Skip to main content

Module engine

Module engine 

Source
Expand description

The engine-adapter seam: TuiEngine.

Why: trusty-code-tui renders one interaction model for two different products — trusty-code (daemon-backed coding agent) and trusty-agents (tagent’s REPL). Rather than fork the TUI per product, the TUI stays engine-agnostic and each product supplies a thin TuiEngine implementation that translates user input into its own backend calls and backend responses into crate::ReplEvent values pushed onto the shared channel. See DOC-50 §2.2 for the full architecture rationale.

What: this module defines only the trait — no event loop, no rendering. The event loop that drives handle_input/setup/shutdown lands in Slice 2 (#3414). Slice 1.5 (#3413) adds two data-supply accessors, commands and picker, so the shared crate can render slash-command help and inline pickers from engine-supplied data instead of hardcoded per-product lists (DOC-50 §3.2) — both default to “nothing supplied” so no existing/future TuiEngine implementor breaks by not overriding them. Statusline segments do NOT get a parallel accessor here: Slice 1’s ReplEvent::StatuslineUpdate (pushed from setup/ subscribe_workstream_events) already is the engine-supply mechanism for those; adding a second, pull-based path would just give the shared event loop two sources of truth to reconcile.

§Spec References

Traits§

TuiEngine
Translates one product’s backend (tcode daemon, tagent’s in-process LLM dispatch) into the shared TUI’s vocabulary.