@prisma/orm-toolchain 8.0.0-rc.3-dev.2 → 8.0.0-rc.3-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ref-BSRf-7Uh-JmET-ptm.mjs","names":["errorConfigValidation"],"sources":["../../../../1-framework/3-tooling/cli/dist/ref-BSRf-7Uh.mjs"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { emit, getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { CliStructuredError, CliStructuredError as CliStructuredError$1, errorConfigValidation, errorContractConfigMissing, errorContractValidationFailed, errorDatabaseConnectionRequired, errorDriverRequired, errorFileNotFound, errorMigrationPlanningFailed, errorTargetMigrationNotSupported, errorUnexpected } from \"@internal/errors/control\";\nimport { APP_SPACE_ID, createControlStack, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaSubjectClassifier, hasSchemaView } from \"@internal/framework-components/control\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { mergeCapabilityMatrices } from \"@internal/framework-components/components\";\nimport { errorConsentPlanMismatch, errorDestructiveChanges, errorHashMismatch, errorMarkerMissing, errorRunnerFailed, errorRuntime, errorTargetMismatch } from \"@internal/errors/execution\";\nimport \"@internal/errors/migration\";\nimport { allStorageElementsExternal, buildFabricatedMigrationEdge, collectAggregateNamespaces, loadContractSpaceAggregate, planMigration, requireHeadRef, resolveRecordedPath, verifyMigration } from \"@internal/migration-tools/aggregate\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError, errorContractDeserializationFailed, errorInvalidRefName, errorNoInvariantPath, errorUnknownInvariant } from \"@internal/migration-tools/errors\";\nimport { APP_SPACE_ID as APP_SPACE_ID$1, emitContractSpaceArtifacts, isValidSpaceId, listContractSpaceDirectories, planAllSpaces, readContractSpaceHeadRef, spaceMigrationDirectory, spaceRefsDirectory } from \"@internal/migration-tools/spaces\";\nimport { basename, dirname, isAbsolute, join, relative, resolve } from \"pathe\";\nimport { createHash } from \"node:crypto\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { assertHashIsGraphNode, findLatestMigration, findPath, findPathWithDecision, isGraphNode } from \"@internal/migration-tools/migration-graph\";\nimport { abortable } from \"@internal/utils/abortable\";\nimport { createImportSpecifierResolver, importRootForDependencies, internalImportRoot } from \"@internal/publish-surface/import-roots\";\nimport { resolve as resolve$1 } from \"node:path\";\nimport { contractSnapshotDir, readContractSnapshotJson, snapshotsImportPathFrom, writeContractSnapshot } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { HEAD_REF_NAME, deleteRef, readRefs, refsByContractHash, validateRefName, validateRefValue, writeRef } from \"@internal/migration-tools/refs\";\nimport { parseContractRef, parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\nimport { computeMigrationHash, verifyMigrationHash } from \"@internal/migration-tools/hash\";\nimport { formatMigrationDirName, materialiseExtensionMigrationPackageIfMissing, writeMigrationPackage } from \"@internal/migration-tools/io\";\nimport { writeMigrationTs } from \"@internal/migration-tools/migration-ts\";\nimport { deriveProvidedInvariants } from \"@internal/migration-tools/invariants\";\n//#region src/utils/next-actions.ts\n/**\n* The typed remediation the CLI attaches to its own errors and findings.\n* Constructors live here rather than in any library the CLI calls: naming a\n* runnable invocation is something only the CLI can do.\n*/\nfunction runCommandAction(label, command) {\n\treturn {\n\t\tkind: \"run-command\",\n\t\tlabel,\n\t\tcommand\n\t};\n}\n/** Advice the user acts on themselves — there is no command to run. */\nfunction chooseAction(label) {\n\treturn {\n\t\tkind: \"user-choice\",\n\t\tlabel\n\t};\n}\n//#endregion\n//#region src/utils/cli-errors.ts\n/**\n* A CLI-raised error that carries the typed remediation as well as the prose.\n* Only the CLI knows which invocation fixes a failure, so only errors raised\n* here spell one; the foundation classes every library also raises keep\n* carrying `code`, `why` and `fix` alone.\n*\n* Both fields are required: the `fix` prose is what the commander shell still\n* renders, and the handler boundary drops it in favour of `nextActions` when it\n* settles the engine's envelope.\n*/\nvar ActionableCliError = class extends CliStructuredError$1 {\n\tnextActions;\n\tconstructor(code, summary, options) {\n\t\tsuper(code, summary, options);\n\t\tthis.nextActions = options.nextActions;\n\t}\n};\n/**\n* A command that accepts a contract reference both as a positional and as a\n* flag was given both. Structured rather than a bare stderr line, so a script\n* sees the same envelope every other invocation failure produces.\n*/\nfunction errorContractArgConflict(options) {\n\tconst fix = \"Pass the contract reference once — either as the positional argument or as --contract.\";\n\treturn new ActionableCliError(\"CLI.CONTRACT_ARG_CONFLICT\", \"Cannot specify both a positional contract argument and --contract\", {\n\t\twhy: `The positional argument names \"${options.positional}\" and --contract names \"${options.flag}\"; there is no rule for which wins.`,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tpositional: options.positional,\n\t\t\tflag: options.flag\n\t\t}\n\t});\n}\nfunction errorRefSetHashNotInGraph(resolvedHash, reachableHashes, graphTipHash) {\n\tconst reachableList = reachableHashes.length > 0 ? reachableHashes.join(\", \") : \"(none — migration graph is empty)\";\n\tconst fix = reachableHashes.length > 0 ? graphTipHash !== null ? `Set the ref to a graph-node hash such as ${graphTipHash}, or run \\`prisma-cli migration plan\\` to extend the graph.` : \"Set the ref to a hash that appears in the migration graph.\" : \"Run `prisma-cli migration plan` first.\";\n\tconst nextActions = reachableHashes.length > 0 ? graphTipHash !== null ? [chooseAction(`Set the ref to a graph-node hash such as ${graphTipHash}`), runCommandAction(\"Extend the migration graph\", \"prisma-cli migration plan\")] : [chooseAction(\"Set the ref to a hash that appears in the migration graph\")] : [runCommandAction(\"Plan the first migration\", \"prisma-cli migration plan\")];\n\treturn new ActionableCliError(\"MIGRATION.HASH_NOT_IN_GRAPH\", `Resolved contract hash is not in the migration graph: ${resolvedHash}`, {\n\t\twhy: reachableHashes.length > 0 ? `The migration graph reaches ${reachableList}; resolved ${resolvedHash} isn't a graph node.` : \"The migration graph is empty — no hashes reachable.\",\n\t\tfix,\n\t\tnextActions,\n\t\tmeta: {\n\t\t\tresolvedHash,\n\t\t\treachableHashes: [...reachableHashes],\n\t\t\t...graphTipHash !== null ? { graphTipHash } : {}\n\t\t}\n\t});\n}\nfunction errorRefSetEmptySentinel(hash) {\n\treturn new ActionableCliError(\"MIGRATION.REF_SET_EMPTY_SENTINEL\", `Cannot set ref to the empty-database sentinel: ${hash}`, {\n\t\twhy: \"The empty-database sentinel is a planner internal; it is not a valid ref target.\",\n\t\tfix: \"Set the ref to a contract hash from the migration graph, or use another ref name.\",\n\t\tnextActions: [chooseAction(\"Set the ref to a contract hash from the migration graph\"), chooseAction(\"Or use another ref name\")],\n\t\tmeta: { hash }\n\t});\n}\n/**\n* `--legend` was combined with a machine-readable or silent output flag.\n* The legend is human-only decoration on stderr.\n*/\nfunction errorLegendHumanOnly(conflictingFlag) {\n\treturn new ActionableCliError(\"MIGRATION.LEGEND_HUMAN_ONLY\", \"`--legend` is only available for human-readable output\", {\n\t\twhy: `\\`--legend\\` prints a glyph key to stderr and cannot be combined with ${conflictingFlag}.`,\n\t\tfix: `Omit ${conflictingFlag} to print the legend alongside the tree, or omit --legend when using ${conflictingFlag}.`,\n\t\tnextActions: [chooseAction(`Omit ${conflictingFlag} to print the legend alongside the tree`), chooseAction(`Or omit --legend when using ${conflictingFlag}`)],\n\t\tmeta: { conflictingFlag }\n\t});\n}\n/**\n* `--space <id>` was given a value that doesn't satisfy the contract-space\n* naming rule (`[a-z][a-z0-9_-]{0,63}` per `isValidSpaceId`). Fires before\n* any fs work — the input is syntactically rejected the same way an on-disk\n* directory with that name would be skipped by the enumerator.\n*/\nfunction errorInvalidSpaceId(spaceId) {\n\treturn new ActionableCliError(\"MIGRATION.INVALID_SPACE_ID\", `Invalid contract space id: ${spaceId}`, {\n\t\twhy: \"Contract space ids must match [a-z][a-z0-9_-]{0,63} (lowercase, starts with a letter, max 64 characters — the rule applied to every on-disk space directory).\",\n\t\tfix: \"Pass a space id that matches the directory naming rule, or omit --space to list every space.\",\n\t\tnextActions: [chooseAction(\"Pass a space id matching [a-z][a-z0-9_-]{0,63}\"), runCommandAction(\"Or list every space\", \"prisma-cli migration list\")],\n\t\tmeta: { spaceId }\n\t});\n}\n/**\n* `migration list --space <id>` was given a contract-space id that has no\n* directory under `migrations/`. Distinct from \"the space exists but is\n* empty\" — that path renders the empty-state line and exits 0 per the\n* slice spec § Empty-state. This error fires only when `<projectMigrationsDir>/<spaceId>`\n* does not exist on disk.\n*\n* `availableSpaces` lists the contract-space directory names actually\n* present, sorted lex-asc, so the diagnostic can suggest a near match\n* without making the user reach for `ls`.\n*/\nfunction errorSpaceNotFound(spaceId, availableSpaces) {\n\tconst availableList = availableSpaces.length > 0 ? availableSpaces.join(\", \") : \"(none — no contract spaces on disk yet)\";\n\tconst fix = availableSpaces.length > 0 ? `Pick one of: ${availableList}. Run \\`prisma-cli migration list\\` (no --space) to see every space's migrations.` : \"Author a migration with `prisma-cli migration new` to create the first contract-space directory.\";\n\tconst nextActions = availableSpaces.length > 0 ? [chooseAction(`Pick one of: ${availableList}`), runCommandAction(\"See every space's migrations\", \"prisma-cli migration list\")] : [runCommandAction(\"Author the first migration, which creates the contract-space directory\", \"prisma-cli migration new\")];\n\treturn new ActionableCliError(\"MIGRATION.SPACE_NOT_FOUND\", `Unknown contract space: ${spaceId}`, {\n\t\twhy: `No directory named \"${spaceId}\" exists under the migrations root.`,\n\t\tfix,\n\t\tnextActions,\n\t\tmeta: {\n\t\t\tspaceId,\n\t\t\tavailableSpaces: [...availableSpaces]\n\t\t}\n\t});\n}\n/**\n* A `migration show` target resolved to a directory or a graph node, but no\n* on-disk package was loaded for it.\n*/\nfunction errorMigrationPackageNotFound(why) {\n\treturn new ActionableCliError(\"MIGRATION.PACKAGE_NOT_FOUND\", \"Migration package not found\", {\n\t\twhy,\n\t\tfix: \"Pass a directory name, hash prefix, or path to an on-disk app-space migration package.\",\n\t\tnextActions: [chooseAction(\"Pass a directory name, hash prefix, or path to an on-disk app-space migration package\"), runCommandAction(\"List what is on disk\", \"prisma-cli migration list\")]\n\t});\n}\n/** The app space has no migration packages at all, so no target can resolve. */\nfunction errorNoMigrations(appMigrationsRelative) {\n\treturn new ActionableCliError(\"MIGRATION.NO_MIGRATIONS\", \"No migrations found\", {\n\t\twhy: `No migration packages found in ${appMigrationsRelative}`,\n\t\tfix: \"Run `prisma-cli migration plan` to create a migration first.\",\n\t\tnextActions: [runCommandAction(\"Create the first migration\", \"prisma-cli migration plan\")]\n\t});\n}\nfunction errorRefSetBundleNotFound(hash) {\n\treturn new ActionableCliError(\"MIGRATION.REF_SET_BUNDLE_NOT_FOUND\", `No migration bundle matches graph-node hash ${hash}`, {\n\t\twhy: `The hash is a graph node but no on-disk bundle has metadata.to = ${hash}.`,\n\t\tfix: \"Run `pnpm fixtures:check`, or re-emit the migration that produces this hash so its bundle is restored.\",\n\t\tnextActions: [runCommandAction(\"Restore the checked-in fixtures\", \"pnpm fixtures:check\"), chooseAction(\"Or re-emit the migration that produces this hash\")],\n\t\tmeta: { hash }\n\t});\n}\nfunction errorPlanForgotTheFlag(resolvedHash, reachableRefs, graphTipHash, options) {\n\tconst reachableList = reachableRefs.length > 0 ? reachableRefs.map((r) => `${r.name} (${r.hash})`).join(\", \") : \"(none)\";\n\tconst refFix = reachableRefs.length > 0 ? `Run migration plan with ${reachableRefs.map((r) => `--from ${r.name}`).join(\" or \")}.` : graphTipHash !== null ? `Run migration plan --from ${graphTipHash}.` : \"Commit pending migrations first, then run migration plan.\";\n\tconst nextActions = reachableRefs.length > 0 ? reachableRefs.map((ref) => runCommandAction(`Plan from ${ref.name}`, `prisma-cli migration plan --from ${ref.name}`)) : graphTipHash !== null ? [runCommandAction(\"Plan from the graph tip\", `prisma-cli migration plan --from ${graphTipHash}`)] : [chooseAction(\"Commit pending migrations first, then run migration plan\")];\n\treturn new ActionableCliError(\"MIGRATION.HASH_NOT_IN_GRAPH\", `Resolved from-hash is not in the migration graph: ${resolvedHash}`, {\n\t\twhy: `The migration graph reaches ${reachableList}; resolved ${resolvedHash} isn't a graph node.`,\n\t\tfix: refFix,\n\t\tnextActions,\n\t\tmeta: {\n\t\t\tresolvedHash,\n\t\t\treachableRefs: reachableRefs.map((r) => r.name),\n\t\t\t...graphTipHash !== null ? { graphTipHash } : {}\n\t\t},\n\t\t...ifDefined(\"cause\", options?.cause)\n\t});\n}\n/**\n* `viaRef: true` (the default) mirrors migration-tools' `errorRefNotResolvable`:\n* a ref name with no pointer file, where the fallback hash isn't a graph\n* node either — there's nothing to materialize a contract from.\n* `viaRef: false` is a distinct, ref-independent case: an explicit `--from\n* <hash>` that doesn't name a ref, on an empty migration graph, so there is\n* no graph node and no ref to resolve a contract through.\n*/\nfunction errorSnapshotMissing(identifier, options) {\n\tconst viaRef = options?.viaRef !== false;\n\tconst fix = viaRef ? `Create the ref with \"prisma-cli ref set ${identifier} <hash>\" (or advance it via \"prisma-cli db update --advance-ref ${identifier}\"), or pass a hash that is a node in the migration graph.` : `No contract source exists for hash \"${identifier}\" on an empty migration graph. Use --from with a ref name (its contract resolves through the snapshot store), or run db update first.`;\n\tconst nextActions = viaRef ? [\n\t\trunCommandAction(`Create the ref \"${identifier}\"`, `prisma-cli ref set ${identifier} <hash>`),\n\t\trunCommandAction(\"Or advance it from the database\", `prisma-cli db update --advance-ref ${identifier}`),\n\t\tchooseAction(\"Or pass a hash that is a node in the migration graph\")\n\t] : [chooseAction(\"Pass --from a ref name, whose contract resolves through the snapshot store\"), runCommandAction(\"Or populate the graph first\", \"prisma-cli db update\")];\n\treturn new ActionableCliError(\"MIGRATION.SNAPSHOT_MISSING\", viaRef ? `Ref \"${identifier}\" is not resolvable` : `No contract source for from-hash \"${identifier}\"`, {\n\t\twhy: viaRef ? `Ref \"${identifier}\" has no pointer file, and the hash being resolved is not a node in the migration graph either.` : `Hash \"${identifier}\" is not a node in the migration graph (the graph is empty), and it does not name a ref either.`,\n\t\tfix,\n\t\tnextActions,\n\t\tmeta: {\n\t\t\tidentifier,\n\t\t\tviaRef\n\t\t},\n\t\t...ifDefined(\"cause\", options?.cause)\n\t});\n}\nfunction errorMarkerMismatch(markerHash, reachableHashes, graphTip) {\n\tconst reachableList = reachableHashes.length > 0 ? reachableHashes.join(\", \") : \"(none — migration graph is empty)\";\n\tconst planFromFix = graphTip !== null ? `Run \\`prisma-cli migration plan --from ${graphTip}\\` if the live marker is canonical and the on-disk graph needs catching up.` : \"Run `prisma-cli migration plan` if the live marker is canonical and the on-disk graph needs catching up.\";\n\tconst planCommand = graphTip !== null ? `prisma-cli migration plan --from ${graphTip}` : \"prisma-cli migration plan\";\n\treturn new ActionableCliError(\"MIGRATION.MARKER_MISMATCH\", \"Database marker is not reachable in the on-disk migration graph\", {\n\t\twhy: `DB marker is ${markerHash}, but the on-disk migration graph reaches: ${reachableList}.`,\n\t\tfix: [\n\t\t\tplanFromFix,\n\t\t\t`Run \\`prisma-cli ref set db ${markerHash}\\` if the on-disk graph is canonical and the local \\`db\\` ref drifted.`,\n\t\t\t\"Investigate whether the database was migrated by an out-of-band process.\"\n\t\t].join(\"\\n\"),\n\t\tnextActions: [\n\t\t\trunCommandAction(\"Catch the on-disk graph up to the live marker\", planCommand),\n\t\t\trunCommandAction(\"Point the local db ref at the live marker\", `prisma-cli ref set db ${markerHash}`),\n\t\t\tchooseAction(\"Investigate whether the database was migrated by an out-of-band process\")\n\t\t],\n\t\tmeta: {\n\t\t\tmarkerHash,\n\t\t\treachableHashes: [...reachableHashes],\n\t\t\t...graphTip !== null ? { graphTip } : {}\n\t\t}\n\t});\n}\nconst ROLLBACK_IS_DESTRUCTIVE = \"A rollback (reverse) plan is expected to contain destructive (DROP) operations — review them before applying\";\nconst NARROWER_CASES_NEED_A_HINT = \"Narrower cases (rename inference, re-adding a required field without a safe default, or a type change that needs data) may additionally need a hint in the planned migration\";\nfunction errorPathUnreachable(failure) {\n\tconst meta = failure.meta ?? {};\n\tconst fromHashMeta = typeof meta[\"fromHash\"] === \"string\" ? meta[\"fromHash\"] : null;\n\tconst planFromHash = fromHashMeta === \"<empty>\" ? null : fromHashMeta;\n\tconst targetHash = typeof meta[\"targetHash\"] === \"string\" ? meta[\"targetHash\"] : typeof meta[\"target\"] === \"string\" ? meta[\"target\"] : null;\n\tconst deadEnds = meta[\"deadEnds\"];\n\tconst deadEndsSuffix = Array.isArray(deadEnds) && deadEnds.length > 0 ? ` Dead-ends: ${deadEnds.map(String).join(\", \")}.` : \"\";\n\tconst neverPlanned = meta[\"kind\"] === \"neverPlanned\";\n\tconst planCommand = (() => {\n\t\tif (neverPlanned) return \"prisma-cli migration plan --name <slug>\";\n\t\tif (planFromHash !== null && targetHash !== null) return `prisma-cli migration plan --from ${planFromHash} --to ${targetHash} --name <slug>`;\n\t\tif (targetHash !== null) return `prisma-cli migration plan --to ${targetHash} --name <slug>`;\n\t\tif (planFromHash !== null) return `prisma-cli migration plan --from ${planFromHash} --name <slug>`;\n\t\treturn \"prisma-cli migration plan\";\n\t})();\n\tconst applyCommand = targetHash !== null && !neverPlanned ? `prisma-cli migrate --to ${targetHash}` : \"prisma-cli migrate\";\n\treturn new ActionableCliError(\"MIGRATION.PATH_UNREACHABLE\", failure.summary, {\n\t\twhy: failure.why ?? `Cannot reach target \"${targetHash ?? \"<unknown>\"}\" from current marker \"${fromHashMeta ?? \"<unknown>\"}\".${deadEndsSuffix}`,\n\t\tfix: [\n\t\t\t\"Plan the missing edge, then apply it:\",\n\t\t\t` 1. ${planCommand}`,\n\t\t\t` 2. ${applyCommand}`,\n\t\t\t`${ROLLBACK_IS_DESTRUCTIVE}.`,\n\t\t\t`${NARROWER_CASES_NEED_A_HINT}.`,\n\t\t\t\"Inspect the on-disk graph with `prisma-cli migration list`, or `prisma-cli migration show <bundle>` for any bundle in the path you expected.\"\n\t\t].join(\"\\n\"),\n\t\tnextActions: [\n\t\t\trunCommandAction(\"Plan the missing edge\", planCommand),\n\t\t\trunCommandAction(\"Apply it\", applyCommand),\n\t\t\tchooseAction(ROLLBACK_IS_DESTRUCTIVE),\n\t\t\tchooseAction(NARROWER_CASES_NEED_A_HINT),\n\t\t\trunCommandAction(\"Inspect the on-disk graph\", \"prisma-cli migration list\"),\n\t\t\trunCommandAction(\"Inspect a bundle in the path you expected\", \"prisma-cli migration show <bundle>\")\n\t\t],\n\t\tmeta: { ...meta }\n\t});\n}\n/**\n* Shared \"needs a live database\" precondition for read verbs that consult the\n* marker/ledger (`migration log`, `migration status`). A command needs both a\n* connection string and a control-plane driver; either missing yields the same\n* `CONFIG.DB_CONNECTION_REQUIRED` envelope with `meta.missingFlags` (canonical long-form flags\n* per CLI Style Guide §Errors) so callers can react programmatically. Returns\n* `null` when both are present.\n*/\nfunction requireLiveDatabase(args) {\n\tif (args.dbConnection && args.hasDriver) return null;\n\tconst missingFlags = args.dbConnection ? [] : [\"--db\"];\n\treturn errorDatabaseConnectionRequired({\n\t\twhy: args.why,\n\t\tmissingFlags,\n\t\t...ifDefined(\"commandName\", args.commandName),\n\t\t...ifDefined(\"retryCommand\", args.retryCommand)\n\t});\n}\n/**\n* Maps a `RefResolutionError` from the contract/migration reference\n* resolver into a CLI structured error envelope.\n*/\n/**\n* A migration ref (dirName or hash-prefix) resolves in more than one contract\n* space. The user must qualify with `--space <id>` to disambiguate.\n*/\nfunction errorAmbiguousMigrationRef(ref, spaceIds) {\n\tconst spaceList = spaceIds.join(\", \");\n\treturn new ActionableCliError(\"MIGRATION.AMBIGUOUS_MIGRATION_REF\", `Ambiguous migration reference: \"${ref}\" resolves in multiple spaces — qualify with --space <id>`, {\n\t\twhy: `\"${ref}\" matches migrations in spaces: ${spaceList}.`,\n\t\tfix: `Qualify with --space <id> to select one space. Available matching spaces: ${spaceList}.`,\n\t\tnextActions: [chooseAction(`Qualify with --space <id>, one of: ${spaceList}`)],\n\t\tmeta: {\n\t\t\tref,\n\t\t\tspaceIds: [...spaceIds]\n\t\t}\n\t});\n}\nfunction mapRefResolutionError(error) {\n\tswitch (error.kind) {\n\t\tcase \"not-found\": {\n\t\t\tconst fix = error.grammar === \"contract\" ? \"Provide a valid contract hash, ref name, or migration directory name.\" : \"Provide a valid migration directory name or migration hash.\";\n\t\t\treturn new ActionableCliError(\"MIGRATION.REF_NOT_FOUND\", `Not a known ${error.grammar} reference: \"${error.input}\"`, {\n\t\t\t\twhy: `No ${error.grammar} matching \"${error.input}\" exists in the migration graph or refs index.`,\n\t\t\t\tfix,\n\t\t\t\tnextActions: [chooseAction(fix)],\n\t\t\t\tmeta: {\n\t\t\t\t\tinput: error.input,\n\t\t\t\t\tgrammar: error.grammar\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tcase \"ambiguous\": return new ActionableCliError(\"MIGRATION.REF_AMBIGUOUS\", `Ambiguous ${error.grammar} reference: \"${error.input}\"`, {\n\t\t\twhy: `\"${error.input}\" matches multiple ${error.grammar}s: ${error.candidates.join(\", \")}`,\n\t\t\tfix: \"Provide a longer prefix or use the full hash to disambiguate.\",\n\t\t\tnextActions: [chooseAction(\"Provide a longer prefix or use the full hash to disambiguate\")],\n\t\t\tmeta: {\n\t\t\t\tinput: error.input,\n\t\t\t\tcandidates: error.candidates,\n\t\t\t\tgrammar: error.grammar\n\t\t\t}\n\t\t});\n\t\tcase \"wrong-grammar\": return new ActionableCliError(\"MIGRATION.REF_WRONG_GRAMMAR\", error.message, {\n\t\t\twhy: error.message,\n\t\t\tfix: error.fix,\n\t\t\tnextActions: [chooseAction(error.fix)],\n\t\t\tmeta: {\n\t\t\t\tinput: error.input,\n\t\t\t\texpectedGrammar: error.expectedGrammar\n\t\t\t}\n\t\t});\n\t\tcase \"invalid-format\": return new ActionableCliError(\"MIGRATION.REF_INVALID_FORMAT\", `Invalid reference format: \"${error.input}\"`, {\n\t\t\twhy: error.reason,\n\t\t\tfix: \"Provide a valid contract hash, ref name, or migration directory name.\",\n\t\t\tnextActions: [chooseAction(\"Provide a valid contract hash, ref name, or migration directory name\")],\n\t\t\tmeta: { input: error.input }\n\t\t});\n\t}\n}\n//#endregion\n//#region src/utils/framework-components.ts\n/**\n* Asserts that all framework components are compatible with the expected family and target.\n*\n* This function validates that each component in the framework components array:\n* - Has kind 'target', 'adapter', 'extension', or 'driver'\n* - Has familyId matching expectedFamilyId\n* - Has targetId matching expectedTargetId\n*\n* This validation happens at the CLI composition boundary, before passing components\n* to typed planner/runner instances. It fills the gap between runtime validation\n* (via the config loader's `collectConfigIssues` diagnostics) and compile-time\n* type enforcement.\n*\n* @param expectedFamilyId - The expected family ID (e.g., 'sql')\n* @param expectedTargetId - The expected target ID (e.g., 'postgres')\n* @param frameworkComponents - Array of framework components to validate\n* @returns The same array typed as TargetBoundComponentDescriptor\n* @throws CliStructuredError if any component is incompatible\n*\n* @example\n* ```ts\n* const configResult = await loadConfigForSections(undefined, ['family', 'target', 'adapter', 'extensions']);\n* const config = configResult.assertOk();\n* const frameworkComponents = [config.target, config.adapter, ...(config.extensions ?? [])];\n*\n* // Validate and type-narrow components before passing to planner\n* const typedComponents = assertFrameworkComponentsCompatible(\n* config.family.familyId,\n* config.target.targetId,\n* frameworkComponents\n* );\n*\n* const planner = target.migrations.createPlanner(familyInstance);\n* planner.plan({ contract, schema, policy, frameworkComponents: typedComponents });\n* ```\n*/\nfunction assertFrameworkComponentsCompatible(expectedFamilyId, expectedTargetId, frameworkComponents) {\n\tfor (let i = 0; i < frameworkComponents.length; i++) {\n\t\tconst component = frameworkComponents[i];\n\t\tif (typeof component !== \"object\" || component === null) throw errorConfigValidation(\"frameworkComponents[]\", { why: `Framework component at index ${i} must be an object` });\n\t\tconst record = component;\n\t\tif (!Object.hasOwn(record, \"kind\")) throw errorConfigValidation(\"frameworkComponents[].kind\", { why: `Framework component at index ${i} must have 'kind' property` });\n\t\tconst kind = record[\"kind\"];\n\t\tif (kind !== \"target\" && kind !== \"adapter\" && kind !== \"extension\" && kind !== \"driver\") throw errorConfigValidation(\"frameworkComponents[].kind\", { why: `Framework component at index ${i} has invalid kind '${String(kind)}' (must be 'target', 'adapter', 'extension', or 'driver')` });\n\t\tif (!Object.hasOwn(record, \"familyId\")) throw errorConfigValidation(\"frameworkComponents[].familyId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'familyId' property` });\n\t\tconst familyId = record[\"familyId\"];\n\t\tif (familyId !== expectedFamilyId) throw errorConfigValidation(\"frameworkComponents[].familyId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) has familyId '${String(familyId)}' but expected '${expectedFamilyId}'` });\n\t\tif (!Object.hasOwn(record, \"targetId\")) throw errorConfigValidation(\"frameworkComponents[].targetId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'targetId' property` });\n\t\tconst targetId = record[\"targetId\"];\n\t\tif (targetId !== expectedTargetId) throw errorConfigValidation(\"frameworkComponents[].targetId\", { why: `Framework component at index ${i} (kind: ${String(kind)}) has targetId '${String(targetId)}' but expected '${expectedTargetId}'` });\n\t}\n\treturn frameworkComponents;\n}\n//#endregion\n//#region src/control-api/contract-enrichment.ts\nfunction isPlainObject(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction sortDeep(value) {\n\tif (Array.isArray(value)) return value.map(sortDeep);\n\tif (!isPlainObject(value)) return value;\n\tconst entries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b));\n\tconst next = {};\n\tfor (const [key, child] of entries) next[key] = sortDeep(child);\n\treturn next;\n}\nfunction sortDeepTyped(value) {\n\treturn sortDeep(value);\n}\nfunction extractExtensionPackMeta(component) {\n\tconst { kind, id, version, capabilities, types } = component;\n\tconst base = {\n\t\tkind,\n\t\tid,\n\t\tfamilyId: component.familyId,\n\t\ttargetId: component.targetId,\n\t\tversion\n\t};\n\tif (capabilities) base[\"capabilities\"] = capabilities;\n\tif (types) if (types.codecTypes) {\n\t\tconst { controlPlaneHooks: _, codecDescriptors: _cd, ...cleanedCodecTypes } = types.codecTypes;\n\t\tbase[\"types\"] = {\n\t\t\t...types,\n\t\t\tcodecTypes: cleanedCodecTypes\n\t\t};\n\t} else base[\"types\"] = types;\n\treturn base;\n}\n/**\n* Enriches a raw contract with framework-derived metadata: capabilities from all component descriptors and extension pack metadata from extension descriptors. Produces deterministically sorted output.\n*/\nfunction enrichContract(ir, components) {\n\tconst mergedCapabilities = mergeCapabilityMatrices(ir.capabilities, components);\n\tconst extensionsMeta = {};\n\tfor (const component of components) if (component.kind === \"extension\") extensionsMeta[component.id] = extractExtensionPackMeta(component);\n\tconst extensions = Object.keys(extensionsMeta).length > 0 ? {\n\t\t...ir.extensions,\n\t\t...extensionsMeta\n\t} : ir.extensions;\n\treturn {\n\t\t...ir,\n\t\tcapabilities: sortDeepTyped(mergedCapabilities),\n\t\textensions: sortDeepTyped(extensions)\n\t};\n}\n//#endregion\n//#region src/utils/command-helpers.ts\n/**\n* Resolves the absolute path to contract.json from the config.\n*/\nfunction resolveContractPath(config) {\n\tif (config.contract?.output === void 0) throw errorRuntime(\"CONFIG.VALIDATION_FAILED\", \"config.contract.output is required to resolve the contract path\", {\n\t\twhy: \"CLI commands read the emitted contract from config.contract.output; the config has no value to read.\",\n\t\tfix: \"Ensure your prisma.config.ts goes through `defineConfig()`, which normalises a default output when the provider supplies an input path, or set `contract.output` explicitly.\"\n\t});\n\treturn resolve(config.contract.output);\n}\n/**\n* Resolves the migrations directory and config path from CLI options.\n* Shared by migrate, migration-plan, and migration-status.\n*\n* - `migrationsDir` is the project's top-level `migrations/` directory\n* (the root that the aggregate loader walks for every contract space).\n* - `appMigrationsDir` is the app subspace directory under it\n* (`<migrationsDir>/<APP_SPACE_ID>/`). Every per-app reader / writer\n* (`migration new`, `migration plan`, `migrate`,\n* `migration status`, `migration show`, `migration ref`) operates on\n* this directory. Extensions own their own `migrations/<spaceId>/`.\n* - `refsDir` is the app's refs directory (`<appMigrationsDir>/refs/`).\n* The framework does not maintain refs at the migrations root.\n*\n* `cwd` is the directory the command was invoked from; every relative path in\n* the result is computed against it.\n*/\nfunction resolveMigrationPaths(configOption, config, cwd) {\n\tconst resolvedConfigPath = configOption ? resolve(cwd, configOption) : void 0;\n\tconst configPath = resolvedConfigPath ? relative(cwd, resolvedConfigPath) : \"prisma.config.ts\";\n\tconst migrationsDir = resolve(resolvedConfigPath ? resolve(resolvedConfigPath, \"..\") : cwd, config.migrations?.dir ?? \"migrations\");\n\tconst migrationsRelative = relative(cwd, migrationsDir);\n\tconst appMigrationsDir = spaceMigrationDirectory(migrationsDir, APP_SPACE_ID$1);\n\treturn {\n\t\tconfigPath,\n\t\tmigrationsDir,\n\t\tmigrationsRelative,\n\t\tappMigrationsDir,\n\t\tappMigrationsRelative: relative(cwd, appMigrationsDir),\n\t\trefsDir: resolve(appMigrationsDir, \"refs\")\n\t};\n}\nfunction collectDeclaredInvariants(graph) {\n\tconst declared = /* @__PURE__ */ new Set();\n\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) for (const inv of edge.invariants) declared.add(inv);\n\treturn declared;\n}\n/**\n* Maps a `MigrationEdge` to the structural-edge shape used in the\n* `MIGRATION.NO_INVARIANT_PATH` error envelope. Shared between\n* `migrate` and `migration status` so both commands surface\n* the same JSON wire shape when an invariant-aware route is unsatisfiable.\n*/\nfunction toStructuralEdge(edge) {\n\treturn {\n\t\tdirName: edge.dirName,\n\t\tmigrationHash: edge.migrationHash,\n\t\tfrom: edge.from,\n\t\tto: edge.to,\n\t\tinvariants: edge.invariants\n\t};\n}\nfunction targetSupportsMigrations(target) {\n\treturn hasMigrations(target);\n}\n/**\n* Hangs up without letting the hang-up decide the command's result. A rejection out of a\n* `finally` replaces the value the `try`/`catch` already returned, so an unguarded close turns a\n* mapped connection error into an unmapped one — and that is the case it hits most, because a\n* `connect()` that failed leaves nothing to close.\n*/\nasync function closeQuietly(client) {\n\ttry {\n\t\tawait client.close();\n\t} catch {}\n}\nfunction getTargetMigrations(target) {\n\treturn hasMigrations(target) ? target.migrations : void 0;\n}\n/**\n* Reads and parses contract.json, validating the framework-level envelope\n* fields (storageHash, schemaVersion, target, targetFamily).\n*\n* Family-specific validation (storage structure, codec mappings, etc.)\n* happens downstream in the control client via the family instance.\n*/\nasync function readContractEnvelope(config) {\n\tconst contractPath = resolveContractPath(config);\n\tconst content = await readFile(contractPath, \"utf-8\");\n\tconst json = JSON.parse(content);\n\tconst { schemaVersion, target, targetFamily, profileHash } = json;\n\tconst storageHash = json[\"storage\"]?.[\"storageHash\"];\n\tif (typeof storageHash !== \"string\") throw new CliStructuredError$1(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing a valid storage.storageHash. Run \\`prisma-cli contract emit\\` to regenerate.`, { where: { path: contractPath } });\n\tif (typeof schemaVersion !== \"string\") throw new CliStructuredError$1(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing schemaVersion.`, { where: { path: contractPath } });\n\tif (typeof target !== \"string\") throw new CliStructuredError$1(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing target.`, { where: { path: contractPath } });\n\tif (typeof targetFamily !== \"string\") throw new CliStructuredError$1(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing targetFamily.`, { where: { path: contractPath } });\n\treturn {\n\t\t...json,\n\t\tstorageHash,\n\t\tschemaVersion,\n\t\ttarget,\n\t\ttargetFamily,\n\t\t...typeof profileHash === \"string\" ? { profileHash } : {}\n\t};\n}\n/**\n* Masks credentials in a database connection URL.\n* Handles standard URLs (username + password + query params) and libpq-style key=value strings.\n*/\nfunction maskConnectionUrl(url) {\n\ttry {\n\t\tconst parsed = new URL(url);\n\t\tif (parsed.username) parsed.username = \"****\";\n\t\tif (parsed.password) parsed.password = \"****\";\n\t\tfor (const key of [...parsed.searchParams.keys()]) if (/password/i.test(key)) parsed.searchParams.set(key, \"****\");\n\t\treturn parsed.toString();\n\t} catch {\n\t\treturn url.replace(/password\\s*=\\s*\\S+/gi, \"password=****\").replace(/user\\s*=\\s*\\S+/gi, \"user=****\");\n\t}\n}\n/**\n* Strips raw connection URL fragments from an error message to prevent credential leakage.\n* Call this before surfacing driver errors to the user.\n*/\nfunction sanitizeErrorMessage(message, connectionUrl) {\n\tif (!connectionUrl) return message;\n\ttry {\n\t\tconst parsed = new URL(connectionUrl);\n\t\tlet sanitized = message;\n\t\tsanitized = sanitized.replaceAll(connectionUrl, maskConnectionUrl(connectionUrl));\n\t\tif (parsed.password) sanitized = sanitized.replaceAll(parsed.password, \"****\");\n\t\tif (parsed.username) sanitized = sanitized.replaceAll(parsed.username, \"****\");\n\t\treturn sanitized;\n\t} catch {\n\t\treturn message.replace(/password\\s*=\\s*\\S+/gi, \"password=****\").replace(/user\\s*=\\s*\\S+/gi, \"user=****\");\n\t}\n}\n//#endregion\n//#region src/utils/extension-pack-inputs.ts\n/**\n* Project the CLI's `Config.extensions` array into the canonical\n* {@link ExtensionPackInput} shape. The single `as ExtensionPackLike`\n* structural cast in the CLI lives inside this function.\n*/\nfunction toExtensionInputs(extensions) {\n\treturn extensions.map((raw) => {\n\t\tconst pack = raw;\n\t\tif (pack.contractSpace === void 0) return {\n\t\t\tid: pack.id,\n\t\t\ttargetId: pack.targetId\n\t\t};\n\t\treturn {\n\t\t\tid: pack.id,\n\t\t\ttargetId: pack.targetId,\n\t\t\tcontractSpace: {\n\t\t\t\tcontractJson: pack.contractSpace.contractJson,\n\t\t\t\theadRef: pack.contractSpace.headRef,\n\t\t\t\tmigrations: pack.contractSpace.migrations ?? []\n\t\t\t}\n\t\t};\n\t});\n}\n/**\n* Minimal aggregate-loader projection that extracts `id` + `targetId`\n* from raw extension pack descriptors **without invoking any\n* `contractSpace` accessor**. Inspects the own-property descriptor so\n* that getter-backed `contractSpace` declarations are detected but\n* never called.\n*\n* Inclusion semantics match {@link toDeclaredExtensions}: a data\n* property whose value is explicitly `undefined` is treated as \"no\n* contract-space declaration\" and skipped, mirroring the\n* `pack.contractSpace === undefined` check used on canonicalised\n* inputs. Prototype-chain `contractSpace` properties (no own\n* descriptor) are also skipped.\n*\n* This variant must be used by `buildContractSpaceAggregate` so that\n* the aggregate path (including `db verify`) never reads\n* `contractSpace.contractJson` from extension descriptors — the loader\n* always reads the contract from on-disk artefacts instead.\n*/\nfunction toDeclaredExtensionsFromRaw(extensions) {\n\tconst entries = [];\n\tfor (const raw of extensions) {\n\t\tif (typeof raw !== \"object\" || raw === null) continue;\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(raw, \"contractSpace\");\n\t\tif (descriptor === void 0) continue;\n\t\tif (\"value\" in descriptor && descriptor.value === void 0) continue;\n\t\tconst pack = raw;\n\t\tentries.push({\n\t\t\tid: pack.id,\n\t\t\ttargetId: pack.targetId\n\t\t});\n\t}\n\treturn entries;\n}\n//#endregion\n//#region src/control-api/operations/contract-space-aggregate-loader.ts\nconst CONTRACT_SPACES_DOCS_URL = \"https://pris.ly/contract-spaces\";\nfunction contractSpaceViolationError(summary, options) {\n\treturn new CliStructuredError$1(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", summary, {\n\t\twhy: options.why,\n\t\tfix: options.fix,\n\t\tdocsUrl: CONTRACT_SPACES_DOCS_URL,\n\t\tmeta: { violations: options.violations }\n\t});\n}\n/**\n* Build the `MIGRATION.CONTRACT_SPACE_VIOLATION` structured-error envelope for a contract-space\n* target mismatch. Shared between the declared-extension precheck (the\n* descriptor's configured target disagrees with the project target) and\n* the on-disk-contract check surfaced by `checkIntegrity`.\n*/\nfunction targetMismatchError(spaceId, expected, actual) {\n\treturn contractSpaceViolationError(`Contract-space target mismatch for \"${spaceId}\"`, {\n\t\twhy: `Space \"${spaceId}\" targets \"${actual}\" but the project's adapter targets \"${expected}\".`,\n\t\tfix: \"Update the extension descriptor to target the configured database, or change the project adapter.\",\n\t\tviolations: [{\n\t\t\tkind: \"targetMismatch\",\n\t\t\tspaceId,\n\t\t\texpected,\n\t\t\tactual\n\t\t}]\n\t});\n}\n/**\n* Human-readable detail for an integrity violation, used as the `why`\n* of the `integrityFailure` envelope. Mirrors the messages the prior\n* throw-on-load loader produced so downstream consumers see the same\n* text for the same on-disk state.\n*/\nfunction describeIntegrityViolation(violation) {\n\tswitch (violation.kind) {\n\t\tcase \"hashMismatch\": return `Migration \"${violation.dirName}\" stored hash \"${violation.stored}\" does not match computed hash \"${violation.computed}\".`;\n\t\tcase \"providedInvariantsMismatch\": return `Migration \"${violation.dirName}\" providedInvariants in migration.json disagrees with ops.json.`;\n\t\tcase \"packageUnloadable\": return `Migration \"${violation.dirName}\" could not be loaded: ${violation.detail}`;\n\t\tcase \"sameSourceAndTarget\": return `Migration \"${violation.dirName}\" has source equal to target (${violation.hash}) with no data invariant — a true no-op self-edge.`;\n\t\tcase \"headRefMissing\": return `Head ref \\`refs/head.json\\` is missing for contract space \"${violation.spaceId}\".`;\n\t\tcase \"headRefNotInGraph\": return `Head ref ${violation.hash} for contract space \"${violation.spaceId}\" is not present in the migration graph.`;\n\t\tcase \"refUnreadable\": return `Ref \"${violation.refName}\" for contract space \"${violation.spaceId}\" is unreadable: ${violation.detail}`;\n\t\tcase \"duplicateMigrationHash\": return `Multiple migrations in space \"${violation.spaceId}\" share migrationHash \"${violation.migrationHash}\" (${violation.dirNames.join(\", \")}).`;\n\t\tdefault: {\n\t\t\tconst spaceId = \"spaceId\" in violation ? violation.spaceId : \"*\";\n\t\t\treturn `Integrity violation \"${violation.kind}\" for contract space \"${spaceId}\".`;\n\t\t}\n\t}\n}\n/**\n* Map the integrity violations `checkIntegrity` reports into a single\n* CLI structured-error envelope, preserving the error codes the prior\n* throw-on-load loader emitted: `MIGRATION.CONTRACT_SPACE_LAYOUT_VIOLATION`\n* (layout drift, bundled) and `MIGRATION.CONTRACT_SPACE_VIOLATION` (target /\n* disjointness / contract-validation / structural integrity). Returns\n* `null` when there is nothing to refuse on.\n*\n* Precedence reproduces the prior loader's first-failure ordering:\n* layout drift first (every offence bundled into one envelope), then\n* target mismatch, then disjointness, then a contract-validation\n* failure, then any remaining structural integrity violation.\n*/\nfunction mapIntegrityViolations(violations) {\n\tif (violations.length === 0) return null;\n\tconst layout = violations.filter((v) => v.kind === \"orphanSpaceDir\" || v.kind === \"declaredButUnmigrated\");\n\tif (layout.length > 0) {\n\t\tconst lines = layout.map((v) => `- [${v.kind}] ${v.spaceId}`);\n\t\treturn new CliStructuredError$1(\"MIGRATION.CONTRACT_SPACE_LAYOUT_VIOLATION\", layout.length === 1 ? \"Contract-space layout violation detected\" : `Contract-space layout violations detected (${layout.length})`, {\n\t\t\twhy: `The on-disk \\`migrations/\\` directory and your \\`extensions\\` declaration are not in agreement.\\n${lines.join(\"\\n\")}`,\n\t\t\tfix: \"Declare the extension in `extensions` and re-emit its contract-space artefacts, or remove the orphan `migrations/<space>` directory.\",\n\t\t\tdocsUrl: CONTRACT_SPACES_DOCS_URL,\n\t\t\tmeta: { violations: layout }\n\t\t});\n\t}\n\tconst targetMismatch = violations.find((v) => v.kind === \"targetMismatch\");\n\tif (targetMismatch && targetMismatch.kind === \"targetMismatch\") return targetMismatchError(targetMismatch.spaceId, targetMismatch.expected, targetMismatch.actual);\n\tconst disjointness = violations.find((v) => v.kind === \"disjointness\");\n\tif (disjointness && disjointness.kind === \"disjointness\") return contractSpaceViolationError(`Contract-space disjointness violation: storage element \"${disjointness.element}\" claimed by multiple spaces`, {\n\t\twhy: `Spaces ${disjointness.claimedBy.map((s) => `\"${s}\"`).join(\", \")} all claim the storage element \"${disjointness.element}\". Each storage element must be owned by exactly one contract space.`,\n\t\tfix: \"Update the conflicting contracts so each storage element is claimed by exactly one space.\",\n\t\tviolations: [disjointness]\n\t});\n\tconst contractUnreadable = violations.find((v) => v.kind === \"contractUnreadable\");\n\tif (contractUnreadable && contractUnreadable.kind === \"contractUnreadable\") return contractSpaceViolationError(`Contract-space contract validation failed for \"${contractUnreadable.spaceId}\"`, {\n\t\twhy: contractUnreadable.detail,\n\t\tfix: \"Re-emit the extension contract with `prisma-cli contract emit`, or fix the extension pack descriptor producing the invalid contract.\",\n\t\tviolations: [contractUnreadable]\n\t});\n\tconst structural = violations[0];\n\treturn contractSpaceViolationError(`Contract-space integrity failure for \"${\"spaceId\" in structural ? structural.spaceId : \"*\"}\"`, {\n\t\twhy: describeIntegrityViolation(structural),\n\t\tfix: \"Re-emit the affected migration package(s) or restore the on-disk `migrations/` directory from version control.\",\n\t\tviolations: [structural]\n\t});\n}\nfunction declaredExtensionsFromInputs(extensions) {\n\treturn toDeclaredExtensionsFromRaw(extensions);\n}\n/**\n* Reject extension descriptors whose configured target disagrees with\n* the project target before any on-disk read.\n*/\nfunction refuseDeclaredExtensionTargetMismatch(inputs) {\n\tfor (const declared of declaredExtensionsFromInputs(inputs.extensions)) if (declared.targetId !== inputs.targetId) return targetMismatchError(declared.id, inputs.targetId, declared.targetId);\n\treturn null;\n}\n/**\n* Load the tolerant {@link ContractSpaceAggregate} once at the CLI\n* surface. Construction never throws on disk content; callers query\n* {@link ContractSpaceAggregate.app} / extension facets instead of\n* re-reading `migrations/`.\n*/\nasync function loadContractSpaceAggregateForCli(inputs) {\n\tconst targetFailure = refuseDeclaredExtensionTargetMismatch(inputs);\n\tif (targetFailure) return notOk(targetFailure);\n\treturn ok(await loadContractSpaceAggregate({\n\t\tmigrationsDir: inputs.migrationsDir,\n\t\tdeserializeContract: inputs.deserializeContract,\n\t\tappContract: inputs.appContract\n\t}));\n}\n/**\n* Run `checkIntegrity` on a loaded aggregate and map violations into\n* the contract-space refusal envelope, or return `null` when the model\n* is acceptable for the requested check scope.\n*/\nfunction refuseContractSpaceIntegrity(aggregate, options) {\n\treturn mapIntegrityViolations(aggregate.checkIntegrity(options));\n}\nconst PACKAGE_CORRUPTION_KINDS = /* @__PURE__ */ new Set([\n\t\"hashMismatch\",\n\t\"providedInvariantsMismatch\",\n\t\"packageUnloadable\"\n]);\n/**\n* Reader-subset integrity refusal for `migration status`: package\n* corruptions only (`hashMismatch`, `providedInvariantsMismatch`,\n* `packageUnloadable`).\n*/\nfunction refusePackageCorruptionOnAggregate(aggregate) {\n\treturn mapIntegrityViolations(aggregate.checkIntegrity().filter((v) => PACKAGE_CORRUPTION_KINDS.has(v.kind)));\n}\n/**\n* Construct the tolerant {@link ContractSpaceAggregate} at the CLI\n* surface and apply the explicit integrity refusal.\n*\n* App-space migration packages are read from `migrations/<app>/` by the\n* loader itself; callers no longer thread them through.\n*/\nasync function buildContractSpaceAggregate(inputs) {\n\tconst declaredExtensions = declaredExtensionsFromInputs(inputs.extensions);\n\tconst loaded = await loadContractSpaceAggregateForCli(inputs);\n\tif (!loaded.ok) return loaded;\n\tconst failure = refuseContractSpaceIntegrity(loaded.value, {\n\t\tdeclaredExtensions,\n\t\tcheckContracts: true\n\t});\n\tif (failure) return notOk(failure);\n\treturn ok(loaded.value);\n}\n/**\n* Build a minimal app {@link Contract} carrying only the project's\n* contract-identity (`storage.storageHash` + `target` / `targetFamily`)\n* when the real `contract.json` is absent or undeserializable.\n*\n* `loadContractSpaceAggregate` requires an `appContract` to synthesise the\n* app space's head ref from its storage hash. Read commands query only that\n* hash and the target — never `models` — so an empty-`models` stand-in is\n* sufficient for them. It is *not* a valid contract for any consumer that\n* reads schema, which is why this is confined to the read-aggregate path.\n*/\nfunction appContractStandInFromIdentity(args) {\n\treturn blindCast({\n\t\tstorage: { storageHash: args.contractHash },\n\t\tschemaVersion: \"0.0.0\",\n\t\ttarget: args.targetId,\n\t\ttargetFamily: args.targetFamily,\n\t\tmodels: {},\n\t\tprofileHash: EMPTY_CONTRACT_HASH\n\t});\n}\nasync function loadContractRawSafely(config) {\n\ttry {\n\t\tconst raw = await readFile(resolveContractPath(config), \"utf-8\");\n\t\treturn JSON.parse(raw);\n\t} catch {\n\t\treturn null;\n\t}\n}\n/**\n* Tolerant {@link ContractSpaceAggregate} assembly for read-only CLI\n* commands. No integrity gate — callers query `aggregate.app` (or other\n* facets) without re-reading `migrations/`. When `contract.json` is absent\n* or undeserializable, the app contract falls back to an identity-only\n* stand-in ({@link appContractStandInFromIdentity}), so these commands\n* load without requiring a readable contract.\n*/\nasync function buildReadAggregate(config, options) {\n\tlet contractHash = EMPTY_CONTRACT_HASH;\n\ttry {\n\t\tcontractHash = (await readContractEnvelope(config)).storageHash;\n\t} catch {}\n\ttry {\n\t\tconst contractRawForAggregate = await loadContractRawSafely(config);\n\t\tconst stack = createControlStack(config);\n\t\tconst familyInstance = config.family.create(stack);\n\t\tconst deserializeContract = (json) => familyInstance.deserializeContract(json);\n\t\tlet appContractForLoad = appContractStandInFromIdentity({\n\t\t\tcontractHash,\n\t\t\ttargetId: config.target.id,\n\t\t\ttargetFamily: config.target.familyId\n\t\t});\n\t\tif (contractRawForAggregate !== null) try {\n\t\t\tappContractForLoad = deserializeContract(contractRawForAggregate);\n\t\t} catch {}\n\t\tconst loaded = await loadContractSpaceAggregateForCli({\n\t\t\ttargetId: config.target.id,\n\t\t\tmigrationsDir: options.migrationsDir,\n\t\t\tappContract: appContractForLoad,\n\t\t\textensions: config.extensions ?? [],\n\t\t\tdeserializeContract\n\t\t});\n\t\tif (!loaded.ok) return loaded;\n\t\treturn ok({\n\t\t\taggregate: loaded.value,\n\t\t\tcontractHash\n\t\t});\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(error);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read migrations directory: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n}\n//#endregion\n//#region src/control-api/operations/migration-helpers.ts\n/**\n* Strips operation objects to their public shape (id, label, operationClass).\n* Used at the API boundary to avoid leaking internal fields (precheck, execute, postcheck, etc.).\n*/\nfunction stripOperations(operations) {\n\treturn operations.map((op) => ({\n\t\tid: op.id,\n\t\tlabel: op.label,\n\t\toperationClass: op.operationClass\n\t}));\n}\n//#endregion\n//#region src/control-api/operations/plan-identity.ts\n/**\n* Content identity of a `db update` plan: what it does (the ordered display\n* operations) and where it lands (the destination storage hash). A\n* `DESTRUCTIVE_CHANGES` refusal names the refused plan by this hash, and the\n* apply that carries the consent back recomputes it to prove it is still\n* applying the plan that was consented to.\n*/\nfunction computePlanHash(plan) {\n\tconst canonical = canonicalizeJson({\n\t\toperations: plan.operations,\n\t\tdestination: { storageHash: plan.destination.storageHash }\n\t});\n\treturn createHash(\"sha256\").update(canonical).digest(\"hex\");\n}\n//#endregion\n//#region src/control-api/operations/run-migration.ts\n/**\n* Span id emitted via `onProgress` for the run phase. Stable\n* identifier consumed by the structured-output renderer and by tests.\n*/\nconst RUN_SPAN_ID = \"apply\";\n/**\n* Runner-driving tail shared by every run caller — `db init`,\n* `db update`, and `migrate`. Consumes already-resolved per-space\n* plans (the planner-vs-replay distinction is owned by the caller) and\n* dispatches them to the runner in canonical order.\n*\n* Marker advancement is part of the runner's per-space transaction\n* (the SQL family runner writes the marker as the last step of each\n* space's transaction), so this primitive does not advance markers\n* separately — by the time `execute` returns ok, every\n* space's marker has been advanced to its plan's destination.\n*\n* Span emission (`spanStart 'apply'` / `spanEnd 'apply'`) is owned here\n* so callers don't have to duplicate it; the `action` field on each\n* progress event is taken from the caller's `action` argument.\n*/\nasync function runMigration(inputs) {\n\tconst { aggregate, perSpacePlans, applyOrder, driver, familyInstance, migrations, frameworkComponents, policy, action, onProgress } = inputs;\n\tconst orderedResolutions = collectOrdered(applyOrder, perSpacePlans);\n\tconst runner = migrations.createRunner(familyInstance);\n\tonProgress?.({\n\t\taction,\n\t\tkind: \"spanStart\",\n\t\tspanId: RUN_SPAN_ID,\n\t\tlabel: progressLabelForAction(action)\n\t});\n\tconst perSpaceOptions = orderedResolutions.map((r) => ({\n\t\tspace: r.spaceId,\n\t\tplan: r.entry.plan,\n\t\tdriver,\n\t\tdestinationContract: r.entry.destinationContract,\n\t\tpolicy,\n\t\tframeworkComponents,\n\t\tmigrationEdges: r.entry.migrationEdges,\n\t\tstrictVerification: false\n\t}));\n\tconst runnerResult = await runner.execute({\n\t\tdriver,\n\t\tperSpaceOptions\n\t});\n\tif (!runnerResult.ok) {\n\t\tonProgress?.({\n\t\t\taction,\n\t\t\tkind: \"spanEnd\",\n\t\t\tspanId: RUN_SPAN_ID,\n\t\t\toutcome: \"error\"\n\t\t});\n\t\treturn notOk({\n\t\t\tsummary: runnerResult.failure.summary,\n\t\t\t...ifDefined(\"why\", runnerResult.failure.why),\n\t\t\tmeta: {\n\t\t\t\t...runnerResult.failure.meta ?? {},\n\t\t\t\tfailingSpace: runnerResult.failure.failingSpace,\n\t\t\t\trunnerErrorCode: runnerResult.failure.code\n\t\t\t},\n\t\t\tcause: runnerResult.failure\n\t\t});\n\t}\n\tonProgress?.({\n\t\taction,\n\t\tkind: \"spanEnd\",\n\t\tspanId: RUN_SPAN_ID,\n\t\toutcome: \"ok\"\n\t});\n\treturn ok({\n\t\torderedResolutions,\n\t\ttotalOpsPlanned: runnerResult.value.perSpaceResults.reduce((sum, r) => sum + r.value.operationsPlanned, 0),\n\t\ttotalOpsExecuted: runnerResult.value.perSpaceResults.reduce((sum, r) => sum + r.value.operationsExecuted, 0),\n\t\tperSpace: buildPerSpaceBreakdown(orderedResolutions, aggregate.app.spaceId, { includeMarkers: true })\n\t});\n}\n/**\n* Project the planner's per-space resolutions into the\n* `PerSpaceExecutionEntry[]` shape the CLI surfaces.\n*\n* `includeMarkers` is `true` for apply-mode (each space's marker is\n* the `destination.storageHash` of its plan, which the runner\n* advances as the last step of each space's transaction) and `false`\n* for plan-mode (no marker has been written yet).\n*\n* Exported alongside {@link runMigration} so plan-mode callers can\n* assemble the same per-space block without going through the runner.\n*/\nfunction buildPerSpaceBreakdown(orderedResolutions, appSpaceId, options) {\n\treturn orderedResolutions.map((r) => {\n\t\tconst operations = r.entry.displayOps.map((op) => ({\n\t\t\tid: op.id,\n\t\t\tlabel: op.label,\n\t\t\toperationClass: op.operationClass\n\t\t}));\n\t\tconst base = {\n\t\t\tspaceId: r.spaceId,\n\t\t\tkind: r.spaceId === appSpaceId ? \"app\" : \"extension\",\n\t\t\toperations\n\t\t};\n\t\tif (!options.includeMarkers) return base;\n\t\treturn {\n\t\t\t...base,\n\t\t\tmarker: { storageHash: r.entry.plan.destination.storageHash }\n\t\t};\n\t});\n}\n/**\n* Materialise the `applyOrder` ordering into resolved per-space\n* entries. Throws if the planner output is missing a contract space listed\n* in `applyOrder` — a wiring bug that should never reach runtime.\n*\n* Exported so callers building their own success envelopes after a\n* plan-mode dispatch can replay the same ordering.\n*/\nfunction collectOrdered(applyOrder, perSpace) {\n\treturn applyOrder.map((spaceId) => {\n\t\tconst entry = perSpace.get(spaceId);\n\t\tif (!entry) throw new InternalError(`planner output missing per-space plan for \"${spaceId}\"`);\n\t\treturn {\n\t\t\tspaceId,\n\t\t\tentry\n\t\t};\n\t});\n}\n/**\n* Action-appropriate label for the `spanStart` event the run\n* primitive emits. `runMigration` is shared by `db init`, `db update`,\n* and `migrate`; the span label tracks the user-visible action\n* so structured-progress output reads naturally for each surface.\n*/\nfunction progressLabelForAction(action) {\n\tswitch (action) {\n\t\tcase \"dbInit\": return \"Initialising database across spaces\";\n\t\tcase \"dbUpdate\": return \"Updating database across spaces\";\n\t\tcase \"migrate\": return \"Running migration plan across spaces\";\n\t}\n}\n//#endregion\n//#region src/control-api/operations/db-run.ts\n/**\n* Span IDs emitted via `onProgress` during the run flow.\n* Stable identifiers consumed by the structured-output renderer and by\n* tests asserting on span ids. The `apply` span itself is owned by\n* the {@link runMigration} primitive — only the introspect / plan\n* spans are emitted directly here.\n*/\nconst SPAN_IDS$1 = {\n\tintrospect: \"introspect\",\n\tplan: \"plan\"\n};\n/**\n* Loader → planner → runner pipeline shared by `db init` and `db update`.\n*\n* The pipeline:\n*\n* 1. **Load**: build a {@link ContractSpaceAggregate} from the descriptor\n* set + on-disk on-disk artefacts. Any layout / drift / disjointness /\n* integrity violation short-circuits with a structured error.\n* 2. **Read DB state**: marker rows (`familyInstance.readAllMarkers`)\n* + introspected schema (`familyInstance.introspect`).\n* 3. **Plan**: {@link planMigration} chooses `resolveRecordedPath` vs\n* `planFromDiff` per space according to `callerPolicy.ignoreGraphFor`.\n* The app space is forced through `planFromDiff` (today's daily-driver\n* behaviour); every extension space walks its on-disk graph via\n* `resolveRecordedPath`.\n* 4. **Apply** (when `mode === 'apply'`): every per-space `MigrationPlan`\n* feeds into the runner's `execute` — one outer\n* transaction across every space; failure on any space rolls back\n* every space's writes.\n*/\nasync function executeRun(options) {\n\tconst { driver, adapter, familyInstance, contract, mode, migrations, frameworkComponents, migrationsDir, extensions, targetId, policy, action, onProgress } = options;\n\tconst loaded = await buildContractSpaceAggregate({\n\t\ttargetId,\n\t\tmigrationsDir,\n\t\tappContract: contract,\n\t\textensions,\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!loaded.ok) throw loaded.failure;\n\tconst aggregate = loaded.value;\n\tconst markerRows = await familyInstance.readAllMarkers({ driver });\n\tif (mode === \"apply\") {\n\t\tconst orphanMarkerError = detectOrphanMarkers(aggregate, markerRows);\n\t\tif (orphanMarkerError !== null) throw orphanMarkerError;\n\t}\n\tonProgress?.({\n\t\taction,\n\t\tkind: \"spanStart\",\n\t\tspanId: SPAN_IDS$1.introspect,\n\t\tlabel: \"Introspecting database schema\"\n\t});\n\tconst schemaIR = await familyInstance.introspect({\n\t\tdriver,\n\t\tcontract: collectAggregateNamespaces(aggregate)\n\t});\n\tonProgress?.({\n\t\taction,\n\t\tkind: \"spanEnd\",\n\t\tspanId: SPAN_IDS$1.introspect,\n\t\toutcome: \"ok\"\n\t});\n\tonProgress?.({\n\t\taction,\n\t\tkind: \"spanStart\",\n\t\tspanId: SPAN_IDS$1.plan,\n\t\tlabel: \"Planning migration\"\n\t});\n\tconst planResult = await planMigration({\n\t\taggregate,\n\t\tcurrentDBState: {\n\t\t\tmarkersBySpaceId: markerRows,\n\t\t\tschemaIntrospection: schemaIR\n\t\t},\n\t\tadapter,\n\t\tmigrations,\n\t\tframeworkComponents,\n\t\tcallerPolicy: { ignoreGraphFor: /* @__PURE__ */ new Set([aggregate.app.spaceId]) },\n\t\toperationPolicy: policy\n\t});\n\tif (!planResult.ok) {\n\t\tonProgress?.({\n\t\t\taction,\n\t\t\tkind: \"spanEnd\",\n\t\t\tspanId: SPAN_IDS$1.plan,\n\t\t\toutcome: \"error\"\n\t\t});\n\t\treturn mapPlannerError(planResult.failure);\n\t}\n\tonProgress?.({\n\t\taction,\n\t\tkind: \"spanEnd\",\n\t\tspanId: SPAN_IDS$1.plan,\n\t\toutcome: \"ok\"\n\t});\n\tconst orderedResolutions = collectOrdered(planResult.value.applyOrder, planResult.value.perSpace);\n\tconst plannerWarnings = aggregatePlannerWarnings(orderedResolutions);\n\tconst appResolution = orderedResolutions.find((r) => r.spaceId === aggregate.app.spaceId);\n\tif (!appResolution) throw new InternalError(\"Aggregate planner returned no plan for the app space — the planner is supposed to always emit one.\");\n\tconst appPlan = appResolution.entry.plan;\n\tif (mode === \"plan\") {\n\t\tconst aggregateOps = orderedResolutions.flatMap((r) => r.entry.displayOps);\n\t\tconst preview = hasOperationPreview(familyInstance) ? familyInstance.toOperationPreview(aggregateOps) : void 0;\n\t\tconst perSpace = buildPerSpaceBreakdown(orderedResolutions, aggregate.app.spaceId, { includeMarkers: false });\n\t\tconst summary = `Planned ${aggregateOps.length} operation(s) across ${orderedResolutions.length} space(s)`;\n\t\treturn wrapPlanResult({\n\t\t\toperations: aggregateOps,\n\t\t\tdestination: appPlan.destination,\n\t\t\tpreview,\n\t\t\tperSpace,\n\t\t\tsummary,\n\t\t\t...ifDefined(\"warnings\", plannerWarnings)\n\t\t});\n\t}\n\tif (options.consentedPlanHash !== void 0) {\n\t\tconst planHash = computePlanHash({\n\t\t\toperations: stripOperations(orderedResolutions.flatMap((r) => r.entry.displayOps)),\n\t\t\tdestination: appPlan.destination\n\t\t});\n\t\tif (planHash !== options.consentedPlanHash) return notOk({\n\t\t\tcode: \"CONSENT_PLAN_MISMATCH\",\n\t\t\tsummary: \"The plan changed between consent and apply\",\n\t\t\twhy: \"The plan recomputed for the consented apply is not the plan that was consented to, so applying it could destroy something nobody agreed to.\",\n\t\t\tconflicts: void 0,\n\t\t\tmeta: void 0,\n\t\t\tconsentPlanMismatch: {\n\t\t\t\tconsentedPlanHash: options.consentedPlanHash,\n\t\t\t\tplanHash\n\t\t\t},\n\t\t\t...ifDefined(\"warnings\", plannerWarnings)\n\t\t});\n\t}\n\tconst applied = await runMigration({\n\t\taggregate,\n\t\tperSpacePlans: planResult.value.perSpace,\n\t\tapplyOrder: planResult.value.applyOrder,\n\t\tdriver,\n\t\tfamilyInstance,\n\t\tmigrations,\n\t\tframeworkComponents,\n\t\tpolicy,\n\t\taction,\n\t\t...ifDefined(\"onProgress\", onProgress)\n\t});\n\tif (!applied.ok) return buildRunnerFailure({\n\t\tsummary: applied.failure.summary,\n\t\t...ifDefined(\"why\", applied.failure.why),\n\t\tmeta: applied.failure.meta,\n\t\t...ifDefined(\"warnings\", plannerWarnings),\n\t\t...ifDefined(\"cause\", applied.failure.cause)\n\t});\n\tconst aggregateOps = applied.value.orderedResolutions.flatMap((r) => r.entry.displayOps);\n\tconst summary = action === \"dbInit\" ? `Applied ${applied.value.totalOpsExecuted} operation(s) across ${applied.value.orderedResolutions.length} space(s), database signed` : applied.value.totalOpsExecuted === 0 ? `Database already matches contract across ${applied.value.orderedResolutions.length} space(s), signature updated` : `Applied ${applied.value.totalOpsExecuted} operation(s) across ${applied.value.orderedResolutions.length} space(s), signature updated`;\n\treturn wrapApplyResult({\n\t\toperations: aggregateOps,\n\t\tdestination: appPlan.destination,\n\t\toperationsPlanned: applied.value.totalOpsPlanned,\n\t\toperationsExecuted: applied.value.totalOpsExecuted,\n\t\tperSpace: applied.value.perSpace,\n\t\tsummary,\n\t\t...ifDefined(\"warnings\", plannerWarnings)\n\t});\n}\nfunction aggregatePlannerWarnings(orderedResolutions) {\n\tconst warnings = orderedResolutions.flatMap((r) => r.entry.warnings ?? []);\n\treturn warnings.length > 0 ? warnings : void 0;\n}\n/**\n* Compare the live `_prisma_marker` rows against the aggregate's\n* declared contract spaces. Any marker row whose `space` is not a space of\n* the aggregate is an \"orphan\" — typically a marker left behind by\n* an extension that was removed from `extensions` without first\n* cleaning up its on-disk migrations / database tables.\n*\n* Returns a {@link CliStructuredError} envelope (code\n* `MIGRATION.CONTRACT_SPACE_VIOLATION`, `kind: 'orphanMarker'`) for the\n* first orphan it finds, or `null`\n* when every marker row maps to a declared contract space. Mirrors the M2\n* `runContractSpaceVerifierMarkerCheck` envelope so downstream\n* tooling (integration tests, JSON consumers) keeps asserting on the\n* same shape.\n*/\nfunction detectOrphanMarkers(aggregate, markerRows) {\n\tconst aggregateSpaceIds = /* @__PURE__ */ new Set([aggregate.app.spaceId, ...aggregate.extensions.map((m) => m.spaceId)]);\n\tconst orphans = [];\n\tfor (const [spaceId, row] of markerRows) if (row !== null && row !== void 0 && !aggregateSpaceIds.has(spaceId)) orphans.push(spaceId);\n\tif (orphans.length === 0) return null;\n\torphans.sort((a, b) => a.localeCompare(b));\n\treturn new CliStructuredError$1(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", orphans.length === 1 ? `Orphan contract-space marker detected for \"${orphans[0]}\"` : `Orphan contract-space markers detected for ${orphans.length} spaces`, {\n\t\twhy: `The database has \\`_prisma_marker\\` rows for spaces (${orphans.map((s) => `\"${s}\"`).join(\", \")}) that are not declared in the project's \\`extensions\\`. The aggregate pipeline refuses to advance markers it cannot account for.`,\n\t\tfix: \"Either re-declare the missing extension(s) in `extensions` (so the aggregate owns them again), or remove the orphan marker row(s) from `_prisma_marker` once you have confirmed the corresponding tables can be safely retired.\",\n\t\tdocsUrl: \"https://pris.ly/contract-spaces\",\n\t\tmeta: { violations: orphans.map((spaceId) => ({\n\t\t\tkind: \"orphanMarker\",\n\t\t\tspaceId\n\t\t})) }\n\t});\n}\nfunction mapPlannerError(error) {\n\tif (error.kind === \"planFromDiffFailed\") return blindCast(notOk({\n\t\tcode: \"PLANNING_FAILED\",\n\t\tsummary: \"Migration planning failed due to conflicts\",\n\t\tconflicts: error.conflicts,\n\t\twhy: void 0,\n\t\tmeta: void 0\n\t}));\n\tif (error.kind === \"extensionPathUnreachable\") return buildRunnerFailure({\n\t\tsummary: `Cannot resolve apply path for extension space \"${error.spaceId}\"`,\n\t\twhy: `No path in the on-disk migration graph for extension space \"${error.spaceId}\" reaches the on-disk head ref hash \"${error.target}\".`,\n\t\tmeta: {\n\t\t\tspaceId: error.spaceId,\n\t\t\ttarget: error.target\n\t\t}\n\t});\n\tif (error.kind === \"extensionPathUnsatisfiable\") return buildRunnerFailure({\n\t\tsummary: `Cannot resolve apply path for extension space \"${error.spaceId}\"`,\n\t\twhy: `On-disk migration graph for extension space \"${error.spaceId}\" reaches the on-disk head ref but does not cover required invariants: ${error.missingInvariants.join(\", \")}.`,\n\t\tmeta: {\n\t\t\tspaceId: error.spaceId,\n\t\t\tmissingInvariants: error.missingInvariants\n\t\t}\n\t});\n\treturn buildRunnerFailure({\n\t\tsummary: `Aggregate planner policy conflict for space \"${error.spaceId}\"`,\n\t\twhy: error.detail,\n\t\tmeta: { spaceId: error.spaceId }\n\t});\n}\nfunction wrapPlanResult(args) {\n\treturn ok({\n\t\tmode: \"plan\",\n\t\tplan: {\n\t\t\toperations: stripOperations(args.operations),\n\t\t\t...ifDefined(\"preview\", args.preview)\n\t\t},\n\t\tdestination: {\n\t\t\tstorageHash: args.destination.storageHash,\n\t\t\t...ifDefined(\"profileHash\", args.destination.profileHash)\n\t\t},\n\t\tperSpace: args.perSpace,\n\t\tsummary: args.summary,\n\t\t...ifDefined(\"warnings\", args.warnings)\n\t});\n}\nfunction wrapApplyResult(args) {\n\treturn ok({\n\t\tmode: \"apply\",\n\t\tplan: { operations: stripOperations(args.operations) },\n\t\tdestination: {\n\t\t\tstorageHash: args.destination.storageHash,\n\t\t\t...ifDefined(\"profileHash\", args.destination.profileHash)\n\t\t},\n\t\texecution: {\n\t\t\toperationsPlanned: args.operationsPlanned,\n\t\t\toperationsExecuted: args.operationsExecuted\n\t\t},\n\t\tmarker: args.destination.profileHash ? {\n\t\t\tstorageHash: args.destination.storageHash,\n\t\t\tprofileHash: args.destination.profileHash\n\t\t} : { storageHash: args.destination.storageHash },\n\t\tperSpace: args.perSpace,\n\t\tsummary: args.summary,\n\t\t...ifDefined(\"warnings\", args.warnings)\n\t});\n}\nfunction buildRunnerFailure(args) {\n\treturn blindCast(notOk({\n\t\tcode: \"RUNNER_FAILED\",\n\t\tsummary: args.summary,\n\t\twhy: args.why,\n\t\tmeta: args.meta,\n\t\tconflicts: void 0,\n\t\t...ifDefined(\"warnings\", args.warnings),\n\t\t...ifDefined(\"cause\", args.cause)\n\t}));\n}\n//#endregion\n//#region src/control-api/operations/db-init.ts\n/**\n* Execute `db init` against the configured contract.\n*\n* Routes through the loader → planner → runner pipeline (sub-spec\n* \"Commit-by-commit § Commit 4\"). Always additive-only; destructive\n* changes belong to `db update`.\n*/\nasync function executeDbInit(options) {\n\treturn await executeRun({\n\t\tdriver: options.driver,\n\t\tadapter: options.adapter,\n\t\tfamilyInstance: options.familyInstance,\n\t\tcontract: options.contract,\n\t\tmode: options.mode,\n\t\tmigrations: options.migrations,\n\t\tframeworkComponents: options.frameworkComponents,\n\t\tmigrationsDir: options.migrationsDir,\n\t\ttargetId: options.targetId,\n\t\textensions: options.extensions ?? [],\n\t\tpolicy: { allowedOperationClasses: [\"additive\"] },\n\t\taction: \"dbInit\",\n\t\t...ifDefined(\"onProgress\", options.onProgress)\n\t});\n}\n//#endregion\n//#region src/control-api/operations/db-update.ts\nconst DB_UPDATE_POLICY = { allowedOperationClasses: [\n\t\"additive\",\n\t\"widening\",\n\t\"destructive\"\n] };\n/**\n* Execute `db update` against the configured contract.\n*\n* Routes through the loader → planner → runner pipeline. Destructive\n* operations require either `acceptDataLoss: true` or a prior\n* `mode: 'plan'` invocation that surfaces the destructive ops; the\n* confirmation gate is implemented here so the lower-level applier\n* remains policy-agnostic.\n*/\nasync function executeDbUpdate(options) {\n\tconst sharedInputs = {\n\t\tdriver: options.driver,\n\t\tadapter: options.adapter,\n\t\tfamilyInstance: options.familyInstance,\n\t\tcontract: options.contract,\n\t\tmigrations: options.migrations,\n\t\tframeworkComponents: options.frameworkComponents,\n\t\tmigrationsDir: options.migrationsDir,\n\t\ttargetId: options.targetId,\n\t\textensions: options.extensions ?? [],\n\t\tpolicy: DB_UPDATE_POLICY,\n\t\taction: \"dbUpdate\",\n\t\t...ifDefined(\"onProgress\", options.onProgress)\n\t};\n\tif (options.mode === \"apply\" && !options.acceptDataLoss && options.consent === void 0) {\n\t\tconst refusal = await guardDestructiveChanges(sharedInputs);\n\t\tif (refusal !== null) return refusal;\n\t}\n\treturn await executeRun({\n\t\t...sharedInputs,\n\t\tmode: options.mode,\n\t\t...ifDefined(\"consentedPlanHash\", options.consent?.planHash)\n\t});\n}\n/**\n* Pre-plan once when running `db update apply` without `acceptDataLoss`.\n* Surfaces destructive operations across every space; if any are\n* planned, returns a `DESTRUCTIVE_CHANGES` failure that the CLI shows\n* as a confirmation prompt. Returns `null` when the apply is safe to\n* run.\n*/\nasync function guardDestructiveChanges(sharedInputs) {\n\tconst planResult = await executeRun({\n\t\t...sharedInputs,\n\t\tmode: \"plan\"\n\t});\n\tif (!planResult.ok) return planResult;\n\tconst destructiveOps = planResult.value.plan.operations.filter((op) => op.operationClass === \"destructive\").map((op) => ({\n\t\tid: op.id,\n\t\tlabel: op.label\n\t}));\n\tif (destructiveOps.length === 0) return null;\n\tconst databaseName = await sharedInputs.driver.databaseName?.();\n\treturn notOk({\n\t\tcode: \"DESTRUCTIVE_CHANGES\",\n\t\tsummary: `Planned ${destructiveOps.length} destructive operation(s) that require confirmation`,\n\t\twhy: \"Destructive operations require explicit consent, which the caller has not given\",\n\t\tconflicts: void 0,\n\t\tmeta: void 0,\n\t\tdestructiveChanges: {\n\t\t\tdestructiveOperations: destructiveOps,\n\t\t\tdatabaseName,\n\t\t\tplanHash: computePlanHash({\n\t\t\t\toperations: planResult.value.plan.operations,\n\t\t\t\tdestination: planResult.value.destination\n\t\t\t})\n\t\t},\n\t\t...ifDefined(\"warnings\", planResult.value.warnings)\n\t});\n}\n//#endregion\n//#region src/control-api/operations/db-verify.ts\n/**\n* Span IDs emitted via `onProgress` during the aggregate verify flow.\n* Mirrors the span identifiers used by the legacy precheck / marker-check\n* helpers so structured-output renderers and progress tests keep working.\n*/\nconst SPAN_IDS = {\n\tintrospect: \"introspect\",\n\tverify: \"verify\"\n};\n/**\n* Loader → verifier pipeline shared by `db verify` modes (`full`,\n* `marker-only`, `schema-only`).\n*\n* 1. **Load**: build a {@link import('@internal/migration-tools/aggregate').ContractSpaceAggregate}\n* from descriptors + on-disk on-disk artefacts. Layout / drift /\n* integrity / disjointness violations short-circuit with a\n* structured CLI error.\n* 2. **Read DB state**: marker rows + (when `skipSchema` is `false`)\n* schema introspection.\n* 3. **Verify**: {@link verifyMigration} returns per-space `markerCheck` +\n* per-space `schemaCheck` (each contract space verified against the full schema,\n* then scoped to its own contract space). Marker drift is returned as the\n* success value's `markerDrift` envelope for callers to settle as a\n* finding. Verify results are returned to the caller verbatim.\n*/\nasync function executeDbVerify(options) {\n\tconst { driver, familyInstance, onProgress, skipSchema, skipMarker } = options;\n\tconst loaded = await buildContractSpaceAggregate(buildLoadInputs(options));\n\tif (!loaded.ok) return notOk(loaded.failure);\n\tconst aggregate = loaded.value;\n\tconst markersBySpaceId = await familyInstance.readAllMarkers({ driver });\n\tconst schemaIntrospection = skipSchema ? null : await runIntrospection({\n\t\tdriver,\n\t\tfamilyInstance,\n\t\tonProgress,\n\t\tcontract: collectAggregateNamespaces(aggregate)\n\t});\n\tconst classifySubjectGranularity = hasSchemaSubjectClassifier(familyInstance) ? (issue) => familyInstance.classifySubjectGranularity(issue) : void 0;\n\tconst classifyEntityKind = hasSchemaSubjectClassifier(familyInstance) ? (issue) => familyInstance.classifyEntityKind(issue) : void 0;\n\temitVerifySpan(onProgress, \"spanStart\");\n\treturn finaliseVerifyResult({\n\t\tverifyResult: verifyMigration({\n\t\t\taggregate,\n\t\t\tmarkersBySpaceId,\n\t\t\tschemaIntrospection,\n\t\t\tmode: options.mode,\n\t\t\tverifySchemaForSpace: createPerSpaceVerifier(options),\n\t\t\t...ifDefined(\"classifySubjectGranularity\", classifySubjectGranularity),\n\t\t\t...ifDefined(\"classifyEntityKind\", classifyEntityKind)\n\t\t}),\n\t\taggregate,\n\t\tskipMarker,\n\t\tonProgress\n\t});\n}\nfunction buildLoadInputs(options) {\n\treturn {\n\t\ttargetId: options.targetId,\n\t\tmigrationsDir: options.migrationsDir,\n\t\tappContract: options.contract,\n\t\textensions: options.extensions,\n\t\tdeserializeContract: (json) => options.familyInstance.deserializeContract(json)\n\t};\n}\nasync function runIntrospection(args) {\n\tconst { driver, familyInstance, onProgress, contract } = args;\n\tonProgress?.({\n\t\taction: \"dbVerify\",\n\t\tkind: \"spanStart\",\n\t\tspanId: SPAN_IDS.introspect,\n\t\tlabel: \"Introspecting database schema\"\n\t});\n\ttry {\n\t\tconst result = await familyInstance.introspect({\n\t\t\tdriver,\n\t\t\tcontract\n\t\t});\n\t\tonProgress?.({\n\t\t\taction: \"dbVerify\",\n\t\t\tkind: \"spanEnd\",\n\t\t\tspanId: SPAN_IDS.introspect,\n\t\t\toutcome: \"ok\"\n\t\t});\n\t\treturn result;\n\t} catch (error) {\n\t\tonProgress?.({\n\t\t\taction: \"dbVerify\",\n\t\t\tkind: \"spanEnd\",\n\t\t\tspanId: SPAN_IDS.introspect,\n\t\t\toutcome: \"error\"\n\t\t});\n\t\tthrow error;\n\t}\n}\n/**\n* Build the per-space schema callback handed to the aggregate verifier.\n* When `skipSchema` is true the callback short-circuits with a synthetic\n* `ok` result so the verifier still runs the (cheap) schemaCheck loop\n* without invoking the family's verification path.\n*/\nfunction createPerSpaceVerifier(options) {\n\tconst { skipSchema, familyInstance, frameworkComponents } = options;\n\treturn (schema, space, verifyMode) => {\n\t\tif (skipSchema) return buildSkippedSchemaResult(space);\n\t\treturn familyInstance.verifySchema({\n\t\t\tcontract: space.contract(),\n\t\t\tschema,\n\t\t\tstrict: verifyMode === \"strict\",\n\t\t\tframeworkComponents\n\t\t});\n\t};\n}\nfunction emitVerifySpan(onProgress, kind) {\n\tif (kind === \"spanStart\") {\n\t\tonProgress?.({\n\t\t\taction: \"dbVerify\",\n\t\t\tkind: \"spanStart\",\n\t\t\tspanId: SPAN_IDS.verify,\n\t\t\tlabel: \"Verifying contract spaces\"\n\t\t});\n\t\treturn;\n\t}\n\tonProgress?.({\n\t\taction: \"dbVerify\",\n\t\tkind: \"spanEnd\",\n\t\tspanId: SPAN_IDS.verify,\n\t\toutcome: kind === \"spanEndOk\" ? \"ok\" : \"error\"\n\t});\n}\n/**\n* Map an {@link VerifierOutput} to the operation's\n* {@link ExecuteDbVerifyResult}, applying the `skipMarker` policy used\n* by the CLI's `--schema-only` mode.\n*/\nfunction finaliseVerifyResult(args) {\n\tconst { verifyResult, aggregate, skipMarker, onProgress } = args;\n\tif (!verifyResult.ok) {\n\t\temitVerifySpan(onProgress, \"spanEndError\");\n\t\treturn notOk(new CliStructuredError$1(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", \"Aggregate verifier introspection failed\", {\n\t\t\twhy: verifyResult.failure.detail,\n\t\t\tfix: \"Check database connectivity and the introspection tooling.\",\n\t\t\tdocsUrl: \"https://pris.ly/contract-spaces\"\n\t\t}));\n\t}\n\tconst markerDrift = skipMarker ? null : mapMarkerCheckFailures(aggregate.app.spaceId, verifyResult.value.markerCheck);\n\temitVerifySpan(onProgress, markerDrift === null ? \"spanEndOk\" : \"spanEndError\");\n\treturn ok({\n\t\tschemaResults: verifyResult.value.schemaCheck.perSpace,\n\t\tunclaimed: verifyResult.value.schemaCheck.unclaimed,\n\t\tspaceOrder: [aggregate.app.spaceId, ...aggregate.extensions.map((e) => e.spaceId)],\n\t\tappSpaceId: aggregate.app.spaceId,\n\t\tmarkerDrift\n\t});\n}\nfunction buildSkippedSchemaResult(space) {\n\tconst contract = space.contract();\n\tconst headRef = requireHeadRef(space);\n\tconst profileHash = castAs(contract).profileHash;\n\treturn {\n\t\tok: true,\n\t\tsummary: \"Schema verification skipped\",\n\t\tcontract: {\n\t\t\tstorageHash: headRef.hash,\n\t\t\t...profileHash ? { profileHash } : {}\n\t\t},\n\t\ttarget: { expected: contract.target },\n\t\tschema: { issues: [] },\n\t\ttimings: { total: 0 }\n\t};\n}\n/**\n* Translate per-space marker check failures and orphan markers into a\n* single CLI structured error envelope. Preserves the legacy code\n* `MIGRATION.CONTRACT_SPACE_VIOLATION` (was emitted by\n* `runContractSpaceVerifierMarkerCheck`).\n*/\nfunction mapMarkerCheckFailures(appSpaceId, section) {\n\tconst violations = [];\n\tfor (const [spaceId, result] of section.perSpace) {\n\t\tif (result.kind === \"ok\" || result.kind === \"absent\") continue;\n\t\tif (result.kind === \"hashMismatch\") {\n\t\t\tviolations.push({\n\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\tspaceId,\n\t\t\t\tremediation: spaceId === appSpaceId ? \"Run `prisma-cli db update` to advance the marker, or roll the database back to the recorded hash.\" : `Apply on-disk migrations under \\`migrations/${spaceId}/\\` to advance the marker, or remove the conflicting marker row.`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (result.kind === \"missingInvariants\") violations.push({\n\t\t\tkind: \"invariantsMismatch\",\n\t\t\tspaceId,\n\t\t\tremediation: `Re-apply the migrations under \\`migrations/${spaceId}/\\` so the marker carries invariants: ${result.missing.join(\", \")}.`\n\t\t});\n\t}\n\tfor (const orphan of section.orphanMarkers) violations.push({\n\t\tkind: \"orphanMarker\",\n\t\tspaceId: orphan.spaceId,\n\t\tremediation: `Add the corresponding extension to \\`extensions\\` in \\`prisma.config.ts\\`, or delete the orphan marker row for \"${orphan.spaceId}\".`\n\t});\n\tif (violations.length === 0) return null;\n\tconst lines = violations.map((v) => `- [${v.kind}] ${v.spaceId}: ${v.remediation}`);\n\treturn new CliStructuredError$1(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", violations.length === 1 ? \"Contract-space verifier found a violation\" : `Contract-space verifier found violations (${violations.length})`, {\n\t\twhy: `The on-disk \\`migrations/\\` directory, the \\`extensions\\` declaration, and the live database marker rows are not in agreement.\\n${lines.join(\"\\n\")}`,\n\t\tfix: violations[0]?.remediation ?? \"Review and reconcile the violations listed above.\",\n\t\tdocsUrl: \"https://pris.ly/contract-spaces\",\n\t\tmeta: { violations }\n\t});\n}\n//#endregion\n//#region src/control-api/operations/migrate.ts\n/**\n* Apply pending migrations across every contract space (app +\n* extensions). Replay-only: graph-walk against the on-disk graph for\n* every contract space; no synth, no introspection.\n*\n* Pipeline:\n*\n* 1. Load aggregate from disk (loader hydrates extension graphs;\n* caller provides app-space packages).\n* 2. Read live marker rows per space (`familyInstance.readAllMarkers`).\n* 3. Per space: `resolveRecordedPath` plots the path from the live\n* marker to `space.headRef.hash` (or `refHash` for the app\n* space when provided). An empty-graph space whose elements are ALL\n* externally managed resolves declaratively (marker to head, zero\n* ops), mirroring the db-init aggregate planner: such a space ships\n* no DDL and has nothing to author. Every other empty-graph space\n* fails loudly — \"never planned\" is a user-error condition for\n* replay.\n* 4. Hand off to {@link runMigration} (the runner-driving tail\n* shared with `db init` / `db update`). Marker advancement is\n* inside the per-space transaction.\n*\n* Encodes the replay-only contract: the app contract space must have an\n* authored migration graph on disk before this operation can advance it.\n*/\nasync function executeMigrate(options) {\n\tconst { driver, familyInstance, contract, migrations, frameworkComponents, migrationsDir, extensions, targetId, refHash, refInvariants, refName, onProgress } = options;\n\tconst loaded = await buildContractSpaceAggregate({\n\t\ttargetId,\n\t\tmigrationsDir,\n\t\tappContract: contract,\n\t\textensions,\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!loaded.ok) throw loaded.failure;\n\tconst aggregate = loaded.value;\n\tconst markerRows = await familyInstance.readAllMarkers({ driver });\n\tconst allSpaces = [aggregate.app, ...aggregate.extensions];\n\tconst perSpacePlans = /* @__PURE__ */ new Map();\n\tconst atHeadResolutions = /* @__PURE__ */ new Map();\n\tfor (const space of allSpaces) {\n\t\tconst isAppSpace = space.spaceId === aggregate.app.spaceId;\n\t\tconst headRef = requireHeadRef(space);\n\t\tconst spaceTargetHash = isAppSpace && refHash !== void 0 ? refHash : headRef.hash;\n\t\tconst outcome = planSpacePath({\n\t\t\tspace,\n\t\t\taggregate,\n\t\t\ttargetHash: spaceTargetHash,\n\t\t\trefInvariants: isAppSpace && refHash !== void 0 ? refInvariants : void 0,\n\t\t\tliveMarker: markerRows.get(space.spaceId) ?? null,\n\t\t\t...isAppSpace ? { refName } : {}\n\t\t});\n\t\tif (outcome.kind === \"at-head\") {\n\t\t\tatHeadResolutions.set(space.spaceId, outcome.plan);\n\t\t\tcontinue;\n\t\t}\n\t\tif (outcome.kind === \"never-planned\") return notOk(buildNeverPlannedFailure(outcome.spaceId, outcome.targetHash));\n\t\tif (outcome.kind === \"unreachable\") return notOk(buildPathNotFoundFailure(outcome.spaceId, outcome.liveMarker, outcome.targetHash));\n\t\tif (outcome.kind === \"unsatisfiable\") {\n\t\t\tconst structural = findPathWithDecision(outcome.targetSpace.graph(), outcome.liveHash, spaceTargetHash, { required: /* @__PURE__ */ new Set() });\n\t\t\tconst structuralPath = structural.kind === \"ok\" ? structural.decision.selectedPath.map((edge) => ({\n\t\t\t\tdirName: edge.dirName,\n\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\tfrom: edge.from,\n\t\t\t\tto: edge.to,\n\t\t\t\tinvariants: edge.invariants\n\t\t\t})) : [];\n\t\t\tthrow errorNoInvariantPath({\n\t\t\t\t...outcome.refName !== void 0 ? { refName: outcome.refName } : {},\n\t\t\t\trequired: outcome.targetInvariants,\n\t\t\t\tmissing: outcome.missing,\n\t\t\t\tstructuralPath\n\t\t\t});\n\t\t}\n\t\tperSpacePlans.set(space.spaceId, outcome.plan);\n\t}\n\tconst canonicalOrder = [...aggregate.extensions.map((m) => m.spaceId), aggregate.app.spaceId];\n\tconst applyOrder = canonicalOrder.filter((spaceId) => perSpacePlans.has(spaceId));\n\tif (!applyOrder.some((spaceId) => {\n\t\tconst entry = perSpacePlans.get(spaceId);\n\t\treturn entry !== void 0 && planRequiresExecution(entry);\n\t})) {\n\t\tconst ordered = canonicalOrder.filter((spaceId) => perSpacePlans.has(spaceId) || atHeadResolutions.has(spaceId)).map((spaceId) => {\n\t\t\tconst entry = perSpacePlans.get(spaceId) ?? atHeadResolutions.get(spaceId);\n\t\t\tif (entry === void 0) throw new InternalError(`Unreachable: missing per-space plan for \"${spaceId}\"`);\n\t\t\treturn {\n\t\t\t\tspaceId,\n\t\t\t\tentry\n\t\t\t};\n\t\t});\n\t\tconst perSpace = buildPerSpaceBreakdown(ordered, aggregate.app.spaceId, { includeMarkers: true });\n\t\tconst totalSpaces = ordered.length;\n\t\treturn ok(buildSuccess({\n\t\t\taggregate,\n\t\t\torderedResolutions: ordered,\n\t\t\tperSpace,\n\t\t\ttotalOpsExecuted: 0,\n\t\t\tsummary: totalSpaces === 0 ? \"Already up to date — no contract spaces are loaded\" : totalSpaces === 1 ? \"Already up to date\" : `Already up to date across ${totalSpaces} space(s)`\n\t\t}));\n\t}\n\tconst applied = await runMigration({\n\t\taggregate,\n\t\tperSpacePlans,\n\t\tapplyOrder,\n\t\tdriver,\n\t\tfamilyInstance,\n\t\tmigrations,\n\t\tframeworkComponents,\n\t\tpolicy: { allowedOperationClasses: [\n\t\t\t\"additive\",\n\t\t\t\"widening\",\n\t\t\t\"destructive\",\n\t\t\t\"data\"\n\t\t] },\n\t\taction: \"migrate\",\n\t\t...ifDefined(\"onProgress\", onProgress)\n\t});\n\tif (!applied.ok) return notOk({\n\t\tcode: \"RUNNER_FAILED\",\n\t\tsummary: applied.failure.summary,\n\t\twhy: applied.failure.why,\n\t\tmeta: applied.failure.meta,\n\t\t...ifDefined(\"cause\", applied.failure.cause)\n\t});\n\tconst orderedAll = canonicalOrder.filter((spaceId) => perSpacePlans.has(spaceId) || atHeadResolutions.has(spaceId)).map((spaceId) => {\n\t\tif (perSpacePlans.has(spaceId)) {\n\t\t\tconst fromRunner = applied.value.orderedResolutions.find((r) => r.spaceId === spaceId);\n\t\t\tif (fromRunner !== void 0) return fromRunner;\n\t\t}\n\t\tconst entry = atHeadResolutions.get(spaceId);\n\t\tif (entry === void 0) throw new InternalError(`Unreachable: missing per-space plan for \"${spaceId}\"`);\n\t\treturn {\n\t\t\tspaceId,\n\t\t\tentry\n\t\t};\n\t});\n\tconst perSpaceAll = buildPerSpaceBreakdown(orderedAll, aggregate.app.spaceId, { includeMarkers: true });\n\tconst summary = `Applied ${applied.value.orderedResolutions.reduce((sum, r) => sum + r.entry.migrationEdges.length, 0)} migration(s) (${applied.value.totalOpsExecuted} operation(s)) across ${orderedAll.length} contract space(s)`;\n\treturn ok(buildSuccess({\n\t\taggregate,\n\t\torderedResolutions: orderedAll,\n\t\tperSpace: perSpaceAll,\n\t\ttotalOpsExecuted: applied.value.totalOpsExecuted,\n\t\tsummary\n\t}));\n}\n/**\n* Compute the graph-walk path for one contract space.\n*\n* Encapsulates the invariant-correct input assembly that both\n* `executeMigrate` and `executeMigrateShowCommand` must use:\n* - `currentMarker` carries the full live marker including `invariants`\n* (not a stripped `{ storageHash, invariants: [] }` shell).\n* - `targetInvariants` uses the caller-supplied `refInvariants` when a\n* `--to` ref was resolved (not always the file head ref's invariants).\n*\n* Both callers map the returned `SpacePathOutcome` to their own error\n* representation; the path-compute logic is shared and identical.\n*\n* @internal Exported for `executeMigrateShowCommand`.\n*/\nfunction planSpacePath({ space, aggregate, targetHash, refInvariants, liveMarker, refName }) {\n\tconst isAppSpace = space.spaceId === aggregate.app.spaceId;\n\tconst headRef = requireHeadRef(space);\n\tif (space.graph().nodes.size === 0) {\n\t\tconst liveHash = liveMarker?.storageHash;\n\t\tif (targetHash === liveHash || liveHash === void 0 && targetHash === EMPTY_CONTRACT_HASH) return {\n\t\t\tkind: \"at-head\",\n\t\t\tplan: buildAtHeadResolution({\n\t\t\t\taggregateTargetId: aggregate.targetId,\n\t\t\t\tspace,\n\t\t\t\ttargetHash,\n\t\t\t\tliveMarker\n\t\t\t})\n\t\t};\n\t\tif (!isAppSpace && allStorageElementsExternal(space.contract())) {\n\t\t\tif (headRef.invariants.length > 0) return {\n\t\t\t\tkind: \"unsatisfiable\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\tisAppSpace,\n\t\t\t\tmissing: [...headRef.invariants].sort(),\n\t\t\t\ttargetInvariants: headRef.invariants,\n\t\t\t\ttargetSpace: space,\n\t\t\t\tliveHash: liveHash ?? EMPTY_CONTRACT_HASH,\n\t\t\t\trefName: void 0\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tkind: \"ok\",\n\t\t\t\tplan: buildAtHeadResolution({\n\t\t\t\t\taggregateTargetId: aggregate.targetId,\n\t\t\t\t\tspace,\n\t\t\t\t\ttargetHash,\n\t\t\t\t\tliveMarker\n\t\t\t\t})\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tkind: \"never-planned\",\n\t\t\tspaceId: space.spaceId,\n\t\t\ttargetHash\n\t\t};\n\t}\n\tconst targetInvariants = isAppSpace && refInvariants !== void 0 ? refInvariants : headRef.invariants;\n\tconst targetSpace = targetHash === headRef.hash && targetInvariants === headRef.invariants ? space : {\n\t\t...space,\n\t\theadRef: {\n\t\t\thash: targetHash,\n\t\t\tinvariants: targetInvariants\n\t\t}\n\t};\n\tconst walked = resolveRecordedPath({\n\t\taggregateTargetId: aggregate.targetId,\n\t\tspace: targetSpace,\n\t\tcurrentMarker: liveMarker,\n\t\t...isAppSpace && refName !== void 0 ? { refName } : {}\n\t});\n\tif (walked.kind === \"unreachable\") return {\n\t\tkind: \"unreachable\",\n\t\tspaceId: space.spaceId,\n\t\tliveMarker,\n\t\ttargetHash\n\t};\n\tif (walked.kind === \"unsatisfiable\") {\n\t\tconst liveHash = liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;\n\t\treturn {\n\t\t\tkind: \"unsatisfiable\",\n\t\t\tspaceId: space.spaceId,\n\t\t\tisAppSpace,\n\t\t\tmissing: walked.missing,\n\t\t\ttargetInvariants,\n\t\t\ttargetSpace,\n\t\t\tliveHash,\n\t\t\trefName\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tplan: walked.result\n\t};\n}\n/**\n* Build a zero-op {@link PerSpacePlan} for an empty-graph space —\n* either one whose live marker already matches the target (at-head), or\n* an all-external extension space whose marker must advance to the head\n* ref with no DDL (declared-state). Lets the apply pipeline thread the\n* space through `perSpacePlans` -> `applyOrder` -> the success\n* envelope's `perSpace[]` block so the result reflects every loaded\n* space, even when there is nothing to execute.\n*/\nfunction buildAtHeadResolution(args) {\n\tconst { aggregateTargetId, space, targetHash, liveMarker } = args;\n\treturn {\n\t\tplan: {\n\t\t\ttargetId: aggregateTargetId,\n\t\t\tspaceId: space.spaceId,\n\t\t\torigin: liveMarker === null ? null : { storageHash: liveMarker.storageHash },\n\t\t\tdestination: { storageHash: targetHash },\n\t\t\toperations: [],\n\t\t\tprovidedInvariants: []\n\t\t},\n\t\tdisplayOps: [],\n\t\tdestinationContract: space.contract(),\n\t\tstrategy: \"declared-state\",\n\t\tmigrationEdges: [buildFabricatedMigrationEdge({\n\t\t\tcurrentMarkerStorageHash: liveMarker?.storageHash,\n\t\t\tdestinationStorageHash: targetHash,\n\t\t\toperationCount: 0\n\t\t})]\n\t};\n}\n/**\n* A plan needs the runner when it executes operations or advances the\n* space's marker (a declared-state resolution has zero operations but a\n* destination hash the live marker doesn't carry yet).\n*/\nfunction planRequiresExecution(entry) {\n\tif (entry.plan.operations.length > 0) return true;\n\treturn entry.plan.origin?.storageHash !== entry.plan.destination.storageHash;\n}\nfunction buildSuccess(args) {\n\tconst appResolution = args.orderedResolutions.find((r) => r.spaceId === args.aggregate.app.spaceId);\n\tconst appMarkerHash = appResolution?.entry.plan.destination.storageHash ?? requireHeadRef(args.aggregate.app).hash;\n\tconst applied = args.orderedResolutions.flatMap((r) => {\n\t\treturn r.entry.migrationEdges.map((edge) => ({\n\t\t\tspaceId: r.spaceId,\n\t\t\tdirName: edge.dirName,\n\t\t\tmigrationHash: edge.migrationHash,\n\t\t\tfrom: edge.from,\n\t\t\tto: edge.to,\n\t\t\toperationsExecuted: edge.operationCount\n\t\t}));\n\t});\n\tconst appPlan = appResolution?.entry;\n\tconst pathDecision = appPlan?.pathDecision ? {\n\t\tfromHash: appPlan.pathDecision.fromHash,\n\t\ttoHash: appPlan.pathDecision.toHash,\n\t\talternativeCount: appPlan.pathDecision.alternativeCount,\n\t\ttieBreakReasons: appPlan.pathDecision.tieBreakReasons,\n\t\t...appPlan.pathDecision.refName !== void 0 ? { refName: appPlan.pathDecision.refName } : {},\n\t\trequiredInvariants: appPlan.pathDecision.requiredInvariants ?? [],\n\t\tsatisfiedInvariants: appPlan.pathDecision.satisfiedInvariants ?? [],\n\t\tselectedPath: appPlan.pathDecision.selectedPath.map((entry) => ({\n\t\t\tdirName: entry.dirName,\n\t\t\tmigrationHash: entry.migrationHash,\n\t\t\tfrom: entry.from,\n\t\t\tto: entry.to,\n\t\t\tinvariants: entry.invariants\n\t\t}))\n\t} : void 0;\n\treturn {\n\t\tmigrationsApplied: applied.length,\n\t\tmarkerHash: appMarkerHash,\n\t\tapplied,\n\t\tsummary: args.summary,\n\t\tperSpace: args.perSpace,\n\t\t...pathDecision !== void 0 ? { pathDecision } : {}\n\t};\n}\n/**\n* Build the `neverPlanned` failure raised when a contract space that\n* declares managed storage elements has no on-disk migration graph but\n* migrate was asked to reach a target hash. All-external spaces never reach\n* this: they resolve declaratively (marker advances to the head ref with\n* zero operations). The `why` states only the condition; the recovery\n* sequence is composed by `errorPathUnreachable`'s `fix`.\n*\n* @internal Exported for testing only.\n*/\nfunction buildNeverPlannedFailure(spaceId, targetHash) {\n\treturn {\n\t\tcode: \"MIGRATION_PATH_NOT_FOUND\",\n\t\tsummary: `No on-disk migrations for contract space \"${spaceId}\"`,\n\t\twhy: `migrate is replay-only: a contract space that declares managed storage elements must have an authored migration graph on disk. Space \"${spaceId}\" has no migrations under \\`migrations/${spaceId}/\\` but its head ref targets \"${targetHash}\".`,\n\t\tmeta: {\n\t\t\tspaceId,\n\t\t\ttarget: targetHash,\n\t\t\tkind: \"neverPlanned\"\n\t\t}\n\t};\n}\n/**\n* Build the `pathUnreachable` failure raised when an emitted contract has no\n* on-disk migration edge from the current marker to the target. The `why`\n* states only the condition (no edge between the two named states, and migrate\n* replays edges rather than inventing them); the recovery sequence — plan the\n* edge, then re-apply — is composed by `errorPathUnreachable`'s `fix`, so the\n* two read as one non-redundant plan-then-apply story.\n*\n* @internal Exported for testing only.\n*/\nfunction buildPathNotFoundFailure(spaceId, marker, targetHash) {\n\tconst fromHash = marker?.storageHash ?? \"<empty>\";\n\treturn {\n\t\tcode: \"MIGRATION_PATH_NOT_FOUND\",\n\t\tsummary: spaceId === \"app\" ? \"Current contract has no planned migration path\" : `Current contract has no planned migration path for contract space \"${spaceId}\"`,\n\t\twhy: `No migration edge connects the current state \"${fromHash}\" to the target \"${targetHash}\" in contract space \"${spaceId}\". The on-disk migration graph does not join the two, and migrate replays existing edges — it never invents one.`,\n\t\tmeta: {\n\t\t\tspaceId,\n\t\t\tfromHash,\n\t\t\ttargetHash,\n\t\t\tkind: \"pathUnreachable\"\n\t\t}\n\t};\n}\n//#endregion\n//#region src/control-api/client.ts\n/**\n* Creates a programmatic control client for Prisma Next operations.\n*\n* The client accepts framework component descriptors at creation time,\n* manages driver lifecycle via connect()/close(), and exposes domain\n* operations that delegate to the existing family instance methods.\n*\n* @see {@link ControlClient} for the client interface\n* @see README.md \"Programmatic Control API\" section for usage examples\n*/\nfunction createControlClient(options) {\n\treturn new ControlClientImpl(options);\n}\n/**\n* Implementation of ControlClient.\n* Manages initialization and connection state, delegates operations to family instance.\n*/\nvar ControlClientImpl = class {\n\toptions;\n\tstack = null;\n\tdriver = null;\n\tfamilyInstance = null;\n\tframeworkComponents = null;\n\tinitialized = false;\n\tdefaultConnection;\n\tconstructor(options) {\n\t\tthis.options = options;\n\t\tthis.defaultConnection = options.connection;\n\t}\n\tinit() {\n\t\tif (this.initialized) return;\n\t\tthis.stack = createControlStack({\n\t\t\tfamily: this.options.family,\n\t\t\ttarget: this.options.target,\n\t\t\tadapter: this.options.adapter,\n\t\t\tdriver: this.options.driver,\n\t\t\textensions: this.options.extensions\n\t\t});\n\t\tthis.familyInstance = this.options.family.create(this.stack);\n\t\tconst rawComponents = [\n\t\t\tthis.options.target,\n\t\t\tthis.options.adapter,\n\t\t\t...this.options.extensions ?? []\n\t\t];\n\t\tthis.frameworkComponents = assertFrameworkComponentsCompatible(this.options.family.familyId, this.options.target.targetId, rawComponents);\n\t\tthis.initialized = true;\n\t}\n\tasync connect(connection) {\n\t\tthis.init();\n\t\tif (this.driver) throw new CliStructuredError(\"DRIVER.ALREADY_CONNECTED\", \"Already connected. Call close() before reconnecting.\");\n\t\tconst resolvedConnection = connection ?? this.defaultConnection;\n\t\tif (resolvedConnection === void 0) throw new CliStructuredError(\"CONFIG.DB_CONNECTION_REQUIRED\", \"No connection provided. Pass a connection to connect() or provide a default connection when creating the client.\");\n\t\tif (!this.stack?.driver) throw new CliStructuredError(\"CONFIG.DRIVER_REQUIRED\", \"Driver is not configured. Pass a driver descriptor when creating the control client to enable database operations.\");\n\t\tthis.driver = await this.stack.driver.create(resolvedConnection);\n\t}\n\tasync close() {\n\t\tif (this.driver) {\n\t\t\tawait this.driver.close();\n\t\t\tthis.driver = null;\n\t\t}\n\t}\n\t/**\n\t* Construct the control adapter once for a migration operation and return\n\t* it, mirroring how the runtime plane builds the execution adapter once in\n\t* `createExecutionStack`. Only `dbInit` / `dbUpdate` need it (it lowers the\n\t* planner's DDL); read-only operations never build it. The descriptor is\n\t* optional on the stack — targets without migrations omit it.\n\t*/\n\tbuildControlAdapter() {\n\t\tthis.init();\n\t\tif (!this.stack?.adapter) throw new CliStructuredError(\"MIGRATION.TARGET_UNSUPPORTED\", `Target \"${this.options.target.targetId}\" requires an adapter for migrations`);\n\t\treturn this.stack.adapter.create(this.stack);\n\t}\n\tasync ensureConnected() {\n\t\tthis.init();\n\t\tif (!this.driver && this.defaultConnection !== void 0) await this.connect(this.defaultConnection);\n\t\tif (!this.driver || !this.familyInstance || !this.frameworkComponents) throw new CliStructuredError(\"DRIVER.NOT_CONNECTED\", \"Not connected. Call connect(connection) first.\");\n\t\treturn {\n\t\t\tdriver: this.driver,\n\t\t\tfamilyInstance: this.familyInstance,\n\t\t\tframeworkComponents: this.frameworkComponents\n\t\t};\n\t}\n\tasync connectWithProgress(connection, action, onProgress) {\n\t\tif (connection === void 0) return;\n\t\tonProgress?.({\n\t\t\taction,\n\t\t\tkind: \"spanStart\",\n\t\t\tspanId: \"connect\",\n\t\t\tlabel: \"Connecting to database...\"\n\t\t});\n\t\ttry {\n\t\t\tawait this.connect(connection);\n\t\t\tonProgress?.({\n\t\t\t\taction,\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"connect\",\n\t\t\t\toutcome: \"ok\"\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tonProgress?.({\n\t\t\t\taction,\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"connect\",\n\t\t\t\toutcome: \"error\"\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync verify(options) {\n\t\tconst { onProgress } = options;\n\t\tawait this.connectWithProgress(options.connection, \"verify\", onProgress);\n\t\tconst { driver, familyInstance } = await this.ensureConnected();\n\t\tlet contract;\n\t\ttry {\n\t\t\tcontract = familyInstance.deserializeContract(options.contract);\n\t\t} catch (error) {\n\t\t\tthrow structuredError(\"CONTRACT.VALIDATION_FAILED\", error instanceof Error ? error.message : String(error), { cause: error });\n\t\t}\n\t\tonProgress?.({\n\t\t\taction: \"verify\",\n\t\t\tkind: \"spanStart\",\n\t\t\tspanId: \"verify\",\n\t\t\tlabel: \"Verifying database marker...\"\n\t\t});\n\t\ttry {\n\t\t\tconst result = await familyInstance.verify({\n\t\t\t\tdriver,\n\t\t\t\tcontract,\n\t\t\t\texpectedTargetId: this.options.target.targetId,\n\t\t\t\tcontractPath: \"\"\n\t\t\t});\n\t\t\tonProgress?.({\n\t\t\t\taction: \"verify\",\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"verify\",\n\t\t\t\toutcome: result.ok ? \"ok\" : \"error\"\n\t\t\t});\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tonProgress?.({\n\t\t\t\taction: \"verify\",\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"verify\",\n\t\t\t\toutcome: \"error\"\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync schemaVerify(options) {\n\t\tconst { onProgress } = options;\n\t\tawait this.connectWithProgress(options.connection, \"schemaVerify\", onProgress);\n\t\tconst { driver, familyInstance, frameworkComponents } = await this.ensureConnected();\n\t\tlet contract;\n\t\ttry {\n\t\t\tcontract = familyInstance.deserializeContract(options.contract);\n\t\t} catch (error) {\n\t\t\tthrow structuredError(\"CONTRACT.VALIDATION_FAILED\", error instanceof Error ? error.message : String(error), { cause: error });\n\t\t}\n\t\tonProgress?.({\n\t\t\taction: \"schemaVerify\",\n\t\t\tkind: \"spanStart\",\n\t\t\tspanId: \"schemaVerify\",\n\t\t\tlabel: \"Verifying database schema...\"\n\t\t});\n\t\ttry {\n\t\t\tconst schema = await familyInstance.introspect({\n\t\t\t\tdriver,\n\t\t\t\tcontract\n\t\t\t});\n\t\t\tconst result = familyInstance.verifySchema({\n\t\t\t\tcontract,\n\t\t\t\tschema,\n\t\t\t\tstrict: options.strict ?? false,\n\t\t\t\tframeworkComponents\n\t\t\t});\n\t\t\tonProgress?.({\n\t\t\t\taction: \"schemaVerify\",\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"schemaVerify\",\n\t\t\t\toutcome: result.ok ? \"ok\" : \"error\"\n\t\t\t});\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tonProgress?.({\n\t\t\t\taction: \"schemaVerify\",\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"schemaVerify\",\n\t\t\t\toutcome: \"error\"\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync sign(options) {\n\t\tconst { onProgress } = options;\n\t\tawait this.connectWithProgress(options.connection, \"sign\", onProgress);\n\t\tconst { driver, familyInstance } = await this.ensureConnected();\n\t\tlet contract;\n\t\ttry {\n\t\t\tcontract = familyInstance.deserializeContract(options.contract);\n\t\t} catch (error) {\n\t\t\tthrow structuredError(\"CONTRACT.VALIDATION_FAILED\", error instanceof Error ? error.message : String(error), { cause: error });\n\t\t}\n\t\tonProgress?.({\n\t\t\taction: \"sign\",\n\t\t\tkind: \"spanStart\",\n\t\t\tspanId: \"sign\",\n\t\t\tlabel: \"Signing database...\"\n\t\t});\n\t\ttry {\n\t\t\tconst result = await familyInstance.sign({\n\t\t\t\tdriver,\n\t\t\t\tcontract,\n\t\t\t\tcontractPath: options.contractPath ?? \"\",\n\t\t\t\t...ifDefined(\"configPath\", options.configPath)\n\t\t\t});\n\t\t\tonProgress?.({\n\t\t\t\taction: \"sign\",\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"sign\",\n\t\t\t\toutcome: \"ok\"\n\t\t\t});\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tonProgress?.({\n\t\t\t\taction: \"sign\",\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"sign\",\n\t\t\t\toutcome: \"error\"\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync dbInit(options) {\n\t\tconst { onProgress } = options;\n\t\tawait this.connectWithProgress(options.connection, \"dbInit\", onProgress);\n\t\tconst { driver, familyInstance, frameworkComponents } = await this.ensureConnected();\n\t\tif (!hasMigrations(this.options.target)) throw new CliStructuredError(\"MIGRATION.TARGET_UNSUPPORTED\", `Target \"${this.options.target.targetId}\" does not support migrations`);\n\t\tconst adapter = this.buildControlAdapter();\n\t\tlet contract;\n\t\ttry {\n\t\t\tcontract = familyInstance.deserializeContract(options.contract);\n\t\t} catch (error) {\n\t\t\tthrow structuredError(\"CONTRACT.VALIDATION_FAILED\", error instanceof Error ? error.message : String(error), { cause: error });\n\t\t}\n\t\treturn executeDbInit({\n\t\t\tdriver,\n\t\t\tadapter,\n\t\t\tfamilyInstance,\n\t\t\tcontract,\n\t\t\tmode: options.mode,\n\t\t\tmigrations: this.options.target.migrations,\n\t\t\tframeworkComponents,\n\t\t\tmigrationsDir: options.migrationsDir,\n\t\t\ttargetId: this.options.target.targetId,\n\t\t\textensions: this.options.extensions ?? [],\n\t\t\t...ifDefined(\"onProgress\", onProgress)\n\t\t});\n\t}\n\tasync dbUpdate(options) {\n\t\tconst { onProgress } = options;\n\t\tawait this.connectWithProgress(options.connection, \"dbUpdate\", onProgress);\n\t\tconst { driver, familyInstance, frameworkComponents } = await this.ensureConnected();\n\t\tif (!hasMigrations(this.options.target)) throw new CliStructuredError(\"MIGRATION.TARGET_UNSUPPORTED\", `Target \"${this.options.target.targetId}\" does not support migrations`);\n\t\tconst adapter = this.buildControlAdapter();\n\t\tlet contract;\n\t\ttry {\n\t\t\tcontract = familyInstance.deserializeContract(options.contract);\n\t\t} catch (error) {\n\t\t\tthrow structuredError(\"CONTRACT.VALIDATION_FAILED\", error instanceof Error ? error.message : String(error), { cause: error });\n\t\t}\n\t\treturn executeDbUpdate({\n\t\t\tdriver,\n\t\t\tadapter,\n\t\t\tfamilyInstance,\n\t\t\tcontract,\n\t\t\tmode: options.mode,\n\t\t\tmigrations: this.options.target.migrations,\n\t\t\tframeworkComponents,\n\t\t\tmigrationsDir: options.migrationsDir,\n\t\t\ttargetId: this.options.target.targetId,\n\t\t\textensions: this.options.extensions ?? [],\n\t\t\t...ifDefined(\"acceptDataLoss\", options.acceptDataLoss),\n\t\t\t...ifDefined(\"consent\", options.consent),\n\t\t\t...ifDefined(\"onProgress\", onProgress)\n\t\t});\n\t}\n\tasync dbVerify(options) {\n\t\tconst { onProgress } = options;\n\t\tawait this.connectWithProgress(options.connection, \"dbVerify\", onProgress);\n\t\tconst { driver, familyInstance, frameworkComponents } = await this.ensureConnected();\n\t\treturn executeDbVerify({\n\t\t\tdriver,\n\t\t\tfamilyInstance,\n\t\t\tcontract: options.contract,\n\t\t\tmigrationsDir: options.migrationsDir,\n\t\t\ttargetId: this.options.target.targetId,\n\t\t\textensions: this.options.extensions ?? [],\n\t\t\tframeworkComponents,\n\t\t\tmode: options.strict ? \"strict\" : \"lenient\",\n\t\t\tskipSchema: options.skipSchema,\n\t\t\tskipMarker: options.skipMarker,\n\t\t\t...ifDefined(\"onProgress\", onProgress)\n\t\t});\n\t}\n\tasync readMarker() {\n\t\tconst { driver, familyInstance } = await this.ensureConnected();\n\t\treturn familyInstance.readMarker({\n\t\t\tdriver,\n\t\t\tspace: APP_SPACE_ID\n\t\t});\n\t}\n\tasync readAllMarkers() {\n\t\tconst { driver, familyInstance } = await this.ensureConnected();\n\t\treturn familyInstance.readAllMarkers({ driver });\n\t}\n\t/** Reads the per-migration journal; omit `space` to return every space. */\n\tasync readLedger(space) {\n\t\tconst { driver, familyInstance } = await this.ensureConnected();\n\t\treturn familyInstance.readLedger({\n\t\t\tdriver,\n\t\t\t...ifDefined(\"space\", space)\n\t\t});\n\t}\n\tasync migrate(options) {\n\t\tconst { onProgress } = options;\n\t\tawait this.connectWithProgress(options.connection, \"migrate\", onProgress);\n\t\tconst { driver, familyInstance, frameworkComponents } = await this.ensureConnected();\n\t\tif (!hasMigrations(this.options.target)) throw new CliStructuredError(\"MIGRATION.TARGET_UNSUPPORTED\", `Target \"${this.options.target.targetId}\" does not support migrations`);\n\t\tlet contract;\n\t\ttry {\n\t\t\tcontract = familyInstance.deserializeContract(options.contract);\n\t\t} catch (error) {\n\t\t\tthrow structuredError(\"CONTRACT.VALIDATION_FAILED\", error instanceof Error ? error.message : String(error), { cause: error });\n\t\t}\n\t\treturn executeMigrate({\n\t\t\tdriver,\n\t\t\tfamilyInstance,\n\t\t\tcontract,\n\t\t\tmigrations: this.options.target.migrations,\n\t\t\tframeworkComponents,\n\t\t\tmigrationsDir: options.migrationsDir,\n\t\t\textensions: this.options.extensions ?? [],\n\t\t\ttargetId: this.options.target.targetId,\n\t\t\t...ifDefined(\"refHash\", options.refHash),\n\t\t\t...ifDefined(\"refInvariants\", options.refInvariants),\n\t\t\t...ifDefined(\"refName\", options.refName),\n\t\t\t...ifDefined(\"onProgress\", onProgress)\n\t\t});\n\t}\n\tasync introspect(options) {\n\t\tconst onProgress = options?.onProgress;\n\t\tawait this.connectWithProgress(options?.connection, \"introspect\", onProgress);\n\t\tconst { driver, familyInstance } = await this.ensureConnected();\n\t\toptions?.schema;\n\t\tonProgress?.({\n\t\t\taction: \"introspect\",\n\t\t\tkind: \"spanStart\",\n\t\t\tspanId: \"introspect\",\n\t\t\tlabel: \"Introspecting database schema...\"\n\t\t});\n\t\ttry {\n\t\t\tconst result = await familyInstance.introspect({ driver });\n\t\t\tonProgress?.({\n\t\t\t\taction: \"introspect\",\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"introspect\",\n\t\t\t\toutcome: \"ok\"\n\t\t\t});\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tonProgress?.({\n\t\t\t\taction: \"introspect\",\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"introspect\",\n\t\t\t\toutcome: \"error\"\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n\ttoSchemaView(schemaIR) {\n\t\tthis.init();\n\t\tif (this.familyInstance && hasSchemaView(this.familyInstance)) return this.familyInstance.toSchemaView(schemaIR);\n\t}\n\tinferPslContract(schemaIR) {\n\t\tthis.init();\n\t\tif (this.familyInstance && hasPslContractInfer(this.familyInstance)) return this.familyInstance.inferPslContract(schemaIR);\n\t}\n\tgetPslBlockDescriptors() {\n\t\tthis.init();\n\t\treturn this.stack.authoringContributions.pslBlockDescriptors;\n\t}\n\ttoOperationPreview(operations) {\n\t\tthis.init();\n\t\tif (this.familyInstance && hasOperationPreview(this.familyInstance)) return this.familyInstance.toOperationPreview(operations);\n\t}\n\tasync emit(options) {\n\t\tconst { onProgress, contractConfig } = options;\n\t\tthis.init();\n\t\tif (!this.familyInstance) throw new InternalError(\"Family instance was not initialized. This is a bug.\");\n\t\tlet contractRaw;\n\t\tonProgress?.({\n\t\t\taction: \"emit\",\n\t\t\tkind: \"spanStart\",\n\t\t\tspanId: \"resolveSource\",\n\t\t\tlabel: \"Resolving contract source...\"\n\t\t});\n\t\ttry {\n\t\t\tconst stack = this.stack;\n\t\t\tconst sourceContext = {\n\t\t\t\tcomposedExtensions: stack.extensions.map((p) => p.id),\n\t\t\t\tcomposedExtensionContracts: stack.extensionContracts,\n\t\t\t\tauthoringContributions: stack.authoringContributions,\n\t\t\t\tcodecLookup: stack.codecLookup,\n\t\t\t\tcontrolMutationDefaults: stack.controlMutationDefaults,\n\t\t\t\tresolvedInputs: contractConfig.source.inputs ?? [],\n\t\t\t\tcapabilities: stack.capabilities\n\t\t\t};\n\t\t\tconst providerResult = await contractConfig.source.load(sourceContext);\n\t\t\tif (!providerResult.ok) {\n\t\t\t\tonProgress?.({\n\t\t\t\t\taction: \"emit\",\n\t\t\t\t\tkind: \"spanEnd\",\n\t\t\t\t\tspanId: \"resolveSource\",\n\t\t\t\t\toutcome: \"error\"\n\t\t\t\t});\n\t\t\t\treturn notOk({\n\t\t\t\t\tcode: \"CONTRACT_SOURCE_INVALID\",\n\t\t\t\t\tsummary: providerResult.failure.summary,\n\t\t\t\t\twhy: providerResult.failure.summary,\n\t\t\t\t\tmeta: providerResult.failure.meta,\n\t\t\t\t\tdiagnostics: providerResult.failure\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontractRaw = providerResult.value;\n\t\t\tonProgress?.({\n\t\t\t\taction: \"emit\",\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"resolveSource\",\n\t\t\t\toutcome: \"ok\"\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tonProgress?.({\n\t\t\t\taction: \"emit\",\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"resolveSource\",\n\t\t\t\toutcome: \"error\"\n\t\t\t});\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treturn notOk({\n\t\t\t\tcode: \"CONTRACT_SOURCE_INVALID\",\n\t\t\t\tsummary: \"Failed to resolve contract source\",\n\t\t\t\twhy: message,\n\t\t\t\tdiagnostics: {\n\t\t\t\t\tsummary: \"Contract source provider threw an exception\",\n\t\t\t\t\tdiagnostics: [{\n\t\t\t\t\t\tcode: \"PROVIDER_THROW\",\n\t\t\t\t\t\tmessage\n\t\t\t\t\t}]\n\t\t\t\t},\n\t\t\t\tmeta: void 0\n\t\t\t});\n\t\t}\n\t\tonProgress?.({\n\t\t\taction: \"emit\",\n\t\t\tkind: \"spanStart\",\n\t\t\tspanId: \"emit\",\n\t\t\tlabel: \"Emitting contract...\"\n\t\t});\n\t\ttry {\n\t\t\tconst enrichedIR = enrichContract(contractRaw, this.frameworkComponents ?? []);\n\t\t\tconst rawContractJson = this.options.target.contractSerializer.serializeContract(enrichedIR);\n\t\t\tlet deserializedContract;\n\t\t\ttry {\n\t\t\t\tdeserializedContract = this.familyInstance.deserializeContract(rawContractJson);\n\t\t\t} catch (error) {\n\t\t\t\tonProgress?.({\n\t\t\t\t\taction: \"emit\",\n\t\t\t\t\tkind: \"spanEnd\",\n\t\t\t\t\tspanId: \"emit\",\n\t\t\t\t\toutcome: \"error\"\n\t\t\t\t});\n\t\t\t\treturn notOk({\n\t\t\t\t\tcode: \"CONTRACT_VALIDATION_FAILED\",\n\t\t\t\t\tsummary: \"Contract validation failed\",\n\t\t\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\t\t\tmeta: void 0\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst result = await emit(deserializedContract, this.stack, this.options.family.emission, { serializeContract: (contract) => this.options.target.contractSerializer.serializeContract(contract) });\n\t\t\tonProgress?.({\n\t\t\t\taction: \"emit\",\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"emit\",\n\t\t\t\toutcome: \"ok\"\n\t\t\t});\n\t\t\treturn ok({\n\t\t\t\tstorageHash: result.storageHash,\n\t\t\t\t...ifDefined(\"executionHash\", result.executionHash),\n\t\t\t\tprofileHash: result.profileHash,\n\t\t\t\tcontractJson: result.contractJson,\n\t\t\t\tcontractDts: result.contractDts\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tonProgress?.({\n\t\t\t\taction: \"emit\",\n\t\t\t\tkind: \"spanEnd\",\n\t\t\t\tspanId: \"emit\",\n\t\t\t\toutcome: \"error\"\n\t\t\t});\n\t\t\treturn notOk({\n\t\t\t\tcode: \"EMIT_FAILED\",\n\t\t\t\tsummary: \"Failed to emit contract\",\n\t\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\t\tmeta: void 0\n\t\t\t});\n\t\t}\n\t}\n};\n//#endregion\n//#region src/utils/emit-queue.ts\n/**\n* Per-output FIFO queue for `executeContractEmit`.\n*\n* Ensures that at most one emit (load → resolve source → emit bytes → publish)\n* runs per output JSON path at a time. Concurrent calls for the same path\n* line up behind the in-flight one and run in submission order; the user-visible\n* outcome is \"last submission wins on disk\" without any supersession bookkeeping.\n*\n* Long-lived hosts (Vite dev server, watch CLIs) must call `disposeEmitQueue`\n* when they stop publishing to a path, otherwise the module-global `Map`\n* accumulates one entry per unique output path for the lifetime of the process.\n*/\nconst emitQueues = /* @__PURE__ */ new Map();\nfunction queueEmitByOutput(outputJsonPath, action) {\n\tconst next = (emitQueues.get(outputJsonPath) ?? Promise.resolve()).then(action, action);\n\temitQueues.set(outputJsonPath, next);\n\treturn next;\n}\nfunction disposeEmitQueue(outputJsonPath) {\n\temitQueues.delete(outputJsonPath);\n}\n//#endregion\n//#region src/utils/project-import-root.ts\n/**\n* The import root of the project being emitted for, read from its own\n* manifest.\n*\n* Generated files are kept by the application, so every package name in them\n* has to be one the application can resolve — which means one of its direct\n* dependencies (ADR 242). The application already states those in\n* `package.json`, so emission reads them instead of taking a mode from\n* configuration that could disagree with what is installed.\n*/\nconst DEPENDENCY_FIELDS = [\"dependencies\", \"devDependencies\"];\nfunction isRecord$2(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n/** The error codes that mean \"no manifest here\", as opposed to \"cannot read it\". */\nconst MANIFEST_ABSENT_CODES = /* @__PURE__ */ new Set([\"ENOENT\", \"ENOTDIR\"]);\nfunction errorCode(error) {\n\tif (!isRecord$2(error)) return void 0;\n\tconst code = error[\"code\"];\n\treturn typeof code === \"string\" ? code : void 0;\n}\n/**\n* The nearest `package.json` at or above `from`, or `undefined` if there is\n* none. The nearest one wins: a package inside a workspace states its own\n* dependencies, and the workspace root's are somebody else's.\n*\n* @throws {CliStructuredError} when a manifest is there but cannot be used —\n* unreadable, not valid JSON, or not a JSON object. Only \"there is no manifest\n* at this level\" continues the walk up; treating a permissions failure that\n* way would silently emit against the wrong project's dependencies.\n*/\nfunction nearestManifest(from) {\n\tlet dir = from;\n\twhile (true) {\n\t\tconst path = join(dir, \"package.json\");\n\t\tlet raw;\n\t\ttry {\n\t\t\traw = readFileSync(path, \"utf8\");\n\t\t} catch (cause) {\n\t\t\tif (!MANIFEST_ABSENT_CODES.has(errorCode(cause) ?? \"\")) throw errorRuntime(\"CLI.PROJECT_MANIFEST_UNREADABLE\", `Failed to read ${path}`, {\n\t\t\t\twhy: `\\`${path}\\` exists but could not be read: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t\tfix: `Make \\`${path}\\` readable, then re-run the command. Emission reads it to decide which package names generated files should import.`,\n\t\t\t\tmeta: { path },\n\t\t\t\tcause\n\t\t\t});\n\t\t\tconst parent = dirname(dir);\n\t\t\tif (parent === dir) return void 0;\n\t\t\tdir = parent;\n\t\t\tcontinue;\n\t\t}\n\t\tlet parsed;\n\t\ttry {\n\t\t\tparsed = JSON.parse(raw);\n\t\t} catch (cause) {\n\t\t\tthrow errorRuntime(\"CLI.PROJECT_MANIFEST_INVALID\", `Failed to parse ${path}`, {\n\t\t\t\twhy: `\\`${path}\\` is not valid JSON: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t\tfix: `Fix the JSON syntax in \\`${path}\\` (a missing comma or unbalanced brace is the most common cause), then re-run the command. Emission reads it to decide which package names generated files should import.`,\n\t\t\t\tmeta: { path },\n\t\t\t\tcause\n\t\t\t});\n\t\t}\n\t\tif (!isRecord$2(parsed)) throw errorRuntime(\"CLI.PROJECT_MANIFEST_INVALID\", `Failed to read ${path}`, {\n\t\t\twhy: `\\`${path}\\` is valid JSON but not a JSON object, so it states no dependencies.`,\n\t\t\tfix: `Make \\`${path}\\` a JSON object with the usual manifest fields, then re-run the command. Emission reads it to decide which package names generated files should import.`,\n\t\t\tmeta: { path }\n\t\t});\n\t\treturn parsed;\n\t}\n}\nfunction declaredDependencies(manifest) {\n\treturn DEPENDENCY_FIELDS.flatMap((field) => {\n\t\tconst value = manifest[field];\n\t\treturn isRecord$2(value) ? Object.keys(value) : [];\n\t});\n}\n/**\n* The import root for the project that owns `configPath`, or for the working\n* directory when the config was discovered rather than named.\n*\n* A project with no manifest, or one that names no published package, is on\n* the internal root — which emits every specifier exactly as authored, so a\n* project that has not moved to published names is unaffected.\n*/\nfunction projectImportRoot(configPath) {\n\tconst manifest = nearestManifest(configPath === void 0 ? resolve(\".\") : dirname(resolve(configPath)));\n\tif (manifest === void 0) return internalImportRoot;\n\treturn importRootForDependencies(declaredDependencies(manifest));\n}\n/** The specifier resolver emission should use for the project owning `configPath`. */\nfunction createProjectSpecifierResolver(configPath) {\n\treturn createImportSpecifierResolver(projectImportRoot(configPath));\n}\n//#endregion\n//#region src/utils/publish-contract-artifact-pair.ts\nfunction isRecord$1(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction createTempArtifactPath(path, publicationToken, phase) {\n\treturn join(dirname(path), `.${basename(path)}.${process.pid}.${publicationToken}.${phase}.tmp`);\n}\nasync function readExistingArtifact(path) {\n\ttry {\n\t\treturn { content: await readFile(path, \"utf-8\") };\n\t} catch (error) {\n\t\tif (isRecord$1(error) && error[\"code\"] === \"ENOENT\") return \"remove\";\n\t\tthrow error;\n\t}\n}\nasync function restoreArtifact(path, previous, publicationToken) {\n\tif (previous === \"remove\") {\n\t\tawait rm(path, { force: true });\n\t\treturn;\n\t}\n\tconst restorePath = createTempArtifactPath(path, publicationToken, \"rollback\");\n\tawait writeFile(restorePath, previous.content, \"utf-8\");\n\ttry {\n\t\tawait rename(restorePath, path);\n\t} finally {\n\t\tawait rm(restorePath, { force: true });\n\t}\n}\nfunction withRollbackFailureCause(error, rollbackFailures) {\n\tconst rollbackCause = new AggregateError(rollbackFailures, \"Failed to restore published artifacts\");\n\tif (error instanceof Error) {\n\t\tObject.defineProperty(error, \"cause\", {\n\t\t\tvalue: rollbackCause,\n\t\t\tconfigurable: true,\n\t\t\twritable: true\n\t\t});\n\t\treturn error;\n\t}\n\treturn new Error(String(error), { cause: rollbackCause });\n}\nasync function publishPairWithRollback(entries, publicationToken) {\n\tconst replaced = [];\n\ttry {\n\t\tfor (const entry of entries) {\n\t\t\tawait rename(entry.tempPath, entry.outputPath);\n\t\t\treplaced.push(entry);\n\t\t}\n\t} catch (error) {\n\t\tconst rollbackFailures = (await Promise.allSettled(replaced.map((entry) => restoreArtifact(entry.outputPath, entry.previous, publicationToken)))).flatMap((result) => result.status === \"rejected\" ? [result.reason] : []);\n\t\tif (rollbackFailures.length > 0) throw withRollbackFailureCause(error, rollbackFailures);\n\t\tthrow error;\n\t}\n}\nasync function publishContractArtifactPair({ outputJsonPath, outputDtsPath, contractJson, contractDts, publicationToken, beforePublish }) {\n\tconst tempJsonPath = createTempArtifactPath(outputJsonPath, publicationToken, \"next\");\n\tconst tempDtsPath = createTempArtifactPath(outputDtsPath, publicationToken, \"next\");\n\ttry {\n\t\tawait writeFile(tempJsonPath, contractJson, \"utf-8\");\n\t\tawait writeFile(tempDtsPath, contractDts, \"utf-8\");\n\t\tif (await beforePublish?.() === false) return false;\n\t\tconst previousJson = await readExistingArtifact(outputJsonPath);\n\t\tawait publishPairWithRollback([{\n\t\t\ttempPath: tempDtsPath,\n\t\t\toutputPath: outputDtsPath,\n\t\t\tprevious: await readExistingArtifact(outputDtsPath)\n\t\t}, {\n\t\t\ttempPath: tempJsonPath,\n\t\t\toutputPath: outputJsonPath,\n\t\t\tprevious: previousJson\n\t\t}], publicationToken);\n\t\treturn true;\n\t} finally {\n\t\tawait Promise.allSettled([rm(tempJsonPath, { force: true }), rm(tempDtsPath, { force: true })]);\n\t}\n}\n//#endregion\n//#region src/utils/validate-contract-deps.ts\nconst IMPORT_PATTERN = /import\\s+type\\s+.*?\\s+from\\s+['\"](@[^/]+\\/[^/'\"]+)/g;\nfunction extractPackageSpecifiers(dtsContent) {\n\tconst packages = /* @__PURE__ */ new Set();\n\tfor (const match of dtsContent.matchAll(IMPORT_PATTERN)) {\n\t\tconst pkg = match[1];\n\t\tif (pkg) packages.add(pkg);\n\t}\n\treturn [...packages];\n}\nfunction validateContractDeps(dtsContent, projectRoot) {\n\tconst packages = extractPackageSpecifiers(dtsContent);\n\tconst resolve = createRequire(resolve$1(projectRoot, \"package.json\"));\n\tconst missing = [];\n\tfor (const pkg of packages) try {\n\t\tresolve.resolve(`${pkg}/package.json`);\n\t} catch {\n\t\tmissing.push(pkg);\n\t}\n\tif (missing.length === 0) return { missing };\n\treturn {\n\t\tmissing,\n\t\twarning: [\n\t\t\t\"contract.d.ts imports types from packages that are not installed:\",\n\t\t\tmissing.map((p) => ` - ${p}`).join(\"\\n\"),\n\t\t\t\"\",\n\t\t\t\"Install them with your package manager:\",\n\t\t\t...missing.map((p) => ` ${p}`)\n\t\t].join(\"\\n\")\n\t};\n}\n//#endregion\n//#region src/control-api/operations/contract-emit.ts\nconst EMIT_ACTION = \"emit\";\nconst defaultContractEmitDependencies = { emit };\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction startSpan(onProgress, spanId, label) {\n\tonProgress?.({\n\t\taction: EMIT_ACTION,\n\t\tkind: \"spanStart\",\n\t\tspanId,\n\t\tlabel\n\t});\n}\nfunction endSpan(onProgress, spanId, outcome) {\n\tonProgress?.({\n\t\taction: EMIT_ACTION,\n\t\tkind: \"spanEnd\",\n\t\tspanId,\n\t\toutcome\n\t});\n}\nfunction failedToResolveContractSource(why, fix, meta, cause) {\n\treturn errorRuntime(\"CONTRACT.SOURCE_LOAD_FAILED\", \"Failed to resolve contract source\", {\n\t\twhy,\n\t\tfix,\n\t\t...ifDefined(\"meta\", meta),\n\t\t...ifDefined(\"cause\", cause)\n\t});\n}\nfunction diagnosticLocationSuffix(diagnostic) {\n\tconst sourceId = typeof diagnostic[\"sourceId\"] === \"string\" ? diagnostic[\"sourceId\"] : void 0;\n\tconst span = isRecord(diagnostic[\"span\"]) ? diagnostic[\"span\"] : void 0;\n\tconst start = span && isRecord(span[\"start\"]) ? span[\"start\"] : void 0;\n\tconst line = start && typeof start[\"line\"] === \"number\" ? start[\"line\"] : void 0;\n\tconst column = start && typeof start[\"column\"] === \"number\" ? start[\"column\"] : void 0;\n\tif (sourceId && line !== void 0 && column !== void 0) return ` (${sourceId}:${line}:${column})`;\n\tif (sourceId) return ` (${sourceId})`;\n\treturn \"\";\n}\nfunction mapDiagnosticsToIssues(diagnostics) {\n\tconst issues = [];\n\tfor (const raw of diagnostics) {\n\t\tif (!isRecord(raw)) continue;\n\t\tconst code = typeof raw[\"code\"] === \"string\" ? raw[\"code\"] : \"diagnostic\";\n\t\tconst message = typeof raw[\"message\"] === \"string\" ? raw[\"message\"] : \"\";\n\t\tissues.push({\n\t\t\tkind: code,\n\t\t\tmessage: `${message}${diagnosticLocationSuffix(raw)}`\n\t\t});\n\t}\n\treturn issues;\n}\nfunction validateProviderResult(providerResult) {\n\tif (!isRecord(providerResult) || typeof providerResult[\"ok\"] !== \"boolean\") return {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed result shape.\", \"Ensure contract.source.load resolves to ok(Contract) or notOk({ summary, diagnostics }).\")\n\t};\n\tif (providerResult[\"ok\"]) {\n\t\tif (!(\"value\" in providerResult)) return {\n\t\t\tok: false,\n\t\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed success result: missing value.\", \"Ensure contract.source.load success payload is ok(Contract).\")\n\t\t};\n\t\treturn {\n\t\t\tok: true,\n\t\t\tvalue: providerResult[\"value\"]\n\t\t};\n\t}\n\tconst failure = providerResult[\"failure\"];\n\tif (!isRecord(failure) || typeof failure[\"summary\"] !== \"string\" || !Array.isArray(failure[\"diagnostics\"])) return {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(\"Contract source provider returned malformed failure result: expected summary and diagnostics.\", \"Ensure contract.source.load failure payload is notOk({ summary, diagnostics, meta? }).\")\n\t};\n\treturn {\n\t\tok: false,\n\t\terror: failedToResolveContractSource(String(failure[\"summary\"]), \"Fix contract source diagnostics and return ok(Contract).\", {\n\t\t\tdiagnostics: failure[\"diagnostics\"],\n\t\t\tissues: mapDiagnosticsToIssues(failure[\"diagnostics\"]),\n\t\t\t...ifDefined(\"providerMeta\", failure[\"meta\"])\n\t\t})\n\t};\n}\n/**\n* Canonical contract emit operation.\n*\n* This is the SINGLE publication path used by both the CLI command\n* (`prisma-next contract emit`) and the Vite plugin\n* (`@internal/vite-plugin-contract-emit`). New callers must go through this\n* function rather than re-implementing load → emit → publish.\n*\n* The whole flow (load config → resolve source → emit bytes → atomic publish)\n* is serialized per output JSON path via `queueEmitByOutput`. Concurrent calls\n* for the same output line up FIFO; the user-visible outcome is \"last\n* submission wins on disk\" without any supersession bookkeeping. Within a\n* single emit, `publishContractArtifactPair` stages temp files, renames\n* `contract.d.ts` before `contract.json`, and attempts to restore the previous\n* pair if either rename fails — so type-only consumers never observe a\n* mismatched pair.\n*\n* @throws {CliStructuredError} on config/source/validation problems\n* @throws {DOMException} `AbortError` if cancelled via `signal`\n*/\nasync function executeContractEmit(options, dependencies = defaultContractEmitDependencies) {\n\tconst { config, configPath, outputPath, signal = new AbortController().signal, onProgress } = options;\n\tconst unlessAborted = abortable(signal);\n\tif (!config.contract) throw errorContractConfigMissing({ why: \"Config.contract is required for emit. Define it in your config: contract: { source: ..., output: ... }\" });\n\tconst contractConfig = config.contract;\n\tconst effectiveOutput = outputPath !== void 0 ? join(outputPath, \"contract.json\") : contractConfig.output;\n\tif (!effectiveOutput) throw errorContractConfigMissing({ why: \"Contract config must have output path. This should not happen if defineConfig() was used.\" });\n\tif (typeof contractConfig.source?.load !== \"function\") throw errorContractConfigMissing({ why: \"Contract config must include a valid source provider object\" });\n\tlet outputPaths;\n\ttry {\n\t\toutputPaths = getEmittedArtifactPaths(effectiveOutput);\n\t} catch (error) {\n\t\tthrow errorContractConfigMissing({ why: error instanceof Error ? error.message : String(error) });\n\t}\n\tconst { jsonPath: outputJsonPath, dtsPath: outputDtsPath } = outputPaths;\n\treturn queueEmitByOutput(outputJsonPath, async () => {\n\t\tconst stack = createControlStack(config);\n\t\tconst sourceContext = {\n\t\t\tcomposedExtensions: stack.extensions.map((p) => p.id),\n\t\t\tcomposedExtensionContracts: stack.extensionContracts,\n\t\t\tauthoringContributions: stack.authoringContributions,\n\t\t\tcodecLookup: stack.codecLookup,\n\t\t\tcontrolMutationDefaults: stack.controlMutationDefaults,\n\t\t\tresolvedInputs: contractConfig.source.inputs ?? [],\n\t\t\tcapabilities: stack.capabilities\n\t\t};\n\t\tstartSpan(onProgress, \"resolveSource\", \"Resolving contract source...\");\n\t\tlet providerResult;\n\t\ttry {\n\t\t\tproviderResult = await unlessAborted(contractConfig.source.load(sourceContext));\n\t\t} catch (error) {\n\t\t\tendSpan(onProgress, \"resolveSource\", \"error\");\n\t\t\tif (signal.aborted || isRecord(error) && error[\"name\"] === \"AbortError\") throw error;\n\t\t\tthrow failedToResolveContractSource(error instanceof Error ? error.message : String(error), \"Ensure contract.source.load resolves to ok(Contract) or returns structured diagnostics.\", void 0, error);\n\t\t}\n\t\tconst validatedContract = validateProviderResult(providerResult);\n\t\tif (!validatedContract.ok) {\n\t\t\tendSpan(onProgress, \"resolveSource\", \"error\");\n\t\t\tthrow validatedContract.error;\n\t\t}\n\t\tendSpan(onProgress, \"resolveSource\", \"ok\");\n\t\tstartSpan(onProgress, \"emit\", \"Emitting contract...\");\n\t\tlet emitResult;\n\t\ttry {\n\t\t\tconst familyInstance = config.family.create(stack);\n\t\t\tconst rawComponents = [\n\t\t\t\tconfig.target,\n\t\t\t\tconfig.adapter,\n\t\t\t\t...config.extensions ?? []\n\t\t\t];\n\t\t\tconst frameworkComponents = assertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, rawComponents);\n\t\t\tconst enrichedIR = enrichContract(validatedContract.value, frameworkComponents);\n\t\t\tconst rawContractJson = config.target.contractSerializer.serializeContract(enrichedIR);\n\t\t\tconst deserializedContract = familyInstance.deserializeContract(rawContractJson);\n\t\t\tconst { contractSerializer } = config.target;\n\t\t\tconst serializeContract = (c) => contractSerializer.serializeContract(c);\n\t\t\temitResult = await unlessAborted(dependencies.emit(deserializedContract, stack, config.family.emission, {\n\t\t\t\toutputJsonPath,\n\t\t\t\tserializeContract,\n\t\t\t\tresolveImportSpecifier: createProjectSpecifierResolver(configPath ?? outputJsonPath),\n\t\t\t\t...ifDefined(\"shouldPreserveEmpty\", contractSerializer.shouldPreserveEmpty),\n\t\t\t\t...ifDefined(\"sortStorage\", contractSerializer.sortStorage)\n\t\t\t}));\n\t\t} catch (error) {\n\t\t\tendSpan(onProgress, \"emit\", \"error\");\n\t\t\tthrow error;\n\t\t}\n\t\tendSpan(onProgress, \"emit\", \"ok\");\n\t\tawait unlessAborted(mkdir(dirname(outputJsonPath), { recursive: true }));\n\t\tawait publishContractArtifactPair({\n\t\t\toutputJsonPath,\n\t\t\toutputDtsPath,\n\t\t\tcontractJson: emitResult.contractJson,\n\t\t\tcontractDts: emitResult.contractDts,\n\t\t\tpublicationToken: String(process.hrtime.bigint())\n\t\t});\n\t\tconst validationWarning = validateContractDeps(emitResult.contractDts, dirname(outputDtsPath)).warning;\n\t\treturn {\n\t\t\tstorageHash: emitResult.storageHash,\n\t\t\t...ifDefined(\"executionHash\", emitResult.executionHash),\n\t\t\tprofileHash: emitResult.profileHash,\n\t\t\tfiles: {\n\t\t\t\tjson: outputJsonPath,\n\t\t\t\tdts: outputDtsPath\n\t\t\t},\n\t\t\t...ifDefined(\"validationWarning\", validationWarning)\n\t\t};\n\t});\n}\n//#endregion\n//#region src/control-api/operations/ref-advancement.ts\nfunction computeRefAdvancementName(options) {\n\tif (options.advanceRef !== void 0) return options.advanceRef;\n\tif (options.db === void 0) return \"db\";\n\treturn null;\n}\nasync function readContractIR(contractJson, contractJsonPath) {\n\treturn {\n\t\tcontract: contractJson,\n\t\tcontractDts: await readFile(contractJsonPath.replace(/\\.json$/i, \".d.ts\"), \"utf-8\")\n\t};\n}\nasync function executeRefAdvancement(refsDir, migrationsDir, name, hash, contractIR) {\n\tif (!validateRefName(name)) throw errorInvalidRefName(name);\n\tawait writeContractSnapshot(migrationsDir, hash, {\n\t\tcontractJson: contractIR.contract,\n\t\tcontractDts: contractIR.contractDts\n\t});\n\tawait writeRef(refsDir, name, {\n\t\thash,\n\t\tinvariants: []\n\t});\n\treturn {\n\t\tname,\n\t\thash\n\t};\n}\nasync function buildRefAdvancementFields(options) {\n\tconst name = computeRefAdvancementName({\n\t\t...ifDefined(\"advanceRef\", options.advanceRef),\n\t\t...ifDefined(\"db\", options.db)\n\t});\n\tif (name === null) return {\n\t\tadvancedRef: null,\n\t\tplannedAdvanceRef: null\n\t};\n\tif (options.mode === \"plan\") return {\n\t\tadvancedRef: null,\n\t\tplannedAdvanceRef: {\n\t\t\tname,\n\t\t\thash: options.hash\n\t\t}\n\t};\n\treturn {\n\t\tadvancedRef: await executeRefAdvancement(options.refsDir, options.migrationsDir, name, options.hash, options.contractIR),\n\t\tplannedAdvanceRef: null\n\t};\n}\n/**\n* Full ref-advancement phase for db init/update: ok({advancedRef:null, plannedAdvanceRef:null})\n* when computeRefAdvancementName is null; else readContractIR + buildRefAdvancementFields with\n* MigrationToolsError mapped, other errors rethrown.\n*/\nasync function resolveRefAdvancementFields(options) {\n\tif (computeRefAdvancementName({\n\t\t...ifDefined(\"advanceRef\", options.advanceRef),\n\t\t...ifDefined(\"db\", options.db)\n\t}) === null) return ok({\n\t\tadvancedRef: null,\n\t\tplannedAdvanceRef: null\n\t});\n\ttry {\n\t\tconst contractIR = await readContractIR(options.contractJson, options.contractJsonPath);\n\t\treturn ok(await buildRefAdvancementFields({\n\t\t\t...ifDefined(\"advanceRef\", options.advanceRef),\n\t\t\t...ifDefined(\"db\", options.db),\n\t\t\trefsDir: options.refsDir,\n\t\t\tmigrationsDir: options.migrationsDir,\n\t\t\tcontractIR,\n\t\t\tmode: options.mode,\n\t\t\thash: options.hash\n\t\t}));\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n}\n/** migrate's --advance-ref tail: executeRefAdvancement with MigrationToolsError passed through, others rethrown. */\nasync function advanceRefSafely(args) {\n\ttry {\n\t\treturn ok(await executeRefAdvancement(args.refsDir, args.migrationsDir, args.name, args.hash, args.contractIR));\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n}\n//#endregion\n//#region src/control-api/operations/contract-snapshot-resolution.ts\n/**\n* Resolves a user-supplied contract reference to an on-disk contract JSON (snapshot store or emitted contract), shared by db sign and db update --to.\n*/\nfunction isEnoent$1(error) {\n\treturn error instanceof Error && \"code\" in error && error.code === \"ENOENT\";\n}\nasync function resolveContractRefToSnapshot(options) {\n\ttry {\n\t\tconst loaded = await buildReadAggregate(options.config, { migrationsDir: options.migrationsDir });\n\t\tif (!loaded.ok) return notOk(loaded.failure);\n\t\tconst graph = loaded.value.aggregate.app.graph();\n\t\tconst bundles = loaded.value.aggregate.app.packages;\n\t\tconst refs = loaded.value.aggregate.app.refs;\n\t\tconst refResult = parseContractRef(options.refInput, {\n\t\t\tgraph,\n\t\t\trefs\n\t\t});\n\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\tconst targetHash = refResult.value.hash;\n\t\tif (bundles.find((p) => p.metadata.to === targetHash)) return ok({\n\t\t\thash: targetHash,\n\t\t\tcontractJson: blindCast(await readContractSnapshotJson(options.migrationsDir, targetHash)),\n\t\t\tcontractJsonPath: join(contractSnapshotDir(options.migrationsDir, targetHash), \"contract.json\"),\n\t\t\tsource: \"snapshot\"\n\t\t});\n\t\tif (!options.fallbackToEmitted) return notOk(errorUnexpected(`No migration bundle found for ${options.missingBundleFlag} \"${options.refInput}\" (resolved hash: ${targetHash})`, {\n\t\t\twhy: `The ref resolved successfully but no on-disk migration package has a destination (\\`to\\`) hash matching ${targetHash}.`,\n\t\t\tfix: \"Provide a ref or hash that corresponds to an existing migration package, or run `migration list` to see available migrations.\"\n\t\t}));\n\t\tlet defaultRaw;\n\t\ttry {\n\t\t\tdefaultRaw = await readFile(options.contractPathAbsolute, \"utf-8\");\n\t\t} catch (error) {\n\t\t\tif (isEnoent$1(error)) return notOk(errorFileNotFound(options.contractPathAbsolute, {\n\t\t\t\twhy: `Contract file not found at ${options.contractPathAbsolute}`,\n\t\t\t\tfix: \"Run `prisma-cli contract emit` first to generate the contract\",\n\t\t\t\tcause: error\n\t\t\t}));\n\t\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), {\n\t\t\t\twhy: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\tcause: error\n\t\t\t}));\n\t\t}\n\t\tlet parsed;\n\t\ttry {\n\t\t\tparsed = castAs(JSON.parse(defaultRaw));\n\t\t} catch (error) {\n\t\t\treturn notOk(errorContractDeserializationFailed(options.contractPathAbsolute, error instanceof Error ? error.message : String(error), { cause: error }));\n\t\t}\n\t\tif (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) return notOk(errorContractDeserializationFailed(options.contractPathAbsolute, `expected a JSON object, got ${parsed === null ? \"null\" : Array.isArray(parsed) ? \"an array\" : `a ${typeof parsed}`}`));\n\t\tconst defaultContract = blindCast(parsed);\n\t\tconst storage = defaultContract[\"storage\"];\n\t\tif ((storage !== null && typeof storage === \"object\" ? blindCast(storage)[\"storageHash\"] : void 0) === targetHash) return ok({\n\t\t\thash: targetHash,\n\t\t\tcontractJson: defaultContract,\n\t\t\tcontractJsonPath: options.contractPathAbsolute,\n\t\t\tsource: \"emitted\"\n\t\t});\n\t\treturn notOk(errorRuntime(\"MIGRATION.SNAPSHOT_MISSING\", `No contract file found for hash \"${targetHash}\"`, {\n\t\t\twhy: `Resolved contract reference \"${options.refInput}\" to hash \"${targetHash}\" but no migration produces that hash and the emitted contract does not match.`,\n\t\t\tfix: \"Ensure the target contract exists on disk — either as a migration endpoint or as the emitted contract.json.\"\n\t\t}));\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(error);\n\t\tif (CliStructuredError$1.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n}\n//#endregion\n//#region src/control-api/operations/caught-errors.ts\n/**\n* Classifies errors caught around migration-tools calls so commands never import the MigrationToolsError class directly.\n*/\n/** CliStructuredError (including MigrationToolsError) → identity; anything else → null (caller rethrows/wraps). */\nfunction mapCaughtMigrationError(error) {\n\tif (CliStructuredError$1.is(error)) return error;\n\treturn null;\n}\n//#endregion\n//#region src/control-api/operations/contract-at-errors.ts\nfunction mapContractAtError(error, options) {\n\tif (MigrationToolsError.is(error)) switch (error.code) {\n\t\tcase \"MIGRATION.REF_NOT_RESOLVABLE\": return notOk(errorSnapshotMissing(typeof error.meta?.[\"refName\"] === \"string\" ? error.meta[\"refName\"] : typeof error.meta?.[\"identifier\"] === \"string\" ? error.meta[\"identifier\"] : \"unknown\", { cause: error }));\n\t\tcase \"MIGRATION.CONTRACT_DESERIALIZATION_FAILED\": {\n\t\t\tconst filePath = typeof error.meta?.[\"filePath\"] === \"string\" ? error.meta[\"filePath\"] : \"unknown\";\n\t\t\treturn notOk(errorContractValidationFailed(`Predecessor contract at ${filePath} failed to deserialize: ${typeof error.meta?.[\"message\"] === \"string\" ? error.meta[\"message\"] : error.message}`, {\n\t\t\t\twhere: { path: filePath },\n\t\t\t\tcause: error\n\t\t\t}));\n\t\t}\n\t\tcase \"MIGRATION.INVALID_JSON\": {\n\t\t\tconst filePath = typeof error.meta?.[\"filePath\"] === \"string\" ? error.meta[\"filePath\"] : \"unknown\";\n\t\t\tconst message = typeof error.meta?.[\"parseError\"] === \"string\" ? error.meta[\"parseError\"] : error.message;\n\t\t\treturn notOk(errorContractValidationFailed((options?.artifactRole ?? \"from\") === \"to\" ? `Target contract at ${filePath} failed to deserialize: ${message}` : `Predecessor contract at ${filePath} failed to deserialize: ${message}`, {\n\t\t\t\twhere: { path: filePath },\n\t\t\t\tcause: error\n\t\t\t}));\n\t\t}\n\t\tcase \"MIGRATION.BUNDLE_NOT_FOUND_FOR_GRAPH_NODE\": return notOk(errorUnexpected(error.message, {\n\t\t\twhy: error.why,\n\t\t\tfix: error.fix,\n\t\t\tcause: error\n\t\t}));\n\t\tcase \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\": {\n\t\t\tconst expectedPath = typeof error.meta?.[\"expectedPath\"] === \"string\" ? error.meta[\"expectedPath\"] : \"migrations/snapshots/\";\n\t\t\treturn notOk(errorFileNotFound(expectedPath, {\n\t\t\t\twhy: (options?.artifactRole ?? \"from\") === \"to\" ? `Target migration is missing its contract snapshot at ${expectedPath}` : `Predecessor migration is missing its contract snapshot at ${expectedPath}`,\n\t\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\",\n\t\t\t\tcause: error\n\t\t\t}));\n\t\t}\n\t\tdefault: return notOk(error);\n\t}\n\tif (CliStructuredError$1.is(error)) return notOk(error);\n\tthrow error;\n}\n//#endregion\n//#region src/control-api/operations/graph-queries.ts\n/** True when the on-disk graph contains a path fromHash → toHash. */\nfunction hasMigrationPath(graph, fromHash, toHash) {\n\treturn findPath(graph, fromHash, toHash) !== null;\n}\n/**\n* Refusal for a live marker hash that is not a node of the on-disk app graph.\n* Same errorMarkerMismatch envelope migrate raises today, or null when the marker is a node.\n*/\nfunction refuseMarkerOutsideGraph(args) {\n\tif (isGraphNode(args.markerHash, args.graph)) return null;\n\treturn errorMarkerMismatch(args.markerHash, [...args.graph.nodes].sort(), findLatestMigration(args.graph)?.to ?? null);\n}\n//#endregion\n//#region src/control-api/operations/invariants.ts\n/**\n* Invariant refusals shared by migrate and migration status: unknown ref invariants and unsatisfiable invariant paths.\n*/\n/** Refuses ref invariants neither declared on any graph edge nor present on the live marker. */\nfunction refuseUnknownInvariants(args) {\n\tconst declared = collectDeclaredInvariants(args.graph);\n\tconst known = new Set(declared);\n\tfor (const id of args.markerInvariants) known.add(id);\n\tconst unknown = args.refInvariants.filter((id) => !known.has(id));\n\tif (unknown.length === 0) return null;\n\treturn errorUnknownInvariant({\n\t\t...ifDefined(\"refName\", args.refName),\n\t\tunknown,\n\t\tdeclared: [...declared].sort()\n\t});\n}\n/** Refuses a --to target whose missing invariants no path from originHash satisfies. */\nfunction refuseMissingInvariantPath(args) {\n\tconst outcome = findPathWithDecision(args.graph, args.originHash, args.targetHash, {\n\t\t...ifDefined(\"refName\", args.refName),\n\t\trequired: new Set(args.missing)\n\t});\n\tif (outcome.kind !== \"unsatisfiable\") return null;\n\treturn errorNoInvariantPath({\n\t\t...ifDefined(\"refName\", args.refName),\n\t\trequired: [...args.missing].sort(),\n\t\tmissing: outcome.missing,\n\t\tstructuralPath: outcome.structuralPath.map(toStructuralEdge)\n\t});\n}\n//#endregion\n//#region src/control-api/operations/migrate-show.ts\n/**\n* Computes the path through the SAME seam as `executeMigrate`:\n* - `readAllMarkers()` for the from-state (when no `--from` is given), preserving\n* the full marker including `invariants` (not just `storageHash`).\n* - `planSpacePath()` (shared with `executeMigrate`) for per-space path selection,\n* which feeds `resolveRecordedPath()` with the same target hash, target invariants,\n* and current marker as the real apply path uses.\n*\n* Returns BEFORE any write boundary (`runMigration` / marker / DDL). No\n* DB state is mutated.\n*/\nasync function executeMigrateShowPlan(options) {\n\tconst config = options.config;\n\tconst { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.configPath, config, options.cwd);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tconst hasDriver = !!config.driver;\n\tconst hasExplicitFrom = options.from !== void 0;\n\tif (!hasExplicitFrom) {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"migrate --show needs a database connection to read the live marker (or pass --from <contract> for an offline preview)\",\n\t\t\tretryCommand: \"prisma-cli migrate --show --from <contract>\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t}\n\tlet allRefs = {};\n\ttry {\n\t\tallRefs = await readRefs(refsDir);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return notOk(loaded.failure);\n\tconst { aggregate, contractHash } = loaded.value;\n\tconst appGraph = aggregate.app.graph();\n\tlet targetHash = contractHash;\n\tlet refInvariants;\n\tif (options.to) {\n\t\tconst toResult = parseContractRef(options.to, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs,\n\t\t\tcontractHash\n\t\t});\n\t\tif (!toResult.ok) return notOk(mapRefResolutionError(toResult.failure));\n\t\tif (toResult.value.provenance.kind === \"reserved-db\") return notOk(errorDatabaseConnectionRequired({\n\t\t\twhy: \"@db is not valid as a --to target; it names the live database state, not a target contract.\",\n\t\t\tcommandName: \"migrate --show\"\n\t\t}));\n\t\ttargetHash = toResult.value.hash;\n\t\tif (toResult.value.provenance.kind === \"ref\") {\n\t\t\tconst refEntry = allRefs[toResult.value.provenance.refName];\n\t\t\tif (refEntry) refInvariants = refEntry.invariants;\n\t\t}\n\t}\n\toptions.onPreflightComplete?.({\n\t\tconfigPath,\n\t\tmigrationsRelative,\n\t\tdbConnection,\n\t\thasExplicitFrom\n\t});\n\tconst markerBySpace = /* @__PURE__ */ new Map();\n\tconst allSpaces = [aggregate.app, ...aggregate.extensions];\n\tif (hasExplicitFrom) if (options.from === \"@db\") {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"@db resolves to the live database marker and requires a --db connection\",\n\t\t\tretryCommand: \"prisma-cli migrate --show --from @db --db $DATABASE_URL\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t} else {\n\t\tconst fromResult = parseContractRef(options.from, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs,\n\t\t\tcontractHash\n\t\t});\n\t\tif (!fromResult.ok) return notOk(mapRefResolutionError(fromResult.failure));\n\t\tif (fromResult.value.provenance.kind === \"reserved-db\") {\n\t\t\tconst missingDb = requireLiveDatabase({\n\t\t\t\tdbConnection,\n\t\t\t\thasDriver,\n\t\t\t\twhy: \"@db resolves to the live database marker and requires a --db connection\"\n\t\t\t});\n\t\t\tif (missingDb) return notOk(missingDb);\n\t\t} else {\n\t\t\tconst fromHash = fromResult.value.hash;\n\t\t\tconst offlineMarker = fromHash === EMPTY_CONTRACT_HASH ? null : {\n\t\t\t\tstorageHash: fromHash,\n\t\t\t\tinvariants: []\n\t\t\t};\n\t\t\tmarkerBySpace.set(aggregate.app.spaceId, offlineMarker);\n\t\t}\n\t}\n\tconst needsLiveMarker = !hasExplicitFrom || options.from === \"@db\";\n\tif (needsLiveMarker) {\n\t\tif (!dbConnection || !hasDriver) return notOk(errorDatabaseConnectionRequired({\n\t\t\twhy: \"A database connection is required to read the live marker for migrate --show\",\n\t\t\tcommandName: \"migrate --show\"\n\t\t}));\n\t\tconst client = (options.createClient ?? createControlClient)({\n\t\t\tfamily: config.family,\n\t\t\ttarget: config.target,\n\t\t\tadapter: config.adapter,\n\t\t\tdriver: config.driver,\n\t\t\textensions: config.extensions ?? []\n\t\t});\n\t\ttry {\n\t\t\tawait client.connect(dbConnection);\n\t\t\tconst allMarkers = await client.readAllMarkers();\n\t\t\tfor (const space of allSpaces) {\n\t\t\t\tconst marker = allMarkers.get(space.spaceId);\n\t\t\t\tmarkerBySpace.set(space.spaceId, marker ?? null);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError$1.is(error)) return notOk(error);\n\t\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read live DB marker: ${error instanceof Error ? error.message : String(error)}` }));\n\t\t} finally {\n\t\t\tawait closeQuietly(client);\n\t\t}\n\t}\n\tconst canonicalOrderSpaces = [...aggregate.extensions, aggregate.app];\n\tconst orderedMigrations = [];\n\tfor (const space of canonicalOrderSpaces) {\n\t\tconst isAppSpace = space.spaceId === aggregate.app.spaceId;\n\t\tconst headRef = requireHeadRef(space);\n\t\tconst outcome = planSpacePath({\n\t\t\tspace,\n\t\t\taggregate,\n\t\t\ttargetHash: isAppSpace ? targetHash : headRef.hash,\n\t\t\trefInvariants: isAppSpace ? refInvariants : void 0,\n\t\t\tliveMarker: markerBySpace.get(space.spaceId) ?? null\n\t\t});\n\t\tif (outcome.kind === \"at-head\") continue;\n\t\tif (outcome.kind === \"never-planned\") return notOk(errorPathUnreachable({\n\t\t\tcode: \"MIGRATION_PATH_NOT_FOUND\",\n\t\t\tsummary: `No on-disk migrations for contract space \"${outcome.spaceId}\"`,\n\t\t\twhy: `migrate is replay-only: space \"${outcome.spaceId}\" has no on-disk migrations but its head ref targets \"${outcome.targetHash}\".`,\n\t\t\tmeta: {\n\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\ttarget: outcome.targetHash,\n\t\t\t\tkind: \"neverPlanned\"\n\t\t\t}\n\t\t}));\n\t\tif (outcome.kind === \"unreachable\") {\n\t\t\tconst fromHash = outcome.liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;\n\t\t\treturn notOk(errorPathUnreachable({\n\t\t\t\tcode: \"MIGRATION_PATH_NOT_FOUND\",\n\t\t\t\tsummary: `No migration path from ${fromHash.slice(0, 14)} to ${outcome.targetHash.slice(0, 14)} in space \"${outcome.spaceId}\".`,\n\t\t\t\twhy: `The migration graph has no path from the from-state to the target in space \"${outcome.spaceId}\".`,\n\t\t\t\tmeta: {\n\t\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\t\tfrom: fromHash,\n\t\t\t\t\tto: outcome.targetHash\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (outcome.kind === \"unsatisfiable\") return notOk(errorRuntime(\"MIGRATION.NO_INVARIANT_PATH\", `Missing required invariants for space \"${outcome.spaceId}\"`, {\n\t\t\twhy: `The path requires invariants not available on disk: ${outcome.missing.join(\", \")}`,\n\t\t\tfix: \"Add a migration on the path that runs `dataTransform({ invariantId: \\\"<id>\\\", … })` for each missing invariant, or retarget the ref to a hash whose path already provides them.\",\n\t\t\tmeta: {\n\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\tmissing: [...outcome.missing]\n\t\t\t}\n\t\t}));\n\t\tfor (const edge of outcome.plan.migrationEdges) orderedMigrations.push({\n\t\t\tspaceId: space.spaceId,\n\t\t\tdirName: edge.dirName,\n\t\t\tmigrationHash: edge.migrationHash,\n\t\t\tfrom: edge.from,\n\t\t\tto: edge.to\n\t\t});\n\t}\n\tconst count = orderedMigrations.length;\n\treturn ok({\n\t\taggregate,\n\t\tcontractHash,\n\t\tmigrations: orderedMigrations,\n\t\tsummary: count === 0 ? \"Already up to date — nothing to run\" : `${count} migration${count === 1 ? \"\" : \"s\"} will run`,\n\t\trenderMarkerHashBySpace: new Map(allSpaces.map((s) => [s.spaceId, markerBySpace.get(s.spaceId)?.storageHash ?? EMPTY_CONTRACT_HASH])),\n\t\tusedLiveMarker: needsLiveMarker\n\t});\n}\n//#endregion\n//#region src/control-api/operations/ref-resolution.ts\nfunction resolveContractRef$1(input, context) {\n\tconst result = parseContractRef(input, context);\n\treturn result.ok ? ok(result.value) : notOk(mapRefResolutionError(result.failure));\n}\nfunction resolveMigrationRef(input, context) {\n\tconst result = parseMigrationRef(input, context);\n\treturn result.ok ? ok(result.value) : notOk(mapRefResolutionError(result.failure));\n}\n//#endregion\n//#region src/control-api/operations/migration-list.ts\nfunction compareSpaceIds(a, b) {\n\tif (a === APP_SPACE_ID$1) return b === APP_SPACE_ID$1 ? 0 : -1;\n\tif (b === APP_SPACE_ID$1) return 1;\n\tif (a < b) return -1;\n\tif (a > b) return 1;\n\treturn 0;\n}\nfunction compareDirNamesDescending(a, b) {\n\tif (a.name < b.name) return 1;\n\tif (a.name > b.name) return -1;\n\treturn 0;\n}\n/**\n* Ref names decorating a space's destination contract hashes. The\n* tolerant `space.refs` deliberately omits the structural `head.json`;\n* for extension spaces the old enumerator surfaced it as a `head`\n* decoration on the tip migration, so fold `space.headRef` back in to\n* keep that output. The app space synthesises its head, so it carries\n* no on-disk `head` ref to restore.\n*/\nfunction listRefsByContractHash(space) {\n\tconst byHash = new Map(refsByContractHash(space.refs));\n\tif (space.spaceId !== APP_SPACE_ID$1 && space.headRef !== null) {\n\t\tconst hash = space.headRef.hash;\n\t\tconst bucket = byHash.get(hash) ?? [];\n\t\tif (!bucket.includes(HEAD_REF_NAME)) byHash.set(hash, [...bucket, HEAD_REF_NAME].sort());\n\t}\n\treturn byHash;\n}\nasync function orderedOnDiskSpaceIds(projectMigrationsDir) {\n\treturn (await listContractSpaceDirectories(projectMigrationsDir)).filter(isValidSpaceId).sort(compareSpaceIds);\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the render-ready\n* {@link MigrationSpaceListEntry} rows `migration list` displays.\n*\n* Space membership matches the on-disk contract-space directories (not the\n* aggregate's always-present synthesized app space when `migrations/app/`\n* is absent); package and ref data come from `aggregate.space(id)`.\n*/\nasync function migrationSpaceListEntriesFromAggregate(aggregate, projectMigrationsDir) {\n\tconst spaceIds = await orderedOnDiskSpaceIds(projectMigrationsDir);\n\tconst spaces = [];\n\tfor (const spaceId of spaceIds) {\n\t\tconst space = aggregate.space(spaceId);\n\t\tif (space === void 0) continue;\n\t\tconst refsByHash = listRefsByContractHash(space);\n\t\tconst migrations = space.packages.map((pkg) => ({\n\t\t\tname: pkg.dirName,\n\t\t\thash: pkg.metadata.migrationHash,\n\t\t\tfromContract: pkg.metadata.from,\n\t\t\ttoContract: pkg.metadata.to,\n\t\t\toperationCount: pkg.ops.length,\n\t\t\tcreatedAt: pkg.metadata.createdAt,\n\t\t\trefs: [...refsByHash.get(pkg.metadata.to) ?? []],\n\t\t\tprovidedInvariants: [...pkg.metadata.providedInvariants]\n\t\t})).sort(compareDirNamesDescending);\n\t\tspaces.push({\n\t\t\tspace: spaceId,\n\t\t\tmigrations\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction computeSummary(spaces) {\n\tconst totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);\n\tif (spaces.length <= 1) return `${totalMigrations} migration(s) on disk`;\n\treturn `${totalMigrations} migration(s) across ${spaces.length} contract space(s)`;\n}\n/**\n* Policy core of `migration list`: validates `--space`, narrows the\n* pre-enumerated spaces, and assembles a {@link MigrationListResult}.\n*\n* - `migrations/` missing or contains no valid space directories →\n* caller passes `spaces: []`; this synthesizes `[{ spaceId: APP_SPACE_ID, migrations: [] }]`.\n* - `--space <id>` on an existing-but-empty space → `{ spaceId, migrations: [] }` in the input.\n* - `--space <id>` on a non-existent (or reserved) space → `SPACE_NOT_FOUND`.\n*/\nfunction runMigrationList(inputs) {\n\tconst { spaces, spaceFilter } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.space === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.space).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.space === spaceFilter) : spaces;\n\tconst resultSpaces = scopedSpaces.length === 0 ? [{\n\t\tspace: APP_SPACE_ID$1,\n\t\tmigrations: []\n\t}] : scopedSpaces;\n\treturn ok({\n\t\tok: true,\n\t\tspaces: [...resultSpaces],\n\t\tsummary: computeSummary(resultSpaces)\n\t});\n}\n//#endregion\n//#region src/utils/migration-path-target.ts\nfunction looksLikePath(target) {\n\treturn target.includes(\"/\") || target.includes(\"\\\\\");\n}\nfunction resolveAppTargetPath(cwd, target, appMigrationsDir, appMigrationsRelative) {\n\tconst targetPath = resolve(cwd, target);\n\tconst relativeToApp = relative(appMigrationsDir, targetPath);\n\tif (relativeToApp === \"\" || relativeToApp === \".\" || relativeToApp.startsWith(\"..\") || isAbsolute(relativeToApp)) return notOk(errorRuntime(\"MIGRATION.TARGET_NOT_APP_SPACE\", \"Target must point to an app-space migration\", {\n\t\twhy: `Expected a path under ${appMigrationsRelative}, got ${target}`,\n\t\tfix: \"Pass an app-space migration directory or use a hash prefix.\"\n\t}));\n\treturn ok(targetPath);\n}\n/**\n* Resolve a filesystem-path target to the migration dir that contains it,\n* searching each in-scope space's `migrationsDir`. A path is explicit, so\n* it can belong to at most one space — returns the first match, or `null`\n* when the path falls outside every space dir.\n*/\nfunction resolveTargetPathAcrossSpaces(cwd, target, spaces) {\n\tconst targetPath = resolve(cwd, target);\n\tfor (const space of spaces) {\n\t\tconst rel = relative(space.migrationsDir, targetPath);\n\t\tif (!(rel === \"\" || rel === \".\" || rel.startsWith(\"..\") || isAbsolute(rel))) return targetPath;\n\t}\n\treturn null;\n}\nfunction findPackageByDirPath(packages, resolvedDirPath) {\n\tconst normalized = resolve(resolvedDirPath);\n\treturn packages.find((p) => resolve(p.dirPath) === normalized);\n}\n//#endregion\n//#region src/control-api/operations/migration-check.ts\n/**\n* Policy core of `migration check`: per-space explicit graph checks, aggregate-integrity loading, and single-target resolution.\n*/\nfunction migrationPathRelative(cwd, dirPath) {\n\treturn relative(cwd, dirPath);\n}\nfunction migrationFileRelative(cwd, dirPath, fileName) {\n\treturn join(migrationPathRelative(cwd, dirPath), fileName);\n}\nfunction checkFileExists(space, dirPath, dirName, fileName) {\n\tif (!existsSync(join(dirPath, fileName))) return {\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_FILE_MISSING\",\n\t\twhere: migrationFileRelative(space.cwd, dirPath, fileName),\n\t\twhy: `${fileName} is missing from ${dirName}`,\n\t\tnextActions: [chooseAction(\"Re-emit the migration package, or restore it from version control\")]\n\t};\n\treturn null;\n}\n/**\n* Snapshot-store consistency check for one migration package (D6.5):\n* absent store entry is not an issue (runner independence, ADR 199 — a\n* package dir with only `migration.json` + `ops.json` is legitimate); a\n* present entry whose inner `storage.storageHash` disagrees with\n* `pkg.metadata.to` is `MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH`; an unparseable store\n* entry (or a malformed `to`) is `MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE`.\n*/\nasync function checkSnapshotConsistency(space, pkg, migrationsDir) {\n\tconst spaceId = space.spaceId;\n\tlet snapshotDir;\n\ttry {\n\t\tsnapshotDir = contractSnapshotDir(migrationsDir, pkg.metadata.to);\n\t} catch {\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" declares to=\"${pkg.metadata.to}\", which is not a well-formed contract snapshot hash.`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the migration package so migration.json declares a valid 64-hex to-hash\")]\n\t\t};\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readContractSnapshotJson(migrationsDir, pkg.metadata.to);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return null;\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" has an unparseable contract snapshot at ${snapshotDir}/contract.json.`,\n\t\t\tnextActions: [chooseAction(\"Restore migrations/snapshots/ from version control\"), chooseAction(\"Or re-run the command that produced this migration to regenerate its snapshot\")]\n\t\t};\n\t}\n\tconst snapshotHash = (raw !== null && typeof raw === \"object\" ? raw : {})[\"storage\"]?.[\"storageHash\"];\n\tif (typeof snapshotHash === \"string\" && snapshotHash !== pkg.metadata.to) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH\",\n\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" declares to=${pkg.metadata.to} but its contract snapshot has storageHash=${snapshotHash}`,\n\t\tnextActions: [chooseAction(\"Re-emit the migration package so migration.json and its contract snapshot agree\")]\n\t};\n\treturn null;\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the\n* {@link CheckSpace} rows the multi-space check iterates — one per on-disk\n* contract-space directory, in the aggregate's `app`-first ordering. Mirrors\n* `migration list`'s `migrationSpaceListEntriesFromAggregate`: space\n* membership matches the on-disk directories, package / ref / graph data come\n* from `aggregate.space(id)`.\n*/\nasync function enumerateCheckSpaces(aggregate, projectMigrationsDir, cwd) {\n\tconst candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst onDiskSpaceIds = new Set(candidateDirs.filter(isValidSpaceId));\n\tconst spaces = [];\n\tfor (const space of aggregate.spaces()) {\n\t\tconst spaceId = space.spaceId;\n\t\tif (!isValidSpaceId(spaceId)) continue;\n\t\tif (!onDiskSpaceIds.has(spaceId)) continue;\n\t\tconst migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);\n\t\tspaces.push({\n\t\t\tspaceId,\n\t\t\tpackages: space.packages,\n\t\t\trefs: space.refs,\n\t\t\tgraph: space.graph(),\n\t\t\tmigrationsDir,\n\t\t\trefsDir: spaceRefsDirectory(migrationsDir),\n\t\t\tprojectMigrationsDir,\n\t\t\tcwd\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction checkManifestFilesPresent(space) {\n\tif (!existsSync(space.migrationsDir)) return [];\n\tconst loadedDirNames = new Set(space.packages.map((p) => p.dirName));\n\tconst failures = [];\n\tlet entries;\n\ttry {\n\t\tentries = readdirSync(space.migrationsDir);\n\t} catch {\n\t\treturn failures;\n\t}\n\tfor (const entry of entries) {\n\t\tif (entry.startsWith(\".\") || entry.startsWith(\"_\") || entry === \"refs\") continue;\n\t\tconst entryPath = join(space.migrationsDir, entry);\n\t\ttry {\n\t\t\tif (!statSync(entryPath).isDirectory()) continue;\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!loadedDirNames.has(entry)) for (const f of [\"migration.json\", \"ops.json\"]) {\n\t\t\tconst fail = checkFileExists(space, entryPath, entry, f);\n\t\t\tif (fail) failures.push(fail);\n\t\t}\n\t}\n\treturn failures;\n}\nfunction checkReachability(space) {\n\tconst allToHashes = new Set(space.packages.map((p) => p.metadata.to));\n\tconst failures = [];\n\tfor (const pkg of space.packages) if (!(pkg.metadata.from === null || allToHashes.has(pkg.metadata.from) || pkg.metadata.from === EMPTY_CONTRACT_HASH)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_UNREACHABLE_MIGRATION\",\n\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" starts from ${pkg.metadata.from} which no other migration produces`,\n\t\tnextActions: [chooseAction(\"Delete the unreachable migration\"), chooseAction(\"Or re-emit a migration that connects it to the graph\")]\n\t});\n\treturn failures;\n}\nfunction checkDanglingRefs(space) {\n\tconst failures = [];\n\tfor (const [name, entry] of Object.entries(space.refs)) if (!space.graph.nodes.has(entry.hash)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_DANGLING_REF\",\n\t\twhere: relative(space.cwd, join(space.refsDir, `${name}.json`)),\n\t\twhy: `Ref \"${name}\" points at ${entry.hash} which does not exist in the migration graph`,\n\t\tnextActions: [runCommandAction(\"Point the ref at a graph node\", `prisma-cli ref set ${name} <valid-hash>`), chooseAction(\"Or delete the ref\")]\n\t});\n\treturn failures;\n}\nasync function checkSpace(space) {\n\tconst snapshotFailures = await Promise.all(space.packages.map((pkg) => checkSnapshotConsistency(space, pkg, space.projectMigrationsDir)));\n\treturn [\n\t\t...checkManifestFilesPresent(space),\n\t\t...snapshotFailures.filter((f) => f !== null),\n\t\t...checkReachability(space),\n\t\t...checkDanglingRefs(space)\n\t];\n}\n/**\n* Policy core of the holistic `migration check`: validates `--space`,\n* narrows the pre-enumerated spaces, and runs the per-space explicit graph\n* checks (file-existence, snapshot consistency, reachability, dangling\n* refs), aggregating every failure into one {@link MigrationCheckResult}.\n*\n* `--space` validation mirrors `migration list`: an invalid id →\n* {@link errorInvalidSpaceId}; an id with no on-disk space →\n* {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.\n* Aggregate-integrity violations (which already span every space) are folded\n* in by the caller, not here.\n*/\nasync function runMigrationCheck(inputs) {\n\tconst { spaces, spaceFilter } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tconst failures = (await Promise.all(scopedSpaces.map(checkSpace))).flat();\n\tif (failures.length === 0) return ok({\n\t\tok: true,\n\t\tfailures: [],\n\t\tsummary: \"All checks passed\"\n\t});\n\treturn ok({\n\t\tok: false,\n\t\tfailures,\n\t\tsummary: `${failures.length} integrity failure(s)`\n\t});\n}\nasync function loadAggregateIntegrityViolations(config, migrationsDir) {\n\ttry {\n\t\tconst contractJsonContent = await readFile(resolveContractPath(config), \"utf-8\");\n\t\tconst familyInstance = config.family.create(createControlStack(config));\n\t\tconst declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);\n\t\tconst parsedAppContract = JSON.parse(contractJsonContent);\n\t\treturn (await loadContractSpaceAggregate({\n\t\t\tmigrationsDir,\n\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\t\tappContract: familyInstance.deserializeContract(parsedAppContract)\n\t\t})).checkIntegrity({\n\t\t\tdeclaredExtensions,\n\t\t\tcheckContracts: true\n\t\t});\n\t} catch {\n\t\treturn [];\n\t}\n}\n/**\n* Ranks ref-resolution failure kinds by how informative they are, so a\n* single-target check surfaces the most useful failure across spaces instead of\n* whichever space failed first. `not-found` (the input matched nothing here)\n* says the least; a malformed input, a wrong grammar, or an in-space ambiguity\n* all say more.\n*/\nfunction refFailureSpecificity(error) {\n\tswitch (error.kind) {\n\t\tcase \"wrong-grammar\": return 3;\n\t\tcase \"ambiguous\": return 2;\n\t\tcase \"invalid-format\": return 1;\n\t\tcase \"not-found\": return 0;\n\t}\n}\n/**\n* Single-target (`check <ref/path>`) mode — resolves a migration reference\n* across all contract spaces (or the one space narrowed by `--space <id>`).\n*\n* Resolution:\n* - filesystem path → find the owning space by checking which space's\n* `migrationsDir` contains the resolved path; falls back to app-relative\n* validation when the path is outside every space dir.\n* - ref → `parseMigrationRef` against each in-scope space; collect every\n* (space, package) hit; 0 hits = not-found, 1 = check it, >1 = ambiguity\n* error (qualify with `--space`).\n*\n* `--space <id>` is validated the same way the holistic path does it:\n* invalid id → `errorInvalidSpaceId`; no on-disk space → `errorSpaceNotFound`.\n*/\nasync function checkSingleTarget(target, inputs) {\n\tconst { spaces, spaceFilter, appMigrationsDir, appMigrationsRelative, cwd } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return {\n\t\terror: errorInvalidSpaceId(spaceFilter),\n\t\texitCode: 2\n\t};\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return {\n\t\terror: errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()),\n\t\texitCode: 2\n\t};\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tlet matchedSpace;\n\tlet matchedPkg;\n\tif (looksLikePath(target)) {\n\t\tconst resolvedPath = resolveTargetPathAcrossSpaces(cwd, target, scopedSpaces);\n\t\tif (resolvedPath !== null) for (const space of scopedSpaces) {\n\t\t\tconst found = findPackageByDirPath(space.packages, resolvedPath);\n\t\t\tif (found) {\n\t\t\t\tmatchedSpace = space;\n\t\t\t\tmatchedPkg = found;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconst resolved = resolveAppTargetPath(cwd, target, appMigrationsDir, appMigrationsRelative);\n\t\t\tif (!resolved.ok) return {\n\t\t\t\terror: resolved.failure,\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t\tconst appSpace = scopedSpaces.find((s) => s.spaceId === \"app\");\n\t\t\tif (appSpace) {\n\t\t\t\tmatchedSpace = appSpace;\n\t\t\t\tmatchedPkg = findPackageByDirPath(appSpace.packages, resolved.value);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst hits = [];\n\t\tlet bestParseFailure;\n\t\tfor (const space of scopedSpaces) {\n\t\t\tconst migResult = parseMigrationRef(target, {\n\t\t\t\tgraph: space.graph,\n\t\t\t\trefs: space.refs\n\t\t\t});\n\t\t\tif (!migResult.ok) {\n\t\t\t\tif (bestParseFailure === void 0 || refFailureSpecificity(migResult.failure) > refFailureSpecificity(bestParseFailure)) bestParseFailure = migResult.failure;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst pkg = space.packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);\n\t\t\tif (pkg) hits.push({\n\t\t\t\tspace,\n\t\t\t\tpkg\n\t\t\t});\n\t\t}\n\t\tif (hits.length > 1) return {\n\t\t\terror: errorAmbiguousMigrationRef(target, hits.map((h) => h.space.spaceId)),\n\t\t\texitCode: 2\n\t\t};\n\t\tif (hits.length === 1) {\n\t\t\tmatchedSpace = hits[0].space;\n\t\t\tmatchedPkg = hits[0].pkg;\n\t\t} else if (bestParseFailure !== void 0) return {\n\t\t\terror: mapRefResolutionError(bestParseFailure),\n\t\t\texitCode: 2\n\t\t};\n\t}\n\tif (!matchedPkg || !matchedSpace) return {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: `Migration package for \"${target}\" not found on disk`\n\t\t},\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkManifestFilesPresent(matchedSpace)];\n\tfor (const f of [\"migration.json\", \"ops.json\"]) {\n\t\tconst fail = checkFileExists(matchedSpace, matchedPkg.dirPath, matchedPkg.dirName, f);\n\t\tif (fail) failures.push(fail);\n\t}\n\tconst verification = verifyMigrationHash(matchedPkg);\n\tif (!verification.ok) failures.push({\n\t\tspace: matchedSpace.spaceId,\n\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\twhere: migrationFileRelative(matchedSpace.cwd, matchedPkg.dirPath, \"migration.json\"),\n\t\twhy: `Stored hash ${verification.storedHash} does not match recomputed hash ${verification.computedHash}`,\n\t\tnextActions: [chooseAction(\"Re-emit the migration package, or restore it from version control\")]\n\t});\n\tconst snapshotFailure = await checkSnapshotConsistency(matchedSpace, matchedPkg, matchedSpace.projectMigrationsDir);\n\tif (snapshotFailure) failures.push(snapshotFailure);\n\tconst resolvedSpaceId = matchedSpace.spaceId !== \"app\" ? matchedSpace.spaceId : void 0;\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n}\n//#endregion\n//#region src/control-api/operations/migration-graph.ts\n/**\n* Project scoped list entries into the per-space contracts+migrations rows the migration\n* graph --json output serializes (EMPTY_CONTRACT_HASH from-hash → null). Skips space ids\n* the aggregate no longer resolves, mirroring the command loop.\n*/\nfunction buildMigrationSpaceGraphEntries(args) {\n\tconst spaces = [];\n\tfor (const spaceEntry of args.scopedSpaces) {\n\t\tconst space = args.aggregate.space(spaceEntry.space);\n\t\tif (space === void 0) continue;\n\t\tconst graph = space.graph();\n\t\tconst refsByHash = listRefsByContractHash(space);\n\t\tspaces.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\tcontracts: [...graph.nodes].map((hash) => ({\n\t\t\t\thash,\n\t\t\t\trefs: [...refsByHash.get(hash) ?? []]\n\t\t\t})),\n\t\t\tmigrations: [...graph.migrationByHash.values()].map((edge) => ({\n\t\t\t\tname: edge.dirName,\n\t\t\t\thash: edge.migrationHash,\n\t\t\t\tfromContract: edge.from === EMPTY_CONTRACT_HASH ? null : edge.from,\n\t\t\t\ttoContract: edge.to\n\t\t\t}))\n\t\t});\n\t}\n\treturn spaces;\n}\n//#endregion\n//#region src/control-api/operations/migration-new.ts\n/**\n* Policy core of `migration new`: scaffolds a migration package with a `migration.ts` stub for manual authoring.\n*/\nasync function executeMigrationNewCommand(options) {\n\tconst config = options.config;\n\tconst cwd = options.cwd;\n\tconst { migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.configPath, config, cwd);\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tconst controlAdapter = config.adapter.create(stack);\n\tconst contractPathAbsolute = resolveContractPath(config);\n\tlet contractJsonContent;\n\ttry {\n\t\tcontractJsonContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorRuntime(\"CLI.FILE_NOT_FOUND\", `Contract file not found at ${contractPathAbsolute}`, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: \"Run `prisma-cli contract emit` first to generate the contract\"\n\t\t}));\n\t\tthrow error;\n\t}\n\tlet toContract;\n\ttry {\n\t\tconst parsedContract = JSON.parse(contractJsonContent);\n\t\ttoContract = familyInstance.deserializeContract(parsedContract);\n\t} catch (error) {\n\t\treturn notOk(errorRuntime(\"MIGRATION.CONTRACT_DESERIALIZATION_FAILED\", \"Contract JSON is invalid\", {\n\t\t\twhy: `Failed to deserialize ${contractPathAbsolute}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\tfix: \"Run `prisma-cli contract emit` to regenerate the contract\",\n\t\t\tcause: error\n\t\t}));\n\t}\n\tconst toStorageHash = toContract.storage?.storageHash;\n\tif (typeof toStorageHash !== \"string\") return notOk(errorRuntime(\"CONTRACT.VALIDATION_FAILED\", \"Contract is missing storageHash\", {\n\t\twhy: `Contract at ${contractPathAbsolute} has no storageHash`,\n\t\tfix: \"Run `prisma-cli contract emit` to regenerate the contract\"\n\t}));\n\tconst aggregate = await loadContractSpaceAggregate({\n\t\tmigrationsDir,\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\tappContract: toContract\n\t});\n\tconst packageCorruptionFailure = refusePackageCorruptionOnAggregate(aggregate);\n\tif (packageCorruptionFailure) return notOk(packageCorruptionFailure);\n\tconst packages = aggregate.app.packages;\n\tconst graph = aggregate.app.graph();\n\tlet fromHash = null;\n\tif (packages.length > 0) if (options.from) {\n\t\tconst match = packages.find((p) => p.metadata.to.startsWith(options.from));\n\t\tif (!match) return notOk(errorRuntime(\"MIGRATION.HASH_NOT_IN_GRAPH\", \"Starting contract not found\", {\n\t\t\twhy: `No migration with to hash matching \"${options.from}\" exists in ${appMigrationsRelative}`,\n\t\t\tfix: \"Check that the --from hash matches a known migration target hash.\"\n\t\t}));\n\t\tfromHash = match.metadata.to;\n\t} else {\n\t\tconst latestMigration = findLatestMigration(graph);\n\t\tif (latestMigration) fromHash = latestMigration.to;\n\t}\n\tif (fromHash === toStorageHash && !options.from) return notOk(errorRuntime(\"MIGRATION.NO_CHANGES\", \"No changes detected\", {\n\t\twhy: \"The from and to contract hashes are identical — there is nothing to migrate.\",\n\t\tfix: \"Change the contract and run `prisma-cli contract emit` before creating a new migration. To author a data-only migration on the current contract hash, pass `--from <hash>` explicitly.\"\n\t}));\n\tconst timestamp = /* @__PURE__ */ new Date();\n\tconst packageDir = join(appMigrationsDir, formatMigrationDirName(timestamp, options.name ?? \"migration\"));\n\tconst baseMetadata = {\n\t\tfrom: fromHash,\n\t\tto: toStorageHash,\n\t\tprovidedInvariants: [],\n\t\tcreatedAt: timestamp.toISOString()\n\t};\n\tconst metadata = {\n\t\t...baseMetadata,\n\t\tmigrationHash: computeMigrationHash(baseMetadata, [])\n\t};\n\tconst migrations = getTargetMigrations(config.target);\n\tif (!migrations) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.targetId}\" does not support migrations` }));\n\ttry {\n\t\tassertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, [\n\t\t\tconfig.target,\n\t\t\tconfig.adapter,\n\t\t\t...config.extensions ?? []\n\t\t]);\n\t\tconst resolveSpecifier = createProjectSpecifierResolver(options.configPath);\n\t\tawait writeMigrationPackage(packageDir, metadata, []);\n\t\tconst destinationArtifacts = getEmittedArtifactPaths(contractPathAbsolute);\n\t\tconst [contractJsonRaw, contractDts] = await Promise.all([readFile(destinationArtifacts.jsonPath, \"utf-8\"), readFile(destinationArtifacts.dtsPath, \"utf-8\")]);\n\t\tawait writeContractSnapshot(migrationsDir, toStorageHash, {\n\t\t\tcontractJson: JSON.parse(contractJsonRaw),\n\t\t\tcontractDts\n\t\t});\n\t\tawait writeMigrationTs(packageDir, migrations.createPlanner(controlAdapter).emptyMigration({\n\t\t\tpackageDir,\n\t\t\tcontractJsonPath: join(contractSnapshotDir(migrationsDir, toStorageHash), \"contract.json\"),\n\t\t\tfromHash,\n\t\t\ttoHash: toStorageHash,\n\t\t\tsnapshotsImportPath: snapshotsImportPathFrom(packageDir, migrationsDir)\n\t\t}, APP_SPACE_ID).renderTypeScript(resolveSpecifier));\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tdir: relative(cwd, packageDir),\n\t\t\tfrom: fromHash,\n\t\t\tto: toStorageHash,\n\t\t\tsummary: `Scaffolded migration at ${relative(cwd, packageDir)}`\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return notOk(error);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to scaffold migration: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n}\n//#endregion\n//#region src/control-api/operations/contract-space-seed-phase.ts\n/**\n* Phase-1 of the two-phase `migration plan` pipeline (sub-spec § 4).\n*\n* For every extension that exposes a `contractSpace`:\n*\n* 1. Read the on-disk head ref (returns `null` on first emit).\n* 2. Write the head contract into the migrations-root snapshot store\n* (write-if-absent, keyed by hash) and unconditionally re-emit\n* `refs/head.json`, via {@link emitContractSpaceArtifacts}. The\n* framework owns `refs/head.json`; re-emit is the contract for that\n* file. The snapshot itself is only written once per distinct hash.\n* 3. Materialise any descriptor-shipped migration packages not yet on\n* disk via {@link materialiseExtensionMigrationPackageIfMissing}.\n* Existing packages are left untouched (by-existence skip).\n*\n* The return value lets the caller render a per-space status line and\n* lets the phase-2 aggregate loader run on a now-consistent disk state\n* (every loaded extension is guaranteed to have its head ref pinned\n* to the descriptor's hash and to ship every package the descriptor\n* declares).\n*\n* Output ordering is deterministic and alphabetical by spaceId (via\n* {@link planAllSpaces}, which also detects duplicate spaceIds). This\n* matches the canonical sort order used by every other aggregate\n* surface (`migrate`, `migration status`, the runner).\n*/\nasync function runContractSpaceSeedPhase(inputs) {\n\tconst planned = planAllSpaces(inputs.extensions.filter((pack) => pack.contractSpace !== void 0).map((pack) => ({\n\t\tspaceId: pack.id,\n\t\tpriorContract: null,\n\t\tnewContract: pack.contractSpace.contractJson,\n\t\t__pack: pack.contractSpace\n\t})), (input) => input.__pack.migrations);\n\tconst descriptorBySpace = /* @__PURE__ */ new Map();\n\tfor (const pack of inputs.extensions) if (pack.contractSpace !== void 0) descriptorBySpace.set(pack.id, pack.contractSpace);\n\tconst seeded = [];\n\tfor (const space of planned) {\n\t\tconst descriptor = descriptorBySpace.get(space.spaceId);\n\t\tif (descriptor === void 0) continue;\n\t\tconst priorHash = (await readContractSpaceHeadRef(inputs.migrationsDir, space.spaceId))?.hash ?? null;\n\t\tawait emitContractSpaceArtifacts(inputs.migrationsDir, space.spaceId, {\n\t\t\tcontract: descriptor.contractJson,\n\t\t\tcontractDts: buildPlaceholderContractDts(space.spaceId),\n\t\t\theadRef: {\n\t\t\t\thash: descriptor.headRef.hash,\n\t\t\t\tinvariants: descriptor.headRef.invariants\n\t\t\t}\n\t\t});\n\t\tconst spaceDir = spaceMigrationDirectory(inputs.migrationsDir, space.spaceId);\n\t\tconst newMigrationDirs = [];\n\t\tfor (const pkg of space.migrationPackages) {\n\t\t\tconst { written } = await materialiseExtensionMigrationPackageIfMissing(spaceDir, pkg);\n\t\t\tif (written) newMigrationDirs.push(pkg.dirName);\n\t\t}\n\t\tconst action = priorHash !== descriptor.headRef.hash || newMigrationDirs.length > 0 ? \"updated\" : \"unchanged\";\n\t\tseeded.push({\n\t\t\tspaceId: space.spaceId,\n\t\t\taction,\n\t\t\tpriorHash,\n\t\t\tnewHash: descriptor.headRef.hash,\n\t\t\tnewMigrationDirs\n\t\t});\n\t}\n\treturn { seeded };\n}\n/**\n* Placeholder `.d.ts` content for an extension space's on-disk mirror.\n*\n* Rendering a fully-typed `.d.ts` for an extension contract requires\n* the SQL-family renderer with the codec / typemap registry threaded\n* through; until that integration ships, the on-disk `.d.ts` is a\n* stub `export {};` module that documents how consumers should\n* validate the sibling `contract.json`. The stub typechecks on its\n* own and does not need any TypeScript suppressions.\n*/\nfunction buildPlaceholderContractDts(spaceId) {\n\treturn [\n\t\t\"/**\",\n\t\t` * Placeholder \\`.d.ts\\` for extension space \"${spaceId}\".`,\n\t\t\" *\",\n\t\t\" * The framework re-emits this file on every `migration plan` run\",\n\t\t\" * alongside `contract.json` and `refs/head.json`. A typed `.d.ts`\",\n\t\t\" * rendering pass for extension contracts is tracked separately;\",\n\t\t\" * until that ships, consumers should import `contract.json`\",\n\t\t\" * and pass it through the target descriptor’s `contractSerializer`.\",\n\t\t\" */\",\n\t\t\"export {};\",\n\t\t\"\"\n\t].join(\"\\n\");\n}\n//#endregion\n//#region src/control-api/operations/plan-resolution.ts\nconst FULL_HASH_PATTERN = /^([0-9a-f]{64}|empty)$/;\nfunction looksLikeFullHash(input) {\n\treturn FULL_HASH_PATTERN.test(input);\n}\nfunction graphIsEmpty(space) {\n\treturn space.packages.length === 0;\n}\nfunction getReachableRefs(refs, graph) {\n\treturn Object.entries(refs).flatMap(([name, entry]) => entry && isGraphNode(entry.hash, graph) ? [{\n\t\tname,\n\t\thash: entry.hash\n\t}] : []).sort((a, b) => a.name.localeCompare(b.name));\n}\nfunction assertFromIsGraphNode(fromHash, graph, refs, graphTipHash) {\n\ttry {\n\t\tassertHashIsGraphNode(fromHash, graph);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.HASH_NOT_IN_GRAPH\") throw errorPlanForgotTheFlag(fromHash, getReachableRefs(refs, graph), graphTipHash, { cause: error });\n\t\tthrow error;\n\t}\n}\nasync function resolveContractRef(parsed, space, options) {\n\tconst { hash, provenance } = parsed;\n\tconst refName = provenance.kind === \"ref\" ? provenance.refName : void 0;\n\ttry {\n\t\tconst at = await space.contractAt(hash, refName !== void 0 ? { refName } : void 0);\n\t\tif (at.provenance === \"ref\") return ok({\n\t\t\tkind: \"ref\",\n\t\t\thash: at.hash,\n\t\t\tcontract: at.contract,\n\t\t\tcontractJson: at.contractJson,\n\t\t\tcontractDts: at.contractDts\n\t\t});\n\t\treturn ok({\n\t\t\tkind: \"graph-node\",\n\t\t\thash: at.hash,\n\t\t\tcontract: at.contract,\n\t\t\tcontractJson: at.contractJson,\n\t\t\tcontractDts: at.contractDts\n\t\t});\n\t} catch (error) {\n\t\treturn mapContractAtError(error, options?.artifactRole !== void 0 ? { artifactRole: options.artifactRole } : void 0);\n\t}\n}\nasync function resolveFromPolicy(parsed, input, refs, explicitFromLabel) {\n\tconst resolution = await resolveContractRef(parsed, input.space, {\n\t\t...explicitFromLabel !== void 0 ? { explicitLabel: explicitFromLabel } : {},\n\t\tartifactRole: \"from\"\n\t});\n\tif (!resolution.ok) return resolution;\n\tif (resolution.value.kind === \"graph-node\") return ok({\n\t\tkind: \"graph-node\",\n\t\tfromHash: resolution.value.hash,\n\t\tfromContract: resolution.value.contract\n\t});\n\tconst { hash, contract, contractJson, contractDts } = resolution.value;\n\tif (graphIsEmpty(input.space)) return ok({\n\t\tkind: \"auto-baseline\",\n\t\tfromHash: hash,\n\t\tfromContract: contract,\n\t\tcontractDts,\n\t\tcontractJson\n\t});\n\tconst graph = input.space.graph();\n\tconst graphTip = findLatestMigration(graph)?.to ?? null;\n\ttry {\n\t\tassertFromIsGraphNode(hash, graph, refs, graphTip);\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\treturn ok({\n\t\tkind: \"ref\",\n\t\tfromHash: hash,\n\t\tfromContract: contract,\n\t\tcontractDts,\n\t\tcontractJson\n\t});\n}\nasync function resolveFromForPlan(input) {\n\tconst { optionsFrom, space } = input;\n\tconst graph = space.graph();\n\tconst refs = space.refs;\n\tif (optionsFrom === void 0) {\n\t\tconst dbRef = refs[\"db\"];\n\t\tif (!dbRef) return ok({\n\t\t\tkind: \"greenfield\",\n\t\t\tfromHash: null,\n\t\t\tfromContract: null\n\t\t});\n\t\treturn resolveFromPolicy({\n\t\t\thash: dbRef.hash,\n\t\t\tprovenance: {\n\t\t\t\tkind: \"ref\",\n\t\t\t\trefName: \"db\"\n\t\t\t}\n\t\t}, input, refs);\n\t}\n\tconst refResult = parseContractRef(optionsFrom, {\n\t\tgraph,\n\t\trefs\n\t});\n\tif (!refResult.ok) {\n\t\tif (looksLikeFullHash(optionsFrom)) {\n\t\t\tconst empty = graphIsEmpty(space);\n\t\t\tconst graphTip = findLatestMigration(graph)?.to ?? null;\n\t\t\tif (empty) return notOk(errorSnapshotMissing(optionsFrom, { viaRef: false }));\n\t\t\treturn notOk(errorPlanForgotTheFlag(optionsFrom, getReachableRefs(refs, graph), graphTip));\n\t\t}\n\t\treturn notOk(mapRefResolutionError(refResult.failure));\n\t}\n\treturn resolveFromPolicy(refResult.value, input, refs, optionsFrom);\n}\nasync function resolveToForPlan(optionsTo, input) {\n\tconst { space } = input;\n\tconst graph = space.graph();\n\tconst refs = space.refs;\n\tconst refResult = parseContractRef(optionsTo, {\n\t\tgraph,\n\t\trefs\n\t});\n\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\tconst resolution = await resolveContractRef(refResult.value, space, {\n\t\texplicitLabel: optionsTo,\n\t\tartifactRole: \"to\"\n\t});\n\tif (!resolution.ok) return resolution;\n\tconst { hash, contract, contractJson, contractDts } = resolution.value;\n\treturn ok({\n\t\thash,\n\t\tcontract,\n\t\tcontractJson,\n\t\tcontractDts\n\t});\n}\n//#endregion\n//#region src/control-api/operations/migration-plan.ts\n/**\n* Policy core of `migration plan`: resolves from/to contracts, runs the planner legs, and writes the planned migration packages.\n*/\nfunction isEnoent(error) {\n\treturn error instanceof Error && \"code\" in error && error.code === \"ENOENT\";\n}\nasync function runPlannerLeg(planner, migrations, frameworkComponents, contract, fromContract, spaceId, ownership, snapshotsImportPath, resolveImportSpecifier) {\n\tconst fromSchema = migrations.contractToSchema(fromContract, frameworkComponents);\n\tconst plannerResult = planner.plan({\n\t\tcontract,\n\t\tschema: fromSchema,\n\t\tpolicy: { allowedOperationClasses: [\n\t\t\t\"additive\",\n\t\t\t\"widening\",\n\t\t\t\"destructive\",\n\t\t\t\"data\"\n\t\t] },\n\t\tfromContract,\n\t\tframeworkComponents,\n\t\tspaceId,\n\t\townership,\n\t\tsnapshotsImportPath\n\t});\n\tif (plannerResult.kind === \"failure\") return notOk(errorMigrationPlanningFailed({ conflicts: castAs(plannerResult.conflicts) }));\n\tlet plannedOps = [];\n\tlet hasPlaceholders = false;\n\ttry {\n\t\tplannedOps = await Promise.all(plannerResult.plan.operations);\n\t\tif (plannedOps.length === 0) return notOk(errorMigrationPlanningFailed({ conflicts: [{\n\t\t\tkind: \"unsupportedChange\",\n\t\t\tsummary: \"Contract changed but planner produced no operations. This indicates unsupported or ignored changes.\"\n\t\t}] }));\n\t} catch (e) {\n\t\tif (CliStructuredError$1.is(e) && e.code === \"MIGRATION.UNFILLED_PLACEHOLDER\") hasPlaceholders = true;\n\t\telse throw e;\n\t}\n\treturn ok({\n\t\tplannedOps,\n\t\tmigrationTsContent: plannerResult.plan.renderTypeScript(resolveImportSpecifier),\n\t\thasPlaceholders\n\t});\n}\nasync function writePlannedMigrationPackage(packageDir, fromHash, toHash, createdAt, leg) {\n\tconst opsForWrite = leg.hasPlaceholders ? [] : leg.plannedOps;\n\tconst metadataWithInvariants = {\n\t\tfrom: fromHash,\n\t\tto: toHash,\n\t\tprovidedInvariants: deriveProvidedInvariants(opsForWrite),\n\t\tcreatedAt: createdAt.toISOString()\n\t};\n\tawait writeMigrationPackage(packageDir, {\n\t\t...metadataWithInvariants,\n\t\tmigrationHash: computeMigrationHash(metadataWithInvariants, opsForWrite)\n\t}, opsForWrite);\n\tawait writeMigrationTs(packageDir, leg.migrationTsContent);\n}\nasync function executeMigrationPlanCommand(options, startTime, callbacks) {\n\ttry {\n\t\treturn await executeMigrationPlanCommandInner(options, startTime, callbacks);\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return notOk(error);\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\treturn notOk(errorUnexpected(message, { why: `Unexpected error during migration plan: ${message}` }));\n\t}\n}\nasync function executeMigrationPlanCommandInner(options, startTime, callbacks) {\n\tconst config = options.config;\n\tconst cwd = options.cwd;\n\tconst { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.configPath, config, cwd);\n\tconst contractPathAbsolute = resolveContractPath(config);\n\tconst contractPath = relative(cwd, contractPathAbsolute);\n\tcallbacks?.onContextResolved?.({\n\t\tconfigPath,\n\t\tcontractPath,\n\t\tappMigrationsRelative\n\t});\n\tlet contractJsonContent;\n\ttry {\n\t\tcontractJsonContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (isEnoent(error)) return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: `Run \\`prisma-cli contract emit\\` to generate ${contractPath}, or update \\`config.contract.output\\` in ${configPath}`\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tconst controlAdapter = config.adapter.create(stack);\n\tlet toContract;\n\ttry {\n\t\ttoContract = familyInstance.deserializeContract(castAs(JSON.parse(contractJsonContent)));\n\t} catch (error) {\n\t\treturn notOk(errorContractValidationFailed(`Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst rawStorageHash = toContract.storage?.storageHash;\n\tif (typeof rawStorageHash !== \"string\") return notOk(errorContractValidationFailed(\"Contract is missing storageHash\", { where: { path: contractPathAbsolute } }));\n\tlet toStorageHash = rawStorageHash;\n\tlet toArtifacts = null;\n\tlet fromContract = null;\n\tlet fromHash = null;\n\tlet snapshotStartContract = null;\n\tlet isAutoBaseline = false;\n\tconst tolerantAggregateResult = await loadContractSpaceAggregateForCli({\n\t\ttargetId: config.target.targetId,\n\t\tmigrationsDir,\n\t\tappContract: toContract,\n\t\textensions: config.extensions ?? [],\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!tolerantAggregateResult.ok) return notOk(tolerantAggregateResult.failure);\n\tconst resolutionSpace = tolerantAggregateResult.value.app;\n\tconst resolutionResult = await resolveFromForPlan({\n\t\toptionsFrom: options.from,\n\t\tspace: resolutionSpace\n\t});\n\tif (!resolutionResult.ok) return notOk(resolutionResult.failure);\n\tswitch (resolutionResult.value.kind) {\n\t\tcase \"greenfield\": break;\n\t\tcase \"graph-node\":\n\t\t\tfromHash = resolutionResult.value.fromHash;\n\t\t\tfromContract = resolutionResult.value.fromContract;\n\t\t\tbreak;\n\t\tcase \"ref\":\n\t\t\tfromHash = resolutionResult.value.fromHash;\n\t\t\tfromContract = resolutionResult.value.fromContract;\n\t\t\tsnapshotStartContract = {\n\t\t\t\tfromHash: resolutionResult.value.fromHash,\n\t\t\t\tcontractJson: resolutionResult.value.contractJson,\n\t\t\t\tcontractDts: resolutionResult.value.contractDts\n\t\t\t};\n\t\t\tbreak;\n\t\tcase \"auto-baseline\":\n\t\t\tfromHash = resolutionResult.value.fromHash;\n\t\t\tfromContract = resolutionResult.value.fromContract;\n\t\t\tsnapshotStartContract = {\n\t\t\t\tfromHash: resolutionResult.value.fromHash,\n\t\t\t\tcontractJson: resolutionResult.value.contractJson,\n\t\t\t\tcontractDts: resolutionResult.value.contractDts\n\t\t\t};\n\t\t\tisAutoBaseline = true;\n\t\t\tbreak;\n\t}\n\tif (options.to !== void 0) {\n\t\tconst toResolution = await resolveToForPlan(options.to, { space: resolutionSpace });\n\t\tif (!toResolution.ok) return notOk(toResolution.failure);\n\t\ttoContract = toResolution.value.contract;\n\t\ttoStorageHash = toResolution.value.hash;\n\t\ttoArtifacts = {\n\t\t\tcontractJson: toResolution.value.contractJson,\n\t\t\tcontractDts: toResolution.value.contractDts\n\t\t};\n\t}\n\tconst resolveImportSpecifier = createProjectSpecifierResolver(options.configPath);\n\tconst seedResult = await runContractSpaceSeedPhase({\n\t\tmigrationsDir,\n\t\textensions: toExtensionInputs(config.extensions ?? [])\n\t});\n\tfor (const record of seedResult.seeded) callbacks?.onSeeded?.(record);\n\tconst emittedExtensionDirs = seedResult.seeded.flatMap((r) => r.newMigrationDirs.map((dirName) => ({\n\t\tspaceId: r.spaceId,\n\t\tdirName\n\t})));\n\tif (fromHash === toStorageHash && !isAutoBaseline) return ok({\n\t\tok: true,\n\t\tnoOp: true,\n\t\tfrom: fromHash,\n\t\tto: toStorageHash,\n\t\toperations: [],\n\t\temittedExtensionDirs,\n\t\tsummary: \"No changes detected between contracts\",\n\t\ttimings: { total: Date.now() - startTime }\n\t});\n\tconst migrations = getTargetMigrations(config.target);\n\tif (!migrations) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` }));\n\tconst aggregateResult = await buildContractSpaceAggregate({\n\t\ttargetId: config.target.targetId,\n\t\tmigrationsDir,\n\t\tappContract: toContract,\n\t\textensions: config.extensions ?? [],\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!aggregateResult.ok) return notOk(aggregateResult.failure);\n\tconst aggregate = aggregateResult.value;\n\tconst frameworkComponents = assertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, [\n\t\tconfig.target,\n\t\tconfig.adapter,\n\t\t...config.extensions ?? []\n\t]);\n\tasync function writeDestinationSnapshot(destHash) {\n\t\tif (toArtifacts !== null) {\n\t\t\tawait writeContractSnapshot(migrationsDir, destHash, {\n\t\t\t\tcontractJson: toArtifacts.contractJson,\n\t\t\t\tcontractDts: toArtifacts.contractDts\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst destinationArtifacts = getEmittedArtifactPaths(contractPathAbsolute);\n\t\tconst [contractJsonRaw, contractDts] = await Promise.all([readFile(destinationArtifacts.jsonPath, \"utf-8\"), readFile(destinationArtifacts.dtsPath, \"utf-8\")]);\n\t\tawait writeContractSnapshot(migrationsDir, destHash, {\n\t\t\tcontractJson: castAs(JSON.parse(contractJsonRaw)),\n\t\t\tcontractDts\n\t\t});\n\t}\n\ttry {\n\t\tconst planner = migrations.createPlanner(controlAdapter);\n\t\tif (isAutoBaseline && fromHash !== null && fromContract !== null && snapshotStartContract !== null) {\n\t\t\tconst baselineTimestamp = /* @__PURE__ */ new Date();\n\t\t\tconst deltaTimestamp = new Date(baselineTimestamp.getTime() + 6e4);\n\t\t\tconst baselineDirName = formatMigrationDirName(baselineTimestamp, \"baseline\");\n\t\t\tconst deltaDirName = formatMigrationDirName(deltaTimestamp, options.name ?? \"migration\");\n\t\t\tconst baselinePackageDir = join(appMigrationsDir, baselineDirName);\n\t\t\tconst deltaPackageDir = join(appMigrationsDir, deltaDirName);\n\t\t\tconst baselineLeg = await runPlannerLeg(planner, migrations, frameworkComponents, fromContract, null, aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(baselinePackageDir, migrationsDir), resolveImportSpecifier);\n\t\t\tif (!baselineLeg.ok) return notOk(baselineLeg.failure);\n\t\t\tawait writePlannedMigrationPackage(baselinePackageDir, null, fromHash, baselineTimestamp, baselineLeg.value);\n\t\t\tawait writeContractSnapshot(migrationsDir, fromHash, {\n\t\t\t\tcontractJson: snapshotStartContract.contractJson,\n\t\t\t\tcontractDts: snapshotStartContract.contractDts\n\t\t\t});\n\t\t\tif (fromHash === toStorageHash) {\n\t\t\t\tconst baselineOps = baselineLeg.value.hasPlaceholders ? [] : baselineLeg.value.plannedOps;\n\t\t\t\tif (baselineLeg.value.hasPlaceholders) {\n\t\t\t\t\tconst baselineDir = relative(cwd, baselinePackageDir);\n\t\t\t\t\treturn ok({\n\t\t\t\t\t\tok: true,\n\t\t\t\t\t\tnoOp: false,\n\t\t\t\t\t\tfrom: fromHash,\n\t\t\t\t\t\tto: toStorageHash,\n\t\t\t\t\t\tdir: baselineDir,\n\t\t\t\t\t\tbaselineDir,\n\t\t\t\t\t\toperations: [],\n\t\t\t\t\t\temittedExtensionDirs,\n\t\t\t\t\t\tpendingPlaceholders: true,\n\t\t\t\t\t\tsummary: \"Planned baseline with placeholder(s) — edit migration.ts then run `node migration.ts` to self-emit\",\n\t\t\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst preview = hasOperationPreview(familyInstance) ? familyInstance.toOperationPreview(baselineOps) : void 0;\n\t\t\t\treturn ok({\n\t\t\t\t\tok: true,\n\t\t\t\t\tnoOp: false,\n\t\t\t\t\tfrom: fromHash,\n\t\t\t\t\tto: toStorageHash,\n\t\t\t\t\tbaselineDir: relative(cwd, baselinePackageDir),\n\t\t\t\t\toperations: baselineOps.map((op) => ({\n\t\t\t\t\t\tid: op.id,\n\t\t\t\t\t\tlabel: op.label,\n\t\t\t\t\t\toperationClass: op.operationClass\n\t\t\t\t\t})),\n\t\t\t\t\temittedExtensionDirs,\n\t\t\t\t\t...preview !== void 0 ? { preview } : {},\n\t\t\t\t\tsummary: buildAutoBaselinePlanSummary(0, emittedExtensionDirs.length),\n\t\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst deltaLeg = await runPlannerLeg(planner, migrations, frameworkComponents, aggregate.app.contract(), fromContract, aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(deltaPackageDir, migrationsDir), resolveImportSpecifier);\n\t\t\tif (!deltaLeg.ok) return notOk(deltaLeg.failure);\n\t\t\tawait writePlannedMigrationPackage(deltaPackageDir, fromHash, toStorageHash, deltaTimestamp, deltaLeg.value);\n\t\t\tawait writeDestinationSnapshot(toStorageHash);\n\t\t\tawait writeContractSnapshot(migrationsDir, fromHash, {\n\t\t\t\tcontractJson: snapshotStartContract.contractJson,\n\t\t\t\tcontractDts: snapshotStartContract.contractDts\n\t\t\t});\n\t\t\tconst deltaOps = deltaLeg.value.hasPlaceholders ? [] : deltaLeg.value.plannedOps;\n\t\t\tif (deltaLeg.value.hasPlaceholders) return ok({\n\t\t\t\tok: true,\n\t\t\t\tnoOp: false,\n\t\t\t\tfrom: fromHash,\n\t\t\t\tto: toStorageHash,\n\t\t\t\tdir: relative(cwd, deltaPackageDir),\n\t\t\t\tbaselineDir: relative(cwd, baselinePackageDir),\n\t\t\t\toperations: [],\n\t\t\t\temittedExtensionDirs,\n\t\t\t\tpendingPlaceholders: true,\n\t\t\t\tsummary: \"Planned baseline + migration with placeholder(s) — edit migration.ts then run `node migration.ts` to self-emit\",\n\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t});\n\t\t\tconst preview = hasOperationPreview(familyInstance) ? familyInstance.toOperationPreview(deltaOps) : void 0;\n\t\t\treturn ok({\n\t\t\t\tok: true,\n\t\t\t\tnoOp: false,\n\t\t\t\tfrom: fromHash,\n\t\t\t\tto: toStorageHash,\n\t\t\t\tdir: relative(cwd, deltaPackageDir),\n\t\t\t\tbaselineDir: relative(cwd, baselinePackageDir),\n\t\t\t\toperations: deltaOps.map((op) => ({\n\t\t\t\t\tid: op.id,\n\t\t\t\t\tlabel: op.label,\n\t\t\t\t\toperationClass: op.operationClass\n\t\t\t\t})),\n\t\t\t\temittedExtensionDirs,\n\t\t\t\t...preview !== void 0 ? { preview } : {},\n\t\t\t\tsummary: buildAutoBaselinePlanSummary(deltaOps.length, emittedExtensionDirs.length),\n\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t});\n\t\t}\n\t\tconst timestamp = /* @__PURE__ */ new Date();\n\t\tconst packageDir = join(appMigrationsDir, formatMigrationDirName(timestamp, options.name ?? \"migration\"));\n\t\tconst deltaLeg = await runPlannerLeg(planner, migrations, frameworkComponents, aggregate.app.contract(), fromContract, aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(packageDir, migrationsDir), resolveImportSpecifier);\n\t\tif (!deltaLeg.ok) return notOk(deltaLeg.failure);\n\t\tawait writePlannedMigrationPackage(packageDir, fromHash, toStorageHash, timestamp, deltaLeg.value);\n\t\tawait writeDestinationSnapshot(toStorageHash);\n\t\tif (snapshotStartContract !== null) await writeContractSnapshot(migrationsDir, snapshotStartContract.fromHash, {\n\t\t\tcontractJson: snapshotStartContract.contractJson,\n\t\t\tcontractDts: snapshotStartContract.contractDts\n\t\t});\n\t\tif (deltaLeg.value.hasPlaceholders) return ok({\n\t\t\tok: true,\n\t\t\tnoOp: false,\n\t\t\tfrom: fromHash,\n\t\t\tto: toStorageHash,\n\t\t\tdir: relative(cwd, packageDir),\n\t\t\toperations: [],\n\t\t\temittedExtensionDirs,\n\t\t\tpendingPlaceholders: true,\n\t\t\tsummary: \"Planned migration with placeholder(s) — edit migration.ts then run `node migration.ts` to self-emit\",\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t\tconst plannedOps = deltaLeg.value.plannedOps;\n\t\tconst preview = hasOperationPreview(familyInstance) ? familyInstance.toOperationPreview(plannedOps) : void 0;\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tnoOp: false,\n\t\t\tfrom: fromHash,\n\t\t\tto: toStorageHash,\n\t\t\tdir: relative(cwd, packageDir),\n\t\t\toperations: plannedOps.map((op) => ({\n\t\t\t\tid: op.id,\n\t\t\t\tlabel: op.label,\n\t\t\t\toperationClass: op.operationClass\n\t\t\t})),\n\t\t\temittedExtensionDirs,\n\t\t\t...preview !== void 0 ? { preview } : {},\n\t\t\tsummary: buildPlanSummary(plannedOps.length, emittedExtensionDirs.length),\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError$1.is(error)) return notOk(error);\n\t\tif (MigrationToolsError.is(error)) return notOk(error);\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\treturn notOk(errorUnexpected(message, { why: `Unexpected error during migration plan: ${message}` }));\n\t}\n}\n/**\n* Compose the success-line summary so the cross-space side effect\n* (extension-space migration packages materialised on disk during\n* this `plan` run) is visible in the top line — not just in the\n* step log above it.\n*\n* Example outputs:\n* - `Planned 3 operation(s)` (app-space-only project)\n* - `Planned 3 operation(s); materialised 1 extension-space migration` (one extension)\n* - `Planned 3 operation(s); materialised 2 extension-space migrations` (two extensions)\n*\n* Locks AC3 at the summary-line level: a reader of the success line\n* can tell that something happened beyond the app space.\n*/\nfunction buildPlanSummary(plannedOpsCount, emittedExtensionDirsCount) {\n\tconst base = `Planned ${plannedOpsCount} operation(s)`;\n\tif (emittedExtensionDirsCount === 0) return base;\n\treturn `${base}; materialised ${emittedExtensionDirsCount} ${emittedExtensionDirsCount === 1 ? \"extension-space migration\" : \"extension-space migrations\"}`;\n}\nfunction buildAutoBaselinePlanSummary(deltaOpsCount, emittedExtensionDirsCount) {\n\tconst base = `Planned baseline + ${deltaOpsCount} operation(s)`;\n\tif (emittedExtensionDirsCount === 0) return base;\n\treturn `${base}; materialised ${emittedExtensionDirsCount} ${emittedExtensionDirsCount === 1 ? \"extension-space migration\" : \"extension-space migrations\"}`;\n}\n//#endregion\n//#region src/control-api/operations/migration-status-overlay.ts\n/** Origin hash for status path computation: the live/override marker, or the empty-contract sentinel. */\nfunction originHashForStatus(markerHash) {\n\treturn markerHash ?? EMPTY_CONTRACT_HASH;\n}\nfunction deriveStatusEdgeAnnotations(input) {\n\tconst annotations = /* @__PURE__ */ new Map();\n\tif (input.showAppliedOverlay) {\n\t\tfor (const edge of input.graph.migrationByHash.values()) if (input.appliedMigrationHashes.has(edge.migrationHash)) annotations.set(edge.migrationHash, { status: \"applied\" });\n\t}\n\tif (!input.graph.nodes.has(input.originHash)) return annotations;\n\tconst pendingPath = findPath(input.graph, input.originHash, input.targetHash);\n\tif (!pendingPath) return annotations;\n\tfor (const edge of pendingPath) {\n\t\tif (input.appliedMigrationHashes.has(edge.migrationHash)) continue;\n\t\tif (annotations.get(edge.migrationHash)?.status === \"applied\") continue;\n\t\tannotations.set(edge.migrationHash, { status: \"pending\" });\n\t}\n\treturn annotations;\n}\nfunction appliedHashesFromLedger(ledgerEntries) {\n\treturn new Set(ledgerEntries.map((entry) => entry.migrationHash));\n}\nfunction statusForMigrationHash(migrationHash, annotations) {\n\treturn annotations.get(migrationHash)?.status ?? null;\n}\n//#endregion\n//#region src/control-api/operations/refs.ts\n/**\n* Reads the migrations refs index for commands, mapping MigrationToolsError into the CLI envelope.\n*/\n/** Reads migrations/<app>/refs, passing MigrationToolsError through; other errors rethrow. */\nasync function readMigrationRefs(refsDir) {\n\ttry {\n\t\treturn ok(await readRefs(refsDir));\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n}\n//#endregion\n//#region src/control-api/operations/ref.ts\nfunction mapError(error) {\n\tif (MigrationToolsError.is(error)) return error;\n\treturn errorUnexpected(error instanceof Error ? error.message : String(error));\n}\nfunction cliErrorInvalidRefName(name) {\n\treturn errorRuntime(\"MIGRATION.INVALID_REF_NAME\", `Invalid ref name \"${name}\"`, {\n\t\twhy: `Ref name \"${name}\" does not match the required format`,\n\t\tfix: \"Ref names must be lowercase alphanumeric with hyphens or forward slashes, no `.` or `..` segments\"\n\t});\n}\nasync function executeRefSetCommand(name, contractInput, options) {\n\tif (!validateRefName(name)) return notOk(cliErrorInvalidRefName(name));\n\tconst config = options.config;\n\ttry {\n\t\tconst { migrationsDir, refsDir } = resolveMigrationPaths(options.configPath, config, options.cwd);\n\t\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\t\tif (!loaded.ok) return notOk(loaded.failure);\n\t\tconst graph = loaded.value.aggregate.app.graph();\n\t\tconst bundles = loaded.value.aggregate.app.packages;\n\t\tconst refs = loaded.value.aggregate.app.refs;\n\t\tlet resolvedHash;\n\t\tif (validateRefValue(contractInput)) resolvedHash = contractInput;\n\t\telse {\n\t\t\tconst refResult = parseContractRef(contractInput, {\n\t\t\t\tgraph,\n\t\t\t\trefs\n\t\t\t});\n\t\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\t\tresolvedHash = refResult.value.hash;\n\t\t}\n\t\tif (resolvedHash === EMPTY_CONTRACT_HASH) return notOk(errorRefSetEmptySentinel(resolvedHash));\n\t\tif (!isGraphNode(resolvedHash, graph)) {\n\t\t\tconst graphTip = findLatestMigration(graph)?.to ?? null;\n\t\t\treturn notOk(errorRefSetHashNotInGraph(resolvedHash, [...graph.nodes].sort(), graphTip));\n\t\t}\n\t\tif (!bundles.find((bundle) => bundle.metadata.to === resolvedHash)) return notOk(errorRefSetBundleNotFound(resolvedHash));\n\t\tconst contractJsonPath = join(contractSnapshotDir(migrationsDir, resolvedHash), \"contract.json\");\n\t\ttry {\n\t\t\tawait readContractSnapshotJson(migrationsDir, resolvedHash);\n\t\t} catch (readError) {\n\t\t\tif (MigrationToolsError.is(readError) && readError.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return notOk(errorFileNotFound(contractJsonPath, {\n\t\t\t\twhy: `Migration bundle for hash ${resolvedHash} is missing its contract snapshot at ${contractJsonPath}`,\n\t\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\"\n\t\t\t}));\n\t\t\tthrow readError;\n\t\t}\n\t\tawait writeRef(refsDir, name, {\n\t\t\thash: resolvedHash,\n\t\t\tinvariants: []\n\t\t});\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tref: name,\n\t\t\thash: resolvedHash,\n\t\t\tinvariants: []\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError$1) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nasync function executeRefDeleteCommand(name, options) {\n\ttry {\n\t\tconst { refsDir } = resolveMigrationPaths(options.configPath, options.config, options.cwd);\n\t\tawait deleteRef(refsDir, name);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tref: name,\n\t\t\tdeleted: true\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError$1) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\nasync function executeRefListCommand(options) {\n\ttry {\n\t\tconst { refsDir } = resolveMigrationPaths(options.configPath, options.config, options.cwd);\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\trefs: await readRefs(refsDir)\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof CliStructuredError$1) return notOk(error);\n\t\treturn notOk(mapError(error));\n\t}\n}\n//#endregion\nexport { refuseContractSpaceIntegrity as $, hasMigrationPath as A, requireLiveDatabase as At, resolveRefAdvancementFields as B, migrationSpaceListEntriesFromAggregate as C, errorNoMigrations as Ct, executeMigrateShowPlan as D, errorTargetMigrationNotSupported as Dt, resolveMigrationRef as E, errorRuntime as Et, advanceRefSafely as F, executeDbUpdate as G, disposeEmitQueue as H, buildRefAdvancementFields as I, buildContractSpaceAggregate as J, executeDbInit as K, computeRefAdvancementName as L, mapContractAtError as M, runCommandAction as Mt, mapCaughtMigrationError as N, refuseMissingInvariantPath as O, errorTargetMismatch as Ot, resolveContractRefToSnapshot as P, mapIntegrityViolations as Q, executeRefAdvancement as R, listRefsByContractHash as S, errorMigrationPlanningFailed as St, resolveContractRef$1 as T, errorRunnerFailed as Tt, createControlClient as U, executeContractEmit as V, executeDbVerify as W, loadContractRawSafely as X, buildReadAggregate as Y, loadContractSpaceAggregateForCli as Z, loadAggregateIntegrityViolations as _, errorFileNotFound as _t, appliedHashesFromLedger as a, readContractEnvelope as at, looksLikePath as b, errorMarkerMissing as bt, statusForMigrationHash as c, enrichContract as ct, resolveToForPlan as d, errorConsentPlanMismatch as dt, refuseDeclaredExtensionTargetMismatch as et, runContractSpaceSeedPhase as f, errorContractArgConflict as ft, enumerateCheckSpaces as g, errorDriverRequired as gt, checkSingleTarget as h, errorDestructiveChanges as ht, readMigrationRefs as i, maskConnectionUrl as it, refuseMarkerOutsideGraph as j, chooseAction as jt, refuseUnknownInvariants as k, errorUnexpected as kt, executeMigrationPlanCommand as l, CliStructuredError$1 as lt, buildMigrationSpaceGraphEntries as m, errorDatabaseConnectionRequired as mt, executeRefListCommand as n, toDeclaredExtensionsFromRaw as nt, deriveStatusEdgeAnnotations as o, sanitizeErrorMessage as ot, executeMigrationNewCommand as p, errorContractValidationFailed as pt, appContractStandInFromIdentity as q, executeRefSetCommand as r, closeQuietly as rt, originHashForStatus as s, targetSupportsMigrations as st, executeRefDeleteCommand as t, refusePackageCorruptionOnAggregate as tt, resolveFromForPlan as u, errorConfigValidation as ut, runMigrationCheck as v, errorHashMismatch as vt, runMigrationList as w, errorPathUnreachable as wt, resolveAppTargetPath as x, errorMigrationPackageNotFound as xt, findPackageByDirPath as y, errorLegendHumanOnly as yt, readContractIR as z };\n\n//# sourceMappingURL=ref-BSRf-7Uh.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAS,iBAAiB,OAAO,SAAS;CACzC,OAAO;EACN,MAAM;EACN;EACA;CACD;AACD;;AAEA,SAAS,aAAa,OAAO;CAC5B,OAAO;EACN,MAAM;EACN;CACD;AACD;;;;;;;;;;;AAaA,IAAI,qBAAqB,cAAc,qBAAqB;CAC3D;CACA,YAAY,MAAM,SAAS,SAAS;EACnC,MAAM,MAAM,SAAS,OAAO;EAC5B,KAAK,cAAc,QAAQ;CAC5B;AACD;;;;;;AAMA,SAAS,yBAAyB,SAAS;CAC1C,MAAM,MAAM;CACZ,OAAO,IAAI,mBAAmB,6BAA6B,qEAAqE;EAC/H,KAAK,kCAAkC,QAAQ,WAAW,0BAA0B,QAAQ,KAAK;EACjG;EACA,aAAa,CAAC,aAAa,GAAG,CAAC;EAC/B,MAAM;GACL,YAAY,QAAQ;GACpB,MAAM,QAAQ;EACf;CACD,CAAC;AACF;AACA,SAAS,0BAA0B,cAAc,iBAAiB,cAAc;CAC/E,MAAM,gBAAgB,gBAAgB,SAAS,IAAI,gBAAgB,KAAK,IAAI,IAAI;CAChF,MAAM,MAAM,gBAAgB,SAAS,IAAI,iBAAiB,OAAO,4CAA4C,aAAa,+DAA+D,+DAA+D;CACxP,MAAM,cAAc,gBAAgB,SAAS,IAAI,iBAAiB,OAAO,CAAC,aAAa,4CAA4C,cAAc,GAAG,iBAAiB,8BAA8B,2BAA2B,CAAC,IAAI,CAAC,aAAa,2DAA2D,CAAC,IAAI,CAAC,iBAAiB,4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