@copilotkit/react-core 1.60.2 → 1.61.1
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/dist/{copilotkit-CP5uyB2h.cjs → copilotkit-BCJDP8qd.cjs} +70 -30
- package/dist/copilotkit-BCJDP8qd.cjs.map +1 -0
- package/dist/{copilotkit-CyL6ZsLP.d.cts → copilotkit-CEdu_aie.d.cts} +23 -1
- package/dist/{copilotkit-UaQ7KSUq.d.mts.map → copilotkit-CEdu_aie.d.cts.map} +1 -1
- package/dist/{copilotkit-UaQ7KSUq.d.mts → copilotkit-M1FiciGd.d.mts} +23 -1
- package/dist/{copilotkit-CyL6ZsLP.d.cts.map → copilotkit-M1FiciGd.d.mts.map} +1 -1
- package/dist/{copilotkit-DheptEiV.mjs → copilotkit-UY-H6Kx7.mjs} +70 -30
- package/dist/copilotkit-UY-H6Kx7.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +38 -22
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +60 -13
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +22 -0
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +22 -0
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +61 -14
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.d.cts +1 -1
- package/dist/v2/index.d.mts +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +69 -29
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/skills/react-core/references/provider-setup.md +20 -2
- package/dist/copilotkit-CP5uyB2h.cjs.map +0 -1
- package/dist/copilotkit-DheptEiV.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkit/react-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.61.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -79,11 +79,11 @@
|
|
|
79
79
|
"untruncate-json": "^0.0.1",
|
|
80
80
|
"use-stick-to-bottom": "^1.1.1",
|
|
81
81
|
"zod-to-json-schema": "^3.24.5",
|
|
82
|
-
"@copilotkit/a2ui-renderer": "1.
|
|
83
|
-
"@copilotkit/core": "1.
|
|
84
|
-
"@copilotkit/
|
|
85
|
-
"@copilotkit/
|
|
86
|
-
"@copilotkit/
|
|
82
|
+
"@copilotkit/a2ui-renderer": "1.61.1",
|
|
83
|
+
"@copilotkit/core": "1.61.1",
|
|
84
|
+
"@copilotkit/shared": "1.61.1",
|
|
85
|
+
"@copilotkit/web-inspector": "1.61.1",
|
|
86
|
+
"@copilotkit/runtime-client-gql": "1.61.1"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@tailwindcss/cli": "^4.1.11",
|
|
@@ -100,15 +100,33 @@ of re-rendering the provider with a new `headers` prop.
|
|
|
100
100
|
import { useCopilotKit } from "@copilotkit/react-core/v2";
|
|
101
101
|
import { useEffect } from "react";
|
|
102
102
|
|
|
103
|
-
export function AuthTokenSync({ token }: { token: string }) {
|
|
103
|
+
export function AuthTokenSync({ token }: { token: string | null }) {
|
|
104
104
|
const { copilotkit } = useCopilotKit();
|
|
105
105
|
useEffect(() => {
|
|
106
|
-
|
|
106
|
+
// setHeaders is an overwrite, not a merge — spread the current headers so
|
|
107
|
+
// entries set elsewhere (e.g. the public license key) survive. A `null`
|
|
108
|
+
// value clears that header, so logging out removes `Authorization` instead
|
|
109
|
+
// of sending an empty one.
|
|
110
|
+
copilotkit.setHeaders({
|
|
111
|
+
...copilotkit.headers,
|
|
112
|
+
Authorization: token ? `Bearer ${token}` : null,
|
|
113
|
+
});
|
|
107
114
|
}, [copilotkit, token]);
|
|
108
115
|
return null;
|
|
109
116
|
}
|
|
110
117
|
```
|
|
111
118
|
|
|
119
|
+
`setHeaders` accepts `null`/`undefined` values and drops those keys, so passing
|
|
120
|
+
`Authorization: null` is the supported way to clear a header. Setting it to an
|
|
121
|
+
empty string would keep the header present with a blank value.
|
|
122
|
+
|
|
123
|
+
Do not set the same header through both the `headers` prop and imperative
|
|
124
|
+
`setHeaders`. Whenever any provider prop changes, the provider calls
|
|
125
|
+
`setHeaders` with its prop-derived headers — a full overwrite that drops every
|
|
126
|
+
imperatively-set header, not just keys the prop also defines. Keep rotating
|
|
127
|
+
values like the auth token out of the `headers` prop and manage them only
|
|
128
|
+
through `setHeaders` (as above).
|
|
129
|
+
|
|
112
130
|
### Global error handler
|
|
113
131
|
|
|
114
132
|
`onError` fires for every `CopilotKitCoreErrorCode` emitted by core. Keeps
|