@ghostlytools/cli 1.4.0 → 1.4.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 +5 -2
- package/dist/assets/{api-JMkEO0RR.js → api-PWMQJGFi.js} +59 -14
- package/dist/assets/api-PWMQJGFi.js.map +1 -0
- package/dist/assets/{api-BqLfti32.js → api-r2Nd4r19.js} +2 -2
- package/dist/assets/{apiKit-BpIUCwa-.js → apiKit-qLBXqv02.js} +2 -2
- package/dist/assets/{apiKit-BpIUCwa-.js.map → apiKit-qLBXqv02.js.map} +1 -1
- package/dist/assets/{apps-Bettj7WQ.js → apps-0XIzvlZk.js} +2 -2
- package/dist/assets/{apps-Bettj7WQ.js.map → apps-0XIzvlZk.js.map} +1 -1
- package/dist/assets/{apps-BdfyGVZ1.js → apps-DD9tZdFb.js} +1 -1
- package/dist/assets/{arkade-CP4HvKaa.js → arkade-BSmaMO_Y.js} +2 -2
- package/dist/assets/{arkade-CP4HvKaa.js.map → arkade-BSmaMO_Y.js.map} +1 -1
- package/dist/assets/{backup-BmBtta66.js → backup-DhO7RbYO.js} +4 -4
- package/dist/assets/{backup-BmBtta66.js.map → backup-DhO7RbYO.js.map} +1 -1
- package/dist/assets/{backup-BbO2zLjx.js → backup-LNFuInyF.js} +1 -1
- package/dist/assets/bark_ffi_wasm_bg-EY2uc0Bx.js.map +1 -1
- package/dist/assets/{buttons-YgijrprJ.js → buttons-BRkpVMtD.js} +3 -3
- package/dist/assets/{buttons-YgijrprJ.js.map → buttons-BRkpVMtD.js.map} +1 -1
- package/dist/assets/buttons-BjVhIyPp.js +2 -0
- package/dist/assets/{envelope-C7vnmsJN.js → envelope-DGu2538X.js} +2 -2
- package/dist/assets/{envelope-C7vnmsJN.js.map → envelope-DGu2538X.js.map} +1 -1
- package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js.map +1 -1
- package/dist/assets/{groupFiles-sIdGq4AV.js → groupFiles-BWlfYs84.js} +4 -4
- package/dist/assets/{groupFiles-sIdGq4AV.js.map → groupFiles-BWlfYs84.js.map} +1 -1
- package/dist/assets/{host-Drd-c4VO.js → host-bGuDUvo3.js} +81 -26
- package/dist/assets/host-bGuDUvo3.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-13aQ4KOf.js → hyperdhtRelay-DWQV9iZG.js} +17 -14
- package/dist/assets/hyperdhtRelay-DWQV9iZG.js.map +1 -0
- package/dist/assets/{irohWeb-DHCxSvHF.js → irohWeb-DCx_4wdP.js} +2 -2
- package/dist/assets/{irohWeb-DHCxSvHF.js.map → irohWeb-DCx_4wdP.js.map} +1 -1
- package/dist/assets/{main-BWAwKY4f.js → main-CQpFz5eR.js} +21 -19
- package/dist/assets/main-CQpFz5eR.js.map +1 -0
- package/dist/assets/{mainline-CsG-DdJ5.js → mainline-BI-TebeH.js} +2 -2
- package/dist/assets/{mainline-CsG-DdJ5.js.map → mainline-BI-TebeH.js.map} +1 -1
- package/dist/assets/{networkReason-B91upMCb.js → networkReason-DuKI3ATs.js} +2 -2
- package/dist/assets/{networkReason-B91upMCb.js.map → networkReason-DuKI3ATs.js.map} +1 -1
- package/dist/assets/{nwc-BFv67iSz.js → nwc-DcAovoOM.js} +3 -3
- package/dist/assets/{nwc-BFv67iSz.js.map → nwc-DcAovoOM.js.map} +1 -1
- package/dist/assets/{nwcProvider-BKNFdH9v.js → nwcProvider-LZGgbf5h.js} +2 -2
- package/dist/assets/{nwcProvider-BKNFdH9v.js.map → nwcProvider-LZGgbf5h.js.map} +1 -1
- package/dist/assets/{registry-CHPd_hf7.js → registry-D1qVtZzw.js} +1 -1
- package/dist/assets/{registry-qbnWmwCE.js → registry-KPRUnCeJ.js} +3 -3
- package/dist/assets/{registry-qbnWmwCE.js.map → registry-KPRUnCeJ.js.map} +1 -1
- package/dist/assets/{resolve-B63_uSu7.js → resolve-DYRousKD.js} +2 -2
- package/dist/assets/{resolve-B63_uSu7.js.map → resolve-DYRousKD.js.map} +1 -1
- package/dist/assets/{server-Cd1dLOB8.js → server-VMriom5-.js} +12 -12
- package/dist/assets/{server-Cd1dLOB8.js.map → server-VMriom5-.js.map} +1 -1
- package/dist/assets/{src-DzXL-GYu.js → src-D7v4sfDf.js} +6 -1
- package/dist/assets/{src-DzXL-GYu.js.map → src-D7v4sfDf.js.map} +1 -1
- package/dist/assets/{turnRefs-BCtM10d3.js → turnRefs-BvHvaNjv.js} +2 -2
- package/dist/assets/{turnRefs-BCtM10d3.js.map → turnRefs-BvHvaNjv.js.map} +1 -1
- package/dist/assets/{usdt-B7JWDhQV.js → usdt-06Ou18lB.js} +3 -3
- package/dist/assets/{usdt-B7JWDhQV.js.map → usdt-06Ou18lB.js.map} +1 -1
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/api-JMkEO0RR.js.map +0 -1
- package/dist/assets/buttons-_GBlxAti.js +0 -2
- package/dist/assets/host-Drd-c4VO.js.map +0 -1
- package/dist/assets/hyperdhtRelay-13aQ4KOf.js.map +0 -1
- package/dist/assets/main-BWAwKY4f.js.map +0 -1
package/README.md
CHANGED
|
@@ -127,7 +127,7 @@ The rows are in alphabetical order of their first command, and every command of
|
|
|
127
127
|
| `file list <chat\|group>`, `file accept\|decline\|pause\|resume\|cancel [<chat>] <file>` | Transfers; a file over 25 MiB waits for `file accept` (files/3), and so does a group's file that did not come by itself (over 8 MiB). A file's id names its chat or its group, so `<chat>` may be left out |
|
|
128
128
|
| `file resend [<chat>] <file>`, `file request [<chat>] <file>` | A file that stopped moving: sent again from here, or asked for again from the contact (a group's file: from whoever holds it); either goes on from the bytes the receiver holds (files/3) |
|
|
129
129
|
| `file save [<chat>] <file> [--dir d \| --path p] [--force] [--wait [--timeout s]]` | Write a received file to disk: to `--path`, or into `--dir` under the name its sender gave it, with a `_` first when that name starts with `-`, so no tool run in the folder takes it for an option (the answer's `path` is what was written). Never over a file without `--force`; an unfinished one says how many bytes are here; `--wait` waits for it first |
|
|
130
|
-
| `file send <chat\|group> <path> [--name n] [--mime t] [--voice [ms] [--peaks …]] [--reply <message>]` | A file, or a voice note (its length and waveform measured from the file unless given); `--reply` quotes a message, as `send --reply` does. To a group (`group:<id>` when a chat has the same name), up to 100 MiB: every member sees it at once and each member's app fetches it from a member who has it (WISP 503) |
|
|
130
|
+
| `file send <chat\|group> <path> [--name n] [--mime t] [--voice [ms] [--peaks …]] [--reply <message>]` | A file, or a voice note (its length and waveform measured from the file unless given); `--reply` quotes a message, as `send --reply` does. Answers the message's `messageId` (what `message delete`, `react` and `pin` take) and the file's id. To a group (`group:<id>` when a chat has the same name), up to 100 MiB: every member sees it at once and each member's app fetches it from a member who has it (WISP 503) |
|
|
131
131
|
| `file wait [<chat>] <file> [--timeout s]` | Wait until a transfer ends: exit `0` when the file is all here, `1` with the transfer's error when it failed (`details.retry`: `file resend` can go on), `4` on timeout (default 300 s) |
|
|
132
132
|
| `forward <chat\|group> <message>… --to <chat\|group>… [--force] [--wait none\|sent] [--timeout s]` | Forward messages to up to 5 chats and groups (`--to` again for each; `group:<id>` names a group when a chat has the same name; an id that starts with a dash is taken as it is, `--to -Ab…` or `--to=-Ab…`). Each is a new message of yours that says it was forwarded (`forwarded`, the hop count) and nothing of who wrote it. Files go from the bytes this profile holds, never fetched again; a group takes texts only. A text that looks like a seed, a key or ecash needs `--force`. Answers `{from, results: [{to, kind, messageIds, error}]}`; any refusal fails the command (exit 1) with the results in `details`. `--wait sent`: each text on its way (a group's taken by an edge), each file's transfer done |
|
|
133
133
|
| `group create <name> [--mesh]`, `group join [<link> \| -]` | A community (a link anyone can open), or a private mesh. `group join` reads the link from stdin when none is given or `-` (on the command line it shows in `ps` and the shell's history, and the CLI warns). `group join` with the link of a community the profile was removed from asks to be let in again, and keeps its history |
|
|
@@ -314,7 +314,10 @@ chat (`chat list`, `chat show`, `chat rename`, …) and `engine getState` print
|
|
|
314
314
|
the journal, so `--since` does not replay them, and each carries the `seq` of the event before it), `events.gap` (the journal no longer holds what `--since` asked for).
|
|
315
315
|
- A message that answers another carries `replyTo`: `{id, snippet, from, member?, found}`. `id` is the original's
|
|
316
316
|
message id in this chat when it is here (`found: true`, and `snippet` and `from` come from that copy), else the id
|
|
317
|
-
the reply named; `from` is `me`, `peer` or null (only the id came, over the DHT).
|
|
317
|
+
the reply named; `from` is `me`, `peer` or null (only the id came, over the DHT). An original that was here and is
|
|
318
|
+
gone (deleted on this device, or for everyone by its author) is `found: false, deleted: true`, with an empty
|
|
319
|
+
`snippet`, as the apps show "Original message deleted": in history, and in the reply's events that `--since`
|
|
320
|
+
replays (the event journal keeps no text of a deleted message). Answer one with
|
|
318
321
|
`ghostly send <chat> --reply <message id> "…"` (`group send` too): the id from history or from the event.
|
|
319
322
|
- Reactions (WISP 400 § Reactions): `message.reaction` (a chat) and `group.reaction` (a group) say each change once:
|
|
320
323
|
`{messageId, by, emoji, removed, mine}`, with `by` `me`, `peer` or a member key, `emoji` "" when taken back, `mine`
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { $l as randomBytes$1, Ac as isAppRef, Ba as appCardId, Bi as identityStatement, Ec as appRef, Ha as cardLine, Ic as readImageMeta, Jl as sanitizeAvatar, Mr as TYPING_REFRESH_MS, Pr as sanitizeTypingStatus, Qc as ownInviteRefusal, Qr as APP_DATA_MAX_BYTES, Un as GROUP_FILE_LIMITS, Wa as checkStatusCard, Xc as inviteLink, Y as groupName, aa as sanitizeMime, ca as baseMime, da as voicePeaksOf, eu as toBase64Url, ho as GhostlyHttpError, ia as sanitizeFileName, jr as TYPING_KINDS, lo as AWAITING_PEER_MS, oa as PLAYABLE_AUDIO, pc as APP_PERMISSIONS, ql as MAX_AVATAR_LENGTH, sa as VOICE_LIMITS, ua as parseVoiceMeta, vc as isAppUrl, yo as LIMITS, za as STATUS_CARD_LIMITS } from "./src-
|
|
1
|
+
import { $l as randomBytes$1, Ac as isAppRef, Ba as appCardId, Bi as identityStatement, Ec as appRef, Ha as cardLine, Ic as readImageMeta, Jl as sanitizeAvatar, Mr as TYPING_REFRESH_MS, Pr as sanitizeTypingStatus, Qc as ownInviteRefusal, Qr as APP_DATA_MAX_BYTES, Un as GROUP_FILE_LIMITS, Wa as checkStatusCard, Xc as inviteLink, Y as groupName, aa as sanitizeMime, ca as baseMime, da as voicePeaksOf, eu as toBase64Url, ho as GhostlyHttpError, ia as sanitizeFileName, jr as TYPING_KINDS, lo as AWAITING_PEER_MS, oa as PLAYABLE_AUDIO, pc as APP_PERMISSIONS, ql as MAX_AVATAR_LENGTH, sa as VOICE_LIMITS, ua as parseVoiceMeta, vc as isAppUrl, yo as LIMITS, za as STATUS_CARD_LIMITS } from "./src-D7v4sfDf.js";
|
|
2
2
|
import { l as fileStore } from "./idb-CMVgtn2k.js";
|
|
3
|
-
import { O as waitingGroupFile, T as removeStored, U as iceServerProblem, W as iceServerSetting, i as groupOfFile, l as replyRef, n as groupFileId, v as paymentNetwork } from "./groupFiles-
|
|
3
|
+
import { O as waitingGroupFile, T as removeStored, U as iceServerProblem, W as iceServerSetting, i as groupOfFile, l as replyRef, n as groupFileId, v as paymentNetwork } from "./groupFiles-BWlfYs84.js";
|
|
4
4
|
import { f as FILE_BYTES_STEP, o as fileBytes, s as fileBytesOf } from "./fileBytes-B-fqGdEd.js";
|
|
5
|
-
import { t as IDENTITY_PROVIDERS } from "./registry-
|
|
6
|
-
import { a as waitForEdit, c as findSecret, i as pressable, n as buttonsCard, o as waitForGroupFrame, s as waitForMessage, t as BUTTON_METHODS } from "./buttons-
|
|
7
|
-
import { a as ENGINE_PARAMS, i as ENGINE_METHODS, l as engineParamsProblem, n as withStoredIds, o as ENGINE_READS, r as DESTRUCTIVE_CALLS, s as READ_PARAMS } from "./turnRefs-
|
|
5
|
+
import { t as IDENTITY_PROVIDERS } from "./registry-KPRUnCeJ.js";
|
|
6
|
+
import { a as waitForEdit, c as findSecret, i as pressable, n as buttonsCard, o as waitForGroupFrame, s as waitForMessage, t as BUTTON_METHODS } from "./buttons-BRkpVMtD.js";
|
|
7
|
+
import { a as ENGINE_PARAMS, i as ENGINE_METHODS, l as engineParamsProblem, n as withStoredIds, o as ENGINE_READS, r as DESTRUCTIVE_CALLS, s as READ_PARAMS } from "./turnRefs-BvHvaNjv.js";
|
|
8
8
|
import { i as localFileError, r as asCliError, t as CliError } from "./errors-BLSPp0tK.js";
|
|
9
|
-
import { _ as str, a as findChat, c as groupOf, d as messageOf, f as node, g as state, h as sentAt, i as chatOrGroup, l as inviteTaken, m as oneOf, n as bool, o as findChatOrGroup, p as num, r as chatOf, s as findGroup, u as list, v as waitForState } from "./apiKit-
|
|
9
|
+
import { _ as str, a as findChat, c as groupOf, d as messageOf, f as node, g as state, h as sentAt, i as chatOrGroup, l as inviteTaken, m as oneOf, n as bool, o as findChatOrGroup, p as num, r as chatOf, s as findGroup, u as list, v as waitForState } from "./apiKit-qLBXqv02.js";
|
|
10
10
|
import { a as checkShownName } from "./profiles-DSxPYdlU.js";
|
|
11
|
-
import { t as BACKUP_METHODS } from "./backup-
|
|
12
|
-
import { o as checkedBundle } from "./apps-
|
|
11
|
+
import { t as BACKUP_METHODS } from "./backup-DhO7RbYO.js";
|
|
12
|
+
import { o as checkedBundle } from "./apps-0XIzvlZk.js";
|
|
13
13
|
import { generateMnemonic } from "@scure/bip39";
|
|
14
14
|
import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
15
15
|
import { openAsBlob, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
16
16
|
import { access, constants as constants$1, open, readFile, rm, stat } from "node:fs/promises";
|
|
17
|
-
import { basename, extname, join, resolve } from "node:path";
|
|
17
|
+
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
18
18
|
import { spawn } from "node:child_process";
|
|
19
19
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
20
20
|
import { createServer } from "node:http";
|
|
@@ -747,6 +747,7 @@ var FILE_METHODS = {
|
|
|
747
747
|
}
|
|
748
748
|
return {
|
|
749
749
|
chat: link.id,
|
|
750
|
+
messageId: `me_${timestamp}`,
|
|
750
751
|
file: {
|
|
751
752
|
id: file.id,
|
|
752
753
|
name: file.name,
|
|
@@ -892,6 +893,11 @@ var FILE_METHODS = {
|
|
|
892
893
|
const code = error.code;
|
|
893
894
|
if ((code === "EEXIST" || code === "EISDIR") && (await stat(target).catch(() => void 0))?.isDirectory()) throw new CliError("bad_request", `${target} is a folder: name a file, or use dir (--dir ${target})`);
|
|
894
895
|
if (code === "EEXIST") throw new CliError("confirm", `${target} exists: pass force (--force) to replace it`);
|
|
896
|
+
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
897
|
+
const folder = dirname(target), there = await stat(folder).catch(() => void 0);
|
|
898
|
+
if (!there) throw new CliError("not_found", `No such file or folder: ${folder}`);
|
|
899
|
+
if (!there.isDirectory()) throw new CliError("not_found", `${folder} is a file, not a folder`);
|
|
900
|
+
}
|
|
895
901
|
throw error;
|
|
896
902
|
}
|
|
897
903
|
let written = 0, complete = false;
|
|
@@ -4299,7 +4305,14 @@ function editRefused(message, ref, where, error, refused) {
|
|
|
4299
4305
|
* before `before`), so a long chat's is as quick as a short one's; with `after` the whole history is read and cut.
|
|
4300
4306
|
*/
|
|
4301
4307
|
async function historyOf(ctx, chat, params, json = messageJson) {
|
|
4302
|
-
if (params.after !== void 0 && params.after !== null)
|
|
4308
|
+
if (params.after !== void 0 && params.after !== null) {
|
|
4309
|
+
const whole = await node(ctx).getMessages(chat), { messages, more } = history(whole, params);
|
|
4310
|
+
const gone = await originalsGone(ctx, chat, messages, whole);
|
|
4311
|
+
return {
|
|
4312
|
+
messages: messages.map((m) => quoteChecked(json(m), m, gone)),
|
|
4313
|
+
more
|
|
4314
|
+
};
|
|
4315
|
+
}
|
|
4303
4316
|
const limit = num(params, "limit", 50, {
|
|
4304
4317
|
min: 1,
|
|
4305
4318
|
max: 1e4,
|
|
@@ -4314,12 +4327,44 @@ async function historyOf(ctx, chat, params, json = messageJson) {
|
|
|
4314
4327
|
}).catch((error) => {
|
|
4315
4328
|
throw error instanceof Error && error.message === `No message ${before}` ? new CliError("not_found", error.message) : error;
|
|
4316
4329
|
});
|
|
4330
|
+
const gone = await originalsGone(ctx, chat, page.messages);
|
|
4317
4331
|
return {
|
|
4318
|
-
messages: page.messages.map((m) => json(m)),
|
|
4332
|
+
messages: page.messages.map((m) => quoteChecked(json(m), m, gone)),
|
|
4319
4333
|
more: page.more
|
|
4320
4334
|
};
|
|
4321
4335
|
}
|
|
4322
|
-
|
|
4336
|
+
/** Past this many originals outside a page, its history is read once instead of row by row. */
|
|
4337
|
+
var ORIGINAL_READS = 32;
|
|
4338
|
+
/**
|
|
4339
|
+
* The originals a page's replies found here when they came that are gone now: deleted on this device, or for everyone
|
|
4340
|
+
* by their author (WISP 400 § Delete for everyone). Each is looked for in the page, else read as its one row, one at
|
|
4341
|
+
* a time (a burst of reads stalls fake-indexeddb's scheduler); `whole` is the chat's whole history when it was read
|
|
4342
|
+
* already. Before, such a reply still said `found`, with the original's text.
|
|
4343
|
+
*/
|
|
4344
|
+
async function originalsGone(ctx, chat, page, whole = page) {
|
|
4345
|
+
const here = new Set(whole.map((m) => m.id));
|
|
4346
|
+
const asked = [...new Set(page.flatMap((m) => m.replyTo?.messageId && !here.has(m.replyTo.messageId) ? [m.replyTo.messageId] : []))];
|
|
4347
|
+
if (whole !== page) return new Set(asked);
|
|
4348
|
+
if (asked.length > ORIGINAL_READS) return originalsGone(ctx, chat, page, await node(ctx).getMessages(chat));
|
|
4349
|
+
const gone = /* @__PURE__ */ new Set();
|
|
4350
|
+
for (const id of asked) if (!await node(ctx).getMessage(chat, id)) gone.add(id);
|
|
4351
|
+
return gone;
|
|
4352
|
+
}
|
|
4353
|
+
/** A reply whose original is gone, as the apps show it ("Original message deleted"): not found, and none of its text. */
|
|
4354
|
+
function quoteChecked(json, message, gone) {
|
|
4355
|
+
const id = message.replyTo?.messageId;
|
|
4356
|
+
if (!json.replyTo || !id || !gone.has(id)) return json;
|
|
4357
|
+
return {
|
|
4358
|
+
...json,
|
|
4359
|
+
replyTo: {
|
|
4360
|
+
...json.replyTo,
|
|
4361
|
+
snippet: "",
|
|
4362
|
+
found: false,
|
|
4363
|
+
deleted: true
|
|
4364
|
+
}
|
|
4365
|
+
};
|
|
4366
|
+
}
|
|
4367
|
+
function history(messages, params) {
|
|
4323
4368
|
const limit = num(params, "limit", 50, {
|
|
4324
4369
|
min: 1,
|
|
4325
4370
|
max: 1e4,
|
|
@@ -4340,7 +4385,7 @@ function history(messages, params, json = messageJson) {
|
|
|
4340
4385
|
const list = sorted.filter((m, at) => bounds.every((within) => within(m, at)));
|
|
4341
4386
|
const more = after !== void 0 && after !== null ? list.length > limit : list.length > limit;
|
|
4342
4387
|
return {
|
|
4343
|
-
messages:
|
|
4388
|
+
messages: after !== void 0 && after !== null ? list.slice(0, limit) : list.slice(-limit),
|
|
4344
4389
|
more
|
|
4345
4390
|
};
|
|
4346
4391
|
}
|
|
@@ -4355,4 +4400,4 @@ async function callApi(ctx, method, params = {}) {
|
|
|
4355
4400
|
//#endregion
|
|
4356
4401
|
export { flushCardUpdates as _, hideStateSecrets as a, paymentJson as c, nodeLocalFetch as d, chatJson as f, resumeHolds as g, groupMessageJson as h, groupSendRefused as i, reportAppFrames as l, groupJson as m, SETTABLE as n, mentionsFor as o, chatMessageJson as p, callApi as r, redactSettings as s, API_METHODS as t, servedApps as u };
|
|
4357
4402
|
|
|
4358
|
-
//# sourceMappingURL=api-
|
|
4403
|
+
//# sourceMappingURL=api-PWMQJGFi.js.map
|