Skip to main content

Event

Enum Event 

Source
pub enum Event {
Show 17 variants TurnBegin { user_input: UserInput, }, TurnEnd, StepBegin { n: u32, }, StepInterrupted, CompactionBegin, CompactionEnd, StatusUpdate(StatusUpdate), ContentPart(ContentPart), ToolCall { id: String, function: ToolCallFunction, extras: Option<Value>, }, ToolCallPart { arguments_part: Option<String>, }, ToolResult { tool_call_id: String, return_value: ToolReturnValue, }, ApprovalResponse { request_id: String, response: ApprovalResponseKind, feedback: Option<String>, }, SubagentEvent { parent_tool_call_id: Option<String>, agent_id: Option<String>, subagent_type: Option<String>, event: SubagentEventPayload, }, SteerInput { user_input: UserInput, }, PlanDisplay { content: String, file_path: String, }, HookTriggered { event: String, target: String, hook_count: u32, }, HookResolved { event: String, target: String, action: HookAction, reason: String, duration_ms: u64, },
}
Expand description

An event emitted by the agent during a turn.

Events are sent as JSON-RPC notifications (method: "event") and do not require a response.

Serialization follows the official wire envelope format: {"type": "TurnBegin", "payload": {"user_input": ...}}.

Variants§

§

TurnBegin

A new turn has started with the given user input.

Fields

§user_input: UserInput

The user’s input that triggered this turn.

§

TurnEnd

The current turn has ended.

§

StepBegin

A new step within the turn has started.

Fields

§n: u32

Step number, starting from 1.

§

StepInterrupted

The current step was interrupted (e.g. by user input).

§

CompactionBegin

Context compaction has started.

§

CompactionEnd

Context compaction has finished.

§

StatusUpdate(StatusUpdate)

Server status update (token usage, context size, etc.).

§

ContentPart(ContentPart)

A content part (text, image, etc.) from the model.

§

ToolCall

A tool call from the model.

Wire name is "function" because Kimi serializes tool calls as function type.

Fields

§id: String

Tool call id.

§function: ToolCallFunction

Function name and arguments.

§extras: Option<Value>

Extra fields from the wire protocol.

§

ToolCallPart

A partial tool call (streaming arguments).

Fields

§arguments_part: Option<String>

Partial JSON arguments.

§

ToolResult

Result of a tool execution.

Fields

§tool_call_id: String

Id of the corresponding tool call.

§return_value: ToolReturnValue

Return value from the tool.

§

ApprovalResponse

Response to an approval request (sent by the client).

Fields

§request_id: String

Id of the approval request.

§response: ApprovalResponseKind

Approval decision.

§feedback: Option<String>

Optional feedback text from the user.

§

SubagentEvent

An event from a subagent.

Fields

§parent_tool_call_id: Option<String>

Id of the parent tool call that spawned the subagent.

§agent_id: Option<String>

Subagent id.

§subagent_type: Option<String>

Subagent type.

§event: SubagentEventPayload

Nested wire message in envelope form.

§

SteerInput

Additional user input steering the current turn.

Fields

§user_input: UserInput

The steering input.

§

PlanDisplay

Plan display content.

Fields

§content: String

Display content.

§file_path: String

File path associated with the plan.

§

HookTriggered

A hook was triggered.

Fields

§event: String

Event name.

§target: String

Target of the hook.

§hook_count: u32

Number of times this hook has fired.

§

HookResolved

A hook was resolved.

Fields

§event: String

Event name.

§target: String

Target of the hook.

§action: HookAction

Action taken.

§reason: String

Reason for the action.

§duration_ms: u64

Duration in milliseconds.

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Event

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 Event

Source§

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

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

impl<'de> Deserialize<'de> for Event

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

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

impl PartialEq for Event

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Event

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Event

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnsafeUnpin for Event

§

impl UnwindSafe for Event

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,