Skip to main content

ServerEvent

Enum ServerEvent 

Source
pub enum ServerEvent {
Show 26 variants DaemonStatus { request_id: String, status: DaemonStatus, }, Initialized { request_id: String, protocol_version: u32, server: PeerInfo, }, SessionStarted { request_id: String, session_id: String, cwd: String, model: String, context_max_tokens: usize, max_server_frame_bytes: usize, max_transcript_bytes: usize, max_transcript_items: usize, max_prompt_history_bytes: usize, max_prompt_history_items: usize, }, QueueSnapshot { request_id: Option<String>, session_id: String, seq: u64, entries: Vec<QueueEntry>, paused: bool, }, QueueEnqueued { request_id: String, session_id: String, seq: u64, entry: QueueEntry, position: usize, }, QueueUpdated { request_id: String, session_id: String, seq: u64, entry: QueueEntry, }, QueueMoved { request_id: String, session_id: String, seq: u64, queue_id: String, position: usize, revision: u64, }, QueueRemoved { request_id: String, session_id: String, seq: u64, queue_id: String, revision: u64, }, QueueDequeued { request_id: String, session_id: String, seq: u64, queue_id: String, turn_id: String, }, SessionPaused { request_id: String, session_id: String, seq: u64, paused: bool, }, TurnStarted { request_id: String, session_id: String, turn_id: String, seq: u64, origin: Option<TurnOrigin>, }, AssistantDelta { request_id: String, session_id: String, turn_id: String, seq: u64, content: String, }, AssistantCompleted { request_id: String, session_id: String, turn_id: String, seq: u64, content: String, }, ToolProposed { request_id: String, session_id: String, turn_id: String, seq: u64, call_id: String, name: String, arguments: Value, }, ApprovalRequested { request_id: String, session_id: String, turn_id: String, seq: u64, approval_id: String, call_id: String, name: String, risk: String, cwd: String, summary: String, }, ToolStarted { request_id: String, session_id: String, turn_id: String, seq: u64, call_id: String, name: String, }, ToolProgress { request_id: String, session_id: String, turn_id: String, seq: u64, call_id: String, text: String, }, ToolCompleted { request_id: String, session_id: String, turn_id: String, seq: u64, call_id: String, name: String, success: bool, output: String, truncated: bool, error: Option<ToolErrorKind>, jobs: Vec<JobChange>, }, ContextCompacted { request_id: String, session_id: String, turn_id: String, seq: u64, before_tokens: usize, after_tokens: usize, removed_messages: usize, }, SessionTrimmed { request_id: String, session_id: String, seq: u64, removed_messages: usize, history_bytes: usize, }, SessionCleared { request_id: String, session_id: String, seq: u64, }, TurnCompleted { request_id: String, session_id: String, turn_id: String, seq: u64, steps: usize, usage: Usage, origin: Option<TurnOrigin>, }, TurnCancelled { request_id: String, session_id: String, turn_id: String, seq: u64, origin: Option<TurnOrigin>, }, TurnFailed { request_id: String, session_id: String, turn_id: String, seq: u64, code: ErrorCode, message: String, origin: Option<TurnOrigin>, }, Error { request_id: Option<String>, code: ErrorCode, message: String, fatal: bool, }, Unknown,
}
Expand description

A message from server to client. Serialized as one JSON object per line, tagged by type (such as turn.completed). Turn events carry the session’s consecutive seq.

A type this client does not know parses as ServerEvent::Unknown, so a newer server can add events without breaking older clients; a client ignores them.

Variants§

§

DaemonStatus

The answer to a daemon.control status request.

Fields

§request_id: String

The client request this answers or belongs to.

§status: DaemonStatus

The daemon’s state.

§

Initialized

The answer to initialize.

Fields

§request_id: String

The client request this answers or belongs to.

§protocol_version: u32

The PROTOCOL_VERSION the server speaks.

§server: PeerInfo

The server’s name and version.

§

SessionStarted

The answer to session.start, with the limits the client should use.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§cwd: String

The session’s workspace directory.

§model: String

The model answering.

§context_max_tokens: usize

The model’s context window.

§max_server_frame_bytes: usize

Largest event frame the server sends; clients size their reads by it.

§max_transcript_bytes: usize

Transcript bytes a client should keep for display.

§max_transcript_items: usize

Transcript items a client should keep for display.

§max_prompt_history_bytes: usize

Prompt-history bytes a client should keep.

§max_prompt_history_items: usize

Prompt-history entries a client should keep.

§

QueueSnapshot

The whole queue, sent when a session starts or on request.

Fields

§request_id: Option<String>

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§entries: Vec<QueueEntry>

Queued prompts in the order they will run.

§paused: bool

Whether queued prompts wait instead of starting.

§

QueueEnqueued

A prompt was queued behind the running turn.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§entry: QueueEntry

The queued prompt.

§position: usize

Its index in the queue.

§

QueueUpdated

A queued prompt’s text changed.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§entry: QueueEntry

The queued prompt.

§

QueueMoved

A queued prompt moved.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§queue_id: String

The queued prompt.

§position: usize

Its index in the queue.

§revision: u64

The entry’s revision after the change.

§

QueueRemoved

A queued prompt was dropped.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§queue_id: String

The queued prompt.

§revision: u64

The entry’s revision after the change.

§

QueueDequeued

A queued prompt left the queue to run as a turn.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§queue_id: String

The queued prompt.

§turn_id: String

The turn this belongs to.

§

SessionPaused

The queue was held or released.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§paused: bool

Whether queued prompts wait instead of starting.

§

TurnStarted

A turn began.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§turn_id: String

The turn this belongs to.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§origin: Option<TurnOrigin>

Set when the server started this turn itself, such as to report finished background work; absent for a client’s own turn.start.

§

AssistantDelta

Answer text as it streams.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§turn_id: String

The turn this belongs to.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§content: String

The text.

§

AssistantCompleted

The model’s complete answer for one step.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§turn_id: String

The turn this belongs to.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§content: String

The text.

§

ToolProposed

The model asked to call a tool.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§turn_id: String

The turn this belongs to.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§call_id: String

The tool call, as the model named it.

§name: String

The tool.

§arguments: Value

The call’s arguments as the model sent them.

§

ApprovalRequested

A tool call waits for a person’s decision.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§turn_id: String

The turn this belongs to.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§approval_id: String

Answer with approval.resolve naming this ID.

§call_id: String

The tool call, as the model named it.

§name: String

The tool.

§risk: String

The call’s risk, which selected the approval rule.

§cwd: String

The session’s workspace directory.

§summary: String

What the call will do, for the person deciding.

§

ToolStarted

An approved tool call began running.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§turn_id: String

The turn this belongs to.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§call_id: String

The tool call, as the model named it.

§name: String

The tool.

§

ToolProgress

Short status lines from a running tool, at most two events a second per call and 512 bytes each. Display only; not part of the history.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§turn_id: String

The turn this belongs to.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§call_id: String

The tool call, as the model named it.

§text: String

The status lines.

§

ToolCompleted

A tool call finished; its output goes to the model.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§turn_id: String

The turn this belongs to.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§call_id: String

The tool call, as the model named it.

§name: String

The tool.

§success: bool

Whether the tool succeeded.

§output: String

What the model sees as the result.

§truncated: bool

Whether output was cut to its limit.

§error: Option<ToolErrorKind>

Why the call failed; absent when it succeeded, and from servers before 0.3.0.

§jobs: Vec<JobChange>

Background jobs this call started, or whose results it showed the model; absent when none, and from servers before 0.3.0.

§

ContextCompacted

Older history was summarized to fit the model’s context window.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§turn_id: String

The turn this belongs to.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§before_tokens: usize

Estimated request size before compaction.

§after_tokens: usize

Estimated request size as sent.

§removed_messages: usize

Messages left out or removed.

§

SessionTrimmed

Old turns were removed to keep the session within its history limits.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§removed_messages: usize

Messages left out or removed.

§history_bytes: usize

Size of the session history afterwards.

§

SessionCleared

The session’s history and queue were cleared.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§

TurnCompleted

A turn finished.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§turn_id: String

The turn this belongs to.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§steps: usize

Model requests the turn made.

§usage: Usage

Tokens the turn used, as the provider reported them.

§origin: Option<TurnOrigin>

Set when the server started this turn itself, such as to report finished background work; absent for a client’s own turn.start.

§

TurnCancelled

A turn was cancelled; its history changes were rolled back.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§turn_id: String

The turn this belongs to.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§origin: Option<TurnOrigin>

Set when the server started this turn itself, such as to report finished background work; absent for a client’s own turn.start.

§

TurnFailed

A turn failed; its history changes were rolled back.

Fields

§request_id: String

The client request this answers or belongs to.

§session_id: String

The session this concerns.

§turn_id: String

The turn this belongs to.

§seq: u64

The session’s event sequence number: consecutive, so a gap means events were lost.

§code: ErrorCode

Stable machine-readable error code.

§message: String

What went wrong, for people.

§origin: Option<TurnOrigin>

Set when the server started this turn itself, such as to report finished background work; absent for a client’s own turn.start.

§

Error

A request failed, or a connection-level error.

Fields

§request_id: Option<String>

The client request this answers or belongs to.

§code: ErrorCode

Stable machine-readable error code.

§message: String

What went wrong, for people.

§fatal: bool

Whether the connection is unusable after this error.

§

Unknown

An event this client does not know, from a newer server. Never sent.

Implementations§

Source§

impl ServerEvent

Source

pub fn turn_request_id(&self) -> Option<&str>

The submitting request of a turn-scoped event, which identifies the turn to a client that has several turns’ events interleaved.

Trait Implementations§

Source§

impl Clone for ServerEvent

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 ServerEvent

Source§

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

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

impl<'de> Deserialize<'de> for ServerEvent

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 PartialEq for ServerEvent

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 ServerEvent

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 ServerEvent

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.