Skip to main content

ClientMsg

Enum ClientMsg 

Source
pub enum ClientMsg {
Show 54 variants Hello { protocol: u32, minor: u32, client: String, caps: Vec<String>, }, SetInference { base_url: String, model: String, api_key: Option<String>, }, TestInference { base_url: String, model: String, api_key: Option<String>, }, DetectEndpoints, Retry, SendMessage { text: String, attachments: Vec<String>, }, Cancel, Unqueue { id: u64, }, EditQueued { id: u64, text: String, attachments: Vec<String>, }, MoveQueued { id: u64, to: u32, }, SendQueuedNow { id: u64, }, ResumeQueue, Approve { step: u64, answer: ApprovalAnswer, }, AnswerQuestion { step: u64, text: String, }, Undo { entry: u64, }, ListChats { after: Option<ChatCursor>, limit: u32, }, NewChat { workspace: Option<String>, }, OpenChat { id: String, }, RenameChat { id: String, title: String, }, DeleteChat { id: String, }, PinChat { id: String, pinned: bool, }, Upload { upload: u64, name: String, size: u64, offset: u64, data: String, done: bool, }, GetMedia { path: String, }, GetArtifact { id: String, version: u32, }, Compact { focus: Option<String>, }, WorkspaceEnv { action: Option<EnvAction>, workspace: Option<String>, }, CreateWorkspace { name: String, folder: NewFolder, config: Layer, }, RenameWorkspace { id: String, name: String, }, RemoveWorkspace { id: String, clean: bool, }, GetConfig { scope: ConfigScope, }, SetConfig { scope: ConfigScope, layer: Layer, api_key: Option<String>, }, ListFolders { path: Option<String>, }, CheckContainers, GetExtensions, SetPluginEnabled { scope: ConfigScope, plugin: String, enabled: Option<bool>, }, SetPluginSetting { plugin: String, key: String, value: Option<String>, }, KeepPlugin { plugin: String, scope: PluginScope, new_id: Option<String>, }, RemovePlugin { plugin: String, scope: PluginScope, }, ReloadPlugins, TrustPlugins { workspace: String, plugins: Vec<String>, trust: bool, }, Plugin { plugin: String, msg: Value, }, OpenView { view: ViewRef, }, CloseView { view: ViewRef, }, ViewEvent { view: ViewRef, event: Event, }, WebCall { call: u64, owner: WebOwner, method: String, params: Value, approved: bool, }, GetProfiles, CreateProfile { profile: Profile, api_key: Option<String>, assign: Option<ConfigScope>, make_main: bool, }, UpdateProfile { profile: Profile, api_key: Option<String>, }, DeleteProfile { id: String, }, DuplicateProfile { id: String, }, SetRole { role: String, profile: Option<String>, }, TestProfile { id: String, }, SetLevelProfile { scope: ConfigScope, profile: Option<String>, }, Unknown,
}
Expand description

Client -> engine.

Variants§

§

Hello

First message on every connection: the client’s PROTOCOL_MAJOR (protocol), minor and caps (see version). Answered with ServerMsg::Welcome, or an error notice if the major differs.

Fields

§protocol: u32
§minor: u32
§client: String
§caps: Vec<String>
§

SetInference

Point the engine at a different inference endpoint (saved, then checked). api_key: None keeps the stored key if the server (scheme, host, port) is unchanged and drops it otherwise; Some("") removes it.

Fields

§base_url: String
§model: String
§api_key: Option<String>
§

TestInference

Try an endpoint without switching to it; answered with ServerMsg::InferenceTested. api_key as for ClientMsg::SetInference.

Fields

§base_url: String
§model: String
§api_key: Option<String>
§

DetectEndpoints

Look again for inference servers on this machine’s usual ports (EngineState::detected).

§

Retry

Run the last message of the chat in view again, after its reply failed before producing anything (e.g. the server was down). The failed reply is removed.

§

SendMessage

Send a user message and start a turn; while a reply runs in the chat, queue it instead (see queue). attachments are paths the engine returned in ServerMsg::Uploaded.

Fields

§text: String
§attachments: Vec<String>
§

Cancel

Stop the running turn. Pending approvals are denied; the chat’s queue pauses.

§

Unqueue

Take queued message id out of the queue of the chat in view.

Fields

§id: u64
§

EditQueued

Replace the text and attachments of queued message id (in place). Empty text and no attachments removes it.

Fields

§id: u64
§text: String
§attachments: Vec<String>
§

MoveQueued

Move queued message id to position to (0 = next; past the end = last).

Fields

§id: u64
§to: u32
§

SendQueuedNow

Run queued message id next, now: stop the running turn (if any) and resume the queue.

Fields

§id: u64
§

ResumeQueue

Let a paused queue go on (starts the next message if the chat is free).

§

Approve

Answer a pending approval (a Step with status StepStatus::Waiting). Any client may answer; the first answer wins and later ones are ignored.

Fields

§step: u64
§

AnswerQuestion

Answer a question card (a waiting Step whose Ask::choice is set): one of its options or, when it takes one, the user’s own text (≤ MAX_ANSWER_CHARS). Skipping it is ClientMsg::Approve with ApprovalAnswer::Deny. First answer wins (13.8).

Fields

§step: u64
§text: String
§

Undo

Reverse the file changes of assistant entry entry (see Entry::undoable). The engine refuses, changing nothing, if any of those files changed since.

Fields

§entry: u64
§

ListChats

Ask for a page of the chat list (answered with ServerMsg::Chats). after is the previous page’s next; None asks for the first page (pinned chats included).

Fields

§limit: u32
§

NewChat

Start a new, empty chat in this client, in workspace workspace (default: the workspace of the chat in view, else the default one). The chat is created when the first message is sent; until then this client sees an empty transcript.

Fields

§workspace: Option<String>
§

OpenChat

Look at another chat. Only this client switches; a turn running elsewhere goes on.

Fields

§

RenameChat

Fields

§title: String
§

DeleteChat

Delete a chat and its messages. Refused while a reply is running in it.

Fields

§

PinChat

Fields

§pinned: bool
§

Upload

One chunk of a file the user attaches. upload is chosen by the client (unique per connection); chunks arrive in order, offset is where data (base64, at most media::UPLOAD_CHUNK_BYTES raw) starts; size is the whole file’s size. The engine answers the last chunk (done) or the first problem with ServerMsg::Uploaded.

Fields

§upload: u64
§name: String
§size: u64
§offset: u64
§data: String
§done: bool
§

GetMedia

Ask for the content of a MediaRef in the transcript; answered with ServerMsg::Media.

Fields

§path: String
§

GetArtifact

Ask for the bytes of version version of artifact id in the chat this client looks at; answered with ServerMsg::ArtifactFile.

Fields

§version: u32
§

Compact

Summarise the conversation in view now, so later requests start from the summary (also typed as /compact [focus]). focus says what the summary must keep.

Fields

§

WorkspaceEnv

Ask for the environment state of workspace workspace (default: the chat in view’s), after applying action if given; answered with ServerMsg::WorkspaceEnv.

Fields

§workspace: Option<String>
§

CreateWorkspace

Make a workspace: a name, a folder on the engine’s machine, its own settings (validated for the workspace level). Answered with ServerMsg::WorkspaceCreated; on success this client starts a new chat in it.

Fields

§name: String
§folder: NewFolder
§config: Layer
§

RenameWorkspace

Fields

§name: String
§

RemoveWorkspace

Remove a workspace from byob with its chats; the folder and its files stay. clean also deletes what byob keeps for it elsewhere (installed packages, its container).

Fields

§clean: bool
§

GetConfig

Ask for one level’s settings; answered with ServerMsg::Config.

Fields

§

SetConfig

Replace one level’s own settings (None fields inherit). api_key as for ClientMsg::SetInference, for a level with its own URL. Answered with ServerMsg::Config.

Fields

§layer: Layer
§api_key: Option<String>
§

ListFolders

List the subfolders of path on the engine’s machine (default: the home folder); answered with ServerMsg::Folders.

Fields

§

CheckContainers

Is Docker/Podman reachable? Answered with ServerMsg::ContainersChecked.

§

GetExtensions

Ask for the plugins of the chat in view; answered with ServerMsg::Extensions.

§

SetPluginEnabled

Turn plugin plugin on (Some(true)) or off (Some(false)) at one level of the layered settings, or forget that level’s switch (None: inherit). Applies from the next turn. Answered with ServerMsg::Extensions.

Fields

§plugin: String
§enabled: Option<bool>
§

SetPluginSetting

Set (or clear, None) a setting the plugin declares. Secret settings go to secrets.json, the others to settings.json; values are never sent back, only whether each is set (PluginSetting::set).

Fields

§plugin: String
§

KeepPlugin

Keep plugin plugin of the chat in view (its scratch copy, or whichever copy the chat uses) in the chat’s workspace or everywhere, as new_id if given. The user asked, so there is no approval card.

Fields

§plugin: String
§new_id: Option<String>
§

RemovePlugin

Delete the copy of plugin plugin in scope (the chat in view’s scratch folder, its workspace’s .byob/plugins, or the global plugins folder).

Fields

§plugin: String
§

ReloadPlugins

Read the plugin folders of the chat in view again now.

§

TrustPlugins

Let the plugins that came with workspace workspace’s folder run their tools and servers (trust: true), or keep them to skills and prompt lines without asking again (false). plugins empty: all of them.

Fields

§workspace: String
§plugins: Vec<String>
§trust: bool
§

Plugin

A message for plugin plugin’s handler in the engine (the plugin channel; only when the engine lists version::CAP_PLUGIN_CHANNEL). Its meaning is the plugin’s.

Fields

§plugin: String
§msg: Value
§

OpenView

This client shows live view view at its site (13.3+, only when the engine lists sites::CAP_VIEW_SITES): answered with a ServerMsg::LiveView holding its tree, then its changes until ClientMsg::CloseView or another chat is opened.

Fields

§view: ViewRef
§

CloseView

This client no longer shows view.

Fields

§view: ViewRef
§

ViewEvent

The user did something in live view view (a click, Enter in a field, a cell edit): for the plugin’s backend, which answers with a new view.

Fields

§view: ViewRef
§event: Event
§

WebCall

A call from a web surface for the engine (13.5+, only when the engine lists web::CAP_WEB_BRIDGE): JSON-RPC method + params from the page whose calls owner answers. Answered with one ServerMsg::WebReply of the same call number. approved: the user allowed it after a reply asked (web::WebError::approval).

Fields

§call: u64
§owner: WebOwner
§method: String
§params: Value
§approved: bool
§

GetProfiles

Ask for the model profiles; answered with ServerMsg::Profiles (13.9+, see profiles).

§

CreateProfile

Save a new profile (its id is made by the engine) with its key, if any. assign also makes it that level’s model; make_main the default model of every chat.

Fields

§profile: Profile
§api_key: Option<String>
§make_main: bool
§

UpdateProfile

Replace profile profile.id. api_key: None keeps the stored key while the server (scheme, host, port) stays the same, Some("") removes it.

Fields

§profile: Profile
§api_key: Option<String>
§

DeleteProfile

Delete a profile (not the main one). Levels that picked it inherit their model again; roles that used it are unassigned.

Fields

§

DuplicateProfile

Save a copy of a profile, key included, as “ (copy)”.

Fields

§

SetRole

Give role role (see profiles::ROLES) profile profile; None unassigns it (not main).

Fields

§role: String
§profile: Option<String>
§

TestProfile

Check a profile’s endpoint now; answered with ServerMsg::ProfileTested.

Fields

§

SetLevelProfile

Make profile the model of one level (None: inherit it again). Answered with ServerMsg::Config for that scope.

Fields

§profile: Option<String>
§

Unknown

A message from a newer client this engine doesn’t know (answered with a notice).

Implementations§

Source§

impl ClientMsg

Source

pub fn check_sizes(&self) -> Result<(), String>

Cheap checks of an untrusted message’s sizes (the engine checks meaning: unknown ids, folders that don’t exist, settings that don’t belong at a level).

Source§

impl ClientMsg

Source

pub fn hello(client: &str) -> Self

This build’s ClientMsg::Hello.

Source

pub fn to_json(&self) -> String

Source

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

Parse an untrusted frame.

Trait Implementations§

Source§

impl Clone for ClientMsg

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 ClientMsg

Source§

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

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

impl<'de> Deserialize<'de> for ClientMsg

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 ClientMsg

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 ClientMsg

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 ClientMsg

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.