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

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 (38) hide show
  1. package/dist/{Runtime-hmy7zww1.mjs → Runtime-tvxdkp60.mjs} +1 -1
  2. package/dist/{cli-5ezftnv2.mjs → cli-29hdwt7a.mjs} +58 -640
  3. package/dist/cli.mjs +18 -13
  4. package/dist/{helpers-k5ybc61c.mjs → helpers-00s350tq.mjs} +1 -1
  5. package/dist/{index-37ssbv86.mjs → index-kmxtpxxk.mjs} +2 -2
  6. package/dist/{legacy-runtime-j0sw664c.mjs → legacy-runtime-egp6zww2.mjs} +7 -7
  7. package/dist/{main-7h3v45ag.mjs → main-00ka28er.mjs} +5 -5
  8. package/dist/{main-pqxrvknr.mjs → main-0mv7rpmv.mjs} +2 -2
  9. package/dist/{main-svhdexdh.mjs → main-1h2rczbb.mjs} +3 -3
  10. package/dist/{main-d8km89cz.mjs → main-2jd6x6jq.mjs} +2 -2
  11. package/dist/{main-66fy08h5.mjs → main-7wq2brry.mjs} +58 -62
  12. package/dist/{main-7v4scg8t.mjs → main-ckyb9v7n.mjs} +3 -3
  13. package/dist/{main-0h387a1q.mjs → main-d1th6z2h.mjs} +3 -3
  14. package/dist/{main-m9n50a86.mjs → main-dvy4da2g.mjs} +2 -7
  15. package/dist/main-e575zjpk.mjs +4 -0
  16. package/dist/{main-kzcrfvmh.mjs → main-e5r3f1g8.mjs} +4 -4
  17. package/dist/{main-ba028a85.mjs → main-f1jjkpm9.mjs} +10 -17
  18. package/dist/{main-mvjg1jye.mjs → main-g82bc5x3.mjs} +37 -94
  19. package/dist/main-gexpjhk5.mjs +32 -0
  20. package/dist/{main-3514h33n.mjs → main-hh16893t.mjs} +3 -3
  21. package/dist/{main-9q9919e3.mjs → main-jtgan144.mjs} +3 -3
  22. package/dist/{main-tryp3jph.mjs → main-kd8f1nq2.mjs} +3 -4
  23. package/dist/{main-4qq4n32k.mjs → main-ky3vj3mx.mjs} +2 -2
  24. package/dist/{main-dab23et4.mjs → main-v1r263fc.mjs} +1 -1
  25. package/dist/{main-8xd753k5.mjs → main-z4c819pg.mjs} +4 -37
  26. package/dist/{main-j4kq90pw.mjs → main-zrjcdksk.mjs} +1 -1
  27. package/dist/{mcp-jh4atts2.mjs → mcp-rzn35bxy.mjs} +132 -293
  28. package/dist/{migrate-r433scvg.mjs → migrate-hz3a51xg.mjs} +7 -7
  29. package/dist/{relay-1epy67be.mjs → relay-n5jwr402.mjs} +2082 -4323
  30. package/dist/{remove-stored-secrets-wy3pakjj.mjs → remove-stored-secrets-r8dk5eqc.mjs} +1 -1
  31. package/dist/{runtime-update-ww2pejn2.mjs → runtime-update-avxgfgwm.mjs} +10 -10
  32. package/dist/{setup-n1hpbkz2.mjs → setup-cnp75dsm.mjs} +10 -10
  33. package/dist/{update-z7qvagkc.mjs → update-bmgjhjd0.mjs} +3 -3
  34. package/dist/{version-2123c138.mjs → version-74q9xrcd.mjs} +1 -1
  35. package/package.json +2 -3
  36. package/dist/main-qrqem3fy.mjs +0 -4
  37. package/dist/skill-text-0ndr12dz.mjs +0 -492
  38. package/skills/browse/SKILL.md +0 -484
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  errorExitCode2,
4
4
  errorReported2
5
- } from "./main-j4kq90pw.mjs";
5
+ } from "./main-zrjcdksk.mjs";
6
6
  import {
7
7
  make4,
8
8
  value2,
@@ -14,7 +14,7 @@ import {
14
14
  Terminal,
15
15
  runMain,
16
16
  layer2
17
- } from "./main-3514h33n.mjs";
17
+ } from "./main-hh16893t.mjs";
18
18
  import {
19
19
  ExitCode,
20
20
  failure,
@@ -23,18 +23,16 @@ import {
23
23
  } from "./main-tk4axre7.mjs";
24
24
  import"./main-pmfd055v.mjs";
25
25
  import {
26
- opencodeBrowserVersion2,
27
- opencodeBrowserBuildId2
28
- } from "./main-qrqem3fy.mjs";
26
+ opencodeBrowserVersion2
27
+ } from "./main-e575zjpk.mjs";
29
28
  import {
30
- extensionProtocolVersion,
31
29
  extensionProtocolAdvice,
32
30
  autoUpdateStatus
33
- } from "./main-m9n50a86.mjs";
31
+ } from "./main-dvy4da2g.mjs";
34
32
  import {
35
33
  defaultPort2,
36
34
  isValidSessionId2
37
- } from "./main-mvjg1jye.mjs";
35
+ } from "./main-g82bc5x3.mjs";
38
36
  import {
39
37
  option,
40
38
  String2,
@@ -53,38 +51,31 @@ import {
53
51
  ensureExtensionConnected,
54
52
  stoppedRelayStatus,
55
53
  statusCollections
56
- } from "./main-ba028a85.mjs";
54
+ } from "./main-f1jjkpm9.mjs";
57
55
  import {
58
56
  updateJson2,
59
57
  formatUpdateNotice2,
60
58
  updateNotice2
61
- } from "./main-7v4scg8t.mjs";
59
+ } from "./main-ckyb9v7n.mjs";
62
60
  import {
63
61
  settingKeys,
64
62
  formatSettings,
65
63
  ensureSessionExists
66
- } from "./main-66fy08h5.mjs";
64
+ } from "./main-7wq2brry.mjs";
67
65
  import {
68
66
  defaultJournalBaseDir,
69
67
  readJournalEntries,
70
68
  formatJournalEntry
71
- } from "./main-kzcrfvmh.mjs";
72
- import"./main-pqxrvknr.mjs";
69
+ } from "./main-e5r3f1g8.mjs";
70
+ import"./main-0mv7rpmv.mjs";
73
71
  import {
74
72
  endpointForPort
75
- } from "./main-4qq4n32k.mjs";
73
+ } from "./main-ky3vj3mx.mjs";
76
74
  import {
77
- configRoot2,
78
- dataRoot,
79
75
  stateRoot,
80
- cacheRoot,
81
- fromCheckout,
82
- compiledBinary,
83
- binaryPackage,
84
76
  cliCommand,
85
- devExtension,
86
77
  installCommand
87
- } from "./main-tryp3jph.mjs";
78
+ } from "./main-kd8f1nq2.mjs";
88
79
  import {
89
80
  taggedEnum,
90
81
  is2,
@@ -105,7 +96,7 @@ import {
105
96
  Defect,
106
97
  TaggedError2,
107
98
  toCodecStringTree
108
- } from "./main-8xd753k5.mjs";
99
+ } from "./main-z4c819pg.mjs";
109
100
  import {
110
101
  pipeArguments,
111
102
  dual,
@@ -175,7 +166,6 @@ import {
175
166
  catchFilter,
176
167
  mapError2,
177
168
  orDie,
178
- orElseSucceed,
179
169
  raceFirst,
180
170
  match4,
181
171
  provide3,
@@ -186,7 +176,7 @@ import {
186
176
  interrupt3,
187
177
  fnUntraced,
188
178
  fn
189
- } from "./main-0h387a1q.mjs";
179
+ } from "./main-d1th6z2h.mjs";
190
180
 
191
181
  // node_modules/effect/dist/Number.js
192
182
  var Number2 = globalThis.Number;
@@ -2249,14 +2239,6 @@ var variadic = (self, options) => {
2249
2239
  parse
2250
2240
  });
2251
2241
  };
2252
- var atMost = /* @__PURE__ */ dual(2, (self, max) => {
2253
- if (max < 0) {
2254
- throw new Error("atMost: max must be non-negative");
2255
- }
2256
- return variadic(self, {
2257
- max
2258
- });
2259
- });
2260
2242
  var atLeast = /* @__PURE__ */ dual(2, (self, min) => {
2261
2243
  if (min < 0) {
2262
2244
  throw new Error("atLeast: min must be non-negative");
@@ -3324,7 +3306,6 @@ var optional4 = (param) => optional2(param);
3324
3306
  var withDefault2 = withDefault;
3325
3307
  var map5 = /* @__PURE__ */ dual(2, (self, f) => map3(self, f));
3326
3308
  var atLeast2 = /* @__PURE__ */ dual(2, (self, min) => atLeast(self, min));
3327
- var atMost2 = /* @__PURE__ */ dual(2, (self, max) => atMost(self, max));
3328
3309
 
3329
3310
  // node_modules/effect/dist/cli/internal/config.js
3330
3311
  var ConfigInternalTypeId = "~effect/cli/Command/Config/Internal";
@@ -4995,7 +4976,7 @@ var runWith = (command, config) => {
4995
4976
  }, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed(error) : fail2(error), (error) => andThen2(showHelp(command, error, config.renderErrors !== false), fail6(error))), catchFilter((error) => config.renderErrors !== false && isCliError(error) && error._tag === "UserError" ? succeed(error) : fail2(error), (error) => andThen2(showUserError(error), fail6(error))), catchFilter((e) => isQuitError(e) ? succeed(e) : fail2(e), (_) => interrupt3));
4996
4977
  };
4997
4978
  // src/cli.ts
4998
- import path4 from "node:path";
4979
+ import path3 from "node:path";
4999
4980
  import process3 from "node:process";
5000
4981
  import { fileURLToPath, pathToFileURL } from "node:url";
5001
4982
 
@@ -5065,454 +5046,6 @@ var make2 = fn("SessionStore.make")(function* (options) {
5065
5046
  });
5066
5047
  var layer = effect(Service3, make2());
5067
5048
 
5068
- // src/doctor.ts
5069
- var PackageMetadata = Struct({
5070
- name: String3,
5071
- version: String3,
5072
- bin: optionalKey(Record(String3, String3))
5073
- });
5074
- function extensionManifestVersion(version) {
5075
- const match = /^(\d+\.\d+\.\d+)(?:-dev\.(\d+)(?:\.\d+)?)?/.exec(version);
5076
- if (!match)
5077
- return version;
5078
- return match[2] ? `${match[1]}.${match[2]}` : match[1];
5079
- }
5080
- var probe = (effect) => effect.pipe(match4({
5081
- onFailure: (error) => ({ ok: false, error: errorMessage(error) }),
5082
- onSuccess: (value) => ({ ok: true, value })
5083
- }));
5084
- var errorMessage = (error) => {
5085
- if (error instanceof Error) {
5086
- return error.message;
5087
- }
5088
- return String(error);
5089
- };
5090
- var createDoctorReport = fn("Doctor.createReport")(function* (options) {
5091
- const relay = yield* Service;
5092
- const store = yield* Service3;
5093
- const fs = yield* FileSystem;
5094
- const path = yield* Path;
5095
- const readJsonFile = (relativePath, schema) => fs.readFileString(path.join(options.packageRoot, relativePath)).pipe(mapError2((cause) => new Error(`read ${relativePath}: ${cause.reason.message}`)), flatMap3((text) => try_2({
5096
- try: () => JSON.parse(text),
5097
- catch: () => new Error(`parse ${relativePath}: invalid JSON`)
5098
- })), flatMap3((value) => decodeUnknownEffect2(schema)(value).pipe(mapError2((cause) => new Error(`decode ${relativePath}: ${cause.message}`)))));
5099
- const compiled = compiledBinary();
5100
- const readPackageInfo = compiled ? succeed6({ name: binaryPackage() ?? "@opencode/browse", version: opencodeBrowserVersion2, bin: { opencodeBrowser: process.execPath } }) : readJsonFile("package.json", PackageMetadata).pipe(map6((metadata) => ({
5101
- name: metadata.name,
5102
- version: metadata.version,
5103
- bin: {
5104
- opencodeBrowser: metadata.bin?.browse ?? null
5105
- }
5106
- })));
5107
- const fileExists = (relativePath) => fs.exists(path.join(options.packageRoot, relativePath)).pipe(orElseSucceed(() => false));
5108
- const [packageResult, distCliExists, currentResult] = yield* all([
5109
- probe(readPackageInfo),
5110
- fileExists("dist/cli.mjs"),
5111
- probe(store.read)
5112
- ]);
5113
- const expectedExtensionVersion = packageResult.ok ? { ok: true, value: extensionManifestVersion(packageResult.value.version) } : packageResult;
5114
- const relayResult = yield* probe(relay.version);
5115
- const relayBuildMatches = relayResult.ok ? relayResult.value.buildId ? relayBuildProblem(relayResult.value, opencodeBrowserBuildId2) === undefined : null : null;
5116
- const [extensionResult, targetsResult, sessionsResult] = relayResult.ok ? yield* all([
5117
- probe(relay.extensionStatus),
5118
- probe(relay.targets),
5119
- probe(relay.sessions)
5120
- ]) : [
5121
- { ok: false, error: relayResult.error },
5122
- { ok: false, error: relayResult.error },
5123
- { ok: false, error: relayResult.error }
5124
- ];
5125
- const expectedVersion = expectedExtensionVersion.ok ? expectedExtensionVersion.value : null;
5126
- const extensionVersion = extensionResult.ok ? extensionResult.value.version : null;
5127
- const extensionVersionMatches = extensionResult.ok && extensionVersion && expectedVersion ? extensionVersion === expectedVersion : null;
5128
- const current = currentResult.ok ? currentResult.value ?? null : null;
5129
- const targets = targetsResult.ok ? targetsResult.value : [];
5130
- const sessions = sessionsResult.ok ? sessionsResult.value : [];
5131
- const staleCurrent = Boolean(current && sessionsResult.ok && !sessions.some((session) => {
5132
- return session.id === current;
5133
- }));
5134
- const relayOwnedTargets = targets.filter((target) => {
5135
- return target.owner === "relay";
5136
- });
5137
- const unhealthyTargets = targets.filter((target) => {
5138
- return target.crashed === true || target.url.startsWith("chrome-error://");
5139
- });
5140
- const possibleLeakedSessions = sessions.filter((session) => {
5141
- return session.connected && session.id !== current;
5142
- });
5143
- const artifacts = compiled ? [{ path: process.execPath, exists: true, version: opencodeBrowserVersion2 }] : [{ path: "dist/cli.mjs", exists: distCliExists }];
5144
- const checks = buildDoctorChecks({
5145
- packageResult,
5146
- relayResult,
5147
- extensionResult,
5148
- expectedExtensionVersion,
5149
- artifacts,
5150
- currentResult,
5151
- staleCurrent,
5152
- relayOwnedTargets,
5153
- unhealthyTargets,
5154
- possibleLeakedSessions,
5155
- targetsResult,
5156
- sessionsResult,
5157
- update: options.update ?? null
5158
- });
5159
- const report = {
5160
- status: summarizeCheckStatus(checks),
5161
- endpoint: relay.endpoint,
5162
- paths: {
5163
- config: configRoot2(),
5164
- data: dataRoot(),
5165
- state: stateRoot(),
5166
- cache: cacheRoot()
5167
- },
5168
- cli: { version: opencodeBrowserVersion2, buildId: opencodeBrowserBuildId2 },
5169
- package: {
5170
- path: path.join(options.packageRoot, "package.json"),
5171
- name: packageResult.ok ? packageResult.value.name : null,
5172
- version: packageResult.ok ? packageResult.value.version : null,
5173
- bin: {
5174
- opencodeBrowser: packageResult.ok ? Boolean(packageResult.value.bin.opencodeBrowser) : false
5175
- },
5176
- error: packageResult.ok ? null : packageResult.error
5177
- },
5178
- relay: {
5179
- reachable: relayResult.ok,
5180
- version: relayResult.ok ? relayResult.value.version : null,
5181
- buildId: relayResult.ok ? relayResult.value.buildId ?? null : null,
5182
- buildMatches: relayBuildMatches,
5183
- error: relayResult.ok ? null : relayResult.error
5184
- },
5185
- extension: {
5186
- connected: extensionResult.ok ? extensionResult.value.connected : null,
5187
- unresponsive: extensionResult.ok ? extensionResult.value.browsers?.some((browser) => browser.unresponsive) ?? false : null,
5188
- version: extensionVersion,
5189
- expectedVersion,
5190
- versionMatches: extensionVersionMatches,
5191
- protocolVersion: extensionResult.ok ? extensionResult.value.protocolVersion ?? null : null,
5192
- expectedProtocolVersion: extensionProtocolVersion,
5193
- protocolCompatible: extensionResult.ok ? extensionResult.value.protocolCompatible ?? null : null,
5194
- protocolLegacy: extensionResult.ok ? extensionResult.value.protocolLegacy ?? null : null,
5195
- rejectedConnections: extensionResult.ok ? extensionResult.value.rejectedConnections ?? null : null,
5196
- error: extensionResult.ok ? null : extensionResult.error
5197
- },
5198
- targets: {
5199
- active: extensionResult.ok ? extensionResult.value.activeTargets : null,
5200
- child: extensionResult.ok ? extensionResult.value.childTargets ?? null : null,
5201
- relayOwned: relayOwnedTargets,
5202
- unhealthy: unhealthyTargets,
5203
- all: targets,
5204
- error: targetsResult.ok ? null : targetsResult.error
5205
- },
5206
- sessions: {
5207
- current,
5208
- staleCurrent,
5209
- possibleLeaked: possibleLeakedSessions,
5210
- all: sessions,
5211
- error: sessionsResult.ok ? currentResult.ok ? null : currentResult.error : sessionsResult.error
5212
- },
5213
- artifacts,
5214
- update: options.update ?? null,
5215
- checks,
5216
- recommendations: buildDoctorRecommendations({
5217
- update: options.update ?? null,
5218
- relayResult,
5219
- extensionResult,
5220
- artifacts,
5221
- staleCurrent,
5222
- current,
5223
- unhealthyTargets
5224
- })
5225
- };
5226
- return report;
5227
- });
5228
- function buildDoctorChecks(options) {
5229
- const packageBinChecks = options.packageResult.ok ? [
5230
- {
5231
- id: "bin-opencode-browser",
5232
- label: "browse bin",
5233
- status: options.packageResult.value.bin.opencodeBrowser ? "ok" : "fail",
5234
- message: options.packageResult.value.bin.opencodeBrowser ?? "missing from package.json bin"
5235
- }
5236
- ] : [];
5237
- const artifactChecks = options.artifacts.map((artifact) => {
5238
- return {
5239
- id: `artifact-${artifact.path}`,
5240
- label: artifact.path,
5241
- status: artifact.exists ? "ok" : "warn",
5242
- message: artifact.exists ? artifact.version ? `exists (${artifact.version})` : "exists" : "missing"
5243
- };
5244
- });
5245
- return [
5246
- {
5247
- id: "package-metadata",
5248
- label: "package metadata",
5249
- status: options.packageResult.ok ? "ok" : "fail",
5250
- message: options.packageResult.ok ? `${options.packageResult.value.name} ${options.packageResult.value.version}` : options.packageResult.error
5251
- },
5252
- ...packageBinChecks,
5253
- {
5254
- id: "relay-http",
5255
- label: "relay HTTP endpoint",
5256
- status: options.relayResult.ok ? "ok" : "fail",
5257
- message: options.relayResult.ok ? `reachable (${options.relayResult.value.version})` : options.relayResult.error
5258
- },
5259
- relayBuildCheck({ relayResult: options.relayResult, cliBuildId: opencodeBrowserBuildId2 }),
5260
- extensionConnectedCheck(options.extensionResult),
5261
- extensionVersionCheck({
5262
- extensionResult: options.extensionResult,
5263
- expectedExtensionVersion: options.expectedExtensionVersion
5264
- }),
5265
- extensionProtocolCheck(options.extensionResult),
5266
- ...options.extensionResult.ok && options.extensionResult.value.rejectedConnections !== undefined ? [{
5267
- id: "extension-connection-conflicts",
5268
- label: "competing browser connections",
5269
- status: options.extensionResult.value.rejectedConnections > 0 ? "warn" : "ok",
5270
- message: options.extensionResult.value.rejectedConnections > 0 ? `${options.extensionResult.value.rejectedConnections} connection attempt(s) rejected; the active browser connection was preserved` : "none observed on this connection"
5271
- }] : [],
5272
- ...options.extensionResult.ok && options.extensionResult.value.pairingState ? [{
5273
- id: "extension-pairing",
5274
- label: "extension pairing",
5275
- status: options.extensionResult.value.connected ? "ok" : "warn",
5276
- message: options.extensionResult.value.pairingState
5277
- }] : options.extensionResult.ok && options.extensionResult.value.pairingFailures !== undefined ? [{
5278
- id: "extension-pairing",
5279
- label: "extension pairing",
5280
- status: options.extensionResult.value.pairingFailures > 0 && !options.extensionResult.value.connected ? "warn" : "ok",
5281
- message: options.extensionResult.value.pairingFailures > 0 ? `${options.extensionResult.value.pairingFailures} connection(s) failed pairing${options.extensionResult.value.connected ? "; a paired extension is connected" : `; update the extension, or run \`${cliCommand("pair")}\` and enter the code on its status page`}` : "no failed pairing attempts"
5282
- }] : [],
5283
- ...options.extensionResult.ok && options.extensionResult.value.processFaults !== undefined ? [{
5284
- id: "relay-process-faults",
5285
- label: "relay process faults",
5286
- status: options.extensionResult.value.processFaults.suppressed > 0 ? "warn" : "ok",
5287
- message: options.extensionResult.value.processFaults.suppressed > 0 ? `${options.extensionResult.value.processFaults.suppressed} uncaught fault(s) caught and survived${options.extensionResult.value.processFaults.lastMessage ? `; last: ${options.extensionResult.value.processFaults.lastMessage}` : ""}` : "none since the relay started"
5288
- }] : [],
5289
- {
5290
- id: "targets-readable",
5291
- label: "targets readable",
5292
- status: options.targetsResult.ok ? "ok" : "fail",
5293
- message: options.targetsResult.ok ? `${options.targetsResult.value.length} active root target(s)` : options.targetsResult.error
5294
- },
5295
- unhealthyTargetsCheck({
5296
- targetsResult: options.targetsResult,
5297
- unhealthyTargets: options.unhealthyTargets
5298
- }),
5299
- {
5300
- id: "sessions-readable",
5301
- label: "sessions readable",
5302
- status: options.sessionsResult.ok ? "ok" : "fail",
5303
- message: options.sessionsResult.ok ? `${options.sessionsResult.value.length} session(s)` : options.sessionsResult.error
5304
- },
5305
- {
5306
- id: "current-session-file",
5307
- label: "current session file",
5308
- status: options.currentResult.ok ? "ok" : "warn",
5309
- message: options.currentResult.ok ? options.currentResult.value ?? "none" : options.currentResult.error
5310
- },
5311
- {
5312
- id: "current-session-stale",
5313
- label: "current session membership",
5314
- status: options.staleCurrent ? "warn" : "ok",
5315
- message: options.staleCurrent ? "current session is not present in relay sessions" : "current session is valid or unset"
5316
- },
5317
- {
5318
- id: "relay-owned-targets",
5319
- label: "relay-owned active targets",
5320
- status: "ok",
5321
- message: options.relayOwnedTargets.length ? `${options.relayOwnedTargets.length} persistent relay-owned target(s)` : "none"
5322
- },
5323
- {
5324
- id: "possible-leaked-sessions",
5325
- label: "connected non-current sessions",
5326
- status: "ok",
5327
- message: options.possibleLeakedSessions.length ? `${options.possibleLeakedSessions.length} connected non-current session(s)` : "none"
5328
- },
5329
- ...artifactChecks,
5330
- ...options.update ? [{
5331
- id: "update",
5332
- label: "update",
5333
- status: "ok",
5334
- message: `available: ${options.update.summary}`
5335
- }] : []
5336
- ];
5337
- }
5338
- var makeDoctorCheck = (id, label) => (status, message) => ({
5339
- id,
5340
- label,
5341
- status,
5342
- message
5343
- });
5344
- function unhealthyTargetsCheck(options) {
5345
- const check = makeDoctorCheck("unhealthy-targets", "crashed or browser-error targets");
5346
- if (!options.targetsResult.ok) {
5347
- return check("warn", `target health unknown: ${options.targetsResult.error}`);
5348
- }
5349
- return check(options.unhealthyTargets.length ? "warn" : "ok", options.unhealthyTargets.length ? `${options.unhealthyTargets.length} unhealthy target(s)` : "none");
5350
- }
5351
- function relayBuildCheck(options) {
5352
- const check = makeDoctorCheck("relay-build", "relay build");
5353
- if (!options.relayResult.ok) {
5354
- return check("warn", "relay unreachable; cannot compare builds");
5355
- }
5356
- const relayBuildId = options.relayResult.value.buildId;
5357
- if (!relayBuildId) {
5358
- return check("warn", "running relay does not report a build id");
5359
- }
5360
- const matches = relayBuildId === options.cliBuildId;
5361
- return check(matches ? "ok" : "warn", matches ? `matches CLI build (${options.cliBuildId})` : `runtime ${relayBuildId} does not match CLI ${options.cliBuildId}`);
5362
- }
5363
- function extensionConnectedCheck(extensionResult) {
5364
- const check = makeDoctorCheck("extension-connected", "extension connection");
5365
- if (!extensionResult.ok) {
5366
- return check("fail", extensionResult.error);
5367
- }
5368
- const status = extensionResult.value;
5369
- const unresponsive = (status.browsers ?? []).filter((browser) => browser.unresponsive);
5370
- if (status.connected) {
5371
- const connected = `connected${status.version ? ` (${status.version})` : ""}`;
5372
- const others = unresponsive.map((browser) => `${browser.id} isn't answering (busy or asleep)`).join(", ");
5373
- return others ? check("warn", `${connected}; ${others}`) : check("ok", connected);
5374
- }
5375
- if (unresponsive.length > 0) {
5376
- return check("warn", "connected but not answering (busy or asleep)");
5377
- }
5378
- return check("fail", "disconnected");
5379
- }
5380
- function extensionVersionCheck(options) {
5381
- const check = makeDoctorCheck("extension-version", "extension version");
5382
- if (!options.extensionResult.ok) {
5383
- return check("warn", options.extensionResult.error);
5384
- }
5385
- if (!options.extensionResult.value.connected) {
5386
- return check("warn", "extension disconnected; cannot compare runtime version");
5387
- }
5388
- if (!options.expectedExtensionVersion.ok) {
5389
- return check("warn", `could not read this CLI's version: ${options.expectedExtensionVersion.error}`);
5390
- }
5391
- const runtimeVersion = options.extensionResult.value.version;
5392
- if (!runtimeVersion) {
5393
- return check("warn", "extension did not report a version");
5394
- }
5395
- return check("ok", runtimeVersion === options.expectedExtensionVersion.value ? `matches this CLI (${options.expectedExtensionVersion.value})` : `extension ${runtimeVersion} differs from this CLI's ${options.expectedExtensionVersion.value}; protocol compatibility determines support`);
5396
- }
5397
- function extensionProtocolCheck(extensionResult) {
5398
- const check = makeDoctorCheck("extension-protocol", "extension protocol");
5399
- if (!extensionResult.ok) {
5400
- return check("warn", extensionResult.error);
5401
- }
5402
- const protocolVersion = extensionResult.value.protocolVersion;
5403
- const protocolCompatible = extensionResult.value.protocolCompatible;
5404
- if (protocolCompatible === false) {
5405
- return check("fail", `runtime ${protocolVersion ?? "unknown"} is incompatible with relay ${extensionProtocolVersion}`);
5406
- }
5407
- if (extensionResult.value.protocolLegacy === true) {
5408
- return check("warn", `legacy extension does not report its protocol; relay infers ${protocolVersion ?? "unknown"}`);
5409
- }
5410
- if (protocolVersion === undefined || protocolVersion === null) {
5411
- return check("warn", "extension protocol is unknown");
5412
- }
5413
- return check("ok", `runtime ${protocolVersion} is compatible with relay ${extensionProtocolVersion}`);
5414
- }
5415
- function buildDoctorRecommendations(options) {
5416
- const relayRecommendations = options.relayResult.ok ? [] : [
5417
- `Run a relay-backed command to start the detached relay automatically; use \`${cliCommand("serve")}\` only for foreground debugging.`
5418
- ];
5419
- const relayBuildRecommendations = options.relayResult.ok ? [relayBuildProblem(options.relayResult.value)].filter((message) => message !== undefined) : [];
5420
- const extensionRecommendations = options.relayResult.ok && options.extensionResult.ok && !options.extensionResult.value.connected ? options.extensionResult.value.nextStep ? [options.extensionResult.value.nextStep] : options.extensionResult.value.protocolCompatible === false ? [extensionProtocolAdvice(options.extensionResult.value.protocolVersion, { install: installCommand() })] : [fromCheckout() || devExtension() ? `Run \`${installCommand()}\` and load the extension it points to (Load unpacked on your browser's extensions page).` : `Run \`${installCommand()}\`, and install browse from the Chrome Web Store page it opens.`] : [];
5421
- const artifactRecommendations = options.artifacts.some((artifact) => {
5422
- return !artifact.exists;
5423
- }) ? [`Rebuild or reinstall the missing files with \`${installCommand()}\`.`] : [];
5424
- const connectionConflictRecommendations = options.extensionResult.ok && (options.extensionResult.value.rejectedConnections ?? 0) > 0 ? ["The relay is an older browse that connects one browser at a time. Update browse on the computer running the relay, or close the other browser."] : [];
5425
- const staleSessionRecommendations = options.staleCurrent && options.current ? [
5426
- `Current session ${options.current} is stale; run \`${cliCommand("session new")}\` or \`${cliCommand("session use <id>")}\` after the relay is running.`
5427
- ] : [];
5428
- const unhealthyTargetRecommendations = options.unhealthyTargets.length ? [
5429
- "A target is crashed or showing a browser error page. Run the owning session once to trigger relay-owned recovery, or reset/re-adopt a user-owned tab."
5430
- ] : [];
5431
- return [
5432
- ...options.update ? [options.update.notice] : [],
5433
- ...relayRecommendations,
5434
- ...relayBuildRecommendations,
5435
- ...extensionRecommendations,
5436
- ...connectionConflictRecommendations,
5437
- ...artifactRecommendations,
5438
- ...staleSessionRecommendations,
5439
- ...unhealthyTargetRecommendations
5440
- ];
5441
- }
5442
- function summarizeCheckStatus(checks) {
5443
- if (checks.some((check) => {
5444
- return check.status === "fail";
5445
- })) {
5446
- return "fail";
5447
- }
5448
- if (checks.some((check) => {
5449
- return check.status === "warn";
5450
- })) {
5451
- return "warn";
5452
- }
5453
- return "ok";
5454
- }
5455
- function formatDoctorReport(report) {
5456
- const lines = [
5457
- "browse doctor",
5458
- `Status: ${report.status}`,
5459
- `Endpoint: ${report.endpoint}`,
5460
- `Paths: config=${report.paths.config} data=${report.paths.data} state=${report.paths.state} cache=${report.paths.cache}`,
5461
- `CLI: ${report.cli.version} (${report.cli.buildId})`,
5462
- `Package: ${report.package.name && report.package.version ? `${report.package.name} ${report.package.version}` : report.package.error ?? "unknown"}`,
5463
- `Relay: ${report.relay.reachable ? `reachable (${report.relay.version ?? "unknown"}, ${report.relay.buildId ?? "unknown build"})` : `unreachable (${report.relay.error ?? "unknown error"})`}`,
5464
- `Extension: ${formatExtensionSummary(report)}`,
5465
- `Targets: active=${formatNullableNumber(report.targets.active)} child=${formatNullableNumber(report.targets.child)} relay-owned=${report.targets.relayOwned.length} unhealthy=${report.targets.unhealthy.length}`,
5466
- `Sessions: current=${report.sessions.current ?? "none"} total=${report.sessions.all.length} connected=${report.sessions.all.filter((session) => {
5467
- return session.connected;
5468
- }).length}`,
5469
- "",
5470
- "Checks:",
5471
- ...report.checks.map((check) => {
5472
- return `[${check.status}] ${check.label}: ${check.message}`;
5473
- })
5474
- ];
5475
- const targetLines = report.targets.relayOwned.map((target) => {
5476
- return `- ${formatTargetSummary(target)}`;
5477
- });
5478
- const unhealthyTargetLines = report.targets.unhealthy.map((target) => {
5479
- return `- ${formatTargetSummary(target)}`;
5480
- });
5481
- const sessionLines = report.sessions.possibleLeaked.map((session) => {
5482
- return `- ${session.id} ${session.pageUrl ?? "no page yet"}`;
5483
- });
5484
- const details = [
5485
- ...targetLines.length ? ["", "Relay-owned targets:", ...targetLines] : [],
5486
- ...unhealthyTargetLines.length ? ["", "Unhealthy targets:", ...unhealthyTargetLines] : [],
5487
- ...sessionLines.length ? ["", "Connected non-current sessions:", ...sessionLines] : [],
5488
- ...report.recommendations.length ? ["", "Next steps:", ...report.recommendations.map((item) => {
5489
- return `- ${item}`;
5490
- })] : []
5491
- ];
5492
- return [...lines, ...details].join(`
5493
- `);
5494
- }
5495
- function formatExtensionSummary(report) {
5496
- if (report.extension.connected === null) {
5497
- return `unknown (${report.extension.error ?? "relay unreachable"})`;
5498
- }
5499
- const version = report.extension.version ? ` (${report.extension.version})` : "";
5500
- const protocol = report.extension.protocolVersion === null ? "" : `, protocol ${report.extension.protocolVersion} ${report.extension.protocolCompatible === false ? "incompatible" : "compatible"}`;
5501
- const match = report.extension.versionMatches === null ? "" : report.extension.versionMatches ? ", matches the CLI's version" : ", differs from the CLI's version";
5502
- const state = report.extension.connected ? "connected" : report.extension.unresponsive ? "not answering (busy or asleep)" : "disconnected";
5503
- return `${state}${version}${protocol}${match}`;
5504
- }
5505
- function formatNullableNumber(value) {
5506
- return value === null ? "unknown" : String(value);
5507
- }
5508
- function formatTargetSummary(target, options = {}) {
5509
- const tab = target.tabId === undefined ? "" : ` tab=${target.tabId}`;
5510
- const session = options.includeSession && target.opencodeBrowserSessionId ? ` session=${target.opencodeBrowserSessionId}` : "";
5511
- const owner = target.owner ? ` owner=${target.owner}` : "";
5512
- const health = `${target.crashed ? " crashed=true" : ""}${target.protectedUi ? " protected-ui=true" : ""}`;
5513
- return `${target.type} ${target.id}${tab}${session}${owner}${health} ${target.url || "about:blank"}`;
5514
- }
5515
-
5516
5049
  // src/cli/context.ts
5517
5050
  import process2 from "node:process";
5518
5051
  var sessionIdConfig = option(String2("OPENCODE_BROWSER_SESSION"));
@@ -5635,15 +5168,6 @@ var recordingTarget = fnUntraced(function* (options) {
5635
5168
  ...tabId === undefined ? {} : { tabId }
5636
5169
  };
5637
5170
  });
5638
- var parseRecordingModeOption = fnUntraced(function* (value) {
5639
- if (value === undefined) {
5640
- return;
5641
- }
5642
- if (value === "auto" || value === "tab-capture" || value === "cdp") {
5643
- return value;
5644
- }
5645
- return yield* fail6(new Error("Recording mode must be auto, tab-capture, or cdp"));
5646
- });
5647
5171
  var networkSession = fnUntraced(function* (session) {
5648
5172
  return yield* resolveSelectedSessionId(getOrUndefined(session) ?? getOrUndefined(yield* sessionIdConfig));
5649
5173
  });
@@ -5706,6 +5230,19 @@ var settingsSet = make("set", {
5706
5230
  yield* printSettings(result2.settings);
5707
5231
  })).pipe(withDescription4("Change settings (validated strictly; the extension's options page updates live)"));
5708
5232
  var settings = make("settings").pipe(withDescription4("Read or change the user's settings (the extension's options page). Security switches are environment-only"), withSubcommands([settingsGet, settingsSet]));
5233
+ function extensionManifestVersion(version) {
5234
+ const match = /^(\d+\.\d+\.\d+)(?:-dev\.(\d+)(?:\.\d+)?)?/.exec(version);
5235
+ if (!match)
5236
+ return version;
5237
+ return match[2] ? `${match[1]}.${match[2]}` : match[1];
5238
+ }
5239
+ function formatTargetSummary(target, options = {}) {
5240
+ const tab = target.tabId === undefined ? "" : ` tab=${target.tabId}`;
5241
+ const session = options.includeSession && target.opencodeBrowserSessionId ? ` session=${target.opencodeBrowserSessionId}` : "";
5242
+ const owner = target.owner ? ` owner=${target.owner}` : "";
5243
+ const health = `${target.crashed ? " crashed=true" : ""}${target.protectedUi ? " protected-ui=true" : ""}`;
5244
+ return `${target.type} ${target.id}${tab}${session}${owner}${health} ${target.url || "about:blank"}`;
5245
+ }
5709
5246
  var status = make("status", {
5710
5247
  json: jsonFlag
5711
5248
  }, fn("Cli.status")(function* ({ json }) {
@@ -5796,6 +5333,9 @@ var status = make("status", {
5796
5333
  if (extensionStatus.protocolCompatible === false && !extensionStatus.nextStep)
5797
5334
  yield* log(extensionProtocolAdvice(extensionStatus.protocolVersion, { install: installCommand() }));
5798
5335
  }
5336
+ if (extensionStatus.connected && extensionStatus.version && extensionStatus.version !== extensionManifestVersion(opencodeBrowserVersion2)) {
5337
+ yield* log(`Warning: extension ${extensionStatus.version} differs from this CLI's ${extensionManifestVersion(opencodeBrowserVersion2)}; update the extension if its protocol is incompatible.`);
5338
+ }
5799
5339
  yield* log(`Active targets: ${extensionStatus.activeTargets}`);
5800
5340
  if (extensionStatus.childTargets !== undefined) {
5801
5341
  yield* log(`Child targets: ${extensionStatus.childTargets}`);
@@ -5804,6 +5344,9 @@ var status = make("status", {
5804
5344
  yield* log(`CDP clients: ${extensionStatus.cdpClients}`);
5805
5345
  }
5806
5346
  yield* log(`Current session: ${current ?? "none"}`);
5347
+ if (current && !sessions.some((item) => item.id === current)) {
5348
+ yield* log(`Warning: current session ${current} is stale; run \`${cliCommand("session new")}\` or \`${cliCommand("session use <id>")}\`.`);
5349
+ }
5807
5350
  if (sessions.length === 0) {
5808
5351
  yield* log("Sessions: none");
5809
5352
  } else {
@@ -5820,6 +5363,10 @@ var status = make("status", {
5820
5363
  yield* log(` (${omittedIdleCount} idle session(s) with no page omitted; run ${cliCommand("session list")} to view all)`);
5821
5364
  }
5822
5365
  }
5366
+ const unhealthy = targets.filter((target) => target.crashed === true || target.url.startsWith("chrome-error://"));
5367
+ if (unhealthy.length > 0) {
5368
+ yield* log(`Warning: ${unhealthy.length} target(s) are crashed or on a browser error page. Run the owning session once to trigger recovery, or reset/re-adopt a user-owned tab.`);
5369
+ }
5823
5370
  if (targets.length === 0) {
5824
5371
  yield* log("Targets: none");
5825
5372
  } else {
@@ -5833,30 +5380,12 @@ var status = make("status", {
5833
5380
  }
5834
5381
  })).pipe(withDescription4("Show relay, extension, and target status"));
5835
5382
  var mcp = make("mcp", {}, fn("Cli.mcp")(function* () {
5836
- const { runMcpServer } = yield* promise(() => import("./mcp-jh4atts2.mjs"));
5383
+ const { runMcpServer } = yield* promise(() => import("./mcp-rzn35bxy.mjs"));
5837
5384
  yield* runMcpServer;
5838
5385
  })).pipe(withDescription4("Run the browse MCP server over stdio"));
5839
5386
  registerCliCommand(400, () => tabs);
5840
5387
  registerCliCommand(410, () => settings);
5841
5388
  registerCliCommand(500, () => status);
5842
- registerCliCommand(810, ({ packageRoot }) => make("doctor", {
5843
- json: jsonFlag
5844
- }, fn("Cli.doctor")(function* ({ json }) {
5845
- const update = yield* promise(() => updateNotice2());
5846
- const report = yield* createDoctorReport({ packageRoot, update: updateJson2(update) });
5847
- if (json) {
5848
- yield* emitJson(report);
5849
- } else {
5850
- yield* log(formatDoctorReport(report));
5851
- }
5852
- if (report.status === "fail") {
5853
- yield* failExit;
5854
- }
5855
- })).pipe(withDescription4("Diagnose the local browse install and runtime")));
5856
- registerCliCommand(820, () => make("skill", {}, fn("Cli.skill")(function* () {
5857
- const { skillText } = yield* promise(() => import("./skill-text-0ndr12dz.mjs"));
5858
- yield* log(skillText.trimEnd());
5859
- })).pipe(withDescription4("Print the browse agent skill text")));
5860
5389
  registerCliCommand(900, () => mcp);
5861
5390
 
5862
5391
  // src/cli/execute.ts
@@ -6019,56 +5548,25 @@ var execute = make("execute", {
6019
5548
  registerCliCommand(200, () => execute);
6020
5549
 
6021
5550
  // src/cli/network.ts
6022
- import path2 from "node:path";
6023
- var parseNetworkContent = fnUntraced(function* (content) {
6024
- const value = getOrUndefined(content);
6025
- if (value === undefined || value === "embed" || value === "omit")
6026
- return value;
6027
- return yield* fail6(new Error("Network content must be embed or omit"));
6028
- });
6029
5551
  function formatNetworkStatus(status) {
6030
5552
  if (!status.active)
6031
5553
  return status.ended ? `Network capture: inactive (the last one ended because ${status.ended})` : "Network capture: inactive";
6032
5554
  return `Network capture: active entries=${status.entryCount} responses=${status.responseCount} failures=${status.failureCount} bodyBytes=${status.capturedBodyBytes} truncated=${status.truncatedBodyCount} dropped=${status.droppedEntryCount} startedAt=${status.startedAt ?? "unknown"}${status.endsAt ? ` endsAt=${status.endsAt}` : ""}`;
6033
5555
  }
6034
5556
  function formatNetworkResult(result) {
6035
- const output = result.outputPath ? ` output=${result.outputPath}` : "";
6036
- return `Network capture stopped: entries=${result.entryCount} responses=${result.responseCount} failures=${result.failureCount} bodyBytes=${result.capturedBodyBytes} truncated=${result.truncatedBodyCount} dropped=${result.droppedEntryCount}${output}`;
5557
+ return `Network capture stopped: exchanges=${result.exchanges.length} entries=${result.entryCount} responses=${result.responseCount} failures=${result.failureCount} bodyBytes=${result.capturedBodyBytes} truncated=${result.truncatedBodyCount} dropped=${result.droppedEntryCount}`;
6037
5558
  }
6038
5559
  var networkStart = make("start", {
6039
5560
  session: sessionFlag("Capture the default page for this browse session"),
6040
5561
  urlFilter: String8("url").pipe(optional4, withDescription3("Capture only requests whose URL contains this text")),
6041
- resourceTypes: String8("resource-type").pipe(atMost2(50), withDescription3("Capture this Playwright resource type; repeat for multiple types")),
6042
- content: String8("content").pipe(optional4, withDescription3("Response and request body mode: embed (default) or omit")),
6043
- maxBodyBytes: Int6("max-body-bytes").pipe(optional4, withDescription3("Maximum captured bytes per body, defaults to 1000000")),
6044
- maxTotalBodyBytes: Int6("max-total-body-bytes").pipe(optional4, withDescription3("Maximum captured body bytes for the whole capture, defaults to 25000000")),
6045
- maxEntries: Int6("max-entries").pipe(optional4, withDescription3("Maximum request entries, defaults to 1000")),
6046
- maxDuration: Int6("max-duration-ms").pipe(optional4, withDescription3("End the capture by itself (discarding it) after this long, defaults to 1800000 (30 minutes)")),
6047
5562
  json: jsonFlag
6048
- }, fn("Cli.networkStart")(function* ({
6049
- session,
6050
- urlFilter,
6051
- resourceTypes,
6052
- content,
6053
- maxBodyBytes,
6054
- maxTotalBodyBytes,
6055
- maxEntries,
6056
- maxDuration,
6057
- json
6058
- }) {
5563
+ }, fn("Cli.networkStart")(function* ({ session, urlFilter, json }) {
6059
5564
  const relay = yield* Service;
6060
5565
  yield* ensureCliRelayAndExtension();
6061
5566
  const sessionId = yield* networkSession(session);
6062
- const contentValue = yield* parseNetworkContent(content);
6063
5567
  const result = yield* relay.networkStart({
6064
5568
  sessionId,
6065
- ...isSome(urlFilter) ? { urlFilter: urlFilter.value } : {},
6066
- ...resourceTypes.length === 0 ? {} : { resourceTypes },
6067
- ...contentValue === undefined ? {} : { content: contentValue },
6068
- ...isSome(maxBodyBytes) ? { maxBodyBytes: maxBodyBytes.value } : {},
6069
- ...isSome(maxTotalBodyBytes) ? { maxTotalBodyBytes: maxTotalBodyBytes.value } : {},
6070
- ...isSome(maxEntries) ? { maxEntries: maxEntries.value } : {},
6071
- ...isSome(maxDuration) ? { maxDurationMs: maxDuration.value } : {}
5569
+ ...isSome(urlFilter) ? { urlFilter: urlFilter.value } : {}
6072
5570
  });
6073
5571
  yield* printOr(json, result, formatNetworkStatus(result));
6074
5572
  })).pipe(withDescription4("Start session-scoped network capture"));
@@ -6084,50 +5582,39 @@ var networkStatus = make("status", {
6084
5582
  })).pipe(withDescription4("Show session-scoped network capture status"));
6085
5583
  var networkStop = make("stop", {
6086
5584
  session: sessionFlag(),
6087
- output: String8("output").pipe(optional4, withAlias2("o"), withDescription3("Write a credential-redacted HAR artifact to this path")),
6088
5585
  json: jsonFlag
6089
- }, fn("Cli.networkStop")(function* ({ session, output, json }) {
5586
+ }, fn("Cli.networkStop")(function* ({ session, json }) {
6090
5587
  const relay = yield* Service;
6091
- const outputValue = getOrUndefined(output);
6092
5588
  const sessionId = yield* networkSession(session);
6093
5589
  yield* ensureCliRelay();
6094
- const result = yield* relay.networkStop({
6095
- sessionId,
6096
- ...outputValue ? { outputPath: path2.resolve(outputValue) } : {}
6097
- });
5590
+ const result = yield* relay.networkStop({ sessionId });
6098
5591
  yield* printOr(json, result, formatNetworkResult(result));
6099
- })).pipe(withDescription4("Stop capture and optionally write a credential-redacted artifact"));
5592
+ })).pipe(withDescription4("Stop capture and return the redacted exchanges"));
6100
5593
  var networkCancel = make("cancel", { session: sessionFlag() }, fn("Cli.networkCancel")(function* ({ session }) {
6101
5594
  const relay = yield* Service;
6102
5595
  const sessionId = yield* networkSession(session);
6103
5596
  yield* ensureCliRelay();
6104
5597
  const result = yield* relay.networkCancel({ sessionId });
6105
5598
  yield* log(result.cancelled ? "Network capture cancelled" : "Network capture was not active");
6106
- })).pipe(withDescription4("Cancel capture without writing an artifact"));
5599
+ })).pipe(withDescription4("Cancel capture without returning its exchanges"));
6107
5600
  var network = make("network").pipe(withDescription4("Capture authenticated network exchanges for direct client derivation"), withSubcommands([networkStart, networkStatus, networkStop, networkCancel]));
6108
5601
  registerCliCommand(600, () => network);
6109
5602
 
6110
5603
  // src/cli/recording.ts
6111
- import path3 from "node:path";
5604
+ import path2 from "node:path";
6112
5605
  var recordingStart = make("start", {
6113
- outputPath: String7("output-path").pipe(withDescription2("Path to write the recording artifact; tabCapture requires .webm, CDP accepts .webm or .mp4")),
5606
+ outputPath: String7("output-path").pipe(withDescription2("Path to write the video: .webm or .mp4")),
6114
5607
  session: sessionFlag("Record the page for this browse or CDP session id"),
6115
5608
  tabId: tabIdFlag("Record this attached Chrome tab id"),
6116
- mode: String8("mode").pipe(optional4, withDescription3("Recording mode: auto, tab-capture, or cdp. auto uses CDP for relay-owned tabs and tabCapture for user-owned tabs")),
6117
- audio: Boolean4("audio").pipe(withDefault2(false), withDescription3("Include tab audio")),
6118
- frameRate: Int6("frame-rate").pipe(optional4, withDescription3("Output frame rate, integer 1..60; defaults to 30 for tab-capture and 60 for CDP")),
5609
+ frameRate: Int6("frame-rate").pipe(optional4, withDescription3("Output frame rate, integer 1..60; defaults to 60")),
6119
5610
  maxDurationMs: Int6("max-duration-ms").pipe(optional4, withDescription3("Auto-stop guard in milliseconds, defaults to 900000")),
6120
- cursor: Boolean4("cursor").pipe(withDefault2(false), withDescription3("Draw the ghost cursor in the recording (off by default: only the page is recorded)")),
6121
5611
  json: jsonFlag
6122
5612
  }, fn("Cli.recordingStart")(function* ({
6123
5613
  outputPath,
6124
5614
  session,
6125
5615
  tabId,
6126
- mode,
6127
- audio,
6128
5616
  frameRate,
6129
5617
  maxDurationMs,
6130
- cursor,
6131
5618
  json
6132
5619
  }) {
6133
5620
  if (isSome(frameRate) && (frameRate.value < 1 || frameRate.value > 60)) {
@@ -6136,21 +5623,17 @@ var recordingStart = make("start", {
6136
5623
  const relay = yield* Service;
6137
5624
  yield* ensureCliRelayAndExtension();
6138
5625
  const target = yield* recordingTarget({ session, tabId });
6139
- const modeValue = yield* parseRecordingModeOption(getOrUndefined(mode));
6140
- const resolvedOutputPath = path3.resolve(outputPath);
5626
+ const resolvedOutputPath = path2.resolve(outputPath);
6141
5627
  const result = yield* relay.recordingStart({
6142
5628
  ...target,
6143
5629
  outputPath: resolvedOutputPath,
6144
- ...modeValue === undefined ? {} : { mode: modeValue },
6145
- audio,
6146
5630
  ...isSome(frameRate) ? { frameRate: frameRate.value } : {},
6147
- ...isSome(maxDurationMs) ? { maxDurationMs: maxDurationMs.value } : {},
6148
- ...cursor ? { cursor } : {}
5631
+ ...isSome(maxDurationMs) ? { maxDurationMs: maxDurationMs.value } : {}
6149
5632
  });
6150
5633
  if (!result.success) {
6151
5634
  return yield* fail6(new Error(result.error ?? "Failed to start recording"));
6152
5635
  }
6153
- yield* printOr(json, result, `Recording started: ${result.path ?? resolvedOutputPath} tab=${result.tabId ?? "unknown"} mode=${result.mode ?? "tab-capture"} artifact=${result.artifactType ?? "webm"} mime=${result.mimeType ?? "video/webm"} fps=${result.frameRate ?? "unknown"}`);
5636
+ yield* printOr(json, result, `Recording started: ${result.path ?? resolvedOutputPath} tab=${result.tabId ?? "unknown"} artifact=${result.artifactType ?? "webm"} mime=${result.mimeType ?? "video/webm"} fps=${result.frameRate ?? "unknown"}`);
6154
5637
  })).pipe(withDescription4("Start recording an attached tab"));
6155
5638
  var recordingStop = make("stop", {
6156
5639
  session: sessionFlag("Stop recording for this CDP session id"),
@@ -6167,7 +5650,7 @@ var recordingStop = make("stop", {
6167
5650
  if (json)
6168
5651
  return yield* emitJson(result);
6169
5652
  const frames = result.frameCount === undefined ? "" : `, frames=${result.frameCount}`;
6170
- yield* log(`Recording saved: ${result.path ?? "unknown"} (${result.size ?? 0} bytes, ${result.duration ?? 0}ms, mode=${result.mode ?? "tab-capture"}, artifact=${result.artifactType ?? "webm"}${frames})`);
5653
+ yield* log(`Recording saved: ${result.path ?? "unknown"} (${result.size ?? 0} bytes, ${result.duration ?? 0}ms, artifact=${result.artifactType ?? "webm"}${frames})`);
6171
5654
  yield* log(formatRecordingQuality(result.quality));
6172
5655
  })).pipe(withDescription4("Stop recording and write the artifact"));
6173
5656
  var recordingStatus = make("status", {
@@ -6188,7 +5671,7 @@ var recordingStatus = make("status", {
6188
5671
  return;
6189
5672
  }
6190
5673
  const frames = result.frameCount === undefined ? "" : ` frameCount=${result.frameCount}`;
6191
- yield* log(`Recording: active tab=${result.tabId ?? "unknown"} mode=${result.mode ?? "tab-capture"} artifact=${result.artifactType ?? "webm"} path=${result.path ?? "unknown"} size=${result.size ?? 0}${frames} startedAt=${result.startedAt ?? "unknown"}`);
5674
+ yield* log(`Recording: active tab=${result.tabId ?? "unknown"} artifact=${result.artifactType ?? "webm"} path=${result.path ?? "unknown"} size=${result.size ?? 0}${frames} startedAt=${result.startedAt ?? "unknown"}`);
6192
5675
  yield* log(formatRecordingQuality(result.quality));
6193
5676
  })).pipe(withDescription4("Check current recording status"));
6194
5677
  var recordingCancel = make("cancel", {
@@ -6205,81 +5688,16 @@ var recordingCancel = make("cancel", {
6205
5688
  yield* log("Recording cancelled");
6206
5689
  })).pipe(withDescription4("Cancel recording without writing a file"));
6207
5690
  var recording = make("recording").pipe(withDescription4("Record an attached tab to WebM or MP4"), withSubcommands([recordingStart, recordingStop, recordingStatus, recordingCancel]));
6208
- var flightRecorderStart = make("start", {
6209
- session: sessionFlag("Buffer the tab owned by this session"),
6210
- tabId: tabIdFlag("Buffer this attached Chrome tab id"),
6211
- retentionMs: Int6("retention-ms").pipe(optional4, withDescription3("Ring-buffer duration in milliseconds (1000..120000; default 60000)")),
6212
- frameRate: Int6("frame-rate").pipe(optional4, withDescription3("Output frame rate from 1 to 60")),
6213
- cursor: Boolean4("cursor").pipe(withDefault2(false), withDescription3("Draw the ghost cursor in the buffered video (off by default)")),
6214
- json: jsonFlag
6215
- }, fn("Cli.flightRecorderStart")(function* ({ session, tabId, retentionMs, frameRate, cursor, json }) {
6216
- const relay = yield* Service;
6217
- yield* ensureCliRelayAndExtension();
6218
- const target = yield* recordingTarget({ session, tabId });
6219
- const result = yield* relay.flightRecorderStart({
6220
- ...target,
6221
- ...isSome(retentionMs) ? { retentionMs: retentionMs.value } : {},
6222
- ...isSome(frameRate) ? { frameRate: frameRate.value } : {},
6223
- ...cursor ? { cursor } : {}
6224
- });
6225
- yield* printOr(json, result, `Flight recorder buffering tab ${result.tabId}; retention=${result.retentionMs}ms`);
6226
- })).pipe(withDescription4("Start a rolling in-memory video buffer"));
6227
- var flightRecorderStatus = make("status", {
6228
- session: sessionFlag(),
6229
- tabId: tabIdFlag(),
6230
- json: jsonFlag
6231
- }, fn("Cli.flightRecorderStatus")(function* ({ session, tabId, json }) {
6232
- const relay = yield* Service;
6233
- yield* ensureCliRelay();
6234
- const result = yield* relay.flightRecorderStatus(yield* recordingTarget({ session, tabId }));
6235
- if (json)
6236
- return yield* emitJson(result);
6237
- if (!result.active)
6238
- return yield* log("Flight recorder inactive");
6239
- yield* log(`Flight recorder tab=${result.tabId} frames=${result.bufferedFrames} retained=${result.retainedDurationMs}ms bytes=${result.bufferedBytes}`);
6240
- })).pipe(withDescription4("Show rolling flight-recorder status"));
6241
- var flightRecorderSaveLast = make("save-last", {
6242
- outputPath: String7("output-path").pipe(withDescription2("Fresh .webm or .mp4 artifact path")),
6243
- session: sessionFlag(),
6244
- tabId: tabIdFlag(),
6245
- durationMs: Int6("duration-ms").pipe(optional4, withDescription3("How much recent history to save; defaults to 30 seconds")),
6246
- json: jsonFlag
6247
- }, fn("Cli.flightRecorderSaveLast")(function* ({ outputPath, session, tabId, durationMs, json }) {
6248
- const relay = yield* Service;
6249
- yield* ensureCliRelay();
6250
- const result = yield* relay.flightRecorderSaveLast({
6251
- ...yield* recordingTarget({ session, tabId }),
6252
- outputPath: path3.resolve(outputPath),
6253
- ...isSome(durationMs) ? { durationMs: durationMs.value } : {}
6254
- });
6255
- yield* printOr(json, result, `Saved ${result.durationMs}ms flight recorder clip (${result.frameCount} frames) to ${result.path}`);
6256
- })).pipe(withDescription4("Save the most recent buffered video without stopping the recorder"));
6257
- var flightRecorderCancel = make("cancel", {
6258
- session: sessionFlag(),
6259
- tabId: tabIdFlag()
6260
- }, fn("Cli.flightRecorderCancel")(function* ({ session, tabId }) {
6261
- const relay = yield* Service;
6262
- yield* ensureCliRelay();
6263
- const result = yield* relay.flightRecorderCancel(yield* recordingTarget({ session, tabId }));
6264
- yield* log(result.cancelled ? "Flight recorder stopped" : "No active flight recorder");
6265
- })).pipe(withDescription4("Stop and discard the rolling video buffer"));
6266
- var flightRecorder = make("flight-recorder").pipe(withDescription4("Keep and save a rolling buffer of recent browser video"), withSubcommands([
6267
- flightRecorderStart,
6268
- flightRecorderStatus,
6269
- flightRecorderSaveLast,
6270
- flightRecorderCancel
6271
- ]));
6272
5691
  registerCliCommand(700, () => recording);
6273
- registerCliCommand(710, () => flightRecorder);
6274
5692
 
6275
5693
  // src/cli/relay.ts
6276
5694
  var serve = make("serve", {}, fn("Cli.serve")(function* () {
6277
- const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-1epy67be.mjs"), import("./helpers-k5ybc61c.mjs")]));
5695
+ const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-n5jwr402.mjs"), import("./helpers-00s350tq.mjs")]));
6278
5696
  const port = process.env.OPENCODE_BROWSER_PORT === undefined ? undefined : yield* portConfig;
6279
5697
  const additionalExtensionOrigins = parseAdditionalExtensionOrigins(yield* extensionOriginsConfig);
6280
5698
  yield* scoped(gen(function* () {
6281
5699
  const relay = yield* startRelay({ ...port === undefined ? {} : { port }, additionalExtensionOrigins });
6282
- yield* promise(() => import("./legacy-runtime-j0sw664c.mjs").then((module) => module.commitLegacyTakeover()));
5700
+ yield* promise(() => import("./legacy-runtime-egp6zww2.mjs").then((module) => module.commitLegacyTakeover()));
6283
5701
  yield* log(`browse relay listening at ${relay.url}`);
6284
5702
  yield* log(`browse connects automatically while the browser runs. Run \`${cliCommand("status")}\` to check.`);
6285
5703
  yield* never;
@@ -6479,7 +5897,7 @@ registerCliCommand(300, () => session);
6479
5897
  registerCliCommand(800, () => journal);
6480
5898
 
6481
5899
  // src/cli.ts
6482
- var packageRoot = path4.dirname(path4.dirname(fileURLToPath(import.meta.url)));
5900
+ var packageRoot = path3.dirname(path3.dirname(fileURLToPath(import.meta.url)));
6483
5901
  var opencodeBrowser = make("browse").pipe(withDescription4("Control the user's existing browser through the browse extension"), withSubcommands(buildRegisteredCliCommands({ packageRoot })));
6484
5902
  var mainLayer = mergeAll(layerFetch, layer).pipe(provideMerge(layer2));
6485
5903
  function runCli(rawArgs = process3.argv.slice(2)) {