@mastra/core 0.2.0-alpha.83 → 0.2.0-alpha.84
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/action/index.d.ts +4 -4
- package/dist/agent/index.d.ts +5 -5
- package/dist/agent/index.js +6 -6
- package/dist/base.d.ts +3 -3
- package/dist/base.js +2 -2
- package/dist/bundler/index.d.ts +21 -0
- package/dist/bundler/index.js +4 -0
- package/dist/{chunk-AO76Z4K3.js → chunk-3IV6WDJY.js} +1 -1
- package/dist/{chunk-BWEOV64I.js → chunk-3THCTISX.js} +1 -1
- package/dist/{chunk-LYNJHHQX.js → chunk-42THOFKJ.js} +1 -1
- package/dist/{chunk-K7KUCZT2.js → chunk-6WJREZ5F.js} +2 -2
- package/dist/chunk-CQYUMNLZ.js +28 -0
- package/dist/{chunk-FCRDS4YS.js → chunk-EH2PG7Q6.js} +10 -4
- package/dist/{chunk-27EL4TRB.js → chunk-JCRGAEY6.js} +1 -1
- package/dist/{chunk-BQMCLBCR.js → chunk-OOZGW5CY.js} +1 -1
- package/dist/{chunk-OJJ6QGX4.js → chunk-PRYZIZXD.js} +6 -6
- package/dist/{chunk-FROFMREE.js → chunk-RZYBOMIG.js} +7 -0
- package/dist/{chunk-RPBNMIV7.js → chunk-SAXFXAKK.js} +43 -28
- package/dist/{chunk-Q5JF3TKZ.js → chunk-SLWM3SEH.js} +1 -1
- package/dist/{chunk-NLQVQJOD.js → chunk-TJK6TGSR.js} +1 -0
- package/dist/{chunk-S45F6AHA.js → chunk-U25DBVJZ.js} +1 -1
- package/dist/chunk-XD5IQZRB.js +16 -0
- package/dist/deployer/index.d.ts +8 -25
- package/dist/deployer/index.js +4 -3
- package/dist/engine/index.d.ts +2 -2
- package/dist/engine/index.js +3 -3
- package/dist/eval/index.d.ts +4 -4
- package/dist/filter/index.d.ts +1 -0
- package/dist/filter/index.js +1 -1
- package/dist/{index-CA9EWqaj.d.ts → index-62DyKJRU.d.ts} +275 -270
- package/dist/{index-B9i6dmc0.d.ts → index-B0-NXUYv.d.ts} +1 -0
- package/dist/index.d.ts +13 -11
- package/dist/index.js +21 -20
- package/dist/integration/index.d.ts +9 -9
- package/dist/llm/index.d.ts +5 -5
- package/dist/llm/index.js +3 -3
- package/dist/logger/index.d.ts +1 -1
- package/dist/logger/index.js +1 -1
- package/dist/mastra/index.d.ts +6 -5
- package/dist/mastra/index.js +5 -5
- package/dist/memory/index.d.ts +3 -3
- package/dist/memory/index.js +3 -3
- package/dist/relevance/index.d.ts +4 -4
- package/dist/relevance/index.js +7 -7
- package/dist/storage/index.d.ts +5 -5
- package/dist/storage/index.js +3 -3
- package/dist/telemetry/index.d.ts +5 -103
- package/dist/telemetry/index.js +1 -1
- package/dist/telemetry-oCUM52DG.d.ts +104 -0
- package/dist/tools/index.d.ts +5 -5
- package/dist/tts/index.d.ts +2 -2
- package/dist/tts/index.js +4 -4
- package/dist/vector/index.d.ts +2 -2
- package/dist/vector/index.js +3 -3
- package/dist/{workflow-Dam5GtdA.d.ts → workflow-DGktrYAL.d.ts} +1 -1
- package/dist/workflows/index.d.ts +6 -6
- package/dist/workflows/index.js +3 -3
- package/package.json +1 -2
- package/dist/chunk-5R6DBXQM.js +0 -57
- /package/dist/{chunk-OZZS5Y3C.js → chunk-SDKEPBBH.js} +0 -0
package/dist/action/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'zod';
|
|
2
|
-
export { I as IAction, aR as IExecutionContext, d as MastraPrimitives } from '../index-
|
|
2
|
+
export { I as IAction, aR as IExecutionContext, d as MastraPrimitives } from '../index-62DyKJRU.js';
|
|
3
3
|
import '../engine-EwEG-4Iv.js';
|
|
4
|
-
import '../index-
|
|
5
|
-
import '../telemetry
|
|
4
|
+
import '../index-B0-NXUYv.js';
|
|
5
|
+
import '../telemetry-oCUM52DG.js';
|
|
6
6
|
import '../tts/index.js';
|
|
7
7
|
import '../vector/index.js';
|
|
8
8
|
import 'ai';
|
|
@@ -14,5 +14,5 @@ import 'stream';
|
|
|
14
14
|
import '@opentelemetry/sdk-node';
|
|
15
15
|
import '@opentelemetry/sdk-trace-base';
|
|
16
16
|
import '../metric-D2V4CR8D.js';
|
|
17
|
-
import 'sift';
|
|
18
17
|
import '../types-M16hSruO.js';
|
|
18
|
+
import 'sift';
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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-62DyKJRU.js';
|
|
5
5
|
import '../base.js';
|
|
6
6
|
import '../metric-D2V4CR8D.js';
|
|
7
|
-
import '../
|
|
7
|
+
import '../types-M16hSruO.js';
|
|
8
|
+
import '../telemetry-oCUM52DG.js';
|
|
8
9
|
import '@opentelemetry/api';
|
|
9
10
|
import '@opentelemetry/sdk-node';
|
|
10
11
|
import '@opentelemetry/sdk-trace-base';
|
|
11
|
-
import '
|
|
12
|
+
import 'sift';
|
|
13
|
+
import '../index-B0-NXUYv.js';
|
|
12
14
|
import 'pino';
|
|
13
15
|
import 'stream';
|
|
14
|
-
import 'sift';
|
|
15
|
-
import '../types-M16hSruO.js';
|
|
16
16
|
import '../vector/index.js';
|
|
17
17
|
import '../engine-EwEG-4Iv.js';
|
|
18
18
|
import '../tts/index.js';
|
package/dist/agent/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { Agent } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { Agent } from '../chunk-SAXFXAKK.js';
|
|
2
|
+
import '../chunk-HBTQNIAX.js';
|
|
3
|
+
import '../chunk-SDKEPBBH.js';
|
|
4
|
+
import '../chunk-6WJREZ5F.js';
|
|
4
5
|
import '../chunk-6ZVFVYLE.js';
|
|
5
6
|
import '../chunk-LUULSM4U.js';
|
|
6
|
-
import '../chunk-
|
|
7
|
-
import '../chunk-
|
|
8
|
-
import '../chunk-HBTQNIAX.js';
|
|
7
|
+
import '../chunk-JCRGAEY6.js';
|
|
8
|
+
import '../chunk-TJK6TGSR.js';
|
|
9
9
|
import '../chunk-AJJZUHB4.js';
|
package/dist/base.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _opentelemetry_api from '@opentelemetry/api';
|
|
2
|
-
import { R as RegisteredLogger, L as Logger, a as LogLevel } from './index-
|
|
3
|
-
import { Telemetry } from './telemetry
|
|
2
|
+
import { R as RegisteredLogger, L as Logger, a as LogLevel } from './index-B0-NXUYv.js';
|
|
3
|
+
import { T as Telemetry } from './telemetry-oCUM52DG.js';
|
|
4
4
|
import 'pino';
|
|
5
5
|
import 'stream';
|
|
6
6
|
import '@opentelemetry/sdk-node';
|
|
@@ -8,7 +8,7 @@ import '@opentelemetry/sdk-trace-base';
|
|
|
8
8
|
|
|
9
9
|
declare class MastraBase {
|
|
10
10
|
component: RegisteredLogger;
|
|
11
|
-
logger: Logger;
|
|
11
|
+
protected logger: Logger;
|
|
12
12
|
name?: string;
|
|
13
13
|
telemetry?: Telemetry;
|
|
14
14
|
constructor({ component, name }: {
|
package/dist/base.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { MastraBase } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { MastraBase } from './chunk-JCRGAEY6.js';
|
|
2
|
+
import './chunk-TJK6TGSR.js';
|
|
3
3
|
import './chunk-AJJZUHB4.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MastraBase } from '../base.js';
|
|
2
|
+
import '@opentelemetry/api';
|
|
3
|
+
import '../index-B0-NXUYv.js';
|
|
4
|
+
import 'pino';
|
|
5
|
+
import 'stream';
|
|
6
|
+
import '../telemetry-oCUM52DG.js';
|
|
7
|
+
import '@opentelemetry/sdk-node';
|
|
8
|
+
import '@opentelemetry/sdk-trace-base';
|
|
9
|
+
|
|
10
|
+
declare abstract class MastraBundler extends MastraBase {
|
|
11
|
+
constructor({ name, component }: {
|
|
12
|
+
name: string;
|
|
13
|
+
component?: 'BUNDLER' | 'DEPLOYER';
|
|
14
|
+
});
|
|
15
|
+
loadEnvVars(): Promise<Map<string, string>>;
|
|
16
|
+
abstract prepare(outputDirectory: string): Promise<void>;
|
|
17
|
+
abstract getEnvFiles(): Promise<string[]>;
|
|
18
|
+
abstract bundle(mastraDir: string, outputDirectory: string): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { MastraBundler };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InstrumentClass } from './chunk-6ZVFVYLE.js';
|
|
2
2
|
import { delay } from './chunk-LUULSM4U.js';
|
|
3
|
-
import { MastraBase } from './chunk-
|
|
4
|
-
import { RegisteredLogger, LogLevel } from './chunk-
|
|
3
|
+
import { MastraBase } from './chunk-JCRGAEY6.js';
|
|
4
|
+
import { RegisteredLogger, LogLevel } from './chunk-TJK6TGSR.js';
|
|
5
5
|
import { __name, __privateAdd, __privateSet, __privateGet } from './chunk-AJJZUHB4.js';
|
|
6
6
|
import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
|
|
7
7
|
import { createAnthropic } from '@ai-sdk/anthropic';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MastraBase } from './chunk-JCRGAEY6.js';
|
|
2
|
+
import { __name } from './chunk-AJJZUHB4.js';
|
|
3
|
+
import dotenv from 'dotenv';
|
|
4
|
+
import { readFile } from 'fs/promises';
|
|
5
|
+
|
|
6
|
+
var _MastraBundler = class _MastraBundler extends MastraBase {
|
|
7
|
+
constructor({ name, component = "BUNDLER" }) {
|
|
8
|
+
super({
|
|
9
|
+
component,
|
|
10
|
+
name
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async loadEnvVars() {
|
|
14
|
+
const envVars = /* @__PURE__ */ new Map();
|
|
15
|
+
for (const file of await this.getEnvFiles()) {
|
|
16
|
+
const content = await readFile(file, "utf-8");
|
|
17
|
+
const config = dotenv.parse(content);
|
|
18
|
+
Object.entries(config).forEach(([key, value]) => {
|
|
19
|
+
envVars.set(key, value);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return envVars;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
__name(_MastraBundler, "MastraBundler");
|
|
26
|
+
var MastraBundler = _MastraBundler;
|
|
27
|
+
|
|
28
|
+
export { MastraBundler };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Telemetry } from './chunk-
|
|
2
|
-
import { LLM } from './chunk-
|
|
1
|
+
import { Telemetry } from './chunk-SDKEPBBH.js';
|
|
2
|
+
import { LLM } from './chunk-6WJREZ5F.js';
|
|
3
3
|
import { InstrumentClass } from './chunk-6ZVFVYLE.js';
|
|
4
|
-
import { LogLevel, createLogger, noopLogger } from './chunk-
|
|
4
|
+
import { LogLevel, createLogger, noopLogger } from './chunk-TJK6TGSR.js';
|
|
5
5
|
import { __name, __publicField } from './chunk-AJJZUHB4.js';
|
|
6
6
|
import 'dotenv/config';
|
|
7
7
|
|
|
@@ -243,7 +243,13 @@ var _Mastra = class _Mastra {
|
|
|
243
243
|
this.logger = logger;
|
|
244
244
|
if (this.agents) {
|
|
245
245
|
Object.keys(this.agents).forEach((key) => {
|
|
246
|
-
this.agents?.[key]
|
|
246
|
+
const agent = this.agents?.[key];
|
|
247
|
+
if (agent) {
|
|
248
|
+
agent.__setLogger(this.logger);
|
|
249
|
+
if (agent.hasOwnMemory()) {
|
|
250
|
+
agent.getMemory()?.__setLogger(this.logger);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
247
253
|
});
|
|
248
254
|
}
|
|
249
255
|
if (this.workflows) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MastraBase } from './chunk-
|
|
1
|
+
import { MastraBase } from './chunk-JCRGAEY6.js';
|
|
2
2
|
import { __name, __publicField, __privateAdd, __privateSet, __privateGet, __privateMethod } from './chunk-AJJZUHB4.js';
|
|
3
3
|
import { get } from 'radash';
|
|
4
4
|
import sift from 'sift';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MastraBase } from './chunk-
|
|
1
|
+
import { MastraBase } from './chunk-JCRGAEY6.js';
|
|
2
2
|
import { __name, __publicField } from './chunk-AJJZUHB4.js';
|
|
3
3
|
|
|
4
4
|
// src/memory/index.ts
|
|
@@ -13,19 +13,19 @@ var _MastraMemory = class _MastraMemory extends MastraBase {
|
|
|
13
13
|
__publicField(this, "vector");
|
|
14
14
|
__publicField(this, "embeddingOptions");
|
|
15
15
|
__publicField(this, "threadConfig", {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
lastMessages: 40,
|
|
17
|
+
historySearch: false
|
|
18
18
|
});
|
|
19
19
|
this.storage = config.storage;
|
|
20
20
|
if (config.vector) {
|
|
21
21
|
this.vector = config.vector;
|
|
22
|
-
this.threadConfig.
|
|
22
|
+
this.threadConfig.historySearch = true;
|
|
23
23
|
}
|
|
24
24
|
if (`embeddingOptions` in config) {
|
|
25
25
|
this.embeddingOptions = config.embeddingOptions;
|
|
26
26
|
}
|
|
27
|
-
if (config.
|
|
28
|
-
this.threadConfig = this.getMergedThreadConfig(config.
|
|
27
|
+
if (config.options) {
|
|
28
|
+
this.threadConfig = this.getMergedThreadConfig(config.options);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
parseEmbeddingOptions() {
|
|
@@ -30,6 +30,10 @@ var BaseFilterTranslator = (_a = class {
|
|
|
30
30
|
isFieldOperator(key) {
|
|
31
31
|
return this.isOperator(key) && !this.isLogicalOperator(key);
|
|
32
32
|
}
|
|
33
|
+
isCustomOperator(key) {
|
|
34
|
+
const support = this.getSupportedOperators();
|
|
35
|
+
return support.custom?.includes(key) ?? false;
|
|
36
|
+
}
|
|
33
37
|
getSupportedOperators() {
|
|
34
38
|
return _a.DEFAULT_OPERATORS;
|
|
35
39
|
}
|
|
@@ -45,6 +49,9 @@ var BaseFilterTranslator = (_a = class {
|
|
|
45
49
|
if (value instanceof Date) {
|
|
46
50
|
return value.toISOString();
|
|
47
51
|
}
|
|
52
|
+
if (typeof value === "number" && Object.is(value, -0)) {
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
48
55
|
return value;
|
|
49
56
|
}
|
|
50
57
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { LLM } from './chunk-K7KUCZT2.js';
|
|
2
|
-
import { InstrumentClass } from './chunk-6ZVFVYLE.js';
|
|
3
|
-
import { MastraBase } from './chunk-27EL4TRB.js';
|
|
4
|
-
import { RegisteredLogger, LogLevel } from './chunk-NLQVQJOD.js';
|
|
5
1
|
import { executeHook, AvailableHooks } from './chunk-HBTQNIAX.js';
|
|
2
|
+
import { LLM } from './chunk-6WJREZ5F.js';
|
|
3
|
+
import { InstrumentClass } from './chunk-6ZVFVYLE.js';
|
|
4
|
+
import { MastraBase } from './chunk-JCRGAEY6.js';
|
|
5
|
+
import { RegisteredLogger, LogLevel } from './chunk-TJK6TGSR.js';
|
|
6
6
|
import { __name, __publicField, __privateAdd, __privateSet, __privateGet } from './chunk-AJJZUHB4.js';
|
|
7
7
|
import { randomUUID } from 'crypto';
|
|
8
8
|
import { z } from 'zod';
|
|
@@ -19,7 +19,7 @@ function _ts_metadata(k, v) {
|
|
|
19
19
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
20
20
|
}
|
|
21
21
|
__name(_ts_metadata, "_ts_metadata");
|
|
22
|
-
var _mastra;
|
|
22
|
+
var _mastra, _memory;
|
|
23
23
|
var _Agent = class _Agent extends MastraBase {
|
|
24
24
|
constructor(config) {
|
|
25
25
|
super({
|
|
@@ -30,6 +30,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
30
30
|
__publicField(this, "instructions");
|
|
31
31
|
__publicField(this, "model");
|
|
32
32
|
__privateAdd(this, _mastra);
|
|
33
|
+
__privateAdd(this, _memory);
|
|
33
34
|
__publicField(this, "tools");
|
|
34
35
|
__publicField(this, "metrics");
|
|
35
36
|
this.name = config.name;
|
|
@@ -49,6 +50,15 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
49
50
|
if (config.metrics) {
|
|
50
51
|
this.metrics = config.metrics;
|
|
51
52
|
}
|
|
53
|
+
if (config.memory) {
|
|
54
|
+
__privateSet(this, _memory, config.memory);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
hasOwnMemory() {
|
|
58
|
+
return Boolean(__privateGet(this, _memory));
|
|
59
|
+
}
|
|
60
|
+
getMemory() {
|
|
61
|
+
return __privateGet(this, _memory) ?? __privateGet(this, _mastra)?.memory;
|
|
52
62
|
}
|
|
53
63
|
__registerPrimitives(p) {
|
|
54
64
|
if (p.telemetry) {
|
|
@@ -117,20 +127,21 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
117
127
|
}
|
|
118
128
|
async saveMemory({ threadId, memoryConfig, resourceId, userMessages, runId }) {
|
|
119
129
|
const userMessage = this.getMostRecentUserMessage(userMessages);
|
|
120
|
-
|
|
130
|
+
const memory = this.getMemory();
|
|
131
|
+
if (memory) {
|
|
121
132
|
let thread;
|
|
122
133
|
if (!threadId) {
|
|
123
134
|
this.logger.debug(`No threadId, creating new thread for agent ${this.name}`, {
|
|
124
135
|
runId: runId || this.name
|
|
125
136
|
});
|
|
126
137
|
const title = await this.genTitle(userMessage);
|
|
127
|
-
thread = await
|
|
138
|
+
thread = await memory.createThread({
|
|
128
139
|
threadId,
|
|
129
140
|
resourceId,
|
|
130
141
|
title
|
|
131
142
|
});
|
|
132
143
|
} else {
|
|
133
|
-
thread = await
|
|
144
|
+
thread = await memory.getThreadById({
|
|
134
145
|
threadId
|
|
135
146
|
});
|
|
136
147
|
if (!thread) {
|
|
@@ -138,7 +149,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
138
149
|
runId: runId || this.name
|
|
139
150
|
});
|
|
140
151
|
const title = await this.genTitle(userMessage);
|
|
141
|
-
thread = await
|
|
152
|
+
thread = await memory.createThread({
|
|
142
153
|
threadId,
|
|
143
154
|
resourceId,
|
|
144
155
|
title
|
|
@@ -151,7 +162,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
151
162
|
if (thread) {
|
|
152
163
|
const messages = newMessages.map((u) => {
|
|
153
164
|
return {
|
|
154
|
-
id:
|
|
165
|
+
id: this.getMemory()?.generateId(),
|
|
155
166
|
createdAt: /* @__PURE__ */ new Date(),
|
|
156
167
|
threadId: thread.id,
|
|
157
168
|
...u,
|
|
@@ -194,7 +205,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
194
205
|
this.log(LogLevel.DEBUG, `No context found: ${e.message}`);
|
|
195
206
|
}
|
|
196
207
|
}
|
|
197
|
-
const memoryMessages = threadId &&
|
|
208
|
+
const memoryMessages = threadId && memory ? (await memory.rememberMessages({
|
|
198
209
|
threadId,
|
|
199
210
|
config: memoryConfig,
|
|
200
211
|
vectorMessageSearch: messages.slice(-1).map((m) => {
|
|
@@ -205,10 +216,12 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
205
216
|
}).join(`
|
|
206
217
|
`)
|
|
207
218
|
})).messages : [];
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
219
|
+
if (memory) {
|
|
220
|
+
await memory.saveMessages({
|
|
221
|
+
messages,
|
|
222
|
+
memoryConfig
|
|
223
|
+
});
|
|
224
|
+
}
|
|
212
225
|
this.log(LogLevel.DEBUG, "Saved messages to memory", {
|
|
213
226
|
threadId: thread.id,
|
|
214
227
|
runId
|
|
@@ -239,12 +252,13 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
239
252
|
response.messages
|
|
240
253
|
];
|
|
241
254
|
const responseMessagesWithoutIncompleteToolCalls = this.sanitizeResponseMessages(ms);
|
|
242
|
-
|
|
255
|
+
const memory = this.getMemory();
|
|
256
|
+
if (memory) {
|
|
243
257
|
this.log(LogLevel.DEBUG, "Saving response to memory", {
|
|
244
258
|
threadId,
|
|
245
259
|
runId
|
|
246
260
|
});
|
|
247
|
-
await
|
|
261
|
+
await memory.saveMessages({
|
|
248
262
|
memoryConfig,
|
|
249
263
|
messages: responseMessagesWithoutIncompleteToolCalls.map((message) => {
|
|
250
264
|
const messageId = randomUUID();
|
|
@@ -400,7 +414,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
400
414
|
};
|
|
401
415
|
let coreMessages = messages;
|
|
402
416
|
let threadIdToUse = threadId;
|
|
403
|
-
if (
|
|
417
|
+
if (this.getMemory() && resourceId) {
|
|
404
418
|
const preExecuteResult = await this.preExecute({
|
|
405
419
|
resourceId,
|
|
406
420
|
runId,
|
|
@@ -416,7 +430,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
416
430
|
});
|
|
417
431
|
}
|
|
418
432
|
let convertedTools;
|
|
419
|
-
if (toolsets && Object.keys(toolsets || {}).length > 0 ||
|
|
433
|
+
if (toolsets && Object.keys(toolsets || {}).length > 0 || this.getMemory() && resourceId || __privateGet(this, _mastra)?.engine) {
|
|
420
434
|
convertedTools = this.convertTools({
|
|
421
435
|
toolsets,
|
|
422
436
|
threadId: threadIdToUse,
|
|
@@ -461,7 +475,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
461
475
|
result: resToLog,
|
|
462
476
|
threadId: threadId2
|
|
463
477
|
});
|
|
464
|
-
if (
|
|
478
|
+
if (this.getMemory() && resourceId) {
|
|
465
479
|
try {
|
|
466
480
|
this.logger.debug(`Saving assistant message in memory for agent ${this.name}`, {
|
|
467
481
|
runId: runId2,
|
|
@@ -503,7 +517,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
503
517
|
}, "after")
|
|
504
518
|
};
|
|
505
519
|
}
|
|
506
|
-
async generate(messages, { context, threadId: threadIdInFn,
|
|
520
|
+
async generate(messages, { context, threadId: threadIdInFn, memoryOptions, resourceId, maxSteps = 5, onStepFinish, runId, toolsets, output = "text", temperature } = {}) {
|
|
507
521
|
let messagesToUse = [];
|
|
508
522
|
if (typeof messages === `string`) {
|
|
509
523
|
messagesToUse = [
|
|
@@ -528,7 +542,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
528
542
|
messages: messagesToUse,
|
|
529
543
|
context,
|
|
530
544
|
threadId: threadIdInFn,
|
|
531
|
-
memoryConfig,
|
|
545
|
+
memoryConfig: memoryOptions,
|
|
532
546
|
resourceId,
|
|
533
547
|
runId: runIdToUse,
|
|
534
548
|
toolsets
|
|
@@ -548,7 +562,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
548
562
|
await after({
|
|
549
563
|
result: result2,
|
|
550
564
|
threadId,
|
|
551
|
-
memoryConfig,
|
|
565
|
+
memoryConfig: memoryOptions,
|
|
552
566
|
outputText: outputText2,
|
|
553
567
|
runId: runIdToUse
|
|
554
568
|
});
|
|
@@ -568,13 +582,13 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
568
582
|
await after({
|
|
569
583
|
result,
|
|
570
584
|
threadId,
|
|
571
|
-
memoryConfig,
|
|
585
|
+
memoryConfig: memoryOptions,
|
|
572
586
|
outputText,
|
|
573
587
|
runId: runIdToUse
|
|
574
588
|
});
|
|
575
589
|
return result;
|
|
576
590
|
}
|
|
577
|
-
async stream(messages, { context, threadId: threadIdInFn,
|
|
591
|
+
async stream(messages, { context, threadId: threadIdInFn, memoryOptions, resourceId, maxSteps = 5, onFinish, onStepFinish, runId, toolsets, output = "text", temperature } = {}) {
|
|
578
592
|
const runIdToUse = runId || randomUUID();
|
|
579
593
|
let messagesToUse = [];
|
|
580
594
|
if (typeof messages === `string`) {
|
|
@@ -599,7 +613,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
599
613
|
messages: messagesToUse,
|
|
600
614
|
context,
|
|
601
615
|
threadId: threadIdInFn,
|
|
602
|
-
memoryConfig,
|
|
616
|
+
memoryConfig: memoryOptions,
|
|
603
617
|
resourceId,
|
|
604
618
|
runId: runIdToUse,
|
|
605
619
|
toolsets
|
|
@@ -622,7 +636,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
622
636
|
await after({
|
|
623
637
|
result: res,
|
|
624
638
|
threadId,
|
|
625
|
-
memoryConfig,
|
|
639
|
+
memoryConfig: memoryOptions,
|
|
626
640
|
outputText,
|
|
627
641
|
runId: runIdToUse
|
|
628
642
|
});
|
|
@@ -655,7 +669,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
655
669
|
await after({
|
|
656
670
|
result: res,
|
|
657
671
|
threadId,
|
|
658
|
-
memoryConfig,
|
|
672
|
+
memoryConfig: memoryOptions,
|
|
659
673
|
outputText,
|
|
660
674
|
runId: runIdToUse
|
|
661
675
|
});
|
|
@@ -673,6 +687,7 @@ var _Agent = class _Agent extends MastraBase {
|
|
|
673
687
|
}
|
|
674
688
|
};
|
|
675
689
|
_mastra = new WeakMap();
|
|
690
|
+
_memory = new WeakMap();
|
|
676
691
|
__name(_Agent, "Agent");
|
|
677
692
|
var Agent = _Agent;
|
|
678
693
|
Agent = _ts_decorate([
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MastraBundler } from './chunk-CQYUMNLZ.js';
|
|
2
|
+
import { __name } from './chunk-AJJZUHB4.js';
|
|
3
|
+
|
|
4
|
+
// src/deployer/index.ts
|
|
5
|
+
var _MastraDeployer = class _MastraDeployer extends MastraBundler {
|
|
6
|
+
constructor({ name }) {
|
|
7
|
+
super({
|
|
8
|
+
component: "DEPLOYER",
|
|
9
|
+
name
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
__name(_MastraDeployer, "MastraDeployer");
|
|
14
|
+
var MastraDeployer = _MastraDeployer;
|
|
15
|
+
|
|
16
|
+
export { MastraDeployer };
|
package/dist/deployer/index.d.ts
CHANGED
|
@@ -1,35 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MastraBundler } from '../bundler/index.js';
|
|
2
|
+
import '../base.js';
|
|
2
3
|
import '@opentelemetry/api';
|
|
3
|
-
import '../index-
|
|
4
|
+
import '../index-B0-NXUYv.js';
|
|
4
5
|
import 'pino';
|
|
5
6
|
import 'stream';
|
|
6
|
-
import '../telemetry
|
|
7
|
+
import '../telemetry-oCUM52DG.js';
|
|
7
8
|
import '@opentelemetry/sdk-node';
|
|
8
9
|
import '@opentelemetry/sdk-trace-base';
|
|
9
10
|
|
|
10
|
-
declare abstract class MastraDeployer extends
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
env?: Record<string, any>;
|
|
14
|
-
constructor({ scope, env, projectName }: {
|
|
15
|
-
projectName: string;
|
|
16
|
-
scope: string;
|
|
17
|
-
env?: Record<string, any>;
|
|
11
|
+
declare abstract class MastraDeployer extends MastraBundler {
|
|
12
|
+
constructor({ name }: {
|
|
13
|
+
name: string;
|
|
18
14
|
});
|
|
19
|
-
|
|
20
|
-
protected getEnvFiles(): string[];
|
|
21
|
-
protected parseEnvFile(filePath: string): string[];
|
|
22
|
-
writeFiles({ dir }: {
|
|
23
|
-
dir: string;
|
|
24
|
-
}): void;
|
|
25
|
-
writeIndex({ dir }: {
|
|
26
|
-
dir: string;
|
|
27
|
-
}): void;
|
|
28
|
-
deploy({ dir, siteId }: {
|
|
29
|
-
token: string;
|
|
30
|
-
dir: string;
|
|
31
|
-
siteId?: string;
|
|
32
|
-
}): Promise<void>;
|
|
15
|
+
abstract deploy(outputDirectory: string): Promise<void>;
|
|
33
16
|
}
|
|
34
17
|
|
|
35
18
|
export { MastraDeployer };
|
package/dist/deployer/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { MastraDeployer } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { MastraDeployer } from '../chunk-XD5IQZRB.js';
|
|
2
|
+
import '../chunk-CQYUMNLZ.js';
|
|
3
|
+
import '../chunk-JCRGAEY6.js';
|
|
4
|
+
import '../chunk-TJK6TGSR.js';
|
|
4
5
|
import '../chunk-AJJZUHB4.js';
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { M as MastraEngine, D as DatabaseConfig, B as BaseEntity, a as BaseRecor
|
|
|
2
2
|
export { b as FilterCondition, F as FilterOperators, P as PropertyType, S as SortOrder } from '../engine-EwEG-4Iv.js';
|
|
3
3
|
import '../base.js';
|
|
4
4
|
import '@opentelemetry/api';
|
|
5
|
-
import '../index-
|
|
5
|
+
import '../index-B0-NXUYv.js';
|
|
6
6
|
import 'pino';
|
|
7
7
|
import 'stream';
|
|
8
|
-
import '../telemetry
|
|
8
|
+
import '../telemetry-oCUM52DG.js';
|
|
9
9
|
import '@opentelemetry/sdk-node';
|
|
10
10
|
import '@opentelemetry/sdk-trace-base';
|
|
11
11
|
|
package/dist/engine/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { FilterOperators, MastraEngine, MockMastraEngine, PropertyType } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { FilterOperators, MastraEngine, MockMastraEngine, PropertyType } from '../chunk-U25DBVJZ.js';
|
|
2
|
+
import '../chunk-JCRGAEY6.js';
|
|
3
|
+
import '../chunk-TJK6TGSR.js';
|
|
4
4
|
import '../chunk-AJJZUHB4.js';
|
package/dist/eval/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { M as Metric, a as MetricResult } from '../metric-D2V4CR8D.js';
|
|
2
|
-
import { A as Agent } from '../index-
|
|
2
|
+
import { A as Agent } from '../index-62DyKJRU.js';
|
|
3
3
|
import 'ai';
|
|
4
4
|
import 'json-schema';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '../base.js';
|
|
7
7
|
import '@opentelemetry/api';
|
|
8
|
-
import '../index-
|
|
8
|
+
import '../index-B0-NXUYv.js';
|
|
9
9
|
import 'pino';
|
|
10
10
|
import 'stream';
|
|
11
|
-
import '../telemetry
|
|
11
|
+
import '../telemetry-oCUM52DG.js';
|
|
12
12
|
import '@opentelemetry/sdk-node';
|
|
13
13
|
import '@opentelemetry/sdk-trace-base';
|
|
14
|
-
import 'sift';
|
|
15
14
|
import '../types-M16hSruO.js';
|
|
15
|
+
import 'sift';
|
|
16
16
|
import '../vector/index.js';
|
|
17
17
|
import '../engine-EwEG-4Iv.js';
|
|
18
18
|
import '../tts/index.js';
|
package/dist/filter/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ declare abstract class BaseFilterTranslator {
|
|
|
48
48
|
protected isElementOperator(key: string): key is ElementOperator;
|
|
49
49
|
protected isRegexOperator(key: string): key is RegexOperator;
|
|
50
50
|
protected isFieldOperator(key: string): key is QueryOperator;
|
|
51
|
+
protected isCustomOperator(key: string): boolean;
|
|
51
52
|
protected getSupportedOperators(): OperatorSupport;
|
|
52
53
|
protected isValidOperator(key: string): boolean;
|
|
53
54
|
/**
|
package/dist/filter/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { BaseFilterTranslator } from '../chunk-
|
|
1
|
+
export { BaseFilterTranslator } from '../chunk-RZYBOMIG.js';
|
|
2
2
|
import '../chunk-AJJZUHB4.js';
|