export interface ServiceStatus { installed: boolean; running: boolean; pid?: number; detail?: string; /** * True when the underlying OS query itself failed (our own timeout, the * scheduler binary missing, DBus/launchd unavailable) rather than * genuinely answering "not running" / "not installed". `installed` and * `running` are NOT authoritative when this is true — best-effort * defaults, never a manufactured "not installed". Callers MUST check * this before printing a confident state (ADR-015 rule 4: an * infrastructure failure must never collapse into a domain claim — a * timed-out query and a genuinely uninstalled service used to be the * same observable state here). */ inconclusive?: boolean; } /** * Discriminated union returned by ServiceAdapter.install(). * * - `task` — a scheduled task (schtasks) / systemd unit / launchd plist was * created. `service start/stop/status` will work normally. * - `startup` — OS-level task creation failed; a Startup-folder shortcut was * installed as fallback. `service start/stop` will NOT work. * `path` is the absolute path to the shortcut file. */ export type InstallResult = { kind: 'task'; } | { kind: 'startup'; path: string; }; export interface ServiceAdapter { readonly platform: 'linux' | 'darwin' | 'win32'; /** Write unit file / plist / task. Does NOT start or enable. */ install(execPath: string, port: number): Promise; /** Remove unit file / plist / task. */ uninstall(): Promise; /** Start the service via the OS init system. */ start(): Promise; /** Stop the service via the OS init system. */ stop(): Promise; /** Query current status. */ status(): Promise; /** * Install a nightly backup timer (optional — invoked by * `service install --with-backup-timer`). * * @param execPath Same exec path used for the main service. * @param keep Number of backups to retain (forwarded to --keep). */ installBackupTimer(execPath: string, keep: number): Promise; /** * Remove the nightly backup timer installed by installBackupTimer(). * No-op if the timer was never installed. */ uninstallBackupTimer(): Promise; }