@ghostlytools/cli 1.11.2 → 1.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -10
- package/dist/assets/{api-BM3PsXbB.js → api-DBlaoz8i.js} +129 -37
- package/dist/assets/api-DBlaoz8i.js.map +1 -0
- package/dist/assets/{api-CtXgscmK.js → api-DgU4MZPD.js} +2 -2
- package/dist/assets/{apiKit-lCTQ0EBG.js → apiKit-DesObIDf.js} +4 -4
- package/dist/assets/{apiKit-lCTQ0EBG.js.map → apiKit-DesObIDf.js.map} +1 -1
- package/dist/assets/{appFetch-BKHy5H8J.js → appFetch-C8yZIq1e.js} +3 -3
- package/dist/assets/{appFetch-BKHy5H8J.js.map → appFetch-C8yZIq1e.js.map} +1 -1
- package/dist/assets/{apps-Do26w3c7.js → apps-DkMjDHML.js} +104 -33
- package/dist/assets/apps-DkMjDHML.js.map +1 -0
- package/dist/assets/{apps-DO_gAZgm.js → apps-rzxsjfBV.js} +1 -1
- package/dist/assets/{arkade-CZrLbz-M.js → arkade-CarKONmH.js} +2 -2
- package/dist/assets/{arkade-CZrLbz-M.js.map → arkade-CarKONmH.js.map} +1 -1
- package/dist/assets/{backup-j47AzDvG.js → backup-C0OJCJlM.js} +17 -25
- package/dist/assets/backup-C0OJCJlM.js.map +1 -0
- package/dist/assets/{backup-D21x1f5P.js → backup-CgWU7x0T.js} +1 -1
- package/dist/assets/buttons-Cco0Agfa.js +2 -0
- package/dist/assets/{buttons-CiGlBVBT.js → buttons-fZTEa_2i.js} +34 -5
- package/dist/assets/buttons-fZTEa_2i.js.map +1 -0
- package/dist/assets/{client-raIncVtF.js → client-Ibk3-e60.js} +2 -2
- package/dist/assets/{client-raIncVtF.js.map → client-Ibk3-e60.js.map} +1 -1
- package/dist/assets/{codec-DcG2AeyE.js → codec-DMpQqVSt.js} +2 -2
- package/dist/assets/{codec-DcG2AeyE.js.map → codec-DMpQqVSt.js.map} +1 -1
- package/dist/assets/{envelope-Dud6lntA.js → envelope-CvQVCGdf.js} +2 -2
- package/dist/assets/{envelope-Dud6lntA.js.map → envelope-CvQVCGdf.js.map} +1 -1
- package/dist/assets/{fedimintSdk-DRKRSw14.js → fedimintSdk-zV_5Qdqz.js} +2 -2
- package/dist/assets/{fedimintSdk-DRKRSw14.js.map → fedimintSdk-zV_5Qdqz.js.map} +1 -1
- package/dist/assets/{fixedHosts-CNX7QiUD.js → fixedHosts-6gKn8dp2.js} +3 -3
- package/dist/assets/{fixedHosts-CNX7QiUD.js.map → fixedHosts-6gKn8dp2.js.map} +1 -1
- package/dist/assets/{host-8RskzQgB.js → host-CYlIiY3r.js} +161 -32
- package/dist/assets/host-CYlIiY3r.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-uAThbFub.js → hyperdhtRelay-CdsLcAhY.js} +2 -2
- package/dist/assets/{hyperdhtRelay-uAThbFub.js.map → hyperdhtRelay-CdsLcAhY.js.map} +1 -1
- package/dist/assets/{irohWeb-DGelfgDJ.js → irohWeb-D2IuloLL.js} +19 -12
- package/dist/assets/irohWeb-D2IuloLL.js.map +1 -0
- package/dist/assets/{main-BC33ooYg.js → main-C0PfjKTe.js} +109 -42
- package/dist/assets/main-C0PfjKTe.js.map +1 -0
- package/dist/assets/{mainline-DYrjsS1t.js → mainline-Cu61qcPS.js} +35 -18
- package/dist/assets/mainline-Cu61qcPS.js.map +1 -0
- package/dist/assets/{networkReason-n2oBs4by.js → networkReason-Dt7Yx_n4.js} +3 -3
- package/dist/assets/{networkReason-n2oBs4by.js.map → networkReason-Dt7Yx_n4.js.map} +1 -1
- package/dist/assets/{nwc-Do3VSlIS.js → nwc-CtZypDcv.js} +3 -3
- package/dist/assets/{nwc-Do3VSlIS.js.map → nwc-CtZypDcv.js.map} +1 -1
- package/dist/assets/{nwcProvider-Du5aWNIn.js → nwcProvider-DYHkd0iu.js} +2 -2
- package/dist/assets/{nwcProvider-Du5aWNIn.js.map → nwcProvider-DYHkd0iu.js.map} +1 -1
- package/dist/assets/{ownDid-CwwYu8s2.js → ownDid-CJ0ta8CL.js} +2 -2
- package/dist/assets/{ownDid-CwwYu8s2.js.map → ownDid-CJ0ta8CL.js.map} +1 -1
- package/dist/assets/{ownStatus-D7dB4zJB.js → ownStatus-D4HC6tNR.js} +11 -6
- package/dist/assets/{ownStatus-D7dB4zJB.js.map → ownStatus-D4HC6tNR.js.map} +1 -1
- package/dist/assets/{profiles-NyF5FnYF.js → profiles-Ccdq6Xf6.js} +3 -3
- package/dist/assets/{profiles-NyF5FnYF.js.map → profiles-Ccdq6Xf6.js.map} +1 -1
- package/dist/assets/{registry-C734VrO9.js → registry-CE0PpQAE.js} +1 -1
- package/dist/assets/{registry-DKDInr0A.js → registry-LvxsLJ5S.js} +18 -7
- package/dist/assets/registry-LvxsLJ5S.js.map +1 -0
- package/dist/assets/{resolve-3Tqh9AWQ.js → resolve-6kVu2DE5.js} +2 -2
- package/dist/assets/{resolve-3Tqh9AWQ.js.map → resolve-6kVu2DE5.js.map} +1 -1
- package/dist/assets/{server-B6PQ6iae.js → server-Q3VcNqGt.js} +245 -97
- package/dist/assets/server-Q3VcNqGt.js.map +1 -0
- package/dist/assets/{src-ChJijTlM.js → src-DjVj2ynY.js} +188 -42
- package/dist/assets/src-DjVj2ynY.js.map +1 -0
- package/dist/assets/{sshForges-Brf0fslM.js → sshForges-DeZ9cN9Q.js} +4 -3
- package/dist/assets/sshForges-DeZ9cN9Q.js.map +1 -0
- package/dist/assets/{translate-xLme9Rdh.js → translate-iQZq4TnY.js} +35 -14
- package/dist/assets/translate-iQZq4TnY.js.map +1 -0
- package/dist/assets/{usdt-CSU5KzTV.js → usdt-DnyTGdTX.js} +3 -3
- package/dist/assets/{usdt-CSU5KzTV.js.map → usdt-DnyTGdTX.js.map} +1 -1
- package/dist/ghostly.mjs +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/assets/api-BM3PsXbB.js.map +0 -1
- package/dist/assets/apps-Do26w3c7.js.map +0 -1
- package/dist/assets/backup-j47AzDvG.js.map +0 -1
- package/dist/assets/buttons-CiGlBVBT.js.map +0 -1
- package/dist/assets/buttons-D2l2bVCG.js +0 -2
- package/dist/assets/host-8RskzQgB.js.map +0 -1
- package/dist/assets/irohWeb-DGelfgDJ.js.map +0 -1
- package/dist/assets/main-BC33ooYg.js.map +0 -1
- package/dist/assets/mainline-DYrjsS1t.js.map +0 -1
- package/dist/assets/registry-DKDInr0A.js.map +0 -1
- package/dist/assets/server-B6PQ6iae.js.map +0 -1
- package/dist/assets/src-ChJijTlM.js.map +0 -1
- package/dist/assets/sshForges-Brf0fslM.js.map +0 -1
- package/dist/assets/translate-xLme9Rdh.js.map +0 -1
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ The rows are in alphabetical order of their first command, and every command of
|
|
|
117
117
|
| `app publish <dir> --key <file> [--out <file>] [--sequence n]`, `app verify <bundle\|url>` | The publisher tools of WISP 1200 (Apps), run here with no profile or daemon. `app publish` bundles and signs an app: `<dir>/ghostly-app.json` holds the manifest's fields but `publisher`, `sequence` and `files`, and every other file in `<dir>` goes in (dot files are left out and listed in `skipped`). It writes `<dir>/app.ghostlyapp` (or `--out`), its `sequence` one more than the bundle already there, which only the same key may follow (`--sequence n` sets it, refused unless higher); a sequence that `<dir>/ghostly-revoke.json` already revokes is `refused` (`details.reason` `revoked`, `details.sequence` the first one it leaves alone). `--key` names the publisher key file, a PKCS #8 PEM: made owner-only on first use (back it up: an app is updated only with its key), refused when others may read it or when it is inside `<dir>`, never printed; a folder holding any private key file is refused (`details.reason` `private-key`). `app verify` checks a bundle from a file or an `https` URL as a client does (jsDelivr only at a full commit, 16 MiB at most) and answers its manifest and digest, or `refused` (exit 1) with the WISP's reason in `details.reason` |
|
|
118
118
|
| `app revoke <dir> --key <file> (--digest <digest>… \| --up-to <sequence>) [--reason <text>] [--bundle <file>] [--force]` | Revoke versions of your app (WISP 1200 · Revocation): by digest (base64url, as `app verify` prints it; `--digest` again for each, up to 64) or every version up to a `sequence`, with an optional reason of one line of 1 to 200 characters (a bad or repeated `--digest`, or an empty or longer `--reason`, is a usage error naming the option). Clients keep a revocation for good, so `--up-to` past the bundle's own sequence is a usage error unless `--force` (versions published from elsewhere), and `app publish` refuses a sequence the folder's `ghostly-revoke.json` already stops, naming the `--sequence` that clears it. The statement names the app of `<dir>/app.ghostlyapp` (or `--bundle`), is signed with that app's publisher key (any other key is refused, and none is made here), and is added to `<dir>/ghostly-revoke.json`, published beside the bundle; a client that reads it stops those versions. Answers `{app, digests \| upTo, current, added, revocations, file}`; `current` says whether the bundle in `<dir>` is among them |
|
|
119
119
|
| `app send <chat> <ref\|name> <json\|->` | One message of a served app's own protocol to the same app on the contact's side (WISP 1200, Apps; needs the daemon): any JSON value, on the command line or `-` for stdin, at most 32 KiB, at most 48 a second. It goes on the live session only, while both sides have the app open, and is never kept for later: `{chat, app, sent: true}`, or an error whose `details.reason` is the WISP's name for why it did not go: `not-open` (`refused`: `app open` first), `too-large` (`bad_request`), `offline` and `peer-closed` (`unavailable`: the chat is not live, or the contact's app is not open; wait for `app.opened`), `too-fast` (`refused`). The contact's messages come as `app.message` events |
|
|
120
|
-
| `app serve <bundle\|url> --grant chat [--grant name] [--url <url>]`, `app served`, `app unserve <ref\|name>` | Serve an app as a bot (WISP 1200, Apps): the profile speaks the app's messages in its chats itself, and no app runs here. `app serve` reads the signed bundle from a file or an `https` URL and checks it as `app verify` does (`refused` with the WISP's reason in `details.reason`). Each permission the manifest asks needs its `--grant`: `chat` (talk to the same app on the contact's side) and `name` (the profile's name in that chat); one left out is `confirm` (exit 5), naming it in `details.missing`. `internet` cannot be granted (no page runs here), a permission the app does not ask is `bad_request`, and an app that does not ask for `chat` is `refused`. A newer version replaces the one served; an older one, or another bundle under the same `sequence`, is `refused`. It answers `{served: {ref, title, version, sequence, digest, url?, permissions, granted, servedAt}, offered, restart?}`; `url` is where a contact's app reads the bundle (`--url`, else the URL served from, else the manifest's first source). The list is kept in the profile's folder (`apps.json`). A profile's engine offers `apps/1` to contacts only while it serves an app, and reads the list when it starts: `offered` says whether it does now, and `restart: true` that `daemon restart` is needed for it. `app served` answers `{apps, offered, restart?}`; `app unserve` removes one by its reference or its name |
|
|
120
|
+
| `app serve <bundle\|url> --grant chat [--grant name] [--url <url>]`, `app served`, `app unserve <ref\|name>` | Serve an app as a bot (WISP 1200, Apps): the profile speaks the app's messages in its chats itself, and no app runs here. `app serve` reads the signed bundle from a file or an `https` URL and checks it as `app verify` does (`refused` with the WISP's reason in `details.reason`). Each permission the manifest asks needs its `--grant`: `chat` (talk to the same app on the contact's side) and `name` (the profile's name in that chat); one left out is `confirm` (exit 5), naming it in `details.missing`. `internet` cannot be granted (no page runs here), a permission the app does not ask is `bad_request`, and an app that does not ask for `chat` is `refused`. A newer version replaces the one served; an older one, or another bundle under the same `sequence`, is `refused`. It answers `{served: {ref, title, version, sequence, digest, url?, permissions, granted, servedAt}, offered, restart?}`; `url` is where a contact's app reads the bundle (`--url`, else the URL served from, else the manifest's first source). The list is kept in the profile's folder (`apps.json`), and a `profile backup` carries it to the restored copy. A profile's engine offers `apps/1` to contacts only while it serves an app, and reads the list when it starts: `offered` says whether it does now, and `restart: true` that `daemon restart` is needed for it. `app served` answers `{apps, offered, restart?}`; `app unserve` removes one by its reference or its name |
|
|
121
121
|
| `button press <chat\|group> <message> <button> [--wait none\|sent\|delivered] [--timeout s]` | Press a button of someone else's question, as a tap in the app does (WISP 406 · Message Buttons): the reply carries the button's label, and the asker hears `button.pressed`. `<message>` is the question's id (its event or `chat history`), `<button>` a button's id from its `card`. Refused (exit 1) like a tap: closed buttons, a second answer past `--once`, a second press within a second. A one-shot in a chat waits until it went out, as `send`. Answers `{chat \| group, messageId, button, label, replyId, delivery \| edges}` |
|
|
122
122
|
| `button update <chat\|group> <message> [--chosen <button>] [--close] [--text <text>] [--force] [--wait none\|confirmed\|sent] [--timeout s]` | Answer a question you sent with `send --button` (WISP 406 · Message Buttons): `--chosen` shows which button won, `--close` takes presses no more, `--text` changes the text (shown as edited; refused if it looks like a secret, unless `--force`); the buttons and, unless given, the text stay. `<message>` is the `messageId` send gave. Answers `{chat \| group, buttons, messageId, card, edits}` |
|
|
123
123
|
| `call auto [on\|off] [--from <chat>]… [--rate n]` | Answer calls by themselves, from anyone or the chats named (kept in the profile) |
|
|
@@ -125,22 +125,22 @@ The rows are in alphabetical order of their first command, and every command of
|
|
|
125
125
|
| `call pipe [<chat\|call>]` | A call's audio on stdin and stdout, for shell pipelines (sox, ffmpeg) |
|
|
126
126
|
| `call start <chat> [--rate 48000]`, `call answer [<chat\|call>] [--rate n]` | Voice calls (daemon): the result names the call's audio socket ([Calls](#calls)) |
|
|
127
127
|
| `chat accept <chat> [<method> [--off] [--networks mainnet,testnet]]` | Which ways of paying the chat takes (no method: the ones it takes now, per network) |
|
|
128
|
-
| `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)) |
|
|
128
|
+
| `chat connect <chat>`, `chat disconnect <chat> [--hold <minutes>]` | Reconnect now (ends a hold; a contact whose app is not there is `unavailable`, the dial's own words in `details.reason`); close the live session, or with `--hold` stay off the direct link that long ([Staying off the direct link](#staying-off-the-direct-link)) |
|
|
129
129
|
| `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)) |
|
|
130
130
|
| `chat list [--show-secret]`, `chat show <chat> [--show-secret]` | Chats, and one chat's connection: transports, last attempt, comparison code. `pairing` is connecting, negotiating, confirm, waiting, ready or error, and `connectionError` says why it failed (null when nothing did). A pending chat's `invite` prints as `<hidden>` without `--show-secret`. `lastMessageAt` is null until the chat's first message, as every time not reached yet is |
|
|
131
131
|
| `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 |
|
|
132
|
-
| `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; counted in code points, so a joined emoji counts as several, and a name too long is refused with its count in `details.length` and `details.max`; 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 |
|
|
132
|
+
| `chat rename <chat> <name>`, `chat remove <chat> --yes [--force]` | 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; counted in code points, so a joined emoji counts as several, and a name too long is refused with its count in `details.length` and `details.max`; an empty name gives back the contact's own); delete it (keys and history) here, closing the contact's services opened from it (`service open`), refused (`busy`) while a call is on in it: hang the call up first; refused (`confirm`, the messages in `details.messages`) while a message you deleted for everyone has not reached the contact yet, as removing the chat would leave it on their device: `--force` removes it anyway |
|
|
133
133
|
| `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 |
|
|
134
134
|
| `chat transport <chat> <auto\|dht\|webrtc\|iroh\|hyperdht>` | What carries the chat |
|
|
135
135
|
| `chat verify <chat> --code <code>` | Mark the contact verified after comparing the codes out of band |
|
|
136
136
|
| `chat wait <chat> [--until live\|text\|paired] [--timeout s]` | Wait for a chat to go live, carry text, or see its contact. Live means a session that exists now, in this run of the daemon: a chat that was live before a restart counts once its contact answers again. Paired answers at once for a chat that paired before, whether its contact is online or not |
|
|
137
137
|
| `daemon [--detach] [--timeout s]`, `daemon status [--timeout s]`, `daemon stop [--timeout s]`, `daemon restart [--timeout s]` | Keep the profile online; `status` names its version and its socket (`socket`, for the [socket API](#the-socket-api)), or says `"starting": true` with the `pid` of a daemon whose socket does not listen yet (`stop` and `restart` wait up to `--timeout` for that socket, then stop it); `restart` stops it and starts this release's code in the background ([After an upgrade](#after-an-upgrade)), keeping the profile for the new daemon in between: other commands wait for its socket rather than open the profile. Ctrl-C, SIGTERM and the terminal closing (SIGHUP) stop it cleanly. A command that holds the profile for a moment (a bot's `send` while a service manager restarts it) is waited for, up to `--timeout` (60 s): still held then, `busy` with its pid |
|
|
138
138
|
| `edit <chat> <message> [text… \| --text <text> \| --stdin] [--force] [--wait none\|confirmed] [--timeout s]` | Replace the text of a message you sent (1:1 chats, `group edit` for a group; `<message>` is the `messageId` `send` gave, or its wire id). The contact sees it in place, marked edited; `--wait confirmed` waits for its app to confirm (the default without a daemon). At most 100 edits a message, no time limit; an older contact app gets it once it shows edits |
|
|
139
|
-
| `engine <method> [json \| -] [--confirm-real] [--show-secret] [--yes] [--force]`, `engine --list [--verbose]` | Any call of the app's engine; `--verbose` lists what each takes (`{ linkId, label }`, `?` for an optional key). A call given less than it takes is refused as `bad_request`. One that deletes chats or groups (`clearProfileData`, `removeLink`, `leaveGroup`, `forgetGroup`, `deviceRemove`) needs `--yes`; `clearProfileData` answers what it removed and stops a daemon. `removeLink`, and `setChatTransport` or `setDeliveryMode` to `dht`, are refused (`busy`) while a call is on in the chat, as `chat remove` and `chat transport dht` are; `clearProfileData` while a call is on in any chat. One that sends a text that looks like a secret (`sendMessage`, `sendGroupMessage`, `editMessage`, `forwardMessages`, a payment's memo or comment, a file's name, a group's name in `createGroup` or `renameGroup`, the nick in `updateSettings`) needs `--force` |
|
|
139
|
+
| `engine <method> [json \| -] [--confirm-real] [--show-secret] [--yes] [--force]`, `engine --list [--verbose]` | Any call of the app's engine; `--verbose` lists what each takes (`{ linkId, label }`, `?` for an optional key). A call given less than it takes is refused as `bad_request`. One that deletes chats or groups (`clearProfileData`, `removeLink`, `leaveGroup`, `forgetGroup`, `deviceRemove`) needs `--yes`; `clearProfileData` answers what it removed and stops a daemon. `removeLink`, and `setChatTransport` or `setDeliveryMode` to `dht`, are refused (`busy`) while a call is on in the chat, as `chat remove` and `chat transport dht` are; `removeLink` while a delete for everyone has not reached the contact, as `chat remove` is, and `clearProfileData` while one has not in any chat, until `--force`; `clearProfileData` while a call is on in any chat. One that sends a text that looks like a secret (`sendMessage`, `sendGroupMessage`, `editMessage`, `forwardMessages`, a payment's memo or comment, a file's name, a group's name in `createGroup` or `renameGroup`, the nick in `updateSettings`) needs `--force` |
|
|
140
140
|
| `events [--since seq] [--translate lang]` | What the event journal holds, without following ([Translation](#translation)) |
|
|
141
|
-
| `file list <chat\|group>`, `file accept\|decline\|pause\|resume\|cancel [<chat>] <file>` | Transfers; a file over 25 MiB waits for `file accept` (files/3), and so does a group's file that did not come by itself (over 8 MiB): its row's `transfer` says `stage: "asking"`, `waitingFor: "me"` (a file sent from here that the contact has not taken yet: `waitingFor: "contact"`; one sent while the contact is away: `stage: "waiting"`, `waitingFor: "contact"`). A file's id names its chat or its group, so `<chat>` may be left out |
|
|
141
|
+
| `file list <chat\|group>`, `file accept\|decline\|pause\|resume\|cancel [<chat>] <file>` | Transfers; a file over 25 MiB waits for `file accept` (files/3), and so does a group's file that did not come by itself (over 8 MiB): its row's `transfer` says `stage: "asking"`, `waitingFor: "me"` (a file sent from here that the contact has not taken yet: `waitingFor: "contact"`; one sent while the contact is away: `stage: "waiting"`, `waitingFor: "contact"`). A file's id names its chat or its group, so `<chat>` may be left out. One the contact paused (`pausedBy: "peer"`) goes on only when they resume it: `file resume`, `file request` and `file resend` of it are `refused` |
|
|
142
142
|
| `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) |
|
|
143
|
-
| `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
|
|
143
|
+
| `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 a received one first (a sent one is all here) |
|
|
144
144
|
| `file send <chat\|group> <path> [--name n] [--mime t] [--voice [ms] [--peaks …]] [--reply <message>] [--force] [--wait none\|sent] [--timeout s]` | A file, or a voice note (its length and waveform measured from the file unless given); `--reply` quotes a message, as `send --reply` does. Answers the message's `messageId` (what `message delete`, `react` and `pin` take) and the file's id. Without a daemon, a file to a chat stays until the contact has all of it (`--wait sent`, the default there; `--timeout`, 300 s, then exit 4 with the `messageId` and the file's id in `details`, and it goes on with your next command; a file over 25 MiB waits for the contact's `file accept` meanwhile); `--wait none` answers at once, as a daemon does by default. To a group (`group:<id>` when a chat has the same name), up to 100 MiB: every member sees it at once and each member's app fetches it from a member who has it (WISP 503) |
|
|
145
145
|
| `file wait [<chat>] <file> [--timeout s]` | Wait until a transfer ends: exit `0` when the file is all here, `1` with the transfer's error when it failed (`details.retry`: `file resend` can go on), `4` on timeout (default 300 s), `5` at once when a received file waits for you to take it (over 25 MiB, or a group's file that did not come by itself): the message names `file accept` |
|
|
146
146
|
| `forward <chat\|group> <message>… --to <chat\|group>… [--force] [--wait none\|sent] [--timeout s]` | Forward messages to up to 5 chats and groups (`--to` again for each; `group:<id>` names a group when a chat has the same name; an id that starts with a dash is taken as it is, `--to -Ab…` or `--to=-Ab…`). Each is a new message of yours that says it was forwarded (`forwarded`, the hop count) and nothing of who wrote it. Files go from the bytes this profile holds, never fetched again; a group takes texts only. A text that looks like a seed, a key or ecash needs `--force`. Answers `{from, results: [{to, kind, messageIds, error}]}`, a group's with `edges` (how many edges took its copies so far, as for `group send`); any refusal fails the command (exit 1) with the results in `details`. `--wait sent`: each text on its way (a group's taken by an edge), each file's transfer done; without a daemon a group's copies wait for an edge by default (`--wait none` answers at once) |
|
|
@@ -154,7 +154,7 @@ The rows are in alphabetical order of their first command, and every command of
|
|
|
154
154
|
| `group react <group> <message> <emoji> [--remove] [--wait none\|sent] [--timeout s]` | React to a group's message. `refused` when the profile is not a member any more. `edges`: how many took it (`sent`: whether one did). Without a daemon it waits by default until an edge took it (`--wait sent`, up to `--timeout`, 30 s): a timeout (exit 4) says it is kept and goes with the next command that opens the group |
|
|
155
155
|
| `group rename <group> <name> [--force]` | A new name, for the admin (up to 64 characters, cleaned and counted as a chat's name is; one that looks like a secret needs `--force`, as for `group create`); the picture stays. Members see it once it reaches them; until then, and on apps from before names, the group keeps the name it had when they got in |
|
|
156
156
|
| `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 |
|
|
157
|
-
| `group send <group> [text…] [--mention <member>]… [--reply <message>] [--button id:Label]… [--style id=primary\|neutral\|danger]… [--once] [--id id] [--wait none\|sent] [--timeout s]` | Send; each mentioned member is written as `@name` in the text. `--button` puts buttons under it, as `send --button`. Answers `{group, messageId, sent, edges}`: the id `--reply`, `group react` and `group edit` take, how many edges took it so far, and `sent`, true once one did. A profile that is not a member any more (removed from the group) gets `refused`, with the reason, and nothing is sent. A group has no receipts: `--wait sent` waits until at least one edge took it (a member's in a private group, one of your hubs' in a community), and exits 4 after `--timeout` (default 30 s) if none did; the message still goes when an edge opens, while the profile is online. Use it for a one-shot send with no daemon. In a private group with nobody else in it (they all left, or nobody accepted yet), nobody gets the message, not even someone who joins later: the answer comes at once with `sent: false` and a `note` saying so |
|
|
157
|
+
| `group send <group> [text…] [--mention <member>]… [--reply <message>] [--button id:Label]… [--style id=primary\|neutral\|danger]… [--once] [--id id] [--wait none\|sent] [--timeout s]` | Send; each mentioned member is written as `@name` in the text. `--button` puts buttons under it, as `send --button`. Answers `{group, messageId, sent, edges}`: the id `--reply`, `group react` and `group edit` take, how many edges took it so far, and `sent`, true once one did. A profile that is not a member any more (removed from the group) gets `refused`, with the reason, and nothing is sent. A group has no receipts: `--wait sent` waits until at least one edge took it (a member's in a private group, one of your hubs' in a community), and exits 4 after `--timeout` (default 30 s) if none did; the message still goes when an edge opens, while the profile is online. Use it for a one-shot send with no daemon. In a private group with nobody else in it (they all left, or nobody accepted yet), nobody gets the message, not even someone who joins later: the answer comes at once with `sent: false` and a `note` saying so. A profile removed while it was away learns it only once it is back: a wait that learns it ends at once as `refused` (exit 1) with the reason and the `messageId`, since nothing goes any more |
|
|
158
158
|
| `group typing <group> [--kind typing\|recording\|thinking] [--status "<text>"] [--for s] [--stop]` | `typing` in a private group: the members whose edge is open see "Ana is typing…" (or recording, thinking, or your status line), with the same rules, 6 s hold and `--for` (a one-shot without `--for` reaches nobody and says so in a `note`). Answers `{group, typing, kind, status, reached, sendTyping}` (`reached`: members with an open edge). A community does not carry typing yet (exit 1, `unavailable`) |
|
|
159
159
|
| `identity add <provider> [subject] [--signer id] [--field name=value]… [--stdin] [--days n] [--timeout s]` | A proof: an in-app signer (NIP-46 and the like) finishes here; a tool or a published record answers with the statement; `--timeout` is how long it waits for an approval (300 s). With `--stdin`, fields come as `name=value` lines on stdin, out of `ps` and the shell's history; a `--field` the signer marks secret (a NIP-46 `bunker://` link) is warned about |
|
|
160
160
|
| `identity complete <draft> [--evidence-file f \| --stdin]`, `identity cancel <draft>` | Finish it with the tool's output, from a file, `--stdin` or piped to it (or nothing, for a published record); needs the daemon that began it. Cancel drops one not finished |
|
|
@@ -181,8 +181,8 @@ The rows are in alphabetical order of their first command, and every command of
|
|
|
181
181
|
| `service peer <chat>`, `service open <chat> <service> [--port p]`, `service close <chat> <service>` | A contact's app on a loopback port here (daemon). `url` is a link for your browser, `http://<random>.localhost:<port>/.ghostly-open/<token>`: it sets the service's cookie and shows the app on a host name of its own; any other host name, or a request without that cookie, gets 404. Chrome, Edge and curl reach `*.localhost` names by themselves; Safari and Node's `fetch` on macOS may not (add the name to `/etc/hosts` for them). With Hide my IP from contacts on, `service open` fails with `unavailable`: a browser tab cannot keep the app's page off WebRTC |
|
|
182
182
|
| `settings get [--show-secret]`, `settings set <key> <json> [--force]` | Relays, Iroh relays, the HyperDHT relay, ICE servers, `sendTyping` (false: contacts are never told you type), `daemonPresence` (true: while a daemon runs the profile, contacts see it online, WISP 401 § Presence and status; off by default, so a bot is never shown online unless you turn it on), … `settings get` shows every key `settings set` takes with its value in effect (one never set as its default: `sendTyping: true`, the default Iroh relays). `<json>` as `-`, or none on a pipe, is read from stdin: a TURN password stays out of `ps` |
|
|
183
183
|
| `status` | The profile, its chats, whether WebRTC and calls run, the last event seq |
|
|
184
|
-
| `status set [text…] [--emoji <emoji>] [--availability available\|busy\|away\|dnd] [--until <time>] [--force]`, `status show`, `status clear` | The status your paired contacts see (WISP 401 § Presence and status): a text of up to 60 characters on one line (no links or markup), one emoji, an availability (`dnd` is Do not disturb) and when it ends by itself: `--until 30m`, `2h` or `1d` from now, or milliseconds or a date within a year, written as `routine send --next` takes it. A new `set` replaces the whole status. A text too long or with a link, a word that is not one emoji, or a time already past is a usage error (exit 2) that names it, before the profile opens. The socket's `status.set` takes `until` in milliseconds and holds it to the same year (`bad_request`). All three answer `{"status": {"text", "emoji", "availability", "until"}}` (a field not set is null) or `{"status": null}` when there is none. A daemon tells every contact whose app offers `status/1` at once; without one the status is kept here and said on each chat's next live session. Plain `status` is unchanged.
|
|
185
|
-
| `store sign <index> --key <file> [--out <dir>]` | Sign a store index (WISP 1200 · Stores) with the store key file (kept offline; made when missing, the index names no `key` and no signed index is in the output folder): writes `ghostly-store.json`, canonical, and `ghostly-store.sig` beside the index or in `--out`. Refused, with the reason, when a client would refuse the index (`expires` more than 90 days ahead, a bad field), or when the index already there has a higher `sequence` (`rollback`), the same one with other content (`equivocation`), or is signed by another key (`store-key`: another store is another `--out`), or when a `ghostly-store.json` or `ghostly-store.sig` there does not read as a signed index (move them away, or name another `--out`) |
|
|
184
|
+
| `status set [text…] [--emoji <emoji>] [--availability available\|busy\|away\|dnd] [--until <time>] [--force]`, `status show`, `status clear` | The status your paired contacts see (WISP 401 § Presence and status): a text of up to 60 characters on one line (no links or markup), one emoji, an availability (`dnd` is Do not disturb) and when it ends by itself: `--until 30m`, `2h` or `1d` from now, or milliseconds or a date within a year, written as `routine send --next` takes it. A new `set` replaces the whole status. A text too long or with a link, a word that is not one emoji, or a time already past is a usage error (exit 2) that names it, before the profile opens. The socket's `status.set` takes `until` in milliseconds and holds it to the same year (`bad_request`). All three answer `{"status": {"text", "emoji", "availability", "until"}}` (a field not set is null) or `{"status": null}` when there is none. A daemon tells every contact whose app offers `status/1` at once; without one the status is kept here and said on each chat's next live session. Plain `status` is unchanged. These commands never say presence (online or idle): only a daemon does, and only with `settings set daemonPresence true`; a profile restored from an app with "Share when I'm online" off (`sharePresence: false`, not a key `settings set` takes) says none even then |
|
|
185
|
+
| `store sign <index> --key <file> [--out <dir>]` | Sign a store index (WISP 1200 · Stores) with the store key file (kept offline; made when missing, the index names no `key` and no signed index is in the output folder): writes `ghostly-store.json`, canonical, and `ghostly-store.sig` beside the index or in `--out`. Refused, with the reason, when a client would refuse the index (`expires` more than 90 days ahead, a bad field), or when the index already there has a higher `sequence` (`rollback`), the same one with other content (`equivocation`), or is signed by another key (`store-key`: another store is another `--out`), or when a `ghostly-store.json` or `ghostly-store.sig` there does not read as a signed index (move them away, or name another `--out`), or when `--key` is inside the output folder, which is published (`private-key`: keep the store key outside it, and outside its repository) |
|
|
186
186
|
| `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. Without a daemon a card in a chat stays until it went out: `send` until it is sent (`--wait sent`), `update` until the contact confirmed it (`--wait confirmed`), up to `--timeout` (30 s, then exit 4: it goes with the next command); `--wait none` answers at once, as a daemon and a group do by default. Only the CLI sends cards: the app shows them |
|
|
187
187
|
| `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 one-shot without it reaches nobody, so it answers at once with a `note` saying so); a new kind or status shows at once; a message to the chat or `--stop` ends it |
|
|
188
188
|
| `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`); `--resets` and `@` take milliseconds or a date within a year (no zone: local time, a bare date local midnight). 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. Without a daemon a report in a chat stays until it went out (`--wait sent`: the first sent, a later one confirmed by the contact), up to `--timeout`; `--wait none` answers at once. `--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 |
|
|
@@ -242,7 +242,8 @@ is on in the chat is refused (`busy`): hang the call up first. `chat connect`, o
|
|
|
242
242
|
hold is kept in the profile folder, and a `profile backup` carries it: a daemon that restarts (or a restored copy
|
|
243
243
|
that starts) takes it back when its time is up, and a DHT only the chat had chosen itself (`chat transport dht`) is
|
|
244
244
|
never undone by it. A `chat transport` chosen during a hold ends the
|
|
245
|
-
hold (`lifted`) and stays as chosen
|
|
245
|
+
hold (`lifted`) and stays as chosen, as does the engine's own `setChatTransport` or `setDeliveryMode` (`ghostly
|
|
246
|
+
engine`); `chat remove`, or `engine removeLink`, drops it with the chat. Several chats held at once each keep their
|
|
246
247
|
own hold. `chat show` answers `heldUntil` (a time in ms, or
|
|
247
248
|
null; `hold` there is the store-and-forward state, something else), and the stream says `chat.held` and
|
|
248
249
|
`chat.released` (`reason`: expired, connect or lifted).
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ba as sanitizeFileName, Cd as toBase64Url, Co as replySnippet, Dl as isAppUrl, Fl as appRef, Fo as appCardUrl, Ga as baseMime, Gn as NO_PICTURE_METADATA, Go as claimedTime, Ha as PLAYABLE_AUDIO, Ja as parseVoiceMeta, Jn as stripPictureMetadata, Ju as relayUrlProblem, Ka as downsamplePeaks, Lo as cardLine, Mo as STATUS_CARD_LIMITS, Po as appCardId, Sd as randomBytes$1, Sl as APP_PERMISSIONS, Ss as LIMITS, Ua as VOICE_LIMITS, Uo as MESSAGE_CLOCK_SKEW_MS, Va as sanitizeMime, Vl as isAppRef, Vn as withoutAudioMetadata, Vo as statusCardBytes, Wa as VOICE_METER, Wn as withoutVideoMetadata, Xa as voiceLevel, Ya as voiceDownloadName, Yl as readImageMeta, Yn as withoutPictureMetadata, Zi as identityStatement, bs as parseLocalTarget, du as ownInviteRefusal, ii as TYPING_REFRESH_MS, ki as APP_DATA_MAX_BYTES, lu as inviteLink, md as sanitizeAvatar, oi as sanitizeTypingStatus, pd as MAX_AVATAR_LENGTH, qu as normalizeRelayUrl, ri as TYPING_KINDS, sr as GROUP_FILE_LIMITS, us as AWAITING_PEER_MS, vs as GhostlyHttpError, zo as checkStatusCard } from "./src-DjVj2ynY.js";
|
|
2
2
|
import { p as fileStore } from "./idb-CEuoNsTv.js";
|
|
3
3
|
import { f as FILE_BYTES_STEP, o as fileBytes, s as fileBytesOf } from "./fileBytes-BLPZq9YU.js";
|
|
4
|
-
import { B as removeStored, U as waitingGroupFile, W as IDENTITY_DRAFT_TTL_MS, a as groupMemberOfLink, b as replyRef, c as groupPayTwin, ft as iceServerProblem, h as groupOfFile, k as paymentNetwork, o as groupPayLineId, p as groupFileId, pt as iceServerSetting, s as groupPayNoteId, t as DEFAULT_IROH_RELAYS } from "./irohWeb-
|
|
5
|
-
import { t as IDENTITY_PROVIDERS } from "./registry-
|
|
4
|
+
import { B as removeStored, U as waitingGroupFile, W as IDENTITY_DRAFT_TTL_MS, a as groupMemberOfLink, b as replyRef, c as groupPayTwin, ft as iceServerProblem, h as groupOfFile, k as paymentNetwork, o as groupPayLineId, p as groupFileId, pt as iceServerSetting, s as groupPayNoteId, t as DEFAULT_IROH_RELAYS } from "./irohWeb-D2IuloLL.js";
|
|
5
|
+
import { t as IDENTITY_PROVIDERS } from "./registry-LvxsLJ5S.js";
|
|
6
6
|
import { n as secretWords, r as findSecret, t as guardText } from "./secretGuard-B7Hj0Kvz.js";
|
|
7
7
|
import { i as localFileError, r as asCliError, t as CliError } from "./errors-Dt-ZnyOX.js";
|
|
8
|
-
import { a as PAY_METHODS, d as ENGINE_METHODS, f as ENGINE_PARAMS, g as engineParamsProblem, i as CHAT_METHODS, l as withStoredIds, m as READ_PARAMS, n as statusJson, o as TRANSPORT_NAMES, p as ENGINE_READS, r as ADDRESS_TYPES, s as WALLET_TYPES, t as checkOwnStatus, u as DESTRUCTIVE_CALLS } from "./ownStatus-
|
|
9
|
-
import { A as sinceSeq, D as oneShotWaits, E as oneOf, F as transportOffered, I as waitForState, N as state, O as sentAt, P as str, S as nobodyJoined, T as num, _ as messageOf, a as contactKeyOf, b as noFile, c as findChatOrGroup, d as groupNameOf, f as groupOf, g as list, h as keptForJoin, j as somebodyJoined, k as shownName, l as findGroup, m as inviteTaken, n as chatOf, o as dhtOnly, p as groupPrefixed, r as chatOrGroup, s as findChat, t as bool, u as findOwnNamedChat, w as node, x as noMessage } from "./apiKit-
|
|
8
|
+
import { a as PAY_METHODS, d as ENGINE_METHODS, f as ENGINE_PARAMS, g as engineParamsProblem, i as CHAT_METHODS, l as withStoredIds, m as READ_PARAMS, n as statusJson, o as TRANSPORT_NAMES, p as ENGINE_READS, r as ADDRESS_TYPES, s as WALLET_TYPES, t as checkOwnStatus, u as DESTRUCTIVE_CALLS } from "./ownStatus-D4HC6tNR.js";
|
|
9
|
+
import { A as sinceSeq, D as oneShotWaits, E as oneOf, F as transportOffered, I as waitForState, N as state, O as sentAt, P as str, S as nobodyJoined, T as num, _ as messageOf, a as contactKeyOf, b as noFile, c as findChatOrGroup, d as groupNameOf, f as groupOf, g as list, h as keptForJoin, j as somebodyJoined, k as shownName, l as findGroup, m as inviteTaken, n as chatOf, o as dhtOnly, p as groupPrefixed, r as chatOrGroup, s as findChat, t as bool, u as findOwnNamedChat, w as node, x as noMessage } from "./apiKit-DesObIDf.js";
|
|
10
10
|
import { t as childEnv } from "./childEnv-K_IzUqQx.js";
|
|
11
11
|
import { t as chatState } from "./waitNotice-Cn0WJ-He.js";
|
|
12
|
-
import { a as
|
|
13
|
-
import { a as checkShownName } from "./profiles-
|
|
14
|
-
import { t as BACKUP_METHODS } from "./backup-
|
|
15
|
-
import { o as checkedBundle } from "./apps-
|
|
12
|
+
import { a as checkTextSize$1, c as waitForConfirmed, d as waitForMessage, f as waitForRemoval, i as pressable, l as waitForEdit, n as buttonsCard, o as goesOn, s as nobodyElseIn, t as BUTTON_METHODS, u as waitForGroupFrame } from "./buttons-fZTEa_2i.js";
|
|
13
|
+
import { a as checkShownName } from "./profiles-Ccdq6Xf6.js";
|
|
14
|
+
import { t as BACKUP_METHODS } from "./backup-C0OJCJlM.js";
|
|
15
|
+
import { o as checkedBundle } from "./apps-DkMjDHML.js";
|
|
16
16
|
import { generateMnemonic } from "@scure/bip39";
|
|
17
17
|
import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
18
18
|
import { execFile, spawn } from "node:child_process";
|
|
@@ -729,19 +729,22 @@ function mimeOf(path, given) {
|
|
|
729
729
|
* a date can hold it; else when it was stored here.
|
|
730
730
|
*/
|
|
731
731
|
async function voiceTime(ctx, stored) {
|
|
732
|
-
|
|
732
|
+
const older = (linkId) => node(ctx).fileMessages(linkId);
|
|
733
|
+
return (await findMessage(ctx, stored.linkId, (m) => m.file?.id === stored.id, older))?.timestamp ?? claimedTime(stored.metadata?.timestamp) ?? stored.createdAt;
|
|
733
734
|
}
|
|
734
735
|
/**
|
|
735
736
|
* The message of a chat or a group (`group:<id>`) that `test` picks: looked for among its newest first, where the one a
|
|
736
|
-
* command names almost always is, then in all of them only when there are more. A whole history costs a read of every row
|
|
737
|
+
* command names almost always is, then in all of them only when there are more. A whole history costs a read of every row;
|
|
738
|
+
* `older` reads fewer, where the message is known to be among them.
|
|
737
739
|
*/
|
|
738
|
-
async function findMessage(ctx, linkId, test) {
|
|
740
|
+
async function findMessage(ctx, linkId, test, older) {
|
|
739
741
|
const page = await node(ctx).messagePage({
|
|
740
742
|
linkId,
|
|
741
743
|
limit: 200
|
|
742
744
|
});
|
|
743
745
|
const newest = page.messages.find(test);
|
|
744
746
|
if (newest || !page.more) return newest;
|
|
747
|
+
if (older) return (await older(linkId)).find(test);
|
|
745
748
|
const group = linkId.startsWith("group:") ? linkId.slice(6) : void 0;
|
|
746
749
|
return (group ? await node(ctx).groupMessages({ groupId: group }) : await node(ctx).getMessages(linkId)).find(test);
|
|
747
750
|
}
|
|
@@ -894,7 +897,7 @@ async function whileUnchanged(path, read) {
|
|
|
894
897
|
* A file announced in a group (WISP 503): its bytes staged under a group file id with their digest, as a chat's are, then
|
|
895
898
|
* the announcement. This device is its first holder and serves the members who ask.
|
|
896
899
|
*/
|
|
897
|
-
async function sendToGroup(ctx, params, group, path, picked) {
|
|
900
|
+
async function sendToGroup(ctx, params, group, path, name, picked) {
|
|
898
901
|
if (picked > GROUP_FILE_LIMITS.maxBytes) throw new CliError("refused", `Too large for a group (at most ${GROUP_FILE_LIMITS.maxBytes} bytes)`);
|
|
899
902
|
if (!picked) throw new CliError("refused", "An empty file cannot go to a group");
|
|
900
903
|
const mime = mimeOf(path, str(params, "mime"));
|
|
@@ -914,7 +917,7 @@ async function sendToGroup(ctx, params, group, path, picked) {
|
|
|
914
917
|
const fileId = groupFileId(group.id, "out");
|
|
915
918
|
const file = {
|
|
916
919
|
id: fileId,
|
|
917
|
-
name
|
|
920
|
+
name,
|
|
918
921
|
size,
|
|
919
922
|
mime,
|
|
920
923
|
...voice ? { voice } : {},
|
|
@@ -1090,9 +1093,10 @@ async function waitForFile(ctx, params, stopping) {
|
|
|
1090
1093
|
}
|
|
1091
1094
|
var FILE_METHODS = {
|
|
1092
1095
|
async "file.send"(ctx, params) {
|
|
1093
|
-
guardText(str(params, "name"), bool(params, "force"), "file's name", "send it");
|
|
1094
|
-
const target = chatOrGroupOf(ctx, params);
|
|
1095
1096
|
const path = resolve(str(params, "path", true));
|
|
1097
|
+
const name = sanitizeFileName(str(params, "name") ?? basename(path));
|
|
1098
|
+
guardText(name, bool(params, "force"), "file's name", "send it");
|
|
1099
|
+
const target = chatOrGroupOf(ctx, params);
|
|
1096
1100
|
let info;
|
|
1097
1101
|
try {
|
|
1098
1102
|
info = await stat(path);
|
|
@@ -1106,10 +1110,10 @@ var FILE_METHODS = {
|
|
|
1106
1110
|
min: 1,
|
|
1107
1111
|
max: 86400
|
|
1108
1112
|
});
|
|
1109
|
-
if ("group" in target) return sendToGroup(ctx, params, target.group, path, info.size);
|
|
1113
|
+
if ("group" in target) return sendToGroup(ctx, params, target.group, path, name, info.size);
|
|
1110
1114
|
const { link } = target;
|
|
1111
1115
|
if (link.profile && link.dataLink === "open" && !link.capabilities?.files) throw new CliError("unavailable", "The contact's app takes no files");
|
|
1112
|
-
if (!link.capabilities?.largeFiles && info.size > LIMITS.maxFileBytes) throw new CliError("refused", `Too large for the contact's app (at most ${LIMITS.maxFileBytes} bytes)`);
|
|
1116
|
+
if (link.dataLink === "open" && !link.capabilities?.largeFiles && info.size > LIMITS.maxFileBytes) throw new CliError("refused", `Too large for the contact's app (at most ${LIMITS.maxFileBytes} bytes)`);
|
|
1113
1117
|
if (typeof link.peerFileRoom === "number" && info.size > link.peerFileRoom) throw new CliError("refused", `Not enough space on the contact's device (${link.peerFileRoom} bytes free)`);
|
|
1114
1118
|
const mime = mimeOf(path, str(params, "mime"));
|
|
1115
1119
|
const replyTo = str(params, "reply");
|
|
@@ -1125,7 +1129,7 @@ var FILE_METHODS = {
|
|
|
1125
1129
|
const wireId = toBase64Url(randomBytes$1(12));
|
|
1126
1130
|
const file = {
|
|
1127
1131
|
id: `${link.id}-out-${wireId}`,
|
|
1128
|
-
name
|
|
1132
|
+
name,
|
|
1129
1133
|
size: source.size,
|
|
1130
1134
|
mime,
|
|
1131
1135
|
...voice ? { voice } : {},
|
|
@@ -1272,6 +1276,8 @@ var FILE_METHODS = {
|
|
|
1272
1276
|
if (whole && action === "cancel") throw new CliError("refused", "Too late to cancel: it arrived whole, and the contact keeps it");
|
|
1273
1277
|
if (whole && action === "pause") throw new CliError("refused", "Too late to pause: it arrived whole, and the contact keeps it");
|
|
1274
1278
|
}
|
|
1279
|
+
const view = state(ctx).transfers[fileId];
|
|
1280
|
+
if ((action === "resume" || action === "request" || action === "resend") && view?.stage === "paused" && view.pausedBy === "peer") throw new CliError("refused", "Paused by the contact: it goes on when they resume it");
|
|
1275
1281
|
await node(ctx).fileAction({
|
|
1276
1282
|
linkId,
|
|
1277
1283
|
fileId,
|
|
@@ -1295,7 +1301,7 @@ var FILE_METHODS = {
|
|
|
1295
1301
|
async "file.save"(ctx, params) {
|
|
1296
1302
|
const fileId = str(params, "file", true);
|
|
1297
1303
|
if (params.chat !== void 0) fileChat(ctx, params, fileId);
|
|
1298
|
-
if (bool(params, "wait")) await FILE_METHODS["file.wait"](ctx, {
|
|
1304
|
+
if (bool(params, "wait") && (await fileStore.get(fileId))?.direction !== "out") await FILE_METHODS["file.wait"](ctx, {
|
|
1299
1305
|
file: fileId,
|
|
1300
1306
|
timeout: params.timeout
|
|
1301
1307
|
});
|
|
@@ -1497,9 +1503,11 @@ function secretIn(value) {
|
|
|
1497
1503
|
* The secret guard `send` has (docs/CLI.md § Safety): a card whose text looks like a seed, a private key or a Cashu
|
|
1498
1504
|
* token goes only with `--force`. `fields` are what this command gives (an update's own, not the card it merges over).
|
|
1499
1505
|
* A card's text is read as given and as the card carries it (`cardLine`): a line loses its invisible characters on the
|
|
1500
|
-
* way, so a key one of them broke in two is whole again on the card. The fallback text goes as it is, as `send`'s
|
|
1506
|
+
* way, so a key one of them broke in two is whole again on the card. The fallback text goes as it is, as `send`'s, and
|
|
1507
|
+
* one past 16 KiB is refused first, with its size, `--force` or not (`checkTextSize`).
|
|
1501
1508
|
*/
|
|
1502
1509
|
function guardSecrets(fields, params, verb) {
|
|
1510
|
+
if (typeof params.text === "string") checkTextSize$1(params.text);
|
|
1503
1511
|
if (bool(params, "force")) return;
|
|
1504
1512
|
const check = (text) => {
|
|
1505
1513
|
const secret = findSecret(text);
|
|
@@ -1695,16 +1703,18 @@ async function updateCard(ctx, params, kind) {
|
|
|
1695
1703
|
let queued = false;
|
|
1696
1704
|
if (due > 0 && ctx.mode === "daemon") {
|
|
1697
1705
|
pace.next = card;
|
|
1706
|
+
pace.text = text;
|
|
1698
1707
|
queued = true;
|
|
1699
1708
|
if (!pace.timer) pace.flushed = new Promise((resolve) => {
|
|
1700
1709
|
const send = () => {
|
|
1701
|
-
const next = pace.next;
|
|
1710
|
+
const next = pace.next, nextText = pace.text ?? "";
|
|
1702
1711
|
clearTimeout(pace.timer);
|
|
1703
1712
|
pace.timer = void 0;
|
|
1704
1713
|
pace.next = void 0;
|
|
1714
|
+
pace.text = void 0;
|
|
1705
1715
|
pace.flush = void 0;
|
|
1706
1716
|
pace.last = Date.now();
|
|
1707
|
-
(next ? editCard(ctx, target, message.id, next,
|
|
1717
|
+
(next ? editCard(ctx, target, message.id, next, nextText) : Promise.resolve()).catch(() => {}).finally(resolve);
|
|
1708
1718
|
};
|
|
1709
1719
|
pace.flush = send;
|
|
1710
1720
|
pace.timer = setTimeout(send, due);
|
|
@@ -1805,6 +1815,7 @@ async function sendUsage(ctx, params) {
|
|
|
1805
1815
|
kind: "usage",
|
|
1806
1816
|
id: typeof fields.id === "string" && fields.id ? fields.id : USAGE_CARD_ID
|
|
1807
1817
|
});
|
|
1818
|
+
if (typeof params.text === "string") checkTextSize$1(params.text);
|
|
1808
1819
|
oneOf(params, "wait", ["none", "sent"], "none");
|
|
1809
1820
|
num(params, "timeout", 30, {
|
|
1810
1821
|
min: 1,
|
|
@@ -1911,12 +1922,19 @@ function stopWait(ctx, linkId) {
|
|
|
1911
1922
|
timersOf(ctx).get(linkId)?.();
|
|
1912
1923
|
timersOf(ctx).delete(linkId);
|
|
1913
1924
|
}
|
|
1925
|
+
/**
|
|
1926
|
+
* The longest a hold's timer waits before it reads the wall clock again. Timers run on a clock that stops while the
|
|
1927
|
+
* machine sleeps: one timer for the whole hold, after a sleep past its end, kept the chat on DHT only for as long again
|
|
1928
|
+
* as the hold had left when the machine went to sleep, while `holdOf` no longer reported it.
|
|
1929
|
+
*/
|
|
1930
|
+
var HOLD_CHECK_MS = 6e4;
|
|
1914
1931
|
function schedule(ctx, linkId, until) {
|
|
1915
1932
|
stopWait(ctx, linkId);
|
|
1916
1933
|
const timer = setTimeout(() => {
|
|
1917
1934
|
timersOf(ctx).delete(linkId);
|
|
1918
|
-
|
|
1919
|
-
|
|
1935
|
+
if (until > Date.now()) schedule(ctx, linkId, until);
|
|
1936
|
+
else expire(ctx, linkId);
|
|
1937
|
+
}, Math.min(HOLD_CHECK_MS, Math.max(0, until - Date.now())));
|
|
1920
1938
|
timer.unref?.();
|
|
1921
1939
|
timersOf(ctx).set(linkId, () => clearTimeout(timer));
|
|
1922
1940
|
}
|
|
@@ -2453,7 +2471,9 @@ var GROUP_ADMIN_METHODS = {
|
|
|
2453
2471
|
},
|
|
2454
2472
|
async "group.link"(ctx, params) {
|
|
2455
2473
|
const group = joined(ctx, params);
|
|
2456
|
-
|
|
2474
|
+
const on = params.on === void 0 || bool(params, "on"), reset = bool(params, "reset");
|
|
2475
|
+
if (!on && reset) throw new CliError("bad_request", "on: false turns the link off: not with reset");
|
|
2476
|
+
if (!on) {
|
|
2457
2477
|
await node(ctx).disableGroupLink({ groupId: group.id });
|
|
2458
2478
|
return {
|
|
2459
2479
|
group: group.id,
|
|
@@ -2462,7 +2482,7 @@ var GROUP_ADMIN_METHODS = {
|
|
|
2462
2482
|
}
|
|
2463
2483
|
const { link } = await node(ctx).enableGroupLink({
|
|
2464
2484
|
groupId: group.id,
|
|
2465
|
-
...
|
|
2485
|
+
...reset ? { reset: true } : {}
|
|
2466
2486
|
});
|
|
2467
2487
|
return {
|
|
2468
2488
|
group: group.id,
|
|
@@ -3229,13 +3249,34 @@ var SERVICE_METHODS = {
|
|
|
3229
3249
|
open$1.delete(key);
|
|
3230
3250
|
const entry = await pending?.catch(() => void 0);
|
|
3231
3251
|
if (!entry) throw new CliError("not_found", "That service is not open here");
|
|
3232
|
-
await
|
|
3233
|
-
entry.server.close(() => resolve());
|
|
3234
|
-
entry.server.closeAllConnections();
|
|
3235
|
-
});
|
|
3252
|
+
await closeOpened(entry);
|
|
3236
3253
|
return { closed: key };
|
|
3237
3254
|
}
|
|
3238
3255
|
};
|
|
3256
|
+
/**
|
|
3257
|
+
* Closed means closed: an answer still streaming (a page's EventSource) kept `close` waiting for good, and kept coming.
|
|
3258
|
+
* Each connection's end stops the contact's answer too (`proxy`).
|
|
3259
|
+
*/
|
|
3260
|
+
function closeOpened(entry) {
|
|
3261
|
+
return new Promise((resolve) => {
|
|
3262
|
+
entry.server.close(() => resolve());
|
|
3263
|
+
entry.server.closeAllConnections();
|
|
3264
|
+
});
|
|
3265
|
+
}
|
|
3266
|
+
/**
|
|
3267
|
+
* `chat remove`: the services opened from a contact no chat here has any more. Before, they stayed on their ports, each
|
|
3268
|
+
* request a 503, and `service close` answered `No chat` for good.
|
|
3269
|
+
*/
|
|
3270
|
+
async function closeServicesOf(ctx, peer) {
|
|
3271
|
+
if (state(ctx).links.some((link) => link.peerPubKeyZ32 === peer)) return;
|
|
3272
|
+
const keys = [...open$1.keys()].filter((key) => key.startsWith(`${peer}/`));
|
|
3273
|
+
await Promise.all(keys.map(async (key) => {
|
|
3274
|
+
const pending = open$1.get(key);
|
|
3275
|
+
open$1.delete(key);
|
|
3276
|
+
const entry = await pending?.catch(() => void 0);
|
|
3277
|
+
if (entry) await closeOpened(entry);
|
|
3278
|
+
}));
|
|
3279
|
+
}
|
|
3239
3280
|
//#endregion
|
|
3240
3281
|
//#region src/calls/api.ts
|
|
3241
3282
|
/** Voice calls (WISP 1100 § Calls): the API methods. The audio itself goes over each call's own socket. */
|
|
@@ -4420,6 +4461,26 @@ function inviteNotOut(detail) {
|
|
|
4420
4461
|
var BAD_VALUE = /^Cannot (destructure|read properties of (undefined|null))|is not (a function|iterable)/;
|
|
4421
4462
|
/** A one-shot's typing without `--for` (it opens the profile offline, `offlineCall`): said on no live session. */
|
|
4422
4463
|
var ONE_SHOT_TYPING = "Typing is said on a live session only, and a one-shot has none: it reached nobody. Keep the profile online (`ghostly daemon --detach`), or give --for to wait until it is live";
|
|
4464
|
+
/**
|
|
4465
|
+
* A removal on its way goes with the chat's row, and the contact kept the message for good, though `message delete
|
|
4466
|
+
* --everyone` had said its removal goes on: `chat remove`, the engine's `removeLink` and `clearProfileData` (every
|
|
4467
|
+
* chat's row at once) are refused until `--force`.
|
|
4468
|
+
*/
|
|
4469
|
+
function noRemovalOnItsWay(ctx, linkIds, clearing = false) {
|
|
4470
|
+
const pending = linkIds.flatMap((linkId) => node(ctx).removalsPending({ linkId }));
|
|
4471
|
+
if (!pending.length) return;
|
|
4472
|
+
const n = pending.length, one = n === 1;
|
|
4473
|
+
const [now, then, go] = clearing ? [
|
|
4474
|
+
"clearing the profile",
|
|
4475
|
+
"clear it then",
|
|
4476
|
+
"clear it"
|
|
4477
|
+
] : [
|
|
4478
|
+
"removing the chat",
|
|
4479
|
+
"remove the chat then",
|
|
4480
|
+
"remove it"
|
|
4481
|
+
];
|
|
4482
|
+
throw new CliError("confirm", `${one ? "A message you deleted for everyone has" : `${n} messages you deleted for everyone have`} not reached the contact yet: ${now} now leaves ${one ? "it" : "them"} on their device. Keep this profile online until the contact is reachable (ghostly daemon --detach) and ${then}, or pass --force (force: true over the socket) to ${go} now`, { messages: pending });
|
|
4483
|
+
}
|
|
4423
4484
|
var METHODS = {
|
|
4424
4485
|
...WALLET_METHODS,
|
|
4425
4486
|
...FILE_METHODS,
|
|
@@ -5048,10 +5109,12 @@ var METHODS = {
|
|
|
5048
5109
|
const link = chatNotGroup(ctx, params, "group forget", "--yes");
|
|
5049
5110
|
if (!bool(params, "yes")) throw new CliError("confirm", "Removing a chat deletes its keys and history on this device; pass --yes (yes: true over the socket) to go on");
|
|
5050
5111
|
noCallOn(ctx, link.id, "remove the chat");
|
|
5112
|
+
if (!bool(params, "force")) noRemovalOnItsWay(ctx, [link.id]);
|
|
5051
5113
|
await node(ctx).removeLink({ linkId: link.id });
|
|
5052
5114
|
ctx.calls.forgetChat(link.id);
|
|
5053
5115
|
ctx.groupAuto.forgetChat(link.id);
|
|
5054
5116
|
await forgetHold(ctx, link.id);
|
|
5117
|
+
await closeServicesOf(ctx, link.peerPubKeyZ32);
|
|
5055
5118
|
return { removed: link.id };
|
|
5056
5119
|
},
|
|
5057
5120
|
async "chat.transport"(ctx, params) {
|
|
@@ -5399,7 +5462,7 @@ var METHODS = {
|
|
|
5399
5462
|
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`);
|
|
5400
5463
|
const deletes = DESTRUCTIVE_CALLS.get(method);
|
|
5401
5464
|
if (deletes && !bool(params, "yes")) throw new CliError("confirm", `${method} ${deletes}; pass --yes (yes: true over the socket) to go on`);
|
|
5402
|
-
if (method === "clearProfileData") return clearProfile(ctx);
|
|
5465
|
+
if (method === "clearProfileData") return clearProfile(ctx, bool(params, "force"));
|
|
5403
5466
|
const takes = ENGINE_PARAMS[method] ?? READ_PARAMS[method];
|
|
5404
5467
|
const wrong = (why, rawError) => new CliError("bad_request", `${method} takes ${takes || "no parameters"}: ${why} (ghostly engine --list --verbose)`, {
|
|
5405
5468
|
takes,
|
|
@@ -5408,8 +5471,10 @@ var METHODS = {
|
|
|
5408
5471
|
const problem = engineParamsProblem(method, args);
|
|
5409
5472
|
if (problem) throw wrong(problem);
|
|
5410
5473
|
if (typeof args?.linkId === "string") {
|
|
5411
|
-
if (method === "removeLink")
|
|
5412
|
-
|
|
5474
|
+
if (method === "removeLink") {
|
|
5475
|
+
noCallOn(ctx, args.linkId, "remove the chat");
|
|
5476
|
+
if (!bool(params, "force")) noRemovalOnItsWay(ctx, [args.linkId]);
|
|
5477
|
+
} else if (method === "setChatTransport" && args.transport === "dht" || method === "setDeliveryMode" && args.mode === "dht") noCallOn(ctx, args.linkId, "put the chat on DHT only");
|
|
5413
5478
|
}
|
|
5414
5479
|
if (args && ENGINE_SENDS.has(method) && !bool(params, "force")) await guardEngineSend(ctx, method, args);
|
|
5415
5480
|
if (method === "getMessages") return node(ctx).getMessages(str(args ?? {}, "linkId", true));
|
|
@@ -5417,12 +5482,16 @@ var METHODS = {
|
|
|
5417
5482
|
if (method === "setActiveLink") inviteShown.get(ctx)?.();
|
|
5418
5483
|
const target = node(ctx)[method];
|
|
5419
5484
|
if (typeof target !== "function") throw new CliError("not_found", `The engine has no call ${method}`);
|
|
5485
|
+
const removedPeer = method === "removeLink" ? state(ctx).links.find((link) => link.id === args?.linkId)?.peerPubKeyZ32 : void 0;
|
|
5420
5486
|
try {
|
|
5421
5487
|
const result = await target.call(node(ctx), args) ?? null;
|
|
5422
5488
|
if (method === "removeLink") {
|
|
5423
5489
|
ctx.calls.forgetChat(str(args ?? {}, "linkId", true));
|
|
5424
5490
|
ctx.groupAuto.forgetChat(str(args ?? {}, "linkId", true));
|
|
5491
|
+
await forgetHold(ctx, str(args ?? {}, "linkId", true));
|
|
5492
|
+
if (removedPeer) await closeServicesOf(ctx, removedPeer);
|
|
5425
5493
|
}
|
|
5494
|
+
if ((method === "setChatTransport" || method === "setDeliveryMode") && typeof args?.linkId === "string") await releaseHold(ctx, args.linkId, "lifted", true);
|
|
5426
5495
|
return result;
|
|
5427
5496
|
} catch (error) {
|
|
5428
5497
|
if (error instanceof TypeError && BAD_VALUE.test(error.message)) throw wrong("a parameter of the wrong kind", error.message);
|
|
@@ -5435,10 +5504,11 @@ var METHODS = {
|
|
|
5435
5504
|
* A daemon would go on serving the stopped engine's memory (chats and groups that are gone, new ones that are not
|
|
5436
5505
|
* kept): it stops once it has answered, and the next command starts on the emptied profile.
|
|
5437
5506
|
*/
|
|
5438
|
-
async function clearProfile(ctx) {
|
|
5507
|
+
async function clearProfile(ctx, force) {
|
|
5439
5508
|
const call = ctx.calls.list()[0];
|
|
5440
5509
|
if (call) throw new CliError("busy", `A call is on in a chat: hang it up first (ghostly call hangup ${call.chat}), then clear the profile`, { call: call.call });
|
|
5441
5510
|
const { links, groups } = state(ctx);
|
|
5511
|
+
if (!force) noRemovalOnItsWay(ctx, links.map((link) => link.id), true);
|
|
5442
5512
|
await node(ctx).clearProfileData();
|
|
5443
5513
|
const cleared = {
|
|
5444
5514
|
chats: links.length,
|
|
@@ -5629,13 +5699,35 @@ async function connectWithin(ctx, link, ms) {
|
|
|
5629
5699
|
} catch (error) {
|
|
5630
5700
|
if (asCliError(error).code !== "timeout") {
|
|
5631
5701
|
dhtOnly(findChat(state(ctx).links, link.id));
|
|
5702
|
+
const away = contactAway(error);
|
|
5703
|
+
if (away) throw new CliError("unavailable", `${away}. ${connectNext(ctx, link)}`, {
|
|
5704
|
+
chat: link.id,
|
|
5705
|
+
reason: error.message
|
|
5706
|
+
});
|
|
5632
5707
|
throw error;
|
|
5633
5708
|
}
|
|
5634
5709
|
} finally {
|
|
5635
5710
|
clearTimeout(timer);
|
|
5636
5711
|
}
|
|
5712
|
+
throw new CliError("timeout", `Timed out after ${Math.round(ms / 1e3)} s: the contact did not answer. ${connectNext(ctx, link)}`, { chat: link.id });
|
|
5713
|
+
}
|
|
5714
|
+
/** What happens after a `chat connect` the contact did not answer: the daemon dials again by itself, a one-shot does not. */
|
|
5715
|
+
function connectNext(ctx, link) {
|
|
5637
5716
|
const shown = /^[\w.:-]+$/.test(link.label ?? "") ? link.label : link.id;
|
|
5638
|
-
|
|
5717
|
+
return ctx.mode === "one-shot" ? "Try again later, or keep this profile online with `ghostly daemon --detach`: it reconnects by itself" : `It reconnects by itself while this profile is online; ghostly chat wait ${shown} --until live waits for it`;
|
|
5718
|
+
}
|
|
5719
|
+
/**
|
|
5720
|
+
* A dial that ended because the contact's app is not there: the link's own "Could not connect to the peer", or
|
|
5721
|
+
* HyperDHT's errors as the app's errorText says them (closed, or asleep or frozen). They answered as they came, without
|
|
5722
|
+
* the next step; HyperDHT's as `engine`, "PEER_NOT_FOUND: Peer not found", as if this side had failed.
|
|
5723
|
+
*/
|
|
5724
|
+
function contactAway(error) {
|
|
5725
|
+
const message = error instanceof Error ? error.message : "";
|
|
5726
|
+
const reason = /^Could not connect to the peer(?:: ([\s\S]*))?$/.exec(message);
|
|
5727
|
+
const native = reason ? reason[1] ?? "" : message;
|
|
5728
|
+
if (/^PEER_NOT_FOUND: /.test(native)) return "Your contact's app isn't reachable on HyperDHT: it may be closed";
|
|
5729
|
+
if (/^(?:PEER_CONNECTION_FAILED|BAD_HOLEPUNCH_REPLY|HOLEPUNCH_[A-Z_]+): /.test(native)) return "Your contact's app isn't answering on HyperDHT: it may be asleep or frozen";
|
|
5730
|
+
return reason ? "The contact did not answer" : void 0;
|
|
5639
5731
|
}
|
|
5640
5732
|
async function saveMark(ctx, params, remove) {
|
|
5641
5733
|
const target = chatOrGroup(ctx, str(params, "chat", true)), messageId = str(params, "message", true);
|
|
@@ -5760,4 +5852,4 @@ async function callApi(ctx, method, params = {}) {
|
|
|
5760
5852
|
//#endregion
|
|
5761
5853
|
export { groupPayTwins as _, hideStateSecrets as a, settingsInEffect as c, servedApps as d, nodeLocalFetch as f, groupMessageJson as g, groupJson as h, groupSendRefused as i, paymentJson as l, chatMessageJson as m, SETTABLE as n, mentionsFor as o, chatJson as p, callApi as r, redactSettings as s, API_METHODS as t, reportAppFrames as u, resumeHolds as v, flushCardUpdates as y };
|
|
5762
5854
|
|
|
5763
|
-
//# sourceMappingURL=api-
|
|
5855
|
+
//# sourceMappingURL=api-DBlaoz8i.js.map
|