Repository navigation
docs(react-native): state the version /headless needs, and what to do below it (closes OSS-956) - #6725
Merged
BenTaylorDev merged 1 commit intoAug 27, 2026
Conversation
… below it (closes OSS-956) The React Native guide imports `CopilotKitProvider`, `useAgent` and `useCopilotKit` from `@copilotkit/react-native/headless` and names no version. That subpath first ships in 1.64.0 (#6142), so a project pinned to 1.63.x or earlier fails every one of those imports with `Unable to resolve module @copilotkit/react-native/headless` — which on Metro reads like a broken install rather than a version skew, and sends the reader into the package-exports and polyfill debugging the same guide warns about. The actual fix is one word in an import path. Verified against the registry rather than inferred: `./headless` is absent from 1.62.0, 1.62.2, 1.62.3, 1.63.0, 1.63.1 and 1.63.2, and present from 1.64.0 onward. `./components` and the polyfill subpaths exist across all of them, so `/headless` is the only path in the guide with a version boundary. State the boundary in the three places a reader meets the subpath: the intro line that introduces the surfaces, a callout in the install step (where the resolved version is actually decided, with `npm ls` to check it), and an "Available since" column in the Import surfaces table. The fallback advice is deliberately not just "import from the root". On 1.62.2 and 1.63.2 the root barrel does export all three names — but its `dist/index.mjs` statically imports `expo-document-picker` and `expo-file-system`, so a reader who switches to the root inherits exactly the peer-dependency resolution failure that this guide's `/headless` choice exists to avoid. The note says so and points at the stub/install requirement. Also records what `/headless` is, since the guide never said: a lean alternative entry added so custom-UI consumers skip the chat and attachment native deps, not a replacement for the root barrel, which remains the package's default full surface and re-exports everything in `/headless`. Prose only — no snippet in this page changed, and the page carries no doctest fences, so the guide's snippets stay runnable as they were. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
BenTaylorDev
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
August 26, 2026 20:34
Contributor
Production Digest-Pinning AuditAll 42 services digest-pinned. Run 2026-08-26 13:34:55 PDT — 0 finding(s). |
MikeRyanDev
approved these changes
Aug 27, 2026
BenTaylorDev
deleted the
ben1/oss-956-the-react-native-guide-imports-from-headless-a-subpath
branch
August 27, 2026 14:31
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 does this PR do?
The React Native guide imports
CopilotKitProvider,useAgentanduseCopilotKitfrom@copilotkit/react-native/headlessand names no version. That subpath first ships in 1.64.0 (#6142), so a project pinned to 1.63.x or earlier fails every one of those imports with:On Metro that reads like a broken install rather than a version skew, and it sends the reader into the package-exports and polyfill debugging the same guide warns about a few sections later. The actual fix is one word in an import path.
This states the boundary in the three places a reader meets the subpath. Prose only — no snippet in this page changed.
The version boundary, verified against the registry
Not inferred from a changelog —
npm view @copilotkit/react-native@<v> exportson each:./headless./componentsand the polyfill subpaths exist across all of the above, so/headlessis the only path in the guide that carries a version boundary. Introduced by 0a582df / #6142.What changed
/headlessis marked1.64.0+where the three import surfaces are first introduced.type="warn"callout, placed where the resolved version is actually decided. States the boundary, quotes the exact Metro error, givesnpm ls @copilotkit/react-nativeto check what you resolved, and covers the fallback./headlessis, which the guide never said: a lean alternative entry added so custom-UI consumers skip the chat and attachment native deps — not a replacement for the root barrel, which remains the package's default full surface and re-exports everything in/headless.The fallback advice is deliberately not just "import from the root"
On 1.62.2 and 1.63.2 the root barrel does export all three names (checked in the shipped tarballs, not assumed). But
package/dist/index.mjson those versions statically importsexpo-document-pickerandexpo-file-system. A reader who switches to the root therefore inherits exactly the peer-dependency resolution failure that this guide's/headlesschoice exists to avoid:So the callout says to prefer upgrading to 1.64.0+, and if you cannot (because you are matching a pinned
@copilotkit/runtime), names the install-or-stub requirement that comes with the root import rather than presenting it as a free swap.Why not backport
./headlessto 1.62.xThat was the alternative the issue floated, and it looks unnecessary.
/headlesswas never intended as the canonical entry that supersedes the root — #6142's message,src/index.ts(export * from "./headless", with a root quick-start that uses the root), andsrc/headless.ts("existing imports from@copilotkit/react-nativeare unchanged") all agree it is a lean alternative. Adding an entry point in a patch of an older line would also change what "the pinned set" means for anyone matching client to runtime.Related PRs and Issues
/headlesssubpath in 1.64.0@copilotkit/react-core/v2/headlessentry that fix(react-native): add /headless subpath so custom-UI consumers skip chat/attachment native deps #6142 mirrorsVerification
@mdx-js/mdx+remark-gfm, edited and baseline both<Callout>tags balancedcommitlintexit 0pnpm check:intelligence-env-namespasses.mdxis not in lefthook'slint-fixglob, so oxfmt/oxlint never applied to this filedoctest=fences, and no fence in it changed, so the guide's snippets stay runnable as they wereChecklist
🤖 Generated with Claude Code