@integrity-labs/agt-cli 0.28.708 → 0.28.710

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.
@@ -17,7 +17,7 @@ import {
17
17
  rotateDailySession,
18
18
  sessionFileExists,
19
19
  todayLocalIso
20
- } from "./chunk-NOGQSRQM.js";
20
+ } from "./chunk-FM63TWR3.js";
21
21
  import {
22
22
  reapOrphanChannelMcps
23
23
  } from "./chunk-XWVM4KPK.js";
@@ -2620,6 +2620,52 @@ function findUsageLimitSafeOption(screen) {
2620
2620
  function findUsageLimitSafeOptionKey(screen) {
2621
2621
  return findUsageLimitSafeOption(screen)?.key ?? null;
2622
2622
  }
2623
+ var CONSENT_BLOCK_LINES = 12;
2624
+ function lastIndexWhere(xs, pred) {
2625
+ for (let i = xs.length - 1; i >= 0; i--) {
2626
+ if (pred(xs[i])) return i;
2627
+ }
2628
+ return -1;
2629
+ }
2630
+ function isCursorRow(line2) {
2631
+ return /^[^\S\n]*❯[^\S\n]+\S/.test(line2);
2632
+ }
2633
+ function isOptionRowFor(line2, label) {
2634
+ const escaped = label.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
2635
+ return new RegExp(
2636
+ String.raw`^[^\S\n]*(?:❯[^\S\n]*)?(?:\d\.[^\S\n]*)?` + escaped + String.raw`[^\S\n]*$`
2637
+ ).test(line2);
2638
+ }
2639
+ function selectRowKeys(screen, label) {
2640
+ const block = focusedModalBlock(screen, CONSENT_BLOCK_LINES);
2641
+ if (!block) return null;
2642
+ const target = lastIndexWhere(block, (l) => isOptionRowFor(l, label));
2643
+ if (target < 0) return null;
2644
+ const digit = optionRowDigit(block[target], label);
2645
+ if (digit !== null) return [digit, "Enter"];
2646
+ const cursors = [];
2647
+ for (let i = 0; i < block.length; i++) {
2648
+ if (isCursorRow(block[i])) cursors.push(i);
2649
+ }
2650
+ if (cursors.length === 0) return null;
2651
+ let cursor = cursors[0];
2652
+ let tied = false;
2653
+ for (const i of cursors.slice(1)) {
2654
+ const d = Math.abs(i - target);
2655
+ const best = Math.abs(cursor - target);
2656
+ if (d < best) {
2657
+ cursor = i;
2658
+ tied = false;
2659
+ } else if (d === best) {
2660
+ tied = true;
2661
+ }
2662
+ }
2663
+ if (tied) return null;
2664
+ const distance = target - cursor;
2665
+ if (distance === 0) return ["Enter"];
2666
+ const step = distance > 0 ? "Down" : "Up";
2667
+ return [...Array(Math.abs(distance)).fill(step), "Enter"];
2668
+ }
2623
2669
  function findUsageLimitResetHint(screen) {
2624
2670
  const block = usageLimitModalBlock(screen);
2625
2671
  if (!block) return null;
@@ -2659,18 +2705,20 @@ function sweepDialogs(screen) {
2659
2705
  logMessage: "Auto-accepted theme picker"
2660
2706
  };
2661
2707
  }
2662
- if (screen.includes("Yes, I trust this folder")) {
2708
+ const trustKeys = screen.includes("Yes, I trust this folder") ? selectRowKeys(screen, "Yes, I trust this folder") : null;
2709
+ if (trustKeys) {
2663
2710
  return {
2664
2711
  kind: "folder-trust",
2665
- keys: ["Enter"],
2666
- interKeyDelayMs: 0,
2712
+ keys: trustKeys,
2713
+ interKeyDelayMs: 300,
2667
2714
  logMessage: "Auto-accepted folder trust"
2668
2715
  };
2669
2716
  }
2670
- if (isResumeModeDialogVisible(screen)) {
2717
+ const resumeKeys = isResumeModeDialogVisible(screen) ? selectRowKeys(screen, "Don't ask me again") : null;
2718
+ if (resumeKeys) {
2671
2719
  return {
2672
2720
  kind: "resume-mode",
2673
- keys: ["3", "Enter"],
2721
+ keys: resumeKeys,
2674
2722
  interKeyDelayMs: 300,
2675
2723
  logMessage: "Auto-dismissed resume-mode dialog (picked 'Don't ask me again')"
2676
2724
  };
@@ -2691,10 +2739,11 @@ function sweepDialogs(screen) {
2691
2739
  logMessage: "Auto-accepted MCP servers"
2692
2740
  };
2693
2741
  }
2694
- if (screen.includes("Yes, I accept") && screen.includes("Bypass Permissions")) {
2742
+ const bypassKeys = screen.includes("Yes, I accept") && screen.includes("Bypass Permissions") ? selectRowKeys(screen, "Yes, I accept") : null;
2743
+ if (bypassKeys) {
2695
2744
  return {
2696
2745
  kind: "bypass-permissions",
2697
- keys: ["2", "Enter"],
2746
+ keys: bypassKeys,
2698
2747
  interKeyDelayMs: 300,
2699
2748
  logMessage: "Auto-accepted bypass permissions"
2700
2749
  };
@@ -4540,4 +4589,4 @@ export {
4540
4589
  stopAllSessionsAndWait,
4541
4590
  getProjectDir
4542
4591
  };
4543
- //# sourceMappingURL=chunk-VYG4CTEQ.js.map
4592
+ //# sourceMappingURL=chunk-SR2HUGEA.js.map