@@ -17,6 +17,7 @@ import type {
1717 PatchApplyStatus ,
1818 ThreadItem ,
1919} from "./app-server/v2" ;
20+ import type { JsonValue } from "./app-server/serde_json/JsonValue" ;
2021
2122type CodexItemStatus = CommandExecutionStatus | PatchApplyStatus | McpToolCallStatus | DynamicToolCallStatus ;
2223type AcpToolCallStatus = "pending" | "in_progress" | "completed" | "failed" ;
@@ -83,27 +84,26 @@ export async function createCommandExecutionUpdate(
8384export async function createMcpToolCallUpdate (
8485 item : ThreadItem & { type : "mcpToolCall" }
8586) : Promise < UpdateSessionEvent > {
86- return {
87- sessionUpdate : "tool_call" ,
88- toolCallId : item . id ,
89- kind : "execute" ,
90- title : `mcp.${ item . server } .${ item . tool } ` ,
91- status : toAcpStatus ( item . status ) ,
92- } ;
87+ return createExecuteToolCallUpdate ( item , `mcp.${ item . server } .${ item . tool } ` ) ;
9388}
94-
9589export async function createDynamicToolCallUpdate (
9690 item : ThreadItem & { type : "dynamicToolCall" }
91+ ) : Promise < UpdateSessionEvent > {
92+ return createExecuteToolCallUpdate ( item , item . tool , { arguments : item . arguments } )
93+ }
94+
95+ export async function createExecuteToolCallUpdate (
96+ item : ThreadItem & ( { type : "mcpToolCall" } | { type : "dynamicToolCall" } ) ,
97+ title : string ,
98+ rawInput ?: { arguments : JsonValue }
9799) : Promise < UpdateSessionEvent > {
98100 return {
99101 sessionUpdate : "tool_call" ,
100102 toolCallId : item . id ,
101103 kind : "execute" ,
102- title : item . tool ,
104+ title : title ,
103105 status : toAcpStatus ( item . status ) ,
104- rawInput : {
105- arguments : item . arguments ,
106- } ,
106+ rawInput : rawInput ,
107107 } ;
108108}
109109
0 commit comments