Skip to content

Commit 23ec5ff

Browse files
feat(sdk): add support for AI SDK v6 (#2919)
## Summary - Add support for Vercel AI SDK v6 as a peer dependency - Update internal code to handle async validation from AI SDK v6's Schema type Closes #2918 Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Eric Allam <[email protected]>
1 parent 31e4753 commit 23ec5ff

File tree

5 files changed

+79
-405
lines changed

5 files changed

+79
-405
lines changed

.changeset/ai-sdk-v6-support.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
"@trigger.dev/core": patch
4+
---
5+
6+
Add support for AI SDK v6 (Vercel AI SDK)
7+
8+
- Updated peer dependency to allow `ai@^6.0.0` alongside v4 and v5
9+
- Updated internal code to handle async validation from AI SDK v6's Schema type

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
"@types/humanize-duration": "^3.27.1",
209209
"@types/lodash.get": "^4.4.9",
210210
"@types/readable-stream": "^4.0.14",
211-
"ai": "^3.4.33",
211+
"ai": "^6.0.0",
212212
"defu": "^6.1.4",
213213
"esbuild": "^0.23.0",
214214
"rimraf": "^3.0.2",

packages/core/src/v3/types/tools.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export function convertToolParametersToSchema<TToolParameters extends ToolTaskPa
2020
}
2121

2222
function convertAISchemaToTaskSchema(schema: AISchema<any>): Schema {
23-
return (payload: unknown) => {
24-
const result = schema.validate?.(payload);
23+
return async (payload: unknown) => {
24+
const result = await schema.validate?.(payload);
2525

2626
if (!result) {
2727
throw new Error("Invalid payload");

packages/trigger-sdk/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"@types/slug": "^5.0.3",
7070
"@types/uuid": "^9.0.0",
7171
"@types/ws": "^8.5.3",
72-
"ai": "^5.0.0",
72+
"ai": "^6.0.0",
7373
"encoding": "^0.1.13",
7474
"rimraf": "^3.0.2",
7575
"tshy": "^3.0.2",
@@ -79,7 +79,7 @@
7979
},
8080
"peerDependencies": {
8181
"zod": "^3.0.0 || ^4.0.0",
82-
"ai": "^4.2.0 || ^5.0.0"
82+
"ai": "^4.2.0 || ^5.0.0 || ^6.0.0"
8383
},
8484
"peerDependenciesMeta": {
8585
"ai": {

0 commit comments

Comments
 (0)