@copilotkit/react-core 1.50.1-next.0 → 1.50.1-next.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/CHANGELOG.md +16 -0
- package/dist/{chunk-BTZ3TJVX.mjs → chunk-4RRMC7L2.mjs} +4 -4
- package/dist/{chunk-JZN7YOPM.mjs → chunk-4YZA2BZC.mjs} +13 -13
- package/dist/{chunk-ZE4JVTEP.mjs → chunk-53K6WNJG.mjs} +2 -2
- package/dist/{chunk-U2ZRVVKT.mjs → chunk-BUSWSDYO.mjs} +2 -2
- package/dist/{chunk-T2VBHAAP.mjs → chunk-CDUIA2WM.mjs} +11 -3
- package/dist/chunk-CDUIA2WM.mjs.map +1 -0
- package/dist/{chunk-4HRUQH6U.mjs → chunk-E7SE25ZU.mjs} +2 -2
- package/dist/{chunk-5J7RRLRO.mjs → chunk-FQFXYAV7.mjs} +2 -2
- package/dist/{chunk-EG56H77V.mjs → chunk-GPEJNVE5.mjs} +2 -2
- package/dist/{chunk-7HI6VLJJ.mjs → chunk-HE22TZMF.mjs} +4 -4
- package/dist/{chunk-FESRCHUE.mjs → chunk-LCZZ7YGZ.mjs} +2 -2
- package/dist/{chunk-SNON4QA6.mjs → chunk-LHERIF3L.mjs} +4 -4
- package/dist/{chunk-LDEWO5XH.mjs → chunk-LSHFN2Y5.mjs} +28 -7
- package/dist/chunk-LSHFN2Y5.mjs.map +1 -0
- package/dist/{chunk-IUNU4CUG.mjs → chunk-YTQHRJUA.mjs} +4 -4
- package/dist/components/copilot-provider/copilot-messages.mjs +2 -2
- package/dist/components/copilot-provider/copilotkit.mjs +7 -7
- package/dist/components/copilot-provider/index.mjs +7 -7
- package/dist/components/error-boundary/error-boundary.mjs +2 -2
- package/dist/components/index.mjs +7 -7
- package/dist/context/index.mjs +5 -5
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +36 -7
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +14 -14
- package/dist/hooks/use-coagent-state-render-bridge.mjs +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +2 -2
- package/dist/hooks/use-copilot-action.js +9 -1
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +2 -2
- package/dist/hooks/use-copilot-authenticated-action.js +9 -1
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +3 -3
- package/dist/hooks/use-copilot-chat-headless_c.js +27 -6
- package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
- package/dist/hooks/use-copilot-chat-headless_c.mjs +5 -5
- package/dist/hooks/use-copilot-chat.js +27 -6
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +5 -5
- package/dist/hooks/use-copilot-chat_internal.d.ts +24 -2
- package/dist/hooks/use-copilot-chat_internal.js +27 -6
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +4 -4
- package/dist/hooks/use-default-tool.js +9 -1
- package/dist/hooks/use-default-tool.js.map +1 -1
- package/dist/hooks/use-default-tool.mjs +3 -3
- package/dist/hooks/use-frontend-tool.js +9 -1
- package/dist/hooks/use-frontend-tool.js.map +1 -1
- package/dist/hooks/use-frontend-tool.mjs +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.mjs +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +36 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -39
- package/dist/lib/copilot-task.mjs +8 -8
- package/dist/lib/index.mjs +8 -8
- package/package.json +3 -3
- package/src/hooks/index.ts +6 -1
- package/src/hooks/use-copilot-chat_internal.ts +59 -3
- package/src/hooks/use-frontend-tool.ts +13 -2
- package/dist/chunk-LDEWO5XH.mjs.map +0 -1
- package/dist/chunk-T2VBHAAP.mjs.map +0 -1
- /package/dist/{chunk-BTZ3TJVX.mjs.map → chunk-4RRMC7L2.mjs.map} +0 -0
- /package/dist/{chunk-JZN7YOPM.mjs.map → chunk-4YZA2BZC.mjs.map} +0 -0
- /package/dist/{chunk-ZE4JVTEP.mjs.map → chunk-53K6WNJG.mjs.map} +0 -0
- /package/dist/{chunk-U2ZRVVKT.mjs.map → chunk-BUSWSDYO.mjs.map} +0 -0
- /package/dist/{chunk-4HRUQH6U.mjs.map → chunk-E7SE25ZU.mjs.map} +0 -0
- /package/dist/{chunk-5J7RRLRO.mjs.map → chunk-FQFXYAV7.mjs.map} +0 -0
- /package/dist/{chunk-EG56H77V.mjs.map → chunk-GPEJNVE5.mjs.map} +0 -0
- /package/dist/{chunk-7HI6VLJJ.mjs.map → chunk-HE22TZMF.mjs.map} +0 -0
- /package/dist/{chunk-FESRCHUE.mjs.map → chunk-LCZZ7YGZ.mjs.map} +0 -0
- /package/dist/{chunk-SNON4QA6.mjs.map → chunk-LHERIF3L.mjs.map} +0 -0
- /package/dist/{chunk-IUNU4CUG.mjs.map → chunk-YTQHRJUA.mjs.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDefaultTool
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-BUSWSDYO.mjs";
|
|
4
|
+
import "../chunk-GPEJNVE5.mjs";
|
|
5
5
|
import "../chunk-NBK4KBLX.mjs";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-CDUIA2WM.mjs";
|
|
7
7
|
import "../chunk-7DTB7S5V.mjs";
|
|
8
8
|
import "../chunk-SKC7AJIV.mjs";
|
|
9
9
|
export {
|
|
@@ -80,11 +80,19 @@ function useFrontendTool(tool, dependencies) {
|
|
|
80
80
|
return rendered != null ? rendered : null;
|
|
81
81
|
};
|
|
82
82
|
})();
|
|
83
|
+
const handlerRef = (0, import_react.useRef)(tool.handler);
|
|
84
|
+
(0, import_react.useEffect)(() => {
|
|
85
|
+
handlerRef.current = tool.handler;
|
|
86
|
+
}, [tool.handler, ...dependencies != null ? dependencies : []]);
|
|
87
|
+
const normalizedHandler = tool.handler ? (args) => {
|
|
88
|
+
var _a;
|
|
89
|
+
return (_a = handlerRef.current) == null ? void 0 : _a.call(handlerRef, args);
|
|
90
|
+
} : void 0;
|
|
83
91
|
(0, import_react2.useFrontendTool)({
|
|
84
92
|
name,
|
|
85
93
|
description,
|
|
86
94
|
parameters: zodParameters,
|
|
87
|
-
handler:
|
|
95
|
+
handler: normalizedHandler,
|
|
88
96
|
followUp,
|
|
89
97
|
render: normalizedRender
|
|
90
98
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/use-frontend-tool.ts"],"sourcesContent":["import React from \"react\";\nimport { ActionRenderProps, FrontendAction } from \"../types/frontend-action\";\nimport { Parameter, getZodParameters, MappedParameterTypes } from \"@copilotkit/shared\";\nimport { parseJson } from \"@copilotkit/shared\";\nimport { ToolCallStatus } from \"@copilotkitnext/core\";\nimport {\n type ReactFrontendTool,\n useFrontendTool as useFrontendToolVNext,\n} from \"@copilotkitnext/react\";\n\ntype FrontendToolOptions<T extends Parameter[] | []> = ReactFrontendTool<MappedParameterTypes<T>>;\ntype FrontendToolRenderArgs<T extends Parameter[] | []> =\n | {\n name: string;\n args: Partial<MappedParameterTypes<T>>;\n status: ToolCallStatus.InProgress;\n result: undefined;\n }\n | {\n name: string;\n args: MappedParameterTypes<T>;\n status: ToolCallStatus.Executing;\n result: undefined;\n }\n | {\n name: string;\n args: MappedParameterTypes<T>;\n status: ToolCallStatus.Complete;\n result: string;\n };\n\nexport type UseFrontendToolArgs<T extends Parameter[] | [] = []> = {\n available?: \"disabled\" | \"enabled\";\n} & Pick<\n FrontendAction<T>,\n \"name\" | \"description\" | \"parameters\" | \"handler\" | \"followUp\" | \"render\"\n>;\n\nexport function useFrontendTool<const T extends Parameter[] = []>(\n tool: UseFrontendToolArgs<T>,\n dependencies?: any[],\n) {\n const { name, description, parameters, render, followUp } = tool;\n const zodParameters = getZodParameters(parameters);\n\n const normalizedRender: FrontendToolOptions<T>[\"render\"] | undefined = (() => {\n if (typeof render === \"undefined\") {\n return undefined;\n }\n\n if (typeof render === \"string\") {\n const staticRender = render;\n return (() =>\n React.createElement(\n React.Fragment,\n null,\n staticRender,\n )) as FrontendToolOptions<T>[\"render\"];\n }\n\n return ((args: FrontendToolRenderArgs<T>) => {\n const renderArgs = {\n ...args,\n result: typeof args.result === \"string\" ? parseJson(args.result, args.result) : args.result,\n } as ActionRenderProps<T>;\n\n const rendered = render(renderArgs);\n\n if (typeof rendered === \"string\") {\n return React.createElement(React.Fragment, null, rendered);\n }\n\n return rendered ?? null;\n }) as FrontendToolOptions<T>[\"render\"];\n })();\n\n useFrontendToolVNext<MappedParameterTypes<T>>({\n name,\n description,\n parameters: zodParameters,\n handler:
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-frontend-tool.ts"],"sourcesContent":["import React, { useEffect, useRef } from \"react\";\nimport { ActionRenderProps, FrontendAction } from \"../types/frontend-action\";\nimport { Parameter, getZodParameters, MappedParameterTypes } from \"@copilotkit/shared\";\nimport { parseJson } from \"@copilotkit/shared\";\nimport { ToolCallStatus } from \"@copilotkitnext/core\";\nimport {\n type ReactFrontendTool,\n useFrontendTool as useFrontendToolVNext,\n} from \"@copilotkitnext/react\";\n\ntype FrontendToolOptions<T extends Parameter[] | []> = ReactFrontendTool<MappedParameterTypes<T>>;\ntype FrontendToolRenderArgs<T extends Parameter[] | []> =\n | {\n name: string;\n args: Partial<MappedParameterTypes<T>>;\n status: ToolCallStatus.InProgress;\n result: undefined;\n }\n | {\n name: string;\n args: MappedParameterTypes<T>;\n status: ToolCallStatus.Executing;\n result: undefined;\n }\n | {\n name: string;\n args: MappedParameterTypes<T>;\n status: ToolCallStatus.Complete;\n result: string;\n };\n\nexport type UseFrontendToolArgs<T extends Parameter[] | [] = []> = {\n available?: \"disabled\" | \"enabled\";\n} & Pick<\n FrontendAction<T>,\n \"name\" | \"description\" | \"parameters\" | \"handler\" | \"followUp\" | \"render\"\n>;\n\nexport function useFrontendTool<const T extends Parameter[] = []>(\n tool: UseFrontendToolArgs<T>,\n dependencies?: any[],\n) {\n const { name, description, parameters, render, followUp } = tool;\n const zodParameters = getZodParameters(parameters);\n\n const normalizedRender: FrontendToolOptions<T>[\"render\"] | undefined = (() => {\n if (typeof render === \"undefined\") {\n return undefined;\n }\n\n if (typeof render === \"string\") {\n const staticRender = render;\n return (() =>\n React.createElement(\n React.Fragment,\n null,\n staticRender,\n )) as FrontendToolOptions<T>[\"render\"];\n }\n\n return ((args: FrontendToolRenderArgs<T>) => {\n const renderArgs = {\n ...args,\n result: typeof args.result === \"string\" ? parseJson(args.result, args.result) : args.result,\n } as ActionRenderProps<T>;\n\n const rendered = render(renderArgs);\n\n if (typeof rendered === \"string\") {\n return React.createElement(React.Fragment, null, rendered);\n }\n\n return rendered ?? null;\n }) as FrontendToolOptions<T>[\"render\"];\n })();\n\n // Handler ref to avoid stale closures\n const handlerRef = useRef<typeof tool.handler>(tool.handler);\n\n useEffect(() => {\n handlerRef.current = tool.handler;\n }, [tool.handler, ...(dependencies ?? [])]);\n\n const normalizedHandler = tool.handler\n ? (args: MappedParameterTypes<T>) => handlerRef.current?.(args)\n : undefined;\n\n useFrontendToolVNext<MappedParameterTypes<T>>({\n name,\n description,\n parameters: zodParameters,\n handler: normalizedHandler,\n followUp,\n render: normalizedRender,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyC;AAEzC,oBAAkE;AAClE,IAAAA,iBAA0B;AAE1B,IAAAC,gBAGO;AA8BA,SAAS,gBACd,MACA,cACA;AACA,QAAM,EAAE,MAAM,aAAa,YAAY,QAAQ,SAAS,IAAI;AAC5D,QAAM,oBAAgB,gCAAiB,UAAU;AAEjD,QAAM,oBAAkE,MAAM;AAC5E,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO;AAAA,IACT;AAEA,QAAI,OAAO,WAAW,UAAU;AAC9B,YAAM,eAAe;AACrB,aAAQ,MACN,aAAAC,QAAM;AAAA,QACJ,aAAAA,QAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF;AAAA,IACJ;AAEA,WAAQ,CAAC,SAAoC;AAC3C,YAAM,aAAa,iCACd,OADc;AAAA,QAEjB,QAAQ,OAAO,KAAK,WAAW,eAAW,0BAAU,KAAK,QAAQ,KAAK,MAAM,IAAI,KAAK;AAAA,MACvF;AAEA,YAAM,WAAW,OAAO,UAAU;AAElC,UAAI,OAAO,aAAa,UAAU;AAChC,eAAO,aAAAA,QAAM,cAAc,aAAAA,QAAM,UAAU,MAAM,QAAQ;AAAA,MAC3D;AAEA,aAAO,8BAAY;AAAA,IACrB;AAAA,EACF,GAAG;AAGH,QAAM,iBAAa,qBAA4B,KAAK,OAAO;AAE3D,8BAAU,MAAM;AACd,eAAW,UAAU,KAAK;AAAA,EAC5B,GAAG,CAAC,KAAK,SAAS,GAAI,sCAAgB,CAAC,CAAE,CAAC;AAE1C,QAAM,oBAAoB,KAAK,UAC3B,CAAC,SAA+B;AApFtC;AAoFyC,4BAAW,YAAX,oCAAqB;AAAA,MACxD;AAEJ,oBAAAC,iBAA8C;AAAA,IAC5C;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,SAAS;AAAA,IACT;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AACH;","names":["import_shared","import_react","React","useFrontendToolVNext"]}
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "../chunk-VV56AVPB.mjs";
|
|
4
4
|
import "../chunk-I76HKHPJ.mjs";
|
|
5
5
|
import "../chunk-NB2FKV2V.mjs";
|
|
6
|
+
import "../chunk-F555TVE4.mjs";
|
|
6
7
|
import "../chunk-FDOMAPJY.mjs";
|
|
7
8
|
import "../chunk-AFNWX62Q.mjs";
|
|
8
9
|
import "../chunk-DMLQZG75.mjs";
|
|
9
|
-
import "../chunk-F555TVE4.mjs";
|
|
10
10
|
import "../chunk-SKC7AJIV.mjs";
|
|
11
11
|
export {
|
|
12
12
|
useLangGraphInterruptRender
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useLangGraphInterrupt
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-AFNWX62Q.mjs";
|
|
3
|
+
} from "../chunk-4RRMC7L2.mjs";
|
|
5
4
|
import "../chunk-EFL5OBKN.mjs";
|
|
5
|
+
import "../chunk-AFNWX62Q.mjs";
|
|
6
6
|
import "../chunk-SKC7AJIV.mjs";
|
|
7
7
|
export {
|
|
8
8
|
useLangGraphInterrupt
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { CopilotMessagesContext, CopilotMessagesContextParams, useCopilotMessage
|
|
|
5
5
|
export { CoAgentStateRendersContext, CoAgentStateRendersContextValue, CoAgentStateRendersProvider, useCoAgentStateRenders } from './context/coagent-state-renders-context.js';
|
|
6
6
|
export { ThreadsContext, ThreadsContextValue, ThreadsProvider, ThreadsProviderProps, useThreads } from './context/threads-context.js';
|
|
7
7
|
export { UseCopilotChatReturn, useCopilotChat } from './hooks/use-copilot-chat.js';
|
|
8
|
-
export { ChatSuggestions, UseCopilotChatOptions, UseCopilotChatOptions as UseCopilotChatOptions_c, UseCopilotChatReturn as UseCopilotChatReturn_c, useCopilotChatInternal } from './hooks/use-copilot-chat_internal.js';
|
|
8
|
+
export { ChatSuggestions, OnReloadMessages, OnStopGeneration, UseCopilotChatOptions, UseCopilotChatOptions as UseCopilotChatOptions_c, UseCopilotChatReturn as UseCopilotChatReturn_c, useCopilotChatInternal } from './hooks/use-copilot-chat_internal.js';
|
|
9
9
|
export { useCopilotChatHeadless_c } from './hooks/use-copilot-chat-headless_c.js';
|
|
10
10
|
export { useCopilotAction } from './hooks/use-copilot-action.js';
|
|
11
11
|
export { useCoAgentStateRender } from './hooks/use-coagent-state-render.js';
|
package/dist/index.js
CHANGED
|
@@ -2292,7 +2292,11 @@ function useLazyToolRenderer() {
|
|
|
2292
2292
|
// src/hooks/use-copilot-chat_internal.ts
|
|
2293
2293
|
var import_client = require("@ag-ui/client");
|
|
2294
2294
|
function useCopilotChatInternal({
|
|
2295
|
-
suggestions
|
|
2295
|
+
suggestions,
|
|
2296
|
+
onInProgress,
|
|
2297
|
+
onSubmitMessage,
|
|
2298
|
+
onStopGeneration,
|
|
2299
|
+
onReloadMessages
|
|
2296
2300
|
} = {}) {
|
|
2297
2301
|
var _a, _b, _c;
|
|
2298
2302
|
const { copilotkit } = (0, import_react24.useCopilotKit)();
|
|
@@ -2321,6 +2325,9 @@ function useCopilotChatInternal({
|
|
|
2321
2325
|
return () => {
|
|
2322
2326
|
};
|
|
2323
2327
|
}, [existingConfig == null ? void 0 : existingConfig.threadId, agent, copilotkit, resolvedAgentId]);
|
|
2328
|
+
(0, import_react23.useEffect)(() => {
|
|
2329
|
+
onInProgress == null ? void 0 : onInProgress(Boolean(agent == null ? void 0 : agent.isRunning));
|
|
2330
|
+
}, [agent == null ? void 0 : agent.isRunning, onInProgress]);
|
|
2324
2331
|
const interrupt = useLangGraphInterruptRender(agent);
|
|
2325
2332
|
const reset = () => {
|
|
2326
2333
|
agent == null ? void 0 : agent.setMessages([]);
|
|
@@ -2401,8 +2408,12 @@ function useCopilotChatInternal({
|
|
|
2401
2408
|
console.error("CopilotChat: runAgent failed", error);
|
|
2402
2409
|
}
|
|
2403
2410
|
}
|
|
2411
|
+
if (onSubmitMessage) {
|
|
2412
|
+
const content = typeof message.content === "string" ? message.content : message.content && "text" in message.content ? message.content.text : message.content && "filename" in message.content ? message.content.filename : "";
|
|
2413
|
+
onSubmitMessage(content);
|
|
2414
|
+
}
|
|
2404
2415
|
}),
|
|
2405
|
-
[agent, copilotkit, resolvedAgentId]
|
|
2416
|
+
[agent, copilotkit, resolvedAgentId, onSubmitMessage]
|
|
2406
2417
|
);
|
|
2407
2418
|
const latestAppendFunc = useAsyncCallback(
|
|
2408
2419
|
(message, options) => __async(this, null, function* () {
|
|
@@ -2423,14 +2434,24 @@ function useCopilotChatInternal({
|
|
|
2423
2434
|
const latestReload = useUpdatedRef(reload);
|
|
2424
2435
|
const latestReloadFunc = useAsyncCallback(
|
|
2425
2436
|
(messageId) => __async(this, null, function* () {
|
|
2437
|
+
var _a2;
|
|
2438
|
+
onReloadMessages == null ? void 0 : onReloadMessages({
|
|
2439
|
+
messageId,
|
|
2440
|
+
currentAgentName: agent == null ? void 0 : agent.agentId,
|
|
2441
|
+
messages: (_a2 = agent == null ? void 0 : agent.messages) != null ? _a2 : []
|
|
2442
|
+
});
|
|
2426
2443
|
return yield latestReload.current(messageId);
|
|
2427
2444
|
}),
|
|
2428
|
-
[latestReload]
|
|
2445
|
+
[latestReload, agent, onReloadMessages]
|
|
2429
2446
|
);
|
|
2430
2447
|
const latestStopFunc = (0, import_react23.useCallback)(() => {
|
|
2431
|
-
var _a2;
|
|
2432
|
-
|
|
2433
|
-
|
|
2448
|
+
var _a2, _b2;
|
|
2449
|
+
onStopGeneration == null ? void 0 : onStopGeneration({
|
|
2450
|
+
currentAgentName: agent == null ? void 0 : agent.agentId,
|
|
2451
|
+
messages: (_a2 = agent == null ? void 0 : agent.messages) != null ? _a2 : []
|
|
2452
|
+
});
|
|
2453
|
+
return (_b2 = agent == null ? void 0 : agent.abortRun) == null ? void 0 : _b2.call(agent);
|
|
2454
|
+
}, [onStopGeneration, agent]);
|
|
2434
2455
|
const latestReset = useUpdatedRef(reset);
|
|
2435
2456
|
const latestResetFunc = (0, import_react23.useCallback)(() => {
|
|
2436
2457
|
return latestReset.current();
|
|
@@ -2684,11 +2705,19 @@ function useFrontendTool(tool, dependencies) {
|
|
|
2684
2705
|
return rendered != null ? rendered : null;
|
|
2685
2706
|
};
|
|
2686
2707
|
})();
|
|
2708
|
+
const handlerRef = (0, import_react26.useRef)(tool.handler);
|
|
2709
|
+
(0, import_react26.useEffect)(() => {
|
|
2710
|
+
handlerRef.current = tool.handler;
|
|
2711
|
+
}, [tool.handler, ...dependencies != null ? dependencies : []]);
|
|
2712
|
+
const normalizedHandler = tool.handler ? (args) => {
|
|
2713
|
+
var _a;
|
|
2714
|
+
return (_a = handlerRef.current) == null ? void 0 : _a.call(handlerRef, args);
|
|
2715
|
+
} : void 0;
|
|
2687
2716
|
(0, import_react27.useFrontendTool)({
|
|
2688
2717
|
name,
|
|
2689
2718
|
description,
|
|
2690
2719
|
parameters: zodParameters,
|
|
2691
|
-
handler:
|
|
2720
|
+
handler: normalizedHandler,
|
|
2692
2721
|
followUp,
|
|
2693
2722
|
render: normalizedRender
|
|
2694
2723
|
});
|