Expand description
TcodeConnector — tcode’s WorkstreamConnector implementation
(DOC-44 twin Phase 1, issue #3007).
Why: DOC-44 §5.2 assigns tcode’s connector to wrap the #2983 REST bridge
(crate::serve::rest) rather than reimplementing session.* business
logic — every REST route already just forwards to the identical
JSON-RPC method (crate::session::protocol) both serve --stdio and
serve --http POST /rpc dispatch through (see crate::serve::rest
module docs), so this connector calling REST is provably the SAME code
path a POST /rpc caller would hit. attach is the one exception —
there is no GET/POST REST route for session.attach (the vision spec
§4.4 SSE route, GET /sessions/{id}/events, is the real HTTP
live-streaming mechanism; session.attach itself only returns the
ring-buffer replay + that stream’s URL) — so attach goes over
POST /rpc directly, exactly as tests/session_e2e.rs’s HTTP scenario
already does.
What: TcodeConnector::new targets the default tcode serve --http
port (crate::serve::DEFAULT_HTTP_PORT, 7882);
TcodeConnector::with_daemon_url targets an explicit daemon (every test
in tests/connector_e2e.rs uses this against a --port 0 instance). Every
trait method’s doc comment states the exact route/method it maps onto.
delegate is NOT implemented — see that method’s docs (DOC-44 locked
decision 3).
Test: tests/connector_e2e.rs (a top-level integration test — trusty-code
has no tests/support-reachable unit-test seam for driving the REAL
tcode binary, so this mirrors tests/session_e2e.rs’s own placement)
drives every method against a real tcode serve --http --port 0 process
via support::spawn_http_daemon.
Structs§
- Tcode
Connector - tcode’s
WorkstreamConnectorimplementation over the #2983 REST bridge (+POST /rpcforattach).