Answer the third round: show the judge loop-claude's prompts, one records answer per cycle through an interrupt, name the answer's two sources apart
This commit is contained in:
@@ -65,6 +65,13 @@ def human_text(entry: dict) -> str | None:
|
||||
return text if isinstance(text, str) else "".join(part_text(part) or "" for part in parts(entry))
|
||||
|
||||
|
||||
# {"type": "user", "promptSource": "sdk", "message": {"content": "Continue the task; the previous run stopped before it was finished."}}
|
||||
def loop_text(entry: dict) -> str | None:
|
||||
"""What a -p prompt of loop-claude's told the agent."""
|
||||
text = content(entry)
|
||||
return text if entry.get("type") == "user" and entry.get("promptSource") == "sdk" and isinstance(text, str) else None
|
||||
|
||||
|
||||
# What the human types while claude works, written only as this entry:
|
||||
# {"type": "attachment", "attachment": {"type": "queued_command", "commandMode": "prompt", "origin": {"kind": "human"}, "prompt": "B"}}
|
||||
def queued_human_text(entry: dict) -> str | None:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import json
|
||||
|
||||
from loop_claude.claude_code.entries import assistant_parts, human_text, parse_entry, part_text, tool_call
|
||||
from loop_claude.claude_code.entries import assistant_parts, human_text, loop_text, parse_entry, part_text, tool_call
|
||||
from loop_claude.failure import Failure
|
||||
|
||||
JUDGED_TOOL_INPUT = 400
|
||||
@@ -30,6 +30,8 @@ def render(entries: list[dict]) -> str:
|
||||
lines += [line for part in assistant_parts(entry) if (line := part_line(part, JUDGED_TOOL_INPUT))]
|
||||
if (text := human_text(entry)) is not None:
|
||||
lines.append("[human] " + text)
|
||||
elif (text := loop_text(entry)) is not None:
|
||||
lines.append("[loop] " + text)
|
||||
return "\n\n".join(lines)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user