import type { AgentConfig } from './config.js'; export declare const LOCAL_CONTROL_API_VERSION = 1; export declare const LOCAL_CONTROL_CAPABILITIES: readonly ["health.read", "status.read", "lifecycle.shutdown", "upgrade.worker-shutdown"]; export type LocalControlCapability = typeof LOCAL_CONTROL_CAPABILITIES[number]; export type ShutdownReason = 'upgrade' | 'worker-upgrade' | 'stop' | 'service'; export type ShutdownPhase = 'idle' | 'accepted' | 'shutting-down' | 'completed' | 'failed'; export interface ShutdownRequest { reason: ShutdownReason; requestId: string; expectedPid?: number; expectedProcessInstanceId?: string; jobId?: string; targetVersion?: string; lockNonce?: string; workerPid?: number; workerProcessStartIdentity?: string; } export interface ShutdownAccepted { requestId: string; reason: ShutdownReason; acceptedAt: string; phase: ShutdownPhase; } export interface ConnectionStatus { websocketConnected: boolean; relayReady: boolean; acceptingWork: boolean; sessionId: string | null; workDir: string; backend: string; backendReady?: boolean; entraReady?: boolean; sessionRestored?: boolean; conversations: number; } export interface LocalControlStatus { apiVersion: number; capabilities: readonly LocalControlCapability[]; pid: number; version: string; startedAt: string; uptimeSeconds: number; shutdown: { phase: ShutdownPhase; requestId?: string; reason?: ShutdownReason; }; connection: ConnectionStatus; config: { server: string; dir: string; name: string; agent: string; entra: boolean; autoStart: boolean | null; passwordConfigured: boolean; }; } export declare class LocalControlError extends Error { readonly status: number; readonly code: string; constructor(status: number, code: string, message: string); } export interface LocalControlService { health(): { status: 'ok'; apiVersion: number; capabilities: readonly LocalControlCapability[]; }; status(): LocalControlStatus; shutdown(request: ShutdownRequest): ShutdownAccepted; } export interface LocalControlServiceDeps { version: string; startedAt: string; config: AgentConfig; getConnectionStatus: () => ConnectionStatus; getShutdownStatus: () => LocalControlStatus['shutdown']; requestShutdown: (request: ShutdownRequest) => ShutdownAccepted; authorizeWorkerUpgradeShutdown?: (request: ShutdownRequest) => void; } export declare function createLocalControlService(deps: LocalControlServiceDeps): LocalControlService;