import * as childProcess from "node:child_process"; import type { DaemonRuntimeConfig } from "./config.js"; import { type RuntimeOwnershipSnapshot } from "./runtime-ownership.js"; import type { Store } from "./types.js"; import { type LocalSurrealSnapshot } from "./surreal-local.js"; import { type LocalMemoryPlaneState } from "./surreal-memory-plane.js"; import { type LocalAiSnapshot } from "./local-ai/model-manager.js"; import type { DoctorExplanationOutput } from "./local-ai/schemas.js"; export type LifecyclePlatform = "darwin" | "linux" | "win32" | "unknown"; export type RuntimeClassification = "healthy" | "starting" | "unhealthy" | "stale-pid" | "port-conflict-foreign" | "port-conflict-owned" | "service-configured-not-loaded" | "service-installed-not-running" | "runtime-missing"; export type PortOwnerClassification = "none" | "owned" | "foreign"; export type ServiceInstallState = "installed" | "missing" | "drifted"; export type ServiceLoadState = "loaded" | "not-loaded" | "unknown"; export type RepairStatus = "applied" | "skipped" | "failed"; export type ServiceAction = "install" | "restart" | "remove" | "unload"; export interface DaemonProcessSnapshot { pidPath: string; pid: number | null; alive: boolean; stalePidFile: boolean; } export interface DaemonHealthSnapshot { url: string; reachable: boolean; status: number | null; body: unknown | null; error: string | null; } export interface ServiceManifest { platform: LifecyclePlatform; version: string; hash: string; label: string; manifestPath: string; contents: string; installCommand: string; restartCommand: string; removeCommand: string; notes: string[]; } export interface LifecycleStoreSnapshot { diskUsageKb: number; wal: { total: number; pending: number; synced: number; failed: number; }; syncQueue: { pending: number; retrying: number; dead: number; }; eviction: Record; } export interface PortOwnerSnapshot { port: number; pid: number | null; classification: PortOwnerClassification; } export interface ServiceStateSnapshot { manifestPath: string; installed: boolean; state: ServiceInstallState; loadState: ServiceLoadState; loaded: boolean | null; pid: number | null; loadError: string | null; hash: string; installedHash: string | null; nativeSupported: boolean; } export interface RepairAction { action: string; status: RepairStatus; detail: string; } export interface DaemonLifecycleReport { service: ServiceManifest; serviceState: ServiceStateSnapshot; process: DaemonProcessSnapshot; ownership: RuntimeOwnershipSnapshot; surreal: LocalSurrealSnapshot; memoryPlane: LocalMemoryPlaneState | null; localAi: LocalAiSnapshot; portOwner: PortOwnerSnapshot; runtimeState: RuntimeClassification; health: DaemonHealthSnapshot; logFilePath: string; store: LifecycleStoreSnapshot; doctorExplanation: DoctorExplanationOutput | null; repairs: RepairAction[]; recommendations: string[]; nextAction: string; } export interface ServiceCommandResult { ok: boolean; action: ServiceAction; command: string | null; output: string; error: string | null; skipped: boolean; } export type CommandRunner = (command: string, options: childProcess.ExecSyncOptionsWithStringEncoding) => string; export declare function buildServiceManifest(config: DaemonRuntimeConfig, entrypointPath: string, platform?: NodeJS.Platform): ServiceManifest; export declare function writeServiceManifest(manifest: ServiceManifest): void; export declare function removeServiceManifest(manifest: ServiceManifest): boolean; export declare function executeServiceAction(manifest: ServiceManifest, action: ServiceAction, runner?: CommandRunner): ServiceCommandResult; export declare function setLifecycleCommandRunner(runner: CommandRunner | null): void; export declare function probeDaemonProcess(pidPath: string): DaemonProcessSnapshot; export declare function findPidByPort(port: number): number | null; export declare function probeDaemonHealth(config: DaemonRuntimeConfig, fetchImpl?: typeof fetch, timeoutMs?: number): Promise; export declare function buildServiceState(manifest: ServiceManifest): ServiceStateSnapshot; export declare function buildLifecycleReport(options: { config: DaemonRuntimeConfig; entrypointPath: string; store?: Store; fetchImpl?: typeof fetch; platform?: NodeJS.Platform; repairs?: RepairAction[]; }): Promise; export declare function formatLifecycleReport(report: DaemonLifecycleReport): string; export declare function formatRuntimeUnavailableMessage(report: Pick): string; //# sourceMappingURL=lifecycle.d.ts.map