pub struct RuntimeState {Show 19 fields
pub provider_capabilities: ProviderCapabilitySnapshot,
pub processes: Vec<ManagedProcess>,
pub background_agents: Vec<BackgroundAgent>,
pub timeline: Vec<RuntimeTimelineEvent>,
pub builtin_tool_schema_tokens: usize,
pub ollama_context: Option<OllamaContextInfo>,
pub ollama_placement: Option<OllamaPlacement>,
pub hinted_models: HashSet<String>,
pub offload_warned: HashSet<String>,
pub calls_since_task_update: u32,
pub vision_warned: HashSet<String>,
pub ollama_converged_num_ctx: HashMap<String, u32>,
pub run_started: Option<SystemTime>,
pub run_tokens: RunTokenCounter,
pub run_line_changes: RunLineChanges,
pub truncation_recoveries: u32,
pub empty_continuations: u32,
pub continue_recoveries: u32,
pub auto_compact_suppressed: bool,
}Expand description
Runtime state that is not part of the chat transcript sent to a model, but is useful for UI, slash commands, and debugging.
Fields§
§provider_capabilities: ProviderCapabilitySnapshot§processes: Vec<ManagedProcess>§background_agents: Vec<BackgroundAgent>Subagents detached from their turn via Ctrl+B, newest last.
timeline: Vec<RuntimeTimelineEvent>§builtin_tool_schema_tokens: usizeEstimated token cost of the built-in tool schemas the effect runner
appends to every model request during dispatch. The reducer’s
/context preview builds an MCP-only request and can’t see these, so
the runner reports the figure via Msg::BuiltinToolSchemaTokens and
/context folds it in to match what dispatch actually decides.
ollama_context: Option<OllamaContextInfo>Resolved Ollama context window for the active model (None until the
first turn probes it, or for non-Ollama providers).
ollama_placement: Option<OllamaPlacement>Post-turn /api/ps memory placement for the active model (None until a
turn probes it). Volatile, so it’s tracked separately from the window.
hinted_models: HashSet<String>Models we’ve already shown the proactive auto-fit hint for this session. Session-only (not persisted) so the gentle reminder reappears each launch.
offload_warned: HashSet<String>Models we’ve already warned about VRAM offload this session. Session-only, so the once-per-session warning behaves like the auto-fit hint.
calls_since_task_update: u32Model-call cycles since the task checklist last changed, while a task
sits in_progress. Drives the staleness nudge (see push_call_model);
session-only, reset by every Msg::TasksUpdated.
vision_warned: HashSet<String>Models we’ve already shown the no-vision-model notice for this session. Session-only (not persisted), so the one-shot warning behaves like the auto-fit hint and offload warning.
ollama_converged_num_ctx: HashMap<String, u32>Auto-converge: per-model num_ctx that the post-turn /api/ps check
found fits VRAM, keyed by model id. Session-only (not persisted) because
it depends on whatever else is using VRAM right now; re-derived each
session. Read by build_chat_request below a user override.
run_started: Option<SystemTime>When the current user interaction began. One “turn” in Mermaid is a single
model call + its tools; an agentic run spans many such turns (each tool
follow-up mints a fresh TurnId). This anchors the spinner’s elapsed timer
to the whole run so it doesn’t reset to 0 at every tool step. Set on
submit, read only while generating/executing tools. Session-only.
run_tokens: RunTokenCounterOutput tokens committed in completed phases of the current run (parent turns, subagents, mid-run compactions), so the spinner’s token counter accumulates across tool steps instead of resetting each model call. The live phase’s char-based estimate is added on top at render time.
run_line_changes: RunLineChangesLines added/removed by file-mutating tools (write_file, apply_patch)
across the whole run, summed from each outcome’s exact metadata counts
so the end-of-run summary can show +N/-M without the user totting up
per-call diffs. Reset on submit alongside run_tokens. Session-only.
truncation_recoveries: u32Consecutive auto-compact-and-continue recoveries in the current run after a
context-window truncation. Bounded by settings.compaction.max_truncation_recoveries
(0 = uncapped) and reset whenever the run makes progress, so it caps only
no-progress thrashing on a too-small window. Session-only.
empty_continuations: u32Consecutive turns in the current run that produced no visible output (no
assistant text and no tool calls) — even if the model spent the turn on
hidden reasoning. Under MAX_EMPTY_CONTINUATIONS the run auto-retries the
model call so a stalled turn isn’t left silent; at the cap it stops with a
hint. Reset on a fresh run and whenever a turn makes progress. Session-only.
continue_recoveries: u32Consecutive auto-continuations in the current run after a response hit
the provider’s per-response OUTPUT cap with window room to spare
(compaction can’t help those — the reply is continued in a fresh turn
instead). Bounded by MAX_OUTPUT_CONTINUATIONS; reset whenever a turn
ends any other way. Session-only.
auto_compact_suppressed: boolAuto-threshold compaction failed, so it is paused until a compaction
succeeds, the user runs /compact, or the conversation is switched.
Without this, a summarizer that keeps failing (e.g. a model that can’t
produce the required checkpoint structure) silently retries — and pays
for — a draft + review model call on every subsequent turn. Session-only.
Implementations§
Source§impl RuntimeState
impl RuntimeState
pub fn new(model_id: &str) -> Self
pub fn set_model(&mut self, model_id: &str)
pub fn record_signal(&mut self, signal: RuntimeSignal)
pub fn register_process(&mut self, process: ManagedProcess)
Trait Implementations§
Source§impl Clone for RuntimeState
impl Clone for RuntimeState
Source§fn clone(&self) -> RuntimeState
fn clone(&self) -> RuntimeState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RuntimeState
impl Debug for RuntimeState
Source§impl Default for RuntimeState
impl Default for RuntimeState
Source§impl<'de> Deserialize<'de> for RuntimeState
impl<'de> Deserialize<'de> for RuntimeState
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>,
Auto Trait Implementations§
impl Freeze for RuntimeState
impl RefUnwindSafe for RuntimeState
impl Send for RuntimeState
impl Sync for RuntimeState
impl Unpin for RuntimeState
impl UnsafeUnpin for RuntimeState
impl UnwindSafe for RuntimeState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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