1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Wire types for the `objectiveai-claude-agent-sdk-runner` stdio
//! NDJSON protocol.
//!
//! The runner is a long-lived stdio server that handles many concurrent
//! requests over a single (stdin, stdout, stderr) triple. The caller
//! tags every `run` request with a string `id`; every line emitted on
//! stdout and stderr carries the same `id` so the caller can
//! demultiplex N concurrent streams.
//!
//! ## Wire shapes
//!
//! Every line is one JSON object terminated by `\n`. By convention,
//! **`type` is the first field, `id` is the second field** on every
//! tagged line. This lets readers locate the id with a small byte
//! scan past the type discriminator and reject foreign lines without
//! fully deserializing the rest. The single exception is
//! process-level `fatal` lines (no `id`), which are emitted on stderr
//! only when the runner is exiting non-zero — those have `type` first
//! and `message` (or any other field) second.
//!
//! Stdout (per-request, both variants of [`StdioOutput`] carry `id`):
//!
//! ```text
//! {"type":"event","id":"<id>","event":<T>}
//! {"type":"end","id":"<id>","status":"ok"}
//! {"type":"end","id":"<id>","status":"cancelled"}
//! {"type":"end","id":"<id>","status":"error","error":"<msg>"}
//! ```
//!
//! Stderr (per-request `diag` carries `id`; process-fatal does not):
//!
//! ```text
//! {"type":"diag","id":"<id>","level":"info|warn|error","message":"..."}
//! {"type":"fatal","message":"..."}
//! ```
//!
//! ## Routing
//!
//! The [`Runner`] dispatcher full-deserializes each stdout line into a
//! [`StdioOutput<SDKMessage>`][StdioOutput] (and each stderr line into
//! a [`StdioError`]) and routes by the `id` field on the parsed value.
//! There's no separate scan layer — every line on these pipes belongs
//! to one of our active requests, so there's nothing to early-exit on.
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;