@copilotkit/react-ui 1.8.0-next.3 → 1.8.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/{chunk-LXCH2BIB.mjs → chunk-6H7IQRIU.mjs} +2 -2
- package/dist/{chunk-KG6DW6R2.mjs → chunk-DFHFPZQD.mjs} +7 -7
- package/dist/{chunk-LKCAF2HG.mjs → chunk-FFNESJSG.mjs} +2 -2
- package/dist/{chunk-QGK5GOSC.mjs → chunk-GBXUOB6L.mjs} +8 -8
- package/dist/{chunk-2LRE4W6A.mjs → chunk-LYHZXHTJ.mjs} +3 -2
- package/dist/{chunk-2LRE4W6A.mjs.map → chunk-LYHZXHTJ.mjs.map} +1 -1
- package/dist/chunk-MMVDU6DF.mjs +1 -0
- package/dist/{chunk-GDJAAFIK.mjs → chunk-QS7UFQFD.mjs} +2 -2
- package/dist/{chunk-5GNYGURH.mjs → chunk-Z6YOBQUJ.mjs} +8 -8
- package/dist/components/chat/Chat.js +2 -1
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +4 -4
- package/dist/components/chat/Header.mjs +4 -4
- package/dist/components/chat/Input.js +2 -1
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +1 -1
- package/dist/components/chat/Modal.js +2 -1
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +9 -9
- package/dist/components/chat/Popup.js +2 -1
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +10 -10
- package/dist/components/chat/Sidebar.js +2 -1
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +10 -10
- package/dist/components/chat/index.js +2 -1
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +13 -13
- package/dist/components/dev-console/console.mjs +3 -3
- package/dist/components/dev-console/index.mjs +4 -4
- package/dist/components/index.d.ts +0 -3
- package/dist/components/index.js +2 -291
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +15 -27
- package/dist/index.css +64 -42
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +4 -293
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -27
- package/dist/types/css.d.ts +4 -9
- package/dist/types/css.js.map +1 -1
- package/package.json +4 -4
- package/src/components/chat/Input.tsx +6 -1
- package/src/components/index.ts +0 -1
- package/src/css/button.css +1 -1
- package/src/css/colors.css +79 -23
- package/src/css/console.css +1 -1
- package/src/css/header.css +2 -2
- package/src/css/input.css +19 -10
- package/src/css/messages.css +2 -2
- package/src/css/panel.css +1 -1
- package/src/css/suggestions.css +2 -2
- package/src/types/css.ts +4 -9
- package/dist/chunk-EJG6RRSX.mjs +0 -138
- package/dist/chunk-EJG6RRSX.mjs.map +0 -1
- package/dist/chunk-MCO235PS.mjs +0 -164
- package/dist/chunk-MCO235PS.mjs.map +0 -1
- package/dist/chunk-MWC5OV7Z.mjs +0 -1
- package/dist/chunk-N7LTE54T.mjs +0 -1
- package/dist/chunk-N7LTE54T.mjs.map +0 -1
- package/dist/chunk-UCVCAGU7.mjs +0 -1
- package/dist/chunk-UCVCAGU7.mjs.map +0 -1
- package/dist/components/crew/DefaultResponseRenderer.d.ts +0 -110
- package/dist/components/crew/DefaultResponseRenderer.js +0 -175
- package/dist/components/crew/DefaultResponseRenderer.js.map +0 -1
- package/dist/components/crew/DefaultResponseRenderer.mjs +0 -10
- package/dist/components/crew/DefaultResponseRenderer.mjs.map +0 -1
- package/dist/components/crew/DefaultStateRenderer.d.ts +0 -88
- package/dist/components/crew/DefaultStateRenderer.js +0 -198
- package/dist/components/crew/DefaultStateRenderer.js.map +0 -1
- package/dist/components/crew/DefaultStateRenderer.mjs +0 -8
- package/dist/components/crew/DefaultStateRenderer.mjs.map +0 -1
- package/dist/components/crew/index.d.ts +0 -4
- package/dist/components/crew/index.js +0 -335
- package/dist/components/crew/index.js.map +0 -1
- package/dist/components/crew/index.mjs +0 -16
- package/dist/components/crew/index.mjs.map +0 -1
- package/dist/components/crew/types.d.ts +0 -340
- package/dist/components/crew/types.js +0 -19
- package/dist/components/crew/types.js.map +0 -1
- package/dist/components/crew/types.mjs +0 -2
- package/dist/components/crew/types.mjs.map +0 -1
- package/src/components/crew/DefaultResponseRenderer.tsx +0 -298
- package/src/components/crew/DefaultStateRenderer.tsx +0 -326
- package/src/components/crew/index.ts +0 -3
- package/src/components/crew/types.ts +0 -398
- /package/dist/{chunk-LXCH2BIB.mjs.map → chunk-6H7IQRIU.mjs.map} +0 -0
- /package/dist/{chunk-KG6DW6R2.mjs.map → chunk-DFHFPZQD.mjs.map} +0 -0
- /package/dist/{chunk-LKCAF2HG.mjs.map → chunk-FFNESJSG.mjs.map} +0 -0
- /package/dist/{chunk-QGK5GOSC.mjs.map → chunk-GBXUOB6L.mjs.map} +0 -0
- /package/dist/{chunk-MWC5OV7Z.mjs.map → chunk-MMVDU6DF.mjs.map} +0 -0
- /package/dist/{chunk-GDJAAFIK.mjs.map → chunk-QS7UFQFD.mjs.map} +0 -0
- /package/dist/{chunk-5GNYGURH.mjs.map → chunk-Z6YOBQUJ.mjs.map} +0 -0
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import "../../chunk-SQMEPWVT.mjs";
|
|
2
2
|
import {
|
|
3
3
|
CopilotSidebar
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-FFNESJSG.mjs";
|
|
5
5
|
import "../../chunk-WB3YULQ4.mjs";
|
|
6
6
|
import {
|
|
7
7
|
CopilotPopup
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-6H7IQRIU.mjs";
|
|
9
|
+
import "../../chunk-DFHFPZQD.mjs";
|
|
10
10
|
import "../../chunk-CGVOCLHN.mjs";
|
|
11
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-QS7UFQFD.mjs";
|
|
12
12
|
import "../../chunk-V7W6IM2V.mjs";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-GBXUOB6L.mjs";
|
|
14
|
+
import "../../chunk-6TCUJ3B7.mjs";
|
|
14
15
|
import "../../chunk-KXE2JCUH.mjs";
|
|
15
16
|
import "../../chunk-YC4NBUGE.mjs";
|
|
16
|
-
import "../../chunk-OTPAZXVR.mjs";
|
|
17
|
-
import "../../chunk-6TCUJ3B7.mjs";
|
|
18
17
|
import "../../chunk-BH6PCAAL.mjs";
|
|
18
|
+
import "../../chunk-OTPAZXVR.mjs";
|
|
19
19
|
import "../../chunk-VC4NO5QZ.mjs";
|
|
20
20
|
import {
|
|
21
21
|
CopilotChat
|
|
22
|
-
} from "../../chunk-
|
|
23
|
-
import {
|
|
24
|
-
AssistantMessage
|
|
25
|
-
} from "../../chunk-FBYETUFL.mjs";
|
|
26
|
-
import "../../chunk-XB6QCUPB.mjs";
|
|
22
|
+
} from "../../chunk-Z6YOBQUJ.mjs";
|
|
27
23
|
import "../../chunk-UWWMAJ7R.mjs";
|
|
28
24
|
import "../../chunk-WEYDZBT7.mjs";
|
|
29
25
|
import "../../chunk-7RIBDD4K.mjs";
|
|
30
26
|
import {
|
|
31
27
|
UserMessage
|
|
32
28
|
} from "../../chunk-HEIDCT7I.mjs";
|
|
29
|
+
import {
|
|
30
|
+
AssistantMessage
|
|
31
|
+
} from "../../chunk-FBYETUFL.mjs";
|
|
32
|
+
import "../../chunk-XB6QCUPB.mjs";
|
|
33
33
|
import "../../chunk-TOQ7P4DO.mjs";
|
|
34
|
-
import "../../chunk-
|
|
34
|
+
import "../../chunk-LYHZXHTJ.mjs";
|
|
35
35
|
import "../../chunk-YQFVRDNC.mjs";
|
|
36
36
|
import {
|
|
37
37
|
Markdown
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CopilotDevConsole,
|
|
4
4
|
DebugMenuButton
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-GBXUOB6L.mjs";
|
|
6
|
+
import "../../chunk-6TCUJ3B7.mjs";
|
|
6
7
|
import "../../chunk-KXE2JCUH.mjs";
|
|
7
8
|
import "../../chunk-YC4NBUGE.mjs";
|
|
8
|
-
import "../../chunk-OTPAZXVR.mjs";
|
|
9
|
-
import "../../chunk-6TCUJ3B7.mjs";
|
|
10
9
|
import "../../chunk-BH6PCAAL.mjs";
|
|
10
|
+
import "../../chunk-OTPAZXVR.mjs";
|
|
11
11
|
import "../../chunk-ORSMX3SE.mjs";
|
|
12
12
|
import "../../chunk-MRXNTQOX.mjs";
|
|
13
13
|
export {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "../../chunk-V7W6IM2V.mjs";
|
|
2
2
|
import {
|
|
3
3
|
CopilotDevConsole
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-KXE2JCUH.mjs";
|
|
6
|
-
import "../../chunk-YC4NBUGE.mjs";
|
|
7
|
-
import "../../chunk-OTPAZXVR.mjs";
|
|
4
|
+
} from "../../chunk-GBXUOB6L.mjs";
|
|
8
5
|
import {
|
|
9
6
|
shouldShowDevConsole
|
|
10
7
|
} from "../../chunk-6TCUJ3B7.mjs";
|
|
8
|
+
import "../../chunk-KXE2JCUH.mjs";
|
|
9
|
+
import "../../chunk-YC4NBUGE.mjs";
|
|
11
10
|
import "../../chunk-BH6PCAAL.mjs";
|
|
11
|
+
import "../../chunk-OTPAZXVR.mjs";
|
|
12
12
|
import "../../chunk-ORSMX3SE.mjs";
|
|
13
13
|
import "../../chunk-MRXNTQOX.mjs";
|
|
14
14
|
export {
|
|
@@ -8,9 +8,6 @@ export { UserMessage } from './chat/messages/UserMessage.js';
|
|
|
8
8
|
export { useChatContext } from './chat/ChatContext.js';
|
|
9
9
|
export { shouldShowDevConsole } from './dev-console/utils.js';
|
|
10
10
|
export { CopilotDevConsole } from './dev-console/console.js';
|
|
11
|
-
export { DefaultResponseRenderer, createResponseCache } from './crew/DefaultResponseRenderer.js';
|
|
12
|
-
export { DefaultStateRenderer } from './crew/DefaultStateRenderer.js';
|
|
13
|
-
export { AgentState, CompletedFeedbackProps, ContentRendererProps, FeedbackButtonProps, Response, ResponseCache, ResponseRendererIconProps, ResponseRendererIcons, ResponseRendererLabels, ResponseRendererProps, ResponseStatus, SkeletonLoaderProps, StateItem, StateItemRendererProps, StateRendererProps, TaskStateItem, ToolStateItem } from './crew/types.js';
|
|
14
11
|
import '@copilotkit/runtime-client-gql';
|
|
15
12
|
import 'react/jsx-runtime';
|
|
16
13
|
import './chat/Modal.js';
|
package/dist/components/index.js
CHANGED
|
@@ -84,11 +84,8 @@ __export(components_exports, {
|
|
|
84
84
|
CopilotDevConsole: () => CopilotDevConsole,
|
|
85
85
|
CopilotPopup: () => CopilotPopup,
|
|
86
86
|
CopilotSidebar: () => CopilotSidebar,
|
|
87
|
-
DefaultResponseRenderer: () => DefaultResponseRenderer,
|
|
88
|
-
DefaultStateRenderer: () => DefaultStateRenderer,
|
|
89
87
|
Markdown: () => Markdown,
|
|
90
88
|
UserMessage: () => UserMessage,
|
|
91
|
-
createResponseCache: () => createResponseCache,
|
|
92
89
|
shouldShowDevConsole: () => shouldShowDevConsole,
|
|
93
90
|
useChatContext: () => useChatContext
|
|
94
91
|
});
|
|
@@ -1421,7 +1418,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
|
|
|
1421
1418
|
"button",
|
|
1422
1419
|
{
|
|
1423
1420
|
onClick: () => setPushToTalkState(pushToTalkState === "idle" ? "recording" : "transcribing"),
|
|
1424
|
-
className: pushToTalkState === "recording" ? "copilotKitPushToTalkRecording" : "",
|
|
1421
|
+
className: pushToTalkState === "recording" ? "copilotKitInputControlButton copilotKitPushToTalkRecording" : "copilotKitInputControlButton",
|
|
1425
1422
|
children: context.icons.pushToTalkIcon
|
|
1426
1423
|
}
|
|
1427
1424
|
),
|
|
@@ -1432,6 +1429,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
|
|
|
1432
1429
|
onClick: isInProgress ? onStop : send,
|
|
1433
1430
|
"data-copilotkit-in-progress": inProgress,
|
|
1434
1431
|
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
1432
|
+
className: "copilotKitInputControlButton",
|
|
1435
1433
|
children: buttonIcon
|
|
1436
1434
|
}
|
|
1437
1435
|
)
|
|
@@ -2755,290 +2753,6 @@ function CopilotSidebar(props) {
|
|
|
2755
2753
|
};
|
|
2756
2754
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CopilotModal, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
|
|
2757
2755
|
}
|
|
2758
|
-
|
|
2759
|
-
// src/components/crew/DefaultResponseRenderer.tsx
|
|
2760
|
-
var import_react16 = require("react");
|
|
2761
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2762
|
-
var createResponseCache = () => {
|
|
2763
|
-
const responseCache = /* @__PURE__ */ new Map();
|
|
2764
|
-
return {
|
|
2765
|
-
getResponse: (id) => responseCache.get(id),
|
|
2766
|
-
setResponse: (id, response) => responseCache.set(id, response)
|
|
2767
|
-
};
|
|
2768
|
-
};
|
|
2769
|
-
var useResponseCache = createResponseCache();
|
|
2770
|
-
var DefaultExpandIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2771
|
-
"svg",
|
|
2772
|
-
{
|
|
2773
|
-
className,
|
|
2774
|
-
width: "12",
|
|
2775
|
-
height: "12",
|
|
2776
|
-
viewBox: "0 0 24 24",
|
|
2777
|
-
fill: "none",
|
|
2778
|
-
stroke: "currentColor",
|
|
2779
|
-
strokeWidth: "2",
|
|
2780
|
-
strokeLinecap: "round",
|
|
2781
|
-
strokeLinejoin: "round",
|
|
2782
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
2783
|
-
}
|
|
2784
|
-
);
|
|
2785
|
-
var DefaultCollapseIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2786
|
-
"svg",
|
|
2787
|
-
{
|
|
2788
|
-
className,
|
|
2789
|
-
width: "12",
|
|
2790
|
-
height: "12",
|
|
2791
|
-
viewBox: "0 0 24 24",
|
|
2792
|
-
fill: "none",
|
|
2793
|
-
stroke: "currentColor",
|
|
2794
|
-
strokeWidth: "2",
|
|
2795
|
-
strokeLinecap: "round",
|
|
2796
|
-
strokeLinejoin: "round",
|
|
2797
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("polyline", { points: "18 15 12 9 6 15" })
|
|
2798
|
-
}
|
|
2799
|
-
);
|
|
2800
|
-
var DefaultContentRenderer = ({ content, className }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className, children: content });
|
|
2801
|
-
var DefaultFeedbackButton = ({ label, onClick, className }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { onClick, className, children: label });
|
|
2802
|
-
var DefaultCompletedFeedback = ({ message, className }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: message }) });
|
|
2803
|
-
var DefaultResponseRenderer = ({
|
|
2804
|
-
response,
|
|
2805
|
-
status,
|
|
2806
|
-
onRespond,
|
|
2807
|
-
icons,
|
|
2808
|
-
labels,
|
|
2809
|
-
ContentRenderer = DefaultContentRenderer,
|
|
2810
|
-
FeedbackButton = DefaultFeedbackButton,
|
|
2811
|
-
CompletedFeedback = DefaultCompletedFeedback,
|
|
2812
|
-
className = "copilotkit-response",
|
|
2813
|
-
contentClassName = "copilotkit-response-content",
|
|
2814
|
-
actionsClassName = "copilotkit-response-actions",
|
|
2815
|
-
buttonClassName = "copilotkit-response-button",
|
|
2816
|
-
completedFeedbackClassName = "copilotkit-response-completed-feedback"
|
|
2817
|
-
}) => {
|
|
2818
|
-
const [isExpanded, setIsExpanded] = (0, import_react16.useState)(true);
|
|
2819
|
-
const defaultLabels = {
|
|
2820
|
-
responseLabel: "Response",
|
|
2821
|
-
approveLabel: "Approve",
|
|
2822
|
-
rejectLabel: "Reject",
|
|
2823
|
-
approvedMessage: "Approved",
|
|
2824
|
-
rejectedMessage: "Rejected",
|
|
2825
|
-
feedbackSubmittedMessage: "Feedback submitted"
|
|
2826
|
-
};
|
|
2827
|
-
const mergedLabels = __spreadValues(__spreadValues({}, defaultLabels), labels);
|
|
2828
|
-
const renderFeedback = () => {
|
|
2829
|
-
if (status === "complete") {
|
|
2830
|
-
const cachedResponse = useResponseCache.getResponse(response.id);
|
|
2831
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2832
|
-
CompletedFeedback,
|
|
2833
|
-
{
|
|
2834
|
-
message: (cachedResponse == null ? void 0 : cachedResponse.__feedback__) ? cachedResponse.__feedback__ === mergedLabels.approvedMessage ? mergedLabels.approvedMessage : mergedLabels.rejectedMessage : mergedLabels.feedbackSubmittedMessage,
|
|
2835
|
-
className: completedFeedbackClassName
|
|
2836
|
-
}
|
|
2837
|
-
);
|
|
2838
|
-
}
|
|
2839
|
-
if (status === "inProgress" || status === "executing") {
|
|
2840
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
2841
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2842
|
-
FeedbackButton,
|
|
2843
|
-
{
|
|
2844
|
-
label: mergedLabels.approveLabel,
|
|
2845
|
-
onClick: () => {
|
|
2846
|
-
setIsExpanded(false);
|
|
2847
|
-
onRespond == null ? void 0 : onRespond(mergedLabels.approveLabel);
|
|
2848
|
-
useResponseCache.setResponse(response.id, __spreadProps(__spreadValues({}, response), {
|
|
2849
|
-
__feedback__: mergedLabels.approvedMessage
|
|
2850
|
-
}));
|
|
2851
|
-
},
|
|
2852
|
-
className: buttonClassName
|
|
2853
|
-
}
|
|
2854
|
-
),
|
|
2855
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2856
|
-
FeedbackButton,
|
|
2857
|
-
{
|
|
2858
|
-
label: mergedLabels.rejectLabel,
|
|
2859
|
-
onClick: () => {
|
|
2860
|
-
setIsExpanded(false);
|
|
2861
|
-
useResponseCache.setResponse(response.id, __spreadProps(__spreadValues({}, response), {
|
|
2862
|
-
__feedback__: mergedLabels.rejectedMessage
|
|
2863
|
-
}));
|
|
2864
|
-
onRespond == null ? void 0 : onRespond(mergedLabels.rejectLabel);
|
|
2865
|
-
},
|
|
2866
|
-
className: buttonClassName
|
|
2867
|
-
}
|
|
2868
|
-
)
|
|
2869
|
-
] });
|
|
2870
|
-
}
|
|
2871
|
-
return null;
|
|
2872
|
-
};
|
|
2873
|
-
const ExpandIcon = (icons == null ? void 0 : icons.expand) || DefaultExpandIcon;
|
|
2874
|
-
const CollapseIcon = (icons == null ? void 0 : icons.collapse) || DefaultCollapseIcon;
|
|
2875
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className, children: [
|
|
2876
|
-
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ContentRenderer, { content: response.content, className: contentClassName }),
|
|
2877
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: actionsClassName, children: [
|
|
2878
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "copilotkit-response-label", children: [
|
|
2879
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { onClick: () => setIsExpanded(!isExpanded), className: "copilotkit-toggle-button", children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CollapseIcon, { className: "copilotkit-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ExpandIcon, { className: "copilotkit-icon" }) }),
|
|
2880
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: mergedLabels.responseLabel })
|
|
2881
|
-
] }),
|
|
2882
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "copilotkit-response-buttons", children: renderFeedback() })
|
|
2883
|
-
] })
|
|
2884
|
-
] });
|
|
2885
|
-
};
|
|
2886
|
-
|
|
2887
|
-
// src/components/crew/DefaultStateRenderer.tsx
|
|
2888
|
-
var import_react17 = require("react");
|
|
2889
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2890
|
-
var DefaultExpandIcon2 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2891
|
-
"svg",
|
|
2892
|
-
{
|
|
2893
|
-
className,
|
|
2894
|
-
width: "16",
|
|
2895
|
-
height: "16",
|
|
2896
|
-
viewBox: "0 0 24 24",
|
|
2897
|
-
fill: "none",
|
|
2898
|
-
stroke: "currentColor",
|
|
2899
|
-
strokeWidth: "2",
|
|
2900
|
-
strokeLinecap: "round",
|
|
2901
|
-
strokeLinejoin: "round",
|
|
2902
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
2903
|
-
}
|
|
2904
|
-
);
|
|
2905
|
-
var DefaultCollapseIcon2 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2906
|
-
"svg",
|
|
2907
|
-
{
|
|
2908
|
-
className,
|
|
2909
|
-
width: "16",
|
|
2910
|
-
height: "16",
|
|
2911
|
-
viewBox: "0 0 24 24",
|
|
2912
|
-
fill: "none",
|
|
2913
|
-
stroke: "currentColor",
|
|
2914
|
-
strokeWidth: "2",
|
|
2915
|
-
strokeLinecap: "round",
|
|
2916
|
-
strokeLinejoin: "round",
|
|
2917
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("polyline", { points: "18 15 12 9 6 15" })
|
|
2918
|
-
}
|
|
2919
|
-
);
|
|
2920
|
-
var DefaultLoaderIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2921
|
-
"svg",
|
|
2922
|
-
{
|
|
2923
|
-
className: `${className} copilotkit-spinner`,
|
|
2924
|
-
width: "16",
|
|
2925
|
-
height: "16",
|
|
2926
|
-
viewBox: "0 0 24 24",
|
|
2927
|
-
fill: "none",
|
|
2928
|
-
stroke: "currentColor",
|
|
2929
|
-
strokeWidth: "2",
|
|
2930
|
-
strokeLinecap: "round",
|
|
2931
|
-
strokeLinejoin: "round",
|
|
2932
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
2933
|
-
}
|
|
2934
|
-
);
|
|
2935
|
-
var formatContent = (result) => {
|
|
2936
|
-
if (result === null || result === void 0)
|
|
2937
|
-
return "";
|
|
2938
|
-
return typeof result === "string" ? result : JSON.stringify(result, null, 2);
|
|
2939
|
-
};
|
|
2940
|
-
var DefaultSkeletonLoader = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: className || "copilotkit-skeleton", children: [
|
|
2941
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "copilotkit-skeleton-header", children: [
|
|
2942
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "copilotkit-skeleton-title" }),
|
|
2943
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "copilotkit-skeleton-subtitle" })
|
|
2944
|
-
] }),
|
|
2945
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "copilotkit-skeleton-content" })
|
|
2946
|
-
] });
|
|
2947
|
-
var DefaultStateItemRenderer = ({
|
|
2948
|
-
item,
|
|
2949
|
-
isNewest,
|
|
2950
|
-
className
|
|
2951
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2952
|
-
"div",
|
|
2953
|
-
{
|
|
2954
|
-
className: `${className || "copilotkit-state-item"} ${isNewest ? "copilotkit-state-item-newest" : ""}`,
|
|
2955
|
-
children: [
|
|
2956
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "copilotkit-state-item-header", children: "tool" in item ? item.tool : item.name }),
|
|
2957
|
-
"thought" in item && item.thought && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "copilotkit-state-item-thought", children: item.thought }),
|
|
2958
|
-
"result" in item && item.result !== void 0 && item.result !== null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "copilotkit-state-item-result", children: formatContent(item.result) }),
|
|
2959
|
-
"description" in item && item.description && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "copilotkit-state-item-description", children: item.description })
|
|
2960
|
-
]
|
|
2961
|
-
}
|
|
2962
|
-
);
|
|
2963
|
-
var DefaultStateRenderer = ({
|
|
2964
|
-
state,
|
|
2965
|
-
status,
|
|
2966
|
-
StateItemRenderer = DefaultStateItemRenderer,
|
|
2967
|
-
SkeletonLoader = DefaultSkeletonLoader,
|
|
2968
|
-
labels,
|
|
2969
|
-
icons,
|
|
2970
|
-
className = "copilotkit-state",
|
|
2971
|
-
contentClassName = "copilotkit-state-content",
|
|
2972
|
-
itemClassName = "copilotkit-state-item",
|
|
2973
|
-
maxHeight = "250px",
|
|
2974
|
-
defaultCollapsed = true
|
|
2975
|
-
}) => {
|
|
2976
|
-
const [isCollapsed, setIsCollapsed] = (0, import_react17.useState)(defaultCollapsed);
|
|
2977
|
-
const contentRef = (0, import_react17.useRef)(null);
|
|
2978
|
-
const prevItemsLengthRef = (0, import_react17.useRef)(0);
|
|
2979
|
-
const [newestItemId, setNewestItemId] = (0, import_react17.useState)(null);
|
|
2980
|
-
const defaultLabels = {
|
|
2981
|
-
inProgressLabel: "Analyzing",
|
|
2982
|
-
completeLabel: "Analyzed",
|
|
2983
|
-
emptyLabel: "No activity"
|
|
2984
|
-
};
|
|
2985
|
-
const mergedLabels = __spreadValues(__spreadValues({}, defaultLabels), labels);
|
|
2986
|
-
const ExpandIcon = (icons == null ? void 0 : icons.expand) || DefaultExpandIcon2;
|
|
2987
|
-
const CollapseIcon = (icons == null ? void 0 : icons.collapse) || DefaultCollapseIcon2;
|
|
2988
|
-
const items = (0, import_react17.useMemo)(() => {
|
|
2989
|
-
var _a;
|
|
2990
|
-
return state ? [...((_a = state.steps) == null ? void 0 : _a.filter((s) => s.tool)) || [], ...state.tasks || []].sort(
|
|
2991
|
-
(a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
|
|
2992
|
-
) : [];
|
|
2993
|
-
}, [state]);
|
|
2994
|
-
const isThinking = status === "inProgress" && items.length === 0;
|
|
2995
|
-
(0, import_react17.useEffect)(() => {
|
|
2996
|
-
if (!state)
|
|
2997
|
-
return;
|
|
2998
|
-
if (items.length > prevItemsLengthRef.current) {
|
|
2999
|
-
if (items.length > 0) {
|
|
3000
|
-
const newest = items[items.length - 1];
|
|
3001
|
-
setNewestItemId(newest.id);
|
|
3002
|
-
setTimeout(() => {
|
|
3003
|
-
setNewestItemId(null);
|
|
3004
|
-
}, 1500);
|
|
3005
|
-
}
|
|
3006
|
-
if (contentRef.current && !isCollapsed) {
|
|
3007
|
-
contentRef.current.scrollTop = contentRef.current.scrollHeight;
|
|
3008
|
-
}
|
|
3009
|
-
}
|
|
3010
|
-
prevItemsLengthRef.current = items.length;
|
|
3011
|
-
}, [items, isCollapsed, state]);
|
|
3012
|
-
if (!state) {
|
|
3013
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DefaultLoaderIcon, { className: "copilotkit-loader" }) });
|
|
3014
|
-
}
|
|
3015
|
-
if (isCollapsed && items.length === 0 && !isThinking)
|
|
3016
|
-
return null;
|
|
3017
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className, children: [
|
|
3018
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "copilotkit-state-header", onClick: () => setIsCollapsed(!isCollapsed), children: [
|
|
3019
|
-
isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ExpandIcon, { className: "copilotkit-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CollapseIcon, { className: "copilotkit-icon" }),
|
|
3020
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "copilotkit-state-label", children: status === "inProgress" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "copilotkit-state-label-loading", children: mergedLabels.inProgressLabel }) : mergedLabels.completeLabel })
|
|
3021
|
-
] }),
|
|
3022
|
-
!isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { ref: contentRef, className: contentClassName, style: { maxHeight }, children: items.length > 0 ? items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3023
|
-
StateItemRenderer,
|
|
3024
|
-
{
|
|
3025
|
-
item,
|
|
3026
|
-
isNewest: item.id === newestItemId,
|
|
3027
|
-
className: itemClassName
|
|
3028
|
-
},
|
|
3029
|
-
item.id
|
|
3030
|
-
)) : isThinking ? (
|
|
3031
|
-
// Show skeleton loader while thinking
|
|
3032
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
3033
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SkeletonLoader, {}),
|
|
3034
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SkeletonLoader, {})
|
|
3035
|
-
] })
|
|
3036
|
-
) : (
|
|
3037
|
-
// Empty state
|
|
3038
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "copilotkit-state-empty", children: mergedLabels.emptyLabel })
|
|
3039
|
-
) })
|
|
3040
|
-
] });
|
|
3041
|
-
};
|
|
3042
2756
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3043
2757
|
0 && (module.exports = {
|
|
3044
2758
|
AssistantMessage,
|
|
@@ -3046,11 +2760,8 @@ var DefaultStateRenderer = ({
|
|
|
3046
2760
|
CopilotDevConsole,
|
|
3047
2761
|
CopilotPopup,
|
|
3048
2762
|
CopilotSidebar,
|
|
3049
|
-
DefaultResponseRenderer,
|
|
3050
|
-
DefaultStateRenderer,
|
|
3051
2763
|
Markdown,
|
|
3052
2764
|
UserMessage,
|
|
3053
|
-
createResponseCache,
|
|
3054
2765
|
shouldShowDevConsole,
|
|
3055
2766
|
useChatContext
|
|
3056
2767
|
});
|