@@ -5075,6 +5075,122 @@ describe("openai transport stream", () => {
50755075 }
50765076 } ) ;
50775077
5078+ it ( "replays update_plan-style empty non-image Responses tool results as no output" , ( ) => {
5079+ const params = buildOpenAIResponsesParams (
5080+ {
5081+ id : "gpt-5.5" ,
5082+ name : "GPT-5.5" ,
5083+ api : "openai-responses" ,
5084+ provider : "openai" ,
5085+ baseUrl : "https://api.openai.com/v1" ,
5086+ reasoning : true ,
5087+ input : [ "text" ] ,
5088+ cost : { input : 0 , output : 0 , cacheRead : 0 , cacheWrite : 0 } ,
5089+ contextWindow : 200000 ,
5090+ maxTokens : 8192 ,
5091+ } satisfies Model < "openai-responses" > ,
5092+ {
5093+ systemPrompt : "system" ,
5094+ messages : [
5095+ {
5096+ role : "assistant" ,
5097+ api : "openai-responses" ,
5098+ provider : "openai" ,
5099+ model : "gpt-5.5" ,
5100+ usage : {
5101+ input : 0 ,
5102+ output : 0 ,
5103+ cacheRead : 0 ,
5104+ cacheWrite : 0 ,
5105+ totalTokens : 0 ,
5106+ cost : { input : 0 , output : 0 , cacheRead : 0 , cacheWrite : 0 , total : 0 } ,
5107+ } ,
5108+ stopReason : "toolUse" ,
5109+ timestamp : 1 ,
5110+ content : [ { type : "toolCall" , id : "call_plan" , name : "update_plan" , arguments : { } } ] ,
5111+ } ,
5112+ {
5113+ role : "toolResult" ,
5114+ toolCallId : "call_plan" ,
5115+ toolName : "update_plan" ,
5116+ content : [ ] ,
5117+ isError : false ,
5118+ timestamp : 2 ,
5119+ } ,
5120+ ] ,
5121+ tools : [ ] ,
5122+ } as never ,
5123+ { sessionId : "session-123" } ,
5124+ ) as {
5125+ input ?: Array < { type ?: string ; call_id ?: string ; output ?: unknown } > ;
5126+ } ;
5127+
5128+ expect ( params . input ?. find ( ( item ) => item . type === "function_call_output" ) ) . toMatchObject ( {
5129+ type : "function_call_output" ,
5130+ call_id : "call_plan" ,
5131+ output : "(no output)" ,
5132+ } ) ;
5133+ } ) ;
5134+
5135+ it ( "preserves image-bearing Responses tool results as image input parts" , ( ) => {
5136+ const params = buildOpenAIResponsesParams (
5137+ {
5138+ id : "gpt-5.5" ,
5139+ name : "GPT-5.5" ,
5140+ api : "openai-responses" ,
5141+ provider : "openai" ,
5142+ baseUrl : "https://api.openai.com/v1" ,
5143+ reasoning : true ,
5144+ input : [ "text" , "image" ] ,
5145+ cost : { input : 0 , output : 0 , cacheRead : 0 , cacheWrite : 0 } ,
5146+ contextWindow : 200000 ,
5147+ maxTokens : 8192 ,
5148+ } satisfies Model < "openai-responses" > ,
5149+ {
5150+ systemPrompt : "system" ,
5151+ messages : [
5152+ {
5153+ role : "assistant" ,
5154+ api : "openai-responses" ,
5155+ provider : "openai" ,
5156+ model : "gpt-5.5" ,
5157+ usage : {
5158+ input : 0 ,
5159+ output : 0 ,
5160+ cacheRead : 0 ,
5161+ cacheWrite : 0 ,
5162+ totalTokens : 0 ,
5163+ cost : { input : 0 , output : 0 , cacheRead : 0 , cacheWrite : 0 , total : 0 } ,
5164+ } ,
5165+ stopReason : "toolUse" ,
5166+ timestamp : 1 ,
5167+ content : [ { type : "toolCall" , id : "call_shot" , name : "screenshot" , arguments : { } } ] ,
5168+ } ,
5169+ {
5170+ role : "toolResult" ,
5171+ toolCallId : "call_shot" ,
5172+ toolName : "screenshot" ,
5173+ content : [ { type : "image" , mimeType : "image/png" , data : "aW1n" } ] ,
5174+ isError : false ,
5175+ timestamp : 2 ,
5176+ } ,
5177+ ] ,
5178+ tools : [ ] ,
5179+ } as never ,
5180+ { sessionId : "session-123" } ,
5181+ ) as {
5182+ input ?: Array < { type ?: string ; output ?: unknown } > ;
5183+ } ;
5184+
5185+ expect ( params . input ?. find ( ( item ) => item . type === "function_call_output" ) ?. output ) . toEqual ( [
5186+ {
5187+ type : "input_image" ,
5188+ detail : "auto" ,
5189+ image_url : "data:image/png;base64,aW1n" ,
5190+ } ,
5191+ ] ) ;
5192+ } ) ;
5193+
50785194 it ( "omits distinct overlong Copilot Responses replay item ids when store is disabled" , ( ) => {
50795195 const sharedToolItemPrefix = "iVec" + "A" . repeat ( 160 ) ;
50805196 const firstToolCallId = `call_first|${ sharedToolItemPrefix } Aa` ;
0 commit comments