@wildo-ai/platform-config-lib 1.1.3 → 1.1.5

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 (113) hide show
  1. package/dist/esm/bootstrap/bootstrap.contracts.d.ts +23 -1
  2. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  3. package/dist/esm/bootstrap/bootstrap.contracts.js +24 -0
  4. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  5. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +150 -1
  6. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  7. package/dist/esm/bootstrap/bootstrap.schemas.js +124 -4
  8. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  9. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +16 -0
  10. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  11. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +28 -0
  12. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  13. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts +29 -0
  14. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
  15. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js +39 -0
  16. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
  17. package/dist/esm/index.d.ts +1 -0
  18. package/dist/esm/index.d.ts.map +1 -1
  19. package/dist/esm/index.js +1 -0
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/lockfile/build-parallelism.d.ts +40 -0
  22. package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -0
  23. package/dist/esm/lockfile/build-parallelism.js +64 -0
  24. package/dist/esm/lockfile/build-parallelism.js.map +1 -0
  25. package/dist/esm/lockfile/materialize-infra-section.d.ts +1 -1
  26. package/dist/esm/lockfile/materialize-infra-section.js +1 -1
  27. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  28. package/dist/esm/project-config/define-infra-env-config.d.ts +899 -15
  29. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  30. package/dist/esm/project-config/define-infra-env-config.js +397 -16
  31. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  32. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  33. package/dist/esm/project-config/define-minion-config.js +1 -2
  34. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  35. package/dist/esm/project-config/define-saas-config.d.ts +90 -25
  36. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  37. package/dist/esm/project-config/define-saas-config.js +165 -12
  38. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  39. package/dist/esm/project-config/hosted-infra-env-config.d.ts +59 -0
  40. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -0
  41. package/dist/esm/project-config/hosted-infra-env-config.js +187 -0
  42. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -0
  43. package/dist/esm/project-config/index.d.ts +3 -0
  44. package/dist/esm/project-config/index.d.ts.map +1 -1
  45. package/dist/esm/project-config/index.js +3 -0
  46. package/dist/esm/project-config/index.js.map +1 -1
  47. package/dist/esm/project-config/loader.d.ts +24 -0
  48. package/dist/esm/project-config/loader.d.ts.map +1 -1
  49. package/dist/esm/project-config/loader.js +114 -1
  50. package/dist/esm/project-config/loader.js.map +1 -1
  51. package/dist/esm/project-config/provider-companion-discovery.d.ts +46 -0
  52. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  53. package/dist/esm/project-config/provider-companion-discovery.js +155 -13
  54. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  55. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +72 -23
  56. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  57. package/dist/esm/project-config/provider-runtime-artifacts.js +190 -17
  58. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  59. package/dist/esm/project-config/shared/auth.schemas.d.ts +14 -35
  60. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
  61. package/dist/esm/project-config/shared/auth.schemas.js +14 -35
  62. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
  63. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +37 -7
  64. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  65. package/dist/esm/project-config/shared/backing-services.schemas.js +37 -7
  66. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  67. package/dist/esm/project-config/shared/csp.schemas.d.ts +11 -12
  68. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  69. package/dist/esm/project-config/shared/csp.schemas.js +11 -12
  70. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  71. package/dist/esm/project-config/shared/environment.schemas.d.ts +152 -12
  72. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  73. package/dist/esm/project-config/shared/environment.schemas.js +186 -9
  74. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  75. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +13 -3
  76. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  77. package/dist/esm/project-config/shared/infra-providers.schemas.js +0 -3
  78. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  79. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +140 -34
  80. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
  81. package/dist/esm/project-config/shared/minion-resource-access.validation.js +174 -37
  82. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
  83. package/dist/esm/project-config/shared/platform-services.schemas.d.ts +50 -0
  84. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  85. package/dist/esm/project-config/shared/platform-services.schemas.js +57 -0
  86. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  87. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +35 -0
  88. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -0
  89. package/dist/esm/project-config/shared/platform-storage.schemas.js +37 -0
  90. package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -0
  91. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +81 -0
  92. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -0
  93. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js +74 -0
  94. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -0
  95. package/dist/esm/registry/artifact-domain.schemas.d.ts +1 -1
  96. package/dist/esm/registry/module-manifest.schemas.d.ts +10 -16
  97. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  98. package/dist/esm/registry/module-manifest.schemas.js +14 -20
  99. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  100. package/dist/esm/schemas/framework-secrets.schemas.d.ts +12 -1
  101. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  102. package/dist/esm/schemas/framework-secrets.schemas.js +14 -1
  103. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  104. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +4 -3
  105. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  106. package/dist/esm/workspace-scope/workspace-homes.schemas.js +6 -5
  107. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  108. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts +15 -6
  109. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  110. package/dist/esm/workspace-scope/workspace-scope.schemas.js +23 -9
  111. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  112. package/dist/tsconfig.build.tsbuildinfo +1 -1
  113. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"platform-runtime-env.contracts.js","sourceRoot":"","sources":["../../../../src/bootstrap/platform-runtime-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AAK;YACnF,qFAAqF;YACrF,mCAAmC,CACpC,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC,MAAM,mCAAmC,GAAG,IAAI,GAAG,CAAS;IACjE,4BAA4B,CAAC,iBAAiB;IAC9C,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,oBAAoB;IACjD,4BAA4B,CAAC,uBAAuB;IACpD,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,iBAAiB;IAC9C,4BAA4B,CAAC,cAAc;IAC3C,sBAAsB,CAAC,iCAAiC;IACxD,sBAAsB,CAAC,gCAAgC;IACvD,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 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 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\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 * 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 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; see `external-public-domain-rename.md`.\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 * Documentation-site BUILD env-var contract.\n *\n * Projected from `WildoInfraEnvConfig.documentationSite` by `env-vars-builder`. 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;\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 PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PUBLIC_KEY,\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,EAJ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C,kBAAkB;IAC/C,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,iBAAiB;IAC9C,4BAA4B,CAAC,cAAc;IAC3C,sBAAsB,CAAC,iCAAiC;IACxD,sBAAsB,CAAC,gCAAgC;IACvD,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 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\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 * 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; see `external-public-domain-rename.md`.\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 * Documentation-site BUILD env-var contract.\n *\n * Projected from `WildoInfraEnvConfig.documentationSite` by `env-vars-builder`. 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;\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 PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PUBLIC_KEY,\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,3 +1,4 @@
1
+ import { type OrganizationTypesConfig, type UserTypesConfig } from '@wildo-ai/saas-models';
1
2
  /**
2
3
  * The ONE identity of the organization that owns Wildo's own applications.
3
4
  *
@@ -47,6 +48,34 @@ export interface WildoOwnerOrganizationIdentity {
47
48
  readonly slug: string;
48
49
  /** Display name written on first seed. */
49
50
  readonly name: string;
51
+ /** The organization type written on first seed — a key of {@link WILDO_PLATFORM_ORGANIZATION_TYPES}. */
52
+ readonly type: typeof WILDO_PLATFORM_ORGANIZATION_TYPE;
50
53
  }
54
+ /**
55
+ * The user type the platform seeds its first administrator with, and the one its organization type grants.
56
+ *
57
+ * Declared because it was already HELD: the platform's INIT seed gave its first administrator `member` long before
58
+ * the platform declared any user type, and nothing checked the pair until organization types — whose granted user
59
+ * types must be declared — became mandatory (#1032). Registration is DISABLED: a platform user exists because the
60
+ * platform seeded them, never because someone signed up.
61
+ */
62
+ export declare const WILDO_PLATFORM_MEMBER_USER_TYPE = "member";
63
+ export declare const WILDO_PLATFORM_USER_TYPES: UserTypesConfig;
64
+ /**
65
+ * The ONE organization type the platform's own tenancy declares (#1032, decided 2026-09-14).
66
+ *
67
+ * Every organization carries a type that names a declared organization type, because a member of an
68
+ * organization whose type resolves to nothing cannot sign in. An application declares its types in
69
+ * `wildo.saas.config.ts`; the platform has no such file, so its declaration lives here, beside the
70
+ * identity of the organization it types. Before this, the platform seeded its organizations with no
71
+ * type at all, and `wildo_platform` held two of them.
72
+ *
73
+ * It grants {@link WILDO_PLATFORM_MEMBER_USER_TYPE}, the user type the platform's INIT seeds its first administrator
74
+ * with, so the platform's own first-organization derivation resolves to this type rather than refusing — and a
75
+ * configuration carrying this map must carry {@link WILDO_PLATFORM_USER_TYPES} beside it, or its granted user type
76
+ * is undeclared.
77
+ */
78
+ export declare const WILDO_PLATFORM_ORGANIZATION_TYPE = "platform-operator";
79
+ export declare const WILDO_PLATFORM_ORGANIZATION_TYPES: OrganizationTypesConfig;
51
80
  export declare const WILDO_OWNER_ORGANIZATION: WildoOwnerOrganizationIdentity;
52
81
  //# sourceMappingURL=wildo-owner-organization.contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wildo-owner-organization.contracts.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/wildo-owner-organization.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,WAAW,8BAA8B;IAC7C,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,wBAAwB,EAAE,8BAGtC,CAAC"}
1
+ {"version":3,"file":"wildo-owner-organization.contracts.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/wildo-owner-organization.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,KAAK,uBAAuB,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEvJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,WAAW,8BAA8B;IAC7C,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wGAAwG;IACxG,QAAQ,CAAC,IAAI,EAAE,OAAO,gCAAgC,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,WAAW,CAAC;AAExD,eAAO,MAAM,yBAAyB,EAAE,eAIvC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AAEpE,eAAO,MAAM,iCAAiC,EAAE,uBAO/C,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,8BAItC,CAAC"}
@@ -1,5 +1,44 @@
1
+ import { CORE_ORG_ROLES, RegistrationMode, UserTypeDefinitionSchema } from '@wildo-ai/saas-models';
2
+ /**
3
+ * The user type the platform seeds its first administrator with, and the one its organization type grants.
4
+ *
5
+ * Declared because it was already HELD: the platform's INIT seed gave its first administrator `member` long before
6
+ * the platform declared any user type, and nothing checked the pair until organization types — whose granted user
7
+ * types must be declared — became mandatory (#1032). Registration is DISABLED: a platform user exists because the
8
+ * platform seeded them, never because someone signed up.
9
+ */
10
+ export const WILDO_PLATFORM_MEMBER_USER_TYPE = 'member';
11
+ export const WILDO_PLATFORM_USER_TYPES = {
12
+ [WILDO_PLATFORM_MEMBER_USER_TYPE]: UserTypeDefinitionSchema.parse({
13
+ auth: { registration: { mode: RegistrationMode.DISABLED } },
14
+ }),
15
+ };
16
+ /**
17
+ * The ONE organization type the platform's own tenancy declares (#1032, decided 2026-09-14).
18
+ *
19
+ * Every organization carries a type that names a declared organization type, because a member of an
20
+ * organization whose type resolves to nothing cannot sign in. An application declares its types in
21
+ * `wildo.saas.config.ts`; the platform has no such file, so its declaration lives here, beside the
22
+ * identity of the organization it types. Before this, the platform seeded its organizations with no
23
+ * type at all, and `wildo_platform` held two of them.
24
+ *
25
+ * It grants {@link WILDO_PLATFORM_MEMBER_USER_TYPE}, the user type the platform's INIT seeds its first administrator
26
+ * with, so the platform's own first-organization derivation resolves to this type rather than refusing — and a
27
+ * configuration carrying this map must carry {@link WILDO_PLATFORM_USER_TYPES} beside it, or its granted user type
28
+ * is undeclared.
29
+ */
30
+ export const WILDO_PLATFORM_ORGANIZATION_TYPE = 'platform-operator';
31
+ export const WILDO_PLATFORM_ORGANIZATION_TYPES = {
32
+ [WILDO_PLATFORM_ORGANIZATION_TYPE]: {
33
+ userTypes: [WILDO_PLATFORM_MEMBER_USER_TYPE],
34
+ availableOrgRoles: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN, CORE_ORG_ROLES.ORG_MEMBER],
35
+ defaultMemberRole: CORE_ORG_ROLES.ORG_MEMBER,
36
+ authOverrides: undefined,
37
+ },
38
+ };
1
39
  export const WILDO_OWNER_ORGANIZATION = {
2
40
  slug: 'wildo',
3
41
  name: 'Wildo',
42
+ type: WILDO_PLATFORM_ORGANIZATION_TYPE,
4
43
  };
5
44
  //# sourceMappingURL=wildo-owner-organization.contracts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wildo-owner-organization.contracts.js","sourceRoot":"","sources":["../../../../src/bootstrap/wildo-owner-organization.contracts.ts"],"names":[],"mappings":"AAmDA,MAAM,CAAC,MAAM,wBAAwB,GAAmC;IACtE,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;CACd,CAAC","sourcesContent":["/**\n * The ONE identity of the organization that owns Wildo's own applications.\n *\n * ## Why this constant exists\n *\n * This identity used to be hardcoded FOUR times, in two files, as TWO DIFFERENT VALUES — and the\n * result was a platform carrying two organizations, neither of them a customer:\n *\n * | declared in | value |\n * |---|---|\n * | `init-mode-startup.apps-manager.service.ts` (twice) | `wildo-platform` / `Wildo Platform` |\n * | `maintenance/services/app-initialization.service.ts` (twice) | `wildo` / `Wildo` |\n *\n * The two paths provision different things, so ownership split along them. Measured on the dogfood\n * platform (2026-09-01): `wildo-ai-application` — the bootstrap row — was owned by `wildo-platform`,\n * while `wonder-crm`, `wonder-todos` and `secrets-proof` were owned by `wildo`. Worse, OPERATOR\n * REACH followed the same split: the admin seeded by INIT was `ORG_ADMIN` of BOTH organizations,\n * while an admin seeded later by the maintenance path was a member of `wildo` ONLY. Nothing declared\n * that they should differ; it was decided by which code path happened to run.\n *\n * The bootstrap organization is also `ACTIVE` and authority-conferring, so everything that\n * ENUMERATES tenants — an organization switcher, the owner-floor boot report, a cross-tenant audit,\n * a subject-erasure sweep — counted a bootstrap artifact as a real tenant.\n *\n * ## Why ONE organization rather than two declared ones\n *\n * The second organization was never a design. `seedBootstrapApplicationRecord` needs *an* owner for\n * the minimal APPLICATION row it seeds to break a chicken-and-egg (an APPLICATION-primary-scoped\n * execution context resolves its `applicationId` by READING that row). It needs an owner; it never\n * needed a DIFFERENT one. Wildo owning all Wildo applications — including its own — is the coherent\n * reading, and it is what the duplication suggests was intended before the two literals drifted.\n *\n * If a future decision genuinely wants the platform's own application in a separate tenant, that is\n * a SECOND named constant here plus an explicit statement of which consumers must tell them apart —\n * not a second literal at a call site.\n *\n * ## What this does NOT do\n *\n * It does not retrofit an existing platform. Both bootstrap seeding arms look a row up by business\n * key and insert ONLY when absent, and the registration path prefers an existing application's\n * recorded `ownerOrganizationId` over the seeded id — so an installation that already carries two\n * organizations keeps both, with its existing linkage untouched. Only a FRESH platform gets one.\n * Merging the two on an existing installation is a migration with its own decision.\n */\nexport interface WildoOwnerOrganizationIdentity {\n /** Business key. Both provisioning paths upsert the organization by THIS field. */\n readonly slug: string;\n /** Display name written on first seed. */\n readonly name: string;\n}\n\nexport const WILDO_OWNER_ORGANIZATION: WildoOwnerOrganizationIdentity = {\n slug: 'wildo',\n name: 'Wildo',\n};\n"]}
1
+ {"version":3,"file":"wildo-owner-organization.contracts.js","sourceRoot":"","sources":["../../../../src/bootstrap/wildo-owner-organization.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,wBAAwB,EAAsD,MAAM,uBAAuB,CAAC;AAuDvJ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,QAAQ,CAAC;AAExD,MAAM,CAAC,MAAM,yBAAyB,GAAoB;IACxD,CAAC,+BAA+B,CAAC,EAAE,wBAAwB,CAAC,KAAK,CAAC;QAChE,IAAI,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,gBAAgB,CAAC,QAAQ,EAAE,EAAE;KAC5D,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAAmB,CAAC;AAEpE,MAAM,CAAC,MAAM,iCAAiC,GAA4B;IACxE,CAAC,gCAAgC,CAAC,EAAE;QAClC,SAAS,EAAE,CAAC,+BAA+B,CAAC;QAC5C,iBAAiB,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,UAAU,CAAC;QAClG,iBAAiB,EAAE,cAAc,CAAC,UAAU;QAC5C,aAAa,EAAE,SAAS;KACzB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAmC;IACtE,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,gCAAgC;CACvC,CAAC","sourcesContent":["import { CORE_ORG_ROLES, RegistrationMode, UserTypeDefinitionSchema, type OrganizationTypesConfig, type UserTypesConfig } from '@wildo-ai/saas-models';\n\n/**\n * The ONE identity of the organization that owns Wildo's own applications.\n *\n * ## Why this constant exists\n *\n * This identity used to be hardcoded FOUR times, in two files, as TWO DIFFERENT VALUES — and the\n * result was a platform carrying two organizations, neither of them a customer:\n *\n * | declared in | value |\n * |---|---|\n * | `init-mode-startup.apps-manager.service.ts` (twice) | `wildo-platform` / `Wildo Platform` |\n * | `maintenance/services/app-initialization.service.ts` (twice) | `wildo` / `Wildo` |\n *\n * The two paths provision different things, so ownership split along them. Measured on the dogfood\n * platform (2026-09-01): `wildo-ai-application` — the bootstrap row — was owned by `wildo-platform`,\n * while `wonder-crm`, `wonder-todos` and `secrets-proof` were owned by `wildo`. Worse, OPERATOR\n * REACH followed the same split: the admin seeded by INIT was `ORG_ADMIN` of BOTH organizations,\n * while an admin seeded later by the maintenance path was a member of `wildo` ONLY. Nothing declared\n * that they should differ; it was decided by which code path happened to run.\n *\n * The bootstrap organization is also `ACTIVE` and authority-conferring, so everything that\n * ENUMERATES tenants — an organization switcher, the owner-floor boot report, a cross-tenant audit,\n * a subject-erasure sweep — counted a bootstrap artifact as a real tenant.\n *\n * ## Why ONE organization rather than two declared ones\n *\n * The second organization was never a design. `seedBootstrapApplicationRecord` needs *an* owner for\n * the minimal APPLICATION row it seeds to break a chicken-and-egg (an APPLICATION-primary-scoped\n * execution context resolves its `applicationId` by READING that row). It needs an owner; it never\n * needed a DIFFERENT one. Wildo owning all Wildo applications — including its own — is the coherent\n * reading, and it is what the duplication suggests was intended before the two literals drifted.\n *\n * If a future decision genuinely wants the platform's own application in a separate tenant, that is\n * a SECOND named constant here plus an explicit statement of which consumers must tell them apart —\n * not a second literal at a call site.\n *\n * ## What this does NOT do\n *\n * It does not retrofit an existing platform. Both bootstrap seeding arms look a row up by business\n * key and insert ONLY when absent, and the registration path prefers an existing application's\n * recorded `ownerOrganizationId` over the seeded id — so an installation that already carries two\n * organizations keeps both, with its existing linkage untouched. Only a FRESH platform gets one.\n * Merging the two on an existing installation is a migration with its own decision.\n */\nexport interface WildoOwnerOrganizationIdentity {\n /** Business key. Both provisioning paths upsert the organization by THIS field. */\n readonly slug: string;\n /** Display name written on first seed. */\n readonly name: string;\n /** The organization type written on first seed — a key of {@link WILDO_PLATFORM_ORGANIZATION_TYPES}. */\n readonly type: typeof WILDO_PLATFORM_ORGANIZATION_TYPE;\n}\n\n/**\n * The user type the platform seeds its first administrator with, and the one its organization type grants.\n *\n * Declared because it was already HELD: the platform's INIT seed gave its first administrator `member` long before\n * the platform declared any user type, and nothing checked the pair until organization types — whose granted user\n * types must be declared — became mandatory (#1032). Registration is DISABLED: a platform user exists because the\n * platform seeded them, never because someone signed up.\n */\nexport const WILDO_PLATFORM_MEMBER_USER_TYPE = 'member';\n\nexport const WILDO_PLATFORM_USER_TYPES: UserTypesConfig = {\n [WILDO_PLATFORM_MEMBER_USER_TYPE]: UserTypeDefinitionSchema.parse({\n auth: { registration: { mode: RegistrationMode.DISABLED } },\n }),\n};\n\n/**\n * The ONE organization type the platform's own tenancy declares (#1032, decided 2026-09-14).\n *\n * Every organization carries a type that names a declared organization type, because a member of an\n * organization whose type resolves to nothing cannot sign in. An application declares its types in\n * `wildo.saas.config.ts`; the platform has no such file, so its declaration lives here, beside the\n * identity of the organization it types. Before this, the platform seeded its organizations with no\n * type at all, and `wildo_platform` held two of them.\n *\n * It grants {@link WILDO_PLATFORM_MEMBER_USER_TYPE}, the user type the platform's INIT seeds its first administrator\n * with, so the platform's own first-organization derivation resolves to this type rather than refusing — and a\n * configuration carrying this map must carry {@link WILDO_PLATFORM_USER_TYPES} beside it, or its granted user type\n * is undeclared.\n */\nexport const WILDO_PLATFORM_ORGANIZATION_TYPE = 'platform-operator';\n\nexport const WILDO_PLATFORM_ORGANIZATION_TYPES: OrganizationTypesConfig = {\n [WILDO_PLATFORM_ORGANIZATION_TYPE]: {\n userTypes: [WILDO_PLATFORM_MEMBER_USER_TYPE],\n availableOrgRoles: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN, CORE_ORG_ROLES.ORG_MEMBER],\n defaultMemberRole: CORE_ORG_ROLES.ORG_MEMBER,\n authOverrides: undefined,\n },\n};\n\nexport const WILDO_OWNER_ORGANIZATION: WildoOwnerOrganizationIdentity = {\n slug: 'wildo',\n name: 'Wildo',\n type: WILDO_PLATFORM_ORGANIZATION_TYPE,\n};\n"]}
@@ -25,6 +25,7 @@ export * from './project-config/shared/minion-resource-access.validation';
25
25
  export * from './project-config/shared/object-storage-session-policy';
26
26
  export * from './lockfile/wildo-saas-lock.shared.schemas';
27
27
  export * from './lockfile/lockfile-io';
28
+ export * from './lockfile/build-parallelism';
28
29
  export * from './lockfile/materialize-infra-section';
29
30
  export * from './lockfile/canonical-json';
30
31
  export * from './registry';
@@ -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,C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C;AAC1E,cAAc,uDAAuD,CAAC;AACtE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -25,6 +25,7 @@ export * from './project-config/shared/minion-resource-access.validation.js';
25
25
  export * from './project-config/shared/object-storage-session-policy.js';
26
26
  export * from './lockfile/wildo-saas-lock.shared.schemas.js';
27
27
  export * from './lockfile/lockfile-io.js';
28
+ export * from './lockfile/build-parallelism.js';
28
29
  export * from './lockfile/materialize-infra-section.js';
29
30
  export * from './lockfile/canonical-json.js';
30
31
  export * from './registry/index.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,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,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,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,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-topology.contracts';\nexport * from './bootstrap/runtime-principal.contracts';\nexport * from './bootstrap/runtime-backing-service-access';\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/materialize-infra-section';\nexport * from './lockfile/canonical-json';\nexport * from './registry';\nexport * from './_unimplemented';\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,+BAA+B,CAAC;AAC9C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,6DAA6D,CAAC;AAC5E,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,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,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,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-topology.contracts';\nexport * from './bootstrap/runtime-principal.contracts';\nexport * from './bootstrap/runtime-backing-service-access';\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/build-parallelism';\nexport * from './lockfile/materialize-infra-section';\nexport * from './lockfile/canonical-json';\nexport * from './registry';\nexport * from './_unimplemented';\n"]}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * How many build-plan coding tasks the creation lane may run AT ONCE in one application (#1528).
3
+ *
4
+ * An OPERATIONAL setting, not product truth: it decides how fast the build spends, never what it
5
+ * builds, so it lives in the application's machine-local state beside the workspace-mutation lock and
6
+ * is safe to delete. The companion reads it at every wave, so it changes without a restart; the CLI
7
+ * writes it (`wildo workbench parallelism <n>`).
8
+ *
9
+ * Absent means {@link DEFAULT_BUILD_PARALLELISM}. `1` is the lane's single-flight behaviour, and remains
10
+ * one command away. Parallel runs share ONE worktree by decision (Paul, 2026-09-24): concurrent agents
11
+ * editing the same tree reconcile fine in practice, so the lane detects and repairs interference instead
12
+ * of preventing it.
13
+ */
14
+ export declare const BUILD_PARALLELISM_RELATIVE_PATH: string;
15
+ /**
16
+ * Five runs at once, by decision (Paul, 2026-09-24): parallel is the lane's normal mode, not an opt-in.
17
+ *
18
+ * Five rather than more because each slot is a live agent spending on its own, and the wave is already
19
+ * measured to cut wall-clock by more than three at four runs (a live wave of four real agents: 28 s
20
+ * against 86 s of combined run time). It sits under the ACP provider's own limit of ten concurrent
21
+ * sessions, so the setting — not the provider — is what decides the width.
22
+ */
23
+ export declare const DEFAULT_BUILD_PARALLELISM = 5;
24
+ /**
25
+ * A breaker, not a budget. Each slot is a live coding agent spending on its own, so the ceiling stops
26
+ * a typo (`100`) from becoming a hundred concurrent agents; any value up to it is the operator's call.
27
+ */
28
+ export declare const MAXIMUM_BUILD_PARALLELISM = 16;
29
+ /** Absolute path of an application's build-parallelism setting. */
30
+ export declare function getBuildParallelismPath(saasRoot: string): string;
31
+ /** Clamp a requested degree into `[1, MAXIMUM_BUILD_PARALLELISM]`; anything unreadable is the default. */
32
+ export declare function normalizeBuildParallelism(value: unknown): number;
33
+ /**
34
+ * The application's build parallelism. Never throws: an absent, unreadable or malformed file reads as
35
+ * the default, because a throughput knob that cannot be read must not stop the build.
36
+ */
37
+ export declare function readBuildParallelism(saasRoot: string): number;
38
+ /** Record the application's build parallelism, clamped. Returns the degree actually recorded. */
39
+ export declare function writeBuildParallelism(saasRoot: string, degree: number): number;
40
+ //# sourceMappingURL=build-parallelism.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-parallelism.d.ts","sourceRoot":"","sources":["../../../../src/lockfile/build-parallelism.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,+BAA+B,EAAE,MAAmD,CAAC;AAElG;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C,mEAAmE;AACnE,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,0GAA0G;AAC1G,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAGhE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQ7D;AAED,iGAAiG;AACjG,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAM9E"}
@@ -0,0 +1,64 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ /**
4
+ * How many build-plan coding tasks the creation lane may run AT ONCE in one application (#1528).
5
+ *
6
+ * An OPERATIONAL setting, not product truth: it decides how fast the build spends, never what it
7
+ * builds, so it lives in the application's machine-local state beside the workspace-mutation lock and
8
+ * is safe to delete. The companion reads it at every wave, so it changes without a restart; the CLI
9
+ * writes it (`wildo workbench parallelism <n>`).
10
+ *
11
+ * Absent means {@link DEFAULT_BUILD_PARALLELISM}. `1` is the lane's single-flight behaviour, and remains
12
+ * one command away. Parallel runs share ONE worktree by decision (Paul, 2026-09-24): concurrent agents
13
+ * editing the same tree reconcile fine in practice, so the lane detects and repairs interference instead
14
+ * of preventing it.
15
+ */
16
+ export const BUILD_PARALLELISM_RELATIVE_PATH = '.wildo-saas/state/build-parallelism.json';
17
+ /**
18
+ * Five runs at once, by decision (Paul, 2026-09-24): parallel is the lane's normal mode, not an opt-in.
19
+ *
20
+ * Five rather than more because each slot is a live agent spending on its own, and the wave is already
21
+ * measured to cut wall-clock by more than three at four runs (a live wave of four real agents: 28 s
22
+ * against 86 s of combined run time). It sits under the ACP provider's own limit of ten concurrent
23
+ * sessions, so the setting — not the provider — is what decides the width.
24
+ */
25
+ export const DEFAULT_BUILD_PARALLELISM = 5;
26
+ /**
27
+ * A breaker, not a budget. Each slot is a live coding agent spending on its own, so the ceiling stops
28
+ * a typo (`100`) from becoming a hundred concurrent agents; any value up to it is the operator's call.
29
+ */
30
+ export const MAXIMUM_BUILD_PARALLELISM = 16;
31
+ /** Absolute path of an application's build-parallelism setting. */
32
+ export function getBuildParallelismPath(saasRoot) {
33
+ return path.join(saasRoot, BUILD_PARALLELISM_RELATIVE_PATH);
34
+ }
35
+ /** Clamp a requested degree into `[1, MAXIMUM_BUILD_PARALLELISM]`; anything unreadable is the default. */
36
+ export function normalizeBuildParallelism(value) {
37
+ if (typeof value !== 'number' || !Number.isFinite(value))
38
+ return DEFAULT_BUILD_PARALLELISM;
39
+ return Math.min(MAXIMUM_BUILD_PARALLELISM, Math.max(1, Math.floor(value)));
40
+ }
41
+ /**
42
+ * The application's build parallelism. Never throws: an absent, unreadable or malformed file reads as
43
+ * the default, because a throughput knob that cannot be read must not stop the build.
44
+ */
45
+ export function readBuildParallelism(saasRoot) {
46
+ const filePath = getBuildParallelismPath(saasRoot);
47
+ if (!existsSync(filePath))
48
+ return DEFAULT_BUILD_PARALLELISM;
49
+ try {
50
+ return normalizeBuildParallelism(JSON.parse(readFileSync(filePath, 'utf8')).degree);
51
+ }
52
+ catch {
53
+ return DEFAULT_BUILD_PARALLELISM;
54
+ }
55
+ }
56
+ /** Record the application's build parallelism, clamped. Returns the degree actually recorded. */
57
+ export function writeBuildParallelism(saasRoot, degree) {
58
+ const recorded = normalizeBuildParallelism(degree);
59
+ const filePath = getBuildParallelismPath(saasRoot);
60
+ mkdirSync(path.dirname(filePath), { recursive: true });
61
+ writeFileSync(filePath, `${JSON.stringify({ degree: recorded, recordedAt: new Date().toISOString() }, null, 2)}\n`, 'utf8');
62
+ return recorded;
63
+ }
64
+ //# sourceMappingURL=build-parallelism.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-parallelism.js","sourceRoot":"","sources":["../../../../src/lockfile/build-parallelism.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAW,0CAA0C,CAAC;AAElG;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C,mEAAmE;AACnE,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,+BAA+B,CAAC,CAAC;AAC9D,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACtD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,yBAAyB,CAAC;IAC3F,OAAO,IAAI,CAAC,GAAG,CAAC,yBAAyB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACnD,MAAM,QAAQ,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACnD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,yBAAyB,CAAC;IAC5D,IAAI,CAAC;QACH,OAAO,yBAAyB,CAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAA0B,CAAC,MAAM,CAAC,CAAC;IAChH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,yBAAyB,CAAC;IACnC,CAAC;AACH,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,qBAAqB,CAAC,QAAgB,EAAE,MAAc;IACpE,MAAM,QAAQ,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACnD,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,aAAa,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5H,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport path from 'node:path';\n\n/**\n * How many build-plan coding tasks the creation lane may run AT ONCE in one application (#1528).\n *\n * An OPERATIONAL setting, not product truth: it decides how fast the build spends, never what it\n * builds, so it lives in the application's machine-local state beside the workspace-mutation lock and\n * is safe to delete. The companion reads it at every wave, so it changes without a restart; the CLI\n * writes it (`wildo workbench parallelism <n>`).\n *\n * Absent means {@link DEFAULT_BUILD_PARALLELISM}. `1` is the lane's single-flight behaviour, and remains\n * one command away. Parallel runs share ONE worktree by decision (Paul, 2026-09-24): concurrent agents\n * editing the same tree reconcile fine in practice, so the lane detects and repairs interference instead\n * of preventing it.\n */\nexport const BUILD_PARALLELISM_RELATIVE_PATH: string = '.wildo-saas/state/build-parallelism.json';\n\n/**\n * Five runs at once, by decision (Paul, 2026-09-24): parallel is the lane's normal mode, not an opt-in.\n *\n * Five rather than more because each slot is a live agent spending on its own, and the wave is already\n * measured to cut wall-clock by more than three at four runs (a live wave of four real agents: 28 s\n * against 86 s of combined run time). It sits under the ACP provider's own limit of ten concurrent\n * sessions, so the setting — not the provider — is what decides the width.\n */\nexport const DEFAULT_BUILD_PARALLELISM = 5;\n\n/**\n * A breaker, not a budget. Each slot is a live coding agent spending on its own, so the ceiling stops\n * a typo (`100`) from becoming a hundred concurrent agents; any value up to it is the operator's call.\n */\nexport const MAXIMUM_BUILD_PARALLELISM = 16;\n\n/** Absolute path of an application's build-parallelism setting. */\nexport function getBuildParallelismPath(saasRoot: string): string {\n return path.join(saasRoot, BUILD_PARALLELISM_RELATIVE_PATH);\n}\n\n/** Clamp a requested degree into `[1, MAXIMUM_BUILD_PARALLELISM]`; anything unreadable is the default. */\nexport function normalizeBuildParallelism(value: unknown): number {\n if (typeof value !== 'number' || !Number.isFinite(value)) return DEFAULT_BUILD_PARALLELISM;\n return Math.min(MAXIMUM_BUILD_PARALLELISM, Math.max(1, Math.floor(value)));\n}\n\n/**\n * The application's build parallelism. Never throws: an absent, unreadable or malformed file reads as\n * the default, because a throughput knob that cannot be read must not stop the build.\n */\nexport function readBuildParallelism(saasRoot: string): number {\n const filePath = getBuildParallelismPath(saasRoot);\n if (!existsSync(filePath)) return DEFAULT_BUILD_PARALLELISM;\n try {\n return normalizeBuildParallelism((JSON.parse(readFileSync(filePath, 'utf8')) as { degree?: unknown }).degree);\n } catch {\n return DEFAULT_BUILD_PARALLELISM;\n }\n}\n\n/** Record the application's build parallelism, clamped. Returns the degree actually recorded. */\nexport function writeBuildParallelism(saasRoot: string, degree: number): number {\n const recorded = normalizeBuildParallelism(degree);\n const filePath = getBuildParallelismPath(saasRoot);\n mkdirSync(path.dirname(filePath), { recursive: true });\n writeFileSync(filePath, `${JSON.stringify({ degree: recorded, recordedAt: new Date().toISOString() }, null, 2)}\\n`, 'utf8');\n return recorded;\n}\n"]}
@@ -7,7 +7,7 @@
7
7
  * Lives in `platform-config-lib` (no runtime, no DI, no I/O — pure
8
8
  * projection). The CLI-side caller is responsible for loading the
9
9
  * authored configs from disk via
10
- * `loadAuthoredInfraEnvConfig` (`@wildo-ai/wildo-cli`) and passing
10
+ * `loadInfraEnvConfig` (this package; the CLI's `loadAuthoredInfraEnvConfig` delegates to it) and passing
11
11
  * the parsed `backingServices` slice plus the env name.
12
12
  *
13
13
  * **Slice 2.5c-1 (2026-05-10)**: when the caller supplies an optional
@@ -7,7 +7,7 @@
7
7
  * Lives in `platform-config-lib` (no runtime, no DI, no I/O — pure
8
8
  * projection). The CLI-side caller is responsible for loading the
9
9
  * authored configs from disk via
10
- * `loadAuthoredInfraEnvConfig` (`@wildo-ai/wildo-cli`) and passing
10
+ * `loadInfraEnvConfig` (this package; the CLI's `loadAuthoredInfraEnvConfig` delegates to it) and passing
11
11
  * the parsed `backingServices` slice plus the env name.
12
12
  *
13
13
  * **Slice 2.5c-1 (2026-05-10)**: when the caller supplies an optional
@@ -1 +1 @@
1
- {"version":3,"file":"materialize-infra-section.js","sourceRoot":"","sources":["../../../../src/lockfile/materialize-infra-section.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EACL,kBAAkB,EAClB,mCAAm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;;;;;;;;;;;;GAiBG;AACH,SAAS,uBAAuB,CAC9B,QAAuB,EACvB,IAAwB,EACxB,KAA8B,EAC9B,YAAoB,EACpB,OAAe,EACf,SAAsE;IAEtE,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,eAAe,GAAiC;QACpD,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,SAAS,EAAE,uDAAuD;QAC3E,iBAAiB,EAAE,IAAI;QACvB,MAAM,EAAE,KAAK;KACd,CAAC;IACF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAClD,OAAO,kBAAkB,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * `materializeInfraSection` — pure function that projects authored\n * `wildo.infra.<envName>.config.ts` files into the\n * `sections.infra` slice of `wildo-saas.lock.json` (Slice 2.5b of\n * `infra-provider-planner.md`).\n *\n * Lives in `platform-config-lib` (no runtime, no DI, no I/O — pure\n * projection). The CLI-side caller is responsible for loading the\n * authored configs from disk via\n * `loadAuthoredInfraEnvConfig` (`@wildo-ai/wildo-cli`) and passing\n * the parsed `backingServices` slice plus the env name.\n *\n * **Slice 2.5c-1 (2026-05-10)**: when the caller supplies an optional\n * `moduleMap` of `InfraProvider → InfraProviderModule`, the digest\n * is computed from `module.plan(planningContext)` instead of from\n * the authored entry. This captures **provider-version drift**\n * (e.g., a module change to plumbing port, secret env vars,\n * per-app blob paths) on top of authored-config drift. When the\n * map is omitted, behavior matches Slice 2.5b — backward-compatible.\n * When the map IS supplied but doesn't contain a module for the\n * resolved `InfraProvider`, the materializer falls back to the\n * authored-entry digest for that capability (allows partial\n * coverage as the catalog grows in Slice 5).\n *\n * **Slice 4.A.1 / H2 fix (2026-05-07)**: digest computation uses\n * `stableSha256Digest` (recursive sorted-keys serialization via\n * `canonical-json.ts`) so nested-object property reorders don't\n * spuriously trigger drift.\n */\n\nimport {\n BackingServiceKind,\n BackingServiceKindToInfraCapability,\n resolveInfraProvider,\n type BackingServiceEnvConfig,\n type BackingServicesEnvConfig,\n} from '../project-config/shared/backing-services.schemas';\nimport type {\n InfraProvider,\n InfraProviderModule,\n InfraProviderPlanningContext,\n} from '../project-config/shared/infra-providers.schemas';\nimport type {\n SaasLockfileInfraEnvironment,\n SaasLockfileInfraSection,\n} from './wildo-saas-lock.shared.schemas';\nimport { stableSha256Digest } from './canonical-json';\n\n/**\n * Per-env input for the materializer. The caller has already loaded\n * the authored `wildo.infra.<envName>.config.ts` and parsed it via\n * `defineInfraEnvConfig`; we only consume the `backingServices`\n * slice (the only authored surface that maps to `InfraCapability`\n * selections).\n */\nexport interface InfraEnvSelectionInput {\n envName: string;\n backingServices: BackingServicesEnvConfig | undefined;\n}\n\nexport interface MaterializeInfraSectionOptions {\n envs: ReadonlyArray<InfraEnvSelectionInput>;\n /**\n * ISO-8601 timestamp used as the selection time for NEWLY-selected\n * or CHANGED capabilities (see `previousSection` for the sticky-reuse\n * rule). Caller controls it so multi-env writes share one\n * deterministic timestamp (matches the pattern from\n * `materializeSaasProviderRuntimeArtifacts`).\n */\n generatedAt: string;\n /**\n * Optional `InfraProvider → InfraProviderModule` lookup. When\n * present, each capability's `planContributionDigest` is computed\n * from `module.plan(planningContext)` (richer — captures\n * provider-version drift) instead of from the authored entry\n * (Slice 2.5b). Slice 2.5c-1 of `infra-provider-planner.md`.\n *\n * The CLI-side caller in `provider-runtime-sync.service.ts`\n * builds this from `@wildo-ai/platform-infra-providers`'s\n * `buildInfraProviderModuleMap()`. Apps-manager-side callers\n * (none today) would do the same.\n *\n * **Partial coverage**: a missing entry for a resolved provider\n * falls back to the authored-entry digest — no fail-closed. This\n * lets the catalog grow incrementally (Slice 5 stateless modules\n * still pending) without blocking lockfile materialization.\n */\n moduleMap?: ReadonlyMap<InfraProvider, InfraProviderModule>;\n /**\n * The previous lockfile's `sections.infra` (when present). Threaded\n * so `providerSelectedAt` is STICKY: a capability whose resolved\n * `provider` is unchanged retains its prior `providerSelectedAt`\n * instead of being re-stamped with `generatedAt`. Only a newly-\n * selected capability or a provider CHANGE stamps a fresh\n * `generatedAt`.\n *\n * **Why this exists**: `generatedAt` is the lockfile's volatile\n * generation timestamp — it is bumped by EVERY lockfile write,\n * including writes by unrelated subsystems via `withLockfileMutate`.\n * Deriving `providerSelectedAt` directly from it made the field\n * drift on every unrelated write, producing phantom\n * `wildo lock check` failures even when no infra selection changed.\n * Both callers — the `wildo config sync` writer and the\n * `wildo lock check` drift-checker — MUST pass the same previous\n * section so their projections agree.\n */\n previousSection?: SaasLockfileInfraSection;\n}\n\n/**\n * Project authored infra envs into the lockfile `sections.infra`\n * shape. Returns `undefined` when there are no envs to record (so\n * the lockfile writer can skip emitting the section entirely\n * instead of writing an empty `{ environments: {} }`).\n */\nexport function materializeInfraSection(\n options: MaterializeInfraSectionOptions,\n): SaasLockfileInfraSection | undefined {\n if (options.envs.length === 0) return undefined;\n\n const environments: SaasLockfileInfraSection['environments'] = {};\n let recordedAny = false;\n\n for (const env of options.envs) {\n const capabilities = projectBackingServicesToCapabilities(\n env.backingServices,\n options.generatedAt,\n env.envName,\n options.moduleMap,\n options.previousSection?.environments[env.envName],\n );\n if (Object.keys(capabilities).length === 0) continue;\n environments[env.envName] = { capabilities };\n recordedAny = true;\n }\n\n return recordedAny ? { environments } : undefined;\n}\n\nfunction projectBackingServicesToCapabilities(\n backingServices: BackingServicesEnvConfig | undefined,\n generatedAt: string,\n envName: string,\n moduleMap: ReadonlyMap<InfraProvider, InfraProviderModule> | undefined,\n previousEnv: SaasLockfileInfraEnvironment | undefined,\n): SaasLockfileInfraEnvironment['capabilities'] {\n const capabilities: SaasLockfileInfraEnvironment['capabilities'] = {};\n if (!backingServices) return capabilities;\n\n // Iterate via `Object.values(BackingServiceKind)` (Slice 4.A.2 / M7)\n // — avoids an unsafe `kindKey as BackingServiceKind` cast on\n // `Object.entries`'s string keys. `BackingServicesEnvConfigSchema`\n // is `.strict()` so unknown keys can't reach this code path; this\n // tightening just removes the dead defensive guard that came with\n // the cast.\n for (const kind of Object.values(BackingServiceKind)) {\n const entry = backingServices[kind];\n if (!entry) continue;\n const capability = BackingServiceKindToInfraCapability[kind];\n\n // Some kinds carry an additional `provider` brand (e.g. S3 = minio | aws);\n // others don't. The cast lifts to a permissive shape since\n // `BackingServiceEnvConfig` is a discriminated union and the brand only\n // exists on some variants.\n const providerBrand = (entry as BackingServiceEnvConfig & { provider?: string }).provider;\n const provider = resolveInfraProvider(kind, entry.source, providerBrand);\n if (!provider) {\n // Two kinds (METRICS / BACKUP) have no concrete\n // `InfraProvider` catalog entry yet (Slice 1.b). Skip them in\n // the lockfile until the first concrete provider for each is\n // authored — recording an entry without a provider would lie.\n continue;\n }\n\n // Slice 2.5c-1: prefer module.plan() digest when the catalog\n // exposes a module for this provider. Falls back to the\n // authored-entry digest for uncovered providers (Slice 5\n // stateless modules pending) so partial coverage doesn't\n // break materialization.\n const planContributionDigest =\n computeModulePlanDigest(provider, kind, entry, generatedAt, envName, moduleMap)\n ?? computeAuthoredEntryDigest(entry);\n\n // `providerSelectedAt` is STICKY — only a provider's first\n // selection (or re-selection after a change) is a meaningful moment.\n // Reuse the prior timestamp when the resolved provider is unchanged\n // so an unrelated `generatedAt` bump never perturbs it (the root\n // cause of phantom `wildo lock check` infra drift). A newly-added\n // capability or a provider change stamps the fresh `generatedAt`.\n const previousEntry = previousEnv?.capabilities[capability];\n const providerSelectedAt =\n previousEntry && previousEntry.provider === provider\n ? previousEntry.providerSelectedAt\n : generatedAt;\n\n capabilities[capability] = {\n provider,\n providerSelectedAt,\n planContributionDigest,\n };\n }\n return capabilities;\n}\n\n/**\n * Stable digest of an authored `BackingServiceEnvConfig` entry.\n * Uses `stableJsonStringify` (recursive sorted-keys serialization)\n * via `stableSha256Digest` so the digest is insensitive to property-\n * order shuffles at ANY nesting level — not just top-level. This\n * matters for entries with nested objects like\n * `MongoBackingService.options: {retryWrites, w, authSource}` where\n * editor saves frequently reorder the nested keys.\n *\n * Slice 4.A.1 / H2 fix: previously this used `JSON.stringify(entry,\n * Object.keys(entry).sort())` which only sorted top-level keys.\n */\nfunction computeAuthoredEntryDigest(entry: BackingServiceEnvConfig): string {\n return stableSha256Digest(entry);\n}\n\n/**\n * Slice 2.5c-1: compute the digest by invoking the module's\n * `plan()` and hashing its contribution. Returns `undefined` when\n * the module map is missing OR doesn't cover the provider — caller\n * falls back to `computeAuthoredEntryDigest`.\n *\n * **Why include the authored entry IN the planning context**: the\n * module may use authored fields (e.g., a future opt-in flag in\n * `RabbitBackingService`) to vary its contribution. Threading the\n * entry through `config` keeps the digest sensitive to authored\n * drift even when the digest source is `module.plan()`.\n *\n * **Why ignore `generatedAt` in the digest**: the timestamp is the\n * `providerSelectedAt` field, NOT part of plan-contribution\n * identity. Using it would make every `wildo lock` run produce a\n * different digest — defeats drift detection. We don't pass it to\n * `module.plan()`; we pass it through the surrounding shape only.\n */\nfunction computeModulePlanDigest(\n provider: InfraProvider,\n kind: BackingServiceKind,\n entry: BackingServiceEnvConfig,\n _generatedAt: string,\n envName: string,\n moduleMap: ReadonlyMap<InfraProvider, InfraProviderModule> | undefined,\n): string | undefined {\n if (!moduleMap) return undefined;\n const module = moduleMap.get(provider);\n if (!module) return undefined;\n const planningContext: InfraProviderPlanningContext = {\n environment: envName,\n runtime: 'unknown', // Caller doesn't expose runtime per env at this layer.\n backingServiceKey: kind,\n config: entry,\n };\n const contribution = module.plan(planningContext);\n return stableSha256Digest(contribution);\n}\n"]}
1
+ {"version":3,"file":"materialize-infra-section.js","sourceRoot":"","sources":["../../../../src/lockfile/materialize-infra-section.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EACL,kBAAkB,EAClB,mCAAmC,EACnC,oBAAoB,GAGrB,MAAM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AS,uBAAuB,CAC9B,QAAuB,EACvB,IAAwB,EACxB,KAA8B,EAC9B,YAAoB,EACpB,OAAe,EACf,SAAsE;IAEtE,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,eAAe,GAAiC;QACpD,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,SAAS,EAAE,uDAAuD;QAC3E,iBAAiB,EAAE,IAAI;QACvB,MAAM,EAAE,KAAK;KACd,CAAC;IACF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAClD,OAAO,kBAAkB,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * `materializeInfraSection` — pure function that projects authored\n * `wildo.infra.<envName>.config.ts` files into the\n * `sections.infra` slice of `wildo-saas.lock.json` (Slice 2.5b of\n * `infra-provider-planner.md`).\n *\n * Lives in `platform-config-lib` (no runtime, no DI, no I/O — pure\n * projection). The CLI-side caller is responsible for loading the\n * authored configs from disk via\n * `loadInfraEnvConfig` (this package; the CLI's `loadAuthoredInfraEnvConfig` delegates to it) and passing\n * the parsed `backingServices` slice plus the env name.\n *\n * **Slice 2.5c-1 (2026-05-10)**: when the caller supplies an optional\n * `moduleMap` of `InfraProvider → InfraProviderModule`, the digest\n * is computed from `module.plan(planningContext)` instead of from\n * the authored entry. This captures **provider-version drift**\n * (e.g., a module change to plumbing port, secret env vars,\n * per-app blob paths) on top of authored-config drift. When the\n * map is omitted, behavior matches Slice 2.5b — backward-compatible.\n * When the map IS supplied but doesn't contain a module for the\n * resolved `InfraProvider`, the materializer falls back to the\n * authored-entry digest for that capability (allows partial\n * coverage as the catalog grows in Slice 5).\n *\n * **Slice 4.A.1 / H2 fix (2026-05-07)**: digest computation uses\n * `stableSha256Digest` (recursive sorted-keys serialization via\n * `canonical-json.ts`) so nested-object property reorders don't\n * spuriously trigger drift.\n */\n\nimport {\n BackingServiceKind,\n BackingServiceKindToInfraCapability,\n resolveInfraProvider,\n type BackingServiceEnvConfig,\n type BackingServicesEnvConfig,\n} from '../project-config/shared/backing-services.schemas';\nimport type {\n InfraProvider,\n InfraProviderModule,\n InfraProviderPlanningContext,\n} from '../project-config/shared/infra-providers.schemas';\nimport type {\n SaasLockfileInfraEnvironment,\n SaasLockfileInfraSection,\n} from './wildo-saas-lock.shared.schemas';\nimport { stableSha256Digest } from './canonical-json';\n\n/**\n * Per-env input for the materializer. The caller has already loaded\n * the authored `wildo.infra.<envName>.config.ts` and parsed it via\n * `defineInfraEnvConfig`; we only consume the `backingServices`\n * slice (the only authored surface that maps to `InfraCapability`\n * selections).\n */\nexport interface InfraEnvSelectionInput {\n envName: string;\n backingServices: BackingServicesEnvConfig | undefined;\n}\n\nexport interface MaterializeInfraSectionOptions {\n envs: ReadonlyArray<InfraEnvSelectionInput>;\n /**\n * ISO-8601 timestamp used as the selection time for NEWLY-selected\n * or CHANGED capabilities (see `previousSection` for the sticky-reuse\n * rule). Caller controls it so multi-env writes share one\n * deterministic timestamp (matches the pattern from\n * `materializeSaasProviderRuntimeArtifacts`).\n */\n generatedAt: string;\n /**\n * Optional `InfraProvider → InfraProviderModule` lookup. When\n * present, each capability's `planContributionDigest` is computed\n * from `module.plan(planningContext)` (richer — captures\n * provider-version drift) instead of from the authored entry\n * (Slice 2.5b). Slice 2.5c-1 of `infra-provider-planner.md`.\n *\n * The CLI-side caller in `provider-runtime-sync.service.ts`\n * builds this from `@wildo-ai/platform-infra-providers`'s\n * `buildInfraProviderModuleMap()`. Apps-manager-side callers\n * (none today) would do the same.\n *\n * **Partial coverage**: a missing entry for a resolved provider\n * falls back to the authored-entry digest — no fail-closed. This\n * lets the catalog grow incrementally (Slice 5 stateless modules\n * still pending) without blocking lockfile materialization.\n */\n moduleMap?: ReadonlyMap<InfraProvider, InfraProviderModule>;\n /**\n * The previous lockfile's `sections.infra` (when present). Threaded\n * so `providerSelectedAt` is STICKY: a capability whose resolved\n * `provider` is unchanged retains its prior `providerSelectedAt`\n * instead of being re-stamped with `generatedAt`. Only a newly-\n * selected capability or a provider CHANGE stamps a fresh\n * `generatedAt`.\n *\n * **Why this exists**: `generatedAt` is the lockfile's volatile\n * generation timestamp — it is bumped by EVERY lockfile write,\n * including writes by unrelated subsystems via `withLockfileMutate`.\n * Deriving `providerSelectedAt` directly from it made the field\n * drift on every unrelated write, producing phantom\n * `wildo lock check` failures even when no infra selection changed.\n * Both callers — the `wildo config sync` writer and the\n * `wildo lock check` drift-checker — MUST pass the same previous\n * section so their projections agree.\n */\n previousSection?: SaasLockfileInfraSection;\n}\n\n/**\n * Project authored infra envs into the lockfile `sections.infra`\n * shape. Returns `undefined` when there are no envs to record (so\n * the lockfile writer can skip emitting the section entirely\n * instead of writing an empty `{ environments: {} }`).\n */\nexport function materializeInfraSection(\n options: MaterializeInfraSectionOptions,\n): SaasLockfileInfraSection | undefined {\n if (options.envs.length === 0) return undefined;\n\n const environments: SaasLockfileInfraSection['environments'] = {};\n let recordedAny = false;\n\n for (const env of options.envs) {\n const capabilities = projectBackingServicesToCapabilities(\n env.backingServices,\n options.generatedAt,\n env.envName,\n options.moduleMap,\n options.previousSection?.environments[env.envName],\n );\n if (Object.keys(capabilities).length === 0) continue;\n environments[env.envName] = { capabilities };\n recordedAny = true;\n }\n\n return recordedAny ? { environments } : undefined;\n}\n\nfunction projectBackingServicesToCapabilities(\n backingServices: BackingServicesEnvConfig | undefined,\n generatedAt: string,\n envName: string,\n moduleMap: ReadonlyMap<InfraProvider, InfraProviderModule> | undefined,\n previousEnv: SaasLockfileInfraEnvironment | undefined,\n): SaasLockfileInfraEnvironment['capabilities'] {\n const capabilities: SaasLockfileInfraEnvironment['capabilities'] = {};\n if (!backingServices) return capabilities;\n\n // Iterate via `Object.values(BackingServiceKind)` (Slice 4.A.2 / M7)\n // — avoids an unsafe `kindKey as BackingServiceKind` cast on\n // `Object.entries`'s string keys. `BackingServicesEnvConfigSchema`\n // is `.strict()` so unknown keys can't reach this code path; this\n // tightening just removes the dead defensive guard that came with\n // the cast.\n for (const kind of Object.values(BackingServiceKind)) {\n const entry = backingServices[kind];\n if (!entry) continue;\n const capability = BackingServiceKindToInfraCapability[kind];\n\n // Some kinds carry an additional `provider` brand (e.g. S3 = minio | aws);\n // others don't. The cast lifts to a permissive shape since\n // `BackingServiceEnvConfig` is a discriminated union and the brand only\n // exists on some variants.\n const providerBrand = (entry as BackingServiceEnvConfig & { provider?: string }).provider;\n const provider = resolveInfraProvider(kind, entry.source, providerBrand);\n if (!provider) {\n // Two kinds (METRICS / BACKUP) have no concrete\n // `InfraProvider` catalog entry yet (Slice 1.b). Skip them in\n // the lockfile until the first concrete provider for each is\n // authored — recording an entry without a provider would lie.\n continue;\n }\n\n // Slice 2.5c-1: prefer module.plan() digest when the catalog\n // exposes a module for this provider. Falls back to the\n // authored-entry digest for uncovered providers (Slice 5\n // stateless modules pending) so partial coverage doesn't\n // break materialization.\n const planContributionDigest =\n computeModulePlanDigest(provider, kind, entry, generatedAt, envName, moduleMap)\n ?? computeAuthoredEntryDigest(entry);\n\n // `providerSelectedAt` is STICKY — only a provider's first\n // selection (or re-selection after a change) is a meaningful moment.\n // Reuse the prior timestamp when the resolved provider is unchanged\n // so an unrelated `generatedAt` bump never perturbs it (the root\n // cause of phantom `wildo lock check` infra drift). A newly-added\n // capability or a provider change stamps the fresh `generatedAt`.\n const previousEntry = previousEnv?.capabilities[capability];\n const providerSelectedAt =\n previousEntry && previousEntry.provider === provider\n ? previousEntry.providerSelectedAt\n : generatedAt;\n\n capabilities[capability] = {\n provider,\n providerSelectedAt,\n planContributionDigest,\n };\n }\n return capabilities;\n}\n\n/**\n * Stable digest of an authored `BackingServiceEnvConfig` entry.\n * Uses `stableJsonStringify` (recursive sorted-keys serialization)\n * via `stableSha256Digest` so the digest is insensitive to property-\n * order shuffles at ANY nesting level — not just top-level. This\n * matters for entries with nested objects like\n * `MongoBackingService.options: {retryWrites, w, authSource}` where\n * editor saves frequently reorder the nested keys.\n *\n * Slice 4.A.1 / H2 fix: previously this used `JSON.stringify(entry,\n * Object.keys(entry).sort())` which only sorted top-level keys.\n */\nfunction computeAuthoredEntryDigest(entry: BackingServiceEnvConfig): string {\n return stableSha256Digest(entry);\n}\n\n/**\n * Slice 2.5c-1: compute the digest by invoking the module's\n * `plan()` and hashing its contribution. Returns `undefined` when\n * the module map is missing OR doesn't cover the provider — caller\n * falls back to `computeAuthoredEntryDigest`.\n *\n * **Why include the authored entry IN the planning context**: the\n * module may use authored fields (e.g., a future opt-in flag in\n * `RabbitBackingService`) to vary its contribution. Threading the\n * entry through `config` keeps the digest sensitive to authored\n * drift even when the digest source is `module.plan()`.\n *\n * **Why ignore `generatedAt` in the digest**: the timestamp is the\n * `providerSelectedAt` field, NOT part of plan-contribution\n * identity. Using it would make every `wildo lock` run produce a\n * different digest — defeats drift detection. We don't pass it to\n * `module.plan()`; we pass it through the surrounding shape only.\n */\nfunction computeModulePlanDigest(\n provider: InfraProvider,\n kind: BackingServiceKind,\n entry: BackingServiceEnvConfig,\n _generatedAt: string,\n envName: string,\n moduleMap: ReadonlyMap<InfraProvider, InfraProviderModule> | undefined,\n): string | undefined {\n if (!moduleMap) return undefined;\n const module = moduleMap.get(provider);\n if (!module) return undefined;\n const planningContext: InfraProviderPlanningContext = {\n environment: envName,\n runtime: 'unknown', // Caller doesn't expose runtime per env at this layer.\n backingServiceKey: kind,\n config: entry,\n };\n const contribution = module.plan(planningContext);\n return stableSha256Digest(contribution);\n}\n"]}