@ghostlytools/cli 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +15 -8
  2. package/dist/assets/{api-BIqr8SpM.js → api-CD9JbPuA.js} +99 -28
  3. package/dist/assets/api-CD9JbPuA.js.map +1 -0
  4. package/dist/assets/{api-BnCmJLiQ.js → api-CJM3R93b.js} +2 -2
  5. package/dist/assets/{apiKit-CWalYh1t.js → apiKit-BmnROpCN.js} +8 -4
  6. package/dist/assets/{apiKit-CWalYh1t.js.map → apiKit-BmnROpCN.js.map} +1 -1
  7. package/dist/assets/{apps-_hVUaHIT.js → apps-CJ2dvKSz.js} +1 -1
  8. package/dist/assets/{apps-Bx3tXbJ9.js → apps-DVA60Tg6.js} +34 -11
  9. package/dist/assets/apps-DVA60Tg6.js.map +1 -0
  10. package/dist/assets/{arkade-AxrcyS1C.js → arkade-CHqwEHFd.js} +2 -2
  11. package/dist/assets/{arkade-AxrcyS1C.js.map → arkade-CHqwEHFd.js.map} +1 -1
  12. package/dist/assets/{backup-Y1V1Yxqr.js → backup-B4dSNvzb.js} +5 -5
  13. package/dist/assets/{backup-Y1V1Yxqr.js.map → backup-B4dSNvzb.js.map} +1 -1
  14. package/dist/assets/{backup-d_XvXpEK.js → backup-C4CbTEcj.js} +1 -1
  15. package/dist/assets/{blobFiles-B6nf0gCG.js → blobFiles-Bckz9fjp.js} +2 -2
  16. package/dist/assets/{blobFiles-B6nf0gCG.js.map → blobFiles-Bckz9fjp.js.map} +1 -1
  17. package/dist/assets/buttons-BMVGYXpR.js +2 -0
  18. package/dist/assets/{buttons-BiQyQBb0.js → buttons-C13rK2mH.js} +3 -3
  19. package/dist/assets/{buttons-BiQyQBb0.js.map → buttons-C13rK2mH.js.map} +1 -1
  20. package/dist/assets/{daemonProof-ui8jtIw0.js → daemonProof-B41oSfon.js} +2 -2
  21. package/dist/assets/{daemonProof-ui8jtIw0.js.map → daemonProof-B41oSfon.js.map} +1 -1
  22. package/dist/assets/{envelope-D3oeVhv8.js → envelope-4TXDx3vD.js} +2 -2
  23. package/dist/assets/{envelope-D3oeVhv8.js.map → envelope-4TXDx3vD.js.map} +1 -1
  24. package/dist/assets/{fileBytes-BMEBas7S.js → fileBytes-BD0v3rRG.js} +10 -2
  25. package/dist/assets/{fileBytes-BMEBas7S.js.map → fileBytes-BD0v3rRG.js.map} +1 -1
  26. package/dist/assets/{fileBytes-CtwagJ8h.js → fileBytes-OolN5cSY.js} +1 -1
  27. package/dist/assets/{fileBytes-CFNrRfcl.js → fileBytes-_fd-2JRY.js} +2 -2
  28. package/dist/assets/{fileBytes-CFNrRfcl.js.map → fileBytes-_fd-2JRY.js.map} +1 -1
  29. package/dist/assets/fileBytesIdb-CsSQcSxD.js +2 -0
  30. package/dist/assets/{fileBytesIdb-BXAN7i-N.js → fileBytesIdb-NtA8r9EM.js} +2 -2
  31. package/dist/assets/{fileBytesIdb-BXAN7i-N.js.map → fileBytesIdb-NtA8r9EM.js.map} +1 -1
  32. package/dist/assets/{fileBytesOpfs-Do1Vpkis.js → fileBytesOpfs-B8fJwkwM.js} +3 -3
  33. package/dist/assets/{fileBytesOpfs-Do1Vpkis.js.map → fileBytesOpfs-B8fJwkwM.js.map} +1 -1
  34. package/dist/assets/{ghostly_iroh_web-BXCsSxxo.js → ghostly_iroh_web-CO0onry8.js} +33 -27
  35. package/dist/assets/ghostly_iroh_web-CO0onry8.js.map +1 -0
  36. package/dist/assets/ghostly_iroh_web_bg.wasm +0 -0
  37. package/dist/assets/{groupFiles-DU1wMGI9.js → groupFiles-ajZgZ6P8.js} +41 -25
  38. package/dist/assets/groupFiles-ajZgZ6P8.js.map +1 -0
  39. package/dist/assets/{host-DDMQfR7B.js → host-CVeNtA2_.js} +43 -20
  40. package/dist/assets/host-CVeNtA2_.js.map +1 -0
  41. package/dist/assets/{hyperdhtRelay-B2v8eqRd.js → hyperdhtRelay-CI2ISE-g.js} +2 -2
  42. package/dist/assets/{hyperdhtRelay-B2v8eqRd.js.map → hyperdhtRelay-CI2ISE-g.js.map} +1 -1
  43. package/dist/assets/{irohWeb-9RVIbF_l.js → irohWeb-DcRJdhce.js} +3 -3
  44. package/dist/assets/{irohWeb-9RVIbF_l.js.map → irohWeb-DcRJdhce.js.map} +1 -1
  45. package/dist/assets/{main-BNwNEPEy.js → main-CjO0KGiF.js} +218 -70
  46. package/dist/assets/main-CjO0KGiF.js.map +1 -0
  47. package/dist/assets/{mainline-RXv5_Fby.js → mainline-WM-WItCV.js} +27 -8
  48. package/dist/assets/mainline-WM-WItCV.js.map +1 -0
  49. package/dist/assets/{networkReason-CIn4yN9h.js → networkReason-380j5yMs.js} +2 -2
  50. package/dist/assets/{networkReason-CIn4yN9h.js.map → networkReason-380j5yMs.js.map} +1 -1
  51. package/dist/assets/{nwc-BNPzuT-6.js → nwc-D5dkC1xg.js} +3 -3
  52. package/dist/assets/{nwc-BNPzuT-6.js.map → nwc-D5dkC1xg.js.map} +1 -1
  53. package/dist/assets/{nwcProvider-C9Y6PUNC.js → nwcProvider-p_rMwtDv.js} +2 -2
  54. package/dist/assets/{nwcProvider-C9Y6PUNC.js.map → nwcProvider-p_rMwtDv.js.map} +1 -1
  55. package/dist/assets/{profiles-CEnZfN78.js → profiles-BFd0tpCZ.js} +91 -19
  56. package/dist/assets/profiles-BFd0tpCZ.js.map +1 -0
  57. package/dist/assets/{registry-DOkDhUAu.js → registry-BKffx4ZU.js} +1 -1
  58. package/dist/assets/{registry-B9aYHNNf.js → registry-BfNcA6kF.js} +3 -3
  59. package/dist/assets/{registry-B9aYHNNf.js.map → registry-BfNcA6kF.js.map} +1 -1
  60. package/dist/assets/{resolve-imkCgogd.js → resolve-hUsgRkmm.js} +2 -2
  61. package/dist/assets/{resolve-imkCgogd.js.map → resolve-hUsgRkmm.js.map} +1 -1
  62. package/dist/assets/{server-CB9_JuWZ.js → server-C3tJZFnv.js} +422 -149
  63. package/dist/assets/server-C3tJZFnv.js.map +1 -0
  64. package/dist/assets/{src-BBG_NwMc.js → src-BMHgbkli.js} +219 -62
  65. package/dist/assets/src-BMHgbkli.js.map +1 -0
  66. package/dist/assets/{translate-BcP139SV.js → translate-DJUutSis.js} +2 -2
  67. package/dist/assets/{translate-BcP139SV.js.map → translate-DJUutSis.js.map} +1 -1
  68. package/dist/assets/types-C4_KafL_.js.map +1 -1
  69. package/dist/assets/{usdt-C5Gf9-IC.js → usdt-glkUxsDe.js} +3 -3
  70. package/dist/assets/{usdt-C5Gf9-IC.js.map → usdt-glkUxsDe.js.map} +1 -1
  71. package/dist/assets/{words-ZUiQo4yo.js → words-DyW9b27T.js} +2 -2
  72. package/dist/assets/{words-ZUiQo4yo.js.map → words-DyW9b27T.js.map} +1 -1
  73. package/dist/ghostly.mjs +1 -1
  74. package/package.json +1 -1
  75. package/dist/assets/api-BIqr8SpM.js.map +0 -1
  76. package/dist/assets/apps-Bx3tXbJ9.js.map +0 -1
  77. package/dist/assets/buttons-LO3Ql1Hd.js +0 -2
  78. package/dist/assets/fileBytesIdb-C20oXDdr.js +0 -2
  79. package/dist/assets/ghostly_iroh_web-BXCsSxxo.js.map +0 -1
  80. package/dist/assets/groupFiles-DU1wMGI9.js.map +0 -1
  81. package/dist/assets/host-DDMQfR7B.js.map +0 -1
  82. package/dist/assets/main-BNwNEPEy.js.map +0 -1
  83. package/dist/assets/mainline-RXv5_Fby.js.map +0 -1
  84. package/dist/assets/profiles-CEnZfN78.js.map +0 -1
  85. package/dist/assets/server-CB9_JuWZ.js.map +0 -1
  86. package/dist/assets/src-BBG_NwMc.js.map +0 -1
package/README.md CHANGED
@@ -110,7 +110,7 @@ The rows are in alphabetical order of their first command, and every command of
110
110
  | `call hangup [<chat\|call>]`, `call list`, `call flush [<chat\|call>]` | Hang up (or decline); calls on now; drop the audio queued and not played yet |
111
111
  | `call pipe [<chat\|call>]` | A call's audio on stdin and stdout, for shell pipelines (sox, ffmpeg) |
112
112
  | `call start <chat> [--rate 48000]`, `call answer [<chat\|call>] [--rate n]` | Voice calls (daemon): the result names the call's audio socket ([Calls](#calls)) |
113
- | `chat accept <chat> <method> [--off] [--networks mainnet,testnet]` | Which ways of paying the chat takes |
113
+ | `chat accept <chat> [<method> [--off] [--networks mainnet,testnet]]` | Which ways of paying the chat takes (no method: the ones it takes now, per network) |
114
114
  | `chat connect <chat>`, `chat disconnect <chat> [--hold <minutes>]` | Reconnect now (ends a hold); close the live session, or with `--hold` stay off the direct link that long ([Staying off the direct link](#staying-off-the-direct-link)) |
115
115
  | `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)) |
116
116
  | `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` |
@@ -126,7 +126,7 @@ The rows are in alphabetical order of their first command, and every command of
126
126
  | `events [--since seq] [--translate lang]` | What the event journal holds, without following ([Translation](#translation)) |
127
127
  | `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). A file's id names its chat or its group, so `<chat>` may be left out |
128
128
  | `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) |
129
- | `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 (the answer's `path` is what was written). Never over a file without `--force`; an unfinished one says how many bytes are here; `--wait` waits for it first |
129
+ | `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`; an unfinished one says how many bytes are here; `--wait` waits for it first |
130
130
  | `file send <chat\|group> <path> [--name n] [--mime t] [--voice [ms] [--peaks …]] [--reply <message>]` | 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. 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) |
131
131
  | `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) |
132
132
  | `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}]}`; 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 |
@@ -153,7 +153,7 @@ The rows are in alphabetical order of their first command, and every command of
153
153
  | `message retry\|delete\|details <chat> <message>` | One message |
154
154
  | `pay <invoice\|address\|lnurl> [--amount sats] [--network n] [--max-fee sats] [--confirm-real]` | Pay over Lightning (Testnet unless `--network mainnet`) |
155
155
  | `payment list [--chat c]`, `payment check <chat> <payment>`, `payment reclaim <payment>` | Payments and requests |
156
- | `pin <chat\|group> <message> \| --remove` | Pin a message at the top of a chat or group, for everyone in it: one per chat, a new pin replaces it; `pin <chat\|group> --remove` unpins (it names no message). In a community only the admin pins. A 1:1 pin reaches the contact on the next live session; the other side hears `chat.pinned` or `group.pinned` |
156
+ | `pin <chat\|group> <message> \| --remove` | Pin a message at the top of a chat or group, for everyone in it: one per chat, a new pin replaces it; `pin <chat\|group> --remove` unpins (it names no message). In a community only the admin pins. A 1:1 pin reaches the contact on the next live session; the other side hears `chat.pinned` or `group.pinned`. `chat show`, `group show` and `group list` say what is pinned now: `pin: {messageId, ref, by, at}` (`messageId` null when the message is not here), or `pin: null` |
157
157
  | `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 |
158
158
  | `profile create <name> [--use] [--name <shown>]`, `profile list`, `profile use <name>` | Profiles |
159
159
  | `profile picture <jpeg> \| --clear` | The picture contacts see (a JPEG within 512 px; 128 px is what the app sends) |
@@ -162,12 +162,12 @@ The rows are in alphabetical order of their first command, and every command of
162
162
  | `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] [--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. Updates merge and are paced as `task update`'s. The app shows it, and runs nothing |
163
163
  | `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 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 |
164
164
  | `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)) |
165
- | `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 |
165
+ | `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 add` answers the new one as `service` (the id the others take); its old key `serviceId` stays beside it for one release |
166
166
  | `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) |
167
167
  | `settings get [--show-secret]`, `settings set <key> <json>` | Relays, Iroh relays, the HyperDHT relay, ICE servers, `sendTyping` (false: contacts are never told you type), … |
168
168
  | `status` | The profile, its chats, whether WebRTC and calls run, the last event seq |
169
169
  | `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`) |
170
- | `task send <chat\|group> --title <title> [--status s] [--progress n \| --steps a/b] [--step "…"] [--item state:text]… [--pr-url url --pr-number n --additions n --deletions n --files n --pr-state s --pr-checks c] [--branch b] [--tag label]… [--parent task] [--link url]… [--id id] [--json json\|-\|file] [--force]`, `task update <chat\|group> <task> [fields…]` | A task card for a bot's work (WISP 405 · Status Cards): a title, a status (queued, running, blocked, done, failed, cancelled), progress, the step it is on, up to 20 steps or log lines (`--item done:Codec`; a lowercase word before the colon must be an item state: pending, running, done, failed or skipped) and its pull request, shown as a small card that apps without cards read as text. Optional, and ignored by apps from before them: where the pull request stands (`--pr-state draft`, `open`, `merged` or `closed`; an open one puts the task in the board's Review column) and its checks (`--pr-checks passing`, `failing` or `pending`), up to 3 tags of 24 characters (`--tag core --tag web`; an update's tags replace the card's), and `--parent <task>`, a task of yours in the same chat that this one is a part of (sent first; its parts stack under it on the board). `send` prints the task's id and message; `update` merges the fields given over the card (an update's `--item` list replaces the card's: give all of them) and edits its message, at most once per 2.5 s (sooner updates merge into the next). `--json` takes the whole card; `null` in it removes a field. Only the CLI sends cards: the app shows them |
170
+ | `task send <chat\|group> --title <title> [--status s] [--progress n \| --steps a/b] [--step "…"] [--item state:text]… [--pr-url url --pr-number n --additions n --deletions n --files n --pr-state s --pr-checks c] [--branch b] [--tag label]… [--parent task] [--link url]… [--id id] [--json json\|-\|file] [--force]`, `task update <chat\|group> <task> [fields…]` | A task card for a bot's work (WISP 405 · Status Cards): a title, a status (queued, running, blocked, done, failed, cancelled), progress, the step it is on, up to 20 steps or log lines (`--item done:Codec`; the card holds at most 8 KiB in all, so 20 long items of non-Latin text are past it; a lowercase word before the colon must be an item state: pending, running, done, failed or skipped) and its pull request, shown as a small card that apps without cards read as text. Optional, and ignored by apps from before them: where the pull request stands (`--pr-state draft`, `open`, `merged` or `closed`; an open one puts the task in the board's Review column) and its checks (`--pr-checks passing`, `failing` or `pending`), up to 3 tags of 24 characters (`--tag core --tag web`; an update's tags replace the card's), and `--parent <task>`, a task of yours in the same chat that this one is a part of (sent first; its parts stack under it on the board). `send` prints the task's id and message; `update` merges the fields given over the card (an update's `--item` list replaces the card's: give all of them) and edits its message, at most once per 2.5 s (sooner updates merge into the next). `--json` takes the whole card; `null` in it removes a field. Only the CLI sends cards: the app shows them |
171
171
  | `typing <chat> [--kind typing\|recording\|thinking] [--status "<text>"] [--for s] [--stop]` | Show the contact you are writing, recording or thinking, or a short status line in its place ("Transcribing your audio…", 40 characters, no links): live chats only, it holds 6 s there; `--for s` keeps it on that long (up to 600 s; a one-shot stays that long once the chat is live, and stops with `live: false` when it is not live within 15 s); a new kind or status shows at once; a message to the chat or `--stop` ends it |
172
172
  | `usage send [<chat\|group>] [--all] --left <percent> [--window "5 h"] [--resets <time>] [--label Claude] [--account <name>] [--also week=80@<time>]… [--used n --limit n] [--id id] [--json json\|-\|file] [--force]` | How much of a quota the bot has left (WISP 405 § Usage): the percent (or `--used` of `--limit`), what it is of, the account, the window, when it resets, and up to 3 other windows (`--also week=80@2026-10-10T00:00:00Z`). The app shows a small meter on the chat's row and in its header, amber under 20%, red under 5%, muted once 6 h old or past the reset. One card per chat: the first report sends it, later ones edit it in place (quiet, paced as `task update`'s); each report is whole, so a field it leaves out goes. `--all` reports to every 1:1 chat with a contact. See [docs/AI-AGENTS.md](../../docs/AI-AGENTS.md#reporting-usage) for where a bot gets its numbers |
173
173
  | `version` | This CLI's version, `{"version":"…"}` (also `ghostly --version`) |
@@ -234,7 +234,10 @@ arrives until it is back online.
234
234
 
235
235
  A daemon keeps running the code it started with. After upgrading the CLI, every command that goes through an older
236
236
  (or newer) daemon still answers, and says on stderr `ghostly: the daemon runs <version> and this command is
237
- <version>`. A daemon of a release before 1.5.0 cannot prove it is the profile's daemon (no
237
+ <version>`, then what to do: an older daemon is restarted (`ghostly daemon restart` runs the new code); a newer one
238
+ means this command is the older CLI (a second install, a project's pinned copy), so it says to upgrade the CLI
239
+ (`npm install -g @ghostlytools/cli`) and gives no restart advice, since a restart from it would start the older
240
+ release. A `daemon restart` that does start an older release than the one it stopped says so on stderr. A daemon of a release before 1.5.0 cannot prove it is the profile's daemon (no
238
241
  [greeting](#the-socket-api)): commands are refused after 2 s, exit `1`, until `ghostly daemon restart`. A daemon of
239
242
  this release that is slow to answer (busy on a long task) is waited for, under each command's own deadline. `ghostly daemon restart` stops the running daemon (if one runs) and starts this release's in the
240
243
  background, as `daemon --detach` does. A daemon kept by a service manager (systemd, launchd) is restarted with the
@@ -497,13 +500,17 @@ same setting chats use). A relay connects the calls no direct path can: a VPN th
497
500
  tunnel, a NAT that maps each destination apart. The media stays encrypted end to end; the relay sees both
498
501
  addresses and when and how much is sent. The CLI (libdatachannel) reaches TURN over UDP only: a `turns:` or
499
502
  `?transport=tcp` address stays in the setting for the apps, which use it, and `settings set` warns that the CLI does
500
- not. Behind a network that blocks UDP, the CLI has no relay.
503
+ not. Behind a network that blocks UDP, the CLI has no relay. libdatachannel never gives a relay back when a call
504
+ ends: the server holds it until its 10-minute lifetime runs out, so with a TURN server the CLI makes an incoming
505
+ call's connection only when it is answered, and a call declined or missed costs the server nothing. A call the server
506
+ gives no relay (a per-user quota reached, wrong credentials) logs `no relay address` in the daemon's log.
501
507
 
502
508
  ## Transports
503
509
 
504
510
  The engine picks as the app does: WebRTC (libdatachannel), HyperDHT (native, in process), Iroh (the wasm build,
505
511
  relay only, as in the web app), and the DHT floor through the Pkarr relays in the settings and the Mainline DHT
506
- directly (every packet to both; reads from the DHT when every relay fails). Tests and private networks:
512
+ directly (every packet to both; reads from the DHT when every relay fails, so `settings set readRelays`, the
513
+ app's "Also use Pkarr relays", is refused). Tests and private networks:
507
514
  `GHOSTLY_DHT=0` leaves the Mainline DHT out, `GHOSTLY_DHT_BOOTSTRAP=host:port,…` replaces its bootstrap routers,
508
515
  `GHOSTLY_HYPERDHT_BOOTSTRAP=host:port,…` replaces HyperDHT's bootstrap nodes, `settings set relays
509
516
  '["http://…"]'` the Pkarr relays, `settings set irohRelays '["https://…"]'` the Iroh relays. `GHOSTLY_WEBRTC=0`
@@ -1,15 +1,15 @@
1
- import { Do as GhostlyHttpError, Ec as APP_PERMISSIONS, Ir as sanitizeTypingStatus, Nr as TYPING_KINDS, Pr as TYPING_REFRESH_MS, Qa as appCardId, Uc as isAppRef, Wi as identityStatement, Wn as GROUP_FILE_LIMITS, Xa as STATUS_CARD_LIMITS, Y as groupName, Yc as readImageMeta, _a as voiceDownloadName, _u as toBase64Url, ca as sanitizeFileName, da as VOICE_LIMITS, dl as ownInviteRefusal, du as sanitizeAvatar, eo as cardLine, fa as VOICE_METER, ga as parseVoiceMeta, gu as randomBytes$1, jc as isAppUrl, jo as LIMITS, la as sanitizeMime, ll as inviteLink, ma as downsamplePeaks, ni as APP_DATA_MAX_BYTES, no as checkStatusCard, pa as baseMime, ua as PLAYABLE_AUDIO, uu as MAX_AVATAR_LENGTH, va as voiceLevel, xo as AWAITING_PEER_MS, zc as appRef } from "./src-BBG_NwMc.js";
1
+ import { Ao as parseLocalTarget, Gc as isAppRef, Ir as sanitizeTypingStatus, Mo as LIMITS, Nc as isAppUrl, Nr as TYPING_KINDS, Oc as APP_PERMISSIONS, Oo as GhostlyHttpError, Pr as TYPING_REFRESH_MS, Qa as appCardId, Qc as readImageMeta, So as AWAITING_PEER_MS, Vc as appRef, Wi as identityStatement, Wn as GROUP_FILE_LIMITS, Xa as STATUS_CARD_LIMITS, Y as groupName, _a as voiceDownloadName, bu as toBase64Url, ca as sanitizeFileName, da as VOICE_LIMITS, eo as cardLine, fa as VOICE_METER, fl as inviteLink, ga as parseVoiceMeta, io as statusCardBytes, la as sanitizeMime, ma as downsamplePeaks, ml as ownInviteRefusal, mu as sanitizeAvatar, ni as APP_DATA_MAX_BYTES, no as checkStatusCard, pa as baseMime, pu as MAX_AVATAR_LENGTH, so as claimedTime, ua as PLAYABLE_AUDIO, va as voiceLevel, yu as randomBytes$1 } from "./src-BMHgbkli.js";
2
2
  import { u as fileStore } from "./idb-BlH8-O3R.js";
3
- import { O as waitingGroupFile, T as removeStored, U as iceServerProblem, W as iceServerSetting, i as groupOfFile, l as replyRef, n as groupFileId, v as paymentNetwork } from "./groupFiles-DU1wMGI9.js";
4
- import { f as FILE_BYTES_STEP, o as fileBytes, s as fileBytesOf } from "./fileBytes-BMEBas7S.js";
5
- import { t as IDENTITY_PROVIDERS } from "./registry-B9aYHNNf.js";
6
- import { a as waitForEdit, c as findSecret, i as pressable, n as buttonsCard, o as waitForGroupFrame, s as waitForMessage, t as BUTTON_METHODS } from "./buttons-BiQyQBb0.js";
7
- 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-ZUiQo4yo.js";
3
+ import { O as waitingGroupFile, T as removeStored, U as iceServerProblem, W as iceServerSetting, i as groupOfFile, l as replyRef, n as groupFileId, v as paymentNetwork } from "./groupFiles-ajZgZ6P8.js";
4
+ import { f as FILE_BYTES_STEP, o as fileBytes, s as fileBytesOf } from "./fileBytes-BD0v3rRG.js";
5
+ import { t as IDENTITY_PROVIDERS } from "./registry-BfNcA6kF.js";
6
+ import { a as waitForEdit, c as findSecret, i as pressable, n as buttonsCard, o as waitForGroupFrame, s as waitForMessage, t as BUTTON_METHODS } from "./buttons-C13rK2mH.js";
7
+ 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-DyW9b27T.js";
8
8
  import { i as localFileError, r as asCliError, t as CliError } from "./errors-CzXgR8Cc.js";
9
- import { _ as state, a as findChat, d as list, f as messageOf, g as sentAt, h as oneOf, i as chatOrGroup, l as groupOf, m as num, n as bool, o as findChatOrGroup, p as node, r as chatOf, s as findGroup, u as inviteTaken, v as str, y as waitForState } from "./apiKit-CWalYh1t.js";
10
- import { a as checkShownName } from "./profiles-CEnZfN78.js";
11
- import { t as BACKUP_METHODS } from "./backup-Y1V1Yxqr.js";
12
- import { o as checkedBundle } from "./apps-Bx3tXbJ9.js";
9
+ import { _ as sentAt, a as findChat, b as waitForState, d as list, f as messageOf, g as oneOf, h as num, i as chatOrGroup, l as groupOf, m as node, n as bool, o as findChatOrGroup, r as chatOf, s as findGroup, u as inviteTaken, v as state, y as str } from "./apiKit-BmnROpCN.js";
10
+ import { a as checkShownName } from "./profiles-BFd0tpCZ.js";
11
+ import { t as BACKUP_METHODS } from "./backup-B4dSNvzb.js";
12
+ import { o as checkedBundle } from "./apps-DVA60Tg6.js";
13
13
  import { generateMnemonic } from "@scure/bip39";
14
14
  import { wordlist } from "@scure/bip39/wordlists/english.js";
15
15
  import { openAsBlob, readFileSync, renameSync, writeFileSync } from "node:fs";
@@ -710,6 +710,28 @@ var TYPES = {
710
710
  function mimeOf(path, given) {
711
711
  return sanitizeMime(given ?? TYPES[extname(path).toLowerCase()] ?? "application/octet-stream");
712
712
  }
713
+ /**
714
+ * The time a saved voice message is named from: its message's in the chat, as the apps' Download names it. The file's
715
+ * own time is what its sender says (any safe integer, past Date's end too), taken only when no message is there and
716
+ * a date can hold it; else when it was stored here.
717
+ */
718
+ async function voiceTime(ctx, stored) {
719
+ return (await findMessage(ctx, stored.linkId, (m) => m.file?.id === stored.id))?.timestamp ?? claimedTime(stored.metadata?.timestamp) ?? stored.createdAt;
720
+ }
721
+ /**
722
+ * The message of a chat or a group (`group:<id>`) that `test` picks: looked for among its newest first, where the one a
723
+ * command names almost always is, then in all of them only when there are more. A whole history costs a read of every row.
724
+ */
725
+ async function findMessage(ctx, linkId, test) {
726
+ const page = await node(ctx).messagePage({
727
+ linkId,
728
+ limit: 200
729
+ });
730
+ const newest = page.messages.find(test);
731
+ if (newest || !page.more) return newest;
732
+ const group = linkId.startsWith("group:") ? linkId.slice(6) : void 0;
733
+ return (group ? await node(ctx).groupMessages({ groupId: group }) : await node(ctx).getMessages(linkId)).find(test);
734
+ }
713
735
  /** A chat's files as the timeline shows them, with where each transfer stands (`transferOf`, by file id). */
714
736
  function filesOf(messages, transferOf) {
715
737
  return messages.filter((m) => m.file).map((m) => ({
@@ -795,7 +817,7 @@ async function sendToGroup(ctx, params, group, path, size) {
795
817
  const mime = mimeOf(path, str(params, "mime"));
796
818
  const replyTo = str(params, "reply");
797
819
  if (replyTo) {
798
- if (!(await node(ctx).groupMessages({ groupId: group.id })).some((m) => m.id === replyTo || replyRef(m) === replyTo)) throw new CliError("not_found", "That message is not in this group, or cannot be replied to");
820
+ if (!await findMessage(ctx, `group:${group.id}`, (m) => m.id === replyTo || replyRef(m) === replyTo)) throw new CliError("not_found", "That message is not in this group, or cannot be replied to");
799
821
  }
800
822
  const check = await node(ctx).groupFileCheck({ groupId: group.id });
801
823
  if (check.error) throw check.refused ? new CliError("refused", check.error) : groupSendRefused(check.error);
@@ -911,7 +933,7 @@ var FILE_METHODS = {
911
933
  const mime = mimeOf(path, str(params, "mime"));
912
934
  const replyTo = str(params, "reply");
913
935
  if (replyTo) {
914
- if (!(await node(ctx).getMessages(link.id)).some((m) => m.id === replyTo || replyRef(m) === replyTo)) throw new CliError("not_found", "That message is not in this chat, or cannot be replied to");
936
+ if (!await findMessage(ctx, link.id, (m) => m.id === replyTo || replyRef(m) === replyTo)) throw new CliError("not_found", "That message is not in this chat, or cannot be replied to");
915
937
  }
916
938
  const { voice, warning } = await voiceOf(params, path, mime, info.size);
917
939
  const source = await openAsBlob(path, { type: mime });
@@ -1090,8 +1112,8 @@ var FILE_METHODS = {
1090
1112
  },
1091
1113
  /**
1092
1114
  * Writes a received (or sent) file to disk: into `dir` under its own name (`saveName`), a voice message under the one
1093
- * Ghostly makes for it as the apps' Download does (`voiceDownloadName`, never the sender's), or to `path`. Never over
1094
- * a file unless `force`.
1115
+ * Ghostly makes for it as the apps' Download does (`voiceDownloadName`, never the sender's; "<name> (2)" when taken),
1116
+ * or to `path`. Never over a file unless `force`.
1095
1117
  */
1096
1118
  async "file.save"(ctx, params) {
1097
1119
  const fileId = str(params, "file", true);
@@ -1105,13 +1127,19 @@ var FILE_METHODS = {
1105
1127
  if (stored.leftOut) throw new CliError("not_found", "Not in this backup: the light backup this profile was restored from left the file out");
1106
1128
  const transfer = stored.direction === "out" ? void 0 : state(ctx).transfers[fileId] ?? stored.transfer;
1107
1129
  if (transfer && transfer.state !== "done") throw new CliError("unavailable", `The file is not all here yet (${transfer.transferred} of ${transfer.size} bytes)`);
1108
- const target = str(params, "path") ? resolve(str(params, "path", true)) : join(resolve(str(params, "dir") ?? "."), saveName(stored.metadata.voice ? voiceDownloadName(stored.metadata.mime, stored.metadata.timestamp) : stored.metadata.name));
1109
- const flags = bool(params, "force") ? "w" : "wx";
1110
- let out;
1111
- try {
1112
- out = await open(target, flags, 384);
1130
+ const named = str(params, "path") ? resolve(str(params, "path", true)) : join(resolve(str(params, "dir") ?? "."), saveName(stored.metadata.voice ? voiceDownloadName(stored.metadata.mime, await voiceTime(ctx, stored)) : stored.metadata.name));
1131
+ const force = bool(params, "force");
1132
+ const free = !force && !str(params, "path") && !!stored.metadata.voice;
1133
+ const ext = extname(named), stem = named.slice(0, named.length - ext.length);
1134
+ let target = named, out;
1135
+ for (let n = 2; !out; n += 1) try {
1136
+ out = await open(target, force ? "w" : "wx", 384);
1113
1137
  } catch (error) {
1114
1138
  const code = error.code;
1139
+ if (free && code === "EEXIST" && n <= 1e3) {
1140
+ target = `${stem} (${n})${ext}`;
1141
+ continue;
1142
+ }
1115
1143
  if ((code === "EEXIST" || code === "EISDIR") && (await stat(target).catch(() => void 0))?.isDirectory()) throw new CliError("bad_request", `${target} is a folder: name a file, or use dir (--dir ${target})`);
1116
1144
  if (code === "EEXIST") throw new CliError("confirm", `${target} exists: pass force (--force) to replace it`);
1117
1145
  if (code === "ENOENT" || code === "ENOTDIR") {
@@ -1213,10 +1241,19 @@ function withRun(fields, params, now = Date.now()) {
1213
1241
  runs: [lastRun, ...before].slice(0, STATUS_CARD_LIMITS.runs)
1214
1242
  };
1215
1243
  }
1216
- /** A card checked by the sender's rule, or a `bad_request` that says what is wrong. */
1244
+ /**
1245
+ * A card checked by the sender's rule, or a `bad_request` that says what is wrong: with the card, unless the card is
1246
+ * what is too big (its size and the bound, not kilobytes of it echoed back).
1247
+ */
1217
1248
  function checked(card) {
1218
1249
  const result = checkStatusCard(card);
1219
- if ("error" in result) throw new CliError("bad_request", `Status card: ${result.error}`, { card });
1250
+ if ("error" in result) {
1251
+ const bytes = statusCardBytes(card);
1252
+ throw new CliError("bad_request", `Status card: ${result.error}`, bytes > STATUS_CARD_LIMITS.bytes ? {
1253
+ bytes,
1254
+ max: STATUS_CARD_LIMITS.bytes
1255
+ } : { card });
1256
+ }
1220
1257
  return result.card;
1221
1258
  }
1222
1259
  /** Every text in a card's fields (title, step, items, runs, links…), as the contact's app may show it. */
@@ -1696,7 +1733,20 @@ function chatJson(link, showSecret) {
1696
1733
  peerPicture: !!link.peerAvatar
1697
1734
  };
1698
1735
  }
1699
- /** A chat's details: the summary plus what its connection panel shows. */
1736
+ /**
1737
+ * What is pinned at the top of a chat or a group (WISP 400 § Pinned message), as `chat.pinned` / `group.pinned` say it:
1738
+ * `messageId` the row here (null when it is not here), `ref` the id both sides know it by, `by` (`me`, `peer` or a
1739
+ * member key) and `at`, when it came here. Null when nothing is pinned, or it was unpinned.
1740
+ */
1741
+ function pinJson(pin) {
1742
+ return pin?.id ? {
1743
+ messageId: pin.messageId ?? null,
1744
+ ref: pin.id,
1745
+ by: pin.by,
1746
+ at: pin.at
1747
+ } : null;
1748
+ }
1749
+ /** A chat's details: the summary plus what its connection panel shows, and its pin. */
1700
1750
  function chatDetailsJson(link, showSecret) {
1701
1751
  return {
1702
1752
  ...chatJson(link, showSecret),
@@ -1721,7 +1771,8 @@ function chatDetailsJson(link, showSecret) {
1721
1771
  peerLastSeenAt: link.peerLastSeenAt || null,
1722
1772
  history: link.transportHistory ?? null,
1723
1773
  errors: link.transportErrors ?? null,
1724
- comparisonCode: link.pairing?.code ?? null
1774
+ comparisonCode: link.pairing?.code ?? null,
1775
+ pin: pinJson(link.pin)
1725
1776
  };
1726
1777
  }
1727
1778
  function messageJson(message) {
@@ -1865,7 +1916,8 @@ function groupJson(group, showSecret = false) {
1865
1916
  stage: group.invitation.stage ?? null
1866
1917
  } : null,
1867
1918
  community: group.community ?? null,
1868
- picture: !!group.picture
1919
+ picture: !!group.picture,
1920
+ pin: pinJson(group.pin)
1869
1921
  };
1870
1922
  }
1871
1923
  //#endregion
@@ -2568,10 +2620,21 @@ var SERVICE_METHODS = {
2568
2620
  throw new CliError("bad_request", `Not a URL: ${target}`);
2569
2621
  }
2570
2622
  if (!(LOOPBACK.has(url.hostname) || /^127\.\d+\.\d+\.\d+$/.test(url.hostname))) throw new CliError("refused", "Only a web app on this machine (127.0.0.1, localhost) can be shared");
2571
- return node(ctx).addService({
2623
+ try {
2624
+ parseLocalTarget(target);
2625
+ } catch (error) {
2626
+ const said = error instanceof Error ? error.message : String(error);
2627
+ const shown = `${url.protocol}//${url.host}${url.pathname}`;
2628
+ throw new CliError(/^Only services on this machine/.test(said) ? "refused" : "bad_request", `${said}: ${shown}`);
2629
+ }
2630
+ const { serviceId } = node(ctx).addService({
2572
2631
  name: str(params, "name", true),
2573
2632
  target
2574
2633
  });
2634
+ return {
2635
+ service: serviceId,
2636
+ serviceId
2637
+ };
2575
2638
  },
2576
2639
  async "service.remove"(ctx, params) {
2577
2640
  const serviceId = serviceOf(ctx, params);
@@ -3429,6 +3492,14 @@ var WALLET_METHODS = Object.fromEntries(Object.entries({
3429
3492
  /** Which ways of paying this chat takes, per network (the chat's Accept switches). */
3430
3493
  async "chat.accept"(ctx, params) {
3431
3494
  const link = chatOf(ctx, params);
3495
+ if (params.method === void 0) {
3496
+ if (params.on !== void 0 || params.networks !== void 0) throw new CliError("bad_request", "on and networks change one method: name it");
3497
+ return {
3498
+ chat: link.id,
3499
+ methods: link.paymentMethods ?? null,
3500
+ networks: link.paymentNetworks ?? null
3501
+ };
3502
+ }
3432
3503
  const method = oneOf(params, "method", CHAT_METHODS, "cashu");
3433
3504
  const on = bool(params, "on");
3434
3505
  const nets = params.networks === void 0 ? void 0 : (() => {
@@ -3527,7 +3598,6 @@ var SETTABLE = {
3527
3598
  relays: "strings",
3528
3599
  irohRelays: "strings",
3529
3600
  hyperdhtRelay: "string",
3530
- readRelays: "boolean",
3531
3601
  iceServers: "ice",
3532
3602
  publicProfiles: "boolean",
3533
3603
  online: "boolean",
@@ -3696,6 +3766,7 @@ var METHODS = {
3696
3766
  let warning;
3697
3767
  for (const [key, value] of Object.entries(params)) {
3698
3768
  const kind = Object.hasOwn(SETTABLE, key) ? SETTABLE[key] : void 0;
3769
+ if (key === "readRelays") throw new CliError("bad_request", "readRelays is not a setting the CLI follows: it reads the Pkarr relays first, so a contact on the web app (relays only) is found, and the Mainline DHT when every relay fails");
3699
3770
  if (!kind) throw new CliError("bad_request", `${key} is not a setting the CLI changes (${Object.keys(SETTABLE).join(", ")})`);
3700
3771
  if (kind === "strings" && !(Array.isArray(value) && value.every((v) => typeof v === "string"))) throw new CliError("bad_request", `${key} must be a list of strings`);
3701
3772
  if (kind === "string" && typeof value !== "string") throw new CliError("bad_request", `${key} must be a string`);
@@ -4386,7 +4457,7 @@ var METHODS = {
4386
4457
  const raw = params.params;
4387
4458
  if (raw !== void 0 && (raw === null || typeof raw !== "object" || Array.isArray(raw))) throw new CliError("bad_request", "params must be an object");
4388
4459
  const args = raw;
4389
- if (method === "updateSettings" && args?.settings && typeof args.settings === "object" && "relayOnly" in args.settings) throw new CliError("bad_request", "relayOnly is not a setting yet: Hide my IP from contacts comes in a later release");
4460
+ if (method === "updateSettings" && args?.settings && typeof args.settings === "object" && "relayOnly" in args.settings && args.settings.relayOnly !== false) throw new CliError("bad_request", "relayOnly is not a setting yet: Hide my IP from contacts comes in a later release");
4390
4461
  if (args && "confirmedReal" in args && !bool(params, "confirmReal")) throw new CliError("confirm", `${method} spends real money: pass --confirm-real (confirmReal: true over the socket) to confirm it`);
4391
4462
  const deletes = DESTRUCTIVE_CALLS.get(method);
4392
4463
  if (deletes && !bool(params, "yes")) throw new CliError("confirm", `${method} ${deletes}; pass --yes (yes: true over the socket) to go on`);
@@ -4663,4 +4734,4 @@ async function callApi(ctx, method, params = {}) {
4663
4734
  //#endregion
4664
4735
  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 };
4665
4736
 
4666
- //# sourceMappingURL=api-BIqr8SpM.js.map
4737
+ //# sourceMappingURL=api-CD9JbPuA.js.map