@ghostlytools/cli 1.10.0 → 1.10.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 +19 -17
- package/SKILL.md +5 -4
- package/dist/assets/api-DcE4KylM.js +3 -0
- package/dist/assets/{api-BF_KwecF.js → api-EUGHGnRz.js} +108 -49
- package/dist/assets/api-EUGHGnRz.js.map +1 -0
- package/dist/assets/{apiKit-Du1u2l4x.js → apiKit-CJVp_crp.js} +85 -22
- package/dist/assets/apiKit-CJVp_crp.js.map +1 -0
- package/dist/assets/{apps-Bti9fDoW.js → apps-C-KbyLCa.js} +1 -1
- package/dist/assets/{apps-DwPfp54I.js → apps-C54T_MOT.js} +33 -12
- package/dist/assets/apps-C54T_MOT.js.map +1 -0
- package/dist/assets/{arkade-DOWpA2Kr.js → arkade-BmxJTa65.js} +2 -2
- package/dist/assets/{arkade-DOWpA2Kr.js.map → arkade-BmxJTa65.js.map} +1 -1
- package/dist/assets/{backup-DZ_Q1eSu.js → backup-BxSH5BZG.js} +7 -6
- package/dist/assets/{backup-DZ_Q1eSu.js.map → backup-BxSH5BZG.js.map} +1 -1
- package/dist/assets/{backup-CeRckyl2.js → backup-C0Plp-DF.js} +1 -1
- package/dist/assets/bark_ffi_wasm_bg-EY2uc0Bx.js.map +1 -1
- package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js.map +1 -1
- package/dist/assets/{buttons-BxIThdg9.js → buttons-B-ZJYdo0.js} +6 -6
- package/dist/assets/{buttons-BxIThdg9.js.map → buttons-B-ZJYdo0.js.map} +1 -1
- package/dist/assets/buttons-DA3wZfG0.js +2 -0
- package/dist/assets/childEnv-BVOQK9EA.js +21 -0
- package/dist/assets/childEnv-BVOQK9EA.js.map +1 -0
- package/dist/assets/{client-D5E1RQYB.js → client-CDa87uYD.js} +3 -3
- package/dist/assets/{client-D5E1RQYB.js.map → client-CDa87uYD.js.map} +1 -1
- package/dist/assets/codec-D45W1L8n.js +13 -0
- package/dist/assets/codec-D45W1L8n.js.map +1 -0
- package/dist/assets/{envelope-CugS9qwQ.js → envelope-C3yFCQa-.js} +3 -12
- package/dist/assets/envelope-C3yFCQa-.js.map +1 -0
- package/dist/assets/{errors-R4S2SAEM.js → errors-Dt-ZnyOX.js} +3 -1
- package/dist/assets/errors-Dt-ZnyOX.js.map +1 -0
- package/dist/assets/{fixedHosts-B4E4VrYE.js → fixedHosts-C6nCHjOa.js} +4 -4
- package/dist/assets/{fixedHosts-B4E4VrYE.js.map → fixedHosts-C6nCHjOa.js.map} +1 -1
- package/dist/assets/{groupFiles-NonOYBKN.js → groupFiles-DYopNE57.js} +217 -178
- package/dist/assets/groupFiles-DYopNE57.js.map +1 -0
- package/dist/assets/{host-DvcVt5YI.js → host-G5seUwaI.js} +241 -87
- package/dist/assets/host-G5seUwaI.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-Ce42sR8x.js → hyperdhtRelay-B_uHjg_r.js} +28 -20
- package/dist/assets/hyperdhtRelay-B_uHjg_r.js.map +1 -0
- package/dist/assets/{irohWeb-C9ChbD-c.js → irohWeb-C-2oslSU.js} +120 -38
- package/dist/assets/irohWeb-C-2oslSU.js.map +1 -0
- package/dist/assets/{main-4qE381KM.js → main-Dk--nD7X.js} +92 -48
- package/dist/assets/main-Dk--nD7X.js.map +1 -0
- package/dist/assets/{mainline-DOwZDHVy.js → mainline-HPlVrl8R.js} +5 -5
- package/dist/assets/mainline-HPlVrl8R.js.map +1 -0
- package/dist/assets/networkReason-CfpO9ayz.js +474 -0
- package/dist/assets/networkReason-CfpO9ayz.js.map +1 -0
- package/dist/assets/{nwc-CHLWFV1R.js → nwc-BY7BPttn.js} +3 -3
- package/dist/assets/{nwc-CHLWFV1R.js.map → nwc-BY7BPttn.js.map} +1 -1
- package/dist/assets/{nwcProvider-BlkPOJen.js → nwcProvider-CfpbNUf7.js} +2 -2
- package/dist/assets/{nwcProvider-BlkPOJen.js.map → nwcProvider-CfpbNUf7.js.map} +1 -1
- package/dist/assets/{ownDid-yXtY_1B5.js → ownDid-DJFZM2cV.js} +2 -2
- package/dist/assets/{ownDid-yXtY_1B5.js.map → ownDid-DJFZM2cV.js.map} +1 -1
- package/dist/assets/{profiles-vbXHs0Mq.js → profiles-DKmZGXp6.js} +22 -9
- package/dist/assets/profiles-DKmZGXp6.js.map +1 -0
- package/dist/assets/{registry-chCD0KWS.js → registry-BUm4cAzV.js} +60 -19
- package/dist/assets/registry-BUm4cAzV.js.map +1 -0
- package/dist/assets/{registry-BN9r2pR4.js → registry-CAzrtV0_.js} +1 -1
- package/dist/assets/{resolve-Dtzogt2W.js → resolve-CDD4X68j.js} +5 -3
- package/dist/assets/resolve-CDD4X68j.js.map +1 -0
- package/dist/assets/{restoredRows-CRYwIx3g.js → restoredRows-YhlbokEE.js} +4 -2
- package/dist/assets/restoredRows-YhlbokEE.js.map +1 -0
- package/dist/assets/{secretGuard-CSVNxXVW.js → secretGuard-B7Hj0Kvz.js} +2 -2
- package/dist/assets/{secretGuard-CSVNxXVW.js.map → secretGuard-B7Hj0Kvz.js.map} +1 -1
- package/dist/assets/secretGuard-DUr6bgKc.js +2 -0
- package/dist/assets/{server-BZnsm5X5.js → server-DcOsgYDU.js} +1046 -573
- package/dist/assets/server-DcOsgYDU.js.map +1 -0
- package/dist/assets/{src-DZagapGt.js → src-D31D1_oY.js} +2360 -1673
- package/dist/assets/src-D31D1_oY.js.map +1 -0
- package/dist/assets/{sshForges-BkTgy5rx.js → sshForges-DerRwMf3.js} +2 -2
- package/dist/assets/{sshForges-BkTgy5rx.js.map → sshForges-DerRwMf3.js.map} +1 -1
- package/dist/assets/{translate-B9SMd6uf.js → translate-C-sj0VJe.js} +12 -8
- package/dist/assets/{translate-B9SMd6uf.js.map → translate-C-sj0VJe.js.map} +1 -1
- package/dist/assets/{usdt-BU4ezonh.js → usdt-DwHqp625.js} +3 -3
- package/dist/assets/{usdt-BU4ezonh.js.map → usdt-DwHqp625.js.map} +1 -1
- package/dist/assets/{waitNotice-B8D8WhbE.js → waitNotice-D52RWbV4.js} +38 -4
- package/dist/assets/waitNotice-D52RWbV4.js.map +1 -0
- package/dist/assets/{words-jYy7lTcb.js → words-Db9WgatT.js} +3 -3
- package/dist/assets/words-Db9WgatT.js.map +1 -0
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/api-BF_KwecF.js.map +0 -1
- package/dist/assets/api-DdrA86Ur.js +0 -3
- package/dist/assets/apiKit-Du1u2l4x.js.map +0 -1
- package/dist/assets/apps-DwPfp54I.js.map +0 -1
- package/dist/assets/buttons-D9QBHS9Y.js +0 -2
- package/dist/assets/envelope-CugS9qwQ.js.map +0 -1
- package/dist/assets/errors-R4S2SAEM.js.map +0 -1
- package/dist/assets/groupFiles-NonOYBKN.js.map +0 -1
- package/dist/assets/host-DvcVt5YI.js.map +0 -1
- package/dist/assets/hyperdhtRelay-Ce42sR8x.js.map +0 -1
- package/dist/assets/irohWeb-C9ChbD-c.js.map +0 -1
- package/dist/assets/main-4qE381KM.js.map +0 -1
- package/dist/assets/mainline-DOwZDHVy.js.map +0 -1
- package/dist/assets/networkReason-MInk1Y63.js +0 -154
- package/dist/assets/networkReason-MInk1Y63.js.map +0 -1
- package/dist/assets/profiles-vbXHs0Mq.js.map +0 -1
- package/dist/assets/registry-chCD0KWS.js.map +0 -1
- package/dist/assets/resolve-Dtzogt2W.js.map +0 -1
- package/dist/assets/restoredRows-CRYwIx3g.js.map +0 -1
- package/dist/assets/secretGuard-Q2BKq0q0.js +0 -2
- package/dist/assets/server-BZnsm5X5.js.map +0 -1
- package/dist/assets/src-DZagapGt.js.map +0 -1
- package/dist/assets/waitNotice-B8D8WhbE.js.map +0 -1
- package/dist/assets/words-jYy7lTcb.js.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as localFileError, n as EXIT, r as asCliError, t as CliError } from "./errors-
|
|
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-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { Da as VOICE_LIMITS, bo as cardLine, do as PR_CHECKS, fo as PR_STATES, go as TASK_STATUSES, ho as STATUS_CARD_LIMITS, lo as CRON_LINE, mo as RUN_RESULTS, nr as GROUP_FILE_LIMITS, po as ROUTINE_STATES, uo as ITEM_STATES, wo as statusCardBytes, xo as cardUrl } from "./src-D31D1_oY.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-Db9WgatT.js";
|
|
4
|
+
import { g as namedByThem, t as CONTACT_KEY } from "./apiKit-CJVp_crp.js";
|
|
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-DKmZGXp6.js";
|
|
7
|
+
import { n as waitNotice, r as waitsFor } from "./waitNotice-D52RWbV4.js";
|
|
8
|
+
import { g as isCallRate, i as isNotTheDaemon, r as connectDaemon, t as DaemonClient, u as CALL_RATES } from "./client-CDa87uYD.js";
|
|
8
9
|
import { spawn } from "node:child_process";
|
|
9
10
|
import { accessSync, closeSync, constants, existsSync, fstatSync, openSync, readFileSync, readSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
10
11
|
import { dirname, resolve } from "node:path";
|
|
@@ -12,7 +13,7 @@ import { connect } from "node:net";
|
|
|
12
13
|
import { format } from "node:util";
|
|
13
14
|
var package_default = {
|
|
14
15
|
name: "@ghostlytools/cli",
|
|
15
|
-
version: "1.10.
|
|
16
|
+
version: "1.10.2",
|
|
16
17
|
type: "module",
|
|
17
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.",
|
|
18
19
|
license: "MIT",
|
|
@@ -1082,7 +1083,7 @@ var commands$8 = {
|
|
|
1082
1083
|
description: "Replace the three files when they are there"
|
|
1083
1084
|
}
|
|
1084
1085
|
},
|
|
1085
|
-
run: async ({ options }, a) => (await import("./apps-
|
|
1086
|
+
run: async ({ options }, a) => (await import("./apps-C-KbyLCa.js")).initApp(a.dir, {
|
|
1086
1087
|
name: options.name,
|
|
1087
1088
|
title: options.title,
|
|
1088
1089
|
force: options.force === true
|
|
@@ -1122,7 +1123,7 @@ var commands$8 = {
|
|
|
1122
1123
|
description: "This version's sequence, higher than the bundle at --out's (default: one more than it)"
|
|
1123
1124
|
}
|
|
1124
1125
|
},
|
|
1125
|
-
run: async ({ options }, a) => (await import("./apps-
|
|
1126
|
+
run: async ({ options }, a) => (await import("./apps-C-KbyLCa.js")).publishApp(a.dir, keyFile(options.key, "app publish <dir> --key <file> [--out <file>] [--sequence n]"), here(options.out), options.sequence)
|
|
1126
1127
|
},
|
|
1127
1128
|
"app revoke": {
|
|
1128
1129
|
method: "app.revoke",
|
|
@@ -1155,7 +1156,7 @@ var commands$8 = {
|
|
|
1155
1156
|
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"
|
|
1156
1157
|
}
|
|
1157
1158
|
},
|
|
1158
|
-
run: async ({ options }, a) => (await import("./apps-
|
|
1159
|
+
run: async ({ options }, a) => (await import("./apps-C-KbyLCa.js")).revokeApp(a.dir, keyFile(options.key, "app revoke <dir> --key <file> (--digest <digest>... | --up-to <sequence>) [--reason <text>] [--bundle <file>] [--force]"), {
|
|
1159
1160
|
digests: options.digest,
|
|
1160
1161
|
upTo: options["up-to"],
|
|
1161
1162
|
reason: options.reason,
|
|
@@ -1216,7 +1217,7 @@ var commands$8 = {
|
|
|
1216
1217
|
usage: "app verify <bundle|url>",
|
|
1217
1218
|
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",
|
|
1218
1219
|
args: ["bundle"],
|
|
1219
|
-
run: async (_, a) => (await import("./apps-
|
|
1220
|
+
run: async (_, a) => (await import("./apps-C-KbyLCa.js")).verifyApp(a.bundle)
|
|
1220
1221
|
},
|
|
1221
1222
|
"store sign": {
|
|
1222
1223
|
method: "store.sign",
|
|
@@ -1233,7 +1234,7 @@ var commands$8 = {
|
|
|
1233
1234
|
description: "The folder to write ghostly-store.json and ghostly-store.sig in (default: the index's)"
|
|
1234
1235
|
}
|
|
1235
1236
|
},
|
|
1236
|
-
run: async ({ options }, a) => (await import("./apps-
|
|
1237
|
+
run: async ({ options }, a) => (await import("./apps-C-KbyLCa.js")).signStore(a.index, keyFile(options.key, "store sign <index> --key <file> [--out <dir>]"), here(options.out))
|
|
1237
1238
|
}
|
|
1238
1239
|
};
|
|
1239
1240
|
//#endregion
|
|
@@ -1647,7 +1648,7 @@ var commands$6 = {
|
|
|
1647
1648
|
},
|
|
1648
1649
|
"message delete": {
|
|
1649
1650
|
method: "chat.delete",
|
|
1650
|
-
usage: "message delete <chat|group> <message> [--everyone [--wait none|confirmed] [--timeout s]]",
|
|
1651
|
+
usage: "message delete <chat|group> <message> [--everyone [--wait none|confirmed|sent] [--timeout s]]",
|
|
1651
1652
|
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",
|
|
1652
1653
|
args: ["chat", "message"],
|
|
1653
1654
|
options: {
|
|
@@ -1657,8 +1658,12 @@ var commands$6 = {
|
|
|
1657
1658
|
},
|
|
1658
1659
|
wait: {
|
|
1659
1660
|
type: "string",
|
|
1660
|
-
choices: [
|
|
1661
|
-
|
|
1661
|
+
choices: [
|
|
1662
|
+
"none",
|
|
1663
|
+
"confirmed",
|
|
1664
|
+
"sent"
|
|
1665
|
+
],
|
|
1666
|
+
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)"
|
|
1662
1667
|
},
|
|
1663
1668
|
timeout: wait.timeout
|
|
1664
1669
|
},
|
|
@@ -3314,7 +3319,7 @@ async function allowlist(from, groups, call, peerOf) {
|
|
|
3314
3319
|
keys.add(ref);
|
|
3315
3320
|
continue;
|
|
3316
3321
|
}
|
|
3317
|
-
const chat = await call("chat.get", { chat: ref });
|
|
3322
|
+
const chat = await otherFlag(call("chat.get", { chat: ref }), ref, "--from");
|
|
3318
3323
|
if (chat.id !== ref && chat.label?.toLowerCase() !== ref.toLowerCase()) throw namedByThem(ref, {
|
|
3319
3324
|
chat: chat.id,
|
|
3320
3325
|
name: chat.peerName ?? null,
|
|
@@ -3322,9 +3327,23 @@ async function allowlist(from, groups, call, peerOf) {
|
|
|
3322
3327
|
});
|
|
3323
3328
|
chats.add(chat.id);
|
|
3324
3329
|
}
|
|
3325
|
-
for (const ref of groups) groupIds.add((await call("group.get", { group: ref })).id);
|
|
3330
|
+
for (const ref of groups) groupIds.add((await otherFlag(call("group.get", { group: ref }), ref, "--group")).id);
|
|
3326
3331
|
return new Allowlist(chats, keys, groupIds, peerOf);
|
|
3327
3332
|
}
|
|
3333
|
+
/**
|
|
3334
|
+
* A `--from` that names a group, or a `--group` a chat: said with the flag that takes it. The lookup's own hint named
|
|
3335
|
+
* `ghostly group show` (or `chat show`), which lists nothing.
|
|
3336
|
+
*/
|
|
3337
|
+
async function otherFlag(lookup, ref, flag) {
|
|
3338
|
+
try {
|
|
3339
|
+
return await lookup;
|
|
3340
|
+
} catch (error) {
|
|
3341
|
+
const other = flag === "--from" ? "group" : "chat";
|
|
3342
|
+
if (!(error instanceof CliError) || error.code !== "not_found" || typeof error.details?.[other] !== "string") throw error;
|
|
3343
|
+
const shown = /^[\w.:-]+$/.test(ref) ? ref : JSON.stringify(ref);
|
|
3344
|
+
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);
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3328
3347
|
/** The turn an event starts, or null: only a contact's message, and a group message that mentions this profile. */
|
|
3329
3348
|
function toTurn(event) {
|
|
3330
3349
|
const message = event.message;
|
|
@@ -3528,9 +3547,7 @@ function checkTypes(types, warn) {
|
|
|
3528
3547
|
}
|
|
3529
3548
|
/** The environment a hook runs in: this one's, less the backup passphrase (a hook, and what it runs, never needs it). */
|
|
3530
3549
|
function hookEnv(env) {
|
|
3531
|
-
|
|
3532
|
-
delete rest.GHOSTLY_BACKUP_PASSPHRASE;
|
|
3533
|
-
return rest;
|
|
3550
|
+
return childEnv(env);
|
|
3534
3551
|
}
|
|
3535
3552
|
/** Runs `command` through the shell with the event on stdin (never in its arguments); resolves with its exit code. */
|
|
3536
3553
|
function runExec(command, event) {
|
|
@@ -3904,7 +3921,7 @@ async function completeWithPipedEvidence(call, params, read, note) {
|
|
|
3904
3921
|
* `credential`) given on the command line still goes, with the ps/history warning: `settings get` hides it as a secret.
|
|
3905
3922
|
*/
|
|
3906
3923
|
async function settingValue(key, value, read, tty = false, note = () => {}) {
|
|
3907
|
-
const usage = "Missing <json-value>: ghostly settings set <key> <json-value>";
|
|
3924
|
+
const usage = "Missing <json-value>: ghostly settings set <key> <json-value> [--force]";
|
|
3908
3925
|
if (value !== void 0 && value !== "-") return {
|
|
3909
3926
|
value,
|
|
3910
3927
|
...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} -)` }
|
|
@@ -3998,15 +4015,15 @@ var VERSION = package_default.version;
|
|
|
3998
4015
|
* command a running daemon answers loads none of them, and starts about as fast as Node does. Statically imported, they
|
|
3999
4016
|
* cost every command ~100 ms before its socket was opened.
|
|
4000
4017
|
*/
|
|
4001
|
-
var engineApi = () => import("./api-
|
|
4002
|
-
var engineHost = () => import("./host-
|
|
4018
|
+
var engineApi = () => import("./api-DcE4KylM.js");
|
|
4019
|
+
var engineHost = () => import("./host-G5seUwaI.js");
|
|
4003
4020
|
/**
|
|
4004
4021
|
* `--translate <lang>`'s translator, or null (not asked; or the runtime is not there, said on stderr). Loaded only when
|
|
4005
4022
|
* asked: the app's message parser it reads costs every other command nothing.
|
|
4006
4023
|
*/
|
|
4007
4024
|
async function translatorFor(value, home) {
|
|
4008
4025
|
if (value === void 0) return null;
|
|
4009
|
-
const { loadDetector, openTranslator, translateTarget } = await import("./translate-
|
|
4026
|
+
const { loadDetector, openTranslator, translateTarget } = await import("./translate-C-sj0VJe.js");
|
|
4010
4027
|
return openTranslator({
|
|
4011
4028
|
home,
|
|
4012
4029
|
to: translateTarget(value),
|
|
@@ -4120,10 +4137,15 @@ function settlesWithin(promise, ms) {
|
|
|
4120
4137
|
* waited for the next minute (60 s and more instead of 3 to 5).
|
|
4121
4138
|
*/
|
|
4122
4139
|
function chatOnly(method, params) {
|
|
4123
|
-
if (method.startsWith("task.") || method.startsWith("routine.") || method.startsWith("button.")) return false;
|
|
4124
4140
|
if (method === "usage.send") return params.all === true;
|
|
4141
|
+
if (chatOrGroup(method, params)) return false;
|
|
4125
4142
|
return method.startsWith("chat.") || params.chat !== void 0 && params.group === void 0 && !method.startsWith("group.");
|
|
4126
4143
|
}
|
|
4144
|
+
/** A command whose `chat` may name a group as well: a one-shot for it starts the groups' sessions. */
|
|
4145
|
+
function chatOrGroup(method, params) {
|
|
4146
|
+
if (method.startsWith("task.") || method.startsWith("routine.") || method.startsWith("button.") || method === "usage.send") return true;
|
|
4147
|
+
return method === "chat.delete" && params.everyone === true;
|
|
4148
|
+
}
|
|
4127
4149
|
/**
|
|
4128
4150
|
* A command that makes a new chat and needs no other: a one-shot for it leaves the saved chats and the groups unstarted.
|
|
4129
4151
|
* Started, each saved chat put its records and its leave packet on the relays: from about ten that was the relays' 30
|
|
@@ -4134,6 +4156,16 @@ function newChatOnly(method) {
|
|
|
4134
4156
|
return method === "invite.create" || method === "invite.join";
|
|
4135
4157
|
}
|
|
4136
4158
|
/**
|
|
4159
|
+
* 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
|
|
4160
|
+
* the other saved chats unstarted too, and starts only the chat a call names (`startNamedChats`). Started, each saved
|
|
4161
|
+
* chat put its records and its leave packet on the relays: with 12 invites saved one `send` took the relays' 30
|
|
4162
|
+
* requests a minute, and a text to a contact who is away, or the next one-shot, waited behind them. So does a command
|
|
4163
|
+
* whose chat may name a group (`chatOrGroup`: a bot's `task send`): the groups start for it, the other 1:1 chats do not.
|
|
4164
|
+
*/
|
|
4165
|
+
function oneChatOnly(method, params) {
|
|
4166
|
+
return newChatOnly(method) || (chatOnly(method, params) || chatOrGroup(method, params)) && typeof params.chat === "string";
|
|
4167
|
+
}
|
|
4168
|
+
/**
|
|
4137
4169
|
* Calls that only read what the profile stores: a one-shot for one opens it offline (`RuntimeOptions.offline`).
|
|
4138
4170
|
* Opened online, `status` or `chat list` started every chat, put the profile's records on the relays again and waited
|
|
4139
4171
|
* for its leave packet to be taken: 0.25 s became 3.3 s with a relay that takes 1.5 s, and 10 s with one that does not
|
|
@@ -4214,12 +4246,16 @@ async function session(g, options) {
|
|
|
4214
4246
|
requireProfile(g);
|
|
4215
4247
|
const client = await connectDaemon(g.paths);
|
|
4216
4248
|
if (client) return throughDaemon(client);
|
|
4217
|
-
const [, { callApi }] = await Promise.all([engineHost(), engineApi()]);
|
|
4249
|
+
const [, { callApi, startNamedChats }] = await Promise.all([engineHost(), engineApi()]);
|
|
4218
4250
|
const host = await openOneShot(g, options);
|
|
4219
4251
|
if (host instanceof DaemonClient) return throughDaemon(host);
|
|
4252
|
+
const call = (m, p) => {
|
|
4253
|
+
if (options.deferChats && p && typeof p === "object") startNamedChats(host.ctx, p);
|
|
4254
|
+
return callApi(host.ctx, m, p ?? {});
|
|
4255
|
+
};
|
|
4220
4256
|
return {
|
|
4221
4257
|
mode: "one-shot",
|
|
4222
|
-
call
|
|
4258
|
+
call,
|
|
4223
4259
|
close: () => host.close(),
|
|
4224
4260
|
abort: () => host.close()
|
|
4225
4261
|
};
|
|
@@ -4280,8 +4316,8 @@ async function openOneShot(g, options = {}, mode = "one-shot") {
|
|
|
4280
4316
|
}
|
|
4281
4317
|
/**
|
|
4282
4318
|
* How a one-shot opens the profile: `deferGroups` when the command is about one 1:1 chat (`chatOnly`) and needs
|
|
4283
|
-
* nothing of the groups, `deferChats` too when it makes a new
|
|
4284
|
-
* changes only this device (`offlineCall`).
|
|
4319
|
+
* nothing of the groups, `deferChats` too when it names that chat or makes or joins a new one (`oneChatOnly`), `offline`
|
|
4320
|
+
* when it only reads or changes only this device (`offlineCall`).
|
|
4285
4321
|
*/
|
|
4286
4322
|
async function withSession(g, work, options = {}) {
|
|
4287
4323
|
const s = await session(g, options);
|
|
@@ -4412,7 +4448,7 @@ var o = (type, description) => ({
|
|
|
4412
4448
|
/** Commands with their own flow (main.ts), as help shows them. */
|
|
4413
4449
|
var SPECIAL = [
|
|
4414
4450
|
[
|
|
4415
|
-
"profile create <name> [--use] [--name <shown name>]",
|
|
4451
|
+
"profile create <name> [--use] [--name <shown name>] [--force]",
|
|
4416
4452
|
"Make a profile (its own keys, chats and wallets)",
|
|
4417
4453
|
{
|
|
4418
4454
|
use: o("boolean", "Make it the current profile"),
|
|
@@ -4424,7 +4460,7 @@ var SPECIAL = [
|
|
|
4424
4460
|
["profile use <name>", "Make a profile the current one"],
|
|
4425
4461
|
["profile show", "The name contacts see, and whether it is shared"],
|
|
4426
4462
|
[
|
|
4427
|
-
"profile set [--name <name>] [--share-profile | --no-share-profile]",
|
|
4463
|
+
"profile set [--name <name>] [--share-profile | --no-share-profile] [--force]",
|
|
4428
4464
|
"Change the name contacts see",
|
|
4429
4465
|
{
|
|
4430
4466
|
name: o("string", "The name contacts see"),
|
|
@@ -4498,7 +4534,7 @@ var SPECIAL = [
|
|
|
4498
4534
|
{ "show-secret": o("boolean", "Show credentials too") }
|
|
4499
4535
|
],
|
|
4500
4536
|
[
|
|
4501
|
-
"settings set <key> <json-value>",
|
|
4537
|
+
"settings set <key> <json-value> [--force]",
|
|
4502
4538
|
"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",
|
|
4503
4539
|
{ force: o("boolean", "Set a nick even if it looks like a seed, a key or ecash") }
|
|
4504
4540
|
],
|
|
@@ -4763,11 +4799,11 @@ async function profileCommand(sub, argv) {
|
|
|
4763
4799
|
switch (sub) {
|
|
4764
4800
|
case "create": {
|
|
4765
4801
|
const [name] = parsed.positionals;
|
|
4766
|
-
if (!name) throw new CliError("usage", "Missing <name>: ghostly profile create <name> [--use] [--name <shown name>]");
|
|
4767
|
-
noMoreThan(1, parsed.positionals, "profile create <name> [--use] [--name <shown name>]");
|
|
4802
|
+
if (!name) throw new CliError("usage", "Missing <name>: ghostly profile create <name> [--use] [--name <shown name>] [--force]");
|
|
4803
|
+
noMoreThan(1, parsed.positionals, "profile create <name> [--use] [--name <shown name>] [--force]");
|
|
4768
4804
|
const shownName = parsed.options.name === void 0 ? void 0 : checkShownName(parsed.options.name);
|
|
4769
4805
|
const force = parsed.options.force === true;
|
|
4770
|
-
if (shownName) (await import("./secretGuard-
|
|
4806
|
+
if (shownName) (await import("./secretGuard-DUr6bgKc.js")).guardText(shownName, force, "name", "set it");
|
|
4771
4807
|
const paths = createProfile(g.home, name);
|
|
4772
4808
|
let shown = null;
|
|
4773
4809
|
if (shownName !== void 0) try {
|
|
@@ -4821,11 +4857,11 @@ async function profileCommand(sub, argv) {
|
|
|
4821
4857
|
print(await withSession(g, (s) => s.call("profile.get"), { offline: true }));
|
|
4822
4858
|
return;
|
|
4823
4859
|
case "set": {
|
|
4824
|
-
noMoreThan(0, parsed.positionals, "profile set [--name <name>] [--share-profile | --no-share-profile]");
|
|
4860
|
+
noMoreThan(0, parsed.positionals, "profile set [--name <name>] [--share-profile | --no-share-profile] [--force]");
|
|
4825
4861
|
const params = {};
|
|
4826
4862
|
if (parsed.options.name !== void 0) params.name = parsed.options.name;
|
|
4827
4863
|
if (parsed.options["share-profile"] !== void 0) params.shareProfile = parsed.options["share-profile"];
|
|
4828
|
-
if (!Object.keys(params).length) throw new CliError("usage", "Nothing to change: ghostly profile set [--name <name>] [--share-profile | --no-share-profile]");
|
|
4864
|
+
if (!Object.keys(params).length) throw new CliError("usage", "Nothing to change: ghostly profile set [--name <name>] [--share-profile | --no-share-profile] [--force]");
|
|
4829
4865
|
if (parsed.options.force === true) params.force = true;
|
|
4830
4866
|
print(await withSession(g, (s) => s.call("profile.set", params)));
|
|
4831
4867
|
return;
|
|
@@ -4858,7 +4894,7 @@ async function profileCommand(sub, argv) {
|
|
|
4858
4894
|
if (!given || !name) throw new CliError("usage", `Missing <${given ? "new profile" : "file"}>: ghostly profile restore <file> <new profile> [--passphrase-file f] [--use]`);
|
|
4859
4895
|
noMoreThan(2, parsed.positionals, "profile restore <file> <new profile> [--passphrase-file f] [--use]");
|
|
4860
4896
|
const file = here(given);
|
|
4861
|
-
const { backupFileProtection, restoreProfile } = await import("./backup-
|
|
4897
|
+
const { backupFileProtection, restoreProfile } = await import("./backup-C0Plp-DF.js");
|
|
4862
4898
|
const protection = await backupFileProtection(file);
|
|
4863
4899
|
const paths = await restoreProfile(g.home, checkProfileName(name), file, protection === "none" ? void 0 : backupPassphrase(parsed.options["passphrase-file"], RESTORE_PASSPHRASE));
|
|
4864
4900
|
if (parsed.options.use) selectProfile(g.home, name);
|
|
@@ -4930,6 +4966,7 @@ async function runDaemon(g, seconds) {
|
|
|
4930
4966
|
requireProfile(g);
|
|
4931
4967
|
const detached = process.env[DETACHED_CHILD] === "1";
|
|
4932
4968
|
delete process.env[DETACHED_CHILD];
|
|
4969
|
+
dropSecretEnv();
|
|
4933
4970
|
const { keepServing, openHost, serve } = await engineHost();
|
|
4934
4971
|
const until = Date.now() + seconds * 1e3;
|
|
4935
4972
|
let host;
|
|
@@ -5203,7 +5240,7 @@ async function spawnDaemon(g, until) {
|
|
|
5203
5240
|
log
|
|
5204
5241
|
],
|
|
5205
5242
|
env: {
|
|
5206
|
-
...process.env,
|
|
5243
|
+
...childEnv(process.env),
|
|
5207
5244
|
[DETACHED_CHILD]: "1"
|
|
5208
5245
|
}
|
|
5209
5246
|
});
|
|
@@ -5547,8 +5584,8 @@ async function settingsCommand(sub, argv) {
|
|
|
5547
5584
|
}
|
|
5548
5585
|
if (sub === "set") {
|
|
5549
5586
|
const [key, given] = parsed.positionals;
|
|
5550
|
-
if (!key) throw new CliError("usage", "Missing <key>: ghostly settings set <key> <json-value>");
|
|
5551
|
-
noMoreThan(2, parsed.positionals, "settings set <key> <json-value>");
|
|
5587
|
+
if (!key) throw new CliError("usage", "Missing <key>: ghostly settings set <key> <json-value> [--force]");
|
|
5588
|
+
noMoreThan(2, parsed.positionals, "settings set <key> <json-value> [--force]");
|
|
5552
5589
|
const { value, warning } = await settingValue(key, given, readStdin, process.stdin.isTTY === true, (note) => process.stderr.write(`ghostly: ${note}\n`));
|
|
5553
5590
|
if (warning) process.stderr.write(`ghostly: ${warning}\n`);
|
|
5554
5591
|
let parsedValue;
|
|
@@ -5596,7 +5633,7 @@ async function textCommand(name, argv) {
|
|
|
5596
5633
|
};
|
|
5597
5634
|
if (spec.target === "group") params.mentions = parsed.options.mention ?? [];
|
|
5598
5635
|
if (parsed.options.reply !== void 0) params.reply = parsed.options.reply;
|
|
5599
|
-
if (!spec.message) Object.assign(params, (await import("./buttons-
|
|
5636
|
+
if (!spec.message) Object.assign(params, (await import("./buttons-DA3wZfG0.js")).buttonsOf(parsed.options));
|
|
5600
5637
|
print(await withSession(g, (s) => {
|
|
5601
5638
|
if (spec.target === "chat") {
|
|
5602
5639
|
params.wait = parsed.options.wait ?? (s.mode === "one-shot" ? spec.message ? "confirmed" : "sent" : "none");
|
|
@@ -5606,7 +5643,10 @@ async function textCommand(name, argv) {
|
|
|
5606
5643
|
if (parsed.options.timeout !== void 0) params.timeout = parsed.options.timeout;
|
|
5607
5644
|
}
|
|
5608
5645
|
return s.call(spec.method, params);
|
|
5609
|
-
}, {
|
|
5646
|
+
}, {
|
|
5647
|
+
deferGroups: spec.target === "chat",
|
|
5648
|
+
deferChats: spec.target === "chat"
|
|
5649
|
+
}));
|
|
5610
5650
|
}
|
|
5611
5651
|
/**
|
|
5612
5652
|
* `identity add`: a proof. An in-app signer finishes in this one command (what it waits on is printed to stderr as it
|
|
@@ -5642,7 +5682,7 @@ async function identityAddCommand(argv) {
|
|
|
5642
5682
|
if (!provider) throw new CliError("usage", "Missing <provider>: ghostly identity add <provider> [subject] [--signer id] [--field name=value]... [--stdin] [--days n] [--timeout s]");
|
|
5643
5683
|
inRange(parsed.options, "timeout", "a number of seconds", 5, 3600);
|
|
5644
5684
|
const items = parsed.options.field ?? [];
|
|
5645
|
-
const known = parsed.options.days !== void 0 || items.length ? (await import("./registry-
|
|
5685
|
+
const known = parsed.options.days !== void 0 || items.length ? (await import("./registry-CAzrtV0_.js")).IDENTITY_PROVIDERS.find((p) => p.id === provider) : void 0;
|
|
5646
5686
|
if (known && parsed.options.days !== void 0) inRange(parsed.options, "days", "a whole number", 1, known.validity.maxDays, true);
|
|
5647
5687
|
const { fields, warning } = await identityFields(items, parsed.options.stdin === true, identitySecretFields(known, parsed.options.signer), readStdin, process.stdin.isTTY === true);
|
|
5648
5688
|
if (warning) process.stderr.write(`ghostly: ${warning}\n`);
|
|
@@ -5747,12 +5787,12 @@ async function tableCommand(name, argv) {
|
|
|
5747
5787
|
return result;
|
|
5748
5788
|
}, {
|
|
5749
5789
|
deferGroups: chatOnly(command.method, params) || newChatOnly(command.method),
|
|
5750
|
-
deferChats:
|
|
5790
|
+
deferChats: oneChatOnly(command.method, params),
|
|
5751
5791
|
offline: offlineCall(command.method, params)
|
|
5752
5792
|
});
|
|
5753
5793
|
if (translator) {
|
|
5754
5794
|
try {
|
|
5755
|
-
printAnswer(await (await import("./translate-
|
|
5795
|
+
printAnswer(await (await import("./translate-C-sj0VJe.js")).translateAnswer(result, translator));
|
|
5756
5796
|
} finally {
|
|
5757
5797
|
translator.close();
|
|
5758
5798
|
}
|
|
@@ -5786,6 +5826,10 @@ async function callPipeCommand(argv) {
|
|
|
5786
5826
|
socket.write(`${audio.token}\n`);
|
|
5787
5827
|
process.stderr.write(`ghostly: call ${call.call}: s16le mono ${audio.rate} Hz on stdin/stdout\n`);
|
|
5788
5828
|
process.stdin.pipe(socket, { end: false });
|
|
5829
|
+
onReaderGone(() => {
|
|
5830
|
+
process.stderr.write(`ghostly: call ${call.call}: nothing reads its audio any more; the call goes on\n`);
|
|
5831
|
+
socket.destroy();
|
|
5832
|
+
});
|
|
5789
5833
|
socket.pipe(process.stdout);
|
|
5790
5834
|
socket.on("close", () => exit(0));
|
|
5791
5835
|
socket.on("error", () => exit(1));
|
|
@@ -5973,4 +6017,4 @@ async function run(argv) {
|
|
|
5973
6017
|
//#endregion
|
|
5974
6018
|
export { run };
|
|
5975
6019
|
|
|
5976
|
-
//# sourceMappingURL=main-
|
|
6020
|
+
//# sourceMappingURL=main-Dk--nD7X.js.map
|