Give the Sidecar Host API one authoritative catalog in pkg/pluginproto: every
host/* method's status, required permissions, handshake feature and request and
result shapes. The host, pkg/pluginsdk and plugins share those types, so a field
can no longer exist on one side only, and permissions come from the catalog
instead of from each handler. Tests gate that every served method is
catalogued, every stable catalogued method is served, and every catalogued
permission is one the host recognizes.
Open the interface up instead of adding consent gates. Typing a secret setting
is no longer reserved for reims.agent: any plugin that holds qmp:write and that
the user authorized for the VM can have the host type the plugin's own setting,
which the plugin never reads back. Restoring a snapshot works on any authorized
VM, a plugin names its own clones, a held key may carry modifiers, and a
screenshot width outside the supported range is brought into range rather than
refused. Deleting a VM stays limited to the temporary VMs a plugin created.
Record the keys and pointer buttons each plugin holds per VM and lift them when
the plugin's process exits, its scope is disposed, the VM stops or it stops
calling, so a guest never stays stuck with a modifier down. Requests from
plugins that declare pluginApi 1.3 or newer are decoded strictly and answer an
undefined field with JSON-RPC -32602, while older plugins keep tolerant
decoding.
Add typed VM and console methods to pkg/pluginsdk so a plugin no longer needs
its own JSON-RPC client. A method the contract does not catalog, or one the
host did not advertise in the handshake, is refused before it is sent, and the
host's JSON-RPC error code reaches the caller.
Plugins can add pages to the sidebar, VM tabs, Settings and dialogs. Their
pages can now use host forms and navigation, VM and settings access,
authorized file I/O, task progress, controlled HTTP requests, events and
private storage.
Plugin pages cannot change allow_ai_access, which stays the user's per-VM
consent. Closing a page cancels its unfinished tasks, and running plugin
tasks no longer block changing the data folder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plugins that need their own UI and richer themes should not force breaking
contract changes later, so the full shape is published now (uiApi 2.0,
bridgeApi 1.0) and every entry is marked stable or experimental:
- docs/plugin-architecture.md: plugin-owned views (sidebar, vm.tab,
settings, dialog) and the bridge methods (§5.6), the finer theme
contract with slot catalogue, layers, layout and icons (§5.1), and the
contract evolution rules (§6.3).
- ui-contract.ts and the new bridgeContract.ts list stable and
experimental entries; the build fails if a stable entry is not emitted
or an emitted entry is still experimental, and writes
bridge-contract.json next to ui-contract.json.
- internal/plugin/contract.go mirrors them as catalogs (contribution
points, slots with accepted content, view locations, layers, layout,
icons, bridge methods and events) and derives HostFeatures; tests keep
Go and TypeScript identical and require every contributes field to be
catalogued.
- Manifests gain views, theme layout and engines.bridgeApi. Unknown
slots, locations, layout values and icon names are rejected;
experimental use, unknown fields and missing engines ranges are doctor
warnings. Declared-but-unrendered entries (vmCards, statusItems,
settingsPages, vmTemplates, runtimeSources, runtimes, uiScripts,
diagnostics, theme icons and brandMark, panels outside
settings.plugin) are now marked experimental.
- The panel bridge resolves methods through the catalog, adds hello and
refuses experimental methods; panels get theme.changed and
locale.changed events; the Sidecar handshake and the Go SDK carry
uiApi, bridgeApi and features.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>