@copilotkit/react-core 1.56.0 → 1.56.2
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/{copilotkit-Dv8zU8_U.d.cts → copilotkit-BtP7w7cT.d.cts} +10 -1
- package/dist/{copilotkit-Dv8zU8_U.d.cts.map → copilotkit-BtP7w7cT.d.cts.map} +1 -1
- package/dist/{copilotkit-f2Uq0RwG.d.mts → copilotkit-CCbxm6JM.d.mts} +10 -1
- package/dist/{copilotkit-f2Uq0RwG.d.mts.map → copilotkit-CCbxm6JM.d.mts.map} +1 -1
- package/dist/{copilotkit-Cvb6WpAX.cjs → copilotkit-CSJw5BG8.cjs} +32 -17
- package/dist/copilotkit-CSJw5BG8.cjs.map +1 -0
- package/dist/{copilotkit-BebqQrYT.mjs → copilotkit-Cj2ZIxVr.mjs} +32 -17
- package/dist/copilotkit-Cj2ZIxVr.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +14 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.d.cts +1 -1
- package/dist/v2/index.d.mts +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +32 -17
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/src/components/CopilotListeners.tsx +15 -4
- package/src/components/__tests__/CopilotListeners.test.tsx +38 -0
- package/src/v2/components/chat/CopilotChatAssistantMessage.tsx +4 -4
- package/src/v2/components/chat/CopilotChatInput.tsx +21 -2
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.thumbs.test.tsx +72 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.tsx +38 -0
- package/src/v2/components/ui/button.tsx +12 -11
- package/src/v2/hooks/__tests__/use-render-custom-messages.test.tsx +55 -0
- package/src/v2/hooks/use-render-custom-messages.tsx +1 -1
- package/src/v2/hooks/use-render-tool-call.tsx +3 -0
- package/src/v2/hooks/use-render-tool.tsx +3 -0
- package/src/v2/types/defineToolCallRenderer.ts +3 -0
- package/src/v2/types/react-tool-call-renderer.ts +3 -0
- package/dist/copilotkit-BebqQrYT.mjs.map +0 -1
- package/dist/copilotkit-Cvb6WpAX.cjs.map +0 -1
package/dist/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-
|
|
4
|
+
const require_copilotkit = require('./copilotkit-CSJw5BG8.cjs');
|
|
5
5
|
let react = require("react");
|
|
6
6
|
react = require_copilotkit.__toESM(react);
|
|
7
7
|
let _copilotkit_core = require("@copilotkit/core");
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { An as FrontendAction, Cn as TreeNode, Dn as ActionRenderPropsWait, En as ActionRenderPropsNoArgsWait, Mn as RenderFunctionStatus, N as useAgent, On as CatchAllActionRenderProps, Q as useRenderToolCall$1, Sn as Tree, Tn as ActionRenderPropsNoArgs, _n as CrewsTaskStateItem, an as CoAgentStateRender, bn as SystemMessageFunction, cn as LangGraphInterruptActionSetterArgs, dn as LangGraphInterruptRenderProps, en as CoagentInChatRenderFunction, fn as QueuedInterruptEvent, gn as CrewsStateItem, hn as CrewsResponseStatus, in as useCopilotContext, jn as FrontendActionAvailability, kn as CatchAllFrontendAction, ln as LangGraphInterruptRender, mn as CrewsResponse, n as defaultCopilotContextCategories, nn as CopilotContext, on as LangGraphInterruptAction, pn as CrewsAgentState, r as CopilotKitProps, rn as CopilotContextParams, sn as LangGraphInterruptActionSetter, t as CopilotKit, tn as CopilotApiConfig, un as LangGraphInterruptRenderHandlerProps, vn as CrewsToolStateItem, wn as ActionRenderProps, xn as DocumentPointer, yn as CopilotChatSuggestionConfiguration } from "./copilotkit-
|
|
1
|
+
import { An as FrontendAction, Cn as TreeNode, Dn as ActionRenderPropsWait, En as ActionRenderPropsNoArgsWait, Mn as RenderFunctionStatus, N as useAgent, On as CatchAllActionRenderProps, Q as useRenderToolCall$1, Sn as Tree, Tn as ActionRenderPropsNoArgs, _n as CrewsTaskStateItem, an as CoAgentStateRender, bn as SystemMessageFunction, cn as LangGraphInterruptActionSetterArgs, dn as LangGraphInterruptRenderProps, en as CoagentInChatRenderFunction, fn as QueuedInterruptEvent, gn as CrewsStateItem, hn as CrewsResponseStatus, in as useCopilotContext, jn as FrontendActionAvailability, kn as CatchAllFrontendAction, ln as LangGraphInterruptRender, mn as CrewsResponse, n as defaultCopilotContextCategories, nn as CopilotContext, on as LangGraphInterruptAction, pn as CrewsAgentState, r as CopilotKitProps, rn as CopilotContextParams, sn as LangGraphInterruptActionSetter, t as CopilotKit, tn as CopilotApiConfig, un as LangGraphInterruptRenderHandlerProps, vn as CrewsToolStateItem, wn as ActionRenderProps, xn as DocumentPointer, yn as CopilotChatSuggestionConfiguration } from "./copilotkit-BtP7w7cT.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 { An as FrontendAction, Cn as TreeNode, Dn as ActionRenderPropsWait, En as ActionRenderPropsNoArgsWait, Mn as RenderFunctionStatus, N as useAgent, On as CatchAllActionRenderProps, Q as useRenderToolCall$1, Sn as Tree, Tn as ActionRenderPropsNoArgs, _n as CrewsTaskStateItem, an as CoAgentStateRender, bn as SystemMessageFunction, cn as LangGraphInterruptActionSetterArgs, dn as LangGraphInterruptRenderProps, en as CoagentInChatRenderFunction, fn as QueuedInterruptEvent, gn as CrewsStateItem, hn as CrewsResponseStatus, in as useCopilotContext, jn as FrontendActionAvailability, kn as CatchAllFrontendAction, ln as LangGraphInterruptRender, mn as CrewsResponse, n as defaultCopilotContextCategories, nn as CopilotContext, on as LangGraphInterruptAction, pn as CrewsAgentState, r as CopilotKitProps, rn as CopilotContextParams, sn as LangGraphInterruptActionSetter, t as CopilotKit, tn as CopilotApiConfig, un as LangGraphInterruptRenderHandlerProps, vn as CrewsToolStateItem, wn as ActionRenderProps, xn as DocumentPointer, yn as CopilotChatSuggestionConfiguration } from "./copilotkit-
|
|
1
|
+
import { An as FrontendAction, Cn as TreeNode, Dn as ActionRenderPropsWait, En as ActionRenderPropsNoArgsWait, Mn as RenderFunctionStatus, N as useAgent, On as CatchAllActionRenderProps, Q as useRenderToolCall$1, Sn as Tree, Tn as ActionRenderPropsNoArgs, _n as CrewsTaskStateItem, an as CoAgentStateRender, bn as SystemMessageFunction, cn as LangGraphInterruptActionSetterArgs, dn as LangGraphInterruptRenderProps, en as CoagentInChatRenderFunction, fn as QueuedInterruptEvent, gn as CrewsStateItem, hn as CrewsResponseStatus, in as useCopilotContext, jn as FrontendActionAvailability, kn as CatchAllFrontendAction, ln as LangGraphInterruptRender, mn as CrewsResponse, n as defaultCopilotContextCategories, nn as CopilotContext, on as LangGraphInterruptAction, pn as CrewsAgentState, r as CopilotKitProps, rn as CopilotContextParams, sn as LangGraphInterruptActionSetter, t as CopilotKit, tn as CopilotApiConfig, un as LangGraphInterruptRenderHandlerProps, vn as CrewsToolStateItem, wn as ActionRenderProps, xn as DocumentPointer, yn as CopilotChatSuggestionConfiguration } from "./copilotkit-CCbxm6JM.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 { B as useConfigureSuggestions, Q as useRenderToolCall$1, U as useHumanInTheLoop$1, V as useSuggestions, Y as useRenderCustomMessages, Z as useAgent, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, et as useCopilotKit, f as useToast, g as useCopilotContext, h as CopilotContext, ht as useCopilotChatConfiguration, i as ThreadsContext, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, o as useThreads, p as CopilotMessagesContext, q as useFrontendTool$1, r as CoAgentStateRenderBridge, rt as defineToolCallRenderer, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback, z as useInterrupt } from "./copilotkit-
|
|
3
|
+
import { B as useConfigureSuggestions, Q as useRenderToolCall$1, U as useHumanInTheLoop$1, V as useSuggestions, Y as useRenderCustomMessages, Z as useAgent, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, et as useCopilotKit, f as useToast, g as useCopilotContext, h as CopilotContext, ht as useCopilotChatConfiguration, i as ThreadsContext, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, o as useThreads, p as CopilotMessagesContext, q as useFrontendTool$1, r as CoAgentStateRenderBridge, rt as defineToolCallRenderer, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback, z as useInterrupt } from "./copilotkit-Cj2ZIxVr.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";
|
package/dist/index.umd.js
CHANGED
|
@@ -2323,18 +2323,21 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2323
2323
|
const toolName = toolCall.function.name;
|
|
2324
2324
|
if (toolMessage) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderComponent, {
|
|
2325
2325
|
name: toolName,
|
|
2326
|
+
toolCallId: toolCall.id,
|
|
2326
2327
|
args,
|
|
2327
2328
|
status: _copilotkit_core.ToolCallStatus.Complete,
|
|
2328
2329
|
result: toolMessage.content
|
|
2329
2330
|
});
|
|
2330
2331
|
else if (isExecuting) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderComponent, {
|
|
2331
2332
|
name: toolName,
|
|
2333
|
+
toolCallId: toolCall.id,
|
|
2332
2334
|
args,
|
|
2333
2335
|
status: _copilotkit_core.ToolCallStatus.Executing,
|
|
2334
2336
|
result: void 0
|
|
2335
2337
|
});
|
|
2336
2338
|
else return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderComponent, {
|
|
2337
2339
|
name: toolName,
|
|
2340
|
+
toolCallId: toolCall.id,
|
|
2338
2341
|
args,
|
|
2339
2342
|
status: _copilotkit_core.ToolCallStatus.InProgress,
|
|
2340
2343
|
result: void 0
|
|
@@ -2599,7 +2602,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2599
2602
|
const runId = resolvedRunId !== null && resolvedRunId !== void 0 ? resolvedRunId : `missing-run-id:${message.id}`;
|
|
2600
2603
|
const registryAgent = copilotkit.getAgent(agentId);
|
|
2601
2604
|
const agent = (_getThreadClone = getThreadClone(registryAgent, threadId)) !== null && _getThreadClone !== void 0 ? _getThreadClone : registryAgent;
|
|
2602
|
-
if (!agent)
|
|
2605
|
+
if (!agent) return null;
|
|
2603
2606
|
const messagesIdsInRun = resolvedRunId ? agent.messages.filter((msg) => copilotkit.getRunIdForMessage(agentId, threadId, msg.id) === resolvedRunId).map((msg) => msg.id) : [message.id];
|
|
2604
2607
|
const rawMessageIndex = agent.messages.findIndex((msg) => msg.id === message.id);
|
|
2605
2608
|
const messageIndex = rawMessageIndex >= 0 ? rawMessageIndex : 0;
|
|
@@ -4703,13 +4706,18 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4703
4706
|
};
|
|
4704
4707
|
}, [agent, getSubscriber]);
|
|
4705
4708
|
};
|
|
4709
|
+
function CopilotListenersAgentSubscription() {
|
|
4710
|
+
const existingConfig = useCopilotChatConfiguration();
|
|
4711
|
+
const { agent } = useAgent({ agentId: existingConfig === null || existingConfig === void 0 ? void 0 : existingConfig.agentId });
|
|
4712
|
+
usePredictStateSubscription(agent);
|
|
4713
|
+
return null;
|
|
4714
|
+
}
|
|
4706
4715
|
function CopilotListeners() {
|
|
4716
|
+
var _copilotkit$agents;
|
|
4707
4717
|
const { copilotkit } = useCopilotKit();
|
|
4708
|
-
const existingConfig = useCopilotChatConfiguration();
|
|
4709
|
-
const resolvedAgentId = existingConfig === null || existingConfig === void 0 ? void 0 : existingConfig.agentId;
|
|
4710
4718
|
const { setBannerError } = useToast();
|
|
4711
|
-
const
|
|
4712
|
-
|
|
4719
|
+
const hasAgents = Object.keys((_copilotkit$agents = copilotkit.agents) !== null && _copilotkit$agents !== void 0 ? _copilotkit$agents : {}).length > 0;
|
|
4720
|
+
const hasRuntime = copilotkit.runtimeUrl !== void 0;
|
|
4713
4721
|
(0, react.useEffect)(() => {
|
|
4714
4722
|
const subscription = copilotkit.subscribe({ onError: ({ error, code, context }) => {
|
|
4715
4723
|
if (error.name === "AbortError" || error.message === "Fetch is aborted" || error.message === "signal is aborted without reason" || error.message === "component unmounted" || !error.message) return;
|
|
@@ -4731,7 +4739,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4731
4739
|
subscription.unsubscribe();
|
|
4732
4740
|
};
|
|
4733
4741
|
}, [copilotkit === null || copilotkit === void 0 ? void 0 : copilotkit.subscribe]);
|
|
4734
|
-
return null;
|
|
4742
|
+
return hasAgents || hasRuntime ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotListenersAgentSubscription, {}) : null;
|
|
4735
4743
|
}
|
|
4736
4744
|
|
|
4737
4745
|
//#endregion
|