@opencode/browse 0.0.11-dev.76 → 0.0.11-dev.77

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 (33) hide show
  1. package/dist/{cli-qpkh40gh.mjs → cli-mx6tbg2m.mjs} +63 -52
  2. package/dist/cli.mjs +30 -19
  3. package/dist/{helpers-kp0j46jt.mjs → helpers-hgm1z9h5.mjs} +2 -2
  4. package/dist/{index-0dcypq31.mjs → index-yzz55kxm.mjs} +1 -1
  5. package/dist/{main-brv9dhy5.mjs → main-1fdejpga.mjs} +9 -9
  6. package/dist/{main-ajza8egc.mjs → main-6chyyr6j.mjs} +44 -39
  7. package/dist/{main-rt6g5418.mjs → main-8z9d979q.mjs} +15 -15
  8. package/dist/{setup-j76yv51b.mjs → main-b7g6460c.mjs} +3608 -4406
  9. package/dist/{main-gevbt7h7.mjs → main-csnx585b.mjs} +151 -151
  10. package/dist/{main-nqmm7pdz.mjs → main-cymarjp4.mjs} +47 -47
  11. package/dist/main-j2ehvkhk.mjs +465 -0
  12. package/dist/main-r3a6053j.mjs +157 -0
  13. package/dist/main-s7017yah.mjs +161 -0
  14. package/dist/main-sjrzyg3x.mjs +73 -0
  15. package/dist/main-vgzr4689.mjs +61 -0
  16. package/dist/{main-eej5z0y5.mjs → main-zq79yb8r.mjs} +6 -6
  17. package/dist/main-zya5ttbr.mjs +4 -0
  18. package/dist/{mcp-sy8qgkyr.mjs → mcp-h0qcxhqc.mjs} +138 -137
  19. package/dist/migrate-pgckfkg5.mjs +233 -0
  20. package/dist/{relay-ateyg5ax.mjs → relay-gafgjtav.mjs} +128 -123
  21. package/dist/runtime-update-p2pnfdy1.mjs +156 -0
  22. package/dist/setup-fhhjnx9r.mjs +956 -0
  23. package/dist/{skill-text-x7sccp6h.mjs → skill-text-6p6scqwe.mjs} +2 -2
  24. package/dist/{supervisor-0rvjpf4e.mjs → supervisor-06t66v4t.mjs} +38 -17
  25. package/dist/{update-rbd2025v.mjs → update-7hagfdc0.mjs} +3 -3
  26. package/dist/{version-4cjr3wpp.mjs → version-hhcvk9wm.mjs} +1 -1
  27. package/package.json +1 -1
  28. package/skills/browse/SKILL.md +2 -2
  29. package/dist/main-7wgmq04v.mjs +0 -303
  30. package/dist/main-exnm62gg.mjs +0 -4
  31. package/dist/main-hm4fcpfz.mjs +0 -131
  32. package/dist/main-rn7hdcq2.mjs +0 -805
  33. package/dist/runtime-update-70gqzynp.mjs +0 -200
@@ -19,7 +19,7 @@ import {
19
19
  make4,
20
20
  Reference,
21
21
  succeed,
22
- fail,
22
+ fail2,
23
23
  isFailure,
24
24
  match2,
25
25
  isReadonlyArrayNonEmpty,
@@ -47,7 +47,7 @@ import {
47
47
  void_3,
48
48
  never,
49
49
  gen,
50
- fail4,
50
+ fail5,
51
51
  try_,
52
52
  flatMap3,
53
53
  andThen,
@@ -72,10 +72,8 @@ import {
72
72
  fnUntraced,
73
73
  fn,
74
74
  make7,
75
- value,
76
- take3,
77
- FileSystem,
78
- is,
75
+ value2,
76
+ is2,
79
77
  decodeUnknownEffect2,
80
78
  optionalKey,
81
79
  optional,
@@ -93,21 +91,26 @@ import {
93
91
  Defect,
94
92
  TaggedError2,
95
93
  toCodecStringTree,
94
+ take3,
95
+ FileSystem,
96
+ Path,
96
97
  errorExitCode,
97
98
  errorReported,
98
- runMain,
99
- Path,
100
99
  QuitError,
101
100
  isQuitError,
102
101
  Terminal,
102
+ runMain,
103
103
  layer2
104
- } from "./main-gevbt7h7.mjs";
104
+ } from "./main-csnx585b.mjs";
105
105
  import {
106
106
  opencodeBrowserVersion2,
107
107
  opencodeBrowserBuildId2
108
- } from "./main-exnm62gg.mjs";
108
+ } from "./main-zya5ttbr.mjs";
109
109
  import {
110
+ configRoot2,
110
111
  dataRoot,
112
+ stateRoot,
113
+ cacheRoot,
111
114
  fromCheckout,
112
115
  compiledBinary,
113
116
  binaryPackage,
@@ -115,7 +118,7 @@ import {
115
118
  devExtension,
116
119
  installCommand,
117
120
  autoUpdateStatus
118
- } from "./main-rn7hdcq2.mjs";
121
+ } from "./main-j2ehvkhk.mjs";
119
122
  import {
120
123
  extensionProtocolVersion,
121
124
  extensionProtocolAdvice
@@ -141,13 +144,13 @@ import {
141
144
  ensureExtensionConnected,
142
145
  stoppedRelayStatus,
143
146
  statusCollections
144
- } from "./main-ajza8egc.mjs";
145
- import"./main-hm4fcpfz.mjs";
147
+ } from "./main-6chyyr6j.mjs";
148
+ import"./main-vgzr4689.mjs";
146
149
  import {
147
150
  updateJson2,
148
151
  formatUpdateNotice2,
149
152
  updateNotice2
150
- } from "./main-brv9dhy5.mjs";
153
+ } from "./main-1fdejpga.mjs";
151
154
  import {
152
155
  settingKeys,
153
156
  formatSettings,
@@ -155,12 +158,13 @@ import {
155
158
  addSecret,
156
159
  listSecrets,
157
160
  removeSecret
158
- } from "./main-nqmm7pdz.mjs";
161
+ } from "./main-cymarjp4.mjs";
159
162
  import {
160
163
  defaultJournalBaseDir,
161
164
  readJournalEntries,
162
165
  formatJournalEntry
163
- } from "./main-eej5z0y5.mjs";
166
+ } from "./main-zq79yb8r.mjs";
167
+ import"./main-sjrzyg3x.mjs";
164
168
  import {
165
169
  pipeArguments,
166
170
  dual,
@@ -322,8 +326,8 @@ var Proto = {
322
326
  _A: identity
323
327
  }
324
328
  };
325
- var isTrueLiteral = /* @__PURE__ */ is(TrueLiterals);
326
- var isFalseLiteral = /* @__PURE__ */ is(FalseLiterals);
329
+ var isTrueLiteral = /* @__PURE__ */ is2(TrueLiterals);
330
+ var isFalseLiteral = /* @__PURE__ */ is2(FalseLiterals);
327
331
  var isBoolean = (p) => p._tag === "Boolean";
328
332
  var makePrimitive = (tag, parse) => Object.assign(Object.create(Proto), {
329
333
  _tag: tag,
@@ -344,7 +348,7 @@ var Choice = (choices) => {
344
348
  if (choiceMap.has(value)) {
345
349
  return succeed6(choiceMap.get(value));
346
350
  }
347
- return fail4(validChoices);
351
+ return fail5(validChoices);
348
352
  });
349
353
  return Object.assign(primitive, {
350
354
  choiceKeys: choices.map(([key]) => key)
@@ -581,10 +585,10 @@ var Number3 = (options) => {
581
585
  precision: 2,
582
586
  validate: (n) => {
583
587
  if (n < opts.min) {
584
- return fail4(`${n} must be greater than or equal to ${opts.min}`);
588
+ return fail5(`${n} must be greater than or equal to ${opts.min}`);
585
589
  }
586
590
  if (n > opts.max) {
587
- return fail4(`${n} must be less than or equal to ${opts.max}`);
591
+ return fail5(`${n} must be less than or equal to ${opts.max}`);
588
592
  }
589
593
  return succeed6(n);
590
594
  },
@@ -611,10 +615,10 @@ var Int4 = (options) => {
611
615
  decrementBy: 1,
612
616
  validate: (n) => {
613
617
  if (n < opts.min) {
614
- return fail4(`${n} must be greater than or equal to ${opts.min}`);
618
+ return fail5(`${n} must be greater than or equal to ${opts.min}`);
615
619
  }
616
620
  if (n > opts.max) {
617
- return fail4(`${n} must be less than or equal to ${opts.max}`);
621
+ return fail5(`${n} must be less than or equal to ${opts.max}`);
618
622
  }
619
623
  return succeed6(n);
620
624
  },
@@ -3394,7 +3398,7 @@ var makeCommand = (options) => {
3394
3398
  const annotations = options.annotations ?? empty();
3395
3399
  const globalFlags = options.globalFlags ?? [];
3396
3400
  const subcommands = options.subcommands ?? [];
3397
- const handle = (input, commandPath) => isNotUndefined(options.handle) ? options.handle(input, commandPath) : fail4(new ShowHelp({
3401
+ const handle = (input, commandPath) => isNotUndefined(options.handle) ? options.handle(input, commandPath) : fail5(new ShowHelp({
3398
3402
  commandPath,
3399
3403
  errors: []
3400
3404
  }));
@@ -4648,7 +4652,7 @@ var promptSingle = (single) => {
4648
4652
  case "Redacted":
4649
4653
  return map5(run(Password({
4650
4654
  message
4651
- })), (value2) => commandLineArg(value(value2), "<redacted>"));
4655
+ })), (value) => commandLineArg(value2(value), "<redacted>"));
4652
4656
  default:
4653
4657
  return map5(run(String5({
4654
4658
  message
@@ -4977,7 +4981,7 @@ var runWith = (command, config) => {
4977
4981
  onSome: (level) => make4(MinimumLogLevel, level)
4978
4982
  });
4979
4983
  yield* provideContext(program, services);
4980
- }, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed(error) : fail(error), (error) => andThen(showHelp(command, error, config.renderErrors !== false), fail4(error))), catchFilter((error) => config.renderErrors !== false && isCliError(error) && error._tag === "UserError" ? succeed(error) : fail(error), (error) => andThen(showUserError(error), fail4(error))), catchFilter((e) => isQuitError(e) ? succeed(e) : fail(e), (_) => interrupt2));
4984
+ }, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed(error) : fail2(error), (error) => andThen(showHelp(command, error, config.renderErrors !== false), fail5(error))), catchFilter((error) => config.renderErrors !== false && isCliError(error) && error._tag === "UserError" ? succeed(error) : fail2(error), (error) => andThen(showUserError(error), fail5(error))), catchFilter((e) => isQuitError(e) ? succeed(e) : fail2(e), (_) => interrupt2));
4981
4985
  };
4982
4986
  // src/cli.ts
4983
4987
  import path5 from "node:path";
@@ -5039,7 +5043,7 @@ var StoreFile = Struct({
5039
5043
  class Service3 extends Service2()("opencode-browser-cli/SessionStore") {
5040
5044
  }
5041
5045
  var defaultFilePath = () => {
5042
- return `${dataRoot()}/session.json`;
5046
+ return `${stateRoot()}/session.json`;
5043
5047
  };
5044
5048
  var make2 = fn("SessionStore.make")(function* (options) {
5045
5049
  const fs = yield* FileSystem;
@@ -5057,7 +5061,7 @@ var make2 = fn("SessionStore.make")(function* (options) {
5057
5061
  operation,
5058
5062
  cause
5059
5063
  });
5060
- const readStore = fs.readFileString(filePath).pipe(map5(some), catchTag("PlatformError", (error) => isTagged(error.reason, "NotFound") ? succeed6(none()) : fail4(error)), mapError(storeError("read")), flatMap3(match({
5064
+ const readStore = fs.readFileString(filePath).pipe(map5(some), catchTag("PlatformError", (error) => isTagged(error.reason, "NotFound") ? succeed6(none()) : fail5(error)), mapError(storeError("read")), flatMap3(match({
5061
5065
  onNone: () => succeed6({}),
5062
5066
  onSome: (text) => try_({
5063
5067
  try: () => JSON.parse(text),
@@ -5182,6 +5186,12 @@ var createDoctorReport = fn("Doctor.createReport")(function* (options) {
5182
5186
  const report = {
5183
5187
  status: summarizeCheckStatus(checks),
5184
5188
  endpoint: relay.endpoint,
5189
+ paths: {
5190
+ config: configRoot2(),
5191
+ data: dataRoot(),
5192
+ state: stateRoot(),
5193
+ cache: cacheRoot()
5194
+ },
5185
5195
  cli: { version: opencodeBrowserVersion2, buildId: opencodeBrowserBuildId2 },
5186
5196
  package: {
5187
5197
  path: path.join(options.packageRoot, "package.json"),
@@ -5461,6 +5471,7 @@ function formatDoctorReport(report) {
5461
5471
  "browse doctor",
5462
5472
  `Status: ${report.status}`,
5463
5473
  `Endpoint: ${report.endpoint}`,
5474
+ `Paths: config=${report.paths.config} data=${report.paths.data} state=${report.paths.state} cache=${report.paths.cache}`,
5464
5475
  `CLI: ${report.cli.version} (${report.cli.buildId})`,
5465
5476
  `Package: ${report.package.name && report.package.version ? `${report.package.name} ${report.package.version}` : report.package.error ?? "unknown"}`,
5466
5477
  `Relay: ${report.relay.reachable ? `reachable (${report.relay.version ?? "unknown"}, ${report.relay.buildId ?? "unknown build"})` : `unreachable (${report.relay.error ?? "unknown error"})`}`,
@@ -5614,7 +5625,7 @@ var ensureCliRelay = fnUntraced(function* () {
5614
5625
  yield* error(`Started browse relay at ${relay.endpoint}`);
5615
5626
  }
5616
5627
  if (readiness.buildProblem) {
5617
- return yield* fail4(new Error(readiness.buildProblem));
5628
+ return yield* fail5(new Error(readiness.buildProblem));
5618
5629
  }
5619
5630
  return readiness;
5620
5631
  });
@@ -5632,7 +5643,7 @@ var resolveSelectedSessionId = fnUntraced(function* (explicitSessionId) {
5632
5643
  const store = yield* Service3;
5633
5644
  const sessionId = explicitSessionId ?? (yield* store.read);
5634
5645
  if (!sessionId) {
5635
- return yield* fail4(new Error("No session provided and no current browse session exists"));
5646
+ return yield* fail5(new Error("No session provided and no current browse session exists"));
5636
5647
  }
5637
5648
  return sessionId;
5638
5649
  });
@@ -5652,7 +5663,7 @@ var recordingTarget = fnUntraced(function* (options) {
5652
5663
  const sessionId = getOrUndefined(options.session);
5653
5664
  const tabId = getOrUndefined(options.tabId);
5654
5665
  if (sessionId && tabId !== undefined) {
5655
- return yield* fail4(new Error("Use only one recording target selector: --session or --tab-id"));
5666
+ return yield* fail5(new Error("Use only one recording target selector: --session or --tab-id"));
5656
5667
  }
5657
5668
  return {
5658
5669
  ...sessionId ? { sessionId } : {},
@@ -5666,7 +5677,7 @@ var parseRecordingModeOption = fnUntraced(function* (value) {
5666
5677
  if (value === "auto" || value === "tab-capture" || value === "cdp") {
5667
5678
  return value;
5668
5679
  }
5669
- return yield* fail4(new Error("Recording mode must be auto, tab-capture, or cdp"));
5680
+ return yield* fail5(new Error("Recording mode must be auto, tab-capture, or cdp"));
5670
5681
  });
5671
5682
  var networkSession = fnUntraced(function* (session) {
5672
5683
  return yield* resolveSelectedSessionId(getOrUndefined(session) ?? getOrUndefined(yield* sessionIdConfig));
@@ -5718,7 +5729,7 @@ var settingsSet = make("set", {
5718
5729
  for (const assignment of assignments) {
5719
5730
  const index = assignment.indexOf("=");
5720
5731
  if (index <= 0)
5721
- return yield* fail4(new Error(`Expected key=value, got "${assignment}". Settings: ${settingKeys.join(", ")}.`));
5732
+ return yield* fail5(new Error(`Expected key=value, got "${assignment}". Settings: ${settingKeys.join(", ")}.`));
5722
5733
  changes[assignment.slice(0, index)] = assignment.slice(index + 1);
5723
5734
  }
5724
5735
  const relay = yield* Service;
@@ -5856,7 +5867,7 @@ var status = make("status", {
5856
5867
  }
5857
5868
  })).pipe(withDescription4("Show relay, extension, and target status"));
5858
5869
  var mcp = make("mcp", {}, fn("Cli.mcp")(function* () {
5859
- const { runMcpServer } = yield* promise(() => import("./mcp-sy8qgkyr.mjs"));
5870
+ const { runMcpServer } = yield* promise(() => import("./mcp-h0qcxhqc.mjs"));
5860
5871
  yield* runMcpServer;
5861
5872
  })).pipe(withDescription4("Run the browse MCP server over stdio"));
5862
5873
  registerCliCommand(400, () => tabs);
@@ -5877,7 +5888,7 @@ registerCliCommand(810, ({ packageRoot }) => make("doctor", {
5877
5888
  }
5878
5889
  })).pipe(withDescription4("Diagnose the local browse install and runtime")));
5879
5890
  registerCliCommand(820, () => make("skill", {}, fn("Cli.skill")(function* () {
5880
- const { skillText } = yield* promise(() => import("./skill-text-x7sccp6h.mjs"));
5891
+ const { skillText } = yield* promise(() => import("./skill-text-6p6scqwe.mjs"));
5881
5892
  yield* log(skillText.trimEnd());
5882
5893
  })).pipe(withDescription4("Print the browse agent skill text")));
5883
5894
  registerCliCommand(900, () => mcp);
@@ -5962,19 +5973,19 @@ var execute = make("execute", {
5962
5973
  const relay = yield* Service;
5963
5974
  const filePath = getOrUndefined(file);
5964
5975
  if (code.length > 0 && filePath) {
5965
- return yield* fail4(new Error("Use either positional code or --file, not both"));
5976
+ return yield* fail5(new Error("Use either positional code or --file, not both"));
5966
5977
  }
5967
5978
  if (code.length === 0 && !filePath) {
5968
- return yield* fail4(new Error("Execute requires positional code or --file <path>"));
5979
+ return yield* fail5(new Error("Execute requires positional code or --file <path>"));
5969
5980
  }
5970
5981
  const timeoutMsValue = getOrUndefined(timeoutMs);
5971
5982
  if (timeoutMsValue !== undefined && timeoutMsValue < 0) {
5972
- return yield* fail4(new Error("Timeout must be a non-negative integer"));
5983
+ return yield* fail5(new Error("Timeout must be a non-negative integer"));
5973
5984
  }
5974
5985
  const executeCode = filePath ? yield* readExecuteFile(filePath) : code.join(" ");
5975
5986
  const explicitSessionId = getOrUndefined(session) ?? getOrUndefined(yield* sessionIdConfig);
5976
5987
  if (rm && explicitSessionId) {
5977
- return yield* fail4(new Error("Use --rm without --session or OPENCODE_BROWSER_SESSION"));
5988
+ return yield* fail5(new Error("Use --rm without --session or OPENCODE_BROWSER_SESSION"));
5978
5989
  }
5979
5990
  const agentWorkSessionId = agentDefaultSessionId(getOrUndefined(yield* agentSessionIdConfig));
5980
5991
  const workSessionId = explicitSessionId ?? (rm ? undefined : agentWorkSessionId);
@@ -5982,10 +5993,10 @@ var execute = make("execute", {
5982
5993
  const targetUrlValue = getOrUndefined(targetUrl) ?? getOrUndefined(yield* targetUrlConfig);
5983
5994
  const targetIndexValue = getOrUndefined(targetIndex) ?? getOrUndefined(yield* targetIndexConfig);
5984
5995
  if (targetIndexValue !== undefined && targetIndexValue < 0) {
5985
- return yield* fail4(new Error("Target index must be a non-negative integer"));
5996
+ return yield* fail5(new Error("Target index must be a non-negative integer"));
5986
5997
  }
5987
5998
  if (targetUrlValue && targetIndexValue !== undefined) {
5988
- return yield* fail4(new Error("Use only one target selector: --target-url/OPENCODE_BROWSER_TARGET_URL or --target-index/OPENCODE_BROWSER_TARGET_INDEX"));
5999
+ return yield* fail5(new Error("Use only one target selector: --target-url/OPENCODE_BROWSER_TARGET_URL or --target-index/OPENCODE_BROWSER_TARGET_INDEX"));
5989
6000
  }
5990
6001
  const result2 = yield* relay.execute({
5991
6002
  ...workSessionId ? { sessionId: workSessionId } : {},
@@ -6047,7 +6058,7 @@ var parseNetworkContent = fnUntraced(function* (content) {
6047
6058
  const value = getOrUndefined(content);
6048
6059
  if (value === undefined || value === "embed" || value === "omit")
6049
6060
  return value;
6050
- return yield* fail4(new Error("Network content must be embed or omit"));
6061
+ return yield* fail5(new Error("Network content must be embed or omit"));
6051
6062
  });
6052
6063
  function formatNetworkStatus(status) {
6053
6064
  if (!status.active)
@@ -6116,7 +6127,7 @@ var networkStop = make("stop", {
6116
6127
  const outputValue = getOrUndefined(output);
6117
6128
  const secretsValue = getOrUndefined(secrets);
6118
6129
  if (!outputValue && !secretsValue) {
6119
- return yield* fail4(new Error("network stop requires --output, --secrets, or both"));
6130
+ return yield* fail5(new Error("network stop requires --output, --secrets, or both"));
6120
6131
  }
6121
6132
  const sessionId = yield* networkSession(session);
6122
6133
  yield* ensureCliRelay();
@@ -6161,7 +6172,7 @@ var recordingStart = make("start", {
6161
6172
  json
6162
6173
  }) {
6163
6174
  if (isSome(frameRate) && (frameRate.value < 1 || frameRate.value > 60)) {
6164
- return yield* fail4(new Error("Recording frameRate must be an integer from 1 to 60"));
6175
+ return yield* fail5(new Error("Recording frameRate must be an integer from 1 to 60"));
6165
6176
  }
6166
6177
  const relay = yield* Service;
6167
6178
  yield* ensureCliRelayAndExtension();
@@ -6178,7 +6189,7 @@ var recordingStart = make("start", {
6178
6189
  ...cursor ? { cursor } : {}
6179
6190
  });
6180
6191
  if (!result.success) {
6181
- return yield* fail4(new Error(result.error ?? "Failed to start recording"));
6192
+ return yield* fail5(new Error(result.error ?? "Failed to start recording"));
6182
6193
  }
6183
6194
  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"}`);
6184
6195
  })).pipe(withDescription4("Start recording an attached tab"));
@@ -6192,7 +6203,7 @@ var recordingStop = make("stop", {
6192
6203
  const target = yield* recordingTarget({ session, tabId });
6193
6204
  const result = yield* relay.recordingStop(target);
6194
6205
  if (!result.success) {
6195
- return yield* fail4(new Error(result.error ?? "Failed to stop recording"));
6206
+ return yield* fail5(new Error(result.error ?? "Failed to stop recording"));
6196
6207
  }
6197
6208
  if (json)
6198
6209
  return yield* emitJson(result);
@@ -6230,7 +6241,7 @@ var recordingCancel = make("cancel", {
6230
6241
  const target = yield* recordingTarget({ session, tabId });
6231
6242
  const result = yield* relay.recordingCancel(target);
6232
6243
  if (!result.success) {
6233
- return yield* fail4(new Error(result.error ?? "Failed to cancel recording"));
6244
+ return yield* fail5(new Error(result.error ?? "Failed to cancel recording"));
6234
6245
  }
6235
6246
  yield* log("Recording cancelled");
6236
6247
  })).pipe(withDescription4("Cancel recording without writing a file"));
@@ -6304,7 +6315,7 @@ registerCliCommand(710, () => flightRecorder);
6304
6315
 
6305
6316
  // src/cli/relay.ts
6306
6317
  var serve = make("serve", {}, fn("Cli.serve")(function* () {
6307
- const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-ateyg5ax.mjs"), import("./helpers-kp0j46jt.mjs")]));
6318
+ const [{ startRelay }, { parseAdditionalExtensionOrigins }] = yield* promise(() => Promise.all([import("./relay-gafgjtav.mjs"), import("./helpers-hgm1z9h5.mjs")]));
6308
6319
  const port = yield* portConfig;
6309
6320
  const additionalExtensionOrigins = parseAdditionalExtensionOrigins(yield* extensionOriginsConfig);
6310
6321
  yield* scoped(gen(function* () {
@@ -6371,7 +6382,7 @@ var secretsRun = make("run", {
6371
6382
  yield* ensureCliRelay();
6372
6383
  const [executable, ...args] = decodeCliOperands(command);
6373
6384
  if (!executable)
6374
- return yield* fail4(new Error("secrets run requires a command after --"));
6385
+ return yield* fail5(new Error("secrets run requires a command after --"));
6375
6386
  const result = yield* relay.authRun({
6376
6387
  name,
6377
6388
  command: executable,
@@ -6558,11 +6569,11 @@ var sessionAdopt = make("adopt", {
6558
6569
  const targetUrlValue = getOrUndefined(targetUrl);
6559
6570
  const targetIndexValue = getOrUndefined(targetIndex);
6560
6571
  if (targetIndexValue !== undefined && targetIndexValue < 0) {
6561
- return yield* fail4(new Error("Target index must be a non-negative integer"));
6572
+ return yield* fail5(new Error("Target index must be a non-negative integer"));
6562
6573
  }
6563
6574
  const tabIdValue = getOrUndefined(tabId);
6564
6575
  if ([targetUrlValue, targetIndexValue, tabIdValue].filter((value) => value !== undefined).length > 1) {
6565
- return yield* fail4(new Error("Use only one target selector: --target-url, --target-index, or --tab-id"));
6576
+ return yield* fail5(new Error("Use only one target selector: --target-url, --target-index, or --tab-id"));
6566
6577
  }
6567
6578
  const targetSelection = targetUrlValue ? { urlIncludes: targetUrlValue } : targetIndexValue !== undefined ? { index: targetIndexValue } : undefined;
6568
6579
  const result = yield* relay.sessionAdopt({
@@ -6602,7 +6613,7 @@ var sessionAllow = make("allow", {
6602
6613
  const relay = yield* Service;
6603
6614
  yield* ensureCliRelay();
6604
6615
  if (!clear && origins.length === 0) {
6605
- return yield* fail4(new Error("session allow needs origins, or --clear to remove the allowlist"));
6616
+ return yield* fail5(new Error("session allow needs origins, or --clear to remove the allowlist"));
6606
6617
  }
6607
6618
  const id = yield* resolvePositionalOrFlagSessionId(none(), session);
6608
6619
  const result = yield* relay.sessionAllowlist(id, clear ? [] : origins);
package/dist/cli.mjs CHANGED
@@ -1,30 +1,39 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/main.ts
4
+ import fs from "node:fs";
5
+ import os from "node:os";
4
6
  import path from "node:path";
5
- var embeddedVersion = "0.0.11-dev.76";
6
- var setupCommands = new Set(["install", "uninstall", "extension", "pair", "rollback", "set"]);
7
+ var embeddedVersion = "0.0.11-dev.77";
8
+ var setupCommands = new Set(["install", "uninstall", "extension", "pair", "set"]);
7
9
  var command = process.argv[2];
8
10
  var invokedAs = path.basename(process.argv[1] ?? "");
11
+ var legacyDataRoot = process.platform === "win32" ? path.join(process.env.LOCALAPPDATA ?? path.join(os.homedir(), "AppData", "Local"), "opencode-browser") : path.join(process.env.XDG_DATA_HOME ?? path.join(os.homedir(), ".local", "share"), "opencode-browser");
12
+ if (command !== "--version" && command !== "-v" && !process.env.OPENCODE_BROWSER_HOME && [path.join(os.homedir(), ".browse"), legacyDataRoot].some((root) => fs.existsSync(root))) {
13
+ try {
14
+ const { migrateLegacy } = await import("./migrate-pgckfkg5.mjs");
15
+ migrateLegacy();
16
+ } catch {}
17
+ }
9
18
  if (command === "--version" || command === "-v") {
10
- const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-4cjr3wpp.mjs")).opencodeBrowserVersion;
19
+ const opencodeBrowserVersion = embeddedVersion ?? (await import("./version-hhcvk9wm.mjs")).opencodeBrowserVersion;
11
20
  process.stdout.write(`${opencodeBrowserVersion}
12
21
  `);
13
- } else if (command === "mcp" && globalThis.__OPENCODE_BROWSER_COMPILED__ && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1") {
14
- const { runBinaryMcp } = await import("./supervisor-0rvjpf4e.mjs");
22
+ } else if (command === "mcp" && process.env.OPENCODE_BROWSER_MCP_DIRECT !== "1" && (await import("./supervisor-06t66v4t.mjs")).supervisesMcp()) {
23
+ const { runBinaryMcp } = await import("./supervisor-06t66v4t.mjs");
15
24
  await runBinaryMcp(process.argv.slice(3));
16
25
  } else if (invokedAs === "opencode-browser-mcp" || command === "mcp" && process.argv.length === 3) {
17
- const { NodeRuntime } = await import("./index-0dcypq31.mjs");
18
- const { runMcpServer } = await import("./mcp-sy8qgkyr.mjs");
26
+ const { NodeRuntime } = await import("./index-yzz55kxm.mjs");
27
+ const { runMcpServer } = await import("./mcp-h0qcxhqc.mjs");
19
28
  runMcpServer.pipe(NodeRuntime.runMain);
20
- } else if (command === "runtime-install" || command === "runtime-switch") {
21
- const { runRuntimeInstall, runRuntimeSwitch } = await import("./runtime-update-70gqzynp.mjs");
22
- await (command === "runtime-install" ? runRuntimeInstall : runRuntimeSwitch)(process.argv.slice(3));
29
+ } else if (command === "self-update" || command === "runtime-switch") {
30
+ const { runSelfUpdate, runRuntimeSwitch } = await import("./runtime-update-p2pnfdy1.mjs");
31
+ await (command === "self-update" ? runSelfUpdate : runRuntimeSwitch)(process.argv.slice(3));
23
32
  } else if (command === "update") {
24
- const { runUpdateCommand } = await import("./update-rbd2025v.mjs");
33
+ const { runUpdateCommand } = await import("./update-7hagfdc0.mjs");
25
34
  await runUpdateCommand(process.argv.slice(3));
26
35
  } else if (command && setupCommands.has(command)) {
27
- const { runSetup } = await import("./setup-j76yv51b.mjs");
36
+ const { runSetup } = await import("./setup-fhhjnx9r.mjs");
28
37
  await runSetup(command, process.argv.slice(3));
29
38
  } else {
30
39
  if (!command || command === "--help" || command === "-h") {
@@ -48,20 +57,22 @@ if (command === "--version" || command === "-v") {
48
57
  \`--revoke legacy\` retires the shared code of earlier versions
49
58
  set hostname <address> Where the relay listens: 127.0.0.1 (this computer, the default) or 0.0.0.0
50
59
  (browsers on other computers can connect too, after pairing)
51
- update [--check] Update now. A git clone install pulls the newer commits (fast-forward only)
52
- and runs setup again; an npm install installs the newest version on its
53
- channel and switches to it; --check only says whether there's an update
54
- rollback [--force] npm installs: go back to the version before the last update (and skip
55
- the one rolled back from until a newer one is published)
60
+ update [--check] Update now: rerun whatever installed browse (the install script for a binary
61
+ install, npm install -g for an npm one); --check only says whether there's an
62
+ update. A git clone pulls the newer commits and runs setup again.
56
63
  uninstall [--yes] Remove everything install set up (--yes skips confirming that stored
57
64
  secret profiles are deleted)
58
65
 
66
+ browse keeps its files in $XDG_CONFIG_HOME/browse, $XDG_DATA_HOME/browse, $XDG_STATE_HOME/browse and
67
+ $XDG_CACHE_HOME/browse (defaults under ~/.config, ~/.local/share, ~/.local/state and ~/.cache), and the
68
+ executable in ~/.local/bin (or $XDG_BIN_HOME).
69
+
59
70
  `);
60
71
  }
61
72
  if (command === "status" && !process.argv.includes("--json")) {
62
- const { printSetupStatus } = await import("./setup-j76yv51b.mjs");
73
+ const { printSetupStatus } = await import("./setup-fhhjnx9r.mjs");
63
74
  printSetupStatus();
64
75
  }
65
- const { runCli } = await import("./cli-qpkh40gh.mjs");
76
+ const { runCli } = await import("./cli-mx6tbg2m.mjs");
66
77
  runCli();
67
78
  }
@@ -31,8 +31,8 @@ import {
31
31
  isRestrictedTarget2,
32
32
  isRestrictedUrl2,
33
33
  dataUrlDocument2
34
- } from "./main-ajza8egc.mjs";
35
- import"./main-hm4fcpfz.mjs";
34
+ } from "./main-6chyyr6j.mjs";
35
+ import"./main-vgzr4689.mjs";
36
36
  import"./main-mrew6jy8.mjs";
37
37
  export {
38
38
  HttpRouteError2 as HttpRouteError,
@@ -3,7 +3,7 @@ import {
3
3
  exports_NodeRuntime,
4
4
  exports_NodeStdio,
5
5
  exports_NodeServices
6
- } from "./main-gevbt7h7.mjs";
6
+ } from "./main-csnx585b.mjs";
7
7
  export {
8
8
  exports_NodeHttpClient as NodeHttpClient,
9
9
  exports_NodeRuntime as NodeRuntime,
@@ -1,12 +1,12 @@
1
1
  import {
2
- dataRoot,
2
+ cacheRoot,
3
3
  compiledBinary,
4
4
  checkoutRoot,
5
5
  cliCommand,
6
6
  compareVersions,
7
- npmRuntime,
7
+ installedRuntime2,
8
8
  autoUpdateStatus
9
- } from "./main-rn7hdcq2.mjs";
9
+ } from "./main-j2ehvkhk.mjs";
10
10
  import {
11
11
  unpackedReloadAdvice
12
12
  } from "./main-mrew6jy8.mjs";
@@ -127,19 +127,19 @@ async function updateNotice2(options = {}) {
127
127
  const repo = options.repo ?? checkoutRoot();
128
128
  if (!repo || !updateCheckEnabled() || !existsSync(path.join(repo, ".git")))
129
129
  return;
130
- const check = await cachedUpdateCheck({ repo, dataDir: options.dataDir ?? dataRoot(), ...options.git ? { git: options.git } : {} });
130
+ const check = await cachedUpdateCheck({ repo, dataDir: options.dataDir ?? cacheRoot(), ...options.git ? { git: options.git } : {} });
131
131
  return check?.available ? { summary: describeUpdate(check), command: cliCommand("update"), check } : undefined;
132
132
  } catch {
133
133
  return;
134
134
  }
135
135
  }
136
136
  function npmUpdateNotice() {
137
- const runtime = npmRuntime();
137
+ const runtime = installedRuntime2();
138
138
  if (!runtime)
139
139
  return false;
140
140
  const status = autoUpdateStatus({ runtime });
141
141
  const latest = status.latest;
142
- if (!latest || compareVersions(latest, runtime.version) <= 0 || status.effective === "off" || latest === status.skipped)
142
+ if (!latest || compareVersions(latest, runtime.version) <= 0 || status.effective === "off")
143
143
  return;
144
144
  if (status.effective === "on" && !status.lastError)
145
145
  return;
@@ -315,8 +315,8 @@ function runUpdate(args, deps) {
315
315
  async function runUpdateCommand2(args) {
316
316
  const log = (line) => process.stdout.write(line + `
317
317
  `);
318
- const { runNpmUpdate } = await import("./runtime-update-70gqzynp.mjs");
319
- if (await runNpmUpdate(args))
318
+ const { runInstalledUpdate } = await import("./runtime-update-p2pnfdy1.mjs");
319
+ if (await runInstalledUpdate(args))
320
320
  return;
321
321
  if (compiledBinary()) {
322
322
  log(`This browse isn't installed. Run \`${cliCommand("install")}\` to set it up; it updates itself from then on.`);
@@ -329,7 +329,7 @@ async function runUpdateCommand2(args) {
329
329
  return log("Installed from npm: run `npx @opencode/browse@latest install` to update.");
330
330
  const check = await checkForUpdate(repo);
331
331
  if (check)
332
- writeCache(path.join(dataRoot(), CACHE_FILE), check);
332
+ writeCache(path.join(cacheRoot(), CACHE_FILE), check);
333
333
  if (!check)
334
334
  return log("Can't check: this clone isn't on a branch that tracks a remote.");
335
335
  if (check.failed)