@adhdev/daemon-standalone 1.0.58-rc.51 → 1.0.58-rc.52

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 ? "8ae4b622b6ab59e300631f175785f024b2cbecb2" : void 0) ?? "unknown";
36915
- const commitShort = readInjected(true ? "8ae4b622" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36916
- const version2 = readInjected(true ? "1.0.58-rc.51" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36917
- const builtAt = readInjected(true ? "2026-08-30T15:26:29.414Z" : void 0);
36914
+ const commit = readInjected(true ? "c22db1ad4f39b893ea616443b03c74af32413884" : void 0) ?? "unknown";
36915
+ const commitShort = readInjected(true ? "c22db1ad" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36916
+ const version2 = readInjected(true ? "1.0.58-rc.52" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36917
+ const builtAt = readInjected(true ? "2026-08-30T15:59:23.773Z" : void 0);
36918
36918
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
36919
36919
  return cached2;
36920
36920
  }
@@ -122929,21 +122929,64 @@ ${marker}`,
122929
122929
  }
122930
122930
  return attrs;
122931
122931
  }
122932
+ var TAIL_JSONL_CACHE_MAX_ENTRIES = 8;
122933
+ var TAIL_JSONL_CACHE_MAX_SOURCE_BYTES = 16 * 1024 * 1024;
122934
+ var tailJsonlCache = /* @__PURE__ */ new Map();
122935
+ var tailJsonlCacheSourceBytes = 0;
122936
+ var tailJsonlCacheStats = { hits: 0, misses: 0, fileReads: 0, parsePasses: 0 };
122937
+ function tailJsonlSignature(stat2) {
122938
+ return `${stat2.dev}:${stat2.ino}:${stat2.size}:${stat2.mtimeMs}:${stat2.ctimeMs}`;
122939
+ }
122940
+ function storeTailJsonlCache(p, entry) {
122941
+ const prior = tailJsonlCache.get(p);
122942
+ if (prior) tailJsonlCacheSourceBytes -= prior.sourceBytes;
122943
+ tailJsonlCache.delete(p);
122944
+ if (entry.sourceBytes > TAIL_JSONL_CACHE_MAX_SOURCE_BYTES) return;
122945
+ tailJsonlCache.set(p, entry);
122946
+ tailJsonlCacheSourceBytes += entry.sourceBytes;
122947
+ while (tailJsonlCache.size > TAIL_JSONL_CACHE_MAX_ENTRIES || tailJsonlCacheSourceBytes > TAIL_JSONL_CACHE_MAX_SOURCE_BYTES) {
122948
+ const oldestKey = tailJsonlCache.keys().next().value;
122949
+ if (oldestKey === void 0) break;
122950
+ const oldest = tailJsonlCache.get(oldestKey);
122951
+ if (oldest) tailJsonlCacheSourceBytes -= oldest.sourceBytes;
122952
+ tailJsonlCache.delete(oldestKey);
122953
+ }
122954
+ }
122932
122955
  function readTailJsonlLines(filePath, maxBytes) {
122933
- const stat2 = fs41.statSync(filePath);
122956
+ let stat2;
122957
+ try {
122958
+ stat2 = fs41.statSync(filePath);
122959
+ } catch {
122960
+ return [];
122961
+ }
122962
+ const signature = tailJsonlSignature(stat2);
122963
+ const cached5 = tailJsonlCache.get(filePath);
122964
+ if (cached5?.signature === signature && cached5.maxBytes === maxBytes) {
122965
+ tailJsonlCacheStats.hits++;
122966
+ tailJsonlCache.delete(filePath);
122967
+ tailJsonlCache.set(filePath, cached5);
122968
+ return cached5.lines;
122969
+ }
122970
+ tailJsonlCacheStats.misses++;
122934
122971
  const size = stat2.size;
122935
122972
  const start = size > maxBytes ? size - maxBytes : 0;
122936
122973
  const length = size - start;
122937
- if (length <= 0) return [];
122938
- const fd = fs41.openSync(filePath, "r");
122974
+ if (length <= 0) {
122975
+ const out2 = [];
122976
+ storeTailJsonlCache(filePath, { signature, maxBytes, sourceBytes: size, lines: out2 });
122977
+ return out2;
122978
+ }
122939
122979
  let text;
122980
+ const fd = fs41.openSync(filePath, "r");
122940
122981
  try {
122941
122982
  const buf = Buffer.alloc(length);
122942
122983
  const bytes = fs41.readSync(fd, buf, 0, length, start);
122943
122984
  text = buf.subarray(0, bytes).toString("utf8");
122985
+ tailJsonlCacheStats.fileReads++;
122944
122986
  } finally {
122945
122987
  fs41.closeSync(fd);
122946
122988
  }
122989
+ tailJsonlCacheStats.parsePasses++;
122947
122990
  const rawLines = text.split("\n");
122948
122991
  if (start > 0 && rawLines.length > 0) rawLines.shift();
122949
122992
  const out = [];
@@ -122955,6 +122998,7 @@ ${marker}`,
122955
122998
  } catch {
122956
122999
  }
122957
123000
  }
123001
+ storeTailJsonlCache(filePath, { signature, maxBytes, sourceBytes: size, lines: out });
122958
123002
  return out;
122959
123003
  }
122960
123004
  var USER_RE = /^>\s+(\S.*)$/;