@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 +129 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +129 -6
- package/dist/index.mjs.map +1 -1
- package/dist/providers/auto-approve-modes.d.ts +1 -1
- package/dist/providers/spec/native-history-executor.d.ts +38 -0
- package/package.json +3 -3
- package/src/mesh/mesh-events-utils.ts +1 -1
- package/src/providers/auto-approve-modes.ts +7 -1
- package/src/providers/provider-loader.ts +25 -2
- package/src/providers/spec/native-history-executor.ts +211 -0
package/dist/index.mjs
CHANGED
|
@@ -46,6 +46,7 @@ function resolveConfiguredMode(provider, mode, settings) {
|
|
|
46
46
|
return { active: true, strategy: mode.strategy, modeId: mode.id };
|
|
47
47
|
}
|
|
48
48
|
function resolveProviderAutoApproveMode(provider, settings) {
|
|
49
|
+
if (!provider) return inactiveMode();
|
|
49
50
|
const config = provider.autoApproveModes;
|
|
50
51
|
const explicitModeId = settings?.autoApproveMode;
|
|
51
52
|
if (typeof explicitModeId === "string") {
|
|
@@ -785,10 +786,10 @@ function readInjected(value) {
|
|
|
785
786
|
}
|
|
786
787
|
function getDaemonBuildInfo() {
|
|
787
788
|
if (cached) return cached;
|
|
788
|
-
const commit = readInjected(true ? "
|
|
789
|
-
const commitShort = readInjected(true ? "
|
|
790
|
-
const version = readInjected(true ? "1.0.
|
|
791
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
789
|
+
const commit = readInjected(true ? "b1bd89943b6b0712dcb65b1ad584fffbb78a8f94" : void 0) ?? "unknown";
|
|
790
|
+
const commitShort = readInjected(true ? "b1bd8994" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
791
|
+
const version = readInjected(true ? "1.0.21-rc.1" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
792
|
+
const builtAt = readInjected(true ? "2026-07-23T10:48:36.841Z" : void 0);
|
|
792
793
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
793
794
|
return cached;
|
|
794
795
|
}
|
|
@@ -5001,7 +5002,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
5001
5002
|
if (args.worktreeHasQueuedTask) {
|
|
5002
5003
|
return `${prefix} The worktree is ready; a queued task targeting this node will auto-claim it \u2014 no manual \`mesh_launch_session\` needed.`;
|
|
5003
5004
|
}
|
|
5004
|
-
return `${prefix} The worktree is ready \u2014
|
|
5005
|
+
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.`;
|
|
5005
5006
|
}
|
|
5006
5007
|
if (args.event === "worktree_bootstrap_failed") {
|
|
5007
5008
|
const error = readNonEmptyString(args.metadataEvent.error);
|
|
@@ -46671,6 +46672,119 @@ function executeNativeHistory(cfg, input) {
|
|
|
46671
46672
|
if (cfg.source.kind === "sqlite") return executeSqlite(cfg.source, input);
|
|
46672
46673
|
return null;
|
|
46673
46674
|
}
|
|
46675
|
+
function executeNativeHistoryList(cfg, input) {
|
|
46676
|
+
if (!cfg?.source) return null;
|
|
46677
|
+
if (cfg.source.kind !== "jsonl") return null;
|
|
46678
|
+
return { sessions: enumerateJsonlSessions(cfg.source, input ?? {}) };
|
|
46679
|
+
}
|
|
46680
|
+
function enumerateJsonlSessions(src, input) {
|
|
46681
|
+
const files = enumerateSessionFiles(src, input);
|
|
46682
|
+
const shapes = compileRecordShapes(src);
|
|
46683
|
+
const out = [];
|
|
46684
|
+
const seen = /* @__PURE__ */ new Set();
|
|
46685
|
+
for (const filePath of files) {
|
|
46686
|
+
const item = summarizeSessionFile(src, filePath, shapes);
|
|
46687
|
+
if (!item) continue;
|
|
46688
|
+
const key2 = item.historySessionId.toLowerCase();
|
|
46689
|
+
if (seen.has(key2)) {
|
|
46690
|
+
const existing = out.find((s2) => s2.historySessionId.toLowerCase() === key2);
|
|
46691
|
+
if (existing && item.sourceMtimeMs > existing.sourceMtimeMs) {
|
|
46692
|
+
out[out.indexOf(existing)] = item;
|
|
46693
|
+
}
|
|
46694
|
+
continue;
|
|
46695
|
+
}
|
|
46696
|
+
seen.add(key2);
|
|
46697
|
+
out.push(item);
|
|
46698
|
+
}
|
|
46699
|
+
out.sort((a, b) => b.lastMessageAt - a.lastMessageAt);
|
|
46700
|
+
return out;
|
|
46701
|
+
}
|
|
46702
|
+
function enumerateSessionFiles(src, input) {
|
|
46703
|
+
const expandedRoot = expandTemplateRootForEnumeration(src.path, input);
|
|
46704
|
+
if (!expandedRoot) return [];
|
|
46705
|
+
let dirTemplate;
|
|
46706
|
+
let fileRegex;
|
|
46707
|
+
if (src.file_pattern) {
|
|
46708
|
+
dirTemplate = templateVarsToGlob(expandedRoot);
|
|
46709
|
+
fileRegex = globToRegex(src.file_pattern);
|
|
46710
|
+
} else {
|
|
46711
|
+
const idx = expandedRoot.lastIndexOf("/");
|
|
46712
|
+
const dirPart = idx >= 0 ? expandedRoot.slice(0, idx) : "";
|
|
46713
|
+
const leaf = idx >= 0 ? expandedRoot.slice(idx + 1) : expandedRoot;
|
|
46714
|
+
dirTemplate = templateVarsToGlob(dirPart);
|
|
46715
|
+
fileRegex = globToRegex(templateVarsToGlob(leaf));
|
|
46716
|
+
}
|
|
46717
|
+
const dirs = expandDirGlob(dirTemplate);
|
|
46718
|
+
const files = [];
|
|
46719
|
+
for (const d of dirs) {
|
|
46720
|
+
for (const p of listMatchingFiles(d, fileRegex)) files.push(p);
|
|
46721
|
+
}
|
|
46722
|
+
return files;
|
|
46723
|
+
}
|
|
46724
|
+
function expandTemplateRootForEnumeration(template, input) {
|
|
46725
|
+
if (!template) return "";
|
|
46726
|
+
let out = template;
|
|
46727
|
+
if (out.startsWith("~/") || out === "~") out = path25.join(os19.homedir(), out.slice(2));
|
|
46728
|
+
out = out.replace(/\$\{([A-Z_][A-Z0-9_]*)(?::-(.*?))?\}/g, (_m, name, fallback) => {
|
|
46729
|
+
const v = input.envOverrides?.[name] ?? process.env[name];
|
|
46730
|
+
return v != null && v !== "" ? v : fallback ?? "";
|
|
46731
|
+
});
|
|
46732
|
+
if (out.startsWith("~/")) out = path25.join(os19.homedir(), out.slice(2));
|
|
46733
|
+
return out;
|
|
46734
|
+
}
|
|
46735
|
+
function templateVarsToGlob(template) {
|
|
46736
|
+
return template.replace(/\{[a-zA-Z_][a-zA-Z0-9_]*\}/g, "*");
|
|
46737
|
+
}
|
|
46738
|
+
function sessionIdForFile(src, filePath) {
|
|
46739
|
+
if (src.session_id_from === "first_record" && src.session_id_path) {
|
|
46740
|
+
const lines = readJsonlLines(filePath);
|
|
46741
|
+
if (lines.length > 0) {
|
|
46742
|
+
const v = jsonPathGet(lines[0], src.session_id_path);
|
|
46743
|
+
if (typeof v === "string" && v) return v;
|
|
46744
|
+
}
|
|
46745
|
+
return "";
|
|
46746
|
+
}
|
|
46747
|
+
if (src.session_id_from === "dir_uuid") {
|
|
46748
|
+
return dirUuid(filePath) || "";
|
|
46749
|
+
}
|
|
46750
|
+
return filenameUuid(filePath);
|
|
46751
|
+
}
|
|
46752
|
+
function summarizeSessionFile(src, filePath, shapes) {
|
|
46753
|
+
const historySessionId = sessionIdForFile(src, filePath);
|
|
46754
|
+
if (!historySessionId) return null;
|
|
46755
|
+
const mtime = safeMtimeMs(filePath);
|
|
46756
|
+
const lines = readJsonlLines(filePath);
|
|
46757
|
+
if (lines.length === 0) return null;
|
|
46758
|
+
let messageCount = 0;
|
|
46759
|
+
let first = null;
|
|
46760
|
+
let last = null;
|
|
46761
|
+
let lastNonTool = null;
|
|
46762
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
46763
|
+
const rec = lines[i];
|
|
46764
|
+
const shape = shapes.pick(rec);
|
|
46765
|
+
if (!shape) continue;
|
|
46766
|
+
for (const msg of projectMessages(rec, shape.map, i, lines.length, mtime)) {
|
|
46767
|
+
messageCount += 1;
|
|
46768
|
+
if (!first) first = msg;
|
|
46769
|
+
last = msg;
|
|
46770
|
+
if (msg.kind !== "tool") lastNonTool = msg;
|
|
46771
|
+
}
|
|
46772
|
+
}
|
|
46773
|
+
if (messageCount === 0 || !first || !last) return null;
|
|
46774
|
+
const workspace = readSessionMetaWorkspace(lines) ?? (src.workspace_from_sidecar ? readSidecarWorkspace(filePath, src.workspace_from_sidecar) : void 0);
|
|
46775
|
+
const previewMsg = lastNonTool ?? last;
|
|
46776
|
+
return {
|
|
46777
|
+
historySessionId,
|
|
46778
|
+
sessionTitle: previewMsg.content || void 0,
|
|
46779
|
+
messageCount,
|
|
46780
|
+
firstMessageAt: first.receivedAt || mtime,
|
|
46781
|
+
lastMessageAt: last.receivedAt || first.receivedAt || mtime,
|
|
46782
|
+
preview: previewMsg.content || void 0,
|
|
46783
|
+
workspace,
|
|
46784
|
+
sourcePath: filePath,
|
|
46785
|
+
sourceMtimeMs: mtime
|
|
46786
|
+
};
|
|
46787
|
+
}
|
|
46674
46788
|
function executeJsonl(src, input) {
|
|
46675
46789
|
const sourcePath = resolveJsonlSourcePath(src, input);
|
|
46676
46790
|
if (!sourcePath) {
|
|
@@ -58532,10 +58646,14 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
58532
58646
|
}
|
|
58533
58647
|
if (nh) {
|
|
58534
58648
|
let reader = null;
|
|
58649
|
+
let lister = null;
|
|
58535
58650
|
let format = "spec";
|
|
58536
58651
|
if (nh.source) {
|
|
58537
58652
|
format = `spec-${nh.source.kind}`;
|
|
58538
58653
|
reader = (input) => executeNativeHistory(nh, input);
|
|
58654
|
+
if (nh.source.kind === "jsonl") {
|
|
58655
|
+
lister = (input) => executeNativeHistoryList(nh, input);
|
|
58656
|
+
}
|
|
58539
58657
|
} else if (nh.override_path) {
|
|
58540
58658
|
const overrideFile = path46.resolve(providerDir, nh.override_path);
|
|
58541
58659
|
if (fs44.existsSync(overrideFile)) {
|
|
@@ -58559,10 +58677,15 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
58559
58677
|
if (reader) {
|
|
58560
58678
|
resolved.scripts = { ...resolved.scripts || {} };
|
|
58561
58679
|
resolved.scripts.readNativeHistory = reader;
|
|
58680
|
+
const scriptsMarker = { readSession: "readNativeHistory" };
|
|
58681
|
+
if (lister) {
|
|
58682
|
+
resolved.scripts.listNativeHistory = lister;
|
|
58683
|
+
scriptsMarker.listSessions = "listNativeHistory";
|
|
58684
|
+
}
|
|
58562
58685
|
resolved.nativeHistory = {
|
|
58563
58686
|
format,
|
|
58564
58687
|
watchPath: void 0,
|
|
58565
|
-
scripts:
|
|
58688
|
+
scripts: scriptsMarker,
|
|
58566
58689
|
mode: "native-source"
|
|
58567
58690
|
};
|
|
58568
58691
|
}
|