@voltagent/core 0.1.9 → 0.1.11
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.ts +1 -0
- package/dist/index.js +184 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +184 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -790,11 +790,17 @@ var AgentResponseSchema = import_zod.z.object({
|
|
|
790
790
|
}).passthrough();
|
|
791
791
|
var GenerateOptionsSchema = import_zod.z.object({
|
|
792
792
|
userId: import_zod.z.string().optional().openapi({ description: "Optional user ID for context tracking" }),
|
|
793
|
-
conversationId: import_zod.z.string().optional().openapi({
|
|
794
|
-
|
|
793
|
+
conversationId: import_zod.z.string().optional().openapi({
|
|
794
|
+
description: "Optional conversation ID for context tracking"
|
|
795
|
+
}),
|
|
796
|
+
contextLimit: import_zod.z.number().int().positive().optional().default(10).openapi({
|
|
797
|
+
description: "Optional limit for conversation history context"
|
|
798
|
+
}),
|
|
795
799
|
temperature: import_zod.z.number().min(0).max(1).optional().default(0.7).openapi({ description: "Controls randomness (0-1)" }),
|
|
796
|
-
maxTokens: import_zod.z.number().int().positive().optional().default(
|
|
797
|
-
topP: import_zod.z.number().min(0).max(1).optional().default(1).openapi({
|
|
800
|
+
maxTokens: import_zod.z.number().int().positive().optional().default(4e3).openapi({ description: "Maximum tokens to generate" }),
|
|
801
|
+
topP: import_zod.z.number().min(0).max(1).optional().default(1).openapi({
|
|
802
|
+
description: "Controls diversity via nucleus sampling (0-1)"
|
|
803
|
+
}),
|
|
798
804
|
frequencyPenalty: import_zod.z.number().min(0).max(2).optional().default(0).openapi({ description: "Penalizes repeated tokens (0-2)" }),
|
|
799
805
|
presencePenalty: import_zod.z.number().min(0).max(2).optional().default(0).openapi({ description: "Penalizes tokens based on presence (0-2)" }),
|
|
800
806
|
seed: import_zod.z.number().int().optional().openapi({ description: "Optional seed for reproducible results" }),
|
|
@@ -802,13 +808,78 @@ var GenerateOptionsSchema = import_zod.z.object({
|
|
|
802
808
|
extraOptions: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().openapi({ description: "Provider-specific options" })
|
|
803
809
|
// Add other relevant options from PublicGenerateOptions if known/needed for API exposure
|
|
804
810
|
}).passthrough();
|
|
811
|
+
var ContentPartSchema = import_zod.z.union([
|
|
812
|
+
import_zod.z.object({
|
|
813
|
+
// Text part
|
|
814
|
+
type: import_zod.z.literal("text"),
|
|
815
|
+
text: import_zod.z.string()
|
|
816
|
+
}).openapi({ example: { type: "text", text: "Hello there!" } }),
|
|
817
|
+
import_zod.z.object({
|
|
818
|
+
// Image part
|
|
819
|
+
type: import_zod.z.literal("image"),
|
|
820
|
+
image: import_zod.z.string().openapi({ description: "Base64 encoded image data or a URL" }),
|
|
821
|
+
mimeType: import_zod.z.string().optional().openapi({ example: "image/jpeg" }),
|
|
822
|
+
alt: import_zod.z.string().optional().openapi({ description: "Alternative text for the image" })
|
|
823
|
+
}).openapi({
|
|
824
|
+
example: {
|
|
825
|
+
type: "image",
|
|
826
|
+
image: "data:image/png;base64,...",
|
|
827
|
+
mimeType: "image/png"
|
|
828
|
+
}
|
|
829
|
+
}),
|
|
830
|
+
import_zod.z.object({
|
|
831
|
+
// File part
|
|
832
|
+
type: import_zod.z.literal("file"),
|
|
833
|
+
data: import_zod.z.string().openapi({ description: "Base64 encoded file data" }),
|
|
834
|
+
filename: import_zod.z.string().openapi({ example: "document.pdf" }),
|
|
835
|
+
mimeType: import_zod.z.string().openapi({ example: "application/pdf" }),
|
|
836
|
+
size: import_zod.z.number().optional().openapi({ description: "File size in bytes" })
|
|
837
|
+
}).openapi({
|
|
838
|
+
example: {
|
|
839
|
+
type: "file",
|
|
840
|
+
data: "...",
|
|
841
|
+
filename: "report.docx",
|
|
842
|
+
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
843
|
+
}
|
|
844
|
+
})
|
|
845
|
+
]);
|
|
846
|
+
var MessageContentSchema = import_zod.z.union([
|
|
847
|
+
import_zod.z.string().openapi({ description: "Plain text content" }),
|
|
848
|
+
import_zod.z.array(ContentPartSchema).openapi({ description: "An array of content parts (text, image, file)." })
|
|
849
|
+
]);
|
|
850
|
+
var MessageObjectSchema = import_zod.z.object({
|
|
851
|
+
role: import_zod.z.string().openapi({
|
|
852
|
+
description: "Role of the sender (e.g., 'user', 'assistant')"
|
|
853
|
+
}),
|
|
854
|
+
content: MessageContentSchema
|
|
855
|
+
// Use the reusable content schema
|
|
856
|
+
}).openapi({ description: "A message object with role and content" });
|
|
805
857
|
var TextRequestSchema = import_zod.z.object({
|
|
806
|
-
input: import_zod.z.
|
|
858
|
+
input: import_zod.z.union([
|
|
859
|
+
import_zod.z.string().openapi({
|
|
860
|
+
description: "Input text for the agent",
|
|
861
|
+
example: "Tell me a joke!"
|
|
862
|
+
}),
|
|
863
|
+
import_zod.z.array(MessageObjectSchema).openapi({
|
|
864
|
+
description: "An array of message objects, representing the conversation history",
|
|
865
|
+
example: [
|
|
866
|
+
{ role: "user", content: "What is the weather?" },
|
|
867
|
+
{ role: "assistant", content: "The weather is sunny." },
|
|
868
|
+
{ role: "user", content: [{ type: "text", text: "Thanks!" }] }
|
|
869
|
+
]
|
|
870
|
+
})
|
|
871
|
+
]),
|
|
807
872
|
options: GenerateOptionsSchema.optional().openapi({
|
|
808
|
-
description: "Optional generation parameters"
|
|
873
|
+
description: "Optional generation parameters",
|
|
874
|
+
example: {
|
|
875
|
+
userId: "unique-user-id",
|
|
876
|
+
conversationId: "unique-conversation-id",
|
|
877
|
+
contextLimit: 10,
|
|
878
|
+
temperature: 0.7,
|
|
879
|
+
maxTokens: 100
|
|
880
|
+
}
|
|
809
881
|
})
|
|
810
|
-
|
|
811
|
-
});
|
|
882
|
+
}).openapi("TextGenerationRequest");
|
|
812
883
|
var TextResponseSchema = import_zod.z.object({
|
|
813
884
|
success: import_zod.z.literal(true),
|
|
814
885
|
data: import_zod.z.string().openapi({ description: "Generated text response" })
|
|
@@ -822,34 +893,18 @@ var StreamTextEventSchema = import_zod.z.object({
|
|
|
822
893
|
error: import_zod.z.string().optional()
|
|
823
894
|
});
|
|
824
895
|
var ObjectRequestSchema = import_zod.z.object({
|
|
825
|
-
input: import_zod.z.
|
|
826
|
-
|
|
827
|
-
description: "
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
joke_setup: {
|
|
832
|
-
type: "string",
|
|
833
|
-
description: "The setup part of the joke"
|
|
834
|
-
},
|
|
835
|
-
punchline: {
|
|
836
|
-
type: "string",
|
|
837
|
-
description: "The punchline of the joke"
|
|
838
|
-
},
|
|
839
|
-
rating: {
|
|
840
|
-
type: "number",
|
|
841
|
-
description: "A rating of how funny the joke is from 1 to 5"
|
|
842
|
-
}
|
|
843
|
-
},
|
|
844
|
-
required: ["joke_setup", "punchline"]
|
|
845
|
-
}
|
|
896
|
+
input: import_zod.z.union([
|
|
897
|
+
import_zod.z.string().openapi({ description: "Input text prompt" }),
|
|
898
|
+
import_zod.z.array(MessageObjectSchema).openapi({ description: "Conversation history" })
|
|
899
|
+
]),
|
|
900
|
+
schema: import_zod.z.any().openapi({
|
|
901
|
+
description: "The Zod schema for the desired object output (passed as JSON)"
|
|
846
902
|
}),
|
|
847
|
-
// Expect a JSON Schema object
|
|
848
903
|
options: GenerateOptionsSchema.optional().openapi({
|
|
849
|
-
description: "Optional generation parameters"
|
|
904
|
+
description: "Optional object generation parameters",
|
|
905
|
+
example: { temperature: 0.2 }
|
|
850
906
|
})
|
|
851
|
-
|
|
852
|
-
});
|
|
907
|
+
}).openapi("ObjectGenerationRequest");
|
|
853
908
|
var ObjectResponseSchema = import_zod.z.object({
|
|
854
909
|
success: import_zod.z.literal(true),
|
|
855
910
|
data: import_zod.z.object({}).passthrough().openapi({ description: "Generated object response" })
|
|
@@ -1290,12 +1345,23 @@ app.openapi(streamRoute, (c) => __async(void 0, null, function* () {
|
|
|
1290
1345
|
}
|
|
1291
1346
|
try {
|
|
1292
1347
|
let _a;
|
|
1293
|
-
const {
|
|
1348
|
+
const {
|
|
1349
|
+
input,
|
|
1350
|
+
options = {
|
|
1351
|
+
maxTokens: 4e3,
|
|
1352
|
+
temperature: 0.7
|
|
1353
|
+
}
|
|
1354
|
+
} = c.req.valid("json");
|
|
1294
1355
|
const stream = new ReadableStream({
|
|
1295
1356
|
start(controller) {
|
|
1296
1357
|
return __async(this, null, function* () {
|
|
1297
1358
|
try {
|
|
1298
|
-
const response = yield agent.streamText(input, __spreadValues({}, options)
|
|
1359
|
+
const response = yield agent.streamText(input, __spreadProps(__spreadValues({}, options), {
|
|
1360
|
+
provider: {
|
|
1361
|
+
maxTokens: options.maxTokens,
|
|
1362
|
+
temperature: options.temperature
|
|
1363
|
+
}
|
|
1364
|
+
}));
|
|
1299
1365
|
try {
|
|
1300
1366
|
for (var iter = __forAwait(response.textStream), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
|
|
1301
1367
|
const chunk = temp.value;
|
|
@@ -4903,21 +4969,10 @@ ${context}`;
|
|
|
4903
4969
|
this.id,
|
|
4904
4970
|
{
|
|
4905
4971
|
input
|
|
4906
|
-
// We now always use the input field (instead of message)
|
|
4907
4972
|
},
|
|
4908
4973
|
"agent",
|
|
4909
4974
|
context
|
|
4910
4975
|
);
|
|
4911
|
-
this.createStandardTimelineEvent(
|
|
4912
|
-
context.historyEntry.id,
|
|
4913
|
-
"start",
|
|
4914
|
-
initialStatus,
|
|
4915
|
-
"agent" /* AGENT */,
|
|
4916
|
-
this.id,
|
|
4917
|
-
{},
|
|
4918
|
-
"agent",
|
|
4919
|
-
context
|
|
4920
|
-
);
|
|
4921
4976
|
return context;
|
|
4922
4977
|
});
|
|
4923
4978
|
}
|
|
@@ -4983,6 +5038,7 @@ ${context}`;
|
|
|
4983
5038
|
parentAgentId: internalOptions.parentAgentId,
|
|
4984
5039
|
parentHistoryEntryId: internalOptions.parentHistoryEntryId
|
|
4985
5040
|
});
|
|
5041
|
+
let messages = [];
|
|
4986
5042
|
try {
|
|
4987
5043
|
yield (_b = (_a = this.hooks).onStart) == null ? void 0 : _b.call(_a, { agent: this, context: operationContext });
|
|
4988
5044
|
const { userId, conversationId, contextLimit = 10, provider, signal } = internalOptions;
|
|
@@ -4998,8 +5054,20 @@ ${context}`;
|
|
|
4998
5054
|
historyEntryId: operationContext.historyEntry.id,
|
|
4999
5055
|
contextMessages
|
|
5000
5056
|
});
|
|
5001
|
-
|
|
5057
|
+
messages = [systemMessage, ...contextMessages];
|
|
5002
5058
|
messages = yield this.formatInputMessages(messages, input);
|
|
5059
|
+
this.createStandardTimelineEvent(
|
|
5060
|
+
operationContext.historyEntry.id,
|
|
5061
|
+
"start",
|
|
5062
|
+
"working",
|
|
5063
|
+
"agent" /* AGENT */,
|
|
5064
|
+
this.id,
|
|
5065
|
+
{
|
|
5066
|
+
input: messages
|
|
5067
|
+
},
|
|
5068
|
+
"agent",
|
|
5069
|
+
operationContext
|
|
5070
|
+
);
|
|
5003
5071
|
const onStepFinish = this.memoryManager.createStepFinishHandler(
|
|
5004
5072
|
operationContext,
|
|
5005
5073
|
userId,
|
|
@@ -5040,7 +5108,11 @@ ${context}`;
|
|
|
5040
5108
|
);
|
|
5041
5109
|
operationContext.eventUpdaters.set(step.id, eventUpdater);
|
|
5042
5110
|
if (tool2) {
|
|
5043
|
-
yield (_b2 = (_a2 = this.hooks).onToolStart) == null ? void 0 : _b2.call(_a2, {
|
|
5111
|
+
yield (_b2 = (_a2 = this.hooks).onToolStart) == null ? void 0 : _b2.call(_a2, {
|
|
5112
|
+
agent: this,
|
|
5113
|
+
tool: tool2,
|
|
5114
|
+
context: operationContext
|
|
5115
|
+
});
|
|
5044
5116
|
}
|
|
5045
5117
|
}
|
|
5046
5118
|
} else if (step.type === "tool_result") {
|
|
@@ -5083,6 +5155,7 @@ ${context}`;
|
|
|
5083
5155
|
status: "completed"
|
|
5084
5156
|
});
|
|
5085
5157
|
this.addAgentEvent(operationContext, "finished", "completed", {
|
|
5158
|
+
input: messages,
|
|
5086
5159
|
output: response.text,
|
|
5087
5160
|
usage: response.usage,
|
|
5088
5161
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -5111,6 +5184,7 @@ ${context}`;
|
|
|
5111
5184
|
const voltagentError = error;
|
|
5112
5185
|
operationContext.eventUpdaters.clear();
|
|
5113
5186
|
this.addAgentEvent(operationContext, "finished", "error", {
|
|
5187
|
+
input: messages,
|
|
5114
5188
|
error: voltagentError,
|
|
5115
5189
|
errorMessage: voltagentError.message,
|
|
5116
5190
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -5164,6 +5238,18 @@ ${context}`;
|
|
|
5164
5238
|
});
|
|
5165
5239
|
let messages = [systemMessage, ...contextMessages];
|
|
5166
5240
|
messages = yield this.formatInputMessages(messages, input);
|
|
5241
|
+
this.createStandardTimelineEvent(
|
|
5242
|
+
operationContext.historyEntry.id,
|
|
5243
|
+
"start",
|
|
5244
|
+
"working",
|
|
5245
|
+
"agent" /* AGENT */,
|
|
5246
|
+
this.id,
|
|
5247
|
+
{
|
|
5248
|
+
input: messages
|
|
5249
|
+
},
|
|
5250
|
+
"agent",
|
|
5251
|
+
operationContext
|
|
5252
|
+
);
|
|
5167
5253
|
const onStepFinish = this.memoryManager.createStepFinishHandler(
|
|
5168
5254
|
operationContext,
|
|
5169
5255
|
userId,
|
|
@@ -5180,6 +5266,7 @@ ${context}`;
|
|
|
5180
5266
|
maxSteps,
|
|
5181
5267
|
tools,
|
|
5182
5268
|
signal,
|
|
5269
|
+
provider,
|
|
5183
5270
|
toolExecutionContext: {
|
|
5184
5271
|
operationContext,
|
|
5185
5272
|
agentId: this.id,
|
|
@@ -5202,7 +5289,11 @@ ${context}`;
|
|
|
5202
5289
|
);
|
|
5203
5290
|
operationContext.eventUpdaters.set(chunk.id, eventUpdater);
|
|
5204
5291
|
if (tool2) {
|
|
5205
|
-
yield (_b2 = (_a2 = this.hooks).onToolStart) == null ? void 0 : _b2.call(_a2, {
|
|
5292
|
+
yield (_b2 = (_a2 = this.hooks).onToolStart) == null ? void 0 : _b2.call(_a2, {
|
|
5293
|
+
agent: this,
|
|
5294
|
+
tool: tool2,
|
|
5295
|
+
context: operationContext
|
|
5296
|
+
});
|
|
5206
5297
|
}
|
|
5207
5298
|
}
|
|
5208
5299
|
} else if (chunk.type === "tool_result") {
|
|
@@ -5244,6 +5335,9 @@ ${context}`;
|
|
|
5244
5335
|
}),
|
|
5245
5336
|
onFinish: (result) => __async(this, null, function* () {
|
|
5246
5337
|
var _a2, _b2;
|
|
5338
|
+
if (!operationContext.isActive) {
|
|
5339
|
+
return;
|
|
5340
|
+
}
|
|
5247
5341
|
operationContext.eventUpdaters.clear();
|
|
5248
5342
|
this.updateHistoryEntry(operationContext, {
|
|
5249
5343
|
output: result.text,
|
|
@@ -5253,6 +5347,7 @@ ${context}`;
|
|
|
5253
5347
|
status: "completed"
|
|
5254
5348
|
});
|
|
5255
5349
|
this.addAgentEvent(operationContext, "finished", "completed", {
|
|
5350
|
+
input: messages,
|
|
5256
5351
|
output: result.text,
|
|
5257
5352
|
usage: result.usage,
|
|
5258
5353
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -5315,6 +5410,7 @@ ${context}`;
|
|
|
5315
5410
|
errorMessage: error.message,
|
|
5316
5411
|
// Use the main message
|
|
5317
5412
|
affectedNodeId: `agent_${this.id}`,
|
|
5413
|
+
input: messages,
|
|
5318
5414
|
status: "error",
|
|
5319
5415
|
metadata: __spreadValues({
|
|
5320
5416
|
// Include metadata if available
|
|
@@ -5356,6 +5452,7 @@ ${context}`;
|
|
|
5356
5452
|
parentAgentId: internalOptions.parentAgentId,
|
|
5357
5453
|
parentHistoryEntryId: internalOptions.parentHistoryEntryId
|
|
5358
5454
|
});
|
|
5455
|
+
let messages = [];
|
|
5359
5456
|
try {
|
|
5360
5457
|
yield (_b = (_a = this.hooks).onStart) == null ? void 0 : _b.call(_a, { agent: this, context: operationContext });
|
|
5361
5458
|
const { userId, conversationId, contextLimit = 10, provider, signal } = internalOptions;
|
|
@@ -5371,8 +5468,20 @@ ${context}`;
|
|
|
5371
5468
|
historyEntryId: operationContext.historyEntry.id,
|
|
5372
5469
|
contextMessages
|
|
5373
5470
|
});
|
|
5374
|
-
|
|
5471
|
+
messages = [systemMessage, ...contextMessages];
|
|
5375
5472
|
messages = yield this.formatInputMessages(messages, input);
|
|
5473
|
+
this.createStandardTimelineEvent(
|
|
5474
|
+
operationContext.historyEntry.id,
|
|
5475
|
+
"start",
|
|
5476
|
+
"working",
|
|
5477
|
+
"agent" /* AGENT */,
|
|
5478
|
+
this.id,
|
|
5479
|
+
{
|
|
5480
|
+
input: messages
|
|
5481
|
+
},
|
|
5482
|
+
"agent",
|
|
5483
|
+
operationContext
|
|
5484
|
+
);
|
|
5376
5485
|
const onStepFinish = this.memoryManager.createStepFinishHandler(
|
|
5377
5486
|
operationContext,
|
|
5378
5487
|
userId,
|
|
@@ -5383,6 +5492,7 @@ ${context}`;
|
|
|
5383
5492
|
model: this.model,
|
|
5384
5493
|
schema,
|
|
5385
5494
|
signal,
|
|
5495
|
+
provider,
|
|
5386
5496
|
toolExecutionContext: {
|
|
5387
5497
|
operationContext,
|
|
5388
5498
|
agentId: this.id,
|
|
@@ -5401,7 +5511,8 @@ ${context}`;
|
|
|
5401
5511
|
output: responseStr,
|
|
5402
5512
|
usage: response.usage,
|
|
5403
5513
|
affectedNodeId: `agent_${this.id}`,
|
|
5404
|
-
status: "completed"
|
|
5514
|
+
status: "completed",
|
|
5515
|
+
input: messages
|
|
5405
5516
|
});
|
|
5406
5517
|
this.updateHistoryEntry(operationContext, {
|
|
5407
5518
|
output: responseStr,
|
|
@@ -5433,6 +5544,7 @@ ${context}`;
|
|
|
5433
5544
|
// Use the standardized message
|
|
5434
5545
|
affectedNodeId: `agent_${this.id}`,
|
|
5435
5546
|
status: "error",
|
|
5547
|
+
input: messages,
|
|
5436
5548
|
metadata: __spreadValues({
|
|
5437
5549
|
// Include detailed metadata from VoltAgentError
|
|
5438
5550
|
code: voltagentError.code,
|
|
@@ -5468,6 +5580,7 @@ ${context}`;
|
|
|
5468
5580
|
parentAgentId: internalOptions.parentAgentId,
|
|
5469
5581
|
parentHistoryEntryId: internalOptions.parentHistoryEntryId
|
|
5470
5582
|
});
|
|
5583
|
+
let messages = [];
|
|
5471
5584
|
try {
|
|
5472
5585
|
yield (_b = (_a = this.hooks).onStart) == null ? void 0 : _b.call(_a, { agent: this, context: operationContext });
|
|
5473
5586
|
const { userId, conversationId, contextLimit = 10, signal } = internalOptions;
|
|
@@ -5483,8 +5596,20 @@ ${context}`;
|
|
|
5483
5596
|
historyEntryId: operationContext.historyEntry.id,
|
|
5484
5597
|
contextMessages
|
|
5485
5598
|
});
|
|
5486
|
-
|
|
5599
|
+
messages = [systemMessage, ...contextMessages];
|
|
5487
5600
|
messages = yield this.formatInputMessages(messages, input);
|
|
5601
|
+
this.createStandardTimelineEvent(
|
|
5602
|
+
operationContext.historyEntry.id,
|
|
5603
|
+
"start",
|
|
5604
|
+
"working",
|
|
5605
|
+
"agent" /* AGENT */,
|
|
5606
|
+
this.id,
|
|
5607
|
+
{
|
|
5608
|
+
input: messages
|
|
5609
|
+
},
|
|
5610
|
+
"agent",
|
|
5611
|
+
operationContext
|
|
5612
|
+
);
|
|
5488
5613
|
const onStepFinish = this.memoryManager.createStepFinishHandler(
|
|
5489
5614
|
operationContext,
|
|
5490
5615
|
userId,
|
|
@@ -5494,6 +5619,7 @@ ${context}`;
|
|
|
5494
5619
|
messages,
|
|
5495
5620
|
model: this.model,
|
|
5496
5621
|
schema,
|
|
5622
|
+
provider,
|
|
5497
5623
|
signal,
|
|
5498
5624
|
toolExecutionContext: {
|
|
5499
5625
|
operationContext,
|
|
@@ -5509,8 +5635,12 @@ ${context}`;
|
|
|
5509
5635
|
}),
|
|
5510
5636
|
onFinish: (result) => __async(this, null, function* () {
|
|
5511
5637
|
var _a2, _b2;
|
|
5638
|
+
if (!operationContext.isActive) {
|
|
5639
|
+
return;
|
|
5640
|
+
}
|
|
5512
5641
|
const responseStr = JSON.stringify(result.object);
|
|
5513
5642
|
this.addAgentEvent(operationContext, "finished", "completed", {
|
|
5643
|
+
input: messages,
|
|
5514
5644
|
output: responseStr,
|
|
5515
5645
|
usage: result.usage,
|
|
5516
5646
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -5578,6 +5708,7 @@ ${context}`;
|
|
|
5578
5708
|
}
|
|
5579
5709
|
operationContext.eventUpdaters.clear();
|
|
5580
5710
|
this.addAgentEvent(operationContext, "finished", "error", {
|
|
5711
|
+
input: messages,
|
|
5581
5712
|
error,
|
|
5582
5713
|
errorMessage: error.message,
|
|
5583
5714
|
affectedNodeId: `agent_${this.id}`,
|
|
@@ -5609,6 +5740,7 @@ ${context}`;
|
|
|
5609
5740
|
return typedResponse;
|
|
5610
5741
|
} catch (error) {
|
|
5611
5742
|
this.addAgentEvent(operationContext, "finished", "error", {
|
|
5743
|
+
input: messages,
|
|
5612
5744
|
error,
|
|
5613
5745
|
errorMessage: error instanceof Error ? error.message : "Unknown error",
|
|
5614
5746
|
affectedNodeId: `agent_${this.id}`,
|