chore(deps): migrate AI SDK to v7#6636
Draft
benjamincanac wants to merge 3 commits into
Draft
Conversation
- ai: ^6 → ^7 (root devDependency + docs) - @ai-sdk/vue: ^3 → ^4 - @ai-sdk/anthropic: ^3 → ^4 - @ai-sdk/gateway: ^3 → ^4 - @ai-sdk/mcp: ^1 → ^2 No code changes required: the ai type surface the library consumes (UIMessage, ChatStatus, UIDataTypes, UITools, FileUIPart, TextUIPart and the part.state values) and the @ai-sdk/vue Chat API used by the docs are unchanged in v7. Adds minimumReleaseAgeExclude entries because the v7 packages are newer than the supply-chain release-age gate.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…peer
- playgrounds/nuxt: ai ^6 → ^7, @ai-sdk/{anthropic,gateway,vue} ^3 → ^4
- add `ai: ^6 || ^7` as an optional peerDependency so consumers on
either major resolve against the same install
commit: |
AI SDK 7 deprecates the @ai-sdk/vue Chat class in favor of the reactive
useChat composable. Migrate all real components, playground pages and
documentation examples:
- replace \`new Chat({...})\` with \`useChat({...})\` and destructure the
reactive \`messages\`/\`status\`/\`error\` refs plus \`sendMessage\`/
\`regenerate\`/\`stop\`
- in the docs assistant, alias the import as \`useAIChat\` to avoid the
collision with the local \`useChat\` UI-state composable
- server examples: rename \`system\` to \`instructions\` and \`stepCountIs\`
to \`isStepCount\`
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.
Consolidates the AI SDK major bumps (the separate Renovate PRs) into a single migration:
ai@ai-sdk/vue@ai-sdk/anthropic@ai-sdk/gateway@ai-sdk/mcpLibrary
No code changes.
src/only consumes type exports fromai(UIMessage<M, D, U>,ChatStatus,UIDataTypes,UITools,FileUIPart,TextUIPart) plus thepart.stateliterals, all identical in v7. The one removed UI symbol,isToolOrDynamicToolUIPart, was never used (we already useisToolUIPart).Vue package migration (Chat class → useChat)
AI SDK 7 deprecates the
@ai-sdk/vueChatclass in favor of the reactiveuseChatcomposable. Migrated every consumer so we are not shipping deprecated usage:Chat.vue, the four docs chat/sidebar examples, and the playgroundchat.vue+sidebar.vuenew Chat({...})becomesuseChat({...}), destructuring the reactivemessages/status/errorrefs and thesendMessage/regenerate/stopmethodsuseAIChatto avoid colliding with our own auto-importeduseChatUI-state composablechat.md,chat-prompt.md,chat-messages.md, blog post)Server-side examples were also updated to v7 idioms:
system→instructionsandstepCountIs→isStepCount.pnpm typecheckandeslintpass on the changed files.Optional
aipeer dependencyAdded
aias an optionalpeerDependencywith range^6 || ^7. The Chat component types referenceaitypes in their public API, so a consumer already needsaiinstalled. Declaring it as an optional peer makes that relationship explicit and lets projects stay on v6 or move to v7 while resolving against a single install.Heads up
I added a
minimumReleaseAgeExcludeblock topnpm-workspace.yamlbecause the v7 packages are newer than our supply-chain release-age gate and were otherwise blocked. If you would rather wait for them to age past the gate, drop that block and regenerate the lockfile in a few days.Note
v7 requires Node 22+ and is ESM only (we are already ESM, so it is a CI matrix check at most).