@copilotkit/react-core 1.5.1-next.2 → 1.5.1-next.3

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 (146) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{chunk-LNI2Z45S.mjs → chunk-2KCEHGSI.mjs} +50 -100
  3. package/dist/chunk-2KCEHGSI.mjs.map +1 -0
  4. package/dist/{chunk-2KT73RVG.mjs → chunk-6OR25P32.mjs} +19 -75
  5. package/dist/chunk-6OR25P32.mjs.map +1 -0
  6. package/dist/{chunk-3GQPEN4M.mjs → chunk-DDVXFNYA.mjs} +32 -66
  7. package/dist/chunk-DDVXFNYA.mjs.map +1 -0
  8. package/dist/{chunk-XOQMISG3.mjs → chunk-FXHKK52V.mjs} +13 -14
  9. package/dist/chunk-FXHKK52V.mjs.map +1 -0
  10. package/dist/{chunk-HIUT2NLX.mjs → chunk-H4VZMKR6.mjs} +2 -2
  11. package/dist/{chunk-X36DNILG.mjs → chunk-H7LSKIDK.mjs} +23 -71
  12. package/dist/chunk-H7LSKIDK.mjs.map +1 -0
  13. package/dist/chunk-JDQCJCAQ.mjs +295 -0
  14. package/dist/chunk-JDQCJCAQ.mjs.map +1 -0
  15. package/dist/chunk-L34MHAXR.mjs +1 -0
  16. package/dist/{chunk-WXREY7UP.mjs → chunk-LODRWFMB.mjs} +4 -16
  17. package/dist/chunk-LODRWFMB.mjs.map +1 -0
  18. package/dist/{chunk-EWKJMQOF.mjs → chunk-MWZO6TUR.mjs} +13 -29
  19. package/dist/chunk-MWZO6TUR.mjs.map +1 -0
  20. package/dist/{chunk-6BQVZFNO.mjs → chunk-ODN4H66E.mjs} +2 -6
  21. package/dist/chunk-ODN4H66E.mjs.map +1 -0
  22. package/dist/{chunk-FQ53HQYZ.mjs → chunk-QDGDXRRJ.mjs} +2 -2
  23. package/dist/{chunk-22XKTBPF.mjs → chunk-XINZBP3J.mjs} +3 -15
  24. package/dist/chunk-XINZBP3J.mjs.map +1 -0
  25. package/dist/components/copilot-provider/copilot-messages.d.ts +0 -9
  26. package/dist/components/copilot-provider/copilotkit-props.d.ts +0 -21
  27. package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
  28. package/dist/components/copilot-provider/copilotkit.d.ts +0 -9
  29. package/dist/components/copilot-provider/copilotkit.js +95 -224
  30. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  31. package/dist/components/copilot-provider/copilotkit.mjs +8 -9
  32. package/dist/components/copilot-provider/index.d.ts +0 -9
  33. package/dist/components/copilot-provider/index.js +95 -224
  34. package/dist/components/copilot-provider/index.js.map +1 -1
  35. package/dist/components/copilot-provider/index.mjs +8 -9
  36. package/dist/components/index.d.ts +0 -9
  37. package/dist/components/index.js +95 -224
  38. package/dist/components/index.js.map +1 -1
  39. package/dist/components/index.mjs +8 -9
  40. package/dist/components/toast/toast-provider.d.ts +1 -2
  41. package/dist/components/toast/toast-provider.js +63 -77
  42. package/dist/components/toast/toast-provider.js.map +1 -1
  43. package/dist/components/toast/toast-provider.mjs +1 -1
  44. package/dist/context/copilot-context.d.ts +4 -37
  45. package/dist/context/copilot-context.js +3 -15
  46. package/dist/context/copilot-context.js.map +1 -1
  47. package/dist/context/copilot-context.mjs +1 -1
  48. package/dist/context/index.d.ts +1 -1
  49. package/dist/context/index.js +3 -15
  50. package/dist/context/index.js.map +1 -1
  51. package/dist/context/index.mjs +4 -4
  52. package/dist/hooks/index.d.ts +1 -3
  53. package/dist/hooks/index.js +297 -703
  54. package/dist/hooks/index.js.map +1 -1
  55. package/dist/hooks/index.mjs +23 -35
  56. package/dist/hooks/use-chat.d.ts +3 -35
  57. package/dist/hooks/use-chat.js +205 -453
  58. package/dist/hooks/use-chat.js.map +1 -1
  59. package/dist/hooks/use-chat.mjs +3 -4
  60. package/dist/hooks/use-coagent-state-render.d.ts +2 -2
  61. package/dist/hooks/use-coagent-state-render.js +8 -43
  62. package/dist/hooks/use-coagent-state-render.js.map +1 -1
  63. package/dist/hooks/use-coagent-state-render.mjs +2 -4
  64. package/dist/hooks/use-coagent.d.ts +1 -14
  65. package/dist/hooks/use-coagent.js +265 -603
  66. package/dist/hooks/use-coagent.js.map +1 -1
  67. package/dist/hooks/use-coagent.mjs +12 -20
  68. package/dist/hooks/use-copilot-action.d.ts +2 -12
  69. package/dist/hooks/use-copilot-action.js +19 -169
  70. package/dist/hooks/use-copilot-action.js.map +1 -1
  71. package/dist/hooks/use-copilot-action.mjs +2 -4
  72. package/dist/hooks/use-copilot-chat.d.ts +0 -2
  73. package/dist/hooks/use-copilot-chat.js +240 -545
  74. package/dist/hooks/use-copilot-chat.js.map +1 -1
  75. package/dist/hooks/use-copilot-chat.mjs +11 -13
  76. package/dist/hooks/use-copilot-readable.js +3 -15
  77. package/dist/hooks/use-copilot-readable.js.map +1 -1
  78. package/dist/hooks/use-copilot-readable.mjs +2 -2
  79. package/dist/hooks/use-copilot-runtime-client.js +4 -110
  80. package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
  81. package/dist/hooks/use-copilot-runtime-client.mjs +2 -2
  82. package/dist/hooks/use-make-copilot-document-readable.js +3 -15
  83. package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
  84. package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
  85. package/dist/index.d.ts +3 -4
  86. package/dist/index.js +398 -812
  87. package/dist/index.js.map +1 -1
  88. package/dist/index.mjs +31 -43
  89. package/dist/lib/copilot-task.d.ts +1 -6
  90. package/dist/lib/copilot-task.js +17 -55
  91. package/dist/lib/copilot-task.js.map +1 -1
  92. package/dist/lib/copilot-task.mjs +9 -11
  93. package/dist/lib/index.d.ts +1 -1
  94. package/dist/lib/index.js +17 -55
  95. package/dist/lib/index.js.map +1 -1
  96. package/dist/lib/index.mjs +9 -11
  97. package/dist/types/frontend-action.d.ts +2 -21
  98. package/dist/types/frontend-action.js +0 -34
  99. package/dist/types/frontend-action.js.map +1 -1
  100. package/dist/types/frontend-action.mjs +0 -7
  101. package/dist/types/index.d.ts +1 -2
  102. package/dist/types/index.js.map +1 -1
  103. package/dist/utils/extract.d.ts +2 -3
  104. package/dist/utils/extract.js +3 -21
  105. package/dist/utils/extract.js.map +1 -1
  106. package/dist/utils/extract.mjs +8 -9
  107. package/dist/utils/index.js +3 -21
  108. package/dist/utils/index.js.map +1 -1
  109. package/dist/utils/index.mjs +9 -10
  110. package/package.json +5 -5
  111. package/dist/chunk-22XKTBPF.mjs.map +0 -1
  112. package/dist/chunk-2KT73RVG.mjs.map +0 -1
  113. package/dist/chunk-3GQPEN4M.mjs.map +0 -1
  114. package/dist/chunk-6BQVZFNO.mjs.map +0 -1
  115. package/dist/chunk-EWKJMQOF.mjs.map +0 -1
  116. package/dist/chunk-LHKIIAUQ.mjs +0 -59
  117. package/dist/chunk-LHKIIAUQ.mjs.map +0 -1
  118. package/dist/chunk-LNI2Z45S.mjs.map +0 -1
  119. package/dist/chunk-NR2BTA6Z.mjs +0 -1
  120. package/dist/chunk-VGOFRULA.mjs +0 -401
  121. package/dist/chunk-VGOFRULA.mjs.map +0 -1
  122. package/dist/chunk-VNTDIJSG.mjs +0 -37
  123. package/dist/chunk-VNTDIJSG.mjs.map +0 -1
  124. package/dist/chunk-WXREY7UP.mjs.map +0 -1
  125. package/dist/chunk-X36DNILG.mjs.map +0 -1
  126. package/dist/chunk-XERJQUHA.mjs +0 -31
  127. package/dist/chunk-XERJQUHA.mjs.map +0 -1
  128. package/dist/chunk-XOQMISG3.mjs.map +0 -1
  129. package/dist/components/error-boundary/error-boundary.d.ts +0 -22
  130. package/dist/components/error-boundary/error-boundary.js +0 -183
  131. package/dist/components/error-boundary/error-boundary.js.map +0 -1
  132. package/dist/components/error-boundary/error-boundary.mjs +0 -12
  133. package/dist/components/error-boundary/error-boundary.mjs.map +0 -1
  134. package/dist/components/error-boundary/error-utils.d.ts +0 -11
  135. package/dist/components/error-boundary/error-utils.js +0 -177
  136. package/dist/components/error-boundary/error-utils.js.map +0 -1
  137. package/dist/components/error-boundary/error-utils.mjs +0 -13
  138. package/dist/components/error-boundary/error-utils.mjs.map +0 -1
  139. package/dist/hooks/use-copilot-authenticated-action.d.ts +0 -8
  140. package/dist/hooks/use-copilot-authenticated-action.js +0 -418
  141. package/dist/hooks/use-copilot-authenticated-action.js.map +0 -1
  142. package/dist/hooks/use-copilot-authenticated-action.mjs +0 -12
  143. package/dist/hooks/use-copilot-authenticated-action.mjs.map +0 -1
  144. /package/dist/{chunk-HIUT2NLX.mjs.map → chunk-H4VZMKR6.mjs.map} +0 -0
  145. /package/dist/{chunk-NR2BTA6Z.mjs.map → chunk-L34MHAXR.mjs.map} +0 -0
  146. /package/dist/{chunk-FQ53HQYZ.mjs.map → chunk-QDGDXRRJ.mjs.map} +0 -0
@@ -1,22 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React from 'react';
3
-
4
- interface Props {
5
- children: React.ReactNode;
6
- }
7
- interface State {
8
- hasError: boolean;
9
- error?: Error;
10
- }
11
- declare class CopilotErrorBoundary extends React.Component<Props, State> {
12
- constructor(props: Props);
13
- static getDerivedStateFromError(error: Error): State;
14
- componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
15
- render(): react_jsx_runtime.JSX.Element;
16
- }
17
- declare function ErrorToast({ error, children }: {
18
- error?: Error;
19
- children: React.ReactNode;
20
- }): React.ReactNode;
21
-
22
- export { CopilotErrorBoundary, ErrorToast };
@@ -1,183 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/components/error-boundary/error-boundary.tsx
31
- var error_boundary_exports = {};
32
- __export(error_boundary_exports, {
33
- CopilotErrorBoundary: () => CopilotErrorBoundary,
34
- ErrorToast: () => ErrorToast2
35
- });
36
- module.exports = __toCommonJS(error_boundary_exports);
37
- var import_react3 = __toESM(require("react"));
38
-
39
- // src/components/error-boundary/error-utils.tsx
40
- var import_react2 = require("react");
41
-
42
- // src/components/toast/toast-provider.tsx
43
- var import_react = require("react");
44
- var import_jsx_runtime = require("react/jsx-runtime");
45
- var ToastContext = (0, import_react.createContext)(void 0);
46
- function useToast() {
47
- const context = (0, import_react.useContext)(ToastContext);
48
- if (!context) {
49
- throw new Error("useToast must be used within a ToastProvider");
50
- }
51
- return context;
52
- }
53
-
54
- // src/components/toast/exclamation-mark-icon.tsx
55
- var import_jsx_runtime2 = require("react/jsx-runtime");
56
- var ExclamationMarkIcon = ({
57
- className,
58
- style
59
- }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
60
- "svg",
61
- {
62
- xmlns: "http://www.w3.org/2000/svg",
63
- width: "24",
64
- height: "24",
65
- viewBox: "0 0 24 24",
66
- fill: "none",
67
- stroke: "currentColor",
68
- strokeWidth: "2",
69
- strokeLinecap: "round",
70
- strokeLinejoin: "round",
71
- className: `lucide lucide-circle-alert ${className ? className : ""}`,
72
- style,
73
- children: [
74
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
75
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", x2: "12", y1: "8", y2: "12" }),
76
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })
77
- ]
78
- }
79
- );
80
-
81
- // src/components/error-boundary/error-utils.tsx
82
- var import_jsx_runtime3 = require("react/jsx-runtime");
83
- function ErrorToast({ errors }) {
84
- const errorsToRender = errors.map((error, idx) => {
85
- var _a, _b, _c;
86
- const message = "extensions" in error ? (_b = (_a = error.extensions) == null ? void 0 : _a.originalError) == null ? void 0 : _b.message : error.message;
87
- const code = "extensions" in error ? (_c = error.extensions) == null ? void 0 : _c.code : null;
88
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
89
- "div",
90
- {
91
- style: {
92
- marginTop: idx === 0 ? 0 : 10,
93
- marginBottom: 14
94
- },
95
- children: [
96
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ExclamationMarkIcon, { style: { marginBottom: 4 } }),
97
- code && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
98
- "div",
99
- {
100
- style: {
101
- fontWeight: "600",
102
- marginBottom: 4
103
- },
104
- children: [
105
- "Copilot Cloud Error:",
106
- " ",
107
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontFamily: "monospace", fontWeight: "normal" }, children: code })
108
- ]
109
- }
110
- ),
111
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: message })
112
- ]
113
- },
114
- idx
115
- );
116
- });
117
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
118
- "div",
119
- {
120
- style: {
121
- fontSize: "13px",
122
- maxWidth: "600px"
123
- },
124
- children: [
125
- errorsToRender,
126
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: "11px", opacity: 0.75 }, children: "NOTE: This error only displays during local development." })
127
- ]
128
- }
129
- );
130
- }
131
- function useErrorToast() {
132
- const { addToast } = useToast();
133
- return (0, import_react2.useCallback)(
134
- (error) => {
135
- const errorId = error.map((err) => {
136
- var _a, _b;
137
- const message = "extensions" in err ? ((_b = (_a = err.extensions) == null ? void 0 : _a.originalError) == null ? void 0 : _b.message) || err.message : err.message;
138
- const stack = err.stack || "";
139
- return btoa(message + stack).slice(0, 32);
140
- }).join("|");
141
- addToast({
142
- type: "error",
143
- id: errorId,
144
- // Toast libraries typically dedupe by id
145
- message: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorToast, { errors: error })
146
- });
147
- },
148
- [addToast]
149
- );
150
- }
151
-
152
- // src/components/error-boundary/error-boundary.tsx
153
- var import_jsx_runtime4 = require("react/jsx-runtime");
154
- var CopilotErrorBoundary = class extends import_react3.default.Component {
155
- constructor(props) {
156
- super(props);
157
- this.state = { hasError: false };
158
- }
159
- static getDerivedStateFromError(error) {
160
- return { hasError: true, error };
161
- }
162
- componentDidCatch(error, errorInfo) {
163
- console.error("CopilotKit Error:", error, errorInfo);
164
- }
165
- render() {
166
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorToast2, { error: this.state.error, children: this.props.children });
167
- }
168
- };
169
- function ErrorToast2({ error, children }) {
170
- const addErrorToast = useErrorToast();
171
- (0, import_react3.useEffect)(() => {
172
- if (error) {
173
- addErrorToast([error]);
174
- }
175
- }, [error, addErrorToast]);
176
- return children;
177
- }
178
- // Annotate the CommonJS export names for ESM import in node:
179
- 0 && (module.exports = {
180
- CopilotErrorBoundary,
181
- ErrorToast
182
- });
183
- //# sourceMappingURL=error-boundary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/error-boundary/error-boundary.tsx","../../../src/components/error-boundary/error-utils.tsx","../../../src/components/toast/toast-provider.tsx","../../../src/components/toast/exclamation-mark-icon.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { useErrorToast } from \"./error-utils\";\n\ninterface Props {\n children: React.ReactNode;\n}\n\ninterface State {\n hasError: boolean;\n error?: Error;\n}\n\nexport class CopilotErrorBoundary extends React.Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(error: Error): State {\n return { hasError: true, error };\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {\n console.error(\"CopilotKit Error:\", error, errorInfo);\n }\n\n render() {\n return <ErrorToast error={this.state.error}>{this.props.children}</ErrorToast>;\n }\n}\n\nexport function ErrorToast({ error, children }: { error?: Error; children: React.ReactNode }) {\n const addErrorToast = useErrorToast();\n\n useEffect(() => {\n if (error) {\n addErrorToast([error]);\n }\n }, [error, addErrorToast]);\n\n return children;\n}\n","import React, { useCallback, useEffect } from \"react\";\nimport { GraphQLError } from \"@copilotkit/runtime-client-gql\";\nimport { useToast } from \"../toast/toast-provider\";\nimport { ExclamationMarkIcon } from \"../toast/exclamation-mark-icon\";\n\nexport function ErrorToast({ errors }: { errors: (Error | GraphQLError)[] }) {\n const errorsToRender = errors.map((error, idx) => {\n const message =\n \"extensions\" in error\n ? (error.extensions?.originalError as undefined | { message?: string })?.message\n : error.message;\n const code = \"extensions\" in error ? (error.extensions?.code as string) : null;\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 return (\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 error only displays during local development.\n </div>\n </div>\n );\n}\n\nexport function useErrorToast() {\n const { addToast } = useToast();\n\n return useCallback(\n (error: (Error | GraphQLError)[]) => {\n const errorId = error\n .map((err) => {\n const message =\n \"extensions\" in err\n ? (err.extensions?.originalError as any)?.message || err.message\n : err.message;\n const stack = err.stack || \"\";\n return btoa(message + stack).slice(0, 32); // Create hash from message + stack\n })\n .join(\"|\");\n\n addToast({\n type: \"error\",\n id: errorId, // Toast libraries typically dedupe by id\n message: <ErrorToast errors={error} />,\n });\n },\n [addToast],\n );\n}\n\nexport function useAsyncCallback<T extends (...args: any[]) => Promise<any>>(\n callback: T,\n deps: Parameters<typeof useCallback>[1],\n) {\n const addErrorToast = useErrorToast();\n return useCallback(async (...args: Parameters<T>) => {\n try {\n return await callback(...args);\n } catch (error) {\n console.error(\"Error in async callback:\", error);\n // @ts-ignore\n addErrorToast([error]);\n throw error;\n }\n }, deps);\n}\n","import { GraphQLError } from \"@copilotkit/runtime-client-gql\";\nimport React, { createContext, useContext, useState, useCallback } from \"react\";\nimport { ErrorToast } from \"../error-boundary/error-utils\";\nimport { PartialBy } from \"@copilotkit/shared\";\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: PartialBy<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: PartialBy<Toast, \"id\">) => {\n const id = toast.id ?? Math.random().toString(36).substring(2, 9);\n\n setToasts((currentToasts) => {\n if (currentToasts.find((toast) => toast.id === id)) return currentToasts;\n return [...currentToasts, { ...toast, id }];\n });\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 addToast({\n type: \"error\",\n message: <ErrorToast errors={errors} />,\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 1.5rem\",\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","import React from \"react\";\n\nexport const ExclamationMarkIcon = ({\n className,\n style,\n}: {\n className?: string;\n style?: React.CSSProperties;\n}) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={`lucide lucide-circle-alert ${className ? className : \"\"}`}\n style={style}\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" />\n <line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oBAAAA;AAAA;AAAA;AAAA,IAAAC,gBAAiC;;;ACAjC,IAAAC,gBAA8C;;;ACC9C,mBAAwE;AA4DzD;AAzCf,IAAM,mBAAe,4BAA6C,MAAS;AAEpE,SAAS,WAAW;AACzB,QAAM,cAAU,yBAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,8CAA8C;AAAA,EAChE;AACA,SAAO;AACT;;;ACnBE,IAAAC,sBAAA;AAPK,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AACF,MAIE;AAAA,EAAC;AAAA;AAAA,IACC,OAAM;AAAA,IACN,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,aAAY;A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SAAO;AACT;","names":["ErrorToast","import_react","import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","React","ErrorToast"]}
@@ -1,12 +0,0 @@
1
- import {
2
- CopilotErrorBoundary,
3
- ErrorToast
4
- } from "../../chunk-VNTDIJSG.mjs";
5
- import "../../chunk-LNI2Z45S.mjs";
6
- import "../../chunk-O7ARI5CV.mjs";
7
- import "../../chunk-SKC7AJIV.mjs";
8
- export {
9
- CopilotErrorBoundary,
10
- ErrorToast
11
- };
12
- //# sourceMappingURL=error-boundary.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,11 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { useCallback } from 'react';
3
- import { GraphQLError } from '@copilotkit/runtime-client-gql';
4
-
5
- declare function ErrorToast({ errors }: {
6
- errors: (Error | GraphQLError)[];
7
- }): react_jsx_runtime.JSX.Element;
8
- declare function useErrorToast(): (error: (Error | GraphQLError)[]) => void;
9
- declare function useAsyncCallback<T extends (...args: any[]) => Promise<any>>(callback: T, deps: Parameters<typeof useCallback>[1]): (...args: Parameters<T>) => Promise<any>;
10
-
11
- export { ErrorToast, useAsyncCallback, useErrorToast };
@@ -1,177 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var __async = (__this, __arguments, generator) => {
20
- return new Promise((resolve, reject) => {
21
- var fulfilled = (value) => {
22
- try {
23
- step(generator.next(value));
24
- } catch (e) {
25
- reject(e);
26
- }
27
- };
28
- var rejected = (value) => {
29
- try {
30
- step(generator.throw(value));
31
- } catch (e) {
32
- reject(e);
33
- }
34
- };
35
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
36
- step((generator = generator.apply(__this, __arguments)).next());
37
- });
38
- };
39
-
40
- // src/components/error-boundary/error-utils.tsx
41
- var error_utils_exports = {};
42
- __export(error_utils_exports, {
43
- ErrorToast: () => ErrorToast,
44
- useAsyncCallback: () => useAsyncCallback,
45
- useErrorToast: () => useErrorToast
46
- });
47
- module.exports = __toCommonJS(error_utils_exports);
48
- var import_react2 = require("react");
49
-
50
- // src/components/toast/toast-provider.tsx
51
- var import_react = require("react");
52
- var import_jsx_runtime = require("react/jsx-runtime");
53
- var ToastContext = (0, import_react.createContext)(void 0);
54
- function useToast() {
55
- const context = (0, import_react.useContext)(ToastContext);
56
- if (!context) {
57
- throw new Error("useToast must be used within a ToastProvider");
58
- }
59
- return context;
60
- }
61
-
62
- // src/components/toast/exclamation-mark-icon.tsx
63
- var import_jsx_runtime2 = require("react/jsx-runtime");
64
- var ExclamationMarkIcon = ({
65
- className,
66
- style
67
- }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
68
- "svg",
69
- {
70
- xmlns: "http://www.w3.org/2000/svg",
71
- width: "24",
72
- height: "24",
73
- viewBox: "0 0 24 24",
74
- fill: "none",
75
- stroke: "currentColor",
76
- strokeWidth: "2",
77
- strokeLinecap: "round",
78
- strokeLinejoin: "round",
79
- className: `lucide lucide-circle-alert ${className ? className : ""}`,
80
- style,
81
- children: [
82
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
83
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", x2: "12", y1: "8", y2: "12" }),
84
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })
85
- ]
86
- }
87
- );
88
-
89
- // src/components/error-boundary/error-utils.tsx
90
- var import_jsx_runtime3 = require("react/jsx-runtime");
91
- function ErrorToast({ errors }) {
92
- const errorsToRender = errors.map((error, idx) => {
93
- var _a, _b, _c;
94
- const message = "extensions" in error ? (_b = (_a = error.extensions) == null ? void 0 : _a.originalError) == null ? void 0 : _b.message : error.message;
95
- const code = "extensions" in error ? (_c = error.extensions) == null ? void 0 : _c.code : null;
96
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
97
- "div",
98
- {
99
- style: {
100
- marginTop: idx === 0 ? 0 : 10,
101
- marginBottom: 14
102
- },
103
- children: [
104
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ExclamationMarkIcon, { style: { marginBottom: 4 } }),
105
- code && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
106
- "div",
107
- {
108
- style: {
109
- fontWeight: "600",
110
- marginBottom: 4
111
- },
112
- children: [
113
- "Copilot Cloud Error:",
114
- " ",
115
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontFamily: "monospace", fontWeight: "normal" }, children: code })
116
- ]
117
- }
118
- ),
119
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: message })
120
- ]
121
- },
122
- idx
123
- );
124
- });
125
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
126
- "div",
127
- {
128
- style: {
129
- fontSize: "13px",
130
- maxWidth: "600px"
131
- },
132
- children: [
133
- errorsToRender,
134
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: "11px", opacity: 0.75 }, children: "NOTE: This error only displays during local development." })
135
- ]
136
- }
137
- );
138
- }
139
- function useErrorToast() {
140
- const { addToast } = useToast();
141
- return (0, import_react2.useCallback)(
142
- (error) => {
143
- const errorId = error.map((err) => {
144
- var _a, _b;
145
- const message = "extensions" in err ? ((_b = (_a = err.extensions) == null ? void 0 : _a.originalError) == null ? void 0 : _b.message) || err.message : err.message;
146
- const stack = err.stack || "";
147
- return btoa(message + stack).slice(0, 32);
148
- }).join("|");
149
- addToast({
150
- type: "error",
151
- id: errorId,
152
- // Toast libraries typically dedupe by id
153
- message: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorToast, { errors: error })
154
- });
155
- },
156
- [addToast]
157
- );
158
- }
159
- function useAsyncCallback(callback, deps) {
160
- const addErrorToast = useErrorToast();
161
- return (0, import_react2.useCallback)((...args) => __async(this, null, function* () {
162
- try {
163
- return yield callback(...args);
164
- } catch (error) {
165
- console.error("Error in async callback:", error);
166
- addErrorToast([error]);
167
- throw error;
168
- }
169
- }), deps);
170
- }
171
- // Annotate the CommonJS export names for ESM import in node:
172
- 0 && (module.exports = {
173
- ErrorToast,
174
- useAsyncCallback,
175
- useErrorToast
176
- });
177
- //# sourceMappingURL=error-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/error-boundary/error-utils.tsx","../../../src/components/toast/toast-provider.tsx","../../../src/components/toast/exclamation-mark-icon.tsx"],"sourcesContent":["import React, { useCallback, useEffect } from \"react\";\nimport { GraphQLError } from \"@copilotkit/runtime-client-gql\";\nimport { useToast } from \"../toast/toast-provider\";\nimport { ExclamationMarkIcon } from \"../toast/exclamation-mark-icon\";\n\nexport function ErrorToast({ errors }: { errors: (Error | GraphQLError)[] }) {\n const errorsToRender = errors.map((error, idx) => {\n const message =\n \"extensions\" in error\n ? (error.extensions?.originalError as undefined | { message?: string })?.message\n : error.message;\n const code = \"extensions\" in error ? (error.extensions?.code as string) : null;\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 return (\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 error only displays during local development.\n </div>\n </div>\n );\n}\n\nexport function useErrorToast() {\n const { addToast } = useToast();\n\n return useCallback(\n (error: (Error | GraphQLError)[]) => {\n const errorId = error\n .map((err) => {\n const message =\n \"extensions\" in err\n ? (err.extensions?.originalError as any)?.message || err.message\n : err.message;\n const stack = err.stack || \"\";\n return btoa(message + stack).slice(0, 32); // Create hash from message + stack\n })\n .join(\"|\");\n\n addToast({\n type: \"error\",\n id: errorId, // Toast libraries typically dedupe by id\n message: <ErrorToast errors={error} />,\n });\n },\n [addToast],\n );\n}\n\nexport function useAsyncCallback<T extends (...args: any[]) => Promise<any>>(\n callback: T,\n deps: Parameters<typeof useCallback>[1],\n) {\n const addErrorToast = useErrorToast();\n return useCallback(async (...args: Parameters<T>) => {\n try {\n return await callback(...args);\n } catch (error) {\n console.error(\"Error in async callback:\", error);\n // @ts-ignore\n addErrorToast([error]);\n throw error;\n }\n }, deps);\n}\n","import { GraphQLError } from \"@copilotkit/runtime-client-gql\";\nimport React, { createContext, useContext, useState, useCallback } from \"react\";\nimport { ErrorToast } from \"../error-boundary/error-utils\";\nimport { PartialBy } from \"@copilotkit/shared\";\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: PartialBy<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: PartialBy<Toast, \"id\">) => {\n const id = toast.id ?? Math.random().toString(36).substring(2, 9);\n\n setToasts((currentToasts) => {\n if (currentToasts.find((toast) => toast.id === id)) return currentToasts;\n return [...currentToasts, { ...toast, id }];\n });\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 addToast({\n type: \"error\",\n message: <ErrorToast errors={errors} />,\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 1.5rem\",\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","import React from \"react\";\n\nexport const ExclamationMarkIcon = ({\n className,\n style,\n}: {\n className?: string;\n style?: React.CSSProperties;\n}) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={`lucide lucide-circle-alert ${className ? className : \"\"}`}\n style={style}\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" />\n <line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA8C;;;ACC9C,mBAAwE;AA4DzD;AAzCf,IAAM,mBAAe,4BAA6C,MAAS;AAEpE,SAAS,WAAW;AACzB,QAAM,cAAU,yBAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,8CAA8C;AAAA,EAChE;AACA,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,UAEF,6CAAC,SAAK,mBAAQ;AAAA;AAAA;AAAA,MAnBT;AAAA,IAoBP;AAAA,EAEJ,CAAC;AACD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,UAAU;AAAA,QACV,UAAU;AAAA,MACZ;AAAA,MAEC;AAAA;AAAA,QACD,6CAAC,SAAI,OAAO,EAAE,UAAU,QAAQ,SAAS,KAAK,GAAG,sEAEjD;AAAA;AAAA;AAAA,EACF;AAEJ;AAEO,SAAS,gBAAgB;AAC9B,QAAM,EAAE,SAAS,IAAI,SAAS;AAE9B,aAAO;AAAA,IACL,CAAC,UAAoC;AACnC,YAAM,UAAU,MACb,IAAI,CAAC,QAAQ;AA3DtB;AA4DU,cAAM,UACJ,gBAAgB,QACX,eAAI,eAAJ,mBAAgB,kBAAhB,mBAAuC,YAAW,IAAI,UACvD,IAAI;AACV,cAAM,QAAQ,IAAI,SAAS;AAC3B,eAAO,KAAK,UAAU,KAAK,EAAE,MAAM,GAAG,EAAE;AAAA,MAC1C,CAAC,EACA,KAAK,GAAG;AAEX,eAAS;AAAA,QACP,MAAM;AAAA,QACN,IAAI;AAAA;AAAA,QACJ,SAAS,6CAAC,cAAW,QAAQ,OAAO;AAAA,MACtC,CAAC;AAAA,IACH;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AACF;AAEO,SAAS,iBACd,UACA,MACA;AACA,QAAM,gBAAgB,cAAc;AACpC,aAAO,2BAAY,IAAU,SAAwB;AACnD,QAAI;AACF,aAAO,MAAM,SAAS,GAAG,IAAI;AAAA,IAC/B,SAAS,OAAP;AACA,cAAQ,MAAM,4BAA4B,KAAK;AAE/C,oBAAc,CAAC,KAAK,CAAC;AACrB,YAAM;AAAA,IACR;AAAA,EACF,IAAG,IAAI;AACT;","names":["import_react","import_jsx_runtime","import_jsx_runtime"]}
@@ -1,13 +0,0 @@
1
- import {
2
- ErrorToast,
3
- useAsyncCallback,
4
- useErrorToast
5
- } from "../../chunk-LNI2Z45S.mjs";
6
- import "../../chunk-O7ARI5CV.mjs";
7
- import "../../chunk-SKC7AJIV.mjs";
8
- export {
9
- ErrorToast,
10
- useAsyncCallback,
11
- useErrorToast
12
- };
13
- //# sourceMappingURL=error-utils.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,8 +0,0 @@
1
- import { Parameter } from '@copilotkit/shared';
2
- import { FrontendAction } from '../types/frontend-action.js';
3
- import '@copilotkit/runtime-client-gql';
4
- import 'react';
5
-
6
- declare function useCopilotAuthenticatedAction<T extends Parameter[]>(action: FrontendAction<T>, dependencies?: any[]): void;
7
-
8
- export { useCopilotAuthenticatedAction };