import { z } from "zod"; import { AihError } from "../errors.js"; export declare const BindingWriteSchema: z.ZodObject<{ path: z.ZodString; mechanism: z.ZodEnum<{ file: "file"; "json-pointer": "json-pointer"; "mcp-server": "mcp-server"; }>; contentDigest: z.ZodString; }, z.core.$strict>; export declare const BindingOwnershipEntrySchema: z.ZodObject<{ kind: z.ZodEnum<{ file: "file"; "json-pointer": "json-pointer"; "mcp-server": "mcp-server"; }>; target: z.ZodString; preExisting: z.ZodUnion; }, z.core.$strict>, z.ZodObject<{ value: z.ZodUnknown; }, z.core.$strict>]>; applied: z.ZodUnknown; postApplyDigest: z.ZodString; }, z.core.$strict>; export declare const BindingLockSchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<1>; declaration: z.ZodObject<{ schemaVersion: z.ZodLiteral<1>; framework: z.ZodObject<{ id: z.ZodEnum<{ ecc: "ecc"; superpowers: "superpowers"; }>; mode: z.ZodOptional>; host: z.ZodEnum<{ claude: "claude"; }>; features: z.ZodOptional>; }, z.core.$strict>; source: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"git">; repository: z.ZodString; commitSha: z.ZodString; treeDigest: z.ZodString; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"npm">; package: z.ZodString; exactVersion: z.ZodString; integrity: z.ZodString; }, z.core.$strict>], "kind">; }, z.core.$strict>; writes: z.ZodArray; contentDigest: z.ZodString; }, z.core.$strict>>; scannedDigest: z.ZodString; loadedDigest: z.ZodString; match: z.ZodBoolean; ownership: z.ZodArray; target: z.ZodString; preExisting: z.ZodUnion; }, z.core.$strict>, z.ZodObject<{ value: z.ZodUnknown; }, z.core.$strict>]>; applied: z.ZodUnknown; postApplyDigest: z.ZodString; }, z.core.$strict>>; }, z.core.$strict>; /** * A v3.4 GStack receipt remains readable only by removal/drift code. It is not * a binding declaration: normal lock reads, writes, selection, and provisioning * continue to reject GStack with the one migration diagnostic. Keeping this * narrow local record lets conservative D18 cleanup restore only receipt-proven * AIH-owned state after an upgrade. */ declare const LegacyGstackBindingLockSchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<1>; declaration: z.ZodObject<{ schemaVersion: z.ZodLiteral<1>; framework: z.ZodObject<{ id: z.ZodLiteral<"gstack">; mode: z.ZodOptional; host: z.ZodLiteral<"claude">; features: z.ZodOptional>; }, z.core.$strict>; source: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"git">; repository: z.ZodString; commitSha: z.ZodString; treeDigest: z.ZodString; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"npm">; package: z.ZodString; exactVersion: z.ZodString; integrity: z.ZodString; }, z.core.$strict>], "kind">; }, z.core.$strict>; writes: z.ZodArray; contentDigest: z.ZodString; }, z.core.$strict>>; scannedDigest: z.ZodString; loadedDigest: z.ZodString; match: z.ZodBoolean; ownership: z.ZodArray; target: z.ZodString; preExisting: z.ZodUnion; }, z.core.$strict>, z.ZodObject<{ value: z.ZodUnknown; }, z.core.$strict>]>; applied: z.ZodUnknown; postApplyDigest: z.ZodString; }, z.core.$strict>>; }, z.core.$strict>; export type BindingWrite = z.infer; export type BindingOwnershipEntry = z.infer; export type BindingLock = z.infer; type LegacyGstackBindingLock = z.infer; export type BindingLockForRemoval = BindingLock | LegacyGstackBindingLock; export type BindingLockRead = { present: true; lock: BindingLock; } | { present: false; }; export type BindingLockReadForRemoval = { present: true; lock: BindingLockForRemoval; } | { present: false; }; export type BindingRemovalPlan = { mode: "apply"; lock: BindingLockForRemoval; } | { mode: "drift-report-only"; reason: string; }; /** Corrupt or schema-invalid machine-state lock — fail closed, never guess. */ export declare class BindingLockError extends AihError { constructor(message: string); } export declare function parseBindingLock(value: unknown): BindingLock; export declare function bindingDir(root: string): string; export declare function bindingLockPath(root: string): string; /** Read a current supported binding receipt; legacy GStack receipts fail closed. */ export declare function readBindingLock(root: string): BindingLockRead; /** * Read a receipt exclusively for conservative removal or ownership-drift * reporting. This is the sole migration exception: an exact old GStack receipt * is never selected, provisioned, verified, rewritten, or treated as current * configuration, but its recorded ownership may still be reconciled safely. */ export declare function readBindingLockForRemoval(root: string): BindingLockReadForRemoval; /** * Atomically write the lock (validate -> temp file with owner-only mode -> rename), * mirroring the ECC ledger writer. The rename is retried through the transient * Windows lock window. */ export declare function writeBindingLockAtomic(root: string, lock: BindingLock): void; /** * Decide how removal must proceed (W3 executes it). A MISSING lock degrades to * drift-report-only — conservative removal never guess-deletes state it has no * applied-value record for (ruling 3). A corrupt lock propagates the fail-closed * {@link BindingLockError} from {@link readBindingLock} for the same reason. */ export declare function planBindingRemoval(root: string): BindingRemovalPlan; export {};