@mastra/core 1.18.0-alpha.5 → 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 +206 -0
- package/dist/agent/index.cjs +8 -8
- package/dist/agent/index.js +1 -1
- package/dist/{chunk-XC6ZFHUA.cjs → chunk-2H53MD2U.cjs} +48 -48
- package/dist/{chunk-XC6ZFHUA.cjs.map → chunk-2H53MD2U.cjs.map} +1 -1
- package/dist/{chunk-5LA5TY63.js → chunk-2M3HWTRI.js} +4 -4
- package/dist/{chunk-5LA5TY63.js.map → chunk-2M3HWTRI.js.map} +1 -1
- package/dist/{chunk-WNI6ACXE.js → chunk-6Z4GSLLO.js} +3 -3
- package/dist/{chunk-WNI6ACXE.js.map → chunk-6Z4GSLLO.js.map} +1 -1
- package/dist/{chunk-DBHNKGT2.js → chunk-7GLVV6CZ.js} +3 -3
- package/dist/{chunk-DBHNKGT2.js.map → chunk-7GLVV6CZ.js.map} +1 -1
- package/dist/{chunk-YIBYKN6M.js → chunk-EKFG6JWW.js} +6 -6
- package/dist/{chunk-YIBYKN6M.js.map → chunk-EKFG6JWW.js.map} +1 -1
- package/dist/{chunk-W4I7AX2S.js → chunk-GJ62FP5X.js} +4 -4
- package/dist/{chunk-W4I7AX2S.js.map → chunk-GJ62FP5X.js.map} +1 -1
- package/dist/{chunk-INENOZKZ.cjs → chunk-GJIN53S6.cjs} +9 -9
- package/dist/{chunk-INENOZKZ.cjs.map → chunk-GJIN53S6.cjs.map} +1 -1
- package/dist/{chunk-W6QY3O3X.js → chunk-I4ZSA3XJ.js} +4 -4
- package/dist/{chunk-W6QY3O3X.js.map → chunk-I4ZSA3XJ.js.map} +1 -1
- package/dist/{chunk-KCRQQDEF.cjs → chunk-J47RNLSY.cjs} +12 -12
- package/dist/{chunk-KCRQQDEF.cjs.map → chunk-J47RNLSY.cjs.map} +1 -1
- package/dist/{chunk-XNWKYVLQ.cjs → chunk-KLVNQDUR.cjs} +3 -3
- package/dist/chunk-KLVNQDUR.cjs.map +1 -0
- package/dist/{chunk-JVL4ANDA.cjs → chunk-KOTSKPTF.cjs} +5 -5
- package/dist/{chunk-JVL4ANDA.cjs.map → chunk-KOTSKPTF.cjs.map} +1 -1
- package/dist/{chunk-BZUTYPXP.cjs → chunk-L3X22YTN.cjs} +185 -185
- package/dist/{chunk-BZUTYPXP.cjs.map → chunk-L3X22YTN.cjs.map} +1 -1
- package/dist/{chunk-JWE3L5J2.cjs → chunk-PWFPYJGG.cjs} +15 -15
- package/dist/{chunk-JWE3L5J2.cjs.map → chunk-PWFPYJGG.cjs.map} +1 -1
- package/dist/{chunk-AYVJ4EXL.js → chunk-RTBZOGTO.js} +3 -3
- package/dist/{chunk-AYVJ4EXL.js.map → chunk-RTBZOGTO.js.map} +1 -1
- package/dist/{chunk-7456ZWIM.cjs → chunk-RTXCZT3M.cjs} +5 -5
- package/dist/{chunk-7456ZWIM.cjs.map → chunk-RTXCZT3M.cjs.map} +1 -1
- package/dist/{chunk-XRW4AYLH.cjs → chunk-TVZCMQTV.cjs} +75 -75
- package/dist/{chunk-XRW4AYLH.cjs.map → chunk-TVZCMQTV.cjs.map} +1 -1
- package/dist/{chunk-IM6BRUQI.js → chunk-UPBMT3QM.js} +8 -8
- package/dist/{chunk-IM6BRUQI.js.map → chunk-UPBMT3QM.js.map} +1 -1
- package/dist/{chunk-27EVOYQC.js → chunk-XOBRMYFA.js} +3 -3
- package/dist/chunk-XOBRMYFA.js.map +1 -0
- package/dist/{chunk-7IKOVR4F.js → chunk-XQN3BKCI.js} +3 -3
- package/dist/{chunk-7IKOVR4F.js.map → chunk-XQN3BKCI.js.map} +1 -1
- package/dist/{chunk-BL7DAQXE.cjs → chunk-ZQE2VUYD.cjs} +7 -7
- package/dist/{chunk-BL7DAQXE.cjs.map → chunk-ZQE2VUYD.cjs.map} +1 -1
- package/dist/{chunk-3CTQJRNS.js → chunk-ZRLAR66M.js} +3 -3
- package/dist/{chunk-3CTQJRNS.js.map → chunk-ZRLAR66M.js.map} +1 -1
- package/dist/{chunk-H3DHOME4.cjs → chunk-ZVGS2O2W.cjs} +6 -6
- package/dist/{chunk-H3DHOME4.cjs.map → chunk-ZVGS2O2W.cjs.map} +1 -1
- package/dist/datasets/index.cjs +11 -11
- package/dist/datasets/index.js +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +121 -121
- package/dist/evals/index.cjs +5 -5
- package/dist/evals/index.js +2 -2
- package/dist/evals/scoreTraces/index.cjs +3 -3
- package/dist/evals/scoreTraces/index.js +1 -1
- 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-5X6CFNIO.cjs.map → models-dev-5WY37RVC.cjs.map} +1 -1
- package/dist/models-dev-Y2UFJEOO.js +3 -0
- package/dist/{models-dev-NFYFNV6D.js.map → models-dev-Y2UFJEOO.js.map} +1 -1
- package/dist/netlify-ADZQ5ZNY.cjs +12 -0
- package/dist/{netlify-MZJ7FN5B.cjs.map → netlify-ADZQ5ZNY.cjs.map} +1 -1
- package/dist/netlify-I4AUVRO2.js +3 -0
- package/dist/{netlify-EYSCS3HJ.js.map → netlify-I4AUVRO2.js.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-ODJKK7NU.js.map → provider-registry-C7SZ5ZT4.js.map} +1 -1
- package/dist/provider-registry-I5RW3MEE.cjs +40 -0
- package/dist/{provider-registry-YGVNXVGE.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/stream/index.cjs +8 -8
- package/dist/stream/index.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/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-27EVOYQC.js.map +0 -1
- package/dist/chunk-XNWKYVLQ.cjs.map +0 -1
- package/dist/models-dev-5X6CFNIO.cjs +0 -12
- package/dist/models-dev-NFYFNV6D.js +0 -3
- package/dist/netlify-EYSCS3HJ.js +0 -3
- package/dist/netlify-MZJ7FN5B.cjs +0 -12
- package/dist/provider-registry-ODJKK7NU.js +0 -3
- package/dist/provider-registry-YGVNXVGE.cjs +0 -40
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,211 @@
|
|
|
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
|
+
|
|
3
209
|
## 1.18.0-alpha.5
|
|
4
210
|
|
|
5
211
|
### Minor Changes
|
package/dist/agent/index.cjs
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJ47RNLSY_cjs = require('../chunk-J47RNLSY.cjs');
|
|
4
4
|
var chunkANLO4VM2_cjs = require('../chunk-ANLO4VM2.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "Agent", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkJ47RNLSY_cjs.Agent; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "TripWire", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkJ47RNLSY_cjs.TripWire; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "isSupportedLanguageModel", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkJ47RNLSY_cjs.isSupportedLanguageModel; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "resolveThreadIdFromArgs", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkJ47RNLSY_cjs.resolveThreadIdFromArgs; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "supportedLanguageModelSpecifications", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkJ47RNLSY_cjs.supportedLanguageModelSpecifications; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "tryGenerateWithJsonFallback", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkJ47RNLSY_cjs.tryGenerateWithJsonFallback; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "tryStreamWithJsonFallback", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkJ47RNLSY_cjs.tryStreamWithJsonFallback; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "MessageList", {
|
|
37
37
|
enumerable: true,
|
package/dist/agent/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Agent, TripWire, isSupportedLanguageModel, resolveThreadIdFromArgs, supportedLanguageModelSpecifications, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '../chunk-
|
|
1
|
+
export { Agent, TripWire, isSupportedLanguageModel, resolveThreadIdFromArgs, supportedLanguageModelSpecifications, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '../chunk-ZRLAR66M.js';
|
|
2
2
|
export { MessageList, TypeDetector, aiV5ModelMessageToV2PromptMessage, convertMessages } from '../chunk-SLZ3WO42.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJ47RNLSY_cjs = require('./chunk-J47RNLSY.cjs');
|
|
4
4
|
var chunkZCBG4ZQT_cjs = require('./chunk-ZCBG4ZQT.cjs');
|
|
5
5
|
var chunkV2NQOABM_cjs = require('./chunk-V2NQOABM.cjs');
|
|
6
6
|
var chunkANLO4VM2_cjs = require('./chunk-ANLO4VM2.cjs');
|
|
@@ -60,7 +60,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
60
60
|
let suspended;
|
|
61
61
|
let bailed;
|
|
62
62
|
const startedAt = Date.now();
|
|
63
|
-
const { inputData, validationError } = await
|
|
63
|
+
const { inputData, validationError } = await chunkJ47RNLSY_cjs.validateStepInput({
|
|
64
64
|
prevOutput: typeof params.foreachIdx === "number" ? params.input?.[params.foreachIdx] : params.input,
|
|
65
65
|
step,
|
|
66
66
|
validateInputs: params.validateInputs ?? true
|
|
@@ -93,7 +93,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
93
93
|
const stepOutput = await chunkBF7IH4JU_cjs.executeWithContext({
|
|
94
94
|
span: params.tracingContext?.currentSpan,
|
|
95
95
|
fn: () => step.execute(
|
|
96
|
-
|
|
96
|
+
chunkJ47RNLSY_cjs.createDeprecationProxy(
|
|
97
97
|
{
|
|
98
98
|
workflowId: params.workflowId,
|
|
99
99
|
runId,
|
|
@@ -108,9 +108,9 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
108
108
|
resumeData: params.resumeData,
|
|
109
109
|
suspendData: suspendDataToUse,
|
|
110
110
|
getInitData: () => stepResults?.input,
|
|
111
|
-
getStepResult:
|
|
111
|
+
getStepResult: chunkJ47RNLSY_cjs.getStepResult.bind(this, stepResults),
|
|
112
112
|
suspend: async (suspendPayload, suspendOptions) => {
|
|
113
|
-
const { suspendData, validationError: validationError2 } = await
|
|
113
|
+
const { suspendData, validationError: validationError2 } = await chunkJ47RNLSY_cjs.validateStepSuspendData({
|
|
114
114
|
suspendData: suspendPayload,
|
|
115
115
|
step,
|
|
116
116
|
validateInputs: params.validateInputs ?? true
|
|
@@ -163,7 +163,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
paramName: "runCount",
|
|
166
|
-
deprecationMessage:
|
|
166
|
+
deprecationMessage: chunkJ47RNLSY_cjs.runCountDeprecationMessage,
|
|
167
167
|
logger: this.logger
|
|
168
168
|
}
|
|
169
169
|
)
|
|
@@ -236,7 +236,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
236
236
|
// Preserve TripWire data as plain object for proper serialization
|
|
237
237
|
// Important: Check `error` not `errorInstance` because getErrorFromUnknown
|
|
238
238
|
// converts the error and loses the prototype chain
|
|
239
|
-
tripwire: error instanceof
|
|
239
|
+
tripwire: error instanceof chunkJ47RNLSY_cjs.TripWire ? {
|
|
240
240
|
reason: error.message,
|
|
241
241
|
retry: error.options?.retry,
|
|
242
242
|
metadata: error.options?.metadata,
|
|
@@ -294,7 +294,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
294
294
|
const callId = crypto.randomUUID();
|
|
295
295
|
const outputWriter = this.createOutputWriter(runId);
|
|
296
296
|
return condition(
|
|
297
|
-
|
|
297
|
+
chunkJ47RNLSY_cjs.createDeprecationProxy(
|
|
298
298
|
{
|
|
299
299
|
workflowId,
|
|
300
300
|
runId,
|
|
@@ -305,7 +305,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
305
305
|
retryCount,
|
|
306
306
|
resumeData,
|
|
307
307
|
getInitData: () => stepResults?.input,
|
|
308
|
-
getStepResult:
|
|
308
|
+
getStepResult: chunkJ47RNLSY_cjs.getStepResult.bind(this, stepResults),
|
|
309
309
|
bail: (_result) => {
|
|
310
310
|
throw new Error("Not implemented");
|
|
311
311
|
},
|
|
@@ -332,7 +332,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
332
332
|
},
|
|
333
333
|
{
|
|
334
334
|
paramName: "runCount",
|
|
335
|
-
deprecationMessage:
|
|
335
|
+
deprecationMessage: chunkJ47RNLSY_cjs.runCountDeprecationMessage,
|
|
336
336
|
logger: this.logger
|
|
337
337
|
}
|
|
338
338
|
)
|
|
@@ -352,7 +352,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
352
352
|
const callId = crypto.randomUUID();
|
|
353
353
|
const outputWriter = this.createOutputWriter(runId);
|
|
354
354
|
return await step.fn(
|
|
355
|
-
|
|
355
|
+
chunkJ47RNLSY_cjs.createDeprecationProxy(
|
|
356
356
|
{
|
|
357
357
|
workflowId: params.workflowId,
|
|
358
358
|
runId,
|
|
@@ -366,7 +366,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
366
366
|
retryCount,
|
|
367
367
|
resumeData: params.resumeData,
|
|
368
368
|
getInitData: () => stepResults?.input,
|
|
369
|
-
getStepResult:
|
|
369
|
+
getStepResult: chunkJ47RNLSY_cjs.getStepResult.bind(this, stepResults),
|
|
370
370
|
suspend: async (_suspendPayload) => {
|
|
371
371
|
throw new Error("Not implemented");
|
|
372
372
|
},
|
|
@@ -395,7 +395,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
395
395
|
},
|
|
396
396
|
{
|
|
397
397
|
paramName: "runCount",
|
|
398
|
-
deprecationMessage:
|
|
398
|
+
deprecationMessage: chunkJ47RNLSY_cjs.runCountDeprecationMessage,
|
|
399
399
|
logger: this.logger
|
|
400
400
|
}
|
|
401
401
|
)
|
|
@@ -419,7 +419,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
419
419
|
const callId = crypto.randomUUID();
|
|
420
420
|
const outputWriter = this.createOutputWriter(runId);
|
|
421
421
|
const result = await step.fn(
|
|
422
|
-
|
|
422
|
+
chunkJ47RNLSY_cjs.createDeprecationProxy(
|
|
423
423
|
{
|
|
424
424
|
workflowId: params.workflowId,
|
|
425
425
|
runId,
|
|
@@ -433,7 +433,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
433
433
|
retryCount,
|
|
434
434
|
resumeData: params.resumeData,
|
|
435
435
|
getInitData: () => stepResults?.input,
|
|
436
|
-
getStepResult:
|
|
436
|
+
getStepResult: chunkJ47RNLSY_cjs.getStepResult.bind(this, stepResults),
|
|
437
437
|
suspend: async (_suspendPayload) => {
|
|
438
438
|
throw new Error("Not implemented");
|
|
439
439
|
},
|
|
@@ -462,7 +462,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
462
462
|
},
|
|
463
463
|
{
|
|
464
464
|
paramName: "runCount",
|
|
465
|
-
deprecationMessage:
|
|
465
|
+
deprecationMessage: chunkJ47RNLSY_cjs.runCountDeprecationMessage,
|
|
466
466
|
logger: this.logger
|
|
467
467
|
}
|
|
468
468
|
)
|
|
@@ -481,7 +481,7 @@ function isTripwireChunk(chunk) {
|
|
|
481
481
|
}
|
|
482
482
|
function createTripWireFromChunk(chunk) {
|
|
483
483
|
const { payload } = chunk;
|
|
484
|
-
return new
|
|
484
|
+
return new chunkJ47RNLSY_cjs.TripWire(
|
|
485
485
|
payload.reason || "Agent tripwire triggered",
|
|
486
486
|
{
|
|
487
487
|
retry: payload.retry,
|
|
@@ -2100,7 +2100,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
2100
2100
|
runId
|
|
2101
2101
|
}) ?? { context: {} };
|
|
2102
2102
|
const nestedWorkflow = step.step;
|
|
2103
|
-
const timeTravelParams =
|
|
2103
|
+
const timeTravelParams = chunkJ47RNLSY_cjs.createTimeTravelExecutionParams({
|
|
2104
2104
|
steps: timeTravel.steps.slice(1),
|
|
2105
2105
|
inputData: timeTravel.inputData,
|
|
2106
2106
|
resumeData: timeTravel.resumeData,
|
|
@@ -2200,7 +2200,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
2200
2200
|
for (const [key, value] of Object.entries(requestContext)) {
|
|
2201
2201
|
rc.set(key, value);
|
|
2202
2202
|
}
|
|
2203
|
-
const { resumeData: timeTravelResumeData, validationError: timeTravelResumeValidationError } = await
|
|
2203
|
+
const { resumeData: timeTravelResumeData, validationError: timeTravelResumeValidationError } = await chunkJ47RNLSY_cjs.validateStepResumeData({
|
|
2204
2204
|
resumeData: timeTravel?.stepResults[step.step.id]?.status === "suspended" ? timeTravel?.resumeData : void 0,
|
|
2205
2205
|
step: step.step
|
|
2206
2206
|
});
|
|
@@ -3021,7 +3021,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
3021
3021
|
|
|
3022
3022
|
// src/workflows/evented/workflow.ts
|
|
3023
3023
|
function cloneWorkflow(workflow, opts) {
|
|
3024
|
-
const wf = new
|
|
3024
|
+
const wf = new chunkJ47RNLSY_cjs.Workflow({
|
|
3025
3025
|
id: opts.id,
|
|
3026
3026
|
inputSchema: workflow.inputSchema,
|
|
3027
3027
|
outputSchema: workflow.outputSchema,
|
|
@@ -3050,16 +3050,16 @@ function cloneStep(step, opts) {
|
|
|
3050
3050
|
};
|
|
3051
3051
|
}
|
|
3052
3052
|
function isAgent(input) {
|
|
3053
|
-
return input instanceof
|
|
3053
|
+
return input instanceof chunkJ47RNLSY_cjs.Agent;
|
|
3054
3054
|
}
|
|
3055
3055
|
function isToolStep(input) {
|
|
3056
3056
|
return input instanceof chunkAV4YSAZL_cjs.Tool;
|
|
3057
3057
|
}
|
|
3058
3058
|
function isStepParams(input) {
|
|
3059
|
-
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof
|
|
3059
|
+
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof chunkJ47RNLSY_cjs.Agent) && !(input instanceof chunkAV4YSAZL_cjs.Tool);
|
|
3060
3060
|
}
|
|
3061
3061
|
function isProcessor(obj) {
|
|
3062
|
-
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof
|
|
3062
|
+
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof chunkJ47RNLSY_cjs.Agent) && !(obj instanceof chunkAV4YSAZL_cjs.Tool) && (typeof obj.processInput === "function" || typeof obj.processInputStep === "function" || typeof obj.processOutputStream === "function" || typeof obj.processOutputResult === "function" || typeof obj.processOutputStep === "function");
|
|
3063
3063
|
}
|
|
3064
3064
|
function createStep(params, agentOrToolOptions) {
|
|
3065
3065
|
if (isAgent(params)) {
|
|
@@ -3124,7 +3124,7 @@ async function processAgentStream(params) {
|
|
|
3124
3124
|
}
|
|
3125
3125
|
}
|
|
3126
3126
|
if (streamFormat !== "legacy") {
|
|
3127
|
-
await
|
|
3127
|
+
await chunkJ47RNLSY_cjs.forwardAgentStreamChunk({ writer, chunk });
|
|
3128
3128
|
}
|
|
3129
3129
|
}
|
|
3130
3130
|
try {
|
|
@@ -3182,7 +3182,7 @@ function createStepFromAgent(params, agentOrToolOptions) {
|
|
|
3182
3182
|
};
|
|
3183
3183
|
const llm = await params.getLLM({ requestContext });
|
|
3184
3184
|
const modelInfo = llm.getModel();
|
|
3185
|
-
const isV2Model =
|
|
3185
|
+
const isV2Model = chunkJ47RNLSY_cjs.isSupportedLanguageModel(modelInfo);
|
|
3186
3186
|
let structuredResult = null;
|
|
3187
3187
|
const handleFinish = (result) => {
|
|
3188
3188
|
const resultWithObject = result;
|
|
@@ -3349,8 +3349,8 @@ function createStepFromProcessor(processor) {
|
|
|
3349
3349
|
return {
|
|
3350
3350
|
id: `processor:${processor.id}`,
|
|
3351
3351
|
description: processor.name ?? `Processor ${processor.id}`,
|
|
3352
|
-
inputSchema: chunkXB4FLS7A_cjs.toStandardSchema(
|
|
3353
|
-
outputSchema: chunkXB4FLS7A_cjs.toStandardSchema(
|
|
3352
|
+
inputSchema: chunkXB4FLS7A_cjs.toStandardSchema(chunkJ47RNLSY_cjs.ProcessorStepSchema),
|
|
3353
|
+
outputSchema: chunkXB4FLS7A_cjs.toStandardSchema(chunkJ47RNLSY_cjs.ProcessorStepOutputSchema),
|
|
3354
3354
|
execute: async ({ inputData, requestContext, ...obsFields }) => {
|
|
3355
3355
|
const observabilityContext = chunkBF7IH4JU_cjs.resolveObservabilityContext(obsFields);
|
|
3356
3356
|
const input = inputData;
|
|
@@ -3385,7 +3385,7 @@ function createStepFromProcessor(processor) {
|
|
|
3385
3385
|
abortSignal
|
|
3386
3386
|
} = input;
|
|
3387
3387
|
const abort = (reason, options) => {
|
|
3388
|
-
throw new
|
|
3388
|
+
throw new chunkJ47RNLSY_cjs.TripWire(reason || `Tripwire triggered by ${processor.id}`, options, processor.id);
|
|
3389
3389
|
};
|
|
3390
3390
|
let currentMessageId = messageId;
|
|
3391
3391
|
const rotateCurrentResponseMessageId = rotateResponseMessageId ? () => {
|
|
@@ -3417,7 +3417,7 @@ function createStepFromProcessor(processor) {
|
|
|
3417
3417
|
if (processorStates) {
|
|
3418
3418
|
let ps = processorStates.get(processor.id);
|
|
3419
3419
|
if (!ps) {
|
|
3420
|
-
ps = new
|
|
3420
|
+
ps = new chunkJ47RNLSY_cjs.ProcessorState();
|
|
3421
3421
|
processorStates.set(processor.id, ps);
|
|
3422
3422
|
}
|
|
3423
3423
|
processorState = ps.customState;
|
|
@@ -3466,7 +3466,7 @@ function createStepFromProcessor(processor) {
|
|
|
3466
3466
|
processorSpan?.end({ output: result });
|
|
3467
3467
|
return result;
|
|
3468
3468
|
} catch (error) {
|
|
3469
|
-
if (error instanceof
|
|
3469
|
+
if (error instanceof chunkJ47RNLSY_cjs.TripWire) {
|
|
3470
3470
|
processorSpan?.end({ output: { tripwire: error.message } });
|
|
3471
3471
|
} else {
|
|
3472
3472
|
processorSpan?.error({ error, endSpan: true });
|
|
@@ -3509,7 +3509,7 @@ function createStepFromProcessor(processor) {
|
|
|
3509
3509
|
systemMessages: result.getAllSystemMessages()
|
|
3510
3510
|
};
|
|
3511
3511
|
} else if (Array.isArray(result)) {
|
|
3512
|
-
|
|
3512
|
+
chunkJ47RNLSY_cjs.ProcessorRunner.applyMessagesToMessageList(
|
|
3513
3513
|
result,
|
|
3514
3514
|
passThrough.messageList,
|
|
3515
3515
|
idsBeforeProcessing,
|
|
@@ -3519,7 +3519,7 @@ function createStepFromProcessor(processor) {
|
|
|
3519
3519
|
return { ...passThrough, messages: result };
|
|
3520
3520
|
} else if (result && "messages" in result && "systemMessages" in result) {
|
|
3521
3521
|
const typedResult = result;
|
|
3522
|
-
|
|
3522
|
+
chunkJ47RNLSY_cjs.ProcessorRunner.applyMessagesToMessageList(
|
|
3523
3523
|
typedResult.messages,
|
|
3524
3524
|
passThrough.messageList,
|
|
3525
3525
|
idsBeforeProcessing,
|
|
@@ -3567,13 +3567,13 @@ function createStepFromProcessor(processor) {
|
|
|
3567
3567
|
messageId: currentMessageId,
|
|
3568
3568
|
rotateResponseMessageId: rotateCurrentResponseMessageId
|
|
3569
3569
|
});
|
|
3570
|
-
const validatedResult = await
|
|
3570
|
+
const validatedResult = await chunkJ47RNLSY_cjs.ProcessorRunner.validateAndFormatProcessInputStepResult(result, {
|
|
3571
3571
|
messageList: passThrough.messageList,
|
|
3572
3572
|
processor,
|
|
3573
3573
|
stepNumber: stepNumber ?? 0
|
|
3574
3574
|
});
|
|
3575
3575
|
if (validatedResult.messages) {
|
|
3576
|
-
|
|
3576
|
+
chunkJ47RNLSY_cjs.ProcessorRunner.applyMessagesToMessageList(
|
|
3577
3577
|
validatedResult.messages,
|
|
3578
3578
|
passThrough.messageList,
|
|
3579
3579
|
idsBeforeProcessing,
|
|
@@ -3638,7 +3638,7 @@ function createStepFromProcessor(processor) {
|
|
|
3638
3638
|
delete mutableState[spanKey];
|
|
3639
3639
|
}
|
|
3640
3640
|
} catch (error) {
|
|
3641
|
-
if (error instanceof
|
|
3641
|
+
if (error instanceof chunkJ47RNLSY_cjs.TripWire) {
|
|
3642
3642
|
processorSpan2?.end({ output: { tripwire: error.message } });
|
|
3643
3643
|
} else {
|
|
3644
3644
|
processorSpan2?.error({ error, endSpan: true });
|
|
@@ -3689,7 +3689,7 @@ function createStepFromProcessor(processor) {
|
|
|
3689
3689
|
systemMessages: result.getAllSystemMessages()
|
|
3690
3690
|
};
|
|
3691
3691
|
} else if (Array.isArray(result)) {
|
|
3692
|
-
|
|
3692
|
+
chunkJ47RNLSY_cjs.ProcessorRunner.applyMessagesToMessageList(
|
|
3693
3693
|
result,
|
|
3694
3694
|
passThrough.messageList,
|
|
3695
3695
|
idsBeforeProcessing,
|
|
@@ -3699,7 +3699,7 @@ function createStepFromProcessor(processor) {
|
|
|
3699
3699
|
return { ...passThrough, messages: result };
|
|
3700
3700
|
} else if (result && "messages" in result && "systemMessages" in result) {
|
|
3701
3701
|
const typedResult = result;
|
|
3702
|
-
|
|
3702
|
+
chunkJ47RNLSY_cjs.ProcessorRunner.applyMessagesToMessageList(
|
|
3703
3703
|
typedResult.messages,
|
|
3704
3704
|
passThrough.messageList,
|
|
3705
3705
|
idsBeforeProcessing,
|
|
@@ -3755,7 +3755,7 @@ function createStepFromProcessor(processor) {
|
|
|
3755
3755
|
systemMessages: result.getAllSystemMessages()
|
|
3756
3756
|
};
|
|
3757
3757
|
} else if (Array.isArray(result)) {
|
|
3758
|
-
|
|
3758
|
+
chunkJ47RNLSY_cjs.ProcessorRunner.applyMessagesToMessageList(
|
|
3759
3759
|
result,
|
|
3760
3760
|
passThrough.messageList,
|
|
3761
3761
|
idsBeforeProcessing,
|
|
@@ -3765,7 +3765,7 @@ function createStepFromProcessor(processor) {
|
|
|
3765
3765
|
return { ...passThrough, messages: result };
|
|
3766
3766
|
} else if (result && "messages" in result && "systemMessages" in result) {
|
|
3767
3767
|
const typedResult = result;
|
|
3768
|
-
|
|
3768
|
+
chunkJ47RNLSY_cjs.ProcessorRunner.applyMessagesToMessageList(
|
|
3769
3769
|
typedResult.messages,
|
|
3770
3770
|
passThrough.messageList,
|
|
3771
3771
|
idsBeforeProcessing,
|
|
@@ -3809,7 +3809,7 @@ function createWorkflow(params) {
|
|
|
3809
3809
|
executionEngine
|
|
3810
3810
|
});
|
|
3811
3811
|
}
|
|
3812
|
-
var EventedWorkflow = class extends
|
|
3812
|
+
var EventedWorkflow = class extends chunkJ47RNLSY_cjs.Workflow {
|
|
3813
3813
|
constructor(params) {
|
|
3814
3814
|
super(params);
|
|
3815
3815
|
this.engineType = "evented";
|
|
@@ -3883,7 +3883,7 @@ var EventedWorkflow = class extends chunkKCRQQDEF_cjs.Workflow {
|
|
|
3883
3883
|
return run;
|
|
3884
3884
|
}
|
|
3885
3885
|
};
|
|
3886
|
-
var EventedRun = class extends
|
|
3886
|
+
var EventedRun = class extends chunkJ47RNLSY_cjs.Run {
|
|
3887
3887
|
constructor(params) {
|
|
3888
3888
|
super(params);
|
|
3889
3889
|
this.serializedStepGraph = params.serializedStepGraph;
|
|
@@ -4095,7 +4095,7 @@ var EventedRun = class extends chunkKCRQQDEF_cjs.Run {
|
|
|
4095
4095
|
}
|
|
4096
4096
|
}
|
|
4097
4097
|
});
|
|
4098
|
-
this.streamOutput = new
|
|
4098
|
+
this.streamOutput = new chunkJ47RNLSY_cjs.WorkflowRunOutput({
|
|
4099
4099
|
runId: this.runId,
|
|
4100
4100
|
workflowId: this.workflowId,
|
|
4101
4101
|
stream
|
|
@@ -4161,7 +4161,7 @@ var EventedRun = class extends chunkKCRQQDEF_cjs.Run {
|
|
|
4161
4161
|
}
|
|
4162
4162
|
}
|
|
4163
4163
|
});
|
|
4164
|
-
this.streamOutput = new
|
|
4164
|
+
this.streamOutput = new chunkJ47RNLSY_cjs.WorkflowRunOutput({
|
|
4165
4165
|
runId: this.runId,
|
|
4166
4166
|
workflowId: this.workflowId,
|
|
4167
4167
|
stream
|
|
@@ -4394,7 +4394,7 @@ function isExecutableStep(step) {
|
|
|
4394
4394
|
}
|
|
4395
4395
|
|
|
4396
4396
|
// src/workflows/evented/execution-engine.ts
|
|
4397
|
-
var EventedExecutionEngine = class extends
|
|
4397
|
+
var EventedExecutionEngine = class extends chunkJ47RNLSY_cjs.ExecutionEngine {
|
|
4398
4398
|
eventProcessor;
|
|
4399
4399
|
constructor({
|
|
4400
4400
|
mastra,
|
|
@@ -4434,7 +4434,7 @@ var EventedExecutionEngine = class extends chunkKCRQQDEF_cjs.ExecutionEngine {
|
|
|
4434
4434
|
await ack?.();
|
|
4435
4435
|
await pubsub.unsubscribe("workflows-finish", finishCb);
|
|
4436
4436
|
if (event.type === "workflow.fail" && event.data.stepResults) {
|
|
4437
|
-
event.data.stepResults =
|
|
4437
|
+
event.data.stepResults = chunkJ47RNLSY_cjs.hydrateSerializedStepErrors(event.data.stepResults);
|
|
4438
4438
|
}
|
|
4439
4439
|
resolveResult(event.data);
|
|
4440
4440
|
return;
|
|
@@ -4516,7 +4516,7 @@ var EventedExecutionEngine = class extends chunkKCRQQDEF_cjs.ExecutionEngine {
|
|
|
4516
4516
|
const { __state: _removedState, ...stepResultsWithoutTopLevelState } = resultData.stepResults ?? {};
|
|
4517
4517
|
const cleanStepResults = {};
|
|
4518
4518
|
for (const [stepId, stepResult] of Object.entries(stepResultsWithoutTopLevelState)) {
|
|
4519
|
-
cleanStepResults[stepId] =
|
|
4519
|
+
cleanStepResults[stepId] = chunkJ47RNLSY_cjs.cleanStepResult(stepResult);
|
|
4520
4520
|
}
|
|
4521
4521
|
let callbackArg;
|
|
4522
4522
|
if (resultData.prevResult.status === "failed") {
|
|
@@ -4633,5 +4633,5 @@ exports.cloneStep = cloneStep;
|
|
|
4633
4633
|
exports.cloneWorkflow = cloneWorkflow;
|
|
4634
4634
|
exports.createStep = createStep;
|
|
4635
4635
|
exports.createWorkflow = createWorkflow;
|
|
4636
|
-
//# sourceMappingURL=chunk-
|
|
4637
|
-
//# sourceMappingURL=chunk-
|
|
4636
|
+
//# sourceMappingURL=chunk-2H53MD2U.cjs.map
|
|
4637
|
+
//# sourceMappingURL=chunk-2H53MD2U.cjs.map
|