Skip to content

docs: move the v1 CopilotKit headers notes into the JSDoc and drop a dead snippet - #7515

Merged
BenTaylorDev merged 1 commit into
ben1/1937-headers-at-send-timefrom
ben1/1937-docs-cleanup
Oct 7, 2026
Merged

BenTaylorDev merged 1 commit into
ben1/1937-headers-at-send-timefrom
ben1/1937-docs-cleanup

Conversation

@BenTaylorDev

Copy link
Copy Markdown
Contributor

What does this PR do?

This is a docs cleanup that follows #7510. It is stacked on #7510's branch, so the diff shows only this change. Once #7510 merges, I'll retarget it to main.

  1. Move hand-written notes into the source they're generated from. reference/v1/components/CopilotKit.mdx is generated by scripts/docs/gen.ts from the CopilotKitProps JSDoc. feat: evaluate request headers when each request is sent (sync and async builders) #7510 edited the page by hand, so the next regeneration would have dropped its notes: caching in the builder, header_resolution_failed, the user-switch rule, and the cross-origin agents warning. This PR moves those notes into the headers JSDoc and regenerates the page from it.
  2. Delete a dead snippet. snippets/shared/reference/copilotkit-component.mdx is auto-generated, and nothing uses it: no SNIPPET_MAP entry, import or route. It isn't a generator destination either, and it still documented headers as Record<string, string>.

One visible difference on the regenerated page: the headers type reads CopilotKitHeadersSource, which is what the generator emits, instead of the hand-expanded union. The text below it still lists the three forms (record, sync builder, async builder).

Related PRs and Issues

Testing

  • Generator reproduces the page. I regenerated the page with the repo's ReferenceDoc for this one entry. The committed page is exactly the generator's output. Only the headers section changed; the rest of the page is identical.
  • The snippet is unused. git grep copilotkit-component returns no hits outside the deleted file. scripts/docs/lib/files.ts doesn't list it.
  • CI's generator test passes. pnpm exec vitest run scripts/__tests__/docs-reference-generator.test.ts, the same command CI runs in static_quality.yml: 31/31 pass.
  • The page parses. It compiles with the repo's @mdx-js/mdx.
  • Lint and format are clean. oxfmt and oxlint on the edited .tsx: clean. The change is a comment only.

Checklist

  • I have read the Contribution Guide
  • If the PR changes or adds functionality, I have updated the relevant documentation
  • "Allow edits by maintainers" is checked (not applicable: this branch is in this repo)

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: CopilotKit/CopilotKit/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d9b0ff67-25e9-4ed7-86b2-6c005e6512b3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Production Digest-Pinning Audit

All 43 services digest-pinned.

Run 2026-10-07 06:52:44 PDT — 0 finding(s).

@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
@copilotkit/a2ui-renderer

pnpm add https://pkg.pr.new/@copilotkit/a2ui-renderer@7515

@copilotkit/agentcore-runner

pnpm add https://pkg.pr.new/@copilotkit/agentcore-runner@7515

@copilotkit/angular

pnpm add https://pkg.pr.new/@copilotkit/angular@7515

@copilotkit/channels

pnpm add https://pkg.pr.new/@copilotkit/channels@7515

@copilotkit/channels-core

pnpm add https://pkg.pr.new/@copilotkit/channels-core@7515

@copilotkit/channels-discord

pnpm add https://pkg.pr.new/@copilotkit/channels-discord@7515

@copilotkit/channels-intelligence

pnpm add https://pkg.pr.new/@copilotkit/channels-intelligence@7515

@copilotkit/channels-slack

pnpm add https://pkg.pr.new/@copilotkit/channels-slack@7515

@copilotkit/channels-teams

pnpm add https://pkg.pr.new/@copilotkit/channels-teams@7515

@copilotkit/channels-telegram

pnpm add https://pkg.pr.new/@copilotkit/channels-telegram@7515

@copilotkit/channels-ui

pnpm add https://pkg.pr.new/@copilotkit/channels-ui@7515

@copilotkit/channels-whatsapp

pnpm add https://pkg.pr.new/@copilotkit/channels-whatsapp@7515

@copilotkit/core

pnpm add https://pkg.pr.new/@copilotkit/core@7515

@copilotkit/intelligence-langgraph

pnpm add https://pkg.pr.new/@copilotkit/intelligence-langgraph@7515

@copilotkit/intelligence-mastra

pnpm add https://pkg.pr.new/@copilotkit/intelligence-mastra@7515

@copilotkit/mcp-apps-renderer

pnpm add https://pkg.pr.new/@copilotkit/mcp-apps-renderer@7515

@copilotkit/react-core

pnpm add https://pkg.pr.new/@copilotkit/react-core@7515

@copilotkit/react-native

pnpm add https://pkg.pr.new/@copilotkit/react-native@7515

@copilotkit/react-textarea

pnpm add https://pkg.pr.new/@copilotkit/react-textarea@7515

@copilotkit/react-ui

pnpm add https://pkg.pr.new/@copilotkit/react-ui@7515

@copilotkit/runtime

pnpm add https://pkg.pr.new/@copilotkit/runtime@7515

@copilotkit/runtime-client-gql

pnpm add https://pkg.pr.new/@copilotkit/runtime-client-gql@7515

@copilotkit/sdk-js

pnpm add https://pkg.pr.new/@copilotkit/sdk-js@7515

@copilotkit/shared

pnpm add https://pkg.pr.new/@copilotkit/shared@7515

@copilotkit/sqlite-runner

pnpm add https://pkg.pr.new/@copilotkit/sqlite-runner@7515

@copilotkit/voice

pnpm add https://pkg.pr.new/@copilotkit/voice@7515

@copilotkit/vue

pnpm add https://pkg.pr.new/@copilotkit/vue@7515

@copilotkit/web-components

pnpm add https://pkg.pr.new/@copilotkit/web-components@7515

@copilotkit/web-inspector

pnpm add https://pkg.pr.new/@copilotkit/web-inspector@7515

commit: 5732e4b

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Size Change: 0 B

Total Size: 1.74 MB

ℹ️ View Unchanged
Filename Size
packages/a2ui-renderer/dist/_virtual/_rolldown/runtime.cjs 516 B
packages/a2ui-renderer/dist/a2ui-types.cjs 472 B
packages/a2ui-renderer/dist/a2ui-types.mjs 469 B
packages/a2ui-renderer/dist/index.cjs 959 B
packages/a2ui-renderer/dist/index.mjs 637 B
packages/a2ui-renderer/dist/index.umd.js 12.9 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/A2uiSurface.cjs 1.52 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/A2uiSurface.mjs 1.46 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/adapter.cjs 1.07 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/adapter.mjs 1.01 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.cjs 904 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.mjs 492 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Button.cjs 1 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Button.mjs 596 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Card.cjs 829 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Card.mjs 419 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.cjs 1.1 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.mjs 1.02 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/ChildList.cjs 799 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/ChildList.mjs 737 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.cjs 1.63 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.mjs 1.57 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Column.cjs 856 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Column.mjs 802 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.cjs 1.12 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.mjs 1.05 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.cjs 842 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.mjs 432 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.cjs 877 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.mjs 469 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Image.cjs 995 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Image.mjs 587 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/List.cjs 920 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/List.mjs 508 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.cjs 1.19 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.mjs 1.13 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Row.cjs 855 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Row.mjs 801 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.cjs 1.06 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.mjs 984 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.cjs 1.1 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.mjs 1.04 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Text.cjs 903 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Text.mjs 489 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.cjs 1.21 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.mjs 1.14 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Video.cjs 788 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Video.mjs 378 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/index.cjs 928 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/index.mjs 855 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/utils.cjs 579 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/utils.mjs 556 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.cjs 982 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.mjs 580 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/ChildList.cjs 800 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/ChildList.mjs 735 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.cjs 1.08 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.mjs 1.02 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.cjs 1.07 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.mjs 1.01 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.cjs 894 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.mjs 839 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.cjs 1.21 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.mjs 802 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/index.cjs 849 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/index.mjs 804 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/index.cjs 310 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/index.mjs 325 B
packages/a2ui-renderer/dist/react-renderer/catalog-utils.cjs 1.59 kB
packages/a2ui-renderer/dist/react-renderer/catalog-utils.mjs 1.52 kB
packages/a2ui-renderer/dist/react-renderer/core/A2UIProvider.cjs 1.5 kB
packages/a2ui-renderer/dist/react-renderer/core/A2UIProvider.mjs 1.42 kB
packages/a2ui-renderer/dist/react-renderer/core/A2UIRenderer.cjs 728 B
packages/a2ui-renderer/dist/react-renderer/core/A2UIRenderer.mjs 671 B
packages/a2ui-renderer/dist/react-renderer/create-catalog.cjs 1.35 kB
packages/a2ui-renderer/dist/react-renderer/create-catalog.mjs 1.28 kB
packages/a2ui-renderer/dist/react-renderer/filter-catalog.cjs 622 B
packages/a2ui-renderer/dist/react-renderer/filter-catalog.mjs 569 B
packages/a2ui-renderer/dist/react-renderer/hooks/useA2UI.cjs 316 B
packages/a2ui-renderer/dist/react-renderer/hooks/useA2UI.mjs 309 B
packages/a2ui-renderer/dist/react-renderer/index.cjs 409 B
packages/a2ui-renderer/dist/react-renderer/index.mjs 568 B
packages/a2ui-renderer/dist/react-renderer/lib/utils.cjs 236 B
packages/a2ui-renderer/dist/react-renderer/lib/utils.mjs 188 B
packages/a2ui-renderer/dist/react-renderer/styles/index.cjs 239 B
packages/a2ui-renderer/dist/react-renderer/styles/index.mjs 231 B
packages/a2ui-renderer/dist/react-renderer/theme/ThemeContext.cjs 436 B
packages/a2ui-renderer/dist/react-renderer/theme/ThemeContext.mjs 381 B
packages/core/dist/index.cjs 75.5 kB
packages/core/dist/index.mjs 75 kB
packages/core/dist/index.umd.js 80.2 kB
packages/mcp-apps-renderer/dist/activity.cjs 259 B
packages/mcp-apps-renderer/dist/activity.mjs 170 B
packages/mcp-apps-renderer/dist/activity.umd.js 1.84 kB
packages/mcp-apps-renderer/dist/constants.cjs 714 B
packages/mcp-apps-renderer/dist/constants.mjs 712 B
packages/mcp-apps-renderer/dist/content-schema.cjs 392 B
packages/mcp-apps-renderer/dist/content-schema.mjs 386 B
packages/mcp-apps-renderer/dist/follow-up.cjs 796 B
packages/mcp-apps-renderer/dist/follow-up.mjs 794 B
packages/mcp-apps-renderer/dist/index.mjs 268 B
packages/mcp-apps-renderer/dist/request-queue.mjs 1.05 kB
packages/mcp-apps-renderer/dist/sandbox.mjs 1.14 kB
packages/mcp-apps-renderer/dist/session.mjs 3.05 kB
packages/react-core/dist/copilotkit-D_m_-uH_.mjs 122 kB
packages/react-core/dist/copilotkit-DgPaiDo3.cjs 120 kB
packages/react-core/dist/index.cjs 17.6 kB
packages/react-core/dist/index.mjs 17.5 kB
packages/react-core/dist/index.umd.js 68.3 kB
packages/react-core/dist/v2/context.cjs 1.58 kB
packages/react-core/dist/v2/context.mjs 1.5 kB
packages/react-core/dist/v2/headless.cjs 16.2 kB
packages/react-core/dist/v2/headless.mjs 15.6 kB
packages/react-core/dist/v2/index.cjs 4.07 kB
packages/react-core/dist/v2/index.mjs 4.08 kB
packages/react-core/dist/v2/index.umd.js 123 kB
packages/react-native/dist/chunk-C0xms8kb.cjs 546 B
packages/react-native/dist/components/index.cjs 8.65 kB
packages/react-native/dist/components/index.mjs 8.45 kB
packages/react-native/dist/CopilotKitProvider-CjoPnabW.cjs 1.55 kB
packages/react-native/dist/CopilotKitProvider-D8sn7G_C.mjs 1.43 kB
packages/react-native/dist/headless.cjs 632 B
packages/react-native/dist/headless.mjs 373 B
packages/react-native/dist/index.cjs 6.52 kB
packages/react-native/dist/index.mjs 6.14 kB
packages/react-native/dist/polyfills.cjs 195 B
packages/react-native/dist/polyfills.mjs 195 B
packages/react-native/dist/polyfills/crypto.cjs 373 B
packages/react-native/dist/polyfills/crypto.mjs 381 B
packages/react-native/dist/polyfills/dom.cjs 540 B
packages/react-native/dist/polyfills/dom.mjs 550 B
packages/react-native/dist/polyfills/encoding.cjs 332 B
packages/react-native/dist/polyfills/encoding.mjs 307 B
packages/react-native/dist/polyfills/location.cjs 236 B
packages/react-native/dist/polyfills/location.mjs 244 B
packages/react-native/dist/polyfills/streams.cjs 371 B
packages/react-native/dist/polyfills/streams.mjs 339 B
packages/react-native/dist/streaming-fetch-BnQh3vBz.mjs 2.22 kB
packages/react-native/dist/streaming-fetch-BTESzLKX.cjs 2.27 kB
packages/react-textarea/dist/index.cjs 17.6 kB
packages/react-textarea/dist/index.mjs 16.9 kB
packages/react-textarea/dist/index.umd.js 18.4 kB
packages/react-ui/dist/index.cjs 25.2 kB
packages/react-ui/dist/index.mjs 24.5 kB
packages/react-ui/dist/index.umd.js 26.4 kB
packages/runtime-client-gql/dist/_virtual/_rolldown/runtime.cjs 516 B
packages/runtime-client-gql/dist/client/conversion.cjs 1.52 kB
packages/runtime-client-gql/dist/client/conversion.mjs 1.45 kB
packages/runtime-client-gql/dist/client/CopilotRuntimeClient.cjs 1.58 kB
packages/runtime-client-gql/dist/client/CopilotRuntimeClient.mjs 1.54 kB
packages/runtime-client-gql/dist/client/types.cjs 701 B
packages/runtime-client-gql/dist/client/types.mjs 642 B
packages/runtime-client-gql/dist/graphql/@generated/gql.cjs 850 B
packages/runtime-client-gql/dist/graphql/@generated/gql.mjs 850 B
packages/runtime-client-gql/dist/graphql/@generated/graphql.cjs 2.4 kB
packages/runtime-client-gql/dist/graphql/@generated/graphql.mjs 2.36 kB
packages/runtime-client-gql/dist/graphql/definitions/mutations.cjs 740 B
packages/runtime-client-gql/dist/graphql/definitions/mutations.mjs 732 B
packages/runtime-client-gql/dist/graphql/definitions/queries.cjs 316 B
packages/runtime-client-gql/dist/graphql/definitions/queries.mjs 304 B
packages/runtime-client-gql/dist/index.cjs 679 B
packages/runtime-client-gql/dist/index.mjs 495 B
packages/runtime-client-gql/dist/index.umd.js 9.58 kB
packages/runtime-client-gql/dist/message-conversion/agui-to-gql.cjs 1.72 kB
packages/runtime-client-gql/dist/message-conversion/agui-to-gql.mjs 1.7 kB
packages/runtime-client-gql/dist/message-conversion/gql-to-agui.cjs 1.56 kB
packages/runtime-client-gql/dist/message-conversion/gql-to-agui.mjs 1.53 kB
packages/runtime-client-gql/dist/package.cjs 181 B
packages/runtime-client-gql/dist/package.mjs 116 B
packages/shared/dist/_virtual/_rolldown/runtime.cjs 516 B
packages/shared/dist/a2ui-prompts.cjs 2.85 kB
packages/shared/dist/a2ui-prompts.mjs 2.85 kB
packages/shared/dist/attachments/content.cjs 255 B
packages/shared/dist/attachments/content.mjs 253 B
packages/shared/dist/attachments/utils.cjs 1.83 kB
packages/shared/dist/attachments/utils.mjs 1.79 kB
packages/shared/dist/constants/index.cjs 362 B
packages/shared/dist/constants/index.mjs 345 B
packages/shared/dist/debug.cjs 454 B
packages/shared/dist/debug.mjs 452 B
packages/shared/dist/event-transforms/index.cjs 335 B
packages/shared/dist/event-transforms/index.mjs 165 B
packages/shared/dist/event-transforms/open-generative-ui-middleware.cjs 2.42 kB
packages/shared/dist/event-transforms/open-generative-ui-middleware.mjs 2.35 kB
packages/shared/dist/event-transforms/recorded-events.cjs 988 B
packages/shared/dist/event-transforms/recorded-events.mjs 925 B
packages/shared/dist/finalize-events.cjs 1.94 kB
packages/shared/dist/finalize-events.mjs 1.88 kB
packages/shared/dist/index.cjs 2.89 kB
packages/shared/dist/index.mjs 2.47 kB
packages/shared/dist/index.umd.js 30.7 kB
packages/shared/dist/intelligence-routing-fields.cjs 778 B
packages/shared/dist/intelligence-routing-fields.mjs 775 B
packages/shared/dist/logger.cjs 112 B
packages/shared/dist/logger.mjs 112 B
packages/shared/dist/package.cjs 181 B
packages/shared/dist/package.mjs 116 B
packages/shared/dist/standard-schema.cjs 740 B
packages/shared/dist/standard-schema.mjs 737 B
packages/shared/dist/telemetry/index.cjs 358 B
packages/shared/dist/telemetry/index.mjs 250 B
packages/shared/dist/telemetry/lambda-client.cjs 1.59 kB
packages/shared/dist/telemetry/lambda-client.mjs 1.58 kB
packages/shared/dist/telemetry/model-host.cjs 1.63 kB
packages/shared/dist/telemetry/model-host.mjs 1.62 kB
packages/shared/dist/telemetry/sampling.cjs 956 B
packages/shared/dist/telemetry/sampling.mjs 935 B
packages/shared/dist/telemetry/telemetry-client.cjs 1.88 kB
packages/shared/dist/telemetry/telemetry-client.mjs 1.83 kB
packages/shared/dist/telemetry/telemetry-disabled.cjs 454 B
packages/shared/dist/telemetry/telemetry-disabled.mjs 451 B
packages/shared/dist/telemetry/utils.cjs 321 B
packages/shared/dist/telemetry/utils.mjs 277 B
packages/shared/dist/transcription-errors.cjs 951 B
packages/shared/dist/transcription-errors.mjs 944 B
packages/shared/dist/utils/clipboard.cjs 407 B
packages/shared/dist/utils/clipboard.mjs 405 B
packages/shared/dist/utils/conditions.cjs 540 B
packages/shared/dist/utils/conditions.mjs 536 B
packages/shared/dist/utils/console-styling.cjs 1.23 kB
packages/shared/dist/utils/console-styling.mjs 1.21 kB
packages/shared/dist/utils/errors.cjs 4.51 kB
packages/shared/dist/utils/errors.mjs 4.41 kB
packages/shared/dist/utils/index.cjs 1.45 kB
packages/shared/dist/utils/index.mjs 1.77 kB
packages/shared/dist/utils/inspector-learning.cjs 2.38 kB
packages/shared/dist/utils/inspector-learning.mjs 2.38 kB
packages/shared/dist/utils/inspector-metadata.cjs 1.46 kB
packages/shared/dist/utils/inspector-metadata.mjs 1.45 kB
packages/shared/dist/utils/inspector-visibility.cjs 285 B
packages/shared/dist/utils/inspector-visibility.mjs 282 B
packages/shared/dist/utils/json-schema.cjs 1.97 kB
packages/shared/dist/utils/json-schema.mjs 1.91 kB
packages/shared/dist/utils/random-id.cjs 618 B
packages/shared/dist/utils/random-id.mjs 559 B
packages/shared/dist/utils/requests.cjs 706 B
packages/shared/dist/utils/requests.mjs 704 B
packages/shared/dist/utils/row-render-keys.cjs 3.38 kB
packages/shared/dist/utils/row-render-keys.mjs 3.36 kB
packages/shared/dist/utils/types.cjs 161 B
packages/shared/dist/utils/types.mjs 160 B
packages/voice/dist/_virtual/_rolldown/runtime.cjs 516 B
packages/voice/dist/index.cjs 175 B
packages/voice/dist/index.mjs 95 B
packages/voice/dist/index.umd.js 1.5 kB
packages/voice/dist/transcription/transcription-service-openai.cjs 495 B
packages/voice/dist/transcription/transcription-service-openai.mjs 434 B
packages/web-inspector/dist/assets/inspector-logo-kite.cjs 2.36 kB
packages/web-inspector/dist/assets/inspector-logo-kite.mjs 2.3 kB
packages/web-inspector/dist/assets/inspector-logo.cjs 4.32 kB
packages/web-inspector/dist/assets/inspector-logo.mjs 4.23 kB
packages/web-inspector/dist/components/learning-view.cjs 9.47 kB
packages/web-inspector/dist/components/learning-view.mjs 9.47 kB
packages/web-inspector/dist/index.cjs 130 kB
packages/web-inspector/dist/index.mjs 130 kB
packages/web-inspector/dist/index.umd.js 194 kB
packages/web-inspector/dist/lib/context-helpers.cjs 866 B
packages/web-inspector/dist/lib/context-helpers.mjs 835 B
packages/web-inspector/dist/lib/home-briefing.cjs 2.8 kB
packages/web-inspector/dist/lib/home-briefing.mjs 2.79 kB
packages/web-inspector/dist/lib/inspector-learning.cjs 754 B
packages/web-inspector/dist/lib/inspector-learning.mjs 732 B
packages/web-inspector/dist/lib/inspector-metadata.cjs 760 B
packages/web-inspector/dist/lib/inspector-metadata.mjs 750 B
packages/web-inspector/dist/lib/inspector-nav.cjs 668 B
packages/web-inspector/dist/lib/inspector-nav.mjs 649 B
packages/web-inspector/dist/lib/learning-setup.cjs 1.12 kB
packages/web-inspector/dist/lib/learning-setup.mjs 1.09 kB
packages/web-inspector/dist/lib/notification-loader.cjs 792 B
packages/web-inspector/dist/lib/notification-loader.mjs 786 B
packages/web-inspector/dist/lib/notifications.cjs 2.39 kB
packages/web-inspector/dist/lib/notifications.mjs 2.37 kB
packages/web-inspector/dist/lib/onboarding-prompt.cjs 2.38 kB
packages/web-inspector/dist/lib/onboarding-prompt.mjs 2.37 kB
packages/web-inspector/dist/lib/persistence.cjs 3.45 kB
packages/web-inspector/dist/lib/persistence.mjs 3.36 kB
packages/web-inspector/dist/lib/pop-out.cjs 1.07 kB
packages/web-inspector/dist/lib/pop-out.mjs 1.05 kB
packages/web-inspector/dist/lib/telemetry.cjs 5.59 kB
packages/web-inspector/dist/lib/telemetry.mjs 5.38 kB
packages/web-inspector/dist/lib/thread-selection.cjs 566 B
packages/web-inspector/dist/lib/thread-selection.mjs 563 B
packages/web-inspector/dist/package.cjs 181 B
packages/web-inspector/dist/package.mjs 116 B
packages/web-inspector/dist/styles/generated.cjs 20.1 kB
packages/web-inspector/dist/styles/generated.mjs 20 kB
packages/web-inspector/dist/styles/notification-article.cjs 1.44 kB
packages/web-inspector/dist/styles/notification-article.mjs 1.44 kB

compressed-size-action

…dead snippet

reference/v1/components/CopilotKit.mdx is generated by scripts/docs/gen.ts
from the CopilotKitProps JSDoc. #7510 hand-edited the page, so a regen
would have dropped the caching, header_resolution_failed, user-switch and
cross-origin notes. Move them into the JSDoc and regenerate the page.

Delete snippets/shared/reference/copilotkit-component.mdx: an
auto-generated snippet that no SNIPPET_MAP entry, import or route uses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@BenTaylorDev
BenTaylorDev force-pushed the ben1/1937-docs-cleanup branch from 4d724a7 to 5732e4b Compare October 7, 2026 13:52
@BenTaylorDev
BenTaylorDev marked this pull request as ready for review October 7, 2026 14:03
@BenTaylorDev
BenTaylorDev merged commit 8fc6eca into ben1/1937-headers-at-send-time Oct 7, 2026
18 checks passed
@BenTaylorDev
BenTaylorDev deleted the ben1/1937-docs-cleanup branch October 7, 2026 14:04
BenTaylorDev added a commit that referenced this pull request Oct 9, 2026
…ync builders) (#7510)

## What does this PR do?

The `headers` option now accepts a record, a sync builder, or an async
builder. A builder runs **when each request is sent**, not when the
provider renders.

**The bug on `main`:** a sync builder ran during the provider's render.
So if a token rotated without a provider re-render, CopilotKit kept
sending the old token. For example, Clerk tokens live for 60 seconds,
and typing in the chat input doesn't re-render the provider. After about
a minute idle, the next run got a 401. Intelligence makes this worse,
because thread refetches and realtime reconnects run without any user
action, including in background tabs. There was also no way to pass an
async `getToken()` at all (#1937, #2159).

Measured with the real `@copilotkit/react-core` v2 build in jsdom,
sending real HTTP requests to a local runtime that rejects tokens older
than 60 s, after a real 65 s idle with no provider re-render:

| Request after 65 s idle | `main` | this branch |
|---|---|---|
| Send a message (run) | **401**, token 65,053 ms old | 200, token 3–4
ms old |
| `useThreads().renameThread()` (via `ɵruntimeFetch`) | **401**, token
65,051 ms old | 200, token 4–6 ms old |

### How it works

- **Core** (`@copilotkit/core`): a `HeaderSourceResolver` owns the
headers source.
- It resolves synchronously for a record or a sync builder, so static
and sync users gain no extra `await`.
- For an async builder, concurrent requests share one in-flight call. A
generation counter makes sure a call started before `setHeaders()` is
never reused after it.
- New public API: `resolveHeaders()`, `CopilotKitHeadersSource`,
`CopilotKitHeaderResolutionError`, and the error code
`HEADER_RESOLUTION_FAILED`.
- `ɵruntimeFetch` adds the current headers when each request is sent,
before the runtime watchdog is armed and before the single-route
rewrite. The request's own `Content-Type`/`Accept` still win, and core
headers still beat an agent's own headers (#5635 precedence).
- `/info`, inspector metadata, runs, connects, stop requests and
`/suggest` all resolve current headers.
- **React v2** `CopilotKitProvider` and **`<CopilotKit>`** (also the
main v2 export): the provider hands core one stable builder and never
calls it during render. `<CopilotKit>` accepts async builders too. The
one exception is the legacy v1 GraphQL `CopilotTask` path: it doesn't
await an async builder, and it logs a one-time dev warning.
- **Vue** and **Angular** (Angular accepts a builder for the first
time), **web-inspector**, **react-textarea** (a dead render-time headers
read was removed), and the **docs**.
- **Out of scope:** React Native is unchanged (sync builder, evaluated
at render); a follow-up issue will cover it. Cross-origin agent headers
(#5635) are unchanged, and the docs now warn about them.

### Behavior changes

1. **A sync builder now runs once per request**, not once per provider
render.
2. **A new token from a builder doesn't fire `onHeadersChanged`** and
doesn't refetch threads or inspector metadata. Only `setHeaders()` or a
new source does.
3. **`setHeaders()` with an equal record is a no-op**, and so is passing
the same builder function again.
4. **User switch with a builder:** re-rendering the provider no longer
reloads the thread list or re-subscribes realtime, because the builder's
identity is stable. On a user switch, remount the provider (for example
`key={userId}`), or call `setHeaders` with a new function or a record.
The docs say this. Commit 9a69623 carries a `BREAKING CHANGE:`
footer, so this lands under Breaking Changes in the release notes.
5. **Fail closed:** if a builder throws or rejects, or returns something
that isn't an object (for example `() => token && {...}` before
sign-in), the request is not sent. `onError` receives
`header_resolution_failed` once per failed call. A header failure
replaces the `AGENT_RUN_FAILED`/`AGENT_CONNECT_FAILED` that used to
follow. A sync builder that threw used to crash render; now it fails
closed. A header failure on `/info` sets the runtime status to Error and
logs a warning that names headers.
6. **`copilotkit.headers`** is the last resolved value. With a builder
it is `{}` until the first request. Angular's `headers()` signal follows
source changes only (`{}` for a builder); use `core.resolveHeaders()`
instead.
7. **A proxied runtime agent's `agent.headers` no longer contains core
headers.** They are added at send time. Three existing tests (two #5635
remote-agent tests and one registered-proxy test) now assert on the
request instead of on the field.
8. **Stop requests** and provisional proxies (React, Vue, Angular) now
go through `ɵruntimeFetch` (stop requests are marked non-critical).
9. **v1 `copilotApiConfig.headers`** is a lazy getter, so a sync builder
runs when `CopilotTask.run` reads it.
10. **`CpkThreadInspector.headers`** is deprecated in favor of
`resolveHeaders`, and still works as a fallback.
11. **Angular `updateRuntime({ headers })`** now applies the license-key
default to the new headers, as construction always did. Passing the same
builder again is a no-op.
12. **Type widenings:** `CopilotKitCoreConfig.headers`, Angular
`CopilotKitConfig.headers`, and the `headers` prop on
`CopilotKitProvider`, Vue and `<CopilotKit>`. `resolveHeaders()` returns
a read-only record.

### Follow-ups

- #7511: `HEADER_RESOLUTION_FAILED` has no agent or thread context.
- #7512: React `use-agent` re-applies headers on value changes instead
of the generation.
- #7513: React Native parity.
- #7514: core headers reach user-supplied agents on other origins (#5635
behavior, documented here).
- #7515 (stacked on this PR): moves the hand-written v1 `CopilotKit`
docs notes into the JSDoc they're generated from, and deletes an
orphaned auto-generated snippet.

## Related PRs and Issues

- Closes #1937
- Supersedes #6291. Thanks to @rodboev: that PR's review is where the
StrictMode, identity-churn and sync-timing traps in this design were
found.
- Related: #2159 (closed as a duplicate of #1937), #3401 / OSS-551

## Testing

Everything below ran on this branch, rebased onto `origin/main` at
`b3d1aad2e3`. Each suite also ran on a clean `origin/main` worktree in
the same environment.

**Unit and integration suites (branch):**

| Package | Result |
|---|---|
| `@copilotkit/core` | 1007 / 1007 pass; `check-types` clean |
| `@copilotkit/react-core` | 1771 vitest + 54 node:test pass;
`check-types` clean |
| `@copilotkit/vue` | 1160 / 1160 pass; `vue-tsc` clean |
| `@copilotkit/angular` | 452 pass, 1 skipped (already skipped on main);
`check-types` clean |
| `@copilotkit/web-inspector` | 794 / 794 pass; `check-types` clean |
| `@copilotkit/react-textarea` | 3 / 3 pass; `check-types` clean |

- **Compared with `origin/main`:** no failures appear on the branch
only. `use-agent-context-timing.e2e` failed once, during a run that
overlapped a parallel `pnpm install`. It didn't recur in 2 full runs, 3
isolated runs or 10 runs under load. Its agent isn't an `HttpAgent`, so
this change adds no await on its path.
- **Mutation checks:** every new test was checked by breaking the
mechanism it guards, confirming the test fails, and restoring. Examples:
  - render-time builder evaluation → the stale-token tests fail;
  - dropping the generation guard → the in-flight reuse tests fail;
  - keying on header values → the no-reload tests fail;
- a snapshot spread on a `ɵruntimeFetch` site → the removed-key tests
fail;
  - awaiting unconditionally → the sync-timing tests fail.
- **Other gates:**
- oxlint: 0 errors. On the 49 modified files, warnings go from 58 on
`main` to 49. The 12 new files add 4, for 53 in total.
  - Public API manifest: unchanged.
  - Release, config-allowlist and static-quality script tests: pass.
- shell-docs search index and typecheck: pass. Its suite passes except 3
PNG checks, which fail only because the worktree has LFS pointer files
instead of images.
- Size: core is 1.19 kB larger minified. The size job is informational.
- Angular showcase initial-bundle budget: 1,479,169 raw bytes on the
branch vs 1,479,152 on `main` (cap 1,551,287). An earlier push failed
this check because `config.ts` imported a value from `@copilotkit/core`,
which pulled all of core into the initial bundle. `config.ts` now
imports types only, and a test guards it.
- **Not run locally:** `check:packages`, `verify:angular-package`,
`verify:runtime-package`, `verify:channels-umbrella`, and the
web-inspector browser tests. CI covers them.
- **Docs:** every edited `.mdx` parses with the repo's `@mdx-js/mdx`.
- **Live check:** the table at the top. I re-ran both scenarios on the
final head (`71368fea1e`) with the same results: after a 65 s idle with
0 provider re-renders, the run sent a 2 ms-old token (200) and the
rename a 5 ms-old token (200).

**Review round (9a69623), after merging `origin/main` at
`07d4830ade`:**

- Trajectory connect and suggestions from a cloned `HttpAgent` now
resolve headers at send time. There are two new rows in
`core-headers-request-table.test.ts`.
- Mutation check: with both source fixes reverted, the two new rows fail
(`Expected: "fresh"`, `Received: "stale"`). With the fixes, the table
and trajectory files pass:
  ```
  Test Files  3 passed (3)
       Tests  85 passed (85)
  ```
- The React thread-context test now sends a request and re-renders after
the token change. Mutation check: with `use-threads.tsx` keyed on
`JSON.stringify(copilotkit.headers)`, the test fails (`1 failed`). On
the PR code, the file passes (`13 passed`).
- `nx run-many -t test check-types lint` for core, react-core,
react-textarea, vue, angular and web-inspector: `check-types` passes for
all six. Two tests timed out under the parallel load
(`CopilotThreadsDrawer.ssr`, `MCPAppsUiMessage.e2e`). Both pass when run
alone. `vue:lint` reports 166 errors, which also exist on `main`. None
of them is on a line this PR adds.

## Checklist

- [x] 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
- [ ] "Allow edits by maintainers" is checked (not applicable: this
branch is in this repo)

🤖 Generated with [Claude Code](https://claude.com/claude-code)




<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Web providers now accept synchronous and asynchronous header builders,
resolving the current headers when requests are sent across runtime
requests, agents, threads, transcription, and the Inspector.
  * Valid public API keys are included by default in request headers.
* Changing the header source refreshes relevant thread and Inspector
data; token updates from a builder alone do not trigger those refreshes.
* Header resolution failures prevent the affected request and report
`header_resolution_failed`.

* **Documentation**
* Updated guidance on header builders and request timing, including
React Native’s synchronous-only behavior and the legacy v1 async-builder
limitation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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