@mastra/core 1.0.0-beta.15 → 1.0.0-beta.16

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 (180) hide show
  1. package/CHANGELOG.md +165 -0
  2. package/dist/agent/index.cjs +8 -8
  3. package/dist/agent/index.js +1 -1
  4. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  5. package/dist/{chunk-IRTICXRZ.cjs → chunk-33VDGXRH.cjs} +22 -44
  6. package/dist/chunk-33VDGXRH.cjs.map +1 -0
  7. package/dist/{chunk-DRJTNGI4.cjs → chunk-3ZRMVPQA.cjs} +7 -7
  8. package/dist/{chunk-DRJTNGI4.cjs.map → chunk-3ZRMVPQA.cjs.map} +1 -1
  9. package/dist/{chunk-GXMJ5URG.cjs → chunk-4KVIXN7K.cjs} +14 -14
  10. package/dist/{chunk-GXMJ5URG.cjs.map → chunk-4KVIXN7K.cjs.map} +1 -1
  11. package/dist/{chunk-BAZHNX5P.js → chunk-4N6WB4EZ.js} +6 -6
  12. package/dist/{chunk-BAZHNX5P.js.map → chunk-4N6WB4EZ.js.map} +1 -1
  13. package/dist/{chunk-CBY37FTP.cjs → chunk-4UH5LAF5.cjs} +15 -15
  14. package/dist/{chunk-CBY37FTP.cjs.map → chunk-4UH5LAF5.cjs.map} +1 -1
  15. package/dist/{chunk-DDK3URK2.cjs → chunk-5DL6Y7PJ.cjs} +104 -83
  16. package/dist/chunk-5DL6Y7PJ.cjs.map +1 -0
  17. package/dist/{chunk-6HJFCSJ4.cjs → chunk-6YUHA5UH.cjs} +2 -2
  18. package/dist/chunk-6YUHA5UH.cjs.map +1 -0
  19. package/dist/{chunk-T2LVULCK.cjs → chunk-7KL2YFFK.cjs} +9 -9
  20. package/dist/{chunk-T2LVULCK.cjs.map → chunk-7KL2YFFK.cjs.map} +1 -1
  21. package/dist/{chunk-RA2CHJCY.cjs → chunk-A6JNGJIU.cjs} +36 -36
  22. package/dist/chunk-A6JNGJIU.cjs.map +1 -0
  23. package/dist/{chunk-BC2VKOH4.cjs → chunk-AQ22JIR7.cjs} +18 -18
  24. package/dist/{chunk-BC2VKOH4.cjs.map → chunk-AQ22JIR7.cjs.map} +1 -1
  25. package/dist/{chunk-YV43YEZ6.js → chunk-CSCTVLD5.js} +3 -3
  26. package/dist/chunk-CSCTVLD5.js.map +1 -0
  27. package/dist/chunk-DMX7MC4N.js +3 -0
  28. package/dist/{chunk-GXSERFAG.js.map → chunk-DMX7MC4N.js.map} +1 -1
  29. package/dist/{chunk-IHISDRFV.js → chunk-DT5RMENY.js} +187 -95
  30. package/dist/chunk-DT5RMENY.js.map +1 -0
  31. package/dist/{chunk-NGWTSHNA.js → chunk-F7PAZAGE.js} +69 -48
  32. package/dist/chunk-F7PAZAGE.js.map +1 -0
  33. package/dist/{chunk-XJB7J4UT.js → chunk-FB5QMTJJ.js} +4 -4
  34. package/dist/{chunk-XJB7J4UT.js.map → chunk-FB5QMTJJ.js.map} +1 -1
  35. package/dist/{chunk-3HDRO3GG.js → chunk-GNUITL2N.js} +26 -49
  36. package/dist/chunk-GNUITL2N.js.map +1 -0
  37. package/dist/{chunk-HAYBGFPA.js → chunk-J4SXS7KN.js} +4 -4
  38. package/dist/{chunk-HAYBGFPA.js.map → chunk-J4SXS7KN.js.map} +1 -1
  39. package/dist/{chunk-ZGIVAQRI.js → chunk-JQM64OZF.js} +2 -2
  40. package/dist/chunk-JQM64OZF.js.map +1 -0
  41. package/dist/{chunk-CBQ6WDUJ.js → chunk-K4XAKG7L.js} +4 -4
  42. package/dist/{chunk-CBQ6WDUJ.js.map → chunk-K4XAKG7L.js.map} +1 -1
  43. package/dist/{chunk-4J4M2Q5R.js → chunk-KKYAYRIO.js} +4 -4
  44. package/dist/{chunk-4J4M2Q5R.js.map → chunk-KKYAYRIO.js.map} +1 -1
  45. package/dist/{chunk-S23TNDXG.cjs → chunk-NCAMNQC3.cjs} +188 -96
  46. package/dist/chunk-NCAMNQC3.cjs.map +1 -0
  47. package/dist/{chunk-CBVHOGXX.cjs → chunk-NK4UN2LF.cjs} +6 -6
  48. package/dist/chunk-NK4UN2LF.cjs.map +1 -0
  49. package/dist/{chunk-BCUKD2XG.js → chunk-NNFF3URD.js} +12 -34
  50. package/dist/chunk-NNFF3URD.js.map +1 -0
  51. package/dist/{chunk-LOV5NNGK.cjs → chunk-OXV6QFSV.cjs} +31 -54
  52. package/dist/chunk-OXV6QFSV.cjs.map +1 -0
  53. package/dist/{chunk-4HP7CS6L.js → chunk-QD776HMB.js} +2 -2
  54. package/dist/chunk-QD776HMB.js.map +1 -0
  55. package/dist/chunk-ROOVGRNA.cjs +4 -0
  56. package/dist/{chunk-X4RMXTXF.cjs.map → chunk-ROOVGRNA.cjs.map} +1 -1
  57. package/dist/{chunk-2OOMJRXZ.cjs → chunk-UT6MASE5.cjs} +3 -3
  58. package/dist/{chunk-2OOMJRXZ.cjs.map → chunk-UT6MASE5.cjs.map} +1 -1
  59. package/dist/{chunk-D2IFWD7A.js → chunk-UTMBASR5.js} +10 -10
  60. package/dist/chunk-UTMBASR5.js.map +1 -0
  61. package/dist/{chunk-AR5CF3IN.js → chunk-WDXYPI3P.js} +3 -3
  62. package/dist/{chunk-AR5CF3IN.js.map → chunk-WDXYPI3P.js.map} +1 -1
  63. package/dist/{chunk-O2CAMK4A.cjs → chunk-ZSZOYPSJ.cjs} +2 -2
  64. package/dist/chunk-ZSZOYPSJ.cjs.map +1 -0
  65. package/dist/evals/index.cjs +19 -19
  66. package/dist/evals/index.js +2 -2
  67. package/dist/evals/scoreTraces/index.cjs +5 -5
  68. package/dist/evals/scoreTraces/index.cjs.map +1 -1
  69. package/dist/evals/scoreTraces/index.js +2 -2
  70. package/dist/evals/scoreTraces/index.js.map +1 -1
  71. package/dist/evals/types.d.ts +0 -2
  72. package/dist/evals/types.d.ts.map +1 -1
  73. package/dist/index.cjs +2 -2
  74. package/dist/index.js +1 -1
  75. package/dist/integration/index.cjs +2 -2
  76. package/dist/integration/index.js +1 -1
  77. package/dist/llm/index.cjs +11 -11
  78. package/dist/llm/index.js +3 -3
  79. package/dist/llm/model/provider-types.generated.d.ts +88 -42
  80. package/dist/loop/index.cjs +2 -2
  81. package/dist/loop/index.js +1 -1
  82. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  83. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +1 -1
  84. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  85. package/dist/mastra/hooks.d.ts.map +1 -1
  86. package/dist/mastra/index.cjs +2 -2
  87. package/dist/mastra/index.d.ts.map +1 -1
  88. package/dist/mastra/index.js +1 -1
  89. package/dist/mcp/index.cjs +3 -0
  90. package/dist/mcp/index.cjs.map +1 -1
  91. package/dist/mcp/index.d.ts +2 -0
  92. package/dist/mcp/index.d.ts.map +1 -1
  93. package/dist/mcp/index.js +3 -0
  94. package/dist/mcp/index.js.map +1 -1
  95. package/dist/mcp/types.d.ts +2 -0
  96. package/dist/mcp/types.d.ts.map +1 -1
  97. package/dist/memory/index.cjs +11 -11
  98. package/dist/memory/index.js +1 -1
  99. package/dist/netlify-3MHHJG2E.js +3 -0
  100. package/dist/{netlify-J4QPOROO.js.map → netlify-3MHHJG2E.js.map} +1 -1
  101. package/dist/netlify-5Y33S7WL.cjs +12 -0
  102. package/dist/{netlify-CUYK2MZ2.cjs.map → netlify-5Y33S7WL.cjs.map} +1 -1
  103. package/dist/observability/index.cjs +11 -11
  104. package/dist/observability/index.js +1 -1
  105. package/dist/observability/types/tracing.d.ts +2 -1
  106. package/dist/observability/types/tracing.d.ts.map +1 -1
  107. package/dist/processors/index.cjs +37 -37
  108. package/dist/processors/index.js +1 -1
  109. package/dist/processors/processors/structured-output.d.ts +1 -0
  110. package/dist/processors/processors/structured-output.d.ts.map +1 -1
  111. package/dist/provider-registry-LXSWMVEC.js +3 -0
  112. package/dist/{provider-registry-6CIGRQVZ.js.map → provider-registry-LXSWMVEC.js.map} +1 -1
  113. package/dist/provider-registry-YJ2P5YY5.cjs +40 -0
  114. package/dist/{provider-registry-7O7FJ4BS.cjs.map → provider-registry-YJ2P5YY5.cjs.map} +1 -1
  115. package/dist/provider-registry.json +184 -92
  116. package/dist/relevance/index.cjs +3 -3
  117. package/dist/relevance/index.js +1 -1
  118. package/dist/server/types.d.ts +28 -0
  119. package/dist/server/types.d.ts.map +1 -1
  120. package/dist/storage/base.d.ts +76 -29
  121. package/dist/storage/base.d.ts.map +1 -1
  122. package/dist/storage/constants.cjs +14 -14
  123. package/dist/storage/constants.js +1 -1
  124. package/dist/storage/index.cjs +92 -92
  125. package/dist/storage/index.js +2 -2
  126. package/dist/storage/mock.d.ts +0 -2
  127. package/dist/storage/mock.d.ts.map +1 -1
  128. package/dist/storage/types.d.ts +0 -24
  129. package/dist/storage/types.d.ts.map +1 -1
  130. package/dist/stream/aisdk/v5/compat/consume-stream.d.ts +4 -1
  131. package/dist/stream/aisdk/v5/compat/consume-stream.d.ts.map +1 -1
  132. package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
  133. package/dist/stream/base/output.d.ts.map +1 -1
  134. package/dist/stream/index.cjs +9 -9
  135. package/dist/stream/index.js +1 -1
  136. package/dist/test-utils/llm-mock.cjs +4 -4
  137. package/dist/test-utils/llm-mock.js +1 -1
  138. package/dist/tool-loop-agent/index.cjs +4 -4
  139. package/dist/tool-loop-agent/index.js +1 -1
  140. package/dist/tools/index.cjs +4 -4
  141. package/dist/tools/index.d.ts +1 -0
  142. package/dist/tools/index.d.ts.map +1 -1
  143. package/dist/tools/index.js +1 -1
  144. package/dist/tools/is-vercel-tool.cjs +2 -2
  145. package/dist/tools/is-vercel-tool.js +1 -1
  146. package/dist/tools/tool.d.ts +4 -4
  147. package/dist/tools/tool.d.ts.map +1 -1
  148. package/dist/tools/types.d.ts +3 -1
  149. package/dist/tools/types.d.ts.map +1 -1
  150. package/dist/utils.cjs +22 -22
  151. package/dist/utils.js +1 -1
  152. package/dist/workflows/evented/index.cjs +10 -10
  153. package/dist/workflows/evented/index.js +1 -1
  154. package/dist/workflows/index.cjs +23 -23
  155. package/dist/workflows/index.js +1 -1
  156. package/dist/workflows/workflow.d.ts.map +1 -1
  157. package/package.json +2 -2
  158. package/src/llm/model/provider-types.generated.d.ts +88 -42
  159. package/dist/chunk-3HDRO3GG.js.map +0 -1
  160. package/dist/chunk-4HP7CS6L.js.map +0 -1
  161. package/dist/chunk-6HJFCSJ4.cjs.map +0 -1
  162. package/dist/chunk-BCUKD2XG.js.map +0 -1
  163. package/dist/chunk-CBVHOGXX.cjs.map +0 -1
  164. package/dist/chunk-D2IFWD7A.js.map +0 -1
  165. package/dist/chunk-DDK3URK2.cjs.map +0 -1
  166. package/dist/chunk-GXSERFAG.js +0 -3
  167. package/dist/chunk-IHISDRFV.js.map +0 -1
  168. package/dist/chunk-IRTICXRZ.cjs.map +0 -1
  169. package/dist/chunk-LOV5NNGK.cjs.map +0 -1
  170. package/dist/chunk-NGWTSHNA.js.map +0 -1
  171. package/dist/chunk-O2CAMK4A.cjs.map +0 -1
  172. package/dist/chunk-RA2CHJCY.cjs.map +0 -1
  173. package/dist/chunk-S23TNDXG.cjs.map +0 -1
  174. package/dist/chunk-X4RMXTXF.cjs +0 -4
  175. package/dist/chunk-YV43YEZ6.js.map +0 -1
  176. package/dist/chunk-ZGIVAQRI.js.map +0 -1
  177. package/dist/netlify-CUYK2MZ2.cjs +0 -12
  178. package/dist/netlify-J4QPOROO.js +0 -3
  179. package/dist/provider-registry-6CIGRQVZ.js +0 -3
  180. package/dist/provider-registry-7O7FJ4BS.cjs +0 -40
package/CHANGELOG.md CHANGED
@@ -1,5 +1,170 @@
1
1
  # @mastra/core
2
2
 
3
+ ## 1.0.0-beta.16
4
+
5
+ ### Minor Changes
6
+
7
+ - Add `onError` hook to server configuration for custom error handling. ([#11403](https://github.com/mastra-ai/mastra/pull/11403))
8
+
9
+ You can now provide a custom error handler through the Mastra server config to catch errors, format responses, or send them to external services like Sentry:
10
+
11
+ ```typescript
12
+ import { Mastra } from '@mastra/core/mastra';
13
+
14
+ const mastra = new Mastra({
15
+ server: {
16
+ onError: (err, c) => {
17
+ // Send to Sentry
18
+ Sentry.captureException(err);
19
+
20
+ // Return custom formatted response
21
+ return c.json(
22
+ {
23
+ error: err.message,
24
+ timestamp: new Date().toISOString(),
25
+ },
26
+ 500,
27
+ );
28
+ },
29
+ },
30
+ });
31
+ ```
32
+
33
+ If no `onError` is provided, the default error handler is used.
34
+
35
+ Fixes #9610
36
+
37
+ ### Patch Changes
38
+
39
+ - fix(observability): start MODEL_STEP span at beginning of LLM execution ([#11409](https://github.com/mastra-ai/mastra/pull/11409))
40
+
41
+ The MODEL_STEP span was being created when the step-start chunk arrived (after the model API call completed), causing the span's startTime to be close to its endTime instead of accurately reflecting when the step began.
42
+
43
+ This fix ensures MODEL_STEP spans capture the full duration of each LLM execution step, including the API call latency, by starting the span at the beginning of the step execution rather than when the response starts streaming.
44
+
45
+ Fixes #11271
46
+
47
+ - Fixed inline type narrowing for `tool.execute()` return type when using `outputSchema`. ([#11420](https://github.com/mastra-ai/mastra/pull/11420))
48
+
49
+ **Problem:** When calling `tool.execute()`, TypeScript couldn't narrow the `ValidationError | OutputType` union after checking `'error' in result && result.error`, causing type errors when accessing output properties.
50
+
51
+ **Solution:**
52
+ - Added `{ error?: never }` to the success type, enabling proper discriminated union narrowing
53
+ - Simplified `createTool` generics so `inputData` is correctly typed based on `inputSchema`
54
+
55
+ **Note:** Tool output schemas should not use `error` as a field name since it's reserved for ValidationError discrimination. Use `errorMessage` or similar instead.
56
+
57
+ **Usage:**
58
+
59
+ ```typescript
60
+ const result = await myTool.execute({ firstName: 'Hans' });
61
+
62
+ if ('error' in result && result.error) {
63
+ console.error('Validation failed:', result.message);
64
+ return;
65
+ }
66
+
67
+ // ✅ TypeScript now correctly narrows result
68
+ return { fullName: result.fullName };
69
+ ```
70
+
71
+ - Add support for `instructions` field in MCPServer ([#11421](https://github.com/mastra-ai/mastra/pull/11421))
72
+
73
+ Implements the official MCP specification's `instructions` field, which allows MCP servers to provide system-wide prompts that are automatically sent to clients during initialization. This eliminates the need for per-project configuration files (like AGENTS.md) by centralizing the system prompt in the server definition.
74
+
75
+ **What's New:**
76
+ - Added `instructions` optional field to `MCPServerConfig` type
77
+ - Instructions are passed to the underlying MCP SDK Server during initialization
78
+ - Instructions are sent to clients in the `InitializeResult` response
79
+ - Fully compatible with all MCP clients (Cursor, Windsurf, Claude Desktop, etc.)
80
+
81
+ **Example Usage:**
82
+
83
+ ```typescript
84
+ const server = new MCPServer({
85
+ name: 'GitHub MCP Server',
86
+ version: '1.0.0',
87
+ instructions:
88
+ 'Use the available tools to help users manage GitHub repositories, issues, and pull requests. Always search before creating to avoid duplicates.',
89
+ tools: { searchIssues, createIssue, listPRs },
90
+ });
91
+ ```
92
+
93
+ - Add storage composition to MastraStorage ([#11401](https://github.com/mastra-ai/mastra/pull/11401))
94
+
95
+ `MastraStorage` can now compose storage domains from different adapters. Use it when you need different databases for different purposes - for example, PostgreSQL for memory and workflows, but a different database for observability.
96
+
97
+ ```typescript
98
+ import { MastraStorage } from '@mastra/core/storage';
99
+ import { MemoryPG, WorkflowsPG, ScoresPG } from '@mastra/pg';
100
+ import { MemoryLibSQL } from '@mastra/libsql';
101
+
102
+ // Compose domains from different stores
103
+ const storage = new MastraStorage({
104
+ id: 'composite',
105
+ domains: {
106
+ memory: new MemoryLibSQL({ url: 'file:./local.db' }),
107
+ workflows: new WorkflowsPG({ connectionString: process.env.DATABASE_URL }),
108
+ scores: new ScoresPG({ connectionString: process.env.DATABASE_URL }),
109
+ },
110
+ });
111
+ ```
112
+
113
+ **Breaking changes:**
114
+ - `storage.supports` property no longer exists
115
+ - `StorageSupports` type is no longer exported from `@mastra/core/storage`
116
+
117
+ All stores now support the same features. For domain availability, use `getStore()`:
118
+
119
+ ```typescript
120
+ const store = await storage.getStore('memory');
121
+ if (store) {
122
+ // domain is available
123
+ }
124
+ ```
125
+
126
+ - Fix various places in core package where we were logging with console.error instead of the mastra logger. ([#11425](https://github.com/mastra-ai/mastra/pull/11425))
127
+
128
+ - fix(workflows): ensure writer.custom() bubbles up from nested workflows and loops ([#11422](https://github.com/mastra-ai/mastra/pull/11422))
129
+
130
+ Previously, when using `writer.custom()` in steps within nested sub-workflows or loops (like `dountil`), the custom data events would not properly bubble up to the top-level workflow stream. This fix ensures that custom events are now correctly propagated through the nested workflow hierarchy without modification, allowing them to be consumed at the top level.
131
+
132
+ This brings workflows in line with the existing behavior for agents, where custom data chunks properly bubble up through sub-agent execution.
133
+
134
+ **What changed:**
135
+ - Modified the `nestedWatchCb` function in workflow event handling to detect and preserve `data-*` custom events
136
+ - Custom events now bubble up directly without being wrapped or modified
137
+ - Regular workflow events continue to work as before with proper step ID prefixing
138
+
139
+ **Example:**
140
+
141
+ ```typescript
142
+ const subStep = createStep({
143
+ id: 'subStep',
144
+ execute: async ({ writer }) => {
145
+ await writer.custom({
146
+ type: 'custom-progress',
147
+ data: { status: 'processing' },
148
+ });
149
+ return { result: 'done' };
150
+ },
151
+ });
152
+
153
+ const subWorkflow = createWorkflow({ id: 'sub' }).then(subStep).commit();
154
+
155
+ const topWorkflow = createWorkflow({ id: 'top' }).then(subWorkflow).commit();
156
+
157
+ const run = await topWorkflow.createRun();
158
+ const stream = run.stream({ inputData: {} });
159
+
160
+ // Custom events from subStep now properly appear in the top-level stream
161
+ for await (const event of stream) {
162
+ if (event.type === 'custom-progress') {
163
+ console.log(event.data); // { status: 'processing' }
164
+ }
165
+ }
166
+ ```
167
+
3
168
  ## 1.0.0-beta.15
4
169
 
5
170
  ### Minor Changes
@@ -1,37 +1,37 @@
1
1
  'use strict';
2
2
 
3
- var chunkDDK3URK2_cjs = require('../chunk-DDK3URK2.cjs');
3
+ var chunk5DL6Y7PJ_cjs = require('../chunk-5DL6Y7PJ.cjs');
4
4
  var chunkEMLEZXTQ_cjs = require('../chunk-EMLEZXTQ.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "Agent", {
9
9
  enumerable: true,
10
- get: function () { return chunkDDK3URK2_cjs.Agent; }
10
+ get: function () { return chunk5DL6Y7PJ_cjs.Agent; }
11
11
  });
12
12
  Object.defineProperty(exports, "TripWire", {
13
13
  enumerable: true,
14
- get: function () { return chunkDDK3URK2_cjs.TripWire; }
14
+ get: function () { return chunk5DL6Y7PJ_cjs.TripWire; }
15
15
  });
16
16
  Object.defineProperty(exports, "isSupportedLanguageModel", {
17
17
  enumerable: true,
18
- get: function () { return chunkDDK3URK2_cjs.isSupportedLanguageModel; }
18
+ get: function () { return chunk5DL6Y7PJ_cjs.isSupportedLanguageModel; }
19
19
  });
20
20
  Object.defineProperty(exports, "resolveThreadIdFromArgs", {
21
21
  enumerable: true,
22
- get: function () { return chunkDDK3URK2_cjs.resolveThreadIdFromArgs; }
22
+ get: function () { return chunk5DL6Y7PJ_cjs.resolveThreadIdFromArgs; }
23
23
  });
24
24
  Object.defineProperty(exports, "supportedLanguageModelSpecifications", {
25
25
  enumerable: true,
26
- get: function () { return chunkDDK3URK2_cjs.supportedLanguageModelSpecifications; }
26
+ get: function () { return chunk5DL6Y7PJ_cjs.supportedLanguageModelSpecifications; }
27
27
  });
28
28
  Object.defineProperty(exports, "tryGenerateWithJsonFallback", {
29
29
  enumerable: true,
30
- get: function () { return chunkDDK3URK2_cjs.tryGenerateWithJsonFallback; }
30
+ get: function () { return chunk5DL6Y7PJ_cjs.tryGenerateWithJsonFallback; }
31
31
  });
32
32
  Object.defineProperty(exports, "tryStreamWithJsonFallback", {
33
33
  enumerable: true,
34
- get: function () { return chunkDDK3URK2_cjs.tryStreamWithJsonFallback; }
34
+ get: function () { return chunk5DL6Y7PJ_cjs.tryStreamWithJsonFallback; }
35
35
  });
36
36
  Object.defineProperty(exports, "MessageList", {
37
37
  enumerable: true,
@@ -1,4 +1,4 @@
1
- export { Agent, TripWire, isSupportedLanguageModel, resolveThreadIdFromArgs, supportedLanguageModelSpecifications, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '../chunk-NGWTSHNA.js';
1
+ export { Agent, TripWire, isSupportedLanguageModel, resolveThreadIdFromArgs, supportedLanguageModelSpecifications, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '../chunk-F7PAZAGE.js';
2
2
  export { MessageList, convertMessages } from '../chunk-QXL3F3T2.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"map-results-step.d.ts","sourceRoot":"","sources":["../../../../src/agent/workflows/prepare-stream/map-results-step.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAmB,MAAM,qCAAqC,CAAC;AAChG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEnG,UAAU,qBAAqB,CAAC,MAAM,SAAS,YAAY,GAAG,SAAS,GAAG,SAAS;IACjF,YAAY,EAAE,iBAAiB,CAAC;IAChC,OAAO,EAAE,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,cAAc,CAAC;IAC/B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAAC,MAAM,SAAS,YAAY,GAAG,SAAS,GAAG,SAAS,EAAE,EACxF,YAAY,EACZ,OAAO,EACP,UAAU,EACV,KAAK,EACL,cAAc,EACd,MAAM,EACN,YAAY,EACZ,SAAS,EACT,OAAO,EACP,UAAU,GACX,EAAE,qBAAqB,CAAC,MAAM,CAAC,IAChB,sCAIX;IACD,SAAS,EAAE;QACT,oBAAoB,EAAE,sBAAsB,CAAC;QAC7C,qBAAqB,EAAE,uBAAuB,CAAC;KAChD,CAAC;IACF,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;CAChC,qGAyLF"}
1
+ {"version":3,"file":"map-results-step.d.ts","sourceRoot":"","sources":["../../../../src/agent/workflows/prepare-stream/map-results-step.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAmB,MAAM,qCAAqC,CAAC;AAChG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEnG,UAAU,qBAAqB,CAAC,MAAM,SAAS,YAAY,GAAG,SAAS,GAAG,SAAS;IACjF,YAAY,EAAE,iBAAiB,CAAC;IAChC,OAAO,EAAE,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,cAAc,CAAC;IAC/B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAAC,MAAM,SAAS,YAAY,GAAG,SAAS,GAAG,SAAS,EAAE,EACxF,YAAY,EACZ,OAAO,EACP,UAAU,EACV,KAAK,EACL,cAAc,EACd,MAAM,EACN,YAAY,EACZ,SAAS,EACT,OAAO,EACP,UAAU,GACX,EAAE,qBAAqB,CAAC,MAAM,CAAC,IAChB,sCAIX;IACD,SAAS,EAAE;QACT,oBAAoB,EAAE,sBAAsB,CAAC;QAC7C,qBAAqB,EAAE,uBAAuB,CAAC;KAChD,CAAC;IACF,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;CAChC,qGA4LF"}
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkRA2CHJCY_cjs = require('./chunk-RA2CHJCY.cjs');
4
- var chunkDRJTNGI4_cjs = require('./chunk-DRJTNGI4.cjs');
5
- var chunkDDK3URK2_cjs = require('./chunk-DDK3URK2.cjs');
6
- var chunkCBVHOGXX_cjs = require('./chunk-CBVHOGXX.cjs');
3
+ var chunkA6JNGJIU_cjs = require('./chunk-A6JNGJIU.cjs');
4
+ var chunk3ZRMVPQA_cjs = require('./chunk-3ZRMVPQA.cjs');
5
+ var chunk5DL6Y7PJ_cjs = require('./chunk-5DL6Y7PJ.cjs');
6
+ var chunkNK4UN2LF_cjs = require('./chunk-NK4UN2LF.cjs');
7
7
  var chunk6BJ7XHRH_cjs = require('./chunk-6BJ7XHRH.cjs');
8
- var chunkUIGRFDO6_cjs = require('./chunk-UIGRFDO6.cjs');
9
8
  var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
10
- var chunkO2CAMK4A_cjs = require('./chunk-O2CAMK4A.cjs');
9
+ var chunkZSZOYPSJ_cjs = require('./chunk-ZSZOYPSJ.cjs');
11
10
  var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
11
+ var chunkUIGRFDO6_cjs = require('./chunk-UIGRFDO6.cjs');
12
12
  var chunkAF74UXR5_cjs = require('./chunk-AF74UXR5.cjs');
13
13
  var crypto = require('crypto');
14
14
  var pMap = require('p-map');
@@ -122,7 +122,7 @@ async function validateAndSaveScore(storage, payload) {
122
122
  text: "Scores storage domain is not available"
123
123
  });
124
124
  }
125
- const payloadToSave = chunkCBVHOGXX_cjs.saveScorePayloadSchema.parse(payload);
125
+ const payloadToSave = chunkNK4UN2LF_cjs.saveScorePayloadSchema.parse(payload);
126
126
  await scoresStore.saveScore(payloadToSave);
127
127
  }
128
128
  async function findScorer(mastra, entityId, entityType, scorerId) {
@@ -286,7 +286,7 @@ var Mastra = class {
286
286
  if (config?.pubsub) {
287
287
  this.#pubsub = config.pubsub;
288
288
  } else {
289
- this.#pubsub = new chunkDDK3URK2_cjs.EventEmitterPubSub();
289
+ this.#pubsub = new chunk5DL6Y7PJ_cjs.EventEmitterPubSub();
290
290
  }
291
291
  this.#events = {};
292
292
  for (const topic in config?.events ?? {}) {
@@ -296,12 +296,12 @@ var Mastra = class {
296
296
  this.#events[topic] = config?.events?.[topic] ?? [];
297
297
  }
298
298
  }
299
- const workflowEventProcessor = new chunkRA2CHJCY_cjs.WorkflowEventProcessor({ mastra: this });
299
+ const workflowEventProcessor = new chunkA6JNGJIU_cjs.WorkflowEventProcessor({ mastra: this });
300
300
  const workflowEventCb = async (event, cb) => {
301
301
  try {
302
302
  await workflowEventProcessor.process(event, cb);
303
303
  } catch (e) {
304
- console.error("Error processing event", e);
304
+ this.getLogger()?.error("Error processing event", e);
305
305
  }
306
306
  };
307
307
  if (this.#events.workflows) {
@@ -324,7 +324,7 @@ var Mastra = class {
324
324
  this.#idGenerator = config?.idGenerator;
325
325
  let storage = config?.storage;
326
326
  if (storage) {
327
- storage = chunkDDK3URK2_cjs.augmentWithInit(storage);
327
+ storage = chunk5DL6Y7PJ_cjs.augmentWithInit(storage);
328
328
  }
329
329
  if (config?.observability) {
330
330
  if (typeof config.observability.getDefaultInstance === "function") {
@@ -334,10 +334,10 @@ var Mastra = class {
334
334
  this.#logger?.warn(
335
335
  'Observability configuration error: Expected an Observability instance, but received a config object. Import and instantiate: import { Observability } from "@mastra/observability"; then pass: observability: new Observability({ default: { enabled: true } }). Observability has been disabled.'
336
336
  );
337
- this.#observability = new chunkO2CAMK4A_cjs.NoOpObservability();
337
+ this.#observability = new chunkZSZOYPSJ_cjs.NoOpObservability();
338
338
  }
339
339
  } else {
340
- this.#observability = new chunkO2CAMK4A_cjs.NoOpObservability();
340
+ this.#observability = new chunkZSZOYPSJ_cjs.NoOpObservability();
341
341
  }
342
342
  this.#storage = storage;
343
343
  this.#vectors = {};
@@ -554,24 +554,13 @@ var Mastra = class {
554
554
  this.#logger?.trackException(error);
555
555
  throw error;
556
556
  }
557
- if (!storage.supports.agents) {
558
- const error = new chunk4U7ZLI36_cjs.MastraError({
559
- id: "MASTRA_GET_STORED_AGENT_NOT_SUPPORTED",
560
- domain: "MASTRA" /* MASTRA */,
561
- category: "USER" /* USER */,
562
- text: "Storage does not support agents",
563
- details: { status: 400 }
564
- });
565
- this.#logger?.trackException(error);
566
- throw error;
567
- }
568
557
  const agentsStore = await storage.getStore("agents");
569
558
  if (!agentsStore) {
570
559
  const error = new chunk4U7ZLI36_cjs.MastraError({
571
560
  id: "MASTRA_GET_STORED_AGENT_NOT_SUPPORTED",
572
561
  domain: "MASTRA" /* MASTRA */,
573
562
  category: "USER" /* USER */,
574
- text: "Agents storage domain is not available",
563
+ text: "Agents storage is not available",
575
564
  details: { status: 400 }
576
565
  });
577
566
  this.#logger?.trackException(error);
@@ -599,24 +588,13 @@ var Mastra = class {
599
588
  this.#logger?.trackException(error);
600
589
  throw error;
601
590
  }
602
- if (!storage.supports.agents) {
603
- const error = new chunk4U7ZLI36_cjs.MastraError({
604
- id: "MASTRA_LIST_STORED_AGENTS_NOT_SUPPORTED",
605
- domain: "MASTRA" /* MASTRA */,
606
- category: "USER" /* USER */,
607
- text: "Storage does not support agents",
608
- details: { status: 400 }
609
- });
610
- this.#logger?.trackException(error);
611
- throw error;
612
- }
613
591
  const agentsStore = await storage.getStore("agents");
614
592
  if (!agentsStore) {
615
593
  const error = new chunk4U7ZLI36_cjs.MastraError({
616
594
  id: "MASTRA_LIST_STORED_AGENTS_NOT_SUPPORTED",
617
595
  domain: "MASTRA" /* MASTRA */,
618
596
  category: "USER" /* USER */,
619
- text: "Agents storage domain is not available",
597
+ text: "Agents storage is not available",
620
598
  details: { status: 400 }
621
599
  });
622
600
  this.#logger?.trackException(error);
@@ -660,7 +638,7 @@ var Mastra = class {
660
638
  const agents = this.#resolveStoredAgents(storedAgent.agents);
661
639
  const memory = this.#resolveStoredMemory(storedAgent.memory);
662
640
  const scorers = this.#resolveStoredScorers(storedAgent.scorers);
663
- const agent = new chunkDDK3URK2_cjs.Agent({
641
+ const agent = new chunk5DL6Y7PJ_cjs.Agent({
664
642
  id: storedAgent.id,
665
643
  name: storedAgent.name,
666
644
  description: storedAgent.description,
@@ -826,8 +804,8 @@ var Mastra = class {
826
804
  throw createUndefinedPrimitiveError("agent", agent, key);
827
805
  }
828
806
  let mastraAgent;
829
- if (chunkDRJTNGI4_cjs.isToolLoopAgentLike(agent)) {
830
- mastraAgent = chunkDRJTNGI4_cjs.toolLoopAgentToMastraAgent(agent, { fallbackName: key });
807
+ if (chunk3ZRMVPQA_cjs.isToolLoopAgentLike(agent)) {
808
+ mastraAgent = chunk3ZRMVPQA_cjs.toolLoopAgentToMastraAgent(agent, { fallbackName: key });
831
809
  } else {
832
810
  mastraAgent = agent;
833
811
  }
@@ -1861,7 +1839,7 @@ var Mastra = class {
1861
1839
  * ```
1862
1840
  */
1863
1841
  setStorage(storage) {
1864
- this.#storage = chunkDDK3URK2_cjs.augmentWithInit(storage);
1842
+ this.#storage = chunk5DL6Y7PJ_cjs.augmentWithInit(storage);
1865
1843
  }
1866
1844
  setLogger({ logger }) {
1867
1845
  this.#logger = logger;
@@ -2523,7 +2501,7 @@ var Mastra = class {
2523
2501
  if (process.env.MASTRA_DEV !== "true" && process.env.MASTRA_DEV !== "1") {
2524
2502
  return;
2525
2503
  }
2526
- import('./provider-registry-7O7FJ4BS.cjs').then(async ({ GatewayRegistry }) => {
2504
+ import('./provider-registry-YJ2P5YY5.cjs').then(async ({ GatewayRegistry }) => {
2527
2505
  const registry = GatewayRegistry.getInstance();
2528
2506
  const customGateways = Object.values(this.#gateways || {});
2529
2507
  registry.registerCustomGateways(customGateways);
@@ -2577,5 +2555,5 @@ var Mastra = class {
2577
2555
  };
2578
2556
 
2579
2557
  exports.Mastra = Mastra;
2580
- //# sourceMappingURL=chunk-IRTICXRZ.cjs.map
2581
- //# sourceMappingURL=chunk-IRTICXRZ.cjs.map
2558
+ //# sourceMappingURL=chunk-33VDGXRH.cjs.map
2559
+ //# sourceMappingURL=chunk-33VDGXRH.cjs.map