Skip to main content

Module stream

Module stream 

Source
Expand description

The stream-json tracker (Feed 4): the pure state machine behind omni-dev claude-wrap, turning Claude’s --output-format stream-json stdio into ObserveRequests for the SessionsRegistry.

Unlike the other three feeds this one is authoritative. Hooks and the transcript watcher observe a session from the outside and infer what it is doing; the wrapper sits in the stream the Claude VS Code extension itself reads, so it sees the exact protocol events — including can_use_tool, the permission prompt that never reaches a transcript and is therefore invisible to Feeds 1–3 unless the user has the Notification hook installed. See ADR-0057.

Both directions matter. A permission request travels CLI → editor on the child’s stdout as a control_request; its resolution travels editor → CLI on the child’s stdin as a control_response. Correlating the two by request_id is what makes waiting_for_permission exact rather than a guess, so StreamTracker::observe_line takes the Direction a line was seen in.

Nothing here does I/O and nothing here retains conversation content: only the message type/subtype, the identity fields (session_id, cwd, model) and outstanding permission ids are ever read out of a line. Every parse is best-effort — an unparseable or unrecognized line is ignored, never fatal, because the wrapper must fail open (see crate::cli::claude_wrap).

Structs§

StreamTracker
The authoritative session-state machine over one wrapped claude process.

Enums§

Direction
Which side of the wrapped process’s stdio a line was observed on.