@@ -49,10 +49,6 @@ function textFrame(text: string): Uint8Array {
4949 return eventFrame ( "assistantResponseEvent" , { content : text } ) ;
5050}
5151
52- function reasoningFrame ( text : string ) : Uint8Array {
53- return eventFrame ( "reasoningContentEvent" , { text } ) ;
54- }
55-
5652function completionFrames ( answer : string , id = "completion-1" ) : Uint8Array [ ] {
5753 const input = JSON . stringify ( { answer } ) ;
5854 return [
@@ -132,9 +128,9 @@ function anthropicEvents(sse: string): Array<{ name: string; data: Record<string
132128}
133129
134130describe ( "Kiro completion through public server endpoints" , ( ) => {
135- test ( "/v1/responses lets the bounded fallback complete after reasoning-only output " , async ( ) => {
131+ test ( "/v1/responses keeps progress nonterminal and lets only the bounded fallback complete" , async ( ) => {
136132 const upstream = scriptedKiroUpstream ( [
137- [ reasoningFrame ( "Checking the workspace." ) ] ,
133+ [ textFrame ( "Checking the workspace." ) ] ,
138134 completionFrames ( "The workspace is ready." ) ,
139135 ] ) ;
140136 saveConfig ( kiroConfig ( upstream . server . url . toString ( ) ) ) ;
@@ -156,20 +152,21 @@ describe("Kiro completion through public server endpoints", () => {
156152 const events = responseEvents ( wire ) ;
157153 const text = events . filter ( event => event . name === "response.output_text.delta" ) ;
158154 expect ( text . map ( event => [ event . data . delta , event . data . phase ] ) ) . toEqual ( [
155+ [ "Checking the workspace." , undefined ] ,
159156 [ "The workspace is ready." , undefined ] ,
160157 ] ) ;
161158 const completed = events . filter ( event => event . name === "response.completed" ) ;
162159 expect ( completed ) . toHaveLength ( 1 ) ;
163160 expect ( events . at ( - 1 ) ?. name ) . toBe ( "response.completed" ) ;
164161 const messages = completed [ 0 ] . data . response . output . filter ( ( item : { type : string } ) => item . type === "message" ) ;
165- expect ( messages . map ( ( item : { phase ?: string } ) => item . phase ) ) . toEqual ( [ "final_answer" ] ) ;
162+ expect ( messages . map ( ( item : { phase ?: string } ) => item . phase ) ) . toEqual ( [ "commentary" , " final_answer"] ) ;
166163 expect ( wire ) . not . toContain ( KIRO_COMPLETION_TOOL_NAME ) ;
167164
168165 expect ( upstream . requests ) . toHaveLength ( 2 ) ;
169166 expect ( kiroToolNames ( upstream . requests [ 0 ] ) ) . toEqual ( [ "bash" , KIRO_COMPLETION_TOOL_NAME ] ) ;
170167 expect ( kiroToolNames ( upstream . requests [ 1 ] ) ) . toEqual ( [ "bash" , KIRO_COMPLETION_TOOL_NAME ] ) ;
171168 expect ( upstream . requests [ 1 ] . conversationState . history . at ( - 1 ) . assistantResponseMessage . content )
172- . toBe ( "" ) ;
169+ . toBe ( "Checking the workspace. " ) ;
173170 } finally {
174171 proxy . stop ( true ) ;
175172 upstream . server . stop ( true ) ;
@@ -181,7 +178,7 @@ describe("Kiro completion through public server endpoints", () => {
181178 [ "accepted text fallback" , [ textFrame ( "The Claude task is complete." ) ] ] ,
182179 ] ) ( "/v1/messages hides the private tool and ends after %s" , async ( _label , fallbackFrames ) => {
183180 const upstream = scriptedKiroUpstream ( [
184- [ reasoningFrame ( "I am checking the Claude task." ) ] ,
181+ [ textFrame ( "I am checking the Claude task." ) ] ,
185182 fallbackFrames ,
186183 ] ) ;
187184 saveConfig ( kiroConfig ( upstream . server . url . toString ( ) ) ) ;
@@ -205,7 +202,7 @@ describe("Kiro completion through public server endpoints", () => {
205202 const deltas = events
206203 . filter ( event => event . name === "content_block_delta" && event . data . delta ?. type === "text_delta" )
207204 . map ( event => event . data . delta . text ) ;
208- expect ( deltas ) . toEqual ( [ "The Claude task is complete." ] ) ;
205+ expect ( deltas ) . toEqual ( [ "I am checking the Claude task." , " The Claude task is complete."] ) ;
209206 expect ( events . filter ( event => event . name === "message_delta" ) ) . toHaveLength ( 1 ) ;
210207 expect ( events . find ( event => event . name === "message_delta" ) ?. data . delta . stop_reason ) . toBe ( "end_turn" ) ;
211208 expect ( events . at ( - 1 ) ?. name ) . toBe ( "message_stop" ) ;
0 commit comments