@ghostlytools/cli 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/dist/assets/{api-CJM3R93b.js → api-CcuCtc1H.js} +2 -2
- package/dist/assets/{api-CD9JbPuA.js → api-tSZELCPQ.js} +44 -22
- package/dist/assets/api-tSZELCPQ.js.map +1 -0
- package/dist/assets/{apiKit-BmnROpCN.js → apiKit-BFk7GAk9.js} +3 -3
- package/dist/assets/{apiKit-BmnROpCN.js.map → apiKit-BFk7GAk9.js.map} +1 -1
- package/dist/assets/{apps-DVA60Tg6.js → apps-C5Mi6x9Q.js} +5 -5
- package/dist/assets/{apps-DVA60Tg6.js.map → apps-C5Mi6x9Q.js.map} +1 -1
- package/dist/assets/{apps-CJ2dvKSz.js → apps-D6THreq_.js} +1 -1
- package/dist/assets/{arkade-CHqwEHFd.js → arkade-Cz0B9bJ0.js} +2 -2
- package/dist/assets/{arkade-CHqwEHFd.js.map → arkade-Cz0B9bJ0.js.map} +1 -1
- package/dist/assets/{backup-C4CbTEcj.js → backup-A0hIa9GE.js} +1 -1
- package/dist/assets/{backup-B4dSNvzb.js → backup-Wb2sm2dd.js} +6 -6
- package/dist/assets/{backup-B4dSNvzb.js.map → backup-Wb2sm2dd.js.map} +1 -1
- package/dist/assets/buttons-Bxxu3lSk.js +2 -0
- package/dist/assets/{buttons-C13rK2mH.js → buttons-Cf70NVYq.js} +12 -7
- package/dist/assets/buttons-Cf70NVYq.js.map +1 -0
- package/dist/assets/{daemonProof-B41oSfon.js → daemonProof-Bp9lJDxf.js} +2 -2
- package/dist/assets/{daemonProof-B41oSfon.js.map → daemonProof-Bp9lJDxf.js.map} +1 -1
- package/dist/assets/{envelope-4TXDx3vD.js → envelope-kQ5kYjVE.js} +2 -2
- package/dist/assets/{envelope-4TXDx3vD.js.map → envelope-kQ5kYjVE.js.map} +1 -1
- package/dist/assets/{errors-CzXgR8Cc.js → errors-mnjSQlbX.js} +2 -1
- package/dist/assets/errors-mnjSQlbX.js.map +1 -0
- package/dist/assets/{groupFiles-ajZgZ6P8.js → groupFiles-D9Ttlm3M.js} +3 -3
- package/dist/assets/groupFiles-D9Ttlm3M.js.map +1 -0
- package/dist/assets/{host-CVeNtA2_.js → host-DpypH-fR.js} +11 -11
- package/dist/assets/{host-CVeNtA2_.js.map → host-DpypH-fR.js.map} +1 -1
- package/dist/assets/{hyperdhtRelay-CI2ISE-g.js → hyperdhtRelay-D1rj84v2.js} +2 -2
- package/dist/assets/{hyperdhtRelay-CI2ISE-g.js.map → hyperdhtRelay-D1rj84v2.js.map} +1 -1
- package/dist/assets/{irohWeb-DcRJdhce.js → irohWeb-BTSlWgEX.js} +2 -2
- package/dist/assets/{irohWeb-DcRJdhce.js.map → irohWeb-BTSlWgEX.js.map} +1 -1
- package/dist/assets/{main-CjO0KGiF.js → main-BwgoQZVu.js} +70 -45
- package/dist/assets/main-BwgoQZVu.js.map +1 -0
- package/dist/assets/{mainline-WM-WItCV.js → mainline-B1urhbEZ.js} +2 -2
- package/dist/assets/{mainline-WM-WItCV.js.map → mainline-B1urhbEZ.js.map} +1 -1
- package/dist/assets/{networkReason-380j5yMs.js → networkReason-D2Z0BdIj.js} +2 -2
- package/dist/assets/{networkReason-380j5yMs.js.map → networkReason-D2Z0BdIj.js.map} +1 -1
- package/dist/assets/{nwc-D5dkC1xg.js → nwc-T2aUK6bi.js} +3 -3
- package/dist/assets/{nwc-D5dkC1xg.js.map → nwc-T2aUK6bi.js.map} +1 -1
- package/dist/assets/{nwcProvider-p_rMwtDv.js → nwcProvider-Dz-ty_DE.js} +2 -2
- package/dist/assets/{nwcProvider-p_rMwtDv.js.map → nwcProvider-Dz-ty_DE.js.map} +1 -1
- package/dist/assets/{profiles-BFd0tpCZ.js → profiles-C6XWqre5.js} +2 -2
- package/dist/assets/{profiles-BFd0tpCZ.js.map → profiles-C6XWqre5.js.map} +1 -1
- package/dist/assets/{registry-BfNcA6kF.js → registry-Bazitl0a.js} +3 -3
- package/dist/assets/{registry-BfNcA6kF.js.map → registry-Bazitl0a.js.map} +1 -1
- package/dist/assets/{registry-BKffx4ZU.js → registry-BlSTJlbv.js} +1 -1
- package/dist/assets/{resolve-hUsgRkmm.js → resolve-Bx1Eeg-w.js} +2 -2
- package/dist/assets/{resolve-hUsgRkmm.js.map → resolve-Bx1Eeg-w.js.map} +1 -1
- package/dist/assets/{server-C3tJZFnv.js → server-CnPj9wWh.js} +252 -93
- package/dist/assets/server-CnPj9wWh.js.map +1 -0
- package/dist/assets/{src-BMHgbkli.js → src-BsznF3XG.js} +88 -23
- package/dist/assets/src-BsznF3XG.js.map +1 -0
- package/dist/assets/{translate-DJUutSis.js → translate-cDBotA-b.js} +11 -11
- package/dist/assets/{translate-DJUutSis.js.map → translate-cDBotA-b.js.map} +1 -1
- package/dist/assets/{usdt-glkUxsDe.js → usdt-DxxLdG60.js} +3 -3
- package/dist/assets/{usdt-glkUxsDe.js.map → usdt-DxxLdG60.js.map} +1 -1
- package/dist/assets/{words-DyW9b27T.js → words-qH8gGtmc.js} +2 -2
- package/dist/assets/{words-DyW9b27T.js.map → words-qH8gGtmc.js.map} +1 -1
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/api-CD9JbPuA.js.map +0 -1
- package/dist/assets/buttons-BMVGYXpR.js +0 -2
- package/dist/assets/buttons-C13rK2mH.js.map +0 -1
- package/dist/assets/errors-CzXgR8Cc.js.map +0 -1
- package/dist/assets/groupFiles-ajZgZ6P8.js.map +0 -1
- package/dist/assets/main-CjO0KGiF.js.map +0 -1
- package/dist/assets/server-C3tJZFnv.js.map +0 -1
- package/dist/assets/src-BMHgbkli.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Ga as
|
|
2
|
-
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-
|
|
3
|
-
import { i as localFileError, n as EXIT, r as asCliError, t as CliError } from "./errors-
|
|
4
|
-
import { p as namedByThem, t as CONTACT_KEY } from "./apiKit-
|
|
5
|
-
import { _ as ownSocket, a as checkShownName, c as ghostlyHome, f as profileExists, h as userPath, i as checkProfileName, l as listProfiles, m as selectProfile, o as createProfile, p as profilePaths, s as currentProfile, u as lockOwner } from "./profiles-
|
|
6
|
-
import { _ as isCallRate, a as newNonce, c as provesGreeting, d as CALL_RATES, l as readDaemonSecret, n as daemonOfThisRelease, s as provesDaemon, t as HELLO } from "./daemonProof-
|
|
1
|
+
import { Ga as CRON_LINE, Ja as PR_STATES, Ka as ITEM_STATES, Qa as TASK_STATUSES, Wn as GROUP_FILE_LIMITS, Xa as RUN_RESULTS, Ya as ROUTINE_STATES, Za as STATUS_CARD_LIMITS, ao as statusCardBytes, da as VOICE_LIMITS, no as cardUrl, qa as PR_CHECKS, to as cardLine } from "./src-BsznF3XG.js";
|
|
2
|
+
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-qH8gGtmc.js";
|
|
3
|
+
import { i as localFileError, n as EXIT, r as asCliError, t as CliError } from "./errors-mnjSQlbX.js";
|
|
4
|
+
import { p as namedByThem, t as CONTACT_KEY } from "./apiKit-BFk7GAk9.js";
|
|
5
|
+
import { _ as ownSocket, a as checkShownName, c as ghostlyHome, f as profileExists, h as userPath, i as checkProfileName, l as listProfiles, m as selectProfile, o as createProfile, p as profilePaths, s as currentProfile, u as lockOwner } from "./profiles-C6XWqre5.js";
|
|
6
|
+
import { _ as isCallRate, a as newNonce, c as provesGreeting, d as CALL_RATES, l as readDaemonSecret, n as daemonOfThisRelease, s as provesDaemon, t as HELLO } from "./daemonProof-Bp9lJDxf.js";
|
|
7
7
|
import { accessSync, closeSync, constants, existsSync, fstatSync, openSync, readFileSync, readSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { dirname, resolve } from "node:path";
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
@@ -12,7 +12,7 @@ import { createInterface } from "node:readline";
|
|
|
12
12
|
import { format } from "node:util";
|
|
13
13
|
var package_default = {
|
|
14
14
|
name: "@ghostlytools/cli",
|
|
15
|
-
version: "1.7.
|
|
15
|
+
version: "1.7.2",
|
|
16
16
|
type: "module",
|
|
17
17
|
description: "Ghostly for bots and terminals: the app's own engine, headless on Node, behind a daemon and a `ghostly` command with JSON output.",
|
|
18
18
|
license: "MIT",
|
|
@@ -492,7 +492,7 @@ var groupWait = {
|
|
|
492
492
|
/** `listen`, `events` and `chat history`: received messages with `translation: { from, text }` (translate.ts). */
|
|
493
493
|
var translate = {
|
|
494
494
|
type: "string",
|
|
495
|
-
description: "
|
|
495
|
+
description: "Not in this build yet (no language detector): messages print untranslated. Meant to add a translation into this language (en, pt...) to received messages, made on this machine"
|
|
496
496
|
};
|
|
497
497
|
var net = {
|
|
498
498
|
type: "string",
|
|
@@ -587,6 +587,19 @@ var showInvite = { "show-secret": {
|
|
|
587
587
|
} };
|
|
588
588
|
var secret = (options) => options["show-secret"] === true ? { showSecret: true } : {};
|
|
589
589
|
/**
|
|
590
|
+
* `--kind` of the typing commands: another word is a usage error (exit 2) before the profile opens, not the API's
|
|
591
|
+
* "kind must be one of" (exit 1). The words are core's TYPING_KINDS, written out: the package is not loaded here.
|
|
592
|
+
*/
|
|
593
|
+
var typingKind = {
|
|
594
|
+
type: "string",
|
|
595
|
+
choices: [
|
|
596
|
+
"typing",
|
|
597
|
+
"recording",
|
|
598
|
+
"thinking"
|
|
599
|
+
],
|
|
600
|
+
description: "typing (default), recording (a voice note) or thinking"
|
|
601
|
+
};
|
|
602
|
+
/**
|
|
590
603
|
* `--for` of the typing commands: the seconds it is kept on, 1 to 600, and never with `--stop`. A usage error (exit 2)
|
|
591
604
|
* that names the flag: before, the API's own check answered ("for must be a number from 1 to 600", exit 1).
|
|
592
605
|
*/
|
|
@@ -1137,7 +1150,7 @@ var commands$8 = {
|
|
|
1137
1150
|
description: "Replace the three files when they are there"
|
|
1138
1151
|
}
|
|
1139
1152
|
},
|
|
1140
|
-
run: async ({ options }, a) => (await import("./apps-
|
|
1153
|
+
run: async ({ options }, a) => (await import("./apps-D6THreq_.js")).initApp(a.dir, {
|
|
1141
1154
|
name: options.name,
|
|
1142
1155
|
title: options.title,
|
|
1143
1156
|
force: options.force === true
|
|
@@ -1160,7 +1173,7 @@ var commands$8 = {
|
|
|
1160
1173
|
},
|
|
1161
1174
|
"app publish": {
|
|
1162
1175
|
method: "app.publish",
|
|
1163
|
-
usage: "app publish <dir> --key <file> [--out <file>]",
|
|
1176
|
+
usage: "app publish <dir> --key <file> [--out <file>] [--sequence n]",
|
|
1164
1177
|
summary: "Bundle and sign an app (WISP 1200): <dir>/ghostly-app.json and every other file in <dir> become one .ghostlyapp, its sequence one more than the bundle at --out (default <dir>/app.ghostlyapp)",
|
|
1165
1178
|
args: ["dir"],
|
|
1166
1179
|
options: {
|
|
@@ -1177,7 +1190,7 @@ var commands$8 = {
|
|
|
1177
1190
|
description: "This version's sequence, higher than the bundle at --out's (default: one more than it)"
|
|
1178
1191
|
}
|
|
1179
1192
|
},
|
|
1180
|
-
run: async ({ options }, a) => (await import("./apps-
|
|
1193
|
+
run: async ({ options }, a) => (await import("./apps-D6THreq_.js")).publishApp(a.dir, keyFile(options.key, "app publish <dir> --key <file> [--out <file>] [--sequence n]"), here(options.out), options.sequence)
|
|
1181
1194
|
},
|
|
1182
1195
|
"app revoke": {
|
|
1183
1196
|
method: "app.revoke",
|
|
@@ -1210,7 +1223,7 @@ var commands$8 = {
|
|
|
1210
1223
|
description: "Allow --up-to past the bundle's own sequence (versions published from elsewhere)"
|
|
1211
1224
|
}
|
|
1212
1225
|
},
|
|
1213
|
-
run: async ({ options }, a) => (await import("./apps-
|
|
1226
|
+
run: async ({ options }, a) => (await import("./apps-D6THreq_.js")).revokeApp(a.dir, keyFile(options.key, "app revoke <dir> --key <file> (--digest <digest>... | --up-to <sequence>) [--reason <text>]"), {
|
|
1214
1227
|
digests: options.digest,
|
|
1215
1228
|
upTo: options["up-to"],
|
|
1216
1229
|
reason: options.reason,
|
|
@@ -1271,7 +1284,7 @@ var commands$8 = {
|
|
|
1271
1284
|
usage: "app verify <bundle|url>",
|
|
1272
1285
|
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",
|
|
1273
1286
|
args: ["bundle"],
|
|
1274
|
-
run: async (_, a) => (await import("./apps-
|
|
1287
|
+
run: async (_, a) => (await import("./apps-D6THreq_.js")).verifyApp(a.bundle)
|
|
1275
1288
|
},
|
|
1276
1289
|
"store sign": {
|
|
1277
1290
|
method: "store.sign",
|
|
@@ -1288,7 +1301,7 @@ var commands$8 = {
|
|
|
1288
1301
|
description: "The folder to write ghostly-store.json and ghostly-store.sig in (default: the index's)"
|
|
1289
1302
|
}
|
|
1290
1303
|
},
|
|
1291
|
-
run: async ({ options }, a) => (await import("./apps-
|
|
1304
|
+
run: async ({ options }, a) => (await import("./apps-D6THreq_.js")).signStore(a.index, keyFile(options.key, "store sign <index> --key <file> [--out <dir>]"), here(options.out))
|
|
1292
1305
|
}
|
|
1293
1306
|
};
|
|
1294
1307
|
//#endregion
|
|
@@ -1726,7 +1739,7 @@ var commands$6 = {
|
|
|
1726
1739
|
},
|
|
1727
1740
|
"routine send": {
|
|
1728
1741
|
method: "routine.send",
|
|
1729
|
-
usage: "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] [--json json|-|file] [--force] [--wait none|sent|delivered] [--timeout s]",
|
|
1742
|
+
usage: "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] [--wait none|sent|delivered] [--timeout s]",
|
|
1730
1743
|
summary: "Send a routine card (something a bot runs on a schedule: its last run and the next) to a chat or group",
|
|
1731
1744
|
args: ["chat"],
|
|
1732
1745
|
options: {
|
|
@@ -1750,7 +1763,7 @@ var commands$6 = {
|
|
|
1750
1763
|
},
|
|
1751
1764
|
"routine update": {
|
|
1752
1765
|
method: "routine.update",
|
|
1753
|
-
usage: "routine update <chat|group> <routine> [--run ok|failed|skipped[:summary]] [--next <time>] [--state active|paused] [--schedule ...] [--json json|-|file] [--force] [--wait none|confirmed|sent] [--timeout s]",
|
|
1766
|
+
usage: "routine update <chat|group> <routine> [--run ok|failed|skipped[:summary]] [--next <time>] [--state active|paused] [--name <name>] [--schedule ...] [--cron ...] [--link url]... [--text <text>] [--json json|-|file] [--force] [--wait none|confirmed|sent] [--timeout s]",
|
|
1754
1767
|
summary: "Update a routine card you sent: record a run, the next one, a pause (at most one update per 2.5 s; sooner ones merge)",
|
|
1755
1768
|
args: ["chat", "routine"],
|
|
1756
1769
|
options: {
|
|
@@ -1804,7 +1817,7 @@ var commands$6 = {
|
|
|
1804
1817
|
},
|
|
1805
1818
|
"task send": {
|
|
1806
1819
|
method: "task.send",
|
|
1807
|
-
usage: "task send <chat|group> --title <title> [--status s] [--progress n | --steps a/b] [--step \"...\"] [--item state:text]... [--pr-url url --pr-number n --additions n --deletions n --files n --pr-state s --pr-checks c] [--branch b] [--tag label]... [--parent task] [--link url]... [--id id] [--json json|-|file] [--force] [--wait none|sent|delivered] [--timeout s]",
|
|
1820
|
+
usage: "task send <chat|group> --title <title> [--status s] [--progress n | --steps a/b] [--step \"...\"] [--item state:text]... [--pr-url url --pr-number n --additions n --deletions n --files n --pr-state s --pr-checks c] [--branch b] [--tag label]... [--parent task] [--link url]... [--id id] [--text <text>] [--json json|-|file] [--force] [--wait none|sent|delivered] [--timeout s]",
|
|
1808
1821
|
summary: "Send a task card (a bot's work: status, progress, its PR) to a chat or group; prints its id and message",
|
|
1809
1822
|
args: ["chat"],
|
|
1810
1823
|
options: {
|
|
@@ -1827,7 +1840,7 @@ var commands$6 = {
|
|
|
1827
1840
|
},
|
|
1828
1841
|
"task update": {
|
|
1829
1842
|
method: "task.update",
|
|
1830
|
-
usage: "task update <chat|group> <task> [--status s] [--progress n | --steps a/b] [--step \"...\"] [--item state:text]... [--pr-url
|
|
1843
|
+
usage: "task update <chat|group> <task> [--title <title>] [--status s] [--progress n | --steps a/b] [--step \"...\"] [--item state:text]... [--pr-url url] [--pr-number n] [--additions n] [--deletions n] [--files n] [--pr-state s] [--pr-checks c] [--branch b] [--tag label]... [--parent task] [--link url]... [--text <text>] [--json json|-|file] [--force] [--wait none|confirmed|sent] [--timeout s]",
|
|
1831
1844
|
summary: "Update a task card you sent: the fields given, merged over it (at most one update per 2.5 s; sooner ones merge)",
|
|
1832
1845
|
args: ["chat", "task"],
|
|
1833
1846
|
options: {
|
|
@@ -1863,10 +1876,7 @@ var commands$6 = {
|
|
|
1863
1876
|
type: "boolean",
|
|
1864
1877
|
description: "Say you stopped"
|
|
1865
1878
|
},
|
|
1866
|
-
kind:
|
|
1867
|
-
type: "string",
|
|
1868
|
-
description: "typing (default), recording (a voice note) or thinking"
|
|
1869
|
-
},
|
|
1879
|
+
kind: typingKind,
|
|
1870
1880
|
status: {
|
|
1871
1881
|
type: "string",
|
|
1872
1882
|
description: "A short line shown instead, e.g. \"Transcribing your audio…\" (40 characters, no links)"
|
|
@@ -1886,7 +1896,7 @@ var commands$6 = {
|
|
|
1886
1896
|
},
|
|
1887
1897
|
"usage send": {
|
|
1888
1898
|
method: "usage.send",
|
|
1889
|
-
usage: "usage send [<chat|group>] [--all] --left <percent> [--window \"5 h\"] [--resets <time>] [--label Claude] [--account <name>] [--also week=80@<time>]... [--used n --limit n] [--id id] [--json json|-|file] [--force] [--wait none|sent] [--timeout s]",
|
|
1899
|
+
usage: "usage send [<chat|group>] [--all] --left <percent> [--window \"5 h\"] [--resets <time>] [--label Claude] [--account <name>] [--also week=80@<time>]... [--used n --limit n] [--id id] [--text <text>] [--json json|-|file] [--force] [--wait none|sent] [--timeout s]",
|
|
1890
1900
|
summary: "Say how much of your quota is left (a bot's usage card, one per chat, updated in place); --all for every 1:1 chat",
|
|
1891
1901
|
args: ["chat?"],
|
|
1892
1902
|
options: {
|
|
@@ -2427,10 +2437,7 @@ var commands$3 = {
|
|
|
2427
2437
|
type: "boolean",
|
|
2428
2438
|
description: "Say you stopped"
|
|
2429
2439
|
},
|
|
2430
|
-
kind:
|
|
2431
|
-
type: "string",
|
|
2432
|
-
description: "typing (default), recording (a voice note) or thinking"
|
|
2433
|
-
},
|
|
2440
|
+
kind: typingKind,
|
|
2434
2441
|
status: {
|
|
2435
2442
|
type: "string",
|
|
2436
2443
|
description: "A short line shown instead, e.g. \"Reading the thread…\" (40 characters, no links)"
|
|
@@ -2887,7 +2894,7 @@ var commands$1 = {
|
|
|
2887
2894
|
},
|
|
2888
2895
|
"wallet redeem": {
|
|
2889
2896
|
method: "wallet.redeem",
|
|
2890
|
-
usage: "wallet redeem [<cashu-token>]",
|
|
2897
|
+
usage: "wallet redeem [<cashu-token> | -]",
|
|
2891
2898
|
summary: "Take the ecash of a Cashu token (its mint must be one of yours); the token on stdin keeps it out of ps",
|
|
2892
2899
|
args: ["token?"],
|
|
2893
2900
|
params: (_, { token }) => ({ token })
|
|
@@ -2969,7 +2976,7 @@ var commands = {
|
|
|
2969
2976
|
params: ({ options }, a) => ({
|
|
2970
2977
|
chat: a.chat,
|
|
2971
2978
|
service: a.service,
|
|
2972
|
-
port: options
|
|
2979
|
+
port: inRange(options, "port", "a whole number", 0, 65535, true)
|
|
2973
2980
|
})
|
|
2974
2981
|
},
|
|
2975
2982
|
"service peer": {
|
|
@@ -3026,7 +3033,7 @@ var TEXT_COMMANDS = {
|
|
|
3026
3033
|
method: "chat.send",
|
|
3027
3034
|
target: "chat",
|
|
3028
3035
|
args: ["chat", "text...?"],
|
|
3029
|
-
usage: "send <chat> [text...] [--reply <message>] [--button id:Label]... [--style id=primary|neutral|danger]... [--once] [--id id] [--stdin] [--force] [--wait none|sent|delivered]",
|
|
3036
|
+
usage: "send <chat> [text...] [--reply <message>] [--button id:Label]... [--style id=primary|neutral|danger]... [--once] [--id id] [--stdin] [--force] [--wait none|sent|delivered] [--timeout s]",
|
|
3030
3037
|
summary: "Send a message (text from arguments or stdin); --button puts buttons under it, each label its own (case aside)",
|
|
3031
3038
|
options: {
|
|
3032
3039
|
stdin: {
|
|
@@ -3048,7 +3055,7 @@ var TEXT_COMMANDS = {
|
|
|
3048
3055
|
"message",
|
|
3049
3056
|
"text...?"
|
|
3050
3057
|
],
|
|
3051
|
-
usage: "edit <chat> <message> [text... | --text <text> | --stdin] [--force] [--wait none|confirmed]",
|
|
3058
|
+
usage: "edit <chat> <message> [text... | --text <text> | --stdin] [--force] [--wait none|confirmed] [--timeout s]",
|
|
3052
3059
|
summary: "Replace the text of a message you sent (the id send gave; in a group, group edit)",
|
|
3053
3060
|
options: {
|
|
3054
3061
|
stdin: {
|
|
@@ -3213,6 +3220,19 @@ function noMoreThan(count, values, usage) {
|
|
|
3213
3220
|
if (values.length > count) throw new CliError("usage", `Too many arguments: ghostly ${usage}`);
|
|
3214
3221
|
}
|
|
3215
3222
|
//#endregion
|
|
3223
|
+
//#region src/jsonOut.ts
|
|
3224
|
+
/**
|
|
3225
|
+
* What `JSON.stringify` leaves raw and a terminal may act on: DEL and the C1 controls (CSI, OSC, ST, NEL... in UTF-8),
|
|
3226
|
+
* the line and paragraph separators, and the bidi marks, embeddings, overrides and isolates that reorder a line. Only
|
|
3227
|
+
* a string holds them, and a peer writes some of those strings (a message's text), so the CLI's output writes them as
|
|
3228
|
+
* `\uXXXX`: the same JSON value for every reader, nothing a terminal acts on. What is stored stays whole.
|
|
3229
|
+
*/
|
|
3230
|
+
var RAW = /[\u007f-\u009f\u061c\u200e\u200f\u2028\u2029\u202a-\u202e\u2066-\u2069]/g;
|
|
3231
|
+
/** `value` as the JSON the CLI prints: `JSON.stringify`, with `RAW` escaped. */
|
|
3232
|
+
function jsonOut(value, space) {
|
|
3233
|
+
return JSON.stringify(value, null, space)?.replace(RAW, (char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4, "0"));
|
|
3234
|
+
}
|
|
3235
|
+
//#endregion
|
|
3216
3236
|
//#region src/listen.ts
|
|
3217
3237
|
/** The cursor's own write failed, not the event's handling. */
|
|
3218
3238
|
var CursorError = class extends Error {
|
|
@@ -3527,7 +3547,7 @@ async function post(url, event, retryMs) {
|
|
|
3527
3547
|
});
|
|
3528
3548
|
response.body?.cancel().catch(() => {});
|
|
3529
3549
|
if (response.ok) {
|
|
3530
|
-
if (holding) process.stderr.write(`ghostly: the webhook at ${url.
|
|
3550
|
+
if (holding) process.stderr.write(`ghostly: the webhook at ${url.origin} answers again: event ${event.seq} taken\n`);
|
|
3531
3551
|
return true;
|
|
3532
3552
|
}
|
|
3533
3553
|
status = response.status;
|
|
@@ -3536,7 +3556,7 @@ async function post(url, event, retryMs) {
|
|
|
3536
3556
|
if (!down && attempt >= 2) return status;
|
|
3537
3557
|
if (down && attempt >= 2 && !holding) {
|
|
3538
3558
|
holding = true;
|
|
3539
|
-
process.stderr.write(`ghostly: the webhook at ${url.
|
|
3559
|
+
process.stderr.write(`ghostly: the webhook at ${url.origin} is not answering: holding event ${event.seq} (${event.type}) until it does\n`);
|
|
3540
3560
|
}
|
|
3541
3561
|
await new Promise((resolve) => setTimeout(resolve, wait));
|
|
3542
3562
|
wait = Math.min(wait * 2, RETRY_MAX_MS);
|
|
@@ -3593,13 +3613,13 @@ function eventHandler(options) {
|
|
|
3593
3613
|
if (!next) return skip();
|
|
3594
3614
|
event = next;
|
|
3595
3615
|
}
|
|
3596
|
-
const full = options.print && options.write(
|
|
3616
|
+
const full = options.print && options.write(jsonOut(event)) === false;
|
|
3597
3617
|
if (options.exec) {
|
|
3598
3618
|
const code = await runExec(options.exec, event);
|
|
3599
3619
|
if (code !== 0) process.stderr.write(`ghostly: --exec exited ${code} on event ${event.seq} (${event.type})\n`);
|
|
3600
3620
|
}
|
|
3601
3621
|
const answered = webhook ? await post(webhook, event, options.retryMs ?? 500) : true;
|
|
3602
|
-
if (webhook && answered !== true) process.stderr.write(`ghostly: the webhook at ${webhook.
|
|
3622
|
+
if (webhook && answered !== true) process.stderr.write(`ghostly: the webhook at ${webhook.origin} answered ${answered}: event ${event.seq} (${event.type}) passed, not taken (a 4xx or a redirect is not tried again)\n`);
|
|
3603
3623
|
if (full) await options.drained?.();
|
|
3604
3624
|
keep(event.seq);
|
|
3605
3625
|
}).catch((error) => {
|
|
@@ -3761,10 +3781,10 @@ var STDIN_GIVE_UP_MS = 6e4;
|
|
|
3761
3781
|
async function secretsFromStdin(method, params, read, tty = false, note = () => {}) {
|
|
3762
3782
|
const warning = (what) => `${what} on the command line shows in ps and the shell's history: give it on stdin instead`;
|
|
3763
3783
|
if (method === "wallet.redeem") {
|
|
3764
|
-
if (params.token !== void 0) return warning("A token");
|
|
3784
|
+
if (params.token !== void 0 && params.token !== "-") return warning("A token");
|
|
3765
3785
|
const missing = () => new CliError("usage", "Missing <cashu-token>: give it as an argument or on stdin (… | ghostly wallet redeem)");
|
|
3766
3786
|
if (tty) throw missing();
|
|
3767
|
-
const token = (await readUnasked(read, note, {
|
|
3787
|
+
const token = (params.token === "-" ? await read() : await readUnasked(read, note, {
|
|
3768
3788
|
what: "a Cashu token",
|
|
3769
3789
|
missing: "Missing <cashu-token>",
|
|
3770
3790
|
command: "wallet redeem",
|
|
@@ -3855,15 +3875,15 @@ var VERSION = package_default.version;
|
|
|
3855
3875
|
* command a running daemon answers loads none of them, and starts about as fast as Node does. Statically imported, they
|
|
3856
3876
|
* cost every command ~100 ms before its socket was opened.
|
|
3857
3877
|
*/
|
|
3858
|
-
var engineApi = () => import("./api-
|
|
3859
|
-
var engineHost = () => import("./host-
|
|
3878
|
+
var engineApi = () => import("./api-CcuCtc1H.js");
|
|
3879
|
+
var engineHost = () => import("./host-DpypH-fR.js");
|
|
3860
3880
|
/**
|
|
3861
3881
|
* `--translate <lang>`'s translator, or null (not asked; or the runtime is not there, said on stderr). Loaded only when
|
|
3862
3882
|
* asked: the app's message parser it reads costs every other command nothing.
|
|
3863
3883
|
*/
|
|
3864
3884
|
async function translatorFor(value, home) {
|
|
3865
3885
|
if (value === void 0) return null;
|
|
3866
|
-
const { loadDetector, openTranslator, translateTarget } = await import("./translate-
|
|
3886
|
+
const { loadDetector, openTranslator, translateTarget } = await import("./translate-cDBotA-b.js");
|
|
3867
3887
|
return openTranslator({
|
|
3868
3888
|
home,
|
|
3869
3889
|
to: translateTarget(value),
|
|
@@ -3873,7 +3893,7 @@ async function translatorFor(value, home) {
|
|
|
3873
3893
|
}
|
|
3874
3894
|
var pretty = false;
|
|
3875
3895
|
function print(value) {
|
|
3876
|
-
process.stdout.write(
|
|
3896
|
+
process.stdout.write(jsonOut(value, pretty ? 2 : void 0) + "\n");
|
|
3877
3897
|
}
|
|
3878
3898
|
/** Done, with something to know (a voice note sent without its waveform): said on stderr, the JSON stays the answer. */
|
|
3879
3899
|
function printAnswer(result) {
|
|
@@ -4554,7 +4574,7 @@ async function profileCommand(sub, argv) {
|
|
|
4554
4574
|
if (!given || !name) throw new CliError("usage", "ghostly profile restore <file> <new profile> [--passphrase-file f] [--use]");
|
|
4555
4575
|
noMoreThan(2, parsed.positionals, "profile restore <file> <new profile> [--passphrase-file f] [--use]");
|
|
4556
4576
|
const file = here(given);
|
|
4557
|
-
const { backupFileProtection, restoreProfile } = await import("./backup-
|
|
4577
|
+
const { backupFileProtection, restoreProfile } = await import("./backup-A0hIa9GE.js");
|
|
4558
4578
|
const protection = await backupFileProtection(file);
|
|
4559
4579
|
const paths = await restoreProfile(g.home, checkProfileName(name), file, protection === "none" ? void 0 : backupPassphrase(parsed.options["passphrase-file"], RESTORE_PASSPHRASE));
|
|
4560
4580
|
if (parsed.options.use) selectProfile(g.home, name);
|
|
@@ -5202,7 +5222,7 @@ async function textCommand(name, argv) {
|
|
|
5202
5222
|
};
|
|
5203
5223
|
if (spec.target === "group") params.mentions = parsed.options.mention ?? [];
|
|
5204
5224
|
if (parsed.options.reply !== void 0) params.reply = parsed.options.reply;
|
|
5205
|
-
if (!spec.message) Object.assign(params, (await import("./buttons-
|
|
5225
|
+
if (!spec.message) Object.assign(params, (await import("./buttons-Bxxu3lSk.js")).buttonsOf(parsed.options));
|
|
5206
5226
|
print(await withSession(g, (s) => {
|
|
5207
5227
|
if (spec.target === "chat") {
|
|
5208
5228
|
params.wait = parsed.options.wait ?? (s.mode === "one-shot" ? spec.message ? "confirmed" : "sent" : "none");
|
|
@@ -5248,6 +5268,11 @@ async function identityAddCommand(argv) {
|
|
|
5248
5268
|
if (eq < 1) throw new CliError("usage", `--field takes name=value, not ${JSON.stringify(item)}`);
|
|
5249
5269
|
fields[item.slice(0, eq)] = item.slice(eq + 1);
|
|
5250
5270
|
}
|
|
5271
|
+
inRange(parsed.options, "timeout", "a number of seconds", 5, 3600);
|
|
5272
|
+
if (parsed.options.days !== void 0) {
|
|
5273
|
+
const known = (await import("./registry-BlSTJlbv.js")).IDENTITY_PROVIDERS.find((p) => p.id === provider);
|
|
5274
|
+
if (known) inRange(parsed.options, "days", "a whole number", 1, known.validity.maxDays, true);
|
|
5275
|
+
}
|
|
5251
5276
|
const params = {
|
|
5252
5277
|
provider,
|
|
5253
5278
|
subject: subject.join(" ") || void 0,
|
|
@@ -5342,7 +5367,7 @@ async function tableCommand(name, argv) {
|
|
|
5342
5367
|
});
|
|
5343
5368
|
if (translator) {
|
|
5344
5369
|
try {
|
|
5345
|
-
printAnswer(await (await import("./translate-
|
|
5370
|
+
printAnswer(await (await import("./translate-cDBotA-b.js")).translateAnswer(result, translator));
|
|
5346
5371
|
} finally {
|
|
5347
5372
|
translator.close();
|
|
5348
5373
|
}
|
|
@@ -5521,4 +5546,4 @@ async function run(argv) {
|
|
|
5521
5546
|
//#endregion
|
|
5522
5547
|
export { run };
|
|
5523
5548
|
|
|
5524
|
-
//# sourceMappingURL=main-
|
|
5549
|
+
//# sourceMappingURL=main-BwgoQZVu.js.map
|