@voltagent/core 0.1.39 → 0.1.40
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.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6424,14 +6424,18 @@ ${agentsMemory || "No previous agent interactions available."}
|
|
|
6424
6424
|
await targetAgent.hooks.onHandoff?.({ agent: targetAgent, source: sourceAgent });
|
|
6425
6425
|
}
|
|
6426
6426
|
const sharedContext = options.sharedContext || [];
|
|
6427
|
-
const handoffMessage = {
|
|
6428
|
-
role: "system",
|
|
6429
|
-
content: `Task handed off from ${sourceAgent?.name || this.agentName} to ${targetAgent.name}:
|
|
6430
|
-
${task}
|
|
6431
|
-
Context: ${JSON.stringify(context)}`
|
|
6432
|
-
};
|
|
6433
6427
|
const forwardEvent = options.forwardEvent;
|
|
6434
|
-
|
|
6428
|
+
let taskContent = task;
|
|
6429
|
+
if (context && Object.keys(context).length > 0) {
|
|
6430
|
+
taskContent = `${task}
|
|
6431
|
+
|
|
6432
|
+
Context: ${JSON.stringify(context, null, 2)}`;
|
|
6433
|
+
}
|
|
6434
|
+
const taskMessage = {
|
|
6435
|
+
role: "user",
|
|
6436
|
+
content: taskContent
|
|
6437
|
+
};
|
|
6438
|
+
const streamResponse = await targetAgent.streamText([...sharedContext, taskMessage], {
|
|
6435
6439
|
conversationId: handoffConversationId,
|
|
6436
6440
|
userId,
|
|
6437
6441
|
parentAgentId: sourceAgent?.id || parentAgentId,
|
|
@@ -6547,7 +6551,7 @@ Context: ${JSON.stringify(context)}`
|
|
|
6547
6551
|
return {
|
|
6548
6552
|
result: finalText,
|
|
6549
6553
|
conversationId: handoffConversationId,
|
|
6550
|
-
messages: [
|
|
6554
|
+
messages: [taskMessage, { role: "assistant", content: finalText }],
|
|
6551
6555
|
status: "success"
|
|
6552
6556
|
};
|
|
6553
6557
|
} catch (error) {
|
|
@@ -7327,7 +7331,7 @@ ${context}`;
|
|
|
7327
7331
|
});
|
|
7328
7332
|
const opContext = {
|
|
7329
7333
|
operationId: historyEntry.id,
|
|
7330
|
-
userContext: options.userContext
|
|
7334
|
+
userContext: options.userContext ?? /* @__PURE__ */ new Map(),
|
|
7331
7335
|
historyEntry,
|
|
7332
7336
|
isActive: true,
|
|
7333
7337
|
parentAgentId: options.parentAgentId,
|