@opencode/browse 0.0.15-dev.103 → 0.0.15-dev.105
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/{cli-9ddej5na.mjs → cli-aqmppryn.mjs} +9 -9
- package/dist/cli.mjs +11 -11
- package/dist/{helpers-3yrwqm8f.mjs → helpers-sg3zk4cf.mjs} +1 -1
- package/dist/{main-nc1g28wg.mjs → main-2vd35ddd.mjs} +1 -1
- package/dist/{main-wy2xpftt.mjs → main-3b80897r.mjs} +1 -1
- package/dist/main-86gs8q0t.mjs +4 -0
- package/dist/{main-s1x8tzfy.mjs → main-9pvtmhg7.mjs} +3 -3
- package/dist/{main-keabwg6j.mjs → main-mhpdnjcy.mjs} +2 -2
- package/dist/{main-gjn37m1b.mjs → main-n8m6b9y4.mjs} +44 -5
- package/dist/{main-erz36086.mjs → main-p7t3aqr3.mjs} +2 -2
- package/dist/{main-waz16y51.mjs → main-q4enpj73.mjs} +23 -9
- package/dist/{main-3pj3kvka.mjs → main-t2cqfrsz.mjs} +2 -2
- package/dist/{main-9qz3mq0q.mjs → main-tajvt727.mjs} +2 -2
- package/dist/{mcp-e7kqbc36.mjs → mcp-pz4qkbm0.mjs} +6 -6
- package/dist/{migrate-twdgvdzg.mjs → migrate-nadhygma.mjs} +4 -4
- package/dist/{relay-1ha3w7r6.mjs → relay-qw5kk0jr.mjs} +195 -21
- package/dist/{runtime-update-qrsb0dxy.mjs → runtime-update-8qb4h3kx.mjs} +4 -4
- package/dist/{setup-pg2g577m.mjs → setup-nwsadfrf.mjs} +16 -15
- package/dist/{supervisor-daa9f9yf.mjs → supervisor-gecgx8wf.mjs} +5 -5
- package/dist/{update-9bazqqqb.mjs → update-m165b2my.mjs} +3 -3
- package/dist/{version-ymp6wn5v.mjs → version-b34skvbr.mjs} +1 -1
- package/package.json +1 -1
- package/dist/main-yeb6hwye.mjs +0 -4
|
@@ -105,7 +105,7 @@ import {
|
|
|
105
105
|
import {
|
|
106
106
|
opencodeBrowserVersion2,
|
|
107
107
|
opencodeBrowserBuildId2
|
|
108
|
-
} from "./main-
|
|
108
|
+
} from "./main-86gs8q0t.mjs";
|
|
109
109
|
import {
|
|
110
110
|
configRoot2,
|
|
111
111
|
dataRoot,
|
|
@@ -118,7 +118,7 @@ import {
|
|
|
118
118
|
devExtension,
|
|
119
119
|
installCommand,
|
|
120
120
|
autoUpdateStatus
|
|
121
|
-
} from "./main-
|
|
121
|
+
} from "./main-n8m6b9y4.mjs";
|
|
122
122
|
import {
|
|
123
123
|
extensionProtocolVersion,
|
|
124
124
|
extensionProtocolAdvice
|
|
@@ -144,13 +144,13 @@ import {
|
|
|
144
144
|
ensureExtensionConnected,
|
|
145
145
|
stoppedRelayStatus,
|
|
146
146
|
statusCollections
|
|
147
|
-
} from "./main-
|
|
147
|
+
} from "./main-9pvtmhg7.mjs";
|
|
148
148
|
import"./main-vgzr4689.mjs";
|
|
149
149
|
import {
|
|
150
150
|
updateJson2,
|
|
151
151
|
formatUpdateNotice2,
|
|
152
152
|
updateNotice2
|
|
153
|
-
} from "./main-
|
|
153
|
+
} from "./main-mhpdnjcy.mjs";
|
|
154
154
|
import {
|
|
155
155
|
settingKeys,
|
|
156
156
|
formatSettings,
|
|
@@ -158,13 +158,13 @@ import {
|
|
|
158
158
|
addSecret,
|
|
159
159
|
listSecrets,
|
|
160
160
|
removeSecret
|
|
161
|
-
} from "./main-
|
|
161
|
+
} from "./main-tajvt727.mjs";
|
|
162
162
|
import {
|
|
163
163
|
defaultJournalBaseDir,
|
|
164
164
|
readJournalEntries,
|
|
165
165
|
formatJournalEntry
|
|
166
|
-
} from "./main-
|
|
167
|
-
import"./main-
|
|
166
|
+
} from "./main-t2cqfrsz.mjs";
|
|
167
|
+
import"./main-3b80897r.mjs";
|
|
168
168
|
import {
|
|
169
169
|
pipeArguments,
|
|
170
170
|
dual,
|
|
@@ -5867,7 +5867,7 @@ var status = make("status", {
|
|
|
5867
5867
|
}
|
|
5868
5868
|
})).pipe(withDescription4("Show relay, extension, and target status"));
|
|
5869
5869
|
var mcp = make("mcp", {}, fn("Cli.mcp")(function* () {
|
|
5870
|
-
const { runMcpServer } = yield* promise(() => import("./mcp-
|
|
5870
|
+
const { runMcpServer } = yield* promise(() => import("./mcp-pz4qkbm0.mjs"));
|
|
5871
5871
|
yield* runMcpServer;
|
|
5872
5872
|
})).pipe(withDescription4("Run the browse MCP server over stdio"));
|
|
5873
5873
|
registerCliCommand(400, () => tabs);
|
|
@@ -6315,7 +6315,7 @@ registerCliCommand(710, () => flightRecorder);
|
|
|
6315
6315
|
|
|
6316
6316
|
// src/cli/relay.ts
|
|
6317
6317
|
var serve = make("serve", {}, fn("Cli.serve")(function* () {
|
|
6318
|
-
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-
|
|
6318
|
+
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-qw5kk0jr.mjs"), import("./helpers-sg3zk4cf.mjs")]));
|
|
6319
6319
|
const port = yield* portConfig;
|
|
6320
6320
|
const additionalExtensionOrigins = parseAdditionalExtensionOrigins(yield* extensionOriginsConfig);
|
|
6321
6321
|
yield* scoped(gen(function* () {
|
package/dist/cli.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
// src/main.ts
|
|
7
7
|
import fs from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
|
-
var embeddedVersion = "0.0.15-dev.
|
|
9
|
+
var embeddedVersion = "0.0.15-dev.105";
|
|
10
10
|
var setupCommands = new Set(["install", "uninstall", "extension", "pair", "set"]);
|
|
11
11
|
var command = process.argv[2];
|
|
12
12
|
var args = process.argv.slice(3);
|
|
@@ -17,29 +17,29 @@ var askedForHelp = command === "--help" || command === "-h" || options.some((arg
|
|
|
17
17
|
var preCliHelp = askedForHelp && (command === "update" || command !== undefined && setupCommands.has(command));
|
|
18
18
|
if (command !== "--version" && command !== "-v" && !askedForHelp && !process.env.OPENCODE_BROWSER_HOME && legacyRoots().some((root) => fs.existsSync(root))) {
|
|
19
19
|
try {
|
|
20
|
-
const { migrateLegacy } = await import("./migrate-
|
|
20
|
+
const { migrateLegacy } = await import("./migrate-nadhygma.mjs");
|
|
21
21
|
migrateLegacy();
|
|
22
22
|
} catch {}
|
|
23
23
|
}
|
|
24
24
|
if (command === "--version" || command === "-v") {
|
|
25
|
-
const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-
|
|
25
|
+
const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-b34skvbr.mjs")).opencodeBrowserVersion;
|
|
26
26
|
process.stdout.write(`${opencodeBrowserVersion}
|
|
27
27
|
`);
|
|
28
|
-
} else if (command === "mcp" && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1" && (await import("./supervisor-
|
|
29
|
-
const { runBinaryMcp } = await import("./supervisor-
|
|
28
|
+
} else if (command === "mcp" && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1" && (await import("./supervisor-gecgx8wf.mjs")).supervisesMcp()) {
|
|
29
|
+
const { runBinaryMcp } = await import("./supervisor-gecgx8wf.mjs");
|
|
30
30
|
await runBinaryMcp(process.argv.slice(3));
|
|
31
31
|
} else if (invokedAs === "opencode-browser-mcp" || command === "mcp" && process.argv.length === 3) {
|
|
32
32
|
const { NodeRuntime } = await import("./index-yzz55kxm.mjs");
|
|
33
|
-
const { runMcpServer } = await import("./mcp-
|
|
33
|
+
const { runMcpServer } = await import("./mcp-pz4qkbm0.mjs");
|
|
34
34
|
runMcpServer.pipe(NodeRuntime.runMain);
|
|
35
35
|
} else if (command === "self-update" || command === "runtime-switch") {
|
|
36
|
-
const { runSelfUpdate, runRuntimeSwitch } = await import("./runtime-update-
|
|
36
|
+
const { runSelfUpdate, runRuntimeSwitch } = await import("./runtime-update-8qb4h3kx.mjs");
|
|
37
37
|
await (command === "self-update" ? runSelfUpdate : runRuntimeSwitch)(process.argv.slice(3));
|
|
38
38
|
} else if (command === "update" && !askedForHelp) {
|
|
39
|
-
const { runUpdateCommand } = await import("./update-
|
|
39
|
+
const { runUpdateCommand } = await import("./update-m165b2my.mjs");
|
|
40
40
|
await runUpdateCommand(process.argv.slice(3));
|
|
41
41
|
} else if (command && setupCommands.has(command) && !askedForHelp) {
|
|
42
|
-
const { runSetup } = await import("./setup-
|
|
42
|
+
const { runSetup } = await import("./setup-nwsadfrf.mjs");
|
|
43
43
|
await runSetup(command, process.argv.slice(3));
|
|
44
44
|
} else {
|
|
45
45
|
if (preCliHelp || !command || command === "--help" || command === "-h") {
|
|
@@ -76,9 +76,9 @@ executable in ~/.local/bin (or $XDG_BIN_HOME).
|
|
|
76
76
|
`);
|
|
77
77
|
}
|
|
78
78
|
if (command === "status" && !askedForHelp && !process.argv.includes("--json")) {
|
|
79
|
-
const { printSetupStatus } = await import("./setup-
|
|
79
|
+
const { printSetupStatus } = await import("./setup-nwsadfrf.mjs");
|
|
80
80
|
printSetupStatus();
|
|
81
81
|
}
|
|
82
|
-
const { runCli } = await import("./cli-
|
|
82
|
+
const { runCli } = await import("./cli-aqmppryn.mjs");
|
|
83
83
|
runCli(preCliHelp ? ["--help"] : undefined);
|
|
84
84
|
}
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
} from "./main-csnx585b.mjs";
|
|
108
108
|
import {
|
|
109
109
|
opencodeBrowserBuildId2
|
|
110
|
-
} from "./main-
|
|
110
|
+
} from "./main-86gs8q0t.mjs";
|
|
111
111
|
import {
|
|
112
112
|
compiledBinary,
|
|
113
113
|
scriptEntry,
|
|
@@ -116,10 +116,10 @@ import {
|
|
|
116
116
|
compareVersions,
|
|
117
117
|
installedRuntime2,
|
|
118
118
|
installedVersion
|
|
119
|
-
} from "./main-
|
|
119
|
+
} from "./main-n8m6b9y4.mjs";
|
|
120
120
|
import {
|
|
121
121
|
relayAuthorization
|
|
122
|
-
} from "./main-
|
|
122
|
+
} from "./main-3b80897r.mjs";
|
|
123
123
|
import {
|
|
124
124
|
dual,
|
|
125
125
|
memoize,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
installedRuntime2,
|
|
7
7
|
autoUpdateStatus,
|
|
8
8
|
updateAvailable
|
|
9
|
-
} from "./main-
|
|
9
|
+
} from "./main-n8m6b9y4.mjs";
|
|
10
10
|
import {
|
|
11
11
|
unpackedReloadAdvice
|
|
12
12
|
} from "./main-mrew6jy8.mjs";
|
|
@@ -315,7 +315,7 @@ function runUpdate(args, deps) {
|
|
|
315
315
|
async function runUpdateCommand2(args) {
|
|
316
316
|
const log = (line) => process.stdout.write(line + `
|
|
317
317
|
`);
|
|
318
|
-
const { runInstalledUpdate } = await import("./runtime-update-
|
|
318
|
+
const { runInstalledUpdate } = await import("./runtime-update-8qb4h3kx.mjs");
|
|
319
319
|
if (await runInstalledUpdate(args))
|
|
320
320
|
return;
|
|
321
321
|
if (compiledBinary()) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
opencodeBrowserVersion2
|
|
3
|
-
} from "./main-
|
|
3
|
+
} from "./main-86gs8q0t.mjs";
|
|
4
4
|
|
|
5
5
|
// src/paths.ts
|
|
6
6
|
import fs from "node:fs";
|
|
@@ -57,6 +57,45 @@ var binaryPackage = () => globalThis.__OPENCODE_BROWSER_TARGET__ ? `@opencode/br
|
|
|
57
57
|
var binaryName = (platform = process.platform) => platform === "win32" ? "browse.exe" : "browse";
|
|
58
58
|
var scriptEntry = (entry) => /\.[cm]?[jt]s$/.test(entry);
|
|
59
59
|
var entryCommand = (entry, node = process.execPath) => scriptEntry(entry) ? [node, entry] : [entry];
|
|
60
|
+
var windowsShellShim = (entry, pathModule) => /\.(cmd|bat)$/i.test(entry) || pathModule.extname(entry) === "" && !pathModule.isAbsolute(entry) && !/[\\/]/.test(entry);
|
|
61
|
+
var npxEntry = (entry) => /(^|\/)_npx\//.test(entry.replaceAll("\\", "/"));
|
|
62
|
+
function resolveWindowsShim(entry, node = process.execPath, options = {}) {
|
|
63
|
+
const pathModule = options.pathModule ?? path.win32;
|
|
64
|
+
const exists = options.existsSync ?? fs.existsSync;
|
|
65
|
+
if (!windowsShellShim(entry, pathModule))
|
|
66
|
+
return;
|
|
67
|
+
const shimmed = /\.(cmd|bat)$/i.test(entry);
|
|
68
|
+
const withFolder = shimmed && (pathModule.isAbsolute(entry) || /[\\/]/.test(entry));
|
|
69
|
+
const directories = withFolder ? [pathModule.dirname(entry)] : (options.env ?? process.env).PATH?.split(";").map((directory) => directory.trim().replace(/^"(.*)"$/, "$1")).filter(Boolean) ?? [];
|
|
70
|
+
for (const directory of directories) {
|
|
71
|
+
if (!shimmed) {
|
|
72
|
+
const executable = pathModule.join(directory, `${entry}.exe`);
|
|
73
|
+
if (exists(executable))
|
|
74
|
+
return [executable];
|
|
75
|
+
}
|
|
76
|
+
const shim = withFolder ? entry : pathModule.join(directory, shimmed ? entry : `${entry}.cmd`);
|
|
77
|
+
if (!exists(shim))
|
|
78
|
+
continue;
|
|
79
|
+
const script = pathModule.join(directory, "node_modules", "@opencode", "browse", "dist", "cli.mjs");
|
|
80
|
+
if (exists(script))
|
|
81
|
+
return [node, script];
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
function entrySpawnCommand(entry, node = process.execPath, options = {}) {
|
|
86
|
+
if (scriptEntry(entry))
|
|
87
|
+
return [node, entry];
|
|
88
|
+
const pathModule = options.pathModule ?? path.win32;
|
|
89
|
+
if ((options.platform ?? process.platform) !== "win32" || !windowsShellShim(entry, pathModule))
|
|
90
|
+
return [entry];
|
|
91
|
+
const resolved = resolveWindowsShim(entry, node, options);
|
|
92
|
+
if (resolved)
|
|
93
|
+
return resolved;
|
|
94
|
+
const running = options.running ?? runningEntry();
|
|
95
|
+
const compiled = options.compiled ?? compiledBinary();
|
|
96
|
+
const checkout = options.checkout ?? fromCheckout();
|
|
97
|
+
return !compiled && !checkout && scriptEntry(running) && !npxEntry(running) ? [node, running] : [entry];
|
|
98
|
+
}
|
|
60
99
|
function installedBinary() {
|
|
61
100
|
const binary = installedBinaryPath();
|
|
62
101
|
return fs.existsSync(binary) ? binary : undefined;
|
|
@@ -71,7 +110,7 @@ function cliInstall() {
|
|
|
71
110
|
return { kind: "binary", binary: installedBinary() ?? process.execPath, pathEnv: process.env.PATH };
|
|
72
111
|
if (fromCheckout())
|
|
73
112
|
return { kind: "checkout", bundle: path.join(packageRoot(), "dist", "cli.mjs") };
|
|
74
|
-
return { kind: "npm", version: "0.0.15-dev.
|
|
113
|
+
return { kind: "npm", version: "0.0.15-dev.105", npx: /[/\\]_npx[/\\]/.test(process.argv[1] ?? "") };
|
|
75
114
|
}
|
|
76
115
|
function cliPrefix(install = cliInstall()) {
|
|
77
116
|
if (install.kind === "binary") {
|
|
@@ -93,7 +132,7 @@ function storeConfig(env = process.env, baked = { id: "mfnicocicmmlkpjnaffgihfjh
|
|
|
93
132
|
return id ? { id } : {};
|
|
94
133
|
}
|
|
95
134
|
var RELEASE_SERVICE = "https://anoma.ly/release";
|
|
96
|
-
function devExtension(baked = { file: "browse-extension-0.0.15-dev.
|
|
135
|
+
function devExtension(baked = { file: "browse-extension-0.0.15-dev.105.zip", sha256: "a87cf54f484fce970ffd7e071eebbe18ce24c27a187c5adcd438f33b693275c2", size: 183068 }) {
|
|
97
136
|
return baked && /^[0-9a-f]{64}$/.test(baked.sha256) && /^[\w.-]+\.zip$/.test(baked.file) ? baked : undefined;
|
|
98
137
|
}
|
|
99
138
|
var devExtensionUrl = (extension, env = process.env) => `${(env.OPENCODE_BROWSER_RELEASE_SERVICE || RELEASE_SERVICE).replace(/\/+$/, "")}/browse/files/${extension.sha256}/${extension.file}`;
|
|
@@ -713,7 +752,7 @@ function spawnRuntimeChild(runtime, args, onExit, env = process.env) {
|
|
|
713
752
|
mkdirSync2(directory, { recursive: true, mode: 448 });
|
|
714
753
|
const log = openSync(path3.join(directory, "auto-update.log"), "a", 384);
|
|
715
754
|
try {
|
|
716
|
-
const [file, ...prefix] =
|
|
755
|
+
const [file, ...prefix] = entrySpawnCommand(runtime.entry);
|
|
717
756
|
const child = spawn(file, [...prefix, ...args], { detached: true, stdio: ["ignore", log, log], env: rest });
|
|
718
757
|
child.on("error", () => onExit(null));
|
|
719
758
|
child.on("exit", (code) => onExit(code));
|
|
@@ -727,4 +766,4 @@ function spawnRuntimeChild(runtime, args, onExit, env = process.env) {
|
|
|
727
766
|
}
|
|
728
767
|
}
|
|
729
768
|
|
|
730
|
-
export { defaultRoots, configRoot2, dataRoot, stateRoot, cacheRoot, binRoot, installedBinaryPath, installerBinaryPath, defaultSettingsPath, oldStoreMarker, fromCheckout, compiledBinary, binaryPackage, binaryName, scriptEntry, entryCommand, runningEntry, checkoutRoot, cliCommand, PUBLIC_STORE_ID, storeConfig, devExtension, devExtensionUrl, devExtensionFolder, storeUrl, installCommand, runningServiceTarget, releaseChannel, checkRelease, autoUpdateModes, UPDATE_VERSION, channelOf, compareVersions, installedRuntime2, installedVersion, updateState, autoUpdateOverride, storedMode, effectiveMode, setStoredMode, autoUpdateStatus, describeAutoUpdate, updateAvailable, runCommand, registryUrl, fetchPublished, runInstaller, createAutoUpdater };
|
|
769
|
+
export { defaultRoots, configRoot2, dataRoot, stateRoot, cacheRoot, binRoot, installedBinaryPath, installerBinaryPath, defaultSettingsPath, oldStoreMarker, fromCheckout, compiledBinary, binaryPackage, binaryName, scriptEntry, entryCommand, resolveWindowsShim, entrySpawnCommand, runningEntry, checkoutRoot, cliCommand, PUBLIC_STORE_ID, storeConfig, devExtension, devExtensionUrl, devExtensionFolder, storeUrl, installCommand, runningServiceTarget, releaseChannel, checkRelease, autoUpdateModes, UPDATE_VERSION, channelOf, compareVersions, installedRuntime2, installedVersion, updateState, autoUpdateOverride, storedMode, effectiveMode, setStoredMode, autoUpdateStatus, describeAutoUpdate, updateAvailable, runCommand, registryUrl, fetchPublished, runInstaller, createAutoUpdater };
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
bundledPairingCodeTtlMs,
|
|
6
6
|
mintPairingCode,
|
|
7
7
|
writeExtensionPairing
|
|
8
|
-
} from "./main-
|
|
8
|
+
} from "./main-2vd35ddd.mjs";
|
|
9
9
|
import {
|
|
10
10
|
configRoot2,
|
|
11
11
|
cacheRoot,
|
|
12
12
|
devExtensionUrl,
|
|
13
13
|
devExtensionFolder
|
|
14
|
-
} from "./main-
|
|
14
|
+
} from "./main-n8m6b9y4.mjs";
|
|
15
15
|
|
|
16
16
|
// src/setup/dev-extension.ts
|
|
17
17
|
import { createHash } from "node:crypto";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
opencodeBrowserVersion2
|
|
3
|
-
} from "./main-
|
|
3
|
+
} from "./main-86gs8q0t.mjs";
|
|
4
4
|
import {
|
|
5
5
|
configRoot2,
|
|
6
6
|
dataRoot,
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
compiledBinary,
|
|
11
11
|
scriptEntry,
|
|
12
12
|
entryCommand,
|
|
13
|
+
resolveWindowsShim,
|
|
14
|
+
entrySpawnCommand,
|
|
13
15
|
cliCommand,
|
|
14
16
|
PUBLIC_STORE_ID,
|
|
15
17
|
storeConfig,
|
|
@@ -18,10 +20,10 @@ import {
|
|
|
18
20
|
storeUrl,
|
|
19
21
|
installedVersion,
|
|
20
22
|
runCommand
|
|
21
|
-
} from "./main-
|
|
23
|
+
} from "./main-n8m6b9y4.mjs";
|
|
22
24
|
import {
|
|
23
25
|
formatPairingCode
|
|
24
|
-
} from "./main-
|
|
26
|
+
} from "./main-2vd35ddd.mjs";
|
|
25
27
|
import {
|
|
26
28
|
unpackedExtensionId
|
|
27
29
|
} from "./main-mrew6jy8.mjs";
|
|
@@ -11229,7 +11231,7 @@ function fingerprint(entry) {
|
|
|
11229
11231
|
return createHash("sha256").update(readFileOr(entry, entry)).digest("hex").slice(0, 16);
|
|
11230
11232
|
}
|
|
11231
11233
|
function restartOutdatedRelay(entry) {
|
|
11232
|
-
const [file, ...prefix] =
|
|
11234
|
+
const [file, ...prefix] = entrySpawnCommand(entry);
|
|
11233
11235
|
const status = spawnSync4(file, [...prefix, "status", "--json"], { encoding: "utf8", timeout: 15000 });
|
|
11234
11236
|
if (!/"stale":\s*true/.test(status.stdout ?? ""))
|
|
11235
11237
|
return;
|
|
@@ -11321,13 +11323,15 @@ async function npmGlobalRoot() {
|
|
|
11321
11323
|
return root && path5.isAbsolute(root) ? root : undefined;
|
|
11322
11324
|
}
|
|
11323
11325
|
async function installRuntime() {
|
|
11324
|
-
if (compiledBinary())
|
|
11325
|
-
|
|
11326
|
+
if (compiledBinary()) {
|
|
11327
|
+
const runtime = await installBinaryRuntime();
|
|
11328
|
+
return { ...runtime, spawnEntry: runtime.entry };
|
|
11329
|
+
}
|
|
11326
11330
|
if (fromSource) {
|
|
11327
11331
|
const bundle = path5.join(packageRoot, "dist", "cli.mjs");
|
|
11328
11332
|
if (!existsSync4(bundle))
|
|
11329
11333
|
fail("Build the CLI first: `bun run build` in cli/ (or `bun run setup` at the top).");
|
|
11330
|
-
return { entry: bundle, version: opencodeBrowserVersion2 };
|
|
11334
|
+
return { entry: bundle, version: opencodeBrowserVersion2, spawnEntry: bundle };
|
|
11331
11335
|
}
|
|
11332
11336
|
const spec = process.env.OPENCODE_BROWSER_PACKAGE;
|
|
11333
11337
|
const globalRoot = await npmGlobalRoot();
|
|
@@ -11348,7 +11352,7 @@ async function installRuntime() {
|
|
|
11348
11352
|
if (!existsSync4(entry))
|
|
11349
11353
|
fail(`npm didn't install ${PACKAGE} in ${root}; run \`npm install -g ${PACKAGE}\` and try again.`);
|
|
11350
11354
|
const version = readJson(path5.join(root, "@opencode", "browse", "package.json"))?.version ?? opencodeBrowserVersion2;
|
|
11351
|
-
return { entry: "browse", version };
|
|
11355
|
+
return { entry: "browse", version, spawnEntry: entry };
|
|
11352
11356
|
}
|
|
11353
11357
|
function installedRuntime(settings, server) {
|
|
11354
11358
|
const command = Array.isArray(server?.command) ? server.command.filter((part) => typeof part === "string") : [];
|
|
@@ -11357,7 +11361,17 @@ function installedRuntime(settings, server) {
|
|
|
11357
11361
|
return;
|
|
11358
11362
|
const packageDir = path5.dirname(path5.dirname(entry));
|
|
11359
11363
|
const source = scriptEntry(entry) && existsSync4(path5.join(packageDir, "src", "main.ts"));
|
|
11360
|
-
const
|
|
11364
|
+
const windowsShim = process.platform === "win32" && (entry === "browse" || /\.(cmd|bat)$/i.test(entry));
|
|
11365
|
+
const onDisk = windowsShim ? (() => {
|
|
11366
|
+
const resolved = resolveWindowsShim(entry);
|
|
11367
|
+
if (!resolved)
|
|
11368
|
+
return;
|
|
11369
|
+
return installedVersion({
|
|
11370
|
+
kind: resolved.length === 2 ? "npm" : "binary",
|
|
11371
|
+
entry: resolved[resolved.length - 1],
|
|
11372
|
+
version: settings?.version ?? opencodeBrowserVersion2
|
|
11373
|
+
});
|
|
11374
|
+
})() : entry === "browse" ? spawnSync4("browse", ["--version"], { encoding: "utf8", timeout: 15000 }).stdout?.trim() || undefined : existsSync4(entry) ? installedVersion({ kind: scriptEntry(entry) ? "npm" : "binary", entry, version: settings?.version ?? opencodeBrowserVersion2 }) : undefined;
|
|
11361
11375
|
const version = onDisk ?? settings?.version ?? (path5.resolve(entry) === path5.join(packageRoot, "dist", "cli.mjs") ? opencodeBrowserVersion2 : readJson(path5.join(packageDir, "package.json"))?.version);
|
|
11362
11376
|
return { entry, version, source };
|
|
11363
11377
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./main-vgzr4689.mjs";
|
|
4
4
|
import {
|
|
5
5
|
isValidSessionId2
|
|
6
|
-
} from "./main-
|
|
6
|
+
} from "./main-9pvtmhg7.mjs";
|
|
7
7
|
import {
|
|
8
8
|
isSome,
|
|
9
9
|
decodeUnknownOption,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./main-csnx585b.mjs";
|
|
18
18
|
import {
|
|
19
19
|
stateRoot
|
|
20
|
-
} from "./main-
|
|
20
|
+
} from "./main-n8m6b9y4.mjs";
|
|
21
21
|
|
|
22
22
|
// src/session-manager/journal.ts
|
|
23
23
|
import fs from "node:fs";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
parseTargetSelection2,
|
|
13
13
|
getObject2,
|
|
14
14
|
getString2
|
|
15
|
-
} from "./main-
|
|
15
|
+
} from "./main-9pvtmhg7.mjs";
|
|
16
16
|
import {
|
|
17
17
|
isNodeError,
|
|
18
18
|
writeJsonFileAtomically
|
|
@@ -131,7 +131,7 @@ import {
|
|
|
131
131
|
import {
|
|
132
132
|
dataRoot,
|
|
133
133
|
cliCommand
|
|
134
|
-
} from "./main-
|
|
134
|
+
} from "./main-n8m6b9y4.mjs";
|
|
135
135
|
|
|
136
136
|
// node_modules/effect/dist/Semaphore.js
|
|
137
137
|
var makeUnsafe = (permits) => new SemaphoreImpl(permits);
|
|
@@ -256,11 +256,11 @@ import {
|
|
|
256
256
|
} from "./main-csnx585b.mjs";
|
|
257
257
|
import {
|
|
258
258
|
opencodeBrowserVersion2
|
|
259
|
-
} from "./main-
|
|
259
|
+
} from "./main-86gs8q0t.mjs";
|
|
260
260
|
import {
|
|
261
261
|
cliCommand,
|
|
262
262
|
autoUpdateStatus
|
|
263
|
-
} from "./main-
|
|
263
|
+
} from "./main-n8m6b9y4.mjs";
|
|
264
264
|
import"./main-mrew6jy8.mjs";
|
|
265
265
|
import {
|
|
266
266
|
option,
|
|
@@ -280,12 +280,12 @@ import {
|
|
|
280
280
|
relayBuildProblem,
|
|
281
281
|
ensureRelay,
|
|
282
282
|
ensureExtensionConnected
|
|
283
|
-
} from "./main-
|
|
283
|
+
} from "./main-9pvtmhg7.mjs";
|
|
284
284
|
import"./main-vgzr4689.mjs";
|
|
285
285
|
import {
|
|
286
286
|
updateJson2,
|
|
287
287
|
createUpdateWatcher2
|
|
288
|
-
} from "./main-
|
|
288
|
+
} from "./main-mhpdnjcy.mjs";
|
|
289
289
|
import {
|
|
290
290
|
makeUnsafe,
|
|
291
291
|
make,
|
|
@@ -369,7 +369,7 @@ import {
|
|
|
369
369
|
mcpErrorMessage2,
|
|
370
370
|
toolResult,
|
|
371
371
|
listSecrets
|
|
372
|
-
} from "./main-
|
|
372
|
+
} from "./main-tajvt727.mjs";
|
|
373
373
|
import {
|
|
374
374
|
Clock,
|
|
375
375
|
type,
|
|
@@ -384,7 +384,7 @@ import {
|
|
|
384
384
|
orElse,
|
|
385
385
|
exhaustive
|
|
386
386
|
} from "./main-8z9d979q.mjs";
|
|
387
|
-
import"./main-
|
|
387
|
+
import"./main-3b80897r.mjs";
|
|
388
388
|
import {
|
|
389
389
|
pipeArguments,
|
|
390
390
|
dual,
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
browseServerCommand,
|
|
7
7
|
editAgentConfig,
|
|
8
8
|
configureMcp
|
|
9
|
-
} from "./main-
|
|
10
|
-
import"./main-
|
|
9
|
+
} from "./main-q4enpj73.mjs";
|
|
10
|
+
import"./main-86gs8q0t.mjs";
|
|
11
11
|
import {
|
|
12
12
|
configRoot2,
|
|
13
13
|
dataRoot,
|
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
cacheRoot,
|
|
16
16
|
binRoot,
|
|
17
17
|
binaryName
|
|
18
|
-
} from "./main-
|
|
18
|
+
} from "./main-n8m6b9y4.mjs";
|
|
19
19
|
import"./main-vgzr4689.mjs";
|
|
20
|
-
import"./main-
|
|
20
|
+
import"./main-2vd35ddd.mjs";
|
|
21
21
|
import"./main-mrew6jy8.mjs";
|
|
22
22
|
import {
|
|
23
23
|
legacyDataRoot,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
opencodeBrowserVersion2,
|
|
3
3
|
opencodeBrowserBuildId2
|
|
4
|
-
} from "./main-
|
|
4
|
+
} from "./main-86gs8q0t.mjs";
|
|
5
5
|
import {
|
|
6
6
|
defaultRoots,
|
|
7
7
|
configRoot2,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
setStoredMode,
|
|
26
26
|
autoUpdateStatus,
|
|
27
27
|
createAutoUpdater
|
|
28
|
-
} from "./main-
|
|
28
|
+
} from "./main-n8m6b9y4.mjs";
|
|
29
29
|
import {
|
|
30
30
|
extensionProtocolVersion,
|
|
31
31
|
minExtensionProtocolVersion,
|
|
@@ -101,7 +101,7 @@ import {
|
|
|
101
101
|
isRestrictedTarget2,
|
|
102
102
|
isRestrictedUrl2,
|
|
103
103
|
dataUrlDocument2
|
|
104
|
-
} from "./main-
|
|
104
|
+
} from "./main-9pvtmhg7.mjs";
|
|
105
105
|
import {
|
|
106
106
|
context,
|
|
107
107
|
pendingPairingCodeKeys,
|
|
@@ -119,7 +119,7 @@ import {
|
|
|
119
119
|
pairingSessionKey,
|
|
120
120
|
sessionProof,
|
|
121
121
|
wrapToken
|
|
122
|
-
} from "./main-
|
|
122
|
+
} from "./main-2vd35ddd.mjs";
|
|
123
123
|
import {
|
|
124
124
|
makeUnsafe,
|
|
125
125
|
SettingsInputError,
|
|
@@ -147,22 +147,22 @@ import {
|
|
|
147
147
|
checkNavigationUrl,
|
|
148
148
|
readSecret,
|
|
149
149
|
secretText
|
|
150
|
-
} from "./main-
|
|
150
|
+
} from "./main-tajvt727.mjs";
|
|
151
151
|
import {
|
|
152
152
|
defaultJournalBaseDir,
|
|
153
153
|
makeJournalEntry,
|
|
154
154
|
appendJournalEntry,
|
|
155
155
|
startJournalRetention
|
|
156
|
-
} from "./main-
|
|
156
|
+
} from "./main-t2cqfrsz.mjs";
|
|
157
157
|
import {
|
|
158
158
|
createUpdateWatcher2
|
|
159
|
-
} from "./main-
|
|
159
|
+
} from "./main-mhpdnjcy.mjs";
|
|
160
160
|
import {
|
|
161
161
|
relayHostname,
|
|
162
162
|
isLocalPeer,
|
|
163
163
|
installedDevExtension,
|
|
164
164
|
syncDevExtension
|
|
165
|
-
} from "./main-
|
|
165
|
+
} from "./main-p7t3aqr3.mjs";
|
|
166
166
|
import {
|
|
167
167
|
legacyRoots
|
|
168
168
|
} from "./main-ckssvk4c.mjs";
|
|
@@ -278,7 +278,7 @@ import {
|
|
|
278
278
|
relayToken,
|
|
279
279
|
secretsEqual,
|
|
280
280
|
ensurePrivateDirectory
|
|
281
|
-
} from "./main-
|
|
281
|
+
} from "./main-3b80897r.mjs";
|
|
282
282
|
import {
|
|
283
283
|
isString,
|
|
284
284
|
isNumber,
|
|
@@ -2410,6 +2410,9 @@ function isInside(child, parent, platform = process.platform) {
|
|
|
2410
2410
|
const relative = paths.relative(foldCase(parent, platform), foldCase(child, platform));
|
|
2411
2411
|
return relative === "" || !paths.isAbsolute(relative) && relative !== ".." && !relative.startsWith(`..${paths.sep}`);
|
|
2412
2412
|
}
|
|
2413
|
+
function isSamePath(a, b) {
|
|
2414
|
+
return isInside(a, b) && isInside(b, a);
|
|
2415
|
+
}
|
|
2413
2416
|
function realTarget(target) {
|
|
2414
2417
|
let current = path2.resolve(target);
|
|
2415
2418
|
const rest = [];
|
|
@@ -2610,12 +2613,161 @@ var fileOptionMethods = new Set([
|
|
|
2610
2613
|
var fileOptionKeys = new Set(["path", "dir", "har", "storageState"]);
|
|
2611
2614
|
var alwaysFileOptionKeys = new Set(["outputPath", "baseline", "certPath", "keyPath", "pfxPath", "tracesDir", "downloadsPath"]);
|
|
2612
2615
|
var forbiddenOptionKeys = new Set(["executablePath", "recordHar", "recordVideo"]);
|
|
2613
|
-
|
|
2616
|
+
var fileOutputMethods = new Set(["screenshot", "pdf", "storageState", "stop", "stopChunk", "screenshotWithLabels", "screenshotDiff"]);
|
|
2617
|
+
var isFileOutputOption = (method, key) => key === "path" && fileOutputMethods.has(method) || key === "outputPath" && method === "stop";
|
|
2618
|
+
var startedTraces = new WeakMap;
|
|
2619
|
+
var isObject2 = (value) => value !== null && typeof value === "object";
|
|
2620
|
+
function fileExists(target) {
|
|
2621
|
+
try {
|
|
2622
|
+
fs2.lstatSync(target);
|
|
2623
|
+
return true;
|
|
2624
|
+
} catch (error) {
|
|
2625
|
+
if (error.code === "ENOENT")
|
|
2626
|
+
return false;
|
|
2627
|
+
throw error;
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
function outputDirectoryError(directory) {
|
|
2631
|
+
return new ExecuteFileAccessError(`file outputs must use real, owned directories without group/world write access, not ${directory}`);
|
|
2632
|
+
}
|
|
2633
|
+
function pinPrivateDirectory(directory, uid) {
|
|
2634
|
+
const descriptor = fs2.openSync(directory, fs2.constants.O_RDONLY | fs2.constants.O_DIRECTORY | fs2.constants.O_NOFOLLOW);
|
|
2635
|
+
try {
|
|
2636
|
+
const opened = fs2.fstatSync(descriptor);
|
|
2637
|
+
const current = fs2.lstatSync(directory);
|
|
2638
|
+
if (!opened.isDirectory() || opened.uid !== uid || current.isSymbolicLink() || current.dev !== opened.dev || current.ino !== opened.ino) {
|
|
2639
|
+
throw outputDirectoryError(directory);
|
|
2640
|
+
}
|
|
2641
|
+
if ((opened.mode & 511) !== 448)
|
|
2642
|
+
fs2.fchmodSync(descriptor, 448);
|
|
2643
|
+
} finally {
|
|
2644
|
+
fs2.closeSync(descriptor);
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
function ensureExecuteOutputDirectory(directory) {
|
|
2648
|
+
const resolved = path2.resolve(directory);
|
|
2649
|
+
const roots = executeFileRoots();
|
|
2650
|
+
const root = roots.filter((candidate) => isInside(resolved, candidate)).sort((a, b) => b.length - a.length)[0];
|
|
2651
|
+
if (root === undefined)
|
|
2652
|
+
throw outputDirectoryError(resolved);
|
|
2653
|
+
const uid = process.getuid?.();
|
|
2654
|
+
const missing = [];
|
|
2655
|
+
let current = resolved;
|
|
2656
|
+
for (;; ) {
|
|
2657
|
+
let stat;
|
|
2658
|
+
try {
|
|
2659
|
+
stat = fs2.lstatSync(current);
|
|
2660
|
+
} catch (error) {
|
|
2661
|
+
if (error.code !== "ENOENT")
|
|
2662
|
+
throw error;
|
|
2663
|
+
}
|
|
2664
|
+
if (stat) {
|
|
2665
|
+
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
2666
|
+
throw outputDirectoryError(current);
|
|
2667
|
+
if (!isSamePath(current, root) && uid !== undefined && (stat.uid !== uid || (stat.mode & 18) !== 0))
|
|
2668
|
+
throw outputDirectoryError(current);
|
|
2669
|
+
} else if (isSamePath(current, root)) {
|
|
2670
|
+
throw outputDirectoryError(current);
|
|
2671
|
+
} else {
|
|
2672
|
+
missing.push(current);
|
|
2673
|
+
}
|
|
2674
|
+
if (isSamePath(current, root))
|
|
2675
|
+
break;
|
|
2676
|
+
const parent = path2.dirname(current);
|
|
2677
|
+
if (parent === current)
|
|
2678
|
+
throw outputDirectoryError(current);
|
|
2679
|
+
current = parent;
|
|
2680
|
+
}
|
|
2681
|
+
for (const step of missing.reverse()) {
|
|
2682
|
+
let created = false;
|
|
2683
|
+
try {
|
|
2684
|
+
fs2.mkdirSync(step, { mode: 448 });
|
|
2685
|
+
created = true;
|
|
2686
|
+
} catch (error) {
|
|
2687
|
+
if (error.code !== "EEXIST")
|
|
2688
|
+
throw error;
|
|
2689
|
+
}
|
|
2690
|
+
if (created && uid !== undefined && process.platform !== "win32")
|
|
2691
|
+
pinPrivateDirectory(step, uid);
|
|
2692
|
+
const stat = fs2.lstatSync(step);
|
|
2693
|
+
if (!stat.isDirectory() || stat.isSymbolicLink() || uid !== undefined && (stat.uid !== uid || (stat.mode & 18) !== 0)) {
|
|
2694
|
+
throw outputDirectoryError(step);
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
function secureExecuteFileOutputs(outputs) {
|
|
2699
|
+
const uid = process.getuid?.();
|
|
2700
|
+
if (uid === undefined)
|
|
2701
|
+
return;
|
|
2702
|
+
const operation = "execute file output";
|
|
2703
|
+
for (const output of outputs) {
|
|
2704
|
+
if (output.existed)
|
|
2705
|
+
continue;
|
|
2706
|
+
try {
|
|
2707
|
+
const before = fs2.lstatSync(output.path);
|
|
2708
|
+
if (!before.isFile() || before.uid !== uid || before.nlink !== 1)
|
|
2709
|
+
continue;
|
|
2710
|
+
const descriptor = fs2.openSync(output.path, fs2.constants.O_RDONLY | fs2.constants.O_NOFOLLOW | fs2.constants.O_NONBLOCK);
|
|
2711
|
+
try {
|
|
2712
|
+
const opened = fs2.fstatSync(descriptor);
|
|
2713
|
+
const current = fs2.lstatSync(output.path);
|
|
2714
|
+
if (!opened.isFile() || opened.uid !== uid || opened.nlink !== 1 || current.isSymbolicLink() || current.dev !== opened.dev || current.ino !== opened.ino)
|
|
2715
|
+
continue;
|
|
2716
|
+
assertExecuteFilePath(path2.join(path2.dirname(output.path), `.execute-output-${crypto3.randomUUID()}`), operation);
|
|
2717
|
+
fs2.fchmodSync(descriptor, 384);
|
|
2718
|
+
assertExecuteFilePath(output.path, operation);
|
|
2719
|
+
if (process.platform === "linux")
|
|
2720
|
+
assertExecuteFilePath(fs2.realpathSync(`/proc/self/fd/${descriptor}`), operation);
|
|
2721
|
+
} finally {
|
|
2722
|
+
fs2.closeSync(descriptor);
|
|
2723
|
+
}
|
|
2724
|
+
} catch {}
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
function prepareExecuteFileOutputs(call) {
|
|
2728
|
+
const trace = call.trace;
|
|
2729
|
+
if (trace !== undefined) {
|
|
2730
|
+
if (trace.path === undefined)
|
|
2731
|
+
startedTraces.delete(trace.receiver);
|
|
2732
|
+
else
|
|
2733
|
+
startedTraces.set(trace.receiver, trace.path);
|
|
2734
|
+
}
|
|
2735
|
+
const outputs = [];
|
|
2736
|
+
for (const candidate of call.outputs) {
|
|
2737
|
+
assertExecuteFilePath(candidate.path, "execute file output");
|
|
2738
|
+
ensureExecuteOutputDirectory(path2.dirname(candidate.path));
|
|
2739
|
+
const resolved = assertExecuteFilePath(candidate.path, "execute file output");
|
|
2740
|
+
outputs.push({ path: resolved, existed: fileExists(resolved) });
|
|
2741
|
+
}
|
|
2742
|
+
const stop = call.traceStop;
|
|
2743
|
+
return stop === undefined ? { outputs } : { outputs, forgetTrace: () => startedTraces.delete(stop) };
|
|
2744
|
+
}
|
|
2745
|
+
function completeExecuteFileOutputs(result, prepared) {
|
|
2746
|
+
const settle = (resolved) => {
|
|
2747
|
+
if (resolved)
|
|
2748
|
+
prepared.forgetTrace?.();
|
|
2749
|
+
secureExecuteFileOutputs(prepared.outputs);
|
|
2750
|
+
};
|
|
2751
|
+
if (prepared.outputs.length === 0 && prepared.forgetTrace === undefined)
|
|
2752
|
+
return result;
|
|
2753
|
+
if (!util.types.isPromise(result)) {
|
|
2754
|
+
settle(true);
|
|
2755
|
+
return result;
|
|
2756
|
+
}
|
|
2757
|
+
return result.then((value) => {
|
|
2758
|
+
settle(true);
|
|
2759
|
+
return value;
|
|
2760
|
+
}, (error) => {
|
|
2761
|
+
settle(false);
|
|
2762
|
+
throw error;
|
|
2763
|
+
});
|
|
2764
|
+
}
|
|
2765
|
+
function checkFileOptions(value, method, includeMethodKeys, candidates, depth = 0) {
|
|
2614
2766
|
if (depth > 4 || value === null || typeof value !== "object")
|
|
2615
2767
|
return;
|
|
2616
2768
|
if (Array.isArray(value)) {
|
|
2617
2769
|
for (const item of value)
|
|
2618
|
-
checkFileOptions(item, method, includeMethodKeys, depth + 1);
|
|
2770
|
+
checkFileOptions(item, method, includeMethodKeys, candidates, depth + 1);
|
|
2619
2771
|
return;
|
|
2620
2772
|
}
|
|
2621
2773
|
const prototype = Object.getPrototypeOf(value);
|
|
@@ -2625,20 +2777,24 @@ function checkFileOptions(value, method, includeMethodKeys, depth = 0) {
|
|
|
2625
2777
|
if (forbiddenOptionKeys.has(key))
|
|
2626
2778
|
throw new ExecuteFileAccessError(`${method}: the ${key} option is not available in execute code`);
|
|
2627
2779
|
if (typeof item === "string" && (alwaysFileOptionKeys.has(key) || includeMethodKeys && fileOptionKeys.has(key))) {
|
|
2628
|
-
|
|
2780
|
+
const resolved = assertExecuteFilePath(item, `${method}({ ${key} })`);
|
|
2781
|
+
if (depth === 0 && isFileOutputOption(method, key))
|
|
2782
|
+
candidates.push({ path: resolved });
|
|
2783
|
+
Reflect.set(value, key, resolved);
|
|
2629
2784
|
} else {
|
|
2630
|
-
checkFileOptions(item, method, includeMethodKeys, depth + 1);
|
|
2785
|
+
checkFileOptions(item, method, includeMethodKeys, candidates, depth + 1);
|
|
2631
2786
|
}
|
|
2632
2787
|
}
|
|
2633
2788
|
}
|
|
2634
2789
|
function checkFileStrings(value, method) {
|
|
2635
2790
|
if (typeof value === "string")
|
|
2636
|
-
assertExecuteFilePath(value, method);
|
|
2637
|
-
|
|
2791
|
+
return assertExecuteFilePath(value, method);
|
|
2792
|
+
if (Array.isArray(value)) {
|
|
2638
2793
|
for (const item of value)
|
|
2639
2794
|
if (typeof item === "string")
|
|
2640
2795
|
assertExecuteFilePath(item, method);
|
|
2641
2796
|
}
|
|
2797
|
+
return;
|
|
2642
2798
|
}
|
|
2643
2799
|
var promiseReturningNames = new Set([...fileOptionMethods, "setInputFiles", "setFiles", "saveAs", "bringToFront", "send"]);
|
|
2644
2800
|
function returnsPromise(fn) {
|
|
@@ -2658,15 +2814,32 @@ function checkHostCall(fn, receiver, args) {
|
|
|
2658
2814
|
if ((name === "bringToFront" || name === "send" && args[0] === "Page.bringToFront") && !executeAllowsForeground()) {
|
|
2659
2815
|
throw new Error(bringToFrontBlockedMessage);
|
|
2660
2816
|
}
|
|
2817
|
+
const candidates = [];
|
|
2661
2818
|
if (name === "setInputFiles") {
|
|
2662
2819
|
const isFrameLike = receiver !== null && typeof receiver === "object" && typeof receiver.goto === "function";
|
|
2663
2820
|
checkFileStrings(isFrameLike ? args[1] : args[0], "setInputFiles");
|
|
2664
|
-
} else if (name === "
|
|
2821
|
+
} else if (name === "saveAs") {
|
|
2822
|
+
const target = checkFileStrings(args[0], name);
|
|
2823
|
+
if (target !== undefined)
|
|
2824
|
+
candidates.push({ path: target });
|
|
2825
|
+
} else if (name === "setFiles" || name === "routeFromHAR") {
|
|
2665
2826
|
checkFileStrings(args[0], name);
|
|
2666
2827
|
}
|
|
2667
2828
|
const includeMethodKeys = fileOptionMethods.has(name);
|
|
2668
2829
|
for (const arg of args)
|
|
2669
|
-
checkFileOptions(arg, name || "call", includeMethodKeys);
|
|
2830
|
+
checkFileOptions(arg, name || "call", includeMethodKeys, candidates);
|
|
2831
|
+
if (name === "startTracing" && isObject2(receiver)) {
|
|
2832
|
+
const path = isObject2(args[1]) ? Reflect.get(args[1], "path") : undefined;
|
|
2833
|
+
const trace = typeof path === "string" ? assertExecuteFilePath(path, "startTracing({ path })") : undefined;
|
|
2834
|
+
return { outputs: candidates, trace: { receiver, path: trace } };
|
|
2835
|
+
}
|
|
2836
|
+
if (name === "stopTracing" && isObject2(receiver)) {
|
|
2837
|
+
const remembered = startedTraces.get(receiver);
|
|
2838
|
+
if (remembered === undefined)
|
|
2839
|
+
return { outputs: candidates };
|
|
2840
|
+
return { outputs: [...candidates, { path: assertExecuteFilePath(remembered, "stopTracing()") }], traceStop: receiver };
|
|
2841
|
+
}
|
|
2842
|
+
return { outputs: candidates };
|
|
2670
2843
|
}
|
|
2671
2844
|
function pageVisibleApiWarningForName(name) {
|
|
2672
2845
|
if (name === "addInitScript" || name === "exposeFunction" || name === "exposeBinding") {
|
|
@@ -3508,8 +3681,9 @@ class ExecuteRealm {
|
|
|
3508
3681
|
apply(_shadow, thisArgument, args) {
|
|
3509
3682
|
const hostThis = isObjectLike(thisArgument) && realm.hostBySandboxProxy.has(thisArgument) ? realm.hostBySandboxProxy.get(thisArgument) : realm.toHost(thisArgument);
|
|
3510
3683
|
const hostArgs = args.map((arg) => realm.toHost(arg));
|
|
3684
|
+
let prepared;
|
|
3511
3685
|
try {
|
|
3512
|
-
checkHostCall(target, hostThis, hostArgs);
|
|
3686
|
+
prepared = prepareExecuteFileOutputs(checkHostCall(target, hostThis, hostArgs));
|
|
3513
3687
|
} catch (error) {
|
|
3514
3688
|
if (returnsPromise(target))
|
|
3515
3689
|
return realm.SandboxPromise.reject(realm.toSandboxThrown(error));
|
|
@@ -3525,7 +3699,7 @@ class ExecuteRealm {
|
|
|
3525
3699
|
throw realm.toSandboxThrown(error);
|
|
3526
3700
|
}
|
|
3527
3701
|
try {
|
|
3528
|
-
return realm.toSandbox(result);
|
|
3702
|
+
return realm.toSandbox(completeExecuteFileOutputs(result, prepared));
|
|
3529
3703
|
} catch (error) {
|
|
3530
3704
|
throw realm.sanitizeThrown(error);
|
|
3531
3705
|
}
|
|
@@ -3567,8 +3741,8 @@ class ExecuteRealm {
|
|
|
3567
3741
|
if (!guarded) {
|
|
3568
3742
|
guarded = new Proxy(host, {
|
|
3569
3743
|
apply(target, receiver, args) {
|
|
3570
|
-
checkHostCall(target, receiver, args);
|
|
3571
|
-
return Reflect.apply(target, receiver, args);
|
|
3744
|
+
const prepared = prepareExecuteFileOutputs(checkHostCall(target, receiver, args));
|
|
3745
|
+
return completeExecuteFileOutputs(Reflect.apply(target, receiver, args), prepared);
|
|
3572
3746
|
},
|
|
3573
3747
|
construct(target, args, newTarget) {
|
|
3574
3748
|
checkHostCall(target, undefined, args);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./main-
|
|
1
|
+
import"./main-86gs8q0t.mjs";
|
|
2
2
|
import {
|
|
3
3
|
cliCommand,
|
|
4
4
|
installCommand,
|
|
@@ -15,14 +15,14 @@ import {
|
|
|
15
15
|
registryUrl,
|
|
16
16
|
fetchPublished,
|
|
17
17
|
runInstaller
|
|
18
|
-
} from "./main-
|
|
18
|
+
} from "./main-n8m6b9y4.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-
|
|
25
|
+
} from "./main-9pvtmhg7.mjs";
|
|
26
26
|
import"./main-vgzr4689.mjs";
|
|
27
27
|
import {
|
|
28
28
|
succeed6,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
provide3,
|
|
33
33
|
runPromise
|
|
34
34
|
} from "./main-csnx585b.mjs";
|
|
35
|
-
import"./main-
|
|
35
|
+
import"./main-3b80897r.mjs";
|
|
36
36
|
|
|
37
37
|
// src/update/runtime-update.ts
|
|
38
38
|
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-q4enpj73.mjs";
|
|
67
67
|
import {
|
|
68
68
|
opencodeBrowserBuildId2
|
|
69
|
-
} from "./main-
|
|
69
|
+
} from "./main-86gs8q0t.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,7 +83,7 @@ import {
|
|
|
82
83
|
autoUpdateStatus,
|
|
83
84
|
describeAutoUpdate,
|
|
84
85
|
runCommand
|
|
85
|
-
} from "./main-
|
|
86
|
+
} from "./main-n8m6b9y4.mjs";
|
|
86
87
|
import"./main-vgzr4689.mjs";
|
|
87
88
|
import {
|
|
88
89
|
pairingCodeTtlMs,
|
|
@@ -96,7 +97,7 @@ import {
|
|
|
96
97
|
revokeBrowserToken,
|
|
97
98
|
legacyPairingCode,
|
|
98
99
|
removeLegacyPairingCode
|
|
99
|
-
} from "./main-
|
|
100
|
+
} from "./main-2vd35ddd.mjs";
|
|
100
101
|
import {
|
|
101
102
|
unpackedExtensionId,
|
|
102
103
|
extensionProtocolSkew,
|
|
@@ -107,10 +108,10 @@ import {
|
|
|
107
108
|
readRelayConfig,
|
|
108
109
|
writeRelayConfig,
|
|
109
110
|
syncDevExtension
|
|
110
|
-
} from "./main-
|
|
111
|
+
} from "./main-p7t3aqr3.mjs";
|
|
111
112
|
import {
|
|
112
113
|
relayAuthorization
|
|
113
|
-
} from "./main-
|
|
114
|
+
} from "./main-3b80897r.mjs";
|
|
114
115
|
|
|
115
116
|
// src/setup.ts
|
|
116
117
|
import { mkdirSync as mkdirSync2, rmSync as rmSync2, writeFileSync } from "node:fs";
|
|
@@ -306,7 +307,7 @@ var relayHeaders = () => {
|
|
|
306
307
|
}
|
|
307
308
|
};
|
|
308
309
|
function ensureRelay(entry) {
|
|
309
|
-
const [file, ...prefix] =
|
|
310
|
+
const [file, ...prefix] = entrySpawnCommand(entry);
|
|
310
311
|
const started = spawnSync(file, [...prefix, "session", "list", "--json"], {
|
|
311
312
|
encoding: "utf8",
|
|
312
313
|
timeout: 30000
|
|
@@ -486,7 +487,7 @@ async function set(args) {
|
|
|
486
487
|
log(`✓ hostname is ${hostname}`);
|
|
487
488
|
const running = await fetch(`${relayBase()}/version`, { signal: AbortSignal.timeout(2000) }).then((response) => response.ok, () => false);
|
|
488
489
|
if (running) {
|
|
489
|
-
const [file, ...prefix] =
|
|
490
|
+
const [file, ...prefix] = entrySpawnCommand(runningEntry());
|
|
490
491
|
const restarted = spawnSync(file, [...prefix, "relay", "restart"], { stdio: "inherit" });
|
|
491
492
|
if (restarted.status !== 0)
|
|
492
493
|
log(`! The relay is still running with the old hostname. Run \`${cliCommand("relay restart --force")}\` to apply it.`);
|
|
@@ -660,7 +661,7 @@ async function installRemote(entry, tty) {
|
|
|
660
661
|
if (config.hostname !== "0.0.0.0") {
|
|
661
662
|
writeRelayConfig({ ...config, hostname: "0.0.0.0" });
|
|
662
663
|
const running = await fetch(`${relayBase()}/version`, { signal: AbortSignal.timeout(2000) }).then((response) => response.ok, () => false);
|
|
663
|
-
const [file, ...prefix] =
|
|
664
|
+
const [file, ...prefix] = entrySpawnCommand(entry);
|
|
664
665
|
const restarted = running && spawnSync2(file, [...prefix, "relay", "restart"], { encoding: "utf8", timeout: 60000 }).status === 0;
|
|
665
666
|
if (running && !restarted) {
|
|
666
667
|
process.exitCode = 1;
|
|
@@ -745,7 +746,7 @@ async function installSteps(args, tty, caller) {
|
|
|
745
746
|
const plan = agentPlan(locations, flags, tty, caller, remembered);
|
|
746
747
|
mkdirSync2(path2.dirname(files.settings), { recursive: true, mode: 448 });
|
|
747
748
|
mkdirSync2(files.dir, { recursive: true, mode: 448 });
|
|
748
|
-
const { entry, version } = await installRuntime();
|
|
749
|
+
const { entry, version, spawnEntry } = await installRuntime();
|
|
749
750
|
log(`✓ browse ${version} installed${fromSource ? " (from source)" : ""}`);
|
|
750
751
|
const onPath = args.includes("--no-modify-path") ? undefined : path2.isAbsolute(entry) && !scriptEntry(entry) ? addToPath(path2.dirname(entry)) : undefined;
|
|
751
752
|
if (onPath)
|
|
@@ -822,15 +823,15 @@ async function installSteps(args, tty, caller) {
|
|
|
822
823
|
log(`! Couldn't edit ${tilde(agent.file)} for ${label}. Check its syntax and permissions, then run ${cliCommand(`install --agent ${agent.name}`)}.`);
|
|
823
824
|
}
|
|
824
825
|
}
|
|
825
|
-
for (const line of restartOutdatedRelay(
|
|
826
|
+
for (const line of restartOutdatedRelay(spawnEntry) ?? [])
|
|
826
827
|
log(line);
|
|
827
828
|
const legacy = selected.includes("opencode") ? legacyBrowserControl() : [];
|
|
828
829
|
if (legacy.length)
|
|
829
830
|
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
831
|
if (args.includes("--remote"))
|
|
831
|
-
return installRemote(
|
|
832
|
+
return installRemote(spawnEntry, tty);
|
|
832
833
|
await syncDev();
|
|
833
|
-
const initial = await settledExtensionStatus(
|
|
834
|
+
const initial = await settledExtensionStatus(spawnEntry);
|
|
834
835
|
const connected = initial?.connected ? initial : undefined;
|
|
835
836
|
const pairedOffline = initial?.pairingState === "paired-offline";
|
|
836
837
|
const needsPairing = initial?.pairingState === "unpaired" || initial?.pairingState === "refused";
|
|
@@ -859,7 +860,7 @@ async function installSteps(args, tty, caller) {
|
|
|
859
860
|
return true;
|
|
860
861
|
writeFileSync(oldStoreMarker(), `2
|
|
861
862
|
`);
|
|
862
|
-
ensureRelay(
|
|
863
|
+
ensureRelay(spawnEntry);
|
|
863
864
|
log(`! Found browse ${matches[0].version} in ${matches[0].browser.name}. ${extensionProtocolAdvice(2, { install: cliCommand("install") }, "store")}`);
|
|
864
865
|
process.exitCode = 1;
|
|
865
866
|
return false;
|
|
@@ -883,7 +884,7 @@ async function installSteps(args, tty, caller) {
|
|
|
883
884
|
});
|
|
884
885
|
if (connected || found === "off" || pairedOffline)
|
|
885
886
|
return;
|
|
886
|
-
ensureRelay(
|
|
887
|
+
ensureRelay(spawnEntry);
|
|
887
888
|
let code;
|
|
888
889
|
const pairingCode = () => code && pendingPairingCodeKeys().includes(pairingCodeKey(code)) ? code : code = mintPairingCode();
|
|
889
890
|
const pairStore = (scanned) => pairStoreExtension({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import"./main-
|
|
1
|
+
import"./main-86gs8q0t.mjs";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
entrySpawnCommand,
|
|
4
4
|
installedRuntime2,
|
|
5
5
|
installedVersion
|
|
6
|
-
} from "./main-
|
|
6
|
+
} from "./main-n8m6b9y4.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-aqmppryn.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-mhpdnjcy.mjs";
|
|
8
8
|
import"./main-mrew6jy8.mjs";
|
|
9
|
-
import"./main-
|
|
10
|
-
import"./main-
|
|
9
|
+
import"./main-n8m6b9y4.mjs";
|
|
10
|
+
import"./main-86gs8q0t.mjs";
|
|
11
11
|
export {
|
|
12
12
|
createUpdateWatcher2 as createUpdateWatcher,
|
|
13
13
|
formatUpdateNotice2 as formatUpdateNotice,
|
package/package.json
CHANGED
package/dist/main-yeb6hwye.mjs
DELETED