@copilotkitnext/react 1.52.0-next.5 → 1.52.0-next.7
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/dist/components/WildcardToolCallRender.cjs +13 -13
- package/dist/components/WildcardToolCallRender.cjs.map +1 -1
- package/dist/components/WildcardToolCallRender.mjs +13 -13
- package/dist/components/WildcardToolCallRender.mjs.map +1 -1
- package/dist/components/chat/CopilotChat.cjs.map +1 -1
- package/dist/components/chat/CopilotChat.mjs.map +1 -1
- package/dist/components/chat/CopilotChatAssistantMessage.cjs +36 -28
- package/dist/components/chat/CopilotChatAssistantMessage.cjs.map +1 -1
- package/dist/components/chat/CopilotChatAssistantMessage.mjs +37 -29
- package/dist/components/chat/CopilotChatAssistantMessage.mjs.map +1 -1
- package/dist/components/chat/CopilotChatAudioRecorder.cjs +2 -2
- package/dist/components/chat/CopilotChatAudioRecorder.cjs.map +1 -1
- package/dist/components/chat/CopilotChatAudioRecorder.mjs +2 -2
- package/dist/components/chat/CopilotChatAudioRecorder.mjs.map +1 -1
- package/dist/components/chat/CopilotChatInput.cjs +59 -51
- package/dist/components/chat/CopilotChatInput.cjs.map +1 -1
- package/dist/components/chat/CopilotChatInput.d.cts.map +1 -1
- package/dist/components/chat/CopilotChatInput.d.mts.map +1 -1
- package/dist/components/chat/CopilotChatInput.mjs +59 -51
- package/dist/components/chat/CopilotChatInput.mjs.map +1 -1
- package/dist/components/chat/CopilotChatMessageView.cjs +28 -10
- package/dist/components/chat/CopilotChatMessageView.cjs.map +1 -1
- package/dist/components/chat/CopilotChatMessageView.d.cts +1 -0
- package/dist/components/chat/CopilotChatMessageView.d.cts.map +1 -1
- package/dist/components/chat/CopilotChatMessageView.d.mts +1 -0
- package/dist/components/chat/CopilotChatMessageView.d.mts.map +1 -1
- package/dist/components/chat/CopilotChatMessageView.mjs +29 -11
- package/dist/components/chat/CopilotChatMessageView.mjs.map +1 -1
- package/dist/components/chat/CopilotChatReasoningMessage.cjs +24 -20
- package/dist/components/chat/CopilotChatReasoningMessage.cjs.map +1 -1
- package/dist/components/chat/CopilotChatReasoningMessage.d.cts.map +1 -1
- package/dist/components/chat/CopilotChatReasoningMessage.d.mts.map +1 -1
- package/dist/components/chat/CopilotChatReasoningMessage.mjs +25 -21
- package/dist/components/chat/CopilotChatReasoningMessage.mjs.map +1 -1
- package/dist/components/chat/CopilotChatSuggestionPill.cjs +6 -5
- package/dist/components/chat/CopilotChatSuggestionPill.cjs.map +1 -1
- package/dist/components/chat/CopilotChatSuggestionPill.mjs +6 -5
- package/dist/components/chat/CopilotChatSuggestionPill.mjs.map +1 -1
- package/dist/components/chat/CopilotChatSuggestionView.cjs +24 -12
- package/dist/components/chat/CopilotChatSuggestionView.cjs.map +1 -1
- package/dist/components/chat/CopilotChatSuggestionView.d.cts.map +1 -1
- package/dist/components/chat/CopilotChatSuggestionView.d.mts.map +1 -1
- package/dist/components/chat/CopilotChatSuggestionView.mjs +25 -13
- package/dist/components/chat/CopilotChatSuggestionView.mjs.map +1 -1
- package/dist/components/chat/CopilotChatToggleButton.cjs +7 -6
- package/dist/components/chat/CopilotChatToggleButton.cjs.map +1 -1
- package/dist/components/chat/CopilotChatToggleButton.d.cts.map +1 -1
- package/dist/components/chat/CopilotChatToggleButton.d.mts.map +1 -1
- package/dist/components/chat/CopilotChatToggleButton.mjs +7 -6
- package/dist/components/chat/CopilotChatToggleButton.mjs.map +1 -1
- package/dist/components/chat/CopilotChatUserMessage.cjs +29 -24
- package/dist/components/chat/CopilotChatUserMessage.cjs.map +1 -1
- package/dist/components/chat/CopilotChatUserMessage.d.cts.map +1 -1
- package/dist/components/chat/CopilotChatUserMessage.d.mts.map +1 -1
- package/dist/components/chat/CopilotChatUserMessage.mjs +30 -25
- package/dist/components/chat/CopilotChatUserMessage.mjs.map +1 -1
- package/dist/components/chat/CopilotChatView.cjs +45 -35
- package/dist/components/chat/CopilotChatView.cjs.map +1 -1
- package/dist/components/chat/CopilotChatView.d.cts +1 -1
- package/dist/components/chat/CopilotChatView.d.cts.map +1 -1
- package/dist/components/chat/CopilotChatView.d.mts +1 -1
- package/dist/components/chat/CopilotChatView.d.mts.map +1 -1
- package/dist/components/chat/CopilotChatView.mjs +45 -35
- package/dist/components/chat/CopilotChatView.mjs.map +1 -1
- package/dist/components/chat/CopilotModalHeader.cjs +8 -8
- package/dist/components/chat/CopilotModalHeader.cjs.map +1 -1
- package/dist/components/chat/CopilotModalHeader.d.cts.map +1 -1
- package/dist/components/chat/CopilotModalHeader.d.mts.map +1 -1
- package/dist/components/chat/CopilotModalHeader.mjs +8 -8
- package/dist/components/chat/CopilotModalHeader.mjs.map +1 -1
- package/dist/components/chat/CopilotPopupView.cjs +20 -15
- package/dist/components/chat/CopilotPopupView.cjs.map +1 -1
- package/dist/components/chat/CopilotPopupView.d.cts.map +1 -1
- package/dist/components/chat/CopilotPopupView.d.mts.map +1 -1
- package/dist/components/chat/CopilotPopupView.mjs +20 -15
- package/dist/components/chat/CopilotPopupView.mjs.map +1 -1
- package/dist/components/chat/CopilotSidebarView.cjs +54 -43
- package/dist/components/chat/CopilotSidebarView.cjs.map +1 -1
- package/dist/components/chat/CopilotSidebarView.d.cts.map +1 -1
- package/dist/components/chat/CopilotSidebarView.d.mts.map +1 -1
- package/dist/components/chat/CopilotSidebarView.mjs +55 -44
- package/dist/components/chat/CopilotSidebarView.mjs.map +1 -1
- package/dist/components/ui/button.cjs +42 -42
- package/dist/components/ui/button.cjs.map +1 -1
- package/dist/components/ui/button.mjs +42 -42
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/dropdown-menu.cjs +7 -6
- package/dist/components/ui/dropdown-menu.cjs.map +1 -1
- package/dist/components/ui/dropdown-menu.mjs +7 -6
- package/dist/components/ui/dropdown-menu.mjs.map +1 -1
- package/dist/components/ui/tooltip.cjs +3 -2
- package/dist/components/ui/tooltip.cjs.map +1 -1
- package/dist/components/ui/tooltip.mjs +3 -2
- package/dist/components/ui/tooltip.mjs.map +1 -1
- package/dist/hooks/index.cjs +1 -0
- package/dist/hooks/index.d.cts +2 -1
- package/dist/hooks/index.d.mts +2 -1
- package/dist/hooks/index.mjs +1 -0
- package/dist/hooks/use-component.cjs +18 -5
- package/dist/hooks/use-component.cjs.map +1 -1
- package/dist/hooks/use-component.d.cts +21 -7
- package/dist/hooks/use-component.d.cts.map +1 -1
- package/dist/hooks/use-component.d.mts +21 -7
- package/dist/hooks/use-component.d.mts.map +1 -1
- package/dist/hooks/use-component.mjs +18 -5
- package/dist/hooks/use-component.mjs.map +1 -1
- package/dist/hooks/use-default-render-tool.cjs +2 -2
- package/dist/hooks/use-default-render-tool.cjs.map +1 -1
- package/dist/hooks/use-default-render-tool.d.cts +3 -3
- package/dist/hooks/use-default-render-tool.d.cts.map +1 -1
- package/dist/hooks/use-default-render-tool.d.mts +3 -3
- package/dist/hooks/use-default-render-tool.d.mts.map +1 -1
- package/dist/hooks/use-default-render-tool.mjs +2 -2
- package/dist/hooks/use-default-render-tool.mjs.map +1 -1
- package/dist/hooks/use-interrupt.cjs +171 -0
- package/dist/hooks/use-interrupt.cjs.map +1 -0
- package/dist/hooks/use-interrupt.d.cts +102 -0
- package/dist/hooks/use-interrupt.d.cts.map +1 -0
- package/dist/hooks/use-interrupt.d.mts +102 -0
- package/dist/hooks/use-interrupt.d.mts.map +1 -0
- package/dist/hooks/use-interrupt.mjs +170 -0
- package/dist/hooks/use-interrupt.mjs.map +1 -0
- package/dist/hooks/use-render-tool.cjs +15 -9
- package/dist/hooks/use-render-tool.cjs.map +1 -1
- package/dist/hooks/use-render-tool.d.cts +9 -9
- package/dist/hooks/use-render-tool.d.cts.map +1 -1
- package/dist/hooks/use-render-tool.d.mts +9 -9
- package/dist/hooks/use-render-tool.d.mts.map +1 -1
- package/dist/hooks/use-render-tool.mjs +15 -9
- package/dist/hooks/use-render-tool.mjs.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +3 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.mjs +2 -1
- package/dist/index.umd.js +625 -342
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/react-core.cjs +13 -0
- package/dist/lib/react-core.cjs.map +1 -1
- package/dist/lib/react-core.d.cts +8 -0
- package/dist/lib/react-core.d.cts.map +1 -1
- package/dist/lib/react-core.d.mts +8 -0
- package/dist/lib/react-core.d.mts.map +1 -1
- package/dist/lib/react-core.mjs +13 -0
- package/dist/lib/react-core.mjs.map +1 -1
- package/dist/lib/utils.cjs +2 -1
- package/dist/lib/utils.cjs.map +1 -1
- package/dist/lib/utils.mjs +3 -2
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/index.d.cts +2 -1
- package/dist/types/index.d.mts +2 -1
- package/dist/types/interrupt.d.cts +17 -0
- package/dist/types/interrupt.d.cts.map +1 -0
- package/dist/types/interrupt.d.mts +17 -0
- package/dist/types/interrupt.d.mts.map +1 -0
- package/eslint-rules/README.md +52 -0
- package/eslint-rules/require-cpk-prefix.mjs +375 -0
- package/eslint.config.mjs +17 -0
- package/package.json +8 -7
package/dist/index.umd.js
CHANGED
|
@@ -107,65 +107,66 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
107
107
|
|
|
108
108
|
//#endregion
|
|
109
109
|
//#region src/lib/utils.ts
|
|
110
|
+
const twMerge$8 = (0, tailwind_merge.extendTailwindMerge)({ prefix: "cpk" });
|
|
110
111
|
function cn(...inputs) {
|
|
111
|
-
return
|
|
112
|
+
return twMerge$8((0, clsx.clsx)(inputs));
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
//#endregion
|
|
115
116
|
//#region src/components/ui/button.tsx
|
|
116
|
-
const buttonVariants = (0, class_variance_authority.cva)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
117
|
+
const buttonVariants = (0, class_variance_authority.cva)("cpk:inline-flex cpk:items-center cpk:justify-center cpk:gap-2 cpk:whitespace-nowrap cpk:rounded-md cpk:text-sm cpk:font-medium cpk:transition-all cpk:disabled:pointer-events-none cpk:disabled:opacity-50 cpk:[&_svg]:pointer-events-none cpk:[&_svg:not([class*='size-'])]:size-4 cpk:shrink-0 cpk:[&_svg]:shrink-0 cpk:outline-none cpk:focus-visible:border-ring cpk:focus-visible:ring-ring/50 cpk:focus-visible:ring-[3px] cpk:aria-invalid:ring-destructive/20 cpk:dark:aria-invalid:ring-destructive/40 cpk:aria-invalid:border-destructive", {
|
|
117
118
|
variants: {
|
|
118
119
|
variant: {
|
|
119
|
-
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
120
|
-
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
121
|
-
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
122
|
-
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
123
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50 cursor-pointer",
|
|
124
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
120
|
+
default: "cpk:bg-primary cpk:text-primary-foreground cpk:shadow-xs cpk:hover:bg-primary/90",
|
|
121
|
+
destructive: "cpk:bg-destructive cpk:text-white cpk:shadow-xs cpk:hover:bg-destructive/90 cpk:focus-visible:ring-destructive/20 cpk:dark:focus-visible:ring-destructive/40 cpk:dark:bg-destructive/60",
|
|
122
|
+
outline: "cpk:border cpk:bg-background cpk:shadow-xs cpk:hover:bg-accent cpk:hover:text-accent-foreground cpk:dark:bg-input/30 cpk:dark:border-input cpk:dark:hover:bg-input/50",
|
|
123
|
+
secondary: "cpk:bg-secondary cpk:text-secondary-foreground cpk:shadow-xs cpk:hover:bg-secondary/80",
|
|
124
|
+
ghost: "cpk:hover:bg-accent cpk:hover:text-accent-foreground cpk:dark:hover:bg-accent/50 cpk:cursor-pointer",
|
|
125
|
+
link: "cpk:text-primary cpk:underline-offset-4 cpk:hover:underline",
|
|
125
126
|
assistantMessageToolbarButton: [
|
|
126
|
-
"cursor-pointer",
|
|
127
|
-
"p-0 text-[rgb(93,93,93)] hover:bg-[#E8E8E8]",
|
|
128
|
-
"dark:text-[rgb(243,243,243)] dark:hover:bg-[#303030]",
|
|
129
|
-
"h-8 w-8",
|
|
130
|
-
"transition-colors",
|
|
131
|
-
"hover:text-[rgb(93,93,93)]",
|
|
132
|
-
"dark:hover:text-[rgb(243,243,243)]"
|
|
127
|
+
"cpk:cursor-pointer",
|
|
128
|
+
"cpk:p-0 cpk:text-[rgb(93,93,93)] cpk:hover:bg-[#E8E8E8]",
|
|
129
|
+
"cpk:dark:text-[rgb(243,243,243)] cpk:dark:hover:bg-[#303030]",
|
|
130
|
+
"cpk:h-8 cpk:w-8",
|
|
131
|
+
"cpk:transition-colors",
|
|
132
|
+
"cpk:hover:text-[rgb(93,93,93)]",
|
|
133
|
+
"cpk:dark:hover:text-[rgb(243,243,243)]"
|
|
133
134
|
],
|
|
134
135
|
chatInputToolbarPrimary: [
|
|
135
|
-
"cursor-pointer",
|
|
136
|
-
"bg-black text-white",
|
|
137
|
-
"dark:bg-white dark:text-black dark:focus-visible:outline-white",
|
|
138
|
-
"rounded-full",
|
|
139
|
-
"transition-colors",
|
|
140
|
-
"focus:outline-none",
|
|
141
|
-
"hover:opacity-70 disabled:hover:opacity-100",
|
|
142
|
-
"disabled:cursor-not-allowed disabled:bg-[#00000014] disabled:text-[rgb(13,13,13)]",
|
|
143
|
-
"dark:disabled:bg-[#454545] dark:disabled:text-white "
|
|
136
|
+
"cpk:cursor-pointer",
|
|
137
|
+
"cpk:bg-black cpk:text-white",
|
|
138
|
+
"cpk:dark:bg-white cpk:dark:text-black cpk:dark:focus-visible:outline-white",
|
|
139
|
+
"cpk:rounded-full",
|
|
140
|
+
"cpk:transition-colors",
|
|
141
|
+
"cpk:focus:outline-none",
|
|
142
|
+
"cpk:hover:opacity-70 cpk:disabled:hover:opacity-100",
|
|
143
|
+
"cpk:disabled:cursor-not-allowed cpk:disabled:bg-[#00000014] cpk:disabled:text-[rgb(13,13,13)]",
|
|
144
|
+
"cpk:dark:disabled:bg-[#454545] cpk:dark:disabled:text-white "
|
|
144
145
|
],
|
|
145
146
|
chatInputToolbarSecondary: [
|
|
146
|
-
"cursor-pointer",
|
|
147
|
-
"bg-transparent text-[#444444]",
|
|
148
|
-
"dark:text-white dark:border-[#404040]",
|
|
149
|
-
"rounded-full",
|
|
150
|
-
"transition-colors",
|
|
151
|
-
"focus:outline-none",
|
|
152
|
-
"hover:bg-[#f8f8f8] hover:text-[#333333]",
|
|
153
|
-
"dark:hover:bg-[#404040] dark:hover:text-[#FFFFFF]",
|
|
154
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
155
|
-
"disabled:hover:bg-transparent disabled:hover:text-[#444444]",
|
|
156
|
-
"dark:disabled:hover:bg-transparent dark:disabled:hover:text-[#CCCCCC]"
|
|
147
|
+
"cpk:cursor-pointer",
|
|
148
|
+
"cpk:bg-transparent cpk:text-[#444444]",
|
|
149
|
+
"cpk:dark:text-white cpk:dark:border-[#404040]",
|
|
150
|
+
"cpk:rounded-full",
|
|
151
|
+
"cpk:transition-colors",
|
|
152
|
+
"cpk:focus:outline-none",
|
|
153
|
+
"cpk:hover:bg-[#f8f8f8] cpk:hover:text-[#333333]",
|
|
154
|
+
"cpk:dark:hover:bg-[#404040] cpk:dark:hover:text-[#FFFFFF]",
|
|
155
|
+
"cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50",
|
|
156
|
+
"cpk:disabled:hover:bg-transparent cpk:disabled:hover:text-[#444444]",
|
|
157
|
+
"cpk:dark:disabled:hover:bg-transparent cpk:dark:disabled:hover:text-[#CCCCCC]"
|
|
157
158
|
]
|
|
158
159
|
},
|
|
159
160
|
size: {
|
|
160
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
161
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
162
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
163
|
-
icon: "size-9",
|
|
164
|
-
chatInputToolbarIcon: ["h-9 w-9 rounded-full"],
|
|
161
|
+
default: "cpk:h-9 cpk:px-4 cpk:py-2 cpk:has-[>svg]:px-3",
|
|
162
|
+
sm: "cpk:h-8 cpk:rounded-md cpk:gap-1.5 cpk:px-3 cpk:has-[>svg]:px-2.5",
|
|
163
|
+
lg: "cpk:h-10 cpk:rounded-md cpk:px-6 cpk:has-[>svg]:px-4",
|
|
164
|
+
icon: "cpk:size-9",
|
|
165
|
+
chatInputToolbarIcon: ["cpk:h-9 cpk:w-9 cpk:rounded-full"],
|
|
165
166
|
chatInputToolbarIconLabel: [
|
|
166
|
-
"h-9 px-3 rounded-full",
|
|
167
|
-
"gap-2",
|
|
168
|
-
"font-normal"
|
|
167
|
+
"cpk:h-9 cpk:px-3 cpk:rounded-full",
|
|
168
|
+
"cpk:gap-2",
|
|
169
|
+
"cpk:font-normal"
|
|
169
170
|
]
|
|
170
171
|
}
|
|
171
172
|
},
|
|
@@ -209,11 +210,12 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
209
210
|
}
|
|
210
211
|
function TooltipContent({ className, sideOffset = 0, children, ...props }) {
|
|
211
212
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_tooltip.Content, {
|
|
213
|
+
"data-copilotkit": true,
|
|
212
214
|
"data-slot": "tooltip-content",
|
|
213
215
|
sideOffset,
|
|
214
|
-
className: cn("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance", className),
|
|
216
|
+
className: cn("cpk:bg-primary cpk:text-primary-foreground cpk:animate-in cpk:fade-in-0 cpk:zoom-in-95 cpk:data-[state=closed]:animate-out cpk:data-[state=closed]:fade-out-0 cpk:data-[state=closed]:zoom-out-95 cpk:data-[side=bottom]:slide-in-from-top-2 cpk:data-[side=left]:slide-in-from-right-2 cpk:data-[side=right]:slide-in-from-left-2 cpk:data-[side=top]:slide-in-from-bottom-2 cpk:z-50 cpk:w-fit cpk:origin-(--radix-tooltip-content-transform-origin) cpk:rounded-md cpk:px-3 cpk:py-1.5 cpk:text-xs cpk:text-balance", className),
|
|
215
217
|
...props,
|
|
216
|
-
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })]
|
|
218
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Arrow, { className: "cpk:bg-primary cpk:fill-primary cpk:z-50 cpk:size-2.5 cpk:translate-y-[calc(-50%_-_2px)] cpk:rotate-45 cpk:rounded-[2px]" })]
|
|
217
219
|
}) });
|
|
218
220
|
}
|
|
219
221
|
|
|
@@ -233,9 +235,10 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
233
235
|
}
|
|
234
236
|
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
235
237
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Content, {
|
|
238
|
+
"data-copilotkit": true,
|
|
236
239
|
"data-slot": "dropdown-menu-content",
|
|
237
240
|
sideOffset,
|
|
238
|
-
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md", className),
|
|
241
|
+
className: cn("cpk:bg-popover cpk:text-popover-foreground cpk:data-[state=open]:animate-in cpk:data-[state=closed]:animate-out cpk:data-[state=closed]:fade-out-0 cpk:data-[state=open]:fade-in-0 cpk:data-[state=closed]:zoom-out-95 cpk:data-[state=open]:zoom-in-95 cpk:data-[side=bottom]:slide-in-from-top-2 cpk:data-[side=left]:slide-in-from-right-2 cpk:data-[side=right]:slide-in-from-left-2 cpk:data-[side=top]:slide-in-from-bottom-2 cpk:z-50 cpk:max-h-(--radix-dropdown-menu-content-available-height) cpk:min-w-[8rem] cpk:origin-(--radix-dropdown-menu-content-transform-origin) cpk:overflow-x-hidden cpk:overflow-y-auto cpk:rounded-md cpk:border cpk:p-1 cpk:shadow-md", className),
|
|
239
242
|
...props
|
|
240
243
|
}) });
|
|
241
244
|
}
|
|
@@ -244,14 +247,14 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
244
247
|
"data-slot": "dropdown-menu-item",
|
|
245
248
|
"data-inset": inset,
|
|
246
249
|
"data-variant": variant,
|
|
247
|
-
className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
250
|
+
className: cn("cpk:focus:bg-accent cpk:focus:text-accent-foreground cpk:data-[variant=destructive]:text-destructive cpk:data-[variant=destructive]:focus:bg-destructive/10 cpk:dark:data-[variant=destructive]:focus:bg-destructive/20 cpk:data-[variant=destructive]:focus:text-destructive cpk:data-[variant=destructive]:*:[svg]:!text-destructive cpk:[&_svg:not([class*='text-'])]:text-muted-foreground cpk:relative cpk:flex cpk:cursor-default cpk:items-center cpk:gap-2 cpk:rounded-sm cpk:px-2 cpk:py-1.5 cpk:text-sm cpk:outline-hidden cpk:select-none cpk:data-[disabled]:pointer-events-none cpk:data-[disabled]:opacity-50 cpk:data-[inset]:pl-8 cpk:[&_svg]:pointer-events-none cpk:[&_svg]:shrink-0 cpk:[&_svg:not([class*='size-'])]:size-4", className),
|
|
248
251
|
...props
|
|
249
252
|
});
|
|
250
253
|
}
|
|
251
254
|
function DropdownMenuSeparator({ className, ...props }) {
|
|
252
255
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Separator, {
|
|
253
256
|
"data-slot": "dropdown-menu-separator",
|
|
254
|
-
className: cn("bg-border
|
|
257
|
+
className: cn("cpk:bg-border cpk:-mx-1 cpk:my-1 cpk:h-px", className),
|
|
255
258
|
...props
|
|
256
259
|
});
|
|
257
260
|
}
|
|
@@ -265,15 +268,15 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
265
268
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dropdown_menu.SubTrigger, {
|
|
266
269
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
267
270
|
"data-inset": inset,
|
|
268
|
-
className: cn("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8", className),
|
|
271
|
+
className: cn("cpk:focus:bg-accent cpk:focus:text-accent-foreground cpk:data-[state=open]:bg-accent cpk:data-[state=open]:text-accent-foreground cpk:flex cpk:cursor-default cpk:items-center cpk:rounded-sm cpk:px-2 cpk:py-1.5 cpk:text-sm cpk:outline-hidden cpk:select-none cpk:data-[inset]:pl-8", className),
|
|
269
272
|
...props,
|
|
270
|
-
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRightIcon, { className: "ml-auto size-4" })]
|
|
273
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRightIcon, { className: "cpk:ml-auto cpk:size-4" })]
|
|
271
274
|
});
|
|
272
275
|
}
|
|
273
276
|
function DropdownMenuSubContent({ className, ...props }) {
|
|
274
277
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.SubContent, {
|
|
275
278
|
"data-slot": "dropdown-menu-sub-content",
|
|
276
|
-
className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg", className),
|
|
279
|
+
className: cn("cpk:bg-popover cpk:text-popover-foreground cpk:data-[state=open]:animate-in cpk:data-[state=closed]:animate-out cpk:data-[state=closed]:fade-out-0 cpk:data-[state=open]:fade-in-0 cpk:data-[state=closed]:zoom-out-95 cpk:data-[state=open]:zoom-in-95 cpk:data-[side=bottom]:slide-in-from-top-2 cpk:data-[side=left]:slide-in-from-right-2 cpk:data-[side=right]:slide-in-from-left-2 cpk:data-[side=top]:slide-in-from-bottom-2 cpk:z-50 cpk:min-w-[8rem] cpk:origin-(--radix-dropdown-menu-content-transform-origin) cpk:overflow-hidden cpk:rounded-md cpk:border cpk:p-1 cpk:shadow-lg", className),
|
|
277
280
|
...props
|
|
278
281
|
});
|
|
279
282
|
}
|
|
@@ -470,11 +473,11 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
470
473
|
cleanup
|
|
471
474
|
]);
|
|
472
475
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
473
|
-
className: (0, tailwind_merge.twMerge)("w-full py-3 px-5", className),
|
|
476
|
+
className: (0, tailwind_merge.twMerge)("cpk:w-full cpk:py-3 cpk:px-5", className),
|
|
474
477
|
...divProps,
|
|
475
478
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("canvas", {
|
|
476
479
|
ref: canvasRef,
|
|
477
|
-
className: "block w-full h-[26px]"
|
|
480
|
+
className: "cpk:block cpk:w-full cpk:h-[26px]"
|
|
478
481
|
})
|
|
479
482
|
});
|
|
480
483
|
});
|
|
@@ -762,7 +765,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
762
765
|
onChange: handleChange,
|
|
763
766
|
onKeyDown: handleKeyDown,
|
|
764
767
|
autoFocus,
|
|
765
|
-
className: (0, tailwind_merge.twMerge)("w-full py-3", isExpanded ? "px-5" : "pr-5")
|
|
768
|
+
className: (0, tailwind_merge.twMerge)("cpk:w-full cpk:py-3", isExpanded ? "cpk:px-5" : "cpk:pr-5")
|
|
766
769
|
});
|
|
767
770
|
const isProcessing = mode !== "transcribe" && isRunning;
|
|
768
771
|
const canSend = resolvedValue.trim().length > 0 && !!onSubmitMessage;
|
|
@@ -778,7 +781,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
778
781
|
const BoundSendButton = renderSlot(sendButton, CopilotChatInput.SendButton, {
|
|
779
782
|
onClick: handleSendButtonClick,
|
|
780
783
|
disabled: isProcessing ? !canStop : !canSend,
|
|
781
|
-
children: isProcessing && canStop ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Square, { className: "size-[18px] fill-current" }) : void 0
|
|
784
|
+
children: isProcessing && canStop ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Square, { className: "cpk:size-[18px] cpk:fill-current" }) : void 0
|
|
782
785
|
});
|
|
783
786
|
const BoundStartTranscribeButton = renderSlot(startTranscribeButton, CopilotChatInput.StartTranscribeButton, { onClick: onStartTranscribe });
|
|
784
787
|
const BoundCancelTranscribeButton = renderSlot(cancelTranscribeButton, CopilotChatInput.CancelTranscribeButton, { onClick: onCancelTranscribe });
|
|
@@ -800,29 +803,36 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
800
803
|
});
|
|
801
804
|
const BoundDisclaimer = renderSlot(disclaimer, CopilotChatInput.Disclaimer, {});
|
|
802
805
|
const shouldShowDisclaimer = showDisclaimer !== null && showDisclaimer !== void 0 ? showDisclaimer : positioning === "absolute";
|
|
803
|
-
if (children)
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
806
|
+
if (children) {
|
|
807
|
+
const childProps = {
|
|
808
|
+
textArea: BoundTextArea,
|
|
809
|
+
audioRecorder: BoundAudioRecorder,
|
|
810
|
+
sendButton: BoundSendButton,
|
|
811
|
+
startTranscribeButton: BoundStartTranscribeButton,
|
|
812
|
+
cancelTranscribeButton: BoundCancelTranscribeButton,
|
|
813
|
+
finishTranscribeButton: BoundFinishTranscribeButton,
|
|
814
|
+
addMenuButton: BoundAddMenuButton,
|
|
815
|
+
disclaimer: BoundDisclaimer,
|
|
816
|
+
onSubmitMessage,
|
|
817
|
+
onStop,
|
|
818
|
+
isRunning,
|
|
819
|
+
onStartTranscribe,
|
|
820
|
+
onCancelTranscribe,
|
|
821
|
+
onFinishTranscribe,
|
|
822
|
+
onAddFile,
|
|
823
|
+
mode,
|
|
824
|
+
toolsMenu,
|
|
825
|
+
autoFocus,
|
|
826
|
+
positioning,
|
|
827
|
+
keyboardHeight,
|
|
828
|
+
showDisclaimer: shouldShowDisclaimer
|
|
829
|
+
};
|
|
830
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
831
|
+
"data-copilotkit": true,
|
|
832
|
+
style: { display: "contents" },
|
|
833
|
+
children: children(childProps)
|
|
834
|
+
});
|
|
835
|
+
}
|
|
826
836
|
const handleContainerClick = (e) => {
|
|
827
837
|
const target = e.target;
|
|
828
838
|
if (target.tagName !== "BUTTON" && !target.closest("button") && inputRef.current && mode === "input") inputRef.current.focus();
|
|
@@ -984,10 +994,10 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
984
994
|
role: "listbox",
|
|
985
995
|
"aria-label": "Slash commands",
|
|
986
996
|
ref: slashMenuRef,
|
|
987
|
-
className: "absolute bottom-full left-0 right-0 z-30 mb-2 max-h-64 overflow-y-auto rounded-lg border border-border bg-white shadow-lg dark:border-[#3a3a3a] dark:bg-[#1f1f1f]",
|
|
997
|
+
className: "cpk:absolute cpk:bottom-full cpk:left-0 cpk:right-0 cpk:z-30 cpk:mb-2 cpk:max-h-64 cpk:overflow-y-auto cpk:rounded-lg cpk:border cpk:border-border cpk:bg-white cpk:shadow-lg cpk:dark:border-[#3a3a3a] cpk:dark:bg-[#1f1f1f]",
|
|
988
998
|
style: { maxHeight: `${SLASH_MENU_MAX_VISIBLE_ITEMS * SLASH_MENU_ITEM_HEIGHT_PX}px` },
|
|
989
999
|
children: filteredCommands.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
990
|
-
className: "px-3 py-2 text-sm text-muted-foreground",
|
|
1000
|
+
className: "cpk:px-3 cpk:py-2 cpk:text-sm cpk:text-muted-foreground",
|
|
991
1001
|
children: "No commands found"
|
|
992
1002
|
}) : filteredCommands.map((item, index) => {
|
|
993
1003
|
const isActive = index === slashHighlightIndex;
|
|
@@ -997,7 +1007,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
997
1007
|
"aria-selected": isActive,
|
|
998
1008
|
"data-active": isActive ? "true" : void 0,
|
|
999
1009
|
"data-slash-index": index,
|
|
1000
|
-
className: (0, tailwind_merge.twMerge)("w-full px-3 py-2 text-left text-sm transition-colors", "hover:bg-muted dark:hover:bg-[#2f2f2f]", isActive ? "bg-muted dark:bg-[#2f2f2f]" : "bg-transparent"),
|
|
1010
|
+
className: (0, tailwind_merge.twMerge)("cpk:w-full cpk:px-3 cpk:py-2 cpk:text-left cpk:text-sm cpk:transition-colors", "cpk:hover:bg-muted cpk:dark:hover:bg-[#2f2f2f]", isActive ? "cpk:bg-muted cpk:dark:bg-[#2f2f2f]" : "cpk:bg-transparent"),
|
|
1001
1011
|
onMouseEnter: () => setSlashHighlightIndex(index),
|
|
1002
1012
|
onMouseDown: (event) => {
|
|
1003
1013
|
event.preventDefault();
|
|
@@ -1008,58 +1018,59 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
1008
1018
|
})
|
|
1009
1019
|
}) : null;
|
|
1010
1020
|
const inputPill = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1011
|
-
className: (0, tailwind_merge.twMerge)("flex w-full flex-col items-center justify-center", "cursor-text", "overflow-visible bg-clip-padding contain-inline-size", "bg-white dark:bg-[#303030]", "shadow-[0_4px_4px_0_#0000000a,0_0_1px_0_#0000009e] rounded-[28px]"),
|
|
1021
|
+
className: (0, tailwind_merge.twMerge)("cpk:flex cpk:w-full cpk:flex-col cpk:items-center cpk:justify-center", "cpk:cursor-text", "cpk:overflow-visible cpk:bg-clip-padding cpk:contain-inline-size", "cpk:bg-white cpk:dark:bg-[#303030]", "cpk:shadow-[0_4px_4px_0_#0000000a,0_0_1px_0_#0000009e] cpk:rounded-[28px]"),
|
|
1012
1022
|
onClick: handleContainerClick,
|
|
1013
1023
|
"data-layout": isExpanded ? "expanded" : "compact",
|
|
1014
1024
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1015
1025
|
ref: gridRef,
|
|
1016
|
-
className: (0, tailwind_merge.twMerge)("grid w-full gap-x-3 gap-y-3 px-3 py-2", isExpanded ? "grid-cols-[auto_minmax(0,1fr)_auto] grid-rows-[auto_auto]" : "grid-cols-[auto_minmax(0,1fr)_auto] items-center"),
|
|
1026
|
+
className: (0, tailwind_merge.twMerge)("cpk:grid cpk:w-full cpk:gap-x-3 cpk:gap-y-3 cpk:px-3 cpk:py-2", isExpanded ? "cpk:grid-cols-[auto_minmax(0,1fr)_auto] cpk:grid-rows-[auto_auto]" : "cpk:grid-cols-[auto_minmax(0,1fr)_auto] cpk:items-center"),
|
|
1017
1027
|
"data-layout": isExpanded ? "expanded" : "compact",
|
|
1018
1028
|
children: [
|
|
1019
1029
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1020
1030
|
ref: addButtonContainerRef,
|
|
1021
|
-
className: (0, tailwind_merge.twMerge)("flex items-center", isExpanded ? "row-start-2" : "row-start-1", "col-start-1"),
|
|
1031
|
+
className: (0, tailwind_merge.twMerge)("cpk:flex cpk:items-center", isExpanded ? "cpk:row-start-2" : "cpk:row-start-1", "cpk:col-start-1"),
|
|
1022
1032
|
children: BoundAddMenuButton
|
|
1023
1033
|
}),
|
|
1024
1034
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1025
|
-
className: (0, tailwind_merge.twMerge)("relative flex min-w-0 flex-col min-h-[50px] justify-center", isExpanded ? "col-span-3 row-start-1" : "col-start-2 row-start-1"),
|
|
1035
|
+
className: (0, tailwind_merge.twMerge)("cpk:relative cpk:flex cpk:min-w-0 cpk:flex-col cpk:min-h-[50px] cpk:justify-center", isExpanded ? "cpk:col-span-3 cpk:row-start-1" : "cpk:col-start-2 cpk:row-start-1"),
|
|
1026
1036
|
children: mode === "transcribe" ? BoundAudioRecorder : mode === "processing" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1027
|
-
className: "flex w-full items-center justify-center py-3 px-5",
|
|
1028
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, { className: "size-[26px] animate-spin text-muted-foreground" })
|
|
1037
|
+
className: "cpk:flex cpk:w-full cpk:items-center cpk:justify-center cpk:py-3 cpk:px-5",
|
|
1038
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, { className: "cpk:size-[26px] cpk:animate-spin cpk:text-muted-foreground" })
|
|
1029
1039
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [BoundTextArea, slashMenu] })
|
|
1030
1040
|
}),
|
|
1031
1041
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1032
1042
|
ref: actionsContainerRef,
|
|
1033
|
-
className: (0, tailwind_merge.twMerge)("flex items-center justify-end gap-2", isExpanded ? "col-start-3 row-start-2" : "col-start-3 row-start-1"),
|
|
1043
|
+
className: (0, tailwind_merge.twMerge)("cpk:flex cpk:items-center cpk:justify-end cpk:gap-2", isExpanded ? "cpk:col-start-3 cpk:row-start-2" : "cpk:col-start-3 cpk:row-start-1"),
|
|
1034
1044
|
children: mode === "transcribe" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [onCancelTranscribe && BoundCancelTranscribeButton, onFinishTranscribe && BoundFinishTranscribeButton] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [onStartTranscribe && BoundStartTranscribeButton, BoundSendButton] })
|
|
1035
1045
|
})
|
|
1036
1046
|
]
|
|
1037
1047
|
})
|
|
1038
1048
|
});
|
|
1039
1049
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1050
|
+
"data-copilotkit": true,
|
|
1040
1051
|
ref: containerRef,
|
|
1041
|
-
className: cn(positioning === "absolute" && "absolute bottom-0 left-0 right-0 z-20 pointer-events-none", className),
|
|
1052
|
+
className: cn(positioning === "absolute" && "cpk:absolute cpk:bottom-0 cpk:left-0 cpk:right-0 cpk:z-20 cpk:pointer-events-none", className),
|
|
1042
1053
|
style: {
|
|
1043
1054
|
transform: keyboardHeight > 0 ? `translateY(-${keyboardHeight}px)` : void 0,
|
|
1044
1055
|
transition: "transform 0.2s ease-out"
|
|
1045
1056
|
},
|
|
1046
1057
|
...props,
|
|
1047
1058
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1048
|
-
className: "max-w-3xl mx-auto py-0 px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-4 pointer-events-auto",
|
|
1059
|
+
className: "cpk:max-w-3xl cpk:mx-auto cpk:py-0 cpk:px-4 cpk:sm:px-0 cpk:[div[data-sidebar-chat]_&]:px-8 cpk:[div[data-popup-chat]_&]:px-4 cpk:pointer-events-auto",
|
|
1049
1060
|
children: inputPill
|
|
1050
1061
|
}), shouldShowDisclaimer && BoundDisclaimer]
|
|
1051
1062
|
});
|
|
1052
1063
|
}
|
|
1053
1064
|
(function(_CopilotChatInput) {
|
|
1054
1065
|
_CopilotChatInput.SendButton = ({ className, children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1055
|
-
className: "mr-[10px]",
|
|
1066
|
+
className: "cpk:mr-[10px]",
|
|
1056
1067
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
1057
1068
|
type: "button",
|
|
1058
1069
|
variant: "chatInputToolbarPrimary",
|
|
1059
1070
|
size: "chatInputToolbarIcon",
|
|
1060
1071
|
className,
|
|
1061
1072
|
...props,
|
|
1062
|
-
children: children !== null && children !== void 0 ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ArrowUp, { className: "size-[18px]" })
|
|
1073
|
+
children: children !== null && children !== void 0 ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ArrowUp, { className: "cpk:size-[18px]" })
|
|
1063
1074
|
})
|
|
1064
1075
|
});
|
|
1065
1076
|
const ToolbarButton = _CopilotChatInput.ToolbarButton = ({ icon, labelKey, defaultClassName, className, ...props }) => {
|
|
@@ -1082,21 +1093,21 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
1082
1093
|
})] });
|
|
1083
1094
|
};
|
|
1084
1095
|
_CopilotChatInput.StartTranscribeButton = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
1085
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Mic, { className: "size-[18px]" }),
|
|
1096
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Mic, { className: "cpk:size-[18px]" }),
|
|
1086
1097
|
labelKey: "chatInputToolbarStartTranscribeButtonLabel",
|
|
1087
|
-
defaultClassName: "mr-2",
|
|
1098
|
+
defaultClassName: "cpk:mr-2",
|
|
1088
1099
|
...props
|
|
1089
1100
|
});
|
|
1090
1101
|
_CopilotChatInput.CancelTranscribeButton = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
1091
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "size-[18px]" }),
|
|
1102
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "cpk:size-[18px]" }),
|
|
1092
1103
|
labelKey: "chatInputToolbarCancelTranscribeButtonLabel",
|
|
1093
|
-
defaultClassName: "mr-2",
|
|
1104
|
+
defaultClassName: "cpk:mr-2",
|
|
1094
1105
|
...props
|
|
1095
1106
|
});
|
|
1096
1107
|
_CopilotChatInput.FinishTranscribeButton = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
1097
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "size-[18px]" }),
|
|
1108
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "cpk:size-[18px]" }),
|
|
1098
1109
|
labelKey: "chatInputToolbarFinishTranscribeButtonLabel",
|
|
1099
|
-
defaultClassName: "mr-[10px]",
|
|
1110
|
+
defaultClassName: "cpk:mr-[10px]",
|
|
1100
1111
|
...props
|
|
1101
1112
|
});
|
|
1102
1113
|
_CopilotChatInput.AddMenuButton = ({ className, toolsMenu, onAddFile, disabled, ...props }) => {
|
|
@@ -1141,18 +1152,18 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
1141
1152
|
type: "button",
|
|
1142
1153
|
variant: "chatInputToolbarSecondary",
|
|
1143
1154
|
size: "chatInputToolbarIcon",
|
|
1144
|
-
className: (0, tailwind_merge.twMerge)("ml-1", className),
|
|
1155
|
+
className: (0, tailwind_merge.twMerge)("cpk:ml-1", className),
|
|
1145
1156
|
disabled: isDisabled,
|
|
1146
1157
|
...props,
|
|
1147
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Plus, { className: "size-[20px]" })
|
|
1158
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Plus, { className: "cpk:size-[20px]" })
|
|
1148
1159
|
})
|
|
1149
1160
|
})
|
|
1150
1161
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContent, {
|
|
1151
1162
|
side: "bottom",
|
|
1152
1163
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1153
|
-
className: "flex items-center gap-1 text-xs font-medium",
|
|
1164
|
+
className: "cpk:flex cpk:items-center cpk:gap-1 cpk:text-xs cpk:font-medium",
|
|
1154
1165
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Add files and more" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
1155
|
-
className: "rounded bg-[#4a4a4a] px-1 py-[1px] font-mono text-[11px] text-white dark:bg-[#e0e0e0] dark:text-black",
|
|
1166
|
+
className: "cpk:rounded cpk:bg-[#4a4a4a] cpk:px-1 cpk:py-[1px] cpk:font-mono cpk:text-[11px] cpk:text-white cpk:dark:bg-[#e0e0e0] cpk:dark:text-black",
|
|
1156
1167
|
children: "/"
|
|
1157
1168
|
})]
|
|
1158
1169
|
})
|
|
@@ -1191,7 +1202,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
1191
1202
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
1192
1203
|
ref: internalTextareaRef,
|
|
1193
1204
|
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : labels.chatInputPlaceholder,
|
|
1194
|
-
className: (0, tailwind_merge.twMerge)("bg-transparent outline-none antialiased font-regular leading-relaxed text-[16px] placeholder:text-[#00000077] dark:placeholder:text-[#fffc]", className),
|
|
1205
|
+
className: (0, tailwind_merge.twMerge)("cpk:bg-transparent cpk:outline-none cpk:antialiased cpk:font-regular cpk:leading-relaxed cpk:text-[16px] cpk:placeholder:text-[#00000077] cpk:dark:placeholder:text-[#fffc]", className),
|
|
1195
1206
|
style: {
|
|
1196
1207
|
overflow: "auto",
|
|
1197
1208
|
resize: "none",
|
|
@@ -1207,7 +1218,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
1207
1218
|
const config = useCopilotChatConfiguration();
|
|
1208
1219
|
const labels = (_config$labels5 = config === null || config === void 0 ? void 0 : config.labels) !== null && _config$labels5 !== void 0 ? _config$labels5 : CopilotChatDefaultLabels;
|
|
1209
1220
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1210
|
-
className: cn("text-center text-xs text-muted-foreground py-3 px-4 max-w-3xl mx-auto", className),
|
|
1221
|
+
className: cn("cpk:text-center cpk:text-xs cpk:text-muted-foreground cpk:py-3 cpk:px-4 cpk:max-w-3xl cpk:mx-auto", className),
|
|
1211
1222
|
...props,
|
|
1212
1223
|
children: labels.chatDisclaimerText
|
|
1213
1224
|
});
|
|
@@ -1787,6 +1798,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
1787
1798
|
_defineProperty(this, "_renderToolCalls", []);
|
|
1788
1799
|
_defineProperty(this, "_renderCustomMessages", []);
|
|
1789
1800
|
_defineProperty(this, "_renderActivityMessages", []);
|
|
1801
|
+
_defineProperty(this, "_interruptElement", null);
|
|
1790
1802
|
this._renderToolCalls = (_config$renderToolCal = config.renderToolCalls) !== null && _config$renderToolCal !== void 0 ? _config$renderToolCal : [];
|
|
1791
1803
|
this._renderCustomMessages = (_config$renderCustomM = config.renderCustomMessages) !== null && _config$renderCustomM !== void 0 ? _config$renderCustomM : [];
|
|
1792
1804
|
this._renderActivityMessages = (_config$renderActivit = config.renderActivityMessages) !== null && _config$renderActivit !== void 0 ? _config$renderActivit : [];
|
|
@@ -1810,6 +1822,20 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
1810
1822
|
});
|
|
1811
1823
|
}, "Subscriber onRenderToolCallsChanged error:");
|
|
1812
1824
|
}
|
|
1825
|
+
get interruptElement() {
|
|
1826
|
+
return this._interruptElement;
|
|
1827
|
+
}
|
|
1828
|
+
setInterruptElement(element) {
|
|
1829
|
+
this._interruptElement = element;
|
|
1830
|
+
this.notifySubscribers((subscriber) => {
|
|
1831
|
+
var _reactSubscriber$onIn;
|
|
1832
|
+
const reactSubscriber = subscriber;
|
|
1833
|
+
(_reactSubscriber$onIn = reactSubscriber.onInterruptElementChanged) === null || _reactSubscriber$onIn === void 0 || _reactSubscriber$onIn.call(reactSubscriber, {
|
|
1834
|
+
copilotkit: this,
|
|
1835
|
+
interruptElement: this._interruptElement
|
|
1836
|
+
});
|
|
1837
|
+
}, "Subscriber onInterruptElementChanged error:");
|
|
1838
|
+
}
|
|
1813
1839
|
subscribe(subscriber) {
|
|
1814
1840
|
return super.subscribe(subscriber);
|
|
1815
1841
|
}
|
|
@@ -2237,21 +2263,34 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2237
2263
|
* This hook is a convenience wrapper around `useFrontendTool` that:
|
|
2238
2264
|
* - builds a model-facing tool description,
|
|
2239
2265
|
* - forwards optional Zod parameters,
|
|
2240
|
-
* - renders your component with tool call
|
|
2266
|
+
* - renders your component with tool call parameters.
|
|
2241
2267
|
*
|
|
2242
2268
|
* Use this when you want to display a typed visual component for a tool call
|
|
2243
2269
|
* without manually wiring a full frontend tool object.
|
|
2244
2270
|
*
|
|
2245
|
-
*
|
|
2271
|
+
* When `parameters` is provided, render props are inferred from the schema
|
|
2272
|
+
* via `z.infer`. When omitted, the render component may accept any props.
|
|
2273
|
+
*
|
|
2274
|
+
* @typeParam TSchema - Zod schema describing tool parameters, or `undefined` when no schema is given.
|
|
2246
2275
|
* @param config - Tool registration config.
|
|
2247
2276
|
* @param deps - Optional dependencies to refresh registration (same semantics as `useEffect`).
|
|
2248
2277
|
*
|
|
2249
2278
|
* @example
|
|
2250
2279
|
* ```tsx
|
|
2280
|
+
* // Without parameters — render accepts any props
|
|
2281
|
+
* useComponent({
|
|
2282
|
+
* name: "showGreeting",
|
|
2283
|
+
* render: ({ message }: { message: string }) => <div>{message}</div>,
|
|
2284
|
+
* });
|
|
2285
|
+
* ```
|
|
2286
|
+
*
|
|
2287
|
+
* @example
|
|
2288
|
+
* ```tsx
|
|
2289
|
+
* // With parameters — render props inferred from schema
|
|
2251
2290
|
* useComponent({
|
|
2252
2291
|
* name: "showWeatherCard",
|
|
2253
2292
|
* parameters: z.object({ city: z.string() }),
|
|
2254
|
-
*
|
|
2293
|
+
* render: ({ city }) => <div>{city}</div>,
|
|
2255
2294
|
* });
|
|
2256
2295
|
* ```
|
|
2257
2296
|
*
|
|
@@ -2261,7 +2300,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2261
2300
|
* {
|
|
2262
2301
|
* name: "renderProfile",
|
|
2263
2302
|
* parameters: z.object({ userId: z.string() }),
|
|
2264
|
-
*
|
|
2303
|
+
* render: ProfileCard,
|
|
2265
2304
|
* agentId: "support-agent",
|
|
2266
2305
|
* },
|
|
2267
2306
|
* [selectedAgentId],
|
|
@@ -2276,7 +2315,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2276
2315
|
description: fullDescription,
|
|
2277
2316
|
parameters: config.parameters,
|
|
2278
2317
|
render: ({ args }) => {
|
|
2279
|
-
const Component = config.
|
|
2318
|
+
const Component = config.render;
|
|
2280
2319
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, { ...args });
|
|
2281
2320
|
},
|
|
2282
2321
|
agentId: config.agentId
|
|
@@ -2306,7 +2345,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2306
2345
|
* - keeps renderer entries on cleanup so historical chat tool calls can still render,
|
|
2307
2346
|
* - refreshes registration when `deps` change.
|
|
2308
2347
|
*
|
|
2309
|
-
* @typeParam S - Zod schema type describing tool call
|
|
2348
|
+
* @typeParam S - Zod schema type describing tool call parameters.
|
|
2310
2349
|
* @param config - Renderer config for wildcard or named tools.
|
|
2311
2350
|
* @param deps - Optional dependencies to refresh registration.
|
|
2312
2351
|
*
|
|
@@ -2315,9 +2354,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2315
2354
|
* useRenderTool(
|
|
2316
2355
|
* {
|
|
2317
2356
|
* name: "searchDocs",
|
|
2318
|
-
*
|
|
2319
|
-
* render: ({ status,
|
|
2320
|
-
* if (status === "executing") return <div>Searching {
|
|
2357
|
+
* parameters: z.object({ query: z.string() }),
|
|
2358
|
+
* render: ({ status, parameters, result }) => {
|
|
2359
|
+
* if (status === "executing") return <div>Searching {parameters.query}</div>;
|
|
2321
2360
|
* if (status === "complete") return <div>{result}</div>;
|
|
2322
2361
|
* return <div>Preparing...</div>;
|
|
2323
2362
|
* },
|
|
@@ -2331,7 +2370,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2331
2370
|
* useRenderTool(
|
|
2332
2371
|
* {
|
|
2333
2372
|
* name: "summarize",
|
|
2334
|
-
*
|
|
2373
|
+
* parameters: z.object({ text: z.string() }),
|
|
2335
2374
|
* agentId: "research-agent",
|
|
2336
2375
|
* render: ({ name, status }) => <div>{name}: {status}</div>,
|
|
2337
2376
|
* },
|
|
@@ -2343,14 +2382,20 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2343
2382
|
const { copilotkit } = useCopilotKit();
|
|
2344
2383
|
const extraDeps = deps !== null && deps !== void 0 ? deps : EMPTY_DEPS;
|
|
2345
2384
|
(0, react.useEffect)(() => {
|
|
2346
|
-
const renderer = config.name === "*" && !config.
|
|
2385
|
+
const renderer = config.name === "*" && !config.parameters ? defineToolCallRenderer({
|
|
2347
2386
|
name: "*",
|
|
2348
|
-
render: config.render
|
|
2387
|
+
render: (props) => config.render({
|
|
2388
|
+
...props,
|
|
2389
|
+
parameters: props.args
|
|
2390
|
+
}),
|
|
2349
2391
|
...config.agentId ? { agentId: config.agentId } : {}
|
|
2350
2392
|
}) : defineToolCallRenderer({
|
|
2351
2393
|
name: config.name,
|
|
2352
|
-
args: config.
|
|
2353
|
-
render: config.render
|
|
2394
|
+
args: config.parameters,
|
|
2395
|
+
render: (props) => config.render({
|
|
2396
|
+
...props,
|
|
2397
|
+
parameters: props.args
|
|
2398
|
+
}),
|
|
2354
2399
|
...config.agentId ? { agentId: config.agentId } : {}
|
|
2355
2400
|
});
|
|
2356
2401
|
const keyOf = (rc) => {
|
|
@@ -2415,7 +2460,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2415
2460
|
render: (_config$render = config === null || config === void 0 ? void 0 : config.render) !== null && _config$render !== void 0 ? _config$render : DefaultToolCallRenderer
|
|
2416
2461
|
}, deps);
|
|
2417
2462
|
}
|
|
2418
|
-
function DefaultToolCallRenderer({ name,
|
|
2463
|
+
function DefaultToolCallRenderer({ name, parameters, status, result }) {
|
|
2419
2464
|
const [isExpanded, setIsExpanded] = (0, react.useState)(false);
|
|
2420
2465
|
const statusString = String(status);
|
|
2421
2466
|
const isActive = statusString === "inProgress" || statusString === "executing";
|
|
@@ -2531,7 +2576,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2531
2576
|
whiteSpace: "pre-wrap",
|
|
2532
2577
|
wordBreak: "break-word"
|
|
2533
2578
|
},
|
|
2534
|
-
children: JSON.stringify(
|
|
2579
|
+
children: JSON.stringify(parameters !== null && parameters !== void 0 ? parameters : {}, null, 2)
|
|
2535
2580
|
})] }), result !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2536
2581
|
style: {
|
|
2537
2582
|
fontSize: "10px",
|
|
@@ -2926,6 +2971,170 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2926
2971
|
});
|
|
2927
2972
|
}
|
|
2928
2973
|
|
|
2974
|
+
//#endregion
|
|
2975
|
+
//#region src/hooks/use-interrupt.tsx
|
|
2976
|
+
const INTERRUPT_EVENT_NAME = "on_interrupt";
|
|
2977
|
+
function isPromiseLike(value) {
|
|
2978
|
+
return (typeof value === "object" || typeof value === "function") && value !== null && typeof Reflect.get(value, "then") === "function";
|
|
2979
|
+
}
|
|
2980
|
+
/**
|
|
2981
|
+
* Handles agent interrupts (`on_interrupt`) with optional filtering, preprocessing, and resume behavior.
|
|
2982
|
+
*
|
|
2983
|
+
* The hook listens to custom events on the active agent, stores interrupt payloads per run,
|
|
2984
|
+
* and surfaces a render callback once the run finalizes. Call `resolve` from your UI to resume
|
|
2985
|
+
* execution with user-provided data.
|
|
2986
|
+
*
|
|
2987
|
+
* - `renderInChat: true` (default): the element is published into `<CopilotChat>` and this hook returns `void`.
|
|
2988
|
+
* - `renderInChat: false`: the hook returns the interrupt element so you can place it anywhere in your component tree.
|
|
2989
|
+
*
|
|
2990
|
+
* `event.value` is typed as `any` since the interrupt payload shape depends on your agent.
|
|
2991
|
+
* Type-narrow it in your callbacks (e.g. `handler`, `enabled`, `render`) as needed.
|
|
2992
|
+
*
|
|
2993
|
+
* @typeParam TResult - Inferred from `handler` return type. Exposed as `result` in `render`.
|
|
2994
|
+
* @param config - Interrupt configuration (renderer, optional handler/filter, and render mode).
|
|
2995
|
+
* @returns When `renderInChat` is `false`, returns the interrupt element (or `null` when idle).
|
|
2996
|
+
* Otherwise returns `void` and publishes the element into chat. In `render`, `result` is always
|
|
2997
|
+
* either the handler's resolved return value or `null` (including when no handler is provided,
|
|
2998
|
+
* when filtering skips the interrupt, or when handler execution fails).
|
|
2999
|
+
*
|
|
3000
|
+
* @example
|
|
3001
|
+
* ```tsx
|
|
3002
|
+
* import { useInterrupt } from "@copilotkitnext/react";
|
|
3003
|
+
*
|
|
3004
|
+
* function InterruptUI() {
|
|
3005
|
+
* useInterrupt({
|
|
3006
|
+
* render: ({ event, resolve }) => (
|
|
3007
|
+
* <div>
|
|
3008
|
+
* <p>{event.value.question}</p>
|
|
3009
|
+
* <button onClick={() => resolve({ approved: true })}>Approve</button>
|
|
3010
|
+
* <button onClick={() => resolve({ approved: false })}>Reject</button>
|
|
3011
|
+
* </div>
|
|
3012
|
+
* ),
|
|
3013
|
+
* });
|
|
3014
|
+
*
|
|
3015
|
+
* return null;
|
|
3016
|
+
* }
|
|
3017
|
+
* ```
|
|
3018
|
+
*
|
|
3019
|
+
* @example
|
|
3020
|
+
* ```tsx
|
|
3021
|
+
* import { useInterrupt } from "@copilotkitnext/react";
|
|
3022
|
+
*
|
|
3023
|
+
* function CustomPanel() {
|
|
3024
|
+
* const interruptElement = useInterrupt({
|
|
3025
|
+
* renderInChat: false,
|
|
3026
|
+
* enabled: (event) => event.value.startsWith("approval:"),
|
|
3027
|
+
* handler: async ({ event }) => ({ label: event.value.toUpperCase() }),
|
|
3028
|
+
* render: ({ event, result, resolve }) => (
|
|
3029
|
+
* <aside>
|
|
3030
|
+
* <strong>{result?.label ?? ""}</strong>
|
|
3031
|
+
* <button onClick={() => resolve({ value: event.value })}>Continue</button>
|
|
3032
|
+
* </aside>
|
|
3033
|
+
* ),
|
|
3034
|
+
* });
|
|
3035
|
+
*
|
|
3036
|
+
* return <>{interruptElement}</>;
|
|
3037
|
+
* }
|
|
3038
|
+
* ```
|
|
3039
|
+
*/
|
|
3040
|
+
function useInterrupt(config) {
|
|
3041
|
+
const { copilotkit } = useCopilotKit();
|
|
3042
|
+
const { agent } = useAgent({ agentId: config.agentId });
|
|
3043
|
+
const [pendingEvent, setPendingEvent] = (0, react.useState)(null);
|
|
3044
|
+
const [handlerResult, setHandlerResult] = (0, react.useState)(null);
|
|
3045
|
+
(0, react.useEffect)(() => {
|
|
3046
|
+
let localInterrupt = null;
|
|
3047
|
+
const subscription = agent.subscribe({
|
|
3048
|
+
onCustomEvent: ({ event }) => {
|
|
3049
|
+
if (event.name === INTERRUPT_EVENT_NAME) localInterrupt = {
|
|
3050
|
+
name: event.name,
|
|
3051
|
+
value: event.value
|
|
3052
|
+
};
|
|
3053
|
+
},
|
|
3054
|
+
onRunStartedEvent: () => {
|
|
3055
|
+
localInterrupt = null;
|
|
3056
|
+
setPendingEvent(null);
|
|
3057
|
+
},
|
|
3058
|
+
onRunFinalized: () => {
|
|
3059
|
+
if (localInterrupt) {
|
|
3060
|
+
setPendingEvent(localInterrupt);
|
|
3061
|
+
localInterrupt = null;
|
|
3062
|
+
}
|
|
3063
|
+
},
|
|
3064
|
+
onRunFailed: () => {
|
|
3065
|
+
localInterrupt = null;
|
|
3066
|
+
}
|
|
3067
|
+
});
|
|
3068
|
+
return () => subscription.unsubscribe();
|
|
3069
|
+
}, [agent]);
|
|
3070
|
+
const resolve = (0, react.useCallback)((response) => {
|
|
3071
|
+
setPendingEvent(null);
|
|
3072
|
+
copilotkit.runAgent({
|
|
3073
|
+
agent,
|
|
3074
|
+
forwardedProps: { command: { resume: response } }
|
|
3075
|
+
});
|
|
3076
|
+
}, [agent, copilotkit]);
|
|
3077
|
+
(0, react.useEffect)(() => {
|
|
3078
|
+
if (!pendingEvent) {
|
|
3079
|
+
setHandlerResult(null);
|
|
3080
|
+
return;
|
|
3081
|
+
}
|
|
3082
|
+
if (config.enabled && !config.enabled(pendingEvent)) {
|
|
3083
|
+
setHandlerResult(null);
|
|
3084
|
+
return;
|
|
3085
|
+
}
|
|
3086
|
+
const handler = config.handler;
|
|
3087
|
+
if (!handler) {
|
|
3088
|
+
setHandlerResult(null);
|
|
3089
|
+
return;
|
|
3090
|
+
}
|
|
3091
|
+
let cancelled = false;
|
|
3092
|
+
const maybePromise = handler({
|
|
3093
|
+
event: pendingEvent,
|
|
3094
|
+
resolve
|
|
3095
|
+
});
|
|
3096
|
+
if (isPromiseLike(maybePromise)) Promise.resolve(maybePromise).then((resolved) => {
|
|
3097
|
+
if (!cancelled) setHandlerResult(resolved);
|
|
3098
|
+
}).catch(() => {
|
|
3099
|
+
if (!cancelled) setHandlerResult(null);
|
|
3100
|
+
});
|
|
3101
|
+
else setHandlerResult(maybePromise);
|
|
3102
|
+
return () => {
|
|
3103
|
+
cancelled = true;
|
|
3104
|
+
};
|
|
3105
|
+
}, [
|
|
3106
|
+
pendingEvent,
|
|
3107
|
+
config.enabled,
|
|
3108
|
+
config.handler,
|
|
3109
|
+
resolve
|
|
3110
|
+
]);
|
|
3111
|
+
const element = (0, react.useMemo)(() => {
|
|
3112
|
+
if (!pendingEvent) return null;
|
|
3113
|
+
if (config.enabled && !config.enabled(pendingEvent)) return null;
|
|
3114
|
+
return config.render({
|
|
3115
|
+
event: pendingEvent,
|
|
3116
|
+
result: handlerResult,
|
|
3117
|
+
resolve
|
|
3118
|
+
});
|
|
3119
|
+
}, [
|
|
3120
|
+
pendingEvent,
|
|
3121
|
+
handlerResult,
|
|
3122
|
+
config.enabled,
|
|
3123
|
+
config.render,
|
|
3124
|
+
resolve
|
|
3125
|
+
]);
|
|
3126
|
+
(0, react.useEffect)(() => {
|
|
3127
|
+
if (config.renderInChat === false) return;
|
|
3128
|
+
copilotkit.setInterruptElement(element);
|
|
3129
|
+
return () => copilotkit.setInterruptElement(null);
|
|
3130
|
+
}, [
|
|
3131
|
+
element,
|
|
3132
|
+
config.renderInChat,
|
|
3133
|
+
copilotkit
|
|
3134
|
+
]);
|
|
3135
|
+
if (config.renderInChat === false) return element;
|
|
3136
|
+
}
|
|
3137
|
+
|
|
2929
3138
|
//#endregion
|
|
2930
3139
|
//#region src/components/chat/CopilotChatToolCallsView.tsx
|
|
2931
3140
|
function CopilotChatToolCallsView({ message, messages = [] }) {
|
|
@@ -2957,7 +3166,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2957
3166
|
const boundReadAloudButton = renderSlot(readAloudButton, CopilotChatAssistantMessage.ReadAloudButton, { onClick: onReadAloud });
|
|
2958
3167
|
const boundRegenerateButton = renderSlot(regenerateButton, CopilotChatAssistantMessage.RegenerateButton, { onClick: onRegenerate });
|
|
2959
3168
|
const boundToolbar = renderSlot(toolbar, CopilotChatAssistantMessage.Toolbar, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2960
|
-
className: "flex items-center gap-1",
|
|
3169
|
+
className: "cpk:flex cpk:items-center cpk:gap-1",
|
|
2961
3170
|
children: [
|
|
2962
3171
|
boundCopyButton,
|
|
2963
3172
|
(onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
|
|
@@ -2974,31 +3183,39 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2974
3183
|
const hasContent = !!(message.content && message.content.trim().length > 0);
|
|
2975
3184
|
const isLatestAssistantMessage = message.role === "assistant" && (messages === null || messages === void 0 || (_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.id) === message.id;
|
|
2976
3185
|
const shouldShowToolbar = toolbarVisible && hasContent && !(isRunning && isLatestAssistantMessage);
|
|
2977
|
-
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
3186
|
+
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3187
|
+
"data-copilotkit": true,
|
|
3188
|
+
style: { display: "contents" },
|
|
3189
|
+
children: children({
|
|
3190
|
+
markdownRenderer: boundMarkdownRenderer,
|
|
3191
|
+
toolbar: boundToolbar,
|
|
3192
|
+
toolCallsView: boundToolCallsView,
|
|
3193
|
+
copyButton: boundCopyButton,
|
|
3194
|
+
thumbsUpButton: boundThumbsUpButton,
|
|
3195
|
+
thumbsDownButton: boundThumbsDownButton,
|
|
3196
|
+
readAloudButton: boundReadAloudButton,
|
|
3197
|
+
regenerateButton: boundRegenerateButton,
|
|
3198
|
+
message,
|
|
3199
|
+
messages,
|
|
3200
|
+
isRunning,
|
|
3201
|
+
onThumbsUp,
|
|
3202
|
+
onThumbsDown,
|
|
3203
|
+
onReadAloud,
|
|
3204
|
+
onRegenerate,
|
|
3205
|
+
additionalToolbarItems,
|
|
3206
|
+
toolbarVisible: shouldShowToolbar
|
|
3207
|
+
})
|
|
3208
|
+
});
|
|
2996
3209
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2997
|
-
|
|
3210
|
+
"data-copilotkit": true,
|
|
3211
|
+
className: (0, tailwind_merge.twMerge)(className),
|
|
2998
3212
|
...props,
|
|
2999
3213
|
"data-message-id": message.id,
|
|
3000
3214
|
children: [
|
|
3001
|
-
|
|
3215
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3216
|
+
className: "cpk:prose cpk:max-w-full cpk:break-words cpk:dark:prose-invert",
|
|
3217
|
+
children: boundMarkdownRenderer
|
|
3218
|
+
}),
|
|
3002
3219
|
boundToolCallsView,
|
|
3003
3220
|
shouldShowToolbar && boundToolbar
|
|
3004
3221
|
]
|
|
@@ -3011,7 +3228,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3011
3228
|
children: content !== null && content !== void 0 ? content : ""
|
|
3012
3229
|
});
|
|
3013
3230
|
_CopilotChatAssistantMessage.Toolbar = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3014
|
-
className: (0, tailwind_merge.twMerge)("w-full bg-transparent flex items-center
|
|
3231
|
+
className: (0, tailwind_merge.twMerge)("cpk:w-full cpk:bg-transparent cpk:flex cpk:items-center cpk:-ml-[5px] cpk:-mt-[0px]", className),
|
|
3015
3232
|
...props
|
|
3016
3233
|
});
|
|
3017
3234
|
const ToolbarButton = _CopilotChatAssistantMessage.ToolbarButton = ({ title, children, ...props }) => {
|
|
@@ -3044,7 +3261,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3044
3261
|
onClick: handleClick,
|
|
3045
3262
|
className,
|
|
3046
3263
|
...props,
|
|
3047
|
-
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "size-[18px]" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Copy, { className: "size-[18px]" })
|
|
3264
|
+
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "cpk:size-[18px]" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Copy, { className: "cpk:size-[18px]" })
|
|
3048
3265
|
});
|
|
3049
3266
|
};
|
|
3050
3267
|
_CopilotChatAssistantMessage.ThumbsUpButton = ({ title, ...props }) => {
|
|
@@ -3054,7 +3271,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3054
3271
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
3055
3272
|
title: title || labels.assistantMessageToolbarThumbsUpLabel,
|
|
3056
3273
|
...props,
|
|
3057
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ThumbsUp, { className: "size-[18px]" })
|
|
3274
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ThumbsUp, { className: "cpk:size-[18px]" })
|
|
3058
3275
|
});
|
|
3059
3276
|
};
|
|
3060
3277
|
_CopilotChatAssistantMessage.ThumbsDownButton = ({ title, ...props }) => {
|
|
@@ -3064,7 +3281,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3064
3281
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
3065
3282
|
title: title || labels.assistantMessageToolbarThumbsDownLabel,
|
|
3066
3283
|
...props,
|
|
3067
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ThumbsDown, { className: "size-[18px]" })
|
|
3284
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ThumbsDown, { className: "cpk:size-[18px]" })
|
|
3068
3285
|
});
|
|
3069
3286
|
};
|
|
3070
3287
|
_CopilotChatAssistantMessage.ReadAloudButton = ({ title, ...props }) => {
|
|
@@ -3074,7 +3291,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3074
3291
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
3075
3292
|
title: title || labels.assistantMessageToolbarReadAloudLabel,
|
|
3076
3293
|
...props,
|
|
3077
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Volume2, { className: "size-[20px]" })
|
|
3294
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Volume2, { className: "cpk:size-[20px]" })
|
|
3078
3295
|
});
|
|
3079
3296
|
};
|
|
3080
3297
|
_CopilotChatAssistantMessage.RegenerateButton = ({ title, ...props }) => {
|
|
@@ -3084,7 +3301,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3084
3301
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
3085
3302
|
title: title || labels.assistantMessageToolbarRegenerateLabel,
|
|
3086
3303
|
...props,
|
|
3087
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.RefreshCw, { className: "size-[18px]" })
|
|
3304
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.RefreshCw, { className: "cpk:size-[18px]" })
|
|
3088
3305
|
});
|
|
3089
3306
|
};
|
|
3090
3307
|
})(CopilotChatAssistantMessage || (CopilotChatAssistantMessage = {}));
|
|
@@ -3126,7 +3343,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3126
3343
|
});
|
|
3127
3344
|
const showBranchNavigation = numberOfBranches && numberOfBranches > 1 && onSwitchToBranch;
|
|
3128
3345
|
const BoundToolbar = renderSlot(toolbar, CopilotChatUserMessage.Toolbar, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3129
|
-
className: "flex items-center gap-1 justify-end",
|
|
3346
|
+
className: "cpk:flex cpk:items-center cpk:gap-1 cpk:justify-end",
|
|
3130
3347
|
children: [
|
|
3131
3348
|
additionalToolbarItems,
|
|
3132
3349
|
BoundCopyButton,
|
|
@@ -3134,19 +3351,24 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3134
3351
|
showBranchNavigation && BoundBranchNavigation
|
|
3135
3352
|
]
|
|
3136
3353
|
}) });
|
|
3137
|
-
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3354
|
+
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3355
|
+
"data-copilotkit": true,
|
|
3356
|
+
style: { display: "contents" },
|
|
3357
|
+
children: children({
|
|
3358
|
+
messageRenderer: BoundMessageRenderer,
|
|
3359
|
+
toolbar: BoundToolbar,
|
|
3360
|
+
copyButton: BoundCopyButton,
|
|
3361
|
+
editButton: BoundEditButton,
|
|
3362
|
+
branchNavigation: BoundBranchNavigation,
|
|
3363
|
+
message,
|
|
3364
|
+
branchIndex,
|
|
3365
|
+
numberOfBranches,
|
|
3366
|
+
additionalToolbarItems
|
|
3367
|
+
})
|
|
3368
|
+
});
|
|
3148
3369
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3149
|
-
|
|
3370
|
+
"data-copilotkit": true,
|
|
3371
|
+
className: (0, tailwind_merge.twMerge)("cpk:flex cpk:flex-col cpk:items-end cpk:group cpk:pt-10", className),
|
|
3150
3372
|
"data-message-id": message.id,
|
|
3151
3373
|
...props,
|
|
3152
3374
|
children: [BoundMessageRenderer, BoundToolbar]
|
|
@@ -3154,16 +3376,16 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3154
3376
|
}
|
|
3155
3377
|
(function(_CopilotChatUserMessage) {
|
|
3156
3378
|
_CopilotChatUserMessage.Container = ({ children, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3157
|
-
className: (0, tailwind_merge.twMerge)("flex flex-col items-end group", className),
|
|
3379
|
+
className: (0, tailwind_merge.twMerge)("cpk:flex cpk:flex-col cpk:items-end cpk:group", className),
|
|
3158
3380
|
...props,
|
|
3159
3381
|
children
|
|
3160
3382
|
});
|
|
3161
3383
|
_CopilotChatUserMessage.MessageRenderer = ({ content, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3162
|
-
className: (0, tailwind_merge.twMerge)("prose dark:prose-invert bg-muted relative max-w-[80%] rounded-[18px] px-4 py-1.5 data-[multiline]:py-3 inline-block whitespace-pre-wrap", className),
|
|
3384
|
+
className: (0, tailwind_merge.twMerge)("cpk:prose cpk:dark:prose-invert cpk:bg-muted cpk:relative cpk:max-w-[80%] cpk:rounded-[18px] cpk:px-4 cpk:py-1.5 cpk:data-[multiline]:py-3 cpk:inline-block cpk:whitespace-pre-wrap", className),
|
|
3163
3385
|
children: content
|
|
3164
3386
|
});
|
|
3165
3387
|
_CopilotChatUserMessage.Toolbar = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3166
|
-
className: (0, tailwind_merge.twMerge)("w-full bg-transparent flex items-center justify-end
|
|
3388
|
+
className: (0, tailwind_merge.twMerge)("cpk:w-full cpk:bg-transparent cpk:flex cpk:items-center cpk:justify-end cpk:-mr-[5px] cpk:mt-[4px] cpk:invisible cpk:group-hover:visible", className),
|
|
3167
3389
|
...props
|
|
3168
3390
|
});
|
|
3169
3391
|
const ToolbarButton = _CopilotChatUserMessage.ToolbarButton = ({ title, children, className, ...props }) => {
|
|
@@ -3197,7 +3419,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3197
3419
|
onClick: handleClick,
|
|
3198
3420
|
className,
|
|
3199
3421
|
...props,
|
|
3200
|
-
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "size-[18px]" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Copy, { className: "size-[18px]" })
|
|
3422
|
+
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "cpk:size-[18px]" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Copy, { className: "cpk:size-[18px]" })
|
|
3201
3423
|
});
|
|
3202
3424
|
};
|
|
3203
3425
|
_CopilotChatUserMessage.EditButton = ({ className, title, ...props }) => {
|
|
@@ -3208,7 +3430,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3208
3430
|
title: title || labels.userMessageToolbarEditMessageLabel,
|
|
3209
3431
|
className,
|
|
3210
3432
|
...props,
|
|
3211
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Edit, { className: "size-[18px]" })
|
|
3433
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Edit, { className: "cpk:size-[18px]" })
|
|
3212
3434
|
});
|
|
3213
3435
|
};
|
|
3214
3436
|
_CopilotChatUserMessage.BranchNavigation = ({ className, currentBranch = 0, numberOfBranches = 1, onSwitchToBranch, message, ...props }) => {
|
|
@@ -3216,7 +3438,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3216
3438
|
const canGoPrev = currentBranch > 0;
|
|
3217
3439
|
const canGoNext = currentBranch < numberOfBranches - 1;
|
|
3218
3440
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3219
|
-
className: (0, tailwind_merge.twMerge)("flex items-center gap-1", className),
|
|
3441
|
+
className: (0, tailwind_merge.twMerge)("cpk:flex cpk:items-center cpk:gap-1", className),
|
|
3220
3442
|
...props,
|
|
3221
3443
|
children: [
|
|
3222
3444
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
@@ -3228,11 +3450,11 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3228
3450
|
message
|
|
3229
3451
|
}),
|
|
3230
3452
|
disabled: !canGoPrev,
|
|
3231
|
-
className: "h-6 w-6 p-0",
|
|
3232
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronLeft, { className: "size-[20px]" })
|
|
3453
|
+
className: "cpk:h-6 cpk:w-6 cpk:p-0",
|
|
3454
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronLeft, { className: "cpk:size-[20px]" })
|
|
3233
3455
|
}),
|
|
3234
3456
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3235
|
-
className: "text-sm text-muted-foreground px-0 font-medium",
|
|
3457
|
+
className: "cpk:text-sm cpk:text-muted-foreground cpk:px-0 cpk:font-medium",
|
|
3236
3458
|
children: [
|
|
3237
3459
|
currentBranch + 1,
|
|
3238
3460
|
"/",
|
|
@@ -3248,8 +3470,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3248
3470
|
message
|
|
3249
3471
|
}),
|
|
3250
3472
|
disabled: !canGoNext,
|
|
3251
|
-
className: "h-6 w-6 p-0",
|
|
3252
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRight, { className: "size-[20px]" })
|
|
3473
|
+
className: "cpk:h-6 cpk:w-6 cpk:p-0",
|
|
3474
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRight, { className: "cpk:size-[20px]" })
|
|
3253
3475
|
})
|
|
3254
3476
|
]
|
|
3255
3477
|
});
|
|
@@ -3318,16 +3540,20 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3318
3540
|
isOpen,
|
|
3319
3541
|
children: boundContent
|
|
3320
3542
|
});
|
|
3321
|
-
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3543
|
+
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3544
|
+
"data-copilotkit": true,
|
|
3545
|
+
style: { display: "contents" },
|
|
3546
|
+
children: children({
|
|
3547
|
+
header: boundHeader,
|
|
3548
|
+
contentView: boundContent,
|
|
3549
|
+
toggle: boundToggle,
|
|
3550
|
+
message,
|
|
3551
|
+
messages,
|
|
3552
|
+
isRunning
|
|
3553
|
+
})
|
|
3554
|
+
});
|
|
3329
3555
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3330
|
-
className: (0, tailwind_merge.twMerge)("my-1", className),
|
|
3556
|
+
className: (0, tailwind_merge.twMerge)("cpk:my-1", className),
|
|
3331
3557
|
"data-message-id": message.id,
|
|
3332
3558
|
...props,
|
|
3333
3559
|
children: [boundHeader, boundToggle]
|
|
@@ -3338,44 +3564,44 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3338
3564
|
const isExpandable = !!hasContent;
|
|
3339
3565
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3340
3566
|
type: "button",
|
|
3341
|
-
className: (0, tailwind_merge.twMerge)("inline-flex items-center gap-1 py-1 text-sm text-muted-foreground transition-colors select-none", isExpandable ? "hover:text-foreground cursor-pointer" : "cursor-default", className),
|
|
3567
|
+
className: (0, tailwind_merge.twMerge)("cpk:inline-flex cpk:items-center cpk:gap-1 cpk:py-1 cpk:text-sm cpk:text-muted-foreground cpk:transition-colors cpk:select-none", isExpandable ? "cpk:hover:text-foreground cpk:cursor-pointer" : "cpk:cursor-default", className),
|
|
3342
3568
|
"aria-expanded": isExpandable ? isOpen : void 0,
|
|
3343
3569
|
...headerProps,
|
|
3344
3570
|
children: [
|
|
3345
3571
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3346
|
-
className: "font-medium",
|
|
3572
|
+
className: "cpk:font-medium",
|
|
3347
3573
|
children: label
|
|
3348
3574
|
}),
|
|
3349
3575
|
isStreaming && !hasContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3350
|
-
className: "inline-flex items-center ml-1",
|
|
3351
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-pulse" })
|
|
3576
|
+
className: "cpk:inline-flex cpk:items-center cpk:ml-1",
|
|
3577
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "cpk:w-1.5 cpk:h-1.5 cpk:rounded-full cpk:bg-muted-foreground cpk:animate-pulse" })
|
|
3352
3578
|
}),
|
|
3353
3579
|
headerChildren,
|
|
3354
|
-
isExpandable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRight, { className: (0, tailwind_merge.twMerge)("size-3.5 shrink-0 transition-transform duration-200", isOpen && "rotate-90") })
|
|
3580
|
+
isExpandable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRight, { className: (0, tailwind_merge.twMerge)("cpk:size-3.5 cpk:shrink-0 cpk:transition-transform cpk:duration-200", isOpen && "cpk:rotate-90") })
|
|
3355
3581
|
]
|
|
3356
3582
|
});
|
|
3357
3583
|
};
|
|
3358
3584
|
_CopilotChatReasoningMessage.Content = ({ isStreaming, hasContent, className, children: contentChildren, ...contentProps }) => {
|
|
3359
3585
|
if (!hasContent && !isStreaming) return null;
|
|
3360
3586
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3361
|
-
className: (0, tailwind_merge.twMerge)("pb-2 pt-1", className),
|
|
3587
|
+
className: (0, tailwind_merge.twMerge)("cpk:pb-2 cpk:pt-1", className),
|
|
3362
3588
|
...contentProps,
|
|
3363
3589
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3364
|
-
className: "text-sm text-muted-foreground",
|
|
3590
|
+
className: "cpk:text-sm cpk:text-muted-foreground",
|
|
3365
3591
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.Streamdown, { children: typeof contentChildren === "string" ? contentChildren : "" }), isStreaming && hasContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3366
|
-
className: "inline-flex items-center ml-1 align-middle",
|
|
3367
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "w-2 h-2 rounded-full bg-muted-foreground animate-pulse-cursor" })
|
|
3592
|
+
className: "cpk:inline-flex cpk:items-center cpk:ml-1 cpk:align-middle",
|
|
3593
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "cpk:w-2 cpk:h-2 cpk:rounded-full cpk:bg-muted-foreground cpk:animate-pulse-cursor" })
|
|
3368
3594
|
})]
|
|
3369
3595
|
})
|
|
3370
3596
|
});
|
|
3371
3597
|
};
|
|
3372
3598
|
_CopilotChatReasoningMessage.Toggle = ({ isOpen, className, children: toggleChildren, ...toggleProps }) => {
|
|
3373
3599
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3374
|
-
className: (0, tailwind_merge.twMerge)("grid transition-[grid-template-rows] duration-200 ease-in-out", className),
|
|
3600
|
+
className: (0, tailwind_merge.twMerge)("cpk:grid cpk:transition-[grid-template-rows] cpk:duration-200 cpk:ease-in-out", className),
|
|
3375
3601
|
style: { gridTemplateRows: isOpen ? "1fr" : "0fr" },
|
|
3376
3602
|
...toggleProps,
|
|
3377
3603
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3378
|
-
className: "overflow-hidden",
|
|
3604
|
+
className: "cpk:overflow-hidden",
|
|
3379
3605
|
children: toggleChildren
|
|
3380
3606
|
})
|
|
3381
3607
|
});
|
|
@@ -3388,12 +3614,13 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3388
3614
|
|
|
3389
3615
|
//#endregion
|
|
3390
3616
|
//#region src/components/chat/CopilotChatSuggestionPill.tsx
|
|
3391
|
-
const baseClasses = "group inline-flex h-7 sm:h-8 items-center gap-1 sm:gap-1.5 rounded-full border border-border/60 bg-background px-2.5 sm:px-3 text-[11px] sm:text-xs leading-none text-foreground transition-colors cursor-pointer hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:text-muted-foreground disabled:hover:bg-background disabled:hover:text-muted-foreground pointer-events-auto";
|
|
3392
|
-
const labelClasses = "whitespace-nowrap font-medium leading-none";
|
|
3617
|
+
const baseClasses = "group cpk:inline-flex cpk:h-7 cpk:sm:h-8 cpk:items-center cpk:gap-1 cpk:sm:gap-1.5 cpk:rounded-full cpk:border cpk:border-border/60 cpk:bg-background cpk:px-2.5 cpk:sm:px-3 cpk:text-[11px] cpk:sm:text-xs cpk:leading-none cpk:text-foreground cpk:transition-colors cpk:cursor-pointer cpk:hover:bg-accent/60 cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background cpk:disabled:cursor-not-allowed cpk:disabled:text-muted-foreground cpk:disabled:hover:bg-background cpk:disabled:hover:text-muted-foreground cpk:pointer-events-auto";
|
|
3618
|
+
const labelClasses = "cpk:whitespace-nowrap cpk:font-medium cpk:leading-none";
|
|
3393
3619
|
const CopilotChatSuggestionPill = react.default.forwardRef(function CopilotChatSuggestionPill({ className, children, icon, isLoading, type, ...props }, ref) {
|
|
3394
3620
|
const showIcon = !isLoading && icon;
|
|
3395
3621
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3396
3622
|
ref,
|
|
3623
|
+
"data-copilotkit": true,
|
|
3397
3624
|
"data-slot": "suggestion-pill",
|
|
3398
3625
|
className: cn(baseClasses, className),
|
|
3399
3626
|
type: type !== null && type !== void 0 ? type : "button",
|
|
@@ -3401,13 +3628,13 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3401
3628
|
disabled: isLoading || props.disabled,
|
|
3402
3629
|
...props,
|
|
3403
3630
|
children: [isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3404
|
-
className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground",
|
|
3631
|
+
className: "cpk:flex cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:items-center cpk:justify-center cpk:text-muted-foreground",
|
|
3405
3632
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, {
|
|
3406
|
-
className: "h-3.5 sm:h-4 w-3.5 sm:w-4 animate-spin",
|
|
3633
|
+
className: "cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:animate-spin",
|
|
3407
3634
|
"aria-hidden": "true"
|
|
3408
3635
|
})
|
|
3409
3636
|
}) : showIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3410
|
-
className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground",
|
|
3637
|
+
className: "cpk:flex cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:items-center cpk:justify-center cpk:text-muted-foreground",
|
|
3411
3638
|
children: icon
|
|
3412
3639
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3413
3640
|
className: labelClasses,
|
|
@@ -3422,7 +3649,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3422
3649
|
const DefaultContainer = react.default.forwardRef(function DefaultContainer({ className, ...props }, ref) {
|
|
3423
3650
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3424
3651
|
ref,
|
|
3425
|
-
|
|
3652
|
+
"data-copilotkit": true,
|
|
3653
|
+
className: cn("cpk:flex cpk:flex-wrap cpk:items-center cpk:gap-1.5 cpk:sm:gap-2 cpk:pl-0 cpk:pr-4 cpk:sm:px-0 cpk:pointer-events-none", className),
|
|
3426
3654
|
...props
|
|
3427
3655
|
});
|
|
3428
3656
|
});
|
|
@@ -3449,21 +3677,30 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3449
3677
|
const boundContainer = react.default.cloneElement(ContainerElement, void 0, suggestionElements);
|
|
3450
3678
|
if (typeof children === "function") {
|
|
3451
3679
|
var _suggestions$0$title, _suggestions$, _suggestions$2;
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3680
|
+
const sampleSuggestion = renderSlot(suggestionSlot, CopilotChatSuggestionPill, {
|
|
3681
|
+
children: (_suggestions$0$title = (_suggestions$ = suggestions[0]) === null || _suggestions$ === void 0 ? void 0 : _suggestions$.title) !== null && _suggestions$0$title !== void 0 ? _suggestions$0$title : "",
|
|
3682
|
+
isLoading: suggestions.length > 0 ? loadingSet.has(0) || ((_suggestions$2 = suggestions[0]) === null || _suggestions$2 === void 0 ? void 0 : _suggestions$2.isLoading) === true : false,
|
|
3683
|
+
type: "button"
|
|
3684
|
+
});
|
|
3685
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3686
|
+
"data-copilotkit": true,
|
|
3687
|
+
style: { display: "contents" },
|
|
3688
|
+
children: children({
|
|
3689
|
+
container: boundContainer,
|
|
3690
|
+
suggestion: sampleSuggestion,
|
|
3691
|
+
suggestions,
|
|
3692
|
+
onSelectSuggestion,
|
|
3693
|
+
loadingIndexes,
|
|
3694
|
+
className,
|
|
3695
|
+
...restProps
|
|
3696
|
+
})
|
|
3697
|
+
});
|
|
3465
3698
|
}
|
|
3466
|
-
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
3699
|
+
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3700
|
+
"data-copilotkit": true,
|
|
3701
|
+
style: { display: "contents" },
|
|
3702
|
+
children: [boundContainer, children]
|
|
3703
|
+
});
|
|
3467
3704
|
return boundContainer;
|
|
3468
3705
|
});
|
|
3469
3706
|
CopilotChatSuggestionView.displayName = "CopilotChatSuggestionView";
|
|
@@ -3587,6 +3824,14 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3587
3824
|
copilotkit,
|
|
3588
3825
|
forceUpdate
|
|
3589
3826
|
]);
|
|
3827
|
+
const [interruptElement, setInterruptElement] = (0, react.useState)(null);
|
|
3828
|
+
(0, react.useEffect)(() => {
|
|
3829
|
+
setInterruptElement(copilotkit.interruptElement);
|
|
3830
|
+
const subscription = copilotkit.subscribe({ onInterruptElementChanged: ({ interruptElement }) => {
|
|
3831
|
+
setInterruptElement(interruptElement);
|
|
3832
|
+
} });
|
|
3833
|
+
return () => subscription.unsubscribe();
|
|
3834
|
+
}, [copilotkit]);
|
|
3590
3835
|
const getStateSnapshotForMessage = (messageId) => {
|
|
3591
3836
|
var _copilotkit$getRunIdF;
|
|
3592
3837
|
if (!config) return void 0;
|
|
@@ -3655,25 +3900,35 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3655
3900
|
}, `${message.id}-custom-after`));
|
|
3656
3901
|
return elements;
|
|
3657
3902
|
}).filter(Boolean);
|
|
3658
|
-
if (children) return
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3903
|
+
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3904
|
+
"data-copilotkit": true,
|
|
3905
|
+
style: { display: "contents" },
|
|
3906
|
+
children: children({
|
|
3907
|
+
messageElements,
|
|
3908
|
+
messages,
|
|
3909
|
+
isRunning,
|
|
3910
|
+
interruptElement
|
|
3911
|
+
})
|
|
3662
3912
|
});
|
|
3663
3913
|
const lastMessage = messages[messages.length - 1];
|
|
3664
3914
|
const showCursor = isRunning && (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.role) !== "reasoning";
|
|
3665
3915
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3666
|
-
|
|
3916
|
+
"data-copilotkit": true,
|
|
3917
|
+
className: (0, tailwind_merge.twMerge)("cpk:flex cpk:flex-col", className),
|
|
3667
3918
|
...props,
|
|
3668
|
-
children: [
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3919
|
+
children: [
|
|
3920
|
+
messageElements,
|
|
3921
|
+
interruptElement,
|
|
3922
|
+
showCursor && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3923
|
+
className: "cpk:mt-2",
|
|
3924
|
+
children: renderSlot(cursor, CopilotChatMessageView.Cursor, {})
|
|
3925
|
+
})
|
|
3926
|
+
]
|
|
3672
3927
|
});
|
|
3673
3928
|
}
|
|
3674
3929
|
CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
|
|
3675
3930
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3676
|
-
className: (0, tailwind_merge.twMerge)("w-[11px] h-[11px] rounded-full bg-foreground animate-pulse-cursor ml-1", className),
|
|
3931
|
+
className: (0, tailwind_merge.twMerge)("cpk:w-[11px] cpk:h-[11px] cpk:rounded-full cpk:bg-foreground cpk:animate-pulse-cursor cpk:ml-1", className),
|
|
3677
3932
|
...props
|
|
3678
3933
|
});
|
|
3679
3934
|
};
|
|
@@ -3779,7 +4034,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3779
4034
|
suggestions,
|
|
3780
4035
|
loadingIndexes: suggestionLoadingIndexes,
|
|
3781
4036
|
onSelectSuggestion,
|
|
3782
|
-
className: "mb-3 lg:ml-4 lg:mr-4 ml-0 mr-0"
|
|
4037
|
+
className: "cpk:mb-3 cpk:lg:ml-4 cpk:lg:mr-4 cpk:ml-0 cpk:mr-0"
|
|
3783
4038
|
}) : null;
|
|
3784
4039
|
const BoundScrollView = renderSlot(scrollView, CopilotChatView.ScrollView, {
|
|
3785
4040
|
autoScroll,
|
|
@@ -3788,9 +4043,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3788
4043
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3789
4044
|
style: { paddingBottom: `${inputContainerHeight + FEATHER_HEIGHT + (hasSuggestions ? 4 : 32)}px` },
|
|
3790
4045
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3791
|
-
className: "max-w-3xl mx-auto",
|
|
4046
|
+
className: "cpk:max-w-3xl cpk:mx-auto",
|
|
3792
4047
|
children: [BoundMessageView, hasSuggestions ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3793
|
-
className: "pl-0 pr-4 sm:px-0 mt-4",
|
|
4048
|
+
className: "cpk:pl-0 cpk:pr-4 cpk:sm:px-0 cpk:mt-4",
|
|
3794
4049
|
children: BoundSuggestionView
|
|
3795
4050
|
}) : null]
|
|
3796
4051
|
})
|
|
@@ -3816,19 +4071,25 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3816
4071
|
suggestionView: BoundSuggestionView !== null && BoundSuggestionView !== void 0 ? BoundSuggestionView : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {})
|
|
3817
4072
|
});
|
|
3818
4073
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3819
|
-
|
|
4074
|
+
"data-copilotkit": true,
|
|
4075
|
+
className: (0, tailwind_merge.twMerge)("cpk:relative cpk:h-full cpk:flex cpk:flex-col", className),
|
|
3820
4076
|
...props,
|
|
3821
4077
|
children: BoundWelcomeScreen
|
|
3822
4078
|
});
|
|
3823
4079
|
}
|
|
3824
|
-
if (children) return
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
4080
|
+
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4081
|
+
"data-copilotkit": true,
|
|
4082
|
+
style: { display: "contents" },
|
|
4083
|
+
children: children({
|
|
4084
|
+
messageView: BoundMessageView,
|
|
4085
|
+
input: BoundInput,
|
|
4086
|
+
scrollView: BoundScrollView,
|
|
4087
|
+
suggestionView: BoundSuggestionView !== null && BoundSuggestionView !== void 0 ? BoundSuggestionView : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {})
|
|
4088
|
+
})
|
|
3829
4089
|
});
|
|
3830
4090
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3831
|
-
|
|
4091
|
+
"data-copilotkit": true,
|
|
4092
|
+
className: (0, tailwind_merge.twMerge)("cpk:relative cpk:h-full", className),
|
|
3832
4093
|
...props,
|
|
3833
4094
|
children: [BoundScrollView, BoundInput]
|
|
3834
4095
|
});
|
|
@@ -3839,19 +4100,19 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3839
4100
|
const BoundFeather = renderSlot(feather, CopilotChatView.Feather, {});
|
|
3840
4101
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3841
4102
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(use_stick_to_bottom.StickToBottom.Content, {
|
|
3842
|
-
className: "overflow-y-scroll overflow-x-hidden",
|
|
4103
|
+
className: "cpk:overflow-y-scroll cpk:overflow-x-hidden",
|
|
3843
4104
|
style: {
|
|
3844
4105
|
flex: "1 1 0%",
|
|
3845
4106
|
minHeight: 0
|
|
3846
4107
|
},
|
|
3847
4108
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3848
|
-
className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6",
|
|
4109
|
+
className: "cpk:px-4 cpk:sm:px-0 cpk:[div[data-sidebar-chat]_&]:px-8 cpk:[div[data-popup-chat]_&]:px-6",
|
|
3849
4110
|
children
|
|
3850
4111
|
})
|
|
3851
4112
|
}),
|
|
3852
4113
|
BoundFeather,
|
|
3853
4114
|
!isAtBottom && !isResizing && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3854
|
-
className: "absolute inset-x-0 flex justify-center z-30 pointer-events-none",
|
|
4115
|
+
className: "cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30 cpk:pointer-events-none",
|
|
3855
4116
|
style: { bottom: `${inputContainerHeight + FEATHER_HEIGHT + 16}px` },
|
|
3856
4117
|
children: renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, { onClick: () => scrollToBottom() })
|
|
3857
4118
|
})
|
|
@@ -3881,9 +4142,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3881
4142
|
};
|
|
3882
4143
|
}, [scrollRef, autoScroll]);
|
|
3883
4144
|
if (!hasMounted) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3884
|
-
className: "h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden",
|
|
4145
|
+
className: "cpk:h-full cpk:max-h-full cpk:flex cpk:flex-col cpk:min-h-0 cpk:overflow-y-scroll cpk:overflow-x-hidden",
|
|
3885
4146
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3886
|
-
className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6",
|
|
4147
|
+
className: "cpk:px-4 cpk:sm:px-0 cpk:[div[data-sidebar-chat]_&]:px-8 cpk:[div[data-popup-chat]_&]:px-6",
|
|
3887
4148
|
children
|
|
3888
4149
|
})
|
|
3889
4150
|
});
|
|
@@ -3891,17 +4152,17 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3891
4152
|
const BoundFeather = renderSlot(feather, CopilotChatView.Feather, {});
|
|
3892
4153
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3893
4154
|
ref: scrollRef,
|
|
3894
|
-
className: cn("h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden relative", className),
|
|
4155
|
+
className: cn("cpk:h-full cpk:max-h-full cpk:flex cpk:flex-col cpk:min-h-0 cpk:overflow-y-scroll cpk:overflow-x-hidden cpk:relative", className),
|
|
3895
4156
|
...props,
|
|
3896
4157
|
children: [
|
|
3897
4158
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3898
4159
|
ref: contentRef,
|
|
3899
|
-
className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6",
|
|
4160
|
+
className: "cpk:px-4 cpk:sm:px-0 cpk:[div[data-sidebar-chat]_&]:px-8 cpk:[div[data-popup-chat]_&]:px-6",
|
|
3900
4161
|
children
|
|
3901
4162
|
}),
|
|
3902
4163
|
BoundFeather,
|
|
3903
4164
|
showScrollButton && !isResizing && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3904
|
-
className: "absolute inset-x-0 flex justify-center z-30 pointer-events-none",
|
|
4165
|
+
className: "cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30 cpk:pointer-events-none",
|
|
3905
4166
|
style: { bottom: `${inputContainerHeight + FEATHER_HEIGHT + 16}px` },
|
|
3906
4167
|
children: renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, { onClick: () => scrollToBottom() })
|
|
3907
4168
|
})
|
|
@@ -3909,7 +4170,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3909
4170
|
});
|
|
3910
4171
|
}
|
|
3911
4172
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(use_stick_to_bottom.StickToBottom, {
|
|
3912
|
-
className: cn("h-full max-h-full flex flex-col min-h-0 relative", className),
|
|
4173
|
+
className: cn("cpk:h-full cpk:max-h-full cpk:flex cpk:flex-col cpk:min-h-0 cpk:relative", className),
|
|
3913
4174
|
resize: "smooth",
|
|
3914
4175
|
initial: "smooth",
|
|
3915
4176
|
...props,
|
|
@@ -3925,12 +4186,12 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3925
4186
|
_CopilotChatView.ScrollToBottomButton = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
3926
4187
|
variant: "outline",
|
|
3927
4188
|
size: "sm",
|
|
3928
|
-
className: (0, tailwind_merge.twMerge)("rounded-full w-10 h-10 p-0 pointer-events-auto", "bg-white dark:bg-gray-900", "shadow-lg border border-gray-200 dark:border-gray-700", "hover:bg-gray-50 dark:hover:bg-gray-800", "flex items-center justify-center cursor-pointer", className),
|
|
4189
|
+
className: (0, tailwind_merge.twMerge)("cpk:rounded-full cpk:w-10 cpk:h-10 cpk:p-0 cpk:pointer-events-auto", "cpk:bg-white cpk:dark:bg-gray-900", "cpk:shadow-lg cpk:border cpk:border-gray-200 cpk:dark:border-gray-700", "cpk:hover:bg-gray-50 cpk:dark:hover:bg-gray-800", "cpk:flex cpk:items-center cpk:justify-center cpk:cursor-pointer", className),
|
|
3929
4190
|
...props,
|
|
3930
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, { className: "w-4 h-4 text-gray-600 dark:text-white" })
|
|
4191
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, { className: "cpk:w-4 cpk:h-4 cpk:text-gray-600 cpk:dark:text-white" })
|
|
3931
4192
|
});
|
|
3932
4193
|
_CopilotChatView.Feather = ({ className, style, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3933
|
-
className: cn("absolute bottom-0 left-0 right-4 h-24 pointer-events-none z-10 bg-gradient-to-t", "from-white via-white to-transparent", "dark:from-[rgb(33,33,33)] dark:via-[rgb(33,33,33)]", className),
|
|
4194
|
+
className: cn("cpk:absolute cpk:bottom-0 cpk:left-0 cpk:right-4 cpk:h-24 cpk:pointer-events-none cpk:z-10 cpk:bg-gradient-to-t", "cpk:from-white cpk:via-white cpk:to-transparent", "cpk:dark:from-[rgb(33,33,33)] cpk:dark:via-[rgb(33,33,33)]", className),
|
|
3934
4195
|
style,
|
|
3935
4196
|
...props
|
|
3936
4197
|
});
|
|
@@ -3939,36 +4200,40 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3939
4200
|
const config = useCopilotChatConfiguration();
|
|
3940
4201
|
const labels = (_config$labels = config === null || config === void 0 ? void 0 : config.labels) !== null && _config$labels !== void 0 ? _config$labels : CopilotChatDefaultLabels;
|
|
3941
4202
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
3942
|
-
className: cn("text-xl sm:text-2xl font-medium text-foreground text-center", className),
|
|
4203
|
+
className: cn("cpk:text-xl cpk:sm:text-2xl cpk:font-medium cpk:text-foreground cpk:text-center", className),
|
|
3943
4204
|
...props,
|
|
3944
4205
|
children: labels.welcomeMessageText
|
|
3945
4206
|
});
|
|
3946
4207
|
};
|
|
3947
4208
|
_CopilotChatView.WelcomeScreen = ({ welcomeMessage, input, suggestionView, className, children, ...props }) => {
|
|
3948
4209
|
const BoundWelcomeMessage = renderSlot(welcomeMessage, CopilotChatView.WelcomeMessage, {});
|
|
3949
|
-
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
4210
|
+
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4211
|
+
"data-copilotkit": true,
|
|
4212
|
+
style: { display: "contents" },
|
|
4213
|
+
children: children({
|
|
4214
|
+
welcomeMessage: BoundWelcomeMessage,
|
|
4215
|
+
input,
|
|
4216
|
+
suggestionView,
|
|
4217
|
+
className,
|
|
4218
|
+
...props
|
|
4219
|
+
})
|
|
4220
|
+
});
|
|
3956
4221
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3957
|
-
className: cn("flex-1 flex flex-col items-center justify-center px-4", className),
|
|
4222
|
+
className: cn("cpk:flex-1 cpk:flex cpk:flex-col cpk:items-center cpk:justify-center cpk:px-4", className),
|
|
3958
4223
|
...props,
|
|
3959
4224
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3960
|
-
className: "w-full max-w-3xl flex flex-col items-center",
|
|
4225
|
+
className: "cpk:w-full cpk:max-w-3xl cpk:flex cpk:flex-col cpk:items-center",
|
|
3961
4226
|
children: [
|
|
3962
4227
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3963
|
-
className: "mb-6",
|
|
4228
|
+
className: "cpk:mb-6",
|
|
3964
4229
|
children: BoundWelcomeMessage
|
|
3965
4230
|
}),
|
|
3966
4231
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3967
|
-
className: "w-full",
|
|
4232
|
+
className: "cpk:w-full",
|
|
3968
4233
|
children: input
|
|
3969
4234
|
}),
|
|
3970
4235
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3971
|
-
className: "mt-4 flex justify-center",
|
|
4236
|
+
className: "cpk:mt-4 cpk:flex cpk:justify-center",
|
|
3972
4237
|
children: suggestionView
|
|
3973
4238
|
})
|
|
3974
4239
|
]
|
|
@@ -4282,21 +4547,21 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4282
4547
|
//#endregion
|
|
4283
4548
|
//#region src/components/chat/CopilotChatToggleButton.tsx
|
|
4284
4549
|
const DefaultOpenIcon = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.MessageCircle, {
|
|
4285
|
-
className: cn("h-6 w-6", className),
|
|
4550
|
+
className: cn("cpk:h-6 cpk:w-6", className),
|
|
4286
4551
|
strokeWidth: 1.75,
|
|
4287
4552
|
fill: "currentColor",
|
|
4288
4553
|
...props
|
|
4289
4554
|
});
|
|
4290
4555
|
const DefaultCloseIcon = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, {
|
|
4291
|
-
className: cn("h-6 w-6", className),
|
|
4556
|
+
className: cn("cpk:h-6 cpk:w-6", className),
|
|
4292
4557
|
strokeWidth: 1.75,
|
|
4293
4558
|
...props
|
|
4294
4559
|
});
|
|
4295
4560
|
DefaultOpenIcon.displayName = "CopilotChatToggleButton.OpenIcon";
|
|
4296
4561
|
DefaultCloseIcon.displayName = "CopilotChatToggleButton.CloseIcon";
|
|
4297
4562
|
const ICON_TRANSITION_STYLE = Object.freeze({ transition: "opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)" });
|
|
4298
|
-
const ICON_WRAPPER_BASE = "pointer-events-none absolute inset-0 flex items-center justify-center will-change-transform";
|
|
4299
|
-
const BUTTON_BASE_CLASSES = cn("fixed bottom-6 right-6 z-[1100] flex h-14 w-14 items-center justify-center", "rounded-full border border-primary bg-primary text-primary-foreground", "shadow-sm transition-all duration-200 ease-out", "hover:scale-[1.04] hover:shadow-md", "cursor-pointer", "active:scale-[0.96]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:pointer-events-none disabled:opacity-60");
|
|
4563
|
+
const ICON_WRAPPER_BASE = "cpk:pointer-events-none cpk:absolute cpk:inset-0 cpk:flex cpk:items-center cpk:justify-center cpk:will-change-transform";
|
|
4564
|
+
const BUTTON_BASE_CLASSES = cn("cpk:fixed cpk:bottom-6 cpk:right-6 cpk:z-[1100] cpk:flex cpk:h-14 cpk:w-14 cpk:items-center cpk:justify-center", "cpk:rounded-full cpk:border cpk:border-primary cpk:bg-primary cpk:text-primary-foreground", "cpk:shadow-sm cpk:transition-all cpk:duration-200 cpk:ease-out", "cpk:hover:scale-[1.04] cpk:hover:shadow-md", "cpk:cursor-pointer", "cpk:active:scale-[0.96]", "cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-primary/50 cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background", "cpk:disabled:pointer-events-none cpk:disabled:opacity-60");
|
|
4300
4565
|
const CopilotChatToggleButton = react.default.forwardRef(function CopilotChatToggleButton({ openIcon, closeIcon, className, ...buttonProps }, ref) {
|
|
4301
4566
|
var _configuration$labels, _configuration$isModa, _configuration$setMod;
|
|
4302
4567
|
const { onClick, type, disabled, ...restProps } = buttonProps;
|
|
@@ -4312,12 +4577,12 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4312
4577
|
setModalOpen(!isOpen);
|
|
4313
4578
|
};
|
|
4314
4579
|
const renderedOpenIcon = renderSlot(openIcon, DefaultOpenIcon, {
|
|
4315
|
-
className: "h-6 w-6",
|
|
4580
|
+
className: "cpk:h-6 cpk:w-6",
|
|
4316
4581
|
"aria-hidden": true,
|
|
4317
4582
|
focusable: false
|
|
4318
4583
|
});
|
|
4319
4584
|
const renderedCloseIcon = renderSlot(closeIcon, DefaultCloseIcon, {
|
|
4320
|
-
className: "h-6 w-6",
|
|
4585
|
+
className: "cpk:h-6 cpk:w-6",
|
|
4321
4586
|
"aria-hidden": true,
|
|
4322
4587
|
focusable: false
|
|
4323
4588
|
});
|
|
@@ -4346,6 +4611,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4346
4611
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
4347
4612
|
ref,
|
|
4348
4613
|
type: type !== null && type !== void 0 ? type : "button",
|
|
4614
|
+
"data-copilotkit": true,
|
|
4349
4615
|
"data-slot": "chat-toggle-button",
|
|
4350
4616
|
"data-state": isOpen ? "open" : "closed",
|
|
4351
4617
|
className: cn(BUTTON_BASE_CLASSES, className),
|
|
@@ -4380,21 +4646,21 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4380
4646
|
});
|
|
4381
4647
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
|
|
4382
4648
|
"data-slot": "copilot-modal-header",
|
|
4383
|
-
className: cn("flex items-center justify-between border-b border-border px-4 py-4", "bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80", className),
|
|
4649
|
+
className: cn("cpk:flex cpk:items-center cpk:justify-between cpk:border-b cpk:border-border cpk:px-4 cpk:py-4", "cpk:bg-background/95 cpk:backdrop-blur cpk:supports-[backdrop-filter]:bg-background/80", className),
|
|
4384
4650
|
...rest,
|
|
4385
4651
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4386
|
-
className: "flex w-full items-center gap-2",
|
|
4652
|
+
className: "cpk:flex cpk:w-full cpk:items-center cpk:gap-2",
|
|
4387
4653
|
children: [
|
|
4388
4654
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4389
|
-
className: "flex-1",
|
|
4655
|
+
className: "cpk:flex-1",
|
|
4390
4656
|
"aria-hidden": "true"
|
|
4391
4657
|
}),
|
|
4392
4658
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4393
|
-
className: "flex flex-1 justify-center text-center",
|
|
4659
|
+
className: "cpk:flex cpk:flex-1 cpk:justify-center cpk:text-center",
|
|
4394
4660
|
children: BoundTitle
|
|
4395
4661
|
}),
|
|
4396
4662
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4397
|
-
className: "flex flex-1 justify-end",
|
|
4663
|
+
className: "cpk:flex cpk:flex-1 cpk:justify-end",
|
|
4398
4664
|
children: BoundCloseButton
|
|
4399
4665
|
})
|
|
4400
4666
|
]
|
|
@@ -4404,17 +4670,17 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4404
4670
|
CopilotModalHeader.displayName = "CopilotModalHeader";
|
|
4405
4671
|
(function(_CopilotModalHeader) {
|
|
4406
4672
|
_CopilotModalHeader.Title = ({ children, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4407
|
-
className: cn("w-full text-base font-medium leading-none tracking-tight text-foreground", className),
|
|
4673
|
+
className: cn("cpk:w-full cpk:text-base cpk:font-medium cpk:leading-none cpk:tracking-tight cpk:text-foreground", className),
|
|
4408
4674
|
...props,
|
|
4409
4675
|
children
|
|
4410
4676
|
});
|
|
4411
4677
|
_CopilotModalHeader.CloseButton = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4412
4678
|
type: "button",
|
|
4413
|
-
className: cn("inline-flex size-8 items-center justify-center rounded-full text-muted-foreground transition cursor-pointer", "hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className),
|
|
4679
|
+
className: cn("cpk:inline-flex cpk:size-8 cpk:items-center cpk:justify-center cpk:rounded-full cpk:text-muted-foreground cpk:transition cpk:cursor-pointer", "cpk:hover:bg-muted cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring", className),
|
|
4414
4680
|
"aria-label": "Close",
|
|
4415
4681
|
...props,
|
|
4416
4682
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, {
|
|
4417
|
-
className: "h-4 w-4",
|
|
4683
|
+
className: "cpk:h-4 cpk:w-4",
|
|
4418
4684
|
"aria-hidden": "true"
|
|
4419
4685
|
})
|
|
4420
4686
|
});
|
|
@@ -4468,63 +4734,74 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4468
4734
|
window.addEventListener("resize", updateWidth);
|
|
4469
4735
|
return () => window.removeEventListener("resize", updateWidth);
|
|
4470
4736
|
}, [width]);
|
|
4737
|
+
const hasMounted = (0, react.useRef)(false);
|
|
4738
|
+
(0, react.useLayoutEffect)(() => {
|
|
4739
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
4740
|
+
if (!window.matchMedia("(min-width: 768px)").matches) return;
|
|
4741
|
+
if (isSidebarOpen) {
|
|
4742
|
+
if (hasMounted.current) document.body.style.transition = `margin-inline-end ${SIDEBAR_TRANSITION_MS}ms ease`;
|
|
4743
|
+
document.body.style.marginInlineEnd = widthToMargin(sidebarWidth);
|
|
4744
|
+
} else if (hasMounted.current) {
|
|
4745
|
+
document.body.style.transition = `margin-inline-end ${SIDEBAR_TRANSITION_MS}ms ease`;
|
|
4746
|
+
document.body.style.marginInlineEnd = "";
|
|
4747
|
+
}
|
|
4748
|
+
hasMounted.current = true;
|
|
4749
|
+
return () => {
|
|
4750
|
+
document.body.style.marginInlineEnd = "";
|
|
4751
|
+
document.body.style.transition = "";
|
|
4752
|
+
};
|
|
4753
|
+
}, [isSidebarOpen, sidebarWidth]);
|
|
4471
4754
|
const headerElement = renderSlot(header, CopilotModalHeader, {});
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
"aria-label": "Copilot chat sidebar",
|
|
4493
|
-
role: "complementary",
|
|
4494
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4495
|
-
className: "flex h-full w-full flex-col overflow-hidden",
|
|
4496
|
-
children: [headerElement, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4497
|
-
className: "flex-1 overflow-hidden",
|
|
4498
|
-
"data-sidebar-chat": true,
|
|
4499
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatView_default, { ...props })
|
|
4500
|
-
})]
|
|
4501
|
-
})
|
|
4755
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderSlot(toggleButton, CopilotChatToggleButton, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
|
|
4756
|
+
ref: sidebarRef,
|
|
4757
|
+
"data-copilotkit": true,
|
|
4758
|
+
"data-copilot-sidebar": true,
|
|
4759
|
+
className: cn("cpk:fixed cpk:right-0 cpk:top-0 cpk:z-[1200] cpk:flex", "cpk:h-[100vh] cpk:h-[100dvh] cpk:max-h-screen", "cpk:w-full", "cpk:border-l cpk:border-border cpk:bg-background cpk:text-foreground cpk:shadow-xl", "cpk:transition-transform cpk:duration-300 cpk:ease-out", isSidebarOpen ? "cpk:translate-x-0" : "cpk:translate-x-full cpk:pointer-events-none"),
|
|
4760
|
+
style: {
|
|
4761
|
+
["--sidebar-width"]: widthToCss(sidebarWidth),
|
|
4762
|
+
paddingTop: "env(safe-area-inset-top)",
|
|
4763
|
+
paddingBottom: "env(safe-area-inset-bottom)"
|
|
4764
|
+
},
|
|
4765
|
+
"aria-hidden": !isSidebarOpen,
|
|
4766
|
+
"aria-label": "Copilot chat sidebar",
|
|
4767
|
+
role: "complementary",
|
|
4768
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4769
|
+
className: "cpk:flex cpk:h-full cpk:w-full cpk:flex-col cpk:overflow-hidden",
|
|
4770
|
+
children: [headerElement, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4771
|
+
className: "cpk:flex-1 cpk:overflow-hidden",
|
|
4772
|
+
"data-sidebar-chat": true,
|
|
4773
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatView_default, { ...props })
|
|
4774
|
+
})]
|
|
4502
4775
|
})
|
|
4503
|
-
] });
|
|
4776
|
+
})] });
|
|
4504
4777
|
}
|
|
4505
4778
|
CopilotSidebarView.displayName = "CopilotSidebarView";
|
|
4506
4779
|
(function(_CopilotSidebarView) {
|
|
4507
4780
|
_CopilotSidebarView.WelcomeScreen = ({ welcomeMessage, input, suggestionView, className, children, ...props }) => {
|
|
4508
4781
|
const BoundWelcomeMessage = renderSlot(welcomeMessage, CopilotChatView_default.WelcomeMessage, {});
|
|
4509
|
-
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4782
|
+
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4783
|
+
"data-copilotkit": true,
|
|
4784
|
+
style: { display: "contents" },
|
|
4785
|
+
children: children({
|
|
4786
|
+
welcomeMessage: BoundWelcomeMessage,
|
|
4787
|
+
input,
|
|
4788
|
+
suggestionView,
|
|
4789
|
+
className,
|
|
4790
|
+
...props
|
|
4791
|
+
})
|
|
4792
|
+
});
|
|
4516
4793
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4517
|
-
className: cn("h-full flex flex-col", className),
|
|
4794
|
+
className: cn("cpk:h-full cpk:flex cpk:flex-col", className),
|
|
4518
4795
|
...props,
|
|
4519
4796
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4520
|
-
className: "flex-1 flex flex-col items-center justify-center px-4",
|
|
4797
|
+
className: "cpk:flex-1 cpk:flex cpk:flex-col cpk:items-center cpk:justify-center cpk:px-4",
|
|
4521
4798
|
children: BoundWelcomeMessage
|
|
4522
4799
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4523
|
-
className: "px-8 pb-4",
|
|
4800
|
+
className: "cpk:px-8 cpk:pb-4",
|
|
4524
4801
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4525
|
-
className: "max-w-3xl mx-auto",
|
|
4802
|
+
className: "cpk:max-w-3xl cpk:mx-auto",
|
|
4526
4803
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4527
|
-
className: "mb-4 flex justify-center",
|
|
4804
|
+
className: "cpk:mb-4 cpk:flex cpk:justify-center",
|
|
4528
4805
|
children: suggestionView
|
|
4529
4806
|
}), input]
|
|
4530
4807
|
})
|
|
@@ -4632,23 +4909,24 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4632
4909
|
paddingLeft: "env(safe-area-inset-left)",
|
|
4633
4910
|
paddingRight: "env(safe-area-inset-right)"
|
|
4634
4911
|
}), [resolvedHeight, resolvedWidth]);
|
|
4635
|
-
const popupAnimationClass = isPopupOpen && !isAnimatingOut ? "pointer-events-auto translate-y-0 opacity-100 md:scale-100" : "pointer-events-none translate-y-4 opacity-0 md:translate-y-5 md:scale-[0.95]";
|
|
4912
|
+
const popupAnimationClass = isPopupOpen && !isAnimatingOut ? "cpk:pointer-events-auto cpk:translate-y-0 cpk:opacity-100 cpk:md:scale-100" : "cpk:pointer-events-none cpk:translate-y-4 cpk:opacity-0 cpk:md:translate-y-5 cpk:md:scale-[0.95]";
|
|
4636
4913
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [toggleButtonElement, isRendered ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4637
|
-
|
|
4914
|
+
"data-copilotkit": true,
|
|
4915
|
+
className: cn("cpk:fixed cpk:inset-0 cpk:z-[1200] cpk:flex cpk:max-w-full cpk:flex-col cpk:items-stretch", "cpk:md:inset-auto cpk:md:bottom-24 cpk:md:right-6 cpk:md:items-end cpk:md:gap-4"),
|
|
4638
4916
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4639
4917
|
ref: containerRef,
|
|
4640
4918
|
tabIndex: -1,
|
|
4641
4919
|
role: "dialog",
|
|
4642
4920
|
"aria-label": labels.modalHeaderTitle,
|
|
4643
4921
|
"data-copilot-popup": true,
|
|
4644
|
-
className: cn("relative flex h-full w-full flex-col overflow-hidden bg-background text-foreground", "origin-bottom focus:outline-none transform-gpu transition-transform transition-opacity duration-200 ease-out", "md:transition-transform md:transition-opacity", "rounded-none border border-border/0 shadow-none ring-0", "md:h-[var(--copilot-popup-height)] md:w-[var(--copilot-popup-width)]", "md:max-h-[var(--copilot-popup-max-height)] md:max-w-[var(--copilot-popup-max-width)]", "md:origin-bottom-right md:rounded-2xl md:border-border md:shadow-xl md:ring-1 md:ring-border/40", popupAnimationClass),
|
|
4922
|
+
className: cn("cpk:relative cpk:flex cpk:h-full cpk:w-full cpk:flex-col cpk:overflow-hidden cpk:bg-background cpk:text-foreground", "cpk:origin-bottom cpk:focus:outline-none cpk:transform-gpu cpk:transition-transform cpk:transition-opacity cpk:duration-200 cpk:ease-out", "cpk:md:transition-transform cpk:md:transition-opacity", "cpk:rounded-none cpk:border cpk:border-border/0 cpk:shadow-none cpk:ring-0", "cpk:md:h-[var(--copilot-popup-height)] cpk:md:w-[var(--copilot-popup-width)]", "cpk:md:max-h-[var(--copilot-popup-max-height)] cpk:md:max-w-[var(--copilot-popup-max-width)]", "cpk:md:origin-bottom-right cpk:md:rounded-2xl cpk:md:border-border cpk:md:shadow-xl cpk:md:ring-1 cpk:md:ring-border/40", popupAnimationClass),
|
|
4645
4923
|
style: popupStyle,
|
|
4646
4924
|
children: [headerElement, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4647
|
-
className: "flex-1 overflow-hidden",
|
|
4925
|
+
className: "cpk:flex-1 cpk:overflow-hidden",
|
|
4648
4926
|
"data-popup-chat": true,
|
|
4649
4927
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatView_default, {
|
|
4650
4928
|
...restProps,
|
|
4651
|
-
className: cn("h-full min-h-0", className)
|
|
4929
|
+
className: cn("cpk:h-full cpk:min-h-0", className)
|
|
4652
4930
|
})
|
|
4653
4931
|
})]
|
|
4654
4932
|
})
|
|
@@ -4658,21 +4936,25 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4658
4936
|
(function(_CopilotPopupView) {
|
|
4659
4937
|
_CopilotPopupView.WelcomeScreen = ({ welcomeMessage, input, suggestionView, className, children, ...props }) => {
|
|
4660
4938
|
const BoundWelcomeMessage = renderSlot(welcomeMessage, CopilotChatView_default.WelcomeMessage, {});
|
|
4661
|
-
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4939
|
+
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4940
|
+
"data-copilotkit": true,
|
|
4941
|
+
style: { display: "contents" },
|
|
4942
|
+
children: children({
|
|
4943
|
+
welcomeMessage: BoundWelcomeMessage,
|
|
4944
|
+
input,
|
|
4945
|
+
suggestionView,
|
|
4946
|
+
className,
|
|
4947
|
+
...props
|
|
4948
|
+
})
|
|
4949
|
+
});
|
|
4668
4950
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4669
|
-
className: cn("h-full flex flex-col", className),
|
|
4951
|
+
className: cn("cpk:h-full cpk:flex cpk:flex-col", className),
|
|
4670
4952
|
...props,
|
|
4671
4953
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4672
|
-
className: "flex-1 flex flex-col items-center justify-center px-4",
|
|
4954
|
+
className: "cpk:flex-1 cpk:flex cpk:flex-col cpk:items-center cpk:justify-center cpk:px-4",
|
|
4673
4955
|
children: BoundWelcomeMessage
|
|
4674
4956
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4675
|
-
className: "mb-4 flex justify-center px-4",
|
|
4957
|
+
className: "cpk:mb-4 cpk:flex cpk:justify-center cpk:px-4",
|
|
4676
4958
|
children: suggestionView
|
|
4677
4959
|
}), input] })]
|
|
4678
4960
|
});
|
|
@@ -4750,17 +5032,17 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4750
5032
|
const [isExpanded, setIsExpanded] = (0, react.useState)(false);
|
|
4751
5033
|
const statusString = String(status);
|
|
4752
5034
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4753
|
-
className: "mt-2 pb-2",
|
|
5035
|
+
className: "cpk:mt-2 cpk:pb-2",
|
|
4754
5036
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4755
|
-
className: "rounded-xl border border-zinc-200/60 dark:border-zinc-800/60 bg-white/70 dark:bg-zinc-900/50 shadow-sm backdrop-blur p-4",
|
|
5037
|
+
className: "cpk:rounded-xl cpk:border cpk:border-zinc-200/60 cpk:dark:border-zinc-800/60 cpk:bg-white/70 cpk:dark:bg-zinc-900/50 cpk:shadow-sm cpk:backdrop-blur cpk:p-4",
|
|
4756
5038
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4757
|
-
className: "flex items-center justify-between gap-3 cursor-pointer",
|
|
5039
|
+
className: "cpk:flex cpk:items-center cpk:justify-between cpk:gap-3 cpk:cursor-pointer",
|
|
4758
5040
|
onClick: () => setIsExpanded(!isExpanded),
|
|
4759
5041
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4760
|
-
className: "flex items-center gap-2 min-w-0",
|
|
5042
|
+
className: "cpk:flex cpk:items-center cpk:gap-2 cpk:min-w-0",
|
|
4761
5043
|
children: [
|
|
4762
5044
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
4763
|
-
className: `h-4 w-4 text-zinc-500 dark:text-zinc-400 transition-transform ${isExpanded ? "rotate-90" : ""}`,
|
|
5045
|
+
className: `cpk:h-4 cpk:w-4 cpk:text-zinc-500 cpk:dark:text-zinc-400 cpk:transition-transform ${isExpanded ? "cpk:rotate-90" : ""}`,
|
|
4764
5046
|
fill: "none",
|
|
4765
5047
|
viewBox: "0 0 24 24",
|
|
4766
5048
|
strokeWidth: 2,
|
|
@@ -4771,29 +5053,29 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4771
5053
|
d: "M8.25 4.5l7.5 7.5-7.5 7.5"
|
|
4772
5054
|
})
|
|
4773
5055
|
}),
|
|
4774
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
|
|
5056
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "cpk:inline-block cpk:h-2 cpk:w-2 cpk:rounded-full cpk:bg-blue-500" }),
|
|
4775
5057
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4776
|
-
className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100",
|
|
5058
|
+
className: "cpk:truncate cpk:text-sm cpk:font-medium cpk:text-zinc-900 cpk:dark:text-zinc-100",
|
|
4777
5059
|
children: name
|
|
4778
5060
|
})
|
|
4779
5061
|
]
|
|
4780
5062
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4781
|
-
className: `inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${statusString === "inProgress" || statusString === "executing" ? "bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-400" : statusString === "complete" ? "bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-400" : "bg-zinc-100 text-zinc-800 dark:bg-zinc-700/40 dark:text-zinc-300"}`,
|
|
5063
|
+
className: `cpk:inline-flex cpk:items-center cpk:rounded-full cpk:px-2 cpk:py-1 cpk:text-xs cpk:font-medium ${statusString === "inProgress" || statusString === "executing" ? "cpk:bg-amber-100 cpk:text-amber-800 cpk:dark:bg-amber-500/15 cpk:dark:text-amber-400" : statusString === "complete" ? "cpk:bg-emerald-100 cpk:text-emerald-800 cpk:dark:bg-emerald-500/15 cpk:dark:text-emerald-400" : "cpk:bg-zinc-100 cpk:text-zinc-800 cpk:dark:bg-zinc-700/40 cpk:dark:text-zinc-300"}`,
|
|
4782
5064
|
children: String(status)
|
|
4783
5065
|
})]
|
|
4784
5066
|
}), isExpanded && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4785
|
-
className: "mt-3 grid gap-4",
|
|
5067
|
+
className: "cpk:mt-3 cpk:grid cpk:gap-4",
|
|
4786
5068
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4787
|
-
className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400",
|
|
5069
|
+
className: "cpk:text-xs cpk:uppercase cpk:tracking-wide cpk:text-zinc-500 cpk:dark:text-zinc-400",
|
|
4788
5070
|
children: "Arguments"
|
|
4789
5071
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
4790
|
-
className: "mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words",
|
|
5072
|
+
className: "cpk:mt-2 cpk:max-h-64 cpk:overflow-auto cpk:rounded-md cpk:bg-zinc-50 cpk:dark:bg-zinc-800/60 cpk:p-3 cpk:text-xs cpk:leading-relaxed cpk:text-zinc-800 cpk:dark:text-zinc-200 cpk:whitespace-pre-wrap cpk:break-words",
|
|
4791
5073
|
children: JSON.stringify(args !== null && args !== void 0 ? args : {}, null, 2)
|
|
4792
5074
|
})] }), result !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4793
|
-
className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400",
|
|
5075
|
+
className: "cpk:text-xs cpk:uppercase cpk:tracking-wide cpk:text-zinc-500 cpk:dark:text-zinc-400",
|
|
4794
5076
|
children: "Result"
|
|
4795
5077
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
4796
|
-
className: "mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words",
|
|
5078
|
+
className: "cpk:mt-2 cpk:max-h-64 cpk:overflow-auto cpk:rounded-md cpk:bg-zinc-50 cpk:dark:bg-zinc-800/60 cpk:p-3 cpk:text-xs cpk:leading-relaxed cpk:text-zinc-800 cpk:dark:text-zinc-200 cpk:whitespace-pre-wrap cpk:break-words",
|
|
4797
5079
|
children: typeof result === "string" ? result : JSON.stringify(result, null, 2)
|
|
4798
5080
|
})] })]
|
|
4799
5081
|
})]
|
|
@@ -4862,6 +5144,7 @@ exports.useCopilotKit = useCopilotKit;
|
|
|
4862
5144
|
exports.useDefaultRenderTool = useDefaultRenderTool;
|
|
4863
5145
|
exports.useFrontendTool = useFrontendTool;
|
|
4864
5146
|
exports.useHumanInTheLoop = useHumanInTheLoop;
|
|
5147
|
+
exports.useInterrupt = useInterrupt;
|
|
4865
5148
|
exports.useRenderActivityMessage = useRenderActivityMessage;
|
|
4866
5149
|
exports.useRenderCustomMessages = useRenderCustomMessages;
|
|
4867
5150
|
exports.useRenderTool = useRenderTool;
|