@ghostlytools/cli 1.8.1 → 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.
Files changed (78) hide show
  1. package/README.md +8 -5
  2. package/SKILL.md +4 -3
  3. package/dist/assets/{api-BpQC8dAw.js → api-DFCgr6RH.js} +40 -16
  4. package/dist/assets/api-DFCgr6RH.js.map +1 -0
  5. package/dist/assets/{api-CttDF-S5.js → api-raWw9j_m.js} +2 -2
  6. package/dist/assets/{apiKit-CSMeHKgo.js → apiKit-CCavJJcl.js} +2 -2
  7. package/dist/assets/{apiKit-CSMeHKgo.js.map → apiKit-CCavJJcl.js.map} +1 -1
  8. package/dist/assets/{apps-DzFMdVt6.js → apps-B7o2BPj6.js} +1 -1
  9. package/dist/assets/{apps-DqTyZ40T.js → apps-DmxEG147.js} +2 -2
  10. package/dist/assets/{apps-DqTyZ40T.js.map → apps-DmxEG147.js.map} +1 -1
  11. package/dist/assets/{arkade-Cu3TbPxC.js → arkade-DtYR9H0c.js} +2 -2
  12. package/dist/assets/{arkade-Cu3TbPxC.js.map → arkade-DtYR9H0c.js.map} +1 -1
  13. package/dist/assets/{backup-CLZOORFC.js → backup-BserdrNk.js} +1 -1
  14. package/dist/assets/{backup-CyTZhu28.js → backup-YIB2XIES.js} +4 -4
  15. package/dist/assets/{backup-CyTZhu28.js.map → backup-YIB2XIES.js.map} +1 -1
  16. package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js.map +1 -1
  17. package/dist/assets/buttons-CuRfKnPI.js +1331 -0
  18. package/dist/assets/buttons-CuRfKnPI.js.map +1 -0
  19. package/dist/assets/buttons-De3LPdSG.js +2 -0
  20. package/dist/assets/{envelope-CGfUsR1m.js → envelope-Dt75vrmY.js} +2 -2
  21. package/dist/assets/{envelope-CGfUsR1m.js.map → envelope-Dt75vrmY.js.map} +1 -1
  22. package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js.map +1 -1
  23. package/dist/assets/{fixedHosts-BiukTsd9.js → fixedHosts-B598JzbC.js} +4 -4
  24. package/dist/assets/{fixedHosts-BiukTsd9.js.map → fixedHosts-B598JzbC.js.map} +1 -1
  25. package/dist/assets/{groupFiles-CeF9nPv9.js → groupFiles-FXel6zIc.js} +10 -599
  26. package/dist/assets/groupFiles-FXel6zIc.js.map +1 -0
  27. package/dist/assets/{host-CKAehWP6.js → host-DIBeK_c_.js} +73 -18
  28. package/dist/assets/host-DIBeK_c_.js.map +1 -0
  29. package/dist/assets/{hyperdhtRelay-B8Pdykhg.js → hyperdhtRelay-D185dETu.js} +2 -2
  30. package/dist/assets/{hyperdhtRelay-B8Pdykhg.js.map → hyperdhtRelay-D185dETu.js.map} +1 -1
  31. package/dist/assets/{irohWeb-D6tAPHZa.js → irohWeb-BSv_BWyG.js} +16 -3
  32. package/dist/assets/{irohWeb-D6tAPHZa.js.map → irohWeb-BSv_BWyG.js.map} +1 -1
  33. package/dist/assets/{main-BDY-pfpz.js → main-BbhfMTt8.js} +50 -22
  34. package/dist/assets/main-BbhfMTt8.js.map +1 -0
  35. package/dist/assets/{mainline-3ueXpFQL.js → mainline-9Vc3c3SA.js} +2 -2
  36. package/dist/assets/{mainline-3ueXpFQL.js.map → mainline-9Vc3c3SA.js.map} +1 -1
  37. package/dist/assets/{networkReason-DhJYOomu.js → networkReason-BncJ9KSM.js} +2 -2
  38. package/dist/assets/{networkReason-DhJYOomu.js.map → networkReason-BncJ9KSM.js.map} +1 -1
  39. package/dist/assets/{nwc-B1Quqda-.js → nwc-QX3Yt1Sb.js} +3 -3
  40. package/dist/assets/{nwc-B1Quqda-.js.map → nwc-QX3Yt1Sb.js.map} +1 -1
  41. package/dist/assets/{nwcProvider-DUB6xO-b.js → nwcProvider-CzX3xH47.js} +2 -2
  42. package/dist/assets/{nwcProvider-DUB6xO-b.js.map → nwcProvider-CzX3xH47.js.map} +1 -1
  43. package/dist/assets/{ownDid-BfqHJdA6.js → ownDid-D8z5gwGI.js} +2 -2
  44. package/dist/assets/{ownDid-BfqHJdA6.js.map → ownDid-D8z5gwGI.js.map} +1 -1
  45. package/dist/assets/{registry-DwlTNQjr.js → registry-B2Dtnibo.js} +5 -5
  46. package/dist/assets/{registry-DwlTNQjr.js.map → registry-B2Dtnibo.js.map} +1 -1
  47. package/dist/assets/{registry-CZTmtSws.js → registry-PTtBMaYZ.js} +1 -1
  48. package/dist/assets/{resolve-BVwhiYjj.js → resolve-ZxVzwFNA.js} +2 -2
  49. package/dist/assets/{resolve-BVwhiYjj.js.map → resolve-ZxVzwFNA.js.map} +1 -1
  50. package/dist/assets/{server-Br3XPwFG.js → server-Dw1o8z1o.js} +796 -269
  51. package/dist/assets/server-Dw1o8z1o.js.map +1 -0
  52. package/dist/assets/{src-C4sOH4zH.js → src-BD8RBVEp.js} +1038 -30
  53. package/dist/assets/src-BD8RBVEp.js.map +1 -0
  54. package/dist/assets/{sshForges-CQQomStK.js → sshForges-DWrESWkK.js} +2 -2
  55. package/dist/assets/{sshForges-CQQomStK.js.map → sshForges-DWrESWkK.js.map} +1 -1
  56. package/dist/assets/{translate-C2aNyUkR.js → translate-D1uP0q32.js} +9 -3
  57. package/dist/assets/translate-D1uP0q32.js.map +1 -0
  58. package/dist/assets/{usdt-CMwatDnQ.js → usdt-DhVN8geQ.js} +3 -3
  59. package/dist/assets/{usdt-CMwatDnQ.js.map → usdt-DhVN8geQ.js.map} +1 -1
  60. package/dist/assets/{waitNotice-Ck3el3_Z.js → waitNotice-B8D8WhbE.js} +2 -2
  61. package/dist/assets/waitNotice-B8D8WhbE.js.map +1 -0
  62. package/dist/assets/{words-CqN2KG1r.js → words-DdXPkB3n.js} +3 -2
  63. package/dist/assets/words-DdXPkB3n.js.map +1 -0
  64. package/dist/ghostly.mjs +1 -1
  65. package/examples/call-echo.mjs +7 -5
  66. package/package.json +1 -1
  67. package/dist/assets/api-BpQC8dAw.js.map +0 -1
  68. package/dist/assets/buttons-Bd9fR31r.js +0 -698
  69. package/dist/assets/buttons-Bd9fR31r.js.map +0 -1
  70. package/dist/assets/buttons-c4CJnL6i.js +0 -2
  71. package/dist/assets/groupFiles-CeF9nPv9.js.map +0 -1
  72. package/dist/assets/host-CKAehWP6.js.map +0 -1
  73. package/dist/assets/main-BDY-pfpz.js.map +0 -1
  74. package/dist/assets/server-Br3XPwFG.js.map +0 -1
  75. package/dist/assets/src-C4sOH4zH.js.map +0 -1
  76. package/dist/assets/translate-C2aNyUkR.js.map +0 -1
  77. package/dist/assets/waitNotice-Ck3el3_Z.js.map +0 -1
  78. package/dist/assets/words-CqN2KG1r.js.map +0 -1
package/README.md CHANGED
@@ -129,12 +129,12 @@ 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. `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. 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 |
@@ -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`:
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; see `examples/call-echo.mjs`. To answer calls by
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 { El as ownInviteRefusal, Eu as sanitizeAvatar, Fr as TYPING_KINDS, Gn as GROUP_FILE_LIMITS, Ir as TYPING_REFRESH_MS, Ka as replySnippet, Ki as identityStatement, Mo as AWAITING_PEER_MS, Mu as toBase64Url, Qc as appRef, Rr as sanitizeTypingStatus, Tu as MAX_AVATAR_LENGTH, Uo as LIMITS, Vo as parseLocalTarget, Wc as isAppUrl, X as groupName, ba as voiceLevel, co as checkStatusCard, da as sanitizeMime, fa as PLAYABLE_AUDIO, ga as downsamplePeaks, ha as baseMime, ii as APP_DATA_MAX_BYTES, io as appCardUrl, ju as randomBytes$1, ma as VOICE_METER, nl as isAppRef, oo as cardLine, pa as VOICE_LIMITS, po as claimedTime, ro as appCardId, to as STATUS_CARD_LIMITS, ua as sanitizeFileName, ul as readImageMeta, uo as statusCardBytes, va as parseVoiceMeta, wl as inviteLink, ya as voiceDownloadName, zc as APP_PERMISSIONS, zo as GhostlyHttpError } from "./src-C4sOH4zH.js";
2
- import { O as waitingGroupFile, T as removeStored, X as iceServerProblem, Z as iceServerSetting, ct as NO_PICTURE_METADATA, dt as stripPictureMetadata, ft as withoutPictureMetadata, i as groupOfFile, k as IDENTITY_DRAFT_TTL_MS, l as replyRef, n as groupFileId, v as paymentNetwork } from "./groupFiles-CeF9nPv9.js";
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";
3
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-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-DwlTNQjr.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-Bd9fR31r.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-CqN2KG1r.js";
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, 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-CSMeHKgo.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, 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-CyTZhu28.js";
12
- import { o as checkedBundle } from "./apps-DqTyZ40T.js";
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,17 +836,17 @@ 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 without its metadata
840
- * (where it was taken, the device, the time), before its size is read and its digest computed. A picture whose metadata
841
- * cannot be removed is refused, never sent as it was. A voice note goes as it is.
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
842
  */
843
843
  async function sendable(path, mime, voice) {
844
844
  const source = await openAsBlob(path, { type: mime });
845
845
  if (voice) return source;
846
846
  try {
847
- return await withoutPictureMetadata(source, mime) ?? source;
847
+ return await withoutPictureMetadata(source, mime) ?? await withoutVideoMetadata(source, mime) ?? source;
848
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") throw new CliError("refused", NO_PICTURE_METADATA);
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
850
  throw error;
851
851
  }
852
852
  }
@@ -1005,6 +1005,11 @@ var FILE_METHODS = {
1005
1005
  }
1006
1006
  if (!info.isFile()) throw new CliError("bad_request", `${path} is not a file`);
1007
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
+ });
1008
1013
  if ("group" in target) return sendToGroup(ctx, params, target.group, path, info.size);
1009
1014
  const { link } = target;
1010
1015
  if (link.profile && link.dataLink === "open" && !link.capabilities?.files) throw new CliError("unavailable", "The contact's app takes no files");
@@ -1064,6 +1069,11 @@ var FILE_METHODS = {
1064
1069
  await removeStored(file.id).catch(() => {});
1065
1070
  throw new CliError("refused", error instanceof Error ? error.message : String(error));
1066
1071
  }
1072
+ if (wait === "sent") await FILE_METHODS["file.wait"](ctx, {
1073
+ chat: link.id,
1074
+ file: file.id,
1075
+ timeout: seconds
1076
+ });
1067
1077
  return {
1068
1078
  chat: link.id,
1069
1079
  messageId: `me_${timestamp}`,
@@ -1146,7 +1156,9 @@ var FILE_METHODS = {
1146
1156
  const transfer = state(ctx).transfers[fileId] ?? (await fileStore.get(fileId).catch(() => void 0))?.transfer;
1147
1157
  if (action === "pause" && transfer?.stage === "verifying") throw new CliError("refused", "Too late to pause: it is being checked");
1148
1158
  if (transfer?.state === "failed") throw new CliError("refused", `It ended: ${transfer.error ?? "failed"}${outgoing && transfer.retry ? " (file resend sends it again)" : ""}`);
1149
- if (outgoing && action === "cancel" && transfer?.state === "transferring" && (transfer.stage === "verifying" || transfer.size > 0 && transfer.transferred >= transfer.size && transfer.stage !== "asking" && transfer.stage !== "queued" && transfer.stage !== "paused")) throw new CliError("refused", "Too late to cancel: it arrived whole, and the contact keeps it");
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");
1150
1162
  }
1151
1163
  await node(ctx).fileAction({
1152
1164
  linkId,
@@ -1317,10 +1329,20 @@ function fieldsOf(params) {
1317
1329
  }
1318
1330
  /**
1319
1331
  * An update merged over a card: fields given replace those there, `pr` field by field, and a field given as null goes
1320
- * (`--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.
1321
1335
  */
1322
1336
  function mergeCard(base, patch) {
1323
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
+ }
1324
1346
  for (const [key, value] of Object.entries(patch)) {
1325
1347
  if (key === "kind" || key === "id") continue;
1326
1348
  if (value === null) {
@@ -4753,6 +4775,8 @@ var METHODS = {
4753
4775
  * kept): it stops once it has answered, and the next command starts on the emptied profile.
4754
4776
  */
4755
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 });
4756
4780
  const { links, groups } = state(ctx);
4757
4781
  await node(ctx).clearProfileData();
4758
4782
  const cleared = {
@@ -5022,4 +5046,4 @@ async function callApi(ctx, method, params = {}) {
5022
5046
  //#endregion
5023
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 };
5024
5048
 
5025
- //# sourceMappingURL=api-BpQC8dAw.js.map
5049
+ //# sourceMappingURL=api-DFCgr6RH.js.map