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
ResumeSession
Fields
cwd: StringWorking 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.
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.
Prompt
Fields
PromptWithImages
Cancel
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.