@copilotkit/react-core 1.63.2 → 1.63.3-canary.rc-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.
- package/dist/copilotkit-BE1n5tSI.d.mts.map +1 -1
- package/dist/copilotkit-CXvuYw_F.d.cts.map +1 -1
- package/dist/{copilotkit-CN2JVeH3.mjs → copilotkit-DL0LvmwQ.mjs} +69 -65
- package/dist/copilotkit-DL0LvmwQ.mjs.map +1 -0
- package/dist/{copilotkit-DDVfoiRM.cjs → copilotkit-rYTwMndy.cjs} +71 -67
- package/dist/copilotkit-rYTwMndy.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +5 -48
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +79 -45
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +30 -2
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +19 -3
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +83 -57
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +70 -66
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +7 -7
- package/dist/copilotkit-CN2JVeH3.mjs.map +0 -1
- package/dist/copilotkit-DDVfoiRM.cjs.map +0 -1
package/dist/v2/headless.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React$1, { ComponentType, ReactNode } from "react";
|
|
2
2
|
import { InferSchemaOutput, StandardSchemaV1 } from "@copilotkit/shared";
|
|
3
3
|
import { CopilotKitCore, CopilotKitCoreConfig, CopilotKitCoreSubscriber, CopilotKitCoreSubscription, DynamicSuggestionsConfig, FrontendTool, StaticSuggestionsConfig, Suggestion, ToolCallStatus } from "@copilotkit/core";
|
|
4
|
-
import { ActivityMessage, AgentCapabilities, Message } from "@ag-ui/core";
|
|
4
|
+
import { ActivityMessage, AgentCapabilities, Message, ToolCall, ToolMessage } from "@ag-ui/core";
|
|
5
5
|
import { AbstractAgent, Interrupt, ResumeEntry, ResumeStatus, RunAgentResult } from "@ag-ui/client";
|
|
6
6
|
|
|
7
7
|
//#region src/v2/types/react-tool-call-renderer.d.ts
|
|
@@ -269,6 +269,18 @@ declare class CopilotKitCoreReact extends CopilotKitCore {
|
|
|
269
269
|
waitForPendingFrameworkUpdates(): Promise<void>;
|
|
270
270
|
}
|
|
271
271
|
//#endregion
|
|
272
|
+
//#region src/v2/context.d.ts
|
|
273
|
+
interface CopilotKitContextValue {
|
|
274
|
+
copilotkit: CopilotKitCoreReact;
|
|
275
|
+
/**
|
|
276
|
+
* Set of tool call IDs currently being executed.
|
|
277
|
+
* This is tracked at the provider level to ensure tool execution events
|
|
278
|
+
* are captured even before child components mount.
|
|
279
|
+
*/
|
|
280
|
+
executingToolCallIds: ReadonlySet<string>;
|
|
281
|
+
}
|
|
282
|
+
declare const useCopilotKit: () => CopilotKitContextValue;
|
|
283
|
+
//#endregion
|
|
272
284
|
//#region src/v2/providers/CopilotChatConfigurationProvider.d.ts
|
|
273
285
|
declare const CopilotChatDefaultLabels: {
|
|
274
286
|
chatInputPlaceholder: string;
|
|
@@ -894,6 +906,22 @@ declare function useRenderTool<S extends StandardSchemaV1>(config: {
|
|
|
894
906
|
agentId?: string;
|
|
895
907
|
}, deps?: ReadonlyArray<unknown>): void;
|
|
896
908
|
//#endregion
|
|
909
|
+
//#region src/v2/hooks/use-render-tool-call.d.ts
|
|
910
|
+
interface UseRenderToolCallProps {
|
|
911
|
+
toolCall: ToolCall;
|
|
912
|
+
toolMessage?: ToolMessage;
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Hook that returns a function to render tool calls based on the render functions
|
|
916
|
+
* defined in CopilotKitProvider.
|
|
917
|
+
*
|
|
918
|
+
* @returns A function that takes a tool call and optional tool message and returns the rendered component
|
|
919
|
+
*/
|
|
920
|
+
declare function useRenderToolCall(): ({
|
|
921
|
+
toolCall,
|
|
922
|
+
toolMessage
|
|
923
|
+
}: UseRenderToolCallProps) => React$1.ReactElement | null;
|
|
924
|
+
//#endregion
|
|
897
925
|
//#region src/v2/hooks/use-capabilities.d.ts
|
|
898
926
|
/**
|
|
899
927
|
* Returns the capabilities declared by the given agent (or the agent resolved
|
|
@@ -910,5 +938,5 @@ declare function useRenderTool<S extends StandardSchemaV1>(config: {
|
|
|
910
938
|
*/
|
|
911
939
|
declare function useCapabilities(agentId?: string): AgentCapabilities | undefined;
|
|
912
940
|
//#endregion
|
|
913
|
-
export { type AgentContextInput, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatDefaultLabels, type CopilotChatLabels, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type Interrupt, type InterruptEvent, type InterruptHandlerProps, type InterruptRenderProps, type JsonSerializable, type ReactFrontendTool, type ReactHumanInTheLoop, type RenderToolCompleteProps, type RenderToolExecutingProps, type RenderToolInProgressProps, type RenderToolProps, type ResumeEntry, type ResumeStatus, type Thread,
|
|
941
|
+
export { type AgentContextInput, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatDefaultLabels, type CopilotChatLabels, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type Interrupt, type InterruptEvent, type InterruptHandlerProps, type InterruptRenderProps, type JsonSerializable, type ReactFrontendTool, type ReactHumanInTheLoop, type RenderToolCompleteProps, type RenderToolExecutingProps, type RenderToolInProgressProps, type RenderToolProps, type ResumeEntry, type ResumeStatus, type Thread, UseAgentUpdate, type UseInterruptConfig, type UseThreadsInput, type UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useRenderToolCall, useSuggestions, useThreads };
|
|
914
942
|
//# sourceMappingURL=headless.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headless.d.cts","names":[],"sources":["../../src/v2/types/react-tool-call-renderer.ts","../../src/v2/types/react-activity-message-renderer.ts","../../src/v2/types/react-custom-message-renderer.ts","../../src/v2/types/frontend-tool.ts","../../src/v2/types/human-in-the-loop.ts","../../src/v2/types/defineToolCallRenderer.ts","../../src/v2/types/interrupt.ts","../../src/v2/lib/react-core.ts","../../src/v2/providers/CopilotChatConfigurationProvider.tsx","../../src/v2/hooks/use-agent.tsx","../../src/v2/hooks/use-frontend-tool.tsx","../../src/v2/hooks/use-component.tsx","../../src/v2/hooks/use-human-in-the-loop.tsx","../../src/v2/hooks/use-interrupt.tsx","../../src/v2/hooks/use-suggestions.tsx","../../src/v2/hooks/use-configure-suggestions.tsx","../../src/v2/hooks/use-agent-context.tsx","../../src/v2/hooks/use-threads.tsx","../../src/v2/hooks/use-render-tool.tsx","../../src/v2/hooks/use-capabilities.tsx"],"mappings":";;;;;;;UAGiB,qBAAA;EACf,IAAA;;;;AADF;EAME,IAAA,GAAO,gBAAA,MAAsB,CAAA;EANO;;;;EAWpC,OAAA;EACA,MAAA,EAAQ,KAAA,CAAM,aAAA;IAER,IAAA;IACA,UAAA;IACA,IAAA,EAAM,OAAA,CAAQ,CAAA;IACd,MAAA,EAAQ,cAAA,CAAe,UAAA;IACvB,MAAA;EAAA;IAGA,IAAA;IACA,UAAA;IACA,IAAA,EAAM,CAAA;IACN,MAAA,EAAQ,cAAA,CAAe,SAAA;IACvB,MAAA;EAAA;IAGA,IAAA;IACA,UAAA;IACA,IAAA,EAAM,CAAA;IACN,MAAA,EAAQ,cAAA,CAAe,QAAA;IACvB,MAAA;EAAA;AAAA;;;UC/BS,4BAAA;;;;EAIf,YAAA;EDLoC;;;ECSpC,OAAA;EDOoB;;;ECHpB,OAAA,EAAS,gBAAA,MAAsB,gBAAA;EDWjB;;;ECPd,MAAA,EAAQ,KAAA,CAAM,aA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AC1B,UAAA,EAAY,cAAA;IACZ,eAAA,EAAiB,qBAAA;EAAA,aACN,OAAA;EACb,yBAAA,IAA6B,KAAA;IAC3B,UAAA,EAAY,cAAA;IACZ,gBAAA,EAAkB,OAAA,CAAM,YAAA;EAAA,aACb,OAAA;AAAA;AAAA,cAGF,mBAAA,SAA4B,cAAA;EAAA,QAC/B,gBAAA;EAAA,QACA,oBAAA;EAAA,QAEA,4BAAA;EAAA,QAEA,qBAAA;EAAA,QACA,uBAAA;EAAA,QACA,iBAAA;cAEI,MAAA,EAAQ,yBAAA;EAAA,IAOhB,oBAAA,CAAA,GAAwB,QAAA,CAAS,0BAAA;EAAA,IAIjC,sBAAA,CAAA,GAA0B,QAAA,CAAS,4BAAA;EAAA,IAInC,eAAA,CAAA,GAAmB,QAAA,CAAS,qBAAA;EAmBhC,yBAAA,CACE,SAAA,EAAW,4BAAA;EAKb,uBAAA,CAAwB,SAAA,EAAW,0BAAA;EAInC,kBAAA,CAAmB,eAAA,EAAiB,qBAAA;EAMpC,qBAAA,CAAsB,KAAA,EAAO,qBAAA;EAO7B,wBAAA,CAAyB,IAAA,UAAc,OAAA;EAAA,QAQ/B,6BAAA;EAAA,IAYJ,gBAAA,CAAA,GAAoB,OAAA,CAAM,YAAA;EAI9B,mBAAA,CAAoB,OAAA,EAAS,OAAA,CAAM,YAAA;EAYnC,SAAA,CACE,UAAA,EAAY,6BAAA,GACX,0BAAA;EPlHG;;;;;;;;;;;;;EOmIA,8BAAA,CAAA,GAAkC,OAAA;AAAA;;;
|
|
1
|
+
{"version":3,"file":"headless.d.cts","names":[],"sources":["../../src/v2/types/react-tool-call-renderer.ts","../../src/v2/types/react-activity-message-renderer.ts","../../src/v2/types/react-custom-message-renderer.ts","../../src/v2/types/frontend-tool.ts","../../src/v2/types/human-in-the-loop.ts","../../src/v2/types/defineToolCallRenderer.ts","../../src/v2/types/interrupt.ts","../../src/v2/lib/react-core.ts","../../src/v2/context.ts","../../src/v2/providers/CopilotChatConfigurationProvider.tsx","../../src/v2/hooks/use-agent.tsx","../../src/v2/hooks/use-frontend-tool.tsx","../../src/v2/hooks/use-component.tsx","../../src/v2/hooks/use-human-in-the-loop.tsx","../../src/v2/hooks/use-interrupt.tsx","../../src/v2/hooks/use-suggestions.tsx","../../src/v2/hooks/use-configure-suggestions.tsx","../../src/v2/hooks/use-agent-context.tsx","../../src/v2/hooks/use-threads.tsx","../../src/v2/hooks/use-render-tool.tsx","../../src/v2/hooks/use-render-tool-call.tsx","../../src/v2/hooks/use-capabilities.tsx"],"mappings":";;;;;;;UAGiB,qBAAA;EACf,IAAA;;;;AADF;EAME,IAAA,GAAO,gBAAA,MAAsB,CAAA;EANO;;;;EAWpC,OAAA;EACA,MAAA,EAAQ,KAAA,CAAM,aAAA;IAER,IAAA;IACA,UAAA;IACA,IAAA,EAAM,OAAA,CAAQ,CAAA;IACd,MAAA,EAAQ,cAAA,CAAe,UAAA;IACvB,MAAA;EAAA;IAGA,IAAA;IACA,UAAA;IACA,IAAA,EAAM,CAAA;IACN,MAAA,EAAQ,cAAA,CAAe,SAAA;IACvB,MAAA;EAAA;IAGA,IAAA;IACA,UAAA;IACA,IAAA,EAAM,CAAA;IACN,MAAA,EAAQ,cAAA,CAAe,QAAA;IACvB,MAAA;EAAA;AAAA;;;UC/BS,4BAAA;;;;EAIf,YAAA;EDLoC;;;ECSpC,OAAA;EDOoB;;;ECHpB,OAAA,EAAS,gBAAA,MAAsB,gBAAA;EDWjB;;;ECPd,MAAA,EAAQ,KAAA,CAAM,aAAA;IACZ,YAAA;IACA,OAAA,EAAS,gBAAA;IACT,OAAA,EAAS,eAAA;IACT,KAAA,EAAO,aAAA;EAAA;AAAA;;;KCtBC,kCAAA;AAAA,UAEK,0BAAA;EACf,OAAA;EACA,MAAA,EAAQ,KAAA,CAAM,aAAA;IACZ,OAAA,EAAS,OAAA;IACT,QAAA,EAAU,kCAAA;IACV,KAAA;IACA,YAAA;IACA,iBAAA;IACA,qBAAA;IACA,OAAA;IACA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 +2,8 @@ import React$1, { ComponentType, ReactNode } from "react";
|
|
|
2
2
|
import { InferSchemaOutput, StandardSchemaV1 } from "@copilotkit/shared";
|
|
3
3
|
import { AbstractAgent, Interrupt, ResumeEntry, ResumeStatus, RunAgentResult } from "@ag-ui/client";
|
|
4
4
|
import { DynamicSuggestionsConfig, FrontendTool, StaticSuggestionsConfig, Suggestion, ToolCallStatus } from "@copilotkit/core";
|
|
5
|
-
import { CopilotKitCoreReact, CopilotKitCoreReactConfig } from "@copilotkit/react-core/v2/context";
|
|
6
|
-
import { AgentCapabilities } from "@ag-ui/core";
|
|
5
|
+
import { CopilotKitCoreReact, CopilotKitCoreReactConfig, useCopilotKit } from "@copilotkit/react-core/v2/context";
|
|
6
|
+
import { AgentCapabilities, ToolCall, ToolMessage } from "@ag-ui/core";
|
|
7
7
|
|
|
8
8
|
//#region src/v2/providers/CopilotChatConfigurationProvider.d.ts
|
|
9
9
|
declare const CopilotChatDefaultLabels: {
|
|
@@ -763,6 +763,22 @@ declare function useRenderTool<S extends StandardSchemaV1>(config: {
|
|
|
763
763
|
agentId?: string;
|
|
764
764
|
}, deps?: ReadonlyArray<unknown>): void;
|
|
765
765
|
//#endregion
|
|
766
|
+
//#region src/v2/hooks/use-render-tool-call.d.ts
|
|
767
|
+
interface UseRenderToolCallProps {
|
|
768
|
+
toolCall: ToolCall;
|
|
769
|
+
toolMessage?: ToolMessage;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Hook that returns a function to render tool calls based on the render functions
|
|
773
|
+
* defined in CopilotKitProvider.
|
|
774
|
+
*
|
|
775
|
+
* @returns A function that takes a tool call and optional tool message and returns the rendered component
|
|
776
|
+
*/
|
|
777
|
+
declare function useRenderToolCall(): ({
|
|
778
|
+
toolCall,
|
|
779
|
+
toolMessage
|
|
780
|
+
}: UseRenderToolCallProps) => React$1.ReactElement | null;
|
|
781
|
+
//#endregion
|
|
766
782
|
//#region src/v2/types/defineToolCallRenderer.d.ts
|
|
767
783
|
/**
|
|
768
784
|
* Helper to define a type-safe tool call renderer entry.
|
|
@@ -818,5 +834,5 @@ declare function defineToolCallRenderer<S extends StandardSchemaV1>(def: {
|
|
|
818
834
|
*/
|
|
819
835
|
declare function useCapabilities(agentId?: string): AgentCapabilities | undefined;
|
|
820
836
|
//#endregion
|
|
821
|
-
export { type AgentContextInput, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatDefaultLabels, type CopilotChatLabels, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type Interrupt, type InterruptEvent, type InterruptHandlerProps, type InterruptRenderProps, type JsonSerializable, type ReactFrontendTool, type ReactHumanInTheLoop, type RenderToolCompleteProps, type RenderToolExecutingProps, type RenderToolInProgressProps, type RenderToolProps, type ResumeEntry, type ResumeStatus, type Thread,
|
|
837
|
+
export { type AgentContextInput, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatDefaultLabels, type CopilotChatLabels, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type Interrupt, type InterruptEvent, type InterruptHandlerProps, type InterruptRenderProps, type JsonSerializable, type ReactFrontendTool, type ReactHumanInTheLoop, type RenderToolCompleteProps, type RenderToolExecutingProps, type RenderToolInProgressProps, type RenderToolProps, type ResumeEntry, type ResumeStatus, type Thread, UseAgentUpdate, type UseInterruptConfig, type UseThreadsInput, type UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useRenderToolCall, useSuggestions, useThreads };
|
|
822
838
|
//# sourceMappingURL=headless.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headless.d.mts","names":[],"sources":["../../src/v2/providers/CopilotChatConfigurationProvider.tsx","../../src/v2/hooks/use-agent.tsx","../../src/v2/types/react-tool-call-renderer.ts","../../src/v2/types/frontend-tool.ts","../../src/v2/hooks/use-frontend-tool.tsx","../../src/v2/hooks/use-component.tsx","../../src/v2/types/human-in-the-loop.ts","../../src/v2/hooks/use-human-in-the-loop.tsx","../../src/v2/types/interrupt.ts","../../src/v2/hooks/use-interrupt.tsx","../../src/v2/hooks/use-suggestions.tsx","../../src/v2/hooks/use-configure-suggestions.tsx","../../src/v2/hooks/use-agent-context.tsx","../../src/v2/hooks/use-threads.tsx","../../src/v2/hooks/use-render-tool.tsx","../../src/v2/types/defineToolCallRenderer.ts","../../src/v2/hooks/use-capabilities.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"headless.d.mts","names":[],"sources":["../../src/v2/providers/CopilotChatConfigurationProvider.tsx","../../src/v2/hooks/use-agent.tsx","../../src/v2/types/react-tool-call-renderer.ts","../../src/v2/types/frontend-tool.ts","../../src/v2/hooks/use-frontend-tool.tsx","../../src/v2/hooks/use-component.tsx","../../src/v2/types/human-in-the-loop.ts","../../src/v2/hooks/use-human-in-the-loop.tsx","../../src/v2/types/interrupt.ts","../../src/v2/hooks/use-interrupt.tsx","../../src/v2/hooks/use-suggestions.tsx","../../src/v2/hooks/use-configure-suggestions.tsx","../../src/v2/hooks/use-agent-context.tsx","../../src/v2/hooks/use-threads.tsx","../../src/v2/hooks/use-render-tool.tsx","../../src/v2/hooks/use-render-tool-call.tsx","../../src/v2/types/defineToolCallRenderer.ts","../../src/v2/hooks/use-capabilities.tsx"],"mappings":";;;;;;;;cAgBa,wBAAA;;;;;;;;;;;;;;;;;;;;;;KAwBD,iBAAA,UAA2B,wBAAA;AAAA,UA6BtB,6BAAA;EACf,MAAA,EAAQ,iBAAA;EACR,OAAA;EACA,QAAA;EACA,WAAA;EACA,YAAA,GAAe,IAAA;;;;AAlCjB;;EAwCE,UAAA;EAxCqC;;AA6BvC;;;EAiBE,aAAA,GAAgB,IAAA;EAhBhB;;;;;EAsBA,gBAAA;EAlBe;;;;;;;EA0Bf,cAAA;EAWuB;;;;;;;;;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|
|
|
1
|
-
import { CopilotKitCoreReact, useCopilotKit } from "@copilotkit/react-core/v2/context";
|
|
1
|
+
import { CopilotKitCoreReact, useCopilotKit, useCopilotKit as useCopilotKit$1 } from "@copilotkit/react-core/v2/context";
|
|
2
2
|
import React, { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
3
|
-
import { DEFAULT_AGENT_ID, randomUUID } from "@copilotkit/shared";
|
|
4
|
-
import { twMerge } from "tailwind-merge";
|
|
3
|
+
import { DEFAULT_AGENT_ID, partialJSONParse, randomUUID } from "@copilotkit/shared";
|
|
5
4
|
import { jsx } from "react/jsx-runtime";
|
|
6
5
|
import { HttpAgent, randomUUID as randomUUID$1 } from "@ag-ui/client";
|
|
7
6
|
import { CopilotKitCoreRuntimeConnectionStatus, ProxiedCopilotRuntimeAgent, ToolCallStatus, ɵInterruptState, ɵcreateThreadStore, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading } from "@copilotkit/core";
|
|
8
7
|
import { z } from "zod";
|
|
9
8
|
|
|
10
|
-
//#region src/v2/lib/
|
|
9
|
+
//#region src/v2/lib/shallow-stable-ref.ts
|
|
11
10
|
/**
|
|
12
11
|
* Shallow equality comparison for objects.
|
|
13
12
|
*/
|
|
@@ -47,49 +46,6 @@ function useShallowStableRef(value) {
|
|
|
47
46
|
ref.current = value;
|
|
48
47
|
return ref.current;
|
|
49
48
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Check if a value is a React component type (function, class, forwardRef, memo, etc.)
|
|
52
|
-
*/
|
|
53
|
-
function isReactComponentType(value) {
|
|
54
|
-
if (typeof value === "function") return true;
|
|
55
|
-
if (value && typeof value === "object" && "$$typeof" in value && !React.isValidElement(value)) return true;
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Internal function to render a slot value as a React element (non-memoized).
|
|
60
|
-
*/
|
|
61
|
-
function renderSlotElement(slot, DefaultComponent, props) {
|
|
62
|
-
if (typeof slot === "string") {
|
|
63
|
-
const existingClassName = props.className;
|
|
64
|
-
return React.createElement(DefaultComponent, {
|
|
65
|
-
...props,
|
|
66
|
-
className: twMerge(existingClassName, slot)
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
if (isReactComponentType(slot)) return React.createElement(slot, props);
|
|
70
|
-
if (slot && typeof slot === "object" && !React.isValidElement(slot)) return React.createElement(DefaultComponent, {
|
|
71
|
-
...props,
|
|
72
|
-
...slot
|
|
73
|
-
});
|
|
74
|
-
return React.createElement(DefaultComponent, props);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Internal memoized wrapper component for renderSlot.
|
|
78
|
-
* Uses forwardRef to support ref forwarding.
|
|
79
|
-
*/
|
|
80
|
-
const MemoizedSlotWrapper = React.memo(React.forwardRef(function MemoizedSlotWrapper(props, ref) {
|
|
81
|
-
const { $slot, $component, ...rest } = props;
|
|
82
|
-
return renderSlotElement($slot, $component, ref !== null ? {
|
|
83
|
-
...rest,
|
|
84
|
-
ref
|
|
85
|
-
} : rest);
|
|
86
|
-
}), (prev, next) => {
|
|
87
|
-
if (prev.$slot !== next.$slot) return false;
|
|
88
|
-
if (prev.$component !== next.$component) return false;
|
|
89
|
-
const { $slot: _ps, $component: _pc, ...prevRest } = prev;
|
|
90
|
-
const { $slot: _ns, $component: _nc, ...nextRest } = next;
|
|
91
|
-
return shallowEqual(prevRest, nextRest);
|
|
92
|
-
});
|
|
93
49
|
|
|
94
50
|
//#endregion
|
|
95
51
|
//#region src/v2/providers/CopilotChatConfigurationProvider.tsx
|
|
@@ -311,7 +267,7 @@ const ALL_UPDATES = [
|
|
|
311
267
|
function useAgent({ agentId, updates, throttleMs } = {}) {
|
|
312
268
|
const chatConfig = useCopilotChatConfiguration();
|
|
313
269
|
const resolvedAgentId = agentId ?? chatConfig?.agentId ?? DEFAULT_AGENT_ID;
|
|
314
|
-
const { copilotkit } = useCopilotKit();
|
|
270
|
+
const { copilotkit } = useCopilotKit$1();
|
|
315
271
|
const providerThrottleMs = copilotkit.defaultThrottleMs;
|
|
316
272
|
const [, forceUpdate] = useReducer((x) => x + 1, 0);
|
|
317
273
|
const updateFlags = useMemo(() => updates ?? ALL_UPDATES, [JSON.stringify(updates)]);
|
|
@@ -440,7 +396,7 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
|
|
|
440
396
|
//#region src/v2/hooks/use-frontend-tool.tsx
|
|
441
397
|
const EMPTY_DEPS$1 = [];
|
|
442
398
|
function useFrontendTool(tool, deps) {
|
|
443
|
-
const { copilotkit } = useCopilotKit();
|
|
399
|
+
const { copilotkit } = useCopilotKit$1();
|
|
444
400
|
const extraDeps = deps ?? EMPTY_DEPS$1;
|
|
445
401
|
useEffect(() => {
|
|
446
402
|
const name = tool.name;
|
|
@@ -540,7 +496,7 @@ function useComponent(config, deps) {
|
|
|
540
496
|
//#endregion
|
|
541
497
|
//#region src/v2/hooks/use-human-in-the-loop.tsx
|
|
542
498
|
function useHumanInTheLoop(tool, deps) {
|
|
543
|
-
const { copilotkit } = useCopilotKit();
|
|
499
|
+
const { copilotkit } = useCopilotKit$1();
|
|
544
500
|
const resolvePromiseRef = useRef(null);
|
|
545
501
|
const cleanupAbortRef = useRef(null);
|
|
546
502
|
const respond = useCallback(async (result) => {
|
|
@@ -668,7 +624,7 @@ function toLegacyEvent(pending) {
|
|
|
668
624
|
* ```
|
|
669
625
|
*/
|
|
670
626
|
function useInterrupt(config) {
|
|
671
|
-
const { copilotkit } = useCopilotKit();
|
|
627
|
+
const { copilotkit } = useCopilotKit$1();
|
|
672
628
|
const { agent } = useAgent({ agentId: config.agentId });
|
|
673
629
|
const [pending, setPending] = useState(null);
|
|
674
630
|
const pendingRef = useRef(pending);
|
|
@@ -898,7 +854,7 @@ function useInterrupt(config) {
|
|
|
898
854
|
//#endregion
|
|
899
855
|
//#region src/v2/hooks/use-suggestions.tsx
|
|
900
856
|
function useSuggestions({ agentId } = {}) {
|
|
901
|
-
const { copilotkit } = useCopilotKit();
|
|
857
|
+
const { copilotkit } = useCopilotKit$1();
|
|
902
858
|
const config = useCopilotChatConfiguration();
|
|
903
859
|
const resolvedAgentId = useMemo(() => agentId ?? config?.agentId ?? DEFAULT_AGENT_ID, [agentId, config?.agentId]);
|
|
904
860
|
const [suggestions, setSuggestions] = useState(() => {
|
|
@@ -951,7 +907,7 @@ function useSuggestions({ agentId } = {}) {
|
|
|
951
907
|
//#endregion
|
|
952
908
|
//#region src/v2/hooks/use-configure-suggestions.tsx
|
|
953
909
|
function useConfigureSuggestions(config, deps) {
|
|
954
|
-
const { copilotkit } = useCopilotKit();
|
|
910
|
+
const { copilotkit } = useCopilotKit$1();
|
|
955
911
|
const chatConfig = useCopilotChatConfiguration();
|
|
956
912
|
const extraDeps = deps ?? [];
|
|
957
913
|
const resolvedConsumerAgentId = useMemo(() => chatConfig?.agentId ?? DEFAULT_AGENT_ID, [chatConfig?.agentId]);
|
|
@@ -1111,7 +1067,7 @@ function normalizeStaticSuggestions(suggestions) {
|
|
|
1111
1067
|
//#region src/v2/hooks/use-agent-context.tsx
|
|
1112
1068
|
function useAgentContext(context) {
|
|
1113
1069
|
const { description, value } = context;
|
|
1114
|
-
const { copilotkit } = useCopilotKit();
|
|
1070
|
+
const { copilotkit } = useCopilotKit$1();
|
|
1115
1071
|
const stringValue = useMemo(() => {
|
|
1116
1072
|
if (typeof value === "string") return value;
|
|
1117
1073
|
return JSON.stringify(value);
|
|
@@ -1182,7 +1138,7 @@ function useThreadStoreSelector(store, selector) {
|
|
|
1182
1138
|
* ```
|
|
1183
1139
|
*/
|
|
1184
1140
|
function useThreads({ agentId, includeArchived, limit, enabled = true }) {
|
|
1185
|
-
const { copilotkit } = useCopilotKit();
|
|
1141
|
+
const { copilotkit } = useCopilotKit$1();
|
|
1186
1142
|
const [store] = useState(() => ɵcreateThreadStore({ fetch: globalThis.fetch }));
|
|
1187
1143
|
const coreThreads = useThreadStoreSelector(store, ɵselectThreads);
|
|
1188
1144
|
const threads = useMemo(() => coreThreads.map(({ id, agentId, name, archived, createdAt, updatedAt, lastRunAt }) => ({
|
|
@@ -1376,7 +1332,7 @@ const EMPTY_DEPS = [];
|
|
|
1376
1332
|
* ```
|
|
1377
1333
|
*/
|
|
1378
1334
|
function useRenderTool(config, deps) {
|
|
1379
|
-
const { copilotkit } = useCopilotKit();
|
|
1335
|
+
const { copilotkit } = useCopilotKit$1();
|
|
1380
1336
|
const extraDeps = deps ?? EMPTY_DEPS;
|
|
1381
1337
|
useEffect(() => {
|
|
1382
1338
|
const renderer = config.name === "*" && !config.parameters ? defineToolCallRenderer({
|
|
@@ -1413,6 +1369,76 @@ function useRenderTool(config, deps) {
|
|
|
1413
1369
|
]);
|
|
1414
1370
|
}
|
|
1415
1371
|
|
|
1372
|
+
//#endregion
|
|
1373
|
+
//#region src/v2/hooks/use-render-tool-call.tsx
|
|
1374
|
+
/**
|
|
1375
|
+
* Memoized component that renders a single tool call.
|
|
1376
|
+
* This prevents unnecessary re-renders when parent components update
|
|
1377
|
+
* but the tool call data hasn't changed.
|
|
1378
|
+
*/
|
|
1379
|
+
const ToolCallRenderer = React.memo(function ToolCallRenderer({ toolCall, toolMessage, RenderComponent, isExecuting }) {
|
|
1380
|
+
const args = useMemo(() => partialJSONParse(toolCall.function.arguments), [toolCall.function.arguments]);
|
|
1381
|
+
const toolName = toolCall.function.name;
|
|
1382
|
+
if (toolMessage) return /* @__PURE__ */ jsx(RenderComponent, {
|
|
1383
|
+
name: toolName,
|
|
1384
|
+
toolCallId: toolCall.id,
|
|
1385
|
+
args,
|
|
1386
|
+
status: ToolCallStatus.Complete,
|
|
1387
|
+
result: toolMessage.content
|
|
1388
|
+
});
|
|
1389
|
+
else if (isExecuting) return /* @__PURE__ */ jsx(RenderComponent, {
|
|
1390
|
+
name: toolName,
|
|
1391
|
+
toolCallId: toolCall.id,
|
|
1392
|
+
args,
|
|
1393
|
+
status: ToolCallStatus.Executing,
|
|
1394
|
+
result: void 0
|
|
1395
|
+
});
|
|
1396
|
+
else return /* @__PURE__ */ jsx(RenderComponent, {
|
|
1397
|
+
name: toolName,
|
|
1398
|
+
toolCallId: toolCall.id,
|
|
1399
|
+
args,
|
|
1400
|
+
status: ToolCallStatus.InProgress,
|
|
1401
|
+
result: void 0
|
|
1402
|
+
});
|
|
1403
|
+
}, (prevProps, nextProps) => {
|
|
1404
|
+
if (prevProps.toolCall.id !== nextProps.toolCall.id) return false;
|
|
1405
|
+
if (prevProps.toolCall.function.name !== nextProps.toolCall.function.name) return false;
|
|
1406
|
+
if (prevProps.toolCall.function.arguments !== nextProps.toolCall.function.arguments) return false;
|
|
1407
|
+
if (prevProps.toolMessage?.content !== nextProps.toolMessage?.content) return false;
|
|
1408
|
+
if (prevProps.isExecuting !== nextProps.isExecuting) return false;
|
|
1409
|
+
if (prevProps.RenderComponent !== nextProps.RenderComponent) return false;
|
|
1410
|
+
return true;
|
|
1411
|
+
});
|
|
1412
|
+
/**
|
|
1413
|
+
* Hook that returns a function to render tool calls based on the render functions
|
|
1414
|
+
* defined in CopilotKitProvider.
|
|
1415
|
+
*
|
|
1416
|
+
* @returns A function that takes a tool call and optional tool message and returns the rendered component
|
|
1417
|
+
*/
|
|
1418
|
+
function useRenderToolCall() {
|
|
1419
|
+
const { copilotkit, executingToolCallIds } = useCopilotKit$1();
|
|
1420
|
+
const agentId = useCopilotChatConfiguration()?.agentId ?? DEFAULT_AGENT_ID;
|
|
1421
|
+
const renderToolCalls = useSyncExternalStore((callback) => {
|
|
1422
|
+
return copilotkit.subscribe({ onRenderToolCallsChanged: callback }).unsubscribe;
|
|
1423
|
+
}, () => copilotkit.renderToolCalls, () => copilotkit.renderToolCalls);
|
|
1424
|
+
return useCallback(({ toolCall, toolMessage }) => {
|
|
1425
|
+
const exactMatches = renderToolCalls.filter((rc) => rc.name === toolCall.function.name);
|
|
1426
|
+
const renderConfig = exactMatches.find((rc) => rc.agentId === agentId) || exactMatches.find((rc) => !rc.agentId) || exactMatches[0] || renderToolCalls.find((rc) => rc.name === "*");
|
|
1427
|
+
if (!renderConfig) return null;
|
|
1428
|
+
const RenderComponent = renderConfig.render;
|
|
1429
|
+
return /* @__PURE__ */ jsx(ToolCallRenderer, {
|
|
1430
|
+
toolCall,
|
|
1431
|
+
toolMessage,
|
|
1432
|
+
RenderComponent,
|
|
1433
|
+
isExecuting: executingToolCallIds.has(toolCall.id)
|
|
1434
|
+
}, toolCall.id);
|
|
1435
|
+
}, [
|
|
1436
|
+
renderToolCalls,
|
|
1437
|
+
executingToolCallIds,
|
|
1438
|
+
agentId
|
|
1439
|
+
]);
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1416
1442
|
//#endregion
|
|
1417
1443
|
//#region src/v2/hooks/use-capabilities.tsx
|
|
1418
1444
|
/**
|
|
@@ -1434,5 +1460,5 @@ function useCapabilities(agentId) {
|
|
|
1434
1460
|
}
|
|
1435
1461
|
|
|
1436
1462
|
//#endregion
|
|
1437
|
-
export { CopilotChatConfigurationProvider, CopilotChatDefaultLabels, CopilotKitCoreReact, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useSuggestions, useThreads };
|
|
1463
|
+
export { CopilotChatConfigurationProvider, CopilotChatDefaultLabels, CopilotKitCoreReact, UseAgentUpdate, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useRenderToolCall, useSuggestions, useThreads };
|
|
1438
1464
|
//# sourceMappingURL=headless.mjs.map
|