adhdev 0.8.6 → 0.8.8

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/cli/index.js CHANGED
@@ -6406,6 +6406,9 @@ function promptLikelyVisible(screenText, promptSnippet) {
6406
6406
  function normalizeScreenSnapshot(text) {
6407
6407
  return sanitizeTerminalText(String(text || "")).replace(/\s+/g, " ").trim();
6408
6408
  }
6409
+ function normalizeComparableMessageContent(text) {
6410
+ return String(text || "").replace(/\s+/g, " ").trim();
6411
+ }
6409
6412
  function parsePatternEntry(x) {
6410
6413
  if (x instanceof RegExp) return x;
6411
6414
  if (x && typeof x === "object" && typeof x.source === "string") {
@@ -6587,11 +6590,44 @@ var init_provider_cli_adapter = __esm({
6587
6590
  this.structuredMessages = [...this.committedMessages];
6588
6591
  }
6589
6592
  normalizeParsedMessages(parsedMessages) {
6590
- return parsedMessages.filter((message) => message && (message.role === "user" || message.role === "assistant")).map((message) => ({
6591
- role: message.role,
6592
- content: typeof message.content === "string" ? message.content : String(message.content || ""),
6593
- timestamp: typeof message.timestamp === "number" && Number.isFinite(message.timestamp) ? message.timestamp : Date.now()
6594
- }));
6593
+ const referenceMessages = [...this.committedMessages];
6594
+ const usedReferenceIndexes = /* @__PURE__ */ new Set();
6595
+ const now = Date.now();
6596
+ const findReferenceTimestamp = (role, content, parsedIndex) => {
6597
+ const normalizedContent = normalizeComparableMessageContent(content);
6598
+ if (!normalizedContent) return void 0;
6599
+ const sameIndex = referenceMessages[parsedIndex];
6600
+ if (sameIndex && !usedReferenceIndexes.has(parsedIndex) && sameIndex.role === role && normalizeComparableMessageContent(sameIndex.content) === normalizedContent && typeof sameIndex.timestamp === "number" && Number.isFinite(sameIndex.timestamp)) {
6601
+ usedReferenceIndexes.add(parsedIndex);
6602
+ return sameIndex.timestamp;
6603
+ }
6604
+ for (let i = 0; i < referenceMessages.length; i++) {
6605
+ if (usedReferenceIndexes.has(i)) continue;
6606
+ const candidate = referenceMessages[i];
6607
+ if (!candidate || candidate.role !== role) continue;
6608
+ const candidateContent = normalizeComparableMessageContent(candidate.content);
6609
+ if (!candidateContent) continue;
6610
+ const exactMatch = candidateContent === normalizedContent;
6611
+ const fuzzyMatch = candidateContent.includes(normalizedContent) || normalizedContent.includes(candidateContent);
6612
+ if (!exactMatch && !fuzzyMatch) continue;
6613
+ if (typeof candidate.timestamp === "number" && Number.isFinite(candidate.timestamp)) {
6614
+ usedReferenceIndexes.add(i);
6615
+ return candidate.timestamp;
6616
+ }
6617
+ }
6618
+ return void 0;
6619
+ };
6620
+ return parsedMessages.filter((message) => message && (message.role === "user" || message.role === "assistant")).map((message, index) => {
6621
+ const role = message.role;
6622
+ const content = typeof message.content === "string" ? message.content : String(message.content || "");
6623
+ const parsedTimestamp = typeof message.timestamp === "number" && Number.isFinite(message.timestamp) ? message.timestamp : void 0;
6624
+ const referenceTimestamp = parsedTimestamp ?? findReferenceTimestamp(role, content, index);
6625
+ return {
6626
+ role,
6627
+ content,
6628
+ timestamp: referenceTimestamp ?? now
6629
+ };
6630
+ });
6595
6631
  }
6596
6632
  sliceFromOffset(text, start) {
6597
6633
  if (!text) return "";
@@ -6749,11 +6785,15 @@ var init_provider_cli_adapter = __esm({
6749
6785
  let shellCmd;
6750
6786
  let shellArgs;
6751
6787
  const useShellUnix = !isWin && (!!spawnConfig.shell || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
6752
- const useShell = isWin ? !!spawnConfig.shell : useShellUnix;
6788
+ const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
6789
+ const useShell = isWin ? !!spawnConfig.shell || isCmdShim : useShellUnix;
6753
6790
  if (useShell) {
6754
6791
  if (!spawnConfig.shell && !isWin) {
6755
6792
  LOG.info("CLI", `[${this.cliType}] Using login shell (script shim or non-native binary)`);
6756
6793
  }
6794
+ if (isCmdShim) {
6795
+ LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell for .cmd/.bat shim: ${binaryPath}`);
6796
+ }
6757
6797
  shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
6758
6798
  if (isWin) {
6759
6799
  shellArgs = ["/c", binaryPath, ...allArgs];
@@ -39190,7 +39230,7 @@ var init_adhdev_daemon = __esm({
39190
39230
  fs17 = __toESM(require("fs"));
39191
39231
  path21 = __toESM(require("path"));
39192
39232
  import_chalk2 = __toESM(require("chalk"));
39193
- pkgVersion = "0.8.6";
39233
+ pkgVersion = "0.8.8";
39194
39234
  if (pkgVersion === "unknown") {
39195
39235
  try {
39196
39236
  const possiblePaths = [