@copilotkit/react-core 1.57.4 → 1.58.0-canary.thread-id-propagation

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/index.umd.js CHANGED
@@ -875,7 +875,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
875
875
  resourceUri: zod.z.string(),
876
876
  serverHash: zod.z.string(),
877
877
  serverId: zod.z.string().optional(),
878
- toolInput: zod.z.record(zod.z.unknown()).optional()
878
+ toolInput: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
879
879
  });
880
880
  function isRequest(msg) {
881
881
  return "id" in msg && "method" in msg;
@@ -2831,6 +2831,17 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2831
2831
  (0, react.useEffect)(() => {
2832
2832
  if (agent instanceof _ag_ui_client.HttpAgent) agent.headers = { ...copilotkit.headers };
2833
2833
  }, [agent, JSON.stringify(copilotkit.headers)]);
2834
+ const chatConfig = useCopilotChatConfiguration();
2835
+ const configThreadId = chatConfig === null || chatConfig === void 0 ? void 0 : chatConfig.threadId;
2836
+ const configHasExplicitThreadId = chatConfig === null || chatConfig === void 0 ? void 0 : chatConfig.hasExplicitThreadId;
2837
+ (0, react.useEffect)(() => {
2838
+ if (!configHasExplicitThreadId || !configThreadId) return;
2839
+ agent.threadId = configThreadId;
2840
+ }, [
2841
+ agent,
2842
+ configThreadId,
2843
+ configHasExplicitThreadId
2844
+ ]);
2834
2845
  return { agent };
2835
2846
  }
2836
2847
 
@@ -4147,7 +4158,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4147
4158
  switch (error.code) {
4148
4159
  case _copilotkit_shared.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR: return { primary: {
4149
4160
  label: "Show me how",
4150
- onClick: () => window.open("https://docs.copilotkit.ai/premium#how-do-i-get-access-to-premium-features", "_blank", "noopener,noreferrer")
4161
+ onClick: () => window.open("https://docs.copilotkit.ai/premium/overview#getting-access", "_blank", "noopener,noreferrer")
4151
4162
  } };
4152
4163
  case _copilotkit_shared.CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR: return { primary: {
4153
4164
  label: "Upgrade",
@@ -5733,80 +5744,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5733
5744
  //#endregion
5734
5745
  //#region src/hooks/use-copilot-chat.ts
5735
5746
  /**
5736
- * `useCopilotChat` is a lightweight React hook for headless chat interactions.
5737
- * Perfect for controlling the prebuilt chat components programmatically.
5738
- *
5739
- * **Open Source Friendly** - Works without requiring a free public license key.
5740
- *
5741
- * <Callout title="Looking for fully headless UI?">
5742
- * Get started with [useCopilotChatHeadless_c](https://docs.copilotkit.ai/reference/v1/hooks/useCopilotChatHeadless_c).
5743
- * </Callout>
5744
- *
5745
- * ## Use Cases
5746
- *
5747
- * - **Programmatic Messaging**: Send messages without displaying chat UI
5748
- * - **Programmatic control**: Control prebuilt component programmatically
5749
- * - **Background Operations**: Trigger AI interactions in the background
5750
- * - **Fire-and-Forget**: Send messages without needing to read responses
5751
- *
5752
- * ## Usage
5753
- *
5754
- * ```tsx
5755
- * import { TextMessage, MessageRole } from "@copilotkit/runtime-client-gql";
5756
- *
5757
- * const { appendMessage } = useCopilotChat();
5758
- *
5759
- * // Example usage without naming conflicts
5760
- * const handleSendMessage = async (content: string) => {
5761
- * await appendMessage(
5762
- * new TextMessage({
5763
- * role: MessageRole.User,
5764
- * content,
5765
- * })
5766
- * );
5767
- * };
5768
- * ```
5769
- *
5770
- * ## Return Values
5771
- * The following properties are returned from the hook:
5772
- *
5773
- * <PropertyReference name="visibleMessages" type="DeprecatedGqlMessage[]" deprecated>
5774
- * Array of messages in old non-AG-UI format, use for compatibility only
5775
- * </PropertyReference>
5776
- *
5777
- * <PropertyReference name="appendMessage" type="(message: DeprecatedGqlMessage, options?) => Promise<void>" deprecated>
5778
- * Append message using old format, use `sendMessage` instead
5779
- * </PropertyReference>
5780
- *
5781
- * <PropertyReference name="reloadMessages" type="(messageId: string) => Promise<void>">
5782
- * Regenerate the response for a specific message by ID
5783
- * </PropertyReference>
5784
- *
5785
- * <PropertyReference name="stopGeneration" type="() => void">
5786
- * Stop the current message generation process
5787
- * </PropertyReference>
5788
- *
5789
- * <PropertyReference name="reset" type="() => void">
5790
- * Clear all messages and reset chat state completely
5791
- * </PropertyReference>
5792
- *
5793
- * <PropertyReference name="isLoading" type="boolean">
5794
- * Whether the chat is currently generating a response
5795
- * </PropertyReference>
5796
- *
5797
- * <PropertyReference name="runChatCompletion" type="() => Promise<Message[]>">
5798
- * Manually trigger chat completion for advanced usage
5799
- * </PropertyReference>
5800
- *
5801
- * <PropertyReference name="mcpServers" type="MCPServerConfig[]">
5802
- * Array of Model Context Protocol server configurations
5803
- * </PropertyReference>
5804
- *
5805
- * <PropertyReference name="setMcpServers" type="(servers: MCPServerConfig[]) => void">
5806
- * Update MCP server configurations for enhanced context
5807
- * </PropertyReference>
5808
- */
5809
- /**
5810
5747
  * A lightweight React hook for headless chat interactions.
5811
5748
  * Perfect for programmatic messaging, background operations, and custom UI implementations.
5812
5749
  *
@@ -6429,7 +6366,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6429
6366
  * useful for showing intermediate state or progress during Agentic Copilot operations.
6430
6367
  * To get started using rendering intermediate state through this hook, checkout the documentation.
6431
6368
  *
6432
- * https://docs.copilotkit.ai/coagents/shared-state/predictive-state-updates
6369
+ * https://docs.copilotkit.ai/langgraph-python/shared-state/predictive-state-updates
6433
6370
  */
6434
6371
  function useCoAgentStateRender(action, dependencies) {
6435
6372
  const { chatComponentsCache, availableAgents } = (0, react.useContext)(CopilotContext);
@@ -6738,7 +6675,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6738
6675
  * This hook is used to integrate an agent into your application. With its use, you can
6739
6676
  * render and update the state of the agent, allowing for a dynamic and interactive experience.
6740
6677
  * We call these shared state experiences "agentic copilots". To get started using agentic copilots, which
6741
- * we refer to as CoAgents, checkout the documentation at https://docs.copilotkit.ai/coagents/quickstart/langgraph.
6678
+ * we refer to as CoAgents, checkout the documentation at https://docs.copilotkit.ai/langgraph-python/quickstart.
6742
6679
  */
6743
6680
  function useCoAgent(options) {
6744
6681
  const { agent } = useAgent({ agentId: options.name });