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

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 (27) hide show
  1. package/dist/{cli-n67t50qs.mjs → cli-fk82qmwb.mjs} +15 -14
  2. package/dist/cli.mjs +12 -12
  3. package/dist/{helpers-jj42z7rm.mjs → helpers-v2zmfak2.mjs} +1 -1
  4. package/dist/{legacy-runtime-tne3461e.mjs → legacy-runtime-rvfsgmzn.mjs} +6 -6
  5. package/dist/{main-b830e27p.mjs → main-1b344j42.mjs} +2 -2
  6. package/dist/{main-zgawp964.mjs → main-2wrvr3gc.mjs} +5 -5
  7. package/dist/{main-xnp01wxw.mjs → main-3ewrhbqw.mjs} +2 -2
  8. package/dist/{main-f1fdks8n.mjs → main-6my7bmf1.mjs} +2 -2
  9. package/dist/main-ew8jna3e.mjs +4 -0
  10. package/dist/{main-jt4h0g8x.mjs → main-ndmgt6k5.mjs} +8 -2
  11. package/dist/{main-aj4grz5c.mjs → main-qwf4vk41.mjs} +2 -2
  12. package/dist/{main-650pqeq5.mjs → main-sbqypb33.mjs} +2 -2
  13. package/dist/{main-1nnqhn1v.mjs → main-t2jyedkv.mjs} +2 -2
  14. package/dist/{main-ans6rqv0.mjs → main-x7takqns.mjs} +4 -4
  15. package/dist/{main-254jbd9y.mjs → main-xct4r41x.mjs} +3 -3
  16. package/dist/{main-h3sgxdjn.mjs → main-xjskgtdr.mjs} +2 -2
  17. package/dist/{main-k39ype39.mjs → main-z32979g4.mjs} +3 -3
  18. package/dist/{mcp-9sch561m.mjs → mcp-2xkjfnqz.mjs} +9 -9
  19. package/dist/{migrate-dwpc3854.mjs → migrate-fygxtp2g.mjs} +5 -5
  20. package/dist/{relay-q62xjvg0.mjs → relay-mbjgxbtr.mjs} +181 -40
  21. package/dist/{runtime-update-797qc0w9.mjs → runtime-update-ngg3m888.mjs} +6 -6
  22. package/dist/{setup-31sys1aq.mjs → setup-t0pbhmzh.mjs} +9 -9
  23. package/dist/{supervisor-ratepwa5.mjs → supervisor-wrrnbfhw.mjs} +5 -5
  24. package/dist/{update-7mb87vfx.mjs → update-heze6vjn.mjs} +3 -3
  25. package/dist/{version-144ecn73.mjs → version-x1kkvpqn.mjs} +1 -1
  26. package/package.json +1 -1
  27. package/dist/main-70nwvs6t.mjs +0 -4
@@ -25,7 +25,7 @@ import"./main-pmfd055v.mjs";
25
25
  import {
26
26
  opencodeBrowserVersion2,
27
27
  opencodeBrowserBuildId2
28
- } from "./main-70nwvs6t.mjs";
28
+ } from "./main-ew8jna3e.mjs";
29
29
  import {
30
30
  configRoot2,
31
31
  dataRoot,
@@ -40,11 +40,11 @@ import {
40
40
  extensionProtocolVersion,
41
41
  extensionProtocolAdvice,
42
42
  autoUpdateStatus
43
- } from "./main-k39ype39.mjs";
43
+ } from "./main-z32979g4.mjs";
44
44
  import {
45
45
  defaultPort2,
46
46
  isValidSessionId2
47
- } from "./main-jt4h0g8x.mjs";
47
+ } from "./main-ndmgt6k5.mjs";
48
48
  import {
49
49
  option,
50
50
  String2,
@@ -63,31 +63,31 @@ import {
63
63
  ensureExtensionConnected,
64
64
  stoppedRelayStatus,
65
65
  statusCollections
66
- } from "./main-zgawp964.mjs";
66
+ } from "./main-2wrvr3gc.mjs";
67
67
  import {
68
68
  updateJson2,
69
69
  formatUpdateNotice2,
70
70
  updateNotice2
71
- } from "./main-1nnqhn1v.mjs";
71
+ } from "./main-t2jyedkv.mjs";
72
72
  import {
73
73
  settingKeys,
74
74
  formatSettings,
75
75
  ensureSessionExists
76
- } from "./main-b830e27p.mjs";
76
+ } from "./main-1b344j42.mjs";
77
77
  import {
78
78
  addSecret,
79
79
  listSecrets,
80
80
  removeSecret
81
- } from "./main-f1fdks8n.mjs";
81
+ } from "./main-6my7bmf1.mjs";
82
82
  import {
83
83
  defaultJournalBaseDir,
84
84
  readJournalEntries,
85
85
  formatJournalEntry
86
- } from "./main-xnp01wxw.mjs";
87
- import"./main-h3sgxdjn.mjs";
86
+ } from "./main-3ewrhbqw.mjs";
87
+ import"./main-xjskgtdr.mjs";
88
88
  import {
89
89
  endpointForPort
90
- } from "./main-aj4grz5c.mjs";
90
+ } from "./main-qwf4vk41.mjs";
91
91
  import {
92
92
  taggedEnum,
93
93
  is2,
@@ -5858,7 +5858,7 @@ var status = make("status", {
5858
5858
  }
5859
5859
  })).pipe(withDescription4("Show relay, extension, and target status"));
5860
5860
  var mcp = make("mcp", {}, fn("Cli.mcp")(function* () {
5861
- const { runMcpServer } = yield* promise(() => import("./mcp-9sch561m.mjs"));
5861
+ const { runMcpServer } = yield* promise(() => import("./mcp-2xkjfnqz.mjs"));
5862
5862
  yield* runMcpServer;
5863
5863
  })).pipe(withDescription4("Run the browse MCP server over stdio"));
5864
5864
  registerCliCommand(400, () => tabs);
@@ -6306,12 +6306,12 @@ registerCliCommand(710, () => flightRecorder);
6306
6306
 
6307
6307
  // src/cli/relay.ts
6308
6308
  var serve = make("serve", {}, fn("Cli.serve")(function* () {
6309
- const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-q62xjvg0.mjs"), import("./helpers-jj42z7rm.mjs")]));
6309
+ const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-mbjgxbtr.mjs"), import("./helpers-v2zmfak2.mjs")]));
6310
6310
  const port = process.env.OPENCODE_BROWSER_PORT === undefined ? undefined : yield* portConfig;
6311
6311
  const additionalExtensionOrigins = parseAdditionalExtensionOrigins(yield* extensionOriginsConfig);
6312
6312
  yield* scoped(gen(function* () {
6313
6313
  const relay = yield* startRelay({ ...port === undefined ? {} : { port }, additionalExtensionOrigins });
6314
- yield* promise(() => import("./legacy-runtime-tne3461e.mjs").then((module) => module.commitLegacyTakeover()));
6314
+ yield* promise(() => import("./legacy-runtime-rvfsgmzn.mjs").then((module) => module.commitLegacyTakeover()));
6315
6315
  yield* log(`browse relay listening at ${relay.url}`);
6316
6316
  yield* log(`browse connects automatically while the browser runs. Run \`${cliCommand("status")}\` to check.`);
6317
6317
  yield* never;
@@ -6526,7 +6526,8 @@ var sessionList = make("list", {
6526
6526
  const keys = item.stateKeys.length ? ` state=${item.stateKeys.join(",")}` : "";
6527
6527
  const readOnly = item.readOnly ? " read-only" : "";
6528
6528
  const allowed = item.allowedOrigins ? ` allow=${item.allowedOrigins.join(",")}` : "";
6529
- return log(`${marker} ${item.id} ${page}${keys}${readOnly}${allowed}`);
6529
+ const handoff = item.handoff ? ` waiting on you: ${JSON.stringify(item.handoff.message)}` : "";
6530
+ return log(`${marker} ${item.id} ${page}${keys}${readOnly}${allowed}${handoff}`);
6530
6531
  });
6531
6532
  })).pipe(withDescription4("List browse sessions"));
6532
6533
  var sessionCurrent = make("current", {}, fn("Cli.sessionCurrent")(function* () {
package/dist/cli.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
 
9
9
  // src/main.ts
10
10
  import path from "node:path";
11
- var embeddedVersion = "0.0.17-dev.183";
11
+ var embeddedVersion = "0.0.17-dev.185";
12
12
  var setupCommands = new Set(["install", "uninstall", "extension", "pair", "set"]);
13
13
  var command = process.argv[2];
14
14
  var args = process.argv.slice(3);
@@ -18,26 +18,26 @@ var options = separator === -1 ? args : args.slice(0, separator);
18
18
  var askedForHelp = command === "--help" || command === "-h" || options.some((arg) => arg === "--help" || arg === "-h");
19
19
  var preCliHelp = askedForHelp && (command === "update" || command !== undefined && setupCommands.has(command));
20
20
  var oldRuntime = legacyRuntime();
21
- var takingOver = command === "serve" && !askedForHelp && legacyRuntimeActive(oldRuntime) && await import("./legacy-runtime-tne3461e.mjs").then((module) => module.prepareLegacyTakeover(oldRuntime)).catch(() => false);
21
+ var takingOver = command === "serve" && !askedForHelp && legacyRuntimeActive(oldRuntime) && await import("./legacy-runtime-rvfsgmzn.mjs").then((module) => module.prepareLegacyTakeover(oldRuntime)).catch(() => false);
22
22
  if (!takingOver)
23
23
  settleLegacyHome(process.env, oldRuntime);
24
24
  if (command !== "--version" && command !== "-v" && !askedForHelp && !takingOver && !process.env.OPENCODE_BROWSER_HOME && legacyRootsLeft()) {
25
25
  try {
26
- const { migrateLegacy } = await import("./migrate-dwpc3854.mjs");
26
+ const { migrateLegacy } = await import("./migrate-fygxtp2g.mjs");
27
27
  migrateLegacy();
28
28
  } catch {}
29
29
  }
30
30
  if (command === "--version" || command === "-v") {
31
- const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-144ecn73.mjs")).opencodeBrowserVersion;
31
+ const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-x1kkvpqn.mjs")).opencodeBrowserVersion;
32
32
  process.stdout.write(`${opencodeBrowserVersion}
33
33
  `);
34
- } else if (command === "mcp" && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1" && (await import("./supervisor-ratepwa5.mjs")).supervisesMcp()) {
35
- const { runBinaryMcp } = await import("./supervisor-ratepwa5.mjs");
34
+ } else if (command === "mcp" && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1" && (await import("./supervisor-wrrnbfhw.mjs")).supervisesMcp()) {
35
+ const { runBinaryMcp } = await import("./supervisor-wrrnbfhw.mjs");
36
36
  await runBinaryMcp(process.argv.slice(3));
37
37
  } else if (invokedAs === "opencode-browser-mcp" || command === "mcp" && process.argv.length === 3) {
38
38
  const { NodeRuntime } = await import("./index-gjq7chrk.mjs");
39
39
  const { defaultTeardown } = await import("./Runtime-xss8qan1.mjs");
40
- const { runMcpServer } = await import("./mcp-9sch561m.mjs");
40
+ const { runMcpServer } = await import("./mcp-2xkjfnqz.mjs");
41
41
  let stdinGone = false;
42
42
  const onStdinGone = () => {
43
43
  stdinGone = true;
@@ -59,13 +59,13 @@ if (command === "--version" || command === "-v") {
59
59
  })
60
60
  }));
61
61
  } else if (command === "self-update" || command === "runtime-switch") {
62
- const { runSelfUpdate, runRuntimeSwitch } = await import("./runtime-update-797qc0w9.mjs");
62
+ const { runSelfUpdate, runRuntimeSwitch } = await import("./runtime-update-ngg3m888.mjs");
63
63
  await (command === "self-update" ? runSelfUpdate : runRuntimeSwitch)(process.argv.slice(3));
64
64
  } else if (command === "update" && !askedForHelp) {
65
- const { runUpdateCommand } = await import("./update-7mb87vfx.mjs");
65
+ const { runUpdateCommand } = await import("./update-heze6vjn.mjs");
66
66
  await runUpdateCommand(process.argv.slice(3));
67
67
  } else if (command && setupCommands.has(command) && !askedForHelp) {
68
- const { runSetup } = await import("./setup-31sys1aq.mjs");
68
+ const { runSetup } = await import("./setup-t0pbhmzh.mjs");
69
69
  await runSetup(command, process.argv.slice(3));
70
70
  } else {
71
71
  if (preCliHelp || !command || command === "--help" || command === "-h") {
@@ -102,9 +102,9 @@ executable in ~/.local/bin (or $XDG_BIN_HOME).
102
102
  `);
103
103
  }
104
104
  if (command === "status" && !askedForHelp && !process.argv.includes("--json")) {
105
- const { printSetupStatus } = await import("./setup-31sys1aq.mjs");
105
+ const { printSetupStatus } = await import("./setup-t0pbhmzh.mjs");
106
106
  printSetupStatus();
107
107
  }
108
- const { runCli } = await import("./cli-n67t50qs.mjs");
108
+ const { runCli } = await import("./cli-fk82qmwb.mjs");
109
109
  runCli(preCliHelp ? ["--help"] : undefined);
110
110
  }
@@ -32,7 +32,7 @@ import {
32
32
  isRestrictedTarget2,
33
33
  isRestrictedUrl2,
34
34
  dataUrlDocument2
35
- } from "./main-jt4h0g8x.mjs";
35
+ } from "./main-ndmgt6k5.mjs";
36
36
  export {
37
37
  HttpRouteError2 as HttpRouteError,
38
38
  chromeExtensionOriginForPath2 as chromeExtensionOriginForPath,
@@ -1,10 +1,10 @@
1
- import"./main-jt4h0g8x.mjs";
1
+ import"./main-ndmgt6k5.mjs";
2
2
  import {
3
3
  installerBinaryPath,
4
4
  compiledBinary,
5
5
  channelOf,
6
6
  installedRuntime2
7
- } from "./main-k39ype39.mjs";
7
+ } from "./main-z32979g4.mjs";
8
8
  import {
9
9
  legacyRuntimeActive,
10
10
  insidePath,
@@ -12,12 +12,12 @@ import {
12
12
  } from "./main-pmfd055v.mjs";
13
13
  import {
14
14
  opencodeBrowserVersion2
15
- } from "./main-70nwvs6t.mjs";
15
+ } from "./main-ew8jna3e.mjs";
16
16
  import {
17
17
  relayPortPinned,
18
18
  resolveRelayPort,
19
19
  probeRelayPort
20
- } from "./main-aj4grz5c.mjs";
20
+ } from "./main-qwf4vk41.mjs";
21
21
 
22
22
  // src/setup/legacy-runtime.ts
23
23
  import fs from "node:fs";
@@ -50,7 +50,7 @@ async function prepareLegacyTakeover(legacy, options = {}) {
50
50
  return false;
51
51
  }
52
52
  const home = options.home ?? os.homedir();
53
- const { copyLegacyData } = await import("./migrate-dwpc3854.mjs");
53
+ const { copyLegacyData } = await import("./migrate-fygxtp2g.mjs");
54
54
  delete env.OPENCODE_BROWSER_HOME;
55
55
  copyLegacyData(home);
56
56
  pending = { legacy, install, home };
@@ -64,7 +64,7 @@ async function commitLegacyTakeover(now = Date.now()) {
64
64
  try {
65
65
  if (!adoptLegacyRuntime(legacy, install, now))
66
66
  return false;
67
- const { migrateLegacy } = await import("./migrate-dwpc3854.mjs");
67
+ const { migrateLegacy } = await import("./migrate-fygxtp2g.mjs");
68
68
  migrateLegacy(home, now);
69
69
  return true;
70
70
  } catch {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cliCommand
3
- } from "./main-k39ype39.mjs";
3
+ } from "./main-z32979g4.mjs";
4
4
  import {
5
5
  SessionDeleted,
6
6
  ExecuteLogEntry,
@@ -15,7 +15,7 @@ import {
15
15
  parseTargetSelection2,
16
16
  getObject2,
17
17
  getString2
18
- } from "./main-jt4h0g8x.mjs";
18
+ } from "./main-ndmgt6k5.mjs";
19
19
  import {
20
20
  isStream,
21
21
  provideContext
@@ -10,7 +10,7 @@ import {
10
10
  compareVersions,
11
11
  installedRuntime2,
12
12
  installedVersion
13
- } from "./main-k39ype39.mjs";
13
+ } from "./main-z32979g4.mjs";
14
14
  import {
15
15
  ensurePrivateDirectorySync,
16
16
  SessionContainer,
@@ -43,7 +43,7 @@ import {
43
43
  RelayErrorCode,
44
44
  ErrorEnvelope,
45
45
  defaultPort2
46
- } from "./main-jt4h0g8x.mjs";
46
+ } from "./main-ndmgt6k5.mjs";
47
47
  import {
48
48
  get,
49
49
  post,
@@ -54,10 +54,10 @@ import {
54
54
  } from "./main-jeta10c6.mjs";
55
55
  import {
56
56
  opencodeBrowserBuildId2
57
- } from "./main-70nwvs6t.mjs";
57
+ } from "./main-ew8jna3e.mjs";
58
58
  import {
59
59
  relayAuthorization
60
- } from "./main-h3sgxdjn.mjs";
60
+ } from "./main-xjskgtdr.mjs";
61
61
  import {
62
62
  endpointForPort,
63
63
  configuredRelayPort,
@@ -65,7 +65,7 @@ import {
65
65
  readRelayState,
66
66
  processAlive,
67
67
  resolveRelayPort
68
- } from "./main-aj4grz5c.mjs";
68
+ } from "./main-qwf4vk41.mjs";
69
69
  import {
70
70
  Pointer,
71
71
  passthrough,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  isNodeError,
3
3
  isValidSessionId2
4
- } from "./main-jt4h0g8x.mjs";
4
+ } from "./main-ndmgt6k5.mjs";
5
5
  import {
6
6
  stateRoot
7
- } from "./main-k39ype39.mjs";
7
+ } from "./main-z32979g4.mjs";
8
8
  import {
9
9
  decodeUnknownOption,
10
10
  optionalKey,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isNodeError,
3
3
  writeJsonFileAtomically
4
- } from "./main-jt4h0g8x.mjs";
4
+ } from "./main-ndmgt6k5.mjs";
5
5
  import {
6
6
  decodeUnknownEffect2,
7
7
  decodeUnknownSync,
@@ -50,7 +50,7 @@ import {
50
50
  import {
51
51
  dataRoot,
52
52
  cliCommand
53
- } from "./main-k39ype39.mjs";
53
+ } from "./main-z32979g4.mjs";
54
54
 
55
55
  // node_modules/effect/dist/Semaphore.js
56
56
  var makeUnsafe = (permits) => new SemaphoreImpl(permits);
@@ -0,0 +1,4 @@
1
+ // src/version.ts
2
+ var opencodeBrowserVersion2 = "0.0.17-dev.185";
3
+ var opencodeBrowserBuildId2 = "2026-11-14T01:44:36.613Z";
4
+ export { opencodeBrowserVersion2, opencodeBrowserBuildId2 };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unpackedExtensionId,
3
3
  parseJsonObject
4
- } from "./main-k39ype39.mjs";
4
+ } from "./main-z32979g4.mjs";
5
5
  import {
6
6
  decodeUnknownOption,
7
7
  optionalKey,
@@ -101,6 +101,11 @@ function writePrivateJsonFileSync(filePath, value, options = {}) {
101
101
  }
102
102
 
103
103
  // src/relay/schema.ts
104
+ var SessionHandoff = Struct({
105
+ message: String3,
106
+ tabId: Number2,
107
+ startedAt: String3
108
+ });
104
109
  var SessionSummary = Struct({
105
110
  id: String3,
106
111
  createdAt: String3,
@@ -111,7 +116,8 @@ var SessionSummary = Struct({
111
116
  readOnly: optionalKey(Boolean3),
112
117
  allowedOrigins: optionalKey(ArraySchema(String3)),
113
118
  keepVisible: optionalKey(Boolean3),
114
- browser: optionalKey(String3)
119
+ browser: optionalKey(String3),
120
+ handoff: optionalKey(SessionHandoff)
115
121
  });
116
122
  var ExecuteSessionSummary = SessionSummary.pipe(fieldsAssign({
117
123
  created: optionalKey(Boolean3)
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  writePrivateJsonFileSync,
3
3
  defaultPort2
4
- } from "./main-jt4h0g8x.mjs";
4
+ } from "./main-ndmgt6k5.mjs";
5
5
  import {
6
6
  stateRoot
7
- } from "./main-k39ype39.mjs";
7
+ } from "./main-z32979g4.mjs";
8
8
 
9
9
  // src/relay/port.ts
10
10
  import fs from "node:fs";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  writePrivateJsonFileSync
3
- } from "./main-jt4h0g8x.mjs";
3
+ } from "./main-ndmgt6k5.mjs";
4
4
  import {
5
5
  dataRoot,
6
6
  stateRoot
7
- } from "./main-k39ype39.mjs";
7
+ } from "./main-z32979g4.mjs";
8
8
 
9
9
  // src/relay/browser-pairing.ts
10
10
  import crypto from "node:crypto";
@@ -7,7 +7,7 @@ import {
7
7
  installedRuntime2,
8
8
  autoUpdateStatus,
9
9
  updateAvailable
10
- } from "./main-k39ype39.mjs";
10
+ } from "./main-z32979g4.mjs";
11
11
 
12
12
  // src/update.ts
13
13
  import { execFile, spawnSync } from "node:child_process";
@@ -313,7 +313,7 @@ function runUpdate(args, deps) {
313
313
  async function runUpdateCommand2(args) {
314
314
  const log = (line) => process.stdout.write(line + `
315
315
  `);
316
- const { runInstalledUpdate } = await import("./runtime-update-797qc0w9.mjs");
316
+ const { runInstalledUpdate } = await import("./runtime-update-ngg3m888.mjs");
317
317
  if (await runInstalledUpdate(args))
318
318
  return;
319
319
  if (compiledBinary()) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  opencodeBrowserVersion2
3
- } from "./main-70nwvs6t.mjs";
3
+ } from "./main-ew8jna3e.mjs";
4
4
  import {
5
5
  configRoot2,
6
6
  dataRoot,
@@ -22,16 +22,16 @@ import {
22
22
  npmGlobalRoot,
23
23
  installedVersion,
24
24
  runCommand
25
- } from "./main-k39ype39.mjs";
25
+ } from "./main-z32979g4.mjs";
26
26
  import {
27
27
  writeStdout
28
28
  } from "./main-tk4axre7.mjs";
29
29
  import {
30
30
  defaultPort2
31
- } from "./main-jt4h0g8x.mjs";
31
+ } from "./main-ndmgt6k5.mjs";
32
32
  import {
33
33
  formatPairingCode
34
- } from "./main-650pqeq5.mjs";
34
+ } from "./main-sbqypb33.mjs";
35
35
  import {
36
36
  __toESM,
37
37
  __commonJS,
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  writePrivateJsonFileSync
3
- } from "./main-jt4h0g8x.mjs";
3
+ } from "./main-ndmgt6k5.mjs";
4
4
  import {
5
5
  bundledPairingCodeTtlMs,
6
6
  mintPairingCode,
7
7
  writeExtensionPairing
8
- } from "./main-650pqeq5.mjs";
8
+ } from "./main-sbqypb33.mjs";
9
9
  import {
10
10
  configRoot2,
11
11
  cacheRoot,
12
12
  devExtensionUrl,
13
13
  devExtensionFolder
14
- } from "./main-k39ype39.mjs";
14
+ } from "./main-z32979g4.mjs";
15
15
 
16
16
  // src/setup/dev-extension.ts
17
17
  import { createHash } from "node:crypto";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  ensurePrivateDirectorySync
3
- } from "./main-jt4h0g8x.mjs";
3
+ } from "./main-ndmgt6k5.mjs";
4
4
  import {
5
5
  dataRoot
6
- } from "./main-k39ype39.mjs";
6
+ } from "./main-z32979g4.mjs";
7
7
 
8
8
  // src/relay/secrets.ts
9
9
  import crypto from "node:crypto";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./main-pmfd055v.mjs";
5
5
  import {
6
6
  opencodeBrowserVersion2
7
- } from "./main-70nwvs6t.mjs";
7
+ } from "./main-ew8jna3e.mjs";
8
8
 
9
9
  // src/paths.ts
10
10
  import fs from "node:fs";
@@ -114,7 +114,7 @@ function cliInstall() {
114
114
  return { kind: "binary", binary: installedBinary() ?? process.execPath, pathEnv: process.env.PATH };
115
115
  if (fromCheckout())
116
116
  return { kind: "checkout", bundle: path.join(packageRoot(), "dist", "cli.mjs") };
117
- return { kind: "npm", version: "0.0.17-dev.183", npx: /[/\\]_npx[/\\]/.test(process.argv[1] ?? "") };
117
+ return { kind: "npm", version: "0.0.17-dev.185", npx: /[/\\]_npx[/\\]/.test(process.argv[1] ?? "") };
118
118
  }
119
119
  function cliPrefix(install = cliInstall()) {
120
120
  if (install.kind === "binary") {
@@ -136,7 +136,7 @@ function storeConfig(env = process.env, baked = { id: "mfnicocicmmlkpjnaffgihfjh
136
136
  return id ? { id } : {};
137
137
  }
138
138
  var RELEASE_SERVICE = "https://anoma.ly/release";
139
- function devExtension(baked = { file: "browse-extension-0.0.17-dev.183.zip", sha256: "c01fd42b8192ed9a08171e2f8d9b3e2d2c8d6282ddd7429caa9dcdc2e7317e97", size: 187301 }) {
139
+ function devExtension(baked = { file: "browse-extension-0.0.17-dev.185.zip", sha256: "34356c57c65878977f8ccb8eff624ea2ae8e3b13974ddad7aa4c2e6c0268488a", size: 187301 }) {
140
140
  return baked && /^[0-9a-f]{64}$/.test(baked.sha256) && /^[\w.-]+\.zip$/.test(baked.file) ? baked : undefined;
141
141
  }
142
142
  var devExtensionUrl = (extension, env = process.env) => `${(env.OPENCODE_BROWSER_RELEASE_SERVICE || RELEASE_SERVICE).replace(/\/+$/, "")}/browse/files/${extension.sha256}/${extension.file}`;
@@ -46,11 +46,11 @@ import {
46
46
  import"./main-pmfd055v.mjs";
47
47
  import {
48
48
  opencodeBrowserVersion2
49
- } from "./main-70nwvs6t.mjs";
49
+ } from "./main-ew8jna3e.mjs";
50
50
  import {
51
51
  cliCommand,
52
52
  autoUpdateStatus
53
- } from "./main-k39ype39.mjs";
53
+ } from "./main-z32979g4.mjs";
54
54
  import {
55
55
  SessionContainer,
56
56
  SessionsContainer,
@@ -61,7 +61,7 @@ import {
61
61
  AuthRunResponse,
62
62
  TabsCleanupResponse,
63
63
  getObject2
64
- } from "./main-jt4h0g8x.mjs";
64
+ } from "./main-ndmgt6k5.mjs";
65
65
  import {
66
66
  option,
67
67
  String2,
@@ -71,11 +71,11 @@ import {
71
71
  relayBuildProblem,
72
72
  ensureRelay,
73
73
  ensureExtensionConnected
74
- } from "./main-zgawp964.mjs";
74
+ } from "./main-2wrvr3gc.mjs";
75
75
  import {
76
76
  updateJson2,
77
77
  createUpdateWatcher2
78
- } from "./main-1nnqhn1v.mjs";
78
+ } from "./main-t2jyedkv.mjs";
79
79
  import {
80
80
  settingSpecs,
81
81
  securityVariables,
@@ -156,12 +156,12 @@ import {
156
156
  toolResultForValue2,
157
157
  mcpErrorMessage2,
158
158
  toolResult
159
- } from "./main-b830e27p.mjs";
159
+ } from "./main-1b344j42.mjs";
160
160
  import {
161
161
  makeUnsafe,
162
162
  make3,
163
163
  listSecrets
164
- } from "./main-f1fdks8n.mjs";
164
+ } from "./main-6my7bmf1.mjs";
165
165
  import {
166
166
  Clock,
167
167
  type,
@@ -176,8 +176,8 @@ import {
176
176
  orElse,
177
177
  exhaustive
178
178
  } from "./main-akpa411k.mjs";
179
- import"./main-h3sgxdjn.mjs";
180
- import"./main-aj4grz5c.mjs";
179
+ import"./main-xjskgtdr.mjs";
180
+ import"./main-qwf4vk41.mjs";
181
181
  import {
182
182
  Class,
183
183
  taggedEnum,
@@ -7,14 +7,14 @@ import {
7
7
  editAgentConfig,
8
8
  OPENCODE_CONFIG_NAMES,
9
9
  configureMcp
10
- } from "./main-ans6rqv0.mjs";
10
+ } from "./main-x7takqns.mjs";
11
11
  import {
12
12
  legacyDataRoot,
13
13
  legacyRoots,
14
14
  legacyRuntime,
15
15
  LEGACY_HANDOVER_GRACE_MS
16
16
  } from "./main-pmfd055v.mjs";
17
- import"./main-70nwvs6t.mjs";
17
+ import"./main-ew8jna3e.mjs";
18
18
  import {
19
19
  configRoot2,
20
20
  dataRoot,
@@ -23,10 +23,10 @@ import {
23
23
  binRoot,
24
24
  binaryName,
25
25
  devExtensionFolder
26
- } from "./main-k39ype39.mjs";
26
+ } from "./main-z32979g4.mjs";
27
27
  import"./main-tk4axre7.mjs";
28
- import"./main-jt4h0g8x.mjs";
29
- import"./main-650pqeq5.mjs";
28
+ import"./main-ndmgt6k5.mjs";
29
+ import"./main-sbqypb33.mjs";
30
30
 
31
31
  // src/setup/migrate.ts
32
32
  import fs from "node:fs";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  opencodeBrowserVersion2,
6
6
  opencodeBrowserBuildId2
7
- } from "./main-70nwvs6t.mjs";
7
+ } from "./main-ew8jna3e.mjs";
8
8
  import {
9
9
  defaultRoots,
10
10
  configRoot2,
@@ -41,7 +41,7 @@ import {
41
41
  setStoredMode,
42
42
  autoUpdateStatus,
43
43
  createAutoUpdater
44
- } from "./main-k39ype39.mjs";
44
+ } from "./main-z32979g4.mjs";
45
45
  import {
46
46
  isNodeError,
47
47
  isUnsupportedDirectorySyncError,
@@ -95,7 +95,7 @@ import {
95
95
  isRestrictedTarget2,
96
96
  isRestrictedUrl2,
97
97
  dataUrlDocument2
98
- } from "./main-jt4h0g8x.mjs";
98
+ } from "./main-ndmgt6k5.mjs";
99
99
  import {
100
100
  context,
101
101
  pendingPairingCodeKeys,
@@ -113,7 +113,7 @@ import {
113
113
  pairingSessionKey,
114
114
  sessionProof,
115
115
  wrapToken
116
- } from "./main-650pqeq5.mjs";
116
+ } from "./main-sbqypb33.mjs";
117
117
  import {
118
118
  makeUnsafe,
119
119
  terminateChildProcess,
@@ -136,16 +136,16 @@ import {
136
136
  checkNavigationUrl,
137
137
  readSecret,
138
138
  secretText
139
- } from "./main-f1fdks8n.mjs";
139
+ } from "./main-6my7bmf1.mjs";
140
140
  import {
141
141
  defaultJournalBaseDir,
142
142
  makeJournalEntry,
143
143
  appendJournalEntry,
144
144
  startJournalRetention
145
- } from "./main-xnp01wxw.mjs";
145
+ } from "./main-3ewrhbqw.mjs";
146
146
  import {
147
147
  createUpdateWatcher2
148
- } from "./main-1nnqhn1v.mjs";
148
+ } from "./main-t2jyedkv.mjs";
149
149
  import {
150
150
  SettingsInputError,
151
151
  parseSettingChanges,
@@ -153,13 +153,13 @@ import {
153
153
  settingsToExtension,
154
154
  describeSettings,
155
155
  describeChanges
156
- } from "./main-b830e27p.mjs";
156
+ } from "./main-1b344j42.mjs";
157
157
  import {
158
158
  relayHostname,
159
159
  isLocalPeer,
160
160
  installedDevExtension,
161
161
  syncDevExtension
162
- } from "./main-254jbd9y.mjs";
162
+ } from "./main-xct4r41x.mjs";
163
163
  import {
164
164
  currentTimeMillis,
165
165
  value,
@@ -176,13 +176,13 @@ import {
176
176
  Boolean2,
177
177
  appendManagedRelayProcessLog,
178
178
  relayLog
179
- } from "./main-zgawp964.mjs";
179
+ } from "./main-2wrvr3gc.mjs";
180
180
  import {
181
181
  relayTokenQueryParam,
182
182
  relayToken,
183
183
  secretsEqual,
184
184
  ensurePrivateDirectory
185
- } from "./main-h3sgxdjn.mjs";
185
+ } from "./main-xjskgtdr.mjs";
186
186
  import {
187
187
  join,
188
188
  interrupt,
@@ -195,7 +195,7 @@ import {
195
195
  writeRelayState,
196
196
  removeRelayState,
197
197
  chooseRelayPort
198
- } from "./main-aj4grz5c.mjs";
198
+ } from "./main-qwf4vk41.mjs";
199
199
  import {
200
200
  taggedEnum,
201
201
  is2,
@@ -695,12 +695,15 @@ var ClientCdpSessionAlias = taggedEnum();
695
695
  class CdpClientPool {
696
696
  send;
697
697
  retired;
698
+ onInterceptionEmpty;
698
699
  states = new Map;
700
+ interceptionOwners = new Map;
699
701
  nextAliasId = 1;
700
702
  connectionGeneration = 0;
701
- constructor(send, retired) {
703
+ constructor(send, retired, onInterceptionEmpty = () => {}) {
702
704
  this.send = send;
703
705
  this.retired = retired;
706
+ this.onInterceptionEmpty = onInterceptionEmpty;
704
707
  }
705
708
  register(client, opencodeBrowserSessionId, kind = "raw") {
706
709
  if (this.states.has(client))
@@ -714,10 +717,47 @@ class CdpClientPool {
714
717
  this.connectionGeneration += 1;
715
718
  }
716
719
  unregister(client) {
717
- if (!this.states.delete(client) || this.states.size !== 0)
720
+ const registered = this.states.delete(client);
721
+ this.dropClientInterceptions(client);
722
+ if (!registered || this.states.size !== 0)
718
723
  return;
719
724
  return ++this.connectionGeneration;
720
725
  }
726
+ markInterceptionOwner(client, tabId, sessionId) {
727
+ if (!this.states.has(client))
728
+ return;
729
+ const sessions = this.interceptionOwners.get(tabId) ?? new Map;
730
+ const owners = sessions.get(sessionId) ?? new Set;
731
+ owners.add(client);
732
+ sessions.set(sessionId, owners);
733
+ this.interceptionOwners.set(tabId, sessions);
734
+ }
735
+ hasInterceptionOwner(tabId, sessionId) {
736
+ return (this.interceptionOwners.get(tabId)?.get(sessionId)?.size ?? 0) > 0;
737
+ }
738
+ hasInterceptionOwners(tabId) {
739
+ const sessions = this.interceptionOwners.get(tabId);
740
+ if (!sessions)
741
+ return false;
742
+ for (const owners of sessions.values())
743
+ if (owners.size > 0)
744
+ return true;
745
+ return false;
746
+ }
747
+ clearInterceptionOwner(client, tabId, sessionId, releaseTab = true) {
748
+ const sessions = this.interceptionOwners.get(tabId);
749
+ const owners = sessions?.get(sessionId);
750
+ if (!sessions || !owners?.delete(client))
751
+ return;
752
+ if (owners.size === 0)
753
+ sessions.delete(sessionId);
754
+ if (sessions.size > 0)
755
+ return;
756
+ if (releaseTab)
757
+ this.dropInterceptionTab(tabId);
758
+ else
759
+ this.interceptionOwners.delete(tabId);
760
+ }
721
761
  get size() {
722
762
  return this.states.size;
723
763
  }
@@ -771,12 +811,14 @@ class CdpClientPool {
771
811
  this.detachSession(client, state, announced.sessionId, options);
772
812
  }
773
813
  }
814
+ this.dropInterceptionTab(tabId);
774
815
  }
775
816
  detachTarget(target, options = {}) {
776
817
  for (const [client, state] of this.states) {
777
818
  this.removeTargetAliases(state, (alias) => alias.targetId === target.targetInfo.targetId);
778
819
  this.detachSession(client, state, target.sessionId, options);
779
820
  }
821
+ this.dropInterceptionSession(target.tabId, target.sessionId);
780
822
  }
781
823
  pruneInvisible(client, canSeeTab) {
782
824
  const state = this.requireState(client);
@@ -833,6 +875,8 @@ class CdpClientPool {
833
875
  if (!announced)
834
876
  return;
835
877
  state.announcements.delete(sessionId);
878
+ if (announced.parentSessionId === undefined)
879
+ this.dropClientTabInterception(client, announced.tabId);
836
880
  this.removeTargetAliases(state, (alias) => alias.targetId === announced.targetId);
837
881
  for (const child of state.announcements.values()) {
838
882
  if (child.parentSessionId === sessionId)
@@ -850,6 +894,34 @@ class CdpClientPool {
850
894
  params: { sessionId, targetId: announced.targetId }
851
895
  });
852
896
  }
897
+ dropClientTabInterception(client, tabId) {
898
+ const sessions = this.interceptionOwners.get(tabId);
899
+ if (!sessions)
900
+ return;
901
+ for (const [sessionId, owners] of sessions) {
902
+ owners.delete(client);
903
+ if (owners.size === 0)
904
+ sessions.delete(sessionId);
905
+ }
906
+ if (sessions.size === 0)
907
+ this.dropInterceptionTab(tabId);
908
+ }
909
+ dropClientInterceptions(client) {
910
+ for (const tabId of Array.from(this.interceptionOwners.keys()))
911
+ this.dropClientTabInterception(client, tabId);
912
+ }
913
+ dropInterceptionSession(tabId, sessionId) {
914
+ const sessions = this.interceptionOwners.get(tabId);
915
+ if (!sessions?.delete(sessionId))
916
+ return;
917
+ if (sessions.size === 0)
918
+ this.dropInterceptionTab(tabId);
919
+ }
920
+ dropInterceptionTab(tabId) {
921
+ if (!this.interceptionOwners.delete(tabId))
922
+ return;
923
+ this.onInterceptionEmpty(tabId);
924
+ }
853
925
  removeTargetAliases(state, matches) {
854
926
  for (const [aliasId, alias] of state.aliases) {
855
927
  if (ClientCdpSessionAlias.$is("Target")(alias) && matches(alias))
@@ -1583,6 +1655,8 @@ function errorCauses(cause) {
1583
1655
 
1584
1656
  // src/cdp/runtime.ts
1585
1657
  var maxCachedContexts = 512;
1658
+ var interceptionReleaseTimeout = "3 seconds";
1659
+ var interceptionReleaseConcurrency = 4;
1586
1660
  var routeSessionId = (route) => route.chromeSessionId ?? route.rootSessionId;
1587
1661
  var disableKey = (tabId, chromeSessionId) => `${tabId}:${chromeSessionId ?? "root"}`;
1588
1662
  var contextAux = (event) => getObject2(getObject2(event.params?.context)?.auxData);
@@ -1757,20 +1831,37 @@ class CdpRuntime {
1757
1831
  return first.result;
1758
1832
  });
1759
1833
  disableIdle = fn("CdpRuntime.disableIdle")(function* (stillIdle) {
1760
- const { registry } = this.options;
1761
- const routes = registry.listRootTargets().map((target) => ({ tabId: target.tabId, rootSessionId: target.sessionId }));
1762
- for (const target of registry.childTargets.values()) {
1763
- const root = registry.tabTargets.get(target.tabId);
1764
- if (root)
1765
- routes.push({ tabId: target.tabId, rootSessionId: root.sessionId, chromeSessionId: target.sessionId });
1766
- }
1767
- const targets = routes.map((route) => ({ route, current: this.capture(route) }));
1834
+ const targets = this.routes().map((route) => ({ route, current: this.capture(route) }));
1768
1835
  for (const { route, current } of targets) {
1769
1836
  if (!stillIdle())
1770
1837
  break;
1771
1838
  yield* this.reset(route, "Runtime.disable", {}, () => stillIdle() && current());
1772
1839
  }
1773
1840
  });
1841
+ releaseInterception = fn("CdpRuntime.releaseInterception")(function* (tabIds, shouldRelease) {
1842
+ yield* forEach(Array.from(new Set(tabIds)), (tabId) => suspend2(() => {
1843
+ if (!shouldRelease(tabId))
1844
+ return void_3;
1845
+ const targets = this.routes(new Set([tabId])).map((route) => ({ route, current: this.capture(route) }));
1846
+ return forEach(targets, ({ route, current }) => {
1847
+ if (!shouldRelease(tabId))
1848
+ return void_3;
1849
+ return this.reset(route, "Fetch.disable", {}, () => shouldRelease(tabId) && current()).pipe(timeoutOption(interceptionReleaseTimeout));
1850
+ }, { concurrency: "unbounded", discard: true });
1851
+ }), { concurrency: interceptionReleaseConcurrency, discard: true });
1852
+ });
1853
+ routes(tabIds) {
1854
+ const { registry } = this.options;
1855
+ const routes = registry.listRootTargets().filter((target) => tabIds === undefined || tabIds.has(target.tabId)).map((target) => ({ tabId: target.tabId, rootSessionId: target.sessionId }));
1856
+ for (const target of registry.childTargets.values()) {
1857
+ if (tabIds !== undefined && !tabIds.has(target.tabId))
1858
+ continue;
1859
+ const root = registry.tabTargets.get(target.tabId);
1860
+ if (root)
1861
+ routes.push({ tabId: target.tabId, rootSessionId: root.sessionId, chromeSessionId: target.sessionId });
1862
+ }
1863
+ return routes;
1864
+ }
1774
1865
  replayCached(client, route, frameId) {
1775
1866
  const cache = this.contexts.get(routeSessionId(route));
1776
1867
  const contexts = cache?.current() ? cache.contexts : undefined;
@@ -1812,10 +1903,11 @@ class CdpRuntime {
1812
1903
  return suspend2(() => {
1813
1904
  if (!current())
1814
1905
  return void_3;
1815
- this.trace(route, `runtime-reset command=${method}`);
1906
+ const trace = method === "Fetch.disable" ? "fetch-release" : "runtime-reset";
1907
+ this.trace(route, `${trace} command=${method}`);
1816
1908
  return this.options.send({ tabId: route.tabId, method, params, ...route.chromeSessionId === undefined ? {} : { sessionId: route.chromeSessionId } }).pipe(match4({
1817
- onFailure: (error) => this.trace(route, `runtime-reset command=${method} outcome=failed failure=${runtimeFailureKind(error)}`),
1818
- onSuccess: () => this.trace(route, `runtime-reset command=${method} outcome=ok`)
1909
+ onFailure: (error) => this.trace(route, `${trace} command=${method} outcome=failed failure=${runtimeFailureKind(error)}`),
1910
+ onSuccess: () => this.trace(route, `${trace} command=${method} outcome=ok`)
1819
1911
  }));
1820
1912
  });
1821
1913
  }
@@ -13011,6 +13103,7 @@ class HandoffRegistry {
13011
13103
  existing.resolve("timeout");
13012
13104
  }
13013
13105
  const id = this.createId();
13106
+ const startedAt = new Date().toISOString();
13014
13107
  let held = false;
13015
13108
  let humanCompleted = false;
13016
13109
  let finish;
@@ -13031,6 +13124,7 @@ class HandoffRegistry {
13031
13124
  targetId: options.targetId,
13032
13125
  targetSessionId: options.targetSessionId,
13033
13126
  message: options.message,
13127
+ startedAt,
13034
13128
  resolve: (outcome) => {
13035
13129
  if (outcome === "resolved" && held) {
13036
13130
  humanCompleted = true;
@@ -13127,7 +13221,8 @@ class HandoffRegistry {
13127
13221
  tabId: pending.tabId,
13128
13222
  targetId: pending.targetId,
13129
13223
  targetSessionId: pending.targetSessionId,
13130
- message: pending.message
13224
+ message: pending.message,
13225
+ startedAt: pending.startedAt
13131
13226
  };
13132
13227
  }
13133
13228
  }
@@ -13404,8 +13499,9 @@ function stoppedExecuteResult(message, diagnostic) {
13404
13499
  diagnostic
13405
13500
  };
13406
13501
  }
13407
- function sessionSummary(session) {
13502
+ function sessionSummary(session, hooks) {
13408
13503
  const status = session.sandbox.getStatus();
13504
+ const handoff = hooks?.pendingHandoff?.(session.id);
13409
13505
  return {
13410
13506
  id: session.id,
13411
13507
  createdAt: session.createdAt,
@@ -13416,12 +13512,13 @@ function sessionSummary(session) {
13416
13512
  ...session.readOnly ? { readOnly: true } : {},
13417
13513
  ...session.allowedOrigins ? { allowedOrigins: [...session.allowedOrigins] } : {},
13418
13514
  ...session.keepVisible ? { keepVisible: true } : {},
13419
- ...session.browser ? { browser: session.browser.id } : {}
13515
+ ...session.browser ? { browser: session.browser.id } : {},
13516
+ ...handoff ? { handoff } : {}
13420
13517
  };
13421
13518
  }
13422
- function createdSummary(session, created) {
13519
+ function createdSummary(session, created, hooks) {
13423
13520
  return {
13424
- ...sessionSummary(session),
13521
+ ...sessionSummary(session, hooks),
13425
13522
  ...created ? { created: true } : {}
13426
13523
  };
13427
13524
  }
@@ -13668,7 +13765,7 @@ function adoptTargetForSession(context, options) {
13668
13765
  catch: (cause) => cause instanceof Error ? cause : new Error("Commit target ownership", { cause })
13669
13766
  });
13670
13767
  const releasedTargetIds = previousTargetId && previousTargetId !== options.targetId ? [previousTargetId] : [];
13671
- const value = { adoptedUrl: options.targetUrl, releasedTargetIds, session: createdSummary(session, resolved.created) };
13768
+ const value = { adoptedUrl: options.targetUrl, releasedTargetIds, session: createdSummary(session, resolved.created, context.hooks) };
13672
13769
  yield* succeed4(result2, value);
13673
13770
  return value;
13674
13771
  });
@@ -13766,7 +13863,7 @@ function executeInSession(ctx, options) {
13766
13863
  let stopped;
13767
13864
  const stoppedExecution = (stop) => ({
13768
13865
  result: stoppedExecuteResult(stop.message, stop.diagnostic),
13769
- session: createdSummary(session, resolved.created)
13866
+ session: createdSummary(session, resolved.created, ctx.hooks)
13770
13867
  });
13771
13868
  const chosenTimeoutMs = options.timeoutMs ?? ctx.hooks.executeTimeoutMs;
13772
13869
  const effectiveTimeoutMs = chosenTimeoutMs ?? defaultExecuteTimeoutMs;
@@ -13859,7 +13956,7 @@ function executeInSession(ctx, options) {
13859
13956
  result: resultWithHint
13860
13957
  });
13861
13958
  yield* ctx.admission.commitPersistence();
13862
- return { result: resultWithHint, session: createdSummary(session, resolved.created) };
13959
+ return { result: resultWithHint, session: createdSummary(session, resolved.created, ctx.hooks) };
13863
13960
  });
13864
13961
  const worker = session.executeSemaphore.withPermit(operation.pipe(matchEffect2({
13865
13962
  onFailure: (error) => sync2(() => deadline?.cancel()).pipe(andThen2(resolved.created ? ctx.cleanupCreatedSession(session) : void_3), andThen2(fail5(response, error))),
@@ -13937,7 +14034,7 @@ class OpenCodeBrowserSessions {
13937
14034
  };
13938
14035
  }
13939
14036
  listSummaries() {
13940
- return Array.from(this.sessions.values()).map((session) => sessionSummary(session));
14037
+ return Array.from(this.sessions.values()).map((session) => sessionSummary(session, this.hooks));
13941
14038
  }
13942
14039
  restore(entries) {
13943
14040
  this.admission.assertAdmission();
@@ -14029,10 +14126,10 @@ class OpenCodeBrowserSessions {
14029
14126
  if (options?.readOnly === true && !existing.readOnly) {
14030
14127
  return yield* sessionError("invalid-request", `Session ${id} already exists with write access and cannot be ensured as read-only`, id);
14031
14128
  }
14032
- return sessionSummary(existing);
14129
+ return sessionSummary(existing, manager.hooks);
14033
14130
  }
14034
14131
  const session = yield* manager.createPersistedSession(id, options);
14035
- return sessionSummary(session);
14132
+ return sessionSummary(session, manager.hooks);
14036
14133
  }).pipe(uninterruptible));
14037
14134
  }
14038
14135
  createPersistedSession = fnUntraced(function* (id, options) {
@@ -14075,7 +14172,7 @@ class OpenCodeBrowserSessions {
14075
14172
  delete session.allowedOrigins;
14076
14173
  session.updatedAt = new Date().toISOString();
14077
14174
  manager.admission.schedulePersistence();
14078
- return sessionSummary(session);
14175
+ return sessionSummary(session, manager.hooks);
14079
14176
  });
14080
14177
  }
14081
14178
  keepsTabsVisible(id) {
@@ -14247,7 +14344,7 @@ class OpenCodeBrowserSessions {
14247
14344
  console.error("Session reset hook failed", error);
14248
14345
  }
14249
14346
  });
14250
- return sessionSummary(session);
14347
+ return sessionSummary(session, manager.hooks);
14251
14348
  })));
14252
14349
  return { session, ...stopped ? { stopped } : {} };
14253
14350
  }));
@@ -14346,7 +14443,7 @@ class OpenCodeBrowserSessions {
14346
14443
  }
14347
14444
  summary(id) {
14348
14445
  const session = this.sessions.get(id);
14349
- return session ? sessionSummary(session) : undefined;
14446
+ return session ? sessionSummary(session, this.hooks) : undefined;
14350
14447
  }
14351
14448
  reapIdleSessions(options) {
14352
14449
  const manager = this;
@@ -17041,7 +17138,19 @@ function createCdpDispatcher(options) {
17041
17138
  catch: (error) => error instanceof Error ? error : new Error(String(error))
17042
17139
  });
17043
17140
  const { tabId } = route;
17141
+ if (message.method === "Fetch.enable") {
17142
+ const rootSessionId = registry.tabTargets.get(tabId)?.sessionId;
17143
+ if (!rootSessionId || !cdpClients.hasSession(socket, rootSessionId)) {
17144
+ return yield* fail6(new Error("Fetch.enable requires this client to be attached to the tab's root target; attach the tab before enabling request interception."));
17145
+ }
17146
+ cdpClients.markInterceptionOwner(socket, tabId, route.chromeSessionId);
17147
+ }
17044
17148
  tabActivity.touch(tabId);
17149
+ if (message.method === "Fetch.disable") {
17150
+ cdpClients.clearInterceptionOwner(socket, tabId, route.chromeSessionId, false);
17151
+ if (cdpClients.hasInterceptionOwner(tabId, route.chromeSessionId))
17152
+ return {};
17153
+ }
17045
17154
  const executingSession = cdpClients.sessionId(socket);
17046
17155
  if (executingSession && sessions.isExecuting(executingSession)) {
17047
17156
  yield* tabActivity.focus(tabId, executingSession);
@@ -19521,7 +19630,12 @@ var makeRelay = fnUntraced(function* (options = {}) {
19521
19630
  sendEvent: sendCdpEvent2,
19522
19631
  ...contextDebugLog ? { trace: contextDebugLog } : {}
19523
19632
  });
19524
- const cdpClients = new CdpClientPool((client, event) => cdpRuntime.deliver(client, event), (client, sessionId) => cdpRuntime.detach(client, sessionId));
19633
+ let releaseIdleInterception = () => {
19634
+ return;
19635
+ };
19636
+ const pendingInterceptionReleases = new Set;
19637
+ let interceptionReleaseScheduled = false;
19638
+ const cdpClients = new CdpClientPool((client, event) => cdpRuntime.deliver(client, event), (client, sessionId) => cdpRuntime.detach(client, sessionId), (tabId) => releaseIdleInterception(tabId));
19525
19639
  const mainFrameIdsByTab = new Map;
19526
19640
  const blankNavigationWaiters = new Map;
19527
19641
  const suppressedChildSessions = new Map;
@@ -19711,6 +19825,10 @@ var makeRelay = fnUntraced(function* (options = {}) {
19711
19825
  ...Array.from(ownersAcrossReconnect).filter(([targetId, known]) => known.owner === "relay" && known.sessionId === sessionId && !registry.targetsByTargetId.has(targetId)).map(([targetId]) => targetId)
19712
19826
  ],
19713
19827
  onCancelSessionHandoff: (sessionId) => handoffs.cancelForSession(sessionId) !== undefined,
19828
+ pendingHandoff: (sessionId) => {
19829
+ const pending = handoffs.pendingForSession(sessionId);
19830
+ return pending ? { message: pending.message, tabId: pending.tabId, startedAt: pending.startedAt } : undefined;
19831
+ },
19714
19832
  onSessionsChanged: async (entries) => {
19715
19833
  if (catalogWritesEnabled)
19716
19834
  await sessionCatalog?.save(entries);
@@ -19816,6 +19934,28 @@ var makeRelay = fnUntraced(function* (options = {}) {
19816
19934
  audit
19817
19935
  });
19818
19936
  const { shutdown: shutdownControl, updates, sendUpdateNotice, releaseRelayTarget, browserIdle, startTimers, stopTimers } = housekeeping;
19937
+ releaseIdleInterception = (tabId) => {
19938
+ if (shutdownControl.stopping)
19939
+ return;
19940
+ pendingInterceptionReleases.add(tabId);
19941
+ if (interceptionReleaseScheduled)
19942
+ return;
19943
+ interceptionReleaseScheduled = true;
19944
+ queueMicrotask(() => {
19945
+ interceptionReleaseScheduled = false;
19946
+ if (shutdownControl.stopping) {
19947
+ pendingInterceptionReleases.clear();
19948
+ return;
19949
+ }
19950
+ const tabs = Array.from(pendingInterceptionReleases).filter((id) => !cdpClients.hasInterceptionOwners(id));
19951
+ pendingInterceptionReleases.clear();
19952
+ if (tabs.length === 0)
19953
+ return;
19954
+ runPromise(shutdownControl.trackTransport(cdpRuntime.releaseInterception(tabs, (id) => !cdpClients.hasInterceptionOwners(id)).pipe(timeoutOption("3 seconds"), ignore))).catch((error) => {
19955
+ console.error("Failed to release request interception", error);
19956
+ });
19957
+ });
19958
+ };
19819
19959
  const toggleTab = fnUntraced(function* (tabId) {
19820
19960
  if (registry.tabTargets.has(tabId))
19821
19961
  return yield* detachTab(tabId);
@@ -20076,6 +20216,7 @@ var makeRelay = fnUntraced(function* (options = {}) {
20076
20216
  waitedMs: defaultShutdownTimeoutMs
20077
20217
  })
20078
20218
  });
20219
+ yield* cdpRuntime.releaseInterception(registry.listRootTargets().map((target) => target.tabId), () => true).pipe(timeoutOption("5 seconds"), ignore);
20079
20220
  yield* rootLifecycle.close();
20080
20221
  if (managed) {
20081
20222
  yield* audit(RelayLifecycleEvent.cases.Closed.make({ instanceId: browserId })).pipe(catch_(() => sync2(() => console.error("Failed to record relay shutdown lifecycle event"))));
@@ -1,6 +1,6 @@
1
1
  import"./main-9frwnsnf.mjs";
2
2
  import"./main-pmfd055v.mjs";
3
- import"./main-70nwvs6t.mjs";
3
+ import"./main-ew8jna3e.mjs";
4
4
  import {
5
5
  cliCommand,
6
6
  installCommand,
@@ -18,17 +18,17 @@ import {
18
18
  registryUrl,
19
19
  fetchPublished,
20
20
  runInstaller
21
- } from "./main-k39ype39.mjs";
22
- import"./main-jt4h0g8x.mjs";
21
+ } from "./main-z32979g4.mjs";
22
+ import"./main-ndmgt6k5.mjs";
23
23
  import"./main-jeta10c6.mjs";
24
24
  import {
25
25
  Service,
26
26
  layerFetch,
27
27
  restartRelay,
28
28
  startManagedRelay
29
- } from "./main-zgawp964.mjs";
30
- import"./main-h3sgxdjn.mjs";
31
- import"./main-aj4grz5c.mjs";
29
+ } from "./main-2wrvr3gc.mjs";
30
+ import"./main-xjskgtdr.mjs";
31
+ import"./main-qwf4vk41.mjs";
32
32
  import {
33
33
  succeed6,
34
34
  gen,
@@ -63,11 +63,11 @@ import {
63
63
  installRuntime,
64
64
  installedRuntime,
65
65
  manualMcpEntry
66
- } from "./main-ans6rqv0.mjs";
66
+ } from "./main-x7takqns.mjs";
67
67
  import"./main-pmfd055v.mjs";
68
68
  import {
69
69
  opencodeBrowserBuildId2
70
- } from "./main-70nwvs6t.mjs";
70
+ } from "./main-ew8jna3e.mjs";
71
71
  import {
72
72
  installedBinaryPath,
73
73
  installerBinaryPath,
@@ -87,10 +87,10 @@ import {
87
87
  autoUpdateStatus,
88
88
  describeAutoUpdate,
89
89
  runCommand
90
- } from "./main-k39ype39.mjs";
90
+ } from "./main-z32979g4.mjs";
91
91
  import {
92
92
  defaultPort2
93
- } from "./main-jt4h0g8x.mjs";
93
+ } from "./main-ndmgt6k5.mjs";
94
94
  import {
95
95
  pairingCodeTtlMs,
96
96
  bundledPairingCodeTtlMs,
@@ -103,20 +103,20 @@ import {
103
103
  revokeBrowserToken,
104
104
  legacyPairingCode,
105
105
  removeLegacyPairingCode
106
- } from "./main-650pqeq5.mjs";
106
+ } from "./main-sbqypb33.mjs";
107
107
  import"./main-tk4axre7.mjs";
108
108
  import {
109
109
  defaultSiteSecretsDir
110
- } from "./main-f1fdks8n.mjs";
110
+ } from "./main-6my7bmf1.mjs";
111
111
  import {
112
112
  parseHostname,
113
113
  readRelayConfig,
114
114
  writeRelayConfig,
115
115
  syncDevExtension
116
- } from "./main-254jbd9y.mjs";
116
+ } from "./main-xct4r41x.mjs";
117
117
  import {
118
118
  relayAuthorization
119
- } from "./main-h3sgxdjn.mjs";
119
+ } from "./main-xjskgtdr.mjs";
120
120
  import {
121
121
  endpointForPort,
122
122
  configuredRelayPort,
@@ -125,7 +125,7 @@ import {
125
125
  verifiedRelay,
126
126
  verifiedRelayEndpoint,
127
127
  liveRelayPort
128
- } from "./main-aj4grz5c.mjs";
128
+ } from "./main-qwf4vk41.mjs";
129
129
 
130
130
  // src/setup.ts
131
131
  import { mkdirSync as mkdirSync2, rmSync as rmSync2, writeFileSync } from "node:fs";
@@ -1,15 +1,15 @@
1
- import"./main-jt4h0g8x.mjs";
1
+ import"./main-ndmgt6k5.mjs";
2
2
  import {
3
3
  entrySpawnCommand,
4
4
  installedRuntime2,
5
5
  installedVersion
6
- } from "./main-k39ype39.mjs";
6
+ } from "./main-z32979g4.mjs";
7
7
  import"./main-pmfd055v.mjs";
8
- import"./main-70nwvs6t.mjs";
8
+ import"./main-ew8jna3e.mjs";
9
9
  import {
10
10
  endpointForPort,
11
11
  resolveRelayPort
12
- } from "./main-aj4grz5c.mjs";
12
+ } from "./main-qwf4vk41.mjs";
13
13
 
14
14
  // src/mcp/supervisor.ts
15
15
  import { spawn } from "node:child_process";
@@ -40,7 +40,7 @@ async function runBinaryMcp(args) {
40
40
  const runtime = installedRuntime2();
41
41
  if (!runtime || runtime.kind === "npx") {
42
42
  process.env[directEnvironmentVariable] = "1";
43
- const { runCli } = await import("./cli-n67t50qs.mjs");
43
+ const { runCli } = await import("./cli-fk82qmwb.mjs");
44
44
  return runCli();
45
45
  }
46
46
  const REPLAY = `opencode-browser-shim-initialize-${randomUUID()}`;
@@ -4,10 +4,10 @@ import {
4
4
  updateNotice2,
5
5
  createUpdateWatcher2,
6
6
  runUpdateCommand2
7
- } from "./main-1nnqhn1v.mjs";
8
- import"./main-k39ype39.mjs";
7
+ } from "./main-t2jyedkv.mjs";
8
+ import"./main-z32979g4.mjs";
9
9
  import"./main-pmfd055v.mjs";
10
- import"./main-70nwvs6t.mjs";
10
+ import"./main-ew8jna3e.mjs";
11
11
  export {
12
12
  createUpdateWatcher2 as createUpdateWatcher,
13
13
  formatUpdateNotice2 as formatUpdateNotice,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  opencodeBrowserVersion2,
3
3
  opencodeBrowserBuildId2
4
- } from "./main-70nwvs6t.mjs";
4
+ } from "./main-ew8jna3e.mjs";
5
5
  export {
6
6
  opencodeBrowserBuildId2 as opencodeBrowserBuildId,
7
7
  opencodeBrowserVersion2 as opencodeBrowserVersion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencode/browse",
3
- "version": "0.0.17-dev.183",
3
+ "version": "0.0.17-dev.185",
4
4
  "description": "browse: connect the extension to opencode, and drive your browser from any agent (CLI, MCP, Playwright).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,4 +0,0 @@
1
- // src/version.ts
2
- var opencodeBrowserVersion2 = "0.0.17-dev.183";
3
- var opencodeBrowserBuildId2 = "2026-11-13T14:17:29.770Z";
4
- export { opencodeBrowserVersion2, opencodeBrowserBuildId2 };