/** * GraphPipelineLifecycle — singleton that owns the tokensave serve subprocess * for the duration of a single `agent-bober run` pipeline invocation. * * Module-level export guarantees one instance per Node process (ESM singleton). * Importers receive the same object regardless of how many times they import. * * Responsibilities: * - Read bober.config.json graph section. * - Run prereq check before spawning. * - Orphan cleanup via PID file (`.bober/graph/.serve.pid`). * - SIGTERM/SIGINT handlers for graceful shutdown. * - Idempotent start() and stop(). */ import type { BoberConfig } from "../config/schema.js"; import { type EngineHealth } from "./mcp-client.js"; import { GraphClient } from "./client.js"; import { GraphFallback } from "./fallback.js"; declare class GraphPipelineLifecycleImpl { private started; private stopping; private healthOverride; private mcpClient; private store; private incidents; private hookHandler; private projectRoot; private pidPath; private sigHandler; /** * Start the lifecycle. * * - When graph.enabled is false (or graph section is absent): no-op; health = 'disabled'. * - Otherwise: prereq check → orphan cleanup → spawn serve → write PID file → register signals. * - Idempotent: calling start() twice is safe (second call is a no-op). */ start(projectRoot: string, config: BoberConfig): Promise; /** * Gracefully stop the lifecycle. * SIGTERM → wait 2000ms (inside mcpClient.stop()) → SIGKILL fallback. * Idempotent. */ stop(): Promise; engineHealth(): string; /** * Project root of the active pipeline, or null when not started. * * Used by PreflightContextInjector to resolve a telemetry sink when the * injector was constructed without an explicit projectRoot (the common case * at most agent call sites). Lets graph-preflight telemetry fire for every * role with zero changes to the call sites. */ projectRootOrNull(): string | null; /** * Lazy accessor for the GraphClient instance. * Returns null if the engine is not 'ready'. * Caches the constructed client on first call. */ private _graphClient; getGraphClient(): GraphClient | null; /** * Returns {client, fallback} when engine is 'ready', null otherwise. * Used by resolveRoleTools to construct gated tool sets. */ getGraphDeps(): { client: GraphClient; fallback: GraphFallback; } | null; /** * Reset internal state so tests can call start() again on the same instance. * NOT intended for production use. */ _reset(): void; private handleOrphan; private writePidFile; private removePidFile; private registerSignalHandlers; private unregisterSignalHandlers; } /** * The one and only GraphPipelineLifecycle instance per Node process. * * ESM module caching guarantees this is the same object for all importers * in the same realm — even if imported from multiple modules simultaneously. * * Usage: * import { graphPipelineLifecycle } from './pipeline-lifecycle.js'; * await graphPipelineLifecycle.start(projectRoot, config); * // ... pipeline runs ... * await graphPipelineLifecycle.stop(); */ export declare const graphPipelineLifecycle: GraphPipelineLifecycleImpl; export { GraphPipelineLifecycleImpl }; export type { EngineHealth }; //# sourceMappingURL=pipeline-lifecycle.d.ts.map