@different-ai/opencode-browser 4.5.1 → 4.6.1
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.
- package/.opencode/skill/browser-automation/SKILL.md +14 -1
- package/README.md +53 -2
- package/bin/broker.cjs +18 -2
- package/bin/cli.js +395 -52
- package/bin/native-host.cjs +17 -1
- package/dist/plugin.js +374 -103
- package/extension/background.js +627 -20
- package/extension/manifest.json +4 -2
- package/package.json +15 -9
- package/.opencode/skill/github-release/SKILL.md +0 -12
|
@@ -13,6 +13,7 @@ metadata:
|
|
|
13
13
|
- Provide a safe, composable workflow for browsing tasks
|
|
14
14
|
- Use `browser_query` list and index selection to click reliably
|
|
15
15
|
- Confirm state changes after each action
|
|
16
|
+
- Support CLI-first debugging with `opencode-browser tool` commands
|
|
16
17
|
|
|
17
18
|
## Best-practice workflow
|
|
18
19
|
|
|
@@ -24,6 +25,16 @@ metadata:
|
|
|
24
25
|
6. Click, type, or select using `index`
|
|
25
26
|
7. Confirm using `browser_query` or `browser_snapshot`
|
|
26
27
|
|
|
28
|
+
## CLI-first debugging
|
|
29
|
+
|
|
30
|
+
- List all available tools: `npx @different-ai/opencode-browser tools`
|
|
31
|
+
- Run one tool directly: `npx @different-ai/opencode-browser tool browser_status`
|
|
32
|
+
- Pass JSON args: `npx @different-ai/opencode-browser tool browser_query --args '{"mode":"page_text"}'`
|
|
33
|
+
- Run smoke test: `npx @different-ai/opencode-browser self-test`
|
|
34
|
+
- After `update`, reload the unpacked extension in `chrome://extensions`
|
|
35
|
+
|
|
36
|
+
This path is useful for reproducing selector/scroll issues quickly before running a full OpenCode session.
|
|
37
|
+
|
|
27
38
|
## Selecting options
|
|
28
39
|
|
|
29
40
|
- Use `browser_select` for native `<select>` elements
|
|
@@ -46,5 +57,7 @@ metadata:
|
|
|
46
57
|
## Troubleshooting
|
|
47
58
|
|
|
48
59
|
- If a selector fails, run `browser_query` with `mode=page_text` to confirm the content exists
|
|
49
|
-
- Use `mode=list` on broad selectors (`button`, `a`, `*[role="button"]`) and choose by index
|
|
60
|
+
- Use `mode=list` on broad selectors (`button`, `a`, `*[role="button"]`, `*[role="listitem"]`) and choose by index
|
|
61
|
+
- For inbox/chat panes, try text selectors first (`text:Subject line`) then verify selection with `browser_query`
|
|
62
|
+
- For scrollable containers, pass both `selector` and `x`/`y` to `browser_scroll` and then verify `scrollTop`
|
|
50
63
|
- Confirm results after each action
|
package/README.md
CHANGED
|
@@ -24,6 +24,8 @@ This version is optimized for reliability and predictable multi-session behavior
|
|
|
24
24
|
bunx @different-ai/opencode-browser@latest install
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
Supports macOS, Linux, and Windows (Chrome/Edge/Brave/Chromium).
|
|
28
|
+
|
|
27
29
|
|
|
28
30
|
https://github.com/user-attachments/assets/d5767362-fbf3-4023-858b-90f06d9f0b25
|
|
29
31
|
|
|
@@ -58,6 +60,44 @@ Your `opencode.json` or `opencode.jsonc` should contain:
|
|
|
58
60
|
bunx @different-ai/opencode-browser@latest update
|
|
59
61
|
```
|
|
60
62
|
|
|
63
|
+
## CLI tool runner (for local debugging)
|
|
64
|
+
|
|
65
|
+
Run plugin tools directly from the package CLI (without starting an OpenCode session):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# list available browser_* tools
|
|
69
|
+
npx @different-ai/opencode-browser tools
|
|
70
|
+
|
|
71
|
+
# run a single tool
|
|
72
|
+
npx @different-ai/opencode-browser tool browser_status
|
|
73
|
+
npx @different-ai/opencode-browser tool browser_query --args '{"mode":"page_text"}'
|
|
74
|
+
|
|
75
|
+
# run built-in end-to-end smoke test (click + text selector + container scroll)
|
|
76
|
+
npx @different-ai/opencode-browser self-test
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
This is useful for debugging issue reports (for example inbox/chat UIs) before involving a full OpenCode workflow.
|
|
80
|
+
After `update`, reload the unpacked extension in `chrome://extensions` before running `self-test`.
|
|
81
|
+
|
|
82
|
+
## Chrome Web Store maintainer flow
|
|
83
|
+
|
|
84
|
+
Build a store-ready extension package:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
bun run build:cws
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Outputs:
|
|
91
|
+
|
|
92
|
+
- `artifacts/chrome-web-store/opencode-browser-cws-v<version>.zip`
|
|
93
|
+
- `artifacts/chrome-web-store/manifest.chrome-web-store.json`
|
|
94
|
+
|
|
95
|
+
Submission checklist and guidance:
|
|
96
|
+
|
|
97
|
+
- `CHROME_WEB_STORE.md`
|
|
98
|
+
- `CHROME_WEB_STORE_REQUEST_TEMPLATE.md`
|
|
99
|
+
- `PRIVACY.md`
|
|
100
|
+
|
|
61
101
|
## How it works
|
|
62
102
|
|
|
63
103
|
```
|
|
@@ -135,6 +175,13 @@ Core primitives:
|
|
|
135
175
|
- `browser_scroll` (optional `timeoutMs`/`pollMs`)
|
|
136
176
|
- `browser_wait`
|
|
137
177
|
|
|
178
|
+
Downloads:
|
|
179
|
+
- `browser_download`
|
|
180
|
+
- `browser_list_downloads`
|
|
181
|
+
|
|
182
|
+
Uploads:
|
|
183
|
+
- `browser_set_file_input` (extension backend supports small files; use agent backend for larger uploads)
|
|
184
|
+
|
|
138
185
|
Selector helpers (usable in `selector`):
|
|
139
186
|
- `label:Mailing Address: City`
|
|
140
187
|
- `aria:Principal Address: City`
|
|
@@ -153,8 +200,8 @@ Diagnostics:
|
|
|
153
200
|
- [ ] Add tab management tools (`browser_set_active_tab`)
|
|
154
201
|
- [ ] Add navigation helpers (`browser_back`, `browser_forward`, `browser_reload`)
|
|
155
202
|
- [ ] Add keyboard input tool (`browser_key`)
|
|
156
|
-
- [
|
|
157
|
-
- [
|
|
203
|
+
- [x] Add download support (`browser_download`, `browser_list_downloads`)
|
|
204
|
+
- [x] Add upload support (`browser_set_file_input`)
|
|
158
205
|
|
|
159
206
|
## Troubleshooting
|
|
160
207
|
|
|
@@ -174,3 +221,7 @@ npx @different-ai/opencode-browser uninstall
|
|
|
174
221
|
```
|
|
175
222
|
|
|
176
223
|
Then remove the unpacked extension in `chrome://extensions` and remove the plugin from `opencode.json` or `opencode.jsonc`.
|
|
224
|
+
|
|
225
|
+
## Privacy
|
|
226
|
+
|
|
227
|
+
- Privacy policy: `PRIVACY.md`
|
package/bin/broker.cjs
CHANGED
|
@@ -7,7 +7,23 @@ const os = require("os");
|
|
|
7
7
|
const path = require("path");
|
|
8
8
|
|
|
9
9
|
const BASE_DIR = path.join(os.homedir(), ".opencode-browser");
|
|
10
|
-
const SOCKET_PATH =
|
|
10
|
+
const SOCKET_PATH = getBrokerSocketPath();
|
|
11
|
+
|
|
12
|
+
function getSafePipeName() {
|
|
13
|
+
try {
|
|
14
|
+
const username = os.userInfo().username || "user";
|
|
15
|
+
return `opencode-browser-${username}`.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
16
|
+
} catch {
|
|
17
|
+
return "opencode-browser";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getBrokerSocketPath() {
|
|
22
|
+
const override = process.env.OPENCODE_BROWSER_BROKER_SOCKET;
|
|
23
|
+
if (override) return override;
|
|
24
|
+
if (process.platform === "win32") return `\\\\.\\pipe\\${getSafePipeName()}`;
|
|
25
|
+
return path.join(BASE_DIR, "broker.sock");
|
|
26
|
+
}
|
|
11
27
|
|
|
12
28
|
fs.mkdirSync(BASE_DIR, { recursive: true });
|
|
13
29
|
|
|
@@ -53,7 +69,7 @@ function writeJsonLine(socket, msg) {
|
|
|
53
69
|
}
|
|
54
70
|
|
|
55
71
|
function wantsTab(toolName) {
|
|
56
|
-
return !["get_tabs", "get_active_tab", "open_tab"].includes(toolName);
|
|
72
|
+
return !["get_tabs", "get_active_tab", "open_tab", "list_downloads"].includes(toolName);
|
|
57
73
|
}
|
|
58
74
|
|
|
59
75
|
// --- State ---
|