Skip to content

docs(react-native): state the version /headless needs, and what to do below it (closes OSS-956) - #6725

Merged
BenTaylorDev merged 1 commit into
mainfrom
ben1/oss-956-the-react-native-guide-imports-from-headless-a-subpath
Aug 27, 2026
Merged

BenTaylorDev merged 1 commit into
mainfrom
ben1/oss-956-the-react-native-guide-imports-from-headless-a-subpath

Conversation

@BenTaylorDev

Copy link
Copy Markdown
Contributor

What does this PR do?

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

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> exports on each:

version ./headless
1.62.0, 1.62.2, 1.62.3 absent
1.63.0, 1.63.1, 1.63.2 absent
1.64.0 present
1.64.1+, 1.65.0, 1.69.2 present

./components and the polyfill subpaths exist across all of the above, so /headless is the only path in the guide that carries a version boundary. Introduced by 0a582df / #6142.

What changed

  • Intro line — /headless is marked 1.64.0+ where the three import surfaces are first introduced.
  • Install step — a type="warn" callout, placed where the resolved version is actually decided. States the boundary, quotes the exact Metro error, gives npm ls @copilotkit/react-native to check what you resolved, and covers the fallback.
  • Import surfaces table — a new "Available since" column.
  • Import surfaces prose — records what /headless is, 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.mjs on those versions statically imports expo-document-picker and expo-file-system. A reader who switches to the root therefore inherits exactly the peer-dependency resolution failure that this guide's /headless choice exists to avoid:

Unable to resolve module expo-document-picker

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 ./headless to 1.62.x

That was the alternative the issue floated, and it looks unnecessary. /headless was 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), and src/headless.ts ("existing imports from @copilotkit/react-native are 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

Verification

  • MDX compiles via @mdx-js/mdx + remark-gfm, edited and baseline both
  • 4-column Import surfaces table parses; 19/19 <Callout> tags balanced
  • commitlint exit 0
  • pnpm check:intelligence-env-names passes
  • .mdx is not in lefthook's lint-fix glob, so oxfmt/oxlint never applied to this file
  • This page carries no doctest= fences, and no fence in it changed, so the guide's snippets stay runnable as they were

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

🤖 Generated with Claude Code

… 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]>
@linear-code

linear-code Bot commented Aug 26, 2026

Copy link
Copy Markdown

OSS-956

@github-actions

Copy link
Copy Markdown
Contributor

Production Digest-Pinning Audit

All 42 services digest-pinned.

Run 2026-08-26 13:34:55 PDT — 0 finding(s).

@BenTaylorDev
BenTaylorDev merged commit 30d4f2a into main Aug 27, 2026
25 checks passed
@BenTaylorDev
BenTaylorDev deleted the ben1/oss-956-the-react-native-guide-imports-from-headless-a-subpath branch August 27, 2026 14:31
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.

2 participants