Skip to main content

StatuslineSegment

Enum StatuslineSegment 

Source
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.

Fields

§provider: String
§name: String
§

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)”).

Fields

§name: String
§

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.

Fields

§label: String
§value: String
§

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.

Fields

§text: String

Trait Implementations§

Source§

impl Clone for StatuslineSegment

Source§

fn clone(&self) -> StatuslineSegment

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StatuslineSegment

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for StatuslineSegment

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for StatuslineSegment

Source§

impl PartialEq for StatuslineSegment

Source§

fn eq(&self, other: &StatuslineSegment) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for StatuslineSegment

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for StatuslineSegment

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more