Repository navigation
Upgrade dependencies to latest (AI SDK v7) and keep GLM 4.6 + Qwen 3 working (#47) - #51
Conversation
Bump ai, @ai-sdk/* providers, @openrouter/ai-sdk-provider, ollama-ai-provider-v2, and ai-sdk-provider-claude-code to their latest majors. AI SDK v7 providers now emit LanguageModelV4 (specificationVersion "v4"), so rename the LanguageModelV2 contract to LanguageModelV4 across the provider base class, all 16 providers, and getSdkLanguageModel. Raise peerDependency floors for the AI SDK provider packages to the majors that produce LanguageModelV4, keeping the picker's createInstance contract consistent with a consumer's AI SDK v7 runtime. Providers continue to reuse the official AI SDK provider packages (no direct API calls). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oj8aXYorx82K6sUbvK258
Bump the build/test toolchain and linting stack to their latest versions: - React 19.2.7, react-hook-form 7.81 - Vite 8, Vitest 4, @vitejs/plugin-react 6, vite-plugin-dts 5, jsdom 29, Testing Library, prettier 3.9 - vite-plugin-dts v5 renamed rollupTypes -> bundleTypes and now needs @microsoft/api-extractor as an explicit dependency - ESLint 10, typescript-eslint 8.64, eslint-plugin-unicorn 71, eslint-plugin-react-hooks 7, eslint-plugin-sonarjs 4 Migrate eslint-plugin-import -> eslint-plugin-import-x: the former's latest (2.32.0) crashes on ESLint 10 (its order rule calls the removed sourceCode.getTokenOrCommentBefore API); import-x is the maintained, flat-config-native, ESLint 10-compatible successor. Keep TypeScript on 5.9.x: typescript-eslint's latest still caps its peer at "<6.1.0", so TypeScript 7 would break the lint pass. Adjust eslint.config.ts for the upgrades: type-cast the plugin configs that ESLint 10's stricter defineConfig types reject, and disable the opinionated rules newly enabled by unicorn 71 / sonarjs 4 (several would rename public API) to keep this an upgrade rather than a refactor. Address the few genuine findings that remain: attach `cause` to rethrown errors (ESLint 10 preserve-caught-error), mark ListboxOption props read-only, and drop an unused React import. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oj8aXYorx82K6sUbvK258
- Upgrade Storybook and its addons (react-vite, addon-docs, addon-onboarding, addon-vitest) and eslint-plugin-storybook to 10.5.0. This also clears the bulk of the `pnpm audit` findings, which came from Storybook 9's transitive tree. - Bump Tailwind to the latest 3.x (3.4.19). Tailwind is intentionally kept on v3: the library ships a JS `tailwind-preset` as public API, and v4's CSS-first rewrite would be a breaking change for consumers and a full rewrite of the theming/VSCode-integration layer — out of scope for a dependency upgrade and best decided separately. - Add pnpm-workspace.yaml (pnpm 11 no longer reads settings from the package.json "pnpm" field) with a rollup override for the last remaining advisory. All overridden packages are dev/build tooling and none ship in the published package. TypeScript is likewise held at 5.9.x because typescript-eslint's latest still caps its peer at "<6.1.0"; TypeScript 7 would break linting. `pnpm audit --audit-level=moderate` now reports no known vulnerabilities. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oj8aXYorx82K6sUbvK258
Reflect the upgraded AI SDK in user-facing text: the picker now targets AI SDK v7 and its createInstance contract returns LanguageModelV4. Updates the README, package description, basics guide, provider base-class comment, and the Storybook intro. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oj8aXYorx82K6sUbvK258
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR updates the package for Vercel AI SDK v7. Provider factory contracts and Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
pnpm's latest release (installed via pnpm/action-setup version: latest) requires Node.js >=22.13 and crashes on Node 20 (`node:sqlite` is not a built-in there), which fails the install step before any check runs. Bump the CI, publish, and storybook workflows from Node 20 to Node 22. The library's own engines.node stays at ">=20" — this only changes the Node version used to build and test the package. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oj8aXYorx82K6sUbvK258
pnpm 11 removed the `--no-save` flag from `pnpm add`, so the compatibility job failed with ERR_PNPM_OPTION_NOT_SUPPORTED. Switch to `pnpm update --latest` for the three providers, which pulls the newest releases and matches the step's intent without the unsupported flag. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oj8aXYorx82K6sUbvK258
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20.x | ||
| node-version: 22.x |
There was a problem hiding this comment.
P0: Publish workflow caches pnpm, enabling cache poisoning into releases
The setup-node step at line 30 and the publish-npm job at line 82 both use cache: 'pnpm'. In a publish workflow triggered by releases, this enables cache poisoning where a compromised cache from another workflow run could inject malicious build artifacts into the release.
Remove cache: 'pnpm' from all setup-node steps in publish.yml.
AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.
<file name=".github/workflows/publish.yml">
<violation number="1" location=".github/workflows/publish.yml:30">
<priority>P0</priority>
<title>Publish workflow caches pnpm, enabling cache poisoning into releases</title>
<evidence>The publish.yml workflow runs on release events and uses cache: 'pnpm' in setup-node actions for both the quality-checks and publish-npm jobs. This enables cache poisoning, where a compromised cache from another workflow run could inject malicious build artifacts into the release.</evidence>
<recommendation>Remove the cache: 'pnpm' input from all actions/setup-node steps in .github/workflows/publish.yml. Continue using pnpm install --frozen-lockfile without the setup-node cache in release workflows.</recommendation>
</violation>
</file>
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20.x | ||
| node-version: 22.x |
There was a problem hiding this comment.
P1: Missing deployment environment on NPM publish job
The publish-npm job does not declare an environment block, bypassing environment-protection rules for releases.
Add environment: { name: npm } to the publish-npm job after runs-on.
AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.
<file name=".github/workflows/publish.yml">
<violation number="1" location=".github/workflows/publish.yml:66">
<priority>P1</priority>
<title>Missing deployment environment on NPM publish job</title>
<evidence>The publish-npm job in .github/workflows/publish.yml publishes packages to the NPM registry but does not declare an environment block. Without a deployment environment, release credentials and deployments are not gated by environment protection rules.</evidence>
<recommendation>Add an environment block to the publish-npm job, e.g. environment: { name: npm }. This enables environment protection rules and scoped secrets for releases.</recommendation>
</violation>
</file>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Around line 102-113: Add `@ai-sdk/provider` to the package.json peerDependencies
alongside the existing AI SDK provider entries, ensuring the public
LanguageModelV4 type has an explicitly declared consumer dependency while
preserving the existing versioning conventions.
In `@pnpm-workspace.yaml`:
- Around line 11-13: Replace the global minimumReleaseAge: 0 setting in
pnpm-workspace.yaml with the pnpm minimumReleaseAgeExclude configuration scoped
to rollup, preserving the ability to install the patched rollup release
immediately while retaining the default release-age protection for all other
dependencies.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 36031217-9257-4326-9f19-029d1fcd4473
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (32)
README.mddocs/basics.mdeslint.config.tspackage.jsonpnpm-workspace.yamlsrc/lib/components/ModelSelect.tsxsrc/lib/components/ProviderSelectionListbox.tsxsrc/lib/components/ui/Listbox.tsxsrc/lib/context/index.tssrc/lib/providers/AnthropicProvider.tssrc/lib/providers/AzureProvider.tssrc/lib/providers/BedrockProvider.tssrc/lib/providers/ClaudeCodeProvider.tssrc/lib/providers/CohereProvider.tssrc/lib/providers/DeepseekProvider.tssrc/lib/providers/GoogleProvider.tssrc/lib/providers/LmStudioProvider.tssrc/lib/providers/MistralProvider.tssrc/lib/providers/MoonshotProvider.tssrc/lib/providers/OllamaProvider.tssrc/lib/providers/OpenAIProvider.tssrc/lib/providers/OpenRouterProvider.tssrc/lib/providers/QwenProvider.tssrc/lib/providers/ZaiProvider.tssrc/lib/providers/configuration.tssrc/lib/storage/modelRepository.tssrc/lib/types/index.tssrc/lib/utils/index.tsstories/Introduction.stories.tsxtests/catalog.modelCatalog.test.tstests/hooks.useModelsWithConfiguredProvider.test.tsxvite.config.ts
💤 Files with no reviewable changes (1)
- src/lib/components/ModelSelect.tsx
| "@ai-sdk/amazon-bedrock": ">=5.0.0", | ||
| "@ai-sdk/anthropic": ">=4.0.0", | ||
| "@ai-sdk/azure": ">=4.0.0", | ||
| "@ai-sdk/cohere": ">=4.0.0", | ||
| "@ai-sdk/deepseek": ">=3.0.0", | ||
| "@ai-sdk/google": ">=4.0.0", | ||
| "@ai-sdk/mistral": ">=4.0.0", | ||
| "@ai-sdk/openai": ">=4.0.0", | ||
| "@ai-sdk/openai-compatible": ">=3.0.0", | ||
| "@openrouter/ai-sdk-provider": ">=3.0.0", | ||
| "ai-sdk-provider-claude-code": ">=4.0.0 <5.0.0", | ||
| "ollama-ai-provider-v2": ">=4.0.0", |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check whether `@ai-sdk/provider` is declared anywhere in package.json peerDependencies/dependencies
jq '.peerDependencies, .dependencies' package.json
# Inspect the generated bundled .d.ts (if present) for unresolved `@ai-sdk/provider` imports
fd -e ts -e d.ts . dist 2>/dev/null | xargs -r rg -n "`@ai-sdk/provider`"Repository: hbmartin/ai-sdk-react-model-picker
Length of output: 696
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== package.json: relevant sections =="
jq '{peerDependencies, dependencies, devDependencies}' package.json
echo
echo "== vite.config.ts =="
sed -n '1,220p' vite.config.ts
echo
echo "== source references to `@ai-sdk/provider` / LanguageModelV4 =="
rg -n "`@ai-sdk/provider`|LanguageModelV4" .Repository: hbmartin/ai-sdk-react-model-picker
Length of output: 10567
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== package.json around line 110-130 =="
sed -n '110,130p' package.json
echo
echo "== package.json around line 160-180 =="
sed -n '160,180p' package.json
echo
echo "== public type exports =="
sed -n '1,220p' src/lib/index.ts
echo
echo "== tsconfig.app.json =="
sed -n '1,220p' tsconfig.app.jsonRepository: hbmartin/ai-sdk-react-model-picker
Length of output: 5076
🌐 Web query:
vite-plugin-dts bundleTypes unresolved external type imports bundledPackages behavior
💡 Result:
In vite-plugin-dts, the bundleTypes option (previously often referred to as rollupTypes in older versions) enables type bundling by leveraging @microsoft/api-extractor [1][2][3]. When this feature is enabled, the plugin attempts to consolidate type definitions into a single file per entry point [1]. Regarding unresolved external type imports and bundledPackages behavior: 1. Handling of External Types: By default, @microsoft/api-extractor treats external packages (found in node_modules) as external dependencies [4]. This means they are not bundled into your declaration file but are instead referenced via import statements in the generated.d.ts files [1][4]. 2. The Role of bundledPackages: The bundledPackages option in vite-plugin-dts allows you to specify a list of package names that should be bundled (inlined) directly into your declaration file instead of being treated as external references [3][5][6]. This is useful when you want to include transitive type dependencies or specific internal monorepo packages within your bundled output [7]. 3. Unresolved Types and Internal Errors: When using bundleTypes: true, you may encounter "Unable to follow symbol" or "Internal Error" messages [1]. - Common Causes: These often arise from non-standard path aliases in your tsconfig.json, complex cross-file re-exports, or internal types generated by frameworks (e.g., Vue's VLS_EmitsToProps) that api-extractor cannot resolve [1]. - Plugin Mitigation: For certain known issues, such as internal Vue types, the plugin attempts to replace unresolved types with empty objects ({}) to prevent the build from failing [1]. - Recommendations: For libraries with multiple entry points that share significant internal code, it is generally recommended to avoid bundleTypes: true, as it processes each entry independently, which can lead to duplication of shared types in every output file [1]. Instead, leaving bundleTypes disabled allows the plugin to maintain the original module structure, which is typically more efficient for multi-entry projects [1]. To configure bundledPackages, you provide an array of strings corresponding to the package names you wish to inline: { plugins: [ dts({ bundleTypes: true, bundledPackages: ['my-internal-lib'] }) ] } [3][6]
Citations:
- 1: https://github.com/qmhc/unplugin-dts/blob/main/docs/en/faq.md
- 2: https://github.com/qmhc/unplugin-dts/blob/main/docs/en/usage.md
- 3: https://github.com/qmhc/vite-plugin-dts?tab=readme-ov-file
- 4: https://github.com/Swatinem/rollup-plugin-dts
- 5: https://unpkg.com/vite-plugin-dts@4.3.0/README.md
- 6: https://github.com/2wheeh/vite-plugin-dts/blob/main/README.md
- 7: https://rslib.rs/config/lib/dts
Add @ai-sdk/provider to peerDependencies in package.json:102-113. LanguageModelV4 is part of the public API, so leaving it only in devDependencies can leave consumer .d.ts resolution depending on an undeclared transitive install.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@package.json` around lines 102 - 113, Add `@ai-sdk/provider` to the
package.json peerDependencies alongside the existing AI SDK provider entries,
ensuring the public LanguageModelV4 type has an explicitly declared consumer
dependency while preserving the existing versioning conventions.
| # Install security patches immediately instead of pnpm 11's staged-release | ||
| # delay, so the transitive override below can resolve to the patched release. | ||
| minimumReleaseAge: 0 |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Scope the release-age exemption to rollup pnpm-workspace.yaml:11-13
minimumReleaseAge: 0 disables pnpm’s 24h supply-chain protection for every dependency. Use minimumReleaseAgeExclude for the patched rollup release instead.
Suggested change
-# Install security patches immediately instead of pnpm 11's staged-release
-# delay, so the transitive override below can resolve to the patched release.
-minimumReleaseAge: 0
+# Keep pnpm's 24h staged-release delay, but let the patched rollup release through.
+minimumReleaseAgeExclude:
+ - rollup📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Install security patches immediately instead of pnpm 11's staged-release | |
| # delay, so the transitive override below can resolve to the patched release. | |
| minimumReleaseAge: 0 | |
| # Keep pnpm's 24h staged-release delay, but let the patched rollup release through. | |
| minimumReleaseAgeExclude: | |
| - rollup |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pnpm-workspace.yaml` around lines 11 - 13, Replace the global
minimumReleaseAge: 0 setting in pnpm-workspace.yaml with the pnpm
minimumReleaseAgeExclude configuration scoped to rollup, preserving the ability
to install the patched rollup release immediately while retaining the default
release-age protection for all other dependencies.
Summary
Issue #47 asks for GLM 4.6 (Z.ai) and Qwen 3 (Alibaba Cloud) support. Those providers already exist in the tree —
ZaiProvider(GLM 4.6 / 4.5 / 4.5 Air) andQwenProvider(Qwen3 Max / Qwen3 Coder Plus / Qwen Plus / Qwen Turbo) — and both are registered inallProviders, exported, documented, and covered bytests/providers.qwenZai.test.ts.They already do the right thing per the request: each re-uses an existing AI SDK provider (
@ai-sdk/openai-compatible, the AI-SDK-recommended path for the OpenAI-compatible DashScope and Z.ai endpoints) and makes no direct API calls. Purpose-built community packages (qwen-ai-provider,zhipu-ai-provider) were evaluated and rejected — they are version-misaligned with this project's AI SDK (one still targets@ai-sdk/providerv1 /LanguageModelV1).So the substance of this PR is bringing the whole dependency stack up to latest so those providers (and the rest of the library) keep working on current tooling, then verifying the result end-to-end.
Dependency upgrades
ai,@ai-sdk/provider(v2 → v4), and every@ai-sdk/*provider, plus@openrouter/ai-sdk-provider,ollama-ai-provider-v2, andai-sdk-provider-claude-code. v7 providers now emitLanguageModelV4(specificationVersion: "v4"), so thecreateInstancecontract was renamedLanguageModelV2 → LanguageModelV4across the base class, all 16 providers, andgetSdkLanguageModel. Peer floors were raised to the majors that emitLanguageModelV4.@vitejs/plugin-react6,vite-plugin-dts5 (rollupTypes→bundleTypes, now needs@microsoft/api-extractor), jsdom 29, Testing Library, prettier 3.9.eslint-plugin-import→eslint-plugin-import-xbecause the former's latest (2.32.0) crashes on ESLint 10 (itsorderrule calls the removedsourceCode.getTokenOrCommentBeforeAPI).eslint-plugin-storybook), which also cleared mostpnpm auditfindings.Deliberate holds and decisions
typescript ">=4.8.4 <6.1.0", so TypeScript 7 would break the lint pass.tailwind-presetas public API; Tailwind 4's CSS-first rewrite would be a breaking change for consumers and a rewrite of the theming / VSCode-integration layer — out of scope for a dependency bump and best decided on its own.pnpm-workspace.yamladded. pnpm 11 no longer reads settings from the package.jsonpnpmfield. It carries arollupsecurity override (dev/build tooling only — nothing overridden ships in the published package), an explicit build-script opt-out, andminimumReleaseAge: 0.LanguageModelV4, andcreateInstancereturnsLanguageModelV4. Consumers must be on AI SDK v7-era providers. Suggest a minor version bump on the next release (left for the maintainer'snpflow).Verification
Every CI gate passes locally against the upgraded tree:
tsc -b(typecheck)eslint .prettier --checkvitest(34 passed, 4 skipped)vite build+ packaging (publint+attw)pnpm audit --audit-level=moderatepnpm install --frozen-lockfilestorybook buildDocs, the package description, and the Storybook intro were updated from "AI SDK v5 /
LanguageModelV2" to "AI SDK v7 /LanguageModelV4".Closes #47
🤖 Generated with Claude Code
https://claude.ai/code/session_015oj8aXYorx82K6sUbvK258
Generated by Claude Code