/** * Pure derived-deadline arithmetic for `control.timeoutSec`. * * "Active execution only" is the scope every node-timeout ruling shares: the * clock runs from `startedAt` but stops counting while the node was parked * for a human decision. Rather than persist a separate "paused" duration, * this module recomputes the deadline on demand from `startedAt` plus the * already-durable `approvalHistory` / `inputHistory` — so it is correct * immediately after `hydrate()` or a reconnect with no extra wiring, and a * live timer is never the source of truth. * * @docLink packages/flow-engine/concepts#node-deadline */ import type { NodeExecution } from "@skaile/workspaces/types"; /** * Milliseconds remaining before `execution`'s active-execution deadline, given * `timeoutSec`. Negative once the deadline has passed. `undefined` when no * timeout applies — `timeoutSec` is unset, or the node has no `startedAt` to * measure from (e.g. it hasn't actually started). * * Active time is wall-clock since `startedAt` minus every *resolved* * approval/input interval recorded at or after that `startedAt` (an * interval opened before a retry's fresh `startedAt` never counts against * the new attempt; a still-open interval never counts because the node * would not be `running` while parked). * * @param execution - Current node snapshot. Only `startedAt`, `approvalHistory`, * and `inputHistory` are read. * @param timeoutSec - Authored `control.timeoutSec`, or `undefined` for no timeout. * @param nowMs - Caller-supplied wall clock (`Date.now()` in production, injectable * for tests). * @docLink packages/flow-engine/concepts#remaining-active-execution-ms */ export declare function remainingActiveExecutionMs(execution: NodeExecution, timeoutSec: number | undefined, nowMs: number): number | undefined; /** * Whether `execution` has exceeded its derived active-execution deadline. * `false` when no timeout applies. Convenience wrapper over * {@link remainingActiveExecutionMs} for call sites that only need the * boolean. * * @docLink packages/flow-engine/concepts#is-active-execution-expired */ export declare function isActiveExecutionExpired(execution: NodeExecution, timeoutSec: number | undefined, nowMs: number): boolean; //# sourceMappingURL=node-deadline.d.ts.map