@wildo-ai/platform-config-lib 1.1.10 → 1.1.12

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 (396) 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 +83 -0
  6. package/dist/esm/blueprint/anchored-region.d.ts.map +1 -0
  7. package/dist/esm/blueprint/anchored-region.js +263 -0
  8. package/dist/esm/blueprint/anchored-region.js.map +1 -0
  9. package/dist/esm/blueprint/blueprint.schemas.d.ts +600 -0
  10. package/dist/esm/blueprint/blueprint.schemas.d.ts.map +1 -0
  11. package/dist/esm/blueprint/blueprint.schemas.js +638 -0
  12. package/dist/esm/blueprint/blueprint.schemas.js.map +1 -0
  13. package/dist/esm/bootstrap/application-backend-env.contracts.js.map +1 -1
  14. package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts.map +1 -1
  15. package/dist/esm/bootstrap/application-creation-verification-env.contracts.js.map +1 -1
  16. package/dist/esm/bootstrap/bootstrap-planner.js.map +1 -1
  17. package/dist/esm/bootstrap/bootstrap.contracts.d.ts +13 -1
  18. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  19. package/dist/esm/bootstrap/bootstrap.contracts.js +6 -0
  20. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  21. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +29 -4
  22. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  23. package/dist/esm/bootstrap/bootstrap.schemas.js +29 -4
  24. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  25. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +131 -2
  26. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  27. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +139 -2
  28. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  29. package/dist/esm/bootstrap/platform-store-preconnect.d.ts +21 -0
  30. package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -1
  31. package/dist/esm/bootstrap/platform-store-preconnect.js +25 -0
  32. package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -1
  33. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts +80 -0
  34. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts.map +1 -0
  35. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js +81 -0
  36. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js.map +1 -0
  37. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts +41 -9
  38. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
  39. package/dist/esm/bootstrap/runtime-backing-service-access.js +77 -28
  40. package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
  41. package/dist/esm/bootstrap/runtime-network-policy.d.ts +117 -12
  42. package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
  43. package/dist/esm/bootstrap/runtime-network-policy.js +222 -23
  44. package/dist/esm/bootstrap/runtime-network-policy.js.map +1 -1
  45. package/dist/esm/bootstrap/runtime-network-topology.d.ts +31 -4
  46. package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
  47. package/dist/esm/bootstrap/runtime-network-topology.js +43 -2
  48. package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
  49. package/dist/esm/bootstrap/runtime-platform-access.js.map +1 -1
  50. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts +40 -2
  51. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
  52. package/dist/esm/bootstrap/runtime-principal.contracts.js +66 -3
  53. package/dist/esm/bootstrap/runtime-principal.contracts.js.map +1 -1
  54. package/dist/esm/bootstrap/runtime-response-integrity.d.ts +249 -0
  55. package/dist/esm/bootstrap/runtime-response-integrity.d.ts.map +1 -0
  56. package/dist/esm/bootstrap/runtime-response-integrity.js +353 -0
  57. package/dist/esm/bootstrap/runtime-response-integrity.js.map +1 -0
  58. package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts +32 -0
  59. package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts.map +1 -0
  60. package/dist/esm/bootstrap/runtime-secret-env.contracts.js +43 -0
  61. package/dist/esm/bootstrap/runtime-secret-env.contracts.js.map +1 -0
  62. package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
  63. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
  64. package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts +51 -0
  65. package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts.map +1 -0
  66. package/dist/esm/canonical-json/rfc8785-canonical-json.js +231 -0
  67. package/dist/esm/canonical-json/rfc8785-canonical-json.js.map +1 -0
  68. package/dist/esm/config-authoring.entry.js.map +1 -1
  69. package/dist/esm/credentials/credential-generator.service.d.ts.map +1 -1
  70. package/dist/esm/credentials/credential-generator.service.js.map +1 -1
  71. package/dist/esm/index.d.ts +20 -1
  72. package/dist/esm/index.d.ts.map +1 -1
  73. package/dist/esm/index.js +20 -1
  74. package/dist/esm/index.js.map +1 -1
  75. package/dist/esm/key-management/application-legacy-envelope-key.contracts.d.ts +119 -0
  76. package/dist/esm/key-management/application-legacy-envelope-key.contracts.d.ts.map +1 -0
  77. package/dist/esm/key-management/application-legacy-envelope-key.contracts.js +109 -0
  78. package/dist/esm/key-management/application-legacy-envelope-key.contracts.js.map +1 -0
  79. package/dist/esm/key-management/application-signing-key-rotation.contracts.d.ts +182 -0
  80. package/dist/esm/key-management/application-signing-key-rotation.contracts.d.ts.map +1 -0
  81. package/dist/esm/key-management/application-signing-key-rotation.contracts.js +145 -0
  82. package/dist/esm/key-management/application-signing-key-rotation.contracts.js.map +1 -0
  83. package/dist/esm/key-management/approval-seal-manifested-copy.d.ts +156 -0
  84. package/dist/esm/key-management/approval-seal-manifested-copy.d.ts.map +1 -0
  85. package/dist/esm/key-management/approval-seal-manifested-copy.js +617 -0
  86. package/dist/esm/key-management/approval-seal-manifested-copy.js.map +1 -0
  87. package/dist/esm/key-management/approval-seal-verifier.d.ts +278 -0
  88. package/dist/esm/key-management/approval-seal-verifier.d.ts.map +1 -0
  89. package/dist/esm/key-management/approval-seal-verifier.js +355 -0
  90. package/dist/esm/key-management/approval-seal-verifier.js.map +1 -0
  91. package/dist/esm/key-management/approval-seal.contracts.d.ts +128 -0
  92. package/dist/esm/key-management/approval-seal.contracts.d.ts.map +1 -0
  93. package/dist/esm/key-management/approval-seal.contracts.js +135 -0
  94. package/dist/esm/key-management/approval-seal.contracts.js.map +1 -0
  95. package/dist/esm/key-management/data-key.contracts.d.ts +106 -0
  96. package/dist/esm/key-management/data-key.contracts.d.ts.map +1 -0
  97. package/dist/esm/key-management/data-key.contracts.js +54 -0
  98. package/dist/esm/key-management/data-key.contracts.js.map +1 -0
  99. package/dist/esm/key-management/es256-jws.d.ts +60 -0
  100. package/dist/esm/key-management/es256-jws.d.ts.map +1 -0
  101. package/dist/esm/key-management/es256-jws.js +135 -0
  102. package/dist/esm/key-management/es256-jws.js.map +1 -0
  103. package/dist/esm/key-management/key-provider.spi.d.ts +158 -0
  104. package/dist/esm/key-management/key-provider.spi.d.ts.map +1 -0
  105. package/dist/esm/key-management/key-provider.spi.js +38 -0
  106. package/dist/esm/key-management/key-provider.spi.js.map +1 -0
  107. package/dist/esm/key-management/keyring-rotation.contracts.d.ts +83 -0
  108. package/dist/esm/key-management/keyring-rotation.contracts.d.ts.map +1 -0
  109. package/dist/esm/key-management/keyring-rotation.contracts.js +101 -0
  110. package/dist/esm/key-management/keyring-rotation.contracts.js.map +1 -0
  111. package/dist/esm/key-management/keyring-status.contracts.d.ts +59 -0
  112. package/dist/esm/key-management/keyring-status.contracts.d.ts.map +1 -0
  113. package/dist/esm/key-management/keyring-status.contracts.js +45 -0
  114. package/dist/esm/key-management/keyring-status.contracts.js.map +1 -0
  115. package/dist/esm/key-management/pdf-incremental-update.d.ts +158 -0
  116. package/dist/esm/key-management/pdf-incremental-update.d.ts.map +1 -0
  117. package/dist/esm/key-management/pdf-incremental-update.js +730 -0
  118. package/dist/esm/key-management/pdf-incremental-update.js.map +1 -0
  119. package/dist/esm/key-management/pdf-truetype-font.d.ts +35 -0
  120. package/dist/esm/key-management/pdf-truetype-font.d.ts.map +1 -0
  121. package/dist/esm/key-management/pdf-truetype-font.js +152 -0
  122. package/dist/esm/key-management/pdf-truetype-font.js.map +1 -0
  123. package/dist/esm/key-management/qr-code.d.ts +38 -0
  124. package/dist/esm/key-management/qr-code.d.ts.map +1 -0
  125. package/dist/esm/key-management/qr-code.js +325 -0
  126. package/dist/esm/key-management/qr-code.js.map +1 -0
  127. package/dist/esm/key-management/signature-request.contracts.d.ts +91 -0
  128. package/dist/esm/key-management/signature-request.contracts.d.ts.map +1 -0
  129. package/dist/esm/key-management/signature-request.contracts.js +96 -0
  130. package/dist/esm/key-management/signature-request.contracts.js.map +1 -0
  131. package/dist/esm/key-management/signing-log-export.contracts.d.ts +215 -0
  132. package/dist/esm/key-management/signing-log-export.contracts.d.ts.map +1 -0
  133. package/dist/esm/key-management/signing-log-export.contracts.js +268 -0
  134. package/dist/esm/key-management/signing-log-export.contracts.js.map +1 -0
  135. package/dist/esm/key-management/vault-custody.contracts.d.ts +98 -0
  136. package/dist/esm/key-management/vault-custody.contracts.d.ts.map +1 -0
  137. package/dist/esm/key-management/vault-custody.contracts.js +154 -0
  138. package/dist/esm/key-management/vault-custody.contracts.js.map +1 -0
  139. package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -1
  140. package/dist/esm/lockfile/build-parallelism.js.map +1 -1
  141. package/dist/esm/lockfile/canonical-json.d.ts +1 -1
  142. package/dist/esm/lockfile/canonical-json.d.ts.map +1 -1
  143. package/dist/esm/lockfile/canonical-json.js +1 -1
  144. package/dist/esm/lockfile/canonical-json.js.map +1 -1
  145. package/dist/esm/lockfile/file-lock-hold.d.ts.map +1 -1
  146. package/dist/esm/lockfile/file-lock-hold.js +2 -1
  147. package/dist/esm/lockfile/file-lock-hold.js.map +1 -1
  148. package/dist/esm/lockfile/lockfile-io.d.ts +13 -17
  149. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
  150. package/dist/esm/lockfile/lockfile-io.js +29 -30
  151. package/dist/esm/lockfile/lockfile-io.js.map +1 -1
  152. package/dist/esm/lockfile/materialize-infra-section.d.ts +22 -20
  153. package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
  154. package/dist/esm/lockfile/materialize-infra-section.js +13 -14
  155. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  156. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +27 -249
  157. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
  158. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +28 -3
  159. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
  160. package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts +146 -0
  161. package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts.map +1 -0
  162. package/dist/esm/pnpm-settings/application-pnpm-settings.js +573 -0
  163. package/dist/esm/pnpm-settings/application-pnpm-settings.js.map +1 -0
  164. package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -1
  165. package/dist/esm/project-config/application-public-pricing-catalog.loader.js +22 -3
  166. package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -1
  167. package/dist/esm/project-config/application-served-public-documents.loader.d.ts +26 -0
  168. package/dist/esm/project-config/application-served-public-documents.loader.d.ts.map +1 -0
  169. package/dist/esm/project-config/application-served-public-documents.loader.js +86 -0
  170. package/dist/esm/project-config/application-served-public-documents.loader.js.map +1 -0
  171. package/dist/esm/project-config/backend-compliance-section.reader.d.ts +35 -0
  172. package/dist/esm/project-config/backend-compliance-section.reader.d.ts.map +1 -0
  173. package/dist/esm/project-config/backend-compliance-section.reader.js +123 -0
  174. package/dist/esm/project-config/backend-compliance-section.reader.js.map +1 -0
  175. package/dist/esm/project-config/backend-compliance-section.worker.d.ts +20 -0
  176. package/dist/esm/project-config/backend-compliance-section.worker.d.ts.map +1 -0
  177. package/dist/esm/project-config/backend-compliance-section.worker.js +78 -0
  178. package/dist/esm/project-config/backend-compliance-section.worker.js.map +1 -0
  179. package/dist/esm/project-config/config-module-resolution.d.ts +32 -0
  180. package/dist/esm/project-config/config-module-resolution.d.ts.map +1 -0
  181. package/dist/esm/project-config/config-module-resolution.js +33 -0
  182. package/dist/esm/project-config/config-module-resolution.js.map +1 -0
  183. package/dist/esm/project-config/define-framework-config.js.map +1 -1
  184. package/dist/esm/project-config/define-infra-env-config.d.ts +344 -69
  185. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  186. package/dist/esm/project-config/define-infra-env-config.js +194 -143
  187. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  188. package/dist/esm/project-config/define-minion-config.d.ts +26 -36
  189. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  190. package/dist/esm/project-config/define-minion-config.js +64 -25
  191. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  192. package/dist/esm/project-config/define-saas-config.d.ts +82 -348
  193. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  194. package/dist/esm/project-config/define-saas-config.js +262 -103
  195. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  196. package/dist/esm/project-config/define-worker-config.d.ts +10 -20
  197. package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
  198. package/dist/esm/project-config/define-worker-config.js +10 -12
  199. package/dist/esm/project-config/define-worker-config.js.map +1 -1
  200. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -1
  201. package/dist/esm/project-config/hosted-infra-env-config.js +4 -1
  202. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
  203. package/dist/esm/project-config/index.d.ts +5 -0
  204. package/dist/esm/project-config/index.d.ts.map +1 -1
  205. package/dist/esm/project-config/index.js +5 -0
  206. package/dist/esm/project-config/index.js.map +1 -1
  207. package/dist/esm/project-config/loader-instances-zod.d.ts +19 -0
  208. package/dist/esm/project-config/loader-instances-zod.d.ts.map +1 -0
  209. package/dist/esm/project-config/loader-instances-zod.js +40 -0
  210. package/dist/esm/project-config/loader-instances-zod.js.map +1 -0
  211. package/dist/esm/project-config/loader.d.ts +131 -14
  212. package/dist/esm/project-config/loader.d.ts.map +1 -1
  213. package/dist/esm/project-config/loader.js +226 -12
  214. package/dist/esm/project-config/loader.js.map +1 -1
  215. package/dist/esm/project-config/minion-liveness.contracts.d.ts +131 -0
  216. package/dist/esm/project-config/minion-liveness.contracts.d.ts.map +1 -0
  217. package/dist/esm/project-config/minion-liveness.contracts.js +167 -0
  218. package/dist/esm/project-config/minion-liveness.contracts.js.map +1 -0
  219. package/dist/esm/project-config/minion-local-provider-registration.d.ts.map +1 -1
  220. package/dist/esm/project-config/minion-local-provider-registration.js.map +1 -1
  221. package/dist/esm/project-config/npm-version-range.d.ts.map +1 -1
  222. package/dist/esm/project-config/npm-version-range.js +39 -16
  223. package/dist/esm/project-config/npm-version-range.js.map +1 -1
  224. package/dist/esm/project-config/owning-package-tsconfig.d.ts +15 -0
  225. package/dist/esm/project-config/owning-package-tsconfig.d.ts.map +1 -0
  226. package/dist/esm/project-config/owning-package-tsconfig.js +29 -0
  227. package/dist/esm/project-config/owning-package-tsconfig.js.map +1 -0
  228. package/dist/esm/project-config/provider-catalog-types.js.map +1 -1
  229. package/dist/esm/project-config/provider-companion-discovery.d.ts +4 -4
  230. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  231. package/dist/esm/project-config/provider-companion-discovery.js +16 -10
  232. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  233. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +103 -49
  234. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  235. package/dist/esm/project-config/provider-runtime-artifacts.js +216 -16
  236. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  237. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts +0 -2
  238. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
  239. package/dist/esm/project-config/shared/application-creation-verification.schemas.js.map +1 -1
  240. package/dist/esm/project-config/shared/application-modules.schemas.js.map +1 -1
  241. package/dist/esm/project-config/shared/application-modules.utils.js.map +1 -1
  242. package/dist/esm/project-config/shared/auth.schemas.d.ts +0 -17
  243. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
  244. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
  245. package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -1
  246. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +9 -10
  247. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  248. package/dist/esm/project-config/shared/backing-services.schemas.js +13 -15
  249. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  250. package/dist/esm/project-config/shared/cdn.schemas.d.ts +0 -51
  251. package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
  252. package/dist/esm/project-config/shared/cdn.schemas.js.map +1 -1
  253. package/dist/esm/project-config/shared/csp-defaults.d.ts +36 -9
  254. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
  255. package/dist/esm/project-config/shared/csp-defaults.js +54 -11
  256. package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
  257. package/dist/esm/project-config/shared/csp-emit.d.ts +60 -13
  258. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
  259. package/dist/esm/project-config/shared/csp-emit.js +77 -24
  260. package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
  261. package/dist/esm/project-config/shared/csp.schemas.d.ts +72 -85
  262. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  263. package/dist/esm/project-config/shared/csp.schemas.js +40 -13
  264. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  265. package/dist/esm/project-config/shared/data-services.schemas.d.ts +0 -8
  266. package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
  267. package/dist/esm/project-config/shared/data-services.schemas.js.map +1 -1
  268. package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
  269. package/dist/esm/project-config/shared/env-example-defaults.js.map +1 -1
  270. package/dist/esm/project-config/shared/environment.schemas.d.ts +101 -8
  271. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  272. package/dist/esm/project-config/shared/environment.schemas.js +128 -9
  273. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  274. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +10 -4
  275. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  276. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  277. package/dist/esm/project-config/shared/infra-service.schemas.js.map +1 -1
  278. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +2 -1
  279. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  280. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +4 -1
  281. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  282. package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
  283. package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
  284. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
  285. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
  286. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +24 -0
  287. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
  288. package/dist/esm/project-config/shared/minion-resource-access.validation.js +25 -2
  289. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
  290. package/dist/esm/project-config/shared/object-storage-session-policy.d.ts.map +1 -1
  291. package/dist/esm/project-config/shared/object-storage-session-policy.js.map +1 -1
  292. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts +276 -0
  293. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts.map +1 -0
  294. package/dist/esm/project-config/shared/platform-key-management.schemas.js +296 -0
  295. package/dist/esm/project-config/shared/platform-key-management.schemas.js.map +1 -0
  296. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  297. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +2 -2
  298. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -1
  299. package/dist/esm/project-config/shared/platform-storage.schemas.js +16 -2
  300. package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -1
  301. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts +21 -23
  302. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
  303. package/dist/esm/project-config/shared/service-definitions.schemas.js +4 -5
  304. package/dist/esm/project-config/shared/service-definitions.schemas.js.map +1 -1
  305. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +0 -18
  306. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -1
  307. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -1
  308. package/dist/esm/project-config/static-asset-import-noop.d.ts +20 -3
  309. package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -1
  310. package/dist/esm/project-config/static-asset-import-noop.js +36 -20
  311. package/dist/esm/project-config/static-asset-import-noop.js.map +1 -1
  312. package/dist/esm/registry/artifact-domain.schemas.d.ts +0 -5
  313. package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
  314. package/dist/esm/registry/artifact-domain.schemas.js.map +1 -1
  315. package/dist/esm/registry/digest.schemas.js.map +1 -1
  316. package/dist/esm/registry/index.d.ts +3 -3
  317. package/dist/esm/registry/index.d.ts.map +1 -1
  318. package/dist/esm/registry/index.js +3 -3
  319. package/dist/esm/registry/index.js.map +1 -1
  320. package/dist/esm/registry/local-checkout-source.d.ts +22 -2
  321. package/dist/esm/registry/local-checkout-source.d.ts.map +1 -1
  322. package/dist/esm/registry/local-checkout-source.js +66 -3
  323. package/dist/esm/registry/local-checkout-source.js.map +1 -1
  324. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +11 -98
  325. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
  326. package/dist/esm/registry/lockfile-modules-section.schemas.js +1 -2
  327. package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
  328. package/dist/esm/registry/module-artifact.schemas.d.ts +40 -17
  329. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
  330. package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
  331. package/dist/esm/registry/module-manifest.schemas.d.ts +324 -74
  332. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  333. package/dist/esm/registry/module-manifest.schemas.js +377 -19
  334. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  335. package/dist/esm/registry/module-search.schemas.d.ts +2 -0
  336. package/dist/esm/registry/module-search.schemas.d.ts.map +1 -1
  337. package/dist/esm/registry/module-search.schemas.js +14 -1
  338. package/dist/esm/registry/module-search.schemas.js.map +1 -1
  339. package/dist/esm/registry/registry-config.schemas.d.ts +0 -18
  340. package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
  341. package/dist/esm/registry/registry-config.schemas.js.map +1 -1
  342. package/dist/esm/registry/registry-defaults.constants.d.ts.map +1 -1
  343. package/dist/esm/registry/registry-defaults.constants.js.map +1 -1
  344. package/dist/esm/registry/registry-errors.d.ts +103 -5
  345. package/dist/esm/registry/registry-errors.d.ts.map +1 -1
  346. package/dist/esm/registry/registry-errors.js +213 -6
  347. package/dist/esm/registry/registry-errors.js.map +1 -1
  348. package/dist/esm/registry/registry-keys.schemas.js.map +1 -1
  349. package/dist/esm/registry/registry-section-schemas.constants.d.ts +5 -0
  350. package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
  351. package/dist/esm/registry/registry-section-schemas.constants.js.map +1 -1
  352. package/dist/esm/registry/registry-url-resolution.d.ts +72 -0
  353. package/dist/esm/registry/registry-url-resolution.d.ts.map +1 -0
  354. package/dist/esm/registry/registry-url-resolution.js +157 -0
  355. package/dist/esm/registry/registry-url-resolution.js.map +1 -0
  356. package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
  357. package/dist/esm/release/framework-release.constants.js.map +1 -1
  358. package/dist/esm/schemas/framework-info.schemas.js.map +1 -1
  359. package/dist/esm/schemas/framework-secrets.schemas.d.ts +48 -0
  360. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  361. package/dist/esm/schemas/framework-secrets.schemas.js +53 -0
  362. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  363. package/dist/esm/schemas/platform-application-config.schemas.d.ts +1 -1
  364. package/dist/esm/schemas/platform-application-config.schemas.js.map +1 -1
  365. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts +1 -1
  366. package/dist/esm/schemas/platform-application-secrets.schemas.js.map +1 -1
  367. package/dist/esm/schemas/platform-config.schemas.d.ts +2 -2
  368. package/dist/esm/schemas/platform-config.schemas.js.map +1 -1
  369. package/dist/esm/workspace-scope/application-subject-manifest.js.map +1 -1
  370. package/dist/esm/workspace-scope/index.js.map +1 -1
  371. package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
  372. package/dist/esm/workspace-scope/resolve-homes.js.map +1 -1
  373. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  374. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  375. package/dist/esm/workspace-scope/workspace-scope-detector.d.ts.map +1 -1
  376. package/dist/esm/workspace-scope/workspace-scope-detector.js.map +1 -1
  377. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  378. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  379. package/dist/tsconfig.build.tsbuildinfo +1 -1
  380. package/package.json +12 -12
  381. package/dist/esm/_unimplemented/index.d.ts +0 -3
  382. package/dist/esm/_unimplemented/index.d.ts.map +0 -1
  383. package/dist/esm/_unimplemented/index.js +0 -3
  384. package/dist/esm/_unimplemented/index.js.map +0 -1
  385. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts +0 -137
  386. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts.map +0 -1
  387. package/dist/esm/_unimplemented/unimplemented-field-warning.js +0 -153
  388. package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +0 -1
  389. package/dist/esm/project-config/shared/cdn.example.d.ts +0 -14
  390. package/dist/esm/project-config/shared/cdn.example.d.ts.map +0 -1
  391. package/dist/esm/project-config/shared/cdn.example.js +0 -38
  392. package/dist/esm/project-config/shared/cdn.example.js.map +0 -1
  393. package/dist/esm/project-config/shared/schema-version.schemas.d.ts +0 -15
  394. package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +0 -1
  395. package/dist/esm/project-config/shared/schema-version.schemas.js +0 -40
  396. package/dist/esm/project-config/shared/schema-version.schemas.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { BackgroundRuntimeType } from '@wildo-ai/saas-models';
1
+ import { BackgroundRuntimeType, RuntimeEnvironment } from '@wildo-ai/saas-models';
2
2
  /**
3
3
  * WHOSE credentials are these? — the credential-principal axis.
4
4
  *
@@ -33,7 +33,23 @@ export declare enum ApplicationRuntimePrincipalKind {
33
33
  */
34
34
  APPLICATION_BACKEND = "application_backend",
35
35
  MINION = "minion",
36
- WORKER = "worker"
36
+ WORKER = "worker",
37
+ /**
38
+ * The application's development companion (#2941): the long-running local daemon that serves the workbench and
39
+ * runs the app-creation lane beside a developer's checkout.
40
+ *
41
+ * It used to present the BACKEND's `primarySecret`, so apps-manager could not tell it from the backend, and
42
+ * everything the backend may do on the platform (a platform-custody signature, a data key, the application's
43
+ * secrets blob) the companion, and any coding agent able to read its workspace `.env`, could do too.
44
+ *
45
+ * Like the backend it is nameless: an application has at most one companion. Unlike every other principal it is
46
+ * not DECLARED in `wildo.saas.config.ts`: it exists on a development platform only (production runs no companion),
47
+ * which is why {@link enumerateRuntimePrincipalsWithBootstrapSecrets} adds it from the platform's runtime
48
+ * environment rather than from the declaration. apps-manager admits it on the routes the companion calls and on
49
+ * no other, and it is in no key purpose's `heldBy` / `mayRequestSignature` / `mayRequestDataKeys`, so the signing
50
+ * and data-key proxies refuse it.
51
+ */
52
+ DEVELOPMENT_COMPANION = "development_companion"
37
53
  }
38
54
  /**
39
55
  * Map a deployable background-runtime kind onto its credential principal.
@@ -64,6 +80,17 @@ export interface ApplicationRuntimePrincipal {
64
80
  }
65
81
  /** The canonical backend principal — one per application, by definition. */
66
82
  export declare const APPLICATION_BACKEND_PRINCIPAL: ApplicationRuntimePrincipal;
83
+ /** The development companion's principal — at most one per application, so nameless like the backend (#2941). */
84
+ export declare const DEVELOPMENT_COMPANION_PRINCIPAL: ApplicationRuntimePrincipal;
85
+ /**
86
+ * Whether a platform running in `runtimeEnvironment` hosts development companions, and so mints each application a
87
+ * {@link ApplicationRuntimePrincipalKind.DEVELOPMENT_COMPANION} secret (#2941).
88
+ *
89
+ * Development only. A staging or production platform runs no companion, and minting it a credential anyway would leave
90
+ * one more secret able to authenticate at apps-manager with nothing that uses it. apps-manager reads its own
91
+ * `APPLICATION_ENV` (the platform is mono-environment) and the CLI reads the environment it bootstraps; both ask here.
92
+ */
93
+ export declare function runtimeEnvironmentHostsDevelopmentCompanion(runtimeEnvironment: RuntimeEnvironment | undefined): boolean;
67
94
  /**
68
95
  * Render a principal as a single stable string.
69
96
  *
@@ -106,6 +133,17 @@ export declare function enumerateDeclaredRuntimePrincipals(declaration: {
106
133
  minions?: Record<string, unknown> | undefined;
107
134
  workers?: Record<string, unknown> | undefined;
108
135
  }): ApplicationRuntimePrincipal[];
136
+ /**
137
+ * Every principal apps-manager mints a bootstrap secret for, other than the backend (whose secret is `primarySecret`):
138
+ * one per declared minion and worker, plus the development companion on a platform that hosts one (#2941).
139
+ *
140
+ * The ONE derivation both sides use. apps-manager mints exactly this set (and prunes any stored secret outside it), and
141
+ * the CLI fetches exactly this set, so a companion the platform never minted is never asked for, and a companion
142
+ * secret left over from a development era is revoked the moment the platform stops hosting companions.
143
+ */
144
+ export declare function enumerateRuntimePrincipalsWithBootstrapSecrets(declaration: Parameters<typeof enumerateDeclaredRuntimePrincipals>[0], options: {
145
+ hostsDevelopmentCompanion: boolean;
146
+ }): ApplicationRuntimePrincipal[];
109
147
  /**
110
148
  * The Redis key namespace a MINION owns (D20).
111
149
  *
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-principal.contracts.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/runtime-principal.contracts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,oBAAY,+BAA+B;IACzC;;;;;OAKG;IACH,mBAAmB,wBAAwB;IAC3C,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,qBAAqB,GACjC,+BAA+B,CAOjC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,+BAA+B,CAAC;IACtC,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,4EAA4E;AAC5E,eAAO,MAAM,6BAA6B,EAAE,2BAE3C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,2BAA2B,GAAG,MAAM,CAIvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,2BAA2B,GAAG,IAAI,CAaxF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kCAAkC,CAAC,WAAW,EAAE;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC/C,GAAG,2BAA2B,EAAE,CAYhC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAErF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sCAAsC,CACpD,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,+BAA+B,GAAG,SAAS,CAW7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iCAAiC,CAC/C,aAAa,EAAE,+BAA+B,GAAG,SAAS,EAC1D,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,MAAM,GAAG,SAAS,CAQpB"}
1
+ {"version":3,"file":"runtime-principal.contracts.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/runtime-principal.contracts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,oBAAY,+BAA+B;IACzC;;;;;OAKG;IACH,mBAAmB,wBAAwB;IAC3C,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB;;;;;;;;;;;;;;OAcG;IACH,qBAAqB,0BAA0B;CAChD;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,qBAAqB,GACjC,+BAA+B,CAOjC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,+BAA+B,CAAC;IACtC,8EAA8E;IAC9E,I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,EAAE,+BAA+B,GAAG,SAAS,EAC1D,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,MAAM,GAAG,SAAS,CAQpB"}
@@ -2,7 +2,7 @@
2
2
  // lives in the decorator-bound graph, not the browser-safe `/public-runtime`
3
3
  // atom subset. This module is platform/CLI-side only and never reaches a
4
4
  // browser bundle, so the root import costs nothing here.
5
- import { BackgroundRuntimeType } from '@wildo-ai/saas-models';
5
+ import { BackgroundRuntimeType, RuntimeEnvironment } from '@wildo-ai/saas-models';
6
6
  /**
7
7
  * WHOSE credentials are these? — the credential-principal axis.
8
8
  *
@@ -39,6 +39,22 @@ export var ApplicationRuntimePrincipalKind;
39
39
  ApplicationRuntimePrincipalKind["APPLICATION_BACKEND"] = "application_backend";
40
40
  ApplicationRuntimePrincipalKind["MINION"] = "minion";
41
41
  ApplicationRuntimePrincipalKind["WORKER"] = "worker";
42
+ /**
43
+ * The application's development companion (#2941): the long-running local daemon that serves the workbench and
44
+ * runs the app-creation lane beside a developer's checkout.
45
+ *
46
+ * It used to present the BACKEND's `primarySecret`, so apps-manager could not tell it from the backend, and
47
+ * everything the backend may do on the platform (a platform-custody signature, a data key, the application's
48
+ * secrets blob) the companion, and any coding agent able to read its workspace `.env`, could do too.
49
+ *
50
+ * Like the backend it is nameless: an application has at most one companion. Unlike every other principal it is
51
+ * not DECLARED in `wildo.saas.config.ts`: it exists on a development platform only (production runs no companion),
52
+ * which is why {@link enumerateRuntimePrincipalsWithBootstrapSecrets} adds it from the platform's runtime
53
+ * environment rather than from the declaration. apps-manager admits it on the routes the companion calls and on
54
+ * no other, and it is in no key purpose's `heldBy` / `mayRequestSignature` / `mayRequestDataKeys`, so the signing
55
+ * and data-key proxies refuse it.
56
+ */
57
+ ApplicationRuntimePrincipalKind["DEVELOPMENT_COMPANION"] = "development_companion";
42
58
  })(ApplicationRuntimePrincipalKind || (ApplicationRuntimePrincipalKind = {}));
43
59
  /**
44
60
  * Map a deployable background-runtime kind onto its credential principal.
@@ -60,6 +76,35 @@ export function principalKindForBackgroundRuntime(runtimeType) {
60
76
  export const APPLICATION_BACKEND_PRINCIPAL = {
61
77
  kind: ApplicationRuntimePrincipalKind.APPLICATION_BACKEND,
62
78
  };
79
+ /** The development companion's principal — at most one per application, so nameless like the backend (#2941). */
80
+ export const DEVELOPMENT_COMPANION_PRINCIPAL = {
81
+ kind: ApplicationRuntimePrincipalKind.DEVELOPMENT_COMPANION,
82
+ };
83
+ /**
84
+ * Whether a principal kind is a singleton per application, and therefore carries no name. ONE predicate shared by the
85
+ * key renderer and its parser, so the two cannot disagree about which kinds take a name segment.
86
+ */
87
+ function isNamelessRuntimePrincipalKind(kind) {
88
+ switch (kind) {
89
+ case ApplicationRuntimePrincipalKind.APPLICATION_BACKEND:
90
+ case ApplicationRuntimePrincipalKind.DEVELOPMENT_COMPANION:
91
+ return true;
92
+ case ApplicationRuntimePrincipalKind.MINION:
93
+ case ApplicationRuntimePrincipalKind.WORKER:
94
+ return false;
95
+ }
96
+ }
97
+ /**
98
+ * Whether a platform running in `runtimeEnvironment` hosts development companions, and so mints each application a
99
+ * {@link ApplicationRuntimePrincipalKind.DEVELOPMENT_COMPANION} secret (#2941).
100
+ *
101
+ * Development only. A staging or production platform runs no companion, and minting it a credential anyway would leave
102
+ * one more secret able to authenticate at apps-manager with nothing that uses it. apps-manager reads its own
103
+ * `APPLICATION_ENV` (the platform is mono-environment) and the CLI reads the environment it bootstraps; both ask here.
104
+ */
105
+ export function runtimeEnvironmentHostsDevelopmentCompanion(runtimeEnvironment) {
106
+ return runtimeEnvironment === RuntimeEnvironment.DEVELOPMENT;
107
+ }
63
108
  /**
64
109
  * Render a principal as a single stable string.
65
110
  *
@@ -75,8 +120,8 @@ export const APPLICATION_BACKEND_PRINCIPAL = {
75
120
  * boundary rather than resolving to the wrong principal.
76
121
  */
77
122
  export function buildRuntimePrincipalKey(principal) {
78
- return principal.kind === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND
79
- ? ApplicationRuntimePrincipalKind.APPLICATION_BACKEND
123
+ return isNamelessRuntimePrincipalKind(principal.kind)
124
+ ? principal.kind
80
125
  : `${principal.kind}:${principal.name ?? ''}`;
81
126
  }
82
127
  /**
@@ -92,6 +137,9 @@ export function parseRuntimePrincipalKey(key) {
92
137
  if (key === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND) {
93
138
  return APPLICATION_BACKEND_PRINCIPAL;
94
139
  }
140
+ if (key === ApplicationRuntimePrincipalKind.DEVELOPMENT_COMPANION) {
141
+ return DEVELOPMENT_COMPANION_PRINCIPAL;
142
+ }
95
143
  const separatorIndex = key.indexOf(':');
96
144
  if (separatorIndex <= 0)
97
145
  return null;
@@ -130,6 +178,21 @@ export function enumerateDeclaredRuntimePrincipals(declaration) {
130
178
  })),
131
179
  ];
132
180
  }
181
+ /**
182
+ * Every principal apps-manager mints a bootstrap secret for, other than the backend (whose secret is `primarySecret`):
183
+ * one per declared minion and worker, plus the development companion on a platform that hosts one (#2941).
184
+ *
185
+ * The ONE derivation both sides use. apps-manager mints exactly this set (and prunes any stored secret outside it), and
186
+ * the CLI fetches exactly this set, so a companion the platform never minted is never asked for, and a companion
187
+ * secret left over from a development era is revoked the moment the platform stops hosting companions.
188
+ */
189
+ export function enumerateRuntimePrincipalsWithBootstrapSecrets(declaration, options) {
190
+ return [
191
+ ...enumerateDeclaredRuntimePrincipals(declaration)
192
+ .filter((principal) => principal.kind !== ApplicationRuntimePrincipalKind.APPLICATION_BACKEND),
193
+ ...(options.hostsDevelopmentCompanion ? [DEVELOPMENT_COMPANION_PRINCIPAL] : []),
194
+ ];
195
+ }
133
196
  /**
134
197
  * The Redis key namespace a MINION owns (D20).
135
198
  *
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-principal.contracts.js","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-principal.contracts.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,yDAAyD;AACzD,OAAO,EAAE,qBAAqB,EA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;YACzC,OAAO,+BAA+B,CAAC,MAAM,CAAC;QAChD,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,+BAA+B,CAAC,MAAM,CAAC;QAChD;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,iCAAiC,CAC/C,aAA0D,EAC1D,aAAiC;IAEjC,IAAI,CAAC,aAAa,IAAI,aAAa,KAAK,+BAA+B,CAAC,mBAAmB,EAAE,CAAC;QAC5F,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IAC9E,gFAAgF;IAChF,MAAM,SAAS,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAC/F,OAAO,SAAS,CAAC,CAAC,CAAC,GAAG,aAAa,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC","sourcesContent":["// Root barrel, matching the sibling bootstrap files: `BackgroundRuntimeType`\n// lives in the decorator-bound graph, not the browser-safe `/public-runtime`\n// atom subset. This module is platform/CLI-side only and never reaches a\n// browser bundle, so the root import costs nothing here.\nimport { BackgroundRuntimeType } from '@wildo-ai/saas-models';\n\n/**\n * WHOSE credentials are these? — the credential-principal axis.\n *\n * Wildo now has three runtime-identity vocabularies and they answer three\n * different questions. They are deliberately NOT collapsed, even where their\n * members currently coincide:\n *\n * - `BackgroundRuntimeType` (`MINION | WORKER`) — *what kind of deployable is\n * this?* A compose service, a K8s workload, a provider-runtime scope. It has\n * no application-backend member because the backend is not a background\n * runtime.\n * - `ApplicationRuntimeProfile` (`APPLICATION_BACKEND | MINION`) — *does this\n * boot assertion apply to me?* Inside a single process. It has no worker\n * member because workers never boot that lifecycle.\n * - **This enum** (`APPLICATION_BACKEND | MINION | WORKER`) — *which principal\n * is authenticating, and whose secrets may it receive?* It is the only one of\n * the three that spans every runtime capable of presenting a credential, which\n * is exactly why it cannot be expressed as either neighbour.\n *\n * Merging any pair would be convenient and wrong: a future runtime that boots no\n * lifecycle but does hold credentials (or the reverse) would silently inherit a\n * decision made for a different question.\n *\n * @see BackgroundRuntimeType — the deployable-kind axis this maps FROM\n */\nexport enum ApplicationRuntimePrincipalKind {\n /**\n * The application's own backend service. Historically the ONLY principal:\n * before per-runtime identity, one `primarySecret` per application was held\n * identically by the backend and by every minion and worker, so at the\n * apps-manager door they were indistinguishable.\n */\n APPLICATION_BACKEND = 'application_backend',\n MINION = 'minion',\n WORKER = 'worker',\n}\n\n/**\n * Map a deployable background-runtime kind onto its credential principal.\n *\n * The one place the two vocabularies meet. Keeping the translation in a single\n * exhaustive switch means adding a member to `BackgroundRuntimeType` is a\n * COMPILE error here rather than a silent gap at whichever call site happened to\n * assume a mapping.\n */\nexport function principalKindForBackgroundRuntime(\n runtimeType: BackgroundRuntimeType,\n): ApplicationRuntimePrincipalKind {\n switch (runtimeType) {\n case BackgroundRuntimeType.MINION:\n return ApplicationRuntimePrincipalKind.MINION;\n case BackgroundRuntimeType.WORKER:\n return ApplicationRuntimePrincipalKind.WORKER;\n }\n}\n\n/**\n * A runtime principal's stable identity within one application.\n *\n * `name` is the `wildo.saas.config.ts` bucket key (`marketingScrapper`,\n * `myNodeWorker`) — the SAME identity axis the deploy path already carries as\n * `wildo.ai/owned-service-name` and `APP_OWNED_SERVICE_NAME`. Reusing the bucket\n * key rather than the `serviceName` matters: the bucket key is what the\n * declaration, the config lookup and the pod label all agree on, while\n * `serviceName` is a rendering concern that is normalised for DNS.\n *\n * The backend principal carries no name — an application has exactly one, so a\n * name would be a second way to say `APPLICATION_BACKEND`.\n */\nexport interface ApplicationRuntimePrincipal {\n kind: ApplicationRuntimePrincipalKind;\n /** Absent for {@link ApplicationRuntimePrincipalKind.APPLICATION_BACKEND}. */\n name?: string | undefined;\n}\n\n/** The canonical backend principal — one per application, by definition. */\nexport const APPLICATION_BACKEND_PRINCIPAL: ApplicationRuntimePrincipal = {\n kind: ApplicationRuntimePrincipalKind.APPLICATION_BACKEND,\n};\n\n/**\n * Render a principal as a single stable string.\n *\n * Used as the stored key for a principal's secret, as the URL segment when the\n * CLI asks for a named principal's bootstrap credentials, and in log/audit\n * fields. ONE renderer so those three never drift into three spellings of the\n * same identity.\n *\n * `:` is the separator because neither half can contain it — the kinds are a\n * closed enum, and a bucket key is a TypeScript object key in\n * `wildo.saas.config.ts`. {@link parseRuntimePrincipalKey} rejects anything that\n * does not round-trip, so a key that ever gains a colon fails loudly at the\n * boundary rather than resolving to the wrong principal.\n */\nexport function buildRuntimePrincipalKey(principal: ApplicationRuntimePrincipal): string {\n return principal.kind === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND\n ? ApplicationRuntimePrincipalKind.APPLICATION_BACKEND\n : `${principal.kind}:${principal.name ?? ''}`;\n}\n\n/**\n * Inverse of {@link buildRuntimePrincipalKey}. Returns `null` for anything\n * malformed — an unknown kind, a missing name on a named kind, or a name\n * containing the separator.\n *\n * Fail-closed by returning `null` rather than throwing OR guessing: this parses\n * values that reach the system from a URL segment and from stored rows, and a\n * lenient parse there is how one principal's key resolves to another's secret.\n */\nexport function parseRuntimePrincipalKey(key: string): ApplicationRuntimePrincipal | null {\n if (key === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND) {\n return APPLICATION_BACKEND_PRINCIPAL;\n }\n const separatorIndex = key.indexOf(':');\n if (separatorIndex <= 0) return null;\n const kind = key.slice(0, separatorIndex);\n const name = key.slice(separatorIndex + 1);\n if (name.length === 0 || name.includes(':')) return null;\n if (kind !== ApplicationRuntimePrincipalKind.MINION && kind !== ApplicationRuntimePrincipalKind.WORKER) {\n return null;\n }\n return { kind, name };\n}\n\n/**\n * Every principal an application declares: its backend, plus one per declared\n * minion and worker.\n *\n * Derived from the managed declaration — the same input the config seed already\n * consumes — so the credential set and the deployed runtime set cannot diverge.\n * That is also what makes revocation fall out for free: a runtime removed from\n * `wildo.saas.config.ts` simply stops appearing here, and the mint step prunes\n * any stored secret whose key is no longer in this list (R15).\n *\n * The backend is ALWAYS included, including for an application that declares no\n * minions and no workers — it is the principal that must never be absent.\n */\nexport function enumerateDeclaredRuntimePrincipals(declaration: {\n minions?: Record<string, unknown> | undefined;\n workers?: Record<string, unknown> | undefined;\n}): ApplicationRuntimePrincipal[] {\n return [\n APPLICATION_BACKEND_PRINCIPAL,\n ...Object.keys(declaration.minions ?? {}).map((name) => ({\n kind: ApplicationRuntimePrincipalKind.MINION,\n name,\n })),\n ...Object.keys(declaration.workers ?? {}).map((name) => ({\n kind: ApplicationRuntimePrincipalKind.WORKER,\n name,\n })),\n ];\n}\n\n/**\n * The Redis key namespace a MINION owns (D20).\n *\n * `<appSlug>:minions:<name>:` — a strict extension of the application's own\n * `<appSlug>:` prefix, which is what lets `RedisService` keep enforcing \"an\n * authored prefix must start with `<appSlug>:`\" unchanged.\n *\n * ## One derivation, deliberately, because it is a COUPLED PAIR\n *\n * Two places consume this and they must agree exactly: the Redis ACL key pattern\n * apps-manager grants the minion's user, and the `REDIS_KEY_PREFIX` the CLI\n * writes into that minion's environment. If they disagree by even a character,\n * every Redis operation the minion performs is DENIED — and the error names an\n * ACL, not the mismatch, so nothing in the minion's own configuration explains\n * it. Deriving both from this function is what makes that class of failure\n * unrepresentable rather than merely unlikely.\n *\n * Based on `appSlug` rather than an authored `dataServices.redis.keyPrefix`\n * because the ACL pattern already is (`RedisSelfInfraProviderModule`), and one\n * inconsistency is better than two competing bases. An application that authors\n * a custom prefix therefore has a PRE-EXISTING mismatch with its own ACL; that\n * gap is older than per-principal credentials and is not narrowed here.\n */\nexport function buildMinionRedisKeyPrefix(appSlug: string, minionName: string): string {\n return `${appSlug}:minions:${minionName}:`;\n}\n\n/**\n * Map an `ApplicationRuntimeProfile` value onto the credential-principal axis.\n *\n * The two vocabularies are deliberately SEPARATE — a runtime profile answers\n * \"which declaration class am I?\", a principal kind answers \"whose credential do\n * I hold?\" — but their string values coincide today. A consumer that relies on\n * that coincidence by comparing raw strings has made the coupling invisible; this\n * function is where the crossing is allowed to happen, once.\n *\n * Fail-closed: an unrecognised profile returns `undefined` rather than a\n * plausible default, because every caller uses the result to decide how narrowly\n * a runtime is confined, and guessing there widens confinement silently.\n */\nexport function runtimePrincipalKindFromRuntimeProfile(\n runtimeProfile: string | undefined,\n): ApplicationRuntimePrincipalKind | undefined {\n switch (runtimeProfile) {\n case ApplicationRuntimePrincipalKind.APPLICATION_BACKEND:\n return ApplicationRuntimePrincipalKind.APPLICATION_BACKEND;\n case ApplicationRuntimePrincipalKind.MINION:\n return ApplicationRuntimePrincipalKind.MINION;\n case ApplicationRuntimePrincipalKind.WORKER:\n return ApplicationRuntimePrincipalKind.WORKER;\n default:\n return undefined;\n }\n}\n\n/**\n * The principal segment embedded in a runtime's RPC reply-queue name.\n *\n * ## Why this exists — the same reason as {@link buildMinionRedisKeyPrefix}\n *\n * Two places consume this and they must agree EXACTLY: the broker permission\n * pattern apps-manager grants a minion's user, and the reply-queue name the\n * minion's own AMQP adapter declares and consumes. If they disagree by even a\n * character the minion's every reply is refused with `403 ACCESS_REFUSED`, and\n * the error names a permission rather than the mismatch — so nothing in the\n * minion's own configuration explains it.\n *\n * It previously WAS derived twice: the adapter sanitised its runtime key while\n * the permission builder escaped the raw minion name, coupled only by a comment\n * saying the two \"mirror\" each other. They agreed for `marketingScrapper` and\n * would have diverged for any name containing a character sanitisation rewrites\n * (`marketing.scrapper` → `marketing-scrapper` on one side, `marketing.scrapper`\n * on the other). A comment describing what the other side must do is not a site\n * that upholds an invariant; deriving both from here makes the divergence\n * unrepresentable instead of merely unlikely.\n *\n * Returns `undefined` for the APPLICATION BACKEND, which keeps the historical\n * segment-less reply-queue layout — that is what stops a minion's permission\n * from ever matching the backend's replies.\n */\nexport function buildRuntimePrincipalQueueSegment(\n principalKind: ApplicationRuntimePrincipalKind | undefined,\n principalName: string | undefined,\n): string | undefined {\n if (!principalKind || principalKind === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND) {\n return undefined;\n }\n // Sanitised for the same reason the ACL usernames are: a principal name comes\n // from a TypeScript object key and may hold characters a queue name should not.\n const sanitized = (principalName ?? '').replace(/[^a-zA-Z0-9]+/g, '-').replace(/^-+|-+$/g, '');\n return sanitized ? `${principalKind}-${sanitized}` : undefined;\n}\n\n"]}
1
+ {"version":3,"file":"runtime-principal.contracts.js","sourceRoot":"","sources":["../../../src/bootstrap/runtime-principal.contracts.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,yDAAyD;AACzD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAN,IAAY,+BA0BX;AA1BD,WAAY,+BAA+B;IACzC;;;;;OAKG;IACH,8EAA2C,CAAA;IAC3C,oDAAiB,CAAA;IACjB,oDAAiB,CAAA;IACjB;;;;;;;;;;;;;;OAcG;IACH,kFAA+C,CAAA;AACjD,CAAC,EA1BW,+BAA+B,KAA/B,+BAA+B,QA0B1C;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iCAAiC,CAC/C,WAAkC;IAElC,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,qBAAqB,CAAC,MAAM;YAC/B,OAAO,+BAA+B,CAAC,MAAM,CAAC;QAChD,KAAK,qBAAqB,CAAC,MAAM;YAC/B,OAAO,+BAA+B,CAAC,MAAM,CAAC;IAClD,CAAC;AACH,CAAC;AAqBD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,6BAA6B,GAAgC;IACxE,IAAI,EAAE,+BAA+B,CAAC,mBAAmB;CAC1D,CAAC;AAEF,iHAAiH;AACjH,MAAM,CAAC,MAAM,+BAA+B,GAAgC;IAC1E,IAAI,EAAE,+BAA+B,CAAC,qBAAqB;CAC5D,CAAC;AAEF;;;GAGG;AACH,SAAS,8BAA8B,C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C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,sCAAsC,CACpD,cAAkC;IAElC,QAAQ,cAAc,EAAE,CAAC;QACvB,KAAK,+BAA+B,CAAC,mBAAmB;YACtD,OAAO,+BAA+B,CAAC,mBAAmB,CAAC;QAC7D,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,+BAA+B,CAAC,MAAM,CAAC;QAChD,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,+BAA+B,CAAC,MAAM,CAAC;QAChD;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,iCAAiC,CAC/C,aAA0D,EAC1D,aAAiC;IAEjC,IAAI,CAAC,aAAa,IAAI,aAAa,KAAK,+BAA+B,CAAC,mBAAmB,EAAE,CAAC;QAC5F,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IAC9E,gFAAgF;IAChF,MAAM,SAAS,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAC/F,OAAO,SAAS,CAAC,CAAC,CAAC,GAAG,aAAa,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC","sourcesContent":["// Root barrel, matching the sibling bootstrap files: `BackgroundRuntimeType`\n// lives in the decorator-bound graph, not the browser-safe `/public-runtime`\n// atom subset. This module is platform/CLI-side only and never reaches a\n// browser bundle, so the root import costs nothing here.\nimport { BackgroundRuntimeType, RuntimeEnvironment } from '@wildo-ai/saas-models';\n\n/**\n * WHOSE credentials are these? — the credential-principal axis.\n *\n * Wildo now has three runtime-identity vocabularies and they answer three\n * different questions. They are deliberately NOT collapsed, even where their\n * members currently coincide:\n *\n * - `BackgroundRuntimeType` (`MINION | WORKER`) — *what kind of deployable is\n * this?* A compose service, a K8s workload, a provider-runtime scope. It has\n * no application-backend member because the backend is not a background\n * runtime.\n * - `ApplicationRuntimeProfile` (`APPLICATION_BACKEND | MINION`) — *does this\n * boot assertion apply to me?* Inside a single process. It has no worker\n * member because workers never boot that lifecycle.\n * - **This enum** (`APPLICATION_BACKEND | MINION | WORKER`) — *which principal\n * is authenticating, and whose secrets may it receive?* It is the only one of\n * the three that spans every runtime capable of presenting a credential, which\n * is exactly why it cannot be expressed as either neighbour.\n *\n * Merging any pair would be convenient and wrong: a future runtime that boots no\n * lifecycle but does hold credentials (or the reverse) would silently inherit a\n * decision made for a different question.\n *\n * @see BackgroundRuntimeType — the deployable-kind axis this maps FROM\n */\nexport enum ApplicationRuntimePrincipalKind {\n /**\n * The application's own backend service. Historically the ONLY principal:\n * before per-runtime identity, one `primarySecret` per application was held\n * identically by the backend and by every minion and worker, so at the\n * apps-manager door they were indistinguishable.\n */\n APPLICATION_BACKEND = 'application_backend',\n MINION = 'minion',\n WORKER = 'worker',\n /**\n * The application's development companion (#2941): the long-running local daemon that serves the workbench and\n * runs the app-creation lane beside a developer's checkout.\n *\n * It used to present the BACKEND's `primarySecret`, so apps-manager could not tell it from the backend, and\n * everything the backend may do on the platform (a platform-custody signature, a data key, the application's\n * secrets blob) the companion, and any coding agent able to read its workspace `.env`, could do too.\n *\n * Like the backend it is nameless: an application has at most one companion. Unlike every other principal it is\n * not DECLARED in `wildo.saas.config.ts`: it exists on a development platform only (production runs no companion),\n * which is why {@link enumerateRuntimePrincipalsWithBootstrapSecrets} adds it from the platform's runtime\n * environment rather than from the declaration. apps-manager admits it on the routes the companion calls and on\n * no other, and it is in no key purpose's `heldBy` / `mayRequestSignature` / `mayRequestDataKeys`, so the signing\n * and data-key proxies refuse it.\n */\n DEVELOPMENT_COMPANION = 'development_companion',\n}\n\n/**\n * Map a deployable background-runtime kind onto its credential principal.\n *\n * The one place the two vocabularies meet. Keeping the translation in a single\n * exhaustive switch means adding a member to `BackgroundRuntimeType` is a\n * COMPILE error here rather than a silent gap at whichever call site happened to\n * assume a mapping.\n */\nexport function principalKindForBackgroundRuntime(\n runtimeType: BackgroundRuntimeType,\n): ApplicationRuntimePrincipalKind {\n switch (runtimeType) {\n case BackgroundRuntimeType.MINION:\n return ApplicationRuntimePrincipalKind.MINION;\n case BackgroundRuntimeType.WORKER:\n return ApplicationRuntimePrincipalKind.WORKER;\n }\n}\n\n/**\n * A runtime principal's stable identity within one application.\n *\n * `name` is the `wildo.saas.config.ts` bucket key (`marketingScrapper`,\n * `myNodeWorker`) — the SAME identity axis the deploy path already carries as\n * `wildo.ai/owned-service-name` and `APP_OWNED_SERVICE_NAME`. Reusing the bucket\n * key rather than the `serviceName` matters: the bucket key is what the\n * declaration, the config lookup and the pod label all agree on, while\n * `serviceName` is a rendering concern that is normalised for DNS.\n *\n * The backend principal carries no name — an application has exactly one, so a\n * name would be a second way to say `APPLICATION_BACKEND`.\n */\nexport interface ApplicationRuntimePrincipal {\n kind: ApplicationRuntimePrincipalKind;\n /** Absent for {@link ApplicationRuntimePrincipalKind.APPLICATION_BACKEND}. */\n name?: string | undefined;\n}\n\n/** The canonical backend principal — one per application, by definition. */\nexport const APPLICATION_BACKEND_PRINCIPAL: ApplicationRuntimePrincipal = {\n kind: ApplicationRuntimePrincipalKind.APPLICATION_BACKEND,\n};\n\n/** The development companion's principal — at most one per application, so nameless like the backend (#2941). */\nexport const DEVELOPMENT_COMPANION_PRINCIPAL: ApplicationRuntimePrincipal = {\n kind: ApplicationRuntimePrincipalKind.DEVELOPMENT_COMPANION,\n};\n\n/**\n * Whether a principal kind is a singleton per application, and therefore carries no name. ONE predicate shared by the\n * key renderer and its parser, so the two cannot disagree about which kinds take a name segment.\n */\nfunction isNamelessRuntimePrincipalKind(kind: ApplicationRuntimePrincipalKind): boolean {\n switch (kind) {\n case ApplicationRuntimePrincipalKind.APPLICATION_BACKEND:\n case ApplicationRuntimePrincipalKind.DEVELOPMENT_COMPANION:\n return true;\n case ApplicationRuntimePrincipalKind.MINION:\n case ApplicationRuntimePrincipalKind.WORKER:\n return false;\n }\n}\n\n/**\n * Whether a platform running in `runtimeEnvironment` hosts development companions, and so mints each application a\n * {@link ApplicationRuntimePrincipalKind.DEVELOPMENT_COMPANION} secret (#2941).\n *\n * Development only. A staging or production platform runs no companion, and minting it a credential anyway would leave\n * one more secret able to authenticate at apps-manager with nothing that uses it. apps-manager reads its own\n * `APPLICATION_ENV` (the platform is mono-environment) and the CLI reads the environment it bootstraps; both ask here.\n */\nexport function runtimeEnvironmentHostsDevelopmentCompanion(runtimeEnvironment: RuntimeEnvironment | undefined): boolean {\n return runtimeEnvironment === RuntimeEnvironment.DEVELOPMENT;\n}\n\n/**\n * Render a principal as a single stable string.\n *\n * Used as the stored key for a principal's secret, as the URL segment when the\n * CLI asks for a named principal's bootstrap credentials, and in log/audit\n * fields. ONE renderer so those three never drift into three spellings of the\n * same identity.\n *\n * `:` is the separator because neither half can contain it — the kinds are a\n * closed enum, and a bucket key is a TypeScript object key in\n * `wildo.saas.config.ts`. {@link parseRuntimePrincipalKey} rejects anything that\n * does not round-trip, so a key that ever gains a colon fails loudly at the\n * boundary rather than resolving to the wrong principal.\n */\nexport function buildRuntimePrincipalKey(principal: ApplicationRuntimePrincipal): string {\n return isNamelessRuntimePrincipalKind(principal.kind)\n ? principal.kind\n : `${principal.kind}:${principal.name ?? ''}`;\n}\n\n/**\n * Inverse of {@link buildRuntimePrincipalKey}. Returns `null` for anything\n * malformed — an unknown kind, a missing name on a named kind, or a name\n * containing the separator.\n *\n * Fail-closed by returning `null` rather than throwing OR guessing: this parses\n * values that reach the system from a URL segment and from stored rows, and a\n * lenient parse there is how one principal's key resolves to another's secret.\n */\nexport function parseRuntimePrincipalKey(key: string): ApplicationRuntimePrincipal | null {\n if (key === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND) {\n return APPLICATION_BACKEND_PRINCIPAL;\n }\n if (key === ApplicationRuntimePrincipalKind.DEVELOPMENT_COMPANION) {\n return DEVELOPMENT_COMPANION_PRINCIPAL;\n }\n const separatorIndex = key.indexOf(':');\n if (separatorIndex <= 0) return null;\n const kind = key.slice(0, separatorIndex);\n const name = key.slice(separatorIndex + 1);\n if (name.length === 0 || name.includes(':')) return null;\n if (kind !== ApplicationRuntimePrincipalKind.MINION && kind !== ApplicationRuntimePrincipalKind.WORKER) {\n return null;\n }\n return { kind, name };\n}\n\n/**\n * Every principal an application declares: its backend, plus one per declared\n * minion and worker.\n *\n * Derived from the managed declaration — the same input the config seed already\n * consumes — so the credential set and the deployed runtime set cannot diverge.\n * That is also what makes revocation fall out for free: a runtime removed from\n * `wildo.saas.config.ts` simply stops appearing here, and the mint step prunes\n * any stored secret whose key is no longer in this list (R15).\n *\n * The backend is ALWAYS included, including for an application that declares no\n * minions and no workers — it is the principal that must never be absent.\n */\nexport function enumerateDeclaredRuntimePrincipals(declaration: {\n minions?: Record<string, unknown> | undefined;\n workers?: Record<string, unknown> | undefined;\n}): ApplicationRuntimePrincipal[] {\n return [\n APPLICATION_BACKEND_PRINCIPAL,\n ...Object.keys(declaration.minions ?? {}).map((name) => ({\n kind: ApplicationRuntimePrincipalKind.MINION,\n name,\n })),\n ...Object.keys(declaration.workers ?? {}).map((name) => ({\n kind: ApplicationRuntimePrincipalKind.WORKER,\n name,\n })),\n ];\n}\n\n/**\n * Every principal apps-manager mints a bootstrap secret for, other than the backend (whose secret is `primarySecret`):\n * one per declared minion and worker, plus the development companion on a platform that hosts one (#2941).\n *\n * The ONE derivation both sides use. apps-manager mints exactly this set (and prunes any stored secret outside it), and\n * the CLI fetches exactly this set, so a companion the platform never minted is never asked for, and a companion\n * secret left over from a development era is revoked the moment the platform stops hosting companions.\n */\nexport function enumerateRuntimePrincipalsWithBootstrapSecrets(\n declaration: Parameters<typeof enumerateDeclaredRuntimePrincipals>[0],\n options: { hostsDevelopmentCompanion: boolean },\n): ApplicationRuntimePrincipal[] {\n return [\n ...enumerateDeclaredRuntimePrincipals(declaration)\n .filter((principal) => principal.kind !== ApplicationRuntimePrincipalKind.APPLICATION_BACKEND),\n ...(options.hostsDevelopmentCompanion ? [DEVELOPMENT_COMPANION_PRINCIPAL] : []),\n ];\n}\n\n/**\n * The Redis key namespace a MINION owns (D20).\n *\n * `<appSlug>:minions:<name>:` — a strict extension of the application's own\n * `<appSlug>:` prefix, which is what lets `RedisService` keep enforcing \"an\n * authored prefix must start with `<appSlug>:`\" unchanged.\n *\n * ## One derivation, deliberately, because it is a COUPLED PAIR\n *\n * Two places consume this and they must agree exactly: the Redis ACL key pattern\n * apps-manager grants the minion's user, and the `REDIS_KEY_PREFIX` the CLI\n * writes into that minion's environment. If they disagree by even a character,\n * every Redis operation the minion performs is DENIED — and the error names an\n * ACL, not the mismatch, so nothing in the minion's own configuration explains\n * it. Deriving both from this function is what makes that class of failure\n * unrepresentable rather than merely unlikely.\n *\n * Based on `appSlug` rather than an authored `dataServices.redis.keyPrefix`\n * because the ACL pattern already is (`RedisSelfInfraProviderModule`), and one\n * inconsistency is better than two competing bases. An application that authors\n * a custom prefix therefore has a PRE-EXISTING mismatch with its own ACL; that\n * gap is older than per-principal credentials and is not narrowed here.\n */\nexport function buildMinionRedisKeyPrefix(appSlug: string, minionName: string): string {\n return `${appSlug}:minions:${minionName}:`;\n}\n\n/**\n * Map an `ApplicationRuntimeProfile` value onto the credential-principal axis.\n *\n * The two vocabularies are deliberately SEPARATE — a runtime profile answers\n * \"which declaration class am I?\", a principal kind answers \"whose credential do\n * I hold?\" — but their string values coincide today. A consumer that relies on\n * that coincidence by comparing raw strings has made the coupling invisible; this\n * function is where the crossing is allowed to happen, once.\n *\n * Fail-closed: an unrecognised profile returns `undefined` rather than a\n * plausible default, because every caller uses the result to decide how narrowly\n * a runtime is confined, and guessing there widens confinement silently.\n */\nexport function runtimePrincipalKindFromRuntimeProfile(\n runtimeProfile: string | undefined,\n): ApplicationRuntimePrincipalKind | undefined {\n switch (runtimeProfile) {\n case ApplicationRuntimePrincipalKind.APPLICATION_BACKEND:\n return ApplicationRuntimePrincipalKind.APPLICATION_BACKEND;\n case ApplicationRuntimePrincipalKind.MINION:\n return ApplicationRuntimePrincipalKind.MINION;\n case ApplicationRuntimePrincipalKind.WORKER:\n return ApplicationRuntimePrincipalKind.WORKER;\n default:\n return undefined;\n }\n}\n\n/**\n * The principal segment embedded in a runtime's RPC reply-queue name.\n *\n * ## Why this exists — the same reason as {@link buildMinionRedisKeyPrefix}\n *\n * Two places consume this and they must agree EXACTLY: the broker permission\n * pattern apps-manager grants a minion's user, and the reply-queue name the\n * minion's own AMQP adapter declares and consumes. If they disagree by even a\n * character the minion's every reply is refused with `403 ACCESS_REFUSED`, and\n * the error names a permission rather than the mismatch — so nothing in the\n * minion's own configuration explains it.\n *\n * It previously WAS derived twice: the adapter sanitised its runtime key while\n * the permission builder escaped the raw minion name, coupled only by a comment\n * saying the two \"mirror\" each other. They agreed for `marketingScrapper` and\n * would have diverged for any name containing a character sanitisation rewrites\n * (`marketing.scrapper` → `marketing-scrapper` on one side, `marketing.scrapper`\n * on the other). A comment describing what the other side must do is not a site\n * that upholds an invariant; deriving both from here makes the divergence\n * unrepresentable instead of merely unlikely.\n *\n * Returns `undefined` for the APPLICATION BACKEND, which keeps the historical\n * segment-less reply-queue layout — that is what stops a minion's permission\n * from ever matching the backend's replies.\n */\nexport function buildRuntimePrincipalQueueSegment(\n principalKind: ApplicationRuntimePrincipalKind | undefined,\n principalName: string | undefined,\n): string | undefined {\n if (!principalKind || principalKind === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND) {\n return undefined;\n }\n // Sanitised for the same reason the ACL usernames are: a principal name comes\n // from a TypeScript object key and may hold characters a queue name should not.\n const sanitized = (principalName ?? '').replace(/[^a-zA-Z0-9]+/g, '-').replace(/^-+|-+$/g, '');\n return sanitized ? `${principalKind}-${sanitized}` : undefined;\n}\n\n"]}
@@ -0,0 +1,249 @@
1
+ import { type KeyObject } from 'node:crypto';
2
+ import { CryptoKey_Purpose } from '@wildo-ai/saas-models';
3
+ import { type P256PublicJwk } from '../key-management/es256-jws';
4
+ import { type ApplicationRuntimePrincipal } from './runtime-principal.contracts';
5
+ /**
6
+ * Integrity of what apps-manager tells an application runtime (#2921) and a platform service (#2898).
7
+ *
8
+ * A platform service (crontabs, module-registry) is held to the same contract with the same key: its audience is its
9
+ * own platform application (`SERVICE_NAME`, the record the request authenticated against) and the backend principal,
10
+ * and the route binding keeps an answer on one plane (`platform-services-to-manager`) from standing in for the other
11
+ * (`apps-to-manager`).
12
+ *
13
+ * An application runtime (backend, minion, worker, development companion) learns its configuration, its secrets, its
14
+ * worker bootstrap, its storage session and its runtime-principal tokens from apps-manager, over HTTP. Before this
15
+ * contract it verified none of it: anything that could answer on `PLATFORM_APPS_MANAGER_URL` (a wrong DNS answer, a
16
+ * plain-HTTP hop, an impostor service) could hand a runtime a configuration and secrets of its choosing.
17
+ *
18
+ * ## The contract
19
+ *
20
+ * - **apps-manager signs every successful response** on the runtime-facing routes with its RESPONSE key, a key used for
21
+ * nothing else (not the key that signs runtime-principal tokens or crontabs requests: one key per purpose, NIST SP
22
+ * 800-57 Part 1 Rev 5 §5.2). The signature travels in {@link RUNTIME_RESPONSE_SIGNATURE_HEADER}.
23
+ * - **The signature is a compact JWS** (RFC 7515) with `alg: ES256`, `typ: wildo-runtime-response+jws` and a `kid`
24
+ * that is the RFC 7638 thumbprint of the signing key. Its claims bind:
25
+ * - `bodyDigest`: SHA-256 over the RFC 8785 (JCS) serialization of the body as sent (`canonicalizeJson`). The signer
26
+ * digests the exact text it sends, parsed back, so a `Date` or an `undefined` in the handler's object cannot make
27
+ * the two sides digest different values. RFC 8785 rather than a sorted `JSON.stringify`: the latter drops a
28
+ * `"__proto__"` member (so one could be added to a signed body undetected) and orders integer-like keys the
29
+ * JavaScript way, which no verifier in another language reproduces;
30
+ * - `aud`: the application id and the runtime principal the request authenticated as;
31
+ * - `nonce`: echoed from {@link RUNTIME_RESPONSE_NONCE_HEADER}, which the runtime generates fresh for every request.
32
+ * Replay protection rests on this nonce and on a short lifetime, never on a version a freshly booted runtime
33
+ * cannot remember;
34
+ * - `htm` / `htu`: the request's method and its apps-to-manager route (the DPoP pattern, RFC 9449 §4.2), so a
35
+ * genuine answer from one route cannot stand in for another under the same nonce;
36
+ * - `iat` / `exp`: a {@link RUNTIME_RESPONSE_SIGNATURE_LIFETIME_SECONDS}-second window.
37
+ * - **Runtimes verify, fail-closed**, against up to {@link RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS} public keys (current
38
+ * and next) carried in their environment as a one-line JWKS, so the response key can rotate without a flag day.
39
+ *
40
+ * ## Its key purpose (#2891)
41
+ *
42
+ * The response key is the {@link RUNTIME_RESPONSE_KEY_PURPOSE} key: platform-scoped, held by apps-manager alone, used for
43
+ * nothing else, and requested by nobody (its descriptor's `heldBy` and `mayRequestSignature` are empty). Its `typ`,
44
+ * algorithm and cryptoperiod are the purpose's. Its versions are the two the runtimes accept, current and next, which
45
+ * is the purpose's ACTIVE and NEXT.
46
+ *
47
+ * It stays in apps-manager's environment rather than in the platform keyring, deliberately: a runtime has to hold the
48
+ * verification keys BEFORE it can trust anything apps-manager says, so they reach it out of band, in its environment,
49
+ * and so does the signing half. A keyring version would be announced over the very channel the key authenticates.
50
+ *
51
+ * ## What this protects, stated
52
+ *
53
+ * The network path and an impostor apps-manager. NOT the host: the host supplies each runtime's environment, so it
54
+ * supplies the verification keys too.
55
+ *
56
+ * ## Why not a library
57
+ *
58
+ * ES256 over a compact JWS is a few lines of `node:crypto` (`dsaEncoding: 'ieee-p1363'` gives the raw r‖s form RFC 7518
59
+ * §3.4 requires). Every party here already runs Node, and the verifier must load in the dependency-light worker
60
+ * runtime, so taking no JOSE dependency keeps one implementation on both sides.
61
+ */
62
+ /** The key purpose that signs runtime responses (#2891): the response key is used for nothing else. */
63
+ export declare const RUNTIME_RESPONSE_KEY_PURPOSE = CryptoKey_Purpose.PLATFORM_RESPONSE_INTEGRITY;
64
+ /**
65
+ * The JWS `typ`, so a response signature can never be mistaken for any other JWS the platform issues (RFC 8725 §3.11):
66
+ * the response purpose's, from its descriptor, distinct from every other purpose's.
67
+ */
68
+ export declare const RUNTIME_RESPONSE_JWS_TYPE: string;
69
+ /** The only algorithm accepted, pinned rather than read from the header (RFC 8725 §3.1): the purpose's ES256. */
70
+ export declare const RUNTIME_RESPONSE_JWS_ALGORITHM = "ES256";
71
+ /** The issuer every response signature carries: apps-manager. */
72
+ export declare const RUNTIME_RESPONSE_ISSUER: string;
73
+ /** Response header carrying the compact JWS. */
74
+ export declare const RUNTIME_RESPONSE_SIGNATURE_HEADER = "x-wildo-response-signature";
75
+ /** Request header carrying the runtime's fresh nonce, echoed into the signature's `nonce` claim. */
76
+ export declare const RUNTIME_RESPONSE_NONCE_HEADER = "x-wildo-response-nonce";
77
+ /**
78
+ * How long a response signature is valid. It only needs to cover one round trip plus clock skew: the nonce is what
79
+ * stops a replay, and the window bounds how long a captured response is worth anything at all.
80
+ */
81
+ export declare const RUNTIME_RESPONSE_SIGNATURE_LIFETIME_SECONDS = 60;
82
+ /** Tolerated clock difference between apps-manager and a runtime, in both directions. */
83
+ export declare const RUNTIME_RESPONSE_CLOCK_SKEW_SECONDS = 30;
84
+ /** Random bytes in a nonce (256 bits, base64url-encoded). */
85
+ export declare const RUNTIME_RESPONSE_NONCE_BYTES = 32;
86
+ /** Current and next: a runtime accepts at most two response keys, so the key can rotate without a flag day. */
87
+ export declare const RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS = 2;
88
+ /**
89
+ * Why a response was refused. A closed vocabulary so a log, a test or an alert can branch on the reason rather than on
90
+ * an English message.
91
+ */
92
+ export declare enum RuntimeResponseVerificationFailure {
93
+ /** No signature header on a successful response. */
94
+ MISSING_SIGNATURE = "missing_signature",
95
+ /** The header is not a three-part compact JWS, or a part does not decode. */
96
+ MALFORMED_SIGNATURE = "malformed_signature",
97
+ /** The JWS `typ` is not {@link RUNTIME_RESPONSE_JWS_TYPE}. */
98
+ WRONG_TYPE = "wrong_type",
99
+ /** The JWS `alg` is not {@link RUNTIME_RESPONSE_JWS_ALGORITHM}. */
100
+ UNSUPPORTED_ALGORITHM = "unsupported_algorithm",
101
+ /** The `kid` names no key the runtime holds. */
102
+ UNKNOWN_KEY = "unknown_key",
103
+ /** The signature does not verify under the named key. */
104
+ BAD_SIGNATURE = "bad_signature",
105
+ /** The issuer is not apps-manager. */
106
+ WRONG_ISSUER = "wrong_issuer",
107
+ /** The audience names another application or another runtime principal. */
108
+ WRONG_AUDIENCE = "wrong_audience",
109
+ /** The echoed nonce is not the one this request sent. */
110
+ NONCE_MISMATCH = "nonce_mismatch",
111
+ /** The response answers another method or route than the one this request used. */
112
+ WRONG_REQUEST = "wrong_request",
113
+ /** Past `exp` (beyond the skew tolerance). */
114
+ EXPIRED = "expired",
115
+ /** `iat` is in the future (beyond the skew tolerance). */
116
+ NOT_YET_VALID = "not_yet_valid",
117
+ /** The body received is not the body that was signed. */
118
+ BODY_MISMATCH = "body_mismatch"
119
+ }
120
+ /** Thrown by {@link verifyRuntimeResponse}; `failure` is the branchable reason. */
121
+ export declare class RuntimeResponseVerificationError extends Error {
122
+ readonly failure: RuntimeResponseVerificationFailure;
123
+ constructor(failure: RuntimeResponseVerificationFailure, message: string);
124
+ }
125
+ /**
126
+ * Whether a caught value is a {@link RuntimeResponseVerificationError}. Decided by name and reason rather than
127
+ * `instanceof`, because a runtime can load two copies of this package (an application's injected snapshot beside the
128
+ * engine's), and a refusal thrown by one copy must still be recognised by code holding the other.
129
+ */
130
+ export declare function isRuntimeResponseVerificationError(value: unknown): value is RuntimeResponseVerificationError;
131
+ /** The audience of a response: which application, and which of its runtime principals, the answer is for. */
132
+ export interface RuntimeResponseAudience {
133
+ application: string;
134
+ /** {@link buildRuntimePrincipalKey} of the principal the request authenticated as. */
135
+ principal: string;
136
+ }
137
+ /**
138
+ * The route a request is bound to: its path without query and without a leading API mount prefix (`/api/v1`). apps-manager
139
+ * serves its runtime-facing and platform-facing routes both at the root and under that prefix, and a caller may use
140
+ * either, so both sides derive the route from the URL they actually used and drop the prefix before comparing.
141
+ *
142
+ * Only that prefix is dropped, so `PLATFORM_APPS_MANAGER_URL` must name the service's ROOT (`http(s)://host[:port]`, as
143
+ * every generated address does). A URL carrying a path prefix that a reverse proxy strips would bind a different route
144
+ * on each side and be refused as `wrong_request`.
145
+ */
146
+ export declare function runtimeResponseRouteOf(urlOrPath: string): string;
147
+ /** The request a response answers: its method and its URL (absolute, or a path). */
148
+ export interface RuntimeResponseRequestBinding {
149
+ method: string;
150
+ url: string;
151
+ }
152
+ /** The claims a response signature carries. */
153
+ export interface RuntimeResponseClaims {
154
+ iss: string;
155
+ aud: RuntimeResponseAudience;
156
+ /** The request's nonce, or `null` when the caller sent none. Every verifying caller sends one, so a verifier always demands it. */
157
+ nonce: string | null;
158
+ /** base64url(SHA-256(canonical body)). */
159
+ bodyDigest: string;
160
+ /** The request's method, upper-cased. */
161
+ htm: string;
162
+ /** The request's route, per {@link runtimeResponseRouteOf}. */
163
+ htu: string;
164
+ iat: number;
165
+ exp: number;
166
+ }
167
+ /** One verification key, ready to use. */
168
+ export interface RuntimeResponseVerificationKey {
169
+ kid: string;
170
+ key: KeyObject;
171
+ }
172
+ /** RFC 7638 thumbprint of a P-256 public key (the shared implementation, `p256JwkThumbprint`). */
173
+ export declare function runtimeResponseKeyThumbprint(jwk: P256PublicJwk): string;
174
+ /**
175
+ * Digest of a JSON value as it travels: SHA-256 over its canonical serialization, base64url-encoded.
176
+ *
177
+ * Takes the PARSED value. The signer passes `JSON.parse` of the exact text it sends; the verifier passes the body it
178
+ * parsed. Both therefore digest the same JSON value, whatever the handler's object held before serialization.
179
+ */
180
+ export declare function runtimeResponseBodyDigest(body: unknown): string;
181
+ /** A fresh nonce for one request. */
182
+ export declare function createRuntimeResponseNonce(): string;
183
+ /**
184
+ * Build the environment value that carries a runtime's verification keys: a one-line JWKS of up to two public keys
185
+ * (current first, then next).
186
+ *
187
+ * A JWKS rather than PEM because a PEM is multi-line, and multi-line values are where `.env` files and orchestrators
188
+ * disagree. Used by every lane's environment builder, so the format has one producer.
189
+ */
190
+ export declare function buildRuntimeResponseVerificationKeySet(publicKeyPems: readonly string[]): string;
191
+ /**
192
+ * Parse the environment value {@link buildRuntimeResponseVerificationKeySet} produced.
193
+ *
194
+ * Throws on anything other than one or two EC P-256 public keys, and on a `kid` that is not the key's own thumbprint:
195
+ * the thumbprint is recomputed, never trusted, so a key cannot be filed under another key's id.
196
+ */
197
+ export declare function parseRuntimeResponseVerificationKeySet(value: string): RuntimeResponseVerificationKey[];
198
+ /**
199
+ * Why a response signing key cannot be used with a published key set, or `null` when it can.
200
+ *
201
+ * apps-manager calls this at startup: a signing key that runtimes do not hold makes every runtime refuse every answer,
202
+ * and that is far cheaper to refuse once, at apps-manager's boot, naming the remedy, than in every runtime.
203
+ */
204
+ export declare function describeRuntimeResponseSigningKeyMismatch(privateKeyPem: string, verificationKeySet: string): string | null;
205
+ /** What apps-manager needs to sign one response. */
206
+ export interface SignRuntimeResponseInput {
207
+ /** The response key's private half (PEM, SEC1 or PKCS#8). */
208
+ privateKeyPem: string;
209
+ /** The exact text that will be sent as the body. */
210
+ bodyText: string;
211
+ application: string;
212
+ principal: ApplicationRuntimePrincipal;
213
+ /** The request's {@link RUNTIME_RESPONSE_NONCE_HEADER}, or `null` if it sent none. */
214
+ nonce: string | null;
215
+ /** The request being answered. */
216
+ request: RuntimeResponseRequestBinding;
217
+ /** Seconds since the epoch; injectable for tests. */
218
+ nowSeconds?: number;
219
+ }
220
+ /**
221
+ * Sign one response. Throws rather than returning nothing: a response that cannot be signed must not be sent.
222
+ */
223
+ export declare function signRuntimeResponse(input: SignRuntimeResponseInput): string;
224
+ /** What a runtime needs to verify one response. */
225
+ export interface VerifyRuntimeResponseInput {
226
+ /** The {@link RUNTIME_RESPONSE_SIGNATURE_HEADER} value, as received (absent when missing). */
227
+ signature: string | null | undefined;
228
+ /** The body, parsed from JSON. */
229
+ body: unknown;
230
+ keys: readonly RuntimeResponseVerificationKey[];
231
+ /** The runtime's own `APPLICATION_ID`. */
232
+ application: string;
233
+ /**
234
+ * The principal the runtime authenticates as, when it knows it. Omitted only by a caller that cannot know it at that
235
+ * point; the nonce still binds the response to this one request, so a response meant for a sibling cannot be replayed.
236
+ */
237
+ principal?: ApplicationRuntimePrincipal;
238
+ /** The nonce this request sent. */
239
+ nonce: string;
240
+ /** The request this runtime sent. */
241
+ request: RuntimeResponseRequestBinding;
242
+ nowSeconds?: number;
243
+ }
244
+ /**
245
+ * Verify one response, fail-closed. Returns the verified claims; throws {@link RuntimeResponseVerificationError}
246
+ * otherwise. The header's `alg` and `typ` are checked against pinned values and never used to choose an algorithm.
247
+ */
248
+ export declare function verifyRuntimeResponse(input: VerifyRuntimeResponseInput): RuntimeResponseClaims;
249
+ //# sourceMappingURL=runtime-response-integrity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-response-integrity.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/runtime-response-integrity.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAmB,iBAAiB,EAAuB,MAAM,uBAAuB,CAAC;AAEhG,OAAO,EAAuF,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACtJ,OAAO,EAA4B,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE3G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,uGAAuG;AACvG,eAAO,MAAM,4BAA4B,gDAAgD,CAAC;AAE1F;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAsD,CAAC;AAE/F,iHAAiH;AACjH,eAAO,MAAM,8BAA8B,UAAsB,CAAC;AAElE,iEAAiE;AACjE,eAAO,MAAM,uBAAuB,EAAE,MAAsD,CAAC;AAE7F,gDAAgD;AAChD,eAAO,MAAM,iCAAiC,+BAA+B,CAAC;AAE9E,oGAAoG;AACpG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