File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -576,16 +576,19 @@ const program = Effect.gen(function* () {
576576 mode : "default" ,
577577 } ,
578578 } ) ;
579+ if ( typeof result !== "object" || result === null || ! ( "outcome" in result ) ) {
580+ throw new Error ( "Expected _x.ai/ask_user_question response outcome." ) ;
581+ }
582+ if ( result . outcome === "cancelled" ) {
583+ return { stopReason : "end_turn" } ;
584+ }
579585 if (
580- typeof result !== "object" ||
581- result === null ||
582- ! ( "outcome" in result ) ||
583586 result . outcome !== "accepted" ||
584587 ! ( "answers" in result ) ||
585588 typeof result . answers !== "object" ||
586589 result . answers === null
587590 ) {
588- throw new Error ( "Expected _x.ai/ask_user_question response outcome ." ) ;
591+ throw new Error ( "Expected accepted _x.ai/ask_user_question response answers ." ) ;
589592 }
590593
591594 return { stopReason : "end_turn" } ;
You can’t perform that action at this time.
0 commit comments