Skip to content

Comments

feat: upgrade to ai sdk 6#1559

Merged
maxprilutskiy merged 50 commits intolingodotdev:mainfrom
The-Best-Codes:best/aisdk-provider-upgrades
Jan 21, 2026
Merged

feat: upgrade to ai sdk 6#1559
maxprilutskiy merged 50 commits intolingodotdev:mainfrom
The-Best-Codes:best/aisdk-provider-upgrades

Conversation

@The-Best-Codes
Copy link
Contributor

Closes #1556

This upgrades the project to use the latest version of the AI SDK (v5.0.89). It also upgrades provider packages to versions compatible with AI SDK 5.
Note: The ollama-ai-provider package doesn't support AI SDK 5, so I swapped it out for the ollama-ai-provider-v2 package, which is recommended in AI SDK's docs.

The point of these upgrades is to address a security advisory which, though minor, was affecting some users' ability to ship Lingo.dev in production as it failed SOC 2 checks.

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>
Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>
@The-Best-Codes
Copy link
Contributor Author

Don't merge yet, please, as I am still manually testing locally. I'll provide an update here if all my manual tests do fine.
cc @maxprilutskiy

Copy link
Contributor Author

@The-Best-Codes The-Best-Codes left a comment

Choose a reason for hiding this comment

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

Ready to merge. Tested locally with Google, Groq, and OpenRouter.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades the AI SDK from v4 to v5 (specifically v5.0.89) to address a security advisory (GHSA-rwvc-j5jr-mgvh) that was affecting production deployments with SOC 2 compliance requirements.

Key changes:

  • Upgraded core ai package from v4.3.15 to v5.0.89
  • Upgraded all AI SDK provider packages to v2 versions (anthropic, google, groq, mistral, openai, openrouter)
  • Replaced ollama-ai-provider with ollama-ai-provider-v2 as recommended by AI SDK v5 documentation
  • Updated TypeScript types to match AI SDK v5 API (LanguageModelV1LanguageModel, MessageModelMessage)

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm-lock.yaml Updated dependency versions for AI SDK v5 and all provider packages
packages/cli/package.json Upgraded AI SDK dependencies to v2 and core ai package to v5.0.89
packages/compiler/package.json Upgraded AI SDK dependencies to v2 and core ai package to v5.0.89
packages/cli/src/cli/processor/index.ts Updated import to use ollama-ai-provider-v2
packages/cli/src/cli/processor/basic.ts Updated type from LanguageModelV1 to LanguageModel
packages/cli/src/cli/localizer/explicit.ts Updated import to ollama-ai-provider-v2 and type from Message to ModelMessage
packages/compiler/src/lib/lcp/api/index.ts Updated import to use ollama-ai-provider-v2
.changeset/pink-lemons-buy.md Added changeset documenting the upgrade
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

name: "I18nConfig",
markdownDescription: true,
const schema = toJSONSchema(LATEST_CONFIG_DEFINITION.schema, {
target: "openapi-3.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note to self: Ensure this is the correct way to migrate this

Copy link
Contributor Author

@The-Best-Codes The-Best-Codes Nov 15, 2025

Choose a reason for hiding this comment

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

@maxprilutskiy The file this script generates does change quite a bit after the Zod 4 upgrade, but I'm not sure how much that matters... I think the docs script is used internally in some way? Can you give me any details on what the generate-config-docs.ts script does and if it's important for the output schema to stay the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One option here is to keep this as zod-to-json-schema with a zod/v3 import.

Copy link
Contributor Author

@The-Best-Codes The-Best-Codes left a comment

Choose a reason for hiding this comment

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

Still working on migrating to Zod 4, don't merge this!

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>
Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>
@The-Best-Codes The-Best-Codes marked this pull request as draft November 15, 2025 20:31
Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>
everything still works fine)

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>
Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>
Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>
{
text: Z.string(),
targetLocale: Z.string().regex(/^[a-z]{2}(-[A-Z]{2})?$/),
text: Z.string() as any,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to manually test the MCP server

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One option here is to keep backward compat by importing zod/v3 here.

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>
@The-Best-Codes
Copy link
Contributor Author

They still haven't released AI SDK 6 support in stable, but I've bumped it to alpha. Tests passing locally (but not in CI for some reason).

Copy link
Contributor Author

@The-Best-Codes The-Best-Codes left a comment

Choose a reason for hiding this comment

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

Ready to review, if that failing test will pass. The @openrouter/ai-sdk-provider dep will need to be bumped to stable later once they release it in stable

@maxprilutskiy
Copy link
Contributor

@The-Best-Codes please have a look at the lockfile again 🙏

@maxprilutskiy maxprilutskiy enabled auto-merge (squash) January 14, 2026 21:15
auto-merge was automatically disabled January 14, 2026 21:18

Head branch was pushed to by a user without write access

@The-Best-Codes
Copy link
Contributor Author

All tests passing :)

image

@The-Best-Codes
Copy link
Contributor Author

cc @vrcprl

@maxprilutskiy maxprilutskiy merged commit e8407e6 into lingodotdev:main Jan 21, 2026
4 checks passed
@maxprilutskiy
Copy link
Contributor

wohooo @The-Best-Codes 🕺

@The-Best-Codes The-Best-Codes deleted the best/aisdk-provider-upgrades branch January 21, 2026 18:25
@The-Best-Codes
Copy link
Contributor Author

🥳

17prateek12 pushed a commit to 17prateek12/lingo.dev that referenced this pull request Jan 23, 2026
* chore: upgrade to ai sdk 5 to resolve security vulns

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* chore: changeset

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* feat: upgrade to zod 4

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* chore: remove zod-to-json-schema from the codebase

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* fix: use "Z" not "z"

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* fix: use error.issues

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* fix: perform more zod 4 migrations

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* fix: resolve type errors in mcp.ts (used any, might manually verify
everything still works fine)

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* fix: remove defaults from optional fields in zod 4 (fixes failing tests)

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* chore: fmt

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* chore: remove unused zod-to-json-schema dep

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* fix: use prefault

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* fix: revert

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* fix: upgrade new deps

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* fix: sort deps

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* fix: revert to zod 3 for docs script

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* chore: upgrade to ai sdk 6

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

* chore: sync lockfile

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>

---------

Signed-off-by: The-Best-Codes <bestcodes.official@gmail.com>
Co-authored-by: Max Prilutskiy <5614659+maxprilutskiy@users.noreply.github.com>
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.

Upgrade from AI SDK v4 to v6

3 participants