pub enum AgentCommand {
Show 20 variants
SendMessage {
text: String,
images: Vec<ImagePart>,
image_markers: Vec<usize>,
},
Cancel,
ApproveTool,
ApproveToolAlways,
DenyTool,
ReloadConfig(Config),
ChangeDir(String),
AppendInput(String),
ClearConversation,
SetMessages(Vec<Message>),
SetPlanMode(bool),
Compact {
prompt: Option<String>,
},
Remember {
content: String,
global: bool,
},
Forget {
keyword: String,
},
ShowMemory,
Background {
task: String,
},
RefreshContextStats,
ReloadHooks,
SyncMessages,
Shutdown,
}Expand description
Commands sent FROM the UI TO the agent loop.
Variants§
SendMessage
User sent a message (may include attached file content and/or images).
image_markers[i] is the [Image #N] number printed for images[i]
at paste time. Round-tripped through AgentEvent::RestorePendingImages
so that on VL preprocess failure the TUI can re-attach images with
their ORIGINAL markers — otherwise an UP-recalled [Image #5] text
wouldn’t match a freshly-renumbered restored image. Empty when the
caller has no images (slash commands, queued text from streaming,
CLI single-shot).
Cancel
Cancel current operation.
ApproveTool
Approve a pending tool call.
ApproveToolAlways
Approve and always allow this tool for the session.
DenyTool
Deny a pending tool call.
ReloadConfig(Config)
Reload config from TUI (the single source of truth for in-memory config, including ephemeral OAuth providers). Switches to the new default provider.
ChangeDir(String)
Change working directory.
AppendInput(String)
Append input during streaming — queued and injected before next LLM call.
ClearConversation
Clear conversation history.
SetMessages(Vec<Message>)
Set messages from a resumed session.
SetPlanMode(bool)
Set plan mode (read-only exploration, no edits).
Compact
Manually compact conversation history. prompt is accepted for
forward-compat with an eventual LLM-backed summarize-with-instruction
path; currently unused — this is the mechanical path only.
Remember
Forget
ShowMemory
Background
Run a one-shot task in an isolated background context (read-only-ish
tool subset, independent conversation, capped turns + timeout).
Result is returned via AgentEvent::BackgroundComplete.
RefreshContextStats
Recompute and re-emit a rich ContextStats snapshot. /context sends
this before rendering so the user never sees a stale cache — the
cache is only refreshed on LLM round-trips, so between turns (or
after out-of-turn mutations like inject_post_compress_state) the
snapshot can lag the actual conversation state.
ReloadHooks
Rebuild the hook executor from disk after a /plugin install|uninstall
or other change to plugin state. Cheap (just re-reads JSON files);
does NOT touch provider/model state, unlike ReloadConfig.
SyncMessages
Request a snapshot of the current conversation messages.
The agent responds with AgentEvent::MessagesSync carrying
conversation.messages. Used by the TUI before /bg to ensure
the session has up-to-date message history even when a turn is
still in progress (e.g. waiting for tool approval).
Shutdown
Shutdown the agent.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AgentCommand
impl RefUnwindSafe for AgentCommand
impl Send for AgentCommand
impl Sync for AgentCommand
impl Unpin for AgentCommand
impl UnsafeUnpin for AgentCommand
impl UnwindSafe for AgentCommand
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> 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