fix: drop transitive Zod 3 via type-only @ag-ui/core@0.1.0#738
Draft
tombeckenham wants to merge 1 commit into
Draft
fix: drop transitive Zod 3 via type-only @ag-ui/core@0.1.0#738tombeckenham wants to merge 1 commit into
tombeckenham wants to merge 1 commit into
Conversation
…520) @ag-ui/core@0.0.x infers its public types from Zod 3 schemas and carries zod ^3.22 as a hard runtime dependency, dragging Zod 3 into every consumer's tree and type graph. Apps on Zod 4 (e.g. @hookform/resolvers@5) hit zod/v4/core version-mismatch errors (TS2769) when their lockfile resolves the resolver's zod/v4 import to the Zod 3 shim. @ag-ui/core@0.1.0 makes the main entry type-only with zero runtime deps and moves schemas to an opt-in /schemas subpath (zod ^3.24 || ^4 optional peer). This change: - bumps @ag-ui/core to ^0.1.0 - loads RunAgentInputSchema lazily from @ag-ui/core/schemas inside chatParamsFromRequestBody, typed against a local structural interface so zod never appears in this package's compilation or public .d.ts - declares zod (^3.24.0 || ^4.0.0) as an optional peer dependency — only server code calling chatParamsFromRequest* needs zod installed; calling without it rejects with an actionable AGUIError Verified against a packed build: a zod-4 + @hookform/resolvers@5 consumer gets exactly one zod in its tree and tsc --noEmit passes with skipLibCheck: false; a zod-free consumer imports @tanstack/ai fine. Blocked on the @ag-ui/core@0.1.0 npm release (ag-ui-protocol/ag-ui#1637, conflict resolution in ag-ui-protocol/ag-ui#1918). Lockfile to be regenerated once published. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Blocked on the
@ag-ui/core@0.1.0npm release. The upstream extraction of zod from@ag-ui/coreis ag-ui-protocol/ag-ui#1637; we resolved its merge conflicts in ag-ui-protocol/ag-ui#1918. Once 0.1.0 is published: regeneratepnpm-lock.yaml, mark ready for review.🎯 Changes
Fixes #520.
@ag-ui/core@0.0.xinfers its public types from Zod 3 schemas and carrieszod ^3.22as a hard runtime dependency, dragging Zod 3 into every consumer's tree and type graph. Apps on Zod 4 (e.g. with@hookform/resolvers@5) hitzod/v4/coreversion-mismatch errors (TS2769: The types of '_zod.version.minor' are incompatible) when their lockfile resolves the resolver'szod/v4import to Zod 3.25's shim.@ag-ui/core@0.1.0makes the main entry type-only with zero runtime dependencies and moves the zod schemas to an opt-in/schemassubpath (zod^3.24 || ^4optional peer). This PR:@ag-ui/coreto^0.1.0— Zod 3 disappears from consumer installs entirelyRunAgentInputSchemalazily from@ag-ui/core/schemasinsidechatParamsFromRequestBody, typed against a local structural interface so zod never appears in this package's compilation or its public.d.ts(the subpath's emitted declarations are pinned to one zod major; ours must not be)zod(^3.24.0 || ^4.0.0) as an optional peer of@tanstack/ai: only server code callingchatParamsFromRequest*needs it; calling without zod rejects with an actionableAGUIError. Wire behavior unchanged.chatParamsFromRequestAPI doc, and theag-ui-protocolagent skillVerification (against packed builds)
@tanstack/ai@latest(control): zod 4 +@hookform/resolvers@5consumernpm ls zodshows nestedzod@3.25.76under@ag-ui/corezod@4.4.3in the whole tree;tsc --noEmitclean withskipLibCheck: falsechatParamsFromRequestBodyparses valid bodies (incl.partsre-attach) and rejects invalid ones withAGUIError, validated by upstream schemas running on zod 4import '@tanstack/ai'works; callingchatParamsFromRequest*rejects with the install-zod message✅ Checklist
pnpm run test:pr. (Run with@ag-ui/corepointed at a tarball built from ag-ui#1918, since 0.1.0 isn't published yet — all targets green, incl. unit (1003), types, lint, knip, sherif, docs, publint, build. E2E: 259 passed, 4 flaky multimodal-image retries unrelated to this change.)🚀 Release Impact
🤖 Generated with Claude Code