Skip to main content

Module engine

Module engine 

Source
Expand description

CodeEngine: the trusty_code_tui::TuiEngine adapter driving a long-lived tcode serve daemon over its Unix socket (issue #3415, DOC-50 §3.3/§3.4; retransported in #6637).

Why: see crate::tui_client’s module docs for the ephemeral---stdio vs. long-lived-daemon client distinction. This module is the TuiEngine impl itself — uds_rpc exists to support it. Split across sibling files (issue #610’s 500-SLOC production-file cap): engine_state.rs holds [super::engine_state::EngineState] (the actual session/cache/streaming logic), session_events.rs holds the pure Event -> ReplEvent mapping, workstream_subscription.rs holds the background workstream-activation SSE loop, splash.rs holds the startup splash’s pure text assembly (#8164). This file keeps only the public CodeEngine wrapper and the TuiEngine impl that delegates into EngineState. What: CodeEngine is a thin Arc<EngineState> wrapper so the background workstream-subscription task spawned by subscribe_workstream_events can share the SAME state (and refresh the SAME caches) without a second, divergent copy. trusty-code-tui Slice 1.5 (#3428, merged) added the SYNCHRONOUS TuiEngine::commands()/ picker(name) accessors this impl TuiEngine block implements directly (not as inherent methods — see the impl TuiEngine for CodeEngine block’s commands/picker for why serving from EngineState’s std::sync::Mutex-guarded caches, populated during setup(), is the only way to satisfy a synchronous trait method with no I/O on the calling path). Test: engine_tests::* (in the sibling engine_tests.rs, included below) for the pure event-mapping/parsing helpers this module’s siblings define; the full setup -> stream -> cancel -> workstream-activation flow against a real daemon socket lives in tests/tui_client_engine.rs.

Structs§

CodeEngine
The trusty_code_tui::TuiEngine adapter for tcode tui — see module docs.

Enums§

CancelOutcome
What a session.cancel achieved (#8207).