UNPKG

@code-yeongyu/senpi

Version:

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

41 lines • 2.16 kB
/** * Deadline-bounded warnings for waits that have no deadline of their own (senpi#6189). * * A wait that never settles leaves no trace: no timer fires, no result is written, and the * session just idles. These helpers only observe such a wait. They log once when it outlives * its threshold and never resolve, reject, abort or delay anything themselves. */ /** A wait still pending after this long is logged once. A bash spawn's own shorter timeout lowers it. */ export declare const STALL_WARNING_MS = 30000; /** The warning threshold for a bash spawn whose own `timeout` (in seconds) may be shorter than {@link STALL_WARNING_MS}. */ export declare function stallThresholdMs(timeoutSeconds: unknown): number; export declare function queueEntryLabel(event: { readonly type: string; }): string; export interface StallWatch { stop(): void; } /** * Call `onStall` once if `stop` has not run within `thresholdMs`. The caller keeps its own `await`, so the * watched wait's outcome and ordering are unchanged. The timer is unref'd: it never keeps the process alive. */ export declare function watchForStall(thresholdMs: number, onStall: (elapsedMs: number) => void): StallWatch; export interface PendingQueueSnapshot { readonly queueDepth: number; /** Label of the oldest unsettled entry: the one every later entry waits behind. */ readonly queueHead?: string; readonly ageMs?: number; } /** The unsettled entries of a promise chain, oldest first, so a stalled wait on the chain can name what it waits behind. */ export declare class PendingQueueLedger { private nextId; private readonly entries; /** * Record `run` as an entry from now until it settles, and return it wrapped for the chain. The wrapper returns * exactly what `run` returns or throws, and releases the entry from that result. It never attaches a handler to * the chain itself, so a rejection on the chain is exactly as visible (or unhandled) as before. */ track<A extends unknown[], R>(label: string, run: (...args: A) => R): (...args: A) => R; snapshot(): PendingQueueSnapshot; } //# sourceMappingURL=stall-warning.d.ts.map