@adhdev/daemon-core 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
@@ -791,10 +791,10 @@ function readInjected(value) {
791
791
  }
792
792
  function getDaemonBuildInfo() {
793
793
  if (cached) return cached;
794
- const commit = readInjected(true ? "5a496bfb562636720786b97880c617ebcd15fe64" : void 0) ?? "unknown";
795
- const commitShort = readInjected(true ? "5a496bf" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
796
- const version = readInjected(true ? "1.0.20" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
797
- const builtAt = readInjected(true ? "2026-07-23T08:01:01.842Z" : void 0);
794
+ const commit = readInjected(true ? "b1bd89943b6b0712dcb65b1ad584fffbb78a8f94" : void 0) ?? "unknown";
795
+ const commitShort = readInjected(true ? "b1bd8994" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
796
+ const version = readInjected(true ? "1.0.21-rc.1" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
797
+ const builtAt = readInjected(true ? "2026-07-23T10:48:36.841Z" : void 0);
798
798
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
799
799
  return cached;
800
800
  }
@@ -5009,7 +5009,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
5009
5009
  if (args.worktreeHasQueuedTask) {
5010
5010
  return `${prefix} The worktree is ready; a queued task targeting this node will auto-claim it \u2014 no manual \`mesh_launch_session\` needed.`;
5011
5011
  }
5012
- return `${prefix} The worktree is ready \u2014 use \`mesh_launch_session\` to start an agent.`;
5012
+ 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.`;
5013
5013
  }
5014
5014
  if (args.event === "worktree_bootstrap_failed") {
5015
5015
  const error = readNonEmptyString(args.metadataEvent.error);
@@ -47108,6 +47108,119 @@ function executeNativeHistory(cfg, input) {
47108
47108
  if (cfg.source.kind === "sqlite") return executeSqlite(cfg.source, input);
47109
47109
  return null;
47110
47110
  }
47111
+ function executeNativeHistoryList(cfg, input) {
47112
+ if (!cfg?.source) return null;
47113
+ if (cfg.source.kind !== "jsonl") return null;
47114
+ return { sessions: enumerateJsonlSessions(cfg.source, input ?? {}) };
47115
+ }
47116
+ function enumerateJsonlSessions(src, input) {
47117
+ const files = enumerateSessionFiles(src, input);
47118
+ const shapes = compileRecordShapes(src);
47119
+ const out = [];
47120
+ const seen = /* @__PURE__ */ new Set();
47121
+ for (const filePath of files) {
47122
+ const item = summarizeSessionFile(src, filePath, shapes);
47123
+ if (!item) continue;
47124
+ const key2 = item.historySessionId.toLowerCase();
47125
+ if (seen.has(key2)) {
47126
+ const existing = out.find((s2) => s2.historySessionId.toLowerCase() === key2);
47127
+ if (existing && item.sourceMtimeMs > existing.sourceMtimeMs) {
47128
+ out[out.indexOf(existing)] = item;
47129
+ }
47130
+ continue;
47131
+ }
47132
+ seen.add(key2);
47133
+ out.push(item);
47134
+ }
47135
+ out.sort((a, b) => b.lastMessageAt - a.lastMessageAt);
47136
+ return out;
47137
+ }
47138
+ function enumerateSessionFiles(src, input) {
47139
+ const expandedRoot = expandTemplateRootForEnumeration(src.path, input);
47140
+ if (!expandedRoot) return [];
47141
+ let dirTemplate;
47142
+ let fileRegex;
47143
+ if (src.file_pattern) {
47144
+ dirTemplate = templateVarsToGlob(expandedRoot);
47145
+ fileRegex = globToRegex(src.file_pattern);
47146
+ } else {
47147
+ const idx = expandedRoot.lastIndexOf("/");
47148
+ const dirPart = idx >= 0 ? expandedRoot.slice(0, idx) : "";
47149
+ const leaf = idx >= 0 ? expandedRoot.slice(idx + 1) : expandedRoot;
47150
+ dirTemplate = templateVarsToGlob(dirPart);
47151
+ fileRegex = globToRegex(templateVarsToGlob(leaf));
47152
+ }
47153
+ const dirs = expandDirGlob(dirTemplate);
47154
+ const files = [];
47155
+ for (const d of dirs) {
47156
+ for (const p of listMatchingFiles(d, fileRegex)) files.push(p);
47157
+ }
47158
+ return files;
47159
+ }
47160
+ function expandTemplateRootForEnumeration(template, input) {
47161
+ if (!template) return "";
47162
+ let out = template;
47163
+ if (out.startsWith("~/") || out === "~") out = path25.join(os19.homedir(), out.slice(2));
47164
+ out = out.replace(/\$\{([A-Z_][A-Z0-9_]*)(?::-(.*?))?\}/g, (_m, name, fallback) => {
47165
+ const v = input.envOverrides?.[name] ?? process.env[name];
47166
+ return v != null && v !== "" ? v : fallback ?? "";
47167
+ });
47168
+ if (out.startsWith("~/")) out = path25.join(os19.homedir(), out.slice(2));
47169
+ return out;
47170
+ }
47171
+ function templateVarsToGlob(template) {
47172
+ return template.replace(/\{[a-zA-Z_][a-zA-Z0-9_]*\}/g, "*");
47173
+ }
47174
+ function sessionIdForFile(src, filePath) {
47175
+ if (src.session_id_from === "first_record" && src.session_id_path) {
47176
+ const lines = readJsonlLines(filePath);
47177
+ if (lines.length > 0) {
47178
+ const v = jsonPathGet(lines[0], src.session_id_path);
47179
+ if (typeof v === "string" && v) return v;
47180
+ }
47181
+ return "";
47182
+ }
47183
+ if (src.session_id_from === "dir_uuid") {
47184
+ return dirUuid(filePath) || "";
47185
+ }
47186
+ return filenameUuid(filePath);
47187
+ }
47188
+ function summarizeSessionFile(src, filePath, shapes) {
47189
+ const historySessionId = sessionIdForFile(src, filePath);
47190
+ if (!historySessionId) return null;
47191
+ const mtime = safeMtimeMs(filePath);
47192
+ const lines = readJsonlLines(filePath);
47193
+ if (lines.length === 0) return null;
47194
+ let messageCount = 0;
47195
+ let first = null;
47196
+ let last = null;
47197
+ let lastNonTool = null;
47198
+ for (let i = 0; i < lines.length; i += 1) {
47199
+ const rec = lines[i];
47200
+ const shape = shapes.pick(rec);
47201
+ if (!shape) continue;
47202
+ for (const msg of projectMessages(rec, shape.map, i, lines.length, mtime)) {
47203
+ messageCount += 1;
47204
+ if (!first) first = msg;
47205
+ last = msg;
47206
+ if (msg.kind !== "tool") lastNonTool = msg;
47207
+ }
47208
+ }
47209
+ if (messageCount === 0 || !first || !last) return null;
47210
+ const workspace = readSessionMetaWorkspace(lines) ?? (src.workspace_from_sidecar ? readSidecarWorkspace(filePath, src.workspace_from_sidecar) : void 0);
47211
+ const previewMsg = lastNonTool ?? last;
47212
+ return {
47213
+ historySessionId,
47214
+ sessionTitle: previewMsg.content || void 0,
47215
+ messageCount,
47216
+ firstMessageAt: first.receivedAt || mtime,
47217
+ lastMessageAt: last.receivedAt || first.receivedAt || mtime,
47218
+ preview: previewMsg.content || void 0,
47219
+ workspace,
47220
+ sourcePath: filePath,
47221
+ sourceMtimeMs: mtime
47222
+ };
47223
+ }
47111
47224
  function executeJsonl(src, input) {
47112
47225
  const sourcePath = resolveJsonlSourcePath(src, input);
47113
47226
  if (!sourcePath) {
@@ -58964,10 +59077,14 @@ var ProviderLoader = class _ProviderLoader {
58964
59077
  }
58965
59078
  if (nh) {
58966
59079
  let reader = null;
59080
+ let lister = null;
58967
59081
  let format = "spec";
58968
59082
  if (nh.source) {
58969
59083
  format = `spec-${nh.source.kind}`;
58970
59084
  reader = (input) => executeNativeHistory(nh, input);
59085
+ if (nh.source.kind === "jsonl") {
59086
+ lister = (input) => executeNativeHistoryList(nh, input);
59087
+ }
58971
59088
  } else if (nh.override_path) {
58972
59089
  const overrideFile = path46.resolve(providerDir, nh.override_path);
58973
59090
  if (fs44.existsSync(overrideFile)) {
@@ -58991,10 +59108,15 @@ var ProviderLoader = class _ProviderLoader {
58991
59108
  if (reader) {
58992
59109
  resolved.scripts = { ...resolved.scripts || {} };
58993
59110
  resolved.scripts.readNativeHistory = reader;
59111
+ const scriptsMarker = { readSession: "readNativeHistory" };
59112
+ if (lister) {
59113
+ resolved.scripts.listNativeHistory = lister;
59114
+ scriptsMarker.listSessions = "listNativeHistory";
59115
+ }
58994
59116
  resolved.nativeHistory = {
58995
59117
  format,
58996
59118
  watchPath: void 0,
58997
- scripts: { readSession: "readNativeHistory" },
59119
+ scripts: scriptsMarker,
58998
59120
  mode: "native-source"
58999
59121
  };
59000
59122
  }