@ghostlytools/cli 1.11.4 → 1.12.1

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 +31 -14
  2. package/dist/assets/{api-MYc6QNRs.js → api-BwEgbvvK.js} +395 -131
  3. package/dist/assets/api-BwEgbvvK.js.map +1 -0
  4. package/dist/assets/{api-BwyFq4lA.js → api-jRUXnBdX.js} +2 -2
  5. package/dist/assets/{apiKit-CfsNx9ZR.js → apiKit-BlsNk-Cx.js} +48 -11
  6. package/dist/assets/apiKit-BlsNk-Cx.js.map +1 -0
  7. package/dist/assets/appFetch-CW9fJPHh.js +602 -0
  8. package/dist/assets/appFetch-CW9fJPHh.js.map +1 -0
  9. package/dist/assets/apps-BcG4u6SM.js +1 -0
  10. package/dist/assets/{apps-h12II1us.js → apps-CL8TXHhu.js} +20 -14
  11. package/dist/assets/apps-CL8TXHhu.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-Chvy79SN.js → backup-BA41EDvh.js} +110 -26
  17. package/dist/assets/backup-BA41EDvh.js.map +1 -0
  18. package/dist/assets/backup-xZfV-ytw.js +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-Dh7n9amb.js} +4 -5
  23. package/dist/assets/{bitcoind-CdSmvy2y.js.map → bitcoind-Dh7n9amb.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-CsGdQNnR.js +1 -0
  31. package/dist/assets/{buttons-BgoExb4E.js → buttons-SH1tNRh7.js} +45 -23
  32. package/dist/assets/buttons-SH1tNRh7.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-DGS-atRu.js} +5 -8
  38. package/dist/assets/{client-DY8tZZWi.js.map → client-DGS-atRu.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-Cvu-taMs.js} +462 -424
  44. package/dist/assets/endpoint-Cvu-taMs.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-DxuJzko_.js} +6009 -25536
  70. package/dist/assets/groupMeta-DxuJzko_.js.map +1 -0
  71. package/dist/assets/{host-C0NMNQLl.js → host-BxM-HMr0.js} +262 -134
  72. package/dist/assets/host-BxM-HMr0.js.map +1 -0
  73. package/dist/assets/{hyperdhtRelay-Dz7pvcBA.js → hyperdhtRelay-DLUiwfnt.js} +36 -9
  74. package/dist/assets/hyperdhtRelay-DLUiwfnt.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-CbnGtUo6.js} +3231 -87
  82. package/dist/assets/irohWeb-CbnGtUo6.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-CwTaepxR.js} +296 -122
  91. package/dist/assets/main-CwTaepxR.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-DtzIllg2.js} +70 -20
  114. package/dist/assets/ownStatus-DtzIllg2.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-BOYGlmu2.js} +9 -10
  122. package/dist/assets/profiles-BOYGlmu2.js.map +1 -0
  123. package/dist/assets/registry-4W1LGlCF.js +1 -0
  124. package/dist/assets/{registry-Da-r6eC3.js → registry-Bep4umOM.js} +1296 -80
  125. package/dist/assets/registry-Bep4umOM.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-Bm6nci0I.js +1 -0
  133. package/dist/assets/{secretGuard-CsVHDdYk.js → secretGuard-BrATm_gl.js} +43 -22
  134. package/dist/assets/{secretGuard-CsVHDdYk.js.map → secretGuard-BrATm_gl.js.map} +1 -1
  135. package/dist/assets/{server-C1jZZ61O.js → server-D4gf-LnD.js} +9797 -479
  136. package/dist/assets/server-D4gf-LnD.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-DQvZgz2T.js} +27 -4
  156. package/dist/assets/waitNotice-DQvZgz2T.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,12 +1,11 @@
1
- import { Ao as PR_CHECKS, Bo as cardUrl, Fo as TASK_STATUSES, Ga as VOICE_LIMITS, Mo as ROUTINE_STATES, No as RUN_RESULTS, Oo as CRON_LINE, Po as STATUS_CARD_LIMITS, Uo as statusCardBytes, ei as STATUS_AVAILABILITIES, jo as PR_STATES, ko as ITEM_STATES, lr as GROUP_FILE_LIMITS, vo as reactionEmoji, zo as cardLine } from "./src-DJe-OYxd.js";
2
- import { i as localFileError, n as EXIT, r as asCliError, t as CliError } from "./errors-CAh6GLJZ.js";
3
- import { _ as hideSecretFields, a as PAY_METHODS, c as turnRef, d as ENGINE_METHODS, f as ENGINE_PARAMS, h as SECRET_RESULTS, i as CHAT_METHODS, m as READ_PARAMS, o as TRANSPORT_NAMES, p as ENGINE_READS, r as ADDRESS_TYPES, s as WALLET_TYPES, t as checkOwnStatus } from "./ownStatus-BoTf5WqQ.js";
4
- import { a as contactKeyOf, v as nameKey, y as namedByThem } from "./apiKit-CfsNx9ZR.js";
5
- import { n as dropSecretEnv, t as childEnv } from "./childEnv-K_IzUqQx.js";
6
- import { i as waitsFor, r as waitNotice } from "./waitNotice-Cn0WJ-He.js";
7
- import { S as userPath, _ as profileExists, b as startingDaemon, c as createProfile, d as daemonClaim, f as ghostlyHome, g as noProfile, i as checkProfileName, l as currentProfile, m as lockOwner, o as checkShownNameOption, p as listProfiles, s as claimForDaemon, u as currentProfileOrNone, v as profilePaths, w as ownProfile, y as selectProfile } from "./profiles-DszHjEJi.js";
8
- import { t as jsonOut } from "./jsonOut-POtMBS_V.js";
9
- import { a as endedUnsent, i as endedUnanswered, o as isNotTheDaemon, p as CALL_RATES, r as connectDaemon, s as notTheDaemon, t as DaemonClient, y as isCallRate } from "./client-DY8tZZWi.js";
1
+ import { i as localFileError, n as EXIT, r as asCliError, t as CliError } from "./errors-DDLFO4Gf.js";
2
+ import { a as endedUnsent, i as endedUnanswered, o as isNotTheDaemon, p as CALL_RATES, r as connectDaemon, s as notTheDaemon, t as DaemonClient, y as isCallRate } from "./client-DGS-atRu.js";
3
+ import { n as dropSecretEnv, t as childEnv } from "./childEnv-C-99hdbL.js";
4
+ import { Cr as cardUrl, D as GROUP_FILE_LIMITS, Dr as statusCardBytes, En as VOICE_LIMITS, Sr as cardLine, Zn as reactionEmoji, _r as TASK_STATUSES, bt as STATUS_AVAILABILITIES, dr as ITEM_STATES, fr as PR_CHECKS, gr as STATUS_CARD_LIMITS, hr as RUN_RESULTS, mr as ROUTINE_STATES, pr as PR_STATES, ur as CRON_LINE } from "./groupMeta-DxuJzko_.js";
5
+ import { S as userPath, _ as profileExists, b as startingDaemon, c as createProfile, d as daemonClaim, f as ghostlyHome, g as noProfile, i as checkProfileName, l as currentProfile, m as lockOwner, o as checkShownNameOption, p as listProfiles, s as claimForDaemon, u as currentProfileOrNone, v as profilePaths, w as ownProfile, y as selectProfile } from "./profiles-BOYGlmu2.js";
6
+ import { _ as hideSecretFields, a as PAY_METHODS, c as turnRef, d as ENGINE_METHODS, f as ENGINE_PARAMS, h as SECRET_RESULTS, i as CHAT_METHODS, m as READ_PARAMS, o as TRANSPORT_NAMES, p as ENGINE_READS, r as ADDRESS_TYPES, s as WALLET_TYPES, t as checkOwnStatus } from "./ownStatus-DtzIllg2.js";
7
+ import { B as shellWord, V as jsonOut, a as contactKeyOf, b as namedByThem, y as nameKey } from "./apiKit-BlsNk-Cx.js";
8
+ import { i as waitsFor, r as waitNotice } from "./waitNotice-DQvZgz2T.js";
10
9
  import { spawn } from "node:child_process";
11
10
  import { accessSync, closeSync, constants, existsSync, fstatSync, openSync, readFileSync, readSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
12
11
  import { dirname, resolve, sep } from "node:path";
@@ -14,7 +13,7 @@ import { connect } from "node:net";
14
13
  import { format } from "node:util";
15
14
  var package_default = {
16
15
  name: "@ghostlytools/cli",
17
- version: "1.11.4",
16
+ version: "1.12.1",
18
17
  type: "module",
19
18
  description: "Ghostly for bots and terminals: the app's own engine, headless on Node, behind a daemon and a `ghostly` command with JSON output.",
20
19
  license: "MIT",
@@ -42,12 +41,12 @@ var package_default = {
42
41
  "test": "vitest run"
43
42
  },
44
43
  dependencies: {
45
- "@arkade-os/sdk": "0.4.79",
44
+ "@arkade-os/sdk": "0.5.4",
46
45
  "@atproto/jwk-webcrypto": "^0.3.4",
47
- "@atproto/oauth-client": "^0.8.9",
48
- "@bitcoindevkit/bdk-wallet-web": "0.3.0",
49
- "@bitcoinerlab/descriptors-scure": "^3.2.0",
50
- "@cashu/cashu-ts": "^4.11.0",
46
+ "@atproto/oauth-client": "^0.9.3",
47
+ "@bitcoindevkit/bdk-wallet-web": "0.4.0",
48
+ "@bitcoinerlab/descriptors-scure": "^3.2.1",
49
+ "@cashu/cashu-ts": "^4.13.0",
51
50
  "@fedimint/core": "0.0.0-canary-eea6a3c98909fa8e736d6dadb1f1243fd3322b27",
52
51
  "@fedimint/fedimint-client-wasm-bundler": "0.0.0-canary-eea6a3c98909fa8e736d6dadb1f1243fd3322b27",
53
52
  "@fedimint/types": "0.0.0-canary-eea6a3c98909fa8e736d6dadb1f1243fd3322b27",
@@ -59,20 +58,20 @@ var package_default = {
59
58
  "@scure/bip32": "^2.4.0",
60
59
  "@scure/bip39": "2.4.0",
61
60
  "@scure/btc-signer": "2.4.1",
62
- "@secondts/bark": "0.25.0",
61
+ "@secondts/bark": "0.27.0",
63
62
  "@serenity-kit/opaque": "1.1.0",
64
- "@synonymdev/pubky": "0.16.2",
63
+ "@synonymdev/pubky": "0.18.0",
65
64
  "@tetherto/wdk-wallet-evm": "1.0.0-beta.24",
66
65
  "b4a": "1.9.0",
67
66
  "bittorrent-dht": "11.0.12",
68
67
  "ethers": "6.17.0",
69
- "eventsource": "^5.1.3",
70
- "fake-indexeddb": "6.2.5",
71
- "hyperdht": "6.34.1",
68
+ "eventsource": "^5.1.4",
69
+ "fake-indexeddb": "6.2.8",
70
+ "hyperdht": "6.36.0",
72
71
  "keet-identity-key": "3.2.0",
73
72
  "mpg123-decoder": "1.0.3",
74
- "node-datachannel": "^0.33.4",
75
- "nostr-tools": "2.25.2",
73
+ "node-datachannel": "^0.33.6",
74
+ "nostr-tools": "2.26.0",
76
75
  "opus-decoder": "0.7.12",
77
76
  "opusscript": "0.1.1",
78
77
  "ws": "8.22.1"
@@ -81,19 +80,28 @@ var package_default = {
81
80
  "@ghostly/browser": "*",
82
81
  "@ghostly/core": "*",
83
82
  "@ghostly/iroh-web": "*",
84
- "@types/node": "^26.6.5",
83
+ "@types/node": "^26.6.6",
85
84
  "typescript": "^5.9.3",
86
- "vite": "^8.3.4",
87
- "vitest": "^5.0.5"
85
+ "vite": "^8.3.6",
86
+ "vitest": "^5.1.0"
88
87
  }
89
88
  };
90
- //#endregion
91
- //#region src/args.ts
89
+ // src/args.ts
92
90
  /**
93
91
  * A number as typed on the command line, in decimal digits only (`21`, `-5`, `12.5`); NaN for any other word.
94
92
  * `Number()` alone read `1e3` as 1,000, `0x10` as 16 and `" 21"` as 21: `chat pay bob 2e3`, a typo of 23, paid 2,000.
95
93
  */
96
94
  var decimalNumber = (value) => /^-?\d+(\.\d+)?$/.test(value) ? Number(value) : NaN;
95
+ var notANumber = (name, option, value) => new CliError("usage", `--${name} takes ${option.takes ?? "a number"}, not ${JSON.stringify(value)}`);
96
+ /**
97
+ * The word right after an option that stood alone because it was no number (`--voice 2s`), by the positionals a parse
98
+ * returned: should the line have one too many, that word was the option's value, and `strayValue` says so.
99
+ */
100
+ var lonelyValues = /* @__PURE__ */ new WeakMap();
101
+ /** The refusal of an option's value that was taken as a positional (`--voice 2s`), else undefined. */
102
+ function strayValue(values) {
103
+ return lonelyValues.get(values)?.find(({ index, word }) => values[index] === word)?.refusal;
104
+ }
97
105
  /**
98
106
  * Options every command takes. They may come anywhere on the line.
99
107
  */
@@ -143,6 +151,7 @@ function parseArgs(argv, spec, idSlot = () => false, parsing) {
143
151
  return Object.hasOwn(all, name) || name.startsWith("no-") && all[name.slice(3)]?.type === "boolean";
144
152
  };
145
153
  const positionals = [];
154
+ const lonely = [];
146
155
  const options = {};
147
156
  const setBoolean = (name, value) => {
148
157
  if (all[name].eitherWay && options[name] !== void 0 && options[name] !== value) throw new CliError("usage", `--${name} or --no-${name}, not both`);
@@ -186,8 +195,14 @@ function parseArgs(argv, spec, idSlot = () => false, parsing) {
186
195
  continue;
187
196
  }
188
197
  let value = inline;
189
- if (value === void 0 && option.optionalValue && !(i + 1 < argv.length && argv[i + 1] !== "" && Number.isFinite(Number(argv[i + 1])))) {
198
+ if (value === void 0 && option.optionalValue && !(i + 1 < argv.length && Number.isFinite(Number(argv[i + 1])))) {
190
199
  options[name] = true;
200
+ const next = argv[i + 1];
201
+ if (next && !next.startsWith("-")) lonely.push({
202
+ index: positionals.length,
203
+ word: next,
204
+ refusal: notANumber(name, option, next)
205
+ });
191
206
  continue;
192
207
  }
193
208
  if (value === void 0) {
@@ -196,7 +211,7 @@ function parseArgs(argv, spec, idSlot = () => false, parsing) {
196
211
  }
197
212
  if (option.type === "number") {
198
213
  const number = decimalNumber(value);
199
- if (!Number.isFinite(number)) throw new CliError("usage", `--${name} takes a number, not ${JSON.stringify(value)}`);
214
+ if (!Number.isFinite(number)) throw notANumber(name, option, value);
200
215
  options[name] = number;
201
216
  } else if (option.type === "list") options[name] = [...options[name] ?? [], value];
202
217
  else {
@@ -208,6 +223,7 @@ function parseArgs(argv, spec, idSlot = () => false, parsing) {
208
223
  if (arg.startsWith("-") && arg !== "-") throw unknownOption(arg, all, parsing);
209
224
  positionals.push(arg);
210
225
  }
226
+ if (lonely.length) lonelyValues.set(positionals, lonely);
211
227
  return {
212
228
  positionals,
213
229
  options
@@ -220,12 +236,23 @@ function parseArgs(argv, spec, idSlot = () => false, parsing) {
220
236
  function unknownOption(arg, all, parsing, help = parsing ? `ghostly help ${parsing.command}` : void 0) {
221
237
  const names = Object.entries(all).flatMap(([name, o]) => o.type === "boolean" ? [name, `no-${name}`] : [name]);
222
238
  const near = nearest(arg.replace(/^--?/, ""), names);
239
+ const privateKey = /PRIVATE KEY/.test(arg);
223
240
  const hints = [
224
241
  ...near ? [`did you mean --${near}?`] : [],
242
+ ...privateKey ? ["never paste a private key anywhere: Ghostly only needs the public key;"] : [],
225
243
  ...parsing?.text && /^-[^-]/.test(arg) ? ["put -- before text that starts with a dash;"] : [],
226
244
  ...help ? [help] : []
227
245
  ];
228
- return new CliError("usage", `Unknown option ${arg}${parsing ? ` for ghostly ${parsing.command}` : ""}${hints.length ? ` (${hints.join(" ")})` : ""}`);
246
+ return new CliError("usage", `Unknown option ${shownOption(arg, privateKey)}${parsing ? ` for ghostly ${parsing.command}` : ""}${hints.length ? ` (${hints.join(" ")})` : ""}`);
247
+ }
248
+ /**
249
+ * An unknown option as its refusal names it: a pasted private key (a PEM or OpenPGP block starts with dashes), a word
250
+ * with a line break or one longer than any option's name is described, not printed (docs/CLI.md "Secrets stay hidden").
251
+ * A seed, an nsec, a hex key or a Cashu token is longer than 40 characters too.
252
+ */
253
+ function shownOption(arg, privateKey) {
254
+ if (privateKey) return "(a private key)";
255
+ return arg.length > 40 || /[\r\n]/.test(arg) ? `(a ${arg.length}-character word)` : arg;
229
256
  }
230
257
  /**
231
258
  * A first word that starts with a dash and is no global option (`ghostly --porfile bot send …`, `ghostly -x status`):
@@ -323,8 +350,7 @@ function liftGlobals(argv) {
323
350
  ...rest.slice(dash)
324
351
  ];
325
352
  }
326
- //#endregion
327
- //#region src/commands/shared.ts
353
+ // src/commands/shared.ts
328
354
  var wait = {
329
355
  wait: {
330
356
  type: "string",
@@ -695,6 +721,13 @@ function cardBytes(fields, flags) {
695
721
  if (bytes > STATUS_CARD_LIMITS.bytes) throw new CliError("usage", `The card takes ${bytes} bytes, and holds at most ${STATUS_CARD_LIMITS.bytes} in all (a character past Latin takes 2 to 4): give shorter or fewer ${flags}`);
696
722
  return fields;
697
723
  }
724
+ /**
725
+ * A card's `--id` given as "" (an unset variable in a script: `--id "$ID"`) is a usage error. Taken as not given, a new
726
+ * id was made, and a script meant to update its card posted a second one.
727
+ */
728
+ function cardId(options) {
729
+ if (options.id === "") throw new CliError("usage", "--id needs a card id");
730
+ }
698
731
  /** `--progress`, `--left`: a percent, or a usage error that names the flag. */
699
732
  function percent(options, flag) {
700
733
  const value = options[flag];
@@ -734,6 +767,7 @@ function taskFields(options) {
734
767
  ["pr-state", PR_STATES],
735
768
  ["pr-checks", PR_CHECKS]
736
769
  ]) oneWord(options, flag, words);
770
+ cardId(options);
737
771
  set("id", options.id);
738
772
  set("title", options.title);
739
773
  set("status", options.status);
@@ -912,6 +946,7 @@ function routineFields(options) {
912
946
  throw new CliError("usage", length > STATUS_CARD_LIMITS.cron ? `--cron takes at most ${STATUS_CARD_LIMITS.cron} characters, not ${length}` : `--cron takes a cron line of 0-9 A-Z a-z * , / ? # - and spaces, not ${JSON.stringify(options.cron)}`);
913
947
  }
914
948
  oneWord(options, "state", ROUTINE_STATES);
949
+ cardId(options);
915
950
  for (const key of [
916
951
  "id",
917
952
  "name",
@@ -1050,6 +1085,7 @@ function usageFields(options) {
1050
1085
  ["window", STATUS_CARD_LIMITS.usageWindow]
1051
1086
  ]) cardText(`--${flag}`, options[flag], max);
1052
1087
  given("also", options.also, STATUS_CARD_LIMITS.usageWindows);
1088
+ cardId(options);
1053
1089
  for (const key of [
1054
1090
  "id",
1055
1091
  "left",
@@ -1110,8 +1146,7 @@ var usageOptions = {
1110
1146
  text: cardOptions.text,
1111
1147
  force: cardOptions.force
1112
1148
  };
1113
- //#endregion
1114
- //#region src/commands/apps.ts
1149
+ // src/commands/apps.ts
1115
1150
  /** The key file a command signs with: always named, never a default, never on the command line itself. */
1116
1151
  function keyFile(value, usage) {
1117
1152
  if (typeof value !== "string" || !value) throw new CliError("usage", `--key <file> is needed: ghostly ${usage}`);
@@ -1174,7 +1209,7 @@ var commands$8 = {
1174
1209
  description: "Replace the three files when they are there"
1175
1210
  }
1176
1211
  },
1177
- run: async ({ options }, a) => (await import("./apps-Dbw2Hcko.js")).initApp(a.dir, {
1212
+ run: async ({ options }, a) => (await import("./apps-BcG4u6SM.js")).initApp(a.dir, {
1178
1213
  name: options.name,
1179
1214
  title: options.title,
1180
1215
  force: options.force === true
@@ -1214,7 +1249,7 @@ var commands$8 = {
1214
1249
  description: "This version's sequence, higher than the bundle at --out's (default: one more than it)"
1215
1250
  }
1216
1251
  },
1217
- run: async ({ options }, a) => (await import("./apps-Dbw2Hcko.js")).publishApp(a.dir, keyFile(options.key, "app publish <dir> --key <file> [--out <file>] [--sequence n]"), here(options.out), options.sequence)
1252
+ run: async ({ options }, a) => (await import("./apps-BcG4u6SM.js")).publishApp(a.dir, keyFile(options.key, "app publish <dir> --key <file> [--out <file>] [--sequence n]"), here(options.out), options.sequence)
1218
1253
  },
1219
1254
  "app revoke": {
1220
1255
  method: "app.revoke",
@@ -1247,7 +1282,7 @@ var commands$8 = {
1247
1282
  description: "Allow --up-to past the bundle's own sequence (versions published from elsewhere), and a --reason that looks like a seed, a key or ecash"
1248
1283
  }
1249
1284
  },
1250
- run: async ({ options }, a) => (await import("./apps-Dbw2Hcko.js")).revokeApp(a.dir, keyFile(options.key, "app revoke <dir> --key <file> (--digest <digest>... | --up-to <sequence>) [--reason <text>] [--bundle <file>] [--force]"), {
1285
+ run: async ({ options }, a) => (await import("./apps-BcG4u6SM.js")).revokeApp(a.dir, keyFile(options.key, "app revoke <dir> --key <file> (--digest <digest>... | --up-to <sequence>) [--reason <text>] [--bundle <file>] [--force]"), {
1251
1286
  digests: options.digest,
1252
1287
  upTo: options["up-to"],
1253
1288
  reason: options.reason,
@@ -1308,7 +1343,7 @@ var commands$8 = {
1308
1343
  usage: "app verify <bundle|url>",
1309
1344
  summary: "Check a .ghostlyapp as a client would, from a file or an https URL: its manifest and digest, or refused (exit 1) with the reason, revoked when the ghostly-revoke.json beside it (for a URL, or beside one of its sources) revokes this version",
1310
1345
  args: ["bundle"],
1311
- run: async (_, a) => (await import("./apps-Dbw2Hcko.js")).verifyApp(a.bundle)
1346
+ run: async (_, a) => (await import("./apps-BcG4u6SM.js")).verifyApp(a.bundle)
1312
1347
  },
1313
1348
  "store sign": {
1314
1349
  method: "store.sign",
@@ -1325,11 +1360,10 @@ var commands$8 = {
1325
1360
  description: "The folder to write ghostly-store.json and ghostly-store.sig in (default: the index's)"
1326
1361
  }
1327
1362
  },
1328
- run: async ({ options }, a) => (await import("./apps-Dbw2Hcko.js")).signStore(a.index, keyFile(options.key, "store sign <index> --key <file> [--out <dir>]"), here(options.out))
1363
+ run: async ({ options }, a) => (await import("./apps-BcG4u6SM.js")).signStore(a.index, keyFile(options.key, "store sign <index> --key <file> [--out <dir>]"), here(options.out))
1329
1364
  }
1330
1365
  };
1331
- //#endregion
1332
- //#region src/commands/calls.ts
1366
+ // src/commands/calls.ts
1333
1367
  /**
1334
1368
  * `--rate`: one of the rates a call takes, or a usage error (exit 2) that names the flag before the profile opens.
1335
1369
  * Before, the API's own check answered it ("rate must be …", exit 1), and `call answer` only once a call rang.
@@ -1407,8 +1441,7 @@ var commands$7 = {
1407
1441
  })
1408
1442
  }
1409
1443
  };
1410
- //#endregion
1411
- //#region src/commands/chats.ts
1444
+ // src/commands/chats.ts
1412
1445
  /** `react` and `pin` in a 1:1 chat: until the contact confirmed it, by default without a daemon (the process leaves). */
1413
1446
  var confirmWait = {
1414
1447
  wait: {
@@ -1747,7 +1780,7 @@ var commands$6 = {
1747
1780
  },
1748
1781
  "message delete": {
1749
1782
  method: "chat.delete",
1750
- usage: "message delete <chat|group> <message> [--everyone [--wait none|confirmed|sent] [--timeout s]]",
1783
+ usage: "message delete <chat|group> <message> [--everyone [--wait none|confirmed|sent] [--timeout s]] [--purge]",
1751
1784
  summary: "Forget a message on this device (the contact keeps theirs; a waiting text of yours is cancelled, or deleted for everyone if a relay may have it); --everyone deletes one of yours, in a chat or a group, from every member's device",
1752
1785
  args: ["chat", "message"],
1753
1786
  options: {
@@ -1764,7 +1797,11 @@ var commands$6 = {
1764
1797
  ],
1765
1798
  description: "With --everyone: in a chat none or confirmed, until the contact has it; in a group none or sent, until a member's edge took it (default: none with a daemon, confirmed or sent without)"
1766
1799
  },
1767
- timeout: wait.timeout
1800
+ timeout: wait.timeout,
1801
+ purge: {
1802
+ type: "boolean",
1803
+ description: "Take what it said out of the profile's folder now (the store folds at once), not within the hour: for a secret pasted into a chat"
1804
+ }
1768
1805
  },
1769
1806
  params: ({ options }, a) => {
1770
1807
  for (const flag of ["wait", "timeout"]) if (options[flag] !== void 0 && options.everyone !== true) throw new CliError("usage", `--${flag} goes with --everyone`);
@@ -1773,7 +1810,8 @@ var commands$6 = {
1773
1810
  message: a.message,
1774
1811
  everyone: options.everyone === true,
1775
1812
  wait: options.wait,
1776
- timeout: timeout(options)
1813
+ timeout: timeout(options),
1814
+ ...options.purge === true && { purge: true }
1777
1815
  };
1778
1816
  }
1779
1817
  },
@@ -1819,7 +1857,7 @@ var commands$6 = {
1819
1857
  timeout: groupWait.timeout
1820
1858
  },
1821
1859
  params: ({ options }, a) => {
1822
- if (a.message === void 0 && options.remove !== true) throw new CliError("usage", "Missing <message>: ghostly pin <chat|group> <message> | --remove");
1860
+ if (!a.message && options.remove !== true) throw new CliError("usage", "Missing <message>: ghostly pin <chat|group> <message> | --remove");
1823
1861
  if (a.message?.includes(" ")) throw new CliError("usage", "Too many arguments: ghostly pin <chat|group> <message> | --remove");
1824
1862
  return {
1825
1863
  chat: a.chat,
@@ -2016,8 +2054,7 @@ var commands$6 = {
2016
2054
  }
2017
2055
  }
2018
2056
  };
2019
- //#endregion
2020
- //#region src/commands/files.ts
2057
+ // src/commands/files.ts
2021
2058
  /**
2022
2059
  * `--voice [ms]` and `--peaks`: a length and a waveform a voice note takes, or a usage error (exit 2) that names the flag
2023
2060
  * before the profile opens. Before, the API answered them once it had opened ("voice must be a number from 1 to
@@ -2190,6 +2227,7 @@ var commands$5 = {
2190
2227
  voice: {
2191
2228
  type: "number",
2192
2229
  optionalValue: true,
2230
+ takes: "a length in milliseconds",
2193
2231
  description: "A voice note; its length in milliseconds (default: measured from the sound)"
2194
2232
  },
2195
2233
  peaks: {
@@ -2243,8 +2281,7 @@ var commands$5 = {
2243
2281
  })
2244
2282
  }
2245
2283
  };
2246
- //#endregion
2247
- //#region src/commands/general.ts
2284
+ // src/commands/general.ts
2248
2285
  /** `--until 30m`, `2h`, `1d`: that long from now. */
2249
2286
  var DURATION = /^(\d+)(m|h|d)$/;
2250
2287
  var UNIT_MS = {
@@ -2351,8 +2388,7 @@ var commands$4 = {
2351
2388
  summary: "This profile's status (status set), or null when it has none"
2352
2389
  }
2353
2390
  };
2354
- //#endregion
2355
- //#region src/commands/groups.ts
2391
+ // src/commands/groups.ts
2356
2392
  var nameForce = {
2357
2393
  type: "boolean",
2358
2394
  description: "Use the name even if it looks like a seed, a key or ecash"
@@ -2400,6 +2436,39 @@ var commands$3 = {
2400
2436
  } : { on: false };
2401
2437
  }
2402
2438
  },
2439
+ "group call": {
2440
+ method: "group.call",
2441
+ usage: "group call <group> --sfu <https origin> [--e2ee | --no-e2ee] | --e2ee | --no-e2ee | --clear [--show-secret]",
2442
+ summary: "Name the node a community group's calls go through, turn sealed call media on or off, or --clear (admin)",
2443
+ args: ["group"],
2444
+ options: {
2445
+ ...showSecret,
2446
+ sfu: {
2447
+ type: "string",
2448
+ description: "The node's https origin, e.g. https://call.example.com"
2449
+ },
2450
+ e2ee: {
2451
+ type: "boolean",
2452
+ eitherWay: true,
2453
+ description: "Seal the call media end to end (--no-e2ee: off); left out, the group keeps what it had"
2454
+ },
2455
+ clear: {
2456
+ type: "boolean",
2457
+ description: "The group has no calls"
2458
+ }
2459
+ },
2460
+ params: ({ options }, a) => {
2461
+ if (options.sfu === void 0 && options.clear !== true && options.e2ee === void 0) throw new CliError("usage", "Missing --sfu, --e2ee, --no-e2ee or --clear: ghostly group call <group> --sfu <https origin> [--e2ee | --no-e2ee] | --e2ee | --no-e2ee | --clear");
2462
+ if (options.sfu !== void 0 && options.clear === true) throw new CliError("usage", "--clear removes the call node: not with --sfu");
2463
+ if (options.e2ee !== void 0 && options.clear === true) throw new CliError("usage", "--clear removes the call node: not with --e2ee or --no-e2ee");
2464
+ return {
2465
+ group: a.group,
2466
+ ...options.clear === true ? { clear: true } : options.sfu !== void 0 ? { sfu: options.sfu } : {},
2467
+ ...options.e2ee !== void 0 && { e2ee: options.e2ee === true },
2468
+ ...secret(options)
2469
+ };
2470
+ }
2471
+ },
2403
2472
  "group create": {
2404
2473
  method: "group.create",
2405
2474
  usage: "group create <name...> [--mesh] [--force]",
@@ -2691,8 +2760,7 @@ var commands$3 = {
2691
2760
  })
2692
2761
  }
2693
2762
  };
2694
- //#endregion
2695
- //#region src/commands/identities.ts
2763
+ // src/commands/identities.ts
2696
2764
  /** Identity proofs and x401 credentials: one entry per command, in alphabetical order (test/commands.test.ts checks). */
2697
2765
  var commands$2 = {
2698
2766
  "identity cancel": {
@@ -2710,7 +2778,7 @@ var commands$2 = {
2710
2778
  options: {
2711
2779
  "evidence-file": {
2712
2780
  type: "string",
2713
- description: "The tool's output, from this file"
2781
+ description: "The tool's output, from this file (- for stdin)"
2714
2782
  },
2715
2783
  stdin: {
2716
2784
  type: "boolean",
@@ -2719,10 +2787,11 @@ var commands$2 = {
2719
2787
  },
2720
2788
  params: ({ options }, a) => {
2721
2789
  if (options["evidence-file"] !== void 0 && options.stdin === true) throw new CliError("usage", "--evidence-file or --stdin, not both");
2790
+ const piped = options["evidence-file"] === "-";
2722
2791
  return {
2723
2792
  draft: a.draft,
2724
- evidenceFile: here(options["evidence-file"]),
2725
- stdin: options.stdin === true
2793
+ evidenceFile: piped ? void 0 : here(options["evidence-file"]),
2794
+ stdin: piped || options.stdin === true
2726
2795
  };
2727
2796
  }
2728
2797
  },
@@ -2817,8 +2886,7 @@ var commands$2 = {
2817
2886
  summary: "A fresh P-256 holder key: its public JWK goes to the issuer (the 8 newest wait for a credential; past them, the oldest is dropped)"
2818
2887
  }
2819
2888
  };
2820
- //#endregion
2821
- //#region src/commands/payments.ts
2889
+ // src/commands/payments.ts
2822
2890
  /**
2823
2891
  * `chat accept`'s --networks: mainnet and/or testnet, comma-separated; any other word, or none (an unset variable), is a
2824
2892
  * usage error before the profile opens, as a word --network does not take is. Before, the API refused it after a
@@ -3027,7 +3095,10 @@ var commands$1 = {
3027
3095
  type: "string",
3028
3096
  description: "Only this chat's"
3029
3097
  } },
3030
- params: ({ options }) => ({ chat: options.chat })
3098
+ params: ({ options }) => {
3099
+ if (options.chat === "") throw new CliError("usage", "--chat needs a chat");
3100
+ return { chat: options.chat };
3101
+ }
3031
3102
  },
3032
3103
  "payment reclaim": {
3033
3104
  method: "payment.reclaim",
@@ -3181,8 +3252,7 @@ var commands$1 = {
3181
3252
  })
3182
3253
  }
3183
3254
  };
3184
- //#endregion
3185
- //#region src/commands/services.ts
3255
+ // src/commands/services.ts
3186
3256
  /** Shared local services: one entry per command, in alphabetical order (test/commands.test.ts checks). */
3187
3257
  var commands = {
3188
3258
  "service add": {
@@ -3269,8 +3339,7 @@ var commands = {
3269
3339
  })
3270
3340
  }
3271
3341
  };
3272
- //#endregion
3273
- //#region src/commands/index.ts
3342
+ // src/commands/index.ts
3274
3343
  /**
3275
3344
  * The commands that are one API method each, one file per area of the app, each in alphabetical order. A new
3276
3345
  * command goes in its area's file at its place; a new area is a new file and its two lines here. The order here
@@ -3489,12 +3558,14 @@ function positionals(command, values) {
3489
3558
  noMoreThan(names.length, values, command.usage);
3490
3559
  return out;
3491
3560
  }
3492
- /** Words past a usage's arguments are refused, never dropped: `profile use my bot` would select `my`. */
3561
+ /**
3562
+ * Words past a usage's arguments are refused, never dropped: `profile use my bot` would select `my`. One of them right
3563
+ * after an option that stood alone (`file send bob v.wav --voice 2s`) is refused as that option's value.
3564
+ */
3493
3565
  function noMoreThan(count, values, usage) {
3494
- if (values.length > count) throw new CliError("usage", `Too many arguments: ghostly ${usage}`);
3566
+ if (values.length > count) throw strayValue(values) ?? new CliError("usage", `Too many arguments: ghostly ${usage}`);
3495
3567
  }
3496
- //#endregion
3497
- //#region src/listen.ts
3568
+ // src/listen.ts
3498
3569
  /** The cursor's own write failed, not the event's handling. */
3499
3570
  var CursorError = class extends Error {
3500
3571
  error;
@@ -3554,30 +3625,36 @@ async function allowlist(from, groups, call, peerOf) {
3554
3625
  keys.add(key);
3555
3626
  continue;
3556
3627
  }
3557
- const chat = await otherFlag(call("chat.get", { chat: ref }), ref, "--from");
3558
- if (chat.id !== ref && (!nameKey(ref) || nameKey(chat.label) !== nameKey(ref))) throw namedByThem(ref, {
3559
- chat: chat.id,
3560
- name: chat.peerName ?? null,
3561
- contact: chat.peer
3562
- });
3563
- chats.add(chat.id);
3628
+ chats.add(await fromChat(ref, call));
3564
3629
  }
3565
- for (const ref of groups) groupIds.add((await otherFlag(call("group.get", { group: ref }), ref, "--group")).id);
3630
+ for (const ref of groups) groupIds.add((await otherFlag(call("group.get", { group: ref }), ref, "--group", call)).id);
3566
3631
  return new Allowlist(chats, keys, groupIds, peerOf);
3567
3632
  }
3633
+ /** The chat `--from <ref>` names (not a contact key): its id, or `namedByThem` when only its contact chose `ref`. */
3634
+ async function fromChat(ref, call) {
3635
+ const chat = await otherFlag(call("chat.get", { chat: ref }), ref, "--from", call);
3636
+ if (chat.id !== ref && (!nameKey(ref) || nameKey(chat.label) !== nameKey(ref))) throw namedByThem(ref, {
3637
+ chat: chat.id,
3638
+ name: chat.peerName ?? null,
3639
+ contact: chat.peer
3640
+ });
3641
+ return chat.id;
3642
+ }
3568
3643
  /**
3569
3644
  * A `--from` that names a group, or a `--group` a chat: said with the flag that takes it. The lookup's own hint named
3570
3645
  * `ghostly group show` (or `chat show`), which lists nothing. A chat is named by its id: `--from` refuses a prefix of it
3571
- * or the name its contact chose, which `--group`'s lookup took.
3646
+ * or the name its contact chose, which `--group`'s lookup took, so a `--group` that found its chat only so is refused
3647
+ * as `--from` refuses it, with no `--from` to paste.
3572
3648
  */
3573
- async function otherFlag(lookup, ref, flag) {
3649
+ async function otherFlag(lookup, ref, flag, call) {
3574
3650
  try {
3575
3651
  return await lookup;
3576
3652
  } catch (error) {
3577
3653
  const other = flag === "--from" ? "group" : "chat";
3578
3654
  if (!(error instanceof CliError) || error.code !== "not_found" || typeof error.details?.[other] !== "string") throw error;
3655
+ if (other === "chat" && contactKeyOf(ref) === void 0) await fromChat(ref, call);
3579
3656
  const named = other === "chat" ? error.details.chat : ref;
3580
- const shown = /^[\w.:-]+$/.test(named) ? named : JSON.stringify(named);
3657
+ const shown = shellWord(named, error.details[other]);
3581
3658
  throw new CliError("not_found", `${JSON.stringify(ref)} is a ${other}, not a ${flag === "--from" ? "chat" : "group"}: ghostly listen ${flag === "--from" ? "--group" : "--from"} ${shown}`, error.details);
3582
3659
  }
3583
3660
  }
@@ -3687,6 +3764,29 @@ function readCursor(path) {
3687
3764
  throw new CliError("bad_request", `${path} holds no event number (${shown}): fix or remove it, or give --since`);
3688
3765
  }
3689
3766
  /**
3767
+ * Where listen starts: after the event number the cursor file holds, else after `since` (--since: the first start's
3768
+ * place). Before, --since won without a word, and a unit with `--since 0 --cursor f` ran every handled event's hook
3769
+ * again at each restart. A cursor file that holds no number is refused unless --since is given, which starts it.
3770
+ * `known`, once the journal's last event is: says on stderr where it starts. A cursor past it (a profile restored from a
3771
+ * backup, a journal reset, a cursor copied from another profile) starts with new events; before, stderr said "starting
3772
+ * after it" (or nothing, without --since) and the next event wrote a lower number over the file.
3773
+ */
3774
+ function startAt(since, cursor, say) {
3775
+ let kept;
3776
+ if (since === void 0) kept = readCursor(cursor);
3777
+ else try {
3778
+ kept = readCursor(cursor);
3779
+ } catch {}
3780
+ return {
3781
+ from: kept ?? since,
3782
+ known: (lastSeq) => {
3783
+ if (kept === void 0) return;
3784
+ if (kept > lastSeq) say(`ghostly: ${cursor} holds event ${kept}, past this profile's last event (${lastSeq}): starting with new events`);
3785
+ else if (since !== void 0 && kept !== since) say(`ghostly: ${cursor} holds event ${kept}: starting after it, not after --since ${since}`);
3786
+ }
3787
+ };
3788
+ }
3789
+ /**
3690
3790
  * Whether a cursor can be kept at `path`, asked before anything starts: its folder is there and takes a file. Before, a
3691
3791
  * folder that was not there was found at the first event: the listener ran, said "event N failed: ENOENT" for each one
3692
3792
  * and never wrote the cursor, so the next start began at the journal's end and skipped what came while it was down.
@@ -4123,14 +4223,17 @@ function followDaemon(address, client, handle, since, holdMs = PAUSE_HOLD_MS, pr
4123
4223
  if (current) current.resume();
4124
4224
  else reconnect(0);
4125
4225
  });
4126
- const follow = (c) => c.subscribe(feed.since, feed.take, () => {
4127
- if (current !== c) return;
4128
- current = null;
4129
- reconnect(1e3);
4130
- }).then((answer) => {
4131
- if (feed.since === void 0 && typeof answer?.lastSeq === "number") feed.since = answer.lastSeq;
4132
- return answer;
4133
- });
4226
+ const follow = (c) => {
4227
+ const asked = feed.since;
4228
+ return c.subscribe(asked, feed.take, () => {
4229
+ if (current !== c) return;
4230
+ current = null;
4231
+ reconnect(1e3);
4232
+ }).then((answer) => {
4233
+ if (typeof answer?.lastSeq === "number" && feed.since === asked && (asked === void 0 || asked > answer.lastSeq)) feed.since = answer.lastSeq;
4234
+ return answer;
4235
+ });
4236
+ };
4134
4237
  return {
4135
4238
  subscribed: follow(client),
4136
4239
  close: () => {
@@ -4139,8 +4242,7 @@ function followDaemon(address, client, handle, since, holdMs = PAUSE_HOLD_MS, pr
4139
4242
  }
4140
4243
  };
4141
4244
  }
4142
- //#endregion
4143
- //#region src/secretInput.ts
4245
+ // src/secretInput.ts
4144
4246
  /**
4145
4247
  * Secrets a command takes (a Cashu token, an API key, a card's form) come on stdin: on the command line they show in
4146
4248
  * `ps` to every user of the machine while the command runs, and stay in the shell's history. Still taken there, with
@@ -4242,6 +4344,14 @@ async function textFromStdin(read, command, asked, note) {
4242
4344
  })).replace(/\n$/, "");
4243
4345
  }
4244
4346
  /**
4347
+ * `identity complete <draft> --stdin` (or `--evidence-file -`): what the tool printed, from stdin. A terminal (a read
4348
+ * that would wait on the keyboard without a word) is a usage error, as identity add --stdin's is.
4349
+ */
4350
+ async function evidenceFromStdin(read, draft, tty = false) {
4351
+ if (tty) throw new CliError("usage", `Missing what the tool printed: stdin is a terminal; pipe it in (… | ghostly identity complete ${draft}) or give --evidence-file f`);
4352
+ return read();
4353
+ }
4354
+ /**
4245
4355
  * `identity complete <draft>` with neither --evidence-file nor --stdin, stdin not a terminal: asked with nothing first,
4246
4356
  * since a published record takes none; a draft that answers it takes a tool's output (`details.needs`) is asked again
4247
4357
  * with what was piped, read as a send reads its text.
@@ -4355,23 +4465,22 @@ function secretValuesWarning(list, type, provider, names) {
4355
4465
  if (!secret.length) return void 0;
4356
4466
  return `${secret.map((name) => `--value ${name}`).join(", ")} on the command line shows in ps and the shell's history: give ${secret.length > 1 ? "them" : "it"} on stdin instead (--stdin, name=value lines)`;
4357
4467
  }
4358
- //#endregion
4359
- //#region src/main.ts
4468
+ // src/main.ts
4360
4469
  var VERSION = package_default.version;
4361
4470
  /**
4362
4471
  * The engine's modules (the API, the host, the backup, the buttons) are loaded only where a command needs them here: a
4363
4472
  * command a running daemon answers loads none of them, and starts about as fast as Node does. Statically imported, they
4364
4473
  * cost every command ~100 ms before its socket was opened.
4365
4474
  */
4366
- var engineApi = () => import("./api-BwyFq4lA.js");
4367
- var engineHost = () => import("./host-C0NMNQLl.js");
4475
+ var engineApi = () => import("./api-jRUXnBdX.js");
4476
+ var engineHost = () => import("./host-BxM-HMr0.js");
4368
4477
  /**
4369
4478
  * `--translate <lang>`'s translator, or null (not asked; or the runtime is not there, said on stderr). Loaded only when
4370
4479
  * asked: the app's message parser it reads costs every other command nothing.
4371
4480
  */
4372
4481
  async function translatorFor(value, home) {
4373
4482
  if (value === void 0) return null;
4374
- const { loadDetector, openTranslator, translateTarget } = await import("./translate-CUuC5szR.js");
4483
+ const { loadDetector, openTranslator, translateTarget } = await import("./translate-BcbSWkuq.js");
4375
4484
  return openTranslator({
4376
4485
  home,
4377
4486
  to: translateTarget(value),
@@ -4519,12 +4628,21 @@ function newChatOnly(method) {
4519
4628
  function oneChatOnly(method, params) {
4520
4629
  return newChatOnly(method) || (chatOnly(method, params) || chatOrGroup(method, params)) && typeof params.chat === "string";
4521
4630
  }
4522
- /** What a member says in one group, over that group's own edges: no 1:1 chat carries any of it. */
4631
+ /**
4632
+ * What a member says in one group, over that group's own edges: no 1:1 chat carries any of it. The admin's name,
4633
+ * picture, call node, hubs and fresh secret too (the group's metadata or a commit). Not `group.remove` (the one removed hears it
4634
+ * over the chat that invited them) nor `group.admin` (the new admin takes back the invitations still out).
4635
+ */
4523
4636
  var GROUP_EDGES_ONLY = /* @__PURE__ */ new Set([
4524
4637
  "group.send",
4525
4638
  "group.edit",
4526
4639
  "group.react",
4527
- "group.typing"
4640
+ "group.typing",
4641
+ "group.rename",
4642
+ "group.picture",
4643
+ "group.call",
4644
+ "group.hub",
4645
+ "group.rotate"
4528
4646
  ]);
4529
4647
  /**
4530
4648
  * A command about one group that goes over its edges only (`GROUP_EDGES_ONLY`): a one-shot for it leaves the saved 1:1
@@ -4541,7 +4659,11 @@ function oneGroupOnly(method) {
4541
4659
  * so its start reads each chat's newest row (its place in `chat list`) and no history. It read every 1:1 chat whole:
4542
4660
  * `profile show` took 0.8 s and 243 MB instead of 0.45 s and 162 MB with 53,800 messages in the profile, and
4543
4661
  * `group list` 0.89 s and 220 MB instead of 0.42 s and 154 MB with 50,000. A group's own reads need its history only,
4544
- * which its start reads whatever this says.
4662
+ * which its start reads whatever this says. The wallet's reads come from its own stores (proofs, wallet history,
4663
+ * payments), none from a chat's history: `wallet list` took 1.3 s and 239 MB instead of 0.48 s and 146 MB with 50,000
4664
+ * messages; `payment list --chat` starts the chat it names. `identity providers` reads nothing of the profile, and
4665
+ * `call auto` and `group auto` with no on|off what it keeps: each took 1.6 s and 211 MB instead of 0.8 s and 152 MB
4666
+ * with 50,000.
4545
4667
  */
4546
4668
  var NO_HISTORY_READS = /* @__PURE__ */ new Set([
4547
4669
  "status",
@@ -4556,11 +4678,35 @@ var NO_HISTORY_READS = /* @__PURE__ */ new Set([
4556
4678
  "service.list",
4557
4679
  "identity.list",
4558
4680
  "x401.credential.list",
4559
- "app.served"
4681
+ "app.served",
4682
+ "wallet.list",
4683
+ "wallet.history",
4684
+ "payment.list",
4685
+ "identity.providers"
4560
4686
  ]);
4561
- /** Whether a one-shot for this call leaves every saved chat unstarted, its history unread (`NO_HISTORY_READS`). */
4562
- function readsNoHistory(method) {
4563
- return NO_HISTORY_READS.has(method);
4687
+ /**
4688
+ * Changes kept outside any chat (this profile's status, which each chat says on its next session; x401 keys and
4689
+ * credentials; a service; a draft; a served app), and `call answer` and `call flush`, which a one-shot refuses whatever
4690
+ * the chats say: a one-shot for one leaves every saved chat unstarted too. Each read every 1:1 chat whole first: with
4691
+ * 30,000 messages in the profile, about 0.95 s and 200 MB instead of 0.45 s and 140 MB.
4692
+ */
4693
+ var NO_HISTORY_WRITES = /* @__PURE__ */ new Set([
4694
+ "status.set",
4695
+ "status.clear",
4696
+ "x401.key.new",
4697
+ "x401.credential.add",
4698
+ "x401.credential.remove",
4699
+ "service.add",
4700
+ "identity.cancel",
4701
+ "app.serve",
4702
+ "app.unserve",
4703
+ "call.answer",
4704
+ "call.flush"
4705
+ ]);
4706
+ /** Whether a one-shot for this call leaves every saved chat unstarted, its history unread (`NO_HISTORY_READS`, `NO_HISTORY_WRITES`). */
4707
+ function readsNoHistory(method, params = {}) {
4708
+ if (method === "call.auto" || method === "group.auto") return params.on === void 0;
4709
+ return NO_HISTORY_READS.has(method) || NO_HISTORY_WRITES.has(method);
4564
4710
  }
4565
4711
  /**
4566
4712
  * Calls that only read what the profile stores: a one-shot for one opens it offline (`RuntimeOptions.offline`).
@@ -4925,9 +5071,10 @@ async function oneShotJoinWait(s, result, label) {
4925
5071
  stage
4926
5072
  };
4927
5073
  if (view.paired) return { answer };
5074
+ const typed = label?.trim();
4928
5075
  return {
4929
5076
  answer,
4930
- note: `Not paired yet: the inviter's app is offline. It pairs when both are online: keep this profile running (ghostly daemon --detach), then ghostly chat wait ${label?.trim() && !/\s/.test(label.trim()) ? label.trim() : String(result.chat)} --until paired`
5077
+ note: `Not paired yet: the inviter's app is offline. It pairs when both are online: keep this profile running (ghostly daemon --detach), then ghostly chat wait ${!!typed && shellWord(typed, "") === typed && await s.call("chat.get", { chat: typed }).then((chat) => chat?.id === result.chat, () => false) ? typed : String(result.chat)} --until paired`
4931
5078
  };
4932
5079
  }
4933
5080
  /**
@@ -4979,7 +5126,7 @@ var SPECIAL = [
4979
5126
  "A backup of the profile, encrypted with a passphrase (from a file or GHOSTLY_BACKUP_PASSPHRASE); --no-passphrase makes one anyone can read",
4980
5127
  {
4981
5128
  out: o("string", "The backup file to write"),
4982
- "passphrase-file": o("string", "The passphrase, from this file, or stdin for - (else GHOSTLY_BACKUP_PASSPHRASE)"),
5129
+ "passphrase-file": o("string", "The passphrase, from this file, or stdin for - (else GHOSTLY_BACKUP_PASSPHRASE). One line break at its end is left out; any other space or line break at an end is refused"),
4983
5130
  passphrase: {
4984
5131
  ...o("boolean", "Do not encrypt. The file then holds the profile's keys and wallet secrets in the clear"),
4985
5132
  negatedOnly: true
@@ -4991,7 +5138,7 @@ var SPECIAL = [
4991
5138
  "profile restore <file> <new profile> [--passphrase-file f] [--use]",
4992
5139
  "A backup into a new profile (a backup made with --no-passphrase needs none)",
4993
5140
  {
4994
- "passphrase-file": o("string", "The passphrase, from this file, or stdin for - (else GHOSTLY_BACKUP_PASSPHRASE)"),
5141
+ "passphrase-file": o("string", "The passphrase, from this file, or stdin for - (else GHOSTLY_BACKUP_PASSPHRASE). One line break at its end is left out"),
4995
5142
  use: o("boolean", "Make it the current profile")
4996
5143
  }
4997
5144
  ],
@@ -5022,8 +5169,8 @@ var SPECIAL = [
5022
5169
  "listen [--since seq] [--cursor file] [--type t]... [--turns] [--from <chat|key>]... [--group <group>]... [--exec cmd] [--webhook url] [--print] [--translate lang]",
5023
5170
  "Stream events as JSON lines (starts the profile here if no daemon runs it)",
5024
5171
  {
5025
- since: o("number", "Replay events after this seq first"),
5026
- cursor: o("string", "A file that keeps the last seq handled (read at start, written after each event)"),
5172
+ since: o("number", "Replay events after this seq first (with --cursor: only while its file holds no seq yet)"),
5173
+ cursor: o("string", "A file that keeps the last seq handled (read at start, written after each event); its seq wins over --since"),
5027
5174
  type: o("list", "Only events of this type (message.received) or family (message, or group.typing.); repeat for more"),
5028
5175
  turns: o("boolean", "Only agent turns: each message received, and each group message that mentions you, as one agent.turn event"),
5029
5176
  from: o("list", "Only this chat's events (id, a label given here or the contact's key; again for more)"),
@@ -5147,7 +5294,7 @@ function helpRow(label, text, at, columns) {
5147
5294
  var FIRST_STEPS = [
5148
5295
  "First steps:",
5149
5296
  " $ ghostly invite create --label alice make an invite for a contact",
5150
- " $ printf '%s' \"$INVITE\" | ghostly invite join join one, from stdin",
5297
+ " $ printf '%s' \"$INVITE\" | ghostly invite join join one, from stdin",
5151
5298
  " $ ghostly daemon --detach keep the profile online",
5152
5299
  " $ ghostly help <command> one command and its options"
5153
5300
  ];
@@ -5334,7 +5481,7 @@ async function profileCommand(sub, argv) {
5334
5481
  noMoreThan(1, parsed.positionals, "profile create <name> [--use] [--name <shown name>] [--force]");
5335
5482
  const shownName = parsed.options.name === void 0 ? void 0 : checkShownNameOption(parsed.options.name);
5336
5483
  const force = parsed.options.force === true;
5337
- if (shownName) (await import("./secretGuard-DCb1I0_B.js")).guardText(shownName, force, "name", "set it");
5484
+ if (shownName) (await import("./secretGuard-Bm6nci0I.js")).guardText(shownName, force, "name", "set it");
5338
5485
  const paths = createProfile(g.home, name);
5339
5486
  let shown = null;
5340
5487
  if (shownName !== void 0) try {
@@ -5421,7 +5568,7 @@ async function profileCommand(sub, argv) {
5421
5568
  ...light
5422
5569
  } : {
5423
5570
  path,
5424
- passphrase: await backupPassphrase(parsed.options["passphrase-file"]),
5571
+ passphrase: cleanEnds(await backupPassphrase(parsed.options["passphrase-file"]), parsed.options["passphrase-file"]),
5425
5572
  ...light
5426
5573
  };
5427
5574
  const made = await withSession(g, (s) => s.call("profile.backup", params), { offline: true });
@@ -5434,7 +5581,7 @@ async function profileCommand(sub, argv) {
5434
5581
  if (!given || !name) throw new CliError("usage", `Missing <${given ? "new profile" : "file"}>: ghostly profile restore <file> <new profile> [--passphrase-file f] [--use]`);
5435
5582
  noMoreThan(2, parsed.positionals, "profile restore <file> <new profile> [--passphrase-file f] [--use]");
5436
5583
  const file = here(given);
5437
- const { backupFileProtection, restoreProfile } = await import("./backup-CdEzTq5C.js");
5584
+ const { backupFileProtection, restoreProfile } = await import("./backup-xZfV-ytw.js");
5438
5585
  const protection = await backupFileProtection(file);
5439
5586
  const paths = await restoreProfile(g.home, checkProfileName(name), file, protection === "none" ? void 0 : await backupPassphrase(parsed.options["passphrase-file"], RESTORE_PASSPHRASE));
5440
5587
  if (parsed.options.use) selectProfile(g.home, name);
@@ -5477,10 +5624,13 @@ var BACKUP_PASSPHRASE = "The backup passphrase comes from --passphrase-file or G
5477
5624
  /** Restore takes no --no-passphrase: a backup made without one says so itself. */
5478
5625
  var RESTORE_PASSPHRASE = "This backup is encrypted: its passphrase comes from --passphrase-file or GHOSTLY_BACKUP_PASSPHRASE";
5479
5626
  var PASSPHRASE_ON_LINE = "The passphrase comes from --passphrase-file or GHOSTLY_BACKUP_PASSPHRASE, never the command line";
5480
- /** `--passphrase` or `--passphrase=<value>` before any `--` (after it, words are positionals). */
5627
+ /**
5628
+ * `--passphrase` or `--passphrase=<value>` before any `--` (after it, words are positionals), or a typo of it
5629
+ * (`--pasphrase=<value>`): before, that was "did you mean --passphrase?", the one form refused here.
5630
+ */
5481
5631
  var passphraseOnLine = (argv) => {
5482
5632
  const end = argv.indexOf("--");
5483
- return (end === -1 ? argv : argv.slice(0, end)).some((arg) => arg === "--passphrase" || arg.startsWith("--passphrase="));
5633
+ return (end === -1 ? argv : argv.slice(0, end)).some((arg) => arg.startsWith("--") && nearest(arg.slice(2).split("=")[0], ["passphrase"]) === "passphrase");
5484
5634
  };
5485
5635
  /**
5486
5636
  * The backup passphrase: from a file or the environment, never the command line (it would sit in shell history). The
@@ -5505,6 +5655,29 @@ async function backupPassphrase(file, missing = BACKUP_PASSPHRASE) {
5505
5655
  if (!value) throw new CliError("bad_request", `${file === "-" ? "Stdin" : file} is empty: it holds the backup's passphrase`);
5506
5656
  return value;
5507
5657
  }
5658
+ var END_NAMES = {
5659
+ " ": "a space",
5660
+ " ": "a tab",
5661
+ "\r": "a carriage return",
5662
+ "\n": "a line break",
5663
+ "": "a byte order mark"
5664
+ };
5665
+ var endName = (char) => END_NAMES[char] ?? `U+${char.codePointAt(0).toString(16).toUpperCase().padStart(4, "0")} (a space)`;
5666
+ /**
5667
+ * A new backup's passphrase, refused when it starts or ends with whitespace or a byte order mark, or holds a NUL (a
5668
+ * file saved as UTF-16): only the one line break at a file's end is left out, so the same passphrase typed, pasted or
5669
+ * held by a password manager would open nothing ("Wrong passphrase"). Restore takes any passphrase: old backups open.
5670
+ */
5671
+ function cleanEnds(passphrase, file) {
5672
+ const source = typeof file !== "string" ? "GHOSTLY_BACKUP_PASSPHRASE" : file === "-" ? "stdin" : file;
5673
+ if (passphrase.includes("\0")) throw new CliError("bad_request", `${source} holds a NUL: a file saved as UTF-16? Save the passphrase as UTF-8 text`);
5674
+ const trimmed = passphrase.trim();
5675
+ if (trimmed === passphrase) return passphrase;
5676
+ const at = trimmed && passphrase.startsWith(trimmed) ? "ends" : "starts";
5677
+ const char = at === "ends" ? passphrase.at(-1) : passphrase[0];
5678
+ const fileRule = typeof file === "string" ? " (one line break at its end is left out already)" : "";
5679
+ throw new CliError("bad_request", `The passphrase in ${source} ${at} with ${endName(char)}${fileRule}: the same passphrase typed or pasted would not open the backup. Take it out`);
5680
+ }
5508
5681
  /** Set on `startDetached`'s child: its parent waits for the profile and starts it again, so the child does not wait too. */
5509
5682
  var DETACHED_CHILD = "GHOSTLY_DAEMON_DETACHED";
5510
5683
  /**
@@ -5981,7 +6154,7 @@ async function listenCommand(argv) {
5981
6154
  const from = parsed.options.from ?? [], groups = parsed.options.group ?? [];
5982
6155
  const cursor = here(parsed.options.cursor);
5983
6156
  checkCursor(cursor);
5984
- const since$1 = since(parsed.options) ?? readCursor(cursor);
6157
+ const starting = startAt(since(parsed.options), cursor, (line) => process.stderr.write(line + "\n")), since$1 = starting.from;
5985
6158
  const translator = await translatorFor(parsed.options.translate, g.home);
5986
6159
  let quit = (code) => {
5987
6160
  process.exit(code);
@@ -6046,8 +6219,9 @@ async function listenCommand(argv) {
6046
6219
  process.exit(code);
6047
6220
  };
6048
6221
  onReaderGone(stop);
6049
- await following.subscribed;
6050
6222
  onStopSignals(stop);
6223
+ const answer = await following.subscribed;
6224
+ if (typeof answer?.lastSeq === "number") starting.known(answer.lastSeq);
6051
6225
  return;
6052
6226
  }
6053
6227
  const [{ keepServing, serve }, { callApi }] = await Promise.all([engineHost(), engineApi()]);
@@ -6101,6 +6275,7 @@ async function listenCommand(argv) {
6101
6275
  off?.();
6102
6276
  off = null;
6103
6277
  }, open);
6278
+ starting.known(host.ctx.hub.lastSeq);
6104
6279
  open(since$1);
6105
6280
  host.ctx.hub.emit("daemon.started", `daemon.started:${process.pid}:${Date.now()}`, {
6106
6281
  pid: process.pid,
@@ -6253,7 +6428,7 @@ async function textCommand(name, argv) {
6253
6428
  };
6254
6429
  if (spec.target === "group") params.mentions = parsed.options.mention ?? [];
6255
6430
  if (parsed.options.reply !== void 0) params.reply = parsed.options.reply;
6256
- if (!spec.message) Object.assign(params, (await import("./buttons-DK2aAGat.js")).buttonsOf(parsed.options));
6431
+ if (!spec.message) Object.assign(params, (await import("./buttons-CsGdQNnR.js")).buttonsOf(parsed.options));
6257
6432
  print(await withSession(g, (s) => {
6258
6433
  if (parsed.options.wait !== void 0) params.wait = parsed.options.wait;
6259
6434
  if (parsed.options.timeout !== void 0) params.timeout = parsed.options.timeout;
@@ -6297,7 +6472,7 @@ async function identityAddCommand(argv) {
6297
6472
  if (!provider) throw new CliError("usage", "Missing <provider>: ghostly identity add <provider> [subject] [--signer id] [--field name=value]... [--stdin] [--days n] [--timeout s]");
6298
6473
  inRange(parsed.options, "timeout", "a number of seconds", 5, 3600);
6299
6474
  const items = parsed.options.field ?? [];
6300
- const known = parsed.options.days !== void 0 || items.length ? (await import("./registry-zUZBSHYv.js")).IDENTITY_PROVIDERS.find((p) => p.id === provider) : void 0;
6475
+ const known = parsed.options.days !== void 0 || items.length ? (await import("./registry-4W1LGlCF.js")).IDENTITY_PROVIDERS.find((p) => p.id === provider) : void 0;
6301
6476
  if (known && parsed.options.days !== void 0) inRange(parsed.options, "days", "a whole number", 1, known.validity.maxDays, true);
6302
6477
  const { fields, warning } = await identityFields(items, parsed.options.stdin === true, identitySecretFields(known, parsed.options.signer), readStdin, process.stdin.isTTY === true);
6303
6478
  if (warning) process.stderr.write(`ghostly: ${warning}\n`);
@@ -6372,7 +6547,7 @@ async function tableCommand(name, argv) {
6372
6547
  } catch (error) {
6373
6548
  throw localFileError(error, params.evidenceFile) ?? error;
6374
6549
  }
6375
- else if (params.stdin) params.evidence = await readStdin();
6550
+ else if (params.stdin) params.evidence = await evidenceFromStdin(readStdin, String(params.draft), process.stdin.isTTY === true);
6376
6551
  delete params.evidenceFile;
6377
6552
  delete params.stdin;
6378
6553
  }
@@ -6402,12 +6577,12 @@ async function tableCommand(name, argv) {
6402
6577
  return result;
6403
6578
  }, {
6404
6579
  deferGroups: chatOnly(command.method, params) || newChatOnly(command.method),
6405
- deferChats: oneChatOnly(command.method, params) || oneGroupOnly(command.method) || readsNoHistory(command.method),
6580
+ deferChats: oneChatOnly(command.method, params) || oneGroupOnly(command.method) || readsNoHistory(command.method, params),
6406
6581
  offline: offlineCall(command.method, params)
6407
6582
  });
6408
6583
  if (translator) {
6409
6584
  try {
6410
- printAnswer(await (await import("./translate-CUuC5szR.js")).translateAnswer(result, translator));
6585
+ printAnswer(await (await import("./translate-BcbSWkuq.js")).translateAnswer(result, translator));
6411
6586
  } finally {
6412
6587
  translator.close();
6413
6588
  }
@@ -6657,7 +6832,6 @@ async function run(argv) {
6657
6832
  exit(EXIT[failure.code]);
6658
6833
  }
6659
6834
  }
6660
- //#endregion
6661
6835
  export { run };
6662
6836
 
6663
- //# sourceMappingURL=main-C6t5zrD5.js.map
6837
+ //# sourceMappingURL=main-CwTaepxR.js.map