import type { ModelAdapterRuntimeCaller, ModelAdapterRuntimeGate } from "./modelAdapterRuntime.js";
import type { AuthEnvelope } from "../../agent_modelAdapter/authProfileLayer/authEnvelope.js";
import type { OpenAIV1ResponsesProviderCaller, OpenAIV1ResponsesResult, OpenAIV1ResponsesUsage } from "../../agent_modelAdapter/actualInvocationLayer/openai/v1_responses.js";
import { type OpenAiV1ChatCompletionsInvocationResult, type OpenAiV1ChatCompletionsProviderCaller, type OpenAiV1ChatCompletionsUsage } from "../../agent_modelAdapter/actualInvocationLayer/openai/v1_chat_completions.js";
import { type AnthropicV1MessagesInvocationResult, type AnthropicV1MessagesProviderCaller, type AnthropicV1MessagesUsage } from "../../agent_modelAdapter/actualInvocationLayer/anthropic/v1_messages.js";
export type ModelInvocationRuntimeMode = "single" | "stream" | "batch" | (string & {});
export type ModelInvocationRuntimeBoundary = "input" | "contract" | "governance" | "runtime-state" | "prompt" | "capability" | "carrier" | "side-effect";
export type ModelInvocationRuntimeErrorCode = "MISSING_RUNTIME_ID" | "MISSING_CALLER" | "MISSING_LOWERED_PROMPT" | "MISSING_LOWERING_ID" | "MISSING_CAPABILITY" | "MISSING_CAPABILITY_ID" | "MISSING_CARRIER" | "MISSING_CARRIER_ID" | "RUNTIME_NOT_READY" | "CONTRACT_REJECTED" | "GOVERNANCE_REJECTED" | "UNSAFE_INVOCATION_DISABLED" | "PROVIDER_CALLER_REQUIRED" | "UNSUPPORTED_PROVIDER_ROUTE" | "PROVIDER_INVOCATION_FAILED";
export type ModelInvocationRuntimeError = {
    code: ModelInvocationRuntimeErrorCode;
    message: string;
    boundary: ModelInvocationRuntimeBoundary;
    publicSafe: true;
};
export type ModelInvocationPromptRef = {
    loweringId?: string;
    promptPackId?: string;
    materialRefs?: readonly string[];
};
export type ModelInvocationCapabilityRef = {
    capabilityId?: string;
    kind?: string;
};
export type ModelInvocationCarrierRef = {
    carrierId?: string;
    provider?: string;
    endpointShape?: string;
    baseURL?: string;
    metadata?: Readonly<Record<string, unknown>>;
};
export type ModelInvocationRuntimeRequest = {
    runtimeId?: string;
    caller?: ModelAdapterRuntimeCaller;
    invocationId?: string;
    loweredPrompt?: ModelInvocationPromptRef;
    capability?: ModelInvocationCapabilityRef;
    carrier?: ModelInvocationCarrierRef;
    mode?: ModelInvocationRuntimeMode;
    runtimeReady?: boolean;
    allowProviderCall?: boolean;
    contract?: ModelAdapterRuntimeGate;
    governance?: ModelAdapterRuntimeGate;
    metadata?: Readonly<Record<string, unknown>>;
};
export type RuntimeModelInvocationLiveRequest = ModelInvocationRuntimeRequest & {
    providerBody?: unknown;
    auth?: AuthEnvelope;
    providerCaller?: OpenAIV1ResponsesProviderCaller;
    openaiResponsesCaller?: OpenAIV1ResponsesProviderCaller;
    openaiChatCompletionsCaller?: OpenAiV1ChatCompletionsProviderCaller;
    anthropicMessagesCaller?: AnthropicV1MessagesProviderCaller;
    dryRun?: boolean;
    requiredScopes?: readonly string[];
    allowedScopes?: readonly string[];
    chatgptAccountId?: string;
    clientName?: string;
    clientVersion?: string;
};
export type ModelInvocationProviderResult = OpenAIV1ResponsesResult | OpenAiV1ChatCompletionsInvocationResult | AnthropicV1MessagesInvocationResult;
export type ModelInvocationRuntimeUsage = OpenAIV1ResponsesUsage | OpenAiV1ChatCompletionsUsage | AnthropicV1MessagesUsage;
export type ModelInvocationMockableEnvelope = {
    loweringId: string;
    promptPackId?: string;
    materialRefs: readonly string[];
    capabilityId: string;
    capabilityKind?: string;
    carrierId: string;
    provider?: string;
    mode: ModelInvocationRuntimeMode;
};
export type ModelInvocationPlan = {
    invocationId: string;
    runtimeId: string;
    caller: ModelAdapterRuntimeCaller;
    route: "runtime.modelAdapter.modelInvocationRuntime";
    envelope: ModelInvocationMockableEnvelope;
    providerCallPermitted: boolean;
    transport: "mockable-envelope" | "provider";
    metadata: Readonly<Record<string, unknown>>;
    contractChecked: true;
    governanceChecked: true;
    dryRun: boolean;
    unsafeSideEffects: false;
};
export type ModelInvocationRuntimeResult = {
    ok: true;
    plan: ModelInvocationPlan;
    events: readonly string[];
} | {
    ok: false;
    error: ModelInvocationRuntimeError;
    events: readonly string[];
};
export type RuntimeModelInvocationResult = {
    ok: true;
    plan: ModelInvocationPlan;
    providerResult?: ModelInvocationProviderResult;
    usage?: ModelInvocationRuntimeUsage;
    raw: unknown;
    events: readonly string[];
} | {
    ok: false;
    error: ModelInvocationRuntimeError;
    providerResult?: ModelInvocationProviderResult;
    events: readonly string[];
};
export declare function planModelInvocation(request?: ModelInvocationRuntimeRequest): ModelInvocationRuntimeResult;
export declare function invokeModelThroughRuntime(request?: RuntimeModelInvocationLiveRequest): Promise<RuntimeModelInvocationResult>;
