@mastra/core 1.18.0-alpha.4 → 1.18.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.
- package/CHANGELOG.md +229 -0
- package/dist/_types/@internal_core/dist/index.d.ts +502 -29
- package/dist/agent/agent-legacy.d.ts +2 -0
- package/dist/agent/agent-legacy.d.ts.map +1 -1
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +8 -8
- package/dist/agent/index.js +1 -1
- package/dist/{chunk-2RGBP3A3.cjs → chunk-2H53MD2U.cjs} +68 -68
- package/dist/{chunk-2RGBP3A3.cjs.map → chunk-2H53MD2U.cjs.map} +1 -1
- package/dist/{chunk-CEWIMGYP.js → chunk-2M3HWTRI.js} +4 -4
- package/dist/{chunk-CEWIMGYP.js.map → chunk-2M3HWTRI.js.map} +1 -1
- package/dist/{chunk-UZ426KMJ.cjs → chunk-4BZRWJBH.cjs} +32 -32
- package/dist/{chunk-UZ426KMJ.cjs.map → chunk-4BZRWJBH.cjs.map} +1 -1
- package/dist/{chunk-LQHNR4L7.js → chunk-4FMKWOPC.js} +3 -3
- package/dist/{chunk-LQHNR4L7.js.map → chunk-4FMKWOPC.js.map} +1 -1
- package/dist/{chunk-WINCOFML.js → chunk-6Z4GSLLO.js} +3 -3
- package/dist/{chunk-WINCOFML.js.map → chunk-6Z4GSLLO.js.map} +1 -1
- package/dist/{chunk-JYVH24UY.js → chunk-7GLVV6CZ.js} +5 -5
- package/dist/{chunk-JYVH24UY.js.map → chunk-7GLVV6CZ.js.map} +1 -1
- package/dist/{chunk-VYVPUH6H.cjs → chunk-BF7IH4JU.cjs} +189 -35
- package/dist/chunk-BF7IH4JU.cjs.map +1 -0
- package/dist/{chunk-GIBIKVUG.js → chunk-EKFG6JWW.js} +7 -7
- package/dist/{chunk-GIBIKVUG.js.map → chunk-EKFG6JWW.js.map} +1 -1
- package/dist/{chunk-F77BL7Z7.js → chunk-GJ62FP5X.js} +4 -4
- package/dist/{chunk-F77BL7Z7.js.map → chunk-GJ62FP5X.js.map} +1 -1
- package/dist/{chunk-ULPWI6DN.cjs → chunk-GJIN53S6.cjs} +9 -9
- package/dist/{chunk-ULPWI6DN.cjs.map → chunk-GJIN53S6.cjs.map} +1 -1
- package/dist/{chunk-HJVPOP5S.js → chunk-I4ZSA3XJ.js} +4 -4
- package/dist/{chunk-HJVPOP5S.js.map → chunk-I4ZSA3XJ.js.map} +1 -1
- package/dist/{chunk-2OZQLYLM.cjs → chunk-J47RNLSY.cjs} +176 -173
- package/dist/chunk-J47RNLSY.cjs.map +1 -0
- package/dist/{chunk-DJ2RXLO3.js → chunk-K7AE4BHR.js} +4 -4
- package/dist/{chunk-DJ2RXLO3.js.map → chunk-K7AE4BHR.js.map} +1 -1
- package/dist/{chunk-RIUDLIP3.cjs → chunk-KLVNQDUR.cjs} +3 -3
- package/dist/chunk-KLVNQDUR.cjs.map +1 -0
- package/dist/{chunk-SMWXSQXP.cjs → chunk-KOTSKPTF.cjs} +19 -19
- package/dist/{chunk-SMWXSQXP.cjs.map → chunk-KOTSKPTF.cjs.map} +1 -1
- package/dist/{chunk-QE7OKYS3.js → chunk-KRFGPA2H.js} +174 -36
- package/dist/chunk-KRFGPA2H.js.map +1 -0
- package/dist/{chunk-5M3CKUAS.cjs → chunk-L3X22YTN.cjs} +185 -185
- package/dist/{chunk-5M3CKUAS.cjs.map → chunk-L3X22YTN.cjs.map} +1 -1
- package/dist/{chunk-OJQCLQK7.cjs → chunk-LKZQG2ZZ.cjs} +13 -13
- package/dist/{chunk-OJQCLQK7.cjs.map → chunk-LKZQG2ZZ.cjs.map} +1 -1
- package/dist/{chunk-ERAZTMF6.js → chunk-MJF7NZEF.js} +437 -8
- package/dist/chunk-MJF7NZEF.js.map +1 -0
- package/dist/{chunk-RHQHBU6R.js → chunk-PMWMEK4T.js} +3 -3
- package/dist/{chunk-RHQHBU6R.js.map → chunk-PMWMEK4T.js.map} +1 -1
- package/dist/{chunk-IKYWIQB2.cjs → chunk-PWFPYJGG.cjs} +20 -20
- package/dist/{chunk-IKYWIQB2.cjs.map → chunk-PWFPYJGG.cjs.map} +1 -1
- package/dist/{chunk-B5LIMU4I.js → chunk-RTBZOGTO.js} +3 -3
- package/dist/{chunk-B5LIMU4I.js.map → chunk-RTBZOGTO.js.map} +1 -1
- package/dist/{chunk-E7LJ7F56.cjs → chunk-RTXCZT3M.cjs} +5 -5
- package/dist/{chunk-E7LJ7F56.cjs.map → chunk-RTXCZT3M.cjs.map} +1 -1
- package/dist/{chunk-4QLIPOI7.cjs → chunk-TVZCMQTV.cjs} +82 -82
- package/dist/{chunk-4QLIPOI7.cjs.map → chunk-TVZCMQTV.cjs.map} +1 -1
- package/dist/{chunk-QOFOOVPM.js → chunk-UPBMT3QM.js} +9 -9
- package/dist/{chunk-QOFOOVPM.js.map → chunk-UPBMT3QM.js.map} +1 -1
- package/dist/{chunk-CGDV5YUS.cjs → chunk-V2NQOABM.cjs} +455 -26
- package/dist/chunk-V2NQOABM.cjs.map +1 -0
- package/dist/{chunk-Z5FE6LBA.js → chunk-XOBRMYFA.js} +3 -3
- package/dist/chunk-XOBRMYFA.js.map +1 -0
- package/dist/{chunk-6DDSP6ZE.js → chunk-XQN3BKCI.js} +5 -5
- package/dist/{chunk-6DDSP6ZE.js.map → chunk-XQN3BKCI.js.map} +1 -1
- package/dist/{chunk-ATKRXBCX.cjs → chunk-XQRTJIC7.cjs} +9 -9
- package/dist/{chunk-ATKRXBCX.cjs.map → chunk-XQRTJIC7.cjs.map} +1 -1
- package/dist/{chunk-A2FSD2KN.cjs → chunk-ZQE2VUYD.cjs} +7 -7
- package/dist/{chunk-A2FSD2KN.cjs.map → chunk-ZQE2VUYD.cjs.map} +1 -1
- package/dist/{chunk-T3TFXXGP.js → chunk-ZRLAR66M.js} +12 -9
- package/dist/chunk-ZRLAR66M.js.map +1 -0
- package/dist/{chunk-4LDFFARO.cjs → chunk-ZVGS2O2W.cjs} +6 -6
- package/dist/{chunk-4LDFFARO.cjs.map → chunk-ZVGS2O2W.cjs.map} +1 -1
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +560 -496
- package/dist/evals/index.cjs +23 -23
- package/dist/evals/index.js +3 -3
- package/dist/evals/scoreTraces/index.cjs +7 -7
- package/dist/evals/scoreTraces/index.js +3 -3
- package/dist/harness/index.cjs +7 -7
- package/dist/harness/index.js +5 -5
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/llm/index.cjs +16 -16
- package/dist/llm/index.js +5 -5
- package/dist/loop/index.cjs +14 -14
- package/dist/loop/index.js +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +14 -14
- package/dist/memory/index.js +1 -1
- package/dist/models-dev-5WY37RVC.cjs +12 -0
- package/dist/{models-dev-THY3NOPF.cjs.map → models-dev-5WY37RVC.cjs.map} +1 -1
- package/dist/models-dev-Y2UFJEOO.js +3 -0
- package/dist/{models-dev-JGKQCSEN.js.map → models-dev-Y2UFJEOO.js.map} +1 -1
- package/dist/netlify-ADZQ5ZNY.cjs +12 -0
- package/dist/{netlify-NL6O2R7M.cjs.map → netlify-ADZQ5ZNY.cjs.map} +1 -1
- package/dist/netlify-I4AUVRO2.js +3 -0
- package/dist/{netlify-6TILQFDV.js.map → netlify-I4AUVRO2.js.map} +1 -1
- package/dist/observability/index.cjs +18 -18
- package/dist/observability/index.js +1 -1
- package/dist/observability/types/tracing.d.ts +2 -0
- package/dist/observability/types/tracing.d.ts.map +1 -1
- package/dist/processor-provider/index.cjs +10 -10
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +44 -44
- package/dist/processors/index.js +1 -1
- package/dist/provider-registry-C7SZ5ZT4.js +3 -0
- package/dist/{provider-registry-CRD5YYZY.js.map → provider-registry-C7SZ5ZT4.js.map} +1 -1
- package/dist/provider-registry-I5RW3MEE.cjs +40 -0
- package/dist/{provider-registry-KXOHTVQF.cjs.map → provider-registry-I5RW3MEE.cjs.map} +1 -1
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/storage/constants.cjs +56 -56
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/observability/base.d.ts +10 -2
- package/dist/storage/domains/observability/base.d.ts.map +1 -1
- package/dist/storage/domains/observability/feedback.d.ts +1 -1
- package/dist/storage/domains/observability/feedback.d.ts.map +1 -1
- package/dist/storage/domains/observability/inmemory.d.ts +13 -2
- package/dist/storage/domains/observability/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/observability/scores.d.ts +1 -1
- package/dist/storage/domains/observability/scores.d.ts.map +1 -1
- package/dist/storage/index.cjs +334 -270
- package/dist/storage/index.js +3 -3
- package/dist/stream/index.cjs +8 -8
- package/dist/stream/index.js +1 -1
- package/dist/test-utils/llm-mock.cjs +4 -4
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/utils.cjs +23 -23
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +7 -7
- package/dist/vector/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +24 -24
- package/dist/workflows/index.js +1 -1
- package/package.json +9 -9
- package/dist/chunk-2OZQLYLM.cjs.map +0 -1
- package/dist/chunk-CGDV5YUS.cjs.map +0 -1
- package/dist/chunk-ERAZTMF6.js.map +0 -1
- package/dist/chunk-QE7OKYS3.js.map +0 -1
- package/dist/chunk-RIUDLIP3.cjs.map +0 -1
- package/dist/chunk-T3TFXXGP.js.map +0 -1
- package/dist/chunk-VYVPUH6H.cjs.map +0 -1
- package/dist/chunk-Z5FE6LBA.js.map +0 -1
- package/dist/models-dev-JGKQCSEN.js +0 -3
- package/dist/models-dev-THY3NOPF.cjs +0 -12
- package/dist/netlify-6TILQFDV.js +0 -3
- package/dist/netlify-NL6O2R7M.cjs +0 -12
- package/dist/provider-registry-CRD5YYZY.js +0 -3
- package/dist/provider-registry-KXOHTVQF.cjs +0 -40
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,234 @@
|
|
|
1
1
|
# @mastra/core
|
|
2
2
|
|
|
3
|
+
## 1.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add version-aware code-agent lookup and override version lifecycle support. ([#14776](https://github.com/mastra-ai/mastra/pull/14776))
|
|
8
|
+
|
|
9
|
+
`Mastra.getAgent(name, version)` and `Mastra.getAgentById(id, version)` can now resolve draft or specific stored override versions when the editor package is configured, and throw a clear error when versioned lookup is requested without the editor.
|
|
10
|
+
|
|
11
|
+
`client.getAgent(id, version)` now carries version selection through agent detail and voice metadata requests, and the `Agent` resource now supports override version management methods including `listVersions`, `createVersion`, `getVersion`, `activateVersion`, `restoreVersion`, `deleteVersion`, and `compareVersions`.
|
|
12
|
+
|
|
13
|
+
`Agent.createVersion(...)` is intentionally limited to code-agent overrideable fields plus version metadata, rather than the full stored-agent configuration surface.
|
|
14
|
+
|
|
15
|
+
- **Trajectory evaluation**: Added trajectory types and trace-based extraction for evaluating agent and workflow execution paths. ([#14697](https://github.com/mastra-ai/mastra/pull/14697))
|
|
16
|
+
|
|
17
|
+
`TrajectoryStep` models each step in an execution as a typed object — tool calls, model generations, agent runs, workflow steps, and control flow nodes each have their own variant with relevant properties (e.g., `toolArgs`/`toolResult` for tool calls, `modelId`/`promptTokens` for model generations). Steps can be nested via `children` to represent hierarchical execution.
|
|
18
|
+
|
|
19
|
+
`TrajectoryExpectation` lets you define what a good trajectory looks like — expected steps, ordering, step/token/duration budgets, blacklisted tools, and retry thresholds. `ExpectedStep` provides a simple way to define expected steps by name and optional stepType, with support for nested expectations via `children` to set different evaluation rules at each level of the hierarchy.
|
|
20
|
+
|
|
21
|
+
**Trace-based extraction:** `extractTrajectoryFromTrace()` builds hierarchical trajectories from observability trace spans. The `runEvals` pipeline automatically uses this when storage is configured, capturing the full execution tree including nested agent runs and tool calls. Falls back to `extractTrajectory` (agents) or `extractWorkflowTrajectory` (workflows) when storage is unavailable.
|
|
22
|
+
|
|
23
|
+
**Pipeline:** `expectedTrajectory` flows from dataset items through `runEvals` to trajectory scorers. Added `trajectory` key to both `AgentScorerConfig` and `WorkflowScorerConfig`.
|
|
24
|
+
|
|
25
|
+
- Added support for attaching scorers to datasets. Scorers attached to a dataset automatically run when an experiment is triggered, alongside any scorers specified at trigger time. New `scorerIds` field on `DatasetRecord`, `CreateDatasetInput`, and `UpdateDatasetInput` types. ([#14783](https://github.com/mastra-ai/mastra/pull/14783))
|
|
26
|
+
|
|
27
|
+
- Add `lsp_inspect` tool for LSP-based code inspection with hover, definition, and implementation queries ([#14565](https://github.com/mastra-ai/mastra/pull/14565))
|
|
28
|
+
|
|
29
|
+
- Added `disableBuiltinTools` to `HarnessConfig` so you can disable specific built-in harness tools. ([#14227](https://github.com/mastra-ai/mastra/pull/14227))
|
|
30
|
+
|
|
31
|
+
Example:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
new Harness({ disableBuiltinTools: ['submit_plan', 'subagent'] });
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- Added SkillSearchProcessor for on-demand skill discovery. Instead of injecting all skill metadata upfront, agents get `search_skills` and `load_skill` meta-tools to find and load skills on demand with thread-scoped state and TTL cleanup. ([#14596](https://github.com/mastra-ai/mastra/pull/14596))
|
|
38
|
+
|
|
39
|
+
**Example**
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { SkillSearchProcessor } from '@mastra/core/processors';
|
|
43
|
+
|
|
44
|
+
const skillSearch = new SkillSearchProcessor({
|
|
45
|
+
workspace,
|
|
46
|
+
search: { topK: 5 },
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const agent = new Agent({
|
|
50
|
+
workspace,
|
|
51
|
+
inputProcessors: [skillSearch],
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- Added public score and feedback analytics APIs to observability storage: ([#14861](https://github.com/mastra-ai/mastra/pull/14861))
|
|
56
|
+
`getScoreAggregate` / `getFeedbackAggregate` for counts, sums, averages, minimums, maximums, or latest values;
|
|
57
|
+
`getScoreBreakdown` / `getFeedbackBreakdown` for grouped results by dimension;
|
|
58
|
+
`getScoreTimeSeries` / `getFeedbackTimeSeries` for time-bucketed trends;
|
|
59
|
+
and `getScorePercentiles` / `getFeedbackPercentiles` for percentile series such as p50 and p95.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
await observability.getScoreTimeSeries({
|
|
63
|
+
scorerId: 'relevance',
|
|
64
|
+
interval: '1h',
|
|
65
|
+
aggregation: 'avg',
|
|
66
|
+
});
|
|
67
|
+
// returns time-bucketed average scores
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- Added new observability entrypoint APIs for persisted traces. You can now call `mastra.observability.getRecordedTrace({ traceId })` to load a recorded trace, and use optional top-level `mastra.observability.addScore()/addFeedback()` helpers to annotate a persisted trace by ID. ([#14842](https://github.com/mastra-ai/mastra/pull/14842))
|
|
71
|
+
|
|
72
|
+
- Align observability signal contracts around first-class trace and span fields. ([#14838](https://github.com/mastra-ai/mastra/pull/14838))
|
|
73
|
+
|
|
74
|
+
**Improved observability signal consistency**
|
|
75
|
+
Logs, metrics, scores, and feedback now carry `traceId` and `spanId` directly on each signal. Shared correlation metadata stays in `correlationContext`.
|
|
76
|
+
|
|
77
|
+
**Added clearer provenance fields**
|
|
78
|
+
Score and feedback payloads now support `scoreSource`, `feedbackSource`, and `executionSource` for clearer source tracking.
|
|
79
|
+
|
|
80
|
+
**Migration note**
|
|
81
|
+
Deprecated fields (like `source` and feedback `userId`) are still accepted for compatibility.
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- Update provider registry and model documentation with latest models and providers ([`dc514a8`](https://github.com/mastra-ai/mastra/commit/dc514a83dba5f719172dddfd2c7b858e4943d067))
|
|
86
|
+
|
|
87
|
+
- Persist observational memory threshold settings across restarts and restore per-thread overrides. ([#14788](https://github.com/mastra-ai/mastra/pull/14788))
|
|
88
|
+
|
|
89
|
+
- Fixed title generation blocking stream completion. The `generateTitle` LLM call now runs in the background instead of blocking the stream from closing, removing the 2-3 second post-response delay in the UI when memory is enabled. ([#14757](https://github.com/mastra-ai/mastra/pull/14757))
|
|
90
|
+
|
|
91
|
+
- feat(memory): add recall-tool history retrieval for agents using observational memory ([#14567](https://github.com/mastra-ai/mastra/pull/14567))
|
|
92
|
+
|
|
93
|
+
Agents that use observational memory can now use the `recall` tool to retrieve history from past conversations, including raw messages, thread listings, and indexed observation-group memories.
|
|
94
|
+
|
|
95
|
+
Enable observational-memory retrieval when listing tools:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
const tools = await memory.listTools({
|
|
99
|
+
threadId: 'thread_123',
|
|
100
|
+
resourceId: 'resource_abc',
|
|
101
|
+
observationalMemory: {
|
|
102
|
+
retrieval: { vector: true, scope: 'resource' },
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
With retrieval enabled, `recall` can browse the current thread, list threads for the current resource, and search indexed observation groups with source ranges.
|
|
108
|
+
|
|
109
|
+
- Added resolvedVersionId to agent run trace span attributes for tracking which agent version was used during execution. ([#14847](https://github.com/mastra-ai/mastra/pull/14847))
|
|
110
|
+
|
|
111
|
+
- Limit dynamically injected AGENTS.md reminders to 1000 estimated tokens by default and tell mastracode observational memory to ignore those ephemeral reminder messages. ([#14790](https://github.com/mastra-ai/mastra/pull/14790))
|
|
112
|
+
|
|
113
|
+
- Fixed missing `TRequestContext` type parameter on `DynamicArgument` fields in `AgentConfig`. Previously, only `instructions` and `tools` correctly propagated the `requestContextSchema` type to their dynamic function callbacks. Now all dynamic fields — `model`, `workflows`, `workspace`, `agents`, `memory`, `scorers`, `defaultGenerateOptionsLegacy`, `defaultStreamOptionsLegacy`, `defaultOptions`, `defaultNetworkOptions`, `inputProcessors`, and `outputProcessors` — properly type `requestContext` based on the agent's `requestContextSchema`. ([#14582](https://github.com/mastra-ai/mastra/pull/14582))
|
|
114
|
+
|
|
115
|
+
**Before:**
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
const agent = new Agent({
|
|
119
|
+
requestContextSchema: z.object({ userId: z.string() }),
|
|
120
|
+
workspace: ({ requestContext }) => {
|
|
121
|
+
requestContext.get('userId'); // typed as `unknown`
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**After:**
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
const agent = new Agent({
|
|
130
|
+
requestContextSchema: z.object({ userId: z.string() }),
|
|
131
|
+
workspace: ({ requestContext }) => {
|
|
132
|
+
requestContext.get('userId'); // typed as `string`
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
- Fixed resuming suspended tool calls with `resumeStream` or `approveToolCall` failing with a TripWire when input processors (e.g. TokenLimiterProcessor) are enabled on the agent. ([#14561](https://github.com/mastra-ai/mastra/pull/14561))
|
|
138
|
+
|
|
139
|
+
- Fixed `Harness.listThreads()` so callers can request threads across all resources. ([#14690](https://github.com/mastra-ai/mastra/pull/14690))
|
|
140
|
+
|
|
141
|
+
- Fixed agent run traces not appearing in Datadog and other observability backends when LLM calls fail. Previously, an API error during streaming would leave the root AGENT_RUN span open indefinitely, causing the entire trace tree to be silently dropped by exporters that wait for the root span to close. Failed agent runs now correctly end the span with error information, making failures visible in your observability dashboard. ([#14850](https://github.com/mastra-ai/mastra/pull/14850))
|
|
142
|
+
|
|
143
|
+
- Fixed streaming delegation to propagate output processor modifications to the supervisor. Previously, when a sub-agent had an output processor that modified text via `processOutputResult`, the supervisor received the raw LLM output instead of the processed text. The processed text was only saved to the sub-agent's memory. Now the supervisor correctly receives the output-processor-modified text from delegated sub-agents in the streaming path. ([#14731](https://github.com/mastra-ai/mastra/pull/14731))
|
|
144
|
+
|
|
145
|
+
- Fixed Harness `stateSchema` typing to accept Zod schemas with `.default()`, `.optional()`, and `.transform()` modifiers. Previously, these modifiers caused TypeScript errors because the type system forced schema Input and Output types to be identical. Now `stateSchema` correctly accepts any schema regardless of input type divergence. ([#14606](https://github.com/mastra-ai/mastra/pull/14606))
|
|
146
|
+
|
|
147
|
+
- Add `getReviewSummary()` to experiments storage for aggregating review status counts ([#14649](https://github.com/mastra-ai/mastra/pull/14649))
|
|
148
|
+
|
|
149
|
+
Query experiment results grouped by experiment ID, returning counts of `needs-review`, `reviewed`, and `complete` items in a single query instead of fetching all results client-side.
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
const summary = await storage.experiments.getReviewSummary();
|
|
153
|
+
// [{ experimentId: 'exp-1', needsReview: 3, reviewed: 5, complete: 2, total: 10 }, ...]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
- Fixed `mcpOptions` (including `serverless: true`) being silently ignored when using the Mastra deployer. The deployer now forwards `mcpOptions` from your server config to the underlying `MastraServer`, so MCP stateless mode works correctly in serverless environments like Cloudflare Workers, Vercel Edge, and AWS Lambda. ([#14810](https://github.com/mastra-ai/mastra/issues/14810)) ([#14812](https://github.com/mastra-ai/mastra/pull/14812))
|
|
157
|
+
|
|
158
|
+
**What changed:**
|
|
159
|
+
- Added `mcpOptions` to the `ServerConfig` type so it can be set in `new Mastra({ server: { ... } })`
|
|
160
|
+
- The deployer now passes `server.mcpOptions` through to `MastraServer`
|
|
161
|
+
|
|
162
|
+
**Example:**
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
const mastra = new Mastra({
|
|
166
|
+
server: {
|
|
167
|
+
mcpOptions: {
|
|
168
|
+
serverless: true,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
- Added `isValidationError` type guard for the `ValidationError` interface ([#14853](https://github.com/mastra-ai/mastra/pull/14853))
|
|
175
|
+
|
|
176
|
+
- Fixed models.dev provider URLs to interpolate environment variable placeholders like `${ACCOUNT_ID}` before creating the underlying provider client. ([#14722](https://github.com/mastra-ai/mastra/pull/14722))
|
|
177
|
+
|
|
178
|
+
- Fixed tool input validation failures not producing observability spans. When input schema validation failed, no TOOL_CALL span was created because span creation happened inside the execution function that ran after validation. Moved span creation before input validation so validation errors are now captured in spans and visible in observability backends like Datadog. ([#14677](https://github.com/mastra-ai/mastra/pull/14677))
|
|
179
|
+
|
|
180
|
+
- Fixed MODEL_GENERATION and AGENT_RUN spans not reflecting model, provider, parameters, and availableTools overrides from input processors. Traces in Langfuse and other exporters now show the correct model info when a processor dynamically switches models. ([#14705](https://github.com/mastra-ai/mastra/pull/14705))
|
|
181
|
+
|
|
182
|
+
- Fixed MODEL_GENERATION observability span to include all system messages (tagged and untagged). Previously, working memory and semantic recall instructions were missing from trace inputs because only untagged system messages were captured. ([#14800](https://github.com/mastra-ai/mastra/pull/14800))
|
|
183
|
+
|
|
184
|
+
- Fixed models.dev auth env selection to prefer auth credentials over URL path identifiers, so Cloudflare Workers AI no longer uses the account ID for authentication. ([#14687](https://github.com/mastra-ai/mastra/pull/14687))
|
|
185
|
+
|
|
186
|
+
- Fixed processInputStep always receiving an empty steps array. Processors can now inspect previous step results (tool calls, LLM responses) when running inside the agentic loop. ([#14821](https://github.com/mastra-ai/mastra/pull/14821))
|
|
187
|
+
|
|
188
|
+
- **Configurable weights**: Add `weights` option to `createTrajectoryScorerCode` for controlling how dimension scores are combined. Defaults to `{ accuracy: 0.4, efficiency: 0.3, toolFailures: 0.2, blacklist: 0.1 }`. ([#14740](https://github.com/mastra-ai/mastra/pull/14740))
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
const scorer = createTrajectoryScorerCode({
|
|
192
|
+
defaults: { steps: [{ name: 'search' }], maxSteps: 5 },
|
|
193
|
+
weights: { accuracy: 0.6, efficiency: 0.2, toolFailures: 0.1, blacklist: 0.1 },
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**ExpectedStep redesign**: `ExpectedStep` is now a discriminated union mirroring `TrajectoryStep`. When you specify a `stepType`, you get autocomplete for that variant's fields (e.g., `toolArgs` for `tool_call`, `modelId` for `model_generation`). The old `data: Record<string, unknown>` field is replaced by direct variant fields.
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
// Before: { name: 'search', stepType: 'tool_call', data: { input: { query: 'weather' } } }
|
|
201
|
+
// After:
|
|
202
|
+
{ name: 'search', stepType: 'tool_call', toolArgs: { query: 'weather' } }
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Remove `compareStepData`**: The `compareStepData` option is removed from `compareTrajectories`, `TrajectoryExpectation`, and all scorers. Data fields are now auto-compared when present on expected steps — if you specify `toolArgs` on an `ExpectedStep`, it will be compared against the actual step. If you omit it, only name and stepType are matched.
|
|
206
|
+
|
|
207
|
+
Also fixes documentation inaccuracies in `trajectory-accuracy.mdx` and `scorer-utils.mdx`.
|
|
208
|
+
|
|
209
|
+
## 1.18.0-alpha.5
|
|
210
|
+
|
|
211
|
+
### Minor Changes
|
|
212
|
+
|
|
213
|
+
- Added public score and feedback analytics APIs to observability storage: ([#14861](https://github.com/mastra-ai/mastra/pull/14861))
|
|
214
|
+
`getScoreAggregate` / `getFeedbackAggregate` for counts, sums, averages, minimums, maximums, or latest values;
|
|
215
|
+
`getScoreBreakdown` / `getFeedbackBreakdown` for grouped results by dimension;
|
|
216
|
+
`getScoreTimeSeries` / `getFeedbackTimeSeries` for time-bucketed trends;
|
|
217
|
+
and `getScorePercentiles` / `getFeedbackPercentiles` for percentile series such as p50 and p95.
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
await observability.getScoreTimeSeries({
|
|
221
|
+
scorerId: 'relevance',
|
|
222
|
+
interval: '1h',
|
|
223
|
+
aggregation: 'avg',
|
|
224
|
+
});
|
|
225
|
+
// returns time-bucketed average scores
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Patch Changes
|
|
229
|
+
|
|
230
|
+
- Added resolvedVersionId to agent run trace span attributes for tracking which agent version was used during execution. ([#14847](https://github.com/mastra-ai/mastra/pull/14847))
|
|
231
|
+
|
|
3
232
|
## 1.18.0-alpha.4
|
|
4
233
|
|
|
5
234
|
### Minor Changes
|