pub enum Cmd {
Show 20 variants
CallModel {
turn: TurnId,
request: ChatRequest,
},
CompactConversation {
turn: TurnId,
request: CompactionRequest,
},
ExecuteTool {
turn: TurnId,
call_id: ToolCallId,
source: ToolCall,
model_id: String,
},
CancelScope(TurnId),
SaveConversation(ConversationHistory),
SaveCompactionArchive(CompactionArchive),
PersistLastModel(String),
PersistReasoningFor {
model_id: String,
level: ReasoningLevel,
},
RefreshInstructions,
LoadConversation(String),
ListConversations,
InitMcpServers(HashMap<String, McpServerConfig>),
StopMcpServer {
name: String,
},
PullOllamaModel {
model: String,
},
OpenInSystem(PathBuf),
DismissStatusAfter {
ms: u64,
},
WriteImageToTemp {
path: PathBuf,
bytes: Vec<u8>,
format: String,
},
ReadClipboard,
Exit,
SetTerminalTitle(String),
}Expand description
A single side-effect request. Most variants are one-shot; CallModel
and ExecuteTool spawn long-running tasks inside a per-turn
TurnScope.
Variants§
CallModel
Dispatch the next chat request. Effect runner maps this onto
ModelProvider::chat for the session’s active provider.
CompactConversation
Generate a compact context checkpoint without continuing into a normal assistant turn.
ExecuteTool
Run one tool in parallel with any other tools in the same turn.
The runner wires ExecContext::token to the turn’s scope so
Cmd::CancelScope aborts them all at once.
model_id is the active session’s model id at the moment this
tool call was emitted. The runner passes it into ExecContext
so tools like SubagentTool can spawn children against the
same provider the parent is using.
CancelScope(TurnId)
Cancel every task in the given turn’s TurnScope. After the
scope drains, the runner emits a Msg::StreamDone (with a
synthetic “cancelled” marker in usage, or a batch of
ToolFinished { outcome: Cancelled } for tools already running)
so the reducer can transition back to Idle.
SaveConversation(ConversationHistory)
Save the current conversation to disk. No-op if unchanged since last save (effect-side idempotence).
SaveCompactionArchive(CompactionArchive)
Persist the raw messages removed by a compaction.
PersistLastModel(String)
Persist the active model ID as last_used_model.
PersistReasoningFor
Persist reasoning level tied to a specific model ID.
RefreshInstructions
Re-stat MERMAID.md (cheap); emits Msg::InstructionsChanged
only when the mtime moved or the file appeared/disappeared.
LoadConversation(String)
Load a specific conversation by ID and emit
Msg::ConversationLoaded. Reducer consumes that event to
replace the current session.
ListConversations
Scan the conversations directory for the /load picker. Emits
Msg::ConversationsListed with one ConversationSummary per
saved session (newest first). The reducer transitions to
UiMode::ConversationList and the render shows the picker.
InitMcpServers(HashMap<String, McpServerConfig>)
Start every configured MCP server; each one emits
Msg::McpServerReady or Msg::McpServerErrored as it comes up.
StopMcpServer
Stop a running server (e.g. config was removed, or app quit).
PullOllamaModel
ollama pull <model> with progress → Msg::ModelPullFinished.
OpenInSystem(PathBuf)
xdg-open / open / start on a file path. Used by the
image-paste preview and the “open in editor” affordance.
DismissStatusAfter
Schedule Msg::StatusDismiss after ms milliseconds. Reducer
uses this to self-clear transient status lines.
WriteImageToTemp
Persist a pasted image to a temp file so the TUI can open it
via OpenInSystem. Emits no follow-up Msg on success; failure
is a log-and-drop.
ReadClipboard
Read the system clipboard on a blocking task. The per-platform
dispatch (xclip / wl-paste / pngpaste / PowerShell) can block
for hundreds of ms on macOS via osascript, so it never runs on
the reducer thread. Emits Msg::Paste(Paste::Image|Text) on
success; Msg::TransientStatus when the clipboard is empty or
the read fails.
Exit
Exit the main loop. No reply message — the loop observes
state.should_exit after the reducer returns and breaks out.
SetTerminalTitle(String)
Write the OSC 2 terminal-title sequence. Reducer diffs
against ui.last_title_dispatched so this only fires on
actual title changes, not every frame.
Implementations§
Source§impl Cmd
impl Cmd
Sourcepub fn tag(&self) -> &'static str
pub fn tag(&self) -> &'static str
Human-readable tag, for tracing + replay logs. Stable across refactors (tests assert against it).
Sourcepub fn is_turn_scoped(&self) -> bool
pub fn is_turn_scoped(&self) -> bool
True iff this command needs to run inside a TurnScope so it
can be cancelled by Cmd::CancelScope. The effect runner uses
this to decide between “spawn into JoinSet” and “spawn detached”.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cmd
impl RefUnwindSafe for Cmd
impl Send for Cmd
impl Sync for Cmd
impl Unpin for Cmd
impl UnsafeUnpin for Cmd
impl UnwindSafe for Cmd
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.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, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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 moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more