UNPKG

@code-yeongyu/senpi

Version:

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

31 lines • 1.54 kB
import type { CompactionReason } from "../../types.ts"; import type { CompactionExtensionState } from "./state.ts"; export declare const FAILURE_TRIP_THRESHOLD = 3; export declare const COOLDOWN_MS = 60000; export interface BreakerNotification { tripped: true; failureCount: number; trippedAt: number; reason: CompactionReason | "threshold"; } export interface RecordFailureOptions { onTrip?: (notification: BreakerNotification) => void; route?: CompactionReason; } export interface ShouldBypassOptions { manual?: boolean; reason?: CompactionReason; } export declare function recordSuccess(state: CompactionExtensionState): CompactionExtensionState; export declare function recordFailure(state: CompactionExtensionState, now: number, opts?: RecordFailureOptions): CompactionExtensionState; export declare function isTripped(state: CompactionExtensionState, now: number): boolean; /** * A tripped breaker halts *automatic* compaction only. An explicit `/compact` is the * user's escape hatch - and on an SDK-owned lane it is the documented recovery from a * rejected model downswitch - so refusing it during the cooldown would strand the very * session the recovery exists for. Manual failures are still recorded (see the * `ownsCompaction` failure-accounting site in `index.ts`), so they count toward the * trip that protects the automatic routes. */ export declare function shouldBypass(_state: CompactionExtensionState, opts?: ShouldBypassOptions): boolean; //# sourceMappingURL=circuit-breaker.d.ts.map