fix(js): pin ai to v4 — unbreak main (broken by #13)#14
Conversation
…dabot PR #13 bumped the ai devDependency to v5, but the Vercel middleware targets the v4 LanguageModelV1Middleware interface (v5 renamed it to LanguageModelV2Middleware and changed usage field names), so tsc/tsup failed on main. Pin ai back to ^4.0.0 (matches the >=4.0.0 <5.0.0 peer range) and regenerate the lockfile — build, typecheck, and tests green again. Add a Dependabot ignore for ai major bumps so this can't recur; supporting v5/v6 is a deliberate migration, not an auto-bump.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Changesai v4 SDK pin and Dependabot setup
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Hotfix to restore the JS package build/publish pipeline by aligning the ai dependency back to the Vercel AI SDK v4 middleware interface and preventing future major auto-upgrades of ai via Dependabot.
Changes:
- Pin
jsdevDependencyaiback to^4.0.0to match the existing peer range (>=4.0.0 <5.0.0). - Regenerate
js/package-lock.jsonto resolveai@4.3.19and the corresponding v4 dependency tree. - Add
.github/dependabot.ymlto ignore major updates foraiin/js.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
js/package.json |
Downgrades/pins ai devDependency to v4 to restore TS build compatibility. |
js/package-lock.json |
Updates lockfile to reflect ai@4.3.19 and its transitive dependencies. |
.github/dependabot.yml |
Prevents Dependabot from proposing ai major bumps for the /js workspace. |
Files not reviewed (1)
- js/package-lock.json: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Hotfix — main is currently red. PR #13 merged a Dependabot bump of the
aidevDependency to v5, but the Vercel AI SDK middleware targets the v4 interface (LanguageModelV1Middleware,usage.promptTokens). v5 removed/renamed those (LanguageModelV2Middleware,usage.inputTokens), sotsc/tsupfail:Fix
aidevDependency back to^4.0.0(matches the unchanged>=4.0.0 <5.0.0peer range); regenerate the lockfile → resolvesai@4.3.19..github/dependabot.ymlthat ignoresaimajor updates (honored by security updates too), so this can't recur.Verified
npm run build✅ ·tsc --noEmit✅ ·vitest run→ 7 passed ✅ (ai@4.3.19).Note / follow-up decision
Pinning to v4 means the middleware only supports consumers on ai v4. Since ai v5 is now the current major, new Vercel AI SDK users (on v5) can't use this middleware until it's migrated. That migration (rewrite against
LanguageModelV2Middleware, rename usage fields, bump the peer range, update README/tests) is a real, deliberate change — worth doing if there's v5 demand, but not as an auto-bump. Flagging so it's a conscious choice, not a silent gap.The dev-only
jsondiffpatchadvisory that triggered these bumps lives inai's transitive dev tree (types/tests only, never shipped to consumers), so accepting it to keep the build working is the right trade.Summary by CodeRabbit