pub enum StatuslineSegment {
SessionId(String),
Model {
provider: String,
name: String,
},
Project(String),
Workstream {
id: String,
name: String,
},
Cost(String),
Custom {
label: String,
value: String,
emphasis: StatuslineEmphasis,
},
Chrome {
text: String,
emphasis: StatuslineEmphasis,
},
}Expand description
One labeled segment of the status line, supplied by the engine.
Why: DOC-50 §3.2 specifies the statusline as “enum-driven, engine
populated” — each variant is a semantic kind of thing an engine can
report (a session, the active model, the project, the active
workstream, an approximate cost), not an arbitrary string pair. This
replaces Slice 1’s provisional flat StatuslineSegment { label, value }
(zero consumers today, so the redefinition is free — see that struct’s
removal from crate::event).
What: ReplEvent::StatuslineUpdate(Vec<StatuslineSegment>) carries these
in render order; the Slice 4 status-line widget matches on variant to
decide layout/styling per kind, falling back to Self::Custom for
anything not worth a first-class variant (e.g. tagent’s TM/claude-mpm
session counts, status.rs’s tm_chunk/local_model_chunk).
Self::Cost carries a pre-formatted string rather than raw
token/pricing data — per DOC-50 Q9, cost display is a Phase 2 concern
pending a daemon API, and the shared crate must never contain a pricing
formula (tagent’s OpenRouter haiku formula stays in AgentEngine, not
here).
Variants§
SessionId(String)
The active session’s identifier (e.g. a short session id).
Model
The active LLM provider + model (e.g. provider: "anthropic",
name: "claude-sonnet-5"). Kept as two fields (not one formatted
string) so the widget can style them independently, mirroring
tagent’s LLM: {provider} ({model}) chunk without hardcoding the
provider (model) formatting choice into the shared crate.
Project(String)
The active project name or path.
Workstream
The active workstream (DOC-48 §2.1): id + name, matching
WorkstreamSummary and the Slice 6 status-line example
(“WS: Token rotation (a1b2c3d4)”).
Cost(String)
A pre-formatted, engine-computed cost string (e.g. "$0.0034").
Deferred to Phase 2 per DOC-50 Q9 (no daemon API yet to source real
cost from) — this variant exists so the wire shape doesn’t need a
breaking change once that API lands; no engine populates it yet.
Multi-cost case: Cost carries a single string, not a label +
value pair, so an engine that wants to show more than one cost
figure at once (tagent shows both the current session’s cost and
the day’s running total, status.rs’s session_cost/daily_cost)
bakes the distinction into the string itself and emits multiple
Cost segments — e.g. Cost("$0.0034 session") and
Cost("$0.0145 today") — matching tagent’s existing "{cost} session" / "{cost} today" suffix convention
(crates/trusty-agents/src/repl/tui/status.rs’s format_cost_value
call sites) rather than inventing a new labeled-cost shape here.
Custom
Escape hatch for an engine-specific segment that doesn’t warrant a
first-class variant (e.g. tagent’s TM: N sessions / MPM: N sessions counts). label is the short prefix, value is the
rendered text; emphasis is the same wire-safe style hint
Chrome carries — added so a labeled segment like
MPM: 2 sessions can render bold/accented the way tagent’s
status.rs distinguishes it from the plainer TM: N sessions
segment, without the shared crate encoding either label’s meaning.
Chrome
Free-form styled text with no label: value structure — the
generalization of tagent’s un-labeled statusline chrome (the bold-
cyan "[trusty-agents] " bracket prefix, the green "✓ " / "All systems go." success framing, status.rs’s style_status_chunk).
Why a separate variant from Custom rather than an empty label:
Custom’s renderer always emits the "{label}: " separator, which
is wrong for chrome that isn’t a label/value pair at all — an empty
label would still render ": ✓ All systems go.".
What: text renders verbatim, styled per emphasis. No tagent-
specific color/text is hardcoded here — the engine supplies both.
Trait Implementations§
Source§impl Clone for StatuslineSegment
impl Clone for StatuslineSegment
Source§impl Debug for StatuslineSegment
impl Debug for StatuslineSegment
Source§impl<'de> Deserialize<'de> for StatuslineSegment
impl<'de> Deserialize<'de> for StatuslineSegment
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for StatuslineSegment
Source§impl PartialEq for StatuslineSegment
impl PartialEq for StatuslineSegment
Source§impl Serialize for StatuslineSegment
impl Serialize for StatuslineSegment
impl StructuralPartialEq for StatuslineSegment
Auto Trait Implementations§
impl Forget for StatuslineSegment
impl Freeze for StatuslineSegment
impl Move for StatuslineSegment
impl RefUnwindSafe for StatuslineSegment
impl Send for StatuslineSegment
impl Sync for StatuslineSegment
impl Unpin for StatuslineSegment
impl UnsafeUnpin for StatuslineSegment
impl UnwindSafe for StatuslineSegment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more