/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
/**
 * @plan PLAN-20251205-ISSUE712
 * @description Tool ID strategy module for Kimi K2 and standard ID handling
 *
 * This module provides different strategies for resolving tool call IDs
 * based on the tool format being used. Kimi K2 requires a specific ID format
 * (functions.{name}:{index}) while most other providers use OpenAI-style
 * call_xxx format.
 */
import type { IContent, ToolCallBlock, ToolResponseBlock } from '../services/history/IContent.js';
import type { ToolFormat } from './IToolFormatter.js';
/**
 * Interface for mapping tool IDs to provider-specific formats
 */
export interface ToolIdMapper {
    /**
     * Resolves a tool call's internal ID to the provider-specific format
     */
    resolveToolCallId(tc: ToolCallBlock): string;
    /**
     * Resolves a tool response's callId to the provider-specific format
     * that matches its corresponding tool call
     */
    resolveToolResponseId(tr: ToolResponseBlock): string;
}
/**
 * Interface for creating tool ID mappers based on conversation contents
 */
export interface ToolIdStrategy {
    /**
     * Creates a mapper that can resolve tool IDs for the given conversation
     */
    createMapper(contents: IContent[]): ToolIdMapper;
}
/**
 * Checks if a model name indicates a Kimi K2 model that requires
 * the special functions.{name}:{index} ID format.
 *
 * Uses specific pattern matching to avoid false positives from models
 * that happen to contain 'k2' as part of their name (e.g., "gptk2-turbo").
 *
 * @param model - The model name to check
 * @returns true if this is a K2 model requiring special ID handling
 */
export declare function isKimiModel(model: string): boolean;
/**
 * Checks if a model name indicates a Mistral model that requires
 * the special 9-character alphanumeric ID format.
 *
 * Mistral models (both hosted and self-hosted) enforce a strict tool call ID format:
 * - Exactly 9 characters
 * - Only alphanumeric (a-z, A-Z, 0-9) - no underscores or special characters
 *
 * This applies to mistral, devstral, codestral, and other Mistral model variants.
 *
 * @param model - The model name to check
 * @returns true if this is a Mistral model requiring special ID handling
 */
export declare function isMistralModel(model: string): boolean;
/**
 * Kimi K2 strategy: Generates IDs in the format functions.{toolName}:{globalIndex}
 *
 * K2 uses a specific ID format where each tool call gets a sequential index
 * based on its position in the conversation. This strategy scans all tool calls
 * and assigns indices, then uses those indices when resolving IDs.
 */
export declare const kimiStrategy: ToolIdStrategy;
/**
 * Standard strategy: Converts internal hist_tool_xxx format to OpenAI call_xxx format
 *
 * This is the default strategy used for most providers (OpenAI, Qwen, DeepSeek, etc.)
 * It simply normalizes the internal ID format to the OpenAI format.
 */
export declare const standardStrategy: ToolIdStrategy;
/**
 * Mistral strategy: Generates IDs in Mistral's required format
 *
 * Mistral models (both hosted API and self-hosted) require tool call IDs to be:
 * - Exactly 9 characters
 * - Only alphanumeric (a-z, A-Z, 0-9)
 *
 * This strategy maintains a mapping from internal IDs to Mistral-compliant IDs
 * to ensure tool responses can be matched back to their calls.
 */
export declare const mistralStrategy: ToolIdStrategy;
/**
 * Gets the appropriate tool ID strategy for a given tool format
 *
 * @param format - The tool format being used
 * @returns The strategy to use for ID resolution
 */
export declare function getToolIdStrategy(format: ToolFormat): ToolIdStrategy;
