Keep loop-claude's rendering out of the adapter and Claude Code's locations in it

This commit is contained in:
2026-09-28 20:21:01 +02:00
parent 938eaf69fc
commit 711d13b71b
5 changed files with 45 additions and 31 deletions
+6 -7
View File
@@ -1,7 +1,8 @@
import subprocess
from loop_claude.claude_code import assistant_parts, ends_stream, parse
from loop_claude.outcome import Failure
from loop_claude.claude_code import ends_stream, parse, parts, said
from loop_claude.transcript import said
def run_worker(root, args):
@@ -13,12 +14,10 @@ def run_worker(root, args):
done = False
for raw in proc.stdout:
event = parse(raw) or {}
if ends_stream(event):
done = True
elif event.get("type") == "assistant":
for part in parts(event):
if line := said(part, 160):
print(line, flush=True)
done = done or ends_stream(event)
for part in assistant_parts(event):
if line := said(part, 160):
print(line, flush=True)
code = proc.wait()
if code < 0:
return Failure(f"claude killed by signal {-code}")