Skip to content

fix(cli): add @ai-sdk/openai, anthropic, google as direct dependencies#1667

Merged
os-zhuang merged 2 commits into
mainfrom
fix/cli-ai-sdk-deps
Jun 9, 2026
Merged

fix(cli): add @ai-sdk/openai, anthropic, google as direct dependencies#1667
os-zhuang merged 2 commits into
mainfrom
fix/cli-ai-sdk-deps

Conversation

@baozhoutao

Copy link
Copy Markdown
Contributor

问题

全局安装的 CLI(npm install -g @objectstack/cli)不会自动安装 peerDependencies,导致用户配置 DeepSeek 等 provider 后报错:

Could not build adapter for provider=deepseek. Check API key (or the corresponding env var) and that the provider SDK package is installed.
Failed to load @ai-sdk/openai for provider=openai
{"error":"Cannot find package '@ai-sdk/openai' imported from ...@objectstack/cli/node_modules/index.js"}

根本原因

service-ai@ai-sdk/openai 等声明为 optional peerDependencies,设计意图是让消费方按需安装。但 CLI 作为消费方一直缺少这三个包的显式声明,而 normalisePresetProvider() 会将 deepseek / siliconflow / dashscope / openrouter / cloudflare 等 5 个预设 provider 全部重写为 provider=openai,再去动态 import('@ai-sdk/openai'),包不存在就报错。

修复

packages/cli/package.json 里将三个 provider SDK 加为直接依赖,与 @ai-sdk/gateway 保持一致。

Test plan

  • 全局安装 CLI 后配置 DeepSeek provider,验证不再报 Cannot find package '@ai-sdk/openai'
  • 配置 Anthropic / Google provider 同样正常工作

Global CLI installs don't auto-install peerDependencies, so providers
like DeepSeek (which normalises to provider=openai internally) silently
fail with "Cannot find package '@ai-sdk/openai'".

The CLI is the final consumer and must list all provider SDKs it
dynamically imports as direct dependencies, the same way apps/studio
previously did for Vercel deployments.

Fixes: "Could not build adapter for provider=deepseek"
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 9, 2026 2:54am

Request Review

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file size/xs labels Jun 9, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling size/s and removed size/xs labels Jun 9, 2026
@os-zhuang os-zhuang merged commit c66f770 into main Jun 9, 2026
13 checks passed
@os-zhuang os-zhuang deleted the fix/cli-ai-sdk-deps branch June 9, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation size/s tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants