rdesign/frontend/node_modules/@copilotkitnext/react/dist/hooks/use-default-render-tool.d.cts

51 lines
1.6 KiB
TypeScript

import React from "react";
//#region src/hooks/use-default-render-tool.d.ts
type DefaultRenderProps = {
/** The name of the tool being called. */name: string; /** The parsed parameters passed to the tool call. */
parameters: unknown; /** Current execution status of the tool call. */
status: "inProgress" | "executing" | "complete"; /** The tool call result string, available only when `status` is `"complete"`. */
result: string | undefined;
};
/**
* Registers a wildcard (`"*"`) tool-call renderer via `useRenderTool`.
*
* - Call with no config to use CopilotKit's built-in default tool-call card.
* - Pass `config.render` to replace the default UI with your own fallback renderer.
*
* This is useful when you want a generic renderer for tools that do not have a
* dedicated `useRenderTool({ name: "..." })` registration.
*
* @param config - Optional custom wildcard render function.
* @param deps - Optional dependencies to refresh registration.
*
* @example
* ```tsx
* useDefaultRenderTool();
* ```
*
* @example
* ```tsx
* useDefaultRenderTool({
* render: ({ name, status }) => <div>{name}: {status}</div>,
* });
* ```
*
* @example
* ```tsx
* useDefaultRenderTool(
* {
* render: ({ name, result }) => (
* <ToolEventRow title={name} payload={result} compact={compactMode} />
* ),
* },
* [compactMode],
* );
* ```
*/
declare function useDefaultRenderTool(config?: {
render?: (props: DefaultRenderProps) => React.ReactElement;
}, deps?: ReadonlyArray<unknown>): void;
//#endregion
export { useDefaultRenderTool };
//# sourceMappingURL=use-default-render-tool.d.cts.map