@mastra/ai-sdk 1.0.0-beta.6 → 1.0.0-beta.8
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 +64 -0
- package/dist/helpers.d.ts +8 -2
- package/dist/helpers.d.ts.map +1 -1
- package/dist/index.cjs +507 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +509 -26
- package/dist/index.js.map +1 -1
- package/dist/middleware.d.ts +157 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/transformers.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
# @mastra/ai-sdk
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Support new Workflow tripwire run status. Tripwires that are thrown from within a workflow will now bubble up and return a graceful state with information about tripwires. ([#10947](https://github.com/mastra-ai/mastra/pull/10947))
|
|
8
|
+
|
|
9
|
+
When a workflow contains an agent step that triggers a tripwire, the workflow returns with `status: 'tripwire'` and includes tripwire details:
|
|
10
|
+
|
|
11
|
+
```typescript showLineNumbers copy
|
|
12
|
+
const run = await workflow.createRun();
|
|
13
|
+
const result = await run.start({ inputData: { message: 'Hello' } });
|
|
14
|
+
|
|
15
|
+
if (result.status === 'tripwire') {
|
|
16
|
+
console.log('Workflow terminated by tripwire:', result.tripwire?.reason);
|
|
17
|
+
console.log('Processor ID:', result.tripwire?.processorId);
|
|
18
|
+
console.log('Retry requested:', result.tripwire?.retry);
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Adds new UI state for tripwire in agent chat and workflow UI.
|
|
23
|
+
|
|
24
|
+
This is distinct from `status: 'failed'` which indicates an unexpected error. A tripwire status means a processor intentionally stopped execution (e.g., for content moderation).
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`38380b6`](https://github.com/mastra-ai/mastra/commit/38380b60fca905824bdf6b43df307a58efb1aa15), [`798d0c7`](https://github.com/mastra-ai/mastra/commit/798d0c740232653b1d754870e6b43a55c364ffe2), [`ffe84d5`](https://github.com/mastra-ai/mastra/commit/ffe84d54f3b0f85167fe977efd027dba027eb998), [`2c212e7`](https://github.com/mastra-ai/mastra/commit/2c212e704c90e2db83d4109e62c03f0f6ebd2667), [`4ca4306`](https://github.com/mastra-ai/mastra/commit/4ca430614daa5fa04730205a302a43bf4accfe9f), [`3bf6c5f`](https://github.com/mastra-ai/mastra/commit/3bf6c5f104c25226cd84e0c77f9dec15f2cac2db)]:
|
|
27
|
+
- @mastra/core@1.0.0-beta.11
|
|
28
|
+
|
|
29
|
+
## 1.0.0-beta.7
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Return NetworkDataPart on each agent-execution-event and workflow-execution-event in network streams ([#10982](https://github.com/mastra-ai/mastra/pull/10982))
|
|
34
|
+
|
|
35
|
+
- Fixed tool-call-suspended chunks being dropped in workflow-step-output when using AI SDK. Previously, when an agent inside a workflow step called a tool that got suspended, the tool-call-suspended chunk was not received on the frontend even though tool-input-available chunks were correctly received. ([#10987](https://github.com/mastra-ai/mastra/pull/10987))
|
|
36
|
+
|
|
37
|
+
The issue occurred because tool-call-suspended was not included in the isMastraTextStreamChunk list, causing it to be filtered out in transformWorkflow. Now tool-call-suspended, tool-call-approval, object, and tripwire chunks are properly included in the text stream chunk list and will be transformed and passed through correctly.
|
|
38
|
+
|
|
39
|
+
Fixes #10978
|
|
40
|
+
|
|
41
|
+
- Adds `withMastra()` for wrapping AI SDK models with Mastra processors and memory. ([#10911](https://github.com/mastra-ai/mastra/pull/10911))
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { openai } from '@ai-sdk/openai';
|
|
45
|
+
import { generateText } from 'ai';
|
|
46
|
+
import { withMastra } from '@mastra/ai-sdk';
|
|
47
|
+
|
|
48
|
+
const model = withMastra(openai('gpt-4o'), {
|
|
49
|
+
inputProcessors: [myGuardProcessor],
|
|
50
|
+
outputProcessors: [myLoggingProcessor],
|
|
51
|
+
memory: {
|
|
52
|
+
storage,
|
|
53
|
+
threadId: 'thread-123',
|
|
54
|
+
resourceId: 'user-123',
|
|
55
|
+
lastMessages: 10,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const { text } = await generateText({ model, prompt: 'Hello!' });
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Works with `generateText`, `streamText`, `generateObject`, and `streamObject`.
|
|
63
|
+
|
|
64
|
+
- Updated dependencies [[`72df8ae`](https://github.com/mastra-ai/mastra/commit/72df8ae595584cdd7747d5c39ffaca45e4507227), [`9198899`](https://github.com/mastra-ai/mastra/commit/91988995c427b185c33714b7f3be955367911324), [`653e65a`](https://github.com/mastra-ai/mastra/commit/653e65ae1f9502c2958a32f47a5a2df11e612a92), [`c6fd6fe`](https://github.com/mastra-ai/mastra/commit/c6fd6fedd09e9cf8004b03a80925f5e94826ad7e), [`0bed332`](https://github.com/mastra-ai/mastra/commit/0bed332843f627202c6520eaf671771313cd20f3)]:
|
|
65
|
+
- @mastra/core@1.0.0-beta.9
|
|
66
|
+
|
|
3
67
|
## 1.0.0-beta.6
|
|
4
68
|
|
|
5
69
|
### Patch Changes
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type { PartialSchemaOutput, OutputSchema, DataChunkType, ChunkType } from '@mastra/core/stream';
|
|
2
|
-
import type { InferUIMessageChunk, ObjectStreamPart, TextStreamPart, ToolSet, UIMessage } from 'ai';
|
|
1
|
+
import type { PartialSchemaOutput, OutputSchema, DataChunkType, ChunkType, MastraFinishReason } from '@mastra/core/stream';
|
|
2
|
+
import type { InferUIMessageChunk, ObjectStreamPart, TextStreamPart, ToolSet, UIMessage, FinishReason } from 'ai';
|
|
3
|
+
/**
|
|
4
|
+
* Maps Mastra's extended finish reasons to AI SDK-compatible values.
|
|
5
|
+
* 'tripwire' and 'retry' are Mastra-specific reasons for processor scenarios,
|
|
6
|
+
* which are mapped to 'other' for AI SDK compatibility.
|
|
7
|
+
*/
|
|
8
|
+
export declare function toAISDKFinishReason(reason: MastraFinishReason): FinishReason;
|
|
3
9
|
export type OutputChunkType<OUTPUT extends OutputSchema = undefined> = TextStreamPart<ToolSet> | ObjectStreamPart<PartialSchemaOutput<OUTPUT>> | DataChunkType | undefined;
|
|
4
10
|
export type ToolAgentChunkType = {
|
|
5
11
|
type: 'tool-agent';
|
package/dist/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,SAAS,EACT,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAGlH;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAK5E;AAED,MAAM,MAAM,eAAe,CAAC,MAAM,SAAS,YAAY,GAAG,SAAS,IAC/D,cAAc,CAAC,OAAO,CAAC,GACvB,gBAAgB,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,GAC7C,aAAa,GACb,SAAS,CAAC;AAEd,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG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