//! The Claude Code driver: `claude -p` speaking stream-json on stdio, //! translated into the common event model. //! //! This half owns the process -- starting it, *adopting one this server //! left running*, writing lines to it, and ending it. Where it runs is //! `session::transport`'s business, not this file's: this one emits a //! `Launch` and never learns whether it became a local child or an ssh //! invocation. //! //! The process is meant to outlive the server, so that restarting the //! backend does not end a turn: its stdio lives in the session directory //! (a fifo it holds open itself, plus logs read from a byte offset) and //! `session::process` records what it is. Everything comes through //! [`ClaudeDriver::launch`], which adopts if it can and starts if it //! cannot -- `--resume` is reachable only on the second path, because two //! CLIs on one session file duplicate the conversation into it. //! Turning a line into [`Event`]s is [`translate`], which changes when the //! CLI's wire format does rather than when any of the above does. //! //! The probing record below stays here, since it is the provenance for //! both halves: the flags are this file's, the message catalogue is what //! `translate` implements. //! //! Wire format pinned against CLI 2.1.237 by probing (2026-08-24; scripts //! summarized here since they live outside the repo): //! //! - Outbound: `system/init` (carries `session_id`, the `--resume` token), //! `stream_event` (raw API deltas; `text_delta` is the streaming text), //! consolidated `assistant` messages (their `tool_use` blocks have the //! complete input), `user` messages with `tool_result` blocks, a `result` //! per turn (usage + cost), `control_request` for anything needing a //! human, `control_response` answering ours. //! - Permission prompts require the hidden `--permission-prompt-tool stdio` //! flag; they arrive as `control_request{subtype:can_use_tool}` and are //! answered with `{behavior:"allow",updatedInput}` or //! `{behavior:"deny",message}`. `AskUserQuestion` uses the same shape, //! with the chosen labels added to `updatedInput` as //! `answers:{: