Mark all publishable @copilotkitnext/* packages as deprecated in
package.json, pointing users to the @copilotkit/* equivalents.
V2 features will be available under the /v2 subpath.
Affected packages: shared, core, agent, angular, react, runtime,
sqlite-runner, web-inspector.
Same fix as zod-regression — the mock was missing addHookRenderToolCall
and removeHookRenderToolCall methods.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The mock was missing addHookRenderToolCall/removeHookRenderToolCall methods
introduced by the separate hook vs prop render tool call storage refactor.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address review feedback: remove `as ReactToolCallRenderer` cast in
useFrontendTool by guarding with `tool.parameters` check (matching
CopilotKitProvider's pattern). Remove unused ReactToolCallRenderer
imports from use-frontend-tool.tsx and use-render-tool.tsx.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add tests verifying:
- useFrontendTool render registrations survive StrictMode remount
- Hook and prop render entries coexist through StrictMode remount
- Hook render entries survive provider prop changes
- Update useRenderTool test mock to match new addHookRenderToolCall API
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CopilotKitProvider's didMountRef guard breaks under React Strict Mode:
refs persist across the simulated unmount/remount cycle, causing the
provider's setRenderToolCalls effect to overwrite registrations from
useFrontendTool and useRenderTool hooks.
Split render tool call storage in CopilotKitCoreReact into two layers:
- _renderToolCalls: prop-based entries (set by provider)
- _hookRenderToolCalls: hook-based entries (set by useFrontendTool/useRenderTool)
The renderToolCalls getter merges both with a cached result for
useSyncExternalStore referential stability. Provider and hooks can
never overwrite each other, eliminating the race by design.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace Zod-specific types (z.ZodType, z.infer) with Standard Schema V1
interfaces across the V2 public API surface. This allows users to use any
Standard Schema V1 compatible library (Zod 3.24+, Valibot v1+, ArkType v2+)
for tool parameters, with zero breaking changes for existing Zod users.
- Add schemaToJsonSchema() utility in shared with Standard JSON Schema V1
support and Zod fallback
- Update FrontendTool, ToolDefinition, useRenderTool, useComponent, and
Angular tool types to accept StandardSchemaV1
- Move zod from dependencies to devDependencies in core and angular
- Add runtime tests (40) and type-level tests (38) across all packages
verifying Zod, Valibot, and ArkType compatibility
Covers the dynamic CSS import behavior, graceful error handling,
and a regression guard ensuring the static katex CSS import doesn't
creep back into CopilotChatAssistantMessage.
## Summary
Fixes#2851
### Problem
Next.js rejects global CSS imports from within `node_modules`, causing
build failures:
```
Global CSS cannot be imported from within node_modules.
Location: node_modules/@copilotkitnext/react/dist/index.mjs
Import trace:
katex/dist/katex.min.css
@copilotkitnext/react/dist/index.mjs
@copilotkit/react-core/dist/v2/index.mjs
```
This affects all Next.js consumers of CopilotKit (versions 1.50.0+).
### Root Cause
The static `import 'katex/dist/katex.min.css'` in
`CopilotChatAssistantMessage.tsx` (line 22) is preserved in the dist
bundle by tsdown's unbundle mode. Next.js webpack statically analyzes
imports and rejects global CSS from `node_modules`.
### Fix
Replace the static CSS import with a `useKatexStyles()` hook that
dynamically loads the stylesheet at runtime via `useEffect`:
- Created `useKatexStyles.ts` — a singleton hook that uses `import()` to
lazy-load KaTeX CSS
- Dynamic imports bypass Next.js static analysis (the css-npm check only
applies to static imports)
- Uses a module-level flag to ensure the CSS is only injected once
### Testing
- 2 consecutive clean test passes: **748/748 tests** (38 test files)
- Type-check shows only pre-existing errors from
`@copilotkitnext/web-inspector` (unrelated)