@tritard/waterbrother 0.14.3 → 0.14.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +14 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tritard/waterbrother",
3
- "version": "0.14.3",
3
+ "version": "0.14.5",
4
4
  "description": "Waterbrother: Grok-powered coding CLI with local tools, sessions, operator modes, and approval controls",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -4774,9 +4774,20 @@ async function readInteractiveLine(options = {}) {
4774
4774
  });
4775
4775
  }
4776
4776
 
4777
- // Ensure stdin is in a clean state before attaching listeners.
4778
- // The interrupt listener may have paused stdin and toggled raw mode
4779
- // between turns, leaving readline's internal keypress emitter stale.
4777
+ // Nuclear stdin reset force a completely clean state every time.
4778
+ // The readline keypress emitter guards with a Symbol and only attaches once.
4779
+ // After interrupt listeners, promptLine, and approval prompts mess with stdin,
4780
+ // the internal handler gets stale. Force it to re-attach by clearing the guard.
4781
+ const kEmit = Symbol.for("readline.emitKeypressEvents");
4782
+ if (input[kEmit]) {
4783
+ // Remove the old internal data listener that readline attached
4784
+ const oldListeners = input.rawListeners("data").slice();
4785
+ for (const fn of oldListeners) {
4786
+ // readline's internal listener is not our onData — remove all, re-add ours after
4787
+ input.removeListener("data", fn);
4788
+ }
4789
+ delete input[kEmit];
4790
+ }
4780
4791
  if (input.isTTY) {
4781
4792
  try { input.setRawMode(false); } catch {}
4782
4793
  }