Skip to main content

Module model

Module model 

Source
Expand description

Engine-supplied UI data: StatuslineSegment, PickerItem/PickerRequest, and CommandDescriptor.

Why: DOC-50 §3.2 (Slice 1.5) requires the statusline, pickers, and slash-command help to be driven entirely by data the engine supplies, not by constants baked into the shared crate. Slice 1 shipped provisional stubs for these three types directly in crate::event, flagged as zero-consumer placeholders; this module is their real, spec-shaped home. Splitting them out of event.rs also keeps that module’s focus narrow (the ReplEvent wire vocabulary) versus this module’s focus (the semantic data an engine hands the TUI to render).

What: three families of type, one per generalized surface:

  • StatuslineSegment — an enum, per DOC-50 §3.2’s explicit correction of Slice 1’s flat {label, value} struct.
  • PickerItem / PickerRequest — a named, engine-supplied picker (replacing tagent’s hardcoded PickerKind::{Model,Provider}, crates/trusty-agents/src/repl/tui/types.rs:28-35).
  • CommandDescriptor / CommandRouting — a slash-command registry entry that records whether the shared crate or the engine handles it (replacing tagent’s hardcoded SLASH_COMMANDS array, crates/trusty-agents/src/repl/tui/helpers.rs:156-181).

None of these types encode product-specific formulas or lists (e.g. tagent’s OpenRouter haiku cost formula, crates/trusty-agents/src/repl/tui/status.rs:145-155, or its /model//provider literals) — that logic stays in each engine adapter (AgentEngine, CodeEngine); this crate only defines the shapes the engine populates.

§Spec References

Structs§

CommandDescriptor
One entry in an engine-supplied slash-command registry.
PendingPermission
The permission request currently blocking the turn (#3422).
PermissionResponse
An answer staged for the outer driver to relay to crate::engine::TuiEngine::respond_permission (#3422).
PickerItem
One selectable row in an engine-supplied picker (model, provider, workstream, …).
PickerRequest
A complete engine-supplied picker: what to show, and what selecting an item does.

Enums§

CancelReply
What a backend actually confirmed about a dispatched cancel (#8207).
CommandRouting
Which side of the seam dispatches a CommandDescriptor (DOC-50 §6 Q4, “mixed routing”).
PermissionAnswer
The user’s answer to a PendingPermission (#3422).
StatuslineEmphasis
A generic, wire-safe (JSON, via serde) style hint an engine can attach to a free-form statusline segment (StatuslineSegment::Custom/ StatuslineSegment::Chrome).
StatuslineSegment
One labeled segment of the status line, supplied by the engine.