@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
28 lines • 1.42 kB
TypeScript
/**
* Detects commands whose whole purpose is to *wait* — `sleep 270; git log`,
* `for ...; do ...; sleep 5; done`, a bare `sleep 30`. Such a command should not
* hold the foreground: it detaches early so the session can keep working while
* the wait finishes in the background and its completion notification lands.
*
* Settle sleeps (`pkill; sleep 1`, a 2s server warm-up) are deliberately NOT
* sleep-waits: they are short by construction and detaching them would cost a
* notification round-trip for nothing.
*/
/** Minimum `sleep` seconds for a non-loop command to count as a wait. */
export declare const SLEEP_WAIT_THRESHOLD_SECONDS = 10;
/** Minimum per-iteration `sleep` seconds for a polling loop to count as a wait. */
export declare const SLEEP_WAIT_LOOP_THRESHOLD_SECONDS = 2;
export type SleepWaitRule = "R1" | "R2" | "R3" | "R4";
export interface SleepWaitClassification {
readonly kind: "sleep-wait";
/** R1 pure, R2 leading chain, R3 polling loop, R4 trailing. */
readonly rule: SleepWaitRule;
/** Longest `sleep` argument that made the command match. */
readonly seconds: number;
}
/**
* Classify a bash command as a sleep-wait, or `undefined` when it is ordinary
* work (including short settle sleeps below the thresholds).
*/
export declare function classifySleepWait(command: string): SleepWaitClassification | undefined;
//# sourceMappingURL=sleep-wait.d.ts.map