@opencode/browse 0.0.11-dev.72 → 0.0.11-dev.73
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-w445s77h.mjs → cli-pqwk0593.mjs} +9 -9
- package/dist/cli.mjs +9 -9
- package/dist/{helpers-spk1cnxw.mjs → helpers-w2qyckdd.mjs} +2 -2
- package/dist/{main-dfac31gt.mjs → main-2v53xfxr.mjs} +1 -1
- package/dist/{main-c03yxxa5.mjs → main-5fwb3tjm.mjs} +3 -3
- package/dist/{main-g606v7zz.mjs → main-6nwq3ezr.mjs} +2 -2
- package/dist/{main-yz931fa0.mjs → main-gcmshzpr.mjs} +3 -3
- package/dist/{main-jfw7tc5g.mjs → main-mkt65nqy.mjs} +2 -2
- package/dist/{main-gz443nq8.mjs → main-rm734baq.mjs} +26 -15
- package/dist/{main-psy10am0.mjs → main-rnc3f5wr.mjs} +3 -3
- package/dist/main-wyynrqg7.mjs +4 -0
- package/dist/{mcp-qw645sjd.mjs → mcp-6d2jsged.mjs} +6 -6
- package/dist/{relay-pysa3c90.mjs → relay-f035x14b.mjs} +57 -27
- package/dist/{runtime-update-kyd27gdx.mjs → runtime-update-5p996ppb.mjs} +4 -4
- package/dist/{setup-p20qjea1.mjs → setup-ckx80s7r.mjs} +5 -5
- package/dist/{supervisor-68nzaabf.mjs → supervisor-rt8fh19g.mjs} +31 -19
- package/dist/{update-4a7wp8tc.mjs → update-7gcjgsnj.mjs} +3 -3
- package/dist/{version-zy6f2nw4.mjs → version-4jkmgcvm.mjs} +1 -1
- package/package.json +1 -1
- package/dist/main-4qy2q686.mjs +0 -4
|
@@ -105,7 +105,7 @@ import {
|
|
|
105
105
|
import {
|
|
106
106
|
opencodeBrowserVersion2,
|
|
107
107
|
opencodeBrowserBuildId2
|
|
108
|
-
} from "./main-
|
|
108
|
+
} from "./main-wyynrqg7.mjs";
|
|
109
109
|
import {
|
|
110
110
|
dataRoot,
|
|
111
111
|
fromCheckout,
|
|
@@ -115,7 +115,7 @@ import {
|
|
|
115
115
|
devExtension,
|
|
116
116
|
installCommand,
|
|
117
117
|
autoUpdateStatus
|
|
118
|
-
} from "./main-
|
|
118
|
+
} from "./main-rm734baq.mjs";
|
|
119
119
|
import {
|
|
120
120
|
extensionProtocolVersion,
|
|
121
121
|
extensionProtocolAdvice
|
|
@@ -141,13 +141,13 @@ import {
|
|
|
141
141
|
ensureExtensionConnected,
|
|
142
142
|
stoppedRelayStatus,
|
|
143
143
|
statusCollections
|
|
144
|
-
} from "./main-
|
|
145
|
-
import"./main-
|
|
144
|
+
} from "./main-gcmshzpr.mjs";
|
|
145
|
+
import"./main-2v53xfxr.mjs";
|
|
146
146
|
import {
|
|
147
147
|
updateJson2,
|
|
148
148
|
formatUpdateNotice2,
|
|
149
149
|
updateNotice2
|
|
150
|
-
} from "./main-
|
|
150
|
+
} from "./main-mkt65nqy.mjs";
|
|
151
151
|
import {
|
|
152
152
|
settingKeys,
|
|
153
153
|
formatSettings,
|
|
@@ -155,12 +155,12 @@ import {
|
|
|
155
155
|
addSecret,
|
|
156
156
|
listSecrets,
|
|
157
157
|
removeSecret
|
|
158
|
-
} from "./main-
|
|
158
|
+
} from "./main-rnc3f5wr.mjs";
|
|
159
159
|
import {
|
|
160
160
|
defaultJournalBaseDir,
|
|
161
161
|
readJournalEntries,
|
|
162
162
|
formatJournalEntry
|
|
163
|
-
} from "./main-
|
|
163
|
+
} from "./main-5fwb3tjm.mjs";
|
|
164
164
|
import {
|
|
165
165
|
pipeArguments,
|
|
166
166
|
dual,
|
|
@@ -5856,7 +5856,7 @@ var status = make("status", {
|
|
|
5856
5856
|
}
|
|
5857
5857
|
})).pipe(withDescription4("Show relay, extension, and target status"));
|
|
5858
5858
|
var mcp = make("mcp", {}, fn("Cli.mcp")(function* () {
|
|
5859
|
-
const { runMcpServer } = yield* promise(() => import("./mcp-
|
|
5859
|
+
const { runMcpServer } = yield* promise(() => import("./mcp-6d2jsged.mjs"));
|
|
5860
5860
|
yield* runMcpServer;
|
|
5861
5861
|
})).pipe(withDescription4("Run the browse MCP server over stdio"));
|
|
5862
5862
|
registerCliCommand(400, () => tabs);
|
|
@@ -6304,7 +6304,7 @@ registerCliCommand(710, () => flightRecorder);
|
|
|
6304
6304
|
|
|
6305
6305
|
// src/cli/relay.ts
|
|
6306
6306
|
var serve = make("serve", {}, fn("Cli.serve")(function* () {
|
|
6307
|
-
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-
|
|
6307
|
+
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-f035x14b.mjs"), import("./helpers-w2qyckdd.mjs")]));
|
|
6308
6308
|
const port = yield* portConfig;
|
|
6309
6309
|
const additionalExtensionOrigins = parseAdditionalExtensionOrigins(yield* extensionOriginsConfig);
|
|
6310
6310
|
yield* scoped(gen(function* () {
|
package/dist/cli.mjs
CHANGED
|
@@ -2,29 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
// src/main.ts
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
var embeddedVersion = "0.0.11-dev.
|
|
5
|
+
var embeddedVersion = "0.0.11-dev.73";
|
|
6
6
|
var setupCommands = new Set(["install", "uninstall", "extension", "pair", "rollback", "set"]);
|
|
7
7
|
var command = process.argv[2];
|
|
8
8
|
var invokedAs = path.basename(process.argv[1] ?? "");
|
|
9
9
|
if (command === "--version" || command === "-v") {
|
|
10
|
-
const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-
|
|
10
|
+
const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-4jkmgcvm.mjs")).opencodeBrowserVersion;
|
|
11
11
|
process.stdout.write(`${opencodeBrowserVersion}
|
|
12
12
|
`);
|
|
13
13
|
} else if (command === "mcp" && globalThis.__OPENCODE_BROWSER_COMPILED__ && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1") {
|
|
14
|
-
const { runBinaryMcp } = await import("./supervisor-
|
|
14
|
+
const { runBinaryMcp } = await import("./supervisor-rt8fh19g.mjs");
|
|
15
15
|
await runBinaryMcp(process.argv.slice(3));
|
|
16
16
|
} else if (invokedAs === "opencode-browser-mcp" || command === "mcp" && process.argv.length === 3) {
|
|
17
17
|
const { NodeRuntime } = await import("./index-0dcypq31.mjs");
|
|
18
|
-
const { runMcpServer } = await import("./mcp-
|
|
18
|
+
const { runMcpServer } = await import("./mcp-6d2jsged.mjs");
|
|
19
19
|
runMcpServer.pipe(NodeRuntime.runMain);
|
|
20
20
|
} else if (command === "runtime-install" || command === "runtime-switch") {
|
|
21
|
-
const { runRuntimeInstall, runRuntimeSwitch } = await import("./runtime-update-
|
|
21
|
+
const { runRuntimeInstall, runRuntimeSwitch } = await import("./runtime-update-5p996ppb.mjs");
|
|
22
22
|
await (command === "runtime-install" ? runRuntimeInstall : runRuntimeSwitch)(process.argv.slice(3));
|
|
23
23
|
} else if (command === "update") {
|
|
24
|
-
const { runUpdateCommand } = await import("./update-
|
|
24
|
+
const { runUpdateCommand } = await import("./update-7gcjgsnj.mjs");
|
|
25
25
|
await runUpdateCommand(process.argv.slice(3));
|
|
26
26
|
} else if (command && setupCommands.has(command)) {
|
|
27
|
-
const { runSetup } = await import("./setup-
|
|
27
|
+
const { runSetup } = await import("./setup-ckx80s7r.mjs");
|
|
28
28
|
await runSetup(command, process.argv.slice(3));
|
|
29
29
|
} else {
|
|
30
30
|
if (!command || command === "--help" || command === "-h") {
|
|
@@ -59,9 +59,9 @@ if (command === "--version" || command === "-v") {
|
|
|
59
59
|
`);
|
|
60
60
|
}
|
|
61
61
|
if (command === "status" && !process.argv.includes("--json")) {
|
|
62
|
-
const { printSetupStatus } = await import("./setup-
|
|
62
|
+
const { printSetupStatus } = await import("./setup-ckx80s7r.mjs");
|
|
63
63
|
printSetupStatus();
|
|
64
64
|
}
|
|
65
|
-
const { runCli } = await import("./cli-
|
|
65
|
+
const { runCli } = await import("./cli-pqwk0593.mjs");
|
|
66
66
|
runCli();
|
|
67
67
|
}
|
|
@@ -31,8 +31,8 @@ import {
|
|
|
31
31
|
isRestrictedTarget2,
|
|
32
32
|
isRestrictedUrl2,
|
|
33
33
|
dataUrlDocument2
|
|
34
|
-
} from "./main-
|
|
35
|
-
import"./main-
|
|
34
|
+
} from "./main-gcmshzpr.mjs";
|
|
35
|
+
import"./main-2v53xfxr.mjs";
|
|
36
36
|
import"./main-mrew6jy8.mjs";
|
|
37
37
|
export {
|
|
38
38
|
HttpRouteError2 as HttpRouteError,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isNodeError
|
|
3
|
-
} from "./main-
|
|
3
|
+
} from "./main-2v53xfxr.mjs";
|
|
4
4
|
import {
|
|
5
5
|
isValidSessionId2
|
|
6
|
-
} from "./main-
|
|
6
|
+
} from "./main-gcmshzpr.mjs";
|
|
7
7
|
import {
|
|
8
8
|
isSome,
|
|
9
9
|
decodeUnknownOption,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./main-gevbt7h7.mjs";
|
|
18
18
|
import {
|
|
19
19
|
dataRoot
|
|
20
|
-
} from "./main-
|
|
20
|
+
} from "./main-rm734baq.mjs";
|
|
21
21
|
|
|
22
22
|
// src/session-manager/journal.ts
|
|
23
23
|
import fs from "node:fs";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
writePrivateJsonFileSync
|
|
3
|
-
} from "./main-
|
|
3
|
+
} from "./main-2v53xfxr.mjs";
|
|
4
4
|
import {
|
|
5
5
|
dataRoot,
|
|
6
6
|
devExtensionUrl,
|
|
7
7
|
devExtensionFolder
|
|
8
|
-
} from "./main-
|
|
8
|
+
} from "./main-rm734baq.mjs";
|
|
9
9
|
|
|
10
10
|
// src/relay/browser-pairing.ts
|
|
11
11
|
import crypto from "node:crypto";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./main-mrew6jy8.mjs";
|
|
8
8
|
import {
|
|
9
9
|
relayAuthorization
|
|
10
|
-
} from "./main-
|
|
10
|
+
} from "./main-2v53xfxr.mjs";
|
|
11
11
|
import {
|
|
12
12
|
assignProperty,
|
|
13
13
|
PipeInspectableProto,
|
|
@@ -110,14 +110,14 @@ import {
|
|
|
110
110
|
} from "./main-gevbt7h7.mjs";
|
|
111
111
|
import {
|
|
112
112
|
opencodeBrowserBuildId2
|
|
113
|
-
} from "./main-
|
|
113
|
+
} from "./main-wyynrqg7.mjs";
|
|
114
114
|
import {
|
|
115
115
|
compiledBinary,
|
|
116
116
|
scriptEntry,
|
|
117
117
|
cliCommand,
|
|
118
118
|
installCommand,
|
|
119
119
|
npmRuntime
|
|
120
|
-
} from "./main-
|
|
120
|
+
} from "./main-rm734baq.mjs";
|
|
121
121
|
import {
|
|
122
122
|
dual,
|
|
123
123
|
memoize,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
compareVersions,
|
|
7
7
|
npmRuntime,
|
|
8
8
|
autoUpdateStatus
|
|
9
|
-
} from "./main-
|
|
9
|
+
} from "./main-rm734baq.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 { runNpmUpdate } = await import("./runtime-update-
|
|
318
|
+
const { runNpmUpdate } = await import("./runtime-update-5p996ppb.mjs");
|
|
319
319
|
if (await runNpmUpdate(args))
|
|
320
320
|
return;
|
|
321
321
|
if (compiledBinary()) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
opencodeBrowserVersion2
|
|
3
|
-
} from "./main-
|
|
3
|
+
} from "./main-wyynrqg7.mjs";
|
|
4
4
|
|
|
5
5
|
// src/update/auto-update.ts
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
@@ -53,7 +53,7 @@ function cliInstall() {
|
|
|
53
53
|
return { kind: "binary", binary: installedBinary() ?? process.execPath, pathEnv: process.env.PATH };
|
|
54
54
|
if (fromCheckout())
|
|
55
55
|
return { kind: "checkout", bundle: path.join(packageRoot(), "dist", "cli.mjs") };
|
|
56
|
-
return { kind: "npm", version: "0.0.11-dev.
|
|
56
|
+
return { kind: "npm", version: "0.0.11-dev.73" };
|
|
57
57
|
}
|
|
58
58
|
function cliPrefix(install = cliInstall()) {
|
|
59
59
|
if (install.kind === "binary") {
|
|
@@ -73,7 +73,7 @@ function storeConfig(env = process.env, baked = { id: "mfnicocicmmlkpjnaffgihfjh
|
|
|
73
73
|
return id ? { id } : {};
|
|
74
74
|
}
|
|
75
75
|
var RELEASE_SERVICE = "https://anoma.ly/release";
|
|
76
|
-
function devExtension(baked = { file: "browse-extension-0.0.11-dev.
|
|
76
|
+
function devExtension(baked = { file: "browse-extension-0.0.11-dev.73.zip", sha256: "76e24c3bd805706bee3a133f7c8767e658a2844a719e5f6fd728a07a0692b715", size: 182614 }) {
|
|
77
77
|
return baked && /^[0-9a-f]{64}$/.test(baked.sha256) && /^[\w.-]+\.zip$/.test(baked.file) ? baked : undefined;
|
|
78
78
|
}
|
|
79
79
|
var devExtensionUrl = (extension, env = process.env) => `${(env.OPENCODE_BROWSER_RELEASE_SERVICE || RELEASE_SERVICE).replace(/\/+$/, "")}/browse/files/${extension.sha256}/${extension.file}`;
|
|
@@ -551,6 +551,15 @@ if (binary) {
|
|
|
551
551
|
const toClient = (line) => process.stdout.write(line + "\\n")
|
|
552
552
|
const toChild = (line) => child.stdin.write(line + "\\n")
|
|
553
553
|
const parse = (line) => { try { return JSON.parse(line) } catch { return undefined } }
|
|
554
|
+
// A request is in flight until its response; a cancelled request never gets one, so its client tells us to forget it.
|
|
555
|
+
const trackRequest = (message) => {
|
|
556
|
+
if (!message) return
|
|
557
|
+
if (message.id !== undefined && message.method !== undefined) inflight.add(message.id)
|
|
558
|
+
if (message.method !== "notifications/cancelled" || !message.params || typeof message.params !== "object") return
|
|
559
|
+
const cancelled = message.params.requestId
|
|
560
|
+
if (cancelled !== undefined) inflight.delete(cancelled)
|
|
561
|
+
}
|
|
562
|
+
const forward = (line) => { trackRequest(parse(line)); toChild(line) }
|
|
554
563
|
|
|
555
564
|
const start = (replay) => {
|
|
556
565
|
const next = spawn(process.execPath, [entry(version), "mcp"], { stdio: ["pipe", "pipe", "inherit"], env: process.env })
|
|
@@ -589,17 +598,18 @@ if (binary) {
|
|
|
589
598
|
let heldSince
|
|
590
599
|
const moved = () => { try { return current() !== version } catch { return false } }
|
|
591
600
|
const fromClient = (line) => {
|
|
601
|
+
const message = parse(line)
|
|
602
|
+
// A cancellation drops the request at once, even while client messages wait: it may be the one blocking the swap.
|
|
603
|
+
if (message && message.method === "notifications/cancelled") trackRequest(message)
|
|
592
604
|
if (swapping) return void queue.push(line)
|
|
593
605
|
if (moved()) {
|
|
594
606
|
heldSince ??= Date.now()
|
|
595
607
|
queue.push(line)
|
|
596
608
|
return void maybeSwap()
|
|
597
609
|
}
|
|
598
|
-
const message = parse(line)
|
|
599
610
|
if (message && message.method === "initialize") initialize = message
|
|
600
611
|
if (message && message.method === "notifications/initialized") initialized = line
|
|
601
|
-
|
|
602
|
-
toChild(line)
|
|
612
|
+
forward(line)
|
|
603
613
|
}
|
|
604
614
|
|
|
605
615
|
// A new version in current.json swaps the server only once the relay runs it too (GET /version), so a server never
|
|
@@ -610,7 +620,15 @@ if (binary) {
|
|
|
610
620
|
.then((response) => (response.ok ? response.json() : undefined))
|
|
611
621
|
.then((body) => (body && typeof body.version === "string" ? body.version : undefined), () => undefined)
|
|
612
622
|
const maybeSwap = async () => {
|
|
613
|
-
if (swapping || checking
|
|
623
|
+
if (swapping || checking) return
|
|
624
|
+
// Held requests go to the current server at the deadline even when a request still looks in flight: a cancelled
|
|
625
|
+
// request may never answer, and waiting for it would wedge the swap forever.
|
|
626
|
+
if (heldSince !== undefined && Date.now() - heldSince > 15000) {
|
|
627
|
+
heldSince = undefined
|
|
628
|
+
const released = queue.splice(0)
|
|
629
|
+
for (const line of released) forward(line)
|
|
630
|
+
}
|
|
631
|
+
if (inflight.size > 0) return
|
|
614
632
|
let next
|
|
615
633
|
try { next = current() } catch { return }
|
|
616
634
|
if (next === version) {
|
|
@@ -624,14 +642,7 @@ if (binary) {
|
|
|
624
642
|
checking = false
|
|
625
643
|
unreachable = running === undefined ? unreachable + 1 : 0
|
|
626
644
|
// Held requests don't wait forever for a relay that never reports the new version: they go to the current server.
|
|
627
|
-
if (running !== next && unreachable < 3)
|
|
628
|
-
if (heldSince !== undefined && Date.now() - heldSince > 15000) {
|
|
629
|
-
heldSince = undefined
|
|
630
|
-
const released = queue.splice(0)
|
|
631
|
-
for (const line of released) { const message = parse(line); if (message && message.id !== undefined && message.method !== undefined) inflight.add(message.id); toChild(line) }
|
|
632
|
-
}
|
|
633
|
-
return
|
|
634
|
-
}
|
|
645
|
+
if (running !== next && unreachable < 3) return
|
|
635
646
|
if (swapping || inflight.size > 0 || current() !== next) return
|
|
636
647
|
const old = child
|
|
637
648
|
version = next
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
parseTargetSelection2,
|
|
12
12
|
getObject2,
|
|
13
13
|
getString2
|
|
14
|
-
} from "./main-
|
|
14
|
+
} from "./main-gcmshzpr.mjs";
|
|
15
15
|
import {
|
|
16
16
|
isNodeError,
|
|
17
17
|
writeJsonFileAtomically
|
|
18
|
-
} from "./main-
|
|
18
|
+
} from "./main-2v53xfxr.mjs";
|
|
19
19
|
import {
|
|
20
20
|
getStackTraceLimit,
|
|
21
21
|
setStackTraceLimit,
|
|
@@ -129,7 +129,7 @@ import {
|
|
|
129
129
|
import {
|
|
130
130
|
dataRoot,
|
|
131
131
|
cliCommand
|
|
132
|
-
} from "./main-
|
|
132
|
+
} from "./main-rm734baq.mjs";
|
|
133
133
|
|
|
134
134
|
// node_modules/effect/dist/Semaphore.js
|
|
135
135
|
var makeUnsafe = (permits) => new SemaphoreImpl(permits);
|
|
@@ -258,11 +258,11 @@ import {
|
|
|
258
258
|
} from "./main-gevbt7h7.mjs";
|
|
259
259
|
import {
|
|
260
260
|
opencodeBrowserVersion2
|
|
261
|
-
} from "./main-
|
|
261
|
+
} from "./main-wyynrqg7.mjs";
|
|
262
262
|
import {
|
|
263
263
|
cliCommand,
|
|
264
264
|
autoUpdateStatus
|
|
265
|
-
} from "./main-
|
|
265
|
+
} from "./main-rm734baq.mjs";
|
|
266
266
|
import"./main-mrew6jy8.mjs";
|
|
267
267
|
import {
|
|
268
268
|
option,
|
|
@@ -290,12 +290,12 @@ import {
|
|
|
290
290
|
relayBuildProblem,
|
|
291
291
|
ensureRelay,
|
|
292
292
|
ensureExtensionConnected
|
|
293
|
-
} from "./main-
|
|
294
|
-
import"./main-
|
|
293
|
+
} from "./main-gcmshzpr.mjs";
|
|
294
|
+
import"./main-2v53xfxr.mjs";
|
|
295
295
|
import {
|
|
296
296
|
updateJson2,
|
|
297
297
|
createUpdateWatcher2
|
|
298
|
-
} from "./main-
|
|
298
|
+
} from "./main-mkt65nqy.mjs";
|
|
299
299
|
import {
|
|
300
300
|
makeUnsafe,
|
|
301
301
|
make,
|
|
@@ -377,7 +377,7 @@ import {
|
|
|
377
377
|
mcpErrorMessage2,
|
|
378
378
|
toolResult,
|
|
379
379
|
listSecrets
|
|
380
|
-
} from "./main-
|
|
380
|
+
} from "./main-rnc3f5wr.mjs";
|
|
381
381
|
import {
|
|
382
382
|
Clock,
|
|
383
383
|
type,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
opencodeBrowserVersion2,
|
|
3
3
|
opencodeBrowserBuildId2
|
|
4
|
-
} from "./main-
|
|
4
|
+
} from "./main-wyynrqg7.mjs";
|
|
5
5
|
import {
|
|
6
6
|
dataRoot,
|
|
7
7
|
oldStoreMarker,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
setStoredMode,
|
|
20
20
|
autoUpdateStatus,
|
|
21
21
|
createAutoUpdater
|
|
22
|
-
} from "./main-
|
|
22
|
+
} from "./main-rm734baq.mjs";
|
|
23
23
|
import {
|
|
24
24
|
extensionProtocolVersion,
|
|
25
25
|
minExtensionProtocolVersion,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
relayToken,
|
|
45
45
|
secretsEqual,
|
|
46
46
|
ensurePrivateDirectory
|
|
47
|
-
} from "./main-
|
|
47
|
+
} from "./main-2v53xfxr.mjs";
|
|
48
48
|
import {
|
|
49
49
|
withDefault,
|
|
50
50
|
option,
|
|
@@ -98,7 +98,7 @@ import {
|
|
|
98
98
|
isRestrictedTarget2,
|
|
99
99
|
isRestrictedUrl2,
|
|
100
100
|
dataUrlDocument2
|
|
101
|
-
} from "./main-
|
|
101
|
+
} from "./main-gcmshzpr.mjs";
|
|
102
102
|
import {
|
|
103
103
|
relayHostname,
|
|
104
104
|
isLocalPeer,
|
|
@@ -120,7 +120,7 @@ import {
|
|
|
120
120
|
wrapToken,
|
|
121
121
|
installedDevExtension,
|
|
122
122
|
syncDevExtension
|
|
123
|
-
} from "./main-
|
|
123
|
+
} from "./main-6nwq3ezr.mjs";
|
|
124
124
|
import {
|
|
125
125
|
makeUnsafe,
|
|
126
126
|
SettingsInputError,
|
|
@@ -148,16 +148,16 @@ import {
|
|
|
148
148
|
checkNavigationUrl,
|
|
149
149
|
readSecret,
|
|
150
150
|
secretText
|
|
151
|
-
} from "./main-
|
|
151
|
+
} from "./main-rnc3f5wr.mjs";
|
|
152
152
|
import {
|
|
153
153
|
defaultJournalBaseDir,
|
|
154
154
|
makeJournalEntry,
|
|
155
155
|
appendJournalEntry,
|
|
156
156
|
startJournalRetention
|
|
157
|
-
} from "./main-
|
|
157
|
+
} from "./main-5fwb3tjm.mjs";
|
|
158
158
|
import {
|
|
159
159
|
createUpdateWatcher2
|
|
160
|
-
} from "./main-
|
|
160
|
+
} from "./main-mkt65nqy.mjs";
|
|
161
161
|
import {
|
|
162
162
|
isNone,
|
|
163
163
|
isSome,
|
|
@@ -397,7 +397,7 @@ class ExtensionRpc {
|
|
|
397
397
|
const replies = this.replies;
|
|
398
398
|
const message = { ...command, id };
|
|
399
399
|
let completed = false;
|
|
400
|
-
const timeoutMs = awaitsPagePromise(command) ?
|
|
400
|
+
const timeoutMs = awaitsPagePromise(command) ? this.timeouts.awaitPromiseTimeoutMs ?? 5 * 60000 : command.method === "ping" ? 4000 : command.method === "debugger.sendCommand" ? this.timeouts.debuggerCommandTimeoutMs ?? 60000 : this.timeouts.commandTimeoutMs ?? 15000;
|
|
401
401
|
const finish = (effect) => {
|
|
402
402
|
if (completed) {
|
|
403
403
|
return;
|
|
@@ -407,7 +407,7 @@ class ExtensionRpc {
|
|
|
407
407
|
this.pendingRequests.delete(id);
|
|
408
408
|
resume(effect);
|
|
409
409
|
};
|
|
410
|
-
const timeout =
|
|
410
|
+
const timeout = setTimeout(() => {
|
|
411
411
|
if (command.method === "ping") {
|
|
412
412
|
if (this.replies !== replies)
|
|
413
413
|
return finish(succeed6({}));
|
|
@@ -11272,7 +11272,10 @@ class RelayShutdown {
|
|
|
11272
11272
|
yield* all([control.options.drain, control.idle.await], { concurrency: "unbounded" });
|
|
11273
11273
|
yield* control.idle.await;
|
|
11274
11274
|
yield* control.options.settle;
|
|
11275
|
-
})
|
|
11275
|
+
}).pipe(timeoutOrElse({
|
|
11276
|
+
duration: control.options.timeoutMs ?? 1e4,
|
|
11277
|
+
orElse: () => fail4(control.busyError("timeout"))
|
|
11278
|
+
}));
|
|
11276
11279
|
}
|
|
11277
11280
|
close() {
|
|
11278
11281
|
const control = this;
|
|
@@ -11902,6 +11905,14 @@ function executeInSession(ctx, options) {
|
|
|
11902
11905
|
}
|
|
11903
11906
|
|
|
11904
11907
|
// src/session-manager.ts
|
|
11908
|
+
var mcpSessionPattern = /^mcp-[0-9a-f]{8}$/i;
|
|
11909
|
+
function isMcpSession(id) {
|
|
11910
|
+
return mcpSessionPattern.test(id);
|
|
11911
|
+
}
|
|
11912
|
+
function isAutoNamedSession(id) {
|
|
11913
|
+
return isMcpSession(id) || /^[a-z]+-[a-z]+-\d{3}$/.test(id) || id.startsWith("oc-");
|
|
11914
|
+
}
|
|
11915
|
+
|
|
11905
11916
|
class OpenCodeBrowserSessions {
|
|
11906
11917
|
endpointUrl;
|
|
11907
11918
|
sessions = new Map;
|
|
@@ -12230,6 +12241,8 @@ class OpenCodeBrowserSessions {
|
|
|
12230
12241
|
session.allowedOrigins = existing.allowedOrigins;
|
|
12231
12242
|
if (existing.browser)
|
|
12232
12243
|
session.browser = existing.browser;
|
|
12244
|
+
if (existing.clientPid !== undefined)
|
|
12245
|
+
session.clientPid = existing.clientPid;
|
|
12233
12246
|
manager.sessions.set(id, session);
|
|
12234
12247
|
yield* manager.admission.commitPersistence(() => sync2(() => {
|
|
12235
12248
|
manager.sessions.set(id, existing);
|
|
@@ -12333,6 +12346,8 @@ class OpenCodeBrowserSessions {
|
|
|
12333
12346
|
const now = options.now ?? Date.now();
|
|
12334
12347
|
const reaped = [];
|
|
12335
12348
|
for (const session of Array.from(manager.sessions.values())) {
|
|
12349
|
+
if (!isAutoNamedSession(session.id))
|
|
12350
|
+
continue;
|
|
12336
12351
|
if (manager.isExecuting(session.id) || manager.hasPendingWork(session.id) || session.sandbox.networkStatus().active) {
|
|
12337
12352
|
continue;
|
|
12338
12353
|
}
|
|
@@ -12345,8 +12360,7 @@ class OpenCodeBrowserSessions {
|
|
|
12345
12360
|
targetIds.add(session.target.id);
|
|
12346
12361
|
if (Array.from(targetIds).some((id) => options.isTargetBusy?.(id)))
|
|
12347
12362
|
continue;
|
|
12348
|
-
const
|
|
12349
|
-
const done = yield* (autoNamed ? manager.delete(session.id).pipe(map5((r) => r.deleted)) : manager.reset(session.id).pipe(map5(Boolean))).pipe(orElseSucceed(() => false));
|
|
12363
|
+
const done = yield* manager.delete(session.id).pipe(map5((result) => result.deleted), orElseSucceed(() => false));
|
|
12350
12364
|
if (done)
|
|
12351
12365
|
reaped.push(session.id);
|
|
12352
12366
|
}
|
|
@@ -12473,10 +12487,9 @@ class OpenCodeBrowserSessions {
|
|
|
12473
12487
|
const pending = Array.from(sessionRelayTargetIds(this.hooks, session)).filter((id) => !closed.has(id));
|
|
12474
12488
|
if (pending.length === 0)
|
|
12475
12489
|
return;
|
|
12476
|
-
|
|
12477
|
-
yield* this.closeRelayTarget(targetId).pipe(ignore);
|
|
12490
|
+
yield* forEach(pending, (targetId) => this.closeRelayTarget(targetId).pipe(ignore, andThen(sync2(() => {
|
|
12478
12491
|
closed.add(targetId);
|
|
12479
|
-
}
|
|
12492
|
+
}))), { concurrency: 4, discard: true });
|
|
12480
12493
|
}
|
|
12481
12494
|
});
|
|
12482
12495
|
}
|
|
@@ -15912,6 +15925,17 @@ class ExtensionHandshake {
|
|
|
15912
15925
|
}
|
|
15913
15926
|
|
|
15914
15927
|
// src/relay/housekeeping.ts
|
|
15928
|
+
function tabIsBusy(tabId, deps) {
|
|
15929
|
+
if (deps.handoffs.pendingForTab(tabId) !== undefined || deps.isTabRecorded(tabId))
|
|
15930
|
+
return true;
|
|
15931
|
+
const sessionId = deps.registry.getRootTargetByTabId(tabId)?.opencodeBrowserSessionId;
|
|
15932
|
+
if (sessionId === undefined)
|
|
15933
|
+
return false;
|
|
15934
|
+
const session = deps.sessions.sessions.get(sessionId);
|
|
15935
|
+
if (!session)
|
|
15936
|
+
return false;
|
|
15937
|
+
return deps.sessions.isExecuting(sessionId) || deps.sessions.hasPendingWork(sessionId) || session.sandbox.networkStatus().active;
|
|
15938
|
+
}
|
|
15915
15939
|
function createRelayHousekeeping(options) {
|
|
15916
15940
|
const {
|
|
15917
15941
|
instanceId,
|
|
@@ -15952,18 +15976,19 @@ function createRelayHousekeeping(options) {
|
|
|
15952
15976
|
sendToEveryBrowser({ method: "update.notice", ...notice ? { params: { summary: notice.summary, command: notice.command } } : {} });
|
|
15953
15977
|
};
|
|
15954
15978
|
const releaseRelayTarget = fnUntraced(function* (targetId) {
|
|
15979
|
+
const first = registry.targetsByTargetId.get(targetId);
|
|
15980
|
+
if (!first || first.owner !== "relay")
|
|
15981
|
+
return;
|
|
15955
15982
|
const deadline = (yield* currentTimeMillis2) + releaseTargetGraceMs;
|
|
15956
15983
|
while (true) {
|
|
15957
15984
|
const target = registry.targetsByTargetId.get(targetId);
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15985
|
+
if (!target || target.owner !== "relay")
|
|
15986
|
+
return;
|
|
15987
|
+
const link = browsers.browserTab(target.tabId)?.link;
|
|
15988
|
+
if (link && (link.rpc.connected || link.rpc.protocolLegacy === true)) {
|
|
15962
15989
|
yield* sendToExtension({ method: "tabs.remove", params: { tabId: target.tabId } });
|
|
15963
15990
|
return;
|
|
15964
15991
|
}
|
|
15965
|
-
if (link?.rpc.connected && link.rpc.protocolLegacy === false)
|
|
15966
|
-
return;
|
|
15967
15992
|
const remaining = deadline - (yield* currentTimeMillis2);
|
|
15968
15993
|
if (remaining <= 0)
|
|
15969
15994
|
return;
|
|
@@ -16028,7 +16053,7 @@ function createRelayHousekeeping(options) {
|
|
|
16028
16053
|
runPromise(gen(function* () {
|
|
16029
16054
|
if (yield* sessions.networkEnd(id, `its client (process ${pid}) exited`))
|
|
16030
16055
|
relayLog("session.capture.ended", { session: id, reason: "client gone", pid });
|
|
16031
|
-
if (
|
|
16056
|
+
if (!isMcpSession(id) || sessions.isExecuting(id) || sessions.hasPendingWork(id))
|
|
16032
16057
|
return;
|
|
16033
16058
|
const tabs = registry.listRootTargets().filter((target) => target.opencodeBrowserSessionId === id).map((target) => target.tabId);
|
|
16034
16059
|
if (tabs.some((tabId) => handoffs.pendingForTab(tabId) || isTabRecorded(tabId)))
|
|
@@ -16048,9 +16073,7 @@ function createRelayHousekeeping(options) {
|
|
|
16048
16073
|
const noteAgentActivity = () => {
|
|
16049
16074
|
lastAgentActivity = Date.now();
|
|
16050
16075
|
};
|
|
16051
|
-
|
|
16052
|
-
return handoffs.pendingForTab(tabId) !== undefined || isTabRecorded(tabId) || Array.from(sessions.sessions.keys()).some((id) => sessions.isExecuting(id) || sessions.hasPendingWork(id) || sessions.sessions.get(id)?.sandbox.networkStatus().active);
|
|
16053
|
-
}
|
|
16076
|
+
const isTabBusy = (tabId) => tabIsBusy(tabId, { registry, sessions, handoffs, isTabRecorded });
|
|
16054
16077
|
const detachIdleUserTarget = fnUntraced(function* (targetId) {
|
|
16055
16078
|
const target = registry.targetsByTargetId.get(targetId);
|
|
16056
16079
|
if (!target || target.owner !== "user" || isTabBusy(target.tabId))
|
|
@@ -16944,7 +16967,14 @@ class SessionCatalog {
|
|
|
16944
16967
|
return sessions;
|
|
16945
16968
|
} catch (error) {
|
|
16946
16969
|
const detail = error instanceof Error && error.message ? `: ${error.message}` : "";
|
|
16947
|
-
|
|
16970
|
+
const corruptPath = `${this.filePath}.corrupt-${Date.now()}`;
|
|
16971
|
+
try {
|
|
16972
|
+
await fs14.rename(this.filePath, corruptPath);
|
|
16973
|
+
console.error(`Browse session catalog at ${this.filePath} was unreadable${detail}; moved it to ${corruptPath} and started with no saved sessions`);
|
|
16974
|
+
} catch (moveError) {
|
|
16975
|
+
console.error(`Browse session catalog at ${this.filePath} was unreadable${detail}; could not move it aside (${moveError instanceof Error ? moveError.message : String(moveError)}), starting with no saved sessions`);
|
|
16976
|
+
}
|
|
16977
|
+
return [];
|
|
16948
16978
|
}
|
|
16949
16979
|
}
|
|
16950
16980
|
async save(sessions) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./main-
|
|
1
|
+
import"./main-wyynrqg7.mjs";
|
|
2
2
|
import {
|
|
3
3
|
cliCommand,
|
|
4
4
|
installCommand,
|
|
@@ -18,15 +18,15 @@ import {
|
|
|
18
18
|
installVersion,
|
|
19
19
|
pruneVersions,
|
|
20
20
|
switchVersion
|
|
21
|
-
} from "./main-
|
|
21
|
+
} from "./main-rm734baq.mjs";
|
|
22
22
|
import"./main-mrew6jy8.mjs";
|
|
23
23
|
import {
|
|
24
24
|
Service,
|
|
25
25
|
layerFetch,
|
|
26
26
|
restartRelay,
|
|
27
27
|
startManagedRelay
|
|
28
|
-
} from "./main-
|
|
29
|
-
import"./main-
|
|
28
|
+
} from "./main-gcmshzpr.mjs";
|
|
29
|
+
import"./main-2v53xfxr.mjs";
|
|
30
30
|
import {
|
|
31
31
|
succeed6,
|
|
32
32
|
suspend2,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
opencodeBrowserVersion2,
|
|
3
3
|
opencodeBrowserBuildId2
|
|
4
|
-
} from "./main-
|
|
4
|
+
} from "./main-wyynrqg7.mjs";
|
|
5
5
|
import {
|
|
6
6
|
dataRoot,
|
|
7
7
|
oldStoreMarker,
|
|
@@ -26,10 +26,10 @@ import {
|
|
|
26
26
|
installVersion,
|
|
27
27
|
pruneVersions,
|
|
28
28
|
switchVersion
|
|
29
|
-
} from "./main-
|
|
29
|
+
} from "./main-rm734baq.mjs";
|
|
30
30
|
import {
|
|
31
31
|
relayAuthorization
|
|
32
|
-
} from "./main-
|
|
32
|
+
} from "./main-2v53xfxr.mjs";
|
|
33
33
|
import {
|
|
34
34
|
parseHostname,
|
|
35
35
|
readRelayConfig,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
legacyPairingCode,
|
|
47
47
|
removeLegacyPairingCode,
|
|
48
48
|
syncDevExtension
|
|
49
|
-
} from "./main-
|
|
49
|
+
} from "./main-6nwq3ezr.mjs";
|
|
50
50
|
import {
|
|
51
51
|
unpackedExtensionId,
|
|
52
52
|
extensionProtocolSkew,
|
|
@@ -12147,7 +12147,7 @@ async function runSetup(command, args) {
|
|
|
12147
12147
|
if (command === "set")
|
|
12148
12148
|
return set(args);
|
|
12149
12149
|
if (command === "rollback") {
|
|
12150
|
-
const { runRollback } = await import("./runtime-update-
|
|
12150
|
+
const { runRollback } = await import("./runtime-update-5p996ppb.mjs");
|
|
12151
12151
|
return runRollback(args);
|
|
12152
12152
|
}
|
|
12153
12153
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import"./main-
|
|
1
|
+
import"./main-wyynrqg7.mjs";
|
|
2
2
|
import {
|
|
3
3
|
versionEntry,
|
|
4
4
|
readCurrent,
|
|
5
5
|
npmRuntime
|
|
6
|
-
} from "./main-
|
|
6
|
+
} from "./main-rm734baq.mjs";
|
|
7
7
|
|
|
8
8
|
// src/mcp/supervisor.ts
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
@@ -14,7 +14,7 @@ async function runBinaryMcp(args) {
|
|
|
14
14
|
const runtime = npmRuntime();
|
|
15
15
|
if (!runtime) {
|
|
16
16
|
process.env[directEnvironmentVariable] = "1";
|
|
17
|
-
const { runCli } = await import("./cli-
|
|
17
|
+
const { runCli } = await import("./cli-pqwk0593.mjs");
|
|
18
18
|
return runCli();
|
|
19
19
|
}
|
|
20
20
|
const { layout } = runtime;
|
|
@@ -46,6 +46,21 @@ async function runBinaryMcp(args) {
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
const trackRequest = (message) => {
|
|
50
|
+
if (!message)
|
|
51
|
+
return;
|
|
52
|
+
if (message.id !== undefined && message.method !== undefined)
|
|
53
|
+
inflight.add(message.id);
|
|
54
|
+
if (message.method !== "notifications/cancelled" || !message.params || typeof message.params !== "object")
|
|
55
|
+
return;
|
|
56
|
+
const cancelled = message.params.requestId;
|
|
57
|
+
if (cancelled !== undefined)
|
|
58
|
+
inflight.delete(cancelled);
|
|
59
|
+
};
|
|
60
|
+
const forward = (line) => {
|
|
61
|
+
trackRequest(parse(line));
|
|
62
|
+
toChild(line);
|
|
63
|
+
};
|
|
49
64
|
const start = (replay) => {
|
|
50
65
|
const next = spawn(command(version), ["mcp", ...args], { stdio: ["pipe", "pipe", "inherit"], env: { ...process.env, [directEnvironmentVariable]: "1" } });
|
|
51
66
|
next.stdin.on("error", () => {});
|
|
@@ -85,6 +100,9 @@ async function runBinaryMcp(args) {
|
|
|
85
100
|
let heldSince;
|
|
86
101
|
const moved = () => current() !== version;
|
|
87
102
|
const fromClient = (line) => {
|
|
103
|
+
const message = parse(line);
|
|
104
|
+
if (message?.method === "notifications/cancelled")
|
|
105
|
+
trackRequest(message);
|
|
88
106
|
if (swapping)
|
|
89
107
|
return void queue.push(line);
|
|
90
108
|
if (moved()) {
|
|
@@ -92,14 +110,11 @@ async function runBinaryMcp(args) {
|
|
|
92
110
|
queue.push(line);
|
|
93
111
|
return void maybeSwap();
|
|
94
112
|
}
|
|
95
|
-
const message = parse(line);
|
|
96
113
|
if (message?.method === "initialize")
|
|
97
114
|
initialize = message;
|
|
98
115
|
if (message?.method === "notifications/initialized")
|
|
99
116
|
initialized = line;
|
|
100
|
-
|
|
101
|
-
inflight.add(message.id);
|
|
102
|
-
toChild(line);
|
|
117
|
+
forward(line);
|
|
103
118
|
};
|
|
104
119
|
let checking = false;
|
|
105
120
|
let unreachable = 0;
|
|
@@ -107,7 +122,14 @@ async function runBinaryMcp(args) {
|
|
|
107
122
|
return;
|
|
108
123
|
});
|
|
109
124
|
const maybeSwap = async () => {
|
|
110
|
-
if (swapping || checking
|
|
125
|
+
if (swapping || checking)
|
|
126
|
+
return;
|
|
127
|
+
if (heldSince !== undefined && Date.now() - heldSince > 15000) {
|
|
128
|
+
heldSince = undefined;
|
|
129
|
+
for (const line of queue.splice(0))
|
|
130
|
+
forward(line);
|
|
131
|
+
}
|
|
132
|
+
if (inflight.size > 0)
|
|
111
133
|
return;
|
|
112
134
|
const next = current();
|
|
113
135
|
if (next === version) {
|
|
@@ -121,18 +143,8 @@ async function runBinaryMcp(args) {
|
|
|
121
143
|
const running = await relayVersion();
|
|
122
144
|
checking = false;
|
|
123
145
|
unreachable = running === undefined ? unreachable + 1 : 0;
|
|
124
|
-
if (running !== next && unreachable < 3)
|
|
125
|
-
if (heldSince !== undefined && Date.now() - heldSince > 15000) {
|
|
126
|
-
heldSince = undefined;
|
|
127
|
-
for (const line of queue.splice(0)) {
|
|
128
|
-
const message = parse(line);
|
|
129
|
-
if (message && message.id !== undefined && message.method !== undefined)
|
|
130
|
-
inflight.add(message.id);
|
|
131
|
-
toChild(line);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
146
|
+
if (running !== next && unreachable < 3)
|
|
134
147
|
return;
|
|
135
|
-
}
|
|
136
148
|
if (swapping || inflight.size > 0 || current() !== next)
|
|
137
149
|
return;
|
|
138
150
|
const old = child;
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
updateNotice2,
|
|
5
5
|
createUpdateWatcher2,
|
|
6
6
|
runUpdateCommand2
|
|
7
|
-
} from "./main-
|
|
7
|
+
} from "./main-mkt65nqy.mjs";
|
|
8
8
|
import"./main-mrew6jy8.mjs";
|
|
9
|
-
import"./main-
|
|
10
|
-
import"./main-
|
|
9
|
+
import"./main-rm734baq.mjs";
|
|
10
|
+
import"./main-wyynrqg7.mjs";
|
|
11
11
|
export {
|
|
12
12
|
createUpdateWatcher2 as createUpdateWatcher,
|
|
13
13
|
formatUpdateNotice2 as formatUpdateNotice,
|
package/package.json
CHANGED
package/dist/main-4qy2q686.mjs
DELETED