@@ -361,6 +361,50 @@ describe("AcpRuntimeModel", () => {
361361 ) . toBe ( true ) ;
362362 } ) ;
363363
364+ it ( "clears explicitly nulled ACP v2 tool call fields and replaces raw input" , ( ) => {
365+ const toolCall = ( update : Omit < EffectAcpSchema . ToolCallUpdate , "toolCallId" > ) => {
366+ const parsed = parseSessionUpdateEvent ( {
367+ sessionId : "session-1" ,
368+ update : { sessionUpdate : "tool_call_update" , toolCallId : "call-1" , ...update } ,
369+ } satisfies EffectAcpSchema . SessionNotification ) ;
370+ const event = parsed . events . find ( ( candidate ) => candidate . _tag === "ToolCallUpdated" ) ;
371+ if ( ! event || event . _tag !== "ToolCallUpdated" ) {
372+ throw new Error ( "expected a tool call update" ) ;
373+ }
374+ return event . toolCall ;
375+ } ;
376+
377+ const created = toolCall ( {
378+ name : "old-name" ,
379+ title : "Old title" ,
380+ kind : "read" ,
381+ status : "in_progress" ,
382+ content : [ { type : "content" , content : { type : "text" , text : "old output" } } ] ,
383+ rawInput : { path : "old.txt" , obsolete : true } ,
384+ _meta : { old : true } ,
385+ } ) ;
386+
387+ expect (
388+ mergeToolCallState ( created , toolCall ( { rawInput : { path : "new.txt" } } ) ) . data . rawInput ,
389+ ) . toEqual ( { path : "new.txt" } ) ;
390+
391+ const cleared = mergeToolCallState (
392+ created ,
393+ toolCall ( {
394+ name : null ,
395+ title : null ,
396+ kind : null ,
397+ status : null ,
398+ content : null ,
399+ rawInput : null ,
400+ _meta : null ,
401+ } ) ,
402+ ) ;
403+ const { name, title, kind, content, rawInput, meta } = cleared . data ;
404+ expect ( { name, title, kind, content, rawInput, meta } ) . toEqual ( { } ) ;
405+ expect ( { kind : cleared . kind , title : cleared . title , status : cleared . status } ) . toEqual ( { } ) ;
406+ } ) ;
407+
364408 it ( "forwards an empty ACP v1 plan to clear previous entries" , ( ) => {
365409 const entries = [
366410 [ { content : "Inspect state" , priority : "high" , status : "pending" } ] ,
0 commit comments