@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.
@@ -552,6 +552,20 @@ class MultiAgentGraph extends Graph.StandardGraph {
552
552
  console.debug(`[MultiAgentGraph] Handoff "${sourceAgentId}" -> "${destination}" START ` +
553
553
  `(messages: ${childMessages.length})`);
554
554
  try {
555
+ /**
556
+ * Dispatch transition BEFORE invoking the child subgraph so that
557
+ * callbacks.js sets multiAgentTrace.isMultiAgent = true before the
558
+ * child's ON_RUN_STEP events fire. This ensures child tool calls
559
+ * are attributed to the correct agent in admin traces.
560
+ */
561
+ await events.safeDispatchCustomEvent(_enum.GraphEvents.ON_AGENT_TRANSITION, {
562
+ sourceAgentId: sourceAgentId,
563
+ sourceAgentName: this.agentContexts.get(sourceAgentId)?.name ?? sourceAgentId,
564
+ destinationAgentId: destination,
565
+ destinationAgentName: destContext?.name ?? destination,
566
+ edgeType: _enum.EdgeType.HANDOFF,
567
+ timestamp: Date.now(),
568
+ }, config);
555
569
  /**
556
570
  * Invoke the child subgraph with config propagation.
557
571
  * Config carries callbacks (for SSE streaming), abort signal,
@@ -563,14 +577,6 @@ class MultiAgentGraph extends Graph.StandardGraph {
563
577
  console.debug(`[MultiAgentGraph] Handoff "${sourceAgentId}" -> "${destination}" DONE ` +
564
578
  `(result: ${resultText.length} chars` +
565
579
  `${truncatedResult.length < resultText.length ? `, truncated to ${truncatedResult.length}` : ''})`);
566
- await events.safeDispatchCustomEvent(_enum.GraphEvents.ON_AGENT_TRANSITION, {
567
- sourceAgentId: sourceAgentId,
568
- sourceAgentName: this.agentContexts.get(sourceAgentId)?.name ?? sourceAgentId,
569
- destinationAgentId: destination,
570
- destinationAgentName: destContext?.name ?? destination,
571
- edgeType: _enum.EdgeType.HANDOFF,
572
- timestamp: Date.now(),
573
- }, config);
574
580
  return truncatedResult;
575
581
  }
576
582
  catch (err) {