@copilotkit/react-core 1.61.0 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/react-core",
3
- "version": "1.61.0",
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.61.0",
83
- "@copilotkit/runtime-client-gql": "1.61.0",
84
- "@copilotkit/web-inspector": "1.61.0",
85
- "@copilotkit/shared": "1.61.0",
86
- "@copilotkit/core": "1.61.0"
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
- copilotkit.setHeaders({ Authorization: `Bearer ${token}` });
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