DERBACH/latent-rubric / scripts /thread_monitor.py
DERBACH's picture
download
raw
1.05 kB
import json,sys,time
from pathlib import Path
name=sys.argv[1];p=Path(f'outputs/threads/{name}_events.jsonl');print(f'Latent Rubric / {name} — persistent Codex thread',flush=True)
print('Full events:',p,flush=True)
with p.open() as f:
while True:
line=f.readline()
if not line:
exit_file=Path(f'outputs/threads/{name}_exit_code')
if exit_file.exists():print('Codex process exit:',exit_file.read_text().strip(),flush=True);break
time.sleep(1);continue
try:e=json.loads(line)
except json.JSONDecodeError:continue
kind=e.get('type');item=e.get('item',{})
if kind=='thread.started':print('Session:',e.get('thread_id'),flush=True)
elif kind=='item.completed' and item.get('type')=='agent_message':print('\n'+item.get('text','')+'\n',flush=True)
elif kind=='item.started' and item.get('type')=='command_execution':print('Running:',item.get('command','')[:240],flush=True)
elif kind in ['error','turn.failed']:print(json.dumps(e),flush=True)
elif kind=='turn.completed':print('Turn completed; usage:',e.get('usage'),flush=True)

Xet Storage Details

Size:
1.05 kB
·
Xet hash:
da6a89868afedc9a28cf2d7a1620e76647168e9b3cfe20fae965d1ec14df78dc

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.