@opencode/browse 0.0.15-dev.97 → 0.0.15
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/dist/{Undici-88kyhfpm.mjs → Undici-mxpvn7gy.mjs} +1 -1
- package/dist/{cli-t7r3wnv8.mjs → cli-xke2d25m.mjs} +139 -135
- package/dist/cli.mjs +17 -16
- package/dist/{helpers-j683tr91.mjs → helpers-tsvynww5.mjs} +4 -2
- package/dist/{index-yzz55kxm.mjs → index-6gkr235e.mjs} +1 -1
- package/dist/{main-8fkq5dgw.mjs → main-3esbykhb.mjs} +4 -4
- package/dist/{main-r62eef6t.mjs → main-70y5racc.mjs} +2 -2
- package/dist/main-7y3pj4rc.mjs +1694 -0
- package/dist/{main-7n3prtjk.mjs → main-9kxgkcse.mjs} +2 -2
- package/dist/main-9t2s5ptx.mjs +5405 -0
- package/dist/{main-vgzr4689.mjs → main-azpzpy0x.mjs} +1 -1
- package/dist/main-ckssvk4c.mjs +18 -0
- package/dist/{main-d0vkm24t.mjs → main-crssg4wd.mjs} +25 -11
- package/dist/{main-b3w2ntyc.mjs → main-d79nrcqc.mjs} +67 -58
- package/dist/{main-8z9d979q.mjs → main-er120rjm.mjs} +2 -2
- package/dist/{main-yf9xhpn4.mjs → main-ken6azcs.mjs} +2 -2
- package/dist/main-m05te79v.mjs +1255 -0
- package/dist/{main-fed0em2f.mjs → main-rycc0g05.mjs} +3 -3
- package/dist/{main-azv7pxzm.mjs → main-sfb6r1ye.mjs} +2 -2
- package/dist/{main-y22dyw2e.mjs → main-w9h0wtxs.mjs} +57 -10
- package/dist/main-xkbs0qyx.mjs +4 -0
- package/dist/{main-csnx585b.mjs → main-yf5j8g79.mjs} +2800 -8017
- package/dist/{mcp-fvd77dd5.mjs → mcp-qzkz0rbx.mjs} +418 -414
- package/dist/{migrate-mbbpx6fe.mjs → migrate-bcea81cv.mjs} +11 -14
- package/dist/{relay-gm2rz6ag.mjs → relay-pc2ke2t2.mjs} +1489 -473
- package/dist/{runtime-update-yr9prapz.mjs → runtime-update-jaxftsqk.mjs} +7 -6
- package/dist/{setup-wq76tmbx.mjs → setup-cpr4psvg.mjs} +30 -20
- package/dist/{skill-text-x30agn5m.mjs → skill-text-v0etv8b7.mjs} +26 -8
- package/dist/{supervisor-e5k91ga8.mjs → supervisor-recc7rne.mjs} +5 -5
- package/dist/{update-mk60neam.mjs → update-0vgwjjha.mjs} +3 -3
- package/dist/{version-hwm41j2w.mjs → version-67w7t6ce.mjs} +1 -1
- package/package.json +1 -1
- package/skills/browse/SKILL.md +26 -8
- package/dist/main-afz4wktv.mjs +0 -4
- package/dist/main-e0wy6qvy.mjs +0 -2924
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./main-
|
|
1
|
+
import"./main-xkbs0qyx.mjs";
|
|
2
2
|
import {
|
|
3
3
|
cliCommand,
|
|
4
4
|
installCommand,
|
|
@@ -15,15 +15,17 @@ import {
|
|
|
15
15
|
registryUrl,
|
|
16
16
|
fetchPublished,
|
|
17
17
|
runInstaller
|
|
18
|
-
} from "./main-
|
|
18
|
+
} from "./main-w9h0wtxs.mjs";
|
|
19
19
|
import"./main-mrew6jy8.mjs";
|
|
20
20
|
import {
|
|
21
21
|
Service,
|
|
22
22
|
layerFetch,
|
|
23
23
|
restartRelay,
|
|
24
24
|
startManagedRelay
|
|
25
|
-
} from "./main-
|
|
26
|
-
import"./main-
|
|
25
|
+
} from "./main-d79nrcqc.mjs";
|
|
26
|
+
import"./main-azpzpy0x.mjs";
|
|
27
|
+
import"./main-9t2s5ptx.mjs";
|
|
28
|
+
import"./main-70y5racc.mjs";
|
|
27
29
|
import {
|
|
28
30
|
succeed6,
|
|
29
31
|
gen,
|
|
@@ -31,8 +33,7 @@ import {
|
|
|
31
33
|
catch_,
|
|
32
34
|
provide3,
|
|
33
35
|
runPromise
|
|
34
|
-
} from "./main-
|
|
35
|
-
import"./main-r62eef6t.mjs";
|
|
36
|
+
} from "./main-yf5j8g79.mjs";
|
|
36
37
|
|
|
37
38
|
// src/update/runtime-update.ts
|
|
38
39
|
var log = (line) => process.stdout.write(line + `
|
|
@@ -63,10 +63,10 @@ import {
|
|
|
63
63
|
installRuntime,
|
|
64
64
|
installedRuntime,
|
|
65
65
|
manualMcpEntry
|
|
66
|
-
} from "./main-
|
|
66
|
+
} from "./main-crssg4wd.mjs";
|
|
67
67
|
import {
|
|
68
68
|
opencodeBrowserBuildId2
|
|
69
|
-
} from "./main-
|
|
69
|
+
} from "./main-xkbs0qyx.mjs";
|
|
70
70
|
import {
|
|
71
71
|
installedBinaryPath,
|
|
72
72
|
installerBinaryPath,
|
|
@@ -75,6 +75,7 @@ import {
|
|
|
75
75
|
compiledBinary,
|
|
76
76
|
scriptEntry,
|
|
77
77
|
entryCommand,
|
|
78
|
+
entrySpawnCommand,
|
|
78
79
|
runningEntry,
|
|
79
80
|
cliCommand,
|
|
80
81
|
devExtensionFolder,
|
|
@@ -82,8 +83,8 @@ import {
|
|
|
82
83
|
autoUpdateStatus,
|
|
83
84
|
describeAutoUpdate,
|
|
84
85
|
runCommand
|
|
85
|
-
} from "./main-
|
|
86
|
-
import"./main-
|
|
86
|
+
} from "./main-w9h0wtxs.mjs";
|
|
87
|
+
import"./main-azpzpy0x.mjs";
|
|
87
88
|
import {
|
|
88
89
|
pairingCodeTtlMs,
|
|
89
90
|
bundledPairingCodeTtlMs,
|
|
@@ -96,21 +97,24 @@ import {
|
|
|
96
97
|
revokeBrowserToken,
|
|
97
98
|
legacyPairingCode,
|
|
98
99
|
removeLegacyPairingCode
|
|
99
|
-
} from "./main-
|
|
100
|
+
} from "./main-9kxgkcse.mjs";
|
|
100
101
|
import {
|
|
101
102
|
unpackedExtensionId,
|
|
102
103
|
extensionProtocolSkew,
|
|
103
104
|
extensionProtocolAdvice
|
|
104
105
|
} from "./main-mrew6jy8.mjs";
|
|
106
|
+
import {
|
|
107
|
+
defaultSiteSecretsDir
|
|
108
|
+
} from "./main-m05te79v.mjs";
|
|
105
109
|
import {
|
|
106
110
|
parseHostname,
|
|
107
111
|
readRelayConfig,
|
|
108
112
|
writeRelayConfig,
|
|
109
113
|
syncDevExtension
|
|
110
|
-
} from "./main-
|
|
114
|
+
} from "./main-rycc0g05.mjs";
|
|
111
115
|
import {
|
|
112
116
|
relayAuthorization
|
|
113
|
-
} from "./main-
|
|
117
|
+
} from "./main-70y5racc.mjs";
|
|
114
118
|
|
|
115
119
|
// src/setup.ts
|
|
116
120
|
import { mkdirSync as mkdirSync2, rmSync as rmSync2, writeFileSync } from "node:fs";
|
|
@@ -306,7 +310,7 @@ var relayHeaders = () => {
|
|
|
306
310
|
}
|
|
307
311
|
};
|
|
308
312
|
function ensureRelay(entry) {
|
|
309
|
-
const [file, ...prefix] =
|
|
313
|
+
const [file, ...prefix] = entrySpawnCommand(entry);
|
|
310
314
|
const started = spawnSync(file, [...prefix, "session", "list", "--json"], {
|
|
311
315
|
encoding: "utf8",
|
|
312
316
|
timeout: 30000
|
|
@@ -486,7 +490,7 @@ async function set(args) {
|
|
|
486
490
|
log(`✓ hostname is ${hostname}`);
|
|
487
491
|
const running = await fetch(`${relayBase()}/version`, { signal: AbortSignal.timeout(2000) }).then((response) => response.ok, () => false);
|
|
488
492
|
if (running) {
|
|
489
|
-
const [file, ...prefix] =
|
|
493
|
+
const [file, ...prefix] = entrySpawnCommand(runningEntry());
|
|
490
494
|
const restarted = spawnSync(file, [...prefix, "relay", "restart"], { stdio: "inherit" });
|
|
491
495
|
if (restarted.status !== 0)
|
|
492
496
|
log(`! The relay is still running with the old hostname. Run \`${cliCommand("relay restart --force")}\` to apply it.`);
|
|
@@ -496,17 +500,23 @@ async function set(args) {
|
|
|
496
500
|
const tailscale = Object.values(networkInterfaces()).flat().find((address) => address?.family === "IPv4" && /^100\.(6[4-9]|[7-9]\d|1[01]\d|12[0-7])\./.test(address.address))?.address;
|
|
497
501
|
log("");
|
|
498
502
|
log("In the browser on the other computer, open browse's options (right-click its toolbar button, then Options),");
|
|
499
|
-
log("and under
|
|
503
|
+
log("and under advanced enter:");
|
|
500
504
|
log(` Relay ${tailscale ?? "this computer's address"}`);
|
|
501
505
|
log(` Pairing code ${formatPairingCode(mintPairingCode())} (works once, within ${pairingCodeTtlMs / 60000} minutes; \`${cliCommand("pair")}\` prints another)`);
|
|
502
506
|
log("The connection isn't encrypted by browse: use it over Tailscale or a LAN you trust, not the open internet.");
|
|
503
507
|
}
|
|
504
508
|
async function confirmSecretRemoval(args) {
|
|
505
509
|
const secrets = path.join(files.dir, "secrets");
|
|
506
|
-
const
|
|
507
|
-
|
|
510
|
+
const siteSecrets = defaultSiteSecretsDir();
|
|
511
|
+
const count = (directory) => existsSync(directory) ? readdirSync(directory).filter((name) => name.endsWith(".json")).length : 0;
|
|
512
|
+
const profiles = count(secrets);
|
|
513
|
+
const sites = count(siteSecrets);
|
|
514
|
+
if (profiles === 0 && sites === 0 || args.includes("--yes") || args.includes("-y"))
|
|
508
515
|
return;
|
|
509
|
-
const notice = `Uninstalling deletes ${
|
|
516
|
+
const notice = `Uninstalling deletes ${[
|
|
517
|
+
...profiles > 0 ? [`${profiles} stored secret profile${profiles === 1 ? "" : "s"} in ${secrets}`] : [],
|
|
518
|
+
...sites > 0 ? [`${sites} site secret${sites === 1 ? "" : "s"} in ${siteSecrets}`] : []
|
|
519
|
+
].join(" and ")}.`;
|
|
510
520
|
if (!process.stdin.isTTY)
|
|
511
521
|
fail(`${notice} Re-run with --yes to confirm.`);
|
|
512
522
|
const prompt = createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -660,7 +670,7 @@ async function installRemote(entry, tty) {
|
|
|
660
670
|
if (config.hostname !== "0.0.0.0") {
|
|
661
671
|
writeRelayConfig({ ...config, hostname: "0.0.0.0" });
|
|
662
672
|
const running = await fetch(`${relayBase()}/version`, { signal: AbortSignal.timeout(2000) }).then((response) => response.ok, () => false);
|
|
663
|
-
const [file, ...prefix] =
|
|
673
|
+
const [file, ...prefix] = entrySpawnCommand(entry);
|
|
664
674
|
const restarted = running && spawnSync2(file, [...prefix, "relay", "restart"], { encoding: "utf8", timeout: 60000 }).status === 0;
|
|
665
675
|
if (running && !restarted) {
|
|
666
676
|
process.exitCode = 1;
|
|
@@ -745,7 +755,7 @@ async function installSteps(args, tty, caller) {
|
|
|
745
755
|
const plan = agentPlan(locations, flags, tty, caller, remembered);
|
|
746
756
|
mkdirSync2(path2.dirname(files.settings), { recursive: true, mode: 448 });
|
|
747
757
|
mkdirSync2(files.dir, { recursive: true, mode: 448 });
|
|
748
|
-
const { entry, version } = await installRuntime();
|
|
758
|
+
const { entry, version, spawnEntry } = await installRuntime();
|
|
749
759
|
log(`✓ browse ${version} installed${fromSource ? " (from source)" : ""}`);
|
|
750
760
|
const onPath = args.includes("--no-modify-path") ? undefined : path2.isAbsolute(entry) && !scriptEntry(entry) ? addToPath(path2.dirname(entry)) : undefined;
|
|
751
761
|
if (onPath)
|
|
@@ -822,15 +832,15 @@ async function installSteps(args, tty, caller) {
|
|
|
822
832
|
log(`! Couldn't edit ${tilde(agent.file)} for ${label}. Check its syntax and permissions, then run ${cliCommand(`install --agent ${agent.name}`)}.`);
|
|
823
833
|
}
|
|
824
834
|
}
|
|
825
|
-
for (const line of restartOutdatedRelay(
|
|
835
|
+
for (const line of restartOutdatedRelay(spawnEntry) ?? [])
|
|
826
836
|
log(line);
|
|
827
837
|
const legacy = selected.includes("opencode") ? legacyBrowserControl() : [];
|
|
828
838
|
if (legacy.length)
|
|
829
839
|
log(`! Also configured: ${legacy.map((name) => `"${name}"`).join(", ")}, ${legacy.length === 1 ? "an older browser MCP server" : "older browser MCP servers"} that browse replaces. Remove ${legacy.length === 1 ? "it" : "them"} from ${configFile()} to avoid two sets of browser tools.`);
|
|
830
840
|
if (args.includes("--remote"))
|
|
831
|
-
return installRemote(
|
|
841
|
+
return installRemote(spawnEntry, tty);
|
|
832
842
|
await syncDev();
|
|
833
|
-
const initial = await settledExtensionStatus(
|
|
843
|
+
const initial = await settledExtensionStatus(spawnEntry);
|
|
834
844
|
const connected = initial?.connected ? initial : undefined;
|
|
835
845
|
const pairedOffline = initial?.pairingState === "paired-offline";
|
|
836
846
|
const needsPairing = initial?.pairingState === "unpaired" || initial?.pairingState === "refused";
|
|
@@ -859,7 +869,7 @@ async function installSteps(args, tty, caller) {
|
|
|
859
869
|
return true;
|
|
860
870
|
writeFileSync(oldStoreMarker(), `2
|
|
861
871
|
`);
|
|
862
|
-
ensureRelay(
|
|
872
|
+
ensureRelay(spawnEntry);
|
|
863
873
|
log(`! Found browse ${matches[0].version} in ${matches[0].browser.name}. ${extensionProtocolAdvice(2, { install: cliCommand("install") }, "store")}`);
|
|
864
874
|
process.exitCode = 1;
|
|
865
875
|
return false;
|
|
@@ -883,7 +893,7 @@ async function installSteps(args, tty, caller) {
|
|
|
883
893
|
});
|
|
884
894
|
if (connected || found === "off" || pairedOffline)
|
|
885
895
|
return;
|
|
886
|
-
ensureRelay(
|
|
896
|
+
ensureRelay(spawnEntry);
|
|
887
897
|
let code;
|
|
888
898
|
const pairingCode = () => code && pendingPairingCodeKeys().includes(pairingCodeKey(code)) ? code : code = mintPairingCode();
|
|
889
899
|
const pairStore = (scanned) => pairStoreExtension({
|
|
@@ -215,6 +215,12 @@ values between calls on \`state\`. A single run without an \`await\` is stopped
|
|
|
215
215
|
about 2 seconds; split heavy loops with
|
|
216
216
|
\`await new Promise(r => setTimeout(r, 0))\` or do the work in the page.
|
|
217
217
|
|
|
218
|
+
Await promises: a rejection with no handler never stops the relay. A running call
|
|
219
|
+
gets the error; a later one resets the realm and warns on the next call (a
|
|
220
|
+
one-shot \`--rm\` session is already gone). Full Node mode has no realm to reset.
|
|
221
|
+
\`await files.write(...)\` and \`await page.goto(...)\` put the error in the call
|
|
222
|
+
that caused it.
|
|
223
|
+
|
|
218
224
|
It runs in a restricted JavaScript realm, not a sandbox. It shares the relay's
|
|
219
225
|
process, so it is not a security boundary: treat code as running as you. There
|
|
220
226
|
is no \`process\`, \`require\`, \`import()\`, \`eval\`, \`fs\`, \`os\`,
|
|
@@ -222,7 +228,8 @@ is no \`process\`, \`require\`, \`import()\`, \`eval\`, \`fs\`, \`os\`,
|
|
|
222
228
|
\`page.request\`, \`context.request\` and \`browser.browserType()\` are unavailable.
|
|
223
229
|
Files go through \`files\` and Playwright file options, which accept absolute paths
|
|
224
230
|
inside the execute file roots (the temp directory, \`/tmp\`, and directories in
|
|
225
|
-
\`OPENCODE_BROWSER_FILE_ROOTS\`)
|
|
231
|
+
\`OPENCODE_BROWSER_FILE_ROOTS\`); raw CDP commands that name local files are
|
|
232
|
+
checked the same way:
|
|
226
233
|
|
|
227
234
|
\`\`\`js
|
|
228
235
|
const saved = await files.write("report.csv", csvText)
|
|
@@ -230,6 +237,11 @@ const bytes = await files.read(saved) // Buffer; files.read(p, "utf8") for text
|
|
|
230
237
|
await page.screenshot({ path: files.path("page.png") })
|
|
231
238
|
\`\`\`
|
|
232
239
|
|
|
240
|
+
Setting \`Browser.setDownloadBehavior\` (or \`Page.setDownloadBehavior\`) replaces
|
|
241
|
+
Playwright's own download handling, so keep its folder inside the file roots.
|
|
242
|
+
After that, \`page.on("download")\` and \`download.saveAs()\` stop working for the
|
|
243
|
+
context.
|
|
244
|
+
|
|
233
245
|
Use \`page.evaluate\` for \`window\`, \`document\`, storage and same-origin \`fetch\`
|
|
234
246
|
with page cookies. It runs in an isolated world whose \`fetch\` skips the page's
|
|
235
247
|
service worker; pass \`false\` as its fourth argument
|
|
@@ -339,15 +351,19 @@ viewport, state and interaction path actually tested.
|
|
|
339
351
|
## Tabs and settings
|
|
340
352
|
|
|
341
353
|
Tabs agents open close by themselves after about 10 minutes without use (the
|
|
342
|
-
user can choose 30 or 60 minutes, or never). When a task is done,
|
|
343
|
-
|
|
354
|
+
user can choose 30 or 60 minutes, or never). When a task is done, reset or
|
|
355
|
+
delete your own session:
|
|
344
356
|
|
|
345
357
|
\`\`\`bash
|
|
346
|
-
browse
|
|
358
|
+
browse session reset <name> # MCP: session_reset
|
|
359
|
+
browse session delete <name> # MCP: session_delete
|
|
347
360
|
\`\`\`
|
|
348
361
|
|
|
349
|
-
|
|
350
|
-
|
|
362
|
+
\`browse tabs cleanup\` closes idle agent tabs from every session sharing the
|
|
363
|
+
browser, not just yours, and \`--idle-minutes 0\` (\`tabs_cleanup\` with
|
|
364
|
+
\`idleMinutes: 0\`) would close other sessions' pages between their calls, so
|
|
365
|
+
only run it when the user asks. Keep a session only when you will continue with
|
|
366
|
+
it.
|
|
351
367
|
|
|
352
368
|
Use the \`settings\` tool (CLI: \`browse settings get\` / \`settings set key=value …\`)
|
|
353
369
|
only when the user asks to change how browse behaves: where tabs open (\`window\`),
|
|
@@ -388,8 +404,10 @@ Common diagnoses:
|
|
|
388
404
|
page. Running setup again does not reload older workers.
|
|
389
405
|
- \`Target not found\`: attach the intended tab, then select or adopt it by a
|
|
390
406
|
unique URL substring or explicit index.
|
|
391
|
-
-
|
|
392
|
-
tab
|
|
407
|
+
- Dismissing Chromium's debugging bar (Cancel in Chrome, OK in some browsers)
|
|
408
|
+
detaches every tab: browse no longer controls them. Tabs an agent opened stay
|
|
409
|
+
open and close when idle; ask the user to lend the tab again with the toolbar
|
|
410
|
+
button, or continue in a new tab. \`execute\` says when this happened.
|
|
393
411
|
- Repeated execution-context errors: run one short follow-up so browse can
|
|
394
412
|
health-check the page. A live page is reconnected and re-resolved once; a
|
|
395
413
|
crashed or \`chrome-error://\` relay-owned page is recreated. It never replaces
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import"./main-
|
|
1
|
+
import"./main-xkbs0qyx.mjs";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
entrySpawnCommand,
|
|
4
4
|
installedRuntime2,
|
|
5
5
|
installedVersion
|
|
6
|
-
} from "./main-
|
|
6
|
+
} from "./main-w9h0wtxs.mjs";
|
|
7
7
|
|
|
8
8
|
// src/mcp/supervisor.ts
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
@@ -33,7 +33,7 @@ async function runBinaryMcp(args) {
|
|
|
33
33
|
const runtime = installedRuntime2();
|
|
34
34
|
if (!runtime || runtime.kind === "npx") {
|
|
35
35
|
process.env[directEnvironmentVariable] = "1";
|
|
36
|
-
const { runCli } = await import("./cli-
|
|
36
|
+
const { runCli } = await import("./cli-xke2d25m.mjs");
|
|
37
37
|
return runCli();
|
|
38
38
|
}
|
|
39
39
|
const REPLAY = "opencode-browser-shim-initialize";
|
|
@@ -77,7 +77,7 @@ async function runBinaryMcp(args) {
|
|
|
77
77
|
toChild(line);
|
|
78
78
|
};
|
|
79
79
|
const start = (replay) => {
|
|
80
|
-
const [file, ...prefix] =
|
|
80
|
+
const [file, ...prefix] = entrySpawnCommand(command());
|
|
81
81
|
const next = spawn(file, [...prefix, "mcp", ...args], { stdio: ["pipe", "pipe", "inherit"], env: { ...process.env, [directEnvironmentVariable]: "1" } });
|
|
82
82
|
next.stdin.on("error", () => {});
|
|
83
83
|
child = next;
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
updateNotice2,
|
|
5
5
|
createUpdateWatcher2,
|
|
6
6
|
runUpdateCommand2
|
|
7
|
-
} from "./main-
|
|
7
|
+
} from "./main-sfb6r1ye.mjs";
|
|
8
8
|
import"./main-mrew6jy8.mjs";
|
|
9
|
-
import"./main-
|
|
10
|
-
import"./main-
|
|
9
|
+
import"./main-w9h0wtxs.mjs";
|
|
10
|
+
import"./main-xkbs0qyx.mjs";
|
|
11
11
|
export {
|
|
12
12
|
createUpdateWatcher2 as createUpdateWatcher,
|
|
13
13
|
formatUpdateNotice2 as formatUpdateNotice,
|
package/package.json
CHANGED
package/skills/browse/SKILL.md
CHANGED
|
@@ -214,6 +214,12 @@ values between calls on `state`. A single run without an `await` is stopped afte
|
|
|
214
214
|
about 2 seconds; split heavy loops with
|
|
215
215
|
`await new Promise(r => setTimeout(r, 0))` or do the work in the page.
|
|
216
216
|
|
|
217
|
+
Await promises: a rejection with no handler never stops the relay. A running call
|
|
218
|
+
gets the error; a later one resets the realm and warns on the next call (a
|
|
219
|
+
one-shot `--rm` session is already gone). Full Node mode has no realm to reset.
|
|
220
|
+
`await files.write(...)` and `await page.goto(...)` put the error in the call
|
|
221
|
+
that caused it.
|
|
222
|
+
|
|
217
223
|
It runs in a restricted JavaScript realm, not a sandbox. It shares the relay's
|
|
218
224
|
process, so it is not a security boundary: treat code as running as you. There
|
|
219
225
|
is no `process`, `require`, `import()`, `eval`, `fs`, `os`,
|
|
@@ -221,7 +227,8 @@ is no `process`, `require`, `import()`, `eval`, `fs`, `os`,
|
|
|
221
227
|
`page.request`, `context.request` and `browser.browserType()` are unavailable.
|
|
222
228
|
Files go through `files` and Playwright file options, which accept absolute paths
|
|
223
229
|
inside the execute file roots (the temp directory, `/tmp`, and directories in
|
|
224
|
-
`OPENCODE_BROWSER_FILE_ROOTS`)
|
|
230
|
+
`OPENCODE_BROWSER_FILE_ROOTS`); raw CDP commands that name local files are
|
|
231
|
+
checked the same way:
|
|
225
232
|
|
|
226
233
|
```js
|
|
227
234
|
const saved = await files.write("report.csv", csvText)
|
|
@@ -229,6 +236,11 @@ const bytes = await files.read(saved) // Buffer; files.read(p, "utf8") for text
|
|
|
229
236
|
await page.screenshot({ path: files.path("page.png") })
|
|
230
237
|
```
|
|
231
238
|
|
|
239
|
+
Setting `Browser.setDownloadBehavior` (or `Page.setDownloadBehavior`) replaces
|
|
240
|
+
Playwright's own download handling, so keep its folder inside the file roots.
|
|
241
|
+
After that, `page.on("download")` and `download.saveAs()` stop working for the
|
|
242
|
+
context.
|
|
243
|
+
|
|
232
244
|
Use `page.evaluate` for `window`, `document`, storage and same-origin `fetch`
|
|
233
245
|
with page cookies. It runs in an isolated world whose `fetch` skips the page's
|
|
234
246
|
service worker; pass `false` as its fourth argument
|
|
@@ -338,15 +350,19 @@ viewport, state and interaction path actually tested.
|
|
|
338
350
|
## Tabs and settings
|
|
339
351
|
|
|
340
352
|
Tabs agents open close by themselves after about 10 minutes without use (the
|
|
341
|
-
user can choose 30 or 60 minutes, or never). When a task is done,
|
|
342
|
-
|
|
353
|
+
user can choose 30 or 60 minutes, or never). When a task is done, reset or
|
|
354
|
+
delete your own session:
|
|
343
355
|
|
|
344
356
|
```bash
|
|
345
|
-
browse
|
|
357
|
+
browse session reset <name> # MCP: session_reset
|
|
358
|
+
browse session delete <name> # MCP: session_delete
|
|
346
359
|
```
|
|
347
360
|
|
|
348
|
-
|
|
349
|
-
|
|
361
|
+
`browse tabs cleanup` closes idle agent tabs from every session sharing the
|
|
362
|
+
browser, not just yours, and `--idle-minutes 0` (`tabs_cleanup` with
|
|
363
|
+
`idleMinutes: 0`) would close other sessions' pages between their calls, so
|
|
364
|
+
only run it when the user asks. Keep a session only when you will continue with
|
|
365
|
+
it.
|
|
350
366
|
|
|
351
367
|
Use the `settings` tool (CLI: `browse settings get` / `settings set key=value …`)
|
|
352
368
|
only when the user asks to change how browse behaves: where tabs open (`window`),
|
|
@@ -387,8 +403,10 @@ Common diagnoses:
|
|
|
387
403
|
page. Running setup again does not reload older workers.
|
|
388
404
|
- `Target not found`: attach the intended tab, then select or adopt it by a
|
|
389
405
|
unique URL substring or explicit index.
|
|
390
|
-
-
|
|
391
|
-
tab
|
|
406
|
+
- Dismissing Chromium's debugging bar (Cancel in Chrome, OK in some browsers)
|
|
407
|
+
detaches every tab: browse no longer controls them. Tabs an agent opened stay
|
|
408
|
+
open and close when idle; ask the user to lend the tab again with the toolbar
|
|
409
|
+
button, or continue in a new tab. `execute` says when this happened.
|
|
392
410
|
- Repeated execution-context errors: run one short follow-up so browse can
|
|
393
411
|
health-check the page. A live page is reconnected and re-resolved once; a
|
|
394
412
|
crashed or `chrome-error://` relay-owned page is recreated. It never replaces
|
package/dist/main-afz4wktv.mjs
DELETED