@ghostlytools/cli 1.7.2 → 1.7.4
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 +37 -24
- package/SKILL.md +10 -4
- package/dist/assets/{api-CcuCtc1H.js → api-Chhvpwok.js} +2 -2
- package/dist/assets/{api-tSZELCPQ.js → api-D3i2hwy0.js} +340 -155
- package/dist/assets/api-D3i2hwy0.js.map +1 -0
- package/dist/assets/{apiKit-BFk7GAk9.js → apiKit-BtsHrnoo.js} +60 -8
- package/dist/assets/apiKit-BtsHrnoo.js.map +1 -0
- package/dist/assets/{apps-D6THreq_.js → apps-BFJTqvAt.js} +1 -1
- package/dist/assets/{apps-C5Mi6x9Q.js → apps-BHl97rHs.js} +11 -9
- package/dist/assets/apps-BHl97rHs.js.map +1 -0
- package/dist/assets/{arkade-Cz0B9bJ0.js → arkade-BFE8KkEE.js} +2 -2
- package/dist/assets/{arkade-Cz0B9bJ0.js.map → arkade-BFE8KkEE.js.map} +1 -1
- package/dist/assets/{backup-A0hIa9GE.js → backup-Bbsr6nDi.js} +1 -1
- package/dist/assets/{backup-Wb2sm2dd.js → backup-CxACdtQX.js} +7 -7
- package/dist/assets/{backup-Wb2sm2dd.js.map → backup-CxACdtQX.js.map} +1 -1
- package/dist/assets/{blobFiles-Bckz9fjp.js → blobFiles-DOQDRdDI.js} +3 -3
- package/dist/assets/{blobFiles-Bckz9fjp.js.map → blobFiles-DOQDRdDI.js.map} +1 -1
- package/dist/assets/{buttons-Cf70NVYq.js → buttons-CieBtXEO.js} +35 -9
- package/dist/assets/buttons-CieBtXEO.js.map +1 -0
- package/dist/assets/buttons-YtAj3R_E.js +2 -0
- package/dist/assets/{daemonProof-Bp9lJDxf.js → daemonProof-QmtwDj-N.js} +2 -2
- package/dist/assets/{daemonProof-Bp9lJDxf.js.map → daemonProof-QmtwDj-N.js.map} +1 -1
- package/dist/assets/{envelope-kQ5kYjVE.js → envelope-DYiGwzq_.js} +2 -2
- package/dist/assets/{envelope-kQ5kYjVE.js.map → envelope-DYiGwzq_.js.map} +1 -1
- package/dist/assets/{errors-mnjSQlbX.js → errors-QUGP-jIF.js} +2 -2
- package/dist/assets/errors-QUGP-jIF.js.map +1 -0
- package/dist/assets/{fileBytes-OolN5cSY.js → fileBytes-BPDKufla.js} +1 -1
- package/dist/assets/{fileBytes-BD0v3rRG.js → fileBytes-DNgrRL0R.js} +3 -3
- package/dist/assets/{fileBytes-BD0v3rRG.js.map → fileBytes-DNgrRL0R.js.map} +1 -1
- package/dist/assets/{fileBytes-_fd-2JRY.js → fileBytes-Q3ehcEr8.js} +2 -2
- package/dist/assets/{fileBytes-_fd-2JRY.js.map → fileBytes-Q3ehcEr8.js.map} +1 -1
- package/dist/assets/fileBytesIdb-DZcESfTt.js +2 -0
- package/dist/assets/{fileBytesIdb-NtA8r9EM.js → fileBytesIdb-Dm1EyEbT.js} +3 -3
- package/dist/assets/{fileBytesIdb-NtA8r9EM.js.map → fileBytesIdb-Dm1EyEbT.js.map} +1 -1
- package/dist/assets/{fileBytesOpfs-B8fJwkwM.js → fileBytesOpfs-ZGD21c4Q.js} +3 -3
- package/dist/assets/{fileBytesOpfs-B8fJwkwM.js.map → fileBytesOpfs-ZGD21c4Q.js.map} +1 -1
- package/dist/assets/{groupFiles-D9Ttlm3M.js → groupFiles-CBJIEvCE.js} +572 -6
- package/dist/assets/groupFiles-CBJIEvCE.js.map +1 -0
- package/dist/assets/{host-DpypH-fR.js → host-Va-r_KJz.js} +84 -23
- package/dist/assets/host-Va-r_KJz.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-D1rj84v2.js → hyperdhtRelay-B2uK9tJv.js} +2 -2
- package/dist/assets/{hyperdhtRelay-D1rj84v2.js.map → hyperdhtRelay-B2uK9tJv.js.map} +1 -1
- package/dist/assets/{idb-BlH8-O3R.js → idb-BkOJES5_.js} +5 -3
- package/dist/assets/idb-BkOJES5_.js.map +1 -0
- package/dist/assets/{irohWeb-BTSlWgEX.js → irohWeb-DxeEgQ-W.js} +2 -2
- package/dist/assets/{irohWeb-BTSlWgEX.js.map → irohWeb-DxeEgQ-W.js.map} +1 -1
- package/dist/assets/{main-BwgoQZVu.js → main-BX4oPWCJ.js} +589 -192
- package/dist/assets/main-BX4oPWCJ.js.map +1 -0
- package/dist/assets/{mainline-B1urhbEZ.js → mainline-IfWQOB-J.js} +39 -12
- package/dist/assets/mainline-IfWQOB-J.js.map +1 -0
- package/dist/assets/{networkReason-D2Z0BdIj.js → networkReason-N2vAaoth.js} +3 -3
- package/dist/assets/{networkReason-D2Z0BdIj.js.map → networkReason-N2vAaoth.js.map} +1 -1
- package/dist/assets/{nwc-T2aUK6bi.js → nwc-CzyCtNK2.js} +3 -3
- package/dist/assets/{nwc-T2aUK6bi.js.map → nwc-CzyCtNK2.js.map} +1 -1
- package/dist/assets/{nwcProvider-Dz-ty_DE.js → nwcProvider-DjWmEn3j.js} +2 -2
- package/dist/assets/{nwcProvider-Dz-ty_DE.js.map → nwcProvider-DjWmEn3j.js.map} +1 -1
- package/dist/assets/{profiles-C6XWqre5.js → profiles-DcCeOi7J.js} +104 -10
- package/dist/assets/profiles-DcCeOi7J.js.map +1 -0
- package/dist/assets/{registry-BlSTJlbv.js → registry-BmS02J5h.js} +1 -1
- package/dist/assets/{registry-Bazitl0a.js → registry-CeW8XEQc.js} +45 -14
- package/dist/assets/registry-CeW8XEQc.js.map +1 -0
- package/dist/assets/{resolve-Bx1Eeg-w.js → resolve-BvHkAhDH.js} +66 -29
- package/dist/assets/resolve-BvHkAhDH.js.map +1 -0
- package/dist/assets/{restoredRows-Fv-MuY45.js → restoredRows-mTTp3XNs.js} +2 -2
- package/dist/assets/{restoredRows-Fv-MuY45.js.map → restoredRows-mTTp3XNs.js.map} +1 -1
- package/dist/assets/{server-CnPj9wWh.js → server-BUcJo4vz.js} +1033 -821
- package/dist/assets/server-BUcJo4vz.js.map +1 -0
- package/dist/assets/{src-BsznF3XG.js → src-BB5-5P3s.js} +645 -196
- package/dist/assets/src-BB5-5P3s.js.map +1 -0
- package/dist/assets/{translate-cDBotA-b.js → translate-2WyaRVCr.js} +11 -9
- package/dist/assets/translate-2WyaRVCr.js.map +1 -0
- package/dist/assets/{usdt-DxxLdG60.js → usdt-BLazHiaP.js} +3 -3
- package/dist/assets/{usdt-DxxLdG60.js.map → usdt-BLazHiaP.js.map} +1 -1
- package/dist/assets/{words-qH8gGtmc.js → words-BaumxjXe.js} +5 -3
- package/dist/assets/words-BaumxjXe.js.map +1 -0
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/api-tSZELCPQ.js.map +0 -1
- package/dist/assets/apiKit-BFk7GAk9.js.map +0 -1
- package/dist/assets/apps-C5Mi6x9Q.js.map +0 -1
- package/dist/assets/buttons-Bxxu3lSk.js +0 -2
- package/dist/assets/buttons-Cf70NVYq.js.map +0 -1
- package/dist/assets/errors-mnjSQlbX.js.map +0 -1
- package/dist/assets/fileBytesIdb-CsSQcSxD.js +0 -2
- package/dist/assets/groupFiles-D9Ttlm3M.js.map +0 -1
- package/dist/assets/host-DpypH-fR.js.map +0 -1
- package/dist/assets/idb-BlH8-O3R.js.map +0 -1
- package/dist/assets/main-BwgoQZVu.js.map +0 -1
- package/dist/assets/mainline-B1urhbEZ.js.map +0 -1
- package/dist/assets/profiles-C6XWqre5.js.map +0 -1
- package/dist/assets/registry-Bazitl0a.js.map +0 -1
- package/dist/assets/resolve-Bx1Eeg-w.js.map +0 -1
- package/dist/assets/server-CnPj9wWh.js.map +0 -1
- package/dist/assets/src-BsznF3XG.js.map +0 -1
- package/dist/assets/translate-cDBotA-b.js.map +0 -1
- package/dist/assets/words-qH8gGtmc.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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 { $r as checkPushEndpoint, Bo as RTC_CONFIG, Ho as buildSdpFromSignal, Jo as signalHasVideo, Ko as extractParamsFromSdp, Ti as isPublicAddress, Uo as callRtcConfig, Vo as answersOffer, Wo as callSignalHeardAt, qo as parseCallSignal, tu as setLinkTraceSink, xu as fromBase64Url, zo as CALL_SIGNAL_MAX_AGE_MS } from "./src-BB5-5P3s.js";
|
|
2
|
+
import { a as fedimintSdkOn, r as irohRelayProblem } from "./irohWeb-DxeEgQ-W.js";
|
|
3
|
+
import { r as asCliError, t as CliError } from "./errors-QUGP-jIF.js";
|
|
4
|
+
import { l as findOwnNamedChat, o as findChat } from "./apiKit-BtsHrnoo.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-D3i2hwy0.js";
|
|
6
|
+
import { b as privateFolder, g as startingPath, n as RESTORED_MARK, r as acquireLock, v as ownFolder, x as runtimePath } from "./profiles-DcCeOi7J.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-QmtwDj-N.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";
|
|
@@ -1262,10 +1262,30 @@ var CallManager = class {
|
|
|
1262
1262
|
from: next.on ? from : [],
|
|
1263
1263
|
rate: rateOf(next.rate, next.on ? this.auto.rate : DEFAULT_RATE)
|
|
1264
1264
|
};
|
|
1265
|
+
this.saveAuto();
|
|
1266
|
+
return this.getAuto();
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* A chat removed from this device leaves the chats auto-answer answers. The last one gone turns auto-answer off:
|
|
1270
|
+
* an empty list is "answer everyone", never what was asked for.
|
|
1271
|
+
*/
|
|
1272
|
+
forgetChat(chat) {
|
|
1273
|
+
if (!this.auto.from.includes(chat)) return;
|
|
1274
|
+
const from = this.auto.from.filter((c) => c !== chat);
|
|
1275
|
+
this.auto = from.length > 0 ? {
|
|
1276
|
+
...this.auto,
|
|
1277
|
+
from
|
|
1278
|
+
} : {
|
|
1279
|
+
on: false,
|
|
1280
|
+
from: [],
|
|
1281
|
+
rate: DEFAULT_RATE
|
|
1282
|
+
};
|
|
1283
|
+
this.saveAuto();
|
|
1284
|
+
}
|
|
1285
|
+
saveAuto() {
|
|
1265
1286
|
const tmp = `${this.configPath}.tmp`;
|
|
1266
1287
|
writeFileSync(tmp, JSON.stringify({ autoAnswer: this.auto }, null, 2) + "\n", { mode: 384 });
|
|
1267
1288
|
renameSync(tmp, this.configPath);
|
|
1268
|
-
return this.getAuto();
|
|
1269
1289
|
}
|
|
1270
1290
|
/** Before the engine stops: every call is hung up (the contact's app is told), its program gets EOF. */
|
|
1271
1291
|
async stopAll() {
|
|
@@ -1496,7 +1516,7 @@ var CallManager = class {
|
|
|
1496
1516
|
}
|
|
1497
1517
|
}
|
|
1498
1518
|
async stack() {
|
|
1499
|
-
if (this.host.answers === false) throw new CliError("unavailable",
|
|
1519
|
+
if (this.host.answers === false) throw new CliError("unavailable", CALLS_NEED_DAEMON);
|
|
1500
1520
|
const stack = await (this.host.stack ?? loadCallStack)();
|
|
1501
1521
|
if (typeof stack === "string") throw new CliError("unavailable", stack);
|
|
1502
1522
|
return stack;
|
|
@@ -1559,6 +1579,7 @@ var CallManager = class {
|
|
|
1559
1579
|
/** The chat, if a call can go in it now; else why not (the engine's reason). */
|
|
1560
1580
|
callable(ref) {
|
|
1561
1581
|
const link = this.link(this.chatId(ref));
|
|
1582
|
+
if (this.host.answers === false) throw new CliError("unavailable", CALLS_NEED_DAEMON);
|
|
1562
1583
|
if (!link.profile) throw new CliError("unavailable", "Calls are in chats made since 0.4 (the chat session): this is a compatibility chat");
|
|
1563
1584
|
if (link.callsUnavailable) throw new CliError("unavailable", link.callsUnavailable);
|
|
1564
1585
|
return link;
|
|
@@ -1567,6 +1588,7 @@ var CallManager = class {
|
|
|
1567
1588
|
return this.auto.on && (this.auto.from.length === 0 || this.auto.from.includes(chat));
|
|
1568
1589
|
}
|
|
1569
1590
|
};
|
|
1591
|
+
var CALLS_NEED_DAEMON = "Calls need the daemon (a call outlives this command): start it with `ghostly daemon --detach`";
|
|
1570
1592
|
function nameOf(link) {
|
|
1571
1593
|
return link.label?.trim() || link.peerNick?.trim() || null;
|
|
1572
1594
|
}
|
|
@@ -3441,6 +3463,14 @@ var ON_DISK = /* @__PURE__ */ new Set(["messages", "fileState"]);
|
|
|
3441
3463
|
var COMPACT_BYTES = 33554432;
|
|
3442
3464
|
/** A journal up to this is kept at close and at start: replaying it costs less than writing the snapshot again. */
|
|
3443
3465
|
var KEEP_BYTES = 1048576;
|
|
3466
|
+
/** The stores whose rows a delete means gone from the disk: the chats (their seed, their ratchet) and their messages. */
|
|
3467
|
+
var FORGOTTEN = /* @__PURE__ */ new Set(["links", "messages"]);
|
|
3468
|
+
/**
|
|
3469
|
+
* 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
|
|
3470
|
+
* folder copied later holds nothing older. Not at every close: writing the whole snapshot again costs a large profile a
|
|
3471
|
+
* second or more.
|
|
3472
|
+
*/
|
|
3473
|
+
var DELETE_FOLD_MS = 36e5;
|
|
3444
3474
|
/**
|
|
3445
3475
|
* The database a journal's close mark names. No profile has it, so a replay skips the mark (an older version's too:
|
|
3446
3476
|
* it skips an op whose store it does not find).
|
|
@@ -3491,9 +3521,12 @@ async function openPersistentIndexedDb(dir, options = {}) {
|
|
|
3491
3521
|
let unsaved = false;
|
|
3492
3522
|
/** Set while the journal holds relaxed entries no sync has covered yet. */
|
|
3493
3523
|
let relaxed = null;
|
|
3524
|
+
/** The journal holds a delete of a chat or a message, and what came before it with it. */
|
|
3525
|
+
let holdsDelete = false;
|
|
3494
3526
|
const pending = /* @__PURE__ */ new WeakMap();
|
|
3495
3527
|
const snapshotPath = join(dir, SNAPSHOT);
|
|
3496
3528
|
const journalPath = join(dir, JOURNAL);
|
|
3529
|
+
const deleteDue = () => holdsDelete && Date.now() - (statSync(snapshotPath, { throwIfNoEntry: false })?.mtimeMs ?? 0) >= DELETE_FOLD_MS;
|
|
3497
3530
|
const snapshotFound = existsSync(snapshotPath), journalFound = existsSync(journalPath);
|
|
3498
3531
|
const saved = snapshotFound ? deserialize(readFileSync(snapshotPath)) : null;
|
|
3499
3532
|
const rows = sqlite && saved?.format === 2 && rowsFound ? openRowFile(sqlite, rowsPath) : null;
|
|
@@ -3533,7 +3566,8 @@ async function openPersistentIndexedDb(dir, options = {}) {
|
|
|
3533
3566
|
}) : {
|
|
3534
3567
|
end: 0,
|
|
3535
3568
|
closed: !folded,
|
|
3536
|
-
seq: 0
|
|
3569
|
+
seq: 0,
|
|
3570
|
+
deletes: false
|
|
3537
3571
|
};
|
|
3538
3572
|
seq = Math.max(seq, replayed.seq);
|
|
3539
3573
|
if (trees) {
|
|
@@ -3550,7 +3584,8 @@ async function openPersistentIndexedDb(dir, options = {}) {
|
|
|
3550
3584
|
restoring = false;
|
|
3551
3585
|
/** Whether the journal on disk says the store is closed: nothing was written since its mark, or there is none. */
|
|
3552
3586
|
let marked = replayed.closed;
|
|
3553
|
-
|
|
3587
|
+
holdsDelete = replayed.deletes;
|
|
3588
|
+
const kept = !!journal && named !== void 0 && named === snapshotName && replayed.end === journal.length && journal.length <= KEEP_BYTES && !deleteDue();
|
|
3554
3589
|
const rewrite = journal && !kept || !snapshotFound || moved;
|
|
3555
3590
|
if (rewrite) await writeSnapshot();
|
|
3556
3591
|
rows?.close();
|
|
@@ -3660,6 +3695,7 @@ async function openPersistentIndexedDb(dir, options = {}) {
|
|
|
3660
3695
|
* and the transaction is to be refused, not completed.
|
|
3661
3696
|
*/
|
|
3662
3697
|
function append(ops, lazy, entry, owner) {
|
|
3698
|
+
holdsDelete ||= ops.some(deletes);
|
|
3663
3699
|
if (trees) ops = [{
|
|
3664
3700
|
db: SEQ,
|
|
3665
3701
|
store: "",
|
|
@@ -3808,7 +3844,7 @@ async function openPersistentIndexedDb(dir, options = {}) {
|
|
|
3808
3844
|
failed(error);
|
|
3809
3845
|
}
|
|
3810
3846
|
}, RELAXED_SYNC_MS).unref();
|
|
3811
|
-
if (statSync(journalPath).size > COMPACT_BYTES) enqueue(writeSnapshot);
|
|
3847
|
+
if (statSync(journalPath).size > COMPACT_BYTES || deleteDue()) enqueue(writeSnapshot);
|
|
3812
3848
|
return true;
|
|
3813
3849
|
}
|
|
3814
3850
|
function sync() {
|
|
@@ -3914,10 +3950,11 @@ async function openPersistentIndexedDb(dir, options = {}) {
|
|
|
3914
3950
|
}
|
|
3915
3951
|
rmSync(journalPath, { force: true });
|
|
3916
3952
|
marked = true;
|
|
3953
|
+
holdsDelete = false;
|
|
3917
3954
|
}
|
|
3918
3955
|
/** What `close` leaves: a short journal with the mark at its end, synced (its relaxed entries too), or a fresh snapshot. */
|
|
3919
3956
|
async function leave() {
|
|
3920
|
-
if (schemaDirty || unsaved || journalBytes() > KEEP_BYTES) return writeSnapshot();
|
|
3957
|
+
if (schemaDirty || unsaved || journalBytes() > KEEP_BYTES || deleteDue()) return writeSnapshot();
|
|
3921
3958
|
if (marked) return;
|
|
3922
3959
|
writeEntry(serialize([{
|
|
3923
3960
|
db: CLOSED,
|
|
@@ -4454,6 +4491,10 @@ function fill(store, sorted) {
|
|
|
4454
4491
|
store.records._numNodes = sorted.length;
|
|
4455
4492
|
store.records._numTombstones = 0;
|
|
4456
4493
|
}
|
|
4494
|
+
/** Whether an op takes a chat or a message away: a delete, or a clear of their store. */
|
|
4495
|
+
function deletes(op) {
|
|
4496
|
+
return op.kind !== "put" && FORGOTTEN.has(op.store);
|
|
4497
|
+
}
|
|
4457
4498
|
/**
|
|
4458
4499
|
* Replays whole entries; a torn last entry (the process died mid-write) was never acknowledged and is dropped.
|
|
4459
4500
|
*
|
|
@@ -4483,7 +4524,7 @@ function replay(databases, journal, cmp, trees) {
|
|
|
4483
4524
|
}
|
|
4484
4525
|
}
|
|
4485
4526
|
function replayEntries(databases, journal, touched, trees) {
|
|
4486
|
-
let offset = 0, closed = false, last = 0;
|
|
4527
|
+
let offset = 0, closed = false, last = 0, deleted = false;
|
|
4487
4528
|
while (offset + 4 <= journal.length) {
|
|
4488
4529
|
const length = journal.readUInt32BE(offset);
|
|
4489
4530
|
if (offset + 4 + length > journal.length) break;
|
|
@@ -4498,6 +4539,7 @@ function replayEntries(databases, journal, touched, trees) {
|
|
|
4498
4539
|
const marker = ops.find((op) => op.db === SEQ);
|
|
4499
4540
|
const entry = marker?.kind === "clear" ? marker.seq : void 0;
|
|
4500
4541
|
if (entry !== void 0) last = Math.max(last, entry);
|
|
4542
|
+
deleted ||= ops.some(deletes);
|
|
4501
4543
|
for (const op of ops) {
|
|
4502
4544
|
const store = databases.get(op.db)?.rawObjectStores.get(op.store);
|
|
4503
4545
|
if (!store) continue;
|
|
@@ -4519,7 +4561,8 @@ function replayEntries(databases, journal, touched, trees) {
|
|
|
4519
4561
|
return {
|
|
4520
4562
|
end: offset,
|
|
4521
4563
|
closed: closed && offset === journal.length,
|
|
4522
|
-
seq: last
|
|
4564
|
+
seq: last,
|
|
4565
|
+
deletes: deleted
|
|
4523
4566
|
};
|
|
4524
4567
|
}
|
|
4525
4568
|
/**
|
|
@@ -4803,7 +4846,7 @@ async function startRuntime(paths, options = {}) {
|
|
|
4803
4846
|
const restored = join(paths.dir, RESTORED_MARK);
|
|
4804
4847
|
if (existsSync(restored)) {
|
|
4805
4848
|
try {
|
|
4806
|
-
const rows = await import("./restoredRows-
|
|
4849
|
+
const rows = await import("./restoredRows-mTTp3XNs.js");
|
|
4807
4850
|
await rows.markRestoredWallet();
|
|
4808
4851
|
await rows.markLeftOutFiles(leftOutIn(restored));
|
|
4809
4852
|
await store.compact();
|
|
@@ -4822,15 +4865,15 @@ async function startRuntime(paths, options = {}) {
|
|
|
4822
4865
|
await installEventSource();
|
|
4823
4866
|
await preloadWalletModules();
|
|
4824
4867
|
(await import("./ghostly_iroh_web-CO0onry8.js")).initSync({ module: irohWasmBytes() });
|
|
4825
|
-
const [{ registerFileBytes }, { NodeFileBytes }] = await Promise.all([import("./fileBytes-
|
|
4868
|
+
const [{ registerFileBytes }, { NodeFileBytes }] = await Promise.all([import("./fileBytes-BPDKufla.js"), import("./fileBytes-Q3ehcEr8.js")]);
|
|
4826
4869
|
registerFileBytes("native", async () => new NodeFileBytes(paths.files), true);
|
|
4827
|
-
if (await (await import("./blobFiles-
|
|
4828
|
-
const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-
|
|
4829
|
-
const mainline = dht.off ? null : new (await (import("./mainline-
|
|
4870
|
+
if (await (await import("./blobFiles-DOQDRdDI.js")).moveBlobFiles()) await store.compact();
|
|
4871
|
+
const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-BUcJo4vz.js"), import("./endpoint-BdaeBw2L.js")]);
|
|
4872
|
+
const mainline = dht.off ? null : new (await (import("./mainline-IfWQOB-J.js"))).Mainline({
|
|
4830
4873
|
bootstrap: dht.bootstrap,
|
|
4831
4874
|
host: dht.host
|
|
4832
4875
|
});
|
|
4833
|
-
const transport = mainline || pinned ? new (await (import("./mainline-
|
|
4876
|
+
const transport = mainline || pinned ? new (await (import("./mainline-IfWQOB-J.js"))).RelaysAndDht(mainline, pinned ? { relays: pinned } : {}, !!pinned) : null;
|
|
4834
4877
|
const apps = servedApps(paths.dir).length > 0;
|
|
4835
4878
|
const server = new EngineServer({
|
|
4836
4879
|
...transport ? { transport } : {},
|
|
@@ -4898,7 +4941,12 @@ var BASELINE_NEWEST = 100;
|
|
|
4898
4941
|
* `deferGroups`: the groups' sessions would spend the relays' budget its message needs.
|
|
4899
4942
|
*/
|
|
4900
4943
|
async function openHost(paths, mode, version, options = {}) {
|
|
4901
|
-
const
|
|
4944
|
+
const locked = acquireLock(paths);
|
|
4945
|
+
const unmark = mode === "daemon" ? markStarting(paths) : () => {};
|
|
4946
|
+
const release = () => {
|
|
4947
|
+
unmark();
|
|
4948
|
+
locked();
|
|
4949
|
+
};
|
|
4902
4950
|
let runtime;
|
|
4903
4951
|
try {
|
|
4904
4952
|
runtime = await startRuntime(paths, mode === "daemon" ? {
|
|
@@ -4998,6 +5046,7 @@ async function serve(host) {
|
|
|
4998
5046
|
}
|
|
4999
5047
|
});
|
|
5000
5048
|
if (process.platform !== "win32") chmodSync(path, 384);
|
|
5049
|
+
unmarkStarting(ctx.runtime.paths);
|
|
5001
5050
|
let closing = null;
|
|
5002
5051
|
return {
|
|
5003
5052
|
server,
|
|
@@ -5011,6 +5060,18 @@ async function serve(host) {
|
|
|
5011
5060
|
})
|
|
5012
5061
|
};
|
|
5013
5062
|
}
|
|
5063
|
+
/** Writes the daemon's start mark (`startingDaemon`); the function it returns removes it. A mark it cannot write is none. */
|
|
5064
|
+
function markStarting(paths) {
|
|
5065
|
+
try {
|
|
5066
|
+
writeFileSync(startingPath(paths.dir), String(process.pid), { mode: 384 });
|
|
5067
|
+
} catch {}
|
|
5068
|
+
return () => unmarkStarting(paths);
|
|
5069
|
+
}
|
|
5070
|
+
function unmarkStarting(paths) {
|
|
5071
|
+
try {
|
|
5072
|
+
rmSync(startingPath(paths.dir), { force: true });
|
|
5073
|
+
} catch {}
|
|
5074
|
+
}
|
|
5014
5075
|
var guarded = false;
|
|
5015
5076
|
/**
|
|
5016
5077
|
* A daemon says an error nobody caught (with its stack, on stderr: the daemon's log when detached) and keeps serving:
|
|
@@ -5172,4 +5233,4 @@ function connection(ctx, socket, secret) {
|
|
|
5172
5233
|
//#endregion
|
|
5173
5234
|
export { BASELINE_NEWEST, MAX_LINE, MAX_UNREAD, keepServing, openHost, serve };
|
|
5174
5235
|
|
|
5175
|
-
//# sourceMappingURL=host-
|
|
5236
|
+
//# sourceMappingURL=host-Va-r_KJz.js.map
|