Skip to main content

Event

Enum Event 

Source
#[non_exhaustive]
pub enum Event<'a> {
Show 29 variants SessionStart { source: SessionSource, }, SessionEnd, PreToolUse { action: &'a Action, }, PostToolUse { action: &'a Action, result: &'a ToolResult, }, PermissionRequest { action: &'a Action, }, PreCompact { stage: CompactionStage, }, PostCompact { stage: CompactionStage, }, PreGuide { guide: &'a String, }, PostGuide { guide: &'a String, }, PreSensor { sensor: &'a String, }, PostSensor { sensor: &'a String, signals: &'a [Signal], }, PreAutoFix { patch: &'a FixPatch, }, PostAutoFix { patch: &'a FixPatch, applied: bool, }, PreModel { ctx: &'a Context, }, PostModel { out: &'a ModelOutput, }, ModelTokenDelta { text: &'a str, }, SubagentStart { name: &'a str, }, SubagentReport { status: SubagentStatus, }, FileChanged { path: &'a PathBuf, }, CwdChanged { from: &'a PathBuf, to: &'a PathBuf, }, BlueprintNodeEnter { node: &'a str, }, BlueprintNodeExit { node: &'a str, }, TaskCompleted, BudgetWarning { ratio: f32, }, Notification { kind: NotificationKind, }, Error { message: &'a str, }, Stop, Heartbeat { iter: u32, }, Custom { name: &'a str, data: &'a Value, },
}
Expand description

All 27 lifecycle events the framework emits (DESIGN.md §10).

Lifetimes are intentionally borrowed: hooks must not own these references past the call.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

SessionStart

Fields

§

SessionEnd

§

PreToolUse

Fields

§action: &'a Action
§

PostToolUse

Fields

§action: &'a Action
§result: &'a ToolResult
§

PermissionRequest

Fields

§action: &'a Action
§

PreCompact

Fields

§

PostCompact

Fields

§

PreGuide

Fields

§guide: &'a String
§

PostGuide

Fields

§guide: &'a String
§

PreSensor

Fields

§sensor: &'a String
§

PostSensor

Fields

§sensor: &'a String
§signals: &'a [Signal]
§

PreAutoFix

Fields

§patch: &'a FixPatch
§

PostAutoFix

Fields

§patch: &'a FixPatch
§applied: bool
§

PreModel

Fields

§ctx: &'a Context
§

PostModel

Fields

§out: &'a ModelOutput
§

ModelTokenDelta

Streaming-only: a text fragment arrived from Model::stream(). Fires 0..N times between PreModel and PostModel when the AgentLoop is in streaming mode. text is the new fragment (not the accumulator). Tool-call deltas are NOT surfaced here — the loop assembles those and emits the final PostModel with full tool_calls.

Fields

§text: &'a str
§

SubagentStart

Fields

§name: &'a str
§

SubagentReport

Fields

§

FileChanged

Fields

§path: &'a PathBuf
§

CwdChanged

Fields

§from: &'a PathBuf
§to: &'a PathBuf
§

BlueprintNodeEnter

Fields

§node: &'a str
§

BlueprintNodeExit

Fields

§node: &'a str
§

TaskCompleted

§

BudgetWarning

Fields

§ratio: f32
§

Notification

Fields

§

Error

Fields

§message: &'a str
§

Stop

§

Heartbeat

Fields

§iter: u32
§

Custom

Fields

§name: &'a str
§data: &'a Value

Implementations§

Source§

impl<'a> Event<'a>

Source

pub fn name(&self) -> &'static str

Stable string discriminant for matchers and serialization.

Trait Implementations§

Source§

impl<'a> Debug for Event<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Event<'a>

§

impl<'a> RefUnwindSafe for Event<'a>

§

impl<'a> Send for Event<'a>

§

impl<'a> Sync for Event<'a>

§

impl<'a> Unpin for Event<'a>

§

impl<'a> UnsafeUnpin for Event<'a>

§

impl<'a> UnwindSafe for Event<'a>

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> 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, 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.