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
Usage
CompactionStart
CompactionEnd
SkillActivated
ToolSource
TurnStart
MessageStart
MessageDelta
MessageEnd
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: PlanDecisionGuardrailWarning
Loop detection fired but the turn continues; the warning is also fed back to the model.
GuardrailStop
Loop detection ended the turn.
SelfHealing
A failing turn is being re-prompted with error context.
ToolExecutionStart(ToolCall)
ToolExecutionEnd(ToolResult)
TodoUpdated
The session todo list changed through the opt-in engine todo tool.
TurnEnd
Retained so existing host matches still compile. The loop emits only Event::TurnEnded.
TurnEnded
The one turn-complete event. Hosts that implement auto-continue policy read metadata.
Fields
metadata: TurnEndMetadataEngine-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
recalls: Vec<MemoryRecall>AgentEnd
Error(String)
BudgetExceeded
RetryReason
Recovery
Empty-turn or stuck-tool recovery the host can forward.