// server/src/localdb — the pure decision-making half of the bundled PostgreSQL
// runtime (docs/todo/2026-08-08-bundled-postgres-decisions.md,
// docs/todo/2026-08-05-install-and-macos.md).
//
// Everything under this directory is PURE: no filesystem, no network, no child
// processes, no reads of `process.platform` / `process.env` / `os.homedir()`.
// Anything from the real world arrives as an argument. That split is not
// fastidiousness — it is what makes the macOS layout, the Linux refusal, the
// stale/corrupt instance.json cases and the major-version downgrade refusal all
// assertable from a Windows test runner in milliseconds, on a project where the
// Mac hardware does not exist yet and the failure mode of getting any of it
// wrong is "the user's books are somewhere else now".
//
// The impure half — downloading and verifying the tarball, unpacking it with
// bsdtar, running initdb, spawning a detached `postgres`, polling pg_isready,
// recovering a stale postmaster.pid, writing the 0600 secret — is a separate
// module built ON TOP of these exports.
//
// This barrel is a convenience for that module. Nothing here re-exports a
// default or renames anything; deep imports remain equally valid and are
// preferable inside this directory.

export {
  type PlatformId,
  type PlatformResult,
  PLATFORM_IDS,
  isPlatformId,
  resolvePlatform,
} from "./platform.js";

export {
  type PathEnv,
  type PostgresBinary,
  type LocalDbLayout,
  type LayoutResult,
  APP_DATA_FOLDER,
  runtimeDirName,
  dataDirName,
  resolveAppDataRoot,
  resolveLayout,
  binaryPath,
} from "./paths.js";

export {
  type RuntimeArtifact,
  type ArtifactEntry,
  type ArtifactResult,
  SHIPPED_POSTGRES_VERSION,
  UPSTREAM_WINDOWS_ARCHIVE,
  RUNTIME_BASE_URL,
  RUNTIME_MANIFEST,
  runtimeTarballName,
  resolveArtifact,
  checksumMatches,
} from "./manifest.js";

export {
  type InstanceDocument,
  type InstanceReadResult,
  type ConnectionParts,
  INSTANCE_FORMAT_VERSION,
  DEFAULT_PORT,
  LOOPBACK_HOST,
  SUPERUSER_ROLE,
  APP_ROLE,
  APP_DATABASE,
  MAINTENANCE_DATABASE,
  buildInstanceDocument,
  serializeInstanceDocument,
  parseInstanceDocument,
  buildConnectionUrl,
  adminConnectionUrl,
  appConnectionUrl,
  redactConnectionUrl,
} from "./instance.js";

export {
  type ClusterVerdict,
  type ClusterVersionCheck,
  parsePostgresMajor,
  checkClusterVersion,
} from "./version.js";

export {
  type RandomBytesFn,
  SECRET_ALPHABET,
  DEFAULT_SECRET_LENGTH,
  generateSecret,
  isWellFormedSecret,
} from "./secret.js";
