import { type LaunchHistoryEntry, type LaunchHistorySample, type LaunchMetricSample } from "./launch-metrics.js"; import { type RingBufferSlice } from "./ring-buffer.js"; export type LaunchRunState = "running" | "exited" | "stopped"; export interface LaunchLogEntry { stream: "stdout" | "stderr"; text: string; } export interface LaunchRun { configId: string; pid: number; state: LaunchRunState; startedAt: string; exitedAt?: string; exitCode?: number | null; command: string; cwd: string; startedBy?: string; stoppedBy?: string; } export interface LaunchStartRequest { configId: string; command: string; cwd?: string; env?: Record; jdkPath?: string; workspacePath?: string; readinessPattern?: string; startedBy?: string; } export interface LaunchRunSummary extends LaunchRun { logTail: LaunchLogEntry[]; nextLogIndex: number; ports: number[]; metrics?: LaunchMetricSample; } export interface LaunchLogsResult { configId: string; state: LaunchRunState; entries: RingBufferSlice; nextIndex: number; oldestIndex: number; } export interface LaunchStartupWaitResult { outcome: "ready" | "exited" | "stopped" | "timeout"; waitedMs: number; matchedLine?: string; ports?: number[]; exitCode?: number | null; logTail: LaunchLogEntry[]; } export declare class LaunchAlreadyRunningError extends Error { readonly existing: LaunchRun; constructor(existing: LaunchRun); } export interface LaunchBatchItemResult { configId: string; ok: boolean; skipped?: boolean; message?: string; run?: LaunchRun; error?: string; wait?: LaunchStartupWaitResult; } export interface LaunchBatchResult { items: LaunchBatchItemResult[]; summary: { total: number; started: number; skipped: number; failed: number; ready: number; exited: number; stopped: number; timeout: number; }; } export declare function resolvePlaceholders(command: string, ctx: { workspacePath?: string; jdkPath?: string; env?: Record; }): string; export declare class StreamDecoder { private readonly utf8Probe; private readonly utf8; private readonly gbk; private readonly onFlush; private mode; private buffered; private bufferedSize; private flushTimer; constructor(onFlush?: (text: string) => void); decode(chunk: Buffer): string; finalize(): string; private commit; } export declare class LaunchManager { private static instance; private readonly runs; private readonly logs; private readonly startupWaiters; private readonly readinessMatchers; private readonly logListeners; private readonly metricsMonitor; private restored; private constructor(); static getInstance(): LaunchManager; private runningRefs; start(req: LaunchStartRequest): Promise; stop(configId: string, reason?: "manual" | "shutdown", actor?: string): Promise<{ success: boolean; message: string; pid?: number; }>; restart(req: LaunchStartRequest): Promise; startBatch(items: LaunchStartRequest[], waitTimeoutMs: number): Promise; stopAll(): Promise<{ running: number; stopped: number; }>; waitStartupResult(configId: string, timeoutMs: number): Promise; private scanReadinessMatch; private resolveStartupWaiters; listRuns(): Promise; getLogs(configId: string, sinceIndex: number): Promise; getRun(configId: string): LaunchRun | undefined; getMetrics(configId: string, limit?: number): LaunchHistorySample[]; getMetricsSince(configId: string, sinceIndex: number, limit?: number): LaunchHistoryEntry[]; private ensureRestored; private publishRunStatus; private persist; } export declare function getLaunchManager(): LaunchManager;