@copilotkit/react-ui 1.7.2-next.1 → 1.7.2-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{chunk-AZU4QOV5.mjs → chunk-AELKLZSG.mjs} +5 -5
  3. package/dist/{chunk-3PJA5MFR.mjs → chunk-DLG7BZTA.mjs} +2 -2
  4. package/dist/chunk-EJG6RRSX.mjs +138 -0
  5. package/dist/chunk-EJG6RRSX.mjs.map +1 -0
  6. package/dist/chunk-MCO235PS.mjs +164 -0
  7. package/dist/chunk-MCO235PS.mjs.map +1 -0
  8. package/dist/chunk-MWC5OV7Z.mjs +1 -0
  9. package/dist/chunk-N7LTE54T.mjs +1 -0
  10. package/dist/chunk-N7LTE54T.mjs.map +1 -0
  11. package/dist/{chunk-2C3ANQCY.mjs → chunk-QXQDIFOC.mjs} +9 -9
  12. package/dist/{chunk-ADTTDBLB.mjs → chunk-R2O33F44.mjs} +2 -2
  13. package/dist/chunk-UCVCAGU7.mjs +1 -0
  14. package/dist/chunk-UCVCAGU7.mjs.map +1 -0
  15. package/dist/{chunk-22K5DDPF.mjs → chunk-ZIF5JJCH.mjs} +8 -8
  16. package/dist/components/chat/Chat.mjs +7 -7
  17. package/dist/components/chat/Modal.mjs +8 -8
  18. package/dist/components/chat/Popup.mjs +9 -9
  19. package/dist/components/chat/Sidebar.mjs +9 -9
  20. package/dist/components/chat/index.mjs +12 -12
  21. package/dist/components/crew/DefaultResponseRenderer.d.ts +110 -0
  22. package/dist/components/crew/DefaultResponseRenderer.js +175 -0
  23. package/dist/components/crew/DefaultResponseRenderer.js.map +1 -0
  24. package/dist/components/crew/DefaultResponseRenderer.mjs +10 -0
  25. package/dist/components/crew/DefaultResponseRenderer.mjs.map +1 -0
  26. package/dist/components/crew/DefaultStateRenderer.d.ts +88 -0
  27. package/dist/components/crew/DefaultStateRenderer.js +198 -0
  28. package/dist/components/crew/DefaultStateRenderer.js.map +1 -0
  29. package/dist/components/crew/DefaultStateRenderer.mjs +8 -0
  30. package/dist/components/crew/DefaultStateRenderer.mjs.map +1 -0
  31. package/dist/components/crew/index.d.ts +4 -0
  32. package/dist/components/crew/index.js +335 -0
  33. package/dist/components/crew/index.js.map +1 -0
  34. package/dist/components/crew/index.mjs +16 -0
  35. package/dist/components/crew/index.mjs.map +1 -0
  36. package/dist/components/crew/types.d.ts +340 -0
  37. package/dist/components/crew/types.js +19 -0
  38. package/dist/components/crew/types.js.map +1 -0
  39. package/dist/components/crew/types.mjs +2 -0
  40. package/dist/components/crew/types.mjs.map +1 -0
  41. package/dist/components/dev-console/console.mjs +3 -3
  42. package/dist/components/dev-console/index.mjs +4 -4
  43. package/dist/components/index.d.ts +3 -0
  44. package/dist/components/index.js +290 -0
  45. package/dist/components/index.js.map +1 -1
  46. package/dist/components/index.mjs +26 -14
  47. package/dist/index.css +227 -0
  48. package/dist/index.css.map +1 -1
  49. package/dist/index.d.ts +3 -0
  50. package/dist/index.js +292 -2
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.mjs +26 -14
  53. package/package.json +4 -4
  54. package/src/components/crew/DefaultResponseRenderer.tsx +298 -0
  55. package/src/components/crew/DefaultStateRenderer.tsx +326 -0
  56. package/src/components/crew/index.ts +3 -0
  57. package/src/components/crew/types.ts +398 -0
  58. package/src/components/index.ts +1 -0
  59. package/src/css/crew.css +277 -0
  60. package/src/styles.css +1 -0
  61. package/dist/chunk-MMVDU6DF.mjs +0 -1
  62. /package/dist/{chunk-AZU4QOV5.mjs.map → chunk-AELKLZSG.mjs.map} +0 -0
  63. /package/dist/{chunk-3PJA5MFR.mjs.map → chunk-DLG7BZTA.mjs.map} +0 -0
  64. /package/dist/{chunk-MMVDU6DF.mjs.map → chunk-MWC5OV7Z.mjs.map} +0 -0
  65. /package/dist/{chunk-2C3ANQCY.mjs.map → chunk-QXQDIFOC.mjs.map} +0 -0
  66. /package/dist/{chunk-ADTTDBLB.mjs.map → chunk-R2O33F44.mjs.map} +0 -0
  67. /package/dist/{chunk-22K5DDPF.mjs.map → chunk-ZIF5JJCH.mjs.map} +0 -0
@@ -1,18 +1,22 @@
1
1
  import "../../chunk-SQMEPWVT.mjs";
2
2
  import {
3
3
  CopilotSidebar
4
- } from "../../chunk-3PJA5MFR.mjs";
4
+ } from "../../chunk-DLG7BZTA.mjs";
5
5
  import "../../chunk-WB3YULQ4.mjs";
6
6
  import {
7
7
  CopilotPopup
8
- } from "../../chunk-ADTTDBLB.mjs";
9
- import "../../chunk-AZU4QOV5.mjs";
8
+ } from "../../chunk-R2O33F44.mjs";
9
+ import "../../chunk-AELKLZSG.mjs";
10
10
  import "../../chunk-YAGE7RCE.mjs";
11
11
  import "../../chunk-VEC45H6Q.mjs";
12
12
  import "../../chunk-RQNJNK2W.mjs";
13
13
  import {
14
14
  CopilotChat
15
- } from "../../chunk-2C3ANQCY.mjs";
15
+ } from "../../chunk-QXQDIFOC.mjs";
16
+ import {
17
+ AssistantMessage
18
+ } from "../../chunk-3VNMQWGT.mjs";
19
+ import "../../chunk-XB6QCUPB.mjs";
16
20
  import "../../chunk-UWWMAJ7R.mjs";
17
21
  import "../../chunk-WEYDZBT7.mjs";
18
22
  import "../../chunk-OFYI4UU4.mjs";
@@ -20,17 +24,13 @@ import {
20
24
  UserMessage
21
25
  } from "../../chunk-HEIDCT7I.mjs";
22
26
  import "../../chunk-V7W6IM2V.mjs";
23
- import {
24
- AssistantMessage
25
- } from "../../chunk-3VNMQWGT.mjs";
26
- import "../../chunk-XB6QCUPB.mjs";
27
- import "../../chunk-WGAZXTUA.mjs";
28
- import "../../chunk-22K5DDPF.mjs";
29
- import "../../chunk-6TCUJ3B7.mjs";
27
+ import "../../chunk-ZIF5JJCH.mjs";
30
28
  import "../../chunk-KXE2JCUH.mjs";
31
29
  import "../../chunk-TI7SY2RI.mjs";
32
- import "../../chunk-BH6PCAAL.mjs";
33
30
  import "../../chunk-OTPAZXVR.mjs";
31
+ import "../../chunk-6TCUJ3B7.mjs";
32
+ import "../../chunk-BH6PCAAL.mjs";
33
+ import "../../chunk-WGAZXTUA.mjs";
34
34
  import "../../chunk-QXTRFMPM.mjs";
35
35
  import "../../chunk-YQFVRDNC.mjs";
36
36
  import {
@@ -0,0 +1,110 @@
1
+ import React__default from 'react';
2
+ import { ResponseRendererProps } from './types.js';
3
+
4
+ /**
5
+ * <br/>
6
+ * A response renderer component for the CopilotKit framework. This component displays
7
+ * a response that may require user feedback, such as approving or rejecting a suggestion.
8
+ * It provides a flexible, customizable interface for rendering responses with user interaction.
9
+ *
10
+ * ## Install Dependencies
11
+ *
12
+ * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.
13
+ *
14
+ * ```shell npm2yarn \"@copilotkit/react-ui"\
15
+ * npm install @copilotkit/react-core @copilotkit/react-ui
16
+ * ```
17
+ *
18
+ * ## Usage
19
+ *
20
+ * ```tsx
21
+ * import { DefaultResponseRenderer } from "@copilotkit/react-ui";
22
+ * import "@copilotkit/react-ui/styles.css";
23
+ *
24
+ * // Basic usage
25
+ * <DefaultResponseRenderer
26
+ * response={{
27
+ * id: "response-1",
28
+ * content: "I've analyzed your data and found these insights..."
29
+ * }}
30
+ * status="inProgress"
31
+ * onRespond={(input) => console.log(`User responded: ${input}`)}
32
+ * />
33
+ * ```
34
+ *
35
+ * ## Customization
36
+ *
37
+ * You can customize the appearance and behavior of the component:
38
+ *
39
+ * ```tsx
40
+ * // Custom labels and styling
41
+ * <DefaultResponseRenderer
42
+ * response={{
43
+ * id: "task-123",
44
+ * content: "Would you like to proceed with this recommendation?"
45
+ * }}
46
+ * status="inProgress"
47
+ * onRespond={handleResponse}
48
+ * labels={{
49
+ * responseLabel: "AI Recommendation",
50
+ * approveLabel: "Yes, proceed",
51
+ * rejectLabel: "No, cancel",
52
+ * approvedMessage: "Proceeding with recommendation",
53
+ * rejectedMessage: "Recommendation cancelled"
54
+ * }}
55
+ * className="my-custom-response"
56
+ * contentClassName="my-custom-content"
57
+ * buttonClassName="my-custom-button"
58
+ * />
59
+ *
60
+ * // Custom components
61
+ * <DefaultResponseRenderer
62
+ * response={{
63
+ * id: "task-456",
64
+ * content: "# Important Decision\nThis requires your approval"
65
+ * }}
66
+ * status="inProgress"
67
+ * onRespond={handleResponse}
68
+ * ContentRenderer={({ content, className }) => (
69
+ * <MyMarkdownRenderer content={content} className={className} />
70
+ * )}
71
+ * FeedbackButton={({ label, onClick, className }) => (
72
+ * <MyCustomButton label={label} onClick={onClick} className={className} />
73
+ * )}
74
+ * />
75
+ * ```
76
+ *
77
+ * ### Look & Feel
78
+ *
79
+ * By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:
80
+ * ```tsx title="YourRootComponent.tsx"
81
+ * ...
82
+ * import "@copilotkit/react-ui/styles.css"; // [!code highlight]
83
+ *
84
+ * export function YourRootComponent() {
85
+ * return (
86
+ * <CopilotKit>
87
+ * ...
88
+ * </CopilotKit>
89
+ * );
90
+ * }
91
+ * ```
92
+ * For more information about how to customize the styles, check out the [Customize Look & Feel](/guides/custom-look-and-feel/customize-built-in-ui-components) guide.
93
+ */
94
+
95
+ /**
96
+ * Creates a cache for storing response feedback
97
+ */
98
+ declare const createResponseCache: <T extends {
99
+ id: string;
100
+ }>() => {
101
+ getResponse: (id: string) => T | undefined;
102
+ setResponse: (id: string, response: T) => Map<string, T>;
103
+ };
104
+ /**
105
+ * Default response renderer component that handles rendering responses
106
+ * and collecting user feedback
107
+ */
108
+ declare const DefaultResponseRenderer: React__default.FC<ResponseRendererProps>;
109
+
110
+ export { DefaultResponseRenderer, createResponseCache };
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __export = (target, all) => {
24
+ for (var name in all)
25
+ __defProp(target, name, { get: all[name], enumerable: true });
26
+ };
27
+ var __copyProps = (to, from, except, desc) => {
28
+ if (from && typeof from === "object" || typeof from === "function") {
29
+ for (let key of __getOwnPropNames(from))
30
+ if (!__hasOwnProp.call(to, key) && key !== except)
31
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
+ }
33
+ return to;
34
+ };
35
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
+
37
+ // src/components/crew/DefaultResponseRenderer.tsx
38
+ var DefaultResponseRenderer_exports = {};
39
+ __export(DefaultResponseRenderer_exports, {
40
+ DefaultResponseRenderer: () => DefaultResponseRenderer,
41
+ createResponseCache: () => createResponseCache
42
+ });
43
+ module.exports = __toCommonJS(DefaultResponseRenderer_exports);
44
+ var import_react = require("react");
45
+ var import_jsx_runtime = require("react/jsx-runtime");
46
+ var createResponseCache = () => {
47
+ const responseCache = /* @__PURE__ */ new Map();
48
+ return {
49
+ getResponse: (id) => responseCache.get(id),
50
+ setResponse: (id, response) => responseCache.set(id, response)
51
+ };
52
+ };
53
+ var useResponseCache = createResponseCache();
54
+ var DefaultExpandIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
55
+ "svg",
56
+ {
57
+ className,
58
+ width: "12",
59
+ height: "12",
60
+ viewBox: "0 0 24 24",
61
+ fill: "none",
62
+ stroke: "currentColor",
63
+ strokeWidth: "2",
64
+ strokeLinecap: "round",
65
+ strokeLinejoin: "round",
66
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polyline", { points: "6 9 12 15 18 9" })
67
+ }
68
+ );
69
+ var DefaultCollapseIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
70
+ "svg",
71
+ {
72
+ className,
73
+ width: "12",
74
+ height: "12",
75
+ viewBox: "0 0 24 24",
76
+ fill: "none",
77
+ stroke: "currentColor",
78
+ strokeWidth: "2",
79
+ strokeLinecap: "round",
80
+ strokeLinejoin: "round",
81
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polyline", { points: "18 15 12 9 6 15" })
82
+ }
83
+ );
84
+ var DefaultContentRenderer = ({ content, className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, children: content });
85
+ var DefaultFeedbackButton = ({ label, onClick, className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick, className, children: label });
86
+ var DefaultCompletedFeedback = ({ message, className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: message }) });
87
+ var DefaultResponseRenderer = ({
88
+ response,
89
+ status,
90
+ onRespond,
91
+ icons,
92
+ labels,
93
+ ContentRenderer = DefaultContentRenderer,
94
+ FeedbackButton = DefaultFeedbackButton,
95
+ CompletedFeedback = DefaultCompletedFeedback,
96
+ className = "copilotkit-response",
97
+ contentClassName = "copilotkit-response-content",
98
+ actionsClassName = "copilotkit-response-actions",
99
+ buttonClassName = "copilotkit-response-button",
100
+ completedFeedbackClassName = "copilotkit-response-completed-feedback"
101
+ }) => {
102
+ const [isExpanded, setIsExpanded] = (0, import_react.useState)(true);
103
+ const defaultLabels = {
104
+ responseLabel: "Response",
105
+ approveLabel: "Approve",
106
+ rejectLabel: "Reject",
107
+ approvedMessage: "Approved",
108
+ rejectedMessage: "Rejected",
109
+ feedbackSubmittedMessage: "Feedback submitted"
110
+ };
111
+ const mergedLabels = __spreadValues(__spreadValues({}, defaultLabels), labels);
112
+ const renderFeedback = () => {
113
+ if (status === "complete") {
114
+ const cachedResponse = useResponseCache.getResponse(response.id);
115
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
116
+ CompletedFeedback,
117
+ {
118
+ message: (cachedResponse == null ? void 0 : cachedResponse.__feedback__) ? cachedResponse.__feedback__ === mergedLabels.approvedMessage ? mergedLabels.approvedMessage : mergedLabels.rejectedMessage : mergedLabels.feedbackSubmittedMessage,
119
+ className: completedFeedbackClassName
120
+ }
121
+ );
122
+ }
123
+ if (status === "inProgress" || status === "executing") {
124
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
125
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
126
+ FeedbackButton,
127
+ {
128
+ label: mergedLabels.approveLabel,
129
+ onClick: () => {
130
+ setIsExpanded(false);
131
+ onRespond == null ? void 0 : onRespond(mergedLabels.approveLabel);
132
+ useResponseCache.setResponse(response.id, __spreadProps(__spreadValues({}, response), {
133
+ __feedback__: mergedLabels.approvedMessage
134
+ }));
135
+ },
136
+ className: buttonClassName
137
+ }
138
+ ),
139
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
140
+ FeedbackButton,
141
+ {
142
+ label: mergedLabels.rejectLabel,
143
+ onClick: () => {
144
+ setIsExpanded(false);
145
+ useResponseCache.setResponse(response.id, __spreadProps(__spreadValues({}, response), {
146
+ __feedback__: mergedLabels.rejectedMessage
147
+ }));
148
+ onRespond == null ? void 0 : onRespond(mergedLabels.rejectLabel);
149
+ },
150
+ className: buttonClassName
151
+ }
152
+ )
153
+ ] });
154
+ }
155
+ return null;
156
+ };
157
+ const ExpandIcon = (icons == null ? void 0 : icons.expand) || DefaultExpandIcon;
158
+ const CollapseIcon = (icons == null ? void 0 : icons.collapse) || DefaultCollapseIcon;
159
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className, children: [
160
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContentRenderer, { content: response.content, className: contentClassName }),
161
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: actionsClassName, children: [
162
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "copilotkit-response-label", children: [
163
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => setIsExpanded(!isExpanded), className: "copilotkit-toggle-button", children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapseIcon, { className: "copilotkit-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpandIcon, { className: "copilotkit-icon" }) }),
164
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: mergedLabels.responseLabel })
165
+ ] }),
166
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotkit-response-buttons", children: renderFeedback() })
167
+ ] })
168
+ ] });
169
+ };
170
+ // Annotate the CommonJS export names for ESM import in node:
171
+ 0 && (module.exports = {
172
+ DefaultResponseRenderer,
173
+ createResponseCache
174
+ });
175
+ //# sourceMappingURL=DefaultResponseRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/crew/DefaultResponseRenderer.tsx"],"sourcesContent":["/**\n * <br/>\n * A response renderer component for the CopilotKit framework. This component displays\n * a response that may require user feedback, such as approving or rejecting a suggestion.\n * It provides a flexible, customizable interface for rendering responses with user interaction.\n *\n * ## Install Dependencies\n *\n * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.\n *\n * ```shell npm2yarn \\\"@copilotkit/react-ui\"\\\n * npm install @copilotkit/react-core @copilotkit/react-ui\n * ```\n *\n * ## Usage\n *\n * ```tsx\n * import { DefaultResponseRenderer } from \"@copilotkit/react-ui\";\n * import \"@copilotkit/react-ui/styles.css\";\n *\n * // Basic usage\n * <DefaultResponseRenderer\n * response={{\n * id: \"response-1\",\n * content: \"I've analyzed your data and found these insights...\"\n * }}\n * status=\"inProgress\"\n * onRespond={(input) => console.log(`User responded: ${input}`)}\n * />\n * ```\n *\n * ## Customization\n *\n * You can customize the appearance and behavior of the component:\n *\n * ```tsx\n * // Custom labels and styling\n * <DefaultResponseRenderer\n * response={{\n * id: \"task-123\",\n * content: \"Would you like to proceed with this recommendation?\"\n * }}\n * status=\"inProgress\"\n * onRespond={handleResponse}\n * labels={{\n * responseLabel: \"AI Recommendation\",\n * approveLabel: \"Yes, proceed\",\n * rejectLabel: \"No, cancel\",\n * approvedMessage: \"Proceeding with recommendation\",\n * rejectedMessage: \"Recommendation cancelled\"\n * }}\n * className=\"my-custom-response\"\n * contentClassName=\"my-custom-content\"\n * buttonClassName=\"my-custom-button\"\n * />\n *\n * // Custom components\n * <DefaultResponseRenderer\n * response={{\n * id: \"task-456\",\n * content: \"# Important Decision\\nThis requires your approval\"\n * }}\n * status=\"inProgress\"\n * onRespond={handleResponse}\n * ContentRenderer={({ content, className }) => (\n * <MyMarkdownRenderer content={content} className={className} />\n * )}\n * FeedbackButton={({ label, onClick, className }) => (\n * <MyCustomButton label={label} onClick={onClick} className={className} />\n * )}\n * />\n * ```\n *\n * ### Look & Feel\n *\n * By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:\n * ```tsx title=\"YourRootComponent.tsx\"\n * ...\n * import \"@copilotkit/react-ui/styles.css\"; // [!code highlight]\n *\n * export function YourRootComponent() {\n * return (\n * <CopilotKit>\n * ...\n * </CopilotKit>\n * );\n * }\n * ```\n * For more information about how to customize the styles, check out the [Customize Look & Feel](/guides/custom-look-and-feel/customize-built-in-ui-components) guide.\n */\n\nimport React, { useState } from \"react\";\nimport {\n Response,\n ResponseRendererProps,\n ContentRendererProps,\n FeedbackButtonProps,\n CompletedFeedbackProps,\n ResponseRendererIconProps,\n} from \"./types\";\n\n/**\n * Creates a cache for storing response feedback\n */\nconst createResponseCache = <T extends { id: string }>() => {\n const responseCache = new Map<string, T>();\n\n return {\n getResponse: (id: string) => responseCache.get(id),\n setResponse: (id: string, response: T) => responseCache.set(id, response),\n };\n};\n\n/**\n * Default global response cache instance\n */\nconst useResponseCache = createResponseCache<Response & { __feedback__?: string }>();\n\n/**\n * Default expand icon component\n */\nconst DefaultExpandIcon: React.FC<ResponseRendererIconProps> = ({ className }) => (\n <svg\n className={className}\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"6 9 12 15 18 9\"></polyline>\n </svg>\n);\n\n/**\n * Default collapse icon component\n */\nconst DefaultCollapseIcon: React.FC<ResponseRendererIconProps> = ({ className }) => (\n <svg\n className={className}\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"18 15 12 9 6 15\"></polyline>\n </svg>\n);\n\n/**\n * Default content renderer that simply displays text\n */\nconst DefaultContentRenderer: React.FC<ContentRendererProps> = ({ content, className }) => (\n <div className={className}>{content}</div>\n);\n\n/**\n * Default feedback button component\n */\nconst DefaultFeedbackButton: React.FC<FeedbackButtonProps> = ({ label, onClick, className }) => (\n <button onClick={onClick} className={className}>\n {label}\n </button>\n);\n\n/**\n * Default completed feedback component\n */\nconst DefaultCompletedFeedback: React.FC<CompletedFeedbackProps> = ({ message, className }) => (\n <div className={className}>\n <span>{message}</span>\n </div>\n);\n\n/**\n * Default response renderer component that handles rendering responses\n * and collecting user feedback\n */\nexport const DefaultResponseRenderer: React.FC<ResponseRendererProps> = ({\n response,\n status,\n onRespond,\n icons,\n labels,\n ContentRenderer = DefaultContentRenderer,\n FeedbackButton = DefaultFeedbackButton,\n CompletedFeedback = DefaultCompletedFeedback,\n className = \"copilotkit-response\",\n contentClassName = \"copilotkit-response-content\",\n actionsClassName = \"copilotkit-response-actions\",\n buttonClassName = \"copilotkit-response-button\",\n completedFeedbackClassName = \"copilotkit-response-completed-feedback\",\n}) => {\n const [isExpanded, setIsExpanded] = useState(true);\n\n // Default label values\n const defaultLabels = {\n responseLabel: \"Response\",\n approveLabel: \"Approve\",\n rejectLabel: \"Reject\",\n approvedMessage: \"Approved\",\n rejectedMessage: \"Rejected\",\n feedbackSubmittedMessage: \"Feedback submitted\",\n };\n\n // Merge provided labels with defaults\n const mergedLabels = { ...defaultLabels, ...labels };\n\n // Function to render feedback UI based on status\n const renderFeedback = () => {\n if (status === \"complete\") {\n const cachedResponse = useResponseCache.getResponse(response.id);\n return (\n <CompletedFeedback\n message={\n cachedResponse?.__feedback__\n ? cachedResponse.__feedback__ === mergedLabels.approvedMessage\n ? mergedLabels.approvedMessage\n : mergedLabels.rejectedMessage\n : mergedLabels.feedbackSubmittedMessage\n }\n className={completedFeedbackClassName}\n />\n );\n }\n\n if (status === \"inProgress\" || status === \"executing\") {\n return (\n <>\n <FeedbackButton\n label={mergedLabels.approveLabel}\n onClick={() => {\n setIsExpanded(false);\n onRespond?.(mergedLabels.approveLabel);\n useResponseCache.setResponse(response.id, {\n ...response,\n __feedback__: mergedLabels.approvedMessage,\n });\n }}\n className={buttonClassName}\n />\n <FeedbackButton\n label={mergedLabels.rejectLabel}\n onClick={() => {\n setIsExpanded(false);\n useResponseCache.setResponse(response.id, {\n ...response,\n __feedback__: mergedLabels.rejectedMessage,\n });\n onRespond?.(mergedLabels.rejectLabel);\n }}\n className={buttonClassName}\n />\n </>\n );\n }\n\n return null;\n };\n\n // Decide which icon to display\n const ExpandIcon = icons?.expand || DefaultExpandIcon;\n const CollapseIcon = icons?.collapse || DefaultCollapseIcon;\n\n return (\n <div className={className}>\n {/* Response content - conditionally expanded */}\n {isExpanded && <ContentRenderer content={response.content} className={contentClassName} />}\n\n <div className={actionsClassName}>\n <div className=\"copilotkit-response-label\">\n <button onClick={() => setIsExpanded(!isExpanded)} className=\"copilotkit-toggle-button\">\n {isExpanded ? (\n <CollapseIcon className=\"copilotkit-icon\" />\n ) : (\n <ExpandIcon className=\"copilotkit-icon\" />\n )}\n </button>\n <span>{mergedLabels.responseLabel}</span>\n </div>\n\n <div className=\"copilotkit-response-buttons\">{renderFeedback()}</div>\n </div>\n </div>\n );\n};\n\n/**\n * Export the response cache for reuse\n */\nexport { createResponseCache };\n"],"mappings":"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","names":[]}
@@ -0,0 +1,10 @@
1
+ import {
2
+ DefaultResponseRenderer,
3
+ createResponseCache
4
+ } from "../../chunk-EJG6RRSX.mjs";
5
+ import "../../chunk-MRXNTQOX.mjs";
6
+ export {
7
+ DefaultResponseRenderer,
8
+ createResponseCache
9
+ };
10
+ //# sourceMappingURL=DefaultResponseRenderer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,88 @@
1
+ import React__default from 'react';
2
+ import { StateRendererProps } from './types.js';
3
+
4
+ /**
5
+ * <br/>
6
+ * A state renderer component for the CopilotKit framework. This component displays
7
+ * the internal state of an agent, such as the steps it has taken and the tasks it has performed.
8
+ * It provides a collapsible UI that shows the agent's thought process and actions.
9
+ *
10
+ * ## Install Dependencies
11
+ *
12
+ * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.
13
+ *
14
+ * ```shell npm2yarn \"@copilotkit/react-ui"\
15
+ * npm install @copilotkit/react-core @copilotkit/react-ui
16
+ * ```
17
+ *
18
+ * ## Usage
19
+ *
20
+ * ```tsx
21
+ * import { DefaultStateRenderer } from "@copilotkit/react-ui";
22
+ * import "@copilotkit/react-ui/styles.css";
23
+ *
24
+ * // Basic usage
25
+ * <DefaultStateRenderer
26
+ * state={agentState}
27
+ * status="inProgress"
28
+ * />
29
+ * ```
30
+ *
31
+ * ## Customization
32
+ *
33
+ * You can customize the appearance and behavior of the component:
34
+ *
35
+ * ```tsx
36
+ * // Custom labels and styling
37
+ * <DefaultStateRenderer
38
+ * state={agentState}
39
+ * status="inProgress"
40
+ * labels={{
41
+ * inProgressLabel: "Thinking...",
42
+ * completeLabel: "Finished processing",
43
+ * emptyLabel: "Nothing to show"
44
+ * }}
45
+ * className="my-custom-state"
46
+ * contentClassName="my-custom-content"
47
+ * itemClassName="my-custom-item"
48
+ * maxHeight="300px"
49
+ * defaultCollapsed={false}
50
+ * />
51
+ *
52
+ * // Custom renderers
53
+ * <DefaultStateRenderer
54
+ * state={agentState}
55
+ * status="inProgress"
56
+ * StateItemRenderer={({ item, isNewest, className }) => (
57
+ * <MyCustomItemRenderer item={item} isNewest={isNewest} className={className} />
58
+ * )}
59
+ * SkeletonLoader={({ className }) => (
60
+ * <MyCustomSkeletonLoader className={className} />
61
+ * )}
62
+ * />
63
+ * ```
64
+ *
65
+ * ### Look & Feel
66
+ *
67
+ * By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:
68
+ * ```tsx title="YourRootComponent.tsx"
69
+ * ...
70
+ * import "@copilotkit/react-ui/styles.css"; // [!code highlight]
71
+ *
72
+ * export function YourRootComponent() {
73
+ * return (
74
+ * <CopilotKit>
75
+ * ...
76
+ * </CopilotKit>
77
+ * );
78
+ * }
79
+ * ```
80
+ * For more information about how to customize the styles, check out the [Customize Look & Feel](/guides/custom-look-and-feel/customize-built-in-ui-components) guide.
81
+ */
82
+
83
+ /**
84
+ * Default state renderer component
85
+ */
86
+ declare const DefaultStateRenderer: React__default.FC<StateRendererProps>;
87
+
88
+ export { DefaultStateRenderer };
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __export = (target, all) => {
21
+ for (var name in all)
22
+ __defProp(target, name, { get: all[name], enumerable: true });
23
+ };
24
+ var __copyProps = (to, from, except, desc) => {
25
+ if (from && typeof from === "object" || typeof from === "function") {
26
+ for (let key of __getOwnPropNames(from))
27
+ if (!__hasOwnProp.call(to, key) && key !== except)
28
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
+ }
30
+ return to;
31
+ };
32
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
+
34
+ // src/components/crew/DefaultStateRenderer.tsx
35
+ var DefaultStateRenderer_exports = {};
36
+ __export(DefaultStateRenderer_exports, {
37
+ DefaultStateRenderer: () => DefaultStateRenderer
38
+ });
39
+ module.exports = __toCommonJS(DefaultStateRenderer_exports);
40
+ var import_react = require("react");
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var DefaultExpandIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
43
+ "svg",
44
+ {
45
+ className,
46
+ width: "16",
47
+ height: "16",
48
+ viewBox: "0 0 24 24",
49
+ fill: "none",
50
+ stroke: "currentColor",
51
+ strokeWidth: "2",
52
+ strokeLinecap: "round",
53
+ strokeLinejoin: "round",
54
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polyline", { points: "6 9 12 15 18 9" })
55
+ }
56
+ );
57
+ var DefaultCollapseIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
58
+ "svg",
59
+ {
60
+ className,
61
+ width: "16",
62
+ height: "16",
63
+ viewBox: "0 0 24 24",
64
+ fill: "none",
65
+ stroke: "currentColor",
66
+ strokeWidth: "2",
67
+ strokeLinecap: "round",
68
+ strokeLinejoin: "round",
69
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polyline", { points: "18 15 12 9 6 15" })
70
+ }
71
+ );
72
+ var DefaultLoaderIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
+ "svg",
74
+ {
75
+ className: `${className} copilotkit-spinner`,
76
+ width: "16",
77
+ height: "16",
78
+ viewBox: "0 0 24 24",
79
+ fill: "none",
80
+ stroke: "currentColor",
81
+ strokeWidth: "2",
82
+ strokeLinecap: "round",
83
+ strokeLinejoin: "round",
84
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
85
+ }
86
+ );
87
+ var formatContent = (result) => {
88
+ if (result === null || result === void 0)
89
+ return "";
90
+ return typeof result === "string" ? result : JSON.stringify(result, null, 2);
91
+ };
92
+ var DefaultSkeletonLoader = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: className || "copilotkit-skeleton", children: [
93
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "copilotkit-skeleton-header", children: [
94
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotkit-skeleton-title" }),
95
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotkit-skeleton-subtitle" })
96
+ ] }),
97
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotkit-skeleton-content" })
98
+ ] });
99
+ var DefaultStateItemRenderer = ({
100
+ item,
101
+ isNewest,
102
+ className
103
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
104
+ "div",
105
+ {
106
+ className: `${className || "copilotkit-state-item"} ${isNewest ? "copilotkit-state-item-newest" : ""}`,
107
+ children: [
108
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotkit-state-item-header", children: "tool" in item ? item.tool : item.name }),
109
+ "thought" in item && item.thought && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotkit-state-item-thought", children: item.thought }),
110
+ "result" in item && item.result !== void 0 && item.result !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotkit-state-item-result", children: formatContent(item.result) }),
111
+ "description" in item && item.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotkit-state-item-description", children: item.description })
112
+ ]
113
+ }
114
+ );
115
+ var DefaultStateRenderer = ({
116
+ state,
117
+ status,
118
+ StateItemRenderer = DefaultStateItemRenderer,
119
+ SkeletonLoader = DefaultSkeletonLoader,
120
+ labels,
121
+ icons,
122
+ className = "copilotkit-state",
123
+ contentClassName = "copilotkit-state-content",
124
+ itemClassName = "copilotkit-state-item",
125
+ maxHeight = "250px",
126
+ defaultCollapsed = true
127
+ }) => {
128
+ const [isCollapsed, setIsCollapsed] = (0, import_react.useState)(defaultCollapsed);
129
+ const contentRef = (0, import_react.useRef)(null);
130
+ const prevItemsLengthRef = (0, import_react.useRef)(0);
131
+ const [newestItemId, setNewestItemId] = (0, import_react.useState)(null);
132
+ const defaultLabels = {
133
+ inProgressLabel: "Analyzing",
134
+ completeLabel: "Analyzed",
135
+ emptyLabel: "No activity"
136
+ };
137
+ const mergedLabels = __spreadValues(__spreadValues({}, defaultLabels), labels);
138
+ const ExpandIcon = (icons == null ? void 0 : icons.expand) || DefaultExpandIcon;
139
+ const CollapseIcon = (icons == null ? void 0 : icons.collapse) || DefaultCollapseIcon;
140
+ const items = (0, import_react.useMemo)(() => {
141
+ var _a;
142
+ return state ? [...((_a = state.steps) == null ? void 0 : _a.filter((s) => s.tool)) || [], ...state.tasks || []].sort(
143
+ (a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
144
+ ) : [];
145
+ }, [state]);
146
+ const isThinking = status === "inProgress" && items.length === 0;
147
+ (0, import_react.useEffect)(() => {
148
+ if (!state)
149
+ return;
150
+ if (items.length > prevItemsLengthRef.current) {
151
+ if (items.length > 0) {
152
+ const newest = items[items.length - 1];
153
+ setNewestItemId(newest.id);
154
+ setTimeout(() => {
155
+ setNewestItemId(null);
156
+ }, 1500);
157
+ }
158
+ if (contentRef.current && !isCollapsed) {
159
+ contentRef.current.scrollTop = contentRef.current.scrollHeight;
160
+ }
161
+ }
162
+ prevItemsLengthRef.current = items.length;
163
+ }, [items, isCollapsed, state]);
164
+ if (!state) {
165
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultLoaderIcon, { className: "copilotkit-loader" }) });
166
+ }
167
+ if (isCollapsed && items.length === 0 && !isThinking)
168
+ return null;
169
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className, children: [
170
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "copilotkit-state-header", onClick: () => setIsCollapsed(!isCollapsed), children: [
171
+ isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpandIcon, { className: "copilotkit-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapseIcon, { className: "copilotkit-icon" }),
172
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotkit-state-label", children: status === "inProgress" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotkit-state-label-loading", children: mergedLabels.inProgressLabel }) : mergedLabels.completeLabel })
173
+ ] }),
174
+ !isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: contentRef, className: contentClassName, style: { maxHeight }, children: items.length > 0 ? items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
175
+ StateItemRenderer,
176
+ {
177
+ item,
178
+ isNewest: item.id === newestItemId,
179
+ className: itemClassName
180
+ },
181
+ item.id
182
+ )) : isThinking ? (
183
+ // Show skeleton loader while thinking
184
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
185
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkeletonLoader, {}),
186
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkeletonLoader, {})
187
+ ] })
188
+ ) : (
189
+ // Empty state
190
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotkit-state-empty", children: mergedLabels.emptyLabel })
191
+ ) })
192
+ ] });
193
+ };
194
+ // Annotate the CommonJS export names for ESM import in node:
195
+ 0 && (module.exports = {
196
+ DefaultStateRenderer
197
+ });
198
+ //# sourceMappingURL=DefaultStateRenderer.js.map