@copilotkit/react-native 2.0.0-rc.20 → 2.0.0-rc.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
1
  import { t as MarkdownRendererProvider } from "./MarkdownRendererContext-B_AKdPAN.mjs";
2
2
  import React, { useEffect, useMemo, useRef, useState } from "react";
3
3
  import { CopilotKitContext, LicenseContext } from "@copilotkit/react-core/context";
4
- import { CopilotKitCoreReact } from "@copilotkit/react-core/headless";
4
+ import { CopilotKitCoreReact, ɵuseOwnedCore } from "@copilotkit/react-core/headless";
5
+ import { ɵreportProviderConfigDiagnostics, ɵresolveProviderConfig } from "@copilotkit/core";
5
6
  import { createLicenseContextValue } from "@copilotkit/shared";
6
7
  import { jsx } from "react/jsx-runtime";
7
8
 
@@ -33,48 +34,67 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp, creden
33
34
  const resolvedHeaders = typeof headersProp === "function" ? headersProp() : headersProp;
34
35
  const stableHeaders = useMemo(() => resolvedHeaders ?? {}, [JSON.stringify(resolvedHeaders)]);
35
36
  const stableProperties = useMemo(() => properties ?? {}, [JSON.stringify(properties)]);
36
- const copilotkitRef = useRef(null);
37
- if (copilotkitRef.current === null) {
38
- const instance = new CopilotKitCoreReact({
39
- runtimeUrl,
40
- runtimeTransport: useSingleEndpoint === true ? "single" : useSingleEndpoint === false ? "rest" : "auto",
37
+ const resolvedConfig = useMemo(() => ɵresolveProviderConfig({
38
+ runtimeUrl,
39
+ useSingleEndpoint,
40
+ properties: stableProperties
41
+ }), [
42
+ runtimeUrl,
43
+ useSingleEndpoint,
44
+ stableProperties
45
+ ]);
46
+ const loggedDiagnosticsRef = useRef(/* @__PURE__ */ new Set());
47
+ ɵreportProviderConfigDiagnostics(resolvedConfig.diagnostics, {
48
+ isProduction: process.env.NODE_ENV === "production",
49
+ logged: loggedDiagnosticsRef.current
50
+ });
51
+ const copilotkit = ɵuseOwnedCore(useRef(null), () => new CopilotKitCoreReact({
52
+ runtimeUrl: resolvedConfig.runtimeUrl,
53
+ runtimeTransport: resolvedConfig.runtimeTransport,
54
+ deferInitialConnection: true,
55
+ headers: stableHeaders,
56
+ credentials,
57
+ messageFilter,
58
+ properties: resolvedConfig.properties,
59
+ debug,
60
+ defaultThrottleMs,
61
+ onError
62
+ }));
63
+ useEffect(() => {
64
+ copilotkit.setErrorHandler(onError);
65
+ }, [copilotkit, onError]);
66
+ useEffect(() => {
67
+ copilotkit.ɵupdateConfig({
68
+ messageFilter,
69
+ runtimeUrl: resolvedConfig.runtimeUrl,
70
+ runtimeTransport: resolvedConfig.runtimeTransport,
41
71
  headers: stableHeaders,
42
72
  credentials,
43
- messageFilter,
44
- properties: stableProperties,
45
- debug
73
+ properties: resolvedConfig.properties,
74
+ debug,
75
+ defaultThrottleMs
46
76
  });
47
- if (defaultThrottleMs !== void 0) instance.setDefaultThrottleMs(defaultThrottleMs);
48
- copilotkitRef.current = instance;
49
- }
50
- const copilotkit = copilotkitRef.current;
51
- useEffect(() => {
52
- copilotkit.setRuntimeUrl(runtimeUrl);
53
- copilotkit.setRuntimeTransport(useSingleEndpoint === true ? "single" : useSingleEndpoint === false ? "rest" : "auto");
54
- copilotkit.setHeaders(stableHeaders);
55
- copilotkit.setCredentials(credentials);
56
- copilotkit.setMessageFilter(messageFilter);
57
- copilotkit.setProperties(stableProperties);
58
- copilotkit.setDebug(debug);
77
+ copilotkit.connect();
59
78
  }, [
60
- runtimeUrl,
61
- useSingleEndpoint,
79
+ copilotkit,
80
+ messageFilter,
81
+ resolvedConfig.runtimeUrl,
82
+ resolvedConfig.runtimeTransport,
62
83
  stableHeaders,
63
84
  credentials,
64
- messageFilter,
65
- stableProperties,
85
+ resolvedConfig.properties,
66
86
  debug,
67
- copilotkit
87
+ defaultThrottleMs
68
88
  ]);
69
- useEffect(() => {
70
- copilotkit.setDefaultThrottleMs(defaultThrottleMs);
71
- }, [copilotkit, defaultThrottleMs]);
72
89
  const [executingToolCallIds, setExecutingToolCallIds] = useState(() => /* @__PURE__ */ new Set());
73
- const [runtimeLicenseStatus, setRuntimeLicenseStatus] = useState(void 0);
74
- const onErrorRef = useRef(onError);
90
+ const [runtimeInfo, setRuntimeInfo] = useState(null);
91
+ const runtimeLicenseStatus = runtimeInfo?.licenseStatus;
75
92
  useEffect(() => {
76
- onErrorRef.current = onError;
77
- }, [onError]);
93
+ const syncRuntimeInfo = () => setRuntimeInfo(copilotkit.ɵruntimeInfo);
94
+ const unsubscribe = copilotkit.ɵsubscribeToRuntimeInfo(syncRuntimeInfo);
95
+ syncRuntimeInfo();
96
+ return unsubscribe;
97
+ }, [copilotkit]);
78
98
  useEffect(() => {
79
99
  const subscription = copilotkit.subscribe({
80
100
  onToolExecutionStart: ({ toolCallId }) => {
@@ -92,13 +112,6 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp, creden
92
112
  next.delete(toolCallId);
93
113
  return next;
94
114
  });
95
- },
96
- onError: (event) => {
97
- if (onErrorRef.current) onErrorRef.current(event);
98
- else console.error(`[CopilotKit] Error (${event.code}):`, event.error, event.context ?? {});
99
- },
100
- onRuntimeConnectionStatusChanged: () => {
101
- setRuntimeLicenseStatus(copilotkit.licenseStatus);
102
115
  }
103
116
  });
104
117
  return () => subscription.unsubscribe();
@@ -122,4 +135,4 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp, creden
122
135
 
123
136
  //#endregion
124
137
  export { CopilotKitProvider as t };
125
- //# sourceMappingURL=CopilotKitProvider-DlP73sLt.mjs.map
138
+ //# sourceMappingURL=CopilotKitProvider-BXpkAl1Y.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopilotKitProvider-BXpkAl1Y.mjs","names":[],"sources":["../src/CopilotKitProvider.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport {\n CopilotKitContext,\n LicenseContext,\n} from \"@copilotkit/react-core/context\";\nimport type {\n CopilotKitContextValue,\n CopilotKitCoreReact as CopilotKitCoreReactInstance,\n} from \"@copilotkit/react-core/context\";\nimport {\n CopilotKitCoreReact,\n ɵuseOwnedCore,\n} from \"@copilotkit/react-core/headless\";\nimport type {\n ɵCopilotKitProviderBaseOptions,\n ɵRuntimeInfo,\n} from \"@copilotkit/core\";\nimport {\n ɵreportProviderConfigDiagnostics,\n ɵresolveProviderConfig,\n} from \"@copilotkit/core\";\nimport { createLicenseContextValue } from \"@copilotkit/shared\";\nimport { MarkdownRendererProvider } from \"./components/MarkdownRendererContext\";\nimport type { MarkdownRendererValue } from \"./components/MarkdownRendererContext\";\n\nexport interface CopilotKitNativeProviderProps extends Pick<\n ɵCopilotKitProviderBaseOptions,\n | \"credentials\"\n | \"messageFilter\"\n | \"useSingleEndpoint\"\n | \"properties\"\n | \"onError\"\n | \"debug\"\n | \"defaultThrottleMs\"\n> {\n children: ReactNode;\n /** URL of the CopilotKit runtime endpoint */\n runtimeUrl: string;\n /** Custom headers sent with every request */\n headers?: Record<string, string> | (() => Record<string, string>);\n /**\n * Custom markdown renderer for assistant messages. Either a component (escape\n * hatch — receives `content` and an optional `isStreaming` flag) used instead\n * of the built-in renderer, or a `{ style, animate }` config object to\n * configure the built-in React Native renderer (the `CopilotMarkdown` used by\n * the default `AssistantMessage`) without writing a wrapper.\n */\n markdownRenderer?: MarkdownRendererValue;\n // Cloud features (publicApiKey, licenseToken) — not yet supported on React Native\n}\n\n/**\n * CopilotKit provider for React Native.\n *\n * A lightweight alternative to the web CopilotKitProvider that avoids\n * web-only dependencies (DOM, CSS, Radix UI, Lit, etc).\n *\n * Polyfills are auto-imported when `@copilotkit/react-native` is loaded,\n * so a separate `import \"@copilotkit/react-native/polyfills\"` is no longer\n * required (though it remains available for advanced use).\n *\n * Usage:\n * ```tsx\n * import { CopilotKitProvider } from \"@copilotkit/react-native\";\n *\n * function App() {\n * return (\n * <CopilotKitProvider runtimeUrl=\"https://your-runtime/api/copilotkit\">\n * <ChatScreen />\n * </CopilotKitProvider>\n * );\n * }\n * ```\n */\nexport const CopilotKitProvider: React.FC<CopilotKitNativeProviderProps> = ({\n children,\n runtimeUrl,\n headers: headersProp,\n credentials,\n messageFilter,\n useSingleEndpoint,\n properties,\n onError,\n debug,\n defaultThrottleMs,\n markdownRenderer,\n}) => {\n // Resolve headers from function or static object (matches web provider pattern)\n const resolvedHeaders =\n typeof headersProp === \"function\" ? headersProp() : headersProp;\n\n // Stabilize headers/properties references to avoid effect churn when callers\n // pass inline object literals (e.g. headers={{}} or the undefined default).\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableHeaders = useMemo(\n () => resolvedHeaders ?? {},\n [JSON.stringify(resolvedHeaders)],\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableProperties = useMemo(\n () => properties ?? {},\n [JSON.stringify(properties)],\n );\n\n // Transport mapping and config checks come from core.\n const resolvedConfig = useMemo(\n () =>\n ɵresolveProviderConfig({\n runtimeUrl,\n useSingleEndpoint,\n properties: stableProperties,\n }),\n [runtimeUrl, useSingleEndpoint, stableProperties],\n );\n const loggedDiagnosticsRef = useRef(new Set<string>());\n ɵreportProviderConfigDiagnostics(resolvedConfig.diagnostics, {\n isProduction: process.env.NODE_ENV === \"production\",\n logged: loggedDiagnosticsRef.current,\n });\n\n // One core for the provider lifetime, disposed on unmount (StrictMode\n // safe, see `ɵuseOwnedCore`).\n const copilotkitRef = useRef<CopilotKitCoreReactInstance | null>(null);\n const copilotkit = ɵuseOwnedCore(\n copilotkitRef,\n (): CopilotKitCoreReactInstance =>\n new CopilotKitCoreReact({\n runtimeUrl: resolvedConfig.runtimeUrl,\n runtimeTransport: resolvedConfig.runtimeTransport,\n // `/info` starts from the effect below, so a render React discards\n // never fetches it (#5801).\n deferInitialConnection: true,\n headers: stableHeaders,\n credentials,\n messageFilter,\n properties: resolvedConfig.properties,\n debug,\n // Set at construction so child hooks see it on their first render.\n defaultThrottleMs,\n onError,\n }),\n );\n\n // Core calls `onError`, and logs the error itself when there is none.\n useEffect(() => {\n copilotkit.setErrorHandler(onError);\n }, [copilotkit, onError]);\n\n // Sync props to the core. Core applies only what changed.\n useEffect(() => {\n copilotkit.ɵupdateConfig({\n messageFilter,\n runtimeUrl: resolvedConfig.runtimeUrl,\n runtimeTransport: resolvedConfig.runtimeTransport,\n headers: stableHeaders,\n credentials,\n properties: resolvedConfig.properties,\n debug,\n defaultThrottleMs,\n });\n copilotkit.connect();\n }, [\n copilotkit,\n messageFilter,\n resolvedConfig.runtimeUrl,\n resolvedConfig.runtimeTransport,\n stableHeaders,\n credentials,\n resolvedConfig.properties,\n debug,\n defaultThrottleMs,\n ]);\n\n // Track executing tool call IDs at the provider level.\n // Critical for HITL reconnection: onToolExecutionStart fires before child\n // components mount, so we must capture the state here.\n const [executingToolCallIds, setExecutingToolCallIds] = useState<\n ReadonlySet<string>\n >(() => new Set());\n\n const [runtimeInfo, setRuntimeInfo] = useState<ɵRuntimeInfo | null>(null);\n const runtimeLicenseStatus = runtimeInfo?.licenseStatus;\n\n // Project core's runtime info snapshot; the catch-up read reflects a status\n // that settled before this effect ran.\n useEffect(() => {\n const syncRuntimeInfo = () => setRuntimeInfo(copilotkit.ɵruntimeInfo);\n const unsubscribe = copilotkit.ɵsubscribeToRuntimeInfo(syncRuntimeInfo);\n syncRuntimeInfo();\n return unsubscribe;\n }, [copilotkit]);\n\n // Tool execution tracking.\n // Tool call IDs are tracked at the provider level because onToolExecutionStart\n // fires before child components mount — critical for HITL reconnection.\n useEffect(() => {\n const subscription = copilotkit.subscribe({\n onToolExecutionStart: ({ toolCallId }) => {\n setExecutingToolCallIds((prev) => {\n if (prev.has(toolCallId)) return prev;\n const next = new Set(prev);\n next.add(toolCallId);\n return next;\n });\n },\n onToolExecutionEnd: ({ toolCallId }) => {\n setExecutingToolCallIds((prev) => {\n if (!prev.has(toolCallId)) return prev;\n const next = new Set(prev);\n next.delete(toolCallId);\n return next;\n });\n },\n });\n return () => subscription.unsubscribe();\n }, [copilotkit]);\n\n const contextValue: CopilotKitContextValue = useMemo(\n () => ({\n copilotkit,\n executingToolCallIds,\n }),\n [copilotkit, executingToolCallIds],\n );\n\n // License context — driven by server-reported status via /info endpoint\n const licenseContextValue = useMemo(\n () => createLicenseContextValue(runtimeLicenseStatus),\n [runtimeLicenseStatus],\n );\n\n return (\n <CopilotKitContext.Provider value={contextValue}>\n <LicenseContext.Provider value={licenseContextValue}>\n <MarkdownRendererProvider renderer={markdownRenderer}>\n {children}\n </MarkdownRendererProvider>\n </LicenseContext.Provider>\n </CopilotKitContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,MAAa,sBAA+D,EAC1E,UACA,YACA,SAAS,aACT,aACA,eACA,mBACA,YACA,SACA,OACA,mBACA,uBACI;CAEJ,MAAM,kBACJ,OAAO,gBAAgB,aAAa,aAAa,GAAG;CAKtD,MAAM,gBAAgB,cACd,mBAAmB,EAAE,EAC3B,CAAC,KAAK,UAAU,gBAAgB,CAAC,CAClC;CAED,MAAM,mBAAmB,cACjB,cAAc,EAAE,EACtB,CAAC,KAAK,UAAU,WAAW,CAAC,CAC7B;CAGD,MAAM,iBAAiB,cAEnB,uBAAuB;EACrB;EACA;EACA,YAAY;EACb,CAAC,EACJ;EAAC;EAAY;EAAmB;EAAiB,CAClD;CACD,MAAM,uBAAuB,uBAAO,IAAI,KAAa,CAAC;AACtD,kCAAiC,eAAe,aAAa;EAC3D,cAAc,QAAQ,IAAI,aAAa;EACvC,QAAQ,qBAAqB;EAC9B,CAAC;CAKF,MAAM,aAAa,cADG,OAA2C,KAAK,QAIlE,IAAI,oBAAoB;EACtB,YAAY,eAAe;EAC3B,kBAAkB,eAAe;EAGjC,wBAAwB;EACxB,SAAS;EACT;EACA;EACA,YAAY,eAAe;EAC3B;EAEA;EACA;EACD,CAAC,CACL;AAGD,iBAAgB;AACd,aAAW,gBAAgB,QAAQ;IAClC,CAAC,YAAY,QAAQ,CAAC;AAGzB,iBAAgB;AACd,aAAW,cAAc;GACvB;GACA,YAAY,eAAe;GAC3B,kBAAkB,eAAe;GACjC,SAAS;GACT;GACA,YAAY,eAAe;GAC3B;GACA;GACD,CAAC;AACF,aAAW,SAAS;IACnB;EACD;EACA;EACA,eAAe;EACf,eAAe;EACf;EACA;EACA,eAAe;EACf;EACA;EACD,CAAC;CAKF,MAAM,CAAC,sBAAsB,2BAA2B,+BAEhD,IAAI,KAAK,CAAC;CAElB,MAAM,CAAC,aAAa,kBAAkB,SAA8B,KAAK;CACzE,MAAM,uBAAuB,aAAa;AAI1C,iBAAgB;EACd,MAAM,wBAAwB,eAAe,WAAW,aAAa;EACrE,MAAM,cAAc,WAAW,wBAAwB,gBAAgB;AACvE,mBAAiB;AACjB,SAAO;IACN,CAAC,WAAW,CAAC;AAKhB,iBAAgB;EACd,MAAM,eAAe,WAAW,UAAU;GACxC,uBAAuB,EAAE,iBAAiB;AACxC,6BAAyB,SAAS;AAChC,SAAI,KAAK,IAAI,WAAW,CAAE,QAAO;KACjC,MAAM,OAAO,IAAI,IAAI,KAAK;AAC1B,UAAK,IAAI,WAAW;AACpB,YAAO;MACP;;GAEJ,qBAAqB,EAAE,iBAAiB;AACtC,6BAAyB,SAAS;AAChC,SAAI,CAAC,KAAK,IAAI,WAAW,CAAE,QAAO;KAClC,MAAM,OAAO,IAAI,IAAI,KAAK;AAC1B,UAAK,OAAO,WAAW;AACvB,YAAO;MACP;;GAEL,CAAC;AACF,eAAa,aAAa,aAAa;IACtC,CAAC,WAAW,CAAC;CAEhB,MAAM,eAAuC,eACpC;EACL;EACA;EACD,GACD,CAAC,YAAY,qBAAqB,CACnC;CAGD,MAAM,sBAAsB,cACpB,0BAA0B,qBAAqB,EACrD,CAAC,qBAAqB,CACvB;AAED,QACE,oBAAC,kBAAkB;EAAS,OAAO;YACjC,oBAAC,eAAe;GAAS,OAAO;aAC9B,oBAAC;IAAyB,UAAU;IACjC;KACwB;IACH;GACC"}
@@ -3,6 +3,7 @@ let react = require("react");
3
3
  react = require_MarkdownRendererContext.__toESM(react);
4
4
  let _copilotkit_react_core_context = require("@copilotkit/react-core/context");
5
5
  let _copilotkit_react_core_headless = require("@copilotkit/react-core/headless");
6
+ let _copilotkit_core = require("@copilotkit/core");
6
7
  let _copilotkit_shared = require("@copilotkit/shared");
7
8
  let react_jsx_runtime = require("react/jsx-runtime");
8
9
 
@@ -34,48 +35,67 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp, creden
34
35
  const resolvedHeaders = typeof headersProp === "function" ? headersProp() : headersProp;
35
36
  const stableHeaders = (0, react.useMemo)(() => resolvedHeaders ?? {}, [JSON.stringify(resolvedHeaders)]);
36
37
  const stableProperties = (0, react.useMemo)(() => properties ?? {}, [JSON.stringify(properties)]);
37
- const copilotkitRef = (0, react.useRef)(null);
38
- if (copilotkitRef.current === null) {
39
- const instance = new _copilotkit_react_core_headless.CopilotKitCoreReact({
40
- runtimeUrl,
41
- runtimeTransport: useSingleEndpoint === true ? "single" : useSingleEndpoint === false ? "rest" : "auto",
38
+ const resolvedConfig = (0, react.useMemo)(() => (0, _copilotkit_core.ɵresolveProviderConfig)({
39
+ runtimeUrl,
40
+ useSingleEndpoint,
41
+ properties: stableProperties
42
+ }), [
43
+ runtimeUrl,
44
+ useSingleEndpoint,
45
+ stableProperties
46
+ ]);
47
+ const loggedDiagnosticsRef = (0, react.useRef)(/* @__PURE__ */ new Set());
48
+ (0, _copilotkit_core.ɵreportProviderConfigDiagnostics)(resolvedConfig.diagnostics, {
49
+ isProduction: process.env.NODE_ENV === "production",
50
+ logged: loggedDiagnosticsRef.current
51
+ });
52
+ const copilotkit = (0, _copilotkit_react_core_headless.ɵuseOwnedCore)((0, react.useRef)(null), () => new _copilotkit_react_core_headless.CopilotKitCoreReact({
53
+ runtimeUrl: resolvedConfig.runtimeUrl,
54
+ runtimeTransport: resolvedConfig.runtimeTransport,
55
+ deferInitialConnection: true,
56
+ headers: stableHeaders,
57
+ credentials,
58
+ messageFilter,
59
+ properties: resolvedConfig.properties,
60
+ debug,
61
+ defaultThrottleMs,
62
+ onError
63
+ }));
64
+ (0, react.useEffect)(() => {
65
+ copilotkit.setErrorHandler(onError);
66
+ }, [copilotkit, onError]);
67
+ (0, react.useEffect)(() => {
68
+ copilotkit.ɵupdateConfig({
69
+ messageFilter,
70
+ runtimeUrl: resolvedConfig.runtimeUrl,
71
+ runtimeTransport: resolvedConfig.runtimeTransport,
42
72
  headers: stableHeaders,
43
73
  credentials,
44
- messageFilter,
45
- properties: stableProperties,
46
- debug
74
+ properties: resolvedConfig.properties,
75
+ debug,
76
+ defaultThrottleMs
47
77
  });
48
- if (defaultThrottleMs !== void 0) instance.setDefaultThrottleMs(defaultThrottleMs);
49
- copilotkitRef.current = instance;
50
- }
51
- const copilotkit = copilotkitRef.current;
52
- (0, react.useEffect)(() => {
53
- copilotkit.setRuntimeUrl(runtimeUrl);
54
- copilotkit.setRuntimeTransport(useSingleEndpoint === true ? "single" : useSingleEndpoint === false ? "rest" : "auto");
55
- copilotkit.setHeaders(stableHeaders);
56
- copilotkit.setCredentials(credentials);
57
- copilotkit.setMessageFilter(messageFilter);
58
- copilotkit.setProperties(stableProperties);
59
- copilotkit.setDebug(debug);
78
+ copilotkit.connect();
60
79
  }, [
61
- runtimeUrl,
62
- useSingleEndpoint,
80
+ copilotkit,
81
+ messageFilter,
82
+ resolvedConfig.runtimeUrl,
83
+ resolvedConfig.runtimeTransport,
63
84
  stableHeaders,
64
85
  credentials,
65
- messageFilter,
66
- stableProperties,
86
+ resolvedConfig.properties,
67
87
  debug,
68
- copilotkit
88
+ defaultThrottleMs
69
89
  ]);
70
- (0, react.useEffect)(() => {
71
- copilotkit.setDefaultThrottleMs(defaultThrottleMs);
72
- }, [copilotkit, defaultThrottleMs]);
73
90
  const [executingToolCallIds, setExecutingToolCallIds] = (0, react.useState)(() => /* @__PURE__ */ new Set());
74
- const [runtimeLicenseStatus, setRuntimeLicenseStatus] = (0, react.useState)(void 0);
75
- const onErrorRef = (0, react.useRef)(onError);
91
+ const [runtimeInfo, setRuntimeInfo] = (0, react.useState)(null);
92
+ const runtimeLicenseStatus = runtimeInfo?.licenseStatus;
76
93
  (0, react.useEffect)(() => {
77
- onErrorRef.current = onError;
78
- }, [onError]);
94
+ const syncRuntimeInfo = () => setRuntimeInfo(copilotkit.ɵruntimeInfo);
95
+ const unsubscribe = copilotkit.ɵsubscribeToRuntimeInfo(syncRuntimeInfo);
96
+ syncRuntimeInfo();
97
+ return unsubscribe;
98
+ }, [copilotkit]);
79
99
  (0, react.useEffect)(() => {
80
100
  const subscription = copilotkit.subscribe({
81
101
  onToolExecutionStart: ({ toolCallId }) => {
@@ -93,13 +113,6 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp, creden
93
113
  next.delete(toolCallId);
94
114
  return next;
95
115
  });
96
- },
97
- onError: (event) => {
98
- if (onErrorRef.current) onErrorRef.current(event);
99
- else console.error(`[CopilotKit] Error (${event.code}):`, event.error, event.context ?? {});
100
- },
101
- onRuntimeConnectionStatusChanged: () => {
102
- setRuntimeLicenseStatus(copilotkit.licenseStatus);
103
116
  }
104
117
  });
105
118
  return () => subscription.unsubscribe();
@@ -128,4 +141,4 @@ Object.defineProperty(exports, 'CopilotKitProvider', {
128
141
  return CopilotKitProvider;
129
142
  }
130
143
  });
131
- //# sourceMappingURL=CopilotKitProvider-DbI3aQam.cjs.map
144
+ //# sourceMappingURL=CopilotKitProvider-DDPbJkHS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopilotKitProvider-DDPbJkHS.cjs","names":["CopilotKitCoreReact","CopilotKitContext","LicenseContext","MarkdownRendererProvider"],"sources":["../src/CopilotKitProvider.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport {\n CopilotKitContext,\n LicenseContext,\n} from \"@copilotkit/react-core/context\";\nimport type {\n CopilotKitContextValue,\n CopilotKitCoreReact as CopilotKitCoreReactInstance,\n} from \"@copilotkit/react-core/context\";\nimport {\n CopilotKitCoreReact,\n ɵuseOwnedCore,\n} from \"@copilotkit/react-core/headless\";\nimport type {\n ɵCopilotKitProviderBaseOptions,\n ɵRuntimeInfo,\n} from \"@copilotkit/core\";\nimport {\n ɵreportProviderConfigDiagnostics,\n ɵresolveProviderConfig,\n} from \"@copilotkit/core\";\nimport { createLicenseContextValue } from \"@copilotkit/shared\";\nimport { MarkdownRendererProvider } from \"./components/MarkdownRendererContext\";\nimport type { MarkdownRendererValue } from \"./components/MarkdownRendererContext\";\n\nexport interface CopilotKitNativeProviderProps extends Pick<\n ɵCopilotKitProviderBaseOptions,\n | \"credentials\"\n | \"messageFilter\"\n | \"useSingleEndpoint\"\n | \"properties\"\n | \"onError\"\n | \"debug\"\n | \"defaultThrottleMs\"\n> {\n children: ReactNode;\n /** URL of the CopilotKit runtime endpoint */\n runtimeUrl: string;\n /** Custom headers sent with every request */\n headers?: Record<string, string> | (() => Record<string, string>);\n /**\n * Custom markdown renderer for assistant messages. Either a component (escape\n * hatch — receives `content` and an optional `isStreaming` flag) used instead\n * of the built-in renderer, or a `{ style, animate }` config object to\n * configure the built-in React Native renderer (the `CopilotMarkdown` used by\n * the default `AssistantMessage`) without writing a wrapper.\n */\n markdownRenderer?: MarkdownRendererValue;\n // Cloud features (publicApiKey, licenseToken) — not yet supported on React Native\n}\n\n/**\n * CopilotKit provider for React Native.\n *\n * A lightweight alternative to the web CopilotKitProvider that avoids\n * web-only dependencies (DOM, CSS, Radix UI, Lit, etc).\n *\n * Polyfills are auto-imported when `@copilotkit/react-native` is loaded,\n * so a separate `import \"@copilotkit/react-native/polyfills\"` is no longer\n * required (though it remains available for advanced use).\n *\n * Usage:\n * ```tsx\n * import { CopilotKitProvider } from \"@copilotkit/react-native\";\n *\n * function App() {\n * return (\n * <CopilotKitProvider runtimeUrl=\"https://your-runtime/api/copilotkit\">\n * <ChatScreen />\n * </CopilotKitProvider>\n * );\n * }\n * ```\n */\nexport const CopilotKitProvider: React.FC<CopilotKitNativeProviderProps> = ({\n children,\n runtimeUrl,\n headers: headersProp,\n credentials,\n messageFilter,\n useSingleEndpoint,\n properties,\n onError,\n debug,\n defaultThrottleMs,\n markdownRenderer,\n}) => {\n // Resolve headers from function or static object (matches web provider pattern)\n const resolvedHeaders =\n typeof headersProp === \"function\" ? headersProp() : headersProp;\n\n // Stabilize headers/properties references to avoid effect churn when callers\n // pass inline object literals (e.g. headers={{}} or the undefined default).\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableHeaders = useMemo(\n () => resolvedHeaders ?? {},\n [JSON.stringify(resolvedHeaders)],\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableProperties = useMemo(\n () => properties ?? {},\n [JSON.stringify(properties)],\n );\n\n // Transport mapping and config checks come from core.\n const resolvedConfig = useMemo(\n () =>\n ɵresolveProviderConfig({\n runtimeUrl,\n useSingleEndpoint,\n properties: stableProperties,\n }),\n [runtimeUrl, useSingleEndpoint, stableProperties],\n );\n const loggedDiagnosticsRef = useRef(new Set<string>());\n ɵreportProviderConfigDiagnostics(resolvedConfig.diagnostics, {\n isProduction: process.env.NODE_ENV === \"production\",\n logged: loggedDiagnosticsRef.current,\n });\n\n // One core for the provider lifetime, disposed on unmount (StrictMode\n // safe, see `ɵuseOwnedCore`).\n const copilotkitRef = useRef<CopilotKitCoreReactInstance | null>(null);\n const copilotkit = ɵuseOwnedCore(\n copilotkitRef,\n (): CopilotKitCoreReactInstance =>\n new CopilotKitCoreReact({\n runtimeUrl: resolvedConfig.runtimeUrl,\n runtimeTransport: resolvedConfig.runtimeTransport,\n // `/info` starts from the effect below, so a render React discards\n // never fetches it (#5801).\n deferInitialConnection: true,\n headers: stableHeaders,\n credentials,\n messageFilter,\n properties: resolvedConfig.properties,\n debug,\n // Set at construction so child hooks see it on their first render.\n defaultThrottleMs,\n onError,\n }),\n );\n\n // Core calls `onError`, and logs the error itself when there is none.\n useEffect(() => {\n copilotkit.setErrorHandler(onError);\n }, [copilotkit, onError]);\n\n // Sync props to the core. Core applies only what changed.\n useEffect(() => {\n copilotkit.ɵupdateConfig({\n messageFilter,\n runtimeUrl: resolvedConfig.runtimeUrl,\n runtimeTransport: resolvedConfig.runtimeTransport,\n headers: stableHeaders,\n credentials,\n properties: resolvedConfig.properties,\n debug,\n defaultThrottleMs,\n });\n copilotkit.connect();\n }, [\n copilotkit,\n messageFilter,\n resolvedConfig.runtimeUrl,\n resolvedConfig.runtimeTransport,\n stableHeaders,\n credentials,\n resolvedConfig.properties,\n debug,\n defaultThrottleMs,\n ]);\n\n // Track executing tool call IDs at the provider level.\n // Critical for HITL reconnection: onToolExecutionStart fires before child\n // components mount, so we must capture the state here.\n const [executingToolCallIds, setExecutingToolCallIds] = useState<\n ReadonlySet<string>\n >(() => new Set());\n\n const [runtimeInfo, setRuntimeInfo] = useState<ɵRuntimeInfo | null>(null);\n const runtimeLicenseStatus = runtimeInfo?.licenseStatus;\n\n // Project core's runtime info snapshot; the catch-up read reflects a status\n // that settled before this effect ran.\n useEffect(() => {\n const syncRuntimeInfo = () => setRuntimeInfo(copilotkit.ɵruntimeInfo);\n const unsubscribe = copilotkit.ɵsubscribeToRuntimeInfo(syncRuntimeInfo);\n syncRuntimeInfo();\n return unsubscribe;\n }, [copilotkit]);\n\n // Tool execution tracking.\n // Tool call IDs are tracked at the provider level because onToolExecutionStart\n // fires before child components mount — critical for HITL reconnection.\n useEffect(() => {\n const subscription = copilotkit.subscribe({\n onToolExecutionStart: ({ toolCallId }) => {\n setExecutingToolCallIds((prev) => {\n if (prev.has(toolCallId)) return prev;\n const next = new Set(prev);\n next.add(toolCallId);\n return next;\n });\n },\n onToolExecutionEnd: ({ toolCallId }) => {\n setExecutingToolCallIds((prev) => {\n if (!prev.has(toolCallId)) return prev;\n const next = new Set(prev);\n next.delete(toolCallId);\n return next;\n });\n },\n });\n return () => subscription.unsubscribe();\n }, [copilotkit]);\n\n const contextValue: CopilotKitContextValue = useMemo(\n () => ({\n copilotkit,\n executingToolCallIds,\n }),\n [copilotkit, executingToolCallIds],\n );\n\n // License context — driven by server-reported status via /info endpoint\n const licenseContextValue = useMemo(\n () => createLicenseContextValue(runtimeLicenseStatus),\n [runtimeLicenseStatus],\n );\n\n return (\n <CopilotKitContext.Provider value={contextValue}>\n <LicenseContext.Provider value={licenseContextValue}>\n <MarkdownRendererProvider renderer={markdownRenderer}>\n {children}\n </MarkdownRendererProvider>\n </LicenseContext.Provider>\n </CopilotKitContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,MAAa,sBAA+D,EAC1E,UACA,YACA,SAAS,aACT,aACA,eACA,mBACA,YACA,SACA,OACA,mBACA,uBACI;CAEJ,MAAM,kBACJ,OAAO,gBAAgB,aAAa,aAAa,GAAG;CAKtD,MAAM,yCACE,mBAAmB,EAAE,EAC3B,CAAC,KAAK,UAAU,gBAAgB,CAAC,CAClC;CAED,MAAM,4CACE,cAAc,EAAE,EACtB,CAAC,KAAK,UAAU,WAAW,CAAC,CAC7B;CAGD,MAAM,uFAEqB;EACrB;EACA;EACA,YAAY;EACb,CAAC,EACJ;EAAC;EAAY;EAAmB;EAAiB,CAClD;CACD,MAAM,yDAA8B,IAAI,KAAa,CAAC;AACtD,wDAAiC,eAAe,aAAa;EAC3D,cAAc,QAAQ,IAAI,aAAa;EACvC,QAAQ,qBAAqB;EAC9B,CAAC;CAKF,MAAM,kFAD2D,KAAK,QAIlE,IAAIA,oDAAoB;EACtB,YAAY,eAAe;EAC3B,kBAAkB,eAAe;EAGjC,wBAAwB;EACxB,SAAS;EACT;EACA;EACA,YAAY,eAAe;EAC3B;EAEA;EACA;EACD,CAAC,CACL;AAGD,4BAAgB;AACd,aAAW,gBAAgB,QAAQ;IAClC,CAAC,YAAY,QAAQ,CAAC;AAGzB,4BAAgB;AACd,aAAW,cAAc;GACvB;GACA,YAAY,eAAe;GAC3B,kBAAkB,eAAe;GACjC,SAAS;GACT;GACA,YAAY,eAAe;GAC3B;GACA;GACD,CAAC;AACF,aAAW,SAAS;IACnB;EACD;EACA;EACA,eAAe;EACf,eAAe;EACf;EACA;EACA,eAAe;EACf;EACA;EACD,CAAC;CAKF,MAAM,CAAC,sBAAsB,qEAErB,IAAI,KAAK,CAAC;CAElB,MAAM,CAAC,aAAa,sCAAgD,KAAK;CACzE,MAAM,uBAAuB,aAAa;AAI1C,4BAAgB;EACd,MAAM,wBAAwB,eAAe,WAAW,aAAa;EACrE,MAAM,cAAc,WAAW,wBAAwB,gBAAgB;AACvE,mBAAiB;AACjB,SAAO;IACN,CAAC,WAAW,CAAC;AAKhB,4BAAgB;EACd,MAAM,eAAe,WAAW,UAAU;GACxC,uBAAuB,EAAE,iBAAiB;AACxC,6BAAyB,SAAS;AAChC,SAAI,KAAK,IAAI,WAAW,CAAE,QAAO;KACjC,MAAM,OAAO,IAAI,IAAI,KAAK;AAC1B,UAAK,IAAI,WAAW;AACpB,YAAO;MACP;;GAEJ,qBAAqB,EAAE,iBAAiB;AACtC,6BAAyB,SAAS;AAChC,SAAI,CAAC,KAAK,IAAI,WAAW,CAAE,QAAO;KAClC,MAAM,OAAO,IAAI,IAAI,KAAK;AAC1B,UAAK,OAAO,WAAW;AACvB,YAAO;MACP;;GAEL,CAAC;AACF,eAAa,aAAa,aAAa;IACtC,CAAC,WAAW,CAAC;CAEhB,MAAM,yCACG;EACL;EACA;EACD,GACD,CAAC,YAAY,qBAAqB,CACnC;CAGD,MAAM,iGAC4B,qBAAqB,EACrD,CAAC,qBAAqB,CACvB;AAED,QACE,2CAACC,iDAAkB;EAAS,OAAO;YACjC,2CAACC,8CAAe;GAAS,OAAO;aAC9B,2CAACC;IAAyB,UAAU;IACjC;KACwB;IACH;GACC"}
@@ -0,0 +1,65 @@
1
+ import { r as MarkdownStyle } from "./Markdown-DzjnSuu5.cjs";
2
+ import React, { ReactNode } from "react";
3
+ import { ɵCopilotKitProviderBaseOptions } from "@copilotkit/core";
4
+
5
+ //#region src/components/MarkdownRendererContext.d.ts
6
+ interface NativeMarkdownRendererProps {
7
+ content: string;
8
+ isStreaming?: boolean;
9
+ }
10
+ type NativeMarkdownRenderer = React.ComponentType<NativeMarkdownRendererProps>;
11
+ /** Config for the built-in RN renderer (pass instead of a component). */
12
+ interface DefaultMarkdownRendererProps {
13
+ style?: MarkdownStyle;
14
+ animate?: boolean;
15
+ }
16
+ type MarkdownRendererValue = NativeMarkdownRenderer | DefaultMarkdownRendererProps;
17
+ declare const MarkdownRendererProvider: React.FC<{
18
+ renderer?: MarkdownRendererValue;
19
+ children: React.ReactNode;
20
+ }>;
21
+ declare function useMarkdownRenderer(): MarkdownRendererValue | undefined;
22
+ //#endregion
23
+ //#region src/CopilotKitProvider.d.ts
24
+ interface CopilotKitNativeProviderProps extends Pick<ɵCopilotKitProviderBaseOptions, "credentials" | "messageFilter" | "useSingleEndpoint" | "properties" | "onError" | "debug" | "defaultThrottleMs"> {
25
+ children: ReactNode;
26
+ /** URL of the CopilotKit runtime endpoint */
27
+ runtimeUrl: string;
28
+ /** Custom headers sent with every request */
29
+ headers?: Record<string, string> | (() => Record<string, string>);
30
+ /**
31
+ * Custom markdown renderer for assistant messages. Either a component (escape
32
+ * hatch — receives `content` and an optional `isStreaming` flag) used instead
33
+ * of the built-in renderer, or a `{ style, animate }` config object to
34
+ * configure the built-in React Native renderer (the `CopilotMarkdown` used by
35
+ * the default `AssistantMessage`) without writing a wrapper.
36
+ */
37
+ markdownRenderer?: MarkdownRendererValue;
38
+ }
39
+ /**
40
+ * CopilotKit provider for React Native.
41
+ *
42
+ * A lightweight alternative to the web CopilotKitProvider that avoids
43
+ * web-only dependencies (DOM, CSS, Radix UI, Lit, etc).
44
+ *
45
+ * Polyfills are auto-imported when `@copilotkit/react-native` is loaded,
46
+ * so a separate `import "@copilotkit/react-native/polyfills"` is no longer
47
+ * required (though it remains available for advanced use).
48
+ *
49
+ * Usage:
50
+ * ```tsx
51
+ * import { CopilotKitProvider } from "@copilotkit/react-native";
52
+ *
53
+ * function App() {
54
+ * return (
55
+ * <CopilotKitProvider runtimeUrl="https://your-runtime/api/copilotkit">
56
+ * <ChatScreen />
57
+ * </CopilotKitProvider>
58
+ * );
59
+ * }
60
+ * ```
61
+ */
62
+ declare const CopilotKitProvider: React.FC<CopilotKitNativeProviderProps>;
63
+ //#endregion
64
+ export { NativeMarkdownRendererProps as a, NativeMarkdownRenderer as i, CopilotKitProvider as n, useMarkdownRenderer as o, MarkdownRendererProvider as r, CopilotKitNativeProviderProps as t };
65
+ //# sourceMappingURL=CopilotKitProvider-F7Pn5kp4.d.cts.map
@@ -0,0 +1,65 @@
1
+ import { r as MarkdownStyle } from "./Markdown-a-rdG22_.mjs";
2
+ import React, { ReactNode } from "react";
3
+ import { ɵCopilotKitProviderBaseOptions } from "@copilotkit/core";
4
+
5
+ //#region src/components/MarkdownRendererContext.d.ts
6
+ interface NativeMarkdownRendererProps {
7
+ content: string;
8
+ isStreaming?: boolean;
9
+ }
10
+ type NativeMarkdownRenderer = React.ComponentType<NativeMarkdownRendererProps>;
11
+ /** Config for the built-in RN renderer (pass instead of a component). */
12
+ interface DefaultMarkdownRendererProps {
13
+ style?: MarkdownStyle;
14
+ animate?: boolean;
15
+ }
16
+ type MarkdownRendererValue = NativeMarkdownRenderer | DefaultMarkdownRendererProps;
17
+ declare const MarkdownRendererProvider: React.FC<{
18
+ renderer?: MarkdownRendererValue;
19
+ children: React.ReactNode;
20
+ }>;
21
+ declare function useMarkdownRenderer(): MarkdownRendererValue | undefined;
22
+ //#endregion
23
+ //#region src/CopilotKitProvider.d.ts
24
+ interface CopilotKitNativeProviderProps extends Pick<ɵCopilotKitProviderBaseOptions, "credentials" | "messageFilter" | "useSingleEndpoint" | "properties" | "onError" | "debug" | "defaultThrottleMs"> {
25
+ children: ReactNode;
26
+ /** URL of the CopilotKit runtime endpoint */
27
+ runtimeUrl: string;
28
+ /** Custom headers sent with every request */
29
+ headers?: Record<string, string> | (() => Record<string, string>);
30
+ /**
31
+ * Custom markdown renderer for assistant messages. Either a component (escape
32
+ * hatch — receives `content` and an optional `isStreaming` flag) used instead
33
+ * of the built-in renderer, or a `{ style, animate }` config object to
34
+ * configure the built-in React Native renderer (the `CopilotMarkdown` used by
35
+ * the default `AssistantMessage`) without writing a wrapper.
36
+ */
37
+ markdownRenderer?: MarkdownRendererValue;
38
+ }
39
+ /**
40
+ * CopilotKit provider for React Native.
41
+ *
42
+ * A lightweight alternative to the web CopilotKitProvider that avoids
43
+ * web-only dependencies (DOM, CSS, Radix UI, Lit, etc).
44
+ *
45
+ * Polyfills are auto-imported when `@copilotkit/react-native` is loaded,
46
+ * so a separate `import "@copilotkit/react-native/polyfills"` is no longer
47
+ * required (though it remains available for advanced use).
48
+ *
49
+ * Usage:
50
+ * ```tsx
51
+ * import { CopilotKitProvider } from "@copilotkit/react-native";
52
+ *
53
+ * function App() {
54
+ * return (
55
+ * <CopilotKitProvider runtimeUrl="https://your-runtime/api/copilotkit">
56
+ * <ChatScreen />
57
+ * </CopilotKitProvider>
58
+ * );
59
+ * }
60
+ * ```
61
+ */
62
+ declare const CopilotKitProvider: React.FC<CopilotKitNativeProviderProps>;
63
+ //#endregion
64
+ export { NativeMarkdownRendererProps as a, NativeMarkdownRenderer as i, CopilotKitProvider as n, useMarkdownRenderer as o, MarkdownRendererProvider as r, CopilotKitNativeProviderProps as t };
65
+ //# sourceMappingURL=CopilotKitProvider-Khgz5dQo.d.mts.map
package/dist/headless.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_MarkdownRendererContext = require('./MarkdownRendererContext-BRNe808d.cjs');
3
3
  require('./utf8-Cf3Ssy33.cjs');
4
4
  require('./polyfills.cjs');
5
- const require_CopilotKitProvider = require('./CopilotKitProvider-DbI3aQam.cjs');
5
+ const require_CopilotKitProvider = require('./CopilotKitProvider-DDPbJkHS.cjs');
6
6
  let _copilotkit_react_core_context = require("@copilotkit/react-core/context");
7
7
  let _copilotkit_react_core_headless = require("@copilotkit/react-core/headless");
8
8
  let _copilotkit_core = require("@copilotkit/core");
@@ -1,5 +1,5 @@
1
1
  import "./Markdown-DzjnSuu5.cjs";
2
- import { n as CopilotKitProvider, t as CopilotKitNativeProviderProps } from "./CopilotKitProvider-lfVMYSby.cjs";
2
+ import { n as CopilotKitProvider, t as CopilotKitNativeProviderProps } from "./CopilotKitProvider-F7Pn5kp4.cjs";
3
3
  import React from "react";
4
4
  import { AgentContextInput, CopilotChatConfigurationValue, CopilotChatDefaultLabels, CopilotChatLabels, Interrupt, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, ReactToolCallRenderer as ReactToolCallRenderer$1, RenderToolCompleteProps, RenderToolExecutingProps, RenderToolInProgressProps, RenderToolProps, ResumeEntry, ResumeStatus, Thread, UseAgentUpdate, UseInterruptConfig, UseThreadsInput, UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useRenderToolCall, useSuggestions, useThreads } from "@copilotkit/react-core/headless";
5
5
  import { CopilotKitCoreErrorCode, CopilotKitCoreRuntimeConnectionStatus, FrontendTool, Suggestion, ToolCallStatus } from "@copilotkit/core";
@@ -1,5 +1,5 @@
1
1
  import "./Markdown-a-rdG22_.mjs";
2
- import { n as CopilotKitProvider, t as CopilotKitNativeProviderProps } from "./CopilotKitProvider-mVDI6DLx.mjs";
2
+ import { n as CopilotKitProvider, t as CopilotKitNativeProviderProps } from "./CopilotKitProvider-Khgz5dQo.mjs";
3
3
  import React from "react";
4
4
  import { CopilotKitContext, CopilotKitContextValue, useCopilotKit, useLicenseContext } from "@copilotkit/react-core/context";
5
5
  import { AgentContextInput, CopilotChatConfigurationValue, CopilotChatDefaultLabels, CopilotChatLabels, Interrupt, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, ReactToolCallRenderer as ReactToolCallRenderer$1, RenderToolCompleteProps, RenderToolExecutingProps, RenderToolInProgressProps, RenderToolProps, ResumeEntry, ResumeStatus, Thread, UseAgentUpdate, UseInterruptConfig, UseThreadsInput, UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useRenderToolCall, useSuggestions, useThreads } from "@copilotkit/react-core/headless";
package/dist/headless.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./utf8-BIN9t4Oy.mjs";
2
2
  import "./polyfills.mjs";
3
- import { t as CopilotKitProvider } from "./CopilotKitProvider-DlP73sLt.mjs";
3
+ import { t as CopilotKitProvider } from "./CopilotKitProvider-BXpkAl1Y.mjs";
4
4
  import { CopilotKitContext, useCopilotKit, useLicenseContext } from "@copilotkit/react-core/context";
5
5
  import { CopilotChatDefaultLabels, UseAgentUpdate, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useRenderToolCall, useSuggestions, useThreads } from "@copilotkit/react-core/headless";
6
6
  import { CopilotKitCoreErrorCode, CopilotKitCoreRuntimeConnectionStatus, ToolCallStatus } from "@copilotkit/core";
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_MarkdownRendererContext = require('./MarkdownRendererContext-BRNe808d.cjs');
3
3
  require('./utf8-Cf3Ssy33.cjs');
4
- const require_CopilotKitProvider = require('./CopilotKitProvider-DbI3aQam.cjs');
4
+ const require_CopilotKitProvider = require('./CopilotKitProvider-DDPbJkHS.cjs');
5
5
  require('./headless.cjs');
6
6
  const require_Markdown = require('./Markdown-CaYHlD4j.cjs');
7
7
  let react = require("react");
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as defaultMarkdownStyles, n as CopilotMarkdownProps, r as MarkdownStyle, t as CopilotMarkdown } from "./Markdown-DzjnSuu5.cjs";
2
- import { a as NativeMarkdownRendererProps, i as NativeMarkdownRenderer, n as CopilotKitProvider, o as useMarkdownRenderer, r as MarkdownRendererProvider, t as CopilotKitNativeProviderProps } from "./CopilotKitProvider-lfVMYSby.cjs";
2
+ import { a as NativeMarkdownRendererProps, i as NativeMarkdownRenderer, n as CopilotKitProvider, o as useMarkdownRenderer, r as MarkdownRendererProvider, t as CopilotKitNativeProviderProps } from "./CopilotKitProvider-F7Pn5kp4.cjs";
3
3
  import { AbstractAgent, AgentCapabilities, AgentContextInput, AssistantMessageType, CopilotChatConfigurationValue, CopilotChatDefaultLabels, CopilotChatLabels, CopilotKitContext, CopilotKitContextValue, CopilotKitCoreErrorCode, CopilotKitCoreRuntimeConnectionStatus, FrontendTool, FrontendToolRenderFunction, Interrupt, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, Message, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, RenderToolCompleteProps, RenderToolExecutingProps, RenderToolInProgressProps, RenderToolProps, ResumeEntry, ResumeStatus, Suggestion, Thread, ToolCall, ToolCallStatus, ToolMessage, UseAgentUpdate, UseInterruptConfig, UseThreadsInput, UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotKit, useFrontendTool, useHumanInTheLoop, useInterrupt, useLicenseContext, useRenderTool, useRenderToolCall, useSuggestions, useThreads } from "./headless.cjs";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
5
5
  import React, { ReactNode } from "react";
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { i as defaultMarkdownStyles, n as CopilotMarkdownProps, r as MarkdownStyle, t as CopilotMarkdown } from "./Markdown-a-rdG22_.mjs";
2
- import { a as NativeMarkdownRendererProps, i as NativeMarkdownRenderer, n as CopilotKitProvider, o as useMarkdownRenderer, r as MarkdownRendererProvider, t as CopilotKitNativeProviderProps } from "./CopilotKitProvider-mVDI6DLx.mjs";
2
+ import { a as NativeMarkdownRendererProps, i as NativeMarkdownRenderer, n as CopilotKitProvider, o as useMarkdownRenderer, r as MarkdownRendererProvider, t as CopilotKitNativeProviderProps } from "./CopilotKitProvider-Khgz5dQo.mjs";
3
3
  import { AbstractAgent, AgentCapabilities, AgentContextInput, AssistantMessageType, CopilotChatConfigurationValue, CopilotChatDefaultLabels, CopilotChatLabels, CopilotKitContext, CopilotKitContextValue, CopilotKitCoreErrorCode, CopilotKitCoreRuntimeConnectionStatus, FrontendTool, FrontendToolRenderFunction, Interrupt, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, Message, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, RenderToolCompleteProps, RenderToolExecutingProps, RenderToolInProgressProps, RenderToolProps, ResumeEntry, ResumeStatus, Suggestion, Thread, ToolCall, ToolCallStatus, ToolMessage, UseAgentUpdate, UseInterruptConfig, UseThreadsInput, UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotKit, useFrontendTool, useHumanInTheLoop, useInterrupt, useLicenseContext, useRenderTool, useRenderToolCall, useSuggestions, useThreads } from "./headless.mjs";
4
4
  import React, { ReactNode } from "react";
5
+ import { CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1 } from "@copilotkit/core";
5
6
  import { Attachment, AttachmentUploadErrorReason, AttachmentUploadResult } from "@copilotkit/shared";
6
7
  import * as react_jsx_runtime0 from "react/jsx-runtime";
7
- import { CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1 } from "@copilotkit/core";
8
8
  import { ViewStyle } from "react-native";
9
9
 
10
10
  //#region src/hooks/use-attachments.d.ts
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./utf8-BIN9t4Oy.mjs";
2
2
  import { r as useMarkdownRenderer, t as MarkdownRendererProvider } from "./MarkdownRendererContext-B_AKdPAN.mjs";
3
- import { t as CopilotKitProvider } from "./CopilotKitProvider-DlP73sLt.mjs";
3
+ import { t as CopilotKitProvider } from "./CopilotKitProvider-BXpkAl1Y.mjs";
4
4
  import { AbstractAgent, CopilotChatDefaultLabels, CopilotKitContext, CopilotKitCoreErrorCode, CopilotKitCoreRuntimeConnectionStatus, ToolCallStatus, UseAgentUpdate, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotKit, useFrontendTool, useHumanInTheLoop, useInterrupt, useLicenseContext, useRenderTool, useRenderToolCall, useSuggestions, useThreads } from "./headless.mjs";
5
5
  import { n as defaultMarkdownStyles, t as CopilotMarkdown } from "./Markdown-SE9MfY2U.mjs";
6
6
  import React, { createContext, forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useRef, useState } from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/react-native",
3
- "version": "2.0.0-rc.20",
3
+ "version": "2.0.0-rc.21",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "ai",
@@ -77,10 +77,10 @@
77
77
  },
78
78
  "dependencies": {
79
79
  "@ag-ui/client": "1.0.2",
80
- "@copilotkit/core": "2.0.0-rc.20",
81
- "@copilotkit/markdown": "2.0.0-rc.20",
82
- "@copilotkit/react-core": "2.0.0-rc.20",
83
- "@copilotkit/shared": "2.0.0-rc.20",
80
+ "@copilotkit/core": "2.0.0-rc.21",
81
+ "@copilotkit/markdown": "2.0.0-rc.21",
82
+ "@copilotkit/react-core": "2.0.0-rc.21",
83
+ "@copilotkit/shared": "2.0.0-rc.21",
84
84
  "web-streams-polyfill": "^4.2.0"
85
85
  },
86
86
  "devDependencies": {