import type { LauncherFileSystem, ProcessSpec, ProcessState } from "./types.js"; export interface ManagedProcessRecord { spec: ProcessSpec | null; state: ProcessState | null; daemonPid: number | null; } export interface StartManagedProcessOptions { baseDir: string; spec: ProcessSpec; fs?: LauncherFileSystem; pollIntervalMs?: number; startupTimeoutMs?: number; spawnDaemon: (id: string) => Promise; isPidRunning?: (pid: number) => boolean; signalProcess?: (pid: number, signal: NodeJS.Signals) => void; } export interface StopManagedProcessOptions { baseDir: string; id: string; fs?: LauncherFileSystem; force?: boolean; pollIntervalMs?: number; stopTimeoutMs?: number; isPidRunning?: (pid: number) => boolean; signalProcess?: (pid: number, signal: NodeJS.Signals) => void; stopRuntimeArtifacts?: (input: { record: ManagedProcessRecord; force: boolean; }) => Promise; } export interface RestartManagedProcessOptions extends Omit { startupTimeoutMs?: number; spawnDaemon: (id: string) => Promise; } export interface ListManagedProcessesOptions { baseDir: string; fs?: LauncherFileSystem; isPidRunning?: (pid: number) => boolean; } export interface ReadManagedLogsOptions { baseDir: string; id: string; fs?: LauncherFileSystem; lines?: number; stream?: "stdout" | "stderr"; } export interface FollowManagedLogsOptions extends ReadManagedLogsOptions { pollIntervalMs?: number; signal?: AbortSignal; } export interface RemoveManagedProcessOptions { baseDir: string; id: string; fs?: LauncherFileSystem; isPidRunning?: (pid: number) => boolean; removeRuntimeArtifacts?: (input: { record: ManagedProcessRecord; }) => Promise; } export interface RunManagedProcessOptions { baseDir: string; id: string; fs?: LauncherFileSystem; pollIntervalMs?: number; signal?: AbortSignal; } export declare function startManagedProcess(options: StartManagedProcessOptions): Promise; export declare function stopManagedProcess(options: StopManagedProcessOptions): Promise; export declare function restartManagedProcess(options: RestartManagedProcessOptions): Promise; export declare function listManagedProcesses(options: ListManagedProcessesOptions): Promise; export declare function readManagedLogs(options: ReadManagedLogsOptions): Promise; export declare function followManagedLogs(options: FollowManagedLogsOptions): AsyncIterable; export declare function removeManagedProcess(options: RemoveManagedProcessOptions): Promise; export declare function runManagedProcess(options: RunManagedProcessOptions): Promise;