import type { AuthEnvelope } from "../../authProfileLayer/authEnvelope.js";
export declare const OPENAI_V1_RESPONSES_ENDPOINT: "/v1/responses";
export declare const DEFAULT_OPENAI_V1_RESPONSES_BASE_URL: "https://api.openai.com";
export type OpenAIV1ResponsesMethod = "GET" | "POST" | "PATCH" | "DELETE";
export type OpenAIV1ResponsesBoundary = "input" | "contract" | "governance" | "auth" | "scope" | "provider" | "response";
export type OpenAIV1ResponsesErrorCode = "MISSING_OPERATION" | "MISSING_RUNTIME_ID" | "CONTRACT_REJECTED" | "GOVERNANCE_REJECTED" | "SCOPE_DENIED" | "AUTH_REJECTED" | "CALLER_REQUIRED" | "PROVIDER_AUTH_FAILED" | "PROVIDER_RATE_LIMITED" | "PROVIDER_TIMEOUT" | "PROVIDER_UNAVAILABLE" | "RESPONSE_FORMAT_DRIFT" | "CALLER_FAILED";
export type OpenAIV1ResponsesGate = {
    accepted: boolean;
    reason?: string;
};
export type OpenAIV1ResponsesRuntimeContext = {
    runtimeId?: string;
    invocationId?: string;
    traceId?: string;
    callerId?: string;
};
export type OpenAIV1ResponsesAuthEnvelope = {
    kind: "bearer" | "api-key" | "none";
    present: boolean;
    redactedToken?: string;
};
export type OpenAIV1ResponsesRequestEnvelope = {
    provider: "openai";
    apiVersion: "v1";
    endpoint: string;
    operation: string;
    method: OpenAIV1ResponsesMethod;
    url: string;
    pathSuffix: string;
    query: Readonly<Record<string, string>>;
    headers: Readonly<Record<string, string>>;
    body?: unknown;
    runtime: Required<OpenAIV1ResponsesRuntimeContext>;
    requestedScopes: readonly string[];
    grantedScopes: readonly string[];
    dryRun: boolean;
    providerCallPlanned: boolean;
    unsafeSideEffects: false;
    providerFieldsOpaque: true;
};
export type OpenAIV1ResponsesProviderCaller = (envelope: OpenAIV1ResponsesRequestEnvelope) => unknown | Promise<unknown>;
export type OpenAIV1ResponsesInvocationRequest = {
    operation?: string;
    method?: OpenAIV1ResponsesMethod;
    endpointPath?: string;
    pathSuffix?: string;
    query?: Readonly<Record<string, string | number | boolean | undefined>>;
    headers?: Readonly<Record<string, string | undefined>>;
    body?: unknown;
    baseUrl?: string;
    auth?: OpenAIV1ResponsesAuthEnvelope | AuthEnvelope;
    runtime?: OpenAIV1ResponsesRuntimeContext;
    requiredScopes?: readonly string[];
    allowedScopes?: readonly string[];
    contract?: OpenAIV1ResponsesGate;
    governance?: OpenAIV1ResponsesGate;
    dryRun?: boolean;
    mockResponse?: unknown;
    expectResponseObject?: boolean;
    caller?: OpenAIV1ResponsesProviderCaller;
};
export type OpenAIV1ResponsesResponseEnvelope = {
    provider: "openai";
    endpoint: string;
    mode: "dry-run" | "mock" | "caller";
    headers?: Readonly<Record<string, string>>;
    raw: unknown;
    usage?: OpenAIV1ResponsesUsage;
    providerFieldsOpaque: true;
};
export type OpenAIV1ResponsesUsage = {
    source: "openai.responses.usage";
    inputTokens?: number;
    outputTokens?: number;
    totalTokens?: number;
    cachedInputTokens?: number;
    reasoningTokens?: number;
    estimated: false;
};
export type OpenAIV1ResponsesCapabilitySignal = {
    provider: "openai";
    endpoint: string;
    operation: string;
    rawShape: "response-object" | "response-list" | "mock" | "dry-run";
};
export type OpenAIV1ResponsesError = {
    code: OpenAIV1ResponsesErrorCode;
    message: string;
    boundary: OpenAIV1ResponsesBoundary;
    retryable: boolean;
};
export type OpenAIV1ResponsesResult = {
    ok: true;
    request: OpenAIV1ResponsesRequestEnvelope;
    response: OpenAIV1ResponsesResponseEnvelope;
    capability: OpenAIV1ResponsesCapabilitySignal;
    events: readonly string[];
} | {
    ok: false;
    error: OpenAIV1ResponsesError;
    request?: OpenAIV1ResponsesRequestEnvelope;
    events: readonly string[];
};
export declare function extractOpenAIV1ResponsesUsage(raw: unknown): OpenAIV1ResponsesUsage | undefined;
export declare function classifyOpenAIV1ResponsesProviderError(error: unknown): OpenAIV1ResponsesErrorCode;
export declare function invokeOpenAIV1Responses(input?: OpenAIV1ResponsesInvocationRequest): Promise<OpenAIV1ResponsesResult>;
