@ghostlytools/cli 1.11.4 → 1.12.0

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 (218) hide show
  1. package/README.md +28 -11
  2. package/dist/assets/{api-MYc6QNRs.js → api-DLzCtePC.js} +363 -125
  3. package/dist/assets/api-DLzCtePC.js.map +1 -0
  4. package/dist/assets/{api-BwyFq4lA.js → api-DYMKyb1k.js} +2 -2
  5. package/dist/assets/{apiKit-CfsNx9ZR.js → apiKit-CVaEzKWQ.js} +48 -11
  6. package/dist/assets/apiKit-CVaEzKWQ.js.map +1 -0
  7. package/dist/assets/appFetch-D56GsYuq.js +602 -0
  8. package/dist/assets/appFetch-D56GsYuq.js.map +1 -0
  9. package/dist/assets/apps-BPFW19Wc.js +1 -0
  10. package/dist/assets/{apps-h12II1us.js → apps-XnZ8VEuj.js} +20 -14
  11. package/dist/assets/apps-XnZ8VEuj.js.map +1 -0
  12. package/dist/assets/{argon2id-088uQfnH.js → argon2id-B9wFdSj6.js} +2 -3
  13. package/dist/assets/{argon2id-088uQfnH.js.map → argon2id-B9wFdSj6.js.map} +1 -1
  14. package/dist/assets/{arkade-Bw_4PZRG.js → arkade-DryM-q5n.js} +6 -7
  15. package/dist/assets/arkade-DryM-q5n.js.map +1 -0
  16. package/dist/assets/backup-COX6j1_W.js +1 -0
  17. package/dist/assets/{backup-Chvy79SN.js → backup-DpyvT9Z6.js} +66 -21
  18. package/dist/assets/backup-DpyvT9Z6.js.map +1 -0
  19. package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js +5 -0
  20. package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js.map +1 -0
  21. package/dist/assets/{bark_ffi_wasm_bg-Bxru_BVW.wasm → bark_ffi_wasm_bg-VNmaJsc9.wasm} +0 -0
  22. package/dist/assets/{bitcoind-CdSmvy2y.js → bitcoind-DTsrd7TF.js} +4 -5
  23. package/dist/assets/{bitcoind-CdSmvy2y.js.map → bitcoind-DTsrd7TF.js.map} +1 -1
  24. package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js +5 -0
  25. package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js.map +1 -0
  26. package/dist/assets/bitcoindevkit_bg-DXil67yS.wasm +0 -0
  27. package/dist/assets/{blobFiles-BmsrvZc3.js → blobFiles-DDs34n0r.js} +4 -5
  28. package/dist/assets/{blobFiles-BmsrvZc3.js.map → blobFiles-DDs34n0r.js.map} +1 -1
  29. package/dist/assets/breez_sdk_spark_wasm_bg.wasm +0 -0
  30. package/dist/assets/buttons-Bq7pTXqF.js +1 -0
  31. package/dist/assets/{buttons-BgoExb4E.js → buttons-BvWqHJeh.js} +45 -23
  32. package/dist/assets/buttons-BvWqHJeh.js.map +1 -0
  33. package/dist/assets/bytes-C1DNGY18.js +132 -0
  34. package/dist/assets/bytes-C1DNGY18.js.map +1 -0
  35. package/dist/assets/{childEnv-K_IzUqQx.js → childEnv-C-99hdbL.js} +2 -3
  36. package/dist/assets/{childEnv-K_IzUqQx.js.map → childEnv-C-99hdbL.js.map} +1 -1
  37. package/dist/assets/{client-DY8tZZWi.js → client-kGZ3ZdUW.js} +5 -8
  38. package/dist/assets/{client-DY8tZZWi.js.map → client-kGZ3ZdUW.js.map} +1 -1
  39. package/dist/assets/{codec-BnMg-Grj.js → codec-B2rH1mfx.js} +2 -4
  40. package/dist/assets/{codec-BnMg-Grj.js.map → codec-B2rH1mfx.js.map} +1 -1
  41. package/dist/assets/domainProofs-BDNP1dIy.js +280 -0
  42. package/dist/assets/domainProofs-BDNP1dIy.js.map +1 -0
  43. package/dist/assets/{endpoint-DarqblYE.js → endpoint-B0vE5ojY.js} +421 -420
  44. package/dist/assets/endpoint-B0vE5ojY.js.map +1 -0
  45. package/dist/assets/engineErrors--9hfgKlK.js +150 -0
  46. package/dist/assets/engineErrors--9hfgKlK.js.map +1 -0
  47. package/dist/assets/{envelope-CdV7vHVZ.js → envelope-Bi2kMqbp.js} +3 -4
  48. package/dist/assets/{envelope-CdV7vHVZ.js.map → envelope-Bi2kMqbp.js.map} +1 -1
  49. package/dist/assets/{errors-CAh6GLJZ.js → errors-DDLFO4Gf.js} +5 -4
  50. package/dist/assets/errors-DDLFO4Gf.js.map +1 -0
  51. package/dist/assets/{fedimintSdk-CPFfVK-G.js → fedimintSdk-D-6H9Pe7.js} +4 -5
  52. package/dist/assets/{fedimintSdk-CPFfVK-G.js.map → fedimintSdk-D-6H9Pe7.js.map} +1 -1
  53. package/dist/assets/fedimint_client_wasm_bg-Cr5xGD-w.js +5 -0
  54. package/dist/assets/{fedimint_client_wasm_bg-BtHHlFpp.js.map → fedimint_client_wasm_bg-Cr5xGD-w.js.map} +1 -1
  55. package/dist/assets/fileBytes-CCKbwqG_.js +1 -0
  56. package/dist/assets/{fileBytes-BLPZq9YU.js → fileBytes-CfvUXdSy.js} +5 -7
  57. package/dist/assets/fileBytes-CfvUXdSy.js.map +1 -0
  58. package/dist/assets/{fileBytes-B0z9A6Le.js → fileBytes-tj6-VZcB.js} +3 -4
  59. package/dist/assets/{fileBytes-B0z9A6Le.js.map → fileBytes-tj6-VZcB.js.map} +1 -1
  60. package/dist/assets/fileBytesIdb-B0zzJ6p7.js +1 -0
  61. package/dist/assets/{fileBytesIdb-Bmlrl9EO.js → fileBytesIdb-BJirUAjI.js} +4 -5
  62. package/dist/assets/{fileBytesIdb-Bmlrl9EO.js.map → fileBytesIdb-BJirUAjI.js.map} +1 -1
  63. package/dist/assets/{fileBytesOpfs-DBS0kbPT.js → fileBytesOpfs-DRUYLER4.js} +4 -5
  64. package/dist/assets/{fileBytesOpfs-DBS0kbPT.js.map → fileBytesOpfs-DRUYLER4.js.map} +1 -1
  65. package/dist/assets/{fixedHosts-CbgqrIKs.js → fixedHosts-CPSsGOI2.js} +4 -5
  66. package/dist/assets/{fixedHosts-CbgqrIKs.js.map → fixedHosts-CPSsGOI2.js.map} +1 -1
  67. package/dist/assets/{ghostly_iroh_web-BzAXJUYH.js → ghostly_iroh_web-DIj5xGmR.js} +2 -3
  68. package/dist/assets/{ghostly_iroh_web-BzAXJUYH.js.map → ghostly_iroh_web-DIj5xGmR.js.map} +1 -1
  69. package/dist/assets/{src-DJe-OYxd.js → groupMeta-DTQAJG50.js} +4693 -24241
  70. package/dist/assets/groupMeta-DTQAJG50.js.map +1 -0
  71. package/dist/assets/{host-C0NMNQLl.js → host-z0FAHP9Z.js} +209 -134
  72. package/dist/assets/host-z0FAHP9Z.js.map +1 -0
  73. package/dist/assets/{hyperdhtRelay-Dz7pvcBA.js → hyperdhtRelay-CvsAfQRQ.js} +5 -6
  74. package/dist/assets/hyperdhtRelay-CvsAfQRQ.js.map +1 -0
  75. package/dist/assets/hyperdhtRelay-bjNGacf5.js +32 -0
  76. package/dist/assets/hyperdhtRelay-bjNGacf5.js.map +1 -0
  77. package/dist/assets/{idb-CEuoNsTv.js → idb-ewvbqyDI.js} +2 -3
  78. package/dist/assets/{idb-CEuoNsTv.js.map → idb-ewvbqyDI.js.map} +1 -1
  79. package/dist/assets/identityProofs-Cksc_K7_.js +940 -0
  80. package/dist/assets/identityProofs-Cksc_K7_.js.map +1 -0
  81. package/dist/assets/{irohWeb-caAj4Dms.js → irohWeb-CLBx5MIv.js} +3061 -86
  82. package/dist/assets/irohWeb-CLBx5MIv.js.map +1 -0
  83. package/dist/assets/joinTrace-CBr1jbch.js +1 -0
  84. package/dist/assets/{joinTrace-CjRDFy85.js → joinTrace-xKBe73j9.js} +2 -3
  85. package/dist/assets/{joinTrace-CjRDFy85.js.map → joinTrace-xKBe73j9.js.map} +1 -1
  86. package/dist/assets/{legacy_ciphers-JJOu0JXL.js → legacy_ciphers-BnYATjxo.js} +2 -3
  87. package/dist/assets/{legacy_ciphers-JJOu0JXL.js.map → legacy_ciphers-BnYATjxo.js.map} +1 -1
  88. package/dist/assets/linkPreview-DdMf-YAc.js +252 -0
  89. package/dist/assets/linkPreview-DdMf-YAc.js.map +1 -0
  90. package/dist/assets/{main-C6t5zrD5.js → main-CVqkvuIo.js} +268 -111
  91. package/dist/assets/main-CVqkvuIo.js.map +1 -0
  92. package/dist/assets/{mainline-DCuGUSZF.js → mainline-CVrd0C1n.js} +72 -18
  93. package/dist/assets/mainline-CVrd0C1n.js.map +1 -0
  94. package/dist/assets/mints-BcBODVVW.js +1 -0
  95. package/dist/assets/{mints-j5XAOk4f.js → mints-CMDLbMeH.js} +8 -6
  96. package/dist/assets/mints-CMDLbMeH.js.map +1 -0
  97. package/dist/assets/{nacl-fast-CDhNCYHs.js → nacl-fast-B1ThWvuM.js} +2 -3
  98. package/dist/assets/{nacl-fast-CDhNCYHs.js.map → nacl-fast-B1ThWvuM.js.map} +1 -1
  99. package/dist/assets/{networkReason-BbQW1Xpc.js → networkReason-Be-hMghr.js} +10 -14
  100. package/dist/assets/{networkReason-BbQW1Xpc.js.map → networkReason-Be-hMghr.js.map} +1 -1
  101. package/dist/assets/{noble_curves-DDWn5AH0.js → noble_curves-DqpNlhAU.js} +3 -4
  102. package/dist/assets/{noble_curves-DDWn5AH0.js.map → noble_curves-DqpNlhAU.js.map} +1 -1
  103. package/dist/assets/{noble_hashes-B7AZyFyS.js → noble_hashes-LFe1N2xt.js} +3 -4
  104. package/dist/assets/{noble_hashes-B7AZyFyS.js.map → noble_hashes-LFe1N2xt.js.map} +1 -1
  105. package/dist/assets/{nwc-CSDRMZ0e.js → nwc-DKE2FXr6.js} +5 -6
  106. package/dist/assets/{nwc-CSDRMZ0e.js.map → nwc-DKE2FXr6.js.map} +1 -1
  107. package/dist/assets/nwcProvider-pL2XqSbW.js +208 -0
  108. package/dist/assets/nwcProvider-pL2XqSbW.js.map +1 -0
  109. package/dist/assets/{openpgp-BBFr-zHQ.js → openpgp-LkR_Zof0.js} +14 -15
  110. package/dist/assets/{openpgp-BBFr-zHQ.js.map → openpgp-LkR_Zof0.js.map} +1 -1
  111. package/dist/assets/ownDid-DY3rYqDI.js +862 -0
  112. package/dist/assets/ownDid-DY3rYqDI.js.map +1 -0
  113. package/dist/assets/{ownStatus-BoTf5WqQ.js → ownStatus-DMEhrpkd.js} +69 -20
  114. package/dist/assets/ownStatus-DMEhrpkd.js.map +1 -0
  115. package/dist/assets/pairedTransports-BKmvlKz1.js +581 -0
  116. package/dist/assets/pairedTransports-BKmvlKz1.js.map +1 -0
  117. package/dist/assets/paymentIntent-DySU3Ajm.js +349 -0
  118. package/dist/assets/paymentIntent-DySU3Ajm.js.map +1 -0
  119. package/dist/assets/pkarr-BQo4PcCg.js +367 -0
  120. package/dist/assets/pkarr-BQo4PcCg.js.map +1 -0
  121. package/dist/assets/{profiles-DszHjEJi.js → profiles-BFSGqDFC.js} +9 -10
  122. package/dist/assets/profiles-BFSGqDFC.js.map +1 -0
  123. package/dist/assets/registry-B15Yg_1C.js +1 -0
  124. package/dist/assets/{registry-Da-r6eC3.js → registry-rXgaZeNn.js} +1261 -53
  125. package/dist/assets/registry-rXgaZeNn.js.map +1 -0
  126. package/dist/assets/relay-Cjfmdec0.js +2219 -0
  127. package/dist/assets/relay-Cjfmdec0.js.map +1 -0
  128. package/dist/assets/resolve-CIc3KZMV.js +970 -0
  129. package/dist/assets/resolve-CIc3KZMV.js.map +1 -0
  130. package/dist/assets/{restoredRows-C3LcxmOw.js → restoredRows-D_WSHE7H.js} +3 -4
  131. package/dist/assets/{restoredRows-C3LcxmOw.js.map → restoredRows-D_WSHE7H.js.map} +1 -1
  132. package/dist/assets/{secretGuard-CsVHDdYk.js → secretGuard-B4-LlMjv.js} +11 -14
  133. package/dist/assets/{secretGuard-CsVHDdYk.js.map → secretGuard-B4-LlMjv.js.map} +1 -1
  134. package/dist/assets/secretGuard-BmmnEbYf.js +1 -0
  135. package/dist/assets/{server-C1jZZ61O.js → server-CQR7NLCz.js} +9565 -461
  136. package/dist/assets/server-CQR7NLCz.js.map +1 -0
  137. package/dist/assets/{sha512-BYId-G-T.js → sha512-DST9fbWH.js} +2 -3
  138. package/dist/assets/{sha512-BYId-G-T.js.map → sha512-DST9fbWH.js.map} +1 -1
  139. package/dist/assets/sshForges-BnvwmNj-.js +539 -0
  140. package/dist/assets/sshForges-BnvwmNj-.js.map +1 -0
  141. package/dist/assets/{storage-Bya5b2Xt.js → storage-BpjdxvO2.js} +243 -34
  142. package/dist/assets/storage-BpjdxvO2.js.map +1 -0
  143. package/dist/assets/text-li76pThX.js +106 -0
  144. package/dist/assets/text-li76pThX.js.map +1 -0
  145. package/dist/assets/{translate-CUuC5szR.js → translate-BcbSWkuq.js} +21 -26
  146. package/dist/assets/{translate-CUuC5szR.js.map → translate-BcbSWkuq.js.map} +1 -1
  147. package/dist/assets/{tree-store-N362nuzZ.js → tree-store-CAchkO_l.js} +22 -6
  148. package/dist/assets/tree-store-CAchkO_l.js.map +1 -0
  149. package/dist/assets/{types-Clyb52K2.js → types-CdWwgvyt.js} +2 -3
  150. package/dist/assets/{types-Clyb52K2.js.map → types-CdWwgvyt.js.map} +1 -1
  151. package/dist/assets/{unbzip2-stream-B1C-JX9L.js → unbzip2-stream-BtkYGpC5.js} +2 -3
  152. package/dist/assets/{unbzip2-stream-B1C-JX9L.js.map → unbzip2-stream-BtkYGpC5.js.map} +1 -1
  153. package/dist/assets/{usdt-DI51znt-.js → usdt-CBJ4Q5Ji.js} +7 -7
  154. package/dist/assets/usdt-CBJ4Q5Ji.js.map +1 -0
  155. package/dist/assets/{waitNotice-Cn0WJ-He.js → waitNotice-BGM0QOS2.js} +27 -4
  156. package/dist/assets/waitNotice-BGM0QOS2.js.map +1 -0
  157. package/dist/assets/{web-DwgdhfcY.js → web-68CYFCl9.js} +314 -91
  158. package/dist/assets/web-68CYFCl9.js.map +1 -0
  159. package/dist/ghostly.mjs +3 -5
  160. package/dist/ghostly.mjs.map +1 -1
  161. package/npm-shrinkwrap.json +225 -200
  162. package/package.json +16 -16
  163. package/dist/assets/api-MYc6QNRs.js.map +0 -1
  164. package/dist/assets/apiKit-CfsNx9ZR.js.map +0 -1
  165. package/dist/assets/appFetch-DVYZOZFw.js +0 -194
  166. package/dist/assets/appFetch-DVYZOZFw.js.map +0 -1
  167. package/dist/assets/apps-Dbw2Hcko.js +0 -2
  168. package/dist/assets/apps-h12II1us.js.map +0 -1
  169. package/dist/assets/arkade-Bw_4PZRG.js.map +0 -1
  170. package/dist/assets/backup-CdEzTq5C.js +0 -2
  171. package/dist/assets/backup-Chvy79SN.js.map +0 -1
  172. package/dist/assets/bark_ffi_wasm_bg-EY2uc0Bx.js +0 -6
  173. package/dist/assets/bark_ffi_wasm_bg-EY2uc0Bx.js.map +0 -1
  174. package/dist/assets/bitcoindProvider-BvoRh0D5.js +0 -97
  175. package/dist/assets/bitcoindProvider-BvoRh0D5.js.map +0 -1
  176. package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js +0 -6
  177. package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js.map +0 -1
  178. package/dist/assets/bitcoindevkit_bg-CRkZTSbO.wasm +0 -0
  179. package/dist/assets/buttons-BgoExb4E.js.map +0 -1
  180. package/dist/assets/buttons-DK2aAGat.js +0 -2
  181. package/dist/assets/endpoint-DarqblYE.js.map +0 -1
  182. package/dist/assets/errors-CAh6GLJZ.js.map +0 -1
  183. package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js +0 -6
  184. package/dist/assets/fileBytes-BLPZq9YU.js.map +0 -1
  185. package/dist/assets/fileBytes-BtIyoDF2.js +0 -2
  186. package/dist/assets/fileBytesIdb-D8mAK4pF.js +0 -2
  187. package/dist/assets/host-C0NMNQLl.js.map +0 -1
  188. package/dist/assets/hyperdhtRelay-1wzya_0L.js +0 -25
  189. package/dist/assets/hyperdhtRelay-1wzya_0L.js.map +0 -1
  190. package/dist/assets/hyperdhtRelay-Dz7pvcBA.js.map +0 -1
  191. package/dist/assets/irohWeb-caAj4Dms.js.map +0 -1
  192. package/dist/assets/joinTrace-D-fnt2p3.js +0 -2
  193. package/dist/assets/jsonOut-POtMBS_V.js +0 -16
  194. package/dist/assets/jsonOut-POtMBS_V.js.map +0 -1
  195. package/dist/assets/main-C6t5zrD5.js.map +0 -1
  196. package/dist/assets/mainline-DCuGUSZF.js.map +0 -1
  197. package/dist/assets/mints-BaOmx517.js +0 -2
  198. package/dist/assets/mints-j5XAOk4f.js.map +0 -1
  199. package/dist/assets/nwcProvider-PE0wli8n.js +0 -88
  200. package/dist/assets/nwcProvider-PE0wli8n.js.map +0 -1
  201. package/dist/assets/ownDid-C1R5Kd8q.js +0 -282
  202. package/dist/assets/ownDid-C1R5Kd8q.js.map +0 -1
  203. package/dist/assets/ownStatus-BoTf5WqQ.js.map +0 -1
  204. package/dist/assets/profiles-DszHjEJi.js.map +0 -1
  205. package/dist/assets/registry-Da-r6eC3.js.map +0 -1
  206. package/dist/assets/registry-zUZBSHYv.js +0 -2
  207. package/dist/assets/resolve-tUzh4lHh.js +0 -400
  208. package/dist/assets/resolve-tUzh4lHh.js.map +0 -1
  209. package/dist/assets/secretGuard-DCb1I0_B.js +0 -2
  210. package/dist/assets/server-C1jZZ61O.js.map +0 -1
  211. package/dist/assets/src-DJe-OYxd.js.map +0 -1
  212. package/dist/assets/sshForges-C9zTO72R.js +0 -261
  213. package/dist/assets/sshForges-C9zTO72R.js.map +0 -1
  214. package/dist/assets/storage-Bya5b2Xt.js.map +0 -1
  215. package/dist/assets/tree-store-N362nuzZ.js.map +0 -1
  216. package/dist/assets/usdt-DI51znt-.js.map +0 -1
  217. package/dist/assets/waitNotice-Cn0WJ-He.js.map +0 -1
  218. package/dist/assets/web-DwgdhfcY.js.map +0 -1
@@ -1,22 +1,27 @@
1
- import { As as RTC_CONFIG, Da as isPublicAddress, Di as checkPushEndpoint, Fa as ACTIVE_DHT_POLL_MS, Is as extractParamsFromSdp, Ls as parseCallSignal, Ms as buildSdpFromSignal, Ns as callRtcConfig, Os as CALL_SIGNAL_MAX_AGE_MS, Ps as callSignalHeardAt, Rs as signalHasVideo, Xu as setLinkTraceSink, fd as setPublicKeyFastPath, js as answersOffer, ps as DAEMON_WATCH_PEER_IDLE_MS, ti as STATUS_IDLE_AFTER_MS, xd as fromBase64Url } from "./src-DJe-OYxd.js";
2
- import { p as fileStore } from "./idb-CEuoNsTv.js";
3
- import { d as parsePayLink, r as irohRelayProblem } from "./irohWeb-caAj4Dms.js";
4
- import { n as fedimintSdkOn } from "./fedimintSdk-CPFfVK-G.js";
5
- import { r as asCliError, t as CliError } from "./errors-CAh6GLJZ.js";
6
- import { M as sinceSeq, s as findChat, u as findOwnNamedChat } from "./apiKit-CfsNx9ZR.js";
7
- 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-MYc6QNRs.js";
8
- 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-DszHjEJi.js";
9
- import { p as nativePublicKey } from "./apps-h12II1us.js";
10
- 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-DY8tZZWi.js";
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-DLzCtePC.js";
3
+ import { N as sinceSeq, s as findChat, u as findOwnNamedChat } from "./apiKit-CVaEzKWQ.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-BFSGqDFC.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-kGZ3ZdUW.js";
7
+ import { Bi as callRtcConfig, Fi as CALL_SIGNAL_MAX_AGE_MS, Gi as signalHasVideo, Li as RTC_CONFIG, Ri as answersOffer, Ui as extractParamsFromSdp, Vi as callSignalHeardAt, Wi as parseCallSignal, Zt as checkPushEndpoint, bi as DAEMON_WATCH_PEER_IDLE_MS, gn as ACTIVE_DHT_POLL_MS, xt as STATUS_IDLE_AFTER_MS, zi as buildSdpFromSignal } from "./groupMeta-DTQAJG50.js";
8
+ import { d as parsePayLink, r as irohRelayProblem } from "./irohWeb-CLBx5MIv.js";
9
+ import { i as fromBase64Url } from "./bytes-C1DNGY18.js";
10
+ import { u as setLinkTraceSink } from "./relay-Cjfmdec0.js";
11
+ import { b as setPublicKeyFastPath } from "./pkarr-BQo4PcCg.js";
12
+ import { p as nativePublicKey } from "./apps-XnZ8VEuj.js";
13
+ import { n as fedimintSdkOn } from "./fedimintSdk-D-6H9Pe7.js";
14
+ import { s as isPublicAddress } from "./domainProofs-BDNP1dIy.js";
11
15
  import { createRequire } from "node:module";
12
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";
13
17
  import { open, readFile } from "node:fs/promises";
14
- import { dirname, join } from "node:path";
18
+ import { dirname, isAbsolute, join, resolve } from "node:path";
15
19
  import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
16
20
  import { networkInterfaces } from "node:os";
17
21
  import { Readable } from "node:stream";
18
- import { createServer, isIP } from "node:net";
22
+ import { connect, createServer, isIP } from "node:net";
19
23
  import { createInterface } from "node:readline";
24
+ import { createSocket } from "node:dgram";
20
25
  import { fileURLToPath, pathToFileURL } from "node:url";
21
26
  import { Worker } from "node:worker_threads";
22
27
  import { request } from "node:https";
@@ -24,7 +29,7 @@ import { lookup } from "node:dns";
24
29
  import { WebSocket } from "ws";
25
30
  import { DefaultSerializer, deserialize, serialize } from "node:v8";
26
31
  import { IDBFactory, IDBKeyRange as IDBKeyRange$1, IDBTransaction } from "fake-indexeddb";
27
- //#region src/announce.ts
32
+ // src/announce.ts
28
33
  /**
29
34
  * What the app's chat screen does by itself, done here for a profile no screen shows (apps/ui/src/hooks/useChat.ts): the side
30
35
  * that joined says "👋 <name> joined" once the chat first goes live, and the side that invited answers once. Contacts
@@ -50,33 +55,89 @@ function announceJoins(hub, node) {
50
55
  else if (event.type === "chat.joined") say(chat);
51
56
  });
52
57
  }
53
- //#endregion
54
- //#region src/calls/audioSocket.ts
58
+ // src/calls/audioSocket.ts
55
59
  /**
56
60
  * A call's audio socket (WISP 1100 § Calls): `<profile>/calls/<call>.sock`, 0600, in a folder only the owner may
57
61
  * open. When that path is too long for a Unix socket: `ghostly-calls-<hash of the profile>/<call>.sock` in the user's
58
62
  * runtime folder (`runtimePath`), a folder of the owner's, 0700, checked as such before use. A named pipe on Windows.
63
+ * With a shared folder (`callSocketDir`): `<that folder>/<call>.sock`.
59
64
  */
60
- function audioSocketPath(profileDir, callId) {
65
+ function audioSocketPath(profileDir, callId, sharedDir) {
66
+ if (sharedDir && process.platform !== "win32") return join(sharedDir, `${callId}.sock`);
61
67
  const inside = join(profileDir, "calls", `${callId}.sock`);
62
68
  if (process.platform === "win32") return `\\\\.\\pipe\\ghostly-call-${createHash("sha256").update(inside).digest("hex").slice(0, 24)}`;
63
69
  if (Buffer.byteLength(inside) <= 100) return inside;
64
70
  return runtimePath("ghostly-calls", profileDir, `${callId}.sock`);
65
71
  }
66
72
  /**
73
+ * GHOSTLY_CALL_SOCKET_DIR: a folder the machine made for its daemon's call sockets, shared with the group of another
74
+ * user that runs the program on the audio (a Ghostly OS node's assistant). Unset: the profile's own folder. Refused
75
+ * (`usage`) when it is not an absolute path, is too long for a socket's, or on Windows, whose calls are named pipes.
76
+ */
77
+ function callSocketDir(value = process.env.GHOSTLY_CALL_SOCKET_DIR) {
78
+ if (value === void 0) return void 0;
79
+ if (process.platform === "win32") throw new CliError("usage", "GHOSTLY_CALL_SOCKET_DIR is for Linux and macOS: on Windows a call's audio is a named pipe");
80
+ if (!value.trim() || !isAbsolute(value)) throw new CliError("usage", "GHOSTLY_CALL_SOCKET_DIR takes an absolute path: the folder for the calls' audio sockets");
81
+ const dir = resolve(value);
82
+ if (Buffer.byteLength(join(dir, `${"0".repeat(12)}.sock`)) > 100) throw new CliError("usage", `GHOSTLY_CALL_SOCKET_DIR is too long for a socket's path (${dir}): choose a folder of at most 82 bytes`);
83
+ return dir;
84
+ }
85
+ /**
86
+ * The shared folder (`callSocketDir`), checked before a socket goes in it: the machine made it, so it is not made here.
87
+ * Refused when it is missing, a link, someone else's, or when anyone else may write it (and so replace a socket) or
88
+ * anyone outside its group may enter it: 0750, its group the other user's (setgid, so the sockets take that group).
89
+ * Refused too on Linux when its group is not this user's own and it is not setgid: a socket there takes this user's
90
+ * group, not the folder's, and the other user's program could never open one.
91
+ */
92
+ function sharedFolder(path) {
93
+ const what = "calls will not put their audio there";
94
+ let info;
95
+ try {
96
+ info = lstatSync(path);
97
+ } catch {
98
+ throw new CliError("refused", `${path} (GHOSTLY_CALL_SOCKET_DIR) is not there: ${what}. Make it a folder of this user's, 0750 with the group that reads the audio (chmod 2750)`);
99
+ }
100
+ if (!info.isDirectory() || process.getuid && info.uid !== process.getuid()) throw new CliError("refused", `${path} (GHOSTLY_CALL_SOCKET_DIR) is not a folder of this user's: ${what}`);
101
+ if ((info.mode & 23) !== 0) throw new CliError("refused", `${path} (GHOSTLY_CALL_SOCKET_DIR) may be written by others or entered by anyone outside its group: ${what}. Run \`chmod 2750 ${path}\`, then try again`);
102
+ if (process.platform === "linux" && process.getegid && info.gid !== process.getegid() && (info.mode & 1024) === 0) throw new CliError("refused", `${path} (GHOSTLY_CALL_SOCKET_DIR) is not setgid: a call's socket there would take this user's group, not the folder's, and its group could not open it. Run \`chmod 2750 ${path}\`, then try again`);
103
+ }
104
+ /** A call's socket's name: its call id, 12 hex digits. */
105
+ var CALL_SOCKET = /^[0-9a-f]{12}\.sock$/;
106
+ /**
67
107
  * Removes the call sockets a daemon that died during a call left in this profile's folder (`audioSocketPath`; call
68
- * ids are 12 hex digits): no call outlives its daemon. A folder that is a link or someone else's is left alone.
108
+ * ids are 12 hex digits), or in the shared folder: no call outlives its daemon. A folder that is a link or someone
109
+ * else's is left alone, and so is anything else in it: the shared folder is the machine's, not Ghostly's alone. There a
110
+ * socket goes only once nobody answers on it (`removeIfDead`): two profiles' daemons may share the folder, and the
111
+ * other one's call is live.
69
112
  */
70
- function clearAudioSockets(profileDir) {
113
+ function clearAudioSockets(profileDir, sharedDir) {
71
114
  if (process.platform === "win32") return;
72
- const folder = dirname(audioSocketPath(profileDir, "0".repeat(12)));
115
+ const folder = dirname(audioSocketPath(profileDir, "0".repeat(12), sharedDir));
73
116
  try {
74
117
  const info = lstatSync(folder);
75
118
  if (!info.isDirectory() || process.getuid && info.uid !== process.getuid()) return;
76
- for (const entry of readdirSync(folder, { withFileTypes: true })) if (entry.name.endsWith(".sock") && !entry.isDirectory()) rmSync(join(folder, entry.name), { force: true });
119
+ for (const entry of readdirSync(folder, { withFileTypes: true })) {
120
+ if (!CALL_SOCKET.test(entry.name) || entry.isDirectory()) continue;
121
+ if (sharedDir && entry.isSocket()) removeIfDead(join(folder, entry.name));
122
+ else rmSync(join(folder, entry.name), { force: true });
123
+ }
77
124
  } catch {}
78
125
  }
79
126
  /**
127
+ * Removes a shared folder's call socket once a connection to it is refused: its daemon is gone. A live one is another
128
+ * daemon's call, and the connection (which sends no token) replaces nobody there and is closed at once.
129
+ */
130
+ function removeIfDead(path) {
131
+ const probe = connect(path);
132
+ probe.once("connect", () => probe.destroy());
133
+ probe.once("error", (error) => {
134
+ if (error.code !== "ECONNREFUSED") return;
135
+ try {
136
+ rmSync(path, { force: true });
137
+ } catch {}
138
+ });
139
+ }
140
+ /**
80
141
  * The socket's handlers for a call's queue: what the program writes is queued, and a program that takes the socket
81
142
  * (the first, or one that replaces the last) starts on a queue of its own (`PlaybackQueue.newWriter`): the last
82
143
  * one's leftover, half a sample included, would otherwise shift all of its audio by a byte.
@@ -101,6 +162,7 @@ function feedQueue(queue) {
101
162
  * of the machine may open and read), a connection is nobody's until it has: it hears nothing and replaces nobody, it is
102
163
  * closed when what it sent is not the token, and when `proveMs` pass without it. On an owner-only Unix socket the token
103
164
  * is optional: a connection is the program at once, and a token line it sends first is kept out of the call's audio.
165
+ * `shared`: the socket is in the shared folder (`sharedFolder`), 0660 for its group, and the token is required.
104
166
  */
105
167
  var AudioSocket = class AudioSocket {
106
168
  path;
@@ -123,8 +185,10 @@ var AudioSocket = class AudioSocket {
123
185
  this.proveMs = proveMs;
124
186
  }
125
187
  static async open(path, rate, handlers, options = {}) {
188
+ const shared = !!options.shared && process.platform !== "win32";
126
189
  if (process.platform !== "win32") {
127
- privateFolder(join(path, ".."), "calls will not put their audio there");
190
+ if (shared) sharedFolder(dirname(path));
191
+ else privateFolder(join(path, ".."), "calls will not put their audio there");
128
192
  if (existsSync(path)) rmSync(path, { force: true });
129
193
  }
130
194
  let self = null;
@@ -136,8 +200,8 @@ var AudioSocket = class AudioSocket {
136
200
  resolve();
137
201
  });
138
202
  });
139
- if (process.platform !== "win32") chmodSync(path, 384);
140
- self = new AudioSocket(path, server, rate, options.requireToken ?? process.platform === "win32", options.proveMs ?? 5e3);
203
+ if (process.platform !== "win32") chmodSync(path, shared ? 432 : 384);
204
+ self = new AudioSocket(path, server, rate, options.requireToken ?? (shared || process.platform === "win32"), options.proveMs ?? 5e3);
141
205
  return self;
142
206
  }
143
207
  get connected() {
@@ -333,8 +397,7 @@ var ReorderBuffer = class {
333
397
  }
334
398
  }
335
399
  };
336
- //#endregion
337
- //#region src/calls/audio.ts
400
+ // src/calls/audio.ts
338
401
  /** The longest stall of the sender whose frames are still sent after it (see `catchUp`). */
339
402
  var MAX_CATCH_UP_MS = 1e3;
340
403
  /**
@@ -580,8 +643,7 @@ var CallAudio = class {
580
643
  this.owed -= this.queue.skip(Math.min(this.owed, this.queue.queuedMs - this.kept));
581
644
  }
582
645
  };
583
- //#endregion
584
- //#region src/envSwitch.ts
646
+ // src/envSwitch.ts
585
647
  var OFF = /^(0|false|off|no)$/i;
586
648
  var ON = /^(1|true|on|yes)$/i;
587
649
  /**
@@ -598,8 +660,7 @@ function envSwitch(name, fallback, env = process.env) {
598
660
  if (ON.test(value.trim())) return true;
599
661
  throw new CliError("usage", `${name} takes 0 or 1 (or false/true, off/on, no/yes), not ${JSON.stringify(value)}`);
600
662
  }
601
- //#endregion
602
- //#region src/runtime/rtcThreads.ts
663
+ // src/runtime/rtcThreads.ts
603
664
  /**
604
665
  * How long no WebRTC connection is open before libdatachannel's threads are let go. For tests,
605
666
  * `GHOSTLY_TEST_RTC_IDLE_MS=<ms>` sets it.
@@ -649,8 +710,7 @@ var rtcThreads = new RtcThreads(async () => {
649
710
  const ndc = await import("node-datachannel");
650
711
  if (rtcThreads.idle) (ndc.cleanup ?? ndc.default.cleanup)();
651
712
  });
652
- //#endregion
653
- //#region src/calls/media.ts
713
+ // src/calls/media.ts
654
714
  var loading = null;
655
715
  var OPUS_APPLICATION_VOIP = 2048;
656
716
  var OPUS_SET_BITRATE = 4002;
@@ -717,6 +777,8 @@ function loadCallStack() {
717
777
  } catch (error) {
718
778
  return error.message;
719
779
  }
780
+ const bind = process.env.GHOSTLY_CALL_BIND;
781
+ if (bind && !isIP(bind)) return isIP(bind.trim().replace(/^\[(.*)\]$/, "$1")) ? "Calls are off on this headless Ghostly: GHOSTLY_CALL_BIND takes an IP address of this machine without brackets or spaces, such as 127.0.0.1 or ::1" : "Calls are off on this headless Ghostly: GHOSTLY_CALL_BIND takes an IP address of this machine, such as 127.0.0.1, not a name";
720
782
  try {
721
783
  const ndc = await import("node-datachannel");
722
784
  const lib = ndc.PeerConnection ? ndc : ndc.default;
@@ -780,6 +842,29 @@ var SETTLE_MS = 150;
780
842
  * `OFFER_HOST_GATHER_MS`).
781
843
  */
782
844
  var HOST_GATHER_MS = 2e3;
845
+ /** Not echoed: the address may be one of this network's. */
846
+ var CALL_BIND_GONE = "Calls can't start: GHOSTLY_CALL_BIND is not an address of this machine now (a typo, or a network that changed). Set it to one of this machine's addresses, such as 127.0.0.1, or unset it, then restart the daemon";
847
+ /**
848
+ * Whether a socket can be bound on `address` now. On an address that is not this machine's (a typo, a network that
849
+ * changed since the daemon started), libdatachannel gathers no candidate and throws from an offer's description where
850
+ * node-datachannel catches nothing: the whole daemon aborted, every chat with it.
851
+ */
852
+ async function bindable(address) {
853
+ const socket = createSocket(isIP(address) === 6 ? "udp6" : "udp4");
854
+ try {
855
+ await new Promise((bound, failed) => {
856
+ socket.once("error", failed);
857
+ socket.bind(0, address, () => bound());
858
+ });
859
+ return true;
860
+ } catch {
861
+ return false;
862
+ } finally {
863
+ try {
864
+ socket.close();
865
+ } catch {}
866
+ }
867
+ }
783
868
  /**
784
869
  * A connection and its description, with its candidates. An early answer's (`held`) takes the contact's offer
785
870
  * without its candidates: with none, this side sends the contact no check, so nothing connects, and no audio is sent
@@ -788,6 +873,7 @@ var HOST_GATHER_MS = 2e3;
788
873
  async function openConnection(stack, options, offer, held = false) {
789
874
  const { ndc } = stack;
790
875
  const bind = process.env.GHOSTLY_CALL_BIND;
876
+ if (bind && !await bindable(bind)) throw new CliError("unavailable", CALL_BIND_GONE);
791
877
  const iceServers = callIceServers(options.iceServers);
792
878
  const pc = new ndc.PeerConnection("ghostly-call", {
793
879
  iceServers,
@@ -1079,8 +1165,7 @@ function gathering(pc, { turn = false } = {}) {
1079
1165
  });
1080
1166
  });
1081
1167
  }
1082
- //#endregion
1083
- //#region src/calls/manager.ts
1168
+ // src/calls/manager.ts
1084
1169
  /** An outgoing call rings this long, then ends as `unanswered`. */
1085
1170
  var RING_MS = 6e4;
1086
1171
  /** An answered or accepted call has this long to connect its media, then ends as `failed`. */
@@ -1124,7 +1209,8 @@ var CallManager = class {
1124
1209
  this.host = host;
1125
1210
  this.configPath = join(host.profileDir, "calls.json");
1126
1211
  this.auto = readAuto(this.configPath);
1127
- if (host.answers !== false) clearAudioSockets(host.profileDir);
1212
+ if (host.answers !== false && host.socketDir) sharedFolder(host.socketDir);
1213
+ if (host.answers !== false) clearAudioSockets(host.profileDir, host.socketDir);
1128
1214
  }
1129
1215
  get now() {
1130
1216
  return (this.host.now ?? Date.now)();
@@ -1308,7 +1394,7 @@ var CallManager = class {
1308
1394
  */
1309
1395
  prepare(call) {
1310
1396
  if (this.host.answers === false || call.ended || call.state !== "ringing") return;
1311
- const settings = this.host.engine.getState().settings;
1397
+ const settings = this.host.engine.getSettings();
1312
1398
  const iceServers = settings?.iceServers ?? [];
1313
1399
  if (settings?.relayOnly === true || callUsesTurn(callIceServers(iceServers))) return;
1314
1400
  this.stopEarly(call);
@@ -1554,7 +1640,7 @@ var CallManager = class {
1554
1640
  */
1555
1641
  async attach(call, create) {
1556
1642
  const queue = call.queue = new PlaybackQueue(call.rate);
1557
- const socket = await AudioSocket.open(audioSocketPath(this.host.profileDir, call.id), call.rate, feedQueue(queue));
1643
+ const socket = await AudioSocket.open(audioSocketPath(this.host.profileDir, call.id, this.host.socketDir), call.rate, feedQueue(queue), { shared: !!this.host.socketDir });
1558
1644
  if (call.ended) {
1559
1645
  await socket.close();
1560
1646
  return;
@@ -1576,7 +1662,7 @@ var CallManager = class {
1576
1662
  rate: call.rate,
1577
1663
  queue: call.queue ?? void 0,
1578
1664
  log: (line) => process.stderr.write(`ghostly: call ${call.id}: ${line}\n`),
1579
- iceServers: this.host.engine.getState().settings?.iceServers ?? [],
1665
+ iceServers: this.host.engine.getSettings()?.iceServers ?? [],
1580
1666
  onFrame: (frame) => call.socket?.write(frame),
1581
1667
  onState: (state) => {
1582
1668
  if (call.ended || attempt !== call.attempt) return;
@@ -1809,7 +1895,7 @@ var CallManager = class {
1809
1895
  if (ref) {
1810
1896
  const byId = this.calls.get(ref);
1811
1897
  if (byId) return byId;
1812
- const call = this.byChat(this.chatId(ref));
1898
+ const call = this.byChat(this.chatOf(ref).id);
1813
1899
  if (!call) throw new CliError("not_found", `No call in chat ${ref}`);
1814
1900
  return call;
1815
1901
  }
@@ -1820,16 +1906,22 @@ var CallManager = class {
1820
1906
  throw new CliError("bad_request", "More than one call is on: name one (its id or its chat)", { calls: picked.map((c) => c.id) });
1821
1907
  }
1822
1908
  link(chat) {
1823
- return this.host.engine.getState().links.find((l) => l.id === chat);
1909
+ return this.host.engine.chatView(chat);
1824
1910
  }
1825
- /** A chat by id, contact key, prefix or name (the API's rules, `findChat`); a group's says it is one. */
1826
- chatId(ref) {
1911
+ /**
1912
+ * A chat by id, contact key, prefix or name (the API's rules, `findChat`); a group's says it is one. By its id (as
1913
+ * events name it, and a call's own chat), only that chat's view is built: a call placed and hung up built every chat's
1914
+ * five times, one rung and answered six, ~0.2 s of the daemon's thread at 2,000 chats.
1915
+ */
1916
+ chatOf(ref) {
1917
+ const byId = this.link(ref);
1918
+ if (byId) return byId;
1827
1919
  const { links, groups } = this.host.engine.getState();
1828
- return findChat(links, ref, groups).id;
1920
+ return findChat(links, ref, groups);
1829
1921
  }
1830
1922
  /** The chat, if a call can go in it now; else why not (the engine's reason). */
1831
1923
  callable(ref) {
1832
- const link = this.link(this.chatId(ref));
1924
+ const link = this.chatOf(ref);
1833
1925
  if (this.host.answers === false) throw new CliError("unavailable", CALLS_NEED_DAEMON);
1834
1926
  if (!link.profile) throw new CliError("unavailable", "Calls are in chats made since 0.4 (the chat session): this is a compatibility chat");
1835
1927
  if (link.callsUnavailable === CALLS_NEED_LIVE) {
@@ -1837,7 +1929,7 @@ var CallManager = class {
1837
1929
  throw new CliError("unavailable", `${CALLS_NEED_LIVE}, and your contact's app is not connected now: ghostly chat wait ${shown} --until live waits for it, then call again`, { chat: link.id });
1838
1930
  }
1839
1931
  if (link.callsUnavailable) throw new CliError("unavailable", link.callsUnavailable);
1840
- if (this.host.engine.getState().settings?.relayOnly === true) throw new CliError("unavailable", CALLS_OFF_RELAY_ONLY);
1932
+ if (this.host.engine.getSettings()?.relayOnly === true) throw new CliError("unavailable", CALLS_OFF_RELAY_ONLY);
1841
1933
  return link;
1842
1934
  }
1843
1935
  autoFor(chat) {
@@ -1881,8 +1973,7 @@ function readAuto(path) {
1881
1973
  return off;
1882
1974
  }
1883
1975
  }
1884
- //#endregion
1885
- //#region src/daemonPresence.ts
1976
+ // src/daemonPresence.ts
1886
1977
  /** How often a daemon that shares its presence says `active` again: well within the engine's 10 minutes to `idle`. */
1887
1978
  var PRESENCE_EVERY_MS = STATUS_IDLE_AFTER_MS / 2;
1888
1979
  /**
@@ -2593,7 +2684,9 @@ var EventHub = class {
2593
2684
  stateChanged(state) {
2594
2685
  const quiet = !this.stateKnown;
2595
2686
  const links = new Map(state.links.map((link) => [link.id, link]));
2687
+ const last = new Map(this.state?.links.map((link) => [link.id, link]));
2596
2688
  for (const [id, link] of links) {
2689
+ if (last.get(id) === link && this.chats.has(id)) continue;
2597
2690
  const shape = chatShape(link), before = this.chats.get(id);
2598
2691
  this.chats.set(id, shape);
2599
2692
  if (quiet) continue;
@@ -2697,7 +2790,8 @@ var EventHub = class {
2697
2790
  this.forget(removedGroups, (event) => groupsGone.has(event.group) && event.type !== "group.removed");
2698
2791
  let edgeGroups;
2699
2792
  const groupOf = (linkId) => (edgeGroups ??= new Map(state.groups.flatMap((g) => g.members.flatMap((m) => m.edge ? [[m.edge.linkId, g.id]] : [])))).get(linkId) ?? parsePayLink(linkId)?.groupId;
2700
- for (const [id, payment] of Object.entries(state.payments ?? {})) {
2793
+ const payments = state.payments === this.state?.payments ? {} : state.payments ?? {};
2794
+ for (const [id, payment] of Object.entries(payments)) {
2701
2795
  const shape = `${payment.state}|${payment.error ?? ""}|${payment.closed ? 1 : 0}`, before = this.payments.get(id);
2702
2796
  this.payments.set(id, shape);
2703
2797
  if (quiet || before === shape) continue;
@@ -2715,22 +2809,25 @@ var EventHub = class {
2715
2809
  payment: json
2716
2810
  });
2717
2811
  }
2718
- for (const link of state.links) for (const identity of link.identities?.received ?? []) {
2719
- const key = `${link.id}:${identity.id}`, shape = identity.status, before = this.received.get(key);
2720
- this.received.set(key, shape);
2721
- if (quiet || before === shape) continue;
2722
- const id = before === void 0 ? `identity.received:${key}:${shape}` : `identity.status:${key}:${shape}:${this.now()}:${this.seq + 1}`;
2723
- this.emit(before === void 0 ? "identity.received" : "identity.status", id, {
2724
- chat: link.id,
2725
- identity: {
2726
- id: identity.id,
2727
- provider: identity.provider,
2728
- subject: identity.subject,
2729
- status: identity.status,
2730
- verified: identity.verified,
2731
- error: identity.error ?? null
2732
- }
2733
- });
2812
+ for (const link of state.links) {
2813
+ if (last.get(link.id) === link) continue;
2814
+ for (const identity of link.identities?.received ?? []) {
2815
+ const key = `${link.id}:${identity.id}`, shape = identity.status, before = this.received.get(key);
2816
+ this.received.set(key, shape);
2817
+ if (quiet || before === shape) continue;
2818
+ const id = before === void 0 ? `identity.received:${key}:${shape}` : `identity.status:${key}:${shape}:${this.now()}:${this.seq + 1}`;
2819
+ this.emit(before === void 0 ? "identity.received" : "identity.status", id, {
2820
+ chat: link.id,
2821
+ identity: {
2822
+ id: identity.id,
2823
+ provider: identity.provider,
2824
+ subject: identity.subject,
2825
+ status: identity.status,
2826
+ verified: identity.verified,
2827
+ error: identity.error ?? null
2828
+ }
2829
+ });
2830
+ }
2734
2831
  }
2735
2832
  for (const [id, transfer] of Object.entries(state.transfers ?? {})) this.transferChanged(id, transfer, state, quiet);
2736
2833
  this.state = state;
@@ -3532,8 +3629,7 @@ function journalWindow(path, lineAt = 0) {
3532
3629
  closeSync(fd);
3533
3630
  }
3534
3631
  }
3535
- //#endregion
3536
- //#region src/groupAuto.ts
3632
+ // src/groupAuto.ts
3537
3633
  var FILE = "groups.json";
3538
3634
  var GroupAutoJoin = class {
3539
3635
  host;
@@ -3671,8 +3767,7 @@ function readGrants(path) {
3671
3767
  return [];
3672
3768
  }
3673
3769
  }
3674
- //#endregion
3675
- //#region src/joinLog.ts
3770
+ // src/joinLog.ts
3676
3771
  /**
3677
3772
  * A join through a group's link, as a daemon says it in its log (stderr): the steps of the knock and of the entry
3678
3773
  * session, one short line each, from the engine's join trace (packages/browser/src/engine/joinTrace.ts). Without them a
@@ -3713,8 +3808,7 @@ function joinLogLine(traced) {
3713
3808
  const at = typeof step.t === "number" ? ` at ${new Date(step.t).toISOString()}` : "";
3714
3809
  return `ghostly: group ${step.g}: ${SAID[step.step]}${role ? ` (${role === "host" ? "letting in" : "joining"})` : ""}${at}`;
3715
3810
  }
3716
- //#endregion
3717
- //#region src/runtime/fedimint.ts
3811
+ // src/runtime/fedimint.ts
3718
3812
  /**
3719
3813
  * The Fedimint client on Node (WISP 1100 § Wallet SDKs on Node): the app's own SDK and WebAssembly, each database in
3720
3814
  * a `worker_threads` worker (fedimintWorker.mjs) and a file of the profile's `fedimint/` folder, where the browser has
@@ -3822,8 +3916,7 @@ function nodeFedimintSdk(dir) {
3822
3916
  throw error;
3823
3917
  });
3824
3918
  }
3825
- //#endregion
3826
- //#region src/runtime/fileFetch.ts
3919
+ // src/runtime/fileFetch.ts
3827
3920
  /**
3828
3921
  * `fetch` for `file:` URLs, which Node's does not do. The wallet SDKs' WebAssembly (Bark, BDK, Breez, Iroh) is loaded
3829
3922
  * the way a page loads it, `fetch(new URL("…wasm", import.meta.url))`; on Node that URL is a file beside the bundle.
@@ -3843,8 +3936,7 @@ function installFileFetch() {
3843
3936
  };
3844
3937
  globalThis.fetch = patched;
3845
3938
  }
3846
- //#endregion
3847
- //#region src/runtime/pushSend.ts
3939
+ // src/runtime/pushSend.ts
3848
3940
  /** An address as bytes (4 or 16), or null when it is not one. */
3849
3941
  function addressBytes(address) {
3850
3942
  const family = isIP(address);
@@ -3918,8 +4010,7 @@ async function nodePushSend(push, lookup = publicOnlyLookup) {
3918
4010
  req.end(push.body);
3919
4011
  });
3920
4012
  }
3921
- //#endregion
3922
- //#region src/runtime/holdFetch.ts
4013
+ // src/runtime/holdFetch.ts
3923
4014
  /**
3924
4015
  * How the CLI reads a held item or manifest (WISP 404): a GET to the address the contact chose, only
3925
4016
  * at a name whose every address is public, checked when the connection is made (so a name that changes its answer
@@ -3946,8 +4037,7 @@ function nodeHoldFetch(lookup = publicOnlyLookup) {
3946
4037
  req.end();
3947
4038
  });
3948
4039
  }
3949
- //#endregion
3950
- //#region src/runtime/irohRelay.ts
4040
+ // src/runtime/irohRelay.ts
3951
4041
  /**
3952
4042
  * Whether the CLI's Iroh may dial a contact through the relay its descriptor names (irohWeb.ts `publicRelay`): at a
3953
4043
  * public address, or at a name whose every address is public now, as a held item's is (`publicOnlyLookup`). Asked again
@@ -4001,8 +4091,7 @@ function relaySockets(scope) {
4001
4091
  } });
4002
4092
  return names;
4003
4093
  }
4004
- //#endregion
4005
- //#region src/runtime/rows.ts
4094
+ // src/runtime/rows.ts
4006
4095
  /** The warning `node:sqlite` gives as it loads (experimental on Node 22 and 23): said once for every command, it is noise. */
4007
4096
  var SQLITE_WARNING = /^SQLite is an experimental feature/;
4008
4097
  var loaded;
@@ -4065,8 +4154,7 @@ function rowRecords(rows) {
4065
4154
  return record;
4066
4155
  } };
4067
4156
  }
4068
- //#endregion
4069
- //#region src/runtime/keyBytes.ts
4157
+ // src/runtime/keyBytes.ts
4070
4158
  /**
4071
4159
  * An IndexedDB key as bytes whose order is the keys' own (W3C IndexedDB § Compare two keys: a number before a date
4072
4160
  * before a string before binary before an array; strings by UTF-16 code unit; arrays item by item, the shorter
@@ -4135,8 +4223,7 @@ function number(value, out) {
4135
4223
  out.push(negative ? ~byte & 255 : at === 0 ? byte ^ 128 : byte);
4136
4224
  }
4137
4225
  }
4138
- //#endregion
4139
- //#region src/runtime/sqlTree.ts
4226
+ // src/runtime/sqlTree.ts
4140
4227
  var buffer = (bytes) => Buffer.from(bytes, "latin1");
4141
4228
  /**
4142
4229
  * Values just read from rows.db, which nothing else holds: fake-indexeddb copies each value it hands out, and for these
@@ -4247,6 +4334,15 @@ var TreeFile = class {
4247
4334
  closeSync(fd);
4248
4335
  }
4249
4336
  }
4337
+ /**
4338
+ * rows.db written again whole (VACUUM), with nothing but its rows: `secure_delete` zeroes the cell a delete frees, not
4339
+ * the copies a page's rebalancing left in its unused space, where a text gone from every row was still found after a
4340
+ * few thousand writes. A second or two for a profile of 100,000 messages, the thread held: only when asked
4341
+ * (`message delete --purge`).
4342
+ */
4343
+ scrub() {
4344
+ this.db.exec("VACUUM");
4345
+ }
4250
4346
  /** Trees whose store or index is gone from the schema (deleted, a database removed) go, with their entries. */
4251
4347
  sweep(keep) {
4252
4348
  const ids = this.db.prepare("SELECT id FROM trees").all().map((row) => Number(row.id)).filter((id) => !keep.has(id));
@@ -4578,7 +4674,8 @@ var SqlTree = class SqlTree {
4578
4674
  /**
4579
4675
  * rows.db, owner-only (SQLite makes its WAL files with the database's mode), in WAL with NORMAL: the journal makes a
4580
4676
  * transaction durable, and `sync` runs before a snapshot takes the journal's place. With `secure_delete` SQLite zeroes
4581
- * what a delete frees: a message or chat deleted is not left readable in the file's free pages after the fold.
4677
+ * what a delete frees: a message or chat deleted is not left readable in the file's free pages after the fold (but for
4678
+ * a copy a page's rebalancing left behind, now and then: `TreeFile.scrub`).
4582
4679
  */
4583
4680
  function openTreeFile(sqlite, path, constraintError) {
4584
4681
  closeSync(openSync(path, "a", 384));
@@ -4622,8 +4719,7 @@ function holdsBlob(value, depth = 0) {
4622
4719
  for (const item of Object.values(value)) if (holdsBlob(item, depth + 1)) return true;
4623
4720
  return false;
4624
4721
  }
4625
- //#endregion
4626
- //#region src/runtime/storage.ts
4722
+ // src/runtime/storage.ts
4627
4723
  var SNAPSHOT = "snapshot.bin";
4628
4724
  var JOURNAL = "journal.bin";
4629
4725
  var ROWS = "rows.db";
@@ -4897,9 +4993,7 @@ async function openPersistentIndexedDb(dir, options = {}) {
4897
4993
  pending.delete(this._rollbackLog);
4898
4994
  trees?.abort(this._rollbackLog);
4899
4995
  }
4900
- const dispatched = dispatch.call(this, event);
4901
- if ((event.type === "complete" || event.type === "abort") && this._state === "finished") dropEnded(this.db._rawDatabase, this);
4902
- return dispatched;
4996
+ return dispatch.call(this, event);
4903
4997
  };
4904
4998
  const deleteDatabase = factory.deleteDatabase.bind(factory);
4905
4999
  factory.deleteDatabase = (name) => {
@@ -5046,7 +5140,7 @@ async function openPersistentIndexedDb(dir, options = {}) {
5046
5140
  * `sync`: "now", synced before this returns; "shared", synced by the caller through `shareSync`; "lazy", a relaxed
5047
5141
  * transaction's entry. A sync blocks the whole process for milliseconds, and what such a transaction wrote can be
5048
5142
  * made again (the event set's note of a message it already reported): written, it outlives the process; a power cut
5049
- * may take its last second.
5143
+ * may take its last second. Its sync, a second later, runs off the thread as a shared one does.
5050
5144
  */
5051
5145
  function writeEntry(entry, sync = "now") {
5052
5146
  const lazy = sync === "lazy";
@@ -5072,11 +5166,8 @@ async function openPersistentIndexedDb(dir, options = {}) {
5072
5166
  throw error;
5073
5167
  }
5074
5168
  if (lazy) relaxed ??= setTimeout(() => {
5075
- try {
5076
- syncNow();
5077
- } catch (error) {
5078
- failed(error);
5079
- }
5169
+ relaxed = null;
5170
+ shareSync(() => {});
5080
5171
  }, RELAXED_SYNC_MS).unref();
5081
5172
  holdsRatchet ||= entry.includes(RATCHET);
5082
5173
  if (statSync(journalPath).size > COMPACT_BYTES || ratchetDue() || deleteDue()) enqueue(writeSnapshot);
@@ -5126,11 +5217,11 @@ async function openPersistentIndexedDb(dir, options = {}) {
5126
5217
  async function synced() {
5127
5218
  while (syncing) await syncing;
5128
5219
  }
5129
- async function writeSnapshot() {
5220
+ async function writeSnapshot(scrub = false) {
5130
5221
  const dirty = schemaDirty;
5131
5222
  schemaDirty = false;
5132
5223
  try {
5133
- await snapshotToDisk();
5224
+ await snapshotToDisk(scrub);
5134
5225
  } catch (error) {
5135
5226
  schemaDirty ||= dirty;
5136
5227
  throw error;
@@ -5269,12 +5360,13 @@ async function openPersistentIndexedDb(dir, options = {}) {
5269
5360
  reader?.db.close();
5270
5361
  }
5271
5362
  }
5272
- async function snapshotToDisk() {
5363
+ async function snapshotToDisk(scrub = false) {
5273
5364
  await synced();
5274
5365
  const name = randomBytes(8).toString("hex");
5275
5366
  const snapshot = await capture(name);
5276
5367
  if (trees) {
5277
5368
  trees.apply(seq);
5369
+ if (scrub) trees.scrub();
5278
5370
  trees.sync();
5279
5371
  }
5280
5372
  const temporary = snapshotPath + ".tmp";
@@ -5345,10 +5437,10 @@ async function openPersistentIndexedDb(dir, options = {}) {
5345
5437
  factory,
5346
5438
  recovered: !replayed.closed,
5347
5439
  flush: () => queue,
5348
- async compact() {
5440
+ async compact(options) {
5349
5441
  await settled();
5350
5442
  let thrown = null;
5351
- await enqueue(() => writeSnapshot().catch((error) => {
5443
+ await enqueue(() => writeSnapshot(options?.scrub).catch((error) => {
5352
5444
  thrown = { error };
5353
5445
  throw error;
5354
5446
  }));
@@ -5629,24 +5721,6 @@ function readWithoutCopy(classes) {
5629
5721
  return values;
5630
5722
  };
5631
5723
  }
5632
- /** Transactions whose last event is out, by database, and dropped from its list at the next turn: all at once. */
5633
- var ended = /* @__PURE__ */ new WeakMap();
5634
- /** A finished transaction's place in its database's list, given back: one walk of the list for all that ended in a turn. */
5635
- function dropEnded(db, transaction) {
5636
- let gone = ended.get(db);
5637
- if (gone) {
5638
- gone.add(transaction);
5639
- return;
5640
- }
5641
- ended.set(db, gone = /* @__PURE__ */ new Set([transaction]));
5642
- setImmediate(() => {
5643
- ended.delete(db);
5644
- const list = db.transactions;
5645
- let kept = 0;
5646
- for (const held of list) if (!gone.has(held)) list[kept++] = held;
5647
- list.length = kept;
5648
- });
5649
- }
5650
5724
  /** The classes whose scheduler starts every transaction it can in one pass: shared by every store opened. */
5651
5725
  var onePass = /* @__PURE__ */ new WeakSet();
5652
5726
  /**
@@ -6183,8 +6257,7 @@ function safe(read) {
6183
6257
  return "";
6184
6258
  }
6185
6259
  }
6186
- //#endregion
6187
- //#region src/runtime/engine.ts
6260
+ // src/runtime/engine.ts
6188
6261
  setPublicKeyFastPath(nativePublicKey);
6189
6262
  /**
6190
6263
  * The HyperDHT network: `GHOSTLY_HYPERDHT_BOOTSTRAP` ("host:port,…") replaces the public bootstrap nodes, as it does
@@ -6407,7 +6480,7 @@ async function startRuntime(paths, options = {}) {
6407
6480
  const dht = mainlineNetwork();
6408
6481
  const trace = process.env.GHOSTLY_LINK_TRACE;
6409
6482
  if (trace) setLinkTraceSink((line) => appendFileSync(trace, line + "\n", { mode: 384 }));
6410
- if (trace || options.logJoins) (await import("./joinTrace-D-fnt2p3.js")).setJoinTraceSink((line) => {
6483
+ if (trace || options.logJoins) (await import("./joinTrace-CBr1jbch.js")).setJoinTraceSink((line) => {
6411
6484
  if (trace) appendFileSync(trace, line + "\n", { mode: 384 });
6412
6485
  const said = options.logJoins ? joinLogLine(line) : null;
6413
6486
  if (said) process.stderr.write(said + "\n");
@@ -6417,7 +6490,7 @@ async function startRuntime(paths, options = {}) {
6417
6490
  const restored = join(paths.dir, RESTORED_MARK);
6418
6491
  if (existsSync(restored)) {
6419
6492
  try {
6420
- const rows = await import("./restoredRows-C3LcxmOw.js");
6493
+ const rows = await import("./restoredRows-D_WSHE7H.js");
6421
6494
  await rows.markRestoredWallet();
6422
6495
  await rows.markLeftOutFiles(leftOutIn(restored));
6423
6496
  await rows.forgetRatchets();
@@ -6433,15 +6506,15 @@ async function startRuntime(paths, options = {}) {
6433
6506
  const callsUnavailable = typeof stack === "string" ? stack : null;
6434
6507
  installFileFetch();
6435
6508
  const testMints = process.env.GHOSTLY_TEST_MINTS;
6436
- if (testMints) (await import("./mints-BaOmx517.js")).declareTestMints(testMints.split(","));
6509
+ if (testMints) (await import("./mints-BcBODVVW.js")).declareTestMints(testMints.split(","));
6437
6510
  await installEventSource();
6438
6511
  await preloadWalletModules();
6439
- (await import("./ghostly_iroh_web-BzAXJUYH.js")).initSync({ module: irohWasmBytes() });
6440
- const [{ registerFileBytes }, { NodeFileBytes }] = await Promise.all([import("./fileBytes-BtIyoDF2.js"), import("./fileBytes-B0z9A6Le.js")]);
6512
+ (await import("./ghostly_iroh_web-DIj5xGmR.js")).initSync({ module: irohWasmBytes() });
6513
+ const [{ registerFileBytes }, { NodeFileBytes }] = await Promise.all([import("./fileBytes-CCKbwqG_.js"), import("./fileBytes-tj6-VZcB.js")]);
6441
6514
  registerFileBytes("native", async () => new NodeFileBytes(paths.files), true);
6442
- if (await (await import("./blobFiles-BmsrvZc3.js")).moveBlobFiles()) await store.compact();
6443
- const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-C1jZZ61O.js"), import("./endpoint-DarqblYE.js")]);
6444
- const mainline = dht.off ? null : new (await (import("./mainline-DCuGUSZF.js"))).Mainline({
6515
+ if (await (await import("./blobFiles-DDs34n0r.js")).moveBlobFiles()) await store.compact();
6516
+ const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-CQR7NLCz.js"), import("./endpoint-B0vE5ojY.js")]);
6517
+ const mainline = dht.off ? null : new (await (import("./mainline-CVrd0C1n.js"))).Mainline({
6445
6518
  bootstrap: dht.bootstrap,
6446
6519
  host: dht.host
6447
6520
  });
@@ -6449,7 +6522,7 @@ async function startRuntime(paths, options = {}) {
6449
6522
  ...pinned ? { relays: pinned } : {},
6450
6523
  ...relayBudgetForTests()
6451
6524
  };
6452
- const transport = mainline || pinned ? new (await (import("./mainline-DCuGUSZF.js"))).RelaysAndDht(mainline, relayOptions, !!pinned) : null;
6525
+ const transport = mainline || pinned ? new (await (import("./mainline-CVrd0C1n.js"))).RelaysAndDht(mainline, relayOptions, !!pinned) : null;
6453
6526
  const apps = servedApps(paths.dir).length > 0;
6454
6527
  const server = new EngineServer({
6455
6528
  ...transport ? { transport } : {},
@@ -6505,8 +6578,7 @@ async function startRuntime(paths, options = {}) {
6505
6578
  })()
6506
6579
  };
6507
6580
  }
6508
- //#endregion
6509
- //#region src/host.ts
6581
+ // src/host.ts
6510
6582
  /**
6511
6583
  * The most a connection may leave unread (answers and events the daemon wrote that its client has not taken): past
6512
6584
  * it, the connection ends. A `listen` stopped with Ctrl+Z, or a client that stops reading, kept every later event in
@@ -6527,6 +6599,7 @@ var BASELINE_NEWEST = 100;
6527
6599
  */
6528
6600
  async function openHost(paths, mode, version, options = {}) {
6529
6601
  ownProfile(paths.dir);
6602
+ const socketDir = mode === "daemon" ? callSocketDir() : void 0;
6530
6603
  const locked = acquireLock(paths);
6531
6604
  const unmark = mode === "daemon" ? markStarting(paths) : () => {};
6532
6605
  const release = () => {
@@ -6609,6 +6682,7 @@ async function openHost(paths, mode, version, options = {}) {
6609
6682
  engine: node,
6610
6683
  emit: (type, id, fields) => hub.emit(type, id, fields),
6611
6684
  profileDir: paths.dir,
6685
+ socketDir,
6612
6686
  answers: mode === "daemon"
6613
6687
  });
6614
6688
  const manager = calls;
@@ -6781,6 +6855,8 @@ function connection(ctx, socket, secret, answering) {
6781
6855
  const unsubscribe = () => {
6782
6856
  for (const off of unsubscribes.splice(0)) off();
6783
6857
  };
6858
+ const gone = new AbortController();
6859
+ socket.on("close", () => gone.abort());
6784
6860
  const write = (value, replayed = false) => {
6785
6861
  if (socket.destroyed || socket.writableEnded) return;
6786
6862
  if (!replayed && socket.writableLength > limit) {
@@ -6892,7 +6968,7 @@ function connection(ctx, socket, secret, answering) {
6892
6968
  for (const event of queued) if (event.seq > last) write({ event });
6893
6969
  return;
6894
6970
  }
6895
- const answered = callApi(ctx, request.method, request.params ?? {}).then((result) => write({
6971
+ const answered = callApi(ctx, request.method, request.params ?? {}, { gone: gone.signal }).then((result) => write({
6896
6972
  id,
6897
6973
  result: result ?? null
6898
6974
  }), (error) => write({
@@ -6903,7 +6979,6 @@ function connection(ctx, socket, secret, answering) {
6903
6979
  answered.then(() => answering.delete(answered));
6904
6980
  });
6905
6981
  }
6906
- //#endregion
6907
6982
  export { BASELINE_NEWEST, MAX_UNREAD, STOP_ANSWERS_MS, keepServing, openHost, serve };
6908
6983
 
6909
- //# sourceMappingURL=host-C0NMNQLl.js.map
6984
+ //# sourceMappingURL=host-z0FAHP9Z.js.map