Repository navigation
refactor(core)!: move suggestions, Inspector mounting and learning auto-start into core - #8182
Merged
Merged
Conversation
…spector Adds an optional hostname input and the exported loopback host list, so all framework adapters apply the localhost / 127.0.0.1 / [::1] rule React had. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…unt subpath Owns define, configure-before-connect, open-request replay, visibility events, adoption of an app-placed element and teardown, so adapters keep only the host element. The subpath has no runtime import of the Inspector bundle, so the Inspector itself stays a lazy chunk the adapter loads. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The component keeps only its host span and React lifecycle; loading, configuring, open-request replay and teardown live in web-inspector. The loopback host rule now comes from shouldEnableInspector. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…visibility The Inspector now mounts only on loopback hosts, as in React, and Inspector message actions show only while the Inspector itself is shown. The component emits visibility-change and keeps only its host element and Vue lifecycle. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ly opens The Inspector now mounts only on loopback hosts, Inspector message actions follow the Inspector's own visibility, and an open request made before the element loads is no longer dropped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The package typechecks with node16 module resolution. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Moves the suggestions-config logic the framework hooks each carried into one core binding: disabled configs, content dedupe, consumer/chat agent resolution, reloading every idle agent for a global config (plus the chat's own agent when the registry is empty), retrying agents that were running once their run ends, and waiting for a dynamic config's agent to register. The subscription helper keeps the view's suggestions and loading flag in sync. Co-Authored-By: Claude Opus 5.5 <[email protected]>
useConfigureSuggestions now wraps ɵbindSuggestionsConfig and useSuggestions wraps ɵsubscribeToAgentSuggestions. A global config now also falls back to the provider's agentId when no chat configuration surrounds it, and agents skipped because they were running are reloaded once their run ends. Co-Authored-By: Claude Opus 5.5 <[email protected]>
useConfigureSuggestions now wraps ɵbindSuggestionsConfig and useSuggestions wraps ɵsubscribeToAgentSuggestions. A global config now also loads for the chat's own agent while the agent registry is still empty, and a dynamic config reloads once its agent registers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Angular counterpart of useConfigureSuggestions: bound to the calling injection context, follows the surrounding chat configuration's agent and re-applies a function config when the signals it reads change. addSuggestionsConfig keeps working. Co-Authored-By: Claude Opus 5.5 <[email protected]>
One place for the provider learning option: mapping true/false/objects to the core config, the generated Trajectory ID (kept across dispose and update, so StrictMode replays restart the same Trajectory), start/stop on settings changes and dispose, the once-per-condition warnings and the late-rejection guard. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…arter The provider keeps only effect timing: update on mount and prop changes, dispose on unmount. The learningContainerIds warning now fires once per condition instead of on every new inline learning object. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The provider keeps only the mount-time watch and unmount dispose. CopilotKitLearningOptions is now an alias of the core type. The learningContainerIds warning now fires once per condition instead of on every new learning object. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Same semantics as the React and Vue providers, through ɵLearningAutoStarter: capture starts in the browser when CopilotKit is created and stops when the application is destroyed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…host The React and Vue providers read the hostname for the loopback rule; a page or test without a location keeps the previous behaviour (no host limit). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lpers Co-Authored-By: Claude Opus 5.5 <[email protected]>
…manifest Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ment Listeners such as @cpk-inspector-visibility-change reach the cpk-web-inspector element again, as they did before the Inspector moved onto ɵmountInspector. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…anges Adds two sections to the Chat UI in 2.0 guide: the Vue and Angular Inspector (loopback hosts only, the message action follows Inspector visibility, text attributes and listeners on the Vue component) and useConfigureSuggestions (provider agentId fallback, early loads, reloads after a run, deps reloads). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tions-inspector-learning The React, Vue and Angular providers keep the core provider config and diagnostics and drive the learning option through ɵLearningAutoStarter and ɵtoLearningConfig. Keep both sides' core exports, Angular imports and chat-2.0 sections. Regenerate react-core external re-exports and the public API manifest. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…starter ɵLearningProp duplicated ɵCopilotKitLearningOptions from the provider config. The auto-starter, its tests and the Angular config now use the provider-config type, and ɵLearningProp is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2.0.0 split the Inspector source into fixed layers and removed lib/, so src/mount.ts failed the architecture spec and its notifications import no longer resolved. The mount entry now lives in src/shell/mount.ts and still builds to dist/mount.*, so the "./mount" export is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rtcut test The Inspector shortcut now shows only while the Inspector is mounted and visible, so enableInspector alone no longer turns it on in a test. Stub CopilotInspector as enabled, as the Inspector button spec does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
AlemTuzlak
requested review from
jpr5,
mme,
rainerhahnekamp,
tylerslaton and
wolfmanfx
as code owners
November 3, 2026 18:20
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait...
|
2 of 4 tasks
This was referenced Nov 3, 2026
Merged
Merged
Contributor
Production Digest-Pinning AuditAll 43 services digest-pinned. Run 2026-11-04 02:56:15 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
@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: |
Contributor
|
Size Change: +9.57 kB (+0.4%) Total Size: 2.38 MB 📦 View Changed
ℹ️ View Unchanged
|
…tions-inspector-learning Angular CopilotKit keeps both the chat configuration token import and the open-Thread bindings import. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tions-inspector-learning No conflicts. The lint baseline only shrinks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
AlemTuzlak
added a commit
that referenced
this pull request
Nov 4, 2026
…into core (#8181) Merge this PR first. It is PR 1 of 10 in the "2.0 core pipeline" stack, with base `2.0.0`. The chat primitives of React, Vue, and Angular now get their logic from `@copilotkit/core`. As a result, a bug in this logic has one fix, in core. This PR also corrects five bugs where the three frameworks did different things. ## What does this PR do? These rules moved into core. The framework packages keep only the rendering and the lifecycle. | Core file | What it holds now | | --- | --- | | `chat/message-feedback.ts` | The rating store, the "Learning feedback on" rule, and the comment popover rules (150 ms close delay) | | `chat/viewport.ts` | `autoScroll` modes, the mobile media query, the keyboard height, and pin-to-send | | `chat/license.ts` | License banner text, links, colors, and the 52 px bottom offset | | `chat/message-display.ts` | Reasoning time label, work summary text, user message text and files, branch navigation, toolbar rule, and the "copied" timer | | `chat/inspector-button.ts` | The "hide shortcuts" store, the kite icon as data, and the hover menu (180 ms close delay) | Core also exports `ɵshallowEqualRecord` and `ɵcn` to the framework packages. All new exports use the `ɵ` prefix, because they are internal. Bugs that this PR corrects: - **Copy buttons:** Fast clicks made the check mark flicker in the React user message and both Angular buttons. A second copy now starts the 2 seconds again. - **Angular toolbar:** The assistant toolbar showed while the latest message streamed. Now it is hidden, as in React and Vue. - **License text:** React license warnings ignored custom labels, and the Vue inline warning had fixed text. Both now use the chat labels. - **Stable refs:** React and Vue treated `{ a: undefined }` and `{ b: undefined }` as equal. Now they compare with `Object.is` and own keys. - **Pin-to-send in React:** It now runs without `requestAnimationFrame` or `ResizeObserver`, as Vue did. Angular also gets an optional `branchSwitchEnabled` input (default `true`) on the user message and its branch navigation. The merge from `2.0.0` brought in the React StrictMode pin-to-send fix of #8159. This fix now lives in core `ɵpinMessageToTop`. The unpin function returns `false` when it cancelled a scroll that did not run. On `false`, React pins again. A new core test covers this ("reports whether the scroll ran before it was unpinned"). BREAKING CHANGE: In `@copilotkit/angular`, `copied` on `CopilotChatUserMessageCopyButton` and `CopilotChatAssistantMessageCopyButton` is a read-only signal. Calls to `copied.set()` and `copied.update()` do not type-check. Call `handleCopy()` on the button, or render your own button in the `copyButton` slot. The [v2-migration codemod](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-chat-primitives/codemods/v2-migration/scripts/angular-copy-buttons.ts) puts a TODO above each of these calls. The steps are in [Angular copy buttons](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-chat-primitives/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#angular-copy-buttons). Behavior changes without a codemod are in the same page: - [License warning text](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-chat-primitives/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#license-warning-text) (React and Vue) - [Chat behavior in Vue and Angular](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-chat-primitives/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#chat-behavior-in-vue-and-angular): the Angular toolbar, and the Vue copy buttons without the Clipboard API ## Related PRs and Issues - #8159 (the pin-to-send fix that this PR moves into core) ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) - [ ] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) ## Testing **Commands run** On the head `cb06e3f5cb` (after the merge from `2.0.0`): - `pnpm nx run-many -t test -p @copilotkit/core @copilotkit/react-core @copilotkit/vue @copilotkit/angular`: core 1955, react-core 2487 (35 skipped), vue 1432, angular 690 tests pass. - The first run had two failures from a stale local install: a stale `external-reexports` check and a Vue test that timed out at 5 s. After `pnpm install` and a core build, both pass. Before the merge, on this branch: - `pnpm nx run-many -t build,check-types -p @copilotkit/core @copilotkit/react-core @copilotkit/vue @copilotkit/angular`: pass. - `pnpm nx run @copilotkit/v2-migration:test --skip-nx-cache`: 39 TypeScript and 14 TSX cases pass. - `pnpm check:public-api-manifest`: current. - `pnpm nx run @copilotkit/vue:lint`: 197 errors. `2.0.0` has the same 197 errors. None come from this PR. **Manual test** 1. In an Angular chat, send a message. The assistant toolbar shows only after the reply stops streaming. 2. Click a copy button two times in 2 seconds. The check mark stays for 2 seconds after the second click. 3. In React, render `<CopilotChat labels={{ licenseFeatureUnlicensedText: "No license for {feature}" }} />` without a license. The warning shows your text. 4. Run the codemod on an Angular file with `copyButton.copied.set(true)`. A `TODO(copilotkit-2.0)` comment is above the call. **How this PR makes testing easy** - Each new core module has its own tests in `packages/core/src/chat/__tests__/` and `packages/core/src/utils/__tests__/`. - Each behavior change has an adapter test, for example `CopilotChatCopyButtons.test.tsx`, `copy-buttons.spec.ts`, and `copilot-chat-assistant-message.component.spec.ts`. - The codemod has three new cases in `codemods/v2-migration/tests/ts/angular-copy-buttons*`. ## Risk / rollback The risk is medium. Many chat components in three frameworks changed at the same time. The tests above cover each moved rule. If this PR causes an error, revert it. Before that, revert the stack PRs that merged after it. ## Public API change **Before** ```ts this.copyButton().copied.set(true); ``` **After** ```ts this.copyButton().handleCopy(); ``` ## Stack Merge in this order. Each PR's base is the PR above it. | # | PR | Area | Base | |---|---|---|---| | 1 | **#8181 (this PR)** | Chat primitives | `2.0.0` | | 2 | #8173 | Provider config and runtime info | PR 1 | | 3 | #8176 | Tool-call rendering | PR 2 | | 4 | #8175 | A2UI, Open Generative UI, MCP Apps | PR 3 | | 5 | #8174 | Agents, threads, chat configuration | PR 4 | | 6 | #8179 | Chat sends, attachments, message view | PR 5 | | 7 | #8178 | Chat input, recorder, DOM controllers | PR 6 | | 8 | #8177 | Markdown renderer | PR 7 | | 9 | #8182 | Suggestions, Inspector, learning | PR 8 | | 10 | #8180 | Interrupts and human-in-the-loop | PR 9 | **Stack verification.** After each merge, the stack builder ran these on this layer's head before pushing it, all with `--skip-nx-cache`: build, check-types and tests for core, react-core, vue and angular, plus the packages this layer touches; the codemod tests; oxlint; and `check:public-api-manifest`. On the top layer it also ran publint, attw, and the shell-docs tests and build. All passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Angular 2.0 migration guidance now covers copy-button changes, including read-only copied state and options for custom copy behavior. * **Improvements** * License banners and inline warnings now use configured labels across React and Vue, with default labels when no provider is present. * Chat toolbars, branch navigation, copy feedback, Inspector menus, and work summaries now follow shared behavior across frameworks. * **Documentation** * Updated the migration guide with Angular copy-button, license-warning, and chat-behavior notes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
AlemTuzlak
added a commit
that referenced
this pull request
Nov 4, 2026
…o core (#8173) The CopilotKit providers in React, Vue, Angular, and React Native now get their config rules, prop sync, runtime info, and error handling from `@copilotkit/core`. Each framework kept its own copy of this logic, and the copies did not match. A fix in these areas now goes in one place in core. This is PR 2 of 10 in the "2.0 core pipeline" stack. Its base is `alem/2.0-core-chat-primitives`. Merge it after PR 1. ## What does this PR do? **Moved into core** (`packages/core/src/core/provider-config.ts`, `runtime-info.ts`, `core.ts`): - `ɵresolveProviderConfig`: the key fallback (`publicApiKey ?? publicLicenseKey`), the Copilot Cloud URL, the transport from `useSingleEndpoint`, the agent merge, the `a2uiCatalogAvailable` property, the key header, and the missing-config check. - `CopilotKitCore.ɵupdateConfig(patch)`: applies only the keys present, in a fixed order (message filter first). - `CopilotKitCore.ɵruntimeInfo` + `ɵsubscribeToRuntimeInfo`: one frozen snapshot of every `/info` field, so an adapter cannot miss a field. - `onError` config + `setErrorHandler`: without a handler, core logs `[CopilotKit] Error (code):`. - `ɵCopilotKitProviderBaseOptions`: one copy of the shared option docs that React and Vue extend, and Angular and React Native pick from. Also `ɵSTABLE_ARRAY_WARNINGS` and `ɵtoolRendererShapeChanged`. **Bugs fixed:** - React and React Native never disposed their core. They now dispose it on unmount. The dispose waits one task, so the StrictMode remount keeps the same core, and a later remount (`<Activity>`) gets a new core. - Vue and Angular fetched `/info` during server-side rendering. Vue now connects on mount, and Angular only in the browser. - Angular could not clear `runtimeUrl`, and had no `runtimeTransport`, `debug`, `defaultThrottleMs`, or `onError` at startup. Now it has all of them. - Vue logged an invalid `defaultThrottleMs` two times. Now core logs it once. - Vue `CopilotChatConfigurationProvider` registered its open Thread again on every runtime status event. - A React StrictMode remount pushed the provider tool lists over the tools that children registered. ## Breaking changes BREAKING CHANGE: Angular `provideCopilotKit` with no `runtimeUrl`, `licenseKey`, `agents`, or `selfManagedAgents` now throws in production. Add a `runtimeUrl` to the config. Behavior changes that apps can notice: - Without `onError`, core, Vue, and Angular now log errors with `console.error`. - The React and React Native providers dispose their core on unmount. - Vue and Angular no longer send `/info` during server-side rendering. - Angular `licenseKey` with no `runtimeUrl` connects to Copilot Cloud. Angular sends every key value, also keys that do not start with `ck_pub_`. - Angular `updateRuntime({ runtimeUrl: undefined })` clears the URL. `agents` and `selfManagedAgents` each keep the last value of the other set. Migration: - Guide: [Providers in 2.0](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-provider-config/showcase/shell-docs/src/content/docs/migrate/providers-2.0.mdx), linked from the main 2.0 migration page. - Codemod: the [v2 migration codemod](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-provider-config/codemods/v2-migration/scripts/codemod.ts) adds a `TODO(copilotkit-2.0)` comment to each `provideCopilotKit` call that it can read in full and that has no runtime config. ## Related PRs and Issues - Base: `alem/2.0-core-chat-primitives` (PR 1 of the stack). - Keeps the deferred connection from #5801 and the header rules from #1937 and #5635. ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) - [ ] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) ## Merge notes - The merge of 2.0.0 into this branch kept both codemod transforms. - In the React Native provider, this branch's version won over the reworded `debug` doc comment from 2.0.0. The core base type now documents that prop. ## Testing **Commands run** (before the stack merge, on this layer alone): - `pnpm nx run-many -t build,check-types,test,lint -p @copilotkit/core @copilotkit/react-core @copilotkit/vue @copilotkit/angular @copilotkit/react-native --parallel=1`: builds and type checks pass. Core 116 test files, React Native 27, and Angular 71 pass. - These tests timed out under load in the full run and passed when run alone: the react-core chart tests, Vue `build-entries.test.ts`, and Angular `public-api-documentation.spec.ts`. - Vue lint fails on the base too. It has 197 errors on the base and 194 on this branch, so this PR adds none. - `pnpm nx run @copilotkit/v2-migration:test --skip-nx-cache`: 14 tsx and 40 ts cases pass. - `npm test` in `showcase/shell-docs`: 91 files and 585 tests pass, with link integrity. - `pnpm check:public-api-manifest`: current. - Not run after the stack merge: the full suites on head `4ba047de80`. **Manual test:** 1. In a React app, wrap the provider in `<StrictMode>`. Read the core with `useCopilotKit()`, then unmount the provider. The core is disposed after one task, and StrictMode does not dispose it. 2. In an Angular app, call `provideCopilotKit({})` in a production build. The app throws `Missing required prop: 'runtimeUrl' or 'publicApiKey' or 'publicLicenseKey'`. Add `runtimeUrl` to remove the error. 3. In a Vue app, render the provider on the server. No request goes to `/info` until the app mounts in the browser. **How this PR makes testing easy:** - Core unit tests: `provider-config.test.ts`, `runtime-info.test.ts`, `core-update-config.test.ts`. - Adapter tests: `CopilotKitProvider.lifecycle.test.tsx` (React, StrictMode and `<Activity>`), `CopilotKitProvider.config.test.ts` (Vue), `copilotkit.provider-config.spec.ts` (Angular). - Codemod fixtures: `codemods/v2-migration/tests/ts/angular-*`. ## Risk / rollback - Risk: an app that keeps the React core after unmount, or an Angular app with no runtime config at startup, breaks. The guide and the codemod TODO cover both. - Raw `CopilotKitCore` users now see logged errors when they set no handler. - Rollback: revert this PR. Layers 3 to 10 of the stack build on it, so revert them first. ## Public API change **Before** (Angular, 1.x) ```ts provideCopilotKit({ licenseKey: "ck_pub_..." }); // later copilotKit.updateRuntime({ runtimeUrl: "/api/copilotkit" }); ``` **After** ```ts provideCopilotKit({ licenseKey: "ck_pub_...", runtimeUrl: "/api/copilotkit", onError: ({ code, error }) => console.warn(code, error), }); ``` ## Stack Merge in this order. Each PR's base is the PR above it. | # | PR | Area | Base | |---|---|---|---| | 1 | #8181 | Chat primitives | `2.0.0` | | 2 | **#8173 (this PR)** | Provider config and runtime info | PR 1 | | 3 | #8176 | Tool-call rendering | PR 2 | | 4 | #8175 | A2UI, Open Generative UI, MCP Apps | PR 3 | | 5 | #8174 | Agents, threads, chat configuration | PR 4 | | 6 | #8179 | Chat sends, attachments, message view | PR 5 | | 7 | #8178 | Chat input, recorder, DOM controllers | PR 6 | | 8 | #8177 | Markdown renderer | PR 7 | | 9 | #8182 | Suggestions, Inspector, learning | PR 8 | | 10 | #8180 | Interrupts and human-in-the-loop | PR 9 | **Stack verification.** After each merge, the stack builder ran these on this layer's head before pushing it, all with `--skip-nx-cache`: build, check-types and tests for core, react-core, vue and angular, plus the packages this layer touches; the codemod tests; oxlint; and `check:public-api-manifest`. On the top layer it also ran publint, attw, and the shell-docs tests and build. All passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Provider configuration is more consistent across Angular, React, React Native, and Vue, with shared options for runtime settings, agents, and error handling. * Runtime and license information updates are synchronized across providers. Angular runtime updates can clear selected settings with `undefined`. * Errors use a configured handler when available; otherwise, they are logged. * Angular migration tooling flags missing runtime configuration with a TODO. * **Bug Fixes** * Vue and Angular defer runtime information requests until browser startup. * **Documentation** * Added a provider migration guide covering 2.0 configuration and behavior changes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
AlemTuzlak
added a commit
that referenced
this pull request
Nov 4, 2026
Merge this PR after PR 2. It is PR 3 of 10 in the "2.0 core pipeline" stack, with base `alem/2.0-core-provider-config`. Tool-call rendering now follows one set of rules in `@copilotkit/core`. React, Vue, and Angular only connect those rules to their own reactivity, so a rendering bug is fixed in one place. This PR also fixes several bugs where the three frameworks disagreed. One of them: Angular showed tool-call status the wrong way round. ## What does this PR do? **Moved into core:** - **Renderer registry** (`ɵRendererRegistry`): prop and hook tool-call renderers by `agentId` and name, plus activity and custom message renderers. React, Vue, and Angular store their renderers in it. - **Executing tool calls**: `CopilotKitCore.executingToolCallIds` and the `onExecutingToolCallsChanged` event. The React and Vue providers read it. Angular gets an `executingToolCallIds` signal. - **Tool-call render props**: status, argument parsing, the result text, and the agent to look up renderers for. The props of the built-in card and the state of a tool-call group come from core too. - **Activity and custom message renderers**: the renderer lookup, a reason when nothing can draw, one warning text, and the props of a custom message renderer. - **Component tools**: the tool description that `useComponent` and `registerComponent` give the model. **Bugs fixed:** - **Angular status was inverted.** A call with no result was "in-progress" while the run went on and "executing" after it stopped. Now it is "executing" only while its handler runs. - **Vue status lagged.** Vue removed executing ids one tick late, with `setTimeout`. Core now keeps a call executing until its result is in the messages. A human-in-the-loop `respond` also never shows before the handler waits for it. - **Angular `<copilot-activity>` used no agent** when `agentId` was not set. It now uses the default agent, as React and Vue do. - **Vue `useComponent` dropped `followUp`.** It now passes it on, as React and Angular do. - **Renderer changes went unannounced.** React sent no event when activity or custom message renderers changed, and Vue sent none for activity renderers. Both now send one. ## Breaking changes BREAKING CHANGE: In React, `copilotkit.renderToolCalls` and `copilotkit.renderActivityMessages` are read-only arrays. Code that changes them in place no longer type-checks. Give a new list to `setRenderToolCalls` or `setRenderActivityMessages` instead. See [Renderer lists](https://docs.copilotkit.ai/migrate/chat-2.0#renderer-lists). BREAKING CHANGE: `CopilotChatLabels` has a new key, `toolCallStatusUnknownLabel`. A complete labels object no longer type-checks. Spread `CopilotChatDefaultLabels` and override only your keys. See [Label type](https://docs.copilotkit.ai/migrate/chat-2.0#label-type). The codemod marks both cases with a `TODO(copilotkit-2.0)` comment. See [`chat-apis.ts`](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-tool-call-rendering/codemods/v2-migration/scripts/chat-apis.ts). These behavior changes have guide entries and no codemod: - **Angular:** for two renderers with the same name and `agentId`, the newer renderer is used. In 1.x, the first one was used. See [Chat behavior in Vue and Angular](https://docs.copilotkit.ai/migrate/chat-2.0#chat-behavior-in-vue-and-angular). - **React and Vue:** malformed tool-call arguments read `{ _raw }` or `{ _value }`, not `{}`. This is the rule that Angular already tested. See [Tool-call rendering](https://docs.copilotkit.ai/migrate/chat-2.0#tool-call-rendering). - **The built-in card:** its status and headings come from the labels, and a status it does not know shows "Unknown status". - **All three frameworks:** they log the same activity warning text. ## Merge notes - **Angular `copilotkit.ts`:** this PR adds the renderer registry and the executing tool-call ids on top of the runtime-info subscription from PR 2. - **Codemod:** the stack merge kept the changes from both sides. - **`chat-2.0.mdx`:** the Vue custom message renderer bullet replaces the earlier 2.0.0 sentence. That sentence said that the chat tries each renderer until one draws. Both React and Vue use the first renderer for the agent, then the first global one. ## Related PRs and Issues - PR 2 of the stack: `alem/2.0-core-provider-config` (the base of this PR). ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) - [ ] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) ## Testing **Commands run.** I ran these on this branch before the stack merge, at `12d04e3743`. I did not run them again after the merge of PR 2 (`2fde35e750`). - `pnpm nx run-many -t build,test,lint,check-types -p @copilotkit/core @copilotkit/react-core @copilotkit/vue @copilotkit/angular`. Build and check-types passed for all four packages, and the Angular tests passed. - The core, React and Vue test failures were timeouts while ten agents ran on the same machine. Each failing file passed when run on its own, except one Vue `build-entries.test.ts` case. That case times out a Vite build at 5 seconds. I did not run it on the base branch. - `vue:lint` fails with 197 errors. None is on a line that this PR adds. - `pnpm --filter @copilotkit/v2-migration test`: 16 tsx fixtures and 38 ts fixtures passed. - `pnpm check:public-api-manifest`: the manifest is current. **Manual test (the Angular status bug):** 1. Run `pnpm nx run @copilotkit/angular:test -- src/lib/render-tool-calls.spec.ts`. The new `status` cases pass: "in-progress" when the run stopped, "executing" while core runs the handler, "complete" with a result. On the base branch, a stopped run gave "executing". 2. Run `pnpm --filter @copilotkit/v2-migration test`. The `chat-labels-object` and `chat-renderer-lists` fixtures show the codemod TODOs. **How this PR makes testing easy.** It adds core unit tests for each moved rule (`renderer-registry.test.ts`, `core-executing-tool-calls.test.ts`, `tool-call-render.test.ts`, and new cases in `renderers.test.ts` and `tool-call-layout.test.ts`). It also adds adapter tests for each behavior change and four codemod fixtures. ## Risk / rollback The tool-call rendering of all three frameworks changes. The largest risk is the Angular status change, because a renderer that waited for "executing" after a run now stays at "in-progress". To undo, revert this PR. PRs 4 to 10 of the stack build on it, so revert them first. ## Public API change **Before** ```ts const { copilotkit } = useCopilotKit(); copilotkit.renderToolCalls.push(searchRenderer); const labels: CopilotChatLabels = { chatInputPlaceholder: "Ask me anything..." /* every 1.x key */ }; ``` **After** ```ts const { copilotkit } = useCopilotKit(); copilotkit.setRenderToolCalls([...copilotkit.renderToolCalls, searchRenderer]); const labels: CopilotChatLabels = { ...CopilotChatDefaultLabels, chatInputPlaceholder: "Ask me anything...", }; ``` New and additive: `CopilotKitCore.executingToolCallIds`, `onExecutingToolCallsChanged`, and the Angular `CopilotKit.executingToolCallIds` signal. ## Stack Merge in this order. Each PR's base is the PR above it. | # | PR | Area | Base | |---|---|---|---| | 1 | #8181 | Chat primitives | `2.0.0` | | 2 | #8173 | Provider config and runtime info | PR 1 | | 3 | **#8176 (this PR)** | Tool-call rendering | PR 2 | | 4 | #8175 | A2UI, Open Generative UI, MCP Apps | PR 3 | | 5 | #8174 | Agents, threads, chat configuration | PR 4 | | 6 | #8179 | Chat sends, attachments, message view | PR 5 | | 7 | #8178 | Chat input, recorder, DOM controllers | PR 6 | | 8 | #8177 | Markdown renderer | PR 7 | | 9 | #8182 | Suggestions, Inspector, learning | PR 8 | | 10 | #8180 | Interrupts and human-in-the-loop | PR 9 | **Stack verification.** After each merge, the stack builder ran these on this layer's head before pushing it, all with `--skip-nx-cache`: build, check-types and tests for core, react-core, vue and angular, plus the packages this layer touches; the codemod tests; oxlint; and `check:public-api-manifest`. On the top layer it also ran publint, attw, and the shell-docs tests and build. All passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
AlemTuzlak
added a commit
that referenced
this pull request
Nov 4, 2026
…o core (#8174) Merge this after PR 4. It moves the agent, thread-list, chat configuration, threads drawer, and Inspector "view thread" logic from React, Vue, and Angular into `@copilotkit/core`. The three framework packages now only connect that core logic to their reactivity, so a logic fault is fixed in one place. It also fixes several drifts between the frameworks. The largest fix: data that an app writes to the stand-in agent before the runtime connects is now kept in React and Vue. PR 5 of 10 in the "2.0 core pipeline" stack. Base: `alem/2.0-core-generative-ui` (PR 4). ## What does this PR do? New core modules (internal `ɵ` exports): - `core/agent-resolver.ts`: `ɵAgentResolver` (one per core) owns the binding checks, the agent ID fallback, the stand-in agent cache, the hand-off from the stand-in to the real agent, and thread-scoped proxy registration. `useAgent` (React, Vue) and `injectAgentStore` (Angular) use it. - `threads-controller.ts`: `ɵThreadsController` owns thread projection, config errors, the gated `/threads` context dispatch, the store registry claim, and the mutation guard. `useThreads` (React, Vue) and `injectThreads` (Angular) use it. - `chat/chat-configuration.ts`: `ɵChatConfigurationStore` owns thread, agent, modal, and drawer state across nested providers, and open-thread registration. The three chat configuration providers wrap it. - `chat/threads-drawer.ts` and `inspector-thread-bridge.ts`: the drawer actions, element props, chat-input lookup, and `ɵInspectorThreadOverride`. - `core/agent-helpers.ts` and `core/record-annotation.ts`: context value serialization, capability lookup, and the learn-from-user-action request (moved from React). Faults and drifts this fixes: - **Stand-in agent hand-off (React, Vue):** messages, state, and a run written to the stand-in during the `/info` request now move to the real agent. Same-ID consumers share one stand-in (Angular already did this). - **Stand-in request settings (all):** the stand-in now gets the same credentials, message filter, debug, and Intelligence settings as a registered proxy. React keys header refresh on `ɵheadersGeneration` (#1937). - **Vue `useAgent`:** returns `isReady`, re-renders on run start, and batches message updates like React. - **Angular gaps closed:** chats apply the Inspector "view thread" request. `CopilotChatConfiguration` registers the open thread and warns when the thread is controlled. Agent context accepts JSON values. - **Thread lists:** React and Vue no longer fetch `/threads` twice for the same context. Vue and Angular `startNewThread` hides config errors, like React. ## Breaking changes BREAKING CHANGE: Angular `CopilotChatConfiguration` no longer has the protected `_setOverride(threadId, explicit)` method. In a subclass, call `this.setActiveThreadId(threadId, { explicit })` instead. To customize thread changes, override `setActiveThreadId` and `startNewThread`. - Codemod: [`angular-chat-configuration.ts`](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-agents-threads/codemods/v2-migration/scripts/angular-chat-configuration.ts) rewrites the calls. It adds a `TODO(copilotkit-2.0)` comment to a subclass that overrides `_setOverride`. - Migration guide: [Chat configuration](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-agents-threads/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#chat-configuration). Behavior-only changes are in the same page: [Agents before the runtime connects](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-agents-threads/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#agents-before-the-runtime-connects), [Agent context in Angular](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-agents-threads/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#agent-context-in-angular), [Thread lists](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-agents-threads/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#thread-lists). Behavior changes an app can notice (guide only, no codemod): - Vue chat configuration: a parent thread beats a nested non-explicit seed. Nested thread changes go to the top-most provider. A bare provider has `isModalOpen: true` and a `setModalOpen` function. - React: the placeholder thread ID is made once per provider. - Angular: `connectAgentContext` and the `copilotkitAgentContext` directive send a non-string value as JSON text. ## Merge notes - Angular `injectCapabilities` keeps the default-agent fallback from 2.0.0 (`d3c6423f92`) on top of the core `ɵgetAgentCapabilities` version. - The codemod passes are chained: generative UI first, then Angular chat configuration. - `f7480aa80b` makes the threads controller and the agent resolver read `ɵruntimeInfo`. `6c501597fb` makes `chat-configuration.ts` use the shared `ɵMOBILE_MAX_WIDTH_QUERY`. - `d107031158` moves one Vue render-count test baseline after the first render. The provider from the earlier layer now connects on mount, and that causes one extra render. ## Related PRs and Issues - Stack: PR 5 of 10, "2.0 core pipeline". Base PR: `alem/2.0-core-generative-ui`. ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) - [ ] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) ## Testing Commands run on this layer before the merge of PR 4: - `nx run-many -t check-types` for core, react-core, vue, angular: pass. - `nx run @copilotkit/react-core:test`: 2477 passed, 35 skipped. `nx run @copilotkit/vue:test`: 1439 passed. Core and Angular tests: pass. - Codemod `pnpm test`: 53 fixtures pass, 3 of them new. `kiira check` on `chat-2.0.mdx`: 7 snippets pass. `pnpm check:public-api-manifest`: current. - Not run by me after the merge of PR 4 and the three follow-up commits. CI is the check for those. Manual test: 1. Start a React or Vue app with a runtime URL. Call `useAgent()` and add a message to the agent before the runtime connects. 2. When `isReady` becomes `true`, confirm that the message is on the real agent. Before this PR, React and Vue lost it. 3. In an Angular app, open the Inspector and pick "View in app" on a thread. Confirm that the chat loads that thread. How this PR makes testing easy: new core unit tests for each module (`agent-resolver.test.ts`, `threads-controller.test.ts`, `chat-configuration.test.ts`, `threads-drawer.test.ts`, `inspector-thread-override.test.ts`, `agent-helpers.test.ts`), new adapter tests for each behavior change, and three codemod fixtures under `codemods/v2-migration/tests/ts/angular-chat-configuration*`. ## Risk / rollback Risk is medium. The three frameworks now share one implementation of agent resolution, thread lists, and chat configuration, so a core fault shows in all three. The stand-in hand-off bridges stay subscribed for the life of the core and copy each registered-agent update into the stand-in. To undo, revert this PR. Later layers of the stack build on it. ## Public API change **Before** (Angular subclass) ```ts export class RoutedChatConfiguration extends CopilotChatConfiguration { openFromRoute(threadId: string) { this._setOverride(threadId, true); } } ``` **After** ```ts export class RoutedChatConfiguration extends CopilotChatConfiguration { openFromRoute(threadId: string) { this.setActiveThreadId(threadId, { explicit: true }); } } ``` ### Angular bundle fix (added after the PR opened) Commit `56ba9982d9` (`perf(angular)`) fixes a CI failure on this layer, "Build canonical Angular browser artifact". Angular's chat configuration imported the core store from the core index, and it also injected `CopilotKit`. That pulled all of core, AG-UI and zod into the showcase's initial bundle, which was 2,711,682 raw bytes against a 1,633,493 cap. Initial-path Angular modules must not import core at runtime (see `config.ts`, #1937). - New public subpath `@copilotkit/core/chat-configuration`. It exports only `ɵChatConfigurationStore`, and the manifest lists it. - Angular `chat-configuration.ts` imports the store from that subpath. It hands the store to a small root service, `ɵOpenThreadBindings`, and does not inject `CopilotKit`. `CopilotKit` connects its core to that service when it is created. - Behavior: a chat configuration created before `CopilotKit` now registers its thread when `CopilotKit` is created, not straight away. A new test covers this order. - Result: the initial bundle is 1,503,074 raw bytes. All Angular tests and the type check pass. ## Stack Merge in this order. Each PR's base is the PR above it. | # | PR | Area | Base | |---|---|---|---| | 1 | #8181 | Chat primitives | `2.0.0` | | 2 | #8173 | Provider config and runtime info | PR 1 | | 3 | #8176 | Tool-call rendering | PR 2 | | 4 | #8175 | A2UI, Open Generative UI, MCP Apps | PR 3 | | 5 | **#8174 (this PR)** | Agents, threads, chat configuration | PR 4 | | 6 | #8179 | Chat sends, attachments, message view | PR 5 | | 7 | #8178 | Chat input, recorder, DOM controllers | PR 6 | | 8 | #8177 | Markdown renderer | PR 7 | | 9 | #8182 | Suggestions, Inspector, learning | PR 8 | | 10 | #8180 | Interrupts and human-in-the-loop | PR 9 | **Stack verification.** After each merge, the stack builder ran these on this layer's head before pushing it, all with `--skip-nx-cache`: build, check-types and tests for core, react-core, vue and angular, plus the packages this layer touches; the codemod tests; oxlint; and `check:public-api-manifest`. On the top layer it also ran publint, attw, and the shell-docs tests and build. All passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added Angular migration support for chat configuration overrides, including guidance for custom overrides. * Agent context values can now be supplied as JSON-compatible values and are serialized consistently across frameworks. * Vue’s agent hook now exposes whether the resolved agent is ready. * Inspector thread-view requests can select a chat thread and report connection failures. * **Improvements** * Chat configuration, agent resolution, thread lists, and thread-drawer actions now share behavior across frameworks. * Thread-list configuration errors and unsupported mutations are handled consistently. * **Documentation** * Expanded the 2.0 migration guide with framework-specific behavior and migration details. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
AlemTuzlak
added a commit
that referenced
this pull request
Nov 4, 2026
…e message view into core (#8179) The chat's send, attachment, thread-switch and message-list logic now lives in `@copilotkit/core`. React, Vue and Angular call it, so a fix there applies to all three. This fixes Vue sends that did not wait for the active run (#5195), Angular welcome-screen gating, and other drift between the three frameworks. This is PR 6 of 10 in the "2.0 core pipeline" stack. Base: `alem/2.0-core-agents-threads`. Merge it after PR 5. ## What does this PR do? New internal (`ɵ`) modules in `packages/core/src/chat/` and `packages/core/src/core/`: - `attachment-queue.ts`: `ɵAttachmentQueue`. It checks file type and size, shows a placeholder per file, uploads (`onUpload` or base64), and hands ready files to the next message. - `session.ts`: `ɵcreateChatSubmitter`. It owns send, suggestion, stop and transcription: the send queue, the upload guard, and the 5-second notice. - `thread-switch.ts` and `thread-baseline.ts`: `ɵThreadSwitchCoordinator` and `ɵresetAgentThreadBaseline`. They pin the thread, reset the agent on a switch to a fresh thread, and keep teardowns in order. The run handler uses the same reset. - `message-view.ts`: `ɵcreateMessageViewModel` for tool-call layout, the "turn" work summaries, and the cursor rule. - `chat-view.ts`: `ɵgetChatViewState` (suggestions, welcome screen, connecting indicator, padding) and the pin-to-send tracker. Fixes: - Vue now waits for the thread to load and for the active run before it sends (#5195). Before, a send in Vue stopped a thread load that was in progress, and the chat could stay in "connecting". - Vue and Angular show `chatAttachmentsUploadingText` and keep the typed text when an upload blocks a send. - Angular hides the welcome screen while the thread loads and when `[welcomeScreen]` is `false`. It also takes `[autoScroll]` instead of always scrolling. - Angular logs a failed detach on a thread switch instead of leaving an unhandled rejection. Not in this PR: a core connect/reconnect controller (item 6 of the slice). It is designed but not built. React, Vue and Angular still own their connect code. BREAKING CHANGE: behavior only. No public export, prop or input is removed or renamed. Migration steps are on the chat 2.0 migration page: - [Sending messages](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-chat-session/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#sending-messages): a send waits for the active run and the thread load. Blank text and loading suggestions are not sent. Angular sends text untrimmed. - [Attachment uploads](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-chat-session/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#attachment-uploads): `processFiles` needs `enabled: true`. Vue and Angular honor `maxConcurrentUploads`. - [Welcome screen and suggestions in Angular](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-chat-session/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#welcome-screen-and-suggestions-in-angular): a custom `<copilot-chat-view>` must pass `[isRunning]` and `[isConnecting]`. - [Console messages](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-chat-session/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#console-messages): new text for the Vue duplicate-ID warning and the Angular connect failure. ## Related PRs and Issues - Stack: PR 6 of 10, "2.0 core pipeline". Base `alem/2.0-core-agents-threads` (PR 5). - #5195 (Vue send did not wait for the active run). ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) - [ ] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) ## Merge notes - Angular `copilot-chat.ts` combines this layer's change with layer 5's. This layer makes a send wait for the thread to load. Layer 5 makes a failed connect end the Inspector's "view thread" override. Both now sit in the same connect callback. - A carry-over commit (`f47b53867f`) moves the React-only "connecting" indicator rule from 2.0.0 into core's `ɵgetChatViewState`, with tests. React reads it from there. ## Testing Commands run: - Before the stack merge: `nx run` build, check-types and test for `@copilotkit/core`, `@copilotkit/react-core`, `@copilotkit/vue` and `@copilotkit/angular`. Build and check-types passed. Tests: core 119/119 files, React 2482 passed. Vue 1437/1438 and Angular 675/677. The failures were timeouts under machine load (`build-entries`, `inspector.spec`, `mcp-apps-widget.spec`), and they passed when run alone. - On this head (`f47b53867f`): `nx run-many -t check-types` for the four packages passed. `nx run @copilotkit/core:test`: 146/146 files passed. `nx run` build for React, Vue and Angular passed when run one at a time. In one parallel run, the builds read a stale core `dist` and failed. - `nx run @copilotkit/v2-migration:test`: 52/52. `pnpm check:public-api-manifest`: current. - Not run: `nx run @copilotkit/vue:lint`. It fails with 197 errors on lines this PR does not touch. Core, React and Angular have no lint target. I ran repo `oxlint` on the changed files: 0 errors. Manual test (Vue, #5195): 1. On the base branch, open a Vue chat with an explicit `threadId` that has history. Send a message while the history still loads. The load stops, and the chat can stay in "connecting". 2. On this branch, do the same. The message waits until the history loads, then sends. 3. While a reply streams, send a second message. It sends after the first run ends. It does not stop that run. How this PR makes testing easy: core unit tests for every new module in `packages/core/src/chat/__tests__/` (`attachment-queue`, `session`, `thread-switch`, `message-view`, `chat-view`) and `packages/core/src/core/__tests__/thread-baseline.test.ts`. New Angular specs cover `[welcomeScreen]`, `[autoScroll]` and the connecting welcome gate. ## Risk / rollback The main risk is send timing. A send now waits for the active run in Vue. If a run never ends (for example, a human-in-the-loop prompt with no answer after its component unmounts in Vue), later sends wait too. To roll back, revert this PR. It has no data or config migration. ## Stack Merge in this order. Each PR's base is the PR above it. | # | PR | Area | Base | |---|---|---|---| | 1 | #8181 | Chat primitives | `2.0.0` | | 2 | #8173 | Provider config and runtime info | PR 1 | | 3 | #8176 | Tool-call rendering | PR 2 | | 4 | #8175 | A2UI, Open Generative UI, MCP Apps | PR 3 | | 5 | #8174 | Agents, threads, chat configuration | PR 4 | | 6 | **#8179 (this PR)** | Chat sends, attachments, message view | PR 5 | | 7 | #8178 | Chat input, recorder, DOM controllers | PR 6 | | 8 | #8177 | Markdown renderer | PR 7 | | 9 | #8182 | Suggestions, Inspector, learning | PR 8 | | 10 | #8180 | Interrupts and human-in-the-loop | PR 9 | **Stack verification.** After each merge, the stack builder ran these on this layer's head before pushing it, all with `--skip-nx-cache`: build, check-types and tests for core, react-core, vue and angular, plus the packages this layer touches; the codemod tests; oxlint; and `check:public-api-manifest`. On the top layer it also ran publint, attw, and the shell-docs tests and build. All passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Chat submission, stopping, transcription, attachment handling, and thread switching now follow consistent behavior across React, Vue, and Angular. * Chat views now provide more consistent welcome-screen, suggestion, connecting-indicator, and message-layout behavior, with configurable welcome screens and auto-scrolling in Angular. * **Bug Fixes** * Sends wait for active runs and thread connections; failed connections and attachment uploads are handled more consistently. * **Documentation** * Updated the chat 2.0 migration guide with cross-framework behavior and Angular welcome-screen details. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
AlemTuzlak
added a commit
that referenced
this pull request
Nov 4, 2026
…ntrollers into core (#8178) Merge this after PR 6. It moves the chat input, the audio recorder, and the DOM work of the sidebar, popup, lightbox, attachment previews, and scroll-to-bottom from React, Vue, and Angular into `@copilotkit/core`. The three framework packages now only connect that core logic to their own reactivity, so a fault in this logic is fixed in one place. It also fixes several drifts between the frameworks. PR 7 of 10 in the "2.0 core pipeline" stack. Base: `alem/2.0-core-chat-session` (PR 6). ## What does this PR do? New core code (internal `ɵ` exports): - **Slash-command menu** (`chat/composer.ts`): flatten, rank, query parsing, highlight, and key handling. React and Vue use it. - **Chat input auto-grow and layout** (`chat/composer-layout.ts`): `ɵcreateComposerAutosize` measures the text box, caps it at `maxRows` (default 5), picks the compact or expanded layout, and watches the elements with one `ResizeObserver`. All three use it. - **Audio recorder** (`chat/audio-recorder.ts`): `ɵAudioRecorder` and `ɵcreateWaveformRenderer`. All three use it. `AudioRecorderError` is now one class in all packages. - **DOM controllers** (`chat/dom.ts`): docked sidebar margins, popup dismiss, the lightbox morph and focus trap, document preview URLs, and the scroll-to-bottom check. Bugs fixed: - Angular: padding that the browser did not report made the text box max-height `NaN`. - Angular: the text box measured its max-height only once, so a later `inputMaxRows` was ignored. - Vue: on a phone, each keystroke emptied the text box to measure it. This moved the caret to the end. - React and Vue: a second `start()` during the microphone prompt opened a second stream. - React: the docked sidebar set the page margins to `""` and lost the margins that the page had. - Vue: a pointer down in a chat popover closed the popup. - React: the attachment preview had no dialog role, no focus trap, and no focus return. - React and Vue: text previews decoded base64 as Latin-1, so text outside ASCII showed incorrectly. The full list of behavior changes per framework is in the commit messages. ### Breaking changes BREAKING CHANGE: Angular `CopilotChatTextarea` has no `ngAfterViewInit()` method. It measures its height after each render. 1. Run the v2 codemod. In a subclass of `CopilotChatTextarea`, it deletes `super.ngAfterViewInit()` and removes `override` from `ngAfterViewInit`. See [the codemod transform](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-composer-dom/codemods/v2-migration/scripts/deprecated-apis.ts) and [its fixture](https://github.com/CopilotKit/CopilotKit/tree/alem/2.0-core-composer-dom/codemods/v2-migration/tests/ts/angular-textarea-lifecycle). 2. Read [Chat UI in 2.0](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-composer-dom/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx) for the behavior changes. The new sections: - "Angular text box" - "Audio recorder": a second `start()` rejects, and the Angular `error` output emits every failure. - "Docked sidebar": one owner, margins come back, the 767px breakpoint, and Vue server rendering. - "Slash commands in React", "Attachment previews", and "Scroll to bottom in Angular" (12px, was 10px). ## Related PRs and Issues - Stack: PR 7 of 10, "2.0 core pipeline". Base: `alem/2.0-core-chat-session` (PR 6). Merge after PR 6. ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) - [ ] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) ## Merge notes - `chat-2.0.mdx` was rebuilt when PR 6 was merged into this branch. The sections of this layer are appended at the end of the page. - Commit `97870c944e` makes `composer-layout.ts`, `dom.ts`, and the Angular sidebar use `ɵMOBILE_MAX_WIDTH_QUERY` from the chat-primitives layer. No `(max-width: 767px)` string remains in TypeScript source, except the definition of that constant. - `packages/core` gets `jsdom` as a dev dependency for its DOM tests. The lockfile change is only that dependency. ## Testing Commands run: - On this layer before the merge of PR 6: `pnpm nx run-many -t build,test,lint,check-types` for core, react-core, vue, and angular. Build and check-types passed. Core tests passed (1942). The other failures were: - 3 recharts Chart tests in react-core. They also fail without this layer. - Timeouts on a loaded machine. They passed when I ran them again with a longer timeout. - `vue:lint`, with 197 errors that were already on the base. - On head `97870c944e`, after the merge of PR 6: `pnpm nx run-many -t check-types` for the same four projects passed. The core chat tests passed (577). - Codemod: `pnpm --filter @copilotkit/v2-migration test` passed, with the new fixture. `check-types` passed. - Docs: `pnpm kiira check` on `chat-2.0.mdx` passed. `pnpm check:public-api-manifest` reports the manifest is current. Not run after the merge of PR 6: the full test suites of react-core, vue, and angular. CI is the check for those. Manual test: 1. Open a chat with a sidebar, type a long line, then a line break. The text box grows to 5 rows, then scrolls. The buttons move below it. 2. On a narrow window (767px or less), the text box sits above the buttons. 3. Open the docked sidebar, then close it. The page margin comes back to what it was before. 4. In React, open an image attachment. Focus moves to the close button, Tab stays inside, and Escape returns focus to the thumbnail. 5. Start a voice recording, then stop it. The waveform moves, and the recording is transcribed. How this PR makes testing easy: - New core tests: `composer-slash`, `composer-layout`, `audio-recorder`, `dom` (jsdom). - New adapter tests for each behavior change. For example `Lightbox.test.tsx`, `copilot-chat-audio-recorder.spec.ts`, `stick-to-bottom.spec.ts`, and the sidebar margin tests. - The codemod fixture `tests/ts/angular-textarea-lifecycle`. ## Risk / rollback Risk is medium. The three frameworks now share one chat input, one recorder, and one set of DOM controllers, so a core fault shows in all three. The most visible change is the docked sidebar: only one docked sidebar adds a page margin, and the margin now follows viewport changes. To undo, revert this PR. Later layers of the stack build on it. ## Public API change **Before** ```ts @component({ selector: "textarea[appTextarea]", template: "" }) export class AppTextarea extends CopilotChatTextarea { override ngAfterViewInit(): void { super.ngAfterViewInit(); } } ``` **After** ```ts @component({ selector: "textarea[appTextarea]", template: "" }) export class AppTextarea extends CopilotChatTextarea {} ``` ## Stack Merge in this order. Each PR's base is the PR above it. | # | PR | Area | Base | |---|---|---|---| | 1 | #8181 | Chat primitives | `2.0.0` | | 2 | #8173 | Provider config and runtime info | PR 1 | | 3 | #8176 | Tool-call rendering | PR 2 | | 4 | #8175 | A2UI, Open Generative UI, MCP Apps | PR 3 | | 5 | #8174 | Agents, threads, chat configuration | PR 4 | | 6 | #8179 | Chat sends, attachments, message view | PR 5 | | 7 | **#8178 (this PR)** | Chat input, recorder, DOM controllers | PR 6 | | 8 | #8177 | Markdown renderer | PR 7 | | 9 | #8182 | Suggestions, Inspector, learning | PR 8 | | 10 | #8180 | Interrupts and human-in-the-loop | PR 9 | **Stack verification.** After each merge, the stack builder ran these on this layer's head before pushing it, all with `--skip-nx-cache`: build, check-types and tests for core, react-core, vue and angular, plus the packages this layer touches; the codemod tests; oxlint; and `check:public-api-manifest`. On the top layer it also ran publint, attw, and the shell-docs tests and build. All passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Improved chat input autosizing and slash-command menus across Angular, React, and Vue, including support for commands that load after text is entered. * Added accessible lightbox dialogs with focus management and clearer labels for attachment previews. * Improved audio recording, waveform display, attachment previews, and docked sidebar behavior across frameworks. * **Bug Fixes** * Prevented typed text from being cleared on phone-sized screens and kept popovers from dismissing the chat popup. * Sidebar margins are restored when the sidebar closes or is removed. Scrolling now treats distances up to 12px as at the bottom. * **Documentation** * Expanded the chat 2.0 migration guide with framework-specific migration details. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
AlemTuzlak
added a commit
that referenced
this pull request
Nov 4, 2026
…shared engine (#8177) React, Vue, and Angular now render assistant markdown with one engine from `@copilotkit/markdown`. Markup and URL sanitization live in one file, so a fix there reaches all three frameworks. Angular drops `marked` and DOMPurify and keeps KaTeX math. This is PR 8 of 10 in the "2.0 core pipeline" stack. Base: `alem/2.0-core-composer-dom`. Merge it after PR 7. ## What does this PR do? **What moved where** - `packages/markdown/src/render/` is new and has no framework code. `render-tree.ts` decides the elements, sanitized attributes, click actions, text segments for the fade-in, and the caret position. `parser-session.ts` parses only the appended text (this logic was inside the React hook). - The React and Vue renderers now only map that tree to elements and VNodes. - New subpath **`@copilotkit/markdown/dom`**: `createStreamingMarkdownDomRenderer(container)`. It patches the DOM by key, so text on screen keeps its nodes and does not fade in again. It creates nodes through `container.ownerDocument`, so it works on server DOMs. - Angular `components/chat/markdown.ts` uses the DOM renderer. `marked` and `dompurify` are removed from `@copilotkit/angular`. - The parser gets GFM task lists (`listItem.checked`) and an opt-in `enableMath` option for `math` nodes. Angular turns math on and typesets it with `katex.render()`, which builds DOM nodes, so no HTML string is parsed. **Bugs fixed** - Vue never showed the streaming caret. The boolean prop became `false`, so `caret ?? isStreaming` never fell back. - Vue did not pass `onLinkClick` / `onCitationClick` to the renderer. - Vue rendered an empty root for empty content. React rendered nothing. Both render nothing now. - Vue re-parsed the whole message on every update. It now parses only the new text. - Angular had no caret and no fade-in, and its parser and sanitizer were different from React and Vue. **Breaking changes** BREAKING CHANGE: the `@copilotkit/markdown` AST node types include `math`, and a task-list item has `checked` with no `[ ]` / `[x]` marker in its text. Exhaustive switches on `node.type` and maps keyed by every node type stop type-checking. The codemod marks these imports with a `TODO(copilotkit-2.0)` comment ([codemod](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-markdown-dom-renderer/codemods/v2-migration/scripts/codemod.ts), [fixtures](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-markdown-dom-renderer/codemods/v2-migration/tests/ts/markdown-ast)). These changes are behavior only, so no codemod applies. The steps are in the migrate section ["Rendering changes in 2.0"](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-markdown-dom-renderer/showcase/shell-docs/src/content/snippets/shared/migration-guides/migrate-markdown-renderer.mdx), on the `/migrate/markdown-renderer` page: - **Angular:** raw HTML in model output shows as text. A single newline is a soft break, not `<br>`. The table header is in `<tbody>`, and links open in a new tab. - **Angular:** `marked` and `dompurify` are no longer installed. Apps that import them must add them. - **React and Vue:** task-list items render as disabled checkboxes. - **Vue:** strikethrough is `<s>`, not `<del>`. The caret shows while the latest message streams. The renderer adds a `<style>` element next to its root. **Merge notes** Merging layer 7 into this branch conflicted only in the codemod `README.md` and `agents/skill/v2-migration/references/mappings.md`. Both sides were kept. My web-inspector change moved with its file to `packages/web-inspector/src/domains/announcements/markdown.ts`. ## Related PRs and Issues - PR 7 of the stack: `alem/2.0-core-composer-dom` (base of this PR) ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) - [ ] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) ## Testing **Commands run** - On the merged head `2e1ffc0f95`: `nx run-many -t test -p @copilotkit/markdown @copilotkit/v2-migration` passes (215 tests, 73 codemod fixtures). The web-inspector announcements tests pass (93). - Before the layer 7 merge: build, check-types, publint, and attw pass for markdown, core, react-core, vue, angular, and web-inspector. Tests pass for all of them except react-core. - react-core has 3 failures in chart tests (`chart.test`, `chart-scatter.test`, `data.test`). They failed the same way on the old base. `2.0.0` has since fixed them, and they pass on the stacked heads. - `@copilotkit/vue:lint` reports 197 errors, all in files this PR does not touch. - `pnpm check:public-api-manifest` passes. kiira type-checks the changed doc pages (8 of 8 snippets). - I did not run the full suite again after the layer 7 merge. **Manual test** 1. Start the Angular demo and send a message with `**bold**`, a task list, and `$x^2$`. 2. While the reply streams, see the caret and the fade-in. After it finishes, see the checkbox and the typeset math. 3. In the Vue demo, send a long reply. Before this PR, no caret showed. Now the caret shows until the reply finishes. **How this PR makes testing easy** - Unit tests for the render tree, parser session, DOM renderer, and parser additions in `packages/markdown/src`. - Parity tests for the Vue renderer and the Vue default renderer. The Angular renderer spec covers caret, empty content, and rendering without a global `document`. - Codemod fixtures in `codemods/v2-migration/tests/{ts,tsx}/markdown-ast*`. ## Risk / rollback Medium risk for Angular, because its markdown markup changed (see the breaking changes above). React output is the same except for task lists and the default code block (data attributes, and the caret while it streams). To undo, revert this PR. Layers 9 and 10 build on it, so revert them first. ## Public API change **Before** ```ts import type { StreamingMarkdownAstNode } from "@copilotkit/markdown"; function label(node: StreamingMarkdownAstNode) { if (node.type === "list-item") return "item"; // task state only in the text: "[x] done" return node.type; } ``` **After** ```ts import type { StreamingMarkdownAstNode } from "@copilotkit/markdown"; import { createStreamingMarkdownDomRenderer } from "@copilotkit/markdown/dom"; function label(node: StreamingMarkdownAstNode) { if (node.type === "math") return node.display ? "display math" : "inline math"; if (node.type === "list-item") return node.checked === undefined ? "item" : "task"; return node.type; } const renderer = createStreamingMarkdownDomRenderer(element); renderer.render({ content: "**Hi**", caret: true }); ``` ## Stack Merge in this order. Each PR's base is the PR above it. | # | PR | Area | Base | |---|---|---|---| | 1 | #8181 | Chat primitives | `2.0.0` | | 2 | #8173 | Provider config and runtime info | PR 1 | | 3 | #8176 | Tool-call rendering | PR 2 | | 4 | #8175 | A2UI, Open Generative UI, MCP Apps | PR 3 | | 5 | #8174 | Agents, threads, chat configuration | PR 4 | | 6 | #8179 | Chat sends, attachments, message view | PR 5 | | 7 | #8178 | Chat input, recorder, DOM controllers | PR 6 | | 8 | **#8177 (this PR)** | Markdown renderer | PR 7 | | 9 | #8182 | Suggestions, Inspector, learning | PR 8 | | 10 | #8180 | Interrupts and human-in-the-loop | PR 9 | **Stack verification.** After each merge, the stack builder ran these on this layer's head before pushing it, all with `--skip-nx-cache`: build, check-types and tests for core, react-core, vue and angular, plus the packages this layer touches; the codemod tests; oxlint; and `check:public-api-manifest`. On the top layer it also ran publint, attw, and the shell-docs tests and build. All passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added a framework-independent DOM renderer for streaming Markdown, with support for custom rendering, link and citation callbacks, and optional math rendering. * Markdown parsing now supports math when enabled and checked or unchecked task-list items. * React, Vue, and Angular assistant messages now share consistent streaming Markdown behavior, including caret display and task-list rendering. * **Improvements** * Raw HTML is displayed as text, and unsafe links and image URLs are filtered. * Added migration guidance and automated TODO comments for code that reads Markdown AST types. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
AlemTuzlak
added a commit
that referenced
this pull request
Nov 4, 2026
Interrupts and human-in-the-loop (HITL) now run in `@copilotkit/core`. React, Vue, and Angular only project core state and render it. This also fixes four bugs that were in one or two of the three copies. This is PR 10 of 10 in the "2.0 core pipeline" stack. Base: `alem/2.0-core-suggestions-inspector-learning`. Merge it last. ## What does this PR do? Moved into core: - **`ɵInterruptController`** (`core/interrupt-controller.ts`): collects legacy and standard interrupts per run, runs `enabled` and `handler`, records answers in `ɵInterruptState`, adds tool results, and starts one resume run. `useInterrupt` (React, Vue) and `InterruptController` / `injectInterrupt` (Angular) project its snapshot. - **A generic interrupt slot** on `CopilotKitCore` (`ɵsetInterruptPayload`). React `setInterruptElement` and Vue `setInterruptState` store their value in it. Their names and events do not change. - **`ɵHumanInTheLoopRegistry`** (`core/human-in-the-loop.ts`, on `core.ɵhumanInTheLoop`): each HITL call waits by tool call id until `respond`. `ɵbuildHumanInTheLoopTool` and `ɵhitlRenderProps` build the tool and the render props for all three frameworks. - **Pending HITL calls in the run handler**: when no registration of a tool is left, its waiting calls fail with `Human-in-the-loop interaction aborted`. Bugs fixed: - **Angular `"*"` HITL tools hung.** The handler waited for the name `"*"`, but `respond` sent the called tool name. - **Parallel HITL calls in React and Vue.** One resolver per hook let a second call replace the first, so the first call never finished. - **Vue interrupt state.** Vue did not use the shared interrupt state. It did not add tool results, use saved frontend results, show pending interrupts after a reload, or catch a throw from `enabled` or `handler`. - **Waits after unmount.** When a HITL component unmounted with no answer, the run never ended. The Vue chat waits for that run, so the next message stayed queued. Now core rejects the wait and the run ends. ### Breaking behavior changes The exports and types do not change. Some behavior changes. Each item has a section in the migration guide: - **HITL calls end on abort:** a call fails with `Human-in-the-loop interaction aborted` when the provider unmounts, when you call `dispose()` on the core, or when its tool is unregistered and no other component registers it. See [Human-in-the-loop tools](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-interrupts-hitl/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#human-in-the-loop-tools). - **Interrupts in React and Vue:** a `RUN_ERROR` event removes the interrupt, and an answer after a thread change does not resume. See [Interrupts in React and Vue](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-interrupts-hitl/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#interrupts-in-react-and-vue). - **Interrupts in Vue:** `enabled` runs one time for each interrupt, and the `interrupt` ref is `null` while `enabled` returns `false`. See [Interrupts in Vue](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-interrupts-hitl/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#interrupts-in-vue). - **Angular scroll threshold:** the chat view uses the core default of 12px from the end. See [Scroll to bottom in Angular](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-interrupts-hitl/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#scroll-to-bottom-in-angular). BREAKING CHANGE: HITL calls now fail with "Human-in-the-loop interaction aborted" when their tool is unregistered, the provider unmounts, or the core is disposed. React and Vue interrupts clear on RUN_ERROR and after a thread change. Vue runs `enabled` one time per interrupt. To migrate, follow the "Interrupts and human-in-the-loop" section of `migrate/chat-2.0.mdx`. No codemod: no export or type changes. ### Merge notes These files combine this layer with layer B (tool-call rendering): - **`core/run-handler.ts`:** keeps this layer's pending-HITL table and microtask check. B's executing-call cleanup sits beside it in the same `finally` block. - **React `lib/react-core.ts` and Vue `lib/vue-core.ts`:** B's `ɵRendererRegistry` plus this layer's core interrupt slot. - **Angular `buildHumanInTheLoopToolCall`:** uses B's core-built props and this layer's core `respond`. ### Top-of-stack cleanup commits - The React and Vue `normalize-auto-scroll.ts` and Vue `is-mobile-viewport.ts` shims are removed. - Vue `CopilotChatView` uses `ɵisScrolledToBottom`. - Angular `autoScroll` goes through core's `ɵnormalizeAutoScroll`. - Angular `[threshold]="10"` is removed, so the chat view uses the core default of 12px. The migration page has a note. ## Related PRs and Issues - PR 9 of the stack (base): `alem/2.0-core-suggestions-inspector-learning` ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) - [ ] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) ## Testing **Commands run** on head `b254db2961`: - `pnpm nx run-many -t test,check-types -p @copilotkit/core @copilotkit/vue @copilotkit/angular @copilotkit/react-core --skip-nx-cache` - core: 155 of 155 test files pass. - Angular: 74 of 74 test files pass. - react-core: 197 test files pass, 2 skipped. - Vue: 1459 of 1460 tests pass. `src/__tests__/build-entries.test.ts` hit its 5 s timeout under load. Run alone, it passes (2 of 2). - `@copilotkit/markdown:check-types` failed once in this run, because the worktree had a stale install after the stack merge. Re-run on this head with `--skip-nx-cache`, it passes. - `pnpm nx run-many -t check-types -p @copilotkit/core @copilotkit/vue @copilotkit/angular @copilotkit/react-core --exclude-task-dependencies --skip-nx-cache`: pass. - `pnpm nx run @copilotkit/v2-migration:test`: 15 tsx and 39 ts cases pass. No codemod change in this layer. - `pnpm check:public-api-manifest`: current. **Manual test** (Vue, unanswered prompt): 1. In a Vue app, call `useHumanInTheLoop` in a component that you can hide with `v-if`. 2. Ask the agent to call that tool. The HITL card shows. 3. Hide the component. Do not answer. 4. Send a new message. Before this PR, the first run never ended. Now the call ends with `Human-in-the-loop interaction aborted` and the message sends. **How this PR makes testing easy:** - `packages/core/src/core/__tests__/interrupt-controller.test.ts` and `human-in-the-loop.test.ts` test the new core modules. - `packages/core/src/__tests__/core-hitl-unregister.test.ts` tests rejection on unregister, a same-pass re-registration, and no resurrection. - `packages/angular/src/lib/human-in-the-loop.spec.ts` covers the `"*"` hang and parallel calls. - React `use-human-in-the-loop.e2e.test.tsx` and Vue `use-human-in-the-loop.test.ts` cover parallel calls and the Vue unmount case. ## Risk / rollback - **Risk:** apps that depend on the earlier behavior listed above. For example, a test that expects a HITL call to stay open after its component unmounts. - **Merge order:** this layer sits on 9 others. Merge it last. - **Rollback:** revert this PR. The layers below it do not depend on it. ## Stack Merge in this order. Each PR's base is the PR above it. | # | PR | Area | Base | |---|---|---|---| | 1 | #8181 | Chat primitives | `2.0.0` | | 2 | #8173 | Provider config and runtime info | PR 1 | | 3 | #8176 | Tool-call rendering | PR 2 | | 4 | #8175 | A2UI, Open Generative UI, MCP Apps | PR 3 | | 5 | #8174 | Agents, threads, chat configuration | PR 4 | | 6 | #8179 | Chat sends, attachments, message view | PR 5 | | 7 | #8178 | Chat input, recorder, DOM controllers | PR 6 | | 8 | #8177 | Markdown renderer | PR 7 | | 9 | #8182 | Suggestions, Inspector, learning | PR 8 | | 10 | **#8180 (this PR)** | Interrupts and human-in-the-loop | PR 9 | **Stack verification.** After each merge, the stack builder ran these on this layer's head before pushing it, all with `--skip-nx-cache`: build, check-types and tests for core, react-core, vue and angular, plus the packages this layer touches; the codemod tests; oxlint; and `check:public-api-manifest`. On the top layer it also ran publint, attw, and the shell-docs tests and build. All passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
3 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.

React, Vue, and Angular now get suggestions, Inspector mounting, and the
learningauto-start from@copilotkit/coreand@copilotkit/web-inspector. A fix in that logic is now one change, not three. Vue and Angular get the Inspector rules that React had, and Angular getsconfigureSuggestionsand alearningoption.This is PR 9 of 10 in the "2.0 core pipeline" stack. Base:
alem/2.0-markdown-dom-renderer. Merge it after PR 8.What does this PR do?
What moved where
ɵbindSuggestionsConfig(core) owns config dedupe, the target agent, global and targeted reloads, a retry for agents that were running, and the wait for a dynamic config's agent.ɵsubscribeToAgentSuggestionskeeps a view's list and loading flag current.useConfigureSuggestionsanduseSuggestionsin React and Vue now only call these.shouldEnableInspector(@copilotkit/shared) takes an optionalhostnameand allows onlylocalhost,127.0.0.1, and[::1].ɵmountInspector(@copilotkit/web-inspector/mount) loads the element, sets the core before it connects, replays an early open request, reports visibility, and removes the element. The adapters keep only the host element.ɵLearningAutoStarter(core) owns the generated Trajectory ID, start and stop, the warnings, and the guard for a late start failure. The React and Vue providers only callupdate()anddispose().Bugs fixed
<CopilotKitInspector>now gives event listeners, such as@cpk-inspector-visibility-change, to thecpk-web-inspectorelement.useConfigureSuggestionsignored the provideragentId. Vue did not load a global config while the agent list was empty, and did not wait for a dynamic config's agent.New subpath:
@copilotkit/web-inspector/mount. It has no runtime import of the Inspector bundle, so the Inspector stays a lazy chunk. The public API manifest has the new entry.Breaking changes
BREAKING CHANGE: the changes below are behavior only, so no codemod applies. The steps are in the migrate page
/migrate/chat-2.0:enableInspector: true. The message "Inspect" action shows only while the Inspector is visible. Vue<CopilotKitInspector>does not give object values (for example:style="{ ... }") to the element.agentId, not"default". Agents skipped while running reload when the run ends. Adepschange no longer reloads a second time on mount.Merge notes
2.0.0rejected a top-levelsrc/mount.ts. Afix(web-inspector)commit moved it tosrc/shell/mount.ts. It still builds todist/mount.*, so the./mountexport is unchanged.ɵLearningPropwas removed in favor of D's identicalɵCopilotKitLearningOptions.Related PRs and Issues
alem/2.0-markdown-dom-renderer, base of this PR)Checklist
!(for examplefeat(react-core)!: ...) and the description has aBREAKING CHANGE:line with migration steps. See VERSIONING.mdTesting
Commands run
nx run-many -t build,check-types,test,publint,attwpassed for core, react-core, vue, angular, shared, and web-inspector, except for the items below.chart.test,chart-scatter.test,data.test) and the Vuebuild-entriestest failed under full-suite load. They pass when run alone, on this branch and on the base commit.@copilotkit/vue:lintfails with the same errors on the base commit, in files this PR does not touch.pnpm check:public-api-manifestpasses.pnpm --filter @copilotkit/v2-migration testpasses (36 of 36).89939875ea: the Angularinspector.spec.tspassed 5 of 5 times with--skip-nx-cache. It also passed 5 of 5 on a cleanorigin/2.0.0. I did not run the full suites again after the layer 8 merge.Manual test
http://localhost:<port>. The Inspector button shows.http://192.168.1.20:<port>). Before this PR, the Inspector mounted. Now it does not.localhost, hide the Inspector. The "Inspect" action on assistant messages is hidden too.useConfigureSuggestionswith static suggestions outside a chat, under<CopilotKitProvider agentId="support">. The suggestions show for thesupportagent.How this PR makes testing easy
packages/core/src/core/__tests__/suggestions-binding.test.tsandlearning-autostart.test.ts.packages/web-inspector/src/__tests__/mount.spec.tsand theshouldEnableInspectorhostname tests inpackages/shared.CopilotKitInspector.test.tsandCopilotKitProvider.test.ts, and Angularinspector.spec.ts,configure-suggestions.spec.ts, andlearning.spec.ts.Risk / rollback
Medium risk for the Inspector in Vue and Angular: developers who open the app on a LAN address or a tunnel no longer see it. Suggestions and learning keep the same public options. To undo, revert this PR. Layer 10 builds on it, so revert layer 10 first.
Public API change
Angular gets the suggestions and learning options that React and Vue have.
Before
After
Stack
Merge in this order. Each PR's base is the PR above it.
2.0.0Stack verification. After each merge, the stack builder ran these on this layer's head before pushing it, all with
--skip-nx-cache: build, check-types and tests for core, react-core, vue and angular, plus the packages this layer touches; the codemod tests; oxlint; andcheck:public-api-manifest. On the top layer it also ran publint, attw, and the shell-docs tests and build. All passed.🤖 Generated with Claude Code
Summary by CodeRabbit