@copilotkit/react-core 1.51.4-next.7 → 1.51.4
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 +26 -0
- package/README.md +18 -12
- package/dist/{chunk-6ESSSQ7Q.mjs → chunk-2RSAYTXH.mjs} +6 -3
- package/dist/chunk-2RSAYTXH.mjs.map +1 -0
- package/dist/chunk-3LZZ4RVM.mjs +37 -0
- package/dist/{chunk-ABWT4DRT.mjs.map → chunk-3LZZ4RVM.mjs.map} +1 -1
- package/dist/{chunk-QDES5PDW.mjs → chunk-4ZQYMC5F.mjs} +2 -2
- package/dist/{chunk-QDES5PDW.mjs.map → chunk-4ZQYMC5F.mjs.map} +1 -1
- package/dist/{chunk-VKNLTZJE.mjs → chunk-6ABVYB2U.mjs} +28 -19
- package/dist/chunk-6ABVYB2U.mjs.map +1 -0
- package/dist/{chunk-6PUNP7CD.mjs → chunk-6AWG5FWL.mjs} +2 -2
- package/dist/chunk-6AWG5FWL.mjs.map +1 -0
- package/dist/{chunk-C3YJYDK4.mjs → chunk-7GIBHX6X.mjs} +8 -2
- package/dist/chunk-7GIBHX6X.mjs.map +1 -0
- package/dist/{chunk-PIF5KJYI.mjs → chunk-7PJKPWMD.mjs} +15 -6
- package/dist/chunk-7PJKPWMD.mjs.map +1 -0
- package/dist/{chunk-7JTI6ZL4.mjs → chunk-7U3DNFBF.mjs} +6 -3
- package/dist/chunk-7U3DNFBF.mjs.map +1 -0
- package/dist/{chunk-KNJHRVKW.mjs → chunk-AAGMWZCN.mjs} +45 -14
- package/dist/chunk-AAGMWZCN.mjs.map +1 -0
- package/dist/{chunk-AFNWX62Q.mjs → chunk-C7HSVDHD.mjs} +10 -4
- package/dist/chunk-C7HSVDHD.mjs.map +1 -0
- package/dist/{chunk-ZYTXB6HH.mjs → chunk-CZT7JUIM.mjs} +4 -2
- package/dist/chunk-CZT7JUIM.mjs.map +1 -0
- package/dist/{chunk-BKMJ4LC7.mjs → chunk-G7SUZGGB.mjs} +19 -12
- package/dist/chunk-G7SUZGGB.mjs.map +1 -0
- package/dist/{chunk-7IBF6RBW.mjs → chunk-GY3FQICF.mjs} +2 -2
- package/dist/{chunk-QD7EID4N.mjs → chunk-IHMMKEFG.mjs} +16 -11
- package/dist/chunk-IHMMKEFG.mjs.map +1 -0
- package/dist/{chunk-YYN33GSG.mjs → chunk-K5OXUXCG.mjs} +14 -11
- package/dist/chunk-K5OXUXCG.mjs.map +1 -0
- package/dist/{chunk-6ZLPNY7X.mjs → chunk-L7GPCF2V.mjs} +6 -2
- package/dist/{chunk-6ZLPNY7X.mjs.map → chunk-L7GPCF2V.mjs.map} +1 -1
- package/dist/{chunk-LHERIF3L.mjs → chunk-LD34IXVT.mjs} +8 -5
- package/dist/chunk-LD34IXVT.mjs.map +1 -0
- package/dist/{chunk-7DTB7S5V.mjs → chunk-LNGBARXE.mjs} +5 -2
- package/dist/chunk-LNGBARXE.mjs.map +1 -0
- package/dist/{chunk-DQXCQWSG.mjs → chunk-LRPWSPXG.mjs} +85 -50
- package/dist/chunk-LRPWSPXG.mjs.map +1 -0
- package/dist/{chunk-NBK4KBLX.mjs → chunk-MBJ7OLYI.mjs} +9 -5
- package/dist/chunk-MBJ7OLYI.mjs.map +1 -0
- package/dist/{chunk-MA3CUMCY.mjs → chunk-P6ZPE4XJ.mjs} +3 -3
- package/dist/{chunk-MA3CUMCY.mjs.map → chunk-P6ZPE4XJ.mjs.map} +1 -1
- package/dist/{chunk-77IVITG3.mjs → chunk-QXZTCGF4.mjs} +9 -4
- package/dist/chunk-QXZTCGF4.mjs.map +1 -0
- package/dist/{chunk-VP43SLSZ.mjs → chunk-R2DP4APC.mjs} +10 -5
- package/dist/chunk-R2DP4APC.mjs.map +1 -0
- package/dist/{chunk-RKTVJRK7.mjs → chunk-R7BV32X4.mjs} +5 -2
- package/dist/chunk-R7BV32X4.mjs.map +1 -0
- package/dist/{chunk-YCG6SNAU.mjs → chunk-SBRCWA4S.mjs} +186 -32
- package/dist/chunk-SBRCWA4S.mjs.map +1 -0
- package/dist/{chunk-LMHB2D4J.mjs → chunk-SK2XMJUD.mjs} +13 -4
- package/dist/chunk-SK2XMJUD.mjs.map +1 -0
- package/dist/{chunk-HE22TZMF.mjs → chunk-SLM6CLAH.mjs} +16 -7
- package/dist/chunk-SLM6CLAH.mjs.map +1 -0
- package/dist/{chunk-XDFVCQD3.mjs → chunk-SYGQHN3H.mjs} +1 -1
- package/dist/{chunk-XDFVCQD3.mjs.map → chunk-SYGQHN3H.mjs.map} +1 -1
- package/dist/{chunk-4RRMC7L2.mjs → chunk-SYMT73HM.mjs} +16 -5
- package/dist/chunk-SYMT73HM.mjs.map +1 -0
- package/dist/{chunk-SRJT5VVY.mjs → chunk-TFZXOEY4.mjs} +6 -4
- package/dist/{chunk-SRJT5VVY.mjs.map → chunk-TFZXOEY4.mjs.map} +1 -1
- package/dist/{chunk-4CEQJ2X6.mjs → chunk-TPN7WC53.mjs} +4 -2
- package/dist/{chunk-4CEQJ2X6.mjs.map → chunk-TPN7WC53.mjs.map} +1 -1
- package/dist/{chunk-VGL3DGUW.mjs → chunk-UA23VX5J.mjs} +4 -2
- package/dist/chunk-UA23VX5J.mjs.map +1 -0
- package/dist/{chunk-VV56AVPB.mjs → chunk-V42VL2JR.mjs} +15 -4
- package/dist/chunk-V42VL2JR.mjs.map +1 -0
- package/dist/{chunk-RBGVEVWY.mjs → chunk-VZ4NSOFQ.mjs} +4 -4
- package/dist/chunk-VZ4NSOFQ.mjs.map +1 -0
- package/dist/{chunk-WF65O6HX.mjs → chunk-WRALJIW5.mjs} +18 -5
- package/dist/chunk-WRALJIW5.mjs.map +1 -0
- package/dist/{chunk-PMAFHQ7P.mjs → chunk-WV2EA7SX.mjs} +1 -1
- package/dist/chunk-WV2EA7SX.mjs.map +1 -0
- package/dist/{chunk-EFL5OBKN.mjs → chunk-ZP2IMXFY.mjs} +10 -4
- package/dist/chunk-ZP2IMXFY.mjs.map +1 -0
- package/dist/components/CopilotListeners.js +11 -2
- package/dist/components/CopilotListeners.js.map +1 -1
- package/dist/components/CopilotListeners.mjs +2 -2
- package/dist/components/copilot-provider/copilot-messages.d.ts +1 -1
- package/dist/components/copilot-provider/copilot-messages.js +22 -7
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +3 -3
- package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.js +179 -84
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +16 -16
- package/dist/components/copilot-provider/index.js +179 -84
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +16 -16
- package/dist/components/dev-console/console-trigger.d.ts +1 -1
- package/dist/components/dev-console/console-trigger.js +227 -42
- package/dist/components/dev-console/console-trigger.js.map +1 -1
- package/dist/components/dev-console/console-trigger.mjs +24 -8
- package/dist/components/dev-console/console-trigger.mjs.map +1 -1
- package/dist/components/dev-console/developer-console-modal.d.ts +1 -1
- package/dist/components/dev-console/developer-console-modal.js +206 -37
- package/dist/components/dev-console/developer-console-modal.js.map +1 -1
- package/dist/components/dev-console/developer-console-modal.mjs +3 -3
- package/dist/components/dev-console/icons.js +14 -5
- package/dist/components/dev-console/icons.js.map +1 -1
- package/dist/components/dev-console/icons.mjs +1 -1
- package/dist/components/error-boundary/error-boundary.d.ts +1 -1
- package/dist/components/error-boundary/error-boundary.js +9 -2
- package/dist/components/error-boundary/error-boundary.js.map +1 -1
- package/dist/components/error-boundary/error-boundary.mjs +5 -5
- package/dist/components/error-boundary/error-utils.js.map +1 -1
- package/dist/components/error-boundary/error-utils.mjs +2 -2
- package/dist/components/index.js +179 -84
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +16 -16
- package/dist/components/toast/toast-provider.js +9 -3
- package/dist/components/toast/toast-provider.js.map +1 -1
- package/dist/components/toast/toast-provider.mjs +1 -1
- package/dist/components/usage-banner.js +5 -1
- package/dist/components/usage-banner.js.map +1 -1
- package/dist/components/usage-banner.mjs +1 -1
- package/dist/context/coagent-state-renders-context.d.ts +1 -1
- package/dist/context/coagent-state-renders-context.js +15 -10
- package/dist/context/coagent-state-renders-context.js.map +1 -1
- package/dist/context/coagent-state-renders-context.mjs +1 -1
- package/dist/context/copilot-context.js +9 -3
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/index.js +31 -15
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/context/threads-context.d.ts +1 -1
- package/dist/context/threads-context.js +7 -2
- package/dist/context/threads-context.js.map +1 -1
- package/dist/context/threads-context.mjs +1 -1
- package/dist/hooks/index.js +162 -61
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +25 -25
- package/dist/hooks/use-coagent-state-render-bridge.helpers.js +7 -1
- package/dist/hooks/use-coagent-state-render-bridge.helpers.js.map +1 -1
- package/dist/hooks/use-coagent-state-render-bridge.helpers.mjs +1 -1
- package/dist/hooks/use-coagent-state-render-bridge.js +31 -15
- package/dist/hooks/use-coagent-state-render-bridge.js.map +1 -1
- package/dist/hooks/use-coagent-state-render-bridge.mjs +6 -6
- package/dist/hooks/use-coagent-state-render-registry.js +14 -3
- package/dist/hooks/use-coagent-state-render-registry.js.map +1 -1
- package/dist/hooks/use-coagent-state-render-registry.mjs +2 -2
- package/dist/hooks/use-coagent-state-render.js +34 -21
- package/dist/hooks/use-coagent-state-render.js.map +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +4 -4
- package/dist/hooks/use-coagent.js +3 -1
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +1 -1
- package/dist/hooks/use-configure-chat-suggestions.js.map +1 -1
- package/dist/hooks/use-configure-chat-suggestions.mjs.map +1 -1
- package/dist/hooks/use-copilot-action.js +13 -9
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +4 -4
- package/dist/hooks/use-copilot-additional-instructions.d.ts +1 -1
- package/dist/hooks/use-copilot-additional-instructions.js +26 -7
- package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
- package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
- package/dist/hooks/use-copilot-authenticated-action.js +25 -13
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +6 -6
- package/dist/hooks/use-copilot-chat-headless_c.js +81 -27
- package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
- package/dist/hooks/use-copilot-chat-headless_c.mjs +11 -11
- package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -1
- package/dist/hooks/use-copilot-chat-suggestions.mjs +1 -1
- package/dist/hooks/use-copilot-chat.js +81 -27
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +11 -11
- package/dist/hooks/use-copilot-chat_internal.js +81 -27
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +10 -10
- package/dist/hooks/use-copilot-runtime-client.js +4 -1
- package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
- package/dist/hooks/use-copilot-runtime-client.mjs +2 -2
- package/dist/hooks/use-default-tool.js +17 -10
- package/dist/hooks/use-default-tool.js.map +1 -1
- package/dist/hooks/use-default-tool.mjs +5 -5
- package/dist/hooks/use-flat-category-store.js +13 -10
- package/dist/hooks/use-flat-category-store.js.map +1 -1
- package/dist/hooks/use-flat-category-store.mjs +1 -1
- package/dist/hooks/use-frontend-tool.js.map +1 -1
- package/dist/hooks/use-frontend-tool.mjs +1 -1
- package/dist/hooks/use-human-in-the-loop.js.map +1 -1
- package/dist/hooks/use-human-in-the-loop.mjs +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.js +22 -5
- package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.mjs +4 -4
- package/dist/hooks/use-langgraph-interrupt.js +19 -4
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +3 -3
- package/dist/hooks/use-make-copilot-document-readable.js +9 -3
- package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
- package/dist/hooks/use-render-tool-call.d.ts +1 -1
- package/dist/hooks/use-render-tool-call.js +13 -9
- package/dist/hooks/use-render-tool-call.js.map +1 -1
- package/dist/hooks/use-render-tool-call.mjs +1 -1
- package/dist/hooks/use-tree.js +4 -1
- package/dist/hooks/use-tree.js.map +1 -1
- package/dist/hooks/use-tree.mjs +1 -1
- package/dist/index.js +311 -130
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -35
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/copilot-task.js +10 -3
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +18 -18
- package/dist/lib/index.js +10 -3
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +18 -18
- package/dist/lib/status-checker.js.map +1 -1
- package/dist/lib/status-checker.mjs +1 -1
- package/dist/types/coagent-action.js.map +1 -1
- package/dist/types/frontend-action.js +3 -1
- package/dist/types/frontend-action.js.map +1 -1
- package/dist/types/frontend-action.mjs +1 -1
- package/dist/types/interrupt-action.js.map +1 -1
- package/dist/v2/index.umd.js.map +1 -1
- package/jest.config.js +1 -0
- package/package.json +7 -8
- package/src/__mocks__/analytics-node.js +9 -0
- package/src/components/CopilotListeners.tsx +21 -5
- package/src/components/copilot-provider/__tests__/copilotkit-error.test.tsx +3 -1
- package/src/components/copilot-provider/copilot-messages.tsx +36 -11
- package/src/components/copilot-provider/copilotkit-props.tsx +4 -1
- package/src/components/copilot-provider/copilotkit.tsx +116 -50
- package/src/components/dev-console/console-trigger.tsx +39 -10
- package/src/components/dev-console/developer-console-modal.tsx +207 -57
- package/src/components/dev-console/icons.tsx +6 -1
- package/src/components/error-boundary/error-boundary.tsx +10 -2
- package/src/components/error-boundary/error-utils.tsx +8 -3
- package/src/components/toast/toast-provider.tsx +16 -6
- package/src/components/usage-banner.tsx +9 -2
- package/src/context/coagent-state-renders-context.tsx +24 -12
- package/src/context/copilot-context.tsx +48 -15
- package/src/context/index.ts +8 -2
- package/src/context/threads-context.tsx +14 -3
- package/src/hooks/__tests__/use-coagent-state-render-bridge.helpers.test.ts +11 -4
- package/src/hooks/__tests__/use-coagent-state-render.e2e.test.tsx +175 -47
- package/src/hooks/__tests__/use-coagent-state-render.test.tsx +31 -10
- package/src/hooks/__tests__/use-frontend-tool-remount.e2e.test.tsx +10 -2
- package/src/hooks/use-coagent-state-render-bridge.helpers.ts +49 -16
- package/src/hooks/use-coagent-state-render-bridge.tsx +30 -13
- package/src/hooks/use-coagent-state-render-registry.ts +36 -21
- package/src/hooks/use-coagent-state-render.ts +30 -19
- package/src/hooks/use-coagent.ts +15 -4
- package/src/hooks/use-configure-chat-suggestions.tsx +14 -4
- package/src/hooks/use-copilot-action.ts +12 -3
- package/src/hooks/use-copilot-additional-instructions.ts +17 -4
- package/src/hooks/use-copilot-authenticated-action.ts +4 -1
- package/src/hooks/use-copilot-chat-headless_c.ts +8 -2
- package/src/hooks/use-copilot-chat-suggestions.tsx +14 -4
- package/src/hooks/use-copilot-chat.ts +3 -1
- package/src/hooks/use-copilot-chat_internal.ts +72 -19
- package/src/hooks/use-copilot-runtime-client.ts +20 -6
- package/src/hooks/use-default-tool.ts +8 -2
- package/src/hooks/use-flat-category-store.ts +15 -11
- package/src/hooks/use-frontend-tool.ts +35 -25
- package/src/hooks/use-human-in-the-loop.ts +21 -5
- package/src/hooks/use-langgraph-interrupt-render.ts +13 -2
- package/src/hooks/use-langgraph-interrupt.ts +13 -3
- package/src/hooks/use-render-tool-call.ts +20 -11
- package/src/hooks/use-tree.ts +20 -5
- package/src/lib/copilot-task.ts +20 -6
- package/src/lib/status-checker.ts +4 -1
- package/src/types/coagent-action.ts +6 -2
- package/src/types/frontend-action.ts +16 -5
- package/src/types/interrupt-action.ts +15 -5
- package/tsconfig.json +1 -1
- package/dist/chunk-4RRMC7L2.mjs.map +0 -1
- package/dist/chunk-6ESSSQ7Q.mjs.map +0 -1
- package/dist/chunk-6PUNP7CD.mjs.map +0 -1
- package/dist/chunk-77IVITG3.mjs.map +0 -1
- package/dist/chunk-7DTB7S5V.mjs.map +0 -1
- package/dist/chunk-7JTI6ZL4.mjs.map +0 -1
- package/dist/chunk-ABWT4DRT.mjs +0 -24
- package/dist/chunk-AFNWX62Q.mjs.map +0 -1
- package/dist/chunk-BKMJ4LC7.mjs.map +0 -1
- package/dist/chunk-C3YJYDK4.mjs.map +0 -1
- package/dist/chunk-DQXCQWSG.mjs.map +0 -1
- package/dist/chunk-EFL5OBKN.mjs.map +0 -1
- package/dist/chunk-HE22TZMF.mjs.map +0 -1
- package/dist/chunk-KNJHRVKW.mjs.map +0 -1
- package/dist/chunk-LHERIF3L.mjs.map +0 -1
- package/dist/chunk-LMHB2D4J.mjs.map +0 -1
- package/dist/chunk-NBK4KBLX.mjs.map +0 -1
- package/dist/chunk-PIF5KJYI.mjs.map +0 -1
- package/dist/chunk-PMAFHQ7P.mjs.map +0 -1
- package/dist/chunk-QD7EID4N.mjs.map +0 -1
- package/dist/chunk-RBGVEVWY.mjs.map +0 -1
- package/dist/chunk-RKTVJRK7.mjs.map +0 -1
- package/dist/chunk-VGL3DGUW.mjs.map +0 -1
- package/dist/chunk-VKNLTZJE.mjs.map +0 -1
- package/dist/chunk-VP43SLSZ.mjs.map +0 -1
- package/dist/chunk-VV56AVPB.mjs.map +0 -1
- package/dist/chunk-WF65O6HX.mjs.map +0 -1
- package/dist/chunk-YCG6SNAU.mjs.map +0 -1
- package/dist/chunk-YYN33GSG.mjs.map +0 -1
- package/dist/chunk-ZYTXB6HH.mjs.map +0 -1
- /package/dist/{chunk-7IBF6RBW.mjs.map → chunk-GY3FQICF.mjs.map} +0 -0
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotChatHeadless_c
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-P6ZPE4XJ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
defaultSystemMessage
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-AAGMWZCN.mjs";
|
|
7
7
|
import "../chunk-ZVF5Q6IH.mjs";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-V42VL2JR.mjs";
|
|
9
9
|
import "../chunk-I76HKHPJ.mjs";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-6AWG5FWL.mjs";
|
|
11
11
|
import "../chunk-O7ARI5CV.mjs";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-G7SUZGGB.mjs";
|
|
13
13
|
import "../chunk-NB2FKV2V.mjs";
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-SK2XMJUD.mjs";
|
|
15
|
+
import "../chunk-QXZTCGF4.mjs";
|
|
16
|
+
import "../chunk-7GIBHX6X.mjs";
|
|
17
|
+
import "../chunk-ZP2IMXFY.mjs";
|
|
18
|
+
import "../chunk-IHMMKEFG.mjs";
|
|
19
|
+
import "../chunk-C7HSVDHD.mjs";
|
|
20
20
|
import "../chunk-DMLQZG75.mjs";
|
|
21
21
|
import "../chunk-SKC7AJIV.mjs";
|
|
22
22
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/use-copilot-chat-suggestions.tsx"],"sourcesContent":["/**\n * <Callout type=\"warning\">\n * useCopilotChatSuggestions is experimental. The interface is not final and\n * can change without notice.\n * </Callout>\n *\n * `useCopilotReadable` is a React hook that provides app-state and other information\n * to the Copilot. Optionally, the hook can also handle hierarchical state within your\n * application, passing these parent-child relationships to the Copilot.\n *\n * <br/>\n * <img src=\"https://cdn.copilotkit.ai/docs/copilotkit/images/use-copilot-chat-suggestions/use-copilot-chat-suggestions.gif\" width=\"500\" />\n *\n * ## Usage\n *\n * ### Install Dependencies\n *\n * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.\n *\n * ```shell npm2yarn \\\"@copilotkit/react-ui\"\\\n * npm install @copilotkit/react-core @copilotkit/react-ui\n * ```\n *\n * ### Simple Usage\n *\n * ```tsx\n * import { useCopilotChatSuggestions } from \"@copilotkit/react-ui\";\n *\n * export function MyComponent() {\n * const [employees, setEmployees] = useState([]);\n *\n * useCopilotChatSuggestions({\n * instructions: `The following employees are on duty: ${JSON.stringify(employees)}`,\n * });\n * }\n * ```\n *\n * ### Dependency Management\n *\n * ```tsx\n * import { useCopilotChatSuggestions } from \"@copilotkit/react-ui\";\n *\n * export function MyComponent() {\n * useCopilotChatSuggestions(\n * {\n * instructions: \"Suggest the most relevant next actions.\",\n * },\n * [appState],\n * );\n * }\n * ```\n *\n * In the example above, the suggestions are generated based on the given instructions.\n * The hook monitors `appState`, and updates suggestions accordingly whenever it changes.\n *\n * ### Behavior and Lifecycle\n *\n * The hook registers the configuration with the chat context upon component mount and\n * removes it on unmount, ensuring a clean and efficient lifecycle management.\n */\nimport {\n useConfigureSuggestions,\n useCopilotChatConfiguration,\n useCopilotKit,\n useSuggestions,\n} from \"@copilotkitnext/react\";\nimport { useEffect } from \"react\";\nimport { StaticSuggestionsConfig, Suggestion } from \"@copilotkitnext/core\";\n\ntype StaticSuggestionInput = Omit<Suggestion, \"isLoading\">
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-copilot-chat-suggestions.tsx"],"sourcesContent":["/**\n * <Callout type=\"warning\">\n * useCopilotChatSuggestions is experimental. The interface is not final and\n * can change without notice.\n * </Callout>\n *\n * `useCopilotReadable` is a React hook that provides app-state and other information\n * to the Copilot. Optionally, the hook can also handle hierarchical state within your\n * application, passing these parent-child relationships to the Copilot.\n *\n * <br/>\n * <img src=\"https://cdn.copilotkit.ai/docs/copilotkit/images/use-copilot-chat-suggestions/use-copilot-chat-suggestions.gif\" width=\"500\" />\n *\n * ## Usage\n *\n * ### Install Dependencies\n *\n * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.\n *\n * ```shell npm2yarn \\\"@copilotkit/react-ui\"\\\n * npm install @copilotkit/react-core @copilotkit/react-ui\n * ```\n *\n * ### Simple Usage\n *\n * ```tsx\n * import { useCopilotChatSuggestions } from \"@copilotkit/react-ui\";\n *\n * export function MyComponent() {\n * const [employees, setEmployees] = useState([]);\n *\n * useCopilotChatSuggestions({\n * instructions: `The following employees are on duty: ${JSON.stringify(employees)}`,\n * });\n * }\n * ```\n *\n * ### Dependency Management\n *\n * ```tsx\n * import { useCopilotChatSuggestions } from \"@copilotkit/react-ui\";\n *\n * export function MyComponent() {\n * useCopilotChatSuggestions(\n * {\n * instructions: \"Suggest the most relevant next actions.\",\n * },\n * [appState],\n * );\n * }\n * ```\n *\n * In the example above, the suggestions are generated based on the given instructions.\n * The hook monitors `appState`, and updates suggestions accordingly whenever it changes.\n *\n * ### Behavior and Lifecycle\n *\n * The hook registers the configuration with the chat context upon component mount and\n * removes it on unmount, ensuring a clean and efficient lifecycle management.\n */\nimport {\n useConfigureSuggestions,\n useCopilotChatConfiguration,\n useCopilotKit,\n useSuggestions,\n} from \"@copilotkitnext/react\";\nimport { useEffect } from \"react\";\nimport { StaticSuggestionsConfig, Suggestion } from \"@copilotkitnext/core\";\n\ntype StaticSuggestionInput = Omit<Suggestion, \"isLoading\"> &\n Partial<Pick<Suggestion, \"isLoading\">>;\n\ntype StaticSuggestionsConfigInput = Omit<\n StaticSuggestionsConfig,\n \"suggestions\"\n> & {\n suggestions: StaticSuggestionInput[];\n};\n\ntype DynamicSuggestionsConfigInput = {\n /**\n * A prompt or instructions for the GPT to generate suggestions.\n */\n instructions: string;\n /**\n * The minimum number of suggestions to generate. Defaults to `1`.\n * @default 1\n */\n minSuggestions?: number;\n /**\n * The maximum number of suggestions to generate. Defaults to `3`.\n * @default 1\n */\n maxSuggestions?: number;\n\n /**\n * Whether the suggestions are available. Defaults to `enabled`.\n * @default enabled\n */\n available?:\n | \"enabled\"\n | \"disabled\"\n | \"always\"\n | \"before-first-message\"\n | \"after-first-message\";\n\n /**\n * An optional class name to apply to the suggestions.\n */\n className?: string;\n};\n\nexport type UseCopilotChatSuggestionsConfiguration =\n | DynamicSuggestionsConfigInput\n | StaticSuggestionsConfigInput;\n\nexport function useCopilotChatSuggestions(\n config: UseCopilotChatSuggestionsConfiguration,\n dependencies: any[] = [],\n) {\n const existingConfig = useCopilotChatConfiguration();\n const resolvedAgentId = existingConfig?.agentId ?? \"default\";\n\n const available =\n (config.available === \"enabled\" ? \"always\" : config.available) ??\n \"before-first-message\";\n\n const finalSuggestionConfig = {\n ...config,\n available,\n consumerAgentId: resolvedAgentId, // Use chatConfig.agentId here\n };\n useConfigureSuggestions(finalSuggestionConfig, dependencies);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4DA,mBAKO;AAmDA,SAAS,0BACd,QACA,eAAsB,CAAC,GACvB;AAvHF;AAwHE,QAAM,qBAAiB,0CAA4B;AACnD,QAAM,mBAAkB,sDAAgB,YAAhB,YAA2B;AAEnD,QAAM,aACH,YAAO,cAAc,YAAY,WAAW,OAAO,cAAnD,YACD;AAEF,QAAM,wBAAwB,iCACzB,SADyB;AAAA,IAE5B;AAAA,IACA,iBAAiB;AAAA;AAAA,EACnB;AACA,4CAAwB,uBAAuB,YAAY;AAC7D;","names":[]}
|
|
@@ -117,7 +117,9 @@ var emptyCopilotContext = {
|
|
|
117
117
|
},
|
|
118
118
|
copilotApiConfig: new class {
|
|
119
119
|
get chatApiEndpoint() {
|
|
120
|
-
throw new Error(
|
|
120
|
+
throw new Error(
|
|
121
|
+
"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!"
|
|
122
|
+
);
|
|
121
123
|
}
|
|
122
124
|
get headers() {
|
|
123
125
|
return {};
|
|
@@ -179,12 +181,16 @@ var CopilotContext = import_react.default.createContext(emptyCopilotContext);
|
|
|
179
181
|
function useCopilotContext() {
|
|
180
182
|
const context = import_react.default.useContext(CopilotContext);
|
|
181
183
|
if (context === emptyCopilotContext) {
|
|
182
|
-
throw new Error(
|
|
184
|
+
throw new Error(
|
|
185
|
+
"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!"
|
|
186
|
+
);
|
|
183
187
|
}
|
|
184
188
|
return context;
|
|
185
189
|
}
|
|
186
190
|
function returnAndThrowInDebug(_value) {
|
|
187
|
-
throw new Error(
|
|
191
|
+
throw new Error(
|
|
192
|
+
"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!"
|
|
193
|
+
);
|
|
188
194
|
}
|
|
189
195
|
|
|
190
196
|
// src/components/error-boundary/error-utils.tsx
|
|
@@ -321,13 +327,13 @@ var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
|
321
327
|
// src/context/coagent-state-renders-context.tsx
|
|
322
328
|
var import_react4 = require("react");
|
|
323
329
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
324
|
-
var CoAgentStateRendersContext = (0, import_react4.createContext)(
|
|
325
|
-
void 0
|
|
326
|
-
);
|
|
330
|
+
var CoAgentStateRendersContext = (0, import_react4.createContext)(void 0);
|
|
327
331
|
function useCoAgentStateRenders() {
|
|
328
332
|
const context = (0, import_react4.useContext)(CoAgentStateRendersContext);
|
|
329
333
|
if (!context) {
|
|
330
|
-
throw new Error(
|
|
334
|
+
throw new Error(
|
|
335
|
+
"useCoAgentStateRenders must be used within CoAgentStateRendersProvider"
|
|
336
|
+
);
|
|
331
337
|
}
|
|
332
338
|
return context;
|
|
333
339
|
}
|
|
@@ -367,7 +373,12 @@ function useAgentNodeName(agentName) {
|
|
|
367
373
|
|
|
368
374
|
// src/hooks/use-langgraph-interrupt-render.ts
|
|
369
375
|
var import_react8 = require("@copilotkitnext/react");
|
|
370
|
-
var InterruptRenderer = ({
|
|
376
|
+
var InterruptRenderer = ({
|
|
377
|
+
event,
|
|
378
|
+
result,
|
|
379
|
+
render,
|
|
380
|
+
resolve
|
|
381
|
+
}) => {
|
|
371
382
|
return render({ event, result, resolve });
|
|
372
383
|
};
|
|
373
384
|
function useLangGraphInterruptRender(agent) {
|
|
@@ -469,7 +480,13 @@ function useLangGraphInterruptRender(agent) {
|
|
|
469
480
|
render,
|
|
470
481
|
resolve: resolveInterrupt
|
|
471
482
|
});
|
|
472
|
-
}, [
|
|
483
|
+
}, [
|
|
484
|
+
interruptActions,
|
|
485
|
+
interruptEventQueue,
|
|
486
|
+
threadId,
|
|
487
|
+
agentSession,
|
|
488
|
+
handleResolve
|
|
489
|
+
]);
|
|
473
490
|
}
|
|
474
491
|
|
|
475
492
|
// src/hooks/use-copilot-chat_internal.ts
|
|
@@ -666,7 +683,13 @@ function selectSnapshot({
|
|
|
666
683
|
cachedSnapshot = caches.byStateRenderAndRun[`${stateRenderId}::latest`];
|
|
667
684
|
}
|
|
668
685
|
const snapshotForClaim = (existingClaim == null ? void 0 : existingClaim.locked) ? (_e = existingClaim.stateSnapshot) != null ? _e : cachedSnapshot : hasSnapshotKeys ? snapshot : (_f = existingClaim == null ? void 0 : existingClaim.stateSnapshot) != null ? _f : cachedSnapshot;
|
|
669
|
-
return {
|
|
686
|
+
return {
|
|
687
|
+
snapshot,
|
|
688
|
+
hasSnapshotKeys,
|
|
689
|
+
cachedSnapshot,
|
|
690
|
+
allowEmptySnapshot,
|
|
691
|
+
snapshotForClaim
|
|
692
|
+
};
|
|
670
693
|
}
|
|
671
694
|
|
|
672
695
|
// src/hooks/use-coagent-state-render-registry.ts
|
|
@@ -771,7 +794,9 @@ function useStateRenderRegistry({
|
|
|
771
794
|
});
|
|
772
795
|
}
|
|
773
796
|
if (existingClaim && !existingClaim.locked && (agentMessages == null ? void 0 : agentMessages.length)) {
|
|
774
|
-
const indexInAgentMessages = agentMessages.findIndex(
|
|
797
|
+
const indexInAgentMessages = agentMessages.findIndex(
|
|
798
|
+
(msg) => msg.id === message.id
|
|
799
|
+
);
|
|
775
800
|
if (indexInAgentMessages >= 0 && indexInAgentMessages < agentMessages.length - 1) {
|
|
776
801
|
existingClaim.locked = true;
|
|
777
802
|
}
|
|
@@ -803,7 +828,10 @@ function useStateRenderRegistry({
|
|
|
803
828
|
snapshotCache[`${stateRenderId}::latest`] = snapshotForClaim;
|
|
804
829
|
store[LAST_SNAPSHOTS_BY_RENDER_AND_RUN] = snapshotCache;
|
|
805
830
|
const messageCache = __spreadValues({}, (_f = store[LAST_SNAPSHOTS_BY_MESSAGE]) != null ? _f : {});
|
|
806
|
-
messageCache[message.id] = {
|
|
831
|
+
messageCache[message.id] = {
|
|
832
|
+
snapshot: snapshotForClaim,
|
|
833
|
+
runId: effectiveRunId
|
|
834
|
+
};
|
|
807
835
|
store[LAST_SNAPSHOTS_BY_MESSAGE] = messageCache;
|
|
808
836
|
}
|
|
809
837
|
}
|
|
@@ -843,18 +871,23 @@ function useCoagentStateRenderBridge(agentId, props) {
|
|
|
843
871
|
}, [agentId, nodeName]);
|
|
844
872
|
const getStateRender = (0, import_react13.useCallback)(
|
|
845
873
|
(messageId) => {
|
|
846
|
-
return Object.entries(coAgentStateRenders).find(
|
|
847
|
-
|
|
848
|
-
|
|
874
|
+
return Object.entries(coAgentStateRenders).find(
|
|
875
|
+
([stateRenderId2, stateRender2]) => {
|
|
876
|
+
if (claimsRef.current[messageId]) {
|
|
877
|
+
return stateRenderId2 === claimsRef.current[messageId].stateRenderId;
|
|
878
|
+
}
|
|
879
|
+
const matchingAgentName = stateRender2.name === agentId;
|
|
880
|
+
const matchesNodeContext = stateRender2.nodeName ? stateRender2.nodeName === nodeName : true;
|
|
881
|
+
return matchingAgentName && matchesNodeContext;
|
|
849
882
|
}
|
|
850
|
-
|
|
851
|
-
const matchesNodeContext = stateRender2.nodeName ? stateRender2.nodeName === nodeName : true;
|
|
852
|
-
return matchingAgentName && matchesNodeContext;
|
|
853
|
-
});
|
|
883
|
+
);
|
|
854
884
|
},
|
|
855
885
|
[coAgentStateRenders, nodeName, agentId]
|
|
856
886
|
);
|
|
857
|
-
const stateRenderEntry = (0, import_react13.useMemo)(
|
|
887
|
+
const stateRenderEntry = (0, import_react13.useMemo)(
|
|
888
|
+
() => getStateRender(message.id),
|
|
889
|
+
[getStateRender, message.id]
|
|
890
|
+
);
|
|
858
891
|
const stateRenderId = stateRenderEntry == null ? void 0 : stateRenderEntry[0];
|
|
859
892
|
const stateRender = stateRenderEntry == null ? void 0 : stateRenderEntry[1];
|
|
860
893
|
const registryMessage = __spreadProps(__spreadValues({}, message), {
|
|
@@ -981,14 +1014,18 @@ function useCopilotChatInternal({
|
|
|
981
1014
|
if (isLoading || messages.length === 0) {
|
|
982
1015
|
return;
|
|
983
1016
|
}
|
|
984
|
-
const reloadMessageIndex = messages.findIndex(
|
|
1017
|
+
const reloadMessageIndex = messages.findIndex(
|
|
1018
|
+
(msg) => msg.id === reloadMessageId
|
|
1019
|
+
);
|
|
985
1020
|
if (reloadMessageIndex === -1) {
|
|
986
1021
|
console.warn(`Message with id ${reloadMessageId} not found`);
|
|
987
1022
|
return;
|
|
988
1023
|
}
|
|
989
1024
|
const reloadMessageRole = messages[reloadMessageIndex].role;
|
|
990
1025
|
if (reloadMessageRole !== "assistant") {
|
|
991
|
-
console.warn(
|
|
1026
|
+
console.warn(
|
|
1027
|
+
`Regenerate cannot be performed on ${reloadMessageRole} role`
|
|
1028
|
+
);
|
|
992
1029
|
return;
|
|
993
1030
|
}
|
|
994
1031
|
let historyCutoff = [messages[0]];
|
|
@@ -1000,7 +1037,10 @@ function useCopilotChatInternal({
|
|
|
1000
1037
|
const indexOfLastUserMessageBeforeRegenerate = messages.findIndex(
|
|
1001
1038
|
(msg) => msg.id === lastUserMessageBeforeRegenerate.id
|
|
1002
1039
|
);
|
|
1003
|
-
historyCutoff = messages.slice(
|
|
1040
|
+
historyCutoff = messages.slice(
|
|
1041
|
+
0,
|
|
1042
|
+
indexOfLastUserMessageBeforeRegenerate + 1
|
|
1043
|
+
);
|
|
1004
1044
|
}
|
|
1005
1045
|
} else if (messages.length > 2 && reloadMessageIndex === 0) {
|
|
1006
1046
|
historyCutoff = [messages[0], messages[1]];
|
|
@@ -1015,7 +1055,12 @@ function useCopilotChatInternal({
|
|
|
1015
1055
|
}
|
|
1016
1056
|
return;
|
|
1017
1057
|
}),
|
|
1018
|
-
[
|
|
1058
|
+
[
|
|
1059
|
+
agent == null ? void 0 : agent.messages.length,
|
|
1060
|
+
agent == null ? void 0 : agent.isRunning,
|
|
1061
|
+
agent == null ? void 0 : agent.setMessages,
|
|
1062
|
+
copilotkit == null ? void 0 : copilotkit.runAgent
|
|
1063
|
+
]
|
|
1019
1064
|
);
|
|
1020
1065
|
const latestSendMessageFunc = useAsyncCallback(
|
|
1021
1066
|
(message, options) => __async(this, null, function* () {
|
|
@@ -1111,7 +1156,10 @@ function useCopilotChatInternal({
|
|
|
1111
1156
|
const bridgeRenderer = legacyCustomMessageRenderer || renderCustomMessage ? () => {
|
|
1112
1157
|
var _a3;
|
|
1113
1158
|
if (legacyCustomMessageRenderer) {
|
|
1114
|
-
return legacyCustomMessageRenderer({
|
|
1159
|
+
return legacyCustomMessageRenderer({
|
|
1160
|
+
message,
|
|
1161
|
+
position: "before"
|
|
1162
|
+
});
|
|
1115
1163
|
}
|
|
1116
1164
|
try {
|
|
1117
1165
|
return (_a3 = renderCustomMessage == null ? void 0 : renderCustomMessage({ message, position: "before" })) != null ? _a3 : null;
|
|
@@ -1131,7 +1179,9 @@ function useCopilotChatInternal({
|
|
|
1131
1179
|
}
|
|
1132
1180
|
return message;
|
|
1133
1181
|
});
|
|
1134
|
-
const hasAssistantMessages = processedMessages.some(
|
|
1182
|
+
const hasAssistantMessages = processedMessages.some(
|
|
1183
|
+
(msg) => msg.role === "assistant"
|
|
1184
|
+
);
|
|
1135
1185
|
const canUseCustomRenderer = Boolean(
|
|
1136
1186
|
renderCustomMessage && ((_a2 = copilotkit == null ? void 0 : copilotkit.getAgent) == null ? void 0 : _a2.call(copilotkit, resolvedAgentId))
|
|
1137
1187
|
);
|
|
@@ -1146,7 +1196,11 @@ function useCopilotChatInternal({
|
|
|
1146
1196
|
}
|
|
1147
1197
|
}
|
|
1148
1198
|
const latestUserMessageId = latestUserIndex >= 0 ? processedMessages[latestUserIndex].id : void 0;
|
|
1149
|
-
const currentRunId = latestUserMessageId ? copilotkit.getRunIdForMessage(
|
|
1199
|
+
const currentRunId = latestUserMessageId ? copilotkit.getRunIdForMessage(
|
|
1200
|
+
resolvedAgentId,
|
|
1201
|
+
effectiveThreadId,
|
|
1202
|
+
latestUserMessageId
|
|
1203
|
+
) || `pending:${latestUserMessageId}` : void 0;
|
|
1150
1204
|
const hasAssistantForCurrentRun = latestUserIndex >= 0 ? processedMessages.slice(latestUserIndex + 1).some((msg) => msg.role === "assistant") : hasAssistantMessages;
|
|
1151
1205
|
if (placeholderRenderer && shouldRenderPlaceholder && !hasAssistantForCurrentRun) {
|
|
1152
1206
|
const placeholderId = currentRunId ? `coagent-state-render-${resolvedAgentId}-${currentRunId}` : `coagent-state-render-${resolvedAgentId}`;
|