File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " spec2tools" ,
3- "version" : " 0.1.2 " ,
3+ "version" : " 0.1.3 " ,
44 "description" : " Dynamically convert OpenAPI specs into AI agent tools at runtime" ,
55 "type" : " module" ,
66 "main" : " dist/main.js" ,
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export class Agent {
2121
2222 constructor ( config : AgentConfig ) {
2323 this . tools = config . tools ;
24- this . model = config . model || 'gpt-4o ' ;
24+ this . model = config . model || 'gpt-5.1-chat-latest ' ;
2525 this . maxSteps = config . maxSteps || 10 ;
2626 this . conversationHistory = [ ] ;
2727 }
Original file line number Diff line number Diff line change @@ -155,25 +155,29 @@ async function startChatLoop(session: Session): Promise<void> {
155155 } ) ;
156156
157157 const prompt = ( ) : void => {
158- rl . question ( chalk . cyan ( '> ' ) , ( input ) => {
158+ rl . question ( chalk . cyan ( '> ' ) , async ( input ) => {
159159 const trimmedInput = input . trim ( ) ;
160160
161161 if ( ! trimmedInput ) {
162162 prompt ( ) ;
163163 return ;
164164 }
165165
166- handleInput ( trimmedInput , session , agent )
167- . catch ( ( error ) => {
168- console . error (
169- chalk . red (
170- `Error: ${ error instanceof Error ? error . message : String ( error ) } `
171- )
172- ) ;
173- } )
174- . finally ( ( ) => {
175- prompt ( ) ;
176- } ) ;
166+ // Pause readline during async operations to prevent corruption
167+ rl . pause ( ) ;
168+
169+ try {
170+ await handleInput ( trimmedInput , session , agent ) ;
171+ } catch ( error ) {
172+ console . error (
173+ chalk . red (
174+ `Error: ${ error instanceof Error ? error . message : String ( error ) } `
175+ )
176+ ) ;
177+ } finally {
178+ rl . resume ( ) ;
179+ prompt ( ) ;
180+ }
177181 } ) ;
178182 } ;
179183
You can’t perform that action at this time.
0 commit comments