@opencode/browse 0.0.17-dev.162 → 0.0.17-dev.163
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-kyjz2fv6.mjs → cli-qr4zcy16.mjs} +13 -11
- package/dist/cli.mjs +22 -16
- package/dist/{helpers-mrhgzkhv.mjs → helpers-53gpkz0t.mjs} +1 -1
- package/dist/{index-7d47yfra.mjs → index-yaf37ery.mjs} +1 -1
- package/dist/legacy-runtime-hzc0n6fb.mjs +120 -0
- package/dist/{main-dryenht1.mjs → main-21qy8kmb.mjs} +1 -1
- package/dist/{main-kf317tn1.mjs → main-2hjf3ynh.mjs} +2 -2
- package/dist/{main-zhsha1kp.mjs → main-avsbn8a7.mjs} +2 -2
- package/dist/{main-hw4metyv.mjs → main-azbyg2h1.mjs} +1 -1
- package/dist/{main-ca27zwnv.mjs → main-bn9skafd.mjs} +35 -10
- package/dist/{main-h0zg8zzs.mjs → main-g9wttfh5.mjs} +3 -3
- package/dist/main-j8f19mw5.mjs +4 -0
- package/dist/{main-vw10y6h5.mjs → main-kdpdxkk2.mjs} +4 -4
- package/dist/{main-35yka6tb.mjs → main-n52th9gj.mjs} +7 -10
- package/dist/main-pmfd055v.mjs +63 -0
- package/dist/{main-tdj3qe8t.mjs → main-rrfp644p.mjs} +1 -1
- package/dist/{main-qms4y514.mjs → main-xk9hcdb6.mjs} +2 -2
- package/dist/{mcp-fxzgqcf9.mjs → mcp-n8h723wv.mjs} +9 -8
- package/dist/{migrate-ez1zc343.mjs → migrate-0gw32zk6.mjs} +126 -17
- package/dist/{relay-5s01yjxf.mjs → relay-mj9bz4hk.mjs} +18 -18
- package/dist/{runtime-update-hgzht45w.mjs → runtime-update-c1fyht56.mjs} +9 -6
- package/dist/{setup-337p0qbr.mjs → setup-z1zgxd53.mjs} +8 -7
- package/dist/{supervisor-ebc531b3.mjs → supervisor-dfgq7zk2.mjs} +4 -3
- package/dist/{update-j68jekpe.mjs → update-8pej35zc.mjs} +4 -3
- package/dist/{version-r8hstwyb.mjs → version-rqeap5xg.mjs} +1 -1
- package/package.json +1 -1
- package/dist/main-7dea1z95.mjs +0 -4
- package/dist/main-ckssvk4c.mjs +0 -18
- /package/dist/{main-bc8cjey0.mjs → main-jf7jberd.mjs} +0 -0
|
@@ -14,17 +14,18 @@ import {
|
|
|
14
14
|
Terminal,
|
|
15
15
|
runMain,
|
|
16
16
|
layer2
|
|
17
|
-
} from "./main-
|
|
17
|
+
} from "./main-jf7jberd.mjs";
|
|
18
18
|
import {
|
|
19
19
|
ExitCode,
|
|
20
20
|
failure,
|
|
21
21
|
takeJsonFlag,
|
|
22
22
|
printJson
|
|
23
23
|
} from "./main-tk4axre7.mjs";
|
|
24
|
+
import"./main-pmfd055v.mjs";
|
|
24
25
|
import {
|
|
25
26
|
opencodeBrowserVersion2,
|
|
26
27
|
opencodeBrowserBuildId2
|
|
27
|
-
} from "./main-
|
|
28
|
+
} from "./main-j8f19mw5.mjs";
|
|
28
29
|
import {
|
|
29
30
|
configRoot2,
|
|
30
31
|
dataRoot,
|
|
@@ -37,7 +38,7 @@ import {
|
|
|
37
38
|
devExtension,
|
|
38
39
|
installCommand,
|
|
39
40
|
autoUpdateStatus
|
|
40
|
-
} from "./main-
|
|
41
|
+
} from "./main-bn9skafd.mjs";
|
|
41
42
|
import {
|
|
42
43
|
extensionProtocolVersion,
|
|
43
44
|
extensionProtocolAdvice
|
|
@@ -63,29 +64,29 @@ import {
|
|
|
63
64
|
ensureExtensionConnected,
|
|
64
65
|
stoppedRelayStatus,
|
|
65
66
|
statusCollections
|
|
66
|
-
} from "./main-
|
|
67
|
+
} from "./main-kdpdxkk2.mjs";
|
|
67
68
|
import"./main-4h7rfhhr.mjs";
|
|
68
69
|
import {
|
|
69
70
|
updateJson2,
|
|
70
71
|
formatUpdateNotice2,
|
|
71
72
|
updateNotice2
|
|
72
|
-
} from "./main-
|
|
73
|
+
} from "./main-avsbn8a7.mjs";
|
|
73
74
|
import {
|
|
74
75
|
settingKeys,
|
|
75
76
|
formatSettings,
|
|
76
77
|
ensureSessionExists
|
|
77
|
-
} from "./main-
|
|
78
|
+
} from "./main-g9wttfh5.mjs";
|
|
78
79
|
import {
|
|
79
80
|
addSecret,
|
|
80
81
|
listSecrets,
|
|
81
82
|
removeSecret
|
|
82
|
-
} from "./main-
|
|
83
|
+
} from "./main-azbyg2h1.mjs";
|
|
83
84
|
import {
|
|
84
85
|
defaultJournalBaseDir,
|
|
85
86
|
readJournalEntries,
|
|
86
87
|
formatJournalEntry
|
|
87
|
-
} from "./main-
|
|
88
|
-
import"./main-
|
|
88
|
+
} from "./main-2hjf3ynh.mjs";
|
|
89
|
+
import"./main-rrfp644p.mjs";
|
|
89
90
|
import {
|
|
90
91
|
taggedEnum,
|
|
91
92
|
is2,
|
|
@@ -5843,7 +5844,7 @@ var status = make("status", {
|
|
|
5843
5844
|
}
|
|
5844
5845
|
})).pipe(withDescription4("Show relay, extension, and target status"));
|
|
5845
5846
|
var mcp = make("mcp", {}, fn("Cli.mcp")(function* () {
|
|
5846
|
-
const { runMcpServer } = yield* promise(() => import("./mcp-
|
|
5847
|
+
const { runMcpServer } = yield* promise(() => import("./mcp-n8h723wv.mjs"));
|
|
5847
5848
|
yield* runMcpServer;
|
|
5848
5849
|
})).pipe(withDescription4("Run the browse MCP server over stdio"));
|
|
5849
5850
|
registerCliCommand(400, () => tabs);
|
|
@@ -6291,11 +6292,12 @@ registerCliCommand(710, () => flightRecorder);
|
|
|
6291
6292
|
|
|
6292
6293
|
// src/cli/relay.ts
|
|
6293
6294
|
var serve = make("serve", {}, fn("Cli.serve")(function* () {
|
|
6294
|
-
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-
|
|
6295
|
+
const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-mj9bz4hk.mjs"), import("./helpers-53gpkz0t.mjs")]));
|
|
6295
6296
|
const port = yield* portConfig;
|
|
6296
6297
|
const additionalExtensionOrigins = parseAdditionalExtensionOrigins(yield* extensionOriginsConfig);
|
|
6297
6298
|
yield* scoped(gen(function* () {
|
|
6298
6299
|
const relay = yield* startRelay({ port, additionalExtensionOrigins });
|
|
6300
|
+
yield* promise(() => import("./legacy-runtime-hzc0n6fb.mjs").then((module) => module.commitLegacyTakeover()));
|
|
6299
6301
|
yield* log(`browse relay listening at ${relay.url}`);
|
|
6300
6302
|
yield* log(`browse connects automatically while the browser runs. Run \`${cliCommand("status")}\` to check.`);
|
|
6301
6303
|
yield* never;
|
package/dist/cli.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
legacyRootsLeft,
|
|
4
|
+
legacyRuntime,
|
|
5
|
+
legacyRuntimeActive,
|
|
6
|
+
settleLegacyHome
|
|
7
|
+
} from "./main-pmfd055v.mjs";
|
|
5
8
|
|
|
6
9
|
// src/main.ts
|
|
7
|
-
import fs from "node:fs";
|
|
8
10
|
import path from "node:path";
|
|
9
|
-
var embeddedVersion = "0.0.17-dev.
|
|
11
|
+
var embeddedVersion = "0.0.17-dev.163";
|
|
10
12
|
var setupCommands = new Set(["install", "uninstall", "extension", "pair", "set"]);
|
|
11
13
|
var command = process.argv[2];
|
|
12
14
|
var args = process.argv.slice(3);
|
|
@@ -15,23 +17,27 @@ var separator = args.indexOf("--");
|
|
|
15
17
|
var options = separator === -1 ? args : args.slice(0, separator);
|
|
16
18
|
var askedForHelp = command === "--help" || command === "-h" || options.some((arg) => arg === "--help" || arg === "-h");
|
|
17
19
|
var preCliHelp = askedForHelp && (command === "update" || command !== undefined && setupCommands.has(command));
|
|
18
|
-
|
|
20
|
+
var oldRuntime = legacyRuntime();
|
|
21
|
+
var takingOver = command === "serve" && !askedForHelp && legacyRuntimeActive(oldRuntime) && await import("./legacy-runtime-hzc0n6fb.mjs").then((module) => module.prepareLegacyTakeover(oldRuntime)).catch(() => false);
|
|
22
|
+
if (!takingOver)
|
|
23
|
+
settleLegacyHome(process.env, oldRuntime);
|
|
24
|
+
if (command !== "--version" && command !== "-v" && !askedForHelp && !takingOver && !process.env.OPENCODE_BROWSER_HOME && legacyRootsLeft()) {
|
|
19
25
|
try {
|
|
20
|
-
const { migrateLegacy } = await import("./migrate-
|
|
26
|
+
const { migrateLegacy } = await import("./migrate-0gw32zk6.mjs");
|
|
21
27
|
migrateLegacy();
|
|
22
28
|
} catch {}
|
|
23
29
|
}
|
|
24
30
|
if (command === "--version" || command === "-v") {
|
|
25
|
-
const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-
|
|
31
|
+
const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-rqeap5xg.mjs")).opencodeBrowserVersion;
|
|
26
32
|
process.stdout.write(`${opencodeBrowserVersion}
|
|
27
33
|
`);
|
|
28
|
-
} else if (command === "mcp" && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1" && (await import("./supervisor-
|
|
29
|
-
const { runBinaryMcp } = await import("./supervisor-
|
|
34
|
+
} else if (command === "mcp" && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1" && (await import("./supervisor-dfgq7zk2.mjs")).supervisesMcp()) {
|
|
35
|
+
const { runBinaryMcp } = await import("./supervisor-dfgq7zk2.mjs");
|
|
30
36
|
await runBinaryMcp(process.argv.slice(3));
|
|
31
37
|
} else if (invokedAs === "opencode-browser-mcp" || command === "mcp" && process.argv.length === 3) {
|
|
32
|
-
const { NodeRuntime } = await import("./index-
|
|
38
|
+
const { NodeRuntime } = await import("./index-yaf37ery.mjs");
|
|
33
39
|
const { defaultTeardown } = await import("./Runtime-qfc1eg1n.mjs");
|
|
34
|
-
const { runMcpServer } = await import("./mcp-
|
|
40
|
+
const { runMcpServer } = await import("./mcp-n8h723wv.mjs");
|
|
35
41
|
let stdinGone = false;
|
|
36
42
|
const onStdinGone = () => {
|
|
37
43
|
stdinGone = true;
|
|
@@ -53,13 +59,13 @@ if (command === "--version" || command === "-v") {
|
|
|
53
59
|
})
|
|
54
60
|
}));
|
|
55
61
|
} else if (command === "self-update" || command === "runtime-switch") {
|
|
56
|
-
const { runSelfUpdate, runRuntimeSwitch } = await import("./runtime-update-
|
|
62
|
+
const { runSelfUpdate, runRuntimeSwitch } = await import("./runtime-update-c1fyht56.mjs");
|
|
57
63
|
await (command === "self-update" ? runSelfUpdate : runRuntimeSwitch)(process.argv.slice(3));
|
|
58
64
|
} else if (command === "update" && !askedForHelp) {
|
|
59
|
-
const { runUpdateCommand } = await import("./update-
|
|
65
|
+
const { runUpdateCommand } = await import("./update-8pej35zc.mjs");
|
|
60
66
|
await runUpdateCommand(process.argv.slice(3));
|
|
61
67
|
} else if (command && setupCommands.has(command) && !askedForHelp) {
|
|
62
|
-
const { runSetup } = await import("./setup-
|
|
68
|
+
const { runSetup } = await import("./setup-z1zgxd53.mjs");
|
|
63
69
|
await runSetup(command, process.argv.slice(3));
|
|
64
70
|
} else {
|
|
65
71
|
if (preCliHelp || !command || command === "--help" || command === "-h") {
|
|
@@ -96,9 +102,9 @@ executable in ~/.local/bin (or $XDG_BIN_HOME).
|
|
|
96
102
|
`);
|
|
97
103
|
}
|
|
98
104
|
if (command === "status" && !askedForHelp && !process.argv.includes("--json")) {
|
|
99
|
-
const { printSetupStatus } = await import("./setup-
|
|
105
|
+
const { printSetupStatus } = await import("./setup-z1zgxd53.mjs");
|
|
100
106
|
printSetupStatus();
|
|
101
107
|
}
|
|
102
|
-
const { runCli } = await import("./cli-
|
|
108
|
+
const { runCli } = await import("./cli-qr4zcy16.mjs");
|
|
103
109
|
runCli(preCliHelp ? ["--help"] : undefined);
|
|
104
110
|
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import {
|
|
2
|
+
legacyRuntimeActive,
|
|
3
|
+
insidePath,
|
|
4
|
+
samePath2
|
|
5
|
+
} from "./main-pmfd055v.mjs";
|
|
6
|
+
import {
|
|
7
|
+
opencodeBrowserVersion2
|
|
8
|
+
} from "./main-j8f19mw5.mjs";
|
|
9
|
+
import {
|
|
10
|
+
installerBinaryPath,
|
|
11
|
+
compiledBinary,
|
|
12
|
+
channelOf,
|
|
13
|
+
installedRuntime2
|
|
14
|
+
} from "./main-bn9skafd.mjs";
|
|
15
|
+
|
|
16
|
+
// src/setup/legacy-runtime.ts
|
|
17
|
+
import fs from "node:fs";
|
|
18
|
+
import net from "node:net";
|
|
19
|
+
import os from "node:os";
|
|
20
|
+
import path from "node:path";
|
|
21
|
+
var FORWARDER = "// browse: this old runtime folder runs the current install";
|
|
22
|
+
var legacyEntry = (root, version) => path.join(root, "runtime", "versions", version, "node_modules", "@opencode", "browse", "dist", "cli.mjs");
|
|
23
|
+
function currentInstall(options = {}) {
|
|
24
|
+
if (!(options.compiled ?? compiledBinary()))
|
|
25
|
+
return installedRuntime2();
|
|
26
|
+
const binary = installerBinaryPath(options.home);
|
|
27
|
+
return realpath(binary) === realpath(options.execPath ?? process.execPath) ? { kind: "binary", entry: binary, version: opencodeBrowserVersion2 } : undefined;
|
|
28
|
+
}
|
|
29
|
+
var pending;
|
|
30
|
+
async function prepareLegacyTakeover(legacy, options = {}) {
|
|
31
|
+
const env = options.env ?? process.env;
|
|
32
|
+
const install = "install" in options ? options.install : currentInstall();
|
|
33
|
+
if (!legacy || !legacyRuntimeActive(legacy) || !install || install.kind === "npx" || insidePath(install.entry, legacy.root))
|
|
34
|
+
return false;
|
|
35
|
+
if (env.OPENCODE_BROWSER_HOME && !samePath2(env.OPENCODE_BROWSER_HOME, legacy.root))
|
|
36
|
+
return false;
|
|
37
|
+
if (await portInUse(Number(env.OPENCODE_BROWSER_PORT) || 19988))
|
|
38
|
+
return false;
|
|
39
|
+
const home = options.home ?? os.homedir();
|
|
40
|
+
const { copyLegacyData } = await import("./migrate-0gw32zk6.mjs");
|
|
41
|
+
delete env.OPENCODE_BROWSER_HOME;
|
|
42
|
+
copyLegacyData(home);
|
|
43
|
+
pending = { legacy, install, home };
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
async function commitLegacyTakeover(now = Date.now()) {
|
|
47
|
+
if (!pending)
|
|
48
|
+
return false;
|
|
49
|
+
const { legacy, install, home } = pending;
|
|
50
|
+
pending = undefined;
|
|
51
|
+
try {
|
|
52
|
+
if (!adoptLegacyRuntime(legacy, install, now))
|
|
53
|
+
return false;
|
|
54
|
+
const { migrateLegacy } = await import("./migrate-0gw32zk6.mjs");
|
|
55
|
+
migrateLegacy(home, now);
|
|
56
|
+
return true;
|
|
57
|
+
} catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function adoptLegacyRuntime(legacy, runtime = currentInstall(), now = Date.now()) {
|
|
62
|
+
if (!legacy || !legacyRuntimeActive(legacy) || !runtime || runtime.kind === "npx" || insidePath(runtime.entry, legacy.root))
|
|
63
|
+
return false;
|
|
64
|
+
const entry = legacyEntry(legacy.root, runtime.version);
|
|
65
|
+
if (!fs.existsSync(entry) || fs.readFileSync(entry, "utf8").includes(FORWARDER))
|
|
66
|
+
writeForwarder(entry, runtime);
|
|
67
|
+
writeAtomic(path.join(legacy.root, "runtime", "current.json"), JSON.stringify({
|
|
68
|
+
version: runtime.version,
|
|
69
|
+
previous: legacy.version,
|
|
70
|
+
channel: channelOf(runtime.version),
|
|
71
|
+
switchedAt: new Date(now).toISOString(),
|
|
72
|
+
movedTo: runtime.entry
|
|
73
|
+
}, null, 2) + `
|
|
74
|
+
`, 384);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
function writeForwarder(entry, runtime) {
|
|
78
|
+
const packageDir = path.dirname(path.dirname(entry));
|
|
79
|
+
fs.mkdirSync(path.dirname(entry), { recursive: true });
|
|
80
|
+
writeAtomic(path.join(packageDir, "package.json"), JSON.stringify({ name: "@opencode/browse", version: runtime.version, private: true }) + `
|
|
81
|
+
`);
|
|
82
|
+
const target = JSON.stringify(runtime.entry);
|
|
83
|
+
const run = runtime.kind === "binary" ? [
|
|
84
|
+
`import { spawn } from "node:child_process"`,
|
|
85
|
+
`const child = spawn(${target}, process.argv.slice(2), { stdio: "inherit" })`,
|
|
86
|
+
`for (const signal of ["SIGTERM", "SIGINT"]) process.on(signal, () => child.kill(signal))`,
|
|
87
|
+
`child.on("exit", (code, signal) => { process.exitCode = code ?? (signal ? 1 : 0) })`
|
|
88
|
+
] : [
|
|
89
|
+
`import { pathToFileURL } from "node:url"`,
|
|
90
|
+
`if (process.env.OPENCODE_BROWSER_CLIENT_PID === String(process.ppid)) delete process.env.OPENCODE_BROWSER_CLIENT_PID`,
|
|
91
|
+
`process.argv[1] = ${target}`,
|
|
92
|
+
`await import(pathToFileURL(${target}).href)`
|
|
93
|
+
];
|
|
94
|
+
writeAtomic(entry, ["#!/usr/bin/env node", `${FORWARDER} (${runtime.kind}). Don't edit.`, ...run, ""].join(`
|
|
95
|
+
`));
|
|
96
|
+
}
|
|
97
|
+
function portInUse(port) {
|
|
98
|
+
return new Promise((resolve) => {
|
|
99
|
+
const socket = net.connect({ host: "127.0.0.1", port });
|
|
100
|
+
socket.setTimeout(1000, () => (socket.destroy(), resolve(true)));
|
|
101
|
+
socket.once("connect", () => (socket.destroy(), resolve(true)));
|
|
102
|
+
socket.once("error", (error) => resolve(error.code !== "ECONNREFUSED"));
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function realpath(file) {
|
|
106
|
+
try {
|
|
107
|
+
return fs.realpathSync(file);
|
|
108
|
+
} catch {
|
|
109
|
+
return path.resolve(file);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function writeAtomic(file, text, mode = 420) {
|
|
113
|
+
const temporary = `${file}.${process.pid}.tmp`;
|
|
114
|
+
fs.writeFileSync(temporary, text, { mode });
|
|
115
|
+
fs.renameSync(temporary, file);
|
|
116
|
+
}
|
|
117
|
+
export {
|
|
118
|
+
commitLegacyTakeover,
|
|
119
|
+
prepareLegacyTakeover
|
|
120
|
+
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./main-4h7rfhhr.mjs";
|
|
4
4
|
import {
|
|
5
5
|
isValidSessionId2
|
|
6
|
-
} from "./main-
|
|
6
|
+
} from "./main-kdpdxkk2.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-bn9skafd.mjs";
|
|
23
23
|
|
|
24
24
|
// src/session-manager/journal.ts
|
|
25
25
|
import fs from "node:fs";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
installedRuntime2,
|
|
7
7
|
autoUpdateStatus,
|
|
8
8
|
updateAvailable
|
|
9
|
-
} from "./main-
|
|
9
|
+
} from "./main-bn9skafd.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-c1fyht56.mjs");
|
|
319
319
|
if (await runInstalledUpdate(args))
|
|
320
320
|
return;
|
|
321
321
|
if (compiledBinary()) {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
legacyDataRoot,
|
|
3
|
+
insidePath
|
|
4
|
+
} from "./main-pmfd055v.mjs";
|
|
1
5
|
import {
|
|
2
6
|
opencodeBrowserVersion2
|
|
3
|
-
} from "./main-
|
|
7
|
+
} from "./main-j8f19mw5.mjs";
|
|
4
8
|
|
|
5
9
|
// src/paths.ts
|
|
6
10
|
import fs from "node:fs";
|
|
@@ -110,7 +114,7 @@ function cliInstall() {
|
|
|
110
114
|
return { kind: "binary", binary: installedBinary() ?? process.execPath, pathEnv: process.env.PATH };
|
|
111
115
|
if (fromCheckout())
|
|
112
116
|
return { kind: "checkout", bundle: path.join(packageRoot(), "dist", "cli.mjs") };
|
|
113
|
-
return { kind: "npm", version: "0.0.17-dev.
|
|
117
|
+
return { kind: "npm", version: "0.0.17-dev.163", npx: /[/\\]_npx[/\\]/.test(process.argv[1] ?? "") };
|
|
114
118
|
}
|
|
115
119
|
function cliPrefix(install = cliInstall()) {
|
|
116
120
|
if (install.kind === "binary") {
|
|
@@ -132,7 +136,7 @@ function storeConfig(env = process.env, baked = { id: "mfnicocicmmlkpjnaffgihfjh
|
|
|
132
136
|
return id ? { id } : {};
|
|
133
137
|
}
|
|
134
138
|
var RELEASE_SERVICE = "https://anoma.ly/release";
|
|
135
|
-
function devExtension(baked = { file: "browse-extension-0.0.17-dev.
|
|
139
|
+
function devExtension(baked = { file: "browse-extension-0.0.17-dev.163.zip", sha256: "d86726472c91ce3ff17ac1a952e91f88429cade46e0317de2f1b8a8df8fb4854", size: 184210 }) {
|
|
136
140
|
return baked && /^[0-9a-f]{64}$/.test(baked.sha256) && /^[\w.-]+\.zip$/.test(baked.file) ? baked : undefined;
|
|
137
141
|
}
|
|
138
142
|
var devExtensionUrl = (extension, env = process.env) => `${(env.OPENCODE_BROWSER_RELEASE_SERVICE || RELEASE_SERVICE).replace(/\/+$/, "")}/browse/files/${extension.sha256}/${extension.file}`;
|
|
@@ -419,6 +423,17 @@ function installedRuntime2(entry = process.argv[1] ?? process.execPath) {
|
|
|
419
423
|
const resolved = realEntry(entry);
|
|
420
424
|
return { kind, entry: resolved, version: packageVersion(resolved) ?? opencodeBrowserVersion2 };
|
|
421
425
|
}
|
|
426
|
+
async function updateTarget(runtime, run = runCommand, env = process.env) {
|
|
427
|
+
if (runtime.kind !== "npm" || !insidePath(runtime.entry, path3.join(legacyDataRoot(), "runtime", "versions")))
|
|
428
|
+
return runtime;
|
|
429
|
+
const root = await npmGlobalRoot(run, env);
|
|
430
|
+
return root ? { ...runtime, entry: path3.join(root, ...PACKAGE_NAME.split("/"), "dist", "cli.mjs") } : undefined;
|
|
431
|
+
}
|
|
432
|
+
async function npmGlobalRoot(run = runCommand, env = process.env) {
|
|
433
|
+
const result = await run("npm", ["root", "-g"], { timeoutMs: 20000, env });
|
|
434
|
+
const root = result.status === 0 ? result.stdout.trim() : "";
|
|
435
|
+
return root && path3.isAbsolute(root) ? root : undefined;
|
|
436
|
+
}
|
|
422
437
|
function installedVersion(runtime) {
|
|
423
438
|
if (runtime.kind === "binary") {
|
|
424
439
|
const result = spawnSync(runtime.entry, ["--version"], { encoding: "utf8", timeout: 15000, env: { ...process.env, OPENCODE_BROWSER_AUTOSTART: "0" }, windowsHide: true });
|
|
@@ -562,7 +577,13 @@ async function runInstaller(options) {
|
|
|
562
577
|
if (npm.status !== 0)
|
|
563
578
|
throw new Error(`npm install -g ${spec} failed: ${(npm.stderr || npm.stdout).trim().split(`
|
|
564
579
|
`).slice(-3).join(" ")}`);
|
|
565
|
-
const
|
|
580
|
+
const target = await updateTarget(options.runtime, run, env);
|
|
581
|
+
if (!target)
|
|
582
|
+
throw new Error(`npm install -g ${spec} ran, but \`npm root -g\` didn't say where it installed`);
|
|
583
|
+
const found = existsSync(target.entry) ? installedVersion(target) : undefined;
|
|
584
|
+
if (!found && target !== options.runtime)
|
|
585
|
+
throw new Error(`npm install -g ${spec} ran, but ${target.entry} isn't there`);
|
|
586
|
+
const version = found ?? options.version ?? options.channel ?? "latest";
|
|
566
587
|
if (options.version && compareVersions(version, options.version) < 0)
|
|
567
588
|
throw new Error(`npm install -g ${spec} left ${version}, not the requested ${options.version}`);
|
|
568
589
|
return version;
|
|
@@ -614,7 +635,8 @@ function createAutoUpdater(deps) {
|
|
|
614
635
|
const { runtime } = deps;
|
|
615
636
|
const running = runtime.version;
|
|
616
637
|
const checkIntervalMs = Math.min(Number(env.OPENCODE_BROWSER_AUTO_UPDATE_INTERVAL_MS) || HOUR_MS, HOUR_MS);
|
|
617
|
-
const spawnChild = deps.spawnChild ?? ((args, onExit) => spawnRuntimeChild(
|
|
638
|
+
const spawnChild = deps.spawnChild ?? ((args, onExit, from) => spawnRuntimeChild(from, args, onExit, env));
|
|
639
|
+
let updates;
|
|
618
640
|
let busy = false;
|
|
619
641
|
let switching;
|
|
620
642
|
let timer;
|
|
@@ -685,12 +707,15 @@ function createAutoUpdater(deps) {
|
|
|
685
707
|
}
|
|
686
708
|
if (!wanted || mode !== "on")
|
|
687
709
|
return;
|
|
710
|
+
updates ??= await updateTarget(runtime, deps.run ?? runCommand, env);
|
|
711
|
+
if (!updates)
|
|
712
|
+
return void deps.log("autoupdate.no_target", { reason: "npm root -g failed" });
|
|
688
713
|
const installing = state.installing;
|
|
689
714
|
if (installing) {
|
|
690
715
|
const alive = processAlive(installing.pid) && now() - installing.startedAt < INSTALL_TIMEOUT_MS;
|
|
691
716
|
if (alive)
|
|
692
717
|
return;
|
|
693
|
-
const installed = installedVersion(
|
|
718
|
+
const installed = installedVersion(updates);
|
|
694
719
|
state = updateState(({ installing: _installing, ...rest }) => ({
|
|
695
720
|
...rest,
|
|
696
721
|
...installed && installed !== running ? {} : { lastError: { message: "the installer stopped without finishing", at: new Date(now()).toISOString(), version: installing.version } }
|
|
@@ -699,7 +724,7 @@ function createAutoUpdater(deps) {
|
|
|
699
724
|
}
|
|
700
725
|
if (!deps.isIdle())
|
|
701
726
|
return;
|
|
702
|
-
const installed = installedVersion(
|
|
727
|
+
const installed = installedVersion(updates);
|
|
703
728
|
if (installed === wanted) {
|
|
704
729
|
switching = { pid: undefined, startedAt: now() };
|
|
705
730
|
deps.log("autoupdate.switching", { from: running, to: installed });
|
|
@@ -709,7 +734,7 @@ function createAutoUpdater(deps) {
|
|
|
709
734
|
if (code !== 0)
|
|
710
735
|
deps.log("autoupdate.restart_refused", { version: installed, code });
|
|
711
736
|
deps.onChange?.();
|
|
712
|
-
});
|
|
737
|
+
}, updates);
|
|
713
738
|
return;
|
|
714
739
|
}
|
|
715
740
|
if (state.lastError?.version === wanted) {
|
|
@@ -741,7 +766,7 @@ function createAutoUpdater(deps) {
|
|
|
741
766
|
deps.onChange?.();
|
|
742
767
|
if (code === 0)
|
|
743
768
|
tick();
|
|
744
|
-
});
|
|
769
|
+
}, runtime);
|
|
745
770
|
if (pid)
|
|
746
771
|
updateState((rest) => ({ ...rest, installing: { version: wanted, pid, startedAt } }));
|
|
747
772
|
} catch (error) {
|
|
@@ -782,4 +807,4 @@ function spawnRuntimeChild(runtime, args, onExit, env = process.env) {
|
|
|
782
807
|
}
|
|
783
808
|
}
|
|
784
809
|
|
|
785
|
-
export { defaultRoots, configRoot2, dataRoot, stateRoot, cacheRoot, binRoot, installedBinaryPath, installerBinaryPath, defaultSettingsPath, oldStoreMarker, fromCheckout, compiledBinary, binaryPackage, binaryName, scriptEntry, entryCommand, resolveWindowsShim, entrySpawnCommand, runningEntry, checkoutRoot, cliCommand, PUBLIC_STORE_ID, storeConfig, devExtension, devExtensionUrl, devExtensionFolder, storeUrl, installCommand, runningServiceTarget, releaseChannel, checkRelease, autoUpdateModes, UPDATE_VERSION, channelOf, compareVersions, installedRuntime2, installedVersion, updateState, autoUpdateOverride, storedMode, effectiveMode, setStoredMode, autoUpdateStatus, describeAutoUpdate, updateAvailable, runCommand, registryUrl, fetchPublished, runInstaller, createAutoUpdater };
|
|
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 };
|
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
parseTargetSelection2,
|
|
13
13
|
getObject2,
|
|
14
14
|
getString2
|
|
15
|
-
} from "./main-
|
|
15
|
+
} from "./main-kdpdxkk2.mjs";
|
|
16
16
|
import {
|
|
17
17
|
isStream,
|
|
18
18
|
provideContext
|
|
19
|
-
} from "./main-
|
|
19
|
+
} from "./main-jf7jberd.mjs";
|
|
20
20
|
import {
|
|
21
21
|
TaggedError,
|
|
22
22
|
passthrough,
|
|
@@ -103,7 +103,7 @@ import {
|
|
|
103
103
|
} from "./main-qazf3bhk.mjs";
|
|
104
104
|
import {
|
|
105
105
|
cliCommand
|
|
106
|
-
} from "./main-
|
|
106
|
+
} from "./main-bn9skafd.mjs";
|
|
107
107
|
|
|
108
108
|
// node_modules/effect/dist/PrimaryKey.js
|
|
109
109
|
var symbol = "~effect/PrimaryKey";
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
bodyJson,
|
|
16
16
|
HttpClient,
|
|
17
17
|
layerNodeHttp
|
|
18
|
-
} from "./main-
|
|
18
|
+
} from "./main-jf7jberd.mjs";
|
|
19
19
|
import {
|
|
20
20
|
opencodeBrowserBuildId2
|
|
21
|
-
} from "./main-
|
|
21
|
+
} from "./main-j8f19mw5.mjs";
|
|
22
22
|
import {
|
|
23
23
|
stateRoot,
|
|
24
24
|
compiledBinary,
|
|
@@ -28,10 +28,10 @@ import {
|
|
|
28
28
|
compareVersions,
|
|
29
29
|
installedRuntime2,
|
|
30
30
|
installedVersion
|
|
31
|
-
} from "./main-
|
|
31
|
+
} from "./main-bn9skafd.mjs";
|
|
32
32
|
import {
|
|
33
33
|
relayAuthorization
|
|
34
|
-
} from "./main-
|
|
34
|
+
} from "./main-rrfp644p.mjs";
|
|
35
35
|
import {
|
|
36
36
|
Pointer,
|
|
37
37
|
passthrough,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
opencodeBrowserVersion2
|
|
3
|
-
} from "./main-
|
|
3
|
+
} from "./main-j8f19mw5.mjs";
|
|
4
4
|
import {
|
|
5
5
|
configRoot2,
|
|
6
6
|
dataRoot,
|
|
@@ -18,15 +18,16 @@ import {
|
|
|
18
18
|
devExtension,
|
|
19
19
|
devExtensionFolder,
|
|
20
20
|
storeUrl,
|
|
21
|
+
npmGlobalRoot,
|
|
21
22
|
installedVersion,
|
|
22
23
|
runCommand
|
|
23
|
-
} from "./main-
|
|
24
|
+
} from "./main-bn9skafd.mjs";
|
|
24
25
|
import {
|
|
25
26
|
writeStdout
|
|
26
27
|
} from "./main-tk4axre7.mjs";
|
|
27
28
|
import {
|
|
28
29
|
formatPairingCode
|
|
29
|
-
} from "./main-
|
|
30
|
+
} from "./main-21qy8kmb.mjs";
|
|
30
31
|
import {
|
|
31
32
|
unpackedExtensionId
|
|
32
33
|
} from "./main-b3jrctcx.mjs";
|
|
@@ -11230,9 +11231,10 @@ function launcher(browser) {
|
|
|
11230
11231
|
|
|
11231
11232
|
// src/setup/mcp.ts
|
|
11232
11233
|
var legacyShimPath = () => path5.join(files.dir, "bin", "opencode-browser.mjs");
|
|
11234
|
+
var OPENCODE_CONFIG_NAMES = ["opencode.json", "opencode.jsonc", ".opencode/opencode.json", ".opencode/opencode.jsonc"];
|
|
11233
11235
|
function configFile() {
|
|
11234
11236
|
const directory = path5.join(configRoot, "opencode");
|
|
11235
|
-
const candidates =
|
|
11237
|
+
const candidates = OPENCODE_CONFIG_NAMES.map((name) => path5.join(directory, name));
|
|
11236
11238
|
return candidates.find((file) => existsSync4(file) && statSync2(file).isFile()) ?? candidates[0];
|
|
11237
11239
|
}
|
|
11238
11240
|
function fingerprint(entry) {
|
|
@@ -11325,11 +11327,6 @@ function removeLegacyHost() {
|
|
|
11325
11327
|
keys.forEach((key) => spawnSync4("reg", ["delete", key, "/f"]));
|
|
11326
11328
|
return leftovers.length + keys.length > 0;
|
|
11327
11329
|
}
|
|
11328
|
-
async function npmGlobalRoot() {
|
|
11329
|
-
const result = await runCommand("npm", ["root", "-g"], { timeoutMs: 20000 });
|
|
11330
|
-
const root = result.status === 0 ? result.stdout.trim() : "";
|
|
11331
|
-
return root && path5.isAbsolute(root) ? root : undefined;
|
|
11332
|
-
}
|
|
11333
11330
|
async function installRuntime() {
|
|
11334
11331
|
if (compiledBinary()) {
|
|
11335
11332
|
const runtime = await installBinaryRuntime();
|
|
@@ -11393,4 +11390,4 @@ function manualMcpEntry(command) {
|
|
|
11393
11390
|
}`;
|
|
11394
11391
|
}
|
|
11395
11392
|
|
|
11396
|
-
export { parse, parse2, $parseDocument, agentLabels, agentNames, agentName, callingAgent, agentLocations, browseServerCommand, editAgentConfig, settings, isCancel, T$1, S_BAR, S_BAR_END, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, symbol, limitOptions, intro, outro, note, spinner, STORE_IDS, STORE_URL, MCP_NAME, LEGACY_MCP_NAME, home, configRoot, paths, files, fromSource, checkoutExtensionDirs, dev, unpackedFolder, connectedMessage, pairedOfflineMessage, manualPair, findOnPath, findOpencode, readJson, tilde, rail, log, fail, installWaitTimeout, waitTimeout, samePath, isInstallerBinary, addToPath, removeBinaryInstall, oldStoreBuild, detectBrowsers, parseJson, defaultBrowser, blockedReason, revealFolder, systemEffects, configFile, restartOutdatedRelay, mcpServers, configureMcp, removeMcp, legacyBrowserControl, removeLegacyHost, installRuntime, installedRuntime, manualMcpEntry };
|
|
11393
|
+
export { parse, parse2, $parseDocument, agentLabels, agentNames, agentName, callingAgent, agentLocations, browseServerCommand, editAgentConfig, settings, isCancel, T$1, S_BAR, S_BAR_END, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, symbol, limitOptions, intro, outro, note, spinner, STORE_IDS, STORE_URL, MCP_NAME, LEGACY_MCP_NAME, home, configRoot, paths, files, fromSource, checkoutExtensionDirs, dev, unpackedFolder, connectedMessage, pairedOfflineMessage, manualPair, findOnPath, findOpencode, readJson, tilde, rail, log, fail, installWaitTimeout, waitTimeout, samePath, isInstallerBinary, addToPath, removeBinaryInstall, oldStoreBuild, detectBrowsers, parseJson, defaultBrowser, blockedReason, revealFolder, systemEffects, OPENCODE_CONFIG_NAMES, configFile, restartOutdatedRelay, mcpServers, configureMcp, removeMcp, legacyBrowserControl, removeLegacyHost, installRuntime, installedRuntime, manualMcpEntry };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// src/setup/legacy.ts
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
function legacyDataRoot(home = os.homedir()) {
|
|
6
|
+
if (home !== os.homedir())
|
|
7
|
+
return path.join(home, ".local", "share", "opencode-browser");
|
|
8
|
+
if (process.platform === "win32") {
|
|
9
|
+
const configured = process.env.LOCALAPPDATA;
|
|
10
|
+
return path.join(configured && path.isAbsolute(configured) ? configured : path.join(home, "AppData", "Local"), "opencode-browser");
|
|
11
|
+
}
|
|
12
|
+
const configured = process.env.XDG_DATA_HOME;
|
|
13
|
+
return path.join(configured && path.isAbsolute(configured) ? configured : path.join(home, ".local", "share"), "opencode-browser");
|
|
14
|
+
}
|
|
15
|
+
function legacyRoots(home = os.homedir()) {
|
|
16
|
+
return [path.join(home, ".browse"), legacyDataRoot(home)];
|
|
17
|
+
}
|
|
18
|
+
function legacyRootsLeft(home = os.homedir()) {
|
|
19
|
+
return legacyRoots(home).some((root) => {
|
|
20
|
+
try {
|
|
21
|
+
return fs.readdirSync(root).some((name) => name !== "extension" || !fs.lstatSync(path.join(root, name)).isSymbolicLink());
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function legacyRuntime(home = os.homedir()) {
|
|
28
|
+
const root = legacyDataRoot(home);
|
|
29
|
+
try {
|
|
30
|
+
const current = JSON.parse(fs.readFileSync(path.join(root, "runtime", "current.json"), "utf8"));
|
|
31
|
+
if (typeof current.version !== "string")
|
|
32
|
+
return;
|
|
33
|
+
const text = (key) => typeof current[key] === "string" ? { [key]: current[key] } : {};
|
|
34
|
+
return { root, version: current.version, ...text("binary"), ...text("movedTo"), ...text("switchedAt") };
|
|
35
|
+
} catch {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
var legacyRuntimeActive = (runtime) => !!runtime && !runtime.binary && !runtime.movedTo;
|
|
40
|
+
var LEGACY_HANDOVER_GRACE_MS = 10 * 60000;
|
|
41
|
+
var real = (value) => {
|
|
42
|
+
try {
|
|
43
|
+
return fs.realpathSync(value);
|
|
44
|
+
} catch {
|
|
45
|
+
return path.resolve(value);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
function insidePath(file, root) {
|
|
49
|
+
const relative = path.relative(real(root), real(file));
|
|
50
|
+
return relative !== "" && !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
51
|
+
}
|
|
52
|
+
var samePath2 = (left, right) => {
|
|
53
|
+
const normalize = (value) => process.platform === "win32" ? real(value).toLowerCase() : real(value);
|
|
54
|
+
return normalize(left) === normalize(right);
|
|
55
|
+
};
|
|
56
|
+
function settleLegacyHome(env = process.env, runtime = legacyRuntime()) {
|
|
57
|
+
if (runtime && legacyRuntimeActive(runtime))
|
|
58
|
+
env.OPENCODE_BROWSER_HOME ??= runtime.root;
|
|
59
|
+
else if (runtime?.movedTo && env.OPENCODE_BROWSER_HOME && samePath2(env.OPENCODE_BROWSER_HOME, runtime.root))
|
|
60
|
+
delete env.OPENCODE_BROWSER_HOME;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { legacyDataRoot, legacyRoots, legacyRootsLeft, legacyRuntime, legacyRuntimeActive, LEGACY_HANDOVER_GRACE_MS, insidePath, samePath2, settleLegacyHome };
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
bundledPairingCodeTtlMs,
|
|
6
6
|
mintPairingCode,
|
|
7
7
|
writeExtensionPairing
|
|
8
|
-
} from "./main-
|
|
8
|
+
} from "./main-21qy8kmb.mjs";
|
|
9
9
|
import {
|
|
10
10
|
configRoot2,
|
|
11
11
|
cacheRoot,
|
|
12
12
|
devExtensionUrl,
|
|
13
13
|
devExtensionFolder
|
|
14
|
-
} from "./main-
|
|
14
|
+
} from "./main-bn9skafd.mjs";
|
|
15
15
|
|
|
16
16
|
// src/setup/dev-extension.ts
|
|
17
17
|
import { createHash } from "node:crypto";
|
|
@@ -42,14 +42,15 @@ import {
|
|
|
42
42
|
empty3,
|
|
43
43
|
jsonUnsafe,
|
|
44
44
|
layer
|
|
45
|
-
} from "./main-
|
|
45
|
+
} from "./main-jf7jberd.mjs";
|
|
46
|
+
import"./main-pmfd055v.mjs";
|
|
46
47
|
import {
|
|
47
48
|
opencodeBrowserVersion2
|
|
48
|
-
} from "./main-
|
|
49
|
+
} from "./main-j8f19mw5.mjs";
|
|
49
50
|
import {
|
|
50
51
|
cliCommand,
|
|
51
52
|
autoUpdateStatus
|
|
52
|
-
} from "./main-
|
|
53
|
+
} from "./main-bn9skafd.mjs";
|
|
53
54
|
import"./main-b3jrctcx.mjs";
|
|
54
55
|
import {
|
|
55
56
|
option,
|
|
@@ -69,12 +70,12 @@ import {
|
|
|
69
70
|
relayBuildProblem,
|
|
70
71
|
ensureRelay,
|
|
71
72
|
ensureExtensionConnected
|
|
72
|
-
} from "./main-
|
|
73
|
+
} from "./main-kdpdxkk2.mjs";
|
|
73
74
|
import"./main-4h7rfhhr.mjs";
|
|
74
75
|
import {
|
|
75
76
|
updateJson2,
|
|
76
77
|
createUpdateWatcher2
|
|
77
|
-
} from "./main-
|
|
78
|
+
} from "./main-avsbn8a7.mjs";
|
|
78
79
|
import {
|
|
79
80
|
settingSpecs,
|
|
80
81
|
securityVariables,
|
|
@@ -155,12 +156,12 @@ import {
|
|
|
155
156
|
toolResultForValue2,
|
|
156
157
|
mcpErrorMessage2,
|
|
157
158
|
toolResult
|
|
158
|
-
} from "./main-
|
|
159
|
+
} from "./main-g9wttfh5.mjs";
|
|
159
160
|
import {
|
|
160
161
|
makeUnsafe,
|
|
161
162
|
make3,
|
|
162
163
|
listSecrets
|
|
163
|
-
} from "./main-
|
|
164
|
+
} from "./main-azbyg2h1.mjs";
|
|
164
165
|
import {
|
|
165
166
|
Clock,
|
|
166
167
|
type,
|
|
@@ -175,7 +176,7 @@ import {
|
|
|
175
176
|
orElse,
|
|
176
177
|
exhaustive
|
|
177
178
|
} from "./main-4074weqb.mjs";
|
|
178
|
-
import"./main-
|
|
179
|
+
import"./main-rrfp644p.mjs";
|
|
179
180
|
import {
|
|
180
181
|
Class,
|
|
181
182
|
taggedEnum,
|
|
@@ -5,25 +5,29 @@ import {
|
|
|
5
5
|
agentLocations,
|
|
6
6
|
browseServerCommand,
|
|
7
7
|
editAgentConfig,
|
|
8
|
+
OPENCODE_CONFIG_NAMES,
|
|
8
9
|
configureMcp
|
|
9
|
-
} from "./main-
|
|
10
|
-
import
|
|
10
|
+
} from "./main-n52th9gj.mjs";
|
|
11
|
+
import {
|
|
12
|
+
legacyDataRoot,
|
|
13
|
+
legacyRoots,
|
|
14
|
+
legacyRuntime,
|
|
15
|
+
LEGACY_HANDOVER_GRACE_MS
|
|
16
|
+
} from "./main-pmfd055v.mjs";
|
|
17
|
+
import"./main-j8f19mw5.mjs";
|
|
11
18
|
import {
|
|
12
19
|
configRoot2,
|
|
13
20
|
dataRoot,
|
|
14
21
|
stateRoot,
|
|
15
22
|
cacheRoot,
|
|
16
23
|
binRoot,
|
|
17
|
-
binaryName
|
|
18
|
-
|
|
24
|
+
binaryName,
|
|
25
|
+
devExtensionFolder
|
|
26
|
+
} from "./main-bn9skafd.mjs";
|
|
19
27
|
import"./main-tk4axre7.mjs";
|
|
20
28
|
import"./main-4h7rfhhr.mjs";
|
|
21
|
-
import"./main-
|
|
29
|
+
import"./main-21qy8kmb.mjs";
|
|
22
30
|
import"./main-b3jrctcx.mjs";
|
|
23
|
-
import {
|
|
24
|
-
legacyDataRoot,
|
|
25
|
-
legacyRoots
|
|
26
|
-
} from "./main-ckssvk4c.mjs";
|
|
27
31
|
|
|
28
32
|
// src/setup/migrate.ts
|
|
29
33
|
import fs from "node:fs";
|
|
@@ -50,6 +54,14 @@ function destination(relative, home) {
|
|
|
50
54
|
return path.join(path.basename(file) === "lifecycle.jsonl" ? stateRoot(home) : dataRoot(home), file);
|
|
51
55
|
return path.join(dataRoot(home), file);
|
|
52
56
|
}
|
|
57
|
+
var lexists = (file) => {
|
|
58
|
+
try {
|
|
59
|
+
fs.lstatSync(file);
|
|
60
|
+
return true;
|
|
61
|
+
} catch {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
53
65
|
var privatePath = (relative) => {
|
|
54
66
|
const file = normalized(relative);
|
|
55
67
|
return file === "relay-token" || file === "browser-tokens.json" || file === "pairing-codes.json" || file === "extension-pairing" || file === "session.json" || file.startsWith("secrets/") || file.startsWith("site-secrets/") || file.startsWith("sessions/") || file === "auto-update.json" || file === "old-store-extension";
|
|
@@ -68,8 +80,8 @@ function filesUnder(root, relative = "") {
|
|
|
68
80
|
return entry.isFile() ? [next] : [];
|
|
69
81
|
});
|
|
70
82
|
}
|
|
71
|
-
function copyPrivate(from, to, relative) {
|
|
72
|
-
if (fs.existsSync(to))
|
|
83
|
+
function copyPrivate(from, to, relative, overwrite = false) {
|
|
84
|
+
if (!overwrite && fs.existsSync(to))
|
|
73
85
|
return;
|
|
74
86
|
fs.mkdirSync(path.dirname(to), { recursive: true, mode: privatePath(relative) ? 448 : 493 });
|
|
75
87
|
const temporary = `${to}.migrate-${process.pid}`;
|
|
@@ -165,14 +177,89 @@ function rewriteAgent(name, file, oldBinary, newBinary) {
|
|
|
165
177
|
}
|
|
166
178
|
return false;
|
|
167
179
|
}
|
|
168
|
-
function
|
|
180
|
+
function copyLegacyData(home = os.homedir()) {
|
|
181
|
+
const root = legacyDataRoot(home);
|
|
182
|
+
const record = takeoverRecord(home);
|
|
183
|
+
for (const file of readCopied(record))
|
|
184
|
+
fs.rmSync(file, { force: true });
|
|
185
|
+
const copies = filesUnder(root).flatMap((relative) => {
|
|
186
|
+
const to = destination(relative, home);
|
|
187
|
+
return to ? [{ relative, to }] : [];
|
|
188
|
+
});
|
|
189
|
+
try {
|
|
190
|
+
fs.mkdirSync(path.dirname(record), { recursive: true, mode: 448 });
|
|
191
|
+
fs.writeFileSync(record, JSON.stringify({ copied: copies.map((copy) => copy.to) }) + `
|
|
192
|
+
`, { mode: 384 });
|
|
193
|
+
} catch {}
|
|
194
|
+
for (const { relative, to } of copies) {
|
|
195
|
+
try {
|
|
196
|
+
copyPrivate(path.join(root, relative), to, relative, true);
|
|
197
|
+
} catch {}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
var takeoverRecord = (home) => path.join(stateRoot(home), "legacy-takeover.json");
|
|
201
|
+
function readCopied(record) {
|
|
202
|
+
try {
|
|
203
|
+
const copied = JSON.parse(fs.readFileSync(record, "utf8")).copied;
|
|
204
|
+
return Array.isArray(copied) ? copied.filter((file) => typeof file === "string") : [];
|
|
205
|
+
} catch {
|
|
206
|
+
return [];
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function recordedConfigs(home) {
|
|
210
|
+
return [path.join(configRoot2(home), "settings.json"), path.join(home, ".browse", "settings.json"), path.join(legacyDataRoot(home), "settings.json")].flatMap((file) => {
|
|
211
|
+
try {
|
|
212
|
+
const settings = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
213
|
+
return [
|
|
214
|
+
...(settings.opencodeConfigs ?? []).filter((config) => typeof config === "string").map((config) => ({ name: "opencode", file: config })),
|
|
215
|
+
...(settings.agents ?? []).filter((agent) => typeof agent?.file === "string").map((agent) => ({ name: agent.name, file: agent.file }))
|
|
216
|
+
];
|
|
217
|
+
} catch {
|
|
218
|
+
return [];
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function linkLegacyExtension(root, home) {
|
|
223
|
+
const old = path.join(root, "extension");
|
|
224
|
+
try {
|
|
225
|
+
if (!fs.lstatSync(old).isDirectory())
|
|
226
|
+
return;
|
|
227
|
+
} catch {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const folder = devExtensionFolder(cacheRoot(home));
|
|
231
|
+
const link = `${old}.link-${process.pid}`;
|
|
232
|
+
try {
|
|
233
|
+
fs.mkdirSync(path.dirname(folder), { recursive: true });
|
|
234
|
+
fs.rmSync(link, { force: true });
|
|
235
|
+
fs.symlinkSync(folder, link, "junction");
|
|
236
|
+
if (fs.existsSync(folder))
|
|
237
|
+
fs.rmSync(old, { recursive: true, force: true });
|
|
238
|
+
else {
|
|
239
|
+
try {
|
|
240
|
+
fs.renameSync(old, folder);
|
|
241
|
+
} catch {
|
|
242
|
+
fs.cpSync(old, folder, { recursive: true });
|
|
243
|
+
fs.rmSync(old, { recursive: true, force: true });
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
fs.renameSync(link, old);
|
|
247
|
+
} catch {
|
|
248
|
+
fs.rmSync(link, { force: true });
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function migrateLegacy(home = os.homedir(), now = Date.now()) {
|
|
169
252
|
const result = { moved: 0, rewritten: 0, removed: [] };
|
|
170
253
|
if (process.env.OPENCODE_BROWSER_HOME)
|
|
171
254
|
return result;
|
|
172
255
|
const roots = legacyRoots(home);
|
|
256
|
+
const oldData = legacyDataRoot(home);
|
|
257
|
+
const recorded = recordedConfigs(home);
|
|
173
258
|
for (const root of roots) {
|
|
174
259
|
if (!fs.existsSync(root))
|
|
175
260
|
continue;
|
|
261
|
+
if (root === oldData)
|
|
262
|
+
linkLegacyExtension(root, home);
|
|
176
263
|
let complete = true;
|
|
177
264
|
for (const relative of filesUnder(root)) {
|
|
178
265
|
const to = destination(relative, home);
|
|
@@ -181,6 +268,9 @@ function migrateLegacy(home = os.homedir()) {
|
|
|
181
268
|
try {
|
|
182
269
|
copyPrivate(path.join(root, relative), to, relative);
|
|
183
270
|
result.moved++;
|
|
271
|
+
const top = normalized(relative).split("/")[0];
|
|
272
|
+
if (top !== "bin" && top !== "extension")
|
|
273
|
+
fs.rmSync(path.join(root, relative), { force: true });
|
|
184
274
|
} catch {
|
|
185
275
|
complete = false;
|
|
186
276
|
}
|
|
@@ -195,9 +285,14 @@ function migrateLegacy(home = os.homedir()) {
|
|
|
195
285
|
rewriteBinaryText(settingsFile, oldBinary, newBinary);
|
|
196
286
|
} catch {}
|
|
197
287
|
const config = home === os.homedir() && process.env.XDG_CONFIG_HOME && path.isAbsolute(process.env.XDG_CONFIG_HOME) ? process.env.XDG_CONFIG_HOME : path.join(home, ".config");
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
288
|
+
const opencodeConfigs = OPENCODE_CONFIG_NAMES.map((name) => path.join(config, "opencode", name));
|
|
289
|
+
const locations = [
|
|
290
|
+
...agentLocations(home, config, () => {
|
|
291
|
+
return;
|
|
292
|
+
}, opencodeConfigs[0]).filter((location) => location.name !== "opencode"),
|
|
293
|
+
...opencodeConfigs.map((file) => ({ name: "opencode", file })),
|
|
294
|
+
...recorded
|
|
295
|
+
].filter((location, index, all) => all.findIndex((other) => other.name === location.name && normalized(other.file) === normalized(location.file)) === index);
|
|
201
296
|
for (const location of locations) {
|
|
202
297
|
try {
|
|
203
298
|
if (rewriteAgent(location.name, location.file, oldBinary, newBinary))
|
|
@@ -209,23 +304,37 @@ function migrateLegacy(home = os.homedir()) {
|
|
|
209
304
|
const stillReferences = (needle) => locations.some((location) => referencesPath(location.file, needle));
|
|
210
305
|
const keep = new Set;
|
|
211
306
|
const browseRoot = path.join(home, ".browse");
|
|
212
|
-
const oldData = legacyDataRoot(home);
|
|
213
307
|
if (stillReferences(oldBinary))
|
|
214
308
|
keep.add(normalized(browseRoot));
|
|
215
309
|
if (stillReferences(oldData))
|
|
216
310
|
keep.add(normalized(oldData));
|
|
311
|
+
const takenOver = legacyRuntime(home);
|
|
312
|
+
if (takenOver?.movedTo && !(now - Date.parse(takenOver.switchedAt ?? "") >= LEGACY_HANDOVER_GRACE_MS))
|
|
313
|
+
keep.add(normalized(oldData));
|
|
314
|
+
if (takenOver?.movedTo) {
|
|
315
|
+
try {
|
|
316
|
+
fs.rmSync(takeoverRecord(home), { force: true });
|
|
317
|
+
} catch {}
|
|
318
|
+
}
|
|
217
319
|
if (referencesPath(settingsFile, oldBinary))
|
|
218
320
|
keep.add(normalized(browseRoot));
|
|
219
321
|
result.removed = result.removed.filter((root) => !keep.has(normalized(root)));
|
|
220
322
|
const removable = result.removed.splice(0);
|
|
221
323
|
for (const root of removable) {
|
|
222
324
|
try {
|
|
223
|
-
|
|
325
|
+
const keepExtension = root === oldData && lexists(path.join(root, "extension"));
|
|
326
|
+
if (!keepExtension)
|
|
327
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
328
|
+
else
|
|
329
|
+
for (const name of fs.readdirSync(root))
|
|
330
|
+
if (name !== "extension")
|
|
331
|
+
fs.rmSync(path.join(root, name), { recursive: true, force: true });
|
|
224
332
|
result.removed.push(root);
|
|
225
333
|
} catch {}
|
|
226
334
|
}
|
|
227
335
|
return result;
|
|
228
336
|
}
|
|
229
337
|
export {
|
|
338
|
+
copyLegacyData,
|
|
230
339
|
migrateLegacy
|
|
231
340
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
legacyRoots
|
|
3
|
+
} from "./main-pmfd055v.mjs";
|
|
1
4
|
import {
|
|
2
5
|
opencodeBrowserVersion2,
|
|
3
6
|
opencodeBrowserBuildId2
|
|
4
|
-
} from "./main-
|
|
7
|
+
} from "./main-j8f19mw5.mjs";
|
|
5
8
|
import {
|
|
6
9
|
defaultRoots,
|
|
7
10
|
configRoot2,
|
|
@@ -25,7 +28,7 @@ import {
|
|
|
25
28
|
setStoredMode,
|
|
26
29
|
autoUpdateStatus,
|
|
27
30
|
createAutoUpdater
|
|
28
|
-
} from "./main-
|
|
31
|
+
} from "./main-bn9skafd.mjs";
|
|
29
32
|
import {
|
|
30
33
|
extensionProtocolVersion,
|
|
31
34
|
minExtensionProtocolVersion,
|
|
@@ -104,7 +107,7 @@ import {
|
|
|
104
107
|
dataUrlDocument2,
|
|
105
108
|
appendManagedRelayProcessLog,
|
|
106
109
|
relayLog
|
|
107
|
-
} from "./main-
|
|
110
|
+
} from "./main-kdpdxkk2.mjs";
|
|
108
111
|
import {
|
|
109
112
|
context,
|
|
110
113
|
pendingPairingCodeKeys,
|
|
@@ -122,7 +125,7 @@ import {
|
|
|
122
125
|
pairingSessionKey,
|
|
123
126
|
sessionProof,
|
|
124
127
|
wrapToken
|
|
125
|
-
} from "./main-
|
|
128
|
+
} from "./main-21qy8kmb.mjs";
|
|
126
129
|
import {
|
|
127
130
|
makeUnsafe,
|
|
128
131
|
terminateChildProcess,
|
|
@@ -145,16 +148,16 @@ import {
|
|
|
145
148
|
checkNavigationUrl,
|
|
146
149
|
readSecret,
|
|
147
150
|
secretText
|
|
148
|
-
} from "./main-
|
|
151
|
+
} from "./main-azbyg2h1.mjs";
|
|
149
152
|
import {
|
|
150
153
|
defaultJournalBaseDir,
|
|
151
154
|
makeJournalEntry,
|
|
152
155
|
appendJournalEntry,
|
|
153
156
|
startJournalRetention
|
|
154
|
-
} from "./main-
|
|
157
|
+
} from "./main-2hjf3ynh.mjs";
|
|
155
158
|
import {
|
|
156
159
|
createUpdateWatcher2
|
|
157
|
-
} from "./main-
|
|
160
|
+
} from "./main-avsbn8a7.mjs";
|
|
158
161
|
import {
|
|
159
162
|
SettingsInputError,
|
|
160
163
|
parseSettingChanges,
|
|
@@ -162,16 +165,13 @@ import {
|
|
|
162
165
|
settingsToExtension,
|
|
163
166
|
describeSettings,
|
|
164
167
|
describeChanges
|
|
165
|
-
} from "./main-
|
|
168
|
+
} from "./main-g9wttfh5.mjs";
|
|
166
169
|
import {
|
|
167
170
|
relayHostname,
|
|
168
171
|
isLocalPeer,
|
|
169
172
|
installedDevExtension,
|
|
170
173
|
syncDevExtension
|
|
171
|
-
} from "./main-
|
|
172
|
-
import {
|
|
173
|
-
legacyRoots
|
|
174
|
-
} from "./main-ckssvk4c.mjs";
|
|
174
|
+
} from "./main-xk9hcdb6.mjs";
|
|
175
175
|
import {
|
|
176
176
|
currentTimeMillis,
|
|
177
177
|
value,
|
|
@@ -179,17 +179,17 @@ import {
|
|
|
179
179
|
orElse,
|
|
180
180
|
exhaustive
|
|
181
181
|
} from "./main-4074weqb.mjs";
|
|
182
|
-
import {
|
|
183
|
-
join,
|
|
184
|
-
interrupt,
|
|
185
|
-
makeUnsafe2
|
|
186
|
-
} from "./main-bc8cjey0.mjs";
|
|
187
182
|
import {
|
|
188
183
|
relayTokenQueryParam,
|
|
189
184
|
relayToken,
|
|
190
185
|
secretsEqual,
|
|
191
186
|
ensurePrivateDirectory
|
|
192
|
-
} from "./main-
|
|
187
|
+
} from "./main-rrfp644p.mjs";
|
|
188
|
+
import {
|
|
189
|
+
join,
|
|
190
|
+
interrupt,
|
|
191
|
+
makeUnsafe2
|
|
192
|
+
} from "./main-jf7jberd.mjs";
|
|
193
193
|
import {
|
|
194
194
|
taggedEnum,
|
|
195
195
|
is2,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import"./main-9bk4pprj.mjs";
|
|
2
|
-
import"./main-
|
|
2
|
+
import"./main-pmfd055v.mjs";
|
|
3
|
+
import"./main-j8f19mw5.mjs";
|
|
3
4
|
import {
|
|
4
5
|
cliCommand,
|
|
5
6
|
installCommand,
|
|
@@ -10,23 +11,24 @@ import {
|
|
|
10
11
|
channelOf,
|
|
11
12
|
compareVersions,
|
|
12
13
|
installedRuntime2,
|
|
14
|
+
updateTarget,
|
|
13
15
|
installedVersion,
|
|
14
16
|
updateState,
|
|
15
17
|
effectiveMode,
|
|
16
18
|
registryUrl,
|
|
17
19
|
fetchPublished,
|
|
18
20
|
runInstaller
|
|
19
|
-
} from "./main-
|
|
21
|
+
} from "./main-bn9skafd.mjs";
|
|
20
22
|
import"./main-b3jrctcx.mjs";
|
|
21
23
|
import {
|
|
22
24
|
Service,
|
|
23
25
|
layerFetch,
|
|
24
26
|
restartRelay,
|
|
25
27
|
startManagedRelay
|
|
26
|
-
} from "./main-
|
|
28
|
+
} from "./main-kdpdxkk2.mjs";
|
|
27
29
|
import"./main-4h7rfhhr.mjs";
|
|
28
|
-
import"./main-
|
|
29
|
-
import"./main-
|
|
30
|
+
import"./main-jf7jberd.mjs";
|
|
31
|
+
import"./main-rrfp644p.mjs";
|
|
30
32
|
import {
|
|
31
33
|
succeed6,
|
|
32
34
|
gen,
|
|
@@ -159,7 +161,8 @@ async function runInstalledUpdate(args, runtime = installedRuntime2()) {
|
|
|
159
161
|
if (!installed)
|
|
160
162
|
return true;
|
|
161
163
|
updateState(({ installing: _installing, ...state }) => ({ ...state, lastUpdate: { from: runtime.version, to: installed, at: new Date().toISOString() } }));
|
|
162
|
-
const
|
|
164
|
+
const target = await updateTarget(runtime);
|
|
165
|
+
const { refused } = target ? await switchTo({ ...target, version: installed }, installed, { force: args.includes("--force") }) : { refused: "npm's global folder is unknown (`npm root -g` failed)" };
|
|
163
166
|
if (refused) {
|
|
164
167
|
const automatic = effectiveMode() === "on";
|
|
165
168
|
log(`! Installed ${installed}, but the relay didn't restart (${refused}).`);
|
|
@@ -63,10 +63,11 @@ import {
|
|
|
63
63
|
installRuntime,
|
|
64
64
|
installedRuntime,
|
|
65
65
|
manualMcpEntry
|
|
66
|
-
} from "./main-
|
|
66
|
+
} from "./main-n52th9gj.mjs";
|
|
67
|
+
import"./main-pmfd055v.mjs";
|
|
67
68
|
import {
|
|
68
69
|
opencodeBrowserBuildId2
|
|
69
|
-
} from "./main-
|
|
70
|
+
} from "./main-j8f19mw5.mjs";
|
|
70
71
|
import {
|
|
71
72
|
installedBinaryPath,
|
|
72
73
|
installerBinaryPath,
|
|
@@ -83,7 +84,7 @@ import {
|
|
|
83
84
|
autoUpdateStatus,
|
|
84
85
|
describeAutoUpdate,
|
|
85
86
|
runCommand
|
|
86
|
-
} from "./main-
|
|
87
|
+
} from "./main-bn9skafd.mjs";
|
|
87
88
|
import"./main-4h7rfhhr.mjs";
|
|
88
89
|
import {
|
|
89
90
|
pairingCodeTtlMs,
|
|
@@ -97,7 +98,7 @@ import {
|
|
|
97
98
|
revokeBrowserToken,
|
|
98
99
|
legacyPairingCode,
|
|
99
100
|
removeLegacyPairingCode
|
|
100
|
-
} from "./main-
|
|
101
|
+
} from "./main-21qy8kmb.mjs";
|
|
101
102
|
import {
|
|
102
103
|
unpackedExtensionId,
|
|
103
104
|
extensionProtocolSkew,
|
|
@@ -106,16 +107,16 @@ import {
|
|
|
106
107
|
import"./main-tk4axre7.mjs";
|
|
107
108
|
import {
|
|
108
109
|
defaultSiteSecretsDir
|
|
109
|
-
} from "./main-
|
|
110
|
+
} from "./main-azbyg2h1.mjs";
|
|
110
111
|
import {
|
|
111
112
|
parseHostname,
|
|
112
113
|
readRelayConfig,
|
|
113
114
|
writeRelayConfig,
|
|
114
115
|
syncDevExtension
|
|
115
|
-
} from "./main-
|
|
116
|
+
} from "./main-xk9hcdb6.mjs";
|
|
116
117
|
import {
|
|
117
118
|
relayAuthorization
|
|
118
|
-
} from "./main-
|
|
119
|
+
} from "./main-rrfp644p.mjs";
|
|
119
120
|
|
|
120
121
|
// src/setup.ts
|
|
121
122
|
import { mkdirSync as mkdirSync2, rmSync as rmSync2, writeFileSync } from "node:fs";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import"./main-
|
|
1
|
+
import"./main-pmfd055v.mjs";
|
|
2
|
+
import"./main-j8f19mw5.mjs";
|
|
2
3
|
import {
|
|
3
4
|
entrySpawnCommand,
|
|
4
5
|
installedRuntime2,
|
|
5
6
|
installedVersion
|
|
6
|
-
} from "./main-
|
|
7
|
+
} from "./main-bn9skafd.mjs";
|
|
7
8
|
|
|
8
9
|
// src/mcp/supervisor.ts
|
|
9
10
|
import { spawn } from "node:child_process";
|
|
@@ -34,7 +35,7 @@ async function runBinaryMcp(args) {
|
|
|
34
35
|
const runtime = installedRuntime2();
|
|
35
36
|
if (!runtime || runtime.kind === "npx") {
|
|
36
37
|
process.env[directEnvironmentVariable] = "1";
|
|
37
|
-
const { runCli } = await import("./cli-
|
|
38
|
+
const { runCli } = await import("./cli-qr4zcy16.mjs");
|
|
38
39
|
return runCli();
|
|
39
40
|
}
|
|
40
41
|
const REPLAY = `opencode-browser-shim-initialize-${randomUUID()}`;
|
|
@@ -4,10 +4,11 @@ import {
|
|
|
4
4
|
updateNotice2,
|
|
5
5
|
createUpdateWatcher2,
|
|
6
6
|
runUpdateCommand2
|
|
7
|
-
} from "./main-
|
|
7
|
+
} from "./main-avsbn8a7.mjs";
|
|
8
8
|
import"./main-b3jrctcx.mjs";
|
|
9
|
-
import"./main-
|
|
10
|
-
import"./main-
|
|
9
|
+
import"./main-bn9skafd.mjs";
|
|
10
|
+
import"./main-pmfd055v.mjs";
|
|
11
|
+
import"./main-j8f19mw5.mjs";
|
|
11
12
|
export {
|
|
12
13
|
createUpdateWatcher2 as createUpdateWatcher,
|
|
13
14
|
formatUpdateNotice2 as formatUpdateNotice,
|
package/package.json
CHANGED
package/dist/main-7dea1z95.mjs
DELETED
package/dist/main-ckssvk4c.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// src/setup/legacy.ts
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
function legacyDataRoot(home = os.homedir()) {
|
|
5
|
-
if (home !== os.homedir())
|
|
6
|
-
return path.join(home, ".local", "share", "opencode-browser");
|
|
7
|
-
if (process.platform === "win32") {
|
|
8
|
-
const configured = process.env.LOCALAPPDATA;
|
|
9
|
-
return path.join(configured && path.isAbsolute(configured) ? configured : path.join(home, "AppData", "Local"), "opencode-browser");
|
|
10
|
-
}
|
|
11
|
-
const configured = process.env.XDG_DATA_HOME;
|
|
12
|
-
return path.join(configured && path.isAbsolute(configured) ? configured : path.join(home, ".local", "share"), "opencode-browser");
|
|
13
|
-
}
|
|
14
|
-
function legacyRoots(home = os.homedir()) {
|
|
15
|
-
return [path.join(home, ".browse"), legacyDataRoot(home)];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { legacyDataRoot, legacyRoots };
|
|
File without changes
|