diff --git a/packages/plugin-browser/src/rpc.ts b/packages/plugin-browser/src/rpc.ts index ce26994a3cb..aa84fb7e13c 100644 --- a/packages/plugin-browser/src/rpc.ts +++ b/packages/plugin-browser/src/rpc.ts @@ -281,7 +281,7 @@ const workspaceFile = optional( const focus = optional( Schema.Boolean.annotate({ description: - "For a web address. True: ask to show this tab if the pane is closed and the person's settings allow it. Omit to make it active for the agent without revealing it. False keeps it in the background until the person selects it. Never switches the person's open tab. A workspace file is always shown to the person.", + "For a web address. True, only when the person asked to see or be shown the page: opens the browser if it is closed and the person's settings allow it. Omit to make it active for the agent without revealing it. False keeps it in the background until the person selects it. Never switches the person's open tab. A workspace file is always shown to the person.", }), ) const FileTab = Schema.Struct({ @@ -298,7 +298,7 @@ export const Operations = [ ), operation( "tabs.open", - 'Open a tab on a web address (url), or show a workspace file to the user (path). Pass one of them, or neither for about:blank. A web address loads over the connected server\'s network; localhost reaches that server. Use path to present an artifact, result or output for the user to view. An HTML page opens in a tab, even off screen, and opening the same file again reloads that tab; keep its assets in its own folder or subfolders, because hidden and secret files cannot load. Any other file opens in the file panel instead, for display once the session is on screen, and returns { path, shown: "file" } without a tab: images and screenshots (PNG, JPEG, GIF, WebP, charts, plots, photos), SVG, audio, video (MP4, WebM), PDF documents, Markdown, Mermaid diagrams, CSV and TSV tables, and fonts render as media previews; text and code show source. A missing file, a folder or a path outside the workspace fails.', + 'Open a tab on a web address (url), or show a workspace file to the user (path). Pass one of them, or neither for about:blank. A web address loads over the connected server\'s network; localhost reaches that server. A web page opens without showing itself: pass focus: true only when the user asked to see or be shown the page. Use path to present an artifact, result or output for the user to view. An HTML page opens in a tab, even off screen, and opening the same file again reloads that tab; keep its assets in its own folder or subfolders, because hidden and secret files cannot load. Any other file opens in the file panel instead, for display once the session is on screen, and returns { path, shown: "file" } without a tab: images and screenshots (PNG, JPEG, GIF, WebP, charts, plots, photos), SVG, audio, video (MP4, WebM), PDF documents, Markdown, Mermaid diagrams, CSV and TSV tables, and fonts render as media previews; text and code show source. A missing file, a folder or a path outside the workspace fails.', { url: webAddress, focus }, Schema.Union([FileTab, Schema.Struct({ path: short, shown: Schema.Literal("file") })]), { url: webAddress, path: workspaceFile, focus }, diff --git a/packages/plugin-browser/src/skill.ts b/packages/plugin-browser/src/skill.ts index 445bd149c5a..7e5023d745f 100644 --- a/packages/plugin-browser/src/skill.ts +++ b/packages/plugin-browser/src/skill.ts @@ -41,7 +41,7 @@ export const info = Skill.Info.make({ "- `tools.browser.tabs.open({ path })` shows a workspace file to the user. An HTML file opens in a browser tab, even off screen: pass the returned `id` straight to `snapshot`. Opening the same file again reloads its tab, and `navigate({ tabID, path })` moves a tab you already have to another HTML file. Other files open in the file panel, queued until the user returns to this session, and return `{ path, shown: \"file\" }` with no tab.", "- Put HTML assets in the document's folder or below it; parent folders, hidden paths and secret filenames are not available to the page.", "- `tabs.open` and `navigate` take a web address in `url` or a workspace file in `path`, never both. The `file:` or `workspace:` address that `tabs.list` shows for a file's tab names that file too. The page's isolated `oc-preview:` origin opens nothing. You can also click a relative link in the page.", - "- New tabs open in front by default so the user can watch. Pass `focus: false` only when the user asked you to work in the background.", + "- A web page you open with `tabs.open({ url })` does not show itself. Pass `focus: true` only when the user asked to see or be shown the page: it opens the browser if it is closed, and never switches the tab the user is on.", "- `screenshot` works on a hidden tab, including `fullPage: true`. On macOS restore the OpenCode window if it is minimized or hidden. The result includes the image and a server-local file path.", "", "## Recipes",