diff --git a/src/cli/components/InputRich.tsx b/src/cli/components/InputRich.tsx index 8120d06..942a911 100644 --- a/src/cli/components/InputRich.tsx +++ b/src/cli/components/InputRich.tsx @@ -1,4 +1,6 @@ // Import useInput from vendored Ink for bracketed paste support + +import { EventEmitter } from "node:events"; import { stdin } from "node:process"; import { Box, Text, useInput } from "ink"; import SpinnerLib from "ink-spinner"; @@ -24,6 +26,14 @@ const COUNTER_VISIBLE_THRESHOLD = 1000; // Window for double-escape to clear input const ESC_CLEAR_WINDOW_MS = 2500; +// Increase max listeners to accommodate multiple useInput hooks +// (5 in this component + autocomplete components) +stdin.setMaxListeners(20); + +// Also set default max listeners on EventEmitter prototype to prevent warnings +// from any EventEmitters that might not have their limit set properly +EventEmitter.defaultMaxListeners = 20; + export function Input({ visible = true, streaming,