/** * Lightweight deadline tracking for long-running CLI operations. * * Supports the `--timeout-seconds` global CLI flag (#402, #404). Operations * that may exceed reasonable wall-clock time can check the deadline * periodically and exit gracefully with a clear message instead of timing * out at the process boundary with no context. */ /** * Thrown when a CLI operation exceeds its configured `--timeout-seconds` deadline. */ export declare class DeadlineExceededError extends Error { constructor(message: string); } /** * An immutable deadline computed from a timeout in seconds. */ export interface Deadline { /** Absolute wall-clock timestamp (Date.now()) after which the deadline is exceeded. */ readonly at: number; /** The original timeout in seconds that produced this deadline. */ readonly timeoutSeconds: number; } /** * Sets the active deadline for the current CLI invocation. * Called once from cli.ts after parsing global options. */ export declare function setActiveDeadline(deadline: Deadline | undefined): void; /** * Returns the active deadline, or `undefined` when no timeout was set. */ export declare function getActiveDeadline(): Deadline | undefined; /** * Creates a Deadline from a timeout in seconds. * Returns `undefined` when `timeoutSeconds` is falsy (no deadline set). * Clamps to `[MIN_TIMEOUT_SECONDS, MAX_TIMEOUT_SECONDS]`. */ export declare function createDeadline(timeoutSeconds: number | undefined): Deadline | undefined; /** * Reads the timeout from a CLI flag value (string), falling back to the * AGENT_HARNESS_TIMEOUT_SECONDS env var, then to `undefined` (no deadline). */ export declare function resolveTimeoutSeconds(flagValue: string | undefined, env?: NodeJS.ProcessEnv): number | undefined; /** * Returns `true` when the deadline has been exceeded. * Always `false` when `deadline` is `undefined`. */ export declare function isDeadlineExceeded(deadline: Deadline | undefined): boolean; /** * Throws `DeadlineExceededError` when the deadline has been exceeded. * No-op when `deadline` is `undefined`. */ export declare function assertNotDeadlineExceeded(deadline: Deadline | undefined, context: string): void;