@wildo-ai/platform-config-lib 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/dist/esm/_unimplemented/index.d.ts.map +1 -1
  2. package/dist/esm/_unimplemented/index.js.map +1 -1
  3. package/dist/esm/_unimplemented/soft-warn.d.ts.map +1 -1
  4. package/dist/esm/_unimplemented/soft-warn.js.map +1 -1
  5. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts.map +1 -1
  6. package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +1 -1
  7. package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
  8. package/dist/esm/bootstrap/application-backend-env.contracts.js.map +1 -1
  9. package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts.map +1 -1
  10. package/dist/esm/bootstrap/application-creation-verification-env.contracts.js.map +1 -1
  11. package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
  12. package/dist/esm/bootstrap/bootstrap-planner.js.map +1 -1
  13. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  14. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  15. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  16. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  17. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  18. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  19. package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -1
  20. package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -1
  21. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
  22. package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
  23. package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
  24. package/dist/esm/bootstrap/runtime-network-policy.js.map +1 -1
  25. package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
  26. package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
  27. package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -1
  28. package/dist/esm/bootstrap/runtime-platform-access.js.map +1 -1
  29. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
  30. package/dist/esm/bootstrap/runtime-principal.contracts.js.map +1 -1
  31. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
  32. package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
  33. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
  34. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
  35. package/dist/esm/config-authoring.entry.d.ts.map +1 -1
  36. package/dist/esm/config-authoring.entry.js.map +1 -1
  37. package/dist/esm/credentials/credential-generator.service.d.ts.map +1 -1
  38. package/dist/esm/credentials/credential-generator.service.js.map +1 -1
  39. package/dist/esm/index.d.ts.map +1 -1
  40. package/dist/esm/index.js.map +1 -1
  41. package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -1
  42. package/dist/esm/lockfile/build-parallelism.js.map +1 -1
  43. package/dist/esm/lockfile/canonical-json.d.ts.map +1 -1
  44. package/dist/esm/lockfile/canonical-json.js.map +1 -1
  45. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
  46. package/dist/esm/lockfile/lockfile-io.js.map +1 -1
  47. package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
  48. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  49. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
  50. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
  51. package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -1
  52. package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -1
  53. package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
  54. package/dist/esm/project-config/define-framework-config.js.map +1 -1
  55. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  56. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  57. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  58. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  59. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  60. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  61. package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
  62. package/dist/esm/project-config/define-worker-config.js.map +1 -1
  63. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -1
  64. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
  65. package/dist/esm/project-config/index.d.ts.map +1 -1
  66. package/dist/esm/project-config/index.js.map +1 -1
  67. package/dist/esm/project-config/loader.d.ts.map +1 -1
  68. package/dist/esm/project-config/loader.js.map +1 -1
  69. package/dist/esm/project-config/minion-local-provider-registration.d.ts.map +1 -1
  70. package/dist/esm/project-config/minion-local-provider-registration.js.map +1 -1
  71. package/dist/esm/project-config/npm-version-range.d.ts.map +1 -1
  72. package/dist/esm/project-config/npm-version-range.js.map +1 -1
  73. package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -1
  74. package/dist/esm/project-config/provider-catalog-types.js.map +1 -1
  75. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  76. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  77. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  78. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  79. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
  80. package/dist/esm/project-config/shared/application-creation-verification.schemas.js.map +1 -1
  81. package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
  82. package/dist/esm/project-config/shared/application-modules.schemas.js.map +1 -1
  83. package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
  84. package/dist/esm/project-config/shared/application-modules.utils.js.map +1 -1
  85. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
  86. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
  87. package/dist/esm/project-config/shared/backing-service-servability.d.ts.map +1 -1
  88. package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -1
  89. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  90. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  91. package/dist/esm/project-config/shared/cdn.example.d.ts.map +1 -1
  92. package/dist/esm/project-config/shared/cdn.example.js.map +1 -1
  93. package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
  94. package/dist/esm/project-config/shared/cdn.schemas.js.map +1 -1
  95. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
  96. package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
  97. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
  98. package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
  99. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  100. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  101. package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
  102. package/dist/esm/project-config/shared/data-services.schemas.js.map +1 -1
  103. package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
  104. package/dist/esm/project-config/shared/env-example-defaults.js.map +1 -1
  105. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  106. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  107. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  108. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  109. package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -1
  110. package/dist/esm/project-config/shared/infra-service.schemas.js.map +1 -1
  111. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  112. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  113. package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
  114. package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
  115. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
  116. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
  117. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
  118. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
  119. package/dist/esm/project-config/shared/object-storage-session-policy.d.ts.map +1 -1
  120. package/dist/esm/project-config/shared/object-storage-session-policy.js.map +1 -1
  121. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  122. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  123. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -1
  124. package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -1
  125. package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +1 -1
  126. package/dist/esm/project-config/shared/schema-version.schemas.js.map +1 -1
  127. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
  128. package/dist/esm/project-config/shared/service-definitions.schemas.js.map +1 -1
  129. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -1
  130. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -1
  131. package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -1
  132. package/dist/esm/project-config/static-asset-import-noop.js.map +1 -1
  133. package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
  134. package/dist/esm/registry/artifact-domain.schemas.js.map +1 -1
  135. package/dist/esm/registry/digest.schemas.d.ts.map +1 -1
  136. package/dist/esm/registry/digest.schemas.js.map +1 -1
  137. package/dist/esm/registry/index.d.ts.map +1 -1
  138. package/dist/esm/registry/index.js.map +1 -1
  139. package/dist/esm/registry/local-checkout-source.d.ts.map +1 -1
  140. package/dist/esm/registry/local-checkout-source.js.map +1 -1
  141. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
  142. package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
  143. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
  144. package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
  145. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  146. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  147. package/dist/esm/registry/module-search.schemas.d.ts.map +1 -1
  148. package/dist/esm/registry/module-search.schemas.js.map +1 -1
  149. package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
  150. package/dist/esm/registry/registry-config.schemas.js.map +1 -1
  151. package/dist/esm/registry/registry-defaults.constants.d.ts.map +1 -1
  152. package/dist/esm/registry/registry-defaults.constants.js.map +1 -1
  153. package/dist/esm/registry/registry-errors.d.ts.map +1 -1
  154. package/dist/esm/registry/registry-errors.js.map +1 -1
  155. package/dist/esm/registry/registry-keys.schemas.d.ts.map +1 -1
  156. package/dist/esm/registry/registry-keys.schemas.js.map +1 -1
  157. package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
  158. package/dist/esm/registry/registry-section-schemas.constants.js.map +1 -1
  159. package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
  160. package/dist/esm/release/framework-release.constants.js.map +1 -1
  161. package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
  162. package/dist/esm/schemas/framework-info.schemas.js.map +1 -1
  163. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  164. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  165. package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
  166. package/dist/esm/schemas/platform-application-config.schemas.js.map +1 -1
  167. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
  168. package/dist/esm/schemas/platform-application-secrets.schemas.js.map +1 -1
  169. package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
  170. package/dist/esm/schemas/platform-config.schemas.js.map +1 -1
  171. package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -1
  172. package/dist/esm/workspace-scope/application-subject-manifest.js.map +1 -1
  173. package/dist/esm/workspace-scope/index.d.ts.map +1 -1
  174. package/dist/esm/workspace-scope/index.js.map +1 -1
  175. package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
  176. package/dist/esm/workspace-scope/resolve-homes.js.map +1 -1
  177. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  178. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  179. package/dist/esm/workspace-scope/workspace-scope-detector.d.ts.map +1 -1
  180. package/dist/esm/workspace-scope/workspace-scope-detector.js.map +1 -1
  181. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  182. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  183. package/dist/tsconfig.build.tsbuildinfo +1 -0
  184. package/package.json +7 -7
  185. package/dist/esm/registry/companion-api.schemas.d.ts +0 -0
  186. package/dist/esm/registry/companion-api.schemas.d.ts.map +0 -0
  187. package/dist/esm/registry/companion-api.schemas.js.map +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"infra-providers.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/infra-providers.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,eAkBX;AAlBD,WAAY,eAAe;IACzB,0DAAuC,CAAA;IACvC,8DAA2C,CAAA;IAC3C,0DAAuC,CAAA;IACvC,oDAAiC,CAAA;IACjC,4DAAyC,CAAA;IACzC,oDAAiC,CAAA;IACjC,kDAA+B,CAAA;IAC/B;;;OAGG;IACH,0DAAuC,CAAA;IACvC;;;OAGG;IACH,oDAAiC,CAAA;AACnC,CAAC,EAlBW,eAAe,KAAf,eA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AC,CAAC;AAKH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,yCAAyC,GAAG,CAAC,CAAC,YAAY,CAAC;IAC/D,qBAAqB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC1E,qBAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC7D,CAAC,CAAC;AAKH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAC9C,4CAA4C,CAAC,MAAM,CAAC;IAClD,aAAa,EAAE,4CAA4C,CAAC,QAAQ,EAAE;IACtE,UAAU,EAAE,yCAAyC,CAAC,QAAQ,EAAE;CACjE,CAAC,CAAC,WAAW,EAAE,CAAC;AA8gBnB;;;;;;;;;;GAUG;AACH,MAAM,CAAN,IAAY,wBAEX;AAFD,WAAY,wBAAwB;IAClC,mFAAc,CAAA;AAChB,CAAC,EAFW,wBAAwB,KAAxB,wBAAwB,QAEnC","sourcesContent":["import { z } from 'zod';\nimport type { ApplicationRuntimePrincipal } from '../../bootstrap/runtime-principal.contracts';\nimport type { MinionResourceGrants } from './minion-resource-access.validation';\nimport type { PostgreSQLSSLMode } from '@wildo-ai/saas-models';\n\n/**\n * Environment functions an infra environment must fulfill.\n *\n * This vocabulary is intentionally platform/config-owned, not part of\n * `@wildo-ai/saas-models`, because browser/runtime packages must not\n * import infrastructure provider concepts.\n */\nexport enum InfraCapability {\n DOCUMENT_DATABASE = 'DOCUMENT_DATABASE',\n RELATIONAL_DATABASE = 'RELATIONAL_DATABASE',\n AUDIT_LOG_STORAGE = 'AUDIT_LOG_STORAGE',\n OBJECT_STORAGE = 'OBJECT_STORAGE',\n ANTIVIRUS_SCANNING = 'ANTIVIRUS_SCANNING',\n QUEUING_SYSTEM = 'QUEUING_SYSTEM',\n CACHE_MANAGER = 'CACHE_MANAGER',\n /**\n * OTLP telemetry. GRANTED TO EVERY RUNTIME, never declared as a backing service — see\n * {@link RUNTIME_GRANTED_INFRA_CAPABILITIES}.\n */\n METRICS_TELEMETRY = 'METRICS_TELEMETRY',\n /**\n * Backup. RESERVED — no backing-service kind declares it and no module serves it; see\n * {@link RESERVED_INFRA_CAPABILITIES}.\n */\n BACKUP_MANAGER = 'BACKUP_MANAGER',\n}\n\n/**\n * Capabilities NO `BackingServiceKind` projects to — granted to a runtime by the platform rather\n * than declared by an environment.\n *\n * `BackingServiceKindToInfraCapability` used to be described as bijective, and a test asserted the\n * reverse direction: every capability reachable from some kind. That held only while every\n * capability was something an environment points at. It is not a property of the model, and reading\n * it as one is what kept `metrics-telemetry` alive as an authoring surface with no consumer.\n *\n * Membership here is the ANSWER to \"why does this capability have no kind\", so a capability that\n * belongs in neither place is a real gap and stays visible as one.\n */\nexport const RUNTIME_GRANTED_INFRA_CAPABILITIES: Readonly<Partial<Record<InfraCapability, string>>> = {\n /*\n * Telemetry is configured in TWO places, and a backing service is neither of them: the endpoint is\n * authored at `observability.telemetry.endpoint` (projected to `OTEL_EXPORTER_OTLP_ENDPOINT`), and\n * the auth header is derived provider-agnostically from the selected `OBSERVABILITY_TELEMETRY`\n * engine provider. Nothing is left for an environment to declare, and nothing for an\n * infra-provider module to mint — those exist to issue PER-APPLICATION credentials, and a\n * telemetry token is one provider-level secret shared by every runtime.\n *\n * The capability itself is load-bearing and must NOT be withdrawn with the kind: it carries the\n * `DATA_TELEMETRY` network in `NETWORK_FOR_CAPABILITY` and sits in\n * `MINION_UNCONDITIONAL_CAPABILITIES`, so every runtime reaches the collector through it. Setting\n * it to `null` there was corrected on 2026-08-12 precisely because it \"would have cut tracing for\n * every runtime the moment segmentation was enforced, with NO readiness check covering it\".\n */\n [InfraCapability.METRICS_TELEMETRY]:\n 'Authored at observability.telemetry + the OBSERVABILITY_TELEMETRY provider; granted to every '\n + 'runtime for the DATA_TELEMETRY network, so no environment declares it and no module mints it.',\n};\n\n/**\n * Capabilities kept as VOCABULARY with no way to be selected yet — neither declared by an\n * environment (no `BackingServiceKind` projects to them) nor granted to runtimes by the platform.\n *\n * This is the third answer to \"why does this capability have no kind\", beside\n * `BackingServiceKindToInfraCapability` and {@link RUNTIME_GRANTED_INFRA_CAPABILITIES}. It exists so\n * that answer is WRITTEN DOWN: a capability in none of the three is an unexplained gap, and the\n * reachability test still fails on it.\n *\n * Membership is a statement that nothing can reach the capability today. It is not a placeholder\n * an environment may fill in — withdrawing the declarable kind is what stopped it being one.\n */\nexport const RESERVED_INFRA_CAPABILITIES: Readonly<Partial<Record<InfraCapability, string>>> = {\n /*\n * The `backup` backing-service kind was WITHDRAWN 2026-09-26 (#1693): it resolved to no provider,\n * rendered no workload, and nothing read it. The capability stays because whether backup is modelled\n * as a capability at all is the design question #8 owns. Its network is `null` in\n * `NETWORK_FOR_CAPABILITY` for the same reason — no runtime dials a backup target.\n */\n [InfraCapability.BACKUP_MANAGER]:\n 'Reserved for the backup design (#8): no environment can declare it and no module serves it.',\n};\n\n/**\n * Built-in environment-facing provider ids — the (kind × hosting-model\n * × brand) projection vocabulary. Apps SELECT these implicitly via\n * `wildo.infra.<env>.config.ts > backingServices.<kind>.{source,\n * provider?}`; the planner resolves the tuple to one of these\n * `InfraProvider` values via `resolveInfraProvider`.\n *\n * **Naming convention**: `<KIND>_<BRAND>` — `BRAND` is either a\n * vendor (Atlas / AWS_RDS / Supabase / …) for managed services, or\n * an open-source software name (MinIO / vanilla self-hosted) for\n * self-hosted. `<KIND>_MANAGED` exists as a generic fallback when\n * the operator hasn't named a brand (Postgres in particular —\n * acceptable while the brand catalog is incomplete; Mongo's\n * `MONGODB_ATLAS` is the only branded managed option today, so no\n * `MONGODB_MANAGED` generic is needed).\n *\n * Slice 4.B.0 (2026-05-07) added the Postgres brand expansion to\n * generalize the source/brand split that S3 already had.\n */\nexport enum InfraProvider {\n // === MongoDB ===\n /** Self-hosted vanilla MongoDB (in-cluster docker-compose / K8s\n * deployment). Selected via `source: SELF`. No `provider` brand\n * required (Mongo's `provider` axis is reserved for managed\n * variants like `'atlas'`). */\n MONGODB_SELF = 'mongodb-self',\n /** MongoDB Atlas (managed cloud). brand: `'atlas'`. */\n MONGODB_ATLAS = 'mongodb-atlas',\n\n // === PostgreSQL ===\n /** Self-hosted vanilla PostgreSQL (in-cluster docker-compose /\n * K8s deployment). Selected via `source: SELF`. */\n POSTGRES_SELF = 'postgres-self',\n /** Generic managed Postgres — fallback when the operator hasn't\n * named a brand. Concrete brand identifiers below are preferred. */\n POSTGRES_MANAGED = 'postgres-managed',\n /** AWS RDS for PostgreSQL. brand: `'aws-rds'`. */\n POSTGRES_AWS_RDS = 'postgres-aws-rds',\n /** Google Cloud SQL for PostgreSQL. brand: `'gcp-cloud-sql'`. */\n POSTGRES_GCP_CLOUD_SQL = 'postgres-gcp-cloud-sql',\n /** Azure Database for PostgreSQL. brand: `'azure-database'`. */\n POSTGRES_AZURE_DATABASE = 'postgres-azure-database',\n /** Supabase. brand: `'supabase'`. */\n POSTGRES_SUPABASE = 'postgres-supabase',\n /** Neon. brand: `'neon'`. */\n POSTGRES_NEON = 'postgres-neon',\n /** Render. brand: `'render'`. */\n POSTGRES_RENDER = 'postgres-render',\n\n // === Redis / Valkey ===\n /** Self-hosted Redis-compatible cache (today: Valkey under the\n * hood; the engine adapter is wire-protocol compatible with\n * Redis OSS). Selected via `source: SELF`. */\n REDIS_SELF = 'redis-self',\n\n // === RabbitMQ ===\n /** Self-hosted RabbitMQ broker (in-cluster docker-compose / K8s\n * deployment). Selected via `source: SELF`. */\n RABBITMQ_SELF = 'rabbitmq-self',\n\n // === Object storage ===\n /** MinIO (self-hosted S3-compatible). brand: `'minio'` (or unset on\n * source=self — MinIO is the canonical default). */\n MINIO_SELF = 'minio-self',\n /** AWS S3 (managed). brand: `'aws'`. */\n AWS_S3 = 'aws-s3',\n\n // === Stateless infra ===\n /** Self-hosted ClamAV antivirus scanning service. Stateless (no\n * auth, no per-tenant state); apps connect to a shared host:port.\n * Selected via `source: SELF`. */\n CLAMAV_SELF = 'clamav-self',\n /** Self-hosted immudb — immutable, cryptographically-verifiable DB used as a\n * tamper-evident audit-log store. Selected via `source: SELF`. */\n IMMUDB_SELF = 'immudb-self',\n}\n\n/**\n * Platform-side consumers of an `InfraProviderPlanContribution.platformAdmin`\n * block. Each provider declares which platform services receive its\n * admin credentials so the planner can route them to the right pod /\n * compose service / env file.\n *\n * Locked enum (2026-05-05). Extending requires adding the consumer\n * enum value here AND in every `InfraProviderModule.plan()` that\n * legitimately delivers admin credentials to the new consumer.\n *\n * Excluded by design (consume platform-service APIs, not direct infra-admin):\n * - `file-generator`\n * - `sourcecode-provider`\n *\n * Add as real consumers surface, not pre-emptively.\n */\nexport enum InfraPlatformAdminConsumer {\n APPS_MANAGER = 'apps-manager',\n COMPANION = 'companion',\n CRONTABS_BATCHES_MANAGER = 'crontabs-batches-manager',\n MODULE_REGISTRY = 'module-registry',\n}\n\n/**\n * Audience-less contributions: describe the infra resource itself.\n * Same payload regardless of who consumes it (compose definitions,\n * K8s manifests, CI checks).\n */\nconst InfraProviderResourceContributionShapeSchema = z.strictObject({\n dockerComposeServices: z.array(z.string().min(1)).optional(),\n k8sResources: z.array(z.string().min(1)).optional(),\n startupScripts: z.array(z.string().min(1)).optional(),\n ciChecks: z.array(z.string().min(1)).optional(),\n policyChecks: z.array(z.string().min(1)).optional(),\n});\n\n/**\n * Audience: platform services that need **management-API access** to\n * administer the infra resource (create per-app users / vhosts / ACLs\n * / DBs). This is audience-1 in the three-audience model:\n *\n * 1. **Platform-admin** (this contribution slice). Cluster-wide\n * management-API credentials. Consumed by apps-manager (mints\n * per-app users via `mintAppCredentials`), companion (mirrors\n * apps-manager admin role for local dev). `crontabs` /\n * `module-registry` are listed in the enum because they MAY\n * surface admin needs in future slices, but no provider should\n * declare them as consumers in this slice unless evidence\n * surfaces.\n * 2. **Platform-service-scoped** (NOT modeled in `plan()` yet —\n * see LD-8 / Slice 2.5). Per-platform-service publish/consume\n * creds for the platform-services that participate in\n * inter-service messaging (`PLATFORM_SERVICES` enum:\n * apps-manager, crontabs-batches-manager, file-generator).\n * Today provisioned inline by\n * `PlatformInfrastructureManagerService.provisionAllPlatformServices`.\n * 3. **App-scoped** (`appRuntime` slice below). Per-app\n * publish/consume creds, minted by `mintAppCredentials`.\n *\n * `consumers` is the explicit audience declaration: every provider\n * states which platform services receive this block. The planner\n * routes the credentials accordingly.\n */\nconst InfraProviderPlatformAdminContributionSchema = z.strictObject({\n envVars: z.record(z.string(), z.string()).optional(),\n secretEnvVars: z.array(z.string().min(1)).optional(),\n consumers: z.array(z.enum(InfraPlatformAdminConsumer)).optional(),\n});\nexport type InfraProviderPlatformAdminContribution = z.infer<\n typeof InfraProviderPlatformAdminContributionSchema\n>;\n\n/**\n * Audience: customer-app + minion + Node-worker pods. Per-app\n * runtime delivery flows through the persisted\n * `Wildo_Application_Config` and `Wildo_Application_Secrets` blobs in\n * MongoDB (NOT through K8s deployment-Secret env vars; engine\n * consumers like `queue.backend.service.ts:144-149` read from\n * `appConfigService.{config,secrets}` after fetching them at startup\n * via app-config-fetch).\n *\n * - `perAppConfigBlobPaths`: JSON paths into `Wildo_Application_Config`\n * carrying static values (same for every app in this env) — e.g.\n * `'database.rabbitmq.host': 'rabbitmq'`. Merged into the persisted\n * config blob by the planner at sync time.\n * - `perAppSecretBlobPaths`: JSON paths into `Wildo_Application_Secrets`\n * that `mintAppCredentials` will populate at deploy time (e.g.\n * `'database.rabbitmq.username'`). The planner emits only the path\n * list; apps-manager invokes `mintAppCredentials` per app to produce\n * the values, then merges them into the persisted secrets blob via\n * the existing `_merge_WildoApplicationSecrets` machinery.\n *\n * No K8s-Secret-env-var output is intentional: the K8s\n * `{appSlug}-secret` carries only the four-env bootstrap-env-contract\n * (APPLICATION_ID / PLATFORM_APPLICATION_PRIMARY_SECRET /\n * PLATFORM_APPS_MANAGER_URL / APPLICATION_ENV); per-resource creds\n * land in MongoDB, not env. If a future provider genuinely needs\n * env-var injection it can extend this contribution shape via\n * `.passthrough()` — not pre-emptively designed for here.\n */\nconst InfraProviderAppRuntimeContributionSchema = z.strictObject({\n perAppConfigBlobPaths: z.record(z.string().min(1), z.unknown()).optional(),\n perAppSecretBlobPaths: z.array(z.string().min(1)).optional(),\n});\nexport type InfraProviderAppRuntimeContribution = z.infer<\n typeof InfraProviderAppRuntimeContributionSchema\n>;\n\n/**\n * Two-slice contribution shape. The audience-less resource block\n * (compose / K8s / CI) merges with the audience-scoped credential\n * blocks (`platformAdmin`, `appRuntime`).\n *\n * `.passthrough()` is preserved on the merged shape so future\n * contribution kinds (dashboards, alerting rules, autoscaler hints)\n * can be added without breaking existing modules.\n */\nexport const InfraProviderPlanContributionSchema =\n InfraProviderResourceContributionShapeSchema.extend({\n platformAdmin: InfraProviderPlatformAdminContributionSchema.optional(),\n appRuntime: InfraProviderAppRuntimeContributionSchema.optional(),\n }).passthrough();\nexport type InfraProviderPlanContribution = z.infer<typeof InfraProviderPlanContributionSchema>;\n\nexport interface InfraProviderPlanningContext {\n environment: string;\n runtime: string;\n backingServiceKey: string;\n config: unknown;\n}\n\n/**\n * Per-app credential minting context. Called by the orchestrator\n * (apps-manager `wildo-application-lifecycle.service.ts`) at app-init\n * time — not at K8s deploy time. The orchestrator is responsible for\n * **generation policy** (read existing creds from MongoDB; decide\n * rotate-vs-preserve based on `overrideCredentials` flag; generate\n * new password when needed); the module is responsible for the\n * **broker upsert** (install / replace the user on the broker with\n * the supplied password).\n *\n * Inputs:\n * - `appSlug` — the application slug (or its derived namespace\n * `ns`); used by the module to compute the rabbit username,\n * permission regex, etc.\n * - `adminClient` — pre-wired by the orchestrator from the resolved\n * `platformAdmin` env vars; concrete type narrowed per provider at\n * the module's implementation site (e.g., RabbitMQ modules narrow\n * to `RabbitMQManagementClient`).\n * - `secretInputs` — orchestrator-supplied scalars keyed by the JSON\n * path the module declared in `appRuntime.perAppSecretBlobPaths`.\n * For RabbitMQ: `{ 'database.rabbitmq.password': '<orchestrator-generated-password>' }`.\n * The module installs these on the broker; it does NOT generate\n * passwords itself.\n *\n * Note: `applicationEnv` was previously included in this context but\n * removed 2026-05-06 — the integration site (`wildo-application-lifecycle`)\n * does not carry an env field on its options shape.\n */\nexport interface AppCredentialMintingContext {\n /**\n * Raw application slug (e.g., `'wonder-todos'`). Used by modules\n * whose per-app resource names embed the slug directly without\n * env-scoping (e.g., MongoDB database name).\n */\n appSlug: string;\n /**\n * Application namespace = `<appSlug>-<environmentId>`, derived\n * server-side via `buildApplicationNamespace` in platform-config-lib.\n * Used by modules whose per-app resource names scope by namespace\n * (RabbitMQ username, Redis ACL keyPattern, …) — i.e., resources\n * that must remain isolated across env boundaries (`wonder-todos-local`\n * vs `wonder-todos-staging`).\n */\n applicationNamespace: string;\n /**\n * Stable opaque application identifier (Mongo ObjectId-shaped string,\n * matches the convention at\n * `wildo-application-lifecycle.service.ts:552` where the broker\n * permission regex disambiguates per-app queue/reply names by this\n * id, NOT by `appSlug` — the slug is human-readable and could\n * theoretically be reassigned, the id is forever-stable). Required\n * by modules whose per-app resource names embed the application id\n * (RabbitMQ permission regex, …).\n */\n wildoApplicationId: string;\n /**\n * WHICH runtime principal these credentials are for (Step 2 / D17).\n *\n * Optional, and absent means the APPLICATION BACKEND — which keeps every\n * existing module and call site meaning exactly what it meant before, since\n * per-application minting IS the backend principal's case.\n *\n * A module that ignores this field still mints correctly for the backend and\n * simply does not participate in per-principal narrowing; a module that reads\n * it must derive a DISTINCT resource name (ACL username, DB user, queue\n * permission) per principal, or two principals will share one credential and\n * the narrowing will exist only on paper.\n *\n * `buildRuntimePrincipalKey` renders the stable identity to embed in such a\n * name — the same string the stored section is keyed by, so a minted resource\n * and the row that records it cannot drift.\n */\n principal?: ApplicationRuntimePrincipal;\n /**\n * What this principal may touch, in RESOURCE TYPES (Step 3).\n *\n * Deliberately the platform vocabulary, not storage names: a module that\n * grants on tables and a module that grants on collections must receive the\n * same contract, and the translation belongs at each adapter via\n * `resolveGrantStorageNames`.\n *\n * Absent for the application backend, which is granted database-wide by a\n * different path. Absent for a NAMED principal means \"no grants derived\" —\n * which a module must treat as an ERROR rather than as a reason to fall back\n * to the wide grant (D11/R3: a minion with no declared access gets no\n * database user at all, and that is the orchestrator's decision to make).\n */\n resourceGrants?: MinionResourceGrants;\n adminClient: unknown;\n secretInputs: Record<string, string>;\n /**\n * Optional non-secret per-app config inputs supplied by the\n * orchestrator. Distinct from `secretInputs` (passwords) — these\n * are authored topology values that affect HOW the module\n * provisions the per-app resource. Each module documents the keys\n * it consumes in its own JSDoc.\n *\n * Slice 2.5c-3 introduced this field for `RabbitmqSelfInfraProviderModule`\n * to receive the optional per-app vhost (key `'vhost'`); future\n * modules may use it for per-app database suffixes, bucket prefixes,\n * or other authored topology overrides without further extending\n * the context shape.\n *\n * When `undefined` or missing a key the module relies on, the\n * module falls back to its default behavior (e.g., RabbitMQ\n * provisions on the default vhost `/`).\n */\n applicationConfigInputs?: Record<string, string>;\n}\n\n// =============================================================================\n// Platform-service-scoped credential minting (audience-2 / LD-8)\n// =============================================================================\n//\n// `provisionAllPlatformServices` (in apps-manager\n// `PlatformInfrastructureManagerService`) hands each platform service\n// (`apps-manager`, `crontabs-batches-manager`, `file-generator`) a SCOPED\n// (non-admin) broker user for inter-service messaging. Today the policy\n// (per-service permission regex, the broader-permissions special case for\n// crontabs) is hand-rolled inline. Slice 2.5 of `infra-provider-planner.md`\n// moves it onto the `InfraProviderModule` interface so each provider owns\n// its own per-platform-service policy.\n//\n// Distinct from `mintAppCredentials` (audience-3): platform-service creds\n// land in MongoDB `platformApplicationsSecrets` (orchestrator-owned), NOT\n// in `Wildo_Application_Secrets`.\n\n/**\n * Context for `InfraProviderModule.mintPlatformServiceCredentials`.\n * Same orchestrator-pattern as `mintAppCredentials`: orchestrator\n * generates the password, passes it via `secretInputs`; module is\n * upsert-only on the broker.\n */\nexport interface PlatformServiceCredentialMintingContext {\n /**\n * Stable identifier of the platform service this credential is for.\n * Today: members of `PlatformApplicationType` (e.g.,\n * `'platform_apps_manager'`, `'platform_crontabs_batches_manager'`,\n * `'platform_file_generator'`). Module derives the per-service\n * permission regex from this string.\n */\n serviceName: string;\n adminClient: unknown;\n /**\n * Orchestrator-supplied scalars. For RabbitMQ the only required\n * key is `'password'` (no JSON-blob-path conventions because\n * platform-service creds don't go into a per-app blob — they're\n * persisted at the platform-services collection level).\n */\n secretInputs: Record<string, string>;\n}\n\nexport interface PlatformServiceCredentialMintingResult {\n /**\n * Username installed on the broker. Equals `serviceName` today\n * (the legacy convention preserved from the inline ceremony in\n * `PlatformInfrastructureManagerService.provisionServiceCredentials`).\n * Future modules may transform if needed; the orchestrator persists\n * this value alongside the password.\n */\n username: string;\n}\n\n/**\n * Per-app credential minting result. Keys are JSON paths into\n * `Wildo_Application_Secrets` (those declared in\n * `appRuntime.perAppSecretBlobPaths`); values are the canonical\n * persisted form post-broker-upsert. Typically:\n * - **Module-derived** values (e.g., `'database.rabbitmq.username': 'app_<ns>'`).\n * The module computes these from `appSlug`.\n * - **Echoed** values from `secretInputs` (e.g.,\n * `'database.rabbitmq.password': '<the-password-you-passed-in>'`)\n * — the module confirms it installed them on the broker.\n *\n * The orchestrator (apps-manager) merges this map into the persisted\n * secrets blob via `_merge_WildoApplicationSecrets`. The customer\n * pod reads at startup via the standard app-config-fetch path — no\n * K8s Secret involvement for per-app data creds.\n */\nexport interface AppCredentialMintingResult {\n secretBlobValues: Record<string, string>;\n /**\n * Optional non-persisted return values the module produces in the\n * course of upsert. Distinct from `secretBlobValues` (which lands\n * in `Wildo_Application_Secrets`) — `runtimeArtifacts` is a back-\n * channel for values the orchestrator needs at app-init time but\n * deliberately does NOT persist.\n *\n * Slice 4.B.3 of `infra-provider-planner.md` introduced this\n * field for the MongoDB modules: `MongodbAtlasInfraProviderModule`\n * returns `runtimeArtifacts['connectionString']` (the per-app\n * SRV URL with credentials embedded) so the orchestrator can use\n * it for transient app-database seeding without persisting the\n * whole credentialed URL into secrets — the persistence shape is\n * `(username, password)` in secrets + `(host, protocol, options,\n * database)` in config, NOT a single URL string.\n *\n * When `undefined`, the module has no transient artifacts; the\n * orchestrator should rely on `secretBlobValues` only.\n */\n runtimeArtifacts?: Record<string, string>;\n}\n\n// =============================================================================\n// Per-provider admin-client contracts\n// =============================================================================\n//\n// Each `InfraProviderModule.mintAppCredentials` call narrows the\n// `AppCredentialMintingContext.adminClient` field to a per-provider\n// management-client interface. The interfaces live HERE (in\n// platform-config-lib, contracts-only per platform/CLAUDE.md) so the\n// module implementation (in platform-apps-manager) and the manager\n// implementation (also in platform-apps-manager) share one definition\n// — and any future caller (companion, CLI) can implement the same\n// interface without depending on the manager class.\n\n/**\n * Raw RabbitMQ management-API transport (HTTP `PUT/DELETE`). Surface\n * what `RabbitmqSelfInfraProviderModule.mintAppCredentials` /\n * `revokeAppCredentials` need; nothing more. The 5C policy/transport\n * split (LD-4) carves *policy* methods (`upsertTenantUserPermissions`\n * etc.) out of the manager into the module; this interface is the\n * pure-transport remainder.\n *\n * **Argument-order convention** (Slice 4.A.2 / L3): for permission\n * methods, the order is `(vhost, username, permissions)` — vhost\n * first. The legacy pre-Slice-2 convention was `(username, vhost, ...)`\n * (positional, username first). The new convention is cleaner but\n * silently swappable since both args are strings. **Do NOT reorder**;\n * stale call sites copying the legacy positional order will produce\n * wrong-vhost permissions without compile-time complaint.\n */\nexport interface IRabbitMQManagementClient {\n /** PUT /api/users/{name} — idempotent upsert. */\n putUser(username: string, password: string, tags: ReadonlyArray<string>): Promise<void>;\n /** PUT /api/permissions/{vhost}/{name} — vhost-first per the\n * argument-order convention noted on the interface JSDoc. */\n setPermissions(\n vhost: string,\n username: string,\n permissions: { configure: string; write: string; read: string },\n ): Promise<void>;\n /** PUT /api/topic-permissions/{vhost}/{name} — vhost-first. */\n setTopicPermissions(\n vhost: string,\n username: string,\n permissions: { exchange: string; write: string; read: string },\n ): Promise<void>;\n /** DELETE /api/users/{name} — idempotent (404 → no-op). */\n deleteUser(username: string): Promise<void>;\n /** PUT /api/vhosts/{name} — ensures vhost exists; idempotent. */\n ensureVhost(vhost: string): Promise<void>;\n}\n\n/**\n * Raw Redis (Valkey) ACL transport. Surface what\n * `RedisSelfInfraProviderModule.mintAppCredentials` /\n * `revokeAppCredentials` need; nothing more. Used over a `redis-cli`-\n * equivalent ACL connection (the apps-manager's\n * `RedisConnectionManagerService` opens it once at boot and reuses).\n *\n * **Channel pattern policy** (Slice 4.B.1, 2026-05-10): the legacy\n * `RedisConnectionManagerService.upsertTenantUserAcl` derived a\n * fixed family of pub/sub channel patterns from `username`\n * (`<u>#*`, `<u>#/#*`, `<u>-request#*`, `<u>-request#/#*`,\n * `<u>-response#*`, `<u>-response#/#*`). That fan-out is module-\n * internal policy, NOT transport. The contract therefore takes\n * only `username`/`password`/`keyPattern` — the channel patterns\n * live inside the manager implementation today (preserves Slice 2\n * behavior parity); when the legacy method is retired the policy\n * moves into `RedisSelfInfraProviderModule` proper. Until then,\n * `upsertUser` is a thin delegator and the contract is the\n * forward-looking shape.\n *\n * **Idempotent persistence** (`persistAcl`): Valkey/Redis ACL\n * changes are in-memory until `ACL SAVE` is called. The legacy\n * code paired every `upsertTenantUserAcl` with `aclSave`; the\n * module mirrors that pairing.\n */\nexport interface IRedisAclClient {\n /**\n * `ACL SETUSER <name> on >password resetkeys ~<keyPattern> ...`\n * — idempotent upsert. The implementation owns the full ACL\n * command shape (channel patterns, allow/deny categories,\n * dangerous-command denials) — the contract surfaces only the\n * orchestrator-supplied identity material. Slice 4.B.1's manager\n * impl preserves the legacy channel-pattern fan-out from\n * `RedisConnectionManagerService.upsertTenantUserAcl`.\n */\n upsertUser(input: {\n username: string;\n password: string;\n keyPattern: string;\n }): Promise<void>;\n /**\n * `ACL DELUSER <name>` — idempotent (no-op when the user is\n * already absent).\n */\n deleteUser(username: string): Promise<void>;\n /**\n * `ACL SAVE` — flushes the in-memory ACL list to disk. MUST be\n * called after every mutation set so Valkey restarts don't lose\n * tenant users.\n */\n persistAcl(): Promise<void>;\n}\n\n/**\n * Raw Postgres admin transport. Surface what\n * `PostgresSelfInfraProviderModule.mintAppCredentials` /\n * `revokeAppCredentials` need; nothing more. The legacy\n * `PostgreSQLConnectionManagerService` (apps-manager) implements\n * this contract via its existing `createApplicationDatabase` /\n * `deleteApplicationDatabase` methods (Slice 4.B.2 5C policy/\n * transport split).\n *\n * **Identifier-injection-safe**: implementations MUST validate\n * `databaseName` / `username` shapes (alphanumeric + underscore;\n * 63-char Postgres limit) and quote them safely — module callers\n * pass authored slugs verbatim. `PostgreSQLConnectionManagerService`\n * uses the legacy `validateIdentifier` + `quoteIdentifier` pair.\n *\n * **Idempotent upsert** (`upsertApplicationDatabase`): the legacy\n * `createApplicationDatabase` is upsert-style — `CREATE USER` falls\n * back to `ALTER USER` on conflict; `CREATE DATABASE` skips when the\n * DB exists; ownership + privileges always reapplied. The module\n * surface preserves that contract; \"create\" is renamed to \"upsert\"\n * in the contract to match the orchestrator-pattern vocabulary.\n */\nexport interface IPostgresAdminClient {\n /**\n * Upsert per-app database + role. Returns the resolved\n * `connectionUrl` so the orchestrator can persist it into\n * `Wildo_Application_Secrets.database.postgresql.connectUrl`.\n * Idempotent: safe to call repeatedly with the same input.\n */\n upsertApplicationDatabase(input: {\n databaseName: string;\n username: string;\n password: string;\n sslMode?: PostgreSQLSSLMode;\n }): Promise<{ connectionUrl: string }>;\n /**\n * Drop per-app database + user. Idempotent: missing DB / missing\n * user are non-throws (best-effort cleanup, see legacy\n * `deleteApplicationDatabase` semantics).\n */\n dropApplicationDatabase(input: {\n databaseName: string;\n username: string;\n }): Promise<void>;\n /**\n * Stop the application's OWNER role from authenticating — and destroy nothing (#1307).\n *\n * The application backend's role OWNS its database, so it cannot be dropped without first handing\n * ownership of every object to somebody else (PostgreSQL refuses `DROP ROLE` while objects depend\n * on it). Revocation therefore keeps the role and removes its ability to open a session:\n * `NOLOGIN` (a role without it cannot be \"the initial session authorization name during client\n * connection\") plus `PASSWORD NULL` (\"password authentication will always fail for that user\"),\n * then terminates the sessions it already holds, because a login attribute is checked only when a\n * session starts.\n *\n * spec-cite: PostgreSQL 17 `CREATE ROLE` — `LOGIN`/`NOLOGIN` and `PASSWORD` parameter descriptions\n * (https://www.postgresql.org/docs/17/sql-createrole.html); `pg_terminate_backend`, System\n * Administration Functions (https://www.postgresql.org/docs/17/functions-admin.html).\n *\n * Separate from {@link IPostgresAdminClient.dropApplicationDatabase}, which DROPS the database: a\n * withdrawn application's data is kept (#1562 owns destruction), and a revocation that routed\n * through the drop would erase it while believing it was only retiring a login.\n *\n * Reversible by {@link IPostgresAdminClient.upsertApplicationDatabase}, which re-applies\n * `LOGIN PASSWORD` to an existing role. Idempotent: a role that does not exist is a no-op.\n */\n revokeApplicationDatabaseLogin(input: {\n username: string;\n }): Promise<void>;\n /**\n * Upsert a LOGIN role holding exactly the given per-table privileges inside an\n * existing application database (Step 3 / R1).\n *\n * A SEPARATE method from {@link IPostgresAdminClient.upsertApplicationDatabase},\n * for the same reason the Mongo port is split: that one CREATEs the database\n * and makes its caller the OWNER with `ALL PRIVILEGES`, this one grants named\n * verbs on named tables inside a database somebody else owns. One method with\n * an optional privileges argument would make OWNERSHIP the behaviour you get\n * by forgetting to pass something.\n *\n * The grants are AUTHORITATIVE: the implementation must revoke what the role\n * previously held before granting, or a table removed from `resourceAccess`\n * keeps its privilege and revocation becomes a no-op that reports success.\n *\n * An empty `readTables`/`writeTables` pair is legitimate — a role that can\n * connect and see nothing — and must NOT be read as \"unspecified, leave the\n * previous grants alone\".\n */\n /**\n * Remove a table-scoped LOGIN role and everything it holds — WITHOUT touching\n * the database it was scoped into.\n *\n * Separate from {@link IPostgresAdminClient.dropApplicationDatabase}, which\n * drops the DATABASE and its owner. Reusing that one to retire a minion would\n * destroy the entire application's data while believing it was removing one\n * principal's access. That asymmetry is why revocation gets its own method\n * rather than a flag.\n */\n dropTableScopedDatabaseRole(input: {\n databaseName: string;\n username: string;\n schemaName: string;\n }): Promise<void>;\n upsertTableScopedDatabaseRole(input: {\n databaseName: string;\n username: string;\n password: string;\n schemaName: string;\n readTables: readonly string[];\n writeTables: readonly string[];\n /**\n * Insert-only tables — `GRANT INSERT`, never UPDATE and never DELETE.\n *\n * A third axis rather than a flag on `writeTables`, because the two say\n * different things about the same verb set and a boolean would make the\n * safer one the thing you get by remembering to pass it. Today this carries\n * the engine's mandatory append floor — the audit trail and retained job\n * output (see `deriveMinionDatabaseGrants`): a principal must be able to record\n * what it did, and must never be able to unrecord it.\n */\n appendTables: readonly string[];\n /** Insert/update durable runtime records without granting DELETE. Read is granted separately. */\n maintainTables?: readonly string[];\n sslMode?: PostgreSQLSSLMode;\n }): Promise<{ connectionUrl: string }>;\n}\n\n/**\n * Raw MongoDB Atlas API transport. Surface what\n * `MongodbAtlasInfraProviderModule.mintAppCredentials` /\n * `revokeAppCredentials` need; nothing more. The legacy\n * `MongoAtlasManagerService` (apps-manager) implements this\n * contract via its existing `createApplicationDatabase` /\n * `deleteDatabaseUser` methods (Slice 4.B.3 5C policy/transport\n * split).\n *\n * **Idempotent upsert** (`upsertApplicationDatabase`): the legacy\n * `createApplicationDatabase` is upsert-style — `POST /databaseUsers`\n * falls back to `PATCH` on conflict (existing user); cluster scope +\n * roles are reapplied on every call. Returns the SRV connection\n * string with credentials embedded, ready for transient\n * app-database seeding by the orchestrator.\n */\nexport interface IMongoAtlasClient {\n /**\n * Upsert per-app Atlas database user. Returns the SRV connection\n * string (with credentials embedded, `mongodb+srv://user:pass@...`)\n * that the orchestrator uses for transient app-init operations.\n * The string is NOT persisted into `Wildo_Application_Secrets`\n * by today's orchestrator — it's exposed via\n * `AppCredentialMintingResult.runtimeArtifacts.connectionString`.\n */\n upsertApplicationDatabase(input: {\n clusterName: string;\n databaseName: string;\n username: string;\n password: string;\n }): Promise<{ connectionString: string }>;\n /**\n * Delete an Atlas database user. Idempotent: 404 → no-op.\n */\n deleteDatabaseUser(username: string): Promise<void>;\n /**\n * Upsert a database user holding exactly ONE Atlas custom database role, which carries exactly the\n * given collection-scoped privileges and inherits nothing (#1694). The Atlas twin of\n * {@link IMongoSelfAdminClient.upsertCollectionScopedDatabaseUser}, for a runtime principal (a minion).\n *\n * A SEPARATE method from {@link IMongoAtlasClient.upsertApplicationDatabase} for the reason the\n * self-hosted contract gives: that one grants `readWrite` on the whole database, this one grants named\n * actions on named collections, and an optional \"privileges\" argument would make the wide grant the\n * behaviour you get by forgetting to pass something.\n *\n * - `privileges[].actions` are Atlas Admin API privilege-action names (`FIND`, `INSERT`, `UPDATE`,\n * `REMOVE`, …). The caller translates from MongoDB's own vocabulary; this transport never widens it.\n * - `privileges` is AUTHORITATIVE: an existing role's actions are REPLACED, so a resource removed from\n * `resourceAccess` loses its grant on the next sync.\n * - The user is scoped to `clusterName` alone (Atlas grants every cluster in the project when `scopes`\n * is omitted), and holds the custom role and nothing else.\n * - Idempotent: safe when the role and user already exist; the password is re-applied, which is how a\n * rotation lands.\n *\n * Returns the SRV connection string carrying THIS user's credentials, for the same transient use as\n * {@link IMongoAtlasClient.upsertApplicationDatabase}'s.\n */\n upsertCollectionScopedDatabaseUser(input: {\n clusterName: string;\n databaseName: string;\n username: string;\n password: string;\n roleName: string;\n privileges: ReadonlyArray<{\n resource: { db: string; collection: string };\n actions: readonly string[];\n }>;\n }): Promise<{ connectionString: string }>;\n /**\n * Retire a collection-scoped user AND the custom role it holds — and nothing else.\n *\n * Two objects, deleted user FIRST: Atlas refuses to delete a custom role that would leave a database\n * user with no roles, so the reverse order fails while the user exists. Dropping only the user would\n * leave a privileged role behind that the next mint silently adopts. Idempotent in both halves: a\n * missing user or a missing role is a no-op.\n */\n dropCollectionScopedDatabaseUser(input: {\n username: string;\n roleName: string;\n }): Promise<void>;\n}\n\n/**\n * The immudb permission an application's audit user holds on its OWN database (#1696).\n *\n * The values are immudb's own permission bytes, because the admin transport sends them verbatim.\n * spec-cite: immudb v1.11.1 `pkg/auth/permissions.go` — `PermissionNone = iota`, `PermissionR`, `PermissionRW`\n * (0, 1, 2), `PermissionAdmin = 254`, `PermissionSysAdmin = 255`\n * (https://raw.githubusercontent.com/codenotary/immudb/v1.11.1/pkg/auth/permissions.go, fetched 2026-09-29).\n *\n * Only READ_WRITE is named: an audit sink appends and verifies, and nothing in the framework grants an\n * application more. `ADMIN` and `SYSADMIN` are deliberately absent — holding either is the defect #1696 removes.\n */\nexport enum ImmudbDatabasePermission {\n READ_WRITE = 2,\n}\n\n/**\n * Raw immudb admin transport (#1696). Surfaces exactly what `ImmudbSelfInfraProviderModule` needs to give each\n * application ONE database and ONE user confined to it, and to revoke that user — nothing more.\n *\n * Implemented in apps-manager over the gRPC admin API with the PLATFORM's own admin credential (a\n * framework-managed secret no application receives). Every method is idempotent, because registration,\n * withdrawal and restore all retry by re-running.\n *\n * **No method deletes anything.** immudb keeps every database and every user it has created: an append-only\n * store's audit history must outlive the application's credential, and a withdrawn application is restored by\n * RE-ACTIVATING its user onto the same database (#1307).\n */\nexport interface IImmudbAdminClient {\n /** Create the database when it does not exist; a no-op when it does. */\n ensureDatabase(input: { databaseName: string }): Promise<void>;\n /**\n * Create the user, or bring an existing one back to exactly this state: ACTIVE, this password, and `permission`\n * on `databaseName`. Re-applying the password and re-activating are what make a restore after withdrawal work.\n */\n upsertDatabaseUser(input: {\n username: string;\n password: string;\n databaseName: string;\n permission: ImmudbDatabasePermission;\n }): Promise<void>;\n /**\n * Refuse the user's credential from now on: revoke its permission on `databaseName` and DEACTIVATE it.\n * immudb has no user deletion; a deactivated user cannot log in. A user that does not exist is a no-op.\n */\n deactivateDatabaseUser(input: { username: string; databaseName: string }): Promise<void>;\n}\n\n/**\n * Raw self-managed MongoDB admin transport. Surface what\n * `MongodbSelfInfraProviderModule.mintAppCredentials` /\n * `revokeAppCredentials` need; nothing more. Implemented by a\n * lightweight admin-side mongoose connection — the legacy inline\n * `ensureSelfManagedMongoApplicationUser` at\n * `wildo-application-lifecycle.service.ts:2710-2745` is the source\n * of behavior.\n *\n * **Why this contract is asymmetric to `IMongoAtlasClient`** (Slice\n * 4.B.3 design note, 2026-05-10): Atlas exposes a stateless REST\n * API for user management; self-managed Mongo requires opening an\n * admin-DB connection and running `createUser` / `updateUser`\n * commands. The contract therefore takes the admin connect URL as\n * an input (not a constructor-time configuration) — implementations\n * open transient connections per call, mirroring the legacy\n * pattern.\n */\nexport interface IMongoSelfAdminClient {\n /**\n * Upsert per-app database user on a self-managed MongoDB\n * instance. Connects to `adminConnectUrl` (admin-scoped),\n * creates or updates the user with `readWrite` + `dbAdmin`\n * roles on `databaseName`, then closes the connection. Idempotent.\n */\n upsertApplicationDatabaseUser(input: {\n adminConnectUrl: string;\n databaseName: string;\n username: string;\n password: string;\n }): Promise<void>;\n /**\n * Delete a per-app database user. Idempotent: missing user is a\n * no-op (best-effort cleanup, mirrors `IPostgresAdminClient`\n * semantics).\n */\n deleteApplicationDatabaseUser(input: {\n adminConnectUrl: string;\n username: string;\n }): Promise<void>;\n /**\n * Upsert a database user holding ONE custom role carrying exactly the given\n * collection-scoped privileges (Step 3 / R1 / D14).\n *\n * Deliberately a SEPARATE method from\n * {@link IMongoSelfAdminClient.upsertApplicationDatabaseUser} rather than an\n * optional parameter on it. The two grant fundamentally different authority —\n * that one grants `readWrite` + `dbAdmin` on the WHOLE database, this one\n * grants named actions on named collections and nothing else — and a single\n * method with an optional \"privileges\" argument would make the wide grant the\n * behaviour you get by forgetting to pass something. Two methods make the\n * caller name which authority it intends.\n *\n * `privileges` is authoritative and REPLACES the role's previous contents, so\n * a resource removed from `resourceAccess` loses its grant on the next sync.\n * An empty list is legitimate — a principal with no data access — and MUST\n * yield a role granting nothing rather than being treated as \"unspecified\".\n *\n * Idempotent: safe to call when the role and user already exist.\n */\n /**\n * Retire a collection-scoped user AND the custom role it holds.\n *\n * Separate from {@link IMongoSelfAdminClient.deleteApplicationDatabaseUser}\n * because a scoped principal owns TWO objects in TWO databases — the user in\n * `admin`, the role in the application database — and dropping only the user\n * leaves a privileged role behind that the next mint silently adopts.\n *\n * Idempotent in both halves: a missing user or a missing role is a no-op.\n */\n dropCollectionScopedDatabaseUser(input: {\n adminConnectUrl: string;\n databaseName: string;\n username: string;\n roleName: string;\n }): Promise<void>;\n upsertCollectionScopedDatabaseUser(input: {\n adminConnectUrl: string;\n databaseName: string;\n username: string;\n password: string;\n roleName: string;\n privileges: ReadonlyArray<{\n resource: { db: string; collection: string };\n actions: readonly string[];\n }>;\n }): Promise<void>;\n}\n\nexport interface InfraProviderModule {\n provider: InfraProvider;\n supportedCapabilities: ReadonlyArray<InfraCapability>;\n\n /**\n * Present when this module EXISTS but the platform cannot yet deliver a working connection for the\n * provider — the module can plan, and an application selecting it would still receive no usable\n * credential. The value says why, and what would change it.\n *\n * ## Why the module stays in the catalogue instead of being removed\n *\n * The module's `plan()` is correct and useful: it formalizes the env contract an operator will set\n * and gives the lockfile a stable digest. What is missing is elsewhere (for `AWS_S3`, the credential\n * broker that speaks only MinIO's AssumeRole, #14). Removing the module would lose the correct half\n * to express the missing one.\n *\n * ## What it does\n *\n * A declaration resolving to a provider whose module carries this is REFUSED at authoring time\n * (`wildo config validate` / `config sync` / `lock check`), exactly like a declaration resolving to\n * a provider with no module. Delete the field in the same change that makes the provider servable.\n */\n unservableReason?: string;\n\n /**\n * Every `Wildo_Application_Secrets` JSON path this module can mint PER RUNTIME PRINCIPAL.\n *\n * ## Why this is static, when `plan()` already reports the same paths\n *\n * `plan()` answers \"what does THIS application get\", so it needs an\n * {@link InfraProviderPlanningContext}. The secret-DELIVERY path in apps-manager asks a different\n * question — \"which paths are per-principal AT ALL\" — and must answer it with no application in\n * hand, because it decides what to STRIP from the application blob before overlaying a\n * principal's own material. A principal must receive a credential only where one was minted for\n * it; anything left un-stripped is delivered with the APPLICATION's value, which for a database\n * means `readWrite` + `dbAdmin` on the whole database.\n *\n * Empty for a provider with no per-app credentials — shared-bucket object storage\n * (`MINIO_SELF`, `AWS_S3`) and stateless infra (`CLAMAV_SELF`). Empty is a\n * real answer, not a missing one, which is why the field is required rather than optional: a\n * module that mints per-principal material must not be able to omit it and be silently read as\n * \"nothing to confine\".\n *\n * **Modules MUST derive `appRuntime.perAppSecretBlobPaths` from this same constant** rather than\n * repeating the literal list. Two spellings of where a credential lives is the defect this exists\n * to prevent, one layer up.\n *\n * **A module declaring paths here MUST derive a distinct resource name per principal**, in its mint\n * AND its revoke, through one function. apps-manager dispatches every minion mint and revocation\n * through the catalogue (#1692), so a module that ignored `principal` and derived the application\n * backend's own name would OVERWRITE the backend's user on a minion mint and DELETE it on a minion\n * revocation — the defect `invariant-call-site-enumeration.md` #18 records. MongoDB Atlas shipped in\n * exactly that shape and was refused at registration until its per-principal path landed (#1694).\n */\n perPrincipalSecretBlobPaths: ReadonlyArray<string>;\n\n plan(context: InfraProviderPlanningContext): InfraProviderPlanContribution;\n\n /**\n * Optional. Called by apps-manager at app-init time (see\n * `wildo-application-lifecycle.service.ts:432-580` — the existing\n * per-resource ceremony this method abstracts). Upserts the per-app\n * user / role / DB on the broker using `secretInputs` for any\n * orchestrator-supplied passwords; returns the canonical form of\n * the persisted secrets blob slice.\n *\n * Returns `null` when the provider has no per-app credentials (e.g.,\n * shared S3 bucket with shared access key).\n *\n * **Idempotent broker upsert** — the module installs / replaces the\n * user with the password from `secretInputs`. It does NOT make\n * generation/rotation decisions; that is the orchestrator's\n * responsibility (driven by the existing `overrideCredentials`\n * flag on `WildoApplicationInitOptions`). The module MUST NOT\n * crash on \"user already exists\" (PUT semantics on the broker\n * management API are sufficient for RabbitMQ; equivalent\n * upsert-on-conflict semantics for other providers).\n */\n mintAppCredentials?(\n context: AppCredentialMintingContext,\n ): Promise<AppCredentialMintingResult | null>;\n\n /**\n * Optional. Symmetric to `mintAppCredentials`: afterwards the principal's credential is REFUSED by the\n * server. Called by apps-manager when a minion leaves the declaration, and for EVERY principal of an\n * application withdrawn from the platform (`deregisterApplication`, #1307).\n *\n * **It revokes and never destroys.** It removes the ability to authenticate — an ACL user, a broker\n * user, a database user, or a login — and leaves the application's DATA where it is: its database,\n * keys, queues and blobs. A withdrawn application is restored by re-minting (`mintAppCredentials` with\n * the recorded material), which only works if nothing it owns was dropped. Destroying data is a\n * different verb with its own protection (#1562); a module must never reach it through this one.\n *\n * Idempotent: safe to call when the per-principal user / role does not exist (no throw on\n * already-absent), because a retry after a partial revocation must converge.\n */\n revokeAppCredentials?(context: AppCredentialMintingContext): Promise<void>;\n\n /**\n * Optional (LD-8 / Slice 2.5). Called by the orchestrator\n * (`PlatformInfrastructureManagerService.provisionServiceCredentials`\n * + `ensureAppsManagerCredentials`) at platform-service-init time.\n * Upserts a SCOPED (non-admin) per-platform-service user on the\n * broker for inter-service messaging — distinct from\n * `mintAppCredentials` (audience-3, customer-app per-app creds).\n *\n * Same orchestrator-pattern as `mintAppCredentials`: orchestrator\n * owns generation, module is upsert-only.\n *\n * Returns `null` when the provider has no per-platform-service\n * credentials concept (e.g., S3 modules — platform services use a\n * shared bucket).\n */\n mintPlatformServiceCredentials?(\n context: PlatformServiceCredentialMintingContext,\n ): Promise<PlatformServiceCredentialMintingResult | null>;\n}\n"]}
1
+ {"version":3,"file":"infra-providers.schemas.js","sourceRoot":"","sources":["../../../../src/project-config/shared/infra-providers.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,eAkBX;AAlBD,WAAY,eAAe;IACzB,0DAAuC,CAAA;IACvC,8DAA2C,CAAA;IAC3C,0DAAuC,CAAA;IACvC,oDAAiC,CAAA;IACjC,4DAAyC,CAAA;IACzC,oDAAiC,CAAA;IACjC,kDAA+B,CAAA;IAC/B;;;OAGG;IACH,0DAAuC,CAAA;IACvC;;;OAGG;IACH,oDAAiC,CAAA;AACnC,CAAC,EAlBW,eAAe,KAAf,eAAe,QAkB1B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAu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C,GAAG,CAAC,CAAC,YAAY,CAAC;IAC/D,qBAAqB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC1E,qBAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC7D,CAAC,CAAC;AAKH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAC9C,4CAA4C,CAAC,MAAM,CAAC;IAClD,aAAa,EAAE,4CAA4C,CAAC,QAAQ,EAAE;IACtE,UAAU,EAAE,yCAAyC,CAAC,QAAQ,EAAE;CACjE,CAAC,CAAC,WAAW,EAAE,CAAC;AA8gBnB;;;;;;;;;;GAUG;AACH,MAAM,CAAN,IAAY,wBAEX;AAFD,WAAY,wBAAwB;IAClC,mFAAc,CAAA;AAChB,CAAC,EAFW,wBAAwB,KAAxB,wBAAwB,QAEnC","sourcesContent":["import { z } from 'zod';\nimport type { ApplicationRuntimePrincipal } from '../../bootstrap/runtime-principal.contracts';\nimport type { MinionResourceGrants } from './minion-resource-access.validation';\nimport type { PostgreSQLSSLMode } from '@wildo-ai/saas-models';\n\n/**\n * Environment functions an infra environment must fulfill.\n *\n * This vocabulary is intentionally platform/config-owned, not part of\n * `@wildo-ai/saas-models`, because browser/runtime packages must not\n * import infrastructure provider concepts.\n */\nexport enum InfraCapability {\n DOCUMENT_DATABASE = 'DOCUMENT_DATABASE',\n RELATIONAL_DATABASE = 'RELATIONAL_DATABASE',\n AUDIT_LOG_STORAGE = 'AUDIT_LOG_STORAGE',\n OBJECT_STORAGE = 'OBJECT_STORAGE',\n ANTIVIRUS_SCANNING = 'ANTIVIRUS_SCANNING',\n QUEUING_SYSTEM = 'QUEUING_SYSTEM',\n CACHE_MANAGER = 'CACHE_MANAGER',\n /**\n * OTLP telemetry. GRANTED TO EVERY RUNTIME, never declared as a backing service — see\n * {@link RUNTIME_GRANTED_INFRA_CAPABILITIES}.\n */\n METRICS_TELEMETRY = 'METRICS_TELEMETRY',\n /**\n * Backup. RESERVED — no backing-service kind declares it and no module serves it; see\n * {@link RESERVED_INFRA_CAPABILITIES}.\n */\n BACKUP_MANAGER = 'BACKUP_MANAGER',\n}\n\n/**\n * Capabilities NO `BackingServiceKind` projects to — granted to a runtime by the platform rather\n * than declared by an environment.\n *\n * `BackingServiceKindToInfraCapability` used to be described as bijective, and a test asserted the\n * reverse direction: every capability reachable from some kind. That held only while every\n * capability was something an environment points at. It is not a property of the model, and reading\n * it as one is what kept `metrics-telemetry` alive as an authoring surface with no consumer.\n *\n * Membership here is the ANSWER to \"why does this capability have no kind\", so a capability that\n * belongs in neither place is a real gap and stays visible as one.\n */\nexport const RUNTIME_GRANTED_INFRA_CAPABILITIES: Readonly<Partial<Record<InfraCapability, string>>> = {\n /*\n * Telemetry is configured in TWO places, and a backing service is neither of them: the endpoint is\n * authored at `observability.telemetry.endpoint` (projected to `OTEL_EXPORTER_OTLP_ENDPOINT`), and\n * the auth header is derived provider-agnostically from the selected `OBSERVABILITY_TELEMETRY`\n * engine provider. Nothing is left for an environment to declare, and nothing for an\n * infra-provider module to mint — those exist to issue PER-APPLICATION credentials, and a\n * telemetry token is one provider-level secret shared by every runtime.\n *\n * The capability itself is load-bearing and must NOT be withdrawn with the kind: it carries the\n * `DATA_TELEMETRY` network in `NETWORK_FOR_CAPABILITY` and sits in\n * `MINION_UNCONDITIONAL_CAPABILITIES`, so every runtime reaches the collector through it. Setting\n * it to `null` there was corrected on 2026-08-12 precisely because it \"would have cut tracing for\n * every runtime the moment segmentation was enforced, with NO readiness check covering it\".\n */\n [InfraCapability.METRICS_TELEMETRY]:\n 'Authored at observability.telemetry + the OBSERVABILITY_TELEMETRY provider; granted to every '\n + 'runtime for the DATA_TELEMETRY network, so no environment declares it and no module mints it.',\n};\n\n/**\n * Capabilities kept as VOCABULARY with no way to be selected yet — neither declared by an\n * environment (no `BackingServiceKind` projects to them) nor granted to runtimes by the platform.\n *\n * This is the third answer to \"why does this capability have no kind\", beside\n * `BackingServiceKindToInfraCapability` and {@link RUNTIME_GRANTED_INFRA_CAPABILITIES}. It exists so\n * that answer is WRITTEN DOWN: a capability in none of the three is an unexplained gap, and the\n * reachability test still fails on it.\n *\n * Membership is a statement that nothing can reach the capability today. It is not a placeholder\n * an environment may fill in — withdrawing the declarable kind is what stopped it being one.\n */\nexport const RESERVED_INFRA_CAPABILITIES: Readonly<Partial<Record<InfraCapability, string>>> = {\n /*\n * The `backup` backing-service kind was WITHDRAWN 2026-09-26 (#1693): it resolved to no provider,\n * rendered no workload, and nothing read it. The capability stays because whether backup is modelled\n * as a capability at all is the design question #8 owns. Its network is `null` in\n * `NETWORK_FOR_CAPABILITY` for the same reason — no runtime dials a backup target.\n */\n [InfraCapability.BACKUP_MANAGER]:\n 'Reserved for the backup design (#8): no environment can declare it and no module serves it.',\n};\n\n/**\n * Built-in environment-facing provider ids — the (kind × hosting-model\n * × brand) projection vocabulary. Apps SELECT these implicitly via\n * `wildo.infra.<env>.config.ts > backingServices.<kind>.{source,\n * provider?}`; the planner resolves the tuple to one of these\n * `InfraProvider` values via `resolveInfraProvider`.\n *\n * **Naming convention**: `<KIND>_<BRAND>` — `BRAND` is either a\n * vendor (Atlas / AWS_RDS / Supabase / …) for managed services, or\n * an open-source software name (MinIO / vanilla self-hosted) for\n * self-hosted. `<KIND>_MANAGED` exists as a generic fallback when\n * the operator hasn't named a brand (Postgres in particular —\n * acceptable while the brand catalog is incomplete; Mongo's\n * `MONGODB_ATLAS` is the only branded managed option today, so no\n * `MONGODB_MANAGED` generic is needed).\n *\n * Slice 4.B.0 (2026-05-07) added the Postgres brand expansion to\n * generalize the source/brand split that S3 already had.\n */\nexport enum InfraProvider {\n // === MongoDB ===\n /** Self-hosted vanilla MongoDB (in-cluster docker-compose / K8s\n * deployment). Selected via `source: SELF`. No `provider` brand\n * required (Mongo's `provider` axis is reserved for managed\n * variants like `'atlas'`). */\n MONGODB_SELF = 'mongodb-self',\n /** MongoDB Atlas (managed cloud). brand: `'atlas'`. */\n MONGODB_ATLAS = 'mongodb-atlas',\n\n // === PostgreSQL ===\n /** Self-hosted vanilla PostgreSQL (in-cluster docker-compose /\n * K8s deployment). Selected via `source: SELF`. */\n POSTGRES_SELF = 'postgres-self',\n /** Generic managed Postgres — fallback when the operator hasn't\n * named a brand. Concrete brand identifiers below are preferred. */\n POSTGRES_MANAGED = 'postgres-managed',\n /** AWS RDS for PostgreSQL. brand: `'aws-rds'`. */\n POSTGRES_AWS_RDS = 'postgres-aws-rds',\n /** Google Cloud SQL for PostgreSQL. brand: `'gcp-cloud-sql'`. */\n POSTGRES_GCP_CLOUD_SQL = 'postgres-gcp-cloud-sql',\n /** Azure Database for PostgreSQL. brand: `'azure-database'`. */\n POSTGRES_AZURE_DATABASE = 'postgres-azure-database',\n /** Supabase. brand: `'supabase'`. */\n POSTGRES_SUPABASE = 'postgres-supabase',\n /** Neon. brand: `'neon'`. */\n POSTGRES_NEON = 'postgres-neon',\n /** Render. brand: `'render'`. */\n POSTGRES_RENDER = 'postgres-render',\n\n // === Redis / Valkey ===\n /** Self-hosted Redis-compatible cache (today: Valkey under the\n * hood; the engine adapter is wire-protocol compatible with\n * Redis OSS). Selected via `source: SELF`. */\n REDIS_SELF = 'redis-self',\n\n // === RabbitMQ ===\n /** Self-hosted RabbitMQ broker (in-cluster docker-compose / K8s\n * deployment). Selected via `source: SELF`. */\n RABBITMQ_SELF = 'rabbitmq-self',\n\n // === Object storage ===\n /** MinIO (self-hosted S3-compatible). brand: `'minio'` (or unset on\n * source=self — MinIO is the canonical default). */\n MINIO_SELF = 'minio-self',\n /** AWS S3 (managed). brand: `'aws'`. */\n AWS_S3 = 'aws-s3',\n\n // === Stateless infra ===\n /** Self-hosted ClamAV antivirus scanning service. Stateless (no\n * auth, no per-tenant state); apps connect to a shared host:port.\n * Selected via `source: SELF`. */\n CLAMAV_SELF = 'clamav-self',\n /** Self-hosted immudb — immutable, cryptographically-verifiable DB used as a\n * tamper-evident audit-log store. Selected via `source: SELF`. */\n IMMUDB_SELF = 'immudb-self',\n}\n\n/**\n * Platform-side consumers of an `InfraProviderPlanContribution.platformAdmin`\n * block. Each provider declares which platform services receive its\n * admin credentials so the planner can route them to the right pod /\n * compose service / env file.\n *\n * Locked enum (2026-05-05). Extending requires adding the consumer\n * enum value here AND in every `InfraProviderModule.plan()` that\n * legitimately delivers admin credentials to the new consumer.\n *\n * Excluded by design (consume platform-service APIs, not direct infra-admin):\n * - `file-generator`\n * - `sourcecode-provider`\n *\n * Add as real consumers surface, not pre-emptively.\n */\nexport enum InfraPlatformAdminConsumer {\n APPS_MANAGER = 'apps-manager',\n COMPANION = 'companion',\n CRONTABS_BATCHES_MANAGER = 'crontabs-batches-manager',\n MODULE_REGISTRY = 'module-registry',\n}\n\n/**\n * Audience-less contributions: describe the infra resource itself.\n * Same payload regardless of who consumes it (compose definitions,\n * K8s manifests, CI checks).\n */\nconst InfraProviderResourceContributionShapeSchema = z.strictObject({\n dockerComposeServices: z.array(z.string().min(1)).optional(),\n k8sResources: z.array(z.string().min(1)).optional(),\n startupScripts: z.array(z.string().min(1)).optional(),\n ciChecks: z.array(z.string().min(1)).optional(),\n policyChecks: z.array(z.string().min(1)).optional(),\n});\n\n/**\n * Audience: platform services that need **management-API access** to\n * administer the infra resource (create per-app users / vhosts / ACLs\n * / DBs). This is audience-1 in the three-audience model:\n *\n * 1. **Platform-admin** (this contribution slice). Cluster-wide\n * management-API credentials. Consumed by apps-manager (mints\n * per-app users via `mintAppCredentials`), companion (mirrors\n * apps-manager admin role for local dev). `crontabs` /\n * `module-registry` are listed in the enum because they MAY\n * surface admin needs in future slices, but no provider should\n * declare them as consumers in this slice unless evidence\n * surfaces.\n * 2. **Platform-service-scoped** (NOT modeled in `plan()` yet —\n * see LD-8 / Slice 2.5). Per-platform-service publish/consume\n * creds for the platform-services that participate in\n * inter-service messaging (`PLATFORM_SERVICES` enum:\n * apps-manager, crontabs-batches-manager, file-generator).\n * Today provisioned inline by\n * `PlatformInfrastructureManagerService.provisionAllPlatformServices`.\n * 3. **App-scoped** (`appRuntime` slice below). Per-app\n * publish/consume creds, minted by `mintAppCredentials`.\n *\n * `consumers` is the explicit audience declaration: every provider\n * states which platform services receive this block. The planner\n * routes the credentials accordingly.\n */\nconst InfraProviderPlatformAdminContributionSchema = z.strictObject({\n envVars: z.record(z.string(), z.string()).optional(),\n secretEnvVars: z.array(z.string().min(1)).optional(),\n consumers: z.array(z.enum(InfraPlatformAdminConsumer)).optional(),\n});\nexport type InfraProviderPlatformAdminContribution = z.infer<\n typeof InfraProviderPlatformAdminContributionSchema\n>;\n\n/**\n * Audience: customer-app + minion + Node-worker pods. Per-app\n * runtime delivery flows through the persisted\n * `Wildo_Application_Config` and `Wildo_Application_Secrets` blobs in\n * MongoDB (NOT through K8s deployment-Secret env vars; engine\n * consumers like `queue.backend.service.ts:144-149` read from\n * `appConfigService.{config,secrets}` after fetching them at startup\n * via app-config-fetch).\n *\n * - `perAppConfigBlobPaths`: JSON paths into `Wildo_Application_Config`\n * carrying static values (same for every app in this env) — e.g.\n * `'database.rabbitmq.host': 'rabbitmq'`. Merged into the persisted\n * config blob by the planner at sync time.\n * - `perAppSecretBlobPaths`: JSON paths into `Wildo_Application_Secrets`\n * that `mintAppCredentials` will populate at deploy time (e.g.\n * `'database.rabbitmq.username'`). The planner emits only the path\n * list; apps-manager invokes `mintAppCredentials` per app to produce\n * the values, then merges them into the persisted secrets blob via\n * the existing `_merge_WildoApplicationSecrets` machinery.\n *\n * No K8s-Secret-env-var output is intentional: the K8s\n * `{appSlug}-secret` carries only the four-env bootstrap-env-contract\n * (APPLICATION_ID / PLATFORM_APPLICATION_PRIMARY_SECRET /\n * PLATFORM_APPS_MANAGER_URL / APPLICATION_ENV); per-resource creds\n * land in MongoDB, not env. If a future provider genuinely needs\n * env-var injection it can extend this contribution shape via\n * `.passthrough()` — not pre-emptively designed for here.\n */\nconst InfraProviderAppRuntimeContributionSchema = z.strictObject({\n perAppConfigBlobPaths: z.record(z.string().min(1), z.unknown()).optional(),\n perAppSecretBlobPaths: z.array(z.string().min(1)).optional(),\n});\nexport type InfraProviderAppRuntimeContribution = z.infer<\n typeof InfraProviderAppRuntimeContributionSchema\n>;\n\n/**\n * Two-slice contribution shape. The audience-less resource block\n * (compose / K8s / CI) merges with the audience-scoped credential\n * blocks (`platformAdmin`, `appRuntime`).\n *\n * `.passthrough()` is preserved on the merged shape so future\n * contribution kinds (dashboards, alerting rules, autoscaler hints)\n * can be added without breaking existing modules.\n */\nexport const InfraProviderPlanContributionSchema =\n InfraProviderResourceContributionShapeSchema.extend({\n platformAdmin: InfraProviderPlatformAdminContributionSchema.optional(),\n appRuntime: InfraProviderAppRuntimeContributionSchema.optional(),\n }).passthrough();\nexport type InfraProviderPlanContribution = z.infer<typeof InfraProviderPlanContributionSchema>;\n\nexport interface InfraProviderPlanningContext {\n environment: string;\n runtime: string;\n backingServiceKey: string;\n config: unknown;\n}\n\n/**\n * Per-app credential minting context. Called by the orchestrator\n * (apps-manager `wildo-application-lifecycle.service.ts`) at app-init\n * time — not at K8s deploy time. The orchestrator is responsible for\n * **generation policy** (read existing creds from MongoDB; decide\n * rotate-vs-preserve based on `overrideCredentials` flag; generate\n * new password when needed); the module is responsible for the\n * **broker upsert** (install / replace the user on the broker with\n * the supplied password).\n *\n * Inputs:\n * - `appSlug` — the application slug (or its derived namespace\n * `ns`); used by the module to compute the rabbit username,\n * permission regex, etc.\n * - `adminClient` — pre-wired by the orchestrator from the resolved\n * `platformAdmin` env vars; concrete type narrowed per provider at\n * the module's implementation site (e.g., RabbitMQ modules narrow\n * to `RabbitMQManagementClient`).\n * - `secretInputs` — orchestrator-supplied scalars keyed by the JSON\n * path the module declared in `appRuntime.perAppSecretBlobPaths`.\n * For RabbitMQ: `{ 'database.rabbitmq.password': '<orchestrator-generated-password>' }`.\n * The module installs these on the broker; it does NOT generate\n * passwords itself.\n *\n * Note: `applicationEnv` was previously included in this context but\n * removed 2026-05-06 — the integration site (`wildo-application-lifecycle`)\n * does not carry an env field on its options shape.\n */\nexport interface AppCredentialMintingContext {\n /**\n * Raw application slug (e.g., `'wonder-todos'`). Used by modules\n * whose per-app resource names embed the slug directly without\n * env-scoping (e.g., MongoDB database name).\n */\n appSlug: string;\n /**\n * Application namespace = `<appSlug>-<environmentId>`, derived\n * server-side via `buildApplicationNamespace` in platform-config-lib.\n * Used by modules whose per-app resource names scope by namespace\n * (RabbitMQ username, Redis ACL keyPattern, …) — i.e., resources\n * that must remain isolated across env boundaries (`wonder-todos-local`\n * vs `wonder-todos-staging`).\n */\n applicationNamespace: string;\n /**\n * Stable opaque application identifier (Mongo ObjectId-shaped string,\n * matches the convention at\n * `wildo-application-lifecycle.service.ts:552` where the broker\n * permission regex disambiguates per-app queue/reply names by this\n * id, NOT by `appSlug` — the slug is human-readable and could\n * theoretically be reassigned, the id is forever-stable). Required\n * by modules whose per-app resource names embed the application id\n * (RabbitMQ permission regex, …).\n */\n wildoApplicationId: string;\n /**\n * WHICH runtime principal these credentials are for (Step 2 / D17).\n *\n * Optional, and absent means the APPLICATION BACKEND — which keeps every\n * existing module and call site meaning exactly what it meant before, since\n * per-application minting IS the backend principal's case.\n *\n * A module that ignores this field still mints correctly for the backend and\n * simply does not participate in per-principal narrowing; a module that reads\n * it must derive a DISTINCT resource name (ACL username, DB user, queue\n * permission) per principal, or two principals will share one credential and\n * the narrowing will exist only on paper.\n *\n * `buildRuntimePrincipalKey` renders the stable identity to embed in such a\n * name — the same string the stored section is keyed by, so a minted resource\n * and the row that records it cannot drift.\n */\n principal?: ApplicationRuntimePrincipal;\n /**\n * What this principal may touch, in RESOURCE TYPES (Step 3).\n *\n * Deliberately the platform vocabulary, not storage names: a module that\n * grants on tables and a module that grants on collections must receive the\n * same contract, and the translation belongs at each adapter via\n * `resolveGrantStorageNames`.\n *\n * Absent for the application backend, which is granted database-wide by a\n * different path. Absent for a NAMED principal means \"no grants derived\" —\n * which a module must treat as an ERROR rather than as a reason to fall back\n * to the wide grant (D11/R3: a minion with no declared access gets no\n * database user at all, and that is the orchestrator's decision to make).\n */\n resourceGrants?: MinionResourceGrants;\n adminClient: unknown;\n secretInputs: Record<string, string>;\n /**\n * Optional non-secret per-app config inputs supplied by the\n * orchestrator. Distinct from `secretInputs` (passwords) — these\n * are authored topology values that affect HOW the module\n * provisions the per-app resource. Each module documents the keys\n * it consumes in its own JSDoc.\n *\n * Slice 2.5c-3 introduced this field for `RabbitmqSelfInfraProviderModule`\n * to receive the optional per-app vhost (key `'vhost'`); future\n * modules may use it for per-app database suffixes, bucket prefixes,\n * or other authored topology overrides without further extending\n * the context shape.\n *\n * When `undefined` or missing a key the module relies on, the\n * module falls back to its default behavior (e.g., RabbitMQ\n * provisions on the default vhost `/`).\n */\n applicationConfigInputs?: Record<string, string>;\n}\n\n// =============================================================================\n// Platform-service-scoped credential minting (audience-2 / LD-8)\n// =============================================================================\n//\n// `provisionAllPlatformServices` (in apps-manager\n// `PlatformInfrastructureManagerService`) hands each platform service\n// (`apps-manager`, `crontabs-batches-manager`, `file-generator`) a SCOPED\n// (non-admin) broker user for inter-service messaging. Today the policy\n// (per-service permission regex, the broader-permissions special case for\n// crontabs) is hand-rolled inline. Slice 2.5 of `infra-provider-planner.md`\n// moves it onto the `InfraProviderModule` interface so each provider owns\n// its own per-platform-service policy.\n//\n// Distinct from `mintAppCredentials` (audience-3): platform-service creds\n// land in MongoDB `platformApplicationsSecrets` (orchestrator-owned), NOT\n// in `Wildo_Application_Secrets`.\n\n/**\n * Context for `InfraProviderModule.mintPlatformServiceCredentials`.\n * Same orchestrator-pattern as `mintAppCredentials`: orchestrator\n * generates the password, passes it via `secretInputs`; module is\n * upsert-only on the broker.\n */\nexport interface PlatformServiceCredentialMintingContext {\n /**\n * Stable identifier of the platform service this credential is for.\n * Today: members of `PlatformApplicationType` (e.g.,\n * `'platform_apps_manager'`, `'platform_crontabs_batches_manager'`,\n * `'platform_file_generator'`). Module derives the per-service\n * permission regex from this string.\n */\n serviceName: string;\n adminClient: unknown;\n /**\n * Orchestrator-supplied scalars. For RabbitMQ the only required\n * key is `'password'` (no JSON-blob-path conventions because\n * platform-service creds don't go into a per-app blob — they're\n * persisted at the platform-services collection level).\n */\n secretInputs: Record<string, string>;\n}\n\nexport interface PlatformServiceCredentialMintingResult {\n /**\n * Username installed on the broker. Equals `serviceName` today\n * (the legacy convention preserved from the inline ceremony in\n * `PlatformInfrastructureManagerService.provisionServiceCredentials`).\n * Future modules may transform if needed; the orchestrator persists\n * this value alongside the password.\n */\n username: string;\n}\n\n/**\n * Per-app credential minting result. Keys are JSON paths into\n * `Wildo_Application_Secrets` (those declared in\n * `appRuntime.perAppSecretBlobPaths`); values are the canonical\n * persisted form post-broker-upsert. Typically:\n * - **Module-derived** values (e.g., `'database.rabbitmq.username': 'app_<ns>'`).\n * The module computes these from `appSlug`.\n * - **Echoed** values from `secretInputs` (e.g.,\n * `'database.rabbitmq.password': '<the-password-you-passed-in>'`)\n * — the module confirms it installed them on the broker.\n *\n * The orchestrator (apps-manager) merges this map into the persisted\n * secrets blob via `_merge_WildoApplicationSecrets`. The customer\n * pod reads at startup via the standard app-config-fetch path — no\n * K8s Secret involvement for per-app data creds.\n */\nexport interface AppCredentialMintingResult {\n secretBlobValues: Record<string, string>;\n /**\n * Optional non-persisted return values the module produces in the\n * course of upsert. Distinct from `secretBlobValues` (which lands\n * in `Wildo_Application_Secrets`) — `runtimeArtifacts` is a back-\n * channel for values the orchestrator needs at app-init time but\n * deliberately does NOT persist.\n *\n * Slice 4.B.3 of `infra-provider-planner.md` introduced this\n * field for the MongoDB modules: `MongodbAtlasInfraProviderModule`\n * returns `runtimeArtifacts['connectionString']` (the per-app\n * SRV URL with credentials embedded) so the orchestrator can use\n * it for transient app-database seeding without persisting the\n * whole credentialed URL into secrets — the persistence shape is\n * `(username, password)` in secrets + `(host, protocol, options,\n * database)` in config, NOT a single URL string.\n *\n * When `undefined`, the module has no transient artifacts; the\n * orchestrator should rely on `secretBlobValues` only.\n */\n runtimeArtifacts?: Record<string, string>;\n}\n\n// =============================================================================\n// Per-provider admin-client contracts\n// =============================================================================\n//\n// Each `InfraProviderModule.mintAppCredentials` call narrows the\n// `AppCredentialMintingContext.adminClient` field to a per-provider\n// management-client interface. The interfaces live HERE (in\n// platform-config-lib, contracts-only per platform/CLAUDE.md) so the\n// module implementation (in platform-apps-manager) and the manager\n// implementation (also in platform-apps-manager) share one definition\n// — and any future caller (companion, CLI) can implement the same\n// interface without depending on the manager class.\n\n/**\n * Raw RabbitMQ management-API transport (HTTP `PUT/DELETE`). Surface\n * what `RabbitmqSelfInfraProviderModule.mintAppCredentials` /\n * `revokeAppCredentials` need; nothing more. The 5C policy/transport\n * split (LD-4) carves *policy* methods (`upsertTenantUserPermissions`\n * etc.) out of the manager into the module; this interface is the\n * pure-transport remainder.\n *\n * **Argument-order convention** (Slice 4.A.2 / L3): for permission\n * methods, the order is `(vhost, username, permissions)` — vhost\n * first. The legacy pre-Slice-2 convention was `(username, vhost, ...)`\n * (positional, username first). The new convention is cleaner but\n * silently swappable since both args are strings. **Do NOT reorder**;\n * stale call sites copying the legacy positional order will produce\n * wrong-vhost permissions without compile-time complaint.\n */\nexport interface IRabbitMQManagementClient {\n /** PUT /api/users/{name} — idempotent upsert. */\n putUser(username: string, password: string, tags: ReadonlyArray<string>): Promise<void>;\n /** PUT /api/permissions/{vhost}/{name} — vhost-first per the\n * argument-order convention noted on the interface JSDoc. */\n setPermissions(\n vhost: string,\n username: string,\n permissions: { configure: string; write: string; read: string },\n ): Promise<void>;\n /** PUT /api/topic-permissions/{vhost}/{name} — vhost-first. */\n setTopicPermissions(\n vhost: string,\n username: string,\n permissions: { exchange: string; write: string; read: string },\n ): Promise<void>;\n /** DELETE /api/users/{name} — idempotent (404 → no-op). */\n deleteUser(username: string): Promise<void>;\n /** PUT /api/vhosts/{name} — ensures vhost exists; idempotent. */\n ensureVhost(vhost: string): Promise<void>;\n}\n\n/**\n * Raw Redis (Valkey) ACL transport. Surface what\n * `RedisSelfInfraProviderModule.mintAppCredentials` /\n * `revokeAppCredentials` need; nothing more. Used over a `redis-cli`-\n * equivalent ACL connection (the apps-manager's\n * `RedisConnectionManagerService` opens it once at boot and reuses).\n *\n * **Channel pattern policy** (Slice 4.B.1, 2026-05-10): the legacy\n * `RedisConnectionManagerService.upsertTenantUserAcl` derived a\n * fixed family of pub/sub channel patterns from `username`\n * (`<u>#*`, `<u>#/#*`, `<u>-request#*`, `<u>-request#/#*`,\n * `<u>-response#*`, `<u>-response#/#*`). That fan-out is module-\n * internal policy, NOT transport. The contract therefore takes\n * only `username`/`password`/`keyPattern` — the channel patterns\n * live inside the manager implementation today (preserves Slice 2\n * behavior parity); when the legacy method is retired the policy\n * moves into `RedisSelfInfraProviderModule` proper. Until then,\n * `upsertUser` is a thin delegator and the contract is the\n * forward-looking shape.\n *\n * **Idempotent persistence** (`persistAcl`): Valkey/Redis ACL\n * changes are in-memory until `ACL SAVE` is called. The legacy\n * code paired every `upsertTenantUserAcl` with `aclSave`; the\n * module mirrors that pairing.\n */\nexport interface IRedisAclClient {\n /**\n * `ACL SETUSER <name> on >password resetkeys ~<keyPattern> ...`\n * — idempotent upsert. The implementation owns the full ACL\n * command shape (channel patterns, allow/deny categories,\n * dangerous-command denials) — the contract surfaces only the\n * orchestrator-supplied identity material. Slice 4.B.1's manager\n * impl preserves the legacy channel-pattern fan-out from\n * `RedisConnectionManagerService.upsertTenantUserAcl`.\n */\n upsertUser(input: {\n username: string;\n password: string;\n keyPattern: string;\n }): Promise<void>;\n /**\n * `ACL DELUSER <name>` — idempotent (no-op when the user is\n * already absent).\n */\n deleteUser(username: string): Promise<void>;\n /**\n * `ACL SAVE` — flushes the in-memory ACL list to disk. MUST be\n * called after every mutation set so Valkey restarts don't lose\n * tenant users.\n */\n persistAcl(): Promise<void>;\n}\n\n/**\n * Raw Postgres admin transport. Surface what\n * `PostgresSelfInfraProviderModule.mintAppCredentials` /\n * `revokeAppCredentials` need; nothing more. The legacy\n * `PostgreSQLConnectionManagerService` (apps-manager) implements\n * this contract via its existing `createApplicationDatabase` /\n * `deleteApplicationDatabase` methods (Slice 4.B.2 5C policy/\n * transport split).\n *\n * **Identifier-injection-safe**: implementations MUST validate\n * `databaseName` / `username` shapes (alphanumeric + underscore;\n * 63-char Postgres limit) and quote them safely — module callers\n * pass authored slugs verbatim. `PostgreSQLConnectionManagerService`\n * uses the legacy `validateIdentifier` + `quoteIdentifier` pair.\n *\n * **Idempotent upsert** (`upsertApplicationDatabase`): the legacy\n * `createApplicationDatabase` is upsert-style — `CREATE USER` falls\n * back to `ALTER USER` on conflict; `CREATE DATABASE` skips when the\n * DB exists; ownership + privileges always reapplied. The module\n * surface preserves that contract; \"create\" is renamed to \"upsert\"\n * in the contract to match the orchestrator-pattern vocabulary.\n */\nexport interface IPostgresAdminClient {\n /**\n * Upsert per-app database + role. Returns the resolved\n * `connectionUrl` so the orchestrator can persist it into\n * `Wildo_Application_Secrets.database.postgresql.connectUrl`.\n * Idempotent: safe to call repeatedly with the same input.\n */\n upsertApplicationDatabase(input: {\n databaseName: string;\n username: string;\n password: string;\n sslMode?: PostgreSQLSSLMode;\n }): Promise<{ connectionUrl: string }>;\n /**\n * Drop per-app database + user. Idempotent: missing DB / missing\n * user are non-throws (best-effort cleanup, see legacy\n * `deleteApplicationDatabase` semantics).\n */\n dropApplicationDatabase(input: {\n databaseName: string;\n username: string;\n }): Promise<void>;\n /**\n * Stop the application's OWNER role from authenticating — and destroy nothing (#1307).\n *\n * The application backend's role OWNS its database, so it cannot be dropped without first handing\n * ownership of every object to somebody else (PostgreSQL refuses `DROP ROLE` while objects depend\n * on it). Revocation therefore keeps the role and removes its ability to open a session:\n * `NOLOGIN` (a role without it cannot be \"the initial session authorization name during client\n * connection\") plus `PASSWORD NULL` (\"password authentication will always fail for that user\"),\n * then terminates the sessions it already holds, because a login attribute is checked only when a\n * session starts.\n *\n * spec-cite: PostgreSQL 17 `CREATE ROLE` — `LOGIN`/`NOLOGIN` and `PASSWORD` parameter descriptions\n * (https://www.postgresql.org/docs/17/sql-createrole.html); `pg_terminate_backend`, System\n * Administration Functions (https://www.postgresql.org/docs/17/functions-admin.html).\n *\n * Separate from {@link IPostgresAdminClient.dropApplicationDatabase}, which DROPS the database: a\n * withdrawn application's data is kept (#1562 owns destruction), and a revocation that routed\n * through the drop would erase it while believing it was only retiring a login.\n *\n * Reversible by {@link IPostgresAdminClient.upsertApplicationDatabase}, which re-applies\n * `LOGIN PASSWORD` to an existing role. Idempotent: a role that does not exist is a no-op.\n */\n revokeApplicationDatabaseLogin(input: {\n username: string;\n }): Promise<void>;\n /**\n * Upsert a LOGIN role holding exactly the given per-table privileges inside an\n * existing application database (Step 3 / R1).\n *\n * A SEPARATE method from {@link IPostgresAdminClient.upsertApplicationDatabase},\n * for the same reason the Mongo port is split: that one CREATEs the database\n * and makes its caller the OWNER with `ALL PRIVILEGES`, this one grants named\n * verbs on named tables inside a database somebody else owns. One method with\n * an optional privileges argument would make OWNERSHIP the behaviour you get\n * by forgetting to pass something.\n *\n * The grants are AUTHORITATIVE: the implementation must revoke what the role\n * previously held before granting, or a table removed from `resourceAccess`\n * keeps its privilege and revocation becomes a no-op that reports success.\n *\n * An empty `readTables`/`writeTables` pair is legitimate — a role that can\n * connect and see nothing — and must NOT be read as \"unspecified, leave the\n * previous grants alone\".\n */\n /**\n * Remove a table-scoped LOGIN role and everything it holds — WITHOUT touching\n * the database it was scoped into.\n *\n * Separate from {@link IPostgresAdminClient.dropApplicationDatabase}, which\n * drops the DATABASE and its owner. Reusing that one to retire a minion would\n * destroy the entire application's data while believing it was removing one\n * principal's access. That asymmetry is why revocation gets its own method\n * rather than a flag.\n */\n dropTableScopedDatabaseRole(input: {\n databaseName: string;\n username: string;\n schemaName: string;\n }): Promise<void>;\n upsertTableScopedDatabaseRole(input: {\n databaseName: string;\n username: string;\n password: string;\n schemaName: string;\n readTables: readonly string[];\n writeTables: readonly string[];\n /**\n * Insert-only tables — `GRANT INSERT`, never UPDATE and never DELETE.\n *\n * A third axis rather than a flag on `writeTables`, because the two say\n * different things about the same verb set and a boolean would make the\n * safer one the thing you get by remembering to pass it. Today this carries\n * the engine's mandatory append floor — the audit trail and retained job\n * output (see `deriveMinionDatabaseGrants`): a principal must be able to record\n * what it did, and must never be able to unrecord it.\n */\n appendTables: readonly string[];\n /** Insert/update durable runtime records without granting DELETE. Read is granted separately. */\n maintainTables?: readonly string[];\n sslMode?: PostgreSQLSSLMode;\n }): Promise<{ connectionUrl: string }>;\n}\n\n/**\n * Raw MongoDB Atlas API transport. Surface what\n * `MongodbAtlasInfraProviderModule.mintAppCredentials` /\n * `revokeAppCredentials` need; nothing more. The legacy\n * `MongoAtlasManagerService` (apps-manager) implements this\n * contract via its existing `createApplicationDatabase` /\n * `deleteDatabaseUser` methods (Slice 4.B.3 5C policy/transport\n * split).\n *\n * **Idempotent upsert** (`upsertApplicationDatabase`): the legacy\n * `createApplicationDatabase` is upsert-style — `POST /databaseUsers`\n * falls back to `PATCH` on conflict (existing user); cluster scope +\n * roles are reapplied on every call. Returns the SRV connection\n * string with credentials embedded, ready for transient\n * app-database seeding by the orchestrator.\n */\nexport interface IMongoAtlasClient {\n /**\n * Upsert per-app Atlas database user. Returns the SRV connection\n * string (with credentials embedded, `mongodb+srv://user:pass@...`)\n * that the orchestrator uses for transient app-init operations.\n * The string is NOT persisted into `Wildo_Application_Secrets`\n * by today's orchestrator — it's exposed via\n * `AppCredentialMintingResult.runtimeArtifacts.connectionString`.\n */\n upsertApplicationDatabase(input: {\n clusterName: string;\n databaseName: string;\n username: string;\n password: string;\n }): Promise<{ connectionString: string }>;\n /**\n * Delete an Atlas database user. Idempotent: 404 → no-op.\n */\n deleteDatabaseUser(username: string): Promise<void>;\n /**\n * Upsert a database user holding exactly ONE Atlas custom database role, which carries exactly the\n * given collection-scoped privileges and inherits nothing (#1694). The Atlas twin of\n * {@link IMongoSelfAdminClient.upsertCollectionScopedDatabaseUser}, for a runtime principal (a minion).\n *\n * A SEPARATE method from {@link IMongoAtlasClient.upsertApplicationDatabase} for the reason the\n * self-hosted contract gives: that one grants `readWrite` on the whole database, this one grants named\n * actions on named collections, and an optional \"privileges\" argument would make the wide grant the\n * behaviour you get by forgetting to pass something.\n *\n * - `privileges[].actions` are Atlas Admin API privilege-action names (`FIND`, `INSERT`, `UPDATE`,\n * `REMOVE`, …). The caller translates from MongoDB's own vocabulary; this transport never widens it.\n * - `privileges` is AUTHORITATIVE: an existing role's actions are REPLACED, so a resource removed from\n * `resourceAccess` loses its grant on the next sync.\n * - The user is scoped to `clusterName` alone (Atlas grants every cluster in the project when `scopes`\n * is omitted), and holds the custom role and nothing else.\n * - Idempotent: safe when the role and user already exist; the password is re-applied, which is how a\n * rotation lands.\n *\n * Returns the SRV connection string carrying THIS user's credentials, for the same transient use as\n * {@link IMongoAtlasClient.upsertApplicationDatabase}'s.\n */\n upsertCollectionScopedDatabaseUser(input: {\n clusterName: string;\n databaseName: string;\n username: string;\n password: string;\n roleName: string;\n privileges: ReadonlyArray<{\n resource: { db: string; collection: string };\n actions: readonly string[];\n }>;\n }): Promise<{ connectionString: string }>;\n /**\n * Retire a collection-scoped user AND the custom role it holds — and nothing else.\n *\n * Two objects, deleted user FIRST: Atlas refuses to delete a custom role that would leave a database\n * user with no roles, so the reverse order fails while the user exists. Dropping only the user would\n * leave a privileged role behind that the next mint silently adopts. Idempotent in both halves: a\n * missing user or a missing role is a no-op.\n */\n dropCollectionScopedDatabaseUser(input: {\n username: string;\n roleName: string;\n }): Promise<void>;\n}\n\n/**\n * The immudb permission an application's audit user holds on its OWN database (#1696).\n *\n * The values are immudb's own permission bytes, because the admin transport sends them verbatim.\n * spec-cite: immudb v1.11.1 `pkg/auth/permissions.go` — `PermissionNone = iota`, `PermissionR`, `PermissionRW`\n * (0, 1, 2), `PermissionAdmin = 254`, `PermissionSysAdmin = 255`\n * (https://raw.githubusercontent.com/codenotary/immudb/v1.11.1/pkg/auth/permissions.go, fetched 2026-09-29).\n *\n * Only READ_WRITE is named: an audit sink appends and verifies, and nothing in the framework grants an\n * application more. `ADMIN` and `SYSADMIN` are deliberately absent — holding either is the defect #1696 removes.\n */\nexport enum ImmudbDatabasePermission {\n READ_WRITE = 2,\n}\n\n/**\n * Raw immudb admin transport (#1696). Surfaces exactly what `ImmudbSelfInfraProviderModule` needs to give each\n * application ONE database and ONE user confined to it, and to revoke that user — nothing more.\n *\n * Implemented in apps-manager over the gRPC admin API with the PLATFORM's own admin credential (a\n * framework-managed secret no application receives). Every method is idempotent, because registration,\n * withdrawal and restore all retry by re-running.\n *\n * **No method deletes anything.** immudb keeps every database and every user it has created: an append-only\n * store's audit history must outlive the application's credential, and a withdrawn application is restored by\n * RE-ACTIVATING its user onto the same database (#1307).\n */\nexport interface IImmudbAdminClient {\n /** Create the database when it does not exist; a no-op when it does. */\n ensureDatabase(input: { databaseName: string }): Promise<void>;\n /**\n * Create the user, or bring an existing one back to exactly this state: ACTIVE, this password, and `permission`\n * on `databaseName`. Re-applying the password and re-activating are what make a restore after withdrawal work.\n */\n upsertDatabaseUser(input: {\n username: string;\n password: string;\n databaseName: string;\n permission: ImmudbDatabasePermission;\n }): Promise<void>;\n /**\n * Refuse the user's credential from now on: revoke its permission on `databaseName` and DEACTIVATE it.\n * immudb has no user deletion; a deactivated user cannot log in. A user that does not exist is a no-op.\n */\n deactivateDatabaseUser(input: { username: string; databaseName: string }): Promise<void>;\n}\n\n/**\n * Raw self-managed MongoDB admin transport. Surface what\n * `MongodbSelfInfraProviderModule.mintAppCredentials` /\n * `revokeAppCredentials` need; nothing more. Implemented by a\n * lightweight admin-side mongoose connection — the legacy inline\n * `ensureSelfManagedMongoApplicationUser` at\n * `wildo-application-lifecycle.service.ts:2710-2745` is the source\n * of behavior.\n *\n * **Why this contract is asymmetric to `IMongoAtlasClient`** (Slice\n * 4.B.3 design note, 2026-05-10): Atlas exposes a stateless REST\n * API for user management; self-managed Mongo requires opening an\n * admin-DB connection and running `createUser` / `updateUser`\n * commands. The contract therefore takes the admin connect URL as\n * an input (not a constructor-time configuration) — implementations\n * open transient connections per call, mirroring the legacy\n * pattern.\n */\nexport interface IMongoSelfAdminClient {\n /**\n * Upsert per-app database user on a self-managed MongoDB\n * instance. Connects to `adminConnectUrl` (admin-scoped),\n * creates or updates the user with `readWrite` + `dbAdmin`\n * roles on `databaseName`, then closes the connection. Idempotent.\n */\n upsertApplicationDatabaseUser(input: {\n adminConnectUrl: string;\n databaseName: string;\n username: string;\n password: string;\n }): Promise<void>;\n /**\n * Delete a per-app database user. Idempotent: missing user is a\n * no-op (best-effort cleanup, mirrors `IPostgresAdminClient`\n * semantics).\n */\n deleteApplicationDatabaseUser(input: {\n adminConnectUrl: string;\n username: string;\n }): Promise<void>;\n /**\n * Upsert a database user holding ONE custom role carrying exactly the given\n * collection-scoped privileges (Step 3 / R1 / D14).\n *\n * Deliberately a SEPARATE method from\n * {@link IMongoSelfAdminClient.upsertApplicationDatabaseUser} rather than an\n * optional parameter on it. The two grant fundamentally different authority —\n * that one grants `readWrite` + `dbAdmin` on the WHOLE database, this one\n * grants named actions on named collections and nothing else — and a single\n * method with an optional \"privileges\" argument would make the wide grant the\n * behaviour you get by forgetting to pass something. Two methods make the\n * caller name which authority it intends.\n *\n * `privileges` is authoritative and REPLACES the role's previous contents, so\n * a resource removed from `resourceAccess` loses its grant on the next sync.\n * An empty list is legitimate — a principal with no data access — and MUST\n * yield a role granting nothing rather than being treated as \"unspecified\".\n *\n * Idempotent: safe to call when the role and user already exist.\n */\n /**\n * Retire a collection-scoped user AND the custom role it holds.\n *\n * Separate from {@link IMongoSelfAdminClient.deleteApplicationDatabaseUser}\n * because a scoped principal owns TWO objects in TWO databases — the user in\n * `admin`, the role in the application database — and dropping only the user\n * leaves a privileged role behind that the next mint silently adopts.\n *\n * Idempotent in both halves: a missing user or a missing role is a no-op.\n */\n dropCollectionScopedDatabaseUser(input: {\n adminConnectUrl: string;\n databaseName: string;\n username: string;\n roleName: string;\n }): Promise<void>;\n upsertCollectionScopedDatabaseUser(input: {\n adminConnectUrl: string;\n databaseName: string;\n username: string;\n password: string;\n roleName: string;\n privileges: ReadonlyArray<{\n resource: { db: string; collection: string };\n actions: readonly string[];\n }>;\n }): Promise<void>;\n}\n\nexport interface InfraProviderModule {\n provider: InfraProvider;\n supportedCapabilities: ReadonlyArray<InfraCapability>;\n\n /**\n * Present when this module EXISTS but the platform cannot yet deliver a working connection for the\n * provider — the module can plan, and an application selecting it would still receive no usable\n * credential. The value says why, and what would change it.\n *\n * ## Why the module stays in the catalogue instead of being removed\n *\n * The module's `plan()` is correct and useful: it formalizes the env contract an operator will set\n * and gives the lockfile a stable digest. What is missing is elsewhere (for `AWS_S3`, the credential\n * broker that speaks only MinIO's AssumeRole, #14). Removing the module would lose the correct half\n * to express the missing one.\n *\n * ## What it does\n *\n * A declaration resolving to a provider whose module carries this is REFUSED at authoring time\n * (`wildo config validate` / `config sync` / `lock check`), exactly like a declaration resolving to\n * a provider with no module. Delete the field in the same change that makes the provider servable.\n */\n unservableReason?: string;\n\n /**\n * Every `Wildo_Application_Secrets` JSON path this module can mint PER RUNTIME PRINCIPAL.\n *\n * ## Why this is static, when `plan()` already reports the same paths\n *\n * `plan()` answers \"what does THIS application get\", so it needs an\n * {@link InfraProviderPlanningContext}. The secret-DELIVERY path in apps-manager asks a different\n * question — \"which paths are per-principal AT ALL\" — and must answer it with no application in\n * hand, because it decides what to STRIP from the application blob before overlaying a\n * principal's own material. A principal must receive a credential only where one was minted for\n * it; anything left un-stripped is delivered with the APPLICATION's value, which for a database\n * means `readWrite` + `dbAdmin` on the whole database.\n *\n * Empty for a provider with no per-app credentials — shared-bucket object storage\n * (`MINIO_SELF`, `AWS_S3`) and stateless infra (`CLAMAV_SELF`). Empty is a\n * real answer, not a missing one, which is why the field is required rather than optional: a\n * module that mints per-principal material must not be able to omit it and be silently read as\n * \"nothing to confine\".\n *\n * **Modules MUST derive `appRuntime.perAppSecretBlobPaths` from this same constant** rather than\n * repeating the literal list. Two spellings of where a credential lives is the defect this exists\n * to prevent, one layer up.\n *\n * **A module declaring paths here MUST derive a distinct resource name per principal**, in its mint\n * AND its revoke, through one function. apps-manager dispatches every minion mint and revocation\n * through the catalogue (#1692), so a module that ignored `principal` and derived the application\n * backend's own name would OVERWRITE the backend's user on a minion mint and DELETE it on a minion\n * revocation — the defect `invariant-call-site-enumeration.md` #18 records. MongoDB Atlas shipped in\n * exactly that shape and was refused at registration until its per-principal path landed (#1694).\n */\n perPrincipalSecretBlobPaths: ReadonlyArray<string>;\n\n plan(context: InfraProviderPlanningContext): InfraProviderPlanContribution;\n\n /**\n * Optional. Called by apps-manager at app-init time (see\n * `wildo-application-lifecycle.service.ts:432-580` — the existing\n * per-resource ceremony this method abstracts). Upserts the per-app\n * user / role / DB on the broker using `secretInputs` for any\n * orchestrator-supplied passwords; returns the canonical form of\n * the persisted secrets blob slice.\n *\n * Returns `null` when the provider has no per-app credentials (e.g.,\n * shared S3 bucket with shared access key).\n *\n * **Idempotent broker upsert** — the module installs / replaces the\n * user with the password from `secretInputs`. It does NOT make\n * generation/rotation decisions; that is the orchestrator's\n * responsibility (driven by the existing `overrideCredentials`\n * flag on `WildoApplicationInitOptions`). The module MUST NOT\n * crash on \"user already exists\" (PUT semantics on the broker\n * management API are sufficient for RabbitMQ; equivalent\n * upsert-on-conflict semantics for other providers).\n */\n mintAppCredentials?(\n context: AppCredentialMintingContext,\n ): Promise<AppCredentialMintingResult | null>;\n\n /**\n * Optional. Symmetric to `mintAppCredentials`: afterwards the principal's credential is REFUSED by the\n * server. Called by apps-manager when a minion leaves the declaration, and for EVERY principal of an\n * application withdrawn from the platform (`deregisterApplication`, #1307).\n *\n * **It revokes and never destroys.** It removes the ability to authenticate — an ACL user, a broker\n * user, a database user, or a login — and leaves the application's DATA where it is: its database,\n * keys, queues and blobs. A withdrawn application is restored by re-minting (`mintAppCredentials` with\n * the recorded material), which only works if nothing it owns was dropped. Destroying data is a\n * different verb with its own protection (#1562); a module must never reach it through this one.\n *\n * Idempotent: safe to call when the per-principal user / role does not exist (no throw on\n * already-absent), because a retry after a partial revocation must converge.\n */\n revokeAppCredentials?(context: AppCredentialMintingContext): Promise<void>;\n\n /**\n * Optional (LD-8 / Slice 2.5). Called by the orchestrator\n * (`PlatformInfrastructureManagerService.provisionServiceCredentials`\n * + `ensureAppsManagerCredentials`) at platform-service-init time.\n * Upserts a SCOPED (non-admin) per-platform-service user on the\n * broker for inter-service messaging — distinct from\n * `mintAppCredentials` (audience-3, customer-app per-app creds).\n *\n * Same orchestrator-pattern as `mintAppCredentials`: orchestrator\n * owns generation, module is upsert-only.\n *\n * Returns `null` when the provider has no per-platform-service\n * credentials concept (e.g., S3 modules — platform services use a\n * shared bucket).\n */\n mintPlatformServiceCredentials?(\n context: PlatformServiceCredentialMintingContext,\n ): Promise<PlatformServiceCredentialMintingResult | null>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"infra-service.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/infra-service.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;kBAI9B,CAAC;AACZ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;kBAEvB,CAAC;AACZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"infra-service.schemas.d.ts","sourceRoot":"","sources":["../../../../src/project-config/shared/infra-service.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;kBAI9B,CAAC;AACZ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;kBAEvB,CAAC;AACZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"infra-service.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/infra-service.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC3B,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\n\n/**\n * App-authored local runtime addressing for helper services.\n */\nexport const InfraServiceAddressingSchema = z.object({\n host: z.string().optional(),\n port: z.number().int().positive().optional(),\n url: z.string().optional(),\n}).strict();\nexport type InfraServiceAddressing = z.infer<typeof InfraServiceAddressingSchema>;\n\n/**\n * App-authored Kubernetes runtime scaling for generated service workloads.\n */\nexport const InfraServiceK8sSchema = z.object({\n replicas: z.number().int().positive().optional(),\n}).strict();\nexport type InfraServiceK8s = z.infer<typeof InfraServiceK8sSchema>;\n"]}
1
+ {"version":3,"file":"infra-service.schemas.js","sourceRoot":"","sources":["../../../../src/project-config/shared/infra-service.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC3B,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\n\n/**\n * App-authored local runtime addressing for helper services.\n */\nexport const InfraServiceAddressingSchema = z.object({\n host: z.string().optional(),\n port: z.number().int().positive().optional(),\n url: z.string().optional(),\n}).strict();\nexport type InfraServiceAddressing = z.infer<typeof InfraServiceAddressingSchema>;\n\n/**\n * App-authored Kubernetes runtime scaling for generated service workloads.\n */\nexport const InfraServiceK8sSchema = z.object({\n replicas: z.number().int().positive().optional(),\n}).strict();\nexport type InfraServiceK8s = z.infer<typeof InfraServiceK8sSchema>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"infrastructure-defaults.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/infrastructure-defaults.schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;CA2BtB,CAAC;AAEX,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB;;;CAGzB,CAAC;AAEX,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAG,gBAAyB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,EAAG,gBAAyB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,sCAAsC,EAAG,UAAmB,CAAC"}
1
+ {"version":3,"file":"infrastructure-defaults.schemas.d.ts","sourceRoot":"","sources":["../../../../src/project-config/shared/infrastructure-defaults.schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;CA2BtB,CAAC;AAEX,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB;;;CAGzB,CAAC;AAEX,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAG,gBAAyB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,EAAG,gBAAyB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,sCAAsC,EAAG,UAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"infrastructure-defaults.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/infrastructure-defaults.schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,mBAAmB,EAAE,KAAK;IAC1B,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;IAChB,oEAAoE;IACpE,mEAAmE;IACnE,yEAAyE;IACzE,MAAM,EAAE,IAAI;IACZ,oEAAoE;IACpE,4EAA4E;IAC5E,MAAM,EAAE,IAAI;IACZ,iFAAiF;IACjF,iFAAiF;IACjF,+EAA+E;IAC/E,kFAAkF;IAClF,8EAA8E;IAC9E,sEAAsE;IACtE,wEAAwE;IACxE,sDAAsD;IACtD,gFAAgF;IAChF,gFAAgF;IAChF,WAAW,EAAE,KAAK;IAClB,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;CACZ,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,YAAY,EAAE,IAAI;IAClB,wBAAwB,EAAE,IAAI;IAC9B,eAAe,EAAE,IAAI;CACb,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,SAAS,EAAE,aAAa;IACxB,WAAW,EAAE,gBAAgB;CACrB,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS,EAAE,gBAAgB;IAC3B,aAAa,EAAE,WAAW;CAClB,CAAC;AAEX,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,UAAU;IAC3B,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,IAAI;CACX,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,MAAM,EAAE,aAAa;IACrB,QAAQ,EAAE,OAAO;CACT,CAAC;AAEX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,gBAAyB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAyB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,UAAmB,CAAC","sourcesContent":["/**\n * Infrastructure default ports and constants.\n * Single source of truth — CLI catalogs, apps-manager env schemas,\n * and generated manifests all derive from these values.\n */\n\nexport const INFRA_DEFAULT_PORTS = {\n MONGODB: 27017,\n VALKEY: 6379,\n RABBITMQ: 5672,\n RABBITMQ_MANAGEMENT: 15672,\n MINIO: 9000,\n POSTGRESQL: 5432,\n // Slice 4 (4.8) — ClamAV catalog integration. 3310 is the canonical\n // clamd TCP port the official `clamav/clamav:1.4` image listens on\n // (and the port the static docker-compose.yml has been hand-publishing).\n CLAMAV: 3310,\n // Audit Phase 2 — immudb gRPC port (the canonical port the official\n // `codenotary/immudb` image listens on for the tamper-evident audit store).\n IMMUDB: 3322,\n // Issue #74 — `mongot`, the separate MongoDB Search / Vector Search process that\n // sits BESIDE mongod (never in front of it: clients only ever connect to mongod,\n // which routes `$search` / `$vectorSearch` to mongot over gRPC and lets mongot\n // read its change stream back). Three listeners, all container-internal — none is\n // ever published to the host, because nothing on the host is a mongot client.\n // - 27028 gRPC — the mongod ⇄ mongot channel (`mongotHost`).\n // - 8080 health — `GET /health` answers `{\"status\":\"SERVING\"}`.\n // - 9946 metrics — Prometheus scrape endpoint.\n // Verified 2026-08-27 against `mongodb/mongodb-community-search:1.70.3` running\n // beside `mongo:8.2` (8.2.12): index create + `$vectorSearch` query round-trip.\n MONGOT_GRPC: 27028,\n MONGOT_HEALTH: 8080,\n MONGOT_METRICS: 9946,\n} as const;\n\nexport const PLATFORM_DEFAULT_PORTS = {\n APPS_MANAGER: 5151,\n CRONTABS_BATCHES_MANAGER: 5152,\n MODULE_REGISTRY: 5154,\n} as const;\n\nexport const K8S_LOCAL_DEFAULTS = {\n NAMESPACE: 'wildo-local',\n BASE_DOMAIN: 'local.wildo.ai',\n} as const;\n\n/**\n * Write-time defaults for the runtime-agnostic top-level `publicDomain`\n * field on `WildoInfraEnvConfig`. Consumed ONLY by `wildo init` (and\n * the equivalent CLI bootstrap surface) to populate the generated\n * config file at creation time.\n *\n * There is no read-time fallback — the schema requires `publicDomain`\n * to be authored explicitly. A hand-edited config that drops the field\n * fails Zod parse with a clear error instead of silently defaulting.\n *\n * - `LOCAL_K8S` — what `wildo init` writes for a local K8s runtime.\n * - `LOCAL_COMPOSE` — what `wildo init` writes for a local Docker\n * Compose runtime (compose-without-reverse-proxy authors `'localhost'`).\n *\n * For remote envs, no default — the author must specify the apex\n * (e.g. `'wonder-todos.com'`).\n */\nexport const PUBLIC_DOMAIN_DEFAULTS = {\n LOCAL_K8S: 'local.wildo.ai',\n LOCAL_COMPOSE: 'localhost',\n} as const;\n\nexport const KIND_CLUSTER_DEFAULTS = {\n CLUSTER_NAME: 'dev',\n KUBECTL_CONTEXT: 'kind-dev',\n REGISTRY_NAME: 'kind-registry',\n REGISTRY_PORT: 5001,\n} as const;\n\nexport const STORAGE_DEFAULTS = {\n BUCKET: 'wildo-files',\n PROVIDER: 'minio',\n} as const;\n\n/**\n * Platform MongoDB database name.\n * This is the database used by apps-manager and platform services for\n * all platform-scoped collections (wildoApplication, platformApplications, etc.).\n * Aligned with PostgreSQL naming (`wildo_platform`).\n */\nexport const PLATFORM_MONGO_DATABASE = 'wildo_platform' as const;\n\n/**\n * Platform PostgreSQL database name — the PostgreSQL mirror of {@link PLATFORM_MONGO_DATABASE},\n * and it exists to keep the platform's own store SEPARATE from any application's.\n *\n * ⚠️ Do NOT derive this from `infrastructure.postgresql.database`. That field is mirrored from the\n * author's `backingServices.postgresql.database`, which names the APPLICATION's database (for\n * Wonder Todos local it is literally `wonder-todos-db`) and is also the compose container's initdb\n * database. Pointing the platform's `PG_CONNECT_URL` at it created the platform's ~94 tables —\n * `users`, `organizations`, `applications` among them — INSIDE the application's database; and\n * because every generated statement is `create table if not exists`, an application later\n * provisioning its own PostgreSQL schema there would silently ADOPT the platform's tables instead\n * of failing. Two tenancy planes, one table, no diagnostic. Found by review before the first flip.\n *\n * A dedicated name costs one `create database` — apps-manager INIT creates it through\n * `PostgreSQLConnectionManagerService.ensurePlatformDatabaseExists` using the `PG_ADMIN_*`\n * credentials, because PostgreSQL (unlike MongoDB) creates no database on connect and the compose\n * container's initdb creates only the application's. That makes the separation structural rather\n * than conventional. Full context: `.claude/plans/platform-postgresql-store-switch.md`.\n */\nexport const PLATFORM_POSTGRES_DATABASE = 'wildo_platform' as const;\n\n/**\n * The MAINTENANCE database the apps-manager admin pool connects to in order to provision OTHER\n * databases and roles — the value of `PG_ADMIN_DATABASE`.\n *\n * PostgreSQL has no \"connect to the server\" — every connection is to a database — while\n * `CREATE DATABASE` / `CREATE ROLE` are server-scoped and cannot run from inside the database being\n * created. So a provisioner needs one database that is guaranteed to exist and that it never\n * provisions: `postgres`, which `initdb` always creates alongside whatever `POSTGRES_DB` names.\n *\n * ⚠️ There are THREE PostgreSQL database names in this system and they are NOT interchangeable.\n * Conflating the first two cost a silent outage (2026-08-13):\n *\n * | Constant / field | Env key | Meaning |\n * |---|---|---|\n * | this one | `PG_ADMIN_DATABASE` | where the admin pool CONNECTS to do provisioning work |\n * | `infrastructure.postgresql.database` | `POSTGRES_ADMIN_DATABASE` | the container's `initdb` database (the APPLICATION's) |\n * | {@link PLATFORM_POSTGRES_DATABASE} | inside `PG_CONNECT_URL` | where the platform's OWN ~94 tables live |\n *\n * `PG_ADMIN_DATABASE` was emitted from `infrastructure.postgresql.database`, so the admin pool\n * dialled the APPLICATION's database (`wonder-todos-db`). That database is created by the compose\n * container's initdb — from the SEPARATE `POSTGRES_ADMIN_DATABASE` key, which defaults to\n * `wildo_platform` — so on any machine where the two disagreed it did not exist. The failure is\n * silent by construction: `3D000 database does not exist` is not a connection error, so\n * `initializeAdmin`'s retry branch is skipped, the caller records `postgresql: 'failed'` and\n * CONTINUES, and `/health/ready` still answers 200. `isPostgreSQLAvailable()` then returns false\n * for the whole process lifetime — every provisioning call a silent no-op behind a green probe.\n *\n * Pointing it at the application's database would be wrong even where that database exists: the\n * admin pool holds an open connection, and an open connection blocks `DROP DATABASE` on its own\n * target.\n *\n * A framework constant rather than an authored field on purpose — it is a property of PostgreSQL,\n * not of an environment. If a managed provider ever disallows connecting to `postgres`, this is the\n * single place to make it authorable; do not re-derive it from an application-scoped field.\n */\nexport const PLATFORM_POSTGRES_MAINTENANCE_DATABASE = 'postgres' as const;\n"]}
1
+ {"version":3,"file":"infrastructure-defaults.schemas.js","sourceRoot":"","sources":["../../../../src/project-config/shared/infrastructure-defaults.schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,mBAAmB,EAAE,KAAK;IAC1B,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;IAChB,oEAAoE;IACpE,mEAAmE;IACnE,yEAAyE;IACzE,MAAM,EAAE,IAAI;IACZ,oEAAoE;IACpE,4EAA4E;IAC5E,MAAM,EAAE,IAAI;IACZ,iFAAiF;IACjF,iFAAiF;IACjF,+EAA+E;IAC/E,kFAAkF;IAClF,8EAA8E;IAC9E,sEAAsE;IACtE,wEAAwE;IACxE,sDAAsD;IACtD,gFAAgF;IAChF,gFAAgF;IAChF,WAAW,EAAE,KAAK;IAClB,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;CACZ,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,YAAY,EAAE,IAAI;IAClB,wBAAwB,EAAE,IAAI;IAC9B,eAAe,EAAE,IAAI;CACb,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,SAAS,EAAE,aAAa;IACxB,WAAW,EAAE,gBAAgB;CACrB,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS,EAAE,gBAAgB;IAC3B,aAAa,EAAE,WAAW;CAClB,CAAC;AAEX,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,UAAU;IAC3B,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,IAAI;CACX,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,MAAM,EAAE,aAAa;IACrB,QAAQ,EAAE,OAAO;CACT,CAAC;AAEX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,gBAAyB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAyB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,UAAmB,CAAC","sourcesContent":["/**\n * Infrastructure default ports and constants.\n * Single source of truth — CLI catalogs, apps-manager env schemas,\n * and generated manifests all derive from these values.\n */\n\nexport const INFRA_DEFAULT_PORTS = {\n MONGODB: 27017,\n VALKEY: 6379,\n RABBITMQ: 5672,\n RABBITMQ_MANAGEMENT: 15672,\n MINIO: 9000,\n POSTGRESQL: 5432,\n // Slice 4 (4.8) — ClamAV catalog integration. 3310 is the canonical\n // clamd TCP port the official `clamav/clamav:1.4` image listens on\n // (and the port the static docker-compose.yml has been hand-publishing).\n CLAMAV: 3310,\n // Audit Phase 2 — immudb gRPC port (the canonical port the official\n // `codenotary/immudb` image listens on for the tamper-evident audit store).\n IMMUDB: 3322,\n // Issue #74 — `mongot`, the separate MongoDB Search / Vector Search process that\n // sits BESIDE mongod (never in front of it: clients only ever connect to mongod,\n // which routes `$search` / `$vectorSearch` to mongot over gRPC and lets mongot\n // read its change stream back). Three listeners, all container-internal — none is\n // ever published to the host, because nothing on the host is a mongot client.\n // - 27028 gRPC — the mongod ⇄ mongot channel (`mongotHost`).\n // - 8080 health — `GET /health` answers `{\"status\":\"SERVING\"}`.\n // - 9946 metrics — Prometheus scrape endpoint.\n // Verified 2026-08-27 against `mongodb/mongodb-community-search:1.70.3` running\n // beside `mongo:8.2` (8.2.12): index create + `$vectorSearch` query round-trip.\n MONGOT_GRPC: 27028,\n MONGOT_HEALTH: 8080,\n MONGOT_METRICS: 9946,\n} as const;\n\nexport const PLATFORM_DEFAULT_PORTS = {\n APPS_MANAGER: 5151,\n CRONTABS_BATCHES_MANAGER: 5152,\n MODULE_REGISTRY: 5154,\n} as const;\n\nexport const K8S_LOCAL_DEFAULTS = {\n NAMESPACE: 'wildo-local',\n BASE_DOMAIN: 'local.wildo.ai',\n} as const;\n\n/**\n * Write-time defaults for the runtime-agnostic top-level `publicDomain`\n * field on `WildoInfraEnvConfig`. Consumed ONLY by `wildo init` (and\n * the equivalent CLI bootstrap surface) to populate the generated\n * config file at creation time.\n *\n * There is no read-time fallback — the schema requires `publicDomain`\n * to be authored explicitly. A hand-edited config that drops the field\n * fails Zod parse with a clear error instead of silently defaulting.\n *\n * - `LOCAL_K8S` — what `wildo init` writes for a local K8s runtime.\n * - `LOCAL_COMPOSE` — what `wildo init` writes for a local Docker\n * Compose runtime (compose-without-reverse-proxy authors `'localhost'`).\n *\n * For remote envs, no default — the author must specify the apex\n * (e.g. `'wonder-todos.com'`).\n */\nexport const PUBLIC_DOMAIN_DEFAULTS = {\n LOCAL_K8S: 'local.wildo.ai',\n LOCAL_COMPOSE: 'localhost',\n} as const;\n\nexport const KIND_CLUSTER_DEFAULTS = {\n CLUSTER_NAME: 'dev',\n KUBECTL_CONTEXT: 'kind-dev',\n REGISTRY_NAME: 'kind-registry',\n REGISTRY_PORT: 5001,\n} as const;\n\nexport const STORAGE_DEFAULTS = {\n BUCKET: 'wildo-files',\n PROVIDER: 'minio',\n} as const;\n\n/**\n * Platform MongoDB database name.\n * This is the database used by apps-manager and platform services for\n * all platform-scoped collections (wildoApplication, platformApplications, etc.).\n * Aligned with PostgreSQL naming (`wildo_platform`).\n */\nexport const PLATFORM_MONGO_DATABASE = 'wildo_platform' as const;\n\n/**\n * Platform PostgreSQL database name — the PostgreSQL mirror of {@link PLATFORM_MONGO_DATABASE},\n * and it exists to keep the platform's own store SEPARATE from any application's.\n *\n * ⚠️ Do NOT derive this from `infrastructure.postgresql.database`. That field is mirrored from the\n * author's `backingServices.postgresql.database`, which names the APPLICATION's database (for\n * Wonder Todos local it is literally `wonder-todos-db`) and is also the compose container's initdb\n * database. Pointing the platform's `PG_CONNECT_URL` at it created the platform's ~94 tables —\n * `users`, `organizations`, `applications` among them — INSIDE the application's database; and\n * because every generated statement is `create table if not exists`, an application later\n * provisioning its own PostgreSQL schema there would silently ADOPT the platform's tables instead\n * of failing. Two tenancy planes, one table, no diagnostic. Found by review before the first flip.\n *\n * A dedicated name costs one `create database` — apps-manager INIT creates it through\n * `PostgreSQLConnectionManagerService.ensurePlatformDatabaseExists` using the `PG_ADMIN_*`\n * credentials, because PostgreSQL (unlike MongoDB) creates no database on connect and the compose\n * container's initdb creates only the application's. That makes the separation structural rather\n * than conventional. Full context: `.claude/plans/platform-postgresql-store-switch.md`.\n */\nexport const PLATFORM_POSTGRES_DATABASE = 'wildo_platform' as const;\n\n/**\n * The MAINTENANCE database the apps-manager admin pool connects to in order to provision OTHER\n * databases and roles — the value of `PG_ADMIN_DATABASE`.\n *\n * PostgreSQL has no \"connect to the server\" — every connection is to a database — while\n * `CREATE DATABASE` / `CREATE ROLE` are server-scoped and cannot run from inside the database being\n * created. So a provisioner needs one database that is guaranteed to exist and that it never\n * provisions: `postgres`, which `initdb` always creates alongside whatever `POSTGRES_DB` names.\n *\n * ⚠️ There are THREE PostgreSQL database names in this system and they are NOT interchangeable.\n * Conflating the first two cost a silent outage (2026-08-13):\n *\n * | Constant / field | Env key | Meaning |\n * |---|---|---|\n * | this one | `PG_ADMIN_DATABASE` | where the admin pool CONNECTS to do provisioning work |\n * | `infrastructure.postgresql.database` | `POSTGRES_ADMIN_DATABASE` | the container's `initdb` database (the APPLICATION's) |\n * | {@link PLATFORM_POSTGRES_DATABASE} | inside `PG_CONNECT_URL` | where the platform's OWN ~94 tables live |\n *\n * `PG_ADMIN_DATABASE` was emitted from `infrastructure.postgresql.database`, so the admin pool\n * dialled the APPLICATION's database (`wonder-todos-db`). That database is created by the compose\n * container's initdb — from the SEPARATE `POSTGRES_ADMIN_DATABASE` key, which defaults to\n * `wildo_platform` — so on any machine where the two disagreed it did not exist. The failure is\n * silent by construction: `3D000 database does not exist` is not a connection error, so\n * `initializeAdmin`'s retry branch is skipped, the caller records `postgresql: 'failed'` and\n * CONTINUES, and `/health/ready` still answers 200. `isPostgreSQLAvailable()` then returns false\n * for the whole process lifetime — every provisioning call a silent no-op behind a green probe.\n *\n * Pointing it at the application's database would be wrong even where that database exists: the\n * admin pool holds an open connection, and an open connection blocks `DROP DATABASE` on its own\n * target.\n *\n * A framework constant rather than an authored field on purpose — it is a property of PostgreSQL,\n * not of an environment. If a managed provider ever disallows connecting to `postgres`, this is the\n * single place to make it authorable; do not re-derive it from an application-scoped field.\n */\nexport const PLATFORM_POSTGRES_MAINTENANCE_DATABASE = 'postgres' as const;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"k8s-utils.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/k8s-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE/E;AAED;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,uBAAuB,CAAC,kBAA0B;IAChE,OAAO,GAAG,kBAAkB,SAAS,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,6BAA6B,CAAC,kBAA0B;IACtE,OAAO,GAAG,kBAAkB,mBAAmB,CAAC;AAClD,CAAC","sourcesContent":["/**\n * Kubernetes URL builders and naming conventions.\n * Single source of truth for constructing K8s-style addresses and resource names.\n *\n * Used by CLI (ServiceAddressResolver, K8s manifest gen) and apps-manager\n * (application lifecycle) to ensure consistent URL/naming patterns.\n */\n\n/**\n * Builds a K8s cluster-internal URL: `http://<service>.<namespace>.svc.cluster.local:<port>`\n */\nexport function buildK8sInternalUrl(service: string, port: number, namespace: string): string {\n return `http://${service}.${namespace}.svc.cluster.local:${port}`;\n}\n\n/**\n * Builds a K8s cluster-internal hostname (without scheme/port).\n */\nexport function buildK8sInternalHost(service: string, namespace: string): string {\n return `${service}.${namespace}.svc.cluster.local`;\n}\n\n/**\n * Builds an ingress-based public URL: `https://<service>.<publicDomain>`\n *\n * `publicDomain` is the runtime-agnostic external hostname (browsers /\n * reverse proxy / DNS terminate here). See `WildoInfraEnvConfig.publicDomain`.\n *\n * Used for PLATFORM services (apps-manager, module-registry, …) whose\n * subdomain is always the service name. Application services (frontends +\n * backend API) resolve their public host through {@link buildServicePublicHost}\n * so the operator's authored `serviceHosts` map wins.\n */\nexport function buildK8sPublicUrl(service: string, publicDomain: string): string {\n return `https://${service}.${publicDomain}`;\n}\n\n// ============================================================================\n// Application public-host resolution (serviceHosts-driven)\n// ============================================================================\n//\n// Single source of truth for an application service's PUBLIC hostname, shared\n// by every producer so ingress routing, `runtime.endPoints[*].publicUrl`, and\n// CORS never diverge (a divergence breaks the browser's next `fetch` on CORS —\n// see `.claude/plans/self-host-domain-subdomain-model.md`).\n//\n// The self-hosted, single-app, mono-env model: each service lives at a\n// subdomain of the operator's own `publicDomain`. Greenfield — there is NO\n// multi-tenant `{service}-{appSlug}-{env}` fan-out.\n//\n// - `serviceHosts[serviceKey]` authored → `<host>.<publicDomain>`\n// (`app` → `app.example.com`), or `<publicDomain>` when the authored value\n// is the empty string (apex — `''` → `example.com`).\n// - key NOT authored → `<serviceKey>.<publicDomain>`: the service key IS its\n// own subdomain, the same convention platform services use via\n// {@link buildK8sPublicUrl}. A DEFINED fallback (never a silent error — the\n// `serviceHosts` schema requires consumers handle \"not mapped\" explicitly).\n\nexport interface ServicePublicHostParams {\n /** The application service key (`config.services.<key>` / `serviceHosts` key). */\n serviceKey: string;\n /** Authored per-service subdomain map from `wildo.infra.<env>.config.ts`. */\n serviceHosts: Record<string, string> | undefined;\n /** The operator's public domain (`WildoInfraEnvConfig.publicDomain`). */\n publicDomain: string;\n}\n\n/**\n * Resolve an application service's PUBLIC hostname (no scheme). `serviceHosts`\n * wins; the service key is its own subdomain when unauthored; `''` = apex.\n * See the section header.\n */\nexport function buildServicePublicHost(params: ServicePublicHostParams): string {\n const { serviceKey, serviceHosts, publicDomain } = params;\n // Fallback uses the service key AS the subdomain, lowercased: DNS labels are\n // case-insensitive and Let's Encrypt / `new URL()` canonicalize to lowercase,\n // so a camelCase key like `backendApi` must become `backendapi` to round-trip\n // (and to match the ingress host). Authored serviceHosts values are already\n // lowercase-validated upstream (`SERVICE_HOST_LABEL`). NOTE: a config key with\n // a DNS-invalid char (e.g. `_`) still yields an invalid host — the operator\n // must author a `serviceHosts` entry for it.\n const host = serviceHosts?.[serviceKey] ?? serviceKey.toLowerCase();\n return host === '' ? publicDomain : `${host}.${publicDomain}`;\n}\n\n/**\n * Resolve an application service's PUBLIC URL (`https://<host>`), where the\n * host comes from {@link buildServicePublicHost}.\n */\nexport function buildServicePublicUrl(params: ServicePublicHostParams): string {\n return `https://${buildServicePublicHost(params)}`;\n}\n\n/**\n * K8s Secret name for a platform service: `<service>-secret`\n */\nexport function k8sServiceSecretName(service: string): string {\n return `${service}-secret`;\n}\n\n/**\n * K8s ConfigMap name for a platform service: `<service>-config`\n */\nexport function k8sServiceConfigMapName(service: string): string {\n return `${service}-config`;\n}\n\n/**\n * K8s Secret name for an app backend: `<serviceName>-secret`\n *\n * The emitted name MUST match the `envFrom: secretRef.name` the application\n * deployment template mounts. The CLI static emit lane\n * (`k8s-secrets-generator.service.ts` § 5) calls this helper with the app's\n * backend `serviceName`.\n *\n * The name-mismatch gap this JSDoc used to warn about is CLOSED (#377): the templates no longer\n * spell a Secret name at all — each receives the resolved `{{runtimeEnvSecretName}}` from\n * {@link k8sRuntimeEnvSecretName}, which is the same function the emit side calls. The mount stays\n * fail-closed (no `optional: true`), so were the two ever to diverge again the pod would refuse to\n * boot rather than start without its environment.\n *\n * ⚠️ Still true: the K8s app lane has never had a live cluster run. What is verified is that emit\n * and mount agree, pinned from both sides.\n *\n * Application backends emit a single Secret per app (no companion ConfigMap):\n * envFrom mounts every entry as `process.env.*`, so splitting sensitive vs\n * non-sensitive added zero runtime value and fragmented the canonical sink.\n * See `k8s-secrets-generator.service.ts` § 5 for the design note.\n */\nexport function k8sAppBackendSecretName(serviceName: string): string {\n return k8sRuntimeEnvSecretName(serviceName);\n}\n\n/**\n * K8s Secret name carrying ONE runtime's ENVIRONMENT: `<runtimeServiceName>-secret`.\n *\n * The companion of {@link k8sRuntimeProvidersSecretName} — that one carries a runtime's provider\n * CREDENTIALS, this one everything else it boots with. Same keying: the app slug for the backend\n * pod, {@link buildMinionServiceName} / {@link buildWorkerServiceName} for a minion or worker.\n *\n * ## Why minions and workers stopped sharing the backend's (issue #377)\n *\n * Every minion and worker pod used to `envFrom`-mount the BACKEND's `{appSlug}-secret`, so each\n * received the backend's whole environment: the platform bootstrap contract, MongoDB / PostgreSQL /\n * Redis / RabbitMQ topology, storage configuration — and, once #360 composed it, the backend's\n * `OTEL_EXPORTER_OTLP_HEADERS`, which carries the telemetry provider's token. So the per-runtime\n * confinement that #329, #360 and #369 established was defeated one level up: a minion scoped to\n * `openai` alone got no telemetry token in its own provider Secret and received it anyway, from a\n * different runtime's environment.\n *\n * `buildApplicationMinionEnv` and `buildApplicationWorkerEnv` already existed, already took a\n * `RuntimeProviderScope`, and already produced the correctly-scoped environment for the compose\n * lane. The Kubernetes lane simply never called them.\n *\n * ## Every mount name is now resolved here, including the backend's\n *\n * `k8sAppBackendSecretName` delegates rather than repeating `${x}-secret`, so there is ONE format\n * string for this concept. The templates receive the resolved name as `{{runtimeEnvSecretName}}`\n * and no longer compose `{{appName}}-secret` themselves — which is what the older JSDoc on\n * `k8sAppBackendSecretName` warned about, from the era when a template hardcoded a name the emit\n * never produced and the pod failed closed at boot.\n *\n * Unlike the provider Secret, this mount is NOT `optional`: a runtime cannot boot without its\n * environment, and a missing one must fail loudly rather than start a pod that cannot work.\n */\nexport function k8sRuntimeEnvSecretName(runtimeServiceName: string): string {\n return `${runtimeServiceName}-secret`;\n}\n\n/**\n * K8s Secret name carrying ONE runtime's provider credentials:\n * `<runtimeServiceName>-providers-secret`.\n *\n * `runtimeServiceName` is the runtime's own DNS name — the app slug for the backend pod,\n * {@link buildMinionServiceName} / {@link buildWorkerServiceName} for a minion or worker — so every\n * application runtime gets its own Secret and no two can collide.\n *\n * ## Why this replaced one shared `providers-secret` (issue #369)\n *\n * There used to be a single cluster-wide `providers-secret` holding the application's ENTIRE\n * `providerEnv`, `envFrom`-mounted by the backend, every minion AND every worker. `envFrom` merges,\n * so a provider key the per-app Secret withheld arrived from that second reference: on Kubernetes a\n * worker authoring `providers: {}` received every provider key the application had, in its process\n * environment, which is exactly what LLM-driven minion code reads. The per-runtime confinement\n * (#329) held in the compose lane and did not exist here at all — one contract, two deployment\n * lanes, one swept.\n *\n * **The name is a function, not a format string repeated in a template, and that is the point.**\n * This file already carries a scar from the other direction: `k8sAppBackendSecretName` documents a\n * mount whose name the template hardcodes, and a mismatch there means a pod that cannot boot. Here\n * the emit side (`k8s-secrets-generator.service.ts`) and the mount side (the three\n * `*.deployment.yaml.hbs` renderers) both call THIS function, and the templates receive the\n * resolved name as `{{providersSecretName}}` rather than composing it themselves.\n *\n * The mount stays `optional: true`: a runtime that declares no providers gets no Secret emitted,\n * which is the correct outcome and must not fail pod start.\n */\nexport function k8sRuntimeProvidersSecretName(runtimeServiceName: string): string {\n return `${runtimeServiceName}-providers-secret`;\n}\n"]}
1
+ {"version":3,"file":"k8s-utils.js","sourceRoot":"","sources":["../../../../src/project-config/shared/k8s-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,IAAY,EAAE,SAAiB;IAClF,OAAO,UAAU,OAAO,IAAI,SAAS,sBAAsB,IAAI,EAAE,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,SAAiB;IACrE,OAAO,GAAG,OAAO,IAAI,SAAS,oBAAoB,CAAC;AACrD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,YAAoB;IACrE,OAAO,WAAW,OAAO,IAAI,YAAY,EAAE,CAAC;AAC9C,CAAC;AAgCD;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAA+B;IACpE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAC1D,6EAA6E;IAC7E,8EAA8E;IAC9E,8EAA8E;IAC9E,4EAA4E;IAC5E,+EAA+E;IAC/E,4EAA4E;IAC5E,6CAA6C;IAC7C,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC;IACpE,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,YAAY,EAAE,CAAC;AAChE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA+B;IACnE,OAAO,WAAW,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,OAAO,GAAG,OAAO,SAAS,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,OAAO,GAAG,OAAO,SAAS,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAmB;IACzD,OAAO,uBAAuB,CAAC,WAAW,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,uBAAuB,CAAC,kBAA0B;IAChE,OAAO,GAAG,kBAAkB,SAAS,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,6BAA6B,CAAC,kBAA0B;IACtE,OAAO,GAAG,kBAAkB,mBAAmB,CAAC;AAClD,CAAC","sourcesContent":["/**\n * Kubernetes URL builders and naming conventions.\n * Single source of truth for constructing K8s-style addresses and resource names.\n *\n * Used by CLI (ServiceAddressResolver, K8s manifest gen) and apps-manager\n * (application lifecycle) to ensure consistent URL/naming patterns.\n */\n\n/**\n * Builds a K8s cluster-internal URL: `http://<service>.<namespace>.svc.cluster.local:<port>`\n */\nexport function buildK8sInternalUrl(service: string, port: number, namespace: string): string {\n return `http://${service}.${namespace}.svc.cluster.local:${port}`;\n}\n\n/**\n * Builds a K8s cluster-internal hostname (without scheme/port).\n */\nexport function buildK8sInternalHost(service: string, namespace: string): string {\n return `${service}.${namespace}.svc.cluster.local`;\n}\n\n/**\n * Builds an ingress-based public URL: `https://<service>.<publicDomain>`\n *\n * `publicDomain` is the runtime-agnostic external hostname (browsers /\n * reverse proxy / DNS terminate here). See `WildoInfraEnvConfig.publicDomain`.\n *\n * Used for PLATFORM services (apps-manager, module-registry, …) whose\n * subdomain is always the service name. Application services (frontends +\n * backend API) resolve their public host through {@link buildServicePublicHost}\n * so the operator's authored `serviceHosts` map wins.\n */\nexport function buildK8sPublicUrl(service: string, publicDomain: string): string {\n return `https://${service}.${publicDomain}`;\n}\n\n// ============================================================================\n// Application public-host resolution (serviceHosts-driven)\n// ============================================================================\n//\n// Single source of truth for an application service's PUBLIC hostname, shared\n// by every producer so ingress routing, `runtime.endPoints[*].publicUrl`, and\n// CORS never diverge (a divergence breaks the browser's next `fetch` on CORS —\n// see `.claude/plans/self-host-domain-subdomain-model.md`).\n//\n// The self-hosted, single-app, mono-env model: each service lives at a\n// subdomain of the operator's own `publicDomain`. Greenfield — there is NO\n// multi-tenant `{service}-{appSlug}-{env}` fan-out.\n//\n// - `serviceHosts[serviceKey]` authored → `<host>.<publicDomain>`\n// (`app` → `app.example.com`), or `<publicDomain>` when the authored value\n// is the empty string (apex — `''` → `example.com`).\n// - key NOT authored → `<serviceKey>.<publicDomain>`: the service key IS its\n// own subdomain, the same convention platform services use via\n// {@link buildK8sPublicUrl}. A DEFINED fallback (never a silent error — the\n// `serviceHosts` schema requires consumers handle \"not mapped\" explicitly).\n\nexport interface ServicePublicHostParams {\n /** The application service key (`config.services.<key>` / `serviceHosts` key). */\n serviceKey: string;\n /** Authored per-service subdomain map from `wildo.infra.<env>.config.ts`. */\n serviceHosts: Record<string, string> | undefined;\n /** The operator's public domain (`WildoInfraEnvConfig.publicDomain`). */\n publicDomain: string;\n}\n\n/**\n * Resolve an application service's PUBLIC hostname (no scheme). `serviceHosts`\n * wins; the service key is its own subdomain when unauthored; `''` = apex.\n * See the section header.\n */\nexport function buildServicePublicHost(params: ServicePublicHostParams): string {\n const { serviceKey, serviceHosts, publicDomain } = params;\n // Fallback uses the service key AS the subdomain, lowercased: DNS labels are\n // case-insensitive and Let's Encrypt / `new URL()` canonicalize to lowercase,\n // so a camelCase key like `backendApi` must become `backendapi` to round-trip\n // (and to match the ingress host). Authored serviceHosts values are already\n // lowercase-validated upstream (`SERVICE_HOST_LABEL`). NOTE: a config key with\n // a DNS-invalid char (e.g. `_`) still yields an invalid host — the operator\n // must author a `serviceHosts` entry for it.\n const host = serviceHosts?.[serviceKey] ?? serviceKey.toLowerCase();\n return host === '' ? publicDomain : `${host}.${publicDomain}`;\n}\n\n/**\n * Resolve an application service's PUBLIC URL (`https://<host>`), where the\n * host comes from {@link buildServicePublicHost}.\n */\nexport function buildServicePublicUrl(params: ServicePublicHostParams): string {\n return `https://${buildServicePublicHost(params)}`;\n}\n\n/**\n * K8s Secret name for a platform service: `<service>-secret`\n */\nexport function k8sServiceSecretName(service: string): string {\n return `${service}-secret`;\n}\n\n/**\n * K8s ConfigMap name for a platform service: `<service>-config`\n */\nexport function k8sServiceConfigMapName(service: string): string {\n return `${service}-config`;\n}\n\n/**\n * K8s Secret name for an app backend: `<serviceName>-secret`\n *\n * The emitted name MUST match the `envFrom: secretRef.name` the application\n * deployment template mounts. The CLI static emit lane\n * (`k8s-secrets-generator.service.ts` § 5) calls this helper with the app's\n * backend `serviceName`.\n *\n * The name-mismatch gap this JSDoc used to warn about is CLOSED (#377): the templates no longer\n * spell a Secret name at all — each receives the resolved `{{runtimeEnvSecretName}}` from\n * {@link k8sRuntimeEnvSecretName}, which is the same function the emit side calls. The mount stays\n * fail-closed (no `optional: true`), so were the two ever to diverge again the pod would refuse to\n * boot rather than start without its environment.\n *\n * ⚠️ Still true: the K8s app lane has never had a live cluster run. What is verified is that emit\n * and mount agree, pinned from both sides.\n *\n * Application backends emit a single Secret per app (no companion ConfigMap):\n * envFrom mounts every entry as `process.env.*`, so splitting sensitive vs\n * non-sensitive added zero runtime value and fragmented the canonical sink.\n * See `k8s-secrets-generator.service.ts` § 5 for the design note.\n */\nexport function k8sAppBackendSecretName(serviceName: string): string {\n return k8sRuntimeEnvSecretName(serviceName);\n}\n\n/**\n * K8s Secret name carrying ONE runtime's ENVIRONMENT: `<runtimeServiceName>-secret`.\n *\n * The companion of {@link k8sRuntimeProvidersSecretName} — that one carries a runtime's provider\n * CREDENTIALS, this one everything else it boots with. Same keying: the app slug for the backend\n * pod, {@link buildMinionServiceName} / {@link buildWorkerServiceName} for a minion or worker.\n *\n * ## Why minions and workers stopped sharing the backend's (issue #377)\n *\n * Every minion and worker pod used to `envFrom`-mount the BACKEND's `{appSlug}-secret`, so each\n * received the backend's whole environment: the platform bootstrap contract, MongoDB / PostgreSQL /\n * Redis / RabbitMQ topology, storage configuration — and, once #360 composed it, the backend's\n * `OTEL_EXPORTER_OTLP_HEADERS`, which carries the telemetry provider's token. So the per-runtime\n * confinement that #329, #360 and #369 established was defeated one level up: a minion scoped to\n * `openai` alone got no telemetry token in its own provider Secret and received it anyway, from a\n * different runtime's environment.\n *\n * `buildApplicationMinionEnv` and `buildApplicationWorkerEnv` already existed, already took a\n * `RuntimeProviderScope`, and already produced the correctly-scoped environment for the compose\n * lane. The Kubernetes lane simply never called them.\n *\n * ## Every mount name is now resolved here, including the backend's\n *\n * `k8sAppBackendSecretName` delegates rather than repeating `${x}-secret`, so there is ONE format\n * string for this concept. The templates receive the resolved name as `{{runtimeEnvSecretName}}`\n * and no longer compose `{{appName}}-secret` themselves — which is what the older JSDoc on\n * `k8sAppBackendSecretName` warned about, from the era when a template hardcoded a name the emit\n * never produced and the pod failed closed at boot.\n *\n * Unlike the provider Secret, this mount is NOT `optional`: a runtime cannot boot without its\n * environment, and a missing one must fail loudly rather than start a pod that cannot work.\n */\nexport function k8sRuntimeEnvSecretName(runtimeServiceName: string): string {\n return `${runtimeServiceName}-secret`;\n}\n\n/**\n * K8s Secret name carrying ONE runtime's provider credentials:\n * `<runtimeServiceName>-providers-secret`.\n *\n * `runtimeServiceName` is the runtime's own DNS name — the app slug for the backend pod,\n * {@link buildMinionServiceName} / {@link buildWorkerServiceName} for a minion or worker — so every\n * application runtime gets its own Secret and no two can collide.\n *\n * ## Why this replaced one shared `providers-secret` (issue #369)\n *\n * There used to be a single cluster-wide `providers-secret` holding the application's ENTIRE\n * `providerEnv`, `envFrom`-mounted by the backend, every minion AND every worker. `envFrom` merges,\n * so a provider key the per-app Secret withheld arrived from that second reference: on Kubernetes a\n * worker authoring `providers: {}` received every provider key the application had, in its process\n * environment, which is exactly what LLM-driven minion code reads. The per-runtime confinement\n * (#329) held in the compose lane and did not exist here at all — one contract, two deployment\n * lanes, one swept.\n *\n * **The name is a function, not a format string repeated in a template, and that is the point.**\n * This file already carries a scar from the other direction: `k8sAppBackendSecretName` documents a\n * mount whose name the template hardcodes, and a mismatch there means a pod that cannot boot. Here\n * the emit side (`k8s-secrets-generator.service.ts`) and the mount side (the three\n * `*.deployment.yaml.hbs` renderers) both call THIS function, and the templates receive the\n * resolved name as `{{providersSecretName}}` rather than composing it themselves.\n *\n * The mount stays `optional: true`: a runtime that declares no providers gets no Secret emitted,\n * which is the correct outcome and must not fail pod start.\n */\nexport function k8sRuntimeProvidersSecretName(runtimeServiceName: string): string {\n return `${runtimeServiceName}-providers-secret`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"minion-platform-access.vocabulary.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/minion-platform-access.vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,oBAAY,yBAAyB;IACnC;;;;OAIG;IACH,gBAAgB,qBAAqB;CACtC"}
1
+ {"version":3,"file":"minion-platform-access.vocabulary.d.ts","sourceRoot":"","sources":["../../../../src/project-config/shared/minion-platform-access.vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,oBAAY,yBAAyB;IACnC;;;;OAIG;IACH,gBAAgB,qBAAqB;CACtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"minion-platform-access.vocabulary.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/minion-platform-access.vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,CAAN,IAAY,yBAOX;AAPD,WAAY,yBAAyB;IACnC;;;;OAIG;IACH,kEAAqC,CAAA;AACvC,CAAC,EAPW,yBAAyB,KAAzB,yBAAyB,QAOpC","sourcesContent":["/**\n * The PLATFORM-ACCESS vocabulary a minion declaration is authored with (R4 / R5).\n *\n * ## Why it lives under `project-config` and not beside its derivation\n *\n * The split is by AUDIENCE: the vocabulary an app author writes lives with the\n * other authoring vocabularies; {@link buildOwnCronRecordFilter} and the\n * declaration type stay in `bootstrap/`, because a runtime derivation is not\n * something an authored config should be reaching for.\n *\n * It first moved here for a worse reason, kept as history because the defect\n * shape recurred. Until 2026-09-09 the config loader resolved\n * `@wildo-ai/platform-config-lib` to a `config-authoring.entry.ts` that exported\n * `./project-config` and `./workspace-scope` and nothing else, so an app config\n * importing this enum from `bootstrap/` beside `AppFrontendType` — same package,\n * same statement — got `AppFrontendType` and `undefined` for this one, and\n * `wildo config sync` died on `reading 'OWN_CRON_RECORDS'`. Moving the enum cured\n * that name; the next symbol the engine composed at module load from the same\n * package hit the same wall. The entry now re-exports the whole root (see its\n * header), so placement under `project-config` is a statement about who authors\n * the value, no longer about what the loader can see.\n */\n\nexport enum MinionPlatformAccessScope {\n /**\n * The minion's OWN cron/schedule records. There is deliberately no\n * `ALL_CRON_RECORDS` member: a scope that could name another minion is a scope\n * somebody will eventually grant.\n */\n OWN_CRON_RECORDS = 'own_cron_records',\n}\n"]}
1
+ {"version":3,"file":"minion-platform-access.vocabulary.js","sourceRoot":"","sources":["../../../../src/project-config/shared/minion-platform-access.vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,CAAN,IAAY,yBAOX;AAPD,WAAY,yBAAyB;IACnC;;;;OAIG;IACH,kEAAqC,CAAA;AACvC,CAAC,EAPW,yBAAyB,KAAzB,yBAAyB,QAOpC","sourcesContent":["/**\n * The PLATFORM-ACCESS vocabulary a minion declaration is authored with (R4 / R5).\n *\n * ## Why it lives under `project-config` and not beside its derivation\n *\n * The split is by AUDIENCE: the vocabulary an app author writes lives with the\n * other authoring vocabularies; {@link buildOwnCronRecordFilter} and the\n * declaration type stay in `bootstrap/`, because a runtime derivation is not\n * something an authored config should be reaching for.\n *\n * It first moved here for a worse reason, kept as history because the defect\n * shape recurred. Until 2026-09-09 the config loader resolved\n * `@wildo-ai/platform-config-lib` to a `config-authoring.entry.ts` that exported\n * `./project-config` and `./workspace-scope` and nothing else, so an app config\n * importing this enum from `bootstrap/` beside `AppFrontendType` — same package,\n * same statement — got `AppFrontendType` and `undefined` for this one, and\n * `wildo config sync` died on `reading 'OWN_CRON_RECORDS'`. Moving the enum cured\n * that name; the next symbol the engine composed at module load from the same\n * package hit the same wall. The entry now re-exports the whole root (see its\n * header), so placement under `project-config` is a statement about who authors\n * the value, no longer about what the loader can see.\n */\n\nexport enum MinionPlatformAccessScope {\n /**\n * The minion's OWN cron/schedule records. There is deliberately no\n * `ALL_CRON_RECORDS` member: a scope that could name another minion is a scope\n * somebody will eventually grant.\n */\n OWN_CRON_RECORDS = 'own_cron_records',\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"minion-resource-access.validation.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/minion-resource-access.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iCAAiC,EAEjC,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,4CAA4C,EAAE,SAAS,MAAM,EACb,CAAC;AAE9D,8EAA8E;AAC9E,MAAM,WAAW,6BAA6B;IAC5C,mGAAmG;IACnG,QAAQ,CAAC,IAAI,EAAE,iCAAiC,CAAC,IAAI,GAAG,iCAAiC,CAAC,KAAK,CAAC;IAChG,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;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;;;;;;;;GAiBG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,oBAAoB,GAAG,oBAAoB,CA4B7F"}
1
+ {"version":3,"file":"minion-resource-access.validation.d.ts","sourceRoot":"","sources":["../../../../src/project-config/shared/minion-resource-access.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iCAAiC,EAEjC,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,4CAA4C,EAAE,SAAS,MAAM,EACb,CAAC;AAE9D,8EAA8E;AAC9E,MAAM,WAAW,6BAA6B;IAC5C,mGAAmG;IACnG,QAAQ,CAAC,IAAI,EAAE,iCAAiC,CAAC,IAAI,GAAG,iCAAiC,CAAC,KAAK,CAAC;IAChG,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kCAAkC,CAAC,cAAc,EAAE;IACjE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACrC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CACvC,GAAG,6BAA6B,EAAE,CAyElC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE;IAAE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;CAAE,GAAG,SAAS,EAC3G,2BAA2B,GAAE,SAAS,MAAM,EAAO,GAClD,oBAAoB,GAAG,IAAI,CAuB7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,EAAE,CAEzF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,2CAA2C,EAAE,SAAS,YAAY,EAC8D,CAAC;AAE9I,gFAAgF;AAChF,eAAO,MAAM,6CAA6C,EAAE,SAAS,YAAY,EAC0B,CAAC;AAE5G,0FAA0F;AAC1F,eAAO,MAAM,+CAA+C,EAAE,SAAS,YAAY,EACV,CAAC;AAE1E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,IAAI,IAAI,iCAAiC,GAAG,SAAS,YAAY,EAAE;CAC9E,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,oBAAoB,GAAG,oBAAoB,CA4B7F"}
@@ -1 +1 @@
1
- {"version":3,"file":"minion-resource-access.validation.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/minion-resource-access.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,8CAA8C,EAC9C,iCAAiC,EACjC,sCAAsC,GAEvC,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,MAAM,4CAA4C,GACvD,MAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;AAW9D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kCAAkC,CAAC,cAGlD;IACC,MAAM,UAAU,GAAoC,EAAE,CAAC;IACvD,MAAM,IAAI,G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,EAAE,CAAC;IAErC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,KAAK,CAAC,CAAC;IAEpD,mGAAmG;IACnG,kGAAkG;IAClG,oGAAoG;IACpG,kCAAkC;IAClC,MAAM,kBAAkB,GAAG,6CAA6C,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;IACnI,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,mGAAmG;cACjG,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,gEAAgE,CACnG,CAAC;IACJ,CAAC;IAED,OAAO;QACL,CAAC,iCAAiC,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,GAAG,2CAA2C,CAAC,CAAC;QACrH,CAAC,iCAAiC,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;QAClE,CAAC,iCAAiC,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,6CAA6C,CAAC;QACpG,kGAAkG;QAClG,sFAAsF;QACtF,CAAC,iCAAiC,CAAC,QAAQ,CAAC,EAAE,SAAS,CACrD,+CAA+C,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAC3G;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {\n CoreResourceType,\n RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES,\n RuntimePrincipalDatabaseGrantAxis,\n resolveSharedPersistenceCollectionName,\n type ResourceType,\n} from '@wildo-ai/saas-models';\n\n/**\n * The two safety gates that must hold BEFORE a minion's `resourceAccess` may be\n * turned into database grants (Step 3 shared prerequisites, R11 + the F1 guard).\n *\n * Both exist because of the same asymmetry: `resourceAccess` is a RESOURCE-TYPE\n * whitelist, while a database grant is a COLLECTION grant. The two only line up\n * when the mapping between them is injective over the declarable set — and the\n * alias map is exactly where it is not.\n */\n\n/**\n * Resource types a minion may never declare (D15 / R11) — every ALIASED door.\n *\n * An aliased door is a resource type whose rows live in ANOTHER resource type's\n * collection (`RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES`). It is always the\n * NARROWER of the two doors, and a database grant cannot be narrower than a\n * collection — so a grant derived from the narrow door carries the wide one.\n *\n * The alias map holds two KINDS of narrow door, and both are refused for that\n * same reason while differing in why they are narrow:\n *\n * - **self doors** (`USER_SELF`, `USER_SELF_PROFILES`, `USER_SELF_PREFERENCES`)\n * address \"MY row\". They are additionally meaningless for a minion:\n * `APPLICATION_MACHINE` carries no `userId`, so there is no row to be \"mine\".\n * Declaring `USER_SELF` would grant the whole `users` collection — every user's\n * row, through a door that promises one.\n * - **subset doors** (`APPLICATION_AUDIT_LOGS`, #317) see a different SUBSET of a\n * shared record set. The application audit door and the organization audit door\n * read one trail; a grant derived from either carries the entire trail.\n *\n * This constant was named `MINION_FORBIDDEN_SELF_DOOR_RESOURCE_TYPES` while the\n * map held only self doors, and kept that name — and a refusal message calling\n * every entry a self door — after the audit door joined it (#458). The rule was\n * never \"self doors are forbidden\"; it is \"a grant must not be wider than the\n * declaration reads\", and the name now says that.\n *\n * Removing every aliased door from the declarable set is also what makes\n * resource-type → collection INJECTIVE, so a grant derived per resource type means\n * exactly what the author wrote. Relaxing it for convenience silently restores\n * the coarser floor.\n *\n * Derived from the alias map rather than listed, so an alias added there is\n * forbidden here on the same commit instead of quietly becoming declarable — and\n * the pin in `minion-resource-access.validation.test.ts` forces that addition to\n * be reviewed rather than absorbed.\n */\nexport const MINION_FORBIDDEN_ALIASED_DOOR_RESOURCE_TYPES: readonly string[] =\n Object.keys(RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES);\n\n/** One reason a `resourceAccess` declaration cannot be turned into grants. */\nexport interface MinionResourceAccessViolation {\n /** The AUTHORED axis the offending entry was declared on — `resourceAccess` has only these two. */\n readonly axis: RuntimePrincipalDatabaseGrantAxis.READ | RuntimePrincipalDatabaseGrantAxis.WRITE;\n readonly resourceType: string;\n /** Operator-facing explanation naming the consequence and the fix. */\n readonly message: string;\n}\n\n/**\n * Reject aliased-door types, and refuse any declaration whose types collapse onto\n * one collection.\n *\n * Returns every violation rather than throwing on the first: an author fixing a\n * config wants the whole list, and a caller that wants to fail closed can do so\n * on a non-empty result.\n *\n * ## The injectivity check is NOT redundant with the aliased-door rejection\n *\n * It is tempting to think removing the aliased doors makes collisions impossible —\n * that is true of TODAY's alias map and is exactly why this must be checked\n * rather than assumed. The alias map is data: a future entry that aliases two\n * types a minion MAY declare onto one collection would reintroduce the collapse,\n * and the grant derived for one type would silently carry the other's rows.\n * Failing closed here makes that a build failure instead of a containment that\n * quietly widened.\n */\nexport function findMinionResourceAccessViolations(resourceAccess: {\n read?: readonly string[] | undefined;\n write?: readonly string[] | undefined;\n}): MinionResourceAccessViolation[] {\n const violations: MinionResourceAccessViolation[] = [];\n const axes: Array<[MinionResourceAccessViolation['axis'], readonly string[]]> = [\n [RuntimePrincipalDatabaseGrantAxis.READ, resourceAccess.read ?? []],\n [RuntimePrincipalDatabaseGrantAxis.WRITE, resourceAccess.write ?? []],\n ];\n\n // An APPEND-ONLY floor entry may not be widened to WRITE by declaration. Refused here, at parse\n // time, rather than honoured downstream: the write axis carries DELETE, so `write: ['auditLogs']`\n // is not a broader version of the audit floor — it is the one grant that lets a principal remove\n // the evidence of what it did. This used to be permitted as \"an explicit, reviewed decision\", and\n // the grant derivation kept the declared axis; but a declaration nobody is forced to justify is not\n // a review, and the property the append axis exists for held only until somebody typed one word.\n // Derived from the floor itself, so a type added to the append floor tomorrow is refused on write\n // on the same commit.\n for (const resourceType of resourceAccess.write ?? []) {\n if ((MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES as readonly string[]).includes(resourceType)) {\n violations.push({\n axis: RuntimePrincipalDatabaseGrantAxis.WRITE,\n resourceType,\n message:\n `'${resourceType}' cannot be declared on a minion's write axis: the engine already grants it APPEND-only `\n + '(insert, never update or delete), and a write grant would let this minion modify or remove rows it '\n + 'appended — for the audit trail, the evidence of its own actions. Remove it from `write`; appending '\n + 'needs no declaration.',\n });\n }\n }\n\n for (const [axis, declared] of axes) {\n for (const resourceType of declared) {\n if (MINION_FORBIDDEN_ALIASED_DOOR_RESOURCE_TYPES.includes(resourceType)) {\n // The message names only what is true of EVERY aliased door: the collection\n // it shares and the wider type that owns it. An earlier message called each\n // entry a \"SELF door … every user's row\", which was false for the audit door.\n const widerResourceType = RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES[resourceType]!;\n const collection = resolveSharedPersistenceCollectionName(resourceType as ResourceType);\n violations.push({\n axis,\n resourceType,\n message:\n `'${resourceType}' is an ALIASED door and cannot be granted to a minion (D15): its rows live in the `\n + `'${collection}' collection it shares with '${widerResourceType}'. A database grant is issued per `\n + `collection, so granting '${resourceType}' would reach every row '${widerResourceType}' addresses — `\n + `wider than the door '${resourceType}' promises. Declare '${widerResourceType}' explicitly if the `\n + 'minion genuinely needs that breadth.',\n });\n }\n }\n\n // Injectivity, per AXIS: two declared types resolving to one collection make\n // the derived grant wider than either declaration reads.\n const collectionOwners = new Map<string, string>();\n for (const resourceType of declared) {\n const collection = resolveSharedPersistenceCollectionName(resourceType as ResourceType);\n const existing = collectionOwners.get(collection);\n if (existing !== undefined && existing !== resourceType) {\n violations.push({\n axis,\n resourceType,\n message:\n `'${resourceType}' and '${existing}' both resolve to the '${collection}' collection, `\n + 'so a grant derived from either carries the other\\'s rows. Refusing to derive grants '\n + 'from a declaration whose types are not injective over collections (F1 guard) — '\n + 'declare exactly one of them.',\n });\n continue;\n }\n collectionOwners.set(collection, resourceType);\n }\n }\n\n return violations;\n}\n\n/**\n * What a minion may touch, per axis — expressed in RESOURCE TYPES, the\n * vocabulary the rest of the platform speaks.\n *\n * ## Why not collection names\n *\n * An earlier revision returned collection names, which quietly made storage the\n * API of a security decision. `resourceAccess` is AUTHORED in resource types,\n * `ResourceType` is what every other Wildo surface passes around, and a\n * collection is one adapter's rendering of where those rows happen to live —\n * MongoDB calls it a collection, PostgreSQL a table, and a future adapter will\n * call it something else again. Naming the security contract after one of them\n * would force every reader to translate back, and would make the grant set look\n * different depending on which database an application chose.\n *\n * The translation therefore happens at the ADAPTER boundary — see\n * {@link resolveGrantStorageNames} — which is the only place that legitimately\n * knows about storage, exactly as external protocol literals are confined to the\n * thin adapter that speaks them.\n *\n * `null` means **no access was declared at all**, which is NOT the same as an\n * empty declaration and must not be flattened into one. Absent ⇒ no authored business-data access. The database credential owner\n * separately supplies the mandatory runtime floor; object storage must not receive\n * that floor. Declared-but-empty remains an explicit author decision. One \"empty list\" for both would\n * make \"I forgot\" indistinguishable from \"I meant none\".\n */\nexport interface MinionResourceGrants {\n readonly read: readonly ResourceType[];\n readonly write: readonly ResourceType[];\n}\n\n/**\n * Derive a minion's grants from an authored `resourceAccess`.\n *\n * ## `write` does NOT imply `read`, deliberately\n *\n * It is tempting to add read wherever write is granted — most write paths in the\n * backend pipeline do read first (validation, FK resolution, read-modify-write),\n * so a `write: ['todos']` minion will often need `read: ['todos']` too.\n *\n * It is still refused, for the reason this entire workstream exists: a grant the\n * author did not write is a grant nobody reviewed. An insert-only minion is a\n * real shape, and silently widening every writer to a reader would make the\n * declaration stop describing the outcome — the precise property that made\n * `resourceAccess` non-binding before it produced real credentials.\n *\n * The cost is stated rather than hidden: a minion that writes without declaring\n * read will fail at RUNTIME on its first read, with the database naming the\n * action it lacked. A loud, local failure with an obvious fix (declare the read)\n * is the trade this prefers over a silent widening.\n *\n * ## The F2 transitive read path is the CALLER's to supply\n *\n * A declared type can pull in others through nested reads — the closure rule is\n * *declared ∪ child-direction targets declaring nested `onRead`, transitively*.\n * Computing it needs the resource graph, which this layer does not have, so it\n * arrives as `transitiveReadResourceTypes`. Omitting it is correct ONLY when the\n * application declares no nested `onRead` (true of Wonder Todos, measured\n * 2026-08-05); omitting it elsewhere yields a credential that is denied on a\n * path which works today.\n */\nexport function deriveMinionResourceGrants(\n resourceAccess: { read?: readonly string[] | undefined; write?: readonly string[] | undefined } | undefined,\n transitiveReadResourceTypes: readonly string[] = [],\n): MinionResourceGrants | null {\n if (!resourceAccess) return null;\n\n const violations = findMinionResourceAccessViolations(resourceAccess);\n if (violations.length > 0) {\n // Fail closed. Reaching here means the parse-time gate was bypassed (a\n // hand-built object, a future caller); deriving anyway would issue exactly\n // the over-broad grant those gates exist to refuse.\n throw new Error(\n `Refusing to derive minion resource grants from an invalid resourceAccess: `\n + violations.map((violation) => `[${violation.axis}] ${violation.message}`).join(' '),\n );\n }\n\n // Deduped and ordered so a grant set is stable between syncs — an unstable\n // one reads as a change and would re-issue credentials for nothing.\n const normalize = (resourceTypes: readonly string[]): ResourceType[] =>\n [...new Set(resourceTypes)].sort() as ResourceType[];\n\n return {\n read: normalize([...(resourceAccess.read ?? []), ...transitiveReadResourceTypes]),\n write: normalize(resourceAccess.write ?? []),\n };\n}\n\n/**\n * Translate a grant axis into the STORAGE names one adapter will grant on.\n *\n * The single, explicitly-named boundary between the platform vocabulary and a\n * database dialect. A Mongo module builds collection privileges from it; a\n * PostgreSQL module builds table grants; both call the same function so the two\n * cannot disagree about which rows a resource type addresses.\n *\n * Safe to collapse duplicates here ONLY because the F1 guard already refused any\n * declaration whose types share a collection — see\n * {@link findMinionResourceAccessViolations}. Without that guarantee this\n * function would silently merge two declarations into one grant.\n */\nexport function resolveGrantStorageNames(resourceTypes: readonly ResourceType[]): string[] {\n return [...new Set(resourceTypes.map((resourceType) => resolveSharedPersistenceCollectionName(resourceType)))].sort();\n}\n\n/**\n * What the ENGINE reads and writes for every runtime principal, whatever that\n * principal declared — the floor a database role must hold before any authored\n * `resourceAccess` is considered at all.\n *\n * ## Why this is not declarable, and must not become so\n *\n * `resourceAccess` answers \"what application data may this minion touch\". These\n * entries answer a different question: \"what does the framework itself touch\n * in order to run a repository operation at all\". No author decides them, no\n * author can opt out of them, and asking one to write them down would be asking\n * a human for an answer the mechanism already knows — the exact shape\n * `.claude/rules/derive-before-you-ask.md` refuses. They are derived here, once,\n * from the engine paths that actually perform them:\n *\n * - **`APPLICATION`, read.** `ExecutionContextCreatorBackendService.getApplicationId`\n * resolves the singleton APPLICATION row for EVERY `ResourcePrimaryScope.APPLICATION`\n * operation, through `repositoriesRegistry` directly. That read is structural:\n * a minion declaring `read: ['todos']` is declaring an APPLICATION-scoped read,\n * so it triggers this one before it ever reaches `todos`.\n * - **`AUDIT_LOGS`, append.** `AuditLogsBackendService` writes one row per audited\n * operation, including the `system_context_read` it emits for the read above.\n * - **`JOB_EXECUTIONS`, read/maintain.** Scheduled receipt, atomic admission,\n * heartbeat and recovery update durable history, including after a restart.\n * - **`JOB_PAYLOAD_STORAGE`, read/append.** Recovery retains completed output\n * without granting the principal permission to rewrite or delete that output.\n *\n * These framework operations bypass the in-process `resourceAccess` whitelist by construction —\n * `MinionScopedServicesRegistryHandlerBackendService` decorates the minion's\n * SERVICES registry, and these go through the repositories registry — so the\n * database grant was the only gate they ever met, and it refused them. That\n * asymmetry is the defect: the in-process policy already permits these reads,\n * and the credential did not.\n *\n * ## Why AUDIT_LOGS is APPEND and not WRITE\n *\n * The `write` axis grants `INSERT, UPDATE, DELETE`. Putting the audit table there\n * would let every minion rewrite or delete the evidence of its own actions, which\n * is not a smaller version of the right answer — it is the opposite of one. An\n * audit trail a principal can delete is not an audit trail. The append axis exists\n * so this floor can be satisfied without handing out that capability.\n *\n * ## What this does NOT cover\n *\n * Named runtime principals only. The APPLICATION BACKEND is issued a database-owning\n * credential on every adapter (PostgreSQL `ALL PRIVILEGES`, MongoDB `readWrite` +\n * `dbAdmin`, Atlas `readWrite`), so nothing at the database layer stops the backend's\n * own credential from amending an audit row; for the backend, audit immutability is\n * the application layer's — `AUDIT_LOGS` exposes no update or delete operation. And\n * only the SELF-MANAGED adapters issue a per-principal credential at all.\n *\n * assurance-control: WILDO.AUDIT.TAMPER_RESISTANCE — a named runtime principal may add\n * audit rows and may never modify or remove them, and may not be granted otherwise.\n */\nexport const MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES: readonly ResourceType[] =\n [CoreResourceType.APPLICATION, CoreResourceType.JOB_EXECUTIONS, CoreResourceType.JOB_PAYLOAD_STORAGE] as unknown as readonly ResourceType[];\n\n/** @see MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES — the append-only floor. */\nexport const MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES: readonly ResourceType[] =\n [CoreResourceType.AUDIT_LOGS, CoreResourceType.JOB_PAYLOAD_STORAGE] as unknown as readonly ResourceType[];\n\n/** Insert and update durable execution state, without permission to erase its history. */\nexport const MINION_ENGINE_MANDATORY_MAINTAIN_RESOURCE_TYPES: readonly ResourceType[] =\n [CoreResourceType.JOB_EXECUTIONS] as unknown as readonly ResourceType[];\n\n/**\n * A minion's grants as a DATABASE role must hold them: what the author declared,\n * plus the engine floor above — one resource-type list per\n * {@link RuntimePrincipalDatabaseGrantAxis}, whose members document each axis's verbs.\n *\n * Mapped over the axis vocabulary rather than spelled out, so an axis added there is a compile error\n * at every site that builds or consumes one of these until it is handled.\n *\n * Separate append and maintain axes keep the floor honest — see\n * {@link MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES}.\n */\nexport type MinionDatabaseGrants = {\n readonly [Axis in RuntimePrincipalDatabaseGrantAxis]: readonly ResourceType[];\n};\n\n/**\n * Add the engine floor to an authored derivation — the ONE place database grants\n * acquire it.\n *\n * ## Why here and not in {@link deriveMinionResourceGrants}\n *\n * That function answers \"what did the author declare\", and it has a THIRD\n * consumer that must not receive this floor: the object-storage credential path\n * turns the same grants into blob key prefixes. Widening it there would confine a\n * minion's storage credential to an `applications/` prefix nobody asked for and\n * nothing writes. The floor is a property of holding a DATABASE role, so it is\n * applied at the boundary where a database role is minted — and both database\n * adapters call this one function, so they cannot drift apart the way the mint\n * and revoke halves of those adapters already have once\n * (`.claude/rules/invariant-call-site-enumeration.md` #18).\n *\n * Idempotent: a floor entry the author also declared appears once.\n */\nexport function deriveMinionDatabaseGrants(grants: MinionResourceGrants): MinionDatabaseGrants {\n const normalize = (resourceTypes: readonly ResourceType[]): ResourceType[] =>\n [...new Set(resourceTypes)].sort();\n\n const declaredWrite = new Set<string>(grants.write);\n\n // Fail closed on an append-only floor entry that arrived on the write axis. The parse-time gate in\n // `findMinionResourceAccessViolations` refuses the declaration; reaching here with one means that\n // gate was bypassed (a hand-built grant object), and honouring it would mint the one credential the\n // append axis exists to withhold.\n const widenedAppendFloor = MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES.filter((resourceType) => declaredWrite.has(resourceType));\n if (widenedAppendFloor.length > 0) {\n throw new Error(\n `Refusing to derive minion database grants that put append-only resource types on the write axis: `\n + `${widenedAppendFloor.join(', ')}. A write grant carries DELETE; these are granted APPEND only.`,\n );\n }\n\n return {\n [RuntimePrincipalDatabaseGrantAxis.READ]: normalize([...grants.read, ...MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES]),\n [RuntimePrincipalDatabaseGrantAxis.WRITE]: normalize(grants.write),\n [RuntimePrincipalDatabaseGrantAxis.APPEND]: normalize(MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES),\n // A MAINTAIN floor entry the author also declared on write keeps the wider axis: runtime state is\n // not evidence, so the append-floor refusal above deliberately does not extend to it.\n [RuntimePrincipalDatabaseGrantAxis.MAINTAIN]: normalize(\n MINION_ENGINE_MANDATORY_MAINTAIN_RESOURCE_TYPES.filter((resourceType) => !declaredWrite.has(resourceType)),\n ),\n };\n}\n"]}
1
+ {"version":3,"file":"minion-resource-access.validation.js","sourceRoot":"","sources":["../../../../src/project-config/shared/minion-resource-access.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,8CAA8C,EAC9C,iCAAiC,EACjC,sCAAsC,GAEvC,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;GAQG;AAEH;;;;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\n RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES,\n RuntimePrincipalDatabaseGrantAxis,\n resolveSharedPersistenceCollectionName,\n type ResourceType,\n} from '@wildo-ai/saas-models';\n\n/**\n * The two safety gates that must hold BEFORE a minion's `resourceAccess` may be\n * turned into database grants (Step 3 shared prerequisites, R11 + the F1 guard).\n *\n * Both exist because of the same asymmetry: `resourceAccess` is a RESOURCE-TYPE\n * whitelist, while a database grant is a COLLECTION grant. The two only line up\n * when the mapping between them is injective over the declarable set — and the\n * alias map is exactly where it is not.\n */\n\n/**\n * Resource types a minion may never declare (D15 / R11) — every ALIASED door.\n *\n * An aliased door is a resource type whose rows live in ANOTHER resource type's\n * collection (`RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES`). It is always the\n * NARROWER of the two doors, and a database grant cannot be narrower than a\n * collection — so a grant derived from the narrow door carries the wide one.\n *\n * The alias map holds two KINDS of narrow door, and both are refused for that\n * same reason while differing in why they are narrow:\n *\n * - **self doors** (`USER_SELF`, `USER_SELF_PROFILES`, `USER_SELF_PREFERENCES`)\n * address \"MY row\". They are additionally meaningless for a minion:\n * `APPLICATION_MACHINE` carries no `userId`, so there is no row to be \"mine\".\n * Declaring `USER_SELF` would grant the whole `users` collection — every user's\n * row, through a door that promises one.\n * - **subset doors** (`APPLICATION_AUDIT_LOGS`, #317) see a different SUBSET of a\n * shared record set. The application audit door and the organization audit door\n * read one trail; a grant derived from either carries the entire trail.\n *\n * This constant was named `MINION_FORBIDDEN_SELF_DOOR_RESOURCE_TYPES` while the\n * map held only self doors, and kept that name — and a refusal message calling\n * every entry a self door — after the audit door joined it (#458). The rule was\n * never \"self doors are forbidden\"; it is \"a grant must not be wider than the\n * declaration reads\", and the name now says that.\n *\n * Removing every aliased door from the declarable set is also what makes\n * resource-type → collection INJECTIVE, so a grant derived per resource type means\n * exactly what the author wrote. Relaxing it for convenience silently restores\n * the coarser floor.\n *\n * Derived from the alias map rather than listed, so an alias added there is\n * forbidden here on the same commit instead of quietly becoming declarable — and\n * the pin in `minion-resource-access.validation.test.ts` forces that addition to\n * be reviewed rather than absorbed.\n */\nexport const MINION_FORBIDDEN_ALIASED_DOOR_RESOURCE_TYPES: readonly string[] =\n Object.keys(RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES);\n\n/** One reason a `resourceAccess` declaration cannot be turned into grants. */\nexport interface MinionResourceAccessViolation {\n /** The AUTHORED axis the offending entry was declared on — `resourceAccess` has only these two. */\n readonly axis: RuntimePrincipalDatabaseGrantAxis.READ | RuntimePrincipalDatabaseGrantAxis.WRITE;\n readonly resourceType: string;\n /** Operator-facing explanation naming the consequence and the fix. */\n readonly message: string;\n}\n\n/**\n * Reject aliased-door types, and refuse any declaration whose types collapse onto\n * one collection.\n *\n * Returns every violation rather than throwing on the first: an author fixing a\n * config wants the whole list, and a caller that wants to fail closed can do so\n * on a non-empty result.\n *\n * ## The injectivity check is NOT redundant with the aliased-door rejection\n *\n * It is tempting to think removing the aliased doors makes collisions impossible —\n * that is true of TODAY's alias map and is exactly why this must be checked\n * rather than assumed. The alias map is data: a future entry that aliases two\n * types a minion MAY declare onto one collection would reintroduce the collapse,\n * and the grant derived for one type would silently carry the other's rows.\n * Failing closed here makes that a build failure instead of a containment that\n * quietly widened.\n */\nexport function findMinionResourceAccessViolations(resourceAccess: {\n read?: readonly string[] | undefined;\n write?: readonly string[] | undefined;\n}): MinionResourceAccessViolation[] {\n const violations: MinionResourceAccessViolation[] = [];\n const axes: Array<[MinionResourceAccessViolation['axis'], readonly string[]]> = [\n [RuntimePrincipalDatabaseGrantAxis.READ, resourceAccess.read ?? []],\n [RuntimePrincipalDatabaseGrantAxis.WRITE, resourceAccess.write ?? []],\n ];\n\n // An APPEND-ONLY floor entry may not be widened to WRITE by declaration. Refused here, at parse\n // time, rather than honoured downstream: the write axis carries DELETE, so `write: ['auditLogs']`\n // is not a broader version of the audit floor — it is the one grant that lets a principal remove\n // the evidence of what it did. This used to be permitted as \"an explicit, reviewed decision\", and\n // the grant derivation kept the declared axis; but a declaration nobody is forced to justify is not\n // a review, and the property the append axis exists for held only until somebody typed one word.\n // Derived from the floor itself, so a type added to the append floor tomorrow is refused on write\n // on the same commit.\n for (const resourceType of resourceAccess.write ?? []) {\n if ((MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES as readonly string[]).includes(resourceType)) {\n violations.push({\n axis: RuntimePrincipalDatabaseGrantAxis.WRITE,\n resourceType,\n message:\n `'${resourceType}' cannot be declared on a minion's write axis: the engine already grants it APPEND-only `\n + '(insert, never update or delete), and a write grant would let this minion modify or remove rows it '\n + 'appended — for the audit trail, the evidence of its own actions. Remove it from `write`; appending '\n + 'needs no declaration.',\n });\n }\n }\n\n for (const [axis, declared] of axes) {\n for (const resourceType of declared) {\n if (MINION_FORBIDDEN_ALIASED_DOOR_RESOURCE_TYPES.includes(resourceType)) {\n // The message names only what is true of EVERY aliased door: the collection\n // it shares and the wider type that owns it. An earlier message called each\n // entry a \"SELF door … every user's row\", which was false for the audit door.\n const widerResourceType = RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES[resourceType]!;\n const collection = resolveSharedPersistenceCollectionName(resourceType as ResourceType);\n violations.push({\n axis,\n resourceType,\n message:\n `'${resourceType}' is an ALIASED door and cannot be granted to a minion (D15): its rows live in the `\n + `'${collection}' collection it shares with '${widerResourceType}'. A database grant is issued per `\n + `collection, so granting '${resourceType}' would reach every row '${widerResourceType}' addresses — `\n + `wider than the door '${resourceType}' promises. Declare '${widerResourceType}' explicitly if the `\n + 'minion genuinely needs that breadth.',\n });\n }\n }\n\n // Injectivity, per AXIS: two declared types resolving to one collection make\n // the derived grant wider than either declaration reads.\n const collectionOwners = new Map<string, string>();\n for (const resourceType of declared) {\n const collection = resolveSharedPersistenceCollectionName(resourceType as ResourceType);\n const existing = collectionOwners.get(collection);\n if (existing !== undefined && existing !== resourceType) {\n violations.push({\n axis,\n resourceType,\n message:\n `'${resourceType}' and '${existing}' both resolve to the '${collection}' collection, `\n + 'so a grant derived from either carries the other\\'s rows. Refusing to derive grants '\n + 'from a declaration whose types are not injective over collections (F1 guard) — '\n + 'declare exactly one of them.',\n });\n continue;\n }\n collectionOwners.set(collection, resourceType);\n }\n }\n\n return violations;\n}\n\n/**\n * What a minion may touch, per axis — expressed in RESOURCE TYPES, the\n * vocabulary the rest of the platform speaks.\n *\n * ## Why not collection names\n *\n * An earlier revision returned collection names, which quietly made storage the\n * API of a security decision. `resourceAccess` is AUTHORED in resource types,\n * `ResourceType` is what every other Wildo surface passes around, and a\n * collection is one adapter's rendering of where those rows happen to live —\n * MongoDB calls it a collection, PostgreSQL a table, and a future adapter will\n * call it something else again. Naming the security contract after one of them\n * would force every reader to translate back, and would make the grant set look\n * different depending on which database an application chose.\n *\n * The translation therefore happens at the ADAPTER boundary — see\n * {@link resolveGrantStorageNames} — which is the only place that legitimately\n * knows about storage, exactly as external protocol literals are confined to the\n * thin adapter that speaks them.\n *\n * `null` means **no access was declared at all**, which is NOT the same as an\n * empty declaration and must not be flattened into one. Absent ⇒ no authored business-data access. The database credential owner\n * separately supplies the mandatory runtime floor; object storage must not receive\n * that floor. Declared-but-empty remains an explicit author decision. One \"empty list\" for both would\n * make \"I forgot\" indistinguishable from \"I meant none\".\n */\nexport interface MinionResourceGrants {\n readonly read: readonly ResourceType[];\n readonly write: readonly ResourceType[];\n}\n\n/**\n * Derive a minion's grants from an authored `resourceAccess`.\n *\n * ## `write` does NOT imply `read`, deliberately\n *\n * It is tempting to add read wherever write is granted — most write paths in the\n * backend pipeline do read first (validation, FK resolution, read-modify-write),\n * so a `write: ['todos']` minion will often need `read: ['todos']` too.\n *\n * It is still refused, for the reason this entire workstream exists: a grant the\n * author did not write is a grant nobody reviewed. An insert-only minion is a\n * real shape, and silently widening every writer to a reader would make the\n * declaration stop describing the outcome — the precise property that made\n * `resourceAccess` non-binding before it produced real credentials.\n *\n * The cost is stated rather than hidden: a minion that writes without declaring\n * read will fail at RUNTIME on its first read, with the database naming the\n * action it lacked. A loud, local failure with an obvious fix (declare the read)\n * is the trade this prefers over a silent widening.\n *\n * ## The F2 transitive read path is the CALLER's to supply\n *\n * A declared type can pull in others through nested reads — the closure rule is\n * *declared ∪ child-direction targets declaring nested `onRead`, transitively*.\n * Computing it needs the resource graph, which this layer does not have, so it\n * arrives as `transitiveReadResourceTypes`. Omitting it is correct ONLY when the\n * application declares no nested `onRead` (true of Wonder Todos, measured\n * 2026-08-05); omitting it elsewhere yields a credential that is denied on a\n * path which works today.\n */\nexport function deriveMinionResourceGrants(\n resourceAccess: { read?: readonly string[] | undefined; write?: readonly string[] | undefined } | undefined,\n transitiveReadResourceTypes: readonly string[] = [],\n): MinionResourceGrants | null {\n if (!resourceAccess) return null;\n\n const violations = findMinionResourceAccessViolations(resourceAccess);\n if (violations.length > 0) {\n // Fail closed. Reaching here means the parse-time gate was bypassed (a\n // hand-built object, a future caller); deriving anyway would issue exactly\n // the over-broad grant those gates exist to refuse.\n throw new Error(\n `Refusing to derive minion resource grants from an invalid resourceAccess: `\n + violations.map((violation) => `[${violation.axis}] ${violation.message}`).join(' '),\n );\n }\n\n // Deduped and ordered so a grant set is stable between syncs — an unstable\n // one reads as a change and would re-issue credentials for nothing.\n const normalize = (resourceTypes: readonly string[]): ResourceType[] =>\n [...new Set(resourceTypes)].sort() as ResourceType[];\n\n return {\n read: normalize([...(resourceAccess.read ?? []), ...transitiveReadResourceTypes]),\n write: normalize(resourceAccess.write ?? []),\n };\n}\n\n/**\n * Translate a grant axis into the STORAGE names one adapter will grant on.\n *\n * The single, explicitly-named boundary between the platform vocabulary and a\n * database dialect. A Mongo module builds collection privileges from it; a\n * PostgreSQL module builds table grants; both call the same function so the two\n * cannot disagree about which rows a resource type addresses.\n *\n * Safe to collapse duplicates here ONLY because the F1 guard already refused any\n * declaration whose types share a collection — see\n * {@link findMinionResourceAccessViolations}. Without that guarantee this\n * function would silently merge two declarations into one grant.\n */\nexport function resolveGrantStorageNames(resourceTypes: readonly ResourceType[]): string[] {\n return [...new Set(resourceTypes.map((resourceType) => resolveSharedPersistenceCollectionName(resourceType)))].sort();\n}\n\n/**\n * What the ENGINE reads and writes for every runtime principal, whatever that\n * principal declared — the floor a database role must hold before any authored\n * `resourceAccess` is considered at all.\n *\n * ## Why this is not declarable, and must not become so\n *\n * `resourceAccess` answers \"what application data may this minion touch\". These\n * entries answer a different question: \"what does the framework itself touch\n * in order to run a repository operation at all\". No author decides them, no\n * author can opt out of them, and asking one to write them down would be asking\n * a human for an answer the mechanism already knows — the exact shape\n * `.claude/rules/derive-before-you-ask.md` refuses. They are derived here, once,\n * from the engine paths that actually perform them:\n *\n * - **`APPLICATION`, read.** `ExecutionContextCreatorBackendService.getApplicationId`\n * resolves the singleton APPLICATION row for EVERY `ResourcePrimaryScope.APPLICATION`\n * operation, through `repositoriesRegistry` directly. That read is structural:\n * a minion declaring `read: ['todos']` is declaring an APPLICATION-scoped read,\n * so it triggers this one before it ever reaches `todos`.\n * - **`AUDIT_LOGS`, append.** `AuditLogsBackendService` writes one row per audited\n * operation, including the `system_context_read` it emits for the read above.\n * - **`JOB_EXECUTIONS`, read/maintain.** Scheduled receipt, atomic admission,\n * heartbeat and recovery update durable history, including after a restart.\n * - **`JOB_PAYLOAD_STORAGE`, read/append.** Recovery retains completed output\n * without granting the principal permission to rewrite or delete that output.\n *\n * These framework operations bypass the in-process `resourceAccess` whitelist by construction —\n * `MinionScopedServicesRegistryHandlerBackendService` decorates the minion's\n * SERVICES registry, and these go through the repositories registry — so the\n * database grant was the only gate they ever met, and it refused them. That\n * asymmetry is the defect: the in-process policy already permits these reads,\n * and the credential did not.\n *\n * ## Why AUDIT_LOGS is APPEND and not WRITE\n *\n * The `write` axis grants `INSERT, UPDATE, DELETE`. Putting the audit table there\n * would let every minion rewrite or delete the evidence of its own actions, which\n * is not a smaller version of the right answer — it is the opposite of one. An\n * audit trail a principal can delete is not an audit trail. The append axis exists\n * so this floor can be satisfied without handing out that capability.\n *\n * ## What this does NOT cover\n *\n * Named runtime principals only. The APPLICATION BACKEND is issued a database-owning\n * credential on every adapter (PostgreSQL `ALL PRIVILEGES`, MongoDB `readWrite` +\n * `dbAdmin`, Atlas `readWrite`), so nothing at the database layer stops the backend's\n * own credential from amending an audit row; for the backend, audit immutability is\n * the application layer's — `AUDIT_LOGS` exposes no update or delete operation. And\n * only the SELF-MANAGED adapters issue a per-principal credential at all.\n *\n * assurance-control: WILDO.AUDIT.TAMPER_RESISTANCE — a named runtime principal may add\n * audit rows and may never modify or remove them, and may not be granted otherwise.\n */\nexport const MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES: readonly ResourceType[] =\n [CoreResourceType.APPLICATION, CoreResourceType.JOB_EXECUTIONS, CoreResourceType.JOB_PAYLOAD_STORAGE] as unknown as readonly ResourceType[];\n\n/** @see MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES — the append-only floor. */\nexport const MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES: readonly ResourceType[] =\n [CoreResourceType.AUDIT_LOGS, CoreResourceType.JOB_PAYLOAD_STORAGE] as unknown as readonly ResourceType[];\n\n/** Insert and update durable execution state, without permission to erase its history. */\nexport const MINION_ENGINE_MANDATORY_MAINTAIN_RESOURCE_TYPES: readonly ResourceType[] =\n [CoreResourceType.JOB_EXECUTIONS] as unknown as readonly ResourceType[];\n\n/**\n * A minion's grants as a DATABASE role must hold them: what the author declared,\n * plus the engine floor above — one resource-type list per\n * {@link RuntimePrincipalDatabaseGrantAxis}, whose members document each axis's verbs.\n *\n * Mapped over the axis vocabulary rather than spelled out, so an axis added there is a compile error\n * at every site that builds or consumes one of these until it is handled.\n *\n * Separate append and maintain axes keep the floor honest — see\n * {@link MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES}.\n */\nexport type MinionDatabaseGrants = {\n readonly [Axis in RuntimePrincipalDatabaseGrantAxis]: readonly ResourceType[];\n};\n\n/**\n * Add the engine floor to an authored derivation — the ONE place database grants\n * acquire it.\n *\n * ## Why here and not in {@link deriveMinionResourceGrants}\n *\n * That function answers \"what did the author declare\", and it has a THIRD\n * consumer that must not receive this floor: the object-storage credential path\n * turns the same grants into blob key prefixes. Widening it there would confine a\n * minion's storage credential to an `applications/` prefix nobody asked for and\n * nothing writes. The floor is a property of holding a DATABASE role, so it is\n * applied at the boundary where a database role is minted — and both database\n * adapters call this one function, so they cannot drift apart the way the mint\n * and revoke halves of those adapters already have once\n * (`.claude/rules/invariant-call-site-enumeration.md` #18).\n *\n * Idempotent: a floor entry the author also declared appears once.\n */\nexport function deriveMinionDatabaseGrants(grants: MinionResourceGrants): MinionDatabaseGrants {\n const normalize = (resourceTypes: readonly ResourceType[]): ResourceType[] =>\n [...new Set(resourceTypes)].sort();\n\n const declaredWrite = new Set<string>(grants.write);\n\n // Fail closed on an append-only floor entry that arrived on the write axis. The parse-time gate in\n // `findMinionResourceAccessViolations` refuses the declaration; reaching here with one means that\n // gate was bypassed (a hand-built grant object), and honouring it would mint the one credential the\n // append axis exists to withhold.\n const widenedAppendFloor = MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES.filter((resourceType) => declaredWrite.has(resourceType));\n if (widenedAppendFloor.length > 0) {\n throw new Error(\n `Refusing to derive minion database grants that put append-only resource types on the write axis: `\n + `${widenedAppendFloor.join(', ')}. A write grant carries DELETE; these are granted APPEND only.`,\n );\n }\n\n return {\n [RuntimePrincipalDatabaseGrantAxis.READ]: normalize([...grants.read, ...MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES]),\n [RuntimePrincipalDatabaseGrantAxis.WRITE]: normalize(grants.write),\n [RuntimePrincipalDatabaseGrantAxis.APPEND]: normalize(MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES),\n // A MAINTAIN floor entry the author also declared on write keeps the wider axis: runtime state is\n // not evidence, so the append-floor refusal above deliberately does not extend to it.\n [RuntimePrincipalDatabaseGrantAxis.MAINTAIN]: normalize(\n MINION_ENGINE_MANDATORY_MAINTAIN_RESOURCE_TYPES.filter((resourceType) => !declaredWrite.has(resourceType)),\n ),\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"object-storage-session-policy.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/object-storage-session-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uCAAuC,OAAO,CAAC;AAE5D,MAAM,WAAW,+BAA+B;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AA4BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,+BAA+B,GAAG,MAAM,CAyB9F;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,+BAA+B,GAAG;IACzF,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACf,CAGA"}
1
+ {"version":3,"file":"object-storage-session-policy.d.ts","sourceRoot":"","sources":["../../../../src/project-config/shared/object-storage-session-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uCAAuC,OAAO,CAAC;AAE5D,MAAM,WAAW,+BAA+B;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AA4BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,+BAA+B,GAAG,MAAM,CAyB9F;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,+BAA+B,GAAG;IACzF,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACf,CAGA"}