/** * 07 §3's grant capture, from both ends: the asks arming raises, the ask a * firing raises when it meets a permission nobody granted, and the one decision * subscriber that turns either into a standing grant. */ import { type ApprovalRequest, type AutomationRecord, type RunContext, type Step, type ToolCall, type ToolDescriptor, type VendoRecord } from "@vendoai/core"; import type { AutomationRowsAccess } from "./automation-rows.js"; import type { EngineBase } from "./engine-context.js"; import type { GrantsAccess } from "./grants.js"; import type { RunRowsAccess } from "./run-rows.js"; import { type Capture, type ConsentItem, type InternalRunRecord } from "./types.js"; /** One thing a person may have to allow, already graded the way the firing will * grade it and already carrying the synthetic call the grade was resolved from — * so nothing downstream re-derives either and gets a different answer. */ export type ArmingPower = { item: ConsentItem; descriptor: ToolDescriptor; call: ToolCall; }; export type ConsentDeps = { base: EngineBase; automations: AutomationRowsAccess; grants: GrantsAccess; runRows: RunRowsAccess; }; export interface ConsentAccess { /** A capture row, keyed by the approval it is the ask for. */ writeCapture(approvalId: string, capture: Capture): Promise; /** Is this approval still an open question? */ isPendingAsk(approvalId: string): Promise; /** Every still-pending capture for the subject, parsed. */ pendingCaptures(subject: string): Promise>; /** Claim the approval's one-time transition before granting anything. */ spendApproval(record: VendoRecord): Promise; /** The guard's decision subscriber: mint, clear, and disarm on a bare no. */ handleDecision(approvalId: string, approved: boolean): Promise; /** Every tool a task could reach away, before policy has been consulted. */ candidateSurface(record: AutomationRecord, byName: Map): Promise; /** 07 §3 — the tools this record's arming has to NAME to a person: graded as the * firing will grade them, minus everything policy runs away unasked. */ armingSurface(record: AutomationRecord, byName: Map, ctx: RunContext): Promise; /** The same, for a GOAL arming whose record does not exist yet — the ask parks * before `vendo_automate` runs. */ goalArmingPowers(byName: Map, ctx: RunContext): Promise; /** 07 §3 — the asks arming has to raise for this subject. */ captureGrants(record: AutomationRecord, byName: Map, ctx: RunContext, armedBy?: ToolCall): Promise<{ missing: ApprovalRequest[]; grantSetId: string; }>; /** A step met a permission nobody has granted. The run ends HERE, loudly. */ needsPermission(run: InternalRunRecord, ctx: RunContext, step: Step, approvalId: string): Promise; } export declare const createConsent: (deps: ConsentDeps) => ConsentAccess; //# sourceMappingURL=consent.d.ts.map