Repository navigation
feat!: remove v1 and the /v2 subpaths from react-core and runtime - #8084
Conversation
Users migrate to 2.0 with `npx codemod @copilotkit/v2-migration`, published to the Codemod registry. It moves the /v2 import paths to the package roots, renames CopilotKitProvider to CopilotKit and agent= to agentId=, moves v1 imports whose 2.0 API is the same, and marks every other v1 API with a TODO(copilotkit-2.0) comment that names its replacement. A packaged agent skill resolves the TODOs. scripts/v1-api.ts snapshots scripts/deprecations/v1-public-api.mjs, which stops working once v1 is deleted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The 2.0 provider stays CopilotKitProvider. The codemod now moves the v1 <CopilotKit> (also re-exported from /v2) to it, instead of renaming CopilotKitProvider to CopilotKit. - Table lookups used `in`, so strings such as "constructor" or "toString" matched Object.prototype and were rewritten to the Object function's source. Lookups now read own keys only, with a regression fixture. - Document --allow-dirty for non-interactive runs, and that paths inside template literals are left alone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2.0 drops the v1 SDK. react-core and runtime now export the former v2 API from their package roots, and the /v2 subpaths are gone: - @copilotkit/react-core/v2[/headless|/context|/generative-ui|/styles.css] -> @copilotkit/react-core[/headless|/context|/generative-ui|/styles.css] - @copilotkit/runtime/v2[/express|/hono|/node] -> @copilotkit/runtime[/express|/hono|/node] Removed with v1: - @copilotkit/react-ui, @copilotkit/react-textarea, @copilotkit/runtime-client-gql - @copilotkit/runtime/langgraph; LangGraph agents come from @ag-ui/langgraph - the v1 CopilotKit provider: use CopilotKitProvider (agent -> agentId) - the service adapters and the GraphQL endpoint, and the dependencies only they used (graphql, type-graphql, class-validator, langchain peers, ...) The v2 code that still lived in v1 (logger, telemetry notice, MCP endpoint description, test helpers) moved into the flattened sources. In-repo packages and the workspace examples were migrated with the @copilotkit/v2-migration codemod; the five public examples in examples/v1 stay at their paths, and research-canvas and travel now send the @ag-ui/langgraph event names instead of the CopilotKit ones. The other examples/v1 folders were v1-only and are deleted. The repo's oxlint plugin lived in react-ui and moves to tools/oxlint-rules. Refs PE-1073 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
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
|
Production Digest-Pinning AuditAll 43 services digest-pinned. Run 2026-10-30 02:30:43 PDT — 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: |
|
Size Change: -210 kB (-9.48%) ✅ Total Size: 2.01 MB 📦 View Changed
ℹ️ View Unchanged
|
…v1-apis-and-the-old-uis
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…notice Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adapt the native styles work to #8084, which moved react-core's src/v2 up to src and removed the /v2 subpaths: - react-core: no ./styles.css export, no build:css, and no Tailwind or class-merge dependencies. src/index.ts exports CopilotKitStyles. - Examples drop the new @copilotkit/react-core/styles.css imports. - web-components keep reading the theme from core's theme.css. - The v2-migration codemod deletes stylesheet imports instead of rewriting them to @copilotkit/react-core/styles.css, which no longer exists. remove-stylesheet-import also removes that path and the v1 @copilotkit/react-ui/styles.css. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…start The page came into 2.0.0 from main and still imported @copilotkit/react-core/v2 and @copilotkit/runtime/v2, which #8084 removed. Use the root entry points and CopilotKitProvider, and drop the stylesheet import, so check-docs-snippets passes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…or breaks (#8202) Most react-core slot tests passed with slot overrides switched off. This PR rewrites them so that they fail when a slot breaks. It also deletes tests that guard nothing. No production code changes. Part of PE-1086. v1 and the GraphQL runtime are already gone from `2.0.0` (#8084, #8103), so nothing in react-core was skipped for pending removal. ## What does this PR do? The rot came from four patterns: 1. `expect(container.querySelector(...)).toBeDefined()`. `querySelector` and `queryBy*` return `null`, and `null` is defined, so the check always passes. 2. `if (el) { expect(...) }`. When the element is missing, the test asserts nothing. 3. Tests with no assertion, or that assert on the test's own mock. 4. The same slot matrix repeated in the popup, sidebar, chat view and message view files. ### How I measured it I applied each mutation locally, ran the tests, and reverted it. Nothing from the mutations is committed. - **M-slots-off:** `renderSlotElement` in `lib/slots.tsx` always renders the default component, so every slot override is ignored. - **M-resolve:** `resolveSlotComponent` in `CopilotChatMessageView.tsx` always returns the default. The message view resolves the assistant and user message slots with this function, not with `renderSlot`. Before this PR, **341 of 427** tests in the slot files and `lib/__tests__` passed under M-slots-off. ### Per file "Survive" = the test still passes under M-slots-off + M-resolve. After this PR, every survivor tests something that is not a slot override: positioning, children render props, labels, root `className`, or width. | File | Before (tests / survive) | After (tests / survive) | Notes | |---|---|---|---| | `CopilotChatInput.slots.e2e` | 48 / 42 | 36 / 10 | Buttons now render (transcribe mode, `toolsMenu`). Duplicates of `CopilotChatInput.test.tsx` removed. | | `CopilotChatView.slots.e2e` | 44 / 32 | 34 / 2 | New helper scrolls the view so the scroll-to-bottom button renders. Before, its tests never saw the button. | | `CopilotChatMessageView.slots.e2e` | 42 / 42 | 15 / 1 | All 42 survived. The sub-button matrix moved to the assistant and user message files. Thumbs are covered by `CopilotChat.raw-event-feedback.test.tsx`. | | `CopilotChatAssistantMessage.slots.e2e` | 26 / 18 | 18 / 2 | `markdownRenderer` never forwards `data-testid`, so that test now checks an object `className`. The `toolCallsView` string-slot test is deleted: `CopilotChatToolCallsView` ignores `className`, so nothing is observable. | | `CopilotChatUserMessage.slots.e2e` | 28 / 17 | 26 / 6 | The only home for user message slots. It now covers all 5 slots in each form with `it.each`. | | `CopilotChatSuggestionView.slots.e2e` | 24 / 14 | 23 / 10 | The loading test only counted buttons. It now checks that only the loading pill is busy and disabled. | | `CopilotModalHeader.slots.e2e` | 24 / 16 | 19 / 8 | The custom close-button test asserted the test's own handler. It now checks that the bound `onClick` closes the modal. | | `CopilotPopupView.slots.e2e` | 33 / 28 | 16 / 7 | The width and height tests checked only that the style named the CSS variable, which the default also sets. They now check the value. | | `CopilotSidebarView.slots.e2e` | 25 / 20 | 12 / 3 | Same width fix. The inherited chat view matrix is now one forwarding test. | | `CopilotChat.slots.e2e` | 23 / 18 | 8 / 1 | Deleted the `container.firstChild` smoke tests (they pass when `CopilotChat` renders nothing), a test that asserted its own mock was not called, and a test with no assertion. | | `CopilotChatView.onClick.e2e` | 29 / 19 | 17 / 3 | The submit test looked for a `<form>` that does not exist, so it never asserted. The add-menu click never fired because the button is disabled without menu items. | | `CopilotChatAssistantMessage.test` | `toBeDefined` on DOM queries | `not.toBeNull()` | Class-slot tests: 0 of 4 failed under M-slots-off before, 3 of 4 after. The 4th tests the root `className` prop. | | `CopilotChatInput.test`, `CopilotChatToolRendering.e2e` | `toBeDefined` on DOM queries | `not.toBeNull()` / `getByTestId` | `waitFor(() => expect(queryByTestId(..)).toBeDefined())` resolved at once. It now waits for the element. | | `use-frontend-tool.e2e` | 2 hollow tests | fixed | The wildcard result check never ran: `testId("tc1")` was called twice, so the result never matched the call. The forwarded-tools test accepted an empty array. Mutation `addTool` → no-op: the old test passes, the new one fails. | | `lib/__tests__/renderSlot.test` | 3 conditional tests + 1 tautology | fixed | The memo test counted two separate renders. It now rerenders with equal props and expects 1 render. Mutation "memo comparator returns false": the old test passes, the new one fails. | Typed props replace most `as any` casts in the rewritten tests. ## Related PRs and Issues - PE-1086 (Linear) - Related: PE-1076 (mutation-testing baseline). This PR does not add Stryker config. ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [ ] If the PR changes or adds functionality, I have updated the relevant documentation (not applicable: tests only) - [ ] If the PR contains a breaking change, the title has `!` (not applicable) - [ ] "Allow edits by maintainers" is checked ## Testing **Commands run** - `nx run @copilotkit/react-core:test`: 197 files and 2369 tests pass, 35 skipped (unchanged `skipIf` gates). - `nx run @copilotkit/react-core:check-types --exclude-task-dependencies`: passes. - `oxfmt` and the oxlint gate on every changed file: pass. - Each mutation above, applied and reverted locally. **Manual test** 1. In `packages/react-core/src/lib/slots.tsx`, add `return React.createElement(DefaultComponent, props);` as the first line of `renderSlotElement`. 2. Run `pnpm vitest run src/components/chat/__tests__/CopilotChatInput.slots.e2e.test.tsx` in `packages/react-core`. 3. On `2.0.0`, 42 of 48 tests pass. On this branch, 26 of 36 fail. 4. Revert the line. **How this PR makes testing easy** The changes are tests only. The mutation steps above reproduce the numbers in the table. ## Risk / rollback Low. Only test files change. If a rewritten test turns out to be flaky, revert this PR or that one commit. Each commit covers one group of files. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…o that check nothing (#8204) Three runtime tests passed only because any `Response` passed. None of them reached the code it names. This PR makes them reach it and assert the status. It also deletes two tests that check nothing. No production code changes. Part of PE-1086. v1 and the GraphQL runtime are already gone from `2.0.0` (#8084, #8103), so nothing in runtime was skipped for pending removal. ## What does this PR do? ### Rewritten | Test | What was wrong | Evidence | |---|---|---| | `fetch-handler.test.ts` › "returns 500 JSON error for unhandled errors" | The body had no `messages`, so the request got a **400** from validation. The agent never ran. The test only checked `toBeInstanceOf(Response)`. | The probe showed a 400 `Invalid request body`. Mutation **M-A** (the "Failed to run agent" response in `handle-run.ts` returns 200 instead of 500): the old test passes, the new one fails. | | `fetch-handler-validation.test.ts` › "CORS headers present on 500 error responses" | Same body problem: it got a 400, not a 500. | Mutation **M-A**: the old test passes, the new one fails. | | `code-review-fixes.test.ts` › "single-route agent/run works after onBeforeHandler replaces request" | The test's own hook built `new Request(..., { body: stream })` without `duplex`, and that throws in Node. The handler returned a **500** `internal_error` and `agent/run` never ran. | `onError` showed `TypeError: RequestInit: duplex option is required`. Mutation **M-B** (single-route dispatch sends `{}` instead of `methodCall.body` for `agent/run`): the old test passes, the new one fails. | Each rewritten test now sends a valid run body and asserts the status it names: 500 with `{"error":"Failed to run agent","message":"boom"}`, 500 with CORS headers, or 200 with `text/event-stream`. ### Deleted | Test | Why | |---|---| | `mcp-clients.test.ts` › "type compatibility: @ai-sdk/mcp MCPClient satisfies MCPClientProvider" | It cast `tools()` with `as unknown as` and ended with `expect(true).toBe(true)`, so it checked nothing at runtime or compile time. Without the cast, `tsc` rejects the claim (see below). | | `mcp-apps-middleware-integration.test.ts` › "can be created with mcpServers config pointing at MCPMock URL" | It asserted that `new MCPAppsMiddleware(...)` is an instance of `MCPAppsMiddleware`. That is always true. The other tests in the file use the middleware. | ### Finding for a follow-up (not fixed here) An `@ai-sdk/mcp` `MCPClient` is **not** assignable to `MCPClientProvider`. Its `tools()` returns MCP tools whose `inputSchema` is `FlexibleSchema<unknown>`, and that does not fit the `ai` `ToolSet`. A user who passes a real `MCPClient` to `mcpClients` gets a type error. The deleted test hid this with a cast. This PR changes tests only, so the type stays as it is. ## Related PRs and Issues - PE-1086 (Linear) - react-core part: #8202 ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [ ] If the PR changes or adds functionality, I have updated the relevant documentation (not applicable: tests only) - [ ] If the PR contains a breaking change, the title has `!` (not applicable) - [ ] "Allow edits by maintainers" is checked ## Testing **Commands run** - `nx run @copilotkit/runtime:test`: 184 files and 3013 tests pass, 4 skipped. - `nx run @copilotkit/runtime:check-types --exclude-task-dependencies`: passes. - `oxfmt` and the oxlint gate on every changed file: pass. - Mutations M-A and M-B, applied and reverted locally. Nothing from them is committed. **Manual test** 1. In `packages/runtime/src/runtime/handlers/handle-run.ts`, change `status: 500` in the "Failed to run agent" response to `status: 200`. 2. Run `pnpm vitest run src/runtime/__tests__/fetch-handler.test.ts` in `packages/runtime`. 3. On `2.0.0`, all tests pass. On this branch, "returns 500 JSON error for unhandled errors" fails. 4. Revert the change. **How this PR makes testing easy** The changes are tests only. The mutation steps above reproduce the evidence. ## Risk / rollback Low. Only test files change. To undo, revert the PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Apps on 2.0 import everything from
@copilotkit/react-coreand@copilotkit/runtimedirectly. This PR removes the v1 SDK and the/v2subpaths from both packages. To migrate an app, runnpx codemod @copilotkit/v2-migrationin the root of the app.What does this PR do?
/v2subpaths are removed.@copilotkit/react-ui,@copilotkit/react-textarea,@copilotkit/runtime-client-gql, the service adapters, the GraphQL endpoint, and@copilotkit/runtime/langgraph.@copilotkit/v2-migrationmoves the imports and renames<CopilotKit>to<CopilotKitProvider>. It marks each v1 call that it cannot change with aTODO(copilotkit-2.0)comment. It also installs an agent skill that resolves these comments.@ag-ui/langgraphevent names. The otherexamples/v1folders were v1 only, and are removed.Also in this PR:
graphql,type-graphql,class-validator,reflect-metadata, and 9 langchain peers.packages/react-ui/oxlint-rulestotools/oxlint-rules.@copilotkit/sdk-jsentry points.BREAKING CHANGE: The v1 APIs and the
/v2subpaths of@copilotkit/react-coreand@copilotkit/runtimeare removed. To migrate:npx codemod @copilotkit/v2-migrationin the root of the app.TODO(copilotkit-2.0)and resolve each comment. The installed agent skill can do this step.@copilotkit/*packages to 2.x.@copilotkit/react-ui,@copilotkit/react-textarea, and@copilotkit/runtime-client-gql.Related PRs and Issues
Checklist
!(for examplefeat(react-core)!: ...) and the description has aBREAKING CHANGE:line with migration steps. See VERSIONING.mdThe docs are not updated. PE-1088 tracks the 2.0 docs. The branch is in this repo, so the maintainer-edits box does not apply.
Testing
Commands run
nx run-many -t buildfor all JS packages: 29 passed.nx run-many -t check-types: 44 projects passed.nx run-many -t test publint attw: all passed, except 6 suites that also fail on a clean2.0.0. These arestarter-claude-managed-agents,starter-claude-managed-agents-flutter,react-native-demo,showcase-harness,showcase-strands-todo-tests, andshowcase-shared-python.nx run @copilotkit/v2-migration:test: 14 fixtures passed. The travel agentpytestrun: 11 passed.--no-verify. CI runs these suites.Manual test
pnpm install, thenpnpm nx run @copilotkit/v2-migration:test./v2paths to a scratch folder. Commit it there.npx codemod workflow run -w <repo>/codemods/v2-migration/workflow.yaml --target <app> --no-interactive./v2import stays.TODO(copilotkit-2.0)comment.How this PR makes testing easy
codemods/v2-migration/tests. The@copilotkit/v2-migration:testtarget runs them.packages/andexamples/is a large, real sample of its output.Risk / rollback
@ag-ui/langgraphdoes not handle thecopilotkit_emit_*events from the CopilotKit SDKs. If an app uses these events, it loses state streaming until it sends the upstream names.agent_execution_stream_*events came only from v1, so they stop. PE-1114 tracks this.DeleteResources.2.0.0.mainis not affected.Before the release:
@copilotkitscope on codemod.com..cursor/rulesfiles still point at the removed packages.Public API change
Before
After
Before and after
.(v1),./v2,./v2/generative-ui,./v2/context,./v2/headless,./v2/styles.css.,./generative-ui,./context,./headless,./styles.css.(v1),./v2,./v2/express,./v2/hono,./v2/node,./langgraph,./internal/learned-skills.,./express,./hono,./node,./internal/learned-skillsexpress,openai)Diff by area
packages/react-corepackages/runtimepackages/react-ui(deleted)packages/react-textarea(deleted)packages/runtime-client-gql(deleted)examples/v1codemods/v2-migration(new)pnpm-lock.yamlRemoved dependencies
@copilotkit/runtime-client-gql,lit, anduntruncate-json.graphql,graphql-yoga,@graphql-yoga/plugin-defer-stream,graphql-scalars,type-graphql,reflect-metadata,class-validator, andclass-transformer.@ag-ui/langgraph,@segment/analytics-node,partial-json, anduuid.@anthropic-ai/sdk,groq-sdk,langchain,@langchain/aws,@langchain/community,@langchain/core,@langchain/google-gauth,@langchain/langgraph-sdk, and@langchain/openai.What the codemod does
Users run
npx codemod @copilotkit/v2-migrationin the root of the app. The codemod makes the safe changes. It marks all other changes with a comment for a person or an agent.Changes that the codemod makes
/v2and its subpaths to the package roots. It changes@copilotkit/react-ui/styles.cssto@copilotkit/react-core/styles.css. It also changes these paths inimport(),require(), andvi.mock()strings.<CopilotKit>to<CopilotKitProvider>, andCopilotKitPropstoCopilotKitProviderProps. On the provider, it changesagent=toagentId=.CopilotChat,CopilotPopup, andCopilotSidebarmove from react-ui to react-core. A note tells the user that their props changed.LangGraphAgentandLangGraphHttpAgentto@ag-ui/langgraph. A note tells the user that@ag-ui/langgraphdoes not handle thecopilotkit_emit_*events.Comments that the codemod adds
For each other v1 API, the codemod adds a
TODO(copilotkit-2.0)comment above the import. The comment names the 2.0 replacement and its docs page:Each v1-only provider prop gets a comment next to the prop:
The data for these comments comes from a snapshot of the v1 API in
scripts/v1-api.ts. The snapshot has 206 exports: react-core 79, react-ui 38, react-textarea 14, runtime 69, and runtime/langgraph 6.At the end, the codemod installs an agent skill. The skill resolves the comments, updates
package.json, and runs the build.Limits
"constructor", and theprototype-keysfixture tests this.@importlines or template literals.🤖 Generated with Claude Code