Repository navigation
feat!: slim the 2.0 package dependencies and require Zod 4 - #8143
Merged
Merged
Conversation
AlemTuzlak
requested review from
jpr5,
mme,
rainerhahnekamp,
tylerslaton and
wolfmanfx
as code owners
November 2, 2026 11:49
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 1
Please check the settings in the CodeRabbit UI or the
|
Contributor
Production Digest-Pinning AuditAll 43 services digest-pinned. Run 2026-11-02 06:25:44 PST — 0 finding(s). |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/learning
@copilotkit/markdown-renderer
@copilotkit/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/runtime
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
4 tasks
…/runtime BREAKING CHANGE: the @copilotkit/shared/event-transforms entry point is removed. Import transformRecordedEvents, OpenGenerativeUIMiddleware, ArgsParser, and A2UIMiddleware from @copilotkit/runtime. The v2-migration codemod rewrites these imports. @copilotkit/shared no longer depends on rxjs, clarinet, or @ag-ui/a2ui-middleware. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lemetry entry The runtime has its own lambda-only telemetry client, so nothing imported the Segment client from @copilotkit/shared/telemetry. Drop it, its v1 event catalog, and @segment/analytics-node instead of moving dead code into the runtime. The telemetry fragment emitter now reads the runtime catalog only. BREAKING CHANGE: the @copilotkit/shared/telemetry entry point is removed, and @copilotkit/shared no longer exports the TelemetryCapture and TelemetryIdentity types or depends on @segment/analytics-node. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d a dev dependency convertJsonSchemaToZodSchema moves into @copilotkit/sdk-js (its only caller), and getZodParameters into @copilotkit/vue's v1 hooks. Behavior is unchanged. The converter tests move with them. BREAKING CHANGE: @copilotkit/shared no longer exports convertJsonSchemaToZodSchema or getZodParameters, and no longer depends on zod. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pino-pretty is a development formatter that needs Node streams, and the runtime loaded it on every debug logger. The debug logger now writes pino's JSON lines to stdout; pipe them through `npx pino-pretty` to format them. The edge smoke test no longer stubs pino-pretty. BREAKING CHANGE: with debug: true the runtime writes JSON log lines instead of colorized pino-pretty output, and no longer installs pino-pretty. Co-Authored-By: Claude Opus 5.5 <[email protected]>
yauzl needs Node's fs, stream, and zlib, so the edge smoke test had to stub it. readArchive now parses the ZIP central directory itself and inflates with fflate, which runs on Node and on edge runtimes. It keeps every check the yauzl reader had: entry and size caps, zip-slip and control-byte path rules, duplicate names, symlink and other file types, encryption, compression method, and central/local header agreement. Deflated members stop decoding as soon as they pass their declared size. It now takes and returns Uint8Array. The edge smoke test no longer stubs yauzl. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move the framework-agnostic Open Generative UI logic into @copilotkit/core: the content types and constants, the throttle policy, partial-HTML processing, and an OpenGenerativeUIController that runs the preview and final websandbox iframes inside a host element. @jetbrains/websandbox is now a core dependency, still loaded with a dynamic import for SSR safety, with an injectable loader for tests. The UMD build bundles it, because a UMD script cannot import() a bare specifier. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… React, Vue and Angular The React, Vue and Angular renderers each had their own copy of the sandbox lifecycle, throttling and partial-HTML helpers. They now render the state of core's OpenGenerativeUIController and hand it their container element, content and sandbox functions. @jetbrains/websandbox is no longer a dependency of react-core, vue or angular. The public exports stay: the zod schemas remain in each package, the content types now come from core, and Vue keeps processPartialHtml and extractCompleteStyles as re-exports. The providers use core's design skill and tool name constants. Behaviour now matches across frameworks: Vue measures the final height like React and Angular, a new generation removes the old sandbox at once, and a recreated final sandbox runs jsFunctions and jsExpressions again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The inspector imported the whole lucide icons map (~1,800 icons) to render 58 of them. Copy those icon nodes verbatim from [email protected] into src/lib/icons.ts with the ISC attribution, derive IconName from that map so a missing icon is a type error, and drop the lucide dependency. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Parse announcement bodies with @copilotkit/markdown-renderer and render the AST to HTML in src/lib/markdown.ts, keeping the old marked overrides: links and bare URLs go through the safe-href + ref-param policy and open in a new tab with rel="noopener", raw HTML renders as escaped text, and fenced code keeps the copy-button wrapper. Text, attributes, and code are escaped; unsafe image URLs now fall back to their alt text. Lists stay tight when only a trailing blank line follows them, and task list markers still render as disabled checkboxes, matching marked's output for the current What's new feed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…runtime No code imported it; it only ran a postinstall that reported installs. The runtime's own opt-in telemetry is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cy ranges - engines: browser-side packages declare node >=20; channels-* declare the runtime's floor (^20.19.3 || >=22.13.0) because the runtime depends on them. - @Ag-ui peer floors: shared's @ag-ui/core and mcp-apps-renderer's @ag-ui/client peers move from 0.0.x to ^1.0.2, the version every package already uses. - rxjs: channels-slack and channels-teams pin 7.8.1 like core, runtime and @ag-ui/client, so installs keep one copy. Angular drops its rxjs dependency and keeps only the peer. - web-inspector's lit matches web-components' ^3.3.2. - voice's runtime peer is workspace:^ instead of an exact pin. - sdk-js drops the typescript peer and raises the langchain peer floors to the versions it is tested against. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and Angular React, Vue and Angular each kept their own copy of buildCatalogContextValue and extractCatalogComponentSchemas, and each called zod-to-json-schema directly. A2UI catalog component schemas are Zod 3 schemas: @a2ui/web_core builds its basic catalog with Zod 3, its binder reads Zod 3 internals, and it does not export a standalone JSON Schema helper (the only route, MessageProcessor.getClientCapabilities, rewrites REF-tagged nodes into $refs and would change what the agent sees). So one conversion with zod-to-json-schema has to stay. It now lives once, in a new React-free subpath, @copilotkit/a2ui-renderer/catalog-schema. a2ui-renderer is the narrowest package that already owns A2UI and zod-to-json-schema, and its React peers are optional, so Vue and Angular can depend on it without installing React. React's catalog-utils delegates to it and keeps its basic-catalog default. The output is unchanged. a2ui-renderer now declares zod ^3.25.76 and zod-to-json-schema ^3.25.2, the ranges @a2ui/web_core itself uses, so a single Zod 3 copy serves both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CopilotKit sends every tool schema to the agent as JSON Schema, and schemaToJsonSchema in @copilotkit/shared reads it from the schema itself: Standard JSON Schema (`~standard.jsonSchema`), then a `toJSONSchema()` method. Zod 3 has neither, so core, react-core, vue, angular and channels-core each injected zod-to-json-schema as a third, Zod-3-only path. 2.0 requires a schema library that describes itself: Zod 4.2+ (the first release with both `~standard.jsonSchema` and `.toJSONSchema()`; 4.0 and 4.1 only have the top-level z.toJSONSchema), Valibot via toStandardJsonSchema, or ArkType 2.1.28+. - shared: remove the Zod 3 fallback and SchemaToJsonSchemaOptions; the error now names Zod 4.2+, Valibot and ArkType. - core, react-core, vue, angular, channels-core: drop the injected converter and the zod-to-json-schema dependency. - zod declarations: one range, ^4.2.0. Regular dependency where a package uses zod at runtime (react-core, vue, angular, runtime, mcp-apps-renderer), with no zod peer because user schemas are Standard Schema; peer where output must interoperate with the user's zod (sdk-js, intelligence-langgraph, intelligence-mastra); devDependency where only tests use it. react-native never imports zod, so its optional peer goes. a2ui-renderer stays on Zod 3 (see the previous commit). - root pnpm.overrides: `zod: >=3.22.3` replaced every zod range in the tree with one resolution, which would force Zod 4 onto @ag-ui/* and @a2ui/web_core internals that need Zod 3. The security floor is now a selector override, `zod@<3.22.3: ^3.22.3`. - A2UI: catalog schemas must stay Zod 3 for @a2ui/web_core, and comparing two zod declaration copies makes tsc run out of memory. Angular's A2UI definition types now derive from web_core's ComponentApi schema type, react-core's SurfaceModel catalog is Catalog<any>, and tests that build A2UI catalogs import Zod 3 through a `zod-v3` npm alias devDependency. - vue: hand core the raw tools, renderers and sandbox functions. Zod 4 schemas have a non-configurable `_zod` property, so a Vue reactive proxy around one throws on access. - runtime: convertJsonSchemaToZodSchema only attaches a description the JSON Schema had, since Zod 4 emits `description: ""`. - Tests: assert Zod 4 behaviour (required keys in inferred types, Zod 4's JSON Schema for tuples, records and intersections), keep the Zod 3 wording that channels-core's single-string schema still promises, and drop the zod-to-json-schema parity tests. BREAKING CHANGE: Zod 3 schemas are no longer accepted for tool parameters, tool-call renderer args, generative UI props or sandbox functions. Upgrade to zod ^4.2.0, or use Valibot or ArkType. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The tool card listed parameters by walking Zod 3 internals (`_def.typeName`, `_def.shape`). A Zod 4 schema has `_def` but no `typeName`, so every Zod 4 tool showed no parameters, and Valibot or ArkType tools never did. Describe any Standard Schema through schemaToJsonSchema and read the properties from the JSON Schema, which the plain-JSON-Schema branch already handled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Zod 4 keeps the Zod 3 spellings below but marks them @deprecated: - `.passthrough()` -> `.loose()` - `z.string().email()` / `.url()` -> `z.email()` / `z.url()` - `z.string().datetime({ offset: true })` -> `z.iso.datetime({ offset: true })` - `z.string().uuid()` -> `z.guid()` `z.guid()` rather than `z.uuid()` on purpose: Zod 3's `.uuid()` accepted any 8-4-4-4-12 hex id, and Zod 4's `.uuid()` also checks the RFC 9562 version and variant bits. `z.guid()` keeps the id the intelligence platform hands back validating exactly as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The v2 migration guide gets an "Upgrade to Zod 4.2 or later" step: what breaks (Zod 3 schemas in tool parameters, tool renderer args and sandbox functions), the fix (zod ^4.2.0, no code change), why `zod/v4` from Zod 3.25 and `zod/mini` do not work (neither implements Standard JSON Schema), the Valibot and ArkType alternatives, and that A2UI catalogs stay on Zod 3, with an npm alias for apps that install Zod 4. The LangGraph quickstart told TypeScript agents to install zod@3 for @copilotkit/sdk-js, whose zod peer is now ^4.2.0, and the generative UI catalog page still listed zod 3. The docs snippet check now resolves zod ^4.2.0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
intelligence-langgraph and intelligence-mastra import from "zod/v4", which Zod 3.25 also ships, and never convert user schemas through Standard JSON Schema. Narrowing their peer to ^4.2.0 only stopped the langgraph-js starter (Zod 3.25.76) from adding the adapter, which validate-starter-deps reports as an adapter-floor violation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CopilotKit 2.0 reads tool schemas through Standard JSON Schema, which Zod 3 does not implement, so examples still on Zod 3 failed at run time (for example the mastra-pm v2 chat transport e2e). Every workspace app that depends on @copilotkit/* now declares zod ^4.2.0. - A2UI catalog schemas (angular demo, showcase/angular) import from a zod-v3 alias, because @a2ui/web_core reads Zod 3 internals. - Zod 4 API updates: .passthrough() -> .loose(), two-argument z.record, required_error -> error. - form-filling: @hookform/resolvers ^5, the first major that handles Zod 4 errors. - generative-ui-shop: drop the zod-to-json-schema shim that added ~standard.jsonSchema; Zod 4.2+ provides it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The upstream ag-ui dojo is a 1.x app. It depends on @copilotkit/react-ui and @copilotkit/runtime-client-gql and imports the react-core and runtime /v2 subpaths, which 2.x removes. Its link-cpk.js step therefore fails on every PR into 2.0.0. Skip the suites for 2.x base branches until the dojo moves to the 2.x API. Co-Authored-By: Claude Opus 5.5 <[email protected]>
With Zod 4, `import { z } from "zod"` binds the re-exported `z`
namespace object, which esbuild (and so the Angular CLI) cannot
tree-shake. It keeps every Zod locale, about 450 KB raw instead of
about 85 KB. `import * as z from "zod"` is the form the Zod 4 docs use
and tree-shakes normally. Switch angular, mcp-apps-renderer,
react-core, react-native, vue and the Angular showcase to it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Open Generative UI config loads with the app shell. Its two sandbox function schemas used Zod, and @modelcontextprotocol/ext-apps imports the whole `z` namespace from zod/v4. Because both share one Zod 4 copy, the full Zod bundle with its locales (about 430 KB) went into the first load and failed the bundle budget. Write the two schemas as plain Standard Schemas with a JSON Schema, and test them. The first load is now 1,484,994 bytes raw (201 KB gzip), under 2.0.0's 1,486,215. Re-record the initial baseline to this size. Co-Authored-By: Claude Opus 5.5 <[email protected]>
AlemTuzlak
force-pushed
the
alem/2.0-deps-cleanup
branch
from
November 2, 2026 14:08
4d52916 to
aa921b8
Compare
Contributor
|
Size Change: +15.3 kB (+0.75%) Total Size: 2.05 MB 📦 View Changed
ℹ️ View Unchanged
|
Every package now declares engines.node, and @copilotkit/sdk-js raises its LangChain peers to the 1.x versions it is tested with. Add a step to the v2 guide with both tables and the install command. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 2, 2026
Closed
2 of 4 tasks
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.
Review this PR one commit at a time: each of the 22 commits is one change with its own tests. The PR removes about 20 dependencies from the published 2.0 packages, moves server-only code out of
@copilotkit/shared, and makes tool schemas need Zod 4.2 or later. It changes no AI SDK provider dependencies; those are handled in a different PR.What does this PR do?
Dependencies removed
corezod-to-json-schemasharedclarinet,rxjs,zod,@ag-ui/a2ui-middleware,@segment/analytics-nodereact-core,vue,angular@jetbrains/websandbox,zod-to-json-schema,@scarf/scarf(react-core)core, and React, Vue and Angular use it from there.web-inspectorlucide,marked@copilotkit/markdown-renderer.runtimepino-pretty,yauzl,@scarf/scarfpino-prettyis a dev tool.yauzlis Node-only, sofflatereplaces it.Moved code
transformRecordedEvents,OpenGenerativeUIMiddleware,A2UIMiddleware) move from@copilotkit/shared/event-transformsto@copilotkit/runtime. The v2 codemod rewrites the import.@copilotkit/core. Each framework renderer drops from 550 to 600 lines to about 210.sharedto their only users:sdk-js(convertJsonSchemaToZodSchema) andvue(getZodParameters).Consistency fixes
engines.node. Browser packages use>=20. Channels packages use the runtime floor, because the runtime depends on them.@ag-uipeer floors (>=0.0.48,>=0.0.59) become^1.0.2.rxjsis7.8.1everywhere, the same as@ag-ui/client, so installs get one copy.litis^3.3.2everywhere. Thevoicepeer onruntimeisworkspace:^.sdk-jsdrops itstypescriptpeer and raises its LangChain peer floors to the tested 1.x versions (@langchain/core >=1.1.41,@langchain/langgraph >=1.2.9,langchain >=1.3.4).Smaller Zod 4 bundles
The browser packages (
angular,mcp-apps-renderer,react-core,react-native,vue) now useimport * as z from "zod". With Zod 4,import { z } from "zod"keeps every Zod locale in esbuild bundles: about 450 KB raw instead of about 85 KB.The Angular showcase also keeps Zod out of its first load. Its first load is now 1,484,994 bytes raw (201 KB gzip). That is slightly smaller than
2.0.0(1,486,215 bytes). Before this fix, it was 1,941,221 bytes and failed the bundle budget. The budget baseline is re-recorded to the new size.Dojo e2e skipped for 2.x
The upstream ag-ui dojo is a 1.x app. It needs
@copilotkit/react-ui,@copilotkit/runtime-client-gqland the/v2subpaths, which 2.x removes. The dojo workflow now skips its suites for PRs into a 2.x branch. Before, every PR into2.0.0failed these 15 jobs.Examples moved to Zod 4
The 22 example and showcase apps that build against the workspace packages now declare
zod ^4.2.0. Before this change,mastra-pmfailed its e2e test, because its Zod 3 tool schema made the run fail. A2UI catalogs inexamples/v2/angular/demoandshowcase/angularuse thezod-v3alias, as the migration guide describes.Behavior changes from the shared sandbox controller
jsFunctionsandjsExpressionsagain after the sandbox is built again.BREAKING CHANGE: Tool and renderer schemas must use Zod 4.2 or later, or another Standard JSON Schema library (Valibot, ArkType 2.1.28 or later). Install
zod@^4.2.0.zod/v4from Zod 3.25 does not work. Import the event transforms from@copilotkit/runtime(run the v2 codemod).@copilotkit/shared/telemetryand@copilotkit/shared/event-transformsare removed.@copilotkit/sdk-jsneeds LangChain 1.x. Every package declares Node.js 20 or later. Runtime debug logs are plain JSON lines; pipe them throughnpx pino-prettyto read them. The steps are inmigrate/v2.mdx,migrate/shared-2.0.mdxandmigrate/runtime-2.0.mdx.Related PRs and Issues
@copilotkit/core) and feat(runtime)!: remove Node-only code from the runtime, and smoke-test it on Workers and Vercel Edge #8108 (edge-safe runtime).2.0.0build of@copilotkit/core(@ag-ui/coreas a dependency).Checklist
!(for examplefeat(react-core)!: ...) and the description has aBREAKING CHANGE:line with migration steps. See VERSIONING.mdTesting
Commands run (all passed)
pnpm nx run-many -t build,check-types,test --projects='@copilotkit/*'. Two demo apps failed the same way on2.0.0before this PR:react-native-demo(Jest parse error) andangular-demo-server(toReversed).pnpm nx run runtime-edge-smoke:smoke(Cloudflare Workers and Vercel Edge).pnpm nx run @copilotkit/react-core:test:browser(the real sandbox in Playwright).pnpm run lint,pnpm run check:packages,pnpm check:public-api-manifest,pnpm nx run repo-scripts:check-docs-snippets(1612 snippets).pnpm --dir showcase/angular build, which includes the bundle budget check, andng testfor the Angular showcase (168 tests).validate-starter-deps,validate-channels-zod,package-licenses:test,verify-cross-scope-pins, andcommitlintover all commits.Skipped: the dotnet, Go, Ruby and Python suites. These tools are not installed on my machine, and this PR does not change those packages.
Manual test
pnpm install --frozen-lockfile.pnpm nx run @copilotkit/react-core:test:browserto see the shared sandbox controller in a real browser.skills/inspector-workbench/SKILL.md). Open "What's new". The icons and the markdown look the same as on2.0.0.pnpm nx run runtime-edge-smoke:smoke. The packed runtime has no Node built-ins.How this PR makes testing easy
packages/core/src/open-generative-ui/: tests for the throttle rules and the sandbox lifecycle, with a fake websandbox loader.packages/runtime/.../skill-registry/__tests__/archive.test.ts: 52 unzip tests, including the 28 shared conformance fixtures.packages/web-inspector/src/lib/__tests__/: tests for the markdown escaping, unsafe URLs and the icon coverage.showcase/angular/.../open-generative-ui-config.test.ts: tests for the sandbox function schemas.Risk / rollback
@a2ui/web_corereads Zod 3 internals. The guide shows azod-v3npm alias for them.additionalProperties: false. Records getpropertyNames.Public API change
Before
After
🤖 Generated with Claude Code