/** User-configurable update policy for a compatible CLI runtime. */ export type CliRuntimeUpdateConfig = { provider: 'auto'; } | { provider: 'self'; } | { provider: 'none'; } | { provider: 'npm'; packageName: string; }; /** * A concrete distribution that implements the behavioral contract selected by * `cliId`. For example, VendorCodex can use the `codex` adapter without becoming * a new adapter id of its own. */ export interface CliRuntimeConfig { id: string; displayName?: string; executable: string; update?: CliRuntimeUpdateConfig; } export type CliRuntimeSource = 'official' | 'legacy-path' | 'configured'; /** `internal` is reserved for botmux's built-in official Codex update source. */ export type ResolvedCliRuntimeUpdateConfig = CliRuntimeUpdateConfig | { provider: 'internal'; }; /** Fully resolved, serializable runtime state suitable for freezing on a session. */ export interface CliRuntimeSnapshot { id: string; displayName: string; executable: string; source: CliRuntimeSource; update: ResolvedCliRuntimeUpdateConfig; } export interface ResolveCliRuntimeInput { cliId: string; cliRuntime?: unknown; cliPathOverride?: string; /** Error-path prefix used when validating a structured runtime. */ context?: string; } export interface CliRuntimeIdentityInput { cliId?: string | null; cliRuntime?: Pick | Pick | null; /** Legacy sessions may only have the frozen path and need an identity backfill. */ cliPathOverride?: string | null; wrapperCli?: string | null; } export interface CliRuntimeInstallationInput { cliId?: string | null; cliRuntime?: Pick | Pick | null; cliPathOverride?: string | null; } /** Shared allow-list for npm registry lookup and copyable install commands. */ export declare function isValidNpmPackageName(value: string): boolean; /** Browser-safe basename extraction that also recognizes Windows paths. */ export declare function executableBasename(executable: string): string; /** Strictly validate the user-facing `cliRuntime` object. */ export declare function normalizeCliRuntimeConfig(raw: unknown, context: string): CliRuntimeConfig; /** * Resolve the effective runtime for a bot/session. * * - Plain Codex gets the built-in official runtime. * - A legacy `cliPathOverride` becomes a stable basename-based snapshot. * - Structured runtimes are currently supported only by the Codex adapter. * - Other plain adapters need no runtime snapshot yet. */ export declare function resolveCliRuntime(input: ResolveCliRuntimeInput): CliRuntimeSnapshot | undefined; /** Return the adapter path override implied by a resolved runtime. */ export declare function runtimePathOverride(runtime: CliRuntimeSnapshot | null | undefined): string | undefined; /** Make a detached serializable copy before persisting runtime state on a session. */ export declare function snapshotCliRuntime(runtime: CliRuntimeSnapshot | null | undefined): CliRuntimeSnapshot | undefined; /** Stable identity key: adapter id + runtime source/id + wrapper. */ export declare function runtimeIdentityKey(input: CliRuntimeIdentityInput): string; export declare function sameRuntimeIdentity(left: CliRuntimeIdentityInput, right: CliRuntimeIdentityInput): boolean; /** Version/probe cache key for one concrete installation. Session identity is * intentionally id-based, but two hosts/paths using the same distribution id * may run different versions and must not overwrite each other's cache entry. */ export declare function runtimeInstallationKey(input: CliRuntimeInstallationInput): string; //# sourceMappingURL=runtime.d.ts.map