@mastra/core 0.2.0-alpha.96 → 0.2.0-alpha.99
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.d.ts +2 -2
- package/dist/agent/index.js +2 -2
- package/dist/{chunk-43VWZDGE.js → chunk-A7SNFYQB.js} +1 -1
- package/dist/chunk-C55JWGDU.js +76 -0
- package/dist/{chunk-TYIBRZOY.js → chunk-DHCULRJM.js} +19 -12
- package/dist/{chunk-UTOZGI4D.js → chunk-EO3TIPGQ.js} +21 -7
- package/dist/{chunk-G4LP2IJU.js → chunk-HPXWJBQK.js} +23 -2
- package/dist/{chunk-QLN26TPI.js → chunk-JP37ODNX.js} +3 -2
- package/dist/{chunk-EULBQ77C.js → chunk-Z7JFMQZZ.js} +44 -1
- package/dist/{chunk-5DZIXJRV.js → chunk-ZJOMHCWE.js} +16 -2
- package/dist/eval/index.d.ts +4 -3
- package/dist/eval/index.js +1 -1
- package/dist/hooks/index.d.ts +6 -1
- package/dist/{index-M8e8RIkM.d.ts → index-Cwb-5AzX.d.ts} +16 -4
- package/dist/index.d.ts +7 -7
- package/dist/index.js +12 -11
- package/dist/integration/index.d.ts +3 -3
- package/dist/llm/index.d.ts +2 -2
- package/dist/mastra/index.d.ts +3 -3
- package/dist/mastra/index.js +6 -1
- package/dist/memory/index.d.ts +2 -2
- package/dist/memory/index.js +5 -1
- package/dist/{metric-D2V4CR8D.d.ts → metric-BWeQNZt6.d.ts} +1 -1
- package/dist/relevance/index.js +3 -3
- package/dist/storage/index.d.ts +6 -4
- package/dist/storage/index.js +4 -4
- package/dist/tools/index.d.ts +3 -3
- package/dist/vector/index.d.ts +4 -1
- package/dist/vector/index.js +1 -1
- package/dist/vector/libsql/index.d.ts +2 -0
- package/dist/vector/libsql/index.js +3 -3
- package/dist/{workflow-DaKNLC8e.d.ts → workflow-DTtv7_Eq.d.ts} +1 -1
- package/dist/workflows/index.d.ts +4 -4
- package/package.json +7 -3
- package/dist/action/index.d.ts +0 -16
- package/dist/action/index.js +0 -1
- package/dist/chunk-MBOUQZQT.js +0 -16
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export { A as Agent } from '../index-
|
|
4
|
+
export { A as Agent } from '../index-Cwb-5AzX.js';
|
|
5
5
|
import '../base.js';
|
|
6
|
-
import '../metric-
|
|
6
|
+
import '../metric-BWeQNZt6.js';
|
|
7
7
|
import '../telemetry-oCUM52DG.js';
|
|
8
8
|
import 'sift';
|
|
9
9
|
import '../index-CBZ2mk2H.js';
|
package/dist/agent/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { Agent } from '../chunk-
|
|
1
|
+
export { Agent } from '../chunk-EO3TIPGQ.js';
|
|
2
2
|
import '../chunk-4ZUSEHLH.js';
|
|
3
3
|
import '../chunk-KNPBNSJ7.js';
|
|
4
|
+
import '../chunk-HBTQNIAX.js';
|
|
4
5
|
import '../chunk-G4MCO7XF.js';
|
|
5
6
|
import '../chunk-ICMEXHKD.js';
|
|
6
|
-
import '../chunk-HBTQNIAX.js';
|
|
7
7
|
import '../chunk-AJJZUHB4.js';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { MastraBase } from './chunk-G4MCO7XF.js';
|
|
2
|
+
import { __name } from './chunk-AJJZUHB4.js';
|
|
3
|
+
import { experimental_customProvider } from 'ai';
|
|
4
|
+
import node_modulesPath from 'node_modules-path';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
|
|
7
|
+
var cachedPath = false;
|
|
8
|
+
function getModelCachePath() {
|
|
9
|
+
if (cachedPath) return cachedPath;
|
|
10
|
+
const firstNodeModules = node_modulesPath().split("node_modules")[0];
|
|
11
|
+
cachedPath = path.join(firstNodeModules, "node_modules", ".fastembed-model-cache");
|
|
12
|
+
return cachedPath;
|
|
13
|
+
}
|
|
14
|
+
__name(getModelCachePath, "getModelCachePath");
|
|
15
|
+
var fastEmbedImportPath = "fastembed?" + Date.now();
|
|
16
|
+
async function generateEmbeddings(values, modelType) {
|
|
17
|
+
try {
|
|
18
|
+
const { EmbeddingModel, FlagEmbedding } = await import(fastEmbedImportPath);
|
|
19
|
+
const model = await FlagEmbedding.init({
|
|
20
|
+
model: EmbeddingModel[modelType],
|
|
21
|
+
cacheDir: getModelCachePath()
|
|
22
|
+
});
|
|
23
|
+
const embeddings = await model.embed(values);
|
|
24
|
+
const allResults = [];
|
|
25
|
+
for await (const result of embeddings) {
|
|
26
|
+
allResults.push(...result.map((embedding) => Array.from(embedding)));
|
|
27
|
+
}
|
|
28
|
+
if (allResults.length === 0) throw new Error("No embeddings generated");
|
|
29
|
+
return {
|
|
30
|
+
embeddings: allResults
|
|
31
|
+
};
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error("Error generating embeddings:", error);
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
__name(generateEmbeddings, "generateEmbeddings");
|
|
38
|
+
var fastEmbedProvider = experimental_customProvider({
|
|
39
|
+
textEmbeddingModels: {
|
|
40
|
+
"bge-small-en-v1.5": {
|
|
41
|
+
specificationVersion: "v1",
|
|
42
|
+
provider: "fastembed",
|
|
43
|
+
modelId: "bge-small-en-v1.5",
|
|
44
|
+
maxEmbeddingsPerCall: 256,
|
|
45
|
+
supportsParallelCalls: true,
|
|
46
|
+
async doEmbed({ values }) {
|
|
47
|
+
return generateEmbeddings(values, "BGESmallENV15");
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"bge-base-en-v1.5": {
|
|
51
|
+
specificationVersion: "v1",
|
|
52
|
+
provider: "fastembed",
|
|
53
|
+
modelId: "bge-base-en-v1.5",
|
|
54
|
+
maxEmbeddingsPerCall: 256,
|
|
55
|
+
supportsParallelCalls: true,
|
|
56
|
+
async doEmbed({ values }) {
|
|
57
|
+
return generateEmbeddings(values, "BGEBaseENV15");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
var localEmbedder = fastEmbedProvider.textEmbeddingModel;
|
|
63
|
+
|
|
64
|
+
// src/vector/index.ts
|
|
65
|
+
var _MastraVector = class _MastraVector extends MastraBase {
|
|
66
|
+
constructor() {
|
|
67
|
+
super({
|
|
68
|
+
name: "MastraVector",
|
|
69
|
+
component: "VECTOR"
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
__name(_MastraVector, "MastraVector");
|
|
74
|
+
var MastraVector = _MastraVector;
|
|
75
|
+
|
|
76
|
+
export { MastraVector, localEmbedder };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DefaultStorage } from './chunk-Z7JFMQZZ.js';
|
|
1
2
|
import { InstrumentClass, Telemetry } from './chunk-4ZUSEHLH.js';
|
|
2
3
|
import { LogLevel, createLogger, noopLogger } from './chunk-ICMEXHKD.js';
|
|
3
4
|
import { __name, __publicField } from './chunk-AJJZUHB4.js';
|
|
@@ -55,18 +56,24 @@ var _Mastra = class _Mastra {
|
|
|
55
56
|
this.deployer.__setTelemetry(this.telemetry);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
let storage = config?.storage;
|
|
60
|
+
if (!storage) {
|
|
61
|
+
storage = new DefaultStorage({
|
|
62
|
+
config: {
|
|
63
|
+
url: ":memory:"
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (this.telemetry) {
|
|
68
|
+
this.storage = this.telemetry.traceClass(storage, {
|
|
69
|
+
excludeMethods: [
|
|
70
|
+
"__setTelemetry",
|
|
71
|
+
"__getTelemetry"
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
this.storage.__setTelemetry(this.telemetry);
|
|
75
|
+
} else {
|
|
76
|
+
this.storage = storage;
|
|
70
77
|
}
|
|
71
78
|
if (config?.vectors) {
|
|
72
79
|
let vectors = {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InstrumentClass } from './chunk-4ZUSEHLH.js';
|
|
2
2
|
import { delay } from './chunk-KNPBNSJ7.js';
|
|
3
|
+
import { executeHook, AvailableHooks } from './chunk-HBTQNIAX.js';
|
|
3
4
|
import { MastraBase } from './chunk-G4MCO7XF.js';
|
|
4
5
|
import { RegisteredLogger, LogLevel } from './chunk-ICMEXHKD.js';
|
|
5
|
-
import { executeHook, AvailableHooks } from './chunk-HBTQNIAX.js';
|
|
6
6
|
import { __name, __privateAdd, __privateSet, __privateGet, __publicField } from './chunk-AJJZUHB4.js';
|
|
7
7
|
import { randomUUID } from 'crypto';
|
|
8
8
|
import { z } from 'zod';
|
|
@@ -24,6 +24,9 @@ var _MastraLLMBase = class _MastraLLMBase extends MastraBase {
|
|
|
24
24
|
getProvider() {
|
|
25
25
|
return __privateGet(this, _model).provider;
|
|
26
26
|
}
|
|
27
|
+
getModelId() {
|
|
28
|
+
return __privateGet(this, _model).modelId;
|
|
29
|
+
}
|
|
27
30
|
convertToMessages(messages) {
|
|
28
31
|
if (Array.isArray(messages)) {
|
|
29
32
|
return messages.map((m) => {
|
|
@@ -124,6 +127,9 @@ var _MastraLLM = class _MastraLLM extends MastraLLMBase {
|
|
|
124
127
|
getProvider() {
|
|
125
128
|
return __privateGet(this, _model2).provider;
|
|
126
129
|
}
|
|
130
|
+
getModelId() {
|
|
131
|
+
return __privateGet(this, _model2).modelId;
|
|
132
|
+
}
|
|
127
133
|
convertTools(tools) {
|
|
128
134
|
this.logger.debug("Starting tool conversion for LLM");
|
|
129
135
|
const converted = Object.entries(tools || {}).reduce((memo, value) => {
|
|
@@ -476,6 +482,13 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
476
482
|
getMemory() {
|
|
477
483
|
return __privateGet(this, _memory) ?? __privateGet(this, _mastra3)?.memory;
|
|
478
484
|
}
|
|
485
|
+
__updateInstructions(newInstructions) {
|
|
486
|
+
this.instructions = newInstructions;
|
|
487
|
+
this.logger.debug(`[Agents:${this.name}] Instructions updated.`, {
|
|
488
|
+
model: this.model,
|
|
489
|
+
name: this.name
|
|
490
|
+
});
|
|
491
|
+
}
|
|
479
492
|
__registerPrimitives(p) {
|
|
480
493
|
if (p.telemetry) {
|
|
481
494
|
this.__setTelemetry(p.telemetry);
|
|
@@ -562,7 +575,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
562
575
|
threadId
|
|
563
576
|
});
|
|
564
577
|
if (!thread) {
|
|
565
|
-
this.logger.debug(`Thread not found, creating new thread for agent ${this.name}`, {
|
|
578
|
+
this.logger.debug(`Thread with id ${threadId} not found, creating new thread for agent ${this.name}`, {
|
|
566
579
|
runId: runId || this.name
|
|
567
580
|
});
|
|
568
581
|
const title = await this.genTitle(userMessage);
|
|
@@ -694,11 +707,11 @@ ${memorySystemMessage}` : ""}`
|
|
|
694
707
|
const responseMessagesWithoutIncompleteToolCalls = this.sanitizeResponseMessages(ms);
|
|
695
708
|
const memory = this.getMemory();
|
|
696
709
|
if (memory) {
|
|
697
|
-
this.logger.debug(`[Agent:${this.name}] - Memory persistence: store=${
|
|
710
|
+
this.logger.debug(`[Agent:${this.name}] - Memory persistence: store=${this.getMemory()?.constructor.name} threadId=${threadId}`, {
|
|
698
711
|
runId,
|
|
699
712
|
resourceId,
|
|
700
713
|
threadId,
|
|
701
|
-
memoryStore:
|
|
714
|
+
memoryStore: this.getMemory()?.constructor.name
|
|
702
715
|
});
|
|
703
716
|
await memory.saveMessages({
|
|
704
717
|
memoryConfig,
|
|
@@ -883,11 +896,11 @@ ${memorySystemMessage}` : ""}`
|
|
|
883
896
|
let coreMessages = messages;
|
|
884
897
|
let threadIdToUse = threadId;
|
|
885
898
|
if (this.getMemory() && resourceId) {
|
|
886
|
-
this.logger.debug(`[Agent:${this.name}] - Memory persistence enabled: store=${
|
|
899
|
+
this.logger.debug(`[Agent:${this.name}] - Memory persistence enabled: store=${this.getMemory()?.constructor.name}, resourceId=${resourceId}`, {
|
|
887
900
|
runId,
|
|
888
901
|
resourceId,
|
|
889
902
|
threadId: threadIdToUse,
|
|
890
|
-
memoryStore:
|
|
903
|
+
memoryStore: this.getMemory()?.constructor.name
|
|
891
904
|
});
|
|
892
905
|
const preExecuteResult = await this.preExecute({
|
|
893
906
|
resourceId,
|
|
@@ -981,7 +994,8 @@ ${memorySystemMessage}` : ""}`
|
|
|
981
994
|
output: outputText,
|
|
982
995
|
runId: runIdToUse,
|
|
983
996
|
metric,
|
|
984
|
-
agentName: this.name
|
|
997
|
+
agentName: this.name,
|
|
998
|
+
instructions: this.instructions
|
|
985
999
|
});
|
|
986
1000
|
}
|
|
987
1001
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DefaultStorage } from './chunk-Z7JFMQZZ.js';
|
|
1
2
|
import { deepMerge } from './chunk-KNPBNSJ7.js';
|
|
2
3
|
import { MastraBase } from './chunk-G4MCO7XF.js';
|
|
3
4
|
import { __name, __publicField } from './chunk-AJJZUHB4.js';
|
|
@@ -17,7 +18,11 @@ var _MastraMemory = class _MastraMemory extends MastraBase {
|
|
|
17
18
|
lastMessages: 40,
|
|
18
19
|
semanticRecall: false
|
|
19
20
|
});
|
|
20
|
-
this.storage = config.storage
|
|
21
|
+
this.storage = config.storage || new DefaultStorage({
|
|
22
|
+
config: {
|
|
23
|
+
url: "file:memory.db"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
21
26
|
if (config.vector) {
|
|
22
27
|
this.vector = config.vector;
|
|
23
28
|
this.threadConfig.semanticRecall = true;
|
|
@@ -37,6 +42,23 @@ var _MastraMemory = class _MastraMemory extends MastraBase {
|
|
|
37
42
|
async getSystemMessage(_input) {
|
|
38
43
|
return null;
|
|
39
44
|
}
|
|
45
|
+
async createEmbeddingIndex() {
|
|
46
|
+
if (!this.vector) {
|
|
47
|
+
throw new Error(`Cannot call MastraMemory.createEmbeddingIndex() without a vector db attached.`);
|
|
48
|
+
}
|
|
49
|
+
const defaultDimensions = 1536;
|
|
50
|
+
const dimensionsByModelId = {
|
|
51
|
+
"bge-small-en-v1.5": 384,
|
|
52
|
+
"bge-base-en-v1.5": 768
|
|
53
|
+
};
|
|
54
|
+
const dimensions = dimensionsByModelId[this.getEmbedder().modelId] || defaultDimensions;
|
|
55
|
+
const isDefault = dimensions === defaultDimensions;
|
|
56
|
+
const indexName = isDefault ? "memory_messages" : `memory_messages_${dimensions}`;
|
|
57
|
+
await this.vector.createIndex(indexName, dimensions);
|
|
58
|
+
return {
|
|
59
|
+
indexName
|
|
60
|
+
};
|
|
61
|
+
}
|
|
40
62
|
getEmbedder() {
|
|
41
63
|
if (!this.embedder) {
|
|
42
64
|
throw new Error(`Cannot use vector features without setting new Memory({ embedder: embedderInstance })
|
|
@@ -44,7 +66,6 @@ var _MastraMemory = class _MastraMemory extends MastraBase {
|
|
|
44
66
|
For example:
|
|
45
67
|
|
|
46
68
|
new Memory({
|
|
47
|
-
storage,
|
|
48
69
|
vector,
|
|
49
70
|
embedder: openai("text-embedding-3-small") // example
|
|
50
71
|
});
|
|
@@ -8,7 +8,7 @@ __name(_Metric, "Metric");
|
|
|
8
8
|
var Metric = _Metric;
|
|
9
9
|
|
|
10
10
|
// src/eval/evaluation.ts
|
|
11
|
-
async function evaluate({ agentName, input, metric, output, runId, globalRunId, testInfo }) {
|
|
11
|
+
async function evaluate({ agentName, input, metric, output, runId, globalRunId, testInfo, instructions }) {
|
|
12
12
|
const runIdToUse = runId || crypto.randomUUID();
|
|
13
13
|
const metricResult = await metric.measure(input.toString(), output);
|
|
14
14
|
const traceObject = {
|
|
@@ -24,7 +24,8 @@ async function evaluate({ agentName, input, metric, output, runId, globalRunId,
|
|
|
24
24
|
runId: runIdToUse,
|
|
25
25
|
agentName,
|
|
26
26
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
27
|
-
metricName: metric.constructor.name
|
|
27
|
+
metricName: metric.constructor.name,
|
|
28
|
+
instructions
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
executeHook(AvailableHooks.ON_EVALUATION, traceObject);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MastraBase } from './chunk-G4MCO7XF.js';
|
|
2
2
|
import { __name, __publicField } from './chunk-AJJZUHB4.js';
|
|
3
3
|
import { createClient } from '@libsql/client';
|
|
4
|
+
import { join } from 'path';
|
|
4
5
|
|
|
5
6
|
// src/storage/base.ts
|
|
6
7
|
var _MastraStorage = class _MastraStorage extends MastraBase {
|
|
@@ -213,10 +214,23 @@ var _DefaultStorage = class _DefaultStorage extends MastraStorage {
|
|
|
213
214
|
});
|
|
214
215
|
__publicField(this, "client");
|
|
215
216
|
this.client = createClient({
|
|
216
|
-
url: config.url,
|
|
217
|
+
url: this.rewriteDbUrl(config.url),
|
|
217
218
|
authToken: config.authToken
|
|
218
219
|
});
|
|
219
220
|
}
|
|
221
|
+
rewriteDbUrl(url) {
|
|
222
|
+
if (url.startsWith("file:") && !url.startsWith("file:/")) {
|
|
223
|
+
const cwd = process.cwd();
|
|
224
|
+
const relativePath = url.slice("file:".length);
|
|
225
|
+
if (cwd.endsWith(".mastra") || cwd.endsWith(".mastra/")) {
|
|
226
|
+
const baseDir = join(cwd, `..`);
|
|
227
|
+
const fullPath = join(baseDir, relativePath);
|
|
228
|
+
this.logger.debug(`Initializing LibSQL db with url ${url} with relative file path from inside .mastra directory. Rewriting relative file url to "file:${fullPath}". This ensures it's outside the .mastra directory. If the db is stored inside .mastra it will be deleted when Mastra re-bundles code.`);
|
|
229
|
+
return `file:${fullPath}`;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return url;
|
|
233
|
+
}
|
|
220
234
|
getCreateTableSQL(tableName, schema) {
|
|
221
235
|
const columns = Object.entries(schema).map(([name, col]) => {
|
|
222
236
|
let type = col.type.toUpperCase();
|
|
@@ -501,6 +515,35 @@ var _DefaultStorage = class _DefaultStorage extends MastraStorage {
|
|
|
501
515
|
throw error;
|
|
502
516
|
}
|
|
503
517
|
}
|
|
518
|
+
async getEvalsByAgentName(agentName, type) {
|
|
519
|
+
try {
|
|
520
|
+
const baseQuery = `SELECT * FROM ${MastraStorage.TABLE_EVALS} WHERE meta->>'$.agentName' = ?`;
|
|
521
|
+
const typeCondition = type === "test" ? " AND meta->>'$.testPath' IS NOT NULL" : type === "live" ? " AND meta->>'$.testPath' IS NULL" : "";
|
|
522
|
+
const result = await this.client.execute({
|
|
523
|
+
sql: `${baseQuery}${typeCondition} ORDER BY createdAt DESC`,
|
|
524
|
+
args: [
|
|
525
|
+
agentName
|
|
526
|
+
]
|
|
527
|
+
});
|
|
528
|
+
if (!result.rows) {
|
|
529
|
+
return [];
|
|
530
|
+
}
|
|
531
|
+
return result.rows.map((row) => ({
|
|
532
|
+
...row,
|
|
533
|
+
result: typeof row.result === "string" ? JSON.parse(row.result) : row.result,
|
|
534
|
+
meta: typeof row.meta === "string" ? JSON.parse(row.meta) : row.meta,
|
|
535
|
+
input: row.input,
|
|
536
|
+
output: row.output,
|
|
537
|
+
createdAt: row.createdAt
|
|
538
|
+
}));
|
|
539
|
+
} catch (error) {
|
|
540
|
+
if (error instanceof Error && error.message.includes("no such table")) {
|
|
541
|
+
return [];
|
|
542
|
+
}
|
|
543
|
+
console.error("Failed to get evals for the specified agent", error);
|
|
544
|
+
throw error;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
504
547
|
};
|
|
505
548
|
__name(_DefaultStorage, "DefaultStorage");
|
|
506
549
|
var DefaultStorage = _DefaultStorage;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { MastraVector } from './chunk-
|
|
1
|
+
import { MastraVector } from './chunk-C55JWGDU.js';
|
|
2
2
|
import { BaseFilterTranslator } from './chunk-4LJFWC2Q.js';
|
|
3
3
|
import { __name, __publicField } from './chunk-AJJZUHB4.js';
|
|
4
4
|
import { createClient } from '@libsql/client';
|
|
5
|
+
import { join } from 'path';
|
|
5
6
|
|
|
6
7
|
// src/vector/libsql/filter.ts
|
|
7
8
|
var _LibSQLFilterTranslator = class _LibSQLFilterTranslator extends BaseFilterTranslator {
|
|
@@ -472,12 +473,25 @@ var _DefaultVectorDB = class _DefaultVectorDB extends MastraVector {
|
|
|
472
473
|
super();
|
|
473
474
|
__publicField(this, "turso");
|
|
474
475
|
this.turso = createClient({
|
|
475
|
-
url: connectionUrl,
|
|
476
|
+
url: this.rewriteDbUrl(connectionUrl),
|
|
476
477
|
syncUrl,
|
|
477
478
|
authToken,
|
|
478
479
|
syncInterval
|
|
479
480
|
});
|
|
480
481
|
}
|
|
482
|
+
rewriteDbUrl(url) {
|
|
483
|
+
if (url.startsWith("file:") && !url.startsWith("file:/")) {
|
|
484
|
+
const cwd = process.cwd();
|
|
485
|
+
const relativePath = url.slice("file:".length);
|
|
486
|
+
if (cwd.endsWith(".mastra") || cwd.endsWith(".mastra/")) {
|
|
487
|
+
const baseDir = join(cwd, `..`);
|
|
488
|
+
const fullPath = join(baseDir, relativePath);
|
|
489
|
+
this.logger.debug(`Initializing LibSQL db with url ${url} with relative file path from inside .mastra directory. Rewriting relative file url to "file:${fullPath}". This ensures it's outside the .mastra directory. If the db is stored inside .mastra it will be deleted when Mastra re-bundles code.`);
|
|
490
|
+
return `file:${fullPath}`;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return url;
|
|
494
|
+
}
|
|
481
495
|
transformFilter(filter) {
|
|
482
496
|
const libsqlFilter = new LibSQLFilterTranslator();
|
|
483
497
|
const translatedFilter = libsqlFilter.translate(filter ?? {});
|
package/dist/eval/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as Agent } from '../index-
|
|
1
|
+
import { a as Metric, M as MetricResult } from '../metric-BWeQNZt6.js';
|
|
2
|
+
import { A as Agent } from '../index-Cwb-5AzX.js';
|
|
3
3
|
import 'ai';
|
|
4
4
|
import 'json-schema';
|
|
5
5
|
import 'zod';
|
|
@@ -15,7 +15,7 @@ import 'sift';
|
|
|
15
15
|
import '../vector/index.js';
|
|
16
16
|
import '../tts/index.js';
|
|
17
17
|
|
|
18
|
-
declare function evaluate<T extends Agent>({ agentName, input, metric, output, runId, globalRunId, testInfo, }: {
|
|
18
|
+
declare function evaluate<T extends Agent>({ agentName, input, metric, output, runId, globalRunId, testInfo, instructions, }: {
|
|
19
19
|
agentName: string;
|
|
20
20
|
input: Parameters<T['generate']>[0];
|
|
21
21
|
metric: Metric;
|
|
@@ -26,6 +26,7 @@ declare function evaluate<T extends Agent>({ agentName, input, metric, output, r
|
|
|
26
26
|
testName?: string;
|
|
27
27
|
testPath?: string;
|
|
28
28
|
} | null;
|
|
29
|
+
instructions: string;
|
|
29
30
|
}): Promise<MetricResult>;
|
|
30
31
|
|
|
31
32
|
export { Metric, MetricResult, evaluate };
|
package/dist/eval/index.js
CHANGED
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as
|
|
1
|
+
import { M as MetricResult, a as Metric } from '../metric-BWeQNZt6.js';
|
|
2
2
|
|
|
3
3
|
type Handler<T = unknown> = (event: T) => void;
|
|
4
4
|
|
|
@@ -9,6 +9,8 @@ declare enum AvailableHooks {
|
|
|
9
9
|
declare function registerHook(hook: AvailableHooks.ON_EVALUATION, action: Handler<{
|
|
10
10
|
input: string;
|
|
11
11
|
output: string;
|
|
12
|
+
result: MetricResult;
|
|
13
|
+
meta: Record<string, any>;
|
|
12
14
|
}>): void;
|
|
13
15
|
declare function registerHook(hook: AvailableHooks.ON_GENERATION, action: Handler<{
|
|
14
16
|
input: string;
|
|
@@ -16,11 +18,13 @@ declare function registerHook(hook: AvailableHooks.ON_GENERATION, action: Handle
|
|
|
16
18
|
metric: Metric;
|
|
17
19
|
runId: string;
|
|
18
20
|
agentName: string;
|
|
21
|
+
instructions: string;
|
|
19
22
|
}>): void;
|
|
20
23
|
declare function executeHook(hook: AvailableHooks.ON_EVALUATION, action: {
|
|
21
24
|
input: string;
|
|
22
25
|
output: string;
|
|
23
26
|
result: MetricResult;
|
|
27
|
+
meta: Record<string, any>;
|
|
24
28
|
}): void;
|
|
25
29
|
declare function executeHook(hook: AvailableHooks.ON_GENERATION, action: {
|
|
26
30
|
input: string;
|
|
@@ -28,6 +32,7 @@ declare function executeHook(hook: AvailableHooks.ON_GENERATION, action: {
|
|
|
28
32
|
metric: Metric;
|
|
29
33
|
runId: string;
|
|
30
34
|
agentName: string;
|
|
35
|
+
instructions: string;
|
|
31
36
|
}): void;
|
|
32
37
|
|
|
33
38
|
export { AvailableHooks, executeHook, registerHook };
|
|
@@ -2,7 +2,7 @@ import { Message, UserContent, AssistantContent, ToolContent, CoreMessage as Cor
|
|
|
2
2
|
import { JSONSchema7 } from 'json-schema';
|
|
3
3
|
import { z, ZodSchema } from 'zod';
|
|
4
4
|
import { MastraBase } from './base.js';
|
|
5
|
-
import {
|
|
5
|
+
import { a as Metric } from './metric-BWeQNZt6.js';
|
|
6
6
|
import { T as Telemetry } from './telemetry-oCUM52DG.js';
|
|
7
7
|
import { Query } from 'sift';
|
|
8
8
|
import { B as BaseLogMessage, R as RegisteredLogger, L as Logger, b as Run } from './index-CBZ2mk2H.js';
|
|
@@ -317,6 +317,13 @@ type StorageGetMessagesArg = {
|
|
|
317
317
|
};
|
|
318
318
|
threadConfig?: MemoryConfig;
|
|
319
319
|
};
|
|
320
|
+
type EvalRow = {
|
|
321
|
+
result: string;
|
|
322
|
+
meta: string;
|
|
323
|
+
input: string;
|
|
324
|
+
output: string;
|
|
325
|
+
createdAt: string;
|
|
326
|
+
};
|
|
320
327
|
|
|
321
328
|
type TABLE_NAMES = typeof MastraStorage.TABLE_WORKFLOW_SNAPSHOT | typeof MastraStorage.TABLE_EVALS | typeof MastraStorage.TABLE_MESSAGES | typeof MastraStorage.TABLE_THREADS;
|
|
322
329
|
declare abstract class MastraStorage extends MastraBase {
|
|
@@ -436,7 +443,7 @@ type MemoryConfig = {
|
|
|
436
443
|
};
|
|
437
444
|
};
|
|
438
445
|
type SharedMemoryConfig = {
|
|
439
|
-
storage
|
|
446
|
+
storage?: MastraStorage;
|
|
440
447
|
options?: MemoryConfig;
|
|
441
448
|
vector?: MastraVector;
|
|
442
449
|
embedder?: EmbeddingModel<string>;
|
|
@@ -463,6 +470,9 @@ declare abstract class MastraMemory extends MastraBase {
|
|
|
463
470
|
threadId: string;
|
|
464
471
|
memoryConfig?: MemoryConfig;
|
|
465
472
|
}): Promise<string | null>;
|
|
473
|
+
protected createEmbeddingIndex(): Promise<{
|
|
474
|
+
indexName: string;
|
|
475
|
+
}>;
|
|
466
476
|
protected getEmbedder(): EmbeddingModel<string>;
|
|
467
477
|
protected getMergedThreadConfig(config?: MemoryConfig): MemoryConfig;
|
|
468
478
|
abstract rememberMessages({ threadId, vectorMessageSearch, config, }: {
|
|
@@ -708,6 +718,7 @@ declare class MastraLLMBase extends MastraBase {
|
|
|
708
718
|
model: LanguageModel$1;
|
|
709
719
|
});
|
|
710
720
|
getProvider(): string;
|
|
721
|
+
getModelId(): string;
|
|
711
722
|
convertToMessages(messages: string | string[] | CoreMessage$1[]): CoreMessage$1[];
|
|
712
723
|
__registerPrimitives(p: MastraPrimitives): void;
|
|
713
724
|
__text(input: LLMTextOptions): Promise<GenerateTextResult<any, any>>;
|
|
@@ -722,13 +733,14 @@ declare class Agent<TTools extends Record<string, ToolAction<any, any, any, any>
|
|
|
722
733
|
#private;
|
|
723
734
|
name: string;
|
|
724
735
|
readonly llm: MastraLLMBase;
|
|
725
|
-
|
|
736
|
+
instructions: string;
|
|
726
737
|
readonly model?: LanguageModelV1;
|
|
727
738
|
tools: TTools;
|
|
728
739
|
metrics: TMetrics;
|
|
729
740
|
constructor(config: AgentConfig<TTools, TMetrics>);
|
|
730
741
|
hasOwnMemory(): boolean;
|
|
731
742
|
getMemory(): MastraMemory | undefined;
|
|
743
|
+
__updateInstructions(newInstructions: string): void;
|
|
732
744
|
__registerPrimitives(p: MastraPrimitives): void;
|
|
733
745
|
/**
|
|
734
746
|
* Set the concrete tools for the agent
|
|
@@ -801,4 +813,4 @@ declare class Agent<TTools extends Record<string, ToolAction<any, any, any, any>
|
|
|
801
813
|
stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], { context, threadId: threadIdInFn, memoryOptions, resourceId, maxSteps, onFinish, onStepFinish, runId, toolsets, output, temperature, toolChoice, }?: AgentStreamOptions<Z>): Promise<StreamReturn<Z>>;
|
|
802
814
|
}
|
|
803
815
|
|
|
804
|
-
export { type
|
|
816
|
+
export { type StepDef as $, Agent as A, type BaseStructuredOutputType as B, type CoreMessage as C, type LLMTextObjectOptions as D, type EvalRow as E, type LLMInnerStreamOptions as F, type GenerateReturn as G, type LLMStreamObjectOptions as H, type IAction as I, type AiMessageType as J, type MessageType as K, type LanguageModel as L, MastraStorage as M, type StorageThreadType as N, type OutputType as O, type MessageResponse as P, type MemoryConfig as Q, type RetryConfig as R, type StepExecutionContext as S, type ToolAction as T, type SharedMemoryConfig as U, type CoreTool as V, type WorkflowOptions as W, type StepNode as X, type VariableReference as Y, type BaseCondition as Z, type ActionContext as _, MastraMemory as a, type StepCondition as a0, type WorkflowContext as a1, type WorkflowLogMessage as a2, type WorkflowEvent as a3, type ResolverFunctionInput as a4, type ResolverFunctionOutput as a5, type SubscriberFunctionOutput as a6, type DependencyCheckOutput as a7, type WorkflowActors as a8, type WorkflowActionParams as a9, type WorkflowActions as aa, type WorkflowState as ab, type StepId as ac, type ExtractSchemaFromStep as ad, type ExtractStepResult as ae, type StepInputType as af, type ExtractSchemaType as ag, type PathsToStringProps as ah, type StepAction as b, type MastraPrimitives as c, type StepVariableType as d, type StepConfig as e, type StepResult as f, type WorkflowRunState as g, type StepGraph as h, type AgentConfig as i, type ToolExecutionContext as j, type TABLE_NAMES as k, type StorageColumn as l, type WorkflowRow as m, type StorageGetMessagesArg as n, type CoreSystemMessage as o, type CoreAssistantMessage as p, type CoreUserMessage as q, type CoreToolMessage as r, type EmbedResult as s, type EmbedManyResult as t, type StructuredOutputType as u, type StructuredOutputArrayItem as v, type StructuredOutput as w, type StreamReturn as x, type LLMStreamOptions as y, type LLMTextOptions as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { T as ToolAction, A as Agent$1, i as AgentConfig, M as MastraStorage$1, a as MastraMemory$1, j as ToolExecutionContext, W as WorkflowOptions } from './index-
|
|
4
|
-
export {
|
|
1
|
+
import { a as Metric } from './metric-BWeQNZt6.js';
|
|
2
|
+
export { M as MetricResult } from './metric-BWeQNZt6.js';
|
|
3
|
+
import { T as ToolAction, A as Agent$1, i as AgentConfig, M as MastraStorage$1, a as MastraMemory$1, j as ToolExecutionContext, W as WorkflowOptions } from './index-Cwb-5AzX.js';
|
|
4
|
+
export { _ as ActionContext, J as AiMessageType, Z as BaseCondition, B as BaseStructuredOutputType, p as CoreAssistantMessage, C as CoreMessage, o as CoreSystemMessage, V as CoreTool, r as CoreToolMessage, q as CoreUserMessage, a7 as DependencyCheckOutput, t as EmbedManyResult, s as EmbedResult, E as EvalRow, ad as ExtractSchemaFromStep, ag as ExtractSchemaType, ae as ExtractStepResult, G as GenerateReturn, F as LLMInnerStreamOptions, H as LLMStreamObjectOptions, y as LLMStreamOptions, D as LLMTextObjectOptions, z as LLMTextOptions, L as LanguageModel, Q as MemoryConfig, P as MessageResponse, K as MessageType, O as OutputType, ah as PathsToStringProps, a4 as ResolverFunctionInput, a5 as ResolverFunctionOutput, R as RetryConfig, U as SharedMemoryConfig, b as StepAction, a0 as StepCondition, e as StepConfig, $ as StepDef, S as StepExecutionContext, h as StepGraph, ac as StepId, af as StepInputType, X as StepNode, f as StepResult, d as StepVariableType, l as StorageColumn, n as StorageGetMessagesArg, N as StorageThreadType, x as StreamReturn, w as StructuredOutput, v as StructuredOutputArrayItem, u as StructuredOutputType, a6 as SubscriberFunctionOutput, k as TABLE_NAMES, Y as VariableReference, a9 as WorkflowActionParams, aa as WorkflowActions, a8 as WorkflowActors, a1 as WorkflowContext, a3 as WorkflowEvent, a2 as WorkflowLogMessage, m as WorkflowRow, g as WorkflowRunState, ab as WorkflowState } from './index-Cwb-5AzX.js';
|
|
5
5
|
export { O as OtelConfig, S as SamplingStrategy, T as Telemetry } from './telemetry-oCUM52DG.js';
|
|
6
6
|
import { MastraBase as MastraBase$1 } from './base.js';
|
|
7
7
|
import { R as RegisteredLogger, a as LogLevel, T as TransportMap, L as Logger } from './index-CBZ2mk2H.js';
|
|
@@ -19,9 +19,9 @@ export { createTool } from './tools/index.js';
|
|
|
19
19
|
import { MastraTTS as MastraTTS$1, TTSConfig } from './tts/index.js';
|
|
20
20
|
export { TagMaskOptions, deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './utils.js';
|
|
21
21
|
import { MastraVector as MastraVector$1 } from './vector/index.js';
|
|
22
|
-
export { IndexStats, QueryResult } from './vector/index.js';
|
|
23
|
-
import { S as Step, W as Workflow$1 } from './workflow-
|
|
24
|
-
export { c as createStep } from './workflow-
|
|
22
|
+
export { IndexStats, QueryResult, localEmbedder } from './vector/index.js';
|
|
23
|
+
import { S as Step, W as Workflow$1 } from './workflow-DTtv7_Eq.js';
|
|
24
|
+
export { c as createStep } from './workflow-DTtv7_Eq.js';
|
|
25
25
|
export { getStepResult, isErrorEvent, isTransitionEvent, isVariableReference } from './workflows/index.js';
|
|
26
26
|
export { AvailableHooks, executeHook, registerHook } from './hooks/index.js';
|
|
27
27
|
export { ArrayOperator, BaseFilterTranslator, BasicOperator, ElementOperator, FieldCondition, Filter, LogicalOperator, NumericOperator, OperatorCondition, OperatorSupport, QueryOperator, RegexOperator } from './filter/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { MastraStorage, DefaultStorage } from './chunk-EULBQ77C.js';
|
|
2
|
-
export { DefaultStorage } from './chunk-EULBQ77C.js';
|
|
3
1
|
import { MastraTTS } from './chunk-K3N7KJHH.js';
|
|
4
2
|
import { Workflow } from './chunk-MDM2JS2U.js';
|
|
5
3
|
export { Step, createStep, getStepResult, isErrorEvent, isTransitionEvent, isVariableReference } from './chunk-MDM2JS2U.js';
|
|
6
|
-
export { DefaultVectorDB, DefaultVectorDB as LibSQLVector } from './chunk-5DZIXJRV.js';
|
|
7
|
-
import { MastraVector } from './chunk-MBOUQZQT.js';
|
|
8
|
-
export { BaseFilterTranslator } from './chunk-4LJFWC2Q.js';
|
|
9
4
|
import { Integration, OpenAPIToolset } from './chunk-42DYOLDV.js';
|
|
10
5
|
import { Tool } from './chunk-VOUPGVRD.js';
|
|
11
6
|
export { createTool } from './chunk-VOUPGVRD.js';
|
|
12
7
|
import './chunk-AE3H2QEY.js';
|
|
13
|
-
export { Mastra } from './chunk-
|
|
14
|
-
import { MastraMemory } from './chunk-
|
|
15
|
-
export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from './chunk-
|
|
16
|
-
import {
|
|
8
|
+
export { Mastra } from './chunk-DHCULRJM.js';
|
|
9
|
+
import { MastraMemory } from './chunk-HPXWJBQK.js';
|
|
10
|
+
export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from './chunk-A7SNFYQB.js';
|
|
11
|
+
import { MastraStorage, DefaultStorage } from './chunk-Z7JFMQZZ.js';
|
|
12
|
+
export { DefaultStorage } from './chunk-Z7JFMQZZ.js';
|
|
13
|
+
export { DefaultVectorDB, DefaultVectorDB as LibSQLVector } from './chunk-ZJOMHCWE.js';
|
|
14
|
+
import { MastraVector } from './chunk-C55JWGDU.js';
|
|
15
|
+
export { localEmbedder } from './chunk-C55JWGDU.js';
|
|
16
|
+
import { Agent } from './chunk-EO3TIPGQ.js';
|
|
17
17
|
export { InstrumentClass, Telemetry, hasActiveTelemetry, withSpan } from './chunk-4ZUSEHLH.js';
|
|
18
18
|
export { deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './chunk-KNPBNSJ7.js';
|
|
19
19
|
import { MastraDeployer } from './chunk-JJ57BXQR.js';
|
|
20
|
+
export { Metric, evaluate } from './chunk-JP37ODNX.js';
|
|
21
|
+
export { AvailableHooks, executeHook, registerHook } from './chunk-HBTQNIAX.js';
|
|
20
22
|
import './chunk-MCB4M5W4.js';
|
|
21
23
|
import { MastraBase } from './chunk-G4MCO7XF.js';
|
|
22
24
|
import { createLogger } from './chunk-ICMEXHKD.js';
|
|
23
25
|
export { LogLevel, Logger, LoggerTransport, MultiLogger, RegisteredLogger, combineLoggers, noopLogger } from './chunk-ICMEXHKD.js';
|
|
24
|
-
export {
|
|
25
|
-
export { AvailableHooks, executeHook, registerHook } from './chunk-HBTQNIAX.js';
|
|
26
|
+
export { BaseFilterTranslator } from './chunk-4LJFWC2Q.js';
|
|
26
27
|
import { __name } from './chunk-AJJZUHB4.js';
|
|
27
28
|
|
|
28
29
|
// src/agent/index.warning.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../telemetry-oCUM52DG.js';
|
|
2
|
-
import { W as Workflow } from '../workflow-
|
|
3
|
-
import { T as ToolAction } from '../index-
|
|
2
|
+
import { W as Workflow } from '../workflow-DTtv7_Eq.js';
|
|
3
|
+
import { T as ToolAction } from '../index-Cwb-5AzX.js';
|
|
4
4
|
import '@opentelemetry/api';
|
|
5
5
|
import '@opentelemetry/sdk-node';
|
|
6
6
|
import '@opentelemetry/sdk-trace-base';
|
|
@@ -12,7 +12,7 @@ import 'pino';
|
|
|
12
12
|
import 'stream';
|
|
13
13
|
import 'ai';
|
|
14
14
|
import 'json-schema';
|
|
15
|
-
import '../metric-
|
|
15
|
+
import '../metric-BWeQNZt6.js';
|
|
16
16
|
import 'sift';
|
|
17
17
|
import '../vector/index.js';
|
|
18
18
|
import '../tts/index.js';
|
package/dist/llm/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export { B as BaseStructuredOutputType, p as CoreAssistantMessage, C as CoreMessage, o as CoreSystemMessage, r as CoreToolMessage, q as CoreUserMessage,
|
|
4
|
+
export { B as BaseStructuredOutputType, p as CoreAssistantMessage, C as CoreMessage, o as CoreSystemMessage, r as CoreToolMessage, q as CoreUserMessage, t as EmbedManyResult, s as EmbedResult, G as GenerateReturn, F as LLMInnerStreamOptions, H as LLMStreamObjectOptions, y as LLMStreamOptions, D as LLMTextObjectOptions, z as LLMTextOptions, L as LanguageModel, O as OutputType, x as StreamReturn, w as StructuredOutput, v as StructuredOutputArrayItem, u as StructuredOutputType } from '../index-Cwb-5AzX.js';
|
|
5
5
|
import '../index-CBZ2mk2H.js';
|
|
6
6
|
import '../base.js';
|
|
7
7
|
import '@opentelemetry/api';
|
|
@@ -10,7 +10,7 @@ import '@opentelemetry/sdk-node';
|
|
|
10
10
|
import '@opentelemetry/sdk-trace-base';
|
|
11
11
|
import 'pino';
|
|
12
12
|
import 'stream';
|
|
13
|
-
import '../metric-
|
|
13
|
+
import '../metric-BWeQNZt6.js';
|
|
14
14
|
import 'sift';
|
|
15
15
|
import '../vector/index.js';
|
|
16
16
|
import '../tts/index.js';
|
package/dist/mastra/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as Agent, M as MastraStorage, a as MastraMemory } from '../index-
|
|
1
|
+
import { A as Agent, M as MastraStorage, a as MastraMemory } from '../index-Cwb-5AzX.js';
|
|
2
2
|
import { L as Logger, B as BaseLogMessage } from '../index-CBZ2mk2H.js';
|
|
3
|
-
import { W as Workflow } from '../workflow-
|
|
3
|
+
import { W as Workflow } from '../workflow-DTtv7_Eq.js';
|
|
4
4
|
import { MastraVector } from '../vector/index.js';
|
|
5
5
|
import { O as OtelConfig, T as Telemetry } from '../telemetry-oCUM52DG.js';
|
|
6
6
|
import { MastraTTS } from '../tts/index.js';
|
|
@@ -10,7 +10,7 @@ import 'json-schema';
|
|
|
10
10
|
import 'zod';
|
|
11
11
|
import '../base.js';
|
|
12
12
|
import '@opentelemetry/api';
|
|
13
|
-
import '../metric-
|
|
13
|
+
import '../metric-BWeQNZt6.js';
|
|
14
14
|
import 'sift';
|
|
15
15
|
import 'pino';
|
|
16
16
|
import 'stream';
|
package/dist/mastra/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
export { Mastra } from '../chunk-
|
|
1
|
+
export { Mastra } from '../chunk-DHCULRJM.js';
|
|
2
|
+
import '../chunk-Z7JFMQZZ.js';
|
|
3
|
+
import '../chunk-ZJOMHCWE.js';
|
|
4
|
+
import '../chunk-C55JWGDU.js';
|
|
2
5
|
import '../chunk-4ZUSEHLH.js';
|
|
6
|
+
import '../chunk-G4MCO7XF.js';
|
|
3
7
|
import '../chunk-ICMEXHKD.js';
|
|
8
|
+
import '../chunk-4LJFWC2Q.js';
|
|
4
9
|
import '../chunk-AJJZUHB4.js';
|
package/dist/memory/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'ai';
|
|
2
2
|
import '../base.js';
|
|
3
|
-
export {
|
|
3
|
+
export { J as AiMessageType, a as MastraMemory, Q as MemoryConfig, P as MessageResponse, K as MessageType, U as SharedMemoryConfig, N as StorageThreadType } from '../index-Cwb-5AzX.js';
|
|
4
4
|
import '../vector/index.js';
|
|
5
5
|
import '@opentelemetry/api';
|
|
6
6
|
import '../index-CBZ2mk2H.js';
|
|
@@ -11,6 +11,6 @@ import '@opentelemetry/sdk-node';
|
|
|
11
11
|
import '@opentelemetry/sdk-trace-base';
|
|
12
12
|
import 'json-schema';
|
|
13
13
|
import 'zod';
|
|
14
|
-
import '../metric-
|
|
14
|
+
import '../metric-BWeQNZt6.js';
|
|
15
15
|
import 'sift';
|
|
16
16
|
import '../tts/index.js';
|
package/dist/memory/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export { MastraMemory } from '../chunk-
|
|
1
|
+
export { MastraMemory } from '../chunk-HPXWJBQK.js';
|
|
2
|
+
import '../chunk-Z7JFMQZZ.js';
|
|
3
|
+
import '../chunk-ZJOMHCWE.js';
|
|
4
|
+
import '../chunk-C55JWGDU.js';
|
|
2
5
|
import '../chunk-KNPBNSJ7.js';
|
|
3
6
|
import '../chunk-G4MCO7XF.js';
|
|
4
7
|
import '../chunk-ICMEXHKD.js';
|
|
8
|
+
import '../chunk-4LJFWC2Q.js';
|
|
5
9
|
import '../chunk-AJJZUHB4.js';
|
package/dist/relevance/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from '../chunk-A7SNFYQB.js';
|
|
2
|
+
import '../chunk-EO3TIPGQ.js';
|
|
3
3
|
import '../chunk-4ZUSEHLH.js';
|
|
4
4
|
import '../chunk-KNPBNSJ7.js';
|
|
5
|
+
import '../chunk-HBTQNIAX.js';
|
|
5
6
|
import '../chunk-G4MCO7XF.js';
|
|
6
7
|
import '../chunk-ICMEXHKD.js';
|
|
7
|
-
import '../chunk-HBTQNIAX.js';
|
|
8
8
|
import '../chunk-AJJZUHB4.js';
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MastraStorage, k as TABLE_NAMES, l as StorageColumn,
|
|
2
|
-
export { m as WorkflowRow } from '../index-
|
|
1
|
+
import { M as MastraStorage, k as TABLE_NAMES, l as StorageColumn, N as StorageThreadType, K as MessageType, n as StorageGetMessagesArg, E as EvalRow } from '../index-Cwb-5AzX.js';
|
|
2
|
+
export { m as WorkflowRow } from '../index-Cwb-5AzX.js';
|
|
3
3
|
import '../telemetry-oCUM52DG.js';
|
|
4
4
|
export { LibSQLVector as DefaultVectorDB, LibSQLVector } from '../vector/libsql/index.js';
|
|
5
5
|
import 'ai';
|
|
@@ -12,7 +12,7 @@ import 'pino';
|
|
|
12
12
|
import 'stream';
|
|
13
13
|
import '@opentelemetry/sdk-node';
|
|
14
14
|
import '@opentelemetry/sdk-trace-base';
|
|
15
|
-
import '../metric-
|
|
15
|
+
import '../metric-BWeQNZt6.js';
|
|
16
16
|
import 'sift';
|
|
17
17
|
import '../vector/index.js';
|
|
18
18
|
import '../tts/index.js';
|
|
@@ -27,6 +27,7 @@ declare class DefaultStorage extends MastraStorage {
|
|
|
27
27
|
constructor({ config }: {
|
|
28
28
|
config: LibSQLConfig;
|
|
29
29
|
});
|
|
30
|
+
protected rewriteDbUrl(url: string): string;
|
|
30
31
|
private getCreateTableSQL;
|
|
31
32
|
createTable({ tableName, schema, }: {
|
|
32
33
|
tableName: TABLE_NAMES;
|
|
@@ -65,6 +66,7 @@ declare class DefaultStorage extends MastraStorage {
|
|
|
65
66
|
saveMessages({ messages }: {
|
|
66
67
|
messages: MessageType[];
|
|
67
68
|
}): Promise<MessageType[]>;
|
|
69
|
+
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
68
70
|
}
|
|
69
71
|
|
|
70
|
-
export { DefaultStorage, type LibSQLConfig, MastraStorage, DefaultStorage as MastraStorageLibSql, StorageColumn, StorageGetMessagesArg, TABLE_NAMES };
|
|
72
|
+
export { DefaultStorage, EvalRow, type LibSQLConfig, MastraStorage, DefaultStorage as MastraStorageLibSql, StorageColumn, StorageGetMessagesArg, TABLE_NAMES };
|
package/dist/storage/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { DefaultStorage, MastraStorage, DefaultStorage as MastraStorageLibSql } from '../chunk-
|
|
2
|
-
export { DefaultVectorDB, DefaultVectorDB as LibSQLVector } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-4LJFWC2Q.js';
|
|
1
|
+
export { DefaultStorage, MastraStorage, DefaultStorage as MastraStorageLibSql } from '../chunk-Z7JFMQZZ.js';
|
|
2
|
+
export { DefaultVectorDB, DefaultVectorDB as LibSQLVector } from '../chunk-ZJOMHCWE.js';
|
|
3
|
+
import '../chunk-C55JWGDU.js';
|
|
5
4
|
import '../chunk-G4MCO7XF.js';
|
|
6
5
|
import '../chunk-ICMEXHKD.js';
|
|
6
|
+
import '../chunk-4LJFWC2Q.js';
|
|
7
7
|
import '../chunk-AJJZUHB4.js';
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { j as ToolExecutionContext, T as ToolAction, c as MastraPrimitives } from '../index-
|
|
3
|
-
export {
|
|
2
|
+
import { j as ToolExecutionContext, T as ToolAction, c as MastraPrimitives } from '../index-Cwb-5AzX.js';
|
|
3
|
+
export { V as CoreTool } from '../index-Cwb-5AzX.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import 'json-schema';
|
|
6
6
|
import '../base.js';
|
|
@@ -11,7 +11,7 @@ import 'stream';
|
|
|
11
11
|
import '../telemetry-oCUM52DG.js';
|
|
12
12
|
import '@opentelemetry/sdk-node';
|
|
13
13
|
import '@opentelemetry/sdk-trace-base';
|
|
14
|
-
import '../metric-
|
|
14
|
+
import '../metric-BWeQNZt6.js';
|
|
15
15
|
import 'sift';
|
|
16
16
|
import '../vector/index.js';
|
|
17
17
|
import '../tts/index.js';
|
package/dist/vector/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MastraBase } from '../base.js';
|
|
2
|
+
import * as ai from 'ai';
|
|
2
3
|
import '@opentelemetry/api';
|
|
3
4
|
import '../index-CBZ2mk2H.js';
|
|
4
5
|
import 'pino';
|
|
@@ -7,6 +8,8 @@ import '../telemetry-oCUM52DG.js';
|
|
|
7
8
|
import '@opentelemetry/sdk-node';
|
|
8
9
|
import '@opentelemetry/sdk-trace-base';
|
|
9
10
|
|
|
11
|
+
declare const localEmbedder: (modelId: string) => ai.EmbeddingModel<string>;
|
|
12
|
+
|
|
10
13
|
interface QueryResult {
|
|
11
14
|
id: string;
|
|
12
15
|
score: number;
|
|
@@ -28,4 +31,4 @@ declare abstract class MastraVector extends MastraBase {
|
|
|
28
31
|
abstract deleteIndex(indexName: string): Promise<void>;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
export { type IndexStats, MastraVector, type QueryResult };
|
|
34
|
+
export { type IndexStats, MastraVector, type QueryResult, localEmbedder };
|
package/dist/vector/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import 'stream';
|
|
|
8
8
|
import '../../telemetry-oCUM52DG.js';
|
|
9
9
|
import '@opentelemetry/sdk-node';
|
|
10
10
|
import '@opentelemetry/sdk-trace-base';
|
|
11
|
+
import 'ai';
|
|
11
12
|
|
|
12
13
|
declare class DefaultVectorDB extends MastraVector {
|
|
13
14
|
private turso;
|
|
@@ -17,6 +18,7 @@ declare class DefaultVectorDB extends MastraVector {
|
|
|
17
18
|
syncUrl?: string;
|
|
18
19
|
syncInterval?: number;
|
|
19
20
|
});
|
|
21
|
+
protected rewriteDbUrl(url: string): string;
|
|
20
22
|
transformFilter(filter?: Filter): Filter;
|
|
21
23
|
query(indexName: string, queryVector: number[], topK?: number, filter?: Filter, includeVector?: boolean, minScore?: number): Promise<QueryResult[]>;
|
|
22
24
|
upsert(indexName: string, vectors: number[][], metadata?: Record<string, any>[], ids?: string[]): Promise<string[]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { DefaultVectorDB, DefaultVectorDB as LibSQLVector } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-4LJFWC2Q.js';
|
|
1
|
+
export { DefaultVectorDB, DefaultVectorDB as LibSQLVector } from '../../chunk-ZJOMHCWE.js';
|
|
2
|
+
import '../../chunk-C55JWGDU.js';
|
|
4
3
|
import '../../chunk-G4MCO7XF.js';
|
|
5
4
|
import '../../chunk-ICMEXHKD.js';
|
|
5
|
+
import '../../chunk-4LJFWC2Q.js';
|
|
6
6
|
import '../../chunk-AJJZUHB4.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Snapshot } from 'xstate';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { S as StepExecutionContext, b as StepAction, R as RetryConfig, c as MastraPrimitives, W as WorkflowOptions, I as IAction, d as StepVariableType, e as StepConfig, f as StepResult, g as WorkflowRunState, h as StepGraph } from './index-
|
|
3
|
+
import { S as StepExecutionContext, b as StepAction, R as RetryConfig, c as MastraPrimitives, W as WorkflowOptions, I as IAction, d as StepVariableType, e as StepConfig, f as StepResult, g as WorkflowRunState, h as StepGraph } from './index-Cwb-5AzX.js';
|
|
4
4
|
import { MastraBase } from './base.js';
|
|
5
5
|
|
|
6
6
|
declare class Step<TStepId extends string = any, TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends StepExecutionContext<TSchemaIn> = StepExecutionContext<TSchemaIn>> implements StepAction<TStepId, TSchemaIn, TSchemaOut, TContext> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { S as Step, W as Workflow, c as createStep } from '../workflow-
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
1
|
+
export { S as Step, W as Workflow, c as createStep } from '../workflow-DTtv7_Eq.js';
|
|
2
|
+
import { Y as VariableReference, f as StepResult } from '../index-Cwb-5AzX.js';
|
|
3
|
+
export { _ as ActionContext, Z as BaseCondition, a7 as DependencyCheckOutput, ad as ExtractSchemaFromStep, ag as ExtractSchemaType, ae as ExtractStepResult, ah as PathsToStringProps, a4 as ResolverFunctionInput, a5 as ResolverFunctionOutput, R as RetryConfig, b as StepAction, a0 as StepCondition, e as StepConfig, $ as StepDef, S as StepExecutionContext, h as StepGraph, ac as StepId, af as StepInputType, X as StepNode, d as StepVariableType, a6 as SubscriberFunctionOutput, a9 as WorkflowActionParams, aa as WorkflowActions, a8 as WorkflowActors, a1 as WorkflowContext, a3 as WorkflowEvent, a2 as WorkflowLogMessage, W as WorkflowOptions, g as WorkflowRunState, ab as WorkflowState } from '../index-Cwb-5AzX.js';
|
|
4
4
|
import 'xstate';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '../base.js';
|
|
@@ -13,7 +13,7 @@ import '@opentelemetry/sdk-node';
|
|
|
13
13
|
import '@opentelemetry/sdk-trace-base';
|
|
14
14
|
import 'ai';
|
|
15
15
|
import 'json-schema';
|
|
16
|
-
import '../metric-
|
|
16
|
+
import '../metric-BWeQNZt6.js';
|
|
17
17
|
import 'sift';
|
|
18
18
|
import '../vector/index.js';
|
|
19
19
|
import '../tts/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/core",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.99",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/core.esm.js",
|
|
@@ -58,7 +58,10 @@
|
|
|
58
58
|
"@opentelemetry/semantic-conventions": "^1.28.0",
|
|
59
59
|
"cohere-ai": "^7.15.4",
|
|
60
60
|
"date-fns": "^3.0.5",
|
|
61
|
+
"dotenv": "^16.4.7",
|
|
62
|
+
"fastembed": "^1.14.1",
|
|
61
63
|
"json-schema": "^0.4.0",
|
|
64
|
+
"node_modules-path": "^2.0.8",
|
|
62
65
|
"pino": "^9.6.0",
|
|
63
66
|
"pino-pretty": "^13.0.0",
|
|
64
67
|
"radash": "^12.1.0",
|
|
@@ -121,8 +124,9 @@
|
|
|
121
124
|
"scripts": {
|
|
122
125
|
"check": "tsc --noEmit",
|
|
123
126
|
"analyze": "size-limit --why",
|
|
124
|
-
"
|
|
125
|
-
"build
|
|
127
|
+
"prebuild": "pnpm check",
|
|
128
|
+
"build": "tsup src/index.ts src/base.ts src/utils.ts !src/action/index.ts src/*/index.ts src/vector/libsql/index.ts --format esm --clean --dts --treeshake",
|
|
129
|
+
"build:watch": "pnpm build --watch",
|
|
126
130
|
"size": "size-limit",
|
|
127
131
|
"test": "vitest run"
|
|
128
132
|
}
|
package/dist/action/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import 'zod';
|
|
2
|
-
export { I as IAction, ah as IExecutionContext, c as MastraPrimitives } from '../index-M8e8RIkM.js';
|
|
3
|
-
import '../index-CBZ2mk2H.js';
|
|
4
|
-
import '../telemetry-oCUM52DG.js';
|
|
5
|
-
import '../vector/index.js';
|
|
6
|
-
import '../tts/index.js';
|
|
7
|
-
import 'ai';
|
|
8
|
-
import 'json-schema';
|
|
9
|
-
import '../base.js';
|
|
10
|
-
import '@opentelemetry/api';
|
|
11
|
-
import 'pino';
|
|
12
|
-
import 'stream';
|
|
13
|
-
import '@opentelemetry/sdk-node';
|
|
14
|
-
import '@opentelemetry/sdk-trace-base';
|
|
15
|
-
import '../metric-D2V4CR8D.js';
|
|
16
|
-
import 'sift';
|
package/dist/action/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/dist/chunk-MBOUQZQT.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { MastraBase } from './chunk-G4MCO7XF.js';
|
|
2
|
-
import { __name } from './chunk-AJJZUHB4.js';
|
|
3
|
-
|
|
4
|
-
// src/vector/index.ts
|
|
5
|
-
var _MastraVector = class _MastraVector extends MastraBase {
|
|
6
|
-
constructor() {
|
|
7
|
-
super({
|
|
8
|
-
name: "MastraVector",
|
|
9
|
-
component: "VECTOR"
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
__name(_MastraVector, "MastraVector");
|
|
14
|
-
var MastraVector = _MastraVector;
|
|
15
|
-
|
|
16
|
-
export { MastraVector };
|