@wildo-ai/platform-config-lib 1.1.4 → 1.1.6
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.
- package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts +24 -1
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.js +25 -0
- package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts +117 -1
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.js +63 -4
- package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +24 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js +24 -0
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/platform-store-preconnect.d.ts +37 -0
- package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -0
- package/dist/esm/bootstrap/platform-store-preconnect.js +43 -0
- package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -0
- package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-backing-service-access.js +8 -4
- package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
- package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
- package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.d.ts +36 -3
- package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.js +36 -13
- package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts +29 -0
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.js +39 -0
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
- package/dist/esm/config-authoring.entry.d.ts.map +1 -1
- package/dist/esm/config-authoring.entry.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lockfile/build-parallelism.d.ts +40 -0
- package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -0
- package/dist/esm/lockfile/build-parallelism.js +64 -0
- package/dist/esm/lockfile/build-parallelism.js.map +1 -0
- package/dist/esm/lockfile/lockfile-io.d.ts +7 -1
- package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
- package/dist/esm/lockfile/lockfile-io.js +17 -3
- package/dist/esm/lockfile/lockfile-io.js.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.d.ts +28 -7
- package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.js +24 -11
- package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +455 -6
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +27 -0
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
- package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts +13 -0
- package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -0
- package/dist/esm/project-config/application-public-pricing-catalog.loader.js +56 -0
- package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -0
- package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.d.ts +886 -29
- package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.js +395 -16
- package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-minion-config.js +1 -2
- package/dist/esm/project-config/define-minion-config.js.map +1 -1
- package/dist/esm/project-config/define-saas-config.d.ts +142 -25
- package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-saas-config.js +229 -26
- package/dist/esm/project-config/define-saas-config.js.map +1 -1
- package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
- package/dist/esm/project-config/hosted-infra-env-config.d.ts +59 -0
- package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -0
- package/dist/esm/project-config/hosted-infra-env-config.js +187 -0
- package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -0
- package/dist/esm/project-config/index.d.ts +6 -0
- package/dist/esm/project-config/index.d.ts.map +1 -1
- package/dist/esm/project-config/index.js +6 -0
- package/dist/esm/project-config/index.js.map +1 -1
- package/dist/esm/project-config/loader.d.ts +35 -0
- package/dist/esm/project-config/loader.d.ts.map +1 -1
- package/dist/esm/project-config/loader.js +148 -8
- package/dist/esm/project-config/loader.js.map +1 -1
- package/dist/esm/project-config/npm-version-range.d.ts +23 -0
- package/dist/esm/project-config/npm-version-range.d.ts.map +1 -0
- package/dist/esm/project-config/npm-version-range.js +175 -0
- package/dist/esm/project-config/npm-version-range.js.map +1 -0
- package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.d.ts +288 -30
- package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.js +795 -46
- package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts +192 -20
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.js +381 -42
- package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
- package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.d.ts +14 -35
- package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.js +14 -35
- package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/backing-service-servability.d.ts +157 -0
- package/dist/esm/project-config/shared/backing-service-servability.d.ts.map +1 -0
- package/dist/esm/project-config/shared/backing-service-servability.js +256 -0
- package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -0
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts +66 -66
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/backing-services.schemas.js +75 -67
- package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/cdn.example.d.ts.map +1 -1
- package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-emit.js +41 -2
- package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.d.ts +11 -12
- package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.js +11 -12
- package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.d.ts +152 -12
- package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.js +186 -9
- package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +185 -10
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.js +40 -3
- package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +77 -47
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.js +114 -52
- package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
- package/dist/esm/project-config/shared/platform-services.schemas.d.ts +50 -0
- package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/platform-services.schemas.js +57 -0
- package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +35 -0
- package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/platform-storage.schemas.js +37 -0
- package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -0
- package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +81 -0
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.js +74 -0
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -0
- package/dist/esm/project-config/static-asset-import-noop.d.ts +26 -0
- package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -0
- package/dist/esm/project-config/static-asset-import-noop.js +49 -0
- package/dist/esm/project-config/static-asset-import-noop.js.map +1 -0
- package/dist/esm/registry/artifact-domain.schemas.d.ts +1 -1
- package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
- package/dist/esm/registry/companion-api.schemas.d.ts +0 -176
- package/dist/esm/registry/companion-api.schemas.d.ts.map +0 -1
- package/dist/esm/registry/companion-api.schemas.js.map +0 -1
- package/dist/esm/registry/digest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/index.d.ts +3 -1
- package/dist/esm/registry/index.d.ts.map +1 -1
- package/dist/esm/registry/index.js +3 -1
- package/dist/esm/registry/index.js.map +1 -1
- package/dist/esm/registry/local-checkout-source.d.ts +31 -0
- package/dist/esm/registry/local-checkout-source.d.ts.map +1 -0
- package/dist/esm/registry/local-checkout-source.js +45 -0
- package/dist/esm/registry/local-checkout-source.js.map +1 -0
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +174 -14
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
- package/dist/esm/registry/lockfile-modules-section.schemas.js +120 -11
- package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.d.ts +79 -0
- package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.js +36 -0
- package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.d.ts +403 -23
- package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.js +502 -60
- package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
- package/dist/esm/registry/module-search.schemas.d.ts +80 -0
- package/dist/esm/registry/module-search.schemas.d.ts.map +1 -0
- package/dist/esm/registry/module-search.schemas.js +112 -0
- package/dist/esm/registry/module-search.schemas.js.map +1 -0
- package/dist/esm/registry/registry-config.schemas.d.ts +16 -0
- package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
- package/dist/esm/registry/registry-config.schemas.js +8 -0
- package/dist/esm/registry/registry-config.schemas.js.map +1 -1
- package/dist/esm/registry/registry-errors.d.ts +126 -2
- package/dist/esm/registry/registry-errors.d.ts.map +1 -1
- package/dist/esm/registry/registry-errors.js +183 -14
- package/dist/esm/registry/registry-errors.js.map +1 -1
- package/dist/esm/registry/registry-keys.schemas.d.ts +80 -0
- package/dist/esm/registry/registry-keys.schemas.d.ts.map +1 -0
- package/dist/esm/registry/registry-keys.schemas.js +68 -0
- package/dist/esm/registry/registry-keys.schemas.js.map +1 -0
- package/dist/esm/registry/registry-section-schemas.constants.d.ts +25 -3
- package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
- package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
- package/dist/esm/release/framework-release.constants.js.map +1 -1
- package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.d.ts +12 -1
- package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.js +14 -1
- package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -1
- package/dist/esm/workspace-scope/index.d.ts.map +1 -1
- package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +17 -14
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.js +8 -7
- package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts +15 -6
- package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.js +23 -9
- package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
- package/package.json +7 -7
- package/dist/esm/registry/companion-api.schemas.js +0 -165
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-infra-env-config.js","sourceRoot":"","sources":["../../../src/project-config/define-infra-env-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,2CAA2C,EAAE,MAAM,oDAAoD,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAC7H,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAs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C,UAAU,EAAE,QAAQ,CAAC,CAAC;AAC5E,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAgC;IACnE,MAAM,MAAM,GAAG,yBAAyB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACvD,qCAAqC,CAAC,MAAM,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,SAAS,qCAAqC,CAAC,MAA2B;IACxE,MAAM,IAAI,GAAG,8BAA8B,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;IACvF,MAAM,wBAAwB,GAAG,iCAAiC,CAAC;IACnE,MAAM,sBAAsB,GAAG,8BAA8B,EAAE,CAAC;IAEhE,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,IAAI,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QAC7B,4DAA4D;QAC5D,2DAA2D;QAC3D,yDAAyD;QACzD,8DAA8D;QAC9D,YAAY;QACZ,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;YACjD,IAAI,sBAAsB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC3C,SAAS;YACX,CAAC;YACD,IAAI,CAAC,OAAO,UAAU,EAAE,EAAE,MAAM,EAAE,wBAAwB,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\nimport { RuntimeEnvironment } from '@wildo-ai/saas-models';\nimport { z } from 'zod';\nimport {\n UnimplementedFieldSource,\n createUnimplementedFieldWarner,\n} from '../_unimplemented/unimplemented-field-warning';\nimport { WildoAuthConfigSchema } from './shared/auth.schemas';\nimport { ApplicationCreationVerificationConfigSchema } from './shared/application-creation-verification.schemas';\nimport { BackingServiceKind, BackingServiceSource, BackingServicesEnvConfigSchema } from './shared/backing-services.schemas';\nimport { WildoCdnConfigSchema } from './shared/cdn.schemas';\nimport { EnvCspOverrideSchema } from './shared/csp.schemas';\nimport { WildoSchemaVersionSchema } from './shared/schema-version.schemas';\nimport {\n InfraServiceAddressingSchema,\n InfraServiceK8sSchema,\n} from './shared/infra-service.schemas';\nimport {\n DatabaseEngine,\n WildoDeploymentConfigSchema,\n WildoDeploymentRuntime,\n WildoEnvironment,\n WildoEnvironmentIdSchema,\n WildoKubernetesConfigSchema,\n WildoLocationType,\n WildoLoggingConfigSchema,\n WildoObservabilityConfigSchema,\n WildoDocumentationSiteConfigSchema,\n WildoProviderSelectionOverridesSchema,\n WildoRemoteProviderSchema,\n isLocalEnvironmentId,\n} from './shared/environment.schemas';\n\nconst InfraEnvKubernetesSchema = WildoKubernetesConfigSchema.extend({\n services: z.record(z.string(), InfraServiceK8sSchema).optional(),\n}).strict();\n\n/**\n * DNS subdomain chain regex: one or more lowercase RFC 1123 labels\n * joined by dots. Empty string is allowed separately via the union\n * below — it means \"this service lives at the apex of `publicDomain`\".\n *\n * Examples accepted: `'app'`, `'docs'`, `'dev'`, `'www2'`, `'admin.ops'`.\n * Examples rejected: `'App'` (uppercase), `'-app'` / `'app-'`\n * (dash at boundary), `'app..docs'` / `'.app'` / `'app.'` (malformed\n * dots), `'a/b'` (non-DNS character).\n */\nconst SERVICE_HOST_LABEL = /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/;\n\n/**\n * Per-service public hostname mapping, authored per-environment.\n *\n * - **Keys** are service keys from `wildo.saas.config.ts`\n * (`config.services.<key>`). The mapping is NOT validated against\n * the SaaS config at the Zod level (the two configs live in\n * separate files and are parsed independently). Cross-file\n * validation against the SaaS-config service registry is the\n * responsibility of consumers that wire the two parsed configs\n * together (URL composers, ingress manifest generators) — each\n * consumer enforces it at the seam where both configs are in\n * scope. This schema cannot enforce it standalone.\n * - **Values** are the subdomain chain prefixed to `publicDomain`, OR\n * the empty string for apex. Composed as\n * `https://${value ? `${value}.` : ''}${publicDomain}`.\n *\n * The mapping is intentionally per-environment (living inside\n * `wildo.infra.<env>.config.ts`) because local / staging / production\n * routinely have different topologies — e.g., local collapses\n * everything to `localhost`, staging mounts everything under\n * `*.staging.example.com`, production uses bespoke subdomains like\n * `app.example.com` + `dev.example.com` for docs. Binding the\n * hostname to a frontend kind or to the service key would force a\n * single topology on every environment; the per-env map keeps those\n * decisions explicit and author-driven.\n *\n * See `cross-app-jwt-propagation.md` Step 1 for the motivating\n * decision and the Step 2 URL composer that consumes this mapping\n * when building cross-frontend handoff URLs.\n */\nconst ServiceHostValueSchema = z.string()\n .refine(\n (value) => value === '' || SERVICE_HOST_LABEL.test(value),\n 'serviceHosts value must be a lowercase DNS subdomain chain (e.g. \"app\", \"docs\", \"dev.admin\") or \"\" (empty string, meaning apex).',\n );\n\nconst ServiceHostsMapSchema = z.record(z.string().min(1), ServiceHostValueSchema);\nconst consumedInfraCspServiceKeysContext = new AsyncLocalStorage<ReadonlySet<string>>();\n\nfunction parseConsumedInfraCspServiceKeysFromEnv(): ReadonlySet<string> {\n return new Set(\n (process.env.WILDO_CONSUMED_INFRA_CSP_SERVICE_KEYS ?? '')\n .split(',')\n .map((value) => value.trim())\n .filter((value) => value.length > 0),\n );\n}\n\nfunction getConsumedInfraCspServiceKeys(): ReadonlySet<string> {\n const contextKeys = consumedInfraCspServiceKeysContext.getStore();\n const envKeys = parseConsumedInfraCspServiceKeysFromEnv();\n if (contextKeys === undefined || contextKeys.size === 0) {\n return envKeys;\n }\n if (envKeys.size === 0) {\n return contextKeys;\n }\n return new Set([...contextKeys, ...envKeys]);\n}\n\nconst WildoInfraEnvConfigInputSchema = z.object({\n /**\n * Authored schema-format version for this `wildo.infra.<env>.config.ts`,\n * expressed as a **SemVer 2.0.0 string** (e.g. `'1.0.0'`,\n * `'2.3.1-rc.1'`, `'1.0.0+build.42'`).\n *\n * @unimplemented Slice 3.5 wires a parse-time warning when this is\n * authored. The full schema-evolution / migration tooling story is\n * tracked under deferred-backlog **D-5**\n * (`.cursor/plans/post-flattening-completion-fixes.md`). Symmetrical\n * with `WildoSaasConfig.version` — both reservations land/retire\n * together so the migration tooling, when it ships, can target both\n * authored configs through a single mechanism. SemVer (not a bare\n * integer) was chosen for the same reason as on the SaaS-config side\n * — see the JSDoc on `WildoSaasConfig.version`. Field is `.optional()`\n * (no Zod default) so unauthored configs stay silent.\n */\n version: WildoSchemaVersionSchema.optional(),\n environment: WildoEnvironmentIdSchema,\n locationType: z.enum(WildoLocationType).optional(),\n runtimeEnvironment: z.enum(RuntimeEnvironment).optional(),\n runtime: z.enum(WildoDeploymentRuntime),\n /**\n * The store the PLATFORM's own data lives in (apps-manager + module-registry:\n * users, organizations, applications, sessions, API keys).\n *\n * **This is a DECLARED property of the environment, and that is the whole point.** It used to\n * exist only as an answer to an interactive prompt, persisted to the machine-local\n * `environments.json` — so it could not be committed, reviewed, or reproduced on a second\n * machine, and a value inferred from which backing services happened to be declared filled the\n * gap. Authoring it here makes it travel with the repository like every other environment\n * property.\n *\n * OPTIONAL. When omitted, the engine is INFERRED from the declared backing services\n * (`inferDatabaseChoiceFromInfraConfig`), which is what every pre-existing environment relies\n * on — so omitting this field preserves today's behaviour exactly. When authored, it is the\n * AUTHORITY and the inference is not consulted.\n *\n * Authoring it is REQUIRED to express a PostgreSQL platform that ALSO runs a mongod, because the\n * inference resolves `postgresql && mongodb` to MongoDB — so that dual-store combination is\n * unreachable by inference, by construction. Since 2026-08-28 a PostgreSQL platform no longer has\n * to declare `backingServices.mongodb` at all (see the refinement below), so the single-store case\n * is now expressible too.\n *\n * @example A PostgreSQL platform, no mongod.\n * ```ts\n * database: { engine: DatabaseEngine.POSTGRESQL, source: BackingServiceSource.SELF },\n * backingServices: { postgresql: { source: BackingServiceSource.SELF } },\n * ```\n *\n * @example A DUAL-STORE platform — PostgreSQL for itself, a mongod beside it for the Mongo-backed\n * applications it hosts. This is the shape that needs `database` authored.\n * ```ts\n * database: { engine: DatabaseEngine.POSTGRESQL, source: BackingServiceSource.SELF },\n * backingServices: {\n * mongodb: { source: BackingServiceSource.SELF },\n * postgresql: { source: BackingServiceSource.SELF },\n * },\n * ```\n *\n * NOTE this is the PLATFORM's engine. An APPLICATION's own store is chosen separately by that\n * application's `DATABASE_DEFAULT_ADAPTER`; declaring `backingServices.postgresql` alone gives an\n * application a PostgreSQL substrate without moving the platform.\n */\n database: z\n .strictObject({\n engine: z.enum(DatabaseEngine),\n source: z.enum(BackingServiceSource),\n /**\n * Managed-brand identifier when `source === MANAGED` — `'atlas'` for Mongo; one of\n * `'aws-rds' | 'gcp-cloud-sql' | 'azure-database' | 'supabase' | 'neon' | 'render'` for\n * Postgres. Mirrors `PlatformEnvConfigJson['database'].provider` exactly; this field is\n * deliberately the same vocabulary rather than a parallel one.\n */\n provider: z.string().min(1).optional(),\n })\n .optional(),\n /** @wildo_source:part:start platform.config.application-database facet:layer:platform facet:family:bootstrap facet:audience:app-developer */\n /**\n * Which declared backing store the APPLICATION's own resources persist to.\n *\n * ## Why this is a SEPARATE field from `database`\n *\n * `database` above is the PLATFORM's engine — where apps-manager's own tables live. This one is the\n * application's, and the two move independently: a PostgreSQL platform can host a MongoDB\n * application and vice versa. Collapsing them would make one decision imply the other, which is\n * exactly the conflation the emitter's own contract warns against.\n *\n * ## Why it carries only `engine`\n *\n * The SUBSTRATE is already declared: `backingServices.postgresql` says where the database is and\n * who provisions it, and `env-vars-builder` already emits `POSTGRESQL_HOST/PORT/DATABASE` to the\n * application backend whenever the environment self-hosts one. What was missing is the SELECTION,\n * and only the selection belongs here.\n *\n * ## Why an authored field rather than an env variable\n *\n * The emitter states the rule this field exists to satisfy: *\"which store an application persists to\n * is a deployment decision that must be legible in one place, not an emergent property of which\n * variables happen to be set\"*. Before this, the only way to select PostgreSQL for an application\n * was to hand-edit `backend-api/.env` — machine-local, ungitted, and not reproducible on another\n * developer's machine. That is the same defect the platform `database` field above was added to\n * remove, and the reason both live in the authored, committed config.\n *\n * Absent means MongoDB, matching `ApplicationBackendDataEnvKeys.DATABASE_DEFAULT_ADAPTER`'s own\n * default — so every existing deployment is unaffected by this field existing.\n *\n * @example An application on PostgreSQL, on a platform that is also on PostgreSQL.\n * ```ts\n * database: { engine: DatabaseEngine.POSTGRESQL, source: BackingServiceSource.SELF },\n * applicationDatabase: { engine: DatabaseEngine.POSTGRESQL },\n * backingServices: {\n * postgresql: { source: BackingServiceSource.SELF, database: 'my-app-db' },\n * },\n * ```\n */\n applicationDatabase: z\n .strictObject({\n engine: z.enum(DatabaseEngine),\n })\n .optional(),\n /**\n * ## Choosing PostgreSQL creates a standing obligation — MIGRATIONS\n *\n * This is the part that is easy to miss, and it is not a detail of deployment: on MongoDB a\n * collection exists the moment something writes to it, so a new resource needs nothing. On\n * PostgreSQL a resource's TABLE is built by a MIGRATION, and nothing creates it implicitly. So on\n * this engine, adding or reshaping a resource owes an artifact:\n *\n * - `wildo db diff` — what separates the model from the accepted plan;\n * - `wildo db generate --name <label>` — writes `backend-api/migrations/<timestamp>_<name>/`\n * AND advances `backend-api/migrations/schema-plan.lock.json`, in one step. Commit them\n * TOGETHER; either one alone is the two-artifact drift the design exists to prevent;\n * - `wildo db migrate` — applies pending migrations by hand. Usually unnecessary: the application\n * backend applies them at BOOT, and `wildo local dev` reconciles drift before the app starts.\n *\n * Skip it and nothing warns until the backend refuses to start with\n * `postgresql_table_schema_mismatch` — an accurate message that names neither the migration nor\n * the command. See the `application-database-migrations` skill.\n */\n /** @wildo_source:part:end platform.config.application-database */\n /**\n * Public domain that browsers and external clients use to reach this\n * deployment. Ingress / reverse proxy / DNS terminate here; every\n * service-level subdomain is mounted under it via {@link serviceHosts}\n * (`https://<serviceHost>.<publicDomain>`, e.g. `app.example.com`; a\n * `serviceHosts` value of `''` mounts the service at the apex). Greenfield,\n * single-app, mono-env — there is NO `<service>-<appSlug>-<env>` fan-out.\n *\n * Applies to BOTH `WildoDeploymentRuntime.KUBERNETES` and\n * `WildoDeploymentRuntime.DOCKER_COMPOSE`. For compose envs without a\n * reverse proxy, author `'localhost'` explicitly. For K8s local,\n * author `'local.wildo.ai'` (or your `*.local` apex). For remote,\n * author your apex (e.g. `'wonder-todos.com'`).\n *\n * NOT to be confused with the K8s-internal service-mesh hostname\n * (`<service>.<namespace>.svc.cluster.local`), which stays implicit\n * and is derived from `kubernetes.namespace` at composition time.\n *\n * REQUIRED — there is no read-time fallback. The default that\n * `wildo init` writes into the generated config file lives in\n * `PUBLIC_DOMAIN_DEFAULTS` (`infrastructure-defaults.schemas.ts`),\n * but the schema enforces explicit authoring so a hand-edited\n * config that drops the field fails Zod parse with a clear error\n * instead of silently falling back.\n */\n publicDomain: z.string().min(1),\n /**\n * Per-service public hostname authoring for this environment.\n *\n * The app developer maps each publicly-exposed service (by its\n * `services.<key>` in `wildo.saas.config.ts`) to the subdomain\n * chain under `publicDomain` where it is reachable in this\n * environment. An empty string value mounts the service at the\n * apex of `publicDomain`.\n *\n * Explicit authoring only — there is NO auto-derivation from the\n * service key or from `frontendType`. An app-dev who wants the\n * docs service to live at `dev.example.com` (rather than the more\n * conventional `docs.example.com`) writes\n * `serviceHosts: { docs: 'dev' }` here; an app-dev who splits\n * marketing across `example.com` and `landing.example.com` can\n * author `serviceHosts: { www: '', landing: 'landing' }` without\n * the framework second-guessing the intent.\n *\n * Field is `.optional()` because many projects (local dev,\n * Docker Compose collapsed to `localhost`, single-frontend SaaS\n * apps) do not need per-service hostname authoring. Downstream\n * consumers (URL composers, ingress manifest generators) MUST\n * handle both \"no mapping authored\" and \"service key not\n * mapped\" as defined fallback paths — never as silent errors.\n */\n serviceHosts: ServiceHostsMapSchema.optional(),\n kubernetes: InfraEnvKubernetesSchema.optional(),\n remoteProvider: WildoRemoteProviderSchema.strict().optional(),\n deployment: WildoDeploymentConfigSchema.optional(),\n backingServices: BackingServicesEnvConfigSchema,\n /**\n * Per-environment logging posture. `level` is projected to `LOG_LEVEL`\n * by `env-vars-builder` for every long-running platform/application\n * process (`LoggerService.loadConfiguration` reads it at boot);\n * `formattedConsoleErrors` is projected to `LOG_FORMATTED_CONSOLE_ERRORS`\n * and overrides the auto-detected pino-pretty / JSON branch for\n * environments that want explicit control. Persisted into\n * `PlatformEnvConfigJson.logging` and hydrated back by\n * `hydrateEnvironmentFromConfig` so the runtime contract survives a\n * `wildo config sync` cycle.\n */\n logging: WildoLoggingConfigSchema.optional(),\n /**\n * Per-environment OTLP telemetry posture (Slice 2 Phase 5). `enabled` is projected to\n * `OTEL_ENABLED` and drives the `--import @wildo-ai/saas-backend-lib/otel-preload` wiring;\n * `endpoint` is projected to `OTEL_EXPORTER_OTLP_ENDPOINT`. The provider auth header\n * (`OTEL_EXPORTER_OTLP_HEADERS`) is derived from the selected `OBSERVABILITY_TELEMETRY`\n * provider's secret by `env-vars-builder`, not authored here. Persisted into\n * `PlatformEnvConfigJson.observability` and hydrated by `hydrateEnvironmentFromConfig`.\n */\n observability: WildoObservabilityConfigSchema.optional(),\n /**\n * Per-environment external-provider SELECTION override. Overrides the\n * app-wide `providers.scopes.backend.selection[capability]` primary/whenUnavailable\n * from `wildo.saas.config.ts` for THIS environment only — e.g. author\n * `providerSelection: { EMAIL_TRANSACTIONAL: { primary: 'email-preview' } }`\n * in `wildo.infra.local.config.ts` so local uses the non-sending\n * `email-preview` provider while remote envs keep the SaaS-config default\n * (`resend`). Projected to `WILDO_PROVIDER_SELECTION_OVERRIDES` by\n * `env-vars-builder` and applied by `ExternalProvidersRegistryBackendService`.\n * See {@link WildoProviderSelectionOverridesSchema}.\n */\n providerSelection: WildoProviderSelectionOverridesSchema.optional(),\n /**\n * Per-environment origins the documentation site is BUILT against.\n *\n * A docs bundle is static, so the origins are compiled in: a bundle built with the\n * wrong ones points every reader at the wrong host rather than failing. Authoring them\n * per environment is what lets `wildo config sync` carry them, instead of an operator\n * remembering three env vars on a build command.\n *\n * Projected to `WILDO_DOCS_API_BASE_URL` / `WILDO_DOCS_APP_URL` /\n * `WILDO_DOCS_FRONTEND_SERVICE_NAME` by `env-vars-builder`.\n * See {@link WildoDocumentationSiteConfigSchema}.\n */\n documentationSite: WildoDocumentationSiteConfigSchema.optional(),\n /**\n * Local-only operator configuration for application-creation verification.\n * The authored value is snapshotted into generated `config.json` and then\n * projected into the app-root `.env`; `.env` is never the authoring source.\n */\n applicationCreationVerification: ApplicationCreationVerificationConfigSchema.optional(),\n serviceAuth: WildoAuthConfigSchema.strict().optional(),\n /**\n * Per-environment Content-Security-Policy overrides, keyed by SaaS-config\n * service key (parallel to the `serviceHosts` keying convention).\n *\n * # Consumer wiring\n *\n * The generic resolver in `platform-config-lib` accepts this layer,\n * and `wildo dev sync-csp` is the first build-time consumer that\n * threads `parsed.csp[serviceKey]` into generated frontend CSP\n * artifacts and nginx marker rewrites. `defineInfraEnvConfig` still\n * emits a one-line stderr warning for authored service keys that are\n * not explicitly declared as consumed by the current loader; known\n * CSP-capable frontend keys are suppressed by the CLI while it loads\n * the shared infra config.\n *\n * Cross-validation against SaaS-config service keys is not enforceable\n * inside this schema alone because the infra config file is parsed\n * independently. Consumers that load both files together must validate\n * their own seam; `wildo dev sync-csp` rejects unknown `csp.<key>`\n * entries before emitting generated artifacts.\n *\n * # Where this fits in the layered CSP cake\n *\n * 1. Platform default (per-`AppFrontendType` baseline) — `csp-defaults.ts`.\n * 2. App-static (per-frontend `csp?` block) — authored on each\n * service-definition (today: `wildo.tech-doc.config.ts.csp?` per\n * `saas-technical-doc.md` Step 7.5).\n * 3. **THIS FIELD** — env-specific overrides authored under\n * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. The\n * `resolveCspPolicy({ envOverride, environmentId })` resolver\n * in `platform-config-lib/src/project-config/shared/csp-emit.ts`\n * accepts this shape, the schema's `superRefine` enforces the\n * LOCAL-only `viteDevLoosening` rule, and `wildo dev sync-csp`\n * reads `parsed.csp[serviceKey]` when generating service-local\n * artifacts.\n *\n * # Why per-env overrides exist\n *\n * - Sentry / DataDog ingest origins differ per deployment (staging\n * vs production violation collectors).\n * - Vite dev mode needs `'unsafe-inline'` + `'unsafe-eval'` in\n * `script-src` (HMR client bootstrap injects an inline `<script>`,\n * module/sourcemap transforms run through `eval()`). The\n * framework auto-applies this for `local` + `SAAS_APP` via the\n * resolver's auto-default; the `viteDevLoosening` field exists\n * only for explicit opt-out (debugging real CSP issues) or for\n * non-canonical envs that also run Vite dev.\n * - Per-env `reportOnly` ramping: ship `reportOnly: true` in\n * staging while the violation collector ramps up, flip to\n * enforcing in prod once the directive overrides settle.\n *\n * # Always additive (resolver contract)\n *\n * Env-layer entries can only LOOSEN policy (`extraDirectives` is\n * APPEND-only over the app-static layer; `reportOnly` / `reportUri`\n * scalars override the app-static value when present;\n * `viteDevLoosening: true` appends `'unsafe-inline'` and\n * `'unsafe-eval'` to `script-src`). There is no `'replace-baseline'`\n * equivalent at this layer — env config exists to LOOSEN per-\n * deployment, not to replace an app's chosen posture. If an env\n * genuinely needs a different posture, the right answer is to fix\n * the app-static layer.\n *\n * # `.optional()` rationale\n *\n * Most environments (local dev, single-frontend SaaS apps that\n * accept the baseline policy verbatim) do not author per-service\n * CSP overrides. Downstream consumers MUST handle both \"no overrides\n * authored\" and \"service key not mapped\" as defined no-op fallbacks\n * — never as silent errors.\n *\n * `EnvCspOverrideSchema` is itself `z.strictObject` (csp.schemas.ts),\n * so unknown keys inside an authored override are rejected at the\n * inner-record level — no need to re-apply `.strict()` at the\n * `z.record` value position.\n */\n csp: z\n .record(z.string().min(1), EnvCspOverrideSchema)\n .optional(),\n /**\n * Per-service OPT-IN to CDN serving, keyed by SaaS-config service key\n * (same keyspace as `serviceHosts` / `csp`). Authoring an `enabled` entry\n * makes the deploy render skip the service's nginx Deployment/Service AND\n * its ingress / compose route — its public host is served off-cluster by a\n * CDN fronting an object-storage bucket, while `runtime.endPoints.publicUrl`\n * stays `<serviceHost>.<publicDomain>` (coherence preserved). See\n * {@link WildoCdnConfigSchema}. `wildo frontend publish` uploads the built\n * `dist/` + re-homes CSP to the edge for these services.\n *\n * `.optional()` — most apps serve every frontend from an nginx pod (no CDN);\n * consumers MUST treat \"no cdn authored\" and \"service key not mapped\" as the\n * defined no-op (nginx-served) fallback. `WildoCdnConfigSchema` is itself\n * `z.strictObject`, so unknown keys inside an authored entry are rejected at\n * the inner level — no `.strict()` needed at the `z.record` value position.\n */\n cdn: z\n .record(z.string().min(1), WildoCdnConfigSchema)\n .optional(),\n devCompanion: InfraServiceAddressingSchema.optional(),\n}).strict().superRefine((config, ctx) => {\n const resolvedEnvironment = config.environment;\n\n const resolvedLocationType = config.locationType\n ?? (isLocalEnvironmentId(resolvedEnvironment) ? WildoLocationType.LOCAL : WildoLocationType.REMOTE);\n\n if (isLocalEnvironmentId(resolvedEnvironment) && resolvedLocationType === WildoLocationType.REMOTE) {\n ctx.addIssue({\n code: 'custom',\n path: ['locationType'],\n message: `\"${resolvedEnvironment}\" environment cannot use remote locationType`,\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && resolvedLocationType === WildoLocationType.LOCAL) {\n ctx.addIssue({\n code: 'custom',\n path: ['locationType'],\n message: 'Only the \"local\" environment id can use local locationType',\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && !config.runtimeEnvironment) {\n ctx.addIssue({\n code: 'custom',\n path: ['runtimeEnvironment'],\n message: 'runtimeEnvironment is required for remote environments',\n });\n }\n\n /**\n * A declared PostgreSQL platform must declare the stores it actually needs — checked HERE, at\n * author time, rather than only at env generation.\n *\n * `env-vars-builder` already throws on both of these, but it throws during\n * `wildo config sync`, i.e. after the operator has committed the config and moved on. The same\n * refusal at parse time names the problem while the file is still open. The runtime throws\n * REMAIN as the backstop — they also guard generated/non-authored paths this schema never sees\n * (see `.claude/rules/invariant-call-site-enumeration.md`: an invariant enforced at one of its\n * sites is enforced at none of the others).\n */\n if (config.database?.engine === DatabaseEngine.POSTGRESQL) {\n if (!config.backingServices[BackingServiceKind.POSTGRESQL]) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['backingServices', BackingServiceKind.POSTGRESQL],\n message:\n 'database.engine is POSTGRESQL but no `backingServices.postgresql` is declared: the platform '\n + 'would be pointed at a PostgreSQL that nothing provisions. Declare it, or drop `database` '\n + 'to let the engine be inferred.',\n });\n }\n\n /**\n * RETIRED 2026-08-28. A PostgreSQL-engined platform no longer requires a mongod.\n *\n * This used to refuse a PostgreSQL platform that did not also declare\n * `backingServices.mongodb: { source: SELF }`, on two stated grounds — and BOTH had since been\n * met, which is exactly why it needed retiring rather than keeping:\n *\n * 1. \"six resources declare `persistenceAdapter: MONGODB`\" — retired 2026-08-22 (item C).\n * `bootstrap-plane-persistence-adapter.test.ts` now asserts the INVERSE, that none of the\n * six declares an adapter, so re-pinning any one of them fails that suite.\n * 2. \"`crontabs-batches-manager` … with zero PostgreSQL awareness\" — ported (item D). On a\n * PostgreSQL platform it takes `connectWithUrl(postgresUrl)` and never opens a Mongo\n * connection at all.\n *\n * The guard's own instruction was \"retire this together with those pins and the crontabs port —\n * NOT before\". Both landed; nobody came back. What kept a mongod alive after that was a THIRD\n * reason neither the guard nor its message ever named: apps-manager's env schema declared\n * `MONGO_CONNECT_URL` and `BASE_MONGO_SERVER_URL` as unconditionally REQUIRED, and its INIT\n * threw without them. That is the shape worth remembering — a transitional guard whose recorded\n * checklist is fully ticked while the real blocker sits somewhere it does not mention. Those\n * env keys are now engine-conditional, so nothing forces a mongod any more.\n *\n * A mongod remains perfectly legal to declare, and is still REQUIRED in practice for a platform\n * that hosts Mongo-backed applications — but that is an operator's judgment about the\n * applications they run, exactly as the `applicationDatabase` rule below already argues, and not\n * something this schema can decide for them.\n */\n }\n\n /**\n * An application cannot persist to a store the environment does not declare.\n *\n * Deliberately NOT symmetric with the platform rule above: that one also requires MongoDB to stay\n * declared, because the platform's own BOOTSTRAP plane is Mongo-wired. An application has no such\n * plane — once its resources are on PostgreSQL, nothing of the application's needs a mongod — so\n * requiring one here would forbid the very end-state this field exists to reach.\n */\n if (config.applicationDatabase?.engine === DatabaseEngine.POSTGRESQL\n && config.backingServices[BackingServiceKind.POSTGRESQL] === undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['backingServices', BackingServiceKind.POSTGRESQL],\n message:\n 'applicationDatabase.engine is POSTGRESQL but no `backingServices.postgresql` is declared: the '\n + 'application would be pointed at a PostgreSQL that nothing provisions. Declare it alongside.',\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && config.applicationCreationVerification !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['applicationCreationVerification'],\n message: 'applicationCreationVerification is local-only and must be authored in wildo.infra.local.config.ts.',\n });\n }\n\n if (\n !isLocalEnvironmentId(resolvedEnvironment)\n && resolvedLocationType === WildoLocationType.REMOTE\n && config.runtime === WildoDeploymentRuntime.KUBERNETES\n ) {\n if (!config.remoteProvider) {\n ctx.addIssue({\n code: 'custom',\n path: ['remoteProvider'],\n message: 'remoteProvider is required for remote Kubernetes environments',\n });\n }\n if (!config.kubernetes) {\n ctx.addIssue({\n code: 'custom',\n path: ['kubernetes'],\n message: 'kubernetes is required for remote Kubernetes environments',\n });\n }\n }\n\n // CSP env-layer dev-only escape hatch — `viteDevLoosening: true`\n // injects BOTH `'unsafe-inline'` and `'unsafe-eval'` into `script-src`\n // (Vite's HMR client bootstrap is an inline `<script>` and its module\n // / sourcemap transforms run through `eval()`). The auto-default\n // already handles the canonical case (`local` + `SAAS_APP` →\n // auto-true). Explicit `viteDevLoosening: true` is REJECTED outside\n // the LOCAL environment because shipping `'unsafe-inline'` +\n // `'unsafe-eval'` to staging / production would punch a hole through\n // the entire CSP posture (every XSS payload becomes scriptable via\n // `eval()`-style sinks the baseline specifically denies, and inline\n // `<script>` injection escapes nonce-/hash-based mitigation). Failing\n // fast at parse time prevents an authored `csp.app.viteDevLoosening:\n // true` entry from silently shipping to production via a copy-paste\n // from the local config.\n if (config.csp && !isLocalEnvironmentId(resolvedEnvironment)) {\n for (const [serviceKey, override] of Object.entries(config.csp)) {\n if (override?.viteDevLoosening === true) {\n ctx.addIssue({\n code: 'custom',\n path: ['csp', serviceKey, 'viteDevLoosening'],\n message:\n `csp.${serviceKey}.viteDevLoosening cannot be true in environment \"${resolvedEnvironment}\" — `\n + `the dev-only escape hatch is restricted to \"${WildoEnvironment.LOCAL}\". `\n + `Author this flag ONLY in wildo.infra.local.config.ts; remote envs MUST reject `\n + `'unsafe-inline'/'unsafe-eval' so XSS payloads can't reach eval-style sinks or `\n + `inline-script injection. Production Vite builds emit <script type=\"module\"> with `\n + `no inline scripts and no eval(), so production envs never NEED this flag.`,\n });\n }\n }\n }\n\n // CDN serving is a REMOTE-only concern: it replaces a frontend's nginx pod\n // (Deployment + Service + ingress route), which exists ONLY in a remote\n // k8s/compose deploy. Local dev runs native frontend dev servers — there is\n // no nginx pod to skip and nowhere to publish to. Reject an authored `cdn`\n // block outside a remote env at parse time so a config copy-pasted from a\n // remote env can't silently make `wildo frontend publish --env local`\n // attempt an S3 upload (and so the semantic stays enforced, not implicit).\n if (config.cdn && resolvedLocationType !== WildoLocationType.REMOTE) {\n for (const serviceKey of Object.keys(config.cdn)) {\n ctx.addIssue({\n code: 'custom',\n path: ['cdn', serviceKey],\n message:\n `cdn.${serviceKey} is only valid in a REMOTE environment — CDN serving replaces the `\n + `frontend's nginx pod, which local dev does not have. Author cdn blocks only in `\n + `wildo.infra.remote.config.ts (staging / production).`,\n });\n }\n }\n});\n\nexport const WildoInfraEnvConfigSchema = WildoInfraEnvConfigInputSchema.transform((config) => {\n const environment = config.environment;\n const locationType = config.locationType\n ?? (isLocalEnvironmentId(environment) ? WildoLocationType.LOCAL : WildoLocationType.REMOTE);\n\n return {\n version: config.version,\n environment,\n locationType,\n runtimeEnvironment: config.runtimeEnvironment,\n runtime: config.runtime,\n /**\n * Projected EXPLICITLY, like every field here — this list IS the contract, and a field omitted\n * from it is silently dropped no matter what the input schema accepted. `undefined` when the\n * environment does not author one, which is the signal downstream consumers use to fall back to\n * `inferDatabaseChoiceFromInfraConfig`.\n */\n database: config.database,\n applicationDatabase: config.applicationDatabase,\n publicDomain: config.publicDomain,\n serviceHosts: config.serviceHosts,\n kubernetes: config.kubernetes,\n remoteProvider: config.remoteProvider,\n deployment: config.deployment,\n backingServices: config.backingServices,\n logging: config.logging,\n observability: config.observability,\n providerSelection: config.providerSelection,\n applicationCreationVerification: config.applicationCreationVerification,\n serviceAuth: config.serviceAuth,\n csp: config.csp,\n cdn: config.cdn,\n documentationSite: config.documentationSite,\n devCompanion: config.devCompanion,\n };\n});\n\nexport type WildoInfraEnvConfig = z.output<typeof WildoInfraEnvConfigSchema>;\nexport type WildoInfraEnvConfigInput = z.input<typeof WildoInfraEnvConfigSchema>;\n\n/**\n * Scope `csp.<serviceKey>` warning suppression to the current async load path.\n *\n * The docs CSP generator loads authored infra config through `loadConfig()`,\n * which evaluates `defineInfraEnvConfig(...)` inside the same process. Using\n * an async-local context lets that loader declare which keys are actively\n * consumed without mutating `process.env` across concurrent config loads.\n *\n * `WILDO_CONSUMED_INFRA_CSP_SERVICE_KEYS` remains supported as a coarse global\n * fallback (tests / external callers), but in-process loaders SHOULD prefer\n * this helper so suppression cannot leak between unrelated async work.\n */\nexport async function withConsumedInfraCspServiceKeys<T>(\n serviceKeys: Iterable<string>,\n callback: () => Promise<T> | T,\n): Promise<T> {\n const normalizedKeys = new Set(\n [...serviceKeys]\n .map((value) => value.trim())\n .filter((value) => value.length > 0),\n );\n if (normalizedKeys.size === 0) {\n return await callback();\n }\n const parentKeys = consumedInfraCspServiceKeysContext.getStore();\n const mergedKeys = new Set(parentKeys ?? []);\n for (const serviceKey of normalizedKeys) {\n mergedKeys.add(serviceKey);\n }\n return await consumedInfraCspServiceKeysContext.run(mergedKeys, callback);\n}\n\n/**\n * Define an app-owned environment descriptor under `infrastructure/<env>`.\n *\n * This is the canonical authored env contract for the flattened targeted-app\n * layout.\n *\n * After successful parsing, emits Slice 3.5 `@unimplemented` warnings for\n * authored fields that remain reserved or are not declared as consumed by\n * the current loader — see `_unimplemented/unimplemented-field-warning.ts`\n * for the design rationale (channel = stderr, dedupe = once-per-call,\n * format = single-line with backlog ID).\n */\nexport function defineInfraEnvConfig(config: WildoInfraEnvConfigInput): WildoInfraEnvConfig {\n const parsed = WildoInfraEnvConfigSchema.parse(config);\n emitInfraUnimplementedRuntimeWarnings(parsed);\n return parsed;\n}\n\n/**\n * Emit `@unimplemented` parse-time warnings for every authored\n * `WildoInfraEnvConfig` field that remains reserved or is not declared as\n * consumed by the current loader (Slice 3.5 contract — see\n * `_unimplemented/unimplemented-field-warning.ts`).\n *\n * Surfaces today (2 field families):\n *\n * - `version` (!== undefined) → `D-5`\n * - `csp.<serviceKey>` (each authored entry) → `B-2C` (auth-hardening\n * Slice B Step 2 closeout — the schema reservation shipped, the\n * superRefine guard against `viteDevLoosening: true` outside LOCAL\n * is live, and `wildo dev sync-csp` declares the CSP-capable\n * frontend service keys it consumes while loading authored infra\n * config, so warnings remain reserved for genuinely unconsumed keys.)\n *\n * `logging.{level, formattedConsoleErrors}` is intentionally NOT in this\n * list: Slice 3.5 wires both fields end-to-end (persistence,\n * `env-vars-builder` → `LOG_LEVEL` / `LOG_FORMATTED_CONSOLE_ERRORS`,\n * `LoggerService.loadConfiguration`), so they have a real runtime\n * consumer and silence is the honest behavior.\n *\n * `domain` is intentionally NOT in this list either: Slice 3.5 deleted\n * the field outright as a wrong-seam, and the post-Slice-3.5\n * `external-public-domain-rename.md` follow-up renamed the canonical\n * hostname seam to top-level `publicDomain` (replacing the misnamed\n * `kubernetes.baseDomain` of Slice 3.5). Both `domain` and\n * `kubernetes.baseDomain` are now strict-rejected by the schema —\n * the canonical seam is `publicDomain` at the top level. See the\n * strict-pin tests in `__tests__/define-infra-env-config.unimplemented.test.ts`.\n *\n * When the deferred backlog item lands, the matching `if` branch below\n * MUST be removed in the same commit as the runtime wiring — leaving a\n * stale warning is worse than silence.\n */\nfunction emitInfraUnimplementedRuntimeWarnings(config: WildoInfraEnvConfig): void {\n const warn = createUnimplementedFieldWarner(UnimplementedFieldSource.INFRA_ENV_CONFIG);\n const AUTH_HARDENING_PLAN_PATH = '.cursor/plans/auth-hardening.md';\n const consumedCspServiceKeys = getConsumedInfraCspServiceKeys();\n\n if (config.version !== undefined) {\n warn('version', 'D-5');\n }\n\n if (config.csp !== undefined) {\n // Walk every authored service key so a multi-service author\n // (e.g. csp: { docs: {…}, app: {…} }) sees one warning per\n // service — the dedupe key is the field path, so per-key\n // emission is what matches the createUnimplementedFieldWarner\n // contract.\n for (const serviceKey of Object.keys(config.csp)) {\n if (consumedCspServiceKeys.has(serviceKey)) {\n continue;\n }\n warn(`csp.${serviceKey}`, 'B-2C', AUTH_HARDENING_PLAN_PATH);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"define-infra-env-config.js","sourceRoot":"","sources":["../../../../src/project-config/define-infra-env-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,2CAA2C,EAAE,MAAM,oDAAoD,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAC7H,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mCAAmC,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,oB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AAC,EAAE,CAAC;gBAC3C,SAAS;YACX,CAAC;YACD,IAAI,CAAC,OAAO,UAAU,EAAE,EAAE,MAAM,EAAE,wBAAwB,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\nimport { RuntimeEnvironment } from '@wildo-ai/saas-models';\nimport { z } from 'zod';\nimport {\n UnimplementedFieldSource,\n createUnimplementedFieldWarner,\n} from '../_unimplemented/unimplemented-field-warning';\nimport { WildoAuthConfigSchema } from './shared/auth.schemas';\nimport { ApplicationCreationVerificationConfigSchema } from './shared/application-creation-verification.schemas';\nimport { BackingServiceKind, BackingServiceSource, BackingServicesEnvConfigSchema } from './shared/backing-services.schemas';\nimport { WildoCdnConfigSchema } from './shared/cdn.schemas';\nimport { WildoSystemsOfRecordEnvConfigSchema } from './shared/systems-of-record-env.schemas';\nimport { WildoPlatformStorageConfigSchema } from './shared/platform-storage.schemas';\nimport { EnvCspOverrideSchema } from './shared/csp.schemas';\nimport { WildoSchemaVersionSchema } from './shared/schema-version.schemas';\nimport {\n InfraServiceAddressingSchema,\n} from './shared/infra-service.schemas';\nimport {\n DatabaseEngine,\n resolveApplicationDatabaseEngine,\n WildoDeploymentConfigSchema,\n WildoDeploymentRuntime,\n WildoEnvironment,\n WildoEnvironmentIdSchema,\n WildoKubernetesConfigSchema,\n WildoLocationType,\n WildoLocalDataStorage,\n resolveDefaultLocalDataStorage,\n WildoLoggingConfigSchema,\n WildoObservabilityConfigSchema,\n WildoDocumentationSiteConfigSchema,\n WildoEnvironmentProviderConfigurationsSchema,\n WildoProviderSelectionOverridesSchema,\n WildoRemoteProviderSchema,\n WildoImageTagStrategy,\n isLocalEnvironmentId,\n} from './shared/environment.schemas';\n\nconst InfraEnvKubernetesSchema = WildoKubernetesConfigSchema.strict();\n\n/**\n * A POSIX (`/…`), drive-letter (`C:\\…`, `C:/…`) or UNC (`\\\\host\\…`) absolute path.\n *\n * A pattern rather than `node:path`'s `isAbsolute` so the verdict does not depend on the platform the\n * descriptor happens to be evaluated on: a Windows path committed by one developer must read as absolute\n * on another's macOS machine too, or a machine-local host path could slip into a committed descriptor.\n */\nconst ABSOLUTE_PATH_PATTERN = /^(?:\\/|[A-Za-z]:[\\\\/]|\\\\\\\\)/;\n\n/**\n * DNS subdomain chain regex: one or more lowercase RFC 1123 labels\n * joined by dots. Empty string is allowed separately via the union\n * below — it means \"this service lives at the apex of `publicDomain`\".\n *\n * Examples accepted: `'app'`, `'docs'`, `'dev'`, `'www2'`, `'admin.ops'`.\n * Examples rejected: `'App'` (uppercase), `'-app'` / `'app-'`\n * (dash at boundary), `'app..docs'` / `'.app'` / `'app.'` (malformed\n * dots), `'a/b'` (non-DNS character).\n */\nconst SERVICE_HOST_LABEL = /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/;\n\n/**\n * Per-service public hostname mapping, authored per-environment.\n *\n * - **Keys** are service keys from `wildo.saas.config.ts`\n * (`config.services.<key>`). The mapping is NOT validated against\n * the SaaS config at the Zod level (the two configs live in\n * separate files and are parsed independently). Cross-file\n * validation against the SaaS-config service registry is the\n * responsibility of consumers that wire the two parsed configs\n * together (URL composers, ingress manifest generators) — each\n * consumer enforces it at the seam where both configs are in\n * scope. This schema cannot enforce it standalone.\n * - **Values** are the subdomain chain prefixed to `publicDomain`, OR\n * the empty string for apex. Composed as\n * `https://${value ? `${value}.` : ''}${publicDomain}`.\n *\n * The mapping is intentionally per-environment (living inside\n * `wildo.infra.<env>.config.ts`) because local / staging / production\n * routinely have different topologies — e.g., local collapses\n * everything to `localhost`, staging mounts everything under\n * `*.staging.example.com`, production uses bespoke subdomains like\n * `app.example.com` + `dev.example.com` for docs. Binding the\n * hostname to a frontend kind or to the service key would force a\n * single topology on every environment; the per-env map keeps those\n * decisions explicit and author-driven.\n *\n * See `cross-app-jwt-propagation.md` Step 1 for the motivating\n * decision and the Step 2 URL composer that consumes this mapping\n * when building cross-frontend handoff URLs.\n */\nconst ServiceHostValueSchema = z.string()\n .refine(\n (value) => value === '' || SERVICE_HOST_LABEL.test(value),\n 'serviceHosts value must be a lowercase DNS subdomain chain (e.g. \"app\", \"docs\", \"dev.admin\") or \"\" (empty string, meaning apex).',\n );\n\nconst ServiceHostsMapSchema = z.record(z.string().min(1), ServiceHostValueSchema);\nconst consumedInfraCspServiceKeysContext = new AsyncLocalStorage<ReadonlySet<string>>();\n\nfunction parseConsumedInfraCspServiceKeysFromEnv(): ReadonlySet<string> {\n return new Set(\n (process.env.WILDO_CONSUMED_INFRA_CSP_SERVICE_KEYS ?? '')\n .split(',')\n .map((value) => value.trim())\n .filter((value) => value.length > 0),\n );\n}\n\nfunction getConsumedInfraCspServiceKeys(): ReadonlySet<string> {\n const contextKeys = consumedInfraCspServiceKeysContext.getStore();\n const envKeys = parseConsumedInfraCspServiceKeysFromEnv();\n if (contextKeys === undefined || contextKeys.size === 0) {\n return envKeys;\n }\n if (envKeys.size === 0) {\n return contextKeys;\n }\n return new Set([...contextKeys, ...envKeys]);\n}\n\n/**\n * The shape of a STANDALONE environment descriptor — one that owns its infrastructure.\n *\n * Kept as a plain object rather than inlined into `z.object(...)` because the HOSTED descriptor\n * ({@link WildoHostedInfraEnvConfigSchema}) is built from a subset of these same members. Zod 4 refuses\n * `.pick()` on an object that carries refinements, so sharing the members is the only way the two\n * descriptors can agree on what an application-owned field IS without restating it.\n */\nconst WILDO_INFRA_ENV_CONFIG_SHAPE = {\n /**\n * Authored schema-format version for this `wildo.infra.<env>.config.ts`,\n * expressed as a **SemVer 2.0.0 string** (e.g. `'1.0.0'`,\n * `'2.3.1-rc.1'`, `'1.0.0+build.42'`).\n *\n * @unimplemented Slice 3.5 wires a parse-time warning when this is\n * authored. The full schema-evolution / migration tooling story is\n * tracked under deferred-backlog **D-5**\n * (`.cursor/plans/post-flattening-completion-fixes.md`). Symmetrical\n * with `WildoSaasConfig.version` — both reservations land/retire\n * together so the migration tooling, when it ships, can target both\n * authored configs through a single mechanism. SemVer (not a bare\n * integer) was chosen for the same reason as on the SaaS-config side\n * — see the JSDoc on `WildoSaasConfig.version`. Field is `.optional()`\n * (no Zod default) so unauthored configs stay silent.\n */\n version: WildoSchemaVersionSchema.optional(),\n environment: WildoEnvironmentIdSchema,\n locationType: z.enum(WildoLocationType).optional(),\n runtimeEnvironment: z.enum(RuntimeEnvironment).optional(),\n runtime: z.enum(WildoDeploymentRuntime),\n /**\n * Where the self-hosted backing services of a DOCKER_COMPOSE environment keep their data —\n * a Docker named volume, or a bind mount onto `<saas-root>/.wildo-saas/local_data/<service>/`.\n *\n * Omit it and the environment takes {@link resolveDefaultLocalDataStorage}: a named volume\n * locally (the host-filesystem crossing costs ~4 CPU cores on macOS and Windows, and a named\n * volume costs a Linux developer nothing), a host path remotely (the operator chooses the disk\n * the database lands on). Author it to say otherwise — a remote deployment happy with Docker's\n * own storage, or a local developer who wants to read the files directly.\n *\n * Ignored by KUBERNETES environments, which take their storage from PVs rather than from here.\n */\n localDataStorage: z.enum(WildoLocalDataStorage).optional(),\n /**\n * The store the PLATFORM's own data lives in (apps-manager + module-registry:\n * users, organizations, applications, sessions, API keys).\n *\n * **This is a DECLARED property of the environment, and that is the whole point.** It used to\n * exist only as an answer to an interactive prompt, persisted to the machine-local\n * `environments.json` — so it could not be committed, reviewed, or reproduced on a second\n * machine, and a value inferred from which backing services happened to be declared filled the\n * gap. Authoring it here makes it travel with the repository like every other environment\n * property.\n *\n * OPTIONAL. When omitted, the engine is INFERRED from the declared backing services\n * (`inferDatabaseChoiceFromInfraConfig`), which is what every pre-existing environment relies\n * on — so omitting this field preserves today's behaviour exactly. When authored, it is the\n * AUTHORITY and the inference is not consulted.\n *\n * Authoring it is REQUIRED to express a PostgreSQL platform that ALSO runs a mongod, because the\n * inference resolves `postgresql && mongodb` to MongoDB — so that dual-store combination is\n * unreachable by inference, by construction. Since 2026-08-28 a PostgreSQL platform no longer has\n * to declare `backingServices.mongodb` at all (see the refinement below), so the single-store case\n * is now expressible too.\n *\n * @example A PostgreSQL platform, no mongod.\n * ```ts\n * database: { engine: DatabaseEngine.POSTGRESQL, source: BackingServiceSource.SELF },\n * backingServices: { postgresql: { source: BackingServiceSource.SELF } },\n * ```\n *\n * @example A DUAL-STORE platform — PostgreSQL for itself, a mongod beside it for the Mongo-backed\n * applications it hosts. This is the shape that needs `database` authored.\n * ```ts\n * database: { engine: DatabaseEngine.POSTGRESQL, source: BackingServiceSource.SELF },\n * backingServices: {\n * mongodb: { source: BackingServiceSource.SELF },\n * postgresql: { source: BackingServiceSource.SELF },\n * },\n * ```\n *\n * NOTE this is the PLATFORM's engine. An APPLICATION's own store is chosen separately by that\n * application's `DATABASE_DEFAULT_ADAPTER`; declaring `backingServices.postgresql` alone gives an\n * application a PostgreSQL substrate without moving the platform.\n */\n database: z\n .strictObject({\n engine: z.enum(DatabaseEngine),\n source: z.enum(BackingServiceSource),\n /**\n * Managed-brand identifier when `source === MANAGED` — `'atlas'` for Mongo; one of\n * `'aws-rds' | 'gcp-cloud-sql' | 'azure-database' | 'supabase' | 'neon' | 'render'` for\n * Postgres. Mirrors `PlatformEnvConfigJson['database'].provider` exactly; this field is\n * deliberately the same vocabulary rather than a parallel one.\n */\n provider: z.string().min(1).optional(),\n })\n .optional(),\n /** @wildo_source:part:start platform.config.application-database facet:layer:platform facet:family:bootstrap facet:audience:app-developer */\n /**\n * Which declared backing store the APPLICATION's own resources persist to.\n *\n * ## Why this is a SEPARATE field from `database`\n *\n * `database` above is the PLATFORM's engine — where apps-manager's own tables live. This one is the\n * application's, and the two move independently: a PostgreSQL platform can host a MongoDB\n * application and vice versa. Collapsing them would make one decision imply the other, which is\n * exactly the conflation the emitter's own contract warns against.\n *\n * ## Why it carries only `engine`\n *\n * The SUBSTRATE is already declared: `backingServices.postgresql` says where the database is and\n * who provisions it, and `env-vars-builder` already emits `POSTGRESQL_HOST/PORT/DATABASE` to the\n * application backend whenever the environment self-hosts one. What was missing is the SELECTION,\n * and only the selection belongs here.\n *\n * ## Why an authored field rather than an env variable\n *\n * The emitter states the rule this field exists to satisfy: *\"which store an application persists to\n * is a deployment decision that must be legible in one place, not an emergent property of which\n * variables happen to be set\"*. Before this, the only way to select PostgreSQL for an application\n * was to hand-edit `backend-api/.env` — machine-local, ungitted, and not reproducible on another\n * developer's machine. That is the same defect the platform `database` field above was added to\n * remove, and the reason both live in the authored, committed config.\n *\n * Absent means POSTGRESQL (`DEFAULT_APPLICATION_DATABASE_ENGINE`, decided 2026-09-24, #1571), and\n * every reader resolves it through `resolveApplicationDatabaseEngine` rather than re-deriving it —\n * two readers answering silence differently is what stranded an application on 2026-09-15. So an\n * environment that authors nothing here must still declare `backingServices.postgresql`; the\n * refinement below refuses it otherwise.\n *\n * @example An application on PostgreSQL, on a platform that is also on PostgreSQL.\n * ```ts\n * database: { engine: DatabaseEngine.POSTGRESQL, source: BackingServiceSource.SELF },\n * applicationDatabase: { engine: DatabaseEngine.POSTGRESQL },\n * backingServices: {\n * postgresql: { source: BackingServiceSource.SELF, database: 'my-app-db' },\n * },\n * ```\n */\n applicationDatabase: z\n .strictObject({\n engine: z.enum(DatabaseEngine),\n })\n .optional(),\n /**\n * ## Choosing PostgreSQL creates a standing obligation — MIGRATIONS\n *\n * This is the part that is easy to miss, and it is not a detail of deployment: on MongoDB a\n * collection exists the moment something writes to it, so a new resource needs nothing. On\n * PostgreSQL a resource's TABLE is built by a MIGRATION, and nothing creates it implicitly. So on\n * this engine, adding or reshaping a resource owes an artifact:\n *\n * - `wildo db diff` — what separates the model from the accepted plan;\n * - `wildo db generate --name <label>` — writes `backend-api/migrations/<timestamp>_<name>/`\n * AND advances `backend-api/migrations/schema-plan.lock.json`, in one step. Commit them\n * TOGETHER; either one alone is the two-artifact drift the design exists to prevent;\n * - `wildo db migrate` — applies pending migrations by hand. Usually unnecessary: the application\n * backend applies them at BOOT, and `wildo local dev` reconciles drift before the app starts.\n *\n * Skip it and nothing warns until the backend refuses to start with\n * `postgresql_table_schema_mismatch` — an accurate message that names neither the migration nor\n * the command. See the `application-database-migrations` skill.\n */\n /** @wildo_source:part:end platform.config.application-database */\n /**\n * Public domain that browsers and external clients use to reach this\n * deployment. Ingress / reverse proxy / DNS terminate here; every\n * service-level subdomain is mounted under it via {@link serviceHosts}\n * (`https://<serviceHost>.<publicDomain>`, e.g. `app.example.com`; a\n * `serviceHosts` value of `''` mounts the service at the apex). Greenfield,\n * single-app, mono-env — there is NO `<service>-<appSlug>-<env>` fan-out.\n *\n * Applies to BOTH `WildoDeploymentRuntime.KUBERNETES` and\n * `WildoDeploymentRuntime.DOCKER_COMPOSE`. For compose envs without a\n * reverse proxy, author `'localhost'` explicitly. For K8s local,\n * author `'local.wildo.ai'` (or your `*.local` apex). For remote,\n * author your apex (e.g. `'wonder-todos.com'`).\n *\n * NOT to be confused with the K8s-internal service-mesh hostname\n * (`<service>.<namespace>.svc.cluster.local`), which stays implicit\n * and is derived from `kubernetes.namespace` at composition time.\n *\n * REQUIRED — there is no read-time fallback. The default that\n * `wildo init` writes into the generated config file lives in\n * `PUBLIC_DOMAIN_DEFAULTS` (`infrastructure-defaults.schemas.ts`),\n * but the schema enforces explicit authoring so a hand-edited\n * config that drops the field fails Zod parse with a clear error\n * instead of silently falling back.\n */\n publicDomain: z.string().min(1),\n /**\n * Per-service public hostname authoring for this environment.\n *\n * The app developer maps each publicly-exposed service (by its\n * `services.<key>` in `wildo.saas.config.ts`) to the subdomain\n * chain under `publicDomain` where it is reachable in this\n * environment. An empty string value mounts the service at the\n * apex of `publicDomain`.\n *\n * An UNMAPPED service falls back to its own key, lowercased, as its\n * subdomain (`buildServicePublicHost`) — a defined path, not an error;\n * nothing is derived from `frontendType`. Author an entry whenever the\n * key is not the host you want, or is not a valid DNS label. Two\n * services resolving to one host are refused when a REMOTE\n * environment's ingress routes are built (`buildK8sApplicationIngressRoutes`);\n * a local environment builds none and a CDN-served frontend is excluded\n * from them, so neither is checked. (Corrected\n * 2026-09-13: this comment said there was NO derivation from the key,\n * which the resolver has not matched.) An app-dev who wants the\n * docs service to live at `dev.example.com` (rather than the more\n * conventional `docs.example.com`) writes\n * `serviceHosts: { docs: 'dev' }` here; an app-dev who splits\n * marketing across `example.com` and `landing.example.com` can\n * author `serviceHosts: { www: '', landing: 'landing' }` without\n * the framework second-guessing the intent.\n *\n * Field is `.optional()` because many projects (local dev,\n * Docker Compose collapsed to `localhost`, single-frontend SaaS\n * apps) do not need per-service hostname authoring. Downstream\n * consumers (URL composers, ingress manifest generators) MUST\n * handle both \"no mapping authored\" and \"service key not\n * mapped\" as defined fallback paths — never as silent errors.\n */\n serviceHosts: ServiceHostsMapSchema.optional(),\n kubernetes: InfraEnvKubernetesSchema.optional(),\n remoteProvider: WildoRemoteProviderSchema.strict().optional(),\n deployment: WildoDeploymentConfigSchema.optional(),\n backingServices: BackingServicesEnvConfigSchema,\n /**\n * Per-environment logging posture. `level` is projected to `LOG_LEVEL`\n * by `env-vars-builder` for every long-running platform/application\n * process (`LoggerService.loadConfiguration` reads it at boot);\n * `formattedConsoleErrors` is projected to `LOG_FORMATTED_CONSOLE_ERRORS`\n * and overrides the auto-detected pino-pretty / JSON branch for\n * environments that want explicit control. Persisted into\n * `PlatformEnvConfigJson.logging` and hydrated back by\n * `hydrateEnvironmentFromConfig` so the runtime contract survives a\n * `wildo config sync` cycle.\n */\n logging: WildoLoggingConfigSchema.optional(),\n /**\n * Per-environment OTLP telemetry posture (Slice 2 Phase 5). `enabled` is projected to\n * `OTEL_ENABLED` and drives the `--import @wildo-ai/saas-backend-lib/otel-preload` wiring;\n * `endpoint` is projected to `OTEL_EXPORTER_OTLP_ENDPOINT`. The provider auth header\n * (`OTEL_EXPORTER_OTLP_HEADERS`) is derived from the selected `OBSERVABILITY_TELEMETRY`\n * provider's secret by `env-vars-builder`, not authored here. Persisted into\n * `PlatformEnvConfigJson.observability` and hydrated by `hydrateEnvironmentFromConfig`.\n */\n observability: WildoObservabilityConfigSchema.optional(),\n /**\n * Per-environment external-provider SELECTION override. Overrides the\n * app-wide `providers.scopes.backend.selection[capability]` primary/whenUnavailable\n * from `wildo.saas.config.ts` for THIS environment only — e.g. author\n * `providerSelection: { EMAIL_TRANSACTIONAL: { primary: 'email-preview' } }`\n * in `wildo.infra.local.config.ts` so local uses the non-sending\n * `email-preview` provider while remote envs keep the SaaS-config default\n * (`resend`). Projected to `WILDO_PROVIDER_SELECTION_OVERRIDES` by\n * `env-vars-builder` and applied by `ExternalProvidersRegistryBackendService`.\n * See {@link WildoProviderSelectionOverridesSchema}.\n */\n providerSelection: WildoProviderSelectionOverridesSchema.optional(),\n /**\n * Per-environment provider configuration values — an OAuth client ID, a frontend SDK DSN or site key — laid over\n * `wildo.saas.config.ts > providerConfigurations` key by key for THIS environment. Author here every value a vendor\n * issued against one deployment; keep application policy (an agent execution profile) in the SaaS config.\n * Never a secret: those stay in `secrets.json → providerEnv`. See\n * {@link WildoEnvironmentProviderConfigurationsSchema}.\n */\n providerConfigurations: WildoEnvironmentProviderConfigurationsSchema.optional(),\n /**\n * Per-environment origins the documentation site is BUILT against.\n *\n * A docs bundle is static, so the origins are compiled in: a bundle built with the\n * wrong ones points every reader at the wrong host rather than failing. Authoring them\n * per environment is what lets `wildo config sync` carry them, instead of an operator\n * remembering three env vars on a build command.\n *\n * Projected to `WILDO_DOCS_API_BASE_URL` / `WILDO_DOCS_APP_URL` /\n * `WILDO_DOCS_FRONTEND_SERVICE_NAME` by `env-vars-builder`.\n * See {@link WildoDocumentationSiteConfigSchema}.\n */\n documentationSite: WildoDocumentationSiteConfigSchema.optional(),\n /**\n * Local-only operator configuration for application-creation verification.\n * The authored value is snapshotted into generated `config.json` and then\n * projected into the app-root `.env`; `.env` is never the authoring source.\n */\n applicationCreationVerification: ApplicationCreationVerificationConfigSchema.optional(),\n serviceAuth: WildoAuthConfigSchema.strict().optional(),\n /**\n * Per-environment Content-Security-Policy overrides, keyed by SaaS-config\n * service key (parallel to the `serviceHosts` keying convention).\n *\n * # Consumer wiring\n *\n * The generic resolver in `platform-config-lib` accepts this layer,\n * and `wildo dev sync-csp` is the first build-time consumer that\n * threads `parsed.csp[serviceKey]` into generated frontend CSP\n * artifacts and nginx marker rewrites. `defineInfraEnvConfig` still\n * emits a one-line stderr warning for authored service keys that are\n * not explicitly declared as consumed by the current loader; known\n * CSP-capable frontend keys are suppressed by the CLI while it loads\n * the shared infra config.\n *\n * Cross-validation against SaaS-config service keys is not enforceable\n * inside this schema alone because the infra config file is parsed\n * independently. Consumers that load both files together must validate\n * their own seam; `wildo dev sync-csp` rejects unknown `csp.<key>`\n * entries before emitting generated artifacts.\n *\n * # Where this fits in the layered CSP cake\n *\n * 1. Platform default (per-`AppFrontendType` baseline) — `csp-defaults.ts`.\n * 2. App-static (per-frontend `csp?` block) — authored on each\n * service-definition (today: `wildo.tech-doc.config.ts.csp?` per\n * `saas-technical-doc.md` Step 7.5).\n * 3. **THIS FIELD** — env-specific overrides authored under\n * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. The\n * `resolveCspPolicy({ envOverride, environmentId })` resolver\n * in `platform-config-lib/src/project-config/shared/csp-emit.ts`\n * accepts this shape, the schema's `superRefine` enforces the\n * LOCAL-only `viteDevLoosening` rule, and `wildo dev sync-csp`\n * reads `parsed.csp[serviceKey]` when generating service-local\n * artifacts.\n *\n * # Why per-env overrides exist\n *\n * - Sentry / DataDog ingest origins differ per deployment (staging\n * vs production violation collectors).\n * - Vite dev mode needs `'unsafe-inline'` + `'unsafe-eval'` in\n * `script-src` (HMR client bootstrap injects an inline `<script>`,\n * module/sourcemap transforms run through `eval()`). The\n * framework auto-applies this for `local` + `SAAS_APP` via the\n * resolver's auto-default; the `viteDevLoosening` field exists\n * only for explicit opt-out (debugging real CSP issues) or for\n * non-canonical envs that also run Vite dev.\n * - Per-env `reportOnly` ramping: ship `reportOnly: true` in\n * staging while the violation collector ramps up, flip to\n * enforcing in prod once the directive overrides settle.\n *\n * # Always additive (resolver contract)\n *\n * Env-layer entries can only LOOSEN policy (`extraDirectives` is\n * APPEND-only over the app-static layer; `reportOnly` / `reportUri`\n * scalars override the app-static value when present;\n * `viteDevLoosening: true` appends `'unsafe-inline'` and\n * `'unsafe-eval'` to `script-src`). There is no `'replace-baseline'`\n * equivalent at this layer — env config exists to LOOSEN per-\n * deployment, not to replace an app's chosen posture. If an env\n * genuinely needs a different posture, the right answer is to fix\n * the app-static layer.\n *\n * # `.optional()` rationale\n *\n * Most environments (local dev, single-frontend SaaS apps that\n * accept the baseline policy verbatim) do not author per-service\n * CSP overrides. Downstream consumers MUST handle both \"no overrides\n * authored\" and \"service key not mapped\" as defined no-op fallbacks\n * — never as silent errors.\n *\n * `EnvCspOverrideSchema` is itself `z.strictObject` (csp.schemas.ts),\n * so unknown keys inside an authored override are rejected at the\n * inner-record level — no need to re-apply `.strict()` at the\n * `z.record` value position.\n */\n csp: z\n .record(z.string().min(1), EnvCspOverrideSchema)\n .optional(),\n /**\n * Per-service OPT-IN to CDN serving, keyed by SaaS-config service key\n * (same keyspace as `serviceHosts` / `csp`). Authoring an `enabled` entry\n * makes the deploy render skip the service's nginx Deployment/Service AND\n * its ingress / compose route — its public host is served off-cluster by a\n * CDN fronting an object-storage bucket, while `runtime.endPoints.publicUrl`\n * stays `<serviceHost>.<publicDomain>` (coherence preserved). See\n * {@link WildoCdnConfigSchema}. `wildo frontend publish` uploads the built\n * `dist/` + re-homes CSP to the edge for these services.\n *\n * `.optional()` — most apps serve every frontend from an nginx pod (no CDN);\n * consumers MUST treat \"no cdn authored\" and \"service key not mapped\" as the\n * defined no-op (nginx-served) fallback. `WildoCdnConfigSchema` is itself\n * `z.strictObject`, so unknown keys inside an authored entry are rejected at\n * the inner level — no `.strict()` needed at the `z.record` value position.\n */\n cdn: z\n .record(z.string().min(1), WildoCdnConfigSchema)\n .optional(),\n /**\n * WHERE each declared system of record lives in THIS environment, keyed by the instance name the\n * saas config declares (#1055). See {@link WildoSystemsOfRecordEnvConfigSchema}: either an address,\n * or `{ enabled: false }` for an environment that has no access to the instance at all.\n *\n * `.optional()` — an application that reads nothing out of another system authors none. An instance\n * the saas config DOES declare and this block omits is refused at `wildo config sync` and at boot,\n * because silence is not a declaration of absence; `{ enabled: false }` is.\n */\n systemsOfRecord: WildoSystemsOfRecordEnvConfigSchema.optional(),\n /**\n * The PLATFORM tier's own object-storage bucket, REMOTE environments only (#1112). See\n * {@link WildoPlatformStorageConfigSchema}: not this application's bucket (that is `backingServices.s3.bucket`),\n * and refused in a local environment, whose platform bucket is a constant shared by every application.\n */\n platformStorage: WildoPlatformStorageConfigSchema.optional(),\n devCompanion: InfraServiceAddressingSchema.optional(),\n /**\n * Present only on an environment RESOLVED from a hosted descriptor: this application runs on the\n * infrastructure of another application, whose root and descriptor are named here as absolute paths.\n *\n * Never authored in this form. An application declares its host with a RELATIVE\n * `infrastructureHost.applicationRoot` in a hosted descriptor (`defineHostedInfraEnvConfig`, {@link WildoHostedInfraEnvConfigSchema}),\n * and `loadInfraEnvConfig` produces this value while merging the host's platform-level fields in. The\n * absolute-path requirement is what keeps the two apart: a committed descriptor cannot carry a\n * machine-local path, so it cannot pass itself off as already resolved.\n *\n * Every consumer that would otherwise act on SHARED infrastructure — render the platform compose file,\n * converge containers, start or initialize the platform, write platform-service env files, bootstrap a\n * cluster — reads this field and leaves that action to the host.\n */\n infrastructureHost: z.strictObject({\n applicationRoot: z.string().regex(ABSOLUTE_PATH_PATTERN, 'infrastructureHost.applicationRoot must be absolute once resolved.'),\n infraConfigPath: z.string().regex(ABSOLUTE_PATH_PATTERN, 'infrastructureHost.infraConfigPath must be absolute once resolved.'),\n }).optional(),\n};\n\nconst WildoInfraEnvConfigInputSchema = z.object(WILDO_INFRA_ENV_CONFIG_SHAPE).strict().superRefine((config, ctx) => {\n const resolvedEnvironment = config.environment;\n\n const resolvedLocationType = config.locationType\n ?? (isLocalEnvironmentId(resolvedEnvironment) ? WildoLocationType.LOCAL : WildoLocationType.REMOTE);\n\n if (isLocalEnvironmentId(resolvedEnvironment) && resolvedLocationType === WildoLocationType.REMOTE) {\n ctx.addIssue({\n code: 'custom',\n path: ['locationType'],\n message: `\"${resolvedEnvironment}\" environment cannot use remote locationType`,\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && resolvedLocationType === WildoLocationType.LOCAL) {\n ctx.addIssue({\n code: 'custom',\n path: ['locationType'],\n message: 'Only the \"local\" environment id can use local locationType',\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && !config.runtimeEnvironment) {\n ctx.addIssue({\n code: 'custom',\n path: ['runtimeEnvironment'],\n message: 'runtimeEnvironment is required for remote environments',\n });\n }\n\n /**\n * A declared PostgreSQL platform must declare the stores it actually needs — checked HERE, at\n * author time, rather than only at env generation.\n *\n * `env-vars-builder` already throws on both of these, but it throws during\n * `wildo config sync`, i.e. after the operator has committed the config and moved on. The same\n * refusal at parse time names the problem while the file is still open. The runtime throws\n * REMAIN as the backstop — they also guard generated/non-authored paths this schema never sees\n * (see `.claude/rules/invariant-call-site-enumeration.md`: an invariant enforced at one of its\n * sites is enforced at none of the others).\n */\n /*\n * Scoped to an environment that OWNS its platform. A hosted environment's `database` is the host's,\n * validated when the host's own descriptor was parsed; its `backingServices` are only the stores the\n * hosted application itself uses, so a Mongo-backed application on a PostgreSQL platform would be\n * refused here for a store it never asked for.\n */\n if (config.database?.engine === DatabaseEngine.POSTGRESQL && config.infrastructureHost === undefined) {\n if (!config.backingServices[BackingServiceKind.POSTGRESQL]) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['backingServices', BackingServiceKind.POSTGRESQL],\n message:\n 'database.engine is POSTGRESQL but no `backingServices.postgresql` is declared: the platform '\n + 'would be pointed at a PostgreSQL that nothing provisions. Declare it, or drop `database` '\n + 'to let the engine be inferred.',\n });\n }\n\n /**\n * RETIRED 2026-08-28. A PostgreSQL-engined platform no longer requires a mongod.\n *\n * This used to refuse a PostgreSQL platform that did not also declare\n * `backingServices.mongodb: { source: SELF }`, on two stated grounds — and BOTH had since been\n * met, which is exactly why it needed retiring rather than keeping:\n *\n * 1. \"six resources declare `persistenceAdapter: MONGODB`\" — retired 2026-08-22 (item C).\n * `bootstrap-plane-persistence-adapter.test.ts` now asserts the INVERSE, that none of the\n * six declares an adapter, so re-pinning any one of them fails that suite.\n * 2. \"`crontabs-batches-manager` … with zero PostgreSQL awareness\" — ported (item D). On a\n * PostgreSQL platform it takes `connectWithUrl(postgresUrl)` and never opens a Mongo\n * connection at all.\n *\n * The guard's own instruction was \"retire this together with those pins and the crontabs port —\n * NOT before\". Both landed; nobody came back. What kept a mongod alive after that was a THIRD\n * reason neither the guard nor its message ever named: apps-manager's env schema declared\n * `MONGO_CONNECT_URL` and `BASE_MONGO_SERVER_URL` as unconditionally REQUIRED, and its INIT\n * threw without them. That is the shape worth remembering — a transitional guard whose recorded\n * checklist is fully ticked while the real blocker sits somewhere it does not mention. Those\n * env keys are now engine-conditional, so nothing forces a mongod any more.\n *\n * A mongod remains perfectly legal to declare, and is still REQUIRED in practice for a platform\n * that hosts Mongo-backed applications — but that is an operator's judgment about the\n * applications they run, exactly as the `applicationDatabase` rule below already argues, and not\n * something this schema can decide for them.\n */\n }\n\n /**\n * An application cannot persist to a store the environment does not declare — including the store\n * it selects by SILENCE, which is PostgreSQL. Resolved rather than compared to the authored value,\n * so an environment that declares nothing and provisions no PostgreSQL is refused at authoring time\n * instead of registering an application with no store.\n *\n * Deliberately NOT symmetric with the platform rule above: that one also requires MongoDB to stay\n * declared, because the platform's own BOOTSTRAP plane is Mongo-wired. An application has no such\n * plane — once its resources are on PostgreSQL, nothing of the application's needs a mongod — so\n * requiring one here would forbid the very end-state this field exists to reach.\n */\n if (resolveApplicationDatabaseEngine(config.applicationDatabase) === DatabaseEngine.POSTGRESQL\n && config.backingServices[BackingServiceKind.POSTGRESQL] === undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['backingServices', BackingServiceKind.POSTGRESQL],\n message:\n 'The application persists to PostgreSQL (declared, or selected because `applicationDatabase` is '\n + 'absent) but no `backingServices.postgresql` is declared: it would be pointed at a PostgreSQL that '\n + 'nothing provisions. Declare it, or author `applicationDatabase: { engine: DatabaseEngine.MONGODB }`.',\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && config.applicationCreationVerification !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['applicationCreationVerification'],\n message: 'applicationCreationVerification is local-only and must be authored in wildo.infra.local.config.ts.',\n });\n }\n\n if (\n !isLocalEnvironmentId(resolvedEnvironment)\n && resolvedLocationType === WildoLocationType.REMOTE\n && config.runtime === WildoDeploymentRuntime.KUBERNETES\n ) {\n if (!config.remoteProvider) {\n ctx.addIssue({\n code: 'custom',\n path: ['remoteProvider'],\n message: 'remoteProvider is required for remote Kubernetes environments',\n });\n }\n if (!config.kubernetes) {\n ctx.addIssue({\n code: 'custom',\n path: ['kubernetes'],\n message: 'kubernetes is required for remote Kubernetes environments',\n });\n }\n }\n\n // CSP env-layer dev-only escape hatch — `viteDevLoosening: true`\n // injects BOTH `'unsafe-inline'` and `'unsafe-eval'` into `script-src`\n // (Vite's HMR client bootstrap is an inline `<script>` and its module\n // / sourcemap transforms run through `eval()`). The auto-default\n // already handles the canonical case (`local` + `SAAS_APP` →\n // auto-true). Explicit `viteDevLoosening: true` is REJECTED outside\n // the LOCAL environment because shipping `'unsafe-inline'` +\n // `'unsafe-eval'` to staging / production would punch a hole through\n // the entire CSP posture (every XSS payload becomes scriptable via\n // `eval()`-style sinks the baseline specifically denies, and inline\n // `<script>` injection escapes nonce-/hash-based mitigation). Failing\n // fast at parse time prevents an authored `csp.app.viteDevLoosening:\n // true` entry from silently shipping to production via a copy-paste\n // from the local config.\n if (config.csp && !isLocalEnvironmentId(resolvedEnvironment)) {\n for (const [serviceKey, override] of Object.entries(config.csp)) {\n if (override?.viteDevLoosening === true) {\n ctx.addIssue({\n code: 'custom',\n path: ['csp', serviceKey, 'viteDevLoosening'],\n message:\n `csp.${serviceKey}.viteDevLoosening cannot be true in environment \"${resolvedEnvironment}\" — `\n + `the dev-only escape hatch is restricted to \"${WildoEnvironment.LOCAL}\". `\n + `Author this flag ONLY in wildo.infra.local.config.ts; remote envs MUST reject `\n + `'unsafe-inline'/'unsafe-eval' so XSS payloads can't reach eval-style sinks or `\n + `inline-script injection. Production Vite builds emit <script type=\"module\"> with `\n + `no inline scripts and no eval(), so production envs never NEED this flag.`,\n });\n }\n }\n }\n\n // CDN serving is a REMOTE-only concern: it replaces a frontend's nginx pod\n // (Deployment + Service + ingress route), which exists ONLY in a remote\n // k8s/compose deploy. Local dev runs native frontend dev servers — there is\n // no nginx pod to skip and nowhere to publish to. Reject an authored `cdn`\n // block outside a remote env at parse time so a config copy-pasted from a\n // remote env can't silently make `wildo frontend publish --env local`\n // attempt an S3 upload (and so the semantic stays enforced, not implicit).\n // The platform's own bucket is authored only for a REMOTE environment (#1112). A local platform is shared by\n // every application beside it, and each has its own infra file, so letting one author it would make the\n // platform's bucket whichever application synced last — the defect this field exists to remove.\n if (config.platformStorage && resolvedLocationType !== WildoLocationType.REMOTE) {\n ctx.addIssue({\n code: 'custom',\n path: ['platformStorage'],\n message:\n 'platformStorage is only valid in a REMOTE environment — a local platform is shared by every '\n + 'application beside it and uses the fixed platform bucket. Author it only in wildo.infra.remote.config.ts.',\n });\n }\n\n if (config.cdn && resolvedLocationType !== WildoLocationType.REMOTE) {\n for (const serviceKey of Object.keys(config.cdn)) {\n ctx.addIssue({\n code: 'custom',\n path: ['cdn', serviceKey],\n message:\n `cdn.${serviceKey} is only valid in a REMOTE environment — CDN serving replaces the `\n + `frontend's nginx pod, which local dev does not have. Author cdn blocks only in `\n + `wildo.infra.remote.config.ts (staging / production).`,\n });\n }\n }\n});\n\nexport const WildoInfraEnvConfigSchema = WildoInfraEnvConfigInputSchema.transform((config) => {\n const environment = config.environment;\n const locationType = config.locationType\n ?? (isLocalEnvironmentId(environment) ? WildoLocationType.LOCAL : WildoLocationType.REMOTE);\n\n return {\n version: config.version,\n environment,\n locationType,\n runtimeEnvironment: config.runtimeEnvironment,\n runtime: config.runtime,\n /**\n * Resolved here rather than left `undefined` for a downstream consumer to default, so every\n * reader sees one answer. The derivation is total over `WildoLocationType`.\n */\n localDataStorage: config.localDataStorage ?? resolveDefaultLocalDataStorage(locationType),\n /**\n * Projected EXPLICITLY, like every field here — this list IS the contract, and a field omitted\n * from it is silently dropped no matter what the input schema accepted. `undefined` when the\n * environment does not author one, which is the signal downstream consumers use to fall back to\n * `inferDatabaseChoiceFromInfraConfig`.\n */\n database: config.database,\n applicationDatabase: config.applicationDatabase,\n publicDomain: config.publicDomain,\n serviceHosts: config.serviceHosts,\n kubernetes: config.kubernetes,\n remoteProvider: config.remoteProvider,\n deployment: config.deployment,\n backingServices: config.backingServices,\n logging: config.logging,\n observability: config.observability,\n providerSelection: config.providerSelection,\n providerConfigurations: config.providerConfigurations,\n applicationCreationVerification: config.applicationCreationVerification,\n serviceAuth: config.serviceAuth,\n csp: config.csp,\n cdn: config.cdn,\n systemsOfRecord: config.systemsOfRecord,\n platformStorage: config.platformStorage,\n documentationSite: config.documentationSite,\n devCompanion: config.devCompanion,\n infrastructureHost: config.infrastructureHost,\n };\n});\n\nexport type WildoInfraEnvConfig = z.output<typeof WildoInfraEnvConfigSchema>;\nexport type WildoInfraEnvConfigInput = z.input<typeof WildoInfraEnvConfigSchema>;\n\n// =============================================================================\n// Hosted environment descriptors — an application running on another application's infrastructure\n// =============================================================================\n\n/**\n * Who decides one member of an environment descriptor when the application is HOSTED.\n *\n * Several applications share one platform per environment: one application OWNS the infrastructure\n * (the platform services and every backing service), and the others reference it through\n * `infrastructureHost`. Each member of the descriptor belongs to exactly one side, and this vocabulary is\n * how that is stated — per member, in {@link INFRA_ENV_FIELD_OWNERSHIP}, so a member added tomorrow cannot\n * compile until somebody decides whose it is.\n */\nexport enum InfraEnvFieldOwner {\n /**\n * The hosted application authors it, and it may differ from the host's: its public domain, its CSP,\n * its provider choices, its companion port. Taken verbatim from the hosted descriptor.\n */\n APPLICATION = 'application',\n /**\n * The host decides it, and a hosted descriptor may not author it: the runtime, the platform database,\n * the cluster, the remote provider, the platform bucket. Authoring one in a hosted descriptor is\n * refused — two applications on one platform cannot disagree about what that platform is.\n */\n HOST = 'host',\n /**\n * Split inside the member. Backing services: the host owns each SERVER (`source`, `host`, `port`,\n * `provider`, `endpoint`), the application owns its NAME on that server (database, vhost, bucket).\n * Kubernetes: the host owns the namespace and ingress class, the application its replica counts.\n * Deployment: the host owns the runtime, the application its branch and image tagging.\n */\n PARTITIONED = 'partitioned',\n /**\n * Produced by resolution and never authored in its resolved form (`infrastructureHost`).\n */\n RESOLUTION = 'resolution',\n}\n\n/**\n * Whose decision each member of a standalone descriptor is, when the application is hosted.\n *\n * Total over {@link WILDO_INFRA_ENV_CONFIG_SHAPE} by type, which is the point: `providerConfigurations`\n * landed on the shape while this feature was being written, and a hosted descriptor built from a\n * hand-kept list would have dropped it silently. `hosted-infra-env-config.test.ts` pins that the hosted\n * schema accepts exactly the APPLICATION and PARTITIONED members.\n */\nexport const INFRA_ENV_FIELD_OWNERSHIP: Readonly<Record<keyof typeof WILDO_INFRA_ENV_CONFIG_SHAPE, InfraEnvFieldOwner>> = {\n version: InfraEnvFieldOwner.APPLICATION,\n environment: InfraEnvFieldOwner.APPLICATION,\n locationType: InfraEnvFieldOwner.HOST,\n runtimeEnvironment: InfraEnvFieldOwner.HOST,\n runtime: InfraEnvFieldOwner.HOST,\n /*\n * HOST. It says how the SHARED backing services store their data, and there is one set of those\n * containers per platform — a hosted application cannot have mongod keep its data in a volume\n * while the host keeps it on a bind mount, because it is the same mongod. Same family as\n * `runtime` and `database`: a property of the substrate, not of anyone running on it. The host\n * also writes the compose file this member shapes, so a hosted descriptor authoring it would be\n * describing a file it does not own.\n */\n localDataStorage: InfraEnvFieldOwner.HOST,\n database: InfraEnvFieldOwner.HOST,\n applicationDatabase: InfraEnvFieldOwner.APPLICATION,\n publicDomain: InfraEnvFieldOwner.APPLICATION,\n serviceHosts: InfraEnvFieldOwner.APPLICATION,\n kubernetes: InfraEnvFieldOwner.PARTITIONED,\n remoteProvider: InfraEnvFieldOwner.HOST,\n deployment: InfraEnvFieldOwner.PARTITIONED,\n backingServices: InfraEnvFieldOwner.PARTITIONED,\n logging: InfraEnvFieldOwner.APPLICATION,\n /*\n * APPLICATION, deliberately: `enabled` and `llmObservability` are per-application postures. The OTLP\n * `endpoint` usually names the shared collector, and nothing stops an application pointing its own\n * telemetry elsewhere — that is a destination choice, not a divergence in what the platform runs.\n */\n observability: InfraEnvFieldOwner.APPLICATION,\n providerSelection: InfraEnvFieldOwner.APPLICATION,\n providerConfigurations: InfraEnvFieldOwner.APPLICATION,\n /*\n * APPLICATION. `systemsOfRecord` says where the instances THIS application declares in its saas config live in\n * this environment — an external system it reads from (an ERP), never part of the shared substrate its host\n * runs. Two applications on one platform read from different systems, or from none: handing a hosted\n * application its host's ERP address and credential would be a cross-tenant read nobody asked for, and\n * `{ enabled: false }` is exactly how an environment says it has no access.\n */\n systemsOfRecord: InfraEnvFieldOwner.APPLICATION,\n documentationSite: InfraEnvFieldOwner.APPLICATION,\n applicationCreationVerification: InfraEnvFieldOwner.APPLICATION,\n serviceAuth: InfraEnvFieldOwner.APPLICATION,\n csp: InfraEnvFieldOwner.APPLICATION,\n cdn: InfraEnvFieldOwner.APPLICATION,\n platformStorage: InfraEnvFieldOwner.HOST,\n devCompanion: InfraEnvFieldOwner.APPLICATION,\n infrastructureHost: InfraEnvFieldOwner.RESOLUTION,\n};\n\n/**\n * Which field of a backing-service entry names the APPLICATION'S OWN slice of a shared server.\n *\n * `mustDifferFromHost` is true where the framework's fallback for an unnamed slice is a SHARED constant —\n * `'wildo_app'` for a Mongo or PostgreSQL database, the default vhost `/`, the fixed platform bucket. On\n * those servers two applications that name the same slice are one application's data, silently, so a\n * hosted application must name its own and it must not be the host's. Redis is exempt: every application\n * already shares index 0, isolated by its own ACL principal and key prefix. Immudb's `database` has no\n * consumer today, so it is stripped from the host's entry and not authored by the hosted one.\n */\nexport const BACKING_SERVICE_APPLICATION_NAME_FIELDS = {\n [BackingServiceKind.MONGODB]: { field: 'database', mustDifferFromHost: true },\n [BackingServiceKind.REDIS]: { field: 'database', mustDifferFromHost: false },\n [BackingServiceKind.RABBITMQ]: { field: 'vhost', mustDifferFromHost: true },\n [BackingServiceKind.S3]: { field: 'bucket', mustDifferFromHost: true },\n [BackingServiceKind.POSTGRESQL]: { field: 'database', mustDifferFromHost: true },\n [BackingServiceKind.CLAMAV]: null,\n [BackingServiceKind.IMMUDB]: { field: 'database', mustDifferFromHost: false },\n} as const satisfies Record<BackingServiceKind, { field: string; mustDifferFromHost: boolean } | null>;\n\n/**\n * Error-map for a strict object whose unknown keys are almost always host-owned members an author\n * carried over from a standalone descriptor. Zod's own \"Unrecognized key\" names the key but not the\n * reason, and the reason is the whole lesson.\n */\nfunction refuseHostOwnedKeys(scope: string): { error: (issue: { code?: string; keys?: readonly string[] }) => string | undefined } {\n return {\n error: (issue) => {\n if (issue.code !== 'unrecognized_keys' || !issue.keys?.length) return undefined;\n const keys = issue.keys.map((key) => `\\`${key}\\``).join(', ');\n return `${scope}: ${keys} cannot be authored by a hosted application. Its infrastructure host decides `\n + 'the platform (runtime, database, cluster, remote provider, platform storage) and every backing-service '\n + 'server; a hosted application authors only its own names on those servers (database, vhost, bucket).';\n },\n };\n}\n\nconst HOSTED_BACKING_SERVICES_SHAPE = {\n [BackingServiceKind.MONGODB]: z.strictObject({ database: z.string().min(1) }, refuseHostOwnedKeys('backingServices.mongodb')).optional(),\n [BackingServiceKind.REDIS]: z.strictObject({ database: z.number().int().min(0).max(15).optional() }, refuseHostOwnedKeys('backingServices.redis')).optional(),\n [BackingServiceKind.RABBITMQ]: z.strictObject({ vhost: z.string().min(1) }, refuseHostOwnedKeys('backingServices.rabbitmq')).optional(),\n [BackingServiceKind.S3]: z.strictObject({ bucket: z.string().min(1) }, refuseHostOwnedKeys('backingServices.s3')).optional(),\n [BackingServiceKind.POSTGRESQL]: z.strictObject({ database: z.string().min(1) }, refuseHostOwnedKeys('backingServices.postgresql')).optional(),\n [BackingServiceKind.CLAMAV]: z.strictObject({}, refuseHostOwnedKeys('backingServices.clamav')).optional(),\n [BackingServiceKind.IMMUDB]: z.strictObject({}, refuseHostOwnedKeys('backingServices.immudb')).optional(),\n} satisfies Record<BackingServiceKind, z.ZodOptional<z.ZodType>>;\n\n/**\n * The backing services a HOSTED application uses — each one a store its host must declare.\n *\n * Listing a kind is how the application states it NEEDS that store; the entry carries only the\n * application's own name on the host's server. Every name field is REQUIRED where\n * {@link BACKING_SERVICE_APPLICATION_NAME_FIELDS} says the unnamed fallback is shared.\n */\nexport const HostedBackingServicesEnvConfigSchema = z.strictObject(HOSTED_BACKING_SERVICES_SHAPE, refuseHostOwnedKeys('backingServices'));\nexport type HostedBackingServicesEnvConfig = z.output<typeof HostedBackingServicesEnvConfigSchema>;\n\n/** @wildo_source:part:start platform.config.infrastructure-host facet:layer:platform facet:family:bootstrap facet:audience:app-developer */\n/**\n * An environment descriptor for an application that runs on ANOTHER application's infrastructure.\n *\n * One application per environment owns the infrastructure — its platform services (apps-manager,\n * module-registry, crontabs) and every backing service. Other applications declare that owner as their\n * `infrastructureHost` and author only what is theirs: domain, CSP, provider choices, companion address,\n * and their own database/vhost/bucket names on the host's servers. Everything else comes from the host's\n * descriptor for the SAME environment when the descriptor is loaded, so the two cannot diverge — not in\n * which stores exist, not in how they are reached, not between Docker Compose and Kubernetes.\n *\n * The link is per environment: author it in `wildo.infra.local.config.ts` to share a local platform while\n * `staging` stays standalone, or in both.\n *\n * Refusals, all at load time, all naming both descriptors:\n * - the host root holds no `wildo.saas.config.ts` — a hosted application needs its host's SOURCE checked\n * out at that path;\n * - the host has no descriptor for this environment, or is itself hosted;\n * - a store this application lists is not declared by the host;\n * - a database, vhost or bucket name equals the host's.\n *\n * @example Wonder CRM on Wonder Todos' local platform.\n * ```ts\n * export default defineHostedInfraEnvConfig({\n * environment: WildoEnvironment.LOCAL,\n * infrastructureHost: { applicationRoot: '../wonder-todos' },\n * publicDomain: 'localhost',\n * applicationDatabase: { engine: DatabaseEngine.POSTGRESQL },\n * backingServices: {\n * postgresql: { database: 'wonder-crm-db' },\n * redis: { database: 0 },\n * rabbitmq: { vhost: 'wonder-crm' },\n * s3: { bucket: 'wonder-crm-local' },\n * },\n * devCompanion: { host: 'localhost', port: 4351 },\n * });\n * ```\n */\nexport const WildoHostedInfraEnvConfigSchema = z.strictObject({\n infrastructureHost: z.strictObject({\n /**\n * The host application's root — the directory holding its `wildo.saas.config.ts` — RELATIVE to this\n * application's root. Relative because the descriptor is committed: an absolute path is one machine's\n * checkout layout, and would break on every other.\n */\n applicationRoot: z.string().min(1).refine(\n (value) => !ABSOLUTE_PATH_PATTERN.test(value),\n 'infrastructureHost.applicationRoot must be relative to this application root (e.g. \"../wonder-todos\"): the descriptor is committed, and an absolute path only exists on one machine.',\n ),\n }, refuseHostOwnedKeys('infrastructureHost')),\n version: WILDO_INFRA_ENV_CONFIG_SHAPE.version,\n environment: WILDO_INFRA_ENV_CONFIG_SHAPE.environment,\n applicationDatabase: WILDO_INFRA_ENV_CONFIG_SHAPE.applicationDatabase,\n publicDomain: WILDO_INFRA_ENV_CONFIG_SHAPE.publicDomain,\n serviceHosts: WILDO_INFRA_ENV_CONFIG_SHAPE.serviceHosts,\n kubernetes: z.strictObject({\n services: WildoKubernetesConfigSchema.shape.services,\n }, refuseHostOwnedKeys('kubernetes')).optional(),\n deployment: z.strictObject({\n branch: z.string().min(1),\n imageTagStrategy: z.enum(WildoImageTagStrategy).optional(),\n // No `registry`: images live at the host's `remoteProvider.registryEndpoint`, which its manifests pull from (#1165).\n }, refuseHostOwnedKeys('deployment')).optional(),\n backingServices: HostedBackingServicesEnvConfigSchema.optional(),\n logging: WILDO_INFRA_ENV_CONFIG_SHAPE.logging,\n observability: WILDO_INFRA_ENV_CONFIG_SHAPE.observability,\n providerSelection: WILDO_INFRA_ENV_CONFIG_SHAPE.providerSelection,\n providerConfigurations: WILDO_INFRA_ENV_CONFIG_SHAPE.providerConfigurations,\n systemsOfRecord: WILDO_INFRA_ENV_CONFIG_SHAPE.systemsOfRecord,\n documentationSite: WILDO_INFRA_ENV_CONFIG_SHAPE.documentationSite,\n applicationCreationVerification: WILDO_INFRA_ENV_CONFIG_SHAPE.applicationCreationVerification,\n serviceAuth: WILDO_INFRA_ENV_CONFIG_SHAPE.serviceAuth,\n csp: WILDO_INFRA_ENV_CONFIG_SHAPE.csp,\n cdn: WILDO_INFRA_ENV_CONFIG_SHAPE.cdn,\n devCompanion: WILDO_INFRA_ENV_CONFIG_SHAPE.devCompanion,\n}, refuseHostOwnedKeys('a hosted environment descriptor'));\n/** @wildo_source:part:end platform.config.infrastructure-host */\n\nexport type WildoHostedInfraEnvConfig = z.output<typeof WildoHostedInfraEnvConfigSchema>;\nexport type WildoHostedInfraEnvConfigInput = z.input<typeof WildoHostedInfraEnvConfigSchema>;\n\n/**\n * What an authored `wildo.infra.<env>.config.ts` evaluates to: a standalone descriptor, or a hosted one\n * that is NOT usable until `loadInfraEnvConfig` resolves it against its host.\n */\nexport type WildoAuthoredInfraEnvConfig = WildoInfraEnvConfig | WildoHostedInfraEnvConfig;\n\n/**\n * Whether an evaluated descriptor is a hosted one still awaiting resolution.\n *\n * Keyed on the AUTHORED key, exactly as {@link defineInfraEnvConfig} dispatches: an `infrastructureHost`\n * in its authored form, which names a relative root and no `infraConfigPath`. A RESOLVED hosted\n * environment carries `infraConfigPath` and is a {@link WildoInfraEnvConfig} — consumers ask\n * `config.infrastructureHost !== undefined` for that.\n *\n * An earlier revision keyed on the absence of `runtime`, reasoning that every standalone descriptor\n * requires it. That holds for a descriptor built through `defineInfraEnvConfig` and not for a plain\n * `export default {…}` object, which the loader also evaluates: a partial standalone descriptor with no\n * `runtime` was read as hosted and crashed on its missing host. Discriminate on what the author wrote,\n * never on what a schema happens to require.\n */\nexport function isHostedInfraEnvConfig(config: WildoAuthoredInfraEnvConfig): config is WildoHostedInfraEnvConfig {\n const host = (config as { infrastructureHost?: object }).infrastructureHost;\n return host !== undefined && host !== null && !('infraConfigPath' in host);\n}\n\n/**\n * Scope `csp.<serviceKey>` warning suppression to the current async load path.\n *\n * The docs CSP generator loads authored infra config through `loadConfig()`,\n * which evaluates `defineInfraEnvConfig(...)` inside the same process. Using\n * an async-local context lets that loader declare which keys are actively\n * consumed without mutating `process.env` across concurrent config loads.\n *\n * `WILDO_CONSUMED_INFRA_CSP_SERVICE_KEYS` remains supported as a coarse global\n * fallback (tests / external callers), but in-process loaders SHOULD prefer\n * this helper so suppression cannot leak between unrelated async work.\n */\nexport async function withConsumedInfraCspServiceKeys<T>(\n serviceKeys: Iterable<string>,\n callback: () => Promise<T> | T,\n): Promise<T> {\n const normalizedKeys = new Set(\n [...serviceKeys]\n .map((value) => value.trim())\n .filter((value) => value.length > 0),\n );\n if (normalizedKeys.size === 0) {\n return await callback();\n }\n const parentKeys = consumedInfraCspServiceKeysContext.getStore();\n const mergedKeys = new Set(parentKeys ?? []);\n for (const serviceKey of normalizedKeys) {\n mergedKeys.add(serviceKey);\n }\n return await consumedInfraCspServiceKeysContext.run(mergedKeys, callback);\n}\n\n/**\n * Define an app-owned environment descriptor under `infrastructure/<env>`.\n *\n * This is the canonical authored env contract for the flattened targeted-app\n * layout.\n *\n * After successful parsing, emits Slice 3.5 `@unimplemented` warnings for\n * authored fields that remain reserved or are not declared as consumed by\n * the current loader — see `_unimplemented/unimplemented-field-warning.ts`\n * for the design rationale (channel = stderr, dedupe = once-per-call,\n * format = single-line with backlog ID).\n */\nexport function defineInfraEnvConfig(config: WildoInfraEnvConfigInput): WildoInfraEnvConfig {\n /*\n * An `infrastructureHost` is never authored here: a hosted environment is a different descriptor with its\n * own entry point, and its resolved form (absolute paths) is produced only by `loadInfraEnvConfig`.\n * Refused by name before the schema runs, because the schema's own complaint (\"must be absolute once\n * resolved\") would send the author in the wrong direction.\n */\n if ((config as { infrastructureHost?: unknown }).infrastructureHost !== undefined) {\n throw new Error(\n 'defineInfraEnvConfig describes an environment that OWNS its infrastructure, so it takes no infrastructureHost. '\n + 'An application running on another application\\'s infrastructure is declared with defineHostedInfraEnvConfig({ '\n + 'infrastructureHost: { applicationRoot: \\'../<host-app>\\' }, … }).',\n );\n }\n const parsed = WildoInfraEnvConfigSchema.parse(config);\n emitInfraUnimplementedRuntimeWarnings(parsed);\n return parsed;\n}\n\n/**\n * Define an environment descriptor for an application that runs on ANOTHER application's infrastructure.\n * See {@link WildoHostedInfraEnvConfigSchema} for what it may author and what comes from the host.\n *\n * A separate entry point rather than a variant of {@link defineInfraEnvConfig}, deliberately. \"This\n * environment owns its platform\" and \"this environment runs on someone else's\" are different decisions\n * with different fields, and one function accepting both made a type error in either shape report as \"No\n * overload matches this call\" at the call instead of at the offending property — worse feedback for every\n * author of every descriptor, standalone ones included.\n *\n * The result is NOT an environment yet: `loadInfraEnvConfig` resolves it against the host.\n */\nexport function defineHostedInfraEnvConfig(config: WildoHostedInfraEnvConfigInput): WildoHostedInfraEnvConfig {\n const parsed = WildoHostedInfraEnvConfigSchema.parse(config);\n emitInfraUnimplementedRuntimeWarnings(parsed);\n return parsed;\n}\n\n/**\n * Emit `@unimplemented` parse-time warnings for every authored\n * `WildoInfraEnvConfig` field that remains reserved or is not declared as\n * consumed by the current loader (Slice 3.5 contract — see\n * `_unimplemented/unimplemented-field-warning.ts`).\n *\n * Surfaces today (2 field families):\n *\n * - `version` (!== undefined) → `D-5`\n * - `csp.<serviceKey>` (each authored entry) → `B-2C` (auth-hardening\n * Slice B Step 2 closeout — the schema reservation shipped, the\n * superRefine guard against `viteDevLoosening: true` outside LOCAL\n * is live, and `wildo dev sync-csp` declares the CSP-capable\n * frontend service keys it consumes while loading authored infra\n * config, so warnings remain reserved for genuinely unconsumed keys.)\n *\n * `logging.{level, formattedConsoleErrors}` is intentionally NOT in this\n * list: Slice 3.5 wires both fields end-to-end (persistence,\n * `env-vars-builder` → `LOG_LEVEL` / `LOG_FORMATTED_CONSOLE_ERRORS`,\n * `LoggerService.loadConfiguration`), so they have a real runtime\n * consumer and silence is the honest behavior.\n *\n * `domain` is intentionally NOT in this list either: Slice 3.5 deleted\n * the field outright as a wrong-seam, and the post-Slice-3.5\n * `external-public-domain-rename.md` follow-up renamed the canonical\n * hostname seam to top-level `publicDomain` (replacing the misnamed\n * `kubernetes.baseDomain` of Slice 3.5). Both `domain` and\n * `kubernetes.baseDomain` are now strict-rejected by the schema —\n * the canonical seam is `publicDomain` at the top level. See the\n * strict-pin tests in `__tests__/define-infra-env-config.unimplemented.test.ts`.\n *\n * When the deferred backlog item lands, the matching `if` branch below\n * MUST be removed in the same commit as the runtime wiring — leaving a\n * stale warning is worse than silence.\n */\nfunction emitInfraUnimplementedRuntimeWarnings(config: Partial<Pick<WildoInfraEnvConfig, 'version' | 'csp'>>): void {\n const warn = createUnimplementedFieldWarner(UnimplementedFieldSource.INFRA_ENV_CONFIG);\n const AUTH_HARDENING_PLAN_PATH = '.cursor/plans/auth-hardening.md';\n const consumedCspServiceKeys = getConsumedInfraCspServiceKeys();\n\n if (config.version !== undefined) {\n warn('version', 'D-5');\n }\n\n if (config.csp !== undefined) {\n // Walk every authored service key so a multi-service author\n // (e.g. csp: { docs: {…}, app: {…} }) sees one warning per\n // service — the dedupe key is the field path, so per-key\n // emission is what matches the createUnimplementedFieldWarner\n // contract.\n for (const serviceKey of Object.keys(config.csp)) {\n if (consumedCspServiceKeys.has(serviceKey)) {\n continue;\n }\n warn(`csp.${serviceKey}`, 'B-2C', AUTH_HARDENING_PLAN_PATH);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-minion-config.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"define-minion-config.d.ts","sourceRoot":"","sources":["../../../../src/project-config/define-minion-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,sCAAsC,CAAC;AAE9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,2BAA2B;;;;;;kBAGtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;kBA6B/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,qBAAqB;;;;;kBAAyB,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,SAAkC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;IAMlC;;;;;;;;;OASG;;;;;;IAGH,wDAAwD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmCxD,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE7E;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,sBAAsB,GAAG,iBAAiB,CAEpF"}
|
|
@@ -223,8 +223,7 @@ export const WildoMinionConfigSchema = z.strictObject({
|
|
|
223
223
|
ctx.addIssue({
|
|
224
224
|
code: 'custom',
|
|
225
225
|
path: ['schedule'],
|
|
226
|
-
message: "schedule must be omitted when mode === 'always-up'
|
|
227
|
-
'authoring a cron expression on top would create two competing schedulers).',
|
|
226
|
+
message: "schedule must be omitted when mode === 'always-up'; use mode === 'cron' for platform-scheduled ticks.",
|
|
228
227
|
});
|
|
229
228
|
}
|
|
230
229
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-minion-config.js","sourceRoot":"","sources":["../../../../src/project-config/define-minion-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,+BAA+B,EAC/B,sBAAsB,GAEvB,MAAM,sCAAsC,CAAC;AAE9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,YAAY,CAAC;IACxD,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;IACrE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;CAC1D,CAAC,CAAC;AAGH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC;IACjD,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IAC9C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAAC;IAC9D,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACzD,SAAS,EAAE,CAAC;SACT,YAAY,CAAC;QACZ,WAAW,EAAE,CAAC,CAA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AAS,EAAE,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;CAC9C,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAC1B,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QACzC,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,UAAU,CAAC;YAClB,OAAO,EAAE,0FAA0F;SACpG,CAAC,CAAC;IACL,CAAC;IACD,sBAAsB,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAE3C,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC7C,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,UAAU,CAAC;YAClB,OAAO,EACL,oGAAoG;gBACpG,4EAA4E;SAC/E,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAA8B;IAC/D,OAAO,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n WorkerRuntimeSchema,\n ResourceLimitsSchema,\n RuntimeIsolationSchema,\n RUNTIME_MANDATORY_WRITABLE_PATH,\n refineRuntimeIsolation,\n type RuntimeIsolation,\n} from './shared/service-definitions.schemas';\n\n/**\n * Reinstantiation policy when an `'always-up'` minion is restarted\n * (deploy, config reload, manual `kubectl rollout restart`).\n *\n * - `'kill_previous'` (default) — the apps-manager terminates the\n * running pod before the new one starts. Matches K8s `Recreate`\n * strategy. Correct default for stateful actor-flow minions where\n * two concurrent instances would corrupt invariants.\n * - `'let_run'` — both pods run side-by-side until the previous one\n * exits naturally. Matches K8s `RollingUpdate` strategy with\n * `maxSurge: 1, maxUnavailable: 0`. Authored explicitly when the\n * minion can tolerate momentary duplication (e.g. an idempotent\n * scraper).\n *\n * `gracePeriodSec` is optional and only meaningful for\n * `'kill_previous'` (forwarded to the K8s `terminationGracePeriodSeconds`\n * Phase 3 manifest emitter — Q7 LOCKED). Authoring it on `'let_run'`\n * is harmless today but silently ignored.\n */\nexport const MinionReinstantiationSchema = z.strictObject({\n policy: z.enum(['kill_previous', 'let_run']).default('kill_previous'),\n gracePeriodSec: z.number().int().nonnegative().optional(),\n});\nexport type MinionReinstantiation = z.infer<typeof MinionReinstantiationSchema>;\n\n/**\n * Per-minion liveness contract — G-18 + NR-3 in\n * `.cursor/plans/minions-and-workers-implementation.md`.\n *\n * Minions have NO inbound HTTP surface (KD-1 / Q5 LOCKED), so the K8s\n * liveness probe cannot use the `httpGet` shape that workers use. The\n * supported probes are:\n *\n * - `kind: 'file'` (default) — the minion's actor loop touches\n * `filePath` every `heartbeat.intervalSec` seconds. The K8s probe\n * is an `exec` probe that runs `find <filePath> -mmin -<staleAfterSec/60>`\n * and fails when the file is older than `staleAfterSec`.\n *\n * - `kind: 'exec'` — the minion provides its own probe command (e.g.\n * `['curl', '-fsS', 'http://localhost:9090/internal/healthz']` for\n * a minion that exposes a loopback-only debug surface). The\n * contract is \"exit 0 = healthy, anything else = restart\".\n *\n * `staleAfterSec` MUST be > `heartbeat.intervalSec` (the schema's\n * `superRefine` enforces this — a stale-window equal to or shorter\n * than the heartbeat would guarantee K8s flaps the pod even when\n * the minion is healthy). The 90s / 30s defaults give a 3× safety\n * margin which the cron-cadence vs liveness-cadence interaction\n * documented in NR-3 needs to keep the deploy story sane.\n */\nexport const MinionLivenessSchema = z.strictObject({\n kind: z.enum(['file', 'exec']).default('file'),\n filePath: z.string().min(1).default('/tmp/wildo-minion-alive'),\n execCommand: z.array(z.string().min(1)).min(1).optional(),\n heartbeat: z\n .strictObject({\n intervalSec: z.number().int().positive().default(30),\n })\n .prefault({}),\n staleAfterSec: z.number().int().positive().default(90),\n}).superRefine((val, ctx) => {\n if (val.kind === 'exec' && (!val.execCommand || val.execCommand.length === 0)) {\n ctx.addIssue({\n code: 'custom',\n path: ['execCommand'],\n message: \"liveness.execCommand is required (and non-empty) when liveness.kind === 'exec'.\",\n });\n }\n if (val.staleAfterSec <= val.heartbeat.intervalSec) {\n ctx.addIssue({\n code: 'custom',\n path: ['staleAfterSec'],\n message:\n `liveness.staleAfterSec (${val.staleAfterSec}s) must be strictly greater than ` +\n `liveness.heartbeat.intervalSec (${val.heartbeat.intervalSec}s) — otherwise the K8s ` +\n 'liveness probe will flap the pod even when the minion is healthy. ' +\n 'Recommended: staleAfterSec ≥ 3× heartbeat.intervalSec.',\n });\n }\n});\nexport type MinionLiveness = z.infer<typeof MinionLivenessSchema>;\n\n/**\n * Per-minion container isolation. An ALIAS of the shared\n * {@link RuntimeIsolationSchema} — minions and workers have identical isolation\n * contracts, and the floor/authorable split is documented there. Kept as a named\n * export so minion-facing code and its pins read in minion terms.\n *\n * ## ⚠️ The one MINION-SPECIFIC consequence, and it is load-bearing\n *\n * {@link MinionLivenessSchema} defaults to a FILE probe at\n * `/tmp/wildo-minion-alive`, touched by the actor loop every\n * `heartbeat.intervalSec`. So `readOnlyRootFilesystem: true` with no writable\n * `/tmp` makes the heartbeat unwritable and Kubernetes restart-loops **every\n * healthy minion** — the probe fails for a reason unrelated to the workload's\n * health. The renderers always emit the `/tmp` mount alongside the read-only\n * flag; the two must never be separated.\n *\n * Workers probe over HTTP and so do not share this acute coupling, which is why\n * the reasoning lives here rather than in the shared schema.\n *\n * @example\n * ```ts\n * // Most minions author nothing — the secure defaults apply.\n * isolation: undefined\n *\n * // A minion whose image runs as uid 1000 and needs a scratch directory:\n * isolation: { runAsUser: 1000, runAsGroup: 1000, writablePaths: ['/var/cache/scraper'] }\n * ```\n */\nexport const MinionIsolationSchema = RuntimeIsolationSchema;\nexport type MinionIsolation = RuntimeIsolation;\n\n/**\n * The mandatory writable mount, kept as a named constant rather than a literal\n * repeated across the k8s and compose renderers — two copies of a path this\n * load-bearing WILL drift, and the failure mode (restart-looping healthy\n * minions) is far from the edit that caused it.\n *\n * Matches `MinionLivenessSchema.filePath`'s default directory.\n */\nexport const MINION_MANDATORY_WRITABLE_PATH = RUNTIME_MANDATORY_WRITABLE_PATH;\n\n/**\n * Per-folder minion configuration (`wildo.minion.config.ts`).\n *\n * Phase 1 schema honesty (KD-1, KD-3, KD-7, KD-8 + G-18 in\n * `.cursor/plans/minions-and-workers-implementation.md`):\n *\n * - `mode` (`'always-up' | 'cron'`) — KD-3. Determines the K8s\n * deployment shape Phase 3 will emit. `schedule` is required iff\n * `mode === 'cron'` (enforced by the top-level `superRefine`).\n *\n * - `reinstantiation` — KD-7. Only meaningful for `'always-up'`\n * today (cron minions are short-lived); the schema accepts the\n * field on cron minions but it stays inert at runtime so the\n * surface stays uniform.\n *\n * - `replicas` is pinned to `1` per KD-8 — minions are SINGLETONS\n * in v1 (no horizontal scaling). The literal-`1` constraint is\n * enforced at parse time so a future \"let me run two of these\"\n * request must come through a deliberate schema bump, not a silent\n * config tweak. Authored explicitly in the schema (rather than\n * omitted) so the K8s manifest emitter has a single source of\n * truth — symmetric with the worker schema's `replicas` field.\n *\n * - `liveness` — G-18 + NR-3. Defaults to file-heartbeat 30s /\n * stale-after 90s, which the cron-cadence vs liveness-cadence\n * note in NR-3 picked as the safe baseline.\n *\n * - The legacy `dataAccess` block is REMOVED — minion access to\n * repositories is governed by the bucket-level `resourceAccess`\n * whitelist authored on the minion entry in `wildo.saas.config.ts`\n * (KD-11). Keeping a redundant per-minion-config field would\n * create a second source of truth and an obvious \"which one wins?\"\n * bug surface.\n *\n * - `isolation` — container security posture. Only the image-dependent and\n * ADDITIVE knobs are authorable; the security floor (non-root, read-only\n * rootfs, dropped capabilities, seccomp, no service-account token) is\n * emitted unconditionally and cannot be configured down. See\n * {@link MinionIsolationSchema} for why that split exists.\n *\n * - `localProviders` — providers this minion AUTHORS beside its own code,\n * for the case the application catalog does not carry them (R7).\n *\n * This is NOT a return of the legacy `providers` block, which was removed so\n * that `defineSaaSProviders({ scopes })` would be the single source of truth\n * and per-minion visibility a PROJECTION of it. That property is preserved:\n * a fragment declared here is REGISTERED INTO the application catalog at\n * config load (`registerMinionLocalProviderFragments`), and everything\n * downstream — scope projection, the fail-closed secret filtering, the\n * generated runtime module — reads the catalog and cannot tell a registered\n * fragment from an application-authored entry.\n *\n * One authoring LOCATION per provider; one runtime SOURCE for all of them.\n * The consequence that matters: because a registered fragment IS a catalog\n * entry, its SECRETS arrive through the same single mechanism as every other\n * provider's. Authoring a provider here creates no second secret channel.\n *\n * The schema is `z.strictObject` so a typo (`scedule:` instead of\n * `schedule:`) fails fast — same posture as `WildoSaasConfigSchema`.\n */\nexport const WildoMinionConfigSchema = z.strictObject({\n version: z.number().int().positive().default(1),\n name: z.string().min(1),\n displayName: z.string().min(1),\n description: z.string().optional(),\n runtime: WorkerRuntimeSchema,\n /**\n * Provider fragments this minion authors locally — registered into the\n * application catalog at config load, never a parallel catalog. See the\n * `localProviders` note in this file's header for why this is not the legacy\n * `providers` block returning.\n *\n * Keyed by provider ref, exactly as the application catalog is, so a collision\n * with an application-declared ref is detectable — and REFUSED — at\n * registration rather than resolved by a precedence rule nobody reads.\n */\n localProviders: z.record(z.string().min(1), z.record(z.string().min(1), z.unknown())).optional(),\n mode: z.enum(['always-up', 'cron']),\n /** Cron expression (required iff `mode === 'cron'`). */\n schedule: z.string().min(1).optional(),\n // `.prefault({})` (NOT `.default({})`) so the empty input flows\n // through the inner schema and the field defaults are applied —\n // Zod v4's `.default(x)` returns `x` as-is without re-parsing.\n // See the matching JSDoc on `define-worker-config.ts > http` for\n // the rationale.\n reinstantiation: MinionReinstantiationSchema.prefault({}),\n replicas: z.literal(1).default(1),\n liveness: MinionLivenessSchema.prefault({}),\n resources: ResourceLimitsSchema.optional(),\n // `.prefault({})` for the same reason as `reinstantiation`/`liveness`: the\n // empty input must flow through the inner schema so the field defaults apply.\n // NOT `.optional()` — an absent `isolation` block must still produce the\n // secure uid/gid/pids defaults, because \"authored nothing\" is the common case\n // and it is exactly the case that must come out hardened.\n isolation: MinionIsolationSchema.prefault({}),\n}).superRefine((cfg, ctx) => {\n if (cfg.mode === 'cron' && !cfg.schedule) {\n ctx.addIssue({\n code: 'custom',\n path: ['schedule'],\n message: \"schedule is required when mode === 'cron' (a cron minion without a schedule is a no-op).\",\n });\n }\n refineRuntimeIsolation(cfg.isolation, ctx);\n\n if (cfg.mode === 'always-up' && cfg.schedule) {\n ctx.addIssue({\n code: 'custom',\n path: ['schedule'],\n message:\n \"schedule must be omitted when mode === 'always-up' (the always-up loop is the single tick source; \" +\n 'authoring a cron expression on top would create two competing schedulers).',\n });\n }\n});\nexport type WildoMinionConfig = z.infer<typeof WildoMinionConfigSchema>;\nexport type WildoMinionConfigInput = z.input<typeof WildoMinionConfigSchema>;\n\n/**\n * Define a minion (long-running actor host or scheduled tick) configuration.\n *\n * Minions have NO inbound HTTP surface (KD-1) and are SINGLETONS\n * (`replicas: 1`, KD-8). The full v1 architectural rationale is in\n * `.cursor/plans/minions-and-workers-implementation.md`.\n */\nexport function defineMinionConfig(config: WildoMinionConfigInput): WildoMinionConfig {\n return WildoMinionConfigSchema.parse(config);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"define-minion-config.js","sourceRoot":"","sources":["../../../../src/project-config/define-minion-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,+BAA+B,EAC/B,sBAAsB,GAEvB,MAAM,sCAAsC,CAAC;AAE9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,YAAY,CAAC;IACxD,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,C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UAAU,CAAC;YAClB,OAAO,EACL,uGAAuG;SAC1G,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAA8B;IAC/D,OAAO,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n WorkerRuntimeSchema,\n ResourceLimitsSchema,\n RuntimeIsolationSchema,\n RUNTIME_MANDATORY_WRITABLE_PATH,\n refineRuntimeIsolation,\n type RuntimeIsolation,\n} from './shared/service-definitions.schemas';\n\n/**\n * Reinstantiation policy when an `'always-up'` minion is restarted\n * (deploy, config reload, manual `kubectl rollout restart`).\n *\n * - `'kill_previous'` (default) — the apps-manager terminates the\n * running pod before the new one starts. Matches K8s `Recreate`\n * strategy. Correct default for stateful actor-flow minions where\n * two concurrent instances would corrupt invariants.\n * - `'let_run'` — both pods run side-by-side until the previous one\n * exits naturally. Matches K8s `RollingUpdate` strategy with\n * `maxSurge: 1, maxUnavailable: 0`. Authored explicitly when the\n * minion can tolerate momentary duplication (e.g. an idempotent\n * scraper).\n *\n * `gracePeriodSec` is optional and only meaningful for\n * `'kill_previous'` (forwarded to the K8s `terminationGracePeriodSeconds`\n * Phase 3 manifest emitter — Q7 LOCKED). Authoring it on `'let_run'`\n * is harmless today but silently ignored.\n */\nexport const MinionReinstantiationSchema = z.strictObject({\n policy: z.enum(['kill_previous', 'let_run']).default('kill_previous'),\n gracePeriodSec: z.number().int().nonnegative().optional(),\n});\nexport type MinionReinstantiation = z.infer<typeof MinionReinstantiationSchema>;\n\n/**\n * Per-minion liveness contract — G-18 + NR-3 in\n * `.cursor/plans/minions-and-workers-implementation.md`.\n *\n * Minions have NO inbound HTTP surface (KD-1 / Q5 LOCKED), so the K8s\n * liveness probe cannot use the `httpGet` shape that workers use. The\n * supported probes are:\n *\n * - `kind: 'file'` (default) — the minion's actor loop touches\n * `filePath` every `heartbeat.intervalSec` seconds. The K8s probe\n * is an `exec` probe that runs `find <filePath> -mmin -<staleAfterSec/60>`\n * and fails when the file is older than `staleAfterSec`.\n *\n * - `kind: 'exec'` — the minion provides its own probe command (e.g.\n * `['curl', '-fsS', 'http://localhost:9090/internal/healthz']` for\n * a minion that exposes a loopback-only debug surface). The\n * contract is \"exit 0 = healthy, anything else = restart\".\n *\n * `staleAfterSec` MUST be > `heartbeat.intervalSec` (the schema's\n * `superRefine` enforces this — a stale-window equal to or shorter\n * than the heartbeat would guarantee K8s flaps the pod even when\n * the minion is healthy). The 90s / 30s defaults give a 3× safety\n * margin which the cron-cadence vs liveness-cadence interaction\n * documented in NR-3 needs to keep the deploy story sane.\n */\nexport const MinionLivenessSchema = z.strictObject({\n kind: z.enum(['file', 'exec']).default('file'),\n filePath: z.string().min(1).default('/tmp/wildo-minion-alive'),\n execCommand: z.array(z.string().min(1)).min(1).optional(),\n heartbeat: z\n .strictObject({\n intervalSec: z.number().int().positive().default(30),\n })\n .prefault({}),\n staleAfterSec: z.number().int().positive().default(90),\n}).superRefine((val, ctx) => {\n if (val.kind === 'exec' && (!val.execCommand || val.execCommand.length === 0)) {\n ctx.addIssue({\n code: 'custom',\n path: ['execCommand'],\n message: \"liveness.execCommand is required (and non-empty) when liveness.kind === 'exec'.\",\n });\n }\n if (val.staleAfterSec <= val.heartbeat.intervalSec) {\n ctx.addIssue({\n code: 'custom',\n path: ['staleAfterSec'],\n message:\n `liveness.staleAfterSec (${val.staleAfterSec}s) must be strictly greater than ` +\n `liveness.heartbeat.intervalSec (${val.heartbeat.intervalSec}s) — otherwise the K8s ` +\n 'liveness probe will flap the pod even when the minion is healthy. ' +\n 'Recommended: staleAfterSec ≥ 3× heartbeat.intervalSec.',\n });\n }\n});\nexport type MinionLiveness = z.infer<typeof MinionLivenessSchema>;\n\n/**\n * Per-minion container isolation. An ALIAS of the shared\n * {@link RuntimeIsolationSchema} — minions and workers have identical isolation\n * contracts, and the floor/authorable split is documented there. Kept as a named\n * export so minion-facing code and its pins read in minion terms.\n *\n * ## ⚠️ The one MINION-SPECIFIC consequence, and it is load-bearing\n *\n * {@link MinionLivenessSchema} defaults to a FILE probe at\n * `/tmp/wildo-minion-alive`, touched by the actor loop every\n * `heartbeat.intervalSec`. So `readOnlyRootFilesystem: true` with no writable\n * `/tmp` makes the heartbeat unwritable and Kubernetes restart-loops **every\n * healthy minion** — the probe fails for a reason unrelated to the workload's\n * health. The renderers always emit the `/tmp` mount alongside the read-only\n * flag; the two must never be separated.\n *\n * Workers probe over HTTP and so do not share this acute coupling, which is why\n * the reasoning lives here rather than in the shared schema.\n *\n * @example\n * ```ts\n * // Most minions author nothing — the secure defaults apply.\n * isolation: undefined\n *\n * // A minion whose image runs as uid 1000 and needs a scratch directory:\n * isolation: { runAsUser: 1000, runAsGroup: 1000, writablePaths: ['/var/cache/scraper'] }\n * ```\n */\nexport const MinionIsolationSchema = RuntimeIsolationSchema;\nexport type MinionIsolation = RuntimeIsolation;\n\n/**\n * The mandatory writable mount, kept as a named constant rather than a literal\n * repeated across the k8s and compose renderers — two copies of a path this\n * load-bearing WILL drift, and the failure mode (restart-looping healthy\n * minions) is far from the edit that caused it.\n *\n * Matches `MinionLivenessSchema.filePath`'s default directory.\n */\nexport const MINION_MANDATORY_WRITABLE_PATH = RUNTIME_MANDATORY_WRITABLE_PATH;\n\n/**\n * Per-folder minion configuration (`wildo.minion.config.ts`).\n *\n * Phase 1 schema honesty (KD-1, KD-3, KD-7, KD-8 + G-18 in\n * `.cursor/plans/minions-and-workers-implementation.md`):\n *\n * - `mode` (`'always-up' | 'cron'`) — KD-3. Determines the K8s\n * deployment shape Phase 3 will emit. `schedule` is required iff\n * `mode === 'cron'` (enforced by the top-level `superRefine`).\n *\n * - `reinstantiation` — KD-7. Only meaningful for `'always-up'`\n * today (cron minions are short-lived); the schema accepts the\n * field on cron minions but it stays inert at runtime so the\n * surface stays uniform.\n *\n * - `replicas` is pinned to `1` per KD-8 — minions are SINGLETONS\n * in v1 (no horizontal scaling). The literal-`1` constraint is\n * enforced at parse time so a future \"let me run two of these\"\n * request must come through a deliberate schema bump, not a silent\n * config tweak. Authored explicitly in the schema (rather than\n * omitted) so the K8s manifest emitter has a single source of\n * truth — symmetric with the worker schema's `replicas` field.\n *\n * - `liveness` — G-18 + NR-3. Defaults to file-heartbeat 30s /\n * stale-after 90s, which the cron-cadence vs liveness-cadence\n * note in NR-3 picked as the safe baseline.\n *\n * - The legacy `dataAccess` block is REMOVED — minion access to\n * repositories is governed by the bucket-level `resourceAccess`\n * whitelist authored on the minion entry in `wildo.saas.config.ts`\n * (KD-11). Keeping a redundant per-minion-config field would\n * create a second source of truth and an obvious \"which one wins?\"\n * bug surface.\n *\n * - `isolation` — container security posture. Only the image-dependent and\n * ADDITIVE knobs are authorable; the security floor (non-root, read-only\n * rootfs, dropped capabilities, seccomp, no service-account token) is\n * emitted unconditionally and cannot be configured down. See\n * {@link MinionIsolationSchema} for why that split exists.\n *\n * - `localProviders` — providers this minion AUTHORS beside its own code,\n * for the case the application catalog does not carry them (R7).\n *\n * This is NOT a return of the legacy `providers` block, which was removed so\n * that `defineSaaSProviders({ scopes })` would be the single source of truth\n * and per-minion visibility a PROJECTION of it. That property is preserved:\n * a fragment declared here is REGISTERED INTO the application catalog at\n * config load (`registerMinionLocalProviderFragments`), and everything\n * downstream — scope projection, the fail-closed secret filtering, the\n * generated runtime module — reads the catalog and cannot tell a registered\n * fragment from an application-authored entry.\n *\n * One authoring LOCATION per provider; one runtime SOURCE for all of them.\n * The consequence that matters: because a registered fragment IS a catalog\n * entry, its SECRETS arrive through the same single mechanism as every other\n * provider's. Authoring a provider here creates no second secret channel.\n *\n * The schema is `z.strictObject` so a typo (`scedule:` instead of\n * `schedule:`) fails fast — same posture as `WildoSaasConfigSchema`.\n */\nexport const WildoMinionConfigSchema = z.strictObject({\n version: z.number().int().positive().default(1),\n name: z.string().min(1),\n displayName: z.string().min(1),\n description: z.string().optional(),\n runtime: WorkerRuntimeSchema,\n /**\n * Provider fragments this minion authors locally — registered into the\n * application catalog at config load, never a parallel catalog. See the\n * `localProviders` note in this file's header for why this is not the legacy\n * `providers` block returning.\n *\n * Keyed by provider ref, exactly as the application catalog is, so a collision\n * with an application-declared ref is detectable — and REFUSED — at\n * registration rather than resolved by a precedence rule nobody reads.\n */\n localProviders: z.record(z.string().min(1), z.record(z.string().min(1), z.unknown())).optional(),\n mode: z.enum(['always-up', 'cron']),\n /** Cron expression (required iff `mode === 'cron'`). */\n schedule: z.string().min(1).optional(),\n // `.prefault({})` (NOT `.default({})`) so the empty input flows\n // through the inner schema and the field defaults are applied —\n // Zod v4's `.default(x)` returns `x` as-is without re-parsing.\n // See the matching JSDoc on `define-worker-config.ts > http` for\n // the rationale.\n reinstantiation: MinionReinstantiationSchema.prefault({}),\n replicas: z.literal(1).default(1),\n liveness: MinionLivenessSchema.prefault({}),\n resources: ResourceLimitsSchema.optional(),\n // `.prefault({})` for the same reason as `reinstantiation`/`liveness`: the\n // empty input must flow through the inner schema so the field defaults apply.\n // NOT `.optional()` — an absent `isolation` block must still produce the\n // secure uid/gid/pids defaults, because \"authored nothing\" is the common case\n // and it is exactly the case that must come out hardened.\n isolation: MinionIsolationSchema.prefault({}),\n}).superRefine((cfg, ctx) => {\n if (cfg.mode === 'cron' && !cfg.schedule) {\n ctx.addIssue({\n code: 'custom',\n path: ['schedule'],\n message: \"schedule is required when mode === 'cron' (a cron minion without a schedule is a no-op).\",\n });\n }\n refineRuntimeIsolation(cfg.isolation, ctx);\n\n if (cfg.mode === 'always-up' && cfg.schedule) {\n ctx.addIssue({\n code: 'custom',\n path: ['schedule'],\n message:\n \"schedule must be omitted when mode === 'always-up'; use mode === 'cron' for platform-scheduled ticks.\",\n });\n }\n});\nexport type WildoMinionConfig = z.infer<typeof WildoMinionConfigSchema>;\nexport type WildoMinionConfigInput = z.input<typeof WildoMinionConfigSchema>;\n\n/**\n * Define a minion (long-running actor host or scheduled tick) configuration.\n *\n * Minions have NO inbound HTTP surface (KD-1) and are SINGLETONS\n * (`replicas: 1`, KD-8). The full v1 architectural rationale is in\n * `.cursor/plans/minions-and-workers-implementation.md`.\n */\nexport function defineMinionConfig(config: WildoMinionConfigInput): WildoMinionConfig {\n return WildoMinionConfigSchema.parse(config);\n}\n"]}
|