@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
42 lines • 3.08 kB
TypeScript
import { type HostDaemonPaths } from "./host-daemon-paths.ts";
import type { RegisteredHost } from "./host-daemon-registration.ts";
import { type HostProtocolInfo } from "./host-decision.ts";
import type { HostHolder } from "./host-holder.ts";
/**
* IS-5: a generation nothing can reach whose loop is measurably stalled is still serving its sessions, so
* it is neither stopped nor stranded beside a new generation: no signal, no successor, registration intact.
*/
export declare function refuseIfStalled(paths: HostDaemonPaths, instanceId: string, socket: string, protocol: HostProtocolInfo | undefined): Promise<void>;
/**
* I1 for a record another process wrote: while something still accepts at the public path, the generation
* it names may own the endpoint, so the ensure refuses `foreign_writer` - and the refusal names that
* generation, so every client can say WHO is in the way instead of only that something is
* (omo-desktop-app#3561). An endpoint nothing accepts at is left to the caller's stranded start (#1936).
*/
export declare function refuseIfForeignHeld(paths: HostDaemonPaths, registered: RegisteredHost, socket: string, protocol: HostProtocolInfo | undefined): Promise<void>;
/** The registration's own account of the generation: its record also stores the build and launch profile. */
export declare function readHostHolder(paths: HostDaemonPaths, registered: RegisteredHost): Promise<HostHolder>;
/**
* Whether SOMETHING still accepts connections at the public path - the one fact that says a
* registered process may still own the endpoint. A missing entry and an entry nobody listens
* behind (connection refused) both answer no; an accepted connection, however silent, answers yes.
* A named pipe has no entry to lose and an abstract socket has no path, so both read as owned;
* so does an entry this process cannot stat, because an owner that cannot be ruled out is one
* this ensure must not bind over.
*/
export declare function publicEndpointAccepts(socket: string): Promise<boolean>;
/**
* Whether something stands behind a public path that no registration names: the gate before an
* ensure would start a host there. Unlike `publicEndpointAccepts` it also counts a listener that
* refuses only because its backlog is full (`socketEntryListenerState`), because a start there
* could only lose the bind; the registered paths keep `publicEndpointAccepts`, whose "not
* accepting" leads to the stall check (IS-5).
*
* An entry that is not a socket is held too (#5280): the start's `prepareSocketPath` never removes one, so
* a start there could only fail. The connect probe cannot tell: macOS answers ENOTSOCK, but Linux answers
* ECONNREFUSED, which reads as a dead listener there. The entry is read with `lstat` and never followed: a
* symlink, dangling or not, is held too (#5294 class), so a planted link can neither read as a missing entry
* nor steer the probe to the path it names.
*/
export declare function unregisteredEndpointHeld(socket: string): Promise<boolean>;
//# sourceMappingURL=host-ensure-liveness.d.ts.map