pub enum AgentCommand {
List,
Spawn {
name: String,
prompt: String,
},
Background {
name: String,
prompt: String,
},
Status,
Cancel {
id: String,
},
Approve {
id: String,
},
Deny {
id: String,
},
Mention {
agent: String,
prompt: String,
},
Resume {
id: String,
prompt: String,
},
}Expand description
Typed representation of a parsed /agent CLI command or @agent mention.
Variants§
List
Spawn
Background
Status
Cancel
Approve
Deny
Mention
Foreground spawn triggered by @agent_name <prompt> mention syntax.
Resume
Resume a previously completed sub-agent session by ID prefix.
Implementations§
Source§impl AgentCommand
impl AgentCommand
Sourcepub fn parse(
input: &str,
known_agents: &[String],
) -> Result<Self, SubAgentError>
pub fn parse( input: &str, known_agents: &[String], ) -> Result<Self, SubAgentError>
Parse from raw input text.
The input must start with /agent. Everything after that prefix is
interpreted as <subcommand> [args].
§Errors
Returns SubAgentError::InvalidCommand if:
inputdoes not start with/agent- the subcommand is missing (empty after prefix)
- required arguments are missing
- the subcommand is not recognised
Also handles @agent_name prompt mention syntax when known_agents
contains a match. If @ prefix is present but the agent is unknown,
returns Err so the caller can fall back to file-reference handling.
Sourcepub fn parse_mention(
input: &str,
known_agents: &[String],
) -> Result<Self, SubAgentError>
pub fn parse_mention( input: &str, known_agents: &[String], ) -> Result<Self, SubAgentError>
Parse an @agent_name <prompt> mention from raw input.
Returns Ok(Mention { agent, prompt }) if input starts with @ and the
token after @ matches one of known_agents. Returns
SubAgentError::InvalidCommand if:
inputdoes not start with@- the agent name token is empty (bare
@) - the named agent is not in
known_agents— caller should fall back to other@handling such as file references
§Errors
Returns SubAgentError::InvalidCommand on any parse failure.
Trait Implementations§
Source§impl Debug for AgentCommand
impl Debug for AgentCommand
Source§impl PartialEq for AgentCommand
impl PartialEq for AgentCommand
impl StructuralPartialEq for AgentCommand
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request