@voltagent/core 1.2.19 → 1.2.20
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.
- package/dist/index.d.mts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +44 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -457,6 +457,11 @@ type ProviderTextResponse<TOriginalResponse> = {
|
|
|
457
457
|
type StreamPart = TextStreamPart<any> & {
|
|
458
458
|
subAgentId?: string;
|
|
459
459
|
subAgentName?: string;
|
|
460
|
+
executingAgentId?: string;
|
|
461
|
+
executingAgentName?: string;
|
|
462
|
+
parentAgentId?: string;
|
|
463
|
+
parentAgentName?: string;
|
|
464
|
+
agentPath?: string[];
|
|
460
465
|
};
|
|
461
466
|
/**
|
|
462
467
|
* Response type for text streaming operations
|
|
@@ -3084,10 +3089,29 @@ type VoltAgentTextStreamPart<TOOLS extends Record<string, any> = Record<string,
|
|
|
3084
3089
|
* Optional identifier for the subagent that generated this event
|
|
3085
3090
|
*/
|
|
3086
3091
|
subAgentId?: string;
|
|
3092
|
+
/**
|
|
3093
|
+
* Optional identifier for the agent that actually executed the step
|
|
3094
|
+
* (same as subAgentId for first-level handoffs)
|
|
3095
|
+
*/
|
|
3096
|
+
executingAgentId?: string;
|
|
3087
3097
|
/**
|
|
3088
3098
|
* Optional name of the subagent that generated this event
|
|
3089
3099
|
*/
|
|
3090
3100
|
subAgentName?: string;
|
|
3101
|
+
/**
|
|
3102
|
+
* Optional name of the agent that actually executed the step
|
|
3103
|
+
* (same as subAgentName for first-level handoffs)
|
|
3104
|
+
*/
|
|
3105
|
+
executingAgentName?: string;
|
|
3106
|
+
/**
|
|
3107
|
+
* Parent agent reference when forwarded through supervisors
|
|
3108
|
+
*/
|
|
3109
|
+
parentAgentId?: string;
|
|
3110
|
+
parentAgentName?: string;
|
|
3111
|
+
/**
|
|
3112
|
+
* Ordered list of agent names from supervisor -> executing agent
|
|
3113
|
+
*/
|
|
3114
|
+
agentPath?: string[];
|
|
3091
3115
|
};
|
|
3092
3116
|
/**
|
|
3093
3117
|
* Extended StreamTextResult that uses VoltAgentTextStreamPart for fullStream.
|
package/dist/index.d.ts
CHANGED
|
@@ -457,6 +457,11 @@ type ProviderTextResponse<TOriginalResponse> = {
|
|
|
457
457
|
type StreamPart = TextStreamPart<any> & {
|
|
458
458
|
subAgentId?: string;
|
|
459
459
|
subAgentName?: string;
|
|
460
|
+
executingAgentId?: string;
|
|
461
|
+
executingAgentName?: string;
|
|
462
|
+
parentAgentId?: string;
|
|
463
|
+
parentAgentName?: string;
|
|
464
|
+
agentPath?: string[];
|
|
460
465
|
};
|
|
461
466
|
/**
|
|
462
467
|
* Response type for text streaming operations
|
|
@@ -3084,10 +3089,29 @@ type VoltAgentTextStreamPart<TOOLS extends Record<string, any> = Record<string,
|
|
|
3084
3089
|
* Optional identifier for the subagent that generated this event
|
|
3085
3090
|
*/
|
|
3086
3091
|
subAgentId?: string;
|
|
3092
|
+
/**
|
|
3093
|
+
* Optional identifier for the agent that actually executed the step
|
|
3094
|
+
* (same as subAgentId for first-level handoffs)
|
|
3095
|
+
*/
|
|
3096
|
+
executingAgentId?: string;
|
|
3087
3097
|
/**
|
|
3088
3098
|
* Optional name of the subagent that generated this event
|
|
3089
3099
|
*/
|
|
3090
3100
|
subAgentName?: string;
|
|
3101
|
+
/**
|
|
3102
|
+
* Optional name of the agent that actually executed the step
|
|
3103
|
+
* (same as subAgentName for first-level handoffs)
|
|
3104
|
+
*/
|
|
3105
|
+
executingAgentName?: string;
|
|
3106
|
+
/**
|
|
3107
|
+
* Parent agent reference when forwarded through supervisors
|
|
3108
|
+
*/
|
|
3109
|
+
parentAgentId?: string;
|
|
3110
|
+
parentAgentName?: string;
|
|
3111
|
+
/**
|
|
3112
|
+
* Ordered list of agent names from supervisor -> executing agent
|
|
3113
|
+
*/
|
|
3114
|
+
agentPath?: string[];
|
|
3091
3115
|
};
|
|
3092
3116
|
/**
|
|
3093
3117
|
* Extended StreamTextResult that uses VoltAgentTextStreamPart for fullStream.
|
package/dist/index.js
CHANGED
|
@@ -5850,6 +5850,21 @@ var WorkflowStreamWriterImpl = class {
|
|
|
5850
5850
|
if (part.subAgentName) {
|
|
5851
5851
|
metadata.subAgentName = part.subAgentName;
|
|
5852
5852
|
}
|
|
5853
|
+
if (part.executingAgentId) {
|
|
5854
|
+
metadata.executingAgentId = part.executingAgentId;
|
|
5855
|
+
}
|
|
5856
|
+
if (part.executingAgentName) {
|
|
5857
|
+
metadata.executingAgentName = part.executingAgentName;
|
|
5858
|
+
}
|
|
5859
|
+
if (part.parentAgentId) {
|
|
5860
|
+
metadata.parentAgentId = part.parentAgentId;
|
|
5861
|
+
}
|
|
5862
|
+
if (part.parentAgentName) {
|
|
5863
|
+
metadata.parentAgentName = part.parentAgentName;
|
|
5864
|
+
}
|
|
5865
|
+
if (part.agentPath) {
|
|
5866
|
+
metadata.agentPath = part.agentPath;
|
|
5867
|
+
}
|
|
5853
5868
|
let input;
|
|
5854
5869
|
let output;
|
|
5855
5870
|
let status;
|
|
@@ -16098,11 +16113,11 @@ function createMetadataEnrichedStream(originalStream, metadata, allowedTypes) {
|
|
|
16098
16113
|
type: SUBAGENT_DATA_EVENT_TYPE,
|
|
16099
16114
|
// Don't include id to prevent overwriting in AI SDK - each delta should be a new part
|
|
16100
16115
|
data: {
|
|
16101
|
-
|
|
16102
|
-
|
|
16103
|
-
|
|
16104
|
-
//
|
|
16105
|
-
|
|
16116
|
+
// Include original chunk first so metadata can override it
|
|
16117
|
+
...chunkObj,
|
|
16118
|
+
...metadata,
|
|
16119
|
+
// Preserve the original event type for consumers
|
|
16120
|
+
originalType: chunkObj.type
|
|
16106
16121
|
}
|
|
16107
16122
|
};
|
|
16108
16123
|
controller.enqueue(dataEvent);
|
|
@@ -16404,6 +16419,10 @@ Context: ${(0, import_utils17.safeStringify)(contextObj, { indentation: 2 })}`;
|
|
|
16404
16419
|
};
|
|
16405
16420
|
if (this.isDirectAgent(targetAgentConfig)) {
|
|
16406
16421
|
const response = await targetAgent.streamText(messages, baseOptions);
|
|
16422
|
+
const forwardingMetadata = this.buildForwardingMetadata(
|
|
16423
|
+
targetAgent,
|
|
16424
|
+
parentOperationContext
|
|
16425
|
+
);
|
|
16407
16426
|
const uiStreamWriter = parentOperationContext?.systemContext?.get(
|
|
16408
16427
|
"uiStreamWriter"
|
|
16409
16428
|
);
|
|
@@ -16414,10 +16433,7 @@ Context: ${(0, import_utils17.safeStringify)(contextObj, { indentation: 2 })}`;
|
|
|
16414
16433
|
const subagentUIStream = response.toUIMessageStream();
|
|
16415
16434
|
const enrichedStream = createMetadataEnrichedStream(
|
|
16416
16435
|
subagentUIStream,
|
|
16417
|
-
|
|
16418
|
-
subAgentId: targetAgent.id,
|
|
16419
|
-
subAgentName: targetAgent.name
|
|
16420
|
-
},
|
|
16436
|
+
forwardingMetadata,
|
|
16421
16437
|
this.supervisorConfig?.fullStreamEventForwarding?.types || ["tool-call", "tool-result"]
|
|
16422
16438
|
);
|
|
16423
16439
|
uiStreamWriter.merge(enrichedStream);
|
|
@@ -16435,8 +16451,7 @@ Context: ${(0, import_utils17.safeStringify)(contextObj, { indentation: 2 })}`;
|
|
|
16435
16451
|
}
|
|
16436
16452
|
const enrichedPart = {
|
|
16437
16453
|
...part,
|
|
16438
|
-
|
|
16439
|
-
subAgentName: targetAgent.name
|
|
16454
|
+
...forwardingMetadata
|
|
16440
16455
|
};
|
|
16441
16456
|
this.registerToolCallMetadata(parentOperationContext, enrichedPart, targetAgent);
|
|
16442
16457
|
await fullStreamWriter.write(enrichedPart);
|
|
@@ -16462,6 +16477,10 @@ Context: ${(0, import_utils17.safeStringify)(contextObj, { indentation: 2 })}`;
|
|
|
16462
16477
|
} else if (this.isStreamTextConfig(targetAgentConfig)) {
|
|
16463
16478
|
const options2 = { ...baseOptions, ...targetAgentConfig.options };
|
|
16464
16479
|
const response = await targetAgent.streamText(messages, options2);
|
|
16480
|
+
const forwardingMetadata = this.buildForwardingMetadata(
|
|
16481
|
+
targetAgent,
|
|
16482
|
+
parentOperationContext
|
|
16483
|
+
);
|
|
16465
16484
|
const uiStreamWriter = parentOperationContext?.systemContext?.get(
|
|
16466
16485
|
"uiStreamWriter"
|
|
16467
16486
|
);
|
|
@@ -16472,10 +16491,7 @@ Context: ${(0, import_utils17.safeStringify)(contextObj, { indentation: 2 })}`;
|
|
|
16472
16491
|
const subagentUIStream = response.toUIMessageStream();
|
|
16473
16492
|
const enrichedStream = createMetadataEnrichedStream(
|
|
16474
16493
|
subagentUIStream,
|
|
16475
|
-
|
|
16476
|
-
subAgentId: targetAgent.id,
|
|
16477
|
-
subAgentName: targetAgent.name
|
|
16478
|
-
},
|
|
16494
|
+
forwardingMetadata,
|
|
16479
16495
|
this.supervisorConfig?.fullStreamEventForwarding?.types || ["tool-call", "tool-result"]
|
|
16480
16496
|
);
|
|
16481
16497
|
uiStreamWriter.merge(enrichedStream);
|
|
@@ -16493,8 +16509,7 @@ Context: ${(0, import_utils17.safeStringify)(contextObj, { indentation: 2 })}`;
|
|
|
16493
16509
|
}
|
|
16494
16510
|
const enrichedPart = {
|
|
16495
16511
|
...part,
|
|
16496
|
-
|
|
16497
|
-
subAgentName: targetAgent.name
|
|
16512
|
+
...forwardingMetadata
|
|
16498
16513
|
};
|
|
16499
16514
|
this.registerToolCallMetadata(parentOperationContext, enrichedPart, targetAgent);
|
|
16500
16515
|
await fullStreamWriter.write(enrichedPart);
|
|
@@ -16790,6 +16805,18 @@ Context: ${(0, import_utils17.safeStringify)(contextObj, { indentation: 2 })}`;
|
|
|
16790
16805
|
return subAgentData;
|
|
16791
16806
|
});
|
|
16792
16807
|
}
|
|
16808
|
+
buildForwardingMetadata(agent, oc) {
|
|
16809
|
+
const parentMetadata = oc?.systemContext?.get(AGENT_METADATA_CONTEXT_KEY);
|
|
16810
|
+
return {
|
|
16811
|
+
subAgentId: agent.id,
|
|
16812
|
+
subAgentName: agent.name,
|
|
16813
|
+
executingAgentId: agent.id,
|
|
16814
|
+
executingAgentName: agent.name,
|
|
16815
|
+
parentAgentId: parentMetadata?.agentId,
|
|
16816
|
+
parentAgentName: parentMetadata?.agentName,
|
|
16817
|
+
agentPath: parentMetadata ? [parentMetadata.agentName, agent.name] : [agent.name]
|
|
16818
|
+
};
|
|
16819
|
+
}
|
|
16793
16820
|
registerToolCallMetadata(oc, part, agent) {
|
|
16794
16821
|
if (!oc || !part?.type || !part.type.startsWith("tool-") || !part.toolCallId) {
|
|
16795
16822
|
return;
|