@mastra/core 0.16.1-alpha.1 → 0.16.1-alpha.3
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/CHANGELOG.md +18 -0
- package/dist/agent/agent.types.d.ts +13 -3
- package/dist/agent/agent.types.d.ts.map +1 -1
- package/dist/agent/index.cjs +8 -8
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/input-processor/index.cjs +6 -6
- package/dist/agent/input-processor/index.js +1 -1
- package/dist/agent/test-utils.d.ts +3 -0
- package/dist/agent/test-utils.d.ts.map +1 -1
- package/dist/{chunk-UM4XJM3Y.js → chunk-3MSZBGO3.js} +122 -56
- package/dist/chunk-3MSZBGO3.js.map +1 -0
- package/dist/{chunk-WGX5V6DE.cjs → chunk-6RVOPJVP.cjs} +7 -7
- package/dist/{chunk-WGX5V6DE.cjs.map → chunk-6RVOPJVP.cjs.map} +1 -1
- package/dist/{chunk-C3R2Q3NN.cjs → chunk-BJASJTXK.cjs} +122 -56
- package/dist/chunk-BJASJTXK.cjs.map +1 -0
- package/dist/{chunk-2PWFUEQA.cjs → chunk-JLVFFZT7.cjs} +4 -4
- package/dist/{chunk-2PWFUEQA.cjs.map → chunk-JLVFFZT7.cjs.map} +1 -1
- package/dist/{chunk-DYLYA6HQ.cjs → chunk-OYHHJUTH.cjs} +6 -6
- package/dist/{chunk-DYLYA6HQ.cjs.map → chunk-OYHHJUTH.cjs.map} +1 -1
- package/dist/{chunk-U2RCB3FQ.js → chunk-P67M4R6G.js} +4 -4
- package/dist/{chunk-U2RCB3FQ.js.map → chunk-P67M4R6G.js.map} +1 -1
- package/dist/{chunk-OF4TXRIV.js → chunk-RVNDGKE5.js} +3 -3
- package/dist/{chunk-OF4TXRIV.js.map → chunk-RVNDGKE5.js.map} +1 -1
- package/dist/{chunk-U3OYPZHX.js → chunk-YBKHXKRR.js} +3 -3
- package/dist/{chunk-U3OYPZHX.js.map → chunk-YBKHXKRR.js.map} +1 -1
- package/dist/{chunk-GJKJXY3K.js → chunk-YYRE76UM.js} +3 -3
- package/dist/{chunk-GJKJXY3K.js.map → chunk-YYRE76UM.js.map} +1 -1
- package/dist/{chunk-LZWM7RVY.cjs → chunk-ZIDWSQFD.cjs} +7 -7
- package/dist/{chunk-LZWM7RVY.cjs.map → chunk-ZIDWSQFD.cjs.map} +1 -1
- package/dist/index.cjs +17 -17
- package/dist/index.js +4 -4
- package/dist/llm/model/model.loop.d.ts +1 -1
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/model.loop.types.d.ts +4 -2
- package/dist/llm/model/model.loop.types.d.ts.map +1 -1
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +1 -1
- package/dist/loop/test-utils/fullStream.d.ts.map +1 -1
- package/dist/loop/test-utils/generateText.d.ts.map +1 -1
- package/dist/loop/test-utils/options.d.ts.map +1 -1
- package/dist/loop/test-utils/resultObject.d.ts.map +1 -1
- package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
- package/dist/loop/test-utils/tools.d.ts.map +1 -1
- package/dist/loop/test-utils/utils.d.ts +1 -0
- package/dist/loop/test-utils/utils.d.ts.map +1 -1
- package/dist/loop/types.d.ts +15 -1
- package/dist/loop/types.d.ts.map +1 -1
- package/dist/loop/workflow/llm-execution.d.ts.map +1 -1
- package/dist/loop/workflow/outer-llm-step.d.ts.map +1 -1
- package/dist/loop/workflow/schema.d.ts +12 -0
- package/dist/loop/workflow/schema.d.ts.map +1 -1
- package/dist/loop/workflow/tool-call-step.d.ts +12 -0
- package/dist/loop/workflow/tool-call-step.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/network/index.cjs +2 -2
- package/dist/network/index.js +1 -1
- package/dist/network/vNext/index.cjs +12 -12
- package/dist/network/vNext/index.js +1 -1
- package/dist/processors/index.cjs +8 -8
- package/dist/processors/index.js +2 -2
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.js +1 -1
- package/dist/scores/index.cjs +8 -8
- package/dist/scores/index.js +1 -1
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/index.cjs +3 -3
- package/dist/stream/index.js +1 -1
- package/dist/stream/types.d.ts +3 -0
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +10 -10
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +22 -22
- package/dist/workflows/legacy/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-C3R2Q3NN.cjs.map +0 -1
- package/dist/chunk-UM4XJM3Y.js.map +0 -1
|
@@ -2239,7 +2239,8 @@ var MastraModelOutput = class extends chunkKXCUCBEI_cjs.MastraBase {
|
|
|
2239
2239
|
} = chunk.payload.metadata;
|
|
2240
2240
|
response = {
|
|
2241
2241
|
...otherMetadata,
|
|
2242
|
-
messages: messageList.get.response.aiV5.model()
|
|
2242
|
+
messages: messageList.get.response.aiV5.model(),
|
|
2243
|
+
uiMessages: messageList.get.response.aiV5.ui()
|
|
2243
2244
|
};
|
|
2244
2245
|
}
|
|
2245
2246
|
this.populateUsageCount(chunk.payload.output.usage);
|
|
@@ -2266,7 +2267,8 @@ var MastraModelOutput = class extends chunkKXCUCBEI_cjs.MastraBase {
|
|
|
2266
2267
|
} = chunk.payload.metadata;
|
|
2267
2268
|
response = {
|
|
2268
2269
|
...otherMetadata,
|
|
2269
|
-
messages: messageList.get.response.aiV5.model()
|
|
2270
|
+
messages: messageList.get.response.aiV5.model(),
|
|
2271
|
+
uiMessages: messageList.get.response.aiV5.ui()
|
|
2270
2272
|
};
|
|
2271
2273
|
}
|
|
2272
2274
|
} else {
|
|
@@ -2621,7 +2623,6 @@ var MastraModelOutput = class extends chunkKXCUCBEI_cjs.MastraBase {
|
|
|
2621
2623
|
scoringData
|
|
2622
2624
|
} : {})
|
|
2623
2625
|
};
|
|
2624
|
-
fullOutput.response.messages = this.messageList.get.response.aiV5.model();
|
|
2625
2626
|
return fullOutput;
|
|
2626
2627
|
}
|
|
2627
2628
|
/**
|
|
@@ -3115,7 +3116,9 @@ var toolCallInputSchema = z__default.default.object({
|
|
|
3115
3116
|
toolCallId: z__default.default.string(),
|
|
3116
3117
|
toolName: z__default.default.string(),
|
|
3117
3118
|
args: z__default.default.any(),
|
|
3118
|
-
providerMetadata: z__default.default.any()
|
|
3119
|
+
providerMetadata: z__default.default.any(),
|
|
3120
|
+
providerExecuted: z__default.default.boolean().optional(),
|
|
3121
|
+
output: z__default.default.any().optional()
|
|
3119
3122
|
});
|
|
3120
3123
|
var toolCallOutputSchema = toolCallInputSchema.extend({
|
|
3121
3124
|
result: z__default.default.any(),
|
|
@@ -3416,18 +3419,60 @@ function createLLMExecutionStep({
|
|
|
3416
3419
|
switch (model.specificationVersion) {
|
|
3417
3420
|
case "v2":
|
|
3418
3421
|
{
|
|
3419
|
-
const
|
|
3422
|
+
const messageListPromptArgs = {
|
|
3420
3423
|
downloadRetries,
|
|
3421
3424
|
downloadConcurrency,
|
|
3422
3425
|
supportedUrls: model?.supportedUrls
|
|
3423
|
-
}
|
|
3426
|
+
};
|
|
3427
|
+
let inputMessages = await messageList.get.all.aiV5.llmPrompt(messageListPromptArgs);
|
|
3428
|
+
let stepModel = model;
|
|
3429
|
+
let stepToolChoice = toolChoice;
|
|
3430
|
+
let stepTools = tools;
|
|
3431
|
+
if (options?.prepareStep) {
|
|
3432
|
+
try {
|
|
3433
|
+
const prepareStepResult = await options.prepareStep({
|
|
3434
|
+
stepNumber: inputData.output?.steps?.length || 0,
|
|
3435
|
+
steps: inputData.output?.steps || [],
|
|
3436
|
+
model,
|
|
3437
|
+
messages: messageList.get.all.aiV5.model()
|
|
3438
|
+
});
|
|
3439
|
+
if (prepareStepResult) {
|
|
3440
|
+
if (prepareStepResult.model) {
|
|
3441
|
+
stepModel = prepareStepResult.model;
|
|
3442
|
+
}
|
|
3443
|
+
if (prepareStepResult.toolChoice) {
|
|
3444
|
+
stepToolChoice = prepareStepResult.toolChoice;
|
|
3445
|
+
}
|
|
3446
|
+
if (prepareStepResult.activeTools && stepTools) {
|
|
3447
|
+
const activeToolsSet = new Set(prepareStepResult.activeTools);
|
|
3448
|
+
stepTools = Object.fromEntries(Object.entries(stepTools).filter(([toolName]) => activeToolsSet.has(toolName)));
|
|
3449
|
+
}
|
|
3450
|
+
if (prepareStepResult.messages) {
|
|
3451
|
+
const newMessages = prepareStepResult.messages;
|
|
3452
|
+
const newMessageList = new chunkD3UG2YLU_cjs.MessageList();
|
|
3453
|
+
for (const message of newMessages) {
|
|
3454
|
+
if (message.role === "system") {
|
|
3455
|
+
newMessageList.addSystem(message);
|
|
3456
|
+
} else if (message.role === "user") {
|
|
3457
|
+
newMessageList.add(message, "input");
|
|
3458
|
+
} else if (message.role === "assistant" || message.role === "tool") {
|
|
3459
|
+
newMessageList.add(message, "response");
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
inputMessages = await newMessageList.get.all.aiV5.llmPrompt(messageListPromptArgs);
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
} catch (error) {
|
|
3466
|
+
console.error("Error in prepareStep callback:", error);
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3424
3469
|
modelResult = execute({
|
|
3425
3470
|
runId,
|
|
3426
|
-
model,
|
|
3471
|
+
model: stepModel,
|
|
3427
3472
|
providerOptions,
|
|
3428
3473
|
inputMessages,
|
|
3429
|
-
tools,
|
|
3430
|
-
toolChoice,
|
|
3474
|
+
tools: stepTools,
|
|
3475
|
+
toolChoice: stepToolChoice,
|
|
3431
3476
|
options,
|
|
3432
3477
|
modelSettings,
|
|
3433
3478
|
telemetry_settings,
|
|
@@ -3636,6 +3681,32 @@ function createToolCallStep({
|
|
|
3636
3681
|
execute: async ({
|
|
3637
3682
|
inputData
|
|
3638
3683
|
}) => {
|
|
3684
|
+
if (inputData.providerExecuted) {
|
|
3685
|
+
const tracer2 = getTracer({
|
|
3686
|
+
isEnabled: telemetry_settings?.isEnabled,
|
|
3687
|
+
tracer: telemetry_settings?.tracer
|
|
3688
|
+
});
|
|
3689
|
+
const span2 = tracer2.startSpan("mastra.stream.toolCall").setAttributes({
|
|
3690
|
+
...assembleOperationName({
|
|
3691
|
+
operationId: "mastra.stream.toolCall",
|
|
3692
|
+
telemetry: telemetry_settings
|
|
3693
|
+
}),
|
|
3694
|
+
"stream.toolCall.toolName": inputData.toolName,
|
|
3695
|
+
"stream.toolCall.toolCallId": inputData.toolCallId,
|
|
3696
|
+
"stream.toolCall.args": JSON.stringify(inputData.args),
|
|
3697
|
+
"stream.toolCall.providerExecuted": true
|
|
3698
|
+
});
|
|
3699
|
+
if (inputData.output) {
|
|
3700
|
+
span2.setAttributes({
|
|
3701
|
+
"stream.toolCall.result": JSON.stringify(inputData.output)
|
|
3702
|
+
});
|
|
3703
|
+
}
|
|
3704
|
+
span2.end();
|
|
3705
|
+
return {
|
|
3706
|
+
...inputData,
|
|
3707
|
+
result: inputData.output
|
|
3708
|
+
};
|
|
3709
|
+
}
|
|
3639
3710
|
const tool = tools?.[inputData.toolName] || Object.values(tools || {})?.find(tool2 => `id` in tool2 && tool2.id === inputData.toolName);
|
|
3640
3711
|
if (!tool) {
|
|
3641
3712
|
throw new Error(`Tool ${inputData.toolName} not found`);
|
|
@@ -3777,7 +3848,8 @@ function createOuterLLMWorkflow({
|
|
|
3777
3848
|
toolCallId: toolCall.toolCallId,
|
|
3778
3849
|
toolName: toolCall.toolName,
|
|
3779
3850
|
result: toolCall.result,
|
|
3780
|
-
providerMetadata: toolCall.providerMetadata
|
|
3851
|
+
providerMetadata: toolCall.providerMetadata,
|
|
3852
|
+
providerExecuted: toolCall.providerExecuted
|
|
3781
3853
|
}
|
|
3782
3854
|
};
|
|
3783
3855
|
rest.controller.enqueue(chunk);
|
|
@@ -4156,7 +4228,6 @@ var MastraLLMVNext = class extends chunkKXCUCBEI_cjs.MastraBase {
|
|
|
4156
4228
|
}];
|
|
4157
4229
|
}
|
|
4158
4230
|
stream({
|
|
4159
|
-
messages,
|
|
4160
4231
|
stopWhen = aiV5.stepCountIs(5),
|
|
4161
4232
|
maxSteps,
|
|
4162
4233
|
tools = {},
|
|
@@ -4171,7 +4242,9 @@ var MastraLLMVNext = class extends chunkKXCUCBEI_cjs.MastraBase {
|
|
|
4171
4242
|
outputProcessors,
|
|
4172
4243
|
returnScorerData,
|
|
4173
4244
|
providerOptions,
|
|
4174
|
-
tracingContext
|
|
4245
|
+
tracingContext,
|
|
4246
|
+
messageList,
|
|
4247
|
+
_internal
|
|
4175
4248
|
// ...rest
|
|
4176
4249
|
}) {
|
|
4177
4250
|
let stopWhenToUse;
|
|
@@ -4180,6 +4253,7 @@ var MastraLLMVNext = class extends chunkKXCUCBEI_cjs.MastraBase {
|
|
|
4180
4253
|
} else {
|
|
4181
4254
|
stopWhenToUse = stopWhen;
|
|
4182
4255
|
}
|
|
4256
|
+
const messages = messageList.get.all.aiV5.model();
|
|
4183
4257
|
const model = this.#model;
|
|
4184
4258
|
this.logger.debug(`[LLM] - Streaming text`, {
|
|
4185
4259
|
runId,
|
|
@@ -4203,11 +4277,6 @@ var MastraLLMVNext = class extends chunkKXCUCBEI_cjs.MastraBase {
|
|
|
4203
4277
|
}
|
|
4204
4278
|
});
|
|
4205
4279
|
try {
|
|
4206
|
-
const messageList = new chunkD3UG2YLU_cjs.MessageList({
|
|
4207
|
-
threadId,
|
|
4208
|
-
resourceId
|
|
4209
|
-
});
|
|
4210
|
-
messageList.add(messages, "input");
|
|
4211
4280
|
const loopOptions = {
|
|
4212
4281
|
messageList,
|
|
4213
4282
|
model: this.#model,
|
|
@@ -4220,6 +4289,7 @@ var MastraLLMVNext = class extends chunkKXCUCBEI_cjs.MastraBase {
|
|
|
4220
4289
|
...this.experimental_telemetry,
|
|
4221
4290
|
...telemetry_settings
|
|
4222
4291
|
},
|
|
4292
|
+
_internal,
|
|
4223
4293
|
output,
|
|
4224
4294
|
outputProcessors,
|
|
4225
4295
|
returnScorerData,
|
|
@@ -9542,16 +9612,17 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
|
|
|
9542
9612
|
const systemInstructions = await this.resolveTitleInstructions(runtimeContext, instructions);
|
|
9543
9613
|
let text = "";
|
|
9544
9614
|
if (llm.getModel().specificationVersion === "v2") {
|
|
9615
|
+
const messageList = new chunkD3UG2YLU_cjs.MessageList().add([{
|
|
9616
|
+
role: "system",
|
|
9617
|
+
content: systemInstructions
|
|
9618
|
+
}], "system").add([{
|
|
9619
|
+
role: "user",
|
|
9620
|
+
content: JSON.stringify(partsToGen)
|
|
9621
|
+
}], "input");
|
|
9545
9622
|
const result = llm.stream({
|
|
9546
9623
|
runtimeContext,
|
|
9547
9624
|
tracingContext,
|
|
9548
|
-
|
|
9549
|
-
role: "system",
|
|
9550
|
-
content: systemInstructions
|
|
9551
|
-
}, {
|
|
9552
|
-
role: "user",
|
|
9553
|
-
content: JSON.stringify(partsToGen)
|
|
9554
|
-
}]
|
|
9625
|
+
messageList
|
|
9555
9626
|
});
|
|
9556
9627
|
text = await result.text;
|
|
9557
9628
|
} else {
|
|
@@ -10007,7 +10078,7 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
|
|
|
10007
10078
|
threadId,
|
|
10008
10079
|
resourceId
|
|
10009
10080
|
});
|
|
10010
|
-
const run = workflow.
|
|
10081
|
+
const run = await workflow.createRunAsync();
|
|
10011
10082
|
let result;
|
|
10012
10083
|
if (methodType === "generate") {
|
|
10013
10084
|
result = await run.start({
|
|
@@ -10538,14 +10609,7 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
10538
10609
|
}];
|
|
10539
10610
|
}
|
|
10540
10611
|
if (responseMessages) {
|
|
10541
|
-
|
|
10542
|
-
const {
|
|
10543
|
-
id,
|
|
10544
|
-
...messageWithoutId
|
|
10545
|
-
} = m;
|
|
10546
|
-
return messageWithoutId;
|
|
10547
|
-
});
|
|
10548
|
-
messageList.add(messagesWithoutIds, "response");
|
|
10612
|
+
messageList.add(responseMessages, "response");
|
|
10549
10613
|
}
|
|
10550
10614
|
if (!threadExists) {
|
|
10551
10615
|
await memory.createThread({
|
|
@@ -11060,7 +11124,6 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
11060
11124
|
id: "prepare-memory-step",
|
|
11061
11125
|
inputSchema: z.z.any(),
|
|
11062
11126
|
outputSchema: z.z.object({
|
|
11063
|
-
messageObjects: z.z.array(z.z.any()),
|
|
11064
11127
|
threadExists: z.z.boolean(),
|
|
11065
11128
|
thread: z.z.any(),
|
|
11066
11129
|
messageList: z.z.any(),
|
|
@@ -11092,7 +11155,6 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
|
|
|
11092
11155
|
messageList
|
|
11093
11156
|
});
|
|
11094
11157
|
return {
|
|
11095
|
-
messageObjects: messageList.get.all.prompt(),
|
|
11096
11158
|
threadExists: false,
|
|
11097
11159
|
thread: void 0,
|
|
11098
11160
|
messageList,
|
|
@@ -11237,12 +11299,11 @@ the following messages are from ${ymd}
|
|
|
11237
11299
|
generateMessageId: this.#mastra?.generateId?.bind(this.#mastra),
|
|
11238
11300
|
// @ts-ignore Flag for agent network messages
|
|
11239
11301
|
_agentNetworkAppend: this._agentNetworkAppend
|
|
11240
|
-
}).addSystem(instructions || `${this.instructions}.`).addSystem(memorySystemMessage).add(options.context || [], "context").add(processedMemoryMessages, "memory").add(messageList.get.input.v2(), "user")
|
|
11302
|
+
}).addSystem(instructions || `${this.instructions}.`).addSystem(memorySystemMessage).add(options.context || [], "context").add(processedMemoryMessages, "memory").add(messageList.get.input.v2(), "user");
|
|
11241
11303
|
return {
|
|
11242
11304
|
thread: threadObject,
|
|
11243
|
-
messageList,
|
|
11305
|
+
messageList: processedList,
|
|
11244
11306
|
// add old processed messages + new input messages
|
|
11245
|
-
messageObjects: processedList,
|
|
11246
11307
|
...(tripwireTriggered && {
|
|
11247
11308
|
tripwire: true,
|
|
11248
11309
|
tripwireReason
|
|
@@ -11269,7 +11330,10 @@ the following messages are from ${ymd}
|
|
|
11269
11330
|
...inputData,
|
|
11270
11331
|
outputProcessors,
|
|
11271
11332
|
returnScorerData: options.returnScorerData,
|
|
11272
|
-
tracingContext
|
|
11333
|
+
tracingContext,
|
|
11334
|
+
_internal: {
|
|
11335
|
+
generateId: inputData.experimental_generateMessageId || this.#mastra?.generateId?.bind(this.#mastra)
|
|
11336
|
+
}
|
|
11273
11337
|
});
|
|
11274
11338
|
if (format === "aisdk") {
|
|
11275
11339
|
return streamResult.aisdk.v5;
|
|
@@ -11289,7 +11353,6 @@ the following messages are from ${ymd}
|
|
|
11289
11353
|
}) => {
|
|
11290
11354
|
const result2 = {
|
|
11291
11355
|
...options,
|
|
11292
|
-
messages: inputData["prepare-memory-step"].messageObjects,
|
|
11293
11356
|
tools: inputData["prepare-tools-step"].convertedTools,
|
|
11294
11357
|
runId,
|
|
11295
11358
|
temperature: options.modelSettings?.temperature,
|
|
@@ -11391,7 +11454,6 @@ the following messages are from ${ymd}
|
|
|
11391
11454
|
effectiveOutputProcessors = effectiveOutputProcessors ? [...effectiveOutputProcessors, structuredProcessor] : [structuredProcessor];
|
|
11392
11455
|
}
|
|
11393
11456
|
const loopOptions = {
|
|
11394
|
-
messages: result2.messages,
|
|
11395
11457
|
runtimeContext: result2.runtimeContext,
|
|
11396
11458
|
tracingContext: {
|
|
11397
11459
|
currentSpan: agentAISpan
|
|
@@ -11406,6 +11468,9 @@ the following messages are from ${ymd}
|
|
|
11406
11468
|
maxSteps: result2.maxSteps,
|
|
11407
11469
|
providerOptions: result2.providerOptions,
|
|
11408
11470
|
options: {
|
|
11471
|
+
...(options.prepareStep && {
|
|
11472
|
+
prepareStep: options.prepareStep
|
|
11473
|
+
}),
|
|
11409
11474
|
onFinish: async payload => {
|
|
11410
11475
|
if (payload.finishReason === "error") {
|
|
11411
11476
|
this.logger.error("Error in agent stream", {
|
|
@@ -11415,7 +11480,6 @@ the following messages are from ${ymd}
|
|
|
11415
11480
|
return;
|
|
11416
11481
|
}
|
|
11417
11482
|
const messageList = inputData["prepare-memory-step"].messageList;
|
|
11418
|
-
messageList.add(payload.response.messages, "response");
|
|
11419
11483
|
try {
|
|
11420
11484
|
const outputText = messageList.get.all.core().map(m => m.content).join("\n");
|
|
11421
11485
|
await this.#executeOnFinish({
|
|
@@ -11449,14 +11513,20 @@ the following messages are from ${ymd}
|
|
|
11449
11513
|
totalUsage: payload.totalUsage
|
|
11450
11514
|
});
|
|
11451
11515
|
},
|
|
11452
|
-
onStepFinish: result2.onStepFinish
|
|
11516
|
+
onStepFinish: result2.onStepFinish,
|
|
11517
|
+
onChunk: options.onChunk,
|
|
11518
|
+
onError: options.onError,
|
|
11519
|
+
onAbort: options.onAbort,
|
|
11520
|
+
activeTools: options.activeTools,
|
|
11521
|
+
abortSignal: options.abortSignal
|
|
11453
11522
|
},
|
|
11454
11523
|
output: options.output,
|
|
11455
11524
|
outputProcessors: effectiveOutputProcessors,
|
|
11456
11525
|
modelSettings: {
|
|
11457
11526
|
temperature: 0,
|
|
11458
11527
|
...(options.modelSettings || {})
|
|
11459
|
-
}
|
|
11528
|
+
},
|
|
11529
|
+
messageList: inputData["prepare-memory-step"].messageList
|
|
11460
11530
|
};
|
|
11461
11531
|
return loopOptions;
|
|
11462
11532
|
}).then(streamStep).commit();
|
|
@@ -11533,14 +11603,8 @@ the following messages are from ${ymd}
|
|
|
11533
11603
|
}];
|
|
11534
11604
|
}
|
|
11535
11605
|
if (responseMessages) {
|
|
11536
|
-
const
|
|
11537
|
-
|
|
11538
|
-
id,
|
|
11539
|
-
...messageWithoutId
|
|
11540
|
-
} = m;
|
|
11541
|
-
return messageWithoutId;
|
|
11542
|
-
}).filter(m => m.role !== "user");
|
|
11543
|
-
messageList.add(messagesWithoutIds, "response");
|
|
11606
|
+
const filteredMessages = responseMessages.filter(m => m.role !== "user");
|
|
11607
|
+
messageList.add(filteredMessages, "response");
|
|
11544
11608
|
}
|
|
11545
11609
|
if (!threadExists) {
|
|
11546
11610
|
await memory.createThread({
|
|
@@ -11690,7 +11754,8 @@ the following messages are from ${ymd}
|
|
|
11690
11754
|
});
|
|
11691
11755
|
const mergedGenerateOptions = {
|
|
11692
11756
|
...defaultGenerateOptions,
|
|
11693
|
-
...generateOptions
|
|
11757
|
+
...generateOptions,
|
|
11758
|
+
experimental_generateMessageId: defaultGenerateOptions.experimental_generateMessageId || this.#mastra?.generateId?.bind(this.#mastra)
|
|
11694
11759
|
};
|
|
11695
11760
|
const {
|
|
11696
11761
|
llm,
|
|
@@ -11944,7 +12009,8 @@ the following messages are from ${ymd}
|
|
|
11944
12009
|
const mergedStreamOptions = {
|
|
11945
12010
|
...defaultStreamOptions,
|
|
11946
12011
|
...streamOptions,
|
|
11947
|
-
onFinish: this.#mergeOnFinishWithTelemetry(streamOptions, defaultStreamOptions)
|
|
12012
|
+
onFinish: this.#mergeOnFinishWithTelemetry(streamOptions, defaultStreamOptions),
|
|
12013
|
+
experimental_generateMessageId: defaultStreamOptions.experimental_generateMessageId || this.#mastra?.generateId?.bind(this.#mastra)
|
|
11948
12014
|
};
|
|
11949
12015
|
const {
|
|
11950
12016
|
llm,
|
|
@@ -15991,5 +16057,5 @@ exports.recursivelyCheckForFinalState = recursivelyCheckForFinalState;
|
|
|
15991
16057
|
exports.resolveVariables = resolveVariables;
|
|
15992
16058
|
exports.updateStepInHierarchy = updateStepInHierarchy;
|
|
15993
16059
|
exports.workflowToStep = workflowToStep;
|
|
15994
|
-
//# sourceMappingURL=chunk-
|
|
15995
|
-
//# sourceMappingURL=chunk-
|
|
16060
|
+
//# sourceMappingURL=chunk-BJASJTXK.cjs.map
|
|
16061
|
+
//# sourceMappingURL=chunk-BJASJTXK.cjs.map
|