@adhdev/daemon-core 0.9.82-rc.314 → 0.9.82-rc.315

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
@@ -316,10 +316,10 @@ function readInjected(value) {
316
316
  }
317
317
  function getDaemonBuildInfo() {
318
318
  if (cached) return cached;
319
- const commit = readInjected(true ? "f236ed7432cf04dbcfd2e530fa6c69e77e809c80" : void 0) ?? "unknown";
320
- const commitShort = readInjected(true ? "f236ed74" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
- const version = readInjected(true ? "0.9.82-rc.314" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
- const builtAt = readInjected(true ? "2026-06-18T04:15:40.033Z" : void 0);
319
+ const commit = readInjected(true ? "e28347641639c9d0a1e46a6141e3cfed2bc90ac2" : void 0) ?? "unknown";
320
+ const commitShort = readInjected(true ? "e2834764" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
+ const version = readInjected(true ? "0.9.82-rc.315" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
+ const builtAt = readInjected(true ? "2026-06-18T05:47:44.462Z" : void 0);
323
323
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
324
324
  return cached;
325
325
  }
@@ -31399,6 +31399,7 @@ function collectStableSizes(when, sizes) {
31399
31399
  var fs12 = __toESM(require("fs"));
31400
31400
  var os17 = __toESM(require("os"));
31401
31401
  var path21 = __toESM(require("path"));
31402
+ init_logger();
31402
31403
  var UUID_RE = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;
31403
31404
  function executeNativeHistory(cfg, input) {
31404
31405
  if (!cfg?.source) return null;
@@ -31431,8 +31432,33 @@ function executeJsonl(src, input) {
31431
31432
  if (!sourcePath && hasDateTemplateSegment(src.path)) {
31432
31433
  sourcePath = pickExactSessionFileAcrossDateWindow(src.path, input, filePat, requestedSessionId) || (requestedSessionId ? null : pickSessionBoundFileAcrossDateWindow(src.path, input, filePat, windowMs, sessionFloor, workspaceHint)) || (requestedSessionId ? null : newestRecentFileAcrossDateWindow(src.path, input, filePat, windowMs, sessionFloor));
31433
31434
  }
31435
+ if (!sourcePath && !hasDateTemplateSegment(src.path)) {
31436
+ const resolvedRaw = expandPath2(src.path, input, { skipWorkspaceRealpath: true });
31437
+ if (resolvedRaw && resolvedRaw !== resolved) {
31438
+ try {
31439
+ const rawStat = fs12.statSync(resolvedRaw);
31440
+ if (rawStat.isFile()) sourcePath = resolvedRaw;
31441
+ else if (rawStat.isDirectory()) {
31442
+ sourcePath = pickExactSessionFile(resolvedRaw, filePat, requestedSessionId) || (requestedSessionId ? null : newestRecentFile(resolvedRaw, filePat, windowMs, sessionFloor));
31443
+ }
31444
+ } catch {
31445
+ }
31446
+ }
31447
+ }
31448
+ if (!sourcePath && requestedSessionId) {
31449
+ sourcePath = scanProjectsRootForSessionFile(src.path, input, requestedSessionId);
31450
+ }
31451
+ }
31452
+ if (!sourcePath) {
31453
+ const wsRaw = typeof input.workspace === "string" ? input.workspace : "";
31454
+ let wsReal = wsRaw;
31455
+ try {
31456
+ if (wsRaw) wsReal = fs12.realpathSync(wsRaw);
31457
+ } catch {
31458
+ }
31459
+ LOG.debug("NativeHistory", `jsonl unresolved: tried=${JSON.stringify(resolved)} sessionId=${requestedSessionId || "(none)"} wsRaw=${JSON.stringify(wsRaw)} wsReal=${JSON.stringify(wsReal)} rawSlug=${JSON.stringify(claudeProjectDirName(wsRaw))} realSlug=${JSON.stringify(claudeProjectDirName(wsReal))} (concrete miss + raw-slug retry + projects scan all failed)`);
31460
+ return null;
31434
31461
  }
31435
- if (!sourcePath) return null;
31436
31462
  const mtime = safeMtimeMs(sourcePath);
31437
31463
  const lines = readJsonlLines(sourcePath);
31438
31464
  if (lines.length === 0) return null;
@@ -31551,7 +31577,7 @@ function executeSqlite(src, input) {
31551
31577
  }
31552
31578
  }
31553
31579
  }
31554
- function expandPath2(template, input) {
31580
+ function expandPath2(template, input, opts) {
31555
31581
  if (!template) return null;
31556
31582
  let out = template;
31557
31583
  if (out.startsWith("~/") || out === "~") {
@@ -31565,7 +31591,7 @@ function expandPath2(template, input) {
31565
31591
  const now = /* @__PURE__ */ new Date();
31566
31592
  const workspaceRaw = input.workspace ?? "";
31567
31593
  let workspaceResolved = workspaceRaw;
31568
- if (workspaceRaw) {
31594
+ if (workspaceRaw && !opts?.skipWorkspaceRealpath) {
31569
31595
  try {
31570
31596
  workspaceResolved = fs12.realpathSync(workspaceRaw);
31571
31597
  } catch {
@@ -31592,6 +31618,50 @@ function expandPath2(template, input) {
31592
31618
  function claudeProjectDirName(workspace) {
31593
31619
  return workspace.replace(/[^A-Za-z0-9_-]/g, "-");
31594
31620
  }
31621
+ function scanProjectsRootForSessionFile(template, input, requestedSessionId) {
31622
+ if (!requestedSessionId) return null;
31623
+ let head = template;
31624
+ if (head.startsWith("~/") || head === "~") head = path21.join(os17.homedir(), head.slice(2));
31625
+ const segs = head.split("/");
31626
+ const baseParts = [];
31627
+ for (const seg of segs) {
31628
+ if (/[{}*?]/.test(seg)) break;
31629
+ baseParts.push(seg);
31630
+ }
31631
+ const base = baseParts.join("/");
31632
+ if (!base) return null;
31633
+ let baseStat = null;
31634
+ try {
31635
+ baseStat = fs12.statSync(base);
31636
+ } catch {
31637
+ return null;
31638
+ }
31639
+ if (!baseStat.isDirectory()) return null;
31640
+ const needle = `${requestedSessionId.toLowerCase()}.jsonl`;
31641
+ const dirsToScan = [base];
31642
+ try {
31643
+ for (const entry of fs12.readdirSync(base, { withFileTypes: true })) {
31644
+ if (entry.isDirectory()) dirsToScan.push(path21.join(base, entry.name));
31645
+ }
31646
+ } catch {
31647
+ }
31648
+ for (const dir of dirsToScan) {
31649
+ let entries;
31650
+ try {
31651
+ entries = fs12.readdirSync(dir, { withFileTypes: true });
31652
+ } catch {
31653
+ continue;
31654
+ }
31655
+ for (const entry of entries) {
31656
+ if (!entry.isFile()) continue;
31657
+ if (entry.name.toLowerCase() !== needle) continue;
31658
+ const found = path21.join(dir, entry.name);
31659
+ LOG.debug("NativeHistory", `jsonl scan-fallback hit: sessionId=${requestedSessionId} resolved via projects-root scan \u2192 ${JSON.stringify(found)} (slug-derived path missed; likely realpath/slug divergence)`);
31660
+ return found;
31661
+ }
31662
+ }
31663
+ return null;
31664
+ }
31595
31665
  function globToRegex(pattern) {
31596
31666
  const re = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]");
31597
31667
  return new RegExp(`^${re}$`);