@opencode/browse 0.0.17-dev.153 → 0.0.17-dev.155
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-m0j3qnw1.mjs → cli-zsxeh68v.mjs} +10 -10
- package/dist/cli.mjs +19 -16
- package/dist/{helpers-4g7zbsnc.mjs → helpers-9rv0va26.mjs} +1 -1
- package/dist/{main-h53t7qqd.mjs → main-5hhgehca.mjs} +1 -1
- package/dist/{main-rr7mhs8s.mjs → main-8126mrjm.mjs} +3 -3
- package/dist/{main-fy8bze4f.mjs → main-a6x41zxr.mjs} +3 -3
- package/dist/{main-dhqe5ms2.mjs → main-aqdqrj4m.mjs} +3 -3
- package/dist/{main-s60xbp7n.mjs → main-eqpe2r3r.mjs} +2 -2
- package/dist/{main-0bd10nkt.mjs → main-jtejbhfg.mjs} +2 -2
- package/dist/{main-4bf2dyps.mjs → main-kx4ygn02.mjs} +1 -1
- package/dist/main-n77bcfj8.mjs +4 -0
- package/dist/{main-zfjqvx5j.mjs → main-p31nga7a.mjs} +36 -10
- package/dist/{main-gyvm9gdn.mjs → main-ppp9k1gv.mjs} +2 -2
- package/dist/{main-q67650ha.mjs → main-qssg13bm.mjs} +2 -2
- package/dist/{mcp-d6q97s13.mjs → mcp-2wsp2xcd.mjs} +72 -10
- package/dist/{migrate-pvnmfkty.mjs → migrate-jpn1yg84.mjs} +4 -4
- package/dist/{relay-qrpmyt13.mjs → relay-ydy4dkb4.mjs} +11 -11
- package/dist/{runtime-update-eqbm0qk4.mjs → runtime-update-cbfkj6zz.mjs} +4 -4
- package/dist/{setup-68xar70w.mjs → setup-qfm0qz9f.mjs} +7 -7
- package/dist/{supervisor-w75g0agp.mjs → supervisor-kc1kng5j.mjs} +45 -5
- package/dist/{update-2vfqksb5.mjs → update-4gmwf26g.mjs} +3 -3
- package/dist/{version-1aegffmv.mjs → version-qcp1gxbs.mjs} +1 -1
- package/package.json +1 -1
- package/dist/main-90t2fp6z.mjs +0 -4
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
opencodeBrowserVersion2,
|
|
20
20
|
opencodeBrowserBuildId2
|
|
21
|
-
} from "./main-
|
|
21
|
+
} from "./main-n77bcfj8.mjs";
|
|
22
22
|
import {
|
|
23
23
|
configRoot2,
|
|
24
24
|
dataRoot,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
devExtension,
|
|
32
32
|
installCommand,
|
|
33
33
|
autoUpdateStatus
|
|
34
|
-
} from "./main-
|
|
34
|
+
} from "./main-a6x41zxr.mjs";
|
|
35
35
|
import {
|
|
36
36
|
extensionProtocolVersion,
|
|
37
37
|
extensionProtocolAdvice
|
|
@@ -57,29 +57,29 @@ import {
|
|
|
57
57
|
ensureExtensionConnected,
|
|
58
58
|
stoppedRelayStatus,
|
|
59
59
|
statusCollections
|
|
60
|
-
} from "./main-
|
|
60
|
+
} from "./main-aqdqrj4m.mjs";
|
|
61
61
|
import"./main-4h7rfhhr.mjs";
|
|
62
62
|
import {
|
|
63
63
|
updateJson2,
|
|
64
64
|
formatUpdateNotice2,
|
|
65
65
|
updateNotice2
|
|
66
|
-
} from "./main-
|
|
66
|
+
} from "./main-ppp9k1gv.mjs";
|
|
67
67
|
import {
|
|
68
68
|
settingKeys,
|
|
69
69
|
formatSettings,
|
|
70
70
|
ensureSessionExists
|
|
71
|
-
} from "./main-
|
|
71
|
+
} from "./main-eqpe2r3r.mjs";
|
|
72
72
|
import {
|
|
73
73
|
addSecret,
|
|
74
74
|
listSecrets,
|
|
75
75
|
removeSecret
|
|
76
|
-
} from "./main-
|
|
76
|
+
} from "./main-p31nga7a.mjs";
|
|
77
77
|
import {
|
|
78
78
|
defaultJournalBaseDir,
|
|
79
79
|
readJournalEntries,
|
|
80
80
|
formatJournalEntry
|
|
81
|
-
} from "./main-
|
|
82
|
-
import"./main-
|
|
81
|
+
} from "./main-jtejbhfg.mjs";
|
|
82
|
+
import"./main-5hhgehca.mjs";
|
|
83
83
|
import {
|
|
84
84
|
taggedEnum,
|
|
85
85
|
is2,
|
|
@@ -5875,7 +5875,7 @@ var status = make("status", {
|
|
|
5875
5875
|
}
|
|
5876
5876
|
})).pipe(withDescription4("Show relay, extension, and target status"));
|
|
5877
5877
|
var mcp = make("mcp", {}, fn("Cli.mcp")(function* () {
|
|
5878
|
-
const { runMcpServer } = yield* promise(() => import("./mcp-
|
|
5878
|
+
const { runMcpServer } = yield* promise(() => import("./mcp-2wsp2xcd.mjs"));
|
|
5879
5879
|
yield* runMcpServer;
|
|
5880
5880
|
})).pipe(withDescription4("Run the browse MCP server over stdio"));
|
|
5881
5881
|
registerCliCommand(400, () => tabs);
|
|
@@ -6323,7 +6323,7 @@ registerCliCommand(710, () => flightRecorder);
|
|
|
6323
6323
|
|
|
6324
6324
|
// src/cli/relay.ts
|
|
6325
6325
|
var serve = make("serve", {}, fn("Cli.serve")(function* () {
|
|
6326
|
-
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-
|
|
6326
|
+
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-ydy4dkb4.mjs"), import("./helpers-9rv0va26.mjs")]));
|
|
6327
6327
|
const port = yield* portConfig;
|
|
6328
6328
|
const additionalExtensionOrigins = parseAdditionalExtensionOrigins(yield* extensionOriginsConfig);
|
|
6329
6329
|
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.17-dev.
|
|
9
|
+
var embeddedVersion = "0.0.17-dev.155";
|
|
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,26 +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-jpn1yg84.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-qcp1gxbs.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-kc1kng5j.mjs")).supervisesMcp()) {
|
|
29
|
+
const { runBinaryMcp } = await import("./supervisor-kc1kng5j.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-7d47yfra.mjs");
|
|
33
33
|
const { defaultTeardown } = await import("./Runtime-qfc1eg1n.mjs");
|
|
34
|
-
const { runMcpServer } = await import("./mcp-
|
|
35
|
-
let
|
|
34
|
+
const { runMcpServer } = await import("./mcp-2wsp2xcd.mjs");
|
|
35
|
+
let stdinGone = false;
|
|
36
|
+
const onStdinGone = () => {
|
|
37
|
+
stdinGone = true;
|
|
38
|
+
};
|
|
39
|
+
process.stdin.once("end", onStdinGone);
|
|
40
|
+
process.stdin.once("close", onStdinGone);
|
|
41
|
+
process.stdin.once("error", onStdinGone);
|
|
36
42
|
let signalled = false;
|
|
37
|
-
process.stdin.once("end", () => {
|
|
38
|
-
stdinEnded = true;
|
|
39
|
-
});
|
|
40
43
|
const onSignal = () => {
|
|
41
44
|
signalled = true;
|
|
42
45
|
};
|
|
@@ -44,19 +47,19 @@ if (command === "--version" || command === "-v") {
|
|
|
44
47
|
process.once("SIGTERM", onSignal);
|
|
45
48
|
runMcpServer.pipe(NodeRuntime.runMain({
|
|
46
49
|
teardown: (exit, onExit) => defaultTeardown(exit, (code) => {
|
|
47
|
-
if (
|
|
50
|
+
if (stdinGone && !signalled && code === 130)
|
|
48
51
|
return process.exit(0);
|
|
49
52
|
onExit(code);
|
|
50
53
|
})
|
|
51
54
|
}));
|
|
52
55
|
} else if (command === "self-update" || command === "runtime-switch") {
|
|
53
|
-
const { runSelfUpdate, runRuntimeSwitch } = await import("./runtime-update-
|
|
56
|
+
const { runSelfUpdate, runRuntimeSwitch } = await import("./runtime-update-cbfkj6zz.mjs");
|
|
54
57
|
await (command === "self-update" ? runSelfUpdate : runRuntimeSwitch)(process.argv.slice(3));
|
|
55
58
|
} else if (command === "update" && !askedForHelp) {
|
|
56
|
-
const { runUpdateCommand } = await import("./update-
|
|
59
|
+
const { runUpdateCommand } = await import("./update-4gmwf26g.mjs");
|
|
57
60
|
await runUpdateCommand(process.argv.slice(3));
|
|
58
61
|
} else if (command && setupCommands.has(command) && !askedForHelp) {
|
|
59
|
-
const { runSetup } = await import("./setup-
|
|
62
|
+
const { runSetup } = await import("./setup-qfm0qz9f.mjs");
|
|
60
63
|
await runSetup(command, process.argv.slice(3));
|
|
61
64
|
} else {
|
|
62
65
|
if (preCliHelp || !command || command === "--help" || command === "-h") {
|
|
@@ -93,9 +96,9 @@ executable in ~/.local/bin (or $XDG_BIN_HOME).
|
|
|
93
96
|
`);
|
|
94
97
|
}
|
|
95
98
|
if (command === "status" && !askedForHelp && !process.argv.includes("--json")) {
|
|
96
|
-
const { printSetupStatus } = await import("./setup-
|
|
99
|
+
const { printSetupStatus } = await import("./setup-qfm0qz9f.mjs");
|
|
97
100
|
printSetupStatus();
|
|
98
101
|
}
|
|
99
|
-
const { runCli } = await import("./cli-
|
|
102
|
+
const { runCli } = await import("./cli-zsxeh68v.mjs");
|
|
100
103
|
runCli(preCliHelp ? ["--help"] : undefined);
|
|
101
104
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
opencodeBrowserVersion2
|
|
3
|
-
} from "./main-
|
|
3
|
+
} from "./main-n77bcfj8.mjs";
|
|
4
4
|
import {
|
|
5
5
|
configRoot2,
|
|
6
6
|
dataRoot,
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
storeUrl,
|
|
21
21
|
installedVersion,
|
|
22
22
|
runCommand
|
|
23
|
-
} from "./main-
|
|
23
|
+
} from "./main-a6x41zxr.mjs";
|
|
24
24
|
import {
|
|
25
25
|
formatPairingCode
|
|
26
|
-
} from "./main-
|
|
26
|
+
} from "./main-kx4ygn02.mjs";
|
|
27
27
|
import {
|
|
28
28
|
unpackedExtensionId
|
|
29
29
|
} from "./main-b3jrctcx.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
opencodeBrowserVersion2
|
|
3
|
-
} from "./main-
|
|
3
|
+
} from "./main-n77bcfj8.mjs";
|
|
4
4
|
|
|
5
5
|
// src/paths.ts
|
|
6
6
|
import fs from "node:fs";
|
|
@@ -110,7 +110,7 @@ function cliInstall() {
|
|
|
110
110
|
return { kind: "binary", binary: installedBinary() ?? process.execPath, pathEnv: process.env.PATH };
|
|
111
111
|
if (fromCheckout())
|
|
112
112
|
return { kind: "checkout", bundle: path.join(packageRoot(), "dist", "cli.mjs") };
|
|
113
|
-
return { kind: "npm", version: "0.0.17-dev.
|
|
113
|
+
return { kind: "npm", version: "0.0.17-dev.155", npx: /[/\\]_npx[/\\]/.test(process.argv[1] ?? "") };
|
|
114
114
|
}
|
|
115
115
|
function cliPrefix(install = cliInstall()) {
|
|
116
116
|
if (install.kind === "binary") {
|
|
@@ -132,7 +132,7 @@ function storeConfig(env = process.env, baked = { id: "mfnicocicmmlkpjnaffgihfjh
|
|
|
132
132
|
return id ? { id } : {};
|
|
133
133
|
}
|
|
134
134
|
var RELEASE_SERVICE = "https://anoma.ly/release";
|
|
135
|
-
function devExtension(baked = { file: "browse-extension-0.0.17-dev.
|
|
135
|
+
function devExtension(baked = { file: "browse-extension-0.0.17-dev.155.zip", sha256: "efa6e1bc36b17b8bb5985cf49a444beb591e1713ab0756f9b0833178c56a3170", size: 183293 }) {
|
|
136
136
|
return baked && /^[0-9a-f]{64}$/.test(baked.sha256) && /^[\w.-]+\.zip$/.test(baked.file) ? baked : undefined;
|
|
137
137
|
}
|
|
138
138
|
var devExtensionUrl = (extension, env = process.env) => `${(env.OPENCODE_BROWSER_RELEASE_SERVICE || RELEASE_SERVICE).replace(/\/+$/, "")}/browse/files/${extension.sha256}/${extension.file}`;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./main-bc8cjey0.mjs";
|
|
16
16
|
import {
|
|
17
17
|
opencodeBrowserBuildId2
|
|
18
|
-
} from "./main-
|
|
18
|
+
} from "./main-n77bcfj8.mjs";
|
|
19
19
|
import {
|
|
20
20
|
compiledBinary,
|
|
21
21
|
scriptEntry,
|
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
compareVersions,
|
|
25
25
|
installedRuntime2,
|
|
26
26
|
installedVersion
|
|
27
|
-
} from "./main-
|
|
27
|
+
} from "./main-a6x41zxr.mjs";
|
|
28
28
|
import {
|
|
29
29
|
relayAuthorization
|
|
30
|
-
} from "./main-
|
|
30
|
+
} from "./main-5hhgehca.mjs";
|
|
31
31
|
import {
|
|
32
32
|
Pointer,
|
|
33
33
|
passthrough,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
parseTargetSelection2,
|
|
13
13
|
getObject2,
|
|
14
14
|
getString2
|
|
15
|
-
} from "./main-
|
|
15
|
+
} from "./main-aqdqrj4m.mjs";
|
|
16
16
|
import {
|
|
17
17
|
isStream,
|
|
18
18
|
provideContext
|
|
@@ -103,7 +103,7 @@ import {
|
|
|
103
103
|
} from "./main-qazf3bhk.mjs";
|
|
104
104
|
import {
|
|
105
105
|
cliCommand
|
|
106
|
-
} from "./main-
|
|
106
|
+
} from "./main-a6x41zxr.mjs";
|
|
107
107
|
|
|
108
108
|
// node_modules/effect/dist/PrimaryKey.js
|
|
109
109
|
var symbol = "~effect/PrimaryKey";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./main-4h7rfhhr.mjs";
|
|
4
4
|
import {
|
|
5
5
|
isValidSessionId2
|
|
6
|
-
} from "./main-
|
|
6
|
+
} from "./main-aqdqrj4m.mjs";
|
|
7
7
|
import {
|
|
8
8
|
decodeUnknownOption,
|
|
9
9
|
optionalKey,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from "./main-xycdhwqs.mjs";
|
|
20
20
|
import {
|
|
21
21
|
stateRoot
|
|
22
|
-
} from "./main-
|
|
22
|
+
} from "./main-a6x41zxr.mjs";
|
|
23
23
|
|
|
24
24
|
// src/session-manager/journal.ts
|
|
25
25
|
import fs from "node:fs";
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
import {
|
|
53
53
|
dataRoot,
|
|
54
54
|
cliCommand
|
|
55
|
-
} from "./main-
|
|
55
|
+
} from "./main-a6x41zxr.mjs";
|
|
56
56
|
|
|
57
57
|
// node_modules/effect/dist/Semaphore.js
|
|
58
58
|
var makeUnsafe = (permits) => new SemaphoreImpl(permits);
|
|
@@ -202,6 +202,7 @@ function signalChildProcess(child, signal) {
|
|
|
202
202
|
var secretNamePattern = /auth(?:orization)?|cookie|credential|csrf|xsrf|token|secret|session|password|passwd|pwd|passcode|otp|(?:^|[-_.])code(?:$|[-_.])|(?:api|access|refresh)[-_.]?key|signature|(?:^|[-_.])sig(?:$|[-_.])/i;
|
|
203
203
|
var oneTimeFieldPattern = /pass(?:word|wd|code|phrase)|(?:^|[-_.])pwd(?:$|[-_.])|otp|totp|(?:^|[-_.])(?:mfa_?|2fa_?|verification_?|auth_?)?code(?:$|[-_.])|(?:^|[-_.])pin(?:$|[-_.])/i;
|
|
204
204
|
var referencePattern = String.raw`BC_(?:SECRET|REDACTED)_\d+`;
|
|
205
|
+
var minimumKnownSubstringLength = 8;
|
|
205
206
|
var secretHeaders = new Set([
|
|
206
207
|
"authorization",
|
|
207
208
|
"proxy-authorization",
|
|
@@ -235,6 +236,7 @@ class SecretCollector {
|
|
|
235
236
|
refsBySource = new Map;
|
|
236
237
|
retiredRefsByValue = new Map;
|
|
237
238
|
redactedRefsByValue = new Map;
|
|
239
|
+
alwaysRedacted = new Set;
|
|
238
240
|
nextRedactedRef = 1;
|
|
239
241
|
nextRef = 1;
|
|
240
242
|
updated = new Set;
|
|
@@ -249,6 +251,7 @@ class SecretCollector {
|
|
|
249
251
|
};
|
|
250
252
|
this.slotsByRef.set(copy.ref, copy);
|
|
251
253
|
this.refsByValue.set(copy.value, copy.ref);
|
|
254
|
+
this.alwaysRedacted.add(copy.value);
|
|
252
255
|
for (const source of copy.sources) {
|
|
253
256
|
this.refsBySource.set(source, copy.ref);
|
|
254
257
|
}
|
|
@@ -316,10 +319,10 @@ class SecretCollector {
|
|
|
316
319
|
return Array.from(this.observed).sort();
|
|
317
320
|
}
|
|
318
321
|
redactText(text) {
|
|
319
|
-
return
|
|
322
|
+
return redactOutputText(text, this.redactionSlots(), this.alwaysRedacted);
|
|
320
323
|
}
|
|
321
324
|
redactValue(value) {
|
|
322
|
-
return
|
|
325
|
+
return redactOutputValue(value, this.redactionSlots(), this.alwaysRedacted);
|
|
323
326
|
}
|
|
324
327
|
redactExactValue(value, minimumLength) {
|
|
325
328
|
if (!isString(value) && !isNumber(value) && !isBoolean(value))
|
|
@@ -346,8 +349,10 @@ class SecretCollector {
|
|
|
346
349
|
];
|
|
347
350
|
}
|
|
348
351
|
addRedactionOnly(value) {
|
|
349
|
-
if (value)
|
|
352
|
+
if (value) {
|
|
353
|
+
this.alwaysRedacted.add(value);
|
|
350
354
|
this.redactionReference(value);
|
|
355
|
+
}
|
|
351
356
|
}
|
|
352
357
|
redactValuesEverywhere(text, values) {
|
|
353
358
|
const slots = [];
|
|
@@ -477,8 +482,10 @@ class SecretCollector {
|
|
|
477
482
|
return parts.join(delimiter);
|
|
478
483
|
}
|
|
479
484
|
reference(value, source) {
|
|
480
|
-
if (oneTimeFieldPattern.test(sourceFieldName(source)))
|
|
485
|
+
if (oneTimeFieldPattern.test(sourceFieldName(source))) {
|
|
486
|
+
this.alwaysRedacted.add(value);
|
|
481
487
|
return this.redactionReference(value);
|
|
488
|
+
}
|
|
482
489
|
const sourceRef = this.refsBySource.get(source);
|
|
483
490
|
if (sourceRef) {
|
|
484
491
|
const slot = this.slotsByRef.get(sourceRef);
|
|
@@ -632,20 +639,39 @@ function sourceName(requestScope, location, occurrence = 0) {
|
|
|
632
639
|
function redactKnownValues(text, slots) {
|
|
633
640
|
return [...slots].sort((left, right) => right.value.length - left.value.length).reduce((output, slot) => replaceOutsideReferences(output, slot.value, `\${${slot.ref}}`), text);
|
|
634
641
|
}
|
|
635
|
-
function
|
|
642
|
+
function redactOutputText(text, slots, alwaysRedacted) {
|
|
643
|
+
return outputStringRedactor(slots, alwaysRedacted)(text);
|
|
644
|
+
}
|
|
645
|
+
function redactOutputValue(value, slots, alwaysRedacted) {
|
|
646
|
+
return redactValueWith(value, slots, outputStringRedactor(slots, alwaysRedacted));
|
|
647
|
+
}
|
|
648
|
+
function outputStringRedactor(slots, alwaysRedacted) {
|
|
649
|
+
const exact = new Map;
|
|
650
|
+
for (const slot of slots) {
|
|
651
|
+
if (slot.value && !exact.has(slot.value))
|
|
652
|
+
exact.set(slot.value, slot);
|
|
653
|
+
}
|
|
654
|
+
const referenceText = new RegExp(String.raw`^\$\{${referencePattern}\}$`);
|
|
655
|
+
const substringSlots = slots.filter((slot) => slot.value.length >= minimumKnownSubstringLength || alwaysRedacted.has(slot.value));
|
|
656
|
+
return (text) => {
|
|
657
|
+
const match = text && !referenceText.test(text) ? exact.get(text) : undefined;
|
|
658
|
+
return match ? `\${${match.ref}}` : redactKnownValues(text, substringSlots);
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function redactValueWith(value, slots, redactString) {
|
|
636
662
|
if (isString(value))
|
|
637
|
-
return
|
|
663
|
+
return redactString(value);
|
|
638
664
|
if (isNumber(value) || isBoolean(value)) {
|
|
639
665
|
const slot = slots.find((candidate) => candidate.value === String(value));
|
|
640
666
|
return slot ? `\${${slot.ref}}` : value;
|
|
641
667
|
}
|
|
642
668
|
if (Array.isArray(value))
|
|
643
|
-
return value.map((item) =>
|
|
669
|
+
return value.map((item) => redactValueWith(item, slots, redactString));
|
|
644
670
|
if (!isObject(value))
|
|
645
671
|
return value;
|
|
646
672
|
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
647
673
|
key,
|
|
648
|
-
secretNamePattern.test(key) ? redactSecretValue(item) :
|
|
674
|
+
secretNamePattern.test(key) ? redactSecretValue(item) : redactValueWith(item, slots, redactString)
|
|
649
675
|
]));
|
|
650
676
|
}
|
|
651
677
|
function redactSecretValue(value) {
|
|
@@ -1297,4 +1323,4 @@ function secretText(secret) {
|
|
|
1297
1323
|
return secret.kind === "totp" ? totpCode(secret.value) : secret.value;
|
|
1298
1324
|
}
|
|
1299
1325
|
|
|
1300
|
-
export { makeUnsafe, make3, terminateChildProcess, SecretCollector, looksLikeTokenSegment, AuthProfileError, read, readOptional, withLock, write, status, run, OriginPatternError, parseOriginPatterns, normalizeOriginPatterns, isPrivateAddress, explicitlyAllowsHost, checkUrl, checkNavigationUrl, defaultSiteSecretsDir, readSecret, addSecret, listSecrets, removeSecret, secretText };
|
|
1326
|
+
export { makeUnsafe, make3, terminateChildProcess, minimumKnownSubstringLength, SecretCollector, looksLikeTokenSegment, AuthProfileError, read, readOptional, withLock, write, status, run, OriginPatternError, parseOriginPatterns, normalizeOriginPatterns, isPrivateAddress, explicitlyAllowsHost, checkUrl, checkNavigationUrl, defaultSiteSecretsDir, readSecret, addSecret, listSecrets, removeSecret, secretText };
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
installedRuntime2,
|
|
7
7
|
autoUpdateStatus,
|
|
8
8
|
updateAvailable
|
|
9
|
-
} from "./main-
|
|
9
|
+
} from "./main-a6x41zxr.mjs";
|
|
10
10
|
import {
|
|
11
11
|
unpackedReloadAdvice
|
|
12
12
|
} from "./main-b3jrctcx.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-cbfkj6zz.mjs");
|
|
319
319
|
if (await runInstalledUpdate(args))
|
|
320
320
|
return;
|
|
321
321
|
if (compiledBinary()) {
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
bundledPairingCodeTtlMs,
|
|
6
6
|
mintPairingCode,
|
|
7
7
|
writeExtensionPairing
|
|
8
|
-
} from "./main-
|
|
8
|
+
} from "./main-kx4ygn02.mjs";
|
|
9
9
|
import {
|
|
10
10
|
configRoot2,
|
|
11
11
|
cacheRoot,
|
|
12
12
|
devExtensionUrl,
|
|
13
13
|
devExtensionFolder
|
|
14
|
-
} from "./main-
|
|
14
|
+
} from "./main-a6x41zxr.mjs";
|
|
15
15
|
|
|
16
16
|
// src/setup/dev-extension.ts
|
|
17
17
|
import { createHash } from "node:crypto";
|
|
@@ -45,11 +45,11 @@ import {
|
|
|
45
45
|
} from "./main-bc8cjey0.mjs";
|
|
46
46
|
import {
|
|
47
47
|
opencodeBrowserVersion2
|
|
48
|
-
} from "./main-
|
|
48
|
+
} from "./main-n77bcfj8.mjs";
|
|
49
49
|
import {
|
|
50
50
|
cliCommand,
|
|
51
51
|
autoUpdateStatus
|
|
52
|
-
} from "./main-
|
|
52
|
+
} from "./main-a6x41zxr.mjs";
|
|
53
53
|
import"./main-b3jrctcx.mjs";
|
|
54
54
|
import {
|
|
55
55
|
option,
|
|
@@ -69,12 +69,12 @@ import {
|
|
|
69
69
|
relayBuildProblem,
|
|
70
70
|
ensureRelay,
|
|
71
71
|
ensureExtensionConnected
|
|
72
|
-
} from "./main-
|
|
72
|
+
} from "./main-aqdqrj4m.mjs";
|
|
73
73
|
import"./main-4h7rfhhr.mjs";
|
|
74
74
|
import {
|
|
75
75
|
updateJson2,
|
|
76
76
|
createUpdateWatcher2
|
|
77
|
-
} from "./main-
|
|
77
|
+
} from "./main-ppp9k1gv.mjs";
|
|
78
78
|
import {
|
|
79
79
|
settingSpecs,
|
|
80
80
|
securityVariables,
|
|
@@ -155,12 +155,12 @@ import {
|
|
|
155
155
|
toolResultForValue2,
|
|
156
156
|
mcpErrorMessage2,
|
|
157
157
|
toolResult
|
|
158
|
-
} from "./main-
|
|
158
|
+
} from "./main-eqpe2r3r.mjs";
|
|
159
159
|
import {
|
|
160
160
|
makeUnsafe,
|
|
161
161
|
make3,
|
|
162
162
|
listSecrets
|
|
163
|
-
} from "./main-
|
|
163
|
+
} from "./main-p31nga7a.mjs";
|
|
164
164
|
import {
|
|
165
165
|
Clock,
|
|
166
166
|
type,
|
|
@@ -175,7 +175,7 @@ import {
|
|
|
175
175
|
orElse,
|
|
176
176
|
exhaustive
|
|
177
177
|
} from "./main-4074weqb.mjs";
|
|
178
|
-
import"./main-
|
|
178
|
+
import"./main-5hhgehca.mjs";
|
|
179
179
|
import {
|
|
180
180
|
Class,
|
|
181
181
|
taggedEnum,
|
|
@@ -353,7 +353,9 @@ import {
|
|
|
353
353
|
ignore,
|
|
354
354
|
ignoreCause,
|
|
355
355
|
timeout,
|
|
356
|
+
sleep,
|
|
356
357
|
race,
|
|
358
|
+
raceFirst,
|
|
357
359
|
when2,
|
|
358
360
|
match4,
|
|
359
361
|
matchCauseEffect,
|
|
@@ -367,6 +369,7 @@ import {
|
|
|
367
369
|
scope,
|
|
368
370
|
scoped,
|
|
369
371
|
acquireRelease,
|
|
372
|
+
acquireUseRelease,
|
|
370
373
|
ensuring,
|
|
371
374
|
onError,
|
|
372
375
|
onExit,
|
|
@@ -9570,6 +9573,33 @@ registerMcpTools({
|
|
|
9570
9573
|
|
|
9571
9574
|
// src/mcp.ts
|
|
9572
9575
|
var packageRoot = path4.dirname(path4.dirname(fileURLToPath(import.meta.url)));
|
|
9576
|
+
var toolCalls = {
|
|
9577
|
+
running: 0,
|
|
9578
|
+
idle: []
|
|
9579
|
+
};
|
|
9580
|
+
var toolCallsIdle = callback2((resume) => {
|
|
9581
|
+
if (toolCalls.running === 0) {
|
|
9582
|
+
resume(void_3);
|
|
9583
|
+
return void_3;
|
|
9584
|
+
}
|
|
9585
|
+
const wake = () => resume(void_3);
|
|
9586
|
+
toolCalls.idle.push(wake);
|
|
9587
|
+
return sync2(() => {
|
|
9588
|
+
const index = toolCalls.idle.indexOf(wake);
|
|
9589
|
+
if (index !== -1)
|
|
9590
|
+
toolCalls.idle.splice(index, 1);
|
|
9591
|
+
});
|
|
9592
|
+
});
|
|
9593
|
+
var toolCallStarted = () => {
|
|
9594
|
+
toolCalls.running++;
|
|
9595
|
+
};
|
|
9596
|
+
var toolCallFinished = () => {
|
|
9597
|
+
toolCalls.running--;
|
|
9598
|
+
if (toolCalls.running > 0)
|
|
9599
|
+
return;
|
|
9600
|
+
for (const wake of toolCalls.idle.splice(0))
|
|
9601
|
+
wake();
|
|
9602
|
+
};
|
|
9573
9603
|
var mcpInstructions = `browse drives the user's real Chrome-family browser through the browse extension, so logins, extensions and open tabs are already there and the user can watch or take over. \`execute\` runs Playwright JavaScript on a session's page; the session tools manage named tabs.
|
|
9574
9604
|
|
|
9575
9605
|
Use one loop: inspect, act, verify.
|
|
@@ -9636,10 +9666,10 @@ var registerTools = gen(function* () {
|
|
|
9636
9666
|
handle: (payload) => {
|
|
9637
9667
|
const requiresRelay = typeof spec.requiresRelayCompatibility === "function" ? spec.requiresRelayCompatibility(payload) : spec.requiresRelayCompatibility !== false;
|
|
9638
9668
|
const operation = requiresRelay ? ensureRelay({ relay }).pipe(flatMap3((readiness) => readiness.buildProblem ? fail6(new Error(readiness.buildProblem)) : spec.handle(payload))) : spec.handle(payload);
|
|
9639
|
-
return operation.pipe(match4({
|
|
9669
|
+
return acquireUseRelease(sync2(toolCallStarted), () => operation.pipe(match4({
|
|
9640
9670
|
onFailure: (error) => toolResult({ text: mcpErrorMessage2(spec.name, error.message), isError: true }),
|
|
9641
9671
|
onSuccess: (value) => spec.result ? spec.result(value) : toolResultForValue2(value, spec.outputSchema ? { outputSchema: spec.outputSchema } : {})
|
|
9642
|
-
}), flatMap3((result) => ctx.caller.pipe(map5((caller) => withUpdateNote(caller, spec.name, result)))));
|
|
9672
|
+
}), flatMap3((result) => ctx.caller.pipe(map5((caller) => withUpdateNote(caller, spec.name, result))))), () => sync2(toolCallFinished));
|
|
9643
9673
|
}
|
|
9644
9674
|
});
|
|
9645
9675
|
yield* forEach(buildRegisteredMcpTools(ctx), register, { discard: true });
|
|
@@ -9651,7 +9681,39 @@ var mcpServerLayer = layerStdio({
|
|
|
9651
9681
|
protocols: [v2026_07_28, v2025_11_252, v2025_06_182, v2025_03_262, v2024_11_052]
|
|
9652
9682
|
});
|
|
9653
9683
|
var mcpToolsLayer = effectDiscard(registerTools);
|
|
9654
|
-
var
|
|
9684
|
+
var toolCallWaitMs = 30000;
|
|
9685
|
+
var answerFlushMs = 150;
|
|
9686
|
+
var finishToolCalls = gen(function* () {
|
|
9687
|
+
const deadline = Date.now() + toolCallWaitMs;
|
|
9688
|
+
while (true) {
|
|
9689
|
+
const remaining = Math.max(0, deadline - Date.now());
|
|
9690
|
+
if (toolCalls.running > 0) {
|
|
9691
|
+
if (remaining === 0)
|
|
9692
|
+
return;
|
|
9693
|
+
yield* raceFirst(toolCallsIdle, sleep(remaining));
|
|
9694
|
+
continue;
|
|
9695
|
+
}
|
|
9696
|
+
yield* sleep(answerFlushMs);
|
|
9697
|
+
if (toolCalls.running === 0)
|
|
9698
|
+
return;
|
|
9699
|
+
}
|
|
9700
|
+
});
|
|
9701
|
+
var stdinClosed = callback2((resume) => {
|
|
9702
|
+
if (process.stdin.readableEnded || process.stdin.destroyed) {
|
|
9703
|
+
resume(void_3);
|
|
9704
|
+
return void_3;
|
|
9705
|
+
}
|
|
9706
|
+
const closed = () => resume(void_3);
|
|
9707
|
+
process.stdin.once("end", closed);
|
|
9708
|
+
process.stdin.once("close", closed);
|
|
9709
|
+
process.stdin.once("error", closed);
|
|
9710
|
+
return sync2(() => {
|
|
9711
|
+
process.stdin.off("end", closed);
|
|
9712
|
+
process.stdin.off("close", closed);
|
|
9713
|
+
process.stdin.off("error", closed);
|
|
9714
|
+
});
|
|
9715
|
+
});
|
|
9716
|
+
var runMcpServer = launch(mcpServerLayer.pipe(provide2(mcpToolsLayer.pipe(provide2(McpServer.layer))), provide2(layer), provide2(layerFetchMcp))).pipe(raceFirst(stdinClosed.pipe(andThen2(finishToolCalls), andThen2(interrupt3))));
|
|
9655
9717
|
export {
|
|
9656
9718
|
mcpErrorMessage2 as mcpErrorMessage,
|
|
9657
9719
|
mcpInstructions,
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
browseServerCommand,
|
|
7
7
|
editAgentConfig,
|
|
8
8
|
configureMcp
|
|
9
|
-
} from "./main-
|
|
10
|
-
import"./main-
|
|
9
|
+
} from "./main-8126mrjm.mjs";
|
|
10
|
+
import"./main-n77bcfj8.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-a6x41zxr.mjs";
|
|
19
19
|
import"./main-4h7rfhhr.mjs";
|
|
20
|
-
import"./main-
|
|
20
|
+
import"./main-kx4ygn02.mjs";
|
|
21
21
|
import"./main-b3jrctcx.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-n77bcfj8.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-a6x41zxr.mjs";
|
|
29
29
|
import {
|
|
30
30
|
extensionProtocolVersion,
|
|
31
31
|
minExtensionProtocolVersion,
|
|
@@ -102,7 +102,7 @@ import {
|
|
|
102
102
|
isRestrictedTarget2,
|
|
103
103
|
isRestrictedUrl2,
|
|
104
104
|
dataUrlDocument2
|
|
105
|
-
} from "./main-
|
|
105
|
+
} from "./main-aqdqrj4m.mjs";
|
|
106
106
|
import {
|
|
107
107
|
context,
|
|
108
108
|
pendingPairingCodeKeys,
|
|
@@ -120,10 +120,11 @@ import {
|
|
|
120
120
|
pairingSessionKey,
|
|
121
121
|
sessionProof,
|
|
122
122
|
wrapToken
|
|
123
|
-
} from "./main-
|
|
123
|
+
} from "./main-kx4ygn02.mjs";
|
|
124
124
|
import {
|
|
125
125
|
makeUnsafe,
|
|
126
126
|
terminateChildProcess,
|
|
127
|
+
minimumKnownSubstringLength,
|
|
127
128
|
SecretCollector,
|
|
128
129
|
looksLikeTokenSegment,
|
|
129
130
|
AuthProfileError,
|
|
@@ -142,16 +143,16 @@ import {
|
|
|
142
143
|
checkNavigationUrl,
|
|
143
144
|
readSecret,
|
|
144
145
|
secretText
|
|
145
|
-
} from "./main-
|
|
146
|
+
} from "./main-p31nga7a.mjs";
|
|
146
147
|
import {
|
|
147
148
|
defaultJournalBaseDir,
|
|
148
149
|
makeJournalEntry,
|
|
149
150
|
appendJournalEntry,
|
|
150
151
|
startJournalRetention
|
|
151
|
-
} from "./main-
|
|
152
|
+
} from "./main-jtejbhfg.mjs";
|
|
152
153
|
import {
|
|
153
154
|
createUpdateWatcher2
|
|
154
|
-
} from "./main-
|
|
155
|
+
} from "./main-ppp9k1gv.mjs";
|
|
155
156
|
import {
|
|
156
157
|
SettingsInputError,
|
|
157
158
|
parseSettingChanges,
|
|
@@ -159,13 +160,13 @@ import {
|
|
|
159
160
|
settingsToExtension,
|
|
160
161
|
describeSettings,
|
|
161
162
|
describeChanges
|
|
162
|
-
} from "./main-
|
|
163
|
+
} from "./main-eqpe2r3r.mjs";
|
|
163
164
|
import {
|
|
164
165
|
relayHostname,
|
|
165
166
|
isLocalPeer,
|
|
166
167
|
installedDevExtension,
|
|
167
168
|
syncDevExtension
|
|
168
|
-
} from "./main-
|
|
169
|
+
} from "./main-qssg13bm.mjs";
|
|
169
170
|
import {
|
|
170
171
|
legacyRoots
|
|
171
172
|
} from "./main-ckssvk4c.mjs";
|
|
@@ -186,7 +187,7 @@ import {
|
|
|
186
187
|
relayToken,
|
|
187
188
|
secretsEqual,
|
|
188
189
|
ensurePrivateDirectory
|
|
189
|
-
} from "./main-
|
|
190
|
+
} from "./main-5hhgehca.mjs";
|
|
190
191
|
import {
|
|
191
192
|
taggedEnum,
|
|
192
193
|
is2,
|
|
@@ -10253,7 +10254,6 @@ function protectCapturedBody(body, collector, location, scope) {
|
|
|
10253
10254
|
const text = collector.protectBody(body.text, body.mimeType, location, scope);
|
|
10254
10255
|
return text === undefined ? { size: body.size, mimeType: body.mimeType, truncated: true } : { ...body, text };
|
|
10255
10256
|
}
|
|
10256
|
-
var minimumKnownSubstringLength = 8;
|
|
10257
10257
|
var minimumKnownBodySubstringLength = 16;
|
|
10258
10258
|
function redactEntryKnownValues(entry, collector) {
|
|
10259
10259
|
const redactText = (text) => collector.redactKnownSubstrings(text, minimumKnownSubstringLength);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import"./main-9bk4pprj.mjs";
|
|
2
|
-
import"./main-
|
|
2
|
+
import"./main-n77bcfj8.mjs";
|
|
3
3
|
import {
|
|
4
4
|
cliCommand,
|
|
5
5
|
installCommand,
|
|
@@ -16,17 +16,17 @@ import {
|
|
|
16
16
|
registryUrl,
|
|
17
17
|
fetchPublished,
|
|
18
18
|
runInstaller
|
|
19
|
-
} from "./main-
|
|
19
|
+
} from "./main-a6x41zxr.mjs";
|
|
20
20
|
import"./main-b3jrctcx.mjs";
|
|
21
21
|
import {
|
|
22
22
|
Service,
|
|
23
23
|
layerFetch,
|
|
24
24
|
restartRelay,
|
|
25
25
|
startManagedRelay
|
|
26
|
-
} from "./main-
|
|
26
|
+
} from "./main-aqdqrj4m.mjs";
|
|
27
27
|
import"./main-4h7rfhhr.mjs";
|
|
28
28
|
import"./main-bc8cjey0.mjs";
|
|
29
|
-
import"./main-
|
|
29
|
+
import"./main-5hhgehca.mjs";
|
|
30
30
|
import {
|
|
31
31
|
succeed6,
|
|
32
32
|
gen,
|
|
@@ -63,10 +63,10 @@ import {
|
|
|
63
63
|
installRuntime,
|
|
64
64
|
installedRuntime,
|
|
65
65
|
manualMcpEntry
|
|
66
|
-
} from "./main-
|
|
66
|
+
} from "./main-8126mrjm.mjs";
|
|
67
67
|
import {
|
|
68
68
|
opencodeBrowserBuildId2
|
|
69
|
-
} from "./main-
|
|
69
|
+
} from "./main-n77bcfj8.mjs";
|
|
70
70
|
import {
|
|
71
71
|
installedBinaryPath,
|
|
72
72
|
installerBinaryPath,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
autoUpdateStatus,
|
|
84
84
|
describeAutoUpdate,
|
|
85
85
|
runCommand
|
|
86
|
-
} from "./main-
|
|
86
|
+
} from "./main-a6x41zxr.mjs";
|
|
87
87
|
import"./main-4h7rfhhr.mjs";
|
|
88
88
|
import {
|
|
89
89
|
pairingCodeTtlMs,
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
revokeBrowserToken,
|
|
98
98
|
legacyPairingCode,
|
|
99
99
|
removeLegacyPairingCode
|
|
100
|
-
} from "./main-
|
|
100
|
+
} from "./main-kx4ygn02.mjs";
|
|
101
101
|
import {
|
|
102
102
|
unpackedExtensionId,
|
|
103
103
|
extensionProtocolSkew,
|
|
@@ -105,16 +105,16 @@ import {
|
|
|
105
105
|
} from "./main-b3jrctcx.mjs";
|
|
106
106
|
import {
|
|
107
107
|
defaultSiteSecretsDir
|
|
108
|
-
} from "./main-
|
|
108
|
+
} from "./main-p31nga7a.mjs";
|
|
109
109
|
import {
|
|
110
110
|
parseHostname,
|
|
111
111
|
readRelayConfig,
|
|
112
112
|
writeRelayConfig,
|
|
113
113
|
syncDevExtension
|
|
114
|
-
} from "./main-
|
|
114
|
+
} from "./main-qssg13bm.mjs";
|
|
115
115
|
import {
|
|
116
116
|
relayAuthorization
|
|
117
|
-
} from "./main-
|
|
117
|
+
} from "./main-5hhgehca.mjs";
|
|
118
118
|
|
|
119
119
|
// src/setup.ts
|
|
120
120
|
import { mkdirSync as mkdirSync2, rmSync as rmSync2, writeFileSync } from "node:fs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import"./main-
|
|
1
|
+
import"./main-n77bcfj8.mjs";
|
|
2
2
|
import {
|
|
3
3
|
entrySpawnCommand,
|
|
4
4
|
installedRuntime2,
|
|
5
5
|
installedVersion
|
|
6
|
-
} from "./main-
|
|
6
|
+
} from "./main-a6x41zxr.mjs";
|
|
7
7
|
|
|
8
8
|
// src/mcp/supervisor.ts
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
@@ -34,7 +34,7 @@ async function runBinaryMcp(args) {
|
|
|
34
34
|
const runtime = installedRuntime2();
|
|
35
35
|
if (!runtime || runtime.kind === "npx") {
|
|
36
36
|
process.env[directEnvironmentVariable] = "1";
|
|
37
|
-
const { runCli } = await import("./cli-
|
|
37
|
+
const { runCli } = await import("./cli-zsxeh68v.mjs");
|
|
38
38
|
return runCli();
|
|
39
39
|
}
|
|
40
40
|
const REPLAY = `opencode-browser-shim-initialize-${randomUUID()}`;
|
|
@@ -45,6 +45,7 @@ async function runBinaryMcp(args) {
|
|
|
45
45
|
process.env.OPENCODE_BROWSER_CLIENT_PID = String(process.pid);
|
|
46
46
|
let version = current();
|
|
47
47
|
let child;
|
|
48
|
+
const servers = new Set;
|
|
48
49
|
let initialize;
|
|
49
50
|
let initialized;
|
|
50
51
|
let swapping = false;
|
|
@@ -57,11 +58,44 @@ async function runBinaryMcp(args) {
|
|
|
57
58
|
const toChild = (line) => child.stdin.write(line + `
|
|
58
59
|
`);
|
|
59
60
|
let finishing = false;
|
|
61
|
+
const exit = (code, flush) => {
|
|
62
|
+
finishing = true;
|
|
63
|
+
if (!flush)
|
|
64
|
+
return process.exit(code);
|
|
65
|
+
process.stdout.write("", () => process.exit(code));
|
|
66
|
+
};
|
|
60
67
|
const finish = (code) => {
|
|
61
68
|
if (finishing)
|
|
62
69
|
return;
|
|
70
|
+
for (const running of servers)
|
|
71
|
+
running.kill();
|
|
72
|
+
exit(code, true);
|
|
73
|
+
};
|
|
74
|
+
let stopping;
|
|
75
|
+
let stopDeadline;
|
|
76
|
+
let leaving = false;
|
|
77
|
+
const stopped = () => {
|
|
78
|
+
if (!stopping || leaving)
|
|
79
|
+
return;
|
|
80
|
+
leaving = true;
|
|
81
|
+
clearTimeout(stopDeadline);
|
|
82
|
+
exit(stopping.code, stopping.flush);
|
|
83
|
+
};
|
|
84
|
+
const stop = (code, flush, force = false) => {
|
|
85
|
+
if (stopping || finishing && !force)
|
|
86
|
+
return;
|
|
87
|
+
stopping = { code, flush };
|
|
63
88
|
finishing = true;
|
|
64
|
-
|
|
89
|
+
for (const running of servers)
|
|
90
|
+
running.kill();
|
|
91
|
+
if (servers.size === 0)
|
|
92
|
+
return stopped();
|
|
93
|
+
stopDeadline = setTimeout(() => {
|
|
94
|
+
for (const running of servers)
|
|
95
|
+
running.kill("SIGKILL");
|
|
96
|
+
stopped();
|
|
97
|
+
}, 2000);
|
|
98
|
+
stopDeadline.unref();
|
|
65
99
|
};
|
|
66
100
|
const parse = (line) => {
|
|
67
101
|
try {
|
|
@@ -94,6 +128,7 @@ async function runBinaryMcp(args) {
|
|
|
94
128
|
const [file, ...prefix] = entrySpawnCommand(command());
|
|
95
129
|
const next = spawn(file, [...prefix, "mcp", ...args], { stdio: ["pipe", "pipe", "inherit"], env: { ...process.env, [directEnvironmentVariable]: "1" }, windowsHide: true });
|
|
96
130
|
next.stdin.on("error", () => {});
|
|
131
|
+
servers.add(next);
|
|
97
132
|
child = next;
|
|
98
133
|
let linesDone = false;
|
|
99
134
|
let exited;
|
|
@@ -103,8 +138,11 @@ async function runBinaryMcp(args) {
|
|
|
103
138
|
finish(exited.code ?? (exited.signal ? 1 : 0));
|
|
104
139
|
};
|
|
105
140
|
next.on("close", (code, signal) => {
|
|
141
|
+
servers.delete(next);
|
|
106
142
|
exited = { code, signal };
|
|
107
143
|
finishChild();
|
|
144
|
+
if (stopping && servers.size === 0)
|
|
145
|
+
stopped();
|
|
108
146
|
});
|
|
109
147
|
const reader = createInterface({ input: next.stdout });
|
|
110
148
|
reader.on("close", () => {
|
|
@@ -208,8 +246,10 @@ async function runBinaryMcp(args) {
|
|
|
208
246
|
start(false);
|
|
209
247
|
createInterface({ input: process.stdin }).on("line", fromClient).on("close", () => {
|
|
210
248
|
child.stdin.end();
|
|
211
|
-
setTimeout(() =>
|
|
249
|
+
setTimeout(() => stop(0, true), 5000).unref();
|
|
212
250
|
});
|
|
251
|
+
process.on("SIGINT", () => stop(130, false, true));
|
|
252
|
+
process.on("SIGTERM", () => stop(143, false, true));
|
|
213
253
|
setInterval(() => void maybeSwap(), 1000).unref();
|
|
214
254
|
}
|
|
215
255
|
function supervisesMcp() {
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
updateNotice2,
|
|
5
5
|
createUpdateWatcher2,
|
|
6
6
|
runUpdateCommand2
|
|
7
|
-
} from "./main-
|
|
7
|
+
} from "./main-ppp9k1gv.mjs";
|
|
8
8
|
import"./main-b3jrctcx.mjs";
|
|
9
|
-
import"./main-
|
|
10
|
-
import"./main-
|
|
9
|
+
import"./main-a6x41zxr.mjs";
|
|
10
|
+
import"./main-n77bcfj8.mjs";
|
|
11
11
|
export {
|
|
12
12
|
createUpdateWatcher2 as createUpdateWatcher,
|
|
13
13
|
formatUpdateNotice2 as formatUpdateNotice,
|
package/package.json
CHANGED
package/dist/main-90t2fp6z.mjs
DELETED