@ghostlytools/cli 1.13.2 → 1.13.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 (83) hide show
  1. package/README.md +9 -8
  2. package/dist/assets/{api-DV52o7A8.js → api-DO0YMLiB.js} +2 -2
  3. package/dist/assets/{api-O57SNJcb.js → api-Dz2cw7WD.js} +155 -44
  4. package/dist/assets/api-Dz2cw7WD.js.map +1 -0
  5. package/dist/assets/{apiKit-CPTFJHA7.js → apiKit-DAFsWtyk.js} +17 -3
  6. package/dist/assets/apiKit-DAFsWtyk.js.map +1 -0
  7. package/dist/assets/{appFetch-Ca9DNQQ2.js → appFetch-BQO5Pk7W.js} +2 -2
  8. package/dist/assets/{appFetch-Ca9DNQQ2.js.map → appFetch-BQO5Pk7W.js.map} +1 -1
  9. package/dist/assets/{apps-gXpGFPiv.js → apps-B88rYWRm.js} +45 -19
  10. package/dist/assets/apps-B88rYWRm.js.map +1 -0
  11. package/dist/assets/{apps-uZTu5FlR.js → apps-D4KRpZB4.js} +1 -1
  12. package/dist/assets/{backup-Di2U6QVH.js → backup-BeXBtbVL.js} +1 -1
  13. package/dist/assets/{backup-CxH3auHB.js → backup-CNLY905d.js} +10 -5
  14. package/dist/assets/backup-CNLY905d.js.map +1 -0
  15. package/dist/assets/bark_ffi_wasm_bg-CjjCN3FD.js +5 -0
  16. package/dist/assets/{bitcoind-BpZn3bRN.js → bitcoind-BXZdQ1wZ.js} +2 -2
  17. package/dist/assets/{bitcoind-BpZn3bRN.js.map → bitcoind-BXZdQ1wZ.js.map} +1 -1
  18. package/dist/assets/bitcoindevkit_bg-D6IFIaJi.js +5 -0
  19. package/dist/assets/{buttons-D4udKEvT.js → buttons-BKojbx0Q.js} +4 -4
  20. package/dist/assets/{buttons-D4udKEvT.js.map → buttons-BKojbx0Q.js.map} +1 -1
  21. package/dist/assets/buttons-_5Fw8uHn.js +1 -0
  22. package/dist/assets/{client-DGx7E8b3.js → client-BtPhfWjK.js} +2 -2
  23. package/dist/assets/{client-DGx7E8b3.js.map → client-BtPhfWjK.js.map} +1 -1
  24. package/dist/assets/{fedimintSdk-D-6H9Pe7.js → fedimintSdk-eLXBrj9i.js} +2 -2
  25. package/dist/assets/{fedimintSdk-D-6H9Pe7.js.map → fedimintSdk-eLXBrj9i.js.map} +1 -1
  26. package/dist/assets/fedimint_client_wasm_bg-CRQlnJdu.js +5 -0
  27. package/dist/assets/{fixedHosts-CODN2pTL.js → fixedHosts-BJFL8Ell.js} +3 -3
  28. package/dist/assets/{fixedHosts-CODN2pTL.js.map → fixedHosts-BJFL8Ell.js.map} +1 -1
  29. package/dist/assets/{groupMeta-CeZpqVVC.js → groupMeta-Cz95F6sX.js} +98 -9
  30. package/dist/assets/groupMeta-Cz95F6sX.js.map +1 -0
  31. package/dist/assets/{host-CRA7h5A2.js → host-BsBWxTtW.js} +172 -22
  32. package/dist/assets/host-BsBWxTtW.js.map +1 -0
  33. package/dist/assets/{identityProofs-B8zCp5_0.js → identityProofs-zI_Iy9uI.js} +15 -1
  34. package/dist/assets/identityProofs-zI_Iy9uI.js.map +1 -0
  35. package/dist/assets/{irohWeb-mnOi2Jp7.js → irohWeb-BLDcHwYz.js} +50 -13
  36. package/dist/assets/irohWeb-BLDcHwYz.js.map +1 -0
  37. package/dist/assets/{main-Chc871HV.js → main-D48Ben7C.js} +68 -28
  38. package/dist/assets/main-D48Ben7C.js.map +1 -0
  39. package/dist/assets/{ownDid-BOuSlDv-.js → ownDid-CwxFBzOH.js} +5 -4
  40. package/dist/assets/ownDid-CwxFBzOH.js.map +1 -0
  41. package/dist/assets/{ownStatus-CLA1VPkL.js → ownStatus-DjD0sQKF.js} +34 -11
  42. package/dist/assets/ownStatus-DjD0sQKF.js.map +1 -0
  43. package/dist/assets/{profiles-BH1bH9aE.js → profiles-BAJf0c9E.js} +33 -8
  44. package/dist/assets/profiles-BAJf0c9E.js.map +1 -0
  45. package/dist/assets/{registry-DAq16T-V.js → registry-CHwHTWbK.js} +1 -1
  46. package/dist/assets/{registry-DP_-RA-v.js → registry-CPuexTle.js} +25 -13
  47. package/dist/assets/registry-CPuexTle.js.map +1 -0
  48. package/dist/assets/{resolve-B1eQ4dVQ.js → resolve-BqmGXKn4.js} +2 -2
  49. package/dist/assets/{resolve-B1eQ4dVQ.js.map → resolve-BqmGXKn4.js.map} +1 -1
  50. package/dist/assets/{server-Bd2ofxc1.js → server-e4oKeNez.js} +399 -88
  51. package/dist/assets/server-e4oKeNez.js.map +1 -0
  52. package/dist/assets/{sshForges-As7dbGXM.js → sshForges-Cqt3qfWe.js} +2 -2
  53. package/dist/assets/{sshForges-As7dbGXM.js.map → sshForges-Cqt3qfWe.js.map} +1 -1
  54. package/dist/assets/translate-DnuQMfj0.js.map +1 -1
  55. package/dist/assets/{waitNotice-BHuMofaH.js → waitNotice-mB0Ym145.js} +2 -2
  56. package/dist/assets/{waitNotice-BHuMofaH.js.map → waitNotice-mB0Ym145.js.map} +1 -1
  57. package/dist/ghostly.mjs +1 -1
  58. package/npm-shrinkwrap.json +2 -2
  59. package/package.json +1 -1
  60. package/dist/assets/api-O57SNJcb.js.map +0 -1
  61. package/dist/assets/apiKit-CPTFJHA7.js.map +0 -1
  62. package/dist/assets/apps-gXpGFPiv.js.map +0 -1
  63. package/dist/assets/backup-CxH3auHB.js.map +0 -1
  64. package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js +0 -5
  65. package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js.map +0 -1
  66. package/dist/assets/bark_ffi_wasm_bg-VNmaJsc9.wasm +0 -0
  67. package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js +0 -5
  68. package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js.map +0 -1
  69. package/dist/assets/bitcoindevkit_bg-DXil67yS.wasm +0 -0
  70. package/dist/assets/buttons-YTYEqvGC.js +0 -1
  71. package/dist/assets/fedimint_client_wasm_bg-Cr5xGD-w.js +0 -5
  72. package/dist/assets/fedimint_client_wasm_bg-Cr5xGD-w.js.map +0 -1
  73. package/dist/assets/fedimint_client_wasm_bg-DeFtkIv6.wasm +0 -0
  74. package/dist/assets/groupMeta-CeZpqVVC.js.map +0 -1
  75. package/dist/assets/host-CRA7h5A2.js.map +0 -1
  76. package/dist/assets/identityProofs-B8zCp5_0.js.map +0 -1
  77. package/dist/assets/irohWeb-mnOi2Jp7.js.map +0 -1
  78. package/dist/assets/main-Chc871HV.js.map +0 -1
  79. package/dist/assets/ownDid-BOuSlDv-.js.map +0 -1
  80. package/dist/assets/ownStatus-CLA1VPkL.js.map +0 -1
  81. package/dist/assets/profiles-BH1bH9aE.js.map +0 -1
  82. package/dist/assets/registry-DP_-RA-v.js.map +0 -1
  83. package/dist/assets/server-Bd2ofxc1.js.map +0 -1
package/README.md CHANGED
@@ -119,7 +119,7 @@ The rows are in alphabetical order of their first command, and every command of
119
119
  | `app publish <dir> --key <file> [--out <file>] [--sequence n]`, `app verify <bundle\|url>` | The publisher tools of WISP 1200 (Apps), run here with no profile or daemon. `app publish` bundles and signs an app: `<dir>/ghostly-app.json` holds the manifest's fields but `publisher`, `sequence` and `files`, and every other file in `<dir>` goes in (dot files are left out and listed in `skipped`). It writes `<dir>/app.ghostlyapp` (or `--out`), its `sequence` one more than the bundle already there, which only the same key may follow (`--sequence n` sets it, refused unless higher); a sequence that `<dir>/ghostly-revoke.json` or the one beside `--out` already revokes is `refused` (`details.reason` `revoked`, `details.sequence` the first one it leaves alone). `--key` names the publisher key file, a PKCS #8 PEM: made owner-only on first use (back it up: an app is updated only with its key), refused when others may read it or when it is inside `<dir>`, never printed; a folder holding any private key file is refused (`details.reason` `private-key`). `app verify` checks a bundle from a file or an `https` URL as a client does (jsDelivr only at a full commit, 16 MiB at most) and answers its manifest and digest, or `refused` (exit 1) with the WISP's reason in `details.reason` |
120
120
  | `app revoke <dir> --key <file> (--digest <digest>… \| --up-to <sequence>) [--reason <text>] [--bundle <file>] [--force]` | Revoke versions of your app (WISP 1200 · Revocation): by digest (base64url, as `app verify` prints it; `--digest` again for each, up to 64) or every version up to a `sequence`, with an optional reason of one line of 1 to 200 characters (a bad or repeated `--digest`, or an empty or longer `--reason`, is a usage error naming the option). Clients keep a revocation for good, so `--up-to` past the bundle's own sequence asks for `--force` (`confirm`, exit 5; versions published from elsewhere), and `app publish` refuses a sequence that list already stops, naming the `--sequence` that clears it. The statement names the app of `<dir>/app.ghostlyapp` (or `--bundle`), is signed with that app's publisher key (any other key is refused, and none is made here), and is added to the `ghostly-revoke.json` beside that bundle, where `app verify`, `app serve` and a client read it and stop those versions (publish it beside the bundle). Answers `{app, digests \| upTo, current, added, revocations, file}`; `current` says whether that bundle is among them, `file` the list written |
121
121
  | `app send <chat> <ref\|name> <json\|->` | One message of a served app's own protocol to the same app on the contact's side (WISP 1200, Apps; needs the daemon): any JSON value, on the command line or `-` for stdin, at most 32 KiB, at most 48 a second. It goes on the live session only, while both sides have the app open, and is never kept for later: `{chat, app, sent: true}`, or an error whose `details.reason` is the WISP's name for why it did not go: `not-open` (`refused`: `app open` first), `too-large` (`bad_request`), `offline` and `peer-closed` (`unavailable`: the chat is not live, or the contact's app is not open; wait for `app.opened`), `too-fast` (`refused`). The contact's messages come as `app.message` events |
122
- | `app serve <bundle\|url> --grant chat [--grant name] [--url <url>]`, `app served`, `app unserve <ref\|name>` | Serve an app as a bot (WISP 1200, Apps): the profile speaks the app's messages in its chats itself, and no app runs here. `app serve` reads the signed bundle from a file or an `https` URL and checks it as `app verify` does (`refused` with the WISP's reason in `details.reason`). Each permission the manifest asks needs its `--grant`: `chat` (talk to the same app on the contact's side) and `name` (the profile's name in that chat); one left out is `confirm` (exit 5), naming it in `details.missing`. `internet` cannot be granted (no page runs here), a permission the app does not ask is `bad_request`, and an app that does not ask for `chat` is `refused`. A newer version replaces the one served; an older one, or another bundle under the same `sequence`, is `refused`. It answers `{served: {ref, title, version, sequence, digest, url?, permissions, granted, servedAt}, offered, restart?}`; `url` is where a contact's app reads the bundle, on raw.githubusercontent.com or cdn.jsdelivr.net at a full commit: `--url` (any other link is `bad_request`), else the first of the URL served from and the manifest's sources that a contact's app reads from, and none when there is no such link. The list is kept in the profile's folder (`apps.json`), and a `profile backup` carries it to the restored copy. A profile's engine offers `apps/1` to contacts only while it serves an app, and reads the list when it starts: `offered` says whether it does now, and `restart: true` that `daemon restart` is needed for it. `app served` answers `{apps, offered, restart?}`; `app unserve` removes one by its reference or its name, and on a daemon closes it in every chat it was open in (the contact hears `close`) |
122
+ | `app serve <bundle\|url> --grant chat [--grant name] [--url <url>]`, `app served`, `app unserve <ref\|name>` | Serve an app as a bot (WISP 1200, Apps): the profile speaks the app's messages in its chats itself, and no app runs here. `app serve` reads the signed bundle from a file or an `https` URL and checks it as `app verify` does (`refused` with the WISP's reason in `details.reason`). Each permission the manifest asks needs its `--grant`: `chat` (talk to the same app on the contact's side) and `name` (the profile's name in that chat); one left out is `confirm` (exit 5), naming it in `details.missing`. `internet` cannot be granted (no page runs here), a permission the app does not ask is `bad_request`, and an app that does not ask for `chat` is `refused`. A newer version replaces the one served; an older one, or another bundle under the same `sequence`, is `refused`. It answers `{served: {ref, title, version, sequence, digest, url?, permissions, granted, servedAt}, offered, restart?}`; `url` is where a contact's app reads the bundle, on raw.githubusercontent.com or cdn.jsdelivr.net at a full commit: `--url` (any other link is `bad_request`), else the first of the URL served from and the manifest's sources that a contact's app reads from, and none when there is no such link. The list is kept in the profile's folder (`apps.json`), and a `profile backup` carries it to the restored copy. A profile's engine offers `apps/1` to contacts only while it serves an app, and reads the list when it starts: `offered` says whether it does now, and `restart: true` that `daemon restart` is needed for the offer to follow the list (the first app served, or the last one unserved). `app served` answers `{apps, offered, restart?}`; `app unserve` removes one by its reference or its name and answers `{unserved, apps, offered, restart?}`, and on a daemon closes it in every chat it was open in (the contact hears `close`) |
123
123
  | `button press <chat\|group> <message> <button> [--wait none\|sent\|delivered] [--timeout s]` | Press a button of someone else's question, as a tap in the app does (WISP 406 · Message Buttons): the reply carries the button's label, and the asker hears `button.pressed`. `<message>` is the question's id (its event or `chat history`), `<button>` a button's id from its `card`. Refused (exit 1) like a tap: closed buttons, a second answer past `--once`, a second press within a second. A one-shot in a chat waits until it went out, as `send`. Answers `{chat \| group, messageId, button, label, replyId, delivery \| edges}` |
124
124
  | `button update <chat\|group> <message> [--chosen <button>] [--close] [--text <text>] [--force] [--wait none\|confirmed\|sent] [--timeout s]` | Answer a question you sent with `send --button` (WISP 406 · Message Buttons): `--chosen` shows which button won, `--close` takes presses no more, `--text` changes the text (shown as edited; refused if blank, or if it looks like a secret, unless `--force`); the buttons and, unless given, the text stay. `<message>` is the `messageId` send gave. Answers `{chat \| group, buttons, messageId, card, edits}` |
125
125
  | `call auto [on\|off] [--from <chat>]… [--rate n]` | Answer calls by themselves, from anyone or the chats named (kept in the profile) |
@@ -141,22 +141,22 @@ The rows are in alphabetical order of their first command, and every command of
141
141
  | `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`, `switchGroup`, `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; `removeLink` while a delete for everyone has not reached the contact, as `chat remove` is, and `clearProfileData` while one has not in any chat, until `--force`; `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` |
142
142
  | `events [--since seq] [--translate lang]` | What the event journal holds, without following ([Translation](#translation)) |
143
143
  | `file list <chat\|group>`, `file accept\|decline\|pause\|resume\|cancel [<chat>] <file>` | Transfers; a file over 25 MiB waits for `file accept` (files/3), and so does a group's file that did not come by itself (over 8 MiB): its row's `transfer` says `stage: "asking"`, `waitingFor: "me"` (a file sent from here that the contact has not taken yet: `waitingFor: "contact"`; one sent while the contact is away: `stage: "waiting"`, `waitingFor: "contact"`). A file's id names its chat or its group, so `<chat>` may be left out. One the contact paused (`pausedBy: "peer"`) goes on only when they resume it: `file resume`, `file request` and `file resend` of it are `refused`, as are `file pause`, `file resume` and `file request` of one offered here that waits for `file accept`. `file accept` reads this device's room first: a file larger than the room left (beside the files still on their way) is not started and is `refused` with `details.reason: "no_room"` and `details.room` (bytes), and it keeps waiting, so free some space and accept it again |
144
- | `file resend [<chat>] <file>`, `file request [<chat>] <file>` | A file that stopped moving: sent again from here, or asked for again from the contact (a group's file: from whoever holds it); either goes on from the bytes the receiver holds (files/3) |
144
+ | `file resend [<chat>] <file>`, `file request [<chat>] <file>` | A file that stopped moving: sent again from here, or asked for again from the contact (a group's file: from whoever holds it); either goes on from the bytes the receiver holds (files/3). One that ended (cancelled or declined, by either side) is `refused` by these and by `file accept|decline|pause|resume|cancel` and `file save`, naming the way out (`file send` it again; the receiver asks the contact), with `details.reason` (`cancelled`, `declined`, `failed`) and `details.by` (`me`, `contact`, null). A second `file cancel` or `file decline` of one this side ended answers as the first did |
145
145
  | `file save [<chat>] <file> [--dir d \| --path p] [--force] [--wait [--timeout s]]` | Write a received file to disk: to `--path`, or into `--dir` under the name its sender gave it, with a `_` first when that name starts with `-`, so no tool run in the folder takes it for an option; a voice message goes in under the name Ghostly makes for it (`Ghostly voice <date time>`), and when that name is taken (two of one second) under a free `… (2)` (the answer's `path` is what was written). Never over a file without `--force`: a name taken in `--dir` is answered with the next free `--path … (2)` that keeps both; an unfinished one says how many bytes are here (exit `1`), one that waits for you to take it answers `5` naming `file accept`, with or without `--wait`; `--wait` waits for a received one first (a sent one is all here) |
146
- | `file send <chat\|group> <path> [--name n] [--mime t] [--voice [ms] [--peaks …]] [--reply <message>] [--force] [--wait none\|sent] [--timeout s]` | A file, or a voice note (its length and waveform measured from the file unless given); `--reply` quotes a message, as `send --reply` does. Answers the message's `messageId` (what `message delete`, `react` and `pin` take) and the file's id. Without a daemon, a file to a chat stays until the contact has all of it (`--wait sent`, the default there; `--timeout`, 300 s, then exit 4 with the `messageId` and the file's id in `details`, and it goes on with your next command; a file over 25 MiB waits for the contact's `file accept` meanwhile); `--wait none` answers at once, as a daemon does by default. To a group (`group:<id>` when a chat has the same name), up to 100 MiB: every member sees it at once and each member's app fetches it from a member who has it (WISP 503) |
147
- | `file wait [<chat>] <file> [--timeout s]` | Wait until a transfer ends: exit `0` when the file is all here, `1` with the transfer's error when it failed (`details.retry`: `file resend` can go on), `4` on timeout (default 300 s), `5` at once when a received file waits for you to take it (over 25 MiB, or a group's file that did not come by itself): the message names `file accept` |
146
+ | `file send <chat\|group> <path> [--name n] [--mime t] [--voice [ms] [--peaks …]] [--reply <message>] [--force] [--wait none\|sent] [--timeout s]` | A file, or a voice note (its length and waveform measured from the file unless given); `--reply` quotes a message, as `send --reply` does. Answers the message's `messageId` (what `message delete`, `react` and `pin` take) and the file's id. Without a daemon, a file to a chat stays until the contact has all of it (`--wait sent`, the default there; `--timeout`, 300 s, then exit 4 with the `messageId` and the file's id in `details`, and it goes on with your next command; a file over 25 MiB waits for the contact's `file accept` meanwhile); `--wait none` answers at once, as a daemon does by default. To a group (`group:<id>` when a chat has the same name), up to 100 MiB (a larger one is `refused` with `details.reason: "too_large"`, `details.size` and `details.max`; a 1:1 chat takes it): every member sees it at once and each member's app fetches it from a member who has it (WISP 503) |
147
+ | `file wait [<chat>] <file> [--timeout s]` | Wait until a transfer ends: exit `0` when the file is all here, `1` with the transfer's error when it failed (`details.retry`: `file resend` can go on; `details.reason` and `details.by` as the actions' refusals carry them, the code still `engine` until the next minor), `4` on timeout (default 300 s), `5` at once when a received file waits for you to take it (over 25 MiB, or a group's file that did not come by itself): the message names `file accept` |
148
148
  | `forward <chat\|group> <message>… --to <chat\|group>… [--force] [--wait none\|sent] [--timeout s]` | Forward messages to up to 5 chats and groups (`--to` again for each; `group:<id>` names a group when a chat has the same name; an id that starts with a dash is taken as it is, `--to -Ab…` or `--to=-Ab…`). Each is a new message of yours that says it was forwarded (`forwarded`, the hop count) and nothing of who wrote it. Files go from the bytes this profile holds, never fetched again; a group takes texts only. A text that looks like a seed, a key or ecash needs `--force`. Answers `{from, results: [{to, kind, messageIds, error}]}`, a group's with `edges` (how many edges took its copies so far, as for `group send`); any refusal fails the command (exit 1) with the results in `details`. `--wait sent`: each text on its way (a group's taken by an edge), each file's transfer done; without a daemon a group's copies wait for an edge by default (`--wait none` answers at once). A wait that ends short (a timeout, exit 4) has the results in `details` too, next to the copy's `messageId`; a refusal comes first. A text past the 256 bytes the DHT carries, forwarded into a chat on the DHT only, waits for a live transport as `send`'s does: that chat's result says so in a `note`, and a `--wait sent` timeout says the same, also as `details.note` |
149
149
  | `group auto [on\|off] [--from <chat>]…` | Accept group invitations by themselves, only those over the chats named (their id, their contact's key or a label given here; `on` needs at least one, and names them all: a new `on` replaces the list): the daemon accepts them at once, and on start those that came while it was down; any other waits for `group accept`. Kept in the profile's `groups.json` with each chat's contact key: a removed chat, or one whose contact's key changed, leaves the list. When the 32 waiting invitations are full, one over a chat on the list takes the place of the oldest waiting from the chat that holds the most (its inviter is told no). An invitation over a chat on the list kept beside another contact's under the same group id (`others`) is the one taken, the other told no, while the group held is only an invitation not answered yet; beside a group joined or accepted it waits for you (a line in the log). With no argument, prints `{autoJoin: {on, from}}`; `group list` carries it too. Each accept is a line in the daemon's log |
150
150
  | `group call <group> --sfu <https origin> [--e2ee \| --no-e2ee] \| --e2ee \| --no-e2ee \| --clear` | A community's admin names the node its calls go through (WISP 602), signed beside the name and picture, or `--clear` turns its calls off. `--e2ee` asks for sealed call media (§ End-to-end encryption), `--no-e2ee` turns it off, with `--sfu` or alone for the node already named; left out, the group keeps what it had. An https origin only, at most 200 characters, in one spelling (`https://call.example.com`: no path, query, trailing `/`, capitals or default port `:443`); anything else is refused before it is signed, with the origin to use when there is one, or the limit when the origin is longer. A member who is not the admin, one out of the group (removed, or left: with that reason), or a private group, is `refused`. Answers the group as `group show` does, whose `call` is `{sfu, e2ee}` or null |
151
- | `group create <name> [--mesh] [--force]`, `group join [<link> \| -]` | A community (a link anyone can open), or a private mesh. `group join` reads the link from stdin when none is given or `-` (on the command line it shows in `ps` and the shell's history, and the CLI warns). `group join` with the link of a community the profile was removed from asks to be let in again, and keeps its history. It answers `{group, joined, stage}`: without a daemon after waiting up to 60 s to be let in, through one at once (the daemon goes on knocking) |
151
+ | `group create <name> [--mesh] [--force]`, `group join [<link> \| -]` | A community (anyone who has its link can join), or a private mesh. `group join` reads the link from stdin when none is given or `-` (on the command line it shows in `ps` and the shell's history, and the CLI warns). `group join` with the link of a community the profile was removed from asks to be let in again, and keeps its history. It answers `{group, joined, stage}`: without a daemon after waiting up to 60 s to be let in, through one at once (the daemon goes on knocking), with a `warning` naming the `group show` that follows it while not in yet. Until then `group show` says `status: "invited"` with `invitation.viaLink: true` and `chat: null` (no chat brought it), and `invitation.note` that it knocks at the link and that `group decline` stops it |
152
152
  | `group edit <group> <message> [text… \| --text <text> \| --stdin] [--mention <member>]… [--force]` | Replace the text of a message you sent to the group (`<message>` is the `messageId` `group send` gave). Every member sees it in place, marked edited; mentions whose `@name` is still in the text stay, `--mention` adds more. Answers `{group, messageId, edits, sent, edges}`: `edges` and `sent` as for `group send` (`sent: false` while no edge took this edit, also while it waits for the pace); `--wait sent` and `--timeout` as for `group send`. The text the message already has is no edit: `sent: false, unchanged: true`. A profile that is not a member any more (removed from the group) gets `refused`, with the reason, as does `message delete <group> <message> --everyone`. A private group's members whose edge is down get it when it opens, a community's with the catch-up; a member on an older app keeps the old text |
153
- | `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) |
153
+ | `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). A private group only: a community chooses its hubs by itself, and is `refused` |
154
154
  | `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). While the group's link is on, a member removed can join again with it: `group remove` says so on stderr, and `group link <group> --reset` keeps them out. `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; `group admin` (and `group hub --pin`) names its member by its key or a prefix of it, never only by the name the member gave itself |
155
155
  | `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}}`; with nobody else online it is refused until a member is, or until `group admin <group> <member key>` made one the admin. A group you are not in yet (an invitation, or a knock at its link) is left with `group decline` |
156
156
  | `group list [--show-secret]`, `group show <group> [--show-secret]`, `group history <group>` | Groups (and `autoJoin`, as `group auto` prints it), members, history; a message names its author (`member` key, `nick` from the roster, or the name an author no longer in it had). A payment note's line (`gpay:<id>`) carries `groupPay`: `{id, kind, from, to, by, claims, amount, decimals, unit, rail, state, test}` (member keys as `group show` prints them, `from` `*` for a request to the whole group; `state` `open`, `sent`, `paid` or `closed`; `by` null when nobody can tell who paid), and the payment's own line on this profile (the request you made, a request that came to you) says `twinOf: "gpay:<id>"`: the same payment, which the app draws once The entry link prints as `<hidden>` without `--show-secret`. `lastMessageAt` is null until the group's first message. `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>"}' --yes` takes another, leaving the one shown and deleting its history on this device |
157
157
  | `group react <group> <message> <emoji> [--remove] [--wait none\|sent] [--timeout s]` | React to a group's message. An `<emoji>` that is not one emoji is a usage error (exit 2), as for `react`. `refused` when the profile is not a member any more. `edges`: how many took it (`sent`: whether one did). Without a daemon it waits by default until an edge took it (`--wait sent`, up to `--timeout`, 30 s): a timeout (exit 4) says it is kept and goes with the next command that opens the group |
158
158
  | `group rename <group> <name> [--force]` | A new name, for the admin (up to 64 characters, cleaned and counted as a chat's name is; 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 |
159
- | `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 |
159
+ | `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, and anyone who has it can join; a community's member asking for a link the admin turned off is `refused`, told only the admin can make a new one); the picture |
160
160
  | `group send <group> [text…] [--mention <member>]… [--reply <message>] [--button id:Label]… [--style id=primary\|neutral\|danger]… [--once] [--id id] [--wait none\|sent] [--timeout s]` | Send; each mentioned member is written as `@name` in the text. `--button` puts buttons under it, as `send --button`. Answers `{group, messageId, sent, edges}`: the id `--reply`, `group react` and `group edit` take, how many edges took it so far, and `sent`, true once one did. A profile that is not a member any more (removed from the group) gets `refused`, with the reason, and nothing is sent. A group has no receipts: `--wait sent` waits until at least one edge took it (a member's in a private group, one of your hubs' in a community), and exits 4 after `--timeout` (default 30 s) if none did; the message still goes when an edge opens, while the profile is online. Use it for a one-shot send with no daemon. In a private group with nobody else in it (they all left, or nobody accepted yet), nobody gets the message, not even someone who joins later: the answer comes at once with `sent: false` and a `note` saying so. A profile removed while it was away learns it only once it is back: a wait that learns it ends at once as `refused` (exit 1) with the reason and the `messageId`, since nothing goes any more |
161
161
  | `group typing <group> [--kind typing\|recording\|thinking] [--status "<text>"] [--for s] [--stop]` | `typing` in a private group: the members whose edge is open see "Ana is typing…" (or recording, thinking, or your status line), with the same rules, 6 s hold and `--for` (a one-shot without `--for` reaches nobody and says so in a `note`). Answers `{group, typing, kind, status, reached, sendTyping}` (`reached`: members with an open edge). A community does not carry typing yet (exit 1, `unavailable`) |
162
162
  | `identity add <provider> [subject] [--signer id] [--field name=value]… [--stdin] [--days n] [--timeout s]` | A proof: an in-app signer (NIP-46 and the like) finishes here; a tool or a published record answers with the statement; `--timeout` is how long it waits for an approval (300 s, up to 3600; a NIP-46 signer waits as long), and one that does not come is `timeout` (exit 4); once the signer approved, a refusal of the proof keeps its own words and code, even when the check ends past it. Pubky waits at most 300 s, as long as its relay keeps the request: a longer `--timeout` is refused. With `--stdin`, fields come as `name=value` lines on stdin, out of `ps` and the shell's history; a `--field` the signer marks secret (a NIP-46 `bunker://` link) is warned about |
@@ -182,7 +182,7 @@ The rows are in alphabetical order of their first command, and every command of
182
182
  | `send <chat> [text…] [--reply <message>] [--button id:Label]… [--style id=primary\|neutral\|danger]… [--once] [--id id] [--stdin] [--force] [--wait none\|sent\|delivered] [--timeout s]` | Send text (arguments, or stdin); `--reply` quotes a message of the chat. `--button yes:Yes` (1 to 6; the id ends at the first colon; no two labels alike ignoring case and spaces, and no label that is another button's id, else exit 2) puts buttons under the text, which is the question and what older apps show, so say how to answer in words. `--once`: one answer a person. A question that goes on the DHT floor or into a hold (the contact's app closed) reaches them as text alone; the engine sends its buttons again once the chat is live, as an edit of the buttons alone (no `message.edited` for it). The answer adds `buttons` (the question's id, `ask-…` unless `--id`), `card`, and `pressable`: whether the contact's app shows buttons (null until it says). A press comes back as `button.pressed` ([Events](#events)). A text past the 256 bytes the DHT carries, in a chat on the DHT only, waits for a live transport: the answer says so at once in a `note`, and with `--wait sent\|delivered` its timeout (exit 4) says the same, also as `details.note`, as do the wait's notice on a terminal and its Ctrl-C line |
183
183
  | `service add <name> <http://127.0.0.1:port>`, `service share <service> <chat> [--off]`, `service list`, `service remove\|enable` | Share a web app on this machine, per contact. `service share` 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, and is `refused` past the 13 apps one contact can see. On the socket, `service.share` and `service.enable` take `off: true`, or the answer's own `shared` / `enabled` key (refused beside an `off` that says the opposite). `service add` answers the new one as `service` (the id the others take); its old key `serviceId` stays beside it for one release |
184
184
  | `service peer <chat>`, `service open <chat> <service> [--port p]`, `service close <chat> <service>` | A contact's app on a loopback port here (daemon). `url` is a link for your browser, `http://<random>.localhost:<port>/.ghostly-open/<token>`: it sets the service's cookie and shows the app on a host name of its own; any other host name, or a request without that cookie, gets 404. Chrome, Edge and curl reach `*.localhost` names by themselves; Safari and Node's `fetch` on macOS may not (add the name to `/etc/hosts` for them). With Hide my IP from contacts on, `service open` fails with `unavailable`: a browser tab cannot keep the app's page off WebRTC |
185
- | `settings get [--show-secret]`, `settings set <key> <json> [--force]` | Relays, Iroh relays, the HyperDHT relay, ICE servers, `sendTyping` (false: contacts are never told you type), `daemonPresence` (true: while a daemon runs the profile, contacts see it online, WISP 401 § Presence and status; off by default, so a bot is never shown online unless you turn it on), … `settings get` shows every key `settings set` takes with its value in effect (one never set as its default: `sendTyping: true`, the default Iroh relays). `<json>` as `-`, or none on a pipe, is read from stdin: a TURN password stays out of `ps` |
185
+ | `settings get [--show-secret]`, `settings set <key> <json> [--force]` | Relays, Iroh relays, the HyperDHT relay (kept for the apps: the CLI runs HyperDHT itself and dials through the relay only with Hide my IP from contacts, not settable yet, and the answer says so on stderr), ICE servers, `sendTyping` (false: contacts are never told you type), `daemonPresence` (true: while a daemon runs the profile, contacts see it online, WISP 401 § Presence and status; off by default, so a bot is never shown online unless you turn it on), … `settings get` shows every key `settings set` takes with its value in effect (one never set as its default: `sendTyping: true`, the default Iroh relays). `<json>` as `-`, or none on a pipe, is read from stdin: a TURN password stays out of `ps` |
186
186
  | `status` | The profile, its chats, whether WebRTC and calls run, the last event seq |
187
187
  | `status set [text…] [--emoji <emoji>] [--availability available\|busy\|away\|dnd] [--until <time>] [--force]`, `status show`, `status clear` | The status your paired contacts see (WISP 401 § Presence and status): a text of up to 60 characters on one line (no links or markup), one emoji, an availability (`dnd` is Do not disturb) and when it ends by itself: `--until 30m`, `2h` or `1d` from now, or milliseconds or a date within a year, written as `routine send --next` takes it. A new `set` replaces the whole status. A text too long or with a link, a word that is not one emoji, or a time already past is a usage error (exit 2) that names it, before the profile opens. The socket's `status.set` takes `until` in milliseconds and holds it to the same year (`bad_request`). All three answer `{"status": {"text", "emoji", "availability", "until"}}` (a field not set is null) or `{"status": null}` when there is none. A daemon tells every contact whose app offers `status/1` at once; without one the status is kept here and said on each chat's next live session. Plain `status` is unchanged. These commands never say presence (online or idle): only a daemon does, and only with `settings set daemonPresence true`; a profile restored from an app with "Share when I'm online" off (`sharePresence: false`, not a key `settings set` takes) says none even then |
188
188
  | `store sign <index> --key <file> [--out <dir>]` | Sign a store index (WISP 1200 · Stores) with the store key file (kept offline; made when missing, the index names no `key` and no signed index is in the output folder): writes `ghostly-store.json`, canonical, and `ghostly-store.sig` beside the index or in `--out`. Refused, with the reason, when a client would refuse the index (`expires` more than 90 days ahead, a bad field), or when the index already there has a higher `sequence` (`rollback`), the same one with other content (`equivocation`), or is signed by another key (`store-key`: another store is another `--out`), or when a `ghostly-store.json` or `ghostly-store.sig` there does not read as a signed index (move them away, or name another `--out`), or when `--key` is inside the output folder, which is published (`private-key`: keep the store key outside it, and outside its repository) |
@@ -614,6 +614,7 @@ busy bot two relays or more.
614
614
  (calls are voice only).
615
615
  - **A single binary**: the CLI needs Node.
616
616
  - Link previews made by the sender, and holding messages for an away contact.
617
+ - **Search** in a chat or the chat list: `ghostly chat history <chat> --limit n` and `jq` find a message meanwhile.
617
618
 
618
619
  ## Tests
619
620
 
@@ -1,3 +1,3 @@
1
- import { R as startNamedChats, l as findGroup, s as findChat } from "./apiKit-CPTFJHA7.js";
2
- import { a as hideStateSecrets, c as refuseBeforeStart, i as groupSendRefused, l as settingsInEffect, m as identityProvider, n as SETTABLE, o as mentionsFor, r as callApi, s as redactSettings, t as API_METHODS } from "./api-O57SNJcb.js";
1
+ import { l as findGroup, s as findChat, z as startNamedChats } from "./apiKit-DAFsWtyk.js";
2
+ import { a as hideStateSecrets, c as refuseBeforeStart, i as groupSendRefused, l as settingsInEffect, m as identityProvider, n as SETTABLE, o as mentionsFor, r as callApi, s as redactSettings, t as API_METHODS } from "./api-Dz2cw7WD.js";
3
3
  export { API_METHODS, SETTABLE, callApi, findChat, findGroup, groupSendRefused, hideStateSecrets, identityProvider, mentionsFor, redactSettings, refuseBeforeStart, settingsInEffect, startNamedChats };
@@ -1,24 +1,24 @@
1
- import { $a as readImageMeta, Ai as GhostlyHttpError, An as baseMime, Dn as PLAYABLE_AUDIO, Dt as TYPING_KINDS, Ea as isAppUrl, En as sanitizeMime, Er as checkStatusCard, Fi as LIMITS, Fn as voiceLevel, Mr as MESSAGE_CLOCK_SKEW_MS, Ni as parseLocalTarget, Nn as parseVoiceMeta, O as GROUP_FILE_LIMITS, On as VOICE_LIMITS, Ot as TYPING_REFRESH_MS, Pa as appRef, Pn as voiceDownloadName, Pr as claimedTime, Si as AWAITING_PEER_MS, Tn as sanitizeFileName, Va as isAppRef, br as appCardId, cr as replySnippet, do as ownInviteRefusal, ji as VIEWER_PERMISSIONS_POLICY, jn as downsamplePeaks, jt as sanitizeTypingStatus, kn as VOICE_METER, kr as statusCardBytes, lo as inviteLink, n as groupCallSfu, nn as APP_DATA_MAX_BYTES, vr as STATUS_CARD_LIMITS, wr as cardLine, xr as appCardUrl } from "./groupMeta-CeZpqVVC.js";
2
- import { G as removeStored, J as waitingGroupFile, P as paymentNetwork, Pt as decodeCommunityLink, T as replyRef, Y as IDENTITY_DRAFT_TTL_MS, an as withoutAudioMetadata, b as groupOfFile, cn as NO_PICTURE_METADATA, d as groupPayLineId, f as groupPayNoteId, l as normalizeMintUrl, ln as stripPictureMetadata, p as groupPayTwin, sn as withoutVideoMetadata, t as DEFAULT_IROH_RELAYS, u as groupMemberOfLink, un as withoutPictureMetadata, v as groupFileId, vt as iceServerProblem, yt as iceServerSetting, zt as decodeGroupEntryLink } from "./irohWeb-mnOi2Jp7.js";
1
+ import { $a as readImageMeta, Ai as GhostlyHttpError, An as baseMime, Dn as PLAYABLE_AUDIO, Dt as TYPING_KINDS, Ea as isAppUrl, En as sanitizeMime, Er as checkStatusCard, Fi as LIMITS, Fn as voiceLevel, Mr as MESSAGE_CLOCK_SKEW_MS, Ni as parseLocalTarget, Nn as parseVoiceMeta, O as GROUP_FILE_LIMITS, On as VOICE_LIMITS, Ot as TYPING_REFRESH_MS, Pa as appRef, Pn as voiceDownloadName, Pr as claimedTime, Si as AWAITING_PEER_MS, Tn as sanitizeFileName, Va as isAppRef, br as appCardId, cr as replySnippet, do as ownInviteRefusal, ji as VIEWER_PERMISSIONS_POLICY, jn as downsamplePeaks, jt as sanitizeTypingStatus, kn as VOICE_METER, kr as statusCardBytes, lo as inviteLink, n as groupCallSfu, nn as APP_DATA_MAX_BYTES, vr as STATUS_CARD_LIMITS, wr as cardLine, xr as appCardUrl } from "./groupMeta-Cz95F6sX.js";
2
+ import { G as removeStored, J as waitingGroupFile, P as paymentNetwork, Pt as decodeCommunityLink, T as replyRef, Y as IDENTITY_DRAFT_TTL_MS, an as withoutAudioMetadata, b as groupOfFile, cn as NO_PICTURE_METADATA, d as groupPayLineId, f as groupPayNoteId, l as normalizeMintUrl, ln as stripPictureMetadata, p as groupPayTwin, sn as withoutVideoMetadata, t as DEFAULT_IROH_RELAYS, u as groupMemberOfLink, un as withoutPictureMetadata, v as groupFileId, vt as iceServerProblem, yt as iceServerSetting, zt as decodeGroupEntryLink } from "./irohWeb-BLDcHwYz.js";
3
3
  import { c as normalizeRelayUrl, l as relayUrlProblem } from "./relay-gJTOYQJZ.js";
4
4
  import { n as secretWords, r as findSecret, t as guardText } from "./secretGuard-oz_3hBfW.js";
5
- import { a as PAY_METHODS, d as ENGINE_METHODS, f as ENGINE_PARAMS, g as engineParamsProblem, i as CHAT_METHODS, l as withStoredIds, m as READ_PARAMS, n as statusJson, o as TRANSPORT_NAMES, p as ENGINE_READS, r as ADDRESS_TYPES, s as WALLET_TYPES, t as checkOwnStatus, u as DESTRUCTIVE_CALLS } from "./ownStatus-CLA1VPkL.js";
5
+ import { a as PAY_METHODS, d as ENGINE_METHODS, f as ENGINE_PARAMS, g as engineParamsProblem, i as CHAT_METHODS, l as withStoredIds, m as READ_PARAMS, n as statusJson, o as TRANSPORT_NAMES, p as ENGINE_READS, r as ADDRESS_TYPES, s as WALLET_TYPES, t as checkOwnStatus, u as DESTRUCTIVE_CALLS } from "./ownStatus-DjD0sQKF.js";
6
6
  import { i as localFileError, o as shownValue, r as asCliError, t as CliError } from "./errors-JVJsO8Iu.js";
7
- import { A as oneOf, B as str, C as noMessage, D as notInYet, E as node, F as shownName, H as waitForState, I as sinceSeq, L as somebodyJoined, M as ownChatOf, N as sentAt, O as notInYetError, P as settingsOf, S as noFile, U as shellWord, V as transportOffered, _ as keptForJoin, a as contactKeyOf, b as nameKey, c as findChatOrGroup, d as groupById, f as groupCalled, g as inviteTaken, h as groupPrefixed, j as oneShotWaits, k as num, l as findGroup, m as groupOf, n as chatOf, o as dhtOnly, p as groupNameOf, r as chatOrGroup, s as findChat, t as bool, v as list, w as nobodyJoined, y as messageOf, z as state } from "./apiKit-CPTFJHA7.js";
7
+ import { A as oneOf, B as state, C as noMessage, D as notInYet, E as node, F as sharedGroupIds, H as transportOffered, I as shownName, L as sinceSeq, M as ownChatOf, N as sentAt, O as notInYetError, P as settingsOf, R as somebodyJoined, S as noFile, U as waitForState, V as str, W as shellWord, _ as keptForJoin, a as contactKeyOf, b as nameKey, c as findChatOrGroup, d as groupById, f as groupCalled, g as inviteTaken, h as groupPrefixed, j as oneShotWaits, k as num, l as findGroup, m as groupOf, n as chatOf, o as dhtOnly, p as groupNameOf, r as chatOrGroup, s as findChat, t as bool, v as list, w as nobodyJoined, y as messageOf } from "./apiKit-DAFsWtyk.js";
8
8
  import { l as toBase64Url, s as randomBytes$1 } from "./bytes-C1DNGY18.js";
9
9
  import { f as FILE_BYTES_STEP, o as fileBytes, s as fileBytesOf } from "./fileBytes-CfvUXdSy.js";
10
10
  import { p as fileStore } from "./idb-ewvbqyDI.js";
11
11
  import { t as childEnv } from "./childEnv-C-99hdbL.js";
12
- import { a as checkTextSize$1, c as goesOn, d as purgeMessage, f as waitForConfirmed, g as waitForRemoval, h as waitForMessage, i as pressable, l as nobodyElseIn, m as waitForGroupFrame, n as buttonsCard, o as ended, p as waitForEdit, s as foldsAnyway, t as BUTTON_METHODS, u as outOf } from "./buttons-D4udKEvT.js";
13
- import { a as checkShownName } from "./profiles-BH1bH9aE.js";
12
+ import { a as checkTextSize$1, c as goesOn, d as purgeMessage, f as waitForConfirmed, g as waitForRemoval, h as waitForMessage, i as pressable, l as nobodyElseIn, m as waitForGroupFrame, n as buttonsCard, o as ended, p as waitForEdit, s as foldsAnyway, t as BUTTON_METHODS, u as outOf } from "./buttons-BKojbx0Q.js";
13
+ import { a as checkShownName } from "./profiles-BAJf0c9E.js";
14
14
  import { o as MAX_AVATAR_LENGTH, s as sanitizeAvatar } from "./linkPreview-5kHmKUTN.js";
15
- import { m as identityStatement } from "./identityProofs-B8zCp5_0.js";
16
- import { a as SignerTimeout, i as parseProofBunker, t as IDENTITY_PROVIDERS } from "./registry-DP_-RA-v.js";
17
- import { t as BACKUP_METHODS } from "./backup-CxH3auHB.js";
18
- import { s as isAppFetchUrl } from "./appFetch-Ca9DNQQ2.js";
19
- import { o as checkedBundle } from "./apps-gXpGFPiv.js";
15
+ import { m as identityStatement } from "./identityProofs-zI_Iy9uI.js";
16
+ import { a as SignerTimeout, i as parseProofBunker, t as IDENTITY_PROVIDERS } from "./registry-CPuexTle.js";
17
+ import { t as BACKUP_METHODS } from "./backup-CNLY905d.js";
18
+ import { s as isAppFetchUrl } from "./appFetch-BQO5Pk7W.js";
19
+ import { o as checkedBundle } from "./apps-B88rYWRm.js";
20
20
  import { m as parsePaymentAmount } from "./paymentIntent-Cr3uZa_0.js";
21
- import { a as heldWords, n as dhtOnlyNote, t as chatState } from "./waitNotice-BHuMofaH.js";
21
+ import { a as heldWords, n as dhtOnlyNote, t as chatState } from "./waitNotice-mB0Ym145.js";
22
22
  import { generateMnemonic } from "@scure/bip39";
23
23
  import { wordlist } from "@scure/bip39/wordlists/english.js";
24
24
  import { execFile, spawn } from "node:child_process";
@@ -937,7 +937,11 @@ async function stageWhileAsked(bytes, id, path, source, gone) {
937
937
  * the announcement. This device is its first holder and serves the members who ask.
938
938
  */
939
939
  async function sendToGroup(ctx, params, group, path, name, picked, gone) {
940
- if (picked > GROUP_FILE_LIMITS.maxBytes) throw new CliError("refused", `Too large for a group (at most ${GROUP_FILE_LIMITS.maxBytes} bytes)`);
940
+ if (picked > GROUP_FILE_LIMITS.maxBytes) throw new CliError("refused", `Too large for a group: ${name} is ${megabytes(picked)}, a group takes up to ${GROUP_FILE_LIMITS.maxBytes / 1048576} MiB (send it in a 1:1 chat)`, {
941
+ reason: "too_large",
942
+ size: picked,
943
+ max: GROUP_FILE_LIMITS.maxBytes
944
+ });
941
945
  if (!picked) throw new CliError("refused", "An empty file cannot go to a group");
942
946
  const mime = mimeOf(path, str(params, "mime"), params.voice !== void 0);
943
947
  const replyTo = str(params, "reply");
@@ -1015,14 +1019,15 @@ var NAME_BYTES = 255;
1015
1019
  /**
1016
1020
  * `name` as an entry of a folder: an app's name may have 200 characters, which in UTF-8 can be 800 bytes. The end of
1017
1021
  * its stem goes until it fits, its extension stays (as `sanitizeFileName` shortens it), so "文…文.txt" is saved as a text.
1022
+ * A `mark` (" (2)") goes between them and is kept too.
1018
1023
  */
1019
- function fitName(name) {
1024
+ function fitName(name, mark = "") {
1020
1025
  const fits = (candidate) => Buffer.byteLength(candidate) <= NAME_BYTES;
1021
- if (fits(name)) return name;
1026
+ if (!mark && fits(name)) return name;
1022
1027
  const extension = /\.[^.\s]{1,15}$/u.exec(name)?.[0] ?? "";
1023
1028
  const stem = [...name.slice(0, name.length - extension.length)];
1024
- while (stem.length && !fits(stem.join("").trimEnd() + extension)) stem.pop();
1025
- return (stem.join("").trimEnd() || "file") + extension;
1029
+ while (stem.length && !fits(stem.join("").trimEnd() + mark + extension)) stem.pop();
1030
+ return (stem.join("").trimEnd() || "file") + mark + extension;
1026
1031
  }
1027
1032
  /**
1028
1033
  * The name `file save --dir` writes a file under. Its sender chose it, and the folder is one scripts and people run
@@ -1082,6 +1087,48 @@ var ACTIONS = [
1082
1087
  "request"
1083
1088
  ];
1084
1089
  /**
1090
+ * Who ended a transfer, and how, from the engine's words for it (core's `chatFiles.ts`): its view says only `failed`,
1091
+ * and a script could not tell "the contact said no" from "I already did it" without reading the English.
1092
+ */
1093
+ var ENDS = {
1094
+ "You cancelled it": {
1095
+ reason: "cancelled",
1096
+ by: "me"
1097
+ },
1098
+ "You declined it": {
1099
+ reason: "declined",
1100
+ by: "me"
1101
+ },
1102
+ "Cancelled by your contact": {
1103
+ reason: "cancelled",
1104
+ by: "contact"
1105
+ },
1106
+ "Declined by your contact": {
1107
+ reason: "declined",
1108
+ by: "contact"
1109
+ },
1110
+ "Cancelled by the sender": {
1111
+ reason: "cancelled",
1112
+ by: "contact"
1113
+ }
1114
+ };
1115
+ var endOf = (transfer) => ENDS[transfer.error ?? ""] ?? {
1116
+ reason: "failed",
1117
+ by: null
1118
+ };
1119
+ /**
1120
+ * A transfer that ended, refused with its words and the way out: the sender still has the bytes and sends them again
1121
+ * (`file resend` goes on from what the contact holds, while it may); the receiver asks the contact for them.
1122
+ */
1123
+ function endedFile(fileId, where, transfer, outgoing) {
1124
+ const way = where && "chat" in where ? outgoing ? transfer.retry ? " (file resend sends it again)" : ` (send it again: ghostly file send ${where.chat} <path>)` : " (ask the contact to send it again)" : "";
1125
+ return new CliError("refused", `It ended: ${transfer.error ?? "failed"}${way}`, {
1126
+ file: fileId,
1127
+ ...where,
1128
+ ...endOf(transfer)
1129
+ });
1130
+ }
1131
+ /**
1085
1132
  * `file wait`: until a transfer ends: done answers, failed is an `engine` error with the transfer's words (and whether
1086
1133
  * `file resend` can go on). A file whose transfer this run has not seen answers from the file store. `stopping`: the
1087
1134
  * daemon's stop ends it as well (`waitForState`), for `file send --wait`, which answers with what it knows then.
@@ -1112,7 +1159,8 @@ async function waitForFile(ctx, params, stopping) {
1112
1159
  if (transfer.state === "failed") throw new CliError("engine", transfer.error ?? "The transfer failed", {
1113
1160
  file: fileId,
1114
1161
  ...where,
1115
- retry: !!transfer.retry
1162
+ retry: !!transfer.retry,
1163
+ ...endOf(transfer)
1116
1164
  });
1117
1165
  if (transfer.state !== "done") throw waitsForYou((stored ?? await fileStore.get(fileId).catch(() => void 0))?.metadata?.name, fileId, where, transfer.size);
1118
1166
  return {
@@ -1314,14 +1362,22 @@ var FILE_METHODS = {
1314
1362
  if (outgoing !== (action === "resend")) throw new CliError("bad_request", outgoing ? "A file sent from here is sent again: file resend" : "A received file is asked for again: file request");
1315
1363
  const transfer = state(ctx).transfers[fileId];
1316
1364
  if (!transfer || transfer.state === "done") throw new CliError("refused", outgoing ? "Nothing to send again: it arrived whole" : "Nothing to ask for: the file is all here");
1317
- if (transfer.state === "failed" && (!outgoing || !transfer.retry)) throw new CliError("refused", `It ended: ${transfer.error ?? "failed"}`);
1365
+ if (transfer.state === "failed" && (!outgoing || !transfer.retry)) throw endedFile(fileId, where, transfer, outgoing);
1318
1366
  } else {
1319
1367
  const outgoing = fileId.startsWith(`${linkId}-out-`);
1320
1368
  if (outgoing && (action === "accept" || action === "decline")) throw new CliError("bad_request", "A file sent from here is not accepted or declined: file cancel stops it");
1321
1369
  await refuseAllHere();
1322
1370
  const transfer = state(ctx).transfers[fileId] ?? (await fileStore.get(fileId).catch(() => void 0))?.transfer;
1323
1371
  if (action === "pause" && transfer?.stage === "verifying") throw new CliError("refused", "Too late to pause: it is being checked");
1324
- if (transfer?.state === "failed") throw new CliError("refused", `It ended: ${transfer.error ?? "failed"}${outgoing && transfer.retry ? " (file resend sends it again)" : ""}`);
1372
+ if (transfer?.state === "failed") {
1373
+ if ((action === "cancel" || action === "decline") && endOf(transfer).by === "me") return {
1374
+ ...where,
1375
+ file: fileId,
1376
+ action,
1377
+ transfer: state(ctx).transfers[fileId] ?? transfer
1378
+ };
1379
+ throw endedFile(fileId, where, transfer, outgoing);
1380
+ }
1325
1381
  const whole = outgoing && transfer?.state === "transferring" && (transfer.stage === "verifying" || transfer.size > 0 && transfer.transferred >= transfer.size && transfer.stage !== "asking" && transfer.stage !== "queued" && transfer.stage !== "paused");
1326
1382
  if (whole && action === "cancel") throw new CliError("refused", "Too late to cancel: it arrived whole, and the contact keeps it");
1327
1383
  if (whole && action === "pause") throw new CliError("refused", "Too late to pause: it arrived whole, and the contact keeps it");
@@ -1369,7 +1425,7 @@ var FILE_METHODS = {
1369
1425
  if (!stored?.metadata) throw noFile(fileId);
1370
1426
  if (stored.leftOut) throw new CliError("not_found", "Not in this backup: the light backup this profile was restored from left the file out");
1371
1427
  const transfer = stored.direction === "out" ? void 0 : state(ctx).transfers[fileId] ?? waitingGroupFile(stored) ?? stored.transfer;
1372
- if (transfer?.state === "failed") throw new CliError("refused", `It ended: ${transfer.error ?? "failed"}`);
1428
+ if (transfer?.state === "failed") throw endedFile(fileId, stored.linkId.startsWith("group:") ? { group: stored.linkId.slice(6) } : { chat: stored.linkId }, transfer, false);
1373
1429
  if (transfer?.state === "transferring" && transfer.stage === "asking" && transfer.direction === "in") {
1374
1430
  let where;
1375
1431
  try {
@@ -1388,6 +1444,10 @@ var FILE_METHODS = {
1388
1444
  }
1389
1445
  const free = !force && !str(params, "path") && !!stored.metadata.voice;
1390
1446
  const ext = extname(named), stem = named.slice(0, named.length - ext.length);
1447
+ const numbered = (n) => {
1448
+ const plain = `${stem} (${n})${ext}`;
1449
+ return Buffer.byteLength(basename(plain)) <= NAME_BYTES ? plain : join(dirname(named), fitName(basename(named), ` (${n})`));
1450
+ };
1391
1451
  let next = 2;
1392
1452
  const taken = async (target, code) => {
1393
1453
  const there = await stat(target).catch(() => void 0);
@@ -1398,14 +1458,14 @@ var FILE_METHODS = {
1398
1458
  if (path) return new CliError("confirm", replace);
1399
1459
  if (free && next <= 1e3) return new CliError("confirm", replace);
1400
1460
  let n = 2;
1401
- while (n <= 1e3 && await stat(`${stem} (${n})${ext}`).catch(() => void 0)) n += 1;
1402
- const other = `${stem} (${n})${ext}`;
1461
+ while (n <= 1e3 && await stat(numbered(n)).catch(() => void 0)) n += 1;
1462
+ const other = numbered(n);
1403
1463
  return new CliError("confirm", `${replace}, or --path ${shellWord(other, "<the one in details.path>")} (path over the socket) to keep both`, { path: other });
1404
1464
  };
1405
1465
  let target = named;
1406
1466
  for (let refused = await taken(target); refused; refused = await taken(target)) {
1407
1467
  if (!free || refused.code !== "confirm" || next > 1e3) throw refused;
1408
- target = `${stem} (${next})${ext}`;
1468
+ target = numbered(next);
1409
1469
  next += 1;
1410
1470
  }
1411
1471
  const partial = join(dirname(target), `.ghostly-save-${process.pid}-${toBase64Url(randomBytes$1(6))}.partial`);
@@ -1454,7 +1514,7 @@ var FILE_METHODS = {
1454
1514
  const code = error.code;
1455
1515
  const refused = code === "EEXIST" || code === "EISDIR" || code === "ENOTEMPTY" ? await taken(target, code) : void 0;
1456
1516
  if (free && refused?.code === "confirm" && next <= 1e3) {
1457
- target = `${stem} (${next})${ext}`;
1517
+ target = numbered(next);
1458
1518
  next += 1;
1459
1519
  continue;
1460
1520
  }
@@ -2368,6 +2428,15 @@ function groupPayTwins(messages, notes, payments, group) {
2368
2428
  return twins;
2369
2429
  }
2370
2430
  /**
2431
+ * A link join reads `status: "invited"` though nobody invited it: its `note` says that it knocks at the link and how to
2432
+ * stop it. Nothing for anything else.
2433
+ */
2434
+ function knockNote(group) {
2435
+ if (group.status || !group.invitation?.viaLink) return void 0;
2436
+ const id = shellWord(group.id, group.id);
2437
+ return { note: group.invitation.unanswered ? `You opened its link and nobody let you in: ghostly group accept ${id} knocks again, ghostly group decline ${id} drops it` : `You opened its link and knock until a member's app lets you in (stage says how far): ghostly group decline ${id} stops it` };
2438
+ }
2439
+ /**
2371
2440
  * A group as the CLI prints it. The entry link lets anyone who reads it join, so it is `<hidden>` unless asked for
2372
2441
  * (`--show-secret`, or `group link`); null when the group has none.
2373
2442
  */
@@ -2395,10 +2464,11 @@ function groupJson(group, showSecret = false) {
2395
2464
  })),
2396
2465
  ...group.hubs ? { hubs: group.hubs } : {},
2397
2466
  invitation: group.invitation ? {
2398
- chat: group.invitation.linkId,
2467
+ chat: group.invitation.viaLink ? null : group.invitation.linkId,
2399
2468
  accepted: group.invitation.accepted,
2400
2469
  viaLink: !!group.invitation.viaLink,
2401
2470
  stage: group.invitation.stage ?? null,
2471
+ ...knockNote(group),
2402
2472
  ...group.invitation.unanswered ? { unanswered: true } : {},
2403
2473
  ...group.invitation.takenBack ? { takenBack: true } : {}
2404
2474
  } : null,
@@ -2562,6 +2632,7 @@ var GROUP_ADMIN_METHODS = {
2562
2632
  },
2563
2633
  async "group.hub"(ctx, params) {
2564
2634
  const group = joined(ctx, params);
2635
+ if (group.profile === "community") throw new CliError("refused", `${group.name} is a community: it chooses its hubs by itself; group hub is for a private group past 16 members`);
2565
2636
  const role = str(params, "role") ?? "auto";
2566
2637
  if (![
2567
2638
  "pin",
@@ -2603,6 +2674,7 @@ var GROUP_ADMIN_METHODS = {
2603
2674
  link: null
2604
2675
  };
2605
2676
  }
2677
+ if (group.profile === "community" && !group.isAdmin && !group.entryLink && !reset) throw new CliError("refused", "The admin turned the link off: nobody can join with it, and the link shared before will not work again. Only the admin can make a new one.");
2606
2678
  const { link } = await node(ctx).enableGroupLink({
2607
2679
  groupId: group.id,
2608
2680
  ...reset ? { reset: true } : {}
@@ -3574,10 +3646,13 @@ function servedApp(apps, ref) {
3574
3646
  }
3575
3647
  /** A link a contact's app reads a card's bundle from. */
3576
3648
  var readable = (url) => isAppFetchUrl(url) && appCardUrl(url) !== void 0;
3577
- /** Whether this engine offers apps/1 now: it read the list when it started, so the first app served waits for a restart. */
3649
+ /**
3650
+ * Whether this engine offers apps/1 now: it read the list when it started, so the first app served waits for a restart,
3651
+ * and so does the end of the offer once the last one is unserved.
3652
+ */
3578
3653
  var offered = (ctx, apps) => ({
3579
3654
  offered: ctx.runtime.apps,
3580
- ...apps.length > 0 && !ctx.runtime.apps && { restart: true }
3655
+ ...apps.length > 0 !== ctx.runtime.apps && { restart: true }
3581
3656
  });
3582
3657
  var APP_SERVE_METHODS = {
3583
3658
  async "app.serve"(ctx, params) {
@@ -4861,6 +4936,8 @@ var NO_ROOM = {
4861
4936
  var JOIN_STOPS = /* @__PURE__ */ new Set(["replaced", ...Object.keys(NO_ROOM)]);
4862
4937
  /** How long a one-shot `group join` waits to be let in: as long as a one-shot `invite join` waits to pair. */
4863
4938
  var ONE_SHOT_JOIN_S = 60;
4939
+ /** A replaced link never lets it in: the next step is a new link, not a daemon. */
4940
+ var REPLACED = "This link was replaced or turned off: ask someone in the group for the current link, then ghostly group join <link>";
4864
4941
  /**
4865
4942
  * A one-shot `group join` waits to be let in, as a one-shot invite join waits to pair: a member's app lets the joiner
4866
4943
  * in only while its knocks go on, and they stop when the command leaves. It left at once with `{"group": id}` and exit
@@ -4907,10 +4984,23 @@ async function letIn(ctx, groupId, link, held) {
4907
4984
  }
4908
4985
  if (ctx.mode !== "one-shot") {
4909
4986
  const now = seen(state(ctx));
4987
+ const joined = now?.status === "active", stage = now?.invitation?.stage ?? null;
4988
+ if (joined || !now?.invitation?.viaLink) return {
4989
+ group: groupId,
4990
+ joined,
4991
+ stage
4992
+ };
4993
+ if (stage === "replaced") return {
4994
+ group: groupId,
4995
+ joined,
4996
+ stage,
4997
+ warning: REPLACED
4998
+ };
4910
4999
  return {
4911
5000
  group: groupId,
4912
- joined: now?.status === "active",
4913
- stage: now?.invitation?.stage ?? null
5001
+ joined,
5002
+ stage,
5003
+ warning: `Not in yet: the daemon goes on knocking at the group's link until a member's app lets you in: ghostly group show ${id} follows it, ghostly group decline ${id} stops it`
4914
5004
  };
4915
5005
  }
4916
5006
  const done = (g) => !g || g.status === "active" || JOIN_STOPS.has(g.invitation?.stage ?? "");
@@ -4931,7 +5021,7 @@ async function letIn(ctx, groupId, link, held) {
4931
5021
  group: groupId,
4932
5022
  joined,
4933
5023
  stage,
4934
- warning: "This link was replaced or turned off: ask someone in the group for the current link, then ghostly group join <link>"
5024
+ warning: REPLACED
4935
5025
  };
4936
5026
  const show = `keep it running (ghostly daemon --detach), then ghostly group show ${shellWord(groupId, groupId)}`;
4937
5027
  const full = stage === "full" ? group.invitation?.full : void 0;
@@ -5124,9 +5214,10 @@ var METHODS = {
5124
5214
  }
5125
5215
  patch[key] = servers;
5126
5216
  const unused = servers.flatMap((server) => server.urls.split(/[\s,]+/)).filter((url) => /^turns:|\?transport=tcp$/i.test(url));
5127
- if (unused.length) warning = `The CLI reaches TURN over UDP only: it does not use ${unused.join(", ")} (the apps do). Add a turn: server over UDP for the CLI`;
5217
+ if (unused.length) warning = (warning ? `${warning}. ` : "") + `The CLI reaches TURN over UDP only: it does not use ${unused.join(", ")} (the apps do). Add a turn: server over UDP for the CLI`;
5128
5218
  continue;
5129
5219
  }
5220
+ if (key === "hyperdhtRelay" && value) warning = (warning ? `${warning}. ` : "") + "This CLI runs HyperDHT itself and does not dial through hyperdhtRelay: it uses it only with Hide my IP from contacts, which comes in a later release. It is kept for the apps this profile moves to";
5130
5221
  patch[key] = value;
5131
5222
  }
5132
5223
  await node(ctx).updateSettings({ settings: patch }).catch((error) => {
@@ -5675,7 +5766,7 @@ var METHODS = {
5675
5766
  };
5676
5767
  let link;
5677
5768
  try {
5678
- link = notAGroup(ctx, params, () => chatOf(ctx, params), (shown, id) => `ghostly message delete ${groupPrefixed(typed) === null && reachesGroup(typed) ? shown : shellWord(groupPrefixed(typed) === null ? `group:${typed}` : typed, `group:${id}`)} ${ref === "<message>" ? ref : shellWord(ref, "<message>")} --everyone${purge ? " --purge" : ""}`);
5769
+ link = notAGroup(ctx, params, () => chatOf(ctx, params), (shown, id) => `ghostly message delete ${id === void 0 || groupPrefixed(typed) === null && reachesGroup(typed) ? shown : shellWord(groupPrefixed(typed) === null ? `group:${typed}` : typed, `group:${id}`)} ${ref === "<message>" ? ref : shellWord(ref, "<message>")} --everyone${purge ? " --purge" : ""}${byItsId(id)}`);
5679
5770
  } catch (error) {
5680
5771
  const group = error instanceof CliError ? error.details?.group : void 0;
5681
5772
  const theirs = typeof group === "string" && ref !== "<message>" ? await messageOf(ctx, `group:${group}`, ref).catch(() => void 0) : void 0;
@@ -6036,7 +6127,7 @@ var METHODS = {
6036
6127
  if (!bool(params, "yes")) throw new CliError("confirm", "Leaving a group deletes its history and files on this device; pass --yes (yes: true over the socket) to go on");
6037
6128
  const ref = str(params, "group", true);
6038
6129
  const { admin } = await node(ctx).leaveGroup({ groupId: group.id }).catch((error) => {
6039
- throw leaveRefused(group, ref, error);
6130
+ throw leaveRefused(ctx, group, ref, error);
6040
6131
  });
6041
6132
  const next = admin ? group.members.find((m) => m.key === admin) : void 0;
6042
6133
  return {
@@ -6050,7 +6141,9 @@ var METHODS = {
6050
6141
  async "group.forget"(ctx, params) {
6051
6142
  const group = groupOf(ctx, params, "chat remove <chat> --yes");
6052
6143
  if (!bool(params, "yes")) throw new CliError("confirm", "Forgetting a group deletes its history on this device; pass --yes (yes: true over the socket) to go on");
6053
- await node(ctx).forgetGroup({ groupId: group.id });
6144
+ await node(ctx).forgetGroup({ groupId: group.id }).catch((error) => {
6145
+ throw nobodyForLeave(ctx, group, str(params, "group", true), error) ?? error;
6146
+ });
6054
6147
  return { forgotten: group.id };
6055
6148
  },
6056
6149
  async "group.accept"(ctx, params) {
@@ -6268,13 +6361,27 @@ function groupSendRefused(error) {
6268
6361
  }
6269
6362
  /** The engine's admin who may not leave: the app's words say "make someone the admin", which names no command here. */
6270
6363
  var ADMIN_ALONE = "You are the admin and nobody else in the group is online to take over. Try again when a member is, or make someone the admin first.";
6364
+ /** A community's leave (or an admin's forget, which leaves first) with no edge to a member to carry it. */
6365
+ var NOBODY_FOR_LEAVE = "Nobody in the group is connected right now to take your leave. Try again in a moment.";
6366
+ /**
6367
+ * A community's leave nobody was connected to take, said with the CLI's next step: "Try again in a moment" never passed
6368
+ * in a one-shot, which has no edge yet when it runs, and every member is refused alike (`group admin` hands nothing on
6369
+ * here). The code stays the engine's. Undefined for other errors.
6370
+ */
6371
+ function nobodyForLeave(ctx, group, ref, error) {
6372
+ if (!(error instanceof Error) || error.message !== NOBODY_FOR_LEAVE) return void 0;
6373
+ const shown = shellWord(ref, group.id), show = `ghostly group show ${shown} says who is`;
6374
+ return new CliError("engine", ctx.mode === "one-shot" ? `Nobody in ${groupCalled(group)} is connected to take your leave, and a command without a daemon has no connection yet: keep this profile online (ghostly daemon --detach), then ghostly group leave ${shown} --yes once a member is (${show})` : `Nobody in ${groupCalled(group)} is connected to take your leave: try again when a member is online (${show})`);
6375
+ }
6271
6376
  /**
6272
6377
  * `group leave` the engine refused, said with the CLI's next step: an invitation not joined yet answered "Group not
6273
- * found" of a group `group show` lists (its way out is `group decline`), and an admin alone online "make someone the
6274
- * admin", the app's words. The code stays the engine's.
6378
+ * found" of a group `group show` lists (its way out is `group decline`), an admin alone online "make someone the
6379
+ * admin", the app's words, and a community nobody is connected to (`nobodyForLeave`). The code stays the engine's.
6275
6380
  */
6276
- function leaveRefused(group, ref, error) {
6381
+ function leaveRefused(ctx, group, ref, error) {
6277
6382
  if (!(error instanceof Error)) return error;
6383
+ const nobody = nobodyForLeave(ctx, group, ref, error);
6384
+ if (nobody) return nobody;
6278
6385
  const shown = shellWord(ref, group.id);
6279
6386
  if (error.message === ADMIN_ALONE) return new CliError("engine", `You are the admin and nobody else in ${groupCalled(group)} is online to take over: try again when a member is, or make one the admin first (ghostly group admin ${shown} <member key>)`);
6280
6387
  const yet = error.message === "Group not found" ? notInYet(group, ref, true) : void 0;
@@ -6307,13 +6414,14 @@ function joinRefused(link, error) {
6307
6414
  * never has the group.
6308
6415
  */
6309
6416
  function chatNotGroupLink(ctx, params) {
6310
- return notAGroup(ctx, params, () => chatOf(ctx, params), (shown) => `it connects through its members' chats, with no transport of its own (ghostly group show ${shown})`);
6417
+ return notAGroup(ctx, params, () => chatOf(ctx, params), (shown, id) => `it connects through its members' chats, with no transport of its own (${id === void 0 ? "ghostly group list" : `ghostly group show ${shown}`})`);
6311
6418
  }
6312
6419
  /**
6313
6420
  * A chat command given a group's id, prefix or name: `not_found` that says it is a group, with `hint`: the group
6314
6421
  * command that takes it (`react` on a group, where `group react` is meant), or what to do where none does. `group:<id>`,
6315
6422
  * the form `pin` and `saved` take, is that group too (it read "No chat" before). A name no chat and no group has stays
6316
- * the chat's error.
6423
+ * the chat's error. A name more than one group has says so too, with no `id` for `hint` (`shown` is `<group>`): the
6424
+ * group to name is one of theirs, by its id (`ghostly group list`).
6317
6425
  */
6318
6426
  function notAGroup(ctx, params, chat, hint) {
6319
6427
  try {
@@ -6325,16 +6433,19 @@ function notAGroup(ctx, params, chat, hint) {
6325
6433
  let group;
6326
6434
  try {
6327
6435
  group = findGroup(state(ctx).groups, named);
6328
- } catch {
6436
+ } catch (inner) {
6437
+ if (sharedGroupIds(inner)) throw new CliError("not_found", `${JSON.stringify(ref)} names more than one group, not a chat: ${hint("<group>")}`);
6329
6438
  throw error;
6330
6439
  }
6331
6440
  const shown = shellWord(named, group.id);
6332
6441
  throw new CliError("not_found", `${JSON.stringify(ref)} is a group, not a chat: ${hint(shown, group.id)}`, { group: group.id });
6333
6442
  }
6334
6443
  }
6444
+ /** Where a command offered for a name more than one group has (no `id`) finds the id of the one meant. */
6445
+ var byItsId = (id) => id === void 0 ? ", with the id of the group meant (ghostly group list)" : "";
6335
6446
  /** The chat a chat command with a group twin names: a group's name says so, with `command`, the twin (see `notAGroup`). */
6336
6447
  function chatNotGroup(ctx, params, command, rest = "") {
6337
- return notAGroup(ctx, params, () => chatOf(ctx, params), (shown) => `ghostly ${command} ${shown}${rest ? ` ${rest}` : ""}`);
6448
+ return notAGroup(ctx, params, () => chatOf(ctx, params), (shown, id) => `ghostly ${command} ${shown}${rest ? ` ${rest}` : ""}${byItsId(id)}`);
6338
6449
  }
6339
6450
  /**
6340
6451
  * An edit the engine refused. A message that is not in the chat or group at all is `not_found` (exit 3), said as every
@@ -6376,7 +6487,7 @@ function deleteNotMine(ctx, target, ref, theirs, place, purge) {
6376
6487
  /**
6377
6488
  * About the longest ASCII text, and edit, the DHT packet carries once sealed and signed: within the 256 bytes, the
6378
6489
  * envelope's authentication (and an edit's element) takes the rest. The edge moves by a byte or two with the chat (the
6379
- * envelope's sequence, the edit's number), so the words say "about"; `dhtBudgetWords.test.ts` sends both sizes on two
6490
+ * envelope's sequence, the edit's number), so the words say "about"; `dhtPacketBudget.test.ts` sends both sizes on two
6380
6491
  * paired daemons.
6381
6492
  */
6382
6493
  var DHT_TEXT_FITS = 248;
@@ -6612,4 +6723,4 @@ async function callApi(ctx, method, params = {}, call) {
6612
6723
  }
6613
6724
  export { groupJson as _, hideStateSecrets as a, resumeHolds as b, refuseBeforeStart as c, reportAppFrames as d, servedApps as f, chatMessageJson as g, chatJson as h, groupSendRefused as i, settingsInEffect as l, identityProvider as m, SETTABLE as n, mentionsFor as o, nodeLocalFetch as p, callApi as r, redactSettings as s, API_METHODS as t, paymentJson as u, groupMessageJson as v, flushCardUpdates as x, groupPayTwins as y };
6614
6725
 
6615
- //# sourceMappingURL=api-O57SNJcb.js.map
6726
+ //# sourceMappingURL=api-Dz2cw7WD.js.map