import { type Principal, type StoreOps, type ToolRegistry, type ApprovalResolution } from "./core/index.js"; import type { VendoGuard } from "./guard/index.js"; /** The wire's answer to `GET /approvals/:id` — the frozen * `VendoApprovalEmbedState` vocabulary, plus what each state needs to render: * the full request while pending (the consent card shows real inputs), the * executed outcome after resume. * * The request is absent where the answer is "not decided yet" but the ask * itself is no longer anywhere to be had: an IN-APP parked press read during * the resume window (that lane persists the call, not the request), and a * DOOR-parked call whose yes is in but whose caller has not retried it yet. * Surfaces treat both as still-working and keep polling. * * The outcome is absent for the same door lane: nothing here runs that call, * so once it has run all this seam can honestly say is that it did. */ export type ByoApprovalResolution = ApprovalResolution; export interface ByoApprovals { /** The guard-bound registry with approval parking — the registry the BYO * tool pack executes through. Same decisions, same audit; the only * addition is the parked record behind a `pending-approval` outcome. */ registry: ToolRegistry; /** Resolve one approval's state for its owner; not-found for unknown or * foreign ids (indistinguishable on purpose). */ read(approvalId: string, principal: Principal): Promise; /** Deny every parked call idle past `ttlMs` through the existing * abandonment path. No-op when `ttlMs` is 0 or negative. */ sweepExpired(ttlMs: number, now?: number): Promise; } export interface ByoApprovalsConfig { guard: VendoGuard; /** The guard-bound registry (the SAME binding chat, apps, and automations * execute through) — both the parked call and its resume dispatch ride it. */ tools: ToolRegistry; /** THE named-operation surface for this deployment — `undefined` when the * configured store offers neither its own `ops` nor a SQL handle, exactly as * `selectStoreOps` reports it. The parked-call drawers are Vendo's own, so * they are reached through the `engine` family rather than the record * façade, and this is the only store handle this seam takes. */ ops: StoreOps | undefined; } export declare function createByoApprovals({ guard, tools, ops }: ByoApprovalsConfig): ByoApprovals;