Skip to main content

AgentEvent

Enum AgentEvent 

Source
pub enum AgentEvent {
Show 13 variants Ready { capabilities: AgentCapabilities, }, SessionStarted { session: SessionId, }, ModesAvailable { session: SessionId, current: String, available: Vec<SessionMode>, }, ModeChanged { session: SessionId, mode: String, }, 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>, edit: Option<ProposedEditDiff>, }, 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
§

ModesAvailable

What the agent will let this session do, and which of those it started in (ADR-0015). Absent for agents that do not offer modes, which is most of them.

Fields

§session: SessionId
§current: String
§available: Vec<SessionMode>
§

ModeChanged

The agent reports the session is now in mode. The agent’s account is the truth, so this is what updates the client — not the response to our own request.

Fields

§session: SessionId
§mode: String
§

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.

§edit: Option<ProposedEditDiff>

The edit this permission would authorise, when the agent described one.

An agent that asks before editing is an agent whose edits can be reviewed, so this is what turns an “allow?” prompt into a diff (ADR-0016 §1).

§

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<(), Error>

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> Instrument for T

Source§

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

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

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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