@copilotkit/react-core 1.50.1-next.1 → 1.50.1-next.3

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 (51) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{chunk-LCZZ7YGZ.mjs → chunk-3FHX5RLS.mjs} +2 -2
  3. package/dist/{chunk-YCG6SNAU.mjs → chunk-3MHWEKFN.mjs} +4 -4
  4. package/dist/{chunk-LDEWO5XH.mjs → chunk-CGKXLHL3.mjs} +31 -10
  5. package/dist/chunk-CGKXLHL3.mjs.map +1 -0
  6. package/dist/{chunk-5J7RRLRO.mjs → chunk-F62YUR4R.mjs} +2 -2
  7. package/dist/{chunk-HE22TZMF.mjs → chunk-INPM7YKW.mjs} +4 -4
  8. package/dist/{chunk-ZE4JVTEP.mjs → chunk-IZGUA5WC.mjs} +2 -2
  9. package/dist/{chunk-4YZA2BZC.mjs → chunk-RB2TXKFP.mjs} +13 -13
  10. package/dist/{chunk-LHERIF3L.mjs → chunk-SNON4QA6.mjs} +4 -4
  11. package/dist/components/copilot-provider/copilot-messages.mjs +2 -2
  12. package/dist/components/copilot-provider/copilotkit.mjs +8 -8
  13. package/dist/components/copilot-provider/index.mjs +8 -8
  14. package/dist/components/dev-console/console-trigger.mjs +2 -2
  15. package/dist/components/dev-console/developer-console-modal.mjs +2 -2
  16. package/dist/components/error-boundary/error-boundary.mjs +2 -2
  17. package/dist/components/index.mjs +8 -8
  18. package/dist/context/index.mjs +4 -4
  19. package/dist/hooks/index.d.ts +1 -1
  20. package/dist/hooks/index.js +27 -6
  21. package/dist/hooks/index.js.map +1 -1
  22. package/dist/hooks/index.mjs +30 -30
  23. package/dist/hooks/use-coagent-state-render-bridge.mjs +1 -1
  24. package/dist/hooks/use-copilot-chat-headless_c.js +27 -6
  25. package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
  26. package/dist/hooks/use-copilot-chat-headless_c.mjs +6 -6
  27. package/dist/hooks/use-copilot-chat.js +27 -6
  28. package/dist/hooks/use-copilot-chat.js.map +1 -1
  29. package/dist/hooks/use-copilot-chat.mjs +6 -6
  30. package/dist/hooks/use-copilot-chat_internal.d.ts +24 -2
  31. package/dist/hooks/use-copilot-chat_internal.js +27 -6
  32. package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
  33. package/dist/hooks/use-copilot-chat_internal.mjs +5 -5
  34. package/dist/hooks/use-langgraph-interrupt-render.mjs +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.js +27 -6
  37. package/dist/index.js.map +1 -1
  38. package/dist/index.mjs +51 -51
  39. package/dist/lib/copilot-task.mjs +9 -9
  40. package/dist/lib/index.mjs +9 -9
  41. package/package.json +5 -5
  42. package/src/hooks/index.ts +6 -1
  43. package/src/hooks/use-copilot-chat_internal.ts +59 -3
  44. package/dist/chunk-LDEWO5XH.mjs.map +0 -1
  45. /package/dist/{chunk-LCZZ7YGZ.mjs.map → chunk-3FHX5RLS.mjs.map} +0 -0
  46. /package/dist/{chunk-YCG6SNAU.mjs.map → chunk-3MHWEKFN.mjs.map} +0 -0
  47. /package/dist/{chunk-5J7RRLRO.mjs.map → chunk-F62YUR4R.mjs.map} +0 -0
  48. /package/dist/{chunk-HE22TZMF.mjs.map → chunk-INPM7YKW.mjs.map} +0 -0
  49. /package/dist/{chunk-ZE4JVTEP.mjs.map → chunk-IZGUA5WC.mjs.map} +0 -0
  50. /package/dist/{chunk-4YZA2BZC.mjs.map → chunk-RB2TXKFP.mjs.map} +0 -0
  51. /package/dist/{chunk-LHERIF3L.mjs.map → chunk-SNON4QA6.mjs.map} +0 -0
@@ -1,50 +1,31 @@
1
1
  import "../chunk-A6NKSGH3.mjs";
2
- import {
3
- useDefaultTool
4
- } from "../chunk-BUSWSDYO.mjs";
5
2
  import {
6
3
  useLangGraphInterrupt
7
4
  } from "../chunk-4RRMC7L2.mjs";
8
5
  import {
9
6
  useMakeCopilotDocumentReadable
10
7
  } from "../chunk-7IBF6RBW.mjs";
11
- import {
12
- useCopilotAdditionalInstructions
13
- } from "../chunk-ABWT4DRT.mjs";
14
- import {
15
- useCopilotAuthenticatedAction_c
16
- } from "../chunk-E7SE25ZU.mjs";
17
- import {
18
- useCopilotChatHeadless_c
19
- } from "../chunk-5J7RRLRO.mjs";
20
- import {
21
- useCopilotChatSuggestions
22
- } from "../chunk-XDFVCQD3.mjs";
23
- import {
24
- useCopilotChat
25
- } from "../chunk-ZE4JVTEP.mjs";
26
- import {
27
- useCopilotChatInternal
28
- } from "../chunk-LDEWO5XH.mjs";
29
- import {
30
- useLangGraphInterruptRender
31
- } from "../chunk-VV56AVPB.mjs";
32
- import {
33
- useLazyToolRenderer
34
- } from "../chunk-ZVF5Q6IH.mjs";
35
8
  import {
36
9
  useCopilotReadable
37
10
  } from "../chunk-Z6JV2LRY.mjs";
38
11
  import {
39
12
  useCopilotRuntimeClient
40
13
  } from "../chunk-6ESSSQ7Q.mjs";
14
+ import {
15
+ useDefaultTool
16
+ } from "../chunk-BUSWSDYO.mjs";
41
17
  import {
42
18
  useCoAgentStateRender
43
19
  } from "../chunk-YTQHRJUA.mjs";
44
20
  import {
45
21
  useCoAgent
46
22
  } from "../chunk-ZYTXB6HH.mjs";
47
- import "../chunk-I76HKHPJ.mjs";
23
+ import {
24
+ useCopilotAdditionalInstructions
25
+ } from "../chunk-ABWT4DRT.mjs";
26
+ import {
27
+ useCopilotAuthenticatedAction_c
28
+ } from "../chunk-E7SE25ZU.mjs";
48
29
  import {
49
30
  useCopilotAction
50
31
  } from "../chunk-GPEJNVE5.mjs";
@@ -57,15 +38,34 @@ import {
57
38
  import {
58
39
  useHumanInTheLoop
59
40
  } from "../chunk-7DTB7S5V.mjs";
41
+ import {
42
+ useCopilotChatHeadless_c
43
+ } from "../chunk-F62YUR4R.mjs";
44
+ import {
45
+ useCopilotChatSuggestions
46
+ } from "../chunk-XDFVCQD3.mjs";
47
+ import {
48
+ useCopilotChat
49
+ } from "../chunk-IZGUA5WC.mjs";
50
+ import {
51
+ useCopilotChatInternal
52
+ } from "../chunk-CGKXLHL3.mjs";
53
+ import {
54
+ useLazyToolRenderer
55
+ } from "../chunk-ZVF5Q6IH.mjs";
56
+ import {
57
+ useLangGraphInterruptRender
58
+ } from "../chunk-VV56AVPB.mjs";
60
59
  import "../chunk-6PUNP7CD.mjs";
61
60
  import "../chunk-O7ARI5CV.mjs";
61
+ import "../chunk-EFL5OBKN.mjs";
62
+ import "../chunk-I76HKHPJ.mjs";
62
63
  import "../chunk-QNUAXSDP.mjs";
63
64
  import "../chunk-NB2FKV2V.mjs";
64
65
  import "../chunk-F555TVE4.mjs";
65
- import "../chunk-EFL5OBKN.mjs";
66
+ import "../chunk-DMLQZG75.mjs";
66
67
  import "../chunk-FDOMAPJY.mjs";
67
68
  import "../chunk-AFNWX62Q.mjs";
68
- import "../chunk-DMLQZG75.mjs";
69
69
  import "../chunk-SKC7AJIV.mjs";
70
70
  export {
71
71
  useCoAgent,
@@ -4,9 +4,9 @@ import {
4
4
  } from "../chunk-QNUAXSDP.mjs";
5
5
  import "../chunk-NB2FKV2V.mjs";
6
6
  import "../chunk-F555TVE4.mjs";
7
+ import "../chunk-DMLQZG75.mjs";
7
8
  import "../chunk-FDOMAPJY.mjs";
8
9
  import "../chunk-AFNWX62Q.mjs";
9
- import "../chunk-DMLQZG75.mjs";
10
10
  import "../chunk-SKC7AJIV.mjs";
11
11
  export {
12
12
  CoAgentStateRenderBridge,
@@ -661,7 +661,11 @@ function CoAgentStateRenderBridge(props) {
661
661
 
662
662
  // src/hooks/use-copilot-chat_internal.ts
663
663
  function useCopilotChatInternal({
664
- suggestions
664
+ suggestions,
665
+ onInProgress,
666
+ onSubmitMessage,
667
+ onStopGeneration,
668
+ onReloadMessages
665
669
  } = {}) {
666
670
  var _a, _b, _c;
667
671
  const { copilotkit } = (0, import_react14.useCopilotKit)();
@@ -690,6 +694,9 @@ function useCopilotChatInternal({
690
694
  return () => {
691
695
  };
692
696
  }, [existingConfig == null ? void 0 : existingConfig.threadId, agent, copilotkit, resolvedAgentId]);
697
+ (0, import_react13.useEffect)(() => {
698
+ onInProgress == null ? void 0 : onInProgress(Boolean(agent == null ? void 0 : agent.isRunning));
699
+ }, [agent == null ? void 0 : agent.isRunning, onInProgress]);
693
700
  const interrupt = useLangGraphInterruptRender(agent);
694
701
  const reset = () => {
695
702
  agent == null ? void 0 : agent.setMessages([]);
@@ -770,8 +777,12 @@ function useCopilotChatInternal({
770
777
  console.error("CopilotChat: runAgent failed", error);
771
778
  }
772
779
  }
780
+ if (onSubmitMessage) {
781
+ const content = typeof message.content === "string" ? message.content : message.content && "text" in message.content ? message.content.text : message.content && "filename" in message.content ? message.content.filename : "";
782
+ onSubmitMessage(content);
783
+ }
773
784
  }),
774
- [agent, copilotkit, resolvedAgentId]
785
+ [agent, copilotkit, resolvedAgentId, onSubmitMessage]
775
786
  );
776
787
  const latestAppendFunc = useAsyncCallback(
777
788
  (message, options) => __async(this, null, function* () {
@@ -792,14 +803,24 @@ function useCopilotChatInternal({
792
803
  const latestReload = useUpdatedRef(reload);
793
804
  const latestReloadFunc = useAsyncCallback(
794
805
  (messageId) => __async(this, null, function* () {
806
+ var _a2;
807
+ onReloadMessages == null ? void 0 : onReloadMessages({
808
+ messageId,
809
+ currentAgentName: agent == null ? void 0 : agent.agentId,
810
+ messages: (_a2 = agent == null ? void 0 : agent.messages) != null ? _a2 : []
811
+ });
795
812
  return yield latestReload.current(messageId);
796
813
  }),
797
- [latestReload]
814
+ [latestReload, agent, onReloadMessages]
798
815
  );
799
816
  const latestStopFunc = (0, import_react13.useCallback)(() => {
800
- var _a2;
801
- return (_a2 = agent == null ? void 0 : agent.abortRun) == null ? void 0 : _a2.call(agent);
802
- }, [agent == null ? void 0 : agent.abortRun]);
817
+ var _a2, _b2;
818
+ onStopGeneration == null ? void 0 : onStopGeneration({
819
+ currentAgentName: agent == null ? void 0 : agent.agentId,
820
+ messages: (_a2 = agent == null ? void 0 : agent.messages) != null ? _a2 : []
821
+ });
822
+ return (_b2 = agent == null ? void 0 : agent.abortRun) == null ? void 0 : _b2.call(agent);
823
+ }, [onStopGeneration, agent]);
803
824
  const latestReset = useUpdatedRef(reset);
804
825
  const latestResetFunc = (0, import_react13.useCallback)(() => {
805
826
  return latestReset.current();