@adhdev/daemon-core 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
@@ -51,6 +51,7 @@ function resolveConfiguredMode(provider, mode, settings) {
51
51
  return { active: true, strategy: mode.strategy, modeId: mode.id };
52
52
  }
53
53
  function resolveProviderAutoApproveMode(provider, settings) {
54
+ if (!provider) return inactiveMode();
54
55
  const config = provider.autoApproveModes;
55
56
  const explicitModeId = settings?.autoApproveMode;
56
57
  if (typeof explicitModeId === "string") {
@@ -790,10 +791,10 @@ function readInjected(value) {
790
791
  }
791
792
  function getDaemonBuildInfo() {
792
793
  if (cached) return cached;
793
- const commit = readInjected(true ? "091e33a4eb10f721c794790bbf09f7e18639190f" : void 0) ?? "unknown";
794
- const commitShort = readInjected(true ? "091e33a" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
795
- const version = readInjected(true ? "1.0.19" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
796
- const builtAt = readInjected(true ? "2026-07-23T07:36:28.241Z" : 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);
797
798
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
798
799
  return cached;
799
800
  }
@@ -5008,7 +5009,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
5008
5009
  if (args.worktreeHasQueuedTask) {
5009
5010
  return `${prefix} The worktree is ready; a queued task targeting this node will auto-claim it \u2014 no manual \`mesh_launch_session\` needed.`;
5010
5011
  }
5011
- 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.`;
5012
5013
  }
5013
5014
  if (args.event === "worktree_bootstrap_failed") {
5014
5015
  const error = readNonEmptyString(args.metadataEvent.error);
@@ -47107,6 +47108,119 @@ function executeNativeHistory(cfg, input) {
47107
47108
  if (cfg.source.kind === "sqlite") return executeSqlite(cfg.source, input);
47108
47109
  return null;
47109
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
+ }
47110
47224
  function executeJsonl(src, input) {
47111
47225
  const sourcePath = resolveJsonlSourcePath(src, input);
47112
47226
  if (!sourcePath) {
@@ -58963,10 +59077,14 @@ var ProviderLoader = class _ProviderLoader {
58963
59077
  }
58964
59078
  if (nh) {
58965
59079
  let reader = null;
59080
+ let lister = null;
58966
59081
  let format = "spec";
58967
59082
  if (nh.source) {
58968
59083
  format = `spec-${nh.source.kind}`;
58969
59084
  reader = (input) => executeNativeHistory(nh, input);
59085
+ if (nh.source.kind === "jsonl") {
59086
+ lister = (input) => executeNativeHistoryList(nh, input);
59087
+ }
58970
59088
  } else if (nh.override_path) {
58971
59089
  const overrideFile = path46.resolve(providerDir, nh.override_path);
58972
59090
  if (fs44.existsSync(overrideFile)) {
@@ -58990,10 +59108,15 @@ var ProviderLoader = class _ProviderLoader {
58990
59108
  if (reader) {
58991
59109
  resolved.scripts = { ...resolved.scripts || {} };
58992
59110
  resolved.scripts.readNativeHistory = reader;
59111
+ const scriptsMarker = { readSession: "readNativeHistory" };
59112
+ if (lister) {
59113
+ resolved.scripts.listNativeHistory = lister;
59114
+ scriptsMarker.listSessions = "listNativeHistory";
59115
+ }
58993
59116
  resolved.nativeHistory = {
58994
59117
  format,
58995
59118
  watchPath: void 0,
58996
- scripts: { readSession: "readNativeHistory" },
59119
+ scripts: scriptsMarker,
58997
59120
  mode: "native-source"
58998
59121
  };
58999
59122
  }