Expand description
StdioRpcClient: a JSON-RPC 2.0 client speaking NDJSON over a spawned
tcode serve --stdio child’s stdio pipes (#2060).
Why: the CLI needs to drive the daemon’s session.*/task.* methods
without reimplementing any of their logic. Spawning an ephemeral child
per invocation (rather than discovering/reusing a long-lived daemon) is
the simplest robust M1 approach the ticket calls for — no discovery file,
no port, no lifecycle management beyond this one process’s lifetime.
What: StdioRpcClient::spawn launches the child; StdioRpcClient::call
sends a request and blocks (bounded by DEFAULT_CALL_TIMEOUT) for its
matching response, buffering any interleaved session.event notification
lines rather than dropping them; StdioRpcClient::next_notification
drains that buffer (or reads fresh lines, bounded by a caller-supplied
wait) for the streaming subcommands (attach, run-task).
[classify_notification]/[build_request] are pure helpers, unit tested
here without spawning a real process; the full spawn+wire round trip is
covered by tests/cli_e2e.rs against the real tcode binary.
Test: cli_client::stdio::tests::*.
Structs§
- Stdio
RpcClient - A JSON-RPC 2.0 client over a spawned
tcode serve --stdiochild.
Enums§
- RpcClient
Error - Errors a CLI subcommand handler surfaces to the user (mapped onto a nonzero exit code by the caller — this type carries no exit-code opinion itself).
Constants§
- DEFAULT_
CALL_ TIMEOUT - How long
StdioRpcClient::callwaits for a matching response before giving up.