@mastra/core 0.2.0-alpha.98 → 0.2.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 (84) hide show
  1. package/dist/agent/index.d.ts +6 -8
  2. package/dist/agent/index.js +15 -7
  3. package/dist/{telemetry-oCUM52DG.d.ts → base-BbtPAA6f.d.ts} +50 -8
  4. package/dist/{index-Cwb-5AzX.d.ts → base-Bpb7Dmwe.d.ts} +367 -320
  5. package/dist/base.d.ts +3 -43
  6. package/dist/base.js +3 -3
  7. package/dist/bundler/index.d.ts +3 -4
  8. package/dist/bundler/index.js +4 -4
  9. package/dist/{chunk-MCB4M5W4.js → chunk-22LC46YN.js} +3 -9
  10. package/dist/{chunk-MG3WAQV7.js → chunk-2JL6DQMZ.js} +20 -28
  11. package/dist/chunk-2SAHBQEF.js +3 -0
  12. package/dist/chunk-3HBFW3Q7.js +24 -0
  13. package/dist/{chunk-KNPBNSJ7.js → chunk-55GTEVHJ.js} +12 -13
  14. package/dist/chunk-65VPTVVP.js +218 -0
  15. package/dist/chunk-AWEACB2T.js +66 -0
  16. package/dist/chunk-C6A6W6XS.js +49 -0
  17. package/dist/chunk-FGZVE4CM.js +404 -0
  18. package/dist/{chunk-TYIBRZOY.js → chunk-J3W3IHDO.js} +120 -87
  19. package/dist/chunk-K36NSQWH.js +10 -0
  20. package/dist/{chunk-QXH6EK72.js → chunk-K4DFI76V.js} +382 -370
  21. package/dist/{chunk-42DYOLDV.js → chunk-MEISIZMP.js} +13 -21
  22. package/dist/chunk-MLWGYRJR.js +87 -0
  23. package/dist/{chunk-ICMEXHKD.js → chunk-O2VP5JBC.js} +48 -55
  24. package/dist/{chunk-ZJOMHCWE.js → chunk-OJ26F3J4.js} +98 -153
  25. package/dist/chunk-RG66XEJT.js +8 -0
  26. package/dist/chunk-SB37QG7O.js +1203 -0
  27. package/dist/chunk-SDBM53G4.js +32 -0
  28. package/dist/{chunk-4LJFWC2Q.js → chunk-SIFBBGY6.js} +59 -85
  29. package/dist/chunk-U6J2FOU4.js +624 -0
  30. package/dist/chunk-VB7CO5ND.js +31 -0
  31. package/dist/{chunk-C55JWGDU.js → chunk-ZJOXJFJI.js} +43 -15
  32. package/dist/deployer/index.d.ts +2 -4
  33. package/dist/deployer/index.js +5 -5
  34. package/dist/eval/index.d.ts +8 -13
  35. package/dist/eval/index.js +3 -3
  36. package/dist/filter/index.js +2 -2
  37. package/dist/hooks/index.d.ts +13 -18
  38. package/dist/hooks/index.js +2 -2
  39. package/dist/{index-CBZ2mk2H.d.ts → index-B2JCcAQt.d.ts} +1 -1
  40. package/dist/index.d.ts +15 -15
  41. package/dist/index.js +43 -69
  42. package/dist/integration/index.d.ts +8 -10
  43. package/dist/integration/index.js +6 -3
  44. package/dist/llm/index.d.ts +6 -8
  45. package/dist/llm/index.js +1 -1
  46. package/dist/logger/index.d.ts +1 -1
  47. package/dist/logger/index.js +2 -2
  48. package/dist/mastra/index.d.ts +10 -13
  49. package/dist/mastra/index.js +20 -4
  50. package/dist/memory/index.d.ts +8 -10
  51. package/dist/memory/index.js +11 -9
  52. package/dist/relevance/index.js +16 -8
  53. package/dist/storage/index.d.ts +21 -10
  54. package/dist/storage/index.js +8 -7
  55. package/dist/telemetry/index.d.ts +35 -5
  56. package/dist/telemetry/index.js +3 -2
  57. package/dist/telemetry/otel-vendor.d.ts +7 -0
  58. package/dist/telemetry/otel-vendor.js +8 -0
  59. package/dist/tools/index.d.ts +6 -8
  60. package/dist/tools/index.js +2 -2
  61. package/dist/tts/index.d.ts +2 -4
  62. package/dist/tts/index.js +6 -5
  63. package/dist/{metric-BWeQNZt6.d.ts → types-m9RryK9a.d.ts} +6 -1
  64. package/dist/utils.js +2 -2
  65. package/dist/vector/index.d.ts +4 -6
  66. package/dist/vector/index.js +4 -4
  67. package/dist/vector/libsql/index.d.ts +2 -4
  68. package/dist/vector/libsql/index.js +6 -6
  69. package/dist/{workflow-DTtv7_Eq.d.ts → workflow-Cy8UTGCt.d.ts} +3 -6
  70. package/dist/workflows/index.d.ts +7 -9
  71. package/dist/workflows/index.js +4 -4
  72. package/package.json +14 -10
  73. package/dist/chunk-4ZUSEHLH.js +0 -285
  74. package/dist/chunk-AJJZUHB4.js +0 -14
  75. package/dist/chunk-G4MCO7XF.js +0 -70
  76. package/dist/chunk-HBTQNIAX.js +0 -90
  77. package/dist/chunk-HPXWJBQK.js +0 -222
  78. package/dist/chunk-JJ57BXQR.js +0 -16
  79. package/dist/chunk-JP37ODNX.js +0 -36
  80. package/dist/chunk-K3N7KJHH.js +0 -52
  81. package/dist/chunk-MDM2JS2U.js +0 -1288
  82. package/dist/chunk-VOUPGVRD.js +0 -27
  83. package/dist/chunk-Z7JFMQZZ.js +0 -551
  84. /package/dist/{chunk-AE3H2QEY.js → chunk-VDOJTUYY.js} +0 -0
@@ -1,17 +1,16 @@
1
- import { createTool } from './chunk-VOUPGVRD.js';
2
- import { __name, __publicField } from './chunk-AJJZUHB4.js';
1
+ import { createTool } from './chunk-3HBFW3Q7.js';
3
2
  import { z } from 'zod';
4
3
 
5
4
  // src/integration/integration.ts
6
- var _Integration = class _Integration {
5
+ var Integration = class {
6
+ name = "Integration";
7
+ workflows;
7
8
  constructor() {
8
- __publicField(this, "name", "Integration");
9
- __publicField(this, "workflows");
10
9
  this.workflows = {};
11
10
  }
12
11
  /**
13
- * Workflows
14
- */
12
+ * Workflows
13
+ */
15
14
  registerWorkflow(name, fn) {
16
15
  if (this.workflows[name]) {
17
16
  throw new Error(`Sync function "${name}" already registered`);
@@ -32,8 +31,8 @@ var _Integration = class _Integration {
32
31
  return this.workflows;
33
32
  }
34
33
  /**
35
- * TOOLS
36
- */
34
+ * TOOLS
35
+ */
37
36
  getStaticTools(_params) {
38
37
  throw new Error("Method not implemented.");
39
38
  }
@@ -44,11 +43,9 @@ var _Integration = class _Integration {
44
43
  throw new Error("Method not implemented");
45
44
  }
46
45
  };
47
- __name(_Integration, "Integration");
48
- var Integration = _Integration;
49
- var _OpenAPIToolset = class _OpenAPIToolset {
46
+ var OpenAPIToolset = class {
47
+ authType = "API_KEY";
50
48
  constructor() {
51
- __publicField(this, "authType", "API_KEY");
52
49
  }
53
50
  get toolSchemas() {
54
51
  return {};
@@ -74,23 +71,18 @@ var _OpenAPIToolset = class _OpenAPIToolset {
74
71
  inputSchema: schemas[key] || z.object({}),
75
72
  description: comment || fallbackComment,
76
73
  // documentation: doc || fallbackComment,
77
- execute: /* @__PURE__ */ __name(async ({ context }) => {
74
+ execute: async ({ context }) => {
78
75
  const client2 = await this.getApiClient();
79
76
  const value = client2[key];
80
77
  return value({
81
78
  ...context
82
79
  });
83
- }, "execute")
80
+ }
84
81
  });
85
- return {
86
- ...acc,
87
- [key]: tool
88
- };
82
+ return { ...acc, [key]: tool };
89
83
  }, {});
90
84
  return tools;
91
85
  }
92
86
  };
93
- __name(_OpenAPIToolset, "OpenAPIToolset");
94
- var OpenAPIToolset = _OpenAPIToolset;
95
87
 
96
88
  export { Integration, OpenAPIToolset };
@@ -0,0 +1,87 @@
1
+ // src/eval/metric.ts
2
+ var Metric = class {
3
+ };
4
+
5
+ // src/hooks/mitt.ts
6
+ function mitt(all) {
7
+ all = all || /* @__PURE__ */ new Map();
8
+ return {
9
+ /**
10
+ * A Map of event names to registered handler functions.
11
+ */
12
+ all,
13
+ /**
14
+ * Register an event handler for the given type.
15
+ * @param {string|symbol} type Type of event to listen for, or `'*'` for all events
16
+ * @param {Function} handler Function to call in response to given event
17
+ * @memberOf mitt
18
+ */
19
+ on(type, handler) {
20
+ const handlers = all.get(type);
21
+ if (handlers) {
22
+ handlers.push(handler);
23
+ } else {
24
+ all.set(type, [handler]);
25
+ }
26
+ },
27
+ /**
28
+ * Remove an event handler for the given type.
29
+ * If `handler` is omitted, all handlers of the given type are removed.
30
+ * @param {string|symbol} type Type of event to unregister `handler` from (`'*'` to remove a wildcard handler)
31
+ * @param {Function} [handler] Handler function to remove
32
+ * @memberOf mitt
33
+ */
34
+ off(type, handler) {
35
+ const handlers = all.get(type);
36
+ if (handlers) {
37
+ if (handler) {
38
+ handlers.splice(handlers.indexOf(handler) >>> 0, 1);
39
+ } else {
40
+ all.set(type, []);
41
+ }
42
+ }
43
+ },
44
+ /**
45
+ * Invoke all handlers for the given type.
46
+ * If present, `'*'` handlers are invoked after type-matched handlers.
47
+ *
48
+ * Note: Manually firing '*' handlers is not supported.
49
+ *
50
+ * @param {string|symbol} type The event type to invoke
51
+ * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
52
+ * @memberOf mitt
53
+ */
54
+ emit(type, evt) {
55
+ let handlers = all.get(type);
56
+ if (handlers) {
57
+ handlers.slice().map((handler) => {
58
+ handler(evt);
59
+ });
60
+ }
61
+ handlers = all.get("*");
62
+ if (handlers) {
63
+ handlers.slice().map((handler) => {
64
+ handler(type, evt);
65
+ });
66
+ }
67
+ }
68
+ };
69
+ }
70
+
71
+ // src/hooks/index.ts
72
+ var AvailableHooks = /* @__PURE__ */ ((AvailableHooks2) => {
73
+ AvailableHooks2["ON_EVALUATION"] = "onEvaluation";
74
+ AvailableHooks2["ON_GENERATION"] = "onGeneration";
75
+ return AvailableHooks2;
76
+ })(AvailableHooks || {});
77
+ var hooks = mitt();
78
+ function registerHook(hook, action) {
79
+ hooks.on(hook, action);
80
+ }
81
+ function executeHook(hook, data) {
82
+ setImmediate(() => {
83
+ hooks.emit(hook, data);
84
+ });
85
+ }
86
+
87
+ export { AvailableHooks, Metric, executeHook, registerHook };
@@ -1,8 +1,8 @@
1
- import { __name, __publicField } from './chunk-AJJZUHB4.js';
2
1
  import pino from 'pino';
3
2
  import pretty from 'pino-pretty';
4
3
  import { Transform } from 'stream';
5
4
 
5
+ // src/logger/index.ts
6
6
  var RegisteredLogger = {
7
7
  AGENT: "AGENT",
8
8
  WORKFLOW: "WORKFLOW",
@@ -22,7 +22,7 @@ var LogLevel = {
22
22
  ERROR: "error",
23
23
  NONE: "silent"
24
24
  };
25
- var _LoggerTransport = class _LoggerTransport extends Transform {
25
+ var LoggerTransport = class extends Transform {
26
26
  async getLogsByRunId({ runId }) {
27
27
  console.log(runId);
28
28
  return [];
@@ -31,41 +31,42 @@ var _LoggerTransport = class _LoggerTransport extends Transform {
31
31
  return [];
32
32
  }
33
33
  };
34
- __name(_LoggerTransport, "LoggerTransport");
35
- var LoggerTransport = _LoggerTransport;
36
- var _Logger = class _Logger {
34
+ var Logger = class {
35
+ logger;
36
+ transports;
37
37
  constructor(options = {}) {
38
- __publicField(this, "logger");
39
- __publicField(this, "transports");
40
38
  this.transports = options.transports || {};
41
39
  const transportsAry = Object.entries(this.transports);
42
- this.logger = pino({
43
- name: options.name || "app",
44
- level: options.level || LogLevel.INFO
45
- }, options.overrideDefaultTransports ? options?.transports?.default : transportsAry.length === 0 ? pretty({
46
- colorize: true,
47
- levelFirst: true,
48
- ignore: "pid,hostname",
49
- colorizeObjects: true,
50
- translateTime: "SYS:standard",
51
- singleLine: false
52
- }) : pino.multistream([
53
- ...transportsAry.map(([_, transport]) => ({
54
- stream: transport,
55
- level: options.level || LogLevel.INFO
56
- })),
40
+ this.logger = pino(
57
41
  {
58
- stream: pretty({
59
- colorize: true,
60
- levelFirst: true,
61
- ignore: "pid,hostname",
62
- colorizeObjects: true,
63
- translateTime: "SYS:standard",
64
- singleLine: false
65
- }),
42
+ name: options.name || "app",
66
43
  level: options.level || LogLevel.INFO
67
- }
68
- ]));
44
+ },
45
+ options.overrideDefaultTransports ? options?.transports?.default : transportsAry.length === 0 ? pretty({
46
+ colorize: true,
47
+ levelFirst: true,
48
+ ignore: "pid,hostname",
49
+ colorizeObjects: true,
50
+ translateTime: "SYS:standard",
51
+ singleLine: false
52
+ }) : pino.multistream([
53
+ ...transportsAry.map(([_, transport]) => ({
54
+ stream: transport,
55
+ level: options.level || LogLevel.INFO
56
+ })),
57
+ {
58
+ stream: pretty({
59
+ colorize: true,
60
+ levelFirst: true,
61
+ ignore: "pid,hostname",
62
+ colorizeObjects: true,
63
+ translateTime: "SYS:standard",
64
+ singleLine: false
65
+ }),
66
+ level: options.level || LogLevel.INFO
67
+ }
68
+ ])
69
+ );
69
70
  }
70
71
  debug(message, args = {}) {
71
72
  this.logger.debug(args, message);
@@ -82,13 +83,13 @@ var _Logger = class _Logger {
82
83
  // Stream creation for process output handling
83
84
  createStream() {
84
85
  return new Transform({
85
- transform: /* @__PURE__ */ __name((chunk, _encoding, callback) => {
86
+ transform: (chunk, _encoding, callback) => {
86
87
  const line = chunk.toString().trim();
87
88
  if (line) {
88
89
  this.info(line);
89
90
  }
90
91
  callback(null, chunk);
91
- }, "transform")
92
+ }
92
93
  });
93
94
  }
94
95
  async getLogs(transportId) {
@@ -98,20 +99,15 @@ var _Logger = class _Logger {
98
99
  return this.transports[transportId].getLogs();
99
100
  }
100
101
  async getLogsByRunId({ runId, transportId }) {
101
- return this.transports[transportId]?.getLogsByRunId({
102
- runId
103
- });
102
+ return this.transports[transportId]?.getLogsByRunId({ runId });
104
103
  }
105
104
  };
106
- __name(_Logger, "Logger");
107
- var Logger = _Logger;
108
105
  function createLogger(options) {
109
106
  return new Logger(options);
110
107
  }
111
- __name(createLogger, "createLogger");
112
- var _MultiLogger = class _MultiLogger {
108
+ var MultiLogger = class {
109
+ loggers;
113
110
  constructor(loggers) {
114
- __publicField(this, "loggers");
115
111
  this.loggers = loggers;
116
112
  }
117
113
  debug(message, ...args) {
@@ -127,23 +123,20 @@ var _MultiLogger = class _MultiLogger {
127
123
  this.loggers.forEach((logger) => logger.error(message, ...args));
128
124
  }
129
125
  };
130
- __name(_MultiLogger, "MultiLogger");
131
- var MultiLogger = _MultiLogger;
132
126
  function combineLoggers(loggers) {
133
127
  return new MultiLogger(loggers);
134
128
  }
135
- __name(combineLoggers, "combineLoggers");
136
129
  var noopLogger = {
137
- debug: /* @__PURE__ */ __name(() => {
138
- }, "debug"),
139
- info: /* @__PURE__ */ __name(() => {
140
- }, "info"),
141
- warn: /* @__PURE__ */ __name(() => {
142
- }, "warn"),
143
- error: /* @__PURE__ */ __name(() => {
144
- }, "error"),
145
- cleanup: /* @__PURE__ */ __name(async () => {
146
- }, "cleanup")
130
+ debug: () => {
131
+ },
132
+ info: () => {
133
+ },
134
+ warn: () => {
135
+ },
136
+ error: () => {
137
+ },
138
+ cleanup: async () => {
139
+ }
147
140
  };
148
141
 
149
142
  export { LogLevel, Logger, LoggerTransport, MultiLogger, RegisteredLogger, combineLoggers, createLogger, noopLogger };