Skip to main content

Module web

Module web 

Source
Expand description

Web surfaces and their bridge (13.5+, cap CAP_WEB_BRIDGE).

A web surface is HTML byob runs sandboxed (the Servo helper on the desktop, an iframe in the browser) that talks to byob over a typed bridge: JSON-RPC 2.0 messages, the MCP Apps dialect (ui/initialize, tools/call, ui/message, ui/update-model-context, ui/open-link, …). Who answers a surface’s calls is its WebOwner: an MCP server (an MCP App: a tool that declares _meta.ui.resourceUri), or a plugin (a view declared with html, or an artifact renderer web:<file>).

The client is the host the page talks to. It answers what is about the client itself (ui/initialize with the theme as CSS variables, ui/open-link, size changes) and sends the rest to the engine as a crate::ClientMsg::WebCall, answered by one crate::ServerMsg::WebReply with the same call number. The engine routes a call to the owner (tools/call to the same MCP server through the permission gate, or to the plugin’s backend tools; byob/send to the plugin’s backend), or handles it itself (byob/document: the surface’s HTML; ui/message: a user message in the chat; ui/update-model-context: text for the model’s next request). Owners push messages to their surfaces with crate::ServerMsg::WebPush.

Structs§

McpApp
An MCP App on a tool’s step (a crate::View of kind [McpApp::KIND]): the tool declared _meta.ui.resourceUri, so clients render that resource with the call’s input and result.
WebApproval
What the engine says when a call needs the user’s go-ahead first (a tools/call the permission gate would ask about): the client asks and sends the call again with approved.
WebCard
A plugin’s web view on a step (a crate::View of kind [WebCard::KIND]): a backend tool returned card_view naming a view with html.
WebDocument
The answer to byob/document: the surface’s HTML and what it asks of the sandbox.
WebError
Why a call failed (a JSON-RPC error for the page).

Enums§

WebOwner
Who answers a web surface’s calls.

Constants§

CAP_WEB_BRIDGE
Cap: the peer handles crate::ClientMsg::WebCall, crate::ServerMsg::WebReply, crate::ServerMsg::WebPush and the byob.mcp_app / byob.web step views.
MAX_CALL_BYTES
Largest call or push (the JSON of params / msg).
MAX_DOCUMENT_BYTES
Largest HTML document the engine sends for a surface.
MAX_METHOD_CHARS
Longest method name.
MAX_URI_CHARS
Longest resource URI.
MCP_APPS_VERSION
The MCP Apps protocol version byob speaks with views.
MCP_APP_MIME
The MIME type of an MCP App’s HTML resource.
MCP_UI_EXTENSION
The MCP Apps extension id (in initialize capabilities).