import type { Fetch as OpenAiFetch } from 'openai/core.js';
import type { LlmAdapter, ChatMessage, LlmResponse, LlmAdapterCapabilities, LlmStreamEvent, LlmAdapterCreateInput } from '../../../../core/llm/types.js';
import type { ToolDefinition } from '../../../../core/types.js';
import { type OpenAiOAuthCredential } from '../../../../core/auth/index.js';
export type OpenAiAdapterOptions = LlmAdapterCreateInput;
export type CompatibleFetch = (url: unknown, init?: unknown) => Promise<globalThis.Response>;
/**
 * OpenAI implementation of the LLM port. It owns OpenAI Responses streaming,
 * tool-call parsing, reasoning summary conversion, and OAuth fetch wiring.
 */
export declare class OpenAiAdapter implements LlmAdapter {
    private static readonly capabilities;
    readonly info: {
        provider: "openai";
        model: string;
        capabilities: LlmAdapterCapabilities;
    };
    private readonly client;
    private readonly model;
    private readonly oauthCredential?;
    private readonly reasoningEffort?;
    constructor(options?: OpenAiAdapterOptions);
    chat(messages: ChatMessage[], tools: ToolDefinition[], signal?: AbortSignal, onStreamEvent?: (event: LlmStreamEvent) => void): Promise<LlmResponse>;
    private static firstDefinedNonEmpty;
}
export type OpenAiOAuthFetchOptions = {
    storePath?: string;
    fetchImpl?: CompatibleFetch;
    refreshBeforeMs?: number;
};
/**
 * Builds the OpenAI OAuth fetch implementation and refreshes stored account
 * credentials before expiry.
 */
export declare class OpenAiOAuthFetchService {
    static create(initialCredential: OpenAiOAuthCredential, options?: OpenAiOAuthFetchOptions): OpenAiFetch;
    private static normalizeRequestUrl;
    private static shouldRouteToCodexResponses;
}
/**
 * Executes and parses Codex account-mode SSE requests routed through OpenAI
 * OAuth. This is provider-specific support for external context tools.
 */
export declare class OpenAiCodexSseService {
    static execute(args: {
        oauthFetch: ReturnType<typeof OpenAiOAuthFetchService.create> | undefined;
        body: unknown;
        endpoint?: string;
    }): Promise<string>;
    static extractOutputText(text: string): string;
    static extractItems<T>(text: string, predicate: (item: unknown) => item is T): T[];
}
//# sourceMappingURL=openai-adapter.d.ts.map