@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.
Files changed (41) hide show
  1. package/dist/{copilotkit-BUIK5yln.d.mts → copilotkit-DYKpg4pD.d.mts} +34 -25
  2. package/dist/copilotkit-DYKpg4pD.d.mts.map +1 -0
  3. package/dist/{copilotkit-Bocmlr37.cjs → copilotkit-Dr0speVK.cjs} +454 -48
  4. package/dist/copilotkit-Dr0speVK.cjs.map +1 -0
  5. package/dist/{copilotkit-C4RqjAba.mjs → copilotkit-Dr6g885f.mjs} +456 -50
  6. package/dist/copilotkit-Dr6g885f.mjs.map +1 -0
  7. package/dist/{copilotkit-DSvKW3SS.d.cts → copilotkit-Hl1t9Y1v.d.cts} +34 -25
  8. package/dist/copilotkit-Hl1t9Y1v.d.cts.map +1 -0
  9. package/dist/index.cjs +119 -75
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +904 -28
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts +904 -28
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +119 -75
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/index.umd.js +185 -101
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/v2/headless.cjs +3 -2
  20. package/dist/v2/headless.cjs.map +1 -1
  21. package/dist/v2/headless.d.cts +5 -4
  22. package/dist/v2/headless.d.cts.map +1 -1
  23. package/dist/v2/headless.d.mts +5 -4
  24. package/dist/v2/headless.d.mts.map +1 -1
  25. package/dist/v2/headless.mjs +3 -2
  26. package/dist/v2/headless.mjs.map +1 -1
  27. package/dist/v2/index.cjs +1 -1
  28. package/dist/v2/index.css +1 -1
  29. package/dist/v2/index.d.cts +2 -2
  30. package/dist/v2/index.d.mts +2 -2
  31. package/dist/v2/index.mjs +1 -1
  32. package/dist/v2/index.umd.js +451 -45
  33. package/dist/v2/index.umd.js.map +1 -1
  34. package/package.json +8 -8
  35. package/skills/react-core/SKILL.md +1 -1
  36. package/skills/react-core/references/provider-setup.md +23 -2
  37. package/skills/react-core/references/threads.md +3 -4
  38. package/dist/copilotkit-BUIK5yln.d.mts.map +0 -1
  39. package/dist/copilotkit-Bocmlr37.cjs.map +0 -1
  40. package/dist/copilotkit-C4RqjAba.mjs.map +0 -1
  41. package/dist/copilotkit-DSvKW3SS.d.cts.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_copilotkit = require('./copilotkit-Bocmlr37.cjs');
4
+ const require_copilotkit = require('./copilotkit-Dr0speVK.cjs');
5
5
  let react = require("react");
6
6
  react = require_copilotkit.__toESM(react);
7
7
  let _copilotkit_core = require("@copilotkit/core");
@@ -10,7 +10,7 @@ let _copilotkit_shared = require("@copilotkit/shared");
10
10
  let _copilotkit_runtime_client_gql = require("@copilotkit/runtime-client-gql");
11
11
  let _copilotkit_react_core_v2_context = require("@copilotkit/react-core/v2/context");
12
12
 
13
- //#region src/utils/suggestions-constants.ts
13
+ //#region src/v1-deprecated/utils/suggestions-constants.ts
14
14
  /**
15
15
  * Constants for suggestions retry logic
16
16
  */
@@ -20,7 +20,7 @@ const SUGGESTION_RETRY_CONFIG = {
20
20
  };
21
21
 
22
22
  //#endregion
23
- //#region src/hooks/use-lazy-tool-renderer.tsx
23
+ //#region src/v1-deprecated/hooks/use-lazy-tool-renderer.tsx
24
24
  function useLazyToolRenderer() {
25
25
  const renderToolCall = require_copilotkit.useRenderToolCall();
26
26
  return (0, react.useCallback)((message, messages) => {
@@ -36,7 +36,7 @@ function useLazyToolRenderer() {
36
36
  }
37
37
 
38
38
  //#endregion
39
- //#region src/hooks/use-copilot-chat_internal.ts
39
+ //#region src/v1-deprecated/hooks/use-copilot-chat_internal.ts
40
40
  function useCopilotChatInternal({ suggestions, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages } = {}) {
41
41
  const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
42
42
  const { threadId, agentSession } = require_copilotkit.useCopilotContext();
@@ -337,7 +337,7 @@ function useLegacyCoagentRenderer({ copilotkit, agent, agentId, threadId }) {
337
337
  }
338
338
 
339
339
  //#endregion
340
- //#region src/hooks/use-copilot-chat.ts
340
+ //#region src/v1-deprecated/hooks/use-copilot-chat.ts
341
341
  /**
342
342
  * A lightweight React hook for headless chat interactions.
343
343
  * Perfect for programmatic messaging, background operations, and custom UI implementations.
@@ -361,12 +361,12 @@ function useCopilotChat(options = {}) {
361
361
  }
362
362
 
363
363
  //#endregion
364
- //#region src/hooks/use-copilot-chat-headless_c.ts
364
+ //#region src/v1-deprecated/hooks/use-copilot-chat-headless_c.ts
365
365
  /**
366
366
  * `useCopilotChatHeadless_c` is for building fully custom UI (headless UI) implementations.
367
367
  *
368
- * <Callout title="This is an Enterprise Intelligence Platform feature">
369
- * Read more about <a href="/premium/overview">the Enterprise Intelligence Platform</a>.
368
+ * <Callout title="This is a CopilotKit Intelligence feature">
369
+ * Read more about <a href="/premium/overview">CopilotKit Intelligence</a>.
370
370
  *
371
371
  * Usage is generous and **free** to get started.
372
372
  * </Callout>
@@ -545,11 +545,11 @@ const createNonFunctionalReturn = () => ({
545
545
  interrupt: null
546
546
  });
547
547
  /**
548
- * Enterprise Intelligence Platform React hook that provides complete chat functionality for fully custom UI implementations.
548
+ * CopilotKit Intelligence React hook that provides complete chat functionality for fully custom UI implementations.
549
549
  * Includes all advanced features like direct message access, suggestions array, interrupt handling, and MCP support.
550
550
  *
551
551
  * @param options - Configuration options for the chat
552
- * @returns Complete chat interface with all Enterprise Intelligence Platform features
552
+ * @returns Complete chat interface with all CopilotKit Intelligence features
553
553
  *
554
554
  * @example
555
555
  * ```tsx
@@ -563,7 +563,7 @@ function useCopilotChatHeadless_c(options = {}) {
563
563
  (0, react.useEffect)(() => {
564
564
  if (!hasPublicApiKey) {
565
565
  setBannerError(new _copilotkit_shared.CopilotKitError({
566
- message: "You're using useCopilotChatHeadless_c, an Enterprise Intelligence Platform feature that offers extensive headless chat capabilities. To continue, you'll need to provide a free public license key.",
566
+ 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.",
567
567
  code: _copilotkit_shared.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
568
568
  severity: _copilotkit_shared.Severity.WARNING,
569
569
  visibility: _copilotkit_shared.ErrorVisibility.BANNER
@@ -576,7 +576,26 @@ function useCopilotChatHeadless_c(options = {}) {
576
576
  }
577
577
 
578
578
  //#endregion
579
- //#region src/hooks/use-frontend-tool.ts
579
+ //#region src/v1-deprecated/hooks/use-frontend-tool.ts
580
+ /**
581
+ * @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useFrontendTool` from `@copilotkit/react-core/v2` instead.
582
+ *
583
+ * ```tsx
584
+ * import { useFrontendTool } from "@copilotkit/react-core/v2";
585
+ * import { z } from "zod";
586
+ *
587
+ * function MyComponent() {
588
+ * useFrontendTool({
589
+ * name: "myTool",
590
+ * description: "Run my tool",
591
+ * parameters: z.object({}),
592
+ * handler: async () => "done",
593
+ * });
594
+ * return null;
595
+ * }
596
+ * ```
597
+ * See https://docs.copilotkit.ai/reference/v2/hooks/useFrontendTool
598
+ */
580
599
  function useFrontendTool(tool, dependencies) {
581
600
  const { name, description, parameters, render, followUp, available } = tool;
582
601
  const zodParameters = (0, _copilotkit_shared.getZodParameters)(parameters);
@@ -614,7 +633,27 @@ function useFrontendTool(tool, dependencies) {
614
633
  }
615
634
 
616
635
  //#endregion
617
- //#region src/hooks/use-render-tool-call.ts
636
+ //#region src/v1-deprecated/hooks/use-render-tool-call.ts
637
+ /**
638
+ * @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useRenderTool` from `@copilotkit/react-core/v2` instead.
639
+ *
640
+ * ```tsx
641
+ * import { useRenderTool } from "@copilotkit/react-core/v2";
642
+ * import { z } from "zod";
643
+ *
644
+ * function StatusTool() {
645
+ * useRenderTool({
646
+ * name: "showStatus",
647
+ * parameters: z.object({}),
648
+ * render: ({ status, result }) => (
649
+ * <div>{status === "complete" ? result : "Running..."}</div>
650
+ * ),
651
+ * });
652
+ * return null;
653
+ * }
654
+ * ```
655
+ * See https://docs.copilotkit.ai/reference/v2/hooks/useRenderTool
656
+ */
618
657
  function useRenderToolCall(tool, dependencies) {
619
658
  const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
620
659
  const hasAddedRef = (0, react.useRef)(false);
@@ -654,7 +693,28 @@ function useRenderToolCall(tool, dependencies) {
654
693
  }
655
694
 
656
695
  //#endregion
657
- //#region src/hooks/use-human-in-the-loop.ts
696
+ //#region src/v1-deprecated/hooks/use-human-in-the-loop.ts
697
+ /**
698
+ * @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useHumanInTheLoop` from `@copilotkit/react-core/v2` instead.
699
+ *
700
+ * ```tsx
701
+ * import { useHumanInTheLoop } from "@copilotkit/react-core/v2";
702
+ * import { z } from "zod";
703
+ *
704
+ * function Confirmation() {
705
+ * useHumanInTheLoop({
706
+ * name: "confirmAction",
707
+ * description: "Ask the user to confirm",
708
+ * parameters: z.object({}),
709
+ * render: ({ respond }) => (
710
+ * <button onClick={() => respond?.(true)}>Confirm</button>
711
+ * ),
712
+ * });
713
+ * return null;
714
+ * }
715
+ * ```
716
+ * See https://docs.copilotkit.ai/reference/v2/hooks/useHumanInTheLoop
717
+ */
658
718
  function useHumanInTheLoop(tool, dependencies) {
659
719
  const { render, ...toolRest } = tool;
660
720
  const { name, description, parameters, followUp } = toolRest;
@@ -706,7 +766,7 @@ function useHumanInTheLoop(tool, dependencies) {
706
766
  }
707
767
 
708
768
  //#endregion
709
- //#region src/hooks/use-copilot-action.ts
769
+ //#region src/v1-deprecated/hooks/use-copilot-action.ts
710
770
  /**
711
771
  * Example usage of useCopilotAction with complex parameters:
712
772
  *
@@ -905,7 +965,7 @@ function useCopilotAction(action, dependencies) {
905
965
  }
906
966
 
907
967
  //#endregion
908
- //#region src/hooks/use-coagent-state-render.ts
968
+ //#region src/v1-deprecated/hooks/use-coagent-state-render.ts
909
969
  /**
910
970
  * The useCoAgentStateRender hook allows you to render UI or text based components on a Agentic Copilot's state in the chat.
911
971
  * This is particularly useful for showing intermediate state or progress during Agentic Copilot operations.
@@ -1013,7 +1073,7 @@ function useCoAgentStateRender(action, dependencies) {
1013
1073
  }
1014
1074
 
1015
1075
  //#endregion
1016
- //#region src/hooks/use-make-copilot-document-readable.ts
1076
+ //#region src/v1-deprecated/hooks/use-make-copilot-document-readable.ts
1017
1077
  /**
1018
1078
  * Makes a document readable by Copilot.
1019
1079
  * @param document The document to make readable.
@@ -1039,7 +1099,7 @@ function useMakeCopilotDocumentReadable(document, categories, dependencies = [])
1039
1099
  }
1040
1100
 
1041
1101
  //#endregion
1042
- //#region src/hooks/use-copilot-readable.ts
1102
+ //#region src/v1-deprecated/hooks/use-copilot-readable.ts
1043
1103
  /**
1044
1104
  * `useCopilotReadable` is a React hook that provides app-state and other information
1045
1105
  * to the Copilot.
@@ -1110,6 +1170,20 @@ function useMakeCopilotDocumentReadable(document, categories, dependencies = [])
1110
1170
  */
1111
1171
  /**
1112
1172
  * Adds the given information to the Copilot context to make it readable by Copilot.
1173
+ * @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useAgentContext` from `@copilotkit/react-core/v2` instead.
1174
+ *
1175
+ * ```tsx
1176
+ * import { useAgentContext } from "@copilotkit/react-core/v2";
1177
+ *
1178
+ * function UserContext() {
1179
+ * useAgentContext({
1180
+ * description: "The current user",
1181
+ * value: { name: "Ada" },
1182
+ * });
1183
+ * return null;
1184
+ * }
1185
+ * ```
1186
+ * See https://docs.copilotkit.ai/reference/v2/hooks/useAgentContext
1113
1187
  */
1114
1188
  function useCopilotReadable({ description, value, convert, available = "enabled" }, dependencies) {
1115
1189
  const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
@@ -1138,7 +1212,7 @@ function useCopilotReadable({ description, value, convert, available = "enabled"
1138
1212
  }
1139
1213
 
1140
1214
  //#endregion
1141
- //#region src/hooks/use-agent-nodename.ts
1215
+ //#region src/v1-deprecated/hooks/use-agent-nodename.ts
1142
1216
  /**
1143
1217
  * Tracks the node the agent is currently executing.
1144
1218
  *
@@ -1173,7 +1247,7 @@ function useAgentNodeName(agentName) {
1173
1247
  }
1174
1248
 
1175
1249
  //#endregion
1176
- //#region src/hooks/use-coagent.ts
1250
+ //#region src/v1-deprecated/hooks/use-coagent.ts
1177
1251
  /**
1178
1252
  * <Callout type="info">
1179
1253
  * Usage of this hook assumes some additional setup in your application, for more information
@@ -1381,7 +1455,7 @@ const isExternalStateManagement = (options) => {
1381
1455
  };
1382
1456
 
1383
1457
  //#endregion
1384
- //#region src/hooks/use-copilot-runtime-client.ts
1458
+ //#region src/v1-deprecated/hooks/use-copilot-runtime-client.ts
1385
1459
  const useCopilotRuntimeClient = (options) => {
1386
1460
  const { setBannerError } = require_copilotkit.useToast();
1387
1461
  const { showDevConsole, onError, ...runtimeOptions } = options;
@@ -1484,7 +1558,7 @@ function createStructuredError(gqlError) {
1484
1558
  }
1485
1559
 
1486
1560
  //#endregion
1487
- //#region src/hooks/use-copilot-authenticated-action.ts
1561
+ //#region src/v1-deprecated/hooks/use-copilot-authenticated-action.ts
1488
1562
  /**
1489
1563
  * Hook to create an authenticated action that requires user sign-in before execution.
1490
1564
  *
@@ -1527,7 +1601,7 @@ function useCopilotAuthenticatedAction_c(action, dependencies) {
1527
1601
  }
1528
1602
 
1529
1603
  //#endregion
1530
- //#region src/hooks/use-langgraph-interrupt.ts
1604
+ //#region src/v1-deprecated/hooks/use-langgraph-interrupt.ts
1531
1605
  /**
1532
1606
  * Transforms a v2 InterruptEvent into the v1 LangGraphInterruptEvent shape
1533
1607
  * expected by existing useLangGraphInterrupt callbacks.
@@ -1540,6 +1614,23 @@ function toV1Event(event) {
1540
1614
  value
1541
1615
  };
1542
1616
  }
1617
+ /**
1618
+ * @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useInterrupt` from `@copilotkit/react-core/v2` instead.
1619
+ *
1620
+ * ```tsx
1621
+ * import { useInterrupt } from "@copilotkit/react-core/v2";
1622
+ *
1623
+ * function ApprovalInterrupt() {
1624
+ * useInterrupt({
1625
+ * render: ({ resolve }) => (
1626
+ * <button onClick={() => resolve({ approved: true })}>Approve</button>
1627
+ * ),
1628
+ * });
1629
+ * return null;
1630
+ * }
1631
+ * ```
1632
+ * See https://docs.copilotkit.ai/reference/v2/hooks/useInterrupt
1633
+ */
1543
1634
  function useLangGraphInterrupt(action, _dependencies) {
1544
1635
  const actionRef = (0, react.useRef)(action);
1545
1636
  actionRef.current = action;
@@ -1587,7 +1678,7 @@ function useLangGraphInterrupt(action, _dependencies) {
1587
1678
  }
1588
1679
 
1589
1680
  //#endregion
1590
- //#region src/hooks/use-copilot-additional-instructions.ts
1681
+ //#region src/v1-deprecated/hooks/use-copilot-additional-instructions.ts
1591
1682
  /**
1592
1683
  * `useCopilotAdditionalInstructions` is a React hook that provides additional instructions
1593
1684
  * to the Copilot.
@@ -1646,7 +1737,7 @@ function useCopilotAdditionalInstructions({ instructions, available = "enabled"
1646
1737
  }
1647
1738
 
1648
1739
  //#endregion
1649
- //#region src/hooks/use-default-tool.ts
1740
+ //#region src/v1-deprecated/hooks/use-default-tool.ts
1650
1741
  function useDefaultTool(tool, dependencies) {
1651
1742
  useCopilotAction({
1652
1743
  ...tool,
@@ -1655,7 +1746,7 @@ function useDefaultTool(tool, dependencies) {
1655
1746
  }
1656
1747
 
1657
1748
  //#endregion
1658
- //#region src/hooks/use-copilot-chat-suggestions.tsx
1749
+ //#region src/v1-deprecated/hooks/use-copilot-chat-suggestions.tsx
1659
1750
  /**
1660
1751
  * <Callout type="warning">
1661
1752
  * useCopilotChatSuggestions is experimental. The interface is not final and
@@ -1727,7 +1818,7 @@ function useCopilotChatSuggestions(config, dependencies = []) {
1727
1818
  }
1728
1819
 
1729
1820
  //#endregion
1730
- //#region src/types/frontend-action.ts
1821
+ //#region src/v1-deprecated/types/frontend-action.ts
1731
1822
  function processActionsForRuntimeRequest(actions) {
1732
1823
  return actions.filter((action) => action.available !== _copilotkit_runtime_client_gql.ActionInputAvailability.Disabled && action.disabled !== true && action.name !== "*" && action.available != "frontend" && !action.pairedAction).map((action) => {
1733
1824
  let available = _copilotkit_runtime_client_gql.ActionInputAvailability.Enabled;
@@ -1744,54 +1835,7 @@ function processActionsForRuntimeRequest(actions) {
1744
1835
  }
1745
1836
 
1746
1837
  //#endregion
1747
- //#region src/lib/copilot-task.ts
1748
- /**
1749
- * 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.
1750
- *
1751
- * ## Example
1752
- * In the simplest case, use CopilotTask in the context of your app by giving it instructions on what to do.
1753
- *
1754
- * ```tsx
1755
- * import { CopilotTask, useCopilotContext } from "@copilotkit/react-core";
1756
- *
1757
- * export function MyComponent() {
1758
- * const context = useCopilotContext();
1759
- *
1760
- * const task = new CopilotTask({
1761
- * instructions: "Set a random message",
1762
- * actions: [
1763
- * {
1764
- * name: "setMessage",
1765
- * description: "Set the message.",
1766
- * argumentAnnotations: [
1767
- * {
1768
- * name: "message",
1769
- * type: "string",
1770
- * description:
1771
- * "A message to display.",
1772
- * required: true,
1773
- * },
1774
- * ],
1775
- * }
1776
- * ]
1777
- * });
1778
- *
1779
- * const executeTask = async () => {
1780
- * await task.run(context, action);
1781
- * }
1782
- *
1783
- * return (
1784
- * <>
1785
- * <button onClick={executeTask}>
1786
- * Execute task
1787
- * </button>
1788
- * </>
1789
- * )
1790
- * }
1791
- * ```
1792
- *
1793
- * 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.
1794
- */
1838
+ //#region src/v1-deprecated/lib/copilot-task.ts
1795
1839
  var CopilotTask = class {
1796
1840
  constructor(config) {
1797
1841
  this.instructions = config.instructions;