/** * The worst case of a checked flow, computed before the first spawn: how * many agent turns each node can ask for, and how long it can take when * every bounded wait runs to its bound. * * Every loop and every `map` has a bound written in the file, so both are * known. They are shown, never judged: nothing refuses a flow for what it * could cost. Sub-flows are unrolled, since a callee's turns are spent where * its call stands, and its agents inherit the caller's `timeout:`. */ import type { CheckedAgentNode, CheckedNode } from "./checked.ts"; /** An agent turn's bound when neither the node, nor the flow, nor a flow calling it sets one. */ export declare const DEFAULT_TIMEOUT_MS: number; /** * How many more attempts an `agent` node gets after a failed turn when it does * not say. The failures a retry covers are transient: a provider error, an * empty or cut answer, a deadline, a missing `submit`. Three more turns cost * less than a run stopped on one of them. `retry: 0` asks once. */ export declare const DEFAULT_RETRY = 3; /** * The most something can cost. `ms` counts every wait that has a bound: an * agent turn's `timeout:` for each attempt `retry:` allows, a check's, an * ask's when it has one. `waits` says an `ask` with no `timeout:` can be * reached, whose wait for a person no bound covers. */ export type Bound = { /** Agent turns, every retry counted. */ readonly turns: number; /** Every bounded wait run to its bound, in milliseconds. */ readonly ms: number; /** Whether an `ask` with no `timeout:` can be reached. */ readonly waits: boolean; }; /** A flow's worst case whole, and each node's over every visit a run can make of it. */ export type Bounds = { /** The flow's, run whole. */ readonly total: Bound; /** By the node's address through the calls, `spec/look` for `look` in the flow `spec` calls. */ readonly nodes: ReadonlyMap; }; /** The bounds of a flow whose root sequence is `nodes`, run on its own with the flow's `timeout:`. */ export declare function boundsOf(nodes: readonly CheckedNode[], timeoutMs?: number): Bounds; /** * The bound of one attempt of `node`: its own `timeout:`, the nearest flow's * around it, or {@link DEFAULT_TIMEOUT_MS}, and which of the three it is. */ export declare function turnTimeout(node: CheckedAgentNode, flowMs?: number): { readonly ms: number; readonly from: "node" | "flow" | "default"; }; /** How many more attempts `node` gets after a failed turn: its own `retry:`, or {@link DEFAULT_RETRY}. */ export declare function retriesOf(node: CheckedAgentNode): number; /** How many items a `map` runs at most: its literal list, or its `max:`. */ export declare function itemsOf(node: Extract): number; /** A bound as a plan line shows it: `≤ 4 turns · ≤ 2h`, and a person's answer when an ask with no `timeout:` waits for one. */ export declare function showBound({ turns, ms, waits }: Bound): string; //# sourceMappingURL=bounds.d.ts.map