@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
38 lines • 2.26 kB
TypeScript
/**
* Whether a RUNNING host is a stale older-engine leftover that a newer client may stop (#3268).
*
* A host stays up only while its own idle decision says so, and a host of an older engine runs that
* engine's decision: when it is wrong, no fix in a newer build reaches the process. A newer client
* may therefore end such a host, and only when every one of these holds, each read errs toward
* "keep":
*
* stale_unproven_owner the registration does not prove the process serving this socket (I1)
* stale_clients the supervisor holds an accepted public connection, or that cannot be read
* stale_unreachable the host does not answer an observing `get_protocol_info`
* stale_not_older its engine ordinal is not STRICTLY older than the caller's (I2: unknown is equal)
* stale_persistent its recorded policy is `persistent`: an operator asked it to stay
* stale_sessions it lists any session, workers included, or does not answer the listing
* stale_claims any session-path claim exists under its `reservations/`
* stale_young it has been up less than its own recorded idle window plus the grace
*
* Every probe is an observing read, so judging a host never resets its idle window. The caller
* judges inside the endpoint's ensure lock and stops through `stopHost`, which re-reads the session
* count before it signals.
*/
import { type EngineBuildIdentity } from "../../core/engine-build-identity.ts";
export type StaleEngineKeep = "stale_unproven_owner" | "stale_unreachable" | "stale_not_older" | "stale_persistent" | "stale_sessions" | "stale_claims" | "stale_young" | "stale_clients";
export type StaleEngineVerdict = {
readonly stale: true;
readonly pid: number;
} | {
readonly stale: false;
readonly reason: StaleEngineKeep;
};
export interface StaleEngineOptions {
readonly client?: EngineBuildIdentity;
readonly now?: () => number;
readonly graceMs?: number;
}
export declare const STALE_ENGINE_GRACE_MS: number;
export declare function judgeStaleEngine(socket: string, agentDir: string, client: EngineBuildIdentity, options?: StaleEngineOptions): Promise<StaleEngineVerdict>;
//# sourceMappingURL=host-stale-engine.d.ts.map