@integrity-labs/agt-cli 0.27.90 → 0.27.92

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.
@@ -403,9 +403,15 @@ function simpleTextHash(s) {
403
403
  // src/lib/channel-input-watchdog.ts
404
404
  var STUCK_THRESHOLD_MS = 5e3;
405
405
  var MAX_ENTER_FIRES = 3;
406
+ var DISTURB_HEAL_KEYS = ["x", "BSpace", "Enter"];
407
+ var DISTURB_INTER_KEY_DELAY_MS = 200;
406
408
  var ATTACHED_STUCK_THRESHOLD_MS = 15e3;
407
409
  var INPUT_BOX_DIVIDER = /^[─━]{10,}/;
408
410
  var PROMPT_PREFIX = "\u276F ";
411
+ function selectFireKeys(attempt, healMode = "disturb") {
412
+ if (healMode === "disturb" && attempt >= 2) return DISTURB_HEAL_KEYS;
413
+ return ["Enter"];
414
+ }
409
415
  function decide(pane, prev, now, config = {}) {
410
416
  const threshold = config.stuckThresholdMs ?? STUCK_THRESHOLD_MS;
411
417
  const maxFires = config.maxEnterFires ?? MAX_ENTER_FIRES;
@@ -496,6 +502,11 @@ function checkOne(codeName, io, config, states) {
496
502
  const { fire, dialog, gaveUp, next } = decide(pane, prev, io.now(), effectiveConfig);
497
503
  if (next === void 0) {
498
504
  states.delete(codeName);
505
+ if (prev && prev.fires > 0) {
506
+ io.log(
507
+ `[channel-input-watchdog] '${codeName}': recovered after ${prev.fires} fire(s) \u2014 input submitted (input_hash=${prev.lastInputHash})`
508
+ );
509
+ }
499
510
  } else {
500
511
  states.set(codeName, next);
501
512
  }
@@ -518,10 +529,19 @@ function checkOne(codeName, io, config, states) {
518
529
  }
519
530
  if (fire) {
520
531
  const maxFires = effectiveConfig.maxEnterFires ?? MAX_ENTER_FIRES;
521
- io.log(
522
- `[channel-input-watchdog] '${codeName}': stuck channel input \u2014 firing Enter (attempt ${next?.fires ?? 1}/${maxFires}, input_hash=${hash}, len=${text.length})`
523
- );
524
- io.sendEnter(codeName);
532
+ const attempt = next?.fires ?? 1;
533
+ const keys = selectFireKeys(attempt, effectiveConfig.healMode);
534
+ if (keys.length === 1 && keys[0] === "Enter") {
535
+ io.log(
536
+ `[channel-input-watchdog] '${codeName}': stuck channel input \u2014 firing Enter (attempt ${attempt}/${maxFires}, input_hash=${hash}, len=${text.length})`
537
+ );
538
+ io.sendEnter(codeName);
539
+ } else {
540
+ io.log(
541
+ `[channel-input-watchdog] '${codeName}': stuck channel input \u2014 escalating to disturb sequence ${keys.join("\u2192")} (attempt ${attempt}/${maxFires}, input_hash=${hash}, len=${text.length})`
542
+ );
543
+ io.sendKeys(codeName, keys, DISTURB_INTER_KEY_DELAY_MS);
544
+ }
525
545
  }
526
546
  }
527
547
  var sharedStates = /* @__PURE__ */ new Map();
@@ -1528,4 +1548,4 @@ export {
1528
1548
  stopAllSessionsAndWait,
1529
1549
  getProjectDir
1530
1550
  };
1531
- //# sourceMappingURL=chunk-4MZWINDQ.js.map
1551
+ //# sourceMappingURL=chunk-RDIDG5IF.js.map