@copilotkit/react-core 0.0.0-main-20260402184302 → 0.0.0-main-20260403195251

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.
@@ -0,0 +1,667 @@
1
+ import { $t as CrewsAgentState, Bt as CoagentInChatRenderFunction, Gt as CoAgentStateRender, Ht as CopilotContext, Jt as LangGraphInterruptActionSetterArgs, Kt as LangGraphInterruptAction, Qt as QueuedInterruptEvent, T as useAgent, U as useRenderToolCall$1, Ut as CopilotContextParams, Vt as CopilotApiConfig, Wt as useCopilotContext, Xt as LangGraphInterruptRenderHandlerProps, Yt as LangGraphInterruptRender, Zt as LangGraphInterruptRenderProps, _n as FrontendActionAvailability, an as CopilotChatSuggestionConfiguration, cn as Tree, dn as ActionRenderPropsNoArgs, en as CrewsResponse, fn as ActionRenderPropsNoArgsWait, gn as FrontendAction, hn as CatchAllFrontendAction, in as CrewsToolStateItem, ln as TreeNode, mn as CatchAllActionRenderProps, n as defaultCopilotContextCategories, nn as CrewsStateItem, on as SystemMessageFunction, pn as ActionRenderPropsWait, qt as LangGraphInterruptActionSetter, r as CopilotKitProps, rn as CrewsTaskStateItem, sn as DocumentPointer, t as CopilotKit, tn as CrewsResponseStatus, un as ActionRenderProps, vn as RenderFunctionStatus } from "./copilotkit-BYNyIuE7.cjs";
2
+ import "./v2/index.cjs";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+ import { CopilotRuntimeClient, CopilotRuntimeClientOptions, ForwardedParametersInput, Message } from "@copilotkit/runtime-client-gql";
5
+ import React, { ReactNode, RefObject, SetStateAction } from "react";
6
+ import { AIMessage, CopilotErrorHandler, Message as Message$1, Parameter } from "@copilotkit/shared";
7
+ import { StaticSuggestionsConfig, Suggestion } from "@copilotkit/core";
8
+
9
+ //#region src/context/copilot-messages-context.d.ts
10
+ interface CopilotMessagesContextParams {
11
+ messages: Message[];
12
+ setMessages: React.Dispatch<React.SetStateAction<Message[]>>;
13
+ suggestions: Suggestion[];
14
+ setSuggestions: React.Dispatch<React.SetStateAction<Suggestion[]>>;
15
+ }
16
+ declare const CopilotMessagesContext: React.Context<CopilotMessagesContextParams>;
17
+ declare function useCopilotMessagesContext(): CopilotMessagesContextParams;
18
+ //#endregion
19
+ //#region src/context/coagent-state-renders-context.d.ts
20
+ interface StateRenderClaim {
21
+ stateRenderId: string;
22
+ stateSnapshot?: any;
23
+ runId?: string;
24
+ messageIndex?: number;
25
+ locked?: boolean;
26
+ }
27
+ type ClaimsRef = Record<string, StateRenderClaim>;
28
+ interface CoAgentStateRendersContextValue {
29
+ coAgentStateRenders: Record<string, CoAgentStateRender<any>>;
30
+ setCoAgentStateRender: (id: string, stateRender: CoAgentStateRender<any>) => void;
31
+ removeCoAgentStateRender: (id: string) => void;
32
+ claimsRef: RefObject<ClaimsRef>;
33
+ }
34
+ declare const CoAgentStateRendersContext: React.Context<CoAgentStateRendersContextValue | undefined>;
35
+ declare function CoAgentStateRendersProvider({
36
+ children
37
+ }: {
38
+ children: ReactNode;
39
+ }): react_jsx_runtime0.JSX.Element;
40
+ declare function useCoAgentStateRenders(): CoAgentStateRendersContextValue;
41
+ //#endregion
42
+ //#region src/context/threads-context.d.ts
43
+ interface ThreadsContextValue {
44
+ threadId: string;
45
+ setThreadId: (value: SetStateAction<string>) => void;
46
+ }
47
+ declare const ThreadsContext: React.Context<ThreadsContextValue | undefined>;
48
+ interface ThreadsProviderProps {
49
+ children: ReactNode;
50
+ threadId?: string;
51
+ }
52
+ declare function ThreadsProvider({
53
+ children,
54
+ threadId: explicitThreadId
55
+ }: ThreadsProviderProps): react_jsx_runtime0.JSX.Element;
56
+ declare function useThreads(): ThreadsContextValue;
57
+ //#endregion
58
+ //#region src/hooks/use-copilot-chat_internal.d.ts
59
+ /**
60
+ * The type of suggestions to use in the chat.
61
+ *
62
+ * `auto` - Suggestions are generated automatically.
63
+ * `manual` - Suggestions are controlled programmatically.
64
+ * `SuggestionItem[]` - Static suggestions array.
65
+ */
66
+ type ChatSuggestions = "auto" | "manual" | Omit<Suggestion, "isLoading">[];
67
+ interface AppendMessageOptions {
68
+ /**
69
+ * Whether to run the chat completion after appending the message. Defaults to `true`.
70
+ */
71
+ followUp?: boolean;
72
+ /**
73
+ * Whether to clear the suggestions after appending the message. Defaults to `true`.
74
+ */
75
+ clearSuggestions?: boolean;
76
+ }
77
+ interface OnStopGenerationArguments {
78
+ /**
79
+ * The name of the currently executing agent.
80
+ */
81
+ currentAgentName: string | undefined;
82
+ /**
83
+ * The messages in the chat.
84
+ */
85
+ messages: Message$1[];
86
+ }
87
+ type OnReloadMessagesArguments = OnStopGenerationArguments & {
88
+ /**
89
+ * The message on which "regenerate" was pressed
90
+ */
91
+ messageId: string;
92
+ };
93
+ type OnStopGeneration = (args: OnStopGenerationArguments) => void;
94
+ type OnReloadMessages = (args: OnReloadMessagesArguments) => void;
95
+ interface UseCopilotChatOptions {
96
+ /**
97
+ * A unique identifier for the chat. If not provided, a random one will be
98
+ * generated. When provided, the `useChat` hook with the same `id` will
99
+ * have shared states across components.
100
+ */
101
+ id?: string;
102
+ /**
103
+ * HTTP headers to be sent with the API request.
104
+ */
105
+ headers?: Record<string, string> | Headers;
106
+ /**
107
+ * Initial messages to populate the chat with.
108
+ */
109
+ initialMessages?: Message$1[];
110
+ /**
111
+ * A function to generate the system message. Defaults to `defaultSystemMessage`.
112
+ */
113
+ makeSystemMessage?: SystemMessageFunction;
114
+ /**
115
+ * Disables inclusion of CopilotKit’s default system message. When true, no system message is sent (this also suppresses any custom message from <code>makeSystemMessage</code>).
116
+ */
117
+ disableSystemMessage?: boolean;
118
+ /**
119
+ * Controls the behavior of suggestions in the chat interface.
120
+ *
121
+ * `auto` (default) - Suggestions are generated automatically:
122
+ * - When the chat is first opened (empty state)
123
+ * - After each message exchange completes
124
+ * - Uses configuration from `useCopilotChatSuggestions` hooks
125
+ *
126
+ * `manual` - Suggestions are controlled programmatically:
127
+ * - Use `setSuggestions()` to set custom suggestions
128
+ * - Use `generateSuggestions()` to trigger AI generation
129
+ * - Access via `useCopilotChat` hook
130
+ *
131
+ * `SuggestionItem[]` - Static suggestions array:
132
+ * - Always shows the same suggestions
133
+ * - No AI generation involved
134
+ */
135
+ suggestions?: ChatSuggestions;
136
+ onInProgress?: (isLoading: boolean) => void;
137
+ onSubmitMessage?: (messageContent: string) => Promise<void> | void;
138
+ onStopGeneration?: OnStopGeneration;
139
+ onReloadMessages?: OnReloadMessages;
140
+ }
141
+ interface MCPServerConfig {
142
+ endpoint: string;
143
+ apiKey?: string;
144
+ }
145
+ interface UseCopilotChatReturn$1 {
146
+ /**
147
+ * @deprecated use `messages` instead, this is an old non ag-ui version of the messages
148
+ * Array of messages currently visible in the chat interface
149
+ *
150
+ * This is the visible messages, not the raw messages from the runtime client.
151
+ */
152
+ visibleMessages: Message[];
153
+ /**
154
+ * The messages that are currently in the chat in AG-UI format.
155
+ */
156
+ messages: Message$1[];
157
+ /** @deprecated use `sendMessage` in `useCopilotChatHeadless_c` instead. This will be removed in a future major version. */
158
+ appendMessage: (message: Message, options?: AppendMessageOptions) => Promise<void>;
159
+ /**
160
+ * Send a new message to the chat
161
+ *
162
+ * ```tsx
163
+ * await sendMessage({
164
+ * id: "123",
165
+ * role: "user",
166
+ * content: "Hello, process this request",
167
+ * });
168
+ * ```
169
+ */
170
+ sendMessage: (message: Message$1, options?: AppendMessageOptions) => Promise<void>;
171
+ /**
172
+ * Replace all messages in the chat
173
+ *
174
+ * ```tsx
175
+ * setMessages([
176
+ * { id: "123", role: "user", content: "Hello, process this request" },
177
+ * { id: "456", role: "assistant", content: "Hello, I'm the assistant" },
178
+ * ]);
179
+ * ```
180
+ *
181
+ * **Deprecated** non-ag-ui version:
182
+ *
183
+ * ```tsx
184
+ * setMessages([
185
+ * new TextMessage({
186
+ * content: "Hello, process this request",
187
+ * role: gqlRole.User,
188
+ * }),
189
+ * new TextMessage({
190
+ * content: "Hello, I'm the assistant",
191
+ * role: gqlRole.Assistant,
192
+ * ]);
193
+ * ```
194
+ *
195
+ */
196
+ setMessages: (messages: Message$1[] | Message[]) => void;
197
+ /**
198
+ * Remove a specific message by ID
199
+ *
200
+ * ```tsx
201
+ * deleteMessage("123");
202
+ * ```
203
+ */
204
+ deleteMessage: (messageId: string) => void;
205
+ /**
206
+ * Regenerate the response for a specific message
207
+ *
208
+ * ```tsx
209
+ * reloadMessages("123");
210
+ * ```
211
+ */
212
+ reloadMessages: (messageId: string) => Promise<void>;
213
+ /**
214
+ * Stop the current message generation
215
+ *
216
+ * ```tsx
217
+ * if (isLoading) {
218
+ * stopGeneration();
219
+ * }
220
+ * ```
221
+ */
222
+ stopGeneration: () => void;
223
+ /**
224
+ * Clear all messages and reset chat state
225
+ *
226
+ * ```tsx
227
+ * reset();
228
+ * console.log(messages); // []
229
+ * ```
230
+ */
231
+ reset: () => void;
232
+ /**
233
+ * Whether the chat is currently generating a response
234
+ *
235
+ * ```tsx
236
+ * if (isLoading) {
237
+ * console.log("Loading...");
238
+ * } else {
239
+ * console.log("Not loading");
240
+ * }
241
+ */
242
+ isLoading: boolean;
243
+ /**
244
+ * Whether the chat agent is available to generate responses
245
+ *
246
+ * ```tsx
247
+ * if (isAvailable) {
248
+ * console.log("Loading...");
249
+ * } else {
250
+ * console.log("Not loading");
251
+ * }
252
+ */
253
+ isAvailable: boolean;
254
+ /** Manually trigger chat completion (advanced usage) */
255
+ runChatCompletion: () => Promise<Message$1[]>;
256
+ /** MCP (Model Context Protocol) server configurations */
257
+ mcpServers: MCPServerConfig[];
258
+ /** Update MCP server configurations */
259
+ setMcpServers: (mcpServers: MCPServerConfig[]) => void;
260
+ /**
261
+ * Current suggestions array
262
+ * Use this to read the current suggestions or in conjunction with setSuggestions for manual control
263
+ */
264
+ suggestions: Suggestion[];
265
+ /**
266
+ * Manually set suggestions
267
+ * Useful for manual mode or custom suggestion workflows
268
+ */
269
+ setSuggestions: (suggestions: Omit<Suggestion, "isLoading">[]) => void;
270
+ /**
271
+ * Trigger AI-powered suggestion generation
272
+ * Uses configurations from useCopilotChatSuggestions hooks
273
+ * Respects global debouncing - only one generation can run at a time
274
+ *
275
+ * ```tsx
276
+ * generateSuggestions();
277
+ * console.log(suggestions); // [suggestion1, suggestion2, suggestion3]
278
+ * ```
279
+ */
280
+ generateSuggestions: () => Promise<void>;
281
+ /**
282
+ * Clear all current suggestions
283
+ * Also resets suggestion generation state
284
+ */
285
+ resetSuggestions: () => void;
286
+ /** Whether suggestions are currently being generated */
287
+ isLoadingSuggestions: boolean;
288
+ /** Interrupt content for human-in-the-loop workflows */
289
+ interrupt: string | React.ReactElement | null;
290
+ agent?: ReturnType<typeof useAgent>["agent"];
291
+ threadId?: string;
292
+ }
293
+ declare function useCopilotChatInternal({
294
+ suggestions,
295
+ onInProgress,
296
+ onSubmitMessage,
297
+ onStopGeneration,
298
+ onReloadMessages
299
+ }?: UseCopilotChatOptions): UseCopilotChatReturn$1;
300
+ //#endregion
301
+ //#region src/hooks/use-copilot-chat.d.ts
302
+ type UseCopilotChatReturn = Omit<UseCopilotChatReturn$1, "messages" | "sendMessage" | "suggestions" | "setSuggestions" | "generateSuggestions" | "isLoadingSuggestions" | "resetSuggestions" | "interrupt" | "setMessages" | "deleteMessage">;
303
+ /**
304
+ * A lightweight React hook for headless chat interactions.
305
+ * Perfect for programmatic messaging, background operations, and custom UI implementations.
306
+ *
307
+ * **Open Source Friendly** - Works without requiring a `publicApiKey`.
308
+ */
309
+ declare function useCopilotChat(options?: UseCopilotChatOptions): UseCopilotChatReturn;
310
+ //#endregion
311
+ //#region src/hooks/use-copilot-chat-headless_c.d.ts
312
+ /**
313
+ * Enterprise React hook that provides complete chat functionality for fully custom UI implementations.
314
+ * Includes all advanced features like direct message access, suggestions array, interrupt handling, and MCP support.
315
+ *
316
+ * **Requires a publicApiKey** - Sign up for free at https://cloud.copilotkit.ai/
317
+ *
318
+ * @param options - Configuration options for the chat
319
+ * @returns Complete chat interface with all enterprise features
320
+ *
321
+ * @example
322
+ * ```tsx
323
+ * const { messages, sendMessage, suggestions, interrupt } = useCopilotChatHeadless_c();
324
+ * ```
325
+ */
326
+ declare function useCopilotChatHeadless_c(options?: UseCopilotChatOptions): UseCopilotChatReturn$1;
327
+ //#endregion
328
+ //#region src/hooks/use-copilot-action.d.ts
329
+ /**
330
+ * useCopilotAction is a legacy hook maintained for backwards compatibility.
331
+ *
332
+ * To avoid violating React's Rules of Hooks (which prohibit conditional hook calls),
333
+ * we use a registration pattern:
334
+ * 1. This hook registers the action configuration with the CopilotContext
335
+ * 2. A renderer component in CopilotKit actually renders the appropriate hook wrapper
336
+ * 3. React properly manages hook state since components are rendered, not conditionally called
337
+ *
338
+ * This allows action types to change between renders without corrupting React's hook state.
339
+ */
340
+ declare function useCopilotAction<const T extends Parameter[] | [] = []>(action: FrontendAction<T> | CatchAllFrontendAction, dependencies?: any[]): void;
341
+ //#endregion
342
+ //#region src/hooks/use-coagent-state-render.d.ts
343
+ /**
344
+ * This hook is used to render agent state with custom UI components or text. This is particularly
345
+ * useful for showing intermediate state or progress during Agentic Copilot operations.
346
+ * To get started using rendering intermediate state through this hook, checkout the documentation.
347
+ *
348
+ * https://docs.copilotkit.ai/coagents/shared-state/predictive-state-updates
349
+ */
350
+ declare function useCoAgentStateRender<T = any>(action: CoAgentStateRender<T>, dependencies?: any[]): void;
351
+ //#endregion
352
+ //#region src/hooks/use-make-copilot-document-readable.d.ts
353
+ /**
354
+ * Makes a document readable by Copilot.
355
+ * @param document The document to make readable.
356
+ * @param categories The categories to associate with the document.
357
+ * @param dependencies The dependencies to use for the effect.
358
+ * @returns The id of the document.
359
+ */
360
+ declare function useMakeCopilotDocumentReadable(document: DocumentPointer, categories?: string[], dependencies?: any[]): string | undefined;
361
+ //#endregion
362
+ //#region src/hooks/use-copilot-readable.d.ts
363
+ /**
364
+ * Options for the useCopilotReadable hook.
365
+ */
366
+ interface UseCopilotReadableOptions {
367
+ /**
368
+ * The description of the information to be added to the Copilot context.
369
+ */
370
+ description: string;
371
+ /**
372
+ * The value to be added to the Copilot context. Object values are automatically stringified.
373
+ */
374
+ value: any;
375
+ /**
376
+ * The ID of the parent context, if any.
377
+ */
378
+ parentId?: string;
379
+ /**
380
+ * An array of categories to control which context are visible where. Particularly useful
381
+ * with CopilotTextarea (see `useMakeAutosuggestionFunction`)
382
+ */
383
+ categories?: string[];
384
+ /**
385
+ * Whether the context is available to the Copilot.
386
+ */
387
+ available?: "enabled" | "disabled";
388
+ /**
389
+ * A custom conversion function to use to serialize the value to a string. If not provided, the value
390
+ * will be serialized using `JSON.stringify`.
391
+ */
392
+ convert?: (description: string, value: any) => string;
393
+ }
394
+ /**
395
+ * Adds the given information to the Copilot context to make it readable by Copilot.
396
+ */
397
+ declare function useCopilotReadable({
398
+ description,
399
+ value,
400
+ convert,
401
+ available
402
+ }: UseCopilotReadableOptions, dependencies?: any[]): string | undefined;
403
+ //#endregion
404
+ //#region src/hooks/use-coagent.d.ts
405
+ interface UseCoagentOptionsBase {
406
+ /**
407
+ * The name of the agent being used.
408
+ */
409
+ name: string;
410
+ /**
411
+ * @deprecated - use "config.configurable"
412
+ * Config to pass to a LangGraph Agent
413
+ */
414
+ configurable?: Record<string, any>;
415
+ /**
416
+ * Config to pass to a LangGraph Agent
417
+ */
418
+ config?: {
419
+ configurable?: Record<string, any>;
420
+ [key: string]: any;
421
+ };
422
+ }
423
+ interface WithInternalStateManagementAndInitial<T> extends UseCoagentOptionsBase {
424
+ /**
425
+ * The initial state of the agent.
426
+ */
427
+ initialState: T;
428
+ }
429
+ interface WithInternalStateManagement extends UseCoagentOptionsBase {
430
+ /**
431
+ * Optional initialState with default type any
432
+ */
433
+ initialState?: any;
434
+ }
435
+ interface WithExternalStateManagement<T> extends UseCoagentOptionsBase {
436
+ /**
437
+ * The current state of the agent.
438
+ */
439
+ state: T;
440
+ /**
441
+ * A function to update the state of the agent.
442
+ */
443
+ setState: (newState: T | ((prevState: T | undefined) => T)) => void;
444
+ }
445
+ type UseCoagentOptions<T> = WithInternalStateManagementAndInitial<T> | WithInternalStateManagement | WithExternalStateManagement<T>;
446
+ interface UseCoagentReturnType<T> {
447
+ /**
448
+ * The name of the agent being used.
449
+ */
450
+ name: string;
451
+ /**
452
+ * The name of the current LangGraph node.
453
+ */
454
+ nodeName?: string;
455
+ /**
456
+ * The ID of the thread the agent is running in.
457
+ */
458
+ threadId?: string;
459
+ /**
460
+ * A boolean indicating if the agent is currently running.
461
+ */
462
+ running: boolean;
463
+ /**
464
+ * The current state of the agent.
465
+ */
466
+ state: T;
467
+ /**
468
+ * A function to update the state of the agent.
469
+ */
470
+ setState: (newState: T | ((prevState: T | undefined) => T)) => void;
471
+ /**
472
+ * A function to start the agent.
473
+ */
474
+ start: () => void;
475
+ /**
476
+ * A function to stop the agent.
477
+ */
478
+ stop: () => void;
479
+ /**
480
+ * A function to re-run the agent. The hint function can be used to provide a hint to the agent
481
+ * about why it is being re-run again.
482
+ */
483
+ run: (...args: any[]) => Promise<any>;
484
+ }
485
+ interface HintFunctionParams {
486
+ /**
487
+ * The previous state of the agent.
488
+ */
489
+ previousState: any;
490
+ /**
491
+ * The current state of the agent.
492
+ */
493
+ currentState: any;
494
+ }
495
+ type HintFunction = (params: HintFunctionParams) => Message$1 | undefined;
496
+ /**
497
+ * This hook is used to integrate an agent into your application. With its use, you can
498
+ * render and update the state of the agent, allowing for a dynamic and interactive experience.
499
+ * We call these shared state experiences "agentic copilots". To get started using agentic copilots, which
500
+ * we refer to as CoAgents, checkout the documentation at https://docs.copilotkit.ai/coagents/quickstart/langgraph.
501
+ */
502
+ declare function useCoAgent<T = any>(options: UseCoagentOptions<T>): UseCoagentReturnType<T>;
503
+ //#endregion
504
+ //#region src/hooks/use-copilot-runtime-client.d.ts
505
+ interface CopilotRuntimeClientHookOptions extends CopilotRuntimeClientOptions {
506
+ showDevConsole?: boolean;
507
+ onError: CopilotErrorHandler;
508
+ }
509
+ declare const useCopilotRuntimeClient: (options: CopilotRuntimeClientHookOptions) => CopilotRuntimeClient;
510
+ //#endregion
511
+ //#region src/hooks/use-copilot-authenticated-action.d.ts
512
+ /**
513
+ * Hook to create an authenticated action that requires user sign-in before execution.
514
+ *
515
+ * @remarks
516
+ * This feature is only available when using CopilotKit's hosted cloud service.
517
+ * To use this feature, sign up at https://cloud.copilotkit.ai to get your publicApiKey.
518
+ *
519
+ * @param action - The frontend action to be wrapped with authentication
520
+ * @param dependencies - Optional array of dependencies that will trigger recreation of the action when changed
521
+ */
522
+ declare function useCopilotAuthenticatedAction_c<T extends Parameter[]>(action: FrontendAction<T>, dependencies?: any[]): void;
523
+ //#endregion
524
+ //#region src/hooks/use-langgraph-interrupt.d.ts
525
+ declare function useLangGraphInterrupt<TEventValue = any>(action: Omit<LangGraphInterruptRender<TEventValue>, "id">, _dependencies?: any[]): void;
526
+ //#endregion
527
+ //#region src/hooks/use-copilot-additional-instructions.d.ts
528
+ /**
529
+ * Options for the useCopilotAdditionalInstructions hook.
530
+ */
531
+ interface UseCopilotAdditionalInstructionsOptions {
532
+ /**
533
+ * The instructions to be added to the Copilot. Will be added to the instructions like so:
534
+ *
535
+ * ```txt
536
+ * You are a helpful assistant.
537
+ * Additionally, follow these instructions:
538
+ * - Do not answer questions about the weather.
539
+ * - Do not answer questions about the stock market.
540
+ * ```
541
+ */
542
+ instructions: string;
543
+ /**
544
+ * Whether the instructions are available to the Copilot.
545
+ */
546
+ available?: "enabled" | "disabled";
547
+ }
548
+ /**
549
+ * Adds the given instructions to the Copilot context.
550
+ */
551
+ declare function useCopilotAdditionalInstructions({
552
+ instructions,
553
+ available
554
+ }: UseCopilotAdditionalInstructionsOptions, dependencies?: any[]): void;
555
+ //#endregion
556
+ //#region src/hooks/use-frontend-tool.d.ts
557
+ type UseFrontendToolArgs<T extends Parameter[] | [] = []> = {
558
+ available?: "disabled" | "enabled";
559
+ } & Pick<FrontendAction<T>, "name" | "description" | "parameters" | "handler" | "followUp" | "render">;
560
+ declare function useFrontendTool<const T extends Parameter[] = []>(tool: UseFrontendToolArgs<T>, dependencies?: any[]): void;
561
+ //#endregion
562
+ //#region src/hooks/use-human-in-the-loop.d.ts
563
+ type UseHumanInTheLoopArgs<T extends Parameter[] | [] = []> = {
564
+ available?: "disabled" | "enabled";
565
+ render: FrontendAction<T>["renderAndWaitForResponse"];
566
+ followUp?: FrontendAction<T>["followUp"];
567
+ } & Pick<FrontendAction<T>, "name" | "description" | "parameters">;
568
+ declare function useHumanInTheLoop<const T extends Parameter[] | [] = []>(tool: UseHumanInTheLoopArgs<T>, dependencies?: any[]): void;
569
+ //#endregion
570
+ //#region src/hooks/use-render-tool-call.d.ts
571
+ type UseRenderToolCallArgs<T extends Parameter[] | [] = []> = Pick<FrontendAction<T>, "name" | "description" | "parameters"> & {
572
+ available?: "disabled" | "enabled";
573
+ render: T extends [] ? (props: ActionRenderPropsNoArgs<T>) => React.ReactElement : (props: ActionRenderProps<T>) => React.ReactElement;
574
+ };
575
+ declare function useRenderToolCall<const T extends Parameter[] | [] = []>(tool: UseRenderToolCallArgs<T>, dependencies?: any[]): void;
576
+ //#endregion
577
+ //#region src/hooks/use-default-tool.d.ts
578
+ declare function useDefaultTool(tool: Omit<CatchAllFrontendAction, "name">, dependencies?: any[]): void;
579
+ //#endregion
580
+ //#region src/hooks/use-lazy-tool-renderer.d.ts
581
+ declare function useLazyToolRenderer(): (message?: AIMessage, messages?: Message$1[]) => null | (() => ReturnType<ReturnType<typeof useRenderToolCall$1>> | null);
582
+ //#endregion
583
+ //#region src/hooks/use-copilot-chat-suggestions.d.ts
584
+ type StaticSuggestionInput = Omit<Suggestion, "isLoading"> & Partial<Pick<Suggestion, "isLoading">>;
585
+ type StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, "suggestions"> & {
586
+ suggestions: StaticSuggestionInput[];
587
+ };
588
+ type DynamicSuggestionsConfigInput = {
589
+ /**
590
+ * A prompt or instructions for the GPT to generate suggestions.
591
+ */
592
+ instructions: string;
593
+ /**
594
+ * The minimum number of suggestions to generate. Defaults to `1`.
595
+ * @default 1
596
+ */
597
+ minSuggestions?: number;
598
+ /**
599
+ * The maximum number of suggestions to generate. Defaults to `3`.
600
+ * @default 1
601
+ */
602
+ maxSuggestions?: number;
603
+ /**
604
+ * Whether the suggestions are available. Defaults to `enabled`.
605
+ * @default enabled
606
+ */
607
+ available?: "enabled" | "disabled" | "always" | "before-first-message" | "after-first-message";
608
+ /**
609
+ * An optional class name to apply to the suggestions.
610
+ */
611
+ className?: string;
612
+ };
613
+ type UseCopilotChatSuggestionsConfiguration = DynamicSuggestionsConfigInput | StaticSuggestionsConfigInput;
614
+ declare function useCopilotChatSuggestions(config: UseCopilotChatSuggestionsConfiguration, dependencies?: any[]): void;
615
+ //#endregion
616
+ //#region src/lib/copilot-task.d.ts
617
+ interface CopilotTaskConfig {
618
+ /**
619
+ * The instructions to be given to the assistant.
620
+ */
621
+ instructions: string;
622
+ /**
623
+ * An array of action definitions that can be called.
624
+ */
625
+ actions?: FrontendAction<any>[];
626
+ /**
627
+ * Whether to include the copilot readable context in the task.
628
+ */
629
+ includeCopilotReadable?: boolean;
630
+ /**
631
+ * Whether to include actions defined via useCopilotAction in the task.
632
+ */
633
+ includeCopilotActions?: boolean;
634
+ /**
635
+ * The forwarded parameters to use for the task.
636
+ */
637
+ forwardedParameters?: ForwardedParametersInput;
638
+ }
639
+ declare class CopilotTask<T = any> {
640
+ private instructions;
641
+ private actions;
642
+ private includeCopilotReadable;
643
+ private includeCopilotActions;
644
+ private forwardedParameters?;
645
+ constructor(config: CopilotTaskConfig);
646
+ /**
647
+ * Run the task.
648
+ * @param context The CopilotContext to use for the task. Use `useCopilotContext` to obtain the current context.
649
+ * @param data The data to use for the task.
650
+ */
651
+ run(context: CopilotContextParams, data?: T): Promise<void>;
652
+ }
653
+ //#endregion
654
+ //#region src/utils/suggestions-constants.d.ts
655
+ /**
656
+ * Constants for suggestions retry logic
657
+ */
658
+ declare const SUGGESTION_RETRY_CONFIG: {
659
+ readonly MAX_RETRIES: 3;
660
+ readonly COOLDOWN_MS: 5000;
661
+ };
662
+ //#endregion
663
+ //#region src/utils/dev-console.d.ts
664
+ declare function shouldShowDevConsole(showDevConsole?: boolean): boolean;
665
+ //#endregion
666
+ export { ActionRenderProps, ActionRenderPropsNoArgs, ActionRenderPropsNoArgsWait, ActionRenderPropsWait, CatchAllActionRenderProps, CatchAllFrontendAction, type ChatSuggestions, CoAgentStateRendersContext, type CoAgentStateRendersContextValue, CoAgentStateRendersProvider, type CoagentInChatRenderFunction, type CopilotApiConfig, CopilotChatSuggestionConfiguration, CopilotContext, type CopilotContextParams, CopilotKit, type CopilotKitProps, CopilotMessagesContext, type CopilotMessagesContextParams, CopilotTask, CopilotTaskConfig, CrewsAgentState, CrewsResponse, CrewsResponseStatus, CrewsStateItem, CrewsTaskStateItem, CrewsToolStateItem, DocumentPointer, FrontendAction, FrontendActionAvailability, type HintFunction, LangGraphInterruptAction, LangGraphInterruptActionSetter, LangGraphInterruptActionSetterArgs, LangGraphInterruptRender, LangGraphInterruptRenderHandlerProps, LangGraphInterruptRenderProps, type OnReloadMessages, type OnStopGeneration, QueuedInterruptEvent, RenderFunctionStatus, SUGGESTION_RETRY_CONFIG, SystemMessageFunction, ThreadsContext, type ThreadsContextValue, ThreadsProvider, type ThreadsProviderProps, type Tree, type TreeNode, type UseCopilotChatOptions, type UseCopilotChatOptions as UseCopilotChatOptions_c, type UseCopilotChatReturn, type UseCopilotChatReturn$1 as UseCopilotChatReturn_c, type UseCopilotChatSuggestionsConfiguration, defaultCopilotContextCategories, shouldShowDevConsole, useCoAgent, useCoAgentStateRender, useCoAgentStateRenders, useCopilotAction, useCopilotAdditionalInstructions, useCopilotAuthenticatedAction_c, useCopilotChat, useCopilotChatHeadless_c, useCopilotChatInternal, useCopilotChatSuggestions, useCopilotContext, useCopilotMessagesContext, useCopilotReadable, useCopilotRuntimeClient, useDefaultTool, useFrontendTool, useHumanInTheLoop, useLangGraphInterrupt, useLazyToolRenderer, useMakeCopilotDocumentReadable, useRenderToolCall, useThreads };
667
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/context/copilot-messages-context.tsx","../src/context/coagent-state-renders-context.tsx","../src/context/threads-context.tsx","../src/hooks/use-copilot-chat_internal.ts","../src/hooks/use-copilot-chat.ts","../src/hooks/use-copilot-chat-headless_c.ts","../src/hooks/use-copilot-action.ts","../src/hooks/use-coagent-state-render.ts","../src/hooks/use-make-copilot-document-readable.ts","../src/hooks/use-copilot-readable.ts","../src/hooks/use-coagent.ts","../src/hooks/use-copilot-runtime-client.ts","../src/hooks/use-copilot-authenticated-action.ts","../src/hooks/use-langgraph-interrupt.ts","../src/hooks/use-copilot-additional-instructions.ts","../src/hooks/use-frontend-tool.ts","../src/hooks/use-human-in-the-loop.ts","../src/hooks/use-render-tool-call.ts","../src/hooks/use-default-tool.ts","../src/hooks/use-lazy-tool-renderer.tsx","../src/hooks/use-copilot-chat-suggestions.tsx","../src/lib/copilot-task.ts","../src/utils/suggestions-constants.ts","../src/utils/dev-console.ts"],"mappings":";;;;;;;;;UAQiB,4BAAA;EACf,QAAA,EAAU,OAAA;EACV,WAAA,EAAa,KAAA,CAAM,QAAA,CAAS,KAAA,CAAM,cAAA,CAAe,OAAA;EACjD,WAAA,EAAa,UAAA;EACb,cAAA,EAAgB,KAAA,CAAM,QAAA,CAAS,KAAA,CAAM,cAAA,CAAe,UAAA;AAAA;AAAA,cAWzC,sBAAA,EAAsB,KAAA,CAAA,OAAA,CAAA,4BAAA;AAAA,iBAGnB,yBAAA,CAAA,GAA6B,4BAAA;;;UCfnC,gBAAA;EACR,aAAA;EACA,aAAA;EACA,KAAA;EACA,YAAA;EACA,MAAA;AAAA;AAAA,KAGG,SAAA,GAAY,MAAA,SAAe,gBAAA;AAAA,UAEf,+BAAA;EACf,mBAAA,EAAqB,MAAA,SAAe,kBAAA;EACpC,qBAAA,GACE,EAAA,UACA,WAAA,EAAa,kBAAA;EAEf,wBAAA,GAA2B,EAAA;EAC3B,SAAA,EAAW,SA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