Files
Maxim 94c9c1d4c3 feat: add @copilotkit/react-native package
Headless React Native wrapper for CopilotKit. Provides a lightweight
CopilotKitProvider and re-exports platform-agnostic hooks from
react-core without pulling web dependencies (no DOM, CSS, Radix,
Lit, A2UI). Includes XHR-based streaming fetch polyfill for Hermes
and granular polyfills for streams, encoding, crypto, DOM, and
location APIs.
2026-05-06 16:41:51 -07:00

28 lines
666 B
TypeScript

/**
* Polyfill: ReadableStream, WritableStream, TransformStream
*
* Required for SSE streaming in CopilotKit.
* Skipped individually if the global already has each class defined.
*
* Usage:
* import "@copilotkit/react-native/polyfills/streams";
*/
import {
ReadableStream,
WritableStream,
TransformStream,
} from "web-streams-polyfill";
const g = globalThis as Record<string, unknown>;
if (typeof g.ReadableStream === "undefined") {
g.ReadableStream = ReadableStream;
}
if (typeof g.WritableStream === "undefined") {
g.WritableStream = WritableStream;
}
if (typeof g.TransformStream === "undefined") {
g.TransformStream = TransformStream;
}