feat: support AI SDK v7 (ai@7) as a peer dependency#691
Merged
Conversation
Contributor
|
@chentsulin is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
dancer
approved these changes
Jul 13, 2026
Widen peer ranges so the Chat SDK installs cleanly next to ai@7: - chat: ai ^6.0.182 || ^7.0.0 - @chat-adapter/web: ai ^6 || ^7, @ai-sdk/react ^3 || ^4, @ai-sdk/svelte ^4 || ^5, @ai-sdk/vue ^3 || ^4 The only real v6 -> v7 break for this repo is that tool() with an execute function now returns ExecutableTool<Tool<...>>, an internal type that ai does not re-export, so the inferred return types of the chat/ai tool factories fail declaration emit (TS2742). The factories now declare explicit Tool<Input, Output> return types — the same shape the published d.ts already had — so the public type surface is unchanged and works against both majors. Workspaces develop against v7 (devDependencies), and the examples move to ai@7 to keep a single major across the monorepo. Source was verified against both ai@6.0.182 and ai@7.0.17: typecheck and the full test suites pass on each. Closes vercel#690 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: chentsulin <chentsulin@gmail.com>
5b7998c to
0628bc5
Compare
dancer
added a commit
that referenced
this pull request
Jul 13, 2026
## summary #691 widened the `ai` peer to `^6 || ^7`, but the workspace devDependency pins ai@7 so CI only exercised v7. this adds an `ai-sdk-v6-compat` job that forces the v6 constellation (ai@6 + matching `@ai-sdk/react`/`svelte`/`vue` majors via `pnpm.overrides`) and builds, typechecks, and tests `chat` and `@chat-adapter/web` against it. it's wired into the required `build-and-test` summary so a v6 regression can't land unnoticed ## test plan - ran the job's steps locally against ai@6: `chat` (1044 tests) and `@chat-adapter/web` (21 tests) build, typecheck, and pass - YAML validated Signed-off-by: dancer <josh@afterima.ge>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #690
What
Widens the AI SDK peer dependency ranges so the Chat SDK installs cleanly next to
ai@7:chat:ai@^6.0.182 || ^7.0.0@chat-adapter/web:ai@^6 || ^7,@ai-sdk/react@^3 || ^4,@ai-sdk/svelte@^4 || ^5,@ai-sdk/vue@^3 || ^4This also unbreaks
create-chat-sdkscaffolds, which installai@latest(now v7) next tochatand currently hit a peer conflict out of the box.The one real v6 → v7 break
In v7,
tool()with anexecutefunction returnsExecutableTool<Tool<...>>— an internal type from@ai-sdk/provider-utilsthataidoes not re-export. Thechat/aitool factories relied on inference, so declaration emit failed with TS2742 (17 errors). The factories now declare explicitTool<Input, Output>return types, which is exactly the shape the previously published.d.tsalready had — the public type surface is unchanged, and the emitted declarations only reference types fromai(portable for consumers on either major).Everything else checked out compatible:
text-delta/finish-stepshapes, sofromFullStreamduck-typing works unchanged;fullStreamremains as a deprecated aliasneedsApprovalis deprecated in v7 but still typed and honoredcreateUIMessageStream,createUIMessageStreamResponse,isTextUIPart,UIMessage,UIMessageStreamWriter,ChatInit,DefaultChatTransportall still exported —@chat-adapter/webneeded zero source changesOther changes
examples/nextjs-chatandexamples/nuxt-chatmove toai@^7(required — mixing majors across the workspace fails typecheck, sincechat's d.ts resolvesaitypes from its own devDependency)ToolExecutionOptionsstub type is now derived fromTool["execute"]because v7 made the generic parameter requiredchatand@chat-adapter/web)Verification
The same source was verified against both majors (
ai@6.0.182andai@7.0.17):tsc --noEmitand the full test suites (chat: 1035 tests,@chat-adapter/web: 21 tests) pass on each.pnpm validate(knip + check + typecheck + test + build, including both examples) is green on v7.Note for adopters:
ai@7itself requires Node.js ≥ 22 and is ESM-only;chatkeepsengines.node >= 20sinceaiis an optional peer.🤖 Generated with Claude Code