@copilotkit/react-core 1.63.3-canary.rc-1 → 1.64.0

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.
@@ -285,17 +285,15 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
285
285
  const status = copilotkit.runtimeConnectionStatus;
286
286
  if (isRuntimeConfigured && (status === CopilotKitCoreRuntimeConnectionStatus.Disconnected || status === CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
287
287
  const cached = provisionalAgentCache.current.get(resolvedAgentId);
288
- if (cached) {
289
- copilotkit.applyHeadersToAgent(cached);
290
- return {
291
- agent: cached,
292
- isReady: false
293
- };
294
- }
288
+ if (cached) return {
289
+ agent: cached,
290
+ isReady: false
291
+ };
295
292
  const provisional = new ProxiedCopilotRuntimeAgent({
296
293
  runtimeUrl: copilotkit.runtimeUrl,
297
294
  agentId: resolvedAgentId,
298
295
  transport: copilotkit.runtimeTransport,
296
+ credentials: copilotkit.credentials,
299
297
  runtimeMode: "pending"
300
298
  });
301
299
  copilotkit.applyHeadersToAgent(provisional);
@@ -307,17 +305,15 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
307
305
  }
308
306
  if (isRuntimeConfigured && status === CopilotKitCoreRuntimeConnectionStatus.Error) {
309
307
  const cached = provisionalAgentCache.current.get(resolvedAgentId);
310
- if (cached) {
311
- copilotkit.applyHeadersToAgent(cached);
312
- return {
313
- agent: cached,
314
- isReady: false
315
- };
316
- }
308
+ if (cached) return {
309
+ agent: cached,
310
+ isReady: false
311
+ };
317
312
  const provisional = new ProxiedCopilotRuntimeAgent({
318
313
  runtimeUrl: copilotkit.runtimeUrl,
319
314
  agentId: resolvedAgentId,
320
315
  transport: copilotkit.runtimeTransport,
316
+ credentials: copilotkit.credentials,
321
317
  runtimeMode: "pending"
322
318
  });
323
319
  copilotkit.applyHeadersToAgent(provisional);
@@ -336,6 +332,7 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
336
332
  copilotkit.runtimeConnectionStatus,
337
333
  copilotkit.runtimeUrl,
338
334
  copilotkit.runtimeTransport,
335
+ copilotkit.credentials,
339
336
  JSON.stringify(copilotkit.headers)
340
337
  ]);
341
338
  useEffect(() => {
@@ -375,7 +372,12 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
375
372
  ]);
376
373
  useEffect(() => {
377
374
  if (agent instanceof HttpAgent) copilotkit.applyHeadersToAgent(agent);
378
- }, [agent, JSON.stringify(copilotkit.headers)]);
375
+ if (agent instanceof ProxiedCopilotRuntimeAgent) agent.credentials = copilotkit.credentials;
376
+ }, [
377
+ agent,
378
+ JSON.stringify(copilotkit.headers),
379
+ copilotkit.credentials
380
+ ]);
379
381
  const configThreadId = chatConfig?.threadId;
380
382
  const configHasExplicitThreadId = chatConfig?.hasExplicitThreadId;
381
383
  useEffect(() => {