@opencode/browse 0.0.15-dev.110 → 0.0.15-dev.112

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 (32) hide show
  1. package/dist/{Undici-88kyhfpm.mjs → Undici-mxpvn7gy.mjs} +1 -1
  2. package/dist/{cli-ftng02ff.mjs → cli-k4ep9bqh.mjs} +134 -130
  3. package/dist/cli.mjs +13 -13
  4. package/dist/{helpers-xcy6tqv8.mjs → helpers-z9sm10dt.mjs} +2 -2
  5. package/dist/{index-yzz55kxm.mjs → index-6gkr235e.mjs} +1 -1
  6. package/dist/{main-x8sv1x9z.mjs → main-4gta7aqg.mjs} +59 -57
  7. package/dist/{main-2vk5mg8n.mjs → main-7925awaa.mjs} +4 -4
  8. package/dist/main-9t2s5ptx.mjs +5405 -0
  9. package/dist/{main-vgzr4689.mjs → main-azpzpy0x.mjs} +1 -1
  10. package/dist/main-b5v6hjvs.mjs +1255 -0
  11. package/dist/{main-w79fw3mt.mjs → main-bw7m61nw.mjs} +3 -3
  12. package/dist/main-dbyqkg36.mjs +1694 -0
  13. package/dist/{main-8z9d979q.mjs → main-er120rjm.mjs} +2 -2
  14. package/dist/{main-yf9xhpn4.mjs → main-ken6azcs.mjs} +2 -2
  15. package/dist/{main-pnhrdk7y.mjs → main-meec74m9.mjs} +2 -2
  16. package/dist/main-pgnhq60v.mjs +4 -0
  17. package/dist/{main-7p43gjgk.mjs → main-r5pwe9d8.mjs} +4 -4
  18. package/dist/{main-dghqndja.mjs → main-trj5w92c.mjs} +2 -2
  19. package/dist/{main-fpc5be6h.mjs → main-wsgfvvd6.mjs} +8 -8
  20. package/dist/{main-tyydn3xk.mjs → main-ydew87vm.mjs} +2 -2
  21. package/dist/{main-csnx585b.mjs → main-yf5j8g79.mjs} +2800 -8017
  22. package/dist/{mcp-mhms2jng.mjs → mcp-j7sd8vrv.mjs} +415 -411
  23. package/dist/{migrate-w1ted1w6.mjs → migrate-bqb73tpb.mjs} +5 -5
  24. package/dist/{relay-xhz6s81w.mjs → relay-thq3nwb4.mjs} +127 -123
  25. package/dist/{runtime-update-fm0me22e.mjs → runtime-update-6mh1x6rt.mjs} +7 -6
  26. package/dist/{setup-g3fpqzqe.mjs → setup-072zcfcw.mjs} +19 -10
  27. package/dist/{supervisor-40ckz6kf.mjs → supervisor-2vwykyf5.mjs} +3 -3
  28. package/dist/{update-83zpyvjn.mjs → update-h5swvj6m.mjs} +3 -3
  29. package/dist/{version-njstahmg.mjs → version-2qbk7aw2.mjs} +1 -1
  30. package/package.json +1 -1
  31. package/dist/main-rty99vp8.mjs +0 -4
  32. package/dist/main-tams6t1b.mjs +0 -2924
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  opencodeBrowserVersion2,
3
3
  opencodeBrowserBuildId2
4
- } from "./main-rty99vp8.mjs";
4
+ } from "./main-pgnhq60v.mjs";
5
5
  import {
6
6
  defaultRoots,
7
7
  configRoot2,
@@ -25,7 +25,7 @@ import {
25
25
  setStoredMode,
26
26
  autoUpdateStatus,
27
27
  createAutoUpdater
28
- } from "./main-fpc5be6h.mjs";
28
+ } from "./main-wsgfvvd6.mjs";
29
29
  import {
30
30
  extensionProtocolVersion,
31
31
  minExtensionProtocolVersion,
@@ -46,7 +46,7 @@ import {
46
46
  writeJsonFileAtomically,
47
47
  ensurePrivateDirectorySync,
48
48
  writePrivateJsonFileSync
49
- } from "./main-vgzr4689.mjs";
49
+ } from "./main-azpzpy0x.mjs";
50
50
  import {
51
51
  withDefault,
52
52
  option,
@@ -101,7 +101,7 @@ import {
101
101
  isRestrictedTarget2,
102
102
  isRestrictedUrl2,
103
103
  dataUrlDocument2
104
- } from "./main-x8sv1x9z.mjs";
104
+ } from "./main-4gta7aqg.mjs";
105
105
  import {
106
106
  context,
107
107
  pendingPairingCodeKeys,
@@ -119,15 +119,9 @@ import {
119
119
  pairingSessionKey,
120
120
  sessionProof,
121
121
  wrapToken
122
- } from "./main-pnhrdk7y.mjs";
122
+ } from "./main-meec74m9.mjs";
123
123
  import {
124
124
  makeUnsafe,
125
- SettingsInputError,
126
- parseSettingChanges,
127
- settingsFromExtension,
128
- settingsToExtension,
129
- describeSettings,
130
- describeChanges,
131
125
  terminateChildProcess,
132
126
  SecretCollector,
133
127
  looksLikeTokenSegment,
@@ -147,22 +141,30 @@ import {
147
141
  checkNavigationUrl,
148
142
  readSecret,
149
143
  secretText
150
- } from "./main-tams6t1b.mjs";
144
+ } from "./main-b5v6hjvs.mjs";
151
145
  import {
152
146
  defaultJournalBaseDir,
153
147
  makeJournalEntry,
154
148
  appendJournalEntry,
155
149
  startJournalRetention
156
- } from "./main-7p43gjgk.mjs";
150
+ } from "./main-r5pwe9d8.mjs";
157
151
  import {
158
152
  createUpdateWatcher2
159
- } from "./main-dghqndja.mjs";
153
+ } from "./main-trj5w92c.mjs";
154
+ import {
155
+ SettingsInputError,
156
+ parseSettingChanges,
157
+ settingsFromExtension,
158
+ settingsToExtension,
159
+ describeSettings,
160
+ describeChanges
161
+ } from "./main-dbyqkg36.mjs";
160
162
  import {
161
163
  relayHostname,
162
164
  isLocalPeer,
163
165
  installedDevExtension,
164
166
  syncDevExtension
165
- } from "./main-w79fw3mt.mjs";
167
+ } from "./main-bw7m61nw.mjs";
166
168
  import {
167
169
  legacyRoots
168
170
  } from "./main-ckssvk4c.mjs";
@@ -172,7 +174,18 @@ import {
172
174
  when,
173
175
  orElse,
174
176
  exhaustive
175
- } from "./main-8z9d979q.mjs";
177
+ } from "./main-er120rjm.mjs";
178
+ import {
179
+ join,
180
+ interrupt,
181
+ makeUnsafe2
182
+ } from "./main-9t2s5ptx.mjs";
183
+ import {
184
+ relayTokenQueryParam,
185
+ relayToken,
186
+ secretsEqual,
187
+ ensurePrivateDirectory
188
+ } from "./main-ydew87vm.mjs";
176
189
  import {
177
190
  isNone,
178
191
  isSome,
@@ -185,14 +198,14 @@ import {
185
198
  isSuccess2,
186
199
  isFailure2,
187
200
  asVoid,
188
- makeUnsafe3,
189
- make5,
201
+ makeUnsafe4,
202
+ make10,
190
203
  _await,
191
- done,
192
- fail4,
204
+ done2,
205
+ fail5,
193
206
  succeed4,
194
207
  doneUnsafe,
195
- make6,
208
+ make11,
196
209
  close,
197
210
  modifyDelay,
198
211
  spaced,
@@ -208,10 +221,10 @@ import {
208
221
  callback2,
209
222
  never,
210
223
  gen,
211
- fail5,
212
- try_,
224
+ fail6,
225
+ try_2,
213
226
  flatMap3,
214
- andThen,
227
+ andThen2,
215
228
  tap,
216
229
  result,
217
230
  exit,
@@ -231,7 +244,7 @@ import {
231
244
  sleep,
232
245
  raceFirst,
233
246
  match3,
234
- matchEffect,
247
+ matchEffect2,
235
248
  context2,
236
249
  scoped,
237
250
  acquireRelease,
@@ -268,17 +281,8 @@ import {
268
281
  TaggedUnion,
269
282
  Int2,
270
283
  Defect,
271
- TaggedError2,
272
- join,
273
- interrupt3,
274
- makeUnsafe5
275
- } from "./main-csnx585b.mjs";
276
- import {
277
- relayTokenQueryParam,
278
- relayToken,
279
- secretsEqual,
280
- ensurePrivateDirectory
281
- } from "./main-tyydn3xk.mjs";
284
+ TaggedError2
285
+ } from "./main-yf5j8g79.mjs";
282
286
  import {
283
287
  isString,
284
288
  isNumber,
@@ -288,7 +292,7 @@ import {
288
292
  isFunction,
289
293
  isObjectOrArray,
290
294
  isObject
291
- } from "./main-yf9xhpn4.mjs";
295
+ } from "./main-ken6azcs.mjs";
292
296
 
293
297
  // src/relay.ts
294
298
  import crypto10 from "node:crypto";
@@ -401,11 +405,11 @@ class ExtensionRpc {
401
405
  return callback2((resume) => {
402
406
  const socket = this.socket;
403
407
  if (this.protocolCompatible === false) {
404
- resume(fail5(new Error(extensionProtocolAdvice(this.protocolVersion, { install: installCommand() }))));
408
+ resume(fail6(new Error(extensionProtocolAdvice(this.protocolVersion, { install: installCommand() }))));
405
409
  return void_3;
406
410
  }
407
411
  if (!socket || socket.readyState !== WebSocket.OPEN || !this.acceptsEvents) {
408
- resume(fail5(new Error("browse extension is not connected")));
412
+ resume(fail6(new Error("browse extension is not connected")));
409
413
  return void_3;
410
414
  }
411
415
  const id = this.nextRequestId++;
@@ -427,10 +431,10 @@ class ExtensionRpc {
427
431
  if (this.replies !== replies)
428
432
  return finish(succeed6({}));
429
433
  this.unresponsive = true;
430
- return finish(fail5(new Error(browserUnresponsive)));
434
+ return finish(fail6(new Error(browserUnresponsive)));
431
435
  }
432
436
  this.probeLiveness(socket);
433
- finish(fail5(new Error(`Extension command timed out after ${timeoutMs}ms: ${command.method}`)));
437
+ finish(fail6(new Error(`Extension command timed out after ${timeoutMs}ms: ${command.method}`)));
434
438
  }, timeoutMs);
435
439
  const debuggerTabId = command.method === "debugger.sendCommand" && isNumber(command.params?.tabId) ? command.params.tabId : undefined;
436
440
  this.pendingRequests.set(id, {
@@ -438,18 +442,18 @@ class ExtensionRpc {
438
442
  finish(succeed6(value));
439
443
  },
440
444
  reject: (error) => {
441
- finish(fail5(error));
445
+ finish(fail6(error));
442
446
  },
443
447
  ...debuggerTabId === undefined ? {} : { debuggerTabId }
444
448
  });
445
449
  try {
446
450
  socket.send(JSON.stringify(message), (error) => {
447
451
  if (error) {
448
- finish(fail5(new Error(`send extension command: ${command.method}`, { cause: error })));
452
+ finish(fail6(new Error(`send extension command: ${command.method}`, { cause: error })));
449
453
  }
450
454
  });
451
455
  } catch (error) {
452
- finish(fail5(new Error(`send extension command: ${command.method}`, { cause: error })));
456
+ finish(fail6(new Error(`send extension command: ${command.method}`, { cause: error })));
453
457
  }
454
458
  return sync2(() => {
455
459
  completed = true;
@@ -1633,7 +1637,7 @@ class CdpRuntime {
1633
1637
  method: "Runtime.enable",
1634
1638
  params,
1635
1639
  ...route.chromeSessionId === undefined ? {} : { sessionId: route.chromeSessionId }
1636
- }) : fail5(new Error("CDP target changed before Runtime.enable"))), client && requester ? {
1640
+ }) : fail6(new Error("CDP target changed before Runtime.enable"))), client && requester ? {
1637
1641
  replay: () => {
1638
1642
  const frameId = rootFrame();
1639
1643
  return frameId !== undefined && this.replayCached(client, route, frameId);
@@ -1645,7 +1649,7 @@ class CdpRuntime {
1645
1649
  } : {});
1646
1650
  this.trace(route, `runtime-enable defaultContextSeen=${first.seen}`);
1647
1651
  if (!first.seen && permitted()) {
1648
- const retry = yield* this.observe(route, this.reset(route, "Runtime.disable", {}, permitted).pipe(andThen(() => this.reset(route, "Runtime.enable", params, permitted))));
1652
+ const retry = yield* this.observe(route, this.reset(route, "Runtime.disable", {}, permitted).pipe(andThen2(() => this.reset(route, "Runtime.enable", params, permitted))));
1649
1653
  this.trace(route, `runtime-reset phase=missing-default-context defaultContextSeen=${retry.seen}`);
1650
1654
  }
1651
1655
  return first.result;
@@ -1685,7 +1689,7 @@ class CdpRuntime {
1685
1689
  observe(route, command, options = {}) {
1686
1690
  const runtime = this;
1687
1691
  return acquireUseRelease(sync2(() => {
1688
- const waiter = { sessionId: routeSessionId(route), ready: makeUnsafe3(), nativeReady: options.nativeReady ?? (() => true) };
1692
+ const waiter = { sessionId: routeSessionId(route), ready: makeUnsafe4(), nativeReady: options.nativeReady ?? (() => true) };
1689
1693
  runtime.waiters.add(waiter);
1690
1694
  return waiter;
1691
1695
  }), (waiter) => gen(function* () {
@@ -1951,7 +1955,7 @@ class AuthenticatedOriginError extends TaggedError2()("AuthenticatedOrigin.Error
1951
1955
  }) {
1952
1956
  }
1953
1957
  var requestJson = fn("AuthenticatedOrigin.requestJson")(function* (page, request) {
1954
- const target = yield* try_({
1958
+ const target = yield* try_2({
1955
1959
  try: () => {
1956
1960
  const origin = normalizeOrigin(request.origin);
1957
1961
  return {
@@ -4896,7 +4900,7 @@ var runPlaywrightOperation = fn("Execute.playwrightOperation")((options) => tryP
4896
4900
  catch: (cause) => operationFailure(options.label, cause)
4897
4901
  }).pipe(timeoutOrElse({
4898
4902
  duration: options.timeoutMs,
4899
- orElse: () => fail5(new PlaywrightOperationError({
4903
+ orElse: () => fail6(new PlaywrightOperationError({
4900
4904
  message: `${options.label} timed out after ${options.timeoutMs}ms`,
4901
4905
  operation: options.label,
4902
4906
  reason: "timeout"
@@ -7381,7 +7385,7 @@ class GhostCursorTabs {
7381
7385
  command = fnUntraced(function* (tabId, params) {
7382
7386
  const operation = params?.op;
7383
7387
  if (!isString(operation) || !ghostCursorOperations.has(operation)) {
7384
- return yield* fail5(new Error(`Unknown ghost cursor operation: ${String(operation)}`));
7388
+ return yield* fail6(new Error(`Unknown ghost cursor operation: ${String(operation)}`));
7385
7389
  }
7386
7390
  const payload = params?.payload ?? null;
7387
7391
  const state = this.state(tabId);
@@ -10301,7 +10305,7 @@ class Recorder {
10301
10305
  }
10302
10306
  start(page, options = {}) {
10303
10307
  const capture = this;
10304
- return this.transition.withPermit(try_({
10308
+ return this.transition.withPermit(try_2({
10305
10309
  try: () => {
10306
10310
  validateOptions(options);
10307
10311
  if (capture.active) {
@@ -12165,7 +12169,7 @@ class RelayShutdown {
12165
12169
  options;
12166
12170
  state = State.Running();
12167
12171
  requests = 0;
12168
- idle = makeUnsafe5(true);
12172
+ idle = makeUnsafe2(true);
12169
12173
  constructor(options) {
12170
12174
  this.options = options;
12171
12175
  }
@@ -12183,7 +12187,7 @@ class RelayShutdown {
12183
12187
  yield* control.options.settle;
12184
12188
  }).pipe(timeoutOrElse({
12185
12189
  duration: control.options.timeoutMs ?? 1e4,
12186
- orElse: () => fail5(control.busyError("timeout"))
12190
+ orElse: () => fail6(control.busyError("timeout"))
12187
12191
  }));
12188
12192
  }
12189
12193
  close() {
@@ -12197,7 +12201,7 @@ class RelayShutdown {
12197
12201
  const control = this;
12198
12202
  return acquireUseRelease(suspend2(() => {
12199
12203
  if (!control.accepting)
12200
- return fail5(control.busyError());
12204
+ return fail6(control.busyError());
12201
12205
  return sync2(() => control.retain());
12202
12206
  }), () => effect, (release) => sync2(release));
12203
12207
  }
@@ -12348,7 +12352,7 @@ class SessionError extends TaggedError2()("OpenCodeBrowserSessions.SessionError"
12348
12352
  }) {
12349
12353
  }
12350
12354
  var sessionError = (reason, message, sessionId) => new SessionError({ message, reason, ...sessionId ? { sessionId } : {} });
12351
- var trySession = (work) => try_({ try: work, catch: (cause) => cause instanceof Error ? cause : new Error(String(cause)) });
12355
+ var trySession = (work) => try_2({ try: work, catch: (cause) => cause instanceof Error ? cause : new Error(String(cause)) });
12352
12356
  var adoptionTipForUrl = (url) => {
12353
12357
  const selector = targetUrlHintSelector(url);
12354
12358
  return `Tip: an attached tab is open (${url}). Use session_adopt with targetUrl '${selector}' (CLI: ${cliCommand(`session adopt --target-url '${selector}'`)}) to drive it instead of this new tab.`;
@@ -12421,7 +12425,7 @@ class SessionAdmission {
12421
12425
  pendingWork = 0;
12422
12426
  pendingSessionWork = new Map;
12423
12427
  identityChanges = new Map;
12424
- idle = makeUnsafe5(true);
12428
+ idle = makeUnsafe2(true);
12425
12429
  constructor(sessions, hooks) {
12426
12430
  this.sessions = sessions;
12427
12431
  this.hooks = hooks;
@@ -12442,20 +12446,20 @@ class SessionAdmission {
12442
12446
  awaitStableIdentity(id) {
12443
12447
  return suspend2(() => {
12444
12448
  const pending = id === undefined ? undefined : this.identityChanges.get(id);
12445
- return pending ? _await(pending).pipe(andThen(this.awaitStableIdentity(id))) : void_3;
12449
+ return pending ? _await(pending).pipe(andThen2(this.awaitStableIdentity(id))) : void_3;
12446
12450
  });
12447
12451
  }
12448
12452
  withIdentityChange(id, effect) {
12449
12453
  return suspend2(() => {
12450
12454
  const pending = this.identityChanges.get(id);
12451
12455
  if (pending)
12452
- return _await(pending).pipe(andThen(this.withIdentityChange(id, effect)));
12453
- const settled = makeUnsafe3();
12456
+ return _await(pending).pipe(andThen2(this.withIdentityChange(id, effect)));
12457
+ const settled = makeUnsafe4();
12454
12458
  this.identityChanges.set(id, settled);
12455
12459
  return effect.pipe(onExit((exit) => suspend2(() => {
12456
12460
  if (this.identityChanges.get(id) === settled)
12457
12461
  this.identityChanges.delete(id);
12458
- return done(settled, asVoid(exit));
12462
+ return done2(settled, asVoid(exit));
12459
12463
  })));
12460
12464
  });
12461
12465
  }
@@ -12478,13 +12482,13 @@ class SessionAdmission {
12478
12482
  };
12479
12483
  }
12480
12484
  withAdmission(sessionId, effect) {
12481
- return acquireUseRelease(try_({
12485
+ return acquireUseRelease(try_2({
12482
12486
  try: () => {
12483
12487
  this.assertAdmission();
12484
12488
  return this.retainWork(sessionId);
12485
12489
  },
12486
12490
  catch: (cause) => cause instanceof Error ? cause : new Error("Admit session operation", { cause })
12487
- }), () => this.awaitStableIdentity(sessionId).pipe(andThen(effect)), (release) => sync2(release));
12491
+ }), () => this.awaitStableIdentity(sessionId).pipe(andThen2(effect)), (release) => sync2(release));
12488
12492
  }
12489
12493
  forkTracked(effect, sessionId) {
12490
12494
  return uninterruptibleMask2(() => suspend2(() => {
@@ -12528,7 +12532,7 @@ class SessionAdmission {
12528
12532
  yield* rollback();
12529
12533
  this.schedulePersistence();
12530
12534
  yield* this.flushPersistence().pipe(ignore);
12531
- return yield* fail5(error);
12535
+ return yield* fail6(error);
12532
12536
  })));
12533
12537
  }
12534
12538
  beginDrain() {
@@ -12564,7 +12568,7 @@ function adoptTargetForSession(context, options) {
12564
12568
  return context.admission.withAdmission(options.sessionId, uninterruptibleMask2((restore) => gen(function* () {
12565
12569
  const resolved = yield* context.resolveWorkSession(options.sessionId, options.createIfMissing);
12566
12570
  const session = resolved.session;
12567
- const result2 = yield* make5();
12571
+ const result2 = yield* make10();
12568
12572
  let state = "pending";
12569
12573
  let cancelled = false;
12570
12574
  let reservation;
@@ -12593,7 +12597,7 @@ function adoptTargetForSession(context, options) {
12593
12597
  if (options.tabId !== undefined && browser?.key && context.hooks.targetBrowserKey?.(options.tabId) !== browser.key) {
12594
12598
  return yield* sessionError("invalid-request", `Tab ${options.tabId} is not in session ${session.id}'s browser '${browser.id}'. Start a new session for its browser.`, session.id);
12595
12599
  }
12596
- reservation = yield* try_({
12600
+ reservation = yield* try_2({
12597
12601
  try: () => context.targetOwnership.reserveTargetOwnership(options.targetId, session.id),
12598
12602
  catch: (cause) => cause instanceof Error ? cause : new Error("Reserve target ownership", { cause })
12599
12603
  });
@@ -12617,7 +12621,7 @@ function adoptTargetForSession(context, options) {
12617
12621
  if (adoptionCancelled()) {
12618
12622
  return yield* timeoutError;
12619
12623
  }
12620
- yield* try_({
12624
+ yield* try_2({
12621
12625
  try: () => {
12622
12626
  context.notifyTargetOwnershipChange(context.targetOwnership.commitTargetOwnership({
12623
12627
  reservation: activeReservation,
@@ -12632,7 +12636,7 @@ function adoptTargetForSession(context, options) {
12632
12636
  yield* succeed4(result2, value);
12633
12637
  return value;
12634
12638
  });
12635
- const transaction = session.executeSemaphore.withPermit(operation.pipe(matchEffect({
12639
+ const transaction = session.executeSemaphore.withPermit(operation.pipe(matchEffect2({
12636
12640
  onFailure: (error) => gen(function* () {
12637
12641
  if (reservation && state !== "committed") {
12638
12642
  context.notifyTargetOwnershipChange(context.targetOwnership.rollbackTargetOwnership(reservation));
@@ -12640,11 +12644,11 @@ function adoptTargetForSession(context, options) {
12640
12644
  if (context.sessions.get(session.id) === session && (resolved.created || state !== "pending")) {
12641
12645
  const cleanup = yield* result(cleanupSettledAdoption(context, session, resolved.created, previousTarget, previousRelayClosed));
12642
12646
  if (isFailure(cleanup)) {
12643
- yield* fail4(result2, cleanup.failure);
12647
+ yield* fail5(result2, cleanup.failure);
12644
12648
  return;
12645
12649
  }
12646
12650
  }
12647
- yield* fail4(result2, error);
12651
+ yield* fail5(result2, error);
12648
12652
  }),
12649
12653
  onSuccess: () => void_3
12650
12654
  })));
@@ -12652,7 +12656,7 @@ function adoptTargetForSession(context, options) {
12652
12656
  yield* context.admission.forkTracked(worker, session.id);
12653
12657
  return yield* restore(_await(result2).pipe(timeoutOrElse({
12654
12658
  duration: timeoutMs,
12655
- orElse: () => cancel.pipe(andThen(fail5(timeoutError)))
12659
+ orElse: () => cancel.pipe(andThen2(fail6(timeoutError)))
12656
12660
  }), onInterrupt(() => cancel)));
12657
12661
  })));
12658
12662
  }
@@ -12701,7 +12705,7 @@ function withLifecycleTimeout(hooks, effect, label) {
12701
12705
  const timeoutMs = hooks.lifecycleTimeoutMs ?? 1e4;
12702
12706
  return effect.pipe(timeoutOrElse({
12703
12707
  duration: timeoutMs,
12704
- orElse: () => fail5(sessionError("timeout", `${label} timed out after ${timeoutMs}ms`))
12708
+ orElse: () => fail6(sessionError("timeout", `${label} timed out after ${timeoutMs}ms`))
12705
12709
  }));
12706
12710
  }
12707
12711
  function closeSessionSettledWithTimeout(admission, hooks, session, closeSettled) {
@@ -12716,7 +12720,7 @@ function executeInSession(ctx, options) {
12716
12720
  }
12717
12721
  const resolved = yield* ctx.resolveWorkSession(options.sessionId, options.createIfMissing, options.browser);
12718
12722
  const session = resolved.session;
12719
- const response = yield* make5();
12723
+ const response = yield* make10();
12720
12724
  let started = false;
12721
12725
  let cancelled = false;
12722
12726
  const operation = gen(function* () {
@@ -12732,8 +12736,8 @@ function executeInSession(ctx, options) {
12732
12736
  started = true;
12733
12737
  session.updatedAt = new Date().toISOString();
12734
12738
  yield* ctx.setExecuting(session.id, true);
12735
- const stopSignal = makeUnsafe3();
12736
- const released = makeUnsafe3();
12739
+ const stopSignal = makeUnsafe4();
12740
+ const released = makeUnsafe4();
12737
12741
  const effectiveTimeoutMs = options.timeoutMs ?? ctx.hooks.executeTimeoutMs ?? defaultExecuteTimeoutMs;
12738
12742
  let deadline;
12739
12743
  const stopRunning = (message, diagnostic) => {
@@ -12797,9 +12801,9 @@ function executeInSession(ctx, options) {
12797
12801
  yield* ctx.admission.commitPersistence();
12798
12802
  return { result: resultWithHint, session: createdSummary(session, resolved.created) };
12799
12803
  });
12800
- const worker = session.executeSemaphore.withPermit(operation.pipe(matchEffect({
12801
- onFailure: (error) => (resolved.created ? ctx.cleanupCreatedSession(session) : void_3).pipe(andThen(fail4(response, error))),
12802
- onSuccess: (value) => (options.removeAfterExecute ? ctx.cleanupCreatedSession(session) : void_3).pipe(andThen(succeed4(response, value)))
12804
+ const worker = session.executeSemaphore.withPermit(operation.pipe(matchEffect2({
12805
+ onFailure: (error) => (resolved.created ? ctx.cleanupCreatedSession(session) : void_3).pipe(andThen2(fail5(response, error))),
12806
+ onSuccess: (value) => (options.removeAfterExecute ? ctx.cleanupCreatedSession(session) : void_3).pipe(andThen2(succeed4(response, value)))
12803
12807
  })));
12804
12808
  const workerFiber = yield* ctx.admission.forkTracked(worker, session.id);
12805
12809
  return yield* restore(_await(response)).pipe(onInterrupt(() => suspend2(() => {
@@ -12808,7 +12812,7 @@ function executeInSession(ctx, options) {
12808
12812
  return void_3;
12809
12813
  }
12810
12814
  cancelled = true;
12811
- return interrupt3(workerFiber).pipe(asVoid2, andThen(resolved.created ? session.executeSemaphore.withPermit(ctx.cleanupCreatedSession(session)) : void_3));
12815
+ return interrupt(workerFiber).pipe(asVoid2, andThen2(resolved.created ? session.executeSemaphore.withPermit(ctx.cleanupCreatedSession(session)) : void_3));
12812
12816
  })));
12813
12817
  })));
12814
12818
  }
@@ -13172,7 +13176,7 @@ class OpenCodeBrowserSessions {
13172
13176
  }
13173
13177
  networkStatus(id) {
13174
13178
  const session = this.sessions.get(id);
13175
- return session ? succeed6(session.sandbox.networkStatus()) : fail5(sessionError("not-found", `Session not found: ${id}`, id));
13179
+ return session ? succeed6(session.sandbox.networkStatus()) : fail6(sessionError("not-found", `Session not found: ${id}`, id));
13176
13180
  }
13177
13181
  networkStop(id, options = {}) {
13178
13182
  return this.withSessionOperation(id, "network stop", (session) => session.sandbox.networkStop(options));
@@ -13188,8 +13192,8 @@ class OpenCodeBrowserSessions {
13188
13192
  return this.admission.withAdmission(id, suspend2(() => {
13189
13193
  const session = manager.sessions.get(id);
13190
13194
  if (!session)
13191
- return fail5(sessionError("not-found", `Session not found: ${id}`, id));
13192
- return (beforePermit ? beforePermit(session) : void_3).pipe(andThen(manager.withLifecyclePermit(session, operation, gen(function* () {
13195
+ return fail6(sessionError("not-found", `Session not found: ${id}`, id));
13196
+ return (beforePermit ? beforePermit(session) : void_3).pipe(andThen2(manager.withLifecyclePermit(session, operation, gen(function* () {
13193
13197
  if (manager.sessions.get(id) !== session) {
13194
13198
  return yield* sessionError("inactive", `Session is no longer active: ${id}`, id);
13195
13199
  }
@@ -13207,7 +13211,7 @@ class OpenCodeBrowserSessions {
13207
13211
  session.updatedAt = new Date().toISOString();
13208
13212
  yield* manager.admission.commitPersistence();
13209
13213
  return result;
13210
- }), (session) => session.readOnly && request.method !== "GET" ? fail5(sessionError("invalid-request", `Read-only session ${sessionId} cannot make ${request.method} authenticated requests`, sessionId)) : void_3);
13214
+ }), (session) => session.readOnly && request.method !== "GET" ? fail6(sessionError("invalid-request", `Read-only session ${sessionId} cannot make ${request.method} authenticated requests`, sessionId)) : void_3);
13211
13215
  }
13212
13216
  execute(options) {
13213
13217
  return executeInSession(this.executionContext, options);
@@ -13312,7 +13316,7 @@ class OpenCodeBrowserSessions {
13312
13316
  catch: (cause) => cause
13313
13317
  }).pipe(timeoutOrElse({
13314
13318
  duration: this.hooks.journalTimeoutMs ?? 2000,
13315
- orElse: () => fail5(new Error(`Session journal write timed out after ${this.hooks.journalTimeoutMs ?? 2000}ms`))
13319
+ orElse: () => fail6(new Error(`Session journal write timed out after ${this.hooks.journalTimeoutMs ?? 2000}ms`))
13316
13320
  }), catch_((error) => sync2(() => {
13317
13321
  console.error("Session execute-record hook failed", error);
13318
13322
  })), asVoid2);
@@ -13396,7 +13400,7 @@ class OpenCodeBrowserSessions {
13396
13400
  const pending = Array.from(sessionRelayTargetIds(this.hooks, session)).filter((id) => !closed.has(id));
13397
13401
  if (pending.length === 0)
13398
13402
  return;
13399
- yield* forEach(pending, (targetId) => this.closeRelayTarget(targetId).pipe(ignore, andThen(sync2(() => {
13403
+ yield* forEach(pending, (targetId) => this.closeRelayTarget(targetId).pipe(ignore, andThen2(sync2(() => {
13400
13404
  closed.add(targetId);
13401
13405
  }))), { concurrency: 4, discard: true });
13402
13406
  }
@@ -13432,14 +13436,14 @@ class OpenCodeBrowserSessions {
13432
13436
  const timeout = sessionError("timeout", `Session ${operation} timed out waiting for active execute in ${session.id}`, session.id);
13433
13437
  return raceFirst(session.executeSemaphore.withPermit(suspend2(() => {
13434
13438
  if (state === "timed-out")
13435
- return fail5(timeout);
13439
+ return fail6(timeout);
13436
13440
  state = "started";
13437
13441
  return effect;
13438
13442
  }).pipe(uninterruptible)), sleep(this.hooks.lifecycleTimeoutMs ?? 1e4).pipe(flatMap3(() => {
13439
13443
  if (state === "started")
13440
13444
  return never;
13441
13445
  state = "timed-out";
13442
- return fail5(timeout);
13446
+ return fail6(timeout);
13443
13447
  })));
13444
13448
  });
13445
13449
  }
@@ -13541,7 +13545,7 @@ function relayHttpError(error) {
13541
13545
  return routeError(error instanceof Error ? error.message : String(error), 500, "internal");
13542
13546
  }
13543
13547
  function originPatterns(raw) {
13544
- return try_({
13548
+ return try_2({
13545
13549
  try: () => normalizeOriginPatterns(raw),
13546
13550
  catch: (cause) => cause instanceof OriginPatternError ? new Error(cause.message) : new Error("Invalid origin patterns", { cause })
13547
13551
  });
@@ -15798,7 +15802,7 @@ function createCdpDispatcher(options) {
15798
15802
  const routeCdpCommand = fn("Relay.routeCdpCommand")(function* (socket, message) {
15799
15803
  const clientOpenCodeBrowserSessionId = cdpClients.sessionId(socket);
15800
15804
  if (!shutdownControl.accepting && (!cdpClients.isSandbox(socket) || !clientOpenCodeBrowserSessionId || !sessions.hasPendingWork(clientOpenCodeBrowserSessionId))) {
15801
- return yield* fail5(new Error("Relay is draining for an explicit restart"));
15805
+ return yield* fail6(new Error("Relay is draining for an explicit restart"));
15802
15806
  }
15803
15807
  const guardMessage = guardCdpMethod({
15804
15808
  method: message.method,
@@ -15808,7 +15812,7 @@ function createCdpDispatcher(options) {
15808
15812
  pageUrls: () => cdpRouter.visibleRoots(socket).map((target) => target.targetInfo.url)
15809
15813
  });
15810
15814
  if (guardMessage) {
15811
- return yield* fail5(new Error(guardMessage));
15815
+ return yield* fail6(new Error(guardMessage));
15812
15816
  }
15813
15817
  if (message.method === "Page.navigate" || message.method === "Target.createTarget") {
15814
15818
  const tabSessionId = message.method === "Page.navigate" ? (() => {
@@ -15824,7 +15828,7 @@ function createCdpDispatcher(options) {
15824
15828
  sessionId: tabSessionId ?? clientOpenCodeBrowserSessionId
15825
15829
  }));
15826
15830
  if (refusal)
15827
- return yield* fail5(new Error(refusal));
15831
+ return yield* fail6(new Error(refusal));
15828
15832
  }
15829
15833
  if (message.method === "Browser.getVersion") {
15830
15834
  return {
@@ -15855,7 +15859,7 @@ function createCdpDispatcher(options) {
15855
15859
  if (message.method === "Target.setAutoAttach" && message.sessionId && registry.targets.has(message.sessionId)) {
15856
15860
  const target = cdpRouter.rootForSession(socket, message.sessionId);
15857
15861
  if (!target) {
15858
- return yield* fail5(new Error(`Target not found: ${message.sessionId}`));
15862
+ return yield* fail6(new Error(`Target not found: ${message.sessionId}`));
15859
15863
  }
15860
15864
  const result = yield* sendDebuggerCommand({ tabId: target.tabId, method: "Target.setAutoAttach", params: message.params ?? {} });
15861
15865
  replayChildTargetsForParent({ socket, parentSessionId: target.sessionId, registry, clients: cdpClients });
@@ -15881,7 +15885,7 @@ function createCdpDispatcher(options) {
15881
15885
  replayChildFrameNavigation({ socket, registry, target });
15882
15886
  return { sessionId: target.sessionId };
15883
15887
  }
15884
- return yield* fail5(new Error(`Target not found: ${targetId}`));
15888
+ return yield* fail6(new Error(`Target not found: ${targetId}`));
15885
15889
  }
15886
15890
  if (message.method === "Target.getTargetInfo") {
15887
15891
  const targetId = getString2(message.params, "targetId") ?? "";
@@ -15892,7 +15896,7 @@ function createCdpDispatcher(options) {
15892
15896
  if (!target) {
15893
15897
  if (!targetId && !message.sessionId)
15894
15898
  return {};
15895
- return yield* fail5(new Error(`Target not found: ${targetId || message.sessionId || "unknown"}`));
15899
+ return yield* fail6(new Error(`Target not found: ${targetId || message.sessionId || "unknown"}`));
15896
15900
  }
15897
15901
  return { targetInfo: target.targetInfo };
15898
15902
  }
@@ -15929,7 +15933,7 @@ function createCdpDispatcher(options) {
15929
15933
  return {};
15930
15934
  }
15931
15935
  const normalizedMessage = removeDefaultLightColorSchemeEmulation(message);
15932
- const route = yield* try_({
15936
+ const route = yield* try_2({
15933
15937
  try: () => cdpRouter.resolveCommandRoute(socket, message),
15934
15938
  catch: (error) => error instanceof Error ? error : new Error(String(error))
15935
15939
  });
@@ -15976,11 +15980,11 @@ function createCdpDispatcher(options) {
15976
15980
  return fnUntraced(function* (socket, raw) {
15977
15981
  const message = parseJsonObject(raw);
15978
15982
  if (!isCdpRequest(message)) {
15979
- return yield* fail5(new Error("Invalid CDP request"));
15983
+ return yield* fail6(new Error("Invalid CDP request"));
15980
15984
  }
15981
15985
  const frameTreeSent = message.method === "Page.getFrameTree" ? admitFrameTreeResponse(socket, message.sessionId) : undefined;
15982
15986
  debugLog?.(`cdp<- ${cdpClients.sessionId(socket) ?? "raw"} #${message.id} ${message.method} ${message.sessionId ?? ""}`);
15983
- yield* matchEffect(routeCdpCommand(socket, message), {
15987
+ yield* matchEffect2(routeCdpCommand(socket, message), {
15984
15988
  onFailure: (error) => {
15985
15989
  return sync2(() => {
15986
15990
  const runtimeEvaluation = isRuntimeEvaluationMethod(message.method);
@@ -16028,11 +16032,11 @@ function createExtensionCommands(options) {
16028
16032
  if (tabId !== undefined) {
16029
16033
  const owner = browsers.browserTab(tabId);
16030
16034
  if (!owner)
16031
- return fail5(new Error("browse extension is not connected"));
16035
+ return fail6(new Error("browse extension is not connected"));
16032
16036
  return sendToBrowser(owner.link, { ...command, params: { ...command.params, tabId: owner.tabId } });
16033
16037
  }
16034
16038
  const target = link ?? browsers.defaultLink();
16035
- return target ? sendToBrowser(target, command) : fail5(new Error("browse extension is not connected"));
16039
+ return target ? sendToBrowser(target, command) : fail6(new Error("browse extension is not connected"));
16036
16040
  };
16037
16041
  const sendExtensionBestEffort = (command, link) => {
16038
16042
  runPromise(ignore(sendToExtension(command, link))).catch(() => {});
@@ -16045,13 +16049,13 @@ function createExtensionCommands(options) {
16045
16049
  const sendToEach = (command) => gen(function* () {
16046
16050
  const links = browsers.list().filter((link) => link.rpc.connected);
16047
16051
  if (links.length === 0)
16048
- return yield* fail5(new Error("browse extension is not connected"));
16052
+ return yield* fail6(new Error("browse extension is not connected"));
16049
16053
  const results = yield* forEach(links, (link) => result(sendToBrowser(link, command)), { concurrency: "unbounded" });
16050
16054
  const succeeded = results.find(isSuccess);
16051
16055
  if (succeeded)
16052
16056
  return succeeded.success;
16053
16057
  const failed = results.find(isFailure);
16054
- return yield* fail5(failed?.failure ?? new Error("browse extension is not connected"));
16058
+ return yield* fail6(failed?.failure ?? new Error("browse extension is not connected"));
16055
16059
  });
16056
16060
  return { sendToExtension, sendExtensionBestEffort, sendToEveryBrowser, sendToEach };
16057
16061
  }
@@ -17160,7 +17164,7 @@ function createRelayHousekeeping(options) {
17160
17164
  const target = registry.targetsByTargetId.get(targetId);
17161
17165
  return target ? isTabBusy(target.tabId) : false;
17162
17166
  }
17163
- }).pipe(andThen(() => forEach(tabActivity.idleUserTargets(registry.listRootTargets(), Date.now(), idleTabTtlMs), (target) => detachIdleUserTarget(target.targetInfo.targetId).pipe(ignore), { discard: true })))).catch(() => {});
17167
+ }).pipe(andThen2(() => forEach(tabActivity.idleUserTargets(registry.listRootTargets(), Date.now(), idleTabTtlMs), (target) => detachIdleUserTarget(target.targetInfo.targetId).pipe(ignore), { discard: true })))).catch(() => {});
17164
17168
  }, 60000);
17165
17169
  idleReapTimer.unref();
17166
17170
  }
@@ -17197,7 +17201,7 @@ function createRelaySettingsSync(options) {
17197
17201
  const extensionSettings = (method, values) => gen(function* () {
17198
17202
  if (!browsers.connected) {
17199
17203
  const rejected = handshake.rejectedProtocol();
17200
- return yield* fail5(new Error(rejected ? handshake.mismatchAdvice(rejected.version) : "The browse extension isn't connected, so its settings can't be read or changed. Ask the user to open the browser with the extension; its options page shows whether it's connected."));
17204
+ return yield* fail6(new Error(rejected ? handshake.mismatchAdvice(rejected.version) : "The browse extension isn't connected, so its settings can't be read or changed. Ask the user to open the browser with the extension; its options page shows whether it's connected."));
17201
17205
  }
17202
17206
  const result = yield* sendToExtension({ method, ...values ? { params: { values } } : {} }).pipe(mapError((error) => /Invalid extension command/.test(error.message) ? new Error(`The connected browse extension is too old to read or change settings from here. Update browse (\`${installCommand()}\`) and reload the extension, or change them on its options page.`) : error));
17203
17207
  return settingsFromExtension(result);
@@ -17239,7 +17243,7 @@ function createRelaySettingsSync(options) {
17239
17243
  const httpSettings = {
17240
17244
  get: () => extensionSettings("settings.get").pipe(map5((stored) => describeSettings(withRelaySettings(stored), userSettingOverrides()))),
17241
17245
  set: (input) => gen(function* () {
17242
- const requested = yield* try_({
17246
+ const requested = yield* try_2({
17243
17247
  try: () => parseSettingChanges(input),
17244
17248
  catch: (error) => error instanceof SettingsInputError ? new HttpRouteError2({ message: error.message, status: 400, code: "invalid-request" }) : new Error(String(error))
17245
17249
  });
@@ -17699,13 +17703,13 @@ class RootTargetLifecycle {
17699
17703
  scope;
17700
17704
  run;
17701
17705
  static make = fn("RootTargetLifecycle.make")(function* (options) {
17702
- const scope = yield* make6();
17706
+ const scope = yield* make11();
17703
17707
  const run = runForkWith(yield* context2());
17704
17708
  return yield* acquireRelease(sync2(() => new RootTargetLifecycle(options, scope, run)), (lifecycle) => lifecycle.close());
17705
17709
  });
17706
17710
  tabs = new Map;
17707
17711
  workers = new Map;
17708
- idle = makeUnsafe5(true);
17712
+ idle = makeUnsafe2(true);
17709
17713
  active = 0;
17710
17714
  closing = false;
17711
17715
  failedTabs = new Map;
@@ -17751,7 +17755,7 @@ class RootTargetLifecycle {
17751
17755
  work.users += 1;
17752
17756
  const worker = {
17753
17757
  generation,
17754
- done: makeUnsafe5(),
17758
+ done: makeUnsafe2(),
17755
17759
  attachIfMissing: options.attachIfMissing,
17756
17760
  renewed: options.renewed === true,
17757
17761
  pending: false,
@@ -17835,7 +17839,7 @@ class RootTargetLifecycle {
17835
17839
  const lifecycle = this;
17836
17840
  return suspend2(() => {
17837
17841
  if (lifecycle.closing)
17838
- return fail5(new Error("Relay is closing"));
17842
+ return fail6(new Error("Relay is closing"));
17839
17843
  const generation = expectedGeneration ?? lifecycle.options.extension.generation(tabId);
17840
17844
  const work = lifecycle.tabWork(tabId);
17841
17845
  const revision = work.revision;
@@ -17852,7 +17856,7 @@ class RootTargetLifecycle {
17852
17856
  root: lifecycle.options.registry.tabTargets.get(tabId),
17853
17857
  staged: lifecycle.options.registry.stagedRootTarget(tabId)
17854
17858
  };
17855
- return lifecycle.check(transition).pipe(andThen(() => use(transition)));
17859
+ return lifecycle.check(transition).pipe(andThen2(() => use(transition)));
17856
17860
  })).pipe(ensuring(sync2(() => {
17857
17861
  if (--work.users === 0 && !lifecycle.options.registry.routingRootTarget(tabId))
17858
17862
  lifecycle.tabs.delete(tabId);
@@ -17874,14 +17878,14 @@ class RootTargetLifecycle {
17874
17878
  return yield* new GenerationChanged({ message: "Root target generation changed during reconciliation" });
17875
17879
  });
17876
17880
  step(transition, effect) {
17877
- return this.check(transition).pipe(andThen(effect), catch_((error) => this.check(transition).pipe(andThen(fail5(error)))), tap(() => this.check(transition)));
17881
+ return this.check(transition).pipe(andThen2(effect), catch_((error) => this.check(transition).pipe(andThen2(fail6(error)))), tap(() => this.check(transition)));
17878
17882
  }
17879
17883
  command(transition, method, params = {}) {
17880
17884
  const send = this.options.extension.send({ method: "debugger.sendCommand", params: { tabId: transition.tabId, method, params } });
17881
17885
  const timeoutMs = transition.timeoutMs;
17882
17886
  return this.step(transition, timeoutMs === undefined ? send : send.pipe(timeoutOrElse({
17883
17887
  duration: timeoutMs,
17884
- orElse: () => fail5(new RootTargetTimeout({ message: `${method} did not answer within ${timeoutMs} ms on tab ${transition.tabId}` }))
17888
+ orElse: () => fail6(new RootTargetTimeout({ message: `${method} did not answer within ${timeoutMs} ms on tab ${transition.tabId}` }))
17885
17889
  })));
17886
17890
  }
17887
17891
  attachUnlocked = fnUntraced(function* (transition, options) {
@@ -17894,7 +17898,7 @@ class RootTargetLifecycle {
17894
17898
  const result = yield* this.command(transition, "Target.getTargetInfo");
17895
17899
  const reportedTargetInfo = getTargetInfo2(result.targetInfo);
17896
17900
  if (!reportedTargetInfo)
17897
- return yield* fail5(new Error("Target.getTargetInfo did not return targetInfo"));
17901
+ return yield* fail6(new Error("Target.getTargetInfo did not return targetInfo"));
17898
17902
  const targetInfo = options.openerTargetId && !reportedTargetInfo.openerId ? { ...reportedTargetInfo, openerId: options.openerTargetId } : reportedTargetInfo;
17899
17903
  const restored = options.opencodeBrowserSessionId ? undefined : this.options.sessions.persistedTargetOwner(targetInfo.targetId);
17900
17904
  const opencodeBrowserSessionId = options.opencodeBrowserSessionId ?? restored?.sessionId;
@@ -17918,7 +17922,7 @@ class RootTargetLifecycle {
17918
17922
  yield* this.check(transition);
17919
17923
  const targetInfo = getTargetInfo2(result.targetInfo);
17920
17924
  if (!targetInfo) {
17921
- return yield* fail5(new Error(staged ? "Unable to verify staged root target" : "Unable to verify committed root target"));
17925
+ return yield* fail6(new Error(staged ? "Unable to verify staged root target" : "Unable to verify committed root target"));
17922
17926
  }
17923
17927
  if (staged?.targetInfo.targetId === targetInfo.targetId) {
17924
17928
  yield* this.finish(transition, staged);
@@ -17941,11 +17945,11 @@ class RootTargetLifecycle {
17941
17945
  yield* this.command(transition, "Target.setAutoAttach", autoAttachParams ?? { autoAttach: true, waitForDebuggerOnStart: false, flatten: true });
17942
17946
  const result = yield* this.command(transition, "Target.getTargetInfo");
17943
17947
  if (getTargetInfo2(result.targetInfo)?.targetId !== target.targetInfo.targetId) {
17944
- return yield* fail5(new Error(`Root target changed while preparing ${target.targetInfo.targetId}`));
17948
+ return yield* fail6(new Error(`Root target changed while preparing ${target.targetInfo.targetId}`));
17945
17949
  }
17946
17950
  const change = registry.commitStagedRootTarget(target.tabId, target.sessionId);
17947
17951
  if (!change)
17948
- return yield* fail5(new Error(`Staged root target changed before commit: ${target.targetInfo.targetId}`));
17952
+ return yield* fail6(new Error(`Staged root target changed before commit: ${target.targetInfo.targetId}`));
17949
17953
  transition.root = change.target;
17950
17954
  transition.staged = undefined;
17951
17955
  if (change.kind === "replaced") {
@@ -18297,7 +18301,7 @@ var makeRelay = fnUntraced(function* (options = {}) {
18297
18301
  const sessionCatalog = options.sessionCatalogPath === null ? undefined : new SessionCatalog(options.sessionCatalogPath ?? defaultSessionCatalogPath(port));
18298
18302
  let catalogWritesEnabled = false;
18299
18303
  const registry = new TargetRegistry;
18300
- const authToken = yield* try_({
18304
+ const authToken = yield* try_2({
18301
18305
  try: () => {
18302
18306
  ensurePrivateDirectory();
18303
18307
  return relayToken();
@@ -18457,7 +18461,7 @@ var makeRelay = fnUntraced(function* (options = {}) {
18457
18461
  },
18458
18462
  checkBrowserResponsive: (key) => {
18459
18463
  const link = browsers.byKey(key);
18460
- return link ? link.rpc.send({ method: "ping" }).pipe(asVoid2) : fail5(new Error("The browser disconnected before execution."));
18464
+ return link ? link.rpc.send({ method: "ping" }).pipe(asVoid2) : fail6(new Error("The browser disconnected before execution."));
18461
18465
  },
18462
18466
  targetBrowserKey: (tabId) => browsers.ownerKey(tabId),
18463
18467
  getUserAttachedPageUrls: (session) => registry.listRootTargets().filter((target) => target.owner === "user" && browsers.ownerKey(target.tabId) === session.browser?.key).map((target) => target.targetInfo.url || "about:blank"),
@@ -18554,7 +18558,7 @@ var makeRelay = fnUntraced(function* (options = {}) {
18554
18558
  const clientGoneGraceMs = yield* Int("OPENCODE_BROWSER_CLIENT_GONE_GRACE_MS").pipe(withDefault(60000));
18555
18559
  const restartRequestId = yield* option(String2("OPENCODE_BROWSER_RESTART_REQUEST_ID"));
18556
18560
  const lifecycleLogPath = path15.join(stateRoot(), "relays", String(port), "lifecycle.jsonl");
18557
- const audit = (event) => try_(() => appendRelayLifecycleEvent(lifecycleLogPath, event));
18561
+ const audit = (event) => try_2(() => appendRelayLifecycleEvent(lifecycleLogPath, event));
18558
18562
  function setProtectedUi(tabId, protectedUi) {
18559
18563
  const changed = registry.markRootTargetProtectedUi(tabId, protectedUi);
18560
18564
  if (!changed)
@@ -18603,18 +18607,18 @@ var makeRelay = fnUntraced(function* (options = {}) {
18603
18607
  const session = sessionId && sessions.sessions.get(sessionId);
18604
18608
  if (session) {
18605
18609
  const link = handshake.resolveSessionBrowser(undefined, session);
18606
- return "error" in link ? fail5(new Error(link.error)) : succeed6(link);
18610
+ return "error" in link ? fail6(new Error(link.error)) : succeed6(link);
18607
18611
  }
18608
18612
  const existing = sessionId ? registry.listRootTargets().find((target) => target.opencodeBrowserSessionId === sessionId && target.owner === "relay") : undefined;
18609
18613
  const link = (existing && browsers.browserTab(existing.tabId)?.link) ?? browsers.defaultLink();
18610
- return link ? succeed6(link) : fail5(new Error("browse extension is not connected"));
18614
+ return link ? succeed6(link) : fail6(new Error("browse extension is not connected"));
18611
18615
  });
18612
18616
  const createAndAttachTab = fnUntraced(function* (createOptions) {
18613
18617
  const link = yield* sessionBrowser(createOptions.opencodeBrowserSessionId);
18614
18618
  const result = yield* sendToExtension({ method: "tabs.create", params: { url: "about:blank", active: createOptions.active, ...agentWindow ? { window: agentWindow } : {} } }, link);
18615
18619
  const tabId = getNumber2(result, "tabId");
18616
18620
  if (!tabId)
18617
- return yield* fail5(new Error("tabs.create did not return a tabId"));
18621
+ return yield* fail6(new Error("tabs.create did not return a tabId"));
18618
18622
  announceTab(tabId);
18619
18623
  const target = yield* rootLifecycle.attach({
18620
18624
  tabId,
@@ -18858,7 +18862,7 @@ var makeRelay = fnUntraced(function* (options = {}) {
18858
18862
  yield* catch_(listenHttpServer2({ server: httpServer, host: listenHost, port }), (error) => {
18859
18863
  return gen(function* () {
18860
18864
  yield* cleanup();
18861
- return yield* fail5(error);
18865
+ return yield* fail6(error);
18862
18866
  });
18863
18867
  });
18864
18868
  yield* sync2(() => pruneStaleExecuteFilesDirectories());
@@ -18878,7 +18882,7 @@ var makeRelay = fnUntraced(function* (options = {}) {
18878
18882
  },
18879
18883
  catch: (cause) => cause instanceof Error ? cause : new Error("Load browse session catalog", { cause })
18880
18884
  });
18881
- yield* try_({
18885
+ yield* try_2({
18882
18886
  try: () => sessions.restore(restoredSessions),
18883
18887
  catch: (cause) => cause instanceof Error ? cause : new Error("Restore browse sessions", { cause })
18884
18888
  });
@@ -18916,7 +18920,7 @@ var makeRelay = fnUntraced(function* (options = {}) {
18916
18920
  relayLog("relay.ready", { url: endpointUrl, version: opencodeBrowserVersion2, build: opencodeBrowserBuildId2, pid: process.pid, managed });
18917
18921
  }), (error) => gen(function* () {
18918
18922
  yield* cleanup();
18919
- return yield* fail5(error);
18923
+ return yield* fail6(error);
18920
18924
  }));
18921
18925
  return {
18922
18926
  url: endpointUrl,