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/index.js CHANGED
@@ -6232,6 +6232,9 @@ function promptLikelyVisible(screenText, promptSnippet) {
6232
6232
  function normalizeScreenSnapshot(text) {
6233
6233
  return sanitizeTerminalText(String(text || "")).replace(/\s+/g, " ").trim();
6234
6234
  }
6235
+ function normalizeComparableMessageContent(text) {
6236
+ return String(text || "").replace(/\s+/g, " ").trim();
6237
+ }
6235
6238
  function parsePatternEntry(x) {
6236
6239
  if (x instanceof RegExp) return x;
6237
6240
  if (x && typeof x === "object" && typeof x.source === "string") {
@@ -6413,11 +6416,44 @@ var init_provider_cli_adapter = __esm({
6413
6416
  this.structuredMessages = [...this.committedMessages];
6414
6417
  }
6415
6418
  normalizeParsedMessages(parsedMessages) {
6416
- return parsedMessages.filter((message) => message && (message.role === "user" || message.role === "assistant")).map((message) => ({
6417
- role: message.role,
6418
- content: typeof message.content === "string" ? message.content : String(message.content || ""),
6419
- timestamp: typeof message.timestamp === "number" && Number.isFinite(message.timestamp) ? message.timestamp : Date.now()
6420
- }));
6419
+ const referenceMessages = [...this.committedMessages];
6420
+ const usedReferenceIndexes = /* @__PURE__ */ new Set();
6421
+ const now = Date.now();
6422
+ const findReferenceTimestamp = (role, content, parsedIndex) => {
6423
+ const normalizedContent = normalizeComparableMessageContent(content);
6424
+ if (!normalizedContent) return void 0;
6425
+ const sameIndex = referenceMessages[parsedIndex];
6426
+ if (sameIndex && !usedReferenceIndexes.has(parsedIndex) && sameIndex.role === role && normalizeComparableMessageContent(sameIndex.content) === normalizedContent && typeof sameIndex.timestamp === "number" && Number.isFinite(sameIndex.timestamp)) {
6427
+ usedReferenceIndexes.add(parsedIndex);
6428
+ return sameIndex.timestamp;
6429
+ }
6430
+ for (let i = 0; i < referenceMessages.length; i++) {
6431
+ if (usedReferenceIndexes.has(i)) continue;
6432
+ const candidate = referenceMessages[i];
6433
+ if (!candidate || candidate.role !== role) continue;
6434
+ const candidateContent = normalizeComparableMessageContent(candidate.content);
6435
+ if (!candidateContent) continue;
6436
+ const exactMatch = candidateContent === normalizedContent;
6437
+ const fuzzyMatch = candidateContent.includes(normalizedContent) || normalizedContent.includes(candidateContent);
6438
+ if (!exactMatch && !fuzzyMatch) continue;
6439
+ if (typeof candidate.timestamp === "number" && Number.isFinite(candidate.timestamp)) {
6440
+ usedReferenceIndexes.add(i);
6441
+ return candidate.timestamp;
6442
+ }
6443
+ }
6444
+ return void 0;
6445
+ };
6446
+ return parsedMessages.filter((message) => message && (message.role === "user" || message.role === "assistant")).map((message, index) => {
6447
+ const role = message.role;
6448
+ const content = typeof message.content === "string" ? message.content : String(message.content || "");
6449
+ const parsedTimestamp = typeof message.timestamp === "number" && Number.isFinite(message.timestamp) ? message.timestamp : void 0;
6450
+ const referenceTimestamp = parsedTimestamp ?? findReferenceTimestamp(role, content, index);
6451
+ return {
6452
+ role,
6453
+ content,
6454
+ timestamp: referenceTimestamp ?? now
6455
+ };
6456
+ });
6421
6457
  }
6422
6458
  sliceFromOffset(text, start) {
6423
6459
  if (!text) return "";
@@ -6575,11 +6611,15 @@ var init_provider_cli_adapter = __esm({
6575
6611
  let shellCmd;
6576
6612
  let shellArgs;
6577
6613
  const useShellUnix = !isWin && (!!spawnConfig.shell || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
6578
- const useShell = isWin ? !!spawnConfig.shell : useShellUnix;
6614
+ const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
6615
+ const useShell = isWin ? !!spawnConfig.shell || isCmdShim : useShellUnix;
6579
6616
  if (useShell) {
6580
6617
  if (!spawnConfig.shell && !isWin) {
6581
6618
  LOG.info("CLI", `[${this.cliType}] Using login shell (script shim or non-native binary)`);
6582
6619
  }
6620
+ if (isCmdShim) {
6621
+ LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell for .cmd/.bat shim: ${binaryPath}`);
6622
+ }
6583
6623
  shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
6584
6624
  if (isWin) {
6585
6625
  shellArgs = ["/c", binaryPath, ...allArgs];
@@ -38547,7 +38587,7 @@ var init_adhdev_daemon = __esm({
38547
38587
  fs16 = __toESM(require("fs"));
38548
38588
  path20 = __toESM(require("path"));
38549
38589
  import_chalk2 = __toESM(require("chalk"));
38550
- pkgVersion = "0.8.6";
38590
+ pkgVersion = "0.8.8";
38551
38591
  if (pkgVersion === "unknown") {
38552
38592
  try {
38553
38593
  const possiblePaths = [