import { JsonValue } from "./results.js"; import { SupabaseMcpState } from "./types.js"; import { CallToolResult } from "@modelcontextprotocol/server"; //#region src/previews.d.ts declare const previewLimits: Readonly<{ defaultTtlSeconds: 300; maxTtlSeconds: 900; tokenPattern: RegExp; }>; interface MintPreviewOptions { readonly namespace: string; /** Exact MCP tool name this token authorizes (e.g. `"delete_project"`). */ readonly tool: string; /** * Optional verified caller/tenant/workspace scope bound into the SHA-256 digest * (especially recommended on shared-API-key surfaces where `ctx.state` is shared). */ readonly scope?: string; /** * Canonical domain mutation arguments (excluding `dry_run` / `confirm_token` carrier fields). * Must be valid JSON; hashed with SHA-256 and never stored raw in state. */ readonly payload: Readonly>; /** Optional bounded human/model summary echoed back on consumption. */ readonly summary?: Summary; /** Lifetime in seconds (`1..min(900, namespace.maxTtlSeconds)`). Defaults to `min(300, namespace.ttlSeconds, namespace.maxTtlSeconds)`. */ readonly ttlSeconds?: number; } interface MintedPreview { readonly token: `cprev1_${string}`; readonly payloadDigest: `sha256:${string}`; readonly expiresAt: string; readonly summary?: Summary; } type ConsumePreviewFailureReason = "state_unavailable" | "invalid_token" | "missing_or_consumed" | "payload_mismatch"; interface ConsumePreviewOptions { readonly namespace: string; readonly tool: string; readonly token: string; /** Must match the `scope` passed to `mintPreview` (or both omitted). */ readonly scope?: string; /** Current call's domain mutation arguments — must hash identically to `mintPreview`. */ readonly payload: Readonly>; } type ConsumePreviewResult = { readonly ok: true; readonly payloadDigest: `sha256:${string}`; readonly mintedAt: string; readonly summary?: Summary; } | { readonly ok: false; readonly reason: ConsumePreviewFailureReason; /** Actionable `errorResult` steering the model to run a fresh preview. */ readonly error: CallToolResult; }; declare function mintPreview(state: SupabaseMcpState | undefined, options: MintPreviewOptions): Promise>; /** * Verify tool + scope + canonical payload SHA-256 digest and atomically delete the * preview receipt BEFORE the caller executes its domain mutation. */ declare function consumePreview(state: SupabaseMcpState | undefined, options: ConsumePreviewOptions): Promise>; //#endregion export { ConsumePreviewFailureReason, ConsumePreviewOptions, ConsumePreviewResult, MintPreviewOptions, MintedPreview, consumePreview, mintPreview, previewLimits }; //# sourceMappingURL=previews.d.ts.map