@adhdev/daemon-core 0.9.82-rc.535 → 0.9.82-rc.537
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 +103 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -6
- package/dist/index.mjs.map +1 -1
- package/dist/providers/sdk/v1/builders/cli/parse-session.d.ts +13 -0
- package/dist/providers/spec/types.d.ts +17 -0
- package/package.json +3 -3
- package/src/cli-adapters/provider-cli-adapter.ts +7 -0
- package/src/providers/sdk/v1/builders/cli/detect-status.ts +108 -1
- package/src/providers/sdk/v1/builders/cli/parse-session.ts +22 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-transcript-pty-v1.json +1 -1
- package/src/providers/spec/native-history-executor.ts +50 -1
- package/src/providers/spec/types.ts +17 -0
package/dist/index.js
CHANGED
|
@@ -419,10 +419,10 @@ function readInjected(value) {
|
|
|
419
419
|
}
|
|
420
420
|
function getDaemonBuildInfo() {
|
|
421
421
|
if (cached) return cached;
|
|
422
|
-
const commit = readInjected(true ? "
|
|
423
|
-
const commitShort = readInjected(true ? "
|
|
424
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
425
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
422
|
+
const commit = readInjected(true ? "b47ad45cf2b2ad404d911162a9cadd7db2e274a6" : void 0) ?? "unknown";
|
|
423
|
+
const commitShort = readInjected(true ? "b47ad45c" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
424
|
+
const version = readInjected(true ? "0.9.82-rc.537" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
425
|
+
const builtAt = readInjected(true ? "2026-07-15T13:12:55.213Z" : void 0);
|
|
426
426
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
427
427
|
return cached;
|
|
428
428
|
}
|
|
@@ -24551,6 +24551,70 @@ function modalMatches(spec, input) {
|
|
|
24551
24551
|
if (buttonBlockApprovalCue(spec, text)) return true;
|
|
24552
24552
|
return false;
|
|
24553
24553
|
}
|
|
24554
|
+
function lastModalCueLine(spec, screenText) {
|
|
24555
|
+
if (!screenText) return -1;
|
|
24556
|
+
const lines = screenText.split("\n");
|
|
24557
|
+
const question = compile2(spec.questionPattern, spec.questionFlags ?? "i");
|
|
24558
|
+
const variants = (spec.questionVariants ?? []).map((v) => compile2(v.regex, v.flags ?? "i"));
|
|
24559
|
+
const buttonFlags = spec.buttonFlags && spec.buttonFlags.includes("m") ? spec.buttonFlags : `${spec.buttonFlags ?? ""}m`;
|
|
24560
|
+
const buttonRe = compile2(spec.buttonPattern, buttonFlags);
|
|
24561
|
+
let last = -1;
|
|
24562
|
+
for (let i = 0; i < lines.length; i++) {
|
|
24563
|
+
const line = lines[i];
|
|
24564
|
+
question.lastIndex = 0;
|
|
24565
|
+
if (question.test(line)) {
|
|
24566
|
+
last = i;
|
|
24567
|
+
continue;
|
|
24568
|
+
}
|
|
24569
|
+
if (variants.some((re) => {
|
|
24570
|
+
re.lastIndex = 0;
|
|
24571
|
+
return re.test(line);
|
|
24572
|
+
})) {
|
|
24573
|
+
last = i;
|
|
24574
|
+
continue;
|
|
24575
|
+
}
|
|
24576
|
+
buttonRe.lastIndex = 0;
|
|
24577
|
+
if (buttonRe.test(line)) {
|
|
24578
|
+
last = i;
|
|
24579
|
+
continue;
|
|
24580
|
+
}
|
|
24581
|
+
}
|
|
24582
|
+
return last;
|
|
24583
|
+
}
|
|
24584
|
+
function modalSupersededBySettledPrompt(modalSpec, settledSpec, settled, input) {
|
|
24585
|
+
if (!settled || !settledSpec) return false;
|
|
24586
|
+
if (settledSpec.scope === "whole-screen") return false;
|
|
24587
|
+
const screenText = input.screenText ?? "";
|
|
24588
|
+
if (!screenText) return false;
|
|
24589
|
+
const modalLine = lastModalCueLine(modalSpec, screenText);
|
|
24590
|
+
if (modalLine < 0) return false;
|
|
24591
|
+
const lines = screenText.split("\n");
|
|
24592
|
+
const below = lines.slice(modalLine + 1);
|
|
24593
|
+
if (below.length === 0) return false;
|
|
24594
|
+
const belowText = below.join("\n");
|
|
24595
|
+
if (!settled.prompt.test(belowText)) return false;
|
|
24596
|
+
if (settled.footers.length > 0 && !settled.footers.every((f) => f.test(belowText))) return false;
|
|
24597
|
+
const question = compile2(modalSpec.questionPattern, modalSpec.questionFlags ?? "i");
|
|
24598
|
+
const variants = (modalSpec.questionVariants ?? []).map((v) => compile2(v.regex, v.flags ?? "i"));
|
|
24599
|
+
const buttonFlags = modalSpec.buttonFlags && modalSpec.buttonFlags.includes("m") ? modalSpec.buttonFlags : `${modalSpec.buttonFlags ?? ""}m`;
|
|
24600
|
+
const buttonRe = compile2(modalSpec.buttonPattern, buttonFlags);
|
|
24601
|
+
const isModalCueLine = (line) => {
|
|
24602
|
+
question.lastIndex = 0;
|
|
24603
|
+
if (question.test(line)) return true;
|
|
24604
|
+
if (variants.some((re) => {
|
|
24605
|
+
re.lastIndex = 0;
|
|
24606
|
+
return re.test(line);
|
|
24607
|
+
})) return true;
|
|
24608
|
+
buttonRe.lastIndex = 0;
|
|
24609
|
+
return buttonRe.test(line);
|
|
24610
|
+
};
|
|
24611
|
+
const settledPromptLineRe = compile2(settledSpec.regex, (settledSpec.flags ?? "m").includes("m") ? settledSpec.flags ?? "m" : `${settledSpec.flags ?? ""}m`);
|
|
24612
|
+
const isSettledLine = (line) => {
|
|
24613
|
+
settledPromptLineRe.lastIndex = 0;
|
|
24614
|
+
return settledPromptLineRe.test(line);
|
|
24615
|
+
};
|
|
24616
|
+
return below.some((line) => line.trim() !== "" && !isModalCueLine(line) && !isSettledLine(line));
|
|
24617
|
+
}
|
|
24554
24618
|
function evaluateGroup(group, spec, input, compiled) {
|
|
24555
24619
|
switch (group) {
|
|
24556
24620
|
case "spinner": {
|
|
@@ -24560,7 +24624,9 @@ function evaluateGroup(group, spec, input, compiled) {
|
|
|
24560
24624
|
}
|
|
24561
24625
|
case "modal": {
|
|
24562
24626
|
if (!spec.modal) return null;
|
|
24563
|
-
|
|
24627
|
+
if (!modalMatches(spec.modal, input)) return null;
|
|
24628
|
+
if (modalSupersededBySettledPrompt(spec.modal, spec.settledPrompt, compiled.settled, input)) return null;
|
|
24629
|
+
return "waiting_approval";
|
|
24564
24630
|
}
|
|
24565
24631
|
case "settled-prompt": {
|
|
24566
24632
|
if (!spec.settledPrompt || !compiled.settled) return null;
|
|
@@ -24808,7 +24874,11 @@ function buildParseSessionFromTui(spec) {
|
|
|
24808
24874
|
const stripLeadingChrome = spec.transcriptPty.stripLeadingChrome ?? true;
|
|
24809
24875
|
const scope = spec.transcriptPty.scope ?? "buffer";
|
|
24810
24876
|
const userBgList = Array.isArray(spec.transcriptPty.userBackgroundSgr) ? spec.transcriptPty.userBackgroundSgr.map((s2) => String(s2).trim()).filter(Boolean) : [];
|
|
24877
|
+
const ANY_BG_SENTINELS = /* @__PURE__ */ new Set(["*", "48;*", "bg", "48"]);
|
|
24811
24878
|
const userBgRes = userBgList.map((code) => {
|
|
24879
|
+
if (ANY_BG_SENTINELS.has(code.toLowerCase())) {
|
|
24880
|
+
return new RegExp("\\x1b\\[[0-9;]*\\b48;(?:5;\\d{1,3}|2;\\d{1,3};\\d{1,3};\\d{1,3})[0-9;]*m");
|
|
24881
|
+
}
|
|
24812
24882
|
const esc = code.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
24813
24883
|
return new RegExp(`\\x1b\\[[0-9;]*${esc}[0-9;]*m`);
|
|
24814
24884
|
});
|
|
@@ -26727,6 +26797,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
26727
26797
|
const staleSnapshotLooksActive = activeScreenPattern.test(lastSnapshot);
|
|
26728
26798
|
const currentScreenLooksIdle = /(?:^|\n|\r)\s*[❯›>]\s*(?:Try\s+["“][^\n\r"”]+["”])?\s*(?:\n|\r|$)/.test(screenText) && !activeScreenPattern.test(screenText);
|
|
26729
26799
|
if (staleSnapshotLooksActive && currentScreenLooksIdle) return screenText;
|
|
26800
|
+
if (this.runDetectStatus(screenText) === "idle") return screenText;
|
|
26730
26801
|
if (currentSnapshot.length >= lastSnapshot.length) return screenText;
|
|
26731
26802
|
return `${screenText}
|
|
26732
26803
|
${lastSnapshot}`;
|
|
@@ -44256,7 +44327,7 @@ function executeJsonl(src, input) {
|
|
|
44256
44327
|
const mtime = safeMtimeMs(sourcePath);
|
|
44257
44328
|
const lines = readJsonlLines(sourcePath);
|
|
44258
44329
|
if (lines.length === 0) return null;
|
|
44259
|
-
const transcriptWorkspace = readSessionMetaWorkspace(lines);
|
|
44330
|
+
const transcriptWorkspace = readSessionMetaWorkspace(lines) ?? (src.workspace_from_input ? workspaceFromInputIfSlugMatches(sourcePath, input) : void 0);
|
|
44260
44331
|
let providerSessionId;
|
|
44261
44332
|
if (src.session_id_from === "first_record" && src.session_id_path) {
|
|
44262
44333
|
const v = jsonPathGet(lines[0], src.session_id_path);
|
|
@@ -44339,6 +44410,32 @@ function readSessionMetaWorkspace(lines) {
|
|
|
44339
44410
|
}
|
|
44340
44411
|
return void 0;
|
|
44341
44412
|
}
|
|
44413
|
+
function workspaceFromInputIfSlugMatches(sourcePath, input) {
|
|
44414
|
+
const wsRaw = typeof input.workspace === "string" ? input.workspace.trim() : "";
|
|
44415
|
+
if (!wsRaw) return void 0;
|
|
44416
|
+
let wsReal = wsRaw;
|
|
44417
|
+
try {
|
|
44418
|
+
wsReal = fs17.realpathSync(wsRaw);
|
|
44419
|
+
} catch {
|
|
44420
|
+
}
|
|
44421
|
+
const slugs = /* @__PURE__ */ new Set();
|
|
44422
|
+
for (const w of [wsReal, wsRaw]) {
|
|
44423
|
+
if (!w) continue;
|
|
44424
|
+
slugs.add(claudeProjectDirName(w));
|
|
44425
|
+
slugs.add(claudeProjectDirName(w.replace(/^\/+/, "")));
|
|
44426
|
+
}
|
|
44427
|
+
const segments = sourcePath.split(path24.sep);
|
|
44428
|
+
for (const seg of segments) {
|
|
44429
|
+
if (!seg) continue;
|
|
44430
|
+
for (const slug of slugs) {
|
|
44431
|
+
if (!slug) continue;
|
|
44432
|
+
if (seg === slug) return wsRaw;
|
|
44433
|
+
const m = seg.match(/^(.*)-[0-9a-f]{6,}$/);
|
|
44434
|
+
if (m && m[1] && m[1].length >= 8 && slug.startsWith(m[1])) return wsRaw;
|
|
44435
|
+
}
|
|
44436
|
+
}
|
|
44437
|
+
return void 0;
|
|
44438
|
+
}
|
|
44342
44439
|
function readJsonlLines(p) {
|
|
44343
44440
|
let text;
|
|
44344
44441
|
try {
|