@ghostlytools/cli 1.7.1 → 1.7.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.
- package/README.md +27 -16
- package/SKILL.md +5 -1
- package/dist/assets/{api-CJM3R93b.js → api-B42F9ytB.js} +2 -2
- package/dist/assets/{api-CD9JbPuA.js → api-tf-wAAnB.js} +249 -100
- package/dist/assets/api-tf-wAAnB.js.map +1 -0
- package/dist/assets/{apiKit-BmnROpCN.js → apiKit-DJb9hulp.js} +34 -5
- package/dist/assets/{apiKit-BmnROpCN.js.map → apiKit-DJb9hulp.js.map} +1 -1
- package/dist/assets/{apps-CJ2dvKSz.js → apps-BfoDISRg.js} +1 -1
- package/dist/assets/{apps-DVA60Tg6.js → apps-DIrWmLgL.js} +6 -6
- package/dist/assets/{apps-DVA60Tg6.js.map → apps-DIrWmLgL.js.map} +1 -1
- package/dist/assets/{arkade-CHqwEHFd.js → arkade-CJAhhgPQ.js} +2 -2
- package/dist/assets/{arkade-CHqwEHFd.js.map → arkade-CJAhhgPQ.js.map} +1 -1
- package/dist/assets/{backup-C4CbTEcj.js → backup-BkUeeduy.js} +1 -1
- package/dist/assets/{backup-B4dSNvzb.js → backup-Bko-AAm0.js} +6 -6
- package/dist/assets/{backup-B4dSNvzb.js.map → backup-Bko-AAm0.js.map} +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-Be7u0V5g.js +2 -0
- package/dist/assets/{buttons-C13rK2mH.js → buttons-DeA6Yddq.js} +43 -12
- package/dist/assets/buttons-DeA6Yddq.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-Cz5fc7BM.js} +2 -2
- package/dist/assets/{envelope-4TXDx3vD.js.map → envelope-Cz5fc7BM.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-BlZRBWpt.js} +558 -4
- package/dist/assets/groupFiles-BlZRBWpt.js.map +1 -0
- package/dist/assets/{host-CVeNtA2_.js → host-BX0DmKW6.js} +41 -18
- package/dist/assets/host-BX0DmKW6.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-CI2ISE-g.js → hyperdhtRelay-DitYDnXx.js} +2 -2
- package/dist/assets/{hyperdhtRelay-CI2ISE-g.js.map → hyperdhtRelay-DitYDnXx.js.map} +1 -1
- package/dist/assets/{irohWeb-DcRJdhce.js → irohWeb-R3bcd34h.js} +2 -2
- package/dist/assets/{irohWeb-DcRJdhce.js.map → irohWeb-R3bcd34h.js.map} +1 -1
- package/dist/assets/{main-CjO0KGiF.js → main-6QOSvQ8b.js} +297 -127
- package/dist/assets/main-6QOSvQ8b.js.map +1 -0
- package/dist/assets/{mainline-WM-WItCV.js → mainline-BfwezHWi.js} +2 -2
- package/dist/assets/{mainline-WM-WItCV.js.map → mainline-BfwezHWi.js.map} +1 -1
- package/dist/assets/{networkReason-380j5yMs.js → networkReason-Ba9415nn.js} +2 -2
- package/dist/assets/{networkReason-380j5yMs.js.map → networkReason-Ba9415nn.js.map} +1 -1
- package/dist/assets/{nwc-D5dkC1xg.js → nwc-ovXSN2M2.js} +3 -3
- package/dist/assets/{nwc-D5dkC1xg.js.map → nwc-ovXSN2M2.js.map} +1 -1
- package/dist/assets/{nwcProvider-p_rMwtDv.js → nwcProvider-BzZbfFP3.js} +2 -2
- package/dist/assets/{nwcProvider-p_rMwtDv.js.map → nwcProvider-BzZbfFP3.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-B0Uv9yL6.js} +3 -3
- package/dist/assets/{registry-BfNcA6kF.js.map → registry-B0Uv9yL6.js.map} +1 -1
- package/dist/assets/{registry-BKffx4ZU.js → registry-CFtlhWCI.js} +1 -1
- package/dist/assets/{resolve-hUsgRkmm.js → resolve-BzFG4WDU.js} +2 -2
- package/dist/assets/{resolve-hUsgRkmm.js.map → resolve-BzFG4WDU.js.map} +1 -1
- package/dist/assets/{server-C3tJZFnv.js → server-BGCuHbmQ.js} +504 -673
- package/dist/assets/server-BGCuHbmQ.js.map +1 -0
- package/dist/assets/{src-BMHgbkli.js → src-DWw2hUE5.js} +193 -60
- package/dist/assets/src-DWw2hUE5.js.map +1 -0
- package/dist/assets/{translate-DJUutSis.js → translate-DObb-1tq.js} +11 -11
- package/dist/assets/{translate-DJUutSis.js.map → translate-DObb-1tq.js.map} +1 -1
- package/dist/assets/{usdt-glkUxsDe.js → usdt-Bkva90Vo.js} +3 -3
- package/dist/assets/{usdt-glkUxsDe.js.map → usdt-Bkva90Vo.js.map} +1 -1
- package/dist/assets/{words-DyW9b27T.js → words-odSAoasK.js} +4 -2
- package/dist/assets/words-odSAoasK.js.map +1 -0
- 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/host-CVeNtA2_.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
- package/dist/assets/words-DyW9b27T.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Bo as
|
|
2
|
-
import { a as fedimintSdkOn, r as irohRelayProblem } from "./irohWeb-
|
|
3
|
-
import { r as asCliError, t as CliError } from "./errors-
|
|
4
|
-
import {
|
|
5
|
-
import { _ as flushCardUpdates, c as paymentJson, d as nodeLocalFetch, f as chatJson, g as resumeHolds, h as groupMessageJson, l as reportAppFrames, m as groupJson, p as chatMessageJson, r as callApi, u as servedApps } from "./api-
|
|
6
|
-
import { g as ownFolder, n as RESTORED_MARK, r as acquireLock, v as privateFolder, y as runtimePath } from "./profiles-
|
|
7
|
-
import { _ as isCallRate, f as DEFAULT_RATE, g as frameSamples, h as frameBytes, i as newDaemonSecret, m as bytesToMs, o as proof, p as PlaybackQueue, r as greeting, u as removeDaemonSecret } from "./daemonProof-
|
|
1
|
+
import { Bo as callRtcConfig, Go as signalHasVideo, Io as CALL_SIGNAL_MAX_AGE_MS, Lo as RTC_CONFIG, Ql as setLinkTraceSink, Qr as checkPushEndpoint, Ro as answersOffer, Uo as extractParamsFromSdp, Vo as callSignalHeardAt, Wo as parseCallSignal, vu as fromBase64Url, wi as isPublicAddress, zo as buildSdpFromSignal } from "./src-DWw2hUE5.js";
|
|
2
|
+
import { a as fedimintSdkOn, r as irohRelayProblem } from "./irohWeb-R3bcd34h.js";
|
|
3
|
+
import { r as asCliError, t as CliError } from "./errors-mnjSQlbX.js";
|
|
4
|
+
import { l as findOwnNamedChat, o as findChat } from "./apiKit-DJb9hulp.js";
|
|
5
|
+
import { _ as flushCardUpdates, c as paymentJson, d as nodeLocalFetch, f as chatJson, g as resumeHolds, h as groupMessageJson, l as reportAppFrames, m as groupJson, p as chatMessageJson, r as callApi, u as servedApps } from "./api-tf-wAAnB.js";
|
|
6
|
+
import { g as ownFolder, n as RESTORED_MARK, r as acquireLock, v as privateFolder, y as runtimePath } from "./profiles-C6XWqre5.js";
|
|
7
|
+
import { _ as isCallRate, f as DEFAULT_RATE, g as frameSamples, h as frameBytes, i as newDaemonSecret, m as bytesToMs, o as proof, p as PlaybackQueue, r as greeting, u as removeDaemonSecret } from "./daemonProof-Bp9lJDxf.js";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
9
|
import { appendFileSync, chmodSync, closeSync, existsSync, fstatSync, fsyncSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
|
|
10
10
|
import { readFile } from "node:fs/promises";
|
|
@@ -1496,7 +1496,7 @@ var CallManager = class {
|
|
|
1496
1496
|
}
|
|
1497
1497
|
}
|
|
1498
1498
|
async stack() {
|
|
1499
|
-
if (this.host.answers === false) throw new CliError("unavailable",
|
|
1499
|
+
if (this.host.answers === false) throw new CliError("unavailable", CALLS_NEED_DAEMON);
|
|
1500
1500
|
const stack = await (this.host.stack ?? loadCallStack)();
|
|
1501
1501
|
if (typeof stack === "string") throw new CliError("unavailable", stack);
|
|
1502
1502
|
return stack;
|
|
@@ -1559,6 +1559,7 @@ var CallManager = class {
|
|
|
1559
1559
|
/** The chat, if a call can go in it now; else why not (the engine's reason). */
|
|
1560
1560
|
callable(ref) {
|
|
1561
1561
|
const link = this.link(this.chatId(ref));
|
|
1562
|
+
if (this.host.answers === false) throw new CliError("unavailable", CALLS_NEED_DAEMON);
|
|
1562
1563
|
if (!link.profile) throw new CliError("unavailable", "Calls are in chats made since 0.4 (the chat session): this is a compatibility chat");
|
|
1563
1564
|
if (link.callsUnavailable) throw new CliError("unavailable", link.callsUnavailable);
|
|
1564
1565
|
return link;
|
|
@@ -1567,6 +1568,7 @@ var CallManager = class {
|
|
|
1567
1568
|
return this.auto.on && (this.auto.from.length === 0 || this.auto.from.includes(chat));
|
|
1568
1569
|
}
|
|
1569
1570
|
};
|
|
1571
|
+
var CALLS_NEED_DAEMON = "Calls need the daemon (a call outlives this command): start it with `ghostly daemon --detach`";
|
|
1570
1572
|
function nameOf(link) {
|
|
1571
1573
|
return link.label?.trim() || link.peerNick?.trim() || null;
|
|
1572
1574
|
}
|
|
@@ -3441,6 +3443,14 @@ var ON_DISK = /* @__PURE__ */ new Set(["messages", "fileState"]);
|
|
|
3441
3443
|
var COMPACT_BYTES = 33554432;
|
|
3442
3444
|
/** A journal up to this is kept at close and at start: replaying it costs less than writing the snapshot again. */
|
|
3443
3445
|
var KEEP_BYTES = 1048576;
|
|
3446
|
+
/** The stores whose rows a delete means gone from the disk: the chats (their seed, their ratchet) and their messages. */
|
|
3447
|
+
var FORGOTTEN = /* @__PURE__ */ new Set(["links", "messages"]);
|
|
3448
|
+
/**
|
|
3449
|
+
* How long what a delete of a chat or a message took may stay in the journal while the store is in use, so a profile
|
|
3450
|
+
* folder copied later holds nothing older. Not at every close: writing the whole snapshot again costs a large profile a
|
|
3451
|
+
* second or more.
|
|
3452
|
+
*/
|
|
3453
|
+
var DELETE_FOLD_MS = 36e5;
|
|
3444
3454
|
/**
|
|
3445
3455
|
* The database a journal's close mark names. No profile has it, so a replay skips the mark (an older version's too:
|
|
3446
3456
|
* it skips an op whose store it does not find).
|
|
@@ -3491,9 +3501,12 @@ async function openPersistentIndexedDb(dir, options = {}) {
|
|
|
3491
3501
|
let unsaved = false;
|
|
3492
3502
|
/** Set while the journal holds relaxed entries no sync has covered yet. */
|
|
3493
3503
|
let relaxed = null;
|
|
3504
|
+
/** The journal holds a delete of a chat or a message, and what came before it with it. */
|
|
3505
|
+
let holdsDelete = false;
|
|
3494
3506
|
const pending = /* @__PURE__ */ new WeakMap();
|
|
3495
3507
|
const snapshotPath = join(dir, SNAPSHOT);
|
|
3496
3508
|
const journalPath = join(dir, JOURNAL);
|
|
3509
|
+
const deleteDue = () => holdsDelete && Date.now() - (statSync(snapshotPath, { throwIfNoEntry: false })?.mtimeMs ?? 0) >= DELETE_FOLD_MS;
|
|
3497
3510
|
const snapshotFound = existsSync(snapshotPath), journalFound = existsSync(journalPath);
|
|
3498
3511
|
const saved = snapshotFound ? deserialize(readFileSync(snapshotPath)) : null;
|
|
3499
3512
|
const rows = sqlite && saved?.format === 2 && rowsFound ? openRowFile(sqlite, rowsPath) : null;
|
|
@@ -3533,7 +3546,8 @@ async function openPersistentIndexedDb(dir, options = {}) {
|
|
|
3533
3546
|
}) : {
|
|
3534
3547
|
end: 0,
|
|
3535
3548
|
closed: !folded,
|
|
3536
|
-
seq: 0
|
|
3549
|
+
seq: 0,
|
|
3550
|
+
deletes: false
|
|
3537
3551
|
};
|
|
3538
3552
|
seq = Math.max(seq, replayed.seq);
|
|
3539
3553
|
if (trees) {
|
|
@@ -3550,7 +3564,8 @@ async function openPersistentIndexedDb(dir, options = {}) {
|
|
|
3550
3564
|
restoring = false;
|
|
3551
3565
|
/** Whether the journal on disk says the store is closed: nothing was written since its mark, or there is none. */
|
|
3552
3566
|
let marked = replayed.closed;
|
|
3553
|
-
|
|
3567
|
+
holdsDelete = replayed.deletes;
|
|
3568
|
+
const kept = !!journal && named !== void 0 && named === snapshotName && replayed.end === journal.length && journal.length <= KEEP_BYTES && !deleteDue();
|
|
3554
3569
|
const rewrite = journal && !kept || !snapshotFound || moved;
|
|
3555
3570
|
if (rewrite) await writeSnapshot();
|
|
3556
3571
|
rows?.close();
|
|
@@ -3660,6 +3675,7 @@ async function openPersistentIndexedDb(dir, options = {}) {
|
|
|
3660
3675
|
* and the transaction is to be refused, not completed.
|
|
3661
3676
|
*/
|
|
3662
3677
|
function append(ops, lazy, entry, owner) {
|
|
3678
|
+
holdsDelete ||= ops.some(deletes);
|
|
3663
3679
|
if (trees) ops = [{
|
|
3664
3680
|
db: SEQ,
|
|
3665
3681
|
store: "",
|
|
@@ -3808,7 +3824,7 @@ async function openPersistentIndexedDb(dir, options = {}) {
|
|
|
3808
3824
|
failed(error);
|
|
3809
3825
|
}
|
|
3810
3826
|
}, RELAXED_SYNC_MS).unref();
|
|
3811
|
-
if (statSync(journalPath).size > COMPACT_BYTES) enqueue(writeSnapshot);
|
|
3827
|
+
if (statSync(journalPath).size > COMPACT_BYTES || deleteDue()) enqueue(writeSnapshot);
|
|
3812
3828
|
return true;
|
|
3813
3829
|
}
|
|
3814
3830
|
function sync() {
|
|
@@ -3914,10 +3930,11 @@ async function openPersistentIndexedDb(dir, options = {}) {
|
|
|
3914
3930
|
}
|
|
3915
3931
|
rmSync(journalPath, { force: true });
|
|
3916
3932
|
marked = true;
|
|
3933
|
+
holdsDelete = false;
|
|
3917
3934
|
}
|
|
3918
3935
|
/** What `close` leaves: a short journal with the mark at its end, synced (its relaxed entries too), or a fresh snapshot. */
|
|
3919
3936
|
async function leave() {
|
|
3920
|
-
if (schemaDirty || unsaved || journalBytes() > KEEP_BYTES) return writeSnapshot();
|
|
3937
|
+
if (schemaDirty || unsaved || journalBytes() > KEEP_BYTES || deleteDue()) return writeSnapshot();
|
|
3921
3938
|
if (marked) return;
|
|
3922
3939
|
writeEntry(serialize([{
|
|
3923
3940
|
db: CLOSED,
|
|
@@ -4454,6 +4471,10 @@ function fill(store, sorted) {
|
|
|
4454
4471
|
store.records._numNodes = sorted.length;
|
|
4455
4472
|
store.records._numTombstones = 0;
|
|
4456
4473
|
}
|
|
4474
|
+
/** Whether an op takes a chat or a message away: a delete, or a clear of their store. */
|
|
4475
|
+
function deletes(op) {
|
|
4476
|
+
return op.kind !== "put" && FORGOTTEN.has(op.store);
|
|
4477
|
+
}
|
|
4457
4478
|
/**
|
|
4458
4479
|
* Replays whole entries; a torn last entry (the process died mid-write) was never acknowledged and is dropped.
|
|
4459
4480
|
*
|
|
@@ -4483,7 +4504,7 @@ function replay(databases, journal, cmp, trees) {
|
|
|
4483
4504
|
}
|
|
4484
4505
|
}
|
|
4485
4506
|
function replayEntries(databases, journal, touched, trees) {
|
|
4486
|
-
let offset = 0, closed = false, last = 0;
|
|
4507
|
+
let offset = 0, closed = false, last = 0, deleted = false;
|
|
4487
4508
|
while (offset + 4 <= journal.length) {
|
|
4488
4509
|
const length = journal.readUInt32BE(offset);
|
|
4489
4510
|
if (offset + 4 + length > journal.length) break;
|
|
@@ -4498,6 +4519,7 @@ function replayEntries(databases, journal, touched, trees) {
|
|
|
4498
4519
|
const marker = ops.find((op) => op.db === SEQ);
|
|
4499
4520
|
const entry = marker?.kind === "clear" ? marker.seq : void 0;
|
|
4500
4521
|
if (entry !== void 0) last = Math.max(last, entry);
|
|
4522
|
+
deleted ||= ops.some(deletes);
|
|
4501
4523
|
for (const op of ops) {
|
|
4502
4524
|
const store = databases.get(op.db)?.rawObjectStores.get(op.store);
|
|
4503
4525
|
if (!store) continue;
|
|
@@ -4519,7 +4541,8 @@ function replayEntries(databases, journal, touched, trees) {
|
|
|
4519
4541
|
return {
|
|
4520
4542
|
end: offset,
|
|
4521
4543
|
closed: closed && offset === journal.length,
|
|
4522
|
-
seq: last
|
|
4544
|
+
seq: last,
|
|
4545
|
+
deletes: deleted
|
|
4523
4546
|
};
|
|
4524
4547
|
}
|
|
4525
4548
|
/**
|
|
@@ -4825,12 +4848,12 @@ async function startRuntime(paths, options = {}) {
|
|
|
4825
4848
|
const [{ registerFileBytes }, { NodeFileBytes }] = await Promise.all([import("./fileBytes-OolN5cSY.js"), import("./fileBytes-_fd-2JRY.js")]);
|
|
4826
4849
|
registerFileBytes("native", async () => new NodeFileBytes(paths.files), true);
|
|
4827
4850
|
if (await (await import("./blobFiles-Bckz9fjp.js")).moveBlobFiles()) await store.compact();
|
|
4828
|
-
const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-
|
|
4829
|
-
const mainline = dht.off ? null : new (await (import("./mainline-
|
|
4851
|
+
const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-BGCuHbmQ.js"), import("./endpoint-BdaeBw2L.js")]);
|
|
4852
|
+
const mainline = dht.off ? null : new (await (import("./mainline-BfwezHWi.js"))).Mainline({
|
|
4830
4853
|
bootstrap: dht.bootstrap,
|
|
4831
4854
|
host: dht.host
|
|
4832
4855
|
});
|
|
4833
|
-
const transport = mainline || pinned ? new (await (import("./mainline-
|
|
4856
|
+
const transport = mainline || pinned ? new (await (import("./mainline-BfwezHWi.js"))).RelaysAndDht(mainline, pinned ? { relays: pinned } : {}, !!pinned) : null;
|
|
4834
4857
|
const apps = servedApps(paths.dir).length > 0;
|
|
4835
4858
|
const server = new EngineServer({
|
|
4836
4859
|
...transport ? { transport } : {},
|
|
@@ -5172,4 +5195,4 @@ function connection(ctx, socket, secret) {
|
|
|
5172
5195
|
//#endregion
|
|
5173
5196
|
export { BASELINE_NEWEST, MAX_LINE, MAX_UNREAD, keepServing, openHost, serve };
|
|
5174
5197
|
|
|
5175
|
-
//# sourceMappingURL=host-
|
|
5198
|
+
//# sourceMappingURL=host-BX0DmKW6.js.map
|