Skip to main content

Crate byob_protocol

Crate byob_protocol 

Source
Expand description

The wire protocol between byob clients (desktop window, browser tab) and the engine.

Every client, including the in-process desktop window, talks to the engine only through these messages, so the desktop and web UIs can never drift apart. Messages travel as JSON text frames over a WebSocket, or through channels when in-process.

Re-exports§

pub use artifact::Artifact;
pub use artifact::ArtifactKind;
pub use artifact::ArtifactRef;
pub use artifact::ArtifactVersion;
pub use connect::Detected;
pub use connect::InferenceTest;
pub use connect::PRESETS;
pub use connect::Preset;
pub use connect::Problem;
pub use delegation::Delegation;
pub use delegation::DelegationState;
pub use delegation::DelegationUpdate;
pub use env::ContainerEnv;
pub use env::EnvAction;
pub use env::EnvSupport;
pub use env::WorkspaceEnv;
pub use media::MediaContent;
pub use media::MediaKind;
pub use media::MediaRef;
pub use plugins::Extensions;
pub use plugins::PluginAction;
pub use plugins::PluginCard;
pub use plugins::PluginInfo;
pub use plugins::PluginLoadError;
pub use plugins::PluginOrigin;
pub use plugins::PluginScope;
pub use plugins::PluginSetting;
pub use plugins::PluginTest;
pub use plugins::ServerInfo;
pub use plugins::ServerState;
pub use plugins::SlashItem;
pub use plugins::SlashKind;
pub use queue::ChatQueue;
pub use queue::QueuePause;
pub use queue::QueuedMessage;
pub use usage::ChatUsage;
pub use usage::Compaction;
pub use workspace::ChatEndpoint;
pub use workspace::ConfigScope;
pub use workspace::ConfigView;
pub use workspace::FolderList;
pub use workspace::NewFolder;
pub use workspace::WorkspaceSummary;

Modules§

artifact
Artifacts: files the model makes that live beside the conversation — a markdown report, a single-file HTML app, a chart, an image, any other text file — and that are versioned and exportable.
connect
Connecting byob to an inference endpoint: the state of the link, why it fails (in words a user can act on), a connection test, local servers found at startup, and presets for common setups.
delegation
Subagents: a delegate tool step runs a child turn with its own context (a task and a system prompt, not the chat’s history). The step carries the child’s live transcript (Delegation); ServerMsg::Delegation streams changes to it. A child’s tool steps can wait for approval like any other step and are answered with the same ClientMsg::Approve.
env
Workspace environments as clients see them: whether byob loads the workspace’s own environment (flake.nix, pixi.toml, …), and whether its commands run in a container.
media
Media in the conversation: charts and images that tools made, and files users attached.
plugins
Plugins as clients see them: what a chat can use, where each plugin comes from, whether it is on, which settings it still needs, and what went wrong loading it.
queue
Message queueing: follow-ups typed while a reply runs.
usage
Context usage of a chat and its compactions.
workspace
Workspaces as clients see them, layered settings (global → workspace → chat), and the engine’s folder browser for picking a workspace folder from a browser.

Structs§

Ask
The special part of an approval card (see Step::ask).
ChatCursor
Position in the recent-first chat list, for paging.
ChatSummary
A chat as shown in the sidebar.
DiffLine
One line of a preview’s content or diff.
EndpointInfo
Capability summary of the inference endpoint, for a small header detail.
EngineState
What clients may know about the engine. Secrets (API keys) never leave the engine.
Entry
One message in the conversation as shown to users.
Step
One tool call inside an assistant reply.
TurnStats

Enums§

ApprovalAnswer
A user’s answer to an approval request.
ClientMsg
Client -> engine.
EntryRole
FileChange
A file-system effect of a tool call. Paths are for display (workspace-relative when possible).
LineKind
NoticeLevel
Preview
A readable account of a tool call, built from its (untrusted, bounded) arguments.
ServerMsg
Engine -> client(s).
StepStatus
ToolAccess
How dangerous a tool call is; drives the permission gate. Mirrors byob_tools::Access.
ToolsMode
How turns pass tools to the model.

Constants§

MAX_FRAME_BYTES
Hard cap on a single incoming frame, so a hostile peer can’t make us allocate unboundedly.
MAX_PREVIEW_LINES
Most lines in a Preview’s line lists.
MAX_PREVIEW_LINE_CHARS
Most characters in one preview line or value.
PROTOCOL_VERSION
Bumped on any incompatible change to ClientMsg / ServerMsg.

Traits§

Connection
A client’s link to an engine, in-process or over a WebSocket. Never blocks.