@mastra/core 0.9.4 → 0.10.0-alpha.1
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/README.md +3 -2
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +13 -14
- package/dist/agent/index.d.ts +13 -14
- package/dist/agent/index.js +1 -1
- package/dist/{base-BCfssGt6.d.ts → base-DttB7sJD.d.ts} +1187 -886
- package/dist/{base-CAEcd6q2.d.cts → base-aJ3etsh5.d.cts} +1187 -886
- package/dist/{base-H7siSAfu.d.cts → base-aPYtPBT2.d.cts} +3 -3
- package/dist/{base-4Z34GQL8.d.ts → base-tc5kgDTD.d.ts} +3 -3
- package/dist/base.cjs +2 -2
- package/dist/base.d.cts +2 -3
- package/dist/base.d.ts +2 -3
- package/dist/base.js +1 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.d.cts +2 -3
- package/dist/bundler/index.d.ts +2 -3
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-W4BSLENO.js → chunk-2NTUAUGH.js} +1 -1
- package/dist/{chunk-S34QVMKE.js → chunk-2PW6UJMW.js} +77 -10
- package/dist/{chunk-WE36CRQV.cjs → chunk-2U7ZZUFO.cjs} +2 -2
- package/dist/{workflows/vNext/index.js → chunk-3SQ3G2EJ.js} +19 -16
- package/dist/chunk-5HULBQ2W.cjs +38 -0
- package/dist/{chunk-XRGDVLM4.cjs → chunk-5JRD3NDP.cjs} +15 -15
- package/dist/{chunk-GXKODTLA.cjs → chunk-5W2G7S44.cjs} +83 -68
- package/dist/chunk-75Z4BZEE.js +36 -0
- package/dist/{chunk-66GQROSI.cjs → chunk-AOGUTJUO.cjs} +58 -51
- package/dist/{chunk-WIKOYZ63.js → chunk-BPTSLJHA.js} +9 -9
- package/dist/{chunk-JBJ7KXN5.js → chunk-C3ICEF6E.js} +1 -1
- package/dist/{chunk-E4FAXBUV.cjs → chunk-CWSFP2HS.cjs} +2 -2
- package/dist/{chunk-FW5RS6WV.js → chunk-E7CLY6SK.js} +42 -35
- package/dist/{chunk-235X76GC.js → chunk-FI7R232B.js} +2 -2
- package/dist/chunk-GQ2XQ4UN.js +321 -0
- package/dist/{chunk-H4CEZSRM.js → chunk-J7GDGV6F.js} +1 -1
- package/dist/{chunk-NLBJOFNG.js → chunk-JW5TMK2L.js} +1 -1
- package/dist/{chunk-NOPY74PV.js → chunk-KJQFFEEQ.js} +1 -1
- package/dist/{chunk-V2Q2FEVO.cjs → chunk-KSPHQSZX.cjs} +2 -2
- package/dist/{chunk-NZV4OA6P.js → chunk-LHRZV5VG.js} +2 -23
- package/dist/chunk-NMDM4IZN.cjs +78 -0
- package/dist/chunk-OBEALYTK.js +74 -0
- package/dist/{chunk-PEK4TY3P.js → chunk-OCT2762Q.js} +1 -1
- package/dist/{chunk-5DUFC7TV.cjs → chunk-P7BGXOQV.cjs} +2 -2
- package/dist/{chunk-WQKOM7XM.cjs → chunk-PIZM25KI.cjs} +3 -24
- package/dist/{chunk-S7J63JOG.cjs → chunk-RVS6OUJN.cjs} +2 -2
- package/dist/{chunk-5JUWUTPJ.cjs → chunk-SKG2NIZW.cjs} +2 -2
- package/dist/chunk-SWW4EBUZ.cjs +96 -0
- package/dist/{chunk-RGE4UF6A.cjs → chunk-TMPFLJLG.cjs} +2 -2
- package/dist/{workflows/vNext/index.cjs → chunk-TTKQ37ZZ.cjs} +24 -21
- package/dist/{chunk-EJITEVAB.cjs → chunk-U3L3NEOM.cjs} +81 -10
- package/dist/chunk-VHLL4AZK.js +90 -0
- package/dist/{chunk-EG74VBSP.cjs → chunk-YEULQPUY.cjs} +6 -6
- package/dist/{chunk-SOLXHDNQ.js → chunk-ZB3LEHL2.js} +81 -66
- package/dist/{chunk-TAFOICHR.js → chunk-ZKN6HYYQ.js} +1 -1
- package/dist/chunk-ZZDAC5KD.cjs +325 -0
- package/dist/deployer/index.cjs +2 -2
- package/dist/deployer/index.d.cts +2 -3
- package/dist/deployer/index.d.ts +2 -3
- package/dist/deployer/index.js +1 -1
- package/dist/eval/index.d.cts +13 -14
- package/dist/eval/index.d.ts +13 -14
- package/dist/hooks/index.d.cts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/index.cjs +88 -159
- package/dist/index.d.cts +17 -25
- package/dist/index.d.ts +17 -25
- package/dist/index.js +18 -25
- package/dist/integration/index.cjs +3 -3
- package/dist/integration/index.d.cts +12 -13
- package/dist/integration/index.d.ts +12 -13
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.d.cts +13 -14
- package/dist/llm/index.d.ts +13 -14
- package/dist/logger/index.cjs +18 -17
- package/dist/logger/index.d.cts +42 -2
- package/dist/logger/index.d.ts +42 -2
- package/dist/logger/index.js +2 -1
- package/dist/{index-QV27jkxQ.d.ts → logger-EhZkzZOr.d.cts} +38 -52
- package/dist/{index-QV27jkxQ.d.cts → logger-EhZkzZOr.d.ts} +38 -52
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.cts +11 -12
- package/dist/mastra/index.d.ts +11 -12
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.cjs +75 -17
- package/dist/mcp/index.d.cts +14 -15
- package/dist/mcp/index.d.ts +14 -15
- package/dist/mcp/index.js +69 -15
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.d.cts +12 -13
- package/dist/memory/index.d.ts +12 -13
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +8 -8
- package/dist/network/index.d.cts +12 -13
- package/dist/network/index.d.ts +12 -13
- package/dist/network/index.js +5 -5
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +15 -16
- package/dist/relevance/index.d.ts +15 -16
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.cjs +4 -0
- package/dist/server/index.d.cts +13 -12
- package/dist/server/index.d.ts +13 -12
- package/dist/server/index.js +4 -1
- package/dist/storage/index.cjs +184 -3
- package/dist/storage/index.d.cts +83 -13
- package/dist/storage/index.d.ts +83 -13
- package/dist/storage/index.js +186 -1
- package/dist/telemetry/index.d.cts +14 -15
- package/dist/telemetry/index.d.ts +14 -15
- package/dist/telemetry/otel-vendor.cjs +2 -2
- package/dist/telemetry/otel-vendor.d.cts +1 -1
- package/dist/telemetry/otel-vendor.d.ts +1 -1
- package/dist/telemetry/otel-vendor.js +1 -1
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.d.cts +12 -13
- package/dist/tools/index.d.ts +12 -13
- package/dist/tools/index.js +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.d.cts +2 -3
- package/dist/tts/index.d.ts +2 -3
- package/dist/tts/index.js +1 -1
- package/dist/{types-BtMyV38I.d.ts → types-Bo1uigWx.d.cts} +1 -1
- package/dist/{types-BtMyV38I.d.cts → types-Bo1uigWx.d.ts} +1 -1
- package/dist/utils.cjs +28 -12
- package/dist/utils.d.cts +59 -16
- package/dist/utils.d.ts +59 -16
- package/dist/utils.js +1 -1
- package/dist/vector/filter/index.cjs +189 -7
- package/dist/vector/filter/index.js +190 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.d.cts +28 -20
- package/dist/vector/index.d.ts +28 -20
- package/dist/vector/index.js +1 -1
- package/dist/voice/index.cjs +4 -4
- package/dist/voice/index.d.cts +12 -13
- package/dist/voice/index.d.ts +12 -13
- package/dist/voice/index.js +1 -1
- package/dist/workflows/index.cjs +17 -69
- package/dist/workflows/index.d.cts +197 -77
- package/dist/workflows/index.d.ts +197 -77
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +90 -0
- package/dist/workflows/legacy/index.d.cts +87 -0
- package/dist/workflows/legacy/index.d.ts +87 -0
- package/dist/workflows/legacy/index.js +1 -0
- package/package.json +19 -40
- package/workflows/legacy.d.ts +1 -0
- package/dist/chunk-4WABQORE.js +0 -781
- package/dist/chunk-CIEPFV6B.js +0 -658
- package/dist/chunk-CMPPXW4U.js +0 -154
- package/dist/chunk-CTKNWYK2.js +0 -131
- package/dist/chunk-LGERQTJM.js +0 -190
- package/dist/chunk-O44MSFMZ.cjs +0 -168
- package/dist/chunk-QDAMIZY3.cjs +0 -783
- package/dist/chunk-QHDPLMHB.cjs +0 -667
- package/dist/chunk-RAQBTCIR.cjs +0 -134
- package/dist/chunk-YK3XJ52U.cjs +0 -192
- package/dist/storage/libsql/index.cjs +0 -581
- package/dist/storage/libsql/index.d.cts +0 -104
- package/dist/storage/libsql/index.d.ts +0 -104
- package/dist/storage/libsql/index.js +0 -578
- package/dist/vector/libsql/index.cjs +0 -14
- package/dist/vector/libsql/index.d.cts +0 -82
- package/dist/vector/libsql/index.d.ts +0 -82
- package/dist/vector/libsql/index.js +0 -1
- package/dist/workflows/vNext/index.d.cts +0 -209
- package/dist/workflows/vNext/index.d.ts +0 -209
- package/storage/libsql.d.ts +0 -1
- package/vector/libsql.d.ts +0 -1
- package/workflows/vNext.d.ts +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkRVS6OUJN_cjs = require('./chunk-RVS6OUJN.cjs');
|
|
4
|
+
var chunkST5RMVLG_cjs = require('./chunk-ST5RMVLG.cjs');
|
|
5
|
+
var chunk5JRD3NDP_cjs = require('./chunk-5JRD3NDP.cjs');
|
|
5
6
|
var chunkUVRGQEMD_cjs = require('./chunk-UVRGQEMD.cjs');
|
|
6
|
-
var
|
|
7
|
+
var chunkU3L3NEOM_cjs = require('./chunk-U3L3NEOM.cjs');
|
|
8
|
+
var chunkYEULQPUY_cjs = require('./chunk-YEULQPUY.cjs');
|
|
9
|
+
var chunkSWW4EBUZ_cjs = require('./chunk-SWW4EBUZ.cjs');
|
|
7
10
|
var chunkLABUWBKX_cjs = require('./chunk-LABUWBKX.cjs');
|
|
8
|
-
var chunkST5RMVLG_cjs = require('./chunk-ST5RMVLG.cjs');
|
|
9
|
-
var chunkEG74VBSP_cjs = require('./chunk-EG74VBSP.cjs');
|
|
10
|
-
var chunkO44MSFMZ_cjs = require('./chunk-O44MSFMZ.cjs');
|
|
11
11
|
var chunkRWTSGWWL_cjs = require('./chunk-RWTSGWWL.cjs');
|
|
12
12
|
var api = require('@opentelemetry/api');
|
|
13
13
|
var zod = require('zod');
|
|
@@ -22,8 +22,8 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
22
22
|
var EventEmitter__default = /*#__PURE__*/_interopDefault(EventEmitter);
|
|
23
23
|
var sift__default = /*#__PURE__*/_interopDefault(sift);
|
|
24
24
|
|
|
25
|
-
// src/workflows/step.ts
|
|
26
|
-
var
|
|
25
|
+
// src/workflows/legacy/step.ts
|
|
26
|
+
var LegacyStep = class {
|
|
27
27
|
id;
|
|
28
28
|
description;
|
|
29
29
|
inputSchema;
|
|
@@ -51,7 +51,7 @@ var Step = class {
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
// src/workflows/types.ts
|
|
54
|
+
// src/workflows/legacy/types.ts
|
|
55
55
|
var WhenConditionReturnValue = /* @__PURE__ */(WhenConditionReturnValue2 => {
|
|
56
56
|
WhenConditionReturnValue2["CONTINUE"] = "continue";
|
|
57
57
|
WhenConditionReturnValue2["CONTINUE_FAILED"] = "continue_failed";
|
|
@@ -70,7 +70,7 @@ _Agent_decorators = [chunkUVRGQEMD_cjs.InstrumentClass({
|
|
|
70
70
|
prefix: "agent",
|
|
71
71
|
excludeMethods: ["hasOwnMemory", "getMemory", "__primitive", "__registerMastra", "__registerPrimitives", "__setTools", "__setLogger", "__setTelemetry", "log", "getModel", "getInstructions", "getTools", "getLLM", "getWorkflows"]
|
|
72
72
|
})];
|
|
73
|
-
exports.Agent = class Agent extends (_a =
|
|
73
|
+
exports.Agent = class Agent extends (_a = chunkYEULQPUY_cjs.MastraBase) {
|
|
74
74
|
id;
|
|
75
75
|
name;
|
|
76
76
|
#instructions;
|
|
@@ -87,7 +87,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
87
87
|
#voice;
|
|
88
88
|
constructor(config) {
|
|
89
89
|
super({
|
|
90
|
-
component:
|
|
90
|
+
component: chunkSWW4EBUZ_cjs.RegisteredLogger.AGENT
|
|
91
91
|
});
|
|
92
92
|
this.name = config.name;
|
|
93
93
|
this.id = config.name;
|
|
@@ -131,14 +131,21 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
131
131
|
this.#voice?.addInstructions(config.instructions);
|
|
132
132
|
}
|
|
133
133
|
} else {
|
|
134
|
-
this.#voice = new
|
|
134
|
+
this.#voice = new chunkRVS6OUJN_cjs.DefaultVoice();
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
hasOwnMemory() {
|
|
138
138
|
return Boolean(this.#memory);
|
|
139
139
|
}
|
|
140
140
|
getMemory() {
|
|
141
|
-
|
|
141
|
+
const memory = this.#memory;
|
|
142
|
+
if (memory && !memory.hasOwnStorage && this.#mastra) {
|
|
143
|
+
const storage = this.#mastra.getStorage();
|
|
144
|
+
if (storage) {
|
|
145
|
+
memory.setStorage(storage);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return memory;
|
|
142
149
|
}
|
|
143
150
|
get voice() {
|
|
144
151
|
if (typeof this.#instructions === "function") {
|
|
@@ -177,7 +184,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
177
184
|
}));
|
|
178
185
|
return voice;
|
|
179
186
|
} else {
|
|
180
|
-
return new
|
|
187
|
+
return new chunkRVS6OUJN_cjs.DefaultVoice();
|
|
181
188
|
}
|
|
182
189
|
}
|
|
183
190
|
get instructions() {
|
|
@@ -209,13 +216,13 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
209
216
|
if (typeof this.#tools === "function") {
|
|
210
217
|
throw new Error("Tools are not compatible when tools are a function. Please use getTools() instead.");
|
|
211
218
|
}
|
|
212
|
-
return
|
|
219
|
+
return chunkU3L3NEOM_cjs.ensureToolProperties(this.#tools);
|
|
213
220
|
}
|
|
214
221
|
getTools({
|
|
215
222
|
runtimeContext = new chunkLABUWBKX_cjs.RuntimeContext()
|
|
216
223
|
} = {}) {
|
|
217
224
|
if (typeof this.#tools !== "function") {
|
|
218
|
-
return
|
|
225
|
+
return chunkU3L3NEOM_cjs.ensureToolProperties(this.#tools);
|
|
219
226
|
}
|
|
220
227
|
const result = this.#tools({
|
|
221
228
|
runtimeContext
|
|
@@ -225,7 +232,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
225
232
|
this.logger.error(`[Agent:${this.name}] - Function-based tools returned empty value`);
|
|
226
233
|
throw new Error("Tools are required when using a function to provide them. The function returned an empty value.");
|
|
227
234
|
}
|
|
228
|
-
return
|
|
235
|
+
return chunkU3L3NEOM_cjs.ensureToolProperties(tools);
|
|
229
236
|
});
|
|
230
237
|
}
|
|
231
238
|
get llm() {
|
|
@@ -247,7 +254,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
247
254
|
runtimeContext
|
|
248
255
|
});
|
|
249
256
|
return resolveMaybePromise(model, model2 => {
|
|
250
|
-
const llm = new
|
|
257
|
+
const llm = new chunk5JRD3NDP_cjs.MastraLLM({
|
|
251
258
|
model: model2,
|
|
252
259
|
mastra: this.#mastra
|
|
253
260
|
});
|
|
@@ -386,7 +393,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
386
393
|
messages: userMessages
|
|
387
394
|
};
|
|
388
395
|
}
|
|
389
|
-
const newMessages =
|
|
396
|
+
const newMessages = chunkU3L3NEOM_cjs.ensureAllMessagesAreCoreMessages(userMessages);
|
|
390
397
|
const now = Date.now();
|
|
391
398
|
const messages = newMessages.map((u, index) => {
|
|
392
399
|
return {
|
|
@@ -638,7 +645,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
638
645
|
runtimeContext
|
|
639
646
|
}) : this.model
|
|
640
647
|
};
|
|
641
|
-
return [k,
|
|
648
|
+
return [k, chunkU3L3NEOM_cjs.makeCoreTool(tool, options)];
|
|
642
649
|
}));
|
|
643
650
|
const assignedToolEntriesConverted = Object.fromEntries(assignedCoreToolEntries.filter(entry => Boolean(entry)));
|
|
644
651
|
toolsForRequest = {
|
|
@@ -678,7 +685,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
678
685
|
runtimeContext
|
|
679
686
|
}) : this.model
|
|
680
687
|
};
|
|
681
|
-
const convertedToCoreTool =
|
|
688
|
+
const convertedToCoreTool = chunkU3L3NEOM_cjs.makeCoreTool(toolObj, options, "toolset");
|
|
682
689
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
683
690
|
}
|
|
684
691
|
}
|
|
@@ -719,7 +726,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
719
726
|
runtimeContext
|
|
720
727
|
}) : this.model
|
|
721
728
|
};
|
|
722
|
-
const convertedToCoreTool =
|
|
729
|
+
const convertedToCoreTool = chunkU3L3NEOM_cjs.makeCoreTool(rest, options, "client-tool");
|
|
723
730
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
724
731
|
}
|
|
725
732
|
}
|
|
@@ -786,7 +793,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
786
793
|
let mastraProxy = void 0;
|
|
787
794
|
const logger = this.logger;
|
|
788
795
|
if (this.#mastra) {
|
|
789
|
-
mastraProxy =
|
|
796
|
+
mastraProxy = chunkU3L3NEOM_cjs.createMastraProxy({
|
|
790
797
|
mastra: this.#mastra,
|
|
791
798
|
logger
|
|
792
799
|
});
|
|
@@ -994,7 +1001,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
994
1001
|
try {
|
|
995
1002
|
const userMessage = this.getMostRecentUserMessage(messages);
|
|
996
1003
|
const now = Date.now();
|
|
997
|
-
const threadMessages = this.sanitizeResponseMessages(
|
|
1004
|
+
const threadMessages = this.sanitizeResponseMessages(chunkU3L3NEOM_cjs.ensureAllMessagesAreCoreMessages(messages)).map((u, index) => {
|
|
998
1005
|
return {
|
|
999
1006
|
id: `id` in u && u.id || experimental_generateMessageId ? experimental_generateMessageId() : this.getMemory()?.generateId(),
|
|
1000
1007
|
createdAt: new Date(now + index),
|
|
@@ -1143,7 +1150,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
1143
1150
|
messages: messageObjects,
|
|
1144
1151
|
tools: convertedTools,
|
|
1145
1152
|
onStepFinish: result3 => {
|
|
1146
|
-
|
|
1153
|
+
return onStepFinish?.(result3);
|
|
1147
1154
|
},
|
|
1148
1155
|
maxSteps,
|
|
1149
1156
|
runId: runIdToUse,
|
|
@@ -1175,7 +1182,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
1175
1182
|
messages: messageObjects,
|
|
1176
1183
|
tools: convertedTools,
|
|
1177
1184
|
onStepFinish: result3 => {
|
|
1178
|
-
|
|
1185
|
+
return onStepFinish?.(result3);
|
|
1179
1186
|
},
|
|
1180
1187
|
maxSteps,
|
|
1181
1188
|
runId: runIdToUse,
|
|
@@ -1205,7 +1212,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
1205
1212
|
tools: convertedTools,
|
|
1206
1213
|
structuredOutput: output,
|
|
1207
1214
|
onStepFinish: result2 => {
|
|
1208
|
-
|
|
1215
|
+
return onStepFinish?.(result2);
|
|
1209
1216
|
},
|
|
1210
1217
|
maxSteps,
|
|
1211
1218
|
runId: runIdToUse,
|
|
@@ -1303,7 +1310,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
1303
1310
|
temperature,
|
|
1304
1311
|
tools: convertedTools,
|
|
1305
1312
|
onStepFinish: result => {
|
|
1306
|
-
|
|
1313
|
+
return onStepFinish?.(result);
|
|
1307
1314
|
},
|
|
1308
1315
|
onFinish: async result => {
|
|
1309
1316
|
try {
|
|
@@ -1323,7 +1330,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
1323
1330
|
runId
|
|
1324
1331
|
});
|
|
1325
1332
|
}
|
|
1326
|
-
|
|
1333
|
+
await onFinish?.(result);
|
|
1327
1334
|
},
|
|
1328
1335
|
maxSteps,
|
|
1329
1336
|
runId: runIdToUse,
|
|
@@ -1345,7 +1352,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
1345
1352
|
temperature,
|
|
1346
1353
|
tools: convertedTools,
|
|
1347
1354
|
onStepFinish: result => {
|
|
1348
|
-
|
|
1355
|
+
return onStepFinish?.(result);
|
|
1349
1356
|
},
|
|
1350
1357
|
onFinish: async result => {
|
|
1351
1358
|
try {
|
|
@@ -1365,7 +1372,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
1365
1372
|
runId
|
|
1366
1373
|
});
|
|
1367
1374
|
}
|
|
1368
|
-
|
|
1375
|
+
await onFinish?.(result);
|
|
1369
1376
|
},
|
|
1370
1377
|
maxSteps,
|
|
1371
1378
|
runId: runIdToUse,
|
|
@@ -1385,7 +1392,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
1385
1392
|
temperature,
|
|
1386
1393
|
structuredOutput: output,
|
|
1387
1394
|
onStepFinish: result => {
|
|
1388
|
-
|
|
1395
|
+
return onStepFinish?.(result);
|
|
1389
1396
|
},
|
|
1390
1397
|
onFinish: async result => {
|
|
1391
1398
|
try {
|
|
@@ -1405,7 +1412,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
1405
1412
|
runId
|
|
1406
1413
|
});
|
|
1407
1414
|
}
|
|
1408
|
-
|
|
1415
|
+
await onFinish?.(result);
|
|
1409
1416
|
},
|
|
1410
1417
|
runId: runIdToUse,
|
|
1411
1418
|
toolChoice,
|
|
@@ -1479,7 +1486,7 @@ exports.Agent = class Agent extends (_a = chunkEG74VBSP_cjs.MastraBase) {
|
|
|
1479
1486
|
}
|
|
1480
1487
|
toStep() {
|
|
1481
1488
|
const x = agentToStep(this);
|
|
1482
|
-
return new
|
|
1489
|
+
return new LegacyStep(x);
|
|
1483
1490
|
}
|
|
1484
1491
|
};
|
|
1485
1492
|
exports.Agent = /*@__PURE__*/(_ => {
|
|
@@ -1487,10 +1494,10 @@ exports.Agent = /*@__PURE__*/(_ => {
|
|
|
1487
1494
|
exports.Agent = chunkRWTSGWWL_cjs.__decorateElement(_init, 0, "Agent", _Agent_decorators, exports.Agent);
|
|
1488
1495
|
chunkRWTSGWWL_cjs.__runInitializers(_init, 1, exports.Agent);
|
|
1489
1496
|
|
|
1490
|
-
// src/workflows/utils.ts
|
|
1497
|
+
// src/workflows/legacy/utils.ts
|
|
1491
1498
|
return exports.Agent;
|
|
1492
1499
|
})();
|
|
1493
|
-
// src/workflows/utils.ts
|
|
1500
|
+
// src/workflows/legacy/utils.ts
|
|
1494
1501
|
function isErrorEvent(stateEvent) {
|
|
1495
1502
|
return stateEvent.type.startsWith("xstate.error.actor.");
|
|
1496
1503
|
}
|
|
@@ -1609,7 +1616,7 @@ function getResultActivePaths(state) {
|
|
|
1609
1616
|
return activePathsAndStatus;
|
|
1610
1617
|
}
|
|
1611
1618
|
function isWorkflow(step) {
|
|
1612
|
-
return step instanceof
|
|
1619
|
+
return step instanceof LegacyWorkflow;
|
|
1613
1620
|
}
|
|
1614
1621
|
function isAgent(step) {
|
|
1615
1622
|
return step instanceof exports.Agent;
|
|
@@ -1723,7 +1730,7 @@ function workflowToStep(workflow, {
|
|
|
1723
1730
|
});
|
|
1724
1731
|
unwatch();
|
|
1725
1732
|
if (!awaitedResult) {
|
|
1726
|
-
throw new Error("
|
|
1733
|
+
throw new Error("LegacyWorkflow run failed");
|
|
1727
1734
|
}
|
|
1728
1735
|
if (awaitedResult.activePaths?.size > 0) {
|
|
1729
1736
|
const suspendedStep = [...awaitedResult.activePaths.entries()].find(([, {
|
|
@@ -2078,7 +2085,7 @@ var Machine = class extends EventEmitter__default.default {
|
|
|
2078
2085
|
const logger = this.logger;
|
|
2079
2086
|
let mastraProxy = void 0;
|
|
2080
2087
|
if (this.#mastra) {
|
|
2081
|
-
mastraProxy =
|
|
2088
|
+
mastraProxy = chunkU3L3NEOM_cjs.createMastraProxy({
|
|
2082
2089
|
mastra: this.#mastra,
|
|
2083
2090
|
logger
|
|
2084
2091
|
});
|
|
@@ -2875,7 +2882,7 @@ var Machine = class extends EventEmitter__default.default {
|
|
|
2875
2882
|
}
|
|
2876
2883
|
};
|
|
2877
2884
|
|
|
2878
|
-
// src/workflows/workflow-instance.ts
|
|
2885
|
+
// src/workflows/legacy/workflow-instance.ts
|
|
2879
2886
|
var WorkflowInstance = class {
|
|
2880
2887
|
name;
|
|
2881
2888
|
#mastra;
|
|
@@ -3459,8 +3466,8 @@ var WorkflowInstance = class {
|
|
|
3459
3466
|
}
|
|
3460
3467
|
};
|
|
3461
3468
|
|
|
3462
|
-
// src/workflows/workflow.ts
|
|
3463
|
-
var
|
|
3469
|
+
// src/workflows/legacy/workflow.ts
|
|
3470
|
+
var LegacyWorkflow = class extends chunkYEULQPUY_cjs.MastraBase {
|
|
3464
3471
|
name;
|
|
3465
3472
|
triggerSchema;
|
|
3466
3473
|
resultSchema;
|
|
@@ -3487,7 +3494,7 @@ var Workflow = class extends chunkEG74VBSP_cjs.MastraBase {
|
|
|
3487
3494
|
#steps = {};
|
|
3488
3495
|
#ifCount = 0;
|
|
3489
3496
|
/**
|
|
3490
|
-
* Creates a new
|
|
3497
|
+
* Creates a new LegacyWorkflow instance
|
|
3491
3498
|
* @param name - Identifier for the workflow (not necessarily unique)
|
|
3492
3499
|
* @param logger - Optional logger instance
|
|
3493
3500
|
*/
|
|
@@ -3532,7 +3539,7 @@ var Workflow = class extends chunkEG74VBSP_cjs.MastraBase {
|
|
|
3532
3539
|
});
|
|
3533
3540
|
nextSteps.forEach(step2 => this.step(step2, config));
|
|
3534
3541
|
this.after(nextSteps);
|
|
3535
|
-
this.step(new
|
|
3542
|
+
this.step(new LegacyStep({
|
|
3536
3543
|
id: `__after_${next.map(step2 => config?.id ?? step2?.id ?? step2?.name).join("_")}`,
|
|
3537
3544
|
execute: async () => {
|
|
3538
3545
|
return {
|
|
@@ -3611,7 +3618,7 @@ var Workflow = class extends chunkEG74VBSP_cjs.MastraBase {
|
|
|
3611
3618
|
});
|
|
3612
3619
|
nextSteps.forEach(step2 => this.#__internalStep(step2, config, internalUse));
|
|
3613
3620
|
this.after(nextSteps);
|
|
3614
|
-
this.#__internalStep(new
|
|
3621
|
+
this.#__internalStep(new LegacyStep({
|
|
3615
3622
|
id: `__after_${next.map(step2 => step2?.id ?? step2?.name).join("_")}`,
|
|
3616
3623
|
execute: async () => {
|
|
3617
3624
|
return {
|
|
@@ -3695,7 +3702,7 @@ var Workflow = class extends chunkEG74VBSP_cjs.MastraBase {
|
|
|
3695
3702
|
return step2;
|
|
3696
3703
|
});
|
|
3697
3704
|
nextSteps.forEach(step2 => this.step(step2, config));
|
|
3698
|
-
this.step(new
|
|
3705
|
+
this.step(new LegacyStep({
|
|
3699
3706
|
// @ts-ignore
|
|
3700
3707
|
id: `__after_${next.map(step2 => step2?.id ?? step2?.name).join("_")}`,
|
|
3701
3708
|
execute: async () => {
|
|
@@ -4009,7 +4016,7 @@ var Workflow = class extends chunkEG74VBSP_cjs.MastraBase {
|
|
|
4009
4016
|
} else {
|
|
4010
4017
|
this.after(_ifStep);
|
|
4011
4018
|
}
|
|
4012
|
-
this.step(new
|
|
4019
|
+
this.step(new LegacyStep({
|
|
4013
4020
|
id: `${lastStep.id}_if_else`,
|
|
4014
4021
|
execute: async () => {
|
|
4015
4022
|
return {
|
|
@@ -4090,7 +4097,7 @@ var Workflow = class extends chunkEG74VBSP_cjs.MastraBase {
|
|
|
4090
4097
|
throw new Error("Condition requires a step to be executed after");
|
|
4091
4098
|
}
|
|
4092
4099
|
const eventStepKey = `__${eventName}_event`;
|
|
4093
|
-
const eventStep = new
|
|
4100
|
+
const eventStep = new LegacyStep({
|
|
4094
4101
|
id: eventStepKey,
|
|
4095
4102
|
execute: async ({
|
|
4096
4103
|
context,
|
|
@@ -4436,13 +4443,13 @@ var Workflow = class extends chunkEG74VBSP_cjs.MastraBase {
|
|
|
4436
4443
|
const x = workflowToStep(this, {
|
|
4437
4444
|
mastra: this.#mastra
|
|
4438
4445
|
});
|
|
4439
|
-
return new
|
|
4446
|
+
return new LegacyStep(x);
|
|
4440
4447
|
}
|
|
4441
4448
|
};
|
|
4442
4449
|
|
|
4443
|
-
exports.
|
|
4450
|
+
exports.LegacyStep = LegacyStep;
|
|
4451
|
+
exports.LegacyWorkflow = LegacyWorkflow;
|
|
4444
4452
|
exports.WhenConditionReturnValue = WhenConditionReturnValue;
|
|
4445
|
-
exports.Workflow = Workflow;
|
|
4446
4453
|
exports.agentToStep = agentToStep;
|
|
4447
4454
|
exports.getActivePathsAndStatus = getActivePathsAndStatus;
|
|
4448
4455
|
exports.getResultActivePaths = getResultActivePaths;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { delay } from './chunk-
|
|
2
|
-
import { MastraBase } from './chunk-
|
|
3
|
-
import { RegisteredLogger } from './chunk-
|
|
1
|
+
import { delay } from './chunk-2PW6UJMW.js';
|
|
2
|
+
import { MastraBase } from './chunk-FI7R232B.js';
|
|
3
|
+
import { RegisteredLogger } from './chunk-VHLL4AZK.js';
|
|
4
4
|
import { jsonSchema, generateText, Output, generateObject, streamText, streamObject } from 'ai';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
@@ -149,7 +149,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
149
149
|
toolChoice,
|
|
150
150
|
maxSteps,
|
|
151
151
|
onStepFinish: async (props) => {
|
|
152
|
-
|
|
152
|
+
await onStepFinish?.(props);
|
|
153
153
|
this.logger.debug("[LLM] - Step Change:", {
|
|
154
154
|
text: props?.text,
|
|
155
155
|
toolCalls: props?.toolCalls,
|
|
@@ -218,7 +218,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
218
218
|
maxSteps,
|
|
219
219
|
toolChoice,
|
|
220
220
|
onStepFinish: async (props) => {
|
|
221
|
-
|
|
221
|
+
await onStepFinish?.(props);
|
|
222
222
|
this.logger.debug("[LLM] - Step Change:", {
|
|
223
223
|
text: props?.text,
|
|
224
224
|
toolCalls: props?.toolCalls,
|
|
@@ -291,7 +291,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
291
291
|
maxSteps,
|
|
292
292
|
toolChoice,
|
|
293
293
|
onStepFinish: async (props) => {
|
|
294
|
-
|
|
294
|
+
await onStepFinish?.(props);
|
|
295
295
|
this.logger.debug("[LLM] - Stream Step Change:", {
|
|
296
296
|
text: props?.text,
|
|
297
297
|
toolCalls: props?.toolCalls,
|
|
@@ -306,7 +306,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
306
306
|
}
|
|
307
307
|
},
|
|
308
308
|
onFinish: async (props) => {
|
|
309
|
-
|
|
309
|
+
await onFinish?.(props);
|
|
310
310
|
this.logger.debug("[LLM] - Stream Finished:", {
|
|
311
311
|
text: props?.text,
|
|
312
312
|
toolCalls: props?.toolCalls,
|
|
@@ -380,7 +380,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
380
380
|
maxSteps,
|
|
381
381
|
toolChoice,
|
|
382
382
|
onStepFinish: async (props) => {
|
|
383
|
-
|
|
383
|
+
await onStepFinish?.(props);
|
|
384
384
|
this.logger.debug("[LLM] - Stream Step Change:", {
|
|
385
385
|
text: props?.text,
|
|
386
386
|
toolCalls: props?.toolCalls,
|
|
@@ -397,7 +397,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
397
397
|
}
|
|
398
398
|
},
|
|
399
399
|
onFinish: async (props) => {
|
|
400
|
-
|
|
400
|
+
await onFinish?.(props);
|
|
401
401
|
this.logger.debug("[LLM] - Stream Finished:", {
|
|
402
402
|
text: props?.text,
|
|
403
403
|
toolCalls: props?.toolCalls,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InstrumentClass } from './chunk-BFNYQFG2.js';
|
|
2
|
-
import { MastraBase } from './chunk-
|
|
2
|
+
import { MastraBase } from './chunk-FI7R232B.js';
|
|
3
3
|
import { __decoratorStart, __decorateElement, __runInitializers } from './chunk-C6A6W6XS.js';
|
|
4
4
|
|
|
5
5
|
// src/tts/index.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkTMPFLJLG_cjs = require('./chunk-TMPFLJLG.cjs');
|
|
4
4
|
|
|
5
5
|
// src/deployer/index.ts
|
|
6
|
-
var MastraDeployer = class extends
|
|
6
|
+
var MastraDeployer = class extends chunkTMPFLJLG_cjs.MastraBundler {
|
|
7
7
|
constructor({ name }) {
|
|
8
8
|
super({ component: "DEPLOYER", name });
|
|
9
9
|
}
|