Skip to content

Upgrade to AI SDK 7 - #1136

Open
JayanthMalladi wants to merge 1 commit into
ChainFuse:mainfrom
JayanthMalladi:shim/ai-sdk-7
Open

JayanthMalladi wants to merge 1 commit into
ChainFuse:mainfrom
JayanthMalladi:shim/ai-sdk-7

Conversation

@JayanthMalladi

Copy link
Copy Markdown

Upgrade to AI SDK 7

This PR moves the project from AI SDK 6 to 7 and keeps its current behavior.

Versions

  • @ai-sdk/anthropic: ^3.0.133 → ^4.0.0
  • @ai-sdk/azure: ^3.0.141 → ^4.0.0
  • @ai-sdk/google: ^3.0.136 → ^4.0.0
  • @ai-sdk/openai-compatible: ^2.0.86 → ^3.0.0
  • @ai-sdk/openai: ^3.0.10 → ^4.0.0
  • @ai-sdk/provider: ^3.0.19 → ^4.0.0
  • ai: ^6.0.311 → ^7.0.0

This drops support for AI SDK 6, so users of this package will need AI SDK 7 too. It probably belongs in a new major version.

What changed and why

Fixed: would fail at runtime on v7

  • packages/ai-tools/__tests__/ai-tools.test.mts:187, packages/ai-tools/__tests__/ai-tools.test.mts:247: messages/prompt has a system message, which AI SDK 7 rejects at runtime by default. allowSystemInMessages: true keeps the v6 behavior.
  • packages/ai-tools/__tests__/ai-tools.test.mts:306, packages/ai-tools/__tests__/ai-tools.test.mts:376: This agent may be called with a system message in messages/prompt (or its calls aren't visible here), which AI SDK 7 rejects by default. Only the constructor accepts the option; .generate()/.stream() don't. allowSystemInMessages: true keeps the v6 behavior.

Other source files changed (codemod renames and fixer edits): packages/ai-tools/src/providers/types.mts.

After the codemod, these checks failed; this PR fixes them: build, typecheck packages/ai-tools.

How it was checked

Check Before After
install pass pass
build pass pass
typecheck . fail fail
test . fail fail
typecheck packages/ai-tools pass pass
test packages/ai-tools fail fail

Also ran npx @ai-sdk/codemod v7 (official). Install ran with --ignore-scripts. A second agent reviewed the full diff for behavior changes and unrelated edits.

Rollback

Revert this PR. No data or config migrations are involved.


Opened by Shim, which turns API breaking changes into tested PRs. Not useful? Close it and we won't open another on this repo.

Copilot AI balanced review requested due to automatic review settings October 28, 2026 19:52
@changeset-bot

changeset-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 24b661f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@chainfuse/ai-tools Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​ai-sdk/​google@​4.0.107721008598100
Added@​ai-sdk/​openai@​4.0.104731008698100
Added@​ai-sdk/​provider@​4.0.341001007798100
Updated@​ai-sdk/​azure@​3.0.141 ⏵ 4.0.11295 +1610083 -398100
Updated@​ai-sdk/​openai-compatible@​2.0.86 ⏵ 3.0.8098 +1410084 -1698100
Added@​ai-sdk/​anthropic@​4.0.90931008598100
Addedai@​7.0.1559910010099100

View full report

@socket-security

Copy link
Copy Markdown

Caution

Review the following alerts detected in dependencies.

According to your organization's Security Policy, you must resolve all "Block" alerts before proceeding. Learn more about Socket for GitHub.

Priority Alert  (click "▶" to expand/collapse) Action
Low priority
Potential code anomaly (AI signal): npm undici is 68.0% likely to have a medium risk anomaly

Notes: Both alerts describe an in-place re-encoding of a local file from UTF-8 to Latin-1, overwriting the original without backups or validation. This can cause data loss and code corruption, creating a supply-chain tampering risk. The script itself shows no exfiltration or network activity, but its destructive behavior warrants deletion or strict safeguards and auditing.

Confidence: 0.68

Severity: 0.60

From: package-lock.json → npm/@ai-sdk/azure@4.0.112 → npm/@ai-sdk/google@4.0.107 → npm/ai@7.0.155 → npm/@ai-sdk/openai-compatible@3.0.80 → npm/@ai-sdk/anthropic@4.0.90 → npm/@ai-sdk/openai@4.0.104 → npm/undici@7.30.1

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/undici@7.30.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block

View full report

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants