Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
ADR 0170: Ship the work-panel browser as a bundled plugin over public CDP
- Status: Accepted
- Date: 2026-09-06
- Deciders: PI-Desktop core
- Related: ADR 0019 · ADR 0104 · ADR 0105 · 07-plugins
Context
The work-panel browser was a host-built launcher row (HEADER_TOOLS) plus a
Main-owned WebContentsView guest, while Files already proved a first-party surface
can ship as a bundled plugin on the public contributes.views channel — enabled or
disabled on the Plugins page, never uninstallable.
The plugin page cannot be the browser: plugin views are sandboxed, have
webviewTag: false, and are confined by net.domains, so arbitrary http(s),
workspace files, and Chrome DevTools Protocol must stay on a host-owned guest.
Decision
pi.browseris a bundled plugin inapps/desktop/resources/plugins/, enabled by default, disableable, not uninstallable. It contributes viewbrowser(icon tokenbrowser, order 10) and registers the agent toolBrowser.- The guest
WebContentsView(persist:work-browser) and debugger stay host-owned. Plugin chrome is a normal plugin view, and the guest is stacked on a content-relative hole the chrome reports throughpi.browser.setBounds. browser.cdpis a public high-risk permission andpi.browser.*a public host API, with raw CDP allowlisted and deny-by-default (cookie, storage, target, and network-interception methods refused, no DevTools websocket), and bounds clamped to the calling plugin view.- Host
BrowserPreviewremains a thin facade for Plan/subagent name stability: it errors whenpi.browseris disabled, otherwise loading the workspace file into a session-owned guest. Background browser pages supersedes the visible-before-operation rule and retained browser pages per tab replaces the singleton guest with one page per session and tab.
This supersedes ADR 0105 clause 4, the host-launcher clause of ADR 0019, and ADR 0108's "Browser as the host-built tool" clause; guest ownership and navigation policy are unchanged.
Consequences
- Disabling
pi.browserremoves the launcher row, agent CDP, and guest, URL chips fall back toopenExternal, andBrowserPreviewfails closed. browser.cdptools address their invoking session's connected page, and Plan keepsBrowserPreviewwith the fourplanSafeActions(navigate,snapshot,screenshot,console) Plan/Goal-safe while click/fill/evaluate/cdp stay Agent-only (ADR 0211).
Alternatives
- Load the page inside the plugin view: needs
webviewTag, a wildcardnet.domains, and CDP on the wrong WebContents. - Private host APIs only
pi.browsermay call: Files proved the public channel. - Keep React
BrowserTabchrome and only plugin-ize the launcher: that is not a browser shipped as a plugin.