Skip to main content

ServerMsg

Enum ServerMsg 

Source
pub enum ServerMsg {
Show 38 variants Welcome(Welcome), State(EngineState), Notice { level: NoticeLevel, text: String, }, Transcript { entries: Vec<Entry>, }, EntryAdded(Entry), EntryDelta { id: u64, content: String, reasoning: String, }, EntryFinished { id: u64, error: Option<String>, stats: Option<TurnStats>, }, StepUpdated { entry: u64, step: Step, }, EntryUndo { id: u64, undoable: bool, undone: bool, }, Chats { pinned: Vec<ChatSummary>, recent: Vec<ChatSummary>, after: Option<ChatCursor>, next: Option<ChatCursor>, }, ChatUpdated(ChatSummary), ChatDeleted { id: String, }, ChatOpened { chat: Option<ChatSummary>, workspace: Option<String>, }, Uploaded { upload: u64, attachment: Option<MediaRef>, error: Option<String>, }, Media { path: String, content: MediaContent, }, Artifacts { chat: Option<String>, artifacts: Vec<Artifact>, }, ArtifactUpdated(Artifact), ArtifactFile { id: String, version: u32, data: Option<String>, error: Option<String>, }, Usage(ChatUsage), Compactions { chat: Option<String>, items: Vec<Compaction>, }, Compacted(Compaction), Delegation { entry: u64, step: u64, update: DelegationUpdate, }, InferenceTested(InferenceTest), WorkspaceEnv(WorkspaceEnv), Workspaces { items: Vec<WorkspaceSummary>, current: Option<String>, root: String, support: EnvSupport, }, Config(Box<ConfigView>), Folders(FolderList), ContainersChecked { ok: bool, message: String, }, WorkspaceCreated { id: Option<String>, error: Option<String>, }, Queue(ChatQueue), Extensions(Box<Extensions>), Plugin { plugin: String, msg: Value, }, LiveView(LiveView), WebReply { call: u64, result: Option<Value>, error: Option<WebError>, }, WebPush { owner: WebOwner, msg: Value, }, Profiles(Box<ProfileList>), ProfileTested(ProfileTest), Unknown,
}
Expand description

Engine -> client(s).

Variants§

§

Welcome(Welcome)

The answer to ClientMsg::Hello, first: the engine’s version and caps.

§

State(EngineState)

Full engine state; sent on connect and whenever it changes.

§

Notice

A human-readable message for the user (errors, warnings).

Fields

§text: String
§

Transcript

The whole conversation; sent on connect.

Fields

§entries: Vec<Entry>
§

EntryAdded(Entry)

A new entry was appended.

§

EntryDelta

Streamed text appended to an entry.

Fields

§id: u64
§content: String
§reasoning: String
§

EntryFinished

An entry finished streaming.

Fields

§id: u64
§

StepUpdated

A tool step of entry entry was added or changed (replace by step.id).

Fields

§entry: u64
§step: Step
§

EntryUndo

Whether entry id’s file changes can be undone, or have been.

Fields

§id: u64
§undoable: bool
§undone: bool
§

Chats

A page of the chat list. With after: None it replaces the client’s list (pinned chats are in pinned); otherwise recent continues the list after after.

§

ChatUpdated(ChatSummary)

A chat was created or changed (title, pin, activity, busy). Sent to every client.

§

ChatDeleted

A chat was deleted. Sent to every client.

Fields

§

ChatOpened

This client now looks at chat (None: a new chat, not sent yet), which is in workspace workspace. The chat’s ServerMsg::Transcript follows; entry messages only arrive for the chat in view.

Fields

§workspace: Option<String>
§

Uploaded

An upload finished (attachment) or failed (error). Only sent to the uploader.

Fields

§upload: u64
§attachment: Option<MediaRef>
§

Media

Fields

§path: String
§

Artifacts

Every artifact of the chat this client looks at (chat, None for a new chat). Sent after ServerMsg::Transcript; replaces the client’s list.

Fields

§artifacts: Vec<Artifact>
§

ArtifactUpdated(Artifact)

An artifact of the chat in view was created or got a new version.

§

ArtifactFile

Answer to ClientMsg::GetArtifact: the file, base64 (see media::encode), or why not.

Fields

§version: u32
§

Usage(ChatUsage)

Context usage of the chat in view; sent after the transcript and whenever it changes.

§

Compactions

Every compaction of the chat in view, oldest first (chat, None for a new chat). Sent after ServerMsg::Transcript (before Artifacts); replaces the client’s list.

Fields

§

Compacted(Compaction)

The chat in view was just compacted.

§

Delegation

The subagent run of step step (in entry entry) changed.

Fields

§entry: u64
§step: u64
§

InferenceTested(InferenceTest)

§

WorkspaceEnv(WorkspaceEnv)

Answer to ClientMsg::WorkspaceEnv: the environment of a workspace.

§

Workspaces

Every workspace, most recently active first; sent on connect and whenever one is added, renamed, removed or changes its chat count. current is where new chats go by default; root is where fresh workspace folders are created.

Fields

§current: Option<String>
§root: String
§support: EnvSupport
§

Config(Box<ConfigView>)

§

Folders(FolderList)

§

ContainersChecked

Fields

§ok: bool
§message: String
§

WorkspaceCreated

Fields

§

Queue(ChatQueue)

The queue of the chat in view; sent after ServerMsg::Transcript and whenever it changes.

§

Extensions(Box<Extensions>)

The plugins of the chat in view; sent after ServerMsg::ChatOpened, on ClientMsg::GetExtensions, and whenever they change.

§

Plugin

A message from plugin plugin in the engine (the plugin channel; only to clients that list version::CAP_PLUGIN_CHANNEL).

Fields

§plugin: String
§msg: Value
§

LiveView(LiveView)

A live view’s tree, a change to it, or why it can’t be shown (13.3+; only to clients that listed sites::CAP_VIEW_SITES and opened it, see sites).

§

WebReply

The answer to ClientMsg::WebCall call (only to the client that called): a JSON-RPC result or an error.

Fields

§call: u64
§result: Option<Value>

Some(Value::Null) for a JSON-RPC null result, which is sent as null.

§

WebPush

A JSON-RPC message (a notification) for the web surfaces owner answers, from the owner (a plugin’s backend; only to clients that listed web::CAP_WEB_BRIDGE).

Fields

§owner: WebOwner
§msg: Value
§

Profiles(Box<ProfileList>)

Every model profile and the roles (13.9+, only to clients that list profiles::CAP_PROFILES); after the Welcome and whenever they change.

§

ProfileTested(ProfileTest)

§

Unknown

A message from a newer engine this client doesn’t know: skip it.

Implementations§

Source§

impl ServerMsg

Source

pub fn to_json(&self) -> String

Source

pub fn to_frame(&self) -> String

The frame for a remote client: the JSON, or, if that is over MAX_FRAME_BYTES (the client would refuse it and wait forever), a small message in its place that the client acts on: a view change becomes reset (the client opens the view again and gets the whole tree), a view’s tree an error at its site, a web reply an error answer to its call, anything else a notice.

Source

pub fn from_json(text: &str) -> Result<Self, String>

Parse an untrusted frame.

Trait Implementations§

Source§

impl Clone for ServerMsg

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 ServerMsg

Source§

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

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

impl<'de> Deserialize<'de> for ServerMsg

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 ServerMsg

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 ServerMsg

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 ServerMsg

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.