@wildo-ai/platform-config-lib 1.1.14 → 1.1.16

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.
Files changed (39) hide show
  1. package/dist/esm/bootstrap/application-scheduled-jobs.contracts.d.ts +187 -0
  2. package/dist/esm/bootstrap/application-scheduled-jobs.contracts.d.ts.map +1 -0
  3. package/dist/esm/bootstrap/application-scheduled-jobs.contracts.js +250 -0
  4. package/dist/esm/bootstrap/application-scheduled-jobs.contracts.js.map +1 -0
  5. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +12 -0
  6. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  7. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +12 -0
  8. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  9. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts +23 -2
  10. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
  11. package/dist/esm/bootstrap/runtime-backing-service-access.js +23 -4
  12. package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
  13. package/dist/esm/index.d.ts +1 -0
  14. package/dist/esm/index.d.ts.map +1 -1
  15. package/dist/esm/index.js +1 -0
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  18. package/dist/esm/project-config/define-infra-env-config.js +12 -1
  19. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  20. package/dist/esm/project-config/hosted-infra-env-config.js +8 -1
  21. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
  22. package/dist/esm/project-config/provider-companion-discovery.d.ts +45 -0
  23. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  24. package/dist/esm/project-config/provider-companion-discovery.js +53 -3
  25. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  26. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +13 -0
  27. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  28. package/dist/esm/project-config/provider-runtime-artifacts.js +43 -1
  29. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  30. package/dist/esm/project-config/shared/csp-defaults.d.ts +7 -3
  31. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
  32. package/dist/esm/project-config/shared/csp-defaults.js +10 -4
  33. package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
  34. package/dist/esm/project-config/shared/environment.schemas.d.ts +18 -4
  35. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  36. package/dist/esm/project-config/shared/environment.schemas.js +26 -4
  37. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  38. package/dist/tsconfig.build.tsbuildinfo +1 -1
  39. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"platform-runtime-env.contracts.js","sourceRoot":"","sources":["../../../src/bootstrap/platform-runtime-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAN,IAAY,qBAmBX;AAnBD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,sCAAa,CAAA;IACb,sDAA6B,CAAA;IAC7B;;;;;;;;;;OAUG;IACH,8DAAqC,CAAA;IACrC,4EAAmD,CAAA;IACnD,4DAAmC,CAAA;IACnC,gEAAuC,CAAA;AACzC,CAAC,EAnBW,qBAAqB,KAArB,qBAAqB,QAmBhC;AAED,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,mFAAuD,CAAA;IACvD,2GAA+E,CAAA;IAC/E,yFAA6D,CAAA;AAC/D,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC;AAED,MAAM,CAAN,IAAY,4BAqFX;AArFD,WAAY,4BAA4B;IACtC,uEAAuC,CAAA;IACvC,yEAAyC,CAAA;IACzC,+EAA+C,CAAA;IAC/C,yDAAyB,CAAA;IACzB,yDAAyB,CAAA;IACzB;;;;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CAAC,cAAc;IAC3C,4BAA4B,CAAC,qBAAqB;IAClD,sBAAsB,CAAC,iCAAiC;IACxD,sBAAsB,CAAC,gCAAgC;IACvD,sBAAsB,CAAC,kDAAkD;IACzE,sBAAsB,CAAC,4BAA4B;IACnD,sBAAsB,CAAC,qCAAqC;IAC5D,sBAAsB,CAAC,+BAA+B;IACtD,sBAAsB,CAAC,iCAAiC;IACxD,sBAAsB,CAAC,uBAAuB;IAC9C,sBAAsB,CAAC,6CAA6C;IACpE,sBAAsB,CAAC,4CAA4C;IACnE,sBAAsB,CAAC,mCAAmC;IAC1D,sBAAsB,CAAC,qBAAqB;IAC5C,mBAAmB,CAAC,cAAc;IAClC,mBAAmB,CAAC,6BAA6B;IACjD,yFAAyF;IACzF,iGAAiG;IACjG,gGAAgG;IAChG,2BAA2B,CAAC,0BAA0B;CACvD,CAAC,CAAC","sourcesContent":["/**\n * Shared environment contract for platform runtime processes.\n *\n * This captures the canonical env-var vocabulary used by CLI-generated platform\n * `.env` material and by platform services such as apps-manager at runtime.\n * Keep these keys declarative and cross-executor: the contract owns names and\n * sensitivity classification, while writers/readers own behavior.\n */\n\nexport enum PlatformProcessEnvKey {\n HOST = 'HOST',\n PORT = 'PORT',\n SERVICE_NAME = 'SERVICE_NAME',\n /**\n * The APPLICATION this process belongs to, as its slug (#1177).\n *\n * Distinct from {@link SERVICE_NAME}, which names the PROCESS — `wonder-todos-backend-api`,\n * `marketing-scrapper`, `my-node-worker`. Only the first of those contains the application's name,\n * which is why the logger cannot derive the application from it: a minion and a worker are named\n * after themselves.\n *\n * Emitted for APPLICATION runtimes only (backend, minion, worker, companion). The platform's own\n * services belong to no application and deliberately do not carry it.\n */\n APPLICATION_SLUG = 'APPLICATION_SLUG',\n PLATFORM_ENVIRONMENT_ID = 'PLATFORM_ENVIRONMENT_ID',\n APPLICATION_ENV = 'APPLICATION_ENV',\n APPS_MANAGER_MODE = 'APPS_MANAGER_MODE',\n}\n\nexport enum PlatformServiceUrlEnvKey {\n PLATFORM_APPS_MANAGER_URL = 'PLATFORM_APPS_MANAGER_URL',\n PLATFORM_CRONTABS_BATCHES_MANAGER_URL = 'PLATFORM_CRONTABS_BATCHES_MANAGER_URL',\n PLATFORM_MODULE_REGISTRY_URL = 'PLATFORM_MODULE_REGISTRY_URL',\n}\n\nexport enum PlatformInfrastructureEnvKey {\n MONGO_CONNECT_URL = 'MONGO_CONNECT_URL',\n MONGO_PLATFORM_URL = 'MONGO_PLATFORM_URL',\n BASE_MONGO_SERVER_URL = 'BASE_MONGO_SERVER_URL',\n REDIS_HOST = 'REDIS_HOST',\n REDIS_PORT = 'REDIS_PORT',\n /**\n * Optional Redis logical database index (0–15). Emitted only when the\n * author sets `backingServices.redis.database` in `wildo.infra.<env>.config.ts`.\n * Consumers default to DB 0 when this var is missing.\n */\n REDIS_DATABASE = 'REDIS_DATABASE',\n REDIS_ADMIN_USER = 'REDIS_ADMIN_USER',\n REDIS_ADMIN_PASSWORD = 'REDIS_ADMIN_PASSWORD',\n RABBITMQ_HOST = 'RABBITMQ_HOST',\n RABBITMQ_PORT = 'RABBITMQ_PORT',\n RABBITMQ_MANAGEMENT_PORT = 'RABBITMQ_MANAGEMENT_PORT',\n /**\n * Optional RabbitMQ virtual host. Emitted only when the author sets\n * `backingServices.rabbitmq.vhost` in `wildo.infra.<env>.config.ts`.\n * Consumers default to `/` (the RabbitMQ root vhost) when missing.\n */\n RABBITMQ_VHOST = 'RABBITMQ_VHOST',\n RABBITMQ_ADMIN_USERNAME = 'RABBITMQ_ADMIN_USERNAME',\n RABBITMQ_ADMIN_PASSWORD = 'RABBITMQ_ADMIN_PASSWORD',\n STORAGE_PROVIDER = 'STORAGE_PROVIDER',\n /**\n * S3-compatible endpoint **hostname** (NOT a URL); see the matching\n * JSDoc on `ApplicationBackendDataEnvKey.STORAGE_ENDPOINT` for the\n * full contract (Slice 3.2 audit L-4). Kept here for the\n * platform-runtime side (apps-manager) — same\n * host:port-only invariant.\n */\n STORAGE_ENDPOINT = 'STORAGE_ENDPOINT',\n STORAGE_PORT = 'STORAGE_PORT',\n STORAGE_USE_SSL = 'STORAGE_USE_SSL',\n STORAGE_BUCKET = 'STORAGE_BUCKET',\n STORAGE_ACCESS_KEY = 'STORAGE_ACCESS_KEY',\n STORAGE_SECRET_KEY = 'STORAGE_SECRET_KEY',\n /**\n * The role apps-manager's object-storage broker names when it calls STS `AssumeRole` (#2172), as an ARN.\n * apps-manager only. Optional: a MinIO-compatible store issues a session for the CALLING key and names no role,\n * while AWS STS (and SeaweedFS, Ceph RGW) require one, and the broker refuses issuance against such a store when\n * this is absent. Rendered from `platformStorage.stsRoleArn` in the environment's infra file.\n */\n STORAGE_STS_ROLE_ARN = 'STORAGE_STS_ROLE_ARN',\n PG_HOST = 'PG_HOST',\n PG_PORT = 'PG_PORT',\n PG_ADMIN_USER = 'PG_ADMIN_USER',\n PG_ADMIN_PASSWORD = 'PG_ADMIN_PASSWORD',\n /**\n * The MAINTENANCE database the admin pool connects to in order to provision others — NOT the\n * application's database and NOT the container's initdb database (that is\n * `POSTGRES_ADMIN_DATABASE`, a different key on a different transport). Emitted from\n * `PLATFORM_POSTGRES_MAINTENANCE_DATABASE`, whose JSDoc carries the three-way distinction and\n * the silent outage that conflating the first two produced.\n */\n PG_ADMIN_DATABASE = 'PG_ADMIN_DATABASE',\n PG_SSL_MODE = 'PG_SSL_MODE',\n /**\n * The platform's OWN PostgreSQL database — a full connection URL, the exact mirror of\n * `MONGO_CONNECT_URL` for a PostgreSQL-engined platform (D7 of the incremental-migrations plan).\n *\n * Distinct from the `PG_ADMIN_*` family above, which is PROVISIONING material (the admin\n * connection apps-manager uses to create per-application databases/roles). This key is the\n * database apps-manager's own resources live in. One URL rather than an address/credential\n * split on purpose: the platform pre-connects from env BEFORE any config document can be read\n * (the same chicken-and-egg `MONGO_CONNECT_URL` solves — the config documents live in the very\n * database this key addresses), so the whole answer must arrive in one env-delivered value.\n *\n * Emitted by the CLI's platform env builder only when the environment's\n * `database.engine === POSTGRESQL`. Absent on a Mongo-engined platform.\n */\n PG_CONNECT_URL = 'PG_CONNECT_URL',\n /**\n * The self-hosted immudb server apps-manager provisions each application's audit database and user on (#1696):\n * host and gRPC port as apps-manager reaches it, and the server's built-in `immudb` SYSADMIN password — a\n * framework-managed PLATFORM secret (`immudb.adminPassword`), written into apps-manager's environment only.\n * No application receives it: each application writes with the confined user apps-manager minted for it.\n * Absent on a platform that self-hosts no immudb; an application declaring `immudb: { source: SELF }` is then\n * refused at registration (`NOT_HELD_BY_PLATFORM`), like every minting kind whose admin client is missing.\n */\n IMMUDB_ADMIN_HOST = 'IMMUDB_ADMIN_HOST',\n IMMUDB_ADMIN_PORT = 'IMMUDB_ADMIN_PORT',\n IMMUDB_ADMIN_PASSWORD = 'IMMUDB_ADMIN_PASSWORD',\n}\n\nexport enum PlatformSecurityEnvKey {\n PLATFORM_APPS_MANAGER_PRIVATE_KEY = 'PLATFORM_APPS_MANAGER_PRIVATE_KEY',\n PLATFORM_APPS_MANAGER_PUBLIC_KEY = 'PLATFORM_APPS_MANAGER_PUBLIC_KEY',\n /**\n * apps-manager's RESPONSE key (#2921): the private half that signs every successful answer on the routes application\n * runtimes read (configuration, secrets, worker bootstrap, storage session, runtime-principal token). Its own key,\n * never the {@link PLATFORM_APPS_MANAGER_PRIVATE_KEY} that signs runtime-principal tokens and crontabs requests: one key\n * per purpose (NIST SP 800-57 Part 1 Rev 5 §5.2). Runtimes verify against the public halves carried in\n * `PLATFORM_APPS_MANAGER_RESPONSE_VERIFICATION_KEYS`. Required: apps-manager refuses to start without it, because a\n * response it cannot sign must not be sent (`runtime-response-integrity.ts`).\n */\n PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY = 'PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY',\n /**\n * The platform's key-encryption ROOT (#2891): 32 random bytes, base64url, held by apps-manager alone. Every private\n * key the engine's LOCAL key provider makes (the approval-seal keys among them) is sealed under it with AES-256-GCM\n * before it is stored, so a platform database dump yields no usable private key.\n *\n * Losing it loses every LOCAL private key, and nothing else: the public halves are stored in each application, so\n * every seal already made still verifies. The keys it sealed cannot sign again, and the keyring does not replace them on\n * its own: apps-manager reports them at startup, and an operator who knows the root is gone for good runs\n * `wildo keys rotate --root-lost --reason \"<why>\"` per application, which destroys them and makes fresh ones. A new\n * root never opens the old keys, so restore it from backup before minting another. Back it up with the platform's other\n * secrets. Every lane provides it (`wildo local doctor` reports it missing). apps-manager starts without it, so a stack\n * predating it keeps running, and the keyring refuses its first operation (`PROVIDER_UNAVAILABLE`); a MALFORMED value is\n * refused at startup.\n */\n PLATFORM_KEY_ENCRYPTION_ROOT = 'PLATFORM_KEY_ENCRYPTION_ROOT',\n /**\n * The root a rotation replaced (#2891), kept only until every sealed key has been re-sealed under the current one.\n * apps-manager opens a key under whichever root sealed it and re-seals it under the current root. Optional.\n */\n PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT = 'PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT',\n /**\n * The platform's HashiCorp Vault or OpenBao (#2933), where apps-manager runs the `vault-transit` (REMOTE) and\n * `vault-kv` (RETRIEVED) key providers. apps-manager alone holds these: no application runtime ever reaches the Vault.\n * All optional; a platform without a Vault leaves them unset, and a binding to a Vault provider is refused\n * (`PROVIDER_UNAVAILABLE`). The address and BOTH tokens are needed together; a partial set registers nothing and is\n * reported at apps-manager's boot, while the LOCAL provider keeps serving.\n *\n * Two tokens, for least privilege, under the policies `vault-custody.contracts` states (`vaultSignerPolicy`,\n * `vaultOperatorPolicy`): the SIGNER token may sign (`transit/sign/<prefix>*`) and read keys and key metadata; the\n * OPERATOR token performs lifecycle acts (create, rotate, config, delete, KV write and destroy) and is denied signing\n * and reading key material. Neither can make a key leave Vault: the signer is denied `/config`, `transit/export/*` and\n * `transit/backup/*`, and the operator may not send `exportable` or `allow_plaintext_backup` at all.\n * Not `VAULT_ADDR` / `VAULT_TOKEN`: those are read by Vault's own CLI and SDKs, and a stray one would be picked up.\n */\n PLATFORM_KEY_VAULT_ADDRESS = 'PLATFORM_KEY_VAULT_ADDRESS',\n PLATFORM_KEY_VAULT_SIGNER_TOKEN = 'PLATFORM_KEY_VAULT_SIGNER_TOKEN',\n PLATFORM_KEY_VAULT_OPERATOR_TOKEN = 'PLATFORM_KEY_VAULT_OPERATOR_TOKEN',\n /** Vault Enterprise namespace (`ns1/ns2/`). Optional. */\n PLATFORM_KEY_VAULT_NAMESPACE = 'PLATFORM_KEY_VAULT_NAMESPACE',\n /** The Transit mount (`transit` when unset). */\n PLATFORM_KEY_VAULT_TRANSIT_MOUNT = 'PLATFORM_KEY_VAULT_TRANSIT_MOUNT',\n /** The KV v2 mount (`secret` when unset). */\n PLATFORM_KEY_VAULT_KV_MOUNT = 'PLATFORM_KEY_VAULT_KV_MOUNT',\n /** What every key and path apps-manager makes is named with, so the Vault policies can be scoped to it (`wildo-`). */\n PLATFORM_KEY_VAULT_KEY_NAME_PREFIX = 'PLATFORM_KEY_VAULT_KEY_NAME_PREFIX',\n /**\n * The platform's cloud KMS providers (#2896): `aws-kms`, `google-cloud-kms`, `azure-key-vault`. apps-manager alone\n * holds them, and authenticates by its WORKLOAD identity (IAM role for service accounts, GKE workload identity, an\n * Azure managed identity), so none of these is a secret. Each provider acts as TWO identities, as the Vault providers\n * do with two tokens: a SIGNER that may only read keys and sign, and an OPERATOR that creates, disables and destroys\n * them and may never sign. Every key of one provider is needed together; a partial set registers nothing and is\n * reported at apps-manager's boot.\n *\n * AWS: apps-manager's own identity may only `sts:AssumeRole` the two roles named here.\n */\n PLATFORM_KEY_AWS_KMS_REGION = 'PLATFORM_KEY_AWS_KMS_REGION',\n PLATFORM_KEY_AWS_KMS_SIGNER_ROLE_ARN = 'PLATFORM_KEY_AWS_KMS_SIGNER_ROLE_ARN',\n PLATFORM_KEY_AWS_KMS_OPERATOR_ROLE_ARN = 'PLATFORM_KEY_AWS_KMS_OPERATOR_ROLE_ARN',\n /** A KMS endpoint other than the region's public one (a VPC interface endpoint). Optional. */\n PLATFORM_KEY_AWS_KMS_ENDPOINT = 'PLATFORM_KEY_AWS_KMS_ENDPOINT',\n /** Google: the key ring (`projects/<p>/locations/<l>/keyRings/<r>`) and the two service accounts apps-manager impersonates. */\n PLATFORM_KEY_GOOGLE_KMS_KEY_RING = 'PLATFORM_KEY_GOOGLE_KMS_KEY_RING',\n PLATFORM_KEY_GOOGLE_KMS_SIGNER_SERVICE_ACCOUNT = 'PLATFORM_KEY_GOOGLE_KMS_SIGNER_SERVICE_ACCOUNT',\n PLATFORM_KEY_GOOGLE_KMS_OPERATOR_SERVICE_ACCOUNT = 'PLATFORM_KEY_GOOGLE_KMS_OPERATOR_SERVICE_ACCOUNT',\n /** `HSM` (the default) or `SOFTWARE`: the protection level new keys are created at. */\n PLATFORM_KEY_GOOGLE_KMS_PROTECTION_LEVEL = 'PLATFORM_KEY_GOOGLE_KMS_PROTECTION_LEVEL',\n /** Azure: the vault (or Managed HSM) URL and the client ids of the two user-assigned managed identities. */\n PLATFORM_KEY_AZURE_KEY_VAULT_URL = 'PLATFORM_KEY_AZURE_KEY_VAULT_URL',\n PLATFORM_KEY_AZURE_KEY_VAULT_SIGNER_CLIENT_ID = 'PLATFORM_KEY_AZURE_KEY_VAULT_SIGNER_CLIENT_ID',\n PLATFORM_KEY_AZURE_KEY_VAULT_OPERATOR_CLIENT_ID = 'PLATFORM_KEY_AZURE_KEY_VAULT_OPERATOR_CLIENT_ID',\n /** `true` (the default) makes new keys `EC-HSM` (a Premium vault or Managed HSM); `false` makes them software `EC` keys. */\n PLATFORM_KEY_AZURE_KEY_VAULT_HSM = 'PLATFORM_KEY_AZURE_KEY_VAULT_HSM',\n /**\n * The Log Analytics workspace the vault's diagnostic setting sends its `AuditEvent` logs to, read hourly to corroborate\n * the custodian's signatures (#2896). Optional: without it, no Azure hour is compared, and apps-manager says so at boot.\n */\n PLATFORM_KEY_AZURE_KEY_VAULT_LOG_ANALYTICS_WORKSPACE_ID = 'PLATFORM_KEY_AZURE_KEY_VAULT_LOG_ANALYTICS_WORKSPACE_ID',\n /**\n * The platform's dedicated HSM over PKCS#11 (#2934): the vendor's module (a shared library in apps-manager's image or\n * mounted into it), the token's label, and the user PIN. The module path and label come from\n * `platformKeyManagement.pkcs11`; the PIN from `secrets.json` (`platformKeyPkcs11.pin`), operator-typed, and it is the\n * only secret here. All three or none; a partial set registers nothing and is reported at apps-manager's boot.\n */\n PLATFORM_KEY_PKCS11_MODULE_PATH = 'PLATFORM_KEY_PKCS11_MODULE_PATH',\n PLATFORM_KEY_PKCS11_TOKEN_LABEL = 'PLATFORM_KEY_PKCS11_TOKEN_LABEL',\n PLATFORM_KEY_PKCS11_PIN = 'PLATFORM_KEY_PKCS11_PIN',\n /** Comma-separated token models the operator states are hardware (`CK_TOKEN_INFO.model`); none: every key is SOFTWARE. */\n PLATFORM_KEY_PKCS11_HARDWARE_TOKEN_MODELS = 'PLATFORM_KEY_PKCS11_HARDWARE_TOKEN_MODELS',\n /**\n * The crontabs-batches-manager's dedicated P2P signing keypair. The design is\n * per-service (mirrors apps-manager): the crontabs scheduler signs each SCHEDULED_CRON /\n * MINION_TICK job token with the PRIVATE half, and every app + minion verifies it against\n * the PUBLIC half (distributed to each app's `PLATFORM_CRONTABS_BATCHES_MANAGER` verify\n * slot by apps-manager). These were previously absent from the whole minting/emission\n * chain — so crontabs silently fell back to another key and apps handed out an EMPTY verify\n * key, dead-lettering every scheduled tick. Minted by `buildCredentials`, emitted here.\n */\n PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY = 'PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY',\n PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY = 'PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY',\n PLATFORM_APPLICATION_PRIMARY_SECRET = 'PLATFORM_APPLICATION_PRIMARY_SECRET',\n PLATFORM_ADMIN_SECRET = 'PLATFORM_ADMIN_SECRET',\n}\n\nexport enum PlatformAdminEnvKey {\n ADMIN_EMAIL = 'ADMIN_EMAIL',\n ADMIN_PASSWORD = 'ADMIN_PASSWORD',\n ADMIN_FIRST_NAME = 'ADMIN_FIRST_NAME',\n ADMIN_LAST_NAME = 'ADMIN_LAST_NAME',\n /*\n * The SECOND platform administrator — the one who APPROVES an application-wide access grant.\n *\n * `applicationAccessGrantApproverIsDistinct` refuses an approver who is the requester, and refuses\n * an absent approver, and the application-scoped grant has deliberately no auto-approval branch.\n * So a platform seeded with one administrator cannot read ANY application-wide surface — the\n * refusal shipped and the party who discharges it did not (#575).\n *\n * Four keys rather than a serialized payload, mirroring the administrator's own four: each is a\n * scalar read once at INIT, and a JSON blob would make a partially-stated identity a parse error\n * instead of the four named refusals INIT already gives for the first administrator.\n */\n APPROVER_EMAIL = 'APPROVER_EMAIL',\n APPROVER_PASSWORD = 'APPROVER_PASSWORD',\n APPROVER_FIRST_NAME = 'APPROVER_FIRST_NAME',\n APPROVER_LAST_NAME = 'APPROVER_LAST_NAME',\n GITHUB_WILDO_APPS_DEFAULT_ORG_URL = 'GITHUB_WILDO_APPS_DEFAULT_ORG_URL',\n GITHUB_WILDO_APPS_ADMIN_USER = 'GITHUB_WILDO_APPS_ADMIN_USER',\n GITHUB_WILDO_APPS_ADMIN_TOKEN = 'GITHUB_WILDO_APPS_ADMIN_TOKEN',\n}\n\nexport enum PlatformKubernetesEnvKey {\n K8S_NAMESPACE = 'K8S_NAMESPACE',\n}\n\n/**\n * Ingress / reverse-proxy env keys.\n *\n * `WILDO_PUBLIC_DOMAIN` is the runtime-agnostic public hostname that\n * apps-manager uses to compose ingress URLs and that backend services\n * use to derive cookie `Domain` and CORS allowlist entries. It applies\n * to BOTH Kubernetes and Docker Compose deployments — naming it\n * `K8S_*` (as in the previous `K8S_EXTERNAL_BASE_DOMAIN`) was a\n * conflation.\n */\nexport enum PlatformIngressEnvKey {\n WILDO_PUBLIC_DOMAIN = 'WILDO_PUBLIC_DOMAIN',\n /**\n * JSON-serialized `WildoInfraEnvConfig.serviceHosts` map (`<serviceKey> →\n * subdomain chain`, `''` = apex). Projected by `env-vars-builder` so\n * apps-manager can resolve each customer-app service's public host via\n * `buildServicePublicHost` (serviceHosts-driven ingress, no fan-out). Absent\n * / empty ⇒ every key falls back to `<serviceKey>.<publicDomain>`.\n */\n WILDO_SERVICE_HOSTS = 'WILDO_SERVICE_HOSTS',\n}\n\n/**\n * Logging env-var contract (Slice 3.5).\n *\n * Both keys are projected from `WildoInfraEnvConfig.logging.*` by\n * `env-vars-builder` for every long-running platform/application\n * process, and consumed by `LoggerService.loadConfiguration` in\n * `saas-backend-lib`. Missing values fall back to the LoggerService\n * defaults (level `debug`, pino-pretty auto-detect by environment),\n * matching the optional shape on `WildoLoggingConfigSchema`.\n *\n * `LOG_LEVEL` accepts the lowercase pino levels\n * (`debug | info | warn | error`); the `WildoLoggingConfigSchema` enum\n * is the authoritative validation surface upstream so an invalid\n * value can never reach `process.env`.\n *\n * `LOG_FORMATTED_CONSOLE_ERRORS` is a stringified boolean\n * (`'true' | 'false'`) that overrides the LoggerService's\n * environment-derived pino-pretty / JSON branch. When unset,\n * LoggerService keeps its existing auto-detect behavior (pino-pretty\n * iff `APPLICATION_ENV === 'development'`).\n */\nexport enum PlatformLoggingEnvKey {\n LOG_LEVEL = 'LOG_LEVEL',\n LOG_FORMATTED_CONSOLE_ERRORS = 'LOG_FORMATTED_CONSOLE_ERRORS',\n}\n\n/**\n * OTLP telemetry env-var contract (Slice 2 Phase 5).\n *\n * Projected from `WildoInfraEnvConfig.observability.*` + the selected\n * `OBSERVABILITY_TELEMETRY` provider by `env-vars-builder`, and read by the\n * `otel-preload.ts` OTel SDK in `saas-backend-lib` BEFORE app code. These are the\n * STANDARD OpenTelemetry env vars — the preload + OTLP exporters consume them\n * directly, so the engine stays provider-agnostic.\n *\n * `OTEL_ENABLED` is the master gate (`'true'`). `OTEL_EXPORTER_OTLP_ENDPOINT` is the\n * OTLP/HTTP collector/ingest URL. `OTEL_EXPORTER_OTLP_HEADERS` carries the provider auth\n * (e.g. `Authorization=Bearer <source-token>`) — SENSITIVE, routed to the K8s Secret.\n * `OTEL_SERVICE_NAME` + `OTEL_RESOURCE_ATTRIBUTES` carry the resource identity\n * (`service.name`, `service.version`, `deployment.environment`).\n */\nexport enum PlatformObservabilityEnvKey {\n OTEL_ENABLED = 'OTEL_ENABLED',\n OTEL_EXPORTER_OTLP_ENDPOINT = 'OTEL_EXPORTER_OTLP_ENDPOINT',\n OTEL_EXPORTER_OTLP_HEADERS = 'OTEL_EXPORTER_OTLP_HEADERS',\n OTEL_SERVICE_NAME = 'OTEL_SERVICE_NAME',\n OTEL_RESOURCE_ATTRIBUTES = 'OTEL_RESOURCE_ATTRIBUTES',\n /**\n * LLM-call observability (a SEPARATE signal from OTLP telemetry — PostHog\n * `$ai_generation` via the engine's `AgentCallTraceSink`): opt-in forwarding\n * of prompt + completion content (`$ai_input` / `$ai_output_choices`). PII\n * shipped to a third party, hence opt-in per environment. Read by the\n * engine's lazy LLM-obs sink resolution, NOT the OTLP preload.\n */\n WILDO_LLM_OBS_CAPTURE_CONTENT = 'WILDO_LLM_OBS_CAPTURE_CONTENT',\n /** LLM-call observability sampling fraction (0..1); omitted = capture all. */\n WILDO_LLM_OBS_SAMPLE_RATE = 'WILDO_LLM_OBS_SAMPLE_RATE',\n}\n\n/**\n * Per-environment external-provider SELECTION override env-var contract\n * (2026-07-10).\n *\n * Projected from `WildoInfraEnvConfig.providerSelection` by `env-vars-builder`\n * as a single serialized JSON payload (mirrors how `APPLICATION_RUNTIME_ENDPOINTS`\n * carries a structured payload in one var). Read by\n * `ExternalProvidersRegistryBackendService` at capability-resolution time to\n * override the app-wide `providers.scopes.backend.selection[capability]`\n * primary/substitutes for THIS environment only. Absent => the SaaS-config\n * selection applies unchanged.\n *\n * Shape: `{ \"<EngineCapability>\": { \"primary\": \"<ref>\", \"whenUnavailable\"?: [\"<ref>\"] } }`.\n */\nexport enum PlatformProviderSelectionEnvKey {\n WILDO_PROVIDER_SELECTION_OVERRIDES = 'WILDO_PROVIDER_SELECTION_OVERRIDES',\n}\n\n/**\n * Per-environment email env-var contract.\n *\n * Projected from `WildoInfraEnvConfig.email` by `env-vars-builder`, one scalar per value (the documentation-site shape:\n * a single string needs no serialized payload). Read by the backend's inbound email services through\n * `resolveInboundEmailConfig`, where it wins over `email.inbound.sharedDomain` in the backend configuration. Absent =>\n * the authored value applies unchanged.\n */\nexport enum PlatformEmailEnvKey {\n WILDO_INBOUND_EMAIL_SHARED_DOMAIN = 'WILDO_INBOUND_EMAIL_SHARED_DOMAIN',\n}\n\n/**\n * The ownership-DNS stand-in env-var contract (#2519).\n *\n * Projected from `WildoInfraEnvConfig.ownershipDnsStandIn.baseUrl` (local-only) by `env-vars-builder`. Read by the\n * backend's `DnsTxtLookupBackendService` — the one door every domain-ownership challenge asks DNS through — which\n * honours it only in a declared development or test runtime, and refuses to start with it set anywhere else. Absent =>\n * every ownership challenge asks public DNS.\n */\nexport enum PlatformOwnershipDnsEnvKey {\n WILDO_OWNERSHIP_DNS_STAND_IN_URL = 'WILDO_OWNERSHIP_DNS_STAND_IN_URL',\n}\n\n/**\n * Documentation-site BUILD env-var contract.\n *\n * Read from `WildoInfraEnvConfig.documentationSite`, in the loaded descriptor, by the documentation image's build\n * arguments and the CI workflow (`wildo config sync`); no runtime environment carries them (#2310). Unlike the\n * other families here these are consumed by a BUILD rather than a running service: a\n * Docusaurus bundle compiles its origins in, so the values must be present when the site is\n * built, and a bundle built with the wrong ones silently points every reader at the wrong\n * host instead of failing.\n *\n * The application's `docusaurus.config.ts` refuses to complete a production build when they\n * are unset, and falls back to local defaults otherwise. Before this contract existed the\n * only way to satisfy that guard was to remember three variables on a build command line,\n * so they appeared in no environment definition anywhere.\n *\n * Emitted individually rather than as one serialized payload (the `providerSelection`\n * shape): each is a single scalar read directly by the config, and a JSON blob would force\n * the docs config to parse a payload to recover three strings.\n */\nexport enum PlatformDocumentationSiteEnvKey {\n WILDO_DOCS_API_BASE_URL = 'WILDO_DOCS_API_BASE_URL',\n WILDO_DOCS_APP_URL = 'WILDO_DOCS_APP_URL',\n WILDO_DOCS_FRONTEND_SERVICE_NAME = 'WILDO_DOCS_FRONTEND_SERVICE_NAME',\n}\n\nexport const PlatformDocumentationSiteEnvKeys = PlatformDocumentationSiteEnvKey;\nexport const PlatformProcessEnvKeys = PlatformProcessEnvKey;\nexport const PlatformServiceUrlEnvKeys = PlatformServiceUrlEnvKey;\nexport const PlatformInfrastructureEnvKeys = PlatformInfrastructureEnvKey;\nexport const PlatformSecurityEnvKeys = PlatformSecurityEnvKey;\nexport const PlatformAdminEnvKeys = PlatformAdminEnvKey;\nexport const PlatformKubernetesEnvKeys = PlatformKubernetesEnvKey;\nexport const PlatformIngressEnvKeys = PlatformIngressEnvKey;\nexport const PlatformLoggingEnvKeys = PlatformLoggingEnvKey;\nexport const PlatformObservabilityEnvKeys = PlatformObservabilityEnvKey;\nexport const PlatformProviderSelectionEnvKeys = PlatformProviderSelectionEnvKey;\nexport const PlatformEmailEnvKeys = PlatformEmailEnvKey;\nexport const PlatformOwnershipDnsEnvKeys = PlatformOwnershipDnsEnvKey;\n\n/**\n * Resolve a required environment variable value or throw a clear,\n * actionable error.\n *\n * This is the canonical fail-closed reader for platform runtime env vars.\n * It exists to replace silent string-fallback patterns like\n * `process.env.X || 'localhost'` / `process.env.Y || 'local'` /\n * `process.env.Z || 'http://localhost:NNNN'` in apps-manager and any\n * other platform service. Those patterns let production processes start\n * silently mis-wired (e.g. talking to `localhost` instead of the real\n * cluster service) and surface as opaque downstream errors much later.\n *\n * Contract:\n * - Empty strings are treated as missing (a `KEY=` line in `.env` is a\n * misconfiguration, not an \"intentional empty value\").\n * - The thrown error names both the env var and the consuming context\n * (e.g. `\"Missing required env var REDIS_HOST (consumer:\n * PlatformInfrastructureManagerService.provisionAllPlatformConfigs)\"`).\n * - This helper does NOT decide whether a key is sensitive — that lives\n * in `PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS`. Callers are responsible\n * for not logging the resolved value when sensitive.\n *\n * Usage:\n * const host = requireEnv(\n * PlatformInfrastructureEnvKey.REDIS_HOST,\n * 'PlatformInfrastructureManagerService.provisionAllPlatformConfigs',\n * );\n *\n * Local-development defaults must live in `secrets.json` /\n * `infrastructure/<env>/secrets/` and be loaded into `process.env` by\n * the CLI / K8s wiring, NOT in production code paths.\n */\nexport function requireEnv(envName: string, consumerContext: string): string {\n const raw = process.env[envName];\n if (raw === undefined || raw === '') {\n throw new Error(\n `Missing required environment variable ${envName} (consumer: ${consumerContext}). ` +\n `Local development defaults belong in secrets.json / infrastructure/<env>/secrets/, ` +\n `not in production code fallbacks.`,\n );\n }\n return raw;\n}\n\nexport const PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS = new Set<string>([\n PlatformInfrastructureEnvKey.MONGO_CONNECT_URL,\n PlatformInfrastructureEnvKey.MONGO_PLATFORM_URL,\n PlatformInfrastructureEnvKey.REDIS_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.RABBITMQ_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.STORAGE_ACCESS_KEY,\n PlatformInfrastructureEnvKey.STORAGE_SECRET_KEY,\n PlatformInfrastructureEnvKey.PG_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.PG_CONNECT_URL,\n PlatformInfrastructureEnvKey.IMMUDB_ADMIN_PASSWORD,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PUBLIC_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_KEY_ENCRYPTION_ROOT,\n PlatformSecurityEnvKey.PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT,\n PlatformSecurityEnvKey.PLATFORM_KEY_VAULT_SIGNER_TOKEN,\n PlatformSecurityEnvKey.PLATFORM_KEY_VAULT_OPERATOR_TOKEN,\n PlatformSecurityEnvKey.PLATFORM_KEY_PKCS11_PIN,\n PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET,\n PlatformSecurityEnvKey.PLATFORM_ADMIN_SECRET,\n PlatformAdminEnvKey.ADMIN_PASSWORD,\n PlatformAdminEnvKey.GITHUB_WILDO_APPS_ADMIN_TOKEN,\n // OTLP auth header carries the provider source token (e.g. a BetterStack Bearer token) →\n // secret (K8s Secret, docker env_file). The sibling OTEL_ENABLED / OTEL_EXPORTER_OTLP_ENDPOINT /\n // OTEL_SERVICE_NAME / OTEL_RESOURCE_ATTRIBUTES are non-secret config and deliberately stay out.\n PlatformObservabilityEnvKey.OTEL_EXPORTER_OTLP_HEADERS,\n]);\n"]}
1
+ {"version":3,"file":"platform-runtime-env.contracts.js","sourceRoot":"","sources":["../../../src/bootstrap/platform-runtime-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAN,IAAY,qBAmBX;AAnBD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,sCAAa,CAAA;IACb,sDAA6B,CAAA;IAC7B;;;;;;;;;;OAUG;IACH,8DAAqC,CAAA;IACrC,4EAAmD,CAAA;IACnD,4DAAmC,CAAA;IACnC,gEAAuC,CAAA;AACzC,CAAC,EAnBW,qBAAqB,KAArB,qBAAqB,QAmBhC;AAED,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,mFAAuD,CAAA;IACvD,2GAA+E,CAAA;IAC/E,yFAA6D,CAAA;AAC/D,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC;AAED,MAAM,CAAN,IAAY,4BAiGX;AAjGD,WAAY,4BAA4B;IACtC,uEAAuC,CAAA;I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B;IACjD,4BAA4B,CAAC,uBAAuB;IACpD,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,iBAAiB;IAC9C,4BAA4B,CAAC,cAAc;IAC3C,4BAA4B,CAAC,qBAAqB;IAClD,sBAAsB,CAAC,iCAAiC;IACxD,sBAAsB,CAAC,gCAAgC;IACvD,sBAAsB,CAAC,kDAAkD;IACzE,sBAAsB,CAAC,4BAA4B;IACnD,sBAAsB,CAAC,qCAAqC;IAC5D,sBAAsB,CAAC,+BAA+B;IACtD,sBAAsB,CAAC,iCAAiC;IACxD,sBAAsB,CAAC,uBAAuB;IAC9C,sBAAsB,CAAC,6CAA6C;IACpE,sBAAsB,CAAC,4CAA4C;IACnE,sBAAsB,CAAC,mCAAmC;IAC1D,sBAAsB,CAAC,qBAAqB;IAC5C,mBAAmB,CAAC,cAAc;IAClC,mBAAmB,CAAC,6BAA6B;IACjD,yFAAyF;IACzF,iGAAiG;IACjG,gGAAgG;IAChG,2BAA2B,CAAC,0BAA0B;CACvD,CAAC,CAAC","sourcesContent":["/**\n * Shared environment contract for platform runtime processes.\n *\n * This captures the canonical env-var vocabulary used by CLI-generated platform\n * `.env` material and by platform services such as apps-manager at runtime.\n * Keep these keys declarative and cross-executor: the contract owns names and\n * sensitivity classification, while writers/readers own behavior.\n */\n\nexport enum PlatformProcessEnvKey {\n HOST = 'HOST',\n PORT = 'PORT',\n SERVICE_NAME = 'SERVICE_NAME',\n /**\n * The APPLICATION this process belongs to, as its slug (#1177).\n *\n * Distinct from {@link SERVICE_NAME}, which names the PROCESS — `wonder-todos-backend-api`,\n * `marketing-scrapper`, `my-node-worker`. Only the first of those contains the application's name,\n * which is why the logger cannot derive the application from it: a minion and a worker are named\n * after themselves.\n *\n * Emitted for APPLICATION runtimes only (backend, minion, worker, companion). The platform's own\n * services belong to no application and deliberately do not carry it.\n */\n APPLICATION_SLUG = 'APPLICATION_SLUG',\n PLATFORM_ENVIRONMENT_ID = 'PLATFORM_ENVIRONMENT_ID',\n APPLICATION_ENV = 'APPLICATION_ENV',\n APPS_MANAGER_MODE = 'APPS_MANAGER_MODE',\n}\n\nexport enum PlatformServiceUrlEnvKey {\n PLATFORM_APPS_MANAGER_URL = 'PLATFORM_APPS_MANAGER_URL',\n PLATFORM_CRONTABS_BATCHES_MANAGER_URL = 'PLATFORM_CRONTABS_BATCHES_MANAGER_URL',\n PLATFORM_MODULE_REGISTRY_URL = 'PLATFORM_MODULE_REGISTRY_URL',\n}\n\nexport enum PlatformInfrastructureEnvKey {\n MONGO_CONNECT_URL = 'MONGO_CONNECT_URL',\n MONGO_PLATFORM_URL = 'MONGO_PLATFORM_URL',\n BASE_MONGO_SERVER_URL = 'BASE_MONGO_SERVER_URL',\n REDIS_HOST = 'REDIS_HOST',\n REDIS_PORT = 'REDIS_PORT',\n /**\n * Optional Redis logical database index (0–15). Emitted only when the\n * author sets `backingServices.redis.database` in `wildo.infra.<env>.config.ts`.\n * Consumers default to DB 0 when this var is missing.\n */\n REDIS_DATABASE = 'REDIS_DATABASE',\n REDIS_ADMIN_USER = 'REDIS_ADMIN_USER',\n REDIS_ADMIN_PASSWORD = 'REDIS_ADMIN_PASSWORD',\n RABBITMQ_HOST = 'RABBITMQ_HOST',\n RABBITMQ_PORT = 'RABBITMQ_PORT',\n RABBITMQ_MANAGEMENT_PORT = 'RABBITMQ_MANAGEMENT_PORT',\n /**\n * Optional RabbitMQ virtual host. Emitted only when the author sets\n * `backingServices.rabbitmq.vhost` in `wildo.infra.<env>.config.ts`.\n * Consumers default to `/` (the RabbitMQ root vhost) when missing.\n */\n RABBITMQ_VHOST = 'RABBITMQ_VHOST',\n RABBITMQ_ADMIN_USERNAME = 'RABBITMQ_ADMIN_USERNAME',\n RABBITMQ_ADMIN_PASSWORD = 'RABBITMQ_ADMIN_PASSWORD',\n /**\n * The environment's service profile (`EnvironmentServiceProfile`), as the PLATFORM services read it (#2303 slice D).\n * apps-manager derives from it whether the platform runs a message broker\n * (`environmentServiceProfileRunsMessageBroker`), so under a profile whose queue lives in each application's database\n * it initializes no RabbitMQ admin client and mints no vhost or credentials. Absent ⇒ FULL; emitted only when not the\n * default.\n *\n * A key of its own, not the application backend's `ENVIRONMENT_SERVICE_PROFILE`: platform services boot through the\n * engine's `StartApplicationBackendService`, whose APPLICATION refusals (a Layer-2 audit trail, MongoDB search, a\n * required scan, all keyed on that key) describe what an application may declare, not what a platform service runs.\n */\n PLATFORM_ENVIRONMENT_SERVICE_PROFILE = 'PLATFORM_ENVIRONMENT_SERVICE_PROFILE',\n STORAGE_PROVIDER = 'STORAGE_PROVIDER',\n /**\n * S3-compatible endpoint **hostname** (NOT a URL); see the matching\n * JSDoc on `ApplicationBackendDataEnvKey.STORAGE_ENDPOINT` for the\n * full contract (Slice 3.2 audit L-4). Kept here for the\n * platform-runtime side (apps-manager) — same\n * host:port-only invariant.\n */\n STORAGE_ENDPOINT = 'STORAGE_ENDPOINT',\n STORAGE_PORT = 'STORAGE_PORT',\n STORAGE_USE_SSL = 'STORAGE_USE_SSL',\n STORAGE_BUCKET = 'STORAGE_BUCKET',\n STORAGE_ACCESS_KEY = 'STORAGE_ACCESS_KEY',\n STORAGE_SECRET_KEY = 'STORAGE_SECRET_KEY',\n /**\n * The role apps-manager's object-storage broker names when it calls STS `AssumeRole` (#2172), as an ARN.\n * apps-manager only. Optional: a MinIO-compatible store issues a session for the CALLING key and names no role,\n * while AWS STS (and SeaweedFS, Ceph RGW) require one, and the broker refuses issuance against such a store when\n * this is absent. Rendered from `platformStorage.stsRoleArn` in the environment's infra file.\n */\n STORAGE_STS_ROLE_ARN = 'STORAGE_STS_ROLE_ARN',\n PG_HOST = 'PG_HOST',\n PG_PORT = 'PG_PORT',\n PG_ADMIN_USER = 'PG_ADMIN_USER',\n PG_ADMIN_PASSWORD = 'PG_ADMIN_PASSWORD',\n /**\n * The MAINTENANCE database the admin pool connects to in order to provision others — NOT the\n * application's database and NOT the container's initdb database (that is\n * `POSTGRES_ADMIN_DATABASE`, a different key on a different transport). Emitted from\n * `PLATFORM_POSTGRES_MAINTENANCE_DATABASE`, whose JSDoc carries the three-way distinction and\n * the silent outage that conflating the first two produced.\n */\n PG_ADMIN_DATABASE = 'PG_ADMIN_DATABASE',\n PG_SSL_MODE = 'PG_SSL_MODE',\n /**\n * The platform's OWN PostgreSQL database — a full connection URL, the exact mirror of\n * `MONGO_CONNECT_URL` for a PostgreSQL-engined platform (D7 of the incremental-migrations plan).\n *\n * Distinct from the `PG_ADMIN_*` family above, which is PROVISIONING material (the admin\n * connection apps-manager uses to create per-application databases/roles). This key is the\n * database apps-manager's own resources live in. One URL rather than an address/credential\n * split on purpose: the platform pre-connects from env BEFORE any config document can be read\n * (the same chicken-and-egg `MONGO_CONNECT_URL` solves — the config documents live in the very\n * database this key addresses), so the whole answer must arrive in one env-delivered value.\n *\n * Emitted by the CLI's platform env builder only when the environment's\n * `database.engine === POSTGRESQL`. Absent on a Mongo-engined platform.\n */\n PG_CONNECT_URL = 'PG_CONNECT_URL',\n /**\n * The self-hosted immudb server apps-manager provisions each application's audit database and user on (#1696):\n * host and gRPC port as apps-manager reaches it, and the server's built-in `immudb` SYSADMIN password — a\n * framework-managed PLATFORM secret (`immudb.adminPassword`), written into apps-manager's environment only.\n * No application receives it: each application writes with the confined user apps-manager minted for it.\n * Absent on a platform that self-hosts no immudb; an application declaring `immudb: { source: SELF }` is then\n * refused at registration (`NOT_HELD_BY_PLATFORM`), like every minting kind whose admin client is missing.\n */\n IMMUDB_ADMIN_HOST = 'IMMUDB_ADMIN_HOST',\n IMMUDB_ADMIN_PORT = 'IMMUDB_ADMIN_PORT',\n IMMUDB_ADMIN_PASSWORD = 'IMMUDB_ADMIN_PASSWORD',\n}\n\nexport enum PlatformSecurityEnvKey {\n PLATFORM_APPS_MANAGER_PRIVATE_KEY = 'PLATFORM_APPS_MANAGER_PRIVATE_KEY',\n PLATFORM_APPS_MANAGER_PUBLIC_KEY = 'PLATFORM_APPS_MANAGER_PUBLIC_KEY',\n /**\n * apps-manager's RESPONSE key (#2921): the private half that signs every successful answer on the routes application\n * runtimes read (configuration, secrets, worker bootstrap, storage session, runtime-principal token). Its own key,\n * never the {@link PLATFORM_APPS_MANAGER_PRIVATE_KEY} that signs runtime-principal tokens and crontabs requests: one key\n * per purpose (NIST SP 800-57 Part 1 Rev 5 §5.2). Runtimes verify against the public halves carried in\n * `PLATFORM_APPS_MANAGER_RESPONSE_VERIFICATION_KEYS`. Required: apps-manager refuses to start without it, because a\n * response it cannot sign must not be sent (`runtime-response-integrity.ts`).\n */\n PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY = 'PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY',\n /**\n * The platform's key-encryption ROOT (#2891): 32 random bytes, base64url, held by apps-manager alone. Every private\n * key the engine's LOCAL key provider makes (the approval-seal keys among them) is sealed under it with AES-256-GCM\n * before it is stored, so a platform database dump yields no usable private key.\n *\n * Losing it loses every LOCAL private key, and nothing else: the public halves are stored in each application, so\n * every seal already made still verifies. The keys it sealed cannot sign again, and the keyring does not replace them on\n * its own: apps-manager reports them at startup, and an operator who knows the root is gone for good runs\n * `wildo keys rotate --root-lost --reason \"<why>\"` per application, which destroys them and makes fresh ones. A new\n * root never opens the old keys, so restore it from backup before minting another. Back it up with the platform's other\n * secrets. Every lane provides it (`wildo local doctor` reports it missing). apps-manager starts without it, so a stack\n * predating it keeps running, and the keyring refuses its first operation (`PROVIDER_UNAVAILABLE`); a MALFORMED value is\n * refused at startup.\n */\n PLATFORM_KEY_ENCRYPTION_ROOT = 'PLATFORM_KEY_ENCRYPTION_ROOT',\n /**\n * The root a rotation replaced (#2891), kept only until every sealed key has been re-sealed under the current one.\n * apps-manager opens a key under whichever root sealed it and re-seals it under the current root. Optional.\n */\n PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT = 'PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT',\n /**\n * The platform's HashiCorp Vault or OpenBao (#2933), where apps-manager runs the `vault-transit` (REMOTE) and\n * `vault-kv` (RETRIEVED) key providers. apps-manager alone holds these: no application runtime ever reaches the Vault.\n * All optional; a platform without a Vault leaves them unset, and a binding to a Vault provider is refused\n * (`PROVIDER_UNAVAILABLE`). The address and BOTH tokens are needed together; a partial set registers nothing and is\n * reported at apps-manager's boot, while the LOCAL provider keeps serving.\n *\n * Two tokens, for least privilege, under the policies `vault-custody.contracts` states (`vaultSignerPolicy`,\n * `vaultOperatorPolicy`): the SIGNER token may sign (`transit/sign/<prefix>*`) and read keys and key metadata; the\n * OPERATOR token performs lifecycle acts (create, rotate, config, delete, KV write and destroy) and is denied signing\n * and reading key material. Neither can make a key leave Vault: the signer is denied `/config`, `transit/export/*` and\n * `transit/backup/*`, and the operator may not send `exportable` or `allow_plaintext_backup` at all.\n * Not `VAULT_ADDR` / `VAULT_TOKEN`: those are read by Vault's own CLI and SDKs, and a stray one would be picked up.\n */\n PLATFORM_KEY_VAULT_ADDRESS = 'PLATFORM_KEY_VAULT_ADDRESS',\n PLATFORM_KEY_VAULT_SIGNER_TOKEN = 'PLATFORM_KEY_VAULT_SIGNER_TOKEN',\n PLATFORM_KEY_VAULT_OPERATOR_TOKEN = 'PLATFORM_KEY_VAULT_OPERATOR_TOKEN',\n /** Vault Enterprise namespace (`ns1/ns2/`). Optional. */\n PLATFORM_KEY_VAULT_NAMESPACE = 'PLATFORM_KEY_VAULT_NAMESPACE',\n /** The Transit mount (`transit` when unset). */\n PLATFORM_KEY_VAULT_TRANSIT_MOUNT = 'PLATFORM_KEY_VAULT_TRANSIT_MOUNT',\n /** The KV v2 mount (`secret` when unset). */\n PLATFORM_KEY_VAULT_KV_MOUNT = 'PLATFORM_KEY_VAULT_KV_MOUNT',\n /** What every key and path apps-manager makes is named with, so the Vault policies can be scoped to it (`wildo-`). */\n PLATFORM_KEY_VAULT_KEY_NAME_PREFIX = 'PLATFORM_KEY_VAULT_KEY_NAME_PREFIX',\n /**\n * The platform's cloud KMS providers (#2896): `aws-kms`, `google-cloud-kms`, `azure-key-vault`. apps-manager alone\n * holds them, and authenticates by its WORKLOAD identity (IAM role for service accounts, GKE workload identity, an\n * Azure managed identity), so none of these is a secret. Each provider acts as TWO identities, as the Vault providers\n * do with two tokens: a SIGNER that may only read keys and sign, and an OPERATOR that creates, disables and destroys\n * them and may never sign. Every key of one provider is needed together; a partial set registers nothing and is\n * reported at apps-manager's boot.\n *\n * AWS: apps-manager's own identity may only `sts:AssumeRole` the two roles named here.\n */\n PLATFORM_KEY_AWS_KMS_REGION = 'PLATFORM_KEY_AWS_KMS_REGION',\n PLATFORM_KEY_AWS_KMS_SIGNER_ROLE_ARN = 'PLATFORM_KEY_AWS_KMS_SIGNER_ROLE_ARN',\n PLATFORM_KEY_AWS_KMS_OPERATOR_ROLE_ARN = 'PLATFORM_KEY_AWS_KMS_OPERATOR_ROLE_ARN',\n /** A KMS endpoint other than the region's public one (a VPC interface endpoint). Optional. */\n PLATFORM_KEY_AWS_KMS_ENDPOINT = 'PLATFORM_KEY_AWS_KMS_ENDPOINT',\n /** Google: the key ring (`projects/<p>/locations/<l>/keyRings/<r>`) and the two service accounts apps-manager impersonates. */\n PLATFORM_KEY_GOOGLE_KMS_KEY_RING = 'PLATFORM_KEY_GOOGLE_KMS_KEY_RING',\n PLATFORM_KEY_GOOGLE_KMS_SIGNER_SERVICE_ACCOUNT = 'PLATFORM_KEY_GOOGLE_KMS_SIGNER_SERVICE_ACCOUNT',\n PLATFORM_KEY_GOOGLE_KMS_OPERATOR_SERVICE_ACCOUNT = 'PLATFORM_KEY_GOOGLE_KMS_OPERATOR_SERVICE_ACCOUNT',\n /** `HSM` (the default) or `SOFTWARE`: the protection level new keys are created at. */\n PLATFORM_KEY_GOOGLE_KMS_PROTECTION_LEVEL = 'PLATFORM_KEY_GOOGLE_KMS_PROTECTION_LEVEL',\n /** Azure: the vault (or Managed HSM) URL and the client ids of the two user-assigned managed identities. */\n PLATFORM_KEY_AZURE_KEY_VAULT_URL = 'PLATFORM_KEY_AZURE_KEY_VAULT_URL',\n PLATFORM_KEY_AZURE_KEY_VAULT_SIGNER_CLIENT_ID = 'PLATFORM_KEY_AZURE_KEY_VAULT_SIGNER_CLIENT_ID',\n PLATFORM_KEY_AZURE_KEY_VAULT_OPERATOR_CLIENT_ID = 'PLATFORM_KEY_AZURE_KEY_VAULT_OPERATOR_CLIENT_ID',\n /** `true` (the default) makes new keys `EC-HSM` (a Premium vault or Managed HSM); `false` makes them software `EC` keys. */\n PLATFORM_KEY_AZURE_KEY_VAULT_HSM = 'PLATFORM_KEY_AZURE_KEY_VAULT_HSM',\n /**\n * The Log Analytics workspace the vault's diagnostic setting sends its `AuditEvent` logs to, read hourly to corroborate\n * the custodian's signatures (#2896). Optional: without it, no Azure hour is compared, and apps-manager says so at boot.\n */\n PLATFORM_KEY_AZURE_KEY_VAULT_LOG_ANALYTICS_WORKSPACE_ID = 'PLATFORM_KEY_AZURE_KEY_VAULT_LOG_ANALYTICS_WORKSPACE_ID',\n /**\n * The platform's dedicated HSM over PKCS#11 (#2934): the vendor's module (a shared library in apps-manager's image or\n * mounted into it), the token's label, and the user PIN. The module path and label come from\n * `platformKeyManagement.pkcs11`; the PIN from `secrets.json` (`platformKeyPkcs11.pin`), operator-typed, and it is the\n * only secret here. All three or none; a partial set registers nothing and is reported at apps-manager's boot.\n */\n PLATFORM_KEY_PKCS11_MODULE_PATH = 'PLATFORM_KEY_PKCS11_MODULE_PATH',\n PLATFORM_KEY_PKCS11_TOKEN_LABEL = 'PLATFORM_KEY_PKCS11_TOKEN_LABEL',\n PLATFORM_KEY_PKCS11_PIN = 'PLATFORM_KEY_PKCS11_PIN',\n /** Comma-separated token models the operator states are hardware (`CK_TOKEN_INFO.model`); none: every key is SOFTWARE. */\n PLATFORM_KEY_PKCS11_HARDWARE_TOKEN_MODELS = 'PLATFORM_KEY_PKCS11_HARDWARE_TOKEN_MODELS',\n /**\n * The crontabs-batches-manager's dedicated P2P signing keypair. The design is\n * per-service (mirrors apps-manager): the crontabs scheduler signs each SCHEDULED_CRON /\n * MINION_TICK job token with the PRIVATE half, and every app + minion verifies it against\n * the PUBLIC half (distributed to each app's `PLATFORM_CRONTABS_BATCHES_MANAGER` verify\n * slot by apps-manager). These were previously absent from the whole minting/emission\n * chain — so crontabs silently fell back to another key and apps handed out an EMPTY verify\n * key, dead-lettering every scheduled tick. Minted by `buildCredentials`, emitted here.\n */\n PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY = 'PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY',\n PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY = 'PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY',\n PLATFORM_APPLICATION_PRIMARY_SECRET = 'PLATFORM_APPLICATION_PRIMARY_SECRET',\n PLATFORM_ADMIN_SECRET = 'PLATFORM_ADMIN_SECRET',\n}\n\nexport enum PlatformAdminEnvKey {\n ADMIN_EMAIL = 'ADMIN_EMAIL',\n ADMIN_PASSWORD = 'ADMIN_PASSWORD',\n ADMIN_FIRST_NAME = 'ADMIN_FIRST_NAME',\n ADMIN_LAST_NAME = 'ADMIN_LAST_NAME',\n /*\n * The SECOND platform administrator — the one who APPROVES an application-wide access grant.\n *\n * `applicationAccessGrantApproverIsDistinct` refuses an approver who is the requester, and refuses\n * an absent approver, and the application-scoped grant has deliberately no auto-approval branch.\n * So a platform seeded with one administrator cannot read ANY application-wide surface — the\n * refusal shipped and the party who discharges it did not (#575).\n *\n * Four keys rather than a serialized payload, mirroring the administrator's own four: each is a\n * scalar read once at INIT, and a JSON blob would make a partially-stated identity a parse error\n * instead of the four named refusals INIT already gives for the first administrator.\n */\n APPROVER_EMAIL = 'APPROVER_EMAIL',\n APPROVER_PASSWORD = 'APPROVER_PASSWORD',\n APPROVER_FIRST_NAME = 'APPROVER_FIRST_NAME',\n APPROVER_LAST_NAME = 'APPROVER_LAST_NAME',\n GITHUB_WILDO_APPS_DEFAULT_ORG_URL = 'GITHUB_WILDO_APPS_DEFAULT_ORG_URL',\n GITHUB_WILDO_APPS_ADMIN_USER = 'GITHUB_WILDO_APPS_ADMIN_USER',\n GITHUB_WILDO_APPS_ADMIN_TOKEN = 'GITHUB_WILDO_APPS_ADMIN_TOKEN',\n}\n\nexport enum PlatformKubernetesEnvKey {\n K8S_NAMESPACE = 'K8S_NAMESPACE',\n}\n\n/**\n * Ingress / reverse-proxy env keys.\n *\n * `WILDO_PUBLIC_DOMAIN` is the runtime-agnostic public hostname that\n * apps-manager uses to compose ingress URLs and that backend services\n * use to derive cookie `Domain` and CORS allowlist entries. It applies\n * to BOTH Kubernetes and Docker Compose deployments — naming it\n * `K8S_*` (as in the previous `K8S_EXTERNAL_BASE_DOMAIN`) was a\n * conflation.\n */\nexport enum PlatformIngressEnvKey {\n WILDO_PUBLIC_DOMAIN = 'WILDO_PUBLIC_DOMAIN',\n /**\n * JSON-serialized `WildoInfraEnvConfig.serviceHosts` map (`<serviceKey> →\n * subdomain chain`, `''` = apex). Projected by `env-vars-builder` so\n * apps-manager can resolve each customer-app service's public host via\n * `buildServicePublicHost` (serviceHosts-driven ingress, no fan-out). Absent\n * / empty ⇒ every key falls back to `<serviceKey>.<publicDomain>`.\n */\n WILDO_SERVICE_HOSTS = 'WILDO_SERVICE_HOSTS',\n}\n\n/**\n * Logging env-var contract (Slice 3.5).\n *\n * Both keys are projected from `WildoInfraEnvConfig.logging.*` by\n * `env-vars-builder` for every long-running platform/application\n * process, and consumed by `LoggerService.loadConfiguration` in\n * `saas-backend-lib`. Missing values fall back to the LoggerService\n * defaults (level `debug`, pino-pretty auto-detect by environment),\n * matching the optional shape on `WildoLoggingConfigSchema`.\n *\n * `LOG_LEVEL` accepts the lowercase pino levels\n * (`debug | info | warn | error`); the `WildoLoggingConfigSchema` enum\n * is the authoritative validation surface upstream so an invalid\n * value can never reach `process.env`.\n *\n * `LOG_FORMATTED_CONSOLE_ERRORS` is a stringified boolean\n * (`'true' | 'false'`) that overrides the LoggerService's\n * environment-derived pino-pretty / JSON branch. When unset,\n * LoggerService keeps its existing auto-detect behavior (pino-pretty\n * iff `APPLICATION_ENV === 'development'`).\n */\nexport enum PlatformLoggingEnvKey {\n LOG_LEVEL = 'LOG_LEVEL',\n LOG_FORMATTED_CONSOLE_ERRORS = 'LOG_FORMATTED_CONSOLE_ERRORS',\n}\n\n/**\n * OTLP telemetry env-var contract (Slice 2 Phase 5).\n *\n * Projected from `WildoInfraEnvConfig.observability.*` + the selected\n * `OBSERVABILITY_TELEMETRY` provider by `env-vars-builder`, and read by the\n * `otel-preload.ts` OTel SDK in `saas-backend-lib` BEFORE app code. These are the\n * STANDARD OpenTelemetry env vars — the preload + OTLP exporters consume them\n * directly, so the engine stays provider-agnostic.\n *\n * `OTEL_ENABLED` is the master gate (`'true'`). `OTEL_EXPORTER_OTLP_ENDPOINT` is the\n * OTLP/HTTP collector/ingest URL. `OTEL_EXPORTER_OTLP_HEADERS` carries the provider auth\n * (e.g. `Authorization=Bearer <source-token>`) — SENSITIVE, routed to the K8s Secret.\n * `OTEL_SERVICE_NAME` + `OTEL_RESOURCE_ATTRIBUTES` carry the resource identity\n * (`service.name`, `service.version`, `deployment.environment`).\n */\nexport enum PlatformObservabilityEnvKey {\n OTEL_ENABLED = 'OTEL_ENABLED',\n OTEL_EXPORTER_OTLP_ENDPOINT = 'OTEL_EXPORTER_OTLP_ENDPOINT',\n OTEL_EXPORTER_OTLP_HEADERS = 'OTEL_EXPORTER_OTLP_HEADERS',\n OTEL_SERVICE_NAME = 'OTEL_SERVICE_NAME',\n OTEL_RESOURCE_ATTRIBUTES = 'OTEL_RESOURCE_ATTRIBUTES',\n /**\n * LLM-call observability (a SEPARATE signal from OTLP telemetry — PostHog\n * `$ai_generation` via the engine's `AgentCallTraceSink`): opt-in forwarding\n * of prompt + completion content (`$ai_input` / `$ai_output_choices`). PII\n * shipped to a third party, hence opt-in per environment. Read by the\n * engine's lazy LLM-obs sink resolution, NOT the OTLP preload.\n */\n WILDO_LLM_OBS_CAPTURE_CONTENT = 'WILDO_LLM_OBS_CAPTURE_CONTENT',\n /** LLM-call observability sampling fraction (0..1); omitted = capture all. */\n WILDO_LLM_OBS_SAMPLE_RATE = 'WILDO_LLM_OBS_SAMPLE_RATE',\n}\n\n/**\n * Per-environment external-provider SELECTION override env-var contract\n * (2026-07-10).\n *\n * Projected from `WildoInfraEnvConfig.providerSelection` by `env-vars-builder`\n * as a single serialized JSON payload (mirrors how `APPLICATION_RUNTIME_ENDPOINTS`\n * carries a structured payload in one var). Read by\n * `ExternalProvidersRegistryBackendService` at capability-resolution time to\n * override the app-wide `providers.scopes.backend.selection[capability]`\n * primary/substitutes for THIS environment only. Absent => the SaaS-config\n * selection applies unchanged.\n *\n * Shape: `{ \"<EngineCapability>\": { \"primary\": \"<ref>\", \"whenUnavailable\"?: [\"<ref>\"] } }`.\n */\nexport enum PlatformProviderSelectionEnvKey {\n WILDO_PROVIDER_SELECTION_OVERRIDES = 'WILDO_PROVIDER_SELECTION_OVERRIDES',\n}\n\n/**\n * Per-environment email env-var contract.\n *\n * Projected from `WildoInfraEnvConfig.email` by `env-vars-builder`, one scalar per value (the documentation-site shape:\n * a single string needs no serialized payload). Read by the backend's inbound email services through\n * `resolveInboundEmailConfig`, where it wins over `email.inbound.sharedDomain` in the backend configuration. Absent =>\n * the authored value applies unchanged.\n */\nexport enum PlatformEmailEnvKey {\n WILDO_INBOUND_EMAIL_SHARED_DOMAIN = 'WILDO_INBOUND_EMAIL_SHARED_DOMAIN',\n}\n\n/**\n * The ownership-DNS stand-in env-var contract (#2519).\n *\n * Projected from `WildoInfraEnvConfig.ownershipDnsStandIn.baseUrl` (local-only) by `env-vars-builder`. Read by the\n * backend's `DnsTxtLookupBackendService` — the one door every domain-ownership challenge asks DNS through — which\n * honours it only in a declared development or test runtime, and refuses to start with it set anywhere else. Absent =>\n * every ownership challenge asks public DNS.\n */\nexport enum PlatformOwnershipDnsEnvKey {\n WILDO_OWNERSHIP_DNS_STAND_IN_URL = 'WILDO_OWNERSHIP_DNS_STAND_IN_URL',\n}\n\n/**\n * Documentation-site BUILD env-var contract.\n *\n * Read from `WildoInfraEnvConfig.documentationSite`, in the loaded descriptor, by the documentation image's build\n * arguments and the CI workflow (`wildo config sync`); no runtime environment carries them (#2310). Unlike the\n * other families here these are consumed by a BUILD rather than a running service: a\n * Docusaurus bundle compiles its origins in, so the values must be present when the site is\n * built, and a bundle built with the wrong ones silently points every reader at the wrong\n * host instead of failing.\n *\n * The application's `docusaurus.config.ts` refuses to complete a production build when they\n * are unset, and falls back to local defaults otherwise. Before this contract existed the\n * only way to satisfy that guard was to remember three variables on a build command line,\n * so they appeared in no environment definition anywhere.\n *\n * Emitted individually rather than as one serialized payload (the `providerSelection`\n * shape): each is a single scalar read directly by the config, and a JSON blob would force\n * the docs config to parse a payload to recover three strings.\n */\nexport enum PlatformDocumentationSiteEnvKey {\n WILDO_DOCS_API_BASE_URL = 'WILDO_DOCS_API_BASE_URL',\n WILDO_DOCS_APP_URL = 'WILDO_DOCS_APP_URL',\n WILDO_DOCS_FRONTEND_SERVICE_NAME = 'WILDO_DOCS_FRONTEND_SERVICE_NAME',\n}\n\nexport const PlatformDocumentationSiteEnvKeys = PlatformDocumentationSiteEnvKey;\nexport const PlatformProcessEnvKeys = PlatformProcessEnvKey;\nexport const PlatformServiceUrlEnvKeys = PlatformServiceUrlEnvKey;\nexport const PlatformInfrastructureEnvKeys = PlatformInfrastructureEnvKey;\nexport const PlatformSecurityEnvKeys = PlatformSecurityEnvKey;\nexport const PlatformAdminEnvKeys = PlatformAdminEnvKey;\nexport const PlatformKubernetesEnvKeys = PlatformKubernetesEnvKey;\nexport const PlatformIngressEnvKeys = PlatformIngressEnvKey;\nexport const PlatformLoggingEnvKeys = PlatformLoggingEnvKey;\nexport const PlatformObservabilityEnvKeys = PlatformObservabilityEnvKey;\nexport const PlatformProviderSelectionEnvKeys = PlatformProviderSelectionEnvKey;\nexport const PlatformEmailEnvKeys = PlatformEmailEnvKey;\nexport const PlatformOwnershipDnsEnvKeys = PlatformOwnershipDnsEnvKey;\n\n/**\n * Resolve a required environment variable value or throw a clear,\n * actionable error.\n *\n * This is the canonical fail-closed reader for platform runtime env vars.\n * It exists to replace silent string-fallback patterns like\n * `process.env.X || 'localhost'` / `process.env.Y || 'local'` /\n * `process.env.Z || 'http://localhost:NNNN'` in apps-manager and any\n * other platform service. Those patterns let production processes start\n * silently mis-wired (e.g. talking to `localhost` instead of the real\n * cluster service) and surface as opaque downstream errors much later.\n *\n * Contract:\n * - Empty strings are treated as missing (a `KEY=` line in `.env` is a\n * misconfiguration, not an \"intentional empty value\").\n * - The thrown error names both the env var and the consuming context\n * (e.g. `\"Missing required env var REDIS_HOST (consumer:\n * PlatformInfrastructureManagerService.provisionAllPlatformConfigs)\"`).\n * - This helper does NOT decide whether a key is sensitive — that lives\n * in `PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS`. Callers are responsible\n * for not logging the resolved value when sensitive.\n *\n * Usage:\n * const host = requireEnv(\n * PlatformInfrastructureEnvKey.REDIS_HOST,\n * 'PlatformInfrastructureManagerService.provisionAllPlatformConfigs',\n * );\n *\n * Local-development defaults must live in `secrets.json` /\n * `infrastructure/<env>/secrets/` and be loaded into `process.env` by\n * the CLI / K8s wiring, NOT in production code paths.\n */\nexport function requireEnv(envName: string, consumerContext: string): string {\n const raw = process.env[envName];\n if (raw === undefined || raw === '') {\n throw new Error(\n `Missing required environment variable ${envName} (consumer: ${consumerContext}). ` +\n `Local development defaults belong in secrets.json / infrastructure/<env>/secrets/, ` +\n `not in production code fallbacks.`,\n );\n }\n return raw;\n}\n\nexport const PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS = new Set<string>([\n PlatformInfrastructureEnvKey.MONGO_CONNECT_URL,\n PlatformInfrastructureEnvKey.MONGO_PLATFORM_URL,\n PlatformInfrastructureEnvKey.REDIS_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.RABBITMQ_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.STORAGE_ACCESS_KEY,\n PlatformInfrastructureEnvKey.STORAGE_SECRET_KEY,\n PlatformInfrastructureEnvKey.PG_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.PG_CONNECT_URL,\n PlatformInfrastructureEnvKey.IMMUDB_ADMIN_PASSWORD,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PUBLIC_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_KEY_ENCRYPTION_ROOT,\n PlatformSecurityEnvKey.PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT,\n PlatformSecurityEnvKey.PLATFORM_KEY_VAULT_SIGNER_TOKEN,\n PlatformSecurityEnvKey.PLATFORM_KEY_VAULT_OPERATOR_TOKEN,\n PlatformSecurityEnvKey.PLATFORM_KEY_PKCS11_PIN,\n PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET,\n PlatformSecurityEnvKey.PLATFORM_ADMIN_SECRET,\n PlatformAdminEnvKey.ADMIN_PASSWORD,\n PlatformAdminEnvKey.GITHUB_WILDO_APPS_ADMIN_TOKEN,\n // OTLP auth header carries the provider source token (e.g. a BetterStack Bearer token) →\n // secret (K8s Secret, docker env_file). The sibling OTEL_ENABLED / OTEL_EXPORTER_OTLP_ENDPOINT /\n // OTEL_SERVICE_NAME / OTEL_RESOURCE_ATTRIBUTES are non-secret config and deliberately stay out.\n PlatformObservabilityEnvKey.OTEL_EXPORTER_OTLP_HEADERS,\n]);\n"]}
@@ -1,5 +1,5 @@
1
1
  import { InfraCapability } from '../project-config/shared/infra-providers.schemas';
2
- import { DatabaseEngine } from '../project-config/shared/environment.schemas';
2
+ import { DatabaseEngine, type EnvironmentServiceProfile } from '../project-config/shared/environment.schemas';
3
3
  import { type ApplicationRuntimePrincipal } from './runtime-principal.contracts';
4
4
  /**
5
5
  * WHICH backing services a runtime may reach, derived from what it DECLARED.
@@ -94,7 +94,27 @@ export interface RuntimeApplicationStores {
94
94
  * refuses a resource declaring the other, so no runtime needs a route, topology or credential for a second store.
95
95
  */
96
96
  readonly applicationDatabaseEngine: DatabaseEngine;
97
+ /**
98
+ * Whether the application's environment runs a message broker: `environmentServiceProfileRunsMessageBroker(serviceProfile)`
99
+ * (#2303 slice D). Under a profile whose queue lives in the application's own database there is no broker, so no runtime
100
+ * gets the queuing capability: no broker segment, no `RABBITMQ_*` topology, no broker credential. The database queue
101
+ * itself needs nothing beyond the database capability every runtime already has.
102
+ *
103
+ * REQUIRED, like the engine, so no lane can forget it and keep a route to a broker the environment does not run.
104
+ */
105
+ readonly runsMessageBroker: boolean;
97
106
  }
107
+ /**
108
+ * The {@link RuntimeApplicationStores} of an environment, from its configuration: the application's resolved engine and
109
+ * whether its profile runs a broker. The one way a caller holding the environment's config builds them, so the two facts
110
+ * are never derived differently at two call sites.
111
+ */
112
+ export declare function resolveRuntimeApplicationStores(environment: {
113
+ readonly applicationDatabase?: {
114
+ readonly engine?: DatabaseEngine;
115
+ };
116
+ readonly serviceProfile?: EnvironmentServiceProfile;
117
+ }): RuntimeApplicationStores;
98
118
  /**
99
119
  * Derive a runtime's backing-service access from its principal, its declaration and its application's store.
100
120
  *
@@ -102,7 +122,8 @@ export interface RuntimeApplicationStores {
102
122
  * an absent `resourceAccess` all narrow rather than widen.
103
123
  *
104
124
  * The database capabilities are then narrowed to the application's own store (#3367), for EVERY principal, the backend
105
- * included: that is the only store any of them holds a credential for. The env topology and the network membership of
125
+ * included: that is the only store any of them holds a credential for. The queuing capability is removed the same way
126
+ * when the environment runs no broker (#2303 slice D). The env topology and the network membership of
106
127
  * both deployment lanes read this answer. The apps-manager mint does not call it: it reaches the same store through
107
128
  * `AppInitializationService.derivePersistenceSelection` over the same resolved engine, and
108
129
  * `runtime-network-follows-credentials.test.ts` (apps-manager) holds the two to each other for every principal.
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-backing-service-access.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/runtime-backing-service-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EAAmC,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAElH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IACpD;;;;;;;OAOG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;CAC1C;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;OASG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CAAC;IAC9F,uFAAuF;IACvF,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvD;AAuDD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,yBAAyB,EAAE,cAAc,CAAC;CACpD;AAWD;;;;;;;;;;;GAWG;AACH,wBAAgB,kCAAkC,CAChD,SAAS,EAAE,2BAA2B,GAAG,SAAS,EAClD,WAAW,EAAE,wBAAwB,GAAG,SAAS,EACjD,iBAAiB,EAAE,wBAAwB,GAC1C,2BAA2B,CAgB7B"}
1
+ {"version":3,"file":"runtime-backing-service-access.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/runtime-backing-service-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EACL,cAAc,EAGd,KAAK,yBAAyB,EAC/B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAmC,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAElH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IACpD;;;;;;;OAOG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;CAC1C;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;OASG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CAAC;IAC9F,uFAAuF;IACvF,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvD;AAuDD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,yBAAyB,EAAE,cAAc,CAAC;IACnD;;;;;;;OAOG;IACH,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,WAAW,EAAE;IAC3D,QAAQ,CAAC,mBAAmB,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAA;KAAE,CAAC;IACpE,QAAQ,CAAC,cAAc,CAAC,EAAE,yBAAyB,CAAC;CACrD,GAAG,wBAAwB,CAK3B;AAWD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kCAAkC,CAChD,SAAS,EAAE,2BAA2B,GAAG,SAAS,EAClD,WAAW,EAAE,wBAAwB,GAAG,SAAS,EACjD,iBAAiB,EAAE,wBAAwB,GAC1C,2BAA2B,CAwB7B"}
@@ -1,5 +1,5 @@
1
1
  import { InfraCapability } from '../project-config/shared/infra-providers.schemas.js';
2
- import { DatabaseEngine } from '../project-config/shared/environment.schemas.js';
2
+ import { DatabaseEngine, environmentServiceProfileRunsMessageBroker, resolveApplicationDatabaseEngine, } from '../project-config/shared/environment.schemas.js';
3
3
  import { ApplicationRuntimePrincipalKind } from './runtime-principal.contracts.js';
4
4
  /**
5
5
  * Capabilities every MINION reaches regardless of what it declared.
@@ -52,6 +52,17 @@ const MINION_UNCONDITIONAL_CAPABILITIES = [
52
52
  const MINION_DATA_CAPABILITIES = [
53
53
  InfraCapability.OBJECT_STORAGE,
54
54
  ];
55
+ /**
56
+ * The {@link RuntimeApplicationStores} of an environment, from its configuration: the application's resolved engine and
57
+ * whether its profile runs a broker. The one way a caller holding the environment's config builds them, so the two facts
58
+ * are never derived differently at two call sites.
59
+ */
60
+ export function resolveRuntimeApplicationStores(environment) {
61
+ return {
62
+ applicationDatabaseEngine: resolveApplicationDatabaseEngine(environment.applicationDatabase),
63
+ runsMessageBroker: environmentServiceProfileRunsMessageBroker(environment.serviceProfile),
64
+ };
65
+ }
55
66
  /**
56
67
  * The database capability of each engine. Total, so an engine added to {@link DatabaseEngine} is a compile error here
57
68
  * rather than a store no runtime can reach.
@@ -67,7 +78,8 @@ const DATABASE_CAPABILITY_OF_ENGINE = {
67
78
  * an absent `resourceAccess` all narrow rather than widen.
68
79
  *
69
80
  * The database capabilities are then narrowed to the application's own store (#3367), for EVERY principal, the backend
70
- * included: that is the only store any of them holds a credential for. The env topology and the network membership of
81
+ * included: that is the only store any of them holds a credential for. The queuing capability is removed the same way
82
+ * when the environment runs no broker (#2303 slice D). The env topology and the network membership of
71
83
  * both deployment lanes read this answer. The apps-manager mint does not call it: it reaches the same store through
72
84
  * `AppInitializationService.derivePersistenceSelection` over the same resolved engine, and
73
85
  * `runtime-network-follows-credentials.test.ts` (apps-manager) holds the two to each other for every principal.
@@ -81,9 +93,16 @@ export function resolveRuntimeBackingServiceAccess(principal, declaration, appli
81
93
  throw new Error(`resolveRuntimeBackingServiceAccess needs the application's database engine, got `
82
94
  + `${JSON.stringify(applicationStores?.applicationDatabaseEngine)}. Pass resolveApplicationDatabaseEngine(applicationDatabase).`);
83
95
  }
84
- const otherStores = new Set(Object.values(DATABASE_CAPABILITY_OF_ENGINE).filter((capability) => capability !== applicationStore));
96
+ if (typeof applicationStores.runsMessageBroker !== 'boolean') {
97
+ // Same reasoning as the engine: an untyped caller must not silently keep (or lose) a broker route.
98
+ throw new Error(`resolveRuntimeBackingServiceAccess needs whether the environment runs a message broker, got `
99
+ + `${JSON.stringify(applicationStores.runsMessageBroker)}. Pass environmentServiceProfileRunsMessageBroker(serviceProfile).`);
100
+ }
101
+ const unreachable = new Set(Object.values(DATABASE_CAPABILITY_OF_ENGINE).filter((capability) => capability !== applicationStore));
102
+ if (!applicationStores.runsMessageBroker)
103
+ unreachable.add(InfraCapability.QUEUING_SYSTEM);
85
104
  return {
86
- capabilities: new Set([...declared.capabilities].filter((capability) => !otherStores.has(capability))),
105
+ capabilities: new Set([...declared.capabilities].filter((capability) => !unreachable.has(capability))),
87
106
  requiresInternetEgress: declared.requiresInternetEgress,
88
107
  };
89
108
  }
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-backing-service-access.js","sourceRoot":"","sources":["../../../src/bootstrap/runtime-backing-service-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAoC,MAAM,+BAA+B,CAAC;AA4ElH;;;;;;;;;GASG;AACH,MAAM,iCAAiC,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;YAC9B,EAAE;YACF,sGAAsG;YACtG,gFAAgF;YAChF,kHAAkH;YAClH,kHAAkH;YAClH,sCAAsC;YACtC,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,EAAE,sBAAsB,EAAE,CAAC;QAEhG;YACE,2EAA2E;YAC3E,wEAAwE;YACxE,sEAAsE;YACtE,mCAAmC;YACnC,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,EAAE,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAC;IACtE,CAAC;AACH,CAAC","sourcesContent":["import { InfraCapability } from '../project-config/shared/infra-providers.schemas';\nimport { DatabaseEngine } from '../project-config/shared/environment.schemas';\nimport { ApplicationRuntimePrincipalKind, type ApplicationRuntimePrincipal } from './runtime-principal.contracts';\n\n/**\n * WHICH backing services a runtime may reach, derived from what it DECLARED.\n *\n * ## Why this exists as one function\n *\n * Three enforcement points must agree about a runtime's backing-service access:\n * the CREDENTIALS apps-manager mints for it, the network MEMBERSHIP its container\n * gets, and the connection TOPOLOGY written into its environment. Each is\n * independently sufficient to deny, which is the point — but only while they\n * describe the same set.\n *\n * They are also each capable of silently disagreeing. A runtime kept off a\n * service's network while still receiving that service's connect URL is the worst\n * of the three combinations: `isConfigured()` reports true, a health probe or a\n * first use runs, and an unroutable host fails as a timeout for a runtime that was\n * never supposed to have the service at all. The fix is not a compensating branch\n * in a health check — it is that the two derive from HERE, so a non-declaring\n * runtime is never configured in the first place and there is nothing to\n * distinguish.\n *\n * So this is deliberately NOT a helper each consumer may reimplement \"for its own\n * needs\". Consumers call it; none re-derives. Two of the three enforcement points\n * call it directly: the network membership (both deployment lanes) and the\n * connection topology (the env builders). The third, the apps-manager mint, does\n * not: it reaches the same database store through\n * `AppInitializationService.derivePersistenceSelection` over the same resolved\n * engine, and `runtime-network-follows-credentials.test.ts` (apps-manager) holds\n * membership equal to the minted credentials for every principal (#3367).\n *\n * ## The vocabulary is `InfraCapability`, not a new enum\n *\n * That is already what an infra provider module declares it supplies, so a\n * capability named here and a provider that serves it cannot drift into two\n * spellings of one concept.\n */\nexport interface RuntimeBackingServiceAccess {\n /**\n * Capabilities this runtime may reach. Empty is a legitimate, meaningful answer\n * — see the static website, which is no runtime principal — and must never be read as \"unspecified, allow all\".\n */\n readonly capabilities: ReadonlySet<InfraCapability>;\n /**\n * Whether this runtime needs a route off the host at all.\n *\n * Authored, never inferred: a scraper minion legitimately reaches the public\n * internet, and the point of the flag is not to refuse that but to stop egress\n * being universal and unstated. Default false, so the safe answer is the one you\n * get by not thinking about it.\n */\n readonly requiresInternetEgress: boolean;\n}\n\n/**\n * What a minion declares about its access to the application's data.\n *\n * Structural rather than importing the app-declaration type, so this contract does\n * not acquire the whole configuration graph for two fields.\n */\nexport interface RuntimeAccessDeclaration {\n /**\n * The minion's authored `resourceAccess`, or `undefined` when it declared none.\n *\n * The distinction is load-bearing and mirrors `deriveMinionResourceGrants`:\n * ABSENT means application-data access was never requested, so no business\n * table is granted and no object-storage route is joined. It does NOT mean \"no\n * database\": every minion holds the engine-floor database role and the route to\n * it (#1771, see {@link MINION_UNCONDITIONAL_CAPABILITIES}). An empty but PRESENT\n * declaration is a different statement and is not this.\n */\n readonly resourceAccess?: { read?: readonly string[]; write?: readonly string[] } | undefined;\n /** Authored opt-in; see {@link RuntimeBackingServiceAccess.requiresInternetEgress}. */\n readonly requiresInternetEgress?: boolean | undefined;\n}\n\n/**\n * Capabilities every MINION reaches regardless of what it declared.\n *\n * A minion is tick-driven and single-flighted: it consumes its tick queue and its\n * own RPC reply queue (QUEUING_SYSTEM) and holds a per-principal Redis namespace\n * (CACHE_MANAGER) used for its single-flight lease. Both credentials are minted\n * unconditionally for every minion today, so withholding either network would\n * strand a credential the platform issued — the incoherence this module exists to\n * prevent, arriving from the other direction.\n */\nconst MINION_UNCONDITIONAL_CAPABILITIES: readonly InfraCapability[] = [\n InfraCapability.QUEUING_SYSTEM,\n InfraCapability.CACHE_MANAGER,\n // The DATABASE is unconditional too (#1771), decided by what a minion does at startup rather than by what\n // it declared. `StartMinionApplicationBackendService.initialize` runs the full backend startup, which\n // connects the application's selected store and fails the boot if it cannot; and every minion installs the\n // tick consumer, whose durable coordinator and recovery scanner read and maintain `jobexecutions` and\n // `jobpayloadstorage` and append `auditlogs`. A minion with no route to its database therefore cannot boot.\n //\n // So the credential side mints every minion the engine FLOOR role (`deriveMinionDatabaseGrants` over an\n // empty authored grant: the framework's own tables and no business table), and this side gives it the route\n // to use that role. Least privilege lives in the ROLE, which grants nothing `resourceAccess` did not ask for;\n // withholding the route only produced a credential nobody could use and a minion that could not start.\n //\n // Rejected: \"absent `resourceAccess` means no database at all\" (the reading this file had until #1771, D11/R3).\n // It cannot be honoured without a second minion runtime that skips the application lifecycle, and the mint\n // had already stopped honouring it in 5c8936f86 because the tick consumer needs the floor.\n //\n // Both kinds are listed because an application is backed by one or the other and this layer does not know\n // which here. `resolveRuntimeBackingServiceAccess` then keeps only the application's own store (#3367), the one\n // every database credential is minted on.\n InfraCapability.DOCUMENT_DATABASE,\n InfraCapability.RELATIONAL_DATABASE,\n // Telemetry is unconditional for the same reason the platform segment is: every\n // runtime emits it, it carries no application data, and withholding it breaks\n // observability with NO signal — the collector appears in no readiness check, so\n // the failure surfaces as \"spans stopped\" long after the change that caused it.\n InfraCapability.METRICS_TELEMETRY,\n];\n\n/**\n * Capabilities a minion reaches ONLY when it declared application-data access.\n *\n * Object storage alone: the engine floor is a property of holding a DATABASE role, and the object-storage\n * credential is confined to the declared resources' key prefixes. The route follows the DECLARATION, not the\n * size of that prefix set: an absent declaration gets no route (apps-manager derives no grant, so an empty\n * prefix set), while a present one gets the route even when it names no resource, the absent/empty\n * distinction kept everywhere else (an empty declaration's credential is still confined to no prefix).\n */\nconst MINION_DATA_CAPABILITIES: readonly InfraCapability[] = [\n InfraCapability.OBJECT_STORAGE,\n];\n\n/**\n * The application facts that bound what ANY of its runtimes may reach, whatever the runtime declared.\n *\n * REQUIRED at every call, so a caller cannot forget it and silently keep both database stores.\n */\nexport interface RuntimeApplicationStores {\n /**\n * The application's own database engine, `resolveApplicationDatabaseEngine(applicationDatabase)`.\n *\n * It is the ONE store database credentials are minted on: apps-manager registers an application with\n * `useMongoDB` / `usePostgreSQL` derived from this same resolved engine (`AppInitializationService`), and writes a\n * per-principal role only in that store. A runtime given a route to the OTHER store would hold a route with no\n * credential behind it (#3367), the inverse of #1771.\n *\n * One engine, not a set, by decision: an application uses exactly one transactional store (#3328), and the registry\n * refuses a resource declaring the other, so no runtime needs a route, topology or credential for a second store.\n */\n readonly applicationDatabaseEngine: DatabaseEngine;\n}\n\n/**\n * The database capability of each engine. Total, so an engine added to {@link DatabaseEngine} is a compile error here\n * rather than a store no runtime can reach.\n */\nconst DATABASE_CAPABILITY_OF_ENGINE: Record<DatabaseEngine, InfraCapability> = {\n [DatabaseEngine.MONGODB]: InfraCapability.DOCUMENT_DATABASE,\n [DatabaseEngine.POSTGRESQL]: InfraCapability.RELATIONAL_DATABASE,\n};\n\n/**\n * Derive a runtime's backing-service access from its principal, its declaration and its application's store.\n *\n * Fails CLOSED on every axis: an unknown principal kind, an absent declaration and\n * an absent `resourceAccess` all narrow rather than widen.\n *\n * The database capabilities are then narrowed to the application's own store (#3367), for EVERY principal, the backend\n * included: that is the only store any of them holds a credential for. The env topology and the network membership of\n * both deployment lanes read this answer. The apps-manager mint does not call it: it reaches the same store through\n * `AppInitializationService.derivePersistenceSelection` over the same resolved engine, and\n * `runtime-network-follows-credentials.test.ts` (apps-manager) holds the two to each other for every principal.\n */\nexport function resolveRuntimeBackingServiceAccess(\n principal: ApplicationRuntimePrincipal | undefined,\n declaration: RuntimeAccessDeclaration | undefined,\n applicationStores: RuntimeApplicationStores,\n): RuntimeBackingServiceAccess {\n const declared = resolveDeclaredBackingServiceAccess(principal, declaration);\n const applicationStore = DATABASE_CAPABILITY_OF_ENGINE[applicationStores?.applicationDatabaseEngine];\n if (!applicationStore) {\n // A caller that reached here without the engine (an untyped path, a cast) would otherwise lose BOTH stores\n // silently, or, written the other way, keep both. Neither is a reachability decision; refuse.\n throw new Error(\n `resolveRuntimeBackingServiceAccess needs the application's database engine, got `\n + `${JSON.stringify(applicationStores?.applicationDatabaseEngine)}. Pass resolveApplicationDatabaseEngine(applicationDatabase).`,\n );\n }\n const otherStores = new Set(Object.values(DATABASE_CAPABILITY_OF_ENGINE).filter((capability) => capability !== applicationStore));\n return {\n capabilities: new Set([...declared.capabilities].filter((capability) => !otherStores.has(capability))),\n requiresInternetEgress: declared.requiresInternetEgress,\n };\n}\n\n/** What the principal and its declaration allow, before the application's store bounds it. */\nfunction resolveDeclaredBackingServiceAccess(\n principal: ApplicationRuntimePrincipal | undefined,\n declaration: RuntimeAccessDeclaration | undefined,\n): RuntimeBackingServiceAccess {\n const requiresInternetEgress = declaration?.requiresInternetEgress === true;\n\n switch (principal?.kind) {\n case ApplicationRuntimePrincipalKind.APPLICATION_BACKEND:\n // The general runtime: it serves every request the application exposes, so\n // its access is the full vocabulary, bounded by the application's store in\n // `resolveRuntimeBackingServiceAccess` and by what the environment provisions\n // at each consumer.\n return {\n capabilities: new Set(Object.values(InfraCapability)),\n requiresInternetEgress,\n };\n\n case ApplicationRuntimePrincipalKind.MINION: {\n const capabilities = new Set(MINION_UNCONDITIONAL_CAPABILITIES);\n // ABSENT resourceAccess ⇒ the database route (unconditional, for the floor role every minion is minted)\n // and no object-storage route. The same gate as the credential side: the mint grants the floor to every\n // minion and business tables and storage prefixes only from a declaration (#1771).\n if (declaration?.resourceAccess) {\n for (const capability of MINION_DATA_CAPABILITIES) capabilities.add(capability);\n }\n return { capabilities, requiresInternetEgress };\n }\n\n case ApplicationRuntimePrincipalKind.WORKER:\n // TELEMETRY ONLY, and both halves are measured rather than guessed (#3368).\n //\n // No backing service: a worker never boots the application lifecycle — it is standalone by design, which is\n // why it has no member in `ApplicationRuntimeProfile` at all — and D22/KD-3 mints it no credential (the\n // apps-manager mint loop skips it). Its environment (`buildApplicationWorkerEnv`) carries no database, cache,\n // broker or storage topology.\n //\n // Telemetry: it DOES emit, like every runtime. `buildApplicationWorkerEnv` emits the `OTEL_*` posture\n // (\"workers emit OTEL_* like backends\", audit A-2) and a Node worker runs under\n // `--import @wildo-ai/saas-backend-lib/otel-preload`. Withholding the collector segment dropped its spans with no\n // readiness signal, the failure `MINION_UNCONDITIONAL_CAPABILITIES` records for minions. The collector carries no\n // application data and no credential.\n return { capabilities: new Set([InfraCapability.METRICS_TELEMETRY]), requiresInternetEgress };\n\n default:\n // An unrecognised or absent principal gets NOTHING. Every caller uses this\n // to decide how narrowly a runtime is confined, so a permissive default\n // would widen confinement silently — the one direction that cannot be\n // detected by anything downstream.\n return { capabilities: new Set(), requiresInternetEgress: false };\n }\n}\n"]}
1
+ {"version":3,"file":"runtime-backing-service-access.js","sourceRoot":"","sources":["../../../src/bootstrap/runtime-backing-service-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EACL,cAAc,EACd,0CAA0C,EAC1C,gCAAgC,GAEjC,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,+BAA+B,EAAoC,MAAM,+BAA+B,CAAC;AA4ElH;;;;;;;;;GASG;AACH,MAAM,iCAAiC,GAA+B;IACpE,eAAe,CAAC,cAAc;IAC9B,eAAe,CAAC,aAAa;IAC7B,0GAA0G;IAC1G,sGAAsG;IACtG,2GAA2G;IAC3G,sGAAsG;IACtG,4GAA4G;IAC5G,EAAE;IACF,wGAAwG;IACxG,4GAA4G;IAC5G,8GAA8G;IAC9G,uGAAuG;IACvG,EAAE;IACF,gHAAgH;IAChH,2GAA2G;IAC3G,2FAA2F;IAC3F,EAAE;IACF,0GAA0G;IAC1G,gHAAgH;IAChH,0CAA0C;IAC1C,eAAe,CAAC,iBAAiB;IACjC,eAAe,CAAC,mBAAmB;IACnC,gFAAgF;IAChF,8EAA8E;IAC9E,iFAAiF;IACjF,gFAAgF;IAChF,eAA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AAM;YACzC,4EAA4E;YAC5E,EAAE;YACF,4GAA4G;YAC5G,wGAAwG;YACxG,8GAA8G;YAC9G,8BAA8B;YAC9B,EAAE;YACF,sGAAsG;YACtG,gFAAgF;YAChF,kHAAkH;YAClH,kHAAkH;YAClH,sCAAsC;YACtC,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,EAAE,sBAAsB,EAAE,CAAC;QAEhG;YACE,2EAA2E;YAC3E,wEAAwE;YACxE,sEAAsE;YACtE,mCAAmC;YACnC,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,EAAE,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAC;IACtE,CAAC;AACH,CAAC","sourcesContent":["import { InfraCapability } from '../project-config/shared/infra-providers.schemas';\nimport {\n DatabaseEngine,\n environmentServiceProfileRunsMessageBroker,\n resolveApplicationDatabaseEngine,\n type EnvironmentServiceProfile,\n} from '../project-config/shared/environment.schemas';\nimport { ApplicationRuntimePrincipalKind, type ApplicationRuntimePrincipal } from './runtime-principal.contracts';\n\n/**\n * WHICH backing services a runtime may reach, derived from what it DECLARED.\n *\n * ## Why this exists as one function\n *\n * Three enforcement points must agree about a runtime's backing-service access:\n * the CREDENTIALS apps-manager mints for it, the network MEMBERSHIP its container\n * gets, and the connection TOPOLOGY written into its environment. Each is\n * independently sufficient to deny, which is the point — but only while they\n * describe the same set.\n *\n * They are also each capable of silently disagreeing. A runtime kept off a\n * service's network while still receiving that service's connect URL is the worst\n * of the three combinations: `isConfigured()` reports true, a health probe or a\n * first use runs, and an unroutable host fails as a timeout for a runtime that was\n * never supposed to have the service at all. The fix is not a compensating branch\n * in a health check — it is that the two derive from HERE, so a non-declaring\n * runtime is never configured in the first place and there is nothing to\n * distinguish.\n *\n * So this is deliberately NOT a helper each consumer may reimplement \"for its own\n * needs\". Consumers call it; none re-derives. Two of the three enforcement points\n * call it directly: the network membership (both deployment lanes) and the\n * connection topology (the env builders). The third, the apps-manager mint, does\n * not: it reaches the same database store through\n * `AppInitializationService.derivePersistenceSelection` over the same resolved\n * engine, and `runtime-network-follows-credentials.test.ts` (apps-manager) holds\n * membership equal to the minted credentials for every principal (#3367).\n *\n * ## The vocabulary is `InfraCapability`, not a new enum\n *\n * That is already what an infra provider module declares it supplies, so a\n * capability named here and a provider that serves it cannot drift into two\n * spellings of one concept.\n */\nexport interface RuntimeBackingServiceAccess {\n /**\n * Capabilities this runtime may reach. Empty is a legitimate, meaningful answer\n * — see the static website, which is no runtime principal — and must never be read as \"unspecified, allow all\".\n */\n readonly capabilities: ReadonlySet<InfraCapability>;\n /**\n * Whether this runtime needs a route off the host at all.\n *\n * Authored, never inferred: a scraper minion legitimately reaches the public\n * internet, and the point of the flag is not to refuse that but to stop egress\n * being universal and unstated. Default false, so the safe answer is the one you\n * get by not thinking about it.\n */\n readonly requiresInternetEgress: boolean;\n}\n\n/**\n * What a minion declares about its access to the application's data.\n *\n * Structural rather than importing the app-declaration type, so this contract does\n * not acquire the whole configuration graph for two fields.\n */\nexport interface RuntimeAccessDeclaration {\n /**\n * The minion's authored `resourceAccess`, or `undefined` when it declared none.\n *\n * The distinction is load-bearing and mirrors `deriveMinionResourceGrants`:\n * ABSENT means application-data access was never requested, so no business\n * table is granted and no object-storage route is joined. It does NOT mean \"no\n * database\": every minion holds the engine-floor database role and the route to\n * it (#1771, see {@link MINION_UNCONDITIONAL_CAPABILITIES}). An empty but PRESENT\n * declaration is a different statement and is not this.\n */\n readonly resourceAccess?: { read?: readonly string[]; write?: readonly string[] } | undefined;\n /** Authored opt-in; see {@link RuntimeBackingServiceAccess.requiresInternetEgress}. */\n readonly requiresInternetEgress?: boolean | undefined;\n}\n\n/**\n * Capabilities every MINION reaches regardless of what it declared.\n *\n * A minion is tick-driven and single-flighted: it consumes its tick queue and its\n * own RPC reply queue (QUEUING_SYSTEM) and holds a per-principal Redis namespace\n * (CACHE_MANAGER) used for its single-flight lease. Both credentials are minted\n * unconditionally for every minion today, so withholding either network would\n * strand a credential the platform issued — the incoherence this module exists to\n * prevent, arriving from the other direction.\n */\nconst MINION_UNCONDITIONAL_CAPABILITIES: readonly InfraCapability[] = [\n InfraCapability.QUEUING_SYSTEM,\n InfraCapability.CACHE_MANAGER,\n // The DATABASE is unconditional too (#1771), decided by what a minion does at startup rather than by what\n // it declared. `StartMinionApplicationBackendService.initialize` runs the full backend startup, which\n // connects the application's selected store and fails the boot if it cannot; and every minion installs the\n // tick consumer, whose durable coordinator and recovery scanner read and maintain `jobexecutions` and\n // `jobpayloadstorage` and append `auditlogs`. A minion with no route to its database therefore cannot boot.\n //\n // So the credential side mints every minion the engine FLOOR role (`deriveMinionDatabaseGrants` over an\n // empty authored grant: the framework's own tables and no business table), and this side gives it the route\n // to use that role. Least privilege lives in the ROLE, which grants nothing `resourceAccess` did not ask for;\n // withholding the route only produced a credential nobody could use and a minion that could not start.\n //\n // Rejected: \"absent `resourceAccess` means no database at all\" (the reading this file had until #1771, D11/R3).\n // It cannot be honoured without a second minion runtime that skips the application lifecycle, and the mint\n // had already stopped honouring it in 5c8936f86 because the tick consumer needs the floor.\n //\n // Both kinds are listed because an application is backed by one or the other and this layer does not know\n // which here. `resolveRuntimeBackingServiceAccess` then keeps only the application's own store (#3367), the one\n // every database credential is minted on.\n InfraCapability.DOCUMENT_DATABASE,\n InfraCapability.RELATIONAL_DATABASE,\n // Telemetry is unconditional for the same reason the platform segment is: every\n // runtime emits it, it carries no application data, and withholding it breaks\n // observability with NO signal — the collector appears in no readiness check, so\n // the failure surfaces as \"spans stopped\" long after the change that caused it.\n InfraCapability.METRICS_TELEMETRY,\n];\n\n/**\n * Capabilities a minion reaches ONLY when it declared application-data access.\n *\n * Object storage alone: the engine floor is a property of holding a DATABASE role, and the object-storage\n * credential is confined to the declared resources' key prefixes. The route follows the DECLARATION, not the\n * size of that prefix set: an absent declaration gets no route (apps-manager derives no grant, so an empty\n * prefix set), while a present one gets the route even when it names no resource, the absent/empty\n * distinction kept everywhere else (an empty declaration's credential is still confined to no prefix).\n */\nconst MINION_DATA_CAPABILITIES: readonly InfraCapability[] = [\n InfraCapability.OBJECT_STORAGE,\n];\n\n/**\n * The application facts that bound what ANY of its runtimes may reach, whatever the runtime declared.\n *\n * REQUIRED at every call, so a caller cannot forget it and silently keep both database stores.\n */\nexport interface RuntimeApplicationStores {\n /**\n * The application's own database engine, `resolveApplicationDatabaseEngine(applicationDatabase)`.\n *\n * It is the ONE store database credentials are minted on: apps-manager registers an application with\n * `useMongoDB` / `usePostgreSQL` derived from this same resolved engine (`AppInitializationService`), and writes a\n * per-principal role only in that store. A runtime given a route to the OTHER store would hold a route with no\n * credential behind it (#3367), the inverse of #1771.\n *\n * One engine, not a set, by decision: an application uses exactly one transactional store (#3328), and the registry\n * refuses a resource declaring the other, so no runtime needs a route, topology or credential for a second store.\n */\n readonly applicationDatabaseEngine: DatabaseEngine;\n /**\n * Whether the application's environment runs a message broker: `environmentServiceProfileRunsMessageBroker(serviceProfile)`\n * (#2303 slice D). Under a profile whose queue lives in the application's own database there is no broker, so no runtime\n * gets the queuing capability: no broker segment, no `RABBITMQ_*` topology, no broker credential. The database queue\n * itself needs nothing beyond the database capability every runtime already has.\n *\n * REQUIRED, like the engine, so no lane can forget it and keep a route to a broker the environment does not run.\n */\n readonly runsMessageBroker: boolean;\n}\n\n/**\n * The {@link RuntimeApplicationStores} of an environment, from its configuration: the application's resolved engine and\n * whether its profile runs a broker. The one way a caller holding the environment's config builds them, so the two facts\n * are never derived differently at two call sites.\n */\nexport function resolveRuntimeApplicationStores(environment: {\n readonly applicationDatabase?: { readonly engine?: DatabaseEngine };\n readonly serviceProfile?: EnvironmentServiceProfile;\n}): RuntimeApplicationStores {\n return {\n applicationDatabaseEngine: resolveApplicationDatabaseEngine(environment.applicationDatabase),\n runsMessageBroker: environmentServiceProfileRunsMessageBroker(environment.serviceProfile),\n };\n}\n\n/**\n * The database capability of each engine. Total, so an engine added to {@link DatabaseEngine} is a compile error here\n * rather than a store no runtime can reach.\n */\nconst DATABASE_CAPABILITY_OF_ENGINE: Record<DatabaseEngine, InfraCapability> = {\n [DatabaseEngine.MONGODB]: InfraCapability.DOCUMENT_DATABASE,\n [DatabaseEngine.POSTGRESQL]: InfraCapability.RELATIONAL_DATABASE,\n};\n\n/**\n * Derive a runtime's backing-service access from its principal, its declaration and its application's store.\n *\n * Fails CLOSED on every axis: an unknown principal kind, an absent declaration and\n * an absent `resourceAccess` all narrow rather than widen.\n *\n * The database capabilities are then narrowed to the application's own store (#3367), for EVERY principal, the backend\n * included: that is the only store any of them holds a credential for. The queuing capability is removed the same way\n * when the environment runs no broker (#2303 slice D). The env topology and the network membership of\n * both deployment lanes read this answer. The apps-manager mint does not call it: it reaches the same store through\n * `AppInitializationService.derivePersistenceSelection` over the same resolved engine, and\n * `runtime-network-follows-credentials.test.ts` (apps-manager) holds the two to each other for every principal.\n */\nexport function resolveRuntimeBackingServiceAccess(\n principal: ApplicationRuntimePrincipal | undefined,\n declaration: RuntimeAccessDeclaration | undefined,\n applicationStores: RuntimeApplicationStores,\n): RuntimeBackingServiceAccess {\n const declared = resolveDeclaredBackingServiceAccess(principal, declaration);\n const applicationStore = DATABASE_CAPABILITY_OF_ENGINE[applicationStores?.applicationDatabaseEngine];\n if (!applicationStore) {\n // A caller that reached here without the engine (an untyped path, a cast) would otherwise lose BOTH stores\n // silently, or, written the other way, keep both. Neither is a reachability decision; refuse.\n throw new Error(\n `resolveRuntimeBackingServiceAccess needs the application's database engine, got `\n + `${JSON.stringify(applicationStores?.applicationDatabaseEngine)}. Pass resolveApplicationDatabaseEngine(applicationDatabase).`,\n );\n }\n if (typeof applicationStores.runsMessageBroker !== 'boolean') {\n // Same reasoning as the engine: an untyped caller must not silently keep (or lose) a broker route.\n throw new Error(\n `resolveRuntimeBackingServiceAccess needs whether the environment runs a message broker, got `\n + `${JSON.stringify(applicationStores.runsMessageBroker)}. Pass environmentServiceProfileRunsMessageBroker(serviceProfile).`,\n );\n }\n const unreachable = new Set(Object.values(DATABASE_CAPABILITY_OF_ENGINE).filter((capability) => capability !== applicationStore));\n if (!applicationStores.runsMessageBroker) unreachable.add(InfraCapability.QUEUING_SYSTEM);\n return {\n capabilities: new Set([...declared.capabilities].filter((capability) => !unreachable.has(capability))),\n requiresInternetEgress: declared.requiresInternetEgress,\n };\n}\n\n/** What the principal and its declaration allow, before the application's store bounds it. */\nfunction resolveDeclaredBackingServiceAccess(\n principal: ApplicationRuntimePrincipal | undefined,\n declaration: RuntimeAccessDeclaration | undefined,\n): RuntimeBackingServiceAccess {\n const requiresInternetEgress = declaration?.requiresInternetEgress === true;\n\n switch (principal?.kind) {\n case ApplicationRuntimePrincipalKind.APPLICATION_BACKEND:\n // The general runtime: it serves every request the application exposes, so\n // its access is the full vocabulary, bounded by the application's store in\n // `resolveRuntimeBackingServiceAccess` and by what the environment provisions\n // at each consumer.\n return {\n capabilities: new Set(Object.values(InfraCapability)),\n requiresInternetEgress,\n };\n\n case ApplicationRuntimePrincipalKind.MINION: {\n const capabilities = new Set(MINION_UNCONDITIONAL_CAPABILITIES);\n // ABSENT resourceAccess ⇒ the database route (unconditional, for the floor role every minion is minted)\n // and no object-storage route. The same gate as the credential side: the mint grants the floor to every\n // minion and business tables and storage prefixes only from a declaration (#1771).\n if (declaration?.resourceAccess) {\n for (const capability of MINION_DATA_CAPABILITIES) capabilities.add(capability);\n }\n return { capabilities, requiresInternetEgress };\n }\n\n case ApplicationRuntimePrincipalKind.WORKER:\n // TELEMETRY ONLY, and both halves are measured rather than guessed (#3368).\n //\n // No backing service: a worker never boots the application lifecycle — it is standalone by design, which is\n // why it has no member in `ApplicationRuntimeProfile` at all — and D22/KD-3 mints it no credential (the\n // apps-manager mint loop skips it). Its environment (`buildApplicationWorkerEnv`) carries no database, cache,\n // broker or storage topology.\n //\n // Telemetry: it DOES emit, like every runtime. `buildApplicationWorkerEnv` emits the `OTEL_*` posture\n // (\"workers emit OTEL_* like backends\", audit A-2) and a Node worker runs under\n // `--import @wildo-ai/saas-backend-lib/otel-preload`. Withholding the collector segment dropped its spans with no\n // readiness signal, the failure `MINION_UNCONDITIONAL_CAPABILITIES` records for minions. The collector carries no\n // application data and no credential.\n return { capabilities: new Set([InfraCapability.METRICS_TELEMETRY]), requiresInternetEgress };\n\n default:\n // An unrecognised or absent principal gets NOTHING. Every caller uses this\n // to decide how narrowly a runtime is confined, so a permissive default\n // would widen confinement silently — the one direction that cannot be\n // detected by anything downstream.\n return { capabilities: new Set(), requiresInternetEgress: false };\n }\n}\n"]}
@@ -9,6 +9,7 @@ export * from './schemas/framework-secrets.schemas';
9
9
  export * from './release/framework-release.constants';
10
10
  export * from './bootstrap/bootstrap.schemas';
11
11
  export * from './bootstrap/bootstrap.contracts';
12
+ export * from './bootstrap/application-scheduled-jobs.contracts';
12
13
  export * from './bootstrap/bootstrap-planner';
13
14
  export * from './bootstrap/application-backend-env.contracts';
14
15
  export * from './bootstrap/wildo-owner-organization.contracts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4CAA4C,CAAC;AAE3D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,6DAA6D,CAAC;AAC5E,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,yDAAyD,CA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js CHANGED
@@ -9,6 +9,7 @@ export * from './schemas/framework-secrets.schemas.js';
9
9
  export * from './release/framework-release.constants.js';
10
10
  export * from './bootstrap/bootstrap.schemas.js';
11
11
  export * from './bootstrap/bootstrap.contracts.js';
12
+ export * from './bootstrap/application-scheduled-jobs.contracts.js';
12
13
  export * from './bootstrap/bootstrap-planner.js';
13
14
  export * from './bootstrap/application-backend-env.contracts.js';
14
15
  export * from './bootstrap/wildo-owner-organization.contracts.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4CAA4C,CAAC;AAE3D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,6DAA6D,CAAC;AAC5E,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,yDAAyD,CAAC;AACxE,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,6DAA6D,CAAC;AAC5E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qDAAqD,CAAC;AACpE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,uDAAuD,CAAC;AACtE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yCAAyC,CAAC;AACxD,cAAc,YAAY,CAAC;AAC3B,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC","sourcesContent":["export * from './project-config';\nexport * from './workspace-scope';\nexport * from './credentials/credential-generator.service';\n\nexport * from './schemas/platform-application-config.schemas';\nexport * from './schemas/platform-application-secrets.schemas';\nexport * from './schemas/platform-config.schemas';\nexport * from './schemas/framework-info.schemas';\nexport * from './schemas/framework-secrets.schemas';\nexport * from './release/framework-release.constants';\nexport * from './bootstrap/bootstrap.schemas';\nexport * from './bootstrap/bootstrap.contracts';\nexport * from './bootstrap/bootstrap-planner';\nexport * from './bootstrap/application-backend-env.contracts';\nexport * from './bootstrap/wildo-owner-organization.contracts';\nexport * from './bootstrap/application-creation-verification-env.contracts';\nexport * from './bootstrap/platform-runtime-env.contracts';\nexport * from './bootstrap/runtime-secret-env.contracts';\nexport * from './bootstrap/runtime-topology.contracts';\nexport * from './bootstrap/runtime-principal.contracts';\nexport * from './bootstrap/postgresql-owed-grants.contracts';\nexport * from './bootstrap/minion-database-queue-confinement.contracts';\nexport * from './bootstrap/runtime-response-integrity';\nexport * from './key-management/es256-jws';\nexport * from './key-management/data-key.contracts';\nexport * from './key-management/key-provider.spi';\nexport * from './key-management/application-signing-key-rotation.contracts';\nexport * from './key-management/application-legacy-envelope-key.contracts';\nexport * from './key-management/keyring-rotation.contracts';\nexport * from './key-management/keyring-status.contracts';\nexport * from './key-management/signature-request.contracts';\nexport * from './key-management/approval-seal.contracts';\nexport * from './key-management/approval-seal-verifier';\nexport * from './key-management/approval-seal-manifested-copy';\nexport * from './key-management/signing-log-export.contracts';\nexport * from './key-management/vault-custody.contracts';\nexport * from './bootstrap/runtime-backing-service-access';\nexport * from './bootstrap/platform-store-preconnect';\nexport * from './bootstrap/runtime-network-topology';\nexport * from './bootstrap/runtime-network-policy';\nexport * from './bootstrap/runtime-platform-access';\nexport * from './project-config/minion-local-provider-registration';\nexport * from './project-config/shared/minion-resource-access.validation';\nexport * from './project-config/shared/object-storage-session-policy';\nexport * from './lockfile/wildo-saas-lock.shared.schemas';\nexport * from './lockfile/lockfile-io';\nexport * from './lockfile/file-lock-hold';\nexport * from './lockfile/build-parallelism';\nexport * from './lockfile/materialize-infra-section';\nexport * from './lockfile/canonical-json';\nexport * from './canonical-json/rfc8785-canonical-json';\nexport * from './registry';\nexport * from './pnpm-settings/application-pnpm-settings';\nexport * from './blueprint/blueprint.schemas';\nexport * from './blueprint/anchored-region';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4CAA4C,CAAC;AAE3D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kDAAkD,CAAC;AACjE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,6DAA6D,CAAC;AAC5E,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,yDAAyD,CAAC;AACxE,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,6DAA6D,CAAC;AAC5E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qDAAqD,CAAC;AACpE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,uDAAuD,CAAC;AACtE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yCAAyC,CAAC;AACxD,cAAc,YAAY,CAAC;AAC3B,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC","sourcesContent":["export * from './project-config';\nexport * from './workspace-scope';\nexport * from './credentials/credential-generator.service';\n\nexport * from './schemas/platform-application-config.schemas';\nexport * from './schemas/platform-application-secrets.schemas';\nexport * from './schemas/platform-config.schemas';\nexport * from './schemas/framework-info.schemas';\nexport * from './schemas/framework-secrets.schemas';\nexport * from './release/framework-release.constants';\nexport * from './bootstrap/bootstrap.schemas';\nexport * from './bootstrap/bootstrap.contracts';\nexport * from './bootstrap/application-scheduled-jobs.contracts';\nexport * from './bootstrap/bootstrap-planner';\nexport * from './bootstrap/application-backend-env.contracts';\nexport * from './bootstrap/wildo-owner-organization.contracts';\nexport * from './bootstrap/application-creation-verification-env.contracts';\nexport * from './bootstrap/platform-runtime-env.contracts';\nexport * from './bootstrap/runtime-secret-env.contracts';\nexport * from './bootstrap/runtime-topology.contracts';\nexport * from './bootstrap/runtime-principal.contracts';\nexport * from './bootstrap/postgresql-owed-grants.contracts';\nexport * from './bootstrap/minion-database-queue-confinement.contracts';\nexport * from './bootstrap/runtime-response-integrity';\nexport * from './key-management/es256-jws';\nexport * from './key-management/data-key.contracts';\nexport * from './key-management/key-provider.spi';\nexport * from './key-management/application-signing-key-rotation.contracts';\nexport * from './key-management/application-legacy-envelope-key.contracts';\nexport * from './key-management/keyring-rotation.contracts';\nexport * from './key-management/keyring-status.contracts';\nexport * from './key-management/signature-request.contracts';\nexport * from './key-management/approval-seal.contracts';\nexport * from './key-management/approval-seal-verifier';\nexport * from './key-management/approval-seal-manifested-copy';\nexport * from './key-management/signing-log-export.contracts';\nexport * from './key-management/vault-custody.contracts';\nexport * from './bootstrap/runtime-backing-service-access';\nexport * from './bootstrap/platform-store-preconnect';\nexport * from './bootstrap/runtime-network-topology';\nexport * from './bootstrap/runtime-network-policy';\nexport * from './bootstrap/runtime-platform-access';\nexport * from './project-config/minion-local-provider-registration';\nexport * from './project-config/shared/minion-resource-access.validation';\nexport * from './project-config/shared/object-storage-session-policy';\nexport * from './lockfile/wildo-saas-lock.shared.schemas';\nexport * from './lockfile/lockfile-io';\nexport * from './lockfile/file-lock-hold';\nexport * from './lockfile/build-parallelism';\nexport * from './lockfile/materialize-infra-section';\nexport * from './lockfile/canonical-json';\nexport * from './canonical-json/rfc8785-canonical-json';\nexport * from './registry';\nexport * from './pnpm-settings/application-pnpm-settings';\nexport * from './blueprint/blueprint.schemas';\nexport * from './blueprint/anchored-region';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"define-infra-env-config.d.ts","sourceRoot":"","sources":["../../../src/project-config/define-infra-env-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC9H,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAsB,oBAAoB,EAAkC,MAAM,mCAAmC,CAAC;AAS7H,OAAO,EACL,cAAc,EAGd,sBAAsB,EAItB,iBAAiB,EACjB,qBAAqB,EAGrB,yBAAyB,EAWzB,qBAAqB,EAEtB,MAAM,8BAA8B,CAAC;AA6DtC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,2BAA2B;;;;kBAItC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEjF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oCAAoC;;kBAI/C,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAEnG;;;;;;;GAOG;AACH,QAAA,MAAM,4BAA4B;;;;;IAShC;;;;;;;;;;;OAWG;;IAEH;;;;;;;;;;;;;;;;;OAiBG;;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;;;;;;IAcH,6IAA6I;IAC7I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;;;;IAMH;;;;;;;;;;;;;;;;;;OAkBG;IACH,kEAAkE;IAClE;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;;;;;;;;;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
9
  import { WildoPlatformKeyManagementConfigSchema } from './shared/platform-key-management.schemas.js';
10
10
  import { EnvCspOverrideSchema } from './shared/csp.schemas.js';
11
11
  import { InfraServiceAddressingSchema, } from './shared/infra-service.schemas.js';
12
- import { DatabaseEngine, resolveApplicationDatabaseEngine, WildoDeploymentConfigSchema, WildoDeploymentRuntime, WildoEnvironment, WildoEnvironmentIdSchema, WildoKubernetesConfigSchema, WildoLocationType, WildoLocalDataStorage, resolveDefaultLocalDataStorage, DEFAULT_ENVIRONMENT_SERVICE_PROFILE, EnvironmentServiceProfile, EnvironmentServiceProfileOptionalService, describeServiceOmittedByEnvironmentServiceProfile, environmentServiceProfileOmits, environmentServiceProfileRunsOneDatabaseFamily, WildoLoggingConfigSchema, WildoObservabilityConfigSchema, WildoDocumentationSiteConfigSchema, WildoEnvironmentProviderConfigurationsSchema, WildoProviderSelectionOverridesSchema, WildoRemoteProviderSchema, WildoImageTagStrategy, isLocalEnvironmentId, } from './shared/environment.schemas.js';
12
+ import { DatabaseEngine, resolveApplicationDatabaseEngine, WildoDeploymentConfigSchema, WildoDeploymentRuntime, WildoEnvironment, WildoEnvironmentIdSchema, WildoKubernetesConfigSchema, WildoLocationType, WildoLocalDataStorage, resolveDefaultLocalDataStorage, DEFAULT_ENVIRONMENT_SERVICE_PROFILE, EnvironmentServiceProfile, EnvironmentServiceProfileOptionalService, describeServiceOmittedByEnvironmentServiceProfile, environmentServiceProfileOmits, environmentServiceProfileRunsMessageBroker, environmentServiceProfileRunsOneDatabaseFamily, WildoLoggingConfigSchema, WildoObservabilityConfigSchema, WildoDocumentationSiteConfigSchema, WildoEnvironmentProviderConfigurationsSchema, WildoProviderSelectionOverridesSchema, WildoRemoteProviderSchema, WildoImageTagStrategy, isLocalEnvironmentId, } from './shared/environment.schemas.js';
13
13
  const InfraEnvKubernetesSchema = WildoKubernetesConfigSchema.strict();
14
14
  /**
15
15
  * A POSIX (`/…`), drive-letter (`C:\…`, `C:/…`) or UNC (`\\host\…`) absolute path.
@@ -789,6 +789,17 @@ const WildoInfraEnvConfigInputSchema = z.object(WILDO_INFRA_ENV_CONFIG_SHAPE).st
789
789
  + `and declare only that store in \`backingServices\`, or set serviceProfile to '${EnvironmentServiceProfile.FULL}'.`,
790
790
  });
791
791
  }
792
+ // #2303 slice D — a profile whose queue lives in the application's database runs no broker, so ANY RabbitMQ
793
+ // declaration contradicts it: `SELF` asks the environment to run one, and a `MANAGED` broker would be one nothing uses.
794
+ if (config.backingServices[BackingServiceKind.RABBITMQ] !== undefined && !environmentServiceProfileRunsMessageBroker(config.serviceProfile)) {
795
+ ctx.addIssue({
796
+ code: 'custom',
797
+ path: ['backingServices', BackingServiceKind.RABBITMQ],
798
+ message: `serviceProfile '${config.serviceProfile}' runs the application's background work on its own database and runs `
799
+ + `no message broker, and \`backingServices.${BackingServiceKind.RABBITMQ}\` declares one. Remove the declaration, `
800
+ + `or set serviceProfile to '${EnvironmentServiceProfile.FULL}'.`,
801
+ });
802
+ }
792
803
  for (const [kind, service] of [
793
804
  [BackingServiceKind.CLAMAV, EnvironmentServiceProfileOptionalService.ANTIVIRUS_SCANNER],
794
805
  [BackingServiceKind.IMMUDB, EnvironmentServiceProfileOptionalService.IMMUTABLE_AUDIT_STORE],