@copilotkit/react-core 1.55.0-next.8 → 1.55.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.
- package/CHANGELOG.md +48 -5
- package/dist/{copilotkit-DNYSFuz5.mjs → copilotkit-BY5S1-0P.mjs} +2772 -858
- package/dist/copilotkit-BY5S1-0P.mjs.map +1 -0
- package/dist/{copilotkit-Dy5w3qEV.d.mts → copilotkit-BuhSUZHb.d.mts} +230 -17
- package/dist/copilotkit-BuhSUZHb.d.mts.map +1 -0
- package/dist/{copilotkit-B3Mb1yVE.cjs → copilotkit-Bz5-ImDl.cjs} +2776 -832
- package/dist/copilotkit-Bz5-ImDl.cjs.map +1 -0
- package/dist/{copilotkit-DBzgOMby.d.cts → copilotkit-dwDWYpya.d.cts} +230 -17
- package/dist/copilotkit-dwDWYpya.d.cts.map +1 -0
- package/dist/index.cjs +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +9 -4
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1624 -396
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/index.cjs +13 -1
- package/dist/v2/index.css +1 -1
- package/dist/v2/index.d.cts +3 -3
- package/dist/v2/index.d.mts +3 -3
- package/dist/v2/index.mjs +3 -2
- package/dist/v2/index.umd.js +2746 -790
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +62 -54
- package/scripts/scope-preflight.mjs +1 -2
- package/src/components/CopilotListeners.tsx +41 -8
- package/src/components/copilot-provider/__tests__/copilot-messages-key.test.tsx +92 -0
- package/src/components/copilot-provider/copilotkit-props.tsx +4 -2
- package/src/components/copilot-provider/copilotkit.tsx +3 -3
- package/src/components/toast/toast-provider.tsx +269 -194
- package/src/hooks/__tests__/use-copilot-chat-internal-connect.test.tsx +27 -16
- package/src/hooks/use-copilot-chat_internal.ts +15 -4
- package/src/v2/__tests__/A2UIMessageRenderer.test.tsx +86 -22
- package/src/v2/__tests__/utils/test-helpers.tsx +107 -7
- package/src/v2/a2ui/A2UICatalogContext.tsx +79 -0
- package/src/v2/a2ui/A2UIMessageRenderer.tsx +125 -37
- package/src/v2/a2ui/A2UIToolCallRenderer.tsx +290 -0
- package/src/v2/components/CopilotKitInspector.tsx +2 -0
- package/src/v2/components/OpenGenerativeUIRenderer.tsx +598 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.tsx +665 -0
- package/src/v2/components/chat/CopilotChat.tsx +197 -52
- package/src/v2/components/chat/CopilotChatAssistantMessage.tsx +17 -2
- package/src/v2/components/chat/CopilotChatAttachmentQueue.tsx +481 -0
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.tsx +139 -0
- package/src/v2/components/chat/CopilotChatInput.tsx +146 -77
- package/src/v2/components/chat/CopilotChatMessageView.tsx +260 -151
- package/src/v2/components/chat/CopilotChatSuggestionView.tsx +1 -0
- package/src/v2/components/chat/CopilotChatUserMessage.tsx +54 -0
- package/src/v2/components/chat/CopilotChatView.tsx +179 -66
- package/src/v2/components/chat/__tests__/CopilotChat.attachments.test.tsx +168 -0
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.tsx +63 -2
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.tsx +544 -1
- package/src/v2/components/chat/__tests__/CopilotChatPerf.e2e.test.tsx +268 -0
- package/src/v2/components/chat/__tests__/CopilotChatPropsRerender.e2e.test.tsx +249 -0
- package/src/v2/components/chat/__tests__/CopilotChatToolRendering.e2e.test.tsx +5 -2
- package/src/v2/components/chat/__tests__/CopilotChatToolRerenders.e2e.test.tsx +5 -2
- package/src/v2/components/chat/__tests__/MCPAppsActivityRenderer.e2e.test.tsx +60 -3
- package/src/v2/components/chat/__tests__/copilot-chat-throttle.test.tsx +138 -0
- package/src/v2/components/chat/index.ts +9 -0
- package/src/v2/components/chat/scroll-element-context.ts +13 -0
- package/src/v2/hooks/__tests__/use-agent-context-timing.e2e.test.tsx +8 -0
- package/src/v2/hooks/__tests__/use-agent-thread-isolation.test.tsx +327 -0
- package/src/v2/hooks/__tests__/use-agent-throttle.test.tsx +1003 -0
- package/src/v2/hooks/__tests__/use-agent.e2e.test.tsx +13 -2
- package/src/v2/hooks/__tests__/use-attachments.test.tsx +169 -0
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.tsx +23 -4
- package/src/v2/hooks/__tests__/use-threads.test.tsx +54 -0
- package/src/v2/hooks/index.ts +5 -0
- package/src/v2/hooks/use-agent.tsx +220 -15
- package/src/v2/hooks/use-attachments.tsx +269 -0
- package/src/v2/hooks/use-frontend-tool.tsx +5 -2
- package/src/v2/hooks/use-render-activity-message.tsx +9 -2
- package/src/v2/hooks/use-render-custom-messages.tsx +6 -1
- package/src/v2/hooks/use-threads.tsx +35 -15
- package/src/v2/index.ts +5 -1
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +112 -0
- package/src/v2/lib/__tests__/slots.test.ts +56 -0
- package/src/v2/lib/processPartialHtml.ts +45 -0
- package/src/v2/lib/slots.tsx +42 -1
- package/src/v2/providers/CopilotChatConfigurationProvider.tsx +9 -3
- package/src/v2/providers/CopilotKitProvider.tsx +268 -32
- package/src/v2/providers/SandboxFunctionsContext.ts +10 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.tsx +198 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.test.tsx +71 -0
- package/src/v2/providers/index.ts +7 -0
- package/src/v2/styles/globals.css +2 -1
- package/src/v2/types/index.ts +1 -0
- package/src/v2/types/sandbox-function.ts +11 -0
- package/dist/copilotkit-B3Mb1yVE.cjs.map +0 -1
- package/dist/copilotkit-DBzgOMby.d.cts.map +0 -1
- package/dist/copilotkit-DNYSFuz5.mjs.map +0 -1
- package/dist/copilotkit-Dy5w3qEV.d.mts.map +0 -1
- package/src/v2/components/__tests__/license-warning-banner.test.tsx +0 -46
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as
|
|
1
|
+
import { $t as CoagentInChatRenderFunction, An as FrontendActionAvailability, Cn as ActionRenderProps, Dn as CatchAllActionRenderProps, En as ActionRenderPropsWait, M as useAgent, On as CatchAllFrontendAction, Sn as TreeNode, Tn as ActionRenderPropsNoArgsWait, Z as useRenderToolCall$1, _n as CrewsToolStateItem, an as LangGraphInterruptAction, bn as DocumentPointer, cn as LangGraphInterruptRender, dn as QueuedInterruptEvent, en as CopilotApiConfig, fn as CrewsAgentState, gn as CrewsTaskStateItem, hn as CrewsStateItem, in as CoAgentStateRender, jn as RenderFunctionStatus, kn as FrontendAction, ln as LangGraphInterruptRenderHandlerProps, mn as CrewsResponseStatus, n as defaultCopilotContextCategories, nn as CopilotContextParams, on as LangGraphInterruptActionSetter, pn as CrewsResponse, r as CopilotKitProps, rn as useCopilotContext, sn as LangGraphInterruptActionSetterArgs, t as CopilotKit, tn as CopilotContext, un as LangGraphInterruptRenderProps, vn as CopilotChatSuggestionConfiguration, wn as ActionRenderPropsNoArgs, xn as Tree, yn as SystemMessageFunction } from "./copilotkit-dwDWYpya.cjs";
|
|
2
2
|
import "./v2/index.cjs";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import { CopilotRuntimeClient, CopilotRuntimeClientOptions, ForwardedParametersInput, Message } from "@copilotkit/runtime-client-gql";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as
|
|
1
|
+
import { $t as CoagentInChatRenderFunction, An as FrontendActionAvailability, Cn as ActionRenderProps, Dn as CatchAllActionRenderProps, En as ActionRenderPropsWait, M as useAgent, On as CatchAllFrontendAction, Sn as TreeNode, Tn as ActionRenderPropsNoArgsWait, Z as useRenderToolCall$1, _n as CrewsToolStateItem, an as LangGraphInterruptAction, bn as DocumentPointer, cn as LangGraphInterruptRender, dn as QueuedInterruptEvent, en as CopilotApiConfig, fn as CrewsAgentState, gn as CrewsTaskStateItem, hn as CrewsStateItem, in as CoAgentStateRender, jn as RenderFunctionStatus, kn as FrontendAction, ln as LangGraphInterruptRenderHandlerProps, mn as CrewsResponseStatus, n as defaultCopilotContextCategories, nn as CopilotContextParams, on as LangGraphInterruptActionSetter, pn as CrewsResponse, r as CopilotKitProps, rn as useCopilotContext, sn as LangGraphInterruptActionSetterArgs, t as CopilotKit, tn as CopilotContext, un as LangGraphInterruptRenderProps, vn as CopilotChatSuggestionConfiguration, wn as ActionRenderPropsNoArgs, xn as Tree, yn as SystemMessageFunction } from "./copilotkit-BuhSUZHb.mjs";
|
|
2
2
|
import "./v2/index.mjs";
|
|
3
3
|
import React, { ReactNode, RefObject, SetStateAction } from "react";
|
|
4
4
|
import { StaticSuggestionsConfig, Suggestion } from "@copilotkit/core";
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { $ as useCopilotKit, B as useConfigureSuggestions, H as useHumanInTheLoop$1, J as useRenderCustomMessages, K as useFrontendTool$1, V as useSuggestions, X as useAgent, Z as useRenderToolCall$1, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, f as useToast, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, l as useCoAgentStateRenders, m as useCopilotMessagesContext, mt as useCopilotChatConfiguration, n as defaultCopilotContextCategories, nt as defineToolCallRenderer, o as useThreads, p as CopilotMessagesContext, r as CoAgentStateRenderBridge, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback, z as useInterrupt } from "./copilotkit-BY5S1-0P.mjs";
|
|
4
4
|
import React, { Fragment, createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { CopilotKitCoreRuntimeConnectionStatus, ToolCallStatus } from "@copilotkit/core";
|
|
6
6
|
import { AGUIConnectNotImplementedError, HttpAgent } from "@ag-ui/client";
|
|
@@ -40,7 +40,11 @@ function useCopilotChatInternal({ suggestions, onInProgress, onSubmitMessage, on
|
|
|
40
40
|
const existingConfig = useCopilotChatConfiguration();
|
|
41
41
|
const [agentAvailable, setAgentAvailable] = useState(false);
|
|
42
42
|
const resolvedAgentId = existingConfig?.agentId ?? "default";
|
|
43
|
-
const { agent } = useAgent({
|
|
43
|
+
const { agent } = useAgent({
|
|
44
|
+
agentId: resolvedAgentId,
|
|
45
|
+
threadId: existingConfig?.threadId
|
|
46
|
+
});
|
|
47
|
+
const lastConnectedAgentRef = useRef(null);
|
|
44
48
|
useEffect(() => {
|
|
45
49
|
let detached = false;
|
|
46
50
|
const connectAbortController = new AbortController();
|
|
@@ -55,11 +59,12 @@ function useCopilotChatInternal({ suggestions, onInProgress, onSubmitMessage, on
|
|
|
55
59
|
if (error instanceof AGUIConnectNotImplementedError) {} else console.error("CopilotChat: connectAgent failed", error);
|
|
56
60
|
}
|
|
57
61
|
};
|
|
58
|
-
if (agent &&
|
|
59
|
-
|
|
62
|
+
if (agent && agent !== lastConnectedAgentRef.current && copilotkit.runtimeConnectionStatus === CopilotKitCoreRuntimeConnectionStatus.Connected) {
|
|
63
|
+
lastConnectedAgentRef.current = agent;
|
|
60
64
|
connect(agent);
|
|
61
65
|
}
|
|
62
66
|
return () => {
|
|
67
|
+
lastConnectedAgentRef.current = null;
|
|
63
68
|
detached = true;
|
|
64
69
|
connectAbortController.abort();
|
|
65
70
|
agent?.detachActiveRun();
|