Skip to main content

Module tui_client

Module tui_client 

Source
Expand description

CodeEngine — the trusty-code-tui engine adapter driving a long-lived tcode serve --http daemon for the interactive tcode tui (#3415, DOC-50 §3.3/§3.4, epic #3411 Slice 3).

Why: cli_client (above) spawns an EPHEMERAL --stdio child per CLI invocation — the right shape for one-shot commands, wrong for an interactive REPL that needs to hold a session open, stream responses live, and observe workstream activation pushed from OTHER clients. This module is the HTTP counterpart: a thin trusty_code_tui::TuiEngine implementation that discovers an already-running daemon and drives it over pooled HTTP + SSE, translating daemon responses into trusty_code_tui::ReplEvents — no business logic of its own (DOC-39 §2.1 thin-client axiom). What: tui_client::discovery (daemon lookup: TCODE_DAEMON_URL env var -> serve::discovery’s http_addr file -> liveness ping), tui_client::rpc (pooled POST /rpc client, reusing trusty_mcp::{Request,Response} exactly like cli_client::stdio does over STDIO), tui_client::sse (a minimal SSE line pump over reqwest’s byte stream), and tui_client::engine::CodeEngine (the TuiEngine impl itself). Test: tui_client::*::tests for the pure helpers; the full discover/setup/stream/cancel/workstream-activation flow against a mock HTTP daemon in tests/tui_client_engine.rs. CodeEngine — the trusty-code-tui engine adapter for tcode tui (issue #3415, DOC-50 §3.3/§3.4, epic #3411 Slice 3).

Why: see crate::tui_client’s doc comment on the pub mod tui_client; declaration in lib.rs for the full rationale (ephemeral --stdio CLI client vs. long-lived --http TUI client). What: discovery (daemon lookup), rpc (pooled POST /rpc client), sse (SSE line pump), error::EngineError (this module’s unified error type), and engine::CodeEngine (the trusty_code_tui::TuiEngine impl itself — the module most callers want). Test: see each submodule’s own docs; the full engine flow against a mock HTTP daemon lives in tests/tui_client_engine.rs.

Re-exports§

pub use engine::CodeEngine;
pub use engine::build_http_client;
pub use error::EngineError;

Modules§

discovery
Daemon discovery for crate::tui_client::CodeEngine (issue #3415, DOC-50 §3.4).
engine
CodeEngine: the trusty_code_tui::TuiEngine adapter driving a long-lived tcode serve --http daemon (issue #3415, DOC-50 §3.3/§3.4).
error
EngineError: crate::tui_client::CodeEngine’s unified error type.
rpc
RpcHttpClient: a pooled JSON-RPC 2.0 client speaking POST {base}/rpc against a long-lived tcode serve --http daemon (issue #3415).
sse
SseLines: a minimal Server-Sent-Events line pump over a reqwest::Response body (issue #3415).