import type { BackgroundJobRecord, BackgroundJobRegistry } from "../jobs/index.js"; export type ProcessStewardshipClassification = "owned_alive" | "stale_owned" | "unknown_ownership" | "not_owned" | "identity_mismatch" | "terminal"; export interface ProcessStewardshipOwner { ownerKind: string; ownerId: string; } export interface ProcessStewardshipResult { jobId: string; classification: ProcessStewardshipClassification; record: BackgroundJobRecord; reason?: string; } export interface HostResourceSnapshot { capturedAtMs: number; host: string; platform: NodeJS.Platform; cpuCount: number; loadAverage: readonly [number, number, number]; totalMemoryBytes: number; freeMemoryBytes: number; availableMemoryBytes?: number; memoryPressureRatio?: number; processCount?: number; jensenOwnedProcessCount?: number; staleJensenOwnedProcessCount?: number; } export type HostPressureClassification = "NORMAL" | "ELEVATED" | "CRITICAL" | "LEAK_SUSPECTED" | "UNKNOWN"; export interface CleanupResult { action: "stopped" | "skipped"; reason: string; record?: BackgroundJobRecord; } /** * Reconcile only jobs belonging to the supplied authority. Missing ownership * metadata is deliberately unknown, not implicitly owned by the caller. */ export declare function reconcileOwnedProcesses(registry: BackgroundJobRegistry, owner: ProcessStewardshipOwner): Promise; /** * Cleanup seam for a future supervisor. It is intentionally narrow and * fail-closed: ownership must match exactly before the registry can stop a job. */ export declare function cleanupOwnedProcess(registry: BackgroundJobRegistry, jobId: string, owner: ProcessStewardshipOwner): Promise; export interface HostResourceSnapshotOptions { /** Linux proc fixture root; defaults to /proc. */ procRoot?: string; /** Platform override for deterministic fixture tests. */ platform?: NodeJS.Platform; /** Directory reader seam; no process or command execution is performed. */ readDirectory?: (path: string) => Promise; /** UTF-8 file reader seam for deterministic /proc/meminfo fixtures. */ readFile?: (path: string) => Promise; } /** Count numeric Linux /proc entries without invoking ps or another process. */ export declare function countLinuxProcesses(procRoot?: string, readDirectory?: (path: string) => Promise, platform?: NodeJS.Platform): Promise; /** Capture host-only resource facts; no process or command execution occurs. */ export declare function captureHostResourceSnapshot(now?: number, options?: HostResourceSnapshotOptions): Promise; /** * Classify only measured memory pressure. Missing telemetry is UNKNOWN; it is * never converted into permission to clean up processes. */ export declare function classifyHostPressure(snapshot: HostResourceSnapshot, thresholds?: { elevatedMemoryPressureRatio?: number; criticalMemoryPressureRatio?: number; leakCount?: number; }): HostPressureClassification; //# sourceMappingURL=process-stewardship.d.ts.map