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).
Transcript
The whole conversation; sent on connect.
EntryAdded(Entry)
A new entry was appended.
EntryDelta
Streamed text appended to an entry.
EntryFinished
An entry finished streaming.
StepUpdated
A tool step of entry entry was added or changed (replace by step.id).
EntryUndo
Whether entry id’s file changes can be undone, or have been.
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.
Fields
pinned: Vec<ChatSummary>recent: Vec<ChatSummary>after: Option<ChatCursor>next: Option<ChatCursor>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.
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.
Uploaded
An upload finished (attachment) or failed (error). Only sent to the uploader.
Media
Answer to ClientMsg::GetMedia.
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.
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.
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.
Compacted(Compaction)
The chat in view was just compacted.
Delegation
The subagent run of step step (in entry entry) changed.
InferenceTested(InferenceTest)
Answer to ClientMsg::TestInference.
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.
Config(Box<ConfigView>)
Answer to ClientMsg::GetConfig / ClientMsg::SetConfig.
Folders(FolderList)
Answer to ClientMsg::ListFolders.
ContainersChecked
Answer to ClientMsg::CheckContainers.
WorkspaceCreated
Answer to ClientMsg::CreateWorkspace.
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).
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
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).
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)
Answer to ClientMsg::TestProfile.
Unknown
A message from a newer engine this client doesn’t know: skip it.
Implementations§
Source§impl ServerMsg
impl ServerMsg
pub fn to_json(&self) -> String
Sourcepub fn to_frame(&self) -> String
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.