@ghostlytools/cli 1.10.1 → 1.10.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.
Files changed (97) hide show
  1. package/README.md +14 -10
  2. package/SKILL.md +3 -2
  3. package/dist/assets/{api-BOWLZYXM.js → api-BdaxsDvA.js} +2 -2
  4. package/dist/assets/{api-Bi6hCcwG.js → api-C4MLg5Rs.js} +126 -49
  5. package/dist/assets/api-C4MLg5Rs.js.map +1 -0
  6. package/dist/assets/{apiKit-DzXHZojD.js → apiKit-BbNaxZGZ.js} +87 -25
  7. package/dist/assets/apiKit-BbNaxZGZ.js.map +1 -0
  8. package/dist/assets/{apps-DIQbzG08.js → apps-BluQgEhv.js} +5 -5
  9. package/dist/assets/{apps-DIQbzG08.js.map → apps-BluQgEhv.js.map} +1 -1
  10. package/dist/assets/{apps-0Ks6KjqS.js → apps-BtGFth7o.js} +1 -1
  11. package/dist/assets/{arkade-zozCldAE.js → arkade-DdZx4b_I.js} +2 -2
  12. package/dist/assets/{arkade-zozCldAE.js.map → arkade-DdZx4b_I.js.map} +1 -1
  13. package/dist/assets/{backup-BL49Kt-T.js → backup-DyDsW7sC.js} +7 -7
  14. package/dist/assets/{backup-BL49Kt-T.js.map → backup-DyDsW7sC.js.map} +1 -1
  15. package/dist/assets/{backup-BvIFcZM7.js → backup-I1n7ccz7.js} +1 -1
  16. package/dist/assets/{buttons-CAW5v5EE.js → buttons-Do7dCku6.js} +6 -6
  17. package/dist/assets/{buttons-CAW5v5EE.js.map → buttons-Do7dCku6.js.map} +1 -1
  18. package/dist/assets/buttons-DpjwXePb.js +2 -0
  19. package/dist/assets/{client-CyApKBEw.js → client-CWsjRiH8.js} +3 -3
  20. package/dist/assets/{client-CyApKBEw.js.map → client-CWsjRiH8.js.map} +1 -1
  21. package/dist/assets/{codec-DqFxxB_q.js → codec-DPaXhuYc.js} +2 -2
  22. package/dist/assets/{codec-DqFxxB_q.js.map → codec-DPaXhuYc.js.map} +1 -1
  23. package/dist/assets/{envelope-CMUgz31I.js → envelope-5Gu9yGk_.js} +2 -2
  24. package/dist/assets/{envelope-CMUgz31I.js.map → envelope-5Gu9yGk_.js.map} +1 -1
  25. package/dist/assets/{errors-R4S2SAEM.js → errors-Dt-ZnyOX.js} +3 -1
  26. package/dist/assets/errors-Dt-ZnyOX.js.map +1 -0
  27. package/dist/assets/{fixedHosts-C2hdCfzK.js → fixedHosts-PR1BcfKX.js} +7 -8
  28. package/dist/assets/fixedHosts-PR1BcfKX.js.map +1 -0
  29. package/dist/assets/{groupFiles-BAQIt_bJ.js → groupFiles-BuToTMUk.js} +307 -69
  30. package/dist/assets/groupFiles-BuToTMUk.js.map +1 -0
  31. package/dist/assets/{host-CaRlDMTd.js → host-fkQYBvKH.js} +322 -72
  32. package/dist/assets/host-fkQYBvKH.js.map +1 -0
  33. package/dist/assets/{hyperdhtRelay-BxADl3SG.js → hyperdhtRelay-DDCak5PY.js} +28 -20
  34. package/dist/assets/hyperdhtRelay-DDCak5PY.js.map +1 -0
  35. package/dist/assets/{irohWeb-D2sh6EWp.js → irohWeb-B4_swKx0.js} +112 -34
  36. package/dist/assets/{irohWeb-D2sh6EWp.js.map → irohWeb-B4_swKx0.js.map} +1 -1
  37. package/dist/assets/{main-Bc4Ow56Z.js → main-ClYsttvY.js} +98 -51
  38. package/dist/assets/main-ClYsttvY.js.map +1 -0
  39. package/dist/assets/{mainline-DWh4Ccri.js → mainline-Hsk2SZ1B.js} +66 -6
  40. package/dist/assets/mainline-Hsk2SZ1B.js.map +1 -0
  41. package/dist/assets/{networkReason-DT_D_Wpc.js → networkReason-C9Hr-hO7.js} +4 -4
  42. package/dist/assets/{networkReason-DT_D_Wpc.js.map → networkReason-C9Hr-hO7.js.map} +1 -1
  43. package/dist/assets/{nwc-DoSEhUKb.js → nwc-BbK6qNxS.js} +3 -3
  44. package/dist/assets/{nwc-DoSEhUKb.js.map → nwc-BbK6qNxS.js.map} +1 -1
  45. package/dist/assets/{nwcProvider-CGWqUjpB.js → nwcProvider-D_tt2X3Z.js} +2 -2
  46. package/dist/assets/{nwcProvider-CGWqUjpB.js.map → nwcProvider-D_tt2X3Z.js.map} +1 -1
  47. package/dist/assets/{ownDid-CbGjRLBn.js → ownDid-DkK_jem4.js} +2 -2
  48. package/dist/assets/{ownDid-CbGjRLBn.js.map → ownDid-DkK_jem4.js.map} +1 -1
  49. package/dist/assets/{profiles-DgIfvBeN.js → profiles-aV9vaK0B.js} +17 -8
  50. package/dist/assets/profiles-aV9vaK0B.js.map +1 -0
  51. package/dist/assets/{registry-C5cn80Rw.js → registry-C9T6tYCO.js} +1 -1
  52. package/dist/assets/{registry-BSyxGjN6.js → registry-CEjnubep.js} +57 -17
  53. package/dist/assets/registry-CEjnubep.js.map +1 -0
  54. package/dist/assets/{resolve-D-9YRFhl.js → resolve-BBOrN13E.js} +27 -6
  55. package/dist/assets/resolve-BBOrN13E.js.map +1 -0
  56. package/dist/assets/{restoredRows-CRYwIx3g.js → restoredRows-YhlbokEE.js} +4 -2
  57. package/dist/assets/restoredRows-YhlbokEE.js.map +1 -0
  58. package/dist/assets/{secretGuard-CSVNxXVW.js → secretGuard-B7Hj0Kvz.js} +2 -2
  59. package/dist/assets/{secretGuard-CSVNxXVW.js.map → secretGuard-B7Hj0Kvz.js.map} +1 -1
  60. package/dist/assets/secretGuard-DUr6bgKc.js +2 -0
  61. package/dist/assets/{server-BufntkX8.js → server-BJ3T-kx3.js} +1051 -389
  62. package/dist/assets/server-BJ3T-kx3.js.map +1 -0
  63. package/dist/assets/{src-CCt5s4DK.js → src-BIdfHB7t.js} +667 -134
  64. package/dist/assets/src-BIdfHB7t.js.map +1 -0
  65. package/dist/assets/{sshForges-D8CPaIbR.js → sshForges-CRg-NGld.js} +2 -2
  66. package/dist/assets/{sshForges-D8CPaIbR.js.map → sshForges-CRg-NGld.js.map} +1 -1
  67. package/dist/assets/{translate-Cb-6hMhD.js → translate-b0X61WMI.js} +3 -3
  68. package/dist/assets/{translate-Cb-6hMhD.js.map → translate-b0X61WMI.js.map} +1 -1
  69. package/dist/assets/{usdt-ds461mzA.js → usdt-6CQdfye1.js} +7 -4
  70. package/dist/assets/usdt-6CQdfye1.js.map +1 -0
  71. package/dist/assets/waitNotice-Ce3YCinu.js +101 -0
  72. package/dist/assets/waitNotice-Ce3YCinu.js.map +1 -0
  73. package/dist/assets/{words-B1ylON2h.js → words-Dk6o6wz4.js} +4 -4
  74. package/dist/assets/words-Dk6o6wz4.js.map +1 -0
  75. package/dist/ghostly.mjs +1 -1
  76. package/package.json +1 -1
  77. package/dist/assets/api-Bi6hCcwG.js.map +0 -1
  78. package/dist/assets/apiKit-DzXHZojD.js.map +0 -1
  79. package/dist/assets/buttons-oJI5mHSL.js +0 -2
  80. package/dist/assets/errors-R4S2SAEM.js.map +0 -1
  81. package/dist/assets/fixedHosts-C2hdCfzK.js.map +0 -1
  82. package/dist/assets/groupFiles-BAQIt_bJ.js.map +0 -1
  83. package/dist/assets/host-CaRlDMTd.js.map +0 -1
  84. package/dist/assets/hyperdhtRelay-BxADl3SG.js.map +0 -1
  85. package/dist/assets/main-Bc4Ow56Z.js.map +0 -1
  86. package/dist/assets/mainline-DWh4Ccri.js.map +0 -1
  87. package/dist/assets/profiles-DgIfvBeN.js.map +0 -1
  88. package/dist/assets/registry-BSyxGjN6.js.map +0 -1
  89. package/dist/assets/resolve-D-9YRFhl.js.map +0 -1
  90. package/dist/assets/restoredRows-CRYwIx3g.js.map +0 -1
  91. package/dist/assets/secretGuard-Q2BKq0q0.js +0 -2
  92. package/dist/assets/server-BufntkX8.js.map +0 -1
  93. package/dist/assets/src-CCt5s4DK.js.map +0 -1
  94. package/dist/assets/usdt-ds461mzA.js.map +0 -1
  95. package/dist/assets/waitNotice-B8D8WhbE.js +0 -45
  96. package/dist/assets/waitNotice-B8D8WhbE.js.map +0 -1
  97. package/dist/assets/words-B1ylON2h.js.map +0 -1
@@ -1,11 +1,11 @@
1
- import { _o as cardLine, co as PR_CHECKS, do as RUN_RESULTS, er as GROUP_FILE_LIMITS, fo as STATUS_CARD_LIMITS, lo as PR_STATES, oo as CRON_LINE, po as TASK_STATUSES, so as ITEM_STATES, uo as ROUTINE_STATES, vo as cardUrl, wa as VOICE_LIMITS, xo as statusCardBytes } from "./src-CCt5s4DK.js";
2
- import { i as localFileError, n as EXIT, r as asCliError, t as CliError } from "./errors-R4S2SAEM.js";
3
- import { a as WALLET_TYPES, d as ENGINE_READS, f as READ_PARAMS, i as TRANSPORT_NAMES, l as ENGINE_METHODS, n as CHAT_METHODS, o as turnRef, p as SECRET_RESULTS, r as PAY_METHODS, t as ADDRESS_TYPES, u as ENGINE_PARAMS } from "./words-B1ylON2h.js";
4
- import { m as namedByThem, t as CONTACT_KEY } from "./apiKit-DzXHZojD.js";
1
+ import { Aa as VOICE_LIMITS, Co as cardLine, Do as statusCardBytes, _o as RUN_RESULTS, fo as CRON_LINE, go as ROUTINE_STATES, ho as PR_STATES, mo as PR_CHECKS, nr as GROUP_FILE_LIMITS, po as ITEM_STATES, vo as STATUS_CARD_LIMITS, wo as cardUrl, yo as TASK_STATUSES } from "./src-BIdfHB7t.js";
2
+ import { i as localFileError, n as EXIT, r as asCliError, t as CliError } from "./errors-Dt-ZnyOX.js";
3
+ import { a as WALLET_TYPES, d as ENGINE_READS, f as READ_PARAMS, i as TRANSPORT_NAMES, l as ENGINE_METHODS, n as CHAT_METHODS, o as turnRef, p as SECRET_RESULTS, r as PAY_METHODS, t as ADDRESS_TYPES, u as ENGINE_PARAMS } from "./words-Dk6o6wz4.js";
4
+ import { g as namedByThem, t as CONTACT_KEY } from "./apiKit-BbNaxZGZ.js";
5
5
  import { n as dropSecretEnv, t as childEnv } from "./childEnv-BVOQK9EA.js";
6
- import { _ as userPath, a as checkShownName, c as ghostlyHome, f as profileExists, h as startingDaemon, i as checkProfileName, l as listProfiles, m as selectProfile, o as createProfile, p as profilePaths, s as currentProfile, u as lockOwner, y as ownProfile } from "./profiles-DgIfvBeN.js";
7
- import { n as waitNotice, r as waitsFor } from "./waitNotice-B8D8WhbE.js";
8
- import { g as isCallRate, i as isNotTheDaemon, r as connectDaemon, t as DaemonClient, u as CALL_RATES } from "./client-CyApKBEw.js";
6
+ import { a as checkShownName, b as ownProfile, c as ghostlyHome, f as noProfile, g as startingDaemon, h as selectProfile, i as checkProfileName, l as listProfiles, m as profilePaths, o as createProfile, p as profileExists, s as currentProfile, u as lockOwner, v as userPath } from "./profiles-aV9vaK0B.js";
7
+ import { i as waitsFor, r as waitNotice } from "./waitNotice-Ce3YCinu.js";
8
+ import { g as isCallRate, i as isNotTheDaemon, r as connectDaemon, t as DaemonClient, u as CALL_RATES } from "./client-CWsjRiH8.js";
9
9
  import { spawn } from "node:child_process";
10
10
  import { accessSync, closeSync, constants, existsSync, fstatSync, openSync, readFileSync, readSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
11
11
  import { dirname, resolve } from "node:path";
@@ -13,7 +13,7 @@ import { connect } from "node:net";
13
13
  import { format } from "node:util";
14
14
  var package_default = {
15
15
  name: "@ghostlytools/cli",
16
- version: "1.10.1",
16
+ version: "1.10.3",
17
17
  type: "module",
18
18
  description: "Ghostly for bots and terminals: the app's own engine, headless on Node, behind a daemon and a `ghostly` command with JSON output.",
19
19
  license: "MIT",
@@ -117,7 +117,9 @@ var GLOBAL_OPTIONS = {
117
117
  * the ghostly-cli lesson of #208). So is a positional that `idSlot` says takes an id, a key or a draft: there a word
118
118
  * that starts with `-`, is longer than two characters and is no option of the command is the value (`--` starts one
119
119
  * id in 4096; `-x` stays an option). Any other positional that starts with `-` is refused instead of sent: a
120
- * mistyped flag must not reach a contact as text. Put `--` before a message that starts with a dash.
120
+ * mistyped flag must not reach a contact as text. Put `--` before a message that starts with a dash. Where `parsing`
121
+ * says a number comes, a word of a dash and a digit (`-5`) that is no option is that number, for the command to refuse
122
+ * in its own words (`<sats> takes a whole number from 1 up, not -5`); no option's name starts with a digit.
121
123
  *
122
124
  * An unknown option names the command `parsing` gives, the nearest of its options and its help.
123
125
  */
@@ -144,6 +146,10 @@ function parseArgs(argv, spec, idSlot = () => false, parsing) {
144
146
  positionals.push(...argv.slice(i + 1));
145
147
  break;
146
148
  }
149
+ if (/^-\d/.test(arg) && parsing?.number?.(positionals.length) && !isOption(arg)) {
150
+ positionals.push(arg);
151
+ continue;
152
+ }
147
153
  if (arg.startsWith("-") && arg.length > 2 && idSlot(positionals.length) && !isOption(arg)) {
148
154
  positionals.push(arg);
149
155
  continue;
@@ -374,10 +380,16 @@ function refs(values, flag, what) {
374
380
  if (!Array.isArray(values)) return;
375
381
  for (const value of values) if (typeof value === "string" && !value.replace(/^group:/, "").trim()) throw new CliError("usage", `--${flag} ${JSON.stringify(value)} names no ${what}`);
376
382
  }
377
- /** A whole number of sats from the command line. */
383
+ /**
384
+ * A whole number of sats from the command line (`<sats>`), refused in a number flag's words: `<sats> takes a whole
385
+ * number from 1 up, not -5`, a number as typed, other words quoted. Before: "Not an amount in sats: \"-5\"".
386
+ */
378
387
  function sats(value) {
379
388
  const n = Number(value);
380
- if (!value || !Number.isSafeInteger(n) || n <= 0) throw new CliError("usage", `Not an amount in sats: ${JSON.stringify(value)}`);
389
+ if (!value || !Number.isSafeInteger(n) || n <= 0) {
390
+ const shown = /^-?\d+(\.\d+)?$/.test(value ?? "") ? value : JSON.stringify(value);
391
+ throw new CliError("usage", `<sats> takes a whole number from 1 up, not ${shown}`);
392
+ }
381
393
  return n;
382
394
  }
383
395
  /** `name=value` options as an object. */
@@ -1083,7 +1095,7 @@ var commands$8 = {
1083
1095
  description: "Replace the three files when they are there"
1084
1096
  }
1085
1097
  },
1086
- run: async ({ options }, a) => (await import("./apps-0Ks6KjqS.js")).initApp(a.dir, {
1098
+ run: async ({ options }, a) => (await import("./apps-BtGFth7o.js")).initApp(a.dir, {
1087
1099
  name: options.name,
1088
1100
  title: options.title,
1089
1101
  force: options.force === true
@@ -1123,7 +1135,7 @@ var commands$8 = {
1123
1135
  description: "This version's sequence, higher than the bundle at --out's (default: one more than it)"
1124
1136
  }
1125
1137
  },
1126
- run: async ({ options }, a) => (await import("./apps-0Ks6KjqS.js")).publishApp(a.dir, keyFile(options.key, "app publish <dir> --key <file> [--out <file>] [--sequence n]"), here(options.out), options.sequence)
1138
+ run: async ({ options }, a) => (await import("./apps-BtGFth7o.js")).publishApp(a.dir, keyFile(options.key, "app publish <dir> --key <file> [--out <file>] [--sequence n]"), here(options.out), options.sequence)
1127
1139
  },
1128
1140
  "app revoke": {
1129
1141
  method: "app.revoke",
@@ -1156,7 +1168,7 @@ var commands$8 = {
1156
1168
  description: "Allow --up-to past the bundle's own sequence (versions published from elsewhere), and a --reason that looks like a seed, a key or ecash"
1157
1169
  }
1158
1170
  },
1159
- run: async ({ options }, a) => (await import("./apps-0Ks6KjqS.js")).revokeApp(a.dir, keyFile(options.key, "app revoke <dir> --key <file> (--digest <digest>... | --up-to <sequence>) [--reason <text>] [--bundle <file>] [--force]"), {
1171
+ run: async ({ options }, a) => (await import("./apps-BtGFth7o.js")).revokeApp(a.dir, keyFile(options.key, "app revoke <dir> --key <file> (--digest <digest>... | --up-to <sequence>) [--reason <text>] [--bundle <file>] [--force]"), {
1160
1172
  digests: options.digest,
1161
1173
  upTo: options["up-to"],
1162
1174
  reason: options.reason,
@@ -1217,7 +1229,7 @@ var commands$8 = {
1217
1229
  usage: "app verify <bundle|url>",
1218
1230
  summary: "Check a .ghostlyapp as a client would, from a file or an https URL: its manifest and digest, or refused (exit 1) with the reason, revoked when the ghostly-revoke.json beside it revokes this version",
1219
1231
  args: ["bundle"],
1220
- run: async (_, a) => (await import("./apps-0Ks6KjqS.js")).verifyApp(a.bundle)
1232
+ run: async (_, a) => (await import("./apps-BtGFth7o.js")).verifyApp(a.bundle)
1221
1233
  },
1222
1234
  "store sign": {
1223
1235
  method: "store.sign",
@@ -1234,7 +1246,7 @@ var commands$8 = {
1234
1246
  description: "The folder to write ghostly-store.json and ghostly-store.sig in (default: the index's)"
1235
1247
  }
1236
1248
  },
1237
- run: async ({ options }, a) => (await import("./apps-0Ks6KjqS.js")).signStore(a.index, keyFile(options.key, "store sign <index> --key <file> [--out <dir>]"), here(options.out))
1249
+ run: async ({ options }, a) => (await import("./apps-BtGFth7o.js")).signStore(a.index, keyFile(options.key, "store sign <index> --key <file> [--out <dir>]"), here(options.out))
1238
1250
  }
1239
1251
  };
1240
1252
  //#endregion
@@ -1648,7 +1660,7 @@ var commands$6 = {
1648
1660
  },
1649
1661
  "message delete": {
1650
1662
  method: "chat.delete",
1651
- usage: "message delete <chat|group> <message> [--everyone [--wait none|confirmed] [--timeout s]]",
1663
+ usage: "message delete <chat|group> <message> [--everyone [--wait none|confirmed|sent] [--timeout s]]",
1652
1664
  summary: "Forget a message on this device (the contact keeps theirs); --everyone deletes one of yours, in a chat or a group, from every member's device",
1653
1665
  args: ["chat", "message"],
1654
1666
  options: {
@@ -1658,8 +1670,12 @@ var commands$6 = {
1658
1670
  },
1659
1671
  wait: {
1660
1672
  type: "string",
1661
- choices: ["none", "confirmed"],
1662
- description: "With --everyone in a chat: none or confirmed, until the contact has it (default: none with a daemon, confirmed without)"
1673
+ choices: [
1674
+ "none",
1675
+ "confirmed",
1676
+ "sent"
1677
+ ],
1678
+ description: "With --everyone: in a chat none or confirmed, until the contact has it; in a group none or sent, until a member's edge took it (default: none with a daemon, confirmed or sent without)"
1663
1679
  },
1664
1680
  timeout: wait.timeout
1665
1681
  },
@@ -3184,6 +3200,15 @@ function idSlot(command) {
3184
3200
  };
3185
3201
  return (index) => at(index) && (shift === 0 || index + shift >= names.length || at(index + shift));
3186
3202
  }
3203
+ /** Positionals that take a number (`<sats>`): there `-5` is that number, refused as one, not an unknown option. */
3204
+ var NUMBER_ARGS = /* @__PURE__ */ new Set(["amount"]);
3205
+ /** Which of a command's positionals take a number, by index; a leading `name?` shifts them as it does in `idSlot`. */
3206
+ function numberSlot(command) {
3207
+ const names = (command.args ?? []).map((name) => name.replace(/\?$/, ""));
3208
+ const shift = leadingOptionals(command.args ?? []).length;
3209
+ const at = (index) => NUMBER_ARGS.has(names[index] ?? "");
3210
+ return (index) => at(index) && (shift === 0 || index + shift >= names.length || at(index + shift));
3211
+ }
3187
3212
  /** Whether a command's last positional takes the rest of the line as words, not ids: a text, a name, a path, emoji. */
3188
3213
  function takesText(command) {
3189
3214
  const last = command.args?.at(-1)?.replace(/\?$/, "");
@@ -3315,7 +3340,7 @@ async function allowlist(from, groups, call, peerOf) {
3315
3340
  keys.add(ref);
3316
3341
  continue;
3317
3342
  }
3318
- const chat = await call("chat.get", { chat: ref });
3343
+ const chat = await otherFlag(call("chat.get", { chat: ref }), ref, "--from");
3319
3344
  if (chat.id !== ref && chat.label?.toLowerCase() !== ref.toLowerCase()) throw namedByThem(ref, {
3320
3345
  chat: chat.id,
3321
3346
  name: chat.peerName ?? null,
@@ -3323,9 +3348,23 @@ async function allowlist(from, groups, call, peerOf) {
3323
3348
  });
3324
3349
  chats.add(chat.id);
3325
3350
  }
3326
- for (const ref of groups) groupIds.add((await call("group.get", { group: ref })).id);
3351
+ for (const ref of groups) groupIds.add((await otherFlag(call("group.get", { group: ref }), ref, "--group")).id);
3327
3352
  return new Allowlist(chats, keys, groupIds, peerOf);
3328
3353
  }
3354
+ /**
3355
+ * A `--from` that names a group, or a `--group` a chat: said with the flag that takes it. The lookup's own hint named
3356
+ * `ghostly group show` (or `chat show`), which lists nothing.
3357
+ */
3358
+ async function otherFlag(lookup, ref, flag) {
3359
+ try {
3360
+ return await lookup;
3361
+ } catch (error) {
3362
+ const other = flag === "--from" ? "group" : "chat";
3363
+ if (!(error instanceof CliError) || error.code !== "not_found" || typeof error.details?.[other] !== "string") throw error;
3364
+ const shown = /^[\w.:-]+$/.test(ref) ? ref : JSON.stringify(ref);
3365
+ throw new CliError("not_found", `${JSON.stringify(ref)} is a ${other}, not a ${flag === "--from" ? "chat" : "group"}: ghostly listen ${flag === "--from" ? "--group" : "--from"} ${shown}`, error.details);
3366
+ }
3367
+ }
3329
3368
  /** The turn an event starts, or null: only a contact's message, and a group message that mentions this profile. */
3330
3369
  function toTurn(event) {
3331
3370
  const message = event.message;
@@ -3903,7 +3942,7 @@ async function completeWithPipedEvidence(call, params, read, note) {
3903
3942
  * `credential`) given on the command line still goes, with the ps/history warning: `settings get` hides it as a secret.
3904
3943
  */
3905
3944
  async function settingValue(key, value, read, tty = false, note = () => {}) {
3906
- const usage = "Missing <json-value>: ghostly settings set <key> <json-value>";
3945
+ const usage = "Missing <json-value>: ghostly settings set <key> <json-value> [--force]";
3907
3946
  if (value !== void 0 && value !== "-") return {
3908
3947
  value,
3909
3948
  ...key === "iceServers" && hasCredential(value) && { warning: `A TURN password on the command line shows in ps and the shell's history: give it on stdin instead (… | ghostly settings set ${key} -)` }
@@ -3997,15 +4036,15 @@ var VERSION = package_default.version;
3997
4036
  * command a running daemon answers loads none of them, and starts about as fast as Node does. Statically imported, they
3998
4037
  * cost every command ~100 ms before its socket was opened.
3999
4038
  */
4000
- var engineApi = () => import("./api-BOWLZYXM.js");
4001
- var engineHost = () => import("./host-CaRlDMTd.js");
4039
+ var engineApi = () => import("./api-BdaxsDvA.js");
4040
+ var engineHost = () => import("./host-fkQYBvKH.js");
4002
4041
  /**
4003
4042
  * `--translate <lang>`'s translator, or null (not asked; or the runtime is not there, said on stderr). Loaded only when
4004
4043
  * asked: the app's message parser it reads costs every other command nothing.
4005
4044
  */
4006
4045
  async function translatorFor(value, home) {
4007
4046
  if (value === void 0) return null;
4008
- const { loadDetector, openTranslator, translateTarget } = await import("./translate-Cb-6hMhD.js");
4047
+ const { loadDetector, openTranslator, translateTarget } = await import("./translate-b0X61WMI.js");
4009
4048
  return openTranslator({
4010
4049
  home,
4011
4050
  to: translateTarget(value),
@@ -4042,14 +4081,11 @@ function requireProfile(g) {
4042
4081
  createProfile(g.home, g.profile);
4043
4082
  return;
4044
4083
  }
4045
- throw noProfile(g);
4046
- }
4047
- function noProfile(g) {
4048
- return new CliError("not_found", `No profile ${g.profile}: make it with \`ghostly profile create ${g.profile}\``);
4084
+ throw noProfile(g.profile);
4049
4085
  }
4050
4086
  /** For a command that only reads: a mistyped profile is named as one, and `default` is not made by asking about it. */
4051
4087
  function knownProfile(g) {
4052
- if (g.profile !== "default" && !profileExists(g.home, g.profile)) throw noProfile(g);
4088
+ if (g.profile !== "default" && !profileExists(g.home, g.profile)) throw noProfile(g.profile);
4053
4089
  }
4054
4090
  /** `1.2.3`, with an optional `v`, an optional `-beta.1` prerelease and an optional `+build` that never orders. */
4055
4091
  var RELEASE = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
@@ -4119,10 +4155,15 @@ function settlesWithin(promise, ms) {
4119
4155
  * waited for the next minute (60 s and more instead of 3 to 5).
4120
4156
  */
4121
4157
  function chatOnly(method, params) {
4122
- if (method.startsWith("task.") || method.startsWith("routine.") || method.startsWith("button.")) return false;
4123
4158
  if (method === "usage.send") return params.all === true;
4159
+ if (chatOrGroup(method, params)) return false;
4124
4160
  return method.startsWith("chat.") || params.chat !== void 0 && params.group === void 0 && !method.startsWith("group.");
4125
4161
  }
4162
+ /** A command whose `chat` may name a group as well: a one-shot for it starts the groups' sessions. */
4163
+ function chatOrGroup(method, params) {
4164
+ if (method.startsWith("task.") || method.startsWith("routine.") || method.startsWith("button.") || method === "usage.send") return true;
4165
+ return method === "chat.delete" && params.everyone === true;
4166
+ }
4126
4167
  /**
4127
4168
  * A command that makes a new chat and needs no other: a one-shot for it leaves the saved chats and the groups unstarted.
4128
4169
  * Started, each saved chat put its records and its leave packet on the relays: from about ten that was the relays' 30
@@ -4136,10 +4177,11 @@ function newChatOnly(method) {
4136
4177
  * A command about the 1:1 chat it names, or one that makes or joins a new chat (`newChatOnly`): a one-shot for it leaves
4137
4178
  * the other saved chats unstarted too, and starts only the chat a call names (`startNamedChats`). Started, each saved
4138
4179
  * chat put its records and its leave packet on the relays: with 12 invites saved one `send` took the relays' 30
4139
- * requests a minute, and a text to a contact who is away, or the next one-shot, waited behind them.
4180
+ * requests a minute, and a text to a contact who is away, or the next one-shot, waited behind them. So does a command
4181
+ * whose chat may name a group (`chatOrGroup`: a bot's `task send`): the groups start for it, the other 1:1 chats do not.
4140
4182
  */
4141
4183
  function oneChatOnly(method, params) {
4142
- return newChatOnly(method) || chatOnly(method, params) && typeof params.chat === "string";
4184
+ return newChatOnly(method) || (chatOnly(method, params) || chatOrGroup(method, params)) && typeof params.chat === "string";
4143
4185
  }
4144
4186
  /**
4145
4187
  * Calls that only read what the profile stores: a one-shot for one opens it offline (`RuntimeOptions.offline`).
@@ -4424,7 +4466,7 @@ var o = (type, description) => ({
4424
4466
  /** Commands with their own flow (main.ts), as help shows them. */
4425
4467
  var SPECIAL = [
4426
4468
  [
4427
- "profile create <name> [--use] [--name <shown name>]",
4469
+ "profile create <name> [--use] [--name <shown name>] [--force]",
4428
4470
  "Make a profile (its own keys, chats and wallets)",
4429
4471
  {
4430
4472
  use: o("boolean", "Make it the current profile"),
@@ -4436,7 +4478,7 @@ var SPECIAL = [
4436
4478
  ["profile use <name>", "Make a profile the current one"],
4437
4479
  ["profile show", "The name contacts see, and whether it is shared"],
4438
4480
  [
4439
- "profile set [--name <name>] [--share-profile | --no-share-profile]",
4481
+ "profile set [--name <name>] [--share-profile | --no-share-profile] [--force]",
4440
4482
  "Change the name contacts see",
4441
4483
  {
4442
4484
  name: o("string", "The name contacts see"),
@@ -4510,7 +4552,7 @@ var SPECIAL = [
4510
4552
  { "show-secret": o("boolean", "Show credentials too") }
4511
4553
  ],
4512
4554
  [
4513
- "settings set <key> <json-value>",
4555
+ "settings set <key> <json-value> [--force]",
4514
4556
  "Change one: relays, irohRelays, hyperdhtRelay, iceServers, publicProfiles, online, shareProfile, sendTyping, autoDownloads, serveFiles, nick. <json-value> - (or none, piped) reads it from stdin: a TURN password stays out of ps",
4515
4557
  { force: o("boolean", "Set a nick even if it looks like a seed, a key or ecash") }
4516
4558
  ],
@@ -4775,11 +4817,11 @@ async function profileCommand(sub, argv) {
4775
4817
  switch (sub) {
4776
4818
  case "create": {
4777
4819
  const [name] = parsed.positionals;
4778
- if (!name) throw new CliError("usage", "Missing <name>: ghostly profile create <name> [--use] [--name <shown name>]");
4779
- noMoreThan(1, parsed.positionals, "profile create <name> [--use] [--name <shown name>]");
4820
+ if (!name) throw new CliError("usage", "Missing <name>: ghostly profile create <name> [--use] [--name <shown name>] [--force]");
4821
+ noMoreThan(1, parsed.positionals, "profile create <name> [--use] [--name <shown name>] [--force]");
4780
4822
  const shownName = parsed.options.name === void 0 ? void 0 : checkShownName(parsed.options.name);
4781
4823
  const force = parsed.options.force === true;
4782
- if (shownName) (await import("./secretGuard-Q2BKq0q0.js")).guardText(shownName, force, "name", "set it");
4824
+ if (shownName) (await import("./secretGuard-DUr6bgKc.js")).guardText(shownName, force, "name", "set it");
4783
4825
  const paths = createProfile(g.home, name);
4784
4826
  let shown = null;
4785
4827
  if (shownName !== void 0) try {
@@ -4833,11 +4875,11 @@ async function profileCommand(sub, argv) {
4833
4875
  print(await withSession(g, (s) => s.call("profile.get"), { offline: true }));
4834
4876
  return;
4835
4877
  case "set": {
4836
- noMoreThan(0, parsed.positionals, "profile set [--name <name>] [--share-profile | --no-share-profile]");
4878
+ noMoreThan(0, parsed.positionals, "profile set [--name <name>] [--share-profile | --no-share-profile] [--force]");
4837
4879
  const params = {};
4838
4880
  if (parsed.options.name !== void 0) params.name = parsed.options.name;
4839
4881
  if (parsed.options["share-profile"] !== void 0) params.shareProfile = parsed.options["share-profile"];
4840
- if (!Object.keys(params).length) throw new CliError("usage", "Nothing to change: ghostly profile set [--name <name>] [--share-profile | --no-share-profile]");
4882
+ if (!Object.keys(params).length) throw new CliError("usage", "Nothing to change: ghostly profile set [--name <name>] [--share-profile | --no-share-profile] [--force]");
4841
4883
  if (parsed.options.force === true) params.force = true;
4842
4884
  print(await withSession(g, (s) => s.call("profile.set", params)));
4843
4885
  return;
@@ -4861,7 +4903,7 @@ async function profileCommand(sub, argv) {
4861
4903
  ...light
4862
4904
  };
4863
4905
  const made = await withSession(g, (s) => s.call("profile.backup", params), { offline: true });
4864
- if (unsealed) process.stderr.write("Not encrypted: this file holds the profile's keys, chats and wallet secrets in the clear. Anyone who gets it gets everything in it, including any money in its wallets.\n");
4906
+ if (unsealed) process.stderr.write("ghostly: Not encrypted: this file holds the profile's keys, chats and wallet secrets in the clear. Anyone who gets it gets everything in it, including any money in its wallets.\n");
4865
4907
  print(made);
4866
4908
  return;
4867
4909
  }
@@ -4870,7 +4912,7 @@ async function profileCommand(sub, argv) {
4870
4912
  if (!given || !name) throw new CliError("usage", `Missing <${given ? "new profile" : "file"}>: ghostly profile restore <file> <new profile> [--passphrase-file f] [--use]`);
4871
4913
  noMoreThan(2, parsed.positionals, "profile restore <file> <new profile> [--passphrase-file f] [--use]");
4872
4914
  const file = here(given);
4873
- const { backupFileProtection, restoreProfile } = await import("./backup-BvIFcZM7.js");
4915
+ const { backupFileProtection, restoreProfile } = await import("./backup-I1n7ccz7.js");
4874
4916
  const protection = await backupFileProtection(file);
4875
4917
  const paths = await restoreProfile(g.home, checkProfileName(name), file, protection === "none" ? void 0 : backupPassphrase(parsed.options["passphrase-file"], RESTORE_PASSPHRASE));
4876
4918
  if (parsed.options.use) selectProfile(g.home, name);
@@ -5560,8 +5602,8 @@ async function settingsCommand(sub, argv) {
5560
5602
  }
5561
5603
  if (sub === "set") {
5562
5604
  const [key, given] = parsed.positionals;
5563
- if (!key) throw new CliError("usage", "Missing <key>: ghostly settings set <key> <json-value>");
5564
- noMoreThan(2, parsed.positionals, "settings set <key> <json-value>");
5605
+ if (!key) throw new CliError("usage", "Missing <key>: ghostly settings set <key> <json-value> [--force]");
5606
+ noMoreThan(2, parsed.positionals, "settings set <key> <json-value> [--force]");
5565
5607
  const { value, warning } = await settingValue(key, given, readStdin, process.stdin.isTTY === true, (note) => process.stderr.write(`ghostly: ${note}\n`));
5566
5608
  if (warning) process.stderr.write(`ghostly: ${warning}\n`);
5567
5609
  let parsedValue;
@@ -5609,7 +5651,7 @@ async function textCommand(name, argv) {
5609
5651
  };
5610
5652
  if (spec.target === "group") params.mentions = parsed.options.mention ?? [];
5611
5653
  if (parsed.options.reply !== void 0) params.reply = parsed.options.reply;
5612
- if (!spec.message) Object.assign(params, (await import("./buttons-oJI5mHSL.js")).buttonsOf(parsed.options));
5654
+ if (!spec.message) Object.assign(params, (await import("./buttons-DpjwXePb.js")).buttonsOf(parsed.options));
5613
5655
  print(await withSession(g, (s) => {
5614
5656
  if (spec.target === "chat") {
5615
5657
  params.wait = parsed.options.wait ?? (s.mode === "one-shot" ? spec.message ? "confirmed" : "sent" : "none");
@@ -5658,7 +5700,7 @@ async function identityAddCommand(argv) {
5658
5700
  if (!provider) throw new CliError("usage", "Missing <provider>: ghostly identity add <provider> [subject] [--signer id] [--field name=value]... [--stdin] [--days n] [--timeout s]");
5659
5701
  inRange(parsed.options, "timeout", "a number of seconds", 5, 3600);
5660
5702
  const items = parsed.options.field ?? [];
5661
- const known = parsed.options.days !== void 0 || items.length ? (await import("./registry-C5cn80Rw.js")).IDENTITY_PROVIDERS.find((p) => p.id === provider) : void 0;
5703
+ const known = parsed.options.days !== void 0 || items.length ? (await import("./registry-C9T6tYCO.js")).IDENTITY_PROVIDERS.find((p) => p.id === provider) : void 0;
5662
5704
  if (known && parsed.options.days !== void 0) inRange(parsed.options, "days", "a whole number", 1, known.validity.maxDays, true);
5663
5705
  const { fields, warning } = await identityFields(items, parsed.options.stdin === true, identitySecretFields(known, parsed.options.signer), readStdin, process.stdin.isTTY === true);
5664
5706
  if (warning) process.stderr.write(`ghostly: ${warning}\n`);
@@ -5713,7 +5755,8 @@ async function tableCommand(name, argv) {
5713
5755
  const command = COMMANDS[name];
5714
5756
  const parsed = parseArgs(argv, command.options ?? {}, idSlot(command), {
5715
5757
  command: name,
5716
- text: takesText(command)
5758
+ text: takesText(command),
5759
+ number: numberSlot(command)
5717
5760
  });
5718
5761
  const g = globals(parsed);
5719
5762
  pretty = g.pretty;
@@ -5762,13 +5805,13 @@ async function tableCommand(name, argv) {
5762
5805
  }
5763
5806
  return result;
5764
5807
  }, {
5765
- deferGroups: chatOnly(command.method, params) || oneChatOnly(command.method, params),
5808
+ deferGroups: chatOnly(command.method, params) || newChatOnly(command.method),
5766
5809
  deferChats: oneChatOnly(command.method, params),
5767
5810
  offline: offlineCall(command.method, params)
5768
5811
  });
5769
5812
  if (translator) {
5770
5813
  try {
5771
- printAnswer(await (await import("./translate-Cb-6hMhD.js")).translateAnswer(result, translator));
5814
+ printAnswer(await (await import("./translate-b0X61WMI.js")).translateAnswer(result, translator));
5772
5815
  } finally {
5773
5816
  translator.close();
5774
5817
  }
@@ -5802,6 +5845,10 @@ async function callPipeCommand(argv) {
5802
5845
  socket.write(`${audio.token}\n`);
5803
5846
  process.stderr.write(`ghostly: call ${call.call}: s16le mono ${audio.rate} Hz on stdin/stdout\n`);
5804
5847
  process.stdin.pipe(socket, { end: false });
5848
+ onReaderGone(() => {
5849
+ process.stderr.write(`ghostly: call ${call.call}: nothing reads its audio any more; the call goes on\n`);
5850
+ socket.destroy();
5851
+ });
5805
5852
  socket.pipe(process.stdout);
5806
5853
  socket.on("close", () => exit(0));
5807
5854
  socket.on("error", () => exit(1));
@@ -5989,4 +6036,4 @@ async function run(argv) {
5989
6036
  //#endregion
5990
6037
  export { run };
5991
6038
 
5992
- //# sourceMappingURL=main-Bc4Ow56Z.js.map
6039
+ //# sourceMappingURL=main-ClYsttvY.js.map