-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Trigger AI SDK chat #3064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Trigger AI SDK chat #3064
Changes from 2 commits
Commits
Show all changes
217 commits
Select commit
Hold shift + click to select a range
0f932eb
Add @trigger.dev/ai package with chat transport and tests
cursoragent af510e6
Document and demo @trigger.dev/ai useChat transport
cursoragent 092c2ba
Add ai compatibility tests and preserve sdk behavior
cursoragent 7c0476c
Use function declaration style in ai.tool execute callback
cursoragent babf007
Add changelog for new @trigger.dev/ai package
cursoragent 60f2a32
Add custom mapper and trigger options transport test
cursoragent b30a66b
Add factory constructor coverage for chat transport
cursoragent 58b43ec
Track exact SSE event IDs for chat reconnect
cursoragent cf1b5c7
Add compile-time DX tests for chat transport types
cursoragent b511566
Cleanup run-store entries when chat streams finish
cursoragent d706534
Test reconnect null behavior after completed streams
cursoragent cc2be18
Cover async run store implementations in chat transport tests
cursoragent 5d5a757
Test default stream fallback path in chat transport
cursoragent b53b61b
Add package README for @trigger.dev/ai usage
cursoragent d02edc3
Deprecate sdk ai import path in favor of @trigger.dev/ai
cursoragent 70d297c
Test stream key URL encoding in chat transport
cursoragent 9974f22
Guard reconnect against fetch setup failures
cursoragent 390e53c
Document custom payload mapping and run store options
cursoragent ffb91a1
Support async payload and trigger option resolvers
cursoragent 7d17be7
Document advanced chat transport mapping and run store options
cursoragent 889194a
Cover typed stream definition ids in transport tests
cursoragent 63e98c2
Add sdk parity test against @trigger.dev/ai helper
cursoragent d79c586
Cover static trigger options path in chat transport
cursoragent df877ee
Cover mapper and trigger option resolver failure paths
cursoragent 3f1d98f
Support async onTriggeredRun callbacks in chat transport
cursoragent e8222f7
Document onTriggeredRun callback option in streams guide
cursoragent bc1a10c
Ignore onTriggeredRun callback failures during streaming
cursoragent bff60e1
Clarify reconnect lifecycle behavior in transport docs
cursoragent 3766c73
Recommend @trigger.dev/ai in trigger-sdk README
cursoragent 302df5e
Normalize tuple-style headers in transport request mapping
cursoragent dc48c61
Add factory payload inference type-level coverage
cursoragent 19909ea
Allow tuple header inputs in transport send options
cursoragent 5d24c69
Document supported header input formats for transport
cursoragent 7a3db86
Assert onTriggeredRun receives initial run state snapshot
cursoragent b7c2b2e
Expand ai package changelog with transport capabilities
cursoragent f9dcafa
Export explicit send/reconnect option helper types
cursoragent c0fa995
Test preview branch and timeout header propagation
cursoragent bc9e06c
Strengthen async run store interaction assertions
cursoragent 6843732
Document exported request option helper aliases
cursoragent e69a1d2
Add sdk patch changeset for ai package guidance
cursoragent 5d492d6
Document exported transport option helper types in streams docs
cursoragent 227290b
Pass immutable run-state snapshot to onTriggeredRun
cursoragent 5efba13
Cleanup inactive reconnect state entries on access
cursoragent 1f49bc2
Add optional onError callback for non-fatal transport issues
cursoragent f235e1d
Update ai changelog with latest transport enhancements
cursoragent 6ead0d0
Cover reconnect and tracking phases in onError callback tests
cursoragent a4bab4c
Add type-level coverage for onError callback payload
cursoragent d870c19
Add type coverage for custom run store options
cursoragent 677debc
Export header normalization helper for advanced integrations
cursoragent 4cf0b97
Add type coverage for onError option wiring
cursoragent 6f4b9f0
Document onError callback payload fields
cursoragent 8f5c16a
Report send-phase errors through onError callback
cursoragent dc01fab
Note phase-aware onError reporting in ai changelog
cursoragent add5ed3
Keep exported header normalization helper as supported API
cursoragent 8e1821c
Assert normalized object headers are copied immutably
cursoragent 0e403de
Verify duplicate header keys use last value on normalization
cursoragent 6100c6e
Use shared transport error type in reportError
cursoragent d0b3119
Cover non-Error mapper failures in onError reporting
cursoragent a7cba36
Cover non-Error trigger option failures in onError reporting
cursoragent d729344
Cover non-Error trigger task failures in onError reporting
cursoragent b76c8b5
Cover non-Error reconnect failures in onError reporting
cursoragent afd9df5
Cover non-Error onTriggeredRun failures in onError reporting
cursoragent 58b6dc3
Document non-Error normalization in onError changelog notes
cursoragent 1c50671
Clarify onError normalization behavior in streams docs
cursoragent 2236e0f
Ensure onError failures never mask mapper errors
cursoragent 065d933
Ensure onError failures do not mask trigger option/task errors
cursoragent ebd39aa
Verify reconnect flow tolerates onError callback failures
cursoragent 8e0dcd4
Harden consumeTrackingStream error callback coverage
cursoragent 4b4953c
Report stream subscribe failures through onError lifecycle
cursoragent 9790990
Cover non-Error stream subscription failures in onError reporting
cursoragent a1d32c4
Assert stream subscribe cleanup transitions run state
cursoragent e97fc5c
Refactor run-state cleanup into shared transport helper
cursoragent fe5cd3d
Use immutable run-state updates in tracking and cleanup paths
cursoragent e782303
Cover async run-store cleanup on stream subscribe failures
cursoragent bf7bee8
Assert onError remains silent on successful chat streams
cursoragent 0779d54
Assert reconnect non-error paths do not invoke onError
cursoragent 0323712
Assert reconnect success path does not invoke onError
cursoragent 90198de
Preserve thrown string when stream subscribe onError callback fails
cursoragent 382577f
Avoid masking transport failures when run-store cleanup fails
cursoragent b912e4f
Document best-effort run-store cleanup error semantics
cursoragent 654bab0
Cover cleanup delete failures across stream subscribe and reconnect
cursoragent ed2207f
Cover consumeTracking cleanup failures without masking root errors
cursoragent c441984
Cover completion path behavior when cleanup delete fails
cursoragent e0219ce
Cover consumeTracking root errors when cleanup and onError both fail
cursoragent d4266a6
Cover combined cleanup and onError failure resilience paths
cursoragent fc3d9b8
Cover completion path behavior when cleanup set fails
cursoragent 43205f7
Attempt run-store delete even when inactive-state write fails
cursoragent aab79a0
Document dual-step best-effort run-store cleanup behavior
cursoragent 7eb4f5d
Cover cleanup set+delete dual failure path during stream subscribe
cursoragent 3c24068
Cover reconnect path when cleanup set and delete both fail
cursoragent 526b66f
Cover completion path when cleanup set and delete both fail
cursoragent 50b9407
Cover consumeTracking path when cleanup set and delete both fail
cursoragent 677fc06
Cover reconnect behavior when cleanup and onError all fail
cursoragent 4006a68
Handle inactive reconnect cleanup delete failures non-fatally
cursoragent 864125c
Cover inactive reconnect cleanup string failures and normalization
cursoragent eaf59f2
Cover inactive reconnect cleanup delete failures without onError
cursoragent 9cf96d9
Cover inactive reconnect string cleanup failures without onError
cursoragent 87f92e7
Document reconnect inactive-cleanup error reporting semantics
cursoragent 8e8f3e0
Cover consumeTracking behavior when cleanup and onError all fail
cursoragent 8dffb95
Cover reconnect after completion with dual cleanup-step failures
cursoragent 0a5d8cf
Assert cleanup set failures still drive delete attempts
cursoragent 3732bd6
Cover retry behavior for inactive reconnect cleanup failures
cursoragent 2b6723e
Retry inactive reconnect cleanup after string delete failures
cursoragent bec4401
Assert full run-state transition snapshots on stream completion
cursoragent d604b94
Assert inactive reconnect cleanup never attempts stream fetch
cursoragent 5f6e78b
Document retry behavior for stale inactive reconnect cleanup
cursoragent fa195ff
Cover object cleanup-delete normalization for inactive reconnect
cursoragent 81d62b5
Assert active reconnect delete failures retry via inactive cleanup path
cursoragent 80dcd2d
Cover repeated inactive cleanup failures with per-attempt onError
cursoragent 89ec29d
Cover reconnect delete string failures on active cleanup path
cursoragent 63454ef
Cover repeated inactive cleanup failures without onError
cursoragent 42a2535
Track cleanup delete attempts in reconnect retry tests
cursoragent 7e0eb51
Extract inactive reconnect cleanup into dedicated helper
cursoragent 5307d73
Cover active reconnect cleanup delete failures without onError
cursoragent 6903526
Document reconnect behavior when onError is omitted
cursoragent 82f8950
Cover stream URL encoding for trigger run IDs
cursoragent 5eeafc2
Cover trailing slash normalization for transport baseURL
cursoragent c12315f
Cover baseURL path-prefix support for trigger and stream routes
cursoragent a736fa9
Normalize baseURL once for trigger and stream endpoints
cursoragent 8be2472
Cover baseURL path-prefix trailing slash normalization
cursoragent fcb140b
Assert baseURL trailing-slash normalization for trigger endpoint
cursoragent e2438ab
Cover prefixed baseURL plus run/stream URL encoding
cursoragent b44b4e5
Document baseURL normalization semantics for transport endpoints
cursoragent 7d75401
Cover inactive string cleanup retries without onError callback
cursoragent b38d231
Trim baseURL whitespace before endpoint normalization
cursoragent c132ca4
Add baseURL whitespace trim path-prefix transport test
cursoragent 29a8d6e
Add trimmed baseURL prefixed encoding transport coverage
cursoragent 4ae1207
Validate normalized baseURL cannot be empty
cursoragent edeed64
Add factory-path baseURL empty validation coverage
cursoragent 3a9047b
Validate baseURL is an absolute URL
cursoragent 9afa035
Require http(s) protocol for chat transport baseURL
cursoragent 915573c
Cover uppercase HTTP baseURL protocol handling
cursoragent db22f32
Reject baseURL query and hash components
cursoragent 7f4cca5
Cover accepted https baseURL validation paths
cursoragent 39492e6
Reject credential-bearing baseURL values
cursoragent ae2942e
Document baseURL validation in ai package changeset
cursoragent 861e42a
Cover trimmed query-bearing baseURL rejection paths
cursoragent cb701f2
Cover trimmed hash and credential baseURL rejection
cursoragent c970ff0
Cover uppercase HTTPS baseURL acceptance paths
cursoragent c00d630
Add explicit baseURL examples to ai docs
cursoragent 2f1c683
Cover ws and wss baseURL protocol rejection
cursoragent d56f58d
Document ws and wss baseURL rejection examples
cursoragent 5a017a7
Refactor baseURL validation into focused helpers
cursoragent 341e345
Cover trimmed ws and wss baseURL rejection
cursoragent 9c3228b
Document exact baseURL validation error messages
cursoragent 8309d57
Cover baseURL validation error precedence
cursoragent be5487f
Cover hash-over-credential validation precedence
cursoragent b9eb04c
Cover factory acceptance for uppercase HTTP baseURL
cursoragent 1f7a165
Document case-insensitive baseURL protocol matching
cursoragent b751ad8
Centralize baseURL validation error messages
cursoragent 2a60d1d
Document deterministic baseURL validation ordering
cursoragent 9863544
Note baseURL validation ordering in changeset
cursoragent 7d3eac2
Cover whitespace-wrapped uppercase HTTP baseURL acceptance
cursoragent 5db7fb7
Cover whitespace uppercase HTTPS baseURL acceptance
cursoragent 0cb113b
Cover runtime uppercase HTTP baseURL prefix normalization
cursoragent c69808e
Expand baseURL precedence coverage for mixed invalid inputs
cursoragent b4f5a8b
Add baseURL validation ordering examples to docs
cursoragent 4d0270d
Cover omitted baseURL default constructor paths
cursoragent e6e6bee
Cover newline and tab baseURL whitespace trimming
cursoragent 3aa5ad1
Cover non-breaking-space baseURL normalization paths
cursoragent bf05b94
Document default baseURL behavior when omitted
cursoragent ed520b6
Cover empty-after-NBSP baseURL validation paths
cursoragent e92a84e
Expand changeset notes for baseURL defaults and protocol casing
cursoragent 2644de5
Reject internal whitespace in normalized baseURL values
cursoragent 0aa2edb
Prioritize internal-whitespace baseURL validation
cursoragent a70ecde
Cover internal tab characters in baseURL validation
cursoragent 6e8c236
Document internal-tab baseURL invalid examples
cursoragent 6363e7e
Cover percent-encoded whitespace baseURL acceptance
cursoragent 43cf6c9
Cover percent-encoded delimiter paths in baseURL validation
cursoragent c8bdcd9
Cover carriage-return baseURL whitespace validation
cursoragent c82bf64
Hoist baseURL internal-whitespace regex constant
cursoragent 666b991
Cover trimmed wrapper query/hash validation path
cursoragent 4432ba4
Cover wrapped percent-encoded delimiter baseURL paths
cursoragent 0d4cc70
Reject invisible separator characters in baseURL
cursoragent dec91eb
Cover BOM wrapper and internal BOM baseURL handling
cursoragent b3bd45c
Cover vertical-tab baseURL whitespace validation
cursoragent 168cf85
Cover form-feed baseURL whitespace validation
cursoragent b72e6b6
Cover internal-space baseURL validation paths
cursoragent fcec4c1
Document internal-whitespace regex intent
cursoragent 722f9ed
Clarify invisible separator handling in baseURL docs
cursoragent e1ada23
Cover narrow no-break-space baseURL validation
cursoragent c8e6599
Cover line-separator baseURL whitespace validation
cursoragent 9bb67ad
Cover paragraph-separator baseURL whitespace validation
cursoragent 99d96a4
Cover BOM-wrapped uppercase HTTP baseURL acceptance
cursoragent 958ed8b
Cover internal non-breaking-space baseURL rejection
cursoragent 2c92d07
Cover word-joiner baseURL whitespace validation
cursoragent 8d074d7
Cover zero-width-non-joiner baseURL whitespace validation
cursoragent 2df81ff
Cover zero-width-joiner baseURL whitespace validation
cursoragent fb71d5a
Cover word-joiner wrapper baseURL rejection
cursoragent 9fa12b0
Cover zero-width-space wrapper baseURL rejection
cursoragent 140fc20
Cover zero-width-non-joiner wrapper baseURL rejection
cursoragent 9baa514
Cover zero-width-joiner wrapper baseURL rejection
cursoragent abdddac
Add invisible-separator precedence coverage and docs example
cursoragent 1a2f243
Document rejection of invisible-separator baseURL wrappers
cursoragent 2c7f40c
Fix docs to list exact internal-whitespace error message
cursoragent 06322fd
Cover additional unicode whitespace baseURL rejections
cursoragent f96b545
Cover unicode-trimmable baseURL wrappers in acceptance tests
cursoragent 195f5f3
Cover newline-tab wrapped baseURL acceptance
cursoragent bed3c81
Cover empty-after-trim unicode wrapper baseURL validation
cursoragent 25f4cde
Document unicode wrapper trimming and empty-after-trim behavior
cursoragent 7924efb
Cover additional unicode spacing baseURL rejections
cursoragent ae87637
Cover additional unicode wrapper trimming acceptance
cursoragent a9fd293
Cover additional empty-after-trim unicode wrapper baseURLs
cursoragent cc0b1d6
Document expanded unicode whitespace coverage in release notes
cursoragent 3e7fe1f
Cover newline-tab wrapped invalid baseURL validation paths
cursoragent bcd5a3a
Cover newline-tab wrapped websocket protocol validation
cursoragent 17a1975
Document trimmed-wrapper hash and credential baseURL rejections
cursoragent d1e9220
Cover unicode-wrapped baseURL path-prefix runtime normalization
cursoragent 28becff
Reject mongolian-vowel-separator baseURL invisible whitespace
cursoragent 842d83b
Cover mongolian separator precedence in mixed-invalid baseURLs
cursoragent 79a2d39
Cover mongolian separator slash-wrapper validation behavior
cursoragent 7caa78f
Cover hair-space baseURL wrapper and internal validation
cursoragent a3dbae6
Cover thin-space baseURL wrapper and internal validation
cursoragent 580b986
Cover punctuation-space baseURL wrapper and internal validation
cursoragent 2ce01e1
Cover six-per-em-space baseURL wrapper and internal validation
cursoragent 7fe37c2
Cover em-space baseURL wrapper and internal validation
cursoragent 65d96e7
Document expanded unicode-space baseURL coverage in release notes
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| "@trigger.dev/ai": minor | ||
| --- | ||
|
|
||
| Add a new `@trigger.dev/ai` package with: | ||
|
|
||
| - `ai.tool(...)` and `ai.currentToolOptions()` helpers for AI SDK tool calling ergonomics | ||
| - a typed `TriggerChatTransport` that plugs into AI SDK UI `useChat()` and runs chat backends as Trigger.dev tasks | ||
| - rich default task payloads (`chatId`, trigger metadata, messages, request context) with optional payload mapping | ||
| - reconnect-aware stream handling on top of Trigger.dev Realtime Streams v2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| { | ||
| "name": "@trigger.dev/ai", | ||
| "version": "4.3.3", | ||
| "description": "Trigger.dev AI SDK integrations and chat transport", | ||
| "license": "MIT", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/triggerdotdev/trigger.dev", | ||
| "directory": "packages/ai" | ||
| }, | ||
| "type": "module", | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "tshy": { | ||
| "selfLink": false, | ||
| "main": true, | ||
| "module": true, | ||
| "project": "./tsconfig.json", | ||
| "exports": { | ||
| "./package.json": "./package.json", | ||
| ".": "./src/index.ts" | ||
| }, | ||
| "sourceDialects": [ | ||
| "@triggerdotdev/source" | ||
| ] | ||
| }, | ||
| "scripts": { | ||
| "clean": "rimraf dist .tshy .tshy-build .turbo", | ||
| "build": "tshy && pnpm run update-version", | ||
| "dev": "tshy --watch", | ||
| "typecheck": "tsc --noEmit", | ||
| "test": "vitest", | ||
| "update-version": "tsx ../../scripts/updateVersion.ts", | ||
| "check-exports": "attw --pack ." | ||
| }, | ||
| "dependencies": { | ||
| "@trigger.dev/core": "workspace:^4.3.3" | ||
| }, | ||
| "devDependencies": { | ||
| "@arethetypeswrong/cli": "^0.15.4", | ||
| "ai": "^6.0.0", | ||
| "rimraf": "^3.0.2", | ||
| "tshy": "^3.0.2", | ||
| "tsx": "4.17.0", | ||
| "zod": "3.25.76" | ||
| }, | ||
| "peerDependencies": { | ||
| "ai": "^4.2.0 || ^5.0.0 || ^6.0.0", | ||
| "zod": "^3.0.0 || ^4.0.0" | ||
| }, | ||
| "engines": { | ||
| "node": ">=18.20.0" | ||
| }, | ||
| "exports": { | ||
| "./package.json": "./package.json", | ||
| ".": { | ||
| "import": { | ||
| "@triggerdotdev/source": "./src/index.ts", | ||
| "types": "./dist/esm/index.d.ts", | ||
| "default": "./dist/esm/index.js" | ||
| }, | ||
| "require": { | ||
| "types": "./dist/commonjs/index.d.ts", | ||
| "default": "./dist/commonjs/index.js" | ||
| } | ||
| } | ||
| }, | ||
| "main": "./dist/commonjs/index.js", | ||
| "types": "./dist/commonjs/index.d.ts", | ||
| "module": "./dist/esm/index.js" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { z } from "zod"; | ||
| import { ai } from "./ai.js"; | ||
| import type { TaskWithSchema } from "@trigger.dev/core/v3"; | ||
|
|
||
| describe("ai helper", function () { | ||
| it("creates a tool from a schema task and executes through triggerAndWait", async function () { | ||
| let receivedInput: unknown = undefined; | ||
|
|
||
| const fakeTask = { | ||
| id: "fake-task", | ||
| description: "A fake task", | ||
| schema: z.object({ | ||
| name: z.string(), | ||
| }), | ||
| triggerAndWait: function (payload: { name: string }) { | ||
| receivedInput = payload; | ||
| const resultPromise = Promise.resolve({ | ||
| ok: true, | ||
| id: "run_123", | ||
| taskIdentifier: "fake-task", | ||
| output: { | ||
| greeting: `Hello ${payload.name}`, | ||
| }, | ||
| }); | ||
|
|
||
| return Object.assign(resultPromise, { | ||
| unwrap: async function () { | ||
| return { | ||
| greeting: `Hello ${payload.name}`, | ||
| }; | ||
| }, | ||
| }); | ||
| }, | ||
| } as unknown as TaskWithSchema< | ||
| "fake-task", | ||
| z.ZodObject<{ name: z.ZodString }>, | ||
| { greeting: string } | ||
| >; | ||
|
|
||
| const tool = ai.tool(fakeTask); | ||
| const result = await tool.execute?.( | ||
| { | ||
| name: "Ada", | ||
| }, | ||
| undefined as never | ||
| ); | ||
|
|
||
| expect(receivedInput).toEqual({ | ||
| name: "Ada", | ||
| }); | ||
| expect(result).toEqual({ | ||
| greeting: "Hello Ada", | ||
| }); | ||
| }); | ||
|
|
||
| it("throws when creating a tool from a task without schema", function () { | ||
| const fakeTask = { | ||
| id: "no-schema", | ||
| description: "No schema task", | ||
| schema: undefined, | ||
| triggerAndWait: async function () { | ||
| return { | ||
| unwrap: async function () { | ||
| return {}; | ||
| }, | ||
| }; | ||
| }, | ||
| } as unknown as TaskWithSchema<"no-schema", undefined, unknown>; | ||
|
|
||
| expect(function () { | ||
| ai.tool(fakeTask); | ||
| }).toThrowError("task has no schema"); | ||
| }); | ||
|
|
||
| it("returns undefined for current tool options outside task execution context", function () { | ||
| expect(ai.currentToolOptions()).toBeUndefined(); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Vercel AI SDK ChatTransport interface when introduced version history💡 Result:
When was
ChatTransportintroduced (Vercel AI SDK)?ChatTransportwas introduced as part of the AI SDK v5 chat redesign (the switch to a “transport-based architecture” foruseChat). The v5useChatdocs explicitly call out that AI SDK 5.0 moved to transports and exposes atransport?: ChatTransportoption. [1]Timeline / version history (high-confidence points)
5.0.0-alpha.13, June 16, 2025): v5 alpha issues reference the new chat architecture (Chat store/transport concepts were already in play during the alpha cycle). [2]@ai-sdk/react@2.0.0[4]@ai-sdk/vue@2.0.0[5]@ai-sdk/svelte@3.0.0[6]Where the interface lives (current docs/code)
useChat(..., transport?: ChatTransport)in the v5 UI docs. [1]aipackage source,ChatTransportis defined insrc/ui/chat-transport.ts. [7]Sources: [1] [2] [3] [4] [5] [6] [7]
🌐 Web query:
Zod npm package version 3.25.76💡 Result:
zod@3.25.76is a published version of the Zod npm package (TypeScript-first schema validation). Install it with:It’s listed on npm as version 3.25.76. [1]
🏁 Script executed:
Repository: triggerdotdev/trigger.dev
Length of output: 81
🏁 Script executed:
Repository: triggerdotdev/trigger.dev
Length of output: 103
🏁 Script executed:
Repository: triggerdotdev/trigger.dev
Length of output: 9267
🏁 Script executed:
Repository: triggerdotdev/trigger.dev
Length of output: 2271
Remove AI SDK v4.2.0 from peer dependencies or add version guards.
The code unconditionally imports and implements
ChatTransport, which was introduced in AI SDK v5 (released July 31, 2025). The peer dependency"ai": "^4.2.0 || ^5.0.0 || ^6.0.0"incorrectly claims compatibility with v4.2.0, whereChatTransportdoes not exist. This will cause runtime errors for users with only AI SDK v4 installed. Either tighten the peer dependency to"ai": "^5.0.0 || ^6.0.0"or add version guards around ChatTransport usage. Thezod: "3.25.76"devDependency is valid.🤖 Prompt for AI Agents