@copilotkit/react-native 1.57.1 → 1.57.3
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.
- package/README.md +11 -1
- package/dist/index.cjs +752 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +394 -6
- package/dist/index.d.mts +394 -6
- package/dist/index.mjs +725 -14
- package/dist/index.mjs.map +1 -1
- package/dist/polyfills.cjs +86 -73
- package/dist/polyfills.cjs.map +1 -1
- package/dist/polyfills.mjs +86 -73
- package/dist/polyfills.mjs.map +1 -1
- package/package.json +21 -5
- package/src/CopilotChat.tsx +293 -0
- package/src/CopilotKitProvider.tsx +55 -13
- package/src/CopilotModal.tsx +32 -0
- package/src/CopilotPopup.tsx +359 -0
- package/src/CopilotSidebar.tsx +357 -0
- package/src/__tests__/__mocks__/expo-document-picker.ts +13 -0
- package/src/__tests__/__mocks__/expo-file-system.ts +12 -0
- package/src/__tests__/attachments-integration.test.tsx +336 -0
- package/src/__tests__/copilot-chat-agentid.test.tsx +305 -0
- package/src/__tests__/copilot-chat-attachments.test.tsx +259 -0
- package/src/__tests__/copilot-popup.test.tsx +558 -0
- package/src/__tests__/copilot-sidebar.test.tsx +500 -0
- package/src/__tests__/copilotkit-provider.test.tsx +3 -0
- package/src/__tests__/headless-integration.test.tsx +55 -1
- package/src/__tests__/streaming-fetch.test.ts +84 -44
- package/src/__tests__/use-attachments.test.ts +410 -0
- package/src/hooks/use-attachments.ts +274 -0
- package/src/index.ts +77 -3
- package/src/polyfills.ts +3 -2
- package/src/streaming-fetch.ts +135 -104
- package/tsdown.config.ts +1 -0
- package/vitest.config.mjs +19 -0
package/dist/index.cjs
CHANGED
|
@@ -26,11 +26,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
}) : target, mod));
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
|
+
require('./polyfills.cjs');
|
|
29
30
|
let react = require("react");
|
|
30
31
|
react = __toESM(react);
|
|
31
32
|
let _copilotkit_react_core_v2_context = require("@copilotkit/react-core/v2/context");
|
|
32
33
|
let _copilotkit_react_core_v2_headless = require("@copilotkit/react-core/v2/headless");
|
|
33
34
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
let _copilotkit_shared = require("@copilotkit/shared");
|
|
36
|
+
let expo_document_picker = require("expo-document-picker");
|
|
37
|
+
expo_document_picker = __toESM(expo_document_picker);
|
|
38
|
+
let expo_file_system = require("expo-file-system");
|
|
39
|
+
expo_file_system = __toESM(expo_file_system);
|
|
40
|
+
let react_native = require("react-native");
|
|
34
41
|
|
|
35
42
|
//#region src/CopilotKitProvider.tsx
|
|
36
43
|
/**
|
|
@@ -39,9 +46,12 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
39
46
|
* A lightweight alternative to the web CopilotKitProvider that avoids
|
|
40
47
|
* web-only dependencies (DOM, CSS, Radix UI, Lit, etc).
|
|
41
48
|
*
|
|
49
|
+
* Polyfills are auto-imported when `@copilotkit/react-native` is loaded,
|
|
50
|
+
* so a separate `import "@copilotkit/react-native/polyfills"` is no longer
|
|
51
|
+
* required (though it remains available for advanced use).
|
|
52
|
+
*
|
|
42
53
|
* Usage:
|
|
43
54
|
* ```tsx
|
|
44
|
-
* import "@copilotkit/react-native/polyfills";
|
|
45
55
|
* import { CopilotKitProvider } from "@copilotkit/react-native";
|
|
46
56
|
*
|
|
47
57
|
* function App() {
|
|
@@ -53,29 +63,42 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
53
63
|
* }
|
|
54
64
|
* ```
|
|
55
65
|
*/
|
|
56
|
-
const CopilotKitProvider = ({ children, runtimeUrl, headers, useSingleEndpoint, properties, onError }) => {
|
|
57
|
-
const
|
|
66
|
+
const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp, credentials, useSingleEndpoint, properties, onError, debug, defaultThrottleMs }) => {
|
|
67
|
+
const resolvedHeaders = typeof headersProp === "function" ? headersProp() : headersProp;
|
|
68
|
+
const stableHeaders = (0, react.useMemo)(() => resolvedHeaders ?? {}, [JSON.stringify(resolvedHeaders)]);
|
|
58
69
|
const stableProperties = (0, react.useMemo)(() => properties ?? {}, [JSON.stringify(properties)]);
|
|
59
70
|
const copilotkitRef = (0, react.useRef)(null);
|
|
60
|
-
if (copilotkitRef.current === null)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
if (copilotkitRef.current === null) {
|
|
72
|
+
copilotkitRef.current = new _copilotkit_react_core_v2_headless.CopilotKitCoreReact({
|
|
73
|
+
runtimeUrl,
|
|
74
|
+
runtimeTransport: useSingleEndpoint === true ? "single" : useSingleEndpoint === false ? "rest" : "auto",
|
|
75
|
+
headers: stableHeaders,
|
|
76
|
+
credentials,
|
|
77
|
+
properties: stableProperties,
|
|
78
|
+
debug
|
|
79
|
+
});
|
|
80
|
+
if (defaultThrottleMs !== void 0) copilotkitRef.current.setDefaultThrottleMs(defaultThrottleMs);
|
|
81
|
+
}
|
|
66
82
|
const copilotkit = copilotkitRef.current;
|
|
67
83
|
(0, react.useEffect)(() => {
|
|
68
84
|
copilotkit.setRuntimeUrl(runtimeUrl);
|
|
69
85
|
copilotkit.setRuntimeTransport(useSingleEndpoint === true ? "single" : useSingleEndpoint === false ? "rest" : "auto");
|
|
70
86
|
copilotkit.setHeaders(stableHeaders);
|
|
87
|
+
copilotkit.setCredentials(credentials);
|
|
71
88
|
copilotkit.setProperties(stableProperties);
|
|
89
|
+
copilotkit.setDebug(debug);
|
|
72
90
|
}, [
|
|
73
91
|
runtimeUrl,
|
|
74
92
|
useSingleEndpoint,
|
|
75
93
|
stableHeaders,
|
|
94
|
+
credentials,
|
|
76
95
|
stableProperties,
|
|
96
|
+
debug,
|
|
77
97
|
copilotkit
|
|
78
98
|
]);
|
|
99
|
+
(0, react.useEffect)(() => {
|
|
100
|
+
copilotkit.setDefaultThrottleMs(defaultThrottleMs);
|
|
101
|
+
}, [copilotkit, defaultThrottleMs]);
|
|
79
102
|
const [executingToolCallIds, setExecutingToolCallIds] = (0, react.useState)(() => /* @__PURE__ */ new Set());
|
|
80
103
|
const onErrorRef = (0, react.useRef)(onError);
|
|
81
104
|
(0, react.useEffect)(() => {
|
|
@@ -126,6 +149,703 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers, useSingleEndpoint,
|
|
|
126
149
|
};
|
|
127
150
|
|
|
128
151
|
//#endregion
|
|
152
|
+
//#region src/hooks/use-attachments.ts
|
|
153
|
+
const DEFAULT_MAX_SIZE = 20 * 1024 * 1024;
|
|
154
|
+
/**
|
|
155
|
+
* React Native hook that manages file attachment state -- picking, uploading,
|
|
156
|
+
* and lifecycle. All returned callbacks are referentially stable via useCallback.
|
|
157
|
+
*
|
|
158
|
+
* This is the RN counterpart of the web `useAttachments` hook from
|
|
159
|
+
* `@copilotkit/react-core`. It replaces web APIs (FileReader, DragEvent,
|
|
160
|
+
* HTMLInputElement) with Expo modules (expo-document-picker, expo-file-system).
|
|
161
|
+
*/
|
|
162
|
+
function useAttachments({ config }) {
|
|
163
|
+
const enabled = config?.enabled ?? false;
|
|
164
|
+
const [attachments, setAttachments] = (0, react.useState)([]);
|
|
165
|
+
const configRef = (0, react.useRef)(config);
|
|
166
|
+
configRef.current = config;
|
|
167
|
+
const attachmentsRef = (0, react.useRef)([]);
|
|
168
|
+
attachmentsRef.current = attachments;
|
|
169
|
+
/**
|
|
170
|
+
* Simple MIME accept filter for NativeFileInput.
|
|
171
|
+
* Handles wildcards like "image/*" and exact types like "application/pdf".
|
|
172
|
+
* Comma-separated lists are supported.
|
|
173
|
+
*/
|
|
174
|
+
const matchesAccept = (0, react.useCallback)((file, accept) => {
|
|
175
|
+
if (!accept || accept === "*/*") return true;
|
|
176
|
+
return accept.split(",").map((f) => f.trim()).some((filter) => {
|
|
177
|
+
if (filter.startsWith(".")) return file.name.toLowerCase().endsWith(filter.toLowerCase());
|
|
178
|
+
if (filter.endsWith("/*")) {
|
|
179
|
+
const prefix = filter.slice(0, -2);
|
|
180
|
+
return file.mimeType.startsWith(prefix + "/");
|
|
181
|
+
}
|
|
182
|
+
return file.mimeType === filter;
|
|
183
|
+
});
|
|
184
|
+
}, []);
|
|
185
|
+
const processFiles = (0, react.useCallback)(async (files) => {
|
|
186
|
+
const cfg = configRef.current;
|
|
187
|
+
const accept = cfg?.accept ?? "*/*";
|
|
188
|
+
const maxSize = cfg?.maxSize ?? DEFAULT_MAX_SIZE;
|
|
189
|
+
const rejectedFiles = files.filter((f) => !matchesAccept(f, accept));
|
|
190
|
+
for (const file of rejectedFiles) cfg?.onUploadFailed?.({
|
|
191
|
+
reason: "invalid-type",
|
|
192
|
+
file,
|
|
193
|
+
message: `File "${file.name}" is not accepted. Supported types: ${accept}`
|
|
194
|
+
});
|
|
195
|
+
const validFiles = files.filter((f) => matchesAccept(f, accept));
|
|
196
|
+
for (const file of validFiles) {
|
|
197
|
+
if (file.size > maxSize) {
|
|
198
|
+
cfg?.onUploadFailed?.({
|
|
199
|
+
reason: "file-too-large",
|
|
200
|
+
file,
|
|
201
|
+
message: `File "${file.name}" exceeds the maximum size of ${(0, _copilotkit_shared.formatFileSize)(maxSize)}`
|
|
202
|
+
});
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
const modality = (0, _copilotkit_shared.getModalityFromMimeType)(file.mimeType);
|
|
206
|
+
const placeholderId = (0, _copilotkit_shared.randomUUID)();
|
|
207
|
+
const placeholder = {
|
|
208
|
+
id: placeholderId,
|
|
209
|
+
type: modality,
|
|
210
|
+
source: {
|
|
211
|
+
type: "data",
|
|
212
|
+
value: "",
|
|
213
|
+
mimeType: file.mimeType
|
|
214
|
+
},
|
|
215
|
+
filename: file.name,
|
|
216
|
+
size: file.size,
|
|
217
|
+
status: "uploading"
|
|
218
|
+
};
|
|
219
|
+
setAttachments((prev) => [...prev, placeholder]);
|
|
220
|
+
try {
|
|
221
|
+
let source;
|
|
222
|
+
let uploadMetadata;
|
|
223
|
+
if (cfg?.onUpload) {
|
|
224
|
+
const { metadata: meta, ...uploadSource } = await cfg.onUpload(file);
|
|
225
|
+
source = uploadSource;
|
|
226
|
+
uploadMetadata = meta;
|
|
227
|
+
} else source = {
|
|
228
|
+
type: "data",
|
|
229
|
+
value: await expo_file_system.readAsStringAsync(file.uri, { encoding: expo_file_system.EncodingType.Base64 }),
|
|
230
|
+
mimeType: file.mimeType
|
|
231
|
+
};
|
|
232
|
+
setAttachments((prev) => prev.map((att) => att.id === placeholderId ? {
|
|
233
|
+
...att,
|
|
234
|
+
source,
|
|
235
|
+
status: "ready",
|
|
236
|
+
metadata: uploadMetadata
|
|
237
|
+
} : att));
|
|
238
|
+
} catch (error) {
|
|
239
|
+
setAttachments((prev) => prev.filter((att) => att.id !== placeholderId));
|
|
240
|
+
console.error(`[CopilotKit] Failed to upload "${file.name}":`, error);
|
|
241
|
+
cfg?.onUploadFailed?.({
|
|
242
|
+
reason: "upload-failed",
|
|
243
|
+
file,
|
|
244
|
+
message: error instanceof Error ? error.message : `Failed to upload "${file.name}"`
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}, [matchesAccept]);
|
|
249
|
+
return {
|
|
250
|
+
attachments,
|
|
251
|
+
enabled,
|
|
252
|
+
openPicker: (0, react.useCallback)(async () => {
|
|
253
|
+
const typeArray = (configRef.current?.accept ?? "*/*").split(",").map((t) => t.trim()).filter(Boolean);
|
|
254
|
+
try {
|
|
255
|
+
const result = await expo_document_picker.getDocumentAsync({
|
|
256
|
+
type: typeArray.length > 0 ? typeArray : ["*/*"],
|
|
257
|
+
copyToCacheDirectory: true,
|
|
258
|
+
multiple: true
|
|
259
|
+
});
|
|
260
|
+
if (result.canceled || !result.assets?.length) return;
|
|
261
|
+
await processFiles(result.assets.map((asset) => ({
|
|
262
|
+
uri: asset.uri,
|
|
263
|
+
name: asset.name ?? "unknown",
|
|
264
|
+
size: asset.size ?? 0,
|
|
265
|
+
mimeType: asset.mimeType ?? "application/octet-stream"
|
|
266
|
+
})));
|
|
267
|
+
} catch (error) {
|
|
268
|
+
console.error("[CopilotKit] Document picker error:", error);
|
|
269
|
+
}
|
|
270
|
+
}, [processFiles]),
|
|
271
|
+
processFiles,
|
|
272
|
+
removeAttachment: (0, react.useCallback)((id) => {
|
|
273
|
+
setAttachments((prev) => prev.filter((a) => a.id !== id));
|
|
274
|
+
}, []),
|
|
275
|
+
consumeAttachments: (0, react.useCallback)(() => {
|
|
276
|
+
const ready = attachmentsRef.current.filter((a) => a.status === "ready");
|
|
277
|
+
if (ready.length === 0) return ready;
|
|
278
|
+
setAttachments((prev) => prev.filter((a) => a.status !== "ready"));
|
|
279
|
+
return ready;
|
|
280
|
+
}, [])
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/CopilotChat.tsx
|
|
286
|
+
const CopilotChatCtx = (0, react.createContext)(null);
|
|
287
|
+
/**
|
|
288
|
+
* Hook to access the CopilotChat context from child components.
|
|
289
|
+
* Must be called inside a `<CopilotChat>` component tree.
|
|
290
|
+
*/
|
|
291
|
+
function useCopilotChatContext() {
|
|
292
|
+
const ctx = (0, react.useContext)(CopilotChatCtx);
|
|
293
|
+
if (!ctx) throw new Error("useCopilotChatContext must be used within a <CopilotChat> component");
|
|
294
|
+
return ctx;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Headless CopilotChat component for React Native.
|
|
298
|
+
*
|
|
299
|
+
* Wires up the `useAgent` hook with `agentId` resolution and renders children.
|
|
300
|
+
* Unlike the web SDK's CopilotChat, this component does not render any UI
|
|
301
|
+
* elements -- consumers provide their own React Native views.
|
|
302
|
+
*
|
|
303
|
+
* Children can access chat state via `useCopilotChatContext()`.
|
|
304
|
+
*
|
|
305
|
+
* ```tsx
|
|
306
|
+
* import { CopilotChat, useCopilotChatContext } from "@copilotkit/react-native";
|
|
307
|
+
*
|
|
308
|
+
* function MyChatUI() {
|
|
309
|
+
* const { messages, submitMessage, attachments, openPicker } = useCopilotChatContext();
|
|
310
|
+
* // ... render your UI
|
|
311
|
+
* }
|
|
312
|
+
*
|
|
313
|
+
* <CopilotChat agentId="my-agent" attachments={{ enabled: true }}>
|
|
314
|
+
* <MyChatUI />
|
|
315
|
+
* </CopilotChat>
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
function CopilotChat({ agentId, agentName, threadId, onError, throttleMs, attachments: attachmentsConfig, children, ..._rest }) {
|
|
319
|
+
const resolvedAgentId = agentId ?? agentName ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
320
|
+
const warnedRef = (0, react.useRef)(false);
|
|
321
|
+
(0, react.useEffect)(() => {
|
|
322
|
+
if (agentName !== void 0 && agentId === void 0 && !warnedRef.current) {
|
|
323
|
+
warnedRef.current = true;
|
|
324
|
+
if (typeof __DEV__ === "undefined" || __DEV__) console.warn("[CopilotKit] agentName is deprecated, use agentId instead");
|
|
325
|
+
}
|
|
326
|
+
}, [agentName, agentId]);
|
|
327
|
+
const { agent } = (0, _copilotkit_react_core_v2_headless.useAgent)({
|
|
328
|
+
agentId: resolvedAgentId,
|
|
329
|
+
throttleMs
|
|
330
|
+
});
|
|
331
|
+
(0, react.useEffect)(() => {
|
|
332
|
+
if (threadId) agent.threadId = threadId;
|
|
333
|
+
}, [agent, threadId]);
|
|
334
|
+
const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
|
|
335
|
+
const onErrorRef = (0, react.useRef)(onError);
|
|
336
|
+
(0, react.useEffect)(() => {
|
|
337
|
+
onErrorRef.current = onError;
|
|
338
|
+
}, [onError]);
|
|
339
|
+
(0, react.useEffect)(() => {
|
|
340
|
+
if (!onErrorRef.current) return;
|
|
341
|
+
const subscription = copilotkit.subscribe({ onError: (event) => {
|
|
342
|
+
if (event.context?.agentId === resolvedAgentId || !event.context?.agentId) onErrorRef.current?.({
|
|
343
|
+
error: event.error,
|
|
344
|
+
code: event.code,
|
|
345
|
+
context: event.context
|
|
346
|
+
});
|
|
347
|
+
} });
|
|
348
|
+
return () => {
|
|
349
|
+
subscription.unsubscribe();
|
|
350
|
+
};
|
|
351
|
+
}, [copilotkit, resolvedAgentId]);
|
|
352
|
+
const { attachments: selectedAttachments, enabled: attachmentsEnabled, openPicker, removeAttachment, consumeAttachments } = useAttachments({ config: attachmentsConfig });
|
|
353
|
+
const submitMessage = (0, react.useCallback)(async (value) => {
|
|
354
|
+
if (selectedAttachments.some((a) => a.status === "uploading")) {
|
|
355
|
+
console.error("[CopilotKit] Cannot send while attachments are uploading");
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
const readyAttachments = consumeAttachments();
|
|
359
|
+
if (readyAttachments.length > 0) {
|
|
360
|
+
const contentParts = [];
|
|
361
|
+
if (value.trim()) contentParts.push({
|
|
362
|
+
type: "text",
|
|
363
|
+
text: value
|
|
364
|
+
});
|
|
365
|
+
for (const att of readyAttachments) contentParts.push({
|
|
366
|
+
type: att.type,
|
|
367
|
+
source: att.source,
|
|
368
|
+
metadata: {
|
|
369
|
+
...att.filename ? { filename: att.filename } : {},
|
|
370
|
+
...att.metadata
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
agent.addMessage({
|
|
374
|
+
id: (0, _copilotkit_shared.randomUUID)(),
|
|
375
|
+
role: "user",
|
|
376
|
+
content: contentParts
|
|
377
|
+
});
|
|
378
|
+
} else agent.addMessage({
|
|
379
|
+
id: (0, _copilotkit_shared.randomUUID)(),
|
|
380
|
+
role: "user",
|
|
381
|
+
content: value
|
|
382
|
+
});
|
|
383
|
+
try {
|
|
384
|
+
await copilotkit.runAgent({ agent });
|
|
385
|
+
} catch (error) {
|
|
386
|
+
console.error("CopilotChat: runAgent failed", error);
|
|
387
|
+
}
|
|
388
|
+
}, [
|
|
389
|
+
agent,
|
|
390
|
+
selectedAttachments,
|
|
391
|
+
consumeAttachments
|
|
392
|
+
]);
|
|
393
|
+
const contextValue = {
|
|
394
|
+
agent,
|
|
395
|
+
isRunning: agent.isRunning,
|
|
396
|
+
messages: agent.messages,
|
|
397
|
+
attachments: selectedAttachments,
|
|
398
|
+
attachmentsEnabled,
|
|
399
|
+
openPicker,
|
|
400
|
+
removeAttachment,
|
|
401
|
+
submitMessage
|
|
402
|
+
};
|
|
403
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatCtx.Provider, {
|
|
404
|
+
value: contextValue,
|
|
405
|
+
children
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region src/CopilotModal.tsx
|
|
411
|
+
/**
|
|
412
|
+
* Headless CopilotModal component for React Native.
|
|
413
|
+
*
|
|
414
|
+
* A thin wrapper around CopilotChat that mirrors the web SDK's CopilotModal
|
|
415
|
+
* API surface. On React Native, modal presentation is handled by the consumer
|
|
416
|
+
* (e.g. React Native's `Modal` component) -- this component only provides
|
|
417
|
+
* the agent wiring and prop resolution.
|
|
418
|
+
*
|
|
419
|
+
* ```tsx
|
|
420
|
+
* import { CopilotModal } from "@copilotkit/react-native";
|
|
421
|
+
* import { Modal } from "react-native";
|
|
422
|
+
*
|
|
423
|
+
* <Modal visible={isOpen}>
|
|
424
|
+
* <CopilotModal agentId="my-agent">
|
|
425
|
+
* <MyChatUI />
|
|
426
|
+
* </CopilotModal>
|
|
427
|
+
* </Modal>
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
function CopilotModal({ children, ...props }) {
|
|
431
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChat, {
|
|
432
|
+
...props,
|
|
433
|
+
children
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region src/CopilotSidebar.tsx
|
|
439
|
+
const ANIMATION_DURATION_MS = 300;
|
|
440
|
+
const DEFAULT_HEADER_TITLE = "Copilot";
|
|
441
|
+
const BACKDROP_OPACITY = .4;
|
|
442
|
+
const FAB_SIZE = 56;
|
|
443
|
+
/**
|
|
444
|
+
* CopilotSidebar -- a slide-in drawer from the right edge of the screen
|
|
445
|
+
* that wraps CopilotChat for React Native.
|
|
446
|
+
*
|
|
447
|
+
* ```tsx
|
|
448
|
+
* import { CopilotSidebar } from "@copilotkit/react-native";
|
|
449
|
+
*
|
|
450
|
+
* const ref = useRef<CopilotSidebarHandle>(null);
|
|
451
|
+
*
|
|
452
|
+
* <CopilotSidebar
|
|
453
|
+
* ref={ref}
|
|
454
|
+
* agentId="my-agent"
|
|
455
|
+
* headerTitle="Assistant"
|
|
456
|
+
* defaultOpen={false}
|
|
457
|
+
* />
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
const CopilotSidebar = (0, react.forwardRef)(function CopilotSidebar({ agentId, agentName, threadId, onError, throttleMs, defaultOpen = false, width: widthProp, headerTitle = DEFAULT_HEADER_TITLE, showToggleButton = true, onOpen, onClose, style, children, ...rest }, ref) {
|
|
461
|
+
const { width: screenWidth } = (0, react_native.useWindowDimensions)();
|
|
462
|
+
const drawerWidth = resolveWidth(widthProp, screenWidth);
|
|
463
|
+
const [isOpen, setIsOpen] = (0, react.useState)(defaultOpen);
|
|
464
|
+
const slideAnim = (0, react.useRef)(new react_native.Animated.Value(defaultOpen ? 0 : drawerWidth)).current;
|
|
465
|
+
(0, react.useEffect)(() => {
|
|
466
|
+
if (!isOpen) slideAnim.setValue(drawerWidth);
|
|
467
|
+
}, [
|
|
468
|
+
drawerWidth,
|
|
469
|
+
isOpen,
|
|
470
|
+
slideAnim
|
|
471
|
+
]);
|
|
472
|
+
const animateTo = (0, react.useCallback)((toValue, cb) => {
|
|
473
|
+
react_native.Animated.timing(slideAnim, {
|
|
474
|
+
toValue,
|
|
475
|
+
duration: ANIMATION_DURATION_MS,
|
|
476
|
+
useNativeDriver: true
|
|
477
|
+
}).start(({ finished }) => {
|
|
478
|
+
if (finished) cb?.();
|
|
479
|
+
});
|
|
480
|
+
}, [slideAnim]);
|
|
481
|
+
const open = (0, react.useCallback)(() => {
|
|
482
|
+
setIsOpen(true);
|
|
483
|
+
animateTo(0, onOpen);
|
|
484
|
+
}, [animateTo, onOpen]);
|
|
485
|
+
const close = (0, react.useCallback)(() => {
|
|
486
|
+
animateTo(drawerWidth, () => {
|
|
487
|
+
setIsOpen(false);
|
|
488
|
+
onClose?.();
|
|
489
|
+
});
|
|
490
|
+
}, [
|
|
491
|
+
animateTo,
|
|
492
|
+
drawerWidth,
|
|
493
|
+
onClose
|
|
494
|
+
]);
|
|
495
|
+
const toggle = (0, react.useCallback)(() => {
|
|
496
|
+
if (isOpen) close();
|
|
497
|
+
else open();
|
|
498
|
+
}, [
|
|
499
|
+
isOpen,
|
|
500
|
+
open,
|
|
501
|
+
close
|
|
502
|
+
]);
|
|
503
|
+
(0, react.useImperativeHandle)(ref, () => ({
|
|
504
|
+
open,
|
|
505
|
+
close,
|
|
506
|
+
toggle
|
|
507
|
+
}), [
|
|
508
|
+
open,
|
|
509
|
+
close,
|
|
510
|
+
toggle
|
|
511
|
+
]);
|
|
512
|
+
const onOpenRef = (0, react.useRef)(onOpen);
|
|
513
|
+
const onCloseRef = (0, react.useRef)(onClose);
|
|
514
|
+
(0, react.useEffect)(() => {
|
|
515
|
+
onOpenRef.current = onOpen;
|
|
516
|
+
}, [onOpen]);
|
|
517
|
+
(0, react.useEffect)(() => {
|
|
518
|
+
onCloseRef.current = onClose;
|
|
519
|
+
}, [onClose]);
|
|
520
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
521
|
+
isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
522
|
+
style: styles$1.backdrop,
|
|
523
|
+
onPress: close,
|
|
524
|
+
accessibilityRole: "button",
|
|
525
|
+
accessibilityLabel: "Close sidebar",
|
|
526
|
+
testID: "copilot-sidebar-backdrop"
|
|
527
|
+
}),
|
|
528
|
+
isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.Animated.View, {
|
|
529
|
+
style: [
|
|
530
|
+
styles$1.drawer,
|
|
531
|
+
{
|
|
532
|
+
width: drawerWidth,
|
|
533
|
+
transform: [{ translateX: slideAnim }]
|
|
534
|
+
},
|
|
535
|
+
style
|
|
536
|
+
],
|
|
537
|
+
testID: "copilot-sidebar-drawer",
|
|
538
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
539
|
+
style: styles$1.header,
|
|
540
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
541
|
+
style: styles$1.headerTitle,
|
|
542
|
+
children: headerTitle
|
|
543
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
544
|
+
onPress: close,
|
|
545
|
+
accessibilityRole: "button",
|
|
546
|
+
accessibilityLabel: "Close",
|
|
547
|
+
hitSlop: 8,
|
|
548
|
+
testID: "copilot-sidebar-close",
|
|
549
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
550
|
+
style: styles$1.closeButton,
|
|
551
|
+
children: "✕"
|
|
552
|
+
})
|
|
553
|
+
})]
|
|
554
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
555
|
+
style: styles$1.chatContainer,
|
|
556
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChat, {
|
|
557
|
+
agentId,
|
|
558
|
+
agentName,
|
|
559
|
+
threadId,
|
|
560
|
+
onError,
|
|
561
|
+
throttleMs,
|
|
562
|
+
...rest,
|
|
563
|
+
children
|
|
564
|
+
})
|
|
565
|
+
})]
|
|
566
|
+
}),
|
|
567
|
+
showToggleButton && !isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
568
|
+
style: styles$1.fab,
|
|
569
|
+
onPress: open,
|
|
570
|
+
accessibilityRole: "button",
|
|
571
|
+
accessibilityLabel: "Open sidebar",
|
|
572
|
+
testID: "copilot-sidebar-fab",
|
|
573
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
574
|
+
style: styles$1.fabIcon,
|
|
575
|
+
children: "💬"
|
|
576
|
+
})
|
|
577
|
+
})
|
|
578
|
+
] });
|
|
579
|
+
});
|
|
580
|
+
function resolveWidth(widthProp, screenWidth) {
|
|
581
|
+
if (widthProp === void 0) return Math.round(screenWidth * .85);
|
|
582
|
+
if (typeof widthProp === "number") return widthProp;
|
|
583
|
+
const pctMatch = String(widthProp).match(/^(\d+(?:\.\d+)?)%$/);
|
|
584
|
+
if (pctMatch) return Math.round(screenWidth * (parseFloat(pctMatch[1]) / 100));
|
|
585
|
+
const parsed = parseFloat(widthProp);
|
|
586
|
+
return isNaN(parsed) ? Math.round(screenWidth * .85) : parsed;
|
|
587
|
+
}
|
|
588
|
+
const styles$1 = react_native.StyleSheet.create({
|
|
589
|
+
backdrop: {
|
|
590
|
+
...react_native.StyleSheet.absoluteFillObject,
|
|
591
|
+
backgroundColor: `rgba(0, 0, 0, ${BACKDROP_OPACITY})`,
|
|
592
|
+
zIndex: 999
|
|
593
|
+
},
|
|
594
|
+
drawer: {
|
|
595
|
+
position: "absolute",
|
|
596
|
+
top: 0,
|
|
597
|
+
right: 0,
|
|
598
|
+
bottom: 0,
|
|
599
|
+
backgroundColor: "#ffffff",
|
|
600
|
+
zIndex: 1e3,
|
|
601
|
+
shadowColor: "#000",
|
|
602
|
+
shadowOffset: {
|
|
603
|
+
width: -2,
|
|
604
|
+
height: 0
|
|
605
|
+
},
|
|
606
|
+
shadowOpacity: .25,
|
|
607
|
+
shadowRadius: 8,
|
|
608
|
+
elevation: 16
|
|
609
|
+
},
|
|
610
|
+
header: {
|
|
611
|
+
flexDirection: "row",
|
|
612
|
+
alignItems: "center",
|
|
613
|
+
justifyContent: "space-between",
|
|
614
|
+
paddingHorizontal: 16,
|
|
615
|
+
paddingVertical: 12,
|
|
616
|
+
borderBottomWidth: react_native.StyleSheet.hairlineWidth,
|
|
617
|
+
borderBottomColor: "#e0e0e0"
|
|
618
|
+
},
|
|
619
|
+
headerTitle: {
|
|
620
|
+
fontSize: 18,
|
|
621
|
+
fontWeight: "600",
|
|
622
|
+
color: "#1a1a1a"
|
|
623
|
+
},
|
|
624
|
+
closeButton: {
|
|
625
|
+
fontSize: 20,
|
|
626
|
+
color: "#666",
|
|
627
|
+
padding: 4
|
|
628
|
+
},
|
|
629
|
+
chatContainer: { flex: 1 },
|
|
630
|
+
fab: {
|
|
631
|
+
position: "absolute",
|
|
632
|
+
bottom: 24,
|
|
633
|
+
right: 24,
|
|
634
|
+
width: FAB_SIZE,
|
|
635
|
+
height: FAB_SIZE,
|
|
636
|
+
borderRadius: FAB_SIZE / 2,
|
|
637
|
+
backgroundColor: "#007AFF",
|
|
638
|
+
alignItems: "center",
|
|
639
|
+
justifyContent: "center",
|
|
640
|
+
shadowColor: "#000",
|
|
641
|
+
shadowOffset: {
|
|
642
|
+
width: 0,
|
|
643
|
+
height: 2
|
|
644
|
+
},
|
|
645
|
+
shadowOpacity: .3,
|
|
646
|
+
shadowRadius: 4,
|
|
647
|
+
elevation: 8,
|
|
648
|
+
zIndex: 998
|
|
649
|
+
},
|
|
650
|
+
fabIcon: { fontSize: 24 }
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region src/CopilotPopup.tsx
|
|
655
|
+
/**
|
|
656
|
+
* CopilotPopup for React Native.
|
|
657
|
+
*
|
|
658
|
+
* A floating action button (FAB) that opens a modal chat overlay.
|
|
659
|
+
* The popup appears as a card floating above content with rounded corners,
|
|
660
|
+
* a shadow, and a semi-transparent backdrop.
|
|
661
|
+
*
|
|
662
|
+
* ```tsx
|
|
663
|
+
* import { CopilotPopup } from "@copilotkit/react-native";
|
|
664
|
+
*
|
|
665
|
+
* const popupRef = useRef<CopilotPopupHandle>(null);
|
|
666
|
+
*
|
|
667
|
+
* <CopilotPopup
|
|
668
|
+
* ref={popupRef}
|
|
669
|
+
* agentId="my-agent"
|
|
670
|
+
* headerTitle="Chat"
|
|
671
|
+
* defaultOpen={false}
|
|
672
|
+
* />
|
|
673
|
+
* ```
|
|
674
|
+
*/
|
|
675
|
+
const CopilotPopup = (0, react.forwardRef)(function CopilotPopup({ agentId, agentName, threadId, throttleMs, defaultOpen = false, height = "60%", onError, headerTitle = "CopilotKit", attachments: attachmentsConfig, children, onOpen, onClose, dismissOnBackdropPress = true, showToggleButton = true, style }, ref) {
|
|
676
|
+
const [visible, setVisible] = (0, react.useState)(defaultOpen);
|
|
677
|
+
const { height: screenHeight } = (0, react_native.useWindowDimensions)();
|
|
678
|
+
const onOpenRef = (0, react.useRef)(onOpen);
|
|
679
|
+
const onCloseRef = (0, react.useRef)(onClose);
|
|
680
|
+
(0, react.useEffect)(() => {
|
|
681
|
+
onOpenRef.current = onOpen;
|
|
682
|
+
}, [onOpen]);
|
|
683
|
+
(0, react.useEffect)(() => {
|
|
684
|
+
onCloseRef.current = onClose;
|
|
685
|
+
}, [onClose]);
|
|
686
|
+
const handleOpen = (0, react.useCallback)(() => {
|
|
687
|
+
setVisible(true);
|
|
688
|
+
onOpenRef.current?.();
|
|
689
|
+
}, []);
|
|
690
|
+
const handleClose = (0, react.useCallback)(() => {
|
|
691
|
+
setVisible(false);
|
|
692
|
+
onCloseRef.current?.();
|
|
693
|
+
}, []);
|
|
694
|
+
const handleToggle = (0, react.useCallback)(() => {
|
|
695
|
+
setVisible((prev) => {
|
|
696
|
+
const next = !prev;
|
|
697
|
+
if (next) onOpenRef.current?.();
|
|
698
|
+
else onCloseRef.current?.();
|
|
699
|
+
return next;
|
|
700
|
+
});
|
|
701
|
+
}, []);
|
|
702
|
+
(0, react.useImperativeHandle)(ref, () => ({
|
|
703
|
+
open: handleOpen,
|
|
704
|
+
close: handleClose,
|
|
705
|
+
toggle: handleToggle
|
|
706
|
+
}), [
|
|
707
|
+
handleOpen,
|
|
708
|
+
handleClose,
|
|
709
|
+
handleToggle
|
|
710
|
+
]);
|
|
711
|
+
const resolvedHeight = typeof height === "string" && height.endsWith("%") ? parseFloat(height) / 100 * screenHeight : typeof height === "number" ? height : .6 * screenHeight;
|
|
712
|
+
const chatOnError = onError ? (event) => onError(event.error) : void 0;
|
|
713
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [showToggleButton && !visible && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.TouchableOpacity, {
|
|
714
|
+
testID: "copilot-popup-fab",
|
|
715
|
+
style: styles.fab,
|
|
716
|
+
onPress: handleToggle,
|
|
717
|
+
activeOpacity: .8,
|
|
718
|
+
accessibilityLabel: "Open chat",
|
|
719
|
+
accessibilityRole: "button",
|
|
720
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
721
|
+
style: styles.fabIcon,
|
|
722
|
+
children: "💬"
|
|
723
|
+
})
|
|
724
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Modal, {
|
|
725
|
+
testID: "copilot-popup-modal",
|
|
726
|
+
visible,
|
|
727
|
+
transparent: true,
|
|
728
|
+
animationType: "slide",
|
|
729
|
+
onRequestClose: handleClose,
|
|
730
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
731
|
+
testID: "copilot-popup-backdrop",
|
|
732
|
+
style: styles.backdrop,
|
|
733
|
+
onPress: dismissOnBackdropPress ? handleClose : void 0,
|
|
734
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.Pressable, {
|
|
735
|
+
testID: "copilot-popup-card",
|
|
736
|
+
style: [
|
|
737
|
+
styles.card,
|
|
738
|
+
{ height: resolvedHeight },
|
|
739
|
+
style
|
|
740
|
+
],
|
|
741
|
+
onPress: () => {},
|
|
742
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
743
|
+
style: styles.header,
|
|
744
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
745
|
+
style: styles.headerTitle,
|
|
746
|
+
children: headerTitle
|
|
747
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.TouchableOpacity, {
|
|
748
|
+
testID: "copilot-popup-close",
|
|
749
|
+
onPress: handleClose,
|
|
750
|
+
hitSlop: {
|
|
751
|
+
top: 8,
|
|
752
|
+
bottom: 8,
|
|
753
|
+
left: 8,
|
|
754
|
+
right: 8
|
|
755
|
+
},
|
|
756
|
+
accessibilityLabel: "Close chat",
|
|
757
|
+
accessibilityRole: "button",
|
|
758
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
759
|
+
style: styles.closeButton,
|
|
760
|
+
children: "✕"
|
|
761
|
+
})
|
|
762
|
+
})]
|
|
763
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
764
|
+
style: styles.chatContainer,
|
|
765
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChat, {
|
|
766
|
+
agentId,
|
|
767
|
+
agentName,
|
|
768
|
+
threadId,
|
|
769
|
+
throttleMs,
|
|
770
|
+
onError: chatOnError,
|
|
771
|
+
attachments: attachmentsConfig,
|
|
772
|
+
children
|
|
773
|
+
})
|
|
774
|
+
})]
|
|
775
|
+
})
|
|
776
|
+
})
|
|
777
|
+
})] });
|
|
778
|
+
});
|
|
779
|
+
const styles = react_native.StyleSheet.create({
|
|
780
|
+
fab: {
|
|
781
|
+
position: "absolute",
|
|
782
|
+
bottom: 24,
|
|
783
|
+
right: 24,
|
|
784
|
+
width: 56,
|
|
785
|
+
height: 56,
|
|
786
|
+
borderRadius: 28,
|
|
787
|
+
backgroundColor: "#6366f1",
|
|
788
|
+
alignItems: "center",
|
|
789
|
+
justifyContent: "center",
|
|
790
|
+
elevation: 6,
|
|
791
|
+
shadowColor: "#000",
|
|
792
|
+
shadowOffset: {
|
|
793
|
+
width: 0,
|
|
794
|
+
height: 3
|
|
795
|
+
},
|
|
796
|
+
shadowOpacity: .27,
|
|
797
|
+
shadowRadius: 4.65
|
|
798
|
+
},
|
|
799
|
+
fabIcon: { fontSize: 24 },
|
|
800
|
+
backdrop: {
|
|
801
|
+
flex: 1,
|
|
802
|
+
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
|
803
|
+
justifyContent: "flex-end"
|
|
804
|
+
},
|
|
805
|
+
card: {
|
|
806
|
+
backgroundColor: "#ffffff",
|
|
807
|
+
borderTopLeftRadius: 16,
|
|
808
|
+
borderTopRightRadius: 16,
|
|
809
|
+
overflow: "hidden",
|
|
810
|
+
elevation: 10,
|
|
811
|
+
shadowColor: "#000",
|
|
812
|
+
shadowOffset: {
|
|
813
|
+
width: 0,
|
|
814
|
+
height: -3
|
|
815
|
+
},
|
|
816
|
+
shadowOpacity: .25,
|
|
817
|
+
shadowRadius: 8
|
|
818
|
+
},
|
|
819
|
+
header: {
|
|
820
|
+
flexDirection: "row",
|
|
821
|
+
alignItems: "center",
|
|
822
|
+
justifyContent: "space-between",
|
|
823
|
+
paddingHorizontal: 16,
|
|
824
|
+
paddingVertical: 12,
|
|
825
|
+
borderBottomWidth: react_native.StyleSheet.hairlineWidth,
|
|
826
|
+
borderBottomColor: "#e5e7eb"
|
|
827
|
+
},
|
|
828
|
+
headerTitle: {
|
|
829
|
+
fontSize: 17,
|
|
830
|
+
fontWeight: "600",
|
|
831
|
+
color: "#111827"
|
|
832
|
+
},
|
|
833
|
+
closeButton: {
|
|
834
|
+
fontSize: 18,
|
|
835
|
+
color: "#6b7280",
|
|
836
|
+
fontWeight: "500"
|
|
837
|
+
},
|
|
838
|
+
chatContainer: { flex: 1 }
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
//#endregion
|
|
842
|
+
exports.CopilotChat = CopilotChat;
|
|
843
|
+
Object.defineProperty(exports, 'CopilotChatDefaultLabels', {
|
|
844
|
+
enumerable: true,
|
|
845
|
+
get: function () {
|
|
846
|
+
return _copilotkit_react_core_v2_headless.CopilotChatDefaultLabels;
|
|
847
|
+
}
|
|
848
|
+
});
|
|
129
849
|
Object.defineProperty(exports, 'CopilotKitContext', {
|
|
130
850
|
enumerable: true,
|
|
131
851
|
get: function () {
|
|
@@ -133,7 +853,16 @@ Object.defineProperty(exports, 'CopilotKitContext', {
|
|
|
133
853
|
}
|
|
134
854
|
});
|
|
135
855
|
exports.CopilotKitProvider = CopilotKitProvider;
|
|
856
|
+
exports.CopilotModal = CopilotModal;
|
|
857
|
+
exports.CopilotPopup = CopilotPopup;
|
|
858
|
+
exports.CopilotSidebar = CopilotSidebar;
|
|
136
859
|
exports.__toESM = __toESM;
|
|
860
|
+
Object.defineProperty(exports, 'defineToolCallRenderer', {
|
|
861
|
+
enumerable: true,
|
|
862
|
+
get: function () {
|
|
863
|
+
return _copilotkit_react_core_v2_headless.defineToolCallRenderer;
|
|
864
|
+
}
|
|
865
|
+
});
|
|
137
866
|
Object.defineProperty(exports, 'useAgent', {
|
|
138
867
|
enumerable: true,
|
|
139
868
|
get: function () {
|
|
@@ -146,6 +875,13 @@ Object.defineProperty(exports, 'useAgentContext', {
|
|
|
146
875
|
return _copilotkit_react_core_v2_headless.useAgentContext;
|
|
147
876
|
}
|
|
148
877
|
});
|
|
878
|
+
exports.useAttachments = useAttachments;
|
|
879
|
+
Object.defineProperty(exports, 'useCapabilities', {
|
|
880
|
+
enumerable: true,
|
|
881
|
+
get: function () {
|
|
882
|
+
return _copilotkit_react_core_v2_headless.useCapabilities;
|
|
883
|
+
}
|
|
884
|
+
});
|
|
149
885
|
Object.defineProperty(exports, 'useComponent', {
|
|
150
886
|
enumerable: true,
|
|
151
887
|
get: function () {
|
|
@@ -158,6 +894,7 @@ Object.defineProperty(exports, 'useConfigureSuggestions', {
|
|
|
158
894
|
return _copilotkit_react_core_v2_headless.useConfigureSuggestions;
|
|
159
895
|
}
|
|
160
896
|
});
|
|
897
|
+
exports.useCopilotChatContext = useCopilotChatContext;
|
|
161
898
|
Object.defineProperty(exports, 'useCopilotKit', {
|
|
162
899
|
enumerable: true,
|
|
163
900
|
get: function () {
|
|
@@ -188,6 +925,12 @@ Object.defineProperty(exports, 'useLicenseContext', {
|
|
|
188
925
|
return _copilotkit_react_core_v2_context.useLicenseContext;
|
|
189
926
|
}
|
|
190
927
|
});
|
|
928
|
+
Object.defineProperty(exports, 'useRenderTool', {
|
|
929
|
+
enumerable: true,
|
|
930
|
+
get: function () {
|
|
931
|
+
return _copilotkit_react_core_v2_headless.useRenderTool;
|
|
932
|
+
}
|
|
933
|
+
});
|
|
191
934
|
Object.defineProperty(exports, 'useSuggestions', {
|
|
192
935
|
enumerable: true,
|
|
193
936
|
get: function () {
|