Skip to main content

AgentEvent

Enum AgentEvent 

Source
pub enum AgentEvent {
    Ready {
        capabilities: AgentCapabilities,
    },
    SessionStarted {
        session: SessionId,
    },
    MessageChunk {
        session: SessionId,
        text: String,
    },
    ThoughtChunk {
        session: SessionId,
        text: String,
    },
    ReadFileRequested {
        session: SessionId,
        request: ReadRequestId,
        path: PathBuf,
    },
    ProposedEdit {
        session: SessionId,
        proposal: ProposalId,
        path: PathBuf,
        old_text: Option<String>,
        new_text: String,
    },
    PermissionRequested {
        session: SessionId,
        request: PermissionRequestId,
        summary: String,
        command: Vec<String>,
        terminal_spec: Option<TerminalSpec>,
    },
    TerminalRequest {
        session: SessionId,
        request: AgentTerminalRequestId,
        operation: AgentTerminalOperation,
    },
    TerminalAttached {
        session: SessionId,
        terminal: TerminalId,
    },
    TurnEnded {
        session: SessionId,
        reason: StopReason,
    },
    Failed {
        session: SessionId,
        message: String,
    },
}
Expand description

What comes back from the agent.

Exhaustive on purpose, like FsEvent: adding a variant should break every loop that has not decided what to do about it.

Variants§

§

Ready

The handshake completed. Emitted once, before any session, so it carries no SessionId — capabilities belong to the agent connection, not to a session.

Fields

§capabilities: AgentCapabilities
§

SessionStarted

Fields

§session: SessionId
§

MessageChunk

Streamed assistant text.

Fields

§session: SessionId
§text: String
§

ThoughtChunk

Streamed reasoning, rendered dimmer than the answer.

Fields

§session: SessionId
§text: String
§

ReadFileRequested

The agent asked us for a file. We answer from the buffer if it is open.

Fields

§session: SessionId
§path: PathBuf
§

ProposedEdit

A proposed edit, as whole-file before/after text — the shape ACP actually uses. old_text is None when the agent is creating a new file.

Fields

§session: SessionId
§proposal: ProposalId
§path: PathBuf
§old_text: Option<String>
§new_text: String
§

PermissionRequested

A tool call awaiting approval. command is an argv array — we never interpolate agent output into a shell string (ARCHITECTURE.md §9.4, §11).

Fields

§session: SessionId
§summary: String
§command: Vec<String>
§terminal_spec: Option<TerminalSpec>

Present only when raw ACP input supplied an exact structured command.

§

TerminalRequest

§

TerminalAttached

Fields

§session: SessionId
§terminal: TerminalId
§

TurnEnded

Fields

§session: SessionId
§reason: StopReason
§

Failed

Fields

§session: SessionId
§message: String

Trait Implementations§

Source§

impl Clone for AgentEvent

Source§

fn clone(&self) -> AgentEvent

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 AgentEvent

Source§

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

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

impl Eq for AgentEvent

Source§

impl PartialEq for AgentEvent

Source§

fn eq(&self, other: &AgentEvent) -> 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 AgentEvent

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.

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.