@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.mjs CHANGED
@@ -414,10 +414,10 @@ function readInjected(value) {
414
414
  }
415
415
  function getDaemonBuildInfo() {
416
416
  if (cached) return cached;
417
- const commit = readInjected(true ? "207830c90b06f2f738a85f74079a2460d53767c8" : void 0) ?? "unknown";
418
- const commitShort = readInjected(true ? "207830c9" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
419
- const version = readInjected(true ? "0.9.82-rc.535" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
420
- const builtAt = readInjected(true ? "2026-07-15T10:22:51.070Z" : void 0);
417
+ const commit = readInjected(true ? "b47ad45cf2b2ad404d911162a9cadd7db2e274a6" : void 0) ?? "unknown";
418
+ const commitShort = readInjected(true ? "b47ad45c" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
419
+ const version = readInjected(true ? "0.9.82-rc.537" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
420
+ const builtAt = readInjected(true ? "2026-07-15T13:12:55.213Z" : void 0);
421
421
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
422
422
  return cached;
423
423
  }
@@ -24552,6 +24552,70 @@ function modalMatches(spec, input) {
24552
24552
  if (buttonBlockApprovalCue(spec, text)) return true;
24553
24553
  return false;
24554
24554
  }
24555
+ function lastModalCueLine(spec, screenText) {
24556
+ if (!screenText) return -1;
24557
+ const lines = screenText.split("\n");
24558
+ const question = compile2(spec.questionPattern, spec.questionFlags ?? "i");
24559
+ const variants = (spec.questionVariants ?? []).map((v) => compile2(v.regex, v.flags ?? "i"));
24560
+ const buttonFlags = spec.buttonFlags && spec.buttonFlags.includes("m") ? spec.buttonFlags : `${spec.buttonFlags ?? ""}m`;
24561
+ const buttonRe = compile2(spec.buttonPattern, buttonFlags);
24562
+ let last = -1;
24563
+ for (let i = 0; i < lines.length; i++) {
24564
+ const line = lines[i];
24565
+ question.lastIndex = 0;
24566
+ if (question.test(line)) {
24567
+ last = i;
24568
+ continue;
24569
+ }
24570
+ if (variants.some((re) => {
24571
+ re.lastIndex = 0;
24572
+ return re.test(line);
24573
+ })) {
24574
+ last = i;
24575
+ continue;
24576
+ }
24577
+ buttonRe.lastIndex = 0;
24578
+ if (buttonRe.test(line)) {
24579
+ last = i;
24580
+ continue;
24581
+ }
24582
+ }
24583
+ return last;
24584
+ }
24585
+ function modalSupersededBySettledPrompt(modalSpec, settledSpec, settled, input) {
24586
+ if (!settled || !settledSpec) return false;
24587
+ if (settledSpec.scope === "whole-screen") return false;
24588
+ const screenText = input.screenText ?? "";
24589
+ if (!screenText) return false;
24590
+ const modalLine = lastModalCueLine(modalSpec, screenText);
24591
+ if (modalLine < 0) return false;
24592
+ const lines = screenText.split("\n");
24593
+ const below = lines.slice(modalLine + 1);
24594
+ if (below.length === 0) return false;
24595
+ const belowText = below.join("\n");
24596
+ if (!settled.prompt.test(belowText)) return false;
24597
+ if (settled.footers.length > 0 && !settled.footers.every((f) => f.test(belowText))) return false;
24598
+ const question = compile2(modalSpec.questionPattern, modalSpec.questionFlags ?? "i");
24599
+ const variants = (modalSpec.questionVariants ?? []).map((v) => compile2(v.regex, v.flags ?? "i"));
24600
+ const buttonFlags = modalSpec.buttonFlags && modalSpec.buttonFlags.includes("m") ? modalSpec.buttonFlags : `${modalSpec.buttonFlags ?? ""}m`;
24601
+ const buttonRe = compile2(modalSpec.buttonPattern, buttonFlags);
24602
+ const isModalCueLine = (line) => {
24603
+ question.lastIndex = 0;
24604
+ if (question.test(line)) return true;
24605
+ if (variants.some((re) => {
24606
+ re.lastIndex = 0;
24607
+ return re.test(line);
24608
+ })) return true;
24609
+ buttonRe.lastIndex = 0;
24610
+ return buttonRe.test(line);
24611
+ };
24612
+ const settledPromptLineRe = compile2(settledSpec.regex, (settledSpec.flags ?? "m").includes("m") ? settledSpec.flags ?? "m" : `${settledSpec.flags ?? ""}m`);
24613
+ const isSettledLine = (line) => {
24614
+ settledPromptLineRe.lastIndex = 0;
24615
+ return settledPromptLineRe.test(line);
24616
+ };
24617
+ return below.some((line) => line.trim() !== "" && !isModalCueLine(line) && !isSettledLine(line));
24618
+ }
24555
24619
  function evaluateGroup(group, spec, input, compiled) {
24556
24620
  switch (group) {
24557
24621
  case "spinner": {
@@ -24561,7 +24625,9 @@ function evaluateGroup(group, spec, input, compiled) {
24561
24625
  }
24562
24626
  case "modal": {
24563
24627
  if (!spec.modal) return null;
24564
- return modalMatches(spec.modal, input) ? "waiting_approval" : null;
24628
+ if (!modalMatches(spec.modal, input)) return null;
24629
+ if (modalSupersededBySettledPrompt(spec.modal, spec.settledPrompt, compiled.settled, input)) return null;
24630
+ return "waiting_approval";
24565
24631
  }
24566
24632
  case "settled-prompt": {
24567
24633
  if (!spec.settledPrompt || !compiled.settled) return null;
@@ -24810,7 +24876,11 @@ function buildParseSessionFromTui(spec) {
24810
24876
  const stripLeadingChrome = spec.transcriptPty.stripLeadingChrome ?? true;
24811
24877
  const scope = spec.transcriptPty.scope ?? "buffer";
24812
24878
  const userBgList = Array.isArray(spec.transcriptPty.userBackgroundSgr) ? spec.transcriptPty.userBackgroundSgr.map((s2) => String(s2).trim()).filter(Boolean) : [];
24879
+ const ANY_BG_SENTINELS = /* @__PURE__ */ new Set(["*", "48;*", "bg", "48"]);
24813
24880
  const userBgRes = userBgList.map((code) => {
24881
+ if (ANY_BG_SENTINELS.has(code.toLowerCase())) {
24882
+ return new RegExp("\\x1b\\[[0-9;]*\\b48;(?:5;\\d{1,3}|2;\\d{1,3};\\d{1,3};\\d{1,3})[0-9;]*m");
24883
+ }
24814
24884
  const esc = code.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
24815
24885
  return new RegExp(`\\x1b\\[[0-9;]*${esc}[0-9;]*m`);
24816
24886
  });
@@ -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}`;
@@ -43828,7 +43899,7 @@ function executeJsonl(src, input) {
43828
43899
  const mtime = safeMtimeMs(sourcePath);
43829
43900
  const lines = readJsonlLines(sourcePath);
43830
43901
  if (lines.length === 0) return null;
43831
- const transcriptWorkspace = readSessionMetaWorkspace(lines);
43902
+ const transcriptWorkspace = readSessionMetaWorkspace(lines) ?? (src.workspace_from_input ? workspaceFromInputIfSlugMatches(sourcePath, input) : void 0);
43832
43903
  let providerSessionId;
43833
43904
  if (src.session_id_from === "first_record" && src.session_id_path) {
43834
43905
  const v = jsonPathGet(lines[0], src.session_id_path);
@@ -43911,6 +43982,32 @@ function readSessionMetaWorkspace(lines) {
43911
43982
  }
43912
43983
  return void 0;
43913
43984
  }
43985
+ function workspaceFromInputIfSlugMatches(sourcePath, input) {
43986
+ const wsRaw = typeof input.workspace === "string" ? input.workspace.trim() : "";
43987
+ if (!wsRaw) return void 0;
43988
+ let wsReal = wsRaw;
43989
+ try {
43990
+ wsReal = fs17.realpathSync(wsRaw);
43991
+ } catch {
43992
+ }
43993
+ const slugs = /* @__PURE__ */ new Set();
43994
+ for (const w of [wsReal, wsRaw]) {
43995
+ if (!w) continue;
43996
+ slugs.add(claudeProjectDirName(w));
43997
+ slugs.add(claudeProjectDirName(w.replace(/^\/+/, "")));
43998
+ }
43999
+ const segments = sourcePath.split(path24.sep);
44000
+ for (const seg of segments) {
44001
+ if (!seg) continue;
44002
+ for (const slug of slugs) {
44003
+ if (!slug) continue;
44004
+ if (seg === slug) return wsRaw;
44005
+ const m = seg.match(/^(.*)-[0-9a-f]{6,}$/);
44006
+ if (m && m[1] && m[1].length >= 8 && slug.startsWith(m[1])) return wsRaw;
44007
+ }
44008
+ }
44009
+ return void 0;
44010
+ }
43914
44011
  function readJsonlLines(p) {
43915
44012
  let text;
43916
44013
  try {