@ghostlytools/cli 1.10.1 → 1.10.3

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 (97) hide show
  1. package/README.md +14 -10
  2. package/SKILL.md +3 -2
  3. package/dist/assets/{api-BOWLZYXM.js → api-BdaxsDvA.js} +2 -2
  4. package/dist/assets/{api-Bi6hCcwG.js → api-C4MLg5Rs.js} +126 -49
  5. package/dist/assets/api-C4MLg5Rs.js.map +1 -0
  6. package/dist/assets/{apiKit-DzXHZojD.js → apiKit-BbNaxZGZ.js} +87 -25
  7. package/dist/assets/apiKit-BbNaxZGZ.js.map +1 -0
  8. package/dist/assets/{apps-DIQbzG08.js → apps-BluQgEhv.js} +5 -5
  9. package/dist/assets/{apps-DIQbzG08.js.map → apps-BluQgEhv.js.map} +1 -1
  10. package/dist/assets/{apps-0Ks6KjqS.js → apps-BtGFth7o.js} +1 -1
  11. package/dist/assets/{arkade-zozCldAE.js → arkade-DdZx4b_I.js} +2 -2
  12. package/dist/assets/{arkade-zozCldAE.js.map → arkade-DdZx4b_I.js.map} +1 -1
  13. package/dist/assets/{backup-BL49Kt-T.js → backup-DyDsW7sC.js} +7 -7
  14. package/dist/assets/{backup-BL49Kt-T.js.map → backup-DyDsW7sC.js.map} +1 -1
  15. package/dist/assets/{backup-BvIFcZM7.js → backup-I1n7ccz7.js} +1 -1
  16. package/dist/assets/{buttons-CAW5v5EE.js → buttons-Do7dCku6.js} +6 -6
  17. package/dist/assets/{buttons-CAW5v5EE.js.map → buttons-Do7dCku6.js.map} +1 -1
  18. package/dist/assets/buttons-DpjwXePb.js +2 -0
  19. package/dist/assets/{client-CyApKBEw.js → client-CWsjRiH8.js} +3 -3
  20. package/dist/assets/{client-CyApKBEw.js.map → client-CWsjRiH8.js.map} +1 -1
  21. package/dist/assets/{codec-DqFxxB_q.js → codec-DPaXhuYc.js} +2 -2
  22. package/dist/assets/{codec-DqFxxB_q.js.map → codec-DPaXhuYc.js.map} +1 -1
  23. package/dist/assets/{envelope-CMUgz31I.js → envelope-5Gu9yGk_.js} +2 -2
  24. package/dist/assets/{envelope-CMUgz31I.js.map → envelope-5Gu9yGk_.js.map} +1 -1
  25. package/dist/assets/{errors-R4S2SAEM.js → errors-Dt-ZnyOX.js} +3 -1
  26. package/dist/assets/errors-Dt-ZnyOX.js.map +1 -0
  27. package/dist/assets/{fixedHosts-C2hdCfzK.js → fixedHosts-PR1BcfKX.js} +7 -8
  28. package/dist/assets/fixedHosts-PR1BcfKX.js.map +1 -0
  29. package/dist/assets/{groupFiles-BAQIt_bJ.js → groupFiles-BuToTMUk.js} +307 -69
  30. package/dist/assets/groupFiles-BuToTMUk.js.map +1 -0
  31. package/dist/assets/{host-CaRlDMTd.js → host-fkQYBvKH.js} +322 -72
  32. package/dist/assets/host-fkQYBvKH.js.map +1 -0
  33. package/dist/assets/{hyperdhtRelay-BxADl3SG.js → hyperdhtRelay-DDCak5PY.js} +28 -20
  34. package/dist/assets/hyperdhtRelay-DDCak5PY.js.map +1 -0
  35. package/dist/assets/{irohWeb-D2sh6EWp.js → irohWeb-B4_swKx0.js} +112 -34
  36. package/dist/assets/{irohWeb-D2sh6EWp.js.map → irohWeb-B4_swKx0.js.map} +1 -1
  37. package/dist/assets/{main-Bc4Ow56Z.js → main-ClYsttvY.js} +98 -51
  38. package/dist/assets/main-ClYsttvY.js.map +1 -0
  39. package/dist/assets/{mainline-DWh4Ccri.js → mainline-Hsk2SZ1B.js} +66 -6
  40. package/dist/assets/mainline-Hsk2SZ1B.js.map +1 -0
  41. package/dist/assets/{networkReason-DT_D_Wpc.js → networkReason-C9Hr-hO7.js} +4 -4
  42. package/dist/assets/{networkReason-DT_D_Wpc.js.map → networkReason-C9Hr-hO7.js.map} +1 -1
  43. package/dist/assets/{nwc-DoSEhUKb.js → nwc-BbK6qNxS.js} +3 -3
  44. package/dist/assets/{nwc-DoSEhUKb.js.map → nwc-BbK6qNxS.js.map} +1 -1
  45. package/dist/assets/{nwcProvider-CGWqUjpB.js → nwcProvider-D_tt2X3Z.js} +2 -2
  46. package/dist/assets/{nwcProvider-CGWqUjpB.js.map → nwcProvider-D_tt2X3Z.js.map} +1 -1
  47. package/dist/assets/{ownDid-CbGjRLBn.js → ownDid-DkK_jem4.js} +2 -2
  48. package/dist/assets/{ownDid-CbGjRLBn.js.map → ownDid-DkK_jem4.js.map} +1 -1
  49. package/dist/assets/{profiles-DgIfvBeN.js → profiles-aV9vaK0B.js} +17 -8
  50. package/dist/assets/profiles-aV9vaK0B.js.map +1 -0
  51. package/dist/assets/{registry-C5cn80Rw.js → registry-C9T6tYCO.js} +1 -1
  52. package/dist/assets/{registry-BSyxGjN6.js → registry-CEjnubep.js} +57 -17
  53. package/dist/assets/registry-CEjnubep.js.map +1 -0
  54. package/dist/assets/{resolve-D-9YRFhl.js → resolve-BBOrN13E.js} +27 -6
  55. package/dist/assets/resolve-BBOrN13E.js.map +1 -0
  56. package/dist/assets/{restoredRows-CRYwIx3g.js → restoredRows-YhlbokEE.js} +4 -2
  57. package/dist/assets/restoredRows-YhlbokEE.js.map +1 -0
  58. package/dist/assets/{secretGuard-CSVNxXVW.js → secretGuard-B7Hj0Kvz.js} +2 -2
  59. package/dist/assets/{secretGuard-CSVNxXVW.js.map → secretGuard-B7Hj0Kvz.js.map} +1 -1
  60. package/dist/assets/secretGuard-DUr6bgKc.js +2 -0
  61. package/dist/assets/{server-BufntkX8.js → server-BJ3T-kx3.js} +1051 -389
  62. package/dist/assets/server-BJ3T-kx3.js.map +1 -0
  63. package/dist/assets/{src-CCt5s4DK.js → src-BIdfHB7t.js} +667 -134
  64. package/dist/assets/src-BIdfHB7t.js.map +1 -0
  65. package/dist/assets/{sshForges-D8CPaIbR.js → sshForges-CRg-NGld.js} +2 -2
  66. package/dist/assets/{sshForges-D8CPaIbR.js.map → sshForges-CRg-NGld.js.map} +1 -1
  67. package/dist/assets/{translate-Cb-6hMhD.js → translate-b0X61WMI.js} +3 -3
  68. package/dist/assets/{translate-Cb-6hMhD.js.map → translate-b0X61WMI.js.map} +1 -1
  69. package/dist/assets/{usdt-ds461mzA.js → usdt-6CQdfye1.js} +7 -4
  70. package/dist/assets/usdt-6CQdfye1.js.map +1 -0
  71. package/dist/assets/waitNotice-Ce3YCinu.js +101 -0
  72. package/dist/assets/waitNotice-Ce3YCinu.js.map +1 -0
  73. package/dist/assets/{words-B1ylON2h.js → words-Dk6o6wz4.js} +4 -4
  74. package/dist/assets/words-Dk6o6wz4.js.map +1 -0
  75. package/dist/ghostly.mjs +1 -1
  76. package/package.json +1 -1
  77. package/dist/assets/api-Bi6hCcwG.js.map +0 -1
  78. package/dist/assets/apiKit-DzXHZojD.js.map +0 -1
  79. package/dist/assets/buttons-oJI5mHSL.js +0 -2
  80. package/dist/assets/errors-R4S2SAEM.js.map +0 -1
  81. package/dist/assets/fixedHosts-C2hdCfzK.js.map +0 -1
  82. package/dist/assets/groupFiles-BAQIt_bJ.js.map +0 -1
  83. package/dist/assets/host-CaRlDMTd.js.map +0 -1
  84. package/dist/assets/hyperdhtRelay-BxADl3SG.js.map +0 -1
  85. package/dist/assets/main-Bc4Ow56Z.js.map +0 -1
  86. package/dist/assets/mainline-DWh4Ccri.js.map +0 -1
  87. package/dist/assets/profiles-DgIfvBeN.js.map +0 -1
  88. package/dist/assets/registry-BSyxGjN6.js.map +0 -1
  89. package/dist/assets/resolve-D-9YRFhl.js.map +0 -1
  90. package/dist/assets/restoredRows-CRYwIx3g.js.map +0 -1
  91. package/dist/assets/secretGuard-Q2BKq0q0.js +0 -2
  92. package/dist/assets/server-BufntkX8.js.map +0 -1
  93. package/dist/assets/src-CCt5s4DK.js.map +0 -1
  94. package/dist/assets/usdt-ds461mzA.js.map +0 -1
  95. package/dist/assets/waitNotice-B8D8WhbE.js +0 -45
  96. package/dist/assets/waitNotice-B8D8WhbE.js.map +0 -1
  97. package/dist/assets/words-B1ylON2h.js.map +0 -1
package/README.md CHANGED
@@ -102,7 +102,8 @@ a command that waits (`chat wait`, `file wait`, `--wait`) within its `--timeout`
102
102
  `details.method`); `ghostly daemon restart` is the way out ([docs/CLI.md](../../docs/CLI.md#what-it-does)). On a
103
103
  terminal, a command that waits says on stderr what it waits for once it has waited a second; nothing is said there on
104
104
  a pipe. A `<chat>` is
105
- its id, a unique prefix of it, or its name; a `<group>` too. A `<group>` that is one group's name and a prefix of
105
+ its id, a unique prefix of it, or its name; a `<group>` too, each also as `group:<ref>` (every group command,
106
+ `listen --group` and every command that takes a chat or a group). A `<group>` that is one group's name and a prefix of
106
107
  another's id is refused (exit 1, `bad_request`, both ids in `details.matches`): use its id.
107
108
 
108
109
  The rows are in alphabetical order of their first command, and every command of `ghostly help` has one
@@ -127,11 +128,11 @@ The rows are in alphabetical order of their first command, and every command of
127
128
  | `chat history <chat> [--limit n] [--before x] [--after x] [--translate lang]` | Messages, oldest first; `x` is a message id or a time in ms ([Translation](#translation)) |
128
129
  | `chat list [--show-secret]`, `chat show <chat> [--show-secret]` | Chats, and one chat's connection: transports, last attempt, comparison code. A pending chat's `invite` prints as `<hidden>` without `--show-secret` |
129
130
  | `chat pay <chat> <sats> [--memo t] [--network n] [--confirm-real]` | Ecash to a contact. A contact that offers no way of paying is `refused`: `details.reason` `contact_no_wallet` (it has no wallet yet) or `contact_payments_off` (it has payments off in this chat, or an older app). With no Cashu wallet of the network on this side, `refused` with `details.reason` `no_wallet` and the `wallet create` command to run; with one too short of sats, `refused`. It names its chat by the chat's id, its contact's key or a label given here, never only by the contact's own name or a prefix of its id |
130
- | `chat rename <chat> <name>`, `chat remove <chat> --yes` | Name it here; delete it (keys and history) here, refused (`busy`) while a call is on in it: hang the call up first |
131
+ | `chat rename <chat> <name>`, `chat remove <chat> --yes` | Name it here (up to 48 characters, counted as stored: a tab or a line break is a space and invisible characters go, so a name with nothing that shows is refused; an empty name gives back the contact's own); delete it (keys and history) here, refused (`busy`) while a call is on in it: hang the call up first |
131
132
  | `chat request <chat> <sats> [--memo t] [--method m] [--rail r]`, `chat pay-request <chat> <payment>` | Ask a contact to pay; pay the contact's request. Refused as `chat pay` is when the contact offers no way of paying, or when `chat request` has no Cashu wallet of the network here (`no_wallet`). `chat pay-request` names its chat by the chat's id, its contact's key or a label given here, never only by the contact's own name or a prefix of its id |
132
133
  | `chat transport <chat> <auto\|dht\|webrtc\|iroh\|hyperdht>` | What carries the chat |
133
134
  | `chat verify <chat> --code <code>` | Mark the contact verified after comparing the codes out of band |
134
- | `chat wait <chat> [--until live\|text\|paired] [--timeout s]` | Wait for a chat to go live, carry text, or see its contact. Live means a session that exists now, in this run of the daemon: a chat that was live before a restart counts once its contact answers again |
135
+ | `chat wait <chat> [--until live\|text\|paired] [--timeout s]` | Wait for a chat to go live, carry text, or see its contact. Live means a session that exists now, in this run of the daemon: a chat that was live before a restart counts once its contact answers again. Paired answers at once for a chat that paired before, whether its contact is online or not |
135
136
  | `daemon [--detach] [--timeout s]`, `daemon status [--timeout s]`, `daemon stop [--timeout s]`, `daemon restart [--timeout s]` | Keep the profile online; `status` names its version and its socket (`socket`, for the [socket API](#the-socket-api)), or says `"starting": true` with the `pid` of a daemon whose socket does not listen yet (`stop` and `restart` wait up to `--timeout` for that socket, then stop it); `restart` stops it and starts this release's code in the background ([After an upgrade](#after-an-upgrade)). Ctrl-C, SIGTERM and the terminal closing (SIGHUP) stop it cleanly. A command that holds the profile for a moment (a bot's `send` while a service manager restarts it) is waited for, up to `--timeout` (60 s): still held then, `busy` with its pid |
136
137
  | `edit <chat> <message> [text… \| --text <text> \| --stdin] [--force] [--wait none\|confirmed] [--timeout s]` | Replace the text of a message you sent (1:1 chats, `group edit` for a group; `<message>` is the `messageId` `send` gave, or its wire id). The contact sees it in place, marked edited; `--wait confirmed` waits for its app to confirm (the default without a daemon). At most 100 edits a message, no time limit; an older contact app gets it once it shows edits |
137
138
  | `engine <method> [json \| -] [--confirm-real] [--show-secret] [--yes] [--force]`, `engine --list [--verbose]` | Any call of the app's engine; `--verbose` lists what each takes (`{ linkId, label }`, `?` for an optional key). A call given less than it takes is refused as `bad_request`. One that deletes chats or groups (`clearProfileData`, `removeLink`, `leaveGroup`, `forgetGroup`, `deviceRemove`) needs `--yes`; `clearProfileData` answers what it removed and stops a daemon. `removeLink`, and `setChatTransport` or `setDeliveryMode` to `dht`, are refused (`busy`) while a call is on in the chat, as `chat remove` and `chat transport dht` are; `clearProfileData` while a call is on in any chat. One that sends a text that looks like a secret (`sendMessage`, `sendGroupMessage`, `editMessage`, `forwardMessages`, a payment's memo or comment, a file's name, a group's name in `createGroup` or `renameGroup`, the nick in `updateSettings`) needs `--force` |
@@ -147,7 +148,7 @@ The rows are in alphabetical order of their first command, and every command of
147
148
  | `group hub <group> <member> [--pin \| --exclude \| --auto]` | Past 16 members: pin a member as a hub, keep one from being a hub, or leave it to their app (a daemon offers itself) |
148
149
  | `group invite <group> <chat>`, `group remove <group> <member>`, `group admin <group> <member>` | Membership, for the admin (each prints the group; `--show-secret` for its link). `group invite` names its chat by the chat's id, its contact's key or a label given here, never only by the contact's own name or a prefix of its id |
149
150
  | `group leave <group> --yes`, `group forget <group> --yes`, `group accept\|decline <group>` | Membership. Leaving deletes the group's history and files on this device, so it asks for `--yes` (`confirm`, exit 5, without it), as `group forget` does; forget also deletes a group you were removed from, which keeps its history. An admin's leave hands the role to a member who is online and names them: `{left, admin: {key, name}}` |
150
- | `group list [--show-secret]`, `group show <group> [--show-secret]`, `group history <group>` | Groups, members, history; a message names its author (`member` key, `nick` from the roster, or the name an author no longer in it had). The entry link prints as `<hidden>` without `--show-secret` |
151
+ | `group list [--show-secret]`, `group show <group> [--show-secret]`, `group history <group>` | Groups, members, history; a message names its author (`member` key, `nick` from the roster, or the name an author no longer in it had). The entry link prints as `<hidden>` without `--show-secret`. `others` (only when there are some): other groups that came under the same id, kept beside it until you pick, each a contact's invitation (`chat`, `name`, `members`) or a link opened (`link`, hidden the same way); `engine keepGroup '{"groupId":"<id>"}'` keeps the one shown, `engine switchGroup '{"groupId":"<id>","to":"<chat or link>"}'` takes another |
151
152
  | `group react <group> <message> <emoji> [--remove]` | React to a group's message. `refused` when the profile is not a member any more |
152
153
  | `group rename <group> <name> [--force]` | A new name, for the admin (1 to 64 characters on one line; one that looks like a secret needs `--force`, as for `group create`); the picture stays. Members see it once it reaches them; until then, and on apps from before names, the group keeps the name it had when they got in |
153
154
  | `group rotate <group>`, `group link <group> [--off] [--reset]`, `group picture <group> <jpeg> \| --clear` | A fresh secret; the link (printed: asking for it is asking for the secret); the picture |
@@ -161,7 +162,7 @@ The rows are in alphabetical order of their first command, and every command of
161
162
  | `invite join [<invite-or-link> \| -] [--label <name>]` | Join a chat (your own invite is refused). The invite comes from stdin when none is given or `-`, out of `ps` and the shell's history; on the command line the CLI warns |
162
163
  | `lightning default <card>`, `lightning rename <card> <name>` | Lightning cards: which receives by default |
163
164
  | `listen [--since seq] [--cursor file] [--type t]… [--turns] [--from <chat\|key>]… [--group <group>]… [--exec cmd] [--webhook url] [--print] [--translate lang]` | The event stream; `--from` and `--group` an allowlist, `--turns` one `agent.turn` per message to answer, `--translate` a translation of received messages ([Events](#events), [Translation](#translation)) |
164
- | `message delete <chat\|group> <message> --everyone [--wait none\|confirmed] [--timeout s]` | Deletes a message of yours for everyone (a text, a card, a file or a voice message; never a payment): it goes from this device at once and from every member's as the message's last edit, once they are back if they are away. An app from before this shows "🗑 Message removed" in its place. In a chat, `--wait confirmed` waits for the contact's app to confirm (the default without a daemon, which is offline once the command ends), and the answer's `confirmed` says whether it did. Without `--everyone`, only this device forgets it. Answers the chat or group, the message's `messageId` and `everyone` (`deleted` says the same id, kept for callers that read it) |
165
+ | `message delete <chat\|group> <message> --everyone [--wait none\|confirmed\|sent] [--timeout s]` | Deletes a message of yours for everyone (a text, a card, a file or a voice message; never a payment): it goes from this device at once and from every member's as the message's last edit, once they are back if they are away. An app from before this shows "🗑 Message removed" in its place. In a chat, `--wait confirmed` waits for the contact's app to confirm (the default without a daemon, which is offline once the command ends), and the answer's `confirmed` says whether it did. In a group (no receipts), `--wait sent` waits until a member's edge (a hub's, in a community) took the removal, the default without a daemon, and the answer's `edges` and `sent` say how many did, as for `group send`. Without `--everyone`, only this device forgets it. Answers the chat or group, the message's `messageId` and `everyone` (`deleted` says the same id, kept for callers that read it) |
165
166
  | `message retry\|delete\|details <chat> <message>` | One message |
166
167
  | `pay <invoice\|address\|lnurl> [--amount sats] [--network n] [--max-fee sats] [--chat <chat>] [--confirm-real]` | Pay over Lightning (Testnet unless `--network mainnet`). `--chat`: the chat the invoice came from, whose contact is told a Testnet invoice was paid, named by the chat's id, its contact's key or a label given here, never only by the contact's own name or a prefix of its id |
167
168
  | `payment list [--chat c]`, `payment check <chat> <payment>`, `payment reclaim <payment>` | Payments and requests |
@@ -169,7 +170,7 @@ The rows are in alphabetical order of their first command, and every command of
169
170
  | `profile backup --out <file>`, `profile restore <file> <new profile>` | A backup (WISP 05 envelope, written and read a piece at a time), encrypted with the passphrase from `--passphrase-file` or `GHOSTLY_BACKUP_PASSPHRASE`. `--no-passphrase` makes one that is not encrypted: the file then holds the profile's keys and wallet secrets in the clear. Neither given, nothing is made. `--light` leaves out files over 1 MB (voice messages over 4 MB): their messages stay, and the restored copy says each one is not in this backup |
170
171
  | `profile create <name> [--use] [--name <shown>] [--force]`, `profile list`, `profile use <name>` | Profiles |
171
172
  | `profile picture <jpeg> \| --clear` | The picture contacts see (a JPEG within 512 px; 128 px is what the app sends) |
172
- | `profile show`, `profile set [--name <name>] [--share-profile \| --no-share-profile] [--force]` | The name contacts see (one that looks like a secret needs `--force`) |
173
+ | `profile show`, `profile set [--name <name>] [--share-profile \| --no-share-profile] [--force]` | The name contacts see (up to 64 characters, cleaned as a chat's or a group's name is; empty is no name; one that looks like a secret needs `--force`) |
173
174
  | `react <chat> <message> <emoji> [--remove] [--wait none\|confirmed] [--timeout s]` | React to a message with one emoji; a new one replaces yours, `--remove` takes it back. Without a daemon it stays until the contact confirmed it (`--wait confirmed`, the default there; `--timeout`, 30 s): a one-shot that left at once took the reaction along unsaid. `confirmed` says whether the contact has it |
174
175
  | `routine send <chat\|group> --name <name> --schedule "every day 01:00" [--cron "0 1 * * *"] [--state active\|paused] [--next <time>] [--run ok\|failed\|skipped[:summary]] [--link url]… [--id id] [--text <text>] [--json json\|-\|file] [--force]`, `routine update <chat\|group> <routine> [fields…]` | A routine card for something a bot runs on a schedule (WISP 405 · Status Cards): its name, schedule (and cron line, shown only), state, last run and result, next run and up to 10 recent runs. `--run` records a run now as the last one; `--next` takes milliseconds or a date within a year (no zone: local time, a bare `2026-09-30` local midnight; `Z` or `+02:00` as given). Updates merge and are paced as `task update`'s, and wait as `task send` and `task update` do. The app shows it, and runs nothing |
175
176
  | `saved add\|remove <chat\|group> <message>`, `saved list` | Saved messages: mark a message of a chat or a group to find it again, kept for this profile on this device and never sent (the app shows the same list in its Saved view). `saved list` gives them under `saved`, the last saved first, each as it is now (an edit shows its latest text) with its `chat` or `group` and `savedAt`; a deleted message drops out |
@@ -277,7 +278,8 @@ A spend on Mainnet needs the engine's `confirmedReal` (the app asks the person).
277
278
 
278
279
  SSH (`ssh-keygen`), OpenPGP (`gpg`) and Bitcoin (a wallet's "sign message") proofs are made with the tool: `identity
279
280
  add` prints the statement and the command, `identity complete` takes its output. A domain or a DID publishes a record,
280
- then `identity complete` asks the engine to look it up. In-app signers (a Nostr signer over NIP-46, Pubky) run in one
281
+ then `identity complete` asks the engine to look it up. The last of the steps `identity add` answers is that `identity
282
+ complete` command, with its draft (the app's "press Check" and "paste it into Ghostly" point to it). In-app signers (a Nostr signer over NIP-46, Pubky) run in one
281
283
  `identity add`, with their fields in `--field` (a NIP-46 `bunker://` link on stdin: `printf 'bunker=%s\n' "$LINK" | ghostly
282
284
  identity add nostr --signer nip46 --stdin`), and print what they wait on (a link, a code) to stderr. OpenID Connect,
283
285
  AT Protocol and a NIP-07 browser extension need a browser window: make those proofs in the app. `identity providers`
@@ -319,12 +321,14 @@ chat (`chat list`, `chat show`, `chat rename`, …) and `engine getState` print
319
321
  said, which orders nothing (a clock can be wrong).
320
322
  - A message's `from` is `me`, `peer`, or `system` for a group's own line in `group history` (`event`: created, joined,
321
323
  renamed, …; the stream says it as `group.event`): nobody wrote it, whatever `member` key it carries.
322
- - `seq` grows by one per event in the profile, across restarts; `id` is the same whenever the same fact is reported.
324
+ - `seq` grows by one per event in the profile, across restarts, and is never given to two events; after a crash, or a
325
+ full disk that kept events out of the journal, it can skip numbers, and a replay across them starts with
326
+ `events.gap`. `id` is the same whenever the same fact is reported.
323
327
  Dedupe by `id`; resume with `--since <seq>`, or let `--cursor <file>` remember the last event handled. A cursor
324
328
  file that holds no event number (empty, edited by hand) is refused at start (`bad_request`, naming the file): fix or
325
329
  remove it, or give `--since`.
326
330
  - Types: `daemon.started`, `chat.created`, `chat.removed`, `chat.renamed`, `chat.pairing` (`stage`: publishing,
327
- waiting, resolving, on-dht, live, …), `chat.connection` (`live`, `transport`), `typing.started` (with `kind` and, when given, `status`; again when either changes) and `typing.stopped` (the contact is writing, or stopped: a message, a stop, or 6 s of silence), `chat.joined` (the contact's app
331
+ waiting, resolving, on-dht, live, …), `chat.connection` (`live`, `transport`), `typing.started` (with `kind` and, when given, `status`; again when either changes) and `typing.stopped` (the contact is writing, or stopped: a message, a stop, or 6 s of silence; live only, as `group.typing.*`: never in the journal, so `--since` does not replay them), `chat.joined` (the contact's app
328
332
  announced itself, once; not a message: a later message of theirs in the same words is `message.received`), `chat.announced`, `message.received` (`message.nick`: the name the contact gave), `message.sent`, `message.delivery`
329
333
  (`delivery`: sending, queued, waiting, held, sent, delivered, failed), `message.edited` (a text changed in place, the
330
334
  contact's or mine: once per edit number, with `edits` and the message as it is now; `group.message.edited` in a group), `message.deleted` (`{chat, messageId}`: a message gone from this device, deleted here or for everyone by its author; `group.deleted` with `group` in a group), `group.created`,
@@ -370,7 +374,7 @@ chat (`chat list`, `chat show`, `chat rename`, …) and `engine getState` print
370
374
  - `--type message.received` keeps one type; `--type message` (or `message.`, `message.*`) a family. A family deeper
371
375
  down ends in "." (`group.typing.`): `group.message` is that type alone.
372
376
  - `--from <chat|key>` and `--group <group>` (again for more): an allowlist. Only the chats (id, a label given here,
373
- or the contact's `peer` key, which also matches a chat made later) and groups (id, prefix or name; one that fits more than one group is refused) named get through;
377
+ or the contact's `peer` key, which also matches a chat made later) and groups (id, prefix or name, or `group:<id>`; one that fits more than one group is refused) named get through;
374
378
  a prefix of a chat's id or the name its contact gave itself is refused (another contact could call itself that:
375
379
  name the chat first with `chat rename`); any other chat's or
376
380
  group's event stops before `--exec`, `--webhook` and stdout (the message stays in the chat; the cursor moves past
package/SKILL.md CHANGED
@@ -121,7 +121,8 @@ chat; a `<chat>` is its id, a unique prefix of it, or its name.
121
121
 
122
122
  Names are for people at a terminal. A contact chooses its own name, a group's admin its group's name and a member its
123
123
  name in a group, so in a script or an agent keep the **id** (`chat` and `group` in every answer and event, a member's
124
- key) and address by it: `<chat id>`, `group:<group id>`, `<member key>`. Where a command takes a chat or a group, a
124
+ key) and address by it: `<chat id>`, `group:<group id>` (every command that takes a group, `listen --group` too),
125
+ `<member key>`. Where a command takes a chat or a group, a
125
126
  name that a contact gave itself and that also names one of your groups is refused (exit 1, `bad_request`) and both ids are shown.
126
127
  So is a `<group>` that is one group's name and a prefix of another's id.
127
128
 
@@ -329,7 +330,7 @@ ghostly chat connect alice # back now
329
330
 
330
331
  Plain events, without `--turns`: `ghostly listen --type message.received` (one JSON object per line). Useful types:
331
332
  `message.received`, `message.delivery`, `message.edited`, `chat.joined`, `chat.connection`, `group.message` (with
332
- `message.mentioned: true` when it names the agent), `group.members`, `typing.started` / `typing.stopped` (`group.typing.*` with `member` in a private group),
333
+ `message.mentioned: true` when it names the agent), `group.members`, `typing.started` / `typing.stopped` (`group.typing.*` with `member` in a private group; live only, never replayed),
333
334
  `message.reaction` / `group.reaction`, `file.done` / `file.failed`, `payment.created` / `payment.updated`,
334
335
  `call.incoming`. The full list: the package README.
335
336
 
@@ -1,3 +1,3 @@
1
- import { c as findGroup, o as findChat, y as startNamedChats } from "./apiKit-DzXHZojD.js";
2
- import { a as hideStateSecrets, i as groupSendRefused, n as SETTABLE, o as mentionsFor, r as callApi, s as redactSettings, t as API_METHODS } from "./api-Bi6hCcwG.js";
1
+ import { l as findGroup, s as findChat, x as startNamedChats } from "./apiKit-BbNaxZGZ.js";
2
+ import { a as hideStateSecrets, i as groupSendRefused, n as SETTABLE, o as mentionsFor, r as callApi, s as redactSettings, t as API_METHODS } from "./api-C4MLg5Rs.js";
3
3
  export { API_METHODS, SETTABLE, callApi, findChat, findGroup, groupSendRefused, hideStateSecrets, mentionsFor, redactSettings, startNamedChats };
@@ -1,17 +1,18 @@
1
- import { $o as parseLocalTarget, Aa as voiceDownloadName, Ca as PLAYABLE_AUDIO, Da as downsamplePeaks, Dl as readImageMeta, Ea as baseMime, Gr as TYPING_REFRESH_MS, Hn as stripPictureMetadata, Hu as MAX_AVATAR_LENGTH, Ju as randomBytes$1, Ni as identityStatement, Rn as withoutVideoMetadata, Sa as sanitizeMime, Ta as VOICE_METER, Ul as ownInviteRefusal, Un as withoutPictureMetadata, Uo as AWAITING_PEER_MS, Uu as sanitizeAvatar, Vl as inviteLink, Wr as TYPING_KINDS, Yu as toBase64Url, Z as groupName, Zo as GhostlyHttpError, _o as cardLine, er as GROUP_FILE_LIMITS, fo as STATUS_CARD_LIMITS, ho as appCardUrl, ja as voiceLevel, ka as parseVoiceMeta, ml as appRef, mo as appCardId, ol as isAppUrl, pi as APP_DATA_MAX_BYTES, qr as sanitizeTypingStatus, ro as replySnippet, tl as APP_PERMISSIONS, ts as LIMITS, wa as VOICE_LIMITS, wo as claimedTime, xa as sanitizeFileName, xo as statusCardBytes, yl as isAppRef, yo as checkStatusCard, zn as NO_PICTURE_METADATA } from "./src-CCt5s4DK.js";
1
+ import { Aa as VOICE_LIMITS, Ao as claimedTime, Bn as NO_PICTURE_METADATA, Co as cardLine, Da as sanitizeFileName, Do as statusCardBytes, Fa as parseVoiceMeta, Ia as voiceDownloadName, Jr as TYPING_REFRESH_MS, La as voiceLevel, Ma as baseMime, Mu as relayUrlProblem, Na as downsamplePeaks, Nl as readImageMeta, Oa as sanitizeMime, Ri as identityStatement, Tl as isAppRef, To as checkStatusCard, Un as stripPictureMetadata, Wn as withoutPictureMetadata, Xr as sanitizeTypingStatus, Xu as MAX_AVATAR_LENGTH, Yl as ownInviteRefusal, Yo as AWAITING_PEER_MS, Z as groupName, Zu as sanitizeAvatar, ad as toBase64Url, as as parseLocalTarget, bl as appRef, bo as appCardId, fl as isAppUrl, gi as APP_DATA_MAX_BYTES, id as randomBytes$1, ja as VOICE_METER, ju as normalizeRelayUrl, ka as PLAYABLE_AUDIO, lo as replySnippet, nr as GROUP_FILE_LIMITS, ql as inviteLink, qr as TYPING_KINDS, rs as GhostlyHttpError, sl as APP_PERMISSIONS, ss as LIMITS, vo as STATUS_CARD_LIMITS, xo as appCardUrl, zn as withoutVideoMetadata } from "./src-BIdfHB7t.js";
2
2
  import { u as fileStore } from "./idb-BHsAqENE.js";
3
- import { J as iceServerProblem, O as waitingGroupFile, T as removeStored, Y as iceServerSetting, i as groupOfFile, k as IDENTITY_DRAFT_TTL_MS, l as replyRef, n as groupFileId, v as paymentNetwork } from "./groupFiles-BAQIt_bJ.js";
3
+ import { O as waitingGroupFile, T as removeStored, X as iceServerSetting, Y as iceServerProblem, i as groupOfFile, k as IDENTITY_DRAFT_TTL_MS, l as replyRef, n as groupFileId, v as paymentNetwork } from "./groupFiles-BuToTMUk.js";
4
4
  import { f as FILE_BYTES_STEP, o as fileBytes, s as fileBytesOf } from "./fileBytes-DjBYYyXT.js";
5
- import { t as IDENTITY_PROVIDERS } from "./registry-BSyxGjN6.js";
6
- import { n as secretWords, r as findSecret, t as guardText } from "./secretGuard-CSVNxXVW.js";
7
- import { i as localFileError, r as asCliError, t as CliError } from "./errors-R4S2SAEM.js";
8
- import { a as WALLET_TYPES, c as DESTRUCTIVE_CALLS, d as ENGINE_READS, f as READ_PARAMS, i as TRANSPORT_NAMES, l as ENGINE_METHODS, m as engineParamsProblem, n as CHAT_METHODS, r as PAY_METHODS, s as withStoredIds, t as ADDRESS_TYPES, u as ENGINE_PARAMS } from "./words-B1ylON2h.js";
9
- import { C as waitForState, S as transportOffered, _ as oneOf, a as dhtOnly, b as state, c as findGroup, d as inviteTaken, f as list, g as num, h as node, i as chatOrGroup, l as findOwnNamedChat, n as bool, o as findChat, p as messageOf, r as chatOf, s as findChatOrGroup, u as groupOf, v as sentAt, x as str } from "./apiKit-DzXHZojD.js";
5
+ import { t as IDENTITY_PROVIDERS } from "./registry-CEjnubep.js";
6
+ import { n as secretWords, r as findSecret, t as guardText } from "./secretGuard-B7Hj0Kvz.js";
7
+ import { i as localFileError, r as asCliError, t as CliError } from "./errors-Dt-ZnyOX.js";
8
+ import { a as WALLET_TYPES, c as DESTRUCTIVE_CALLS, d as ENGINE_READS, f as READ_PARAMS, i as TRANSPORT_NAMES, l as ENGINE_METHODS, m as engineParamsProblem, n as CHAT_METHODS, r as PAY_METHODS, s as withStoredIds, t as ADDRESS_TYPES, u as ENGINE_PARAMS } from "./words-Dk6o6wz4.js";
9
+ import { C as str, S as state, T as waitForState, _ as node, a as cleanName, b as sentAt, c as findChatOrGroup, d as groupOf, f as groupPrefixed, h as messageOf, i as chatOrGroup, l as findGroup, m as list, n as bool, o as dhtOnly, p as inviteTaken, r as chatOf, s as findChat, u as findOwnNamedChat, v as num, w as transportOffered, y as oneOf } from "./apiKit-BbNaxZGZ.js";
10
10
  import { t as childEnv } from "./childEnv-BVOQK9EA.js";
11
- import { a as checkShownName } from "./profiles-DgIfvBeN.js";
12
- import { a as waitForConfirmed, c as waitForMessage, i as pressable, l as waitForRemoval, n as buttonsCard, o as waitForEdit, s as waitForGroupFrame, t as BUTTON_METHODS } from "./buttons-CAW5v5EE.js";
13
- import { t as BACKUP_METHODS } from "./backup-BL49Kt-T.js";
14
- import { o as checkedBundle } from "./apps-DIQbzG08.js";
11
+ import { a as checkShownName } from "./profiles-aV9vaK0B.js";
12
+ import { t as chatState } from "./waitNotice-Ce3YCinu.js";
13
+ import { a as waitForConfirmed, c as waitForMessage, i as pressable, l as waitForRemoval, n as buttonsCard, o as waitForEdit, s as waitForGroupFrame, t as BUTTON_METHODS } from "./buttons-Do7dCku6.js";
14
+ import { t as BACKUP_METHODS } from "./backup-DyDsW7sC.js";
15
+ import { o as checkedBundle } from "./apps-BluQgEhv.js";
15
16
  import { generateMnemonic } from "@scure/bip39";
16
17
  import { wordlist } from "@scure/bip39/wordlists/english.js";
17
18
  import { execFile, spawn } from "node:child_process";
@@ -1261,6 +1262,14 @@ var FILE_METHODS = {
1261
1262
  target = `${stem} (${n})${ext}`;
1262
1263
  }
1263
1264
  const partial = join(dirname(target), `.ghostly-save-${process.pid}-${toBase64Url(randomBytes$1(6))}.partial`);
1265
+ const asked = (error, where) => {
1266
+ const failed = error;
1267
+ if (failed instanceof Error && failed.path === partial) {
1268
+ failed.path = where;
1269
+ failed.message = failed.message.replaceAll(partial, where);
1270
+ }
1271
+ return error;
1272
+ };
1264
1273
  let out;
1265
1274
  try {
1266
1275
  out = await open(partial, "wx", 384);
@@ -1271,7 +1280,7 @@ var FILE_METHODS = {
1271
1280
  if (!there) throw new CliError("not_found", `No such file or folder: ${folder}`);
1272
1281
  if (!there.isDirectory()) throw new CliError("not_found", `${folder} is a file, not a folder`);
1273
1282
  }
1274
- throw error;
1283
+ throw asked(error, dirname(target));
1275
1284
  }
1276
1285
  let written = 0, complete = false;
1277
1286
  try {
@@ -1304,6 +1313,8 @@ var FILE_METHODS = {
1304
1313
  throw refused ?? error;
1305
1314
  }
1306
1315
  if (stored.direction !== "out") await markDownloaded(target);
1316
+ } catch (error) {
1317
+ throw asked(error, target);
1307
1318
  } finally {
1308
1319
  await out?.close();
1309
1320
  await rm(partial, { force: true });
@@ -2066,6 +2077,11 @@ function groupJson(group, showSecret = false) {
2066
2077
  viaLink: !!group.invitation.viaLink,
2067
2078
  stage: group.invitation.stage ?? null
2068
2079
  } : null,
2080
+ ...group.others?.length ? { others: group.others.map((o) => "link" in o ? { link: showSecret ? o.link : "<hidden>" } : {
2081
+ chat: o.linkId,
2082
+ name: o.name,
2083
+ members: o.members
2084
+ }) } : {},
2069
2085
  community: group.community ?? null,
2070
2086
  picture: !!group.picture,
2071
2087
  pin: pinJson(group.pin)
@@ -2133,7 +2149,7 @@ var view = (ctx, id, params) => groupJson(state(ctx).groups.find((g) => g.id ===
2133
2149
  var GROUP_ADMIN_METHODS = {
2134
2150
  async "group.invite"(ctx, params) {
2135
2151
  const group = groupOf(ctx, params);
2136
- const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
2152
+ const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
2137
2153
  await node(ctx).inviteToGroup({
2138
2154
  groupId: group.id,
2139
2155
  linkId: link.id
@@ -2173,7 +2189,8 @@ var GROUP_ADMIN_METHODS = {
2173
2189
  },
2174
2190
  async "group.rename"(ctx, params) {
2175
2191
  const group = groupOf(ctx, params, "chat rename <chat> <name...>");
2176
- const name = groupName(str(params, "name", true));
2192
+ const clean = cleanName(str(params, "name", true), 64);
2193
+ const name = clean && groupName(clean);
2177
2194
  if (!name) throw new CliError("bad_request", `A group's name is 1 to 64 characters on one line`);
2178
2195
  guardText(name, bool(params, "force"), "group's name", "rename it");
2179
2196
  await node(ctx).renameGroup({
@@ -2257,12 +2274,32 @@ function signerOf(p, id) {
2257
2274
  }
2258
2275
  return found;
2259
2276
  }
2260
- function instructionsJson(i) {
2277
+ var keep = (verb) => verb[0] === verb[0].toUpperCase() ? "Keep" : "keep";
2278
+ /**
2279
+ * The app's words for its own Check button and paste field, in the CLI's: what was pasted is kept for the last step,
2280
+ * `identity complete`. The steps stay the app's otherwise (a wallet's "paste the statement" is the wallet's field).
2281
+ */
2282
+ var APP_WORDS = [
2283
+ [/press Check/g, () => "finish it with the last step"],
2284
+ [/\b(paste|copy) (it|the [\w ]+?) into Ghostly/gi, (_, verb, what) => `${keep(verb)} ${what} for the last step`],
2285
+ [/\b(paste) (?=what it prints|the whole signature it prints|the <file>\.sig it writes)/gi, (_, verb) => `${keep(verb)} `]
2286
+ ];
2287
+ var inCliWords = (text) => APP_WORDS.reduce((t, [pattern, words]) => t.replace(pattern, words), text);
2288
+ /** The signer's steps, then the CLI's own last one: `identity complete` with this draft, then `identity share`. */
2289
+ function instructionsJson(signer, i, draftId) {
2290
+ const share = "It answers the proof; show it to a contact with ghostly identity share <chat> <id>.";
2291
+ const last = signer.kind === "publish" ? {
2292
+ text: `Once it is published, check it from here: the engine looks it up. ${share}`,
2293
+ copy: `ghostly identity complete ${draftId}`
2294
+ } : {
2295
+ text: `Then finish it with what you kept${i.paste ? ` (${i.paste.label})` : ""}, from a file or piped to it (… | ghostly identity complete ${draftId}). ${share}`,
2296
+ copy: `ghostly identity complete ${draftId} --evidence-file <file>`
2297
+ };
2261
2298
  return {
2262
- steps: i.steps.map((s) => ({
2263
- text: s.text,
2299
+ steps: [...i.steps.map((s) => ({
2300
+ text: inCliWords(s.text),
2264
2301
  ...s.copy ? { copy: s.copy } : {}
2265
- })),
2302
+ })), last],
2266
2303
  ...i.paste ? { paste: i.paste.label } : {}
2267
2304
  };
2268
2305
  }
@@ -2278,6 +2315,11 @@ function proofJson(p) {
2278
2315
  ...p.publicUri ? { publicUri: p.publicUri } : {}
2279
2316
  };
2280
2317
  }
2318
+ /** Where the CLI takes a signer's field: a secret (a bunker:// link) on stdin first, kept out of ps and the shell's history. */
2319
+ function howToGive(field) {
2320
+ const stdin = `on stdin (--stdin, a ${field.name}=... line)`, flag = `--field ${field.name}=...`;
2321
+ return field.kind === "secret" ? `give it ${stdin}, or ${flag}` : `give it with ${flag}, or ${stdin}`;
2322
+ }
2281
2323
  function pruneDrafts(now = Date.now()) {
2282
2324
  for (const [id, draft] of drafts) if (now - draft.createdAt > 18e5) drafts.delete(id);
2283
2325
  }
@@ -2335,7 +2377,7 @@ var IDENTITY_METHODS = {
2335
2377
  if (signer.kind === "in-app") {
2336
2378
  const values = params.fields ?? {};
2337
2379
  if (typeof values !== "object" || Array.isArray(values) || Object.values(values).some((v) => typeof v !== "string")) throw new CliError("bad_request", "fields must be an object of strings");
2338
- for (const field of signer.fields ?? []) if (!field.optional && !values[field.name]) throw new CliError("bad_request", `${signer.label} needs ${field.name} (${field.label})`);
2380
+ for (const field of signer.fields ?? []) if (!field.optional && !values[field.name]) throw new CliError("usage", `${signer.label} needs ${field.name} (${field.label}): ${howToGive(field)}`);
2339
2381
  const seconds = num(params, "timeout", 300, {
2340
2382
  min: 5,
2341
2383
  max: 3600
@@ -2409,7 +2451,7 @@ var IDENTITY_METHODS = {
2409
2451
  provider: p.id,
2410
2452
  signer: signer.id,
2411
2453
  statement: statement.text,
2412
- instructions: instructionsJson(signer.instructions(statement)),
2454
+ instructions: instructionsJson(signer, signer.instructions(statement), draftId),
2413
2455
  expiresInSeconds: IDENTITY_DRAFT_TTL_MS / 1e3
2414
2456
  };
2415
2457
  },
@@ -2455,7 +2497,7 @@ var IDENTITY_METHODS = {
2455
2497
  return { removed: id };
2456
2498
  },
2457
2499
  async "identity.share"(ctx, params) {
2458
- const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
2500
+ const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
2459
2501
  const id = str(params, "id", true);
2460
2502
  if (!state(ctx).identityProofs.some((p) => p.id === id)) throw new CliError("not_found", `No identity proof ${JSON.stringify(id)} (ghostly identity list)`);
2461
2503
  await node(ctx).shareIdentityProof({
@@ -2468,7 +2510,7 @@ var IDENTITY_METHODS = {
2468
2510
  };
2469
2511
  },
2470
2512
  async "identity.withdraw"(ctx, params) {
2471
- const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
2513
+ const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
2472
2514
  const id = str(params, "id", true);
2473
2515
  if (!link.identities?.shared.some((s) => s.id === id)) throw new CliError("not_found", `No identity proof ${JSON.stringify(id)} shared in this chat (ghostly identity contact ${link.id})`);
2474
2516
  await node(ctx).withdrawIdentityProof({
@@ -2865,7 +2907,7 @@ var SERVICE_METHODS = {
2865
2907
  };
2866
2908
  },
2867
2909
  async "service.share"(ctx, params) {
2868
- const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
2910
+ const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
2869
2911
  const shared = !bool(params, "off");
2870
2912
  const serviceId = serviceOf(ctx, params);
2871
2913
  await node(ctx).setServiceShared({
@@ -3620,7 +3662,7 @@ var WALLET_METHODS = Object.fromEntries(Object.entries({
3620
3662
  let n;
3621
3663
  let note;
3622
3664
  if (params.chat !== void 0 && !isInvoice(text)) throw new CliError("usage", "--chat names the chat an invoice came from: an address's or LNURL's invoice is its server's");
3623
- const chat = params.chat === void 0 ? void 0 : findOwnNamedChat(state(ctx).links, str(params, "chat", true));
3665
+ const chat = params.chat === void 0 ? void 0 : findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
3624
3666
  if (chat) inviteTaken(chat);
3625
3667
  if (isInvoice(text)) n = network(params);
3626
3668
  else if (isLnurl(text)) {
@@ -3672,7 +3714,7 @@ var WALLET_METHODS = Object.fromEntries(Object.entries({
3672
3714
  /** Ecash to a contact in a chat (the payment sheet's Pay). */
3673
3715
  async "chat.pay"(ctx, params) {
3674
3716
  const memo = memoOf(params, "pay");
3675
- const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
3717
+ const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
3676
3718
  inviteTaken(link);
3677
3719
  const amount = num(params, "amount", 0, { min: 1 });
3678
3720
  if (!amount) throw new CliError("bad_request", "amount is required");
@@ -3723,7 +3765,7 @@ var WALLET_METHODS = Object.fromEntries(Object.entries({
3723
3765
  },
3724
3766
  /** Pays a request the contact made in a chat. */
3725
3767
  async "chat.payRequest"(ctx, params) {
3726
- const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
3768
+ const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
3727
3769
  const paymentId = str(params, "payment", true);
3728
3770
  const request = state(ctx).payments[paymentId];
3729
3771
  if (!request || request.linkId !== link.id || request.kind !== "request") throw new CliError("not_found", `No request ${paymentId} in this chat`);
@@ -3874,17 +3916,23 @@ function relayRefused(error, patch) {
3874
3916
  ].filter((key) => Object.hasOwn(patch, key));
3875
3917
  return new CliError("bad_request", `${keys.join(", ") || "relays"}: ${error.message.replace(/^Enter /, "give ").replace(/^(Not|Use) /, (word) => word.toLowerCase())}`);
3876
3918
  }
3877
- /** The engine keeps a chat's name to 48 UTF-16 units (renameLink). */
3878
- var CHAT_NAME_UNITS = 48;
3919
+ /** The engine keeps a chat's name to 48 characters (code points: `renameLink`). */
3920
+ var CHAT_NAME_LENGTH = 48;
3879
3921
  /**
3880
- * A chat's name on this side (`chat rename`, an invite's `--label`): what the engine keeps whole, on one line, refused
3881
- * with the rule as a profile's or a group's name is. Taken as given, the engine cut it at 48 UTF-16 units without a
3882
- * word (half an emoji left as a lone surrogate) and kept line breaks. Counted as the engine counts: an emoji is two.
3922
+ * A chat's name on this side (`chat rename`, an invite's `--label`), as the engine stores it (`cleanName`): a tab or a
3923
+ * line break is a space, invisible characters go, and what is left is counted. Longer than the engine keeps whole is
3924
+ * refused, not cut. An empty name (or spaces) is the documented one of `chat rename` (the contact's own name) and no
3925
+ * label for an invite; a name with nothing that shows is refused: given as is, the engine cleared the chat's name. A
3926
+ * name starting with `group:` is refused: `group:<ref>` names a group in every command (`groupPrefixed`).
3883
3927
  */
3884
3928
  function chatName(params, name) {
3885
3929
  const value = str(params, name);
3886
- if (value !== void 0 && (value.trim().length > CHAT_NAME_UNITS || /\p{Cc}/u.test(value.trim()))) throw new CliError("bad_request", `A chat's name is up to ${CHAT_NAME_UNITS} characters on one line (an emoji counts as two)`);
3887
- return value;
3930
+ if (value === void 0 || !value.trim()) return value === void 0 ? void 0 : "";
3931
+ const clean = cleanName(value, CHAT_NAME_LENGTH);
3932
+ if (clean === void 0) throw new CliError("bad_request", `A chat's name is up to ${CHAT_NAME_LENGTH} characters on one line`);
3933
+ if (!clean) throw new CliError("bad_request", `A chat's name needs a character that shows (an empty name gives back the contact's own)`);
3934
+ if (groupPrefixed(clean) !== null) throw new CliError("bad_request", `A chat's name can't start with "group:": that names a group`);
3935
+ return clean;
3888
3936
  }
3889
3937
  /** Code points before `index` (UTF-16) in `text`: mentions count code points (WISP 902 § Mentions). */
3890
3938
  var codePoints = (text, index) => [...text.slice(0, index)].length;
@@ -3969,6 +4017,17 @@ function showUntilPaired(ctx, linkId) {
3969
4017
  });
3970
4018
  inviteShown.set(ctx, stop);
3971
4019
  }
4020
+ /**
4021
+ * `invite create`'s `reason` when no relay took the invite. The engine's words ("Publish failed on every relay: Error:
4022
+ * http://… did not answer a moment ago; retry shortly; Error: …") read as the CLI failing, a class name per relay, beside
4023
+ * a `note` that says the invite is good: the relays are named, and nothing is asked of whoever reads it.
4024
+ */
4025
+ function inviteNotOut(detail) {
4026
+ if (!detail.startsWith("Publish failed on every relay:")) return detail;
4027
+ const hosts = [...new Set([...detail.matchAll(/\bhttps?:\/\/[^\s;,]+/g)].map(([url]) => URL.canParse(url) ? new URL(url).host : url))];
4028
+ const named = hosts.length ? ` (${hosts.join(", ")})` : "";
4029
+ return `${/ responded \d{3}\b/.test(detail) ? "No relay took the invite" : "No relay answered"}${named}: it goes out once one does`;
4030
+ }
3972
4031
  /** V8's words for reading what a value does not have: an `engine.call` given a parameter of the wrong kind. */
3973
4032
  var BAD_VALUE = /^Cannot (destructure|read properties of (undefined|null))|is not (a function|iterable)/;
3974
4033
  var METHODS = {
@@ -4038,6 +4097,7 @@ var METHODS = {
4038
4097
  if (kind === "strings" && !(Array.isArray(value) && value.every((v) => typeof v === "string"))) throw new CliError("bad_request", `${key} must be a list of strings`);
4039
4098
  if (kind === "string" && typeof value !== "string") throw new CliError("bad_request", `${key} must be a string`);
4040
4099
  if (kind === "boolean" && typeof value !== "boolean") throw new CliError("bad_request", `${key} must be true or false`);
4100
+ if (key === "relays" && value.length && !value.some(normalizeRelayUrl)) throw relayRefused(new Error(relayUrlProblem(value[0]) ?? ""), { relays: value });
4041
4101
  if (key === "nick") {
4042
4102
  patch.nick = checkShownName(value, key);
4043
4103
  guardText(patch.nick, bool(params, "force"), "nick", "set it");
@@ -4090,7 +4150,7 @@ var METHODS = {
4090
4150
  return {
4091
4151
  ...answer,
4092
4152
  ...waitUntil !== void 0 && { retryInMs: Math.max(0, waitUntil - Date.now()) },
4093
- ...progress?.detail && { reason: progress.detail },
4153
+ ...progress?.detail && { reason: inviteNotOut(progress.detail) },
4094
4154
  note: "The invite is good: it goes out by itself once a relay answers, while a daemon runs for this profile"
4095
4155
  };
4096
4156
  },
@@ -4410,8 +4470,13 @@ var METHODS = {
4410
4470
  async "chat.delete"(ctx, params) {
4411
4471
  if (bool(params, "everyone")) {
4412
4472
  const target = chatOrGroup(ctx, str(params, "chat", true));
4413
- const wait = oneOf(params, "wait", ["none", "confirmed"], !target.group && ctx.mode === "one-shot" ? "confirmed" : "none");
4414
- if (target.group && wait !== "none") throw new CliError("bad_request", "A group has no receipts: --wait confirmed is for a chat");
4473
+ const wait = oneOf(params, "wait", [
4474
+ "none",
4475
+ "confirmed",
4476
+ "sent"
4477
+ ], ctx.mode !== "one-shot" ? "none" : target.group ? "sent" : "confirmed");
4478
+ if (target.group && wait === "confirmed") throw new CliError("bad_request", "A group has no receipts: --wait confirmed is for a chat (--wait sent waits until a member's edge took it)");
4479
+ if (!target.group && wait === "sent") throw new CliError("bad_request", "--wait sent is for a group: a chat's removal waits with --wait confirmed");
4415
4480
  const ms = num(params, "timeout", 30, {
4416
4481
  min: 1,
4417
4482
  max: 3600
@@ -4424,12 +4489,22 @@ var METHODS = {
4424
4489
  messageId: message.id
4425
4490
  });
4426
4491
  if (result.error) throw new CliError(result.refused ? "refused" : "unavailable", result.error);
4427
- if (target.group) return {
4428
- group: target.id,
4429
- messageId: message.id,
4430
- deleted: message.id,
4431
- everyone: true
4432
- };
4492
+ if (target.group) {
4493
+ const e = result.e;
4494
+ const edges = !e ? 0 : wait === "sent" ? await waitForGroupFrame(ctx, target.id, message.id, e, ms) : node(ctx).groupTaken({
4495
+ groupId: target.id,
4496
+ messageId: message.id,
4497
+ edit: e
4498
+ });
4499
+ return {
4500
+ group: target.id,
4501
+ messageId: message.id,
4502
+ deleted: message.id,
4503
+ everyone: true,
4504
+ sent: edges > 0,
4505
+ edges
4506
+ };
4507
+ }
4433
4508
  if (wait === "confirmed") await waitForRemoval(ctx, target.linkId, message.id, ms);
4434
4509
  return {
4435
4510
  chat: target.id,
@@ -4557,11 +4632,12 @@ var METHODS = {
4557
4632
  return chatJson(await waitForState(ctx, (s) => {
4558
4633
  const now = s.links.find((l) => l.id === link.id);
4559
4634
  if (!now) throw new CliError("not_found", `Chat ${link.id} was removed`);
4560
- return (until === "live" ? isLive(now) : until === "text" ? now.textDelivery === "stream" || now.textDelivery === "dht" || now.textDelivery === "hold" : !!now.pairingProgress?.peerSeen || now.pairing?.status === "ready" || isLive(now)) ? now : void 0;
4561
- }, ms, `chat ${link.id} to be ${until}`));
4635
+ return (until === "live" ? isLive(now) : until === "text" ? now.textDelivery === "stream" || now.textDelivery === "dht" || now.textDelivery === "hold" : !!now.peerParticipationKey || !!now.pairingProgress?.peerSeen || now.pairing?.status === "ready" || isLive(now)) ? now : void 0;
4636
+ }, ms, `chat ${link.id} ${chatState(until).to}`));
4562
4637
  },
4563
4638
  async "group.create"(ctx, params) {
4564
- const name = groupName(str(params, "name", true));
4639
+ const clean = cleanName(str(params, "name", true), 64);
4640
+ const name = clean && groupName(clean);
4565
4641
  if (!name) throw new CliError("bad_request", `A group's name is 1 to 64 characters on one line`);
4566
4642
  guardText(name, bool(params, "force"), "group's name", "create it");
4567
4643
  const profile = oneOf(params, "profile", ["community", "mesh"], "community");
@@ -4952,7 +5028,7 @@ function notAGroup(ctx, params, chat, hint) {
4952
5028
  } catch (error) {
4953
5029
  if (!(error instanceof CliError) || error.code !== "not_found") throw error;
4954
5030
  const ref = str(params, "chat", true);
4955
- const named = ref.startsWith("group:") ? ref.slice(6) : ref;
5031
+ const named = groupPrefixed(ref) ?? ref;
4956
5032
  let group;
4957
5033
  try {
4958
5034
  group = findGroup(state(ctx).groups, named);
@@ -5006,8 +5082,9 @@ async function saveMark(ctx, params, remove) {
5006
5082
  messageId,
5007
5083
  remove
5008
5084
  });
5009
- if (result.error && remove && /not in this chat/.test(result.error)) throw new CliError("not_found", `No saved message ${JSON.stringify(messageId)} in this chat (ghostly saved list shows the saved ones)`);
5010
- if (result.error) throw new CliError(/not in this chat/.test(result.error) ? "not_found" : "bad_request", result.error);
5085
+ const where = target.group ? "group" : "chat";
5086
+ if (result.error && /not in this chat/.test(result.error)) throw new CliError("not_found", remove ? `No saved message ${JSON.stringify(messageId)} in this ${where} (ghostly saved list shows the saved ones)` : `No message ${JSON.stringify(messageId)} in this ${where}`);
5087
+ if (result.error) throw new CliError("bad_request", result.error);
5011
5088
  return {
5012
5089
  [target.group ? "group" : "chat"]: target.id,
5013
5090
  messageId,
@@ -5099,4 +5176,4 @@ async function callApi(ctx, method, params = {}) {
5099
5176
  //#endregion
5100
5177
  export { flushCardUpdates as _, hideStateSecrets as a, paymentJson as c, nodeLocalFetch as d, chatJson as f, resumeHolds as g, groupMessageJson as h, groupSendRefused as i, reportAppFrames as l, groupJson as m, SETTABLE as n, mentionsFor as o, chatMessageJson as p, callApi as r, redactSettings as s, API_METHODS as t, servedApps as u };
5101
5178
 
5102
- //# sourceMappingURL=api-Bi6hCcwG.js.map
5179
+ //# sourceMappingURL=api-C4MLg5Rs.js.map