pub enum ProviderEvent {
Show 28 variants
SessionStarted {
session_id: String,
model: String,
tools: Vec<String>,
},
SessionIdentityObserved {
identity: ProviderSessionIdentity,
},
TurnStarted {
prompt: Option<String>,
},
WorkingObserved,
Text {
text: String,
is_delta: bool,
},
Thinking {
text: String,
},
ToolStarted {
id: String,
name: String,
input_json: String,
agent_id: Option<String>,
},
ToolCompleted {
id: String,
output: String,
is_error: bool,
duration_ms: Option<u64>,
agent_id: Option<String>,
non_execution_kind: Option<String>,
},
TurnCompleted {
usage: TokenUsage,
is_cumulative: bool,
},
ContextWindowUsage {
usage: ContextWindowUsage,
},
TurnInterrupted,
SessionEnded {
result: String,
cost_usd: Option<String>,
is_error: bool,
stop_reason: Option<ProviderStopReason>,
},
Error {
message: String,
},
Ready,
InteractionRequested {
request_id: Option<String>,
interaction_kind: ProviderInteractionKind,
tool_name: String,
title: Option<String>,
prompt: String,
options: Vec<ProviderInteractionOption>,
agent_id: Option<String>,
},
InteractionResolved {
request_id: String,
outcome: ProviderInteractionOutcome,
},
SubagentStarted {
agent_id: String,
agent_type: Option<String>,
description: Option<String>,
},
SubagentStopped {
agent_id: String,
},
RateLimited {
limit_type: ProviderRateLimitKind,
resets_at: Option<String>,
usage_percent: Option<String>,
raw_message: String,
},
HostRequestObserved {
method: String,
params_json: String,
decision: HostRequestDecision,
outcome: HostRequestOutcome,
reason: Option<String>,
},
UnrecognizedNotification {
method: String,
payload_json: String,
},
UserMessage {
text: String,
is_delta: bool,
},
Plan {
steps: Vec<ProviderPlanStep>,
},
AvailableCommandsUpdated {
commands: Vec<ProviderAvailableCommand>,
},
ModeChanged {
mode_id: String,
available: Vec<ProviderModeInfo>,
},
SessionInfoUpdated {
title: Option<String>,
},
UsageUpdated {
used_tokens: Option<u64>,
context_window: Option<u64>,
cost_amount: Option<String>,
cost_currency: Option<String>,
},
ConfigOptionsUpdated {
options: Vec<ProviderConfigOption>,
},
}Variants§
SessionStarted
SessionIdentityObserved
Fields
identity: ProviderSessionIdentityTurnStarted
WorkingObserved
Text
Thinking
ToolStarted
ToolCompleted
Fields
non_execution_kind: Option<String>ACP tool_call_update._meta.nonExecutionKind – Claude’s own
vocabulary for WHY the tool never actually ran:
"user-rejected", "permission-rule", "interrupted",
"cancelled". None for a provider that sends no such field,
or a call that genuinely ran and either succeeded or failed for
real. #[serde(default)] reads a durable record written
before this field existed as None – honest, since that
record could not have carried it either way.
TurnCompleted
ContextWindowUsage
Fields
usage: ContextWindowUsageTurnInterrupted
SessionEnded
Fields
stop_reason: Option<ProviderStopReason>Why the turn stopped, when the transport is ACP and one exists
– mirrors gate4agent’s own StopReason (src/core/ types.rs) one-for-one; this crate cannot depend on
gate4agent (see this crate’s own CLAUDE.md), the same
reason every other wire-typed mirror here exists. None for a
non-ACP transport, and for a durable record written before
this field existed (#[serde(default)]).
Error
Ready
InteractionRequested
Fields
interaction_kind: ProviderInteractionKindtitle: Option<String>The ACP PermissionToolCall.title – the human sentence
describing this particular call (e.g. “Edit files”), when the
source carries one. None means this source never carries a
title at all (a PTY- or hook-sourced interaction has no such
field to read – see gate4agent-shell-native’s construction
sites), never that a title was dropped after arriving.
options: Vec<ProviderInteractionOption>The concrete options the agent is willing to accept a decision
from, in the agent’s own order – an ACP PermissionOption
list verbatim (see ProviderInteractionOption). Empty means
this source has no option list to offer at all (PTY- and
hook-sourced interactions), never that the agent offered zero
and one was dropped.
InteractionResolved
SubagentStarted
SubagentStopped
RateLimited
Fields
limit_type: ProviderRateLimitKindHostRequestObserved
The agent sent a JSON-RPC request to the ACP host – session/ request_permission, fs/read_text_file, fs/write_text_file,
terminal/create, terminal/output, terminal/wait_for_exit,
terminal/kill, terminal/release. decision is read off the
host’s own answer, not re-derived here – see the source
(gate4agent’s AgentEvent::RpcIncomingRequest::decision) for
exactly how. A session/request_permission call the host chose to
defer to an operator arrives here TWICE under different method/
params_json snapshots but the SAME logical request: once as
HostRequestDecision::Deferred when it is recorded, then again as
Granted/Denied once HostPolicy (Yolo/Auto/ReadOnly/Deny)
or an operator decides it – see HostRequestDecision and
HostDecisionAuthority for what each of the four ways a request can
end up decided actually means. This event does not change what the
host does; it exists purely so an operator sees the request AND the
decision instead of the request silently disappearing into a
refusal nobody downstream ever hears about.
Fields
decision: HostRequestDecisionoutcome: HostRequestOutcomeWhether an authorized (Granted) request actually ran cleanly
or failed doing so – see HostRequestOutcome’s own doc
comment for why this is a separate field from decision rather
than a third flavor of Denied. Always Executed for Denied/
Deferred (nothing ran to fail). #[serde(default)] reads a
record from before this field existed as Executed – see
HostRequestOutcome::default.
reason: Option<String>The refusal text behind a Denied decision, when this session
actually computed one – the dangerous-command gate’s own
“blocked by dangerous-command gate: rule=…, argument=…”, or
HostPolicy’s fixed “denied by host policy” sentence. None for
every Granted/Deferred decision (there is nothing to explain),
and for a Denied decision this session’s host handler did not
attach text to – never a placeholder standing in for a reason
nobody computed. Bounded and verbatim, the same
PROVIDER_EVENT_TEXT_MAX_BYTES bound ToolCompleted::output
uses – never summarised or rewritten at the point this is
minted (gate4agent-shell-native’s provider_event).
UnrecognizedNotification
A JSON-RPC notification the reader received but could not classify
into any other ProviderEvent – most commonly a session/update
whose update shape none of the known kinds matched, but also any
other notification method this build has no mapping for. This is a
raw protocol echo, NOT a normal operational event: nothing here has
been validated against a known shape, so a consumer must treat
payload_json as opaque vendor JSON, not a fact to act on.
UserMessage
Echo of a user message, replayed when resuming a loaded session
(ACP transport’s user_message_chunk).
Plan
The agent’s full execution plan, replacing any plan reported
before it (ACP transport’s plan).
Fields
steps: Vec<ProviderPlanStep>AvailableCommandsUpdated
The agent’s slash-command catalog changed (ACP transport’s
available_commands_update).
Fields
commands: Vec<ProviderAvailableCommand>ModeChanged
The session’s active mode changed (ACP transport’s
current_mode_update). available is the mode catalogue the agent
returned at session/new (AcpSession::available_modes()), read
back at the moment this event is minted – current_mode_update
itself carries only the new id, never the catalogue. ACP orders
session/new strictly before any session/update, and the
catalogue never changes after handshake, so by the time a
ModeChanged can exist the same session object’s catalogue is
already the real one: an empty available here always means the
agent announced zero modes, never “not read yet”.
SessionInfoUpdated
Session metadata changed; only the fields that actually changed
are populated (ACP transport’s session_info_update).
UsageUpdated
Context-window consumption and, when reported, turn cost (ACP
transport’s usage_update). cost_amount is a decimal string, not
f64, for the same reason SessionEnded::cost_usd is – so this
type can keep deriving Eq.
Fields
ConfigOptionsUpdated
The full current set of session configuration options (ACP
transport’s config_option_update).
Fields
options: Vec<ProviderConfigOption>