feat: add official Codex skill and harden task execution
Install and update artemis-use with task diagnostics and plugin guidance. Preserve cross-device file receipts, review canonical reports, guard stage transitions and reduce small history summaries. Improve exploration lifecycle, request recovery and browser live connections.
This commit is contained in:
1 parent
2328a4df0c
commit
e1ea099592
128 files changed
+4944
-700
No files matched your search
@@ -0,0 +1,62 @@
|
||||
"""Model-facing runtime receipts, outside the truncatable plugin observation."""
|
||||
|
||||
import json
|
||||
|
||||
from artemis.plugins.prompt_budget import bounded_result_text
|
||||
|
||||
|
||||
def attachment_fields(attachments: list) -> list[dict]:
|
||||
return [
|
||||
{
|
||||
key: value[:1000] if isinstance(value, str) else value
|
||||
for key in ("path", "name", "bytes", "sha256", "media_type")
|
||||
if isinstance(value := item.get(key), (str, int))
|
||||
}
|
||||
for item in attachments[:8]
|
||||
if isinstance(item, dict)
|
||||
]
|
||||
|
||||
|
||||
def step_attachment_receipts(step: dict) -> str:
|
||||
"""Keep actual exported paths through every history compaction level."""
|
||||
result = step.get("last_execution_result")
|
||||
actions = result.get("execution") if isinstance(result, dict) else None
|
||||
if not isinstance(actions, list):
|
||||
actions = step.get("action_taken")
|
||||
actions = actions if isinstance(actions, list) else [actions]
|
||||
rows = []
|
||||
for action in actions:
|
||||
if not isinstance(action, dict) or not action.get("plugin_id"):
|
||||
continue
|
||||
attachments = action.get("attachments")
|
||||
if isinstance(attachments, list) and attachments:
|
||||
rows.append(
|
||||
{
|
||||
"plugin": action["plugin_id"],
|
||||
"attachments": attachment_fields(attachments),
|
||||
**({"omitted": len(attachments) - 8} if len(attachments) > 8 else {}),
|
||||
}
|
||||
)
|
||||
return json.dumps(rows, ensure_ascii=False) if rows else ""
|
||||
|
||||
|
||||
def result_blocks(text: str, *, call_id: str = "", attachments=None) -> list[dict]:
|
||||
blocks = []
|
||||
if isinstance(attachments, list) and attachments:
|
||||
# Only callers holding runtime-validated metadata may supply these.
|
||||
# Never extract alleged receipts from plugin prose/structured_content.
|
||||
receipts = attachment_fields(attachments)
|
||||
receipt = {"attachments": receipts}
|
||||
if len(attachments) > 8:
|
||||
receipt["omitted"] = len(attachments) - 8
|
||||
blocks.append(
|
||||
{
|
||||
"type": "text",
|
||||
"text": (
|
||||
"ARTEMIS verified file receipts (task trace paths; content correctness is not verified):\n"
|
||||
+ json.dumps(receipt, ensure_ascii=False)
|
||||
),
|
||||
}
|
||||
)
|
||||
blocks.append({"type": "text", "text": bounded_result_text(text, call_id=call_id)})
|
||||
return blocks
|
||||
Reference in new issue
Block a user