Skip to main content

Event

Enum Event 

Source
pub enum Event {
Show 37 variants AgentStart, ContextUsage { used_tokens: usize, context_window: usize, auto_compact_at: usize, }, Usage { model: String, usage: TokenUsage, estimated: bool, }, CompactionStart { reason: String, before_tokens: usize, }, CompactionEnd { reason: String, result: CompactionResult, }, SkillActivated { id: String, name: String, }, ToolSource { tool: String, source: ToolSource, }, TurnStart { turn: usize, }, MessageStart { role: Role, }, MessageDelta { delta: String, }, MessageEnd { role: Role, content: String, }, ToolCall(ToolCall), ApprovalRequired(ApprovalRequest), PlanProposed(PlanProposal), PlanDecided { decision: PlanDecision, }, GuardrailWarning { tool: String, reason: String, }, GuardrailStop { tool: String, reason: String, }, SelfHealing { attempt: u8, max_attempts: u8, errors: Vec<String>, }, ToolExecutionStart(ToolCall), ToolExecutionEnd(ToolResult), TodoUpdated { todos: TodoState, }, TurnEnd { turn: usize, }, TurnEnded { turn: usize, metadata: TurnEndMetadata, }, CacheAudit(CacheAudit), GateResult(GateResult), MemoryRecalled { recalls: Vec<MemoryRecall>, }, AgentEnd, Error(String), BudgetExceeded { reason: String, }, RetryReason { retry_reason: String, layer: String, }, Recovery { action: RecoveryKind, reason: String, }, ProcessStdin { process_id: String, bytes: usize, }, ProcessStart { process_id: String, program: String, }, ProcessEnd { process_id: String, exit_code: Option<i32>, }, ToolSpill { status: SpillStatus, locator: String, original_bytes: usize, }, RequestPermissions { tool: String, paths: Vec<String>, }, PatchHunk { path: String, hunk: String, },
}
Expand description

Stable event ordering (pi_agent_rust pattern).

Variants§

§

AgentStart

§

ContextUsage

Fields

§used_tokens: usize
§context_window: usize
§auto_compact_at: usize
§

Usage

Fields

§model: String
§estimated: bool
§

CompactionStart

Fields

§reason: String
§before_tokens: usize
§

CompactionEnd

Fields

§reason: String
§

SkillActivated

Fields

§name: String
§

ToolSource

Fields

§tool: String
§source: ToolSource
§

TurnStart

Fields

§turn: usize
§

MessageStart

Fields

§role: Role
§

MessageDelta

Fields

§delta: String
§

MessageEnd

Fields

§role: Role
§content: String
§

ToolCall(ToolCall)

§

ApprovalRequired(ApprovalRequest)

Host UX: tool needs approval (Codex-style ask payload).

§

PlanProposed(PlanProposal)

Host UX: the whole turn’s plan needs approval before anything runs.

§

PlanDecided

The host answered a Event::PlanProposed.

Fields

§decision: PlanDecision
§

GuardrailWarning

Loop detection fired but the turn continues; the warning is also fed back to the model.

Fields

§tool: String
§reason: String
§

GuardrailStop

Loop detection ended the turn.

Fields

§tool: String
§reason: String
§

SelfHealing

A failing turn is being re-prompted with error context.

Fields

§attempt: u8
§max_attempts: u8
§errors: Vec<String>
§

ToolExecutionStart(ToolCall)

§

ToolExecutionEnd(ToolResult)

§

TodoUpdated

The session todo list changed through the opt-in engine todo tool.

Fields

§todos: TodoState

Full replacement state, suitable for hosts to render directly.

§

TurnEnd

Retained so existing host matches still compile. The loop emits only Event::TurnEnded.

Fields

§turn: usize
§

TurnEnded

The one turn-complete event. Hosts that implement auto-continue policy read metadata.

Fields

§turn: usize

Completed loop iteration.

§metadata: TurnEndMetadata

Engine-observed completion facts; hosts decide whether to poke.

§

CacheAudit(CacheAudit)

Debug report describing prompt-cache stability for one provider request.

§

GateResult(GateResult)

Result of an opt-in workspace quality gate.

§

MemoryRecalled

Semantic graph memories selected for this prompt.

Fields

§

AgentEnd

§

Error(String)

§

BudgetExceeded

Fields

§reason: String
§

RetryReason

Fields

§retry_reason: String
§layer: String
§

Recovery

Empty-turn or stuck-tool recovery the host can forward.

Fields

§reason: String
§

ProcessStdin

Fields

§process_id: String
§bytes: usize
§

ProcessStart

Fields

§process_id: String
§program: String
§

ProcessEnd

Fields

§process_id: String
§exit_code: Option<i32>
§

ToolSpill

Fields

§locator: String
§original_bytes: usize
§

RequestPermissions

Fields

§tool: String
§paths: Vec<String>
§

PatchHunk

Fields

§path: String
§hunk: String

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Event

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 Event

Source§

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

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

impl Serialize for Event

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnsafeUnpin for Event

§

impl UnwindSafe for Event

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

Source§

type Output = T

Should always be Self
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.
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