@mastra/core 0.22.0-alpha.1 → 0.22.1
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 +121 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,126 @@
|
|
|
1
1
|
# @mastra/core
|
|
2
2
|
|
|
3
|
+
## 0.22.1
|
|
4
|
+
|
|
5
|
+
## 0.22.1-alpha.0
|
|
6
|
+
|
|
7
|
+
## 0.22.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- Consolidate streamVNext logic into stream, move old stream function into streamLegacy ([#9092](https://github.com/mastra-ai/mastra/pull/9092))
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Update provider registry and model documentation with latest models and providers ([`c67ca32`](https://github.com/mastra-ai/mastra/commit/c67ca32e3c2cf69bfc146580770c720220ca44ac))
|
|
16
|
+
|
|
17
|
+
- Update provider registry and model documentation with latest models and providers ([`efb5ed9`](https://github.com/mastra-ai/mastra/commit/efb5ed946ae7f410bc68c9430beb4b010afd25ec))
|
|
18
|
+
|
|
19
|
+
- Add deprecation warnings for format:ai-sdk ([#9018](https://github.com/mastra-ai/mastra/pull/9018))
|
|
20
|
+
|
|
21
|
+
- network routing agent text delta ai-sdk streaming ([#8979](https://github.com/mastra-ai/mastra/pull/8979))
|
|
22
|
+
|
|
23
|
+
- Support writing custom top level stream chunks ([#8922](https://github.com/mastra-ai/mastra/pull/8922))
|
|
24
|
+
|
|
25
|
+
- Fix incorrect type assertions in Tool class. Created `MastraToolInvocationOptions` type to properly extend AI SDK's `ToolInvocationOptions` with Mastra-specific properties (`suspend`, `resumeData`, `writableStream`). Removed unsafe type assertions from tool execution code. ([#9033](https://github.com/mastra-ai/mastra/pull/9033))
|
|
26
|
+
|
|
27
|
+
- fix(core): Fix Gemini message ordering validation errors (#7287, #8053) ([#8069](https://github.com/mastra-ai/mastra/pull/8069))
|
|
28
|
+
|
|
29
|
+
Fixes Gemini API "single turn requests" validation error by ensuring the first non-system message is from the user role. This resolves errors when:
|
|
30
|
+
- Messages start with assistant role (e.g., from memory truncation)
|
|
31
|
+
- Tool-call sequences begin with assistant messages
|
|
32
|
+
|
|
33
|
+
**Breaking Change**: Empty or system-only message lists now throw an error instead of adding a placeholder user message, preventing confusing LLM responses.
|
|
34
|
+
|
|
35
|
+
This fix handles both issue #7287 (tool-call ordering) and #8053 (single-turn validation) by inserting a placeholder user message when needed.
|
|
36
|
+
|
|
37
|
+
- Add support for external trace and parent span IDs in TracingOptions. This enables integration with external tracing systems by allowing new AI traces to be started with existing traceId and parentSpanId values. The implementation includes OpenTelemetry-compatible ID validation (32 hex chars for trace IDs, 16 hex chars for span IDs). ([#9053](https://github.com/mastra-ai/mastra/pull/9053))
|
|
38
|
+
|
|
39
|
+
- Updated `watch` and `watchAsync` methods to use proper function overloads instead of generic conditional types, ensuring compatibility with the base Run class signatures. ([#9048](https://github.com/mastra-ai/mastra/pull/9048))
|
|
40
|
+
|
|
41
|
+
- Fix tracing context propagation to agent steps in workflows ([#9074](https://github.com/mastra-ai/mastra/pull/9074))
|
|
42
|
+
|
|
43
|
+
When creating a workflow step from an agent using `createStep(myAgent)`, the tracing context was not being passed to the agent's `stream()` and `streamLegacy()` methods. This caused tracing spans to break in the workflow chain.
|
|
44
|
+
|
|
45
|
+
This fix ensures that `tracingContext` is properly propagated to both agent.stream() and agent.streamLegacy() calls, matching the behavior of tool steps which already propagate tracingContext correctly.
|
|
46
|
+
|
|
47
|
+
- Fixes how reasoning chunks are stored in memory to prevent data loss and ensure they are consolidated as single message parts rather than split into word-level fragments. ([#9041](https://github.com/mastra-ai/mastra/pull/9041))
|
|
48
|
+
|
|
49
|
+
- fixes an issue where input processors couldn't add system or assistant messages. Previously all messages from input processors were forced to be user messages, causing an error when trying to add other role types. ([#8835](https://github.com/mastra-ai/mastra/pull/8835))
|
|
50
|
+
|
|
51
|
+
- fix(core): Validate structured output at text-end instead of flush ([#8934](https://github.com/mastra-ai/mastra/pull/8934))
|
|
52
|
+
|
|
53
|
+
Fixes structured output validation for Bedrock and LMStudio by moving validation from `flush()` to `text-end` chunk. Eliminates `finishReason` heuristics, adds special token extraction for LMStudio, and validates at the correct point in stream lifecycle.
|
|
54
|
+
|
|
55
|
+
- fix model.loop.test.ts tests to use structuredOutput.schema and add assertions ([#8926](https://github.com/mastra-ai/mastra/pull/8926))
|
|
56
|
+
|
|
57
|
+
- Add `initialState` as an option to `.streamVNext()` ([#9071](https://github.com/mastra-ai/mastra/pull/9071))
|
|
58
|
+
|
|
59
|
+
- added resourceId and runId to workflow_run metadata in ai tracing ([#9031](https://github.com/mastra-ai/mastra/pull/9031))
|
|
60
|
+
|
|
61
|
+
- When using OpenAI models with JSON response format, automatically enable strict schema validation. ([#8924](https://github.com/mastra-ai/mastra/pull/8924))
|
|
62
|
+
|
|
63
|
+
- Fix custom metadata preservation in UIMessages when loading threads. The `getMessagesHandler` now converts `messagesV2` (V2 format with metadata) instead of `messages` (V1 format without metadata) to AIV5.UI format. Also updates the abstract `MastraMemory.query()` return type to include `messagesV2` for proper type safety. ([#9029](https://github.com/mastra-ai/mastra/pull/9029))
|
|
64
|
+
|
|
65
|
+
- Fix TypeScript type errors when using provider-defined tools from external AI SDK packages. ([#8940](https://github.com/mastra-ai/mastra/pull/8940))
|
|
66
|
+
|
|
67
|
+
Agents can now accept provider tools like `google.tools.googleSearch()` without type errors. Creates new `@internal/external-types` package to centralize AI SDK type re-exports and adds `ProviderDefinedTool` structural type to handle tools from different package versions/instances due to TypeScript's module path discrimination.
|
|
68
|
+
|
|
69
|
+
- feat(ai-tracing): Add automatic metadata extraction from RuntimeContext to spans ([#9072](https://github.com/mastra-ai/mastra/pull/9072))
|
|
70
|
+
|
|
71
|
+
Enables automatic extraction of RuntimeContext values as metadata for AI tracing spans across entire traces.
|
|
72
|
+
|
|
73
|
+
Key features:
|
|
74
|
+
- Configure `runtimeContextKeys` in TracingConfig to extract specific keys from RuntimeContext
|
|
75
|
+
- Add per-request keys via `tracingOptions.runtimeContextKeys` for trace-specific additions
|
|
76
|
+
- Supports dot notation for nested values (e.g., 'user.id', 'session.data.experimentId')
|
|
77
|
+
- TraceState computed once at root span and inherited by all child spans
|
|
78
|
+
- Explicit metadata in span options takes precedence over extracted metadata
|
|
79
|
+
|
|
80
|
+
Example:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
const mastra = new Mastra({
|
|
84
|
+
observability: {
|
|
85
|
+
configs: {
|
|
86
|
+
default: {
|
|
87
|
+
runtimeContextKeys: ['userId', 'environment', 'tenantId'],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
await agent.generate({
|
|
94
|
+
messages,
|
|
95
|
+
runtimeContext,
|
|
96
|
+
tracingOptions: {
|
|
97
|
+
runtimeContextKeys: ['experimentId'], // Adds to configured keys
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
- Fix provider tools for popular providers and add support for anthropic/claude skills. ([#9038](https://github.com/mastra-ai/mastra/pull/9038))
|
|
103
|
+
|
|
104
|
+
- Refactor workflowstream into workflow output with fullStream property ([#9048](https://github.com/mastra-ai/mastra/pull/9048))
|
|
105
|
+
|
|
106
|
+
- Added the ability to use model router configs for embedders (eg "openai/text-embedding-ada-002") ([#8992](https://github.com/mastra-ai/mastra/pull/8992))
|
|
107
|
+
|
|
108
|
+
- Always set supportsStructuredOutputs true for openai compatible provider. ([#8933](https://github.com/mastra-ai/mastra/pull/8933))
|
|
109
|
+
|
|
110
|
+
- Support for custom resume labels mapping to step to be resumed ([#8941](https://github.com/mastra-ai/mastra/pull/8941))
|
|
111
|
+
|
|
112
|
+
- added tracing of LLM steps & chunks ([#9058](https://github.com/mastra-ai/mastra/pull/9058))
|
|
113
|
+
|
|
114
|
+
- Fixed an issue where a custom URL in model router still validated unknown providers against the known providers list. Custom URL means we don't necessarily know the provider. This allows local providers like Ollama to work properly ([#8989](https://github.com/mastra-ai/mastra/pull/8989))
|
|
115
|
+
|
|
116
|
+
- Show agent tool output better in playground ([#9021](https://github.com/mastra-ai/mastra/pull/9021))
|
|
117
|
+
|
|
118
|
+
- feat: inject schema context into main agent for processor mode structured output ([#8886](https://github.com/mastra-ai/mastra/pull/8886))
|
|
119
|
+
|
|
120
|
+
- Added providerOptions types to generate/stream for main builtin model router providers (openai/anthropic/google/xai) ([#8995](https://github.com/mastra-ai/mastra/pull/8995))
|
|
121
|
+
|
|
122
|
+
- Generate a title for Agent.network() threads ([#8853](https://github.com/mastra-ai/mastra/pull/8853))
|
|
123
|
+
|
|
3
124
|
## 0.22.0-alpha.1
|
|
4
125
|
|
|
5
126
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -245,9 +245,9 @@
|
|
|
245
245
|
"typescript": "^5.8.3",
|
|
246
246
|
"vitest": "^3.2.4",
|
|
247
247
|
"zod": "^3.25.76",
|
|
248
|
-
"@internal/lint": "0.0.
|
|
249
|
-
"@internal/external-types": "0.0.
|
|
250
|
-
"@internal/types-builder": "0.0.
|
|
248
|
+
"@internal/lint": "0.0.52",
|
|
249
|
+
"@internal/external-types": "0.0.2",
|
|
250
|
+
"@internal/types-builder": "0.0.27"
|
|
251
251
|
},
|
|
252
252
|
"engines": {
|
|
253
253
|
"node": ">=20"
|