Expand description
Agent-event extraction and translation (Phase 1.5 PR 1). Feeds agent-pane
stdout through the Claude stream-json translator and publishes AgentEvents.
ConstantsΒ§
- AGENT_
LINE_ πBUFFER_ CAP - Maximum size of the per-block line buffer used by the agent-event translation path. Past this, the buffer is reset (a producer that never emits a newline canβt grow it unboundedly). 1 MiB is far beyond any plausible stream-json frame size.
FunctionsΒ§
- accumulate_
and_ πtranslate - Publish the events
extract_agent_eventsproduced on the MPS scopeagent_event:<block_id>. Phase 1.5 PR 1 hook for agent panes. Called only whenis_agentis true at spawn time (see read-task closure instart()). - extract_
agent_ πevents - Append
chunktoline_buf, drain complete lines, JSON-parse each, and run successful parses throughtranslator. Returns the events the translator emitted. Caller is responsible for publishing them.