@mastra/core 0.5.0-alpha.8 → 0.5.0

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.
Files changed (91) hide show
  1. package/dist/agent/index.cjs +3 -2100
  2. package/dist/agent/index.d.cts +1 -1
  3. package/dist/agent/index.d.ts +1 -1
  4. package/dist/agent/index.js +1 -1
  5. package/dist/{base-CTdONy0_.d.cts → base-CIPKleAU.d.cts} +103 -70
  6. package/dist/{base-DIn_km7X.d.ts → base-C_Oq53qk.d.ts} +103 -70
  7. package/dist/base.cjs +5 -140
  8. package/dist/bundler/index.cjs +5 -160
  9. package/dist/chunk-2W2GYEYQ.cjs +25 -0
  10. package/dist/chunk-3ASEZT7U.cjs +1586 -0
  11. package/dist/chunk-43Y7WG5W.cjs +335 -0
  12. package/dist/{chunk-HBHPTMAC.js → chunk-4Y74D74B.js} +46 -6
  13. package/dist/chunk-ENT7U27Y.cjs +37 -0
  14. package/dist/chunk-F5UYWPV4.cjs +14 -0
  15. package/dist/chunk-FL3GQXQ2.cjs +218 -0
  16. package/dist/chunk-FRQFWZDN.cjs +2 -0
  17. package/dist/chunk-GXQRMKSN.cjs +367 -0
  18. package/dist/chunk-HJPMYDWO.cjs +37 -0
  19. package/dist/chunk-IIWRJFLQ.cjs +51 -0
  20. package/dist/chunk-KFQ7Z3PO.cjs +347 -0
  21. package/dist/{chunk-SWDQYPJS.js → chunk-KP5UAFLN.js} +3 -2
  22. package/dist/chunk-KPKFLQFR.cjs +12 -0
  23. package/dist/{chunk-RRJB4TCC.js → chunk-MLFXOST6.js} +1 -1
  24. package/dist/{chunk-KBSR2LLT.js → chunk-OD7ZMKHY.js} +176 -63
  25. package/dist/chunk-OTFLHXHZ.cjs +65 -0
  26. package/dist/chunk-RWTSGWWL.cjs +81 -0
  27. package/dist/chunk-ST5RMVLG.cjs +87 -0
  28. package/dist/chunk-SYQ7NK2E.cjs +24 -0
  29. package/dist/chunk-UZNQG7QO.cjs +1868 -0
  30. package/dist/chunk-V5ORZPFW.cjs +38 -0
  31. package/dist/chunk-VA4P7QJT.cjs +443 -0
  32. package/dist/chunk-WB2HREXE.cjs +166 -0
  33. package/dist/chunk-WOMOGDGR.cjs +691 -0
  34. package/dist/chunk-XB2TJ7LX.cjs +408 -0
  35. package/dist/{chunk-QABMKXI3.js → chunk-XF2FMJYK.js} +1 -1
  36. package/dist/chunk-XLSROQ26.cjs +91 -0
  37. package/dist/chunk-YK3XJ52U.cjs +192 -0
  38. package/dist/{chunk-SF5GHHOQ.js → chunk-YPD6BQIM.js} +121 -93
  39. package/dist/deployer/index.cjs +5 -167
  40. package/dist/eval/index.cjs +9 -105
  41. package/dist/eval/index.d.cts +1 -1
  42. package/dist/eval/index.d.ts +1 -1
  43. package/dist/hooks/index.cjs +14 -83
  44. package/dist/index.cjs +253 -7470
  45. package/dist/index.d.cts +4 -4
  46. package/dist/index.d.ts +4 -4
  47. package/dist/index.js +7 -7
  48. package/dist/integration/index.cjs +9 -108
  49. package/dist/integration/index.d.cts +1 -1
  50. package/dist/integration/index.d.ts +1 -1
  51. package/dist/llm/index.d.cts +1 -1
  52. package/dist/llm/index.d.ts +1 -1
  53. package/dist/logger/index.cjs +33 -161
  54. package/dist/mastra/index.cjs +3 -1755
  55. package/dist/mastra/index.d.cts +1 -1
  56. package/dist/mastra/index.d.ts +1 -1
  57. package/dist/mastra/index.js +1 -1
  58. package/dist/memory/index.cjs +4 -2050
  59. package/dist/memory/index.d.cts +1 -1
  60. package/dist/memory/index.d.ts +1 -1
  61. package/dist/memory/index.js +1 -1
  62. package/dist/relevance/index.cjs +10 -2161
  63. package/dist/relevance/index.d.cts +19 -2
  64. package/dist/relevance/index.d.ts +19 -2
  65. package/dist/relevance/index.js +1 -1
  66. package/dist/storage/index.cjs +29 -367
  67. package/dist/storage/index.d.cts +1 -1
  68. package/dist/storage/index.d.ts +1 -1
  69. package/dist/storage/libsql/index.cjs +9 -798
  70. package/dist/storage/libsql/index.d.cts +1 -1
  71. package/dist/storage/libsql/index.d.ts +1 -1
  72. package/dist/telemetry/index.cjs +21 -408
  73. package/dist/telemetry/index.d.cts +1 -1
  74. package/dist/telemetry/index.d.ts +1 -1
  75. package/dist/tools/index.cjs +11 -22
  76. package/dist/tools/index.d.cts +3 -3
  77. package/dist/tools/index.d.ts +3 -3
  78. package/dist/tts/index.cjs +3 -328
  79. package/dist/utils.cjs +41 -309
  80. package/dist/utils.d.cts +10 -4
  81. package/dist/utils.d.ts +10 -4
  82. package/dist/utils.js +1 -1
  83. package/dist/vector/filter/index.cjs +7 -189
  84. package/dist/vector/index.cjs +5 -172
  85. package/dist/vector/libsql/index.cjs +9 -1047
  86. package/dist/voice/index.cjs +8 -306
  87. package/dist/workflows/index.cjs +65 -1925
  88. package/dist/workflows/index.d.cts +4 -3
  89. package/dist/workflows/index.d.ts +4 -3
  90. package/dist/workflows/index.js +1 -1
  91. package/package.json +27 -27
@@ -10,16 +10,35 @@ _Mastra_decorators = [InstrumentClass({
10
10
  excludeMethods: ["getLogger", "getTelemetry"]
11
11
  })];
12
12
  var Mastra = class {
13
- vectors;
14
- agents;
15
- logger;
16
- workflows;
17
- telemetry;
18
- tts;
19
- deployer;
13
+ #vectors;
14
+ #agents;
15
+ #logger;
16
+ #workflows;
17
+ #tts;
18
+ #deployer;
19
+ #serverMiddleware = [];
20
+ #telemetry;
21
+ /**
22
+ * @deprecated use getStorage() instead
23
+ */
20
24
  storage;
25
+ /**
26
+ * @deprecated use getMemory() instead
27
+ */
21
28
  memory;
29
+ /**
30
+ * @deprecated use getTelemetry() instead
31
+ */
32
+ get telemetry() {
33
+ return this.#telemetry;
34
+ }
22
35
  constructor(config) {
36
+ if (config?.serverMiddleware) {
37
+ this.#serverMiddleware = config.serverMiddleware.map(m => ({
38
+ handler: m.handler,
39
+ path: m.path || "/api/*"
40
+ }));
41
+ }
23
42
  let logger;
24
43
  if (config?.logger === false) {
25
44
  logger = noopLogger;
@@ -34,7 +53,7 @@ var Mastra = class {
34
53
  });
35
54
  }
36
55
  }
37
- this.logger = logger;
56
+ this.#logger = logger;
38
57
  let storage = config?.storage;
39
58
  if (!storage) {
40
59
  storage = new LibSQLStore({
@@ -54,55 +73,55 @@ var Mastra = class {
54
73
  })
55
74
  }
56
75
  };
57
- this.telemetry = Telemetry.init(newTelemetry);
76
+ this.#telemetry = Telemetry.init(newTelemetry);
58
77
  } else if (config?.telemetry) {
59
- this.telemetry = Telemetry.init(config?.telemetry);
78
+ this.#telemetry = Telemetry.init(config?.telemetry);
60
79
  }
61
80
  if (config?.deployer) {
62
- this.deployer = config.deployer;
63
- if (this.telemetry) {
64
- this.deployer = this.telemetry.traceClass(config.deployer, {
81
+ this.#deployer = config.deployer;
82
+ if (this.#telemetry) {
83
+ this.#deployer = this.#telemetry.traceClass(config.deployer, {
65
84
  excludeMethods: ["__setTelemetry", "__getTelemetry"]
66
85
  });
67
- this.deployer.__setTelemetry(this.telemetry);
86
+ this.#deployer.__setTelemetry(this.#telemetry);
68
87
  }
69
88
  }
70
- if (this.telemetry) {
71
- this.storage = this.telemetry.traceClass(storage, {
89
+ if (this.#telemetry) {
90
+ this.storage = this.#telemetry.traceClass(storage, {
72
91
  excludeMethods: ["__setTelemetry", "__getTelemetry"]
73
92
  });
74
- this.storage.__setTelemetry(this.telemetry);
93
+ this.storage.__setTelemetry(this.#telemetry);
75
94
  } else {
76
95
  this.storage = storage;
77
96
  }
78
97
  if (config?.vectors) {
79
98
  let vectors = {};
80
99
  Object.entries(config.vectors).forEach(([key, vector]) => {
81
- if (this.telemetry) {
82
- vectors[key] = this.telemetry.traceClass(vector, {
100
+ if (this.#telemetry) {
101
+ vectors[key] = this.#telemetry.traceClass(vector, {
83
102
  excludeMethods: ["__setTelemetry", "__getTelemetry"]
84
103
  });
85
- vectors[key].__setTelemetry(this.telemetry);
104
+ vectors[key].__setTelemetry(this.#telemetry);
86
105
  } else {
87
106
  vectors[key] = vector;
88
107
  }
89
108
  });
90
- this.vectors = vectors;
109
+ this.#vectors = vectors;
91
110
  }
92
111
  if (config?.vectors) {
93
- this.vectors = config.vectors;
112
+ this.#vectors = config.vectors;
94
113
  }
95
114
  if (config?.memory) {
96
115
  this.memory = config.memory;
97
- if (this.telemetry) {
98
- this.memory = this.telemetry.traceClass(config.memory, {
116
+ if (this.#telemetry) {
117
+ this.memory = this.#telemetry.traceClass(config.memory, {
99
118
  excludeMethods: ["__setTelemetry", "__getTelemetry"]
100
119
  });
101
- this.memory.__setTelemetry(this.telemetry);
120
+ this.memory.__setTelemetry(this.#telemetry);
102
121
  }
103
122
  }
104
123
  if (config && `memory` in config) {
105
- this.logger.warn(`
124
+ this.#logger.warn(`
106
125
  Memory should be added to Agents, not to Mastra.
107
126
 
108
127
  Instead of:
@@ -115,14 +134,14 @@ This is a warning for now, but will throw an error in the future
115
134
  `);
116
135
  }
117
136
  if (config?.tts) {
118
- this.tts = config.tts;
119
- Object.entries(this.tts).forEach(([key, ttsCl]) => {
120
- if (this.tts?.[key]) {
121
- if (this.telemetry) {
122
- this.tts[key] = this.telemetry.traceClass(ttsCl, {
137
+ this.#tts = config.tts;
138
+ Object.entries(this.#tts).forEach(([key, ttsCl]) => {
139
+ if (this.#tts?.[key]) {
140
+ if (this.#telemetry) {
141
+ this.#tts[key] = this.#telemetry.traceClass(ttsCl, {
123
142
  excludeMethods: ["__setTelemetry", "__getTelemetry"]
124
143
  });
125
- this.tts[key].__setTelemetry(this.telemetry);
144
+ this.#tts[key].__setTelemetry(this.#telemetry);
126
145
  }
127
146
  }
128
147
  });
@@ -135,32 +154,32 @@ This is a warning for now, but will throw an error in the future
135
154
  }
136
155
  agent.__registerPrimitives({
137
156
  logger: this.getLogger(),
138
- telemetry: this.telemetry,
157
+ telemetry: this.#telemetry,
139
158
  storage: this.storage,
140
159
  memory: this.memory,
141
160
  agents,
142
- tts: this.tts,
143
- vectors: this.vectors
161
+ tts: this.#tts,
162
+ vectors: this.#vectors
144
163
  });
145
164
  agent.__registerMastra(this);
146
165
  agents[key] = agent;
147
166
  });
148
167
  }
149
- this.agents = agents;
150
- this.workflows = {};
168
+ this.#agents = agents;
169
+ this.#workflows = {};
151
170
  if (config?.workflows) {
152
171
  Object.entries(config.workflows).forEach(([key, workflow]) => {
153
172
  workflow.__registerMastra(this);
154
173
  workflow.__registerPrimitives({
155
174
  logger: this.getLogger(),
156
- telemetry: this.telemetry,
175
+ telemetry: this.#telemetry,
157
176
  storage: this.storage,
158
177
  memory: this.memory,
159
178
  agents,
160
- tts: this.tts,
161
- vectors: this.vectors
179
+ tts: this.#tts,
180
+ vectors: this.#vectors
162
181
  });
163
- this.workflows[key] = workflow;
182
+ this.#workflows[key] = workflow;
164
183
  });
165
184
  }
166
185
  this.setLogger({
@@ -168,32 +187,32 @@ This is a warning for now, but will throw an error in the future
168
187
  });
169
188
  }
170
189
  getAgent(name) {
171
- const agent = this.agents?.[name];
190
+ const agent = this.#agents?.[name];
172
191
  if (!agent) {
173
192
  throw new Error(`Agent with name ${String(name)} not found`);
174
193
  }
175
- return this.agents[name];
194
+ return this.#agents[name];
176
195
  }
177
196
  getAgents() {
178
- return this.agents;
197
+ return this.#agents;
179
198
  }
180
199
  getVector(name) {
181
- const vector = this.vectors?.[name];
200
+ const vector = this.#vectors?.[name];
182
201
  if (!vector) {
183
202
  throw new Error(`Vector with name ${String(name)} not found`);
184
203
  }
185
204
  return vector;
186
205
  }
187
206
  getVectors() {
188
- return this.vectors;
207
+ return this.#vectors;
189
208
  }
190
209
  getDeployer() {
191
- return this.deployer;
210
+ return this.#deployer;
192
211
  }
193
212
  getWorkflow(id, {
194
213
  serialized
195
214
  } = {}) {
196
- const workflow = this.workflows?.[id];
215
+ const workflow = this.#workflows?.[id];
197
216
  if (!workflow) {
198
217
  throw new Error(`Workflow with ID ${String(id)} not found`);
199
218
  }
@@ -206,7 +225,7 @@ This is a warning for now, but will throw an error in the future
206
225
  }
207
226
  getWorkflows(props = {}) {
208
227
  if (props.serialized) {
209
- return Object.entries(this.workflows).reduce((acc, [k, v]) => {
228
+ return Object.entries(this.#workflows).reduce((acc, [k, v]) => {
210
229
  return {
211
230
  ...acc,
212
231
  [k]: {
@@ -215,7 +234,7 @@ This is a warning for now, but will throw an error in the future
215
234
  };
216
235
  }, {});
217
236
  }
218
- return this.workflows;
237
+ return this.#workflows;
219
238
  }
220
239
  setStorage(storage) {
221
240
  this.storage = storage;
@@ -223,92 +242,101 @@ This is a warning for now, but will throw an error in the future
223
242
  setLogger({
224
243
  logger
225
244
  }) {
226
- this.logger = logger;
227
- if (this.agents) {
228
- Object.keys(this.agents).forEach(key => {
229
- this.agents?.[key]?.__setLogger(this.logger);
245
+ this.#logger = logger;
246
+ if (this.#agents) {
247
+ Object.keys(this.#agents).forEach(key => {
248
+ this.#agents?.[key]?.__setLogger(this.#logger);
230
249
  });
231
250
  }
232
251
  if (this.memory) {
233
- this.memory.__setLogger(this.logger);
252
+ this.memory.__setLogger(this.#logger);
234
253
  }
235
- if (this.deployer) {
236
- this.deployer.__setLogger(this.logger);
254
+ if (this.#deployer) {
255
+ this.#deployer.__setLogger(this.#logger);
237
256
  }
238
- if (this.tts) {
239
- Object.keys(this.tts).forEach(key => {
240
- this.tts?.[key]?.__setLogger(this.logger);
257
+ if (this.#tts) {
258
+ Object.keys(this.#tts).forEach(key => {
259
+ this.#tts?.[key]?.__setLogger(this.#logger);
241
260
  });
242
261
  }
243
262
  if (this.storage) {
244
- this.storage.__setLogger(this.logger);
263
+ this.storage.__setLogger(this.#logger);
245
264
  }
246
- if (this.vectors) {
247
- Object.keys(this.vectors).forEach(key => {
248
- this.vectors?.[key]?.__setLogger(this.logger);
265
+ if (this.#vectors) {
266
+ Object.keys(this.#vectors).forEach(key => {
267
+ this.#vectors?.[key]?.__setLogger(this.#logger);
249
268
  });
250
269
  }
251
270
  }
252
271
  setTelemetry(telemetry) {
253
- this.telemetry = Telemetry.init(telemetry);
254
- if (this.agents) {
255
- Object.keys(this.agents).forEach(key => {
256
- if (this.telemetry) {
257
- this.agents?.[key]?.__setTelemetry(this.telemetry);
272
+ this.#telemetry = Telemetry.init(telemetry);
273
+ if (this.#agents) {
274
+ Object.keys(this.#agents).forEach(key => {
275
+ if (this.#telemetry) {
276
+ this.#agents?.[key]?.__setTelemetry(this.#telemetry);
258
277
  }
259
278
  });
260
279
  }
261
280
  if (this.memory) {
262
- this.memory = this.telemetry.traceClass(this.memory, {
281
+ this.memory = this.#telemetry.traceClass(this.memory, {
263
282
  excludeMethods: ["__setTelemetry", "__getTelemetry"]
264
283
  });
265
- this.memory.__setTelemetry(this.telemetry);
284
+ this.memory.__setTelemetry(this.#telemetry);
266
285
  }
267
- if (this.deployer) {
268
- this.deployer = this.telemetry.traceClass(this.deployer, {
286
+ if (this.#deployer) {
287
+ this.#deployer = this.#telemetry.traceClass(this.#deployer, {
269
288
  excludeMethods: ["__setTelemetry", "__getTelemetry"]
270
289
  });
271
- this.deployer.__setTelemetry(this.telemetry);
290
+ this.#deployer.__setTelemetry(this.#telemetry);
272
291
  }
273
- if (this.tts) {
292
+ if (this.#tts) {
274
293
  let tts = {};
275
- Object.entries(this.tts).forEach(([key, ttsCl]) => {
276
- if (this.telemetry) {
277
- tts[key] = this.telemetry.traceClass(ttsCl, {
294
+ Object.entries(this.#tts).forEach(([key, ttsCl]) => {
295
+ if (this.#telemetry) {
296
+ tts[key] = this.#telemetry.traceClass(ttsCl, {
278
297
  excludeMethods: ["__setTelemetry", "__getTelemetry"]
279
298
  });
280
- tts[key].__setTelemetry(this.telemetry);
299
+ tts[key].__setTelemetry(this.#telemetry);
281
300
  }
282
301
  });
283
- this.tts = tts;
302
+ this.#tts = tts;
284
303
  }
285
304
  if (this.storage) {
286
- this.storage = this.telemetry.traceClass(this.storage, {
305
+ this.storage = this.#telemetry.traceClass(this.storage, {
287
306
  excludeMethods: ["__setTelemetry", "__getTelemetry"]
288
307
  });
289
- this.storage.__setTelemetry(this.telemetry);
308
+ this.storage.__setTelemetry(this.#telemetry);
290
309
  }
291
- if (this.vectors) {
310
+ if (this.#vectors) {
292
311
  let vectors = {};
293
- Object.entries(this.vectors).forEach(([key, vector]) => {
294
- if (this.telemetry) {
295
- vectors[key] = this.telemetry.traceClass(vector, {
312
+ Object.entries(this.#vectors).forEach(([key, vector]) => {
313
+ if (this.#telemetry) {
314
+ vectors[key] = this.#telemetry.traceClass(vector, {
296
315
  excludeMethods: ["__setTelemetry", "__getTelemetry"]
297
316
  });
298
- vectors[key].__setTelemetry(this.telemetry);
317
+ vectors[key].__setTelemetry(this.#telemetry);
299
318
  }
300
319
  });
301
- this.vectors = vectors;
320
+ this.#vectors = vectors;
302
321
  }
303
322
  }
304
323
  getTTS() {
305
- return this.tts;
324
+ return this.#tts;
306
325
  }
307
326
  getLogger() {
308
- return this.logger;
327
+ return this.#logger;
309
328
  }
310
329
  getTelemetry() {
311
- return this.telemetry;
330
+ return this.#telemetry;
331
+ }
332
+ getMemory() {
333
+ return this.memory;
334
+ }
335
+ getStorage() {
336
+ return this.storage;
337
+ }
338
+ getServerMiddleware() {
339
+ return this.#serverMiddleware;
312
340
  }
313
341
  async getLogsByRunId({
314
342
  runId,
@@ -317,7 +345,7 @@ This is a warning for now, but will throw an error in the future
317
345
  if (!transportId) {
318
346
  throw new Error("Transport ID is required");
319
347
  }
320
- return await this.logger.getLogsByRunId({
348
+ return await this.#logger.getLogsByRunId({
321
349
  runId,
322
350
  transportId
323
351
  });
@@ -326,7 +354,7 @@ This is a warning for now, but will throw an error in the future
326
354
  if (!transportId) {
327
355
  throw new Error("Transport ID is required");
328
356
  }
329
- return await this.logger.getLogs(transportId);
357
+ return await this.#logger.getLogs(transportId);
330
358
  }
331
359
  };
332
360
  Mastra = /*@__PURE__*/(_ => {
@@ -1,172 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var promises = require('fs/promises');
4
- var dotenv = require('dotenv');
5
- var stream = require('stream');
6
- var pino = require('pino');
7
- var pretty = require('pino-pretty');
3
+ var chunkKPKFLQFR_cjs = require('../chunk-KPKFLQFR.cjs');
8
4
 
9
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
5
 
11
- var pino__default = /*#__PURE__*/_interopDefault(pino);
12
- var pretty__default = /*#__PURE__*/_interopDefault(pretty);
13
6
 
14
- // src/bundler/index.ts
15
- var RegisteredLogger = {
16
- LLM: "LLM"};
17
- var LogLevel = {
18
- INFO: "info"};
19
- var Logger = class {
20
- logger;
21
- transports;
22
- constructor(options = {}) {
23
- this.transports = options.transports || {};
24
- const transportsAry = Object.entries(this.transports);
25
- this.logger = pino__default.default(
26
- {
27
- name: options.name || "app",
28
- level: options.level || LogLevel.INFO,
29
- formatters: {
30
- level: (label) => {
31
- return {
32
- level: label
33
- };
34
- }
35
- }
36
- },
37
- options.overrideDefaultTransports ? options?.transports?.default : transportsAry.length === 0 ? pretty__default.default({
38
- colorize: true,
39
- levelFirst: true,
40
- ignore: "pid,hostname",
41
- colorizeObjects: true,
42
- translateTime: "SYS:standard",
43
- singleLine: false
44
- }) : pino__default.default.multistream([
45
- ...transportsAry.map(([_, transport]) => ({
46
- stream: transport,
47
- level: options.level || LogLevel.INFO
48
- })),
49
- {
50
- stream: pretty__default.default({
51
- colorize: true,
52
- levelFirst: true,
53
- ignore: "pid,hostname",
54
- colorizeObjects: true,
55
- translateTime: "SYS:standard",
56
- singleLine: false
57
- }),
58
- level: options.level || LogLevel.INFO
59
- }
60
- ])
61
- );
62
- }
63
- debug(message, args = {}) {
64
- this.logger.debug(args, message);
65
- }
66
- info(message, args = {}) {
67
- this.logger.info(args, message);
68
- }
69
- warn(message, args = {}) {
70
- this.logger.warn(args, message);
71
- }
72
- error(message, args = {}) {
73
- this.logger.error(args, message);
74
- }
75
- // Stream creation for process output handling
76
- createStream() {
77
- return new stream.Transform({
78
- transform: (chunk, _encoding, callback) => {
79
- const line = chunk.toString().trim();
80
- if (line) {
81
- this.info(line);
82
- }
83
- callback(null, chunk);
84
- }
85
- });
86
- }
87
- async getLogs(transportId) {
88
- if (!transportId || !this.transports[transportId]) {
89
- return [];
90
- }
91
- return this.transports[transportId].getLogs();
92
- }
93
- async getLogsByRunId({ runId, transportId }) {
94
- return this.transports[transportId]?.getLogsByRunId({ runId });
95
- }
96
- };
97
- function createLogger(options) {
98
- return new Logger(options);
99
- }
100
-
101
- // src/base.ts
102
- var MastraBase = class {
103
- component = RegisteredLogger.LLM;
104
- logger;
105
- name;
106
- telemetry;
107
- constructor({ component, name }) {
108
- this.component = component || RegisteredLogger.LLM;
109
- this.name = name;
110
- this.logger = createLogger({ name: `${this.component} - ${this.name}` });
111
- }
112
- /**
113
- * Set the logger for the agent
114
- * @param logger
115
- */
116
- __setLogger(logger) {
117
- this.logger = logger;
118
- this.logger.debug(`Logger updated [component=${this.component}] [name=${this.name}]`);
119
- }
120
- /**
121
- * Set the telemetry for the
122
- * @param telemetry
123
- */
124
- __setTelemetry(telemetry) {
125
- this.telemetry = telemetry;
126
- this.logger.debug(`Telemetry updated [component=${this.component}] [tracer=${this.telemetry.tracer}]`);
127
- }
128
- /**
129
- * Get the telemetry on the vector
130
- * @returns telemetry
131
- */
132
- __getTelemetry() {
133
- return this.telemetry;
134
- }
135
- /*
136
- get experimental_telemetry config
137
- */
138
- get experimental_telemetry() {
139
- return this.telemetry ? {
140
- // tracer: this.telemetry.tracer,
141
- tracer: this.telemetry.getBaggageTracer(),
142
- isEnabled: !!this.telemetry.tracer
143
- } : void 0;
144
- }
145
- };
146
-
147
- // src/bundler/index.ts
148
- var MastraBundler = class extends MastraBase {
149
- constructor({ name, component = "BUNDLER" }) {
150
- super({ component, name });
151
- }
152
- async loadEnvVars() {
153
- const envVars = /* @__PURE__ */ new Map();
154
- for (const file of await this.getEnvFiles()) {
155
- const content = await promises.readFile(file, "utf-8");
156
- const config = dotenv.parse(content);
157
- Object.entries(config).forEach(([key, value]) => {
158
- envVars.set(key, value);
159
- });
160
- }
161
- return envVars;
162
- }
163
- };
164
-
165
- // src/deployer/index.ts
166
- var MastraDeployer = class extends MastraBundler {
167
- constructor({ name }) {
168
- super({ component: "DEPLOYER", name });
169
- }
170
- };
171
-
172
- exports.MastraDeployer = MastraDeployer;
7
+ Object.defineProperty(exports, "MastraDeployer", {
8
+ enumerable: true,
9
+ get: function () { return chunkKPKFLQFR_cjs.MastraDeployer; }
10
+ });
@@ -1,110 +1,14 @@
1
1
  'use strict';
2
2
 
3
- // src/eval/metric.ts
4
- var Metric = class {
5
- };
3
+ var chunkV5ORZPFW_cjs = require('../chunk-V5ORZPFW.cjs');
6
4
 
7
- // src/hooks/mitt.ts
8
- function mitt(all) {
9
- all = all || /* @__PURE__ */ new Map();
10
- return {
11
- /**
12
- * A Map of event names to registered handler functions.
13
- */
14
- all,
15
- /**
16
- * Register an event handler for the given type.
17
- * @param {string|symbol} type Type of event to listen for, or `'*'` for all events
18
- * @param {Function} handler Function to call in response to given event
19
- * @memberOf mitt
20
- */
21
- on(type, handler) {
22
- const handlers = all.get(type);
23
- if (handlers) {
24
- handlers.push(handler);
25
- } else {
26
- all.set(type, [handler]);
27
- }
28
- },
29
- /**
30
- * Remove an event handler for the given type.
31
- * If `handler` is omitted, all handlers of the given type are removed.
32
- * @param {string|symbol} type Type of event to unregister `handler` from (`'*'` to remove a wildcard handler)
33
- * @param {Function} [handler] Handler function to remove
34
- * @memberOf mitt
35
- */
36
- off(type, handler) {
37
- const handlers = all.get(type);
38
- if (handlers) {
39
- if (handler) {
40
- handlers.splice(handlers.indexOf(handler) >>> 0, 1);
41
- } else {
42
- all.set(type, []);
43
- }
44
- }
45
- },
46
- /**
47
- * Invoke all handlers for the given type.
48
- * If present, `'*'` handlers are invoked after type-matched handlers.
49
- *
50
- * Note: Manually firing '*' handlers is not supported.
51
- *
52
- * @param {string|symbol} type The event type to invoke
53
- * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
54
- * @memberOf mitt
55
- */
56
- emit(type, evt) {
57
- let handlers = all.get(type);
58
- if (handlers) {
59
- handlers.slice().map((handler) => {
60
- handler(evt);
61
- });
62
- }
63
- handlers = all.get("*");
64
- if (handlers) {
65
- handlers.slice().map((handler) => {
66
- handler(type, evt);
67
- });
68
- }
69
- }
70
- };
71
- }
72
5
 
73
- // src/hooks/index.ts
74
- var hooks = mitt();
75
- function executeHook(hook, data) {
76
- setImmediate(() => {
77
- hooks.emit(hook, data);
78
- });
79
- }
80
6
 
81
- // src/eval/evaluation.ts
82
- async function evaluate({
83
- agentName,
84
- input,
85
- metric,
86
- output,
87
- runId,
88
- globalRunId,
89
- testInfo,
90
- instructions
91
- }) {
92
- const runIdToUse = runId || crypto.randomUUID();
93
- const metricResult = await metric.measure(input.toString(), output);
94
- const traceObject = {
95
- input: input.toString(),
96
- output,
97
- result: metricResult,
98
- agentName,
99
- metricName: metric.constructor.name,
100
- instructions,
101
- globalRunId,
102
- runId: runIdToUse,
103
- testInfo
104
- };
105
- executeHook("onEvaluation" /* ON_EVALUATION */, traceObject);
106
- return metricResult;
107
- }
108
-
109
- exports.Metric = Metric;
110
- exports.evaluate = evaluate;
7
+ Object.defineProperty(exports, "Metric", {
8
+ enumerable: true,
9
+ get: function () { return chunkV5ORZPFW_cjs.Metric; }
10
+ });
11
+ Object.defineProperty(exports, "evaluate", {
12
+ enumerable: true,
13
+ get: function () { return chunkV5ORZPFW_cjs.evaluate; }
14
+ });