@wildo-ai/platform-config-lib 1.1.11 → 1.1.13

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 (389) hide show
  1. package/dist/esm/_unimplemented/soft-warn.d.ts +24 -49
  2. package/dist/esm/_unimplemented/soft-warn.d.ts.map +1 -1
  3. package/dist/esm/_unimplemented/soft-warn.js +24 -49
  4. package/dist/esm/_unimplemented/soft-warn.js.map +1 -1
  5. package/dist/esm/blueprint/anchored-region.d.ts.map +1 -1
  6. package/dist/esm/blueprint/anchored-region.js.map +1 -1
  7. package/dist/esm/blueprint/blueprint.schemas.d.ts +0 -89
  8. package/dist/esm/blueprint/blueprint.schemas.d.ts.map +1 -1
  9. package/dist/esm/blueprint/blueprint.schemas.js.map +1 -1
  10. package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
  11. package/dist/esm/bootstrap/application-backend-env.contracts.js.map +1 -1
  12. package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts.map +1 -1
  13. package/dist/esm/bootstrap/application-creation-verification-env.contracts.js.map +1 -1
  14. package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
  15. package/dist/esm/bootstrap/bootstrap-planner.js.map +1 -1
  16. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  17. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  18. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +8 -1
  19. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  20. package/dist/esm/bootstrap/bootstrap.schemas.js +15 -1
  21. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  22. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +10 -2
  23. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  24. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +10 -2
  25. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  26. package/dist/esm/bootstrap/platform-store-preconnect.d.ts +21 -0
  27. package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -1
  28. package/dist/esm/bootstrap/platform-store-preconnect.js +25 -0
  29. package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -1
  30. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts +80 -0
  31. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts.map +1 -0
  32. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js +81 -0
  33. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js.map +1 -0
  34. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts +41 -9
  35. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
  36. package/dist/esm/bootstrap/runtime-backing-service-access.js +77 -28
  37. package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
  38. package/dist/esm/bootstrap/runtime-network-policy.d.ts +117 -12
  39. package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
  40. package/dist/esm/bootstrap/runtime-network-policy.js +222 -23
  41. package/dist/esm/bootstrap/runtime-network-policy.js.map +1 -1
  42. package/dist/esm/bootstrap/runtime-network-topology.d.ts +31 -4
  43. package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
  44. package/dist/esm/bootstrap/runtime-network-topology.js +43 -2
  45. package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
  46. package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -1
  47. package/dist/esm/bootstrap/runtime-platform-access.js.map +1 -1
  48. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts +40 -2
  49. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
  50. package/dist/esm/bootstrap/runtime-principal.contracts.js +66 -3
  51. package/dist/esm/bootstrap/runtime-principal.contracts.js.map +1 -1
  52. package/dist/esm/bootstrap/runtime-response-integrity.d.ts.map +1 -1
  53. package/dist/esm/bootstrap/runtime-response-integrity.js +3 -3
  54. package/dist/esm/bootstrap/runtime-response-integrity.js.map +1 -1
  55. package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts.map +1 -1
  56. package/dist/esm/bootstrap/runtime-secret-env.contracts.js.map +1 -1
  57. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
  58. package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
  59. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
  60. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
  61. package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts.map +1 -1
  62. package/dist/esm/canonical-json/rfc8785-canonical-json.js.map +1 -1
  63. package/dist/esm/config-authoring.entry.d.ts.map +1 -1
  64. package/dist/esm/config-authoring.entry.js.map +1 -1
  65. package/dist/esm/credentials/credential-generator.service.d.ts.map +1 -1
  66. package/dist/esm/credentials/credential-generator.service.js.map +1 -1
  67. package/dist/esm/index.d.ts +5 -1
  68. package/dist/esm/index.d.ts.map +1 -1
  69. package/dist/esm/index.js +5 -1
  70. package/dist/esm/index.js.map +1 -1
  71. package/dist/esm/key-management/application-legacy-envelope-key.contracts.d.ts +119 -0
  72. package/dist/esm/key-management/application-legacy-envelope-key.contracts.d.ts.map +1 -0
  73. package/dist/esm/key-management/application-legacy-envelope-key.contracts.js +109 -0
  74. package/dist/esm/key-management/application-legacy-envelope-key.contracts.js.map +1 -0
  75. package/dist/esm/key-management/application-signing-key-rotation.contracts.d.ts +182 -0
  76. package/dist/esm/key-management/application-signing-key-rotation.contracts.d.ts.map +1 -0
  77. package/dist/esm/key-management/application-signing-key-rotation.contracts.js +145 -0
  78. package/dist/esm/key-management/application-signing-key-rotation.contracts.js.map +1 -0
  79. package/dist/esm/key-management/approval-seal-manifested-copy.d.ts +156 -0
  80. package/dist/esm/key-management/approval-seal-manifested-copy.d.ts.map +1 -0
  81. package/dist/esm/key-management/approval-seal-manifested-copy.js +617 -0
  82. package/dist/esm/key-management/approval-seal-manifested-copy.js.map +1 -0
  83. package/dist/esm/key-management/approval-seal-verifier.d.ts +114 -40
  84. package/dist/esm/key-management/approval-seal-verifier.d.ts.map +1 -1
  85. package/dist/esm/key-management/approval-seal-verifier.js +143 -12
  86. package/dist/esm/key-management/approval-seal-verifier.js.map +1 -1
  87. package/dist/esm/key-management/approval-seal.contracts.d.ts +12 -15
  88. package/dist/esm/key-management/approval-seal.contracts.d.ts.map +1 -1
  89. package/dist/esm/key-management/approval-seal.contracts.js +20 -0
  90. package/dist/esm/key-management/approval-seal.contracts.js.map +1 -1
  91. package/dist/esm/key-management/data-key.contracts.d.ts +0 -2
  92. package/dist/esm/key-management/data-key.contracts.d.ts.map +1 -1
  93. package/dist/esm/key-management/data-key.contracts.js.map +1 -1
  94. package/dist/esm/key-management/es256-jws.d.ts.map +1 -1
  95. package/dist/esm/key-management/es256-jws.js.map +1 -1
  96. package/dist/esm/key-management/key-provider.spi.d.ts +8 -1
  97. package/dist/esm/key-management/key-provider.spi.d.ts.map +1 -1
  98. package/dist/esm/key-management/key-provider.spi.js.map +1 -1
  99. package/dist/esm/key-management/keyring-rotation.contracts.d.ts +2 -12
  100. package/dist/esm/key-management/keyring-rotation.contracts.d.ts.map +1 -1
  101. package/dist/esm/key-management/keyring-rotation.contracts.js +3 -3
  102. package/dist/esm/key-management/keyring-rotation.contracts.js.map +1 -1
  103. package/dist/esm/key-management/keyring-status.contracts.d.ts +0 -7
  104. package/dist/esm/key-management/keyring-status.contracts.d.ts.map +1 -1
  105. package/dist/esm/key-management/keyring-status.contracts.js.map +1 -1
  106. package/dist/esm/key-management/pdf-incremental-update.d.ts +158 -0
  107. package/dist/esm/key-management/pdf-incremental-update.d.ts.map +1 -0
  108. package/dist/esm/key-management/pdf-incremental-update.js +730 -0
  109. package/dist/esm/key-management/pdf-incremental-update.js.map +1 -0
  110. package/dist/esm/key-management/pdf-truetype-font.d.ts +35 -0
  111. package/dist/esm/key-management/pdf-truetype-font.d.ts.map +1 -0
  112. package/dist/esm/key-management/pdf-truetype-font.js +152 -0
  113. package/dist/esm/key-management/pdf-truetype-font.js.map +1 -0
  114. package/dist/esm/key-management/qr-code.d.ts +38 -0
  115. package/dist/esm/key-management/qr-code.d.ts.map +1 -0
  116. package/dist/esm/key-management/qr-code.js +325 -0
  117. package/dist/esm/key-management/qr-code.js.map +1 -0
  118. package/dist/esm/key-management/signature-request.contracts.d.ts +0 -4
  119. package/dist/esm/key-management/signature-request.contracts.d.ts.map +1 -1
  120. package/dist/esm/key-management/signature-request.contracts.js.map +1 -1
  121. package/dist/esm/key-management/signing-log-export.contracts.d.ts +0 -1
  122. package/dist/esm/key-management/signing-log-export.contracts.d.ts.map +1 -1
  123. package/dist/esm/key-management/signing-log-export.contracts.js.map +1 -1
  124. package/dist/esm/key-management/vault-custody.contracts.d.ts +43 -0
  125. package/dist/esm/key-management/vault-custody.contracts.d.ts.map +1 -1
  126. package/dist/esm/key-management/vault-custody.contracts.js +66 -0
  127. package/dist/esm/key-management/vault-custody.contracts.js.map +1 -1
  128. package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -1
  129. package/dist/esm/lockfile/build-parallelism.js.map +1 -1
  130. package/dist/esm/lockfile/canonical-json.d.ts +1 -1
  131. package/dist/esm/lockfile/canonical-json.d.ts.map +1 -1
  132. package/dist/esm/lockfile/canonical-json.js +1 -1
  133. package/dist/esm/lockfile/canonical-json.js.map +1 -1
  134. package/dist/esm/lockfile/file-lock-hold.d.ts.map +1 -1
  135. package/dist/esm/lockfile/file-lock-hold.js +2 -1
  136. package/dist/esm/lockfile/file-lock-hold.js.map +1 -1
  137. package/dist/esm/lockfile/lockfile-io.d.ts +6 -8
  138. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
  139. package/dist/esm/lockfile/lockfile-io.js +6 -8
  140. package/dist/esm/lockfile/lockfile-io.js.map +1 -1
  141. package/dist/esm/lockfile/materialize-infra-section.d.ts +5 -6
  142. package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
  143. package/dist/esm/lockfile/materialize-infra-section.js +4 -5
  144. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  145. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +1 -247
  146. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
  147. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +1 -1
  148. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
  149. package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts +146 -0
  150. package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts.map +1 -0
  151. package/dist/esm/pnpm-settings/application-pnpm-settings.js +573 -0
  152. package/dist/esm/pnpm-settings/application-pnpm-settings.js.map +1 -0
  153. package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -1
  154. package/dist/esm/project-config/application-public-pricing-catalog.loader.js +15 -3
  155. package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -1
  156. package/dist/esm/project-config/application-served-public-documents.loader.d.ts.map +1 -1
  157. package/dist/esm/project-config/application-served-public-documents.loader.js +16 -8
  158. package/dist/esm/project-config/application-served-public-documents.loader.js.map +1 -1
  159. package/dist/esm/project-config/backend-compliance-section.reader.d.ts +35 -0
  160. package/dist/esm/project-config/backend-compliance-section.reader.d.ts.map +1 -0
  161. package/dist/esm/project-config/backend-compliance-section.reader.js +123 -0
  162. package/dist/esm/project-config/backend-compliance-section.reader.js.map +1 -0
  163. package/dist/esm/project-config/backend-compliance-section.worker.d.ts +20 -0
  164. package/dist/esm/project-config/backend-compliance-section.worker.d.ts.map +1 -0
  165. package/dist/esm/project-config/backend-compliance-section.worker.js +78 -0
  166. package/dist/esm/project-config/backend-compliance-section.worker.js.map +1 -0
  167. package/dist/esm/project-config/config-module-resolution.d.ts +32 -0
  168. package/dist/esm/project-config/config-module-resolution.d.ts.map +1 -0
  169. package/dist/esm/project-config/config-module-resolution.js +33 -0
  170. package/dist/esm/project-config/config-module-resolution.js.map +1 -0
  171. package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
  172. package/dist/esm/project-config/define-framework-config.js.map +1 -1
  173. package/dist/esm/project-config/define-infra-env-config.d.ts +146 -55
  174. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  175. package/dist/esm/project-config/define-infra-env-config.js +124 -71
  176. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  177. package/dist/esm/project-config/define-minion-config.d.ts +26 -36
  178. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  179. package/dist/esm/project-config/define-minion-config.js +64 -25
  180. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  181. package/dist/esm/project-config/define-saas-config.d.ts +41 -437
  182. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  183. package/dist/esm/project-config/define-saas-config.js +102 -94
  184. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  185. package/dist/esm/project-config/define-worker-config.d.ts +10 -20
  186. package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
  187. package/dist/esm/project-config/define-worker-config.js +10 -12
  188. package/dist/esm/project-config/define-worker-config.js.map +1 -1
  189. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -1
  190. package/dist/esm/project-config/hosted-infra-env-config.js +2 -1
  191. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
  192. package/dist/esm/project-config/index.d.ts +2 -0
  193. package/dist/esm/project-config/index.d.ts.map +1 -1
  194. package/dist/esm/project-config/index.js +2 -0
  195. package/dist/esm/project-config/index.js.map +1 -1
  196. package/dist/esm/project-config/loader-instances-zod.d.ts +19 -0
  197. package/dist/esm/project-config/loader-instances-zod.d.ts.map +1 -0
  198. package/dist/esm/project-config/loader-instances-zod.js +40 -0
  199. package/dist/esm/project-config/loader-instances-zod.js.map +1 -0
  200. package/dist/esm/project-config/loader.d.ts +131 -14
  201. package/dist/esm/project-config/loader.d.ts.map +1 -1
  202. package/dist/esm/project-config/loader.js +226 -12
  203. package/dist/esm/project-config/loader.js.map +1 -1
  204. package/dist/esm/project-config/minion-liveness.contracts.d.ts +131 -0
  205. package/dist/esm/project-config/minion-liveness.contracts.d.ts.map +1 -0
  206. package/dist/esm/project-config/minion-liveness.contracts.js +167 -0
  207. package/dist/esm/project-config/minion-liveness.contracts.js.map +1 -0
  208. package/dist/esm/project-config/minion-local-provider-registration.d.ts.map +1 -1
  209. package/dist/esm/project-config/minion-local-provider-registration.js.map +1 -1
  210. package/dist/esm/project-config/npm-version-range.d.ts.map +1 -1
  211. package/dist/esm/project-config/npm-version-range.js.map +1 -1
  212. package/dist/esm/project-config/owning-package-tsconfig.d.ts +7 -7
  213. package/dist/esm/project-config/owning-package-tsconfig.d.ts.map +1 -1
  214. package/dist/esm/project-config/owning-package-tsconfig.js +7 -7
  215. package/dist/esm/project-config/owning-package-tsconfig.js.map +1 -1
  216. package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -1
  217. package/dist/esm/project-config/provider-catalog-types.js.map +1 -1
  218. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  219. package/dist/esm/project-config/provider-companion-discovery.js +3 -1
  220. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  221. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +71 -46
  222. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  223. package/dist/esm/project-config/provider-runtime-artifacts.js +150 -4
  224. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  225. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts +0 -2
  226. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
  227. package/dist/esm/project-config/shared/application-creation-verification.schemas.js.map +1 -1
  228. package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
  229. package/dist/esm/project-config/shared/application-modules.schemas.js.map +1 -1
  230. package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
  231. package/dist/esm/project-config/shared/application-modules.utils.js.map +1 -1
  232. package/dist/esm/project-config/shared/auth.schemas.d.ts +0 -17
  233. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
  234. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
  235. package/dist/esm/project-config/shared/backing-service-servability.d.ts.map +1 -1
  236. package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -1
  237. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +9 -10
  238. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  239. package/dist/esm/project-config/shared/backing-services.schemas.js +13 -15
  240. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  241. package/dist/esm/project-config/shared/cdn.schemas.d.ts +0 -51
  242. package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
  243. package/dist/esm/project-config/shared/cdn.schemas.js.map +1 -1
  244. package/dist/esm/project-config/shared/csp-defaults.d.ts +34 -6
  245. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
  246. package/dist/esm/project-config/shared/csp-defaults.js +52 -8
  247. package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
  248. package/dist/esm/project-config/shared/csp-emit.d.ts +60 -13
  249. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
  250. package/dist/esm/project-config/shared/csp-emit.js +77 -24
  251. package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
  252. package/dist/esm/project-config/shared/csp.schemas.d.ts +72 -84
  253. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  254. package/dist/esm/project-config/shared/csp.schemas.js +40 -12
  255. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  256. package/dist/esm/project-config/shared/data-services.schemas.d.ts +0 -8
  257. package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
  258. package/dist/esm/project-config/shared/data-services.schemas.js.map +1 -1
  259. package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
  260. package/dist/esm/project-config/shared/env-example-defaults.js.map +1 -1
  261. package/dist/esm/project-config/shared/environment.schemas.d.ts +95 -8
  262. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  263. package/dist/esm/project-config/shared/environment.schemas.js +122 -10
  264. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  265. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +10 -4
  266. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  267. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  268. package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -1
  269. package/dist/esm/project-config/shared/infra-service.schemas.js.map +1 -1
  270. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +1 -1
  271. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  272. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +1 -1
  273. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  274. package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
  275. package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
  276. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
  277. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
  278. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +20 -0
  279. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
  280. package/dist/esm/project-config/shared/minion-resource-access.validation.js +21 -2
  281. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
  282. package/dist/esm/project-config/shared/object-storage-session-policy.d.ts.map +1 -1
  283. package/dist/esm/project-config/shared/object-storage-session-policy.js.map +1 -1
  284. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts +67 -38
  285. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts.map +1 -1
  286. package/dist/esm/project-config/shared/platform-key-management.schemas.js +113 -5
  287. package/dist/esm/project-config/shared/platform-key-management.schemas.js.map +1 -1
  288. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  289. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  290. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +2 -2
  291. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -1
  292. package/dist/esm/project-config/shared/platform-storage.schemas.js +16 -2
  293. package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -1
  294. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts +21 -23
  295. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
  296. package/dist/esm/project-config/shared/service-definitions.schemas.js +4 -5
  297. package/dist/esm/project-config/shared/service-definitions.schemas.js.map +1 -1
  298. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +0 -18
  299. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -1
  300. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -1
  301. package/dist/esm/project-config/static-asset-import-noop.d.ts +20 -3
  302. package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -1
  303. package/dist/esm/project-config/static-asset-import-noop.js +36 -20
  304. package/dist/esm/project-config/static-asset-import-noop.js.map +1 -1
  305. package/dist/esm/registry/artifact-domain.schemas.d.ts +0 -5
  306. package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
  307. package/dist/esm/registry/artifact-domain.schemas.js.map +1 -1
  308. package/dist/esm/registry/digest.schemas.d.ts.map +1 -1
  309. package/dist/esm/registry/digest.schemas.js.map +1 -1
  310. package/dist/esm/registry/index.d.ts +2 -3
  311. package/dist/esm/registry/index.d.ts.map +1 -1
  312. package/dist/esm/registry/index.js +2 -3
  313. package/dist/esm/registry/index.js.map +1 -1
  314. package/dist/esm/registry/local-checkout-source.d.ts.map +1 -1
  315. package/dist/esm/registry/local-checkout-source.js.map +1 -1
  316. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +1 -98
  317. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
  318. package/dist/esm/registry/lockfile-modules-section.schemas.js +1 -2
  319. package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
  320. package/dist/esm/registry/module-artifact.schemas.d.ts +17 -17
  321. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
  322. package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
  323. package/dist/esm/registry/module-manifest.schemas.d.ts +151 -219
  324. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  325. package/dist/esm/registry/module-manifest.schemas.js +145 -13
  326. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  327. package/dist/esm/registry/module-search.schemas.d.ts.map +1 -1
  328. package/dist/esm/registry/module-search.schemas.js.map +1 -1
  329. package/dist/esm/registry/registry-config.schemas.d.ts +0 -18
  330. package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
  331. package/dist/esm/registry/registry-config.schemas.js.map +1 -1
  332. package/dist/esm/registry/registry-defaults.constants.d.ts.map +1 -1
  333. package/dist/esm/registry/registry-defaults.constants.js.map +1 -1
  334. package/dist/esm/registry/registry-errors.d.ts +81 -3
  335. package/dist/esm/registry/registry-errors.d.ts.map +1 -1
  336. package/dist/esm/registry/registry-errors.js +185 -4
  337. package/dist/esm/registry/registry-errors.js.map +1 -1
  338. package/dist/esm/registry/registry-keys.schemas.d.ts.map +1 -1
  339. package/dist/esm/registry/registry-keys.schemas.js.map +1 -1
  340. package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
  341. package/dist/esm/registry/registry-section-schemas.constants.js.map +1 -1
  342. package/dist/esm/registry/registry-url-resolution.d.ts.map +1 -1
  343. package/dist/esm/registry/registry-url-resolution.js.map +1 -1
  344. package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
  345. package/dist/esm/release/framework-release.constants.js.map +1 -1
  346. package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
  347. package/dist/esm/schemas/framework-info.schemas.js.map +1 -1
  348. package/dist/esm/schemas/framework-secrets.schemas.d.ts +0 -7
  349. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  350. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  351. package/dist/esm/schemas/platform-application-config.schemas.d.ts +1 -1
  352. package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
  353. package/dist/esm/schemas/platform-application-config.schemas.js.map +1 -1
  354. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts +1 -1
  355. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
  356. package/dist/esm/schemas/platform-application-secrets.schemas.js.map +1 -1
  357. package/dist/esm/schemas/platform-config.schemas.d.ts +2 -2
  358. package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
  359. package/dist/esm/schemas/platform-config.schemas.js.map +1 -1
  360. package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -1
  361. package/dist/esm/workspace-scope/application-subject-manifest.js.map +1 -1
  362. package/dist/esm/workspace-scope/index.d.ts.map +1 -1
  363. package/dist/esm/workspace-scope/index.js.map +1 -1
  364. package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
  365. package/dist/esm/workspace-scope/resolve-homes.js.map +1 -1
  366. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  367. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  368. package/dist/esm/workspace-scope/workspace-scope-detector.d.ts.map +1 -1
  369. package/dist/esm/workspace-scope/workspace-scope-detector.js.map +1 -1
  370. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  371. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  372. package/dist/tsconfig.build.tsbuildinfo +1 -1
  373. package/package.json +12 -12
  374. package/dist/esm/_unimplemented/index.d.ts +0 -3
  375. package/dist/esm/_unimplemented/index.d.ts.map +0 -1
  376. package/dist/esm/_unimplemented/index.js +0 -3
  377. package/dist/esm/_unimplemented/index.js.map +0 -1
  378. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts +0 -137
  379. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts.map +0 -1
  380. package/dist/esm/_unimplemented/unimplemented-field-warning.js +0 -153
  381. package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +0 -1
  382. package/dist/esm/project-config/shared/cdn.example.d.ts +0 -14
  383. package/dist/esm/project-config/shared/cdn.example.d.ts.map +0 -1
  384. package/dist/esm/project-config/shared/cdn.example.js +0 -38
  385. package/dist/esm/project-config/shared/cdn.example.js.map +0 -1
  386. package/dist/esm/project-config/shared/schema-version.schemas.d.ts +0 -15
  387. package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +0 -1
  388. package/dist/esm/project-config/shared/schema-version.schemas.js +0 -40
  389. package/dist/esm/project-config/shared/schema-version.schemas.js.map +0 -1
@@ -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;IACpB,sHAAsH;IACtH,gHAAgH;IAChH,OAAO,EAAE,IAAI;CACL,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 // #2933 — the self-hosted OpenBao that holds the platform's custodied keys: Vault's API port. Only apps-manager dials\n // it; the compose lane publishes it on the host solely because a framework developer's apps-manager runs there.\n OPENBAO: 8200,\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;IACpB,sHAAsH;IACtH,gHAAgH;IAChH,OAAO,EAAE,IAAI;CACL,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 // #2933 — the self-hosted OpenBao that holds the platform's custodied keys: Vault's API port. Only apps-manager dials\n // it; the compose lane publishes it on the host solely because a framework developer's apps-manager runs there.\n OPENBAO: 8200,\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.\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;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAE/E;AAuBD,MAAM,WAAW,uBAAuB;IACtC,kFAAkF;IAClF,UAAU,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACjD,yEAAyE;IACzE,YAAY,EAAE,MAAM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.\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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AM,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//\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"]}
@@ -139,6 +139,21 @@ export declare function deriveMinionResourceGrants(resourceAccess: {
139
139
  read?: readonly string[] | undefined;
140
140
  write?: readonly string[] | undefined;
141
141
  } | undefined, transitiveReadResourceTypes?: readonly string[]): MinionResourceGrants | null;
142
+ /**
143
+ * The authored grants a minion's DATABASE ROLE is minted from: its declaration, or an EMPTY grant when it declared
144
+ * none (#1771). Never `null`, because every minion holds a database role: it runs the full backend startup, which
145
+ * connects the application's store, and its tick consumer maintains the engine's execution tables. The empty grant
146
+ * is what `deriveMinionDatabaseGrants` widens to the engine floor only, so a minion that declared nothing is granted
147
+ * the framework's own tables and no business table.
148
+ *
149
+ * The network and environment side reads the same rule (`resolveRuntimeBackingServiceAccess` gives every minion the
150
+ * database route), and a test holds the two to each other. Object storage is NOT derived from this: its prefixes come
151
+ * from {@link deriveMinionResourceGrants}, whose `null` stays an empty prefix set.
152
+ */
153
+ export declare function deriveMinionDatabaseRoleResourceGrants(resourceAccess: {
154
+ read?: readonly string[] | undefined;
155
+ write?: readonly string[] | undefined;
156
+ } | undefined): MinionResourceGrants;
142
157
  /**
143
158
  * Translate a grant axis into the STORAGE names one adapter will grant on.
144
159
  *
@@ -183,6 +198,11 @@ export declare function resolveGrantStorageNames(resourceTypes: readonly Resourc
183
198
  * provider credential an agent calls with), so its data-key ring reads every WRAPPED data key at boot, and it
184
199
  * reserves seals and issues a data key when it seals one itself. Unwrapping still needs the platform custodian,
185
200
  * which admits only the runtimes the `sealed_secrets` purpose names; a wrapped key read here opens nothing alone.
201
+ * - **`APPLICATION_PROVIDER_CREDENTIALS`, read/maintain (#3398).** The application's own stored OAuth2 grant. A minion
202
+ * resolving any APPLICATION-owned call to a provider with an OAuth2 client asks the grant store first (absent, it reads
203
+ * the environment as before), so without the read every such call of a self-managed minion would be refused at the
204
+ * database. It renews the grant when it expires and writes the rotated refresh token back (maintain); it never creates
205
+ * or deletes one, which only the backend's connect door does. The value is sealed: the read opens nothing alone.
186
206
  *
187
207
  * These framework operations bypass the in-process `resourceAccess` whitelist by construction —
188
208
  * `MinionScopedServicesRegistryHandlerBackendService` decorates the minion's
@@ -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;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,eAAO,MAAM,2CAA2C,EAAE,SAAS,YAAY,EACsG,CAAC;AAEtL,gFAAgF;AAChF,eAAO,MAAM,6CAA6C,EAAE,SAAS,YAAY,EAC0B,CAAC;AAE5G,0FAA0F;AAC1F,eAAO,MAAM,+CAA+C,EAAE,SAAS,YAAY,EAC8B,CAAC;AAElH;;;;;;;;;;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
+ {"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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AAS,MAAM,EAAE,GAAG,SAAS,CAAA;CAAE,GAAG,SAAS,GAC1G,oBAAoB,CAEtB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,EAAE,CAEzF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,eAAO,MAAM,2CAA2C,EAAE,SAAS,YAAY,EACyJ,CAAC;AAEzO,gFAAgF;AAChF,eAAO,MAAM,6CAA6C,EAAE,SAAS,YAAY,EAC0B,CAAC;AAE5G,0FAA0F;AAC1F,eAAO,MAAM,+CAA+C,EAAE,SAAS,YAAY,EACiF,CAAC;AAErK;;;;;;;;;;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"}
@@ -179,6 +179,20 @@ export function deriveMinionResourceGrants(resourceAccess, transitiveReadResourc
179
179
  write: normalize(resourceAccess.write ?? []),
180
180
  };
181
181
  }
182
+ /**
183
+ * The authored grants a minion's DATABASE ROLE is minted from: its declaration, or an EMPTY grant when it declared
184
+ * none (#1771). Never `null`, because every minion holds a database role: it runs the full backend startup, which
185
+ * connects the application's store, and its tick consumer maintains the engine's execution tables. The empty grant
186
+ * is what `deriveMinionDatabaseGrants` widens to the engine floor only, so a minion that declared nothing is granted
187
+ * the framework's own tables and no business table.
188
+ *
189
+ * The network and environment side reads the same rule (`resolveRuntimeBackingServiceAccess` gives every minion the
190
+ * database route), and a test holds the two to each other. Object storage is NOT derived from this: its prefixes come
191
+ * from {@link deriveMinionResourceGrants}, whose `null` stays an empty prefix set.
192
+ */
193
+ export function deriveMinionDatabaseRoleResourceGrants(resourceAccess) {
194
+ return deriveMinionResourceGrants(resourceAccess) ?? { read: [], write: [] };
195
+ }
182
196
  /**
183
197
  * Translate a grant axis into the STORAGE names one adapter will grant on.
184
198
  *
@@ -225,6 +239,11 @@ export function resolveGrantStorageNames(resourceTypes) {
225
239
  * provider credential an agent calls with), so its data-key ring reads every WRAPPED data key at boot, and it
226
240
  * reserves seals and issues a data key when it seals one itself. Unwrapping still needs the platform custodian,
227
241
  * which admits only the runtimes the `sealed_secrets` purpose names; a wrapped key read here opens nothing alone.
242
+ * - **`APPLICATION_PROVIDER_CREDENTIALS`, read/maintain (#3398).** The application's own stored OAuth2 grant. A minion
243
+ * resolving any APPLICATION-owned call to a provider with an OAuth2 client asks the grant store first (absent, it reads
244
+ * the environment as before), so without the read every such call of a self-managed minion would be refused at the
245
+ * database. It renews the grant when it expires and writes the rotated refresh token back (maintain); it never creates
246
+ * or deletes one, which only the backend's connect door does. The value is sealed: the read opens nothing alone.
228
247
  *
229
248
  * These framework operations bypass the in-process `resourceAccess` whitelist by construction —
230
249
  * `MinionScopedServicesRegistryHandlerBackendService` decorates the minion's
@@ -253,11 +272,11 @@ export function resolveGrantStorageNames(resourceTypes) {
253
272
  * assurance-control: WILDO.AUDIT.TAMPER_RESISTANCE — a named runtime principal may add
254
273
  * audit rows and may never modify or remove them, and may not be granted otherwise.
255
274
  */
256
- export const MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES = [CoreResourceType.APPLICATION, CoreResourceType.JOB_EXECUTIONS, CoreResourceType.JOB_PAYLOAD_STORAGE, CoreResourceType.APPLICATION_DATA_KEYS];
275
+ export const MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES = [CoreResourceType.APPLICATION, CoreResourceType.JOB_EXECUTIONS, CoreResourceType.JOB_PAYLOAD_STORAGE, CoreResourceType.APPLICATION_DATA_KEYS, CoreResourceType.APPLICATION_PROVIDER_CREDENTIALS];
257
276
  /** @see MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES — the append-only floor. */
258
277
  export const MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES = [CoreResourceType.AUDIT_LOGS, CoreResourceType.JOB_PAYLOAD_STORAGE];
259
278
  /** Insert and update durable execution state, without permission to erase its history. */
260
- export const MINION_ENGINE_MANDATORY_MAINTAIN_RESOURCE_TYPES = [CoreResourceType.JOB_EXECUTIONS, CoreResourceType.APPLICATION_DATA_KEYS];
279
+ export const MINION_ENGINE_MANDATORY_MAINTAIN_RESOURCE_TYPES = [CoreResourceType.JOB_EXECUTIONS, CoreResourceType.APPLICATION_DATA_KEYS, CoreResourceType.APPLICATION_PROVIDER_CREDENTIALS];
261
280
  /**
262
281
  * Add the engine floor to an authored derivation — the ONE place database grants
263
282
  * acquire it.
@@ -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,GAAsE;QAC9E,CAAC,iCAAiC,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,IAAI,EAAE,CAAC;QACnE,CAAC,iCAAiC,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,IAAI,EAAE,CAAC;KACtE,CAAC;IAEF,gGAAgG;IAChG,kGAAkG;IAClG,iGAAiG;IACjG,kGAAkG;IAClG,oGAAoG;IACpG,iGAAiG;IACjG,kGAAkG;IA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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 * - **`APPLICATION_DATA_KEYS`, read/maintain (#2894).** A minion opens the stored secrets the backend seals (a\n * provider credential an agent calls with), so its data-key ring reads every WRAPPED data key at boot, and it\n * reserves seals and issues a data key when it seals one itself. Unwrapping still needs the platform custodian,\n * which admits only the runtimes the `sealed_secrets` purpose names; a wrapped key read here opens nothing alone.\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, CoreResourceType.APPLICATION_DATA_KEYS] 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, CoreResourceType.APPLICATION_DATA_KEYS] 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,GAEv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,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 * The authored grants a minion's DATABASE ROLE is minted from: its declaration, or an EMPTY grant when it declared\n * none (#1771). Never `null`, because every minion holds a database role: it runs the full backend startup, which\n * connects the application's store, and its tick consumer maintains the engine's execution tables. The empty grant\n * is what `deriveMinionDatabaseGrants` widens to the engine floor only, so a minion that declared nothing is granted\n * the framework's own tables and no business table.\n *\n * The network and environment side reads the same rule (`resolveRuntimeBackingServiceAccess` gives every minion the\n * database route), and a test holds the two to each other. Object storage is NOT derived from this: its prefixes come\n * from {@link deriveMinionResourceGrants}, whose `null` stays an empty prefix set.\n */\nexport function deriveMinionDatabaseRoleResourceGrants(\n resourceAccess: { read?: readonly string[] | undefined; write?: readonly string[] | undefined } | undefined,\n): MinionResourceGrants {\n return deriveMinionResourceGrants(resourceAccess) ?? { read: [], write: [] };\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 * - **`APPLICATION_DATA_KEYS`, read/maintain (#2894).** A minion opens the stored secrets the backend seals (a\n * provider credential an agent calls with), so its data-key ring reads every WRAPPED data key at boot, and it\n * reserves seals and issues a data key when it seals one itself. Unwrapping still needs the platform custodian,\n * which admits only the runtimes the `sealed_secrets` purpose names; a wrapped key read here opens nothing alone.\n * - **`APPLICATION_PROVIDER_CREDENTIALS`, read/maintain (#3398).** The application's own stored OAuth2 grant. A minion\n * resolving any APPLICATION-owned call to a provider with an OAuth2 client asks the grant store first (absent, it reads\n * the environment as before), so without the read every such call of a self-managed minion would be refused at the\n * database. It renews the grant when it expires and writes the rotated refresh token back (maintain); it never creates\n * or deletes one, which only the backend's connect door does. The value is sealed: the read opens nothing alone.\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, CoreResourceType.APPLICATION_DATA_KEYS, CoreResourceType.APPLICATION_PROVIDER_CREDENTIALS] 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, CoreResourceType.APPLICATION_DATA_KEYS, CoreResourceType.APPLICATION_PROVIDER_CREDENTIALS] 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"}
@@ -1 +1 @@
1
- {"version":3,"file":"object-storage-session-policy.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/object-storage-session-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,IAAI,CAAC;AAgB5D,SAAS,sBAAsB,CAAC,MAAc;IAC5C,IAAI,CAAC,oCAAoC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,0EAA0E,MAAM,IAAI,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,6BAA6B,CAAC,aAAqB;IAC1D,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CACb,+EAA+E;cAC7E,8FAA8F,CACjG,CAAC;IACJ,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,SAAS,2BAA2B,CAAC,IAAY;IAC/C,+EAA+E;IAC/E,yDAAyD;IACzD,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,2EAA2E,IAAI,IAAI,CAAC,CAAC;IACvG,CAAC;IACD,OAAO,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AKtF,MAAM,UAAU,GAAG,+BAA+B,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IACjE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,uCAAuC,EAAE,IAAI,EAAE,UAAU,IAAI,uCAAuC,EAAE,CAAC;AACrI,CAAC","sourcesContent":["/**\n * The object-storage session policy — ONE description, shared by the party that\n * MINTS the credential and the party that VALIDATES a declaration against the\n * size limit.\n *\n * ## Why this lives here rather than on the broker\n *\n * It was a method on `ObjectStorageStsBrokerService` in apps-manager. Pure — no\n * I/O, no state — but unreachable from `minion-resource-access.validation.ts`,\n * which must refuse a `resourceAccess` declaration whose policy would not fit.\n * A validator computing length from its OWN model of the policy shape is a second\n * copy: change the entries here and the estimate silently drifts, so a declaration\n * passes validation and then fails at issuance — the very failure the check exists\n * to prevent, arriving through the check itself.\n *\n * `platform-config-lib` is contracts-and-helpers only, and both consumers already\n * depend on it (`saas-backend-lib` and `platform-infra-providers`), so no new\n * dependency edge was needed.\n */\n\n/**\n * The largest inline session policy an `AssumeRole` call will accept.\n *\n * **This is the MINIMUM across supported providers, not \"the MinIO limit\".** A\n * declaration valid anywhere must be valid everywhere, so the validator enforces\n * the tightest known ceiling. Today that is MinIO's, measured 2026-08-12 against a\n * live server by growing a policy until it refused:\n *\n * InvalidParameterValue Session policy should not exceed 2048 characters\n *\n * AWS S3 is NOT yet measured. Whoever measures it must LOWER this if AWS is\n * tighter — the name says \"session policy max\", not \"MinIO limit\", precisely so\n * that obligation is not read as somebody else's.\n */\nexport const OBJECT_STORAGE_SESSION_POLICY_MAX_CHARS = 2048;\n\nexport interface ObjectStorageSessionPolicyInput {\n bucket: string;\n /** Platform-minted. The application cannot influence it; that is the whole confinement. */\n applicationId: string;\n /**\n * Storage names (from `resolveGrantStorageNames`) to confine to, one prefix each.\n *\n * Omitted or empty ⇒ confine to the whole application subtree, which is what a\n * runtime holding an application-wide credential gets. Supplying names narrows\n * it per declared resource.\n */\n storageNames?: readonly string[];\n}\n\nfunction assertPolicySafeBucket(bucket: string): string {\n if (!/^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/.test(bucket)) {\n throw new Error(`Refusing to build a storage session policy for an invalid bucket name '${bucket}'.`);\n }\n return bucket;\n}\n\nfunction assertPolicySafeApplicationId(applicationId: string): string {\n if (!/^[a-f0-9]{24}$/i.test(applicationId)) {\n throw new Error(\n 'Refusing to build a storage session policy for a non-ObjectId application id '\n + '— an unconstrained value could widen the policy resource and grant cross-application access.',\n );\n }\n return applicationId;\n}\n\nfunction assertPolicySafeStorageName(name: string): string {\n // Same reasoning as the two above: anything reaching a policy resource must be\n // shape-constrained, or a crafted name widens the grant.\n if (!/^[a-z0-9][a-z0-9_-]{0,62}$/i.test(name)) {\n throw new Error(`Refusing to build a storage session policy for an invalid storage name '${name}'.`);\n }\n return name;\n}\n\n/**\n * Build the inline session policy document.\n *\n * ## The `*applications/` collapse\n *\n * One pattern per confinement, not two. An application may author a\n * `bucketPrefix`, so a key is either `applications/<id>/…` or\n * `<authored>/applications/<id>/…`. This used to be covered by TWO entries; a\n * single leading `*` (which matches zero-or-more characters) covers both.\n *\n * That halves the policy — measured 308 → 154 characters per declared resource,\n * which against the 2048 ceiling is the difference between ~5 and ~12 resources.\n * At the two-entry size a plausible minion (todos, lists, tags, users,\n * organizations) is already at the limit, so this is a PREREQUISITE for\n * per-resource confinement rather than an optimisation.\n *\n * Accepted residual: `*applications/` also matches `…/xapplications/<id>/`, so\n * another application could deliberately place an object inside its OWN subtree at\n * a crafted path that this credential could read. That is one application choosing\n * to expose its own bytes — reachable by any other channel too — and the direction\n * that would matter (writing INTO another application's read path) stays closed,\n * because a writer can only produce keys containing its own id.\n *\n * ## Why it keys on `applicationId` and never on the authored prefix\n *\n * `applicationId` is platform-minted and the application cannot influence it. The\n * authored `bucketPrefix` is app-owned, so deriving the policy from it would let an\n * application move its own boundary — and would create a second, independently\n * updated copy of a value the client already derives for itself.\n *\n * ## Enumeration is confined separately\n *\n * A prefix on the object ARNs does not restrict `ListBucket`. Without the\n * `s3:prefix` condition below, a principal could enumerate every key in the bucket\n * — filenames, application ids, file ids — while unable to read any of them.\n *\n * NOTE `s3:ListBucketMultipartUploads` is deliberately absent: MinIO rejects\n * `s3:prefix` as a condition key for it outright, so it cannot be confined at all.\n * The storage provider avoids the multipart branch instead of authorising it.\n */\nexport function buildObjectStorageSessionPolicy(input: ObjectStorageSessionPolicyInput): string {\n const bucket = assertPolicySafeBucket(input.bucket);\n const applicationId = assertPolicySafeApplicationId(input.applicationId);\n const names = (input.storageNames ?? []).map(assertPolicySafeStorageName);\n\n const confinements = names.length > 0\n ? names.map((name) => `*applications/${applicationId}/files/${name}/`)\n : [`*applications/${applicationId}/`];\n\n return JSON.stringify({\n Version: '2012-10-17',\n Statement: [\n {\n Effect: 'Allow',\n Action: ['s3:GetObject', 's3:PutObject', 's3:DeleteObject'],\n Resource: confinements.map((prefix) => `arn:aws:s3:::${bucket}/${prefix}*`),\n },\n {\n Effect: 'Allow',\n Action: ['s3:ListBucket'],\n Resource: [`arn:aws:s3:::${bucket}`],\n Condition: { StringLike: { 's3:prefix': confinements.map((prefix) => `${prefix}*`) } },\n },\n ],\n });\n}\n\n/**\n * Whether a declaration's policy would fit, and by how much.\n *\n * Exposed so a declaration validator measures the REAL document rather than\n * modelling its shape — the whole reason this module exists.\n */\nexport function measureObjectStorageSessionPolicy(input: ObjectStorageSessionPolicyInput): {\n characters: number;\n limit: number;\n fits: boolean;\n} {\n const characters = buildObjectStorageSessionPolicy(input).length;\n return { characters, limit: OBJECT_STORAGE_SESSION_POLICY_MAX_CHARS, fits: characters <= OBJECT_STORAGE_SESSION_POLICY_MAX_CHARS };\n}\n"]}
1
+ {"version":3,"file":"object-storage-session-policy.js","sourceRoot":"","sources":["../../../../src/project-config/shared/object-storage-session-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG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CAAC,CAAC;IAExC,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE;YACT;gBACE,MAAM,EAAE,OAAO;gBACf,MAAM,EAAE,CAAC,cAAc,EAAE,cAAc,EAAE,iBAAiB,CAAC;gBAC3D,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,MAAM,IAAI,MAAM,GAAG,CAAC;aAC5E;YACD;gBACE,MAAM,EAAE,OAAO;gBACf,MAAM,EAAE,CAAC,eAAe,CAAC;gBACzB,QAAQ,EAAE,CAAC,gBAAgB,MAAM,EAAE,CAAC;gBACpC,SAAS,EAAE,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,EAAE;aACvF;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAAC,KAAsC;IAKtF,MAAM,UAAU,GAAG,+BAA+B,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IACjE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,uCAAuC,EAAE,IAAI,EAAE,UAAU,IAAI,uCAAuC,EAAE,CAAC;AACrI,CAAC","sourcesContent":["/**\n * The object-storage session policy — ONE description, shared by the party that\n * MINTS the credential and the party that VALIDATES a declaration against the\n * size limit.\n *\n * ## Why this lives here rather than on the broker\n *\n * It was a method on `ObjectStorageStsBrokerService` in apps-manager. Pure — no\n * I/O, no state — but unreachable from `minion-resource-access.validation.ts`,\n * which must refuse a `resourceAccess` declaration whose policy would not fit.\n * A validator computing length from its OWN model of the policy shape is a second\n * copy: change the entries here and the estimate silently drifts, so a declaration\n * passes validation and then fails at issuance — the very failure the check exists\n * to prevent, arriving through the check itself.\n *\n * `platform-config-lib` is contracts-and-helpers only, and both consumers already\n * depend on it (`saas-backend-lib` and `platform-infra-providers`), so no new\n * dependency edge was needed.\n */\n\n/**\n * The largest inline session policy an `AssumeRole` call will accept.\n *\n * **This is the MINIMUM across supported providers, not \"the MinIO limit\".** A\n * declaration valid anywhere must be valid everywhere, so the validator enforces\n * the tightest known ceiling. Today that is MinIO's, measured 2026-08-12 against a\n * live server by growing a policy until it refused:\n *\n * InvalidParameterValue Session policy should not exceed 2048 characters\n *\n * AWS S3 is NOT yet measured. Whoever measures it must LOWER this if AWS is\n * tighter — the name says \"session policy max\", not \"MinIO limit\", precisely so\n * that obligation is not read as somebody else's.\n */\nexport const OBJECT_STORAGE_SESSION_POLICY_MAX_CHARS = 2048;\n\nexport interface ObjectStorageSessionPolicyInput {\n bucket: string;\n /** Platform-minted. The application cannot influence it; that is the whole confinement. */\n applicationId: string;\n /**\n * Storage names (from `resolveGrantStorageNames`) to confine to, one prefix each.\n *\n * Omitted or empty ⇒ confine to the whole application subtree, which is what a\n * runtime holding an application-wide credential gets. Supplying names narrows\n * it per declared resource.\n */\n storageNames?: readonly string[];\n}\n\nfunction assertPolicySafeBucket(bucket: string): string {\n if (!/^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/.test(bucket)) {\n throw new Error(`Refusing to build a storage session policy for an invalid bucket name '${bucket}'.`);\n }\n return bucket;\n}\n\nfunction assertPolicySafeApplicationId(applicationId: string): string {\n if (!/^[a-f0-9]{24}$/i.test(applicationId)) {\n throw new Error(\n 'Refusing to build a storage session policy for a non-ObjectId application id '\n + '— an unconstrained value could widen the policy resource and grant cross-application access.',\n );\n }\n return applicationId;\n}\n\nfunction assertPolicySafeStorageName(name: string): string {\n // Same reasoning as the two above: anything reaching a policy resource must be\n // shape-constrained, or a crafted name widens the grant.\n if (!/^[a-z0-9][a-z0-9_-]{0,62}$/i.test(name)) {\n throw new Error(`Refusing to build a storage session policy for an invalid storage name '${name}'.`);\n }\n return name;\n}\n\n/**\n * Build the inline session policy document.\n *\n * ## The `*applications/` collapse\n *\n * One pattern per confinement, not two. An application may author a\n * `bucketPrefix`, so a key is either `applications/<id>/…` or\n * `<authored>/applications/<id>/…`. This used to be covered by TWO entries; a\n * single leading `*` (which matches zero-or-more characters) covers both.\n *\n * That halves the policy — measured 308 → 154 characters per declared resource,\n * which against the 2048 ceiling is the difference between ~5 and ~12 resources.\n * At the two-entry size a plausible minion (todos, lists, tags, users,\n * organizations) is already at the limit, so this is a PREREQUISITE for\n * per-resource confinement rather than an optimisation.\n *\n * Accepted residual: `*applications/` also matches `…/xapplications/<id>/`, so\n * another application could deliberately place an object inside its OWN subtree at\n * a crafted path that this credential could read. That is one application choosing\n * to expose its own bytes — reachable by any other channel too — and the direction\n * that would matter (writing INTO another application's read path) stays closed,\n * because a writer can only produce keys containing its own id.\n *\n * ## Why it keys on `applicationId` and never on the authored prefix\n *\n * `applicationId` is platform-minted and the application cannot influence it. The\n * authored `bucketPrefix` is app-owned, so deriving the policy from it would let an\n * application move its own boundary — and would create a second, independently\n * updated copy of a value the client already derives for itself.\n *\n * ## Enumeration is confined separately\n *\n * A prefix on the object ARNs does not restrict `ListBucket`. Without the\n * `s3:prefix` condition below, a principal could enumerate every key in the bucket\n * — filenames, application ids, file ids — while unable to read any of them.\n *\n * NOTE `s3:ListBucketMultipartUploads` is deliberately absent: MinIO rejects\n * `s3:prefix` as a condition key for it outright, so it cannot be confined at all.\n * The storage provider avoids the multipart branch instead of authorising it.\n */\nexport function buildObjectStorageSessionPolicy(input: ObjectStorageSessionPolicyInput): string {\n const bucket = assertPolicySafeBucket(input.bucket);\n const applicationId = assertPolicySafeApplicationId(input.applicationId);\n const names = (input.storageNames ?? []).map(assertPolicySafeStorageName);\n\n const confinements = names.length > 0\n ? names.map((name) => `*applications/${applicationId}/files/${name}/`)\n : [`*applications/${applicationId}/`];\n\n return JSON.stringify({\n Version: '2012-10-17',\n Statement: [\n {\n Effect: 'Allow',\n Action: ['s3:GetObject', 's3:PutObject', 's3:DeleteObject'],\n Resource: confinements.map((prefix) => `arn:aws:s3:::${bucket}/${prefix}*`),\n },\n {\n Effect: 'Allow',\n Action: ['s3:ListBucket'],\n Resource: [`arn:aws:s3:::${bucket}`],\n Condition: { StringLike: { 's3:prefix': confinements.map((prefix) => `${prefix}*`) } },\n },\n ],\n });\n}\n\n/**\n * Whether a declaration's policy would fit, and by how much.\n *\n * Exposed so a declaration validator measures the REAL document rather than\n * modelling its shape — the whole reason this module exists.\n */\nexport function measureObjectStorageSessionPolicy(input: ObjectStorageSessionPolicyInput): {\n characters: number;\n limit: number;\n fits: boolean;\n} {\n const characters = buildObjectStorageSessionPolicy(input).length;\n return { characters, limit: OBJECT_STORAGE_SESSION_POLICY_MAX_CHARS, fits: characters <= OBJECT_STORAGE_SESSION_POLICY_MAX_CHARS };\n}\n"]}