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
//! `tm sm serve --stdio` — launch the SM JSON-RPC over STDIO adapter (#1291).
//!
//! Why: the SM's PRIMARY, API-first interface (DOC-14 §1A.1). A parent
//! `claude-mpm`/PM drives every `sm.*` method headlessly over newline-delimited
//! JSON-RPC to validate ALL SM functionality before any UI exists (§1A.2). Unlike
//! the generic `tm serve --stdio` MCP bridge (which PROXIES to the HTTP daemon's
//! `/rpc`), the SM adapter runs IN-PROCESS: it builds the SM core + the managed
//! session-manager surface directly (the same handles the daemon wires) so the
//! 13 `sm.*` methods map straight onto them with no extra hop.
//! What: [`run_sm_serve`] initialises a STDERR-ONLY tracing subscriber (so stdout
//! stays a clean JSON-RPC channel), builds an in-process
//! [`DaemonState`](trusty_mpm::daemon::state::DaemonState), and runs
//! [`run_sm_stdio`](trusty_mpm::daemon::sm_stdio::run_sm_stdio) to EOF.
//! Test: dispatch behaviour is covered by `daemon::sm_stdio::tests`; this thin
//! wiring is exercised at runtime via `tm sm serve --stdio`.
use ;
use crateCoordinatorAction;
/// Run the `tm sm serve` subcommand.
///
/// Why: dispatch entry for the SM stdio adapter. Only `--stdio` is a real mode
/// today; any other invocation is a usage error (the HTTP/TUI surfaces are
/// separate tickets), so we fail loudly rather than silently no-op.
/// What: for `Serve { stdio: true }`, inits stderr-only tracing and runs the
/// adapter; for `Serve { stdio: false }`, returns an actionable error.
/// Test: runtime; the adapter dispatch is unit-tested in `daemon::sm_stdio`.
pub async