File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export class CliInput extends EventEmitter {
1717 private userDir : string ;
1818 private multilineMode = false ;
1919 private multilineBuffer : string [ ] = [ ] ;
20+ private intentionalClose = false ;
2021
2122 constructor ( params : { prompt : string ; userDir : string } ) {
2223 super ( ) ;
@@ -39,12 +40,23 @@ export class CliInput extends EventEmitter {
3940 } ) ;
4041
4142 this . rl . on ( "close" , ( ) => {
43+ // readline can close spuriously (e.g. when ora clears lines).
44+ // Only truly exit on Ctrl+C (SIGINT) or explicit exit/quit command.
45+ // Recreate readline to keep accepting input.
46+ if ( ! this . intentionalClose ) {
47+ this . rl = null ;
48+ this . start ( ) ;
49+ }
50+ } ) ;
51+
52+ process . on ( "SIGINT" , ( ) => {
4253 this . emit ( "exit" ) ;
4354 } ) ;
4455 }
4556
4657 /** Stop listening */
4758 stop ( ) : void {
59+ this . intentionalClose = true ;
4860 this . rl ?. close ( ) ;
4961 this . rl = null ;
5062 }
Original file line number Diff line number Diff line change @@ -113,8 +113,8 @@ async function main() {
113113 // Create LLM provider
114114 const llm = createOpenAIProvider ( config . llm ) ;
115115
116- // Spinner for loading states
117- const spinner = ora ( { spinner : "dots" , color : "cyan" } ) ;
116+ // Spinner for loading states — must use stderr to avoid conflicting with readline on stdout
117+ const spinner = ora ( { spinner : "dots" , color : "cyan" , stream : process . stderr } ) ;
118118 let streamingStarted = false ;
119119
120120 // Create agent with callbacks
You can’t perform that action at this time.
0 commit comments