import type { Interrupt, InterruptResult } from "./interrupts.js"; import type { InterruptResponse } from "./interruptResponse.js"; import type { Policy } from "./policy.js"; import type { PromptFn, ValuePromptFn } from "./interruptPrompts.js"; export type { InterruptResult } from "./interrupts.js"; /** Resume a paused run. Kept generic over the result shape so a local run * preserves its full `RunNodeResult` while the remote client uses a minimal * `{ data }`. */ export type ResumeFn = (interrupts: Interrupt[], responses: InterruptResponse[]) => Promise; /** Decide one surfaced interrupt. */ export type DecideFn = (interrupt: Interrupt) => Promise; /** * Loop until the run stops pausing: for each surfaced interrupt, `decide` it, * then `respond` (resume) with the collected responses, and repeat. Pure of * transport, prompts, and policy — those live in the injected callbacks. */ export declare function resolveInterrupts(result: R, respond: ResumeFn, decide: DecideFn): Promise; export type BuildDeciderOptions = { /** Client-endpoint policy. Omitted for local `run` (its policy acts in-chain, * and re-applying it here would auto-approve interrupts a handler propagated * — finding 1). Passed for `remote call`, which has no in-chain handler. */ policy?: Policy; interactive: boolean; prompt?: PromptFn; valuePrompt?: ValuePromptFn; }; /** * Build the per-interrupt decision function. Policy runs first for every * interrupt: an explicit reject settles immediately, carrying the matched * rule's `rejectMessage`, when one was set, as the rejection's reason. An * explicit approve settles a statement interrupt, and settles a * value-expecting one with no value (a null answer, which the effect gives * a meaning) unless the run is interactive, where a person can supply the * value at the value prompt instead. Only when the policy leaves an * interrupt "unsettled" (`propagate` or no-match) does interactivity apply * on its own: a value-expecting interrupt uses the value prompt, a * statement interrupt the ordinary prompt, and a non-interactive run * rejects (fail-closed). "Always" * answers are remembered per effect for the run. The result * is always an approve/reject response — never `propagate`, so it can never be * sent over a resume boundary. */ export declare function buildDecider(options: BuildDeciderOptions): DecideFn;