import { ApprovalDecision } from "./contracts/approval.type.mjs"; import { ResumeOptions, ResumeResult } from "./contracts/resume.type.mjs"; //#region ../ai/src/human/resume.d.ts /** * Apply a human's decision to a persisted interrupt — the out-of-process * resume entry point behind `ai.human.resume(interruptId, decision, options)`. * * **Durable v1 model — re-run, not mid-supervisor suspend.** This loads the * {@link PendingInterrupt} from `options.store`, validates the decision, * deletes the pending record, and (when an `agent` is supplied) re-executes * the original turn with the decision **pre-seeded**, so the gated tool call * resolves to the ruling instead of pausing again. It does **not** rehydrate * an in-flight supervisor — that is the deferred v2 lift. * * **Idempotent.** A second resume of an already-resolved (deleted) or * never-raised interrupt is a no-op: it returns `{ type: "already-resolved" }` * without re-applying the decision or re-running the turn — mirroring the * orchestrator resume's drain idempotency. The record is deleted **before** * the re-run, so even a re-run that itself raises a fresh interrupt cannot * collide with the one being resolved. * * **Two shapes** (see {@link ResumeOptions}): * - **apply-only** — omit `agent`: load, validate, delete, return * `{ type: "applied", decision }` for a caller-owned re-drive. * - **re-run** — pass `agent`: additionally re-execute the turn; the * {@link import("@warlock.js/ai").AgentResult} rides `result.result`. * * @param interruptId - Id of the persisted interrupt to resolve. * @param decision - The human's ruling (approve / reject / edit). * @param options - The durable `store` (required) plus optional re-run * `agent` / `input` / `executeOptions`. * @returns A {@link ResumeResult} — `"applied"` or idempotent * `"already-resolved"`. * * @example * // Process B (webhook, hours later) — apply-only: * const outcome = await ai.human.resume(interruptId, { type: "reject", reason: "Out of policy" }, { * store, * }); * * @example * // Re-run the turn with the decision pre-seeded: * const outcome = await ai.human.resume(interruptId, { type: "edit", args: { amount: 5 } }, { * store, * agent: support, * }); * if (outcome.type === "applied" && outcome.result) { * console.log(outcome.result.text); * } */ declare function resume(interruptId: string, decision: ApprovalDecision, options: ResumeOptions): Promise>; //#endregion export { resume }; //# sourceMappingURL=resume.d.mts.map