@copilotkit/react-core 1.56.4-canary.1777529757 → 1.56.4-canary.1777531098

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/v2/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_copilotkit = require('../copilotkit-BAkj3zUc.cjs');
4
+ const require_copilotkit = require('../copilotkit-DMFu29Kx.cjs');
5
5
  require("./index.css");
6
6
  let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
7
7
 
package/dist/v2/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { $ as CopilotKitProvider, A as CopilotChatSuggestionView, B as useConfigureSuggestions, C as CopilotChatToggleButton, D as CopilotChatView_default, E as CopilotChat, F as CopilotChatAssistantMessage_default, G as useRenderTool, H as useCapabilities, I as CopilotChatToolCallsView, J as useRenderActivityMessage, K as useComponent, L as useAttachments, M as CopilotChatReasoningMessage_default, N as CopilotChatUserMessage_default, O as CopilotChatAttachmentQueue, P as CopilotChatAttachmentRenderer, Q as useRenderToolCall, R as useThreads, S as CopilotModalHeader, T as DefaultOpenIcon, U as useHumanInTheLoop, V as useSuggestions, W as useDefaultRenderTool, X as UseAgentUpdate, Y as useRenderCustomMessages, Z as useAgent, _ as WildcardToolCallRender, at as SandboxFunctionsContext, b as CopilotPopupView, ct as MCPAppsActivityRenderer, dt as CopilotChatInput_default, et as useCopilotKit, ft as AudioRecorderError, ht as useCopilotChatConfiguration, it as createA2UIMessageRenderer, j as CopilotChatSuggestionPill, k as CopilotChatMessageView, lt as MCPAppsActivityType, mt as CopilotChatConfigurationProvider, nt as useAgentContext, ot as useSandboxFunctions, pt as CopilotChatAudioRecorder, q as useFrontendTool, rt as defineToolCallRenderer, st as MCPAppsActivityContentSchema, t as CopilotKit, tt as CopilotKitCoreReact, ut as CopilotKitInspector, v as CopilotPopup, w as DefaultCloseIcon, x as CopilotSidebarView, y as CopilotSidebar, z as useInterrupt } from "../copilotkit-DAatqMh2.mjs";
3
+ import { $ as CopilotKitProvider, A as CopilotChatSuggestionView, B as useConfigureSuggestions, C as CopilotChatToggleButton, D as CopilotChatView_default, E as CopilotChat, F as CopilotChatAssistantMessage_default, G as useRenderTool, H as useCapabilities, I as CopilotChatToolCallsView, J as useRenderActivityMessage, K as useComponent, L as useAttachments, M as CopilotChatReasoningMessage_default, N as CopilotChatUserMessage_default, O as CopilotChatAttachmentQueue, P as CopilotChatAttachmentRenderer, Q as useRenderToolCall, R as useThreads, S as CopilotModalHeader, T as DefaultOpenIcon, U as useHumanInTheLoop, V as useSuggestions, W as useDefaultRenderTool, X as UseAgentUpdate, Y as useRenderCustomMessages, Z as useAgent, _ as WildcardToolCallRender, at as SandboxFunctionsContext, b as CopilotPopupView, ct as MCPAppsActivityRenderer, dt as CopilotChatInput_default, et as useCopilotKit, ft as AudioRecorderError, ht as useCopilotChatConfiguration, it as createA2UIMessageRenderer, j as CopilotChatSuggestionPill, k as CopilotChatMessageView, lt as MCPAppsActivityType, mt as CopilotChatConfigurationProvider, nt as useAgentContext, ot as useSandboxFunctions, pt as CopilotChatAudioRecorder, q as useFrontendTool, rt as defineToolCallRenderer, st as MCPAppsActivityContentSchema, t as CopilotKit, tt as CopilotKitCoreReact, ut as CopilotKitInspector, v as CopilotPopup, w as DefaultCloseIcon, x as CopilotSidebarView, y as CopilotSidebar, z as useInterrupt } from "../copilotkit-OmIUrWym.mjs";
4
4
  import "./index.css";
5
5
  import { defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
6
6
 
@@ -4393,16 +4393,20 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4393
4393
  return consumer;
4394
4394
  }, [normalizedConfig, resolvedConsumerAgentId]);
4395
4395
  const isGlobalConfig = rawConsumerAgentId === void 0 || rawConsumerAgentId === "*";
4396
+ const isDynamicConfigType = (0, react.useMemo)(() => !!normalizedConfig && "instructions" in normalizedConfig, [normalizedConfig]);
4396
4397
  const requestReload = (0, react.useCallback)(() => {
4397
4398
  if (!normalizedConfig) return;
4398
4399
  if (isGlobalConfig) {
4399
4400
  var _copilotkit$agents;
4401
+ const seen = /* @__PURE__ */ new Set();
4400
4402
  const agents = Object.values((_copilotkit$agents = copilotkit.agents) !== null && _copilotkit$agents !== void 0 ? _copilotkit$agents : {});
4401
4403
  for (const entry of agents) {
4402
4404
  const agentId = entry.agentId;
4403
4405
  if (!agentId) continue;
4406
+ seen.add(agentId);
4404
4407
  if (!entry.isRunning) copilotkit.reloadSuggestions(agentId);
4405
4408
  }
4409
+ if (targetAgentId && !seen.has(targetAgentId)) copilotkit.reloadSuggestions(targetAgentId);
4406
4410
  return;
4407
4411
  }
4408
4412
  if (!targetAgentId) return;
@@ -4447,6 +4451,26 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4447
4451
  requestReload,
4448
4452
  ...extraDeps
4449
4453
  ]);
4454
+ (0, react.useEffect)(() => {
4455
+ if (!normalizedConfig || !isDynamicConfigType) return;
4456
+ if (!targetAgentId) return;
4457
+ if (!!copilotkit.getAgent(targetAgentId)) return;
4458
+ const subscription = copilotkit.subscribe({ onAgentsChanged: () => {
4459
+ if (copilotkit.getAgent(targetAgentId)) {
4460
+ requestReload();
4461
+ subscription.unsubscribe();
4462
+ }
4463
+ } });
4464
+ return () => {
4465
+ subscription.unsubscribe();
4466
+ };
4467
+ }, [
4468
+ copilotkit,
4469
+ normalizedConfig,
4470
+ isDynamicConfigType,
4471
+ targetAgentId,
4472
+ requestReload
4473
+ ]);
4450
4474
  }
4451
4475
  function isDynamicConfig(config) {
4452
4476
  return "instructions" in config;
@@ -6468,7 +6492,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6468
6492
  bottomAnchored: true,
6469
6493
  ...disclaimer !== void 0 ? { disclaimer } : {}
6470
6494
  });
6471
- const hasSuggestions = !isConnecting && Array.isArray(suggestions) && suggestions.length > 0;
6495
+ const hasSuggestions = !isConnecting && !isRunning && Array.isArray(suggestions) && suggestions.length > 0;
6472
6496
  const BoundSuggestionView = hasSuggestions ? renderSlot(suggestionView, CopilotChatSuggestionView, {
6473
6497
  suggestions,
6474
6498
  loadingIndexes: suggestionLoadingIndexes,