Open every line loop-claude prints with the machine's local time

This commit is contained in:
2026-10-28 18:30:24 +01:00
parent 9014fd0a2c
commit 43e7e96b41
13 changed files with 123 additions and 58 deletions
+3 -4
View File
@@ -1,5 +1,3 @@
import sys
from claude_code.entries import assistant_parts, ends_stream, hit_limit, limit_said, parse_entry, rejected_until
from loop_claude.effects import Effects
from failure import Failure
@@ -7,6 +5,7 @@ from claude_code.reply import Limited
from claude_code.transcript import part_line
from machine_load.memory import ROOM_SHARE
from model_routing.ladder import Rung
from loop_claude.terminal import say
from claude_code.session import Session
PRINTED_TOOL_INPUT = 160
@@ -33,7 +32,7 @@ def run_worker(root: str, args: list[str], env: dict[str, str], effects: Effects
resets.append(resets_at)
for part in assistant_parts(event):
if line := part_line(part, PRINTED_TOOL_INPUT):
print(line, flush=True)
say(line, effects, stdout=True)
return worker_outcome(proc.wait(), result, resets)
@@ -42,7 +41,7 @@ def wait_for_memory(effects: Effects) -> None:
said = False
while (memory := effects.memory()) is not None and not memory.has_room():
if not said:
print(f"waiting to start the worker until at least {ROOM_SHARE:.0%} of the machine's memory is available; {memory.available // 1024} MiB of {memory.total // 1024} MiB is available now", file=sys.stderr, flush=True)
say(f"waiting to start the worker until at least {ROOM_SHARE:.0%} of the machine's memory is available; {memory.available // 1024} MiB of {memory.total // 1024} MiB is available now", effects)
said = True
effects.sleep(MEMORY_POLL)