@opencode/browse 0.0.17-dev.180 → 0.0.17-dev.181

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 (37) hide show
  1. package/dist/{Runtime-jrg7sc9p.mjs → Runtime-xss8qan1.mjs} +1 -1
  2. package/dist/{cli-dbb5bjne.mjs → cli-1bdh4p0a.mjs} +37 -38
  3. package/dist/cli.mjs +14 -14
  4. package/dist/{helpers-mbetgbwv.mjs → helpers-bbaa1vjs.mjs} +1 -3
  5. package/dist/{index-j79y2me1.mjs → index-gjq7chrk.mjs} +2 -2
  6. package/dist/{legacy-runtime-eky6yenx.mjs → legacy-runtime-yjsm0xpg.mjs} +30 -17
  7. package/dist/{main-44rp8pxg.mjs → main-32bwyqja.mjs} +4 -4
  8. package/dist/{main-f98q5tcf.mjs → main-6hvv25x8.mjs} +27 -29
  9. package/dist/{main-v2a390e1.mjs → main-6qfvnjxc.mjs} +7 -9
  10. package/dist/{main-3mhynene.mjs → main-9frwnsnf.mjs} +3 -5
  11. package/dist/{main-048kx59h.mjs → main-akpa411k.mjs} +6 -8
  12. package/dist/main-bt237ys7.mjs +1012 -0
  13. package/dist/main-d5ke1bpm.mjs +4 -0
  14. package/dist/{main-s3g4jwx5.mjs → main-jeta10c6.mjs} +23 -25
  15. package/dist/{main-wpt5ha44.mjs → main-m45zegrn.mjs} +371 -167
  16. package/dist/{main-fpn564ph.mjs → main-pq962g72.mjs} +7 -4
  17. package/dist/main-q4typx7c.mjs +213 -0
  18. package/dist/{main-r8g3xydm.mjs → main-qccyxwg8.mjs} +3 -5
  19. package/dist/{main-awaqqre9.mjs → main-rb7dermc.mjs} +117 -4
  20. package/dist/{main-46wtkfsd.mjs → main-reh7k0hv.mjs} +199 -989
  21. package/dist/{main-jwss6gk9.mjs → main-rvn834gn.mjs} +2 -2
  22. package/dist/{main-wfmad10p.mjs → main-sfxkq31s.mjs} +16 -18
  23. package/dist/{main-q2d5bd1e.mjs → main-tg0r67xj.mjs} +8 -10
  24. package/dist/{main-g1frnq76.mjs → main-tk2thty0.mjs} +8 -7
  25. package/dist/{mcp-amxrbrbd.mjs → mcp-rjpmt73q.mjs} +31 -32
  26. package/dist/{migrate-07f3f3yp.mjs → migrate-hggn66v2.mjs} +5 -6
  27. package/dist/{relay-e7fx469h.mjs → relay-fm6q9hnx.mjs} +87 -60
  28. package/dist/{runtime-update-xt7x7j6c.mjs → runtime-update-vdw1eajx.mjs} +9 -9
  29. package/dist/{setup-m85mamg6.mjs → setup-wyrpwq4c.mjs} +196 -129
  30. package/dist/{supervisor-6zbwkkpt.mjs → supervisor-nbce8yhg.mjs} +10 -6
  31. package/dist/{update-drswqt2m.mjs → update-be8dfw51.mjs} +3 -4
  32. package/dist/{version-v3heqz8b.mjs → version-6j8cdg2k.mjs} +1 -1
  33. package/package.json +1 -1
  34. package/dist/main-4h7rfhhr.mjs +0 -61
  35. package/dist/main-amkq7v9m.mjs +0 -4
  36. package/dist/main-gg7f12gg.mjs +0 -114
  37. package/dist/main-qazf3bhk.mjs +0 -223
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  ensurePrivateDirectorySync
3
- } from "./main-4h7rfhhr.mjs";
3
+ } from "./main-bt237ys7.mjs";
4
4
  import {
5
5
  dataRoot
6
- } from "./main-awaqqre9.mjs";
6
+ } from "./main-rb7dermc.mjs";
7
7
 
8
8
  // src/relay/secrets.ts
9
9
  import crypto from "node:crypto";
@@ -1,3 +1,6 @@
1
+ import {
2
+ cliCommand
3
+ } from "./main-rb7dermc.mjs";
1
4
  import {
2
5
  SessionDeleted,
3
6
  ExecuteLogEntry,
@@ -12,11 +15,11 @@ import {
12
15
  parseTargetSelection2,
13
16
  getObject2,
14
17
  getString2
15
- } from "./main-46wtkfsd.mjs";
18
+ } from "./main-bt237ys7.mjs";
16
19
  import {
17
20
  isStream,
18
21
  provideContext
19
- } from "./main-s3g4jwx5.mjs";
22
+ } from "./main-jeta10c6.mjs";
20
23
  import {
21
24
  TaggedError,
22
25
  passthrough,
@@ -62,8 +65,17 @@ import {
62
65
  toJsonSchemaDocument,
63
66
  Json,
64
67
  JsonObject
65
- } from "./main-f98q5tcf.mjs";
68
+ } from "./main-6hvv25x8.mjs";
66
69
  import {
70
+ pipeArguments,
71
+ identity,
72
+ constTrue,
73
+ constFalse,
74
+ constUndefined,
75
+ isString,
76
+ isNumber,
77
+ isBoolean,
78
+ hasProperty,
67
79
  getStackTraceLimit,
68
80
  setStackTraceLimit,
69
81
  none,
@@ -89,21 +101,7 @@ import {
89
101
  contextWith,
90
102
  provide3,
91
103
  fnUntraced
92
- } from "./main-wpt5ha44.mjs";
93
- import {
94
- pipeArguments,
95
- identity,
96
- constTrue,
97
- constFalse,
98
- constUndefined,
99
- isString,
100
- isNumber,
101
- isBoolean,
102
- hasProperty
103
- } from "./main-qazf3bhk.mjs";
104
- import {
105
- cliCommand
106
- } from "./main-awaqqre9.mjs";
104
+ } from "./main-m45zegrn.mjs";
107
105
 
108
106
  // node_modules/effect/dist/PrimaryKey.js
109
107
  var symbol = "~effect/PrimaryKey";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isNodeError,
3
3
  writeJsonFileAtomically
4
- } from "./main-4h7rfhhr.mjs";
4
+ } from "./main-bt237ys7.mjs";
5
5
  import {
6
6
  decodeUnknownEffect2,
7
7
  decodeUnknownSync,
@@ -15,8 +15,12 @@ import {
15
15
  isPattern,
16
16
  Defect,
17
17
  TaggedError2
18
- } from "./main-f98q5tcf.mjs";
18
+ } from "./main-6hvv25x8.mjs";
19
19
  import {
20
+ isString,
21
+ isNumber,
22
+ isBoolean,
23
+ isObject,
20
24
  withFiber,
21
25
  getCurrentFiber,
22
26
  succeed2,
@@ -42,17 +46,11 @@ import {
42
46
  acquireUseRelease,
43
47
  fnUntraced,
44
48
  fn
45
- } from "./main-wpt5ha44.mjs";
46
- import {
47
- isString,
48
- isNumber,
49
- isBoolean,
50
- isObject
51
- } from "./main-qazf3bhk.mjs";
49
+ } from "./main-m45zegrn.mjs";
52
50
  import {
53
51
  dataRoot,
54
52
  cliCommand
55
- } from "./main-awaqqre9.mjs";
53
+ } from "./main-rb7dermc.mjs";
56
54
 
57
55
  // node_modules/effect/dist/Semaphore.js
58
56
  var makeUnsafe = (permits) => new SemaphoreImpl(permits);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  opencodeBrowserVersion2
3
- } from "./main-amkq7v9m.mjs";
3
+ } from "./main-d5ke1bpm.mjs";
4
4
  import {
5
5
  configRoot2,
6
6
  dataRoot,
@@ -18,19 +18,20 @@ import {
18
18
  devExtension,
19
19
  devExtensionFolder,
20
20
  storeUrl,
21
+ unpackedExtensionId,
21
22
  npmGlobalRoot,
22
23
  installedVersion,
23
24
  runCommand
24
- } from "./main-awaqqre9.mjs";
25
+ } from "./main-rb7dermc.mjs";
25
26
  import {
26
27
  writeStdout
27
28
  } from "./main-tk4axre7.mjs";
28
29
  import {
29
- formatPairingCode
30
- } from "./main-fpn564ph.mjs";
30
+ defaultPort2
31
+ } from "./main-bt237ys7.mjs";
31
32
  import {
32
- unpackedExtensionId
33
- } from "./main-gg7f12gg.mjs";
33
+ formatPairingCode
34
+ } from "./main-pq962g72.mjs";
34
35
  import {
35
36
  __toESM,
36
37
  __commonJS,
@@ -10722,7 +10723,7 @@ var dev = fromSource ? undefined : devExtension();
10722
10723
  var unpackedFolder = () => checkoutExtensionDirs[1] ?? (dev ? devExtensionFolder(paths.cache) : undefined);
10723
10724
  var connectedMessage = "✓ Connected to your browser. Ask your agent to open a page.";
10724
10725
  var pairedOfflineMessage = "! Not connected yet. Open the browser profile already paired with browse and make sure the extension is enabled. It reconnects automatically.";
10725
- var manualPair = (code) => `Open the Extensions menu → browse → Options, expand advanced (or click Pair with a code), enter ${formatPairingCode(code)} as the pairing code, then click Connect.`;
10726
+ var manualPair = (code, port = defaultPort2, address) => `Open the Extensions menu → browse → Options, expand advanced (or click Pair with a code), enter ${formatPairingCode(code)} as the pairing code${address ? ` and ${address} as the relay address` : port === defaultPort2 ? "" : ` and localhost:${port} as the relay address`}, then click Connect.`;
10726
10727
  function flag(args, name) {
10727
10728
  const index = args.indexOf(name);
10728
10729
  return index === -1 ? undefined : args[index + 1];
@@ -1,4 +1,4 @@
1
- import"./main-3mhynene.mjs";
1
+ import"./main-9frwnsnf.mjs";
2
2
  import {
3
3
  filter,
4
4
  empty,
@@ -42,19 +42,16 @@ import {
42
42
  empty3,
43
43
  jsonUnsafe,
44
44
  layer
45
- } from "./main-s3g4jwx5.mjs";
45
+ } from "./main-jeta10c6.mjs";
46
46
  import"./main-pmfd055v.mjs";
47
47
  import {
48
48
  opencodeBrowserVersion2
49
- } from "./main-amkq7v9m.mjs";
49
+ } from "./main-d5ke1bpm.mjs";
50
50
  import {
51
51
  cliCommand,
52
52
  autoUpdateStatus
53
- } from "./main-awaqqre9.mjs";
54
- import"./main-gg7f12gg.mjs";
53
+ } from "./main-rb7dermc.mjs";
55
54
  import {
56
- option,
57
- String2,
58
55
  SessionContainer,
59
56
  SessionsContainer,
60
57
  SessionResetResponse,
@@ -63,19 +60,22 @@ import {
63
60
  NetworkStopResponse,
64
61
  AuthRunResponse,
65
62
  TabsCleanupResponse,
66
- getObject2,
63
+ getObject2
64
+ } from "./main-bt237ys7.mjs";
65
+ import {
66
+ option,
67
+ String2,
67
68
  RelayRejected,
68
69
  Service,
69
70
  layerFetchMcp,
70
71
  relayBuildProblem,
71
72
  ensureRelay,
72
73
  ensureExtensionConnected
73
- } from "./main-46wtkfsd.mjs";
74
- import"./main-4h7rfhhr.mjs";
74
+ } from "./main-reh7k0hv.mjs";
75
75
  import {
76
76
  updateJson2,
77
77
  createUpdateWatcher2
78
- } from "./main-r8g3xydm.mjs";
78
+ } from "./main-qccyxwg8.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-wfmad10p.mjs";
159
+ } from "./main-sfxkq31s.mjs";
160
160
  import {
161
161
  makeUnsafe,
162
162
  make3,
163
163
  listSecrets
164
- } from "./main-q2d5bd1e.mjs";
164
+ } from "./main-tg0r67xj.mjs";
165
165
  import {
166
166
  Clock,
167
167
  type,
@@ -175,8 +175,9 @@ import {
175
175
  boolean,
176
176
  orElse,
177
177
  exhaustive
178
- } from "./main-048kx59h.mjs";
179
- import"./main-jwss6gk9.mjs";
178
+ } from "./main-akpa411k.mjs";
179
+ import"./main-rvn834gn.mjs";
180
+ import"./main-q4typx7c.mjs";
180
181
  import {
181
182
  Class,
182
183
  taggedEnum,
@@ -225,8 +226,21 @@ import {
225
226
  toCodecJson,
226
227
  Json,
227
228
  JsonObject
228
- } from "./main-f98q5tcf.mjs";
229
+ } from "./main-6hvv25x8.mjs";
229
230
  import {
231
+ pipeArguments,
232
+ dual,
233
+ identity,
234
+ constant,
235
+ constTrue,
236
+ constVoid,
237
+ flow,
238
+ isString,
239
+ isNullish,
240
+ isObject,
241
+ isReadonlyObject,
242
+ hasProperty,
243
+ isTagged,
230
244
  hash,
231
245
  equals,
232
246
  redact,
@@ -395,22 +409,7 @@ import {
395
409
  logError,
396
410
  logDebug,
397
411
  annotateLogs
398
- } from "./main-wpt5ha44.mjs";
399
- import {
400
- pipeArguments,
401
- dual,
402
- identity,
403
- constant,
404
- constTrue,
405
- constVoid,
406
- flow,
407
- isString,
408
- isNullish,
409
- isObject,
410
- isReadonlyObject,
411
- hasProperty,
412
- isTagged
413
- } from "./main-qazf3bhk.mjs";
412
+ } from "./main-m45zegrn.mjs";
414
413
 
415
414
  // node_modules/effect/dist/PubSub.js
416
415
  var TypeId = "~effect/PubSub";
@@ -7,14 +7,14 @@ import {
7
7
  editAgentConfig,
8
8
  OPENCODE_CONFIG_NAMES,
9
9
  configureMcp
10
- } from "./main-g1frnq76.mjs";
10
+ } from "./main-tk2thty0.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-amkq7v9m.mjs";
17
+ import"./main-d5ke1bpm.mjs";
18
18
  import {
19
19
  configRoot2,
20
20
  dataRoot,
@@ -23,11 +23,10 @@ import {
23
23
  binRoot,
24
24
  binaryName,
25
25
  devExtensionFolder
26
- } from "./main-awaqqre9.mjs";
26
+ } from "./main-rb7dermc.mjs";
27
27
  import"./main-tk4axre7.mjs";
28
- import"./main-4h7rfhhr.mjs";
29
- import"./main-fpn564ph.mjs";
30
- import"./main-gg7f12gg.mjs";
28
+ import"./main-bt237ys7.mjs";
29
+ import"./main-pq962g72.mjs";
31
30
 
32
31
  // src/setup/migrate.ts
33
32
  import fs from "node:fs";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  opencodeBrowserVersion2,
6
6
  opencodeBrowserBuildId2
7
- } from "./main-amkq7v9m.mjs";
7
+ } from "./main-d5ke1bpm.mjs";
8
8
  import {
9
9
  defaultRoots,
10
10
  configRoot2,
@@ -21,15 +21,6 @@ import {
21
21
  devExtension,
22
22
  storeUrl,
23
23
  installCommand,
24
- autoUpdateModes,
25
- installedRuntime2,
26
- autoUpdateOverride,
27
- storedMode,
28
- setStoredMode,
29
- autoUpdateStatus,
30
- createAutoUpdater
31
- } from "./main-awaqqre9.mjs";
32
- import {
33
24
  extensionProtocolVersion,
34
25
  minExtensionProtocolVersion,
35
26
  browserUnresponsive,
@@ -42,22 +33,21 @@ import {
42
33
  isCdpRequest,
43
34
  isExtensionResponse,
44
35
  isExtensionEvent,
45
- isJsonObject
46
- } from "./main-gg7f12gg.mjs";
36
+ isJsonObject,
37
+ autoUpdateModes,
38
+ installedRuntime2,
39
+ autoUpdateOverride,
40
+ storedMode,
41
+ setStoredMode,
42
+ autoUpdateStatus,
43
+ createAutoUpdater
44
+ } from "./main-rb7dermc.mjs";
47
45
  import {
48
46
  isNodeError,
49
47
  isUnsupportedDirectorySyncError,
50
48
  writeJsonFileAtomically,
51
49
  ensurePrivateDirectorySync,
52
- writePrivateJsonFileSync
53
- } from "./main-4h7rfhhr.mjs";
54
- import {
55
- map,
56
- withDefault,
57
- option,
58
- String2,
59
- Int,
60
- Boolean2,
50
+ writePrivateJsonFileSync,
61
51
  ExecuteRequest,
62
52
  SessionAdoptRequest,
63
53
  SessionNewRequest,
@@ -89,7 +79,6 @@ import {
89
79
  validateHostHeader2,
90
80
  validateBrowserFetchSite2,
91
81
  validateWebSocketOrigin2,
92
- defaultPort2,
93
82
  optionalSessionId2,
94
83
  isValidSessionId2,
95
84
  requiredSessionId2,
@@ -105,10 +94,8 @@ import {
105
94
  getTargetInfo2,
106
95
  isRestrictedTarget2,
107
96
  isRestrictedUrl2,
108
- dataUrlDocument2,
109
- appendManagedRelayProcessLog,
110
- relayLog
111
- } from "./main-46wtkfsd.mjs";
97
+ dataUrlDocument2
98
+ } from "./main-bt237ys7.mjs";
112
99
  import {
113
100
  context,
114
101
  pendingPairingCodeKeys,
@@ -126,7 +113,7 @@ import {
126
113
  pairingSessionKey,
127
114
  sessionProof,
128
115
  wrapToken
129
- } from "./main-fpn564ph.mjs";
116
+ } from "./main-pq962g72.mjs";
130
117
  import {
131
118
  makeUnsafe,
132
119
  terminateChildProcess,
@@ -149,16 +136,16 @@ import {
149
136
  checkNavigationUrl,
150
137
  readSecret,
151
138
  secretText
152
- } from "./main-q2d5bd1e.mjs";
139
+ } from "./main-tg0r67xj.mjs";
153
140
  import {
154
141
  defaultJournalBaseDir,
155
142
  makeJournalEntry,
156
143
  appendJournalEntry,
157
144
  startJournalRetention
158
- } from "./main-v2a390e1.mjs";
145
+ } from "./main-6qfvnjxc.mjs";
159
146
  import {
160
147
  createUpdateWatcher2
161
- } from "./main-r8g3xydm.mjs";
148
+ } from "./main-qccyxwg8.mjs";
162
149
  import {
163
150
  SettingsInputError,
164
151
  parseSettingChanges,
@@ -166,31 +153,49 @@ import {
166
153
  settingsToExtension,
167
154
  describeSettings,
168
155
  describeChanges
169
- } from "./main-wfmad10p.mjs";
156
+ } from "./main-sfxkq31s.mjs";
170
157
  import {
171
158
  relayHostname,
172
159
  isLocalPeer,
173
160
  installedDevExtension,
174
161
  syncDevExtension
175
- } from "./main-44rp8pxg.mjs";
162
+ } from "./main-32bwyqja.mjs";
176
163
  import {
177
164
  currentTimeMillis,
178
165
  value,
179
166
  when,
180
167
  orElse,
181
168
  exhaustive
182
- } from "./main-048kx59h.mjs";
169
+ } from "./main-akpa411k.mjs";
170
+ import {
171
+ map,
172
+ withDefault,
173
+ option,
174
+ String2,
175
+ Int,
176
+ Boolean2,
177
+ appendManagedRelayProcessLog,
178
+ relayLog
179
+ } from "./main-reh7k0hv.mjs";
183
180
  import {
184
181
  relayTokenQueryParam,
185
182
  relayToken,
186
183
  secretsEqual,
187
184
  ensurePrivateDirectory
188
- } from "./main-jwss6gk9.mjs";
185
+ } from "./main-rvn834gn.mjs";
189
186
  import {
190
187
  join,
191
188
  interrupt,
192
189
  makeUnsafe2
193
- } from "./main-s3g4jwx5.mjs";
190
+ } from "./main-jeta10c6.mjs";
191
+ import {
192
+ configuredRelayPort,
193
+ relayPortPinned,
194
+ writeLastRelayPort,
195
+ writeRelayState,
196
+ removeRelayState,
197
+ chooseRelayPort
198
+ } from "./main-q4typx7c.mjs";
194
199
  import {
195
200
  taggedEnum,
196
201
  is2,
@@ -211,8 +216,16 @@ import {
211
216
  Int2,
212
217
  Defect,
213
218
  TaggedError2
214
- } from "./main-f98q5tcf.mjs";
219
+ } from "./main-6hvv25x8.mjs";
215
220
  import {
221
+ isString,
222
+ isNumber,
223
+ isBoolean,
224
+ isBigInt,
225
+ isSymbol,
226
+ isFunction,
227
+ isObjectOrArray,
228
+ isObject,
216
229
  isNone,
217
230
  isSome,
218
231
  getOrElse,
@@ -290,17 +303,7 @@ import {
290
303
  runSync,
291
304
  fnUntraced,
292
305
  fn
293
- } from "./main-wpt5ha44.mjs";
294
- import {
295
- isString,
296
- isNumber,
297
- isBoolean,
298
- isBigInt,
299
- isSymbol,
300
- isFunction,
301
- isObjectOrArray,
302
- isObject
303
- } from "./main-qazf3bhk.mjs";
306
+ } from "./main-m45zegrn.mjs";
304
307
 
305
308
  // src/relay.ts
306
309
  import crypto10 from "node:crypto";
@@ -19413,14 +19416,24 @@ var startRelay = fn("Relay.start")(function* (options = {}) {
19413
19416
  var makeRelay = fnUntraced(function* (options = {}) {
19414
19417
  const listenHost = relayHostname();
19415
19418
  const host = "127.0.0.1";
19416
- const port = options.port ?? defaultPort2;
19419
+ const configuredPort = options.port ?? configuredRelayPort();
19420
+ const port = yield* tryPromise({
19421
+ try: () => chooseRelayPort({
19422
+ configuredPort,
19423
+ pinned: options.port !== undefined || relayPortPinned(),
19424
+ host: listenHost,
19425
+ ...options.portCandidates ? { candidates: options.portCandidates } : {}
19426
+ }),
19427
+ catch: (cause) => cause instanceof Error ? cause : new Error("Choose the relay port", { cause })
19428
+ });
19417
19429
  const releaseTargetGraceMs = Math.max(0, options.releaseTargetGraceMs ?? 1e4);
19418
19430
  const browserId = crypto10.randomUUID();
19431
+ const startedAt = new Date().toISOString();
19419
19432
  const endpointUrl = `http://${formatHostForUrl2(host)}:${port}`;
19420
19433
  const additionalChromeExtensionOrigins = new Set(options.additionalExtensionOrigins ?? []);
19421
19434
  const storeId = storeConfig().id ?? PUBLIC_STORE_ID;
19422
19435
  additionalChromeExtensionOrigins.add(`chrome-extension://${storeId}`);
19423
- const sessionCatalog = options.sessionCatalogPath === null ? undefined : new SessionCatalog(options.sessionCatalogPath ?? defaultSessionCatalogPath(port));
19436
+ const sessionCatalog = options.sessionCatalogPath === null ? undefined : new SessionCatalog(options.sessionCatalogPath ?? defaultSessionCatalogPath(configuredPort));
19424
19437
  let catalogWritesEnabled = false;
19425
19438
  const registry = new TargetRegistry;
19426
19439
  const authToken = yield* try_2({
@@ -19719,7 +19732,7 @@ var makeRelay = fnUntraced(function* (options = {}) {
19719
19732
  const restartTimeoutMs = yield* Int("OPENCODE_BROWSER_RESTART_TIMEOUT_MS").pipe(withDefault(1e4));
19720
19733
  const clientGoneGraceMs = yield* Int("OPENCODE_BROWSER_CLIENT_GONE_GRACE_MS").pipe(withDefault(60000));
19721
19734
  const restartRequestId = yield* option(String2("OPENCODE_BROWSER_RESTART_REQUEST_ID"));
19722
- const lifecycleLogPath = path14.join(stateRoot(), "relays", String(port), "lifecycle.jsonl");
19735
+ const lifecycleLogPath = path14.join(stateRoot(), "relays", String(configuredPort), "lifecycle.jsonl");
19723
19736
  const audit = (event) => try_2(() => appendRelayLifecycleEvent(lifecycleLogPath, event));
19724
19737
  function setProtectedUi(tabId, protectedUi) {
19725
19738
  const changed = registry.markRootTargetProtectedUi(tabId, protectedUi);
@@ -19976,7 +19989,7 @@ var makeRelay = fnUntraced(function* (options = {}) {
19976
19989
  port,
19977
19990
  browserId,
19978
19991
  authToken,
19979
- relayInstance: { id: browserId, startedAt: new Date().toISOString(), pid: process.pid, managed },
19992
+ relayInstance: { id: browserId, startedAt, pid: process.pid, managed },
19980
19993
  shutdown: shutdownControl,
19981
19994
  registry,
19982
19995
  recordingRelay,
@@ -20033,16 +20046,30 @@ var makeRelay = fnUntraced(function* (options = {}) {
20033
20046
  for (const link of browsers.list())
20034
20047
  link.rpc.close();
20035
20048
  yield* closeWebSocketServer2(websocketServer).pipe(logCloseError2("Failed to close websocket server"));
20036
- yield* closeHttpServer2(httpServer).pipe(logCloseError2("Failed to close http server"));
20049
+ yield* closeHttpServer2(httpServer).pipe(logCloseError2("Failed to close http server"), ensuring(sync2(() => removeRelayState(browserId, stateRoot(), configuredPort))));
20037
20050
  });
20038
20051
  const close = cleanup();
20039
- yield* catch_(listenHttpServer2({ server: httpServer, host: listenHost, port }), (error) => {
20040
- return gen(function* () {
20041
- yield* cleanup();
20042
- return yield* fail6(error);
20043
- });
20044
- });
20045
- yield* sync2(() => pruneStaleExecuteFilesDirectories());
20052
+ yield* catch_(gen(function* () {
20053
+ yield* listenHttpServer2({ server: httpServer, host: listenHost, port });
20054
+ yield* try_2({
20055
+ try: () => writeRelayState({ port, configuredPort, pid: process.pid, instanceId: browserId, startedAt }),
20056
+ catch: (cause) => new Error("Write the relay port file", { cause })
20057
+ }).pipe(catch_((error) => {
20058
+ relayLog("relay.state.write_failed", { port, configuredPort, error: error.message });
20059
+ return port === configuredPort ? void_3 : fail6(error);
20060
+ }));
20061
+ yield* try_2({
20062
+ try: () => writeLastRelayPort(port, stateRoot(), configuredPort),
20063
+ catch: (cause) => new Error("Write the last relay port", { cause })
20064
+ }).pipe(catch_((error) => {
20065
+ relayLog("relay.last_port.write_failed", { port, configuredPort, error: error.message });
20066
+ return void_3;
20067
+ }));
20068
+ yield* sync2(() => pruneStaleExecuteFilesDirectories());
20069
+ }), (error) => gen(function* () {
20070
+ yield* cleanup();
20071
+ return yield* fail6(error);
20072
+ }));
20046
20073
  yield* catch_(gen(function* () {
20047
20074
  const restoredSessions = yield* tryPromise({
20048
20075
  try: async () => {
@@ -20086,7 +20113,7 @@ var makeRelay = fnUntraced(function* (options = {}) {
20086
20113
  }
20087
20114
  const dev = devExtension();
20088
20115
  if (dev && installedDevExtension()) {
20089
- syncDevExtension(dev).then((result) => {
20116
+ syncDevExtension(dev, { port }).then((result) => {
20090
20117
  if (result === "updated")
20091
20118
  relayLog("extension.dev_updated", { file: dev.file });
20092
20119
  for (const link of browsers.list())
@@ -1,6 +1,6 @@
1
- import"./main-3mhynene.mjs";
1
+ import"./main-9frwnsnf.mjs";
2
2
  import"./main-pmfd055v.mjs";
3
- import"./main-amkq7v9m.mjs";
3
+ import"./main-d5ke1bpm.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-awaqqre9.mjs";
22
- import"./main-gg7f12gg.mjs";
21
+ } from "./main-rb7dermc.mjs";
22
+ import"./main-bt237ys7.mjs";
23
+ import"./main-jeta10c6.mjs";
23
24
  import {
24
25
  Service,
25
26
  layerFetch,
26
27
  restartRelay,
27
28
  startManagedRelay
28
- } from "./main-46wtkfsd.mjs";
29
- import"./main-4h7rfhhr.mjs";
30
- import"./main-s3g4jwx5.mjs";
31
- import"./main-jwss6gk9.mjs";
29
+ } from "./main-reh7k0hv.mjs";
30
+ import"./main-rvn834gn.mjs";
31
+ import"./main-q4typx7c.mjs";
32
32
  import {
33
33
  succeed6,
34
34
  gen,
@@ -36,7 +36,7 @@ import {
36
36
  catch_,
37
37
  provide3,
38
38
  runPromise
39
- } from "./main-wpt5ha44.mjs";
39
+ } from "./main-m45zegrn.mjs";
40
40
 
41
41
  // src/update/runtime-update.ts
42
42
  var log = (line) => process.stdout.write(line + `