@copilotkit/react-core 2.0.0-rc.63 → 2.0.0-rc.65
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/headless.cjs +57 -4
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +11 -7
- package/dist/headless.d.cts.map +1 -1
- package/dist/headless.d.mts +11 -7
- package/dist/headless.d.mts.map +1 -1
- package/dist/headless.mjs +59 -6
- package/dist/headless.mjs.map +1 -1
- package/dist/index.cjs +250 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +173 -10
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +173 -10
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +216 -9
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +250 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/index.d.cts +158 -0
- package/dist/v2/index.d.mts +158 -0
- package/package.json +7 -7
package/dist/headless.d.cts
CHANGED
|
@@ -718,6 +718,11 @@ interface UseThreadsResult {
|
|
|
718
718
|
* `deleteThread`) return promises that resolve once the platform confirms the
|
|
719
719
|
* operation and reject with an `Error` on failure.
|
|
720
720
|
*
|
|
721
|
+
* In 1.x, `useThreads()` returned the current thread. A call without
|
|
722
|
+
* arguments throws a `CopilotKitRemovedApiError`, and so does a read of
|
|
723
|
+
* `threadId`, `setThreadId`, or `isThreadIdExplicit` on the result. Read the
|
|
724
|
+
* current thread from `useCopilotChatConfiguration()`.
|
|
725
|
+
*
|
|
721
726
|
* @param input - Agent identifier and optional list controls.
|
|
722
727
|
* @returns Thread list state and stable mutation callbacks.
|
|
723
728
|
*
|
|
@@ -746,12 +751,7 @@ interface UseThreadsResult {
|
|
|
746
751
|
* }
|
|
747
752
|
* ```
|
|
748
753
|
*/
|
|
749
|
-
declare function useThreads(
|
|
750
|
-
agentId,
|
|
751
|
-
includeArchived,
|
|
752
|
-
limit,
|
|
753
|
-
enabled
|
|
754
|
-
}: UseThreadsInput): UseThreadsResult;
|
|
754
|
+
declare function useThreads(input: UseThreadsInput): UseThreadsResult;
|
|
755
755
|
//#endregion
|
|
756
756
|
//#region src/hooks/use-render-tool.d.ts
|
|
757
757
|
interface RenderToolInProgressProps<S extends StandardSchemaV1> {
|
|
@@ -850,9 +850,13 @@ interface UseRenderToolCallProps {
|
|
|
850
850
|
* Hook that returns a function to render tool calls based on the render functions
|
|
851
851
|
* defined in CopilotKitProvider.
|
|
852
852
|
*
|
|
853
|
+
* @param removedArguments - None. In 1.x, `useRenderToolCall(tool, deps)`
|
|
854
|
+
* registered a renderer for a tool. That call throws a
|
|
855
|
+
* `CopilotKitRemovedApiError` in 2.0: register a renderer with `useRenderTool`.
|
|
856
|
+
* See https://docs.copilotkit.ai/migrate/removed-apis-2.0#userendertoolcall-with-arguments
|
|
853
857
|
* @returns A function that takes a tool call and optional tool message and returns the rendered component
|
|
854
858
|
*/
|
|
855
|
-
declare function useRenderToolCall(): ({
|
|
859
|
+
declare function useRenderToolCall(...removedArguments: never[]): ({
|
|
856
860
|
toolCall,
|
|
857
861
|
toolMessage
|
|
858
862
|
}: UseRenderToolCallProps) => React$1.ReactElement | null;
|
package/dist/headless.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headless.d.cts","names":[],"sources":["../src/providers/use-owned-core.ts","../src/providers/CopilotChatConfigurationProvider.tsx","../src/hooks/use-agent.tsx","../src/types/react-tool-call-renderer.ts","../src/types/frontend-tool.ts","../src/hooks/use-frontend-tool.tsx","../src/hooks/use-frontend-tools.tsx","../src/hooks/use-component.tsx","../src/types/human-in-the-loop.ts","../src/hooks/use-human-in-the-loop.tsx","../src/hooks/use-interrupt.tsx","../src/hooks/use-suggestions.tsx","../src/hooks/use-configure-suggestions.tsx","../src/hooks/use-agent-context.tsx","../src/hooks/use-threads.tsx","../src/hooks/use-render-tool.tsx","../src/hooks/use-render-tool-call.tsx","../src/types/defineToolCallRenderer.ts","../src/h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MAAA,qBAClC,IAAA,CAAK,YAAA,CAAa,CAAA;;ARVwB;;;;EQgB5C,MAAA,EAAQ,OAAA,CAAM,aAAA,CAAc,yBAAA,CAA0B,CAAA;AAAA;;;
|
|
1
|
+
{"version":3,"file":"headless.d.cts","names":[],"sources":["../src/providers/use-owned-core.ts","../src/providers/CopilotChatConfigurationProvider.tsx","../src/hooks/use-agent.tsx","../src/types/react-tool-call-renderer.ts","../src/types/frontend-tool.ts","../src/hooks/use-frontend-tool.tsx","../src/hooks/use-frontend-tools.tsx","../src/hooks/use-component.tsx","../src/types/human-in-the-loop.ts","../src/hooks/use-human-in-the-loop.tsx","../src/hooks/use-interrupt.tsx","../src/hooks/use-suggestions.tsx","../src/hooks/use-configure-suggestions.tsx","../src/hooks/use-agent-context.tsx","../src/hooks/use-threads.tsx","../src/hooks/use-render-tool.tsx","../src/hooks/use-render-tool-call.tsx","../src/types/defineToolCallRenderer.ts","../src/hooks/use-capabilities.tsx"],"mappings":";;;;;;;;;;;UAIU,UAAA;EACR,OAAA;AAAA;;;;;;AAJ4C;;;;;AAyB9C;;;;;;;;iBAAgB,aAAA,WAAwB,UAAA,CAAA,CACtC,GAAA,EAAK,gBAAA,CAAiB,CAAA,UACtB,MAAA,QAAc,CAAA,GAAC,CAAA;;;UCRA,6BAAA;EACf,MAAA,EAAQ,mBAAA;EACR,OAAA;EACA,QAAA;EACA,WAAA;EACA,YAAA,GAAe,IAAA;EDrBP;;;;;EC2BR,UAAA;EDL2B;;;;;ECW3B,aAAA,GAAgB,IAAA;EDTD;;;;;ECef,gBAAA;EDhBsB;;;;;;;ECwBtB,cAAA;;;AA/BF;;;;;;;;EA0CE,oBAAA,GAAuB,UAAA,GAAa,IAAA;EAKpC,mBAAA;EA1Ce;;;;;;;;;;;;;;;;;EA4Df,iBAAA,GACE,QAAA,UACA,OAAA;IAAY,QAAA;EAAA;EAwBsC;;;;;;;;;EAbpD,cAAA;EAeS;;;;EAVT,MAAA,GAAS,uBAAA;AAAA;A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S,KAAA,UAAe,KAAA,CAAM,YAAA;EAC9B,OAAA,WdnCc;EcqCd,KAAA;AAAA,GAEF,IAAA,GAAO,aAAA;;;;;;;;;;;;;;AdmCT;;;;;;;;;;;;;;iBcLgB,aAAA,WAAwB,gBAAA,CAAA,CACtC,MAAA;EACE,IAAA;EACA,UAAA,EAAY,CAAA;EACZ,MAAA,GAAS,KAAA,EAAO,eAAA,CAAgB,CAAA,MAAO,KAAA,CAAM,YAAA;EAC7C,OAAA,WdeS;EcbT,KAAA;AAAA,GAEF,IAAA,GAAO,aAAA;;;UC/FQ,sBAAA;EACf,QAAA,EAAU,QAAA;EACV,WAAA,GAAc,WAAA;AAAA;;;;;;;;;;;iBA0HA,iBAAA,CAAA,GAAqB,gBAAA;EAAyB,QAAA;EAAA;AAAA,GA2BvD,sBAAA,KAAyB,OAAA,CAAM,YAAA;;;;;;;;;AhB1KQ;iBiBa9B,sBAAA,CAAuB,GAAA;EACrC,IAAA;EACA,MAAA,GAAS,KAAA,EAAO,mBAAA,UAA6B,OAAA,CAAM,YAAA;EACnD,OAAA;EACA,KAAA;AAAA,IACE,qBAAA;AAAA,iBAGY,sBAAA,WAAiC,gBAAA,CAAA,CAAkB,GAAA;EACjE,IAAA;EACA,IAAA,EAAM,CAAA;EACN,MAAA,GACE,KAAA,EAAO,mBAAA,CAAoB,iBAAA,CAAkB,CAAA,OAC1C,OAAA,CAAM,YAAA;EACX,OAAA;EACA,KAAA;AAAA,IACE,qBAAA,CAAsB,iBAAA,CAAkB,CAAA;;;;;;;;;;;;AjB7BE;;;;iBkBgB9B,eAAA,CACd,OAAA,YACC,iBAAA"}
|
package/dist/headless.d.mts
CHANGED
|
@@ -718,6 +718,11 @@ interface UseThreadsResult {
|
|
|
718
718
|
* `deleteThread`) return promises that resolve once the platform confirms the
|
|
719
719
|
* operation and reject with an `Error` on failure.
|
|
720
720
|
*
|
|
721
|
+
* In 1.x, `useThreads()` returned the current thread. A call without
|
|
722
|
+
* arguments throws a `CopilotKitRemovedApiError`, and so does a read of
|
|
723
|
+
* `threadId`, `setThreadId`, or `isThreadIdExplicit` on the result. Read the
|
|
724
|
+
* current thread from `useCopilotChatConfiguration()`.
|
|
725
|
+
*
|
|
721
726
|
* @param input - Agent identifier and optional list controls.
|
|
722
727
|
* @returns Thread list state and stable mutation callbacks.
|
|
723
728
|
*
|
|
@@ -746,12 +751,7 @@ interface UseThreadsResult {
|
|
|
746
751
|
* }
|
|
747
752
|
* ```
|
|
748
753
|
*/
|
|
749
|
-
declare function useThreads(
|
|
750
|
-
agentId,
|
|
751
|
-
includeArchived,
|
|
752
|
-
limit,
|
|
753
|
-
enabled
|
|
754
|
-
}: UseThreadsInput): UseThreadsResult;
|
|
754
|
+
declare function useThreads(input: UseThreadsInput): UseThreadsResult;
|
|
755
755
|
//#endregion
|
|
756
756
|
//#region src/hooks/use-render-tool.d.ts
|
|
757
757
|
interface RenderToolInProgressProps<S extends StandardSchemaV1> {
|
|
@@ -850,9 +850,13 @@ interface UseRenderToolCallProps {
|
|
|
850
850
|
* Hook that returns a function to render tool calls based on the render functions
|
|
851
851
|
* defined in CopilotKitProvider.
|
|
852
852
|
*
|
|
853
|
+
* @param removedArguments - None. In 1.x, `useRenderToolCall(tool, deps)`
|
|
854
|
+
* registered a renderer for a tool. That call throws a
|
|
855
|
+
* `CopilotKitRemovedApiError` in 2.0: register a renderer with `useRenderTool`.
|
|
856
|
+
* See https://docs.copilotkit.ai/migrate/removed-apis-2.0#userendertoolcall-with-arguments
|
|
853
857
|
* @returns A function that takes a tool call and optional tool message and returns the rendered component
|
|
854
858
|
*/
|
|
855
|
-
declare function useRenderToolCall(): ({
|
|
859
|
+
declare function useRenderToolCall(...removedArguments: never[]): ({
|
|
856
860
|
toolCall,
|
|
857
861
|
toolMessage
|
|
858
862
|
}: UseRenderToolCallProps) => React$1.ReactElement | null;
|
package/dist/headless.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headless.d.mts","names":[],"sources":["../src/providers/use-owned-core.ts","../src/providers/CopilotChatConfigurationProvider.tsx","../src/hooks/use-agent.tsx","../src/types/react-tool-call-renderer.ts","../src/types/frontend-tool.ts","../src/hooks/use-frontend-tool.tsx","../src/hooks/use-frontend-tools.tsx","../src/hooks/use-component.tsx","../src/types/human-in-the-loop.ts","../src/hooks/use-human-in-the-loop.tsx","../src/hooks/use-interrupt.tsx","../src/hooks/use-suggestions.tsx","../src/hooks/use-configure-suggestions.tsx","../src/hooks/use-agent-context.tsx","../src/hooks/use-threads.tsx","../src/hooks/use-render-tool.tsx","../src/hooks/use-render-tool-call.tsx","../src/types/defineToolCallRenderer.ts","../src/hooks/use-capabilities.tsx"],"mappings":";;;;;;;;;;;UAIU,UAAA;EACR,OAAA;AAAA;;;;;;AAJ4C;;;;;AAyB9C;;;;;;;;iBAAgB,aAAA,WAAwB,UAAA,CAAA,CACtC,GAAA,EAAK,gBAAA,CAAiB,CAAA,UACtB,MAAA,QAAc,CAAA,GAAC,CAAA;;;UCRA,6BAAA;EACf,MAAA,EAAQ,mBAAA;EACR,OAAA;EACA,QAAA;EACA,WAAA;EACA,YAAA,GAAe,IAAA;EDrBP;;;;;EC2BR,UAAA;EDL2B;;;;;ECW3B,aAAA,GAAgB,IAAA;EDTD;;;;;ECef,gBAAA;EDhBsB;;;;;;;ECwBtB,cAAA;;;AA/BF;;;;;;;;EA0CE,oBAAA,GAAuB,UAAA,GAAa,IAAA;EAKpC,mBAAA;EA1Ce;;;;;;;;;;;;;;;;;EA4Df,iBAAA,GACE,QAAA,UACA,OAAA;IAAY,QAAA;EAAA;EAwBsC;;;;;;;;;EAbpD,cAAA;EAeS;;;;EAVT,MAAA,GAAS,uBAAA;AAAA;AAAA,UAQM,qCAAA;EACf,QAAA,EAAU,SAAA;EACV,MAAA,GAAS,OAAA,CAAQ,mBAAA;EACjB,OAAA;EACA,QAAA;EAMA,mBAAA;EACA,kBAAA;AAAA;AAAA,cAIW,gCAAA,EAAkC,OAAA,CAAM,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DJ,gBAAA,MAAsB,CAAA,SAAU,gBAAA,GACjC,iBAAA,CAAkB,CAAA;;;;;;;;APLwB;;;;;AAyB9C;;;;;;;;;;;;;;;;;;;;;;;ACNA;;;;;;;;;;;;;;;iBMuCgB,YAAA,iBACE,gBAAA,MAAsB,MAAA,2CAAA,CAGtC,MAAA;EACE,IAAA;EACA,WAAA;EACA,UAAA,GAAa,OAAA;EACb,MAAA,EAAQ,aAAA,CAAc,OAAA,CAAQ,gBAAA,CAAiB,OAAA;EAC/C,OAAA;EACA,QAAA;AAAA,GAEF,IAAA,GAAO,aAAA;;;;;;;;;KC9DG,mBAAA,WACA,MAAA,oBAA0B,MAAA,qBAClC,IAAA,CAAK,YAAA,CAAa,CAAA;;ARVwB;;;;EQgB5C,MAAA,EAAQ,OAAA,CAAM,aAAA,CAAc,yBAAA,CAA0B,CAAA;AAAA;;;
|
|
1
|
+
{"version":3,"file":"headless.d.mts","names":[],"sources":["../src/providers/use-owned-core.ts","../src/providers/CopilotChatConfigurationProvider.tsx","../src/hooks/use-agent.tsx","../src/types/react-tool-call-renderer.ts","../src/types/frontend-tool.ts","../src/hooks/use-frontend-tool.tsx","../src/hooks/use-frontend-tools.tsx","../src/hooks/use-component.tsx","../src/types/human-in-the-loop.ts","../src/hooks/use-human-in-the-loop.tsx","../src/hooks/use-interrupt.tsx","../src/hooks/use-suggestions.tsx","../src/hooks/use-configure-suggestions.tsx","../src/hooks/use-agent-context.tsx","../src/hooks/use-threads.tsx","../src/hooks/use-render-tool.tsx","../src/hooks/use-render-tool-call.tsx","../src/types/defineToolCallRenderer.ts","../src/hooks/use-capabilities.tsx"],"mappings":";;;;;;;;;;;UAIU,UAAA;EACR,OAAA;AAAA;;;;;;AAJ4C;;;;;AAyB9C;;;;;;;;iBAAgB,aAAA,WAAwB,UAAA,CAAA,CACtC,GAAA,EAAK,gBAAA,CAAiB,CAAA,UACtB,MAAA,QAAc,CAAA,GAAC,CAAA;;;UCRA,6BAAA;EACf,MAAA,EAA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CAAoB,iBAAA,CAAkB,CAAA,OAC1C,OAAA,CAAM,YAAA;EACX,OAAA;EACA,KAAA;AAAA,IACE,qBAAA,CAAsB,iBAAA,CAAkB,CAAA;;;;;;;;;;;;AjB7BE;;;;iBkBgB9B,eAAA,CACd,OAAA,YACC,iBAAA"}
|
package/dist/headless.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CopilotKitContext, CopilotKitCoreReact, useCopilotKit, useCopilotKit as useCopilotKit$1, useDefaultAgentId } from "@copilotkit/react-core/context";
|
|
2
2
|
import React, { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
3
|
-
import { CopilotChatDefaultLabels, CopilotChatDefaultLabels as CopilotChatDefaultLabels$1, ToolCallStatus, ɵChatConfigurationStore, ɵInterruptController, ɵThreadsController, ɵbindSuggestionsConfig, ɵbuildHumanInTheLoopTool, ɵbuildToolCallRenderProps, ɵcomponentToolDescription, ɵcreateThreadStore, ɵdescribeUnrenderedToolCalls, ɵgetAgentCapabilities, ɵgetAgentResolver, ɵhitlRenderProps, ɵregisterFrontendTools, ɵresolveAgentId, ɵresolveAgentThreadId, ɵresolveToolCallAgentId, ɵresolveToolCallRenderer, ɵserializeContextValue, ɵshallowEqualRecord, ɵsubscribeToAgentSuggestions, ɵsubscribeToAgentUpdates, ɵvalidateAgentBinding } from "@copilotkit/core";
|
|
3
|
+
import { CopilotChatDefaultLabels, CopilotChatDefaultLabels as CopilotChatDefaultLabels$1, ToolCallStatus, ɵChatConfigurationStore, ɵInterruptController, ɵThreadsController, ɵbindSuggestionsConfig, ɵbuildHumanInTheLoopTool, ɵbuildToolCallRenderProps, ɵcheckToolParameters, ɵcomponentToolDescription, ɵcreateThreadStore, ɵdescribeUnrenderedToolCalls, ɵgetAgentCapabilities, ɵgetAgentResolver, ɵhitlRenderProps, ɵregisterFrontendTools, ɵresolveAgentId, ɵresolveAgentThreadId, ɵresolveToolCallAgentId, ɵresolveToolCallRenderer, ɵserializeContextValue, ɵshallowEqualRecord, ɵsubscribeToAgentSuggestions, ɵsubscribeToAgentUpdates, ɵvalidateAgentBinding } from "@copilotkit/core";
|
|
4
4
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
|
-
import { ɵanySchema } from "@copilotkit/shared";
|
|
5
|
+
import { CopilotKitRemovedApiError, ɵanySchema } from "@copilotkit/shared";
|
|
6
6
|
|
|
7
7
|
//#region src/providers/use-owned-core.ts
|
|
8
8
|
/**
|
|
@@ -431,6 +431,7 @@ function useDepsVersion(deps) {
|
|
|
431
431
|
* ```
|
|
432
432
|
*/
|
|
433
433
|
function useFrontendTool(tool, deps) {
|
|
434
|
+
ɵcheckToolParameters("useFrontendTool", tool.parameters);
|
|
434
435
|
const { copilotkit } = useCopilotKit$1();
|
|
435
436
|
const depsVersion = useDepsVersion(deps);
|
|
436
437
|
useLayoutEffect(() => {
|
|
@@ -588,6 +589,7 @@ function useComponent(config, deps) {
|
|
|
588
589
|
//#endregion
|
|
589
590
|
//#region src/hooks/use-human-in-the-loop.tsx
|
|
590
591
|
function useHumanInTheLoop(tool, deps) {
|
|
592
|
+
ɵcheckToolParameters("useHumanInTheLoop", tool.parameters);
|
|
591
593
|
const { copilotkit } = useCopilotKit$1();
|
|
592
594
|
const registry = copilotkit.ɵhumanInTheLoop;
|
|
593
595
|
const RenderComponent = useCallback((props) => React.createElement(tool.render, ɵhitlRenderProps(props, tool, registry)), [
|
|
@@ -808,6 +810,11 @@ function useAgentContext(context) {
|
|
|
808
810
|
* `deleteThread`) return promises that resolve once the platform confirms the
|
|
809
811
|
* operation and reject with an `Error` on failure.
|
|
810
812
|
*
|
|
813
|
+
* In 1.x, `useThreads()` returned the current thread. A call without
|
|
814
|
+
* arguments throws a `CopilotKitRemovedApiError`, and so does a read of
|
|
815
|
+
* `threadId`, `setThreadId`, or `isThreadIdExplicit` on the result. Read the
|
|
816
|
+
* current thread from `useCopilotChatConfiguration()`.
|
|
817
|
+
*
|
|
811
818
|
* @param input - Agent identifier and optional list controls.
|
|
812
819
|
* @returns Thread list state and stable mutation callbacks.
|
|
813
820
|
*
|
|
@@ -836,7 +843,9 @@ function useAgentContext(context) {
|
|
|
836
843
|
* }
|
|
837
844
|
* ```
|
|
838
845
|
*/
|
|
839
|
-
function useThreads(
|
|
846
|
+
function useThreads(input) {
|
|
847
|
+
checkThreadsInput(input);
|
|
848
|
+
const { agentId, includeArchived, limit, enabled = true } = input;
|
|
840
849
|
const { copilotkit } = useCopilotKit$1();
|
|
841
850
|
const [controller] = useState(() => new ɵThreadsController(ɵcreateThreadStore({ fetch: copilotkit.ɵruntimeFetch }), {
|
|
842
851
|
core: copilotkit,
|
|
@@ -870,7 +879,7 @@ function useThreads({ agentId, includeArchived, limit, enabled = true }) {
|
|
|
870
879
|
copilotkit.threadEndpoints?.mutations
|
|
871
880
|
]);
|
|
872
881
|
const { fetchMoreThreads, refetchThreads, startNewThread, renameThread, archiveThread, unarchiveThread, deleteThread } = controller;
|
|
873
|
-
return {
|
|
882
|
+
return withRemovedThreadFields({
|
|
874
883
|
threads,
|
|
875
884
|
isLoading,
|
|
876
885
|
error,
|
|
@@ -886,7 +895,42 @@ function useThreads({ agentId, includeArchived, limit, enabled = true }) {
|
|
|
886
895
|
archiveThread,
|
|
887
896
|
unarchiveThread,
|
|
888
897
|
deleteThread
|
|
889
|
-
};
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
const USE_THREADS_SECTION = "/migrate/removed-apis-2.0#usethreads";
|
|
901
|
+
/** Throws for the 1.x call `useThreads()`, which has no input. */
|
|
902
|
+
function checkThreadsInput(input) {
|
|
903
|
+
if (input !== void 0) return;
|
|
904
|
+
throw new CopilotKitRemovedApiError({
|
|
905
|
+
what: "\"useThreads()\" without arguments",
|
|
906
|
+
use: "useThreads({ agentId }) lists the threads of an agent. To read or set the current thread, use useCopilotChatConfiguration() from @copilotkit/react-core.",
|
|
907
|
+
docs: USE_THREADS_SECTION
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
/** The fields of the 1.x `useThreads()` result, and what to use in 2.0. */
|
|
911
|
+
const REMOVED_THREAD_FIELDS = {
|
|
912
|
+
threadId: "Read threadId from useCopilotChatConfiguration() of @copilotkit/react-core.",
|
|
913
|
+
setThreadId: "Call setActiveThreadId(threadId) on useCopilotChatConfiguration() of @copilotkit/react-core.",
|
|
914
|
+
isThreadIdExplicit: "Read hasExplicitThreadId from useCopilotChatConfiguration() of @copilotkit/react-core."
|
|
915
|
+
};
|
|
916
|
+
/**
|
|
917
|
+
* Adds a getter that throws a `CopilotKitRemovedApiError` for each field of
|
|
918
|
+
* the 1.x result. The getters are not enumerable, so a spread, a JSON copy,
|
|
919
|
+
* or devtools do not call them.
|
|
920
|
+
*/
|
|
921
|
+
function withRemovedThreadFields(result) {
|
|
922
|
+
const fields = Object.entries(REMOVED_THREAD_FIELDS);
|
|
923
|
+
for (const [field, use] of fields) Object.defineProperty(result, field, {
|
|
924
|
+
enumerable: false,
|
|
925
|
+
get() {
|
|
926
|
+
throw new CopilotKitRemovedApiError({
|
|
927
|
+
what: `"${field}" from useThreads`,
|
|
928
|
+
use: `${use} useThreads({ agentId }) lists the threads of an agent.`,
|
|
929
|
+
docs: USE_THREADS_SECTION
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
return result;
|
|
890
934
|
}
|
|
891
935
|
|
|
892
936
|
//#endregion
|
|
@@ -1039,9 +1083,18 @@ function useToolCallRenderers() {
|
|
|
1039
1083
|
* Hook that returns a function to render tool calls based on the render functions
|
|
1040
1084
|
* defined in CopilotKitProvider.
|
|
1041
1085
|
*
|
|
1086
|
+
* @param removedArguments - None. In 1.x, `useRenderToolCall(tool, deps)`
|
|
1087
|
+
* registered a renderer for a tool. That call throws a
|
|
1088
|
+
* `CopilotKitRemovedApiError` in 2.0: register a renderer with `useRenderTool`.
|
|
1089
|
+
* See https://docs.copilotkit.ai/migrate/removed-apis-2.0#userendertoolcall-with-arguments
|
|
1042
1090
|
* @returns A function that takes a tool call and optional tool message and returns the rendered component
|
|
1043
1091
|
*/
|
|
1044
|
-
function useRenderToolCall() {
|
|
1092
|
+
function useRenderToolCall(...removedArguments) {
|
|
1093
|
+
if (removedArguments.length > 0) throw new CopilotKitRemovedApiError({
|
|
1094
|
+
what: "\"useRenderToolCall(tool, deps)\"",
|
|
1095
|
+
use: "To register a renderer for a tool, use useRenderTool from @copilotkit/react-core. useRenderToolCall() takes no arguments: it returns a function that renders a tool call.",
|
|
1096
|
+
docs: "/migrate/removed-apis-2.0#userendertoolcall-with-arguments"
|
|
1097
|
+
});
|
|
1045
1098
|
const { copilotkit, executingToolCallIds } = useCopilotKit$1();
|
|
1046
1099
|
const agentId = ɵresolveToolCallAgentId(useCopilotChatConfiguration()?.agentId, void 0);
|
|
1047
1100
|
const unrenderedToolNames = useRef(/* @__PURE__ */ new Set());
|