@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
30 lines (29 loc) • 1.37 kB
TypeScript
import type { Json, Target } from "./protocol.js";
export interface Stall {
stalled: true;
stalledSince: string;
stallFor: number;
}
export interface StallReaders {
screen: (target: Target) => Promise<string>;
transcript: (target: Target) => Promise<string>;
now: () => number;
threshold: () => number;
}
export declare function stallThreshold(): number;
/** Requires successful observations of both sources. Identity, terminal, work
* status and either source changing all reset the clock. Missing data is unknown.
* `live` reads the awaited work the pane's turn still waits on (`liveWork`:
* awaited background shells and monitors, running children). A worker that
* ended its turn on purpose while a build runs sits still on screen and in its
* transcript, so once the clock runs out `live` is asked, and any live work
* starts the clock over instead of reporting a stall, for at most
* BACKGROUND_STALE_MS: work that never ends (a build deadlocked on a lock, a
* child that died without its completion record) does not hide a stall forever. */
export declare class StallDetector {
private readers;
private entries;
constructor(readers?: StallReaders);
observe(target: Target, pane: Json, live?: () => Promise<number | undefined>): Promise<Stall | undefined>;
}
export declare const sessionStalls: StallDetector;