@adhdev/daemon-standalone 1.0.58-rc.57 → 1.0.58-rc.59

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
@@ -36911,10 +36911,10 @@ var require_dist3 = __commonJS({
36911
36911
  }
36912
36912
  function getDaemonBuildInfo() {
36913
36913
  if (cached2) return cached2;
36914
- const commit = readInjected(true ? "c934db53d11d585f6e21c0715d9b9b180d83ced6" : void 0) ?? "unknown";
36915
- const commitShort = readInjected(true ? "c934db53" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36916
- const version2 = readInjected(true ? "1.0.58-rc.57" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36917
- const builtAt = readInjected(true ? "2026-09-01T10:26:03.358Z" : void 0);
36914
+ const commit = readInjected(true ? "6393920b37c3af6cd2678d0e12a58d0eaa9a138f" : void 0) ?? "unknown";
36915
+ const commitShort = readInjected(true ? "6393920b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36916
+ const version2 = readInjected(true ? "1.0.58-rc.59" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36917
+ const builtAt = readInjected(true ? "2026-09-01T13:20:53.426Z" : void 0);
36918
36918
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
36919
36919
  return cached2;
36920
36920
  }
@@ -101926,8 +101926,58 @@ ${e?.stderr || ""}`;
101926
101926
  }
101927
101927
  var CLAUDE_TUI_OPTION_CHECKBOX = "(?:\\[[ xX]\\]|[\u2610\u2612\u25FB\u25FC])";
101928
101928
  var CLAUDE_TUI_OPTION_PATTERN = new RegExp(
101929
- `^\\s*(?:[\u276F\u203A>]\\s*)?(?:${CLAUDE_TUI_OPTION_CHECKBOX}\\s*)?(\\d+)\\.\\s+(?:${CLAUDE_TUI_OPTION_CHECKBOX}\\s*)?(.+?)\\s*$`
101929
+ `^\\s*(?:[\u276F\u203A>\u2750]\\s*)?(?:${CLAUDE_TUI_OPTION_CHECKBOX}\\s*)?(\\d+)\\.\\s+(?:${CLAUDE_TUI_OPTION_CHECKBOX}\\s*)?(.+?)\\s*$`
101930
101930
  );
101931
+ function readClaudeTuiScreenLines(screenText) {
101932
+ return screenText.split(/\r?\n/).map((raw) => {
101933
+ const panel = raw.match(/(\s+)[│┃].*$/);
101934
+ return {
101935
+ // Keep the rc.58 preview-panel removal, but retain whether the main-pane
101936
+ // text reached the panel edge. One padding cell before the divider is the
101937
+ // observable signal that the terminal continued that logical row on the
101938
+ // next physical row; generously accept two for wide-glyph edge padding.
101939
+ text: panel ? raw.slice(0, panel.index ?? raw.length) : raw,
101940
+ wrapsIntoNext: !!panel && panel[1].length <= 2
101941
+ };
101942
+ });
101943
+ }
101944
+ function joinClaudeTuiRows(lines, start, end) {
101945
+ return lines.slice(start, end).map((line) => line.text.trim()).filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
101946
+ }
101947
+ function readClaudeQuestionBeforeOption(lines, firstOptionIndex, lowerBound) {
101948
+ let end = firstOptionIndex;
101949
+ while (end > lowerBound) {
101950
+ const candidate = lines[end - 1].text.trim();
101951
+ if (candidate && !/^─+$/.test(candidate)) break;
101952
+ end -= 1;
101953
+ }
101954
+ let start = end;
101955
+ while (start > lowerBound) {
101956
+ const candidate = lines[start - 1].text.trim();
101957
+ if (!candidate || /^─+$/.test(candidate) || candidate.includes("\u2714 Submit") || CLAUDE_TUI_OPTION_PATTERN.test(lines[start - 1].text)) break;
101958
+ start -= 1;
101959
+ }
101960
+ const question = joinClaudeTuiRows(lines, start, end);
101961
+ return question.replace(/^[☐☒]\s+/, "").trim();
101962
+ }
101963
+ function readClaudeTuiOption(lines, optionLineIndex, optionBlockEnd) {
101964
+ const match = lines[optionLineIndex].text.match(CLAUDE_TUI_OPTION_PATTERN);
101965
+ if (!match) return null;
101966
+ let label = match[2].trim();
101967
+ let continuationEnd = optionLineIndex + 1;
101968
+ while (continuationEnd < optionBlockEnd) {
101969
+ const candidate = lines[continuationEnd].text.trim();
101970
+ if (!candidate || CLAUDE_TUI_OPTION_PATTERN.test(lines[continuationEnd].text) || /^─+$/.test(candidate) || /^Enter to select\b/i.test(candidate)) break;
101971
+ continuationEnd += 1;
101972
+ }
101973
+ let labelEnd = optionLineIndex + 1;
101974
+ while (labelEnd < continuationEnd && lines[labelEnd - 1].wrapsIntoNext) labelEnd += 1;
101975
+ if (labelEnd > optionLineIndex + 1) {
101976
+ label = `${label} ${joinClaudeTuiRows(lines, optionLineIndex + 1, labelEnd)}`.replace(/\s+/g, " ").trim();
101977
+ }
101978
+ const description = joinClaudeTuiRows(lines, labelEnd, continuationEnd) || void 0;
101979
+ return { label, ...description ? { description } : {} };
101980
+ }
101931
101981
  function claudeTuiQuestionHeaders(screenText) {
101932
101982
  const navLine = screenText.split(/\r?\n/).find((line) => line.includes("\u2714 Submit") && /[☐☒]/.test(line));
101933
101983
  if (!navLine) return [];
@@ -101965,20 +102015,12 @@ ${e?.stderr || ""}`;
101965
102015
  }
101966
102016
  return void 0;
101967
102017
  }
101968
- function readClaudeOptionDescription(lines, optionLineIndex) {
101969
- const nextLine = lines[optionLineIndex + 1];
101970
- const next = nextLine?.trim();
101971
- if (!next || CLAUDE_TUI_OPTION_PATTERN.test(nextLine) || /^─+$/.test(next) || /^Enter to select\b/i.test(next) || /^[☐☒]\s+/.test(next)) {
101972
- return void 0;
101973
- }
101974
- return next;
101975
- }
101976
102018
  function parseClaudeHeaderlessInteractiveTuiQuestion(page, index) {
101977
102019
  if (!isClaudeTuiSelectFooter(page.screenText)) return null;
101978
- const lines = page.screenText.split(/\r?\n/);
102020
+ const lines = readClaudeTuiScreenLines(page.screenText);
101979
102021
  let footerIndex = -1;
101980
102022
  for (let i = lines.length - 1; i >= 0; i -= 1) {
101981
- if (/Enter to select/i.test(lines[i])) {
102023
+ if (/Enter to select/i.test(lines[i].text)) {
101982
102024
  footerIndex = i;
101983
102025
  break;
101984
102026
  }
@@ -101986,14 +102028,14 @@ ${e?.stderr || ""}`;
101986
102028
  if (footerIndex < 0) return null;
101987
102029
  let optionBlockEnd = footerIndex - 1;
101988
102030
  for (let i = footerIndex - 1; i >= 0; i -= 1) {
101989
- if (/^─+$/.test(lines[i].trim())) {
102031
+ if (/^─+$/.test(lines[i].text.trim())) {
101990
102032
  optionBlockEnd = i - 1;
101991
102033
  break;
101992
102034
  }
101993
102035
  }
101994
102036
  const optionLineIndexes = [];
101995
102037
  for (let i = optionBlockEnd; i >= 0; i -= 1) {
101996
- const line = lines[i];
102038
+ const line = lines[i].text;
101997
102039
  if (CLAUDE_TUI_OPTION_PATTERN.test(line)) {
101998
102040
  optionLineIndexes.push(i);
101999
102041
  continue;
@@ -102003,33 +102045,20 @@ ${e?.stderr || ""}`;
102003
102045
  optionLineIndexes.reverse();
102004
102046
  if (optionLineIndexes.length === 0) return null;
102005
102047
  const firstOptionIndex = optionLineIndexes[0];
102006
- let question = "";
102007
- for (let i = firstOptionIndex - 1; i >= 0; i -= 1) {
102008
- const candidate = lines[i].trim();
102009
- if (!candidate || /^─+$/.test(candidate)) continue;
102010
- if (/^[☐☒]\s*$/.test(candidate)) continue;
102011
- const markerMatch = candidate.match(/^[☐☒]\s+(.+)$/);
102012
- if (markerMatch) {
102013
- question = markerMatch[1].trim();
102014
- break;
102015
- }
102016
- question = candidate;
102017
- break;
102018
- }
102048
+ const question = readClaudeQuestionBeforeOption(lines, firstOptionIndex, 0);
102019
102049
  if (!question) return null;
102020
102050
  const options = [];
102021
102051
  let allowFreeform = false;
102022
102052
  for (const optionLineIndex of optionLineIndexes) {
102023
- const match = lines[optionLineIndex].match(CLAUDE_TUI_OPTION_PATTERN);
102024
- if (!match) continue;
102025
- const label = match[2].trim();
102053
+ const option = readClaudeTuiOption(lines, optionLineIndex, optionBlockEnd + 1);
102054
+ if (!option) continue;
102055
+ const { label } = option;
102026
102056
  if (/^Chat about this$/i.test(label)) continue;
102027
102057
  if (/^Type something\.?$/i.test(label)) allowFreeform = true;
102028
- const description = readClaudeOptionDescription(lines, optionLineIndex);
102029
- options.push({ label, ...description ? { description } : {} });
102058
+ options.push(option);
102030
102059
  }
102031
102060
  if (options.length === 0) return null;
102032
- const header = readString(page.header) || readClaudeHeaderLine(lines, firstOptionIndex - 1);
102061
+ const header = readString(page.header) || readClaudeHeaderLine(lines.map((line) => line.text), firstOptionIndex - 1);
102033
102062
  return {
102034
102063
  questionId: `q${index + 1}`,
102035
102064
  question,
@@ -102042,11 +102071,24 @@ ${e?.stderr || ""}`;
102042
102071
  function isClaudeTuiReviewScreen(screenText) {
102043
102072
  return /(?:^|\n)\s*(?:Review your answers|Ready to submit your answers\?)\s*(?:\r?\n|$)/.test(screenText);
102044
102073
  }
102074
+ function readFocusedClaudeTuiPickerRegion(screenText) {
102075
+ if (!screenText.includes("Enter to select")) return null;
102076
+ const lines = screenText.split(/\r?\n/);
102077
+ let lastFooterIndex = -1;
102078
+ let previousFooterIndex = -1;
102079
+ for (let index = 0; index < lines.length; index += 1) {
102080
+ if (!lines[index].includes("Enter to select")) continue;
102081
+ previousFooterIndex = lastFooterIndex;
102082
+ lastFooterIndex = index;
102083
+ }
102084
+ if (lastFooterIndex < 0) return null;
102085
+ return lines.slice(previousFooterIndex + 1, lastFooterIndex + 1).join("\n");
102086
+ }
102045
102087
  function parseClaudeInteractiveTuiQuestion(page, index) {
102046
- const lines = page.screenText.split(/\r?\n/);
102088
+ const lines = readClaudeTuiScreenLines(page.screenText);
102047
102089
  let navIndex = -1;
102048
102090
  for (let i = lines.length - 1; i >= 0; i -= 1) {
102049
- if (lines[i].includes("\u2714 Submit") && /[☐☒]/.test(lines[i])) {
102091
+ if (lines[i].text.includes("\u2714 Submit") && /[☐☒]/.test(lines[i].text)) {
102050
102092
  navIndex = i;
102051
102093
  break;
102052
102094
  }
@@ -102054,38 +102096,35 @@ ${e?.stderr || ""}`;
102054
102096
  if (navIndex < 0) return parseClaudeHeaderlessInteractiveTuiQuestion(page, index);
102055
102097
  if (!page.screenText.includes("Enter to select")) return null;
102056
102098
  for (let i = navIndex + 1; i < lines.length; i += 1) {
102057
- const candidate = lines[i].trim();
102099
+ const candidate = lines[i].text.trim();
102058
102100
  if (!candidate || /^─+$/.test(candidate)) continue;
102059
102101
  if (candidate === "Review your answers" || candidate === "Ready to submit your answers?") return null;
102060
- if (CLAUDE_TUI_OPTION_PATTERN.test(lines[i])) break;
102102
+ if (CLAUDE_TUI_OPTION_PATTERN.test(lines[i].text)) break;
102061
102103
  }
102062
- let question = "";
102063
- let questionLineIndex = -1;
102104
+ let firstOptionIndex = -1;
102064
102105
  for (let i = navIndex + 1; i < lines.length; i += 1) {
102065
- const candidate = lines[i].trim();
102066
- if (!candidate || /^─+$/.test(candidate)) continue;
102067
- question = candidate;
102068
- questionLineIndex = i;
102069
- break;
102106
+ if (CLAUDE_TUI_OPTION_PATTERN.test(lines[i].text)) {
102107
+ firstOptionIndex = i;
102108
+ break;
102109
+ }
102070
102110
  }
102111
+ if (firstOptionIndex < 0) return null;
102112
+ const question = readClaudeQuestionBeforeOption(lines, firstOptionIndex, navIndex + 1);
102071
102113
  if (!question) return null;
102072
102114
  const options = [];
102073
102115
  let allowFreeform = false;
102074
- for (let i = questionLineIndex + 1; i < lines.length; i += 1) {
102075
- const match = lines[i].match(CLAUDE_TUI_OPTION_PATTERN);
102116
+ for (let i = firstOptionIndex; i < lines.length; i += 1) {
102117
+ const match = lines[i].text.match(CLAUDE_TUI_OPTION_PATTERN);
102076
102118
  if (!match) continue;
102077
- const label = match[2].trim();
102119
+ const option = readClaudeTuiOption(lines, i, lines.length);
102120
+ if (!option) continue;
102121
+ const { label } = option;
102078
102122
  if (/^Type something\.?$/i.test(label)) {
102079
102123
  allowFreeform = true;
102080
102124
  continue;
102081
102125
  }
102082
102126
  if (/^Chat about this$/i.test(label)) continue;
102083
- let description;
102084
- const nextLine = lines[i + 1]?.trim();
102085
- if (nextLine && !CLAUDE_TUI_OPTION_PATTERN.test(lines[i + 1]) && !/^─+$/.test(nextLine) && !/^Enter to select\b/.test(nextLine)) {
102086
- description = nextLine;
102087
- }
102088
- options.push({ label, ...description ? { description } : {} });
102127
+ options.push(option);
102089
102128
  }
102090
102129
  if (options.length === 0) return null;
102091
102130
  const header = readString(page.header);
@@ -102099,17 +102138,8 @@ ${e?.stderr || ""}`;
102099
102138
  };
102100
102139
  }
102101
102140
  function readFocusedClaudeTuiQuestion(screenText) {
102102
- if (!screenText.includes("Enter to select")) return null;
102103
- const lines = screenText.split(/\r?\n/);
102104
- let lastFooterIndex = -1;
102105
- let previousFooterIndex = -1;
102106
- for (let index = 0; index < lines.length; index += 1) {
102107
- if (!lines[index].includes("Enter to select")) continue;
102108
- previousFooterIndex = lastFooterIndex;
102109
- lastFooterIndex = index;
102110
- }
102111
- if (lastFooterIndex < 0) return null;
102112
- const focusedScreenText = lines.slice(previousFooterIndex + 1, lastFooterIndex + 1).join("\n");
102141
+ const focusedScreenText = readFocusedClaudeTuiPickerRegion(screenText);
102142
+ if (focusedScreenText === null) return null;
102113
102143
  const parsed = parseClaudeInteractiveTuiQuestion({ screenText: focusedScreenText }, 0);
102114
102144
  if (!parsed) return null;
102115
102145
  return {
@@ -124890,7 +124920,8 @@ ${text}` : text;
124890
124920
  }
124891
124921
  claudeTuiQuestionTextAppears(expected, screenText) {
124892
124922
  const expectedQuestion = this.normalizeClaudeTuiIdentity(expected.question);
124893
- return !!expectedQuestion && this.normalizeClaudeTuiIdentity(screenText).includes(expectedQuestion);
124923
+ const focusedPickerRegion = readFocusedClaudeTuiPickerRegion(screenText);
124924
+ return !!expectedQuestion && focusedPickerRegion !== null && this.normalizeClaudeTuiIdentity(focusedPickerRegion).includes(expectedQuestion);
124894
124925
  }
124895
124926
  readClaudeTuiSnapshotForAnswer() {
124896
124927
  try {