UNPKG

@code-yeongyu/senpi

Version:

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

60 lines • 1.99 kB
/** * Bounded probe-back scheduler for tier-2 demoted selectors. * * Owns ONE armed probe plan per session: at most two probes (first at half-hint, * then at the absolute deadline), never two in-flight simultaneously. Arming * while armed silently supersedes the previous plan. cancel() aborts any * in-flight probe and clears pending timers — no further emits after cancel. * * All timers go through the injected `setTimeout`/`clearTimeout` pair so tests * can drive them deterministically with fake timers. */ export interface ProbeBackArmInput { selector: string; firstAtMs: number; deadlineMs: number; authAvailable: () => boolean; runProbe: (signal: AbortSignal) => Promise<boolean>; onCleared: (selector: string) => void; emit: (event: ProbeBackEvent) => void; } export type ProbeBackEvent = { type: "retry_probe_scheduled"; selector: string; atMs: number; probeIndex: 1 | 2; } | { type: "retry_probe_result"; selector: string; ok: boolean; errorMessage?: string; }; export type ProbeBackCancelReason = "manual-model-change" | "dispose" | "superseded"; export declare class ProbeBackScheduler { private readonly _now; private readonly _setTimeout; private readonly _clearTimeout; private _armed; private _generation; private _firstTimer; private _deadlineTimer; private _abortController; private _activeProbeIndex; private _secondProbeAnnounced; constructor(opts: { now: () => number; setTimeout?: (callback: () => void, delay: number) => unknown; clearTimeout?: (handle: unknown) => void; }); get active(): boolean; arm(input: ProbeBackArmInput): void; cancel(reason: ProbeBackCancelReason): void; private _clearTimers; private _abortInFlight; private _disarm; private _finish; private _announceSecondProbe; private _runDeadlineProbe; private _runProbe; } //# sourceMappingURL=probe-scheduler.d.ts.map