import type { MainLogger } from './logger.js'; export type SidecarWorkingDirectory = 'resources' | 'data' | 'cache' | 'temp'; export interface SidecarRestartPolicy { /** Restart only after an unexpected non-zero exit. Maximum 10. Default 0. */ maxRestarts: number; /** Delay before each restart. Range 0–60 seconds. Default 500 ms. */ delayMs?: number; } export interface SidecarSpawnOptions { /** Stable identifier, unique among live sidecars. */ name: string; /** Relative path to an executable bundled below `resourcesPath`. */ resource: string; /** Passed directly to the executable; Murasaki never invokes a shell. */ args?: string[]; /** A framework-owned working directory. Default `resources`. */ cwd?: SidecarWorkingDirectory; /** Additional environment variables. Inherits the Node Main environment. */ env?: Record; restart?: SidecarRestartPolicy; } export type SidecarEvent = { type: 'started'; name: string; pid: number; } | { type: 'stdout' | 'stderr'; name: string; data: string; } | { type: 'exit'; name: string; code: number | null; signal: NodeJS.Signals | null; restarting: boolean; } | { type: 'error'; name: string; message: string; }; export interface SidecarHandle { readonly name: string; readonly pid: number | null; readonly running: boolean; /** Settles after the final exit, including configured restarts. */ readonly finished: Promise<{ code: number | null; signal: NodeJS.Signals | null; }>; onEvent(listener: (event: SidecarEvent) => void): () => void; stop(timeoutMs?: number): Promise; } export interface SidecarSupervisor { spawn(options: SidecarSpawnOptions): Promise; list(): ReadonlyArray<{ name: string; pid: number | null; running: boolean; }>; stop(name: string, timeoutMs?: number): Promise; stopAll(timeoutMs?: number): Promise; } export interface SidecarSupervisorOptions { resourcesPath: string; paths: { data: string; cache: string; temp: string; }; signal: AbortSignal; log?: MainLogger; } /** * Supervise executables explicitly bundled below the application resources * directory. Node Main is trusted code, but containment and bounded lifecycle * rules prevent accidental shell execution, traversal, and orphaned helpers. */ export declare function createSidecarSupervisor(options: SidecarSupervisorOptions): Promise; //# sourceMappingURL=sidecar.d.ts.map