ZodObject<{ version: ZodNumber; pid: ZodNumber; port: ZodNumber; started: ZodString; app_version: ZodString; }, $strict> Daemon info schema for ~/.{name}/run/daemon.json.
Daemon lifecycle management.
Provides daemon info schema, PID file management, and process lifecycle operations. Separates lifecycle from presentation — stop_daemon returns a result object instead of logging directly.
7 declarations
ZodObject<{ version: ZodNumber; pid: ZodNumber; port: ZodNumber; started: ZodString; app_version: ZodString; }, $strict> Daemon info schema for ~/.{name}/run/daemon.json.
(runtime: Pick<EnvDeps, "env_get">, name: string): string | null Get the daemon info file path (~/.{name}/run/daemon.json).
runtimeruntime with env_get capability
Pick<EnvDeps, "env_get">nameapplication name
stringstring | null path to daemon.json, or null if $HOME is not set
(runtime: CommandDeps, pid: number): Promise<boolean> Check if a process is running by PID.
runtimeruntime with command execution capability
pidprocess ID to check
numberPromise<boolean> true if the process is running
(runtime: Pick<EnvDeps, "env_get"> & FsReadDeps & LogDeps, name: string): Promise<{ version: number; pid: number; port: number; started: string; app_version: string; } | null> Read and validate daemon info from the PID file.
runtimeruntime with file read and env capabilities
Pick<EnvDeps, "env_get"> & FsReadDeps & LogDepsnameapplication name
stringPromise<{ version: number; pid: number; port: number; started: string; app_version: string; } | null> parsed daemon info, or null if missing or invalid
(runtime: Pick<EnvDeps, "env_get"> & FsReadDeps & FsRemoveDeps & CommandDeps & LogDeps, name: string): Promise<...> Stop a running daemon by sending SIGTERM and cleaning up the PID file.
Returns a result object instead of logging directly, separating lifecycle from presentation.
runtimeruntime with command, file, and env capabilities
Pick<EnvDeps, "env_get"> & FsReadDeps & FsRemoveDeps & CommandDeps & LogDepsnameapplication name
stringPromise<StopDaemonResult> result describing the outcome
StopDaemonResult Result of a stop_daemon operation.
stoppedWhether a daemon was stopped.
booleanpidPID of the stopped daemon, if any.
numbermessageHuman-readable message describing the outcome.
string(runtime: Pick<EnvDeps, "env_get"> & FsWriteDeps, name: string, info: { version: number; pid: number; port: number; started: string; app_version: string; }): Promise<...> Write daemon info to the PID file, creating directories as needed.
runtimeruntime with file write and env capabilities
Pick<EnvDeps, "env_get"> & FsWriteDepsnameapplication name
stringinfodaemon info to write
{ version: number; pid: number; port: number; started: string; app_version: string; }Promise<void>