@mastra/core 0.9.2-alpha.3 → 0.9.2-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/bundler/index.d.cts +2 -0
- package/dist/bundler/index.d.ts +2 -0
- package/dist/{chunk-Z4MZ3ZUM.js → chunk-C3BIQDW3.js} +1 -1
- package/dist/{chunk-OPUU4S32.cjs → chunk-CGW7H7VD.cjs} +5 -5
- package/dist/{chunk-VQ7AM4ZV.js → chunk-KHSHYGJU.js} +1 -1
- package/dist/{chunk-AVAHVCWY.cjs → chunk-MJL6FUJI.cjs} +4 -0
- package/dist/{chunk-EIMOKGTI.cjs → chunk-QESYVGP2.cjs} +2 -2
- package/dist/{chunk-6YY6MN2Z.js → chunk-TNZMJBPN.js} +64 -53
- package/dist/{chunk-2IXADNQJ.js → chunk-WFJL654W.js} +4 -0
- package/dist/{chunk-VXUCE4GF.cjs → chunk-WQVDK654.cjs} +64 -53
- package/dist/{chunk-Z3OKCJ62.js → chunk-Y5SHDNH4.js} +57 -3
- package/dist/{chunk-RSPHEENE.cjs → chunk-YHTPTGCJ.cjs} +60 -6
- package/dist/index.cjs +33 -33
- package/dist/index.js +6 -6
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +2 -2
- package/dist/network/index.js +1 -1
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.js +1 -1
- package/dist/workflows/index.cjs +22 -22
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/vNext/index.cjs +49 -7
- package/dist/workflows/vNext/index.d.cts +7 -4
- package/dist/workflows/vNext/index.d.ts +7 -4
- package/dist/workflows/vNext/index.js +48 -6
- package/package.json +1 -1
- package/storage/libsql.d.ts +1 -1
- package/telemetry/otel-vendor.d.ts +1 -1
- package/vector/filter.d.ts +1 -1
- package/vector/libsql.d.ts +1 -1
- package/workflows/vNext.d.ts +1 -1
package/dist/agent/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkWQVDK654_cjs = require('../chunk-WQVDK654.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Agent", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkWQVDK654_cjs.Agent; }
|
|
10
10
|
});
|
package/dist/agent/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Agent } from '../chunk-
|
|
1
|
+
export { Agent } from '../chunk-TNZMJBPN.js';
|
package/dist/bundler/index.d.cts
CHANGED
|
@@ -11,6 +11,7 @@ interface IBundler {
|
|
|
11
11
|
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
12
12
|
prepare(outputDirectory: string): Promise<void>;
|
|
13
13
|
writePackageJson(outputDirectory: string, dependencies: Map<string, string>): Promise<void>;
|
|
14
|
+
lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
14
15
|
}
|
|
15
16
|
declare abstract class MastraBundler extends MastraBase implements IBundler {
|
|
16
17
|
constructor({ name, component }: {
|
|
@@ -23,6 +24,7 @@ declare abstract class MastraBundler extends MastraBase implements IBundler {
|
|
|
23
24
|
abstract writeInstrumentationFile(outputDirectory: string): Promise<void>;
|
|
24
25
|
abstract getEnvFiles(): Promise<string[]>;
|
|
25
26
|
abstract bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
27
|
+
abstract lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export { type IBundler, MastraBundler };
|
package/dist/bundler/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ interface IBundler {
|
|
|
11
11
|
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
12
12
|
prepare(outputDirectory: string): Promise<void>;
|
|
13
13
|
writePackageJson(outputDirectory: string, dependencies: Map<string, string>): Promise<void>;
|
|
14
|
+
lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
14
15
|
}
|
|
15
16
|
declare abstract class MastraBundler extends MastraBase implements IBundler {
|
|
16
17
|
constructor({ name, component }: {
|
|
@@ -23,6 +24,7 @@ declare abstract class MastraBundler extends MastraBase implements IBundler {
|
|
|
23
24
|
abstract writeInstrumentationFile(outputDirectory: string): Promise<void>;
|
|
24
25
|
abstract getEnvFiles(): Promise<string[]>;
|
|
25
26
|
abstract bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
27
|
+
abstract lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export { type IBundler, MastraBundler };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefaultProxyStorage, augmentWithInit } from './chunk-
|
|
1
|
+
import { DefaultProxyStorage, augmentWithInit } from './chunk-WFJL654W.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';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMJL6FUJI_cjs = require('./chunk-MJL6FUJI.cjs');
|
|
4
4
|
var chunkMYHX5XVW_cjs = require('./chunk-MYHX5XVW.cjs');
|
|
5
5
|
var chunkO7IW545H_cjs = require('./chunk-O7IW545H.cjs');
|
|
6
6
|
var chunkRWTSGWWL_cjs = require('./chunk-RWTSGWWL.cjs');
|
|
@@ -67,13 +67,13 @@ exports.Mastra = class Mastra {
|
|
|
67
67
|
this.#logger = logger;
|
|
68
68
|
let storage = config?.storage;
|
|
69
69
|
if (!storage) {
|
|
70
|
-
storage = new
|
|
70
|
+
storage = new chunkMJL6FUJI_cjs.DefaultProxyStorage({
|
|
71
71
|
config: {
|
|
72
72
|
url: process.env.MASTRA_DEFAULT_STORAGE_URL || `:memory:`
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
storage =
|
|
76
|
+
storage = chunkMJL6FUJI_cjs.augmentWithInit(storage);
|
|
77
77
|
this.#telemetry = chunkMYHX5XVW_cjs.Telemetry.init(config?.telemetry);
|
|
78
78
|
if (this.#telemetry) {
|
|
79
79
|
this.#storage = this.#telemetry.traceClass(storage, {
|
|
@@ -285,7 +285,7 @@ This is a warning for now, but will throw an error in the future
|
|
|
285
285
|
return this.#vnext_workflows;
|
|
286
286
|
}
|
|
287
287
|
setStorage(storage) {
|
|
288
|
-
if (storage instanceof
|
|
288
|
+
if (storage instanceof chunkMJL6FUJI_cjs.DefaultProxyStorage) {
|
|
289
289
|
this.#logger.warn(`Importing "DefaultStorage" from '@mastra/core/storage/libsql' is deprecated.
|
|
290
290
|
|
|
291
291
|
Instead of:
|
|
@@ -295,7 +295,7 @@ Do:
|
|
|
295
295
|
import { LibSQLStore } from '@mastra/libsql';
|
|
296
296
|
`);
|
|
297
297
|
}
|
|
298
|
-
this.#storage =
|
|
298
|
+
this.#storage = chunkMJL6FUJI_cjs.augmentWithInit(storage);
|
|
299
299
|
}
|
|
300
300
|
setLogger({
|
|
301
301
|
logger
|
|
@@ -89,6 +89,10 @@ var DefaultProxyStorage = class extends chunkXNBNJEES_cjs.MastraStorage {
|
|
|
89
89
|
await this.setupStorage();
|
|
90
90
|
return this.storage.getWorkflowRuns(args);
|
|
91
91
|
}
|
|
92
|
+
async getWorkflowRunById(args) {
|
|
93
|
+
await this.setupStorage();
|
|
94
|
+
return this.storage.getWorkflowRunById(args);
|
|
95
|
+
}
|
|
92
96
|
};
|
|
93
97
|
|
|
94
98
|
// src/storage/storageWithInit.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkWQVDK654_cjs = require('./chunk-WQVDK654.cjs');
|
|
4
4
|
var cohereAi = require('cohere-ai');
|
|
5
5
|
|
|
6
6
|
var CohereRelevanceScorer = class {
|
|
@@ -38,7 +38,7 @@ Relevance score (0-1):`;
|
|
|
38
38
|
var MastraAgentRelevanceScorer = class {
|
|
39
39
|
agent;
|
|
40
40
|
constructor(name, model) {
|
|
41
|
-
this.agent = new
|
|
41
|
+
this.agent = new chunkWQVDK654_cjs.Agent({
|
|
42
42
|
name: `Relevance Scorer ${name}`,
|
|
43
43
|
instructions: `You are a specialized agent for evaluating the relevance of text to queries.
|
|
44
44
|
Your task is to rate how well a text passage answers a given query.
|
|
@@ -546,9 +546,7 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
546
546
|
const tools = await this.getTools({
|
|
547
547
|
runtimeContext
|
|
548
548
|
});
|
|
549
|
-
const
|
|
550
|
-
const k = value[0];
|
|
551
|
-
const tool = tools[k];
|
|
549
|
+
const convertedEntries = await Promise.all(Object.entries(tools || {}).map(async ([k, tool]) => {
|
|
552
550
|
if (tool) {
|
|
553
551
|
const options = {
|
|
554
552
|
name: k,
|
|
@@ -559,50 +557,57 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
559
557
|
mastra: mastraProxy,
|
|
560
558
|
memory,
|
|
561
559
|
agentName: this.name,
|
|
562
|
-
runtimeContext
|
|
560
|
+
runtimeContext,
|
|
561
|
+
model: typeof this.model === "function" ? await this.getModel({
|
|
562
|
+
runtimeContext
|
|
563
|
+
}) : this.model
|
|
563
564
|
};
|
|
564
|
-
|
|
565
|
+
return [k, makeCoreTool(tool, options)];
|
|
565
566
|
}
|
|
566
|
-
return
|
|
567
|
-
}
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
567
|
+
return void 0;
|
|
568
|
+
}));
|
|
569
|
+
const converted = Object.fromEntries(convertedEntries.filter(entry => Boolean(entry)));
|
|
570
|
+
let convertedMemoryTools = {};
|
|
571
|
+
if (memoryTools) {
|
|
572
|
+
const memoryToolEntries = await Promise.all(Object.entries(memoryTools).map(async ([k, tool]) => {
|
|
573
|
+
return [k, {
|
|
574
|
+
description: tool.description,
|
|
575
|
+
parameters: tool.parameters,
|
|
576
|
+
execute: typeof tool?.execute === "function" ? async (args, options) => {
|
|
577
|
+
try {
|
|
578
|
+
this.logger.debug(`[Agent:${this.name}] - Executing memory tool ${k}`, {
|
|
579
|
+
name: k,
|
|
580
|
+
description: tool.description,
|
|
581
|
+
args,
|
|
582
|
+
runId,
|
|
583
|
+
threadId,
|
|
584
|
+
resourceId
|
|
585
|
+
});
|
|
586
|
+
return tool?.execute?.({
|
|
587
|
+
context: args,
|
|
588
|
+
mastra: mastraProxy,
|
|
589
|
+
memory,
|
|
590
|
+
runId,
|
|
591
|
+
threadId,
|
|
592
|
+
resourceId,
|
|
593
|
+
logger: this.logger,
|
|
594
|
+
agentName: this.name,
|
|
595
|
+
runtimeContext
|
|
596
|
+
}, options) ?? void 0;
|
|
597
|
+
} catch (err) {
|
|
598
|
+
this.logger.error(`[Agent:${this.name}] - Failed memory tool execution`, {
|
|
599
|
+
error: err,
|
|
600
|
+
runId,
|
|
601
|
+
threadId,
|
|
602
|
+
resourceId
|
|
603
|
+
});
|
|
604
|
+
throw err;
|
|
605
|
+
}
|
|
606
|
+
} : void 0
|
|
607
|
+
}];
|
|
608
|
+
}));
|
|
609
|
+
convertedMemoryTools = Object.fromEntries(memoryToolEntries.filter(entry => Boolean(entry)));
|
|
610
|
+
}
|
|
606
611
|
const toolsFromToolsetsConverted = {
|
|
607
612
|
...converted,
|
|
608
613
|
...convertedMemoryTools
|
|
@@ -612,8 +617,8 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
612
617
|
this.logger.debug(`[Agent:${this.name}] - Adding tools from toolsets ${Object.keys(toolsets || {}).join(", ")}`, {
|
|
613
618
|
runId
|
|
614
619
|
});
|
|
615
|
-
|
|
616
|
-
|
|
620
|
+
for (const toolset of toolsFromToolsets) {
|
|
621
|
+
for (const [toolName, tool] of Object.entries(toolset)) {
|
|
617
622
|
const toolObj = tool;
|
|
618
623
|
const options = {
|
|
619
624
|
name: toolName,
|
|
@@ -624,19 +629,22 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
624
629
|
mastra: mastraProxy,
|
|
625
630
|
memory,
|
|
626
631
|
agentName: this.name,
|
|
627
|
-
runtimeContext
|
|
632
|
+
runtimeContext,
|
|
633
|
+
model: typeof this.model === "function" ? await this.getModel({
|
|
634
|
+
runtimeContext
|
|
635
|
+
}) : this.model
|
|
628
636
|
};
|
|
629
637
|
const convertedToCoreTool = makeCoreTool(toolObj, options, "toolset");
|
|
630
638
|
toolsFromToolsetsConverted[toolName] = convertedToCoreTool;
|
|
631
|
-
}
|
|
632
|
-
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
633
641
|
}
|
|
634
642
|
const clientToolsForInput = Object.entries(clientTools || {});
|
|
635
643
|
if (clientToolsForInput.length > 0) {
|
|
636
644
|
this.logger.debug(`[Agent:${this.name}] - Adding client tools ${Object.keys(clientTools || {}).join(", ")}`, {
|
|
637
645
|
runId
|
|
638
646
|
});
|
|
639
|
-
|
|
647
|
+
for (const [toolName, tool] of clientToolsForInput) {
|
|
640
648
|
const {
|
|
641
649
|
execute,
|
|
642
650
|
...rest
|
|
@@ -650,11 +658,14 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
650
658
|
mastra: mastraProxy,
|
|
651
659
|
memory,
|
|
652
660
|
agentName: this.name,
|
|
653
|
-
runtimeContext
|
|
661
|
+
runtimeContext,
|
|
662
|
+
model: typeof this.model === "function" ? await this.getModel({
|
|
663
|
+
runtimeContext
|
|
664
|
+
}) : this.model
|
|
654
665
|
};
|
|
655
666
|
const convertedToCoreTool = makeCoreTool(rest, options, "client-tool");
|
|
656
667
|
toolsFromToolsetsConverted[toolName] = convertedToCoreTool;
|
|
657
|
-
}
|
|
668
|
+
}
|
|
658
669
|
}
|
|
659
670
|
return toolsFromToolsetsConverted;
|
|
660
671
|
}
|
|
@@ -87,6 +87,10 @@ var DefaultProxyStorage = class extends MastraStorage {
|
|
|
87
87
|
await this.setupStorage();
|
|
88
88
|
return this.storage.getWorkflowRuns(args);
|
|
89
89
|
}
|
|
90
|
+
async getWorkflowRunById(args) {
|
|
91
|
+
await this.setupStorage();
|
|
92
|
+
return this.storage.getWorkflowRunById(args);
|
|
93
|
+
}
|
|
90
94
|
};
|
|
91
95
|
|
|
92
96
|
// src/storage/storageWithInit.ts
|
|
@@ -553,9 +553,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
553
553
|
const tools = await this.getTools({
|
|
554
554
|
runtimeContext
|
|
555
555
|
});
|
|
556
|
-
const
|
|
557
|
-
const k = value[0];
|
|
558
|
-
const tool = tools[k];
|
|
556
|
+
const convertedEntries = await Promise.all(Object.entries(tools || {}).map(async ([k, tool]) => {
|
|
559
557
|
if (tool) {
|
|
560
558
|
const options = {
|
|
561
559
|
name: k,
|
|
@@ -566,50 +564,57 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
566
564
|
mastra: mastraProxy,
|
|
567
565
|
memory,
|
|
568
566
|
agentName: this.name,
|
|
569
|
-
runtimeContext
|
|
567
|
+
runtimeContext,
|
|
568
|
+
model: typeof this.model === "function" ? await this.getModel({
|
|
569
|
+
runtimeContext
|
|
570
|
+
}) : this.model
|
|
570
571
|
};
|
|
571
|
-
|
|
572
|
+
return [k, chunkD2Y3ET63_cjs.makeCoreTool(tool, options)];
|
|
572
573
|
}
|
|
573
|
-
return
|
|
574
|
-
}
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
574
|
+
return void 0;
|
|
575
|
+
}));
|
|
576
|
+
const converted = Object.fromEntries(convertedEntries.filter(entry => Boolean(entry)));
|
|
577
|
+
let convertedMemoryTools = {};
|
|
578
|
+
if (memoryTools) {
|
|
579
|
+
const memoryToolEntries = await Promise.all(Object.entries(memoryTools).map(async ([k, tool]) => {
|
|
580
|
+
return [k, {
|
|
581
|
+
description: tool.description,
|
|
582
|
+
parameters: tool.parameters,
|
|
583
|
+
execute: typeof tool?.execute === "function" ? async (args, options) => {
|
|
584
|
+
try {
|
|
585
|
+
this.logger.debug(`[Agent:${this.name}] - Executing memory tool ${k}`, {
|
|
586
|
+
name: k,
|
|
587
|
+
description: tool.description,
|
|
588
|
+
args,
|
|
589
|
+
runId,
|
|
590
|
+
threadId,
|
|
591
|
+
resourceId
|
|
592
|
+
});
|
|
593
|
+
return tool?.execute?.({
|
|
594
|
+
context: args,
|
|
595
|
+
mastra: mastraProxy,
|
|
596
|
+
memory,
|
|
597
|
+
runId,
|
|
598
|
+
threadId,
|
|
599
|
+
resourceId,
|
|
600
|
+
logger: this.logger,
|
|
601
|
+
agentName: this.name,
|
|
602
|
+
runtimeContext
|
|
603
|
+
}, options) ?? void 0;
|
|
604
|
+
} catch (err) {
|
|
605
|
+
this.logger.error(`[Agent:${this.name}] - Failed memory tool execution`, {
|
|
606
|
+
error: err,
|
|
607
|
+
runId,
|
|
608
|
+
threadId,
|
|
609
|
+
resourceId
|
|
610
|
+
});
|
|
611
|
+
throw err;
|
|
612
|
+
}
|
|
613
|
+
} : void 0
|
|
614
|
+
}];
|
|
615
|
+
}));
|
|
616
|
+
convertedMemoryTools = Object.fromEntries(memoryToolEntries.filter(entry => Boolean(entry)));
|
|
617
|
+
}
|
|
613
618
|
const toolsFromToolsetsConverted = {
|
|
614
619
|
...converted,
|
|
615
620
|
...convertedMemoryTools
|
|
@@ -619,8 +624,8 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
619
624
|
this.logger.debug(`[Agent:${this.name}] - Adding tools from toolsets ${Object.keys(toolsets || {}).join(", ")}`, {
|
|
620
625
|
runId
|
|
621
626
|
});
|
|
622
|
-
|
|
623
|
-
|
|
627
|
+
for (const toolset of toolsFromToolsets) {
|
|
628
|
+
for (const [toolName, tool] of Object.entries(toolset)) {
|
|
624
629
|
const toolObj = tool;
|
|
625
630
|
const options = {
|
|
626
631
|
name: toolName,
|
|
@@ -631,19 +636,22 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
631
636
|
mastra: mastraProxy,
|
|
632
637
|
memory,
|
|
633
638
|
agentName: this.name,
|
|
634
|
-
runtimeContext
|
|
639
|
+
runtimeContext,
|
|
640
|
+
model: typeof this.model === "function" ? await this.getModel({
|
|
641
|
+
runtimeContext
|
|
642
|
+
}) : this.model
|
|
635
643
|
};
|
|
636
644
|
const convertedToCoreTool = chunkD2Y3ET63_cjs.makeCoreTool(toolObj, options, "toolset");
|
|
637
645
|
toolsFromToolsetsConverted[toolName] = convertedToCoreTool;
|
|
638
|
-
}
|
|
639
|
-
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
640
648
|
}
|
|
641
649
|
const clientToolsForInput = Object.entries(clientTools || {});
|
|
642
650
|
if (clientToolsForInput.length > 0) {
|
|
643
651
|
this.logger.debug(`[Agent:${this.name}] - Adding client tools ${Object.keys(clientTools || {}).join(", ")}`, {
|
|
644
652
|
runId
|
|
645
653
|
});
|
|
646
|
-
|
|
654
|
+
for (const [toolName, tool] of clientToolsForInput) {
|
|
647
655
|
const {
|
|
648
656
|
execute,
|
|
649
657
|
...rest
|
|
@@ -657,11 +665,14 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
|
657
665
|
mastra: mastraProxy,
|
|
658
666
|
memory,
|
|
659
667
|
agentName: this.name,
|
|
660
|
-
runtimeContext
|
|
668
|
+
runtimeContext,
|
|
669
|
+
model: typeof this.model === "function" ? await this.getModel({
|
|
670
|
+
runtimeContext
|
|
671
|
+
}) : this.model
|
|
661
672
|
};
|
|
662
673
|
const convertedToCoreTool = chunkD2Y3ET63_cjs.makeCoreTool(rest, options, "client-tool");
|
|
663
674
|
toolsFromToolsetsConverted[toolName] = convertedToCoreTool;
|
|
664
|
-
}
|
|
675
|
+
}
|
|
665
676
|
}
|
|
666
677
|
return toolsFromToolsetsConverted;
|
|
667
678
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LibSQLVector } from './chunk-47NGQPZI.js';
|
|
2
|
-
import { DefaultProxyStorage, augmentWithInit } from './chunk-
|
|
2
|
+
import { DefaultProxyStorage, augmentWithInit } from './chunk-WFJL654W.js';
|
|
3
3
|
import { deepMerge } from './chunk-ZCJJ6XOH.js';
|
|
4
4
|
import { MastraBase } from './chunk-CLJQYXNM.js';
|
|
5
5
|
import { existsSync } from 'fs';
|
|
@@ -169,6 +169,9 @@ var MastraMemory = class extends MastraBase {
|
|
|
169
169
|
if (config.options) {
|
|
170
170
|
this.threadConfig = this.getMergedThreadConfig(config.options);
|
|
171
171
|
}
|
|
172
|
+
const hasRootMemoryDbFile = existsSync(join(process.cwd(), `memory.db`));
|
|
173
|
+
const hasParentMemoryDbFile = existsSync(join(process.cwd(), `..`, `..`, `memory.db`));
|
|
174
|
+
const suggestDbPath = hasRootMemoryDbFile || hasParentMemoryDbFile ? `file:${hasParentMemoryDbFile ? `../../` : ``}memory.db` : `file:../mastra.db`;
|
|
172
175
|
if (config.storage) {
|
|
173
176
|
this.storage = config.storage;
|
|
174
177
|
} else {
|
|
@@ -177,6 +180,54 @@ var MastraMemory = class extends MastraBase {
|
|
|
177
180
|
url: "file:memory.db"
|
|
178
181
|
}
|
|
179
182
|
});
|
|
183
|
+
this.deprecationWarnings.push(`
|
|
184
|
+
Default storage is deprecated in Mastra Memory.
|
|
185
|
+
You're using it as an implicit default by not setting a storage adapter.
|
|
186
|
+
|
|
187
|
+
In the May 20th breaking change the default store will be removed.
|
|
188
|
+
|
|
189
|
+
Instead of this:
|
|
190
|
+
export const agent = new Agent({
|
|
191
|
+
memory: new Memory({
|
|
192
|
+
// your config
|
|
193
|
+
})
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
Do this:
|
|
197
|
+
import { LibSQLStore } from '@mastra/libsql';
|
|
198
|
+
|
|
199
|
+
export const agent = new Agent({
|
|
200
|
+
memory: new Memory({
|
|
201
|
+
// your config
|
|
202
|
+
storage: new LibSQLStore({
|
|
203
|
+
url: '${suggestDbPath}' // relative path from bundled .mastra/output dir
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
Additionally, in the breaking release, Memory will inherit storage from the Mastra instance.
|
|
209
|
+
If you plan on using that feature you can prepare by setting the same storage instance on Mastra and Memory.
|
|
210
|
+
|
|
211
|
+
Ex:
|
|
212
|
+
// mastra/storage.ts
|
|
213
|
+
export const storage = new LibSQLStore({
|
|
214
|
+
url: '${suggestDbPath}'
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
// mastra/index.ts
|
|
218
|
+
import { storage } from "./storage"
|
|
219
|
+
export const mastra = new Mastra({
|
|
220
|
+
// your config
|
|
221
|
+
storage
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
// mastra/agents/index.ts
|
|
225
|
+
import { storage } from "../storage"
|
|
226
|
+
export const yourAgent = new Agent({
|
|
227
|
+
// your config
|
|
228
|
+
storage
|
|
229
|
+
})
|
|
230
|
+
`);
|
|
180
231
|
}
|
|
181
232
|
this.storage = augmentWithInit(this.storage);
|
|
182
233
|
const semanticRecallIsEnabled = this.threadConfig.semanticRecall !== false;
|
|
@@ -193,13 +244,15 @@ var MastraMemory = class extends MastraBase {
|
|
|
193
244
|
const newDb = "memory.db";
|
|
194
245
|
if (hasOldDb) {
|
|
195
246
|
this.deprecationWarnings.push(
|
|
196
|
-
`Found deprecated Memory vector db file ${oldDb} this db is now merged with the default ${newDb}
|
|
247
|
+
`Found deprecated Memory vector db file ${oldDb}. In the May 20th breaking change, this will no longer be used by default. This db is now merged with the default storage file (${newDb}). You will need to manually migrate any data from ${oldDb} to ${newDb} if it's important to you. For now the deprecated path will be used, but in the May 20th breaking change we will only use the new db file path.`
|
|
197
248
|
);
|
|
198
249
|
}
|
|
199
250
|
this.deprecationWarnings.push(`
|
|
200
251
|
Default vector storage is deprecated in Mastra Memory.
|
|
201
252
|
You're using it as an implicit default by not setting a vector store.
|
|
202
253
|
|
|
254
|
+
In the May 20th breaking change the default vector store will be removed.
|
|
255
|
+
|
|
203
256
|
Instead of this:
|
|
204
257
|
export const agent = new Agent({
|
|
205
258
|
memory: new Memory({
|
|
@@ -214,12 +267,13 @@ export const agent = new Agent({
|
|
|
214
267
|
memory: new Memory({
|
|
215
268
|
options: { semanticRecall: true },
|
|
216
269
|
vector: new LibSQLVector({
|
|
217
|
-
connectionUrl: '
|
|
270
|
+
connectionUrl: '${suggestDbPath}' // relative path from bundled .mastra/output dir
|
|
218
271
|
})
|
|
219
272
|
})
|
|
220
273
|
})
|
|
221
274
|
`);
|
|
222
275
|
this.vector = new LibSQLVector({
|
|
276
|
+
// TODO: MAY 20th BREAKING CHANGE: remove this default and throw an error if semantic recall is enabled but there's no vector db
|
|
223
277
|
connectionUrl: hasOldDb ? `file:${oldDb}` : `file:${newDb}`
|
|
224
278
|
});
|
|
225
279
|
}
|