UNPKG

@code-yeongyu/senpi

Version:

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

45 lines • 2.85 kB
import { type HostDaemonPaths } from "./host-daemon-paths.ts"; /** The OS start identity, never a timestamp estimated from uptime or the caller's clock. */ export interface HostLifetimeOwner { readonly pid: number; readonly startTime: string; } /** Null explicitly means unowned; undefined is an unreadable/old generation, never permission to take over. */ export declare function readHostOwner(generationDir: string): Promise<HostLifetimeOwner | null | undefined>; /** * The one mutable ownership record: ensure writes it under the endpoint lock while holding an * attachment. Supervisors only read it. Generation teardown removes it before the pointer (#2243). */ export declare function writeHostOwner(generationDir: string, owner: HostLifetimeOwner | null): Promise<void>; export declare function sameHostOwner(a: HostLifetimeOwner | null | undefined, b: HostLifetimeOwner | null | undefined): boolean; export declare function callerHostOwner(): Promise<HostLifetimeOwner>; export declare function hostOwnerGone(owner: HostLifetimeOwner): Promise<boolean>; /** A live or unknown different owner is never silently replaced. Called inside the ensure lock. */ export declare function claimHostOwner(generationDir: string): Promise<void>; /** Settings a supervisor reads at boot. Written before the spawn, so it exists when the host starts. */ export interface HostDaemonSettings { readonly socket: string; readonly capabilities: readonly string[]; readonly coldStart: string; readonly idleExitMs: number; /** Which generation of this daemon the spawn is; `0` for a host nobody has handed off yet. */ readonly generation: number; /** Which generation directory the spawn will register itself in. */ readonly instanceId: string; } /** * Publishes the settings a generation is started with, in both places they are read: the daemon * directory (what the supervisor loads at boot) and the generation's own directory (what that * generation was started with, which survives the next generation overwriting the boot copy). */ export declare function writeHostSettings(paths: HostDaemonPaths, settings: HostDaemonSettings): Promise<void>; /** The policy the running generation was started with, for a successor that states none of its own. */ export declare function readHostSettings(paths: HostDaemonPaths): Promise<{ coldStart?: HostDaemonSettings["coldStart"]; idleExitMs?: number; } | undefined>; export declare function writeStateFile(path: string, content: unknown): Promise<void>; export declare function readFileOrUndefined(path: string): Promise<string | undefined>; export declare function parseJson(text: string | undefined): Record<string, unknown> | undefined; export declare function isRecord(value: unknown): value is Record<string, unknown>; //# sourceMappingURL=host-daemon-state.d.ts.map