@@ -393,16 +393,30 @@ async function runDeliveryTool<T>(
393393 usedTools : Array < Record < string , unknown > > ,
394394 additionalInputSummary : Record < string , unknown > = { } ,
395395) : Promise < T > {
396+ const toolIndex = usedTools . length ;
397+ const toolKey = `${ toolName } :${ toolIndex } ` ;
396398 const summarizedInput = summarizeToolInput ( input , additionalInputSummary ) ;
397399 try {
398400 const output = await run ( ) ;
399401 const summarizedOutput = summarizeToolOutput ( output ) ;
400402 usedTools . push ( { tool : toolName , input : summarizedInput , output : summarizedOutput } ) ;
403+ execution . store ?.( 'tools' , toolKey , {
404+ tool : toolName ,
405+ ok : true ,
406+ input : summarizedInput ,
407+ output : summarizedOutput ,
408+ } ) ;
401409 await emitToolUsage ( execution , toolName , summarizedInput , summarizedOutput , null ) ;
402410 return output ;
403411 } catch ( error ) {
404412 const message = error instanceof Error ? error . message : String ( error ) ;
405413 usedTools . push ( { tool : toolName , input : summarizedInput , error : { message } } ) ;
414+ execution . store ?.( 'tools' , toolKey , {
415+ tool : toolName ,
416+ ok : false ,
417+ input : summarizedInput ,
418+ error : { message } ,
419+ } ) ;
406420 await emitToolUsage ( execution , toolName , summarizedInput , null , message ) ;
407421 throw error ;
408422 }
0 commit comments