import { SupabaseMcpSurfaceTool } from "./types.js"; import { TOKEN_ESTIMATOR_ID } from "./surface-tokens.js"; //#region src/surface-diff.d.ts declare const SURFACE_DIFF_DEFAULTS: Readonly<{ failOn: readonly ["breaking", "authority-widening", "context-regression"]; maxTokenDelta: 500; maxCatalogTokens: 8000; bloatedToolSchemaTokens: 800; bloatedToolGrowthTokens: 250; }>; type SurfaceAuthMode = "oauth" | "bearer" | "api-key" | "public" | "multi" | "unknown"; interface LockedToolAuthorityMeta { readonly risk?: "read" | "write" | "destructive"; readonly idempotent?: boolean; readonly scopes?: readonly string[]; readonly visibility?: readonly ("model" | "app")[]; readonly uiResourceUri?: string; } interface LockedSurfaceContextBudget { readonly estimator: typeof TOKEN_ESTIMATOR_ID; readonly toolCount: number; readonly totalPromptTokens: number; readonly totalOutputSchemaTokens: number; readonly totalWireBytes: number; readonly perToolPromptTokens: Readonly>; } interface LockedSurfaceEntry { readonly functionName: string; readonly profile: string; readonly serverName: string; readonly authMode: SurfaceAuthMode; readonly anonAccessible: boolean; /** Exact SHA-256 of JSON.stringify({ schemaVersion: 1, tools }), matching onSurface. */ readonly contentDigest: `sha256:${string}`; readonly contextBudget: LockedSurfaceContextBudget; readonly toolAuthority: Readonly>; readonly tools: readonly SupabaseMcpSurfaceTool[]; } interface McpSurfaceLockfileV1 { readonly lockfileVersion: 1; readonly surfaces: Readonly>; } type SurfaceDiffCategory = "breaking" | "authority-widening" | "context-regression" | "additive"; type SurfaceDiffRuleCode = "surface-removed" | "tool-removed" | "input-required-added" | "input-property-removed" | "input-type-narrowed" | "input-enum-narrowed" | "input-bounds-tightened" | "output-schema-removed" | "output-property-removed" | "output-type-widened" | "surface-anon-opened" | "anon-tool-added" | "read-only-hint-dropped" | "destructive-hint-dropped" | "destructive-or-open-world-added" | "scope-requirement-widened" | "model-visibility-widened" | "catalog-token-delta-exceeded" | "catalog-token-ceiling-exceeded" | "tool-schema-bloated" | "surface-added" | "tool-added" | "input-optional-added" | "output-property-added" | "prose-updated" | "context-reduced"; interface SurfaceDiffFinding { readonly surfaceKey: string; readonly category: SurfaceDiffCategory; readonly code: SurfaceDiffRuleCode; readonly tool?: string; readonly schemaPath?: string; readonly detail: string; } interface SurfaceSnapshotReport { readonly schemaVersion: 1; readonly command: "surface snapshot"; readonly status: "planned" | "needs_confirmation" | "unchanged" | "complete"; readonly lockfilePath: string; readonly surfaces: ReadonlyArray<{ readonly key: string; readonly contentDigest: `sha256:${string}`; readonly toolCount: number; readonly totalPromptTokens: number; readonly changed: boolean; }>; readonly nextCommand?: string; } interface SurfaceEntryDiff { readonly key: string; readonly baselineDigest: `sha256:${string}` | null; readonly candidateDigest: `sha256:${string}` | null; readonly baselinePromptTokens: number; readonly candidatePromptTokens: number; readonly promptTokenDelta: number; readonly findings: readonly SurfaceDiffFinding[]; } interface SurfaceDiffReport { readonly schemaVersion: 1; readonly command: "surface diff"; readonly status: "unchanged" | "compatible" | "policy_failed"; readonly exitCode: 0 | 2; readonly lockfilePath: string; readonly failOn: readonly SurfaceDiffCategory[]; readonly frozen: boolean; readonly summary: { readonly breaking: number; readonly authorityWidening: number; readonly contextRegression: number; readonly additive: number; readonly promptTokenDelta: number; }; readonly surfaces: readonly SurfaceEntryDiff[]; readonly nextCommand?: string; } interface DiffSurfaceOptions { readonly failOn?: readonly SurfaceDiffCategory[]; readonly frozen?: boolean; readonly maxTokenDelta?: number; readonly maxCatalogTokens?: number; readonly bloatedToolSchemaTokens?: number; readonly bloatedToolGrowthTokens?: number; readonly lockfilePath?: string; } interface BuildLockedSurfaceEntryInput { readonly functionName: string; readonly profile?: string; readonly serverName: string; readonly authMode?: SurfaceAuthMode; readonly anonAccessible?: boolean; readonly tools: readonly unknown[]; readonly toolAuthority?: Readonly>; } /** * Builds a canonical, deterministic `LockedSurfaceEntry` whose `contentDigest` * matches `SupabaseMcpSurfaceProof.contentDigest` emitted by `onSurface` bit-for-bit. */ declare function buildLockedSurfaceEntry(input: BuildLockedSurfaceEntryInput): Promise; declare function surfaceLockKey(functionName: string, profile?: string): string; declare function diffLockedSurfaceEntries(surfaceKey: string, baseline: LockedSurfaceEntry | null, candidate: LockedSurfaceEntry | null, options?: DiffSurfaceOptions): SurfaceEntryDiff; declare function diffSurfaceSnapshots(baseline: McpSurfaceLockfileV1 | Readonly>, candidate: McpSurfaceLockfileV1 | Readonly>, options?: DiffSurfaceOptions): SurfaceDiffReport; //#endregion export { BuildLockedSurfaceEntryInput, DiffSurfaceOptions, LockedSurfaceContextBudget, LockedSurfaceEntry, LockedToolAuthorityMeta, McpSurfaceLockfileV1, SURFACE_DIFF_DEFAULTS, SurfaceAuthMode, SurfaceDiffCategory, SurfaceDiffFinding, SurfaceDiffReport, SurfaceDiffRuleCode, SurfaceEntryDiff, SurfaceSnapshotReport, buildLockedSurfaceEntry, diffLockedSurfaceEntries, diffSurfaceSnapshots, surfaceLockKey }; //# sourceMappingURL=surface-diff.d.ts.map