@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
33 lines (32 loc) • 1.5 kB
TypeScript
import { hookRequest } from "./client.js";
import type { Json } from "./protocol.js";
/**
* `phren dispatch wait`: follow one local dispatch to its end. It peeks at the
* Hook's returns (never taking them), filters to this dispatch, and reads the
* worker's live state to tell a gone pane from one still working. The output
* is NDJSON: one line per state change, then one final line. Only the final
* dispatch's own return is acknowledged, so a conductor's returns on the same
* Hook stay unread.
*/
/** How long an id the Hook does not know gets before it is "unknown dispatch". */
export declare const WAIT_GRACE_MS = 30000;
/** Continuous Hook unavailability before the wait ends failed. */
export declare const WAIT_UNAVAILABLE_MS: number;
/** Longest wait a caller may ask for. */
export declare const WAIT_MAX_MS: number;
export interface DispatchWaitOptions {
/** No timeout by default. Capped at seven days. */
timeoutMs?: number;
request?: typeof hookRequest;
out?: (line: Json) => void;
now?: () => number;
sleep?: (ms: number) => Promise<void>;
/** First poll interval; it backs off to 10 s. */
intervalMs?: number;
jitter?: boolean;
graceMs?: number;
unavailableMs?: number;
}
/** About 2 s at first, backing off to 10 s, with jitter. */
export declare function waitDelay(attempt: number, baseMs?: number, jitter?: boolean): number;
export declare function waitForDispatch(id: string, options?: DispatchWaitOptions): Promise<number>;