import { BashJobRegistry, type BashJob } from "../sdk/coding-agent/core/bash-jobs.js"; import { type OutputAccumulator as OutputAccumulatorType } from "../sdk/coding-agent/core/tools/output-accumulator.js"; import type { DevProcessSummary, ServerEvent } from "./wire.js"; export type { DevProcessStatus, DevProcessSummary } from "./wire.js"; /** * Events emitted by the machine-level dev-process registry. Kept as a subset * of `ServerEvent` so the session-stream manager can fan them out unchanged. */ export type DevProcessRegistryEvent = Extract; /** * Stable definition for a machine-level dev process. Definitions are persisted * in SQLite (`dev_process_definitions`) so a command only has to pass the * startup allow-list once. */ export interface DevProcessDefinitionInput { definitionId?: string; label?: string; command: string; cwd: string; } /** * Machine-level registry for background bash jobs that should be visible in * the landing "Dev servers" settings section. * * Extends the session-scoped `BashJobRegistry` so the existing bash tool * factories accept it unchanged, while adding the list/summary surface and * durable pidfile tracking under `/dev-processes/`. */ export declare class DevProcessRegistry extends BashJobRegistry { private readonly records; private readonly pidDir; private readonly listeners; private portRefresh; constructor(agentDir: string); /** * Subscribe to registry events. Returns an unsubscribe function. * Listeners are invoked synchronously and are expected to be cheap; * a throwing listener is logged and isolated so it cannot break process * tracking. */ onEvent(listener: (event: DevProcessRegistryEvent) => void): () => void; create(input: { id?: string; pid?: number; command: string; cwd: string; output: OutputAccumulatorType; fullOutputPath: string; kill: () => void; definitionId?: string; label?: string; }): BashJob; markExited(id: string, exitCode: number | null): void; markKilled(id: string): void; /** List all tracked processes, newest first. */ list(): DevProcessSummary[]; /** * Spawn a persistent dev process. Unlike the agent's normal background bash * path, this process is NOT force-killed after the 30-minute hard deadline * (`waitForChildProcess(_, 0)`). It remains killable through the registry. */ spawnDaemon(definition: DevProcessDefinitionInput): DevProcessSummary; /** * Re-scan listening TCP ports and update any live record whose port set * changed. Called automatically after a new daemon binds and at the end of * pidfile reconciliation; `GET /api/dev-processes` also refreshes eagerly. */ refreshPorts(): Promise; private schedulePortRefresh; /** * Kill an existing dev process and start a fresh one from its saved * definition. Returns null when the process id is unknown. */ restart(id: string): DevProcessSummary | null; /** * Rehydrate processes from durable pidfiles after a CLI restart. * * A live PID becomes a killable `recovered` record whose output is no * longer attached; a dead PID has its stale pidfile removed. */ reconcile(): void; private toSummary; private emitOutput; private emit; private pidfilePath; private writePidfile; private readPidfile; private removePidfile; private isPidAlive; } //# sourceMappingURL=dev-process-registry.d.ts.map