import type { ToolSearchDocument } from "./engine/document.ts";
import { type AnthropicToolSearchTarget } from "./native-support.ts";
export declare const ANTHROPIC_TOOL_SEARCH_TYPE = "tool_search_tool_bm25_20251119";
export declare const ANTHROPIC_TOOL_SEARCH_NAME = "tool_search_tool_bm25";
/** Anthropic caps a request at 10k tools; beyond that native search is invalid. */
export declare const ANTHROPIC_MAX_TOOLS = 10000;
type McpNativeToolSearchGate = () => boolean;
/** Bind the MCP-owned user setting without moving MCP configuration into the shared builtin. */
export declare function installMcpNativeToolSearchGate(gate: McpNativeToolSearchGate): void;
export declare function isMcpNativeToolSearchEnabled(): boolean;
export interface NativeToolDefinition {
    readonly description?: string;
    readonly parameters?: unknown;
}
export interface AnthropicNativeInjectionConfig {
    /** Never defer this tool (our custom tool_search), and it is non-deferrable. */
    readonly searchToolName?: string;
    /** True only for catalog tools eligible for native deferral in this request. */
    readonly isDeferrable: (toolName: string) => boolean;
    /** Current searchable catalog. Omit when only transforming resident tools. */
    readonly getCatalog?: () => readonly ToolSearchDocument[];
    /** Resolve the winning registered definition used to inject inactive schemas. */
    readonly getToolDefinition?: (toolName: string) => NativeToolDefinition | undefined;
}
/**
 * Pure payload transform. Injects eligible inactive catalog schemas, adds exactly
 * one native search tool, and enforces Anthropic's HARD RULES: never defer the
 * local search tool, never combine defer_loading with cache_control, keep at
 * least one non-deferred tool, and skip entirely above the 10k tool cap.
 */
export declare function addAnthropicNativeToolSearch(target: AnthropicToolSearchTarget, payload: unknown, config: AnthropicNativeInjectionConfig): unknown;
/**
 * `tool_reference` blocks emitted inside a tool_result so the API expands the
 * referenced tools. Anthropic names the target through `tool_name`; a block
 * carrying `name` is rejected as a malformed content block.
 */
export declare function buildToolReferenceBlocks(names: readonly string[]): {
    type: "tool_reference";
    tool_name: string;
}[];
export interface AnthropicNativeAdapterDeps extends AnthropicNativeInjectionConfig {
    /** Resolved provider/config gate. */
    enabled(): boolean;
    /** Invoked once when a 400 forces the local-search fallback. */
    onFallback?(reason: string): void;
}
/** Session-scoped request injector with permanent 400 fallback for the session. */
export declare class AnthropicNativeToolSearchAdapter {
    #private;
    constructor(deps: AnthropicNativeAdapterDeps);
    applyBeforeRequest(target: AnthropicToolSearchTarget, payload: unknown): unknown;
    noteResponseStatus(status: number): void;
    get disabled(): boolean;
    get fallbackReason(): string | null;
}
export {};
//# sourceMappingURL=native-search.d.ts.map