@copilotkit/react-core 1.9.2-next.2 → 1.9.2-next.20
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 +154 -0
- package/dist/{chunk-UHQMV2CE.mjs → chunk-36MGCCPZ.mjs} +2 -2
- package/dist/{chunk-CCESTGAM.mjs → chunk-3OQM3NEK.mjs} +2 -2
- package/dist/{chunk-FRZZPPIV.mjs → chunk-3SLA7Q2N.mjs} +2 -2
- package/dist/chunk-57K2ZJ5F.mjs +348 -0
- package/dist/chunk-57K2ZJ5F.mjs.map +1 -0
- package/dist/{chunk-LZDDYZEY.mjs → chunk-5BSUSFHM.mjs} +2 -2
- package/dist/{chunk-C6F6EQNA.mjs → chunk-BVK7PLK6.mjs} +2 -2
- package/dist/{chunk-6KGEF242.mjs → chunk-DKZTPL66.mjs} +3 -2
- package/dist/chunk-DKZTPL66.mjs.map +1 -0
- package/dist/{chunk-LDACFA2B.mjs → chunk-FN3UA2ZE.mjs} +3 -3
- package/dist/{chunk-RUY6MLHA.mjs → chunk-JWAXDYOW.mjs} +36 -6
- package/dist/chunk-JWAXDYOW.mjs.map +1 -0
- package/dist/{chunk-4I7PLQF7.mjs → chunk-K42OD3J6.mjs} +5 -5
- package/dist/{chunk-2FW7HH6W.mjs → chunk-KIXKBJUV.mjs} +3 -3
- package/dist/{chunk-L6QAOAE4.mjs → chunk-KWQPQ4MM.mjs} +69 -25
- package/dist/chunk-KWQPQ4MM.mjs.map +1 -0
- package/dist/{chunk-MGIXEJWG.mjs → chunk-MTAJI7HV.mjs} +181 -68
- package/dist/chunk-MTAJI7HV.mjs.map +1 -0
- package/dist/{chunk-T42PN5VN.mjs → chunk-NJA5ZLAZ.mjs} +29 -10
- package/dist/chunk-NJA5ZLAZ.mjs.map +1 -0
- package/dist/{chunk-NNSXCFQO.mjs → chunk-R2LNRHJP.mjs} +41 -7
- package/dist/chunk-R2LNRHJP.mjs.map +1 -0
- package/dist/{chunk-QQZLIEXK.mjs → chunk-SJJNFYGQ.mjs} +3 -3
- package/dist/{chunk-OUSWPVDT.mjs → chunk-UGJGKBFB.mjs} +4 -4
- package/dist/{chunk-Q5D5XQFA.mjs → chunk-VDADWRS3.mjs} +2 -2
- package/dist/chunk-YAF2LATQ.mjs +310 -0
- package/dist/chunk-YAF2LATQ.mjs.map +1 -0
- package/dist/{chunk-CMKIDDQL.mjs → chunk-ZOMEQ3XC.mjs} +11 -8
- package/dist/{chunk-CMKIDDQL.mjs.map → chunk-ZOMEQ3XC.mjs.map} +1 -1
- package/dist/components/copilot-provider/copilot-messages.js +39 -4
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +3 -3
- package/dist/components/copilot-provider/copilotkit-props.d.ts +27 -3
- package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +1 -1
- package/dist/components/copilot-provider/copilotkit.js +384 -253
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +10 -10
- package/dist/components/copilot-provider/index.d.ts +1 -1
- package/dist/components/copilot-provider/index.js +384 -253
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +10 -10
- package/dist/components/error-boundary/error-boundary.js +135 -146
- package/dist/components/error-boundary/error-boundary.js.map +1 -1
- package/dist/components/error-boundary/error-boundary.mjs +4 -4
- package/dist/components/error-boundary/error-utils.js.map +1 -1
- package/dist/components/error-boundary/error-utils.mjs +2 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +384 -253
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -10
- package/dist/components/toast/toast-provider.js +118 -85
- package/dist/components/toast/toast-provider.js.map +1 -1
- package/dist/components/toast/toast-provider.mjs +1 -1
- package/dist/components/usage-banner.js +135 -146
- package/dist/components/usage-banner.js.map +1 -1
- package/dist/components/usage-banner.mjs +1 -1
- package/dist/context/copilot-context.d.ts +1 -1
- package/dist/context/copilot-context.js +2 -1
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +2 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/{copilot-context-f9b2b4c3.d.ts → copilot-context-3ab4fdf5.d.ts} +6 -2
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +232 -71
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +32 -32
- package/dist/hooks/use-chat.d.ts +1 -1
- package/dist/hooks/use-chat.js +295 -156
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +6 -6
- package/dist/hooks/use-coagent-state-render.js +2 -1
- package/dist/hooks/use-coagent-state-render.js.map +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +3 -3
- package/dist/hooks/use-coagent.d.ts +1 -1
- package/dist/hooks/use-coagent.js +207 -65
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +14 -14
- package/dist/hooks/use-copilot-action.js +27 -7
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +4 -4
- package/dist/hooks/use-copilot-additional-instructions.js +2 -1
- package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
- package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
- package/dist/hooks/use-copilot-authenticated-action.js +27 -7
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +5 -5
- package/dist/hooks/use-copilot-chat.d.ts +1 -1
- package/dist/hooks/use-copilot-chat.js +204 -65
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +13 -13
- package/dist/hooks/use-copilot-readable.js +2 -1
- package/dist/hooks/use-copilot-readable.js.map +1 -1
- package/dist/hooks/use-copilot-readable.mjs +2 -2
- package/dist/hooks/use-copilot-runtime-client.d.ts +2 -0
- package/dist/hooks/use-copilot-runtime-client.js +52 -2
- package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
- package/dist/hooks/use-copilot-runtime-client.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt-render.js +2 -1
- package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt.d.ts +1 -1
- package/dist/hooks/use-langgraph-interrupt.js +204 -65
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +14 -14
- package/dist/hooks/use-make-copilot-document-readable.js +2 -1
- package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +581 -320
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -33
- package/dist/lib/copilot-task.d.ts +1 -1
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +11 -11
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +11 -11
- package/dist/types/interrupt-action.d.ts +1 -1
- package/dist/utils/extract.d.ts +1 -1
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +10 -10
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +10 -10
- package/jest.config.js +7 -3
- package/package.json +4 -3
- package/src/components/copilot-provider/__tests__/copilotkit-error.test.tsx +75 -0
- package/src/components/copilot-provider/copilot-messages.tsx +46 -5
- package/src/components/copilot-provider/copilotkit-props.tsx +27 -1
- package/src/components/copilot-provider/copilotkit.tsx +64 -18
- package/src/components/toast/toast-provider.tsx +49 -24
- package/src/components/usage-banner.tsx +144 -147
- package/src/context/copilot-context.tsx +8 -2
- package/src/hooks/use-chat.ts +247 -61
- package/src/hooks/use-coagent.ts +5 -0
- package/src/hooks/use-copilot-action.ts +51 -9
- package/src/hooks/use-copilot-runtime-client.ts +41 -40
- package/tsconfig.json +4 -8
- package/tsup.config.ts +6 -6
- package/dist/chunk-6KGEF242.mjs.map +0 -1
- package/dist/chunk-HD2GE3DK.mjs +0 -359
- package/dist/chunk-HD2GE3DK.mjs.map +0 -1
- package/dist/chunk-L6QAOAE4.mjs.map +0 -1
- package/dist/chunk-MGIXEJWG.mjs.map +0 -1
- package/dist/chunk-NNSXCFQO.mjs.map +0 -1
- package/dist/chunk-RUY6MLHA.mjs.map +0 -1
- package/dist/chunk-T42PN5VN.mjs.map +0 -1
- package/dist/chunk-VRXANACV.mjs +0 -277
- package/dist/chunk-VRXANACV.mjs.map +0 -1
- package/dist/utils/utils.test.d.ts +0 -2
- package/dist/utils/utils.test.js +0 -9
- package/dist/utils/utils.test.js.map +0 -1
- package/dist/utils/utils.test.mjs +0 -7
- package/dist/utils/utils.test.mjs.map +0 -1
- /package/dist/{chunk-UHQMV2CE.mjs.map → chunk-36MGCCPZ.mjs.map} +0 -0
- /package/dist/{chunk-CCESTGAM.mjs.map → chunk-3OQM3NEK.mjs.map} +0 -0
- /package/dist/{chunk-FRZZPPIV.mjs.map → chunk-3SLA7Q2N.mjs.map} +0 -0
- /package/dist/{chunk-LZDDYZEY.mjs.map → chunk-5BSUSFHM.mjs.map} +0 -0
- /package/dist/{chunk-C6F6EQNA.mjs.map → chunk-BVK7PLK6.mjs.map} +0 -0
- /package/dist/{chunk-LDACFA2B.mjs.map → chunk-FN3UA2ZE.mjs.map} +0 -0
- /package/dist/{chunk-4I7PLQF7.mjs.map → chunk-K42OD3J6.mjs.map} +0 -0
- /package/dist/{chunk-2FW7HH6W.mjs.map → chunk-KIXKBJUV.mjs.map} +0 -0
- /package/dist/{chunk-QQZLIEXK.mjs.map → chunk-SJJNFYGQ.mjs.map} +0 -0
- /package/dist/{chunk-OUSWPVDT.mjs.map → chunk-UGJGKBFB.mjs.map} +0 -0
- /package/dist/{chunk-Q5D5XQFA.mjs.map → chunk-VDADWRS3.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,159 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
+
## 1.9.2-next.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e1de032: - fix: synchronously execute renderAndWaitForResponse
|
|
8
|
+
|
|
9
|
+
Previously, it was impossible to execute multiple human-in-the-loop (renderAndWaitForResponse)
|
|
10
|
+
calls in a row. Ultimately this was due to an issue with how CopilotKit was rendering the updates
|
|
11
|
+
when multiple renderAndWaitForResponse actions appeared on screen due to a reference based approach.
|
|
12
|
+
|
|
13
|
+
With this change, actions will be executed in a synchronous way appearing almost queue like. This
|
|
14
|
+
works with any combination of action given much more freedom when asking for user input.
|
|
15
|
+
|
|
16
|
+
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
17
|
+
|
|
18
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.20
|
|
19
|
+
- @copilotkit/shared@1.9.2-next.20
|
|
20
|
+
|
|
21
|
+
## 1.9.2-next.19
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.19
|
|
26
|
+
- @copilotkit/shared@1.9.2-next.19
|
|
27
|
+
|
|
28
|
+
## 1.9.2-next.18
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- fac89c2: - refactor: rename onTrace to onError throughout codebase
|
|
33
|
+
|
|
34
|
+
- Rename CopilotTraceEvent to CopilotErrorEvent and CopilotTraceHandler to CopilotErrorHandler
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [fac89c2]
|
|
37
|
+
- @copilotkit/shared@1.9.2-next.18
|
|
38
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.18
|
|
39
|
+
|
|
40
|
+
## 1.9.2-next.17
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.17
|
|
45
|
+
- @copilotkit/shared@1.9.2-next.17
|
|
46
|
+
|
|
47
|
+
## 1.9.2-next.16
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- fe9009c: - feat(langgraph): new thread metadata
|
|
52
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.16
|
|
53
|
+
- @copilotkit/shared@1.9.2-next.16
|
|
54
|
+
|
|
55
|
+
## 1.9.2-next.15
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- cbeccb5: - fix: refrain repeated api calls by memoizing state
|
|
60
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.15
|
|
61
|
+
- @copilotkit/shared@1.9.2-next.15
|
|
62
|
+
|
|
63
|
+
## 1.9.2-next.14
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.14
|
|
68
|
+
- @copilotkit/shared@1.9.2-next.14
|
|
69
|
+
|
|
70
|
+
## 1.9.2-next.13
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.13
|
|
75
|
+
- @copilotkit/shared@1.9.2-next.13
|
|
76
|
+
|
|
77
|
+
## 1.9.2-next.12
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- 3f8c575: - fix: use time travel for regeneration of messages
|
|
82
|
+
- fix: use a better cutoff for regeneration request
|
|
83
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.12
|
|
84
|
+
- @copilotkit/shared@1.9.2-next.12
|
|
85
|
+
|
|
86
|
+
## 1.9.2-next.11
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.11
|
|
91
|
+
- @copilotkit/shared@1.9.2-next.11
|
|
92
|
+
|
|
93
|
+
## 1.9.2-next.10
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.10
|
|
98
|
+
- @copilotkit/shared@1.9.2-next.10
|
|
99
|
+
|
|
100
|
+
## 1.9.2-next.9
|
|
101
|
+
|
|
102
|
+
### Patch Changes
|
|
103
|
+
|
|
104
|
+
- 1d1c51d: - feat: surface all errors in structured format
|
|
105
|
+
- Updated dependencies [1d1c51d]
|
|
106
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.9
|
|
107
|
+
- @copilotkit/shared@1.9.2-next.9
|
|
108
|
+
|
|
109
|
+
## 1.9.2-next.8
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.8
|
|
114
|
+
- @copilotkit/shared@1.9.2-next.8
|
|
115
|
+
|
|
116
|
+
## 1.9.2-next.7
|
|
117
|
+
|
|
118
|
+
### Patch Changes
|
|
119
|
+
|
|
120
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.7
|
|
121
|
+
- @copilotkit/shared@1.9.2-next.7
|
|
122
|
+
|
|
123
|
+
## 1.9.2-next.6
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.6
|
|
128
|
+
- @copilotkit/shared@1.9.2-next.6
|
|
129
|
+
|
|
130
|
+
## 1.9.2-next.5
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.5
|
|
135
|
+
- @copilotkit/shared@1.9.2-next.5
|
|
136
|
+
|
|
137
|
+
## 1.9.2-next.4
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- 9169ad7: - feat: add onTrace handler for runtime and UI error/event tracking
|
|
142
|
+
- 9169ad7: - feat: add onTrace handler for comprehensive debugging and observability - Add CopilotTraceEvent interfaces with rich debugging context, implement runtime-side tracing with publicApiKey gating, add UI-side error tracing, include comprehensive test coverage, and fix tsup build config to exclude test files
|
|
143
|
+
- fix: extract publicApiKey for all requests + trace GraphQL errors
|
|
144
|
+
- Updated dependencies [9169ad7]
|
|
145
|
+
- Updated dependencies [9169ad7]
|
|
146
|
+
- @copilotkit/shared@1.9.2-next.4
|
|
147
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.4
|
|
148
|
+
|
|
149
|
+
## 1.9.2-next.3
|
|
150
|
+
|
|
151
|
+
### Patch Changes
|
|
152
|
+
|
|
153
|
+
- 35537f1: - fix: memoize nested components to not rerender when content changes
|
|
154
|
+
- @copilotkit/runtime-client-gql@1.9.2-next.3
|
|
155
|
+
- @copilotkit/shared@1.9.2-next.3
|
|
156
|
+
|
|
3
157
|
## 1.9.2-next.2
|
|
4
158
|
|
|
5
159
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DKZTPL66.mjs";
|
|
4
4
|
|
|
5
5
|
// src/hooks/use-make-copilot-document-readable.ts
|
|
6
6
|
import { useEffect, useRef } from "react";
|
|
@@ -20,4 +20,4 @@ function useMakeCopilotDocumentReadable(document, categories, dependencies = [])
|
|
|
20
20
|
export {
|
|
21
21
|
useMakeCopilotDocumentReadable
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-36MGCCPZ.mjs.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-O7ARI5CV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useToast
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YAF2LATQ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__async
|
|
9
9
|
} from "./chunk-SKC7AJIV.mjs";
|
|
@@ -99,4 +99,4 @@ export {
|
|
|
99
99
|
useErrorToast,
|
|
100
100
|
useAsyncCallback
|
|
101
101
|
};
|
|
102
|
-
//# sourceMappingURL=chunk-
|
|
102
|
+
//# sourceMappingURL=chunk-3OQM3NEK.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defaultCopilotContextCategories
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KWQPQ4MM.mjs";
|
|
4
4
|
import {
|
|
5
5
|
processActionsForRuntimeRequest
|
|
6
6
|
} from "./chunk-4CEQJ2X6.mjs";
|
|
@@ -117,4 +117,4 @@ ${instructions}
|
|
|
117
117
|
export {
|
|
118
118
|
CopilotTask
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-3SLA7Q2N.mjs.map
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
// src/components/usage-banner.tsx
|
|
2
|
+
import { Severity, ERROR_NAMES, ErrorVisibility } from "@copilotkit/shared";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var defaultIcons = {
|
|
5
|
+
[Severity.CRITICAL]: /* @__PURE__ */ jsxs(
|
|
6
|
+
"svg",
|
|
7
|
+
{
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
width: "16",
|
|
10
|
+
height: "16",
|
|
11
|
+
stroke: "currentColor",
|
|
12
|
+
strokeWidth: "2.5",
|
|
13
|
+
fill: "none",
|
|
14
|
+
strokeLinecap: "round",
|
|
15
|
+
strokeLinejoin: "round",
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
18
|
+
/* @__PURE__ */ jsx("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
|
|
19
|
+
/* @__PURE__ */ jsx("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
[Severity.WARNING]: /* @__PURE__ */ jsxs(
|
|
24
|
+
"svg",
|
|
25
|
+
{
|
|
26
|
+
viewBox: "0 0 24 24",
|
|
27
|
+
width: "16",
|
|
28
|
+
height: "16",
|
|
29
|
+
stroke: "currentColor",
|
|
30
|
+
strokeWidth: "2.5",
|
|
31
|
+
fill: "none",
|
|
32
|
+
strokeLinecap: "round",
|
|
33
|
+
strokeLinejoin: "round",
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
|
|
36
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
37
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
[Severity.INFO]: /* @__PURE__ */ jsxs(
|
|
42
|
+
"svg",
|
|
43
|
+
{
|
|
44
|
+
viewBox: "0 0 24 24",
|
|
45
|
+
width: "16",
|
|
46
|
+
height: "16",
|
|
47
|
+
stroke: "currentColor",
|
|
48
|
+
strokeWidth: "2.5",
|
|
49
|
+
fill: "none",
|
|
50
|
+
strokeLinecap: "round",
|
|
51
|
+
strokeLinejoin: "round",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
54
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
|
|
55
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
};
|
|
60
|
+
function UsageBanner({
|
|
61
|
+
severity = Severity.CRITICAL,
|
|
62
|
+
message = "",
|
|
63
|
+
icon,
|
|
64
|
+
onClose,
|
|
65
|
+
actions
|
|
66
|
+
}) {
|
|
67
|
+
if (!message || !severity) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const parseMessage = (rawMessage) => {
|
|
71
|
+
if (rawMessage.toLowerCase().includes("authentication") || rawMessage.toLowerCase().includes("api key")) {
|
|
72
|
+
return "Authentication failed. Please check your API key.";
|
|
73
|
+
}
|
|
74
|
+
if (rawMessage.toLowerCase().includes("rate limit")) {
|
|
75
|
+
return "Rate limit exceeded. Please try again later.";
|
|
76
|
+
}
|
|
77
|
+
if (rawMessage.toLowerCase().includes("checkpointer")) {
|
|
78
|
+
return "Agent configuration error. Please check your setup.";
|
|
79
|
+
}
|
|
80
|
+
let cleanMessage2 = rawMessage;
|
|
81
|
+
cleanMessage2 = cleanMessage2.split(" - ")[0];
|
|
82
|
+
cleanMessage2 = cleanMessage2.split(": Error code")[0];
|
|
83
|
+
cleanMessage2 = cleanMessage2.split(": 401")[0];
|
|
84
|
+
cleanMessage2 = cleanMessage2.split(": 403")[0];
|
|
85
|
+
cleanMessage2 = cleanMessage2.split(": 404")[0];
|
|
86
|
+
cleanMessage2 = cleanMessage2.split(": 500")[0];
|
|
87
|
+
cleanMessage2 = cleanMessage2.replace(/See more:.*$/g, "").trim();
|
|
88
|
+
if (cleanMessage2.includes("{") || cleanMessage2.includes("'") || cleanMessage2.length > 60) {
|
|
89
|
+
return "Configuration error. Please check your setup.";
|
|
90
|
+
}
|
|
91
|
+
return cleanMessage2 || "An error occurred. Please check your configuration.";
|
|
92
|
+
};
|
|
93
|
+
const cleanMessage = parseMessage(message);
|
|
94
|
+
const Icon = icon || defaultIcons[severity];
|
|
95
|
+
const themeConfigs = {
|
|
96
|
+
[Severity.INFO]: {
|
|
97
|
+
bg: "rgba(239, 246, 255, 0.95)",
|
|
98
|
+
border: "#93c5fd",
|
|
99
|
+
text: "#1e40af",
|
|
100
|
+
icon: "#3b82f6",
|
|
101
|
+
primaryBtn: "#3b82f6",
|
|
102
|
+
primaryBtnHover: "#2563eb"
|
|
103
|
+
},
|
|
104
|
+
[Severity.WARNING]: {
|
|
105
|
+
bg: "rgba(255, 251, 235, 0.95)",
|
|
106
|
+
border: "#fbbf24",
|
|
107
|
+
text: "#92400e",
|
|
108
|
+
icon: "#f59e0b",
|
|
109
|
+
primaryBtn: "#f59e0b",
|
|
110
|
+
primaryBtnHover: "#d97706"
|
|
111
|
+
},
|
|
112
|
+
[Severity.CRITICAL]: {
|
|
113
|
+
bg: "rgba(254, 242, 242, 0.95)",
|
|
114
|
+
border: "#f87171",
|
|
115
|
+
text: "#991b1b",
|
|
116
|
+
icon: "#ef4444",
|
|
117
|
+
primaryBtn: "#ef4444",
|
|
118
|
+
primaryBtnHover: "#dc2626"
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const themeConfig = themeConfigs[severity] || themeConfigs[Severity.CRITICAL];
|
|
122
|
+
return /* @__PURE__ */ jsxs(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
style: {
|
|
126
|
+
position: "fixed",
|
|
127
|
+
bottom: "24px",
|
|
128
|
+
left: "50%",
|
|
129
|
+
transform: "translateX(-50%)",
|
|
130
|
+
width: "400px",
|
|
131
|
+
maxWidth: "90vw",
|
|
132
|
+
zIndex: 1e4,
|
|
133
|
+
animation: "bannerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1)"
|
|
134
|
+
},
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ jsx("style", { children: `
|
|
137
|
+
@keyframes bannerSlideIn {
|
|
138
|
+
from {
|
|
139
|
+
opacity: 0;
|
|
140
|
+
transform: translateX(-50%) translateY(20px);
|
|
141
|
+
scale: 0.95;
|
|
142
|
+
}
|
|
143
|
+
to {
|
|
144
|
+
opacity: 1;
|
|
145
|
+
transform: translateX(-50%) translateY(0);
|
|
146
|
+
scale: 1;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
` }),
|
|
150
|
+
/* @__PURE__ */ jsxs(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
style: {
|
|
154
|
+
borderRadius: "12px",
|
|
155
|
+
border: `1px solid ${themeConfig.border}`,
|
|
156
|
+
background: themeConfig.bg,
|
|
157
|
+
padding: "14px",
|
|
158
|
+
boxShadow: "0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08)",
|
|
159
|
+
position: "relative",
|
|
160
|
+
backdropFilter: "blur(12px)",
|
|
161
|
+
WebkitBackdropFilter: "blur(12px)",
|
|
162
|
+
boxSizing: "border-box",
|
|
163
|
+
overflow: "hidden"
|
|
164
|
+
},
|
|
165
|
+
children: [
|
|
166
|
+
onClose && /* @__PURE__ */ jsx(
|
|
167
|
+
"button",
|
|
168
|
+
{
|
|
169
|
+
onClick: onClose,
|
|
170
|
+
style: {
|
|
171
|
+
position: "absolute",
|
|
172
|
+
top: "8px",
|
|
173
|
+
right: "8px",
|
|
174
|
+
background: "rgba(255, 255, 255, 0.9)",
|
|
175
|
+
border: "none",
|
|
176
|
+
color: themeConfig.text,
|
|
177
|
+
cursor: "pointer",
|
|
178
|
+
fontSize: "16px",
|
|
179
|
+
lineHeight: "1",
|
|
180
|
+
padding: "4px",
|
|
181
|
+
borderRadius: "4px",
|
|
182
|
+
width: "20px",
|
|
183
|
+
height: "20px",
|
|
184
|
+
display: "flex",
|
|
185
|
+
alignItems: "center",
|
|
186
|
+
justifyContent: "center"
|
|
187
|
+
},
|
|
188
|
+
title: "Close",
|
|
189
|
+
children: "\xD7"
|
|
190
|
+
}
|
|
191
|
+
),
|
|
192
|
+
/* @__PURE__ */ jsx(
|
|
193
|
+
"div",
|
|
194
|
+
{
|
|
195
|
+
style: {
|
|
196
|
+
fontSize: "14px",
|
|
197
|
+
fontWeight: 500,
|
|
198
|
+
color: themeConfig.text,
|
|
199
|
+
lineHeight: "1.4",
|
|
200
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
201
|
+
paddingRight: onClose ? "30px" : "0",
|
|
202
|
+
marginBottom: actions ? "12px" : "0",
|
|
203
|
+
wordBreak: "break-word",
|
|
204
|
+
overflow: "hidden",
|
|
205
|
+
textOverflow: "ellipsis",
|
|
206
|
+
display: "-webkit-box",
|
|
207
|
+
WebkitLineClamp: 2,
|
|
208
|
+
WebkitBoxOrient: "vertical"
|
|
209
|
+
},
|
|
210
|
+
children: cleanMessage
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
actions && /* @__PURE__ */ jsxs(
|
|
214
|
+
"div",
|
|
215
|
+
{
|
|
216
|
+
style: {
|
|
217
|
+
display: "flex",
|
|
218
|
+
gap: "8px",
|
|
219
|
+
flexWrap: "wrap"
|
|
220
|
+
},
|
|
221
|
+
children: [
|
|
222
|
+
actions.secondary && /* @__PURE__ */ jsx(
|
|
223
|
+
"button",
|
|
224
|
+
{
|
|
225
|
+
onClick: actions.secondary.onClick,
|
|
226
|
+
style: {
|
|
227
|
+
borderRadius: "8px",
|
|
228
|
+
padding: "6px 12px",
|
|
229
|
+
fontSize: "13px",
|
|
230
|
+
fontWeight: 500,
|
|
231
|
+
color: themeConfig.text,
|
|
232
|
+
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
233
|
+
border: `1px solid ${themeConfig.border}`,
|
|
234
|
+
cursor: "pointer",
|
|
235
|
+
transition: "all 0.2s ease",
|
|
236
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
237
|
+
},
|
|
238
|
+
onMouseOver: (e) => {
|
|
239
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
|
|
240
|
+
e.currentTarget.style.transform = "translateY(-1px)";
|
|
241
|
+
},
|
|
242
|
+
onMouseOut: (e) => {
|
|
243
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.9)";
|
|
244
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
245
|
+
},
|
|
246
|
+
children: actions.secondary.label
|
|
247
|
+
}
|
|
248
|
+
),
|
|
249
|
+
actions.primary && /* @__PURE__ */ jsx(
|
|
250
|
+
"button",
|
|
251
|
+
{
|
|
252
|
+
onClick: actions.primary.onClick,
|
|
253
|
+
style: {
|
|
254
|
+
borderRadius: "8px",
|
|
255
|
+
padding: "6px 12px",
|
|
256
|
+
fontSize: "13px",
|
|
257
|
+
fontWeight: 600,
|
|
258
|
+
color: "#fff",
|
|
259
|
+
backgroundColor: themeConfig.primaryBtn,
|
|
260
|
+
border: "none",
|
|
261
|
+
cursor: "pointer",
|
|
262
|
+
transition: "all 0.2s ease",
|
|
263
|
+
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
|
|
264
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
265
|
+
},
|
|
266
|
+
onMouseOver: (e) => {
|
|
267
|
+
e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
|
|
268
|
+
e.currentTarget.style.transform = "translateY(-1px)";
|
|
269
|
+
e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.2)";
|
|
270
|
+
},
|
|
271
|
+
onMouseOut: (e) => {
|
|
272
|
+
e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
|
|
273
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
274
|
+
e.currentTarget.style.boxShadow = "0 2px 8px rgba(0, 0, 0, 0.15)";
|
|
275
|
+
},
|
|
276
|
+
children: actions.primary.label
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
function renderCopilotKitUsage(error, onClose) {
|
|
290
|
+
if (error.visibility !== ErrorVisibility.BANNER) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
const extractUrlFromMessage = (message) => {
|
|
294
|
+
const linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
295
|
+
const match = linkRegex.exec(message);
|
|
296
|
+
return match ? match[2] : null;
|
|
297
|
+
};
|
|
298
|
+
const getErrorActions = (error2) => {
|
|
299
|
+
switch (error2.name) {
|
|
300
|
+
case ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR:
|
|
301
|
+
return {
|
|
302
|
+
primary: {
|
|
303
|
+
label: "Sign In",
|
|
304
|
+
onClick: () => window.location.href = "https://cloud.copilotkit.ai"
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
case ERROR_NAMES.UPGRADE_REQUIRED_ERROR:
|
|
308
|
+
return {
|
|
309
|
+
primary: {
|
|
310
|
+
label: "Upgrade",
|
|
311
|
+
onClick: () => window.location.href = "https://copilotkit.ai/"
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
case ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR:
|
|
315
|
+
case ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR:
|
|
316
|
+
case ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR:
|
|
317
|
+
return {
|
|
318
|
+
primary: {
|
|
319
|
+
label: "View Docs",
|
|
320
|
+
onClick: () => {
|
|
321
|
+
var _a;
|
|
322
|
+
const urlFromMessage = extractUrlFromMessage(error2.message);
|
|
323
|
+
const urlFromExtensions = (_a = error2.extensions) == null ? void 0 : _a.troubleshootingUrl;
|
|
324
|
+
const url = urlFromMessage || urlFromExtensions || "https://docs.copilotkit.ai/troubleshooting/common-issues";
|
|
325
|
+
window.open(url, "_blank");
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
default:
|
|
330
|
+
return void 0;
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
return /* @__PURE__ */ jsx(
|
|
334
|
+
UsageBanner,
|
|
335
|
+
{
|
|
336
|
+
severity: error.severity || Severity.CRITICAL,
|
|
337
|
+
message: error.message,
|
|
338
|
+
onClose,
|
|
339
|
+
actions: getErrorActions(error)
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export {
|
|
345
|
+
UsageBanner,
|
|
346
|
+
renderCopilotKitUsage
|
|
347
|
+
};
|
|
348
|
+
//# sourceMappingURL=chunk-57K2ZJ5F.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/usage-banner.tsx"],"sourcesContent":["import { Severity, CopilotKitError, ERROR_NAMES, ErrorVisibility } from \"@copilotkit/shared\";\n\ninterface UsageBannerProps {\n severity?: Severity;\n message?: string;\n icon?: React.ReactNode;\n onClose?: () => void;\n actions?: {\n primary?: {\n label: string;\n onClick: () => void;\n };\n secondary?: {\n label: string;\n onClick: () => void;\n };\n };\n}\n\nconst defaultIcons: Record<Severity, JSX.Element> = {\n [Severity.CRITICAL]: (\n <svg\n viewBox=\"0 0 24 24\"\n width=\"16\"\n height=\"16\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\" />\n <line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\" />\n </svg>\n ),\n [Severity.WARNING]: (\n <svg\n viewBox=\"0 0 24 24\"\n width=\"16\"\n height=\"16\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z\" />\n <line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\" />\n <line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\" />\n </svg>\n ),\n [Severity.INFO]: (\n <svg\n viewBox=\"0 0 24 24\"\n width=\"16\"\n height=\"16\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\" />\n <line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\" />\n </svg>\n ),\n};\n\nexport function UsageBanner({\n severity = Severity.CRITICAL,\n message = \"\",\n icon,\n onClose,\n actions,\n}: UsageBannerProps) {\n if (!message || !severity) {\n return null;\n }\n\n // Enhanced message parsing to clean up technical details\n const parseMessage = (rawMessage: string) => {\n // console.log(\"Raw message:\", rawMessage); // Debug\n\n // Super aggressive cleaning - handle common error patterns first\n if (\n rawMessage.toLowerCase().includes(\"authentication\") ||\n rawMessage.toLowerCase().includes(\"api key\")\n ) {\n return \"Authentication failed. Please check your API key.\";\n }\n\n if (rawMessage.toLowerCase().includes(\"rate limit\")) {\n return \"Rate limit exceeded. Please try again later.\";\n }\n\n if (rawMessage.toLowerCase().includes(\"checkpointer\")) {\n return \"Agent configuration error. Please check your setup.\";\n }\n\n // For any other error, extract just the main error type\n let cleanMessage = rawMessage;\n\n // Remove everything after the first \" - \" or \":\" followed by technical details\n cleanMessage = cleanMessage.split(\" - \")[0];\n cleanMessage = cleanMessage.split(\": Error code\")[0];\n cleanMessage = cleanMessage.split(\": 401\")[0];\n cleanMessage = cleanMessage.split(\": 403\")[0];\n cleanMessage = cleanMessage.split(\": 404\")[0];\n cleanMessage = cleanMessage.split(\": 500\")[0];\n\n // Remove \"See more\" links\n cleanMessage = cleanMessage.replace(/See more:.*$/g, \"\").trim();\n\n // If still too technical, just show a generic message\n if (cleanMessage.includes(\"{\") || cleanMessage.includes(\"'\") || cleanMessage.length > 60) {\n return \"Configuration error. Please check your setup.\";\n }\n\n return cleanMessage || \"An error occurred. Please check your configuration.\";\n };\n\n const cleanMessage = parseMessage(message);\n const Icon = icon || defaultIcons[severity];\n\n const themeConfigs = {\n [Severity.INFO]: {\n bg: \"rgba(239, 246, 255, 0.95)\",\n border: \"#93c5fd\",\n text: \"#1e40af\",\n icon: \"#3b82f6\",\n primaryBtn: \"#3b82f6\",\n primaryBtnHover: \"#2563eb\",\n },\n [Severity.WARNING]: {\n bg: \"rgba(255, 251, 235, 0.95)\",\n border: \"#fbbf24\",\n text: \"#92400e\",\n icon: \"#f59e0b\",\n primaryBtn: \"#f59e0b\",\n primaryBtnHover: \"#d97706\",\n },\n [Severity.CRITICAL]: {\n bg: \"rgba(254, 242, 242, 0.95)\",\n border: \"#f87171\",\n text: \"#991b1b\",\n icon: \"#ef4444\",\n primaryBtn: \"#ef4444\",\n primaryBtnHover: \"#dc2626\",\n },\n };\n\n const themeConfig = themeConfigs[severity] || themeConfigs[Severity.CRITICAL];\n\n return (\n <div\n style={{\n position: \"fixed\",\n bottom: \"24px\",\n left: \"50%\",\n transform: \"translateX(-50%)\",\n width: \"400px\",\n maxWidth: \"90vw\",\n zIndex: 10000,\n animation: \"bannerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1)\",\n }}\n >\n <style>\n {`\n @keyframes bannerSlideIn {\n from {\n opacity: 0;\n transform: translateX(-50%) translateY(20px);\n scale: 0.95;\n }\n to {\n opacity: 1;\n transform: translateX(-50%) translateY(0);\n scale: 1;\n }\n }\n `}\n </style>\n <div\n style={{\n borderRadius: \"12px\",\n border: `1px solid ${themeConfig.border}`,\n background: themeConfig.bg,\n padding: \"14px\",\n boxShadow: \"0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08)\",\n position: \"relative\",\n backdropFilter: \"blur(12px)\",\n WebkitBackdropFilter: \"blur(12px)\",\n boxSizing: \"border-box\",\n overflow: \"hidden\",\n }}\n >\n {/* Close button */}\n {onClose && (\n <button\n onClick={onClose}\n style={{\n position: \"absolute\",\n top: \"8px\",\n right: \"8px\",\n background: \"rgba(255, 255, 255, 0.9)\",\n border: \"none\",\n color: themeConfig.text,\n cursor: \"pointer\",\n fontSize: \"16px\",\n lineHeight: \"1\",\n padding: \"4px\",\n borderRadius: \"4px\",\n width: \"20px\",\n height: \"20px\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n title=\"Close\"\n >\n ×\n </button>\n )}\n\n {/* Message */}\n <div\n style={{\n fontSize: \"14px\",\n fontWeight: 500,\n color: themeConfig.text,\n lineHeight: \"1.4\",\n fontFamily: \"-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n paddingRight: onClose ? \"30px\" : \"0\",\n marginBottom: actions ? \"12px\" : \"0\",\n wordBreak: \"break-word\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n display: \"-webkit-box\",\n WebkitLineClamp: 2,\n WebkitBoxOrient: \"vertical\",\n }}\n >\n {cleanMessage}\n </div>\n\n {/* Actions */}\n {actions && (\n <div\n style={{\n display: \"flex\",\n gap: \"8px\",\n flexWrap: \"wrap\",\n }}\n >\n {actions.secondary && (\n <button\n onClick={actions.secondary.onClick}\n style={{\n borderRadius: \"8px\",\n padding: \"6px 12px\",\n fontSize: \"13px\",\n fontWeight: 500,\n color: themeConfig.text,\n backgroundColor: \"rgba(255, 255, 255, 0.9)\",\n border: `1px solid ${themeConfig.border}`,\n cursor: \"pointer\",\n transition: \"all 0.2s ease\",\n fontFamily: \"-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n }}\n onMouseOver={(e) => {\n e.currentTarget.style.backgroundColor = \"rgba(255, 255, 255, 1)\";\n e.currentTarget.style.transform = \"translateY(-1px)\";\n }}\n onMouseOut={(e) => {\n e.currentTarget.style.backgroundColor = \"rgba(255, 255, 255, 0.9)\";\n e.currentTarget.style.transform = \"translateY(0)\";\n }}\n >\n {actions.secondary.label}\n </button>\n )}\n {actions.primary && (\n <button\n onClick={actions.primary.onClick}\n style={{\n borderRadius: \"8px\",\n padding: \"6px 12px\",\n fontSize: \"13px\",\n fontWeight: 600,\n color: \"#fff\",\n backgroundColor: themeConfig.primaryBtn,\n border: \"none\",\n cursor: \"pointer\",\n transition: \"all 0.2s ease\",\n boxShadow: \"0 2px 8px rgba(0, 0, 0, 0.15)\",\n fontFamily: \"-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n }}\n onMouseOver={(e) => {\n e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;\n e.currentTarget.style.transform = \"translateY(-1px)\";\n e.currentTarget.style.boxShadow = \"0 4px 12px rgba(0, 0, 0, 0.2)\";\n }}\n onMouseOut={(e) => {\n e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;\n e.currentTarget.style.transform = \"translateY(0)\";\n e.currentTarget.style.boxShadow = \"0 2px 8px rgba(0, 0, 0, 0.15)\";\n }}\n >\n {actions.primary.label}\n </button>\n )}\n </div>\n )}\n </div>\n </div>\n );\n}\n\nexport function renderCopilotKitUsage(error: CopilotKitError, onClose?: () => void) {\n // Route based on error visibility level\n if (error.visibility !== ErrorVisibility.BANNER) {\n return null;\n }\n\n // Extract URL from markdown links in the message\n const extractUrlFromMessage = (message: string): string | null => {\n const linkRegex = /\\[([^\\]]+)\\]\\(([^)]+)\\)/g;\n const match = linkRegex.exec(message);\n return match ? match[2] : null;\n };\n\n // Get action button based on error type\n const getErrorActions = (error: CopilotKitError) => {\n switch (error.name) {\n case ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR:\n return {\n primary: {\n label: \"Sign In\",\n onClick: () => (window.location.href = \"https://cloud.copilotkit.ai\"),\n },\n };\n case ERROR_NAMES.UPGRADE_REQUIRED_ERROR:\n return {\n primary: {\n label: \"Upgrade\",\n onClick: () => (window.location.href = \"https://copilotkit.ai/\"),\n },\n };\n case ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR:\n case ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR:\n case ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR:\n return {\n primary: {\n label: \"View Docs\",\n onClick: () => {\n // Try to get URL from the error message first, then extensions, then default\n const urlFromMessage = extractUrlFromMessage(error.message);\n const urlFromExtensions = (error.extensions as any)?.troubleshootingUrl;\n const url =\n urlFromMessage ||\n urlFromExtensions ||\n \"https://docs.copilotkit.ai/troubleshooting/common-issues\";\n window.open(url, \"_blank\");\n },\n },\n };\n default:\n return undefined;\n }\n };\n\n return (\n <UsageBanner\n severity={error.severity || Severity.CRITICAL}\n message={error.message}\n onClose={onClose}\n actions={getErrorActions(error)}\n />\n );\n}\n"],"mappings":";AAAA,SAAS,UAA2B,aAAa,uBAAuB;AAqBpE,SAUE,KAVF;AAFJ,IAAM,eAA8C;AAAA,EAClD,CAAC,SAAS,QAAQ,GAChB;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,OAAM;AAAA,MACN,QAAO;AAAA,MACP,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,MAAK;AAAA,MACL,eAAc;AAAA,MACd,gBAAe;AAAA,MAEf;AAAA,4BAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,MAAK;AAAA,QAC/B,oBAAC,UAAK,IAAG,MAAK,IAAG,KAAI,IAAG,KAAI,IAAG,MAAK;AAAA,QACpC,oBAAC,UAAK,IAAG,KAAI,IAAG,KAAI,IAAG,MAAK,IAAG,MAAK;AAAA;AAAA;AAAA,EACtC;AAAA,EAEF,CAAC,SAAS,OAAO,GACf;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,OAAM;AAAA,MACN,QAAO;AAAA,MACP,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,MAAK;AAAA,MACL,eAAc;AAAA,MACd,gBAAe;AAAA,MAEf;AAAA,4BAAC,UAAK,GAAE,6EAA4E;AAAA,QACp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|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DKZTPL66.mjs";
|
|
4
4
|
|
|
5
5
|
// src/hooks/use-copilot-readable.ts
|
|
6
6
|
import { useEffect, useRef } from "react";
|
|
@@ -34,4 +34,4 @@ function useCopilotReadable({
|
|
|
34
34
|
export {
|
|
35
35
|
useCopilotReadable
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
37
|
+
//# sourceMappingURL=chunk-5BSUSFHM.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DKZTPL66.mjs";
|
|
4
4
|
|
|
5
5
|
// src/hooks/use-copilot-additional-instructions.ts
|
|
6
6
|
import { useEffect } from "react";
|
|
@@ -21,4 +21,4 @@ function useCopilotAdditionalInstructions({ instructions, available = "enabled"
|
|
|
21
21
|
export {
|
|
22
22
|
useCopilotAdditionalInstructions
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-BVK7PLK6.mjs.map
|
|
@@ -75,7 +75,8 @@ var emptyCopilotContext = {
|
|
|
75
75
|
},
|
|
76
76
|
langGraphInterruptAction: null,
|
|
77
77
|
setLangGraphInterruptAction: () => null,
|
|
78
|
-
removeLangGraphInterruptAction: () => null
|
|
78
|
+
removeLangGraphInterruptAction: () => null,
|
|
79
|
+
onError: void 0
|
|
79
80
|
};
|
|
80
81
|
var CopilotContext = React.createContext(emptyCopilotContext);
|
|
81
82
|
function useCopilotContext() {
|
|
@@ -93,4 +94,4 @@ export {
|
|
|
93
94
|
CopilotContext,
|
|
94
95
|
useCopilotContext
|
|
95
96
|
};
|
|
96
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-DKZTPL66.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/context/copilot-context.tsx"],"sourcesContent":["import { CopilotCloudConfig, FunctionCallHandler, CopilotErrorHandler } from \"@copilotkit/shared\";\nimport {\n ActionRenderProps,\n CatchAllActionRenderProps,\n FrontendAction,\n} from \"../types/frontend-action\";\nimport React from \"react\";\nimport { TreeNodeId, Tree } from \"../hooks/use-tree\";\nimport { DocumentPointer } from \"../types\";\nimport { CopilotChatSuggestionConfiguration } from \"../types/chat-suggestion-configuration\";\nimport { CoAgentStateRender, CoAgentStateRenderProps } from \"../types/coagent-action\";\nimport { CoagentState } from \"../types/coagent-state\";\nimport {\n CopilotRuntimeClient,\n ExtensionsInput,\n ForwardedParametersInput,\n} from \"@copilotkit/runtime-client-gql\";\nimport { Agent } from \"@copilotkit/runtime-client-gql\";\nimport {\n LangGraphInterruptAction,\n LangGraphInterruptActionSetter,\n} from \"../types/interrupt-action\";\n\n/**\n * Interface for the configuration of the Copilot API.\n */\nexport interface CopilotApiConfig {\n /**\n * The public API key for Copilot Cloud.\n */\n publicApiKey?: string;\n\n /**\n * The configuration for Copilot Cloud.\n */\n cloud?: CopilotCloudConfig;\n\n /**\n * The endpoint for the chat API.\n */\n chatApiEndpoint: string;\n\n /**\n * The endpoint for the Copilot transcribe audio service.\n */\n transcribeAudioUrl?: string;\n\n /**\n * The endpoint for the Copilot text to speech service.\n */\n textToSpeechUrl?: string;\n\n /**\n * additional headers to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'Authorization': 'Bearer your_token_here'\n * }\n * ```\n */\n headers: Record<string, string>;\n\n /**\n * Custom properties to be sent with the request\n * @default {}\n * @example\n * ```\n * {\n * 'user_id': 'user_id'\n * }\n * ```\n */\n properties?: Record<string, any>;\n\n /**\n * Indicates whether the user agent should send or receive cookies from the other domain\n * in the case of cross-origin requests.\n */\n credentials?: RequestCredentials;\n\n /**\n * Optional configuration for connecting to Model Context Protocol (MCP) servers.\n * This is typically derived from the CopilotKitProps and used internally.\n * @experimental\n */\n mcpServers?: Array<{ endpoint: string; apiKey?: string }>;\n}\n\nexport type InChatRenderFunction<TProps = ActionRenderProps<any> | CatchAllActionRenderProps<any>> =\n (props: TProps) => string | JSX.Element;\nexport type CoagentInChatRenderFunction = (\n props: CoAgentStateRenderProps<any>,\n) => string | JSX.Element | undefined | null;\n\nexport interface ChatComponentsCache {\n actions: Record<string, InChatRenderFunction | string>;\n coAgentStateRenders: Record<string, CoagentInChatRenderFunction | string>;\n}\n\nexport interface AgentSession {\n agentName: string;\n threadId?: string;\n nodeName?: string;\n}\n\nexport interface AuthState {\n status: \"authenticated\" | \"unauthenticated\";\n authHeaders: Record<string, string>;\n userId?: string;\n metadata?: Record<string, any>;\n}\n\nexport type ActionName = string;\nexport type ContextTree = Tree;\n\nexport interface CopilotContextParams {\n // function-calling\n actions: Record<string, FrontendAction<any>>;\n setAction: (id: string, action: FrontendAction<any>) => void;\n removeAction: (id: string) => void;\n\n // coagent actions\n coAgentStateRenders: Record<string, CoAgentStateRender<any>>;\n setCoAgentStateRender: (id: string, stateRender: CoAgentStateRender<any>) => void;\n removeCoAgentStateRender: (id: string) => void;\n\n chatComponentsCache: React.RefObject<ChatComponentsCache>;\n\n getFunctionCallHandler: (\n customEntryPoints?: Record<string, FrontendAction<any>>,\n ) => FunctionCallHandler;\n\n // text context\n addContext: (context: string, parentId?: string, categories?: string[]) => TreeNodeId;\n removeContext: (id: TreeNodeId) => void;\n getAllContext: () => Tree;\n getContextString: (documents: DocumentPointer[], categories: string[]) => string;\n\n // document context\n addDocumentContext: (documentPointer: DocumentPointer, categories?: string[]) => TreeNodeId;\n removeDocumentContext: (documentId: string) => void;\n getDocumentsContext: (categories: string[]) => DocumentPointer[];\n\n isLoading: boolean;\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>;\n\n chatSuggestionConfiguration: { [key: string]: CopilotChatSuggestionConfiguration };\n addChatSuggestionConfiguration: (\n id: string,\n suggestion: CopilotChatSuggestionConfiguration,\n ) => void;\n removeChatSuggestionConfiguration: (id: string) => void;\n\n chatInstructions: string;\n setChatInstructions: React.Dispatch<React.SetStateAction<string>>;\n\n additionalInstructions?: string[];\n setAdditionalInstructions: React.Dispatch<React.SetStateAction<string[]>>;\n\n // api endpoints\n copilotApiConfig: CopilotApiConfig;\n\n showDevConsole: boolean;\n\n // agents\n coagentStates: Record<string, CoagentState>;\n setCoagentStates: React.Dispatch<React.SetStateAction<Record<string, CoagentState>>>;\n coagentStatesRef: React.RefObject<Record<string, CoagentState>>;\n setCoagentStatesWithRef: (\n value:\n | Record<string, CoagentState>\n | ((prev: Record<string, CoagentState>) => Record<string, CoagentState>),\n ) => void;\n\n agentSession: AgentSession | null;\n setAgentSession: React.Dispatch<React.SetStateAction<AgentSession | null>>;\n\n agentLock: string | null;\n\n threadId: string;\n setThreadId: React.Dispatch<React.SetStateAction<string>>;\n\n runId: string | null;\n setRunId: React.Dispatch<React.SetStateAction<string | null>>;\n\n // The chat abort controller can be used to stop generation globally,\n // i.e. when using `stop()` from `useChat`\n chatAbortControllerRef: React.MutableRefObject<AbortController | null>;\n\n // runtime\n runtimeClient: CopilotRuntimeClient;\n\n /**\n * The forwarded parameters to use for the task.\n */\n forwardedParameters?: Partial<Pick<ForwardedParametersInput, \"temperature\">>;\n availableAgents: Agent[];\n\n /**\n * The auth states for the CopilotKit.\n */\n authStates_c?: Record<ActionName, AuthState>;\n setAuthStates_c?: React.Dispatch<React.SetStateAction<Record<ActionName, AuthState>>>;\n\n /**\n * The auth config for the CopilotKit.\n */\n authConfig_c?: {\n SignInComponent: React.ComponentType<{\n onSignInComplete: (authState: AuthState) => void;\n }>;\n };\n\n extensions: ExtensionsInput;\n setExtensions: React.Dispatch<React.SetStateAction<ExtensionsInput>>;\n langGraphInterruptAction: LangGraphInterruptAction | null;\n setLangGraphInterruptAction: LangGraphInterruptActionSetter;\n removeLangGraphInterruptAction: () => void;\n\n /**\n * Optional trace handler for comprehensive debugging and observability.\n */\n onError?: CopilotErrorHandler;\n}\n\nconst emptyCopilotContext: CopilotContextParams = {\n actions: {},\n setAction: () => {},\n removeAction: () => {},\n\n coAgentStateRenders: {},\n setCoAgentStateRender: () => {},\n removeCoAgentStateRender: () => {},\n\n chatComponentsCache: { current: { actions: {}, coAgentStateRenders: {} } },\n getContextString: (documents: DocumentPointer[], categories: string[]) =>\n returnAndThrowInDebug(\"\"),\n addContext: () => \"\",\n removeContext: () => {},\n getAllContext: () => [],\n\n getFunctionCallHandler: () => returnAndThrowInDebug(async () => {}),\n\n isLoading: false,\n setIsLoading: () => returnAndThrowInDebug(false),\n\n chatInstructions: \"\",\n setChatInstructions: () => returnAndThrowInDebug(\"\"),\n\n additionalInstructions: [],\n setAdditionalInstructions: () => returnAndThrowInDebug([]),\n\n getDocumentsContext: (categories: string[]) => returnAndThrowInDebug([]),\n addDocumentContext: () => returnAndThrowInDebug(\"\"),\n removeDocumentContext: () => {},\n runtimeClient: {} as any,\n\n copilotApiConfig: new (class implements CopilotApiConfig {\n get chatApiEndpoint(): string {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n }\n\n get headers(): Record<string, string> {\n return {};\n }\n get body(): Record<string, any> {\n return {};\n }\n })(),\n\n chatSuggestionConfiguration: {},\n addChatSuggestionConfiguration: () => {},\n removeChatSuggestionConfiguration: () => {},\n showDevConsole: false,\n coagentStates: {},\n setCoagentStates: () => {},\n coagentStatesRef: { current: {} },\n setCoagentStatesWithRef: () => {},\n agentSession: null,\n setAgentSession: () => {},\n forwardedParameters: {},\n agentLock: null,\n threadId: \"\",\n setThreadId: () => {},\n runId: null,\n setRunId: () => {},\n chatAbortControllerRef: { current: null },\n availableAgents: [],\n extensions: {},\n setExtensions: () => {},\n langGraphInterruptAction: null,\n setLangGraphInterruptAction: () => null,\n removeLangGraphInterruptAction: () => null,\n onError: undefined,\n};\n\nexport const CopilotContext = React.createContext<CopilotContextParams>(emptyCopilotContext);\n\nexport function useCopilotContext(): CopilotContextParams {\n const context = React.useContext(CopilotContext);\n if (context === emptyCopilotContext) {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n }\n return context;\n}\n\nfunction returnAndThrowInDebug<T>(_value: T): T {\n throw new Error(\"Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!\");\n}\n"],"mappings":";;;;;AAMA,OAAO,WAAW;AA6NlB,IAAM,sBAA4C;AAAA,EAChD,SAAS,CAAC;AAAA,EACV,WAAW,MAAM;AAAA,EAAC;AAAA,EAClB,cAAc,MAAM;AAAA,EAAC;AAAA,EAErB,qBAAqB,CAAC;AAAA,EACtB,uBAAuB,MAAM;AAAA,EAAC;AAAA,EAC9B,0BAA0B,MAAM;AAAA,EAAC;AAAA,EAEjC,qBAAqB,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,qBAAqB,CAAC,EAAE,EAAE;AAAA,EACzE,kBAAkB,CAAC,WAA8B,eAC/C,sBAAsB,EAAE;AAAA,EAC1B,YAAY,MAAM;AAAA,EAClB,eAAe,MAAM;AAAA,EAAC;AAAA,EACtB,eAAe,MAAM,CAAC;AAAA,EAEtB,wBAAwB,MAAM,sBAAsB,MAAY;AAAA,EAAC,EAAC;AAAA,EAElE,WAAW;AAAA,EACX,cAAc,MAAM,sBAAsB,KAAK;AAAA,EAE/C,kBAAkB;AAAA,EAClB,qBAAqB,MAAM,sBAAsB,EAAE;AAAA,EAEnD,wBAAwB,CAAC;AAAA,EACzB,2BAA2B,MAAM,sBAAsB,CAAC,CAAC;AAAA,EAEzD,qBAAqB,CAAC,eAAyB,sBAAsB,CAAC,CAAC;AAAA,EACvE,oBAAoB,MAAM,sBAAsB,EAAE;AAAA,EAClD,uBAAuB,MAAM;AAAA,EAAC;AAAA,EAC9B,eAAe,CAAC;AAAA,EAEhB,kBAAkB,IAAK,MAAkC;AAAA,IACvD,IAAI,kBAA0B;AAC5B,YAAM,IAAI,MAAM,uEAAuE;AAAA,IACzF;AAAA,IAEA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