@@ -228,7 +228,7 @@ private async Task ExecuteGraphNodeDfs(
228228 if ( RuleConstant . CONDITION_NODE_TYPES . Contains ( nextNode . Type ) )
229229 {
230230 // Execute condition node
231- var conditionResult = await ExecuteCondition ( nextNode , graph , agent , trigger , context ) ;
231+ var conditionResult = await ExecuteCondition ( nextNode , edge , graph , agent , trigger , context ) ;
232232 if ( conditionResult == null )
233233 {
234234 results . Add ( RuleFlowStepResult . FromResult ( new ( )
@@ -255,7 +255,7 @@ private async Task ExecuteGraphNodeDfs(
255255 else if ( RuleConstant . ACTION_NODE_TYPES . Contains ( nextNode . Type ) )
256256 {
257257 // Execute action node
258- var actionResult = await ExecuteAction ( nextNode , graph , agent , trigger , context ) ;
258+ var actionResult = await ExecuteAction ( nextNode , edge , graph , agent , trigger , context ) ;
259259 if ( actionResult == null )
260260 {
261261 results . Add ( RuleFlowStepResult . FromResult ( new ( )
@@ -337,7 +337,7 @@ private async Task ExecuteGraphNodeBfs(
337337 if ( RuleConstant . CONDITION_NODE_TYPES . Contains ( nextNode . Type ) )
338338 {
339339 // Execute condition node
340- var conditionResult = await ExecuteCondition ( nextNode , graph , agent , trigger , context ) ;
340+ var conditionResult = await ExecuteCondition ( nextNode , nextEdge , graph , agent , trigger , context ) ;
341341 innerData = new ( context . Parameters ?? [ ] ) ;
342342
343343 if ( conditionResult == null )
@@ -369,7 +369,7 @@ private async Task ExecuteGraphNodeBfs(
369369 else if ( RuleConstant . ACTION_NODE_TYPES . Contains ( nextNode . Type ) )
370370 {
371371 // Execute action node
372- var actionResult = await ExecuteAction ( nextNode , graph , agent , trigger , context ) ;
372+ var actionResult = await ExecuteAction ( nextNode , nextEdge , graph , agent , trigger , context ) ;
373373 innerData = new ( context . Parameters ?? [ ] ) ;
374374
375375 if ( actionResult == null )
@@ -413,6 +413,7 @@ private async Task ExecuteGraphNodeBfs(
413413 #region Action
414414 private async Task < RuleNodeResult ? > ExecuteAction (
415415 RuleNode node ,
416+ RuleEdge incomingEdge ,
416417 RuleGraph graph ,
417418 Agent agent ,
418419 IRuleTrigger trigger ,
@@ -435,7 +436,7 @@ private async Task ExecuteGraphNodeBfs(
435436 var hooks = _services . GetHooks < IRuleTriggerHook > ( agent . Id ) ;
436437 foreach ( var hook in hooks )
437438 {
438- await hook . BeforeRuleActionExecuting ( agent , node , trigger , context ) ;
439+ await hook . BeforeRuleActionExecuting ( agent , node , incomingEdge , trigger , context ) ;
439440 }
440441
441442 // Execute action
@@ -444,7 +445,7 @@ private async Task ExecuteGraphNodeBfs(
444445
445446 foreach ( var hook in hooks )
446447 {
447- await hook . AfterRuleActionExecuted ( agent , node , trigger , context , result ) ;
448+ await hook . AfterRuleActionExecuted ( agent , node , incomingEdge , trigger , context , result ) ;
448449 }
449450
450451 return result ;
@@ -499,6 +500,7 @@ private async Task ExecuteGraphNodeBfs(
499500 #region Condition
500501 private async Task < RuleNodeResult ? > ExecuteCondition (
501502 RuleNode node ,
503+ RuleEdge incomingEdge ,
502504 RuleGraph graph ,
503505 Agent agent ,
504506 IRuleTrigger trigger ,
@@ -521,7 +523,7 @@ private async Task ExecuteGraphNodeBfs(
521523 var hooks = _services . GetHooks < IRuleTriggerHook > ( agent . Id ) ;
522524 foreach ( var hook in hooks )
523525 {
524- await hook . BeforeRuleConditionExecuting ( agent , node , trigger , context ) ;
526+ await hook . BeforeRuleConditionExecuting ( agent , node , incomingEdge , trigger , context ) ;
525527 }
526528
527529 // Execute condition
@@ -530,7 +532,7 @@ private async Task ExecuteGraphNodeBfs(
530532
531533 foreach ( var hook in hooks )
532534 {
533- await hook . AfterRuleConditionExecuted ( agent , node , trigger , context , result ) ;
535+ await hook . AfterRuleConditionExecuted ( agent , node , incomingEdge , trigger , context , result ) ;
534536 }
535537
536538 return result ;
0 commit comments