@ghostlytools/cli 1.12.1 → 1.13.0

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.
Files changed (63) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/{api-jRUXnBdX.js → api-CVtg7MpI.js} +2 -2
  3. package/dist/assets/{api-BwEgbvvK.js → api-CjOaoG-v.js} +16 -16
  4. package/dist/assets/api-CjOaoG-v.js.map +1 -0
  5. package/dist/assets/{apiKit-BlsNk-Cx.js → apiKit-BAGvlQtm.js} +2 -2
  6. package/dist/assets/{apiKit-BlsNk-Cx.js.map → apiKit-BAGvlQtm.js.map} +1 -1
  7. package/dist/assets/{appFetch-CW9fJPHh.js → appFetch-BwJd-kNq.js} +2 -2
  8. package/dist/assets/{appFetch-CW9fJPHh.js.map → appFetch-BwJd-kNq.js.map} +1 -1
  9. package/dist/assets/{apps-CL8TXHhu.js → apps-Cuk45sz5.js} +5 -5
  10. package/dist/assets/{apps-CL8TXHhu.js.map → apps-Cuk45sz5.js.map} +1 -1
  11. package/dist/assets/{apps-BcG4u6SM.js → apps-DjY095Af.js} +1 -1
  12. package/dist/assets/{backup-xZfV-ytw.js → backup-B56sQqoQ.js} +1 -1
  13. package/dist/assets/{backup-BA41EDvh.js → backup-DekVCDWv.js} +3 -3
  14. package/dist/assets/{backup-BA41EDvh.js.map → backup-DekVCDWv.js.map} +1 -1
  15. package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js.map +1 -1
  16. package/dist/assets/{bitcoind-Dh7n9amb.js → bitcoind-B2bbVSzh.js} +2 -2
  17. package/dist/assets/{bitcoind-Dh7n9amb.js.map → bitcoind-B2bbVSzh.js.map} +1 -1
  18. package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js.map +1 -1
  19. package/dist/assets/{buttons-SH1tNRh7.js → buttons-BGxzOtrq.js} +26 -5
  20. package/dist/assets/buttons-BGxzOtrq.js.map +1 -0
  21. package/dist/assets/buttons-CsN2WJOf.js +1 -0
  22. package/dist/assets/{client-DGS-atRu.js → client-DcQAfc3h.js} +2 -2
  23. package/dist/assets/{client-DGS-atRu.js.map → client-DcQAfc3h.js.map} +1 -1
  24. package/dist/assets/{fixedHosts-CPSsGOI2.js → fixedHosts-C3hBliM9.js} +2 -2
  25. package/dist/assets/{fixedHosts-CPSsGOI2.js.map → fixedHosts-C3hBliM9.js.map} +1 -1
  26. package/dist/assets/{groupMeta-DxuJzko_.js → groupMeta-goASqzOt.js} +94 -17
  27. package/dist/assets/{groupMeta-DxuJzko_.js.map → groupMeta-goASqzOt.js.map} +1 -1
  28. package/dist/assets/{host-BxM-HMr0.js → host-C2WRKj3g.js} +52 -32
  29. package/dist/assets/host-C2WRKj3g.js.map +1 -0
  30. package/dist/assets/{irohWeb-CbnGtUo6.js → irohWeb-NfthOL98.js} +6 -6
  31. package/dist/assets/{irohWeb-CbnGtUo6.js.map → irohWeb-NfthOL98.js.map} +1 -1
  32. package/dist/assets/{main-CwTaepxR.js → main-Dh7fePd8.js} +19 -19
  33. package/dist/assets/main-Dh7fePd8.js.map +1 -0
  34. package/dist/assets/{mainline-CVrd0C1n.js → mainline-DY95WbuK.js} +2 -2
  35. package/dist/assets/{mainline-CVrd0C1n.js.map → mainline-DY95WbuK.js.map} +1 -1
  36. package/dist/assets/{ownDid-DY3rYqDI.js → ownDid-BErplN7N.js} +2 -2
  37. package/dist/assets/{ownDid-DY3rYqDI.js.map → ownDid-BErplN7N.js.map} +1 -1
  38. package/dist/assets/{ownStatus-DtzIllg2.js → ownStatus-ClrFjd7h.js} +4 -3
  39. package/dist/assets/ownStatus-ClrFjd7h.js.map +1 -0
  40. package/dist/assets/{profiles-BOYGlmu2.js → profiles-B8xO8-oj.js} +2 -2
  41. package/dist/assets/{profiles-BOYGlmu2.js.map → profiles-B8xO8-oj.js.map} +1 -1
  42. package/dist/assets/{registry-4W1LGlCF.js → registry--Rg2YvOH.js} +1 -1
  43. package/dist/assets/{registry-Bep4umOM.js → registry-CU8PevhI.js} +3 -3
  44. package/dist/assets/{registry-Bep4umOM.js.map → registry-CU8PevhI.js.map} +1 -1
  45. package/dist/assets/{relay-Cjfmdec0.js → relay-CHWg5hpZ.js} +73 -11
  46. package/dist/assets/relay-CHWg5hpZ.js.map +1 -0
  47. package/dist/assets/{resolve-CIc3KZMV.js → resolve-B1upovPM.js} +2 -2
  48. package/dist/assets/{resolve-CIc3KZMV.js.map → resolve-B1upovPM.js.map} +1 -1
  49. package/dist/assets/{server-D4gf-LnD.js → server-Dgxx_DaN.js} +221 -22
  50. package/dist/assets/server-Dgxx_DaN.js.map +1 -0
  51. package/dist/assets/{waitNotice-DQvZgz2T.js → waitNotice-ylU3XwjO.js} +2 -2
  52. package/dist/assets/{waitNotice-DQvZgz2T.js.map → waitNotice-ylU3XwjO.js.map} +1 -1
  53. package/dist/ghostly.mjs +1 -1
  54. package/npm-shrinkwrap.json +2 -2
  55. package/package.json +1 -1
  56. package/dist/assets/api-BwEgbvvK.js.map +0 -1
  57. package/dist/assets/buttons-CsGdQNnR.js +0 -1
  58. package/dist/assets/buttons-SH1tNRh7.js.map +0 -1
  59. package/dist/assets/host-BxM-HMr0.js.map +0 -1
  60. package/dist/assets/main-CwTaepxR.js.map +0 -1
  61. package/dist/assets/ownStatus-DtzIllg2.js.map +0 -1
  62. package/dist/assets/relay-Cjfmdec0.js.map +0 -1
  63. package/dist/assets/server-D4gf-LnD.js.map +0 -1
@@ -1,15 +1,15 @@
1
1
  import { p as fileStore } from "./idb-ewvbqyDI.js";
2
- import { _ as groupPayTwins, d as servedApps, f as nodeLocalFetch, g as groupMessageJson, h as groupJson, l as paymentJson, m as chatMessageJson, p as chatJson, r as callApi, u as reportAppFrames, v as resumeHolds, y as flushCardUpdates } from "./api-BwEgbvvK.js";
3
- import { N as sinceSeq, s as findChat, u as findOwnNamedChat } from "./apiKit-BlsNk-Cx.js";
2
+ import { _ as groupPayTwins, d as servedApps, f as nodeLocalFetch, g as groupMessageJson, h as groupJson, l as paymentJson, m as chatMessageJson, p as chatJson, r as callApi, u as reportAppFrames, v as resumeHolds, y as flushCardUpdates } from "./api-CjOaoG-v.js";
3
+ import { N as sinceSeq, s as findChat, u as findOwnNamedChat } from "./apiKit-BAGvlQtm.js";
4
4
  import { r as asCliError, t as CliError } from "./errors-DDLFO4Gf.js";
5
- import { C as ownFolder, D as runtimePath, E as privateFolder, n as RESTORED_MARK, r as acquireLock, w as ownProfile, x as startingPath } from "./profiles-BOYGlmu2.js";
6
- import { _ as frameBytes, b as monotonic, d as proof, f as removeDaemonSecret, g as bytesToMs, h as PlaybackQueue, l as greeting, m as DEFAULT_RATE, u as newDaemonSecret, v as frameSamples, y as isCallRate } from "./client-DGS-atRu.js";
7
- import { Bi as buildSdpFromSignal, Gi as parseCallSignal, Hi as callSignalHeardAt, Ii as CALL_SIGNAL_MAX_AGE_MS, Ki as signalHasVideo, Ri as RTC_CONFIG, Vi as callRtcConfig, Wi as extractParamsFromSdp, Zt as checkPushEndpoint, bi as DAEMON_WATCH_PEER_IDLE_MS, gn as ACTIVE_DHT_POLL_MS, xt as STATUS_IDLE_AFTER_MS, zi as answersOffer } from "./groupMeta-DxuJzko_.js";
8
- import { d as parsePayLink, r as irohRelayProblem } from "./irohWeb-CbnGtUo6.js";
5
+ import { C as ownFolder, D as runtimePath, E as privateFolder, n as RESTORED_MARK, r as acquireLock, w as ownProfile, x as startingPath } from "./profiles-B8xO8-oj.js";
6
+ import { _ as frameBytes, b as monotonic, d as proof, f as removeDaemonSecret, g as bytesToMs, h as PlaybackQueue, l as greeting, m as DEFAULT_RATE, u as newDaemonSecret, v as frameSamples, y as isCallRate } from "./client-DcQAfc3h.js";
7
+ import { Bi as buildSdpFromSignal, Gi as parseCallSignal, Hi as callSignalHeardAt, Ii as CALL_SIGNAL_MAX_AGE_MS, Ki as signalHasVideo, Ri as RTC_CONFIG, Vi as callRtcConfig, Wi as extractParamsFromSdp, Zt as checkPushEndpoint, bi as DAEMON_WATCH_PEER_IDLE_MS, gn as ACTIVE_DHT_POLL_MS, xt as STATUS_IDLE_AFTER_MS, zi as answersOffer } from "./groupMeta-goASqzOt.js";
8
+ import { d as parsePayLink, r as irohRelayProblem } from "./irohWeb-NfthOL98.js";
9
9
  import { i as fromBase64Url } from "./bytes-C1DNGY18.js";
10
- import { u as setLinkTraceSink } from "./relay-Cjfmdec0.js";
10
+ import { u as setLinkTraceSink } from "./relay-CHWg5hpZ.js";
11
11
  import { b as setPublicKeyFastPath } from "./pkarr-BQo4PcCg.js";
12
- import { p as nativePublicKey } from "./apps-CL8TXHhu.js";
12
+ import { p as nativePublicKey } from "./apps-Cuk45sz5.js";
13
13
  import { n as fedimintSdkOn } from "./fedimintSdk-D-6H9Pe7.js";
14
14
  import { s as isPublicAddress } from "./domainProofs-BDNP1dIy.js";
15
15
  import { createRequire } from "node:module";
@@ -1232,6 +1232,11 @@ var CallManager = class {
1232
1232
  if (signal.ts <= (this.lastSignal.get(chat) ?? 0)) return;
1233
1233
  const call = this.byChat(chat);
1234
1234
  if (signal.t === "r" || signal.t === "a" && signal.re !== void 0) return;
1235
+ if (signal.t === "o" && call?.state === "connected") {
1236
+ this.lastSignal.set(chat, signal.ts);
1237
+ this.yieldTo(call, signal, "remote-hangup");
1238
+ return;
1239
+ }
1235
1240
  if (call?.state === "connected" && signal.t !== "h" && signal.t !== "v") return;
1236
1241
  if (signal.t === "o" && !call) {
1237
1242
  this.lastSignal.set(chat, signal.ts);
@@ -1271,11 +1276,12 @@ var CallManager = class {
1271
1276
  }
1272
1277
  }
1273
1278
  /**
1274
- * The contact's offer won a glare: our call ends as `crossed`, sending nothing (a hang-up would end the contact's
1275
- * call, and clearing our signal could drop an answer we are about to give), and the contact's call rings here.
1279
+ * The contact's offer won a glare (`crossed`), or came from their app starting over on a connected call
1280
+ * (`remote-hangup`): our call ends, sending no hang-up (it would end the contact's call; a glare's also keeps our
1281
+ * signal, as clearing it could drop an answer we are about to give), and the contact's call rings here.
1276
1282
  */
1277
- async yieldTo(call, offer) {
1278
- await this.end(call, "crossed", false);
1283
+ async yieldTo(call, offer, reason = "crossed") {
1284
+ await this.end(call, reason, false);
1279
1285
  if (this.lastSignal.get(call.chat) !== offer.ts || this.byChat(call.chat) || this.stopping) return;
1280
1286
  this.incoming(call.chat, offer);
1281
1287
  }
@@ -4873,6 +4879,8 @@ async function openPersistentIndexedDb(dir, options = {}) {
4873
4879
  let unsynced = [];
4874
4880
  /** The syncs running off the thread, one after another, until no `complete` waits for one. */
4875
4881
  let syncing = null;
4882
+ /** The `complete`s of transactions whose entries wait in the queue (`append`). */
4883
+ let held = 0;
4876
4884
  /** The last journal entry whose layers wait for `applying` to take them to SQLite. */
4877
4885
  let applyUpTo = 0;
4878
4886
  let applying = null;
@@ -5027,17 +5035,17 @@ async function openPersistentIndexedDb(dir, options = {}) {
5027
5035
  const ops = pending.get(this._rollbackLog);
5028
5036
  if (!ops?.length) trees?.abort(this._rollbackLog);
5029
5037
  if (ops?.length) entry = ++seq;
5030
- const appended = ops?.length ? append(ops, this.durability === "relaxed", entry, this._rollbackLog) : null;
5031
- if (appended && appended !== "unsynced") return refuse(this, appended.error, event);
5032
- waits = appended === "unsynced";
5038
+ const appended = ops?.length ? append(ops, this.durability === "relaxed", entry, this._rollbackLog, () => dispatch.call(this, event)) : null;
5039
+ if (appended && typeof appended === "object") return refuse(this, appended.error, event);
5040
+ waits = appended !== null;
5041
+ if (appended === "unsynced") shareSync(() => {
5042
+ written(entry);
5043
+ dispatch.call(this, event);
5044
+ });
5033
5045
  }
5034
5046
  pending.delete(this._rollbackLog);
5035
5047
  if (schemaDirty) enqueue(writeSnapshot);
5036
5048
  if (waits) {
5037
- shareSync(() => {
5038
- written(entry);
5039
- dispatch.call(this, event);
5040
- });
5041
5049
  this.db._rawDatabase.processTransactions(event);
5042
5050
  return true;
5043
5051
  }
@@ -5060,8 +5068,11 @@ async function openPersistentIndexedDb(dir, options = {}) {
5060
5068
  * A committed transaction's entry, numbered `entry` (its first op says so, where there are trees), from the
5061
5069
  * transaction whose rollback log is `owner`. Written at once, it may fail (a full disk): the reason is given back,
5062
5070
  * and the transaction is to be refused, not completed. "unsynced": written, and its `complete` waits for a sync.
5071
+ * "queued": written behind what the queue holds (a fold, a Blob's entry), and `complete` called once it is: what
5072
+ * completed before was on no disk while the fold waited for the sync in flight, and a process killed then lost a
5073
+ * text the engine had told the contact it held.
5063
5074
  */
5064
- function append(ops, lazy, entry, owner) {
5075
+ function append(ops, lazy, entry, owner, complete) {
5065
5076
  holdsDelete ||= ops.some(deletes);
5066
5077
  if (trees) ops = [{
5067
5078
  db: SEQ,
@@ -5082,13 +5093,22 @@ async function openPersistentIndexedDb(dir, options = {}) {
5082
5093
  return null;
5083
5094
  }
5084
5095
  trees?.complete(owner, entry);
5096
+ held++;
5085
5097
  enqueue(async () => {
5086
- if (writeEntry(serialize(await Promise.all(ops.map(async (op) => op.kind === "put" ? {
5087
- ...op,
5088
- value: await blobsToDisk(op.value)
5089
- } : op))), lazy ? "lazy" : "now")) written(entry);
5098
+ try {
5099
+ if (writeEntry(serialize(await Promise.all(ops.map(async (op) => op.kind === "put" ? {
5100
+ ...op,
5101
+ value: await blobsToDisk(op.value)
5102
+ } : op))), lazy ? "lazy" : "now")) written(entry);
5103
+ } catch (error) {
5104
+ failed(error);
5105
+ await writeSnapshot().catch(failed);
5106
+ }
5107
+ }).then(() => {
5108
+ held--;
5109
+ complete();
5090
5110
  });
5091
- return null;
5111
+ return "queued";
5092
5112
  }
5093
5113
  /**
5094
5114
  * A transaction whose entry the disk did not take: what it wrote is undone (as fake-indexeddb's own abort does), and
@@ -5237,7 +5257,7 @@ async function openPersistentIndexedDb(dir, options = {}) {
5237
5257
  * (5 ms on a Mac's SSD, where it flushes the drive's cache), one per transaction: 8 sends at once went no faster than
5238
5258
  * 1, and every other call waited behind them. It runs off the thread now, and every entry written while it runs
5239
5259
  * goes with the next one. One that fails leaves what the journal has unsure: the store is folded into a whole
5240
- * snapshot before the `complete`s go (they go even if that fails, as a Blob's entry written late does).
5260
+ * snapshot before the `complete`s go (they go even if that fails, as a queued entry's does).
5241
5261
  */
5242
5262
  function shareSync(done) {
5243
5263
  unsynced.push(done);
@@ -5478,9 +5498,9 @@ async function openPersistentIndexedDb(dir, options = {}) {
5478
5498
  quiet = busy() ? 0 : quiet + 1;
5479
5499
  }
5480
5500
  }
5481
- /** Whether a transaction is running or waiting to, or for the sync that tells the engine it completed. */
5501
+ /** Whether a transaction is running or waiting to, or for the sync or the queued write that tells the engine it completed. */
5482
5502
  function busy() {
5483
- return syncing !== null || [...raw._databases.values()].some((db) => db.transactions.some((transaction) => transaction._state !== "finished"));
5503
+ return syncing !== null || held > 0 || [...raw._databases.values()].some((db) => db.transactions.some((transaction) => transaction._state !== "finished"));
5484
5504
  }
5485
5505
  const installed = globalThis;
5486
5506
  installed.indexedDB = factory;
@@ -6565,8 +6585,8 @@ async function startRuntime(paths, options = {}) {
6565
6585
  const [{ registerFileBytes }, { NodeFileBytes }] = await Promise.all([import("./fileBytes-CCKbwqG_.js"), import("./fileBytes-tj6-VZcB.js")]);
6566
6586
  registerFileBytes("native", async () => new NodeFileBytes(paths.files), true);
6567
6587
  if (await (await import("./blobFiles-DDs34n0r.js")).moveBlobFiles()) await store.compact();
6568
- const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-D4gf-LnD.js"), import("./endpoint-Cvu-taMs.js")]);
6569
- const mainline = dht.off ? null : new (await (import("./mainline-CVrd0C1n.js"))).Mainline({
6588
+ const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-Dgxx_DaN.js"), import("./endpoint-Cvu-taMs.js")]);
6589
+ const mainline = dht.off ? null : new (await (import("./mainline-DY95WbuK.js"))).Mainline({
6570
6590
  bootstrap: dht.bootstrap,
6571
6591
  host: dht.host
6572
6592
  });
@@ -6574,7 +6594,7 @@ async function startRuntime(paths, options = {}) {
6574
6594
  ...pinned ? { relays: pinned } : {},
6575
6595
  ...relayBudgetForTests()
6576
6596
  };
6577
- const transport = mainline || pinned ? new (await (import("./mainline-CVrd0C1n.js"))).RelaysAndDht(mainline, relayOptions, !!pinned) : null;
6597
+ const transport = mainline || pinned ? new (await (import("./mainline-DY95WbuK.js"))).RelaysAndDht(mainline, relayOptions, !!pinned) : null;
6578
6598
  const apps = servedApps(paths.dir).length > 0;
6579
6599
  const server = new EngineServer({
6580
6600
  ...transport ? { transport } : {},
@@ -7034,4 +7054,4 @@ function connection(ctx, socket, secret, answering) {
7034
7054
  }
7035
7055
  export { BASELINE_NEWEST, MAX_UNREAD, STOP_ANSWERS_MS, keepServing, openHost, serve };
7036
7056
 
7037
- //# sourceMappingURL=host-BxM-HMr0.js.map
7057
+ //# sourceMappingURL=host-C2WRKj3g.js.map