@copilotkit/react-core 1.58.0 → 1.59.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.
@@ -2127,7 +2127,7 @@ const MCPAppsActivityContentSchema = zod.z.object({
2127
2127
  resourceUri: zod.z.string(),
2128
2128
  serverHash: zod.z.string(),
2129
2129
  serverId: zod.z.string().optional(),
2130
- toolInput: zod.z.record(zod.z.unknown()).optional()
2130
+ toolInput: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
2131
2131
  });
2132
2132
  function isRequest(msg) {
2133
2133
  return "id" in msg && "method" in msg;
@@ -3450,6 +3450,9 @@ function A2UICatalogContext({ catalog, includeSchema }) {
3450
3450
  //#region src/v2/providers/CopilotKitProvider.tsx
3451
3451
  const HEADER_NAME = "X-CopilotCloud-Public-Api-Key";
3452
3452
  const COPILOT_CLOUD_CHAT_URL$1 = "https://api.cloud.copilotkit.ai/copilotkit/v1";
3453
+ const EMPTY_HEADERS = Object.freeze({});
3454
+ const EMPTY_PROPERTIES = Object.freeze({});
3455
+ const EMPTY_AGENTS = Object.freeze({});
3453
3456
  const DEFAULT_DESIGN_SKILL = `When generating UI with generateSandboxedUi, follow these design principles inspired by shadcn/ui:
3454
3457
 
3455
3458
  - Use a minimal, flat aesthetic. Avoid drop shadows and gradients — rely on subtle borders (1px solid, light gray like #e5e7eb) to define surfaces.
@@ -3470,7 +3473,7 @@ function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
3470
3473
  }, [value, warningMessage]);
3471
3474
  return value;
3472
3475
  }
3473
- const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = {}, credentials, publicApiKey, publicLicenseKey, licenseToken, properties = {}, agents__unsafe_dev_only: agents = {}, selfManagedAgents = {}, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, openGenerativeUI, showDevConsole = false, useSingleEndpoint, onError, a2ui, defaultThrottleMs, inspectorDefaultAnchor, debug }) => {
3476
+ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY_HEADERS, credentials, publicApiKey, publicLicenseKey, licenseToken, properties = EMPTY_PROPERTIES, agents__unsafe_dev_only: agents = EMPTY_AGENTS, selfManagedAgents = EMPTY_AGENTS, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, openGenerativeUI, showDevConsole = false, useSingleEndpoint, onError, a2ui, defaultThrottleMs, inspectorDefaultAnchor, debug }) => {
3474
3477
  const [shouldRenderInspector, setShouldRenderInspector] = (0, react.useState)(false);
3475
3478
  const [runtimeA2UIEnabled, setRuntimeA2UIEnabled] = (0, react.useState)(false);
3476
3479
  const [runtimeOpenGenUIEnabled, setRuntimeOpenGenUIEnabled] = (0, react.useState)(false);
@@ -4159,6 +4162,17 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
4159
4162
  (0, react.useEffect)(() => {
4160
4163
  if (agent instanceof _ag_ui_client.HttpAgent) agent.headers = { ...copilotkit.headers };
4161
4164
  }, [agent, JSON.stringify(copilotkit.headers)]);
4165
+ const chatConfig = useCopilotChatConfiguration();
4166
+ const configThreadId = chatConfig?.threadId;
4167
+ const configHasExplicitThreadId = chatConfig?.hasExplicitThreadId;
4168
+ (0, react.useEffect)(() => {
4169
+ if (!configHasExplicitThreadId || !configThreadId) return;
4170
+ agent.threadId = configThreadId;
4171
+ }, [
4172
+ agent,
4173
+ configThreadId,
4174
+ configHasExplicitThreadId
4175
+ ]);
4162
4176
  return { agent };
4163
4177
  }
4164
4178
 
@@ -7045,14 +7059,14 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
7045
7059
  const [lastConnectedThreadId, setLastConnectedThreadId] = (0, react.useState)(null);
7046
7060
  const isConnecting = hasExplicitThreadId && lastConnectedThreadId !== resolvedThreadId;
7047
7061
  (0, react.useEffect)(() => {
7062
+ agent.threadId = resolvedThreadId;
7048
7063
  if (!hasExplicitThreadId) return;
7049
7064
  let detached = false;
7050
7065
  const connectAbortController = new AbortController();
7051
7066
  if (agent instanceof _ag_ui_client.HttpAgent) agent.abortController = connectAbortController;
7052
- agent.threadId = resolvedThreadId;
7053
- const connect = async (agent) => {
7067
+ const connect = async (agentToConnect) => {
7054
7068
  try {
7055
- await copilotkit.connectAgent({ agent });
7069
+ await copilotkit.connectAgent({ agent: agentToConnect });
7056
7070
  } catch (error) {
7057
7071
  if (detached) return;
7058
7072
  console.error("CopilotChat: connectAgent failed", error);
@@ -10426,4 +10440,4 @@ Object.defineProperty(exports, 'useToast', {
10426
10440
  return useToast;
10427
10441
  }
10428
10442
  });
10429
- //# sourceMappingURL=copilotkit-Drw-g6zA.cjs.map
10443
+ //# sourceMappingURL=copilotkit-DKPrBplZ.cjs.map