@illuma-ai/agents 1.1.23 → 1.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -550,6 +550,20 @@ class MultiAgentGraph extends StandardGraph {
550
550
  console.debug(`[MultiAgentGraph] Handoff "${sourceAgentId}" -> "${destination}" START ` +
551
551
  `(messages: ${childMessages.length})`);
552
552
  try {
553
+ /**
554
+ * Dispatch transition BEFORE invoking the child subgraph so that
555
+ * callbacks.js sets multiAgentTrace.isMultiAgent = true before the
556
+ * child's ON_RUN_STEP events fire. This ensures child tool calls
557
+ * are attributed to the correct agent in admin traces.
558
+ */
559
+ await safeDispatchCustomEvent(GraphEvents.ON_AGENT_TRANSITION, {
560
+ sourceAgentId: sourceAgentId,
561
+ sourceAgentName: this.agentContexts.get(sourceAgentId)?.name ?? sourceAgentId,
562
+ destinationAgentId: destination,
563
+ destinationAgentName: destContext?.name ?? destination,
564
+ edgeType: EdgeType.HANDOFF,
565
+ timestamp: Date.now(),
566
+ }, config);
553
567
  /**
554
568
  * Invoke the child subgraph with config propagation.
555
569
  * Config carries callbacks (for SSE streaming), abort signal,
@@ -561,14 +575,6 @@ class MultiAgentGraph extends StandardGraph {
561
575
  console.debug(`[MultiAgentGraph] Handoff "${sourceAgentId}" -> "${destination}" DONE ` +
562
576
  `(result: ${resultText.length} chars` +
563
577
  `${truncatedResult.length < resultText.length ? `, truncated to ${truncatedResult.length}` : ''})`);
564
- await safeDispatchCustomEvent(GraphEvents.ON_AGENT_TRANSITION, {
565
- sourceAgentId: sourceAgentId,
566
- sourceAgentName: this.agentContexts.get(sourceAgentId)?.name ?? sourceAgentId,
567
- destinationAgentId: destination,
568
- destinationAgentName: destContext?.name ?? destination,
569
- edgeType: EdgeType.HANDOFF,
570
- timestamp: Date.now(),
571
- }, config);
572
578
  return truncatedResult;
573
579
  }
574
580
  catch (err) {