@mastra/core 0.9.5-alpha.0 → 0.10.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 (168) hide show
  1. package/README.md +3 -2
  2. package/dist/agent/index.cjs +2 -2
  3. package/dist/agent/index.d.cts +12 -13
  4. package/dist/agent/index.d.ts +12 -13
  5. package/dist/agent/index.js +1 -1
  6. package/dist/{base-CI7Uz2GO.d.ts → base-DttB7sJD.d.ts} +1172 -1130
  7. package/dist/{base-BV8SNIdm.d.cts → base-aJ3etsh5.d.cts} +1172 -1130
  8. package/dist/{base-H7siSAfu.d.cts → base-aPYtPBT2.d.cts} +3 -3
  9. package/dist/{base-4Z34GQL8.d.ts → base-tc5kgDTD.d.ts} +3 -3
  10. package/dist/base.cjs +2 -2
  11. package/dist/base.d.cts +2 -3
  12. package/dist/base.d.ts +2 -3
  13. package/dist/base.js +1 -1
  14. package/dist/bundler/index.cjs +2 -2
  15. package/dist/bundler/index.d.cts +2 -3
  16. package/dist/bundler/index.d.ts +2 -3
  17. package/dist/bundler/index.js +1 -1
  18. package/dist/{chunk-W4BSLENO.js → chunk-2NTUAUGH.js} +1 -1
  19. package/dist/{chunk-MF5BUJO6.js → chunk-2PW6UJMW.js} +57 -9
  20. package/dist/{chunk-HKCSQI7G.cjs → chunk-2U7ZZUFO.cjs} +2 -2
  21. package/dist/{workflows/vNext/index.js → chunk-3SQ3G2EJ.js} +16 -15
  22. package/dist/chunk-5HULBQ2W.cjs +38 -0
  23. package/dist/{chunk-BATBI3D4.cjs → chunk-5JRD3NDP.cjs} +15 -15
  24. package/dist/{chunk-EYQLTWRJ.cjs → chunk-5W2G7S44.cjs} +33 -58
  25. package/dist/chunk-75Z4BZEE.js +36 -0
  26. package/dist/{chunk-S3Y7QBO7.cjs → chunk-AOGUTJUO.cjs} +57 -50
  27. package/dist/{chunk-BZUIFK6C.js → chunk-BPTSLJHA.js} +9 -9
  28. package/dist/{chunk-JBJ7KXN5.js → chunk-C3ICEF6E.js} +1 -1
  29. package/dist/{chunk-E4FAXBUV.cjs → chunk-CWSFP2HS.cjs} +2 -2
  30. package/dist/{chunk-RWWUZTAK.js → chunk-E7CLY6SK.js} +41 -34
  31. package/dist/{chunk-235X76GC.js → chunk-FI7R232B.js} +2 -2
  32. package/dist/chunk-GQ2XQ4UN.js +321 -0
  33. package/dist/{chunk-6EPEYXAE.js → chunk-J7GDGV6F.js} +1 -1
  34. package/dist/{chunk-NLBJOFNG.js → chunk-JW5TMK2L.js} +1 -1
  35. package/dist/{chunk-NOPY74PV.js → chunk-KJQFFEEQ.js} +1 -1
  36. package/dist/{chunk-V2Q2FEVO.cjs → chunk-KSPHQSZX.cjs} +2 -2
  37. package/dist/{chunk-SU4O2A72.js → chunk-LHRZV5VG.js} +1 -22
  38. package/dist/chunk-NMDM4IZN.cjs +78 -0
  39. package/dist/chunk-OBEALYTK.js +74 -0
  40. package/dist/{chunk-PU2TNRKO.js → chunk-OCT2762Q.js} +1 -1
  41. package/dist/{chunk-5DUFC7TV.cjs → chunk-P7BGXOQV.cjs} +2 -2
  42. package/dist/{chunk-NQE264UM.cjs → chunk-PIZM25KI.cjs} +2 -23
  43. package/dist/{chunk-S7J63JOG.cjs → chunk-RVS6OUJN.cjs} +2 -2
  44. package/dist/{chunk-LF5CE7LU.cjs → chunk-SKG2NIZW.cjs} +2 -2
  45. package/dist/chunk-SWW4EBUZ.cjs +96 -0
  46. package/dist/{chunk-RGE4UF6A.cjs → chunk-TMPFLJLG.cjs} +2 -2
  47. package/dist/{workflows/vNext/index.cjs → chunk-TTKQ37ZZ.cjs} +21 -20
  48. package/dist/{chunk-F7HNPG53.cjs → chunk-U3L3NEOM.cjs} +58 -10
  49. package/dist/chunk-VHLL4AZK.js +90 -0
  50. package/dist/{chunk-EG74VBSP.cjs → chunk-YEULQPUY.cjs} +6 -6
  51. package/dist/{chunk-RVKA5VUT.js → chunk-ZB3LEHL2.js} +31 -56
  52. package/dist/{chunk-TAFOICHR.js → chunk-ZKN6HYYQ.js} +1 -1
  53. package/dist/chunk-ZZDAC5KD.cjs +325 -0
  54. package/dist/deployer/index.cjs +2 -2
  55. package/dist/deployer/index.d.cts +2 -3
  56. package/dist/deployer/index.d.ts +2 -3
  57. package/dist/deployer/index.js +1 -1
  58. package/dist/eval/index.d.cts +12 -13
  59. package/dist/eval/index.d.ts +12 -13
  60. package/dist/hooks/index.d.cts +1 -1
  61. package/dist/hooks/index.d.ts +1 -1
  62. package/dist/index.cjs +71 -158
  63. package/dist/index.d.cts +16 -24
  64. package/dist/index.d.ts +16 -24
  65. package/dist/index.js +16 -23
  66. package/dist/integration/index.cjs +3 -3
  67. package/dist/integration/index.d.cts +11 -12
  68. package/dist/integration/index.d.ts +11 -12
  69. package/dist/integration/index.js +1 -1
  70. package/dist/llm/index.d.cts +11 -12
  71. package/dist/llm/index.d.ts +11 -12
  72. package/dist/logger/index.cjs +18 -17
  73. package/dist/logger/index.d.cts +42 -2
  74. package/dist/logger/index.d.ts +42 -2
  75. package/dist/logger/index.js +2 -1
  76. package/dist/{index-QV27jkxQ.d.ts → logger-EhZkzZOr.d.cts} +38 -52
  77. package/dist/{index-QV27jkxQ.d.cts → logger-EhZkzZOr.d.ts} +38 -52
  78. package/dist/mastra/index.cjs +2 -2
  79. package/dist/mastra/index.d.cts +10 -11
  80. package/dist/mastra/index.d.ts +10 -11
  81. package/dist/mastra/index.js +1 -1
  82. package/dist/mcp/index.cjs +4 -4
  83. package/dist/mcp/index.d.cts +13 -14
  84. package/dist/mcp/index.d.ts +13 -14
  85. package/dist/mcp/index.js +2 -2
  86. package/dist/memory/index.cjs +4 -4
  87. package/dist/memory/index.d.cts +11 -12
  88. package/dist/memory/index.d.ts +11 -12
  89. package/dist/memory/index.js +1 -1
  90. package/dist/network/index.cjs +8 -8
  91. package/dist/network/index.d.cts +11 -12
  92. package/dist/network/index.d.ts +11 -12
  93. package/dist/network/index.js +4 -4
  94. package/dist/relevance/index.cjs +4 -4
  95. package/dist/relevance/index.d.cts +14 -15
  96. package/dist/relevance/index.d.ts +14 -15
  97. package/dist/relevance/index.js +1 -1
  98. package/dist/server/index.cjs +4 -0
  99. package/dist/server/index.d.cts +14 -13
  100. package/dist/server/index.d.ts +14 -13
  101. package/dist/server/index.js +4 -1
  102. package/dist/storage/index.cjs +184 -3
  103. package/dist/storage/index.d.cts +82 -12
  104. package/dist/storage/index.d.ts +82 -12
  105. package/dist/storage/index.js +186 -1
  106. package/dist/telemetry/index.d.cts +13 -14
  107. package/dist/telemetry/index.d.ts +13 -14
  108. package/dist/telemetry/otel-vendor.cjs +2 -2
  109. package/dist/telemetry/otel-vendor.d.cts +1 -1
  110. package/dist/telemetry/otel-vendor.d.ts +1 -1
  111. package/dist/telemetry/otel-vendor.js +1 -1
  112. package/dist/tools/index.cjs +4 -4
  113. package/dist/tools/index.d.cts +11 -12
  114. package/dist/tools/index.d.ts +11 -12
  115. package/dist/tools/index.js +1 -1
  116. package/dist/tts/index.cjs +2 -2
  117. package/dist/tts/index.d.cts +2 -3
  118. package/dist/tts/index.d.ts +2 -3
  119. package/dist/tts/index.js +1 -1
  120. package/dist/{types-BtMyV38I.d.ts → types-Bo1uigWx.d.cts} +1 -1
  121. package/dist/{types-BtMyV38I.d.cts → types-Bo1uigWx.d.ts} +1 -1
  122. package/dist/utils.cjs +16 -16
  123. package/dist/utils.d.cts +14 -15
  124. package/dist/utils.d.ts +14 -15
  125. package/dist/utils.js +1 -1
  126. package/dist/vector/filter/index.cjs +189 -7
  127. package/dist/vector/filter/index.js +190 -1
  128. package/dist/vector/index.cjs +2 -2
  129. package/dist/vector/index.d.cts +10 -24
  130. package/dist/vector/index.d.ts +10 -24
  131. package/dist/vector/index.js +1 -1
  132. package/dist/voice/index.cjs +4 -4
  133. package/dist/voice/index.d.cts +11 -12
  134. package/dist/voice/index.d.ts +11 -12
  135. package/dist/voice/index.js +1 -1
  136. package/dist/workflows/index.cjs +17 -69
  137. package/dist/workflows/index.d.cts +195 -75
  138. package/dist/workflows/index.d.ts +195 -75
  139. package/dist/workflows/index.js +1 -1
  140. package/dist/workflows/legacy/index.cjs +90 -0
  141. package/dist/workflows/legacy/index.d.cts +87 -0
  142. package/dist/workflows/legacy/index.d.ts +87 -0
  143. package/dist/workflows/legacy/index.js +1 -0
  144. package/package.json +19 -41
  145. package/workflows/legacy.d.ts +1 -0
  146. package/dist/chunk-CMPPXW4U.js +0 -154
  147. package/dist/chunk-GH6EMQSO.js +0 -131
  148. package/dist/chunk-JMJXBE7L.js +0 -843
  149. package/dist/chunk-LGERQTJM.js +0 -190
  150. package/dist/chunk-O44MSFMZ.cjs +0 -168
  151. package/dist/chunk-T6DN4C76.cjs +0 -134
  152. package/dist/chunk-UCZWRJRW.cjs +0 -667
  153. package/dist/chunk-YK3XJ52U.cjs +0 -192
  154. package/dist/chunk-YNOTY72R.cjs +0 -845
  155. package/dist/chunk-ZY2DW2VQ.js +0 -658
  156. package/dist/storage/libsql/index.cjs +0 -588
  157. package/dist/storage/libsql/index.d.cts +0 -104
  158. package/dist/storage/libsql/index.d.ts +0 -104
  159. package/dist/storage/libsql/index.js +0 -585
  160. package/dist/vector/libsql/index.cjs +0 -14
  161. package/dist/vector/libsql/index.d.cts +0 -86
  162. package/dist/vector/libsql/index.d.ts +0 -86
  163. package/dist/vector/libsql/index.js +0 -1
  164. package/dist/workflows/vNext/index.d.cts +0 -209
  165. package/dist/workflows/vNext/index.d.ts +0 -209
  166. package/storage/libsql.d.ts +0 -1
  167. package/vector/libsql.d.ts +0 -1
  168. package/workflows/vNext.d.ts +0 -1
@@ -1,190 +0,0 @@
1
- // src/vector/filter/base.ts
2
- var BaseFilterTranslator = class _BaseFilterTranslator {
3
- /**
4
- * Operator type checks
5
- */
6
- isOperator(key) {
7
- return key.startsWith("$");
8
- }
9
- static BASIC_OPERATORS = ["$eq", "$ne"];
10
- static NUMERIC_OPERATORS = ["$gt", "$gte", "$lt", "$lte"];
11
- static ARRAY_OPERATORS = ["$in", "$nin", "$all", "$elemMatch"];
12
- static LOGICAL_OPERATORS = ["$and", "$or", "$not", "$nor"];
13
- static ELEMENT_OPERATORS = ["$exists"];
14
- static REGEX_OPERATORS = ["$regex", "$options"];
15
- static DEFAULT_OPERATORS = {
16
- logical: _BaseFilterTranslator.LOGICAL_OPERATORS,
17
- basic: _BaseFilterTranslator.BASIC_OPERATORS,
18
- numeric: _BaseFilterTranslator.NUMERIC_OPERATORS,
19
- array: _BaseFilterTranslator.ARRAY_OPERATORS,
20
- element: _BaseFilterTranslator.ELEMENT_OPERATORS,
21
- regex: _BaseFilterTranslator.REGEX_OPERATORS
22
- };
23
- isLogicalOperator(key) {
24
- return _BaseFilterTranslator.DEFAULT_OPERATORS.logical.includes(key);
25
- }
26
- isBasicOperator(key) {
27
- return _BaseFilterTranslator.DEFAULT_OPERATORS.basic.includes(key);
28
- }
29
- isNumericOperator(key) {
30
- return _BaseFilterTranslator.DEFAULT_OPERATORS.numeric.includes(key);
31
- }
32
- isArrayOperator(key) {
33
- return _BaseFilterTranslator.DEFAULT_OPERATORS.array.includes(key);
34
- }
35
- isElementOperator(key) {
36
- return _BaseFilterTranslator.DEFAULT_OPERATORS.element.includes(key);
37
- }
38
- isRegexOperator(key) {
39
- return _BaseFilterTranslator.DEFAULT_OPERATORS.regex.includes(key);
40
- }
41
- isFieldOperator(key) {
42
- return this.isOperator(key) && !this.isLogicalOperator(key);
43
- }
44
- isCustomOperator(key) {
45
- const support = this.getSupportedOperators();
46
- return support.custom?.includes(key) ?? false;
47
- }
48
- getSupportedOperators() {
49
- return _BaseFilterTranslator.DEFAULT_OPERATORS;
50
- }
51
- isValidOperator(key) {
52
- const support = this.getSupportedOperators();
53
- const allSupported = Object.values(support).flat();
54
- return allSupported.includes(key);
55
- }
56
- /**
57
- * Value normalization for comparison operators
58
- */
59
- normalizeComparisonValue(value) {
60
- if (value instanceof Date) {
61
- return value.toISOString();
62
- }
63
- if (typeof value === "number" && Object.is(value, -0)) {
64
- return 0;
65
- }
66
- return value;
67
- }
68
- /**
69
- * Helper method to simulate $all operator using $and + $eq when needed.
70
- * Some vector stores don't support $all natively.
71
- */
72
- simulateAllOperator(field, values) {
73
- return {
74
- $and: values.map((value) => ({
75
- [field]: { $in: [this.normalizeComparisonValue(value)] }
76
- }))
77
- };
78
- }
79
- /**
80
- * Utility functions for type checking
81
- */
82
- isPrimitive(value) {
83
- return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
84
- }
85
- isRegex(value) {
86
- return value instanceof RegExp;
87
- }
88
- isEmpty(obj) {
89
- return obj === null || obj === void 0 || typeof obj === "object" && Object.keys(obj).length === 0;
90
- }
91
- static ErrorMessages = {
92
- UNSUPPORTED_OPERATOR: (op) => `Unsupported operator: ${op}`,
93
- INVALID_LOGICAL_OPERATOR_LOCATION: (op, path) => `Logical operator ${op} cannot be used at field level: ${path}`,
94
- NOT_REQUIRES_OBJECT: `$not operator requires an object`,
95
- NOT_CANNOT_BE_EMPTY: `$not operator cannot be empty`,
96
- INVALID_LOGICAL_OPERATOR_CONTENT: (path) => `Logical operators must contain field conditions, not direct operators: ${path}`,
97
- INVALID_TOP_LEVEL_OPERATOR: (op) => `Invalid top-level operator: ${op}`,
98
- ELEM_MATCH_REQUIRES_OBJECT: `$elemMatch requires an object with conditions`
99
- };
100
- /**
101
- * Helper to handle array value normalization consistently
102
- */
103
- normalizeArrayValues(values) {
104
- return values.map((value) => this.normalizeComparisonValue(value));
105
- }
106
- validateFilter(filter) {
107
- const validation = this.validateFilterSupport(filter);
108
- if (!validation.supported) {
109
- throw new Error(validation.messages.join(", "));
110
- }
111
- }
112
- /**
113
- * Validates if a filter structure is supported by the specific vector DB
114
- * and returns detailed validation information.
115
- */
116
- validateFilterSupport(node, path = "") {
117
- const messages = [];
118
- if (this.isPrimitive(node) || this.isEmpty(node)) {
119
- return { supported: true, messages: [] };
120
- }
121
- if (Array.isArray(node)) {
122
- const arrayResults = node.map((item) => this.validateFilterSupport(item, path));
123
- const arrayMessages = arrayResults.flatMap((r) => r.messages);
124
- return {
125
- supported: arrayResults.every((r) => r.supported),
126
- messages: arrayMessages
127
- };
128
- }
129
- const nodeObj = node;
130
- let isSupported = true;
131
- for (const [key, value] of Object.entries(nodeObj)) {
132
- const newPath = path ? `${path}.${key}` : key;
133
- if (this.isOperator(key)) {
134
- if (!this.isValidOperator(key)) {
135
- isSupported = false;
136
- messages.push(_BaseFilterTranslator.ErrorMessages.UNSUPPORTED_OPERATOR(key));
137
- continue;
138
- }
139
- if (!path && !this.isLogicalOperator(key)) {
140
- isSupported = false;
141
- messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_TOP_LEVEL_OPERATOR(key));
142
- continue;
143
- }
144
- if (key === "$elemMatch" && (typeof value !== "object" || Array.isArray(value))) {
145
- isSupported = false;
146
- messages.push(_BaseFilterTranslator.ErrorMessages.ELEM_MATCH_REQUIRES_OBJECT);
147
- continue;
148
- }
149
- if (this.isLogicalOperator(key)) {
150
- if (key === "$not") {
151
- if (Array.isArray(value) || typeof value !== "object") {
152
- isSupported = false;
153
- messages.push(_BaseFilterTranslator.ErrorMessages.NOT_REQUIRES_OBJECT);
154
- continue;
155
- }
156
- if (this.isEmpty(value)) {
157
- isSupported = false;
158
- messages.push(_BaseFilterTranslator.ErrorMessages.NOT_CANNOT_BE_EMPTY);
159
- continue;
160
- }
161
- continue;
162
- }
163
- if (path && !this.isLogicalOperator(path.split(".").pop())) {
164
- isSupported = false;
165
- messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_LOGICAL_OPERATOR_LOCATION(key, newPath));
166
- continue;
167
- }
168
- if (Array.isArray(value)) {
169
- const hasDirectOperators = value.some(
170
- (item) => typeof item === "object" && Object.keys(item).length === 1 && this.isFieldOperator(Object.keys(item)[0])
171
- );
172
- if (hasDirectOperators) {
173
- isSupported = false;
174
- messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_LOGICAL_OPERATOR_CONTENT(newPath));
175
- continue;
176
- }
177
- }
178
- }
179
- }
180
- const nestedValidation = this.validateFilterSupport(value, newPath);
181
- if (!nestedValidation.supported) {
182
- isSupported = false;
183
- messages.push(...nestedValidation.messages);
184
- }
185
- }
186
- return { supported: isSupported, messages };
187
- }
188
- };
189
-
190
- export { BaseFilterTranslator };
@@ -1,168 +0,0 @@
1
- 'use strict';
2
-
3
- var stream = require('stream');
4
- var pino = require('pino');
5
- var pretty = require('pino-pretty');
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
-
9
- var pino__default = /*#__PURE__*/_interopDefault(pino);
10
- var pretty__default = /*#__PURE__*/_interopDefault(pretty);
11
-
12
- // src/logger/index.ts
13
- var RegisteredLogger = {
14
- AGENT: "AGENT",
15
- NETWORK: "NETWORK",
16
- WORKFLOW: "WORKFLOW",
17
- LLM: "LLM",
18
- TTS: "TTS",
19
- VOICE: "VOICE",
20
- VECTOR: "VECTOR",
21
- BUNDLER: "BUNDLER",
22
- DEPLOYER: "DEPLOYER",
23
- MEMORY: "MEMORY",
24
- STORAGE: "STORAGE",
25
- EMBEDDINGS: "EMBEDDINGS",
26
- MCP_SERVER: "MCP_SERVER"
27
- };
28
- var LogLevel = {
29
- DEBUG: "debug",
30
- INFO: "info",
31
- WARN: "warn",
32
- ERROR: "error",
33
- NONE: "silent"
34
- };
35
- var LoggerTransport = class extends stream.Transform {
36
- constructor(opts = {}) {
37
- super({ ...opts, objectMode: true });
38
- }
39
- async getLogsByRunId(_args) {
40
- return [];
41
- }
42
- async getLogs() {
43
- return [];
44
- }
45
- };
46
- var Logger = class {
47
- logger;
48
- transports;
49
- constructor(options = {}) {
50
- this.transports = options.transports || {};
51
- const transportsAry = Object.entries(this.transports);
52
- this.logger = pino__default.default(
53
- {
54
- name: options.name || "app",
55
- level: options.level || LogLevel.INFO,
56
- formatters: {
57
- level: (label) => {
58
- return {
59
- level: label
60
- };
61
- }
62
- }
63
- },
64
- options.overrideDefaultTransports ? options?.transports?.default : transportsAry.length === 0 ? pretty__default.default({
65
- colorize: true,
66
- levelFirst: true,
67
- ignore: "pid,hostname",
68
- colorizeObjects: true,
69
- translateTime: "SYS:standard",
70
- singleLine: false
71
- }) : pino__default.default.multistream([
72
- ...transportsAry.map(([, transport]) => ({
73
- stream: transport,
74
- level: options.level || LogLevel.INFO
75
- })),
76
- {
77
- stream: pretty__default.default({
78
- colorize: true,
79
- levelFirst: true,
80
- ignore: "pid,hostname",
81
- colorizeObjects: true,
82
- translateTime: "SYS:standard",
83
- singleLine: false
84
- }),
85
- level: options.level || LogLevel.INFO
86
- }
87
- ])
88
- );
89
- }
90
- debug(message, args = {}) {
91
- this.logger.debug(args, message);
92
- }
93
- info(message, args = {}) {
94
- this.logger.info(args, message);
95
- }
96
- warn(message, args = {}) {
97
- this.logger.warn(args, message);
98
- }
99
- error(message, args = {}) {
100
- this.logger.error(args, message);
101
- }
102
- // Stream creation for process output handling
103
- createStream() {
104
- return new stream.Transform({
105
- transform: (chunk, _encoding, callback) => {
106
- const line = chunk.toString().trim();
107
- if (line) {
108
- this.info(line);
109
- }
110
- callback(null, chunk);
111
- }
112
- });
113
- }
114
- async getLogs(transportId) {
115
- if (!transportId || !this.transports[transportId]) {
116
- return [];
117
- }
118
- return this.transports[transportId].getLogs();
119
- }
120
- async getLogsByRunId({ runId, transportId }) {
121
- return this.transports[transportId]?.getLogsByRunId({ runId });
122
- }
123
- };
124
- function createLogger(options) {
125
- return new Logger(options);
126
- }
127
- var MultiLogger = class {
128
- loggers;
129
- constructor(loggers) {
130
- this.loggers = loggers;
131
- }
132
- debug(message, ...args) {
133
- this.loggers.forEach((logger) => logger.debug(message, ...args));
134
- }
135
- info(message, ...args) {
136
- this.loggers.forEach((logger) => logger.info(message, ...args));
137
- }
138
- warn(message, ...args) {
139
- this.loggers.forEach((logger) => logger.warn(message, ...args));
140
- }
141
- error(message, ...args) {
142
- this.loggers.forEach((logger) => logger.error(message, ...args));
143
- }
144
- };
145
- function combineLoggers(loggers) {
146
- return new MultiLogger(loggers);
147
- }
148
- var noopLogger = {
149
- debug: () => {
150
- },
151
- info: () => {
152
- },
153
- warn: () => {
154
- },
155
- error: () => {
156
- },
157
- cleanup: async () => {
158
- }
159
- };
160
-
161
- exports.LogLevel = LogLevel;
162
- exports.Logger = Logger;
163
- exports.LoggerTransport = LoggerTransport;
164
- exports.MultiLogger = MultiLogger;
165
- exports.RegisteredLogger = RegisteredLogger;
166
- exports.combineLoggers = combineLoggers;
167
- exports.createLogger = createLogger;
168
- exports.noopLogger = noopLogger;
@@ -1,134 +0,0 @@
1
- 'use strict';
2
-
3
- var chunk5DUFC7TV_cjs = require('./chunk-5DUFC7TV.cjs');
4
-
5
- // src/storage/default-proxy-storage.ts
6
- var DefaultProxyStorage = class extends chunk5DUFC7TV_cjs.MastraStorage {
7
- storage = null;
8
- storageConfig;
9
- isInitializingPromise = null;
10
- constructor({ config }) {
11
- super({ name: "DefaultStorage" });
12
- this.storageConfig = config;
13
- }
14
- setupStorage() {
15
- if (!this.isInitializingPromise) {
16
- this.isInitializingPromise = new Promise((resolve, reject) => {
17
- import('./storage/libsql/index.cjs').then(({ DefaultStorage }) => {
18
- this.storage = new DefaultStorage({ config: this.storageConfig });
19
- resolve();
20
- }).catch(reject);
21
- });
22
- }
23
- return this.isInitializingPromise;
24
- }
25
- async createTable({
26
- tableName,
27
- schema
28
- }) {
29
- await this.setupStorage();
30
- return this.storage.createTable({ tableName, schema });
31
- }
32
- async clearTable({ tableName }) {
33
- await this.setupStorage();
34
- return this.storage.clearTable({ tableName });
35
- }
36
- async insert({ tableName, record }) {
37
- await this.setupStorage();
38
- return this.storage.insert({ tableName, record });
39
- }
40
- async batchInsert({ tableName, records }) {
41
- await this.setupStorage();
42
- return this.storage.batchInsert({ tableName, records });
43
- }
44
- async load({ tableName, keys }) {
45
- await this.setupStorage();
46
- return this.storage.load({ tableName, keys });
47
- }
48
- async getThreadById({ threadId }) {
49
- await this.setupStorage();
50
- return this.storage.getThreadById({ threadId });
51
- }
52
- async getThreadsByResourceId({ resourceId }) {
53
- await this.setupStorage();
54
- return this.storage.getThreadsByResourceId({ resourceId });
55
- }
56
- async saveThread({ thread }) {
57
- await this.setupStorage();
58
- return this.storage.saveThread({ thread });
59
- }
60
- async updateThread({
61
- id,
62
- title,
63
- metadata
64
- }) {
65
- await this.setupStorage();
66
- return this.storage.updateThread({ id, title, metadata });
67
- }
68
- async deleteThread({ threadId }) {
69
- await this.setupStorage();
70
- return this.storage.deleteThread({ threadId });
71
- }
72
- async getMessages({ threadId, selectBy }) {
73
- await this.setupStorage();
74
- return this.storage.getMessages({ threadId, selectBy });
75
- }
76
- async saveMessages({ messages }) {
77
- await this.setupStorage();
78
- return this.storage.saveMessages({ messages });
79
- }
80
- async getEvalsByAgentName(agentName, type) {
81
- await this.setupStorage();
82
- return this.storage.getEvalsByAgentName(agentName, type);
83
- }
84
- async getTraces(options) {
85
- await this.setupStorage();
86
- return this.storage.getTraces(options);
87
- }
88
- async getWorkflowRuns(args) {
89
- await this.setupStorage();
90
- return this.storage.getWorkflowRuns(args);
91
- }
92
- async getWorkflowRunById(args) {
93
- await this.setupStorage();
94
- return this.storage.getWorkflowRunById(args);
95
- }
96
- };
97
-
98
- // src/storage/storageWithInit.ts
99
- var isAugmentedSymbol = Symbol("isAugmented");
100
- function augmentWithInit(storage) {
101
- let hasInitialized = null;
102
- const ensureInit = async () => {
103
- if (!hasInitialized) {
104
- hasInitialized = storage.init();
105
- }
106
- await hasInitialized;
107
- };
108
- if (storage[isAugmentedSymbol]) {
109
- return storage;
110
- }
111
- const proxy = new Proxy(storage, {
112
- get(target, prop) {
113
- const value = target[prop];
114
- if (typeof value === "function" && prop !== "init") {
115
- return async (...args) => {
116
- await ensureInit();
117
- return Reflect.apply(value, target, args);
118
- };
119
- }
120
- return Reflect.get(target, prop);
121
- }
122
- });
123
- Object.defineProperty(proxy, isAugmentedSymbol, {
124
- value: true,
125
- enumerable: false,
126
- // Won't show up in Object.keys() or for...in loops
127
- configurable: true
128
- // Allows the property to be deleted or modified later if needed
129
- });
130
- return proxy;
131
- }
132
-
133
- exports.DefaultProxyStorage = DefaultProxyStorage;
134
- exports.augmentWithInit = augmentWithInit;