UNPKG

@code-yeongyu/senpi

Version:

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

30 lines • 2.02 kB
import { type SocketFileIdentity } from "./socket-ownership.ts"; /** How often a generation re-checks that the public path still holds the socket it bound. */ export declare const SUPERSESSION_POLL_MS = 1000; /** Consecutive absent observations before a missing entry counts as gone rather than as a race. */ export declare const ABSENT_CONFIRMATIONS = 3; /** Consecutive agreeing pointer + endpoint observations before an identity-less endpoint counts as replaced. */ export declare const REPLACED_CONFIRMATIONS = 3; /** How a generation stopped owning its endpoint: somebody took the name, or the name is gone. */ export type EndpointLoss = "replaced" | "absent"; export interface SupersededEndpoint { /** The public path this generation serves: the supervisor's, not a private internal hop. */ readonly path: string; /** The entry it bound there. Without one, supersession can never be proven and is never claimed. */ readonly identity: SocketFileIdentity | undefined; /** Consulted every tick; a host already draining or shutting down has nothing left to notice. */ readonly settled?: () => boolean; /** The daemon pointer and this generation's instance id: the evidence used when `identity` is absent. */ readonly pointer?: SupersessionPointer; /** Which instance answers at `path`; injectable for tests. Defaults to an `observe` read. */ readonly probeInstanceId?: (path: string) => Promise<string | undefined>; /** Which instance the pointer names; injectable for tests. Defaults to reading `pointer.file`. */ readonly readPointerInstanceId?: (file: string) => Promise<string | undefined>; } export interface SupersessionPointer { readonly file: string; readonly instanceId: string; } /** Runs `onLost` once this endpoint stops being served by the entry this generation bound. */ export declare function watchForSupersession(endpoint: SupersededEndpoint, onLost: (loss: EndpointLoss) => void): () => void; //# sourceMappingURL=host-supersession.d.ts.map