@opencode/browse 0.0.17-dev.185 → 0.0.17-dev.188

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.
Files changed (39) hide show
  1. package/dist/{Runtime-xss8qan1.mjs → Runtime-hmy7zww1.mjs} +1 -1
  2. package/dist/{cli-fk82qmwb.mjs → cli-5ezftnv2.mjs} +39 -222
  3. package/dist/cli.mjs +18 -18
  4. package/dist/{helpers-v2zmfak2.mjs → helpers-k5ybc61c.mjs} +1 -1
  5. package/dist/{index-gjq7chrk.mjs → index-37ssbv86.mjs} +2 -2
  6. package/dist/{legacy-runtime-rvfsgmzn.mjs → legacy-runtime-j0sw664c.mjs} +10 -9
  7. package/dist/{main-m45zegrn.mjs → main-0h387a1q.mjs} +1 -6
  8. package/dist/{main-jeta10c6.mjs → main-3514h33n.mjs} +11 -11
  9. package/dist/{main-qwf4vk41.mjs → main-4qq4n32k.mjs} +2 -2
  10. package/dist/{main-1b344j42.mjs → main-66fy08h5.mjs} +8 -25
  11. package/dist/{main-x7takqns.mjs → main-7h3v45ag.mjs} +26 -17
  12. package/dist/{main-t2jyedkv.mjs → main-7v4scg8t.mjs} +8 -6
  13. package/dist/{main-6hvv25x8.mjs → main-8xd753k5.mjs} +1 -1
  14. package/dist/{main-akpa411k.mjs → main-9q9919e3.mjs} +118 -2
  15. package/dist/{main-2wrvr3gc.mjs → main-ba028a85.mjs} +34 -27
  16. package/dist/{main-sbqypb33.mjs → main-d8km89cz.mjs} +2 -2
  17. package/dist/main-dab23et4.mjs +17 -0
  18. package/dist/{main-9frwnsnf.mjs → main-j4kq90pw.mjs} +1 -1
  19. package/dist/{main-3ewrhbqw.mjs → main-kzcrfvmh.mjs} +4 -4
  20. package/dist/{main-z32979g4.mjs → main-m9n50a86.mjs} +41 -162
  21. package/dist/{main-ndmgt6k5.mjs → main-mvjg1jye.mjs} +5 -46
  22. package/dist/{main-xjskgtdr.mjs → main-pqxrvknr.mjs} +2 -2
  23. package/dist/main-qrqem3fy.mjs +4 -0
  24. package/dist/{main-xct4r41x.mjs → main-svhdexdh.mjs} +4 -4
  25. package/dist/main-tryp3jph.mjs +141 -0
  26. package/dist/{mcp-2xkjfnqz.mjs → mcp-jh4atts2.mjs} +37 -140
  27. package/dist/{migrate-fygxtp2g.mjs → migrate-r433scvg.mjs} +14 -7
  28. package/dist/{relay-mbjgxbtr.mjs → relay-1epy67be.mjs} +648 -372
  29. package/dist/remove-stored-secrets-wy3pakjj.mjs +6 -0
  30. package/dist/{runtime-update-ngg3m888.mjs → runtime-update-ww2pejn2.mjs} +13 -11
  31. package/dist/{setup-t0pbhmzh.mjs → setup-n1hpbkz2.mjs} +27 -49
  32. package/dist/{skill-text-1rg5b5np.mjs → skill-text-0ndr12dz.mjs} +7 -31
  33. package/dist/{update-heze6vjn.mjs → update-z7qvagkc.mjs} +3 -3
  34. package/dist/{version-x1kkvpqn.mjs → version-2123c138.mjs} +1 -1
  35. package/package.json +1 -1
  36. package/skills/browse/SKILL.md +7 -31
  37. package/dist/main-6my7bmf1.mjs +0 -1324
  38. package/dist/main-ew8jna3e.mjs +0 -4
  39. package/dist/supervisor-wrrnbfhw.mjs +0 -269
@@ -4,147 +4,16 @@ import {
4
4
  } from "./main-pmfd055v.mjs";
5
5
  import {
6
6
  opencodeBrowserVersion2
7
- } from "./main-ew8jna3e.mjs";
8
-
9
- // src/paths.ts
10
- import fs from "node:fs";
11
- import os from "node:os";
12
- import path from "node:path";
13
- import { fileURLToPath } from "node:url";
14
- var override = (home) => home === os.homedir() && process.env.OPENCODE_BROWSER_HOME ? process.env.OPENCODE_BROWSER_HOME : undefined;
15
- var xdgRoot = (variable, fallback, home) => {
16
- const configured = home === os.homedir() ? process.env[variable] : undefined;
17
- return path.join(configured && path.isAbsolute(configured) ? configured : path.join(home, fallback), "browse");
18
- };
19
- function defaultConfigRoot(home = os.homedir()) {
20
- return xdgRoot("XDG_CONFIG_HOME", ".config", home);
21
- }
22
- function defaultRoots(home = os.homedir()) {
23
- return {
24
- config: defaultConfigRoot(home),
25
- data: xdgRoot("XDG_DATA_HOME", ".local/share", home),
26
- state: xdgRoot("XDG_STATE_HOME", ".local/state", home),
27
- cache: xdgRoot("XDG_CACHE_HOME", ".cache", home)
28
- };
29
- }
30
- function configRoot2(home = os.homedir()) {
31
- return override(home) ?? defaultConfigRoot(home);
32
- }
33
- function dataRoot(home = os.homedir()) {
34
- return override(home) ?? xdgRoot("XDG_DATA_HOME", ".local/share", home);
35
- }
36
- function stateRoot(home = os.homedir()) {
37
- return override(home) ?? xdgRoot("XDG_STATE_HOME", ".local/state", home);
38
- }
39
- function cacheRoot(home = os.homedir()) {
40
- return override(home) ?? xdgRoot("XDG_CACHE_HOME", ".cache", home);
41
- }
42
- function installerBinRoot(home = os.homedir()) {
43
- const configured = home === os.homedir() ? process.env.XDG_BIN_HOME : undefined;
44
- return configured && path.isAbsolute(configured) ? configured : path.join(home, ".local", "bin");
45
- }
46
- function binRoot(home = os.homedir()) {
47
- if (override(home))
48
- return path.join(override(home), "bin");
49
- return installerBinRoot(home);
50
- }
51
- var installedBinaryPath = (home = os.homedir()) => path.join(binRoot(home), binaryName());
52
- var installerBinaryPath = (home = os.homedir()) => path.join(installerBinRoot(home), binaryName());
53
- var defaultSettingsPath = (home = os.homedir()) => path.join(defaultConfigRoot(home), "settings.json");
54
- var packageRoot = () => path.dirname(path.dirname(fileURLToPath(import.meta.url)));
55
- var oldStoreMarker = () => path.join(stateRoot(), "old-store-extension");
56
- function fromCheckout() {
57
- return !compiledBinary() && fs.existsSync(path.join(packageRoot(), "src", "main.ts"));
58
- }
59
- var compiledBinary = () => globalThis.__OPENCODE_BROWSER_COMPILED__ === true;
60
- var binaryPackage = () => globalThis.__OPENCODE_BROWSER_TARGET__ ? `@opencode/browse-${globalThis.__OPENCODE_BROWSER_TARGET__}` : undefined;
61
- var binaryName = (platform = process.platform) => platform === "win32" ? "browse.exe" : "browse";
62
- var scriptEntry = (entry) => /\.[cm]?[jt]s$/.test(entry);
63
- var entryCommand = (entry, node = process.execPath) => scriptEntry(entry) ? [node, entry] : [entry];
64
- var windowsShellShim = (entry, pathModule) => /\.(cmd|bat)$/i.test(entry) || pathModule.extname(entry) === "" && !pathModule.isAbsolute(entry) && !/[\\/]/.test(entry);
65
- var npxEntry = (entry) => /(^|\/)_npx\//.test(entry.replaceAll("\\", "/"));
66
- function resolveWindowsShim(entry, node = process.execPath, options = {}) {
67
- const pathModule = options.pathModule ?? path.win32;
68
- const exists = options.existsSync ?? fs.existsSync;
69
- if (!windowsShellShim(entry, pathModule))
70
- return;
71
- const shimmed = /\.(cmd|bat)$/i.test(entry);
72
- const withFolder = shimmed && (pathModule.isAbsolute(entry) || /[\\/]/.test(entry));
73
- const directories = withFolder ? [pathModule.dirname(entry)] : (options.env ?? process.env).PATH?.split(";").map((directory) => directory.trim().replace(/^"(.*)"$/, "$1")).filter(Boolean) ?? [];
74
- for (const directory of directories) {
75
- if (!shimmed) {
76
- const executable = pathModule.join(directory, `${entry}.exe`);
77
- if (exists(executable))
78
- return [executable];
79
- }
80
- const shim = withFolder ? entry : pathModule.join(directory, shimmed ? entry : `${entry}.cmd`);
81
- if (!exists(shim))
82
- continue;
83
- const script = pathModule.join(directory, "node_modules", "@opencode", "browse", "dist", "cli.mjs");
84
- if (exists(script))
85
- return [node, script];
86
- }
87
- return;
88
- }
89
- function entrySpawnCommand(entry, node = process.execPath, options = {}) {
90
- if (scriptEntry(entry))
91
- return [node, entry];
92
- const pathModule = options.pathModule ?? path.win32;
93
- if ((options.platform ?? process.platform) !== "win32" || !windowsShellShim(entry, pathModule))
94
- return [entry];
95
- const resolved = resolveWindowsShim(entry, node, options);
96
- if (resolved)
97
- return resolved;
98
- const running = options.running ?? runningEntry();
99
- const compiled = options.compiled ?? compiledBinary();
100
- const checkout = options.checkout ?? fromCheckout();
101
- return !compiled && !checkout && scriptEntry(running) && !npxEntry(running) ? [node, running] : [entry];
102
- }
103
- function installedBinary() {
104
- const binary = installedBinaryPath();
105
- return fs.existsSync(binary) ? binary : undefined;
106
- }
107
- var runningEntry = () => compiledBinary() ? process.execPath : process.argv[1];
108
- function checkoutRoot() {
109
- return fromCheckout() ? path.dirname(packageRoot()) : undefined;
110
- }
111
- var quoted = (value) => /^[\w@%+=:,./-]+$/.test(value) ? value : JSON.stringify(value);
112
- function cliInstall() {
113
- if (compiledBinary())
114
- return { kind: "binary", binary: installedBinary() ?? process.execPath, pathEnv: process.env.PATH };
115
- if (fromCheckout())
116
- return { kind: "checkout", bundle: path.join(packageRoot(), "dist", "cli.mjs") };
117
- return { kind: "npm", version: "0.0.17-dev.185", npx: /[/\\]_npx[/\\]/.test(process.argv[1] ?? "") };
118
- }
119
- function cliPrefix(install = cliInstall()) {
120
- if (install.kind === "binary") {
121
- const dir = path.dirname(install.binary);
122
- const onPath = (install.pathEnv ?? "").split(path.delimiter).some((entry) => entry && path.resolve(entry) === dir);
123
- return onPath ? "browse" : quoted(install.binary);
124
- }
125
- if (install.kind === "checkout")
126
- return `node ${quoted(install.bundle)}`;
127
- if (install.npx)
128
- return install.version?.includes("-dev.") ? "npx @opencode/browse@dev" : "npx @opencode/browse";
129
- return "browse";
130
- }
131
- var cliCommand = (args, install = cliInstall()) => `${cliPrefix(install)} ${args}`;
132
- var STORE_ITEM_ID = /^[a-p]{32}$/;
133
- var PUBLIC_STORE_ID = "mfnicocicmmlkpjnaffgihfjhdgjkdjg";
134
- function storeConfig(env = process.env, baked = { id: "mfnicocicmmlkpjnaffgihfjhdgjkdjg" }) {
135
- const id = [env.OPENCODE_BROWSER_STORE_ID, baked?.id].find((value) => value && STORE_ITEM_ID.test(value));
136
- return id ? { id } : {};
137
- }
138
- var RELEASE_SERVICE = "https://anoma.ly/release";
139
- function devExtension(baked = { file: "browse-extension-0.0.17-dev.185.zip", sha256: "34356c57c65878977f8ccb8eff624ea2ae8e3b13974ddad7aa4c2e6c0268488a", size: 187301 }) {
140
- return baked && /^[0-9a-f]{64}$/.test(baked.sha256) && /^[\w.-]+\.zip$/.test(baked.file) ? baked : undefined;
141
- }
142
- var devExtensionUrl = (extension, env = process.env) => `${(env.OPENCODE_BROWSER_RELEASE_SERVICE || RELEASE_SERVICE).replace(/\/+$/, "")}/browse/files/${extension.sha256}/${extension.file}`;
143
- var devExtensionFolder = (root = cacheRoot()) => path.join(root, "extension");
144
- var storeUrl = (id) => `https://chromewebstore.google.com/detail/${id}`;
145
- function installCommand() {
146
- return fromCheckout() ? `cd ${quoted(path.dirname(packageRoot()))} && bun run setup` : cliCommand("install");
147
- }
7
+ } from "./main-qrqem3fy.mjs";
8
+ import {
9
+ stateRoot,
10
+ fromCheckout,
11
+ compiledBinary,
12
+ entrySpawnCommand,
13
+ installedBinary,
14
+ cliPrefix,
15
+ RELEASE_SERVICE
16
+ } from "./main-tryp3jph.mjs";
148
17
 
149
18
  // src/protocol.ts
150
19
  var extensionProtocolVersion = 3;
@@ -262,13 +131,13 @@ function isJsonObject(value) {
262
131
  // src/update/auto-update.ts
263
132
  import { spawn, spawnSync } from "node:child_process";
264
133
  import { chmodSync as chmodSync2, closeSync, existsSync, mkdirSync as mkdirSync2, mkdtempSync, openSync, readFileSync as readFileSync2, renameSync, rmSync, realpathSync, writeFileSync as writeFileSync2 } from "node:fs";
265
- import os2 from "node:os";
266
- import path3 from "node:path";
134
+ import os from "node:os";
135
+ import path2 from "node:path";
267
136
 
268
137
  // src/update/release-service.ts
269
138
  import crypto from "node:crypto";
270
139
  import { chmodSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
271
- import path2 from "node:path";
140
+ import path from "node:path";
272
141
  function serviceTarget(target) {
273
142
  return target.replace(/^darwin-/, "macos-");
274
143
  }
@@ -457,7 +326,7 @@ async function checkRelease(options) {
457
326
  return { status: "manifest", releaseVersion, decision, ...manifest.etag ? { etag: manifest.etag } : {} };
458
327
  }
459
328
  function rolloutBucket(root = stateRoot()) {
460
- const file = path2.join(root, "rollout-bucket");
329
+ const file = path.join(root, "rollout-bucket");
461
330
  try {
462
331
  const saved = Number(readFileSync(file, "utf8").trim());
463
332
  if (Number.isInteger(saved) && saved >= 0 && saved < 100)
@@ -509,7 +378,7 @@ function installKind(entry = process.argv[1] ?? "", checkout = fromCheckout()) {
509
378
  }
510
379
  var packageVersion = (entry) => {
511
380
  try {
512
- const manifest = path3.join(path3.dirname(path3.dirname(entry)), "package.json");
381
+ const manifest = path2.join(path2.dirname(path2.dirname(entry)), "package.json");
513
382
  const version = JSON.parse(readFileSync2(manifest, "utf8")).version;
514
383
  return typeof version === "string" ? version : undefined;
515
384
  } catch {
@@ -537,15 +406,15 @@ function installedRuntime2(entry = process.argv[1] ?? process.execPath) {
537
406
  return { kind, entry: resolved, version: packageVersion(resolved) ?? opencodeBrowserVersion2 };
538
407
  }
539
408
  async function updateTarget(runtime, run = runCommand, env = process.env) {
540
- if (runtime.kind !== "npm" || !insidePath(runtime.entry, path3.join(legacyDataRoot(), "runtime", "versions")))
409
+ if (runtime.kind !== "npm" || !insidePath(runtime.entry, path2.join(legacyDataRoot(), "runtime", "versions")))
541
410
  return runtime;
542
411
  const root = await npmGlobalRoot(run, env);
543
- return root ? { ...runtime, entry: path3.join(root, ...PACKAGE_NAME.split("/"), "dist", "cli.mjs") } : undefined;
412
+ return root ? { ...runtime, entry: path2.join(root, ...PACKAGE_NAME.split("/"), "dist", "cli.mjs") } : undefined;
544
413
  }
545
414
  async function npmGlobalRoot(run = runCommand, env = process.env) {
546
415
  const result = await run("npm", ["root", "-g"], { timeoutMs: 20000, env });
547
416
  const root = result.status === 0 ? result.stdout.trim() : "";
548
- return root && path3.isAbsolute(root) ? root : undefined;
417
+ return root && path2.isAbsolute(root) ? root : undefined;
549
418
  }
550
419
  function installedVersion(runtime) {
551
420
  if (runtime.kind === "binary") {
@@ -554,7 +423,7 @@ function installedVersion(runtime) {
554
423
  }
555
424
  return packageVersion(runtime.entry);
556
425
  }
557
- var autoUpdateStatePath = () => path3.join(stateRoot(), "auto-update.json");
426
+ var autoUpdateStatePath = () => path2.join(stateRoot(), "auto-update.json");
558
427
  function readJson(file) {
559
428
  try {
560
429
  return JSON.parse(readFileSync2(file, "utf8"));
@@ -563,7 +432,7 @@ function readJson(file) {
563
432
  }
564
433
  }
565
434
  function writeJsonAtomic(file, value) {
566
- mkdirSync2(path3.dirname(file), { recursive: true, mode: 448 });
435
+ mkdirSync2(path2.dirname(file), { recursive: true, mode: 448 });
567
436
  const temporary = `${file}.${process.pid}.tmp`;
568
437
  writeFileSync2(temporary, JSON.stringify(value, null, 2) + `
569
438
  `, { mode: 384 });
@@ -614,6 +483,7 @@ function autoUpdateStatus(options = {}) {
614
483
  ...override ? { overriddenBy: env.OPENCODE_BROWSER_AUTO_UPDATE !== undefined ? "OPENCODE_BROWSER_AUTO_UPDATE" : "OPENCODE_BROWSER_UPDATE_CHECK" } : {},
615
484
  ...runtime ? { version: runtime.version, channel: channelOf(runtime.version) } : {},
616
485
  ...state.latest ? { latest: state.latest } : {},
486
+ ...state.latestAt ? { latestAt: new Date(state.latestAt).toISOString() } : {},
617
487
  ...state.checkedAt ? { checkedAt: new Date(state.checkedAt).toISOString() } : {},
618
488
  ...state.lastUpdate ? { lastUpdate: state.lastUpdate } : {},
619
489
  ...state.lastError ? { lastError: state.lastError } : {}
@@ -640,7 +510,7 @@ function updateAvailable(status) {
640
510
  return status.install === "binary" ? status.latest !== status.version : compareVersions(status.latest, status.version) > 0;
641
511
  }
642
512
  var runCommand = (command, args, options = {}) => new Promise((resolve) => {
643
- const npmCli = process.platform === "win32" && command === "npm" ? path3.join(path3.dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js") : undefined;
513
+ const npmCli = process.platform === "win32" && command === "npm" ? path2.join(path2.dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js") : undefined;
644
514
  const [file, argv] = npmCli && existsSync(npmCli) ? [process.execPath, [npmCli, ...args]] : [command, args];
645
515
  const child = spawn(file, argv, { env: options.env ?? process.env, stdio: ["ignore", "pipe", "pipe"], windowsHide: true });
646
516
  let stdout = "";
@@ -709,8 +579,8 @@ async function runInstaller(options) {
709
579
  }) : options.installer ?? globalThis.__OPENCODE_BROWSER_INSTALLER__;
710
580
  if (!script)
711
581
  throw new Error("this build has no installer to run; install browse again with the install script");
712
- const directory = mkdtempSync(path3.join(os2.tmpdir(), "browse-install-"));
713
- const file = path3.join(directory, platform === "win32" ? "install.ps1" : "install");
582
+ const directory = mkdtempSync(path2.join(os.tmpdir(), "browse-install-"));
583
+ const file = path2.join(directory, platform === "win32" ? "install.ps1" : "install");
714
584
  const args = [...options.version ? ["--version", options.version] : options.channel ? ["--channel", options.channel] : [], "--no-setup"];
715
585
  try {
716
586
  writeFileSync2(file, script, { mode: platform === "win32" ? 384 : 448 });
@@ -767,21 +637,25 @@ function createAutoUpdater(deps) {
767
637
  });
768
638
  if (result.status === "unchanged") {
769
639
  deps.log("autoupdate.unchanged", { channel: serviceChannel, running });
770
- return updateState(({ failed: _failed, ...rest }) => ({ ...rest, checkedAt: now() }));
640
+ return updateState(({ failed: _failed, ...rest }) => ({
641
+ ...rest,
642
+ checkedAt: now(),
643
+ ...rest.latest && !rest.latestAt ? { latestAt: now() } : {}
644
+ }));
771
645
  }
772
646
  if (result.status === "missing") {
773
647
  deps.log("autoupdate.no_release", { channel: serviceChannel, running });
774
- return updateState(({ failed: _failed, latest: _latest, etag: _etag, ...rest }) => ({ ...rest, checkedAt: now() }));
648
+ return updateState(({ failed: _failed, latest: _latest, latestAt: _latestAt, etag: _etag, ...rest }) => ({ ...rest, checkedAt: now() }));
775
649
  }
776
650
  const decision = result.decision;
777
651
  if (decision.action === "reject")
778
652
  throw new Error(`the ${serviceChannel} manifest was rejected: ${decision.reason}`);
779
653
  deps.log("autoupdate.checked", { channel: serviceChannel, current: result.releaseVersion, running, decision: decision.reason });
780
- return updateState(({ failed: _failed, latest: _latest, etag: _etag, ...rest }) => ({
654
+ return updateState(({ failed: _failed, latest: previous, latestAt: previousAt, etag: _etag, ...rest }) => ({
781
655
  ...rest,
782
656
  checkedAt: now(),
783
657
  ...result.etag ? { etag: result.etag } : {},
784
- ...decision.action === "install" ? { latest: decision.version } : {}
658
+ ...decision.action === "install" ? { latest: decision.version, latestAt: previous === decision.version && previousAt ? previousAt : now() } : {}
785
659
  }));
786
660
  }
787
661
  async function tick() {
@@ -804,7 +678,12 @@ function createAutoUpdater(deps) {
804
678
  state = await checkBinary(state, channel);
805
679
  } else {
806
680
  const published = await fetchPublished({ registry: await registryUrl(deps.run, env), channel, ...deps.fetch ? { fetch: deps.fetch } : {} });
807
- state = updateState(({ failed: _failed, ...rest }) => ({ ...rest, checkedAt: now(), latest: published.version }));
681
+ state = updateState(({ failed: _failed, latest: previous, latestAt: previousAt, ...rest }) => ({
682
+ ...rest,
683
+ checkedAt: now(),
684
+ latest: published.version,
685
+ latestAt: previous === published.version && previousAt ? previousAt : now()
686
+ }));
808
687
  deps.log("autoupdate.checked", { channel, latest: published.version, running });
809
688
  }
810
689
  } catch (error) {
@@ -902,9 +781,9 @@ function createAutoUpdater(deps) {
902
781
  }
903
782
  function spawnRuntimeChild(runtime, args, onExit, env = process.env) {
904
783
  const { OPENCODE_BROWSER_MANAGED_RELAY: _managed, OPENCODE_BROWSER_RESTART_REQUEST_ID: _request, ...rest } = env;
905
- const directory = path3.join(stateRoot(), "logs");
784
+ const directory = path2.join(stateRoot(), "logs");
906
785
  mkdirSync2(directory, { recursive: true, mode: 448 });
907
- const log = openSync(path3.join(directory, "auto-update.log"), "a", 384);
786
+ const log = openSync(path2.join(directory, "auto-update.log"), "a", 384);
908
787
  try {
909
788
  const [file, ...prefix] = entrySpawnCommand(runtime.entry);
910
789
  const child = spawn(file, [...prefix, ...args], { detached: true, stdio: ["ignore", log, log], env: rest, windowsHide: true });
@@ -920,4 +799,4 @@ function spawnRuntimeChild(runtime, args, onExit, env = process.env) {
920
799
  }
921
800
  }
922
801
 
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 };
802
+ export { 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,7 +1,7 @@
1
1
  import {
2
2
  unpackedExtensionId,
3
3
  parseJsonObject
4
- } from "./main-z32979g4.mjs";
4
+ } from "./main-m9n50a86.mjs";
5
5
  import {
6
6
  decodeUnknownOption,
7
7
  optionalKey,
@@ -29,7 +29,7 @@ import {
29
29
  NonEmptyString,
30
30
  TaggedError2,
31
31
  Json
32
- } from "./main-6hvv25x8.mjs";
32
+ } from "./main-8xd753k5.mjs";
33
33
  import {
34
34
  isString,
35
35
  isNumber,
@@ -42,7 +42,7 @@ import {
42
42
  callback2,
43
43
  fail6,
44
44
  catch_
45
- } from "./main-m45zegrn.mjs";
45
+ } from "./main-0h387a1q.mjs";
46
46
  // src/fs-durability.ts
47
47
  import crypto from "node:crypto";
48
48
  import fsSync from "node:fs";
@@ -364,8 +364,7 @@ var NetworkStartRequest = Struct({
364
364
  });
365
365
  var NetworkSessionRequest = Struct({ sessionId: NonEmptyString });
366
366
  var NetworkStopRequest = NetworkSessionRequest.pipe(fieldsAssign({
367
- outputPath: optionalKey(String3),
368
- secrets: optionalKey(NonEmptyString)
367
+ outputPath: optionalKey(String3)
369
368
  }));
370
369
  var NetworkStatusResponse = Struct({
371
370
  active: Boolean3,
@@ -379,23 +378,9 @@ var NetworkStatusResponse = Struct({
379
378
  urlFilter: optionalKey(String3),
380
379
  resourceTypes: optionalKey(ArraySchema(String3)),
381
380
  content: optionalKey(NetworkContentMode),
382
- secrets: optionalKey(String3),
383
381
  endsAt: optionalKey(String3),
384
382
  ended: optionalKey(String3)
385
383
  });
386
- var AuthProfileSlotSummary = Struct({
387
- ref: String3,
388
- sources: ArraySchema(String3),
389
- expiresAt: optionalKey(String3),
390
- expired: Boolean3
391
- });
392
- var AuthProfileSummary = Struct({
393
- name: String3,
394
- createdAt: String3,
395
- updatedAt: String3,
396
- slotCount: Number2,
397
- slots: ArraySchema(AuthProfileSlotSummary)
398
- });
399
384
  var NetworkEndpointDigest = Struct({
400
385
  method: String3,
401
386
  url: String3,
@@ -409,35 +394,9 @@ var NetworkStopResponse = NetworkStatusResponse.pipe(fieldsAssign({
409
394
  active: Literal(false),
410
395
  stoppedAt: String3,
411
396
  outputPath: optionalKey(String3),
412
- authProfile: optionalKey(AuthProfileSummary),
413
- updatedSecretRefs: ArraySchema(String3),
414
- observedSecretRefs: ArraySchema(String3),
415
397
  endpoints: optionalKey(ArraySchema(NetworkEndpointDigest))
416
398
  }));
417
399
  var NetworkCancelResponse = Struct({ cancelled: Boolean3 });
418
- var AuthProfileRequest = Struct({ name: NonEmptyString });
419
- var AuthRefreshRequest = Struct({
420
- sessionId: NonEmptyString,
421
- name: NonEmptyString,
422
- urlFilter: optionalKey(String3),
423
- timeoutMs: optionalKey(Int2.check(isGreaterThan(0)))
424
- });
425
- var AuthRunRequest = Struct({
426
- name: NonEmptyString,
427
- command: NonEmptyString,
428
- args: optionalKey(ArraySchema(String3)),
429
- cwd: optionalKey(String3),
430
- timeoutMs: optionalKey(Int2.check(isGreaterThan(0)))
431
- });
432
- var AuthRunResponse = Struct({
433
- exitCode: Number2,
434
- signal: NullOr(String3),
435
- stdout: String3,
436
- stderr: String3,
437
- stdoutTruncated: Boolean3,
438
- stderrTruncated: Boolean3,
439
- durationMs: Number2
440
- });
441
400
  var RecordingMode = Literals(["tab-capture", "cdp"]);
442
401
  var RecordingRequestedMode = Literals(["auto", "tab-capture", "cdp"]);
443
402
  var RecordingFrameRate = Number2.check(isInt(), isBetween({ minimum: 1, maximum: 60 }));
@@ -1017,4 +976,4 @@ async function dataUrlDocument2(url) {
1017
976
  return;
1018
977
  }
1019
978
 
1020
- export { isNodeError, isUnsupportedDirectorySyncError, writeJsonFileAtomically, ensurePrivateDirectorySync, writePrivateJsonFileSync, SessionContainer, SessionsContainer, SessionDeleted, SessionResetResponse, ExecuteRequest, SessionAdoptRequest, SessionNewRequest, SessionEnsureRequest, SessionIdRequest, SessionAllowlistRequest, SessionAdoptResponse, ExecuteLogEntry, ExecuteLogSummary, ExecuteAftermath, ExecuteResponse, AuthenticatedJsonRequest, AuthenticatedJsonOutcome, TargetSummaries, ExtensionStatus, RelayVersion, RelayShutdownRequest, RelayShutdownResponse, NetworkStartRequest, NetworkSessionRequest, NetworkStopRequest, NetworkStatusResponse, AuthProfileSummary, NetworkStopResponse, NetworkCancelResponse, AuthProfileRequest, AuthRefreshRequest, AuthRunRequest, AuthRunResponse, RecordingQuality, RecordingTargetRequest, RecordingStartRequest, RecordingStartResponse, RecordingStopResponse, RecordingStatusResponse, TabsCleanupResponse, SettingsGetResponse, SettingsSetResponse, RecordingCancelResponse, FlightRecorderStartRequest, FlightRecorderStatusResponse, FlightRecorderSaveRequest, FlightRecorderSaveResponse, FlightRecorderCancelResponse, RelayErrorCode, ErrorEnvelope, HttpRouteError2, formatHostForUrl2, listenHttpServer2, closeHttpServer2, closeWebSocketServer2, logCloseError2, sendJson2, readJsonBody2, stableUnpackedExtensionOrigin2, chromeExtensionOriginForPath2, parseAdditionalExtensionOrigins2, validateHostHeader2, validateBrowserFetchSite2, validateWebSocketOrigin2, defaultHost2, defaultPort2, optionalSessionId2, isValidSessionId2, requiredSessionId2, parseTargetSelection2, generateSessionId2, sendCdpResponse2, sendCdpEvent2, getObject2, getString2, createTargetUrl2, getNumber2, getIdText2, headerValue2, getTargetInfo2, isRestrictedTarget2, isRestrictedUrl2, dataUrlDocument2 };
979
+ export { isNodeError, isUnsupportedDirectorySyncError, writeJsonFileAtomically, ensurePrivateDirectorySync, writePrivateJsonFileSync, SessionContainer, SessionsContainer, SessionDeleted, SessionResetResponse, ExecuteRequest, SessionAdoptRequest, SessionNewRequest, SessionEnsureRequest, SessionIdRequest, SessionAllowlistRequest, SessionAdoptResponse, ExecuteLogEntry, ExecuteLogSummary, ExecuteAftermath, ExecuteResponse, AuthenticatedJsonRequest, AuthenticatedJsonOutcome, TargetSummaries, ExtensionStatus, RelayVersion, RelayShutdownRequest, RelayShutdownResponse, NetworkStartRequest, NetworkSessionRequest, NetworkStopRequest, NetworkStatusResponse, NetworkStopResponse, NetworkCancelResponse, RecordingQuality, RecordingTargetRequest, RecordingStartRequest, RecordingStartResponse, RecordingStopResponse, RecordingStatusResponse, TabsCleanupResponse, SettingsGetResponse, SettingsSetResponse, RecordingCancelResponse, FlightRecorderStartRequest, FlightRecorderStatusResponse, FlightRecorderSaveRequest, FlightRecorderSaveResponse, FlightRecorderCancelResponse, RelayErrorCode, ErrorEnvelope, HttpRouteError2, formatHostForUrl2, listenHttpServer2, closeHttpServer2, closeWebSocketServer2, logCloseError2, sendJson2, readJsonBody2, stableUnpackedExtensionOrigin2, chromeExtensionOriginForPath2, parseAdditionalExtensionOrigins2, validateHostHeader2, validateBrowserFetchSite2, validateWebSocketOrigin2, defaultHost2, defaultPort2, optionalSessionId2, isValidSessionId2, requiredSessionId2, parseTargetSelection2, generateSessionId2, sendCdpResponse2, sendCdpEvent2, getObject2, getString2, createTargetUrl2, getNumber2, getIdText2, headerValue2, getTargetInfo2, isRestrictedTarget2, isRestrictedUrl2, dataUrlDocument2 };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  ensurePrivateDirectorySync
3
- } from "./main-ndmgt6k5.mjs";
3
+ } from "./main-mvjg1jye.mjs";
4
4
  import {
5
5
  dataRoot
6
- } from "./main-z32979g4.mjs";
6
+ } from "./main-tryp3jph.mjs";
7
7
 
8
8
  // src/relay/secrets.ts
9
9
  import crypto from "node:crypto";
@@ -0,0 +1,4 @@
1
+ // src/version.ts
2
+ var opencodeBrowserVersion2 = "0.0.17-dev.188";
3
+ var opencodeBrowserBuildId2 = "2026-11-14T17:01:47.849Z";
4
+ export { opencodeBrowserVersion2, opencodeBrowserBuildId2 };
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  writePrivateJsonFileSync
3
- } from "./main-ndmgt6k5.mjs";
3
+ } from "./main-mvjg1jye.mjs";
4
4
  import {
5
5
  bundledPairingCodeTtlMs,
6
6
  mintPairingCode,
7
7
  writeExtensionPairing
8
- } from "./main-sbqypb33.mjs";
8
+ } from "./main-d8km89cz.mjs";
9
9
  import {
10
10
  configRoot2,
11
11
  cacheRoot,
12
12
  devExtensionUrl,
13
13
  devExtensionFolder
14
- } from "./main-z32979g4.mjs";
14
+ } from "./main-tryp3jph.mjs";
15
15
 
16
16
  // src/setup/dev-extension.ts
17
17
  import { createHash } from "node:crypto";
@@ -158,4 +158,4 @@ function isLocalPeer(socket) {
158
158
  return remote !== undefined && (remote === "::1" || remote.startsWith("127."));
159
159
  }
160
160
 
161
- export { parseHostname, readRelayConfig, writeRelayConfig, relayHostname, isLocalPeer, installedDevExtension, syncDevExtension };
161
+ export { installedDevExtension, syncDevExtension, parseHostname, readRelayConfig, writeRelayConfig, relayHostname, isLocalPeer };
@@ -0,0 +1,141 @@
1
+ // src/paths.ts
2
+ import fs from "node:fs";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ var override = (home) => home === os.homedir() && process.env.OPENCODE_BROWSER_HOME ? process.env.OPENCODE_BROWSER_HOME : undefined;
7
+ var xdgRoot = (variable, fallback, home) => {
8
+ const configured = home === os.homedir() ? process.env[variable] : undefined;
9
+ return path.join(configured && path.isAbsolute(configured) ? configured : path.join(home, fallback), "browse");
10
+ };
11
+ function defaultConfigRoot(home = os.homedir()) {
12
+ return xdgRoot("XDG_CONFIG_HOME", ".config", home);
13
+ }
14
+ function defaultRoots(home = os.homedir()) {
15
+ return {
16
+ config: defaultConfigRoot(home),
17
+ data: xdgRoot("XDG_DATA_HOME", ".local/share", home),
18
+ state: xdgRoot("XDG_STATE_HOME", ".local/state", home),
19
+ cache: xdgRoot("XDG_CACHE_HOME", ".cache", home)
20
+ };
21
+ }
22
+ function configRoot2(home = os.homedir()) {
23
+ return override(home) ?? defaultConfigRoot(home);
24
+ }
25
+ function dataRoot(home = os.homedir()) {
26
+ return override(home) ?? xdgRoot("XDG_DATA_HOME", ".local/share", home);
27
+ }
28
+ function stateRoot(home = os.homedir()) {
29
+ return override(home) ?? xdgRoot("XDG_STATE_HOME", ".local/state", home);
30
+ }
31
+ function cacheRoot(home = os.homedir()) {
32
+ return override(home) ?? xdgRoot("XDG_CACHE_HOME", ".cache", home);
33
+ }
34
+ function installerBinRoot(home = os.homedir()) {
35
+ const configured = home === os.homedir() ? process.env.XDG_BIN_HOME : undefined;
36
+ return configured && path.isAbsolute(configured) ? configured : path.join(home, ".local", "bin");
37
+ }
38
+ function binRoot(home = os.homedir()) {
39
+ if (override(home))
40
+ return path.join(override(home), "bin");
41
+ return installerBinRoot(home);
42
+ }
43
+ var installedBinaryPath = (home = os.homedir()) => path.join(binRoot(home), binaryName());
44
+ var installerBinaryPath = (home = os.homedir()) => path.join(installerBinRoot(home), binaryName());
45
+ var defaultSettingsPath = (home = os.homedir()) => path.join(defaultConfigRoot(home), "settings.json");
46
+ var packageRoot = () => path.dirname(path.dirname(fileURLToPath(import.meta.url)));
47
+ var oldStoreMarker = () => path.join(stateRoot(), "old-store-extension");
48
+ function fromCheckout() {
49
+ return !compiledBinary() && fs.existsSync(path.join(packageRoot(), "src", "main.ts"));
50
+ }
51
+ var compiledBinary = () => globalThis.__OPENCODE_BROWSER_COMPILED__ === true;
52
+ var binaryPackage = () => globalThis.__OPENCODE_BROWSER_TARGET__ ? `@opencode/browse-${globalThis.__OPENCODE_BROWSER_TARGET__}` : undefined;
53
+ var binaryName = (platform = process.platform) => platform === "win32" ? "browse.exe" : "browse";
54
+ var scriptEntry = (entry) => /\.[cm]?[jt]s$/.test(entry);
55
+ var entryCommand = (entry, node = process.execPath) => scriptEntry(entry) ? [node, entry] : [entry];
56
+ var windowsShellShim = (entry, pathModule) => /\.(cmd|bat)$/i.test(entry) || pathModule.extname(entry) === "" && !pathModule.isAbsolute(entry) && !/[\\/]/.test(entry);
57
+ var npxEntry = (entry) => /(^|\/)_npx\//.test(entry.replaceAll("\\", "/"));
58
+ function resolveWindowsShim(entry, node = process.execPath, options = {}) {
59
+ const pathModule = options.pathModule ?? path.win32;
60
+ const exists = options.existsSync ?? fs.existsSync;
61
+ if (!windowsShellShim(entry, pathModule))
62
+ return;
63
+ const shimmed = /\.(cmd|bat)$/i.test(entry);
64
+ const withFolder = shimmed && (pathModule.isAbsolute(entry) || /[\\/]/.test(entry));
65
+ const directories = withFolder ? [pathModule.dirname(entry)] : (options.env ?? process.env).PATH?.split(";").map((directory) => directory.trim().replace(/^"(.*)"$/, "$1")).filter(Boolean) ?? [];
66
+ for (const directory of directories) {
67
+ if (!shimmed) {
68
+ const executable = pathModule.join(directory, `${entry}.exe`);
69
+ if (exists(executable))
70
+ return [executable];
71
+ }
72
+ const shim = withFolder ? entry : pathModule.join(directory, shimmed ? entry : `${entry}.cmd`);
73
+ if (!exists(shim))
74
+ continue;
75
+ const script = pathModule.join(directory, "node_modules", "@opencode", "browse", "dist", "cli.mjs");
76
+ if (exists(script))
77
+ return [node, script];
78
+ }
79
+ return;
80
+ }
81
+ function entrySpawnCommand(entry, node = process.execPath, options = {}) {
82
+ if (scriptEntry(entry))
83
+ return [node, entry];
84
+ const pathModule = options.pathModule ?? path.win32;
85
+ if ((options.platform ?? process.platform) !== "win32" || !windowsShellShim(entry, pathModule))
86
+ return [entry];
87
+ const resolved = resolveWindowsShim(entry, node, options);
88
+ if (resolved)
89
+ return resolved;
90
+ const running = options.running ?? runningEntry();
91
+ const compiled = options.compiled ?? compiledBinary();
92
+ const checkout = options.checkout ?? fromCheckout();
93
+ return !compiled && !checkout && scriptEntry(running) && !npxEntry(running) ? [node, running] : [entry];
94
+ }
95
+ function installedBinary() {
96
+ const binary = installedBinaryPath();
97
+ return fs.existsSync(binary) ? binary : undefined;
98
+ }
99
+ var runningEntry = () => compiledBinary() ? process.execPath : process.argv[1];
100
+ function checkoutRoot() {
101
+ return fromCheckout() ? path.dirname(packageRoot()) : undefined;
102
+ }
103
+ var quoted = (value) => /^[\w@%+=:,./-]+$/.test(value) ? value : JSON.stringify(value);
104
+ function cliInstall() {
105
+ if (compiledBinary())
106
+ return { kind: "binary", binary: installedBinary() ?? process.execPath, pathEnv: process.env.PATH };
107
+ if (fromCheckout())
108
+ return { kind: "checkout", bundle: path.join(packageRoot(), "dist", "cli.mjs") };
109
+ return { kind: "npm", version: "0.0.17-dev.188", npx: /[/\\]_npx[/\\]/.test(process.argv[1] ?? "") };
110
+ }
111
+ function cliPrefix(install = cliInstall()) {
112
+ if (install.kind === "binary") {
113
+ const dir = path.dirname(install.binary);
114
+ const onPath = (install.pathEnv ?? "").split(path.delimiter).some((entry) => entry && path.resolve(entry) === dir);
115
+ return onPath ? "browse" : quoted(install.binary);
116
+ }
117
+ if (install.kind === "checkout")
118
+ return `node ${quoted(install.bundle)}`;
119
+ if (install.npx)
120
+ return install.version?.includes("-dev.") ? "npx @opencode/browse@dev" : "npx @opencode/browse";
121
+ return "browse";
122
+ }
123
+ var cliCommand = (args, install = cliInstall()) => `${cliPrefix(install)} ${args}`;
124
+ var STORE_ITEM_ID = /^[a-p]{32}$/;
125
+ var PUBLIC_STORE_ID = "mfnicocicmmlkpjnaffgihfjhdgjkdjg";
126
+ function storeConfig(env = process.env, baked = { id: "mfnicocicmmlkpjnaffgihfjhdgjkdjg" }) {
127
+ const id = [env.OPENCODE_BROWSER_STORE_ID, baked?.id].find((value) => value && STORE_ITEM_ID.test(value));
128
+ return id ? { id } : {};
129
+ }
130
+ var RELEASE_SERVICE = "https://anoma.ly/release";
131
+ function devExtension(baked = { file: "browse-extension-0.0.17-dev.188.zip", sha256: "6a85099e6b6e58f200e570558181c5a014f2d9298ba9ee3242f750b0d59af72d", size: 188013 }) {
132
+ return baked && /^[0-9a-f]{64}$/.test(baked.sha256) && /^[\w.-]+\.zip$/.test(baked.file) ? baked : undefined;
133
+ }
134
+ var devExtensionUrl = (extension, env = process.env) => `${(env.OPENCODE_BROWSER_RELEASE_SERVICE || RELEASE_SERVICE).replace(/\/+$/, "")}/browse/files/${extension.sha256}/${extension.file}`;
135
+ var devExtensionFolder = (root = cacheRoot()) => path.join(root, "extension");
136
+ var storeUrl = (id) => `https://chromewebstore.google.com/detail/${id}`;
137
+ function installCommand() {
138
+ return fromCheckout() ? `cd ${quoted(path.dirname(packageRoot()))} && bun run setup` : cliCommand("install");
139
+ }
140
+
141
+ export { defaultRoots, configRoot2, dataRoot, stateRoot, cacheRoot, binRoot, installedBinaryPath, installerBinaryPath, defaultSettingsPath, oldStoreMarker, fromCheckout, compiledBinary, binaryPackage, binaryName, scriptEntry, entryCommand, resolveWindowsShim, entrySpawnCommand, installedBinary, runningEntry, checkoutRoot, cliPrefix, cliCommand, PUBLIC_STORE_ID, storeConfig, RELEASE_SERVICE, devExtension, devExtensionUrl, devExtensionFolder, storeUrl, installCommand };