Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

feat(plugins): add scoped HTML preview API for Browser (#1719)

Land940c8d9202e
diff --git a/apps/desktop/electron/main/plugin-host-process.mjs b/apps/desktop/electron/main/plugin-host-process.mjs
index 77c84e0e4..93b0b2d80 100644
--- a/apps/desktop/electron/main/plugin-host-process.mjs
+++ b/apps/desktop/electron/main/plugin-host-process.mjs
@@ -275,6 +275,7 @@ function buildApi() {
})),
readPreview: (path) => call("fs.readPreview", [path]),
openDefault: (path) => call("fs.openDefault", [path]),
+ openInBrowser: (path) => call("fs.openInBrowser", [path]),
reveal: (path) => call("fs.reveal", [path]),
writeText: (path, content) => call("fs.writeText", [path, content]),
glob: (pattern) => call("fs.glob", [pattern]),
diff --git a/apps/desktop/electron/main/plugin-runtime.ts b/apps/desktop/electron/main/plugin-runtime.ts
index 26e5344da..e262e0638 100644
--- a/apps/desktop/electron/main/plugin-runtime.ts
+++ b/apps/desktop/electron/main/plugin-runtime.ts
@@ -11,7 +11,7 @@ import {
import type { Stats } from "node:fs";
import { open as openFile } from "node:fs/promises";
import { randomUUID } from "node:crypto";
-import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
+import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
import { pluginNetFetch, parseFetchRedirect, type PluginFetchTransport } from "./plugin-net-fetch";
import type { LoadedSkillDocument } from "./skill-document";
import { getModuleDirectory } from "./module-path";
@@ -362,6 +362,8 @@ export type PluginHostServices = {
) => Promise<void>;
/** Open one already-authorized file with the OS-associated application. */
openPath: (fullPath: string) => Promise<void>;
+ /** Open one already-authorized HTML file in the bundled work-panel Browser. */
+ openInBrowser?: (fullPath: string) => Promise<void>;
/** Reveal one already-authorized file in the OS file manager. */
revealPath?: (fullPath: string) => Promise<void>;
readClipboard: () => Promise<string>;
@@ -536,6 +538,7 @@ const HOST_API_ALLOWLIST = new Set([
"fs.readRange",
"fs.readPreview",
"fs.openDefault",
+ "fs.openInBrowser",
"fs.reveal",
"fs.writeText",
"fs.glob",
@@ -1418,6 +1421,9 @@ export class PluginRuntime {
openPath: async () => {
throw apiError("UNSUPPORTED", "openPath service missing");
},
+ openInBrowser: async () => {
+ throw apiError("UNAVAILABLE", "Browser service missing");
+ },
readClipboard: async () => "",
writeClipboard: async () => undefined,
readClipboardHistory: async () => [],
@@ -2412,6 +2418,9 @@ export class PluginRuntime {
case "fs.openDefault":
await api.fs.openDefault(String(payload?.path ?? ""));
return { ok: true };
+ case "fs.openInBrowser":
+ await api.fs.openInBrowser(String(payload?.path ?? ""));
+ return { ok: true };
case "fs.reveal":
await api.fs.reveal(String(payload?.path ?? ""));
return { ok: true };
@@ -4817,7 +4826,7 @@ export class PluginRuntime {
* Resolve a request that names a file in another folder of the open project
* (ADR 0249, ADR 0263, ADR 0264). A view browsing a sibling folder can only
* address that folder's entries absolutely, and the two host-mediated actions
- * it offers for them (fs.openDefault, fs.reveal) are the only requests that
+ * it offers for them (fs.openDefault, fs.openInBrowser, fs.reveal) are the only requests that
* arrive that way. The widening is narrow: only for a plugin whose declared
* root is the workspace, only for an absolute path already inside one of the
* project's registered folder roots (resolved through links, so a symlink
@@ -5599,6 +5608,56 @@ export class PluginRuntime {
path: rel,
});
},
+ openInBrowser: async (pathFromRoot: string) => {
+ const { full, rel } =
+ (await this.resolveRegisteredFolderRequest(loaded, pathFromRoot)) ??
+ (await this.resolveFsRequest(loaded, "read", pathFromRoot));
+ if (!statSync(full).isFile()) {
+ this.services.audit?.({
+ pluginId,
+ api: "fs.openInBrowser",
+ ok: false,
+ errorCode: "INVALID_ARGUMENT",
+ ts: Date.now(),
+ path: rel,
+ });
+ throw apiError("INVALID_ARGUMENT", "only files can be opened in the Browser");
+ }
+ if (![".html", ".htm", ".xhtml"].includes(extname(full).toLowerCase())) {
+ this.services.audit?.({
+ pluginId,
+ api: "fs.openInBrowser",
+ ok: false,
+ errorCode: "INVALID_ARGUMENT",
+ ts: Date.now(),
+ path: rel,
+ });
+ throw apiError("INVALID_ARGUMENT", "only HTML files can be opened in the Browser");
+ }
+ try {
+ await this.services.openInBrowser?.(full);
+ } catch (error) {
+ const code = typeof error === "object" && error !== null && "code" in error
+ ? String(error.code)
+ : "OPEN_FAILED";
+ this.services.audit?.({
+ pluginId,
+ api: "fs.openInBrowser",
+ ok: false,
+ errorCode: code,
+ ts: Date.now(),
+ path: rel,
+ });
+ throw apiError(code, error instanceof Error ? error.message : String(error));
+ }
+ this.services.audit?.({
+ pluginId,
+ api: "fs.openInBrowser",
+ ok: true,
+ ts: Date.now(),
+ path: rel,
+ });
+ },
reveal: async (pathFromRoot: string) => {
const { full, rel } =
(await this.resolveRegisteredFolderRequest(loaded, pathFromRoot)) ??
diff --git a/apps/desktop/electron/main/services/plugin-services.ts b/apps/desktop/electron/main/services/plugin-services.ts
index b1b405977..5ce606a5d 100644
--- a/apps/desktop/electron/main/services/plugin-services.ts
+++ b/apps/desktop/electron/main/services/plugin-services.ts
@@ -638,6 +638,13 @@ export function createPluginServices({
* (ADR 0263) instead of the bare primary path.
*/
getWorkspaceInfo: () => pluginWorkspaceInfo(getWorkspacePath()),
+ openInBrowser: async (fullPath) => {
+ const preview = await browserHost.previewFile();
+ if (!preview.ok) {
+ throw Object.assign(new Error(preview.content), { code: "UNAVAILABLE" });
+ }
+ sendToRenderer(IPC.event.browserOpenFile, { path: fullPath });
+ },
/**
* The project each live session belongs to, so an fs call made by one
* session's tool follows that session instead of whichever project the
diff --git a/apps/desktop/src/features/app/useAppShellRuntime.tsx b/apps/desktop/src/features/app/useAppShellRuntime.tsx
index 6b71c1276..8b0be6185 100644
--- a/apps/desktop/src/features/app/useAppShellRuntime.tsx
+++ b/apps/desktop/src/features/app/useAppShellRuntime.tsx
@@ -624,6 +624,12 @@ export function useAppShellRuntime() {
...browserPluginTab(event.path ?? event.url),
});
});
+ const offBrowserOpenFile = api.onBrowserOpenFile(({ path }) => {
+ const state = useAppStore.getState();
+ if (state.activeSessionId) {
+ state.openWorkPanelTabForSession(state.activeSessionId, browserPluginTab(path));
+ }
+ });
const offHostStatus = api.onHostStatus((status) => {
if (status.archMismatch) setArchMismatch(status.archMismatch);
if (status.ok) {
@@ -829,6 +835,7 @@ export function useAppShellRuntime() {
offNotificationSound();
offInsecureEndpoint();
offBrowserPreview();
+ offBrowserOpenFile();
offBrowserState();
offHostStatus();
offNotificationChanged();
diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.ts
index 0772271cb..bae97d22a 100644
--- a/apps/desktop/src/lib/api.ts
+++ b/apps/desktop/src/lib/api.ts
@@ -1693,6 +1693,13 @@ export const api = {
}),
);
},
+ onBrowserOpenFile: (listener: (event: { path: string }) => void) => {
+ if (!window.piDesktop?.on) return () => undefined;
+ return window.piDesktop.on(IPC.event.browserOpenFile, (payload) => {
+ const event = payload as { path?: unknown };
+ if (typeof event?.path === "string") listener({ path: event.path });
+ });
+ },
onAgentEvent: (listener: (event: AgentEventEnvelope) => void) => {
if (!window.piDesktop?.on) return () => undefined;
return window.piDesktop.on(IPC.event.agentMessage, (payload) =>
diff --git a/apps/desktop/test/browser-preview-tool.test.mjs b/apps/desktop/test/browser-preview-tool.test.mjs
index 4837fe68f..59542693a 100644
--- a/apps/desktop/test/browser-preview-tool.test.mjs
+++ b/apps/desktop/test/browser-preview-tool.test.mjs
@@ -21,10 +21,18 @@ const runtimeSource = await readFile(
new URL("../../../packages/agent-runtime/src/runtime.ts", import.meta.url),
"utf8",
);
+const pluginRuntimeSource = await readFile(
+ new URL("../electron/main/plugin-runtime.ts", import.meta.url),
+ "utf8",
+);
const browserPluginSource = await readFile(
new URL("../resources/plugins/pi.browser/main.js", import.meta.url),
"utf8",
);
+const pluginServicesSource = await readFile(
+ new URL("../electron/main/services/plugin-services.ts", import.meta.url),
+ "utf8",
+);
test("sidecar routes main-local tools before the host-core proxy", () => {
// Local tools short-circuit tools.execute; other methods still proxy.
@@ -94,6 +102,23 @@ test("renderer routes browser preview events to the originating session", () =>
assert.match(appSource, /offBrowserPreview\(\);/);
});
+test("plugin HTML open routes through the active session without Browser CDP", () => {
+ assert.match(apiSource, /onBrowserOpenFile:[\s\S]*IPC\.event\.browserOpenFile/);
+ const hostOpen = pluginServicesSource.match(/openInBrowser: async \(fullPath\) => \{[\s\S]*?\n \},/)?.[0] ?? "";
+ assert.ok(hostOpen, "host filesystem service dispatches Browser-open events");
+ assert.match(hostOpen, /browserHost\.previewFile\(\)/);
+ assert.match(hostOpen, /IPC\.event\.browserOpenFile, \{ path: fullPath \}/);
+ const rendererHandler =
+ appSource.match(/api\.onBrowserOpenFile\([\s\S]*?\n \}\);/)?.[0] ?? "";
+ assert.ok(rendererHandler, "renderer Browser-open event handler exists");
+ assert.match(rendererHandler, /state\.activeSessionId/);
+ assert.match(rendererHandler, /openWorkPanelTabForSession\([\s\S]*browserPluginTab\(path\)/);
+ assert.match(protocolSource, /browserOpenFile: "pi-desktop\/browser\/event\/openFile"/);
+ assert.match(pluginRuntimeSource, /openInBrowser: async \(pathFromRoot: string\) =>/);
+ assert.match(pluginRuntimeSource, /api: "fs\.openInBrowser"/);
+ assert.doesNotMatch(hostOpen, /browser\.cdp|invokeBrowser/);
+});
+
test("agent runtime exposes BrowserPreview in every mode and prompts for it", () => {
// The complete registry includes BrowserPreview even though the active
// provider context may defer its schema until ToolSearch activates it.
diff --git a/apps/desktop/test/plugin-fs-scope.test.mjs b/apps/desktop/test/plugin-fs-scope.test.mjs
index f570a29f8..d1c82fe4e 100644
--- a/apps/desktop/test/plugin-fs-scope.test.mjs
+++ b/apps/desktop/test/plugin-fs-scope.test.mjs
@@ -77,6 +77,9 @@ const PLUGIN_MAIN = `
payload.grantId,
));
}
+ if (channel === "try.openInBrowser") {
+ return attempt(() => pi.fs.openInBrowser(payload.path));
+ }
throw new Error("unknown channel: " + channel);
},
};
@@ -126,13 +129,24 @@ function writePlugin({ id, permissions, fs: fsPolicy }) {
*/
async function harness(
t,
- { id, permissions, fs: fsPolicy, workspace, granted, consent, protectedPaths, folders },
+ {
+ id,
+ permissions,
+ fs: fsPolicy,
+ workspace,
+ granted,
+ consent,
+ protectedPaths,
+ folders,
+ openInBrowser: openInBrowserImpl,
+ },
) {
const ws = workspace ?? makeWorkspace();
const audits = [];
const consents = [];
const trashed = [];
const opened = [];
+ const browserOpened = [];
const revealed = [];
const answers = [...(consent ?? [])];
const runtime = new PluginRuntime({
@@ -159,6 +173,7 @@ async function harness(
audit: (entry) => audits.push(entry),
trashItem: async (fullPath) => trashed.push(fullPath),
openPath: async (fullPath) => opened.push(fullPath),
+ openInBrowser: openInBrowserImpl ?? (async (fullPath) => browserOpened.push(fullPath)),
revealPath: async (fullPath) => revealed.push(fullPath),
...(protectedPaths ? { protectedPaths: () => protectedPaths } : {}),
...(consent
@@ -175,7 +190,7 @@ async function harness(
});
const dir = writePlugin({ id, permissions, fs: fsPolicy });
await runtime.loadFromPath(dir, granted);
- return { runtime, ws, audits, consents, trashed, opened, revealed, dir };
+ return { runtime, ws, audits, consents, trashed, opened, browserOpened, revealed, dir };
}
function refused(t, promise, code, pattern) {
@@ -494,6 +509,83 @@ test("default-app opening reuses the readable file scope", async (t) => {
);
});
+test("opening an HTML file in the Browser reuses the readable file scope", async (t) => {
+ const { runtime, ws, browserOpened, audits } = await harness(t, {
+ id: "fs.open-in-browser.scoped",
+ permissions: ["fs.read"],
+ fs: { read: { scope: ["docs/**", "docs"] } },
+ workspace: makeWorkspace({
+ "docs/index.HTML": "<h1>hello</h1>",
+ "docs/readme.md": "text",
+ "notes.html": "<p>outside scope</p>",
+ }),
+ });
+
+ assert.deepEqual(
+ await runtime.invokePanelBridge("fs.open-in-browser.scoped", "try.openInBrowser", {
+ path: "docs/index.HTML",
+ }),
+ { ok: true, value: null },
+ );
+ assert.deepEqual(browserOpened, [realpathSync(join(ws, "docs/index.HTML"))]);
+ assert.ok(
+ audits.some((entry) => entry.api === "fs.openInBrowser" && entry.ok === true),
+ "opening an HTML file in the Browser is audited",
+ );
+
+ const markdown = await runtime.invokePanelBridge(
+ "fs.open-in-browser.scoped",
+ "try.openInBrowser",
+ { path: "docs/readme.md" },
+ );
+ assert.equal(markdown.ok, false);
+ assert.equal(markdown.code, "INVALID_ARGUMENT");
+ assert.match(markdown.message, /only HTML files/);
+
+ const outside = await runtime.invokePanelBridge(
+ "fs.open-in-browser.scoped",
+ "try.openInBrowser",
+ { path: "notes.html" },
+ );
+ assert.equal(outside.ok, false);
+ assert.equal(outside.code, "PERMISSION_DENIED");
+ assert.match(outside.message, /outside manifest\.fs\.read\.scope/);
+
+ const directory = await runtime.invokePanelBridge(
+ "fs.open-in-browser.scoped",
+ "try.openInBrowser",
+ { path: "docs" },
+ );
+ assert.equal(directory.ok, false);
+ assert.equal(directory.code, "INVALID_ARGUMENT");
+ assert.match(directory.message, /only files/);
+});
+
+test("a disabled Browser is reported and the failed open is audited", async (t) => {
+ const { runtime, audits } = await harness(t, {
+ id: "fs.open-in-browser.unavailable",
+ permissions: ["fs.read"],
+ fs: { read: { scope: ["docs/**", "docs"] } },
+ workspace: makeWorkspace({ "docs/a.html": "<p>preview</p>" }),
+ openInBrowser: async () => {
+ throw Object.assign(new Error("Browser plugin is disabled"), { code: "UNAVAILABLE" });
+ },
+ });
+
+ const result = await runtime.invokePanelBridge(
+ "fs.open-in-browser.unavailable",
+ "try.openInBrowser",
+ { path: "docs/a.html" },
+ );
+ assert.equal(result.ok, false);
+ assert.equal(result.code, "UNAVAILABLE");
+ assert.match(result.message, /Browser plugin is disabled/);
+ assert.ok(
+ audits.some((entry) => entry.api === "fs.openInBrowser" && entry.errorCode === "UNAVAILABLE"),
+ "the failed Browser request is auditable",
+ );
+});
+
test("file reveal reuses the readable file scope", async (t) => {
const { runtime, ws, revealed, audits } = await harness(t, {
id: "fs.reveal.scoped",
@@ -528,8 +620,11 @@ test("file reveal reuses the readable file scope", async (t) => {
});
test("a host action reaches a file in another folder of the open project", async (t) => {
- const other = makeWorkspace({ "notes.txt": "second folder" });
- const { runtime, ws, opened, revealed } = await harness(t, {
+ const other = makeWorkspace({
+ "notes.txt": "second folder",
+ "index.html": "<h1>second folder</h1>",
+ });
+ const { runtime, ws, opened, browserOpened, revealed } = await harness(t, {
id: "fs.folders.open",
permissions: ["fs.read"],
fs: { read: { root: "workspace", scope: ["**"] } },
@@ -551,6 +646,11 @@ test("a host action reaches a file in another folder of the open project", async
realpathSync(join(other, "notes.txt")),
]);
+ await runtime.invokePanelBridge("fs.folders.open", "fs.openInBrowser", {
+ path: join(other, "index.html"),
+ });
+ assert.deepEqual(browserOpened, [realpathSync(join(other, "index.html"))]);
+
await runtime.invokePanelBridge("fs.folders.open", "fs.reveal", {
path: join(other, "notes.txt"),
});
diff --git a/apps/desktop/test/plugin-runtime-risk.test.mjs b/apps/desktop/test/plugin-runtime-risk.test.mjs
index 0058f8361..497d92599 100644
--- a/apps/desktop/test/plugin-runtime-risk.test.mjs
+++ b/apps/desktop/test/plugin-runtime-risk.test.mjs
@@ -39,6 +39,7 @@ test("plugin runtime exposes gated high-risk host APIs", () => {
"fs.write",
"fs.delete",
"fs.openDefault",
+ "fs.openInBrowser",
"fs.reveal",
"net.fetch",
"agent.complete",
diff --git a/docs/adr/0330-open-html-files-in-work-panel-browser-from-plugins.md b/docs/adr/0330-open-html-files-in-work-panel-browser-from-plugins.md
new file mode 100644
index 000000000..c8f240f77
--- /dev/null
+++ b/docs/adr/0330-open-html-files-in-work-panel-browser-from-plugins.md
@@ -0,0 +1,62 @@
+# ADR 0330: Open scoped HTML files in the work-panel Browser from plugins
+
+- Status: Accepted
+- Date: 2026-10-16
+- Deciders: PI-Desktop maintainers
+- Related: [ADR 0109](0109-open-files-with-the-os-associated-application.md) ·
+ [ADR 0170](0170-work-panel-browser-as-bundled-plugin.md) ·
+ [ADR 0264](0264-host-mediated-actions-follow-the-browsed-folder.md) ·
+ [ADR 0328](0328-browser-arbitrary-local-files.md) ·
+ [07-plugins/03-plugin-api](../spec/07-plugins/03-plugin-api.md) · E2E-153
+
+## Context
+
+The bundled File Manager can open files with the OS application or reveal them
+in the file manager. HTML previews need the bundled work-panel Browser, but its
+public `pi.browser.*` API is gated by high-risk `browser.cdp` and also exposes
+page inspection and control. That permission is broader than a file-tree
+preview action needs.
+
+## Decision
+
+1. Add the additive `pi.fs.openInBrowser(pathFromRoot)` API and panel bridge
+ channel `fs.openInBrowser`, covered by the existing `fs.read` permission.
+2. Resolve the path with the same real-path, protected-path, credential
+ deny-list, declared-scope, and project-group root checks as the other
+ host-mediated file actions. Accept only existing regular `.html`, `.htm`, or
+ `.xhtml` files, and audit successful and refused requests.
+3. After validation, Electron Main sends a dedicated Browser-open event to the
+ renderer. The renderer creates a Browser resource tab for the active local
+ session. The bundled Browser plugin must be enabled; disabled Browser state
+ fails with `UNAVAILABLE`.
+4. This action does not grant `browser.cdp`, expose Browser actions or page
+ contents, broaden `BrowserPreview`, or change the Browser's existing local
+ file navigation policy (ADR 0328). No host-core protocol version or
+ persisted data changes.
+
+## Consequences
+
+- A File Manager user can preview an authorized HTML file without leaving the
+ work panel or granting the plugin Browser control.
+- The Browser continues to apply its established policy for local HTML and
+ linked local resources after the host has checked the file-tree selection.
+- Plugins cannot use this API to open directories, non-HTML files, credentials,
+ protected app data, or paths outside their declared read scope.
+
+## Alternatives considered
+
+### Grant `browser.cdp` to the File Manager
+
+Rejected: that high-risk capability also permits page inspection and browser
+actions, while this interaction only needs the host to open one scoped file.
+
+### Reuse `BrowserPreview`
+
+Rejected: `BrowserPreview` is workspace-rooted and session-originated. File
+Manager also supports explicitly browsing another registered folder in a
+project group, and its user-driven action needs to follow the selected file.
+
+### Open through `shell.openExternal(file:)`
+
+Rejected: external URL opening intentionally excludes local file URLs. A
+separate scoped host action preserves that boundary.
diff --git a/docs/adr/README.md b/docs/adr/README.md
index 0efb820a2..c65981843 100644
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@ -375,6 +375,7 @@ Each ADR includes:
| 0327 | [Automatic remote Host version realignment](0327-remote-host-version-realignment.md) | Accepted for experimental implementation (amends ADR 0326 item 6; Linux SSH qualification pending) |
| 0328 | [Open arbitrary local files in the embedded Browser](0328-browser-arbitrary-local-files.md) | Accepted (D657; amends ADR 0170; issue #1627) |
| 0329 | [Isolate parallel sessions of one project in git worktrees](0329-session-worktree-isolation.md) | Accepted (Windows E2E pending) |
+| 0330 | [Open scoped HTML files in the work-panel Browser from plugins](0330-open-html-files-in-work-panel-browser-from-plugins.md) | Accepted |
| plugin-fetch-redirect-policy | [Host-enforced plugin fetch redirect policy](plugin-fetch-redirect-policy.md) | Accepted (implementation candidate for #1475) |
| local-agent-remote-workspace-tools | [Local Agent and model requests for remote workspaces](local-agent-remote-workspace-tools.md) | Accepted for implementation |
diff --git a/docs/spec/03-runtime/01-ipc-protocol.md b/docs/spec/03-runtime/01-ipc-protocol.md
index 8467ed21f..64c0fa905 100644
--- a/docs/spec/03-runtime/01-ipc-protocol.md
+++ b/docs/spec/03-runtime/01-ipc-protocol.md
@@ -1893,6 +1893,11 @@ Renderer IPC kept for the Plan-safe preview facade and URL fallback:
`location` in the matching
runtime panel context. Navigation of a background session does not steal the
visible guest.
+- plugin file action: `browser/event/openFile {path}`. Electron Main emits this
+ only after the plugin's `fs.openInBrowser` request passes its declared
+ `fs.read` scope and HTML-file checks. The renderer opens the absolute path in a
+ new Browser resource tab for the active local session; the Browser plugin
+ must be enabled. This route grants no `browser.cdp` access.
### fs (read-only)
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index f12d336f6..42caec067 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -1049,9 +1049,15 @@ entirely inside the plugin's isolated page:
without walking the whole workspace up front. Search (`fs.glob`-equivalent
filename matching) lists hits without expanding the tree, and refresh
disables itself while it reloads the root and the expanded folders.
-- A context menu on a row offers create, rename/move, **Open with default app**,
- and **Show in folder**. The last two are offered for files only: the host
- refuses them for directories.
+- A row context menu is grouped and ordered as Open With, Create, Rename / Move /
+ Delete, Copy Paths, file actions, and Refresh. Open With includes **Open in
+ built-in Browser** for `.html`, `.htm`, and `.xhtml` files plus **Open with
+ default app**; create actions remain available for files and directories,
+ while rename, move, delete, copy, and file actions follow their applicable
+ selection. The default-app action is disabled for directories, while editor
+ choices remain available. The Browser action opens a new Browser resource tab
+ and requires the bundled Browser plugin to be enabled. **Show in folder**
+ remains a file action. The host refuses directory paths for file actions.
- Selecting a file replaces the tree with a focused viewer: syntax-highlighted
editing with save, a Markdown preview toggle, image and audio/video viewing,
CSV/TSV tables with paging and sorting, a JSON tree, and read-only SQLite
@@ -1077,7 +1083,7 @@ entirely inside the plugin's isolated page:
- The page follows `app.getAppearance` and `appearance:changed` for base theme
and English/Simplified Chinese copy, and `workspace:changed` for the open
project and its folder list. `workspace.get`, `app.getAppearance`,
- `fs.openDefault`, and `fs.reveal` are the only host channels it calls; its own
+ `fs.openDefault`, `fs.openInBrowser`, and `fs.reveal` are the only host channels it calls; its own
reads and writes go through its host process, which keeps the jail of the one
folder the view is browsing — never the whole group — refuses credential
paths, and records writes to its own audit log (ADR 0241, ADR 0263).
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 49dfdba04..67f120124 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -9508,9 +9508,14 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.
the view's top-left folder control to the project's second folder and
confirm the tree follows it while the app's visible workspace does not,
then switch back to the project's primary folder.
- 4. Right-click a file and confirm **Open with default app** and **Show in
- folder** are offered and work; right-click a directory and confirm they are
- not offered, because the host refuses the action for directories.
+ 4. Right-click an HTML file and confirm **Open in built-in Browser** appears
+ under Open With. Select it and verify a new Browser resource tab opens the
+ file in the active local session while the File Manager tab remains open.
+ Right-click a non-HTML file and confirm that item is absent. Confirm
+ **Open with default app** and **Show in folder** remain available for files
+ and work. For directories, confirm the built-in Browser and Show in folder
+ actions are absent, the default-app action is disabled, and editor choices
+ remain available.
5. Open a text file, edit it, and save. Confirm the file on disk changed and
the editor keeps the saved content. Change the same file outside the app,
edit and save again, and confirm the conflict is reported instead of the
@@ -9541,13 +9546,15 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.
- **Specs linked**: `07-plugins/03-plugin-api.md` §3,
`07-plugins/13-plugin-permissions-matrix.md` §2,
`04-ux/08-component-spec.md` §5, ADR 0104, ADR 0109, ADR 0111,
- ADR 0169, ADR 0241, ADR 0249, ADR 0263
+ ADR 0169, ADR 0241, ADR 0249, ADR 0263, ADR 0330
- **Acceptance**: G (plugins), D (workspace), Security, Quality
- **Milestone**: M6+
- **Status**: Unit coverage in `apps/desktop/test/bundled-plugins.test.mjs`
(manifest contract, public-bridge-only page, vendored checksums),
- `apps/desktop/test/plugin-fs-scope.test.mjs` (`fs.openDefault` and `fs.reveal`
- guards), `apps/desktop/test/plugin-work-panel-views.test.mjs` (docked-view
+ `apps/desktop/test/plugin-fs-scope.test.mjs` (`fs.openDefault`,
+ `fs.openInBrowser`, and `fs.reveal` guards),
+ `apps/desktop/test/browser-preview-tool.test.mjs` (Browser resource-tab event
+ routing), `apps/desktop/test/plugin-work-panel-views.test.mjs` (docked-view
event broadcast), and host-core
`bundled_plugins_refresh_from_disk_but_keep_user_state`; the packaged journey
is Draft (run only in a capable environment when this surface changes)
diff --git a/docs/spec/07-plugins/01-plugin-system.md b/docs/spec/07-plugins/01-plugin-system.md
index 1494beb58..e65f74c07 100644
--- a/docs/spec/07-plugins/01-plugin-system.md
+++ b/docs/spec/07-plugins/01-plugin-system.md
@@ -290,6 +290,7 @@ Namespace: `pi.plugin.*`
- `pi.workspace.get()`
- `pi.fs.readText(path)`
- `pi.fs.openDefault(path)` // open the selected file with the OS-associated app
+- `pi.fs.openInBrowser(path)` // open an HTML file in the work-panel Browser
- `pi.fs.reveal(path)` // show the selected file in the OS file manager
- `pi.fs.writeText(path, content)` // high risk
- `pi.fs.glob(pattern)`
diff --git a/docs/spec/07-plugins/03-plugin-api.md b/docs/spec/07-plugins/03-plugin-api.md
index 024d37f0b..65422a591 100644
--- a/docs/spec/07-plugins/03-plugin-api.md
+++ b/docs/spec/07-plugins/03-plugin-api.md
@@ -264,6 +264,7 @@ pi.fs.readPreview(pathFromRoot: string): Promise<{
size: number
}>
pi.fs.openDefault(pathFromRoot: string): Promise<void>
+pi.fs.openInBrowser(pathFromRoot: string): Promise<void>
pi.fs.reveal(pathFromRoot: string): Promise<void>
pi.fs.writeText(pathFromRoot: string, content: string): Promise<void>
pi.fs.glob(pattern: string): Promise<string[]>
@@ -297,11 +298,21 @@ returns `text` (capped at 512 KiB), `image` (capped at 5 MiB, as a data URL),
associated application. It uses the same `fs.read` root, symlink, protected-path,
deny-list, and scope checks as `fs.readText`; directories are rejected. The host
audits the operation. A path is root-relative by default, and an absolute path is
-accepted only by this action and `fs.reveal` (no other mode takes one) when it lies
+accepted only by `fs.openDefault`, `fs.openInBrowser`, and `fs.reveal` (no other mode takes one) when it lies
inside a registered folder root of the open project — which then becomes the
containment base for the request (ADR 0249 §5, ADR 0264). That is the shape a view
uses to name a file in a project folder other than the primary one.
+`fs.openInBrowser` opens one existing `.html`, `.htm`, or `.xhtml` file in a new
+resource tab in the active local session's bundled work-panel Browser. It uses
+the same `fs.read` root, symlink, protected-path, deny-list, and scope checks as
+`fs.openDefault`; directories and other file types are rejected. An absolute
+path is accepted only when it lies inside a registered folder root of the open
+project, with the matched folder as the containment base. The Browser plugin
+must be enabled. This host-mediated preview does not grant `browser.cdp` or expose
+Browser actions or page contents to the caller. The Browser itself retains its
+existing local-file navigation policy (ADR 0328).
+
`fs.reveal` reveals one existing readable file in the operating system's file
manager and selects it when the platform supports that behavior. It uses the
same `fs.read` checks, rejects directories, and audits both success and failure.
@@ -1288,7 +1299,7 @@ The host-owned preload forwards only fixed channels to the plugin runtime:
| `plugin.getSettings`, `workspace.get`, `app.getAppearance` | None |
| `app.setTheme`, `themes.upsert`, `themes.remove`, `themes.list` | `ui.theme` |
| `models.list` | `models.list` |
-| `fs.readText`, `fs.stat`, `fs.readRange`, `fs.readPreview`, `fs.openDefault`, `fs.reveal`, `fs.glob`, `fs.list` | `fs.read` |
+| `fs.readText`, `fs.stat`, `fs.readRange`, `fs.readPreview`, `fs.openDefault`, `fs.openInBrowser`, `fs.reveal`, `fs.glob`, `fs.list` | `fs.read` |
| `fs.writeText` | `fs.write` |
| `clipboard.readText`, `clipboard.getHistory` | `clipboard.read` |
| `clipboard.writeText` | `clipboard.write` |
@@ -1329,6 +1340,7 @@ Any of the following calls must be logged for audit:
- fs.stat, fs.readRange, fs.remove, fs.requestDirectory, and every refused fs call (with its path and
`errorCode`), plus each consent answer and why it was asked (`scope` / `rate`)
- fs.openDefault (with its root-relative path and whether the OS open succeeded)
+- fs.openInBrowser (with its root-relative path and whether the Browser open was accepted)
- fs.reveal (with its root-relative path and whether the file manager reveal succeeded)
- fs.readPreview (with its root-relative path and classified `kind`)
- execute after agent.registerTool (including tools discovered from a plugin's
@@ -1366,7 +1378,7 @@ Log fields:
The desktop plugin runtime now implements the MVP host API surface used by local and marketplace plugins:
- `app.*`, `plugin.*`, `commands.*`, `ui.*`, `workspace.*`
-- `fs.readText` / `fs.stat` / `fs.readRange` / `fs.readPreview` / `fs.openDefault` / `fs.reveal` /
+- `fs.readText` / `fs.stat` / `fs.readRange` / `fs.readPreview` / `fs.openDefault` / `fs.openInBrowser` / `fs.reveal` /
`fs.writeText` / `fs.glob` / `fs.list` / `fs.remove` / `fs.requestDirectory`,
bounded by `manifest.fs` (ADR 0088)
- `agent.registerTool` / `unregisterTool` / `agent.complete`
diff --git a/docs/spec/07-plugins/04-plugin-security.md b/docs/spec/07-plugins/04-plugin-security.md
index 814748351..d26f652f1 100644
--- a/docs/spec/07-plugins/04-plugin-security.md
+++ b/docs/spec/07-plugins/04-plugin-security.md
@@ -330,11 +330,14 @@ Plan is an additional host policy boundary for agent tools:
- `net.fetch` is not granted by default
- `openExternal` should confirm. The host parses the URL and opens only
`http:`, `https:`, and `mailto:` (D330 / ADR 0168); other schemes fail with
- `INVALID_ARGUMENT` and never reach `shell.openExternal`. `fs.openDefault` and
- `fs.reveal` are separate: each accepts only an existing root-relative file
- that already passes the plugin's `fs.read` policy. They are intended for
- explicit file-view actions, not arbitrary URL or absolute-path opening;
- `fs.reveal` only asks the OS file manager to select the file.
+ `INVALID_ARGUMENT` and never reach `shell.openExternal`. `fs.openDefault`,
+ `fs.openInBrowser`, and `fs.reveal` are separate: each accepts only an
+ existing file that already passes the plugin's `fs.read` policy. The Browser
+ action accepts HTML files only and opens a new work-panel resource tab; it
+ does not grant Browser CDP access. These APIs are intended for explicit
+ file-view actions, not arbitrary URL opening. The host-mediated file actions
+ also allow absolute paths under registered project roots; `fs.reveal` only
+ asks the OS file manager to select the file.
- Plugins are forbidden from silently downloading and executing binaries (not done at all in MVP)
### 8.0 Egress allowlist
diff --git a/docs/spec/07-plugins/12-plugin-ipc-and-host-services.md b/docs/spec/07-plugins/12-plugin-ipc-and-host-services.md
index 47a59d8d8..b64d3e21e 100644
--- a/docs/spec/07-plugins/12-plugin-ipc-and-host-services.md
+++ b/docs/spec/07-plugins/12-plugin-ipc-and-host-services.md
@@ -203,7 +203,7 @@ Panel bridge file channels are permission-gated as follows:
| Channel | Required permission |
|---|---|
-| `fs.readText`, `fs.stat`, `fs.readRange`, `fs.readPreview`, `fs.openDefault`, `fs.reveal`, `fs.glob`, `fs.list` | `fs.read` |
+| `fs.readText`, `fs.stat`, `fs.readRange`, `fs.readPreview`, `fs.openDefault`, `fs.openInBrowser`, `fs.reveal`, `fs.glob`, `fs.list` | `fs.read` |
| `fs.registerDropped` | `fs.read` plus a real drop gesture |
| `fs.writeText` | `fs.write` |
diff --git a/docs/spec/07-plugins/13-plugin-permissions-matrix.md b/docs/spec/07-plugins/13-plugin-permissions-matrix.md
index 7b59d066a..3c35e5747 100644
--- a/docs/spec/07-plugins/13-plugin-permissions-matrix.md
+++ b/docs/spec/07-plugins/13-plugin-permissions-matrix.md
@@ -16,7 +16,7 @@ Provide a permission–capability–risk–default-policy reference table for re
| `clipboard.read` | medium | `clipboard.readText`, `clipboard.getHistory` | Confirm on first use | May read sensitive information and retained clipboard history |
| `clipboard.write` | medium | `clipboard.writeText` | Confirm on first use | Prevents clipboard pollution |
| `notify` | low | `ui.notify`, `ui.getNotificationPermission`, `ui.requestNotificationPermission`, `ui.showNativeNotification` | Can be granted by default | Native delivery is OS-controlled; avoid notification-spam abuse |
-| `fs.read` | medium | `fs.readText` / `fs.stat` / `fs.readRange` / `fs.readPreview` / `fs.openDefault` / `fs.reveal` / `fs.glob` / `fs.list` / `fs.requestDirectory` / dropped-file grant | Granted at install, bounded by `manifest.fs.read` | `fs.stat` and `fs.readRange` share the read gate; a dropped-file grant is one-file, read-only, memory-only, and gesture-bound; all file calls remain root- and deny-list-checked |
+| `fs.read` | medium | `fs.readText` / `fs.stat` / `fs.readRange` / `fs.readPreview` / `fs.openDefault` / `fs.openInBrowser` / `fs.reveal` / `fs.glob` / `fs.list` / `fs.requestDirectory` / dropped-file grant | Granted at install, bounded by `manifest.fs.read` | `fs.stat` and `fs.readRange` share the read gate; Browser open accepts HTML only and creates a resource tab without granting CDP; a dropped-file grant is one-file, read-only, memory-only, and gesture-bound; all file calls remain root- and deny-list-checked |
| `fs.write` | high | `fs.writeText` | Granted at install, bounded by `manifest.fs.write` | Scope is required; a whole-tree pattern fails validation. Out of scope asks the user |
| `fs.delete` | high | `fs.remove` | Granted at install, bounded by `manifest.fs.delete` | Two tiers (`own` / `scope`), always via the OS trash, non-recursive, rate-braked (§2B) |
| `fs.read.workspace` | medium | — | Downgraded on load to `fs.read` with a whole-tree scope | Legacy name; predates scopes |
diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.md
index e4ee12866..0b8bfed5c 100644
--- a/docs/spec/08-meta/decisions-log.md
+++ b/docs/spec/08-meta/decisions-log.md
@@ -53,6 +53,7 @@ This log freezes previously open questions into concrete decisions.
| D657 | Let the embedded Browser open local files outside the workspace | **Amend ADR 0170: an explicit absolute path or `file:` URL may load any existing regular local file, and a local-file page may navigate to other existing local files. Relative inputs remain workspace-rooted; HTTP(S) pages retain only the prior in-workspace file-link allowance. Missing files, directories, and remote file authorities remain blocked. `BrowserPreview` and the sidecar keep their workspace-rooted resolver. The public `pi.browser.navigate` API follows this policy under the high-risk `browser.cdp` permission. See ADR 0328, E2E-059, `04-ux/08-component-spec.md`, and `05-security/01-security.md`.** | Users need to inspect local HTML outside a project, while workspace-scoped agent file tools and remote-page navigation must retain their existing boundary (#1627). |
| D659 | Reopen archived projects in the sidebar | **Amend D093 / D455: successful explicit project activation clears the normalized path's renderer-local archived flag and persists it, so Open from Project archive, reopening the same folder through Add project, and opening a project session reveal the project in the home sidebar. Selecting a row for inspection and ordinary session refreshes do not alter archive state. No host/project/session storage or protocol change. See ADR 0294, E2E-264, and issue #1653.** | Reopening a project changed the active workspace but left its path-keyed archived presentation flag set, hiding it from the sidebar after the user explicitly reopened it. |
| D661 | Segmented turn process and independent thinking preference | **Supersede the `Detailed` / `Compact` display-mode behavior and the single whole-process disclosure recorded by D633 / D651 and the `turn-process-and-thinking-display` ADR: a turn renders as chronological collapsible process segments, Bash and run aliases stay outside every folded container (the turn-level process disclosure and any ordinary activity group) and remain visible even when every group is collapsed, and process/group folding defaults are independent of the thinking preference. The preference is the optional boolean `AppSettings.showThinking`; absent or non-boolean values fall back to the legacy `thinkingDisplayMode` field (`compact` hides, `detailed`/unknown/absent shows), which is retained only for persisted-settings compatibility. `showThinking` joins the portable application fields so it synchronizes like the legacy field; no other host protocol, persistence schema, permission, or plugin contract change. See the amended ADR, `04-ux/06-settings-ia.md`, `04-ux/08-component-spec.md`, `04-ux/09-interaction-patterns.md`, and E2E-CHAT-turn-process-and-thinking-display.** | One flat container left long tool/search runs hard to scan and forced reasoning visibility and process folding into the same two-valued switch; an independent boolean plus always-visible Bash rows keeps shell-heavy turns readable without hiding the answer. |
+| D662 | Open scoped HTML files in the work-panel Browser from plugins | **Add `pi.fs.openInBrowser(pathFromRoot)` under `fs.read`. The host applies the plugin's normal read containment, protected-path, credential deny-list, declared scope, and registered project-folder checks; only existing `.html`, `.htm`, and `.xhtml` files qualify. After validation, Main asks the renderer to create a Browser resource tab for the active local session. The Browser plugin must be enabled. This grants no `browser.cdp`, changes no BrowserPreview or local-file navigation policy, and adds no host-core protocol or persisted-state change. See ADR 0330, `07-plugins/03-plugin-api.md`, `07-plugins/13-plugin-permissions-matrix.md`, `04-ux/08-component-spec.md`, and E2E-153.** | The File Manager needs an in-app HTML preview, while granting its plugin `browser.cdp` would also expose unrelated page inspection and control. |
## B. Secondary implementation defaults
@@ -7735,3 +7736,16 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.
the i18n catalog tests. See the amended ADR, `04-ux/06-settings-ia.md`,
`04-ux/08-component-spec.md`, `04-ux/09-interaction-patterns.md`, and
E2E-CHAT-turn-process-and-thinking-display.
+
+## 2026-10-16 — Open scoped HTML files in the work-panel Browser from plugins (D662)
+
+- Add `pi.fs.openInBrowser(pathFromRoot)` under `fs.read`. Main applies the
+ plugin's ordinary filesystem read gates, including project-group roots, and
+ accepts existing HTML files only. Each call is audited.
+- After validation, Main sends a dedicated event; the renderer opens the file
+ in a Browser resource tab for the active local session. The Browser plugin
+ must be enabled. This action does not grant CDP or expose Browser controls.
+- Covered by `apps/desktop/test/plugin-fs-scope.test.mjs` and
+ `apps/desktop/test/browser-preview-tool.test.mjs`. The packaged File Manager
+ scenario in E2E-153 covers the complete user path. See ADR 0330 and the
+ plugin API, permission, security, and component specs.
diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.md
index dc6872fca..40476b06c 100644
--- a/docs/zh-CN/spec/08-meta/decisions-log.md
+++ b/docs/zh-CN/spec/08-meta/decisions-log.md
@@ -55,6 +55,7 @@
| D657 | 让内置浏览器打开工作区外的本地文件 | **修订 ADR 0170:通过绝对路径或 `file:` URL 可打开任意已存在的本地普通文件,本地文件页面也可导航到其他已存在的本地文件。相对输入仍以工作区为根;HTTP(S) 页面只保留此前工作区内文件链接的权限。缺失文件、目录与远程文件 authority 仍被阻止。`BrowserPreview` 与 sidecar 继续使用工作区根解析。公开的 `pi.browser.navigate` API 在高风险 `browser.cdp` 权限下采用相同策略。见 ADR 0328、E2E-059、`04-ux/08-component-spec.md` 与 `05-security/01-security.md`。** | 用户需要检查项目外的本地 HTML,而工作区范围内的 Agent 文件工具和远程页面导航仍须保留原有边界(#1627)。 |
| D659 | 重新打开归档项目后恢复侧栏显示 | **修订 D093 / D455:成功明确激活项目时,清除该规范化路径的渲染层归档标记并持久化,使用户从「项目归档」点击「打开」、通过「添加项目」再次选择同一目录,或打开项目会话后,都能在主页侧边栏看到该项目。仅选择归档详情行而未激活,以及普通会话刷新,都不改变归档状态。不更改 Host/项目/会话存储或协议。见 ADR 0294、E2E-264 与 issue #1653。** | 用户明确重新打开项目后,活动工作区虽已切换,但按路径存储的归档展示标记仍在,导致项目从侧栏隐藏。 |
| D661 | 分段回合过程与独立的思考偏好 | **取代 D633 / D651 与 `turn-process-and-thinking-display` ADR 中记录的 `Detailed` / `Compact` 显示模式行为与单一整体过程披露:回合渲染为按时间顺序排列的可折叠过程片段,Bash 与 run 别名位于所有折叠容器之外(回合级过程披露与任何普通活动组),即使所有组都收起也保持可见,且过程/组折叠默认值不依赖思考偏好。偏好为可选的布尔值 `AppSettings.showThinking`;缺失或非布尔值回退到旧版 `thinkingDisplayMode` 字段(`compact` 隐藏,`detailed`/未知/缺失显示),该旧字段仅为持久化设置兼容性保留。`showThinking` 加入可移植应用字段,因此会像旧字段一样同步;其余 Host 协议、持久化 schema、权限或插件契约不变。见修订后的 ADR、`04-ux/06-settings-ia.md`、`04-ux/08-component-spec.md`、`04-ux/09-interaction-patterns.md` 与 E2E-CHAT-turn-process-and-thinking-display。** | 单一扁平容器让较长的工具/搜索序列难以浏览,并把推理可见性与过程折叠挤进同一个二值开关;独立布尔值加上始终可见的 Bash 行,让命令密集的回合保持可读又不遮挡回答。 |
+| D662 | 插件在工作面板 Browser 中打开受范围限制的 HTML | **在 `fs.read` 下新增 `pi.fs.openInBrowser(pathFromRoot)`。宿主执行插件常规的读取路径包含、受保护路径、凭据拒绝名单、声明范围与项目注册文件夹检查;仅接受已存在的 `.html`、`.htm`、`.xhtml` 文件。验证后,Main 请求渲染进程为当前本地会话创建 Browser 资源标签页。Browser 插件必须启用。此操作不授予 `browser.cdp`,不改变 BrowserPreview 或本地文件导航策略,也不新增 host-core 协议或持久化状态。见 ADR 0330、`07-plugins/03-plugin-api.md`、`07-plugins/13-plugin-permissions-matrix.md`、`04-ux/08-component-spec.md` 与 E2E-153。** | 文件管理器需要在应用内预览 HTML;如果授予插件 `browser.cdp`,也会暴露无关的页面检查与控制能力。 |
## B. 辅助实现默认值
@@ -5455,3 +5456,14 @@ Markdown 源码,不是 `text/html` 负载;对禁用行内 HTML 的外部编
i18n 目录测试覆盖。见修订后的 ADR、`04-ux/06-settings-ia.md`、
`04-ux/08-component-spec.md`、`04-ux/09-interaction-patterns.md` 与
E2E-CHAT-turn-process-and-thinking-display。
+
+## 2026-10-16 —— 插件在工作面板 Browser 中打开受范围限制的 HTML 文件(D662)
+
+- 在 `fs.read` 下新增 `pi.fs.openInBrowser(pathFromRoot)`。宿主沿用插件常规的
+ 读取路径包含检查、受保护路径检查、凭据拒绝名单、声明范围与项目注册文件夹检查;
+ 只接受已存在的 `.html`、`.htm` 与 `.xhtml` 文件,并审计每次调用。
+- 验证通过后,Main 发送专用事件;渲染进程为当前本地会话打开 Browser 资源标签页。
+ Browser 插件必须启用。此操作不授予 `browser.cdp`,也不暴露 Browser 控制能力。
+- 由 `apps/desktop/test/plugin-fs-scope.test.mjs` 与
+ `apps/desktop/test/browser-preview-tool.test.mjs` 覆盖。E2E-153 的已打包文件管理器
+ 场景覆盖完整用户流程。见 ADR 0330 以及插件 API、权限、安全与组件规格。
diff --git a/packages/plugin-sdk/src/index.ts b/packages/plugin-sdk/src/index.ts
index c3ba33f7d..da955f6c3 100644
--- a/packages/plugin-sdk/src/index.ts
+++ b/packages/plugin-sdk/src/index.ts
@@ -1229,6 +1229,8 @@ export type PluginHostApi = {
readPreview: (pathFromRoot: string) => Promise<PluginFsPreview>;
/** Open an existing readable file with the operating system's default app. */
openDefault: (pathFromRoot: string) => Promise<void>;
+ /** Open an existing readable HTML file in the bundled work-panel Browser. */
+ openInBrowser: (pathFromRoot: string) => Promise<void>;
/** Reveal an existing readable file in the operating system's file manager. */
reveal: (pathFromRoot: string) => Promise<void>;
writeText: (pathFromRoot: string, content: string) => Promise<void>;
diff --git a/packages/shared/src/protocol.ts b/packages/shared/src/protocol.ts
index d5845b678..d03bb7ce9 100644
--- a/packages/shared/src/protocol.ts
+++ b/packages/shared/src/protocol.ts
@@ -449,6 +449,7 @@ export const IPC = {
insecureEndpointNotice: "pi-desktop/network/event/insecureEndpointNotice",
browserState: "pi-desktop/browser/event/state",
browserPreview: "pi-desktop/browser/event/preview",
+ browserOpenFile: "pi-desktop/browser/event/openFile",
windowMaximized: "pi-desktop/window/event/maximized",
windowFullScreen: "pi-desktop/window/event/fullscreen",
windowWorkPanelResize: "pi-desktop/window/event/workPanelResize",