@ghostlytools/cli 1.13.0 → 1.13.2

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 (113) hide show
  1. package/README.md +13 -10
  2. package/dist/assets/api-DV52o7A8.js +3 -0
  3. package/dist/assets/{api-CjOaoG-v.js → api-O57SNJcb.js} +495 -99
  4. package/dist/assets/api-O57SNJcb.js.map +1 -0
  5. package/dist/assets/{apiKit-BAGvlQtm.js → apiKit-CPTFJHA7.js} +40 -8
  6. package/dist/assets/{apiKit-BAGvlQtm.js.map → apiKit-CPTFJHA7.js.map} +1 -1
  7. package/dist/assets/{appFetch-BwJd-kNq.js → appFetch-Ca9DNQQ2.js} +2 -2
  8. package/dist/assets/{appFetch-BwJd-kNq.js.map → appFetch-Ca9DNQQ2.js.map} +1 -1
  9. package/dist/assets/{apps-Cuk45sz5.js → apps-gXpGFPiv.js} +16 -14
  10. package/dist/assets/apps-gXpGFPiv.js.map +1 -0
  11. package/dist/assets/{apps-DjY095Af.js → apps-uZTu5FlR.js} +1 -1
  12. package/dist/assets/{arkade-DryM-q5n.js → arkade-B6UNf5HI.js} +2 -2
  13. package/dist/assets/{arkade-DryM-q5n.js.map → arkade-B6UNf5HI.js.map} +1 -1
  14. package/dist/assets/{backup-DekVCDWv.js → backup-CxH3auHB.js} +9 -7
  15. package/dist/assets/backup-CxH3auHB.js.map +1 -0
  16. package/dist/assets/{backup-B56sQqoQ.js → backup-Di2U6QVH.js} +1 -1
  17. package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js.map +1 -1
  18. package/dist/assets/{bitcoind-B2bbVSzh.js → bitcoind-BpZn3bRN.js} +2 -2
  19. package/dist/assets/{bitcoind-B2bbVSzh.js.map → bitcoind-BpZn3bRN.js.map} +1 -1
  20. package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js.map +1 -1
  21. package/dist/assets/{buttons-BGxzOtrq.js → buttons-D4udKEvT.js} +8 -8
  22. package/dist/assets/buttons-D4udKEvT.js.map +1 -0
  23. package/dist/assets/buttons-YTYEqvGC.js +1 -0
  24. package/dist/assets/{client-DcQAfc3h.js → client-DGx7E8b3.js} +3 -3
  25. package/dist/assets/{client-DcQAfc3h.js.map → client-DGx7E8b3.js.map} +1 -1
  26. package/dist/assets/{domainProofs-BDNP1dIy.js → domainProofs-b3Y1Gj9g.js} +6 -2
  27. package/dist/assets/{domainProofs-BDNP1dIy.js.map → domainProofs-b3Y1Gj9g.js.map} +1 -1
  28. package/dist/assets/{engineErrors--9hfgKlK.js → engineErrors-wWlLy54D.js} +11 -3
  29. package/dist/assets/engineErrors-wWlLy54D.js.map +1 -0
  30. package/dist/assets/{errors-DDLFO4Gf.js → errors-JVJsO8Iu.js} +18 -2
  31. package/dist/assets/errors-JVJsO8Iu.js.map +1 -0
  32. package/dist/assets/{fixedHosts-C3hBliM9.js → fixedHosts-CODN2pTL.js} +3 -3
  33. package/dist/assets/{fixedHosts-C3hBliM9.js.map → fixedHosts-CODN2pTL.js.map} +1 -1
  34. package/dist/assets/{ghostly_iroh_web-DIj5xGmR.js → ghostly_iroh_web-9VOwZcJQ.js} +30 -35
  35. package/dist/assets/ghostly_iroh_web-9VOwZcJQ.js.map +1 -0
  36. package/dist/assets/ghostly_iroh_web_bg.wasm +0 -0
  37. package/dist/assets/{groupMeta-goASqzOt.js → groupMeta-CeZpqVVC.js} +174 -37
  38. package/dist/assets/groupMeta-CeZpqVVC.js.map +1 -0
  39. package/dist/assets/{host-C2WRKj3g.js → host-CRA7h5A2.js} +270 -64
  40. package/dist/assets/host-CRA7h5A2.js.map +1 -0
  41. package/dist/assets/{hyperdhtRelay-DLUiwfnt.js → hyperdhtRelay-B34Zhz4P.js} +2 -2
  42. package/dist/assets/{hyperdhtRelay-DLUiwfnt.js.map → hyperdhtRelay-B34Zhz4P.js.map} +1 -1
  43. package/dist/assets/{hyperdhtRelay-bjNGacf5.js → hyperdhtRelay-DDwU5b4P.js} +2 -2
  44. package/dist/assets/{hyperdhtRelay-bjNGacf5.js.map → hyperdhtRelay-DDwU5b4P.js.map} +1 -1
  45. package/dist/assets/{identityProofs-Cksc_K7_.js → identityProofs-B8zCp5_0.js} +140 -27
  46. package/dist/assets/identityProofs-B8zCp5_0.js.map +1 -0
  47. package/dist/assets/{irohWeb-NfthOL98.js → irohWeb-mnOi2Jp7.js} +10838 -4837
  48. package/dist/assets/irohWeb-mnOi2Jp7.js.map +1 -0
  49. package/dist/assets/{linkPreview-DdMf-YAc.js → linkPreview-5kHmKUTN.js} +20 -8
  50. package/dist/assets/linkPreview-5kHmKUTN.js.map +1 -0
  51. package/dist/assets/{main-Dh7fePd8.js → main-Chc871HV.js} +119 -81
  52. package/dist/assets/main-Chc871HV.js.map +1 -0
  53. package/dist/assets/{mainline-DY95WbuK.js → mainline-CDUXtV-I.js} +2 -2
  54. package/dist/assets/{mainline-DY95WbuK.js.map → mainline-CDUXtV-I.js.map} +1 -1
  55. package/dist/assets/{networkReason-Be-hMghr.js → networkReason-DYlPZS5M.js} +2 -2
  56. package/dist/assets/{networkReason-Be-hMghr.js.map → networkReason-DYlPZS5M.js.map} +1 -1
  57. package/dist/assets/{ownDid-BErplN7N.js → ownDid-BOuSlDv-.js} +10 -6
  58. package/dist/assets/ownDid-BOuSlDv-.js.map +1 -0
  59. package/dist/assets/{ownStatus-ClrFjd7h.js → ownStatus-CLA1VPkL.js} +6 -6
  60. package/dist/assets/{ownStatus-ClrFjd7h.js.map → ownStatus-CLA1VPkL.js.map} +1 -1
  61. package/dist/assets/{pairedTransports-BKmvlKz1.js → pairedTransports-DAzupLYo.js} +23 -17
  62. package/dist/assets/pairedTransports-DAzupLYo.js.map +1 -0
  63. package/dist/assets/{paymentIntent-DySU3Ajm.js → paymentIntent-Cr3uZa_0.js} +2 -2
  64. package/dist/assets/{paymentIntent-DySU3Ajm.js.map → paymentIntent-Cr3uZa_0.js.map} +1 -1
  65. package/dist/assets/{profiles-B8xO8-oj.js → profiles-BH1bH9aE.js} +3 -3
  66. package/dist/assets/{profiles-B8xO8-oj.js.map → profiles-BH1bH9aE.js.map} +1 -1
  67. package/dist/assets/{registry--Rg2YvOH.js → registry-DAq16T-V.js} +1 -1
  68. package/dist/assets/{registry-CU8PevhI.js → registry-DP_-RA-v.js} +11 -7
  69. package/dist/assets/registry-DP_-RA-v.js.map +1 -0
  70. package/dist/assets/{relay-CHWg5hpZ.js → relay-gJTOYQJZ.js} +93 -7
  71. package/dist/assets/relay-gJTOYQJZ.js.map +1 -0
  72. package/dist/assets/{resolve-B1upovPM.js → resolve-B1eQ4dVQ.js} +10 -5
  73. package/dist/assets/resolve-B1eQ4dVQ.js.map +1 -0
  74. package/dist/assets/secretGuard-Bh11MPdI.js +1 -0
  75. package/dist/assets/{secretGuard-BrATm_gl.js → secretGuard-oz_3hBfW.js} +19 -2
  76. package/dist/assets/{secretGuard-BrATm_gl.js.map → secretGuard-oz_3hBfW.js.map} +1 -1
  77. package/dist/assets/{server-Dgxx_DaN.js → server-Bd2ofxc1.js} +1283 -6628
  78. package/dist/assets/server-Bd2ofxc1.js.map +1 -0
  79. package/dist/assets/{sshForges-BnvwmNj-.js → sshForges-As7dbGXM.js} +2 -2
  80. package/dist/assets/{sshForges-BnvwmNj-.js.map → sshForges-As7dbGXM.js.map} +1 -1
  81. package/dist/assets/{translate-BcbSWkuq.js → translate-DnuQMfj0.js} +22 -11
  82. package/dist/assets/translate-DnuQMfj0.js.map +1 -0
  83. package/dist/assets/{usdt-CBJ4Q5Ji.js → usdt-DLmtf8F9.js} +4 -4
  84. package/dist/assets/{usdt-CBJ4Q5Ji.js.map → usdt-DLmtf8F9.js.map} +1 -1
  85. package/dist/assets/{waitNotice-ylU3XwjO.js → waitNotice-BHuMofaH.js} +57 -3
  86. package/dist/assets/waitNotice-BHuMofaH.js.map +1 -0
  87. package/dist/ghostly.mjs +1 -1
  88. package/npm-shrinkwrap.json +2 -2
  89. package/package.json +1 -1
  90. package/dist/assets/api-CVtg7MpI.js +0 -3
  91. package/dist/assets/api-CjOaoG-v.js.map +0 -1
  92. package/dist/assets/apps-Cuk45sz5.js.map +0 -1
  93. package/dist/assets/backup-DekVCDWv.js.map +0 -1
  94. package/dist/assets/buttons-BGxzOtrq.js.map +0 -1
  95. package/dist/assets/buttons-CsN2WJOf.js +0 -1
  96. package/dist/assets/engineErrors--9hfgKlK.js.map +0 -1
  97. package/dist/assets/errors-DDLFO4Gf.js.map +0 -1
  98. package/dist/assets/ghostly_iroh_web-DIj5xGmR.js.map +0 -1
  99. package/dist/assets/groupMeta-goASqzOt.js.map +0 -1
  100. package/dist/assets/host-C2WRKj3g.js.map +0 -1
  101. package/dist/assets/identityProofs-Cksc_K7_.js.map +0 -1
  102. package/dist/assets/irohWeb-NfthOL98.js.map +0 -1
  103. package/dist/assets/linkPreview-DdMf-YAc.js.map +0 -1
  104. package/dist/assets/main-Dh7fePd8.js.map +0 -1
  105. package/dist/assets/ownDid-BErplN7N.js.map +0 -1
  106. package/dist/assets/pairedTransports-BKmvlKz1.js.map +0 -1
  107. package/dist/assets/registry-CU8PevhI.js.map +0 -1
  108. package/dist/assets/relay-CHWg5hpZ.js.map +0 -1
  109. package/dist/assets/resolve-B1upovPM.js.map +0 -1
  110. package/dist/assets/secretGuard-Bm6nci0I.js +0 -1
  111. package/dist/assets/server-Dgxx_DaN.js.map +0 -1
  112. package/dist/assets/translate-BcbSWkuq.js.map +0 -1
  113. package/dist/assets/waitNotice-ylU3XwjO.js.map +0 -1
@@ -1,17 +1,17 @@
1
1
  import { p as fileStore } from "./idb-ewvbqyDI.js";
2
- import { _ as groupPayTwins, d as servedApps, f as nodeLocalFetch, g as groupMessageJson, h as groupJson, l as paymentJson, m as chatMessageJson, p as chatJson, r as callApi, u as reportAppFrames, v as resumeHolds, y as flushCardUpdates } from "./api-CjOaoG-v.js";
3
- import { N as sinceSeq, s as findChat, u as findOwnNamedChat } from "./apiKit-BAGvlQtm.js";
4
- import { r as asCliError, t as CliError } from "./errors-DDLFO4Gf.js";
5
- import { C as ownFolder, D as runtimePath, E as privateFolder, n as RESTORED_MARK, r as acquireLock, w as ownProfile, x as startingPath } from "./profiles-B8xO8-oj.js";
6
- import { _ as frameBytes, b as monotonic, d as proof, f as removeDaemonSecret, g as bytesToMs, h as PlaybackQueue, l as greeting, m as DEFAULT_RATE, u as newDaemonSecret, v as frameSamples, y as isCallRate } from "./client-DcQAfc3h.js";
7
- import { Bi as buildSdpFromSignal, Gi as parseCallSignal, Hi as callSignalHeardAt, Ii as CALL_SIGNAL_MAX_AGE_MS, Ki as signalHasVideo, Ri as RTC_CONFIG, Vi as callRtcConfig, Wi as extractParamsFromSdp, Zt as checkPushEndpoint, bi as DAEMON_WATCH_PEER_IDLE_MS, gn as ACTIVE_DHT_POLL_MS, xt as STATUS_IDLE_AFTER_MS, zi as answersOffer } from "./groupMeta-goASqzOt.js";
8
- import { d as parsePayLink, r as irohRelayProblem } from "./irohWeb-NfthOL98.js";
2
+ import { _ as groupJson, b as resumeHolds, d as reportAppFrames, f as servedApps, g as chatMessageJson, h as chatJson, p as nodeLocalFetch, r as callApi, u as paymentJson, v as groupMessageJson, x as flushCardUpdates, y as groupPayTwins } from "./api-O57SNJcb.js";
3
+ import { I as sinceSeq, s as findChat, u as findOwnNamedChat } from "./apiKit-CPTFJHA7.js";
4
+ import { o as shownValue, r as asCliError, t as CliError } from "./errors-JVJsO8Iu.js";
5
+ import { C as ownFolder, D as runtimePath, E as privateFolder, n as RESTORED_MARK, r as acquireLock, w as ownProfile, x as startingPath } from "./profiles-BH1bH9aE.js";
6
+ import { _ as frameBytes, b as monotonic, d as proof, f as removeDaemonSecret, g as bytesToMs, h as PlaybackQueue, l as greeting, m as DEFAULT_RATE, u as newDaemonSecret, v as frameSamples, y as isCallRate } from "./client-DGx7E8b3.js";
7
+ import { Ci as DAEMON_WATCH_PEER_IDLE_MS, Gi as callSignalHeardAt, Hi as answersOffer, Ji as parseCallSignal, Qt as checkPushEndpoint, St as STATUS_IDLE_AFTER_MS, Ui as buildSdpFromSignal, Vi as RTC_CONFIG, Wi as callRtcConfig, Yi as signalHasVideo, _n as ACTIVE_DHT_POLL_MS, qi as extractParamsFromSdp, zi as CALL_SIGNAL_MAX_AGE_MS } from "./groupMeta-CeZpqVVC.js";
8
+ import { g as parsePayLink, r as irohRelayProblem } from "./irohWeb-mnOi2Jp7.js";
9
9
  import { i as fromBase64Url } from "./bytes-C1DNGY18.js";
10
- import { u as setLinkTraceSink } from "./relay-CHWg5hpZ.js";
10
+ import { u as setLinkTraceSink } from "./relay-gJTOYQJZ.js";
11
11
  import { b as setPublicKeyFastPath } from "./pkarr-BQo4PcCg.js";
12
- import { p as nativePublicKey } from "./apps-Cuk45sz5.js";
12
+ import { p as nativePublicKey } from "./apps-gXpGFPiv.js";
13
13
  import { n as fedimintSdkOn } from "./fedimintSdk-D-6H9Pe7.js";
14
- import { s as isPublicAddress } from "./domainProofs-BDNP1dIy.js";
14
+ import { s as isPublicAddress } from "./domainProofs-b3Y1Gj9g.js";
15
15
  import { createRequire } from "node:module";
16
16
  import { appendFileSync, chmodSync, closeSync, existsSync, fstatSync, fsync, fsyncSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, statSync, truncateSync, writeFileSync, writeSync } from "node:fs";
17
17
  import { open, readFile } from "node:fs/promises";
@@ -658,7 +658,7 @@ function envSwitch(name, fallback, env = process.env) {
658
658
  if (value === void 0 || value.trim() === "") return fallback;
659
659
  if (OFF.test(value.trim())) return false;
660
660
  if (ON.test(value.trim())) return true;
661
- throw new CliError("usage", `${name} takes 0 or 1 (or false/true, off/on, no/yes), not ${JSON.stringify(value)}`);
661
+ throw new CliError("usage", `${name} takes 0 or 1 (or false/true, off/on, no/yes), not ${shownValue(value)}`);
662
662
  }
663
663
  // src/runtime/rtcThreads.ts
664
664
  /**
@@ -1289,7 +1289,7 @@ var CallManager = class {
1289
1289
  this.held.delete(chat);
1290
1290
  this.bursts.delete(chat);
1291
1291
  const link = this.link(chat);
1292
- const call = this.add(chat, "in", this.auto.rate);
1292
+ const call = this.add(chat, "in", DEFAULT_RATE);
1293
1293
  call.offer = offer;
1294
1294
  call.video = signalHasVideo(offer);
1295
1295
  this.arm(call, Math.max(1e3, callSignalHeardAt(offer) + CALL_SIGNAL_MAX_AGE_MS - this.now), "missed", false);
@@ -1301,7 +1301,7 @@ var CallManager = class {
1301
1301
  auto: this.autoFor(chat)
1302
1302
  });
1303
1303
  this.prepare(call);
1304
- if (this.host.answers !== false && this.autoFor(chat)) this.answer(call.id, {}).catch((error) => process.stderr.write(`ghostly: auto-answer failed: ${error instanceof Error ? error.message : String(error)}\n`));
1304
+ if (this.host.answers !== false && this.autoFor(chat)) this.answer(call.id, { rate: this.auto.rate }).catch((error) => process.stderr.write(`ghostly: auto-answer failed: ${error instanceof Error ? error.message : String(error)}\n`));
1305
1305
  }
1306
1306
  accepted(call, answer) {
1307
1307
  call.offering = false;
@@ -1464,7 +1464,7 @@ var CallManager = class {
1464
1464
  throw new CliError("busy", "The contact is calling: their call rings here");
1465
1465
  }
1466
1466
  this.paced(link.id);
1467
- const rate = rateOf(options.rate, this.auto.rate);
1467
+ const rate = rateOf(options.rate, DEFAULT_RATE);
1468
1468
  const stack = await this.stack();
1469
1469
  if (this.byChat(link.id)) throw new CliError("busy", "A call is already on in this chat");
1470
1470
  const call = this.add(link.id, "out", rate);
@@ -1896,12 +1896,25 @@ var CallManager = class {
1896
1896
  byChat(chat) {
1897
1897
  for (const call of this.calls.values()) if (call.chat === chat) return call;
1898
1898
  }
1899
- /** A call by its id, or by its chat; with no ref, the only call (or the only one `prefer` picks). */
1899
+ /**
1900
+ * A call by its id, or by its chat; with no ref, the only call (or the only one `prefer` picks). A ref shaped as a
1901
+ * call's id (`CALL_ID`) that names no call on now and no chat says so as a call: it ended (hung up twice, or a
1902
+ * command racing the call's end) or never was one. It said `No chat "<id>"`, sending a script to the chat list. A
1903
+ * chat whose id or label has that shape is still found as a chat first. An ended call is not kept (`end`), so
1904
+ * whether it ended or never was is not known here.
1905
+ */
1900
1906
  find(ref, prefer) {
1901
1907
  if (ref) {
1902
1908
  const byId = this.calls.get(ref);
1903
1909
  if (byId) return byId;
1904
- const call = this.byChat(this.chatOf(ref).id);
1910
+ let chat;
1911
+ try {
1912
+ chat = this.chatOf(ref);
1913
+ } catch (error) {
1914
+ if (CALL_ID.test(ref) && error instanceof CliError && error.code === "not_found" && !error.details) throw new CliError("not_found", `No call ${ref}: it ended or never existed (ghostly call list)`);
1915
+ throw error;
1916
+ }
1917
+ const call = this.byChat(chat.id);
1905
1918
  if (!call) throw new CliError("not_found", `No call in chat ${ref}`);
1906
1919
  return call;
1907
1920
  }
@@ -1942,6 +1955,8 @@ var CallManager = class {
1942
1955
  return this.auto.on && (this.auto.from.length === 0 || this.auto.from.includes(chat));
1943
1956
  }
1944
1957
  };
1958
+ /** A call's id as `add` makes it: 6 random bytes in lowercase hex. */
1959
+ var CALL_ID = /^[0-9a-f]{12}$/;
1945
1960
  var CALLS_NEED_DAEMON = "Calls need the daemon (a call outlives this command): start it with `ghostly daemon --detach`";
1946
1961
  /** The engine's `callsUnavailable` for a chat with no live session (ghostlink's, or node.ts's with no link running). */
1947
1962
  var CALLS_NEED_LIVE = "Calls need a live connection";
@@ -3694,7 +3709,8 @@ var GroupAutoJoin = class {
3694
3709
  * every change of the engine's state. One whose accept fails (the contact is not connected yet) is tried again on a
3695
3710
  * later change. Another contact who knows the group's id may have invited first: the engine then keeps the granted
3696
3711
  * one beside it (`others`), and it is the one taken (`switchGroup`, which tells the other contact no), as long as the
3697
- * group held is only an invitation not answered yet. One beside a group joined or accepted waits for the person.
3712
+ * group held is only an invitation not answered yet. One beside a group joined or accepted, or beside an invitation
3713
+ * that keeps a group this device was in (`kept`: switching would delete its history), waits for the person.
3698
3714
  */
3699
3715
  check(state) {
3700
3716
  if (!this.host.joins || !this.grants.length) return;
@@ -3719,7 +3735,7 @@ var GroupAutoJoin = class {
3719
3735
  const other = group.others?.find((o) => "linkId" in o && granted(o.linkId));
3720
3736
  if (!other || !("linkId" in other)) continue;
3721
3737
  const held = group.invitation;
3722
- if (group.status === void 0 && held && !held.accepted && !held.viaLink) {
3738
+ if (group.status === void 0 && held && !held.accepted && !held.viaLink && !held.kept) {
3723
3739
  this.accept(group.id, other.linkId, true);
3724
3740
  continue;
3725
3741
  }
@@ -4016,6 +4032,46 @@ async function nodePushSend(push, lookup = publicOnlyLookup) {
4016
4032
  req.end(push.body);
4017
4033
  });
4018
4034
  }
4035
+ // src/runtime/groupCallFetch.ts
4036
+ /**
4037
+ * How the CLI asks a group's call node (WISP 602 § The token request, § Moderation) at the origin the group's admin
4038
+ * named: an HTTPS POST only at a public address, or at a name whose every address is public, checked when the
4039
+ * connection is made, as an identity's proof is read (./publicFetch.ts). No redirect is followed (one is answered as it
4040
+ * came: the engine takes only a 2xx), no proxy, no cookie. The engine bounds the time and the size of the reply.
4041
+ */
4042
+ function nodeGroupCallFetch(lookup = publicOnlyLookup) {
4043
+ return async (input, init) => {
4044
+ const url = new URL(typeof input === "string" ? input : input instanceof URL ? input.href : input.url);
4045
+ if (url.protocol !== "https:") throw new TypeError("Only HTTPS is sent");
4046
+ if ((init?.method ?? "GET").toUpperCase() !== "POST") throw new TypeError("Only POST is sent");
4047
+ const host = url.hostname.replace(/^\[|\]$/g, "");
4048
+ if (isIP(host) && !isPublicIp(host)) throw new TypeError(`${host} is not a public address`);
4049
+ const body = typeof init?.body === "string" ? init.body : "";
4050
+ const headers = {
4051
+ ...Object.fromEntries(new Headers(init?.headers)),
4052
+ "content-length": String(Buffer.byteLength(body))
4053
+ };
4054
+ return new Promise((resolve, reject) => {
4055
+ const req = request(url, {
4056
+ method: "POST",
4057
+ headers,
4058
+ lookup,
4059
+ agent: false,
4060
+ signal: init?.signal ?? void 0
4061
+ }, (res) => {
4062
+ const out = new Headers();
4063
+ for (const [name, value] of Object.entries(res.headers)) if (typeof value === "string") out.set(name, value);
4064
+ const status = res.statusCode ?? 0;
4065
+ resolve(new Response(status === 204 || status === 304 ? null : Readable.toWeb(res), {
4066
+ status,
4067
+ headers: out
4068
+ }));
4069
+ });
4070
+ req.on("error", reject);
4071
+ req.end(body);
4072
+ });
4073
+ };
4074
+ }
4019
4075
  // src/runtime/holdFetch.ts
4020
4076
  /**
4021
4077
  * How the CLI reads a held item or manifest (WISP 404): a GET to the address the contact chose, only
@@ -4095,6 +4151,23 @@ function nodePublicFetch(lookup = publicOnlyLookup) {
4095
4151
  }
4096
4152
  };
4097
4153
  }
4154
+ /**
4155
+ * How the CLI asks a Lightning address or LNURL service (WISP 205 § Transport), its redirects and its callback: as an
4156
+ * identity's address, at a name whose every address is public when it connects. The engine follows each redirect
4157
+ * itself (`redirect: "manual"`) and checks names only. A service the person named on this machine itself (a test
4158
+ * server, plain HTTP allowed) is asked as named.
4159
+ */
4160
+ function nodeLnurlFetch(lookup = publicOnlyLookup, local = (...request) => globalThis.fetch(...request)) {
4161
+ const publicFetch = nodePublicFetch(lookup);
4162
+ return (input, init) => {
4163
+ const url = new URL(typeof input === "string" ? input : input instanceof URL ? input.href : input.url);
4164
+ return [
4165
+ "localhost",
4166
+ "127.0.0.1",
4167
+ "[::1]"
4168
+ ].includes(url.hostname) ? local(input, init) : publicFetch(input, init);
4169
+ };
4170
+ }
4098
4171
  // src/runtime/irohRelay.ts
4099
4172
  /**
4100
4173
  * Whether the CLI's Iroh may dial a contact through the relay its descriptor names (irohWeb.ts `publicRelay`): at a
@@ -4360,15 +4433,25 @@ var TreeFile = class {
4360
4433
  abort(owner) {
4361
4434
  for (const tree of this.live) tree.abort(owner);
4362
4435
  }
4363
- /** The layers of the journal's entries up to `upTo` into SQLite, in one transaction that says so (`applied`). */
4364
- apply(upTo) {
4436
+ /** The name of the snapshot that the last fold's `apply` went with (`storage.ts`). */
4437
+ snapshot() {
4438
+ const row = this.db.prepare("SELECT value FROM meta WHERE name = 'snapshot'").get();
4439
+ return row ? String(row.value) : void 0;
4440
+ }
4441
+ /**
4442
+ * The layers of the journal's entries up to `upTo` into SQLite, in one transaction that says so (`applied`). `snapshot`:
4443
+ * the fold's, written whole before this and put in place after; recorded with them, so a process killed between the
4444
+ * two comes back to it, not to the snapshot before it with these transactions half there.
4445
+ */
4446
+ apply(upTo, snapshot) {
4365
4447
  const due = [...this.live].filter((tree) => tree.due(upTo));
4366
- if (!due.length) return;
4448
+ if (!due.length && snapshot === void 0) return;
4367
4449
  this.db.exec("BEGIN");
4368
4450
  try {
4369
4451
  let top = 0;
4370
4452
  for (const tree of due) top = Math.max(top, tree.write(upTo));
4371
4453
  this.db.prepare("INSERT OR REPLACE INTO meta (name, value) VALUES ('applied', max(?, coalesce((SELECT value FROM meta WHERE name = 'applied'), 0)))").run(top);
4454
+ if (snapshot !== void 0) this.db.prepare("INSERT OR REPLACE INTO meta (name, value) VALUES ('snapshot', ?)").run(snapshot);
4372
4455
  this.db.exec("COMMIT");
4373
4456
  } catch (error) {
4374
4457
  rollback(this.db);
@@ -4829,6 +4912,8 @@ var SEQ = "__ghostly_entry__";
4829
4912
  var CLOSE_WAIT_MS = 5e3;
4830
4913
  /** Records an export reads and serializes in one turn of the event loop, then writes: a few milliseconds' worth. */
4831
4914
  var EXPORT_PAGE = 256;
4915
+ /** How long a fold's snapshot serializes records before it writes them and lets the daemon's other work run. */
4916
+ var PAGE_MS = 5;
4832
4917
  /** How long a relaxed transaction's entry may wait for a sync when no other transaction brings one. */
4833
4918
  var RELAXED_SYNC_MS = 1e3;
4834
4919
  /**
@@ -4888,11 +4973,23 @@ async function openPersistentIndexedDb(dir, options = {}) {
4888
4973
  let holdsRatchet = false;
4889
4974
  /** The journal holds a delete of a chat or a message (or a settings write), and what came before it with it. */
4890
4975
  let holdsDelete = false;
4976
+ /** The exports under way (a backup's), each holding rows.db as it was when it began (`openTreeReader`). */
4977
+ const exporting = /* @__PURE__ */ new Set();
4978
+ /** The scrub's fold asked for that has not begun yet: a scrub asked meanwhile is that one (`compact`). */
4979
+ let nextScrub = null;
4891
4980
  const pending = /* @__PURE__ */ new WeakMap();
4892
4981
  const snapshotPath = join(dir, SNAPSHOT);
4893
4982
  const journalPath = join(dir, JOURNAL);
4983
+ const temporaryPath = snapshotPath + ".tmp";
4984
+ /** The last entry the snapshot on disk holds: one that waited behind its fold is not written to the journal after it. */
4985
+ let foldedUpTo = 0;
4894
4986
  const ratchetDue = () => holdsRatchet && Date.now() - (statSync(snapshotPath, { throwIfNoEntry: false })?.mtimeMs ?? 0) >= RATCHET_FOLD_MS;
4895
4987
  const deleteDue = () => holdsDelete && Date.now() - (statSync(snapshotPath, { throwIfNoEntry: false })?.mtimeMs ?? 0) >= DELETE_FOLD_MS;
4988
+ const foldedTo = trees?.snapshot();
4989
+ if (foldedTo !== void 0 && existsSync(temporaryPath) && journalNamed(temporaryPath) === foldedTo) {
4990
+ renameSync(temporaryPath, snapshotPath);
4991
+ rmSync(journalPath, { force: true });
4992
+ }
4896
4993
  const snapshotFound = existsSync(snapshotPath), journalFound = existsSync(journalPath);
4897
4994
  const saved = snapshotFound ? deserialize(readFileSync(snapshotPath)) : null;
4898
4995
  const rows = sqlite && saved?.format === 2 && rowsFound ? openRowFile(sqlite, rowsPath) : null;
@@ -5073,7 +5170,8 @@ async function openPersistentIndexedDb(dir, options = {}) {
5073
5170
  * text the engine had told the contact it held.
5074
5171
  */
5075
5172
  function append(ops, lazy, entry, owner, complete) {
5076
- holdsDelete ||= ops.some(deletes);
5173
+ const deleting = ops.some(deletes);
5174
+ holdsDelete ||= deleting;
5077
5175
  if (trees) ops = [{
5078
5176
  db: SEQ,
5079
5177
  store: "",
@@ -5096,10 +5194,14 @@ async function openPersistentIndexedDb(dir, options = {}) {
5096
5194
  held++;
5097
5195
  enqueue(async () => {
5098
5196
  try {
5197
+ if (entry <= foldedUpTo) return;
5099
5198
  if (writeEntry(serialize(await Promise.all(ops.map(async (op) => op.kind === "put" ? {
5100
5199
  ...op,
5101
5200
  value: await blobsToDisk(op.value)
5102
- } : op))), lazy ? "lazy" : "now")) written(entry);
5201
+ } : op))), lazy ? "lazy" : "now")) {
5202
+ holdsDelete ||= deleting;
5203
+ written(entry);
5204
+ }
5103
5205
  } catch (error) {
5104
5206
  failed(error);
5105
5207
  await writeSnapshot().catch(failed);
@@ -5315,7 +5417,10 @@ async function openPersistentIndexedDb(dir, options = {}) {
5315
5417
  }))
5316
5418
  };
5317
5419
  }
5318
- /** What is held, as a snapshot of format 3: the stores kept on disk say only that they are. */
5420
+ /**
5421
+ * What is held, as a snapshot of format 3: the stores kept on disk say only that they are. `upTo`: the last entry it
5422
+ * holds, the transactions whose layers go to the trees with it.
5423
+ */
5319
5424
  async function capture(journalName) {
5320
5425
  const snapshot = {
5321
5426
  format: 1,
@@ -5340,9 +5445,8 @@ async function openPersistentIndexedDb(dir, options = {}) {
5340
5445
  }
5341
5446
  const saved = {
5342
5447
  ...storeMeta(store),
5343
- records: []
5448
+ records: treeRecords(store.records).map(({ key, value }) => [key, value])
5344
5449
  };
5345
- for (const record of store.records.values()) saved.records.push([record.key, record.value]);
5346
5450
  stores.push(saved);
5347
5451
  held.push(saved);
5348
5452
  }
@@ -5352,8 +5456,12 @@ async function openPersistentIndexedDb(dir, options = {}) {
5352
5456
  stores
5353
5457
  });
5354
5458
  }
5355
- for (const store of held) for (const record of store.records) record[1] = await blobsToDisk(record[1]);
5356
- return snapshot;
5459
+ const upTo = seq;
5460
+ for (const store of held) for (const record of store.records) if (hasBlob(record[1])) record[1] = await blobsToDisk(record[1]);
5461
+ return {
5462
+ snapshot,
5463
+ upTo
5464
+ };
5357
5465
  }
5358
5466
  /**
5359
5467
  * The whole store as a snapshot of format 1 (every value inline, `rows.db` read), written to `file` as it is read: a
@@ -5410,7 +5518,7 @@ async function openPersistentIndexedDb(dir, options = {}) {
5410
5518
  out.begin("A", count);
5411
5519
  let written = 0;
5412
5520
  for (const record of Array.isArray(records) ? records : records.getAllRecords()) {
5413
- let value = Array.isArray(records) ? await blobsToDisk(record.value) : record.value;
5521
+ let value = Array.isArray(records) || hasBlob(record.value) ? await blobsToDisk(record.value) : record.value;
5414
5522
  if (meta.name === "links" && value && typeof value === "object" && "ratchetState" in value) {
5415
5523
  const { ratchetState: _ratchet, ...link } = value;
5416
5524
  value = link;
@@ -5434,29 +5542,35 @@ async function openPersistentIndexedDb(dir, options = {}) {
5434
5542
  }
5435
5543
  async function snapshotToDisk(scrub = false) {
5436
5544
  await synced();
5545
+ if (relaxed) {
5546
+ clearTimeout(relaxed);
5547
+ relaxed = null;
5548
+ }
5437
5549
  const name = randomBytes(8).toString("hex");
5438
- const snapshot = await capture(name);
5550
+ const { snapshot, upTo } = await capture(name);
5551
+ const live = trees ? liveTrees() : null;
5552
+ unsaved = false;
5553
+ const file = await open(temporaryPath, "w", 384);
5554
+ try {
5555
+ await writeSnapshotTo(file, snapshot);
5556
+ await file.sync();
5557
+ } finally {
5558
+ await file.close();
5559
+ }
5560
+ while (scrub && trees && exporting.size) await Promise.allSettled(exporting);
5439
5561
  if (trees) {
5440
- trees.apply(seq);
5562
+ trees.apply(upTo, name);
5441
5563
  if (scrub) trees.scrub();
5442
5564
  trees.sync();
5443
5565
  }
5444
- const temporary = snapshotPath + ".tmp";
5445
- const fd = openSync(temporary, "w", 384);
5566
+ renameSync(temporaryPath, snapshotPath);
5567
+ foldedUpTo = upTo;
5446
5568
  try {
5447
- writeAll(fd, serialize(snapshot));
5448
- fsyncSync(fd);
5449
- } finally {
5450
- closeSync(fd);
5451
- }
5452
- renameSync(temporary, snapshotPath);
5453
- try {
5454
- trees?.sweep(liveTrees());
5569
+ if (live) trees.sweep(/* @__PURE__ */ new Set([...live, ...liveTrees()]));
5455
5570
  } catch (error) {
5456
5571
  process.stderr.write(`ghostly: storage: old trees not removed: ${error instanceof Error ? error.message : String(error)}\n`);
5457
5572
  }
5458
5573
  snapshotName = name;
5459
- unsaved = false;
5460
5574
  if (relaxed) {
5461
5575
  clearTimeout(relaxed);
5462
5576
  relaxed = null;
@@ -5511,12 +5625,22 @@ async function openPersistentIndexedDb(dir, options = {}) {
5511
5625
  flush: () => queue,
5512
5626
  async compact(options) {
5513
5627
  await settled();
5514
- let thrown = null;
5515
- await enqueue(() => writeSnapshot(options?.scrub).catch((error) => {
5516
- thrown = { error };
5517
- throw error;
5518
- }));
5519
- if (thrown) throw thrown.error;
5628
+ const scrub = options?.scrub === true;
5629
+ if (scrub && nextScrub) return nextScrub;
5630
+ const fold = (async () => {
5631
+ while (scrub && exporting.size) await Promise.allSettled(exporting);
5632
+ let thrown = null;
5633
+ await enqueue(() => {
5634
+ if (scrub) nextScrub = null;
5635
+ return writeSnapshot(scrub).catch((error) => {
5636
+ thrown = { error };
5637
+ throw error;
5638
+ });
5639
+ });
5640
+ if (thrown) throw thrown.error;
5641
+ })();
5642
+ if (scrub) nextScrub = fold;
5643
+ return fold;
5520
5644
  },
5521
5645
  async close() {
5522
5646
  if (!writing) return;
@@ -5533,12 +5657,20 @@ async function openPersistentIndexedDb(dir, options = {}) {
5533
5657
  journalBytes,
5534
5658
  async exportSnapshot(path) {
5535
5659
  await settled();
5536
- const file = await open(path, "w", 384);
5660
+ const run = (async () => {
5661
+ const file = await open(path, "w", 384);
5662
+ try {
5663
+ await exportTo(file);
5664
+ await file.sync();
5665
+ } finally {
5666
+ await file.close();
5667
+ }
5668
+ })();
5669
+ exporting.add(run);
5537
5670
  try {
5538
- await exportTo(file);
5539
- await file.sync();
5671
+ await run;
5540
5672
  } finally {
5541
- await file.close();
5673
+ exporting.delete(run);
5542
5674
  }
5543
5675
  }
5544
5676
  };
@@ -5548,6 +5680,44 @@ function writeAll(fd, bytes) {
5548
5680
  for (let at = 0; at < bytes.length;) at += writeSync(fd, bytes, at);
5549
5681
  }
5550
5682
  /**
5683
+ * A snapshot to `file`, its records `EXPORT_PAGE` at a time (or fewer, large ones: `PAGE_MS` of the thread) with a write
5684
+ * between: what `serialize(snapshot)` would write.
5685
+ */
5686
+ async function writeSnapshotTo(file, snapshot) {
5687
+ const out = new SnapshotWriter(file);
5688
+ const { databases, ...head } = snapshot;
5689
+ out.begin("o");
5690
+ for (const [key, value] of Object.entries(head)) out.value(key, value);
5691
+ out.key("databases");
5692
+ out.begin("A", databases.length);
5693
+ for (const { stores, ...db } of databases) {
5694
+ out.begin("o");
5695
+ for (const [key, value] of Object.entries(db)) out.value(key, value);
5696
+ out.key("stores");
5697
+ out.begin("A", stores.length);
5698
+ for (const { records, ...meta } of stores) {
5699
+ out.begin("o");
5700
+ for (const [key, value] of Object.entries(meta)) out.value(key, value);
5701
+ out.key("records");
5702
+ out.begin("A", records.length);
5703
+ let due = performance.now() + PAGE_MS;
5704
+ for (let at = 0; at < records.length; at++) {
5705
+ out.item(records[at]);
5706
+ if ((at + 1) % EXPORT_PAGE !== 0 && performance.now() < due) continue;
5707
+ await out.flush();
5708
+ due = performance.now() + PAGE_MS;
5709
+ }
5710
+ out.end("A", records.length);
5711
+ out.end("o", Object.keys(meta).length + 1);
5712
+ }
5713
+ out.end("A", stores.length);
5714
+ out.end("o", Object.keys(db).length + 1);
5715
+ }
5716
+ out.end("A", databases.length);
5717
+ out.end("o", Object.keys(head).length + 1);
5718
+ await out.flush();
5719
+ }
5720
+ /**
5551
5721
  * A value v8 would serialize whole, written in pieces: the objects and arrays around the records begun and ended here
5552
5722
  * by hand, as v8 itself writes them, and the records serialized a page at a time, each page's bytes to `file`. A reader
5553
5723
  * gets what `deserialize` of `serialize(value)` gives (the bytes differ at most by v8's alignment padding before a
@@ -5666,6 +5836,14 @@ function follows(journal) {
5666
5836
  return;
5667
5837
  }
5668
5838
  }
5839
+ /** The name a snapshot file gives the journal after it; undefined for one cut short (a fold killed while it wrote it). */
5840
+ function journalNamed(path) {
5841
+ try {
5842
+ return deserialize(readFileSync(path)).journal;
5843
+ } catch {
5844
+ return;
5845
+ }
5846
+ }
5669
5847
  /** fake-indexeddb's raw classes, from a throwaway database (they are not exported). */
5670
5848
  async function probeClasses(factory) {
5671
5849
  const db = await new Promise((resolve, reject) => {
@@ -6071,6 +6249,24 @@ function absent(keyPath, value) {
6071
6249
  return false;
6072
6250
  }
6073
6251
  /**
6252
+ * A store's records in key order, read off fake-indexeddb's red-black tree node by node: its own iterator nests a
6253
+ * generator per level and checks the range at each node, 360 ms of the daemon's thread for a seen set of 300,000 notes.
6254
+ */
6255
+ function treeRecords(store) {
6256
+ const records = [], above = [];
6257
+ for (let node = store.records._root; node || above.length;) {
6258
+ if (node) {
6259
+ above.push(node);
6260
+ node = node.left;
6261
+ continue;
6262
+ }
6263
+ node = above.pop();
6264
+ if (!node.deleted) records.push(node.record);
6265
+ node = node.right;
6266
+ }
6267
+ return records;
6268
+ }
6269
+ /**
6074
6270
  * fake-indexeddb's red-black tree, built balanced from sorted records: every level full but the last, whose nodes
6075
6271
  * are red, so each path holds the same number of black nodes and later inserts rebalance as usual.
6076
6272
  */
@@ -6215,6 +6411,7 @@ function keyFromDisk(key) {
6215
6411
  if (range.upper === void 0) return IDBKeyRange$1.lowerBound(range.lower, range.lowerOpen);
6216
6412
  return IDBKeyRange$1.bound(range.lower, range.upper, range.lowerOpen, range.upperOpen);
6217
6413
  }
6414
+ /** A Blob, or an object of the app's that has the marker's key itself (`blobsToDisk`): what goes to disk changed. */
6218
6415
  function hasBlob(value, depth = 0) {
6219
6416
  if (value instanceof Blob) return true;
6220
6417
  if (!value || typeof value !== "object" || depth > 32 || ArrayBuffer.isView(value) || value instanceof ArrayBuffer) return false;
@@ -6222,10 +6419,14 @@ function hasBlob(value, depth = 0) {
6222
6419
  for (const [k, v] of value) if (hasBlob(k, depth + 1) || hasBlob(v, depth + 1)) return true;
6223
6420
  return false;
6224
6421
  }
6422
+ if (Object.hasOwn(value, BLOB)) return true;
6225
6423
  for (const item of Object.values(value)) if (hasBlob(item, depth + 1)) return true;
6226
6424
  return false;
6227
6425
  }
6228
- /** v8 cannot serialize a Blob: it goes to disk as its bytes and type, and comes back a Blob. */
6426
+ /**
6427
+ * v8 cannot serialize a Blob: it goes to disk as its bytes and type, and comes back a Blob. An object of the app's
6428
+ * that has the marker's key itself (a contact's data can) goes in a marker too, as it is, so it never comes back a Blob.
6429
+ */
6229
6430
  async function blobsToDisk(value, depth = 0) {
6230
6431
  if (!hasBlob(value, depth)) return value;
6231
6432
  if (value instanceof Blob) return { [BLOB]: {
@@ -6236,17 +6437,20 @@ async function blobsToDisk(value, depth = 0) {
6236
6437
  if (value instanceof Map) return new Map(await Promise.all([...value].map(async ([k, v]) => [k, await blobsToDisk(v, depth + 1)])));
6237
6438
  const out = {};
6238
6439
  for (const [k, v] of Object.entries(value)) out[k] = await blobsToDisk(v, depth + 1);
6239
- return out;
6440
+ return Object.hasOwn(out, BLOB) ? { [BLOB]: { kept: out } } : out;
6240
6441
  }
6442
+ /** Only a marker this store wrote is one: its key alone, holding bytes (which no JSON makes) or an object it kept. */
6241
6443
  function blobsFromDisk(value, depth = 0) {
6242
6444
  if (!value || typeof value !== "object" || depth > 32 || ArrayBuffer.isView(value) || value instanceof ArrayBuffer) return value;
6243
- const blob = value[BLOB];
6244
- if (blob) return new Blob([blob.bytes], { type: blob.type });
6245
6445
  if (Array.isArray(value)) return value.map((item) => blobsFromDisk(item, depth + 1));
6246
6446
  if (value instanceof Map) return new Map([...value].map(([k, v]) => [k, blobsFromDisk(v, depth + 1)]));
6247
6447
  if (Object.getPrototypeOf(value) !== Object.prototype) return value;
6448
+ const marker = Object.keys(value).length === 1 ? value[BLOB] : void 0;
6449
+ const { type, bytes, kept } = marker && typeof marker === "object" ? marker : {};
6450
+ if (bytes instanceof Uint8Array && typeof type === "string") return new Blob([bytes], { type });
6451
+ const fields = kept && typeof kept === "object" && Object.getPrototypeOf(kept) === Object.prototype ? kept : value;
6248
6452
  const out = {};
6249
- for (const [k, v] of Object.entries(value)) out[k] = blobsFromDisk(v, depth + 1);
6453
+ for (const [k, v] of Object.entries(fields)) out[k] = blobsFromDisk(v, depth + 1);
6250
6454
  return out;
6251
6455
  }
6252
6456
  /**
@@ -6355,7 +6559,7 @@ function bootstrapNodes(name, env) {
6355
6559
  const port = /^[^\s:;/@[\]]+:(\d{1,5})$/.exec(node)?.[1];
6356
6560
  return !port || Number(port) < 1 || Number(port) > 65535;
6357
6561
  });
6358
- if (bad !== void 0) throw new CliError("usage", `${name} takes host:port nodes, comma-separated, not ${JSON.stringify(bad)}`);
6562
+ if (bad !== void 0) throw new CliError("usage", `${name} takes host:port nodes, comma-separated, not ${shownValue(bad)}`);
6359
6563
  return nodes;
6360
6564
  }
6361
6565
  /**
@@ -6367,7 +6571,7 @@ function pkarrRelays(env = process.env) {
6367
6571
  const relays = (env.GHOSTLY_PKARR_RELAYS ?? "").split(",").map((url) => url.trim()).filter(Boolean);
6368
6572
  if (!relays.length) return null;
6369
6573
  const bad = relays.find((url) => !/^https?:\/\/[^/\s]/i.test(url) || /[\s;]/.test(url) || !URL.canParse(url));
6370
- if (bad) throw new CliError("usage", `GHOSTLY_PKARR_RELAYS takes http:// or https:// URLs, comma-separated, not ${JSON.stringify(bad)}`);
6574
+ if (bad) throw new CliError("usage", `GHOSTLY_PKARR_RELAYS takes http:// or https:// URLs, comma-separated, not ${shownValue(bad)}`);
6371
6575
  return relays;
6372
6576
  }
6373
6577
  /**
@@ -6581,12 +6785,12 @@ async function startRuntime(paths, options = {}) {
6581
6785
  if (testMints) (await import("./mints-BcBODVVW.js")).declareTestMints(testMints.split(","));
6582
6786
  await installEventSource();
6583
6787
  await preloadWalletModules();
6584
- (await import("./ghostly_iroh_web-DIj5xGmR.js")).initSync({ module: irohWasmBytes() });
6788
+ (await import("./ghostly_iroh_web-9VOwZcJQ.js")).initSync({ module: irohWasmBytes() });
6585
6789
  const [{ registerFileBytes }, { NodeFileBytes }] = await Promise.all([import("./fileBytes-CCKbwqG_.js"), import("./fileBytes-tj6-VZcB.js")]);
6586
6790
  registerFileBytes("native", async () => new NodeFileBytes(paths.files), true);
6587
6791
  if (await (await import("./blobFiles-DDs34n0r.js")).moveBlobFiles()) await store.compact();
6588
- const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-Dgxx_DaN.js"), import("./endpoint-Cvu-taMs.js")]);
6589
- const mainline = dht.off ? null : new (await (import("./mainline-DY95WbuK.js"))).Mainline({
6792
+ const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-Bd2ofxc1.js"), import("./endpoint-Cvu-taMs.js")]);
6793
+ const mainline = dht.off ? null : new (await (import("./mainline-CDUXtV-I.js"))).Mainline({
6590
6794
  bootstrap: dht.bootstrap,
6591
6795
  host: dht.host
6592
6796
  });
@@ -6594,7 +6798,7 @@ async function startRuntime(paths, options = {}) {
6594
6798
  ...pinned ? { relays: pinned } : {},
6595
6799
  ...relayBudgetForTests()
6596
6800
  };
6597
- const transport = mainline || pinned ? new (await (import("./mainline-DY95WbuK.js"))).RelaysAndDht(mainline, relayOptions, !!pinned) : null;
6801
+ const transport = mainline || pinned ? new (await (import("./mainline-CDUXtV-I.js"))).RelaysAndDht(mainline, relayOptions, !!pinned) : null;
6598
6802
  const apps = servedApps(paths.dir).length > 0;
6599
6803
  const server = new EngineServer({
6600
6804
  ...transport ? { transport } : {},
@@ -6614,6 +6818,8 @@ async function startRuntime(paths, options = {}) {
6614
6818
  pushSend: (request) => nodePushSend(request),
6615
6819
  holdFetch: nodeHoldFetch(),
6616
6820
  identityFetch: nodePublicFetch(),
6821
+ groupCallFetch: nodeGroupCallFetch(),
6822
+ lnurlFetch: nodeLnurlFetch(),
6617
6823
  webrtcIgnoresRelayOnly: true,
6618
6824
  callsSupport: callsUnavailable === null,
6619
6825
  ...callsUnavailable ? { callsUnavailable } : {},
@@ -7054,4 +7260,4 @@ function connection(ctx, socket, secret, answering) {
7054
7260
  }
7055
7261
  export { BASELINE_NEWEST, MAX_UNREAD, STOP_ANSWERS_MS, keepServing, openHost, serve };
7056
7262
 
7057
- //# sourceMappingURL=host-C2WRKj3g.js.map
7263
+ //# sourceMappingURL=host-CRA7h5A2.js.map