Expand description
tcode serve daemon: STDIO + HTTP JSON-RPC transports + proof-of-life
methods.
Why: the foundation of the M1 control-plane cut line (#2053) — proves the
transport + router work end-to-end via ping/health before session.*
(#2054), task.* (#2056), and harness.describe (#2066) land on top.
Both transports dispatch through the same Router, so the method
surface can never drift between --stdio and --http.
What: build_router, run_stdio, run_http, DEFAULT_HTTP_PORT, and
the methods/transport/http submodules.
Test: serve::tests::*, serve::methods::tests::*,
serve::transport::tests::*, serve::http::tests::*.
tcode serve daemon: STDIO + HTTP JSON-RPC transports + proof-of-life,
session.*, and task.* methods (#2053, #2054, #2056, #2058,
M1 control-plane cut line).
Why: this module is the foundation the tcode serve binary subcommand
delegates to. It owns assembling the crate::jsonrpc::Router (and,
since #2054, the crate::session::SessionRegistry every session.*/
task.* method shares) and entering whichever transport loop was
requested; main.rs stays a thin clap-to-handler shim, matching the rest
of the crate’s CLI wiring.
What: [build_router] registers every currently-known method group
(today: [methods::register]’s ping/health proof-of-life pair,
crate::session::protocol::register’s eight session.* methods
(including #2058’s read-only session.get_transcript), and (#2056)
crate::task::protocol::register’s task.run — later tickets add
harness.describe #2066 here, one line each). [run_stdio] and
[run_http] both build a router + registry via build_router and hand
them to their respective transport ([transport::run_stdio_loop] /
[http::run_http]) — every method behaves identically over either
transport because both dispatch through the same Router against the
same SessionRegistry. Both also call
SessionRegistry::shutdown_executions before returning, so a graceful
stop (SIGTERM/stdin EOF) gives any in-flight task.run execution a
bounded chance to unwind — the same connection-safe-restart discipline
(issue #534) this crate’s daemons already apply to connections, now
extended to background tasks.
What’s NOT here yet: the transports are independent modes (--stdio xor
--http), not simultaneous; running both at once would need a shared
Arc<Router>/Arc<SessionRegistry> across two concurrently-spawned
tasks, which no current ticket requires (the registry is already Arc,
so this is a small extension when it’s needed).
Test: serve::tests::*.
Modules§
- http
- HTTP JSON-RPC 2.0 transport for
tcode serve --http(#2053, #2054). - methods
- Proof-of-life JSON-RPC methods for
tcode serve(#2053). - transport
- STDIO JSON-RPC transport loop for
tcode serve --stdio(#2053, #2054).
Constants§
- DEFAULT_
HTTP_ PORT - Default TCP port for
tcode serve --httpwhen--portis omitted.
Functions§
- build_
router - Assemble the router (+ its session registry) with every method this
build of
tcodeknows about, scoped toproject. - run_
http - Run
tcode serve --httpto completion. - run_
stdio - Run
tcode serve --stdioto completion.