@copilotkit/react-core 1.68.3 → 1.69.1
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/dist/{copilotkit-BUIK5yln.d.mts → copilotkit-DYKpg4pD.d.mts} +34 -25
- package/dist/copilotkit-DYKpg4pD.d.mts.map +1 -0
- package/dist/{copilotkit-Bocmlr37.cjs → copilotkit-Dr0speVK.cjs} +454 -48
- package/dist/copilotkit-Dr0speVK.cjs.map +1 -0
- package/dist/{copilotkit-C4RqjAba.mjs → copilotkit-Dr6g885f.mjs} +456 -50
- package/dist/copilotkit-Dr6g885f.mjs.map +1 -0
- package/dist/{copilotkit-DSvKW3SS.d.cts → copilotkit-Hl1t9Y1v.d.cts} +34 -25
- package/dist/copilotkit-Hl1t9Y1v.d.cts.map +1 -0
- package/dist/index.cjs +119 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +904 -28
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +904 -28
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +119 -75
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +185 -101
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +3 -2
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +5 -4
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +5 -4
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +3 -2
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.css +1 -1
- package/dist/v2/index.d.cts +2 -2
- package/dist/v2/index.d.mts +2 -2
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +451 -45
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/skills/react-core/SKILL.md +1 -1
- package/skills/react-core/references/provider-setup.md +23 -2
- package/skills/react-core/references/threads.md +3 -4
- package/dist/copilotkit-BUIK5yln.d.mts.map +0 -1
- package/dist/copilotkit-Bocmlr37.cjs.map +0 -1
- package/dist/copilotkit-C4RqjAba.mjs.map +0 -1
- package/dist/copilotkit-DSvKW3SS.d.cts.map +0 -1
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","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":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/v1-deprecated/context/copilot-messages-context.tsx","../src/v1-deprecated/context/coagent-state-renders-context.tsx","../src/v1-deprecated/context/threads-context.tsx","../src/v1-deprecated/hooks/use-copilot-chat_internal.ts","../src/v1-deprecated/hooks/use-copilot-chat.ts","../src/v1-deprecated/hooks/use-copilot-chat-headless_c.ts","../src/v1-deprecated/hooks/use-copilot-action.ts","../src/v1-deprecated/hooks/use-coagent-state-render.ts","../src/v1-deprecated/hooks/use-make-copilot-document-readable.ts","../src/v1-deprecated/hooks/use-copilot-readable.ts","../src/v1-deprecated/hooks/use-coagent.ts","../src/v1-deprecated/hooks/use-copilot-runtime-client.ts","../src/v1-deprecated/hooks/use-copilot-authenticated-action.ts","../src/v1-deprecated/hooks/use-langgraph-interrupt.ts","../src/v1-deprecated/hooks/use-copilot-additional-instructions.ts","../src/v1-deprecated/hooks/use-frontend-tool.ts","../src/v1-deprecated/hooks/use-human-in-the-loop.ts","../src/v1-deprecated/hooks/use-render-tool-call.ts","../src/v1-deprecated/hooks/use-default-tool.ts","../src/v1-deprecated/hooks/use-lazy-tool-renderer.tsx","../src/v1-deprecated/hooks/use-copilot-chat-suggestions.tsx","../src/v1-deprecated/lib/copilot-task.ts","../src/v1-deprecated/utils/suggestions-constants.ts","../src/v1-deprecated/utils/dev-console.ts"],"mappings":";;;;;;;;;UAyCiB,4BAAA;EACf,QAAA,EAAU,SAAA;EACV,WAAA,EAAa,KAAA,CAAM,QAAA,CAAS,KAAA,CAAM,cAAA,CAAe,SAAA;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;;;UCTnC,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,SAAA,CAAU,SAAA;AAAA;AAAA,cAGjB,0BAAA,EAA0B,KAAA,CAAA,OAAA,CAAA,+BAAA;AAAA,iBAIhB,2BAAA,CAAA;EACd;AAAA;EAEA,QAAA,EAAU,SAAA;AAAA,IACX,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA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;;EAIf,YAAA;;;ApBjDgE;EoBqDhE,OAAA,GAAU,cAAA;;;;EAIV,sBAAA;EpBpDA;;;EoByDA,qBAAA;EpBvDM;AAAA;;EoB4DN,mBAAA,GAAsB,wBAAA;AAAA;AAAA,cAGX,WAAA;EAAA,QACH,YAAA;EAAA,QACA,OAAA;EAAA,QACA,sBAAA;EAAA,QACA,qBAAA;EAAA,QACA,mBAAA;cACI,MAAA,EAAQ,iBAAA;EpBzDC;;;;;EoBsEf,GAAA,CAAI,OAAA,EAAS,oBAAA,EAAsB,IAAA,GAAO,CAAA,GAAI,OAAA;AAAA;;;;;;cClHzC,uBAAA;EAAA,SAGH,WAAA;EAAA,SAAA,WAAA;AAAA;;;iBCEM,oBAAA,CAAqB,cAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { Dt as useRenderToolCall$1, Mt as useCopilotChatConfiguration, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, a as ThreadsProvider, c as CoAgentStateRendersProvider, ct as useRenderCustomMessages, d as shouldShowDevConsole, f as useToast, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, nt as useHumanInTheLoop$1, o as useThreads, ot as useFrontendTool$1, p as CopilotMessagesContext, pt as defineToolCallRenderer, r as CoAgentStateRenderBridge, s as CoAgentStateRendersContext, t as CopilotKit, tt as useAgent, u as useAsyncCallback, ut as useCopilotKit } from "./copilotkit-
|
|
3
|
+
import { Dt as useRenderToolCall$1, Mt as useCopilotChatConfiguration, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, a as ThreadsProvider, c as CoAgentStateRendersProvider, ct as useRenderCustomMessages, d as shouldShowDevConsole, f as useToast, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, nt as useHumanInTheLoop$1, o as useThreads, ot as useFrontendTool$1, p as CopilotMessagesContext, pt as defineToolCallRenderer, r as CoAgentStateRenderBridge, s as CoAgentStateRendersContext, t as CopilotKit, tt as useAgent, u as useAsyncCallback, ut as useCopilotKit } from "./copilotkit-Dr6g885f.mjs";
|
|
4
4
|
import React, { Fragment, createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { CopilotKitCoreRuntimeConnectionStatus, ToolCallStatus } from "@copilotkit/core";
|
|
6
6
|
import { AGUIConnectNotImplementedError, HttpAgent } from "@ag-ui/client";
|
|
7
7
|
import { CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitRemoteEndpointDiscoveryError, ErrorVisibility, Severity, actionParametersToJsonSchema, getZodParameters, parseJson, randomId, styledConsole } from "@copilotkit/shared";
|
|
8
8
|
import { ActionInputAvailability, CopilotRequestType, CopilotRuntimeClient, Message as Message$1, MetaEventName, Role, TextMessage, convertGqlOutputToMessages, convertMessagesToGqlInput, filterAgentStateMessages, gqlToAGUI } from "@copilotkit/runtime-client-gql";
|
|
9
9
|
|
|
10
|
-
//#region src/utils/suggestions-constants.ts
|
|
10
|
+
//#region src/v1-deprecated/utils/suggestions-constants.ts
|
|
11
11
|
/**
|
|
12
12
|
* Constants for suggestions retry logic
|
|
13
13
|
*/
|
|
@@ -17,7 +17,7 @@ const SUGGESTION_RETRY_CONFIG = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
//#endregion
|
|
20
|
-
//#region src/hooks/use-lazy-tool-renderer.tsx
|
|
20
|
+
//#region src/v1-deprecated/hooks/use-lazy-tool-renderer.tsx
|
|
21
21
|
function useLazyToolRenderer() {
|
|
22
22
|
const renderToolCall = useRenderToolCall$1();
|
|
23
23
|
return useCallback((message, messages) => {
|
|
@@ -33,7 +33,7 @@ function useLazyToolRenderer() {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
36
|
-
//#region src/hooks/use-copilot-chat_internal.ts
|
|
36
|
+
//#region src/v1-deprecated/hooks/use-copilot-chat_internal.ts
|
|
37
37
|
function useCopilotChatInternal({ suggestions, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages } = {}) {
|
|
38
38
|
const { copilotkit } = useCopilotKit();
|
|
39
39
|
const { threadId, agentSession } = useCopilotContext();
|
|
@@ -334,7 +334,7 @@ function useLegacyCoagentRenderer({ copilotkit, agent, agentId, threadId }) {
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
//#endregion
|
|
337
|
-
//#region src/hooks/use-copilot-chat.ts
|
|
337
|
+
//#region src/v1-deprecated/hooks/use-copilot-chat.ts
|
|
338
338
|
/**
|
|
339
339
|
* A lightweight React hook for headless chat interactions.
|
|
340
340
|
* Perfect for programmatic messaging, background operations, and custom UI implementations.
|
|
@@ -358,12 +358,12 @@ function useCopilotChat(options = {}) {
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
//#endregion
|
|
361
|
-
//#region src/hooks/use-copilot-chat-headless_c.ts
|
|
361
|
+
//#region src/v1-deprecated/hooks/use-copilot-chat-headless_c.ts
|
|
362
362
|
/**
|
|
363
363
|
* `useCopilotChatHeadless_c` is for building fully custom UI (headless UI) implementations.
|
|
364
364
|
*
|
|
365
|
-
* <Callout title="This is
|
|
366
|
-
* Read more about <a href="/premium/overview">
|
|
365
|
+
* <Callout title="This is a CopilotKit Intelligence feature">
|
|
366
|
+
* Read more about <a href="/premium/overview">CopilotKit Intelligence</a>.
|
|
367
367
|
*
|
|
368
368
|
* Usage is generous and **free** to get started.
|
|
369
369
|
* </Callout>
|
|
@@ -542,11 +542,11 @@ const createNonFunctionalReturn = () => ({
|
|
|
542
542
|
interrupt: null
|
|
543
543
|
});
|
|
544
544
|
/**
|
|
545
|
-
*
|
|
545
|
+
* CopilotKit Intelligence React hook that provides complete chat functionality for fully custom UI implementations.
|
|
546
546
|
* Includes all advanced features like direct message access, suggestions array, interrupt handling, and MCP support.
|
|
547
547
|
*
|
|
548
548
|
* @param options - Configuration options for the chat
|
|
549
|
-
* @returns Complete chat interface with all
|
|
549
|
+
* @returns Complete chat interface with all CopilotKit Intelligence features
|
|
550
550
|
*
|
|
551
551
|
* @example
|
|
552
552
|
* ```tsx
|
|
@@ -560,7 +560,7 @@ function useCopilotChatHeadless_c(options = {}) {
|
|
|
560
560
|
useEffect(() => {
|
|
561
561
|
if (!hasPublicApiKey) {
|
|
562
562
|
setBannerError(new CopilotKitError({
|
|
563
|
-
message: "You're using useCopilotChatHeadless_c,
|
|
563
|
+
message: "You're using useCopilotChatHeadless_c, a CopilotKit Intelligence feature that offers extensive headless chat capabilities. To continue, you'll need to provide a free public license key.",
|
|
564
564
|
code: CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
|
|
565
565
|
severity: Severity.WARNING,
|
|
566
566
|
visibility: ErrorVisibility.BANNER
|
|
@@ -573,7 +573,26 @@ function useCopilotChatHeadless_c(options = {}) {
|
|
|
573
573
|
}
|
|
574
574
|
|
|
575
575
|
//#endregion
|
|
576
|
-
//#region src/hooks/use-frontend-tool.ts
|
|
576
|
+
//#region src/v1-deprecated/hooks/use-frontend-tool.ts
|
|
577
|
+
/**
|
|
578
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useFrontendTool` from `@copilotkit/react-core/v2` instead.
|
|
579
|
+
*
|
|
580
|
+
* ```tsx
|
|
581
|
+
* import { useFrontendTool } from "@copilotkit/react-core/v2";
|
|
582
|
+
* import { z } from "zod";
|
|
583
|
+
*
|
|
584
|
+
* function MyComponent() {
|
|
585
|
+
* useFrontendTool({
|
|
586
|
+
* name: "myTool",
|
|
587
|
+
* description: "Run my tool",
|
|
588
|
+
* parameters: z.object({}),
|
|
589
|
+
* handler: async () => "done",
|
|
590
|
+
* });
|
|
591
|
+
* return null;
|
|
592
|
+
* }
|
|
593
|
+
* ```
|
|
594
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useFrontendTool
|
|
595
|
+
*/
|
|
577
596
|
function useFrontendTool(tool, dependencies) {
|
|
578
597
|
const { name, description, parameters, render, followUp, available } = tool;
|
|
579
598
|
const zodParameters = getZodParameters(parameters);
|
|
@@ -611,7 +630,27 @@ function useFrontendTool(tool, dependencies) {
|
|
|
611
630
|
}
|
|
612
631
|
|
|
613
632
|
//#endregion
|
|
614
|
-
//#region src/hooks/use-render-tool-call.ts
|
|
633
|
+
//#region src/v1-deprecated/hooks/use-render-tool-call.ts
|
|
634
|
+
/**
|
|
635
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useRenderTool` from `@copilotkit/react-core/v2` instead.
|
|
636
|
+
*
|
|
637
|
+
* ```tsx
|
|
638
|
+
* import { useRenderTool } from "@copilotkit/react-core/v2";
|
|
639
|
+
* import { z } from "zod";
|
|
640
|
+
*
|
|
641
|
+
* function StatusTool() {
|
|
642
|
+
* useRenderTool({
|
|
643
|
+
* name: "showStatus",
|
|
644
|
+
* parameters: z.object({}),
|
|
645
|
+
* render: ({ status, result }) => (
|
|
646
|
+
* <div>{status === "complete" ? result : "Running..."}</div>
|
|
647
|
+
* ),
|
|
648
|
+
* });
|
|
649
|
+
* return null;
|
|
650
|
+
* }
|
|
651
|
+
* ```
|
|
652
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useRenderTool
|
|
653
|
+
*/
|
|
615
654
|
function useRenderToolCall(tool, dependencies) {
|
|
616
655
|
const { copilotkit } = useCopilotKit();
|
|
617
656
|
const hasAddedRef = useRef(false);
|
|
@@ -651,7 +690,28 @@ function useRenderToolCall(tool, dependencies) {
|
|
|
651
690
|
}
|
|
652
691
|
|
|
653
692
|
//#endregion
|
|
654
|
-
//#region src/hooks/use-human-in-the-loop.ts
|
|
693
|
+
//#region src/v1-deprecated/hooks/use-human-in-the-loop.ts
|
|
694
|
+
/**
|
|
695
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useHumanInTheLoop` from `@copilotkit/react-core/v2` instead.
|
|
696
|
+
*
|
|
697
|
+
* ```tsx
|
|
698
|
+
* import { useHumanInTheLoop } from "@copilotkit/react-core/v2";
|
|
699
|
+
* import { z } from "zod";
|
|
700
|
+
*
|
|
701
|
+
* function Confirmation() {
|
|
702
|
+
* useHumanInTheLoop({
|
|
703
|
+
* name: "confirmAction",
|
|
704
|
+
* description: "Ask the user to confirm",
|
|
705
|
+
* parameters: z.object({}),
|
|
706
|
+
* render: ({ respond }) => (
|
|
707
|
+
* <button onClick={() => respond?.(true)}>Confirm</button>
|
|
708
|
+
* ),
|
|
709
|
+
* });
|
|
710
|
+
* return null;
|
|
711
|
+
* }
|
|
712
|
+
* ```
|
|
713
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useHumanInTheLoop
|
|
714
|
+
*/
|
|
655
715
|
function useHumanInTheLoop(tool, dependencies) {
|
|
656
716
|
const { render, ...toolRest } = tool;
|
|
657
717
|
const { name, description, parameters, followUp } = toolRest;
|
|
@@ -703,7 +763,7 @@ function useHumanInTheLoop(tool, dependencies) {
|
|
|
703
763
|
}
|
|
704
764
|
|
|
705
765
|
//#endregion
|
|
706
|
-
//#region src/hooks/use-copilot-action.ts
|
|
766
|
+
//#region src/v1-deprecated/hooks/use-copilot-action.ts
|
|
707
767
|
/**
|
|
708
768
|
* Example usage of useCopilotAction with complex parameters:
|
|
709
769
|
*
|
|
@@ -902,7 +962,7 @@ function useCopilotAction(action, dependencies) {
|
|
|
902
962
|
}
|
|
903
963
|
|
|
904
964
|
//#endregion
|
|
905
|
-
//#region src/hooks/use-coagent-state-render.ts
|
|
965
|
+
//#region src/v1-deprecated/hooks/use-coagent-state-render.ts
|
|
906
966
|
/**
|
|
907
967
|
* The useCoAgentStateRender hook allows you to render UI or text based components on a Agentic Copilot's state in the chat.
|
|
908
968
|
* This is particularly useful for showing intermediate state or progress during Agentic Copilot operations.
|
|
@@ -1010,7 +1070,7 @@ function useCoAgentStateRender(action, dependencies) {
|
|
|
1010
1070
|
}
|
|
1011
1071
|
|
|
1012
1072
|
//#endregion
|
|
1013
|
-
//#region src/hooks/use-make-copilot-document-readable.ts
|
|
1073
|
+
//#region src/v1-deprecated/hooks/use-make-copilot-document-readable.ts
|
|
1014
1074
|
/**
|
|
1015
1075
|
* Makes a document readable by Copilot.
|
|
1016
1076
|
* @param document The document to make readable.
|
|
@@ -1036,7 +1096,7 @@ function useMakeCopilotDocumentReadable(document, categories, dependencies = [])
|
|
|
1036
1096
|
}
|
|
1037
1097
|
|
|
1038
1098
|
//#endregion
|
|
1039
|
-
//#region src/hooks/use-copilot-readable.ts
|
|
1099
|
+
//#region src/v1-deprecated/hooks/use-copilot-readable.ts
|
|
1040
1100
|
/**
|
|
1041
1101
|
* `useCopilotReadable` is a React hook that provides app-state and other information
|
|
1042
1102
|
* to the Copilot.
|
|
@@ -1107,6 +1167,20 @@ function useMakeCopilotDocumentReadable(document, categories, dependencies = [])
|
|
|
1107
1167
|
*/
|
|
1108
1168
|
/**
|
|
1109
1169
|
* Adds the given information to the Copilot context to make it readable by Copilot.
|
|
1170
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useAgentContext` from `@copilotkit/react-core/v2` instead.
|
|
1171
|
+
*
|
|
1172
|
+
* ```tsx
|
|
1173
|
+
* import { useAgentContext } from "@copilotkit/react-core/v2";
|
|
1174
|
+
*
|
|
1175
|
+
* function UserContext() {
|
|
1176
|
+
* useAgentContext({
|
|
1177
|
+
* description: "The current user",
|
|
1178
|
+
* value: { name: "Ada" },
|
|
1179
|
+
* });
|
|
1180
|
+
* return null;
|
|
1181
|
+
* }
|
|
1182
|
+
* ```
|
|
1183
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useAgentContext
|
|
1110
1184
|
*/
|
|
1111
1185
|
function useCopilotReadable({ description, value, convert, available = "enabled" }, dependencies) {
|
|
1112
1186
|
const { copilotkit } = useCopilotKit();
|
|
@@ -1135,7 +1209,7 @@ function useCopilotReadable({ description, value, convert, available = "enabled"
|
|
|
1135
1209
|
}
|
|
1136
1210
|
|
|
1137
1211
|
//#endregion
|
|
1138
|
-
//#region src/hooks/use-agent-nodename.ts
|
|
1212
|
+
//#region src/v1-deprecated/hooks/use-agent-nodename.ts
|
|
1139
1213
|
/**
|
|
1140
1214
|
* Tracks the node the agent is currently executing.
|
|
1141
1215
|
*
|
|
@@ -1170,7 +1244,7 @@ function useAgentNodeName(agentName) {
|
|
|
1170
1244
|
}
|
|
1171
1245
|
|
|
1172
1246
|
//#endregion
|
|
1173
|
-
//#region src/hooks/use-coagent.ts
|
|
1247
|
+
//#region src/v1-deprecated/hooks/use-coagent.ts
|
|
1174
1248
|
/**
|
|
1175
1249
|
* <Callout type="info">
|
|
1176
1250
|
* Usage of this hook assumes some additional setup in your application, for more information
|
|
@@ -1378,7 +1452,7 @@ const isExternalStateManagement = (options) => {
|
|
|
1378
1452
|
};
|
|
1379
1453
|
|
|
1380
1454
|
//#endregion
|
|
1381
|
-
//#region src/hooks/use-copilot-runtime-client.ts
|
|
1455
|
+
//#region src/v1-deprecated/hooks/use-copilot-runtime-client.ts
|
|
1382
1456
|
const useCopilotRuntimeClient = (options) => {
|
|
1383
1457
|
const { setBannerError } = useToast();
|
|
1384
1458
|
const { showDevConsole, onError, ...runtimeOptions } = options;
|
|
@@ -1481,7 +1555,7 @@ function createStructuredError(gqlError) {
|
|
|
1481
1555
|
}
|
|
1482
1556
|
|
|
1483
1557
|
//#endregion
|
|
1484
|
-
//#region src/hooks/use-copilot-authenticated-action.ts
|
|
1558
|
+
//#region src/v1-deprecated/hooks/use-copilot-authenticated-action.ts
|
|
1485
1559
|
/**
|
|
1486
1560
|
* Hook to create an authenticated action that requires user sign-in before execution.
|
|
1487
1561
|
*
|
|
@@ -1524,7 +1598,7 @@ function useCopilotAuthenticatedAction_c(action, dependencies) {
|
|
|
1524
1598
|
}
|
|
1525
1599
|
|
|
1526
1600
|
//#endregion
|
|
1527
|
-
//#region src/hooks/use-langgraph-interrupt.ts
|
|
1601
|
+
//#region src/v1-deprecated/hooks/use-langgraph-interrupt.ts
|
|
1528
1602
|
/**
|
|
1529
1603
|
* Transforms a v2 InterruptEvent into the v1 LangGraphInterruptEvent shape
|
|
1530
1604
|
* expected by existing useLangGraphInterrupt callbacks.
|
|
@@ -1537,6 +1611,23 @@ function toV1Event(event) {
|
|
|
1537
1611
|
value
|
|
1538
1612
|
};
|
|
1539
1613
|
}
|
|
1614
|
+
/**
|
|
1615
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useInterrupt` from `@copilotkit/react-core/v2` instead.
|
|
1616
|
+
*
|
|
1617
|
+
* ```tsx
|
|
1618
|
+
* import { useInterrupt } from "@copilotkit/react-core/v2";
|
|
1619
|
+
*
|
|
1620
|
+
* function ApprovalInterrupt() {
|
|
1621
|
+
* useInterrupt({
|
|
1622
|
+
* render: ({ resolve }) => (
|
|
1623
|
+
* <button onClick={() => resolve({ approved: true })}>Approve</button>
|
|
1624
|
+
* ),
|
|
1625
|
+
* });
|
|
1626
|
+
* return null;
|
|
1627
|
+
* }
|
|
1628
|
+
* ```
|
|
1629
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useInterrupt
|
|
1630
|
+
*/
|
|
1540
1631
|
function useLangGraphInterrupt(action, _dependencies) {
|
|
1541
1632
|
const actionRef = useRef(action);
|
|
1542
1633
|
actionRef.current = action;
|
|
@@ -1584,7 +1675,7 @@ function useLangGraphInterrupt(action, _dependencies) {
|
|
|
1584
1675
|
}
|
|
1585
1676
|
|
|
1586
1677
|
//#endregion
|
|
1587
|
-
//#region src/hooks/use-copilot-additional-instructions.ts
|
|
1678
|
+
//#region src/v1-deprecated/hooks/use-copilot-additional-instructions.ts
|
|
1588
1679
|
/**
|
|
1589
1680
|
* `useCopilotAdditionalInstructions` is a React hook that provides additional instructions
|
|
1590
1681
|
* to the Copilot.
|
|
@@ -1643,7 +1734,7 @@ function useCopilotAdditionalInstructions({ instructions, available = "enabled"
|
|
|
1643
1734
|
}
|
|
1644
1735
|
|
|
1645
1736
|
//#endregion
|
|
1646
|
-
//#region src/hooks/use-default-tool.ts
|
|
1737
|
+
//#region src/v1-deprecated/hooks/use-default-tool.ts
|
|
1647
1738
|
function useDefaultTool(tool, dependencies) {
|
|
1648
1739
|
useCopilotAction({
|
|
1649
1740
|
...tool,
|
|
@@ -1652,7 +1743,7 @@ function useDefaultTool(tool, dependencies) {
|
|
|
1652
1743
|
}
|
|
1653
1744
|
|
|
1654
1745
|
//#endregion
|
|
1655
|
-
//#region src/hooks/use-copilot-chat-suggestions.tsx
|
|
1746
|
+
//#region src/v1-deprecated/hooks/use-copilot-chat-suggestions.tsx
|
|
1656
1747
|
/**
|
|
1657
1748
|
* <Callout type="warning">
|
|
1658
1749
|
* useCopilotChatSuggestions is experimental. The interface is not final and
|
|
@@ -1724,7 +1815,7 @@ function useCopilotChatSuggestions(config, dependencies = []) {
|
|
|
1724
1815
|
}
|
|
1725
1816
|
|
|
1726
1817
|
//#endregion
|
|
1727
|
-
//#region src/types/frontend-action.ts
|
|
1818
|
+
//#region src/v1-deprecated/types/frontend-action.ts
|
|
1728
1819
|
function processActionsForRuntimeRequest(actions) {
|
|
1729
1820
|
return actions.filter((action) => action.available !== ActionInputAvailability.Disabled && action.disabled !== true && action.name !== "*" && action.available != "frontend" && !action.pairedAction).map((action) => {
|
|
1730
1821
|
let available = ActionInputAvailability.Enabled;
|
|
@@ -1741,54 +1832,7 @@ function processActionsForRuntimeRequest(actions) {
|
|
|
1741
1832
|
}
|
|
1742
1833
|
|
|
1743
1834
|
//#endregion
|
|
1744
|
-
//#region src/lib/copilot-task.ts
|
|
1745
|
-
/**
|
|
1746
|
-
* This class is used to execute one-off tasks, for example on button press. It can use the context available via [useCopilotReadable](/reference/v1/hooks/useCopilotReadable) and the actions provided by [useCopilotAction](/reference/v1/hooks/useCopilotAction), or you can provide your own context and actions.
|
|
1747
|
-
*
|
|
1748
|
-
* ## Example
|
|
1749
|
-
* In the simplest case, use CopilotTask in the context of your app by giving it instructions on what to do.
|
|
1750
|
-
*
|
|
1751
|
-
* ```tsx
|
|
1752
|
-
* import { CopilotTask, useCopilotContext } from "@copilotkit/react-core";
|
|
1753
|
-
*
|
|
1754
|
-
* export function MyComponent() {
|
|
1755
|
-
* const context = useCopilotContext();
|
|
1756
|
-
*
|
|
1757
|
-
* const task = new CopilotTask({
|
|
1758
|
-
* instructions: "Set a random message",
|
|
1759
|
-
* actions: [
|
|
1760
|
-
* {
|
|
1761
|
-
* name: "setMessage",
|
|
1762
|
-
* description: "Set the message.",
|
|
1763
|
-
* argumentAnnotations: [
|
|
1764
|
-
* {
|
|
1765
|
-
* name: "message",
|
|
1766
|
-
* type: "string",
|
|
1767
|
-
* description:
|
|
1768
|
-
* "A message to display.",
|
|
1769
|
-
* required: true,
|
|
1770
|
-
* },
|
|
1771
|
-
* ],
|
|
1772
|
-
* }
|
|
1773
|
-
* ]
|
|
1774
|
-
* });
|
|
1775
|
-
*
|
|
1776
|
-
* const executeTask = async () => {
|
|
1777
|
-
* await task.run(context, action);
|
|
1778
|
-
* }
|
|
1779
|
-
*
|
|
1780
|
-
* return (
|
|
1781
|
-
* <>
|
|
1782
|
-
* <button onClick={executeTask}>
|
|
1783
|
-
* Execute task
|
|
1784
|
-
* </button>
|
|
1785
|
-
* </>
|
|
1786
|
-
* )
|
|
1787
|
-
* }
|
|
1788
|
-
* ```
|
|
1789
|
-
*
|
|
1790
|
-
* Have a look at the [Presentation Example App](https://github.com/CopilotKit/CopilotKit/blob/main/examples/v1/next-openai/src/app/presentation/page.tsx) for a more complete example.
|
|
1791
|
-
*/
|
|
1835
|
+
//#region src/v1-deprecated/lib/copilot-task.ts
|
|
1792
1836
|
var CopilotTask = class {
|
|
1793
1837
|
constructor(config) {
|
|
1794
1838
|
this.instructions = config.instructions;
|