@ghostlytools/cli 1.10.1 → 1.10.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.
- package/README.md +10 -8
- package/SKILL.md +3 -2
- package/dist/assets/{api-BOWLZYXM.js → api-DcE4KylM.js} +2 -2
- package/dist/assets/{api-Bi6hCcwG.js → api-EUGHGnRz.js} +95 -43
- package/dist/assets/api-EUGHGnRz.js.map +1 -0
- package/dist/assets/{apiKit-DzXHZojD.js → apiKit-CJVp_crp.js} +68 -22
- package/dist/assets/apiKit-CJVp_crp.js.map +1 -0
- package/dist/assets/{apps-0Ks6KjqS.js → apps-C-KbyLCa.js} +1 -1
- package/dist/assets/{apps-DIQbzG08.js → apps-C54T_MOT.js} +5 -5
- package/dist/assets/{apps-DIQbzG08.js.map → apps-C54T_MOT.js.map} +1 -1
- package/dist/assets/{arkade-zozCldAE.js → arkade-BmxJTa65.js} +2 -2
- package/dist/assets/{arkade-zozCldAE.js.map → arkade-BmxJTa65.js.map} +1 -1
- package/dist/assets/{backup-BL49Kt-T.js → backup-BxSH5BZG.js} +7 -7
- package/dist/assets/{backup-BL49Kt-T.js.map → backup-BxSH5BZG.js.map} +1 -1
- package/dist/assets/{backup-BvIFcZM7.js → backup-C0Plp-DF.js} +1 -1
- package/dist/assets/{buttons-CAW5v5EE.js → buttons-B-ZJYdo0.js} +6 -6
- package/dist/assets/{buttons-CAW5v5EE.js.map → buttons-B-ZJYdo0.js.map} +1 -1
- package/dist/assets/buttons-DA3wZfG0.js +2 -0
- package/dist/assets/{client-CyApKBEw.js → client-CDa87uYD.js} +3 -3
- package/dist/assets/{client-CyApKBEw.js.map → client-CDa87uYD.js.map} +1 -1
- package/dist/assets/{codec-DqFxxB_q.js → codec-D45W1L8n.js} +2 -2
- package/dist/assets/{codec-DqFxxB_q.js.map → codec-D45W1L8n.js.map} +1 -1
- package/dist/assets/{envelope-CMUgz31I.js → envelope-C3yFCQa-.js} +2 -2
- package/dist/assets/{envelope-CMUgz31I.js.map → envelope-C3yFCQa-.js.map} +1 -1
- package/dist/assets/{errors-R4S2SAEM.js → errors-Dt-ZnyOX.js} +3 -1
- package/dist/assets/errors-Dt-ZnyOX.js.map +1 -0
- package/dist/assets/{fixedHosts-C2hdCfzK.js → fixedHosts-C6nCHjOa.js} +4 -4
- package/dist/assets/{fixedHosts-C2hdCfzK.js.map → fixedHosts-C6nCHjOa.js.map} +1 -1
- package/dist/assets/{groupFiles-BAQIt_bJ.js → groupFiles-DYopNE57.js} +156 -41
- package/dist/assets/groupFiles-DYopNE57.js.map +1 -0
- package/dist/assets/{host-CaRlDMTd.js → host-G5seUwaI.js} +108 -55
- package/dist/assets/host-G5seUwaI.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-BxADl3SG.js → hyperdhtRelay-B_uHjg_r.js} +28 -20
- package/dist/assets/hyperdhtRelay-B_uHjg_r.js.map +1 -0
- package/dist/assets/{irohWeb-D2sh6EWp.js → irohWeb-C-2oslSU.js} +112 -34
- package/dist/assets/{irohWeb-D2sh6EWp.js.map → irohWeb-C-2oslSU.js.map} +1 -1
- package/dist/assets/{main-Bc4Ow56Z.js → main-Dk--nD7X.js} +69 -41
- package/dist/assets/main-Dk--nD7X.js.map +1 -0
- package/dist/assets/{mainline-DWh4Ccri.js → mainline-HPlVrl8R.js} +5 -5
- package/dist/assets/mainline-HPlVrl8R.js.map +1 -0
- package/dist/assets/{networkReason-DT_D_Wpc.js → networkReason-CfpO9ayz.js} +3 -3
- package/dist/assets/{networkReason-DT_D_Wpc.js.map → networkReason-CfpO9ayz.js.map} +1 -1
- package/dist/assets/{nwc-DoSEhUKb.js → nwc-BY7BPttn.js} +3 -3
- package/dist/assets/{nwc-DoSEhUKb.js.map → nwc-BY7BPttn.js.map} +1 -1
- package/dist/assets/{nwcProvider-CGWqUjpB.js → nwcProvider-CfpbNUf7.js} +2 -2
- package/dist/assets/{nwcProvider-CGWqUjpB.js.map → nwcProvider-CfpbNUf7.js.map} +1 -1
- package/dist/assets/{ownDid-CbGjRLBn.js → ownDid-DJFZM2cV.js} +2 -2
- package/dist/assets/{ownDid-CbGjRLBn.js.map → ownDid-DJFZM2cV.js.map} +1 -1
- package/dist/assets/{profiles-DgIfvBeN.js → profiles-DKmZGXp6.js} +13 -6
- package/dist/assets/profiles-DKmZGXp6.js.map +1 -0
- package/dist/assets/{registry-BSyxGjN6.js → registry-BUm4cAzV.js} +54 -15
- package/dist/assets/registry-BUm4cAzV.js.map +1 -0
- package/dist/assets/{registry-C5cn80Rw.js → registry-CAzrtV0_.js} +1 -1
- package/dist/assets/{resolve-D-9YRFhl.js → resolve-CDD4X68j.js} +5 -3
- package/dist/assets/resolve-CDD4X68j.js.map +1 -0
- package/dist/assets/{restoredRows-CRYwIx3g.js → restoredRows-YhlbokEE.js} +4 -2
- package/dist/assets/restoredRows-YhlbokEE.js.map +1 -0
- package/dist/assets/{secretGuard-CSVNxXVW.js → secretGuard-B7Hj0Kvz.js} +2 -2
- package/dist/assets/{secretGuard-CSVNxXVW.js.map → secretGuard-B7Hj0Kvz.js.map} +1 -1
- package/dist/assets/secretGuard-DUr6bgKc.js +2 -0
- package/dist/assets/{server-BufntkX8.js → server-DcOsgYDU.js} +821 -299
- package/dist/assets/server-DcOsgYDU.js.map +1 -0
- package/dist/assets/{src-CCt5s4DK.js → src-D31D1_oY.js} +417 -67
- package/dist/assets/src-D31D1_oY.js.map +1 -0
- package/dist/assets/{sshForges-D8CPaIbR.js → sshForges-DerRwMf3.js} +2 -2
- package/dist/assets/{sshForges-D8CPaIbR.js.map → sshForges-DerRwMf3.js.map} +1 -1
- package/dist/assets/{translate-Cb-6hMhD.js → translate-C-sj0VJe.js} +3 -3
- package/dist/assets/{translate-Cb-6hMhD.js.map → translate-C-sj0VJe.js.map} +1 -1
- package/dist/assets/{usdt-ds461mzA.js → usdt-DwHqp625.js} +3 -3
- package/dist/assets/{usdt-ds461mzA.js.map → usdt-DwHqp625.js.map} +1 -1
- package/dist/assets/{waitNotice-B8D8WhbE.js → waitNotice-D52RWbV4.js} +38 -4
- package/dist/assets/waitNotice-D52RWbV4.js.map +1 -0
- package/dist/assets/{words-B1ylON2h.js → words-Db9WgatT.js} +3 -3
- package/dist/assets/words-Db9WgatT.js.map +1 -0
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/api-Bi6hCcwG.js.map +0 -1
- package/dist/assets/apiKit-DzXHZojD.js.map +0 -1
- package/dist/assets/buttons-oJI5mHSL.js +0 -2
- package/dist/assets/errors-R4S2SAEM.js.map +0 -1
- package/dist/assets/groupFiles-BAQIt_bJ.js.map +0 -1
- package/dist/assets/host-CaRlDMTd.js.map +0 -1
- package/dist/assets/hyperdhtRelay-BxADl3SG.js.map +0 -1
- package/dist/assets/main-Bc4Ow56Z.js.map +0 -1
- package/dist/assets/mainline-DWh4Ccri.js.map +0 -1
- package/dist/assets/profiles-DgIfvBeN.js.map +0 -1
- package/dist/assets/registry-BSyxGjN6.js.map +0 -1
- package/dist/assets/resolve-D-9YRFhl.js.map +0 -1
- package/dist/assets/restoredRows-CRYwIx3g.js.map +0 -1
- package/dist/assets/secretGuard-Q2BKq0q0.js +0 -2
- package/dist/assets/server-BufntkX8.js.map +0 -1
- package/dist/assets/src-CCt5s4DK.js.map +0 -1
- package/dist/assets/waitNotice-B8D8WhbE.js.map +0 -1
- package/dist/assets/words-B1ylON2h.js.map +0 -1
package/README.md
CHANGED
|
@@ -102,7 +102,8 @@ a command that waits (`chat wait`, `file wait`, `--wait`) within its `--timeout`
|
|
|
102
102
|
`details.method`); `ghostly daemon restart` is the way out ([docs/CLI.md](../../docs/CLI.md#what-it-does)). On a
|
|
103
103
|
terminal, a command that waits says on stderr what it waits for once it has waited a second; nothing is said there on
|
|
104
104
|
a pipe. A `<chat>` is
|
|
105
|
-
its id, a unique prefix of it, or its name; a `<group>` too
|
|
105
|
+
its id, a unique prefix of it, or its name; a `<group>` too, each also as `group:<ref>` (every group command,
|
|
106
|
+
`listen --group` and every command that takes a chat or a group). A `<group>` that is one group's name and a prefix of
|
|
106
107
|
another's id is refused (exit 1, `bad_request`, both ids in `details.matches`): use its id.
|
|
107
108
|
|
|
108
109
|
The rows are in alphabetical order of their first command, and every command of `ghostly help` has one
|
|
@@ -127,7 +128,7 @@ The rows are in alphabetical order of their first command, and every command of
|
|
|
127
128
|
| `chat history <chat> [--limit n] [--before x] [--after x] [--translate lang]` | Messages, oldest first; `x` is a message id or a time in ms ([Translation](#translation)) |
|
|
128
129
|
| `chat list [--show-secret]`, `chat show <chat> [--show-secret]` | Chats, and one chat's connection: transports, last attempt, comparison code. A pending chat's `invite` prints as `<hidden>` without `--show-secret` |
|
|
129
130
|
| `chat pay <chat> <sats> [--memo t] [--network n] [--confirm-real]` | Ecash to a contact. A contact that offers no way of paying is `refused`: `details.reason` `contact_no_wallet` (it has no wallet yet) or `contact_payments_off` (it has payments off in this chat, or an older app). With no Cashu wallet of the network on this side, `refused` with `details.reason` `no_wallet` and the `wallet create` command to run; with one too short of sats, `refused`. It names its chat by the chat's id, its contact's key or a label given here, never only by the contact's own name or a prefix of its id |
|
|
130
|
-
| `chat rename <chat> <name>`, `chat remove <chat> --yes` | Name it here; delete it (keys and history) here, refused (`busy`) while a call is on in it: hang the call up first |
|
|
131
|
+
| `chat rename <chat> <name>`, `chat remove <chat> --yes` | Name it here (up to 48 characters, counted as stored: a tab or a line break is a space and invisible characters go, so a name with nothing that shows is refused; an empty name gives back the contact's own); delete it (keys and history) here, refused (`busy`) while a call is on in it: hang the call up first |
|
|
131
132
|
| `chat request <chat> <sats> [--memo t] [--method m] [--rail r]`, `chat pay-request <chat> <payment>` | Ask a contact to pay; pay the contact's request. Refused as `chat pay` is when the contact offers no way of paying, or when `chat request` has no Cashu wallet of the network here (`no_wallet`). `chat pay-request` names its chat by the chat's id, its contact's key or a label given here, never only by the contact's own name or a prefix of its id |
|
|
132
133
|
| `chat transport <chat> <auto\|dht\|webrtc\|iroh\|hyperdht>` | What carries the chat |
|
|
133
134
|
| `chat verify <chat> --code <code>` | Mark the contact verified after comparing the codes out of band |
|
|
@@ -147,7 +148,7 @@ The rows are in alphabetical order of their first command, and every command of
|
|
|
147
148
|
| `group hub <group> <member> [--pin \| --exclude \| --auto]` | Past 16 members: pin a member as a hub, keep one from being a hub, or leave it to their app (a daemon offers itself) |
|
|
148
149
|
| `group invite <group> <chat>`, `group remove <group> <member>`, `group admin <group> <member>` | Membership, for the admin (each prints the group; `--show-secret` for its link). `group invite` names its chat by the chat's id, its contact's key or a label given here, never only by the contact's own name or a prefix of its id |
|
|
149
150
|
| `group leave <group> --yes`, `group forget <group> --yes`, `group accept\|decline <group>` | Membership. Leaving deletes the group's history and files on this device, so it asks for `--yes` (`confirm`, exit 5, without it), as `group forget` does; forget also deletes a group you were removed from, which keeps its history. An admin's leave hands the role to a member who is online and names them: `{left, admin: {key, name}}` |
|
|
150
|
-
| `group list [--show-secret]`, `group show <group> [--show-secret]`, `group history <group>` | Groups, members, history; a message names its author (`member` key, `nick` from the roster, or the name an author no longer in it had). The entry link prints as `<hidden>` without `--show-secret` |
|
|
151
|
+
| `group list [--show-secret]`, `group show <group> [--show-secret]`, `group history <group>` | Groups, members, history; a message names its author (`member` key, `nick` from the roster, or the name an author no longer in it had). The entry link prints as `<hidden>` without `--show-secret`. `others` (only when there are some): other groups that came under the same id, kept beside it until you pick, each a contact's invitation (`chat`, `name`, `members`) or a link opened (`link`, hidden the same way); `engine keepGroup '{"groupId":"<id>"}'` keeps the one shown, `engine switchGroup '{"groupId":"<id>","to":"<chat or link>"}'` takes another |
|
|
151
152
|
| `group react <group> <message> <emoji> [--remove]` | React to a group's message. `refused` when the profile is not a member any more |
|
|
152
153
|
| `group rename <group> <name> [--force]` | A new name, for the admin (1 to 64 characters on one line; one that looks like a secret needs `--force`, as for `group create`); the picture stays. Members see it once it reaches them; until then, and on apps from before names, the group keeps the name it had when they got in |
|
|
153
154
|
| `group rotate <group>`, `group link <group> [--off] [--reset]`, `group picture <group> <jpeg> \| --clear` | A fresh secret; the link (printed: asking for it is asking for the secret); the picture |
|
|
@@ -161,7 +162,7 @@ The rows are in alphabetical order of their first command, and every command of
|
|
|
161
162
|
| `invite join [<invite-or-link> \| -] [--label <name>]` | Join a chat (your own invite is refused). The invite comes from stdin when none is given or `-`, out of `ps` and the shell's history; on the command line the CLI warns |
|
|
162
163
|
| `lightning default <card>`, `lightning rename <card> <name>` | Lightning cards: which receives by default |
|
|
163
164
|
| `listen [--since seq] [--cursor file] [--type t]… [--turns] [--from <chat\|key>]… [--group <group>]… [--exec cmd] [--webhook url] [--print] [--translate lang]` | The event stream; `--from` and `--group` an allowlist, `--turns` one `agent.turn` per message to answer, `--translate` a translation of received messages ([Events](#events), [Translation](#translation)) |
|
|
164
|
-
| `message delete <chat\|group> <message> --everyone [--wait none\|confirmed] [--timeout s]` | Deletes a message of yours for everyone (a text, a card, a file or a voice message; never a payment): it goes from this device at once and from every member's as the message's last edit, once they are back if they are away. An app from before this shows "🗑 Message removed" in its place. In a chat, `--wait confirmed` waits for the contact's app to confirm (the default without a daemon, which is offline once the command ends), and the answer's `confirmed` says whether it did. Without `--everyone`, only this device forgets it. Answers the chat or group, the message's `messageId` and `everyone` (`deleted` says the same id, kept for callers that read it) |
|
|
165
|
+
| `message delete <chat\|group> <message> --everyone [--wait none\|confirmed\|sent] [--timeout s]` | Deletes a message of yours for everyone (a text, a card, a file or a voice message; never a payment): it goes from this device at once and from every member's as the message's last edit, once they are back if they are away. An app from before this shows "🗑 Message removed" in its place. In a chat, `--wait confirmed` waits for the contact's app to confirm (the default without a daemon, which is offline once the command ends), and the answer's `confirmed` says whether it did. In a group (no receipts), `--wait sent` waits until a member's edge (a hub's, in a community) took the removal, the default without a daemon, and the answer's `edges` and `sent` say how many did, as for `group send`. Without `--everyone`, only this device forgets it. Answers the chat or group, the message's `messageId` and `everyone` (`deleted` says the same id, kept for callers that read it) |
|
|
165
166
|
| `message retry\|delete\|details <chat> <message>` | One message |
|
|
166
167
|
| `pay <invoice\|address\|lnurl> [--amount sats] [--network n] [--max-fee sats] [--chat <chat>] [--confirm-real]` | Pay over Lightning (Testnet unless `--network mainnet`). `--chat`: the chat the invoice came from, whose contact is told a Testnet invoice was paid, named by the chat's id, its contact's key or a label given here, never only by the contact's own name or a prefix of its id |
|
|
167
168
|
| `payment list [--chat c]`, `payment check <chat> <payment>`, `payment reclaim <payment>` | Payments and requests |
|
|
@@ -169,7 +170,7 @@ The rows are in alphabetical order of their first command, and every command of
|
|
|
169
170
|
| `profile backup --out <file>`, `profile restore <file> <new profile>` | A backup (WISP 05 envelope, written and read a piece at a time), encrypted with the passphrase from `--passphrase-file` or `GHOSTLY_BACKUP_PASSPHRASE`. `--no-passphrase` makes one that is not encrypted: the file then holds the profile's keys and wallet secrets in the clear. Neither given, nothing is made. `--light` leaves out files over 1 MB (voice messages over 4 MB): their messages stay, and the restored copy says each one is not in this backup |
|
|
170
171
|
| `profile create <name> [--use] [--name <shown>] [--force]`, `profile list`, `profile use <name>` | Profiles |
|
|
171
172
|
| `profile picture <jpeg> \| --clear` | The picture contacts see (a JPEG within 512 px; 128 px is what the app sends) |
|
|
172
|
-
| `profile show`, `profile set [--name <name>] [--share-profile \| --no-share-profile] [--force]` | The name contacts see (one that looks like a secret needs `--force`) |
|
|
173
|
+
| `profile show`, `profile set [--name <name>] [--share-profile \| --no-share-profile] [--force]` | The name contacts see (up to 64 characters, cleaned as a chat's or a group's name is; empty is no name; one that looks like a secret needs `--force`) |
|
|
173
174
|
| `react <chat> <message> <emoji> [--remove] [--wait none\|confirmed] [--timeout s]` | React to a message with one emoji; a new one replaces yours, `--remove` takes it back. Without a daemon it stays until the contact confirmed it (`--wait confirmed`, the default there; `--timeout`, 30 s): a one-shot that left at once took the reaction along unsaid. `confirmed` says whether the contact has it |
|
|
174
175
|
| `routine send <chat\|group> --name <name> --schedule "every day 01:00" [--cron "0 1 * * *"] [--state active\|paused] [--next <time>] [--run ok\|failed\|skipped[:summary]] [--link url]… [--id id] [--text <text>] [--json json\|-\|file] [--force]`, `routine update <chat\|group> <routine> [fields…]` | A routine card for something a bot runs on a schedule (WISP 405 · Status Cards): its name, schedule (and cron line, shown only), state, last run and result, next run and up to 10 recent runs. `--run` records a run now as the last one; `--next` takes milliseconds or a date within a year (no zone: local time, a bare `2026-09-30` local midnight; `Z` or `+02:00` as given). Updates merge and are paced as `task update`'s, and wait as `task send` and `task update` do. The app shows it, and runs nothing |
|
|
175
176
|
| `saved add\|remove <chat\|group> <message>`, `saved list` | Saved messages: mark a message of a chat or a group to find it again, kept for this profile on this device and never sent (the app shows the same list in its Saved view). `saved list` gives them under `saved`, the last saved first, each as it is now (an edit shows its latest text) with its `chat` or `group` and `savedAt`; a deleted message drops out |
|
|
@@ -277,7 +278,8 @@ A spend on Mainnet needs the engine's `confirmedReal` (the app asks the person).
|
|
|
277
278
|
|
|
278
279
|
SSH (`ssh-keygen`), OpenPGP (`gpg`) and Bitcoin (a wallet's "sign message") proofs are made with the tool: `identity
|
|
279
280
|
add` prints the statement and the command, `identity complete` takes its output. A domain or a DID publishes a record,
|
|
280
|
-
then `identity complete` asks the engine to look it up.
|
|
281
|
+
then `identity complete` asks the engine to look it up. The last of the steps `identity add` answers is that `identity
|
|
282
|
+
complete` command, with its draft (the app's "press Check" and "paste it into Ghostly" point to it). In-app signers (a Nostr signer over NIP-46, Pubky) run in one
|
|
281
283
|
`identity add`, with their fields in `--field` (a NIP-46 `bunker://` link on stdin: `printf 'bunker=%s\n' "$LINK" | ghostly
|
|
282
284
|
identity add nostr --signer nip46 --stdin`), and print what they wait on (a link, a code) to stderr. OpenID Connect,
|
|
283
285
|
AT Protocol and a NIP-07 browser extension need a browser window: make those proofs in the app. `identity providers`
|
|
@@ -324,7 +326,7 @@ chat (`chat list`, `chat show`, `chat rename`, …) and `engine getState` print
|
|
|
324
326
|
file that holds no event number (empty, edited by hand) is refused at start (`bad_request`, naming the file): fix or
|
|
325
327
|
remove it, or give `--since`.
|
|
326
328
|
- Types: `daemon.started`, `chat.created`, `chat.removed`, `chat.renamed`, `chat.pairing` (`stage`: publishing,
|
|
327
|
-
waiting, resolving, on-dht, live, …), `chat.connection` (`live`, `transport`), `typing.started` (with `kind` and, when given, `status`; again when either changes) and `typing.stopped` (the contact is writing, or stopped: a message, a stop, or 6 s of silence), `chat.joined` (the contact's app
|
|
329
|
+
waiting, resolving, on-dht, live, …), `chat.connection` (`live`, `transport`), `typing.started` (with `kind` and, when given, `status`; again when either changes) and `typing.stopped` (the contact is writing, or stopped: a message, a stop, or 6 s of silence; live only, as `group.typing.*`: never in the journal, so `--since` does not replay them), `chat.joined` (the contact's app
|
|
328
330
|
announced itself, once; not a message: a later message of theirs in the same words is `message.received`), `chat.announced`, `message.received` (`message.nick`: the name the contact gave), `message.sent`, `message.delivery`
|
|
329
331
|
(`delivery`: sending, queued, waiting, held, sent, delivered, failed), `message.edited` (a text changed in place, the
|
|
330
332
|
contact's or mine: once per edit number, with `edits` and the message as it is now; `group.message.edited` in a group), `message.deleted` (`{chat, messageId}`: a message gone from this device, deleted here or for everyone by its author; `group.deleted` with `group` in a group), `group.created`,
|
|
@@ -370,7 +372,7 @@ chat (`chat list`, `chat show`, `chat rename`, …) and `engine getState` print
|
|
|
370
372
|
- `--type message.received` keeps one type; `--type message` (or `message.`, `message.*`) a family. A family deeper
|
|
371
373
|
down ends in "." (`group.typing.`): `group.message` is that type alone.
|
|
372
374
|
- `--from <chat|key>` and `--group <group>` (again for more): an allowlist. Only the chats (id, a label given here,
|
|
373
|
-
or the contact's `peer` key, which also matches a chat made later) and groups (id, prefix or name
|
|
375
|
+
or the contact's `peer` key, which also matches a chat made later) and groups (id, prefix or name, or `group:<id>`; one that fits more than one group is refused) named get through;
|
|
374
376
|
a prefix of a chat's id or the name its contact gave itself is refused (another contact could call itself that:
|
|
375
377
|
name the chat first with `chat rename`); any other chat's or
|
|
376
378
|
group's event stops before `--exec`, `--webhook` and stdout (the message stays in the chat; the cursor moves past
|
package/SKILL.md
CHANGED
|
@@ -121,7 +121,8 @@ chat; a `<chat>` is its id, a unique prefix of it, or its name.
|
|
|
121
121
|
|
|
122
122
|
Names are for people at a terminal. A contact chooses its own name, a group's admin its group's name and a member its
|
|
123
123
|
name in a group, so in a script or an agent keep the **id** (`chat` and `group` in every answer and event, a member's
|
|
124
|
-
key) and address by it: `<chat id>`, `group:<group id
|
|
124
|
+
key) and address by it: `<chat id>`, `group:<group id>` (every command that takes a group, `listen --group` too),
|
|
125
|
+
`<member key>`. Where a command takes a chat or a group, a
|
|
125
126
|
name that a contact gave itself and that also names one of your groups is refused (exit 1, `bad_request`) and both ids are shown.
|
|
126
127
|
So is a `<group>` that is one group's name and a prefix of another's id.
|
|
127
128
|
|
|
@@ -329,7 +330,7 @@ ghostly chat connect alice # back now
|
|
|
329
330
|
|
|
330
331
|
Plain events, without `--turns`: `ghostly listen --type message.received` (one JSON object per line). Useful types:
|
|
331
332
|
`message.received`, `message.delivery`, `message.edited`, `chat.joined`, `chat.connection`, `group.message` (with
|
|
332
|
-
`message.mentioned: true` when it names the agent), `group.members`, `typing.started` / `typing.stopped` (`group.typing.*` with `member` in a private group),
|
|
333
|
+
`message.mentioned: true` when it names the agent), `group.members`, `typing.started` / `typing.stopped` (`group.typing.*` with `member` in a private group; live only, never replayed),
|
|
333
334
|
`message.reaction` / `group.reaction`, `file.done` / `file.failed`, `payment.created` / `payment.updated`,
|
|
334
335
|
`call.incoming`. The full list: the package README.
|
|
335
336
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
1
|
+
import { l as findGroup, s as findChat, x as startNamedChats } from "./apiKit-CJVp_crp.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-EUGHGnRz.js";
|
|
3
3
|
export { API_METHODS, SETTABLE, callApi, findChat, findGroup, groupSendRefused, hideStateSecrets, mentionsFor, redactSettings, startNamedChats };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Aa as downsamplePeaks, Al as readImageMeta, Bn as NO_PICTURE_METADATA, Da as VOICE_LIMITS, Do as claimedTime, Ea as PLAYABLE_AUDIO, Ii as identityStatement, Jr as TYPING_REFRESH_MS, Kl as ownInviteRefusal, Ko as AWAITING_PEER_MS, Ku as MAX_AVATAR_LENGTH, Ma as parseVoiceMeta, Na as voiceDownloadName, Oa as VOICE_METER, Ou as normalizeRelayUrl, Pa as voiceLevel, Sl as isAppRef, So as checkStatusCard, Ta as sanitizeMime, Un as stripPictureMetadata, Wl as inviteLink, Wn as withoutPictureMetadata, Xr as sanitizeTypingStatus, Z as groupName, _l as appRef, _o as appCardId, bo as cardLine, ed as randomBytes$1, es as GhostlyHttpError, gi as APP_DATA_MAX_BYTES, ho as STATUS_CARD_LIMITS, il as APP_PERMISSIONS, is as LIMITS, ka as baseMime, ku as relayUrlProblem, ll as isAppUrl, nr as GROUP_FILE_LIMITS, ns as parseLocalTarget, oo as replySnippet, qr as TYPING_KINDS, qu as sanitizeAvatar, td as toBase64Url, vo as appCardUrl, wa as sanitizeFileName, wo as statusCardBytes, zn as withoutVideoMetadata } from "./src-D31D1_oY.js";
|
|
2
2
|
import { u as fileStore } from "./idb-BHsAqENE.js";
|
|
3
|
-
import {
|
|
3
|
+
import { O as waitingGroupFile, T as removeStored, X as iceServerSetting, Y as iceServerProblem, i as groupOfFile, k as IDENTITY_DRAFT_TTL_MS, l as replyRef, n as groupFileId, v as paymentNetwork } from "./groupFiles-DYopNE57.js";
|
|
4
4
|
import { f as FILE_BYTES_STEP, o as fileBytes, s as fileBytesOf } from "./fileBytes-DjBYYyXT.js";
|
|
5
|
-
import { t as IDENTITY_PROVIDERS } from "./registry-
|
|
6
|
-
import { n as secretWords, r as findSecret, t as guardText } from "./secretGuard-
|
|
7
|
-
import { i as localFileError, r as asCliError, t as CliError } from "./errors-
|
|
8
|
-
import { a as WALLET_TYPES, c as DESTRUCTIVE_CALLS, d as ENGINE_READS, f as READ_PARAMS, i as TRANSPORT_NAMES, l as ENGINE_METHODS, m as engineParamsProblem, n as CHAT_METHODS, r as PAY_METHODS, s as withStoredIds, t as ADDRESS_TYPES, u as ENGINE_PARAMS } from "./words-
|
|
9
|
-
import { C as
|
|
5
|
+
import { t as IDENTITY_PROVIDERS } from "./registry-BUm4cAzV.js";
|
|
6
|
+
import { n as secretWords, r as findSecret, t as guardText } from "./secretGuard-B7Hj0Kvz.js";
|
|
7
|
+
import { i as localFileError, r as asCliError, t as CliError } from "./errors-Dt-ZnyOX.js";
|
|
8
|
+
import { a as WALLET_TYPES, c as DESTRUCTIVE_CALLS, d as ENGINE_READS, f as READ_PARAMS, i as TRANSPORT_NAMES, l as ENGINE_METHODS, m as engineParamsProblem, n as CHAT_METHODS, r as PAY_METHODS, s as withStoredIds, t as ADDRESS_TYPES, u as ENGINE_PARAMS } from "./words-Db9WgatT.js";
|
|
9
|
+
import { C as str, S as state, T as waitForState, _ as node, a as cleanName, b as sentAt, c as findChatOrGroup, d as groupOf, f as groupPrefixed, h as messageOf, i as chatOrGroup, l as findGroup, m as list, n as bool, o as dhtOnly, p as inviteTaken, r as chatOf, s as findChat, u as findOwnNamedChat, v as num, w as transportOffered, y as oneOf } from "./apiKit-CJVp_crp.js";
|
|
10
10
|
import { t as childEnv } from "./childEnv-BVOQK9EA.js";
|
|
11
|
-
import { a as checkShownName } from "./profiles-
|
|
12
|
-
import { a as waitForConfirmed, c as waitForMessage, i as pressable, l as waitForRemoval, n as buttonsCard, o as waitForEdit, s as waitForGroupFrame, t as BUTTON_METHODS } from "./buttons-
|
|
13
|
-
import { t as BACKUP_METHODS } from "./backup-
|
|
14
|
-
import { o as checkedBundle } from "./apps-
|
|
11
|
+
import { a as checkShownName } from "./profiles-DKmZGXp6.js";
|
|
12
|
+
import { a as waitForConfirmed, c as waitForMessage, i as pressable, l as waitForRemoval, n as buttonsCard, o as waitForEdit, s as waitForGroupFrame, t as BUTTON_METHODS } from "./buttons-B-ZJYdo0.js";
|
|
13
|
+
import { t as BACKUP_METHODS } from "./backup-BxSH5BZG.js";
|
|
14
|
+
import { o as checkedBundle } from "./apps-C54T_MOT.js";
|
|
15
15
|
import { generateMnemonic } from "@scure/bip39";
|
|
16
16
|
import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
17
17
|
import { execFile, spawn } from "node:child_process";
|
|
@@ -2066,6 +2066,11 @@ function groupJson(group, showSecret = false) {
|
|
|
2066
2066
|
viaLink: !!group.invitation.viaLink,
|
|
2067
2067
|
stage: group.invitation.stage ?? null
|
|
2068
2068
|
} : null,
|
|
2069
|
+
...group.others?.length ? { others: group.others.map((o) => "link" in o ? { link: showSecret ? o.link : "<hidden>" } : {
|
|
2070
|
+
chat: o.linkId,
|
|
2071
|
+
name: o.name,
|
|
2072
|
+
members: o.members
|
|
2073
|
+
}) } : {},
|
|
2069
2074
|
community: group.community ?? null,
|
|
2070
2075
|
picture: !!group.picture,
|
|
2071
2076
|
pin: pinJson(group.pin)
|
|
@@ -2133,7 +2138,7 @@ var view = (ctx, id, params) => groupJson(state(ctx).groups.find((g) => g.id ===
|
|
|
2133
2138
|
var GROUP_ADMIN_METHODS = {
|
|
2134
2139
|
async "group.invite"(ctx, params) {
|
|
2135
2140
|
const group = groupOf(ctx, params);
|
|
2136
|
-
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
|
|
2141
|
+
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
|
|
2137
2142
|
await node(ctx).inviteToGroup({
|
|
2138
2143
|
groupId: group.id,
|
|
2139
2144
|
linkId: link.id
|
|
@@ -2173,7 +2178,8 @@ var GROUP_ADMIN_METHODS = {
|
|
|
2173
2178
|
},
|
|
2174
2179
|
async "group.rename"(ctx, params) {
|
|
2175
2180
|
const group = groupOf(ctx, params, "chat rename <chat> <name...>");
|
|
2176
|
-
const
|
|
2181
|
+
const clean = cleanName(str(params, "name", true), 64);
|
|
2182
|
+
const name = clean && groupName(clean);
|
|
2177
2183
|
if (!name) throw new CliError("bad_request", `A group's name is 1 to 64 characters on one line`);
|
|
2178
2184
|
guardText(name, bool(params, "force"), "group's name", "rename it");
|
|
2179
2185
|
await node(ctx).renameGroup({
|
|
@@ -2257,12 +2263,32 @@ function signerOf(p, id) {
|
|
|
2257
2263
|
}
|
|
2258
2264
|
return found;
|
|
2259
2265
|
}
|
|
2260
|
-
|
|
2266
|
+
var keep = (verb) => verb[0] === verb[0].toUpperCase() ? "Keep" : "keep";
|
|
2267
|
+
/**
|
|
2268
|
+
* The app's words for its own Check button and paste field, in the CLI's: what was pasted is kept for the last step,
|
|
2269
|
+
* `identity complete`. The steps stay the app's otherwise (a wallet's "paste the statement" is the wallet's field).
|
|
2270
|
+
*/
|
|
2271
|
+
var APP_WORDS = [
|
|
2272
|
+
[/press Check/g, () => "finish it with the last step"],
|
|
2273
|
+
[/\b(paste|copy) (it|the [\w ]+?) into Ghostly/gi, (_, verb, what) => `${keep(verb)} ${what} for the last step`],
|
|
2274
|
+
[/\b(paste) (?=what it prints|the whole signature it prints|the <file>\.sig it writes)/gi, (_, verb) => `${keep(verb)} `]
|
|
2275
|
+
];
|
|
2276
|
+
var inCliWords = (text) => APP_WORDS.reduce((t, [pattern, words]) => t.replace(pattern, words), text);
|
|
2277
|
+
/** The signer's steps, then the CLI's own last one: `identity complete` with this draft, then `identity share`. */
|
|
2278
|
+
function instructionsJson(signer, i, draftId) {
|
|
2279
|
+
const share = "It answers the proof; show it to a contact with ghostly identity share <chat> <id>.";
|
|
2280
|
+
const last = signer.kind === "publish" ? {
|
|
2281
|
+
text: `Once it is published, check it from here: the engine looks it up. ${share}`,
|
|
2282
|
+
copy: `ghostly identity complete ${draftId}`
|
|
2283
|
+
} : {
|
|
2284
|
+
text: `Then finish it with what you kept${i.paste ? ` (${i.paste.label})` : ""}, from a file or piped to it (… | ghostly identity complete ${draftId}). ${share}`,
|
|
2285
|
+
copy: `ghostly identity complete ${draftId} --evidence-file <file>`
|
|
2286
|
+
};
|
|
2261
2287
|
return {
|
|
2262
|
-
steps: i.steps.map((s) => ({
|
|
2263
|
-
text: s.text,
|
|
2288
|
+
steps: [...i.steps.map((s) => ({
|
|
2289
|
+
text: inCliWords(s.text),
|
|
2264
2290
|
...s.copy ? { copy: s.copy } : {}
|
|
2265
|
-
})),
|
|
2291
|
+
})), last],
|
|
2266
2292
|
...i.paste ? { paste: i.paste.label } : {}
|
|
2267
2293
|
};
|
|
2268
2294
|
}
|
|
@@ -2278,6 +2304,11 @@ function proofJson(p) {
|
|
|
2278
2304
|
...p.publicUri ? { publicUri: p.publicUri } : {}
|
|
2279
2305
|
};
|
|
2280
2306
|
}
|
|
2307
|
+
/** Where the CLI takes a signer's field: a secret (a bunker:// link) on stdin first, kept out of ps and the shell's history. */
|
|
2308
|
+
function howToGive(field) {
|
|
2309
|
+
const stdin = `on stdin (--stdin, a ${field.name}=... line)`, flag = `--field ${field.name}=...`;
|
|
2310
|
+
return field.kind === "secret" ? `give it ${stdin}, or ${flag}` : `give it with ${flag}, or ${stdin}`;
|
|
2311
|
+
}
|
|
2281
2312
|
function pruneDrafts(now = Date.now()) {
|
|
2282
2313
|
for (const [id, draft] of drafts) if (now - draft.createdAt > 18e5) drafts.delete(id);
|
|
2283
2314
|
}
|
|
@@ -2335,7 +2366,7 @@ var IDENTITY_METHODS = {
|
|
|
2335
2366
|
if (signer.kind === "in-app") {
|
|
2336
2367
|
const values = params.fields ?? {};
|
|
2337
2368
|
if (typeof values !== "object" || Array.isArray(values) || Object.values(values).some((v) => typeof v !== "string")) throw new CliError("bad_request", "fields must be an object of strings");
|
|
2338
|
-
for (const field of signer.fields ?? []) if (!field.optional && !values[field.name]) throw new CliError("
|
|
2369
|
+
for (const field of signer.fields ?? []) if (!field.optional && !values[field.name]) throw new CliError("usage", `${signer.label} needs ${field.name} (${field.label}): ${howToGive(field)}`);
|
|
2339
2370
|
const seconds = num(params, "timeout", 300, {
|
|
2340
2371
|
min: 5,
|
|
2341
2372
|
max: 3600
|
|
@@ -2409,7 +2440,7 @@ var IDENTITY_METHODS = {
|
|
|
2409
2440
|
provider: p.id,
|
|
2410
2441
|
signer: signer.id,
|
|
2411
2442
|
statement: statement.text,
|
|
2412
|
-
instructions: instructionsJson(signer.instructions(statement)),
|
|
2443
|
+
instructions: instructionsJson(signer, signer.instructions(statement), draftId),
|
|
2413
2444
|
expiresInSeconds: IDENTITY_DRAFT_TTL_MS / 1e3
|
|
2414
2445
|
};
|
|
2415
2446
|
},
|
|
@@ -2455,7 +2486,7 @@ var IDENTITY_METHODS = {
|
|
|
2455
2486
|
return { removed: id };
|
|
2456
2487
|
},
|
|
2457
2488
|
async "identity.share"(ctx, params) {
|
|
2458
|
-
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
|
|
2489
|
+
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
|
|
2459
2490
|
const id = str(params, "id", true);
|
|
2460
2491
|
if (!state(ctx).identityProofs.some((p) => p.id === id)) throw new CliError("not_found", `No identity proof ${JSON.stringify(id)} (ghostly identity list)`);
|
|
2461
2492
|
await node(ctx).shareIdentityProof({
|
|
@@ -2468,7 +2499,7 @@ var IDENTITY_METHODS = {
|
|
|
2468
2499
|
};
|
|
2469
2500
|
},
|
|
2470
2501
|
async "identity.withdraw"(ctx, params) {
|
|
2471
|
-
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
|
|
2502
|
+
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
|
|
2472
2503
|
const id = str(params, "id", true);
|
|
2473
2504
|
if (!link.identities?.shared.some((s) => s.id === id)) throw new CliError("not_found", `No identity proof ${JSON.stringify(id)} shared in this chat (ghostly identity contact ${link.id})`);
|
|
2474
2505
|
await node(ctx).withdrawIdentityProof({
|
|
@@ -2865,7 +2896,7 @@ var SERVICE_METHODS = {
|
|
|
2865
2896
|
};
|
|
2866
2897
|
},
|
|
2867
2898
|
async "service.share"(ctx, params) {
|
|
2868
|
-
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
|
|
2899
|
+
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
|
|
2869
2900
|
const shared = !bool(params, "off");
|
|
2870
2901
|
const serviceId = serviceOf(ctx, params);
|
|
2871
2902
|
await node(ctx).setServiceShared({
|
|
@@ -3620,7 +3651,7 @@ var WALLET_METHODS = Object.fromEntries(Object.entries({
|
|
|
3620
3651
|
let n;
|
|
3621
3652
|
let note;
|
|
3622
3653
|
if (params.chat !== void 0 && !isInvoice(text)) throw new CliError("usage", "--chat names the chat an invoice came from: an address's or LNURL's invoice is its server's");
|
|
3623
|
-
const chat = params.chat === void 0 ? void 0 : findOwnNamedChat(state(ctx).links, str(params, "chat", true));
|
|
3654
|
+
const chat = params.chat === void 0 ? void 0 : findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
|
|
3624
3655
|
if (chat) inviteTaken(chat);
|
|
3625
3656
|
if (isInvoice(text)) n = network(params);
|
|
3626
3657
|
else if (isLnurl(text)) {
|
|
@@ -3672,7 +3703,7 @@ var WALLET_METHODS = Object.fromEntries(Object.entries({
|
|
|
3672
3703
|
/** Ecash to a contact in a chat (the payment sheet's Pay). */
|
|
3673
3704
|
async "chat.pay"(ctx, params) {
|
|
3674
3705
|
const memo = memoOf(params, "pay");
|
|
3675
|
-
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
|
|
3706
|
+
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
|
|
3676
3707
|
inviteTaken(link);
|
|
3677
3708
|
const amount = num(params, "amount", 0, { min: 1 });
|
|
3678
3709
|
if (!amount) throw new CliError("bad_request", "amount is required");
|
|
@@ -3723,7 +3754,7 @@ var WALLET_METHODS = Object.fromEntries(Object.entries({
|
|
|
3723
3754
|
},
|
|
3724
3755
|
/** Pays a request the contact made in a chat. */
|
|
3725
3756
|
async "chat.payRequest"(ctx, params) {
|
|
3726
|
-
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
|
|
3757
|
+
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
|
|
3727
3758
|
const paymentId = str(params, "payment", true);
|
|
3728
3759
|
const request = state(ctx).payments[paymentId];
|
|
3729
3760
|
if (!request || request.linkId !== link.id || request.kind !== "request") throw new CliError("not_found", `No request ${paymentId} in this chat`);
|
|
@@ -3874,17 +3905,21 @@ function relayRefused(error, patch) {
|
|
|
3874
3905
|
].filter((key) => Object.hasOwn(patch, key));
|
|
3875
3906
|
return new CliError("bad_request", `${keys.join(", ") || "relays"}: ${error.message.replace(/^Enter /, "give ").replace(/^(Not|Use) /, (word) => word.toLowerCase())}`);
|
|
3876
3907
|
}
|
|
3877
|
-
/** The engine keeps a chat's name to 48
|
|
3878
|
-
var
|
|
3908
|
+
/** The engine keeps a chat's name to 48 characters (code points: `renameLink`). */
|
|
3909
|
+
var CHAT_NAME_LENGTH = 48;
|
|
3879
3910
|
/**
|
|
3880
|
-
* A chat's name on this side (`chat rename`, an invite's `--label`)
|
|
3881
|
-
*
|
|
3882
|
-
*
|
|
3911
|
+
* A chat's name on this side (`chat rename`, an invite's `--label`), as the engine stores it (`cleanName`): a tab or a
|
|
3912
|
+
* line break is a space, invisible characters go, and what is left is counted. Longer than the engine keeps whole is
|
|
3913
|
+
* refused, not cut. An empty name (or spaces) is the documented one of `chat rename` (the contact's own name) and no
|
|
3914
|
+
* label for an invite; a name with nothing that shows is refused: given as is, the engine cleared the chat's name.
|
|
3883
3915
|
*/
|
|
3884
3916
|
function chatName(params, name) {
|
|
3885
3917
|
const value = str(params, name);
|
|
3886
|
-
if (value
|
|
3887
|
-
|
|
3918
|
+
if (value === void 0 || !value.trim()) return value === void 0 ? void 0 : "";
|
|
3919
|
+
const clean = cleanName(value, CHAT_NAME_LENGTH);
|
|
3920
|
+
if (clean === void 0) throw new CliError("bad_request", `A chat's name is up to ${CHAT_NAME_LENGTH} characters on one line`);
|
|
3921
|
+
if (!clean) throw new CliError("bad_request", `A chat's name needs a character that shows (an empty name gives back the contact's own)`);
|
|
3922
|
+
return clean;
|
|
3888
3923
|
}
|
|
3889
3924
|
/** Code points before `index` (UTF-16) in `text`: mentions count code points (WISP 902 § Mentions). */
|
|
3890
3925
|
var codePoints = (text, index) => [...text.slice(0, index)].length;
|
|
@@ -4038,6 +4073,7 @@ var METHODS = {
|
|
|
4038
4073
|
if (kind === "strings" && !(Array.isArray(value) && value.every((v) => typeof v === "string"))) throw new CliError("bad_request", `${key} must be a list of strings`);
|
|
4039
4074
|
if (kind === "string" && typeof value !== "string") throw new CliError("bad_request", `${key} must be a string`);
|
|
4040
4075
|
if (kind === "boolean" && typeof value !== "boolean") throw new CliError("bad_request", `${key} must be true or false`);
|
|
4076
|
+
if (key === "relays" && value.length && !value.some(normalizeRelayUrl)) throw relayRefused(new Error(relayUrlProblem(value[0]) ?? ""), { relays: value });
|
|
4041
4077
|
if (key === "nick") {
|
|
4042
4078
|
patch.nick = checkShownName(value, key);
|
|
4043
4079
|
guardText(patch.nick, bool(params, "force"), "nick", "set it");
|
|
@@ -4410,8 +4446,13 @@ var METHODS = {
|
|
|
4410
4446
|
async "chat.delete"(ctx, params) {
|
|
4411
4447
|
if (bool(params, "everyone")) {
|
|
4412
4448
|
const target = chatOrGroup(ctx, str(params, "chat", true));
|
|
4413
|
-
const wait = oneOf(params, "wait", [
|
|
4414
|
-
|
|
4449
|
+
const wait = oneOf(params, "wait", [
|
|
4450
|
+
"none",
|
|
4451
|
+
"confirmed",
|
|
4452
|
+
"sent"
|
|
4453
|
+
], ctx.mode !== "one-shot" ? "none" : target.group ? "sent" : "confirmed");
|
|
4454
|
+
if (target.group && wait === "confirmed") throw new CliError("bad_request", "A group has no receipts: --wait confirmed is for a chat (--wait sent waits until a member's edge took it)");
|
|
4455
|
+
if (!target.group && wait === "sent") throw new CliError("bad_request", "--wait sent is for a group: a chat's removal waits with --wait confirmed");
|
|
4415
4456
|
const ms = num(params, "timeout", 30, {
|
|
4416
4457
|
min: 1,
|
|
4417
4458
|
max: 3600
|
|
@@ -4424,12 +4465,22 @@ var METHODS = {
|
|
|
4424
4465
|
messageId: message.id
|
|
4425
4466
|
});
|
|
4426
4467
|
if (result.error) throw new CliError(result.refused ? "refused" : "unavailable", result.error);
|
|
4427
|
-
if (target.group)
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4468
|
+
if (target.group) {
|
|
4469
|
+
const e = result.e;
|
|
4470
|
+
const edges = !e ? 0 : wait === "sent" ? await waitForGroupFrame(ctx, target.id, message.id, e, ms) : node(ctx).groupTaken({
|
|
4471
|
+
groupId: target.id,
|
|
4472
|
+
messageId: message.id,
|
|
4473
|
+
edit: e
|
|
4474
|
+
});
|
|
4475
|
+
return {
|
|
4476
|
+
group: target.id,
|
|
4477
|
+
messageId: message.id,
|
|
4478
|
+
deleted: message.id,
|
|
4479
|
+
everyone: true,
|
|
4480
|
+
sent: edges > 0,
|
|
4481
|
+
edges
|
|
4482
|
+
};
|
|
4483
|
+
}
|
|
4433
4484
|
if (wait === "confirmed") await waitForRemoval(ctx, target.linkId, message.id, ms);
|
|
4434
4485
|
return {
|
|
4435
4486
|
chat: target.id,
|
|
@@ -4561,7 +4612,8 @@ var METHODS = {
|
|
|
4561
4612
|
}, ms, `chat ${link.id} to be ${until}`));
|
|
4562
4613
|
},
|
|
4563
4614
|
async "group.create"(ctx, params) {
|
|
4564
|
-
const
|
|
4615
|
+
const clean = cleanName(str(params, "name", true), 64);
|
|
4616
|
+
const name = clean && groupName(clean);
|
|
4565
4617
|
if (!name) throw new CliError("bad_request", `A group's name is 1 to 64 characters on one line`);
|
|
4566
4618
|
guardText(name, bool(params, "force"), "group's name", "create it");
|
|
4567
4619
|
const profile = oneOf(params, "profile", ["community", "mesh"], "community");
|
|
@@ -4952,7 +5004,7 @@ function notAGroup(ctx, params, chat, hint) {
|
|
|
4952
5004
|
} catch (error) {
|
|
4953
5005
|
if (!(error instanceof CliError) || error.code !== "not_found") throw error;
|
|
4954
5006
|
const ref = str(params, "chat", true);
|
|
4955
|
-
const named =
|
|
5007
|
+
const named = groupPrefixed(ref) ?? ref;
|
|
4956
5008
|
let group;
|
|
4957
5009
|
try {
|
|
4958
5010
|
group = findGroup(state(ctx).groups, named);
|
|
@@ -5099,4 +5151,4 @@ async function callApi(ctx, method, params = {}) {
|
|
|
5099
5151
|
//#endregion
|
|
5100
5152
|
export { flushCardUpdates as _, hideStateSecrets as a, paymentJson as c, nodeLocalFetch as d, chatJson as f, resumeHolds as g, groupMessageJson as h, groupSendRefused as i, reportAppFrames as l, groupJson as m, SETTABLE as n, mentionsFor as o, chatMessageJson as p, callApi as r, redactSettings as s, API_METHODS as t, servedApps as u };
|
|
5101
5153
|
|
|
5102
|
-
//# sourceMappingURL=api-
|
|
5154
|
+
//# sourceMappingURL=api-EUGHGnRz.js.map
|