@mastra/core 0.10.4-alpha.3 → 0.10.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/dist/agent/index.cjs +4 -4
- package/dist/agent/index.d.cts +1 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +2 -2
- package/dist/{base-icHjkcs-.d.ts → base-CmIdgTSq.d.ts} +37 -31
- package/dist/{base-Bdc5hWla.d.cts → base-_mZ6e_qo.d.cts} +37 -31
- package/dist/chunk-2RZXEVWT.js +68 -0
- package/dist/{chunk-UFQERGWG.js → chunk-32XBQVNY.js} +117 -28
- package/dist/{chunk-TRJIWZKM.js → chunk-3SY7GRSA.js} +1 -1
- package/dist/{chunk-PUG7THT5.cjs → chunk-6EMFDXAQ.cjs} +4 -4
- package/dist/{chunk-36UICULV.js → chunk-6PQRSQZF.js} +35 -5
- package/dist/{chunk-VB4S54R3.cjs → chunk-7L56W43N.cjs} +118 -29
- package/dist/{chunk-62ZSDIUK.js → chunk-BMED2N3R.js} +1 -1
- package/dist/{chunk-I2KL5KMY.js → chunk-CMEK3A3W.js} +2 -2
- package/dist/{chunk-HGPLTKJA.cjs → chunk-D2ULEJL3.cjs} +2 -2
- package/dist/{chunk-AX6IHSGY.js → chunk-DPKEVI6Q.js} +1 -1
- package/dist/{chunk-ZKUUYDOQ.cjs → chunk-EFJIVMMM.cjs} +21 -21
- package/dist/{chunk-SI2ENZ3O.js → chunk-F2DBWJK3.js} +1 -1
- package/dist/{chunk-Z37B4W7B.js → chunk-HIQ3FPBN.js} +1 -1
- package/dist/{chunk-RO5VPM3P.cjs → chunk-HVI3SKIH.cjs} +278 -55
- package/dist/{chunk-GV6P24NY.cjs → chunk-ISRXIKDS.cjs} +4 -4
- package/dist/{chunk-QVROTSA5.cjs → chunk-J7MLMW6O.cjs} +2 -2
- package/dist/{chunk-PVGSY24V.js → chunk-LDNCERLU.js} +7 -0
- package/dist/{chunk-S6WRT7GI.cjs → chunk-LRMKKZ6M.cjs} +2 -2
- package/dist/{chunk-BBAQW23O.cjs → chunk-OLSQRA2V.cjs} +7 -0
- package/dist/chunk-Q65UGFQK.cjs +70 -0
- package/dist/{chunk-ZAXPU6F2.cjs → chunk-QQ3KHYKE.cjs} +35 -5
- package/dist/{chunk-ZWYZGIV3.cjs → chunk-QQT4XTOG.cjs} +279 -73
- package/dist/{chunk-XUODQRSL.cjs → chunk-TGK6JO2D.cjs} +3 -3
- package/dist/{chunk-JYLH5IY3.cjs → chunk-VRDDTY4O.cjs} +87 -16
- package/dist/{chunk-SWJKOFCU.js → chunk-VZDPK54I.js} +262 -56
- package/dist/{chunk-HFEELWJO.js → chunk-YDGX5LRI.js} +274 -51
- package/dist/{chunk-7UNDRBOU.js → chunk-YLCFUSJ4.js} +86 -15
- package/dist/{chunk-IZGRJXUQ.js → chunk-Z7SBZ7XB.js} +1 -1
- package/dist/error/index.cjs +5 -5
- package/dist/error/index.d.cts +7 -0
- package/dist/error/index.d.ts +7 -0
- package/dist/error/index.js +1 -1
- package/dist/eval/index.d.cts +1 -1
- package/dist/eval/index.d.ts +1 -1
- package/dist/index.cjs +48 -48
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -12
- package/dist/integration/index.d.cts +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/llm/index.d.cts +1 -1
- package/dist/llm/index.d.ts +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.cts +1 -1
- package/dist/mastra/index.d.ts +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.d.cts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.d.cts +1 -1
- package/dist/memory/index.d.ts +1 -1
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +11 -5
- package/dist/network/index.d.cts +1 -1
- package/dist/network/index.d.ts +1 -1
- package/dist/network/index.js +10 -4
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +1 -1
- package/dist/relevance/index.d.ts +1 -1
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.cjs +9 -3
- package/dist/server/index.d.cts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +8 -2
- package/dist/storage/index.cjs +12 -12
- package/dist/storage/index.d.cts +2 -2
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.js +4 -4
- package/dist/telemetry/index.cjs +7 -7
- package/dist/telemetry/index.d.cts +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/tools/index.d.cts +2 -2
- package/dist/tools/index.d.ts +2 -2
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.js +1 -1
- package/dist/utils.cjs +14 -14
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.js +1 -1
- package/dist/voice/index.cjs +4 -4
- package/dist/voice/index.d.cts +1 -1
- package/dist/voice/index.d.ts +1 -1
- package/dist/voice/index.js +1 -1
- package/dist/workflows/index.cjs +9 -9
- package/dist/workflows/index.d.cts +14 -7
- package/dist/workflows/index.d.ts +14 -7
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +22 -22
- package/dist/workflows/legacy/index.d.cts +2 -2
- package/dist/workflows/legacy/index.d.ts +2 -2
- package/dist/workflows/legacy/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-IM7CLVLZ.js +0 -43
- package/dist/chunk-LEK3J7YN.cjs +0 -45
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQQ3KHYKE_cjs = require('./chunk-QQ3KHYKE.cjs');
|
|
4
|
+
var chunkOLSQRA2V_cjs = require('./chunk-OLSQRA2V.cjs');
|
|
4
5
|
var chunkP3Q73CAW_cjs = require('./chunk-P3Q73CAW.cjs');
|
|
5
6
|
var chunkRWTSGWWL_cjs = require('./chunk-RWTSGWWL.cjs');
|
|
6
7
|
|
|
7
8
|
// src/voice/voice.ts
|
|
8
9
|
var _MastraVoice_decorators, _init, _a;
|
|
9
|
-
_MastraVoice_decorators = [
|
|
10
|
+
_MastraVoice_decorators = [chunkQQ3KHYKE_cjs.InstrumentClass({
|
|
10
11
|
prefix: "voice",
|
|
11
12
|
excludeMethods: ["__setTools", "__setLogger", "__setTelemetry", "#log"]
|
|
12
13
|
})];
|
|
@@ -154,7 +155,12 @@ var CompositeVoice = class extends exports.MastraVoice {
|
|
|
154
155
|
} else if (this.speakProvider) {
|
|
155
156
|
return this.speakProvider.speak(input, options);
|
|
156
157
|
}
|
|
157
|
-
throw new
|
|
158
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
159
|
+
id: "VOICE_COMPOSITE_NO_SPEAK_PROVIDER",
|
|
160
|
+
text: "No speak provider or realtime provider configured",
|
|
161
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
162
|
+
category: "USER" /* USER */
|
|
163
|
+
});
|
|
158
164
|
}
|
|
159
165
|
async listen(audioStream, options) {
|
|
160
166
|
if (this.realtimeProvider) {
|
|
@@ -162,7 +168,12 @@ var CompositeVoice = class extends exports.MastraVoice {
|
|
|
162
168
|
} else if (this.listenProvider) {
|
|
163
169
|
return await this.listenProvider.listen(audioStream, options);
|
|
164
170
|
}
|
|
165
|
-
throw new
|
|
171
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
172
|
+
id: "VOICE_COMPOSITE_NO_LISTEN_PROVIDER",
|
|
173
|
+
text: "No listen provider or realtime provider configured",
|
|
174
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
175
|
+
category: "USER" /* USER */
|
|
176
|
+
});
|
|
166
177
|
}
|
|
167
178
|
async getSpeakers() {
|
|
168
179
|
if (this.realtimeProvider) {
|
|
@@ -170,7 +181,12 @@ var CompositeVoice = class extends exports.MastraVoice {
|
|
|
170
181
|
} else if (this.speakProvider) {
|
|
171
182
|
return this.speakProvider.getSpeakers();
|
|
172
183
|
}
|
|
173
|
-
throw new
|
|
184
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
185
|
+
id: "VOICE_COMPOSITE_NO_SPEAKERS_PROVIDER",
|
|
186
|
+
text: "No speak provider or realtime provider configured",
|
|
187
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
188
|
+
category: "USER" /* USER */
|
|
189
|
+
});
|
|
174
190
|
}
|
|
175
191
|
async getListener() {
|
|
176
192
|
if (this.realtimeProvider) {
|
|
@@ -178,7 +194,12 @@ var CompositeVoice = class extends exports.MastraVoice {
|
|
|
178
194
|
} else if (this.listenProvider) {
|
|
179
195
|
return this.listenProvider.getListener();
|
|
180
196
|
}
|
|
181
|
-
throw new
|
|
197
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
198
|
+
id: "VOICE_COMPOSITE_NO_LISTENER_PROVIDER",
|
|
199
|
+
text: "No listener provider or realtime provider configured",
|
|
200
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
201
|
+
category: "USER" /* USER */
|
|
202
|
+
});
|
|
182
203
|
}
|
|
183
204
|
updateConfig(options) {
|
|
184
205
|
if (!this.realtimeProvider) {
|
|
@@ -192,7 +213,12 @@ var CompositeVoice = class extends exports.MastraVoice {
|
|
|
192
213
|
*/
|
|
193
214
|
connect(options) {
|
|
194
215
|
if (!this.realtimeProvider) {
|
|
195
|
-
throw new
|
|
216
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
217
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_CONNECT",
|
|
218
|
+
text: "No realtime provider configured",
|
|
219
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
220
|
+
category: "USER" /* USER */
|
|
221
|
+
});
|
|
196
222
|
}
|
|
197
223
|
return this.realtimeProvider.connect(options);
|
|
198
224
|
}
|
|
@@ -202,7 +228,12 @@ var CompositeVoice = class extends exports.MastraVoice {
|
|
|
202
228
|
*/
|
|
203
229
|
send(audioData) {
|
|
204
230
|
if (!this.realtimeProvider) {
|
|
205
|
-
throw new
|
|
231
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
232
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_SEND",
|
|
233
|
+
text: "No realtime provider configured",
|
|
234
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
235
|
+
category: "USER" /* USER */
|
|
236
|
+
});
|
|
206
237
|
}
|
|
207
238
|
return this.realtimeProvider.send(audioData);
|
|
208
239
|
}
|
|
@@ -211,7 +242,12 @@ var CompositeVoice = class extends exports.MastraVoice {
|
|
|
211
242
|
*/
|
|
212
243
|
answer(options) {
|
|
213
244
|
if (!this.realtimeProvider) {
|
|
214
|
-
throw new
|
|
245
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
246
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_ANSWER",
|
|
247
|
+
text: "No realtime provider configured",
|
|
248
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
249
|
+
category: "USER" /* USER */
|
|
250
|
+
});
|
|
215
251
|
}
|
|
216
252
|
return this.realtimeProvider.answer(options);
|
|
217
253
|
}
|
|
@@ -240,7 +276,12 @@ var CompositeVoice = class extends exports.MastraVoice {
|
|
|
240
276
|
*/
|
|
241
277
|
close() {
|
|
242
278
|
if (!this.realtimeProvider) {
|
|
243
|
-
throw new
|
|
279
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
280
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_CLOSE",
|
|
281
|
+
text: "No realtime provider configured",
|
|
282
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
283
|
+
category: "USER" /* USER */
|
|
284
|
+
});
|
|
244
285
|
}
|
|
245
286
|
this.realtimeProvider.close();
|
|
246
287
|
}
|
|
@@ -251,7 +292,12 @@ var CompositeVoice = class extends exports.MastraVoice {
|
|
|
251
292
|
*/
|
|
252
293
|
on(event, callback) {
|
|
253
294
|
if (!this.realtimeProvider) {
|
|
254
|
-
throw new
|
|
295
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
296
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_ON",
|
|
297
|
+
text: "No realtime provider configured",
|
|
298
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
299
|
+
category: "USER" /* USER */
|
|
300
|
+
});
|
|
255
301
|
}
|
|
256
302
|
this.realtimeProvider.on(event, callback);
|
|
257
303
|
}
|
|
@@ -262,7 +308,12 @@ var CompositeVoice = class extends exports.MastraVoice {
|
|
|
262
308
|
*/
|
|
263
309
|
off(event, callback) {
|
|
264
310
|
if (!this.realtimeProvider) {
|
|
265
|
-
throw new
|
|
311
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
312
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_OFF",
|
|
313
|
+
text: "No realtime provider configured",
|
|
314
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
315
|
+
category: "USER" /* USER */
|
|
316
|
+
});
|
|
266
317
|
}
|
|
267
318
|
this.realtimeProvider.off(event, callback);
|
|
268
319
|
}
|
|
@@ -274,16 +325,36 @@ var DefaultVoice = class extends exports.MastraVoice {
|
|
|
274
325
|
super();
|
|
275
326
|
}
|
|
276
327
|
async speak(_input) {
|
|
277
|
-
throw new
|
|
328
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
329
|
+
id: "VOICE_DEFAULT_NO_SPEAK_PROVIDER",
|
|
330
|
+
text: "No voice provider configured",
|
|
331
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
332
|
+
category: "USER" /* USER */
|
|
333
|
+
});
|
|
278
334
|
}
|
|
279
335
|
async listen(_input) {
|
|
280
|
-
throw new
|
|
336
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
337
|
+
id: "VOICE_DEFAULT_NO_LISTEN_PROVIDER",
|
|
338
|
+
text: "No voice provider configured",
|
|
339
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
340
|
+
category: "USER" /* USER */
|
|
341
|
+
});
|
|
281
342
|
}
|
|
282
343
|
async getSpeakers() {
|
|
283
|
-
throw new
|
|
344
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
345
|
+
id: "VOICE_DEFAULT_NO_SPEAKERS_PROVIDER",
|
|
346
|
+
text: "No voice provider configured",
|
|
347
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
348
|
+
category: "USER" /* USER */
|
|
349
|
+
});
|
|
284
350
|
}
|
|
285
351
|
async getListener() {
|
|
286
|
-
throw new
|
|
352
|
+
throw new chunkOLSQRA2V_cjs.MastraError({
|
|
353
|
+
id: "VOICE_DEFAULT_NO_LISTENER_PROVIDER",
|
|
354
|
+
text: "No voice provider configured",
|
|
355
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
356
|
+
category: "USER" /* USER */
|
|
357
|
+
});
|
|
287
358
|
}
|
|
288
359
|
};
|
|
289
360
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { DefaultVoice } from './chunk-
|
|
2
|
-
import { MessageList } from './chunk-
|
|
1
|
+
import { DefaultVoice } from './chunk-YLCFUSJ4.js';
|
|
2
|
+
import { MessageList } from './chunk-DPKEVI6Q.js';
|
|
3
3
|
import { executeHook } from './chunk-BB4KXGBU.js';
|
|
4
|
-
import { MastraLLM } from './chunk-
|
|
5
|
-
import { InstrumentClass } from './chunk-
|
|
6
|
-
import { ensureToolProperties, makeCoreTool, createMastraProxy } from './chunk-
|
|
4
|
+
import { MastraLLM } from './chunk-YDGX5LRI.js';
|
|
5
|
+
import { InstrumentClass } from './chunk-6PQRSQZF.js';
|
|
6
|
+
import { ensureToolProperties, makeCoreTool, createMastraProxy } from './chunk-3SY7GRSA.js';
|
|
7
|
+
import { MastraError } from './chunk-LDNCERLU.js';
|
|
7
8
|
import { MastraBase } from './chunk-5IEKR756.js';
|
|
8
9
|
import { RegisteredLogger } from './chunk-5YDTZN2X.js';
|
|
9
10
|
import { RuntimeContext } from './chunk-SGGPJWRQ.js';
|
|
@@ -89,7 +90,18 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
89
90
|
this.#instructions = config.instructions;
|
|
90
91
|
this.#description = config.description;
|
|
91
92
|
if (!config.model) {
|
|
92
|
-
|
|
93
|
+
const mastraError = new MastraError({
|
|
94
|
+
id: "AGENT_CONSTRUCTOR_MODEL_REQUIRED",
|
|
95
|
+
domain: "AGENT" /* AGENT */,
|
|
96
|
+
category: "USER" /* USER */,
|
|
97
|
+
details: {
|
|
98
|
+
agentName: config.name
|
|
99
|
+
},
|
|
100
|
+
text: `LanguageModel is required to create an Agent. Please provide the 'model'.`
|
|
101
|
+
});
|
|
102
|
+
this.logger.trackException(mastraError);
|
|
103
|
+
this.logger.error(mastraError.toString());
|
|
104
|
+
throw mastraError;
|
|
93
105
|
}
|
|
94
106
|
this.model = config.model;
|
|
95
107
|
if (config.workflows) {
|
|
@@ -145,7 +157,18 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
145
157
|
}
|
|
146
158
|
get voice() {
|
|
147
159
|
if (typeof this.#instructions === "function") {
|
|
148
|
-
|
|
160
|
+
const mastraError = new MastraError({
|
|
161
|
+
id: "AGENT_VOICE_INCOMPATIBLE_WITH_FUNCTION_INSTRUCTIONS",
|
|
162
|
+
domain: "AGENT" /* AGENT */,
|
|
163
|
+
category: "USER" /* USER */,
|
|
164
|
+
details: {
|
|
165
|
+
agentName: this.name
|
|
166
|
+
},
|
|
167
|
+
text: "Voice is not compatible when instructions are a function. Please use getVoice() instead."
|
|
168
|
+
});
|
|
169
|
+
this.logger.trackException(mastraError);
|
|
170
|
+
this.logger.error(mastraError.toString());
|
|
171
|
+
throw mastraError;
|
|
149
172
|
}
|
|
150
173
|
return this.#voice;
|
|
151
174
|
}
|
|
@@ -186,7 +209,18 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
186
209
|
get instructions() {
|
|
187
210
|
this.logger.warn("The instructions property is deprecated. Please use getInstructions() instead.");
|
|
188
211
|
if (typeof this.#instructions === "function") {
|
|
189
|
-
|
|
212
|
+
const mastraError = new MastraError({
|
|
213
|
+
id: "AGENT_INSTRUCTIONS_INCOMPATIBLE_WITH_FUNCTION_INSTRUCTIONS",
|
|
214
|
+
domain: "AGENT" /* AGENT */,
|
|
215
|
+
category: "USER" /* USER */,
|
|
216
|
+
details: {
|
|
217
|
+
agentName: this.name
|
|
218
|
+
},
|
|
219
|
+
text: "Instructions are not compatible when instructions are a function. Please use getInstructions() instead."
|
|
220
|
+
});
|
|
221
|
+
this.logger.trackException(mastraError);
|
|
222
|
+
this.logger.error(mastraError.toString());
|
|
223
|
+
throw mastraError;
|
|
190
224
|
}
|
|
191
225
|
return this.#instructions;
|
|
192
226
|
}
|
|
@@ -201,8 +235,18 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
201
235
|
});
|
|
202
236
|
return resolveMaybePromise(result, instructions => {
|
|
203
237
|
if (!instructions) {
|
|
204
|
-
|
|
205
|
-
|
|
238
|
+
const mastraError = new MastraError({
|
|
239
|
+
id: "AGENT_GET_INSTRUCTIONS_FUNCTION_EMPTY_RETURN",
|
|
240
|
+
domain: "AGENT" /* AGENT */,
|
|
241
|
+
category: "USER" /* USER */,
|
|
242
|
+
details: {
|
|
243
|
+
agentName: this.name
|
|
244
|
+
},
|
|
245
|
+
text: "Instructions are required to use an Agent. The function-based instructions returned an empty value."
|
|
246
|
+
});
|
|
247
|
+
this.logger.trackException(mastraError);
|
|
248
|
+
this.logger.error(mastraError.toString());
|
|
249
|
+
throw mastraError;
|
|
206
250
|
}
|
|
207
251
|
return instructions;
|
|
208
252
|
});
|
|
@@ -219,7 +263,18 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
219
263
|
get tools() {
|
|
220
264
|
this.logger.warn("The tools property is deprecated. Please use getTools() instead.");
|
|
221
265
|
if (typeof this.#tools === "function") {
|
|
222
|
-
|
|
266
|
+
const mastraError = new MastraError({
|
|
267
|
+
id: "AGENT_GET_TOOLS_FUNCTION_INCOMPATIBLE_WITH_TOOL_FUNCTION_TYPE",
|
|
268
|
+
domain: "AGENT" /* AGENT */,
|
|
269
|
+
category: "USER" /* USER */,
|
|
270
|
+
details: {
|
|
271
|
+
agentName: this.name
|
|
272
|
+
},
|
|
273
|
+
text: "Tools are not compatible when tools are a function. Please use getTools() instead."
|
|
274
|
+
});
|
|
275
|
+
this.logger.trackException(mastraError);
|
|
276
|
+
this.logger.error(mastraError.toString());
|
|
277
|
+
throw mastraError;
|
|
223
278
|
}
|
|
224
279
|
return ensureToolProperties(this.#tools);
|
|
225
280
|
}
|
|
@@ -234,8 +289,18 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
234
289
|
});
|
|
235
290
|
return resolveMaybePromise(result, tools => {
|
|
236
291
|
if (!tools) {
|
|
237
|
-
|
|
238
|
-
|
|
292
|
+
const mastraError = new MastraError({
|
|
293
|
+
id: "AGENT_GET_TOOLS_FUNCTION_EMPTY_RETURN",
|
|
294
|
+
domain: "AGENT" /* AGENT */,
|
|
295
|
+
category: "USER" /* USER */,
|
|
296
|
+
details: {
|
|
297
|
+
agentName: this.name
|
|
298
|
+
},
|
|
299
|
+
text: `[Agent:${this.name}] - Function-based tools returned empty value`
|
|
300
|
+
});
|
|
301
|
+
this.logger.trackException(mastraError);
|
|
302
|
+
this.logger.error(mastraError.toString());
|
|
303
|
+
throw mastraError;
|
|
239
304
|
}
|
|
240
305
|
return ensureToolProperties(tools);
|
|
241
306
|
});
|
|
@@ -243,7 +308,18 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
243
308
|
get llm() {
|
|
244
309
|
this.logger.warn("The llm property is deprecated. Please use getLLM() instead.");
|
|
245
310
|
if (typeof this.model === "function") {
|
|
246
|
-
|
|
311
|
+
const mastraError = new MastraError({
|
|
312
|
+
id: "AGENT_LLM_GETTER_INCOMPATIBLE_WITH_FUNCTION_MODEL",
|
|
313
|
+
domain: "AGENT" /* AGENT */,
|
|
314
|
+
category: "USER" /* USER */,
|
|
315
|
+
details: {
|
|
316
|
+
agentName: this.name
|
|
317
|
+
},
|
|
318
|
+
text: "LLM is not compatible when model is a function. Please use getLLM() instead."
|
|
319
|
+
});
|
|
320
|
+
this.logger.trackException(mastraError);
|
|
321
|
+
this.logger.error(mastraError.toString());
|
|
322
|
+
throw mastraError;
|
|
247
323
|
}
|
|
248
324
|
return this.getLLM();
|
|
249
325
|
}
|
|
@@ -282,8 +358,18 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
282
358
|
} = {}) {
|
|
283
359
|
if (typeof this.model !== "function") {
|
|
284
360
|
if (!this.model) {
|
|
285
|
-
|
|
286
|
-
|
|
361
|
+
const mastraError = new MastraError({
|
|
362
|
+
id: "AGENT_GET_MODEL_MISSING_MODEL_INSTANCE",
|
|
363
|
+
domain: "AGENT" /* AGENT */,
|
|
364
|
+
category: "USER" /* USER */,
|
|
365
|
+
details: {
|
|
366
|
+
agentName: this.name
|
|
367
|
+
},
|
|
368
|
+
text: `[Agent:${this.name}] - No model provided`
|
|
369
|
+
});
|
|
370
|
+
this.logger.trackException(mastraError);
|
|
371
|
+
this.logger.error(mastraError.toString());
|
|
372
|
+
throw mastraError;
|
|
287
373
|
}
|
|
288
374
|
return this.model;
|
|
289
375
|
}
|
|
@@ -292,8 +378,18 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
292
378
|
});
|
|
293
379
|
return resolveMaybePromise(result, model => {
|
|
294
380
|
if (!model) {
|
|
295
|
-
|
|
296
|
-
|
|
381
|
+
const mastraError = new MastraError({
|
|
382
|
+
id: "AGENT_GET_MODEL_FUNCTION_EMPTY_RETURN",
|
|
383
|
+
domain: "AGENT" /* AGENT */,
|
|
384
|
+
category: "USER" /* USER */,
|
|
385
|
+
details: {
|
|
386
|
+
agentName: this.name
|
|
387
|
+
},
|
|
388
|
+
text: `[Agent:${this.name}] - Function-based model returned empty value`
|
|
389
|
+
});
|
|
390
|
+
this.logger.trackException(mastraError);
|
|
391
|
+
this.logger.error(mastraError.toString());
|
|
392
|
+
throw mastraError;
|
|
297
393
|
}
|
|
298
394
|
return model;
|
|
299
395
|
});
|
|
@@ -480,13 +576,21 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
480
576
|
runtimeContext
|
|
481
577
|
}, options) ?? void 0;
|
|
482
578
|
} catch (err) {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
579
|
+
const mastraError = new MastraError({
|
|
580
|
+
id: "AGENT_MEMORY_TOOL_EXECUTION_FAILED",
|
|
581
|
+
domain: "AGENT" /* AGENT */,
|
|
582
|
+
category: "USER" /* USER */,
|
|
583
|
+
details: {
|
|
584
|
+
agentName: this.name,
|
|
585
|
+
runId: runId || "",
|
|
586
|
+
threadId: threadId || "",
|
|
587
|
+
resourceId: resourceId || ""
|
|
588
|
+
},
|
|
589
|
+
text: `[Agent:${this.name}] - Failed memory tool execution`
|
|
590
|
+
}, err);
|
|
591
|
+
this.logger.trackException(mastraError);
|
|
592
|
+
this.logger.error(mastraError.toString());
|
|
593
|
+
throw mastraError;
|
|
490
594
|
}
|
|
491
595
|
} : void 0
|
|
492
596
|
}];
|
|
@@ -653,13 +757,21 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
653
757
|
});
|
|
654
758
|
return result;
|
|
655
759
|
} catch (err) {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
760
|
+
const mastraError = new MastraError({
|
|
761
|
+
id: "AGENT_WORKFLOW_TOOL_EXECUTION_FAILED",
|
|
762
|
+
domain: "AGENT" /* AGENT */,
|
|
763
|
+
category: "USER" /* USER */,
|
|
764
|
+
details: {
|
|
765
|
+
agentName: this.name,
|
|
766
|
+
runId: runId || "",
|
|
767
|
+
threadId: threadId || "",
|
|
768
|
+
resourceId: resourceId || ""
|
|
769
|
+
},
|
|
770
|
+
text: `[Agent:${this.name}] - Failed workflow tool execution`
|
|
771
|
+
}, err);
|
|
772
|
+
this.logger.trackException(mastraError);
|
|
773
|
+
this.logger.error(mastraError.toString());
|
|
774
|
+
throw mastraError;
|
|
663
775
|
}
|
|
664
776
|
}
|
|
665
777
|
};
|
|
@@ -786,7 +898,20 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
786
898
|
};
|
|
787
899
|
}
|
|
788
900
|
if (!threadId || !resourceId) {
|
|
789
|
-
|
|
901
|
+
const mastraError = new MastraError({
|
|
902
|
+
id: "AGENT_MEMORY_MISSING_RESOURCE_ID",
|
|
903
|
+
domain: "AGENT" /* AGENT */,
|
|
904
|
+
category: "USER" /* USER */,
|
|
905
|
+
details: {
|
|
906
|
+
agentName: this.name,
|
|
907
|
+
threadId: threadId || "",
|
|
908
|
+
resourceId: resourceId || ""
|
|
909
|
+
},
|
|
910
|
+
text: `A resourceId must be provided when passing a threadId and using Memory. Saw threadId ${threadId} but resourceId is ${resourceId}`
|
|
911
|
+
});
|
|
912
|
+
this.logger.trackException(mastraError);
|
|
913
|
+
this.logger.error(mastraError.toString());
|
|
914
|
+
throw mastraError;
|
|
790
915
|
}
|
|
791
916
|
const store = memory.constructor.name;
|
|
792
917
|
this.logger.debug(`[Agent:${this.name}] - Memory persistence enabled: store=${store}, resourceId=${resourceId}`, {
|
|
@@ -934,14 +1059,23 @@ ${JSON.stringify(
|
|
|
934
1059
|
memoryConfig: memoryConfig2
|
|
935
1060
|
});
|
|
936
1061
|
} catch (e) {
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1062
|
+
if (e instanceof MastraError) {
|
|
1063
|
+
throw e;
|
|
1064
|
+
}
|
|
1065
|
+
const mastraError = new MastraError({
|
|
1066
|
+
id: "AGENT_MEMORY_PERSIST_RESPONSE_MESSAGES_FAILED",
|
|
1067
|
+
domain: "AGENT" /* AGENT */,
|
|
1068
|
+
category: "SYSTEM" /* SYSTEM */,
|
|
1069
|
+
details: {
|
|
1070
|
+
agentName: this.name,
|
|
1071
|
+
runId: runId2 || "",
|
|
1072
|
+
threadId: threadId2 || "",
|
|
1073
|
+
result: JSON.stringify(resToLog)
|
|
1074
|
+
}
|
|
1075
|
+
}, e);
|
|
1076
|
+
this.logger.trackException(mastraError);
|
|
1077
|
+
this.logger.error(mastraError.toString());
|
|
1078
|
+
throw mastraError;
|
|
945
1079
|
}
|
|
946
1080
|
}
|
|
947
1081
|
if (Object.keys(this.evals || {}).length > 0) {
|
|
@@ -1280,16 +1414,40 @@ ${JSON.stringify(
|
|
|
1280
1414
|
*/
|
|
1281
1415
|
async speak(input, options) {
|
|
1282
1416
|
if (!this.voice) {
|
|
1283
|
-
|
|
1417
|
+
const mastraError = new MastraError({
|
|
1418
|
+
id: "AGENT_SPEAK_METHOD_VOICE_NOT_CONFIGURED",
|
|
1419
|
+
domain: "AGENT" /* AGENT */,
|
|
1420
|
+
category: "USER" /* USER */,
|
|
1421
|
+
details: {
|
|
1422
|
+
agentName: this.name
|
|
1423
|
+
},
|
|
1424
|
+
text: "No voice provider configured"
|
|
1425
|
+
});
|
|
1426
|
+
this.logger.trackException(mastraError);
|
|
1427
|
+
this.logger.error(mastraError.toString());
|
|
1428
|
+
throw mastraError;
|
|
1284
1429
|
}
|
|
1285
1430
|
this.logger.warn("Warning: agent.speak() is deprecated. Please use agent.voice.speak() instead.");
|
|
1286
1431
|
try {
|
|
1287
1432
|
return this.voice.speak(input, options);
|
|
1288
1433
|
} catch (e) {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1434
|
+
let err;
|
|
1435
|
+
if (e instanceof MastraError) {
|
|
1436
|
+
err = e;
|
|
1437
|
+
} else {
|
|
1438
|
+
err = new MastraError({
|
|
1439
|
+
id: "AGENT_SPEAK_METHOD_ERROR",
|
|
1440
|
+
domain: "AGENT" /* AGENT */,
|
|
1441
|
+
category: "UNKNOWN" /* UNKNOWN */,
|
|
1442
|
+
details: {
|
|
1443
|
+
agentName: this.name
|
|
1444
|
+
},
|
|
1445
|
+
text: "Error during agent speak"
|
|
1446
|
+
}, e);
|
|
1447
|
+
}
|
|
1448
|
+
this.logger.trackException(err);
|
|
1449
|
+
this.logger.error(err.toString());
|
|
1450
|
+
throw err;
|
|
1293
1451
|
}
|
|
1294
1452
|
}
|
|
1295
1453
|
/**
|
|
@@ -1301,16 +1459,40 @@ ${JSON.stringify(
|
|
|
1301
1459
|
*/
|
|
1302
1460
|
async listen(audioStream, options) {
|
|
1303
1461
|
if (!this.voice) {
|
|
1304
|
-
|
|
1462
|
+
const mastraError = new MastraError({
|
|
1463
|
+
id: "AGENT_LISTEN_METHOD_VOICE_NOT_CONFIGURED",
|
|
1464
|
+
domain: "AGENT" /* AGENT */,
|
|
1465
|
+
category: "USER" /* USER */,
|
|
1466
|
+
details: {
|
|
1467
|
+
agentName: this.name
|
|
1468
|
+
},
|
|
1469
|
+
text: "No voice provider configured"
|
|
1470
|
+
});
|
|
1471
|
+
this.logger.trackException(mastraError);
|
|
1472
|
+
this.logger.error(mastraError.toString());
|
|
1473
|
+
throw mastraError;
|
|
1305
1474
|
}
|
|
1306
1475
|
this.logger.warn("Warning: agent.listen() is deprecated. Please use agent.voice.listen() instead");
|
|
1307
1476
|
try {
|
|
1308
1477
|
return this.voice.listen(audioStream, options);
|
|
1309
1478
|
} catch (e) {
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1479
|
+
let err;
|
|
1480
|
+
if (e instanceof MastraError) {
|
|
1481
|
+
err = e;
|
|
1482
|
+
} else {
|
|
1483
|
+
err = new MastraError({
|
|
1484
|
+
id: "AGENT_LISTEN_METHOD_ERROR",
|
|
1485
|
+
domain: "AGENT" /* AGENT */,
|
|
1486
|
+
category: "UNKNOWN" /* UNKNOWN */,
|
|
1487
|
+
details: {
|
|
1488
|
+
agentName: this.name
|
|
1489
|
+
},
|
|
1490
|
+
text: "Error during agent listen"
|
|
1491
|
+
}, e);
|
|
1492
|
+
}
|
|
1493
|
+
this.logger.trackException(err);
|
|
1494
|
+
this.logger.error(err.toString());
|
|
1495
|
+
throw err;
|
|
1314
1496
|
}
|
|
1315
1497
|
}
|
|
1316
1498
|
/**
|
|
@@ -1321,16 +1503,40 @@ ${JSON.stringify(
|
|
|
1321
1503
|
*/
|
|
1322
1504
|
async getSpeakers() {
|
|
1323
1505
|
if (!this.voice) {
|
|
1324
|
-
|
|
1506
|
+
const mastraError = new MastraError({
|
|
1507
|
+
id: "AGENT_SPEAKERS_METHOD_VOICE_NOT_CONFIGURED",
|
|
1508
|
+
domain: "AGENT" /* AGENT */,
|
|
1509
|
+
category: "USER" /* USER */,
|
|
1510
|
+
details: {
|
|
1511
|
+
agentName: this.name
|
|
1512
|
+
},
|
|
1513
|
+
text: "No voice provider configured"
|
|
1514
|
+
});
|
|
1515
|
+
this.logger.trackException(mastraError);
|
|
1516
|
+
this.logger.error(mastraError.toString());
|
|
1517
|
+
throw mastraError;
|
|
1325
1518
|
}
|
|
1326
1519
|
this.logger.warn("Warning: agent.getSpeakers() is deprecated. Please use agent.voice.getSpeakers() instead.");
|
|
1327
1520
|
try {
|
|
1328
1521
|
return await this.voice.getSpeakers();
|
|
1329
1522
|
} catch (e) {
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1523
|
+
let err;
|
|
1524
|
+
if (e instanceof MastraError) {
|
|
1525
|
+
err = e;
|
|
1526
|
+
} else {
|
|
1527
|
+
err = new MastraError({
|
|
1528
|
+
id: "AGENT_GET_SPEAKERS_METHOD_ERROR",
|
|
1529
|
+
domain: "AGENT" /* AGENT */,
|
|
1530
|
+
category: "UNKNOWN" /* UNKNOWN */,
|
|
1531
|
+
details: {
|
|
1532
|
+
agentName: this.name
|
|
1533
|
+
},
|
|
1534
|
+
text: "Error during agent getSpeakers"
|
|
1535
|
+
}, e);
|
|
1536
|
+
}
|
|
1537
|
+
this.logger.trackException(err);
|
|
1538
|
+
this.logger.error(err.toString());
|
|
1539
|
+
throw err;
|
|
1334
1540
|
}
|
|
1335
1541
|
}
|
|
1336
1542
|
toStep() {
|