@@ -347,6 +347,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
347347 processor : Pick < SessionProcessor . Handle , "message" | "updateToolCall" | "completeToolCall" >
348348 bypassAgentCheck : boolean
349349 messages : MessageV2 . WithParts [ ]
350+ parentAgent ?: string
350351 } ) {
351352 using _ = log . time ( "resolveTools" )
352353 const tools : Record < string , AITool > = { }
@@ -402,7 +403,14 @@ NOTE: At any point in time through this workflow you should feel free to ask the
402403 const ctx = context ( args , options )
403404 yield * plugin . trigger (
404405 "tool.execute.before" ,
405- { tool : item . id , sessionID : ctx . sessionID , callID : ctx . callID } ,
406+ {
407+ tool : item . id ,
408+ sessionID : ctx . sessionID ,
409+ messageID : input . processor . message . id ,
410+ callID : ctx . callID ,
411+ agent : ctx . agent ,
412+ parentAgent : input . parentAgent ,
413+ } ,
406414 { args } ,
407415 )
408416 const result = yield * Effect . promise ( ( ) => item . execute ( args , ctx ) )
@@ -417,7 +425,15 @@ NOTE: At any point in time through this workflow you should feel free to ask the
417425 }
418426 yield * plugin . trigger (
419427 "tool.execute.after" ,
420- { tool : item . id , sessionID : ctx . sessionID , callID : ctx . callID , args } ,
428+ {
429+ tool : item . id ,
430+ sessionID : ctx . sessionID ,
431+ messageID : input . processor . message . id ,
432+ callID : ctx . callID ,
433+ args,
434+ agent : ctx . agent ,
435+ parentAgent : input . parentAgent ,
436+ } ,
421437 output ,
422438 )
423439 if ( options . abortSignal ?. aborted ) {
@@ -443,7 +459,14 @@ NOTE: At any point in time through this workflow you should feel free to ask the
443459 const ctx = context ( args , opts )
444460 yield * plugin . trigger (
445461 "tool.execute.before" ,
446- { tool : key , sessionID : ctx . sessionID , callID : opts . toolCallId } ,
462+ {
463+ tool : key ,
464+ sessionID : ctx . sessionID ,
465+ messageID : input . processor . message . id ,
466+ callID : opts . toolCallId ,
467+ agent : ctx . agent ,
468+ parentAgent : input . parentAgent ,
469+ } ,
447470 { args } ,
448471 )
449472 yield * Effect . promise ( ( ) => ctx . ask ( { permission : key , metadata : { } , patterns : [ "*" ] , always : [ "*" ] } ) )
@@ -452,7 +475,15 @@ NOTE: At any point in time through this workflow you should feel free to ask the
452475 )
453476 yield * plugin . trigger (
454477 "tool.execute.after" ,
455- { tool : key , sessionID : ctx . sessionID , callID : opts . toolCallId , args } ,
478+ {
479+ tool : key ,
480+ sessionID : ctx . sessionID ,
481+ messageID : input . processor . message . id ,
482+ callID : opts . toolCallId ,
483+ args,
484+ agent : ctx . agent ,
485+ parentAgent : input . parentAgent ,
486+ } ,
456487 result ,
457488 )
458489
@@ -564,7 +595,14 @@ NOTE: At any point in time through this workflow you should feel free to ask the
564595 }
565596 yield * plugin . trigger (
566597 "tool.execute.before" ,
567- { tool : TaskTool . id , sessionID, callID : part . id } ,
598+ {
599+ tool : TaskTool . id ,
600+ sessionID,
601+ messageID : assistantMessage . id ,
602+ callID : part . id ,
603+ agent : lastUser . agent ,
604+ parentAgent : lastUser . parentAgent ,
605+ } ,
568606 { args : taskArgs } ,
569607 )
570608
@@ -582,6 +620,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
582620 taskTool
583621 . execute ( taskArgs , {
584622 agent : task . agent ,
623+ parentAgent : lastUser . agent ,
585624 messageID : assistantMessage . id ,
586625 sessionID,
587626 abort : signal ,
@@ -645,7 +684,15 @@ NOTE: At any point in time through this workflow you should feel free to ask the
645684
646685 yield * plugin . trigger (
647686 "tool.execute.after" ,
648- { tool : TaskTool . id , sessionID, callID : part . id , args : taskArgs } ,
687+ {
688+ tool : TaskTool . id ,
689+ sessionID,
690+ messageID : assistantMessage . id ,
691+ callID : part . id ,
692+ args : taskArgs ,
693+ agent : lastUser . agent ,
694+ parentAgent : lastUser . parentAgent ,
695+ } ,
649696 result ,
650697 )
651698
@@ -726,6 +773,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
726773 time : { created : Date . now ( ) } ,
727774 role : "user" ,
728775 agent : input . agent ,
776+ parentAgent : input . parentAgent ,
729777 model : { providerID : model . providerID , modelID : model . modelID } ,
730778 }
731779 yield * sessions . updateMessage ( userMsg )
@@ -812,7 +860,14 @@ NOTE: At any point in time through this workflow you should feel free to ask the
812860 const cwd = ctx . directory
813861 const shellEnv = yield * plugin . trigger (
814862 "shell.env" ,
815- { cwd, sessionID : input . sessionID , callID : part . callID } ,
863+ {
864+ cwd,
865+ sessionID : input . sessionID ,
866+ messageID : part . messageID ,
867+ callID : part . callID ,
868+ agent : input . agent ,
869+ parentAgent : input . parentAgent ,
870+ } ,
816871 { env : { } } ,
817872 )
818873
@@ -1702,6 +1757,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
17021757 } )
17031758 . optional ( ) ,
17041759 agent : z . string ( ) . optional ( ) ,
1760+ parentAgent : z . string ( ) . optional ( ) ,
17051761 noReply : z . boolean ( ) . optional ( ) ,
17061762 tools : z
17071763 . record ( z . string ( ) , z . boolean ( ) )
@@ -1783,6 +1839,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
17831839 sessionID : SessionID . zod ,
17841840 messageID : MessageID . zod . optional ( ) ,
17851841 agent : z . string ( ) ,
1842+ parentAgent : z . string ( ) . optional ( ) ,
17861843 model : z
17871844 . object ( {
17881845 providerID : ProviderID . zod ,
0 commit comments