@mastra/core 0.10.4 → 0.10.6-alpha.0
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-DF29Fhcx.d.ts} +75 -41
- package/dist/{base-Bdc5hWla.d.cts → base-vDxe4rcD.d.cts} +75 -41
- package/dist/chunk-2RZXEVWT.js +68 -0
- 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-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-IZGRJXUQ.js → chunk-DNK4SXPA.js} +2 -1
- package/dist/{chunk-AX6IHSGY.js → chunk-DPKEVI6Q.js} +1 -1
- package/dist/{chunk-ZKUUYDOQ.cjs → chunk-EFJIVMMM.cjs} +21 -21
- package/dist/{chunk-VB4S54R3.cjs → chunk-EXOTT52R.cjs} +198 -30
- package/dist/{chunk-SI2ENZ3O.js → chunk-F2DBWJK3.js} +1 -1
- package/dist/{chunk-GV6P24NY.cjs → chunk-F5XU7FFR.cjs} +5 -4
- package/dist/{chunk-Z37B4W7B.js → chunk-HIQ3FPBN.js} +1 -1
- package/dist/{chunk-RO5VPM3P.cjs → chunk-HVI3SKIH.cjs} +278 -55
- 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-UFQERGWG.js → chunk-U3F3AQJP.js} +197 -29
- 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/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 +4 -4
- package/dist/index.d.ts +4 -4
- 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 +18 -7
- package/dist/workflows/index.d.ts +18 -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 +24 -24
- package/dist/chunk-IM7CLVLZ.js +0 -43
- package/dist/chunk-LEK3J7YN.cjs +0 -45
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { delay } from './chunk-
|
|
1
|
+
import { delay } from './chunk-3SY7GRSA.js';
|
|
2
|
+
import { MastraError } from './chunk-LDNCERLU.js';
|
|
2
3
|
import { MastraBase } from './chunk-5IEKR756.js';
|
|
3
4
|
import { RegisteredLogger } from './chunk-5YDTZN2X.js';
|
|
4
5
|
import { OpenAIReasoningSchemaCompatLayer, OpenAISchemaCompatLayer, GoogleSchemaCompatLayer, AnthropicSchemaCompatLayer, DeepSeekSchemaCompatLayer, MetaSchemaCompatLayer, applyCompatLayer } from '@mastra/schema-compat';
|
|
@@ -169,7 +170,31 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
169
170
|
toolChoice,
|
|
170
171
|
maxSteps,
|
|
171
172
|
onStepFinish: async (props) => {
|
|
172
|
-
|
|
173
|
+
try {
|
|
174
|
+
await onStepFinish?.(props);
|
|
175
|
+
} catch (e) {
|
|
176
|
+
const mastraError = new MastraError(
|
|
177
|
+
{
|
|
178
|
+
id: "LLM_TEXT_ON_STEP_FINISH_CALLBACK_EXECUTION_FAILED",
|
|
179
|
+
domain: "LLM" /* LLM */,
|
|
180
|
+
category: "USER" /* USER */,
|
|
181
|
+
details: {
|
|
182
|
+
modelId: model.modelId,
|
|
183
|
+
modelProvider: model.provider,
|
|
184
|
+
runId: runId ?? "unknown",
|
|
185
|
+
threadId: threadId ?? "unknown",
|
|
186
|
+
resourceId: resourceId ?? "unknown",
|
|
187
|
+
finishReason: props?.finishReason,
|
|
188
|
+
toolCalls: props?.toolCalls ? JSON.stringify(props.toolCalls) : "",
|
|
189
|
+
toolResults: props?.toolResults ? JSON.stringify(props.toolResults) : "",
|
|
190
|
+
usage: props?.usage ? JSON.stringify(props.usage) : ""
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
e
|
|
194
|
+
);
|
|
195
|
+
this.logger.trackException(mastraError);
|
|
196
|
+
throw mastraError;
|
|
197
|
+
}
|
|
173
198
|
this.logger.debug("[LLM] - Step Change:", {
|
|
174
199
|
text: props?.text,
|
|
175
200
|
toolCalls: props?.toolCalls,
|
|
@@ -199,17 +224,37 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
199
224
|
schema = jsonSchema(experimental_output);
|
|
200
225
|
}
|
|
201
226
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
schema
|
|
211
|
-
|
|
212
|
-
|
|
227
|
+
try {
|
|
228
|
+
return await generateText({
|
|
229
|
+
messages,
|
|
230
|
+
...argsForExecute,
|
|
231
|
+
experimental_telemetry: {
|
|
232
|
+
...this.experimental_telemetry,
|
|
233
|
+
...telemetry
|
|
234
|
+
},
|
|
235
|
+
experimental_output: schema ? Output.object({
|
|
236
|
+
schema
|
|
237
|
+
}) : void 0
|
|
238
|
+
});
|
|
239
|
+
} catch (e) {
|
|
240
|
+
const mastraError = new MastraError(
|
|
241
|
+
{
|
|
242
|
+
id: "LLM_GENERATE_TEXT_AI_SDK_EXECUTION_FAILED",
|
|
243
|
+
domain: "LLM" /* LLM */,
|
|
244
|
+
category: "THIRD_PARTY" /* THIRD_PARTY */,
|
|
245
|
+
details: {
|
|
246
|
+
modelId: model.modelId,
|
|
247
|
+
modelProvider: model.provider,
|
|
248
|
+
runId: runId ?? "unknown",
|
|
249
|
+
threadId: threadId ?? "unknown",
|
|
250
|
+
resourceId: resourceId ?? "unknown"
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
e
|
|
254
|
+
);
|
|
255
|
+
this.logger.trackException(mastraError);
|
|
256
|
+
throw mastraError;
|
|
257
|
+
}
|
|
213
258
|
}
|
|
214
259
|
async __textObject({
|
|
215
260
|
messages,
|
|
@@ -238,7 +283,29 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
238
283
|
maxSteps,
|
|
239
284
|
toolChoice,
|
|
240
285
|
onStepFinish: async (props) => {
|
|
241
|
-
|
|
286
|
+
try {
|
|
287
|
+
await onStepFinish?.(props);
|
|
288
|
+
} catch (e) {
|
|
289
|
+
const mastraError = new MastraError(
|
|
290
|
+
{
|
|
291
|
+
id: "LLM_TEXT_OBJECT_ON_STEP_FINISH_CALLBACK_EXECUTION_FAILED",
|
|
292
|
+
domain: "LLM" /* LLM */,
|
|
293
|
+
category: "USER" /* USER */,
|
|
294
|
+
details: {
|
|
295
|
+
runId: runId ?? "unknown",
|
|
296
|
+
threadId: threadId ?? "unknown",
|
|
297
|
+
resourceId: resourceId ?? "unknown",
|
|
298
|
+
finishReason: props?.finishReason,
|
|
299
|
+
toolCalls: props?.toolCalls ? JSON.stringify(props.toolCalls) : "",
|
|
300
|
+
toolResults: props?.toolResults ? JSON.stringify(props.toolResults) : "",
|
|
301
|
+
usage: props?.usage ? JSON.stringify(props.usage) : ""
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
e
|
|
305
|
+
);
|
|
306
|
+
this.logger.trackException(mastraError);
|
|
307
|
+
throw mastraError;
|
|
308
|
+
}
|
|
242
309
|
this.logger.debug("[LLM] - Step Change:", {
|
|
243
310
|
text: props?.text,
|
|
244
311
|
toolCalls: props?.toolCalls,
|
|
@@ -259,17 +326,37 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
259
326
|
output = "array";
|
|
260
327
|
structuredOutput = structuredOutput._def.type;
|
|
261
328
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
329
|
+
try {
|
|
330
|
+
const processedSchema = this._applySchemaCompat(structuredOutput);
|
|
331
|
+
return await generateObject({
|
|
332
|
+
messages,
|
|
333
|
+
...argsForExecute,
|
|
334
|
+
output,
|
|
335
|
+
schema: processedSchema,
|
|
336
|
+
experimental_telemetry: {
|
|
337
|
+
...this.experimental_telemetry,
|
|
338
|
+
...telemetry
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
} catch (e) {
|
|
342
|
+
const mastraError = new MastraError(
|
|
343
|
+
{
|
|
344
|
+
id: "LLM_GENERATE_OBJECT_AI_SDK_EXECUTION_FAILED",
|
|
345
|
+
domain: "LLM" /* LLM */,
|
|
346
|
+
category: "THIRD_PARTY" /* THIRD_PARTY */,
|
|
347
|
+
details: {
|
|
348
|
+
modelId: model.modelId,
|
|
349
|
+
modelProvider: model.provider,
|
|
350
|
+
runId: runId ?? "unknown",
|
|
351
|
+
threadId: threadId ?? "unknown",
|
|
352
|
+
resourceId: resourceId ?? "unknown"
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
e
|
|
356
|
+
);
|
|
357
|
+
this.logger.trackException(mastraError);
|
|
358
|
+
throw mastraError;
|
|
359
|
+
}
|
|
273
360
|
}
|
|
274
361
|
async __stream({
|
|
275
362
|
messages,
|
|
@@ -306,7 +393,31 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
306
393
|
maxSteps,
|
|
307
394
|
toolChoice,
|
|
308
395
|
onStepFinish: async (props) => {
|
|
309
|
-
|
|
396
|
+
try {
|
|
397
|
+
await onStepFinish?.(props);
|
|
398
|
+
} catch (e) {
|
|
399
|
+
const mastraError = new MastraError(
|
|
400
|
+
{
|
|
401
|
+
id: "LLM_STREAM_ON_STEP_FINISH_CALLBACK_EXECUTION_FAILED",
|
|
402
|
+
domain: "LLM" /* LLM */,
|
|
403
|
+
category: "USER" /* USER */,
|
|
404
|
+
details: {
|
|
405
|
+
modelId: model.modelId,
|
|
406
|
+
modelProvider: model.provider,
|
|
407
|
+
runId: runId ?? "unknown",
|
|
408
|
+
threadId: threadId ?? "unknown",
|
|
409
|
+
resourceId: resourceId ?? "unknown",
|
|
410
|
+
finishReason: props?.finishReason,
|
|
411
|
+
toolCalls: props?.toolCalls ? JSON.stringify(props.toolCalls) : "",
|
|
412
|
+
toolResults: props?.toolResults ? JSON.stringify(props.toolResults) : "",
|
|
413
|
+
usage: props?.usage ? JSON.stringify(props.usage) : ""
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
e
|
|
417
|
+
);
|
|
418
|
+
this.logger.trackException(mastraError);
|
|
419
|
+
throw mastraError;
|
|
420
|
+
}
|
|
310
421
|
this.logger.debug("[LLM] - Stream Step Change:", {
|
|
311
422
|
text: props?.text,
|
|
312
423
|
toolCalls: props?.toolCalls,
|
|
@@ -321,7 +432,31 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
321
432
|
}
|
|
322
433
|
},
|
|
323
434
|
onFinish: async (props) => {
|
|
324
|
-
|
|
435
|
+
try {
|
|
436
|
+
await onFinish?.(props);
|
|
437
|
+
} catch (e) {
|
|
438
|
+
const mastraError = new MastraError(
|
|
439
|
+
{
|
|
440
|
+
id: "LLM_STREAM_ON_FINISH_CALLBACK_EXECUTION_FAILED",
|
|
441
|
+
domain: "LLM" /* LLM */,
|
|
442
|
+
category: "USER" /* USER */,
|
|
443
|
+
details: {
|
|
444
|
+
modelId: model.modelId,
|
|
445
|
+
modelProvider: model.provider,
|
|
446
|
+
runId: runId ?? "unknown",
|
|
447
|
+
threadId: threadId ?? "unknown",
|
|
448
|
+
resourceId: resourceId ?? "unknown",
|
|
449
|
+
finishReason: props?.finishReason,
|
|
450
|
+
toolCalls: props?.toolCalls ? JSON.stringify(props.toolCalls) : "",
|
|
451
|
+
toolResults: props?.toolResults ? JSON.stringify(props.toolResults) : "",
|
|
452
|
+
usage: props?.usage ? JSON.stringify(props.usage) : ""
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
e
|
|
456
|
+
);
|
|
457
|
+
this.logger.trackException(mastraError);
|
|
458
|
+
throw mastraError;
|
|
459
|
+
}
|
|
325
460
|
this.logger.debug("[LLM] - Stream Finished:", {
|
|
326
461
|
text: props?.text,
|
|
327
462
|
toolCalls: props?.toolCalls,
|
|
@@ -349,17 +484,37 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
349
484
|
schema = jsonSchema(experimental_output);
|
|
350
485
|
}
|
|
351
486
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
schema
|
|
361
|
-
|
|
362
|
-
|
|
487
|
+
try {
|
|
488
|
+
return await streamText({
|
|
489
|
+
messages,
|
|
490
|
+
...argsForExecute,
|
|
491
|
+
experimental_telemetry: {
|
|
492
|
+
...this.experimental_telemetry,
|
|
493
|
+
...telemetry
|
|
494
|
+
},
|
|
495
|
+
experimental_output: schema ? Output.object({
|
|
496
|
+
schema
|
|
497
|
+
}) : void 0
|
|
498
|
+
});
|
|
499
|
+
} catch (e) {
|
|
500
|
+
const mastraError = new MastraError(
|
|
501
|
+
{
|
|
502
|
+
id: "LLM_STREAM_TEXT_AI_SDK_EXECUTION_FAILED",
|
|
503
|
+
domain: "LLM" /* LLM */,
|
|
504
|
+
category: "THIRD_PARTY" /* THIRD_PARTY */,
|
|
505
|
+
details: {
|
|
506
|
+
modelId: model.modelId,
|
|
507
|
+
modelProvider: model.provider,
|
|
508
|
+
runId: runId ?? "unknown",
|
|
509
|
+
threadId: threadId ?? "unknown",
|
|
510
|
+
resourceId: resourceId ?? "unknown"
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
e
|
|
514
|
+
);
|
|
515
|
+
this.logger.trackException(mastraError);
|
|
516
|
+
throw mastraError;
|
|
517
|
+
}
|
|
363
518
|
}
|
|
364
519
|
async __streamObject({
|
|
365
520
|
messages,
|
|
@@ -395,7 +550,31 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
395
550
|
maxSteps,
|
|
396
551
|
toolChoice,
|
|
397
552
|
onStepFinish: async (props) => {
|
|
398
|
-
|
|
553
|
+
try {
|
|
554
|
+
await onStepFinish?.(props);
|
|
555
|
+
} catch (e) {
|
|
556
|
+
const mastraError = new MastraError(
|
|
557
|
+
{
|
|
558
|
+
id: "LLM_STREAM_OBJECT_ON_STEP_FINISH_CALLBACK_EXECUTION_FAILED",
|
|
559
|
+
domain: "LLM" /* LLM */,
|
|
560
|
+
category: "USER" /* USER */,
|
|
561
|
+
details: {
|
|
562
|
+
modelId: model.modelId,
|
|
563
|
+
modelProvider: model.provider,
|
|
564
|
+
runId: runId ?? "unknown",
|
|
565
|
+
threadId: threadId ?? "unknown",
|
|
566
|
+
resourceId: resourceId ?? "unknown",
|
|
567
|
+
usage: props?.usage ? JSON.stringify(props.usage) : "",
|
|
568
|
+
toolCalls: props?.toolCalls ? JSON.stringify(props.toolCalls) : "",
|
|
569
|
+
toolResults: props?.toolResults ? JSON.stringify(props.toolResults) : "",
|
|
570
|
+
finishReason: props?.finishReason
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
e
|
|
574
|
+
);
|
|
575
|
+
this.logger.trackException(mastraError);
|
|
576
|
+
throw mastraError;
|
|
577
|
+
}
|
|
399
578
|
this.logger.debug("[LLM] - Stream Step Change:", {
|
|
400
579
|
text: props?.text,
|
|
401
580
|
toolCalls: props?.toolCalls,
|
|
@@ -412,7 +591,31 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
412
591
|
}
|
|
413
592
|
},
|
|
414
593
|
onFinish: async (props) => {
|
|
415
|
-
|
|
594
|
+
try {
|
|
595
|
+
await onFinish?.(props);
|
|
596
|
+
} catch (e) {
|
|
597
|
+
const mastraError = new MastraError(
|
|
598
|
+
{
|
|
599
|
+
id: "LLM_STREAM_OBJECT_ON_FINISH_CALLBACK_EXECUTION_FAILED",
|
|
600
|
+
domain: "LLM" /* LLM */,
|
|
601
|
+
category: "USER" /* USER */,
|
|
602
|
+
details: {
|
|
603
|
+
modelId: model.modelId,
|
|
604
|
+
modelProvider: model.provider,
|
|
605
|
+
runId: runId ?? "unknown",
|
|
606
|
+
threadId: threadId ?? "unknown",
|
|
607
|
+
resourceId: resourceId ?? "unknown",
|
|
608
|
+
toolCalls: props?.toolCalls ? JSON.stringify(props.toolCalls) : "",
|
|
609
|
+
toolResults: props?.toolResults ? JSON.stringify(props.toolResults) : "",
|
|
610
|
+
finishReason: props?.finishReason,
|
|
611
|
+
usage: props?.usage ? JSON.stringify(props.usage) : ""
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
e
|
|
615
|
+
);
|
|
616
|
+
this.logger.trackException(mastraError);
|
|
617
|
+
throw mastraError;
|
|
618
|
+
}
|
|
416
619
|
this.logger.debug("[LLM] - Stream Finished:", {
|
|
417
620
|
text: props?.text,
|
|
418
621
|
toolCalls: props?.toolCalls,
|
|
@@ -431,17 +634,37 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
431
634
|
output = "array";
|
|
432
635
|
structuredOutput = structuredOutput._def.type;
|
|
433
636
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
637
|
+
try {
|
|
638
|
+
const processedSchema = this._applySchemaCompat(structuredOutput);
|
|
639
|
+
return streamObject({
|
|
640
|
+
messages,
|
|
641
|
+
...argsForExecute,
|
|
642
|
+
output,
|
|
643
|
+
schema: processedSchema,
|
|
644
|
+
experimental_telemetry: {
|
|
645
|
+
...this.experimental_telemetry,
|
|
646
|
+
...telemetry
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
} catch (e) {
|
|
650
|
+
const mastraError = new MastraError(
|
|
651
|
+
{
|
|
652
|
+
id: "LLM_STREAM_OBJECT_AI_SDK_EXECUTION_FAILED",
|
|
653
|
+
domain: "LLM" /* LLM */,
|
|
654
|
+
category: "THIRD_PARTY" /* THIRD_PARTY */,
|
|
655
|
+
details: {
|
|
656
|
+
modelId: model.modelId,
|
|
657
|
+
modelProvider: model.provider,
|
|
658
|
+
runId: runId ?? "unknown",
|
|
659
|
+
threadId: threadId ?? "unknown",
|
|
660
|
+
resourceId: resourceId ?? "unknown"
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
e
|
|
664
|
+
);
|
|
665
|
+
this.logger.trackException(mastraError);
|
|
666
|
+
throw mastraError;
|
|
667
|
+
}
|
|
445
668
|
}
|
|
446
669
|
async generate(messages, { maxSteps = 5, output, ...rest }) {
|
|
447
670
|
const msgs = this.convertToMessages(messages);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { InstrumentClass } from './chunk-
|
|
1
|
+
import { InstrumentClass } from './chunk-6PQRSQZF.js';
|
|
2
|
+
import { MastraError } from './chunk-LDNCERLU.js';
|
|
2
3
|
import { MastraBase } from './chunk-5IEKR756.js';
|
|
3
4
|
import { __decoratorStart, __decorateElement, __runInitializers } from './chunk-C6A6W6XS.js';
|
|
4
5
|
|
|
@@ -152,7 +153,12 @@ var CompositeVoice = class extends MastraVoice {
|
|
|
152
153
|
} else if (this.speakProvider) {
|
|
153
154
|
return this.speakProvider.speak(input, options);
|
|
154
155
|
}
|
|
155
|
-
throw new
|
|
156
|
+
throw new MastraError({
|
|
157
|
+
id: "VOICE_COMPOSITE_NO_SPEAK_PROVIDER",
|
|
158
|
+
text: "No speak provider or realtime provider configured",
|
|
159
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
160
|
+
category: "USER" /* USER */
|
|
161
|
+
});
|
|
156
162
|
}
|
|
157
163
|
async listen(audioStream, options) {
|
|
158
164
|
if (this.realtimeProvider) {
|
|
@@ -160,7 +166,12 @@ var CompositeVoice = class extends MastraVoice {
|
|
|
160
166
|
} else if (this.listenProvider) {
|
|
161
167
|
return await this.listenProvider.listen(audioStream, options);
|
|
162
168
|
}
|
|
163
|
-
throw new
|
|
169
|
+
throw new MastraError({
|
|
170
|
+
id: "VOICE_COMPOSITE_NO_LISTEN_PROVIDER",
|
|
171
|
+
text: "No listen provider or realtime provider configured",
|
|
172
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
173
|
+
category: "USER" /* USER */
|
|
174
|
+
});
|
|
164
175
|
}
|
|
165
176
|
async getSpeakers() {
|
|
166
177
|
if (this.realtimeProvider) {
|
|
@@ -168,7 +179,12 @@ var CompositeVoice = class extends MastraVoice {
|
|
|
168
179
|
} else if (this.speakProvider) {
|
|
169
180
|
return this.speakProvider.getSpeakers();
|
|
170
181
|
}
|
|
171
|
-
throw new
|
|
182
|
+
throw new MastraError({
|
|
183
|
+
id: "VOICE_COMPOSITE_NO_SPEAKERS_PROVIDER",
|
|
184
|
+
text: "No speak provider or realtime provider configured",
|
|
185
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
186
|
+
category: "USER" /* USER */
|
|
187
|
+
});
|
|
172
188
|
}
|
|
173
189
|
async getListener() {
|
|
174
190
|
if (this.realtimeProvider) {
|
|
@@ -176,7 +192,12 @@ var CompositeVoice = class extends MastraVoice {
|
|
|
176
192
|
} else if (this.listenProvider) {
|
|
177
193
|
return this.listenProvider.getListener();
|
|
178
194
|
}
|
|
179
|
-
throw new
|
|
195
|
+
throw new MastraError({
|
|
196
|
+
id: "VOICE_COMPOSITE_NO_LISTENER_PROVIDER",
|
|
197
|
+
text: "No listener provider or realtime provider configured",
|
|
198
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
199
|
+
category: "USER" /* USER */
|
|
200
|
+
});
|
|
180
201
|
}
|
|
181
202
|
updateConfig(options) {
|
|
182
203
|
if (!this.realtimeProvider) {
|
|
@@ -190,7 +211,12 @@ var CompositeVoice = class extends MastraVoice {
|
|
|
190
211
|
*/
|
|
191
212
|
connect(options) {
|
|
192
213
|
if (!this.realtimeProvider) {
|
|
193
|
-
throw new
|
|
214
|
+
throw new MastraError({
|
|
215
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_CONNECT",
|
|
216
|
+
text: "No realtime provider configured",
|
|
217
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
218
|
+
category: "USER" /* USER */
|
|
219
|
+
});
|
|
194
220
|
}
|
|
195
221
|
return this.realtimeProvider.connect(options);
|
|
196
222
|
}
|
|
@@ -200,7 +226,12 @@ var CompositeVoice = class extends MastraVoice {
|
|
|
200
226
|
*/
|
|
201
227
|
send(audioData) {
|
|
202
228
|
if (!this.realtimeProvider) {
|
|
203
|
-
throw new
|
|
229
|
+
throw new MastraError({
|
|
230
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_SEND",
|
|
231
|
+
text: "No realtime provider configured",
|
|
232
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
233
|
+
category: "USER" /* USER */
|
|
234
|
+
});
|
|
204
235
|
}
|
|
205
236
|
return this.realtimeProvider.send(audioData);
|
|
206
237
|
}
|
|
@@ -209,7 +240,12 @@ var CompositeVoice = class extends MastraVoice {
|
|
|
209
240
|
*/
|
|
210
241
|
answer(options) {
|
|
211
242
|
if (!this.realtimeProvider) {
|
|
212
|
-
throw new
|
|
243
|
+
throw new MastraError({
|
|
244
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_ANSWER",
|
|
245
|
+
text: "No realtime provider configured",
|
|
246
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
247
|
+
category: "USER" /* USER */
|
|
248
|
+
});
|
|
213
249
|
}
|
|
214
250
|
return this.realtimeProvider.answer(options);
|
|
215
251
|
}
|
|
@@ -238,7 +274,12 @@ var CompositeVoice = class extends MastraVoice {
|
|
|
238
274
|
*/
|
|
239
275
|
close() {
|
|
240
276
|
if (!this.realtimeProvider) {
|
|
241
|
-
throw new
|
|
277
|
+
throw new MastraError({
|
|
278
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_CLOSE",
|
|
279
|
+
text: "No realtime provider configured",
|
|
280
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
281
|
+
category: "USER" /* USER */
|
|
282
|
+
});
|
|
242
283
|
}
|
|
243
284
|
this.realtimeProvider.close();
|
|
244
285
|
}
|
|
@@ -249,7 +290,12 @@ var CompositeVoice = class extends MastraVoice {
|
|
|
249
290
|
*/
|
|
250
291
|
on(event, callback) {
|
|
251
292
|
if (!this.realtimeProvider) {
|
|
252
|
-
throw new
|
|
293
|
+
throw new MastraError({
|
|
294
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_ON",
|
|
295
|
+
text: "No realtime provider configured",
|
|
296
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
297
|
+
category: "USER" /* USER */
|
|
298
|
+
});
|
|
253
299
|
}
|
|
254
300
|
this.realtimeProvider.on(event, callback);
|
|
255
301
|
}
|
|
@@ -260,7 +306,12 @@ var CompositeVoice = class extends MastraVoice {
|
|
|
260
306
|
*/
|
|
261
307
|
off(event, callback) {
|
|
262
308
|
if (!this.realtimeProvider) {
|
|
263
|
-
throw new
|
|
309
|
+
throw new MastraError({
|
|
310
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_OFF",
|
|
311
|
+
text: "No realtime provider configured",
|
|
312
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
313
|
+
category: "USER" /* USER */
|
|
314
|
+
});
|
|
264
315
|
}
|
|
265
316
|
this.realtimeProvider.off(event, callback);
|
|
266
317
|
}
|
|
@@ -272,16 +323,36 @@ var DefaultVoice = class extends MastraVoice {
|
|
|
272
323
|
super();
|
|
273
324
|
}
|
|
274
325
|
async speak(_input) {
|
|
275
|
-
throw new
|
|
326
|
+
throw new MastraError({
|
|
327
|
+
id: "VOICE_DEFAULT_NO_SPEAK_PROVIDER",
|
|
328
|
+
text: "No voice provider configured",
|
|
329
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
330
|
+
category: "USER" /* USER */
|
|
331
|
+
});
|
|
276
332
|
}
|
|
277
333
|
async listen(_input) {
|
|
278
|
-
throw new
|
|
334
|
+
throw new MastraError({
|
|
335
|
+
id: "VOICE_DEFAULT_NO_LISTEN_PROVIDER",
|
|
336
|
+
text: "No voice provider configured",
|
|
337
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
338
|
+
category: "USER" /* USER */
|
|
339
|
+
});
|
|
279
340
|
}
|
|
280
341
|
async getSpeakers() {
|
|
281
|
-
throw new
|
|
342
|
+
throw new MastraError({
|
|
343
|
+
id: "VOICE_DEFAULT_NO_SPEAKERS_PROVIDER",
|
|
344
|
+
text: "No voice provider configured",
|
|
345
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
346
|
+
category: "USER" /* USER */
|
|
347
|
+
});
|
|
282
348
|
}
|
|
283
349
|
async getListener() {
|
|
284
|
-
throw new
|
|
350
|
+
throw new MastraError({
|
|
351
|
+
id: "VOICE_DEFAULT_NO_LISTENER_PROVIDER",
|
|
352
|
+
text: "No voice provider configured",
|
|
353
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
354
|
+
category: "USER" /* USER */
|
|
355
|
+
});
|
|
285
356
|
}
|
|
286
357
|
};
|
|
287
358
|
|
package/dist/error/index.cjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOLSQRA2V_cjs = require('../chunk-OLSQRA2V.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "ErrorCategory", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkOLSQRA2V_cjs.ErrorCategory; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "ErrorDomain", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkOLSQRA2V_cjs.ErrorDomain; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "MastraBaseError", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkOLSQRA2V_cjs.MastraBaseError; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "MastraError", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkOLSQRA2V_cjs.MastraError; }
|
|
22
22
|
});
|
package/dist/error/index.d.cts
CHANGED
|
@@ -2,6 +2,13 @@ declare enum ErrorDomain {
|
|
|
2
2
|
TOOL = "TOOL",
|
|
3
3
|
AGENT = "AGENT",
|
|
4
4
|
MCP = "MCP",
|
|
5
|
+
AGENT_NETWORK = "AGENT_NETWORK",
|
|
6
|
+
MASTRA_SERVER = "MASTRA_SERVER",
|
|
7
|
+
MASTRA_TELEMETRY = "MASTRA_TELEMETRY",
|
|
8
|
+
MASTRA_WORKFLOW = "MASTRA_WORKFLOW",
|
|
9
|
+
MASTRA_VOICE = "MASTRA_VOICE",
|
|
10
|
+
MASTRA_VECTOR = "MASTRA_VECTOR",
|
|
11
|
+
LLM = "LLM",
|
|
5
12
|
UNKNOWN = "UNKNOWN"
|
|
6
13
|
}
|
|
7
14
|
declare enum ErrorCategory {
|
package/dist/error/index.d.ts
CHANGED
|
@@ -2,6 +2,13 @@ declare enum ErrorDomain {
|
|
|
2
2
|
TOOL = "TOOL",
|
|
3
3
|
AGENT = "AGENT",
|
|
4
4
|
MCP = "MCP",
|
|
5
|
+
AGENT_NETWORK = "AGENT_NETWORK",
|
|
6
|
+
MASTRA_SERVER = "MASTRA_SERVER",
|
|
7
|
+
MASTRA_TELEMETRY = "MASTRA_TELEMETRY",
|
|
8
|
+
MASTRA_WORKFLOW = "MASTRA_WORKFLOW",
|
|
9
|
+
MASTRA_VOICE = "MASTRA_VOICE",
|
|
10
|
+
MASTRA_VECTOR = "MASTRA_VECTOR",
|
|
11
|
+
LLM = "LLM",
|
|
5
12
|
UNKNOWN = "UNKNOWN"
|
|
6
13
|
}
|
|
7
14
|
declare enum ErrorCategory {
|
package/dist/error/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ErrorCategory, ErrorDomain, MastraBaseError, MastraError } from '../chunk-
|
|
1
|
+
export { ErrorCategory, ErrorDomain, MastraBaseError, MastraError } from '../chunk-LDNCERLU.js';
|
package/dist/eval/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as Metric, T as TestInfo, E as EvaluationResult } from '../types-Bo1uigWx.cjs';
|
|
2
2
|
export { a as MetricResult } from '../types-Bo1uigWx.cjs';
|
|
3
|
-
import { A as Agent } from '../base-
|
|
3
|
+
import { A as Agent } from '../base-vDxe4rcD.cjs';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../base-DVVTzIQy.cjs';
|
|
6
6
|
import '@opentelemetry/api';
|
package/dist/eval/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as Metric, T as TestInfo, E as EvaluationResult } from '../types-Bo1uigWx.js';
|
|
2
2
|
export { a as MetricResult } from '../types-Bo1uigWx.js';
|
|
3
|
-
import { A as Agent } from '../base-
|
|
3
|
+
import { A as Agent } from '../base-DF29Fhcx.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../base-BbdvunNJ.js';
|
|
6
6
|
import '@opentelemetry/api';
|