Skip to main content

Module translation

Module translation 

Source
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_events produced on the MPS scope agent_event:<block_id>. Phase 1.5 PR 1 hook for agent panes. Called only when is_agent is true at spawn time (see read-task closure in start()).
extract_agent_events πŸ”’
Append chunk to line_buf, drain complete lines, JSON-parse each, and run successful parses through translator. Returns the events the translator emitted. Caller is responsible for publishing them.