Skip to main content

ProviderEvent

Enum ProviderEvent 

Source
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

Fields

§session_id: String
§model: String
§tools: Vec<String>
§

SessionIdentityObserved

§

TurnStarted

Fields

§prompt: Option<String>
§

WorkingObserved

§

Text

Fields

§text: String
§is_delta: bool
§

Thinking

Fields

§text: String
§

ToolStarted

Fields

§name: String
§input_json: String
§agent_id: Option<String>
§

ToolCompleted

Fields

§output: String
§is_error: bool
§duration_ms: Option<u64>
§agent_id: Option<String>
§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

Fields

§is_cumulative: bool
§

ContextWindowUsage

§

TurnInterrupted

§

SessionEnded

Fields

§result: String
§cost_usd: Option<String>
§is_error: bool
§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

Fields

§message: String
§

Ready

§

InteractionRequested

Fields

§request_id: Option<String>
§interaction_kind: ProviderInteractionKind
§tool_name: String
§title: 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.

§prompt: String
§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.

§agent_id: Option<String>
§

InteractionResolved

Fields

§request_id: String
§

SubagentStarted

Fields

§agent_id: String
§agent_type: Option<String>
§description: Option<String>
§

SubagentStopped

Fields

§agent_id: String
§

RateLimited

Fields

§resets_at: Option<String>
§usage_percent: Option<String>
§raw_message: String
§

HostRequestObserved

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

§method: String
§params_json: String
§outcome: HostRequestOutcome

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

Fields

§method: String
§payload_json: String
§

UserMessage

Echo of a user message, replayed when resuming a loaded session (ACP transport’s user_message_chunk).

Fields

§text: String
§is_delta: bool
§

Plan

The agent’s full execution plan, replacing any plan reported before it (ACP transport’s plan).

Fields

§

AvailableCommandsUpdated

The agent’s slash-command catalog changed (ACP transport’s available_commands_update).

§

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

Fields

§mode_id: String
§

SessionInfoUpdated

Session metadata changed; only the fields that actually changed are populated (ACP transport’s session_info_update).

Fields

§

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

§used_tokens: Option<u64>
§context_window: Option<u64>
§cost_amount: Option<String>
§cost_currency: Option<String>
§

ConfigOptionsUpdated

The full current set of session configuration options (ACP transport’s config_option_update).

Fields

Implementations§

Trait Implementations§

Source§

impl Clone for ProviderEvent

Source§

fn clone(&self) -> Self

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 ProviderEvent

Source§

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

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

impl<'de> Deserialize<'de> for ProviderEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ProviderEvent

Source§

impl PartialEq for ProviderEvent

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ProviderEvent

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
Source§

impl StructuralPartialEq for ProviderEvent

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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