@mastra/core 0.7.0 → 0.8.0-alpha.2
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/README.md +76 -74
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +5 -3
- package/dist/agent/index.d.ts +5 -3
- package/dist/agent/index.js +1 -1
- package/dist/{base-Cmunaaxb.d.ts → base-BA_in99t.d.ts} +4 -1
- package/dist/{base-Cyl73WbV.d.ts → base-CQuRWXAH.d.ts} +985 -913
- package/dist/{base-ObPJ-w8K.d.cts → base-CvQbEqGB.d.cts} +4 -1
- package/dist/{base-C0wILuA9.d.cts → base-Dpt4tO56.d.cts} +985 -913
- package/dist/base.cjs +2 -2
- package/dist/base.d.cts +1 -1
- package/dist/base.d.ts +1 -1
- package/dist/base.js +1 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.d.cts +1 -1
- package/dist/bundler/index.d.ts +1 -1
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-L7CR75HA.js → chunk-2BVZNKLX.js} +1 -1
- package/dist/{chunk-V5ORZPFW.cjs → chunk-3C6V2FEP.cjs} +1 -1
- package/dist/chunk-3HE5CJBG.cjs +4604 -0
- package/dist/{chunk-PNZK456O.js → chunk-4RMSGSQN.js} +4 -4
- package/dist/{chunk-WESJ2ZY7.cjs → chunk-57LXIDIK.cjs} +2 -2
- package/dist/chunk-5RRJEWMA.cjs +107 -0
- package/dist/{chunk-3CNO7YB5.js → chunk-5TFGORLG.js} +1 -1
- package/dist/{chunk-5FAJ6HUC.cjs → chunk-64VPB7ZD.cjs} +23 -2
- package/dist/chunk-6XLV4KSD.js +100 -0
- package/dist/{chunk-XLSROQ26.cjs → chunk-7I7AKQH3.cjs} +5 -5
- package/dist/{chunk-RUA6BSB6.cjs → chunk-7JBINHJX.cjs} +2 -2
- package/dist/chunk-A6MBM56X.js +268 -0
- package/dist/{chunk-2YF5JYTJ.js → chunk-BC5B4EGI.js} +21 -2
- package/dist/chunk-BF7ZLRGO.cjs +271 -0
- package/dist/{chunk-SMBKF6K5.js → chunk-BRBHQ6KS.js} +10 -1
- package/dist/{chunk-VN4M67DA.js → chunk-CLJQYXNM.js} +1 -1
- package/dist/{chunk-PL7PVTGF.cjs → chunk-D63P5O4Q.cjs} +4 -4
- package/dist/chunk-DCGLGWHI.cjs +141 -0
- package/dist/{chunk-YXJQFZOW.cjs → chunk-DL4QPJKI.cjs} +24 -10
- package/dist/{chunk-ZABXT2MN.js → chunk-FY57LEMC.js} +1 -1
- package/dist/{chunk-XLXJUYKH.js → chunk-GHK3HBWN.js} +1 -1
- package/dist/{chunk-ONDCHP6G.cjs → chunk-GO2D7FEK.cjs} +2 -2
- package/dist/{chunk-7VTZI3YN.js → chunk-H6ZU5N2C.js} +1 -1
- package/dist/{chunk-WBE5RTFI.js → chunk-HAWAUEWK.js} +2 -2
- package/dist/chunk-HCDXBSMK.js +4577 -0
- package/dist/{chunk-RU7CSPAV.js → chunk-JGJMVCJ4.js} +7 -84
- package/dist/{chunk-W5HVJX45.js → chunk-N5ZYOQBL.js} +46 -5
- package/dist/{chunk-NPOKIPWC.cjs → chunk-O7IW545H.cjs} +1 -1
- package/dist/{chunk-XB2TJ7LX.cjs → chunk-PHWEC4VD.cjs} +47 -6
- package/dist/{chunk-NUDAZEOG.js → chunk-PK5QRKSG.js} +1 -1
- package/dist/{chunk-43SD5CUE.js → chunk-QDHRRKQ5.js} +63 -9
- package/dist/{chunk-ZBKJDQPM.js → chunk-RBWBJC6D.js} +17 -3
- package/dist/{chunk-4PYORXWM.cjs → chunk-RXDLSCBA.cjs} +4 -4
- package/dist/{chunk-IQLRSKED.cjs → chunk-RZCYBC7D.cjs} +2 -2
- package/dist/{chunk-ASFUEC75.cjs → chunk-TNNHN4ZY.cjs} +67 -12
- package/dist/{chunk-QM6WIIPM.js → chunk-UF4LZV3D.js} +1 -1
- package/dist/{chunk-JJ4YQTFT.cjs → chunk-WAW7QBY4.cjs} +2 -2
- package/dist/{chunk-U7ONOIBO.cjs → chunk-YZDUZFVZ.cjs} +11 -2
- package/dist/deployer/index.cjs +2 -2
- package/dist/deployer/index.d.cts +1 -1
- package/dist/deployer/index.d.ts +1 -1
- package/dist/deployer/index.js +1 -1
- package/dist/eval/index.cjs +3 -3
- package/dist/eval/index.d.cts +8 -5
- package/dist/eval/index.d.ts +8 -5
- package/dist/eval/index.js +1 -1
- package/dist/hooks/index.d.cts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/index.cjs +102 -92
- package/dist/index.d.cts +11 -9
- package/dist/index.d.ts +11 -9
- package/dist/index.js +18 -19
- package/dist/integration/index.cjs +3 -3
- package/dist/integration/index.d.cts +5 -3
- package/dist/integration/index.d.ts +5 -3
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.d.cts +5 -3
- package/dist/llm/index.d.ts +5 -3
- package/dist/logger/index.cjs +9 -9
- package/dist/logger/index.js +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.cts +5 -3
- package/dist/mastra/index.d.ts +5 -3
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +6 -2
- package/dist/memory/index.d.cts +5 -3
- package/dist/memory/index.d.ts +5 -3
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +8 -8
- package/dist/network/index.d.cts +5 -3
- package/dist/network/index.d.ts +5 -3
- package/dist/network/index.js +4 -4
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +10 -8
- package/dist/relevance/index.d.ts +10 -8
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.cjs +17 -0
- package/dist/server/index.d.cts +37 -0
- package/dist/server/index.d.ts +37 -0
- package/dist/server/index.js +15 -0
- package/dist/storage/index.cjs +12 -8
- package/dist/storage/index.d.cts +5 -3
- package/dist/storage/index.d.ts +5 -3
- package/dist/storage/index.js +2 -2
- package/dist/storage/libsql/index.cjs +24 -24
- package/dist/storage/libsql/index.d.cts +5 -3
- package/dist/storage/libsql/index.d.ts +5 -3
- package/dist/storage/libsql/index.js +12 -12
- package/dist/telemetry/index.cjs +6 -6
- package/dist/telemetry/index.d.cts +5 -3
- package/dist/telemetry/index.d.ts +5 -3
- package/dist/telemetry/index.js +1 -1
- package/dist/tools/index.cjs +7 -3
- package/dist/tools/index.d.cts +6 -3
- package/dist/tools/index.d.ts +6 -3
- package/dist/tools/index.js +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.d.cts +1 -1
- package/dist/tts/index.d.ts +1 -1
- package/dist/tts/index.js +1 -1
- package/dist/{types-CwTG2XyQ.d.cts → types-BtMyV38I.d.cts} +4 -1
- package/dist/{types-CwTG2XyQ.d.ts → types-BtMyV38I.d.ts} +4 -1
- package/dist/utils.cjs +13 -13
- package/dist/utils.d.cts +7 -5
- package/dist/utils.d.ts +7 -5
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.d.cts +1 -1
- package/dist/vector/index.d.ts +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/vector/libsql/index.cjs +3 -3
- package/dist/vector/libsql/index.d.cts +1 -1
- package/dist/vector/libsql/index.d.ts +1 -1
- package/dist/vector/libsql/index.js +1 -1
- package/dist/voice/index.cjs +13 -249
- package/dist/voice/index.d.cts +22 -8
- package/dist/voice/index.d.ts +22 -8
- package/dist/voice/index.js +1 -252
- package/dist/workflows/index.cjs +28 -20
- package/dist/workflows/index.d.cts +18 -7
- package/dist/workflows/index.d.ts +18 -7
- package/dist/workflows/index.js +1 -1
- package/package.json +5 -3
- package/dist/chunk-2W2GYEYQ.cjs +0 -25
- package/dist/chunk-C6BBAS4I.cjs +0 -1715
- package/dist/chunk-F5UYWPV4.cjs +0 -14
- package/dist/chunk-GG6TEAMJ.cjs +0 -2289
- package/dist/chunk-R2M5CZ5U.js +0 -2264
- package/dist/chunk-RG66XEJT.js +0 -8
- package/dist/chunk-VNQRLYIA.js +0 -1715
- package/dist/chunk-WVVKLIUW.cjs +0 -218
- package/dist/chunk-ZINPRHAN.js +0 -22
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkPHWEC4VD_cjs = require('./chunk-PHWEC4VD.cjs');
|
|
4
|
+
var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
|
|
5
|
+
var chunkRWTSGWWL_cjs = require('./chunk-RWTSGWWL.cjs');
|
|
6
|
+
|
|
7
|
+
// src/voice/voice.ts
|
|
8
|
+
var _MastraVoice_decorators, _init, _a;
|
|
9
|
+
_MastraVoice_decorators = [chunkPHWEC4VD_cjs.InstrumentClass({
|
|
10
|
+
prefix: "voice",
|
|
11
|
+
excludeMethods: ["__setTools", "__setLogger", "__setTelemetry", "#log"]
|
|
12
|
+
})];
|
|
13
|
+
exports.MastraVoice = class MastraVoice extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
|
|
14
|
+
listeningModel;
|
|
15
|
+
speechModel;
|
|
16
|
+
speaker;
|
|
17
|
+
realtimeConfig;
|
|
18
|
+
constructor({
|
|
19
|
+
listeningModel,
|
|
20
|
+
speechModel,
|
|
21
|
+
speaker,
|
|
22
|
+
realtimeConfig,
|
|
23
|
+
name
|
|
24
|
+
} = {}) {
|
|
25
|
+
super({
|
|
26
|
+
component: "VOICE",
|
|
27
|
+
name
|
|
28
|
+
});
|
|
29
|
+
this.listeningModel = listeningModel;
|
|
30
|
+
this.speechModel = speechModel;
|
|
31
|
+
this.speaker = speaker;
|
|
32
|
+
this.realtimeConfig = realtimeConfig;
|
|
33
|
+
}
|
|
34
|
+
traced(method, methodName) {
|
|
35
|
+
return this.telemetry?.traceMethod(method, {
|
|
36
|
+
spanName: `voice.${methodName}`,
|
|
37
|
+
attributes: {
|
|
38
|
+
"voice.type": this.speechModel?.name || this.listeningModel?.name || "unknown"
|
|
39
|
+
}
|
|
40
|
+
}) ?? method;
|
|
41
|
+
}
|
|
42
|
+
updateConfig(_options) {
|
|
43
|
+
this.logger.warn("updateConfig not implemented by this voice provider");
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Initializes a WebSocket or WebRTC connection for real-time communication
|
|
47
|
+
* @returns Promise that resolves when the connection is established
|
|
48
|
+
*/
|
|
49
|
+
connect(_options) {
|
|
50
|
+
this.logger.warn("connect not implemented by this voice provider");
|
|
51
|
+
return Promise.resolve();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Relay audio data to the voice provider for real-time processing
|
|
55
|
+
* @param audioData Audio data to relay
|
|
56
|
+
*/
|
|
57
|
+
send(_audioData) {
|
|
58
|
+
this.logger.warn("relay not implemented by this voice provider");
|
|
59
|
+
return Promise.resolve();
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Trigger voice providers to respond
|
|
63
|
+
*/
|
|
64
|
+
answer(_options) {
|
|
65
|
+
this.logger.warn("answer not implemented by this voice provider");
|
|
66
|
+
return Promise.resolve();
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Equip the voice provider with instructions
|
|
70
|
+
* @param instructions Instructions to add
|
|
71
|
+
*/
|
|
72
|
+
addInstructions(_instructions) {
|
|
73
|
+
this.logger.warn("addInstructions not implemented by this voice provider");
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Equip the voice provider with tools
|
|
77
|
+
* @param tools Array of tools to add
|
|
78
|
+
*/
|
|
79
|
+
addTools(_tools) {
|
|
80
|
+
this.logger.warn("addTools not implemented by this voice provider");
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Disconnect from the WebSocket or WebRTC connection
|
|
84
|
+
*/
|
|
85
|
+
close() {
|
|
86
|
+
this.logger.warn("close not implemented by this voice provider");
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Register an event listener
|
|
90
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
91
|
+
* @param callback Callback function that receives event data
|
|
92
|
+
*/
|
|
93
|
+
on(_event, _callback) {
|
|
94
|
+
this.logger.warn("on not implemented by this voice provider");
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Remove an event listener
|
|
98
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
99
|
+
* @param callback Callback function to remove
|
|
100
|
+
*/
|
|
101
|
+
off(_event, _callback) {
|
|
102
|
+
this.logger.warn("off not implemented by this voice provider");
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get available speakers/voices
|
|
106
|
+
* @returns Array of available voice IDs and their metadata
|
|
107
|
+
*/
|
|
108
|
+
getSpeakers() {
|
|
109
|
+
this.logger.warn("getSpeakers not implemented by this voice provider");
|
|
110
|
+
return Promise.resolve([]);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
exports.MastraVoice = /*@__PURE__*/(_ => {
|
|
114
|
+
_init = chunkRWTSGWWL_cjs.__decoratorStart(_a);
|
|
115
|
+
exports.MastraVoice = chunkRWTSGWWL_cjs.__decorateElement(_init, 0, "MastraVoice", _MastraVoice_decorators, exports.MastraVoice);
|
|
116
|
+
chunkRWTSGWWL_cjs.__runInitializers(_init, 1, exports.MastraVoice);
|
|
117
|
+
|
|
118
|
+
// src/voice/composite-voice.ts
|
|
119
|
+
return exports.MastraVoice;
|
|
120
|
+
})();
|
|
121
|
+
// src/voice/composite-voice.ts
|
|
122
|
+
var CompositeVoice = class extends exports.MastraVoice {
|
|
123
|
+
speakProvider;
|
|
124
|
+
listenProvider;
|
|
125
|
+
realtimeProvider;
|
|
126
|
+
constructor({
|
|
127
|
+
speakProvider,
|
|
128
|
+
listenProvider,
|
|
129
|
+
realtimeProvider
|
|
130
|
+
}) {
|
|
131
|
+
super();
|
|
132
|
+
this.speakProvider = speakProvider;
|
|
133
|
+
this.listenProvider = listenProvider;
|
|
134
|
+
this.realtimeProvider = realtimeProvider;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Convert text to speech using the configured provider
|
|
138
|
+
* @param input Text or text stream to convert to speech
|
|
139
|
+
* @param options Speech options including speaker and provider-specific options
|
|
140
|
+
* @returns Audio stream or void if in realtime mode
|
|
141
|
+
*/
|
|
142
|
+
async speak(input, options) {
|
|
143
|
+
if (this.realtimeProvider) {
|
|
144
|
+
return this.realtimeProvider.speak(input, options);
|
|
145
|
+
} else if (this.speakProvider) {
|
|
146
|
+
return this.speakProvider.speak(input, options);
|
|
147
|
+
}
|
|
148
|
+
throw new Error("No speak provider or realtime provider configured");
|
|
149
|
+
}
|
|
150
|
+
async listen(audioStream, options) {
|
|
151
|
+
if (this.realtimeProvider) {
|
|
152
|
+
return await this.realtimeProvider.listen(audioStream, options);
|
|
153
|
+
} else if (this.listenProvider) {
|
|
154
|
+
return await this.listenProvider.listen(audioStream, options);
|
|
155
|
+
}
|
|
156
|
+
throw new Error("No listen provider or realtime provider configured");
|
|
157
|
+
}
|
|
158
|
+
async getSpeakers() {
|
|
159
|
+
if (this.realtimeProvider) {
|
|
160
|
+
return this.realtimeProvider.getSpeakers();
|
|
161
|
+
} else if (this.speakProvider) {
|
|
162
|
+
return this.speakProvider.getSpeakers();
|
|
163
|
+
}
|
|
164
|
+
throw new Error("No speak provider or realtime provider configured");
|
|
165
|
+
}
|
|
166
|
+
updateConfig(options) {
|
|
167
|
+
if (!this.realtimeProvider) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
this.realtimeProvider.updateConfig(options);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Initializes a WebSocket or WebRTC connection for real-time communication
|
|
174
|
+
* @returns Promise that resolves when the connection is established
|
|
175
|
+
*/
|
|
176
|
+
connect(options) {
|
|
177
|
+
if (!this.realtimeProvider) {
|
|
178
|
+
throw new Error("No realtime provider configured");
|
|
179
|
+
}
|
|
180
|
+
return this.realtimeProvider.connect(options);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Relay audio data to the voice provider for real-time processing
|
|
184
|
+
* @param audioData Audio data to send
|
|
185
|
+
*/
|
|
186
|
+
send(audioData) {
|
|
187
|
+
if (!this.realtimeProvider) {
|
|
188
|
+
throw new Error("No realtime provider configured");
|
|
189
|
+
}
|
|
190
|
+
return this.realtimeProvider.send(audioData);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Trigger voice providers to respond
|
|
194
|
+
*/
|
|
195
|
+
answer(options) {
|
|
196
|
+
if (!this.realtimeProvider) {
|
|
197
|
+
throw new Error("No realtime provider configured");
|
|
198
|
+
}
|
|
199
|
+
return this.realtimeProvider.answer(options);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Equip the voice provider with instructions
|
|
203
|
+
* @param instructions Instructions to add
|
|
204
|
+
*/
|
|
205
|
+
addInstructions(instructions) {
|
|
206
|
+
if (!this.realtimeProvider) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
this.realtimeProvider.addInstructions(instructions);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Equip the voice provider with tools
|
|
213
|
+
* @param tools Array of tools to add
|
|
214
|
+
*/
|
|
215
|
+
addTools(tools) {
|
|
216
|
+
if (!this.realtimeProvider) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
this.realtimeProvider.addTools(tools);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Disconnect from the WebSocket or WebRTC connection
|
|
223
|
+
*/
|
|
224
|
+
close() {
|
|
225
|
+
if (!this.realtimeProvider) {
|
|
226
|
+
throw new Error("No realtime provider configured");
|
|
227
|
+
}
|
|
228
|
+
this.realtimeProvider.close();
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Register an event listener
|
|
232
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
233
|
+
* @param callback Callback function that receives event data
|
|
234
|
+
*/
|
|
235
|
+
on(event, callback) {
|
|
236
|
+
if (!this.realtimeProvider) {
|
|
237
|
+
throw new Error("No realtime provider configured");
|
|
238
|
+
}
|
|
239
|
+
this.realtimeProvider.on(event, callback);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Remove an event listener
|
|
243
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
244
|
+
* @param callback Callback function to remove
|
|
245
|
+
*/
|
|
246
|
+
off(event, callback) {
|
|
247
|
+
if (!this.realtimeProvider) {
|
|
248
|
+
throw new Error("No realtime provider configured");
|
|
249
|
+
}
|
|
250
|
+
this.realtimeProvider.off(event, callback);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// src/voice/default-voice.ts
|
|
255
|
+
var DefaultVoice = class extends exports.MastraVoice {
|
|
256
|
+
constructor() {
|
|
257
|
+
super();
|
|
258
|
+
}
|
|
259
|
+
async speak(_input) {
|
|
260
|
+
throw new Error("No voice provider configured");
|
|
261
|
+
}
|
|
262
|
+
async listen(_input) {
|
|
263
|
+
throw new Error("No voice provider configured");
|
|
264
|
+
}
|
|
265
|
+
async getSpeakers() {
|
|
266
|
+
throw new Error("No voice provider configured");
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
exports.CompositeVoice = CompositeVoice;
|
|
271
|
+
exports.DefaultVoice = DefaultVoice;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseFilterTranslator } from './chunk-LGERQTJM.js';
|
|
2
|
-
import { MastraVector } from './chunk-
|
|
2
|
+
import { MastraVector } from './chunk-FY57LEMC.js';
|
|
3
3
|
import { isAbsolute, join, resolve } from 'path';
|
|
4
4
|
import { createClient } from '@libsql/client';
|
|
5
5
|
|
|
@@ -529,6 +529,15 @@ var LibSQLVector = class extends MastraVector {
|
|
|
529
529
|
return vectorIds;
|
|
530
530
|
} catch (error) {
|
|
531
531
|
await tx.rollback();
|
|
532
|
+
if (error instanceof Error && error.message?.includes("dimensions are different")) {
|
|
533
|
+
const match = error.message.match(/dimensions are different: (\d+) != (\d+)/);
|
|
534
|
+
if (match) {
|
|
535
|
+
const [, actual, expected] = match;
|
|
536
|
+
throw new Error(
|
|
537
|
+
`Vector dimension mismatch: Index "${indexName}" expects ${expected} dimensions but got ${actual} dimensions. Either use a matching embedding model or delete and recreate the index with the new dimension.`
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
532
541
|
throw error;
|
|
533
542
|
}
|
|
534
543
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkO7IW545H_cjs = require('./chunk-O7IW545H.cjs');
|
|
4
4
|
|
|
5
5
|
// src/base.ts
|
|
6
6
|
var MastraBase = class {
|
|
7
|
-
component =
|
|
7
|
+
component = chunkO7IW545H_cjs.RegisteredLogger.LLM;
|
|
8
8
|
logger;
|
|
9
9
|
name;
|
|
10
10
|
telemetry;
|
|
11
11
|
constructor({ component, name }) {
|
|
12
|
-
this.component = component ||
|
|
12
|
+
this.component = component || chunkO7IW545H_cjs.RegisteredLogger.LLM;
|
|
13
13
|
this.name = name;
|
|
14
|
-
this.logger =
|
|
14
|
+
this.logger = chunkO7IW545H_cjs.createLogger({ name: `${this.component} - ${this.name}` });
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Set the logger for the agent
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk5RRJEWMA_cjs = require('./chunk-5RRJEWMA.cjs');
|
|
4
|
+
var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
|
|
5
|
+
|
|
6
|
+
// src/storage/base.ts
|
|
7
|
+
var MastraStorage = class extends chunkD63P5O4Q_cjs.MastraBase {
|
|
8
|
+
/** @deprecated import from { TABLE_WORKFLOW_SNAPSHOT } '@mastra/core/storage' instead */
|
|
9
|
+
static TABLE_WORKFLOW_SNAPSHOT = chunk5RRJEWMA_cjs.TABLE_WORKFLOW_SNAPSHOT;
|
|
10
|
+
/** @deprecated import from { TABLE_EVALS } '@mastra/core/storage' instead */
|
|
11
|
+
static TABLE_EVALS = chunk5RRJEWMA_cjs.TABLE_EVALS;
|
|
12
|
+
/** @deprecated import from { TABLE_MESSAGES } '@mastra/core/storage' instead */
|
|
13
|
+
static TABLE_MESSAGES = chunk5RRJEWMA_cjs.TABLE_MESSAGES;
|
|
14
|
+
/** @deprecated import from { TABLE_THREADS } '@mastra/core/storage' instead */
|
|
15
|
+
static TABLE_THREADS = chunk5RRJEWMA_cjs.TABLE_THREADS;
|
|
16
|
+
/** @deprecated import { TABLE_TRACES } from '@mastra/core/storage' instead */
|
|
17
|
+
static TABLE_TRACES = chunk5RRJEWMA_cjs.TABLE_TRACES;
|
|
18
|
+
hasInitialized = null;
|
|
19
|
+
shouldCacheInit = true;
|
|
20
|
+
constructor({ name }) {
|
|
21
|
+
super({
|
|
22
|
+
component: "STORAGE",
|
|
23
|
+
name
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async __batchInsert({
|
|
27
|
+
tableName,
|
|
28
|
+
records
|
|
29
|
+
}) {
|
|
30
|
+
await this.init();
|
|
31
|
+
return this.batchInsert({ tableName, records });
|
|
32
|
+
}
|
|
33
|
+
async __getThreadById({ threadId }) {
|
|
34
|
+
await this.init();
|
|
35
|
+
return this.getThreadById({ threadId });
|
|
36
|
+
}
|
|
37
|
+
async __getThreadsByResourceId({ resourceId }) {
|
|
38
|
+
await this.init();
|
|
39
|
+
return this.getThreadsByResourceId({ resourceId });
|
|
40
|
+
}
|
|
41
|
+
async __saveThread({ thread }) {
|
|
42
|
+
await this.init();
|
|
43
|
+
return this.saveThread({ thread });
|
|
44
|
+
}
|
|
45
|
+
async __updateThread({
|
|
46
|
+
id,
|
|
47
|
+
title,
|
|
48
|
+
metadata
|
|
49
|
+
}) {
|
|
50
|
+
await this.init();
|
|
51
|
+
return this.updateThread({ id, title, metadata });
|
|
52
|
+
}
|
|
53
|
+
async __deleteThread({ threadId }) {
|
|
54
|
+
await this.init();
|
|
55
|
+
return this.deleteThread({ threadId });
|
|
56
|
+
}
|
|
57
|
+
async __getMessages({ threadId, selectBy, threadConfig }) {
|
|
58
|
+
await this.init();
|
|
59
|
+
return this.getMessages({ threadId, selectBy, threadConfig });
|
|
60
|
+
}
|
|
61
|
+
async __saveMessages({ messages }) {
|
|
62
|
+
await this.init();
|
|
63
|
+
return this.saveMessages({ messages });
|
|
64
|
+
}
|
|
65
|
+
async __getTraces({
|
|
66
|
+
scope,
|
|
67
|
+
page,
|
|
68
|
+
perPage,
|
|
69
|
+
attributes
|
|
70
|
+
}) {
|
|
71
|
+
await this.init();
|
|
72
|
+
return this.getTraces({ scope, page, perPage, attributes });
|
|
73
|
+
}
|
|
74
|
+
async init() {
|
|
75
|
+
if (this.shouldCacheInit && await this.hasInitialized) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
this.hasInitialized = Promise.all([
|
|
79
|
+
this.createTable({
|
|
80
|
+
tableName: chunk5RRJEWMA_cjs.TABLE_WORKFLOW_SNAPSHOT,
|
|
81
|
+
schema: chunk5RRJEWMA_cjs.TABLE_SCHEMAS[chunk5RRJEWMA_cjs.TABLE_WORKFLOW_SNAPSHOT]
|
|
82
|
+
}),
|
|
83
|
+
this.createTable({
|
|
84
|
+
tableName: chunk5RRJEWMA_cjs.TABLE_EVALS,
|
|
85
|
+
schema: chunk5RRJEWMA_cjs.TABLE_SCHEMAS[chunk5RRJEWMA_cjs.TABLE_EVALS]
|
|
86
|
+
}),
|
|
87
|
+
this.createTable({
|
|
88
|
+
tableName: chunk5RRJEWMA_cjs.TABLE_THREADS,
|
|
89
|
+
schema: chunk5RRJEWMA_cjs.TABLE_SCHEMAS[chunk5RRJEWMA_cjs.TABLE_THREADS]
|
|
90
|
+
}),
|
|
91
|
+
this.createTable({
|
|
92
|
+
tableName: chunk5RRJEWMA_cjs.TABLE_MESSAGES,
|
|
93
|
+
schema: chunk5RRJEWMA_cjs.TABLE_SCHEMAS[chunk5RRJEWMA_cjs.TABLE_MESSAGES]
|
|
94
|
+
}),
|
|
95
|
+
this.createTable({
|
|
96
|
+
tableName: chunk5RRJEWMA_cjs.TABLE_TRACES,
|
|
97
|
+
schema: chunk5RRJEWMA_cjs.TABLE_SCHEMAS[chunk5RRJEWMA_cjs.TABLE_TRACES]
|
|
98
|
+
})
|
|
99
|
+
]).then(() => true);
|
|
100
|
+
await this.hasInitialized;
|
|
101
|
+
}
|
|
102
|
+
async persistWorkflowSnapshot({
|
|
103
|
+
workflowName,
|
|
104
|
+
runId,
|
|
105
|
+
snapshot
|
|
106
|
+
}) {
|
|
107
|
+
await this.init();
|
|
108
|
+
const data = {
|
|
109
|
+
workflow_name: workflowName,
|
|
110
|
+
run_id: runId,
|
|
111
|
+
snapshot,
|
|
112
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
113
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
114
|
+
};
|
|
115
|
+
this.logger.debug("Persisting workflow snapshot", { workflowName, runId, data });
|
|
116
|
+
await this.insert({
|
|
117
|
+
tableName: chunk5RRJEWMA_cjs.TABLE_WORKFLOW_SNAPSHOT,
|
|
118
|
+
record: data
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
async loadWorkflowSnapshot({
|
|
122
|
+
workflowName,
|
|
123
|
+
runId
|
|
124
|
+
}) {
|
|
125
|
+
if (!this.hasInitialized) {
|
|
126
|
+
await this.init();
|
|
127
|
+
}
|
|
128
|
+
this.logger.debug("Loading workflow snapshot", { workflowName, runId });
|
|
129
|
+
const d = await this.load({
|
|
130
|
+
tableName: chunk5RRJEWMA_cjs.TABLE_WORKFLOW_SNAPSHOT,
|
|
131
|
+
keys: { workflow_name: workflowName, run_id: runId }
|
|
132
|
+
});
|
|
133
|
+
return d ? d.snapshot : null;
|
|
134
|
+
}
|
|
135
|
+
async __getEvalsByAgentName(agentName, type) {
|
|
136
|
+
await this.init();
|
|
137
|
+
return this.getEvalsByAgentName(agentName, type);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
exports.MastraStorage = MastraStorage;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkGO2D7FEK_cjs = require('./chunk-GO2D7FEK.cjs');
|
|
4
|
+
var chunkPHWEC4VD_cjs = require('./chunk-PHWEC4VD.cjs');
|
|
5
|
+
var chunkO7IW545H_cjs = require('./chunk-O7IW545H.cjs');
|
|
6
6
|
var chunkRWTSGWWL_cjs = require('./chunk-RWTSGWWL.cjs');
|
|
7
7
|
|
|
8
8
|
// src/mastra/index.ts
|
|
9
9
|
var _Mastra_decorators, _init;
|
|
10
|
-
_Mastra_decorators = [
|
|
10
|
+
_Mastra_decorators = [chunkPHWEC4VD_cjs.InstrumentClass({
|
|
11
11
|
prefix: "mastra",
|
|
12
12
|
excludeMethods: ["getLogger", "getTelemetry"]
|
|
13
13
|
})];
|
|
@@ -23,6 +23,7 @@ exports.Mastra = class Mastra {
|
|
|
23
23
|
#storage;
|
|
24
24
|
#memory;
|
|
25
25
|
#networks;
|
|
26
|
+
#server;
|
|
26
27
|
/**
|
|
27
28
|
* @deprecated use getTelemetry() instead
|
|
28
29
|
*/
|
|
@@ -50,13 +51,13 @@ exports.Mastra = class Mastra {
|
|
|
50
51
|
}
|
|
51
52
|
let logger;
|
|
52
53
|
if (config?.logger === false) {
|
|
53
|
-
logger =
|
|
54
|
+
logger = chunkO7IW545H_cjs.noopLogger;
|
|
54
55
|
} else {
|
|
55
56
|
if (config?.logger) {
|
|
56
57
|
logger = config.logger;
|
|
57
58
|
} else {
|
|
58
|
-
const levleOnEnv = process.env.NODE_ENV === "production" ?
|
|
59
|
-
logger =
|
|
59
|
+
const levleOnEnv = process.env.NODE_ENV === "production" ? chunkO7IW545H_cjs.LogLevel.WARN : chunkO7IW545H_cjs.LogLevel.INFO;
|
|
60
|
+
logger = chunkO7IW545H_cjs.createLogger({
|
|
60
61
|
name: "Mastra",
|
|
61
62
|
level: levleOnEnv
|
|
62
63
|
});
|
|
@@ -65,13 +66,13 @@ exports.Mastra = class Mastra {
|
|
|
65
66
|
this.#logger = logger;
|
|
66
67
|
let storage = config?.storage;
|
|
67
68
|
if (!storage) {
|
|
68
|
-
storage = new
|
|
69
|
+
storage = new chunkGO2D7FEK_cjs.DefaultProxyStorage({
|
|
69
70
|
config: {
|
|
70
71
|
url: process.env.MASTRA_DEFAULT_STORAGE_URL || `:memory:`
|
|
71
72
|
}
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
|
-
this.#telemetry =
|
|
75
|
+
this.#telemetry = chunkPHWEC4VD_cjs.Telemetry.init(config?.telemetry);
|
|
75
76
|
if (this.#telemetry) {
|
|
76
77
|
this.#storage = this.#telemetry.traceClass(storage, {
|
|
77
78
|
excludeMethods: ["__setTelemetry", "__getTelemetry"]
|
|
@@ -175,6 +176,9 @@ This is a warning for now, but will throw an error in the future
|
|
|
175
176
|
this.#workflows[key] = workflow;
|
|
176
177
|
});
|
|
177
178
|
}
|
|
179
|
+
if (config?.server) {
|
|
180
|
+
this.#server = config.server;
|
|
181
|
+
}
|
|
178
182
|
this.setLogger({
|
|
179
183
|
logger
|
|
180
184
|
});
|
|
@@ -262,7 +266,7 @@ This is a warning for now, but will throw an error in the future
|
|
|
262
266
|
}
|
|
263
267
|
}
|
|
264
268
|
setTelemetry(telemetry) {
|
|
265
|
-
this.#telemetry =
|
|
269
|
+
this.#telemetry = chunkPHWEC4VD_cjs.Telemetry.init(telemetry);
|
|
266
270
|
if (this.#agents) {
|
|
267
271
|
Object.keys(this.#agents).forEach(key => {
|
|
268
272
|
if (this.#telemetry) {
|
|
@@ -334,6 +338,9 @@ This is a warning for now, but will throw an error in the future
|
|
|
334
338
|
getNetworks() {
|
|
335
339
|
return Object.values(this.#networks || {});
|
|
336
340
|
}
|
|
341
|
+
getServer() {
|
|
342
|
+
return this.#server;
|
|
343
|
+
}
|
|
337
344
|
/**
|
|
338
345
|
* Get a specific network by ID
|
|
339
346
|
* @param networkId - The ID of the network to retrieve
|
|
@@ -353,6 +360,9 @@ This is a warning for now, but will throw an error in the future
|
|
|
353
360
|
if (!transportId) {
|
|
354
361
|
throw new Error("Transport ID is required");
|
|
355
362
|
}
|
|
363
|
+
if (!this.#logger?.getLogsByRunId) {
|
|
364
|
+
throw new Error("Logger is not set");
|
|
365
|
+
}
|
|
356
366
|
return await this.#logger.getLogsByRunId({
|
|
357
367
|
runId,
|
|
358
368
|
transportId
|
|
@@ -362,6 +372,10 @@ This is a warning for now, but will throw an error in the future
|
|
|
362
372
|
if (!transportId) {
|
|
363
373
|
throw new Error("Transport ID is required");
|
|
364
374
|
}
|
|
375
|
+
if (!this.#logger?.getLogs) {
|
|
376
|
+
throw new Error("Logger is not set");
|
|
377
|
+
}
|
|
378
|
+
console.log(this.#logger);
|
|
365
379
|
return await this.#logger.getLogs(transportId);
|
|
366
380
|
}
|
|
367
381
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDCGLGWHI_cjs = require('./chunk-DCGLGWHI.cjs');
|
|
4
4
|
|
|
5
5
|
// src/storage/default-proxy-storage.ts
|
|
6
|
-
var DefaultProxyStorage = class extends
|
|
6
|
+
var DefaultProxyStorage = class extends chunkDCGLGWHI_cjs.MastraStorage {
|
|
7
7
|
storage = null;
|
|
8
8
|
storageConfig;
|
|
9
9
|
isInitializingPromise = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InstrumentClass } from './chunk-
|
|
2
|
-
import { MastraBase } from './chunk-
|
|
1
|
+
import { InstrumentClass } from './chunk-N5ZYOQBL.js';
|
|
2
|
+
import { MastraBase } from './chunk-CLJQYXNM.js';
|
|
3
3
|
import { __decoratorStart, __decorateElement, __runInitializers } from './chunk-C6A6W6XS.js';
|
|
4
4
|
|
|
5
5
|
// src/tts/index.ts
|