@adhdev/daemon-standalone 1.0.20 → 1.0.21-rc.1

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
@@ -33262,10 +33262,10 @@ var require_dist3 = __commonJS({
33262
33262
  }
33263
33263
  function getDaemonBuildInfo() {
33264
33264
  if (cached2) return cached2;
33265
- const commit = readInjected(true ? "5a496bfb562636720786b97880c617ebcd15fe64" : void 0) ?? "unknown";
33266
- const commitShort = readInjected(true ? "5a496bf" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
33267
- const version2 = readInjected(true ? "1.0.20" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
33268
- const builtAt = readInjected(true ? "2026-07-23T08:01:01.842Z" : void 0);
33265
+ const commit = readInjected(true ? "b1bd89943b6b0712dcb65b1ad584fffbb78a8f94" : void 0) ?? "unknown";
33266
+ const commitShort = readInjected(true ? "b1bd8994" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
33267
+ const version2 = readInjected(true ? "1.0.21-rc.1" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
33268
+ const builtAt = readInjected(true ? "2026-07-23T10:49:53.964Z" : void 0);
33269
33269
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
33270
33270
  return cached2;
33271
33271
  }
@@ -37513,7 +37513,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
37513
37513
  if (args.worktreeHasQueuedTask) {
37514
37514
  return `${prefix} The worktree is ready; a queued task targeting this node will auto-claim it \u2014 no manual \`mesh_launch_session\` needed.`;
37515
37515
  }
37516
- return `${prefix} The worktree is ready \u2014 use \`mesh_launch_session\` to start an agent.`;
37516
+ return `${prefix} The worktree is ready. If a task is already queued for this worktree, auto-launch will claim it \u2014 no action needed. Launch a session manually only if you need one and none exists yet.`;
37517
37517
  }
37518
37518
  if (args.event === "worktree_bootstrap_failed") {
37519
37519
  const error48 = readNonEmptyString(args.metadataEvent.error);
@@ -79570,6 +79570,119 @@ ${body}
79570
79570
  if (cfg.source.kind === "sqlite") return executeSqlite(cfg.source, input);
79571
79571
  return null;
79572
79572
  }
79573
+ function executeNativeHistoryList(cfg, input) {
79574
+ if (!cfg?.source) return null;
79575
+ if (cfg.source.kind !== "jsonl") return null;
79576
+ return { sessions: enumerateJsonlSessions(cfg.source, input ?? {}) };
79577
+ }
79578
+ function enumerateJsonlSessions(src, input) {
79579
+ const files = enumerateSessionFiles(src, input);
79580
+ const shapes = compileRecordShapes(src);
79581
+ const out = [];
79582
+ const seen = /* @__PURE__ */ new Set();
79583
+ for (const filePath of files) {
79584
+ const item = summarizeSessionFile(src, filePath, shapes);
79585
+ if (!item) continue;
79586
+ const key2 = item.historySessionId.toLowerCase();
79587
+ if (seen.has(key2)) {
79588
+ const existing = out.find((s2) => s2.historySessionId.toLowerCase() === key2);
79589
+ if (existing && item.sourceMtimeMs > existing.sourceMtimeMs) {
79590
+ out[out.indexOf(existing)] = item;
79591
+ }
79592
+ continue;
79593
+ }
79594
+ seen.add(key2);
79595
+ out.push(item);
79596
+ }
79597
+ out.sort((a, b) => b.lastMessageAt - a.lastMessageAt);
79598
+ return out;
79599
+ }
79600
+ function enumerateSessionFiles(src, input) {
79601
+ const expandedRoot = expandTemplateRootForEnumeration(src.path, input);
79602
+ if (!expandedRoot) return [];
79603
+ let dirTemplate;
79604
+ let fileRegex;
79605
+ if (src.file_pattern) {
79606
+ dirTemplate = templateVarsToGlob(expandedRoot);
79607
+ fileRegex = globToRegex(src.file_pattern);
79608
+ } else {
79609
+ const idx = expandedRoot.lastIndexOf("/");
79610
+ const dirPart = idx >= 0 ? expandedRoot.slice(0, idx) : "";
79611
+ const leaf = idx >= 0 ? expandedRoot.slice(idx + 1) : expandedRoot;
79612
+ dirTemplate = templateVarsToGlob(dirPart);
79613
+ fileRegex = globToRegex(templateVarsToGlob(leaf));
79614
+ }
79615
+ const dirs = expandDirGlob(dirTemplate);
79616
+ const files = [];
79617
+ for (const d of dirs) {
79618
+ for (const p of listMatchingFiles(d, fileRegex)) files.push(p);
79619
+ }
79620
+ return files;
79621
+ }
79622
+ function expandTemplateRootForEnumeration(template, input) {
79623
+ if (!template) return "";
79624
+ let out = template;
79625
+ if (out.startsWith("~/") || out === "~") out = path25.join(os19.homedir(), out.slice(2));
79626
+ out = out.replace(/\$\{([A-Z_][A-Z0-9_]*)(?::-(.*?))?\}/g, (_m, name, fallback) => {
79627
+ const v = input.envOverrides?.[name] ?? process.env[name];
79628
+ return v != null && v !== "" ? v : fallback ?? "";
79629
+ });
79630
+ if (out.startsWith("~/")) out = path25.join(os19.homedir(), out.slice(2));
79631
+ return out;
79632
+ }
79633
+ function templateVarsToGlob(template) {
79634
+ return template.replace(/\{[a-zA-Z_][a-zA-Z0-9_]*\}/g, "*");
79635
+ }
79636
+ function sessionIdForFile(src, filePath) {
79637
+ if (src.session_id_from === "first_record" && src.session_id_path) {
79638
+ const lines = readJsonlLines(filePath);
79639
+ if (lines.length > 0) {
79640
+ const v = jsonPathGet(lines[0], src.session_id_path);
79641
+ if (typeof v === "string" && v) return v;
79642
+ }
79643
+ return "";
79644
+ }
79645
+ if (src.session_id_from === "dir_uuid") {
79646
+ return dirUuid(filePath) || "";
79647
+ }
79648
+ return filenameUuid(filePath);
79649
+ }
79650
+ function summarizeSessionFile(src, filePath, shapes) {
79651
+ const historySessionId = sessionIdForFile(src, filePath);
79652
+ if (!historySessionId) return null;
79653
+ const mtime = safeMtimeMs(filePath);
79654
+ const lines = readJsonlLines(filePath);
79655
+ if (lines.length === 0) return null;
79656
+ let messageCount = 0;
79657
+ let first = null;
79658
+ let last = null;
79659
+ let lastNonTool = null;
79660
+ for (let i = 0; i < lines.length; i += 1) {
79661
+ const rec = lines[i];
79662
+ const shape = shapes.pick(rec);
79663
+ if (!shape) continue;
79664
+ for (const msg of projectMessages(rec, shape.map, i, lines.length, mtime)) {
79665
+ messageCount += 1;
79666
+ if (!first) first = msg;
79667
+ last = msg;
79668
+ if (msg.kind !== "tool") lastNonTool = msg;
79669
+ }
79670
+ }
79671
+ if (messageCount === 0 || !first || !last) return null;
79672
+ const workspace = readSessionMetaWorkspace(lines) ?? (src.workspace_from_sidecar ? readSidecarWorkspace(filePath, src.workspace_from_sidecar) : void 0);
79673
+ const previewMsg = lastNonTool ?? last;
79674
+ return {
79675
+ historySessionId,
79676
+ sessionTitle: previewMsg.content || void 0,
79677
+ messageCount,
79678
+ firstMessageAt: first.receivedAt || mtime,
79679
+ lastMessageAt: last.receivedAt || first.receivedAt || mtime,
79680
+ preview: previewMsg.content || void 0,
79681
+ workspace,
79682
+ sourcePath: filePath,
79683
+ sourceMtimeMs: mtime
79684
+ };
79685
+ }
79573
79686
  function executeJsonl(src, input) {
79574
79687
  const sourcePath = resolveJsonlSourcePath(src, input);
79575
79688
  if (!sourcePath) {
@@ -91366,10 +91479,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
91366
91479
  }
91367
91480
  if (nh) {
91368
91481
  let reader = null;
91482
+ let lister = null;
91369
91483
  let format = "spec";
91370
91484
  if (nh.source) {
91371
91485
  format = `spec-${nh.source.kind}`;
91372
91486
  reader = (input) => executeNativeHistory(nh, input);
91487
+ if (nh.source.kind === "jsonl") {
91488
+ lister = (input) => executeNativeHistoryList(nh, input);
91489
+ }
91373
91490
  } else if (nh.override_path) {
91374
91491
  const overrideFile = path46.resolve(providerDir, nh.override_path);
91375
91492
  if (fs44.existsSync(overrideFile)) {
@@ -91393,10 +91510,15 @@ Run 'adhdev doctor' for detailed diagnostics.`
91393
91510
  if (reader) {
91394
91511
  resolved.scripts = { ...resolved.scripts || {} };
91395
91512
  resolved.scripts.readNativeHistory = reader;
91513
+ const scriptsMarker = { readSession: "readNativeHistory" };
91514
+ if (lister) {
91515
+ resolved.scripts.listNativeHistory = lister;
91516
+ scriptsMarker.listSessions = "listNativeHistory";
91517
+ }
91396
91518
  resolved.nativeHistory = {
91397
91519
  format,
91398
91520
  watchPath: void 0,
91399
- scripts: { readSession: "readNativeHistory" },
91521
+ scripts: scriptsMarker,
91400
91522
  mode: "native-source"
91401
91523
  };
91402
91524
  }