@ghostlytools/cli 1.8.0 → 1.9.0
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 -8
- package/SKILL.md +4 -3
- package/dist/assets/{api-I_KbuXHa.js → api-DFCgr6RH.js} +94 -35
- package/dist/assets/api-DFCgr6RH.js.map +1 -0
- package/dist/assets/{api-Dj1yn0px.js → api-raWw9j_m.js} +2 -2
- package/dist/assets/{apiKit-C-_PWZvy.js → apiKit-CCavJJcl.js} +2 -2
- package/dist/assets/{apiKit-C-_PWZvy.js.map → apiKit-CCavJJcl.js.map} +1 -1
- package/dist/assets/{apps-DbEfL_3b.js → apps-B7o2BPj6.js} +1 -1
- package/dist/assets/{apps-DKIe8VjF.js → apps-DmxEG147.js} +2 -2
- package/dist/assets/{apps-DKIe8VjF.js.map → apps-DmxEG147.js.map} +1 -1
- package/dist/assets/{arkade-k1bdSm70.js → arkade-DtYR9H0c.js} +2 -2
- package/dist/assets/{arkade-k1bdSm70.js.map → arkade-DtYR9H0c.js.map} +1 -1
- package/dist/assets/{backup-Cdd6-HNu.js → backup-BserdrNk.js} +1 -1
- package/dist/assets/{backup-beKfbfNk.js → backup-YIB2XIES.js} +4 -4
- package/dist/assets/{backup-beKfbfNk.js.map → backup-YIB2XIES.js.map} +1 -1
- package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js.map +1 -1
- package/dist/assets/buttons-CuRfKnPI.js +1331 -0
- package/dist/assets/buttons-CuRfKnPI.js.map +1 -0
- package/dist/assets/buttons-De3LPdSG.js +2 -0
- package/dist/assets/{envelope-B88yiCQj.js → envelope-Dt75vrmY.js} +2 -2
- package/dist/assets/{envelope-B88yiCQj.js.map → envelope-Dt75vrmY.js.map} +1 -1
- package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js.map +1 -1
- package/dist/assets/fixedHosts-B598JzbC.js +24 -0
- package/dist/assets/fixedHosts-B598JzbC.js.map +1 -0
- package/dist/assets/{ghostly_iroh_web-CO0onry8.js → ghostly_iroh_web-BzAXJUYH.js} +10 -10
- package/dist/assets/{ghostly_iroh_web-CO0onry8.js.map → ghostly_iroh_web-BzAXJUYH.js.map} +1 -1
- package/dist/assets/ghostly_iroh_web_bg.wasm +0 -0
- package/dist/assets/{groupFiles-DjQc5XXv.js → groupFiles-FXel6zIc.js} +41 -11
- package/dist/assets/groupFiles-FXel6zIc.js.map +1 -0
- package/dist/assets/{host-CNWGB3-j.js → host-DIBeK_c_.js} +95 -28
- package/dist/assets/host-DIBeK_c_.js.map +1 -0
- package/dist/assets/hyperdhtRelay-1wzya_0L.js +25 -0
- package/dist/assets/hyperdhtRelay-1wzya_0L.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-g7eXzf5h.js → hyperdhtRelay-D185dETu.js} +15 -3
- package/dist/assets/hyperdhtRelay-D185dETu.js.map +1 -0
- package/dist/assets/{irohWeb-Bx8dI4be.js → irohWeb-BSv_BWyG.js} +25 -8
- package/dist/assets/{irohWeb-Bx8dI4be.js.map → irohWeb-BSv_BWyG.js.map} +1 -1
- package/dist/assets/{main-BRxhBctJ.js → main-BbhfMTt8.js} +50 -22
- package/dist/assets/main-BbhfMTt8.js.map +1 -0
- package/dist/assets/{mainline-CwuS6ngj.js → mainline-9Vc3c3SA.js} +2 -2
- package/dist/assets/{mainline-CwuS6ngj.js.map → mainline-9Vc3c3SA.js.map} +1 -1
- package/dist/assets/{networkReason-CIAMieQm.js → networkReason-BncJ9KSM.js} +2 -2
- package/dist/assets/{networkReason-CIAMieQm.js.map → networkReason-BncJ9KSM.js.map} +1 -1
- package/dist/assets/{nwc-C9JLJJkL.js → nwc-QX3Yt1Sb.js} +3 -3
- package/dist/assets/{nwc-C9JLJJkL.js.map → nwc-QX3Yt1Sb.js.map} +1 -1
- package/dist/assets/{nwcProvider-pFMrsUJh.js → nwcProvider-CzX3xH47.js} +2 -2
- package/dist/assets/{nwcProvider-pFMrsUJh.js.map → nwcProvider-CzX3xH47.js.map} +1 -1
- package/dist/assets/ownDid-D8z5gwGI.js +281 -0
- package/dist/assets/ownDid-D8z5gwGI.js.map +1 -0
- package/dist/assets/{registry-Cks7FA_o.js → registry-B2Dtnibo.js} +5 -246
- package/dist/assets/registry-B2Dtnibo.js.map +1 -0
- package/dist/assets/{registry-DY2ixQfU.js → registry-PTtBMaYZ.js} +1 -1
- package/dist/assets/{resolve-C4Y2HPqQ.js → resolve-ZxVzwFNA.js} +3 -280
- package/dist/assets/resolve-ZxVzwFNA.js.map +1 -0
- package/dist/assets/{server-D9RAmGdm.js → server-Dw1o8z1o.js} +1144 -359
- package/dist/assets/server-Dw1o8z1o.js.map +1 -0
- package/dist/assets/{src-1RU4TilT.js → src-BD8RBVEp.js} +1269 -134
- package/dist/assets/src-BD8RBVEp.js.map +1 -0
- package/dist/assets/sshForges-DWrESWkK.js +253 -0
- package/dist/assets/sshForges-DWrESWkK.js.map +1 -0
- package/dist/assets/{translate-od5GbpvR.js → translate-D1uP0q32.js} +17 -5
- package/dist/assets/translate-D1uP0q32.js.map +1 -0
- package/dist/assets/{usdt-DldXV0MR.js → usdt-DhVN8geQ.js} +3 -3
- package/dist/assets/{usdt-DldXV0MR.js.map → usdt-DhVN8geQ.js.map} +1 -1
- package/dist/assets/{waitNotice-Ck3el3_Z.js → waitNotice-B8D8WhbE.js} +2 -2
- package/dist/assets/waitNotice-B8D8WhbE.js.map +1 -0
- package/dist/assets/{words-BS2qq_vV.js → words-DdXPkB3n.js} +3 -2
- package/dist/assets/words-DdXPkB3n.js.map +1 -0
- package/dist/ghostly.mjs +1 -1
- package/examples/call-echo.mjs +7 -5
- package/package.json +1 -1
- package/dist/assets/api-I_KbuXHa.js.map +0 -1
- package/dist/assets/buttons-BO1_7V4L.js +0 -2
- package/dist/assets/buttons-ClI13rdv.js +0 -545
- package/dist/assets/buttons-ClI13rdv.js.map +0 -1
- package/dist/assets/groupFiles-DjQc5XXv.js.map +0 -1
- package/dist/assets/host-CNWGB3-j.js.map +0 -1
- package/dist/assets/hyperdhtRelay-BT_wRxab.js +0 -21
- package/dist/assets/hyperdhtRelay-BT_wRxab.js.map +0 -1
- package/dist/assets/hyperdhtRelay-g7eXzf5h.js.map +0 -1
- package/dist/assets/main-BRxhBctJ.js.map +0 -1
- package/dist/assets/registry-Cks7FA_o.js.map +0 -1
- package/dist/assets/resolve-C4Y2HPqQ.js.map +0 -1
- package/dist/assets/server-D9RAmGdm.js.map +0 -1
- package/dist/assets/src-1RU4TilT.js.map +0 -1
- package/dist/assets/translate-od5GbpvR.js.map +0 -1
- package/dist/assets/waitNotice-Ck3el3_Z.js.map +0 -1
- package/dist/assets/words-BS2qq_vV.js.map +0 -1
package/README.md
CHANGED
|
@@ -129,16 +129,16 @@ The rows are in alphabetical order of their first command, and every command of
|
|
|
129
129
|
| `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 |
|
|
130
130
|
| `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)). 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 |
|
|
131
131
|
| `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 |
|
|
132
|
-
| `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. One that sends a text that looks like a secret (`sendMessage`, `sendGroupMessage`, `editMessage`, `forwardMessages`) needs `--force` |
|
|
132
|
+
| `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`) needs `--force` |
|
|
133
133
|
| `events [--since seq] [--translate lang]` | What the event journal holds, without following ([Translation](#translation)) |
|
|
134
134
|
| `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"`). A file's id names its chat or its group, so `<chat>` may be left out |
|
|
135
135
|
| `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) |
|
|
136
136
|
| `file save [<chat>] <file> [--dir d \| --path p] [--force] [--wait [--timeout s]]` | Write a received file to disk: to `--path`, or into `--dir` under the name its sender gave it, with a `_` first when that name starts with `-`, so no tool run in the folder takes it for an option; a voice message goes in under the name Ghostly makes for it (`Ghostly voice <date time>`), and when that name is taken (two of one second) under a free `… (2)` (the answer's `path` is what was written). Never over a file without `--force`; an unfinished one says how many bytes are here; `--wait` waits for it first |
|
|
137
|
-
| `file send <chat\|group> <path> [--name n] [--mime t] [--voice [ms] [--peaks …]] [--reply <message>]` | A file, or a voice note (its length and waveform measured from the file unless given); `--reply` quotes a message, as `send --reply` does. Answers the message's `messageId` (what `message delete`, `react` and `pin` take) and the file's id. To a group (`group:<id>` when a chat has the same name), up to 100 MiB: every member sees it at once and each member's app fetches it from a member who has it (WISP 503) |
|
|
137
|
+
| `file send <chat\|group> <path> [--name n] [--mime t] [--voice [ms] [--peaks …]] [--reply <message>] [--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 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) |
|
|
138
138
|
| `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` |
|
|
139
139
|
| `forward <chat\|group> <message>… --to <chat\|group>… [--force] [--wait none\|sent] [--timeout s]` | Forward messages to up to 5 chats and groups (`--to` again for each; `group:<id>` names a group when a chat has the same name; an id that starts with a dash is taken as it is, `--to -Ab…` or `--to=-Ab…`). Each is a new message of yours that says it was forwarded (`forwarded`, the hop count) and nothing of who wrote it. Files go from the bytes this profile holds, never fetched again; a group takes texts only. A text that looks like a seed, a key or ecash needs `--force`. Answers `{from, results: [{to, kind, messageIds, error}]}`; any refusal fails the command (exit 1) with the results in `details`. `--wait sent`: each text on its way (a group's taken by an edge), each file's transfer done |
|
|
140
140
|
| `group create <name> [--mesh]`, `group join [<link> \| -]` | A community (a link anyone can open), or a private mesh. `group join` reads the link from stdin when none is given or `-` (on the command line it shows in `ps` and the shell's history, and the CLI warns). `group join` with the link of a community the profile was removed from asks to be let in again, and keeps its history |
|
|
141
|
-
| `group edit <group> <message> [text… \| --text <text> \| --stdin] [--mention <member>]… [--force]` | Replace the text of a message you sent to the group (`<message>` is the `messageId` `group send` gave). Every member sees it in place, marked edited; mentions whose `@name` is still in the text stay, `--mention` adds more. Answers `{group, messageId, edits, sent, edges}`: `edges` and `sent` as for `group send` (`sent: false` while no edge took this edit, also while it waits for the pace); `--wait sent` and `--timeout` as for `group send`. The text the message already has is no edit: `sent: false, unchanged: true`. A private group's members whose edge is down get it when it opens, a community's with the catch-up; a member on an older app keeps the old text |
|
|
141
|
+
| `group edit <group> <message> [text… \| --text <text> \| --stdin] [--mention <member>]… [--force]` | Replace the text of a message you sent to the group (`<message>` is the `messageId` `group send` gave). Every member sees it in place, marked edited; mentions whose `@name` is still in the text stay, `--mention` adds more. Answers `{group, messageId, edits, sent, edges}`: `edges` and `sent` as for `group send` (`sent: false` while no edge took this edit, also while it waits for the pace); `--wait sent` and `--timeout` as for `group send`. The text the message already has is no edit: `sent: false, unchanged: true`. A profile that is not a member any more (removed from the group) gets `refused`, with the reason, as does `message delete <group> <message> --everyone`. A private group's members whose edge is down get it when it opens, a community's with the catch-up; a member on an older app keeps the old text |
|
|
142
142
|
| `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) |
|
|
143
143
|
| `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) |
|
|
144
144
|
| `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}}` |
|
|
@@ -169,7 +169,7 @@ The rows are in alphabetical order of their first command, and every command of
|
|
|
169
169
|
| `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 (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 |
|
|
170
170
|
| `saved add\|remove <chat\|group> <message>`, `saved list` | Saved messages: mark a message of a chat or a group to find it again, kept for this profile on this device and never sent (the app shows the same list in its Saved view). `saved list` gives them the last saved first, each as it is now (an edit shows its latest text) with its `chat` or `group` and `savedAt`; a deleted message drops out |
|
|
171
171
|
| `send <chat> [text…] [--reply <message>] [--button id:Label]… [--style id=primary\|neutral\|danger]… [--once] [--id id] [--stdin] [--force] [--wait none\|sent\|delivered] [--timeout s]` | Send text (arguments, or stdin); `--reply` quotes a message of the chat. `--button yes:Yes` (1 to 6; the id ends at the first colon; no two labels alike ignoring case and spaces, and no label that is another button's id, else exit 2) puts buttons under the text, which is the question and what older apps show, so say how to answer in words. `--once`: one answer a person. A question that goes on the DHT floor or into a hold (the contact's app closed) reaches them as text alone; the engine sends its buttons again once the chat is live, as an edit of the buttons alone (no `message.edited` for it). The answer adds `buttons` (the question's id, `ask-…` unless `--id`), `card`, and `pressable`: whether the contact's app shows buttons (null until it says). A press comes back as `button.pressed` ([Events](#events)) |
|
|
172
|
-
| `service add <name> <http://127.0.0.1:port>`, `service share <service> <chat> [--off]`, `service list`, `service remove\|enable` | Share a web app on this machine, per contact. `service add` answers the new one as `service` (the id the others take); its old key `serviceId` stays beside it for one release |
|
|
172
|
+
| `service add <name> <http://127.0.0.1:port>`, `service share <service> <chat> [--off]`, `service list`, `service remove\|enable` | Share a web app on this machine, per contact. `service share` names its chat by the chat's id, its contact's key or a label given here, never only by the contact's own name or a prefix of its id. `service add` answers the new one as `service` (the id the others take); its old key `serviceId` stays beside it for one release |
|
|
173
173
|
| `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) |
|
|
174
174
|
| `settings get [--show-secret]`, `settings set <key> <json>` | Relays, Iroh relays, the HyperDHT relay, ICE servers, `sendTyping` (false: contacts are never told you type), … `<json>` as `-`, or none on a pipe, is read from stdin: a TURN password stays out of `ps` |
|
|
175
175
|
| `status` | The profile, its chats, whether WebRTC and calls run, the last event seq |
|
|
@@ -465,9 +465,12 @@ Its `AGENTS.md` is the guide for an AI agent that sets it up.
|
|
|
465
465
|
|
|
466
466
|
**The audio.** The socket is `<profile>/calls/<call>.sock` (0600), or `ghostly-calls-<hash>/<call>.sock` in
|
|
467
467
|
`$XDG_RUNTIME_DIR`, else in `/tmp/ghostly-calls-<uid>-<hash>/` (a folder of yours alone, 0700), when that path is too long; `call start`, `call answer`, `call list` and the
|
|
468
|
-
`call.connected` event name it. It carries raw PCM,
|
|
468
|
+
`call.connected` event name it. On Windows it is a named pipe. It carries raw PCM,
|
|
469
469
|
with no framing:
|
|
470
470
|
|
|
471
|
+
- First, the call's token: `audio.token` (64 hex digits, new for every call, in the same answers and events as the
|
|
472
|
+
socket) and a line feed. Required on Windows: until a connection sends it, it gets no audio and replaces no program,
|
|
473
|
+
and a wrong one is closed. On Linux and macOS a program that does not send it still works.
|
|
471
474
|
- s16le, mono, at the call's rate: 48000 by default, or 24000, 16000, 12000, 8000 with `--rate`. Opus runs at that
|
|
472
475
|
rate itself, so nothing is resampled.
|
|
473
476
|
- From the call: the contact's audio in 20 ms frames (1920 bytes at 48 kHz, 640 at 16 kHz), as they are decoded.
|
|
@@ -480,13 +483,13 @@ with no framing:
|
|
|
480
483
|
no sooner than 2 s later: `call start` refuses sooner with `busy` and `details.retryAfterMs`. The contact's app
|
|
481
484
|
would not ring a call that comes that fast after a missed one.
|
|
482
485
|
- The socket exists from `call start`/`call answer`, so the program may connect before the media is up. One program
|
|
483
|
-
at a time: a new connection replaces the old one. When the call ends, the program reads EOF and the socket is
|
|
486
|
+
at a time: a new connection (once it sent the token, on Windows) replaces the old one. When the call ends, the program reads EOF and the socket is
|
|
484
487
|
removed.
|
|
485
488
|
- Added latency inside the CLI: at most one 20 ms frame going out; coming in, a frame as soon as its packet is
|
|
486
489
|
decoded (up to 40 ms more when a packet is late; a lost one becomes 20 ms of silence).
|
|
487
490
|
|
|
488
491
|
**Events.** `call.incoming` `{call, chat, name, video, auto}`, `call.outgoing` `{call, chat, name, audio}`,
|
|
489
|
-
`call.connected` `{call, chat, direction, audio: {socket, rate, channels, format, frameMs}}`, `call.stalled`
|
|
492
|
+
`call.connected` `{call, chat, direction, audio: {socket, token, rate, channels, format, frameMs}}`, `call.stalled`
|
|
490
493
|
`{call, chat, direction, silentMs}` (a connected call heard no packet from the contact for 5 s: its side may have died;
|
|
491
494
|
`call.get` says `stalled: true`), `call.resumed` `{call, chat, direction, silentMs}` (packets came back after
|
|
492
495
|
`silentMs` without any), and `call.ended` `{call, chat, direction, reason, duration?}` with `reason`:
|
|
@@ -547,7 +550,7 @@ A profile publishes on Pkarr within seconds of its first run (its `did:dht` reco
|
|
|
547
550
|
public relays and the Mainline DHT unless told otherwise. To keep a private network or a test on its own relays from
|
|
548
551
|
the start, run every command with `GHOSTLY_PKARR_RELAYS=http://…,…` (the Desktop reads the same variable): those are
|
|
549
552
|
then the only Pkarr relays, the profile's `relays` setting is not used, and the Mainline DHT is left out unless
|
|
550
|
-
`GHOSTLY_DHT_BOOTSTRAP` names your own nodes. `GHOSTLY_IROH_RELAYS=https://…,…` (`http://` on loopback) does the same
|
|
553
|
+
`GHOSTLY_DHT_BOOTSTRAP` names your own nodes. `GHOSTLY_IROH_RELAYS=https://…,…` (`http://` on loopback, at most five) does the same
|
|
551
554
|
for Iroh: those are the only Iroh relays, whatever `irohRelays` says. `status` shows the relays in use (`discovery.relays`); `settings get`
|
|
552
555
|
still shows the profile's own list, which is used again once the variable is unset. Without the variable,
|
|
553
556
|
`settings set relays '["http://…"]'` before the first `daemon`, with `GHOSTLY_DHT=0` or `GHOSTLY_DHT_BOOTSTRAP`, does
|
package/SKILL.md
CHANGED
|
@@ -199,7 +199,7 @@ ghostly file save <file id> --dir ./inbox --wait # a file or voice note a tu
|
|
|
199
199
|
ghostly typing alice --kind thinking --status "Transcribing your audio" --for 120
|
|
200
200
|
ghostly file send alice ./answer.ogg --voice --reply <message id> # a voice note: length and waveform from the file
|
|
201
201
|
ghostly file send alice ./note.m4a --voice 4200 # or its length given in ms (AAC needs ffmpeg for the waveform)
|
|
202
|
-
ghostly file send alice ./report.pdf # a file
|
|
202
|
+
ghostly file send alice ./report.pdf # a file (no daemon: stays until alice has all of it)
|
|
203
203
|
ghostly file wait <file id> --timeout 120 # exit 0 when done, 1 when it failed, 4 on timeout
|
|
204
204
|
ghostly file accept <file id> # a file over 25 MiB waits for this (file.offered event)
|
|
205
205
|
```
|
|
@@ -379,7 +379,8 @@ ghostly service add docs http://127.0.0.1:8080 # a web app on this machine
|
|
|
379
379
|
ghostly service share <service id> alice # alice may open it; nobody else
|
|
380
380
|
```
|
|
381
381
|
|
|
382
|
-
A call's audio is raw PCM on its own Unix socket, 48 kHz by default
|
|
382
|
+
A call's audio is raw PCM on its own Unix socket, 48 kHz by default, after the call's `audio.token` and a line feed
|
|
383
|
+
(required on Windows); see `examples/call-echo.mjs`. To answer calls by
|
|
383
384
|
voice, clone [ghostly-voice-agent](https://github.com/MiguelMedeiros/ghostly-voice-agent) rather than writing one: it listens, transcribes, asks Claude
|
|
384
385
|
and speaks the reply (ElevenLabs), and its `AGENTS.md` walks an agent through the setup. Making an identity proof
|
|
385
386
|
needs a person who holds the key: leave that to the owner.
|
|
@@ -398,7 +399,7 @@ needs a person who holds the key: leave that to the owner.
|
|
|
398
399
|
|
|
399
400
|
Every call of the app's engine is reachable: `ghostly engine --list --verbose` (each call with what it takes), then `ghostly engine <method> '<json params>'`.
|
|
400
401
|
A call that deletes chats or groups (`clearProfileData`, `removeLink`, `leaveGroup`, `forgetGroup`, `deviceRemove`)
|
|
401
|
-
needs `--yes`; `clearProfileData` stops a running daemon after it answers.
|
|
402
|
+
needs `--yes`; `clearProfileData` stops a running daemon after it answers, and is refused (`busy`) while a call is on: hang it up first.
|
|
402
403
|
Not on the CLI yet: Bark wallets, OpenID Connect proofs, and video in calls (voice only). More:
|
|
403
404
|
[AI agents on Ghostly](https://ghostly.tools/developers/agents), the
|
|
404
405
|
[CLI guide](https://github.com/MiguelMedeiros/ghostly/blob/main/docs/CLI.md), the
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $a as replySnippet, $i as identityStatement, Al as inviteLink, Bn as stripPictureMetadata, Ca as downsamplePeaks, Da as voiceLevel, Ea as voiceDownloadName, Gr as sanitizeTypingStatus, Hr as TYPING_KINDS, In as withoutVideoMetadata, Jo as parseLocalTarget, Kc as APP_PERMISSIONS, Ko as GhostlyHttpError, Ln as NO_PICTURE_METADATA, Lu as randomBytes$1, Ml as ownInviteRefusal, Mu as sanitizeAvatar, Qn as GROUP_FILE_LIMITS, Ru as toBase64Url, Sa as baseMime, Ta as parseVoiceMeta, Ur as TYPING_REFRESH_MS, Vn as withoutPictureMetadata, X as groupName, Xo as LIMITS, Zc as isAppUrl, _a as sanitizeFileName, _o as statusCardBytes, al as appRef, ba as VOICE_LIMITS, bo as claimedTime, co as STATUS_CARD_LIMITS, di as APP_DATA_MAX_BYTES, do as appCardUrl, gl as readImageMeta, ho as checkStatusCard, ju as MAX_AVATAR_LENGTH, ll as isAppRef, po as cardLine, uo as appCardId, va as sanitizeMime, xa as VOICE_METER, ya as PLAYABLE_AUDIO, zo as AWAITING_PEER_MS } from "./src-BD8RBVEp.js";
|
|
2
2
|
import { u as fileStore } from "./idb-BkOJES5_.js";
|
|
3
|
-
import { O as waitingGroupFile, T as removeStored, X as iceServerProblem, Z as iceServerSetting, i as groupOfFile, k as IDENTITY_DRAFT_TTL_MS, l as replyRef, n as groupFileId, v as paymentNetwork } from "./groupFiles-
|
|
3
|
+
import { O as waitingGroupFile, T as removeStored, X as iceServerProblem, Z as iceServerSetting, i as groupOfFile, k as IDENTITY_DRAFT_TTL_MS, l as replyRef, n as groupFileId, v as paymentNetwork } from "./groupFiles-FXel6zIc.js";
|
|
4
4
|
import { f as FILE_BYTES_STEP, o as fileBytes, s as fileBytesOf } from "./fileBytes-DNgrRL0R.js";
|
|
5
|
-
import { t as IDENTITY_PROVIDERS } from "./registry-
|
|
6
|
-
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, u as findSecret } from "./buttons-
|
|
7
|
-
import { a as WALLET_TYPES, c as DESTRUCTIVE_CALLS, d as ENGINE_READS, f as READ_PARAMS, i as TRANSPORT_NAMES, l as ENGINE_METHODS, m as engineParamsProblem, n as CHAT_METHODS, r as PAY_METHODS, s as withStoredIds, t as ADDRESS_TYPES, u as ENGINE_PARAMS } from "./words-
|
|
5
|
+
import { t as IDENTITY_PROVIDERS } from "./registry-B2Dtnibo.js";
|
|
6
|
+
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, u as findSecret } from "./buttons-CuRfKnPI.js";
|
|
7
|
+
import { a as WALLET_TYPES, c as DESTRUCTIVE_CALLS, d as ENGINE_READS, f as READ_PARAMS, i as TRANSPORT_NAMES, l as ENGINE_METHODS, m as engineParamsProblem, n as CHAT_METHODS, r as PAY_METHODS, s as withStoredIds, t as ADDRESS_TYPES, u as ENGINE_PARAMS } from "./words-DdXPkB3n.js";
|
|
8
8
|
import { i as localFileError, r as asCliError, t as CliError } from "./errors-R4S2SAEM.js";
|
|
9
|
-
import { S as waitForState, _ as oneOf, a as dhtOnly, b as str, c as findGroup, d as inviteTaken, f as list, g as num, h as node, i as chatOrGroup, n as bool, o as findChat, p as messageOf, r as chatOf, s as findChatOrGroup, u as groupOf, v as sentAt, x as transportOffered, y as state } from "./apiKit-
|
|
9
|
+
import { S as waitForState, _ as oneOf, a as dhtOnly, b as str, c as findGroup, d as inviteTaken, f as list, g as num, h as node, i as chatOrGroup, l as findOwnNamedChat, n as bool, o as findChat, p as messageOf, r as chatOf, s as findChatOrGroup, u as groupOf, v as sentAt, x as transportOffered, y as state } from "./apiKit-CCavJJcl.js";
|
|
10
10
|
import { a as checkShownName } from "./profiles-MFtCmJwK.js";
|
|
11
|
-
import { t as BACKUP_METHODS } from "./backup-
|
|
12
|
-
import { o as checkedBundle } from "./apps-
|
|
11
|
+
import { t as BACKUP_METHODS } from "./backup-YIB2XIES.js";
|
|
12
|
+
import { o as checkedBundle } from "./apps-DmxEG147.js";
|
|
13
13
|
import { generateMnemonic } from "@scure/bip39";
|
|
14
14
|
import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
15
15
|
import { execFile, spawn } from "node:child_process";
|
|
@@ -836,12 +836,27 @@ async function voiceOf(params, path, mime, size) {
|
|
|
836
836
|
throw new CliError("bad_request", `A voice note's waveform is 1 to ${VOICE_LIMITS.maxBars} peaks from 0 to 255`);
|
|
837
837
|
}
|
|
838
838
|
/**
|
|
839
|
+
* The file at `path` as it is sent, as the apps send it (platform/services.ts `sendable`): a picture or an MP4 or
|
|
840
|
+
* QuickTime video without its metadata (where it was taken or recorded, the device, the time), before its size is read
|
|
841
|
+
* and its digest computed. One whose metadata cannot be removed is refused, never sent as it was. A voice note goes as it is.
|
|
842
|
+
*/
|
|
843
|
+
async function sendable(path, mime, voice) {
|
|
844
|
+
const source = await openAsBlob(path, { type: mime });
|
|
845
|
+
if (voice) return source;
|
|
846
|
+
try {
|
|
847
|
+
return await withoutPictureMetadata(source, mime) ?? await withoutVideoMetadata(source, mime) ?? source;
|
|
848
|
+
} catch (error) {
|
|
849
|
+
if (error instanceof Error && (error.message === "This picture cannot be sent: Ghostly could not remove the details saved in it, like where it was taken" || error.message === "This video cannot be sent: Ghostly could not remove the details saved in it, like where it was recorded")) throw new CliError("refused", error.message);
|
|
850
|
+
throw error;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
839
854
|
* 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
|
|
840
855
|
* the announcement. This device is its first holder and serves the members who ask.
|
|
841
856
|
*/
|
|
842
|
-
async function sendToGroup(ctx, params, group, path,
|
|
843
|
-
if (
|
|
844
|
-
if (!
|
|
857
|
+
async function sendToGroup(ctx, params, group, path, picked) {
|
|
858
|
+
if (picked > GROUP_FILE_LIMITS.maxBytes) throw new CliError("refused", `Too large for a group (at most ${GROUP_FILE_LIMITS.maxBytes} bytes)`);
|
|
859
|
+
if (!picked) throw new CliError("refused", "An empty file cannot go to a group");
|
|
845
860
|
const mime = mimeOf(path, str(params, "mime"));
|
|
846
861
|
const replyTo = str(params, "reply");
|
|
847
862
|
if (replyTo) {
|
|
@@ -849,8 +864,9 @@ async function sendToGroup(ctx, params, group, path, size) {
|
|
|
849
864
|
}
|
|
850
865
|
const check = await node(ctx).groupFileCheck({ groupId: group.id });
|
|
851
866
|
if (check.error) throw check.refused ? new CliError("refused", check.error) : groupSendRefused(check.error);
|
|
852
|
-
const { voice, warning } = await voiceOf(params, path, mime,
|
|
853
|
-
const source = await
|
|
867
|
+
const { voice, warning } = await voiceOf(params, path, mime, picked);
|
|
868
|
+
const source = await sendable(path, mime, voice);
|
|
869
|
+
const size = source.size;
|
|
854
870
|
const image = voice ? void 0 : await readImageMeta(source, mime);
|
|
855
871
|
const fileId = groupFileId(group.id, "out");
|
|
856
872
|
const file = {
|
|
@@ -989,6 +1005,11 @@ var FILE_METHODS = {
|
|
|
989
1005
|
}
|
|
990
1006
|
if (!info.isFile()) throw new CliError("bad_request", `${path} is not a file`);
|
|
991
1007
|
await access(path, constants$1.R_OK);
|
|
1008
|
+
const wait = oneOf(params, "wait", "group" in target ? ["none"] : ["none", "sent"], !("group" in target) && ctx.mode === "one-shot" ? "sent" : "none");
|
|
1009
|
+
const seconds = num(params, "timeout", 300, {
|
|
1010
|
+
min: 1,
|
|
1011
|
+
max: 86400
|
|
1012
|
+
});
|
|
992
1013
|
if ("group" in target) return sendToGroup(ctx, params, target.group, path, info.size);
|
|
993
1014
|
const { link } = target;
|
|
994
1015
|
if (link.profile && link.dataLink === "open" && !link.capabilities?.files) throw new CliError("unavailable", "The contact's app takes no files");
|
|
@@ -1000,13 +1021,13 @@ var FILE_METHODS = {
|
|
|
1000
1021
|
if (!await findMessage(ctx, link.id, (m) => m.id === replyTo || replyRef(m) === replyTo)) throw new CliError("not_found", "That message is not in this chat, or cannot be replied to");
|
|
1001
1022
|
}
|
|
1002
1023
|
const { voice, warning } = await voiceOf(params, path, mime, info.size);
|
|
1003
|
-
const source = await
|
|
1024
|
+
const source = await sendable(path, mime, voice);
|
|
1004
1025
|
const image = voice ? void 0 : await readImageMeta(source, mime);
|
|
1005
1026
|
const wireId = toBase64Url(randomBytes$1(12));
|
|
1006
1027
|
const file = {
|
|
1007
1028
|
id: `${link.id}-out-${wireId}`,
|
|
1008
1029
|
name: sanitizeFileName(str(params, "name") ?? basename(path)),
|
|
1009
|
-
size:
|
|
1030
|
+
size: source.size,
|
|
1010
1031
|
mime,
|
|
1011
1032
|
...voice ? { voice } : {},
|
|
1012
1033
|
...image ? { image } : {}
|
|
@@ -1048,6 +1069,11 @@ var FILE_METHODS = {
|
|
|
1048
1069
|
await removeStored(file.id).catch(() => {});
|
|
1049
1070
|
throw new CliError("refused", error instanceof Error ? error.message : String(error));
|
|
1050
1071
|
}
|
|
1072
|
+
if (wait === "sent") await FILE_METHODS["file.wait"](ctx, {
|
|
1073
|
+
chat: link.id,
|
|
1074
|
+
file: file.id,
|
|
1075
|
+
timeout: seconds
|
|
1076
|
+
});
|
|
1051
1077
|
return {
|
|
1052
1078
|
chat: link.id,
|
|
1053
1079
|
messageId: `me_${timestamp}`,
|
|
@@ -1128,8 +1154,11 @@ var FILE_METHODS = {
|
|
|
1128
1154
|
if (outgoing && (action === "accept" || action === "decline")) throw new CliError("bad_request", "A file sent from here is not accepted or declined: file cancel stops it");
|
|
1129
1155
|
await refuseAllHere();
|
|
1130
1156
|
const transfer = state(ctx).transfers[fileId] ?? (await fileStore.get(fileId).catch(() => void 0))?.transfer;
|
|
1157
|
+
if (action === "pause" && transfer?.stage === "verifying") throw new CliError("refused", "Too late to pause: it is being checked");
|
|
1131
1158
|
if (transfer?.state === "failed") throw new CliError("refused", `It ended: ${transfer.error ?? "failed"}${outgoing && transfer.retry ? " (file resend sends it again)" : ""}`);
|
|
1132
|
-
|
|
1159
|
+
const whole = outgoing && transfer?.state === "transferring" && (transfer.stage === "verifying" || transfer.size > 0 && transfer.transferred >= transfer.size && transfer.stage !== "asking" && transfer.stage !== "queued" && transfer.stage !== "paused");
|
|
1160
|
+
if (whole && action === "cancel") throw new CliError("refused", "Too late to cancel: it arrived whole, and the contact keeps it");
|
|
1161
|
+
if (whole && action === "pause") throw new CliError("refused", "Too late to pause: it arrived whole, and the contact keeps it");
|
|
1133
1162
|
}
|
|
1134
1163
|
await node(ctx).fileAction({
|
|
1135
1164
|
linkId,
|
|
@@ -1300,10 +1329,20 @@ function fieldsOf(params) {
|
|
|
1300
1329
|
}
|
|
1301
1330
|
/**
|
|
1302
1331
|
* An update merged over a card: fields given replace those there, `pr` field by field, and a field given as null goes
|
|
1303
|
-
* (`--json '{"step":null}'`). The kind and the id never change.
|
|
1332
|
+
* (`--json '{"step":null}'`). The kind and the id never change. A task says how far it is one way: a percent given
|
|
1333
|
+
* replaces the steps there and steps given the percent, unless the update gives both. Before, `--steps 4/5` over an
|
|
1334
|
+
* earlier `--progress 90` showed "90% · 4 of 5 steps", its bar at 90: a card's own percent wins over its steps.
|
|
1304
1335
|
*/
|
|
1305
1336
|
function mergeCard(base, patch) {
|
|
1306
1337
|
const out = { ...base };
|
|
1338
|
+
if (base.kind === "task") {
|
|
1339
|
+
const given = (key) => patch[key] !== void 0 && patch[key] !== null;
|
|
1340
|
+
const steps = given("done") || given("total");
|
|
1341
|
+
if (given("progress") && !steps) {
|
|
1342
|
+
delete out.done;
|
|
1343
|
+
delete out.total;
|
|
1344
|
+
} else if (steps && !given("progress")) delete out.progress;
|
|
1345
|
+
}
|
|
1307
1346
|
for (const [key, value] of Object.entries(patch)) {
|
|
1308
1347
|
if (key === "kind" || key === "id") continue;
|
|
1309
1348
|
if (value === null) {
|
|
@@ -2030,28 +2069,31 @@ function groupJson(group, showSecret = false) {
|
|
|
2030
2069
|
* engine enforces who may do what (the admin); these check the arguments and name members.
|
|
2031
2070
|
*/
|
|
2032
2071
|
/**
|
|
2033
|
-
* A member by key, unique key prefix or name; never this profile itself
|
|
2034
|
-
* member calls itself; a prefix and a name stand side by side (two
|
|
2072
|
+
* A member by key, unique key prefix or name; never this profile itself (`myName`: its name, which its own row lacks).
|
|
2073
|
+
* A whole key is that member, whatever another member calls itself; a prefix and a name stand side by side (two
|
|
2074
|
+
* members is an error, not a guess).
|
|
2035
2075
|
*/
|
|
2036
|
-
function findMember(group, ref) {
|
|
2076
|
+
function findMember(group, ref, myName) {
|
|
2037
2077
|
const lower = ref.toLowerCase();
|
|
2038
2078
|
const others = group.members.filter((m) => !m.me);
|
|
2039
2079
|
const byKey = others.filter((m) => m.key === ref);
|
|
2040
2080
|
const matches = byKey.length ? byKey : others.filter((m) => m.key.startsWith(ref) || m.nick?.trim().toLowerCase() === lower);
|
|
2041
2081
|
if (matches.length === 1) return matches[0];
|
|
2042
|
-
throw matches.length ? new CliError("bad_request", `${JSON.stringify(ref)} names more than one member`) : noMember(group, ref);
|
|
2082
|
+
throw matches.length ? new CliError("bad_request", `${JSON.stringify(ref)} names more than one member`) : noMember(group, ref, myName);
|
|
2043
2083
|
}
|
|
2044
2084
|
/**
|
|
2045
|
-
* A ref no other member answers to. When it is this profile's own key (or a prefix of it),
|
|
2046
|
-
* read as if this profile were not in the group.
|
|
2085
|
+
* A ref no other member answers to. When it is this profile's own key (or a prefix of it), or its own name, it says
|
|
2086
|
+
* so: "No member" read as if this profile were not in the group.
|
|
2047
2087
|
*/
|
|
2048
|
-
function noMember(group, ref) {
|
|
2049
|
-
if (group.members.some((m) => m.me && m.key.startsWith(ref))) return new CliError("bad_request", `${JSON.stringify(ref)} is you: name another member of ${group.name}`);
|
|
2088
|
+
function noMember(group, ref, myName) {
|
|
2089
|
+
if (!!myName?.trim() && myName.trim().toLowerCase() === ref.toLowerCase() || group.members.some((m) => m.me && m.key.startsWith(ref))) return new CliError("bad_request", `${JSON.stringify(ref)} is you: name another member of ${group.name}`);
|
|
2050
2090
|
return new CliError("not_found", `No member ${JSON.stringify(ref)} in ${group.name}`);
|
|
2051
2091
|
}
|
|
2052
2092
|
/**
|
|
2053
2093
|
* A picture as Ghostly sends it: a square JPEG data URL, checked as a contact would check it. The app scales and
|
|
2054
2094
|
* crops any image to 128×128; here the file must already be a JPEG within the bounds (no image library on Node).
|
|
2095
|
+
* It goes without its metadata (where it was taken, the device, the time), as the app's re-encoded one does; a
|
|
2096
|
+
* picture whose metadata cannot be removed is refused, never sent as it was.
|
|
2055
2097
|
*/
|
|
2056
2098
|
async function pictureFrom(path) {
|
|
2057
2099
|
let bytes;
|
|
@@ -2060,7 +2102,14 @@ async function pictureFrom(path) {
|
|
|
2060
2102
|
} catch (error) {
|
|
2061
2103
|
throw localFileError(error, path) ?? new CliError("not_found", `No file ${path}`);
|
|
2062
2104
|
}
|
|
2063
|
-
|
|
2105
|
+
let parts;
|
|
2106
|
+
try {
|
|
2107
|
+
parts = stripPictureMetadata(bytes, "application/octet-stream");
|
|
2108
|
+
} catch (error) {
|
|
2109
|
+
if (error instanceof Error && error.message === "This picture cannot be sent: Ghostly could not remove the details saved in it, like where it was taken") throw new CliError("refused", NO_PICTURE_METADATA);
|
|
2110
|
+
throw error;
|
|
2111
|
+
}
|
|
2112
|
+
const url = `data:image/jpeg;base64,${(parts ? Buffer.concat(parts) : bytes).toString("base64")}`;
|
|
2064
2113
|
const checked = sanitizeAvatar(url);
|
|
2065
2114
|
if (!checked) throw new CliError("bad_request", `A picture is a JPEG of at most 512×512 px and about ${Math.floor(MAX_AVATAR_LENGTH * .74 / 1e3)} KB (128×128 is what the app sends): resize it first`);
|
|
2066
2115
|
return checked;
|
|
@@ -2069,6 +2118,8 @@ async function picture(params) {
|
|
|
2069
2118
|
if (bool(params, "clear")) return null;
|
|
2070
2119
|
return pictureFrom(str(params, "path", true));
|
|
2071
2120
|
}
|
|
2121
|
+
/** The member `params.member` names in `group`, this profile's own name said to be it. */
|
|
2122
|
+
var member = (ctx, group, params) => findMember(group, str(params, "member", true), state(ctx).settings.nick);
|
|
2072
2123
|
var view = (ctx, id, params) => groupJson(state(ctx).groups.find((g) => g.id === id) ?? groupOf(ctx, { group: id }), bool(params, "showSecret"));
|
|
2073
2124
|
var GROUP_ADMIN_METHODS = {
|
|
2074
2125
|
async "group.invite"(ctx, params) {
|
|
@@ -2084,7 +2135,7 @@ var GROUP_ADMIN_METHODS = {
|
|
|
2084
2135
|
const group = groupOf(ctx, params);
|
|
2085
2136
|
await node(ctx).removeGroupMember({
|
|
2086
2137
|
groupId: group.id,
|
|
2087
|
-
key:
|
|
2138
|
+
key: member(ctx, group, params).key
|
|
2088
2139
|
});
|
|
2089
2140
|
return view(ctx, group.id, params);
|
|
2090
2141
|
},
|
|
@@ -2092,7 +2143,7 @@ var GROUP_ADMIN_METHODS = {
|
|
|
2092
2143
|
const group = groupOf(ctx, params);
|
|
2093
2144
|
await node(ctx).makeGroupAdmin({
|
|
2094
2145
|
groupId: group.id,
|
|
2095
|
-
key:
|
|
2146
|
+
key: member(ctx, group, params).key
|
|
2096
2147
|
});
|
|
2097
2148
|
return view(ctx, group.id, params);
|
|
2098
2149
|
},
|
|
@@ -2106,7 +2157,7 @@ var GROUP_ADMIN_METHODS = {
|
|
|
2106
2157
|
].includes(role)) throw new CliError("bad_request", "role is pin, exclude or auto");
|
|
2107
2158
|
await node(ctx).setGroupHub({
|
|
2108
2159
|
groupId: group.id,
|
|
2109
|
-
key:
|
|
2160
|
+
key: member(ctx, group, params).key,
|
|
2110
2161
|
role: role === "auto" ? null : role
|
|
2111
2162
|
});
|
|
2112
2163
|
return view(ctx, group.id, params);
|
|
@@ -2782,7 +2833,7 @@ var SERVICE_METHODS = {
|
|
|
2782
2833
|
};
|
|
2783
2834
|
},
|
|
2784
2835
|
async "service.share"(ctx, params) {
|
|
2785
|
-
const link =
|
|
2836
|
+
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true));
|
|
2786
2837
|
const shared = !bool(params, "off");
|
|
2787
2838
|
const serviceId = serviceOf(ctx, params);
|
|
2788
2839
|
await node(ctx).setServiceShared({
|
|
@@ -2929,6 +2980,7 @@ var APP_SERVE_METHODS = {
|
|
|
2929
2980
|
if (grant.includes("internet")) throw new CliError("refused", "internet cannot be granted here: no app's page runs on the CLI, and a bot reaches the network as its own program");
|
|
2930
2981
|
const given = str(params, "url");
|
|
2931
2982
|
if (given !== void 0 && !isAppUrl(given)) throw new CliError("bad_request", "url is where a contact's app reads the bundle: https only, no user or password, jsDelivr only at a full commit");
|
|
2983
|
+
if (given !== void 0 && /[?#]/.test(given)) throw new CliError("bad_request", "url goes to contacts on the app's card: no query or fragment (a private repository's token rides there); publish the app in a public repository");
|
|
2932
2984
|
const { bundle, url } = await checkedBundle(source);
|
|
2933
2985
|
const m = bundle.manifest;
|
|
2934
2986
|
if (!m.permissions.includes("chat")) throw new CliError("refused", `${m.title} does not ask for chat: it talks to no contact, so a bot has nothing to speak for it`);
|
|
@@ -2940,7 +2992,7 @@ var APP_SERVE_METHODS = {
|
|
|
2940
2992
|
missing
|
|
2941
2993
|
});
|
|
2942
2994
|
const ref = appRef(m.publisher, m.name);
|
|
2943
|
-
const cardUrl = given ?? url ?? m.sources?.[0];
|
|
2995
|
+
const cardUrl = appCardUrl(given ?? url ?? m.sources?.[0]);
|
|
2944
2996
|
const app = {
|
|
2945
2997
|
ref,
|
|
2946
2998
|
title: m.title,
|
|
@@ -3839,7 +3891,8 @@ var inviteShown = /* @__PURE__ */ new WeakMap();
|
|
|
3839
3891
|
* Refuses DHT only (a hold, `chat transport dht`) while a call is on in the chat. A call's signals cross the live
|
|
3840
3892
|
* link: off it, the call talked on over its own connection, and a hang-up from either side never reached the other
|
|
3841
3893
|
* (that call ended only when its media stalled out, 16 s later). Removing the chat (`chat remove`) is refused the same
|
|
3842
|
-
* way: the call talked on in a chat gone from this device, and its hang-up had no chat left to cross.
|
|
3894
|
+
* way: the call talked on in a chat gone from this device, and its hang-up had no chat left to cross. `engine.call`
|
|
3895
|
+
* refuses the raw calls that do the same (`removeLink`, `setChatTransport` / `setDeliveryMode` to `dht`).
|
|
3843
3896
|
*/
|
|
3844
3897
|
function noCallOn(ctx, linkId, then) {
|
|
3845
3898
|
const call = ctx.calls.list().find((c) => c.chat === linkId);
|
|
@@ -4181,7 +4234,7 @@ var METHODS = {
|
|
|
4181
4234
|
...messageId && { messageId },
|
|
4182
4235
|
remove
|
|
4183
4236
|
});
|
|
4184
|
-
if (result.error) throw new CliError(result.refused || /Only the admin/.test(result.error) ? "refused" : /not in this chat|Nothing is pinned/.test(result.error) ? "not_found" : "bad_request", result.error);
|
|
4237
|
+
if (result.error) throw new CliError(result.refused || /Only the admin/.test(result.error) ? "refused" : /not in this (?:chat|group)|Nothing is pinned/.test(result.error) ? "not_found" : "bad_request", result.error);
|
|
4185
4238
|
if (target.group) return {
|
|
4186
4239
|
group: target.id,
|
|
4187
4240
|
messageId: remove ? null : messageId,
|
|
@@ -4696,6 +4749,10 @@ var METHODS = {
|
|
|
4696
4749
|
});
|
|
4697
4750
|
const problem = engineParamsProblem(method, args);
|
|
4698
4751
|
if (problem) throw wrong(problem);
|
|
4752
|
+
if (typeof args?.linkId === "string") {
|
|
4753
|
+
if (method === "removeLink") noCallOn(ctx, args.linkId, "remove the chat");
|
|
4754
|
+
else if (method === "setChatTransport" && args.transport === "dht" || method === "setDeliveryMode" && args.mode === "dht") noCallOn(ctx, args.linkId, "put the chat on DHT only");
|
|
4755
|
+
}
|
|
4699
4756
|
if (args && ENGINE_SENDS.has(method) && !bool(params, "force")) await guardEngineSend(ctx, method, args);
|
|
4700
4757
|
if (method === "getMessages") return node(ctx).getMessages(str(args ?? {}, "linkId", true));
|
|
4701
4758
|
if (method === "getState") return state(ctx);
|
|
@@ -4718,6 +4775,8 @@ var METHODS = {
|
|
|
4718
4775
|
* kept): it stops once it has answered, and the next command starts on the emptied profile.
|
|
4719
4776
|
*/
|
|
4720
4777
|
async function clearProfile(ctx) {
|
|
4778
|
+
const call = ctx.calls.list()[0];
|
|
4779
|
+
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 });
|
|
4721
4780
|
const { links, groups } = state(ctx);
|
|
4722
4781
|
await node(ctx).clearProfileData();
|
|
4723
4782
|
const cleared = {
|
|
@@ -4792,7 +4851,7 @@ async function react(ctx, linkId, params) {
|
|
|
4792
4851
|
messageId,
|
|
4793
4852
|
emoji: emoji ?? ""
|
|
4794
4853
|
});
|
|
4795
|
-
if (result.error) throw new CliError(result.refused ? "refused" : /not in this chat|No reaction of yours/.test(result.error) ? "not_found" : "bad_request", result.error);
|
|
4854
|
+
if (result.error) throw new CliError(result.refused ? "refused" : /not in this (?:chat|group)|No reaction of yours/.test(result.error) ? "not_found" : "bad_request", result.error);
|
|
4796
4855
|
return {
|
|
4797
4856
|
messageId,
|
|
4798
4857
|
emoji: emoji || null,
|
|
@@ -4987,4 +5046,4 @@ async function callApi(ctx, method, params = {}) {
|
|
|
4987
5046
|
//#endregion
|
|
4988
5047
|
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 };
|
|
4989
5048
|
|
|
4990
|
-
//# sourceMappingURL=api-
|
|
5049
|
+
//# sourceMappingURL=api-DFCgr6RH.js.map
|