@different-ai/opencode-browser 4.2.6 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,11 +17,12 @@ metadata:
17
17
  ## Best-practice workflow
18
18
 
19
19
  1. Inspect tabs with `browser_get_tabs`
20
- 2. Navigate with `browser_navigate` if needed
21
- 3. Wait for UI using `browser_query` with `timeoutMs`
22
- 4. Discover candidates using `browser_query` with `mode=list`
23
- 5. Click or type using `index`
24
- 6. Confirm using `browser_query` or `browser_snapshot`
20
+ 2. Open new tabs with `browser_open_tab` when needed
21
+ 3. Navigate with `browser_navigate` if needed
22
+ 4. Wait for UI using `browser_query` with `timeoutMs`
23
+ 5. Discover candidates using `browser_query` with `mode=list`
24
+ 6. Click or type using `index`
25
+ 7. Confirm using `browser_query` or `browser_snapshot`
25
26
 
26
27
  ## Query modes
27
28
 
@@ -31,6 +32,11 @@ metadata:
31
32
  - `exists`: check presence and count
32
33
  - `page_text`: extract visible page text
33
34
 
35
+ ## Opening tabs
36
+
37
+ - Use `browser_open_tab` to create a new tab, optionally with `url` and `active`
38
+ - Example: `browser_open_tab({ url: "https://example.com", active: false })`
39
+
34
40
  ## Troubleshooting
35
41
 
36
42
  - If a selector fails, run `browser_query` with `mode=page_text` to confirm the content exists
package/README.md CHANGED
@@ -57,6 +57,7 @@ OpenCode Plugin <-> Local Broker (unix socket) <-> Native Host <-> Chrome Extens
57
57
  Core primitives:
58
58
  - `browser_status`
59
59
  - `browser_get_tabs`
60
+ - `browser_open_tab`
60
61
  - `browser_navigate`
61
62
  - `browser_query` (modes: `text`, `value`, `list`, `exists`, `page_text`; optional `timeoutMs`/`pollMs`)
62
63
  - `browser_click`
package/dist/plugin.js CHANGED
@@ -12514,6 +12514,17 @@ var plugin = async (ctx) => {
12514
12514
  return toolResultText(data, "ok");
12515
12515
  }
12516
12516
  }),
12517
+ browser_open_tab: tool({
12518
+ description: "Open a new browser tab",
12519
+ args: {
12520
+ url: schema.string().optional(),
12521
+ active: schema.boolean().optional()
12522
+ },
12523
+ async execute({ url: url2, active }, ctx2) {
12524
+ const data = await brokerRequest("tool", { tool: "open_tab", args: { url: url2, active } });
12525
+ return toolResultText(data, "Opened new tab");
12526
+ }
12527
+ }),
12517
12528
  browser_navigate: tool({
12518
12529
  description: "Navigate to a URL in the browser",
12519
12530
  args: {
@@ -100,6 +100,7 @@ async function executeTool(toolName, args) {
100
100
  const tools = {
101
101
  get_active_tab: toolGetActiveTab,
102
102
  get_tabs: toolGetTabs,
103
+ open_tab: toolOpenTab,
103
104
  navigate: toolNavigate,
104
105
  click: toolClick,
105
106
  type: toolType,
@@ -487,6 +488,15 @@ async function toolGetActiveTab() {
487
488
  return { tabId: tab.id, content: { tabId: tab.id, url: tab.url, title: tab.title } }
488
489
  }
489
490
 
491
+ async function toolOpenTab({ url, active = true }) {
492
+ const createOptions = {}
493
+ if (typeof url === "string" && url.trim()) createOptions.url = url.trim()
494
+ if (typeof active === "boolean") createOptions.active = active
495
+
496
+ const tab = await chrome.tabs.create(createOptions)
497
+ return { tabId: tab.id, content: { tabId: tab.id, url: tab.url, active: tab.active } }
498
+ }
499
+
490
500
  async function toolNavigate({ url, tabId }) {
491
501
  if (!url) throw new Error("URL is required")
492
502
  const tab = await getTabById(tabId)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "OpenCode Browser Automation",
4
- "version": "4.2.6",
4
+ "version": "4.3.0",
5
5
  "description": "Browser automation for OpenCode",
6
6
  "permissions": [
7
7
  "tabs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@different-ai/opencode-browser",
3
- "version": "4.2.6",
3
+ "version": "4.3.0",
4
4
  "description": "Browser automation plugin for OpenCode (native messaging + per-tab ownership).",
5
5
  "type": "module",
6
6
  "bin": {