/** * Tool LLM, internal LLM access for tool operations. * * Provides a lightweight interface for tool-internal LLM calls: * semantic diff, auto-heal, commit messages, prompt hooks, etc. * * Resolution order: * 1. tools.llmProvider + tools.llmModel from config * 2. Currently selected provider/model from providerRegistry * * Design constraints: * - Disabled tool LLM resolves to null. * - Configured routes are provider-qualified through the model registry. * - ToolLLM.chat() throws request and configuration failures. */ import type { ConfigManager } from './manager.js'; import type { LLMProvider } from '../providers/interface.js'; import type { ProviderRegistry } from '../providers/registry.js'; import type { RuntimeEventBus } from '../runtime/events/index.js'; /** Resolved provider + model pair for tool-internal LLM calls. */ export interface ResolvedToolLLM { provider: LLMProvider; modelId: string; } export interface ToolLLMDeps { readonly configManager: Pick; readonly providerRegistry: Pick; /** * Runtime bus for usage events. When present, every tool-internal LLM call * emits LLM_RESPONSE_RECEIVED with its token actuals so the shared * cost-attribution pipeline records the spend under whatever tool/hook/MCP * origin scope the call ran inside. Without it, spend from tool-internal * calls never reaches attribution. */ readonly runtimeBus?: RuntimeEventBus | null | undefined; /** Optional session identity stamped on emitted usage events. */ readonly sessionId?: (() => string | undefined) | undefined; } export declare class ToolLLMUnavailableError extends Error { constructor(message: string); } /** * Resolve the LLM provider and model to use for tool-internal operations. * * Resolution order: * 1. If tools.llmProvider + tools.llmModel are set in config, use that route. * 2. Otherwise use the currently selected provider/model. * * Returns null only when tools.llmEnabled is false. */ export declare function resolveToolLLM(deps: ToolLLMDeps): ResolvedToolLLM | null; /** Chat options for tool-internal LLM calls. */ export interface ToolLLMChatOptions { maxTokens?: number | undefined; systemPrompt?: string | undefined; } /** * ToolLLM, lightweight LLM interface for internal tool operations. * * Usage: * const result = await toolLLM.chat('Generate a commit message for: ...'); * * Returns provider text. Throws when disabled, unresolved, or when the provider * request fails. */ export declare class ToolLLM { private readonly deps; constructor(deps: ToolLLMDeps); /** * Send a single-turn prompt to the tool LLM. * * @param prompt The user prompt to send. * @param options Optional maxTokens and systemPrompt. * @returns The assistant's text response. */ chat(prompt: string, options?: ToolLLMChatOptions): Promise; } //# sourceMappingURL=tool-llm.d.ts.map