@mastra/core 0.17.0-alpha.3 → 0.17.0-alpha.5
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 +22 -0
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +11 -11
- package/dist/agent/index.js +2 -2
- package/dist/agent/input-processor/index.cjs +6 -6
- package/dist/agent/input-processor/index.js +1 -1
- package/dist/agent/message-list/index.d.ts +1 -1
- package/dist/agent/message-list/index.d.ts.map +1 -1
- package/dist/agent/types.d.ts +5 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/ai-tracing/exporters/default.d.ts +1 -0
- package/dist/ai-tracing/exporters/default.d.ts.map +1 -1
- package/dist/ai-tracing/index.cjs +35 -31
- package/dist/ai-tracing/index.js +1 -1
- package/dist/ai-tracing/spans/base.d.ts +2 -1
- package/dist/ai-tracing/spans/base.d.ts.map +1 -1
- package/dist/ai-tracing/types.d.ts +35 -4
- package/dist/ai-tracing/types.d.ts.map +1 -1
- package/dist/ai-tracing/utils.d.ts +3 -2
- package/dist/ai-tracing/utils.d.ts.map +1 -1
- package/dist/{chunk-4UUBZNVD.cjs → chunk-3DHX2SDR.cjs} +20 -9
- package/dist/chunk-3DHX2SDR.cjs.map +1 -0
- package/dist/{chunk-6DGBFJVJ.js → chunk-4VHC2F5H.js} +10 -8
- package/dist/chunk-4VHC2F5H.js.map +1 -0
- package/dist/{chunk-6ER2C5KK.js → chunk-666JQVO5.js} +73 -60
- package/dist/chunk-666JQVO5.js.map +1 -0
- package/dist/{chunk-DFG5DYBU.cjs → chunk-7UO6UWCO.cjs} +4 -4
- package/dist/{chunk-DFG5DYBU.cjs.map → chunk-7UO6UWCO.cjs.map} +1 -1
- package/dist/{chunk-CUL4XPO7.cjs → chunk-CP4TZ4HO.cjs} +119 -46
- package/dist/chunk-CP4TZ4HO.cjs.map +1 -0
- package/dist/{chunk-HN446TOQ.js → chunk-D43ZGJR3.js} +17 -6
- package/dist/chunk-D43ZGJR3.js.map +1 -0
- package/dist/{chunk-NHXCRP73.cjs → chunk-EXG53YAJ.cjs} +92 -79
- package/dist/chunk-EXG53YAJ.cjs.map +1 -0
- package/dist/{chunk-7GC52IJO.cjs → chunk-HBQSSMAD.cjs} +13 -11
- package/dist/chunk-HBQSSMAD.cjs.map +1 -0
- package/dist/{chunk-O5ZQXW2Z.js → chunk-IYN65QCO.js} +5 -5
- package/dist/{chunk-O5ZQXW2Z.js.map → chunk-IYN65QCO.js.map} +1 -1
- package/dist/{chunk-RYRLZO4M.js → chunk-KYFRWMTX.js} +3 -3
- package/dist/{chunk-RYRLZO4M.js.map → chunk-KYFRWMTX.js.map} +1 -1
- package/dist/{chunk-AZW77RIZ.cjs → chunk-MRZHPP3G.cjs} +103 -5
- package/dist/chunk-MRZHPP3G.cjs.map +1 -0
- package/dist/{chunk-MEAE636Z.js → chunk-NRGXWM6C.js} +17 -4
- package/dist/chunk-NRGXWM6C.js.map +1 -0
- package/dist/{chunk-UIOXAMCE.js → chunk-PL3B3FZM.js} +119 -47
- package/dist/chunk-PL3B3FZM.js.map +1 -0
- package/dist/{chunk-PGJPVLDZ.cjs → chunk-RNJ4GD7U.cjs} +6 -6
- package/dist/{chunk-PGJPVLDZ.cjs.map → chunk-RNJ4GD7U.cjs.map} +1 -1
- package/dist/{chunk-VFSLYB2P.cjs → chunk-SZZPFXZ7.cjs} +21 -8
- package/dist/chunk-SZZPFXZ7.cjs.map +1 -0
- package/dist/{chunk-FJRTJO6A.cjs → chunk-VBBMXF7Z.cjs} +12 -12
- package/dist/{chunk-FJRTJO6A.cjs.map → chunk-VBBMXF7Z.cjs.map} +1 -1
- package/dist/{chunk-YUSC7Q6Y.js → chunk-VXJFKEON.js} +4 -4
- package/dist/{chunk-YUSC7Q6Y.js.map → chunk-VXJFKEON.js.map} +1 -1
- package/dist/{chunk-A6DPQCNR.js → chunk-XRJDA7BI.js} +102 -4
- package/dist/chunk-XRJDA7BI.js.map +1 -0
- package/dist/index.cjs +38 -38
- package/dist/index.js +7 -7
- package/dist/llm/model/model.d.ts +3 -1
- package/dist/llm/model/model.d.ts.map +1 -1
- package/dist/llm/model/model.loop.d.ts +3 -1
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/shared.types.d.ts +4 -0
- package/dist/llm/model/shared.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/options.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/index.d.ts +836 -0
- package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -0
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +559 -0
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -0
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +311 -0
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -0
- package/dist/loop/{workflow → workflows/agentic-execution}/tool-call-step.d.ts +16 -16
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -0
- package/dist/loop/workflows/agentic-loop/index.d.ts +842 -0
- package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -0
- package/dist/loop/workflows/run-state.d.ts.map +1 -0
- package/dist/loop/workflows/schema.d.ts +439 -0
- package/dist/loop/workflows/schema.d.ts.map +1 -0
- package/dist/loop/{workflow → workflows}/stream.d.ts +1 -1
- package/dist/loop/workflows/stream.d.ts.map +1 -0
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +2 -2
- package/dist/network/index.js +1 -1
- package/dist/network/vNext/index.cjs +34 -34
- package/dist/network/vNext/index.cjs.map +1 -1
- package/dist/network/vNext/index.js +7 -7
- package/dist/network/vNext/index.js.map +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/base.d.ts.map +1 -1
- package/dist/scores/index.cjs +8 -8
- package/dist/scores/index.js +1 -1
- package/dist/storage/index.cjs +3 -3
- package/dist/storage/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 +1 -1
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/test-utils/llm-mock.cjs +2 -2
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/utils.cjs +17 -17
- package/dist/utils.d.ts +2 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/workflows/default.d.ts.map +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/evented/workflow.d.ts.map +1 -1
- package/dist/workflows/execution-engine.d.ts +7 -2
- package/dist/workflows/execution-engine.d.ts.map +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/dist/workflows/types.d.ts +6 -1
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/workflow.d.ts +12 -10
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4UUBZNVD.cjs.map +0 -1
- package/dist/chunk-6DGBFJVJ.js.map +0 -1
- package/dist/chunk-6ER2C5KK.js.map +0 -1
- package/dist/chunk-7GC52IJO.cjs.map +0 -1
- package/dist/chunk-A6DPQCNR.js.map +0 -1
- package/dist/chunk-AZW77RIZ.cjs.map +0 -1
- package/dist/chunk-CUL4XPO7.cjs.map +0 -1
- package/dist/chunk-HN446TOQ.js.map +0 -1
- package/dist/chunk-MEAE636Z.js.map +0 -1
- package/dist/chunk-NHXCRP73.cjs.map +0 -1
- package/dist/chunk-UIOXAMCE.js.map +0 -1
- package/dist/chunk-VFSLYB2P.cjs.map +0 -1
- package/dist/loop/workflow/llm-execution.d.ts +0 -81
- package/dist/loop/workflow/llm-execution.d.ts.map +0 -1
- package/dist/loop/workflow/outer-llm-step.d.ts +0 -44
- package/dist/loop/workflow/outer-llm-step.d.ts.map +0 -1
- package/dist/loop/workflow/run-state.d.ts.map +0 -1
- package/dist/loop/workflow/schema.d.ts +0 -92
- package/dist/loop/workflow/schema.d.ts.map +0 -1
- package/dist/loop/workflow/stream.d.ts.map +0 -1
- package/dist/loop/workflow/tool-call-step.d.ts.map +0 -1
- /package/dist/loop/{workflow → workflows}/run-state.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fetchWithRetry } from './chunk-
|
|
1
|
+
import { fetchWithRetry } from './chunk-PL3B3FZM.js';
|
|
2
2
|
import { MastraError } from './chunk-MCOVMKIS.js';
|
|
3
3
|
import { randomUUID } from 'crypto';
|
|
4
4
|
import * as AIV4 from 'ai';
|
|
@@ -1059,7 +1059,105 @@ var MessageList = class _MessageList {
|
|
|
1059
1059
|
model: () => this.aiV5UIMessagesToAIV5ModelMessages(this.response.aiV5.ui()).filter(
|
|
1060
1060
|
(m) => m.role === `tool` || m.role === `assistant`
|
|
1061
1061
|
),
|
|
1062
|
-
modelContent: () => {
|
|
1062
|
+
modelContent: (stepNumber) => {
|
|
1063
|
+
if (typeof stepNumber === "number") {
|
|
1064
|
+
const uiMessages = this.response.aiV5.ui();
|
|
1065
|
+
const uiMessagesParts = uiMessages.flatMap((item) => item.parts);
|
|
1066
|
+
const stepBoundaries = [];
|
|
1067
|
+
uiMessagesParts.forEach((part, index) => {
|
|
1068
|
+
if (part.type === "step-start") {
|
|
1069
|
+
stepBoundaries.push(index);
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
if (stepNumber === -1) {
|
|
1073
|
+
const toolParts = uiMessagesParts.filter((p) => p.type?.startsWith("tool-"));
|
|
1074
|
+
const hasStepStart = stepBoundaries.length > 0;
|
|
1075
|
+
if (!hasStepStart && toolParts.length > 0) {
|
|
1076
|
+
const lastToolPart = toolParts[toolParts.length - 1];
|
|
1077
|
+
if (!lastToolPart) {
|
|
1078
|
+
return [];
|
|
1079
|
+
}
|
|
1080
|
+
const lastToolIndex = uiMessagesParts.indexOf(lastToolPart);
|
|
1081
|
+
const previousToolPart = toolParts[toolParts.length - 2];
|
|
1082
|
+
const previousToolIndex = previousToolPart ? uiMessagesParts.indexOf(previousToolPart) : -1;
|
|
1083
|
+
const startIndex2 = previousToolIndex + 1;
|
|
1084
|
+
const stepParts3 = uiMessagesParts.slice(startIndex2, lastToolIndex + 1);
|
|
1085
|
+
const stepUiMessages3 = [
|
|
1086
|
+
{
|
|
1087
|
+
id: "last-step",
|
|
1088
|
+
role: "assistant",
|
|
1089
|
+
parts: stepParts3
|
|
1090
|
+
}
|
|
1091
|
+
];
|
|
1092
|
+
const modelMessages3 = AIV5.convertToModelMessages(this.sanitizeV5UIMessages(stepUiMessages3));
|
|
1093
|
+
return modelMessages3.flatMap(this.response.aiV5.stepContent);
|
|
1094
|
+
}
|
|
1095
|
+
const totalSteps = stepBoundaries.length + 1;
|
|
1096
|
+
if (totalSteps === 1 && !hasStepStart) {
|
|
1097
|
+
const stepUiMessages3 = [
|
|
1098
|
+
{
|
|
1099
|
+
id: "last-step",
|
|
1100
|
+
role: "assistant",
|
|
1101
|
+
parts: uiMessagesParts
|
|
1102
|
+
}
|
|
1103
|
+
];
|
|
1104
|
+
const modelMessages3 = AIV5.convertToModelMessages(this.sanitizeV5UIMessages(stepUiMessages3));
|
|
1105
|
+
return modelMessages3.flatMap(this.response.aiV5.stepContent);
|
|
1106
|
+
}
|
|
1107
|
+
const lastStepStart = stepBoundaries[stepBoundaries.length - 1];
|
|
1108
|
+
if (lastStepStart === void 0) {
|
|
1109
|
+
return [];
|
|
1110
|
+
}
|
|
1111
|
+
const stepParts2 = uiMessagesParts.slice(lastStepStart + 1);
|
|
1112
|
+
if (stepParts2.length === 0) {
|
|
1113
|
+
return [];
|
|
1114
|
+
}
|
|
1115
|
+
const stepUiMessages2 = [
|
|
1116
|
+
{
|
|
1117
|
+
id: "last-step",
|
|
1118
|
+
role: "assistant",
|
|
1119
|
+
parts: stepParts2
|
|
1120
|
+
}
|
|
1121
|
+
];
|
|
1122
|
+
const modelMessages2 = AIV5.convertToModelMessages(this.sanitizeV5UIMessages(stepUiMessages2));
|
|
1123
|
+
return modelMessages2.flatMap(this.response.aiV5.stepContent);
|
|
1124
|
+
}
|
|
1125
|
+
if (stepNumber === 1) {
|
|
1126
|
+
const firstStepStart = stepBoundaries[0] ?? uiMessagesParts.length;
|
|
1127
|
+
if (firstStepStart === 0) {
|
|
1128
|
+
return [];
|
|
1129
|
+
}
|
|
1130
|
+
const stepParts2 = uiMessagesParts.slice(0, firstStepStart);
|
|
1131
|
+
const stepUiMessages2 = [
|
|
1132
|
+
{
|
|
1133
|
+
id: "step-1",
|
|
1134
|
+
role: "assistant",
|
|
1135
|
+
parts: stepParts2
|
|
1136
|
+
}
|
|
1137
|
+
];
|
|
1138
|
+
const modelMessages2 = AIV5.convertToModelMessages(this.sanitizeV5UIMessages(stepUiMessages2));
|
|
1139
|
+
return modelMessages2.flatMap(this.response.aiV5.stepContent);
|
|
1140
|
+
}
|
|
1141
|
+
const stepIndex = stepNumber - 2;
|
|
1142
|
+
if (stepIndex < 0 || stepIndex >= stepBoundaries.length) {
|
|
1143
|
+
return [];
|
|
1144
|
+
}
|
|
1145
|
+
const startIndex = (stepBoundaries[stepIndex] ?? 0) + 1;
|
|
1146
|
+
const endIndex = stepBoundaries[stepIndex + 1] ?? uiMessagesParts.length;
|
|
1147
|
+
if (startIndex >= endIndex) {
|
|
1148
|
+
return [];
|
|
1149
|
+
}
|
|
1150
|
+
const stepParts = uiMessagesParts.slice(startIndex, endIndex);
|
|
1151
|
+
const stepUiMessages = [
|
|
1152
|
+
{
|
|
1153
|
+
id: `step-${stepNumber}`,
|
|
1154
|
+
role: "assistant",
|
|
1155
|
+
parts: stepParts
|
|
1156
|
+
}
|
|
1157
|
+
];
|
|
1158
|
+
const modelMessages = AIV5.convertToModelMessages(this.sanitizeV5UIMessages(stepUiMessages));
|
|
1159
|
+
return modelMessages.flatMap(this.response.aiV5.stepContent);
|
|
1160
|
+
}
|
|
1063
1161
|
return this.response.aiV5.model().map(this.response.aiV5.stepContent).flat();
|
|
1064
1162
|
},
|
|
1065
1163
|
stepContent: (message) => {
|
|
@@ -2858,5 +2956,5 @@ function convertMessages(messages) {
|
|
|
2858
2956
|
}
|
|
2859
2957
|
|
|
2860
2958
|
export { DefaultGeneratedFile, DefaultGeneratedFileWithType, MessageList, convertMessages };
|
|
2861
|
-
//# sourceMappingURL=chunk-
|
|
2862
|
-
//# sourceMappingURL=chunk-
|
|
2959
|
+
//# sourceMappingURL=chunk-XRJDA7BI.js.map
|
|
2960
|
+
//# sourceMappingURL=chunk-XRJDA7BI.js.map
|