Skip to main content

AgentCommand

Enum AgentCommand 

Source
pub enum AgentCommand {
Show 13 variants NewSession { session_id: Option<String>, cwd: String, launch_settings: Value, }, ResumeSession { session_id: SessionId, cwd: String, launch_settings: Value, }, ResumeOrNewSession { session_id: SessionId, cwd: String, launch_settings: Value, }, Prompt { session_id: SessionId, text: String, uuid: String, }, PromptWithImages { session_id: SessionId, text: String, images: Vec<ImageAttachment>, uuid: String, }, Cancel { session_id: SessionId, }, CancelQueuedPrompt { session_id: SessionId, uuid: String, }, SetMode { session_id: SessionId, mode: PermissionMode, }, SetModel { session_id: SessionId, model: String, }, GetContextUsage { session_id: SessionId, }, GetMcpSnapshot { session_id: SessionId, }, PermissionResponse { session_id: SessionId, tool_call_id: ToolUseId, outcome: PermissionOutcome, }, QuestionResponse { session_id: SessionId, tool_call_id: ToolUseId, outcome: QuestionOutcome, },
}
Expand description

UI → agent channel envelope. Each variant maps to one inherent method on forge_agent::ForgeSdkBridge. Named AgentCommand to disambiguate from the higher-level forge_workspace::protocol::Command (UI → workspace) - the two envelopes are deliberately different shapes with overlapping names, and disambiguating the agent-side enum makes which one is meant obvious at every call site.

Variants§

§

NewSession

Fields

§session_id: Option<String>

The id the child runs under, passed as --session-id. None leaves the choice to the CLI. Never combined with a resume: the CLI refuses both flags together, and --session-id is create-only, so it is refused outright when a transcript of that id already exists.

§launch_settings: Value
§

ResumeSession

Fields

§session_id: SessionId
§cwd: String

Working directory for the spawned claude subprocess. claude --resume <id> indexes sessions by the project key derived from this directory; an empty value makes the subprocess inherit forge’s $PWD which usually does not match the resumed session’s project, causing “No conversation found with session ID …” even when the .jsonl exists. Source from the catalog when picking a session by id.

§launch_settings: Value
§

ResumeOrNewSession

Resume session_id; if the resume fails at the transport level (e.g. the underlying .jsonl is missing, locked, or otherwise unreadable by the claude subprocess), automatically retry as NewSession { cwd, … }. Used by every project-rooted entry path (forge, forge <project>, Projects-pane project-header click) so a stale or cross-account catalog entry can’t strand the user with no recoverable session.

Fields

§session_id: SessionId
§launch_settings: Value
§

Prompt

Fields

§session_id: SessionId
§text: String
§uuid: String

The prompt’s own id, stamped on the frame. The CLI emits this prompt’s command_lifecycle frames only under a stamped id, and a view keys its row to those frames by it. Minted by whoever dispatches the prompt.

§

PromptWithImages

Fields

§session_id: SessionId
§text: String
§uuid: String

As on Self::Prompt.

§

Cancel

Fields

§session_id: SessionId
§

CancelQueuedPrompt

Drop one prompt still sitting in the CLI’s queue, by the uuid it was sent under. Answered by crate::Message-side lifecycle state: a prompt the CLI already took cannot be reached this way.

Fields

§session_id: SessionId
§uuid: String
§

SetMode

Fields

§session_id: SessionId
§

SetModel

Fields

§session_id: SessionId
§model: String
§

GetContextUsage

Fields

§session_id: SessionId
§

GetMcpSnapshot

Fields

§session_id: SessionId
§

PermissionResponse

Fields

§session_id: SessionId
§tool_call_id: ToolUseId
§

QuestionResponse

Fields

§session_id: SessionId
§tool_call_id: ToolUseId

Trait Implementations§

Source§

impl Clone for AgentCommand

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for AgentCommand

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AgentCommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more