UNPKG

@code-yeongyu/senpi

Version:

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

51 lines • 2.34 kB
import { type EndpointKind } from "./host-daemon-paths.ts"; import { type EndpointInUse, type SocketSilence } from "./host-gc-evidence.ts"; import { type StaleEngineKeep, type StaleEngineOptions } from "./host-stale-engine.ts"; export type HostGcKeptReason = EndpointInUse | StaleEngineKeep | "locked" | "legacy_layout" | "unknown_identity" | "failed"; /** A sibling a removal left in place because of what it is. */ export interface HostGcSkippedEntry { readonly path: string; readonly type: "directory"; } export interface HostGcEntry<Reason extends string> { readonly socket: string | null; readonly dir: string; readonly reason: Reason; /** Removed entries only, and only when a sibling was left in place. */ readonly skipped?: readonly HostGcSkippedEntry[]; /** `failed` entries only: the message of what threw. */ readonly error?: string; } export interface HostGcResult { readonly removed: readonly HostGcEntry<SocketSilence>[]; /** Present only when a run stopped a stale older-engine host (`staleEngine`). */ readonly stopped?: readonly (HostGcEntry<"stale_old_engine"> & { readonly pid: number; })[]; readonly kept: readonly HostGcEntry<HostGcKeptReason>[]; } export interface HostGcOptions { /** Only endpoints of these kinds; every kind when absent. */ readonly kinds?: readonly EndpointKind[]; /** Also stop running stale older-engine hosts; `{}` judges against this build. */ readonly staleEngine?: StaleEngineOptions; readonly _test?: { /** Runs inside an endpoint's ensure lock, before any evidence is read. */ readonly afterLockAcquired?: (socket: string) => Promise<void>; }; } export declare function gcHostEndpoints(agentDir: string, options?: HostGcOptions): Promise<HostGcResult>; /** One endpoint, judged and removed exactly as a full run does; the budgeted pass (`host-gc-pass.ts`) reuses it. */ export declare function gcEndpoint(socket: string, dir: string, options: HostGcOptions): Promise<{ readonly removed: true; readonly reason: SocketSilence; readonly skipped: readonly HostGcSkippedEntry[]; } | { readonly removed: false; readonly reason: HostGcKeptReason; } | { readonly removed: false; readonly stopped: true; readonly pid: number; }>; //# sourceMappingURL=host-gc.d.ts.map