Expand description
Claude Code stream-json → AgentEvent translator.
Mirrors the frontend reference implementation at
frontend/app/view/agent/providers/claude-translator.ts so the
drone Agent block can consume the same stream without
round-tripping through the renderer. Handled frames:
stream_event.content_block_start.content_block.type=text— starts a text block; subsequenttext_deltas belong to it.stream_event.content_block_start.content_block.type=tool_use— starts an in-flight tool_use; subsequentinput_json_deltas accumulate;content_block_stopemits the finalizedAgentEvent::ToolUse.stream_event.content_block_delta.delta.type=text_delta—AgentEvent::AssistantText(also accumulated into the final response).stream_event.content_block_delta.delta.type=input_json_delta— appends to the pending tool_use’s partial_json.stream_event.content_block_stop— flushes the pending tool_use.user.message.content[].type=tool_result— emitsAgentEvent::ToolResult.result.cost_usd+result.usage— emitsAgentEvent::Costfollowed byAgentEvent::Done. The Done’sresponseis the explicitresult.resultfield if present, otherwise the accumulated text from streamed text_deltas.
Unknown frame types and malformed shapes produce an empty Vec
rather than panicking — the runner falls back to whatever the
parallel raw-byte WPS path published, so an unfamiliar frame
degrades gracefully.
thinking_delta and message_delta / message_stop are
discarded (the agent pane filters them too).