UNPKG

@tanstack/ai-code-mode

Version:

Code Mode for TanStack AI - LLM-driven code execution in secure sandboxes

25 lines (24 loc) 1.19 kB
import { CodeModeTool, ToolBinding } from '../types.js'; /** * Convert an array of TanStack AI tools to a Record of ToolBindings * * @param tools - Array of tools to convert * @param prefix - Optional prefix to add to binding names (e.g., 'external_') */ export declare function toolsToBindings(tools: Array<CodeModeTool>, prefix?: string): Record<string, ToolBinding>; /** * Convert a single TanStack AI tool to a ToolBinding * * @param tool - Tool to convert * @param prefix - Optional prefix to add to binding name (e.g., 'external_') * @throws Error if the tool doesn't have an execute function */ export declare function toolToBinding(tool: CodeModeTool, prefix?: string): ToolBinding; /** * Create event-aware bindings that emit custom events for each external function call. * Wraps each binding's execute function to emit events before and after execution. * * @param bindings - Original tool bindings * @param emitCustomEvent - Callback to emit custom events to the stream */ export declare function createEventAwareBindings(bindings: Record<string, ToolBinding>, emitCustomEvent: (eventName: string, data: Record<string, any>) => void): Record<string, ToolBinding>;