opencoder
Version:
13 lines (12 loc) • 568 B
TypeScript
import type { ReactNode } from "react";
import { type JSONValue, type Tool, type ToolInvocation } from "ai";
type Streamable = ReactNode | Promise<ReactNode> | JSONValue;
export type Renderer<T extends Array<any>> = (...args: T) => AsyncGenerator<Streamable, void, void>;
export type CoderTool = Omit<Tool, "execute"> & {
generate?: Renderer<any>;
renderTitle?: (part: ToolInvocation) => ReactNode;
render?: (part: ToolInvocation) => ReactNode;
execute?: Tool["execute"];
};
export declare function defineTool(params: CoderTool): CoderTool;
export {};