/**
 * agentic-provider.ts
 *
 * An agentic Promptfoo provider that gives the model web_search and
 * fetch_page tools, simulating how real AI agents behave when a user
 * asks a development question.
 *
 * Supports two agent modes via the `agentMode` config:
 *
 *   - "naive"     — Simulates current agents (Claude Code, ChatGPT, Cursor):
 *                    uses Jina Reader for search + page fetching because real
 *                    agents can't render JavaScript-heavy SPAs server-side.
 *
 *   - "optimized" — Simulates an ideal agent that knows about Sanity's
 *                    agent-friendly endpoints: fetches .md versions of doc
 *                    pages directly, uses llms.txt for doc discovery, and
 *                    falls back to Jina only for non-Sanity pages.
 *
 * All HTTP requests go through the RequestRecorder, so they're automatically
 * classified as docPageVisits, searchQueries, etc.
 *
 * Promptfoo config usage:
 *
 *   providers:
 *     - id: file://dist/agent-observer/agentic-provider.js
 *       label: "GPT-4o (Naive Agent)"
 *       config:
 *         model: gpt-4o
 *         agentMode: naive       # or "optimized"
 *         maxToolRounds: 5
 */
interface CallApiContextParams {
    prompt?: {
        raw: string;
        label?: string;
    };
    vars?: Record<string, object | string>;
}
interface ProviderOptions {
    config?: Record<string, unknown>;
    id?: string;
}
interface ProviderResponse {
    cached?: boolean;
    cost?: number;
    error?: string;
    metadata?: Record<string, unknown>;
    output?: object | string;
    tokenUsage?: {
        total?: number;
        prompt?: number;
        completion?: number;
        cached?: number;
    };
}
export default class AgenticProvider {
    config: Record<string, unknown>;
    protected providerId: string;
    private agentMode;
    private allowedOrigins;
    private customHeaders;
    private docBaseUrl;
    private docsUrlPattern;
    private llmsTxtUrl;
    private parsedConfig;
    private priorityDomain;
    private searchMode;
    constructor(options: ProviderOptions);
    /**
     * Main Promptfoo provider entry point. Runs the full agentic loop.
     */
    callApi(prompt: string, context?: CallApiContextParams): Promise<ProviderResponse>;
    id(): string;
    /**
     * Build the system prompt based on agent mode and configured doc URLs.
     */
    private buildSystemPrompt;
    /**
     * Cleans Jina Reader markdown output by removing navigation boilerplate,
     * cookie banners, and footer content.
     */
    private cleanJinaContent;
    /**
     * Detect which LLM provider to use based on config and model name.
     * Reads the `provider` config field set by generate-configs, with
     * fallback heuristics for backward compatibility.
     */
    private detectProvider;
    private executeFetchPage;
    private executeListDocs;
    private executeTool;
    private executeWebSearch;
    /**
     * Build the set of tools available to the agent based on search mode
     * and agent mode. When searchMode is "off", web_search is excluded
     * entirely — the model can't call what it can't see.
     */
    private getAvailableTools;
    /**
     * Merge custom headers into a request's headers.
     * Custom headers are injected into doc-site requests only — never into
     * external APIs (OpenAI, Jina, Google).
     */
    private mergeDocHeaders;
    /**
     * Parses search results from Jina Reader markdown output.
     */
    private parseSearchResults;
    /**
     * Runs the agentic tool-calling loop. Routes to OpenAI or Anthropic
     * based on the `provider` config field.
     */
    private runAgenticLoop;
    private runAnthropicLoop;
    private runOpenAILoop;
    /**
     * Strips HTML tags and normalizes whitespace. Fallback for when
     * neither .md endpoints nor Jina are available.
     */
    private stripHtml;
    /**
     * Convert our ToolDefinition[] to Anthropic's tool format.
     * Anthropic uses `input_schema` instead of `parameters`.
     */
    private toAnthropicTools;
}
export {};
