import { type AiClientModelReference } from '@undefineds.co/ai-connections/client-config'; import type { AuthContext } from '../auth/AuthContext'; export type AiClientId = 'codex' | 'claude-code' | 'pi' | 'codebuddy'; export interface AiClientConfigurationCapabilityDescriptor { available: boolean; authority?: 'local-filesystem'; manualInstructions: string; } export interface AiClientConfigurationStatus { status: 'notConfigured' | 'configured' | 'drifted' | 'unavailable' | 'unverifiable' | 'failedAndRestored'; message?: string; installed?: boolean; configExists?: boolean; appliedKeyFingerprint?: string; } export interface AiClientConfigurationPlan { planId: string; client: AiClientId; changes: AiClientConfigurationChange[]; conflicts: string[]; backupLocation: string; replacementConfirmationRequired: boolean; confirmation?: { required: boolean; token: string; targetHash: string; message?: string; }; } export interface AiClientConfigurationChange { target: string; action: 'update' | 'createOrUpdate' | 'delete'; backup: boolean; current?: string; replacement?: string; } export interface AiClientConfigurationServiceOptions { homeDir?: string; backupRoot?: string; now?: () => Date; verifyGateway?: (input: { endpoint: string; gatewayKey: string; model?: string; signal: AbortSignal; }) => Promise; fetch?: typeof fetch; verificationTimeoutMs?: number; launchClient?: (client: AiClientId) => Promise; } export interface PlanInput { client: AiClientId; endpoint: string; model?: string; activeModels?: readonly AiClientModelReference[]; webId?: string; auth?: AuthContext; } export interface ApplyInput { client: AiClientId; planId: string; gatewayKey: string; webId?: string; auth?: AuthContext; confirmation?: { token: string; targetHash: string; }; } export interface VerifyInput { client: AiClientId; planId?: string; webId?: string; auth?: AuthContext; } export declare class AiClientConfigurationError extends Error { readonly statusCode: number; readonly code: string; readonly details?: unknown; constructor(code: string, message: string, statusCode: number, details?: unknown); } export declare class AiClientConfigurationService { private readonly homeDir; private readonly backupRoot; private readonly now; private readonly verifyGateway; private readonly launchClient; private readonly plans; private readonly locks; constructor(options?: AiClientConfigurationServiceOptions); capability(): AiClientConfigurationCapabilityDescriptor; inspect(client: AiClientId, webId?: string): Promise; launch(client: AiClientId): Promise<{ launched: true; }>; plan(input: PlanInput): Promise; apply(input: ApplyInput): Promise<{ applied: true; }>; verify(input: VerifyInput): Promise; restore(client: AiClientId, webId?: string): Promise; private adapterFor; private publicTargets; private detectLockTargets; private requirePlan; private latestPlanFor; private withTargetLocks; } export declare function redactSecretText(input: string): string; export declare function unavailableAiClientConfigurationCapability(): AiClientConfigurationCapabilityDescriptor;