@adhdev/daemon-standalone 1.0.58-rc.47 → 1.0.58-rc.48

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/dist/index.js CHANGED
@@ -36911,10 +36911,10 @@ var require_dist3 = __commonJS({
36911
36911
  }
36912
36912
  function getDaemonBuildInfo() {
36913
36913
  if (cached2) return cached2;
36914
- const commit = readInjected(true ? "f13d08263df6a24da9d6766eebfbfc7cac237235" : void 0) ?? "unknown";
36915
- const commitShort = readInjected(true ? "f13d0826" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36916
- const version2 = readInjected(true ? "1.0.58-rc.47" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36917
- const builtAt = readInjected(true ? "2026-08-30T09:04:38.562Z" : void 0);
36914
+ const commit = readInjected(true ? "5b9c8b942cc6dec286f5257470292e03f12c53e7" : void 0) ?? "unknown";
36915
+ const commitShort = readInjected(true ? "5b9c8b94" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36916
+ const version2 = readInjected(true ? "1.0.58-rc.48" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36917
+ const builtAt = readInjected(true ? "2026-08-30T09:40:02.587Z" : void 0);
36918
36918
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
36919
36919
  return cached2;
36920
36920
  }
@@ -68137,6 +68137,35 @@ CREATE TABLE IF NOT EXISTS sq_archive (
68137
68137
  ledgerReadCache.set(meshId, { entries, cachedAt: Date.now() });
68138
68138
  return entries;
68139
68139
  }
68140
+ function filteredLedgerCacheKey(opts) {
68141
+ const kinds = opts.kinds ? [...new Set(opts.kinds)].sort() : [];
68142
+ return JSON.stringify([opts.since ?? null, kinds]);
68143
+ }
68144
+ function getCachedFilteredRawEntries(meshId, opts) {
68145
+ const key2 = filteredLedgerCacheKey(opts);
68146
+ let meshCache = filteredLedgerReadCache.get(meshId);
68147
+ if (meshCache) {
68148
+ const now = Date.now();
68149
+ for (const [cachedKey, entry] of meshCache) {
68150
+ if (now - entry.cachedAt >= LEDGER_CACHE_TTL_MS) meshCache.delete(cachedKey);
68151
+ }
68152
+ if (meshCache.size === 0) {
68153
+ filteredLedgerReadCache.delete(meshId);
68154
+ meshCache = void 0;
68155
+ }
68156
+ }
68157
+ const cached5 = meshCache?.get(key2);
68158
+ if (cached5) return cached5.entries;
68159
+ const entries = readLedgerFromStore(meshId, opts);
68160
+ recordLedgerPushdownScan(entries.length);
68161
+ const targetCache = meshCache ?? /* @__PURE__ */ new Map();
68162
+ targetCache.set(key2, { entries, cachedAt: Date.now() });
68163
+ if (!meshCache) filteredLedgerReadCache.set(meshId, targetCache);
68164
+ return entries;
68165
+ }
68166
+ function invalidateFilteredLedgerCache(meshId) {
68167
+ filteredLedgerReadCache.delete(meshId);
68168
+ }
68140
68169
  function entryTimeValue(entry) {
68141
68170
  const t = new Date(entry.timestamp).getTime();
68142
68171
  return Number.isNaN(t) ? NaN : t;
@@ -68156,19 +68185,24 @@ CREATE TABLE IF NOT EXISTS sq_archive (
68156
68185
  return true;
68157
68186
  }
68158
68187
  function recordLedgerAppend(meshId, newEntries) {
68188
+ invalidateFilteredLedgerCache(meshId);
68159
68189
  if (!appendToLedgerCache(meshId, newEntries)) invalidateLedgerCache(meshId);
68160
68190
  }
68161
68191
  function invalidateLedgerCache(meshId) {
68162
68192
  ledgerReadCache.delete(meshId);
68193
+ invalidateFilteredLedgerCache(meshId);
68163
68194
  }
68164
68195
  function clearLedgerImportFlag(meshId) {
68165
68196
  ledgerImportDone.delete(meshId);
68197
+ invalidateFilteredLedgerCache(meshId);
68166
68198
  }
68167
68199
  function invalidateAllLedgerCaches() {
68168
68200
  ledgerReadCache.clear();
68201
+ filteredLedgerReadCache.clear();
68169
68202
  }
68170
68203
  var import_fs12;
68171
68204
  var ledgerReadCache;
68205
+ var filteredLedgerReadCache;
68172
68206
  var LEDGER_CACHE_TTL_MS;
68173
68207
  var ledgerImportStoreRef;
68174
68208
  var ledgerImportDone;
@@ -68183,6 +68217,7 @@ CREATE TABLE IF NOT EXISTS sq_archive (
68183
68217
  init_logger();
68184
68218
  init_mesh_ledger_paths();
68185
68219
  ledgerReadCache = /* @__PURE__ */ new Map();
68220
+ filteredLedgerReadCache = /* @__PURE__ */ new Map();
68186
68221
  LEDGER_CACHE_TTL_MS = 3e4;
68187
68222
  ledgerImportDone = /* @__PURE__ */ new Set();
68188
68223
  ledgerScanStats = {
@@ -68791,12 +68826,10 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
68791
68826
  const kinds = opts?.kind?.length ? opts.kind : void 0;
68792
68827
  if (!hasSince && !kinds) return getCachedRawEntries(meshId);
68793
68828
  try {
68794
- const entries = readLedgerFromStore(meshId, {
68829
+ return getCachedFilteredRawEntries(meshId, {
68795
68830
  ...hasSince ? { since: opts.since } : {},
68796
68831
  ...kinds ? { kinds } : {}
68797
68832
  });
68798
- recordLedgerPushdownScan(entries.length);
68799
- return entries;
68800
68833
  } catch {
68801
68834
  return getCachedRawEntries(meshId);
68802
68835
  }