pub struct RuntimeState {Show 13 fields
pub provider_capabilities: ProviderCapabilitySnapshot,
pub processes: Vec<ManagedProcess>,
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 ollama_converged_num_ctx: HashMap<String, u32>,
pub run_started: Option<SystemTime>,
pub run_committed_tokens: usize,
pub truncation_recoveries: u32,
pub empty_continuations: u32,
}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>§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.
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_committed_tokens: usizeEstimated tokens generated in completed phases of the current run, so the spinner’s token counter accumulates across tool steps instead of resetting each model call. The live phase’s estimate is added on top at render time.
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.
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
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> 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