pub fn build_router(project: PathBuf) -> (Router, Arc<SessionRegistry>)Expand description
Assemble the router (+ its session registry) with every method this
build of tcode knows about, scoped to project.
Why: single place that lists which method groups are wired in, so a new
ticket adding harness.describe touches exactly one line here plus its
own register function. Both transports (run_stdio, run_http) call
this so they can never drift into different method surfaces, and both
need the SAME SessionRegistry instance — run_http hands it separately
to the GET /sessions/{id}/events SSE route, which bypasses the Router
entirely (see crate::serve::http module docs). task.run (#2056) is
the first method that needs project for more than logging — it resolves
agents_dir from it via crate::agents::locate_agents_dir (the same
.claude/agents / .open-mpm/agents convention tcode run-task uses)
and passes both down to spawned executions.
What: builds an empty Router + a fresh SessionRegistry, calls
methods::register, crate::session::protocol::register, and
crate::task::protocol::register on them, and returns both.
Test: run_stdio_router_recognises_proof_of_life_methods,
build_router_wires_session_methods, build_router_wires_task_run.