@copilotkit/react-core 1.10.0-next.9 → 1.10.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.
- package/CHANGELOG.md +104 -0
- package/dist/{chunk-VH45SC6Z.mjs → chunk-2GRWTU7W.mjs} +2 -2
- package/dist/chunk-3BASANUO.mjs +170 -0
- package/dist/chunk-3BASANUO.mjs.map +1 -0
- package/dist/{chunk-PHIMGB3K.mjs → chunk-5P46WS5M.mjs} +25 -19
- package/dist/chunk-5P46WS5M.mjs.map +1 -0
- package/dist/{chunk-AWFAFFO5.mjs → chunk-6ZLPNY7X.mjs} +7 -3
- package/dist/chunk-6ZLPNY7X.mjs.map +1 -0
- package/dist/{chunk-TTI4Z6GK.mjs → chunk-BEFEBKKI.mjs} +7 -7
- package/dist/chunk-BEFEBKKI.mjs.map +1 -0
- package/dist/{chunk-VSH4JSN3.mjs → chunk-F26O2HTO.mjs} +13 -7
- package/dist/chunk-F26O2HTO.mjs.map +1 -0
- package/dist/{chunk-GRCHDHC4.mjs → chunk-JY3STRON.mjs} +22 -4
- package/dist/chunk-JY3STRON.mjs.map +1 -0
- package/dist/{chunk-ZTZJIDRJ.mjs → chunk-N4VN2B5S.mjs} +2 -2
- package/dist/{chunk-FTP6FDYS.mjs → chunk-NTH42BY5.mjs} +2 -2
- package/dist/chunk-PIF5KJYI.mjs +103 -0
- package/dist/chunk-PIF5KJYI.mjs.map +1 -0
- package/dist/chunk-WSXTUD36.mjs +759 -0
- package/dist/chunk-WSXTUD36.mjs.map +1 -0
- package/dist/chunk-YIBUNEBN.mjs +34 -0
- package/dist/chunk-YIBUNEBN.mjs.map +1 -0
- package/dist/components/copilot-provider/copilotkit-props.d.ts +9 -1
- package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.js +1052 -72
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +6 -3
- package/dist/components/copilot-provider/index.js +1052 -72
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +6 -3
- package/dist/components/dev-console/console-trigger.d.ts +8 -0
- package/dist/components/dev-console/console-trigger.js +1131 -0
- package/dist/components/dev-console/console-trigger.js.map +1 -0
- package/dist/components/dev-console/console-trigger.mjs +13 -0
- package/dist/components/dev-console/developer-console-modal.d.ts +10 -0
- package/dist/components/dev-console/developer-console-modal.js +977 -0
- package/dist/components/dev-console/developer-console-modal.js.map +1 -0
- package/dist/components/dev-console/developer-console-modal.mjs +12 -0
- package/dist/components/dev-console/developer-console-modal.mjs.map +1 -0
- package/dist/components/dev-console/icons.d.ts +9 -0
- package/dist/components/dev-console/icons.js +131 -0
- package/dist/components/dev-console/icons.js.map +1 -0
- package/dist/components/dev-console/icons.mjs +16 -0
- package/dist/components/dev-console/icons.mjs.map +1 -0
- package/dist/components/error-boundary/error-boundary.js +6 -2
- package/dist/components/error-boundary/error-boundary.js.map +1 -1
- package/dist/components/error-boundary/error-boundary.mjs +2 -2
- package/dist/components/index.js +1052 -72
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +6 -3
- package/dist/components/usage-banner.d.ts +2 -1
- package/dist/components/usage-banner.js +6 -2
- package/dist/components/usage-banner.js.map +1 -1
- package/dist/components/usage-banner.mjs +1 -1
- package/dist/hooks/index.d.ts +5 -5
- package/dist/hooks/index.js +58 -26
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +13 -10
- package/dist/hooks/use-coagent.d.ts +1 -1
- package/dist/hooks/use-coagent.js +18 -6
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +8 -5
- package/dist/hooks/use-copilot-chat-headless_c.d.ts +33 -0
- package/dist/hooks/{use-copilot-chat-light.js → use-copilot-chat-headless_c.js} +88 -19
- package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -0
- package/dist/hooks/{use-copilot-chat-light.mjs → use-copilot-chat-headless_c.mjs} +14 -8
- package/dist/hooks/use-copilot-chat-headless_c.mjs.map +1 -0
- package/dist/hooks/use-copilot-chat.d.ts +85 -4
- package/dist/hooks/use-copilot-chat.js +38 -61
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +8 -8
- package/dist/hooks/use-copilot-chat_internal.d.ts +98 -12
- package/dist/hooks/use-copilot-chat_internal.js +13 -1
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +7 -4
- package/dist/hooks/use-langgraph-interrupt.js +13 -1
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +8 -5
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1203 -200
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -11
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +7 -4
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +7 -4
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +6 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +6 -3
- package/dist/utils/suggestions.js.map +1 -1
- package/dist/utils/suggestions.mjs +6 -3
- package/package.json +3 -3
- package/src/components/copilot-provider/copilotkit-props.tsx +10 -1
- package/src/components/copilot-provider/copilotkit.tsx +25 -16
- package/src/components/dev-console/console-trigger.tsx +190 -0
- package/src/components/dev-console/developer-console-modal.tsx +866 -0
- package/src/components/dev-console/icons.tsx +101 -0
- package/src/components/usage-banner.tsx +8 -3
- package/src/hooks/index.ts +6 -7
- package/src/hooks/use-coagent.ts +6 -11
- package/src/hooks/use-copilot-chat-headless_c.ts +257 -0
- package/src/hooks/use-copilot-chat.ts +103 -154
- package/src/hooks/use-copilot-chat_internal.ts +122 -15
- package/dist/chunk-AWFAFFO5.mjs.map +0 -1
- package/dist/chunk-GRCHDHC4.mjs.map +0 -1
- package/dist/chunk-MWHILKQH.mjs +0 -18
- package/dist/chunk-MWHILKQH.mjs.map +0 -1
- package/dist/chunk-PHIMGB3K.mjs.map +0 -1
- package/dist/chunk-TTI4Z6GK.mjs.map +0 -1
- package/dist/chunk-VSH4JSN3.mjs.map +0 -1
- package/dist/hooks/use-copilot-chat-light.d.ts +0 -211
- package/dist/hooks/use-copilot-chat-light.js.map +0 -1
- package/src/hooks/use-copilot-chat-light.ts +0 -219
- /package/dist/{chunk-VH45SC6Z.mjs.map → chunk-2GRWTU7W.mjs.map} +0 -0
- /package/dist/{chunk-ZTZJIDRJ.mjs.map → chunk-N4VN2B5S.mjs.map} +0 -0
- /package/dist/{chunk-FTP6FDYS.mjs.map → chunk-NTH42BY5.mjs.map} +0 -0
- /package/dist/{hooks/use-copilot-chat-light.mjs.map → components/dev-console/console-trigger.mjs.map} +0 -0
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `useCopilotChatLight` is a lightweight React hook for headless chat interactions.
|
|
3
|
-
* Perfect for programmatic messaging, background operations, and custom UI implementations.
|
|
4
|
-
*
|
|
5
|
-
* **Open Source Friendly** - Works without requiring a `publicApiKey`.
|
|
6
|
-
*
|
|
7
|
-
* ## Use Cases:
|
|
8
|
-
*
|
|
9
|
-
* - **Programmatic Messaging**: Send messages without displaying chat UI
|
|
10
|
-
* - **Background Operations**: Trigger AI interactions in the background
|
|
11
|
-
* - **Custom UI**: Build your own chat interface using CopilotKit's messaging infrastructure
|
|
12
|
-
* - **Testing & Automation**: Programmatic chat interactions for testing
|
|
13
|
-
* - **Fire-and-Forget**: Send messages without needing to read responses
|
|
14
|
-
* - **Suggestion Management**: Control chat suggestions programmatically
|
|
15
|
-
*
|
|
16
|
-
* ## What's Included:
|
|
17
|
-
*
|
|
18
|
-
* - `appendMessage` - Send messages to the chat
|
|
19
|
-
* - `setSuggestions` - Manually control suggestions
|
|
20
|
-
* - `generateSuggestions` - Trigger AI-powered suggestion generation
|
|
21
|
-
*
|
|
22
|
-
* ## What's NOT Included:
|
|
23
|
-
*
|
|
24
|
-
* - Message reading (`visibleMessages`)
|
|
25
|
-
* - Loading states (`isLoading`, `isLoadingSuggestions`)
|
|
26
|
-
* - Message management (`setMessages`, `deleteMessage`, `reloadMessages`)
|
|
27
|
-
* - Chat controls (`reset`, `stopGeneration`)
|
|
28
|
-
* - Advanced features (`mcpServers`, `runChatCompletion`, `interrupt`)
|
|
29
|
-
*
|
|
30
|
-
* ## Usage:
|
|
31
|
-
*
|
|
32
|
-
* ### Basic Messaging
|
|
33
|
-
*
|
|
34
|
-
* ```tsx
|
|
35
|
-
* import { useCopilotChatLite } from "@copilotkit/react-core";
|
|
36
|
-
* import { TextMessage, Role } from "@copilotkit/runtime-client-gql";
|
|
37
|
-
*
|
|
38
|
-
* export function BackgroundMessaging() {
|
|
39
|
-
* const { appendMessage } = useCopilotChatLite();
|
|
40
|
-
*
|
|
41
|
-
* const sendBackgroundMessage = async () => {
|
|
42
|
-
* await appendMessage(new TextMessage({
|
|
43
|
-
* content: "Process this data in the background",
|
|
44
|
-
* role: Role.User,
|
|
45
|
-
* }));
|
|
46
|
-
* };
|
|
47
|
-
*
|
|
48
|
-
* return <button onClick={sendBackgroundMessage}>Process Data</button>;
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* ### Suggestion Management
|
|
53
|
-
*
|
|
54
|
-
* ```tsx
|
|
55
|
-
* import { useCopilotChatLight } from "@copilotkit/react-core";
|
|
56
|
-
*
|
|
57
|
-
* export function SuggestionController() {
|
|
58
|
-
* const { setSuggestions, generateSuggestions } = useCopilotChatLight();
|
|
59
|
-
*
|
|
60
|
-
* const setCustomSuggestions = () => {
|
|
61
|
-
* setSuggestions([
|
|
62
|
-
* { title: "Analyze Data", message: "Analyze the current dataset" },
|
|
63
|
-
* { title: "Generate Report", message: "Create a summary report" }
|
|
64
|
-
* ]);
|
|
65
|
-
* };
|
|
66
|
-
*
|
|
67
|
-
* const triggerAISuggestions = async () => {
|
|
68
|
-
* await generateSuggestions();
|
|
69
|
-
* };
|
|
70
|
-
*
|
|
71
|
-
* return (
|
|
72
|
-
* <div>
|
|
73
|
-
* <button onClick={setCustomSuggestions}>Set Custom Suggestions</button>
|
|
74
|
-
* <button onClick={triggerAISuggestions}>Generate AI Suggestions</button>
|
|
75
|
-
* </div>
|
|
76
|
-
* );
|
|
77
|
-
* }
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* ### Automated Workflows
|
|
81
|
-
*
|
|
82
|
-
* ```tsx
|
|
83
|
-
* import { useCopilotChatLight } from "@copilotkit/react-core";
|
|
84
|
-
*
|
|
85
|
-
* export function AutomatedWorkflow() {
|
|
86
|
-
* const { appendMessage, setSuggestions } = useCopilotChatLight();
|
|
87
|
-
*
|
|
88
|
-
* const runWorkflow = async () => {
|
|
89
|
-
* // Step 1: Send initial message
|
|
90
|
-
* await appendMessage(new TextMessage({
|
|
91
|
-
* content: "Start workflow analysis",
|
|
92
|
-
* role: Role.User,
|
|
93
|
-
* }));
|
|
94
|
-
*
|
|
95
|
-
* // Step 2: Set contextual suggestions
|
|
96
|
-
* setSuggestions([
|
|
97
|
-
* { title: "Continue", message: "Continue to next step" },
|
|
98
|
-
* { title: "Stop", message: "Stop the workflow" }
|
|
99
|
-
* ]);
|
|
100
|
-
* };
|
|
101
|
-
*
|
|
102
|
-
* return <button onClick={runWorkflow}>Run Automated Workflow</button>;
|
|
103
|
-
* }
|
|
104
|
-
* ```
|
|
105
|
-
*
|
|
106
|
-
* ## Return Type:
|
|
107
|
-
*
|
|
108
|
-
* ```tsx
|
|
109
|
-
* const {
|
|
110
|
-
* appendMessage, // Send messages programmatically
|
|
111
|
-
* setSuggestions, // Set custom suggestions array
|
|
112
|
-
* generateSuggestions, // Trigger AI suggestion generation
|
|
113
|
-
* } = useCopilotChatLight();
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
|
|
117
|
-
import { Message } from "@copilotkit/shared";
|
|
118
|
-
import { AppendMessageOptions } from "./use-chat";
|
|
119
|
-
import { useCopilotChat as useCopilotChatInternal } from "./use-copilot-chat_internal";
|
|
120
|
-
import type { SuggestionItem } from "../utils";
|
|
121
|
-
|
|
122
|
-
export interface UseCopilotChatLightOptions {
|
|
123
|
-
/**
|
|
124
|
-
* A unique identifier for the chat. If not provided, a random one will be
|
|
125
|
-
* generated. When provided, the chat instance with the same `id` will
|
|
126
|
-
* have shared state across components.
|
|
127
|
-
*/
|
|
128
|
-
id?: string;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* HTTP headers to be sent with the API request.
|
|
132
|
-
*/
|
|
133
|
-
headers?: Record<string, string> | Headers;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Initial messages to populate the chat with.
|
|
137
|
-
*/
|
|
138
|
-
initialMessages?: Message[];
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* A function to generate the system message. Defaults to `defaultSystemMessage`.
|
|
142
|
-
*/
|
|
143
|
-
makeSystemMessage?: (contextString: string, additionalInstructions?: string) => string;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export interface UseCopilotChatLightReturn {
|
|
147
|
-
/**
|
|
148
|
-
* Send a new message to the chat programmatically.
|
|
149
|
-
*
|
|
150
|
-
* @param message - The message to send
|
|
151
|
-
* @param options - Optional configuration for the message
|
|
152
|
-
*
|
|
153
|
-
* @example
|
|
154
|
-
* ```tsx
|
|
155
|
-
* await appendMessage(new TextMessage({
|
|
156
|
-
* content: "Hello, process this request",
|
|
157
|
-
* role: Role.User,
|
|
158
|
-
* }));
|
|
159
|
-
* ```
|
|
160
|
-
*/
|
|
161
|
-
appendMessage: (message: Message, options?: AppendMessageOptions) => Promise<void>;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Manually set the suggestions array.
|
|
165
|
-
* Useful for custom suggestion workflows and manual control.
|
|
166
|
-
*
|
|
167
|
-
* @param suggestions - Array of suggestion items to display
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* ```tsx
|
|
171
|
-
* setSuggestions([
|
|
172
|
-
* { title: "Continue", message: "Continue the process" },
|
|
173
|
-
* { title: "Stop", message: "Stop the current operation" }
|
|
174
|
-
* ]);
|
|
175
|
-
* ```
|
|
176
|
-
*/
|
|
177
|
-
setSuggestions: (suggestions: SuggestionItem[]) => void;
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Trigger AI-powered suggestion generation.
|
|
181
|
-
* Uses configurations from `useCopilotChatSuggestions` hooks.
|
|
182
|
-
* Respects global debouncing - only one generation can run at a time.
|
|
183
|
-
*
|
|
184
|
-
* @returns Promise that resolves when suggestions are generated
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
* ```tsx
|
|
188
|
-
* await generateSuggestions();
|
|
189
|
-
* ```
|
|
190
|
-
*/
|
|
191
|
-
generateSuggestions: () => Promise<void>;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* A lightweight React hook for headless chat interactions.
|
|
196
|
-
* Perfect for programmatic messaging, background operations, and custom UI implementations.
|
|
197
|
-
*
|
|
198
|
-
* **Open Source Friendly** - Works without requiring a `publicApiKey`.
|
|
199
|
-
*
|
|
200
|
-
* @param options - Configuration options for the chat
|
|
201
|
-
* @returns Object containing appendMessage, setSuggestions, and generateSuggestions functions
|
|
202
|
-
*
|
|
203
|
-
* @example
|
|
204
|
-
* ```tsx
|
|
205
|
-
* const { appendMessage, setSuggestions, generateSuggestions } = useCopilotChatLite();
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
|
-
export function useCopilotChatLight(
|
|
209
|
-
options: UseCopilotChatLightOptions = {},
|
|
210
|
-
): UseCopilotChatLightReturn {
|
|
211
|
-
// Use the internal implementation (no API key required)
|
|
212
|
-
const { appendMessage, setSuggestions, generateSuggestions } = useCopilotChatInternal(options);
|
|
213
|
-
|
|
214
|
-
return {
|
|
215
|
-
appendMessage,
|
|
216
|
-
setSuggestions,
|
|
217
|
-
generateSuggestions,
|
|
218
|
-
};
|
|
219
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|