@opencode/browse 0.0.17-dev.180 → 0.0.17-dev.182
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/{Runtime-jrg7sc9p.mjs → Runtime-xss8qan1.mjs} +1 -1
- package/dist/{cli-dbb5bjne.mjs → cli-29nz7n5s.mjs} +42 -41
- package/dist/cli.mjs +14 -14
- package/dist/{helpers-mbetgbwv.mjs → helpers-vyfqh9b2.mjs} +1 -3
- package/dist/{index-j79y2me1.mjs → index-gjq7chrk.mjs} +2 -2
- package/dist/{legacy-runtime-eky6yenx.mjs → legacy-runtime-6hnptg9g.mjs} +30 -17
- package/dist/main-4vvyemrj.mjs +4 -0
- package/dist/{main-awaqqre9.mjs → main-6a10pzcy.mjs} +117 -4
- package/dist/{main-f98q5tcf.mjs → main-6hvv25x8.mjs} +27 -29
- package/dist/main-6yn76a8h.mjs +1014 -0
- package/dist/{main-q2d5bd1e.mjs → main-7y95agwd.mjs} +8 -10
- package/dist/{main-3mhynene.mjs → main-9frwnsnf.mjs} +3 -5
- package/dist/{main-048kx59h.mjs → main-akpa411k.mjs} +6 -8
- package/dist/{main-v2a390e1.mjs → main-ddha60b9.mjs} +7 -9
- package/dist/{main-wfmad10p.mjs → main-emsvawnv.mjs} +16 -18
- package/dist/{main-g1frnq76.mjs → main-fak5r9je.mjs} +8 -7
- package/dist/{main-fpn564ph.mjs → main-gffzw2p5.mjs} +7 -4
- package/dist/{main-s3g4jwx5.mjs → main-jeta10c6.mjs} +23 -25
- package/dist/{main-wpt5ha44.mjs → main-m45zegrn.mjs} +371 -167
- package/dist/{main-46wtkfsd.mjs → main-qrjqb2nq.mjs} +200 -989
- package/dist/{main-jwss6gk9.mjs → main-s32xre10.mjs} +2 -2
- package/dist/main-wr4d7914.mjs +213 -0
- package/dist/{main-r8g3xydm.mjs → main-yegq8f5a.mjs} +3 -5
- package/dist/{main-44rp8pxg.mjs → main-zhhwe1b2.mjs} +4 -4
- package/dist/{mcp-amxrbrbd.mjs → mcp-s4zq3r5e.mjs} +37 -32
- package/dist/{migrate-07f3f3yp.mjs → migrate-bjbv00k0.mjs} +5 -6
- package/dist/{relay-e7fx469h.mjs → relay-c4d4s5wv.mjs} +134 -63
- package/dist/{runtime-update-xt7x7j6c.mjs → runtime-update-dxb97fdt.mjs} +9 -9
- package/dist/{setup-m85mamg6.mjs → setup-mjb2zzdx.mjs} +196 -129
- package/dist/{skill-text-7bqtc16a.mjs → skill-text-1rg5b5np.mjs} +12 -0
- package/dist/{supervisor-6zbwkkpt.mjs → supervisor-vwmswj0w.mjs} +10 -6
- package/dist/{update-drswqt2m.mjs → update-b708rvmn.mjs} +3 -4
- package/dist/{version-v3heqz8b.mjs → version-qnx1byw6.mjs} +1 -1
- package/package.json +1 -1
- package/skills/browse/SKILL.md +12 -0
- package/dist/main-4h7rfhhr.mjs +0 -61
- package/dist/main-amkq7v9m.mjs +0 -4
- package/dist/main-gg7f12gg.mjs +0 -114
- package/dist/main-qazf3bhk.mjs +0 -223
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
errorExitCode2,
|
|
4
4
|
errorReported2
|
|
5
|
-
} from "./main-
|
|
5
|
+
} from "./main-9frwnsnf.mjs";
|
|
6
6
|
import {
|
|
7
7
|
make4,
|
|
8
8
|
value2,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
Terminal,
|
|
15
15
|
runMain,
|
|
16
16
|
layer2
|
|
17
|
-
} from "./main-
|
|
17
|
+
} from "./main-jeta10c6.mjs";
|
|
18
18
|
import {
|
|
19
19
|
ExitCode,
|
|
20
20
|
failure,
|
|
@@ -25,7 +25,7 @@ import"./main-pmfd055v.mjs";
|
|
|
25
25
|
import {
|
|
26
26
|
opencodeBrowserVersion2,
|
|
27
27
|
opencodeBrowserBuildId2
|
|
28
|
-
} from "./main-
|
|
28
|
+
} from "./main-4vvyemrj.mjs";
|
|
29
29
|
import {
|
|
30
30
|
configRoot2,
|
|
31
31
|
dataRoot,
|
|
@@ -37,21 +37,20 @@ import {
|
|
|
37
37
|
cliCommand,
|
|
38
38
|
devExtension,
|
|
39
39
|
installCommand,
|
|
40
|
+
extensionProtocolVersion,
|
|
41
|
+
extensionProtocolAdvice,
|
|
40
42
|
autoUpdateStatus
|
|
41
|
-
} from "./main-
|
|
43
|
+
} from "./main-6a10pzcy.mjs";
|
|
42
44
|
import {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} from "./main-
|
|
45
|
+
defaultPort2,
|
|
46
|
+
isValidSessionId2
|
|
47
|
+
} from "./main-6yn76a8h.mjs";
|
|
46
48
|
import {
|
|
47
49
|
option,
|
|
48
50
|
String2,
|
|
49
51
|
Int,
|
|
50
|
-
defaultPort2,
|
|
51
|
-
isValidSessionId2,
|
|
52
52
|
portConfig,
|
|
53
53
|
extensionOriginsConfig,
|
|
54
|
-
endpointForPort,
|
|
55
54
|
RelayUnreachable,
|
|
56
55
|
RelayRejected,
|
|
57
56
|
Service,
|
|
@@ -64,29 +63,31 @@ import {
|
|
|
64
63
|
ensureExtensionConnected,
|
|
65
64
|
stoppedRelayStatus,
|
|
66
65
|
statusCollections
|
|
67
|
-
} from "./main-
|
|
68
|
-
import"./main-4h7rfhhr.mjs";
|
|
66
|
+
} from "./main-qrjqb2nq.mjs";
|
|
69
67
|
import {
|
|
70
68
|
updateJson2,
|
|
71
69
|
formatUpdateNotice2,
|
|
72
70
|
updateNotice2
|
|
73
|
-
} from "./main-
|
|
71
|
+
} from "./main-yegq8f5a.mjs";
|
|
74
72
|
import {
|
|
75
73
|
settingKeys,
|
|
76
74
|
formatSettings,
|
|
77
75
|
ensureSessionExists
|
|
78
|
-
} from "./main-
|
|
76
|
+
} from "./main-emsvawnv.mjs";
|
|
79
77
|
import {
|
|
80
78
|
addSecret,
|
|
81
79
|
listSecrets,
|
|
82
80
|
removeSecret
|
|
83
|
-
} from "./main-
|
|
81
|
+
} from "./main-7y95agwd.mjs";
|
|
84
82
|
import {
|
|
85
83
|
defaultJournalBaseDir,
|
|
86
84
|
readJournalEntries,
|
|
87
85
|
formatJournalEntry
|
|
88
|
-
} from "./main-
|
|
89
|
-
import"./main-
|
|
86
|
+
} from "./main-ddha60b9.mjs";
|
|
87
|
+
import"./main-s32xre10.mjs";
|
|
88
|
+
import {
|
|
89
|
+
endpointForPort
|
|
90
|
+
} from "./main-wr4d7914.mjs";
|
|
90
91
|
import {
|
|
91
92
|
taggedEnum,
|
|
92
93
|
is2,
|
|
@@ -107,12 +108,21 @@ import {
|
|
|
107
108
|
Defect,
|
|
108
109
|
TaggedError2,
|
|
109
110
|
toCodecStringTree
|
|
110
|
-
} from "./main-
|
|
111
|
+
} from "./main-6hvv25x8.mjs";
|
|
111
112
|
import {
|
|
113
|
+
pipeArguments,
|
|
114
|
+
dual,
|
|
115
|
+
identity,
|
|
116
|
+
pipe,
|
|
117
|
+
isString,
|
|
118
|
+
isNotUndefined,
|
|
119
|
+
isObject,
|
|
120
|
+
hasProperty,
|
|
121
|
+
isTagged,
|
|
112
122
|
format,
|
|
113
123
|
assignProperty,
|
|
114
124
|
withFiber,
|
|
115
|
-
|
|
125
|
+
Prototype2,
|
|
116
126
|
none,
|
|
117
127
|
some,
|
|
118
128
|
isNone,
|
|
@@ -179,18 +189,7 @@ import {
|
|
|
179
189
|
interrupt3,
|
|
180
190
|
fnUntraced,
|
|
181
191
|
fn
|
|
182
|
-
} from "./main-
|
|
183
|
-
import {
|
|
184
|
-
pipeArguments,
|
|
185
|
-
dual,
|
|
186
|
-
identity,
|
|
187
|
-
pipe,
|
|
188
|
-
isString,
|
|
189
|
-
isNotUndefined,
|
|
190
|
-
isObject,
|
|
191
|
-
hasProperty,
|
|
192
|
-
isTagged
|
|
193
|
-
} from "./main-qazf3bhk.mjs";
|
|
192
|
+
} from "./main-m45zegrn.mjs";
|
|
194
193
|
|
|
195
194
|
// node_modules/effect/dist/Number.js
|
|
196
195
|
var Number2 = globalThis.Number;
|
|
@@ -708,7 +707,7 @@ var Toggle = (options) => {
|
|
|
708
707
|
});
|
|
709
708
|
};
|
|
710
709
|
var proto = {
|
|
711
|
-
.../* @__PURE__ */
|
|
710
|
+
.../* @__PURE__ */ Prototype2({
|
|
712
711
|
label: "Prompt",
|
|
713
712
|
evaluate() {
|
|
714
713
|
return run(this);
|
|
@@ -3399,7 +3398,7 @@ var reconstructTree = (tree, results) => {
|
|
|
3399
3398
|
var TypeId5 = "~effect/cli/Command";
|
|
3400
3399
|
var toImpl = (self) => self;
|
|
3401
3400
|
var Proto3 = {
|
|
3402
|
-
.../* @__PURE__ */
|
|
3401
|
+
.../* @__PURE__ */ Prototype2({
|
|
3403
3402
|
label: "Command",
|
|
3404
3403
|
evaluate() {
|
|
3405
3404
|
return toImpl(this).service;
|
|
@@ -5859,7 +5858,7 @@ var status = make("status", {
|
|
|
5859
5858
|
}
|
|
5860
5859
|
})).pipe(withDescription4("Show relay, extension, and target status"));
|
|
5861
5860
|
var mcp = make("mcp", {}, fn("Cli.mcp")(function* () {
|
|
5862
|
-
const { runMcpServer } = yield* promise(() => import("./mcp-
|
|
5861
|
+
const { runMcpServer } = yield* promise(() => import("./mcp-s4zq3r5e.mjs"));
|
|
5863
5862
|
yield* runMcpServer;
|
|
5864
5863
|
})).pipe(withDescription4("Run the browse MCP server over stdio"));
|
|
5865
5864
|
registerCliCommand(400, () => tabs);
|
|
@@ -5880,7 +5879,7 @@ registerCliCommand(810, ({ packageRoot }) => make("doctor", {
|
|
|
5880
5879
|
}
|
|
5881
5880
|
})).pipe(withDescription4("Diagnose the local browse install and runtime")));
|
|
5882
5881
|
registerCliCommand(820, () => make("skill", {}, fn("Cli.skill")(function* () {
|
|
5883
|
-
const { skillText } = yield* promise(() => import("./skill-text-
|
|
5882
|
+
const { skillText } = yield* promise(() => import("./skill-text-1rg5b5np.mjs"));
|
|
5884
5883
|
yield* log(skillText.trimEnd());
|
|
5885
5884
|
})).pipe(withDescription4("Print the browse agent skill text")));
|
|
5886
5885
|
registerCliCommand(900, () => mcp);
|
|
@@ -6307,12 +6306,12 @@ registerCliCommand(710, () => flightRecorder);
|
|
|
6307
6306
|
|
|
6308
6307
|
// src/cli/relay.ts
|
|
6309
6308
|
var serve = make("serve", {}, fn("Cli.serve")(function* () {
|
|
6310
|
-
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-
|
|
6311
|
-
const port = yield* portConfig;
|
|
6309
|
+
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-c4d4s5wv.mjs"), import("./helpers-vyfqh9b2.mjs")]));
|
|
6310
|
+
const port = process.env.OPENCODE_BROWSER_PORT === undefined ? undefined : yield* portConfig;
|
|
6312
6311
|
const additionalExtensionOrigins = parseAdditionalExtensionOrigins(yield* extensionOriginsConfig);
|
|
6313
6312
|
yield* scoped(gen(function* () {
|
|
6314
|
-
const relay = yield* startRelay({ port, additionalExtensionOrigins });
|
|
6315
|
-
yield* promise(() => import("./legacy-runtime-
|
|
6313
|
+
const relay = yield* startRelay({ ...port === undefined ? {} : { port }, additionalExtensionOrigins });
|
|
6314
|
+
yield* promise(() => import("./legacy-runtime-6hnptg9g.mjs").then((module) => module.commitLegacyTakeover()));
|
|
6316
6315
|
yield* log(`browse relay listening at ${relay.url}`);
|
|
6317
6316
|
yield* log(`browse connects automatically while the browser runs. Run \`${cliCommand("status")}\` to check.`);
|
|
6318
6317
|
yield* never;
|
|
@@ -6489,8 +6488,9 @@ var sessionNew = make("new", {
|
|
|
6489
6488
|
name: String7("name").pipe(optional3, withDescription2("Optional lowercase session id")),
|
|
6490
6489
|
readOnly: Boolean4("read-only").pipe(withDefault2(false), withDescription3("Create a read-only session: adopt a tab the user has lent you, then snapshot, screenshot and read it; CDP input, navigation, new pages and cookie writes are refused")),
|
|
6491
6490
|
allowOrigin: String8("allow-origin").pipe(atLeast2(0), withDescription3("Only let this session's tabs load these hosts or origins (repeatable or comma-separated): example.com, *.example.com, https://app.example.com, http://localhost:3000")),
|
|
6492
|
-
browser: String8("browser").pipe(optional4, withDescription3("Open this session's tabs in the connected browser with this id or name (browse status --json lists them); omit for the default browser"))
|
|
6493
|
-
|
|
6491
|
+
browser: String8("browser").pipe(optional4, withDescription3("Open this session's tabs in the connected browser with this id or name (browse status --json lists them); omit for the default browser")),
|
|
6492
|
+
keepVisible: Boolean4("keep-visible").pipe(withDefault2(false), withDescription3("Keep this session's own tabs visible and focused to the page between execute calls, for apps that pause or disconnect while hidden (pages can notice; tabs you lent it are never kept)"))
|
|
6493
|
+
}, fn("Cli.sessionNew")(function* ({ name, readOnly, allowOrigin, browser, keepVisible }) {
|
|
6494
6494
|
const relay = yield* Service;
|
|
6495
6495
|
yield* ensureCliRelay();
|
|
6496
6496
|
const store = yield* Service3;
|
|
@@ -6498,6 +6498,7 @@ var sessionNew = make("new", {
|
|
|
6498
6498
|
const result = yield* relay.sessionNew(getOrUndefined(name), {
|
|
6499
6499
|
...readOnly ? { readOnly: true } : {},
|
|
6500
6500
|
...allowOrigin.length > 0 ? { allowedOrigins: allowOrigin } : {},
|
|
6501
|
+
...keepVisible ? { keepVisible: true } : {},
|
|
6501
6502
|
...browserValue ? { browser: browserValue } : {}
|
|
6502
6503
|
});
|
|
6503
6504
|
yield* store.write(result.id);
|
package/dist/cli.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
// src/main.ts
|
|
10
10
|
import path from "node:path";
|
|
11
|
-
var embeddedVersion = "0.0.17-dev.
|
|
11
|
+
var embeddedVersion = "0.0.17-dev.182";
|
|
12
12
|
var setupCommands = new Set(["install", "uninstall", "extension", "pair", "set"]);
|
|
13
13
|
var command = process.argv[2];
|
|
14
14
|
var args = process.argv.slice(3);
|
|
@@ -18,26 +18,26 @@ var options = separator === -1 ? args : args.slice(0, separator);
|
|
|
18
18
|
var askedForHelp = command === "--help" || command === "-h" || options.some((arg) => arg === "--help" || arg === "-h");
|
|
19
19
|
var preCliHelp = askedForHelp && (command === "update" || command !== undefined && setupCommands.has(command));
|
|
20
20
|
var oldRuntime = legacyRuntime();
|
|
21
|
-
var takingOver = command === "serve" && !askedForHelp && legacyRuntimeActive(oldRuntime) && await import("./legacy-runtime-
|
|
21
|
+
var takingOver = command === "serve" && !askedForHelp && legacyRuntimeActive(oldRuntime) && await import("./legacy-runtime-6hnptg9g.mjs").then((module) => module.prepareLegacyTakeover(oldRuntime)).catch(() => false);
|
|
22
22
|
if (!takingOver)
|
|
23
23
|
settleLegacyHome(process.env, oldRuntime);
|
|
24
24
|
if (command !== "--version" && command !== "-v" && !askedForHelp && !takingOver && !process.env.OPENCODE_BROWSER_HOME && legacyRootsLeft()) {
|
|
25
25
|
try {
|
|
26
|
-
const { migrateLegacy } = await import("./migrate-
|
|
26
|
+
const { migrateLegacy } = await import("./migrate-bjbv00k0.mjs");
|
|
27
27
|
migrateLegacy();
|
|
28
28
|
} catch {}
|
|
29
29
|
}
|
|
30
30
|
if (command === "--version" || command === "-v") {
|
|
31
|
-
const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-
|
|
31
|
+
const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-qnx1byw6.mjs")).opencodeBrowserVersion;
|
|
32
32
|
process.stdout.write(`${opencodeBrowserVersion}
|
|
33
33
|
`);
|
|
34
|
-
} else if (command === "mcp" && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1" && (await import("./supervisor-
|
|
35
|
-
const { runBinaryMcp } = await import("./supervisor-
|
|
34
|
+
} else if (command === "mcp" && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1" && (await import("./supervisor-vwmswj0w.mjs")).supervisesMcp()) {
|
|
35
|
+
const { runBinaryMcp } = await import("./supervisor-vwmswj0w.mjs");
|
|
36
36
|
await runBinaryMcp(process.argv.slice(3));
|
|
37
37
|
} else if (invokedAs === "opencode-browser-mcp" || command === "mcp" && process.argv.length === 3) {
|
|
38
|
-
const { NodeRuntime } = await import("./index-
|
|
39
|
-
const { defaultTeardown } = await import("./Runtime-
|
|
40
|
-
const { runMcpServer } = await import("./mcp-
|
|
38
|
+
const { NodeRuntime } = await import("./index-gjq7chrk.mjs");
|
|
39
|
+
const { defaultTeardown } = await import("./Runtime-xss8qan1.mjs");
|
|
40
|
+
const { runMcpServer } = await import("./mcp-s4zq3r5e.mjs");
|
|
41
41
|
let stdinGone = false;
|
|
42
42
|
const onStdinGone = () => {
|
|
43
43
|
stdinGone = true;
|
|
@@ -59,13 +59,13 @@ if (command === "--version" || command === "-v") {
|
|
|
59
59
|
})
|
|
60
60
|
}));
|
|
61
61
|
} else if (command === "self-update" || command === "runtime-switch") {
|
|
62
|
-
const { runSelfUpdate, runRuntimeSwitch } = await import("./runtime-update-
|
|
62
|
+
const { runSelfUpdate, runRuntimeSwitch } = await import("./runtime-update-dxb97fdt.mjs");
|
|
63
63
|
await (command === "self-update" ? runSelfUpdate : runRuntimeSwitch)(process.argv.slice(3));
|
|
64
64
|
} else if (command === "update" && !askedForHelp) {
|
|
65
|
-
const { runUpdateCommand } = await import("./update-
|
|
65
|
+
const { runUpdateCommand } = await import("./update-b708rvmn.mjs");
|
|
66
66
|
await runUpdateCommand(process.argv.slice(3));
|
|
67
67
|
} else if (command && setupCommands.has(command) && !askedForHelp) {
|
|
68
|
-
const { runSetup } = await import("./setup-
|
|
68
|
+
const { runSetup } = await import("./setup-mjb2zzdx.mjs");
|
|
69
69
|
await runSetup(command, process.argv.slice(3));
|
|
70
70
|
} else {
|
|
71
71
|
if (preCliHelp || !command || command === "--help" || command === "-h") {
|
|
@@ -102,9 +102,9 @@ executable in ~/.local/bin (or $XDG_BIN_HOME).
|
|
|
102
102
|
`);
|
|
103
103
|
}
|
|
104
104
|
if (command === "status" && !askedForHelp && !process.argv.includes("--json")) {
|
|
105
|
-
const { printSetupStatus } = await import("./setup-
|
|
105
|
+
const { printSetupStatus } = await import("./setup-mjb2zzdx.mjs");
|
|
106
106
|
printSetupStatus();
|
|
107
107
|
}
|
|
108
|
-
const { runCli } = await import("./cli-
|
|
108
|
+
const { runCli } = await import("./cli-29nz7n5s.mjs");
|
|
109
109
|
runCli(preCliHelp ? ["--help"] : undefined);
|
|
110
110
|
}
|
|
@@ -32,9 +32,7 @@ import {
|
|
|
32
32
|
isRestrictedTarget2,
|
|
33
33
|
isRestrictedUrl2,
|
|
34
34
|
dataUrlDocument2
|
|
35
|
-
} from "./main-
|
|
36
|
-
import"./main-4h7rfhhr.mjs";
|
|
37
|
-
import"./main-gg7f12gg.mjs";
|
|
35
|
+
} from "./main-6yn76a8h.mjs";
|
|
38
36
|
export {
|
|
39
37
|
HttpRouteError2 as HttpRouteError,
|
|
40
38
|
chromeExtensionOriginForPath2 as chromeExtensionOriginForPath,
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
exports_NodeRuntime,
|
|
4
4
|
exports_NodeStdio,
|
|
5
5
|
exports_NodeServices
|
|
6
|
-
} from "./main-
|
|
7
|
-
import"./main-
|
|
6
|
+
} from "./main-jeta10c6.mjs";
|
|
7
|
+
import"./main-9frwnsnf.mjs";
|
|
8
8
|
export {
|
|
9
9
|
exports_NodeHttpClient as NodeHttpClient,
|
|
10
10
|
exports_NodeRuntime as NodeRuntime,
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import"./main-6yn76a8h.mjs";
|
|
2
|
+
import {
|
|
3
|
+
installerBinaryPath,
|
|
4
|
+
compiledBinary,
|
|
5
|
+
channelOf,
|
|
6
|
+
installedRuntime2
|
|
7
|
+
} from "./main-6a10pzcy.mjs";
|
|
1
8
|
import {
|
|
2
9
|
legacyRuntimeActive,
|
|
3
10
|
insidePath,
|
|
@@ -5,13 +12,12 @@ import {
|
|
|
5
12
|
} from "./main-pmfd055v.mjs";
|
|
6
13
|
import {
|
|
7
14
|
opencodeBrowserVersion2
|
|
8
|
-
} from "./main-
|
|
15
|
+
} from "./main-4vvyemrj.mjs";
|
|
9
16
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from "./main-awaqqre9.mjs";
|
|
17
|
+
relayPortPinned,
|
|
18
|
+
resolveRelayPort,
|
|
19
|
+
probeRelayPort
|
|
20
|
+
} from "./main-wr4d7914.mjs";
|
|
15
21
|
|
|
16
22
|
// src/setup/legacy-runtime.ts
|
|
17
23
|
import fs from "node:fs";
|
|
@@ -34,10 +40,17 @@ async function prepareLegacyTakeover(legacy, options = {}) {
|
|
|
34
40
|
return false;
|
|
35
41
|
if (env.OPENCODE_BROWSER_HOME && !samePath2(env.OPENCODE_BROWSER_HOME, legacy.root))
|
|
36
42
|
return false;
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
const port = options.relayPort ?? (Number(env.OPENCODE_BROWSER_PORT) || resolveRelayPort());
|
|
44
|
+
if (options.pinned ?? relayPortPinned(env)) {
|
|
45
|
+
if (await portInUse(port))
|
|
46
|
+
return false;
|
|
47
|
+
} else {
|
|
48
|
+
const owner = await probeRelayPort(port);
|
|
49
|
+
if (owner === "browse" || owner === "nobody" && await portInUse(port))
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
39
52
|
const home = options.home ?? os.homedir();
|
|
40
|
-
const { copyLegacyData } = await import("./migrate-
|
|
53
|
+
const { copyLegacyData } = await import("./migrate-bjbv00k0.mjs");
|
|
41
54
|
delete env.OPENCODE_BROWSER_HOME;
|
|
42
55
|
copyLegacyData(home);
|
|
43
56
|
pending = { legacy, install, home };
|
|
@@ -51,7 +64,7 @@ async function commitLegacyTakeover(now = Date.now()) {
|
|
|
51
64
|
try {
|
|
52
65
|
if (!adoptLegacyRuntime(legacy, install, now))
|
|
53
66
|
return false;
|
|
54
|
-
const { migrateLegacy } = await import("./migrate-
|
|
67
|
+
const { migrateLegacy } = await import("./migrate-bjbv00k0.mjs");
|
|
55
68
|
migrateLegacy(home, now);
|
|
56
69
|
return true;
|
|
57
70
|
} catch {
|
|
@@ -94,6 +107,13 @@ function writeForwarder(entry, runtime) {
|
|
|
94
107
|
writeAtomic(entry, ["#!/usr/bin/env node", `${FORWARDER} (${runtime.kind}). Don't edit.`, ...run, ""].join(`
|
|
95
108
|
`));
|
|
96
109
|
}
|
|
110
|
+
function realpath(file) {
|
|
111
|
+
try {
|
|
112
|
+
return fs.realpathSync(file);
|
|
113
|
+
} catch {
|
|
114
|
+
return path.resolve(file);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
97
117
|
function portInUse(port) {
|
|
98
118
|
return new Promise((resolve) => {
|
|
99
119
|
const socket = net.connect({ host: "127.0.0.1", port });
|
|
@@ -102,13 +122,6 @@ function portInUse(port) {
|
|
|
102
122
|
socket.once("error", (error) => resolve(error.code !== "ECONNREFUSED"));
|
|
103
123
|
});
|
|
104
124
|
}
|
|
105
|
-
function realpath(file) {
|
|
106
|
-
try {
|
|
107
|
-
return fs.realpathSync(file);
|
|
108
|
-
} catch {
|
|
109
|
-
return path.resolve(file);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
125
|
function writeAtomic(file, text, mode = 420) {
|
|
113
126
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
114
127
|
fs.writeFileSync(temporary, text, { mode });
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./main-pmfd055v.mjs";
|
|
5
5
|
import {
|
|
6
6
|
opencodeBrowserVersion2
|
|
7
|
-
} from "./main-
|
|
7
|
+
} from "./main-4vvyemrj.mjs";
|
|
8
8
|
|
|
9
9
|
// src/paths.ts
|
|
10
10
|
import fs from "node:fs";
|
|
@@ -114,7 +114,7 @@ function cliInstall() {
|
|
|
114
114
|
return { kind: "binary", binary: installedBinary() ?? process.execPath, pathEnv: process.env.PATH };
|
|
115
115
|
if (fromCheckout())
|
|
116
116
|
return { kind: "checkout", bundle: path.join(packageRoot(), "dist", "cli.mjs") };
|
|
117
|
-
return { kind: "npm", version: "0.0.17-dev.
|
|
117
|
+
return { kind: "npm", version: "0.0.17-dev.182", npx: /[/\\]_npx[/\\]/.test(process.argv[1] ?? "") };
|
|
118
118
|
}
|
|
119
119
|
function cliPrefix(install = cliInstall()) {
|
|
120
120
|
if (install.kind === "binary") {
|
|
@@ -136,7 +136,7 @@ function storeConfig(env = process.env, baked = { id: "mfnicocicmmlkpjnaffgihfjh
|
|
|
136
136
|
return id ? { id } : {};
|
|
137
137
|
}
|
|
138
138
|
var RELEASE_SERVICE = "https://anoma.ly/release";
|
|
139
|
-
function devExtension(baked = { file: "browse-extension-0.0.17-dev.
|
|
139
|
+
function devExtension(baked = { file: "browse-extension-0.0.17-dev.182.zip", sha256: "e2e99ee6f078199d3b5b8224ac5c525e41123b8affd99b9c97164be4b34d33e9", size: 187302 }) {
|
|
140
140
|
return baked && /^[0-9a-f]{64}$/.test(baked.sha256) && /^[\w.-]+\.zip$/.test(baked.file) ? baked : undefined;
|
|
141
141
|
}
|
|
142
142
|
var devExtensionUrl = (extension, env = process.env) => `${(env.OPENCODE_BROWSER_RELEASE_SERVICE || RELEASE_SERVICE).replace(/\/+$/, "")}/browse/files/${extension.sha256}/${extension.file}`;
|
|
@@ -146,6 +146,119 @@ function installCommand() {
|
|
|
146
146
|
return fromCheckout() ? `cd ${quoted(path.dirname(packageRoot()))} && bun run setup` : cliCommand("install");
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
// src/protocol.ts
|
|
150
|
+
var extensionProtocolVersion = 3;
|
|
151
|
+
var minExtensionProtocolVersion = 3;
|
|
152
|
+
var unpackedExtensionId = "afeafocngkodbmaipcngoamamfmekgfo";
|
|
153
|
+
var browserUnresponsive = "The browser isn't answering (asleep, frozen or very busy?). Wake it or wait a moment, then try again.";
|
|
154
|
+
var browserReloading = "browse stopped answering in this browser for over a minute, so the relay asked it to reload. Try again in a few seconds.";
|
|
155
|
+
var unpackedReloadAdvice = "Reload browse on your browser's extensions page (↻).";
|
|
156
|
+
var checkoutReloadPrefix = "Extension protocol incompatible: extension-older; reload ";
|
|
157
|
+
var extensionReconnectAlarmPeriodMs = 30000;
|
|
158
|
+
var legacyExtensionProtocolVersion = 1;
|
|
159
|
+
function extensionProtocolCompatibility(value) {
|
|
160
|
+
const legacy = value === undefined;
|
|
161
|
+
const valid = typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
162
|
+
const version = valid ? value : legacy ? legacyExtensionProtocolVersion : null;
|
|
163
|
+
return { version, compatible: version !== null && version >= minExtensionProtocolVersion && version <= extensionProtocolVersion, legacy };
|
|
164
|
+
}
|
|
165
|
+
function extensionProtocolSkew(version) {
|
|
166
|
+
if (typeof version !== "number")
|
|
167
|
+
return;
|
|
168
|
+
if (version > extensionProtocolVersion)
|
|
169
|
+
return "extension-newer";
|
|
170
|
+
if (version < minExtensionProtocolVersion)
|
|
171
|
+
return "extension-older";
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
function extensionProtocolAdvice(version, commands, distribution) {
|
|
175
|
+
const skew = extensionProtocolSkew(version);
|
|
176
|
+
const versions = `extension protocol ${version ?? "unknown"}, this relay speaks ${minExtensionProtocolVersion === extensionProtocolVersion ? extensionProtocolVersion : `${minExtensionProtocolVersion} to ${extensionProtocolVersion}`}`;
|
|
177
|
+
if (skew === "extension-newer")
|
|
178
|
+
return `The browse extension is newer than this browse CLI (${versions}). Update the CLI: run \`${commands.install}\` (an npm install with automatic updates also catches up by itself within a day), then restart opencode.`;
|
|
179
|
+
if (skew === "extension-older") {
|
|
180
|
+
const store = "The Chrome Web Store updates it within a few hours (to update now, open chrome://extensions, turn on Developer mode and click Update).";
|
|
181
|
+
const next = distribution === "unpacked" ? unpackedReloadAdvice : distribution === "store" ? store : `For an unpacked extension: ${unpackedReloadAdvice} For a store extension: ${store}`;
|
|
182
|
+
return `The browse extension is older than this browse CLI (${versions}). ${next}`;
|
|
183
|
+
}
|
|
184
|
+
return `The browse extension and this browse CLI don't speak the same protocol (${versions}). Run \`${commands.install}\` again and update the extension.`;
|
|
185
|
+
}
|
|
186
|
+
function makePageStatus(options) {
|
|
187
|
+
return {
|
|
188
|
+
state: options.state,
|
|
189
|
+
owner: options.targetOwner === "user" ? "user" : "session",
|
|
190
|
+
...options.sessionId ? { sessionId: options.sessionId } : {},
|
|
191
|
+
...options.sessionId && options.readOnly ? { readOnly: true } : {},
|
|
192
|
+
...options.message ? { message: options.message } : {},
|
|
193
|
+
...options.handoffId ? { handoffId: options.handoffId } : {},
|
|
194
|
+
...options.recording ? { recording: true } : {}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
var extensionCommandMethodValues = [
|
|
198
|
+
"ping",
|
|
199
|
+
"debugger.attach",
|
|
200
|
+
"debugger.detach",
|
|
201
|
+
"debugger.sendCommand",
|
|
202
|
+
"tabs.create",
|
|
203
|
+
"tabs.remove",
|
|
204
|
+
"tabs.group",
|
|
205
|
+
"tabs.ungroup",
|
|
206
|
+
"action.setAttached",
|
|
207
|
+
"action.setBadge",
|
|
208
|
+
"pageStatus.set",
|
|
209
|
+
"pageStatus.clear",
|
|
210
|
+
"runtime.reload",
|
|
211
|
+
"recording.start",
|
|
212
|
+
"recording.stop",
|
|
213
|
+
"recording.status",
|
|
214
|
+
"recording.cancel",
|
|
215
|
+
"tabs.cleanup",
|
|
216
|
+
"update.notice",
|
|
217
|
+
"relay.settings",
|
|
218
|
+
"settings.get",
|
|
219
|
+
"settings.set"
|
|
220
|
+
];
|
|
221
|
+
var extensionEventMethodValues = [
|
|
222
|
+
"protocol",
|
|
223
|
+
"hello",
|
|
224
|
+
"auth.code",
|
|
225
|
+
"auth.response",
|
|
226
|
+
"ready",
|
|
227
|
+
"toolbar.clicked",
|
|
228
|
+
"handoff.completed",
|
|
229
|
+
"debugger.event",
|
|
230
|
+
"debugger.attached",
|
|
231
|
+
"debugger.detached",
|
|
232
|
+
"tabs.removed",
|
|
233
|
+
"tabs.opened",
|
|
234
|
+
"pong",
|
|
235
|
+
"log",
|
|
236
|
+
"recording.cancelled",
|
|
237
|
+
"pageStatus.requested",
|
|
238
|
+
"settings"
|
|
239
|
+
];
|
|
240
|
+
function parseJsonObject(input) {
|
|
241
|
+
const parsed = JSON.parse(input);
|
|
242
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
243
|
+
throw new Error("Expected JSON object");
|
|
244
|
+
}
|
|
245
|
+
return parsed;
|
|
246
|
+
}
|
|
247
|
+
var extensionCommandMethods = new Set(extensionCommandMethodValues);
|
|
248
|
+
var extensionEventMethods = new Set(extensionEventMethodValues);
|
|
249
|
+
function isCdpRequest(input) {
|
|
250
|
+
return typeof input.id === "number" && typeof input.method === "string" && (input.params === undefined || isJsonObject(input.params)) && (input.sessionId === undefined || typeof input.sessionId === "string");
|
|
251
|
+
}
|
|
252
|
+
function isExtensionResponse(input) {
|
|
253
|
+
return typeof input.id === "number" && (input.result === undefined || isJsonObject(input.result)) && (input.error === undefined || typeof input.error === "string") && !(input.result !== undefined && input.error !== undefined);
|
|
254
|
+
}
|
|
255
|
+
function isExtensionEvent(input) {
|
|
256
|
+
return typeof input.method === "string" && extensionEventMethods.has(input.method) && (input.params === undefined || isJsonObject(input.params));
|
|
257
|
+
}
|
|
258
|
+
function isJsonObject(value) {
|
|
259
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
260
|
+
}
|
|
261
|
+
|
|
149
262
|
// src/update/auto-update.ts
|
|
150
263
|
import { spawn, spawnSync } from "node:child_process";
|
|
151
264
|
import { chmodSync as chmodSync2, closeSync, existsSync, mkdirSync as mkdirSync2, mkdtempSync, openSync, readFileSync as readFileSync2, renameSync, rmSync, realpathSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
@@ -807,4 +920,4 @@ function spawnRuntimeChild(runtime, args, onExit, env = process.env) {
|
|
|
807
920
|
}
|
|
808
921
|
}
|
|
809
922
|
|
|
810
|
-
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, updateTarget, npmGlobalRoot, installedVersion, updateState, autoUpdateOverride, storedMode, effectiveMode, setStoredMode, autoUpdateStatus, describeAutoUpdate, updateAvailable, runCommand, registryUrl, fetchPublished, runInstaller, createAutoUpdater };
|
|
923
|
+
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, extensionProtocolVersion, minExtensionProtocolVersion, unpackedExtensionId, browserUnresponsive, browserReloading, unpackedReloadAdvice, checkoutReloadPrefix, extensionReconnectAlarmPeriodMs, extensionProtocolCompatibility, extensionProtocolSkew, extensionProtocolAdvice, makePageStatus, parseJsonObject, isCdpRequest, isExtensionResponse, isExtensionEvent, isJsonObject, runningServiceTarget, releaseChannel, checkRelease, autoUpdateModes, UPDATE_VERSION, channelOf, compareVersions, installedRuntime2, updateTarget, npmGlobalRoot, installedVersion, updateState, autoUpdateOverride, storedMode, effectiveMode, setStoredMode, autoUpdateStatus, describeAutoUpdate, updateAvailable, runCommand, registryUrl, fetchPublished, runInstaller, createAutoUpdater };
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
|
+
pipeArguments,
|
|
3
|
+
Prototype,
|
|
4
|
+
Class3,
|
|
5
|
+
dual,
|
|
6
|
+
identity,
|
|
7
|
+
memoize,
|
|
8
|
+
memoizeIdempotent,
|
|
9
|
+
isString,
|
|
10
|
+
isNumber,
|
|
11
|
+
isBoolean,
|
|
12
|
+
isPropertyKey,
|
|
13
|
+
isFunction,
|
|
14
|
+
isNotUndefined,
|
|
15
|
+
isNotNullish,
|
|
16
|
+
isNever,
|
|
17
|
+
isUnknown,
|
|
18
|
+
isObject,
|
|
19
|
+
isObjectKeyword,
|
|
20
|
+
hasProperty,
|
|
21
|
+
isTagged,
|
|
22
|
+
isError,
|
|
2
23
|
equals,
|
|
3
24
|
format,
|
|
4
25
|
formatPropertyKey,
|
|
@@ -65,33 +86,10 @@ import {
|
|
|
65
86
|
mapBothEager,
|
|
66
87
|
flatMapEager,
|
|
67
88
|
fnUntracedEager
|
|
68
|
-
} from "./main-
|
|
69
|
-
import {
|
|
70
|
-
pipeArguments,
|
|
71
|
-
Prototype2,
|
|
72
|
-
Class4,
|
|
73
|
-
dual,
|
|
74
|
-
identity,
|
|
75
|
-
memoize,
|
|
76
|
-
memoizeIdempotent,
|
|
77
|
-
isString,
|
|
78
|
-
isNumber,
|
|
79
|
-
isBoolean,
|
|
80
|
-
isPropertyKey,
|
|
81
|
-
isFunction,
|
|
82
|
-
isNotUndefined,
|
|
83
|
-
isNotNullish,
|
|
84
|
-
isNever,
|
|
85
|
-
isUnknown,
|
|
86
|
-
isObject,
|
|
87
|
-
isObjectKeyword,
|
|
88
|
-
hasProperty,
|
|
89
|
-
isTagged,
|
|
90
|
-
isError
|
|
91
|
-
} from "./main-qazf3bhk.mjs";
|
|
89
|
+
} from "./main-m45zegrn.mjs";
|
|
92
90
|
|
|
93
91
|
// node_modules/effect/dist/Data.js
|
|
94
|
-
var Class = class extends
|
|
92
|
+
var Class = class extends Class3 {
|
|
95
93
|
constructor(props) {
|
|
96
94
|
super();
|
|
97
95
|
if (props) {
|
|
@@ -509,7 +507,7 @@ function getSchemaIssueOrThrow(cause, message) {
|
|
|
509
507
|
}
|
|
510
508
|
|
|
511
509
|
// node_modules/effect/dist/SchemaGetter.js
|
|
512
|
-
var makeGetter = (fields) => Object.assign(Object.create(
|
|
510
|
+
var makeGetter = (fields) => Object.assign(Object.create(Prototype), fields);
|
|
513
511
|
var passthrough_ = /* @__PURE__ */ makeGetter({
|
|
514
512
|
_tag: "Passthrough"
|
|
515
513
|
});
|
|
@@ -563,7 +561,7 @@ function decodeBase64() {
|
|
|
563
561
|
|
|
564
562
|
// node_modules/effect/dist/SchemaTransformation.js
|
|
565
563
|
var TypeId2 = "~effect/SchemaTransformation/Transformation";
|
|
566
|
-
var Transformation = class extends
|
|
564
|
+
var Transformation = class extends Class3 {
|
|
567
565
|
[TypeId2] = TypeId2;
|
|
568
566
|
_tag = "Transformation";
|
|
569
567
|
decode;
|
|
@@ -1986,7 +1984,7 @@ function formatIsMutable(isMutable) {
|
|
|
1986
1984
|
function formatIsOptional(isOptional) {
|
|
1987
1985
|
return isOptional ? "?" : "";
|
|
1988
1986
|
}
|
|
1989
|
-
var Filter2 = class extends
|
|
1987
|
+
var Filter2 = class extends Class3 {
|
|
1990
1988
|
_tag = "Filter";
|
|
1991
1989
|
run;
|
|
1992
1990
|
annotations;
|
|
@@ -2010,7 +2008,7 @@ var Filter2 = class extends Class4 {
|
|
|
2010
2008
|
return new FilterGroup([this, other], annotations);
|
|
2011
2009
|
}
|
|
2012
2010
|
};
|
|
2013
|
-
var FilterGroup = class extends
|
|
2011
|
+
var FilterGroup = class extends Class3 {
|
|
2014
2012
|
_tag = "FilterGroup";
|
|
2015
2013
|
checks;
|
|
2016
2014
|
annotations;
|