@copilotkit/react-native 1.82.0 → 2.0.0-rc.0

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.
Files changed (67) hide show
  1. package/USAGE.md +2 -2
  2. package/dist/{CopilotKitProvider-BUVBq9LN.d.mts → CopilotKitProvider-BWjzCdHN.d.mts} +29 -2
  3. package/dist/{CopilotKitProvider-BVPr5t83.d.cts → CopilotKitProvider-Btm10msB.d.cts} +29 -2
  4. package/dist/{CopilotKitProvider-CjoPnabW.cjs → CopilotKitProvider-Byw3cqe2.cjs} +13 -10
  5. package/dist/CopilotKitProvider-Byw3cqe2.cjs.map +1 -0
  6. package/dist/{CopilotKitProvider-D8sn7G_C.mjs → CopilotKitProvider-CE4bc6CP.mjs} +9 -5
  7. package/dist/CopilotKitProvider-CE4bc6CP.mjs.map +1 -0
  8. package/dist/Markdown-1ips7myr.d.cts +52 -0
  9. package/dist/Markdown-C6AsLHmd.mjs +47 -0
  10. package/dist/Markdown-C6AsLHmd.mjs.map +1 -0
  11. package/dist/Markdown-C_9Re36O.cjs +60 -0
  12. package/dist/Markdown-C_9Re36O.cjs.map +1 -0
  13. package/dist/Markdown-JsYh7oSA.d.mts +52 -0
  14. package/dist/MarkdownRendererContext-BRNe808d.cjs +72 -0
  15. package/dist/MarkdownRendererContext-BRNe808d.cjs.map +1 -0
  16. package/dist/MarkdownRendererContext-CAnuohIS.mjs +21 -0
  17. package/dist/MarkdownRendererContext-CAnuohIS.mjs.map +1 -0
  18. package/dist/components/index.cjs +20 -106
  19. package/dist/components/index.cjs.map +1 -1
  20. package/dist/components/index.d.cts +1 -46
  21. package/dist/components/index.d.mts +1 -46
  22. package/dist/components/index.mjs +13 -98
  23. package/dist/components/index.mjs.map +1 -1
  24. package/dist/headless.cjs +22 -22
  25. package/dist/headless.d.cts +4 -3
  26. package/dist/headless.d.mts +4 -3
  27. package/dist/headless.mjs +3 -3
  28. package/dist/index.cjs +32 -27
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +3 -2
  31. package/dist/index.d.mts +3 -2
  32. package/dist/index.mjs +6 -4
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/polyfills/encoding.cjs +1 -1
  35. package/dist/polyfills/streams.cjs +1 -1
  36. package/package.json +6 -9
  37. package/scripts/measure-headless.mjs +2 -2
  38. package/src/CopilotChat.tsx +2 -2
  39. package/src/CopilotKitProvider.tsx +17 -4
  40. package/src/__mocks__/test-copilotkit.tsx +3 -3
  41. package/src/__tests__/attachments-integration.test.tsx +2 -2
  42. package/src/__tests__/copilot-chat-agentid.test.tsx +2 -2
  43. package/src/__tests__/copilot-chat-attachments.test.tsx +2 -2
  44. package/src/__tests__/copilot-popup.test.tsx +2 -2
  45. package/src/__tests__/copilot-sidebar.test.tsx +2 -2
  46. package/src/__tests__/copilotkit-provider.test.tsx +2 -2
  47. package/src/__tests__/headless-entry-surface.test.ts +33 -12
  48. package/src/__tests__/headless-integration.test.tsx +4 -2
  49. package/src/__tests__/headless-value-exports.test.ts +2 -2
  50. package/src/components/CopilotChat.tsx +2 -5
  51. package/src/components/Markdown.tsx +62 -100
  52. package/src/components/MarkdownRendererContext.tsx +40 -0
  53. package/src/components/__tests__/CopilotChat-edge-cases.test.tsx +2 -2
  54. package/src/components/__tests__/CopilotChat.test.tsx +2 -2
  55. package/src/components/__tests__/Markdown.code-alias.test.tsx +59 -0
  56. package/src/components/__tests__/Markdown.test.tsx +6 -75
  57. package/src/components/messages/AssistantMessage.tsx +22 -1
  58. package/src/components/messages/__tests__/AssistantMessage.provider-renderer.test.tsx +73 -0
  59. package/src/components/messages/__tests__/markdown-renderer-config.test.tsx +66 -0
  60. package/src/headless.ts +8 -8
  61. package/src/index.ts +19 -2
  62. package/tsdown.config.ts +0 -1
  63. package/vitest.config.mjs +0 -7
  64. package/dist/CopilotKitProvider-CjoPnabW.cjs.map +0 -1
  65. package/dist/CopilotKitProvider-D8sn7G_C.mjs.map +0 -1
  66. package/dist/chunk-C0xms8kb.cjs +0 -34
  67. package/src/__mocks__/react-native-streamdown.ts +0 -16
@@ -1,106 +1,13 @@
1
+ import { n as isNativeComponentRenderer, r as useMarkdownRenderer } from "../MarkdownRendererContext-CAnuohIS.mjs";
2
+ import { n as defaultMarkdownStyles, t as CopilotMarkdown } from "../Markdown-C6AsLHmd.mjs";
1
3
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
2
- import { useCopilotKit } from "@copilotkit/react-core/v2/context";
3
- import { useAgent, useRenderToolCall } from "@copilotkit/react-core/v2/headless";
4
+ import { useCopilotKit } from "@copilotkit/react-core/context";
5
+ import { useAgent, useRenderToolCall } from "@copilotkit/react-core/headless";
4
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
7
  import { contentToText } from "@ag-ui/client";
6
8
  import { Animated, FlatList, KeyboardAvoidingView, Platform, Pressable, StyleSheet, Text, TextInput, TouchableOpacity, View } from "react-native";
7
- import { StreamdownText } from "react-native-streamdown";
8
9
  import BottomSheet, { BottomSheetBackdrop, BottomSheetFlatList, BottomSheetView } from "@gorhom/bottom-sheet";
9
10
 
10
- //#region src/components/Markdown.tsx
11
- /**
12
- * Default markdown styles tuned for chat bubble display.
13
- *
14
- * Exported so consumers can spread and extend:
15
- * ```ts
16
- * import { defaultMarkdownStyles } from "@copilotkit/react-native";
17
- * const custom = { ...defaultMarkdownStyles, h1: { fontSize: 28 } };
18
- * ```
19
- */
20
- const defaultMarkdownStyles = {
21
- paragraph: {
22
- fontSize: 16,
23
- lineHeight: 24,
24
- color: "#1a1a1a",
25
- marginTop: 4,
26
- marginBottom: 4
27
- },
28
- h1: {
29
- fontSize: 24,
30
- fontWeight: "bold",
31
- marginTop: 12,
32
- marginBottom: 8,
33
- color: "#111111"
34
- },
35
- h2: {
36
- fontSize: 20,
37
- fontWeight: "bold",
38
- marginTop: 10,
39
- marginBottom: 6,
40
- color: "#111111"
41
- },
42
- h3: {
43
- fontSize: 18,
44
- fontWeight: "600",
45
- marginTop: 8,
46
- marginBottom: 4,
47
- color: "#222222"
48
- },
49
- strong: { fontWeight: "bold" },
50
- em: { fontStyle: "italic" },
51
- link: {
52
- color: "#0066cc",
53
- underline: true
54
- },
55
- blockquote: {
56
- backgroundColor: "#f5f5f5",
57
- borderWidth: 4,
58
- borderColor: "#cccccc",
59
- gapWidth: 12
60
- },
61
- code: {
62
- backgroundColor: "#f0f0f0",
63
- fontFamily: "monospace",
64
- fontSize: 14
65
- },
66
- codeBlock: {
67
- backgroundColor: "#f0f0f0",
68
- borderRadius: 8,
69
- padding: 12,
70
- fontFamily: "monospace",
71
- fontSize: 14
72
- },
73
- list: {
74
- marginTop: 4,
75
- marginBottom: 4
76
- }
77
- };
78
- /**
79
- * Renders markdown content using `react-native-streamdown` with
80
- * pre-configured styles suited for CopilotKit chat bubbles.
81
- *
82
- * `react-native-streamdown` processes incomplete streaming markdown in the
83
- * background, rendering incrementally without visual glitches — ideal for
84
- * displaying LLM output as it arrives.
85
- *
86
- * Custom styles are merged on top of the defaults so callers only need
87
- * to override what they want to change.
88
- */
89
- function CopilotMarkdown({ content, style, streamingAnimation = true }) {
90
- return /* @__PURE__ */ jsx(StreamdownText, {
91
- markdown: content,
92
- markdownStyle: useMemo(() => {
93
- if (!style) return defaultMarkdownStyles;
94
- return {
95
- ...defaultMarkdownStyles,
96
- ...style
97
- };
98
- }, [style]),
99
- streamingAnimation
100
- });
101
- }
102
-
103
- //#endregion
104
11
  //#region src/components/messages/TypingIndicator.tsx
105
12
  const DOT_SIZE = 6;
106
13
  const DOT_SPACING = 4;
@@ -201,11 +108,19 @@ const TIMESTAMP_COLOR$1 = "#999999";
201
108
  * typing indicator when `isLoading` is true.
202
109
  */
203
110
  function AssistantMessage({ content, isLoading = false, timestamp, style }) {
111
+ const provided = useMarkdownRenderer();
204
112
  return /* @__PURE__ */ jsxs(View, {
205
113
  style: [styles$3.container, style],
206
114
  children: [/* @__PURE__ */ jsxs(View, {
207
115
  style: styles$3.bubble,
208
- children: [content ? /* @__PURE__ */ jsx(CopilotMarkdown, { content }) : null, isLoading ? /* @__PURE__ */ jsx(TypingIndicator, {}) : null]
116
+ children: [content ? isNativeComponentRenderer(provided) ? React.createElement(provided, {
117
+ content,
118
+ isStreaming: isLoading
119
+ }) : provided ? /* @__PURE__ */ jsx(CopilotMarkdown, {
120
+ content,
121
+ style: provided.style,
122
+ streamingAnimation: provided.animate
123
+ }) : /* @__PURE__ */ jsx(CopilotMarkdown, { content }) : null, isLoading ? /* @__PURE__ */ jsx(TypingIndicator, {}) : null]
209
124
  }), timestamp && /* @__PURE__ */ jsx(Text, {
210
125
  style: styles$3.timestamp,
211
126
  children: formatTimestamp(timestamp)
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["styles","TIMESTAMP_COLOR","styles","styles","styles"],"sources":["../../src/components/Markdown.tsx","../../src/components/messages/TypingIndicator.tsx","../../src/components/messages/utils.ts","../../src/components/messages/AssistantMessage.tsx","../../src/components/messages/UserMessage.tsx","../../src/components/CopilotChat.tsx","../../src/components/CopilotModal.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { StreamdownText } from \"react-native-streamdown\";\n\n/**\n * Style object accepted by `react-native-enriched-markdown` (and therefore\n * `react-native-streamdown`). Each key targets a markdown element; the\n * available properties vary per element — see the enriched-markdown style\n * reference for the full list.\n */\nexport type MarkdownStyle = Record<string, Record<string, unknown>>;\n\n/**\n * Props for the CopilotMarkdown component.\n */\nexport interface CopilotMarkdownProps {\n /** Markdown string to render. */\n content: string;\n /** Optional style overrides merged on top of the defaults. */\n style?: MarkdownStyle;\n /** Whether to enable the streaming fade-in animation (default: true). */\n streamingAnimation?: boolean;\n}\n\n/**\n * Default markdown styles tuned for chat bubble display.\n *\n * Exported so consumers can spread and extend:\n * ```ts\n * import { defaultMarkdownStyles } from \"@copilotkit/react-native\";\n * const custom = { ...defaultMarkdownStyles, h1: { fontSize: 28 } };\n * ```\n */\nexport const defaultMarkdownStyles: MarkdownStyle = {\n paragraph: {\n fontSize: 16,\n lineHeight: 24,\n color: \"#1a1a1a\",\n marginTop: 4,\n marginBottom: 4,\n },\n h1: {\n fontSize: 24,\n fontWeight: \"bold\",\n marginTop: 12,\n marginBottom: 8,\n color: \"#111111\",\n },\n h2: {\n fontSize: 20,\n fontWeight: \"bold\",\n marginTop: 10,\n marginBottom: 6,\n color: \"#111111\",\n },\n h3: {\n fontSize: 18,\n fontWeight: \"600\",\n marginTop: 8,\n marginBottom: 4,\n color: \"#222222\",\n },\n strong: {\n fontWeight: \"bold\",\n },\n em: {\n fontStyle: \"italic\",\n },\n link: {\n color: \"#0066cc\",\n underline: true,\n },\n blockquote: {\n backgroundColor: \"#f5f5f5\",\n borderWidth: 4,\n borderColor: \"#cccccc\",\n gapWidth: 12,\n },\n code: {\n backgroundColor: \"#f0f0f0\",\n fontFamily: \"monospace\",\n fontSize: 14,\n },\n codeBlock: {\n backgroundColor: \"#f0f0f0\",\n borderRadius: 8,\n padding: 12,\n fontFamily: \"monospace\",\n fontSize: 14,\n },\n list: {\n marginTop: 4,\n marginBottom: 4,\n },\n};\n\n/**\n * Renders markdown content using `react-native-streamdown` with\n * pre-configured styles suited for CopilotKit chat bubbles.\n *\n * `react-native-streamdown` processes incomplete streaming markdown in the\n * background, rendering incrementally without visual glitches — ideal for\n * displaying LLM output as it arrives.\n *\n * Custom styles are merged on top of the defaults so callers only need\n * to override what they want to change.\n */\nexport function CopilotMarkdown({\n content,\n style,\n streamingAnimation = true,\n}: CopilotMarkdownProps) {\n const mergedStyles = useMemo(() => {\n if (!style) return defaultMarkdownStyles;\n return { ...defaultMarkdownStyles, ...style };\n }, [style]);\n\n return (\n <StreamdownText\n markdown={content}\n markdownStyle={mergedStyles}\n streamingAnimation={streamingAnimation}\n />\n );\n}\n","import React, { useEffect, useRef } from \"react\";\nimport { View, Animated, StyleSheet } from \"react-native\";\nimport type { ViewStyle } from \"react-native\";\n\n/**\n * Props for the TypingIndicator component.\n */\nexport interface TypingIndicatorProps {\n /** Optional style override for the container */\n style?: ViewStyle;\n}\n\nconst DOT_SIZE = 6;\nconst DOT_SPACING = 4;\nconst ANIMATION_DURATION = 400;\n\n/**\n * Three animated dots that pulse in sequence, suitable for embedding\n * inside an AssistantMessage to indicate the AI is still generating.\n *\n * Uses React Native's built-in `Animated` API (no Reanimated dependency).\n */\nexport function TypingIndicator({ style }: TypingIndicatorProps) {\n const dot1 = useRef(new Animated.Value(0)).current;\n const dot2 = useRef(new Animated.Value(0)).current;\n const dot3 = useRef(new Animated.Value(0)).current;\n\n useEffect(() => {\n const createPulse = (dot: Animated.Value, delay: number) =>\n Animated.sequence([\n Animated.delay(delay),\n Animated.loop(\n Animated.sequence([\n Animated.timing(dot, {\n toValue: 1,\n duration: ANIMATION_DURATION,\n useNativeDriver: true,\n }),\n Animated.timing(dot, {\n toValue: 0,\n duration: ANIMATION_DURATION,\n useNativeDriver: true,\n }),\n ]),\n ),\n ]);\n\n const animation = Animated.parallel([\n createPulse(dot1, 0),\n createPulse(dot2, ANIMATION_DURATION * 0.33),\n createPulse(dot3, ANIMATION_DURATION * 0.66),\n ]);\n\n animation.start();\n\n return () => {\n animation.stop();\n };\n }, [dot1, dot2, dot3]);\n\n const dotStyle = (animatedValue: Animated.Value) => ({\n ...styles.dot,\n opacity: animatedValue.interpolate({\n inputRange: [0, 1],\n outputRange: [0.3, 1],\n }),\n transform: [\n {\n scale: animatedValue.interpolate({\n inputRange: [0, 1],\n outputRange: [0.8, 1.2],\n }),\n },\n ],\n });\n\n return (\n <View\n testID=\"copilot-loading-cursor\"\n style={[styles.container, style]}\n accessibilityLabel=\"Typing indicator\"\n accessibilityRole=\"text\"\n >\n <Animated.View style={dotStyle(dot1)} />\n <Animated.View style={dotStyle(dot2)} />\n <Animated.View style={dotStyle(dot3)} />\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flexDirection: \"row\",\n alignItems: \"center\",\n paddingVertical: 4,\n paddingHorizontal: 2,\n },\n dot: {\n width: DOT_SIZE,\n height: DOT_SIZE,\n borderRadius: DOT_SIZE / 2,\n backgroundColor: \"#999999\",\n marginHorizontal: DOT_SPACING / 2,\n },\n});\n","/**\n * Format a Date as a 12-hour time string (e.g. \"2:05 PM\").\n */\nexport function formatTimestamp(date: Date): string {\n const hours = date.getHours();\n const minutes = date.getMinutes();\n const ampm = hours >= 12 ? \"PM\" : \"AM\";\n const displayHours = hours % 12 || 12;\n const displayMinutes = minutes.toString().padStart(2, \"0\");\n return `${displayHours}:${displayMinutes} ${ampm}`;\n}\n","import React from \"react\";\nimport { View, Text, StyleSheet, type ViewStyle } from \"react-native\";\nimport { CopilotMarkdown } from \"../Markdown\";\nimport { TypingIndicator } from \"./TypingIndicator\";\nimport { formatTimestamp } from \"./utils\";\n\n// ─── Colors ──────────────────────────────────────────────────────────────────\nconst ASSISTANT_BUBBLE_BG = \"#F0F0F0\";\nconst ASSISTANT_TEXT_COLOR = \"#1A1A1A\";\nconst TIMESTAMP_COLOR = \"#999999\";\n\n/**\n * Props for the AssistantMessage component.\n */\nexport interface AssistantMessageProps {\n /** Markdown content to render inside the bubble */\n content: string;\n /** When true, shows a typing indicator instead of content */\n isLoading?: boolean;\n /** Optional timestamp displayed below the bubble */\n timestamp?: Date;\n /** Optional style override for the outer container */\n style?: ViewStyle;\n}\n\n/**\n * Left-aligned chat bubble for AI assistant responses.\n *\n * Renders markdown content via `CopilotMarkdown` and shows an animated\n * typing indicator when `isLoading` is true.\n */\nexport function AssistantMessage({\n content,\n isLoading = false,\n timestamp,\n style,\n}: AssistantMessageProps) {\n return (\n <View style={[styles.container, style]}>\n <View style={styles.bubble}>\n {content ? <CopilotMarkdown content={content} /> : null}\n {isLoading ? <TypingIndicator /> : null}\n </View>\n {timestamp && (\n <Text style={styles.timestamp}>{formatTimestamp(timestamp)}</Text>\n )}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: \"flex-start\",\n marginVertical: 4,\n paddingHorizontal: 12,\n },\n bubble: {\n backgroundColor: ASSISTANT_BUBBLE_BG,\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n borderBottomRightRadius: 16,\n borderBottomLeftRadius: 4,\n paddingHorizontal: 12,\n paddingVertical: 8,\n maxWidth: \"80%\",\n },\n timestamp: {\n color: TIMESTAMP_COLOR,\n fontSize: 11,\n marginTop: 2,\n marginLeft: 4,\n },\n});\n","import React from \"react\";\nimport { View, Text, StyleSheet, type ViewStyle } from \"react-native\";\nimport { formatTimestamp } from \"./utils\";\n\n// ─── Colors ──────────────────────────────────────────────────────────────────\nconst USER_BUBBLE_BG = \"#0066CC\";\nconst USER_TEXT_COLOR = \"#FFFFFF\";\nconst TIMESTAMP_COLOR = \"#999999\";\n\n/**\n * Props for the UserMessage component.\n */\nexport interface UserMessageProps {\n /** Plain text content to display */\n content: string;\n /** Optional timestamp displayed below the bubble */\n timestamp?: Date;\n /** Optional style override for the outer container */\n style?: ViewStyle;\n}\n\n/**\n * Right-aligned chat bubble for user messages.\n *\n * Renders plain text (no markdown) with a primary-color background\n * and white text. Optionally displays a subtle timestamp below.\n */\nexport function UserMessage({ content, timestamp, style }: UserMessageProps) {\n return (\n <View style={[styles.container, style]}>\n <View style={styles.bubble}>\n <Text style={styles.text}>{content}</Text>\n </View>\n {timestamp && (\n <Text style={styles.timestamp}>{formatTimestamp(timestamp)}</Text>\n )}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: \"flex-end\",\n marginVertical: 4,\n paddingHorizontal: 12,\n },\n bubble: {\n backgroundColor: USER_BUBBLE_BG,\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n borderBottomLeftRadius: 16,\n borderBottomRightRadius: 4,\n paddingHorizontal: 12,\n paddingVertical: 8,\n maxWidth: \"80%\",\n },\n text: {\n color: USER_TEXT_COLOR,\n fontSize: 16,\n lineHeight: 22,\n },\n timestamp: {\n color: TIMESTAMP_COLOR,\n fontSize: 11,\n marginTop: 2,\n marginRight: 4,\n },\n});\n","import React, { useCallback, useMemo, useRef, useState } from \"react\";\nimport {\n FlatList,\n KeyboardAvoidingView,\n Platform,\n Pressable,\n StyleSheet,\n Text,\n TextInput,\n TouchableOpacity,\n View,\n} from \"react-native\";\nimport type { ListRenderItemInfo, ViewStyle } from \"react-native\";\nimport {\n useAgent,\n useRenderToolCall,\n} from \"@copilotkit/react-core/v2/headless\";\nimport { useCopilotKit } from \"@copilotkit/react-core/v2/context\";\nimport { AssistantMessage } from \"./messages/AssistantMessage\";\nimport { UserMessage } from \"./messages/UserMessage\";\nimport type { Message } from \"@copilotkit/shared\";\nimport type { ToolMessage } from \"@ag-ui/client\";\nimport { contentToText } from \"@ag-ui/client\";\n\n/** Shape of an assistant message with optional tool calls. */\ninterface AssistantMessageShape {\n id: string;\n role: \"assistant\";\n content?: string;\n toolCalls?: Array<{\n id: string;\n type: \"function\";\n function: { name: string; arguments: string };\n }>;\n}\n\nexport interface CopilotChatProps {\n /** Agent ID to connect to. Defaults to 'default'. */\n agentName?: string;\n /** Placeholder text for the input field. */\n placeholder?: string;\n /** Suggestion pills shown in the empty state. */\n initialMessages?: string[];\n /** Title shown when there are no messages. */\n emptyStateTitle?: string;\n /** Subtitle shown when there are no messages. */\n emptyStateSubtitle?: string;\n /** Title for the optional header bar. */\n headerTitle?: string;\n /** Whether to show the header bar. Defaults to true. */\n showHeader?: boolean;\n /** Style override for the outermost container. */\n style?: ViewStyle;\n /** Style override for the message list container. */\n messageContainerStyle?: ViewStyle;\n /** Style override for the input bar container. */\n inputContainerStyle?: ViewStyle;\n /** Callback fired when the user sends a message. */\n onSendMessage?: (text: string) => void;\n /** Custom FlatList component (e.g. BottomSheetFlatList for use inside a bottom sheet). */\n FlatListComponent?: React.ComponentType<any>;\n /** When true, skip the KeyboardAvoidingView wrapper (useful when a parent already handles keyboard). */\n disableKeyboardAvoiding?: boolean;\n}\n\ninterface ChatListItem {\n id: string;\n type: \"user\" | \"assistant\" | \"tool-call\" | \"loading\";\n content?: string;\n toolCalls?: Array<{\n id: string;\n type: \"function\";\n function: { name: string; arguments: string };\n }>;\n}\n\n/**\n * Lightweight content fingerprint for an agent's message list.\n *\n * The identity of `agent.messages` is NOT a reliable change signal, and it fails\n * in BOTH directions:\n *\n * - It changes on paths that have nothing to do with what is read below.\n * `@ag-ui/client`'s apply pipeline REASSIGNS the array\n * (`AbstractAgent.processApplyEvents` does `this.messages = applied.messages`),\n * so a streaming run hands down a fresh array — and fresh message, `toolCall`\n * and `function` objects — on every applied delta.\n * - It does NOT change on the paths these memos exist to serve. Core inserts\n * tool results by mutating in place —\n * `agent.messages.splice(insertAt, 0, toolMessage)`\n * (packages/core/src/core/run-handler.ts:931, :1080) —\n * `AbstractAgent.addMessage` is a `this.messages.push(...)`, and `useAgent`\n * re-renders with a bare `forceUpdate()` rather than a new array.\n *\n * (Grepping `packages/core/src` for a `.messages` assignment finds test files\n * only, but that proves nothing about identity: the reassignment lives in\n * `@ag-ui/client`, outside that tree.)\n *\n * So anything derived from messages must depend on their CONTENT, not on the\n * array reference.\n *\n * Captures exactly what the derivations below read — id, role, content size,\n * `toolCallId` (so an inserted tool result is visible), and each tool call's id\n * plus argument length (so streaming args advance).\n *\n * String and array content contribute their LENGTH rather than their value, so\n * large text and base64 attachment payloads are never re-serialized on every\n * render. Object content is the deliberate exception and IS serialized: a\n * length-based key is a constant 0 for every object, so an in-place content\n * replacement that keeps the same message id would otherwise be invisible to\n * every memo below.\n *\n * That object branch is convergence, not a fix for a reachable stale render: the\n * producer of same-id object content is an ACTIVITY_SNAPSHOT replace, and\n * `role: \"activity\"` never reaches `listItems`, which builds rows for `user` and\n * `assistant` only. It follows the SHAPE of react-core's `messagesMemoKey`\n * (react-core #6325). The two are independent implementations of the same idea —\n * a change to that key does not propagate here on its own, so treat this as a\n * documented parallel rather than a mirror.\n */\nfunction messagesFingerprint(messages: readonly unknown[]): string {\n return messages\n .map((msg) => {\n const m = msg as {\n id?: string;\n role?: string;\n content?: unknown;\n toolCallId?: string;\n toolCalls?: Array<{ id: string; function?: { arguments?: string } }>;\n };\n const content = m.content;\n const contentKey =\n typeof content === \"string\" || Array.isArray(content)\n ? content.length\n : content && typeof content === \"object\"\n ? objectContentKey(content)\n : 0;\n const toolCallsKey = Array.isArray(m.toolCalls)\n ? m.toolCalls\n .map((tc) => `${tc.id}:${tc.function?.arguments?.length ?? 0}`)\n .join(\";\")\n : \"\";\n return `${m.id}:${m.role}:${contentKey}:${m.toolCallId ?? \"\"}:${toolCallsKey}`;\n })\n .join(\",\");\n}\n\n/**\n * Serializes object content for the fingerprint above.\n *\n * Guarded because `JSON.stringify` THROWS on a circular structure and\n * `messagesFingerprint` runs on EVERY render, so a bare call would take the whole\n * chat down on content this component is explicitly required to tolerate —\n * `toolResultContent` below documents why non-string content reaches RN at all,\n * and \"does not throw on tool content that cannot be JSON-serialised\" pins that a\n * circular tool result must still render.\n *\n * The fallback is a constant, which means a circular object is invisible to the\n * memo exactly as every object used to be. That is the correct trade: it confines\n * the old always-equal behaviour to the pathological case instead of letting it\n * decide the common one. NOTE: this guard is a deliberate divergence from\n * react-core's `messagesMemoKey`, which stringifies unguarded.\n */\nfunction objectContentKey(content: object): string {\n try {\n return JSON.stringify(content) ?? \"\";\n } catch {\n return \"[unserializable]\";\n }\n}\n\n/**\n * Coerces a tool message's `content` to the `string` the renderer contract\n * requires (`ReactToolCallRenderer`'s Complete branch declares `result: string`)\n * WITHOUT inventing an empty result.\n *\n * AG-UI 1.0 models tool content as `string | ContentPart[]`: a plain string, or\n * an ordered list of typed parts (text, image, audio, video, document). A\n * string passes through; a list of parts is rendered as its text parts\n * concatenated — the flattening the spec permits for a string-only consumer —\n * and the media parts stay on the message for anything that can show them.\n * Neither is malformed, so neither warns.\n *\n * Anything else is only reachable from a producer that skipped validation —\n * restored thread history, a non-SSE transport, or app code casting on\n * `addMessage`. Core hedges against that case too (it accepts `unknown` content\n * and handles arrays of text parts), so this must not answer it with `\"\"`: an\n * empty string is a LEGITIMATE tool result, which makes a dropped result\n * indistinguishable from an empty one. Serialise faithfully — the same\n * representation core uses for non-string results — and warn in dev.\n */\nconst MEDIA_PART_TYPES = new Set([\"image\", \"audio\", \"video\", \"document\"]);\n\n/**\n * Whether a value is one of the protocol's content parts: a text part with a\n * string `text`, or a media part with a `source` that names its kind and\n * value. Anything else — an array of typed records from restored history,\n * say — is not parts and keeps the serialise-and-warn path.\n */\nfunction isContentPart(part: unknown): boolean {\n if (typeof part !== \"object\" || part === null) return false;\n const record = part as { type?: unknown; text?: unknown; source?: unknown };\n if (record.type === \"text\") return typeof record.text === \"string\";\n if (typeof record.type !== \"string\" || !MEDIA_PART_TYPES.has(record.type))\n return false;\n const source = record.source as\n | { type?: unknown; value?: unknown; mimeType?: unknown }\n | undefined;\n if (typeof source !== \"object\" || source === null) return false;\n if (typeof source.value !== \"string\") return false;\n // Inline bytes need their type; a URL or a provider file handle (AG-UI 1.0\n // `file` source) may leave it out.\n if (source.type === \"data\") return typeof source.mimeType === \"string\";\n return (\n (source.type === \"url\" || source.type === \"file\") &&\n (source.mimeType === undefined || typeof source.mimeType === \"string\")\n );\n}\n\nfunction toolResultContent(content: unknown, toolCallId: string): string {\n if (typeof content === \"string\") return content;\n\n if (Array.isArray(content) && content.every(isContentPart)) {\n return contentToText(content as ToolMessage[\"content\"]);\n }\n\n // null/undefined carry no payload, so \"\" loses nothing — but the message is\n // still malformed, so it warns below rather than passing silently.\n let serialized = \"\";\n if (content !== null && content !== undefined) {\n try {\n serialized =\n JSON.stringify(content) ?? Object.prototype.toString.call(content);\n } catch {\n // Circular or otherwise non-serialisable: keep SOMETHING over dropping\n // the result, and never throw from a render path.\n serialized = Object.prototype.toString.call(content);\n }\n }\n\n if (typeof __DEV__ === \"undefined\" || __DEV__) {\n console.warn(\n `[CopilotChat] Tool message for tool call \"${toolCallId}\" had non-string ` +\n `content (${content === null ? \"null\" : typeof content}), but renderers ` +\n `receive \\`result: string\\`. Rendering a serialized form instead of ` +\n `dropping it: ${serialized === \"\" ? \"<empty>\" : serialized}`,\n );\n }\n\n return serialized;\n}\n\n/**\n * Full-screen chat UI component for React Native.\n *\n * Connects to a CopilotKit agent via `useAgent` and renders messages\n * using platform-appropriate AssistantMessage / UserMessage components.\n *\n * Usage:\n * ```tsx\n * <CopilotChat agentName=\"my-agent\" headerTitle=\"Assistant\" />\n * ```\n */\nexport function CopilotChat({\n agentName = \"default\",\n placeholder = \"Type a message...\",\n initialMessages = [],\n emptyStateTitle = \"How can I help?\",\n emptyStateSubtitle = \"Ask me anything or try a suggestion below.\",\n headerTitle = \"Chat\",\n showHeader = true,\n style,\n messageContainerStyle,\n inputContainerStyle,\n onSendMessage,\n FlatListComponent = FlatList,\n disableKeyboardAvoiding = false,\n}: CopilotChatProps) {\n const [inputText, setInputText] = useState(\"\");\n const [error, setError] = useState<string | null>(null);\n const flatListRef = useRef<FlatList>(null);\n const messageIdCounter = useRef(0);\n\n const { copilotkit } = useCopilotKit();\n const { agent } = useAgent({ agentId: agentName });\n\n const messages = agent.messages ?? [];\n const isRunning = agent.isRunning;\n\n const renderToolCall = useRenderToolCall();\n\n // Recomputed every render — cheap, and the only honest dependency for the\n // message-derived memos below. See `messagesFingerprint` for why the array\n // reference cannot be trusted as one.\n const messagesKey = messagesFingerprint(messages);\n\n // toolCallId -> tool result message. react-core's renderer reports\n // status \"complete\" with `result` when a tool message exists; RN's chat\n // previously never correlated these, so `result` was always undefined.\n const toolMessages = useMemo(() => {\n const byId = new Map<string, ToolMessage>();\n for (const msg of messages) {\n const m = msg as {\n role?: string;\n id?: string;\n toolCallId?: string;\n content?: unknown;\n };\n if (m.role === \"tool\" && m.toolCallId) {\n byId.set(m.toolCallId, {\n id: m.id ?? m.toolCallId,\n role: \"tool\",\n toolCallId: m.toolCallId,\n content: toolResultContent(m.content, m.toolCallId),\n });\n }\n }\n return byId;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messagesKey]);\n\n // Build flat list items from messages\n const listItems: ChatListItem[] = useMemo(() => {\n const items: ChatListItem[] = [];\n\n for (const msg of messages) {\n if (msg.role === \"user\") {\n items.push({\n id: msg.id,\n type: \"user\",\n content: typeof msg.content === \"string\" ? msg.content : \"\",\n });\n } else if (msg.role === \"assistant\") {\n const assistantMsg = msg as AssistantMessageShape;\n // Add text content if present\n if (assistantMsg.content) {\n items.push({\n id: msg.id,\n type: \"assistant\",\n content: assistantMsg.content,\n });\n }\n // Add tool calls if present\n if (assistantMsg.toolCalls && assistantMsg.toolCalls.length > 0) {\n for (const tc of assistantMsg.toolCalls) {\n items.push({\n id: `${msg.id}-tc-${tc.id}`,\n type: \"tool-call\",\n toolCalls: [tc],\n });\n }\n }\n }\n }\n\n // Show loading indicator when agent is running and the last message\n // is not already the assistant streaming\n if (isRunning) {\n const lastItem = items[items.length - 1];\n if (!lastItem || lastItem.type !== \"assistant\") {\n items.push({ id: \"__loading__\", type: \"loading\" });\n }\n }\n\n return items;\n // Same reasoning as `toolMessages`: keyed on message CONTENT, because the\n // array reference does not track content in either direction — core's\n // in-place `splice` and `addMessage`'s push leave it untouched, while the\n // AG-UI apply pipeline replaces it on every delta. Without this, an\n // assistant message or tool call appended mid-run never reaches the list.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messagesKey, isRunning]);\n\n // Id of the trailing row. renderItem needs \"is this the last row?\" to place\n // the streaming indicator; deriving it here keeps that a named scalar instead\n // of renderItem closing over `listItems` and index-reading its tail.\n const lastItemId = useMemo(\n () => listItems[listItems.length - 1]?.id,\n [listItems],\n );\n\n // extraData defeats FlatList's PureComponent shallow-compare for the values\n // renderItem CLOSES OVER, as opposed to the ones it receives per row. Those\n // are exactly the four below, and they mirror renderItem's dependency array —\n // keep the two in sync. `listItems` is deliberately absent: renderItem's only\n // read of it is the tail id, now passed as `lastItemId`, and the array itself\n // is already the `data` prop, which invalidates cells on its own (every\n // rebuild allocates fresh item objects, so each cell's `item` prop differs).\n const extraData = useMemo(\n () => ({ isRunning, lastItemId, renderToolCall, toolMessages }),\n [isRunning, lastItemId, renderToolCall, toolMessages],\n );\n\n // Shared logic for sending a message to the agent\n const sendMessage = useCallback(\n async (text: string) => {\n if (!text || isRunning || !agent) return;\n\n setError(null);\n onSendMessage?.(text);\n\n const id = `user-${++messageIdCounter.current}`;\n agent.addMessage({\n id,\n role: \"user\",\n content: text,\n } as Message);\n\n try {\n await copilotkit.runAgent({ agent });\n } catch (err) {\n const message =\n err instanceof Error ? err.message : \"An unexpected error occurred\";\n console.error(\"[CopilotChat] runAgent failed:\", err);\n setError(message);\n }\n },\n [isRunning, agent, copilotkit, onSendMessage],\n );\n\n // Send from the input field\n const handleSend = useCallback(async () => {\n const text = inputText.trim();\n if (!text) return;\n setInputText(\"\");\n await sendMessage(text);\n }, [inputText, sendMessage]);\n\n // Handle suggestion pill press\n const handleSuggestion = useCallback(\n (text: string) => {\n void sendMessage(text);\n },\n [sendMessage],\n );\n\n // Auto-scroll when content changes\n const handleContentSizeChange = useCallback(() => {\n flatListRef.current?.scrollToEnd({ animated: true });\n }, []);\n\n // Render a single list item\n const renderItem = useCallback(\n ({ item }: ListRenderItemInfo<ChatListItem>) => {\n if (item.type === \"user\") {\n return <UserMessage content={item.content ?? \"\"} />;\n }\n\n if (item.type === \"assistant\") {\n return (\n <AssistantMessage\n content={item.content ?? \"\"}\n isLoading={isRunning && item.id === lastItemId}\n />\n );\n }\n\n if (item.type === \"tool-call\" && item.toolCalls) {\n const tc = item.toolCalls[0];\n // Partial-parses streaming args, resolves the renderer (exact name ->\n // agent-scoped -> wildcard \"*\") and derives status — all in react-core,\n // shared with web. Returns ReactElement | null, which is what\n // renderItem requires.\n const rendered = renderToolCall({\n toolCall: tc,\n toolMessage: toolMessages.get(tc.id),\n });\n if (rendered) return <>{rendered}</>;\n\n // Subtle indicator for unregistered tool calls\n return (\n <View style={styles.toolCallIndicator}>\n <Text style={styles.toolCallText}>Called: {tc.function.name}</Text>\n </View>\n );\n }\n\n if (item.type === \"loading\") {\n return <AssistantMessage content=\"\" isLoading />;\n }\n\n return null;\n },\n [isRunning, lastItemId, renderToolCall, toolMessages],\n );\n\n const keyExtractor = useCallback((item: ChatListItem) => item.id, []);\n\n // Empty state component\n const emptyComponent = useMemo(\n () => (\n <View style={styles.emptyState}>\n <Text style={styles.emptyTitle}>{emptyStateTitle}</Text>\n <Text style={styles.emptySubtitle}>{emptyStateSubtitle}</Text>\n {initialMessages.map((suggestion, i) => (\n <Pressable\n key={`suggestion-${i}`}\n style={styles.suggestionPill}\n onPress={() => handleSuggestion(suggestion)}\n >\n <Text style={styles.suggestionText}>{suggestion}</Text>\n </Pressable>\n ))}\n </View>\n ),\n [emptyStateTitle, emptyStateSubtitle, initialMessages, handleSuggestion],\n );\n\n const sendDisabled = !inputText.trim() || isRunning;\n\n const content = (\n <>\n {showHeader && (\n <View style={styles.header}>\n <Text style={styles.headerTitle}>{headerTitle}</Text>\n </View>\n )}\n\n <FlatListComponent\n ref={flatListRef}\n data={listItems}\n renderItem={renderItem}\n keyExtractor={keyExtractor}\n extraData={extraData}\n contentContainerStyle={[styles.messageList, messageContainerStyle]}\n onContentSizeChange={handleContentSizeChange}\n ListEmptyComponent={emptyComponent}\n />\n\n {error && (\n <View style={styles.errorContainer} testID=\"error-message\">\n <Text style={styles.errorText}>{error}</Text>\n </View>\n )}\n\n <View style={[styles.inputContainer, inputContainerStyle]}>\n <TextInput\n style={styles.input}\n value={inputText}\n onChangeText={setInputText}\n placeholder={placeholder}\n placeholderTextColor=\"#999\"\n multiline\n numberOfLines={4}\n returnKeyType=\"send\"\n onSubmitEditing={handleSend}\n />\n <TouchableOpacity\n style={[styles.sendButton, sendDisabled && styles.sendButtonDisabled]}\n onPress={handleSend}\n disabled={sendDisabled}\n testID=\"send-button\"\n >\n <Text style={styles.sendButtonIcon}>{\"↑\"}</Text>\n </TouchableOpacity>\n </View>\n </>\n );\n\n if (disableKeyboardAvoiding) {\n return <View style={[styles.container, style]}>{content}</View>;\n }\n\n return (\n <KeyboardAvoidingView\n style={[styles.container, style]}\n behavior={Platform.OS === \"ios\" ? \"padding\" : \"height\"}\n keyboardVerticalOffset={0}\n >\n {content}\n </KeyboardAvoidingView>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: \"#FFFFFF\",\n },\n header: {\n height: 56,\n justifyContent: \"center\",\n alignItems: \"center\",\n borderBottomWidth: StyleSheet.hairlineWidth,\n borderBottomColor: \"#E0E0E0\",\n backgroundColor: \"#FFFFFF\",\n },\n headerTitle: {\n fontSize: 17,\n fontWeight: \"600\",\n color: \"#1A1A1A\",\n },\n messageList: {\n paddingHorizontal: 16,\n flexGrow: 1,\n },\n inputContainer: {\n flexDirection: \"row\",\n alignItems: \"flex-end\",\n paddingHorizontal: 8,\n paddingVertical: 8,\n borderTopWidth: StyleSheet.hairlineWidth,\n borderTopColor: \"#E0E0E0\",\n backgroundColor: \"#FFFFFF\",\n },\n input: {\n flex: 1,\n backgroundColor: \"#F5F5F5\",\n borderRadius: 20,\n paddingHorizontal: 12,\n paddingVertical: 8,\n fontSize: 15,\n maxHeight: 100,\n color: \"#1A1A1A\",\n },\n sendButton: {\n width: 36,\n height: 36,\n borderRadius: 18,\n backgroundColor: \"#0066CC\",\n justifyContent: \"center\",\n alignItems: \"center\",\n marginLeft: 8,\n },\n sendButtonDisabled: {\n opacity: 0.4,\n },\n sendButtonIcon: {\n color: \"#FFFFFF\",\n fontSize: 18,\n fontWeight: \"700\",\n },\n emptyState: {\n flex: 1,\n justifyContent: \"center\",\n alignItems: \"center\",\n paddingTop: 100,\n gap: 12,\n },\n emptyTitle: {\n fontSize: 22,\n fontWeight: \"700\",\n color: \"#1A1A1A\",\n marginBottom: 4,\n },\n emptySubtitle: {\n fontSize: 15,\n color: \"#666666\",\n marginBottom: 16,\n },\n suggestionPill: {\n backgroundColor: \"#E8F0FE\",\n borderRadius: 20,\n paddingHorizontal: 16,\n paddingVertical: 10,\n },\n suggestionText: {\n color: \"#0066CC\",\n fontWeight: \"600\",\n fontSize: 14,\n },\n toolCallIndicator: {\n alignSelf: \"flex-start\",\n backgroundColor: \"#F0F0F0\",\n borderRadius: 12,\n paddingHorizontal: 12,\n paddingVertical: 6,\n marginBottom: 8,\n },\n toolCallText: {\n fontSize: 12,\n color: \"#999999\",\n fontStyle: \"italic\",\n },\n errorContainer: {\n backgroundColor: \"#FEE2E2\",\n paddingHorizontal: 12,\n paddingVertical: 8,\n marginHorizontal: 8,\n borderRadius: 8,\n },\n errorText: {\n color: \"#DC2626\",\n fontSize: 13,\n },\n});\n","/**\n * CopilotModal — a bottom-sheet chat overlay for React Native.\n *\n * Mobile equivalent of CopilotPopup on web. Wraps CopilotChat inside\n * @gorhom/bottom-sheet so the chat can slide up over any screen.\n */\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\nimport { StyleSheet, View } from \"react-native\";\nimport BottomSheet, {\n BottomSheetBackdrop,\n BottomSheetFlatList,\n BottomSheetView,\n} from \"@gorhom/bottom-sheet\";\nimport type { BottomSheetBackdropProps } from \"@gorhom/bottom-sheet\";\nimport { CopilotChat } from \"./CopilotChat\";\nimport type { CopilotChatProps } from \"./CopilotChat\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface CopilotModalProps {\n /** Controlled visibility — when true the sheet opens, when false it closes. */\n visible?: boolean;\n\n /** Called when the sheet is dismissed (via backdrop tap, swipe-down, or close()). */\n onDismiss?: () => void;\n\n /**\n * Bottom-sheet snap points.\n * @default ['50%', '90%']\n */\n snapPoints?: (string | number)[];\n\n /**\n * Which snap-point index to open at.\n * @default 0\n */\n initialSnapIndex?: number;\n\n /**\n * Whether closing the sheet fires onDismiss.\n * @default true\n */\n enableDismissOnClose?: boolean;\n\n /**\n * Backdrop opacity when the sheet is open.\n * @default 0.5\n */\n backdropOpacity?: number;\n\n // -- Pass-through to CopilotChat ------------------------------------------\n\n /** Which agent to connect to. */\n agentName?: string;\n\n /** Input placeholder text. */\n placeholder?: string;\n\n /** Seed messages shown on first render. */\n initialMessages?: string[];\n\n /** Title shown in the CopilotChat header area. */\n headerTitle?: string;\n}\n\n/** Imperative handle exposed via ref. */\nexport interface CopilotModalRef {\n /** Programmatically open the bottom sheet. */\n open: () => void;\n /** Programmatically close the bottom sheet. */\n close: () => void;\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nexport const CopilotModal = forwardRef<CopilotModalRef, CopilotModalProps>(\n function CopilotModal(\n {\n visible,\n onDismiss,\n snapPoints: snapPointsProp,\n initialSnapIndex = 0,\n enableDismissOnClose = true,\n backdropOpacity = 0.5,\n agentName,\n placeholder,\n initialMessages,\n headerTitle,\n },\n ref,\n ) {\n const bottomSheetRef = useRef<BottomSheet>(null);\n\n // Stable snap-points array\n const snapPoints = useMemo(\n () => snapPointsProp ?? [\"50%\", \"90%\"],\n [snapPointsProp],\n );\n\n // ── Imperative API ────────────────────────────────────────────────────\n useImperativeHandle(\n ref,\n () => ({\n open() {\n bottomSheetRef.current?.snapToIndex(initialSnapIndex);\n },\n close() {\n bottomSheetRef.current?.close();\n },\n }),\n [initialSnapIndex],\n );\n\n // ── Controlled visibility ─────────────────────────────────────────────\n useEffect(() => {\n if (visible === undefined) return;\n if (visible) {\n bottomSheetRef.current?.snapToIndex(initialSnapIndex);\n } else {\n bottomSheetRef.current?.close();\n }\n }, [visible, initialSnapIndex]);\n\n // ── Backdrop renderer ─────────────────────────────────────────────────\n const renderBackdrop = useCallback(\n (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n disappearsOnIndex={-1}\n appearsOnIndex={0}\n opacity={backdropOpacity}\n pressBehavior=\"close\"\n />\n ),\n [backdropOpacity],\n );\n\n // ── Sheet close handler ───────────────────────────────────────────────\n const handleClose = useCallback(() => {\n if (enableDismissOnClose) {\n onDismiss?.();\n }\n }, [enableDismissOnClose, onDismiss]);\n\n // ── Build CopilotChat props ───────────────────────────────────────────\n const chatProps = useMemo(() => {\n const props: Partial<CopilotChatProps> = {};\n if (agentName !== undefined) props.agentName = agentName;\n if (placeholder !== undefined) props.placeholder = placeholder;\n if (initialMessages !== undefined)\n props.initialMessages = initialMessages;\n if (headerTitle !== undefined) props.headerTitle = headerTitle;\n return props;\n }, [agentName, placeholder, initialMessages, headerTitle]);\n\n return (\n <BottomSheet\n ref={bottomSheetRef}\n index={-1}\n snapPoints={snapPoints}\n enablePanDownToClose\n backdropComponent={renderBackdrop}\n onClose={handleClose}\n keyboardBehavior=\"interactive\"\n keyboardBlurBehavior=\"restore\"\n backgroundStyle={styles.sheetBackground}\n handleIndicatorStyle={styles.handleIndicator}\n >\n <BottomSheetView style={styles.contentContainer}>\n <CopilotChat\n {...chatProps}\n FlatListComponent={BottomSheetFlatList}\n disableKeyboardAvoiding\n />\n </BottomSheetView>\n </BottomSheet>\n );\n },\n);\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\nconst styles = StyleSheet.create({\n sheetBackground: {\n backgroundColor: \"#FFFFFF\",\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n },\n handleIndicator: {\n width: 40,\n height: 4,\n backgroundColor: \"#DDDDDD\",\n },\n contentContainer: {\n flex: 1,\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgCA,MAAa,wBAAuC;CAClD,WAAW;EACT,UAAU;EACV,YAAY;EACZ,OAAO;EACP,WAAW;EACX,cAAc;EACf;CACD,IAAI;EACF,UAAU;EACV,YAAY;EACZ,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,IAAI;EACF,UAAU;EACV,YAAY;EACZ,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,IAAI;EACF,UAAU;EACV,YAAY;EACZ,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,QAAQ,EACN,YAAY,QACb;CACD,IAAI,EACF,WAAW,UACZ;CACD,MAAM;EACJ,OAAO;EACP,WAAW;EACZ;CACD,YAAY;EACV,iBAAiB;EACjB,aAAa;EACb,aAAa;EACb,UAA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AQ;EACR,iBAAiB;EAClB;CACD,kBAAkB,EAChB,MAAM,GACP;CACF,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":["styles","TIMESTAMP_COLOR","styles","styles","styles"],"sources":["../../src/components/messages/TypingIndicator.tsx","../../src/components/messages/utils.ts","../../src/components/messages/AssistantMessage.tsx","../../src/components/messages/UserMessage.tsx","../../src/components/CopilotChat.tsx","../../src/components/CopilotModal.tsx"],"sourcesContent":["import React, { useEffect, useRef } from \"react\";\nimport { View, Animated, StyleSheet } from \"react-native\";\nimport type { ViewStyle } from \"react-native\";\n\n/**\n * Props for the TypingIndicator component.\n */\nexport interface TypingIndicatorProps {\n /** Optional style override for the container */\n style?: ViewStyle;\n}\n\nconst DOT_SIZE = 6;\nconst DOT_SPACING = 4;\nconst ANIMATION_DURATION = 400;\n\n/**\n * Three animated dots that pulse in sequence, suitable for embedding\n * inside an AssistantMessage to indicate the AI is still generating.\n *\n * Uses React Native's built-in `Animated` API (no Reanimated dependency).\n */\nexport function TypingIndicator({ style }: TypingIndicatorProps) {\n const dot1 = useRef(new Animated.Value(0)).current;\n const dot2 = useRef(new Animated.Value(0)).current;\n const dot3 = useRef(new Animated.Value(0)).current;\n\n useEffect(() => {\n const createPulse = (dot: Animated.Value, delay: number) =>\n Animated.sequence([\n Animated.delay(delay),\n Animated.loop(\n Animated.sequence([\n Animated.timing(dot, {\n toValue: 1,\n duration: ANIMATION_DURATION,\n useNativeDriver: true,\n }),\n Animated.timing(dot, {\n toValue: 0,\n duration: ANIMATION_DURATION,\n useNativeDriver: true,\n }),\n ]),\n ),\n ]);\n\n const animation = Animated.parallel([\n createPulse(dot1, 0),\n createPulse(dot2, ANIMATION_DURATION * 0.33),\n createPulse(dot3, ANIMATION_DURATION * 0.66),\n ]);\n\n animation.start();\n\n return () => {\n animation.stop();\n };\n }, [dot1, dot2, dot3]);\n\n const dotStyle = (animatedValue: Animated.Value) => ({\n ...styles.dot,\n opacity: animatedValue.interpolate({\n inputRange: [0, 1],\n outputRange: [0.3, 1],\n }),\n transform: [\n {\n scale: animatedValue.interpolate({\n inputRange: [0, 1],\n outputRange: [0.8, 1.2],\n }),\n },\n ],\n });\n\n return (\n <View\n testID=\"copilot-loading-cursor\"\n style={[styles.container, style]}\n accessibilityLabel=\"Typing indicator\"\n accessibilityRole=\"text\"\n >\n <Animated.View style={dotStyle(dot1)} />\n <Animated.View style={dotStyle(dot2)} />\n <Animated.View style={dotStyle(dot3)} />\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flexDirection: \"row\",\n alignItems: \"center\",\n paddingVertical: 4,\n paddingHorizontal: 2,\n },\n dot: {\n width: DOT_SIZE,\n height: DOT_SIZE,\n borderRadius: DOT_SIZE / 2,\n backgroundColor: \"#999999\",\n marginHorizontal: DOT_SPACING / 2,\n },\n});\n","/**\n * Format a Date as a 12-hour time string (e.g. \"2:05 PM\").\n */\nexport function formatTimestamp(date: Date): string {\n const hours = date.getHours();\n const minutes = date.getMinutes();\n const ampm = hours >= 12 ? \"PM\" : \"AM\";\n const displayHours = hours % 12 || 12;\n const displayMinutes = minutes.toString().padStart(2, \"0\");\n return `${displayHours}:${displayMinutes} ${ampm}`;\n}\n","import React from \"react\";\nimport { View, Text, StyleSheet, type ViewStyle } from \"react-native\";\nimport { CopilotMarkdown } from \"../Markdown\";\nimport {\n useMarkdownRenderer,\n isNativeComponentRenderer,\n} from \"../MarkdownRendererContext\";\nimport { TypingIndicator } from \"./TypingIndicator\";\nimport { formatTimestamp } from \"./utils\";\n\n// ─── Colors ──────────────────────────────────────────────────────────────────\nconst ASSISTANT_BUBBLE_BG = \"#F0F0F0\";\nconst ASSISTANT_TEXT_COLOR = \"#1A1A1A\";\nconst TIMESTAMP_COLOR = \"#999999\";\n\n/**\n * Props for the AssistantMessage component.\n */\nexport interface AssistantMessageProps {\n /** Markdown content to render inside the bubble */\n content: string;\n /** When true, shows a typing indicator instead of content */\n isLoading?: boolean;\n /** Optional timestamp displayed below the bubble */\n timestamp?: Date;\n /** Optional style override for the outer container */\n style?: ViewStyle;\n}\n\n/**\n * Left-aligned chat bubble for AI assistant responses.\n *\n * Renders markdown content via `CopilotMarkdown` and shows an animated\n * typing indicator when `isLoading` is true.\n */\nexport function AssistantMessage({\n content,\n isLoading = false,\n timestamp,\n style,\n}: AssistantMessageProps) {\n // Honor a provider-level markdown renderer (CopilotKitProvider's\n // `markdownRenderer` prop), falling back to the built-in CopilotMarkdown.\n // This is the React Native arm of the slot -> provider -> built-in\n // resolution order documented in the migration guide.\n const provided = useMarkdownRenderer();\n return (\n <View style={[styles.container, style]}>\n <View style={styles.bubble}>\n {content ? (\n isNativeComponentRenderer(provided) ? (\n React.createElement(provided, { content, isStreaming: isLoading })\n ) : provided ? (\n <CopilotMarkdown\n content={content}\n style={provided.style}\n streamingAnimation={provided.animate}\n />\n ) : (\n <CopilotMarkdown content={content} />\n )\n ) : null}\n {isLoading ? <TypingIndicator /> : null}\n </View>\n {timestamp && (\n <Text style={styles.timestamp}>{formatTimestamp(timestamp)}</Text>\n )}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: \"flex-start\",\n marginVertical: 4,\n paddingHorizontal: 12,\n },\n bubble: {\n backgroundColor: ASSISTANT_BUBBLE_BG,\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n borderBottomRightRadius: 16,\n borderBottomLeftRadius: 4,\n paddingHorizontal: 12,\n paddingVertical: 8,\n maxWidth: \"80%\",\n },\n timestamp: {\n color: TIMESTAMP_COLOR,\n fontSize: 11,\n marginTop: 2,\n marginLeft: 4,\n },\n});\n","import React from \"react\";\nimport { View, Text, StyleSheet, type ViewStyle } from \"react-native\";\nimport { formatTimestamp } from \"./utils\";\n\n// ─── Colors ──────────────────────────────────────────────────────────────────\nconst USER_BUBBLE_BG = \"#0066CC\";\nconst USER_TEXT_COLOR = \"#FFFFFF\";\nconst TIMESTAMP_COLOR = \"#999999\";\n\n/**\n * Props for the UserMessage component.\n */\nexport interface UserMessageProps {\n /** Plain text content to display */\n content: string;\n /** Optional timestamp displayed below the bubble */\n timestamp?: Date;\n /** Optional style override for the outer container */\n style?: ViewStyle;\n}\n\n/**\n * Right-aligned chat bubble for user messages.\n *\n * Renders plain text (no markdown) with a primary-color background\n * and white text. Optionally displays a subtle timestamp below.\n */\nexport function UserMessage({ content, timestamp, style }: UserMessageProps) {\n return (\n <View style={[styles.container, style]}>\n <View style={styles.bubble}>\n <Text style={styles.text}>{content}</Text>\n </View>\n {timestamp && (\n <Text style={styles.timestamp}>{formatTimestamp(timestamp)}</Text>\n )}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: \"flex-end\",\n marginVertical: 4,\n paddingHorizontal: 12,\n },\n bubble: {\n backgroundColor: USER_BUBBLE_BG,\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n borderBottomLeftRadius: 16,\n borderBottomRightRadius: 4,\n paddingHorizontal: 12,\n paddingVertical: 8,\n maxWidth: \"80%\",\n },\n text: {\n color: USER_TEXT_COLOR,\n fontSize: 16,\n lineHeight: 22,\n },\n timestamp: {\n color: TIMESTAMP_COLOR,\n fontSize: 11,\n marginTop: 2,\n marginRight: 4,\n },\n});\n","import React, { useCallback, useMemo, useRef, useState } from \"react\";\nimport {\n FlatList,\n KeyboardAvoidingView,\n Platform,\n Pressable,\n StyleSheet,\n Text,\n TextInput,\n TouchableOpacity,\n View,\n} from \"react-native\";\nimport type { ListRenderItemInfo, ViewStyle } from \"react-native\";\nimport { useAgent, useRenderToolCall } from \"@copilotkit/react-core/headless\";\nimport { useCopilotKit } from \"@copilotkit/react-core/context\";\nimport { AssistantMessage } from \"./messages/AssistantMessage\";\nimport { UserMessage } from \"./messages/UserMessage\";\nimport type { Message } from \"@copilotkit/shared\";\nimport type { ToolMessage } from \"@ag-ui/client\";\nimport { contentToText } from \"@ag-ui/client\";\n\n/** Shape of an assistant message with optional tool calls. */\ninterface AssistantMessageShape {\n id: string;\n role: \"assistant\";\n content?: string;\n toolCalls?: Array<{\n id: string;\n type: \"function\";\n function: { name: string; arguments: string };\n }>;\n}\n\nexport interface CopilotChatProps {\n /** Agent ID to connect to. Defaults to 'default'. */\n agentName?: string;\n /** Placeholder text for the input field. */\n placeholder?: string;\n /** Suggestion pills shown in the empty state. */\n initialMessages?: string[];\n /** Title shown when there are no messages. */\n emptyStateTitle?: string;\n /** Subtitle shown when there are no messages. */\n emptyStateSubtitle?: string;\n /** Title for the optional header bar. */\n headerTitle?: string;\n /** Whether to show the header bar. Defaults to true. */\n showHeader?: boolean;\n /** Style override for the outermost container. */\n style?: ViewStyle;\n /** Style override for the message list container. */\n messageContainerStyle?: ViewStyle;\n /** Style override for the input bar container. */\n inputContainerStyle?: ViewStyle;\n /** Callback fired when the user sends a message. */\n onSendMessage?: (text: string) => void;\n /** Custom FlatList component (e.g. BottomSheetFlatList for use inside a bottom sheet). */\n FlatListComponent?: React.ComponentType<any>;\n /** When true, skip the KeyboardAvoidingView wrapper (useful when a parent already handles keyboard). */\n disableKeyboardAvoiding?: boolean;\n}\n\ninterface ChatListItem {\n id: string;\n type: \"user\" | \"assistant\" | \"tool-call\" | \"loading\";\n content?: string;\n toolCalls?: Array<{\n id: string;\n type: \"function\";\n function: { name: string; arguments: string };\n }>;\n}\n\n/**\n * Lightweight content fingerprint for an agent's message list.\n *\n * The identity of `agent.messages` is NOT a reliable change signal, and it fails\n * in BOTH directions:\n *\n * - It changes on paths that have nothing to do with what is read below.\n * `@ag-ui/client`'s apply pipeline REASSIGNS the array\n * (`AbstractAgent.processApplyEvents` does `this.messages = applied.messages`),\n * so a streaming run hands down a fresh array — and fresh message, `toolCall`\n * and `function` objects — on every applied delta.\n * - It does NOT change on the paths these memos exist to serve. Core inserts\n * tool results by mutating in place —\n * `agent.messages.splice(insertAt, 0, toolMessage)`\n * (packages/core/src/core/run-handler.ts:931, :1080) —\n * `AbstractAgent.addMessage` is a `this.messages.push(...)`, and `useAgent`\n * re-renders with a bare `forceUpdate()` rather than a new array.\n *\n * (Grepping `packages/core/src` for a `.messages` assignment finds test files\n * only, but that proves nothing about identity: the reassignment lives in\n * `@ag-ui/client`, outside that tree.)\n *\n * So anything derived from messages must depend on their CONTENT, not on the\n * array reference.\n *\n * Captures exactly what the derivations below read — id, role, content size,\n * `toolCallId` (so an inserted tool result is visible), and each tool call's id\n * plus argument length (so streaming args advance).\n *\n * String and array content contribute their LENGTH rather than their value, so\n * large text and base64 attachment payloads are never re-serialized on every\n * render. Object content is the deliberate exception and IS serialized: a\n * length-based key is a constant 0 for every object, so an in-place content\n * replacement that keeps the same message id would otherwise be invisible to\n * every memo below.\n *\n * That object branch is convergence, not a fix for a reachable stale render: the\n * producer of same-id object content is an ACTIVITY_SNAPSHOT replace, and\n * `role: \"activity\"` never reaches `listItems`, which builds rows for `user` and\n * `assistant` only. It follows the SHAPE of react-core's `messagesMemoKey`\n * (react-core #6325). The two are independent implementations of the same idea —\n * a change to that key does not propagate here on its own, so treat this as a\n * documented parallel rather than a mirror.\n */\nfunction messagesFingerprint(messages: readonly unknown[]): string {\n return messages\n .map((msg) => {\n const m = msg as {\n id?: string;\n role?: string;\n content?: unknown;\n toolCallId?: string;\n toolCalls?: Array<{ id: string; function?: { arguments?: string } }>;\n };\n const content = m.content;\n const contentKey =\n typeof content === \"string\" || Array.isArray(content)\n ? content.length\n : content && typeof content === \"object\"\n ? objectContentKey(content)\n : 0;\n const toolCallsKey = Array.isArray(m.toolCalls)\n ? m.toolCalls\n .map((tc) => `${tc.id}:${tc.function?.arguments?.length ?? 0}`)\n .join(\";\")\n : \"\";\n return `${m.id}:${m.role}:${contentKey}:${m.toolCallId ?? \"\"}:${toolCallsKey}`;\n })\n .join(\",\");\n}\n\n/**\n * Serializes object content for the fingerprint above.\n *\n * Guarded because `JSON.stringify` THROWS on a circular structure and\n * `messagesFingerprint` runs on EVERY render, so a bare call would take the whole\n * chat down on content this component is explicitly required to tolerate —\n * `toolResultContent` below documents why non-string content reaches RN at all,\n * and \"does not throw on tool content that cannot be JSON-serialised\" pins that a\n * circular tool result must still render.\n *\n * The fallback is a constant, which means a circular object is invisible to the\n * memo exactly as every object used to be. That is the correct trade: it confines\n * the old always-equal behaviour to the pathological case instead of letting it\n * decide the common one. NOTE: this guard is a deliberate divergence from\n * react-core's `messagesMemoKey`, which stringifies unguarded.\n */\nfunction objectContentKey(content: object): string {\n try {\n return JSON.stringify(content) ?? \"\";\n } catch {\n return \"[unserializable]\";\n }\n}\n\n/**\n * Coerces a tool message's `content` to the `string` the renderer contract\n * requires (`ReactToolCallRenderer`'s Complete branch declares `result: string`)\n * WITHOUT inventing an empty result.\n *\n * AG-UI 1.0 models tool content as `string | ContentPart[]`: a plain string, or\n * an ordered list of typed parts (text, image, audio, video, document). A\n * string passes through; a list of parts is rendered as its text parts\n * concatenated — the flattening the spec permits for a string-only consumer —\n * and the media parts stay on the message for anything that can show them.\n * Neither is malformed, so neither warns.\n *\n * Anything else is only reachable from a producer that skipped validation —\n * restored thread history, a non-SSE transport, or app code casting on\n * `addMessage`. Core hedges against that case too (it accepts `unknown` content\n * and handles arrays of text parts), so this must not answer it with `\"\"`: an\n * empty string is a LEGITIMATE tool result, which makes a dropped result\n * indistinguishable from an empty one. Serialise faithfully — the same\n * representation core uses for non-string results — and warn in dev.\n */\nconst MEDIA_PART_TYPES = new Set([\"image\", \"audio\", \"video\", \"document\"]);\n\n/**\n * Whether a value is one of the protocol's content parts: a text part with a\n * string `text`, or a media part with a `source` that names its kind and\n * value. Anything else — an array of typed records from restored history,\n * say — is not parts and keeps the serialise-and-warn path.\n */\nfunction isContentPart(part: unknown): boolean {\n if (typeof part !== \"object\" || part === null) return false;\n const record = part as { type?: unknown; text?: unknown; source?: unknown };\n if (record.type === \"text\") return typeof record.text === \"string\";\n if (typeof record.type !== \"string\" || !MEDIA_PART_TYPES.has(record.type))\n return false;\n const source = record.source as\n | { type?: unknown; value?: unknown; mimeType?: unknown }\n | undefined;\n if (typeof source !== \"object\" || source === null) return false;\n if (typeof source.value !== \"string\") return false;\n // Inline bytes need their type; a URL or a provider file handle (AG-UI 1.0\n // `file` source) may leave it out.\n if (source.type === \"data\") return typeof source.mimeType === \"string\";\n return (\n (source.type === \"url\" || source.type === \"file\") &&\n (source.mimeType === undefined || typeof source.mimeType === \"string\")\n );\n}\n\nfunction toolResultContent(content: unknown, toolCallId: string): string {\n if (typeof content === \"string\") return content;\n\n if (Array.isArray(content) && content.every(isContentPart)) {\n return contentToText(content as ToolMessage[\"content\"]);\n }\n\n // null/undefined carry no payload, so \"\" loses nothing — but the message is\n // still malformed, so it warns below rather than passing silently.\n let serialized = \"\";\n if (content !== null && content !== undefined) {\n try {\n serialized =\n JSON.stringify(content) ?? Object.prototype.toString.call(content);\n } catch {\n // Circular or otherwise non-serialisable: keep SOMETHING over dropping\n // the result, and never throw from a render path.\n serialized = Object.prototype.toString.call(content);\n }\n }\n\n if (typeof __DEV__ === \"undefined\" || __DEV__) {\n console.warn(\n `[CopilotChat] Tool message for tool call \"${toolCallId}\" had non-string ` +\n `content (${content === null ? \"null\" : typeof content}), but renderers ` +\n `receive \\`result: string\\`. Rendering a serialized form instead of ` +\n `dropping it: ${serialized === \"\" ? \"<empty>\" : serialized}`,\n );\n }\n\n return serialized;\n}\n\n/**\n * Full-screen chat UI component for React Native.\n *\n * Connects to a CopilotKit agent via `useAgent` and renders messages\n * using platform-appropriate AssistantMessage / UserMessage components.\n *\n * Usage:\n * ```tsx\n * <CopilotChat agentName=\"my-agent\" headerTitle=\"Assistant\" />\n * ```\n */\nexport function CopilotChat({\n agentName = \"default\",\n placeholder = \"Type a message...\",\n initialMessages = [],\n emptyStateTitle = \"How can I help?\",\n emptyStateSubtitle = \"Ask me anything or try a suggestion below.\",\n headerTitle = \"Chat\",\n showHeader = true,\n style,\n messageContainerStyle,\n inputContainerStyle,\n onSendMessage,\n FlatListComponent = FlatList,\n disableKeyboardAvoiding = false,\n}: CopilotChatProps) {\n const [inputText, setInputText] = useState(\"\");\n const [error, setError] = useState<string | null>(null);\n const flatListRef = useRef<FlatList>(null);\n const messageIdCounter = useRef(0);\n\n const { copilotkit } = useCopilotKit();\n const { agent } = useAgent({ agentId: agentName });\n\n const messages = agent.messages ?? [];\n const isRunning = agent.isRunning;\n\n const renderToolCall = useRenderToolCall();\n\n // Recomputed every render — cheap, and the only honest dependency for the\n // message-derived memos below. See `messagesFingerprint` for why the array\n // reference cannot be trusted as one.\n const messagesKey = messagesFingerprint(messages);\n\n // toolCallId -> tool result message. react-core's renderer reports\n // status \"complete\" with `result` when a tool message exists; RN's chat\n // previously never correlated these, so `result` was always undefined.\n const toolMessages = useMemo(() => {\n const byId = new Map<string, ToolMessage>();\n for (const msg of messages) {\n const m = msg as {\n role?: string;\n id?: string;\n toolCallId?: string;\n content?: unknown;\n };\n if (m.role === \"tool\" && m.toolCallId) {\n byId.set(m.toolCallId, {\n id: m.id ?? m.toolCallId,\n role: \"tool\",\n toolCallId: m.toolCallId,\n content: toolResultContent(m.content, m.toolCallId),\n });\n }\n }\n return byId;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messagesKey]);\n\n // Build flat list items from messages\n const listItems: ChatListItem[] = useMemo(() => {\n const items: ChatListItem[] = [];\n\n for (const msg of messages) {\n if (msg.role === \"user\") {\n items.push({\n id: msg.id,\n type: \"user\",\n content: typeof msg.content === \"string\" ? msg.content : \"\",\n });\n } else if (msg.role === \"assistant\") {\n const assistantMsg = msg as AssistantMessageShape;\n // Add text content if present\n if (assistantMsg.content) {\n items.push({\n id: msg.id,\n type: \"assistant\",\n content: assistantMsg.content,\n });\n }\n // Add tool calls if present\n if (assistantMsg.toolCalls && assistantMsg.toolCalls.length > 0) {\n for (const tc of assistantMsg.toolCalls) {\n items.push({\n id: `${msg.id}-tc-${tc.id}`,\n type: \"tool-call\",\n toolCalls: [tc],\n });\n }\n }\n }\n }\n\n // Show loading indicator when agent is running and the last message\n // is not already the assistant streaming\n if (isRunning) {\n const lastItem = items[items.length - 1];\n if (!lastItem || lastItem.type !== \"assistant\") {\n items.push({ id: \"__loading__\", type: \"loading\" });\n }\n }\n\n return items;\n // Same reasoning as `toolMessages`: keyed on message CONTENT, because the\n // array reference does not track content in either direction — core's\n // in-place `splice` and `addMessage`'s push leave it untouched, while the\n // AG-UI apply pipeline replaces it on every delta. Without this, an\n // assistant message or tool call appended mid-run never reaches the list.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messagesKey, isRunning]);\n\n // Id of the trailing row. renderItem needs \"is this the last row?\" to place\n // the streaming indicator; deriving it here keeps that a named scalar instead\n // of renderItem closing over `listItems` and index-reading its tail.\n const lastItemId = useMemo(\n () => listItems[listItems.length - 1]?.id,\n [listItems],\n );\n\n // extraData defeats FlatList's PureComponent shallow-compare for the values\n // renderItem CLOSES OVER, as opposed to the ones it receives per row. Those\n // are exactly the four below, and they mirror renderItem's dependency array —\n // keep the two in sync. `listItems` is deliberately absent: renderItem's only\n // read of it is the tail id, now passed as `lastItemId`, and the array itself\n // is already the `data` prop, which invalidates cells on its own (every\n // rebuild allocates fresh item objects, so each cell's `item` prop differs).\n const extraData = useMemo(\n () => ({ isRunning, lastItemId, renderToolCall, toolMessages }),\n [isRunning, lastItemId, renderToolCall, toolMessages],\n );\n\n // Shared logic for sending a message to the agent\n const sendMessage = useCallback(\n async (text: string) => {\n if (!text || isRunning || !agent) return;\n\n setError(null);\n onSendMessage?.(text);\n\n const id = `user-${++messageIdCounter.current}`;\n agent.addMessage({\n id,\n role: \"user\",\n content: text,\n } as Message);\n\n try {\n await copilotkit.runAgent({ agent });\n } catch (err) {\n const message =\n err instanceof Error ? err.message : \"An unexpected error occurred\";\n console.error(\"[CopilotChat] runAgent failed:\", err);\n setError(message);\n }\n },\n [isRunning, agent, copilotkit, onSendMessage],\n );\n\n // Send from the input field\n const handleSend = useCallback(async () => {\n const text = inputText.trim();\n if (!text) return;\n setInputText(\"\");\n await sendMessage(text);\n }, [inputText, sendMessage]);\n\n // Handle suggestion pill press\n const handleSuggestion = useCallback(\n (text: string) => {\n void sendMessage(text);\n },\n [sendMessage],\n );\n\n // Auto-scroll when content changes\n const handleContentSizeChange = useCallback(() => {\n flatListRef.current?.scrollToEnd({ animated: true });\n }, []);\n\n // Render a single list item\n const renderItem = useCallback(\n ({ item }: ListRenderItemInfo<ChatListItem>) => {\n if (item.type === \"user\") {\n return <UserMessage content={item.content ?? \"\"} />;\n }\n\n if (item.type === \"assistant\") {\n return (\n <AssistantMessage\n content={item.content ?? \"\"}\n isLoading={isRunning && item.id === lastItemId}\n />\n );\n }\n\n if (item.type === \"tool-call\" && item.toolCalls) {\n const tc = item.toolCalls[0];\n // Partial-parses streaming args, resolves the renderer (exact name ->\n // agent-scoped -> wildcard \"*\") and derives status — all in react-core,\n // shared with web. Returns ReactElement | null, which is what\n // renderItem requires.\n const rendered = renderToolCall({\n toolCall: tc,\n toolMessage: toolMessages.get(tc.id),\n });\n if (rendered) return <>{rendered}</>;\n\n // Subtle indicator for unregistered tool calls\n return (\n <View style={styles.toolCallIndicator}>\n <Text style={styles.toolCallText}>Called: {tc.function.name}</Text>\n </View>\n );\n }\n\n if (item.type === \"loading\") {\n return <AssistantMessage content=\"\" isLoading />;\n }\n\n return null;\n },\n [isRunning, lastItemId, renderToolCall, toolMessages],\n );\n\n const keyExtractor = useCallback((item: ChatListItem) => item.id, []);\n\n // Empty state component\n const emptyComponent = useMemo(\n () => (\n <View style={styles.emptyState}>\n <Text style={styles.emptyTitle}>{emptyStateTitle}</Text>\n <Text style={styles.emptySubtitle}>{emptyStateSubtitle}</Text>\n {initialMessages.map((suggestion, i) => (\n <Pressable\n key={`suggestion-${i}`}\n style={styles.suggestionPill}\n onPress={() => handleSuggestion(suggestion)}\n >\n <Text style={styles.suggestionText}>{suggestion}</Text>\n </Pressable>\n ))}\n </View>\n ),\n [emptyStateTitle, emptyStateSubtitle, initialMessages, handleSuggestion],\n );\n\n const sendDisabled = !inputText.trim() || isRunning;\n\n const content = (\n <>\n {showHeader && (\n <View style={styles.header}>\n <Text style={styles.headerTitle}>{headerTitle}</Text>\n </View>\n )}\n\n <FlatListComponent\n ref={flatListRef}\n data={listItems}\n renderItem={renderItem}\n keyExtractor={keyExtractor}\n extraData={extraData}\n contentContainerStyle={[styles.messageList, messageContainerStyle]}\n onContentSizeChange={handleContentSizeChange}\n ListEmptyComponent={emptyComponent}\n />\n\n {error && (\n <View style={styles.errorContainer} testID=\"error-message\">\n <Text style={styles.errorText}>{error}</Text>\n </View>\n )}\n\n <View style={[styles.inputContainer, inputContainerStyle]}>\n <TextInput\n style={styles.input}\n value={inputText}\n onChangeText={setInputText}\n placeholder={placeholder}\n placeholderTextColor=\"#999\"\n multiline\n numberOfLines={4}\n returnKeyType=\"send\"\n onSubmitEditing={handleSend}\n />\n <TouchableOpacity\n style={[styles.sendButton, sendDisabled && styles.sendButtonDisabled]}\n onPress={handleSend}\n disabled={sendDisabled}\n testID=\"send-button\"\n >\n <Text style={styles.sendButtonIcon}>{\"↑\"}</Text>\n </TouchableOpacity>\n </View>\n </>\n );\n\n if (disableKeyboardAvoiding) {\n return <View style={[styles.container, style]}>{content}</View>;\n }\n\n return (\n <KeyboardAvoidingView\n style={[styles.container, style]}\n behavior={Platform.OS === \"ios\" ? \"padding\" : \"height\"}\n keyboardVerticalOffset={0}\n >\n {content}\n </KeyboardAvoidingView>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: \"#FFFFFF\",\n },\n header: {\n height: 56,\n justifyContent: \"center\",\n alignItems: \"center\",\n borderBottomWidth: StyleSheet.hairlineWidth,\n borderBottomColor: \"#E0E0E0\",\n backgroundColor: \"#FFFFFF\",\n },\n headerTitle: {\n fontSize: 17,\n fontWeight: \"600\",\n color: \"#1A1A1A\",\n },\n messageList: {\n paddingHorizontal: 16,\n flexGrow: 1,\n },\n inputContainer: {\n flexDirection: \"row\",\n alignItems: \"flex-end\",\n paddingHorizontal: 8,\n paddingVertical: 8,\n borderTopWidth: StyleSheet.hairlineWidth,\n borderTopColor: \"#E0E0E0\",\n backgroundColor: \"#FFFFFF\",\n },\n input: {\n flex: 1,\n backgroundColor: \"#F5F5F5\",\n borderRadius: 20,\n paddingHorizontal: 12,\n paddingVertical: 8,\n fontSize: 15,\n maxHeight: 100,\n color: \"#1A1A1A\",\n },\n sendButton: {\n width: 36,\n height: 36,\n borderRadius: 18,\n backgroundColor: \"#0066CC\",\n justifyContent: \"center\",\n alignItems: \"center\",\n marginLeft: 8,\n },\n sendButtonDisabled: {\n opacity: 0.4,\n },\n sendButtonIcon: {\n color: \"#FFFFFF\",\n fontSize: 18,\n fontWeight: \"700\",\n },\n emptyState: {\n flex: 1,\n justifyContent: \"center\",\n alignItems: \"center\",\n paddingTop: 100,\n gap: 12,\n },\n emptyTitle: {\n fontSize: 22,\n fontWeight: \"700\",\n color: \"#1A1A1A\",\n marginBottom: 4,\n },\n emptySubtitle: {\n fontSize: 15,\n color: \"#666666\",\n marginBottom: 16,\n },\n suggestionPill: {\n backgroundColor: \"#E8F0FE\",\n borderRadius: 20,\n paddingHorizontal: 16,\n paddingVertical: 10,\n },\n suggestionText: {\n color: \"#0066CC\",\n fontWeight: \"600\",\n fontSize: 14,\n },\n toolCallIndicator: {\n alignSelf: \"flex-start\",\n backgroundColor: \"#F0F0F0\",\n borderRadius: 12,\n paddingHorizontal: 12,\n paddingVertical: 6,\n marginBottom: 8,\n },\n toolCallText: {\n fontSize: 12,\n color: \"#999999\",\n fontStyle: \"italic\",\n },\n errorContainer: {\n backgroundColor: \"#FEE2E2\",\n paddingHorizontal: 12,\n paddingVertical: 8,\n marginHorizontal: 8,\n borderRadius: 8,\n },\n errorText: {\n color: \"#DC2626\",\n fontSize: 13,\n },\n});\n","/**\n * CopilotModal — a bottom-sheet chat overlay for React Native.\n *\n * Mobile equivalent of CopilotPopup on web. Wraps CopilotChat inside\n * @gorhom/bottom-sheet so the chat can slide up over any screen.\n */\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\nimport { StyleSheet, View } from \"react-native\";\nimport BottomSheet, {\n BottomSheetBackdrop,\n BottomSheetFlatList,\n BottomSheetView,\n} from \"@gorhom/bottom-sheet\";\nimport type { BottomSheetBackdropProps } from \"@gorhom/bottom-sheet\";\nimport { CopilotChat } from \"./CopilotChat\";\nimport type { CopilotChatProps } from \"./CopilotChat\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface CopilotModalProps {\n /** Controlled visibility — when true the sheet opens, when false it closes. */\n visible?: boolean;\n\n /** Called when the sheet is dismissed (via backdrop tap, swipe-down, or close()). */\n onDismiss?: () => void;\n\n /**\n * Bottom-sheet snap points.\n * @default ['50%', '90%']\n */\n snapPoints?: (string | number)[];\n\n /**\n * Which snap-point index to open at.\n * @default 0\n */\n initialSnapIndex?: number;\n\n /**\n * Whether closing the sheet fires onDismiss.\n * @default true\n */\n enableDismissOnClose?: boolean;\n\n /**\n * Backdrop opacity when the sheet is open.\n * @default 0.5\n */\n backdropOpacity?: number;\n\n // -- Pass-through to CopilotChat ------------------------------------------\n\n /** Which agent to connect to. */\n agentName?: string;\n\n /** Input placeholder text. */\n placeholder?: string;\n\n /** Seed messages shown on first render. */\n initialMessages?: string[];\n\n /** Title shown in the CopilotChat header area. */\n headerTitle?: string;\n}\n\n/** Imperative handle exposed via ref. */\nexport interface CopilotModalRef {\n /** Programmatically open the bottom sheet. */\n open: () => void;\n /** Programmatically close the bottom sheet. */\n close: () => void;\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nexport const CopilotModal = forwardRef<CopilotModalRef, CopilotModalProps>(\n function CopilotModal(\n {\n visible,\n onDismiss,\n snapPoints: snapPointsProp,\n initialSnapIndex = 0,\n enableDismissOnClose = true,\n backdropOpacity = 0.5,\n agentName,\n placeholder,\n initialMessages,\n headerTitle,\n },\n ref,\n ) {\n const bottomSheetRef = useRef<BottomSheet>(null);\n\n // Stable snap-points array\n const snapPoints = useMemo(\n () => snapPointsProp ?? [\"50%\", \"90%\"],\n [snapPointsProp],\n );\n\n // ── Imperative API ────────────────────────────────────────────────────\n useImperativeHandle(\n ref,\n () => ({\n open() {\n bottomSheetRef.current?.snapToIndex(initialSnapIndex);\n },\n close() {\n bottomSheetRef.current?.close();\n },\n }),\n [initialSnapIndex],\n );\n\n // ── Controlled visibility ─────────────────────────────────────────────\n useEffect(() => {\n if (visible === undefined) return;\n if (visible) {\n bottomSheetRef.current?.snapToIndex(initialSnapIndex);\n } else {\n bottomSheetRef.current?.close();\n }\n }, [visible, initialSnapIndex]);\n\n // ── Backdrop renderer ─────────────────────────────────────────────────\n const renderBackdrop = useCallback(\n (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n disappearsOnIndex={-1}\n appearsOnIndex={0}\n opacity={backdropOpacity}\n pressBehavior=\"close\"\n />\n ),\n [backdropOpacity],\n );\n\n // ── Sheet close handler ───────────────────────────────────────────────\n const handleClose = useCallback(() => {\n if (enableDismissOnClose) {\n onDismiss?.();\n }\n }, [enableDismissOnClose, onDismiss]);\n\n // ── Build CopilotChat props ───────────────────────────────────────────\n const chatProps = useMemo(() => {\n const props: Partial<CopilotChatProps> = {};\n if (agentName !== undefined) props.agentName = agentName;\n if (placeholder !== undefined) props.placeholder = placeholder;\n if (initialMessages !== undefined)\n props.initialMessages = initialMessages;\n if (headerTitle !== undefined) props.headerTitle = headerTitle;\n return props;\n }, [agentName, placeholder, initialMessages, headerTitle]);\n\n return (\n <BottomSheet\n ref={bottomSheetRef}\n index={-1}\n snapPoints={snapPoints}\n enablePanDownToClose\n backdropComponent={renderBackdrop}\n onClose={handleClose}\n keyboardBehavior=\"interactive\"\n keyboardBlurBehavior=\"restore\"\n backgroundStyle={styles.sheetBackground}\n handleIndicatorStyle={styles.handleIndicator}\n >\n <BottomSheetView style={styles.contentContainer}>\n <CopilotChat\n {...chatProps}\n FlatListComponent={BottomSheetFlatList}\n disableKeyboardAvoiding\n />\n </BottomSheetView>\n </BottomSheet>\n );\n },\n);\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\nconst styles = StyleSheet.create({\n sheetBackground: {\n backgroundColor: \"#FFFFFF\",\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n },\n handleIndicator: {\n width: 40,\n height: 4,\n backgroundColor: \"#DDDDDD\",\n },\n contentContainer: {\n flex: 1,\n },\n});\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,WAAW;AACjB,MAAM,cAAc;AACpB,MAAM,qBAAqB;;;;;;;AAQ3B,SAAgB,gBAAgB,EAAE,SAA+B;CAC/D,MAAM,OAAO,OAAO,IAAI,SAAS,MAAM,EAAE,CAAC,CAAC;CAC3C,MAAM,OAAO,OAAO,IAAI,SAAS,MAAM,EAAE,CAAC,CAAC;CAC3C,MAAM,OAAO,OAAO,IAAI,SAAS,MAAM,EAAE,CAAC,CAAC;AAE3C,iBAAgB;EACd,MAAM,eAAe,KAAqB,UACxC,SAAS,SAAS,CAChB,SAAS,MAAM,MAAM,EACrB,SAAS,KACP,SAAS,SAAS,CAChB,SAAS,OAAO,KAAK;GACnB,SAAS;GACT,UAAU;GACV,iBAAiB;GAClB,CAAC,EACF,SAAS,OAAO,KAAK;GACnB,SAAS;GACT,UAAU;GACV,iBAAiB;GAClB,CAAC,CACH,CAAC,CACH,CACF,CAAC;EAEJ,MAAM,YAAY,SAAS,SAAS;GAClC,YAAY,MAAM,EAAE;GACpB,YAAY,MAAM,qBAAqB,IAAK;GAC5C,YAAY,MAAM,qBAAqB,IAAK;GAC7C,CAAC;AAEF,YAAU,OAAO;AAEjB,eAAa;AACX,aAAU,MAAM;;IAEjB;EAAC;EAAM;EAAM;EAAK,CAAC;CAEtB,MAAM,YAAY,mBAAmC;EACnD,GAAGA,SAAO;EACV,SAAS,cAAc,YAAY;GACjC,YAAY,CAAC,GAAG,EAAE;GAClB,aAAa,CAAC,IAAK,EAAE;GACtB,CAAC;EACF,WAAW,CACT,EACE,OAAO,cAAc,YAAY;GA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B;EACf,OAAO;EACP,QAAQ;EACR,iBAAiB;EAClB;CACD,kBAAkB,EAChB,MAAM,GACP;CACF,CAAC"}
package/dist/headless.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_chunk = require('./chunk-C0xms8kb.cjs');
2
+ const require_MarkdownRendererContext = require('./MarkdownRendererContext-BRNe808d.cjs');
3
3
  require('./polyfills.cjs');
4
- const require_CopilotKitProvider = require('./CopilotKitProvider-CjoPnabW.cjs');
5
- let _copilotkit_react_core_v2_context = require("@copilotkit/react-core/v2/context");
6
- let _copilotkit_react_core_v2_headless = require("@copilotkit/react-core/v2/headless");
4
+ const require_CopilotKitProvider = require('./CopilotKitProvider-Byw3cqe2.cjs');
5
+ let _copilotkit_react_core_context = require("@copilotkit/react-core/context");
6
+ let _copilotkit_react_core_headless = require("@copilotkit/react-core/headless");
7
7
  let _copilotkit_core = require("@copilotkit/core");
8
8
  let _ag_ui_client = require("@ag-ui/client");
9
9
 
@@ -16,13 +16,13 @@ Object.defineProperty(exports, 'AbstractAgent', {
16
16
  Object.defineProperty(exports, 'CopilotChatDefaultLabels', {
17
17
  enumerable: true,
18
18
  get: function () {
19
- return _copilotkit_react_core_v2_headless.CopilotChatDefaultLabels;
19
+ return _copilotkit_react_core_headless.CopilotChatDefaultLabels;
20
20
  }
21
21
  });
22
22
  Object.defineProperty(exports, 'CopilotKitContext', {
23
23
  enumerable: true,
24
24
  get: function () {
25
- return _copilotkit_react_core_v2_context.CopilotKitContext;
25
+ return _copilotkit_react_core_context.CopilotKitContext;
26
26
  }
27
27
  });
28
28
  Object.defineProperty(exports, 'CopilotKitCoreErrorCode', {
@@ -47,96 +47,96 @@ Object.defineProperty(exports, 'ToolCallStatus', {
47
47
  Object.defineProperty(exports, 'UseAgentUpdate', {
48
48
  enumerable: true,
49
49
  get: function () {
50
- return _copilotkit_react_core_v2_headless.UseAgentUpdate;
50
+ return _copilotkit_react_core_headless.UseAgentUpdate;
51
51
  }
52
52
  });
53
53
  Object.defineProperty(exports, 'defineToolCallRenderer', {
54
54
  enumerable: true,
55
55
  get: function () {
56
- return _copilotkit_react_core_v2_headless.defineToolCallRenderer;
56
+ return _copilotkit_react_core_headless.defineToolCallRenderer;
57
57
  }
58
58
  });
59
59
  Object.defineProperty(exports, 'useAgent', {
60
60
  enumerable: true,
61
61
  get: function () {
62
- return _copilotkit_react_core_v2_headless.useAgent;
62
+ return _copilotkit_react_core_headless.useAgent;
63
63
  }
64
64
  });
65
65
  Object.defineProperty(exports, 'useAgentContext', {
66
66
  enumerable: true,
67
67
  get: function () {
68
- return _copilotkit_react_core_v2_headless.useAgentContext;
68
+ return _copilotkit_react_core_headless.useAgentContext;
69
69
  }
70
70
  });
71
71
  Object.defineProperty(exports, 'useCapabilities', {
72
72
  enumerable: true,
73
73
  get: function () {
74
- return _copilotkit_react_core_v2_headless.useCapabilities;
74
+ return _copilotkit_react_core_headless.useCapabilities;
75
75
  }
76
76
  });
77
77
  Object.defineProperty(exports, 'useComponent', {
78
78
  enumerable: true,
79
79
  get: function () {
80
- return _copilotkit_react_core_v2_headless.useComponent;
80
+ return _copilotkit_react_core_headless.useComponent;
81
81
  }
82
82
  });
83
83
  Object.defineProperty(exports, 'useConfigureSuggestions', {
84
84
  enumerable: true,
85
85
  get: function () {
86
- return _copilotkit_react_core_v2_headless.useConfigureSuggestions;
86
+ return _copilotkit_react_core_headless.useConfigureSuggestions;
87
87
  }
88
88
  });
89
89
  Object.defineProperty(exports, 'useCopilotKit', {
90
90
  enumerable: true,
91
91
  get: function () {
92
- return _copilotkit_react_core_v2_context.useCopilotKit;
92
+ return _copilotkit_react_core_context.useCopilotKit;
93
93
  }
94
94
  });
95
95
  Object.defineProperty(exports, 'useFrontendTool', {
96
96
  enumerable: true,
97
97
  get: function () {
98
- return _copilotkit_react_core_v2_headless.useFrontendTool;
98
+ return _copilotkit_react_core_headless.useFrontendTool;
99
99
  }
100
100
  });
101
101
  Object.defineProperty(exports, 'useHumanInTheLoop', {
102
102
  enumerable: true,
103
103
  get: function () {
104
- return _copilotkit_react_core_v2_headless.useHumanInTheLoop;
104
+ return _copilotkit_react_core_headless.useHumanInTheLoop;
105
105
  }
106
106
  });
107
107
  Object.defineProperty(exports, 'useInterrupt', {
108
108
  enumerable: true,
109
109
  get: function () {
110
- return _copilotkit_react_core_v2_headless.useInterrupt;
110
+ return _copilotkit_react_core_headless.useInterrupt;
111
111
  }
112
112
  });
113
113
  Object.defineProperty(exports, 'useLicenseContext', {
114
114
  enumerable: true,
115
115
  get: function () {
116
- return _copilotkit_react_core_v2_context.useLicenseContext;
116
+ return _copilotkit_react_core_context.useLicenseContext;
117
117
  }
118
118
  });
119
119
  Object.defineProperty(exports, 'useRenderTool', {
120
120
  enumerable: true,
121
121
  get: function () {
122
- return _copilotkit_react_core_v2_headless.useRenderTool;
122
+ return _copilotkit_react_core_headless.useRenderTool;
123
123
  }
124
124
  });
125
125
  Object.defineProperty(exports, 'useRenderToolCall', {
126
126
  enumerable: true,
127
127
  get: function () {
128
- return _copilotkit_react_core_v2_headless.useRenderToolCall;
128
+ return _copilotkit_react_core_headless.useRenderToolCall;
129
129
  }
130
130
  });
131
131
  Object.defineProperty(exports, 'useSuggestions', {
132
132
  enumerable: true,
133
133
  get: function () {
134
- return _copilotkit_react_core_v2_headless.useSuggestions;
134
+ return _copilotkit_react_core_headless.useSuggestions;
135
135
  }
136
136
  });
137
137
  Object.defineProperty(exports, 'useThreads', {
138
138
  enumerable: true,
139
139
  get: function () {
140
- return _copilotkit_react_core_v2_headless.useThreads;
140
+ return _copilotkit_react_core_headless.useThreads;
141
141
  }
142
142
  });
@@ -1,8 +1,9 @@
1
- import { n as CopilotKitProvider, t as CopilotKitNativeProviderProps } from "./CopilotKitProvider-BVPr5t83.cjs";
1
+ import "./Markdown-1ips7myr.cjs";
2
+ import { n as CopilotKitProvider, t as CopilotKitNativeProviderProps } from "./CopilotKitProvider-Btm10msB.cjs";
2
3
  import React from "react";
3
- 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/v2/headless";
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";
4
5
  import { CopilotKitCoreErrorCode, CopilotKitCoreRuntimeConnectionStatus, FrontendTool, Suggestion, ToolCallStatus } from "@copilotkit/core";
5
- import { CopilotKitContext, CopilotKitContextValue, useCopilotKit, useLicenseContext } from "@copilotkit/react-core/v2/context";
6
+ import { CopilotKitContext, CopilotKitContextValue, useCopilotKit, useLicenseContext } from "@copilotkit/react-core/context";
6
7
  import { AbstractAgent, AgentCapabilities, AssistantMessage as AssistantMessageType, Message, ToolCall, ToolMessage } from "@ag-ui/client";
7
8
 
8
9
  //#region src/headless.d.ts
@@ -1,7 +1,8 @@
1
- import { n as CopilotKitProvider, t as CopilotKitNativeProviderProps } from "./CopilotKitProvider-BUVBq9LN.mjs";
1
+ import "./Markdown-JsYh7oSA.mjs";
2
+ import { n as CopilotKitProvider, t as CopilotKitNativeProviderProps } from "./CopilotKitProvider-BWjzCdHN.mjs";
2
3
  import React from "react";
3
- import { CopilotKitContext, CopilotKitContextValue, useCopilotKit, useLicenseContext } from "@copilotkit/react-core/v2/context";
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/v2/headless";
4
+ import { CopilotKitContext, CopilotKitContextValue, useCopilotKit, useLicenseContext } from "@copilotkit/react-core/context";
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";
5
6
  import { CopilotKitCoreErrorCode, CopilotKitCoreRuntimeConnectionStatus, FrontendTool, Suggestion, ToolCallStatus } from "@copilotkit/core";
6
7
  import { AbstractAgent, AgentCapabilities, AssistantMessage as AssistantMessageType, Message, ToolCall, ToolMessage } from "@ag-ui/client";
7
8
 
package/dist/headless.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./polyfills.mjs";
2
- import { t as CopilotKitProvider } from "./CopilotKitProvider-D8sn7G_C.mjs";
3
- import { CopilotKitContext, useCopilotKit, useLicenseContext } from "@copilotkit/react-core/v2/context";
4
- import { CopilotChatDefaultLabels, UseAgentUpdate, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useRenderToolCall, useSuggestions, useThreads } from "@copilotkit/react-core/v2/headless";
2
+ import { t as CopilotKitProvider } from "./CopilotKitProvider-CE4bc6CP.mjs";
3
+ import { CopilotKitContext, useCopilotKit, useLicenseContext } from "@copilotkit/react-core/context";
4
+ import { CopilotChatDefaultLabels, UseAgentUpdate, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useRenderToolCall, useSuggestions, useThreads } from "@copilotkit/react-core/headless";
5
5
  import { CopilotKitCoreErrorCode, CopilotKitCoreRuntimeConnectionStatus, ToolCallStatus } from "@copilotkit/core";
6
6
  import { AbstractAgent } from "@ag-ui/client";
7
7