import type { CliEnvironment } from "./environment.js";
import type { CommandContext } from "./context.js";
import type { ScopedLogger } from "./logger.js";
import type { FileSystem } from "../utils/file-system.js";
import type { CommandCheck } from "../utils/command-checks.js";
import type { HttpClient } from "./http.js";
import type { PromptLibrary, ModelPromptInput, ReasoningPromptInput } from "./prompts.js";
import type { MutationObservers } from "../../packages/config-mutations/dist/index.js";
import type { PromptFn } from "./types.js";
import type { ActiveProvider } from "./commands/shared.js";
import type { HookBridgeOptions } from "../../packages/agent-spawn/dist/index.js";
export interface ServiceManifestPathMapper {
    mapTargetDirectory: (input: {
        targetDirectory: string;
        env: CliEnvironment;
    }) => string;
}
export interface ServiceRunOptions {
    observers?: MutationObservers;
}
export interface ProviderColorSet {
    light?: string;
    dark?: string;
}
export interface ProviderBranding {
    colors?: ProviderColorSet;
}
export interface ProviderConfigurePrompts {
    model?: ModelPromptInput;
    reasoningEffort?: ReasoningPromptInput;
}
export interface ProviderContext {
    env: CliEnvironment;
    command: CommandContext;
    logger: ScopedLogger;
    model?: string;
    hooks?: HookBridgeOptions;
    activeProvider?: ActiveProvider;
    runCheck(check: CommandCheck): Promise<void>;
}
export interface ServiceExecutionContext<Options> {
    fs: FileSystem;
    env: CliEnvironment;
    command: CommandContext;
    options: Options;
    pathMapper?: ServiceManifestPathMapper;
}
export interface ProviderConfigurePayloadContext {
    fs: FileSystem;
    env: CliEnvironment;
    httpClient: HttpClient;
    logger: ScopedLogger;
    payload: Record<string, unknown>;
    prompts: PromptFn;
    promptLibrary: PromptLibrary;
    assumeYes: boolean;
    commandOptions: Record<string, unknown>;
}
export interface ProviderService<TConfigure = any, TUnconfigure = TConfigure, TSpawn = any> {
    id: string;
    summary: string;
    aliases?: string[];
    configure(context: ServiceExecutionContext<TConfigure>, runOptions?: ServiceRunOptions): Promise<void>;
    unconfigure(context: ServiceExecutionContext<TUnconfigure>, runOptions?: ServiceRunOptions): Promise<boolean>;
    name: string;
    label: string;
    configurationLabel?: string;
    branding?: ProviderBranding;
    disabled?: boolean;
    supportsStdinPrompt?: boolean;
    supportsMcpSpawn?: boolean;
    requiresProvider?: boolean;
    configurePrompts?: ProviderConfigurePrompts;
    postConfigureMessages?: string[];
    extendConfigurePayload?(context: ProviderConfigurePayloadContext): Promise<Record<string, unknown> | void> | Record<string, unknown> | void;
    runtimeEnv?: Record<string, IsolatedEnvValue>;
    isolatedEnv?: ProviderIsolatedEnv;
    install?(context: ProviderContext): Promise<void> | void;
    spawn?(context: ProviderContext, options: TSpawn): Promise<unknown>;
    test?(context: ProviderContext): Promise<void>;
}
export interface ProviderIsolatedEnv {
    agentBinary: string;
    configProbe?: IsolatedEnvPath;
    env: Record<string, IsolatedEnvValue>;
    repairs?: IsolatedEnvRepair[];
    requiresConfig?: boolean;
    /** CLI settings to inject via --settings flag (for agents that support it) */
    cliSettings?: IsolatedCliSettings;
}
export interface IsolatedCliSettings {
    /** Static settings values */
    values: Record<string, unknown>;
    /** Top-level settings that need runtime resolution */
    resolved?: Record<string, IsolatedEnvProviderCredential | IsolatedEnvProviderBaseUrl | IsolatedEnvAgentBaseUrl>;
    /** Environment variables to inject into settings.env (resolved at runtime) */
    env?: Record<string, string | IsolatedEnvProviderCredential | IsolatedEnvProviderBaseUrl | IsolatedEnvAgentBaseUrl>;
}
export type IsolatedEnvRepair = {
    kind: "chmod";
    relativePath: string;
    mode: number;
};
export type IsolatedEnvPath = {
    kind: "isolatedDir";
    relativePath?: string;
} | {
    kind: "isolatedFile";
    relativePath: string;
};
export type IsolatedEnvValue = string | IsolatedEnvPath | IsolatedEnvVariable | IsolatedEnvProviderCredential | IsolatedEnvProviderBaseUrl | IsolatedEnvAgentBaseUrl;
export type IsolatedEnvVariable = {
    kind: "envVar";
    name: string;
};
export type IsolatedEnvProviderCredential = {
    kind: "providerCredential";
    prefix?: string;
};
export type IsolatedEnvProviderBaseUrl = {
    kind: "providerBaseUrl";
};
export type IsolatedEnvAgentBaseUrl = {
    kind: "agentBaseUrl";
};
export type ProviderOperation = "install" | "configure" | "unconfigure" | "spawn" | "test";
export interface ServiceRegistry {
    register(adapter: ProviderService): void;
    discover(adapters: ProviderService[]): void;
    get(name: string): ProviderService | undefined;
    require(name: string): ProviderService;
    list(): ProviderService[];
    invoke<T>(serviceName: string, operation: ProviderOperation, runner: (adapter: ProviderService) => Promise<T>): Promise<T>;
}
export declare function createServiceRegistry(): ServiceRegistry;
