@copilotkit/react-core 1.4.5 → 1.4.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/CHANGELOG.md +15 -0
- package/dist/chunk-2KCEHGSI.mjs +192 -0
- package/dist/chunk-2KCEHGSI.mjs.map +1 -0
- package/dist/chunk-5FHSUKQL.mjs +70 -0
- package/dist/chunk-5FHSUKQL.mjs.map +1 -0
- package/dist/chunk-6U3UH3KO.mjs +140 -0
- package/dist/chunk-6U3UH3KO.mjs.map +1 -0
- package/dist/chunk-AG7FH7OD.mjs +28 -0
- package/dist/chunk-AG7FH7OD.mjs.map +1 -0
- package/dist/chunk-DCTJZ742.mjs +22 -0
- package/dist/chunk-DCTJZ742.mjs.map +1 -0
- package/dist/chunk-DHGXL5PC.mjs +439 -0
- package/dist/chunk-DHGXL5PC.mjs.map +1 -0
- package/dist/chunk-EFZPSZWO.mjs +1 -0
- package/dist/chunk-EFZPSZWO.mjs.map +1 -0
- package/dist/chunk-EUIBVFV6.mjs +294 -0
- package/dist/chunk-EUIBVFV6.mjs.map +1 -0
- package/dist/chunk-JHEAUB3Z.mjs +49 -0
- package/dist/chunk-JHEAUB3Z.mjs.map +1 -0
- package/dist/chunk-L34MHAXR.mjs +1 -0
- package/dist/chunk-L34MHAXR.mjs.map +1 -0
- package/dist/chunk-LUGEI4YQ.mjs +1 -0
- package/dist/chunk-LUGEI4YQ.mjs.map +1 -0
- package/dist/chunk-MLAS4QUR.mjs +18 -0
- package/dist/chunk-MLAS4QUR.mjs.map +1 -0
- package/dist/chunk-O22KGHOQ.mjs +128 -0
- package/dist/chunk-O22KGHOQ.mjs.map +1 -0
- package/dist/chunk-O7ARI5CV.mjs +31 -0
- package/dist/chunk-O7ARI5CV.mjs.map +1 -0
- package/dist/chunk-ODN4H66E.mjs +31 -0
- package/dist/chunk-ODN4H66E.mjs.map +1 -0
- package/dist/chunk-OT67R4NB.mjs +119 -0
- package/dist/chunk-OT67R4NB.mjs.map +1 -0
- package/dist/chunk-SKC7AJIV.mjs +61 -0
- package/dist/chunk-SKC7AJIV.mjs.map +1 -0
- package/dist/chunk-UOVONDR6.mjs +23 -0
- package/dist/chunk-UOVONDR6.mjs.map +1 -0
- package/dist/chunk-XBVKTDXP.mjs +172 -0
- package/dist/chunk-XBVKTDXP.mjs.map +1 -0
- package/dist/chunk-XQFVXX6R.mjs +78 -0
- package/dist/chunk-XQFVXX6R.mjs.map +1 -0
- package/dist/chunk-XXR4QFAQ.mjs +29 -0
- package/dist/chunk-XXR4QFAQ.mjs.map +1 -0
- package/dist/chunk-Y7MI4PBB.mjs +91 -0
- package/dist/chunk-Y7MI4PBB.mjs.map +1 -0
- package/dist/chunk-YPSGKPDA.mjs +1 -0
- package/dist/chunk-YPSGKPDA.mjs.map +1 -0
- package/dist/components/copilot-provider/copilot-messages.d.ts +7 -0
- package/dist/components/copilot-provider/copilot-messages.js +80 -0
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -0
- package/dist/components/copilot-provider/copilot-messages.mjs +9 -0
- package/dist/components/copilot-provider/copilot-messages.mjs.map +1 -0
- package/dist/components/copilot-provider/copilotkit-props.d.ts +72 -0
- package/dist/components/copilot-provider/copilotkit-props.js +19 -0
- package/dist/components/copilot-provider/copilotkit-props.js.map +1 -0
- package/dist/components/copilot-provider/copilotkit-props.mjs +1 -0
- package/dist/components/copilot-provider/copilotkit-props.mjs.map +1 -0
- package/dist/components/copilot-provider/copilotkit.d.ts +9 -0
- package/dist/components/copilot-provider/copilotkit.js +877 -0
- package/dist/components/copilot-provider/copilotkit.js.map +1 -0
- package/dist/components/copilot-provider/copilotkit.mjs +21 -0
- package/dist/components/copilot-provider/copilotkit.mjs.map +1 -0
- package/dist/components/copilot-provider/index.d.ts +4 -0
- package/dist/components/copilot-provider/index.js +877 -0
- package/dist/components/copilot-provider/index.js.map +1 -0
- package/dist/components/copilot-provider/index.mjs +19 -0
- package/dist/components/copilot-provider/index.mjs.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +877 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +19 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/components/toast/exclamation-mark-icon.d.ts +9 -0
- package/dist/components/toast/exclamation-mark-icon.js +55 -0
- package/dist/components/toast/exclamation-mark-icon.js.map +1 -0
- package/dist/components/toast/exclamation-mark-icon.mjs +8 -0
- package/dist/components/toast/exclamation-mark-icon.mjs.map +1 -0
- package/dist/components/toast/toast-provider.d.ts +29 -0
- package/dist/components/toast/toast-provider.js +255 -0
- package/dist/components/toast/toast-provider.js.map +1 -0
- package/dist/components/toast/toast-provider.mjs +11 -0
- package/dist/components/toast/toast-provider.mjs.map +1 -0
- package/dist/context/copilot-context.d.ts +111 -0
- package/dist/context/copilot-context.js +129 -0
- package/dist/context/copilot-context.js.map +1 -0
- package/dist/context/copilot-context.mjs +10 -0
- package/dist/context/copilot-context.mjs.map +1 -0
- package/dist/context/copilot-messages-context.d.ts +15 -0
- package/dist/context/copilot-messages-context.js +57 -0
- package/dist/context/copilot-messages-context.js.map +1 -0
- package/dist/context/copilot-messages-context.mjs +10 -0
- package/dist/context/copilot-messages-context.mjs.map +1 -0
- package/dist/context/index.d.ts +11 -0
- package/dist/context/index.js +152 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/index.mjs +17 -0
- package/dist/context/index.mjs.map +1 -0
- package/dist/hooks/index.d.ts +19 -0
- package/dist/hooks/index.js +906 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +44 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/hooks/use-chat.d.ts +96 -0
- package/dist/hooks/use-chat.js +359 -0
- package/dist/hooks/use-chat.js.map +1 -0
- package/dist/hooks/use-chat.mjs +11 -0
- package/dist/hooks/use-chat.mjs.map +1 -0
- package/dist/hooks/use-coagent-state-render.d.ts +60 -0
- package/dist/hooks/use-coagent-state-render.js +163 -0
- package/dist/hooks/use-coagent-state-render.js.map +1 -0
- package/dist/hooks/use-coagent-state-render.mjs +9 -0
- package/dist/hooks/use-coagent-state-render.mjs.map +1 -0
- package/dist/hooks/use-coagent.d.ts +186 -0
- package/dist/hooks/use-coagent.js +735 -0
- package/dist/hooks/use-coagent.js.map +1 -0
- package/dist/hooks/use-coagent.mjs +21 -0
- package/dist/hooks/use-coagent.mjs.map +1 -0
- package/dist/hooks/use-copilot-action.d.ts +130 -0
- package/dist/hooks/use-copilot-action.js +222 -0
- package/dist/hooks/use-copilot-action.js.map +1 -0
- package/dist/hooks/use-copilot-action.mjs +9 -0
- package/dist/hooks/use-copilot-action.mjs.map +1 -0
- package/dist/hooks/use-copilot-chat.d.ts +37 -0
- package/dist/hooks/use-copilot-chat.js +630 -0
- package/dist/hooks/use-copilot-chat.js.map +1 -0
- package/dist/hooks/use-copilot-chat.mjs +22 -0
- package/dist/hooks/use-copilot-chat.mjs.map +1 -0
- package/dist/hooks/use-copilot-readable.d.ts +33 -0
- package/dist/hooks/use-copilot-readable.js +149 -0
- package/dist/hooks/use-copilot-readable.js.map +1 -0
- package/dist/hooks/use-copilot-readable.mjs +9 -0
- package/dist/hooks/use-copilot-readable.mjs.map +1 -0
- package/dist/hooks/use-copilot-runtime-client.d.ts +5 -0
- package/dist/hooks/use-copilot-runtime-client.js +76 -0
- package/dist/hooks/use-copilot-runtime-client.js.map +1 -0
- package/dist/hooks/use-copilot-runtime-client.mjs +10 -0
- package/dist/hooks/use-copilot-runtime-client.mjs.map +1 -0
- package/dist/hooks/use-flat-category-store.d.ts +9 -0
- package/dist/hooks/use-flat-category-store.js +90 -0
- package/dist/hooks/use-flat-category-store.js.map +1 -0
- package/dist/hooks/use-flat-category-store.mjs +8 -0
- package/dist/hooks/use-flat-category-store.mjs.map +1 -0
- package/dist/hooks/use-make-copilot-document-readable.d.ts +12 -0
- package/dist/hooks/use-make-copilot-document-readable.js +144 -0
- package/dist/hooks/use-make-copilot-document-readable.js.map +1 -0
- package/dist/hooks/use-make-copilot-document-readable.mjs +9 -0
- package/dist/hooks/use-make-copilot-document-readable.mjs.map +1 -0
- package/dist/hooks/use-tree.d.ts +18 -0
- package/dist/hooks/use-tree.js +172 -0
- package/dist/hooks/use-tree.js.map +1 -0
- package/dist/hooks/use-tree.mjs +8 -0
- package/dist/hooks/use-tree.mjs.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +1832 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +71 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/copilot-task.d.ts +92 -0
- package/dist/lib/copilot-task.js +157 -0
- package/dist/lib/copilot-task.js.map +1 -0
- package/dist/lib/copilot-task.mjs +18 -0
- package/dist/lib/copilot-task.mjs.map +1 -0
- package/dist/lib/index.d.ts +11 -0
- package/dist/lib/index.js +159 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/index.mjs +19 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/types/chat-suggestion-configuration.d.ts +22 -0
- package/dist/types/chat-suggestion-configuration.js +19 -0
- package/dist/types/chat-suggestion-configuration.js.map +1 -0
- package/dist/types/chat-suggestion-configuration.mjs +1 -0
- package/dist/types/chat-suggestion-configuration.mjs.map +1 -0
- package/dist/types/coagent-action.d.ts +29 -0
- package/dist/types/coagent-action.js +19 -0
- package/dist/types/coagent-action.js.map +1 -0
- package/dist/types/coagent-action.mjs +1 -0
- package/dist/types/coagent-action.mjs.map +1 -0
- package/dist/types/coagent-state.d.ts +11 -0
- package/dist/types/coagent-state.js +19 -0
- package/dist/types/coagent-state.js.map +1 -0
- package/dist/types/coagent-state.mjs +1 -0
- package/dist/types/coagent-state.mjs.map +1 -0
- package/dist/types/document-pointer.d.ts +9 -0
- package/dist/types/document-pointer.js +19 -0
- package/dist/types/document-pointer.js.map +1 -0
- package/dist/types/document-pointer.mjs +1 -0
- package/dist/types/document-pointer.mjs.map +1 -0
- package/dist/types/frontend-action.d.ts +107 -0
- package/dist/types/frontend-action.js +19 -0
- package/dist/types/frontend-action.js.map +1 -0
- package/dist/types/frontend-action.mjs +1 -0
- package/dist/types/frontend-action.mjs.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +2 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/system-message.d.ts +3 -0
- package/dist/types/system-message.js +19 -0
- package/dist/types/system-message.js.map +1 -0
- package/dist/types/system-message.mjs +1 -0
- package/dist/types/system-message.mjs.map +1 -0
- package/dist/utils/dev-console.d.ts +3 -0
- package/dist/utils/dev-console.js +42 -0
- package/dist/utils/dev-console.js.map +1 -0
- package/dist/utils/dev-console.mjs +8 -0
- package/dist/utils/dev-console.mjs.map +1 -0
- package/dist/utils/extract.d.ts +42 -0
- package/dist/utils/extract.js +190 -0
- package/dist/utils/extract.js.map +1 -0
- package/dist/utils/extract.mjs +17 -0
- package/dist/utils/extract.mjs.map +1 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.js +208 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +20 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/utils.d.ts +2 -0
- package/dist/utils/utils.js +19 -0
- package/dist/utils/utils.js.map +1 -0
- package/dist/utils/utils.mjs +1 -0
- package/dist/utils/utils.mjs.map +1 -0
- package/dist/utils/utils.test.d.ts +2 -0
- package/dist/utils/utils.test.js +9 -0
- package/dist/utils/utils.test.js.map +1 -0
- package/dist/utils/utils.test.mjs +7 -0
- package/dist/utils/utils.test.mjs.map +1 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
+
## 1.4.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix broken build script before release
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @copilotkit/runtime-client-gql@1.4.7
|
|
10
|
+
- @copilotkit/shared@1.4.7
|
|
11
|
+
|
|
12
|
+
## 1.4.6
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- .
|
|
17
|
+
|
|
3
18
|
## 1.4.5
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ExclamationMarkIcon
|
|
3
|
+
} from "./chunk-O7ARI5CV.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__spreadProps,
|
|
6
|
+
__spreadValues
|
|
7
|
+
} from "./chunk-SKC7AJIV.mjs";
|
|
8
|
+
|
|
9
|
+
// src/components/toast/toast-provider.tsx
|
|
10
|
+
import { createContext, useContext, useState, useCallback } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
var ToastContext = createContext(void 0);
|
|
13
|
+
function useToast() {
|
|
14
|
+
const context = useContext(ToastContext);
|
|
15
|
+
if (!context) {
|
|
16
|
+
throw new Error("useToast must be used within a ToastProvider");
|
|
17
|
+
}
|
|
18
|
+
return context;
|
|
19
|
+
}
|
|
20
|
+
function ToastProvider({
|
|
21
|
+
enabled,
|
|
22
|
+
children
|
|
23
|
+
}) {
|
|
24
|
+
const [toasts, setToasts] = useState([]);
|
|
25
|
+
const addToast = useCallback((toast) => {
|
|
26
|
+
const id = Math.random().toString(36).substring(2, 9);
|
|
27
|
+
setToasts((currentToasts) => [...currentToasts, __spreadProps(__spreadValues({}, toast), { id })]);
|
|
28
|
+
if (toast.duration) {
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
removeToast(id);
|
|
31
|
+
}, toast.duration);
|
|
32
|
+
}
|
|
33
|
+
}, []);
|
|
34
|
+
const addGraphQLErrorsToast = useCallback((errors) => {
|
|
35
|
+
const errorsToRender = errors.map((error, idx) => {
|
|
36
|
+
var _a;
|
|
37
|
+
const message = error.message;
|
|
38
|
+
const code = (_a = error.extensions) == null ? void 0 : _a.code;
|
|
39
|
+
return /* @__PURE__ */ jsxs(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
style: {
|
|
43
|
+
marginTop: idx === 0 ? 0 : 10,
|
|
44
|
+
marginBottom: 14
|
|
45
|
+
},
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsx(ExclamationMarkIcon, { style: { marginBottom: 4 } }),
|
|
48
|
+
code && /* @__PURE__ */ jsxs(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
style: {
|
|
52
|
+
fontWeight: "600",
|
|
53
|
+
marginBottom: 4
|
|
54
|
+
},
|
|
55
|
+
children: [
|
|
56
|
+
"Copilot Cloud Error:",
|
|
57
|
+
" ",
|
|
58
|
+
/* @__PURE__ */ jsx("span", { style: { fontFamily: "monospace", fontWeight: "normal" }, children: code })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsx("div", { children: message })
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
idx
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
addToast({
|
|
69
|
+
type: "error",
|
|
70
|
+
message: /* @__PURE__ */ jsxs(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
style: {
|
|
74
|
+
fontSize: "13px",
|
|
75
|
+
maxWidth: "600px"
|
|
76
|
+
},
|
|
77
|
+
children: [
|
|
78
|
+
errorsToRender,
|
|
79
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "11px", opacity: 0.75 }, children: "NOTE: This is a Copilot Cloud error, and it only displays during local development." })
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
});
|
|
84
|
+
}, []);
|
|
85
|
+
const removeToast = useCallback((id) => {
|
|
86
|
+
setToasts((currentToasts) => currentToasts.filter((toast) => toast.id !== id));
|
|
87
|
+
}, []);
|
|
88
|
+
const value = {
|
|
89
|
+
toasts,
|
|
90
|
+
addToast,
|
|
91
|
+
addGraphQLErrorsToast,
|
|
92
|
+
removeToast,
|
|
93
|
+
enabled
|
|
94
|
+
};
|
|
95
|
+
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
|
|
96
|
+
/* @__PURE__ */ jsxs(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
style: {
|
|
100
|
+
position: "fixed",
|
|
101
|
+
bottom: "1rem",
|
|
102
|
+
left: "50%",
|
|
103
|
+
transform: "translateX(-50%)",
|
|
104
|
+
zIndex: 50,
|
|
105
|
+
display: "flex",
|
|
106
|
+
flexDirection: "column",
|
|
107
|
+
gap: "0.5rem"
|
|
108
|
+
},
|
|
109
|
+
children: [
|
|
110
|
+
toasts.length > 1 && /* @__PURE__ */ jsx("div", { style: { textAlign: "right" }, children: /* @__PURE__ */ jsx(
|
|
111
|
+
"button",
|
|
112
|
+
{
|
|
113
|
+
onClick: () => setToasts([]),
|
|
114
|
+
style: {
|
|
115
|
+
padding: "4px 8px",
|
|
116
|
+
fontSize: "12px",
|
|
117
|
+
cursor: "pointer",
|
|
118
|
+
background: "white",
|
|
119
|
+
border: "1px solid rgba(0,0,0,0.2)",
|
|
120
|
+
borderRadius: "4px"
|
|
121
|
+
},
|
|
122
|
+
children: "Close All"
|
|
123
|
+
}
|
|
124
|
+
) }),
|
|
125
|
+
toasts.map((toast) => /* @__PURE__ */ jsx(
|
|
126
|
+
Toast,
|
|
127
|
+
{
|
|
128
|
+
message: toast.message,
|
|
129
|
+
type: toast.type,
|
|
130
|
+
onClose: () => removeToast(toast.id)
|
|
131
|
+
},
|
|
132
|
+
toast.id
|
|
133
|
+
))
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
children
|
|
138
|
+
] });
|
|
139
|
+
}
|
|
140
|
+
function Toast({
|
|
141
|
+
message,
|
|
142
|
+
type = "info",
|
|
143
|
+
onClose
|
|
144
|
+
}) {
|
|
145
|
+
const bgColors = {
|
|
146
|
+
info: "#3b82f6",
|
|
147
|
+
success: "#22c55e",
|
|
148
|
+
warning: "#eab308",
|
|
149
|
+
error: "#ef4444"
|
|
150
|
+
};
|
|
151
|
+
return /* @__PURE__ */ jsxs(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
style: {
|
|
155
|
+
backgroundColor: bgColors[type],
|
|
156
|
+
color: "white",
|
|
157
|
+
padding: "0.5rem 1rem",
|
|
158
|
+
borderRadius: "0.25rem",
|
|
159
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
160
|
+
position: "relative",
|
|
161
|
+
minWidth: "200px"
|
|
162
|
+
},
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ jsx("div", { children: message }),
|
|
165
|
+
/* @__PURE__ */ jsx(
|
|
166
|
+
"button",
|
|
167
|
+
{
|
|
168
|
+
onClick: onClose,
|
|
169
|
+
style: {
|
|
170
|
+
position: "absolute",
|
|
171
|
+
top: "0",
|
|
172
|
+
right: "0",
|
|
173
|
+
background: "none",
|
|
174
|
+
border: "none",
|
|
175
|
+
color: "white",
|
|
176
|
+
cursor: "pointer",
|
|
177
|
+
padding: "0.5rem",
|
|
178
|
+
fontSize: "1rem"
|
|
179
|
+
},
|
|
180
|
+
children: "\u2715"
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export {
|
|
189
|
+
useToast,
|
|
190
|
+
ToastProvider
|
|
191
|
+
};
|
|
192
|
+
//# sourceMappingURL=chunk-2KCEHGSI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/toast/toast-provider.tsx"],"sourcesContent":["import { useCopilotContext } from \"../../context\";\nimport { GraphQLError } from \"@copilotkit/runtime-client-gql\";\nimport React, { createContext, useContext, useState, useCallback } from \"react\";\nimport { ExclamationMarkIcon } from \"./exclamation-mark-icon\";\n\ninterface Toast {\n id: string;\n message: string | React.ReactNode;\n type: \"info\" | \"success\" | \"warning\" | \"error\";\n duration?: number;\n}\n\ninterface ToastContextValue {\n toasts: Toast[];\n addToast: (toast: Omit<Toast, \"id\">) => void;\n addGraphQLErrorsToast: (errors: GraphQLError[]) => void;\n removeToast: (id: string) => void;\n enabled: boolean;\n}\n\nconst ToastContext = createContext<ToastContextValue | undefined>(undefined);\n\nexport function useToast() {\n const context = useContext(ToastContext);\n if (!context) {\n throw new Error(\"useToast must be used within a ToastProvider\");\n }\n return context;\n}\n\nexport function ToastProvider({\n enabled,\n children,\n}: {\n enabled: boolean;\n children: React.ReactNode;\n}) {\n const [toasts, setToasts] = useState<Toast[]>([]);\n const addToast = useCallback((toast: Omit<Toast, \"id\">) => {\n const id = Math.random().toString(36).substring(2, 9);\n\n setToasts((currentToasts) => [...currentToasts, { ...toast, id }]);\n\n if (toast.duration) {\n setTimeout(() => {\n removeToast(id);\n }, toast.duration);\n }\n }, []);\n\n const addGraphQLErrorsToast = useCallback((errors: GraphQLError[]) => {\n // We do not display these errors unless we are in dev mode.\n // if (!showDevConsole) {\n // return;\n // }\n\n const errorsToRender = errors.map((error, idx) => {\n const message = error.message;\n const code = error.extensions?.code as string;\n\n return (\n <div\n key={idx}\n style={{\n marginTop: idx === 0 ? 0 : 10,\n marginBottom: 14,\n }}\n >\n <ExclamationMarkIcon style={{ marginBottom: 4 }} />\n\n {code && (\n <div\n style={{\n fontWeight: \"600\",\n marginBottom: 4,\n }}\n >\n Copilot Cloud Error:{\" \"}\n <span style={{ fontFamily: \"monospace\", fontWeight: \"normal\" }}>{code}</span>\n </div>\n )}\n <div>{message}</div>\n </div>\n );\n });\n\n addToast({\n type: \"error\",\n message: (\n <div\n style={{\n fontSize: \"13px\",\n maxWidth: \"600px\",\n }}\n >\n {errorsToRender}\n <div style={{ fontSize: \"11px\", opacity: 0.75 }}>\n NOTE: This is a Copilot Cloud error, and it only displays during local development.\n </div>\n </div>\n ),\n });\n }, []);\n\n const removeToast = useCallback((id: string) => {\n setToasts((currentToasts) => currentToasts.filter((toast) => toast.id !== id));\n }, []);\n\n const value = {\n toasts,\n addToast,\n addGraphQLErrorsToast,\n removeToast,\n enabled,\n };\n\n return (\n <ToastContext.Provider value={value}>\n <div\n style={{\n position: \"fixed\",\n bottom: \"1rem\",\n left: \"50%\",\n transform: \"translateX(-50%)\",\n zIndex: 50,\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"0.5rem\",\n }}\n >\n {toasts.length > 1 && (\n <div style={{ textAlign: \"right\" }}>\n <button\n onClick={() => setToasts([])}\n style={{\n padding: \"4px 8px\",\n fontSize: \"12px\",\n cursor: \"pointer\",\n background: \"white\",\n border: \"1px solid rgba(0,0,0,0.2)\",\n borderRadius: \"4px\",\n }}\n >\n Close All\n </button>\n </div>\n )}\n {toasts.map((toast) => (\n <Toast\n key={toast.id}\n message={toast.message}\n type={toast.type}\n onClose={() => removeToast(toast.id)}\n />\n ))}\n </div>\n {children}\n </ToastContext.Provider>\n );\n}\n\nfunction Toast({\n message,\n type = \"info\",\n onClose,\n}: {\n message: string | React.ReactNode;\n type: \"info\" | \"success\" | \"warning\" | \"error\";\n onClose: () => void;\n}) {\n const bgColors = {\n info: \"#3b82f6\",\n success: \"#22c55e\",\n warning: \"#eab308\",\n error: \"#ef4444\",\n };\n\n return (\n <div\n style={{\n backgroundColor: bgColors[type],\n color: \"white\",\n padding: \"0.5rem 1rem\",\n borderRadius: \"0.25rem\",\n boxShadow: \"0 2px 4px rgba(0,0,0,0.1)\",\n position: \"relative\",\n minWidth: \"200px\",\n }}\n >\n <div>{message}</div>\n <button\n onClick={onClose}\n style={{\n position: \"absolute\",\n top: \"0\",\n right: \"0\",\n background: \"none\",\n border: \"none\",\n color: \"white\",\n cursor: \"pointer\",\n padding: \"0.5rem\",\n fontSize: \"1rem\",\n }}\n >\n ✕\n </button>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAEA,SAAgB,eAAe,YAAY,UAAU,mBAAmB;AAkE9D,cAGE,YA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,YAAY,MAAM,EAAE;AAAA;AAAA,YAH9B,MAAM;AAAA,UAIb,CACD;AAAA;AAAA;AAAA,IACH;AAAA,IACC;AAAA,KACH;AAEJ;AAEA,SAAS,MAAM;AAAA,EACb;AAAA,EACA,OAAO;AAAA,EACP;AACF,GAIG;AACD,QAAM,WAAW;AAAA,IACf,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,iBAAiB,SAAS,IAAI;AAAA,QAC9B,OAAO;AAAA,QACP,SAAS;AAAA,QACT,cAAc;AAAA,QACd,WAAW;AAAA,QACX,UAAU;AAAA,QACV,UAAU;AAAA,MACZ;AAAA,MAEA;AAAA,4BAAC,SAAK,mBAAQ;AAAA,QACd;AAAA,UAAC;AAAA;AAAA,YACC,SAAS;AAAA,YACT,OAAO;AAAA,cACL,UAAU;AAAA,cACV,KAAK;AAAA,cACL,OAAO;AAAA,cACP,YAAY;AAAA,cACZ,QAAQ;AAAA,cACR,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,SAAS;AAAA,cACT,UAAU;AAAA,YACZ;AAAA,YACD;AAAA;AAAA,QAED;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// src/hooks/use-flat-category-store.ts
|
|
2
|
+
import { useCallback, useReducer } from "react";
|
|
3
|
+
import { randomId } from "@copilotkit/shared";
|
|
4
|
+
var useFlatCategoryStore = () => {
|
|
5
|
+
const [elements, dispatch] = useReducer(flatCategoryStoreReducer, /* @__PURE__ */ new Map());
|
|
6
|
+
const addElement = useCallback((value, categories) => {
|
|
7
|
+
const newId = randomId();
|
|
8
|
+
dispatch({
|
|
9
|
+
type: "ADD_ELEMENT",
|
|
10
|
+
value,
|
|
11
|
+
id: newId,
|
|
12
|
+
categories
|
|
13
|
+
});
|
|
14
|
+
return newId;
|
|
15
|
+
}, []);
|
|
16
|
+
const removeElement = useCallback((id) => {
|
|
17
|
+
dispatch({ type: "REMOVE_ELEMENT", id });
|
|
18
|
+
}, []);
|
|
19
|
+
const allElements = useCallback(
|
|
20
|
+
(categories) => {
|
|
21
|
+
const categoriesSet = new Set(categories);
|
|
22
|
+
const result = [];
|
|
23
|
+
elements.forEach((element) => {
|
|
24
|
+
if (setsHaveIntersection(categoriesSet, element.categories)) {
|
|
25
|
+
result.push(element.value);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return result;
|
|
29
|
+
},
|
|
30
|
+
[elements]
|
|
31
|
+
);
|
|
32
|
+
return { addElement, removeElement, allElements };
|
|
33
|
+
};
|
|
34
|
+
var use_flat_category_store_default = useFlatCategoryStore;
|
|
35
|
+
function flatCategoryStoreReducer(state, action) {
|
|
36
|
+
switch (action.type) {
|
|
37
|
+
case "ADD_ELEMENT": {
|
|
38
|
+
const { value, id, categories } = action;
|
|
39
|
+
const newElement = {
|
|
40
|
+
id,
|
|
41
|
+
value,
|
|
42
|
+
categories: new Set(categories)
|
|
43
|
+
};
|
|
44
|
+
const newState = new Map(state);
|
|
45
|
+
newState.set(id, newElement);
|
|
46
|
+
return newState;
|
|
47
|
+
}
|
|
48
|
+
case "REMOVE_ELEMENT": {
|
|
49
|
+
const newState = new Map(state);
|
|
50
|
+
newState.delete(action.id);
|
|
51
|
+
return newState;
|
|
52
|
+
}
|
|
53
|
+
default:
|
|
54
|
+
return state;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function setsHaveIntersection(setA, setB) {
|
|
58
|
+
const [smallerSet, largerSet] = setA.size <= setB.size ? [setA, setB] : [setB, setA];
|
|
59
|
+
for (let item of smallerSet) {
|
|
60
|
+
if (largerSet.has(item)) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
use_flat_category_store_default
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=chunk-5FHSUKQL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-flat-category-store.ts"],"sourcesContent":["import { useCallback, useReducer } from \"react\";\nimport { randomId } from \"@copilotkit/shared\";\n\nexport type FlatCategoryStoreId = string;\n\nexport interface UseFlatCategoryStoreReturn<T> {\n addElement: (value: T, categories: string[]) => FlatCategoryStoreId;\n removeElement: (id: FlatCategoryStoreId) => void;\n allElements: (categories: string[]) => T[];\n}\n\ninterface FlatCategoryStoreElement<T> {\n id: FlatCategoryStoreId;\n value: T;\n categories: Set<string>;\n}\n\nconst useFlatCategoryStore = <T>(): UseFlatCategoryStoreReturn<T> => {\n const [elements, dispatch] = useReducer<\n React.Reducer<Map<FlatCategoryStoreId, FlatCategoryStoreElement<T>>, Action<T>>\n >(flatCategoryStoreReducer, new Map<FlatCategoryStoreId, FlatCategoryStoreElement<T>>());\n\n const addElement = useCallback((value: T, categories: string[]): FlatCategoryStoreId => {\n const newId = randomId();\n dispatch({\n type: \"ADD_ELEMENT\",\n value,\n id: newId,\n categories,\n });\n return newId;\n }, []);\n\n const removeElement = useCallback((id: FlatCategoryStoreId): void => {\n dispatch({ type: \"REMOVE_ELEMENT\", id });\n }, []);\n\n const allElements = useCallback(\n (categories: string[]): T[] => {\n const categoriesSet = new Set(categories);\n const result: T[] = [];\n elements.forEach((element) => {\n if (setsHaveIntersection(categoriesSet, element.categories)) {\n result.push(element.value);\n }\n });\n return result;\n },\n [elements],\n );\n\n return { addElement, removeElement, allElements };\n};\n\nexport default useFlatCategoryStore;\n\n// Action types\ntype Action<T> =\n | {\n type: \"ADD_ELEMENT\";\n value: T;\n id: FlatCategoryStoreId;\n categories: string[];\n }\n | { type: \"REMOVE_ELEMENT\"; id: FlatCategoryStoreId };\n\n// Reducer\nfunction flatCategoryStoreReducer<T>(\n state: Map<FlatCategoryStoreId, FlatCategoryStoreElement<T>>,\n action: Action<T>,\n): Map<FlatCategoryStoreId, FlatCategoryStoreElement<T>> {\n switch (action.type) {\n case \"ADD_ELEMENT\": {\n const { value, id, categories } = action;\n const newElement: FlatCategoryStoreElement<T> = {\n id,\n value,\n categories: new Set(categories),\n };\n const newState = new Map(state);\n newState.set(id, newElement);\n return newState;\n }\n case \"REMOVE_ELEMENT\": {\n const newState = new Map(state);\n newState.delete(action.id);\n return newState;\n }\n default:\n return state;\n }\n}\n\nfunction setsHaveIntersection<T>(setA: Set<T>, setB: Set<T>): boolean {\n const [smallerSet, largerSet] = setA.size <= setB.size ? [setA, setB] : [setB, setA];\n\n for (let item of smallerSet) {\n if (largerSet.has(item)) {\n return true;\n }\n }\n\n return false;\n}\n"],"mappings":";AAAA,SAAS,aAAa,kBAAkB;AACxC,SAAS,gBAAgB;AAgBzB,IAAM,uBAAuB,MAAwC;AACnE,QAAM,CAAC,UAAU,QAAQ,IAAI,WAE3B,0BAA0B,oBAAI,IAAsD,CAAC;AAEvF,QAAM,aAAa,YAAY,CAAC,OAAU,eAA8C;AACtF,UAAM,QAAQ,SAAS;AACvB,aAAS;AAAA,MACP,MAAM;AAAA,MACN;AAAA,MACA,IAAI;AAAA,MACJ;AAAA,IACF,CAAC;AACD,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AAEL,QAAM,gBAAgB,YAAY,CAAC,OAAkC;AACnE,aAAS,EAAE,MAAM,kBAAkB,GAAG,CAAC;AAAA,EACzC,GAAG,CAAC,CAAC;AAEL,QAAM,cAAc;AAAA,IAClB,CAAC,eAA8B;AAC7B,YAAM,gBAAgB,IAAI,IAAI,UAAU;AACxC,YAAM,SAAc,CAAC;AACrB,eAAS,QAAQ,CAAC,YAAY;AAC5B,YAAI,qBAAqB,eAAe,QAAQ,UAAU,GAAG;AAC3D,iBAAO,KAAK,QAAQ,KAAK;AAAA,QAC3B;AAAA,MACF,CAAC;AACD,aAAO;AAAA,IACT;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,SAAO,EAAE,YAAY,eAAe,YAAY;AAClD;AAEA,IAAO,kCAAQ;AAaf,SAAS,yBACP,OACA,QACuD;AACvD,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,eAAe;AAClB,YAAM,EAAE,OAAO,IAAI,WAAW,IAAI;AAClC,YAAM,aAA0C;AAAA,QAC9C;AAAA,QACA;AAAA,QACA,YAAY,IAAI,IAAI,UAAU;AAAA,MAChC;AACA,YAAM,WAAW,IAAI,IAAI,KAAK;AAC9B,eAAS,IAAI,IAAI,UAAU;AAC3B,aAAO;AAAA,IACT;AAAA,IACA,KAAK,kBAAkB;AACrB,YAAM,WAAW,IAAI,IAAI,KAAK;AAC9B,eAAS,OAAO,OAAO,EAAE;AACzB,aAAO;AAAA,IACT;AAAA,IACA;AACE,aAAO;AAAA,EACX;AACF;AAEA,SAAS,qBAAwB,MAAc,MAAuB;AACpE,QAAM,CAAC,YAAY,SAAS,IAAI,KAAK,QAAQ,KAAK,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI;AAEnF,WAAS,QAAQ,YAAY;AAC3B,QAAI,UAAU,IAAI,IAAI,GAAG;AACvB,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "./chunk-SKC7AJIV.mjs";
|
|
5
|
+
|
|
6
|
+
// src/hooks/use-tree.ts
|
|
7
|
+
import { randomId } from "@copilotkit/shared";
|
|
8
|
+
import { useCallback, useReducer } from "react";
|
|
9
|
+
var removeNode = (nodes, id) => {
|
|
10
|
+
return nodes.reduce((result, node) => {
|
|
11
|
+
if (node.id !== id) {
|
|
12
|
+
const newNode = __spreadProps(__spreadValues({}, node), { children: removeNode(node.children, id) });
|
|
13
|
+
result.push(newNode);
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
}, []);
|
|
17
|
+
};
|
|
18
|
+
var addNode = (nodes, newNode, parentId) => {
|
|
19
|
+
if (!parentId) {
|
|
20
|
+
return [...nodes, newNode];
|
|
21
|
+
}
|
|
22
|
+
return nodes.map((node) => {
|
|
23
|
+
if (node.id === parentId) {
|
|
24
|
+
return __spreadProps(__spreadValues({}, node), { children: [...node.children, newNode] });
|
|
25
|
+
} else if (node.children.length) {
|
|
26
|
+
return __spreadProps(__spreadValues({}, node), { children: addNode(node.children, newNode, parentId) });
|
|
27
|
+
}
|
|
28
|
+
return node;
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var treeIndentationRepresentation = (index, indentLevel) => {
|
|
32
|
+
if (indentLevel === 0) {
|
|
33
|
+
return (index + 1).toString();
|
|
34
|
+
} else if (indentLevel === 1) {
|
|
35
|
+
return String.fromCharCode(65 + index);
|
|
36
|
+
} else if (indentLevel === 2) {
|
|
37
|
+
return String.fromCharCode(97 + index);
|
|
38
|
+
} else {
|
|
39
|
+
return "-";
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var printNode = (node, prefix = "", indentLevel = 0) => {
|
|
43
|
+
const indent = " ".repeat(3).repeat(indentLevel);
|
|
44
|
+
const prefixPlusIndentLength = prefix.length + indent.length;
|
|
45
|
+
const subsequentLinesPrefix = " ".repeat(prefixPlusIndentLength);
|
|
46
|
+
const valueLines = node.value.split("\n");
|
|
47
|
+
const outputFirstLine = `${indent}${prefix}${valueLines[0]}`;
|
|
48
|
+
const outputSubsequentLines = valueLines.slice(1).map((line) => `${subsequentLinesPrefix}${line}`).join("\n");
|
|
49
|
+
let output = `${outputFirstLine}
|
|
50
|
+
`;
|
|
51
|
+
if (outputSubsequentLines) {
|
|
52
|
+
output += `${outputSubsequentLines}
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
const childPrePrefix = " ".repeat(prefix.length);
|
|
56
|
+
node.children.forEach(
|
|
57
|
+
(child, index) => output += printNode(
|
|
58
|
+
child,
|
|
59
|
+
`${childPrePrefix}${treeIndentationRepresentation(index, indentLevel + 1)}. `,
|
|
60
|
+
indentLevel + 1
|
|
61
|
+
)
|
|
62
|
+
);
|
|
63
|
+
return output;
|
|
64
|
+
};
|
|
65
|
+
function treeReducer(state, action) {
|
|
66
|
+
switch (action.type) {
|
|
67
|
+
case "ADD_NODE": {
|
|
68
|
+
const { value, parentId, id: newNodeId } = action;
|
|
69
|
+
const newNode = {
|
|
70
|
+
id: newNodeId,
|
|
71
|
+
value,
|
|
72
|
+
children: [],
|
|
73
|
+
categories: new Set(action.categories)
|
|
74
|
+
};
|
|
75
|
+
try {
|
|
76
|
+
return addNode(state, newNode, parentId);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error(`Error while adding node with id ${newNodeId}: ${error}`);
|
|
79
|
+
return state;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
case "REMOVE_NODE":
|
|
83
|
+
return removeNode(state, action.id);
|
|
84
|
+
default:
|
|
85
|
+
return state;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
var useTree = () => {
|
|
89
|
+
const [tree, dispatch] = useReducer(treeReducer, []);
|
|
90
|
+
const addElement = useCallback(
|
|
91
|
+
(value, categories, parentId) => {
|
|
92
|
+
const newNodeId = randomId();
|
|
93
|
+
dispatch({
|
|
94
|
+
type: "ADD_NODE",
|
|
95
|
+
value,
|
|
96
|
+
parentId,
|
|
97
|
+
id: newNodeId,
|
|
98
|
+
categories
|
|
99
|
+
});
|
|
100
|
+
return newNodeId;
|
|
101
|
+
},
|
|
102
|
+
[]
|
|
103
|
+
);
|
|
104
|
+
const removeElement = useCallback((id) => {
|
|
105
|
+
dispatch({ type: "REMOVE_NODE", id });
|
|
106
|
+
}, []);
|
|
107
|
+
const printTree = useCallback(
|
|
108
|
+
(categories) => {
|
|
109
|
+
const categoriesSet = new Set(categories);
|
|
110
|
+
let output = "";
|
|
111
|
+
tree.forEach((node, index) => {
|
|
112
|
+
if (!setsHaveIntersection(categoriesSet, node.categories)) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (index !== 0) {
|
|
116
|
+
output += "\n";
|
|
117
|
+
}
|
|
118
|
+
output += printNode(node, `${treeIndentationRepresentation(index, 0)}. `);
|
|
119
|
+
});
|
|
120
|
+
return output;
|
|
121
|
+
},
|
|
122
|
+
[tree]
|
|
123
|
+
);
|
|
124
|
+
return { tree, addElement, printTree, removeElement };
|
|
125
|
+
};
|
|
126
|
+
var use_tree_default = useTree;
|
|
127
|
+
function setsHaveIntersection(setA, setB) {
|
|
128
|
+
const [smallerSet, largerSet] = setA.size <= setB.size ? [setA, setB] : [setB, setA];
|
|
129
|
+
for (let item of smallerSet) {
|
|
130
|
+
if (largerSet.has(item)) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
use_tree_default
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=chunk-6U3UH3KO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-tree.ts"],"sourcesContent":["import { randomId } from \"@copilotkit/shared\";\nimport { useCallback, useReducer } from \"react\";\n\nexport type TreeNodeId = string;\n\nexport interface TreeNode {\n id: TreeNodeId;\n value: string;\n children: TreeNode[];\n parentId?: TreeNodeId;\n categories: Set<string>;\n}\n\nexport type Tree = TreeNode[];\n\nexport interface UseTreeReturn {\n tree: Tree;\n addElement: (value: string, categories: string[], parentId?: TreeNodeId) => TreeNodeId;\n printTree: (categories: string[]) => string;\n removeElement: (id: TreeNodeId) => void;\n}\n\nconst findNode = (nodes: Tree, id: TreeNodeId): TreeNode | undefined => {\n for (const node of nodes) {\n if (node.id === id) {\n return node;\n }\n const result = findNode(node.children, id);\n if (result) {\n return result;\n }\n }\n return undefined;\n};\n\nconst removeNode = (nodes: Tree, id: TreeNodeId): Tree => {\n return nodes.reduce((result: Tree, node) => {\n if (node.id !== id) {\n const newNode = { ...node, children: removeNode(node.children, id) };\n result.push(newNode);\n }\n return result;\n }, []);\n};\n\nconst addNode = (nodes: Tree, newNode: TreeNode, parentId?: TreeNodeId): Tree => {\n if (!parentId) {\n return [...nodes, newNode];\n }\n return nodes.map((node) => {\n if (node.id === parentId) {\n return { ...node, children: [...node.children, newNode] };\n } else if (node.children.length) {\n return { ...node, children: addNode(node.children, newNode, parentId) };\n }\n return node;\n });\n};\n\nconst treeIndentationRepresentation = (index: number, indentLevel: number): string => {\n if (indentLevel === 0) {\n return (index + 1).toString();\n } else if (indentLevel === 1) {\n return String.fromCharCode(65 + index); // 65 is the ASCII value for 'A'\n } else if (indentLevel === 2) {\n return String.fromCharCode(97 + index); // 97 is the ASCII value for 'a'\n } else {\n return \"-\";\n }\n};\n\nconst printNode = (node: TreeNode, prefix = \"\", indentLevel = 0): string => {\n const indent = \" \".repeat(3).repeat(indentLevel);\n\n const prefixPlusIndentLength = prefix.length + indent.length;\n const subsequentLinesPrefix = \" \".repeat(prefixPlusIndentLength);\n\n const valueLines = node.value.split(\"\\n\");\n\n const outputFirstLine = `${indent}${prefix}${valueLines[0]}`;\n const outputSubsequentLines = valueLines\n .slice(1)\n .map((line) => `${subsequentLinesPrefix}${line}`)\n .join(\"\\n\");\n\n let output = `${outputFirstLine}\\n`;\n if (outputSubsequentLines) {\n output += `${outputSubsequentLines}\\n`;\n }\n\n const childPrePrefix = \" \".repeat(prefix.length);\n\n node.children.forEach(\n (child, index) =>\n (output += printNode(\n child,\n `${childPrePrefix}${treeIndentationRepresentation(index, indentLevel + 1)}. `,\n indentLevel + 1,\n )),\n );\n return output;\n};\n\n// Action types\ntype Action =\n | {\n type: \"ADD_NODE\";\n value: string;\n parentId?: string;\n id: string;\n categories: string[];\n }\n | { type: \"REMOVE_NODE\"; id: string };\n\n// Reducer function\nfunction treeReducer(state: Tree, action: Action): Tree {\n switch (action.type) {\n case \"ADD_NODE\": {\n const { value, parentId, id: newNodeId } = action;\n const newNode: TreeNode = {\n id: newNodeId,\n value,\n children: [],\n categories: new Set(action.categories),\n };\n\n try {\n return addNode(state, newNode, parentId);\n } catch (error) {\n console.error(`Error while adding node with id ${newNodeId}: ${error}`);\n return state;\n }\n }\n case \"REMOVE_NODE\":\n return removeNode(state, action.id);\n default:\n return state;\n }\n}\n\n// useTree hook\nconst useTree = (): UseTreeReturn => {\n const [tree, dispatch] = useReducer(treeReducer, []);\n\n const addElement = useCallback(\n (value: string, categories: string[], parentId?: string): TreeNodeId => {\n const newNodeId = randomId(); // Generate new ID outside of dispatch\n dispatch({\n type: \"ADD_NODE\",\n value,\n parentId,\n id: newNodeId,\n categories: categories,\n });\n return newNodeId; // Return the new ID\n },\n [],\n );\n\n const removeElement = useCallback((id: TreeNodeId): void => {\n dispatch({ type: \"REMOVE_NODE\", id });\n }, []);\n\n const printTree = useCallback(\n (categories: string[]): string => {\n const categoriesSet = new Set(categories);\n\n let output = \"\";\n tree.forEach((node, index) => {\n // if the node does not have any of the desired categories, continue to the next node\n if (!setsHaveIntersection(categoriesSet, node.categories)) {\n return;\n }\n\n // add a new line before each node except the first one\n if (index !== 0) {\n output += \"\\n\";\n }\n\n output += printNode(node, `${treeIndentationRepresentation(index, 0)}. `);\n });\n return output;\n },\n [tree],\n );\n\n return { tree, addElement, printTree, removeElement };\n};\n\nexport default useTree;\n\nfunction setsHaveIntersection<T>(setA: Set<T>, setB: Set<T>): boolean {\n const [smallerSet, largerSet] = setA.size <= setB.size ? [setA, setB] : [setB, setA];\n\n for (let item of smallerSet) {\n if (largerSet.has(item)) {\n return true;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,aAAa,kBAAkB;AAkCxC,IAAM,aAAa,CAAC,OAAa,OAAyB;AACxD,SAAO,MAAM,OAAO,CAAC,QAAc,SAAS;AAC1C,QAAI,KAAK,OAAO,IAAI;AAClB,YAAM,UAAU,iCAAK,OAAL,EAAW,UAAU,WAAW,KAAK,UAAU,EAAE,EAAE;A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AAI,UAAU;AAExC,UAAI,SAAS;AACb,WAAK,QAAQ,CAAC,MAAM,UAAU;AAE5B,YAAI,CAAC,qBAAqB,eAAe,KAAK,UAAU,GAAG;AACzD;AAAA,QACF;AAGA,YAAI,UAAU,GAAG;AACf,oBAAU;AAAA,QACZ;AAEA,kBAAU,UAAU,MAAM,GAAG,8BAA8B,OAAO,CAAC,KAAK;AAAA,MAC1E,CAAC;AACD,aAAO;AAAA,IACT;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO,EAAE,MAAM,YAAY,WAAW,cAAc;AACtD;AAEA,IAAO,mBAAQ;AAEf,SAAS,qBAAwB,MAAc,MAAuB;AACpE,QAAM,CAAC,YAAY,SAAS,IAAI,KAAK,QAAQ,KAAK,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI;AAEnF,WAAS,QAAQ,YAAY;AAC3B,QAAI,UAAU,IAAI,IAAI,GAAG;AACvB,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCopilotContext
|
|
3
|
+
} from "./chunk-XQFVXX6R.mjs";
|
|
4
|
+
|
|
5
|
+
// src/hooks/use-copilot-readable.ts
|
|
6
|
+
import { useEffect, useRef } from "react";
|
|
7
|
+
function convertToJSON(description, value) {
|
|
8
|
+
return `${description}: ${typeof value === "string" ? value : JSON.stringify(value)}`;
|
|
9
|
+
}
|
|
10
|
+
function useCopilotReadable({ description, value, parentId, categories, convert }, dependencies) {
|
|
11
|
+
const { addContext, removeContext } = useCopilotContext();
|
|
12
|
+
const idRef = useRef();
|
|
13
|
+
convert = convert || convertToJSON;
|
|
14
|
+
const information = convert(description, value);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const id = addContext(information, parentId, categories);
|
|
17
|
+
idRef.current = id;
|
|
18
|
+
return () => {
|
|
19
|
+
removeContext(id);
|
|
20
|
+
};
|
|
21
|
+
}, [information, parentId, addContext, removeContext, ...dependencies || []]);
|
|
22
|
+
return idRef.current;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
useCopilotReadable
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=chunk-AG7FH7OD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-copilot-readable.ts"],"sourcesContent":["/**\n * `useCopilotReadable` is a React hook that provides app-state and other information\n * to the Copilot. Optionally, the hook can also handle hierarchical state within your\n * application, passing these parent-child relationships to the Copilot.\n *\n * ## Usage\n *\n * ### Simple Usage\n *\n * In its most basic usage, useCopilotReadable accepts a single string argument\n * representing any piece of app state, making it available for the Copilot to use\n * as context when responding to user input.\n *\n * ```tsx\n * import { useCopilotReadable } from \"@copilotkit/react-core\";\n *\n * export function MyComponent() {\n * const [employees, setEmployees] = useState([]);\n *\n * useCopilotReadable({\n * description: \"The list of employees\",\n * value: employees,\n * });\n * }\n * ```\n *\n * ### Nested Components\n *\n * Optionally, you can maintain the hierarchical structure of information by passing\n * `parentId`. This allows you to use `useCopilotReadable` in nested components:\n *\n * ```tsx /employeeContextId/1 {17,23}\n * import { useCopilotReadable } from \"@copilotkit/react-core\";\n *\n * function Employee(props: EmployeeProps) {\n * const { employeeName, workProfile, metadata } = props;\n *\n * // propagate any information to copilot\n * const employeeContextId = useCopilotReadable({\n * description: \"Employee name\",\n * value: employeeName\n * });\n *\n * // Pass a parentID to maintain a hierarchical structure.\n * // Especially useful with child React components, list elements, etc.\n * useCopilotReadable({\n * description: \"Work profile\",\n * value: workProfile.description(),\n * parentId: employeeContextId\n * });\n *\n * useCopilotReadable({\n * description: \"Employee metadata\",\n * value: metadata.description(),\n * parentId: employeeContextId\n * });\n *\n * return (\n * // Render as usual...\n * );\n * }\n * ```\n */\nimport { useEffect, useRef } from \"react\";\nimport { useCopilotContext } from \"../context/copilot-context\";\n\n/**\n * Options for the useCopilotReadable hook.\n */\nexport interface UseCopilotReadableOptions {\n /**\n * The description of the information to be added to the Copilot context.\n */\n description: string;\n /**\n * The value to be added to the Copilot context. Object values are automatically stringified.\n */\n value: any;\n /**\n * The ID of the parent context, if any.\n */\n parentId?: string;\n /**\n * An array of categories to control which context are visible where. Particularly useful\n * with CopilotTextarea (see `useMakeAutosuggestionFunction`)\n */\n categories?: string[];\n\n /**\n * A custom conversion function to use to serialize the value to a string. If not provided, the value\n * will be serialized using `JSON.stringify`.\n */\n convert?: (description: string, value: any) => string;\n}\n\nfunction convertToJSON(description: string, value: any): string {\n return `${description}: ${typeof value === \"string\" ? value : JSON.stringify(value)}`;\n}\n\n/**\n * Adds the given information to the Copilot context to make it readable by Copilot.\n */\nexport function useCopilotReadable(\n { description, value, parentId, categories, convert }: UseCopilotReadableOptions,\n dependencies?: any[],\n): string | undefined {\n const { addContext, removeContext } = useCopilotContext();\n const idRef = useRef<string>();\n convert = convert || convertToJSON;\n\n const information = convert(description, value);\n\n useEffect(() => {\n const id = addContext(information, parentId, categories);\n idRef.current = id;\n\n return () => {\n removeContext(id);\n };\n }, [information, parentId, addContext, removeContext, ...(dependencies || [])]);\n\n return idRef.current;\n}\n"],"mappings":";;;;;AA+DA,SAAS,WAAW,cAAc;AAgClC,SAAS,cAAc,aAAqB,OAAoB;AAC9D,SAAO,GAAG,gBAAgB,OAAO,UAAU,WAAW,QAAQ,KAAK,UAAU,KAAK;AACpF;AAKO,SAAS,mBACd,EAAE,aAAa,OAAO,UAAU,YAAY,QAAQ,GACpD,cACoB;AACpB,QAAM,EAAE,YAAY,cAAc,IAAI,kBAAkB;AACxD,QAAM,QAAQ,OAAe;AAC7B,YAAU,WAAW;AAErB,QAAM,cAAc,QAAQ,aAAa,KAAK;AAE9C,YAAU,MAAM;AACd,UAAM,KAAK,WAAW,aAAa,UAAU,UAAU;AACvD,UAAM,UAAU;AAEhB,WAAO,MAAM;AACX,oBAAc,EAAE;AAAA,IAClB;AAAA,EACF,GAAG,CAAC,aAAa,UAAU,YAAY,eAAe,GAAI,gBAAgB,CAAC,CAAE,CAAC;AAE9E,SAAO,MAAM;AACf;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/context/copilot-messages-context.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
var emptyCopilotContext = {
|
|
4
|
+
messages: [],
|
|
5
|
+
setMessages: () => []
|
|
6
|
+
};
|
|
7
|
+
var CopilotMessagesContext = React.createContext(emptyCopilotContext);
|
|
8
|
+
function useCopilotMessagesContext() {
|
|
9
|
+
const context = React.useContext(CopilotMessagesContext);
|
|
10
|
+
if (context === emptyCopilotContext) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
"A messages consuming component was not wrapped with `<CopilotMessages> {...} </CopilotMessages>`"
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
CopilotMessagesContext,
|
|
20
|
+
useCopilotMessagesContext
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=chunk-DCTJZ742.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/context/copilot-messages-context.tsx"],"sourcesContent":["/**\n * An internal context to separate the messages state (which is constantly changing) from the rest of CopilotKit context\n */\n\nimport { Message } from \"@copilotkit/runtime-client-gql\";\nimport React from \"react\";\n\nexport interface CopilotMessagesContextParams {\n messages: Message[];\n setMessages: React.Dispatch<React.SetStateAction<Message[]>>;\n}\n\nconst emptyCopilotContext: CopilotMessagesContextParams = {\n messages: [],\n setMessages: () => [],\n};\n\nexport const CopilotMessagesContext =\n React.createContext<CopilotMessagesContextParams>(emptyCopilotContext);\n\nexport function useCopilotMessagesContext(): CopilotMessagesContextParams {\n const context = React.useContext(CopilotMessagesContext);\n if (context === emptyCopilotContext) {\n throw new Error(\n \"A messages consuming component was not wrapped with `<CopilotMessages> {...} </CopilotMessages>`\",\n );\n }\n return context;\n}\n"],"mappings":";AAKA,OAAO,WAAW;AAOlB,IAAM,sBAAoD;AAAA,EACxD,UAAU,CAAC;AAAA,EACX,aAAa,MAAM,CAAC;AACtB;AAEO,IAAM,yBACX,MAAM,cAA4C,mBAAmB;AAEhE,SAAS,4BAA0D;AACxE,QAAM,UAAU,MAAM,WAAW,sBAAsB;AACvD,MAAI,YAAY,qBAAqB;AACnC,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|