import { createPiOAuthApiKeyResolver, listAcpSessions as listKernelAcpSessions } from "@mono-agent/agent-runtime"; import type { MonoAcpControlOptions, MonoAcpListSessionsRequest, MonoAcpSessionControlOptions, MonoRuntimeBackendDescriptor, MonoRuntimeBackendId, MonoRuntimeHostOptions, MonoRuntimeLike, MonoRuntimeSupportDescription, RuntimeExecutionMode, RuntimeModelReference, RuntimeRunOptions } from "./types.js"; export type RuntimeAdapterErrorCode = "invalid_model_reference" | "invalid_execution_mode" | "incompatible_execution_mode" | "runtime_backend_unavailable" | "invalid_runtime_options" | "invalid_local_provider"; export interface RuntimeAdapterErrorDetails { readonly code?: RuntimeAdapterErrorCode; readonly [key: string]: unknown; } export declare class RuntimeAdapterError extends Error { readonly code: RuntimeAdapterErrorCode; readonly details: RuntimeAdapterErrorDetails; constructor(code: RuntimeAdapterErrorCode, message: string, details?: RuntimeAdapterErrorDetails); } export declare function parseMonoRuntimeModelReference(value: string): RuntimeModelReference; export declare function isRuntimeExecutionMode(value: unknown): value is RuntimeExecutionMode; export declare function defaultExecutionModeForModel(model: RuntimeModelReference): RuntimeExecutionMode; export declare function probeAcpProfile(profileId: string, options: MonoAcpControlOptions): Promise<{ profileId: string; protocolVersion: any; agentInfo: any; agentCapabilities: any; authMethods: any; }>; export declare function authenticateAcpProfile(profileId: string, methodId: string, options: MonoAcpControlOptions): Promise<{ profileId: string; methodId: string; authenticated: boolean; }>; export declare function logoutAcpProfile(profileId: string, options: MonoAcpControlOptions): Promise<{ profileId: string; loggedOut: boolean; }>; export declare function listAcpSessions(profileId: string, options: MonoAcpSessionControlOptions): ReturnType; export declare function listAcpSessions(profileId: string, request: MonoAcpListSessionsRequest, options: MonoAcpSessionControlOptions): ReturnType; export declare function deleteAcpSession(providerSessionId: string, options: MonoAcpSessionControlOptions): Promise<{ profileId: string; providerSessionId: string; deleted: boolean; }>; /** * Stable canonical string for a model reference — its authored `reference` when * present, else `sdk[:provider]:model`. The one place this format lives, so * callers comparing/caching/keying by model (harness override selection, app * runtime cache, host/doctor display ids) stay in agreement. */ export declare function modelReferenceKey(model: RuntimeModelReference): string; export declare function listMonoRuntimeBackends(): readonly MonoRuntimeBackendDescriptor[]; export declare function runtimeBackendForModel(model: RuntimeModelReference, executionMode?: RuntimeExecutionMode): MonoRuntimeBackendDescriptor; export declare function monoRuntimeSupportsSessionResume(model: RuntimeModelReference, executionMode?: RuntimeExecutionMode): boolean; export declare function monoRuntimeSupportsLiveInput(model: RuntimeModelReference, executionMode?: RuntimeExecutionMode): boolean; export declare function monoRuntimeSupportsMcpApps(model: RuntimeModelReference, executionMode?: RuntimeExecutionMode): boolean; export declare function describeMonoRuntimeSupport(model: RuntimeModelReference, executionMode?: RuntimeExecutionMode): MonoRuntimeSupportDescription; export declare function assertExecutionModeCompatible(model: RuntimeModelReference, executionMode: string): void; export interface MonoRuntimeFallbackChainEntry { readonly model: RuntimeModelReference; readonly executionMode?: RuntimeExecutionMode; /** String pins this route, `null` selects the provider default, omitted inherits the run effort. */ readonly effort?: string | null; /** * Total attempts on this route including the first, 1–10. Omitted means a * single shot. A retry re-runs the whole logical turn on the same model and * only fires for transient provider failures. */ readonly attempts?: number; } export type MonoRuntimeRouteSafetyMode = "uniform" | "per-route-native"; export interface MonoRuntimeRetryPolicy { /** Delay before the first retry; doubles per retry. Defaults to 1000. */ readonly backoffMs?: number; /** Ceiling for the doubled delay. Defaults to 15000. */ readonly maxBackoffMs?: number; } export interface MonoRuntimeAttemptContext { readonly model: RuntimeModelReference; readonly executionMode: string | null; /** Index of this route in the chain. Stable across same-model retries. */ readonly attemptIndex: number; /** 0 for the first try of a route, then 1, 2, … for each same-model retry. */ readonly retryIndex: number; readonly routeSafety: MonoRuntimeRouteSafetyMode; } export interface MonoRuntimeAttemptResolution { /** Optional isolated runtime for this route. */ readonly runtime?: MonoRuntimeLike; /** Private per-attempt provider options. These are never copied into router telemetry. */ readonly options?: Readonly> & { /** The sandbox implementation is owned by createMonoRuntime. */ readonly sandbox?: never; /** Logical Codex network policy is caller-owned and resolver-protected. */ readonly codexSandboxNetworkAccess?: never; /** Attempt plugins cannot replace the host's durable process-job owner. */ readonly processJobs?: never; }; /** Provider-specific projection of the logical tool policy for this attempt. */ readonly policyOptions?: Readonly>; readonly cleanup?: () => void | Promise; } export type MonoRuntimeAttemptResolver = (context: MonoRuntimeAttemptContext) => MonoRuntimeAttemptResolution | undefined | Promise; export interface CreateMonoRuntimeOptions extends MonoRuntimeHostOptions { /** The sandbox implementation is owned and injected by runtime-adapter. */ readonly sandbox?: never; /** * Ordered model chain for provider failover. When present, runs are served by * the agent-runtime fallback router: the first entry is attempted first and * each retryable provider failure advances to the next entry, so callers * should put the primary model at index 0. The router overrides the per-run * `model`/`executionMode` with chain entries; failover details are reported * on the result as `failoverHistory`. */ readonly fallbackChain?: readonly MonoRuntimeFallbackChainEntry[]; /** Compatibility-preserving uniform safety, or explicit isolated provider-native route contracts. */ readonly routeSafety?: MonoRuntimeRouteSafetyMode; /** Backoff shape for same-model retries. Per-route counts live on each chain entry's `attempts`. */ readonly retry?: MonoRuntimeRetryPolicy; /** Private host seam for actual-model provider options and route-owned runtimes. */ readonly resolveAttempt?: MonoRuntimeAttemptResolver; } export declare function createMonoRuntime(options?: CreateMonoRuntimeOptions): MonoRuntimeLike; export { createPiOAuthApiKeyResolver }; export declare function assertParsedRuntimeModelReference(value: unknown): asserts value is RuntimeModelReference; /** * Resolves a backend id from the selection table by sdk (canonical or alias) and * execution mode. Returns undefined when no row matches, leaving the caller to * decide how to fail. */ export declare function selectMonoRuntimeBackendId(sdk: string, executionMode: RuntimeExecutionMode): MonoRuntimeBackendId | undefined; //# sourceMappingURL=runtime-adapter.d.ts.map