Join a human entry's text where it is classified

This commit is contained in:
2026-09-28 21:17:59 +02:00
parent 089d8fa1dc
commit 194601aeda
3 changed files with 14 additions and 11 deletions
+4 -5
View File
@@ -1,6 +1,6 @@
import json
from loop_claude.claude_code import assistant_parts, content, parse, part_text, tool_call, typed
from loop_claude.claude_code import assistant_parts, human_text, parse, part_text, tool_call
from loop_claude.outcome import Failure
@@ -13,16 +13,15 @@ def read(path):
def human_turns(entries):
return sum(1 for entry in entries if typed(entry))
return sum(1 for entry in entries if human_text(entry) is not None)
def render(entries):
lines = []
for entry in entries:
lines += [line for part in assistant_parts(entry) if (line := said(part))]
if typed(entry):
text = content(entry)
lines.append("[human] " + (text if isinstance(text, str) else "".join(part["text"] for part in text)))
if (text := human_text(entry)) is not None:
lines.append("[human] " + text)
return "\n\n".join(lines)