@ghostlytools/cli 1.7.4 → 1.8.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 (84) hide show
  1. package/README.md +12 -6
  2. package/SKILL.md +1 -1
  3. package/dist/assets/{api-Chhvpwok.js → api-Dj1yn0px.js} +2 -2
  4. package/dist/assets/{api-D3i2hwy0.js → api-I_KbuXHa.js} +62 -16
  5. package/dist/assets/api-I_KbuXHa.js.map +1 -0
  6. package/dist/assets/{apiKit-BtsHrnoo.js → apiKit-C-_PWZvy.js} +17 -5
  7. package/dist/assets/{apiKit-BtsHrnoo.js.map → apiKit-C-_PWZvy.js.map} +1 -1
  8. package/dist/assets/{apps-BHl97rHs.js → apps-DKIe8VjF.js} +8 -7
  9. package/dist/assets/apps-DKIe8VjF.js.map +1 -0
  10. package/dist/assets/{apps-BFJTqvAt.js → apps-DbEfL_3b.js} +1 -1
  11. package/dist/assets/{arkade-BFE8KkEE.js → arkade-k1bdSm70.js} +2 -2
  12. package/dist/assets/{arkade-BFE8KkEE.js.map → arkade-k1bdSm70.js.map} +1 -1
  13. package/dist/assets/{backup-Bbsr6nDi.js → backup-Cdd6-HNu.js} +1 -1
  14. package/dist/assets/{backup-CxACdtQX.js → backup-beKfbfNk.js} +6 -6
  15. package/dist/assets/{backup-CxACdtQX.js.map → backup-beKfbfNk.js.map} +1 -1
  16. package/dist/assets/buttons-BO1_7V4L.js +2 -0
  17. package/dist/assets/{buttons-CieBtXEO.js → buttons-ClI13rdv.js} +7 -6
  18. package/dist/assets/buttons-ClI13rdv.js.map +1 -0
  19. package/dist/assets/{daemonProof-QmtwDj-N.js → daemonProof-DtrL5lE5.js} +2 -2
  20. package/dist/assets/{daemonProof-QmtwDj-N.js.map → daemonProof-DtrL5lE5.js.map} +1 -1
  21. package/dist/assets/{envelope-DYiGwzq_.js → envelope-B88yiCQj.js} +2 -2
  22. package/dist/assets/{envelope-DYiGwzq_.js.map → envelope-B88yiCQj.js.map} +1 -1
  23. package/dist/assets/{errors-QUGP-jIF.js → errors-R4S2SAEM.js} +7 -2
  24. package/dist/assets/errors-R4S2SAEM.js.map +1 -0
  25. package/dist/assets/{groupFiles-CBJIEvCE.js → groupFiles-DjQc5XXv.js} +135 -24
  26. package/dist/assets/groupFiles-DjQc5XXv.js.map +1 -0
  27. package/dist/assets/{host-Va-r_KJz.js → host-CNWGB3-j.js} +44 -20
  28. package/dist/assets/host-CNWGB3-j.js.map +1 -0
  29. package/dist/assets/{hyperdhtRelay-B2uK9tJv.js → hyperdhtRelay-g7eXzf5h.js} +2 -2
  30. package/dist/assets/{hyperdhtRelay-B2uK9tJv.js.map → hyperdhtRelay-g7eXzf5h.js.map} +1 -1
  31. package/dist/assets/{irohWeb-DxeEgQ-W.js → irohWeb-Bx8dI4be.js} +2 -2
  32. package/dist/assets/{irohWeb-DxeEgQ-W.js.map → irohWeb-Bx8dI4be.js.map} +1 -1
  33. package/dist/assets/{main-BX4oPWCJ.js → main-BRxhBctJ.js} +121 -37
  34. package/dist/assets/main-BRxhBctJ.js.map +1 -0
  35. package/dist/assets/{mainline-IfWQOB-J.js → mainline-CwuS6ngj.js} +2 -2
  36. package/dist/assets/{mainline-IfWQOB-J.js.map → mainline-CwuS6ngj.js.map} +1 -1
  37. package/dist/assets/mints-BaOmx517.js +2 -0
  38. package/dist/assets/{mints-BrlY773j.js → mints-j5XAOk4f.js} +15 -3
  39. package/dist/assets/mints-j5XAOk4f.js.map +1 -0
  40. package/dist/assets/{networkReason-N2vAaoth.js → networkReason-CIAMieQm.js} +2 -2
  41. package/dist/assets/{networkReason-N2vAaoth.js.map → networkReason-CIAMieQm.js.map} +1 -1
  42. package/dist/assets/{nwc-CzyCtNK2.js → nwc-C9JLJJkL.js} +3 -3
  43. package/dist/assets/{nwc-CzyCtNK2.js.map → nwc-C9JLJJkL.js.map} +1 -1
  44. package/dist/assets/{nwcProvider-DjWmEn3j.js → nwcProvider-pFMrsUJh.js} +2 -2
  45. package/dist/assets/{nwcProvider-DjWmEn3j.js.map → nwcProvider-pFMrsUJh.js.map} +1 -1
  46. package/dist/assets/{profiles-DcCeOi7J.js → profiles-MFtCmJwK.js} +3 -3
  47. package/dist/assets/{profiles-DcCeOi7J.js.map → profiles-MFtCmJwK.js.map} +1 -1
  48. package/dist/assets/{registry-CeW8XEQc.js → registry-Cks7FA_o.js} +3 -3
  49. package/dist/assets/{registry-CeW8XEQc.js.map → registry-Cks7FA_o.js.map} +1 -1
  50. package/dist/assets/{registry-BmS02J5h.js → registry-DY2ixQfU.js} +1 -1
  51. package/dist/assets/{resolve-BvHkAhDH.js → resolve-C4Y2HPqQ.js} +15 -3
  52. package/dist/assets/resolve-C4Y2HPqQ.js.map +1 -0
  53. package/dist/assets/{restoredRows-mTTp3XNs.js → restoredRows-BCRCjhdF.js} +26 -2
  54. package/dist/assets/{restoredRows-mTTp3XNs.js.map → restoredRows-BCRCjhdF.js.map} +1 -1
  55. package/dist/assets/{server-BUcJo4vz.js → server-D9RAmGdm.js} +650 -150
  56. package/dist/assets/server-D9RAmGdm.js.map +1 -0
  57. package/dist/assets/{src-BB5-5P3s.js → src-1RU4TilT.js} +878 -77
  58. package/dist/assets/src-1RU4TilT.js.map +1 -0
  59. package/dist/assets/{translate-2WyaRVCr.js → translate-od5GbpvR.js} +11 -7
  60. package/dist/assets/translate-od5GbpvR.js.map +1 -0
  61. package/dist/assets/{usdt-BLazHiaP.js → usdt-DldXV0MR.js} +3 -3
  62. package/dist/assets/{usdt-BLazHiaP.js.map → usdt-DldXV0MR.js.map} +1 -1
  63. package/dist/assets/waitNotice-Ck3el3_Z.js +45 -0
  64. package/dist/assets/waitNotice-Ck3el3_Z.js.map +1 -0
  65. package/dist/assets/{words-BaumxjXe.js → words-BS2qq_vV.js} +6 -3
  66. package/dist/assets/words-BS2qq_vV.js.map +1 -0
  67. package/dist/ghostly.mjs +1 -1
  68. package/examples/claude-code-agent.sh +1 -1
  69. package/package.json +1 -1
  70. package/dist/assets/api-D3i2hwy0.js.map +0 -1
  71. package/dist/assets/apps-BHl97rHs.js.map +0 -1
  72. package/dist/assets/buttons-CieBtXEO.js.map +0 -1
  73. package/dist/assets/buttons-YtAj3R_E.js +0 -2
  74. package/dist/assets/errors-QUGP-jIF.js.map +0 -1
  75. package/dist/assets/groupFiles-CBJIEvCE.js.map +0 -1
  76. package/dist/assets/host-Va-r_KJz.js.map +0 -1
  77. package/dist/assets/main-BX4oPWCJ.js.map +0 -1
  78. package/dist/assets/mints-BrlY773j.js.map +0 -1
  79. package/dist/assets/mints-CqTdA4Gk.js +0 -2
  80. package/dist/assets/resolve-BvHkAhDH.js.map +0 -1
  81. package/dist/assets/server-BUcJo4vz.js.map +0 -1
  82. package/dist/assets/src-BB5-5P3s.js.map +0 -1
  83. package/dist/assets/translate-2WyaRVCr.js.map +0 -1
  84. package/dist/assets/words-BaumxjXe.js.map +0 -1
@@ -1,10 +1,10 @@
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";
1
+ import { $o as parseCallSignal, Du as fromBase64Url, Ei as isPublicAddress, Go as CALL_SIGNAL_MAX_AGE_MS, Jo as buildSdpFromSignal, Ko as RTC_CONFIG, Qo as extractParamsFromSdp, Xo as callSignalHeardAt, Yo as callRtcConfig, ei as checkPushEndpoint, es as signalHasVideo, qo as answersOffer, su as setLinkTraceSink } from "./src-1RU4TilT.js";
2
+ import { a as fedimintSdkOn, r as irohRelayProblem } from "./irohWeb-Bx8dI4be.js";
3
+ import { r as asCliError, t as CliError } from "./errors-R4S2SAEM.js";
4
+ import { l as findOwnNamedChat, o as findChat } from "./apiKit-C-_PWZvy.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-I_KbuXHa.js";
6
+ import { b as privateFolder, g as startingPath, n as RESTORED_MARK, r as acquireLock, v as ownFolder, x as runtimePath } from "./profiles-MFtCmJwK.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-DtrL5lE5.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";
@@ -2091,14 +2091,16 @@ var EventHub = class {
2091
2091
  const key = `${link.id}:${identity.id}`, shape = identity.status, before = this.received.get(key);
2092
2092
  this.received.set(key, shape);
2093
2093
  if (quiet || before === shape) continue;
2094
- this.emit(before === void 0 ? "identity.received" : "identity.status", `identity.${before === void 0 ? "received" : "status"}:${key}:${shape}`, {
2094
+ const id = before === void 0 ? `identity.received:${key}:${shape}` : `identity.status:${key}:${shape}:${this.now()}:${this.seq + 1}`;
2095
+ this.emit(before === void 0 ? "identity.received" : "identity.status", id, {
2095
2096
  chat: link.id,
2096
2097
  identity: {
2097
2098
  id: identity.id,
2098
2099
  provider: identity.provider,
2099
2100
  subject: identity.subject,
2100
2101
  status: identity.status,
2101
- verified: identity.verified
2102
+ verified: identity.verified,
2103
+ error: identity.error ?? null
2102
2104
  }
2103
2105
  });
2104
2106
  }
@@ -3463,12 +3465,19 @@ var ON_DISK = /* @__PURE__ */ new Set(["messages", "fileState"]);
3463
3465
  var COMPACT_BYTES = 33554432;
3464
3466
  /** A journal up to this is kept at close and at start: replaying it costs less than writing the snapshot again. */
3465
3467
  var KEEP_BYTES = 1048576;
3468
+ /** The chat row's field that holds its ratchet, as a journal's bytes spell it. Another row that says the word only folds early. */
3469
+ var RATCHET = "ratchetState";
3470
+ /**
3471
+ * How long a used ratchet state may stay on the disk while the store is in use, so a profile folder copied later opens
3472
+ * nothing older. The time a fold blocks does not set this (tens of milliseconds at 100,000 messages, which are not in
3473
+ * the snapshot); its disk writes do: 4 MB on that profile, so about 100 MB a day at this hour and 600 MB at 10 minutes.
3474
+ */
3475
+ var RATCHET_FOLD_MS = 36e5;
3466
3476
  /** The stores whose rows a delete means gone from the disk: the chats (their seed, their ratchet) and their messages. */
3467
3477
  var FORGOTTEN = /* @__PURE__ */ new Set(["links", "messages"]);
3468
3478
  /**
3469
3479
  * 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.
3480
+ * folder copied later holds nothing older. The hour is the ratchet's, for the same reason.
3472
3481
  */
3473
3482
  var DELETE_FOLD_MS = 36e5;
3474
3483
  /**
@@ -3521,11 +3530,14 @@ async function openPersistentIndexedDb(dir, options = {}) {
3521
3530
  let unsaved = false;
3522
3531
  /** Set while the journal holds relaxed entries no sync has covered yet. */
3523
3532
  let relaxed = null;
3533
+ /** The journal holds a chat's ratchet state, and with the next one it holds a key already used. */
3534
+ let holdsRatchet = false;
3524
3535
  /** The journal holds a delete of a chat or a message, and what came before it with it. */
3525
3536
  let holdsDelete = false;
3526
3537
  const pending = /* @__PURE__ */ new WeakMap();
3527
3538
  const snapshotPath = join(dir, SNAPSHOT);
3528
3539
  const journalPath = join(dir, JOURNAL);
3540
+ const ratchetDue = () => holdsRatchet && Date.now() - (statSync(snapshotPath, { throwIfNoEntry: false })?.mtimeMs ?? 0) >= RATCHET_FOLD_MS;
3529
3541
  const deleteDue = () => holdsDelete && Date.now() - (statSync(snapshotPath, { throwIfNoEntry: false })?.mtimeMs ?? 0) >= DELETE_FOLD_MS;
3530
3542
  const snapshotFound = existsSync(snapshotPath), journalFound = existsSync(journalPath);
3531
3543
  const saved = snapshotFound ? deserialize(readFileSync(snapshotPath)) : null;
@@ -3584,8 +3596,9 @@ async function openPersistentIndexedDb(dir, options = {}) {
3584
3596
  restoring = false;
3585
3597
  /** Whether the journal on disk says the store is closed: nothing was written since its mark, or there is none. */
3586
3598
  let marked = replayed.closed;
3599
+ holdsRatchet = !!journal?.includes(RATCHET);
3587
3600
  holdsDelete = replayed.deletes;
3588
- const kept = !!journal && named !== void 0 && named === snapshotName && replayed.end === journal.length && journal.length <= KEEP_BYTES && !deleteDue();
3601
+ const kept = !!journal && named !== void 0 && named === snapshotName && replayed.end === journal.length && journal.length <= KEEP_BYTES && !ratchetDue() && !deleteDue();
3589
3602
  const rewrite = journal && !kept || !snapshotFound || moved;
3590
3603
  if (rewrite) await writeSnapshot();
3591
3604
  rows?.close();
@@ -3844,7 +3857,8 @@ async function openPersistentIndexedDb(dir, options = {}) {
3844
3857
  failed(error);
3845
3858
  }
3846
3859
  }, RELAXED_SYNC_MS).unref();
3847
- if (statSync(journalPath).size > COMPACT_BYTES || deleteDue()) enqueue(writeSnapshot);
3860
+ holdsRatchet ||= entry.includes(RATCHET);
3861
+ if (statSync(journalPath).size > COMPACT_BYTES || ratchetDue() || deleteDue()) enqueue(writeSnapshot);
3848
3862
  return true;
3849
3863
  }
3850
3864
  function sync() {
@@ -3950,11 +3964,12 @@ async function openPersistentIndexedDb(dir, options = {}) {
3950
3964
  }
3951
3965
  rmSync(journalPath, { force: true });
3952
3966
  marked = true;
3967
+ holdsRatchet = false;
3953
3968
  holdsDelete = false;
3954
3969
  }
3955
3970
  /** What `close` leaves: a short journal with the mark at its end, synced (its relaxed entries too), or a fresh snapshot. */
3956
3971
  async function leave() {
3957
- if (schemaDirty || unsaved || journalBytes() > KEEP_BYTES || deleteDue()) return writeSnapshot();
3972
+ if (schemaDirty || unsaved || journalBytes() > KEEP_BYTES || ratchetDue() || deleteDue()) return writeSnapshot();
3958
3973
  if (marked) return;
3959
3974
  writeEntry(serialize([{
3960
3975
  db: CLOSED,
@@ -4014,6 +4029,14 @@ async function openPersistentIndexedDb(dir, options = {}) {
4014
4029
  async exportSnapshot(path) {
4015
4030
  await settled();
4016
4031
  const snapshot = await capture(void 0, true);
4032
+ for (const db of snapshot.databases) for (const store of db.stores) {
4033
+ if (store.name !== "links") continue;
4034
+ store.records = store.records.map(([key, value]) => {
4035
+ if (!value || typeof value !== "object" || !("ratchetState" in value)) return [key, value];
4036
+ const { ratchetState: _ratchet, ...link } = value;
4037
+ return [key, link];
4038
+ });
4039
+ }
4017
4040
  const fd = openSync(path, "w", 384);
4018
4041
  try {
4019
4042
  writeAll(fd, serialize(snapshot));
@@ -4846,9 +4869,10 @@ async function startRuntime(paths, options = {}) {
4846
4869
  const restored = join(paths.dir, RESTORED_MARK);
4847
4870
  if (existsSync(restored)) {
4848
4871
  try {
4849
- const rows = await import("./restoredRows-mTTp3XNs.js");
4872
+ const rows = await import("./restoredRows-BCRCjhdF.js");
4850
4873
  await rows.markRestoredWallet();
4851
4874
  await rows.markLeftOutFiles(leftOutIn(restored));
4875
+ await rows.forgetRatchets();
4852
4876
  await store.compact();
4853
4877
  } catch (error) {
4854
4878
  await store.close().catch(() => {});
@@ -4861,19 +4885,19 @@ async function startRuntime(paths, options = {}) {
4861
4885
  const callsUnavailable = typeof stack === "string" ? stack : null;
4862
4886
  installFileFetch();
4863
4887
  const testMints = process.env.GHOSTLY_TEST_MINTS;
4864
- if (testMints) (await import("./mints-CqTdA4Gk.js")).declareTestMints(testMints.split(","));
4888
+ if (testMints) (await import("./mints-BaOmx517.js")).declareTestMints(testMints.split(","));
4865
4889
  await installEventSource();
4866
4890
  await preloadWalletModules();
4867
4891
  (await import("./ghostly_iroh_web-CO0onry8.js")).initSync({ module: irohWasmBytes() });
4868
4892
  const [{ registerFileBytes }, { NodeFileBytes }] = await Promise.all([import("./fileBytes-BPDKufla.js"), import("./fileBytes-Q3ehcEr8.js")]);
4869
4893
  registerFileBytes("native", async () => new NodeFileBytes(paths.files), true);
4870
4894
  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({
4895
+ const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-D9RAmGdm.js"), import("./endpoint-BdaeBw2L.js")]);
4896
+ const mainline = dht.off ? null : new (await (import("./mainline-CwuS6ngj.js"))).Mainline({
4873
4897
  bootstrap: dht.bootstrap,
4874
4898
  host: dht.host
4875
4899
  });
4876
- const transport = mainline || pinned ? new (await (import("./mainline-IfWQOB-J.js"))).RelaysAndDht(mainline, pinned ? { relays: pinned } : {}, !!pinned) : null;
4900
+ const transport = mainline || pinned ? new (await (import("./mainline-CwuS6ngj.js"))).RelaysAndDht(mainline, pinned ? { relays: pinned } : {}, !!pinned) : null;
4877
4901
  const apps = servedApps(paths.dir).length > 0;
4878
4902
  const server = new EngineServer({
4879
4903
  ...transport ? { transport } : {},
@@ -5233,4 +5257,4 @@ function connection(ctx, socket, secret) {
5233
5257
  //#endregion
5234
5258
  export { BASELINE_NEWEST, MAX_LINE, MAX_UNREAD, keepServing, openHost, serve };
5235
5259
 
5236
- //# sourceMappingURL=host-Va-r_KJz.js.map
5260
+ //# sourceMappingURL=host-CNWGB3-j.js.map