import type { Settings } from "../../config/settings"; import { type NotificationSettingsReader } from "./config"; import { type NotificationDebrisSweepReport } from "./notification-service"; import { type DaemonState, type TelegramDaemonOptions } from "./telegram-daemon"; type TelegramDaemonRunner = { run(): Promise; requestStop(reason?: "reload" | "signal" | "stop"): void; }; type TelegramDaemonConstructor = new (opts: TelegramDaemonOptions) => TelegramDaemonRunner; export type LightweightDaemonSettings = Pick & NotificationSettingsReader; export interface RunDaemonInternalDeps { SettingsImpl?: { init: (options?: { agentDir?: string; }) => Promise; }; DaemonImpl?: TelegramDaemonConstructor; processPid?: number; pidAlive?: (pid: number) => boolean; pidIncarnation?: (pid: number) => string | undefined; /** Clock used by the ownership-progress watchdog; defaults to `Date.now`. */ now?: () => number; /** Timer pair backing the ownership-progress watchdog; defaults to globals. */ setInterval?: (callback: () => void, ms: number) => Timer; clearInterval?: (timer: Timer) => void; /** Reads persisted daemon ownership state; defaults to the real reader. */ readDaemonState?: (settings: Settings) => Promise; /** Loads the verified machine-local identity; injectable so daemon tests do not touch the host. */ loadInstallationHostId?: () => Promise; /** Loads the previous machine-local identity used only for stale lock migration. */ loadLegacyInstallationHostId?: () => Promise; /** * Startup hygiene sweep over the notifications dir; injectable so tests can * prove it is fired, is never awaited by startup, and that a rejection is * logged instead of failing the daemon. */ sweepNotificationDebris?: (input: { dir: string; }) => Promise; } export declare function createLightweightDaemonSettings(input: { agentDir: string; rawConfig?: unknown; }): LightweightDaemonSettings; export declare function loadLightweightDaemonSettings(agentDir: string): Promise; export declare function ownerPidFromOwnerId(ownerId: string): number | undefined; /** Creates owner-fenced daemon control hooks for the CLI lifecycle boundary. */ export declare function createDaemonControlHooks(settings: Settings): { shouldStop: (owner: string) => Promise; clear: (owner: string) => Promise; }; export declare function runDaemonSmoke(opts?: { agentDir?: string; }): Promise; export declare function runDaemonInternal(argv: string[], deps?: RunDaemonInternalDeps): Promise; export {};