@ghostlytools/cli 1.7.0 → 1.7.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 (90) hide show
  1. package/README.md +22 -12
  2. package/dist/assets/{api-BnCmJLiQ.js → api-CcuCtc1H.js} +2 -2
  3. package/dist/assets/{api-BIqr8SpM.js → api-tSZELCPQ.js} +133 -40
  4. package/dist/assets/api-tSZELCPQ.js.map +1 -0
  5. package/dist/assets/{apiKit-CWalYh1t.js → apiKit-BFk7GAk9.js} +9 -5
  6. package/dist/assets/{apiKit-CWalYh1t.js.map → apiKit-BFk7GAk9.js.map} +1 -1
  7. package/dist/assets/{apps-Bx3tXbJ9.js → apps-C5Mi6x9Q.js} +36 -13
  8. package/dist/assets/apps-C5Mi6x9Q.js.map +1 -0
  9. package/dist/assets/{apps-_hVUaHIT.js → apps-D6THreq_.js} +1 -1
  10. package/dist/assets/{arkade-AxrcyS1C.js → arkade-Cz0B9bJ0.js} +2 -2
  11. package/dist/assets/{arkade-AxrcyS1C.js.map → arkade-Cz0B9bJ0.js.map} +1 -1
  12. package/dist/assets/{backup-d_XvXpEK.js → backup-A0hIa9GE.js} +1 -1
  13. package/dist/assets/{backup-Y1V1Yxqr.js → backup-Wb2sm2dd.js} +6 -6
  14. package/dist/assets/{backup-Y1V1Yxqr.js.map → backup-Wb2sm2dd.js.map} +1 -1
  15. package/dist/assets/{blobFiles-B6nf0gCG.js → blobFiles-Bckz9fjp.js} +2 -2
  16. package/dist/assets/{blobFiles-B6nf0gCG.js.map → blobFiles-Bckz9fjp.js.map} +1 -1
  17. package/dist/assets/buttons-Bxxu3lSk.js +2 -0
  18. package/dist/assets/{buttons-BiQyQBb0.js → buttons-Cf70NVYq.js} +12 -7
  19. package/dist/assets/buttons-Cf70NVYq.js.map +1 -0
  20. package/dist/assets/{daemonProof-ui8jtIw0.js → daemonProof-Bp9lJDxf.js} +2 -2
  21. package/dist/assets/{daemonProof-ui8jtIw0.js.map → daemonProof-Bp9lJDxf.js.map} +1 -1
  22. package/dist/assets/{envelope-D3oeVhv8.js → envelope-kQ5kYjVE.js} +2 -2
  23. package/dist/assets/{envelope-D3oeVhv8.js.map → envelope-kQ5kYjVE.js.map} +1 -1
  24. package/dist/assets/{errors-CzXgR8Cc.js → errors-mnjSQlbX.js} +2 -1
  25. package/dist/assets/errors-mnjSQlbX.js.map +1 -0
  26. package/dist/assets/{fileBytes-BMEBas7S.js → fileBytes-BD0v3rRG.js} +10 -2
  27. package/dist/assets/{fileBytes-BMEBas7S.js.map → fileBytes-BD0v3rRG.js.map} +1 -1
  28. package/dist/assets/{fileBytes-CtwagJ8h.js → fileBytes-OolN5cSY.js} +1 -1
  29. package/dist/assets/{fileBytes-CFNrRfcl.js → fileBytes-_fd-2JRY.js} +2 -2
  30. package/dist/assets/{fileBytes-CFNrRfcl.js.map → fileBytes-_fd-2JRY.js.map} +1 -1
  31. package/dist/assets/fileBytesIdb-CsSQcSxD.js +2 -0
  32. package/dist/assets/{fileBytesIdb-BXAN7i-N.js → fileBytesIdb-NtA8r9EM.js} +2 -2
  33. package/dist/assets/{fileBytesIdb-BXAN7i-N.js.map → fileBytesIdb-NtA8r9EM.js.map} +1 -1
  34. package/dist/assets/{fileBytesOpfs-Do1Vpkis.js → fileBytesOpfs-B8fJwkwM.js} +3 -3
  35. package/dist/assets/{fileBytesOpfs-Do1Vpkis.js.map → fileBytesOpfs-B8fJwkwM.js.map} +1 -1
  36. package/dist/assets/{ghostly_iroh_web-BXCsSxxo.js → ghostly_iroh_web-CO0onry8.js} +33 -27
  37. package/dist/assets/ghostly_iroh_web-CO0onry8.js.map +1 -0
  38. package/dist/assets/ghostly_iroh_web_bg.wasm +0 -0
  39. package/dist/assets/{groupFiles-DU1wMGI9.js → groupFiles-D9Ttlm3M.js} +41 -25
  40. package/dist/assets/groupFiles-D9Ttlm3M.js.map +1 -0
  41. package/dist/assets/{host-DDMQfR7B.js → host-DpypH-fR.js} +44 -21
  42. package/dist/assets/host-DpypH-fR.js.map +1 -0
  43. package/dist/assets/{hyperdhtRelay-B2v8eqRd.js → hyperdhtRelay-D1rj84v2.js} +2 -2
  44. package/dist/assets/{hyperdhtRelay-B2v8eqRd.js.map → hyperdhtRelay-D1rj84v2.js.map} +1 -1
  45. package/dist/assets/{irohWeb-9RVIbF_l.js → irohWeb-BTSlWgEX.js} +3 -3
  46. package/dist/assets/{irohWeb-9RVIbF_l.js.map → irohWeb-BTSlWgEX.js.map} +1 -1
  47. package/dist/assets/{main-BNwNEPEy.js → main-BwgoQZVu.js} +270 -97
  48. package/dist/assets/main-BwgoQZVu.js.map +1 -0
  49. package/dist/assets/{mainline-RXv5_Fby.js → mainline-B1urhbEZ.js} +27 -8
  50. package/dist/assets/mainline-B1urhbEZ.js.map +1 -0
  51. package/dist/assets/{networkReason-CIn4yN9h.js → networkReason-D2Z0BdIj.js} +2 -2
  52. package/dist/assets/{networkReason-CIn4yN9h.js.map → networkReason-D2Z0BdIj.js.map} +1 -1
  53. package/dist/assets/{nwc-BNPzuT-6.js → nwc-T2aUK6bi.js} +3 -3
  54. package/dist/assets/{nwc-BNPzuT-6.js.map → nwc-T2aUK6bi.js.map} +1 -1
  55. package/dist/assets/{nwcProvider-C9Y6PUNC.js → nwcProvider-Dz-ty_DE.js} +2 -2
  56. package/dist/assets/{nwcProvider-C9Y6PUNC.js.map → nwcProvider-Dz-ty_DE.js.map} +1 -1
  57. package/dist/assets/{profiles-CEnZfN78.js → profiles-C6XWqre5.js} +92 -20
  58. package/dist/assets/profiles-C6XWqre5.js.map +1 -0
  59. package/dist/assets/{registry-B9aYHNNf.js → registry-Bazitl0a.js} +3 -3
  60. package/dist/assets/{registry-B9aYHNNf.js.map → registry-Bazitl0a.js.map} +1 -1
  61. package/dist/assets/{registry-DOkDhUAu.js → registry-BlSTJlbv.js} +1 -1
  62. package/dist/assets/{resolve-imkCgogd.js → resolve-Bx1Eeg-w.js} +2 -2
  63. package/dist/assets/{resolve-imkCgogd.js.map → resolve-Bx1Eeg-w.js.map} +1 -1
  64. package/dist/assets/{server-CB9_JuWZ.js → server-CnPj9wWh.js} +661 -229
  65. package/dist/assets/server-CnPj9wWh.js.map +1 -0
  66. package/dist/assets/{src-BBG_NwMc.js → src-BsznF3XG.js} +305 -83
  67. package/dist/assets/src-BsznF3XG.js.map +1 -0
  68. package/dist/assets/{translate-BcP139SV.js → translate-cDBotA-b.js} +11 -11
  69. package/dist/assets/{translate-BcP139SV.js.map → translate-cDBotA-b.js.map} +1 -1
  70. package/dist/assets/types-C4_KafL_.js.map +1 -1
  71. package/dist/assets/{usdt-C5Gf9-IC.js → usdt-DxxLdG60.js} +3 -3
  72. package/dist/assets/{usdt-C5Gf9-IC.js.map → usdt-DxxLdG60.js.map} +1 -1
  73. package/dist/assets/{words-ZUiQo4yo.js → words-qH8gGtmc.js} +2 -2
  74. package/dist/assets/{words-ZUiQo4yo.js.map → words-qH8gGtmc.js.map} +1 -1
  75. package/dist/ghostly.mjs +1 -1
  76. package/package.json +1 -1
  77. package/dist/assets/api-BIqr8SpM.js.map +0 -1
  78. package/dist/assets/apps-Bx3tXbJ9.js.map +0 -1
  79. package/dist/assets/buttons-BiQyQBb0.js.map +0 -1
  80. package/dist/assets/buttons-LO3Ql1Hd.js +0 -2
  81. package/dist/assets/errors-CzXgR8Cc.js.map +0 -1
  82. package/dist/assets/fileBytesIdb-C20oXDdr.js +0 -2
  83. package/dist/assets/ghostly_iroh_web-BXCsSxxo.js.map +0 -1
  84. package/dist/assets/groupFiles-DU1wMGI9.js.map +0 -1
  85. package/dist/assets/host-DDMQfR7B.js.map +0 -1
  86. package/dist/assets/main-BNwNEPEy.js.map +0 -1
  87. package/dist/assets/mainline-RXv5_Fby.js.map +0 -1
  88. package/dist/assets/profiles-CEnZfN78.js.map +0 -1
  89. package/dist/assets/server-CB9_JuWZ.js.map +0 -1
  90. package/dist/assets/src-BBG_NwMc.js.map +0 -1
@@ -1,10 +1,10 @@
1
- import { Fo as RTC_CONFIG, Ho as parseCallSignal, Io as answersOffer, Jl as setLinkTraceSink, Lo as buildSdpFromSignal, Po as CALL_SIGNAL_MAX_AGE_MS, Qr as checkPushEndpoint, Ro as callRtcConfig, Uo as signalHasVideo, Vo as extractParamsFromSdp, mu as fromBase64Url, wi as isPublicAddress, zo as callSignalHeardAt } from "./src-BBG_NwMc.js";
2
- import { a as fedimintSdkOn, r as irohRelayProblem } from "./irohWeb-9RVIbF_l.js";
3
- import { r as asCliError, t as CliError } from "./errors-CzXgR8Cc.js";
4
- import { a as findChat, c as findOwnNamedChat } from "./apiKit-CWalYh1t.js";
5
- import { _ as flushCardUpdates, c as paymentJson, d as nodeLocalFetch, f as chatJson, g as resumeHolds, h as groupMessageJson, l as reportAppFrames, m as groupJson, p as chatMessageJson, r as callApi, u as servedApps } from "./api-BIqr8SpM.js";
6
- import { g as ownFolder, n as RESTORED_MARK, r as acquireLock, v as privateFolder, y as runtimePath } from "./profiles-CEnZfN78.js";
7
- import { _ as isCallRate, f as DEFAULT_RATE, g as frameSamples, h as frameBytes, i as newDaemonSecret, m as bytesToMs, o as proof, p as PlaybackQueue, r as greeting, u as removeDaemonSecret } from "./daemonProof-ui8jtIw0.js";
1
+ import { Bo as callRtcConfig, Go as signalHasVideo, Io as CALL_SIGNAL_MAX_AGE_MS, Lo as RTC_CONFIG, Ql as setLinkTraceSink, Qr as checkPushEndpoint, Ro as answersOffer, Uo as extractParamsFromSdp, Vo as callSignalHeardAt, Wo as parseCallSignal, vu as fromBase64Url, wi as isPublicAddress, zo as buildSdpFromSignal } from "./src-BsznF3XG.js";
2
+ import { a as fedimintSdkOn, r as irohRelayProblem } from "./irohWeb-BTSlWgEX.js";
3
+ import { r as asCliError, t as CliError } from "./errors-mnjSQlbX.js";
4
+ import { a as findChat, c as findOwnNamedChat } from "./apiKit-BFk7GAk9.js";
5
+ import { _ as flushCardUpdates, c as paymentJson, d as nodeLocalFetch, f as chatJson, g as resumeHolds, h as groupMessageJson, l as reportAppFrames, m as groupJson, p as chatMessageJson, r as callApi, u as servedApps } from "./api-tSZELCPQ.js";
6
+ import { g as ownFolder, n as RESTORED_MARK, r as acquireLock, v as privateFolder, y as runtimePath } from "./profiles-C6XWqre5.js";
7
+ import { _ as isCallRate, f as DEFAULT_RATE, g as frameSamples, h as frameBytes, i as newDaemonSecret, m as bytesToMs, o as proof, p as PlaybackQueue, r as greeting, u as removeDaemonSecret } from "./daemonProof-Bp9lJDxf.js";
8
8
  import { createRequire } from "node:module";
9
9
  import { appendFileSync, chmodSync, closeSync, existsSync, fstatSync, fsyncSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
10
10
  import { readFile } from "node:fs/promises";
@@ -674,7 +674,8 @@ async function openConnection(stack, options, offer, held = false) {
674
674
  videoTrack = pc.addTrack(video);
675
675
  videoTrack.onMessage(() => {});
676
676
  }
677
- const gathered = gathering(pc, { turn: callUsesTurn(iceServers) });
677
+ const turn = callUsesTurn(iceServers);
678
+ const gathered = gathering(pc, { turn });
678
679
  if (offer) pc.setRemoteDescription(buildSdpFromSignal(held ? {
679
680
  ...offer,
680
681
  c: []
@@ -683,6 +684,7 @@ async function openConnection(stack, options, offer, held = false) {
683
684
  await gathered;
684
685
  const sdp = pc.localDescription()?.sdp;
685
686
  if (!sdp) throw new Error("No local description");
687
+ if (turn && !/ typ relay/.test(sdp)) log(`no relay address: the TURN server refused the allocation or did not answer in time`);
686
688
  const local = {
687
689
  ...extractParamsFromSdp(sdp, {
688
690
  maxCandidates: 8,
@@ -1096,9 +1098,14 @@ var CallManager = class {
1096
1098
  /**
1097
1099
  * The ringing call's answer, made now (`EarlyAnswer`): when the call is answered, its candidates have been gathered
1098
1100
  * and the answer goes at once. Made again every EARLY_ANSWER_MS while it rings; when it cannot be made, the answer makes its own.
1101
+ * Not made with a TURN server in the profile's settings: libjuice never gives an allocation back (no Refresh with
1102
+ * LIFETIME 0 when a connection closes), so each one held a relay on the server for 10 minutes, those of calls declined,
1103
+ * missed and cancelled too, and a server with a per-user quota refused the next calls theirs. The answer allocates.
1099
1104
  */
1100
1105
  prepare(call) {
1101
1106
  if (this.host.answers === false || call.ended || call.state !== "ringing") return;
1107
+ const iceServers = this.host.engine.getState().settings?.iceServers ?? [];
1108
+ if (callUsesTurn(callIceServers(iceServers))) return;
1102
1109
  this.stopEarly(call);
1103
1110
  call.earlyTimer = setTimeout(() => this.prepare(call), this.host.earlyAnswerMs ?? 3e4);
1104
1111
  call.earlyTimer.unref?.();
@@ -1109,7 +1116,7 @@ var CallManager = class {
1109
1116
  const making = {
1110
1117
  chat: call.chat,
1111
1118
  done: this.stack().then((stack) => EarlyAnswer.open(stack, offer, {
1112
- iceServers: this.host.engine.getState().settings?.iceServers ?? [],
1119
+ iceServers,
1113
1120
  log: (line) => process.stderr.write(`ghostly: call ${call.id}: ${line}\n`)
1114
1121
  })).catch((error) => {
1115
1122
  this.stopEarly(call);
@@ -4602,7 +4609,7 @@ function blobsFromDisk(value, depth = 0) {
4602
4609
  * for the Desktop's sidecar; a network all on loopback (the tests') is announced on loopback too.
4603
4610
  */
4604
4611
  function hyperdhtNetwork(env = process.env.GHOSTLY_HYPERDHT_BOOTSTRAP) {
4605
- const bootstrap = (env ?? "").split(",").map((node) => node.trim()).filter(Boolean);
4612
+ const bootstrap = bootstrapNodes("GHOSTLY_HYPERDHT_BOOTSTRAP", env);
4606
4613
  if (!bootstrap.length) return {};
4607
4614
  return {
4608
4615
  bootstrap,
@@ -4610,6 +4617,21 @@ function hyperdhtNetwork(env = process.env.GHOSTLY_HYPERDHT_BOOTSTRAP) {
4610
4617
  };
4611
4618
  }
4612
4619
  /**
4620
+ * A bootstrap variable's nodes ("host:port,…"), each checked: a host without a port, a port past 65535 or `;` between
4621
+ * nodes crashed every command from bittorrent-dht's timer (port NaN), and `udp://…`, `[v6]:port` or nodes split by
4622
+ * spaces were looked up as names and left the profile with no DHT. IPv6 nodes are refused: neither bittorrent-dht nor
4623
+ * dht-rpc reads them (both split host and port at the first ':').
4624
+ */
4625
+ function bootstrapNodes(name, env) {
4626
+ const nodes = (env ?? "").split(",").map((node) => node.trim()).filter(Boolean);
4627
+ const bad = nodes.find((node) => {
4628
+ const port = /^[^\s:;/@[\]]+:(\d{1,5})$/.exec(node)?.[1];
4629
+ return !port || Number(port) < 1 || Number(port) > 65535;
4630
+ });
4631
+ if (bad !== void 0) throw new CliError("usage", `${name} takes host:port nodes, comma-separated, not ${JSON.stringify(bad)}`);
4632
+ return nodes;
4633
+ }
4634
+ /**
4613
4635
  * The Pkarr relays of a private network or a test, `GHOSTLY_PKARR_RELAYS` ("http://…,…"), the Desktop's name for it:
4614
4636
  * the only relays this process uses, whatever the profile's `relays` setting says, from its very first publish. Null
4615
4637
  * when unset.
@@ -4617,7 +4639,7 @@ function hyperdhtNetwork(env = process.env.GHOSTLY_HYPERDHT_BOOTSTRAP) {
4617
4639
  function pkarrRelays(env = process.env) {
4618
4640
  const relays = (env.GHOSTLY_PKARR_RELAYS ?? "").split(",").map((url) => url.trim()).filter(Boolean);
4619
4641
  if (!relays.length) return null;
4620
- const bad = relays.find((url) => !/^https?:\/\/[^/\s]/i.test(url));
4642
+ const bad = relays.find((url) => !/^https?:\/\/[^/\s]/i.test(url) || /[\s;]/.test(url) || !URL.canParse(url));
4621
4643
  if (bad) throw new CliError("usage", `GHOSTLY_PKARR_RELAYS takes http:// or https:// URLs, comma-separated, not ${JSON.stringify(bad)}`);
4622
4644
  return relays;
4623
4645
  }
@@ -4662,7 +4684,7 @@ function withoutPublicStun(config) {
4662
4684
  */
4663
4685
  function mainlineNetwork(env = process.env) {
4664
4686
  if (!envSwitch("GHOSTLY_DHT", true, env)) return { off: true };
4665
- const bootstrap = (env.GHOSTLY_DHT_BOOTSTRAP ?? "").split(",").map((node) => node.trim()).filter(Boolean);
4687
+ const bootstrap = bootstrapNodes("GHOSTLY_DHT_BOOTSTRAP", env.GHOSTLY_DHT_BOOTSTRAP);
4666
4688
  if (!bootstrap.length && pkarrRelays(env)) return { off: true };
4667
4689
  if (!bootstrap.length) return { off: false };
4668
4690
  return {
@@ -4768,6 +4790,8 @@ function leftOutIn(mark) {
4768
4790
  async function startRuntime(paths, options = {}) {
4769
4791
  const pinned = pkarrRelays();
4770
4792
  const pinnedIroh = irohRelays();
4793
+ const network = hyperdhtNetwork();
4794
+ const dht = mainlineNetwork();
4771
4795
  const trace = process.env.GHOSTLY_LINK_TRACE;
4772
4796
  if (trace) setLinkTraceSink((line) => appendFileSync(trace, line + "\n", { mode: 384 }));
4773
4797
  if (trace || options.logJoins) (await import("./joinTrace-D-fnt2p3.js")).setJoinTraceSink((line) => {
@@ -4797,18 +4821,16 @@ async function startRuntime(paths, options = {}) {
4797
4821
  if (testMints) (await import("./mints-CqTdA4Gk.js")).declareTestMints(testMints.split(","));
4798
4822
  await installEventSource();
4799
4823
  await preloadWalletModules();
4800
- (await import("./ghostly_iroh_web-BXCsSxxo.js")).initSync({ module: irohWasmBytes() });
4801
- const [{ registerFileBytes }, { NodeFileBytes }] = await Promise.all([import("./fileBytes-CtwagJ8h.js"), import("./fileBytes-CFNrRfcl.js")]);
4824
+ (await import("./ghostly_iroh_web-CO0onry8.js")).initSync({ module: irohWasmBytes() });
4825
+ const [{ registerFileBytes }, { NodeFileBytes }] = await Promise.all([import("./fileBytes-OolN5cSY.js"), import("./fileBytes-_fd-2JRY.js")]);
4802
4826
  registerFileBytes("native", async () => new NodeFileBytes(paths.files), true);
4803
- if (await (await import("./blobFiles-B6nf0gCG.js")).moveBlobFiles()) await store.compact();
4804
- const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-CB9_JuWZ.js"), import("./endpoint-BdaeBw2L.js")]);
4805
- const network = hyperdhtNetwork();
4806
- const dht = mainlineNetwork();
4807
- const mainline = dht.off ? null : new (await (import("./mainline-RXv5_Fby.js"))).Mainline({
4827
+ if (await (await import("./blobFiles-Bckz9fjp.js")).moveBlobFiles()) await store.compact();
4828
+ const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-CnPj9wWh.js"), import("./endpoint-BdaeBw2L.js")]);
4829
+ const mainline = dht.off ? null : new (await (import("./mainline-B1urhbEZ.js"))).Mainline({
4808
4830
  bootstrap: dht.bootstrap,
4809
4831
  host: dht.host
4810
4832
  });
4811
- const transport = mainline || pinned ? new (await (import("./mainline-RXv5_Fby.js"))).RelaysAndDht(mainline, pinned ? { relays: pinned } : {}, !!pinned) : null;
4833
+ const transport = mainline || pinned ? new (await (import("./mainline-B1urhbEZ.js"))).RelaysAndDht(mainline, pinned ? { relays: pinned } : {}, !!pinned) : null;
4812
4834
  const apps = servedApps(paths.dir).length > 0;
4813
4835
  const server = new EngineServer({
4814
4836
  ...transport ? { transport } : {},
@@ -4827,6 +4849,7 @@ async function startRuntime(paths, options = {}) {
4827
4849
  callsSupport: callsUnavailable === null,
4828
4850
  ...callsUnavailable ? { callsUnavailable } : {},
4829
4851
  ...options.deferGroups ? { deferGroups: true } : {},
4852
+ ...options.deferChats ? { deferChats: true } : {},
4830
4853
  ...options.offline ? { offline: true } : {},
4831
4854
  ...process.env.GHOSTLY_TEST_WEBRTC_GROUP_LINKS === "1" ? { webrtcGroupLinks: true } : {}
4832
4855
  });
@@ -5149,4 +5172,4 @@ function connection(ctx, socket, secret) {
5149
5172
  //#endregion
5150
5173
  export { BASELINE_NEWEST, MAX_LINE, MAX_UNREAD, keepServing, openHost, serve };
5151
5174
 
5152
- //# sourceMappingURL=host-DDMQfR7B.js.map
5175
+ //# sourceMappingURL=host-DpypH-fR.js.map