Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Dispatcher — resolves a Command into a DispatchOutput.

The dispatcher is the boundary between “the operator asked for X” and “the engine did Y.” It owns the HTTP client, reads the shared EngineState, and returns structured output that the caller (TUI or non-interactive entrypoint) renders.

Structs§

DispatchContext
Shared context for dispatch. The HTTP client is optional — the TUI launches even when the engine is unreachable, and commands that need it degrade to a clear error line.
DispatchOutput
What the dispatcher produced. Mode changes and quits are separate side-channel effects so the caller can apply them without string-parsing lines back.
ReplayLine
One replayed log entry bound for the conversation pane.
StaticLabel
Trivial StateSource that returns the same label on every call. The default value is Label::Steady — the “no friction, nothing abnormal” label — so a fresh DispatchContext does not accidentally gate commands when the engine has not yet reported a state.

Enums§

Never
Placeholder error type — the dispatcher’s public signature reserves a Result<…> slot for future commands that need to refuse execution rather than emit a warn line.
OutputLine
One atomic output action the caller must handle. A single dispatch can emit multiple — e.g. /help emits several Lines.

Traits§

StateSource
A thin read-only handle to the operator’s current behavioural label. The dispatcher consults this on every risk-increasing command to compute the FrictionDecision.

Functions§

dispatch
Parse, resolve, execute. Returns Ok(None) when the line is empty — callers should skip rendering in that case.
run_bypass_friction
Run a Command without consulting the friction ladder.