import { BosConfig } from "../../types.cjs";
import { z } from "zod";
//#region src/services/lockfile/schema.d.ts
declare const LOCKFILE_NAME = "bos.lock.json";
/** A frozen remote coordinate. `descriptor` mirrors the release manifest's
 * remote entry — `digest` (the immutable manifest pointer), a direct entry
 * `integrity` (digest-less fixed-name remotes), and the `base` they resolve
 * against; fields are individually optional because the freeze is faithful to
 * what the config carries, not to what a producer wishes it carried.
 * `pluginRef` freezes a bare plugin reference (`plugins.<id>: "<key>"`). */
declare const LockfileRemoteSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
  kind: z.ZodLiteral<"descriptor">;
  base: z.ZodOptional<z.ZodString>;
  digest: z.ZodOptional<z.ZodObject<{
    manifest: z.ZodString;
    integrity: z.ZodString;
  }, z.core.$strip>>;
  integrity: z.ZodOptional<z.ZodString>;
}, z.core.$strict>, z.ZodObject<{
  kind: z.ZodLiteral<"pluginRef">;
  ref: z.ZodString;
}, z.core.$strict>], "kind">;
type LockfileRemote = z.infer<typeof LockfileRemoteSchema>;
declare const CompositionLockfileSchema: z.ZodObject<{
  schemaVersion: z.ZodLiteral<2>;
  kind: z.ZodLiteral<"everything-dev/composition-lockfile">;
  runtimeRef: z.ZodString;
  release: z.ZodNullable<z.ZodString>;
  remotes: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
    kind: z.ZodLiteral<"descriptor">;
    base: z.ZodOptional<z.ZodString>;
    digest: z.ZodOptional<z.ZodObject<{
      manifest: z.ZodString;
      integrity: z.ZodString;
    }, z.core.$strip>>;
    integrity: z.ZodOptional<z.ZodString>;
  }, z.core.$strict>, z.ZodObject<{
    kind: z.ZodLiteral<"pluginRef">;
    ref: z.ZodString;
  }, z.core.$strict>], "kind">>;
  sharedSingletons: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
  contracts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
  template: z.ZodOptional<z.ZodObject<{
    syncedAt: z.ZodString;
    files: z.ZodRecord<z.ZodString, z.ZodString>;
  }, z.core.$strict>>;
  pointerDigest: z.ZodString;
  resolvedAt: z.ZodString;
}, z.core.$strict>;
type CompositionLockfile = z.infer<typeof CompositionLockfileSchema>;
declare function lockfilePath(configDir?: string): string;
/** The load-side identity check: recompute the pointer digest from the
 * stored `remotes` record (insertion order — JSON round-trips preserve it)
 * and compare. A mismatch means the file was hand-edited or written by a
 * different digest implementation — refuse, loud. */
declare function lockfilePointerDigest(lock: CompositionLockfile): string;
declare function lockfileOf(input: {
  account: string;
  gateway: string;
  config: BosConfig;
  release?: string | null;
  sharedSingletons?: Record<string, string>;
  contracts?: Record<string, string>;
  resolvedAt?: string;
}): CompositionLockfile;
declare function serializeLockfile(lock: CompositionLockfile): string;
/** The lockfile's content digest — what a deployment record names when it
 * answers "what exact composition was live". Producers serialize `lockfileOf`
 * output, which never carries the `template` annotation, so the digest stays
 * a composition identity even when the on-disk file carries a baseline. */
declare function digestOfLockfile(serialized: string): string;
declare function parseLockfile(bytes: string): CompositionLockfile;
/** The sync producer for the deploy train (its publish path is sync-fs):
 * atomic temp + rename, parent dirs created. Carries the `template`
 * annotation forward from the existing file. */
declare function writeLockfileSync(lock: CompositionLockfile, configDir?: string): string;
/** Absent or unparseable → null: the lockfile is an input, and a corrupt one
 * degrades the explainer's provenance rather than failing a build. */
declare function readLockfileIfExists(configDir?: string): Promise<CompositionLockfile | null>;
interface LockWriteResult {
  status: "written" | "unchanged" | "drift";
  path: string;
  pointerDigest: string;
  /** The `--check` refusal reasons — empty unless status is "drift". */
  drift: string[];
}
/** The producer seam both writers share (`bos lock`, and the deploy train's
 * post-publish leg): freeze the resolved composition, atomically, with the
 * `--check` refusal the CI gate exits on. */
declare function writeLockfile(lock: CompositionLockfile, configDir?: string, opts?: {
  check?: boolean;
}): Promise<LockWriteResult>;
//#endregion
export { CompositionLockfile, CompositionLockfileSchema, LOCKFILE_NAME, LockWriteResult, LockfileRemote, LockfileRemoteSchema, digestOfLockfile, lockfileOf, lockfilePath, lockfilePointerDigest, parseLockfile, readLockfileIfExists, serializeLockfile, writeLockfile, writeLockfileSync };
//# sourceMappingURL=schema.d.cts.map