Files
copilotkit__copilotkit/packages/react-native/package.json
David McKay 0a582df4dd fix(react-native): add /headless subpath so custom-UI consumers skip chat/attachment native deps
The `@copilotkit/react-native` barrel statically re-exports the prebuilt chat
UI (CopilotChat / CopilotModal / CopilotSidebar / CopilotPopup, which import
`@gorhom/bottom-sheet`) and `useAttachments` (which imports
`expo-document-picker` + `expo-file-system`). Those are optional peer deps, but
a static re-export still forces Metro to resolve them at bundle time. A headless
consumer that uses only `CopilotKitProvider` + `useAgent` + `useFrontendTool`
(a fully custom UI) had to install every chat/attachment native dep or stub them
in `metro.config.js`, or the release bundle fails with
`Unable to resolve module expo-document-picker`.

Add a lean `@copilotkit/react-native/headless` entry that re-exports only the
provider, the platform-agnostic hooks, the render-tool registry, and the
core/AG-UI types — none of the chat UI or `useAttachments` — so those native
deps never enter the bundle graph and the metro-stub workaround is retired.

Mirrors `@copilotkit/react-core/v2/headless` (#5883): a standalone entry file,
wired into the tsdown entry list, the package.json `exports` map, and
`sideEffects` (it side-effect-imports the polyfills). The default barrel now
does `export * from "./headless"` and layers the chat UI on top, so it stays
fully backward compatible. Adds a static import-graph regression test asserting
the headless graph never reaches the chat/attachment modules or their native
peer deps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 14:56:43 -07:00

134 lines
3.4 KiB
JSON

{
"name": "@copilotkit/react-native",
"version": "1.63.2",
"private": false,
"keywords": [
"ai",
"assistant",
"copilot",
"copilotkit",
"mobile",
"react-native"
],
"homepage": "https://github.com/CopilotKit/CopilotKit",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/CopilotKit/CopilotKit.git"
},
"type": "module",
"sideEffects": [
"./dist/index.*",
"./dist/headless.*",
"./dist/polyfills.*",
"./dist/polyfills/**/*"
],
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.cts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./headless": {
"import": "./dist/headless.mjs",
"require": "./dist/headless.cjs"
},
"./polyfills": {
"import": "./dist/polyfills.mjs",
"require": "./dist/polyfills.cjs"
},
"./polyfills/streams": {
"import": "./dist/polyfills/streams.mjs",
"require": "./dist/polyfills/streams.cjs"
},
"./polyfills/encoding": {
"import": "./dist/polyfills/encoding.mjs",
"require": "./dist/polyfills/encoding.cjs"
},
"./polyfills/crypto": {
"import": "./dist/polyfills/crypto.mjs",
"require": "./dist/polyfills/crypto.cjs"
},
"./polyfills/dom": {
"import": "./dist/polyfills/dom.mjs",
"require": "./dist/polyfills/dom.cjs"
},
"./polyfills/location": {
"import": "./dist/polyfills/location.mjs",
"require": "./dist/polyfills/location.cjs"
},
"./components": {
"import": "./dist/components/index.mjs",
"require": "./dist/components/index.cjs"
},
"./package.json": "./package.json"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsdown",
"dev": "tsdown --watch",
"test": "vitest run",
"check-types": "tsc --noEmit",
"publint": "publint .",
"attw": "attw --pack . --profile node16 --ignore-rules internal-resolution-error",
"link:global": "pnpm link --global",
"unlink:global": "pnpm unlink --global"
},
"dependencies": {
"@ag-ui/client": "0.0.57",
"@copilotkit/core": "workspace:*",
"@copilotkit/react-core": "workspace:*",
"@copilotkit/shared": "workspace:*",
"text-encoding": "^0.7.0",
"web-streams-polyfill": "^4.2.0"
},
"devDependencies": {
"@testing-library/react": "^16.3.0",
"@types/react": "^19.2.0",
"jsdom": "^26.1.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"tsdown": "^0.20.3",
"typescript": "^5.8.3",
"vitest": "^3.2.4"
},
"peerDependencies": {
"@gorhom/bottom-sheet": "^5.0.0",
"expo-document-picker": ">=12.0.0",
"expo-file-system": ">=17.0.0",
"react": "^18 || ^19",
"react-native": ">=0.70",
"react-native-gesture-handler": ">=2.0.0",
"react-native-reanimated": ">=3.0.0",
"react-native-streamdown": ">=0.1.0",
"zod": ">=3.0.0"
},
"peerDependenciesMeta": {
"@gorhom/bottom-sheet": {
"optional": true
},
"expo-document-picker": {
"optional": true
},
"expo-file-system": {
"optional": true
},
"react-native-gesture-handler": {
"optional": true
},
"react-native-reanimated": {
"optional": true
},
"react-native-streamdown": {
"optional": true
},
"zod": {
"optional": true
}
}
}