/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { Config, ProviderManager, SettingsService, type RuntimeAuthScopeFlushResult } from '@vybestack/llxprt-code-core';
import { OAuthManager } from '../auth/oauth-manager.js';
/**
 * @plan PLAN-20251018-STATELESSPROVIDER2.P15
 * @requirement REQ-SP2-003
 * @pseudocode cli-runtime-isolation.md lines 1-3
 * Async runtime scope ensures each CLI runtime preserves its identity across async boundaries.
 */
export interface RuntimeScopeValue {
    runtimeId: string;
    metadata: Record<string, unknown>;
}
export declare function enterRuntimeScope(scope: RuntimeScopeValue): void;
export declare function runWithRuntimeScope<T>(scope: RuntimeScopeValue, callback: () => T): T;
export declare function getCurrentRuntimeScope(): RuntimeScopeValue | undefined;
interface RuntimeActivationBindings {
    resetInfrastructure: () => void | Promise<void>;
    setRuntimeContext: (settingsService: SettingsService, config: Config, options: {
        metadata?: Record<string, unknown>;
        runtimeId: string;
    }) => void | Promise<void>;
    registerInfrastructure: (manager: ProviderManager, oauthManager: OAuthManager) => void | Promise<void>;
    linkProviderManager: (config: Config, manager: ProviderManager) => void | Promise<void>;
    disposeRuntime?: (runtimeId: string, context?: RuntimeAuthScopeFlushResult) => void | Promise<void>;
}
/**
 * @plan:PLAN-20251018-STATELESSPROVIDER2.P03
 * @requirement:REQ-SP2-002
 * @pseudocode multi-runtime-baseline.md lines 7-7
 * Runtime activation overrides that allow callers to adjust metadata and runtimeId per Step 6.
 */
export interface IsolatedRuntimeActivationOptions {
    metadata?: Record<string, unknown>;
    runtimeId?: string;
}
/**
 * @plan:PLAN-20251018-STATELESSPROVIDER2.P03
 * @requirement:REQ-SP2-002
 * @pseudocode multi-runtime-baseline.md lines 3-4
 * Options for constructing an isolated CLI runtime with dedicated SettingsService/Config instances.
 */
export interface IsolatedRuntimeContextOptions {
    runtimeId?: string;
    metadata?: Record<string, unknown>;
    settingsService?: SettingsService;
    config?: Config;
    model?: string;
    debugMode?: boolean;
    workspaceDir?: string;
    oauthManager?: OAuthManager;
    prepare?: (context: {
        config: Config;
        settingsService: SettingsService;
        providerManager: ProviderManager;
        oauthManager: OAuthManager;
        runtimeId: string;
        metadata: Record<string, unknown>;
    }) => void | Promise<void>;
    onCleanup?: (context: {
        config: Config;
        settingsService: SettingsService;
        providerManager: ProviderManager;
        runtimeId: string;
        metadata: Record<string, unknown>;
    }) => void | Promise<void>;
}
/**
 * @plan:PLAN-20251018-STATELESSPROVIDER2.P03
 * @requirement:REQ-SP2-002
 * @pseudocode multi-runtime-baseline.md lines 7-8
 * Handle returned by the factory that exposes activation and cleanup hooks per Steps 6-7.
 */
export interface IsolatedRuntimeContextHandle {
    runtimeId: string;
    metadata: Record<string, unknown>;
    settingsService: SettingsService;
    config: Config;
    providerManager: ProviderManager;
    oauthManager: OAuthManager;
    activate: (options?: IsolatedRuntimeActivationOptions) => Promise<void> | void;
    cleanup: () => Promise<void> | void;
}
/**
 * @plan:PLAN-20251018-STATELESSPROVIDER2.P03
 * @requirement:REQ-SP2-002
 * @pseudocode multi-runtime-baseline.md lines 6-6
 * Cache CLI activation bindings (reset/context/infrastructure/link) for deterministic invocation.
 */
export declare function registerIsolatedRuntimeBindings(bindings: RuntimeActivationBindings): void;
/**
 * @plan:PLAN-20251018-STATELESSPROVIDER2.P03
 * @requirement:REQ-SP2-002
 * @pseudocode multi-runtime-baseline.md lines 2-5
 * Construct an isolated runtime using shared immutable resources and scoped services.
 */
export declare function createIsolatedRuntimeContext(options?: IsolatedRuntimeContextOptions): IsolatedRuntimeContextHandle;
export {};
