pub enum TriggerEvent {
TriggerHandlingStart {
idempotency_key: String,
source_kind: SourceKind,
source_label: String,
event_label: String,
trace_id: String,
},
TriggerHandled {
idempotency_key: String,
trace_id: String,
state: TriggerState,
audit_entry_id: Option<String>,
evaluator_decision: Option<Value>,
},
TriggerPromptRequest {
request: TriggerPromptRequest,
},
PersistenceError {
context: String,
message: String,
},
TriggerExecutionStarted {
trace_id: String,
source_label: String,
event_label: String,
prompt_preview: String,
},
TriggerCompleted {
trace_id: String,
summary: Option<String>,
cost_usd: Option<f64>,
details: Value,
},
TriggerFailed {
trace_id: String,
reason: String,
},
TriggerRequestsMainRun {
trace_id: String,
},
TriggerPromoted {
trace_id: String,
promote_kind: String,
inserted_entry_id: String,
template_name: Option<String>,
redaction_status: String,
},
PromotionPending {
trace_id: String,
promote_kind: String,
template_name: Option<String>,
preview: Option<String>,
},
}Expand description
Event emitted by the trigger executor as a trigger moves through its lifecycle.
Variants§
TriggerHandlingStart
The executor has admitted a Trigger for processing — fires immediately at the
start of TriggerExecutor::handle_trigger before evaluation. Carries the source
identification needed to render a “processing X” banner. RFC 1 §2.7.
Fields
source_kind: SourceKindTriggerHandled
Terminal: the trigger reached an end state. state is one of the terminal variants
(Accepted / Deduped / CycleSuppressed / PermissionDenied / NeedsApproval).
audit_entry_id is the SessionTreeEntry::Custom id when persistence succeeded,
None if persistence failed (a parallel PersistenceError event will describe
the failure).
evaluator_decision mirrors what was persisted in the audit record (same JSON
shape) so live subscribers (TUI banner, /triggers, JSONL logs) can render why
the trigger reached its state without a secondary session lookup. Shape:
- Accept (Allow):
{ "outcome": "accept", "permission": "allow" } - Accept (Deny):
{ "outcome": "accept", "permission": "deny", "reason": ... } - Accept (Prompt):
{ "outcome": "accept", "permission": "prompt", "reason": ... } - Deduped:
{ "outcome": "deduped", "replacement_policy": ..., "previous_trace_id": ... } - CycleSuppressed:
{ "outcome": "cycle_suppressed", "hop_count": N }
None only when audit serialization failed (a PersistenceError will accompany).
Fields
state: TriggerStateTriggerPromptRequest
A trigger admitted by the dedup / cycle evaluator reached
BeforeTriggerDecision::Prompt and is awaiting an embedder-owned user decision.
The prompt is bound by trigger_prompt_id, not by a tool-call id / args hash, so a
decision cannot be replayed onto a different trigger envelope. The executor also
writes a trigger_prompt Custom audit entry when the prompt resolves.
Fields
request: TriggerPromptRequestPersistenceError
Best-effort persistence error reflux from the trigger engine. The trigger itself
still produced a TriggerHandled event with audit_entry_id = None; this event
explains why so that observability (TUI banner, /triggers, JSONL logs) can mark
the audit as best-effort lost rather than dropping it silently.
context is free-form with pinned strings: "trigger_audit", "trigger_result",
"trigger_prompt", "trigger_promotion", "trigger_inject_and_run". New write
sites must pin themselves to a stable string.
Fields
TriggerExecutionStarted
A sub-agent execution started for an accepted trigger. Emitted by the spawned task
just before the sub-agent’s first turn runs. prompt_preview is the first ~80
characters of the resolved action prompt, preview-safe for banners.
TriggerCompleted
A sub-agent execution finished successfully and the parent trigger_result audit
entry has been written. summary is the sub-agent’s self-summary (size-capped at
4 KiB). cost_usd is None when the bare sub-Agent had no CostTracker wrapper
(mirrors the audit’s cost_usd: null).
details is the structured sub-agent result envelope populated through marker tools
(see TriggerResultDetailsBuilder). Defaults to serde_json::Value::Null.
Authorization for PromoteAction::PromoteSummaryWhenResultDetailsMatch flows
exclusively through this field — summary is display-only.
TriggerFailed
A sub-agent execution failed (agent loop error, panic-via-spawn-error, or aborted by
TriggerExecutor::abort_trigger / abort_all_triggers). reason is sanitized —
never contains raw payload, provider response bodies, or credential material. The
parent trigger_result audit entry has been written with success: false.
TriggerRequestsMainRun
An TriggerDelivery::InjectAndRun trigger has injected its prompt into the idle
parent conversation and is asking the embedder to run ONE model turn in the parent’s
full context. The executor never runs the single-tenant parent agent itself from the
detached trigger task, so it delegates: the embedder (which owns the parent agent
and its input loop) should funnel this through the same serialized path as user
input and call AgentHarness::continue_. Emitted only on the idle path — when the
parent is mid-turn the runtime enqueues a follow-up instead and this event is NOT
emitted.
TriggerPromoted
A trigger’s PromoteAction rendered successfully and the executor committed to
surfacing the sub-agent result to the user / LLM. theway_llm_provider has no System
role today; the inserted entry is a Message::User with a [Trigger ...] body
prefix so the LLM disambiguates trigger-driven context from human input.
inserted_entry_id semantics depend on the parent agent state at promotion time:
- Idle parent: durable id of the appended
Message::User(matches the audit). - Streaming parent (queued through the loop’s follow-up queue): empty string
because the session entry ID is only known after the loop drains the queue.
Consumers should correlate by
trace_idin this case.
Fields
PromotionPending
A trigger’s PromoteAction was held pending approval (promote_requires_approval = true) and is awaiting an explicit /triggers approve <trace_id>. The parent
transcript has NOT been modified; a trigger_promotion audit entry with
state: "pending" has been written. preview is the rendered template body the
approval UI would surface, or None when the render itself would have failed.
Trait Implementations§
Source§impl Clone for TriggerEvent
impl Clone for TriggerEvent
Source§fn clone(&self) -> TriggerEvent
fn clone(&self) -> TriggerEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TriggerEvent
impl RefUnwindSafe for TriggerEvent
impl Send for TriggerEvent
impl Sync for TriggerEvent
impl Unpin for TriggerEvent
impl UnsafeUnpin for TriggerEvent
impl UnwindSafe for TriggerEvent
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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::RequestSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more