UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

54 lines • 3.04 kB
import { type HostDaemonDirectory, type HostDaemonPaths } from "./host-daemon-paths.ts"; /** One generation that is still running, as the daemon directory and the OS describe it. */ export interface HostGenerationRow { readonly instanceId: string; readonly generation: number; readonly pid: number; readonly engineVersion: string | null; /** Resident memory of that generation's process tree, `null` where the platform hides it. */ readonly rss_mb: number | null; /** Resident memory of that generation's own supervisor and host processes, without their tools. */ readonly host_rss_mb: number | null; /** Session files this generation still claims in `reservations/`. */ readonly sessions: number; /** True for the generation the pointer names: the one serving the socket. */ readonly current: boolean; readonly alive: boolean; } /** What one prune removed, so a caller can report it instead of guessing. */ export interface PrunedDaemonState { /** Instance ids whose generation directory named a dead pid. */ readonly generations: readonly string[]; /** Session paths whose claim named a dead owner. */ readonly claims: readonly string[]; /** Whether the pointer itself named one of those dead generations. */ readonly pointer: boolean; } export interface PruneOptions { /** Deterministic race seam: runs after the pointer was read and before it is removed. */ readonly _test?: { readonly beforePointerRemoval?: () => Promise<void>; }; } /** * Drops every record of a generation that is no longer running: its directory, the pointer while it * still names it, and the session-path claims its pid published. A record that cannot be parsed is * LEFT - an ensure writing one right now must not be mistaken for a generation that ended. */ export declare function pruneDeadGenerations(paths: HostDaemonPaths, options?: PruneOptions): Promise<PrunedDaemonState>; /** * Removes every claim whose owner is gone, and every claim of a generation in `ended` (being removed by the caller) * whose owner identity cannot be proven. Returns the session paths released. Every path that removes a generation * directory calls this first, so no generation leaves claims behind that its directory no longer explains. */ export declare function endClaimsOfEndedGenerations(paths: HostDaemonDirectory, ended: ReadonlySet<string>): Promise<string[]>; /** * Every generation of this daemon that is still running, newest ordinal last. A record naming a * dead pid is omitted rather than reported as history: `host status` answers who is alive now. * `includeDead` is for the reader that must not prune (`host status --all`): a dead record is then * reported as a row with `alive: false` instead of being dropped, so the stale state stays visible. */ export declare function readGenerationRows(paths: HostDaemonDirectory, options?: { readonly includeDead?: boolean; }): Promise<readonly HostGenerationRow[]>; //# sourceMappingURL=host-generations.d.ts.map