Skip to content

refactor(core)!: move interrupts and human-in-the-loop into core - #8180

Merged
AlemTuzlak merged 162 commits into
2.0.0from
alem/2.0-core-interrupts-hitl
Nov 4, 2026
Merged

AlemTuzlak merged 162 commits into
2.0.0from
alem/2.0-core-interrupts-hitl

Conversation

@AlemTuzlak

@AlemTuzlak AlemTuzlak commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

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.
  • 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.
  • Interrupts in Vue: enabled runs one time for each interrupt, and the interrupt ref is null while enabled returns false. See Interrupts in Vue.
  • Angular scroll threshold: the chat view uses the core default of 12px from the end. See 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
  • If the PR changes or adds functionality, I have updated the relevant documentation
  • 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
  • "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

AlemTuzlak and others added 30 commits November 3, 2026 13:37
Vue put the raw web_core action into the a2uiAction run property. Both
runtimes (@ag-ui/a2ui-middleware and runtime-python) read
forwardedProps.a2uiAction.userAction, so a Vue button click reached the
agent with no action. Wrap it as React and Angular do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
React and Vue kept byte-identical copies of the message feedback store,
the learning-enabled check and the comment popover state machine. Core now
owns them (ɵgetMessageFeedback, ɵsetMessageFeedback,
ɵisLearningFeedbackEnabled, ɵgetMessageFeedbackControls,
ɵFeedbackCommentController); both adapters only project the state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… default error handler

Move the provider logic that React, Vue, Angular and React Native each
copied into core:

- ɵresolveProviderConfig: public key fallback, Copilot Cloud URL, transport
  mapping, agent merge, a2uiCatalogAvailable property, header defaults and
  config diagnostics; ɵreportProviderConfigDiagnostics throws in production
  and logs each message once.
- ɵSTABLE_ARRAY_WARNINGS and ɵtoolRendererShapeChanged for the stable
  array prop warnings.
- CopilotKitCore.ɵupdateConfig: applies only the keys present, in a fixed
  order (message filter first).
- CopilotKitCore.ɵruntimeInfo + ɵsubscribeToRuntimeInfo: one frozen
  snapshot of the /info fields that keeps its identity until a field changes.
- onError config + setErrorHandler. Without a handler, core now logs
  "[CopilotKit] Error (code):" itself, as the React provider did.
- defaultThrottleMs config option.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…helper

ɵCopilotKitProviderBaseOptions holds the docs for the provider options that
the React, Vue and React Native providers copied word for word.
ɵpublicKeyHeaderDefaults builds the public key header defaults from the key
alone, so adapters can memoize them on the key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…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]>
React, Vue and Angular each carried their own copy of the interrupt
lifecycle and of the human-in-the-loop promise broker. Move both into
core so a logic fix lands in one place:

- `ɵInterruptController` collects legacy and standard interrupts per run,
  runs `enabled`/`handler` with a generation guard, records answers in
  the shared `ɵInterruptState`, appends tool results and starts one
  resume run. Adapters project `getSnapshot()` into their reactivity.
- `ɵsetInterruptPayload` / `ɵsubscribeToInterruptPayload` give the core
  a generic in-chat interrupt slot for the framework slots to delegate to.
- `ɵHumanInTheLoopRegistry` (on `core.ɵhumanInTheLoop`) parks each call
  by tool call id and rejects with `ɵHITL_ABORTED_MESSAGE` on abort or
  dispose. `ɵbuildHumanInTheLoopTool` and `ɵhitlRenderProps` build the
  tool and the render props, including `"*"` catch-all naming.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ontroller

`InterruptController` keeps its public signals (`event`, `interrupt`,
`interrupts`, `result`, `error`, `hasInterrupt`, `view`) and methods, and
now projects core's `ɵInterruptController` snapshot into a signal.
`InterruptExpiredError` is re-exported from core under the same name.
Log messages now use the shared wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A `"*"` human-in-the-loop registration hung: the handler waited for a
result tagged with the registration name (`"*"`), but `respond` published
the called tool's name, so the two never matched. Route both through
core's `ɵHumanInTheLoopRegistry`, keyed by tool call id only, and drop
the internal rxjs `HumanInTheLoop` service (it was not exported).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e refs

React's shallowEqual and Vue's shallowEqualObjects compared with !== and
did not check that each key exists on both sides, so { a: undefined } and
{ b: undefined } counted as equal. Both now use core's ɵshallowEqualRecord
(Object.is plus own-key check).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…core

React and Vue each kept normalizeAutoScroll, the mobile media query
watcher, the visual-viewport keyboard math and the pin-to-send spacer and
scroll logic. Core now owns them in chat/viewport.ts (ɵnormalizeAutoScroll,
ɵwatchMobileViewport, ɵreadKeyboardState, ɵwatchKeyboardState,
ɵpinMessageToTop). React's pin-to-send gains Vue's guards for a missing
requestAnimationFrame or ResizeObserver.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…controller

Drop the duplicate thenable check and keep the legacy-event helper
private; no adapter needs either one now that the snapshot carries
ready-made render props.

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]>
…gh core

The React provider now gets its config normalization from
ɵresolveProviderConfig, pushes props with core.ɵupdateConfig, projects
core.ɵruntimeInfo, and hands onError to core (which logs when there is
none). The props interface extends ɵCopilotKitProviderBaseOptions.

Behaviour changes:
- The provider now disposes its core on unmount. The dispose waits one task
  so the StrictMode remount keeps the same core; a remount after a real
  dispose (e.g. <Activity>) builds a new core.
- The "Missing required prop" warning is logged once per provider instead
  of on every render.
- A StrictMode remount no longer re-pushes the tool and renderer lists over
  the ones children registered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
React's interrupt hook accepted an `onRunFailed` call without params and
a `runAgent` that returns a plain value; the core controller now does
too, so moving React onto it changes neither.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`useInterrupt` now projects `ɵInterruptController` through
`useSyncExternalStore` and only renders and publishes the element.
`setInterruptElement` stores the element in core's generic interrupt
slot; `interruptElement` and `onInterruptElementChanged` keep working.

Behaviour changes from the shared controller:
- a RUN_ERROR event clears a shown interrupt (as Angular did);
- an answer after the agent switched threads is dropped, not resumed;
- concurrent answers while the resume run starts share one promise;
- an unknown interruptId is ignored with a warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add ɵAttachmentQueue and ɵbuildUserMessageContent to @copilotkit/core.
React useAttachments, Vue useAttachments and the Angular attachments
directive now only wire the DOM (picker, drag-and-drop, paste) to it.

Behaviour now shared by all three frameworks:
- maxConcurrentUploads is honoured in Vue and Angular (was React only),
  and every picked file shows as uploading at once.
- processFiles does nothing while attachments are disabled (was Angular
  only).
- the file picker is cleared after each upload so the same file can be
  picked again (was Vue only).
- handler errors are caught and logged in Vue (was React only).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
React and Vue each mapped a banner type to its severity, text, link and
colours and published the 52px bottom offset. Core now owns that in
chat/license.ts (ɵgetLicenseBannerSpec, ɵgetInlineFeatureWarningSpec,
ɵLICENSE_BANNER_STYLE, ɵreserveLicenseBannerOffset).

React's banners now read the configured chat labels instead of always the
defaults, and Vue's inline warning uses the licenseFeatureUnlicensedText
label instead of hard-coded text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lver

Add ɵAgentResolver (one per core, via ɵgetAgentResolver) with the binding
validation, agent-id fallback chain, shared provisional agent cache,
thread-scoped proxy registration and the provisional-to-registered
hand-off bridge lifted from Angular. React useAgent, Vue useAgent and
Angular injectAgentStore now call it instead of keeping their own copies.

Behaviour changes:
- React/Vue: same-id consumers share one provisional agent, and data
  written to it during the /info window is copied to the registered agent.
- Provisional agents get the registered-proxy settings (credentials,
  intelligence, debug, message filter, endpoint URL, runtimeMode pending).
- React keys header refresh on ɵheadersGeneration (#1937).
- Vue: useAgent returns isReady, re-renders on run start, and batches
  message notifications like React.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A provider can build its human-in-the-loop tools before it creates the
core; the getter is read on each call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`useHumanInTheLoop` kept one resolver per hook, so two parallel calls of
the same tool overwrote each other and the first call never resolved.
The hook and the provider's `humanInTheLoop` prop now both build their
tool and render props with core's `ɵHumanInTheLoopRegistry`, which parks
each call by tool call id.

The provider's prop tools now also forward every `FrontendTool` field
(`available`, `reconnectBehavior`, `webmcp`), as the hook already did.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Flatten, rank, query parsing, highlight wrapping and Enter/Escape handling
now live in @copilotkit/core (ɵflattenCommandItems, ɵfilterCommands,
ɵparseSlashQuery, ɵnextSlashIndex, ɵclampSlashIndex, ɵresolveSlashKey).
React and Vue call them instead of their own copies.

Behaviour changes:
- React: leaf menu entries with no action (an empty group) are no longer
  listed as slash commands, as in Vue.
- Vue: the slash menu opens for typed "/" text when commands arrive later,
  as in React.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Vue's `useInterrupt` built the resume array itself and skipped the shared
`ɵInterruptState`. It now projects core's `ɵInterruptController` into a
`shallowRef`, and `setInterruptState` stores the props in core's generic
interrupt slot (`interruptState` and `onInterruptStateChanged` keep
working). Vue now:
- appends tool-result messages for frontend tool-call interrupts;
- adopts results frontend tools already gave and skips completed calls;
- picks up the agent's pending interrupts at mount and keeps shared
  decisions when a reconnect replays RUN_STARTED;
- resumes when the only expired interrupt was cancelled;
- catches a synchronous throw from `enabled` or `handler`;
- clears on a RUN_ERROR event and drops answers after a thread switch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… core

The Vue provider now gets its config normalization from
ɵresolveProviderConfig, pushes props with core.ɵupdateConfig, projects
core.ɵruntimeInfo, and hands onError to core. The props interface extends
ɵCopilotKitProviderBaseOptions.

Behaviour changes:
- /info is deferred to onMounted (deferInitialConnection + connect()), so
  server-side setup no longer fetches it.
- Without onError, core errors are now logged ("[CopilotKit] Error (code):"),
  as in React.
- An invalid defaultThrottleMs is reported once by core; the provider's own
  duplicate message is gone.
- renderToolCalls now warns when its shape (agentId:name pairs) changes, as
  in React.
- The "Missing required prop" warning is logged once per provider.
- CopilotChatConfigurationProvider no longer re-registers its open Thread on
  every runtime status event.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…works

Add ɵInspectorThreadOverride to the inspector thread bridge: it claims a
matching "view thread" request, keeps the thread to return to, and ends
the override on stop, agent change, a new chat thread, or a failed
connect. React and Vue useInspectorThreadOverride now bind it instead of
running their own copies of the state machine.

fix(angular): Angular chats now apply the Inspector's view-thread request
and report a failed connect back to the Inspector, like React and Vue.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`useHumanInTheLoop` kept one resolver per composable, so two parallel
calls of one tool overwrote each other, and it named a `"*"` catch-all
render `"*"` instead of the called tool. The composable and the
provider's `humanInTheLoop` prop now build their tool and render props
with core's `ɵHumanInTheLoopRegistry` and `ɵhitlRenderProps`.

The provider no longer falls back to `ɵanySchema` for a prop tool with
no `parameters`: renderer `args` is optional, as in React. Prop tools
now forward every `FrontendTool` field (`available`,
`reconnectBehavior`, `webmcp`). Disposing the core rejects calls that
are still parked with the human-in-the-loop abort error.

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]>
Core now owns the set of tool calls whose frontend handler is running:
`CopilotKitCore.executingToolCallIds` plus an `onExecutingToolCallsChanged`
subscriber event. A call joins the set right after its handler is called
and leaves it once its result is in `agent.messages`, so a renderer never
sees a finished call without its result and a HITL `respond` always reaches
a waiting handler.

React and Vue providers read the core set instead of re-tracking
start/end events (Vue no longer removes ids one tick late with
setTimeout). Angular gets an `executingToolCallIds` signal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AlemTuzlak and others added 13 commits November 3, 2026 19:54
…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]>
Brings in the lint gate (#8172), the inspector feed fixture (#8187) and
the CI checkout fix (#8198). The Angular copy buttons keep the stack's
core copy feedback, which already voids its promise. Core lists jsdom as
a devDependency, so knip no longer flags its jsdom tests as unlisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r-config

The React and React Native providers keep this layer's core error
handler (setErrorHandler); the onError subscriber that the lint fix
touched is gone. The lint baseline moves one no-explicit-any from the
React, React Native and Vue providers to core's CopilotKitCoreErrorEvent
(context: Record<string, any>, the public onError event type).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ll-rendering

The Angular tool renderer and the React and Vue cores keep this layer's
core tool-call badge and shared renderer store; the adapter switches
that the lint fix touched are gone. The lint baseline only shrinks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…erative-ui

The Angular and Vue A2UI helpers keep this layer's shared engine
versions, and the Angular surface outlet keeps core's runA2UIAction,
now voided so the slot output stays void-returning. The Open Generative
UI tool handler returns Promise.resolve instead of an async function
with no await. The lint baseline moves two no-explicit-any entries with
the code this layer moved (the React provider's A2UI catalog and the
React A2UI operation applier) and drops 47 others.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…reads

Removes packages/vue/src/v2/lib/is-mobile-viewport.ts: this layer moved
its last importer to core, so knip reports it as an unused file. The lint
baseline only shrinks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sion

CopilotChat keeps this layer's core submitter and attachment queue. The
lint fix's void wrappers now wrap the submitter: onSubmitInput and
handleSelectSuggestion return void, and dropFiles and uploadFiles void
the attachment handlers. useAttachments voids its paste handler, and
core's thread switch voids the detach it queues (detach catches its own
failure). The lint baseline only shrinks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Core's audio recorder error mapping gets a `case undefined:` before its
default, the same switch-exhaustiveness fix the lint change applied to
other string | undefined switches. The lint baseline only shrinks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nderer

The markdown op-to-AST switch keeps this layer's math case and the lint
fix's explicit citation case in place of the default. The React Native
renderer lists the math node before its default in both switches, which
keeps its current output (source text inline, nothing at block level).
The lint baseline only shrinks.

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]>
….0-core-interrupts-hitl

The React and Vue cores keep this layer's core interrupt payload. Lint
fixes in this layer's code, all with no change in behavior:
- React and Vue cores return the interrupt subscriber result, so
  notifySubscribers awaits it instead of leaving it floating.
- Core's HITL respond returns Promise.resolve() instead of an async
  function with no await (registry.respond cannot throw).
- Core's interrupt controller and Vue's useInterrupt drop type
  assertions the compiler does not need; useInterrupt declares its
  return type, so its public type is unchanged.
- React's useInterrupt passes renderProps without the any cast.
- React's useHumanInTheLoop gives its exhaustive-deps disable a reason.
The lint baseline only shrinks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AlemTuzlak
AlemTuzlak added this pull request to stack #8199 November 4, 2026 12:04
@AlemTuzlak
AlemTuzlak removed this pull request from stack #8199 November 4, 2026 12:04
@AlemTuzlak
AlemTuzlak changed the base branch from alem/2.0-core-suggestions-inspector-learning to 2.0.0 November 4, 2026 12:04
AlemTuzlak and others added 4 commits November 4, 2026 13:08
`render` takes a function or a Vue component, so TypeScript cannot infer
the type of an arrow function's `props`, and the docs snippet check
failed with TS7006. Annotate it with `VueHumanInTheLoopRenderProps`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The chat fixtures set a licenseKey and no runtimeUrl, so CopilotKit asks
Copilot Cloud for /info. In CI the real request came back 401 and logged
runtime_info_fetch_failed, which failed "does not log when the agent does
not implement connect" on every Node and React combination. Stub fetch
with a pending promise for the whole spec. Tests that need a response
still mock fetch themselves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
React 18 has no `<Activity>`, so `Reflect.get(React, "Activity")` is
undefined and rendering it threw "Element type is invalid" on the
React 18 CI legs. The remount it covers only exists on React 19.2+, so
skip the test when `<Activity>` is missing.

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
…to-start into core (#8182)

React, Vue, and Angular now get suggestions, Inspector mounting, and the `learning` auto-start from `@copilotkit/core` and `@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 gets `configureSuggestions` and a `learning` option.

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**

- **Suggestions:** `ɵ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. `ɵsubscribeToAgentSuggestions` keeps a view's list and loading flag current. `useConfigureSuggestions` and `useSuggestions` in React and Vue now only call these.
- **Inspector visibility:** `shouldEnableInspector` (`@copilotkit/shared`) takes an optional `hostname` and allows only `localhost`, `127.0.0.1`, and `[::1]`.
- **Inspector mounting:** `ɵ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.
- **Learning:** `ɵ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 call `update()` and `dispose()`.

**Bugs fixed**

- Vue and Angular mounted the Inspector on any development host. They now use React's loopback rule.
- Vue and Angular showed the message "Inspect" action while the Inspector was hidden.
- Angular dropped an open request made before the Inspector loaded.
- Vue `<CopilotKitInspector>` now gives event listeners, such as `@cpk-inspector-visibility-change`, to the `cpk-web-inspector` element.
- React `useConfigureSuggestions` ignored the provider `agentId`. 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`:

- [Inspector in Vue and Angular](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-suggestions-inspector-learning/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#inspector-in-vue-and-angular): the Inspector mounts only on loopback hosts, even with `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.
- [Suggestions](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-suggestions-inspector-learning/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#suggestions): in React, a global config outside a chat loads for the provider `agentId`, not `"default"`. Agents skipped while running reload when the run ends. A `deps` change no longer reloads a second time on mount.

**Merge notes**

- The web-inspector architecture test on `2.0.0` rejected a top-level `src/mount.ts`. A `fix(web-inspector)` commit moved it to `src/shell/mount.ts`. It still builds to `dist/mount.*`, so the `./mount` export is unchanged.
- `ɵLearningProp` was removed in favor of D's identical `ɵCopilotKitLearningOptions`.
- A's Angular toolbar test now stubs a visible Inspector, because the shortcut only shows while the Inspector is visible.

## Related PRs and Issues

- PR 8 of the stack: #8177 (`alem/2.0-markdown-dom-renderer`, 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**

- Before the layer 8 merge: `nx run-many -t build,check-types,test,publint,attw` passed for core, react-core, vue, angular, shared, and web-inspector, except for the items below.
- react-core chart tests (`chart.test`, `chart-scatter.test`, `data.test`) and the Vue `build-entries` test failed under full-suite load. They pass when run alone, on this branch and on the base commit.
- `@copilotkit/vue:lint` fails with the same errors on the base commit, in files this PR does not touch.
- `pnpm check:public-api-manifest` passes. `pnpm --filter @copilotkit/v2-migration test` passes (36 of 36).
- On the merged head `89939875ea`: the Angular `inspector.spec.ts` passed 5 of 5 times with `--skip-nx-cache`. It also passed 5 of 5 on a clean `origin/2.0.0`. I did not run the full suites again after the layer 8 merge.

**Manual test**

1. Start the Vue or Angular demo and open it at `http://localhost:<port>`. The Inspector button shows.
2. Open the same app at your LAN address (for example `http://192.168.1.20:<port>`). Before this PR, the Inspector mounted. Now it does not.
3. On `localhost`, hide the Inspector. The "Inspect" action on assistant messages is hidden too.
4. In React, put `useConfigureSuggestions` with static suggestions outside a chat, under `<CopilotKitProvider agentId="support">`. The suggestions show for the `support` agent.

**How this PR makes testing easy**

- Core unit tests: `packages/core/src/core/__tests__/suggestions-binding.test.ts` and `learning-autostart.test.ts`.
- `packages/web-inspector/src/__tests__/mount.spec.ts` and the `shouldEnableInspector` hostname tests in `packages/shared`.
- Adapter tests for each behavior change: Vue `CopilotKitInspector.test.ts` and `CopilotKitProvider.test.ts`, and Angular `inspector.spec.ts`, `configure-suggestions.spec.ts`, and `learning.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**

```ts
const copilotKit = inject(CopilotKit);
const id = copilotKit.addSuggestionsConfig({ instructions: "Suggest next steps" });
copilotKit.reloadSuggestions("default");
inject(DestroyRef).onDestroy(() => copilotKit.removeSuggestionsConfig(id));
```

**After**

```ts
provideCopilotKit({ runtimeUrl: "/api/copilotkit", learning: true });

readonly suggestions = inject(CopilotKit).configureSuggestions(() => ({
  instructions: `Suggest next steps about ${this.topic()}`,
  available: "always",
}));
```

## 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 (this PR)** | 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 learning option for Angular that can automatically start and manage trajectory capture.
  * Added Angular support for configuring suggestions, including reactive updates and lifecycle cleanup.
  * Added a shared Inspector mounting experience across Angular, React, and Vue, with visibility-aware actions and queued open requests.
  * Inspector display is limited to development on loopback hosts; explicit enablement does not override this restriction.
* **Documentation**
  * Expanded the migration guide with Inspector and suggestions behavior across frameworks.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@AlemTuzlak
AlemTuzlak merged commit df8b9c6 into 2.0.0 Nov 4, 2026
92 checks passed
@AlemTuzlak
AlemTuzlak deleted the alem/2.0-core-interrupts-hitl branch November 4, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant