@mastra/core 0.19.1 → 0.20.0-alpha.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 (179) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/agent/agent.d.ts +17 -31
  3. package/dist/agent/agent.d.ts.map +1 -1
  4. package/dist/agent/agent.types.d.ts +2 -2
  5. package/dist/agent/agent.types.d.ts.map +1 -1
  6. package/dist/agent/index.cjs +11 -11
  7. package/dist/agent/index.js +2 -2
  8. package/dist/agent/input-processor/index.cjs +6 -6
  9. package/dist/agent/input-processor/index.js +1 -1
  10. package/dist/agent/types.d.ts +1 -6
  11. package/dist/agent/types.d.ts.map +1 -1
  12. package/dist/agent/workflows/prepare-stream/index.d.ts +3 -3
  13. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  14. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +3 -3
  15. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
  16. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts +1 -1
  17. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
  18. package/dist/agent/workflows/prepare-stream/schema.d.ts +2 -2
  19. package/dist/ai-tracing/index.cjs +32 -32
  20. package/dist/ai-tracing/index.js +1 -1
  21. package/dist/{chunk-QFKTSGBI.js → chunk-2DVGQK2L.js} +4 -4
  22. package/dist/chunk-2DVGQK2L.js.map +1 -0
  23. package/dist/{chunk-HJQ7ANDX.cjs → chunk-2JUDZXVI.cjs} +4 -4
  24. package/dist/chunk-2JUDZXVI.cjs.map +1 -0
  25. package/dist/{chunk-SZD4WTRW.cjs → chunk-2SH5WPUA.cjs} +27 -22
  26. package/dist/chunk-2SH5WPUA.cjs.map +1 -0
  27. package/dist/{chunk-QMDJVXFQ.cjs → chunk-3NNB72OL.cjs} +15 -15
  28. package/dist/{chunk-QMDJVXFQ.cjs.map → chunk-3NNB72OL.cjs.map} +1 -1
  29. package/dist/{chunk-D2ZPF2AK.js → chunk-42VT5WOB.js} +3 -3
  30. package/dist/{chunk-D2ZPF2AK.js.map → chunk-42VT5WOB.js.map} +1 -1
  31. package/dist/{chunk-5QUE7HZF.js → chunk-6R46VE63.js} +5 -5
  32. package/dist/{chunk-5QUE7HZF.js.map → chunk-6R46VE63.js.map} +1 -1
  33. package/dist/{chunk-K3UPABLX.cjs → chunk-7EUC32F3.cjs} +16 -34
  34. package/dist/chunk-7EUC32F3.cjs.map +1 -0
  35. package/dist/{chunk-62I4SVWU.cjs → chunk-7HUKQ6SZ.cjs} +4 -4
  36. package/dist/{chunk-62I4SVWU.cjs.map → chunk-7HUKQ6SZ.cjs.map} +1 -1
  37. package/dist/{chunk-NLBX7Q47.cjs → chunk-7QC3MHP7.cjs} +4 -4
  38. package/dist/{chunk-NLBX7Q47.cjs.map → chunk-7QC3MHP7.cjs.map} +1 -1
  39. package/dist/{chunk-X6PLOE2T.js → chunk-AND6J5LG.js} +27 -22
  40. package/dist/chunk-AND6J5LG.js.map +1 -0
  41. package/dist/{chunk-TJHEGJNW.js → chunk-BOJNXNRV.js} +3 -3
  42. package/dist/{chunk-TJHEGJNW.js.map → chunk-BOJNXNRV.js.map} +1 -1
  43. package/dist/{chunk-NVMKTP4N.js → chunk-CJDOU6WP.js} +3 -3
  44. package/dist/chunk-CJDOU6WP.js.map +1 -0
  45. package/dist/{chunk-7CJKBCDL.js → chunk-COYTVUIL.js} +6 -24
  46. package/dist/chunk-COYTVUIL.js.map +1 -0
  47. package/dist/{chunk-2EMOWXLL.js → chunk-DQISKQDE.js} +86 -77
  48. package/dist/chunk-DQISKQDE.js.map +1 -0
  49. package/dist/{chunk-BBTR6DPH.cjs → chunk-DVHBWEYY.cjs} +3 -3
  50. package/dist/chunk-DVHBWEYY.cjs.map +1 -0
  51. package/dist/{chunk-T2CUZA2P.js → chunk-EF6Y74CN.js} +3 -3
  52. package/dist/{chunk-T2CUZA2P.js.map → chunk-EF6Y74CN.js.map} +1 -1
  53. package/dist/{chunk-57UPIDGK.cjs → chunk-I6TOPBP6.cjs} +14 -14
  54. package/dist/{chunk-57UPIDGK.cjs.map → chunk-I6TOPBP6.cjs.map} +1 -1
  55. package/dist/{chunk-M24QFL6S.js → chunk-KGBDRSMX.js} +8 -4
  56. package/dist/chunk-KGBDRSMX.js.map +1 -0
  57. package/dist/{chunk-CC4KO56Z.cjs → chunk-LCJP7LWN.cjs} +6 -6
  58. package/dist/{chunk-CC4KO56Z.cjs.map → chunk-LCJP7LWN.cjs.map} +1 -1
  59. package/dist/{chunk-2F4RLQ5V.cjs → chunk-NEWEONKX.cjs} +4 -4
  60. package/dist/{chunk-2F4RLQ5V.cjs.map → chunk-NEWEONKX.cjs.map} +1 -1
  61. package/dist/{chunk-3I3NRXSD.cjs → chunk-OKIHIKXV.cjs} +6 -6
  62. package/dist/{chunk-3I3NRXSD.cjs.map → chunk-OKIHIKXV.cjs.map} +1 -1
  63. package/dist/{chunk-M635OK6I.js → chunk-OXLN4CWA.js} +3 -3
  64. package/dist/{chunk-M635OK6I.js.map → chunk-OXLN4CWA.js.map} +1 -1
  65. package/dist/{chunk-LYRPXSHB.js → chunk-QR5VZWWT.js} +11 -11
  66. package/dist/{chunk-LYRPXSHB.js.map → chunk-QR5VZWWT.js.map} +1 -1
  67. package/dist/{chunk-WMGV4CS3.cjs → chunk-T4H33PBR.cjs} +115 -106
  68. package/dist/chunk-T4H33PBR.cjs.map +1 -0
  69. package/dist/{chunk-A7REAXWA.js → chunk-WP2KQXPV.js} +3 -3
  70. package/dist/{chunk-A7REAXWA.js.map → chunk-WP2KQXPV.js.map} +1 -1
  71. package/dist/{chunk-HV5ND4KF.cjs → chunk-YEEAHLAK.cjs} +4 -4
  72. package/dist/{chunk-HV5ND4KF.cjs.map → chunk-YEEAHLAK.cjs.map} +1 -1
  73. package/dist/{chunk-BMBWTBCL.js → chunk-ZJ2UFCTS.js} +5 -5
  74. package/dist/{chunk-BMBWTBCL.js.map → chunk-ZJ2UFCTS.js.map} +1 -1
  75. package/dist/{chunk-2C5AQMP5.cjs → chunk-ZNK5RN5D.cjs} +10 -6
  76. package/dist/chunk-ZNK5RN5D.cjs.map +1 -0
  77. package/dist/index.cjs +54 -54
  78. package/dist/index.js +10 -10
  79. package/dist/llm/index.cjs +5 -5
  80. package/dist/llm/index.js +1 -1
  81. package/dist/llm/model/gateways/netlify.d.ts.map +1 -1
  82. package/dist/llm/model/provider-registry.generated.d.ts +4 -4
  83. package/dist/llm/model/provider-registry.generated.d.ts.map +1 -1
  84. package/dist/loop/index.cjs +2 -2
  85. package/dist/loop/index.js +1 -1
  86. package/dist/loop/loop.d.ts.map +1 -1
  87. package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
  88. package/dist/loop/types.d.ts +7 -6
  89. package/dist/loop/types.d.ts.map +1 -1
  90. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +1 -1
  91. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  92. package/dist/loop/workflows/agentic-loop/index.d.ts +2 -2
  93. package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
  94. package/dist/loop/workflows/schema.d.ts +5 -3
  95. package/dist/loop/workflows/schema.d.ts.map +1 -1
  96. package/dist/loop/workflows/stream.d.ts +1 -1
  97. package/dist/loop/workflows/stream.d.ts.map +1 -1
  98. package/dist/mastra/index.cjs +2 -2
  99. package/dist/mastra/index.d.ts +3 -7
  100. package/dist/mastra/index.d.ts.map +1 -1
  101. package/dist/mastra/index.js +1 -1
  102. package/dist/memory/index.cjs +4 -4
  103. package/dist/memory/index.js +1 -1
  104. package/dist/memory/memory.d.ts +7 -2
  105. package/dist/memory/memory.d.ts.map +1 -1
  106. package/dist/memory/types.d.ts +256 -8
  107. package/dist/memory/types.d.ts.map +1 -1
  108. package/dist/processors/index.cjs +14 -10
  109. package/dist/processors/index.d.ts +1 -0
  110. package/dist/processors/index.d.ts.map +1 -1
  111. package/dist/processors/index.js +1 -1
  112. package/dist/processors/processors/structured-output.d.ts +15 -7
  113. package/dist/processors/processors/structured-output.d.ts.map +1 -1
  114. package/dist/processors/runner.d.ts +0 -1
  115. package/dist/processors/runner.d.ts.map +1 -1
  116. package/dist/relevance/index.cjs +4 -4
  117. package/dist/relevance/index.js +1 -1
  118. package/dist/scores/index.cjs +9 -9
  119. package/dist/scores/index.js +2 -2
  120. package/dist/scores/scoreTraces/index.cjs +8 -8
  121. package/dist/scores/scoreTraces/index.js +3 -3
  122. package/dist/server/index.cjs +2 -2
  123. package/dist/server/index.js +1 -1
  124. package/dist/storage/index.cjs +3 -3
  125. package/dist/storage/index.js +1 -1
  126. package/dist/stream/aisdk/v5/compat/ui-message.d.ts.map +1 -1
  127. package/dist/stream/aisdk/v5/output.d.ts +6 -6
  128. package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
  129. package/dist/stream/aisdk/v5/transform.d.ts +5 -4
  130. package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
  131. package/dist/stream/base/output-format-handlers.d.ts +3 -7
  132. package/dist/stream/base/output-format-handlers.d.ts.map +1 -1
  133. package/dist/stream/base/output.d.ts +12 -6
  134. package/dist/stream/base/output.d.ts.map +1 -1
  135. package/dist/stream/index.cjs +4 -4
  136. package/dist/stream/index.js +1 -1
  137. package/dist/stream/types.d.ts +16 -5
  138. package/dist/stream/types.d.ts.map +1 -1
  139. package/dist/telemetry/index.cjs +7 -7
  140. package/dist/telemetry/index.js +1 -1
  141. package/dist/test-utils/llm-mock.cjs +2 -2
  142. package/dist/test-utils/llm-mock.js +1 -1
  143. package/dist/tts/index.cjs +2 -2
  144. package/dist/tts/index.js +1 -1
  145. package/dist/utils.cjs +17 -17
  146. package/dist/utils.d.ts +1 -1
  147. package/dist/utils.d.ts.map +1 -1
  148. package/dist/utils.js +1 -1
  149. package/dist/voice/index.cjs +4 -4
  150. package/dist/voice/index.js +1 -1
  151. package/dist/workflows/evented/index.cjs +10 -10
  152. package/dist/workflows/evented/index.js +1 -1
  153. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  154. package/dist/workflows/index.cjs +12 -12
  155. package/dist/workflows/index.js +1 -1
  156. package/dist/workflows/legacy/index.cjs +22 -22
  157. package/dist/workflows/legacy/index.js +1 -1
  158. package/dist/workflows/workflow.d.ts +8 -8
  159. package/dist/workflows/workflow.d.ts.map +1 -1
  160. package/package.json +1 -1
  161. package/dist/chunk-2C5AQMP5.cjs.map +0 -1
  162. package/dist/chunk-2EMOWXLL.js.map +0 -1
  163. package/dist/chunk-7CJKBCDL.js.map +0 -1
  164. package/dist/chunk-BBTR6DPH.cjs.map +0 -1
  165. package/dist/chunk-HJQ7ANDX.cjs.map +0 -1
  166. package/dist/chunk-K3UPABLX.cjs.map +0 -1
  167. package/dist/chunk-M24QFL6S.js.map +0 -1
  168. package/dist/chunk-NVMKTP4N.js.map +0 -1
  169. package/dist/chunk-QFKTSGBI.js.map +0 -1
  170. package/dist/chunk-SZD4WTRW.cjs.map +0 -1
  171. package/dist/chunk-WMGV4CS3.cjs.map +0 -1
  172. package/dist/chunk-X6PLOE2T.js.map +0 -1
  173. package/dist/network/vNext/index.cjs +0 -990
  174. package/dist/network/vNext/index.cjs.map +0 -1
  175. package/dist/network/vNext/index.d.ts +0 -331
  176. package/dist/network/vNext/index.d.ts.map +0 -1
  177. package/dist/network/vNext/index.js +0 -988
  178. package/dist/network/vNext/index.js.map +0 -1
  179. package/network/vNext.d.ts +0 -1
@@ -59,56 +59,304 @@ type WorkingMemoryNone = BaseWorkingMemory & {
59
59
  };
60
60
  export type WorkingMemory = TemplateWorkingMemory | SchemaWorkingMemory | WorkingMemoryNone;
61
61
  /**
62
- * Vector index configuration (PostgreSQL-specific)
62
+ * Vector index configuration for optimizing semantic recall performance.
63
63
  *
64
- * Note: These configuration options are currently only supported when using
65
- * PostgreSQL with pgvector as the vector store. Other vector stores (Pinecone,
66
- * Qdrant, Chroma, etc.) will ignore these settings.
64
+ * These settings are primarily supported by PostgreSQL with pgvector extension.
65
+ * Other vector stores (Pinecone, Qdrant, Chroma, etc.) will use their default
66
+ * configurations and ignore these settings.
67
+ *
68
+ * @see https://mastra.ai/docs/memory/semantic-recall#postgresql-index-optimization
67
69
  */
68
70
  export type VectorIndexConfig = {
69
- /** Index type - only supported by PostgreSQL/pgvector */
71
+ /**
72
+ * Type of vector index to create (PostgreSQL/pgvector only).
73
+ * - 'ivfflat': Inverted file index, good balance of speed and recall
74
+ * - 'hnsw': Hierarchical Navigable Small World, best performance for most cases
75
+ * - 'flat': Exact nearest neighbor search, slow but 100% recall
76
+ *
77
+ * @default 'ivfflat'
78
+ * @example
79
+ * ```typescript
80
+ * type: 'hnsw' // Recommended for production
81
+ * ```
82
+ */
70
83
  type?: 'ivfflat' | 'hnsw' | 'flat';
71
- /** Distance metric - supported by all vector stores */
84
+ /**
85
+ * Distance metric for similarity calculations.
86
+ * - 'cosine': Normalized dot product, good for text similarity
87
+ * - 'euclidean': L2 distance, geometric distance in vector space
88
+ * - 'dotproduct': Inner product, best for OpenAI embeddings
89
+ *
90
+ * Note: While defined here, most vector stores have their own metric configuration.
91
+ *
92
+ * @default 'cosine'
93
+ * @example
94
+ * ```typescript
95
+ * metric: 'dotproduct' // Optimal for OpenAI embeddings
96
+ * ```
97
+ */
72
98
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
73
- /** IVFFlat configuration (PostgreSQL only) */
99
+ /**
100
+ * Configuration for IVFFlat index (PostgreSQL only).
101
+ * Controls the number of inverted lists for clustering vectors.
102
+ */
74
103
  ivf?: {
104
+ /**
105
+ * Number of inverted lists (clusters) to create.
106
+ * Higher values mean better recall but slower build time.
107
+ * Recommended: rows/1000 for tables with > 1M rows.
108
+ *
109
+ * @default 100
110
+ */
75
111
  lists?: number;
76
112
  };
77
- /** HNSW configuration (PostgreSQL only) */
113
+ /**
114
+ * Configuration for HNSW index (PostgreSQL only).
115
+ * Hierarchical graph-based index with superior query performance.
116
+ */
78
117
  hnsw?: {
118
+ /**
119
+ * Maximum number of bi-directional links per node.
120
+ * Higher values increase recall and index size.
121
+ *
122
+ * @default 16
123
+ * @example
124
+ * ```typescript
125
+ * m: 32 // Higher recall, larger index
126
+ * ```
127
+ */
79
128
  m?: number;
129
+ /**
130
+ * Size of dynamic candidate list during index construction.
131
+ * Higher values mean better recall but slower index creation.
132
+ *
133
+ * @default 64
134
+ * @example
135
+ * ```typescript
136
+ * efConstruction: 128 // Better quality, slower build
137
+ * ```
138
+ */
80
139
  efConstruction?: number;
81
140
  };
82
141
  };
142
+ /**
143
+ * Configuration for semantic recall using RAG-based retrieval.
144
+ *
145
+ * Enables agents to retrieve relevant messages from past conversations using vector similarity search.
146
+ * Retrieved messages provide context from beyond the recent conversation history, helping agents
147
+ * maintain continuity across longer interactions.
148
+ *
149
+ * @see https://mastra.ai/docs/memory/semantic-recall
150
+ */
83
151
  export type SemanticRecall = {
152
+ /**
153
+ * Number of semantically similar messages to retrieve from the vector database.
154
+ * Higher values provide more context but increase token usage.
155
+ *
156
+ * @example
157
+ * ```typescript
158
+ * topK: 3 // Retrieve 3 most similar messages
159
+ * ```
160
+ */
84
161
  topK: number;
162
+ /**
163
+ * Amount of surrounding context to include with each retrieved message.
164
+ * Can be a single number (same before/after) or an object with separate values.
165
+ * Helps provide conversational flow around the matched message.
166
+ *
167
+ * @example
168
+ * ```typescript
169
+ * messageRange: 2 // Include 2 messages before and after
170
+ * messageRange: { before: 1, after: 3 } // 1 before, 3 after
171
+ * ```
172
+ */
85
173
  messageRange: number | {
86
174
  before: number;
87
175
  after: number;
88
176
  };
177
+ /**
178
+ * Scope for semantic search queries.
179
+ * - 'thread': Search only within the current conversation thread (default)
180
+ * - 'resource': Search across all threads owned by the same resource/user
181
+ *
182
+ * @default 'thread'
183
+ * @example
184
+ * ```typescript
185
+ * scope: 'resource' // Enable cross-thread memory recall
186
+ * ```
187
+ */
89
188
  scope?: 'thread' | 'resource';
90
189
  /**
91
190
  * Vector index configuration (PostgreSQL/pgvector specific).
92
191
  * Other vector stores will use their default index configurations.
192
+ * HNSW indexes typically provide better performance than IVFFlat.
193
+ *
194
+ * @example
195
+ * ```typescript
196
+ * indexConfig: {
197
+ * type: 'hnsw',
198
+ * metric: 'dotproduct', // Best for OpenAI embeddings
199
+ * hnsw: { m: 16, efConstruction: 64 }
200
+ * }
201
+ * ```
93
202
  */
94
203
  indexConfig?: VectorIndexConfig;
95
204
  };
205
+ /**
206
+ * Configuration for memory behaviors and retrieval strategies.
207
+ *
208
+ * Controls three types of memory: conversation history (recent messages), semantic recall
209
+ * (RAG-based retrieval of relevant past messages), and working memory (persistent user data).
210
+ * All memory types are combined into a single context window for the LLM.
211
+ *
212
+ * @see https://mastra.ai/docs/memory/overview
213
+ */
96
214
  export type MemoryConfig = {
215
+ /**
216
+ * Number of recent messages from the current thread to include in context.
217
+ * Provides short-term conversational continuity.
218
+ * Set to false to disable conversation history entirely.
219
+ *
220
+ * @default 10
221
+ * @example
222
+ * ```typescript
223
+ * lastMessages: 5 // Include last 5 messages
224
+ * lastMessages: false // Disable conversation history
225
+ * ```
226
+ */
97
227
  lastMessages?: number | false;
228
+ /**
229
+ * Semantic recall configuration for RAG-based retrieval of relevant past messages.
230
+ * Uses vector embeddings for similarity search across conversation history.
231
+ * Can be a boolean to enable/disable with defaults, or an object for detailed configuration.
232
+ *
233
+ * @default false (disabled by default)
234
+ * @example
235
+ * ```typescript
236
+ * semanticRecall: false // Disable semantic recall
237
+ * semanticRecall: {
238
+ * topK: 5,
239
+ * messageRange: 2,
240
+ * scope: 'resource' // Search across all resource (user) threads
241
+ * }
242
+ * ```
243
+ */
98
244
  semanticRecall?: boolean | SemanticRecall;
245
+ /**
246
+ * Working memory configuration for persistent user data and preferences.
247
+ * Maintains a structured record (Markdown or schema-based) that agents update over time.
248
+ * Can be thread-scoped (per conversation) or resource-scoped (across all user threads).
249
+ *
250
+ * @example
251
+ * ```typescript
252
+ * workingMemory: {
253
+ * enabled: true,
254
+ * scope: 'resource', // Persist across all resource (user) conversations
255
+ * template: '# User Profile\n- **Name**:\n- **Preferences**:',
256
+ * schema: z.object({
257
+ * name: z.string(),
258
+ * preferences: z.object({
259
+ * communicationStyle: z.string(),
260
+ * projectGoal: z.string(),
261
+ * deadlines: z.array(z.string()),
262
+ * }),
263
+ * }),
264
+ * }
265
+ * ```
266
+ */
99
267
  workingMemory?: WorkingMemory;
268
+ /**
269
+ * Thread management configuration.
270
+ */
100
271
  threads?: {
272
+ /**
273
+ * Automatically generate descriptive thread titles based on the first user message.
274
+ * Can be a boolean to enable with defaults, or an object to customize the model and instructions.
275
+ * Title generation runs asynchronously and doesn't affect response time.
276
+ *
277
+ * @example
278
+ * ```typescript
279
+ * generateTitle: true // Use agent's model for title generation
280
+ * generateTitle: {
281
+ * model: openai("gpt-4o-mini"),
282
+ * instructions: "Generate a concise title (max 5 words)"
283
+ * }
284
+ * ```
285
+ */
101
286
  generateTitle?: boolean | {
287
+ /**
288
+ * Language model to use for title generation.
289
+ * Can be static or a function that receives runtime context for dynamic selection.
290
+ */
102
291
  model: DynamicArgument<MastraLanguageModel>;
292
+ /**
293
+ * Custom instructions for title generation.
294
+ * Can be static or a function that receives runtime context for dynamic customization.
295
+ */
103
296
  instructions?: DynamicArgument<string>;
104
297
  };
105
298
  };
106
299
  };
300
+ /**
301
+ * Configuration for Mastra's memory system.
302
+ *
303
+ * Enables agents to persist and recall information across conversations using storage providers,
304
+ * vector databases for semantic search, and processors for context management. Memory can be
305
+ * scoped to individual threads or shared across all conversations for a resource (user).
306
+ *
307
+ * @see https://mastra.ai/docs/memory/overview
308
+ */
107
309
  export type SharedMemoryConfig = {
310
+ /**
311
+ * Storage adapter for persisting conversation threads, messages, and working memory.
312
+ *
313
+ * @example
314
+ * ```typescript
315
+ * storage: new LibSQLStore({ url: "file:./agent-memory.db" })
316
+ * ```
317
+ */
108
318
  storage?: MastraStorage;
319
+ /**
320
+ * Configuration for memory behaviors including conversation history, semantic recall,
321
+ * working memory, and thread management. Controls how messages are retrieved and
322
+ * what context is included in the LLM's prompt.
323
+ */
109
324
  options?: MemoryConfig;
325
+ /**
326
+ * Vector database for semantic recall capabilities using RAG-based search.
327
+ * Enables retrieval of relevant messages from past conversations based on semantic similarity.
328
+ * Set to false to disable vector search entirely.
329
+ *
330
+ * @example
331
+ * ```typescript
332
+ * vector: new PgVector({ connectionString: process.env.DATABASE_URL })
333
+ * ```
334
+ */
110
335
  vector?: MastraVector | false;
336
+ /**
337
+ * Embedding model for converting messages into vector representations for semantic search.
338
+ * Compatible with any AI SDK embedding model. FastEmbed provides local embeddings,
339
+ * while providers like OpenAI offer cloud-based models.
340
+ *
341
+ * @example
342
+ * ```typescript
343
+ * embedder: openai.embedding("text-embedding-3-small")
344
+ * ```
345
+ */
111
346
  embedder?: EmbeddingModel<string> | EmbeddingModelV2<string>;
347
+ /**
348
+ * Memory processors that modify retrieved messages before sending to the LLM.
349
+ * Useful for managing context size, filtering content, and preventing token limit errors.
350
+ * Processors execute in order, with TokenLimiter typically placed last.
351
+ *
352
+ * @example
353
+ * ```typescript
354
+ * processors: [
355
+ * new CustomMemoryProcessor(),
356
+ * new TokenLimiter(127000)
357
+ * ]
358
+ * ```
359
+ */
112
360
  processors?: MemoryProcessor[];
113
361
  };
114
362
  export type TraceType = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/memory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;A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,IAAI,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -1,44 +1,48 @@
1
1
  'use strict';
2
2
 
3
- var chunkWMGV4CS3_cjs = require('../chunk-WMGV4CS3.cjs');
3
+ var chunkT4H33PBR_cjs = require('../chunk-T4H33PBR.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "BatchPartsProcessor", {
8
8
  enumerable: true,
9
- get: function () { return chunkWMGV4CS3_cjs.BatchPartsProcessor; }
9
+ get: function () { return chunkT4H33PBR_cjs.BatchPartsProcessor; }
10
10
  });
11
11
  Object.defineProperty(exports, "LanguageDetector", {
12
12
  enumerable: true,
13
- get: function () { return chunkWMGV4CS3_cjs.LanguageDetector; }
13
+ get: function () { return chunkT4H33PBR_cjs.LanguageDetector; }
14
14
  });
15
15
  Object.defineProperty(exports, "ModerationProcessor", {
16
16
  enumerable: true,
17
- get: function () { return chunkWMGV4CS3_cjs.ModerationProcessor; }
17
+ get: function () { return chunkT4H33PBR_cjs.ModerationProcessor; }
18
18
  });
19
19
  Object.defineProperty(exports, "PIIDetector", {
20
20
  enumerable: true,
21
- get: function () { return chunkWMGV4CS3_cjs.PIIDetector; }
21
+ get: function () { return chunkT4H33PBR_cjs.PIIDetector; }
22
+ });
23
+ Object.defineProperty(exports, "ProcessorState", {
24
+ enumerable: true,
25
+ get: function () { return chunkT4H33PBR_cjs.ProcessorState; }
22
26
  });
23
27
  Object.defineProperty(exports, "PromptInjectionDetector", {
24
28
  enumerable: true,
25
- get: function () { return chunkWMGV4CS3_cjs.PromptInjectionDetector; }
29
+ get: function () { return chunkT4H33PBR_cjs.PromptInjectionDetector; }
26
30
  });
27
31
  Object.defineProperty(exports, "StructuredOutputProcessor", {
28
32
  enumerable: true,
29
- get: function () { return chunkWMGV4CS3_cjs.StructuredOutputProcessor; }
33
+ get: function () { return chunkT4H33PBR_cjs.StructuredOutputProcessor; }
30
34
  });
31
35
  Object.defineProperty(exports, "SystemPromptScrubber", {
32
36
  enumerable: true,
33
- get: function () { return chunkWMGV4CS3_cjs.SystemPromptScrubber; }
37
+ get: function () { return chunkT4H33PBR_cjs.SystemPromptScrubber; }
34
38
  });
35
39
  Object.defineProperty(exports, "TokenLimiterProcessor", {
36
40
  enumerable: true,
37
- get: function () { return chunkWMGV4CS3_cjs.TokenLimiterProcessor; }
41
+ get: function () { return chunkT4H33PBR_cjs.TokenLimiterProcessor; }
38
42
  });
39
43
  Object.defineProperty(exports, "UnicodeNormalizer", {
40
44
  enumerable: true,
41
- get: function () { return chunkWMGV4CS3_cjs.UnicodeNormalizer; }
45
+ get: function () { return chunkT4H33PBR_cjs.UnicodeNormalizer; }
42
46
  });
43
47
  //# sourceMappingURL=index.cjs.map
44
48
  //# sourceMappingURL=index.cjs.map
@@ -39,4 +39,5 @@ export type InputProcessor = WithRequired<Processor, 'name' | 'processInput'> &
39
39
  export type OutputProcessor = (WithRequired<Processor, 'name' | 'processOutputStream'> & Processor) | (WithRequired<Processor, 'name' | 'processOutputResult'> & Processor);
40
40
  export type ProcessorTypes = InputProcessor | OutputProcessor;
41
41
  export * from './processors/index.js';
42
+ export { ProcessorState } from './runner.js';
42
43
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/processors/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,CAAC,IAAI,EAAE;QAClB,QAAQ,EAAE,eAAe,EAAE,CAAC;QAC5B,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC;QAClC,cAAc,CAAC,EAAE,cAAc,CAAC;KACjC,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,GAAG,eAAe,EAAE,CAAC;IAEnD;;;;OAIG;IACH,mBAAmB,CAAC,CAAC,IAAI,EAAE;QACzB,IAAI,EAAE,SAAS,CAAC;QAChB,WAAW,EAAE,SAAS,EAAE,CAAC;QACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC3B,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC;QAClC,cAAc,CAAC,EAAE,cAAc,CAAC;KACjC,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAE1C;;OAEG;IACH,mBAAmB,CAAC,CAAC,IAAI,EAAE;QACzB,QAAQ,EAAE,eAAe,EA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EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
@@ -1,3 +1,3 @@
1
- export { BatchPartsProcessor, LanguageDetector, ModerationProcessor, PIIDetector, PromptInjectionDetector, StructuredOutputProcessor, SystemPromptScrubber, TokenLimiterProcessor, UnicodeNormalizer } from '../chunk-2EMOWXLL.js';
1
+ export { BatchPartsProcessor, LanguageDetector, ModerationProcessor, PIIDetector, ProcessorState, PromptInjectionDetector, StructuredOutputProcessor, SystemPromptScrubber, TokenLimiterProcessor, UnicodeNormalizer } from '../chunk-DQISKQDE.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
@@ -1,9 +1,10 @@
1
- import type { MastraMessageV2 } from '../../agent/message-list/index.js';
1
+ import type { TransformStreamDefaultController } from 'stream/web';
2
2
  import type { StructuredOutputOptions } from '../../agent/types.js';
3
3
  import type { MastraLanguageModel } from '../../llm/model/shared.types.js';
4
- import type { OutputSchema } from '../../stream/index.js';
4
+ import type { ChunkType, OutputSchema } from '../../stream/index.js';
5
5
  import type { Processor } from '../index.js';
6
6
  export type { StructuredOutputOptions } from '../../agent/types.js';
7
+ export declare const STRUCTURED_OUTPUT_PROCESSOR_NAME = "structured-output";
7
8
  /**
8
9
  * StructuredOutputProcessor transforms unstructured agent output into structured JSON
9
10
  * using an internal structuring agent and provides real-time streaming support.
@@ -22,15 +23,22 @@ export declare class StructuredOutputProcessor<OUTPUT extends OutputSchema> impl
22
23
  private structuringAgent;
23
24
  private errorStrategy;
24
25
  private fallbackValue?;
26
+ private isStructuringAgentStreamStarted;
25
27
  constructor(options: StructuredOutputOptions<OUTPUT>, fallbackModel?: MastraLanguageModel);
26
- processOutputResult(args: {
27
- messages: MastraMessageV2[];
28
+ processOutputStream(args: {
29
+ part: ChunkType;
30
+ streamParts: ChunkType[];
31
+ state: {
32
+ controller: TransformStreamDefaultController<ChunkType<OUTPUT>>;
33
+ };
28
34
  abort: (reason?: string) => never;
29
- }): Promise<MastraMessageV2[]>;
35
+ }): Promise<ChunkType | null | undefined>;
36
+ private processAndEmitStructuredOutput;
30
37
  /**
31
- * Extract text content from a message
38
+ * Build a structured markdown prompt from stream parts
39
+ * Collects chunks by type and formats them in a consistent structure
32
40
  */
33
- private extractTextContent;
41
+ private buildStructuringPrompt;
34
42
  /**
35
43
  * Generate instructions for the structuring agent based on the schema
36
44
  */
@@ -1 +1 @@
1
- {"version":3,"file":"structured-output.d.ts","sourceRoot":"","sources":["../../../src/processors/processors/structured-output.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,YAAY,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,qBAAa,yBAAyB,CAAC,MAAM,SAAS,YAAY,CAAE,YAAW,SAAS;IACtF,QAAQ,CAAC,IAAI,uBAAuB;IAE7B,MAAM,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,aAAa,CAAC,CAA4B;gBAEtC,OAAO,EAAE,uBAAuB,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,EAAE,mBAAmB;IAoBnF,mBAAmB,CAAC,IAAI,EAAE;QAC9B,QAAQ,EAAE,eAAe,EAAE,CAAC;QAC5B,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC;KACnC,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAgG9B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAkB1B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;OAEG;IACH,OAAO,CAAC,WAAW;CAiBpB"}
1
+ {"version":3,"file":"structured-output.d.ts","sourceRoot":"","sources":["../../../src/processors/processors/structured-output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,YAAY,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,qBAAa,yBAAyB,CAAC,MAAM,SAAS,YAAY,CAAE,YAAW,SAAS;IACtF,QAAQ,CAAC,IAAI,uBAAoC;IAE1C,MAAM,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,aAAa,CAAC,CAA4B;IAClD,OAAO,CAAC,+BAA+B,CAAS;gBAEpC,OAAO,EAAE,uBAAuB,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,EAAE,mBAAmB;IAoBnF,mBAAmB,CAAC,IAAI,EAAE;QAC9B,IAAI,EAAE,SAAS,CAAC;QAChB,WAAW,EAAE,SAAS,EAAE,CAAC;QACzB,KAAK,EAAE;YACL,UAAU,EAAE,gCAAgC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;SACjE,CAAC;QACF,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC;KACnC,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;YAkB3B,8BAA8B;IAsE5C;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IA6D9B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;OAEG;IACH,OAAO,CAAC,WAAW;CAgBpB"}
@@ -14,7 +14,6 @@ export declare class ProcessorState<OUTPUT extends OutputSchema = undefined> {
14
14
  constructor(_processorName: string);
15
15
  addPart(part: ChunkType<OUTPUT>): void;
16
16
  }
17
- export type ProcessorRunnerMode = 'stream' | 'result' | false;
18
17
  export declare class ProcessorRunner {
19
18
  readonly inputProcessors: Processor[];
20
19
  readonly outputProcessors: Processor[];
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/processors/runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;GAEG;AACH,qBAAa,cAAc,CAAC,MAAM,SAAS,YAAY,GAAG,SAAS;IACjE,OAAO,CAAC,eAAe,CAAM;IACtB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACtC,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAM;gBAEjC,cAAc,EAAE,MAAM;IAGlC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI;CAOvC;AAED,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE9D,qBAAa,eAAe;IAC1B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,OAAO,CAAC,WAAW,CAAC;IA0DvB;;OAEG;IACG,WAAW,CAAC,MAAM,SAAS,YAAY,EAC3C,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,EACvB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,EACpD,cAAc,CAAC,EAAE,cAAc,GAC9B,OAAO,CAAC;QACT,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;QAC3C,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IAkDI,4BAA4B,CAAC,MAAM,SAAS,YAAY,GAAG,SAAS,EACxE,YAAY,EAAE,iBAAiB,CAAC,MAAM,CAAC,EACvC,cAAc,CAAC,EAAE,cAAc,GAC9B,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAiDzB,kBAAkB,CACtB,WAAW,EAAE,WAAW,EACxB,cAAc,CAAC,EAAE,cAAc,EAC/B,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,WAAW,CAAC;CAyDxB"}
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var chunk3I3NRXSD_cjs = require('../chunk-3I3NRXSD.cjs');
3
+ var chunkOKIHIKXV_cjs = require('../chunk-OKIHIKXV.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "CohereRelevanceScorer", {
8
8
  enumerable: true,
9
- get: function () { return chunk3I3NRXSD_cjs.CohereRelevanceScorer; }
9
+ get: function () { return chunkOKIHIKXV_cjs.CohereRelevanceScorer; }
10
10
  });
11
11
  Object.defineProperty(exports, "MastraAgentRelevanceScorer", {
12
12
  enumerable: true,
13
- get: function () { return chunk3I3NRXSD_cjs.MastraAgentRelevanceScorer; }
13
+ get: function () { return chunkOKIHIKXV_cjs.MastraAgentRelevanceScorer; }
14
14
  });
15
15
  Object.defineProperty(exports, "createSimilarityPrompt", {
16
16
  enumerable: true,
17
- get: function () { return chunk3I3NRXSD_cjs.createSimilarityPrompt; }
17
+ get: function () { return chunkOKIHIKXV_cjs.createSimilarityPrompt; }
18
18
  });
19
19
  //# sourceMappingURL=index.cjs.map
20
20
  //# sourceMappingURL=index.cjs.map
@@ -1,3 +1,3 @@
1
- export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from '../chunk-BMBWTBCL.js';
1
+ export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from '../chunk-ZJ2UFCTS.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
@@ -1,37 +1,37 @@
1
1
  'use strict';
2
2
 
3
- var chunkQMDJVXFQ_cjs = require('../chunk-QMDJVXFQ.cjs');
4
- var chunkHV5ND4KF_cjs = require('../chunk-HV5ND4KF.cjs');
3
+ var chunk3NNB72OL_cjs = require('../chunk-3NNB72OL.cjs');
4
+ var chunkYEEAHLAK_cjs = require('../chunk-YEEAHLAK.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "MastraScorer", {
9
9
  enumerable: true,
10
- get: function () { return chunkQMDJVXFQ_cjs.MastraScorer; }
10
+ get: function () { return chunk3NNB72OL_cjs.MastraScorer; }
11
11
  });
12
12
  Object.defineProperty(exports, "createScorer", {
13
13
  enumerable: true,
14
- get: function () { return chunkQMDJVXFQ_cjs.createScorer; }
14
+ get: function () { return chunk3NNB72OL_cjs.createScorer; }
15
15
  });
16
16
  Object.defineProperty(exports, "runExperiment", {
17
17
  enumerable: true,
18
- get: function () { return chunkQMDJVXFQ_cjs.runExperiment; }
18
+ get: function () { return chunk3NNB72OL_cjs.runExperiment; }
19
19
  });
20
20
  Object.defineProperty(exports, "saveScorePayloadSchema", {
21
21
  enumerable: true,
22
- get: function () { return chunkHV5ND4KF_cjs.saveScorePayloadSchema; }
22
+ get: function () { return chunkYEEAHLAK_cjs.saveScorePayloadSchema; }
23
23
  });
24
24
  Object.defineProperty(exports, "scoreResultSchema", {
25
25
  enumerable: true,
26
- get: function () { return chunkHV5ND4KF_cjs.scoreResultSchema; }
26
+ get: function () { return chunkYEEAHLAK_cjs.scoreResultSchema; }
27
27
  });
28
28
  Object.defineProperty(exports, "scoringExtractStepResultSchema", {
29
29
  enumerable: true,
30
- get: function () { return chunkHV5ND4KF_cjs.scoringExtractStepResultSchema; }
30
+ get: function () { return chunkYEEAHLAK_cjs.scoringExtractStepResultSchema; }
31
31
  });
32
32
  Object.defineProperty(exports, "scoringValueSchema", {
33
33
  enumerable: true,
34
- get: function () { return chunkHV5ND4KF_cjs.scoringValueSchema; }
34
+ get: function () { return chunkYEEAHLAK_cjs.scoringValueSchema; }
35
35
  });
36
36
  //# sourceMappingURL=index.cjs.map
37
37
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- export { MastraScorer, createScorer, runExperiment } from '../chunk-LYRPXSHB.js';
2
- export { saveScorePayloadSchema, scoreResultSchema, scoringExtractStepResultSchema, scoringValueSchema } from '../chunk-A7REAXWA.js';
1
+ export { MastraScorer, createScorer, runExperiment } from '../chunk-QR5VZWWT.js';
2
+ export { saveScorePayloadSchema, scoreResultSchema, scoringExtractStepResultSchema, scoringValueSchema } from '../chunk-WP2KQXPV.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk57UPIDGK_cjs = require('../../chunk-57UPIDGK.cjs');
4
- var chunkHV5ND4KF_cjs = require('../../chunk-HV5ND4KF.cjs');
5
- var chunk62I4SVWU_cjs = require('../../chunk-62I4SVWU.cjs');
3
+ var chunkI6TOPBP6_cjs = require('../../chunk-I6TOPBP6.cjs');
4
+ var chunkYEEAHLAK_cjs = require('../../chunk-YEEAHLAK.cjs');
5
+ var chunk7HUKQ6SZ_cjs = require('../../chunk-7HUKQ6SZ.cjs');
6
6
  var chunkWM4VQWOZ_cjs = require('../../chunk-WM4VQWOZ.cjs');
7
7
  var pMap = require('p-map');
8
8
  var z = require('zod');
@@ -76,7 +76,7 @@ function normalizeMessageContent(content) {
76
76
  role: "user",
77
77
  parts: content.map((part) => ({ type: part.type, text: part.text }))
78
78
  };
79
- const converted = chunk62I4SVWU_cjs.convertMessages(tempMessage).to("AIV4.UI");
79
+ const converted = chunk7HUKQ6SZ_cjs.convertMessages(tempMessage).to("AIV4.UI");
80
80
  return converted[0]?.content || "";
81
81
  }
82
82
  function convertToUIMessage(message, createdAt) {
@@ -94,7 +94,7 @@ function convertToUIMessage(message, createdAt) {
94
94
  parts: message.content.map((part) => ({ type: part.type, text: part.text }))
95
95
  };
96
96
  }
97
- const converted = chunk62I4SVWU_cjs.convertMessages(messageInput).to("AIV4.UI");
97
+ const converted = chunk7HUKQ6SZ_cjs.convertMessages(messageInput).to("AIV4.UI");
98
98
  const result = converted[0];
99
99
  if (!result) {
100
100
  throw new Error("Failed to convert message");
@@ -234,7 +234,7 @@ function transformTraceToScorerInputAndOutput(trace) {
234
234
  }
235
235
 
236
236
  // src/scores/scoreTraces/scoreTracesWorkflow.ts
237
- var getTraceStep = chunk57UPIDGK_cjs.createStep({
237
+ var getTraceStep = chunkI6TOPBP6_cjs.createStep({
238
238
  id: "__process-trace-scoring",
239
239
  inputSchema: z__default.default.object({
240
240
  targets: z__default.default.array(
@@ -362,7 +362,7 @@ async function runScorerOnTarget({
362
362
  await attachScoreToSpan({ storage, span, scoreRecord: savedScoreRecord });
363
363
  }
364
364
  async function validateAndSaveScore({ storage, scorerResult }) {
365
- const payloadToSave = chunkHV5ND4KF_cjs.saveScorePayloadSchema.parse(scorerResult);
365
+ const payloadToSave = chunkYEEAHLAK_cjs.saveScorePayloadSchema.parse(scorerResult);
366
366
  const result = await storage.saveScore(payloadToSave);
367
367
  return result.score;
368
368
  }
@@ -404,7 +404,7 @@ async function attachScoreToSpan({
404
404
  updates: { links: [...existingLinks, link] }
405
405
  });
406
406
  }
407
- var scoreTracesWorkflow = chunk57UPIDGK_cjs.createWorkflow({
407
+ var scoreTracesWorkflow = chunkI6TOPBP6_cjs.createWorkflow({
408
408
  id: "__batch-scoring-traces",
409
409
  inputSchema: z__default.default.object({
410
410
  targets: z__default.default.array(
@@ -1,6 +1,6 @@
1
- import { createStep, createWorkflow } from '../../chunk-5QUE7HZF.js';
2
- import { saveScorePayloadSchema } from '../../chunk-A7REAXWA.js';
3
- import { convertMessages } from '../../chunk-TJHEGJNW.js';
1
+ import { createStep, createWorkflow } from '../../chunk-6R46VE63.js';
2
+ import { saveScorePayloadSchema } from '../../chunk-WP2KQXPV.js';
3
+ import { convertMessages } from '../../chunk-BOJNXNRV.js';
4
4
  import { MastraError } from '../../chunk-T3JFFQH2.js';
5
5
  import pMap from 'p-map';
6
6
  import z from 'zod';