@copilotkit/react-core 1.63.3-canary.rc-1 → 1.64.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.
@@ -314,17 +314,15 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
314
314
  const status = copilotkit.runtimeConnectionStatus;
315
315
  if (isRuntimeConfigured && (status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Disconnected || status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
316
316
  const cached = provisionalAgentCache.current.get(resolvedAgentId);
317
- if (cached) {
318
- copilotkit.applyHeadersToAgent(cached);
319
- return {
320
- agent: cached,
321
- isReady: false
322
- };
323
- }
317
+ if (cached) return {
318
+ agent: cached,
319
+ isReady: false
320
+ };
324
321
  const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
325
322
  runtimeUrl: copilotkit.runtimeUrl,
326
323
  agentId: resolvedAgentId,
327
324
  transport: copilotkit.runtimeTransport,
325
+ credentials: copilotkit.credentials,
328
326
  runtimeMode: "pending"
329
327
  });
330
328
  copilotkit.applyHeadersToAgent(provisional);
@@ -336,17 +334,15 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
336
334
  }
337
335
  if (isRuntimeConfigured && status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Error) {
338
336
  const cached = provisionalAgentCache.current.get(resolvedAgentId);
339
- if (cached) {
340
- copilotkit.applyHeadersToAgent(cached);
341
- return {
342
- agent: cached,
343
- isReady: false
344
- };
345
- }
337
+ if (cached) return {
338
+ agent: cached,
339
+ isReady: false
340
+ };
346
341
  const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
347
342
  runtimeUrl: copilotkit.runtimeUrl,
348
343
  agentId: resolvedAgentId,
349
344
  transport: copilotkit.runtimeTransport,
345
+ credentials: copilotkit.credentials,
350
346
  runtimeMode: "pending"
351
347
  });
352
348
  copilotkit.applyHeadersToAgent(provisional);
@@ -365,6 +361,7 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
365
361
  copilotkit.runtimeConnectionStatus,
366
362
  copilotkit.runtimeUrl,
367
363
  copilotkit.runtimeTransport,
364
+ copilotkit.credentials,
368
365
  JSON.stringify(copilotkit.headers)
369
366
  ]);
370
367
  (0, react.useEffect)(() => {
@@ -404,7 +401,12 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
404
401
  ]);
405
402
  (0, react.useEffect)(() => {
406
403
  if (agent instanceof _ag_ui_client.HttpAgent) copilotkit.applyHeadersToAgent(agent);
407
- }, [agent, JSON.stringify(copilotkit.headers)]);
404
+ if (agent instanceof _copilotkit_core.ProxiedCopilotRuntimeAgent) agent.credentials = copilotkit.credentials;
405
+ }, [
406
+ agent,
407
+ JSON.stringify(copilotkit.headers),
408
+ copilotkit.credentials
409
+ ]);
408
410
  const configThreadId = chatConfig?.threadId;
409
411
  const configHasExplicitThreadId = chatConfig?.hasExplicitThreadId;
410
412
  (0, react.useEffect)(() => {