@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
35 lines • 1.59 kB
TypeScript
export declare const LEAK_GRACE_MS = 1000;
export declare const MAX_LEAKED_WORKERS = 3;
export declare const BREAKER_BACKOFF_MS = 5000;
export declare const BREAKER_BACKOFF_MAX_MS = 60000;
export type BreakerState = "closed" | "open" | "half-open";
export interface ResolverStateEvent {
readonly volumeKey: string;
readonly state: BreakerState | "leak-cap" | "leak-recovered" | "unavailable";
readonly leaked: number;
}
export type ResolverStateEmitter = (volumeKey: string, state: ResolverStateEvent["state"]) => void;
interface Breaker {
state: BreakerState;
consecutive: number;
backoffMs: number;
probe?: ReturnType<typeof setTimeout>;
}
export interface BreakerRegistry {
breakerFor(key: string): Breaker;
recordTimeout(key: string): void;
recordSuccess(key: string): void;
stateOf(key: string): BreakerState;
clearProbes(): void;
}
/** Per-volume breakers: open after consecutive timeouts, half-open after a doubling back-off, closed on a probe. */
export declare function createBreakerRegistry(emit: ResolverStateEmitter, atLeakCap: () => boolean, onClosed: () => void): BreakerRegistry;
export interface AbandonedWorkerCount {
readonly count: number;
readonly atCap: boolean;
/** Counts a retired worker as abandoned when its `terminate()` has not returned after the grace, and uncounts it when it does. */
track(terminated: Promise<unknown>): void;
}
export declare function createAbandonedWorkerCount(emit: ResolverStateEmitter): AbandonedWorkerCount;
export {};
//# sourceMappingURL=path-identity-breaker.d.ts.map