@copilotkit/react-core 1.51.4-next.7 → 1.51.4-next.8
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 +10 -0
- package/README.md +18 -12
- package/dist/{chunk-DQXCQWSG.mjs → chunk-2JZZD4RP.mjs} +93 -58
- package/dist/chunk-2JZZD4RP.mjs.map +1 -0
- 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-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-VP43SLSZ.mjs → chunk-DAQORGBP.mjs} +10 -5
- package/dist/chunk-DAQORGBP.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-4RRMC7L2.mjs → chunk-IGYMBU43.mjs} +18 -7
- package/dist/chunk-IGYMBU43.mjs.map +1 -0
- 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-7DTB7S5V.mjs → chunk-LNGBARXE.mjs} +5 -2
- package/dist/chunk-LNGBARXE.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-LHERIF3L.mjs → chunk-NINJMAND.mjs} +10 -7
- package/dist/chunk-NINJMAND.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-RKTVJRK7.mjs → chunk-R7BV32X4.mjs} +5 -2
- package/dist/chunk-R7BV32X4.mjs.map +1 -0
- package/dist/{chunk-VKNLTZJE.mjs → chunk-S65UEHGI.mjs} +30 -21
- package/dist/chunk-S65UEHGI.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-HE22TZMF.mjs → chunk-SFOKX4MH.mjs} +18 -9
- package/dist/chunk-SFOKX4MH.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-XDFVCQD3.mjs → chunk-SYGQHN3H.mjs} +1 -1
- package/dist/{chunk-XDFVCQD3.mjs.map → chunk-SYGQHN3H.mjs.map} +1 -1
- 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 +7 -7
- 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 +26 -26
- 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 +12 -12
- 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 +12 -12
- 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 +11 -11
- 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 +52 -52
- 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 +5 -6
- 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
|
@@ -12,13 +12,18 @@ interface ConsoleTriggerProps {
|
|
|
12
12
|
position?: "bottom-left" | "bottom-right";
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export function ConsoleTrigger({
|
|
15
|
+
export function ConsoleTrigger({
|
|
16
|
+
position = "bottom-right",
|
|
17
|
+
}: ConsoleTriggerProps) {
|
|
16
18
|
const context = useCopilotContext();
|
|
17
19
|
const hasApiKey = Boolean(context.copilotApiConfig.publicApiKey);
|
|
18
20
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
19
21
|
const [isHovered, setIsHovered] = useState(false);
|
|
20
22
|
const [isDragging, setIsDragging] = useState(false);
|
|
21
|
-
const [buttonPosition, setButtonPosition] = useState<{
|
|
23
|
+
const [buttonPosition, setButtonPosition] = useState<{
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
} | null>(null);
|
|
22
27
|
const [mounted, setMounted] = useState(false);
|
|
23
28
|
const [isHidden, setIsHidden] = useState(false);
|
|
24
29
|
|
|
@@ -35,7 +40,9 @@ export function ConsoleTrigger({ position = "bottom-right" }: ConsoleTriggerProp
|
|
|
35
40
|
setMounted(true);
|
|
36
41
|
try {
|
|
37
42
|
const hidden =
|
|
38
|
-
typeof window !== "undefined"
|
|
43
|
+
typeof window !== "undefined"
|
|
44
|
+
? localStorage.getItem(INSPECTOR_HIDE_KEY)
|
|
45
|
+
: null;
|
|
39
46
|
if (hidden === "1" || hidden === "true") {
|
|
40
47
|
setIsHidden(true);
|
|
41
48
|
}
|
|
@@ -99,11 +106,19 @@ export function ConsoleTrigger({ position = "bottom-right" }: ConsoleTriggerProp
|
|
|
99
106
|
};
|
|
100
107
|
|
|
101
108
|
// Use capture phase to intercept events before they reach other handlers
|
|
102
|
-
document.addEventListener("mousemove", handleMouseMove, {
|
|
103
|
-
|
|
109
|
+
document.addEventListener("mousemove", handleMouseMove, {
|
|
110
|
+
capture: true,
|
|
111
|
+
passive: false,
|
|
112
|
+
});
|
|
113
|
+
document.addEventListener("mouseup", handleMouseUp, {
|
|
114
|
+
capture: true,
|
|
115
|
+
passive: false,
|
|
116
|
+
});
|
|
104
117
|
|
|
105
118
|
return () => {
|
|
106
|
-
document.removeEventListener("mousemove", handleMouseMove, {
|
|
119
|
+
document.removeEventListener("mousemove", handleMouseMove, {
|
|
120
|
+
capture: true,
|
|
121
|
+
});
|
|
107
122
|
document.removeEventListener("mouseup", handleMouseUp, { capture: true });
|
|
108
123
|
};
|
|
109
124
|
}, [isDragging]);
|
|
@@ -147,7 +162,11 @@ export function ConsoleTrigger({ position = "bottom-right" }: ConsoleTriggerProp
|
|
|
147
162
|
zIndex: 2147483647,
|
|
148
163
|
width: "60px",
|
|
149
164
|
height: "60px",
|
|
150
|
-
background: isDragging
|
|
165
|
+
background: isDragging
|
|
166
|
+
? "#000000"
|
|
167
|
+
: isHovered
|
|
168
|
+
? "#111111"
|
|
169
|
+
: "#000000",
|
|
151
170
|
color: "white",
|
|
152
171
|
borderRadius: "50%",
|
|
153
172
|
boxShadow: isDragging
|
|
@@ -155,7 +174,9 @@ export function ConsoleTrigger({ position = "bottom-right" }: ConsoleTriggerProp
|
|
|
155
174
|
: isHovered
|
|
156
175
|
? "0 12px 40px rgba(0, 0, 0, 0.7), 0 6px 20px rgba(0, 0, 0, 0.5)"
|
|
157
176
|
: "0 6px 20px rgba(0, 0, 0, 0.5), 0 3px 10px rgba(0, 0, 0, 0.3)",
|
|
158
|
-
transition: isDragging
|
|
177
|
+
transition: isDragging
|
|
178
|
+
? "none"
|
|
179
|
+
: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
159
180
|
display: "flex",
|
|
160
181
|
alignItems: "center",
|
|
161
182
|
justifyContent: "center",
|
|
@@ -163,7 +184,11 @@ export function ConsoleTrigger({ position = "bottom-right" }: ConsoleTriggerProp
|
|
|
163
184
|
cursor: isDragging ? "grabbing" : "grab",
|
|
164
185
|
opacity: 1,
|
|
165
186
|
userSelect: "none",
|
|
166
|
-
transform: isDragging
|
|
187
|
+
transform: isDragging
|
|
188
|
+
? "scale(1.05)"
|
|
189
|
+
: isHovered
|
|
190
|
+
? "scale(1.1)"
|
|
191
|
+
: "scale(1)",
|
|
167
192
|
backdropFilter: "blur(10px)",
|
|
168
193
|
pointerEvents: "auto",
|
|
169
194
|
isolation: "isolate",
|
|
@@ -239,7 +264,11 @@ export function ConsoleTrigger({ position = "bottom-right" }: ConsoleTriggerProp
|
|
|
239
264
|
border: "2px solid white",
|
|
240
265
|
}}
|
|
241
266
|
>
|
|
242
|
-
<span
|
|
267
|
+
<span
|
|
268
|
+
style={{ fontSize: "10px", color: "white", fontWeight: "bold" }}
|
|
269
|
+
>
|
|
270
|
+
!
|
|
271
|
+
</span>
|
|
243
272
|
</div>
|
|
244
273
|
)}
|
|
245
274
|
</button>
|
|
@@ -4,7 +4,11 @@ import { useCopilotContext } from "../../context/copilot-context";
|
|
|
4
4
|
import { useCopilotMessagesContext } from "../../context/copilot-messages-context";
|
|
5
5
|
import { COPILOTKIT_VERSION } from "@copilotkit/shared";
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
CheckIcon,
|
|
9
|
+
CopilotKitIcon,
|
|
10
|
+
ExclamationMarkTriangleIcon,
|
|
11
|
+
} from "./icons";
|
|
8
12
|
|
|
9
13
|
// Type definitions for the developer console
|
|
10
14
|
interface ActionParameter {
|
|
@@ -66,7 +70,11 @@ interface DeveloperConsoleModalProps {
|
|
|
66
70
|
hasApiKey: boolean;
|
|
67
71
|
}
|
|
68
72
|
|
|
69
|
-
export function DeveloperConsoleModal({
|
|
73
|
+
export function DeveloperConsoleModal({
|
|
74
|
+
isOpen,
|
|
75
|
+
onClose,
|
|
76
|
+
hasApiKey,
|
|
77
|
+
}: DeveloperConsoleModalProps) {
|
|
70
78
|
const context = useCopilotContext();
|
|
71
79
|
const messagesContext = useCopilotMessagesContext();
|
|
72
80
|
const [activeTab, setActiveTab] = useState("actions");
|
|
@@ -97,9 +105,18 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
97
105
|
? (context as DisplayContext)
|
|
98
106
|
: {
|
|
99
107
|
actions: {
|
|
100
|
-
search_web: {
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
search_web: {
|
|
109
|
+
name: "search_web",
|
|
110
|
+
description: "Search the web for information",
|
|
111
|
+
},
|
|
112
|
+
send_email: {
|
|
113
|
+
name: "send_email",
|
|
114
|
+
description: "Send an email to a contact",
|
|
115
|
+
},
|
|
116
|
+
create_document: {
|
|
117
|
+
name: "create_document",
|
|
118
|
+
description: "Create a new document",
|
|
119
|
+
},
|
|
103
120
|
analyze_code: {
|
|
104
121
|
name: "analyze_code",
|
|
105
122
|
description: "Analyze code for issues and improvements",
|
|
@@ -111,11 +128,13 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
111
128
|
},
|
|
112
129
|
getAllContext: () => [
|
|
113
130
|
{
|
|
114
|
-
content:
|
|
131
|
+
content:
|
|
132
|
+
"User preferences: dark mode enabled, TypeScript preferred",
|
|
115
133
|
metadata: { source: "settings" },
|
|
116
134
|
},
|
|
117
135
|
{
|
|
118
|
-
content:
|
|
136
|
+
content:
|
|
137
|
+
"Current project: Building a React application with CopilotKit",
|
|
119
138
|
metadata: { source: "project" },
|
|
120
139
|
},
|
|
121
140
|
{
|
|
@@ -129,7 +148,10 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
129
148
|
],
|
|
130
149
|
coagentStates: {
|
|
131
150
|
"main-agent": { status: "active", lastUpdate: Date.now() },
|
|
132
|
-
"code-assistant": {
|
|
151
|
+
"code-assistant": {
|
|
152
|
+
status: "active",
|
|
153
|
+
lastUpdate: Date.now() - 15000,
|
|
154
|
+
},
|
|
133
155
|
"search-agent": { status: "idle", lastUpdate: Date.now() - 60000 },
|
|
134
156
|
},
|
|
135
157
|
getDocumentsContext: () => [
|
|
@@ -155,7 +177,8 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
155
177
|
{
|
|
156
178
|
id: "1",
|
|
157
179
|
role: "user",
|
|
158
|
-
content:
|
|
180
|
+
content:
|
|
181
|
+
"Help me implement a todo list with drag and drop functionality",
|
|
159
182
|
},
|
|
160
183
|
{
|
|
161
184
|
id: "2",
|
|
@@ -163,14 +186,22 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
163
186
|
content:
|
|
164
187
|
"I'll help you create a todo list with drag and drop. Let me start by setting up the basic components and then add the drag and drop functionality using React DnD.",
|
|
165
188
|
},
|
|
166
|
-
{
|
|
189
|
+
{
|
|
190
|
+
id: "3",
|
|
191
|
+
role: "user",
|
|
192
|
+
content: "Can you also add priority levels and due dates?",
|
|
193
|
+
},
|
|
167
194
|
{
|
|
168
195
|
id: "4",
|
|
169
196
|
role: "assistant",
|
|
170
197
|
content:
|
|
171
198
|
"Absolutely! I'll enhance the todo items with priority levels (high, medium, low) and due date functionality. This will make your todo list much more powerful for task management.",
|
|
172
199
|
},
|
|
173
|
-
{
|
|
200
|
+
{
|
|
201
|
+
id: "5",
|
|
202
|
+
role: "user",
|
|
203
|
+
content: "Perfect! How about adding categories or tags?",
|
|
204
|
+
},
|
|
174
205
|
],
|
|
175
206
|
};
|
|
176
207
|
|
|
@@ -275,14 +306,26 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
275
306
|
}}
|
|
276
307
|
>
|
|
277
308
|
{[
|
|
278
|
-
{
|
|
279
|
-
|
|
309
|
+
{
|
|
310
|
+
id: "actions",
|
|
311
|
+
label: "Actions",
|
|
312
|
+
count: Object.keys(displayContext.actions).length,
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
id: "readables",
|
|
316
|
+
label: "Readables",
|
|
317
|
+
count: displayContext.getAllContext().length,
|
|
318
|
+
},
|
|
280
319
|
{
|
|
281
320
|
id: "agent",
|
|
282
321
|
label: "Agent Status",
|
|
283
322
|
count: Object.keys(displayContext.coagentStates).length,
|
|
284
323
|
},
|
|
285
|
-
{
|
|
324
|
+
{
|
|
325
|
+
id: "messages",
|
|
326
|
+
label: "Messages",
|
|
327
|
+
count: displayMessagesContext.messages.length,
|
|
328
|
+
},
|
|
286
329
|
{
|
|
287
330
|
id: "context",
|
|
288
331
|
label: "Context",
|
|
@@ -300,7 +343,8 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
300
343
|
cursor: "pointer",
|
|
301
344
|
backgroundColor: activeTab === tab.id ? "white" : "transparent",
|
|
302
345
|
color: activeTab === tab.id ? "#2563eb" : "#6b7280",
|
|
303
|
-
borderBottom:
|
|
346
|
+
borderBottom:
|
|
347
|
+
activeTab === tab.id ? "2px solid #2563eb" : "none",
|
|
304
348
|
transition: "all 0.2s",
|
|
305
349
|
}}
|
|
306
350
|
onMouseEnter={(e) => {
|
|
@@ -347,9 +391,13 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
347
391
|
}}
|
|
348
392
|
>
|
|
349
393
|
{activeTab === "actions" && <ActionsTab context={displayContext} />}
|
|
350
|
-
{activeTab === "readables" &&
|
|
394
|
+
{activeTab === "readables" && (
|
|
395
|
+
<ReadablesTab context={displayContext} />
|
|
396
|
+
)}
|
|
351
397
|
{activeTab === "agent" && <AgentStatusTab context={displayContext} />}
|
|
352
|
-
{activeTab === "messages" &&
|
|
398
|
+
{activeTab === "messages" && (
|
|
399
|
+
<MessagesTab messagesContext={displayMessagesContext} />
|
|
400
|
+
)}
|
|
353
401
|
{activeTab === "context" && <ContextTab context={displayContext} />}
|
|
354
402
|
</div>
|
|
355
403
|
|
|
@@ -374,8 +422,12 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
374
422
|
target="_blank"
|
|
375
423
|
rel="noopener noreferrer"
|
|
376
424
|
style={{ color: "#2563eb", textDecoration: "none" }}
|
|
377
|
-
onMouseEnter={(e) =>
|
|
378
|
-
|
|
425
|
+
onMouseEnter={(e) =>
|
|
426
|
+
(e.currentTarget.style.textDecoration = "underline")
|
|
427
|
+
}
|
|
428
|
+
onMouseLeave={(e) =>
|
|
429
|
+
(e.currentTarget.style.textDecoration = "none")
|
|
430
|
+
}
|
|
379
431
|
>
|
|
380
432
|
Report an issue
|
|
381
433
|
</a>
|
|
@@ -386,8 +438,12 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
386
438
|
target="_blank"
|
|
387
439
|
rel="noopener noreferrer"
|
|
388
440
|
style={{ color: "#2563eb", textDecoration: "none" }}
|
|
389
|
-
onMouseEnter={(e) =>
|
|
390
|
-
|
|
441
|
+
onMouseEnter={(e) =>
|
|
442
|
+
(e.currentTarget.style.textDecoration = "underline")
|
|
443
|
+
}
|
|
444
|
+
onMouseLeave={(e) =>
|
|
445
|
+
(e.currentTarget.style.textDecoration = "none")
|
|
446
|
+
}
|
|
391
447
|
>
|
|
392
448
|
Add MCP Server →
|
|
393
449
|
</a>
|
|
@@ -415,7 +471,9 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
415
471
|
onClick={(e) => e.stopPropagation()}
|
|
416
472
|
>
|
|
417
473
|
<button
|
|
418
|
-
onClick={() =>
|
|
474
|
+
onClick={() =>
|
|
475
|
+
window.open("https://cloud.copilotkit.ai/sign-in", "_blank")
|
|
476
|
+
}
|
|
419
477
|
style={{
|
|
420
478
|
// Following button system specifications
|
|
421
479
|
height: "48px",
|
|
@@ -427,9 +485,11 @@ export function DeveloperConsoleModal({ isOpen, onClose, hasApiKey }: DeveloperC
|
|
|
427
485
|
cursor: "pointer",
|
|
428
486
|
fontSize: "14px", // Medium Semi Bold typography
|
|
429
487
|
fontWeight: "600",
|
|
430
|
-
fontFamily:
|
|
488
|
+
fontFamily:
|
|
489
|
+
"'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif",
|
|
431
490
|
lineHeight: "22px",
|
|
432
|
-
boxShadow:
|
|
491
|
+
boxShadow:
|
|
492
|
+
"0 4px 16px rgba(3, 5, 7, 0.2), 0 1px 3px rgba(3, 5, 7, 0.1)",
|
|
433
493
|
transition: "all 200ms ease", // 200ms ease as per specs
|
|
434
494
|
display: "inline-flex",
|
|
435
495
|
alignItems: "center",
|
|
@@ -482,8 +542,12 @@ function ActionsTab({ context }: { context: DisplayContext }) {
|
|
|
482
542
|
if (actions.length === 0) {
|
|
483
543
|
return (
|
|
484
544
|
<div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
|
|
485
|
-
<p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>
|
|
486
|
-
|
|
545
|
+
<p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>
|
|
546
|
+
No actions available
|
|
547
|
+
</p>
|
|
548
|
+
<p style={{ fontSize: "14px", margin: 0 }}>
|
|
549
|
+
Actions will appear here when registered
|
|
550
|
+
</p>
|
|
487
551
|
</div>
|
|
488
552
|
);
|
|
489
553
|
}
|
|
@@ -502,14 +566,30 @@ function ActionsTab({ context }: { context: DisplayContext }) {
|
|
|
502
566
|
}}
|
|
503
567
|
>
|
|
504
568
|
<div
|
|
505
|
-
style={{
|
|
569
|
+
style={{
|
|
570
|
+
display: "flex",
|
|
571
|
+
alignItems: "flex-start",
|
|
572
|
+
justifyContent: "space-between",
|
|
573
|
+
}}
|
|
506
574
|
>
|
|
507
575
|
<div style={{ flex: 1 }}>
|
|
508
|
-
<h3
|
|
576
|
+
<h3
|
|
577
|
+
style={{
|
|
578
|
+
fontWeight: "600",
|
|
579
|
+
color: "#1f2937",
|
|
580
|
+
margin: "0 0 4px 0",
|
|
581
|
+
}}
|
|
582
|
+
>
|
|
509
583
|
{action.name}
|
|
510
584
|
</h3>
|
|
511
585
|
{action.description && (
|
|
512
|
-
<p
|
|
586
|
+
<p
|
|
587
|
+
style={{
|
|
588
|
+
fontSize: "14px",
|
|
589
|
+
color: "#4b5563",
|
|
590
|
+
margin: "0 0 12px 0",
|
|
591
|
+
}}
|
|
592
|
+
>
|
|
513
593
|
{action.description}
|
|
514
594
|
</p>
|
|
515
595
|
)}
|
|
@@ -526,30 +606,59 @@ function ActionsTab({ context }: { context: DisplayContext }) {
|
|
|
526
606
|
>
|
|
527
607
|
Parameters:
|
|
528
608
|
</p>
|
|
529
|
-
<div
|
|
530
|
-
{
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
609
|
+
<div
|
|
610
|
+
style={{
|
|
611
|
+
display: "flex",
|
|
612
|
+
flexDirection: "column",
|
|
613
|
+
gap: "4px",
|
|
614
|
+
}}
|
|
615
|
+
>
|
|
616
|
+
{action.parameters.map(
|
|
617
|
+
(param: ActionParameter, pIndex: number) => (
|
|
618
|
+
<div key={pIndex} style={{ fontSize: "14px" }}>
|
|
619
|
+
<span
|
|
620
|
+
style={{
|
|
621
|
+
fontFamily: "monospace",
|
|
622
|
+
color: "#374151",
|
|
623
|
+
}}
|
|
624
|
+
>
|
|
625
|
+
{param.name}
|
|
543
626
|
</span>
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
627
|
+
{param.required && (
|
|
628
|
+
<span
|
|
629
|
+
style={{
|
|
630
|
+
marginLeft: "4px",
|
|
631
|
+
fontSize: "12px",
|
|
632
|
+
color: "#ef4444",
|
|
633
|
+
}}
|
|
634
|
+
>
|
|
635
|
+
*required
|
|
636
|
+
</span>
|
|
637
|
+
)}
|
|
638
|
+
{param.type && (
|
|
639
|
+
<span
|
|
640
|
+
style={{
|
|
641
|
+
marginLeft: "8px",
|
|
642
|
+
fontSize: "12px",
|
|
643
|
+
color: "#6b7280",
|
|
644
|
+
}}
|
|
645
|
+
>
|
|
646
|
+
({param.type})
|
|
647
|
+
</span>
|
|
648
|
+
)}
|
|
649
|
+
</div>
|
|
650
|
+
),
|
|
651
|
+
)}
|
|
547
652
|
</div>
|
|
548
653
|
</div>
|
|
549
654
|
)}
|
|
550
655
|
</div>
|
|
551
656
|
<div style={{ marginLeft: "16px" }}>
|
|
552
|
-
{action.status === "available" ?
|
|
657
|
+
{action.status === "available" ? (
|
|
658
|
+
<CheckIcon />
|
|
659
|
+
) : (
|
|
660
|
+
<ExclamationMarkTriangleIcon />
|
|
661
|
+
)}
|
|
553
662
|
</div>
|
|
554
663
|
</div>
|
|
555
664
|
</div>
|
|
@@ -564,7 +673,9 @@ function ReadablesTab({ context }: { context: DisplayContext }) {
|
|
|
564
673
|
if (readables.length === 0) {
|
|
565
674
|
return (
|
|
566
675
|
<div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
|
|
567
|
-
<p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>
|
|
676
|
+
<p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>
|
|
677
|
+
No readable context available
|
|
678
|
+
</p>
|
|
568
679
|
<p style={{ fontSize: "14px", margin: 0 }}>
|
|
569
680
|
Readable context will appear here when provided
|
|
570
681
|
</p>
|
|
@@ -586,14 +697,30 @@ function ReadablesTab({ context }: { context: DisplayContext }) {
|
|
|
586
697
|
}}
|
|
587
698
|
>
|
|
588
699
|
<div
|
|
589
|
-
style={{
|
|
700
|
+
style={{
|
|
701
|
+
display: "flex",
|
|
702
|
+
alignItems: "flex-start",
|
|
703
|
+
justifyContent: "space-between",
|
|
704
|
+
}}
|
|
590
705
|
>
|
|
591
706
|
<div style={{ flex: 1 }}>
|
|
592
|
-
<h3
|
|
707
|
+
<h3
|
|
708
|
+
style={{
|
|
709
|
+
fontWeight: "600",
|
|
710
|
+
color: "#1f2937",
|
|
711
|
+
margin: "0 0 4px 0",
|
|
712
|
+
}}
|
|
713
|
+
>
|
|
593
714
|
{readable.name || `Readable ${index + 1}`}
|
|
594
715
|
</h3>
|
|
595
716
|
{readable.description && (
|
|
596
|
-
<p
|
|
717
|
+
<p
|
|
718
|
+
style={{
|
|
719
|
+
fontSize: "14px",
|
|
720
|
+
color: "#4b5563",
|
|
721
|
+
margin: "0 0 12px 0",
|
|
722
|
+
}}
|
|
723
|
+
>
|
|
597
724
|
{readable.description}
|
|
598
725
|
</p>
|
|
599
726
|
)}
|
|
@@ -627,7 +754,9 @@ function AgentStatusTab({ context }: { context: DisplayContext }) {
|
|
|
627
754
|
if (agentStateEntries.length === 0) {
|
|
628
755
|
return (
|
|
629
756
|
<div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
|
|
630
|
-
<p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>
|
|
757
|
+
<p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>
|
|
758
|
+
No agent states available
|
|
759
|
+
</p>
|
|
631
760
|
<p style={{ fontSize: "14px", margin: 0 }}>
|
|
632
761
|
Agent states will appear here when agents are active
|
|
633
762
|
</p>
|
|
@@ -656,7 +785,14 @@ function AgentStatusTab({ context }: { context: DisplayContext }) {
|
|
|
656
785
|
marginBottom: "16px",
|
|
657
786
|
}}
|
|
658
787
|
>
|
|
659
|
-
<h3
|
|
788
|
+
<h3
|
|
789
|
+
style={{
|
|
790
|
+
fontWeight: "600",
|
|
791
|
+
fontSize: "18px",
|
|
792
|
+
color: "#1f2937",
|
|
793
|
+
margin: 0,
|
|
794
|
+
}}
|
|
795
|
+
>
|
|
660
796
|
{agentName}
|
|
661
797
|
</h3>
|
|
662
798
|
<span
|
|
@@ -749,7 +885,11 @@ function AgentStatusTab({ context }: { context: DisplayContext }) {
|
|
|
749
885
|
);
|
|
750
886
|
}
|
|
751
887
|
|
|
752
|
-
function MessagesTab({
|
|
888
|
+
function MessagesTab({
|
|
889
|
+
messagesContext,
|
|
890
|
+
}: {
|
|
891
|
+
messagesContext: MessagesContext;
|
|
892
|
+
}) {
|
|
753
893
|
const messages = messagesContext.messages || [];
|
|
754
894
|
|
|
755
895
|
if (messages.length === 0) {
|
|
@@ -806,7 +946,13 @@ function MessagesTab({ messagesContext }: { messagesContext: MessagesContext })
|
|
|
806
946
|
</span>
|
|
807
947
|
)}
|
|
808
948
|
</div>
|
|
809
|
-
<div
|
|
949
|
+
<div
|
|
950
|
+
style={{
|
|
951
|
+
fontSize: "14px",
|
|
952
|
+
color: "#1f2937",
|
|
953
|
+
whiteSpace: "pre-wrap",
|
|
954
|
+
}}
|
|
955
|
+
>
|
|
810
956
|
{message.content || ""}
|
|
811
957
|
</div>
|
|
812
958
|
</div>
|
|
@@ -821,7 +967,9 @@ function ContextTab({ context }: { context: DisplayContext }) {
|
|
|
821
967
|
if (documents.length === 0) {
|
|
822
968
|
return (
|
|
823
969
|
<div style={{ textAlign: "center", padding: "48px 0", color: "#6b7280" }}>
|
|
824
|
-
<p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>
|
|
970
|
+
<p style={{ fontSize: "18px", margin: "0 0 8px 0" }}>
|
|
971
|
+
No document context available
|
|
972
|
+
</p>
|
|
825
973
|
<p style={{ fontSize: "14px", margin: 0 }}>
|
|
826
974
|
Document context will appear here when provided
|
|
827
975
|
</p>
|
|
@@ -842,7 +990,9 @@ function ContextTab({ context }: { context: DisplayContext }) {
|
|
|
842
990
|
border: "1px solid #e5e7eb",
|
|
843
991
|
}}
|
|
844
992
|
>
|
|
845
|
-
<h3
|
|
993
|
+
<h3
|
|
994
|
+
style={{ fontWeight: "600", color: "#1f2937", margin: "0 0 8px 0" }}
|
|
995
|
+
>
|
|
846
996
|
{doc.name || `Document ${index + 1}`}
|
|
847
997
|
</h3>
|
|
848
998
|
{doc.content && (
|
|
@@ -67,7 +67,12 @@ export const CheckIcon = () => (
|
|
|
67
67
|
xmlns="http://www.w3.org/2000/svg"
|
|
68
68
|
>
|
|
69
69
|
<g id="Page-1" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
70
|
-
<g
|
|
70
|
+
<g
|
|
71
|
+
id="Group-2"
|
|
72
|
+
transform="translate(-118, 0)"
|
|
73
|
+
fill="#1BC030"
|
|
74
|
+
fillRule="nonzero"
|
|
75
|
+
>
|
|
71
76
|
<g id="Group" transform="translate(118, 0)">
|
|
72
77
|
<path
|
|
73
78
|
d="M0,7 C0,3.13384615 3.13384615,0 7,0 C10.8661538,0 14,3.13384615 14,7 C14,10.8661538 10.8661538,14 7,14 C3.13384615,14 0,10.8661538 0,7 Z M9.59179487,5.69764103 C9.70905818,5.54139023 9.73249341,5.33388318 9.65303227,5.15541491 C9.57357113,4.97694665 9.40367989,4.85551619 9.20909814,4.83811118 C9.01451638,4.82070616 8.82577109,4.91005717 8.71589744,5.07158974 L6.39261538,8.32389744 L5.22666667,7.15794872 C5.01450582,6.96025518 4.68389046,6.9660885 4.47883563,7.17114332 C4.27378081,7.37619815 4.26794748,7.70681351 4.46564103,7.91897436 L6.08102564,9.53435897 C6.19289944,9.64614839 6.3482622,9.70310251 6.50588106,9.69010587 C6.66349993,9.67710922 6.80743532,9.59547613 6.89948718,9.46687179 L9.59179487,5.69764103 L9.59179487,5.69764103 Z"
|
|
@@ -62,7 +62,9 @@ export class CopilotErrorBoundary extends React.Component<Props, State> {
|
|
|
62
62
|
{this.props.children}
|
|
63
63
|
{this.props.showUsageBanner && (
|
|
64
64
|
<UsageBanner
|
|
65
|
-
severity={
|
|
65
|
+
severity={
|
|
66
|
+
this.state.status?.severity ?? this.state.error.severity
|
|
67
|
+
}
|
|
66
68
|
message={this.state.status?.message ?? this.state.error.message}
|
|
67
69
|
actions={getErrorActions(this.state.error)}
|
|
68
70
|
/>
|
|
@@ -77,7 +79,13 @@ export class CopilotErrorBoundary extends React.Component<Props, State> {
|
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
export function ErrorToast({
|
|
82
|
+
export function ErrorToast({
|
|
83
|
+
error,
|
|
84
|
+
children,
|
|
85
|
+
}: {
|
|
86
|
+
error?: Error;
|
|
87
|
+
children: React.ReactNode;
|
|
88
|
+
}) {
|
|
81
89
|
const addErrorToast = useErrorToast();
|
|
82
90
|
|
|
83
91
|
useEffect(() => {
|
|
@@ -12,9 +12,12 @@ interface OriginalError {
|
|
|
12
12
|
export function ErrorToast({ errors }: { errors: (Error | GraphQLError)[] }) {
|
|
13
13
|
const errorsToRender = errors.map((error, idx) => {
|
|
14
14
|
const originalError =
|
|
15
|
-
"extensions" in error
|
|
15
|
+
"extensions" in error
|
|
16
|
+
? (error.extensions?.originalError as undefined | OriginalError)
|
|
17
|
+
: {};
|
|
16
18
|
const message = originalError?.message ?? error.message;
|
|
17
|
-
const code =
|
|
19
|
+
const code =
|
|
20
|
+
"extensions" in error ? (error.extensions?.code as string) : null;
|
|
18
21
|
|
|
19
22
|
return (
|
|
20
23
|
<div
|
|
@@ -34,7 +37,9 @@ export function ErrorToast({ errors }: { errors: (Error | GraphQLError)[] }) {
|
|
|
34
37
|
}}
|
|
35
38
|
>
|
|
36
39
|
Copilot Runtime Error:{" "}
|
|
37
|
-
<span style={{ fontFamily: "monospace", fontWeight: "normal" }}>
|
|
40
|
+
<span style={{ fontFamily: "monospace", fontWeight: "normal" }}>
|
|
41
|
+
{code}
|
|
42
|
+
</span>
|
|
38
43
|
</div>
|
|
39
44
|
)}
|
|
40
45
|
<ReactMarkdown>{message}</ReactMarkdown>
|