@opencode/browse 0.0.15-dev.109 → 0.0.15-dev.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/{Undici-88kyhfpm.mjs → Undici-mxpvn7gy.mjs} +1 -1
  2. package/dist/{cli-p9153stn.mjs → cli-qbevp261.mjs} +134 -130
  3. package/dist/cli.mjs +13 -13
  4. package/dist/{helpers-7581fp1t.mjs → helpers-3qe84bs4.mjs} +2 -2
  5. package/dist/{index-yzz55kxm.mjs → index-6gkr235e.mjs} +1 -1
  6. package/dist/{main-g42426sk.mjs → main-08xv9zty.mjs} +3 -3
  7. package/dist/main-2r3wkhaa.mjs +4 -0
  8. package/dist/main-9t2s5ptx.mjs +5405 -0
  9. package/dist/{main-tnt640me.mjs → main-agbjz9vc.mjs} +3 -3
  10. package/dist/{main-vgzr4689.mjs → main-azpzpy0x.mjs} +1 -1
  11. package/dist/{main-8z9d979q.mjs → main-er120rjm.mjs} +2 -2
  12. package/dist/{main-yf9xhpn4.mjs → main-ken6azcs.mjs} +2 -2
  13. package/dist/main-m7hxrgtg.mjs +1694 -0
  14. package/dist/{main-v214rq9t.mjs → main-p8dn427e.mjs} +2 -2
  15. package/dist/{main-92ddeppe.mjs → main-qya10zvn.mjs} +5 -5
  16. package/dist/{main-xgygnzxq.mjs → main-vyr67qdb.mjs} +2 -2
  17. package/dist/main-wb8sbtr1.mjs +1255 -0
  18. package/dist/{main-jd29wpzh.mjs → main-wmpmewe1.mjs} +2 -2
  19. package/dist/{main-csnx585b.mjs → main-yf5j8g79.mjs} +2800 -8017
  20. package/dist/{main-42rzg4vq.mjs → main-ym0evywx.mjs} +4 -4
  21. package/dist/{main-m17abecj.mjs → main-zptcnvy8.mjs} +59 -57
  22. package/dist/{mcp-y63hca9k.mjs → mcp-cstaf6x0.mjs} +415 -411
  23. package/dist/{migrate-2qb3pzh6.mjs → migrate-bynvsqpe.mjs} +5 -5
  24. package/dist/{relay-dy1jak5p.mjs → relay-aems8waq.mjs} +127 -123
  25. package/dist/{runtime-update-v7ztrvyv.mjs → runtime-update-6gpw6b15.mjs} +7 -6
  26. package/dist/{setup-ws98stde.mjs → setup-aca4zwxc.mjs} +20 -11
  27. package/dist/{supervisor-v3xw2dq1.mjs → supervisor-xavypw3x.mjs} +3 -3
  28. package/dist/{update-na79yc51.mjs → update-v09y9tza.mjs} +3 -3
  29. package/dist/{version-6rycga6g.mjs → version-pkmxp5at.mjs} +1 -1
  30. package/package.json +1 -1
  31. package/dist/main-k3mddd56.mjs +0 -2924
  32. package/dist/main-kca4rh9g.mjs +0 -4
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  isNodeError
3
- } from "./main-vgzr4689.mjs";
3
+ } from "./main-azpzpy0x.mjs";
4
4
  import {
5
5
  isValidSessionId2
6
- } from "./main-m17abecj.mjs";
6
+ } from "./main-zptcnvy8.mjs";
7
7
  import {
8
8
  isSome,
9
9
  decodeUnknownOption,
@@ -14,10 +14,10 @@ import {
14
14
  Struct,
15
15
  ArraySchema,
16
16
  NullOr
17
- } from "./main-csnx585b.mjs";
17
+ } from "./main-yf5j8g79.mjs";
18
18
  import {
19
19
  stateRoot
20
- } from "./main-tnt640me.mjs";
20
+ } from "./main-agbjz9vc.mjs";
21
21
 
22
22
  // src/session-manager/journal.ts
23
23
  import fs from "node:fs";
@@ -5,6 +5,29 @@ import {
5
5
  extensionProtocolAdvice,
6
6
  parseJsonObject
7
7
  } from "./main-mrew6jy8.mjs";
8
+ import {
9
+ get,
10
+ post,
11
+ setHeader,
12
+ bodyJson,
13
+ HttpClient,
14
+ layerNodeHttp
15
+ } from "./main-9t2s5ptx.mjs";
16
+ import {
17
+ opencodeBrowserBuildId2
18
+ } from "./main-2r3wkhaa.mjs";
19
+ import {
20
+ compiledBinary,
21
+ scriptEntry,
22
+ cliCommand,
23
+ installCommand,
24
+ compareVersions,
25
+ installedRuntime2,
26
+ installedVersion
27
+ } from "./main-agbjz9vc.mjs";
28
+ import {
29
+ relayAuthorization
30
+ } from "./main-wmpmewe1.mjs";
8
31
  import {
9
32
  assignProperty,
10
33
  PipeInspectableProto,
@@ -32,12 +55,12 @@ import {
32
55
  sync2,
33
56
  void_3,
34
57
  callback2,
35
- fail5,
58
+ fail6,
36
59
  die2,
37
- try_,
60
+ try_2,
38
61
  fromResult,
39
62
  flatMap3,
40
- andThen,
63
+ andThen2,
41
64
  tap,
42
65
  result,
43
66
  map5,
@@ -69,7 +92,7 @@ import {
69
92
  SchemaError,
70
93
  decodeUnknownEffect2,
71
94
  decodeUnknownOption,
72
- make8,
95
+ make12,
73
96
  optionalKey,
74
97
  Literal,
75
98
  Unknown,
@@ -97,29 +120,8 @@ import {
97
120
  Defect,
98
121
  TaggedError2,
99
122
  toCodecStringTree,
100
- Json,
101
- get2,
102
- post,
103
- setHeader,
104
- bodyJson,
105
- HttpClient,
106
- layerNodeHttp
107
- } from "./main-csnx585b.mjs";
108
- import {
109
- opencodeBrowserBuildId2
110
- } from "./main-kca4rh9g.mjs";
111
- import {
112
- compiledBinary,
113
- scriptEntry,
114
- cliCommand,
115
- installCommand,
116
- compareVersions,
117
- installedRuntime2,
118
- installedVersion
119
- } from "./main-tnt640me.mjs";
120
- import {
121
- relayAuthorization
122
- } from "./main-jd29wpzh.mjs";
123
+ Json
124
+ } from "./main-yf5j8g79.mjs";
123
125
  import {
124
126
  dual,
125
127
  memoize,
@@ -127,7 +129,7 @@ import {
127
129
  isNumber,
128
130
  isObject,
129
131
  isTagged
130
- } from "./main-yf9xhpn4.mjs";
132
+ } from "./main-ken6azcs.mjs";
131
133
 
132
134
  // node_modules/effect/dist/ConfigProvider.js
133
135
  function makeValue(value) {
@@ -384,14 +386,14 @@ var toConfigCursorAST = /* @__PURE__ */ memoize((root) => {
384
386
  function schema(codec, path) {
385
387
  const codecStringTree = toCodecStringTree(codec);
386
388
  const encodedAst = toEncoded(codecStringTree.ast);
387
- const decodeCursor = decodeUnknownEffect(make8(toConfigCursorAST(codecStringTree.ast)));
389
+ const decodeCursor = decodeUnknownEffect(make12(toConfigCursorAST(codecStringTree.ast)));
388
390
  const localPath = typeof path === "string" ? [path] : path ?? [];
389
391
  return make2((provider, pathPrefix) => {
390
392
  const fullPath = [...pathPrefix, ...localPath];
391
393
  return loadCursor(provider, fullPath).pipe(flatMapEager((cursor) => decodeCursor(cursor).pipe(mapEager(succeed), catchEager((issue) => {
392
394
  const error = new ConfigError(new SchemaError(fullPath.length > 0 ? new Pointer(fullPath, issue) : issue));
393
- return hasProviderInput(encodedAst, cursor.node) ? fail5(error) : succeed6(fail2(error));
394
- }))), catchDefect((defect) => isSourceError(defect) ? fail5(new ConfigError(defect)) : die2(defect)));
395
+ return hasProviderInput(encodedAst, cursor.node) ? fail6(error) : succeed6(fail2(error));
396
+ }))), catchDefect((defect) => isSourceError(defect) ? fail6(new ConfigError(defect)) : die2(defect)));
395
397
  });
396
398
  }
397
399
  function String2(name) {
@@ -895,7 +897,7 @@ function formatHostForUrl2(host) {
895
897
  function listenHttpServer2(options) {
896
898
  return callback2((resume) => {
897
899
  const onError = (error) => {
898
- resume(fail5(error));
900
+ resume(fail6(error));
899
901
  };
900
902
  options.server.once("error", onError);
901
903
  options.server.listen(options.port, options.host, () => {
@@ -914,7 +916,7 @@ function closeHttpServer2(server) {
914
916
  return callback2((resume) => {
915
917
  server.close((error) => {
916
918
  if (error) {
917
- resume(fail5(new Error("close http server", { cause: error })));
919
+ resume(fail6(new Error("close http server", { cause: error })));
918
920
  return;
919
921
  }
920
922
  resume(void_3);
@@ -931,7 +933,7 @@ function closeWebSocketServer2(server) {
931
933
  return;
932
934
  }
933
935
  if (error) {
934
- resume(fail5(new Error("close websocket server", { cause: error })));
936
+ resume(fail6(new Error("close websocket server", { cause: error })));
935
937
  return;
936
938
  }
937
939
  resume(void_3);
@@ -956,7 +958,7 @@ function readJsonBody2(request) {
956
958
  const contentType = request.headers["content-type"];
957
959
  const contentTypeValue = Array.isArray(contentType) ? contentType[0] : contentType;
958
960
  if (!contentTypeValue?.toLowerCase().includes("application/json")) {
959
- return fail5(new HttpRouteError2({ message: "Content-Type must be application/json", status: 415, code: "invalid-request" }));
961
+ return fail6(new HttpRouteError2({ message: "Content-Type must be application/json", status: 415, code: "invalid-request" }));
960
962
  }
961
963
  return callback2((resume) => {
962
964
  const chunks = [];
@@ -970,7 +972,7 @@ function readJsonBody2(request) {
970
972
  if (totalBytes > maxCliBodyBytes) {
971
973
  completed = true;
972
974
  request.destroy(new Error(`Request body exceeds ${maxCliBodyBytes} bytes`));
973
- resume(fail5(new HttpRouteError2({ message: `Request body exceeds ${maxCliBodyBytes} bytes`, status: 413, code: "invalid-request" })));
975
+ resume(fail6(new HttpRouteError2({ message: `Request body exceeds ${maxCliBodyBytes} bytes`, status: 413, code: "invalid-request" })));
974
976
  return;
975
977
  }
976
978
  chunks.push(chunk);
@@ -980,21 +982,21 @@ function readJsonBody2(request) {
980
982
  return;
981
983
  }
982
984
  completed = true;
983
- resume(fail5(new Error("read request body", { cause: error })));
985
+ resume(fail6(new Error("read request body", { cause: error })));
984
986
  };
985
987
  const onAbort = () => {
986
988
  if (completed) {
987
989
  return;
988
990
  }
989
991
  completed = true;
990
- resume(fail5(new Error("request body aborted")));
992
+ resume(fail6(new Error("request body aborted")));
991
993
  };
992
994
  const onClose = () => {
993
995
  if (completed || request.complete) {
994
996
  return;
995
997
  }
996
998
  completed = true;
997
- resume(fail5(new Error("request closed before body completed")));
999
+ resume(fail6(new Error("request closed before body completed")));
998
1000
  };
999
1001
  const onEnd = () => {
1000
1002
  if (completed) {
@@ -1009,7 +1011,7 @@ function readJsonBody2(request) {
1009
1011
  try {
1010
1012
  resume(succeed6(parseJsonObject(text)));
1011
1013
  } catch (error) {
1012
- resume(fail5(new HttpRouteError2({ message: "Invalid JSON body", status: 400, code: "invalid-request" })));
1014
+ resume(fail6(new HttpRouteError2({ message: "Invalid JSON body", status: 400, code: "invalid-request" })));
1013
1015
  }
1014
1016
  };
1015
1017
  request.on("data", onData);
@@ -1382,7 +1384,7 @@ var make3 = fn("RelayClient.make")(function* (options) {
1382
1384
  if (response.status < 200 || response.status >= 300) {
1383
1385
  const envelope = decodeErrorEnvelope(body);
1384
1386
  const message = isSome(envelope) ? envelope.value.error : getOrElse(map(decodeErrorMessage(body), (value) => value.error), () => `Relay responded with HTTP ${response.status} for ${path}`);
1385
- return fail5(new RelayRejected({
1387
+ return fail6(new RelayRejected({
1386
1388
  message,
1387
1389
  status: response.status,
1388
1390
  path,
@@ -1411,11 +1413,11 @@ var make3 = fn("RelayClient.make")(function* (options) {
1411
1413
  const authorized = setHeader(request, "authorization", authorization);
1412
1414
  return options?.clientPid === undefined ? authorized : setHeader(authorized, "opencode-browser-client-pid", String(options.clientPid));
1413
1415
  };
1414
- const getJson = (path, schema) => suspend2(() => httpClient.execute(authorize(get2(new URL(path, endpoint))))).pipe(mapError(transportError(path)), flatMap3((response) => handleResponse(response, path, schema)), timeoutOrElse({ duration: 5000, orElse: () => fail5(new RelayTimedOut({
1416
+ const getJson = (path, schema) => suspend2(() => httpClient.execute(authorize(get(new URL(path, endpoint))))).pipe(mapError(transportError(path)), flatMap3((response) => handleResponse(response, path, schema)), timeoutOrElse({ duration: 5000, orElse: () => fail6(new RelayTimedOut({
1415
1417
  message: `The relay on port ${new URL(endpoint).port} isn't answering (${path} timed out).`,
1416
1418
  path
1417
1419
  })) }));
1418
- const checkWhileWaiting = sleep(30000).pipe(andThen(getJson("/version", RelayVersion)), forever);
1420
+ const checkWhileWaiting = sleep(30000).pipe(andThen2(getJson("/version", RelayVersion)), forever);
1419
1421
  const postJson = (path, body, schema) => post(new URL(path, endpoint)).pipe(bodyJson(body), mapError((cause) => new RelayEncodeFailed({
1420
1422
  message: `Could not encode relay request for ${path}`,
1421
1423
  path,
@@ -1560,7 +1562,7 @@ var ensureRelay = fn("RelayLifecycle.ensureRelay")(function* (options) {
1560
1562
  if (relayWasAbsent) {
1561
1563
  const autoStart = yield* Boolean2("OPENCODE_BROWSER_AUTOSTART").pipe(withDefault(true), mapError((cause) => new Error("Invalid OPENCODE_BROWSER_AUTOSTART configuration", { cause })));
1562
1564
  if (!autoStart) {
1563
- return yield* fail5(new Error(`Automatic relay startup is disabled; no relay is available at ${options.relay.endpoint}`));
1565
+ return yield* fail6(new Error(`Automatic relay startup is disabled; no relay is available at ${options.relay.endpoint}`));
1564
1566
  }
1565
1567
  if (!supersededRuntime())
1566
1568
  yield* options.start ?? startManagedRelay();
@@ -1595,16 +1597,16 @@ var restartRelay = fn("RelayLifecycle.restartRelay")(function* (options) {
1595
1597
  }
1596
1598
  if (original) {
1597
1599
  if (original.managed !== true || !original.instanceId) {
1598
- return yield* fail5(new Error(`Cannot restart a foreground or unidentified relay. Stop it manually, then run \`${cliCommand("relay restart")}\`.`));
1600
+ return yield* fail6(new Error(`Cannot restart a foreground or unidentified relay. Stop it manually, then run \`${cliCommand("relay restart")}\`.`));
1599
1601
  }
1600
1602
  if (original.shutdownProtocol !== 2) {
1601
- return yield* fail5(new Error(`This legacy relay does not support safe shutdown protocol 2. Stop it manually once, then run \`${cliCommand("relay restart")}\` to upgrade; no shutdown request was sent.`));
1603
+ return yield* fail6(new Error(`This legacy relay does not support safe shutdown protocol 2. Stop it manually once, then run \`${cliCommand("relay restart")}\` to upgrade; no shutdown request was sent.`));
1602
1604
  }
1603
1605
  if (!Number.isFinite(Date.parse(buildId)) || !original.buildId || !Number.isFinite(Date.parse(original.buildId))) {
1604
- return yield* fail5(new Error("Cannot explicitly replace a source or unorderable relay build. Stop it manually, then launch the intended build."));
1606
+ return yield* fail6(new Error("Cannot explicitly replace a source or unorderable relay build. Stop it manually, then launch the intended build."));
1605
1607
  }
1606
1608
  if (!options.otherBuild && isNewerBuild(original.buildId, buildId)) {
1607
- return yield* fail5(new Error(`Refusing to downgrade relay build ${original.buildId} to ${buildId}; refresh or restart this CLI or MCP client.`));
1609
+ return yield* fail6(new Error(`Refusing to downgrade relay build ${original.buildId} to ${buildId}; refresh or restart this CLI or MCP client.`));
1608
1610
  }
1609
1611
  const confirmed = yield* result(options.relay.version);
1610
1612
  if (isFailure(confirmed)) {
@@ -1614,7 +1616,7 @@ var restartRelay = fn("RelayLifecycle.restartRelay")(function* (options) {
1614
1616
  replacement = confirmed.success;
1615
1617
  } else {
1616
1618
  if (confirmed.success.managed !== true || confirmed.success.shutdownProtocol !== 2 || confirmed.success.buildId !== original.buildId) {
1617
- return yield* fail5(new Error("Relay identity metadata changed during restart; no shutdown request was sent."));
1619
+ return yield* fail6(new Error("Relay identity metadata changed during restart; no shutdown request was sent."));
1618
1620
  }
1619
1621
  const request = yield* RelayShutdownRequest.makeEffect({
1620
1622
  instanceId: original.instanceId,
@@ -1640,15 +1642,15 @@ var restartRelay = fn("RelayLifecycle.restartRelay")(function* (options) {
1640
1642
  replacement = yield* waitForRelayReady(options);
1641
1643
  }
1642
1644
  if (!replacement || !replacement.instanceId || replacement.managed !== true || original && isSameRelayInstance(original, replacement)) {
1643
- return yield* fail5(new Error("Relay restart did not produce a new managed instance; no further shutdown was attempted."));
1645
+ return yield* fail6(new Error("Relay restart did not produce a new managed instance; no further shutdown was attempted."));
1644
1646
  }
1645
1647
  const buildProblem = options.otherBuild ? undefined : relayBuildProblem(replacement, buildId);
1646
1648
  if (buildProblem)
1647
- return yield* fail5(new Error(`${buildProblem} A competing relay was left untouched.`));
1649
+ return yield* fail6(new Error(`${buildProblem} A competing relay was left untouched.`));
1648
1650
  return { version: replacement, started, waitForReconnect: true };
1649
1651
  });
1650
1652
  function waitForRelayExitOrReplacement(options) {
1651
- return options.relay.version.pipe(flatMap3((version) => isSameRelayInstance(options.version, version) ? fail5(new RelayStillRunning("browse relay is still draining; no replacement was started")) : succeed6(version)), catch_((error) => isRelayUnreachable(error) ? succeed6(undefined) : fail5(error)), retry({
1653
+ return options.relay.version.pipe(flatMap3((version) => isSameRelayInstance(options.version, version) ? fail6(new RelayStillRunning("browse relay is still draining; no replacement was started")) : succeed6(version)), catch_((error) => isRelayUnreachable(error) ? succeed6(undefined) : fail6(error)), retry({
1652
1654
  times: options.retryTimes ?? 200,
1653
1655
  schedule: spaced(options.retryDelayMs ?? 50),
1654
1656
  while: (error) => error instanceof RelayStillRunning || isRelayStarting(error)
@@ -1673,7 +1675,7 @@ var ensureExtensionConnected = fn("RelayLifecycle.ensureExtensionConnected")(fun
1673
1675
  const responsiveStatus = options.relay.extensionStatus.pipe(tap((status) => {
1674
1676
  const profile = status.sessions?.find((s) => s.id === options.sessionId)?.browser;
1675
1677
  if (status.browsers?.some((b) => b.unresponsive && (profile ? b.id === profile : !status.connected))) {
1676
- return fail5(new ExtensionDisconnected({ message: browserUnresponsive, unresponsive: true }));
1678
+ return fail6(new ExtensionDisconnected({ message: browserUnresponsive, unresponsive: true }));
1677
1679
  }
1678
1680
  return void_3;
1679
1681
  }));
@@ -1683,18 +1685,18 @@ var ensureExtensionConnected = fn("RelayLifecycle.ensureExtensionConnected")(fun
1683
1685
  const browser = status.browsers?.find((candidate) => candidate.id === bound.browser);
1684
1686
  if (!options.waitForReconnect || browser?.connected || status.protocolCompatible === false)
1685
1687
  return succeed6(status);
1686
- return fail5(new ExtensionDisconnected({
1688
+ return fail6(new ExtensionDisconnected({
1687
1689
  message: `Session ${bound.id} belongs to browser '${bound.browser}', which isn't connected. Reconnect it or start a new session.`,
1688
1690
  needsPairing: status.pairingState === "refused" || status.pairingState === "unpaired"
1689
1691
  }));
1690
1692
  }
1691
1693
  if (status.protocolCompatible === false) {
1692
- return fail5(new ExtensionProtocolIncompatible({
1694
+ return fail6(new ExtensionProtocolIncompatible({
1693
1695
  message: status.nextStep ?? extensionProtocolAdvice(status.protocolVersion, { install: installCommand() }),
1694
1696
  protocolVersion: status.protocolVersion ?? null
1695
1697
  }));
1696
1698
  }
1697
- return status.connected ? succeed6(status) : fail5(new ExtensionDisconnected({
1699
+ return status.connected ? succeed6(status) : fail6(new ExtensionDisconnected({
1698
1700
  message: status.nextStep ?? `browse extension is not connected. Open the browser with browse installed (\`${installCommand()}\`); it reconnects automatically after relay or browser startup.`,
1699
1701
  needsPairing: status.pairingState === "refused" || status.pairingState === "unpaired"
1700
1702
  }));
@@ -1721,7 +1723,7 @@ function statusCollections(status) {
1721
1723
  return status.sessions && status.targets ? { sessions: status.sessions, targets: status.targets } : undefined;
1722
1724
  }
1723
1725
  function startManagedRelay(entrypoint = loadedCliEntrypoint, executable = process2.execPath, execArgv = process2.execArgv, options = {}) {
1724
- return try_({
1726
+ return try_2({
1725
1727
  try: () => {
1726
1728
  if (!entrypoint) {
1727
1729
  throw new Error("Cannot locate the browse CLI entrypoint");