Repository navigation
feat: CopilotThreadsDrawer + active-thread configuration - #5746
Merged
Merged
Conversation
Contributor
📣 Social Copy GeneratorGenerate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.
|
Contributor
|
Size Change: +442 B (+0.04%) Total Size: 1.1 MB 📦 View Changed
ℹ️ View Unchanged
|
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/bot
@copilotkit/bot-discord
@copilotkit/bot-slack
@copilotkit/bot-teams
@copilotkit/bot-telegram
@copilotkit/bot-ui
@copilotkit/bot-whatsapp
@copilotkit/core
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
BenTaylorDev
marked this pull request as ready for review
June 29, 2026 13:21
BenTaylorDev
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
June 29, 2026 13:21
BenTaylorDev
force-pushed
the
feat/copilot-drawer-angular-pr1
branch
from
June 29, 2026 18:22
b482af8 to
821ea67
Compare
BenTaylorDev
marked this pull request as draft
June 29, 2026 22:10
This was referenced Jun 30, 2026
BenTaylorDev
force-pushed
the
feat/copilot-drawer-angular-pr1
branch
from
June 30, 2026 17:39
e97d171 to
5650f03
Compare
MikeRyanDev
added a commit
that referenced
this pull request
Jun 30, 2026
…uery (ENT-1020) (#5778) ## What & why Fixes **ENT-1020**. In a side-by-side layout (the threads drawer rail next to the chat), at iPad-portrait / tablet widths the chat **message text sat flush against both pane edges** — no horizontal padding — while the input stayed correctly inset. Surfaced while manually testing the Angular `CopilotDrawer` (#5746), but it is **not a drawer bug**: it reproduces in any layout that puts `CopilotChat` in a pane narrower than the viewport. ### Root cause The message column is `max-w-3xl` (768px) centered; its wrappers used `cpk:px-4 cpk:sm:px-0` — 16px below 640px, then **0 at viewport ≥640px**. There was no `container-type` on the chat root, so the `sm:` variant keyed on the **viewport**, not the chat's own width. In a sub-viewport pane (~580px chat on an 820px viewport) `sm:px-0` still fired (viewport ≥640) while the 768px column overflowed the pane edge-to-edge → flush text. ## The fix (robust / container-relative) - Add `cpk:@container` (`container-type: inline-size`) to the chat root (React ×2 render paths, Angular, Vue). - Switch every message / input / suggestion wrapper from viewport `cpk:sm:px-0` to the **container** variant `cpk:@3xl:px-0`. Padding now tracks the chat's **own** width and drops to 0 only once the container is at least as wide as the column's `max-w-3xl`, i.e. once the column has real side gutters. In any narrower pane the `px-4` inner padding is retained. **React, Angular, and Vue kept in lockstep.** ### Why `@3xl`, not the `@sm` the ticket suggested Tailwind v4 **container-query** breakpoints are a *different scale* from viewport breakpoints: `@sm` = **24rem/384px** (viewport `sm` = 640px). A mechanical `sm:` → `@sm:` swap would still collapse the ~580px repro pane (580 ≥ 384). `@3xl` = **48rem/768px**, which exactly matches the column's `max-w-3xl` — the width at which gutters first appear — so it is the semantically correct breakpoint. > Vue was not named in the ticket scope but shares the identical `sm:px-0` pattern; left unfixed it would reproduce the bug there, so it is included for true framework lockstep. web-components only *hosts* the chat (no `sm:px-0`), so it is correctly untouched. ## Testing **Browser behavior — real built CSS, exact DOM (`copilotKitChat`/`@container` root → `cpk:max-w-3xl cpk:mx-auto` → `cpk:px-4 cpk:@3xl:px-0` message wrapper), `getComputedStyle().paddingLeft`:** | Scenario | Result | Expectation | |---|---|---| | **580px narrow pane** (the repro) | `padding-left: 16px` | ✅ `px-4` retained — text no longer flush | | **900px wide pane** (full desktop) | `padding-left: 0px` | ✅ `px-0` — column has gutters, behavior preserved | | **No `@container` ancestor** (render-prop path) | `padding-left: 16px` | ✅ graceful `px-4`, no flush | **Generated CSS confirmed** (Tailwind v4.1.18): root emits `container-type: inline-size`; wrapper emits `@container (min-width: 48rem) { padding-inline: 0 }` (verified in both react-core and angular builds — a true container query, not a media query). **Unit/component tests (pass):** - react-core — full chat suite: **645 tests / 39 files** green (incl. `CopilotChatCssClasses`). - angular — `copilot-chat-view` + `copilot-chat-input` specs: **10** green. - vue — `CopilotChatView.connectingGate` + `CopilotChatSuggestionView.slots.e2e`: **30** green. - pre-commit `test-and-check-packages` (test + publint + attw across all 4 affected projects) passed. No tests assert these class strings and no snapshots capture them, so nothing needed regenerating. ## Acceptance criteria - [x] Messages retain horizontal padding when the chat is in a narrow (<~768px) pane at viewports ≥640px. - [x] Full-width chat behavior preserved (container ≥768px → `px-0`), verified in React, Angular, Vue. - [x] No regression to input / disclaimer / suggestion alignment with the message column (all share the same `@3xl` switch). Closes ENT-1020 🤖 Generated with [Claude Code](https://claude.com/claude-code)
BenTaylorDev
marked this pull request as ready for review
June 30, 2026 22:32
…olution Injectable service mirroring React's CopilotChatConfigurationProvider. Owns agentId/threadId resolution (controlled prop > override > options > minted fallback) and the hasExplicitThreadId welcome-screen flag, exposes setActiveThreadId/startNewThread setters that no-op when the config is host-controlled, and reserves drawerOpen/registerDrawer hooks for a future popup/sidebar layer. provideCopilotChatConfiguration aliases the token to a single instance via useExisting.
connectActiveThread reactively pins the resolved thread onto agent.threadId. On an explicit switch it connects the agent, owning the loading-cursor + abort + detach lifecycle of the standalone connectToAgent path (per-run AbortController on HttpAgents, a single caught connect chain so a rejecting connect never leaks an unhandled rejection, and a staleness-guarded cursor settle). On a fresh / non-explicit switch it clears messages only on a genuine new-thread transition, never on mount or a same-thread agent swap. Injection-context-only; not exported on the public surface.
CopilotChat reads the ambient config when a provideCopilotChatConfiguration provider is in scope: input-first precedence ([agentId]/[threadId] win over the config, matching React), seeding the config from a set [threadId], and driving the connector with loading-cursor hooks. Standalone <copilot-chat [threadId]> usage is unchanged when no provider is present. Exports CopilotChatConfiguration from the package entry point.
Adds the workspace dep (consumed by the <CopilotDrawer> wrapper) and allows it as a non-peer dependency in ng-package.json so ng-packagr packages cleanly.
Adds a listError signal that returns only genuine list/mutation errors, excluding developer/config errors (missing runtime URL, runtime without thread endpoints) so consumer error UIs do not surface dev strings to end users. Mirrors react-core's useThreads listError; `error` is unchanged (additive).
…element Standalone OnPush Angular component wrapping the framework-agnostic copilotkit-drawer Lit element. Binds live thread state from injectThreads onto the element (imperative viewChild+effect, per the a2ui-activity-renderer precedent) and routes the element's DOM events to the ambient CopilotChatConfiguration + thread mutations. Ships a CopilotDrawerRow directive for per-row slot projection, host onThreadSelect/onNewThread escape-hatch callbacks, and <ng-content> slot passthrough (launcher-icon/memories). Uses the filtered listError for the error panel. Always-licensed (no licensed/upsell wiring); inline-chat-only (no Layer-2 open-state coordination). Exported from public-api.
…label property, defaults to Threads)
…(:host height + .list min-height:0)
Mirrors the Angular wrapper + the copilotkit-drawer element's label property: sets the drawer region aria-label and default header text, defaulting to the element's built-in "Threads" when omitted.
Wires up the previously-dormant pagination plumbing (ENT-1016):
- Element: render a 'Load more' button at the list bottom when hasMore
(and not fetching / not errored), emitting a new load-more event
(LoadMoreDetail). Distinct from retry{scope:'fetch-more'} (error
recovery); both advance pagination.
- React CopilotDrawer: add a limit prop (forwarded to useThreads) and
route load-more to fetchMoreThreads.
- Angular CopilotDrawer: add a limit input (forwarded to injectThreads)
and route load-more to fetchMoreThreads.
Tests: element load-more render + emit + precedence; React limit
forwarding + load-more routing; Angular load-more routing.
Per review, drop the 'upsell' monetization jargon. Renames the event (upsell -> unlicensed), the React prop (onUpsell -> onUnlicensed), the slot/part/class (upsell -> unlicensed, upsell-cta -> unlicensed-cta), the UnlicensedDetail type, the data-testid, and all comments/test names. Behavior unchanged. Angular is unaffected (always-licensed, no gate).
…face Per review, settle the locked-view affordance on a neutral 'license' name. Renames the event (unlicensed -> licensed), React prop (onUnlicensed -> onLicensed), slot/part/class (licensed, licensed-cta), LicensedDetail type, data-testid, render method, and identifier-referencing comments/test names. The existing 'licensed' boolean gate is unchanged; prose describing the not-licensed state still reads 'unlicensed'/'locked view'. Behavior unchanged; Angular unaffected.
…-drawer Final naming decision. Renames the public component + element across the board: React/Angular CopilotDrawer -> CopilotThreadsDrawer, the Lit element copilotkit-drawer -> copilotkit-threads-drawer (tag, CopilotKitThreadsDrawer class, COPILOTKIT_THREADS_DRAWER_TAG, defineCopilotKitThreadsDrawer), the @copilotkit/web-components/drawer subpath -> /threads-drawer (+ src dir), the CopilotThreadsDrawerRow directive / copilotThreadsDrawerRow input, and all prose/test references. Generic types (DrawerThread, DrawerFilter), --cpk-drawer-* tokens, and ::part names are unchanged. Behavior unchanged.
Add a `licenseUrl` property to the shared element (default https://docs.copilotkit.ai/intelligence). The locked view's Upgrade CTA now dispatches a cancelable `licensed` event carrying the url and, unless the host calls preventDefault(), opens it in a new tab; a blank url suppresses navigation. React and Angular wrappers expose an optional `licenseUrl` prop. License-gate the Angular drawer like React: surface `licenseStatus` as a signal on the CopilotKit service and gate the wrapper on status valid|expiring && checkFeature("threads"), skipping the thread fetch while unlicensed and showing the loading state (not the locked view) until the status resolves. Reverses the earlier always-licensed Angular call. Closes ENT-1027.
BenTaylorDev
force-pushed
the
feat/copilot-drawer-angular-pr1
branch
from
June 30, 2026 22:35
4519fce to
74b8a19
Compare
MikeRyanDev
approved these changes
Jun 30, 2026
BenTaylorDev
added a commit
that referenced
this pull request
Jul 8, 2026
…(closes ENT-1021) (#5780) Documents the new **CopilotDrawer** prebuilt threads drawer (component PR #5746). ## Changes - **Guide** — `docs/prebuilt-components/copilot-drawer.mdx` (new) + registered in `prebuilt-components/meta.json`. React drop-in (`<CopilotDrawer />` beside `<CopilotChat />`, zero active-thread wiring), props table, customization (slots / `::part`s / `--cpk-drawer-*` tokens), Angular usage, license. - **Threads how-to** — `snippets/shared/threads/threads.mdx` (shared → propagates to ~10 integration threads pages + `/threads`): a callout recommending `CopilotDrawer` as the prebuilt path and framing the `useThreads` steps as the **headless** alternative (kept, not removed) + Next-steps cross-links. - **Reference** — `reference/components/CopilotDrawer.mdx` (React) and `reference/angular/components/CopilotDrawer.mdx` (Angular), hand-authored with `<PropertyReference>`. ## Validation `npm run build` in `showcase/shell-docs` is green locally — compiled successfully, 215/215 static pages generated, no MDX errors. All internal links verified to resolve on `main`. ## Why draft / release-gated Merges **with or after** the drawer release (`@copilotkit/web-components` published + `react-core`/`@copilotkit/angular` > 1.61.2 containing `CopilotDrawer`). Until then the documented imports don't exist in a published package. ## Follow-ups (out of scope) - Live `<InlineDemo>` of the drawer (needs a demo-registry entry) — uses plain code blocks for now. - Angular `injectThreads` / `CopilotChatConfiguration` reference pages (named without links here; they don't exist on `main` yet). Spec: https://app.notion.com/p/38f3aa381852814e8884e3153d3d4688 · Tracking: ENT-1021 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Angular
<CopilotDrawer>feature for the CopilotKit SDK — a ready, usable threads drawer for Angular apps, plus the active-thread foundation it sits on. (This PR merges the originally-staged PR1+PR2 so it ships a working feature, not just plumbing.)Foundation — active-thread coordination (no new store):
CopilotChatConfiguration— an injectable, signal-based service mirroring React'sCopilotChatConfigurationProvider: ownsagentId/threadIdresolution (controlled prop → override → minted fallback) + thehasExplicitThreadIdwelcome flag;setActiveThreadId/startNewThreadsetters that no-op when host-controlled; single-instance viauseExisting.connectActiveThread(internal connector) — reactively pins the resolved thread ontoagent.threadIdand owns the connect lifecycle (per-runAbortControlleronHttpAgents, a single caught connect chain, a staleness-guarded loading cursor, abort+detachActiveRun()teardown), mirroring the standaloneconnectToAgentpath. Clears messages only on a genuine new-thread transition (never on mount/agent-swap).CopilotChatconsumes the ambient config when present (input-first precedence:[agentId]/[threadId]win), seeds the config from a set[threadId]; standalone[threadId]usage unchanged when no provider is present.The drawer —
<copilot-drawer>:4. A standalone
OnPushwrapper around the framework-agnosticcopilotkit-drawerLit element (@copilotkit/web-components). Events bind declaratively; element properties are set imperatively viaviewChild+effect(thea2ui-activity-rendererprecedent). Routes the element's events (thread-selected/new-thread/archive/unarchive/delete/filter-change/retry) to the config +injectThreadsmutations (delete-of-active resets to a fresh thread).5.
CopilotDrawerRowdirective for per-row custom content (slot="row:{id}"),onThreadSelect/onNewThreadhost escape-hatch callbacks, and<ng-content>slot passthrough (launcher-icon/memories).6.
listErroradded toinjectThreads— a filtered error (genuine list/mutation errors only, excluding developer/config errors like "Runtime URL is not configured") so the drawer's error panel never shows dev strings to end users. Mirrors react-core'suseThreads.Always-licensed: Angular SDK licensing is no longer a thing, so the wrapper does not wire the element's
licensed/upsell— no upsell path. Inline-chat-only: no Layer-2 open-state coordination (the element self-provides its mobile launcher).Why
Angular had no active-thread provider (only
injectThreads) and no drawer component. This lands both so Angular apps get thread switching + a usable threads drawer at parity with the React vertical, reinterpreted for Angular's inline-chat-only surface.Testing
@copilotkit/angular: tsc clean,oxlint0 errors,ng-packagrbuild green, 152 tests pass (full package suite). New coverage: config precedence/controlled-vs-uncontrolled + single-instance identity; connector connect-on-switch / clear-only-on-real-transition / cursor staleness / no-unhandled-rejection / abort+detach teardown (verified against a realHttpAgent); drawer prop binding, all 7 event routings (incl. delete-active reset), escape-hatch overrides,renderRowprojection,<ng-content>slot passthrough, and thelistErrordev-error-exclusion.Hardened through a full
cr-loop(foundation: 5 rounds; wrapper: 2 rounds) — the wrapper CR caught + fixed a real bug (the error panel was leaking dev/config errors; fixed via the filteredlistError).Dependency / release gate
Depends on
@copilotkit/web-components(thecopilotkit-drawerelement) being published — the same release gate as the React drawer work (#5707).packages/angularpublishes alongside.Follow-ups (out of scope, tracked)
routes/threadsinexamples/v2/angular/demo(kept separate to keep this a clean SDK-only change).zodis indevDependenciesbut imported by production source — should move todependencies/peerDependencies.packages/angular/src/lib/threads.spec.tsusesdescribe/itvs the flat-testconvention of sibling specs (pre-existing).🤖 Generated with Claude Code