@adhdev/daemon-standalone 1.0.19 → 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
@@ -32505,6 +32505,7 @@ var require_dist3 = __commonJS({
32505
32505
  return { active: true, strategy: mode.strategy, modeId: mode.id };
32506
32506
  }
32507
32507
  function resolveProviderAutoApproveMode(provider, settings) {
32508
+ if (!provider) return inactiveMode();
32508
32509
  const config2 = provider.autoApproveModes;
32509
32510
  const explicitModeId = settings?.autoApproveMode;
32510
32511
  if (typeof explicitModeId === "string") {
@@ -33261,10 +33262,10 @@ var require_dist3 = __commonJS({
33261
33262
  }
33262
33263
  function getDaemonBuildInfo() {
33263
33264
  if (cached2) return cached2;
33264
- const commit = readInjected(true ? "091e33a4eb10f721c794790bbf09f7e18639190f" : void 0) ?? "unknown";
33265
- const commitShort = readInjected(true ? "091e33a" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
33266
- const version2 = readInjected(true ? "1.0.19" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
33267
- const builtAt = readInjected(true ? "2026-07-23T07:36:28.241Z" : 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);
33268
33269
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
33269
33270
  return cached2;
33270
33271
  }
@@ -37512,7 +37513,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
37512
37513
  if (args.worktreeHasQueuedTask) {
37513
37514
  return `${prefix} The worktree is ready; a queued task targeting this node will auto-claim it \u2014 no manual \`mesh_launch_session\` needed.`;
37514
37515
  }
37515
- 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.`;
37516
37517
  }
37517
37518
  if (args.event === "worktree_bootstrap_failed") {
37518
37519
  const error48 = readNonEmptyString(args.metadataEvent.error);
@@ -79569,6 +79570,119 @@ ${body}
79569
79570
  if (cfg.source.kind === "sqlite") return executeSqlite(cfg.source, input);
79570
79571
  return null;
79571
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
+ }
79572
79686
  function executeJsonl(src, input) {
79573
79687
  const sourcePath = resolveJsonlSourcePath(src, input);
79574
79688
  if (!sourcePath) {
@@ -91365,10 +91479,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
91365
91479
  }
91366
91480
  if (nh) {
91367
91481
  let reader = null;
91482
+ let lister = null;
91368
91483
  let format = "spec";
91369
91484
  if (nh.source) {
91370
91485
  format = `spec-${nh.source.kind}`;
91371
91486
  reader = (input) => executeNativeHistory(nh, input);
91487
+ if (nh.source.kind === "jsonl") {
91488
+ lister = (input) => executeNativeHistoryList(nh, input);
91489
+ }
91372
91490
  } else if (nh.override_path) {
91373
91491
  const overrideFile = path46.resolve(providerDir, nh.override_path);
91374
91492
  if (fs44.existsSync(overrideFile)) {
@@ -91392,10 +91510,15 @@ Run 'adhdev doctor' for detailed diagnostics.`
91392
91510
  if (reader) {
91393
91511
  resolved.scripts = { ...resolved.scripts || {} };
91394
91512
  resolved.scripts.readNativeHistory = reader;
91513
+ const scriptsMarker = { readSession: "readNativeHistory" };
91514
+ if (lister) {
91515
+ resolved.scripts.listNativeHistory = lister;
91516
+ scriptsMarker.listSessions = "listNativeHistory";
91517
+ }
91395
91518
  resolved.nativeHistory = {
91396
91519
  format,
91397
91520
  watchPath: void 0,
91398
- scripts: { readSession: "readNativeHistory" },
91521
+ scripts: scriptsMarker,
91399
91522
  mode: "native-source"
91400
91523
  };
91401
91524
  }