/** * A single raw tool call from the AI provider (provider-agnostic shape). */ export interface RawToolCall { id: string; name: string; arguments: string; } /** * Resolved output for a single tool call to submit back to the AI. */ export interface ToolOutput { call_id: string; output: string; } /** * Pluggable tool handler — the app injects its own implementation. * * Telbany's implementation delegates to: * buildToolOutput → run-completion.service.ts * extractResult → run-completion.service.ts * * The SDK never imports Mongoose or app business logic. */ export interface ToolHandler { /** * Build the tool output string to submit back to the AI for a single tool call. * Return undefined to skip (tool not handled by this app). */ buildOutput(call: RawToolCall, context: ToolHandlerContext): Promise; /** * After all tool outputs are built, extract any app-level side-effect result * (e.g. a ticket-creation payload) to short-circuit further AI turns. * Return null to continue the tool loop normally. */ extractResult(calls: RawToolCall[], outputs: ToolOutput[], context: ToolHandlerContext): Promise; } export interface ToolHandlerContext { threadKey: string; chatbotId: string; organizationId?: string; userQuestion: string; mediaUrl?: string[]; } //# sourceMappingURL=tool-handler.interface.d.ts.map