@ghostlytools/cli 1.7.1 → 1.7.2

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 (68) hide show
  1. package/README.md +8 -5
  2. package/dist/assets/{api-CJM3R93b.js → api-CcuCtc1H.js} +2 -2
  3. package/dist/assets/{api-CD9JbPuA.js → api-tSZELCPQ.js} +44 -22
  4. package/dist/assets/api-tSZELCPQ.js.map +1 -0
  5. package/dist/assets/{apiKit-BmnROpCN.js → apiKit-BFk7GAk9.js} +3 -3
  6. package/dist/assets/{apiKit-BmnROpCN.js.map → apiKit-BFk7GAk9.js.map} +1 -1
  7. package/dist/assets/{apps-DVA60Tg6.js → apps-C5Mi6x9Q.js} +5 -5
  8. package/dist/assets/{apps-DVA60Tg6.js.map → apps-C5Mi6x9Q.js.map} +1 -1
  9. package/dist/assets/{apps-CJ2dvKSz.js → apps-D6THreq_.js} +1 -1
  10. package/dist/assets/{arkade-CHqwEHFd.js → arkade-Cz0B9bJ0.js} +2 -2
  11. package/dist/assets/{arkade-CHqwEHFd.js.map → arkade-Cz0B9bJ0.js.map} +1 -1
  12. package/dist/assets/{backup-C4CbTEcj.js → backup-A0hIa9GE.js} +1 -1
  13. package/dist/assets/{backup-B4dSNvzb.js → backup-Wb2sm2dd.js} +6 -6
  14. package/dist/assets/{backup-B4dSNvzb.js.map → backup-Wb2sm2dd.js.map} +1 -1
  15. package/dist/assets/buttons-Bxxu3lSk.js +2 -0
  16. package/dist/assets/{buttons-C13rK2mH.js → buttons-Cf70NVYq.js} +12 -7
  17. package/dist/assets/buttons-Cf70NVYq.js.map +1 -0
  18. package/dist/assets/{daemonProof-B41oSfon.js → daemonProof-Bp9lJDxf.js} +2 -2
  19. package/dist/assets/{daemonProof-B41oSfon.js.map → daemonProof-Bp9lJDxf.js.map} +1 -1
  20. package/dist/assets/{envelope-4TXDx3vD.js → envelope-kQ5kYjVE.js} +2 -2
  21. package/dist/assets/{envelope-4TXDx3vD.js.map → envelope-kQ5kYjVE.js.map} +1 -1
  22. package/dist/assets/{errors-CzXgR8Cc.js → errors-mnjSQlbX.js} +2 -1
  23. package/dist/assets/errors-mnjSQlbX.js.map +1 -0
  24. package/dist/assets/{groupFiles-ajZgZ6P8.js → groupFiles-D9Ttlm3M.js} +3 -3
  25. package/dist/assets/groupFiles-D9Ttlm3M.js.map +1 -0
  26. package/dist/assets/{host-CVeNtA2_.js → host-DpypH-fR.js} +11 -11
  27. package/dist/assets/{host-CVeNtA2_.js.map → host-DpypH-fR.js.map} +1 -1
  28. package/dist/assets/{hyperdhtRelay-CI2ISE-g.js → hyperdhtRelay-D1rj84v2.js} +2 -2
  29. package/dist/assets/{hyperdhtRelay-CI2ISE-g.js.map → hyperdhtRelay-D1rj84v2.js.map} +1 -1
  30. package/dist/assets/{irohWeb-DcRJdhce.js → irohWeb-BTSlWgEX.js} +2 -2
  31. package/dist/assets/{irohWeb-DcRJdhce.js.map → irohWeb-BTSlWgEX.js.map} +1 -1
  32. package/dist/assets/{main-CjO0KGiF.js → main-BwgoQZVu.js} +70 -45
  33. package/dist/assets/main-BwgoQZVu.js.map +1 -0
  34. package/dist/assets/{mainline-WM-WItCV.js → mainline-B1urhbEZ.js} +2 -2
  35. package/dist/assets/{mainline-WM-WItCV.js.map → mainline-B1urhbEZ.js.map} +1 -1
  36. package/dist/assets/{networkReason-380j5yMs.js → networkReason-D2Z0BdIj.js} +2 -2
  37. package/dist/assets/{networkReason-380j5yMs.js.map → networkReason-D2Z0BdIj.js.map} +1 -1
  38. package/dist/assets/{nwc-D5dkC1xg.js → nwc-T2aUK6bi.js} +3 -3
  39. package/dist/assets/{nwc-D5dkC1xg.js.map → nwc-T2aUK6bi.js.map} +1 -1
  40. package/dist/assets/{nwcProvider-p_rMwtDv.js → nwcProvider-Dz-ty_DE.js} +2 -2
  41. package/dist/assets/{nwcProvider-p_rMwtDv.js.map → nwcProvider-Dz-ty_DE.js.map} +1 -1
  42. package/dist/assets/{profiles-BFd0tpCZ.js → profiles-C6XWqre5.js} +2 -2
  43. package/dist/assets/{profiles-BFd0tpCZ.js.map → profiles-C6XWqre5.js.map} +1 -1
  44. package/dist/assets/{registry-BfNcA6kF.js → registry-Bazitl0a.js} +3 -3
  45. package/dist/assets/{registry-BfNcA6kF.js.map → registry-Bazitl0a.js.map} +1 -1
  46. package/dist/assets/{registry-BKffx4ZU.js → registry-BlSTJlbv.js} +1 -1
  47. package/dist/assets/{resolve-hUsgRkmm.js → resolve-Bx1Eeg-w.js} +2 -2
  48. package/dist/assets/{resolve-hUsgRkmm.js.map → resolve-Bx1Eeg-w.js.map} +1 -1
  49. package/dist/assets/{server-C3tJZFnv.js → server-CnPj9wWh.js} +252 -93
  50. package/dist/assets/server-CnPj9wWh.js.map +1 -0
  51. package/dist/assets/{src-BMHgbkli.js → src-BsznF3XG.js} +88 -23
  52. package/dist/assets/src-BsznF3XG.js.map +1 -0
  53. package/dist/assets/{translate-DJUutSis.js → translate-cDBotA-b.js} +11 -11
  54. package/dist/assets/{translate-DJUutSis.js.map → translate-cDBotA-b.js.map} +1 -1
  55. package/dist/assets/{usdt-glkUxsDe.js → usdt-DxxLdG60.js} +3 -3
  56. package/dist/assets/{usdt-glkUxsDe.js.map → usdt-DxxLdG60.js.map} +1 -1
  57. package/dist/assets/{words-DyW9b27T.js → words-qH8gGtmc.js} +2 -2
  58. package/dist/assets/{words-DyW9b27T.js.map → words-qH8gGtmc.js.map} +1 -1
  59. package/dist/ghostly.mjs +1 -1
  60. package/package.json +1 -1
  61. package/dist/assets/api-CD9JbPuA.js.map +0 -1
  62. package/dist/assets/buttons-BMVGYXpR.js +0 -2
  63. package/dist/assets/buttons-C13rK2mH.js.map +0 -1
  64. package/dist/assets/errors-CzXgR8Cc.js.map +0 -1
  65. package/dist/assets/groupFiles-ajZgZ6P8.js.map +0 -1
  66. package/dist/assets/main-CjO0KGiF.js.map +0 -1
  67. package/dist/assets/server-C3tJZFnv.js.map +0 -1
  68. package/dist/assets/src-BMHgbkli.js.map +0 -1
package/README.md CHANGED
@@ -159,7 +159,7 @@ The rows are in alphabetical order of their first command, and every command of
159
159
  | `profile picture <jpeg> \| --clear` | The picture contacts see (a JPEG within 512 px; 128 px is what the app sends) |
160
160
  | `profile show`, `profile set [--name <name>] [--share-profile \| --no-share-profile]` | The name contacts see |
161
161
  | `react <chat> <message> <emoji> [--remove]` | React to a message with one emoji; a new one replaces yours, `--remove` takes it back |
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 |
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] [--text <text>] [--json json\|-\|file] [--force]`, `routine update <chat\|group> <routine> [fields…]` | A routine card for something a bot runs on a schedule (WISP 405 · Status Cards): its name, schedule (and cron line, shown only), state, last run and result, next run and up to 10 recent runs. `--run` records a run now as the last one; `--next` takes milliseconds or a date. 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
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 |
@@ -167,14 +167,14 @@ The rows are in alphabetical order of their first command, and every command of
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`; 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 |
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] [--text <text>] [--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
- | `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 |
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] [--text <text>] [--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`) |
174
174
  | `wallet create <type> [--network testnet] [--provider id] [--value name=value]… [--stdin] [--invite code] [--api-key key]` | A wallet: `cashu`, `lightning` (a card: its source's form in `--value`), `arkade`, `spark` (on Mainnet, `--api-key` is your Breez API key), `bitcoin` (BDK), `fedimint` (`--invite` is the federation's invite code), `usdt`. With `--stdin`, secret fields come as `name=value` lines on stdin (`api-key=…` too), out of `ps` and the shell's history; a `--value` the source's form marks secret (an NWC URI, a macaroon, a rune, an RPC password) is warned about |
175
175
  | `wallet faucet <type>`, `wallet add-mint <url> [--primary]` | Test coins; another Cashu mint |
176
176
  | `wallet list [--network n]` | Wallets and balances, and what `wallet create` can make on each network |
177
- | `wallet receive <sats>`, `wallet address <type>`, `wallet redeem [<token>]`, `wallet history` | Receive, and what came and went. `wallet redeem` reads the token from stdin when none is given, which keeps it out of `ps` and the shell's history |
177
+ | `wallet receive <sats>`, `wallet address <type>`, `wallet redeem [<token> \| -]`, `wallet history` | Receive, and what came and went. `wallet redeem` reads the token from stdin when none is given or `-`, which keeps it out of `ps` and the shell's history |
178
178
  | `wallet remove <type> [--network n] [--card id] [--accept-loss]` | Refused while it holds money or waits for some, unless `--accept-loss` |
179
179
  | `x401 credential add <file\|-> [--label name]`, `x401 credential list [--show-secret]`, `x401 credential remove <id>` | x401 credentials ([WISP 3xx](../../docs/wisps/3xx-x401.md), a draft: test credentials only): keep an issued SD-JWT VC bound to a key from `x401 key new` (a label is up to 80 characters on one line), list them (claim paths; values only with `--show-secret`), remove one with its key. Never shared with contacts |
180
180
  | `x401 key new` | A fresh P-256 holder key, one per credential: give its public JWK to the issuer. The 8 newest keys wait for a credential; a ninth drops the oldest (`dropped` names it) |
@@ -369,13 +369,16 @@ chat (`chat list`, `chat show`, `chat rename`, …) and `engine getState` print
369
369
  apart, and the cursor stays before it until the bridge takes it. A 4xx or a redirect (not followed) passes the event
370
370
  as not taken.
371
371
  - With no daemon running, `listen` becomes the daemon (socket included), so a hook can answer with `ghostly send`.
372
- - `--translate <lang>`: received messages carry a translation ([Translation](#translation)).
372
+ - `--translate <lang>`: received messages carry a translation, once the CLI has a language detector ([Translation](#translation)).
373
373
 
374
374
  As the app's chat screen does, the side that joined a chat says `👋 <name> joined` once it first goes live, and the
375
375
  side that invited answers once.
376
376
 
377
377
  ### Translation
378
378
 
379
+ **Not in this build yet:** the CLI has no language detector yet, so `--translate` translates nothing: the command
380
+ says so in one line on stderr and prints what it prints without the flag. What follows is how it works once it has one.
381
+
379
382
  `listen`, `events` and `chat history` take `--translate <lang>` (an ISO 639 code: `en`, `pt`, `es`...). A message a
380
383
  contact or a member sent, in another language, then carries `translation: {from, text}` beside its `text`: `from` is
381
384
  the language it was written in. It is made on this machine by the translation runtime the Desktop app downloads; the
@@ -1,3 +1,3 @@
1
- import { a as findChat, s as findGroup } from "./apiKit-BmnROpCN.js";
2
- import { a as hideStateSecrets, i as groupSendRefused, n as SETTABLE, o as mentionsFor, r as callApi, s as redactSettings, t as API_METHODS } from "./api-CD9JbPuA.js";
1
+ import { a as findChat, s as findGroup } from "./apiKit-BFk7GAk9.js";
2
+ import { a as hideStateSecrets, i as groupSendRefused, n as SETTABLE, o as mentionsFor, r as callApi, s as redactSettings, t as API_METHODS } from "./api-tSZELCPQ.js";
3
3
  export { API_METHODS, SETTABLE, callApi, findChat, findGroup, groupSendRefused, hideStateSecrets, mentionsFor, redactSettings };
@@ -1,15 +1,15 @@
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";
1
+ import { $a as appCardId, $c as readImageMeta, Co as AWAITING_PEER_MS, Hc as appRef, Ir as sanitizeTypingStatus, Kc as isAppRef, No as LIMITS, Nr as TYPING_KINDS, Pc as isAppUrl, Pr as TYPING_REFRESH_MS, Wi as identityStatement, Wn as GROUP_FILE_LIMITS, Y as groupName, Za as STATUS_CARD_LIMITS, _a as voiceDownloadName, ao as statusCardBytes, bu as randomBytes$1, ca as sanitizeFileName, co as claimedTime, da as VOICE_LIMITS, fa as VOICE_METER, ga as parseVoiceMeta, hl as ownInviteRefusal, hu as sanitizeAvatar, jo as parseLocalTarget, kc as APP_PERMISSIONS, ko as GhostlyHttpError, la as sanitizeMime, ma as downsamplePeaks, mu as MAX_AVATAR_LENGTH, ni as APP_DATA_MAX_BYTES, pa as baseMime, pl as inviteLink, ro as checkStatusCard, to as cardLine, ua as PLAYABLE_AUDIO, va as voiceLevel, xu as toBase64Url } from "./src-BsznF3XG.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-ajZgZ6P8.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-D9Ttlm3M.js";
4
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
- import { i as localFileError, r as asCliError, t as CliError } from "./errors-CzXgR8Cc.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";
5
+ import { t as IDENTITY_PROVIDERS } from "./registry-Bazitl0a.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-Cf70NVYq.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-qH8gGtmc.js";
8
+ import { i as localFileError, r as asCliError, t as CliError } from "./errors-mnjSQlbX.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-BFk7GAk9.js";
10
+ import { a as checkShownName } from "./profiles-C6XWqre5.js";
11
+ import { t as BACKUP_METHODS } from "./backup-Wb2sm2dd.js";
12
+ import { o as checkedBundle } from "./apps-C5Mi6x9Q.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";
@@ -2124,7 +2124,8 @@ async function begin(ctx, p, subject, params) {
2124
2124
  if (!normalized) throw new CliError("bad_request", `Not a ${p.subject?.label ?? "subject"} ${p.label} takes`);
2125
2125
  const days = params.days === void 0 ? void 0 : num(params, "days", 0, {
2126
2126
  min: 1,
2127
- max: p.validity.maxDays
2127
+ max: p.validity.maxDays,
2128
+ whole: true
2128
2129
  });
2129
2130
  return node(ctx).beginIdentityProof({
2130
2131
  provider: p.id,
@@ -2600,6 +2601,16 @@ function serviceOf(ctx, params) {
2600
2601
  if (!state(ctx).services.some((s) => s.id === serviceId)) throw new CliError("not_found", `No service ${JSON.stringify(serviceId)} (ghostly service list)`);
2601
2602
  return serviceId;
2602
2603
  }
2604
+ /**
2605
+ * A port the person chose that could not be taken, in words that name it. Before, one in use was Node's EADDRINUSE as
2606
+ * `engine`, and one not allowed read as a file (`localFileError`): "Not allowed to write or read the path".
2607
+ */
2608
+ function portError(error, port) {
2609
+ const { code } = error ?? {};
2610
+ if (port && code === "EADDRINUSE") return new CliError("busy", `Port ${port} is in use on this machine: choose another, or leave out --port`);
2611
+ if (port && (code === "EACCES" || code === "EPERM")) return new CliError("refused", `Port ${port} is not allowed for this user: choose another, or leave out --port`);
2612
+ return error;
2613
+ }
2603
2614
  var SERVICE_METHODS = {
2604
2615
  async "service.list"(ctx) {
2605
2616
  return { services: state(ctx).services.map((s) => ({
@@ -2682,18 +2693,26 @@ var SERVICE_METHODS = {
2682
2693
  const link = chatOf(ctx, params);
2683
2694
  const service = str(params, "service", true);
2684
2695
  const key = `${link.peerPubKeyZ32}/${service}`;
2696
+ const port = num(params, "port", 0, {
2697
+ min: 0,
2698
+ max: 65535,
2699
+ whole: true
2700
+ });
2685
2701
  const already = open$1.get(key);
2686
- if (already) return {
2687
- chat: link.id,
2688
- service,
2689
- url: already.url
2690
- };
2702
+ if (already) {
2703
+ const on = already.server.address().port;
2704
+ if (port && port !== on) throw new CliError("busy", `That service is open here on port ${on}: ghostly service close ${link.id} ${service} first, or leave out --port`);
2705
+ return {
2706
+ chat: link.id,
2707
+ service,
2708
+ url: already.url
2709
+ };
2710
+ }
2691
2711
  if (!link.peerServices?.some((s) => s.id === service)) throw new CliError("not_found", `The contact shares no service ${service} (or is not live)`);
2692
2712
  const peer = link.peerPubKeyZ32;
2693
- const opened = await openServiceServer((request) => node(ctx).request(peer, service, request), num(params, "port", 0, {
2694
- min: 0,
2695
- max: 65535
2696
- }));
2713
+ const opened = await openServiceServer((request) => node(ctx).request(peer, service, request), port).catch((error) => {
2714
+ throw portError(error, port);
2715
+ });
2697
2716
  open$1.set(key, opened);
2698
2717
  return {
2699
2718
  chat: link.id,
@@ -2706,7 +2725,10 @@ var SERVICE_METHODS = {
2706
2725
  const entry = open$1.get(key);
2707
2726
  if (!entry) throw new CliError("not_found", "That service is not open here");
2708
2727
  open$1.delete(key);
2709
- await new Promise((resolve) => entry.server.close(() => resolve()));
2728
+ await new Promise((resolve) => {
2729
+ entry.server.close(() => resolve());
2730
+ entry.server.closeAllConnections();
2731
+ });
2710
2732
  return { closed: key };
2711
2733
  }
2712
2734
  };
@@ -4734,4 +4756,4 @@ async function callApi(ctx, method, params = {}) {
4734
4756
  //#endregion
4735
4757
  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 };
4736
4758
 
4737
- //# sourceMappingURL=api-CD9JbPuA.js.map
4759
+ //# sourceMappingURL=api-tSZELCPQ.js.map