@mastra/core 0.9.2-alpha.0 → 0.9.2-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +1 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/{base-DI6ChaUK.d.cts → base-BZxFAZ3-.d.cts} +27 -3
- package/dist/{base-bWFiU8RL.d.ts → base-uXj2cuRo.d.ts} +27 -3
- package/dist/{chunk-H2UWWO4L.js → chunk-6YY6MN2Z.js} +9 -5
- package/dist/{chunk-MAWT75XY.cjs → chunk-B7N24G5E.cjs} +2 -2
- package/dist/{chunk-7JRVDC7F.cjs → chunk-D2Y3ET63.cjs} +0 -91
- package/dist/{chunk-ZWALP7T2.cjs → chunk-EIMOKGTI.cjs} +2 -2
- package/dist/{chunk-SHDPMWGJ.js → chunk-IBKW4TJU.js} +1 -1
- package/dist/{chunk-33XQ5DGU.cjs → chunk-OPUU4S32.cjs} +5 -5
- package/dist/{chunk-YEA2KXXJ.js → chunk-QV4ZJLWA.js} +1 -1
- package/dist/{chunk-VI3IQINW.cjs → chunk-RSPHEENE.cjs} +45 -7
- package/dist/{chunk-FA7FWCKH.js → chunk-VQ7AM4ZV.js} +1 -1
- package/dist/{chunk-7PRLYMXV.cjs → chunk-VXUCE4GF.cjs} +20 -16
- package/dist/{chunk-INXNZ5VE.js → chunk-Z3OKCJ62.js} +41 -3
- package/dist/{chunk-KYULILA6.js → chunk-Z4MZ3ZUM.js} +1 -1
- package/dist/{chunk-JSUPD5IG.js → chunk-ZCJJ6XOH.js} +1 -90
- package/dist/{chunk-CFWUR4PX.cjs → chunk-ZVBLRU4W.cjs} +5 -5
- package/dist/eval/index.d.cts +1 -1
- package/dist/eval/index.d.ts +1 -1
- package/dist/index.cjs +50 -58
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/integration/index.cjs +3 -3
- package/dist/integration/index.d.cts +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/integration/index.js +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/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 +4 -4
- package/dist/network/index.d.cts +1 -1
- package/dist/network/index.d.ts +1 -1
- package/dist/network/index.js +2 -2
- 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.d.cts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/storage/index.d.cts +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/libsql/index.cjs +15 -1
- package/dist/storage/libsql/index.d.cts +4 -2
- package/dist/storage/libsql/index.d.ts +4 -2
- package/dist/storage/libsql/index.js +15 -1
- package/dist/telemetry/index.d.cts +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.d.cts +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/utils.cjs +12 -20
- package/dist/utils.d.cts +3 -5
- package/dist/utils.d.ts +3 -5
- package/dist/utils.js +1 -1
- package/dist/voice/index.d.cts +1 -1
- package/dist/voice/index.d.ts +1 -1
- package/dist/workflows/index.cjs +22 -22
- package/dist/workflows/index.d.cts +2 -2
- package/dist/workflows/index.d.ts +2 -2
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/vNext/index.cjs +6 -6
- package/dist/workflows/vNext/index.d.cts +2 -2
- package/dist/workflows/vNext/index.d.ts +2 -2
- package/dist/workflows/vNext/index.js +4 -4
- package/package.json +1 -1
- /package/dist/{chunk-7ZR64JAJ.js → chunk-2IXADNQJ.js} +0 -0
- /package/dist/{chunk-ZKRQS3N5.cjs → chunk-AVAHVCWY.cjs} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkPOEYDVX7_cjs = require('./chunk-POEYDVX7.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkZVBLRU4W_cjs = require('./chunk-ZVBLRU4W.cjs');
|
|
5
5
|
var chunkMYHX5XVW_cjs = require('./chunk-MYHX5XVW.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkD2Y3ET63_cjs = require('./chunk-D2Y3ET63.cjs');
|
|
7
7
|
var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
|
|
8
8
|
var chunkO7IW545H_cjs = require('./chunk-O7IW545H.cjs');
|
|
9
9
|
var chunkLABUWBKX_cjs = require('./chunk-LABUWBKX.cjs');
|
|
@@ -68,7 +68,7 @@ function resoolveMaybePromise(value, cb) {
|
|
|
68
68
|
var _Agent_decorators, _init, _a;
|
|
69
69
|
_Agent_decorators = [chunkMYHX5XVW_cjs.InstrumentClass({
|
|
70
70
|
prefix: "agent",
|
|
71
|
-
excludeMethods: ["hasOwnMemory", "getMemory", "__primitive", "__setTools", "__setLogger", "__setTelemetry", "log"]
|
|
71
|
+
excludeMethods: ["hasOwnMemory", "getMemory", "__primitive", "__registerMastra", "__registerPrimitives", "__setTools", "__setLogger", "__setTelemetry", "log", "getModel", "getInstructions", "getTools", "getLLM"]
|
|
72
72
|
})];
|
|
73
73
|
exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
74
74
|
id;
|
|
@@ -187,13 +187,13 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
187
187
|
if (typeof this.#tools === "function") {
|
|
188
188
|
throw new Error("Tools are not compatible when tools are a function. Please use getTools() instead.");
|
|
189
189
|
}
|
|
190
|
-
return
|
|
190
|
+
return chunkD2Y3ET63_cjs.ensureToolProperties(this.#tools);
|
|
191
191
|
}
|
|
192
192
|
getTools({
|
|
193
193
|
runtimeContext = new chunkLABUWBKX_cjs.RuntimeContext()
|
|
194
194
|
} = {}) {
|
|
195
195
|
if (typeof this.#tools !== "function") {
|
|
196
|
-
return
|
|
196
|
+
return chunkD2Y3ET63_cjs.ensureToolProperties(this.#tools);
|
|
197
197
|
}
|
|
198
198
|
const result = this.#tools({
|
|
199
199
|
runtimeContext
|
|
@@ -203,7 +203,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
203
203
|
this.logger.error(`[Agent:${this.name}] - Function-based tools returned empty value`);
|
|
204
204
|
throw new Error("Tools are required when using a function to provide them. The function returned an empty value.");
|
|
205
205
|
}
|
|
206
|
-
return
|
|
206
|
+
return chunkD2Y3ET63_cjs.ensureToolProperties(tools);
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
get llm() {
|
|
@@ -225,7 +225,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
225
225
|
runtimeContext
|
|
226
226
|
});
|
|
227
227
|
return resoolveMaybePromise(model, model2 => {
|
|
228
|
-
const llm = new
|
|
228
|
+
const llm = new chunkZVBLRU4W_cjs.MastraLLM({
|
|
229
229
|
model: model2,
|
|
230
230
|
mastra: this.#mastra
|
|
231
231
|
});
|
|
@@ -364,7 +364,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
364
364
|
messages: userMessages
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
|
-
const newMessages =
|
|
367
|
+
const newMessages = chunkD2Y3ET63_cjs.ensureAllMessagesAreCoreMessages(userMessages);
|
|
368
368
|
const now = Date.now();
|
|
369
369
|
const messages = newMessages.map((u, index) => {
|
|
370
370
|
return {
|
|
@@ -511,6 +511,9 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
511
511
|
});
|
|
512
512
|
return messagesBySanitizedContent.filter(message => {
|
|
513
513
|
if (typeof message.content === `string`) {
|
|
514
|
+
if (message.role === "assistant") {
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
514
517
|
return message.content !== "";
|
|
515
518
|
}
|
|
516
519
|
if (Array.isArray(message.content)) {
|
|
@@ -542,7 +545,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
542
545
|
let mastraProxy = void 0;
|
|
543
546
|
const logger = this.logger;
|
|
544
547
|
if (this.#mastra) {
|
|
545
|
-
mastraProxy =
|
|
548
|
+
mastraProxy = chunkD2Y3ET63_cjs.createMastraProxy({
|
|
546
549
|
mastra: this.#mastra,
|
|
547
550
|
logger
|
|
548
551
|
});
|
|
@@ -565,7 +568,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
565
568
|
agentName: this.name,
|
|
566
569
|
runtimeContext
|
|
567
570
|
};
|
|
568
|
-
memo[k] =
|
|
571
|
+
memo[k] = chunkD2Y3ET63_cjs.makeCoreTool(tool, options);
|
|
569
572
|
}
|
|
570
573
|
return memo;
|
|
571
574
|
}, {});
|
|
@@ -630,7 +633,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
630
633
|
agentName: this.name,
|
|
631
634
|
runtimeContext
|
|
632
635
|
};
|
|
633
|
-
const convertedToCoreTool =
|
|
636
|
+
const convertedToCoreTool = chunkD2Y3ET63_cjs.makeCoreTool(toolObj, options, "toolset");
|
|
634
637
|
toolsFromToolsetsConverted[toolName] = convertedToCoreTool;
|
|
635
638
|
});
|
|
636
639
|
});
|
|
@@ -656,7 +659,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
656
659
|
agentName: this.name,
|
|
657
660
|
runtimeContext
|
|
658
661
|
};
|
|
659
|
-
const convertedToCoreTool =
|
|
662
|
+
const convertedToCoreTool = chunkD2Y3ET63_cjs.makeCoreTool(rest, options, "client-tool");
|
|
660
663
|
toolsFromToolsetsConverted[toolName] = convertedToCoreTool;
|
|
661
664
|
});
|
|
662
665
|
}
|
|
@@ -821,7 +824,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
821
824
|
const userMessage = this.getMostRecentUserMessage(messages);
|
|
822
825
|
const newMessages = userMessage ? [userMessage] : messages;
|
|
823
826
|
const now = Date.now();
|
|
824
|
-
const threadMessages = this.sanitizeResponseMessages(
|
|
827
|
+
const threadMessages = this.sanitizeResponseMessages(chunkD2Y3ET63_cjs.ensureAllMessagesAreCoreMessages(newMessages)).map((u, index) => {
|
|
825
828
|
return {
|
|
826
829
|
id: this.getMemory()?.generateId(),
|
|
827
830
|
createdAt: new Date(now + index),
|
|
@@ -1886,7 +1889,7 @@ var Machine = class extends EventEmitter__default.default {
|
|
|
1886
1889
|
const logger = this.logger;
|
|
1887
1890
|
let mastraProxy = void 0;
|
|
1888
1891
|
if (this.#mastra) {
|
|
1889
|
-
mastraProxy =
|
|
1892
|
+
mastraProxy = chunkD2Y3ET63_cjs.createMastraProxy({
|
|
1890
1893
|
mastra: this.#mastra,
|
|
1891
1894
|
logger
|
|
1892
1895
|
});
|
|
@@ -3988,7 +3991,7 @@ var Workflow = class extends chunkD63P5O4Q_cjs.MastraBase {
|
|
|
3988
3991
|
}));
|
|
3989
3992
|
}
|
|
3990
3993
|
}
|
|
3991
|
-
async getWorkflowRuns() {
|
|
3994
|
+
async getWorkflowRuns(args) {
|
|
3992
3995
|
const storage = this.#mastra?.getStorage();
|
|
3993
3996
|
if (!storage) {
|
|
3994
3997
|
this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
|
|
@@ -3998,7 +4001,8 @@ var Workflow = class extends chunkD63P5O4Q_cjs.MastraBase {
|
|
|
3998
4001
|
};
|
|
3999
4002
|
}
|
|
4000
4003
|
return storage.getWorkflowRuns({
|
|
4001
|
-
workflowName: this.name
|
|
4004
|
+
workflowName: this.name,
|
|
4005
|
+
...(args ?? {})
|
|
4002
4006
|
});
|
|
4003
4007
|
}
|
|
4004
4008
|
getExecutionSpan(runId) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LibSQLVector } from './chunk-47NGQPZI.js';
|
|
2
|
-
import { DefaultProxyStorage, augmentWithInit } from './chunk-
|
|
3
|
-
import { deepMerge } from './chunk-
|
|
2
|
+
import { DefaultProxyStorage, augmentWithInit } from './chunk-2IXADNQJ.js';
|
|
3
|
+
import { deepMerge } from './chunk-ZCJJ6XOH.js';
|
|
4
4
|
import { MastraBase } from './chunk-CLJQYXNM.js';
|
|
5
5
|
import { existsSync } from 'fs';
|
|
6
6
|
import { join } from 'path';
|
|
@@ -127,6 +127,23 @@ var memoryDefaultOptions = {
|
|
|
127
127
|
},
|
|
128
128
|
threads: {
|
|
129
129
|
generateTitle: true
|
|
130
|
+
},
|
|
131
|
+
workingMemory: {
|
|
132
|
+
use: "text-stream",
|
|
133
|
+
// will be deprecated, use 'tool-call' instead
|
|
134
|
+
enabled: false,
|
|
135
|
+
template: `
|
|
136
|
+
# User Information
|
|
137
|
+
- **First Name**:
|
|
138
|
+
- **Last Name**:
|
|
139
|
+
- **Location**:
|
|
140
|
+
- **Occupation**:
|
|
141
|
+
- **Interests**:
|
|
142
|
+
- **Goals**:
|
|
143
|
+
- **Events**:
|
|
144
|
+
- **Facts**:
|
|
145
|
+
- **Projects**:
|
|
146
|
+
`
|
|
130
147
|
}
|
|
131
148
|
};
|
|
132
149
|
var newMemoryDefaultOptions = {
|
|
@@ -134,7 +151,10 @@ var newMemoryDefaultOptions = {
|
|
|
134
151
|
semanticRecall: false,
|
|
135
152
|
threads: {
|
|
136
153
|
generateTitle: false
|
|
137
|
-
}
|
|
154
|
+
},
|
|
155
|
+
workingMemory: {
|
|
156
|
+
// new
|
|
157
|
+
use: "tool-call"}
|
|
138
158
|
};
|
|
139
159
|
var MastraMemory = class extends MastraBase {
|
|
140
160
|
MAX_CONTEXT_TOKENS;
|
|
@@ -258,6 +278,21 @@ ${this.deprecationWarnings.map((w, i) => `${this.deprecationWarnings.length > 1
|
|
|
258
278
|
from: memoryDefaultOptions.threads,
|
|
259
279
|
to: newMemoryDefaultOptions.threads
|
|
260
280
|
});
|
|
281
|
+
if (`workingMemory` in options && // special handling for working memory since it's disabled by default and users should only care about the change if they're using
|
|
282
|
+
options.workingMemory?.enabled === true && options.workingMemory?.use !== `tool-call`) {
|
|
283
|
+
fromToPairs.push({
|
|
284
|
+
key: "workingMemory",
|
|
285
|
+
from: {
|
|
286
|
+
use: memoryDefaultOptions.workingMemory.use
|
|
287
|
+
},
|
|
288
|
+
to: {
|
|
289
|
+
use: newMemoryDefaultOptions.workingMemory.use
|
|
290
|
+
},
|
|
291
|
+
message: `
|
|
292
|
+
Also, the text-stream output mode (which is the current default) will be fully removed in an upcoming breaking change. Please update your code to use the newer "use: 'tool-call'" setting instead.
|
|
293
|
+
`
|
|
294
|
+
});
|
|
295
|
+
}
|
|
261
296
|
if (fromToPairs.length > 0) {
|
|
262
297
|
const currentDefaults = `{
|
|
263
298
|
options: {
|
|
@@ -271,6 +306,7 @@ ${this.deprecationWarnings.map((w, i) => `${this.deprecationWarnings.length > 1
|
|
|
271
306
|
`)}
|
|
272
307
|
}
|
|
273
308
|
}`;
|
|
309
|
+
const messages = fromToPairs.filter((ft) => ft.message);
|
|
274
310
|
this.deprecationWarnings.push(`
|
|
275
311
|
Your Mastra memory instance has the
|
|
276
312
|
following implicit default options:
|
|
@@ -286,6 +322,8 @@ To keep your defaults as they are, add
|
|
|
286
322
|
them directly into your Memory configuration,
|
|
287
323
|
otherwise please add the new settings to
|
|
288
324
|
your memory config to prepare for the change.
|
|
325
|
+
${messages.length ? messages.map((ft) => ft.message).join(`
|
|
326
|
+
`) : ``}
|
|
289
327
|
--> This breaking change will be released on May 20th <--
|
|
290
328
|
`);
|
|
291
329
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefaultProxyStorage, augmentWithInit } from './chunk-
|
|
1
|
+
import { DefaultProxyStorage, augmentWithInit } from './chunk-2IXADNQJ.js';
|
|
2
2
|
import { InstrumentClass, Telemetry } from './chunk-KWYJUFY3.js';
|
|
3
3
|
import { createLogger, LogLevel, noopLogger } from './chunk-2BVZNKLX.js';
|
|
4
4
|
import { __decoratorStart, __decorateElement, __runInitializers } from './chunk-C6A6W6XS.js';
|
|
@@ -25,95 +25,6 @@ function createTool(opts) {
|
|
|
25
25
|
return new Tool(opts);
|
|
26
26
|
}
|
|
27
27
|
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
28
|
-
function jsonSchemaPropertiesToTSTypes(value) {
|
|
29
|
-
if (!value?.type) {
|
|
30
|
-
return z.object({});
|
|
31
|
-
}
|
|
32
|
-
if (Array.isArray(value.type)) {
|
|
33
|
-
const types = value.type.map((type) => {
|
|
34
|
-
return jsonSchemaPropertiesToTSTypes({ ...value, type });
|
|
35
|
-
});
|
|
36
|
-
return z.union(types).describe((value.description || "") + (value.examples ? `
|
|
37
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
38
|
-
}
|
|
39
|
-
let zodType;
|
|
40
|
-
switch (value.type) {
|
|
41
|
-
case "string":
|
|
42
|
-
zodType = z.string().describe((value.description || "") + (value.examples ? `
|
|
43
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
44
|
-
break;
|
|
45
|
-
case "number":
|
|
46
|
-
zodType = z.number().describe((value.description || "") + (value.examples ? `
|
|
47
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
48
|
-
break;
|
|
49
|
-
case "integer":
|
|
50
|
-
zodType = z.number().int().describe((value.description || "") + (value.examples ? `
|
|
51
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
52
|
-
break;
|
|
53
|
-
case "boolean":
|
|
54
|
-
zodType = z.boolean().describe((value.description || "") + (value.examples ? `
|
|
55
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
56
|
-
break;
|
|
57
|
-
case "array":
|
|
58
|
-
if (!value.items || !value.items?.type) {
|
|
59
|
-
value.items = value.items ? { ...value.items, type: "string" } : { type: "string" };
|
|
60
|
-
}
|
|
61
|
-
zodType = z.array(jsonSchemaPropertiesToTSTypes(value.items)).describe((value.description || "") + (value.examples ? `
|
|
62
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
63
|
-
break;
|
|
64
|
-
case "object":
|
|
65
|
-
zodType = jsonSchemaToModel(value).describe(
|
|
66
|
-
(value.description || "") + (value.examples ? `
|
|
67
|
-
Examples: ${value.examples.join(", ")}` : "")
|
|
68
|
-
);
|
|
69
|
-
break;
|
|
70
|
-
case "null":
|
|
71
|
-
zodType = z.null().describe(value.description || "");
|
|
72
|
-
break;
|
|
73
|
-
default:
|
|
74
|
-
throw new Error(`Unsupported JSON schema type: ${value.type}`);
|
|
75
|
-
}
|
|
76
|
-
return zodType;
|
|
77
|
-
}
|
|
78
|
-
function jsonSchemaToModel(jsonSchema) {
|
|
79
|
-
const properties = jsonSchema.properties;
|
|
80
|
-
const requiredFields = jsonSchema.required || [];
|
|
81
|
-
if (!properties) {
|
|
82
|
-
return z.object({});
|
|
83
|
-
}
|
|
84
|
-
const zodSchema = {};
|
|
85
|
-
for (const [key, _] of Object.entries(properties)) {
|
|
86
|
-
const value = _;
|
|
87
|
-
let zodType;
|
|
88
|
-
if (value.anyOf) {
|
|
89
|
-
const anyOfTypes = value.anyOf.map((schema) => jsonSchemaPropertiesToTSTypes(schema));
|
|
90
|
-
zodType = z.union(anyOfTypes).describe((value.description || "") + (value.examples ? `
|
|
91
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
92
|
-
} else if (value.allOf) {
|
|
93
|
-
const allOfTypes = value.allOf.map((schema) => jsonSchemaPropertiesToTSTypes(schema));
|
|
94
|
-
zodType = z.intersection(
|
|
95
|
-
allOfTypes[0],
|
|
96
|
-
allOfTypes.slice(1).reduce((acc, schema) => acc.and(schema), allOfTypes[0])
|
|
97
|
-
).describe((value.description || "") + (value.examples ? `
|
|
98
|
-
Examples: ${value.examples.join(", ")}` : ""));
|
|
99
|
-
} else {
|
|
100
|
-
if (!value.type) {
|
|
101
|
-
value.type = "string";
|
|
102
|
-
}
|
|
103
|
-
zodType = jsonSchemaPropertiesToTSTypes(value);
|
|
104
|
-
}
|
|
105
|
-
if (value.description) {
|
|
106
|
-
zodType = zodType.describe(value.description);
|
|
107
|
-
}
|
|
108
|
-
const isTypeRequired = value.type === "null";
|
|
109
|
-
if (requiredFields.includes(key) || isTypeRequired) {
|
|
110
|
-
zodSchema[key] = zodType;
|
|
111
|
-
} else {
|
|
112
|
-
zodSchema[key] = zodType.nullable().optional();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return z.object(zodSchema);
|
|
116
|
-
}
|
|
117
28
|
function deepMerge(target, source) {
|
|
118
29
|
const output = { ...target };
|
|
119
30
|
if (!source) return output;
|
|
@@ -430,4 +341,4 @@ ${JSON.stringify(message, null, 2)}
|
|
|
430
341
|
}).flat();
|
|
431
342
|
}
|
|
432
343
|
|
|
433
|
-
export { Tool, checkEvalStorageFields, createMastraProxy, createTool, deepMerge, delay, ensureAllMessagesAreCoreMessages, ensureToolProperties, isVercelTool, isZodType,
|
|
344
|
+
export { Tool, checkEvalStorageFields, createMastraProxy, createTool, deepMerge, delay, ensureAllMessagesAreCoreMessages, ensureToolProperties, isVercelTool, isZodType, makeCoreTool, maskStreamTags, resolveSerializedZodOutput };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkD2Y3ET63_cjs = require('./chunk-D2Y3ET63.cjs');
|
|
4
4
|
var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
|
|
5
5
|
var chunkO7IW545H_cjs = require('./chunk-O7IW545H.cjs');
|
|
6
6
|
var ai = require('ai');
|
|
@@ -162,7 +162,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
162
162
|
});
|
|
163
163
|
if (props?.response?.headers?.["x-ratelimit-remaining-tokens"] && parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"], 10) < 2e3) {
|
|
164
164
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
165
|
-
await
|
|
165
|
+
await chunkD2Y3ET63_cjs.delay(10 * 1e3);
|
|
166
166
|
}
|
|
167
167
|
},
|
|
168
168
|
...rest
|
|
@@ -231,7 +231,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
231
231
|
});
|
|
232
232
|
if (props?.response?.headers?.["x-ratelimit-remaining-tokens"] && parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"], 10) < 2e3) {
|
|
233
233
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
234
|
-
await
|
|
234
|
+
await chunkD2Y3ET63_cjs.delay(10 * 1e3);
|
|
235
235
|
}
|
|
236
236
|
},
|
|
237
237
|
...rest
|
|
@@ -304,7 +304,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
304
304
|
});
|
|
305
305
|
if (props?.response?.headers?.["x-ratelimit-remaining-tokens"] && parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"], 10) < 2e3) {
|
|
306
306
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
307
|
-
await
|
|
307
|
+
await chunkD2Y3ET63_cjs.delay(10 * 1e3);
|
|
308
308
|
}
|
|
309
309
|
},
|
|
310
310
|
onFinish: async (props) => {
|
|
@@ -395,7 +395,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
395
395
|
});
|
|
396
396
|
if (props?.response?.headers?.["x-ratelimit-remaining-tokens"] && parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"], 10) < 2e3) {
|
|
397
397
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
398
|
-
await
|
|
398
|
+
await chunkD2Y3ET63_cjs.delay(10 * 1e3);
|
|
399
399
|
}
|
|
400
400
|
},
|
|
401
401
|
onFinish: async (props) => {
|
package/dist/eval/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as Metric, T as TestInfo, E as EvaluationResult } from '../types-BtMyV38I.cjs';
|
|
2
2
|
export { M as MetricResult } from '../types-BtMyV38I.cjs';
|
|
3
|
-
import { D as Agent } from '../base-
|
|
3
|
+
import { D as Agent } from '../base-BZxFAZ3-.cjs';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../base-BihKcqDY.cjs';
|
|
6
6
|
import '@opentelemetry/api';
|
package/dist/eval/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as Metric, T as TestInfo, E as EvaluationResult } from '../types-BtMyV38I.js';
|
|
2
2
|
export { M as MetricResult } from '../types-BtMyV38I.js';
|
|
3
|
-
import { D as Agent } from '../base-
|
|
3
|
+
import { D as Agent } from '../base-uXj2cuRo.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../base-DT2poiVK.js';
|
|
6
6
|
import '@opentelemetry/api';
|