@copilotkit/react-core 1.10.0-next.10 → 1.10.0-next.12

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 (96) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{chunk-LVWV62JZ.mjs → chunk-2PL3WCKM.mjs} +18 -17
  3. package/dist/chunk-2PL3WCKM.mjs.map +1 -0
  4. package/dist/chunk-3BASANUO.mjs +170 -0
  5. package/dist/chunk-3BASANUO.mjs.map +1 -0
  6. package/dist/{chunk-L6HQIJ74.mjs → chunk-7TFJCTYY.mjs} +8 -8
  7. package/dist/{chunk-2TSNHEIS.mjs → chunk-BVRWKRDI.mjs} +5 -5
  8. package/dist/{chunk-DLEXVOQE.mjs → chunk-GEKWHETN.mjs} +4 -4
  9. package/dist/{chunk-Q42NJFXR.mjs → chunk-IKWGQG5V.mjs} +4 -4
  10. package/dist/{chunk-JJDXTTEN.mjs → chunk-K4HXT453.mjs} +2 -2
  11. package/dist/{chunk-JBLMXZ3O.mjs → chunk-KH27ZS4Y.mjs} +6 -6
  12. package/dist/{chunk-QGE7U4NV.mjs → chunk-MO2BUFJD.mjs} +2 -2
  13. package/dist/{chunk-TWYUYC4F.mjs → chunk-MUDXTKXE.mjs} +6 -6
  14. package/dist/{chunk-COEUPDRL.mjs → chunk-OGXCE54J.mjs} +8 -8
  15. package/dist/{chunk-X2DNXTME.mjs → chunk-OPRDTF4S.mjs} +4 -4
  16. package/dist/chunk-PIF5KJYI.mjs +103 -0
  17. package/dist/chunk-PIF5KJYI.mjs.map +1 -0
  18. package/dist/{chunk-IHAZJF3V.mjs → chunk-PYPPRFZ6.mjs} +2 -2
  19. package/dist/{chunk-ADZDXHVC.mjs → chunk-Q573EMPD.mjs} +4 -4
  20. package/dist/chunk-WSXTUD36.mjs +759 -0
  21. package/dist/chunk-WSXTUD36.mjs.map +1 -0
  22. package/dist/components/copilot-provider/copilot-messages.mjs +3 -3
  23. package/dist/components/copilot-provider/copilotkit.js +1034 -63
  24. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  25. package/dist/components/copilot-provider/copilotkit.mjs +11 -8
  26. package/dist/components/copilot-provider/index.js +1034 -63
  27. package/dist/components/copilot-provider/index.js.map +1 -1
  28. package/dist/components/copilot-provider/index.mjs +11 -8
  29. package/dist/components/dev-console/console-trigger.d.ts +8 -0
  30. package/dist/components/dev-console/console-trigger.js +1131 -0
  31. package/dist/components/dev-console/console-trigger.js.map +1 -0
  32. package/dist/components/dev-console/console-trigger.mjs +13 -0
  33. package/dist/components/dev-console/console-trigger.mjs.map +1 -0
  34. package/dist/components/dev-console/developer-console-modal.d.ts +10 -0
  35. package/dist/components/dev-console/developer-console-modal.js +977 -0
  36. package/dist/components/dev-console/developer-console-modal.js.map +1 -0
  37. package/dist/components/dev-console/developer-console-modal.mjs +12 -0
  38. package/dist/components/dev-console/developer-console-modal.mjs.map +1 -0
  39. package/dist/components/dev-console/icons.d.ts +9 -0
  40. package/dist/components/dev-console/icons.js +131 -0
  41. package/dist/components/dev-console/icons.js.map +1 -0
  42. package/dist/components/dev-console/icons.mjs +16 -0
  43. package/dist/components/dev-console/icons.mjs.map +1 -0
  44. package/dist/components/error-boundary/error-boundary.mjs +2 -2
  45. package/dist/components/index.js +1034 -63
  46. package/dist/components/index.js.map +1 -1
  47. package/dist/components/index.mjs +11 -8
  48. package/dist/context/index.mjs +4 -4
  49. package/dist/hooks/index.js.map +1 -1
  50. package/dist/hooks/index.mjs +32 -29
  51. package/dist/hooks/use-chat.mjs +4 -4
  52. package/dist/hooks/use-coagent-state-render.mjs +2 -2
  53. package/dist/hooks/use-coagent.js.map +1 -1
  54. package/dist/hooks/use-coagent.mjs +16 -13
  55. package/dist/hooks/use-copilot-action.mjs +2 -2
  56. package/dist/hooks/use-copilot-authenticated-action.mjs +3 -3
  57. package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
  58. package/dist/hooks/use-copilot-chat-headless_c.mjs +16 -13
  59. package/dist/hooks/use-copilot-chat.js.map +1 -1
  60. package/dist/hooks/use-copilot-chat.mjs +16 -13
  61. package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
  62. package/dist/hooks/use-copilot-chat_internal.mjs +15 -12
  63. package/dist/hooks/use-langgraph-interrupt-render.mjs +1 -1
  64. package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
  65. package/dist/hooks/use-langgraph-interrupt.mjs +16 -13
  66. package/dist/index.js +1131 -169
  67. package/dist/index.js.map +1 -1
  68. package/dist/index.mjs +36 -33
  69. package/dist/lib/copilot-task.js.map +1 -1
  70. package/dist/lib/copilot-task.mjs +13 -10
  71. package/dist/lib/index.js.map +1 -1
  72. package/dist/lib/index.mjs +13 -10
  73. package/dist/utils/extract.js.map +1 -1
  74. package/dist/utils/extract.mjs +11 -8
  75. package/dist/utils/index.js.map +1 -1
  76. package/dist/utils/index.mjs +11 -8
  77. package/dist/utils/suggestions.js.map +1 -1
  78. package/dist/utils/suggestions.mjs +11 -8
  79. package/package.json +3 -3
  80. package/src/components/copilot-provider/copilotkit.tsx +5 -6
  81. package/src/components/dev-console/console-trigger.tsx +190 -0
  82. package/src/components/dev-console/developer-console-modal.tsx +866 -0
  83. package/src/components/dev-console/icons.tsx +101 -0
  84. package/dist/chunk-LVWV62JZ.mjs.map +0 -1
  85. /package/dist/{chunk-L6HQIJ74.mjs.map → chunk-7TFJCTYY.mjs.map} +0 -0
  86. /package/dist/{chunk-2TSNHEIS.mjs.map → chunk-BVRWKRDI.mjs.map} +0 -0
  87. /package/dist/{chunk-DLEXVOQE.mjs.map → chunk-GEKWHETN.mjs.map} +0 -0
  88. /package/dist/{chunk-Q42NJFXR.mjs.map → chunk-IKWGQG5V.mjs.map} +0 -0
  89. /package/dist/{chunk-JJDXTTEN.mjs.map → chunk-K4HXT453.mjs.map} +0 -0
  90. /package/dist/{chunk-JBLMXZ3O.mjs.map → chunk-KH27ZS4Y.mjs.map} +0 -0
  91. /package/dist/{chunk-QGE7U4NV.mjs.map → chunk-MO2BUFJD.mjs.map} +0 -0
  92. /package/dist/{chunk-TWYUYC4F.mjs.map → chunk-MUDXTKXE.mjs.map} +0 -0
  93. /package/dist/{chunk-COEUPDRL.mjs.map → chunk-OGXCE54J.mjs.map} +0 -0
  94. /package/dist/{chunk-X2DNXTME.mjs.map → chunk-OPRDTF4S.mjs.map} +0 -0
  95. /package/dist/{chunk-IHAZJF3V.mjs.map → chunk-PYPPRFZ6.mjs.map} +0 -0
  96. /package/dist/{chunk-ADZDXHVC.mjs.map → chunk-Q573EMPD.mjs.map} +0 -0
@@ -1,20 +1,23 @@
1
1
  import {
2
2
  reloadSuggestions
3
- } from "../chunk-LVWV62JZ.mjs";
4
- import "../chunk-TWYUYC4F.mjs";
5
- import "../chunk-Q42NJFXR.mjs";
3
+ } from "../chunk-2PL3WCKM.mjs";
4
+ import "../chunk-IKWGQG5V.mjs";
5
+ import "../chunk-MUDXTKXE.mjs";
6
+ import "../chunk-3BASANUO.mjs";
7
+ import "../chunk-WSXTUD36.mjs";
8
+ import "../chunk-PIF5KJYI.mjs";
6
9
  import "../chunk-2IDV5OHF.mjs";
7
10
  import "../chunk-PMAFHQ7P.mjs";
8
11
  import "../chunk-5FHSUKQL.mjs";
9
12
  import "../chunk-RKTVJRK7.mjs";
10
- import "../chunk-ZLQVRPDS.mjs";
11
- import "../chunk-OKRZF3DD.mjs";
12
- import "../chunk-N4WEHORG.mjs";
13
- import "../chunk-O7ARI5CV.mjs";
14
13
  import "../chunk-FAUNHSQU.mjs";
15
14
  import "../chunk-ICIK2BSB.mjs";
16
- import "../chunk-TEMLWRRT.mjs";
15
+ import "../chunk-N4WEHORG.mjs";
16
+ import "../chunk-O7ARI5CV.mjs";
17
17
  import "../chunk-EFL5OBKN.mjs";
18
+ import "../chunk-OKRZF3DD.mjs";
19
+ import "../chunk-TEMLWRRT.mjs";
20
+ import "../chunk-ZLQVRPDS.mjs";
18
21
  import "../chunk-SKC7AJIV.mjs";
19
22
  export {
20
23
  reloadSuggestions
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.10.0-next.10",
12
+ "version": "1.10.0-next.12",
13
13
  "sideEffects": false,
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.mjs",
@@ -47,8 +47,8 @@
47
47
  "@scarf/scarf": "^1.3.0",
48
48
  "react-markdown": "^8.0.7",
49
49
  "untruncate-json": "^0.0.1",
50
- "@copilotkit/runtime-client-gql": "1.10.0-next.10",
51
- "@copilotkit/shared": "1.10.0-next.10"
50
+ "@copilotkit/runtime-client-gql": "1.10.0-next.12",
51
+ "@copilotkit/shared": "1.10.0-next.12"
52
52
  },
53
53
  "keywords": [
54
54
  "copilotkit",
@@ -52,7 +52,7 @@ import {
52
52
  LangGraphInterruptActionSetterArgs,
53
53
  } from "../../types/interrupt-action";
54
54
  import { StatusChecker } from "../../lib/status-checker";
55
- import { SuggestionItem } from "../../utils/suggestions";
55
+ import { ConsoleTrigger } from "../dev-console/console-trigger";
56
56
 
57
57
  export function CopilotKit({ children, ...props }: CopilotKitProps) {
58
58
  const enabled = shouldShowDevConsole(props.showDevConsole);
@@ -99,10 +99,6 @@ export function CopilotKitInternal(cpkProps: CopilotKitProps) {
99
99
  allElements: allDocuments,
100
100
  } = useFlatCategoryStore<DocumentPointer>();
101
101
 
102
- const statusChecker = useMemo(() => new StatusChecker(), []);
103
-
104
- const [usageBannerStatus, setUsageBannerStatus] = useState<any>(null);
105
-
106
102
  // Compute all the functions and properties that we need to pass
107
103
  const setAction = useCallback((id: string, action: FrontendAction<any>) => {
108
104
  setActions((prevPoints) => {
@@ -491,7 +487,10 @@ export function CopilotKitInternal(cpkProps: CopilotKitProps) {
491
487
  }}
492
488
  >
493
489
  <MessagesTapProvider>
494
- <CopilotMessages>{memoizedChildren}</CopilotMessages>
490
+ <CopilotMessages>
491
+ {memoizedChildren}
492
+ {showDevConsole && <ConsoleTrigger />}
493
+ </CopilotMessages>
495
494
  </MessagesTapProvider>
496
495
  {bannerError && showDevConsole && (
497
496
  <UsageBanner
@@ -0,0 +1,190 @@
1
+ "use client";
2
+
3
+ import React, { useState, useEffect, useRef } from "react";
4
+ import { useCopilotContext } from "../../context/copilot-context";
5
+ import { CopilotKitIcon } from "./icons";
6
+ import { DeveloperConsoleModal } from "./developer-console-modal";
7
+
8
+ interface ConsoleTriggerProps {
9
+ position?: "bottom-left" | "bottom-right";
10
+ }
11
+
12
+ export function ConsoleTrigger({ position = "bottom-right" }: ConsoleTriggerProps) {
13
+ const context = useCopilotContext();
14
+ const hasApiKey = Boolean(context.copilotApiConfig.publicApiKey);
15
+ const [isModalOpen, setIsModalOpen] = useState(false);
16
+ const [isHovered, setIsHovered] = useState(false);
17
+ const [isDragging, setIsDragging] = useState(false);
18
+ const [buttonPosition, setButtonPosition] = useState<{ x: number; y: number } | null>(null);
19
+ const [mounted, setMounted] = useState(false);
20
+
21
+ const dragRef = useRef<{
22
+ startX: number;
23
+ startY: number;
24
+ buttonX: number;
25
+ buttonY: number;
26
+ } | null>(null);
27
+ const buttonRef = useRef<HTMLButtonElement>(null);
28
+
29
+ // Initialize on client side only
30
+ useEffect(() => {
31
+ setMounted(true);
32
+ if (typeof window !== "undefined" && !buttonPosition) {
33
+ const buttonSize = 60;
34
+ const margin = 24;
35
+
36
+ const initialPosition = {
37
+ x: margin,
38
+ y: window.innerHeight - buttonSize - margin,
39
+ };
40
+
41
+ setButtonPosition(initialPosition);
42
+ }
43
+ }, [position]);
44
+
45
+ const handleMouseDown = (e: React.MouseEvent) => {
46
+ e.preventDefault();
47
+ if (!buttonPosition) return;
48
+
49
+ dragRef.current = {
50
+ startX: e.clientX,
51
+ startY: e.clientY,
52
+ buttonX: buttonPosition.x,
53
+ buttonY: buttonPosition.y,
54
+ };
55
+ setIsDragging(true);
56
+ };
57
+
58
+ useEffect(() => {
59
+ if (!isDragging) return;
60
+
61
+ const handleMouseMove = (e: MouseEvent) => {
62
+ e.preventDefault();
63
+ e.stopPropagation();
64
+
65
+ if (!dragRef.current) return;
66
+
67
+ const deltaX = e.clientX - dragRef.current.startX;
68
+ const deltaY = e.clientY - dragRef.current.startY;
69
+
70
+ // Calculate new position
71
+ let newX = dragRef.current.buttonX + deltaX;
72
+ let newY = dragRef.current.buttonY + deltaY;
73
+
74
+ // Keep button within viewport bounds
75
+ newX = Math.max(0, Math.min(newX, window.innerWidth - 60));
76
+ newY = Math.max(0, Math.min(newY, window.innerHeight - 60));
77
+
78
+ setButtonPosition({ x: newX, y: newY });
79
+ };
80
+
81
+ const handleMouseUp = (e: MouseEvent) => {
82
+ e.preventDefault();
83
+ e.stopPropagation();
84
+ setIsDragging(false);
85
+ dragRef.current = null;
86
+ };
87
+
88
+ // Use capture phase to intercept events before they reach other handlers
89
+ document.addEventListener("mousemove", handleMouseMove, { capture: true, passive: false });
90
+ document.addEventListener("mouseup", handleMouseUp, { capture: true, passive: false });
91
+
92
+ return () => {
93
+ document.removeEventListener("mousemove", handleMouseMove, { capture: true });
94
+ document.removeEventListener("mouseup", handleMouseUp, { capture: true });
95
+ };
96
+ }, [isDragging]);
97
+
98
+ // Don't render until mounted and position is initialized
99
+ if (!mounted || !buttonPosition) {
100
+ return null;
101
+ }
102
+
103
+ return (
104
+ <>
105
+ <button
106
+ ref={buttonRef}
107
+ onClick={() => {
108
+ if (!isDragging) {
109
+ setIsModalOpen(true);
110
+ }
111
+ }}
112
+ onMouseDown={handleMouseDown}
113
+ onMouseEnter={() => setIsHovered(true)}
114
+ onMouseLeave={() => setIsHovered(false)}
115
+ style={{
116
+ position: "fixed",
117
+ left: `${buttonPosition.x}px`,
118
+ top: `${buttonPosition.y}px`,
119
+ zIndex: 2147483647,
120
+ width: "60px",
121
+ height: "60px",
122
+ background: isDragging ? "#000000" : isHovered ? "#111111" : "#000000",
123
+ color: "white",
124
+ borderRadius: "50%",
125
+ boxShadow: isDragging
126
+ ? "0 8px 32px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.4)"
127
+ : isHovered
128
+ ? "0 12px 40px rgba(0, 0, 0, 0.7), 0 6px 20px rgba(0, 0, 0, 0.5)"
129
+ : "0 6px 20px rgba(0, 0, 0, 0.5), 0 3px 10px rgba(0, 0, 0, 0.3)",
130
+ transition: isDragging ? "none" : "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
131
+ display: "flex",
132
+ alignItems: "center",
133
+ justifyContent: "center",
134
+ border: "none",
135
+ cursor: isDragging ? "grabbing" : "grab",
136
+ opacity: 1,
137
+ userSelect: "none",
138
+ transform: isDragging ? "scale(1.05)" : isHovered ? "scale(1.1)" : "scale(1)",
139
+ backdropFilter: "blur(10px)",
140
+ pointerEvents: "auto",
141
+ isolation: "isolate",
142
+ }}
143
+ title={
144
+ hasApiKey
145
+ ? "Open Developer Console (Drag to move)"
146
+ : "Developer Console (API Key Required, Drag to move)"
147
+ }
148
+ >
149
+ <div
150
+ style={{
151
+ width: "28px",
152
+ height: "28px",
153
+ display: "flex",
154
+ alignItems: "center",
155
+ justifyContent: "center",
156
+ filter: "drop-shadow(0 2px 4px rgba(0,0,0,0.2))",
157
+ }}
158
+ >
159
+ <CopilotKitIcon />
160
+ </div>
161
+ {!hasApiKey && (
162
+ <div
163
+ style={{
164
+ position: "absolute",
165
+ top: "-2px",
166
+ right: "-2px",
167
+ width: "18px",
168
+ height: "18px",
169
+ background: "linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%)",
170
+ borderRadius: "50%",
171
+ display: "flex",
172
+ alignItems: "center",
173
+ justifyContent: "center",
174
+ boxShadow: "0 2px 8px rgba(255, 107, 107, 0.4)",
175
+ border: "2px solid white",
176
+ }}
177
+ >
178
+ <span style={{ fontSize: "10px", color: "white", fontWeight: "bold" }}>!</span>
179
+ </div>
180
+ )}
181
+ </button>
182
+
183
+ <DeveloperConsoleModal
184
+ isOpen={isModalOpen}
185
+ onClose={() => setIsModalOpen(false)}
186
+ hasApiKey={hasApiKey}
187
+ />
188
+ </>
189
+ );
190
+ }