@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":"runtime-response-integrity.js","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-response-integrity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,IAAI,IAAI,WAAW,EACnB,MAAM,IAAI,aAAa,GAExB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAsB,MAAM,6BAA6B,CAAC;AACtJ,OAAO,EAAE,wBAAwB,EAAoC,MAAM,+BAA+B,CAAC;AAE3G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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2BAA2B,CAAC,CAAC;IACtH,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,KAAK,yBAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,gCAAgC,CAAC,kCAAkC,CAAC,aAAa,EAAE,yCAAyC,CAAC,CAAC;IAC1I,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n createHash,\n createPrivateKey,\n createPublicKey,\n randomBytes,\n sign as signWithKey,\n verify as verifyWithKey,\n type KeyObject,\n} from 'node:crypto';\nimport { PlatformApplicationType } from '@wildo-ai/platform-core-shared';\nimport { singleJwsTypeOf, CryptoKey_Purpose } from '@wildo-ai/saas-models';\nimport { canonicalizeJson } from '../canonical-json/rfc8785-canonical-json';\nimport { base64url, ES256_JWS_ALGORITHM, isP256PublicJwk, p256JwkThumbprint, p256PublicJwkOf, type P256PublicJwk } from '../key-management/es256-jws';\nimport { buildRuntimePrincipalKey, type ApplicationRuntimePrincipal } from './runtime-principal.contracts';\n\n/**\n * Integrity of what apps-manager tells an application runtime (#2921) and a platform service (#2898).\n *\n * A platform service (crontabs, module-registry) is held to the same contract with the same key: its audience is its\n * own platform application (`SERVICE_NAME`, the record the request authenticated against) and the backend principal,\n * and the route binding keeps an answer on one plane (`platform-services-to-manager`) from standing in for the other\n * (`apps-to-manager`).\n *\n * An application runtime (backend, minion, worker, development companion) learns its configuration, its secrets, its\n * worker bootstrap, its storage session and its runtime-principal tokens from apps-manager, over HTTP. Before this\n * contract it verified none of it: anything that could answer on `PLATFORM_APPS_MANAGER_URL` (a wrong DNS answer, a\n * plain-HTTP hop, an impostor service) could hand a runtime a configuration and secrets of its choosing.\n *\n * ## The contract\n *\n * - **apps-manager signs every successful response** on the runtime-facing routes with its RESPONSE key, a key used for\n * nothing else (not the key that signs runtime-principal tokens or crontabs requests: one key per purpose, NIST SP\n * 800-57 Part 1 Rev 5 §5.2). The signature travels in {@link RUNTIME_RESPONSE_SIGNATURE_HEADER}.\n * - **The signature is a compact JWS** (RFC 7515) with `alg: ES256`, `typ: wildo-runtime-response+jws` and a `kid`\n * that is the RFC 7638 thumbprint of the signing key. Its claims bind:\n * - `bodyDigest`: SHA-256 over the RFC 8785 (JCS) serialization of the body as sent (`canonicalizeJson`). The signer\n * digests the exact text it sends, parsed back, so a `Date` or an `undefined` in the handler's object cannot make\n * the two sides digest different values. RFC 8785 rather than a sorted `JSON.stringify`: the latter drops a\n * `\"__proto__\"` member (so one could be added to a signed body undetected) and orders integer-like keys the\n * JavaScript way, which no verifier in another language reproduces;\n * - `aud`: the application id and the runtime principal the request authenticated as;\n * - `nonce`: echoed from {@link RUNTIME_RESPONSE_NONCE_HEADER}, which the runtime generates fresh for every request.\n * Replay protection rests on this nonce and on a short lifetime, never on a version a freshly booted runtime\n * cannot remember;\n * - `htm` / `htu`: the request's method and its apps-to-manager route (the DPoP pattern, RFC 9449 §4.2), so a\n * genuine answer from one route cannot stand in for another under the same nonce;\n * - `iat` / `exp`: a {@link RUNTIME_RESPONSE_SIGNATURE_LIFETIME_SECONDS}-second window.\n * - **Runtimes verify, fail-closed**, against up to {@link RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS} public keys (current\n * and next) carried in their environment as a one-line JWKS, so the response key can rotate without a flag day.\n *\n * ## Its key purpose (#2891)\n *\n * The response key is the {@link RUNTIME_RESPONSE_KEY_PURPOSE} key: platform-scoped, held by apps-manager alone, used for\n * nothing else, and requested by nobody (its descriptor's `heldBy` and `mayRequestSignature` are empty). Its `typ`,\n * algorithm and cryptoperiod are the purpose's. Its versions are the two the runtimes accept, current and next, which\n * is the purpose's ACTIVE and NEXT.\n *\n * It stays in apps-manager's environment rather than in the platform keyring, deliberately: a runtime has to hold the\n * verification keys BEFORE it can trust anything apps-manager says, so they reach it out of band, in its environment,\n * and so does the signing half. A keyring version would be announced over the very channel the key authenticates.\n *\n * ## What this protects, stated\n *\n * The network path and an impostor apps-manager. NOT the host: the host supplies each runtime's environment, so it\n * supplies the verification keys too.\n *\n * ## Why not a library\n *\n * ES256 over a compact JWS is a few lines of `node:crypto` (`dsaEncoding: 'ieee-p1363'` gives the raw r‖s form RFC 7518\n * §3.4 requires). Every party here already runs Node, and the verifier must load in the dependency-light worker\n * runtime, so taking no JOSE dependency keeps one implementation on both sides.\n */\n\n/** The key purpose that signs runtime responses (#2891): the response key is used for nothing else. */\nexport const RUNTIME_RESPONSE_KEY_PURPOSE = CryptoKey_Purpose.PLATFORM_RESPONSE_INTEGRITY;\n\n/**\n * The JWS `typ`, so a response signature can never be mistaken for any other JWS the platform issues (RFC 8725 §3.11):\n * the response purpose's, from its descriptor, distinct from every other purpose's.\n */\nexport const RUNTIME_RESPONSE_JWS_TYPE: string = singleJwsTypeOf(RUNTIME_RESPONSE_KEY_PURPOSE);\n\n/** The only algorithm accepted, pinned rather than read from the header (RFC 8725 §3.1): the purpose's ES256. */\nexport const RUNTIME_RESPONSE_JWS_ALGORITHM = ES256_JWS_ALGORITHM;\n\n/** The issuer every response signature carries: apps-manager. */\nexport const RUNTIME_RESPONSE_ISSUER: string = PlatformApplicationType.PLATFORM_APPS_MANAGER;\n\n/** Response header carrying the compact JWS. */\nexport const RUNTIME_RESPONSE_SIGNATURE_HEADER = 'x-wildo-response-signature';\n\n/** Request header carrying the runtime's fresh nonce, echoed into the signature's `nonce` claim. */\nexport const RUNTIME_RESPONSE_NONCE_HEADER = 'x-wildo-response-nonce';\n\n/**\n * How long a response signature is valid. It only needs to cover one round trip plus clock skew: the nonce is what\n * stops a replay, and the window bounds how long a captured response is worth anything at all.\n */\nexport const RUNTIME_RESPONSE_SIGNATURE_LIFETIME_SECONDS = 60;\n\n/** Tolerated clock difference between apps-manager and a runtime, in both directions. */\nexport const RUNTIME_RESPONSE_CLOCK_SKEW_SECONDS = 30;\n\n/** Random bytes in a nonce (256 bits, base64url-encoded). */\nexport const RUNTIME_RESPONSE_NONCE_BYTES = 32;\n\n/** Current and next: a runtime accepts at most two response keys, so the key can rotate without a flag day. */\nexport const RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS = 2;\n\n/**\n * Why a response was refused. A closed vocabulary so a log, a test or an alert can branch on the reason rather than on\n * an English message.\n */\nexport enum RuntimeResponseVerificationFailure {\n /** No signature header on a successful response. */\n MISSING_SIGNATURE = 'missing_signature',\n /** The header is not a three-part compact JWS, or a part does not decode. */\n MALFORMED_SIGNATURE = 'malformed_signature',\n /** The JWS `typ` is not {@link RUNTIME_RESPONSE_JWS_TYPE}. */\n WRONG_TYPE = 'wrong_type',\n /** The JWS `alg` is not {@link RUNTIME_RESPONSE_JWS_ALGORITHM}. */\n UNSUPPORTED_ALGORITHM = 'unsupported_algorithm',\n /** The `kid` names no key the runtime holds. */\n UNKNOWN_KEY = 'unknown_key',\n /** The signature does not verify under the named key. */\n BAD_SIGNATURE = 'bad_signature',\n /** The issuer is not apps-manager. */\n WRONG_ISSUER = 'wrong_issuer',\n /** The audience names another application or another runtime principal. */\n WRONG_AUDIENCE = 'wrong_audience',\n /** The echoed nonce is not the one this request sent. */\n NONCE_MISMATCH = 'nonce_mismatch',\n /** The response answers another method or route than the one this request used. */\n WRONG_REQUEST = 'wrong_request',\n /** Past `exp` (beyond the skew tolerance). */\n EXPIRED = 'expired',\n /** `iat` is in the future (beyond the skew tolerance). */\n NOT_YET_VALID = 'not_yet_valid',\n /** The body received is not the body that was signed. */\n BODY_MISMATCH = 'body_mismatch',\n}\n\n/** Thrown by {@link verifyRuntimeResponse}; `failure` is the branchable reason. */\nexport class RuntimeResponseVerificationError extends Error {\n readonly failure: RuntimeResponseVerificationFailure;\n\n constructor(failure: RuntimeResponseVerificationFailure, message: string) {\n super(`apps-manager response refused (${failure}): ${message}`);\n this.name = 'RuntimeResponseVerificationError';\n this.failure = failure;\n }\n}\n\n/**\n * Whether a caught value is a {@link RuntimeResponseVerificationError}. Decided by name and reason rather than\n * `instanceof`, because a runtime can load two copies of this package (an application's injected snapshot beside the\n * engine's), and a refusal thrown by one copy must still be recognised by code holding the other.\n */\nexport function isRuntimeResponseVerificationError(value: unknown): value is RuntimeResponseVerificationError {\n if (value instanceof RuntimeResponseVerificationError) return true;\n if (!(value instanceof Error) || value.name !== 'RuntimeResponseVerificationError') return false;\n const failure = (value as { failure?: unknown }).failure;\n return Object.values(RuntimeResponseVerificationFailure).includes(failure as RuntimeResponseVerificationFailure);\n}\n\n/** The audience of a response: which application, and which of its runtime principals, the answer is for. */\nexport interface RuntimeResponseAudience {\n application: string;\n /** {@link buildRuntimePrincipalKey} of the principal the request authenticated as. */\n principal: string;\n}\n\n/**\n * The route a request is bound to: its path without query and without a leading API mount prefix (`/api/v1`). apps-manager\n * serves its runtime-facing and platform-facing routes both at the root and under that prefix, and a caller may use\n * either, so both sides derive the route from the URL they actually used and drop the prefix before comparing.\n *\n * Only that prefix is dropped, so `PLATFORM_APPS_MANAGER_URL` must name the service's ROOT (`http(s)://host[:port]`, as\n * every generated address does). A URL carrying a path prefix that a reverse proxy strips would bind a different route\n * on each side and be refused as `wrong_request`.\n */\nexport function runtimeResponseRouteOf(urlOrPath: string): string {\n const pathname = urlOrPath.includes('://') ? new URL(urlOrPath).pathname : (urlOrPath.split('?')[0] ?? '');\n return pathname.replace(/^\\/api\\/v\\d+(?=\\/)/, '');\n}\n\n/** The request a response answers: its method and its URL (absolute, or a path). */\nexport interface RuntimeResponseRequestBinding {\n method: string;\n url: string;\n}\n\n/** The claims a response signature carries. */\nexport interface RuntimeResponseClaims {\n iss: string;\n aud: RuntimeResponseAudience;\n /** The request's nonce, or `null` when the caller sent none. Every verifying caller sends one, so a verifier always demands it. */\n nonce: string | null;\n /** base64url(SHA-256(canonical body)). */\n bodyDigest: string;\n /** The request's method, upper-cased. */\n htm: string;\n /** The request's route, per {@link runtimeResponseRouteOf}. */\n htu: string;\n iat: number;\n exp: number;\n}\n\n/** One verification key, ready to use. */\nexport interface RuntimeResponseVerificationKey {\n kid: string;\n key: KeyObject;\n}\n\n/** RFC 7638 thumbprint of a P-256 public key (the shared implementation, `p256JwkThumbprint`). */\nexport function runtimeResponseKeyThumbprint(jwk: P256PublicJwk): string {\n return p256JwkThumbprint(jwk);\n}\n\nfunction publicJwkOf(key: KeyObject): P256PublicJwk {\n try {\n return p256PublicJwkOf(key);\n } catch {\n throw new Error('The apps-manager response key must be an EC P-256 key.');\n }\n}\n\n/**\n * Digest of a JSON value as it travels: SHA-256 over its canonical serialization, base64url-encoded.\n *\n * Takes the PARSED value. The signer passes `JSON.parse` of the exact text it sends; the verifier passes the body it\n * parsed. Both therefore digest the same JSON value, whatever the handler's object held before serialization.\n */\nexport function runtimeResponseBodyDigest(body: unknown): string {\n return base64url(createHash('sha256').update(canonicalizeJson(body)).digest());\n}\n\n/** A fresh nonce for one request. */\nexport function createRuntimeResponseNonce(): string {\n return base64url(randomBytes(RUNTIME_RESPONSE_NONCE_BYTES));\n}\n\n/**\n * Build the environment value that carries a runtime's verification keys: a one-line JWKS of up to two public keys\n * (current first, then next).\n *\n * A JWKS rather than PEM because a PEM is multi-line, and multi-line values are where `.env` files and orchestrators\n * disagree. Used by every lane's environment builder, so the format has one producer.\n */\nexport function buildRuntimeResponseVerificationKeySet(publicKeyPems: readonly string[]): string {\n const keys = publicKeyPems.filter((pem) => pem.trim().length > 0);\n if (keys.length === 0 || keys.length > RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS) {\n throw new Error(\n `A runtime takes one or ${RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS} apps-manager response keys (current, then next); got ${keys.length}.`,\n );\n }\n return JSON.stringify({\n keys: keys.map((pem) => {\n const jwk = publicJwkOf(createPublicKey(pem));\n return { ...jwk, kid: runtimeResponseKeyThumbprint(jwk), alg: RUNTIME_RESPONSE_JWS_ALGORITHM, use: 'sig' };\n }),\n });\n}\n\n/**\n * Parse the environment value {@link buildRuntimeResponseVerificationKeySet} produced.\n *\n * 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:\n * the thumbprint is recomputed, never trusted, so a key cannot be filed under another key's id.\n */\nexport function parseRuntimeResponseVerificationKeySet(value: string): RuntimeResponseVerificationKey[] {\n let parsed: unknown;\n try {\n parsed = JSON.parse(value);\n } catch {\n throw new Error('The apps-manager response verification keys are not valid JSON.');\n }\n const keys = (parsed as { keys?: unknown } | null)?.keys;\n if (!Array.isArray(keys) || keys.length === 0 || keys.length > RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS) {\n throw new Error(\n `The apps-manager response verification keys must be a JWKS of one or ${RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS} keys.`,\n );\n }\n return keys.map((candidate: unknown) => {\n if (!isP256PublicJwk(candidate)) {\n throw new Error('Every apps-manager response verification key must be an EC P-256 public key.');\n }\n const kid = runtimeResponseKeyThumbprint(candidate);\n const declaredKid = (candidate as { kid?: unknown }).kid;\n if (declaredKid !== undefined && declaredKid !== kid) {\n throw new Error('An apps-manager response verification key is filed under a kid that is not its own thumbprint.');\n }\n const key = createPublicKey({ key: { kty: 'EC', crv: 'P-256', x: candidate.x, y: candidate.y }, format: 'jwk' });\n return { kid, key };\n });\n}\n\n/**\n * Why a response signing key cannot be used with a published key set, or `null` when it can.\n *\n * apps-manager calls this at startup: a signing key that runtimes do not hold makes every runtime refuse every answer,\n * and that is far cheaper to refuse once, at apps-manager's boot, naming the remedy, than in every runtime.\n */\nexport function describeRuntimeResponseSigningKeyMismatch(privateKeyPem: string, verificationKeySet: string): string | null {\n let kid: string;\n try {\n kid = runtimeResponseKeyThumbprint(publicJwkOf(createPublicKey(createPrivateKey(privateKeyPem.trim()))));\n } catch (error) {\n return `the response signing key does not parse as an EC P-256 private key (${error instanceof Error ? error.message : String(error)})`;\n }\n let published: RuntimeResponseVerificationKey[];\n try {\n published = parseRuntimeResponseVerificationKeySet(verificationKeySet);\n } catch (error) {\n return error instanceof Error ? error.message : String(error);\n }\n return published.some((key) => key.kid === kid)\n ? null\n : 'the response signing key is not in the published verification key set, so every application runtime would refuse every answer';\n}\n\n/** What apps-manager needs to sign one response. */\nexport interface SignRuntimeResponseInput {\n /** The response key's private half (PEM, SEC1 or PKCS#8). */\n privateKeyPem: string;\n /** The exact text that will be sent as the body. */\n bodyText: string;\n application: string;\n principal: ApplicationRuntimePrincipal;\n /** The request's {@link RUNTIME_RESPONSE_NONCE_HEADER}, or `null` if it sent none. */\n nonce: string | null;\n /** The request being answered. */\n request: RuntimeResponseRequestBinding;\n /** Seconds since the epoch; injectable for tests. */\n nowSeconds?: number;\n}\n\n/**\n * Sign one response. Throws rather than returning nothing: a response that cannot be signed must not be sent.\n */\nexport function signRuntimeResponse(input: SignRuntimeResponseInput): string {\n const privateKey = createPrivateKey(input.privateKeyPem.trim());\n const publicJwk = publicJwkOf(createPublicKey(privateKey));\n const iat = input.nowSeconds ?? Math.floor(Date.now() / 1000);\n const header = { alg: RUNTIME_RESPONSE_JWS_ALGORITHM, typ: RUNTIME_RESPONSE_JWS_TYPE, kid: runtimeResponseKeyThumbprint(publicJwk) };\n const claims: RuntimeResponseClaims = {\n iss: RUNTIME_RESPONSE_ISSUER,\n aud: { application: input.application, principal: buildRuntimePrincipalKey(input.principal) },\n nonce: input.nonce,\n bodyDigest: runtimeResponseBodyDigest(JSON.parse(input.bodyText)),\n htm: input.request.method.toUpperCase(),\n htu: runtimeResponseRouteOf(input.request.url),\n iat,\n exp: iat + RUNTIME_RESPONSE_SIGNATURE_LIFETIME_SECONDS,\n };\n const signingInput = `${base64url(JSON.stringify(header))}.${base64url(JSON.stringify(claims))}`;\n const signature = signWithKey('sha256', Buffer.from(signingInput), { key: privateKey, dsaEncoding: 'ieee-p1363' });\n return `${signingInput}.${base64url(signature)}`;\n}\n\n/** What a runtime needs to verify one response. */\nexport interface VerifyRuntimeResponseInput {\n /** The {@link RUNTIME_RESPONSE_SIGNATURE_HEADER} value, as received (absent when missing). */\n signature: string | null | undefined;\n /** The body, parsed from JSON. */\n body: unknown;\n keys: readonly RuntimeResponseVerificationKey[];\n /** The runtime's own `APPLICATION_ID`. */\n application: string;\n /**\n * The principal the runtime authenticates as, when it knows it. Omitted only by a caller that cannot know it at that\n * point; the nonce still binds the response to this one request, so a response meant for a sibling cannot be replayed.\n */\n principal?: ApplicationRuntimePrincipal;\n /** The nonce this request sent. */\n nonce: string;\n /** The request this runtime sent. */\n request: RuntimeResponseRequestBinding;\n nowSeconds?: number;\n}\n\nfunction decodeSegment(segment: string): Record<string, unknown> {\n try {\n const value: unknown = JSON.parse(Buffer.from(segment, 'base64url').toString('utf8'));\n if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error('not an object');\n return value as Record<string, unknown>;\n } catch {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.MALFORMED_SIGNATURE, 'a JWS segment does not decode to a JSON object');\n }\n}\n\n/**\n * Verify one response, fail-closed. Returns the verified claims; throws {@link RuntimeResponseVerificationError}\n * otherwise. The header's `alg` and `typ` are checked against pinned values and never used to choose an algorithm.\n */\n// assurance-control: WILDO.SECRETS.CONTRACT_INTEGRITY — a runtime trusts no configuration or secret apps-manager did not sign for it, for this request (#2921)\nexport function verifyRuntimeResponse(input: VerifyRuntimeResponseInput): RuntimeResponseClaims {\n const { signature } = input;\n if (!signature) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.MISSING_SIGNATURE, 'the response carries no signature');\n }\n const parts = signature.split('.');\n if (parts.length !== 3 || parts.some((part) => part.length === 0)) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.MALFORMED_SIGNATURE, 'not a compact JWS');\n }\n const [encodedHeader, encodedClaims, encodedSignature] = parts as [string, string, string];\n const header = decodeSegment(encodedHeader);\n if (header.typ !== RUNTIME_RESPONSE_JWS_TYPE) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.WRONG_TYPE, `typ is ${String(header.typ)}`);\n }\n if (header.alg !== RUNTIME_RESPONSE_JWS_ALGORITHM) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.UNSUPPORTED_ALGORITHM, `alg is ${String(header.alg)}`);\n }\n const verificationKey = input.keys.find((candidate) => candidate.kid === header.kid);\n if (!verificationKey) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.UNKNOWN_KEY, `no verification key has kid ${String(header.kid)}`);\n }\n const verified = verifyWithKey(\n 'sha256',\n Buffer.from(`${encodedHeader}.${encodedClaims}`),\n { key: verificationKey.key, dsaEncoding: 'ieee-p1363' },\n Buffer.from(encodedSignature, 'base64url'),\n );\n if (!verified) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.BAD_SIGNATURE, 'the signature does not verify');\n }\n\n const claims = decodeSegment(encodedClaims) as unknown as RuntimeResponseClaims;\n if (claims.iss !== RUNTIME_RESPONSE_ISSUER) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.WRONG_ISSUER, `iss is ${String(claims.iss)}`);\n }\n const audience = claims.aud as RuntimeResponseAudience | undefined;\n if (!audience || audience.application !== input.application) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.WRONG_AUDIENCE, 'the response is for another application');\n }\n if (input.principal && audience.principal !== buildRuntimePrincipalKey(input.principal)) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.WRONG_AUDIENCE, 'the response is for another runtime principal');\n }\n if (claims.nonce !== input.nonce) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.NONCE_MISMATCH, 'the response does not echo this request\\'s nonce');\n }\n if (claims.htm !== input.request.method.toUpperCase() || claims.htu !== runtimeResponseRouteOf(input.request.url)) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.WRONG_REQUEST, 'the response answers another request');\n }\n const now = input.nowSeconds ?? Math.floor(Date.now() / 1000);\n if (typeof claims.iat !== 'number' || typeof claims.exp !== 'number') {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.MALFORMED_SIGNATURE, 'iat and exp must be numbers');\n }\n if (claims.iat > now + RUNTIME_RESPONSE_CLOCK_SKEW_SECONDS) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.NOT_YET_VALID, 'iat is in the future');\n }\n if (claims.exp < now - RUNTIME_RESPONSE_CLOCK_SKEW_SECONDS) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.EXPIRED, 'the signature has expired');\n }\n if (claims.bodyDigest !== runtimeResponseBodyDigest(input.body)) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.BODY_MISMATCH, 'the body is not the one that was signed');\n }\n return claims;\n}\n"]}
1
+ {"version":3,"file":"runtime-response-integrity.js","sourceRoot":"","sources":["../../../src/bootstrap/runtime-response-integrity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,IAAI,IAAI,WAAW,EACnB,MAAM,IAAI,aAAa,GAExB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAsB,MAAM,6BAA6B,CAAC;AACtJ,OAAO,EAAE,wBAAwB,EAAoC,MAAM,+BAA+B,CAAC;AAE3G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,uGAAuG;AACvG,MAAM,CAAC,MAAM,4BAA4B,GAAG,iBAAiB,CAAC,2BAA2B,CAAC;AAE1F;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAW,eAAe,CAAC,4BAA4B,CAAC,CAAC;AAE/F,iHAAiH;AACjH,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAAmB,CAAC;AAElE,iEAAiE;AACjE,MAAM,CAAC,MAAM,uBAAuB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E,IAAI,MAAM,CAAC,GAAG,KAAK,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAClH,MAAM,IAAI,gCAAgC,CAAC,kCAAkC,CAAC,aAAa,EAAE,sCAAsC,CAAC,CAAC;IACvI,CAAC;IACD,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9D,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;QACrE,MAAM,IAAI,gCAAgC,CAAC,kCAAkC,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC;IACpI,CAAC;IACD,IAAI,MAAM,CAAC,GAAG,GAAG,GAAG,GAAG,mCAAmC,EAAE,CAAC;QAC3D,MAAM,IAAI,gCAAgC,CAAC,kCAAkC,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC;IACvH,CAAC;IACD,IAAI,MAAM,CAAC,GAAG,GAAG,GAAG,GAAG,mCAAmC,EAAE,CAAC;QAC3D,MAAM,IAAI,gCAAgC,CAAC,kCAAkC,CAAC,OAAO,EAAE,2BAA2B,CAAC,CAAC;IACtH,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,KAAK,yBAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,gCAAgC,CAAC,kCAAkC,CAAC,aAAa,EAAE,yCAAyC,CAAC,CAAC;IAC1I,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n createHash,\n createPrivateKey,\n createPublicKey,\n randomBytes,\n sign as signWithKey,\n verify as verifyWithKey,\n type KeyObject,\n} from 'node:crypto';\nimport { PlatformApplicationType } from '@wildo-ai/platform-core-shared';\nimport { singleJwsTypeOf, CryptoKey_Purpose, describeCaughtError } from '@wildo-ai/saas-models';\nimport { canonicalizeJson } from '../canonical-json/rfc8785-canonical-json';\nimport { base64url, ES256_JWS_ALGORITHM, isP256PublicJwk, p256JwkThumbprint, p256PublicJwkOf, type P256PublicJwk } from '../key-management/es256-jws';\nimport { buildRuntimePrincipalKey, type ApplicationRuntimePrincipal } from './runtime-principal.contracts';\n\n/**\n * Integrity of what apps-manager tells an application runtime (#2921) and a platform service (#2898).\n *\n * A platform service (crontabs, module-registry) is held to the same contract with the same key: its audience is its\n * own platform application (`SERVICE_NAME`, the record the request authenticated against) and the backend principal,\n * and the route binding keeps an answer on one plane (`platform-services-to-manager`) from standing in for the other\n * (`apps-to-manager`).\n *\n * An application runtime (backend, minion, worker, development companion) learns its configuration, its secrets, its\n * worker bootstrap, its storage session and its runtime-principal tokens from apps-manager, over HTTP. Before this\n * contract it verified none of it: anything that could answer on `PLATFORM_APPS_MANAGER_URL` (a wrong DNS answer, a\n * plain-HTTP hop, an impostor service) could hand a runtime a configuration and secrets of its choosing.\n *\n * ## The contract\n *\n * - **apps-manager signs every successful response** on the runtime-facing routes with its RESPONSE key, a key used for\n * nothing else (not the key that signs runtime-principal tokens or crontabs requests: one key per purpose, NIST SP\n * 800-57 Part 1 Rev 5 §5.2). The signature travels in {@link RUNTIME_RESPONSE_SIGNATURE_HEADER}.\n * - **The signature is a compact JWS** (RFC 7515) with `alg: ES256`, `typ: wildo-runtime-response+jws` and a `kid`\n * that is the RFC 7638 thumbprint of the signing key. Its claims bind:\n * - `bodyDigest`: SHA-256 over the RFC 8785 (JCS) serialization of the body as sent (`canonicalizeJson`). The signer\n * digests the exact text it sends, parsed back, so a `Date` or an `undefined` in the handler's object cannot make\n * the two sides digest different values. RFC 8785 rather than a sorted `JSON.stringify`: the latter drops a\n * `\"__proto__\"` member (so one could be added to a signed body undetected) and orders integer-like keys the\n * JavaScript way, which no verifier in another language reproduces;\n * - `aud`: the application id and the runtime principal the request authenticated as;\n * - `nonce`: echoed from {@link RUNTIME_RESPONSE_NONCE_HEADER}, which the runtime generates fresh for every request.\n * Replay protection rests on this nonce and on a short lifetime, never on a version a freshly booted runtime\n * cannot remember;\n * - `htm` / `htu`: the request's method and its apps-to-manager route (the DPoP pattern, RFC 9449 §4.2), so a\n * genuine answer from one route cannot stand in for another under the same nonce;\n * - `iat` / `exp`: a {@link RUNTIME_RESPONSE_SIGNATURE_LIFETIME_SECONDS}-second window.\n * - **Runtimes verify, fail-closed**, against up to {@link RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS} public keys (current\n * and next) carried in their environment as a one-line JWKS, so the response key can rotate without a flag day.\n *\n * ## Its key purpose (#2891)\n *\n * The response key is the {@link RUNTIME_RESPONSE_KEY_PURPOSE} key: platform-scoped, held by apps-manager alone, used for\n * nothing else, and requested by nobody (its descriptor's `heldBy` and `mayRequestSignature` are empty). Its `typ`,\n * algorithm and cryptoperiod are the purpose's. Its versions are the two the runtimes accept, current and next, which\n * is the purpose's ACTIVE and NEXT.\n *\n * It stays in apps-manager's environment rather than in the platform keyring, deliberately: a runtime has to hold the\n * verification keys BEFORE it can trust anything apps-manager says, so they reach it out of band, in its environment,\n * and so does the signing half. A keyring version would be announced over the very channel the key authenticates.\n *\n * ## What this protects, stated\n *\n * The network path and an impostor apps-manager. NOT the host: the host supplies each runtime's environment, so it\n * supplies the verification keys too.\n *\n * ## Why not a library\n *\n * ES256 over a compact JWS is a few lines of `node:crypto` (`dsaEncoding: 'ieee-p1363'` gives the raw r‖s form RFC 7518\n * §3.4 requires). Every party here already runs Node, and the verifier must load in the dependency-light worker\n * runtime, so taking no JOSE dependency keeps one implementation on both sides.\n */\n\n/** The key purpose that signs runtime responses (#2891): the response key is used for nothing else. */\nexport const RUNTIME_RESPONSE_KEY_PURPOSE = CryptoKey_Purpose.PLATFORM_RESPONSE_INTEGRITY;\n\n/**\n * The JWS `typ`, so a response signature can never be mistaken for any other JWS the platform issues (RFC 8725 §3.11):\n * the response purpose's, from its descriptor, distinct from every other purpose's.\n */\nexport const RUNTIME_RESPONSE_JWS_TYPE: string = singleJwsTypeOf(RUNTIME_RESPONSE_KEY_PURPOSE);\n\n/** The only algorithm accepted, pinned rather than read from the header (RFC 8725 §3.1): the purpose's ES256. */\nexport const RUNTIME_RESPONSE_JWS_ALGORITHM = ES256_JWS_ALGORITHM;\n\n/** The issuer every response signature carries: apps-manager. */\nexport const RUNTIME_RESPONSE_ISSUER: string = PlatformApplicationType.PLATFORM_APPS_MANAGER;\n\n/** Response header carrying the compact JWS. */\nexport const RUNTIME_RESPONSE_SIGNATURE_HEADER = 'x-wildo-response-signature';\n\n/** Request header carrying the runtime's fresh nonce, echoed into the signature's `nonce` claim. */\nexport const RUNTIME_RESPONSE_NONCE_HEADER = 'x-wildo-response-nonce';\n\n/**\n * How long a response signature is valid. It only needs to cover one round trip plus clock skew: the nonce is what\n * stops a replay, and the window bounds how long a captured response is worth anything at all.\n */\nexport const RUNTIME_RESPONSE_SIGNATURE_LIFETIME_SECONDS = 60;\n\n/** Tolerated clock difference between apps-manager and a runtime, in both directions. */\nexport const RUNTIME_RESPONSE_CLOCK_SKEW_SECONDS = 30;\n\n/** Random bytes in a nonce (256 bits, base64url-encoded). */\nexport const RUNTIME_RESPONSE_NONCE_BYTES = 32;\n\n/** Current and next: a runtime accepts at most two response keys, so the key can rotate without a flag day. */\nexport const RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS = 2;\n\n/**\n * Why a response was refused. A closed vocabulary so a log, a test or an alert can branch on the reason rather than on\n * an English message.\n */\nexport enum RuntimeResponseVerificationFailure {\n /** No signature header on a successful response. */\n MISSING_SIGNATURE = 'missing_signature',\n /** The header is not a three-part compact JWS, or a part does not decode. */\n MALFORMED_SIGNATURE = 'malformed_signature',\n /** The JWS `typ` is not {@link RUNTIME_RESPONSE_JWS_TYPE}. */\n WRONG_TYPE = 'wrong_type',\n /** The JWS `alg` is not {@link RUNTIME_RESPONSE_JWS_ALGORITHM}. */\n UNSUPPORTED_ALGORITHM = 'unsupported_algorithm',\n /** The `kid` names no key the runtime holds. */\n UNKNOWN_KEY = 'unknown_key',\n /** The signature does not verify under the named key. */\n BAD_SIGNATURE = 'bad_signature',\n /** The issuer is not apps-manager. */\n WRONG_ISSUER = 'wrong_issuer',\n /** The audience names another application or another runtime principal. */\n WRONG_AUDIENCE = 'wrong_audience',\n /** The echoed nonce is not the one this request sent. */\n NONCE_MISMATCH = 'nonce_mismatch',\n /** The response answers another method or route than the one this request used. */\n WRONG_REQUEST = 'wrong_request',\n /** Past `exp` (beyond the skew tolerance). */\n EXPIRED = 'expired',\n /** `iat` is in the future (beyond the skew tolerance). */\n NOT_YET_VALID = 'not_yet_valid',\n /** The body received is not the body that was signed. */\n BODY_MISMATCH = 'body_mismatch',\n}\n\n/** Thrown by {@link verifyRuntimeResponse}; `failure` is the branchable reason. */\nexport class RuntimeResponseVerificationError extends Error {\n readonly failure: RuntimeResponseVerificationFailure;\n\n constructor(failure: RuntimeResponseVerificationFailure, message: string) {\n super(`apps-manager response refused (${failure}): ${message}`);\n this.name = 'RuntimeResponseVerificationError';\n this.failure = failure;\n }\n}\n\n/**\n * Whether a caught value is a {@link RuntimeResponseVerificationError}. Decided by name and reason rather than\n * `instanceof`, because a runtime can load two copies of this package (an application's injected snapshot beside the\n * engine's), and a refusal thrown by one copy must still be recognised by code holding the other.\n */\nexport function isRuntimeResponseVerificationError(value: unknown): value is RuntimeResponseVerificationError {\n if (value instanceof RuntimeResponseVerificationError) return true;\n if (!(value instanceof Error) || value.name !== 'RuntimeResponseVerificationError') return false;\n const failure = (value as { failure?: unknown }).failure;\n return Object.values(RuntimeResponseVerificationFailure).includes(failure as RuntimeResponseVerificationFailure);\n}\n\n/** The audience of a response: which application, and which of its runtime principals, the answer is for. */\nexport interface RuntimeResponseAudience {\n application: string;\n /** {@link buildRuntimePrincipalKey} of the principal the request authenticated as. */\n principal: string;\n}\n\n/**\n * The route a request is bound to: its path without query and without a leading API mount prefix (`/api/v1`). apps-manager\n * serves its runtime-facing and platform-facing routes both at the root and under that prefix, and a caller may use\n * either, so both sides derive the route from the URL they actually used and drop the prefix before comparing.\n *\n * Only that prefix is dropped, so `PLATFORM_APPS_MANAGER_URL` must name the service's ROOT (`http(s)://host[:port]`, as\n * every generated address does). A URL carrying a path prefix that a reverse proxy strips would bind a different route\n * on each side and be refused as `wrong_request`.\n */\nexport function runtimeResponseRouteOf(urlOrPath: string): string {\n const pathname = urlOrPath.includes('://') ? new URL(urlOrPath).pathname : (urlOrPath.split('?')[0] ?? '');\n return pathname.replace(/^\\/api\\/v\\d+(?=\\/)/, '');\n}\n\n/** The request a response answers: its method and its URL (absolute, or a path). */\nexport interface RuntimeResponseRequestBinding {\n method: string;\n url: string;\n}\n\n/** The claims a response signature carries. */\nexport interface RuntimeResponseClaims {\n iss: string;\n aud: RuntimeResponseAudience;\n /** The request's nonce, or `null` when the caller sent none. Every verifying caller sends one, so a verifier always demands it. */\n nonce: string | null;\n /** base64url(SHA-256(canonical body)). */\n bodyDigest: string;\n /** The request's method, upper-cased. */\n htm: string;\n /** The request's route, per {@link runtimeResponseRouteOf}. */\n htu: string;\n iat: number;\n exp: number;\n}\n\n/** One verification key, ready to use. */\nexport interface RuntimeResponseVerificationKey {\n kid: string;\n key: KeyObject;\n}\n\n/** RFC 7638 thumbprint of a P-256 public key (the shared implementation, `p256JwkThumbprint`). */\nexport function runtimeResponseKeyThumbprint(jwk: P256PublicJwk): string {\n return p256JwkThumbprint(jwk);\n}\n\nfunction publicJwkOf(key: KeyObject): P256PublicJwk {\n try {\n return p256PublicJwkOf(key);\n } catch {\n throw new Error('The apps-manager response key must be an EC P-256 key.');\n }\n}\n\n/**\n * Digest of a JSON value as it travels: SHA-256 over its canonical serialization, base64url-encoded.\n *\n * Takes the PARSED value. The signer passes `JSON.parse` of the exact text it sends; the verifier passes the body it\n * parsed. Both therefore digest the same JSON value, whatever the handler's object held before serialization.\n */\nexport function runtimeResponseBodyDigest(body: unknown): string {\n return base64url(createHash('sha256').update(canonicalizeJson(body)).digest());\n}\n\n/** A fresh nonce for one request. */\nexport function createRuntimeResponseNonce(): string {\n return base64url(randomBytes(RUNTIME_RESPONSE_NONCE_BYTES));\n}\n\n/**\n * Build the environment value that carries a runtime's verification keys: a one-line JWKS of up to two public keys\n * (current first, then next).\n *\n * A JWKS rather than PEM because a PEM is multi-line, and multi-line values are where `.env` files and orchestrators\n * disagree. Used by every lane's environment builder, so the format has one producer.\n */\nexport function buildRuntimeResponseVerificationKeySet(publicKeyPems: readonly string[]): string {\n const keys = publicKeyPems.filter((pem) => pem.trim().length > 0);\n if (keys.length === 0 || keys.length > RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS) {\n throw new Error(\n `A runtime takes one or ${RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS} apps-manager response keys (current, then next); got ${keys.length}.`,\n );\n }\n return JSON.stringify({\n keys: keys.map((pem) => {\n const jwk = publicJwkOf(createPublicKey(pem));\n return { ...jwk, kid: runtimeResponseKeyThumbprint(jwk), alg: RUNTIME_RESPONSE_JWS_ALGORITHM, use: 'sig' };\n }),\n });\n}\n\n/**\n * Parse the environment value {@link buildRuntimeResponseVerificationKeySet} produced.\n *\n * 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:\n * the thumbprint is recomputed, never trusted, so a key cannot be filed under another key's id.\n */\nexport function parseRuntimeResponseVerificationKeySet(value: string): RuntimeResponseVerificationKey[] {\n let parsed: unknown;\n try {\n parsed = JSON.parse(value);\n } catch {\n throw new Error('The apps-manager response verification keys are not valid JSON.');\n }\n const keys = (parsed as { keys?: unknown } | null)?.keys;\n if (!Array.isArray(keys) || keys.length === 0 || keys.length > RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS) {\n throw new Error(\n `The apps-manager response verification keys must be a JWKS of one or ${RUNTIME_RESPONSE_MAX_VERIFICATION_KEYS} keys.`,\n );\n }\n return keys.map((candidate: unknown) => {\n if (!isP256PublicJwk(candidate)) {\n throw new Error('Every apps-manager response verification key must be an EC P-256 public key.');\n }\n const kid = runtimeResponseKeyThumbprint(candidate);\n const declaredKid = (candidate as { kid?: unknown }).kid;\n if (declaredKid !== undefined && declaredKid !== kid) {\n throw new Error('An apps-manager response verification key is filed under a kid that is not its own thumbprint.');\n }\n const key = createPublicKey({ key: { kty: 'EC', crv: 'P-256', x: candidate.x, y: candidate.y }, format: 'jwk' });\n return { kid, key };\n });\n}\n\n/**\n * Why a response signing key cannot be used with a published key set, or `null` when it can.\n *\n * apps-manager calls this at startup: a signing key that runtimes do not hold makes every runtime refuse every answer,\n * and that is far cheaper to refuse once, at apps-manager's boot, naming the remedy, than in every runtime.\n */\nexport function describeRuntimeResponseSigningKeyMismatch(privateKeyPem: string, verificationKeySet: string): string | null {\n let kid: string;\n try {\n kid = runtimeResponseKeyThumbprint(publicJwkOf(createPublicKey(createPrivateKey(privateKeyPem.trim()))));\n } catch (error) {\n return `the response signing key does not parse as an EC P-256 private key (${describeCaughtError(error)})`;\n }\n let published: RuntimeResponseVerificationKey[];\n try {\n published = parseRuntimeResponseVerificationKeySet(verificationKeySet);\n } catch (error) {\n return describeCaughtError(error);\n }\n return published.some((key) => key.kid === kid)\n ? null\n : 'the response signing key is not in the published verification key set, so every application runtime would refuse every answer';\n}\n\n/** What apps-manager needs to sign one response. */\nexport interface SignRuntimeResponseInput {\n /** The response key's private half (PEM, SEC1 or PKCS#8). */\n privateKeyPem: string;\n /** The exact text that will be sent as the body. */\n bodyText: string;\n application: string;\n principal: ApplicationRuntimePrincipal;\n /** The request's {@link RUNTIME_RESPONSE_NONCE_HEADER}, or `null` if it sent none. */\n nonce: string | null;\n /** The request being answered. */\n request: RuntimeResponseRequestBinding;\n /** Seconds since the epoch; injectable for tests. */\n nowSeconds?: number;\n}\n\n/**\n * Sign one response. Throws rather than returning nothing: a response that cannot be signed must not be sent.\n */\nexport function signRuntimeResponse(input: SignRuntimeResponseInput): string {\n const privateKey = createPrivateKey(input.privateKeyPem.trim());\n const publicJwk = publicJwkOf(createPublicKey(privateKey));\n const iat = input.nowSeconds ?? Math.floor(Date.now() / 1000);\n const header = { alg: RUNTIME_RESPONSE_JWS_ALGORITHM, typ: RUNTIME_RESPONSE_JWS_TYPE, kid: runtimeResponseKeyThumbprint(publicJwk) };\n const claims: RuntimeResponseClaims = {\n iss: RUNTIME_RESPONSE_ISSUER,\n aud: { application: input.application, principal: buildRuntimePrincipalKey(input.principal) },\n nonce: input.nonce,\n bodyDigest: runtimeResponseBodyDigest(JSON.parse(input.bodyText)),\n htm: input.request.method.toUpperCase(),\n htu: runtimeResponseRouteOf(input.request.url),\n iat,\n exp: iat + RUNTIME_RESPONSE_SIGNATURE_LIFETIME_SECONDS,\n };\n const signingInput = `${base64url(JSON.stringify(header))}.${base64url(JSON.stringify(claims))}`;\n const signature = signWithKey('sha256', Buffer.from(signingInput), { key: privateKey, dsaEncoding: 'ieee-p1363' });\n return `${signingInput}.${base64url(signature)}`;\n}\n\n/** What a runtime needs to verify one response. */\nexport interface VerifyRuntimeResponseInput {\n /** The {@link RUNTIME_RESPONSE_SIGNATURE_HEADER} value, as received (absent when missing). */\n signature: string | null | undefined;\n /** The body, parsed from JSON. */\n body: unknown;\n keys: readonly RuntimeResponseVerificationKey[];\n /** The runtime's own `APPLICATION_ID`. */\n application: string;\n /**\n * The principal the runtime authenticates as, when it knows it. Omitted only by a caller that cannot know it at that\n * point; the nonce still binds the response to this one request, so a response meant for a sibling cannot be replayed.\n */\n principal?: ApplicationRuntimePrincipal;\n /** The nonce this request sent. */\n nonce: string;\n /** The request this runtime sent. */\n request: RuntimeResponseRequestBinding;\n nowSeconds?: number;\n}\n\nfunction decodeSegment(segment: string): Record<string, unknown> {\n try {\n const value: unknown = JSON.parse(Buffer.from(segment, 'base64url').toString('utf8'));\n if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error('not an object');\n return value as Record<string, unknown>;\n } catch {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.MALFORMED_SIGNATURE, 'a JWS segment does not decode to a JSON object');\n }\n}\n\n/**\n * Verify one response, fail-closed. Returns the verified claims; throws {@link RuntimeResponseVerificationError}\n * otherwise. The header's `alg` and `typ` are checked against pinned values and never used to choose an algorithm.\n */\n// assurance-control: WILDO.SECRETS.CONTRACT_INTEGRITY — a runtime trusts no configuration or secret apps-manager did not sign for it, for this request (#2921)\nexport function verifyRuntimeResponse(input: VerifyRuntimeResponseInput): RuntimeResponseClaims {\n const { signature } = input;\n if (!signature) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.MISSING_SIGNATURE, 'the response carries no signature');\n }\n const parts = signature.split('.');\n if (parts.length !== 3 || parts.some((part) => part.length === 0)) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.MALFORMED_SIGNATURE, 'not a compact JWS');\n }\n const [encodedHeader, encodedClaims, encodedSignature] = parts as [string, string, string];\n const header = decodeSegment(encodedHeader);\n if (header.typ !== RUNTIME_RESPONSE_JWS_TYPE) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.WRONG_TYPE, `typ is ${String(header.typ)}`);\n }\n if (header.alg !== RUNTIME_RESPONSE_JWS_ALGORITHM) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.UNSUPPORTED_ALGORITHM, `alg is ${String(header.alg)}`);\n }\n const verificationKey = input.keys.find((candidate) => candidate.kid === header.kid);\n if (!verificationKey) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.UNKNOWN_KEY, `no verification key has kid ${String(header.kid)}`);\n }\n const verified = verifyWithKey(\n 'sha256',\n Buffer.from(`${encodedHeader}.${encodedClaims}`),\n { key: verificationKey.key, dsaEncoding: 'ieee-p1363' },\n Buffer.from(encodedSignature, 'base64url'),\n );\n if (!verified) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.BAD_SIGNATURE, 'the signature does not verify');\n }\n\n const claims = decodeSegment(encodedClaims) as unknown as RuntimeResponseClaims;\n if (claims.iss !== RUNTIME_RESPONSE_ISSUER) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.WRONG_ISSUER, `iss is ${String(claims.iss)}`);\n }\n const audience = claims.aud as RuntimeResponseAudience | undefined;\n if (!audience || audience.application !== input.application) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.WRONG_AUDIENCE, 'the response is for another application');\n }\n if (input.principal && audience.principal !== buildRuntimePrincipalKey(input.principal)) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.WRONG_AUDIENCE, 'the response is for another runtime principal');\n }\n if (claims.nonce !== input.nonce) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.NONCE_MISMATCH, 'the response does not echo this request\\'s nonce');\n }\n if (claims.htm !== input.request.method.toUpperCase() || claims.htu !== runtimeResponseRouteOf(input.request.url)) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.WRONG_REQUEST, 'the response answers another request');\n }\n const now = input.nowSeconds ?? Math.floor(Date.now() / 1000);\n if (typeof claims.iat !== 'number' || typeof claims.exp !== 'number') {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.MALFORMED_SIGNATURE, 'iat and exp must be numbers');\n }\n if (claims.iat > now + RUNTIME_RESPONSE_CLOCK_SKEW_SECONDS) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.NOT_YET_VALID, 'iat is in the future');\n }\n if (claims.exp < now - RUNTIME_RESPONSE_CLOCK_SKEW_SECONDS) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.EXPIRED, 'the signature has expired');\n }\n if (claims.bodyDigest !== runtimeResponseBodyDigest(input.body)) {\n throw new RuntimeResponseVerificationError(RuntimeResponseVerificationFailure.BODY_MISMATCH, 'the body is not the one that was signed');\n }\n return claims;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-secret-env.contracts.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-secret-env.contracts.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAItD,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAIrE"}
1
+ {"version":3,"file":"runtime-secret-env.contracts.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/runtime-secret-env.contracts.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAItD,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAIrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-secret-env.contracts.js","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-secret-env.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sCAAsC,EAAE,qCAAqC,EAAE,MAAM,gCAAgC,CAAC;AAC/H,OAAO,EAAE,oCAAoC,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAE5G,OAAO,EAAE,mCAAmC,EAAE,MAAM,kCAAkC,CAAC;AAEvF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAS;IAC1E,GAAG,mCAAmC;IACtC,GAAG,sCAAsC;IACzC,GAAG,qCAAqC;CACzC,CAAC,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAAkB;IAC1D,OAAO,uBAAuB,CAAC,GAAG,CAAC,UAAU,CAAC;WACzC,oCAAoC,CAAC,UAAU,CAAC,KAAK,IAAI;WACzD,6BAA6B,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AAC1D,CAAC","sourcesContent":["import { APPLICATION_BACKEND_SENSITIVE_ENV_KEYS, APPLICATION_WORKER_SENSITIVE_ENV_KEYS } from '@wildo-ai/platform-core-shared';\nimport { parseInboundEndpointSecretEnvVarName, parseSystemOfRecordEnvVarName } from '@wildo-ai/saas-models';\n\nimport { PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS } from './platform-runtime-env.contracts';\n\n/**\n * Every environment variable a Wildo runtime env contract declares secret: the platform services', the application\n * backend's (minions included, which run on its env) and the application workers'.\n *\n * DERIVED from the three declared sets, never listed here, so a secret a contract adds is in it the day it is added.\n * Its first reader is the coding-agent boundary (#3018), through {@link isRuntimeSecretEnvVarName}: a variable in this\n * set may never be forwarded into an agent's subprocess (`inheritedEnvironmentVariables`), because the process that\n * spawns the agent holds it.\n *\n * What it does NOT hold, and why that is not a gap: the variables a backing-service CONTAINER reads its credentials\n * from (`MONGO_INITDB_ROOT_PASSWORD`, `RABBITMQ_ERLANG_COOKIE`, ...). They exist only in those containers' own env,\n * and the CLI's env builders refuse any framework-managed material's VALUE in an application-tier env, under any\n * name (`assertNoPlatformCredentialInGeneratedEnv`). Which materials do reach an agent-spawning runtime, and under\n * which names, is measured by the CLI's `runtime-secret-env-keys.material-coverage.test.ts`, which holds them to\n * this set.\n */\nexport const RUNTIME_SECRET_ENV_KEYS: ReadonlySet<string> = new Set<string>([\n ...PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS,\n ...APPLICATION_BACKEND_SENSITIVE_ENV_KEYS,\n ...APPLICATION_WORKER_SENSITIVE_ENV_KEYS,\n]);\n\n/**\n * Whether `envVarName` is a secret a Wildo runtime env carries by the framework's own declaration (#3018): a member of\n * {@link RUNTIME_SECRET_ENV_KEYS}, or a variable the framework DERIVES per application, whose name it recognises from\n * its own derivation:\n * - an inbound endpoint's verification secret (`WILDO_INBOUND_<KEY>__SECRET`, `parseInboundEndpointSecretEnvVarName`);\n * - any slot of a declared system of record (`WILDO_SOR_<NAME>__<SLOT>`, `parseSystemOfRecordEnvVarName`). The WHOLE\n * family, address slots included: which slot is a secret is the facet's declaration, which a name cannot carry, and\n * no consumer of this predicate needs a system of record's address (an agent reaches one through the application,\n * never through its own environment).\n *\n * A provider's secrets are not here: they are known where the provider registry is (the backend registry, the CLI's\n * composed catalogue), and each caller adds them.\n */\nexport function isRuntimeSecretEnvVarName(envVarName: string): boolean {\n return RUNTIME_SECRET_ENV_KEYS.has(envVarName)\n || parseInboundEndpointSecretEnvVarName(envVarName) !== null\n || parseSystemOfRecordEnvVarName(envVarName) !== null;\n}\n"]}
1
+ {"version":3,"file":"runtime-secret-env.contracts.js","sourceRoot":"","sources":["../../../src/bootstrap/runtime-secret-env.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sCAAsC,EAAE,qCAAqC,EAAE,MAAM,gCAAgC,CAAC;AAC/H,OAAO,EAAE,oCAAoC,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAE5G,OAAO,EAAE,mCAAmC,EAAE,MAAM,kCAAkC,CAAC;AAEvF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAS;IAC1E,GAAG,mCAAmC;IACtC,GAAG,sCAAsC;IACzC,GAAG,qCAAqC;CACzC,CAAC,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAAkB;IAC1D,OAAO,uBAAuB,CAAC,GAAG,CAAC,UAAU,CAAC;WACzC,oCAAoC,CAAC,UAAU,CAAC,KAAK,IAAI;WACzD,6BAA6B,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AAC1D,CAAC","sourcesContent":["import { APPLICATION_BACKEND_SENSITIVE_ENV_KEYS, APPLICATION_WORKER_SENSITIVE_ENV_KEYS } from '@wildo-ai/platform-core-shared';\nimport { parseInboundEndpointSecretEnvVarName, parseSystemOfRecordEnvVarName } from '@wildo-ai/saas-models';\n\nimport { PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS } from './platform-runtime-env.contracts';\n\n/**\n * Every environment variable a Wildo runtime env contract declares secret: the platform services', the application\n * backend's (minions included, which run on its env) and the application workers'.\n *\n * DERIVED from the three declared sets, never listed here, so a secret a contract adds is in it the day it is added.\n * Its first reader is the coding-agent boundary (#3018), through {@link isRuntimeSecretEnvVarName}: a variable in this\n * set may never be forwarded into an agent's subprocess (`inheritedEnvironmentVariables`), because the process that\n * spawns the agent holds it.\n *\n * What it does NOT hold, and why that is not a gap: the variables a backing-service CONTAINER reads its credentials\n * from (`MONGO_INITDB_ROOT_PASSWORD`, `RABBITMQ_ERLANG_COOKIE`, ...). They exist only in those containers' own env,\n * and the CLI's env builders refuse any framework-managed material's VALUE in an application-tier env, under any\n * name (`assertNoPlatformCredentialInGeneratedEnv`). Which materials do reach an agent-spawning runtime, and under\n * which names, is measured by the CLI's `runtime-secret-env-keys.material-coverage.test.ts`, which holds them to\n * this set.\n */\nexport const RUNTIME_SECRET_ENV_KEYS: ReadonlySet<string> = new Set<string>([\n ...PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS,\n ...APPLICATION_BACKEND_SENSITIVE_ENV_KEYS,\n ...APPLICATION_WORKER_SENSITIVE_ENV_KEYS,\n]);\n\n/**\n * Whether `envVarName` is a secret a Wildo runtime env carries by the framework's own declaration (#3018): a member of\n * {@link RUNTIME_SECRET_ENV_KEYS}, or a variable the framework DERIVES per application, whose name it recognises from\n * its own derivation:\n * - an inbound endpoint's verification secret (`WILDO_INBOUND_<KEY>__SECRET`, `parseInboundEndpointSecretEnvVarName`);\n * - any slot of a declared system of record (`WILDO_SOR_<NAME>__<SLOT>`, `parseSystemOfRecordEnvVarName`). The WHOLE\n * family, address slots included: which slot is a secret is the facet's declaration, which a name cannot carry, and\n * no consumer of this predicate needs a system of record's address (an agent reaches one through the application,\n * never through its own environment).\n *\n * A provider's secrets are not here: they are known where the provider registry is (the backend registry, the CLI's\n * composed catalogue), and each caller adds them.\n */\nexport function isRuntimeSecretEnvVarName(envVarName: string): boolean {\n return RUNTIME_SECRET_ENV_KEYS.has(envVarName)\n || parseInboundEndpointSecretEnvVarName(envVarName) !== null\n || parseSystemOfRecordEnvVarName(envVarName) !== null;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-topology.contracts.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-topology.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,gCAAgC,CAAC;AASxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAEjG,OAAO,EACL,gCAAgC,EAChC,6BAA6B,EAC7B,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,EAC1B,+BAA+B,GAChC,MAAM,gCAAgC,CAAC;AAExC,YAAY,EACV,gCAAgC,EAChC,6BAA6B,EAC7B,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AAExC,wBAAgB,sCAAsC,CACpD,IAAI,GAAE,MAAoB,GACzB,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAWrC;AAED,MAAM,WAAW,yCAAyC;IACxD,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,wBAAwB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IAC9D,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,0BAA0B,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,wBAAgB,yCAAyC,CACvD,KAAK,EAAE,yCAAyC,GAC/C,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAuCrC;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,SAAS;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EACnF,eAAe,EAAE,SAAS,QAAQ,EAAE,GACnC,QAAQ,GAAG,SAAS,CAEtB;AAED,oFAAoF;AACpF,MAAM,WAAW,2BAA2B;IAC1C,yDAAyD;IACzD,QAAQ,CA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AAgC,CAC9C,KAAK,EAAE,gCAAgC,GACtC,eAAe,EAAE,CA2CnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,uCAAuC;IACtD,qEAAqE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACjD;;;;OAIG;IACH,SAAS,EAAE,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACpD,sFAAsF;IACtF,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,gGAAgG;IAChG,gCAAgC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtD,iEAAiE;IACjE,wBAAwB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED,MAAM,WAAW,mCAAoC,SAAQ,uCAAuC;IAClG,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,uCAAwC,SAAQ,uCAAuC;IACtG;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AA+DD;;;;GAIG;AACH,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,mCAAmC,GACzC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAIrC;AAED;;;;;;;GAOG;AACH,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,uCAAuC,GAC7C,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAErC"}
1
+ {"version":3,"file":"runtime-topology.contracts.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/runtime-topology.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,gCAAgC,CAAC;AASxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,s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;IACH,SAAS,EAAE,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACpD,sFAAsF;IACtF,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,gGAAgG;IAChG,gCAAgC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtD,iEAAiE;IACjE,wBAAwB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED,MAAM,WAAW,mCAAoC,SAAQ,uCAAuC;IAClG,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,uCAAwC,SAAQ,uCAAuC;IACtG;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AA+DD;;;;GAIG;AACH,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,mCAAmC,GACzC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAIrC;AAED;;;;;;;GAOG;AACH,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,uCAAuC,GAC7C,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAErC"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-topology.contracts.js","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-topology.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,6BAA6B,GAE9B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAGvE,OAAO,EACL,gCAAgC,EAChC,6BAA6B,EAC7B,2BAA2B,EAC3B,uBAAuB,EAC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Endpoints,\n buildPlatformRuntimeEndpoints,\n type RuntimeEndpointUrls,\n} from '@wildo-ai/platform-core-shared';\nimport {\n buildK8sInternalUrl,\n buildK8sPublicUrl,\n buildServicePublicHost,\n buildServicePublicUrl,\n} from '../project-config/shared/k8s-utils';\nimport { PLATFORM_DEFAULT_PORTS } from '../project-config/shared/infrastructure-defaults.schemas';\nimport { AppFrontendType } from '@wildo-ai/saas-models/public-runtime';\nimport type { AppServiceDefinition } from '../project-config/shared/service-definitions.schemas';\n\nexport {\n buildApplicationRuntimeEndpoints,\n buildPlatformRuntimeEndpoints,\n parseRuntimeEndpointsRecord,\n PlatformApplicationType,\n PlatformRuntimeEndpointKey,\n serializeRuntimeEndpointsRecord,\n} from '@wildo-ai/platform-core-shared';\n\nexport type {\n ApplicationRuntimeEndpointsInput,\n PlatformRuntimeEndpointsInput,\n RuntimeEndpointUrls,\n} from '@wildo-ai/platform-core-shared';\n\nexport function buildLocalhostPlatformRuntimeEndpoints(\n host: string = 'localhost',\n): Record<string, RuntimeEndpointUrls> {\n const buildUrl = (port: number): RuntimeEndpointUrls => ({\n publicUrl: `http://${host}:${port}`,\n internalUrl: `http://${host}:${port}`,\n });\n\n return buildPlatformRuntimeEndpoints({\n appsManager: buildUrl(PLATFORM_DEFAULT_PORTS.APPS_MANAGER),\n crontabsBatchesManager: buildUrl(PLATFORM_DEFAULT_PORTS.CRONTABS_BATCHES_MANAGER),\n moduleRegistry: buildUrl(PLATFORM_DEFAULT_PORTS.MODULE_REGISTRY),\n });\n}\n\nexport interface LocalhostApplicationRuntimeEndpointsInput {\n mainBackendApiPort?: number | undefined;\n frontendApplicationPorts?: Record<string, number> | undefined;\n websitePort?: number | undefined;\n technicalDocumentationPort?: number | undefined;\n host?: string | undefined;\n}\n\nexport function buildLocalhostApplicationRuntimeEndpoints(\n input: LocalhostApplicationRuntimeEndpointsInput,\n): Record<string, RuntimeEndpointUrls> {\n const host = input.host ?? 'localhost';\n /**\n * Local endpoints are plain http, publicly and internally, and there is no knob.\n *\n * A configurable local scheme existed until 2026-08-14 and was removed: it applied ONE scheme to\n * EVERY endpoint's own port, which is only correct when a single ingress fronts them all. Local\n * Docker Compose has none, so declaring https made `main_backend_api.publicUrl` name a port that\n * held no certificate, and every browser session died on its WebSocket readiness poll.\n *\n * Remote is unaffected and always was: `buildServicePublicUrl` hardcodes `https://` because TLS\n * terminates at Traefik/nginx in front of one origin, where a single scheme IS true for every\n * endpoint. That is the only place the question has a well-defined answer, and it never consulted\n * this input.\n */\n const buildUrl = (port: number): RuntimeEndpointUrls => ({\n publicUrl: `http://${host}:${port}`,\n internalUrl: `http://${host}:${port}`,\n });\n\n return buildApplicationRuntimeEndpoints({\n frontendApplications: input.frontendApplicationPorts\n ? Object.fromEntries(\n Object.entries(input.frontendApplicationPorts).map(([frontendServiceName, port]) => [\n frontendServiceName,\n buildUrl(port),\n ]),\n )\n : undefined,\n ...(input.websitePort ? { website: buildUrl(input.websitePort) } : {}),\n ...(input.technicalDocumentationPort\n ? { technicalDocumentation: buildUrl(input.technicalDocumentationPort) }\n : {}),\n ...(input.mainBackendApiPort\n ? {\n mainBackendApi: buildUrl(input.mainBackendApiPort),\n }\n : {}),\n });\n}\n\n/**\n * Which backend is an application's MAIN backend API — the one its browser-facing\n * surfaces call. The `backendApi` service key when declared, else the first backend\n * row. One rule, used by the CLI's endpoint and ingress derivation and by the public\n * website's local origins, so the three cannot name different backends.\n */\nexport function selectPrimaryBackendService<TService extends { readonly key: string }>(\n backendServices: readonly TService[],\n): TService | undefined {\n return backendServices.find((backend) => backend.key === 'backendApi') ?? backendServices[0];\n}\n\n/** The origins a locally-running application serves its app and its main API on. */\nexport interface LocalhostApplicationOrigins {\n /** The `SAAS_APP` frontend, when one declares a port. */\n readonly app?: string | undefined;\n /** The main backend API ({@link selectPrimaryBackendService}), when it declares a port. */\n readonly api?: string | undefined;\n}\n\n/**\n * The local-development origins of an application's product and API, derived from\n * the `defaultPort` each service already declares in `wildo.saas.config.ts` — the\n * same ports, host and plain-http scheme {@link buildLocalhostApplicationRuntimeEndpoints}\n * advertises, so a local surface that links into the product reaches the process\n * `wildo local dev` actually started.\n *\n * It exists for the public website, which is a separate origin from the product:\n * its CTAs and capture forms must reach `http://localhost:<appPort>` and\n * `http://localhost:<backendPort>` under `astro dev`. Before this, the API origin\n * was a port hardcoded into each site and the app origin had no local form at all,\n * so every \"Start free\" in local development pointed at a production-shaped host\n * that resolves to nothing.\n */\nexport function resolveLocalhostApplicationOrigins(\n services: Readonly<Record<string, Pick<AppServiceDefinition, 'defaultPort' | 'frontendType'>>>,\n host = 'localhost',\n): LocalhostApplicationOrigins {\n const rows = Object.entries(services).map(([key, service]) => ({ key, ...service }));\n const primaryBackend = selectPrimaryBackendService(rows.filter((row) => row.frontendType === undefined));\n const saasApp = rows.find((row) => row.frontendType === AppFrontendType.SAAS_APP);\n const originOf = (port: number | undefined): string | undefined => (port === undefined ? undefined : `http://${host}:${port}`);\n return { app: originOf(saasApp?.defaultPort), api: originOf(primaryBackend?.defaultPort) };\n}\n\nexport function buildK8sPlatformRuntimeEndpoints(input: {\n publicDomain: string;\n namespace: string;\n}): Record<string, RuntimeEndpointUrls> {\n return buildPlatformRuntimeEndpoints({\n appsManager: {\n publicUrl: buildK8sPublicUrl('platform-apps-manager', input.publicDomain),\n internalUrl: buildK8sInternalUrl('platform-apps-manager', PLATFORM_DEFAULT_PORTS.APPS_MANAGER, input.namespace),\n },\n crontabsBatchesManager: {\n publicUrl: buildK8sPublicUrl('platform-crontabs-batches-manager', input.publicDomain),\n internalUrl: buildK8sInternalUrl('platform-crontabs-batches-manager', PLATFORM_DEFAULT_PORTS.CRONTABS_BATCHES_MANAGER, input.namespace),\n },\n moduleRegistry: {\n publicUrl: buildK8sPublicUrl('platform-module-registry', input.publicDomain),\n internalUrl: buildK8sInternalUrl('platform-module-registry', PLATFORM_DEFAULT_PORTS.MODULE_REGISTRY, input.namespace),\n },\n });\n}\n\nexport interface K8sIngressRoute {\n /** Public hostname Traefik/ingress routes on (from the serviceHosts resolver). */\n host: string;\n /**\n * Per-service k8s Service NAME this host routes to. In the per-service deploy\n * model each service is its OWN Deployment+Service, so the route target is the\n * service's `serviceName` (e.g. `wonder-todos-backend-api`, `wonder-todos-app`)\n * — NOT one shared app Service. This is the value stamped into the ingress\n * rule's `backend.service.name`.\n */\n serviceName: string;\n /** Port on that per-service Service to route this host to. */\n port: number;\n}\n\n/**\n * One public frontend in the app's service topology. `serviceName` and\n * `serviceKey` are DECOUPLED on purpose:\n * - `serviceName` — the `runtime.endPoints` map key (the consumer contract:\n * `lookupFrontendPublicUrl` / X-Frontend-Service-Name key by serviceName).\n * - `serviceKey` — the `config.services.<key>`, which is the serviceHosts\n * authoring key. The public HOST resolves from THIS, never from serviceName.\n * Conflating them silently ignores authored `serviceHosts` (the serviceName\n * `wonder-todos-app` misses the authored `app` entry).\n */\nexport interface ApplicationPublicFrontend {\n serviceName: string;\n serviceKey: string;\n port: number;\n}\n\nexport interface K8sApplicationIngressRoutesInput {\n publicDomain: string;\n serviceHosts: Record<string, string> | undefined;\n /** Public frontends. Host resolves from `serviceKey` (config key); route target is the frontend's own `serviceName`. */\n frontends: ReadonlyArray<ApplicationPublicFrontend>;\n /** Backend API `config.services.<key>` (host resolution key). */\n mainBackendApiServiceKey?: string | undefined;\n /** Backend API per-service k8s Service name (the ingress route target). */\n mainBackendApiServiceName?: string | undefined;\n /** Backend API Service port. */\n mainBackendApiPort?: number | undefined;\n}\n\n/**\n * Ingress routes for the app's PUBLIC services (every frontend + the main\n * backend API), serviceHosts-driven. Every host resolves from the service's\n * `config.services.<key>` (`serviceKey`) — so GIVEN THE SAME frontends/keys,\n * the routes match the `runtime.endPoints.publicUrl` that\n * {@link buildK8sApplicationRuntimeEndpoints} produces (both key public hosts on\n * `serviceKey`). Coherence is a property of feeding both the SAME `serviceKey`s,\n * not automatic — see the divergence guards in the domain plan. Health, webhooks,\n * the OAuth provider and MCP are routes on the backend's own port, so they reach\n * the public host through the backend API route like any other path (#1783).\n */\nexport function buildK8sApplicationIngressRoutes(\n input: K8sApplicationIngressRoutesInput,\n): K8sIngressRoute[] {\n const host = (serviceKey: string): string =>\n buildServicePublicHost({ serviceKey, serviceHosts: input.serviceHosts, publicDomain: input.publicDomain });\n\n const entries: Array<{ serviceKey: string; serviceName: string; host: string; port: number }> =\n input.frontends.map((f) => ({\n serviceKey: f.serviceKey,\n serviceName: f.serviceName,\n host: host(f.serviceKey),\n port: f.port,\n }));\n if (\n input.mainBackendApiServiceKey !== undefined &&\n input.mainBackendApiServiceName !== undefined &&\n input.mainBackendApiPort !== undefined\n ) {\n entries.push({\n serviceKey: input.mainBackendApiServiceKey,\n serviceName: input.mainBackendApiServiceName,\n host: host(input.mainBackendApiServiceKey),\n port: input.mainBackendApiPort,\n });\n }\n\n // Fail-closed host-uniqueness guard: each public host routes entirely to ONE\n // service:port (no path-based sharing), so two distinct services resolving to\n // the same host — e.g. both authored to the apex (`''`), or an unauthored key\n // that collides with an authored subdomain — is an ambiguous, silently-broken\n // ingress. Reject it at build time with the colliding keys named, rather than\n // emitting a manifest whose routing is undefined.\n const claimedBy = new Map<string, string>();\n for (const entry of entries) {\n const existing = claimedBy.get(entry.host);\n if (existing !== undefined && existing !== entry.serviceKey) {\n throw new Error(\n `serviceHosts collision: services '${existing}' and '${entry.serviceKey}' both resolve to public host '${entry.host}'. ` +\n `Each service needs a distinct 'serviceHosts' subdomain (only one service may map to the apex '').`,\n );\n }\n claimedBy.set(entry.host, entry.serviceKey);\n }\n\n return entries.map(({ host: h, serviceName, port }) => ({ host: h, serviceName, port }));\n}\n\n/**\n * Fields shared by every REMOTE runtime-endpoints builder (k8s + compose). The\n * PUBLIC side (serviceHosts resolution) is runtime-agnostic; only the INTERNAL\n * URL form differs, injected via the `internalUrlFor` callback of the core\n * builder ({@link buildRemoteApplicationRuntimeEndpoints}).\n */\nexport interface RemoteApplicationRuntimeEndpointsCommon {\n /** Operator's public domain (`WildoInfraEnvConfig.publicDomain`). */\n publicDomain: string;\n /** Authored per-service subdomain map (`wildo.infra.<env>.config.ts`). */\n serviceHosts: Record<string, string> | undefined;\n /**\n * Public frontends. The `runtime.endPoints` map is keyed by each frontend's\n * `serviceName` (consumer contract); the public HOST resolves from its\n * `serviceKey` (config key / serviceHosts key). See {@link ApplicationPublicFrontend}.\n */\n frontends: ReadonlyArray<ApplicationPublicFrontend>;\n /** `serviceKey` of the STATIC_WEBSITE frontend (feeds the fixed website endpoint). */\n websiteServiceKey?: string | undefined;\n /** `serviceKey` of the TECH_DOC frontend (feeds the fixed technical-documentation endpoint). */\n technicalDocumentationServiceKey?: string | undefined;\n /** Backend API `config.services.<key>` (host resolution key). */\n mainBackendApiServiceKey?: string | undefined;\n /** Backend API container port — the one port the backend process binds (its internal URL). */\n mainBackendApiPort?: number | undefined;\n}\n\nexport interface K8sApplicationRuntimeEndpointsInput extends RemoteApplicationRuntimeEndpointsCommon {\n /** K8s namespace for cluster-internal service DNS. */\n namespace: string;\n /**\n * K8s Service name for cluster-internal URLs. Single Service per app (all\n * frontends + APIs ride it on different ports), so this is the app's own\n * service name (= its slug).\n */\n appServiceName: string;\n}\n\nexport interface ComposeApplicationRuntimeEndpointsInput extends RemoteApplicationRuntimeEndpointsCommon {\n /**\n * Compose service (container) name for internal URLs. Single container per\n * app serving all frontends + APIs on their ports, reachable by other\n * containers on the shared network as `http://<appServiceName>:<port>`.\n */\n appServiceName: string;\n}\n\n/**\n * Core REMOTE application runtime-endpoints assembly, shared by the k8s and\n * compose builders so their public-URL semantics never drift. PUBLIC URLs come\n * from {@link buildServicePublicUrl} (so ingress hosts, `runtime.endPoints.publicUrl`,\n * and CORS all agree — greenfield, no multi-tenant fan-out). INTERNAL URLs are\n * supplied by `internalUrlFor` (cluster-DNS for k8s, container DNS for compose).\n * The backend declares ONE endpoint: health, webhooks, the OAuth provider and MCP\n * are routes on its port, not sibling listeners (#1783).\n */\nfunction buildRemoteApplicationRuntimeEndpoints(\n input: RemoteApplicationRuntimeEndpointsCommon,\n internalUrlFor: (port: number) => string,\n): Record<string, RuntimeEndpointUrls> {\n const { publicDomain, serviceHosts } = input;\n const pub = (serviceKey: string): string =>\n buildServicePublicUrl({ serviceKey, serviceHosts, publicDomain });\n const internal = internalUrlFor;\n\n // Map key = serviceName (consumer contract: lookupFrontendPublicUrl keys by\n // serviceName); public host = serviceKey (serviceHosts key). Decoupled.\n const frontendApplications = input.frontends.length > 0\n ? Object.fromEntries(\n input.frontends.map((f) => [\n f.serviceName,\n { publicUrl: pub(f.serviceKey), internalUrl: internal(f.port) },\n ]),\n )\n : undefined;\n\n const websiteFrontend = input.websiteServiceKey\n ? input.frontends.find((f) => f.serviceKey === input.websiteServiceKey)\n : undefined;\n const docsFrontend = input.technicalDocumentationServiceKey\n ? input.frontends.find((f) => f.serviceKey === input.technicalDocumentationServiceKey)\n : undefined;\n const { mainBackendApiServiceKey, mainBackendApiPort } = input;\n\n return buildApplicationRuntimeEndpoints({\n frontendApplications,\n ...(websiteFrontend\n ? { website: { publicUrl: pub(websiteFrontend.serviceKey), internalUrl: internal(websiteFrontend.port) } }\n : {}),\n ...(docsFrontend\n ? {\n technicalDocumentation: {\n publicUrl: pub(docsFrontend.serviceKey),\n internalUrl: internal(docsFrontend.port),\n },\n }\n : {}),\n ...(mainBackendApiServiceKey !== undefined && mainBackendApiPort !== undefined\n ? {\n mainBackendApi: {\n publicUrl: pub(mainBackendApiServiceKey),\n internalUrl: internal(mainBackendApiPort),\n },\n }\n : {}),\n });\n}\n\n/**\n * Build K8s application runtime endpoints — the self-hosted, single-app,\n * `serviceHosts`-driven counterpart to {@link buildLocalhostApplicationRuntimeEndpoints}.\n * INTERNAL URLs are the app's own cluster-DNS Service on each port.\n */\nexport function buildK8sApplicationRuntimeEndpoints(\n input: K8sApplicationRuntimeEndpointsInput,\n): Record<string, RuntimeEndpointUrls> {\n return buildRemoteApplicationRuntimeEndpoints(input, (port) =>\n buildK8sInternalUrl(input.appServiceName, port, input.namespace),\n );\n}\n\n/**\n * Build Docker-Compose application runtime endpoints — the compose counterpart\n * of {@link buildK8sApplicationRuntimeEndpoints}. PUBLIC URLs are IDENTICAL\n * (serviceHosts-driven, so the Traefik ingress routes and `runtime.endPoints`\n * agree — the CORS invariant holds for compose too). INTERNAL URLs are the app\n * container's own name on the shared compose network (`http://<appServiceName>:<port>`),\n * NOT localhost — the remote compose stack must not advertise localhost topology.\n */\nexport function buildComposeApplicationRuntimeEndpoints(\n input: ComposeApplicationRuntimeEndpointsInput,\n): Record<string, RuntimeEndpointUrls> {\n return buildRemoteApplicationRuntimeEndpoints(input, (port) => `http://${input.appServiceName}:${port}`);\n}\n"]}
1
+ {"version":3,"file":"runtime-topology.contracts.js","sourceRoot":"","sources":["../../../src/bootstrap/runtime-topology.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,6BAA6B,GAE9B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAGvE,OAAO,EACL,gCAAgC,EAChC,6BAA6B,EAC7B,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,EAC1B,+BAA+B,GAChC,MAAM,gCAAgC,CAAC;AAQxC,MAAM,UAAU,sCAAsC,CACpD,OAAe,WAAW;IAE1B,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAuB,EAAE,CAAC,CAAC;QACvD,SAAS,EAAE,UAAU,IAAI,IAAI,IAAI,EAAE;QACnC,WAAW,EAAE,UAAU,IAAI,IAAI,IAAI,EAAE;KACtC,CAAC,CAAC;IAEH,OAAO,6BAA6B,CAAC;QACnC,WAAW,EAAE,QAAQ,CAAC,sBAAsB,CAAC,YAAY,CAAC;QAC1D,sBAAsB,EAAE,QAAQ,CAAC,sBAAsB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YAAY,CAAC,UAAU,CAAC;oBACvC,WAAW,EAAE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC;iBACzC;aACF;YACH,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,wBAAwB,KAAK,SAAS,IAAI,kBAAkB,KAAK,SAAS;YAC5E,CAAC,CAAC;gBACE,cAAc,EAAE;oBACd,SAAS,EAAE,GAAG,CAAC,wBAAwB,CAAC;oBACxC,WAAW,EAAE,QAAQ,CAAC,kBAAkB,CAAC;iBAC1C;aACF;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mCAAmC,CACjD,KAA0C;IAE1C,OAAO,sCAAsC,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAC5D,mBAAmB,CAAC,KAAK,CAAC,cAAc,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CACjE,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,uCAAuC,CACrD,KAA8C;IAE9C,OAAO,sCAAsC,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,KAAK,CAAC,cAAc,IAAI,IAAI,EAAE,CAAC,CAAC;AAC3G,CAAC","sourcesContent":["import {\n buildApplicationRuntimeEndpoints,\n buildPlatformRuntimeEndpoints,\n type RuntimeEndpointUrls,\n} from '@wildo-ai/platform-core-shared';\nimport {\n buildK8sInternalUrl,\n buildK8sPublicUrl,\n buildServicePublicHost,\n buildServicePublicUrl,\n} from '../project-config/shared/k8s-utils';\nimport { PLATFORM_DEFAULT_PORTS } from '../project-config/shared/infrastructure-defaults.schemas';\nimport { AppFrontendType } from '@wildo-ai/saas-models/public-runtime';\nimport type { AppServiceDefinition } from '../project-config/shared/service-definitions.schemas';\n\nexport {\n buildApplicationRuntimeEndpoints,\n buildPlatformRuntimeEndpoints,\n parseRuntimeEndpointsRecord,\n PlatformApplicationType,\n PlatformRuntimeEndpointKey,\n serializeRuntimeEndpointsRecord,\n} from '@wildo-ai/platform-core-shared';\n\nexport type {\n ApplicationRuntimeEndpointsInput,\n PlatformRuntimeEndpointsInput,\n RuntimeEndpointUrls,\n} from '@wildo-ai/platform-core-shared';\n\nexport function buildLocalhostPlatformRuntimeEndpoints(\n host: string = 'localhost',\n): Record<string, RuntimeEndpointUrls> {\n const buildUrl = (port: number): RuntimeEndpointUrls => ({\n publicUrl: `http://${host}:${port}`,\n internalUrl: `http://${host}:${port}`,\n });\n\n return buildPlatformRuntimeEndpoints({\n appsManager: buildUrl(PLATFORM_DEFAULT_PORTS.APPS_MANAGER),\n crontabsBatchesManager: buildUrl(PLATFORM_DEFAULT_PORTS.CRONTABS_BATCHES_MANAGER),\n moduleRegistry: buildUrl(PLATFORM_DEFAULT_PORTS.MODULE_REGISTRY),\n });\n}\n\nexport interface LocalhostApplicationRuntimeEndpointsInput {\n mainBackendApiPort?: number | undefined;\n frontendApplicationPorts?: Record<string, number> | undefined;\n websitePort?: number | undefined;\n technicalDocumentationPort?: number | undefined;\n host?: string | undefined;\n}\n\nexport function buildLocalhostApplicationRuntimeEndpoints(\n input: LocalhostApplicationRuntimeEndpointsInput,\n): Record<string, RuntimeEndpointUrls> {\n const host = input.host ?? 'localhost';\n /**\n * Local endpoints are plain http, publicly and internally, and there is no knob.\n *\n * A configurable local scheme existed until 2026-08-14 and was removed: it applied ONE scheme to\n * EVERY endpoint's own port, which is only correct when a single ingress fronts them all. Local\n * Docker Compose has none, so declaring https made `main_backend_api.publicUrl` name a port that\n * held no certificate, and every browser session died on its WebSocket readiness poll.\n *\n * Remote is unaffected and always was: `buildServicePublicUrl` hardcodes `https://` because TLS\n * terminates at Traefik/nginx in front of one origin, where a single scheme IS true for every\n * endpoint. That is the only place the question has a well-defined answer, and it never consulted\n * this input.\n */\n const buildUrl = (port: number): RuntimeEndpointUrls => ({\n publicUrl: `http://${host}:${port}`,\n internalUrl: `http://${host}:${port}`,\n });\n\n return buildApplicationRuntimeEndpoints({\n frontendApplications: input.frontendApplicationPorts\n ? Object.fromEntries(\n Object.entries(input.frontendApplicationPorts).map(([frontendServiceName, port]) => [\n frontendServiceName,\n buildUrl(port),\n ]),\n )\n : undefined,\n ...(input.websitePort ? { website: buildUrl(input.websitePort) } : {}),\n ...(input.technicalDocumentationPort\n ? { technicalDocumentation: buildUrl(input.technicalDocumentationPort) }\n : {}),\n ...(input.mainBackendApiPort\n ? {\n mainBackendApi: buildUrl(input.mainBackendApiPort),\n }\n : {}),\n });\n}\n\n/**\n * Which backend is an application's MAIN backend API — the one its browser-facing\n * surfaces call. The `backendApi` service key when declared, else the first backend\n * row. One rule, used by the CLI's endpoint and ingress derivation and by the public\n * website's local origins, so the three cannot name different backends.\n */\nexport function selectPrimaryBackendService<TService extends { readonly key: string }>(\n backendServices: readonly TService[],\n): TService | undefined {\n return backendServices.find((backend) => backend.key === 'backendApi') ?? backendServices[0];\n}\n\n/** The origins a locally-running application serves its app and its main API on. */\nexport interface LocalhostApplicationOrigins {\n /** The `SAAS_APP` frontend, when one declares a port. */\n readonly app?: string | undefined;\n /** The main backend API ({@link selectPrimaryBackendService}), when it declares a port. */\n readonly api?: string | undefined;\n}\n\n/**\n * The local-development origins of an application's product and API, derived from\n * the `defaultPort` each service already declares in `wildo.saas.config.ts` — the\n * same ports, host and plain-http scheme {@link buildLocalhostApplicationRuntimeEndpoints}\n * advertises, so a local surface that links into the product reaches the process\n * `wildo local dev` actually started.\n *\n * It exists for the public website, which is a separate origin from the product:\n * its CTAs and capture forms must reach `http://localhost:<appPort>` and\n * `http://localhost:<backendPort>` under `astro dev`. Before this, the API origin\n * was a port hardcoded into each site and the app origin had no local form at all,\n * so every \"Start free\" in local development pointed at a production-shaped host\n * that resolves to nothing.\n */\nexport function resolveLocalhostApplicationOrigins(\n services: Readonly<Record<string, Pick<AppServiceDefinition, 'defaultPort' | 'frontendType'>>>,\n host = 'localhost',\n): LocalhostApplicationOrigins {\n const rows = Object.entries(services).map(([key, service]) => ({ key, ...service }));\n const primaryBackend = selectPrimaryBackendService(rows.filter((row) => row.frontendType === undefined));\n const saasApp = rows.find((row) => row.frontendType === AppFrontendType.SAAS_APP);\n const originOf = (port: number | undefined): string | undefined => (port === undefined ? undefined : `http://${host}:${port}`);\n return { app: originOf(saasApp?.defaultPort), api: originOf(primaryBackend?.defaultPort) };\n}\n\nexport function buildK8sPlatformRuntimeEndpoints(input: {\n publicDomain: string;\n namespace: string;\n}): Record<string, RuntimeEndpointUrls> {\n return buildPlatformRuntimeEndpoints({\n appsManager: {\n publicUrl: buildK8sPublicUrl('platform-apps-manager', input.publicDomain),\n internalUrl: buildK8sInternalUrl('platform-apps-manager', PLATFORM_DEFAULT_PORTS.APPS_MANAGER, input.namespace),\n },\n crontabsBatchesManager: {\n publicUrl: buildK8sPublicUrl('platform-crontabs-batches-manager', input.publicDomain),\n internalUrl: buildK8sInternalUrl('platform-crontabs-batches-manager', PLATFORM_DEFAULT_PORTS.CRONTABS_BATCHES_MANAGER, input.namespace),\n },\n moduleRegistry: {\n publicUrl: buildK8sPublicUrl('platform-module-registry', input.publicDomain),\n internalUrl: buildK8sInternalUrl('platform-module-registry', PLATFORM_DEFAULT_PORTS.MODULE_REGISTRY, input.namespace),\n },\n });\n}\n\nexport interface K8sIngressRoute {\n /** Public hostname Traefik/ingress routes on (from the serviceHosts resolver). */\n host: string;\n /**\n * Per-service k8s Service NAME this host routes to. In the per-service deploy\n * model each service is its OWN Deployment+Service, so the route target is the\n * service's `serviceName` (e.g. `wonder-todos-backend-api`, `wonder-todos-app`)\n * — NOT one shared app Service. This is the value stamped into the ingress\n * rule's `backend.service.name`.\n */\n serviceName: string;\n /** Port on that per-service Service to route this host to. */\n port: number;\n}\n\n/**\n * One public frontend in the app's service topology. `serviceName` and\n * `serviceKey` are DECOUPLED on purpose:\n * - `serviceName` — the `runtime.endPoints` map key (the consumer contract:\n * `lookupFrontendPublicUrl` / X-Frontend-Service-Name key by serviceName).\n * - `serviceKey` — the `config.services.<key>`, which is the serviceHosts\n * authoring key. The public HOST resolves from THIS, never from serviceName.\n * Conflating them silently ignores authored `serviceHosts` (the serviceName\n * `wonder-todos-app` misses the authored `app` entry).\n */\nexport interface ApplicationPublicFrontend {\n serviceName: string;\n serviceKey: string;\n port: number;\n}\n\nexport interface K8sApplicationIngressRoutesInput {\n publicDomain: string;\n serviceHosts: Record<string, string> | undefined;\n /** Public frontends. Host resolves from `serviceKey` (config key); route target is the frontend's own `serviceName`. */\n frontends: ReadonlyArray<ApplicationPublicFrontend>;\n /** Backend API `config.services.<key>` (host resolution key). */\n mainBackendApiServiceKey?: string | undefined;\n /** Backend API per-service k8s Service name (the ingress route target). */\n mainBackendApiServiceName?: string | undefined;\n /** Backend API Service port. */\n mainBackendApiPort?: number | undefined;\n}\n\n/**\n * Ingress routes for the app's PUBLIC services (every frontend + the main\n * backend API), serviceHosts-driven. Every host resolves from the service's\n * `config.services.<key>` (`serviceKey`) — so GIVEN THE SAME frontends/keys,\n * the routes match the `runtime.endPoints.publicUrl` that\n * {@link buildK8sApplicationRuntimeEndpoints} produces (both key public hosts on\n * `serviceKey`). Coherence is a property of feeding both the SAME `serviceKey`s,\n * not automatic — see the divergence guards in the domain plan. Health, webhooks,\n * the OAuth provider and MCP are routes on the backend's own port, so they reach\n * the public host through the backend API route like any other path (#1783).\n */\nexport function buildK8sApplicationIngressRoutes(\n input: K8sApplicationIngressRoutesInput,\n): K8sIngressRoute[] {\n const host = (serviceKey: string): string =>\n buildServicePublicHost({ serviceKey, serviceHosts: input.serviceHosts, publicDomain: input.publicDomain });\n\n const entries: Array<{ serviceKey: string; serviceName: string; host: string; port: number }> =\n input.frontends.map((f) => ({\n serviceKey: f.serviceKey,\n serviceName: f.serviceName,\n host: host(f.serviceKey),\n port: f.port,\n }));\n if (\n input.mainBackendApiServiceKey !== undefined &&\n input.mainBackendApiServiceName !== undefined &&\n input.mainBackendApiPort !== undefined\n ) {\n entries.push({\n serviceKey: input.mainBackendApiServiceKey,\n serviceName: input.mainBackendApiServiceName,\n host: host(input.mainBackendApiServiceKey),\n port: input.mainBackendApiPort,\n });\n }\n\n // Fail-closed host-uniqueness guard: each public host routes entirely to ONE\n // service:port (no path-based sharing), so two distinct services resolving to\n // the same host — e.g. both authored to the apex (`''`), or an unauthored key\n // that collides with an authored subdomain — is an ambiguous, silently-broken\n // ingress. Reject it at build time with the colliding keys named, rather than\n // emitting a manifest whose routing is undefined.\n const claimedBy = new Map<string, string>();\n for (const entry of entries) {\n const existing = claimedBy.get(entry.host);\n if (existing !== undefined && existing !== entry.serviceKey) {\n throw new Error(\n `serviceHosts collision: services '${existing}' and '${entry.serviceKey}' both resolve to public host '${entry.host}'. ` +\n `Each service needs a distinct 'serviceHosts' subdomain (only one service may map to the apex '').`,\n );\n }\n claimedBy.set(entry.host, entry.serviceKey);\n }\n\n return entries.map(({ host: h, serviceName, port }) => ({ host: h, serviceName, port }));\n}\n\n/**\n * Fields shared by every REMOTE runtime-endpoints builder (k8s + compose). The\n * PUBLIC side (serviceHosts resolution) is runtime-agnostic; only the INTERNAL\n * URL form differs, injected via the `internalUrlFor` callback of the core\n * builder ({@link buildRemoteApplicationRuntimeEndpoints}).\n */\nexport interface RemoteApplicationRuntimeEndpointsCommon {\n /** Operator's public domain (`WildoInfraEnvConfig.publicDomain`). */\n publicDomain: string;\n /** Authored per-service subdomain map (`wildo.infra.<env>.config.ts`). */\n serviceHosts: Record<string, string> | undefined;\n /**\n * Public frontends. The `runtime.endPoints` map is keyed by each frontend's\n * `serviceName` (consumer contract); the public HOST resolves from its\n * `serviceKey` (config key / serviceHosts key). See {@link ApplicationPublicFrontend}.\n */\n frontends: ReadonlyArray<ApplicationPublicFrontend>;\n /** `serviceKey` of the STATIC_WEBSITE frontend (feeds the fixed website endpoint). */\n websiteServiceKey?: string | undefined;\n /** `serviceKey` of the TECH_DOC frontend (feeds the fixed technical-documentation endpoint). */\n technicalDocumentationServiceKey?: string | undefined;\n /** Backend API `config.services.<key>` (host resolution key). */\n mainBackendApiServiceKey?: string | undefined;\n /** Backend API container port — the one port the backend process binds (its internal URL). */\n mainBackendApiPort?: number | undefined;\n}\n\nexport interface K8sApplicationRuntimeEndpointsInput extends RemoteApplicationRuntimeEndpointsCommon {\n /** K8s namespace for cluster-internal service DNS. */\n namespace: string;\n /**\n * K8s Service name for cluster-internal URLs. Single Service per app (all\n * frontends + APIs ride it on different ports), so this is the app's own\n * service name (= its slug).\n */\n appServiceName: string;\n}\n\nexport interface ComposeApplicationRuntimeEndpointsInput extends RemoteApplicationRuntimeEndpointsCommon {\n /**\n * Compose service (container) name for internal URLs. Single container per\n * app serving all frontends + APIs on their ports, reachable by other\n * containers on the shared network as `http://<appServiceName>:<port>`.\n */\n appServiceName: string;\n}\n\n/**\n * Core REMOTE application runtime-endpoints assembly, shared by the k8s and\n * compose builders so their public-URL semantics never drift. PUBLIC URLs come\n * from {@link buildServicePublicUrl} (so ingress hosts, `runtime.endPoints.publicUrl`,\n * and CORS all agree — greenfield, no multi-tenant fan-out). INTERNAL URLs are\n * supplied by `internalUrlFor` (cluster-DNS for k8s, container DNS for compose).\n * The backend declares ONE endpoint: health, webhooks, the OAuth provider and MCP\n * are routes on its port, not sibling listeners (#1783).\n */\nfunction buildRemoteApplicationRuntimeEndpoints(\n input: RemoteApplicationRuntimeEndpointsCommon,\n internalUrlFor: (port: number) => string,\n): Record<string, RuntimeEndpointUrls> {\n const { publicDomain, serviceHosts } = input;\n const pub = (serviceKey: string): string =>\n buildServicePublicUrl({ serviceKey, serviceHosts, publicDomain });\n const internal = internalUrlFor;\n\n // Map key = serviceName (consumer contract: lookupFrontendPublicUrl keys by\n // serviceName); public host = serviceKey (serviceHosts key). Decoupled.\n const frontendApplications = input.frontends.length > 0\n ? Object.fromEntries(\n input.frontends.map((f) => [\n f.serviceName,\n { publicUrl: pub(f.serviceKey), internalUrl: internal(f.port) },\n ]),\n )\n : undefined;\n\n const websiteFrontend = input.websiteServiceKey\n ? input.frontends.find((f) => f.serviceKey === input.websiteServiceKey)\n : undefined;\n const docsFrontend = input.technicalDocumentationServiceKey\n ? input.frontends.find((f) => f.serviceKey === input.technicalDocumentationServiceKey)\n : undefined;\n const { mainBackendApiServiceKey, mainBackendApiPort } = input;\n\n return buildApplicationRuntimeEndpoints({\n frontendApplications,\n ...(websiteFrontend\n ? { website: { publicUrl: pub(websiteFrontend.serviceKey), internalUrl: internal(websiteFrontend.port) } }\n : {}),\n ...(docsFrontend\n ? {\n technicalDocumentation: {\n publicUrl: pub(docsFrontend.serviceKey),\n internalUrl: internal(docsFrontend.port),\n },\n }\n : {}),\n ...(mainBackendApiServiceKey !== undefined && mainBackendApiPort !== undefined\n ? {\n mainBackendApi: {\n publicUrl: pub(mainBackendApiServiceKey),\n internalUrl: internal(mainBackendApiPort),\n },\n }\n : {}),\n });\n}\n\n/**\n * Build K8s application runtime endpoints — the self-hosted, single-app,\n * `serviceHosts`-driven counterpart to {@link buildLocalhostApplicationRuntimeEndpoints}.\n * INTERNAL URLs are the app's own cluster-DNS Service on each port.\n */\nexport function buildK8sApplicationRuntimeEndpoints(\n input: K8sApplicationRuntimeEndpointsInput,\n): Record<string, RuntimeEndpointUrls> {\n return buildRemoteApplicationRuntimeEndpoints(input, (port) =>\n buildK8sInternalUrl(input.appServiceName, port, input.namespace),\n );\n}\n\n/**\n * Build Docker-Compose application runtime endpoints — the compose counterpart\n * of {@link buildK8sApplicationRuntimeEndpoints}. PUBLIC URLs are IDENTICAL\n * (serviceHosts-driven, so the Traefik ingress routes and `runtime.endPoints`\n * agree — the CORS invariant holds for compose too). INTERNAL URLs are the app\n * container's own name on the shared compose network (`http://<appServiceName>:<port>`),\n * NOT localhost — the remote compose stack must not advertise localhost topology.\n */\nexport function buildComposeApplicationRuntimeEndpoints(\n input: ComposeApplicationRuntimeEndpointsInput,\n): Record<string, RuntimeEndpointUrls> {\n return buildRemoteApplicationRuntimeEndpoints(input, (port) => `http://${input.appServiceName}:${port}`);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"wildo-owner-organization.contracts.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/wildo-owner-organization.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,KAAK,uBAAuB,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEvJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,WAAW,8BAA8B;IAC7C,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wGAAwG;IACxG,QAAQ,CAAC,IAAI,EAAE,OAAO,gCAAgC,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,WAAW,CAAC;AAExD,eAAO,MAAM,yBAAyB,EAAE,eAIvC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AAEpE,eAAO,MAAM,iCAAiC,EAAE,uBAO/C,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,8BAItC,CAAC"}
1
+ {"version":3,"file":"wildo-owner-organization.contracts.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/wildo-owner-organization.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,KAAK,uBAAuB,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEvJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,WAAW,8BAA8B;IAC7C,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wGAAwG;IACxG,QAAQ,CAAC,IAAI,EAAE,OAAO,gCAAgC,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,WAAW,CAAC;AAExD,eAAO,MAAM,yBAAyB,EAAE,eAIvC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AAEpE,eAAO,MAAM,iCAAiC,EAAE,uBAO/C,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,8BAItC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"wildo-owner-organization.contracts.js","sourceRoot":"","sources":["../../../../src/bootstrap/wildo-owner-organization.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,wBAAwB,EAAsD,MAAM,uBAAuB,CAAC;AAuDvJ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,QAAQ,CAAC;AAExD,MAAM,CAAC,MAAM,yBAAyB,GAAoB;IACxD,CAAC,+BAA+B,CAAC,EAAE,wBAAwB,CAAC,KAAK,CAAC;QAChE,IAAI,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,gBAAgB,CAAC,QAAQ,EAAE,EAAE;KAC5D,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAAmB,CAAC;AAEpE,MAAM,CAAC,MAAM,iCAAiC,GAA4B;IACxE,CAAC,gCAAgC,CAAC,EAAE;QAClC,SAAS,EAAE,CAAC,+BAA+B,CAAC;QAC5C,iBAAiB,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,UAAU,CAAC;QAClG,iBAAiB,EAAE,cAAc,CAAC,UAAU;QAC5C,aAAa,EAAE,SAAS;KACzB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAmC;IACtE,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,gCAAgC;CACvC,CAAC","sourcesContent":["import { CORE_ORG_ROLES, RegistrationMode, UserTypeDefinitionSchema, type OrganizationTypesConfig, type UserTypesConfig } from '@wildo-ai/saas-models';\n\n/**\n * The ONE identity of the organization that owns Wildo's own applications.\n *\n * ## Why this constant exists\n *\n * This identity used to be hardcoded FOUR times, in two files, as TWO DIFFERENT VALUES — and the\n * result was a platform carrying two organizations, neither of them a customer:\n *\n * | declared in | value |\n * |---|---|\n * | `init-mode-startup.apps-manager.service.ts` (twice) | `wildo-platform` / `Wildo Platform` |\n * | `maintenance/services/app-initialization.service.ts` (twice) | `wildo` / `Wildo` |\n *\n * The two paths provision different things, so ownership split along them. Measured on the dogfood\n * platform (2026-09-01): `wildo-ai-application` — the bootstrap row — was owned by `wildo-platform`,\n * while `wonder-crm`, `wonder-todos` and `secrets-proof` were owned by `wildo`. Worse, OPERATOR\n * REACH followed the same split: the admin seeded by INIT was `ORG_ADMIN` of BOTH organizations,\n * while an admin seeded later by the maintenance path was a member of `wildo` ONLY. Nothing declared\n * that they should differ; it was decided by which code path happened to run.\n *\n * The bootstrap organization is also `ACTIVE` and authority-conferring, so everything that\n * ENUMERATES tenants — an organization switcher, the owner-floor boot report, a cross-tenant audit,\n * a subject-erasure sweep — counted a bootstrap artifact as a real tenant.\n *\n * ## Why ONE organization rather than two declared ones\n *\n * The second organization was never a design. `seedBootstrapApplicationRecord` needs *an* owner for\n * the minimal APPLICATION row it seeds to break a chicken-and-egg (an APPLICATION-primary-scoped\n * execution context resolves its `applicationId` by READING that row). It needs an owner; it never\n * needed a DIFFERENT one. Wildo owning all Wildo applications — including its own — is the coherent\n * reading, and it is what the duplication suggests was intended before the two literals drifted.\n *\n * If a future decision genuinely wants the platform's own application in a separate tenant, that is\n * a SECOND named constant here plus an explicit statement of which consumers must tell them apart —\n * not a second literal at a call site.\n *\n * ## What this does NOT do\n *\n * It does not retrofit an existing platform. Both bootstrap seeding arms look a row up by business\n * key and insert ONLY when absent, and the registration path prefers an existing application's\n * recorded `ownerOrganizationId` over the seeded id — so an installation that already carries two\n * organizations keeps both, with its existing linkage untouched. Only a FRESH platform gets one.\n * Merging the two on an existing installation is a migration with its own decision.\n */\nexport interface WildoOwnerOrganizationIdentity {\n /** Business key. Both provisioning paths upsert the organization by THIS field. */\n readonly slug: string;\n /** Display name written on first seed. */\n readonly name: string;\n /** The organization type written on first seed — a key of {@link WILDO_PLATFORM_ORGANIZATION_TYPES}. */\n readonly type: typeof WILDO_PLATFORM_ORGANIZATION_TYPE;\n}\n\n/**\n * The user type the platform seeds its first administrator with, and the one its organization type grants.\n *\n * Declared because it was already HELD: the platform's INIT seed gave its first administrator `member` long before\n * the platform declared any user type, and nothing checked the pair until organization types — whose granted user\n * types must be declared — became mandatory (#1032). Registration is DISABLED: a platform user exists because the\n * platform seeded them, never because someone signed up.\n */\nexport const WILDO_PLATFORM_MEMBER_USER_TYPE = 'member';\n\nexport const WILDO_PLATFORM_USER_TYPES: UserTypesConfig = {\n [WILDO_PLATFORM_MEMBER_USER_TYPE]: UserTypeDefinitionSchema.parse({\n auth: { registration: { mode: RegistrationMode.DISABLED } },\n }),\n};\n\n/**\n * The ONE organization type the platform's own tenancy declares (#1032, decided 2026-09-14).\n *\n * Every organization carries a type that names a declared organization type, because a member of an\n * organization whose type resolves to nothing cannot sign in. An application declares its types in\n * `wildo.saas.config.ts`; the platform has no such file, so its declaration lives here, beside the\n * identity of the organization it types. Before this, the platform seeded its organizations with no\n * type at all, and `wildo_platform` held two of them.\n *\n * It grants {@link WILDO_PLATFORM_MEMBER_USER_TYPE}, the user type the platform's INIT seeds its first administrator\n * with, so the platform's own first-organization derivation resolves to this type rather than refusing — and a\n * configuration carrying this map must carry {@link WILDO_PLATFORM_USER_TYPES} beside it, or its granted user type\n * is undeclared.\n */\nexport const WILDO_PLATFORM_ORGANIZATION_TYPE = 'platform-operator';\n\nexport const WILDO_PLATFORM_ORGANIZATION_TYPES: OrganizationTypesConfig = {\n [WILDO_PLATFORM_ORGANIZATION_TYPE]: {\n userTypes: [WILDO_PLATFORM_MEMBER_USER_TYPE],\n availableOrgRoles: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN, CORE_ORG_ROLES.ORG_MEMBER],\n defaultMemberRole: CORE_ORG_ROLES.ORG_MEMBER,\n authOverrides: undefined,\n },\n};\n\nexport const WILDO_OWNER_ORGANIZATION: WildoOwnerOrganizationIdentity = {\n slug: 'wildo',\n name: 'Wildo',\n type: WILDO_PLATFORM_ORGANIZATION_TYPE,\n};\n"]}
1
+ {"version":3,"file":"wildo-owner-organization.contracts.js","sourceRoot":"","sources":["../../../src/bootstrap/wildo-owner-organization.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,wBAAwB,EAAsD,MAAM,uBAAuB,CAAC;AAuDvJ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,QAAQ,CAAC;AAExD,MAAM,CAAC,MAAM,yBAAyB,GAAoB;IACxD,CAAC,+BAA+B,CAAC,EAAE,wBAAwB,CAAC,KAAK,CAAC;QAChE,IAAI,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,gBAAgB,CAAC,QAAQ,EAAE,EAAE;KAC5D,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAAmB,CAAC;AAEpE,MAAM,CAAC,MAAM,iCAAiC,GAA4B;IACxE,CAAC,gCAAgC,CAAC,EAAE;QAClC,SAAS,EAAE,CAAC,+BAA+B,CAAC;QAC5C,iBAAiB,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,UAAU,CAAC;QAClG,iBAAiB,EAAE,cAAc,CAAC,UAAU;QAC5C,aAAa,EAAE,SAAS;KACzB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAmC;IACtE,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,gCAAgC;CACvC,CAAC","sourcesContent":["import { CORE_ORG_ROLES, RegistrationMode, UserTypeDefinitionSchema, type OrganizationTypesConfig, type UserTypesConfig } from '@wildo-ai/saas-models';\n\n/**\n * The ONE identity of the organization that owns Wildo's own applications.\n *\n * ## Why this constant exists\n *\n * This identity used to be hardcoded FOUR times, in two files, as TWO DIFFERENT VALUES — and the\n * result was a platform carrying two organizations, neither of them a customer:\n *\n * | declared in | value |\n * |---|---|\n * | `init-mode-startup.apps-manager.service.ts` (twice) | `wildo-platform` / `Wildo Platform` |\n * | `maintenance/services/app-initialization.service.ts` (twice) | `wildo` / `Wildo` |\n *\n * The two paths provision different things, so ownership split along them. Measured on the dogfood\n * platform (2026-09-01): `wildo-ai-application` — the bootstrap row — was owned by `wildo-platform`,\n * while `wonder-crm`, `wonder-todos` and `secrets-proof` were owned by `wildo`. Worse, OPERATOR\n * REACH followed the same split: the admin seeded by INIT was `ORG_ADMIN` of BOTH organizations,\n * while an admin seeded later by the maintenance path was a member of `wildo` ONLY. Nothing declared\n * that they should differ; it was decided by which code path happened to run.\n *\n * The bootstrap organization is also `ACTIVE` and authority-conferring, so everything that\n * ENUMERATES tenants — an organization switcher, the owner-floor boot report, a cross-tenant audit,\n * a subject-erasure sweep — counted a bootstrap artifact as a real tenant.\n *\n * ## Why ONE organization rather than two declared ones\n *\n * The second organization was never a design. `seedBootstrapApplicationRecord` needs *an* owner for\n * the minimal APPLICATION row it seeds to break a chicken-and-egg (an APPLICATION-primary-scoped\n * execution context resolves its `applicationId` by READING that row). It needs an owner; it never\n * needed a DIFFERENT one. Wildo owning all Wildo applications — including its own — is the coherent\n * reading, and it is what the duplication suggests was intended before the two literals drifted.\n *\n * If a future decision genuinely wants the platform's own application in a separate tenant, that is\n * a SECOND named constant here plus an explicit statement of which consumers must tell them apart —\n * not a second literal at a call site.\n *\n * ## What this does NOT do\n *\n * It does not retrofit an existing platform. Both bootstrap seeding arms look a row up by business\n * key and insert ONLY when absent, and the registration path prefers an existing application's\n * recorded `ownerOrganizationId` over the seeded id — so an installation that already carries two\n * organizations keeps both, with its existing linkage untouched. Only a FRESH platform gets one.\n * Merging the two on an existing installation is a migration with its own decision.\n */\nexport interface WildoOwnerOrganizationIdentity {\n /** Business key. Both provisioning paths upsert the organization by THIS field. */\n readonly slug: string;\n /** Display name written on first seed. */\n readonly name: string;\n /** The organization type written on first seed — a key of {@link WILDO_PLATFORM_ORGANIZATION_TYPES}. */\n readonly type: typeof WILDO_PLATFORM_ORGANIZATION_TYPE;\n}\n\n/**\n * The user type the platform seeds its first administrator with, and the one its organization type grants.\n *\n * Declared because it was already HELD: the platform's INIT seed gave its first administrator `member` long before\n * the platform declared any user type, and nothing checked the pair until organization types — whose granted user\n * types must be declared — became mandatory (#1032). Registration is DISABLED: a platform user exists because the\n * platform seeded them, never because someone signed up.\n */\nexport const WILDO_PLATFORM_MEMBER_USER_TYPE = 'member';\n\nexport const WILDO_PLATFORM_USER_TYPES: UserTypesConfig = {\n [WILDO_PLATFORM_MEMBER_USER_TYPE]: UserTypeDefinitionSchema.parse({\n auth: { registration: { mode: RegistrationMode.DISABLED } },\n }),\n};\n\n/**\n * The ONE organization type the platform's own tenancy declares (#1032, decided 2026-09-14).\n *\n * Every organization carries a type that names a declared organization type, because a member of an\n * organization whose type resolves to nothing cannot sign in. An application declares its types in\n * `wildo.saas.config.ts`; the platform has no such file, so its declaration lives here, beside the\n * identity of the organization it types. Before this, the platform seeded its organizations with no\n * type at all, and `wildo_platform` held two of them.\n *\n * It grants {@link WILDO_PLATFORM_MEMBER_USER_TYPE}, the user type the platform's INIT seeds its first administrator\n * with, so the platform's own first-organization derivation resolves to this type rather than refusing — and a\n * configuration carrying this map must carry {@link WILDO_PLATFORM_USER_TYPES} beside it, or its granted user type\n * is undeclared.\n */\nexport const WILDO_PLATFORM_ORGANIZATION_TYPE = 'platform-operator';\n\nexport const WILDO_PLATFORM_ORGANIZATION_TYPES: OrganizationTypesConfig = {\n [WILDO_PLATFORM_ORGANIZATION_TYPE]: {\n userTypes: [WILDO_PLATFORM_MEMBER_USER_TYPE],\n availableOrgRoles: [CORE_ORG_ROLES.ORG_OWNER, CORE_ORG_ROLES.ORG_ADMIN, CORE_ORG_ROLES.ORG_MEMBER],\n defaultMemberRole: CORE_ORG_ROLES.ORG_MEMBER,\n authOverrides: undefined,\n },\n};\n\nexport const WILDO_OWNER_ORGANIZATION: WildoOwnerOrganizationIdentity = {\n slug: 'wildo',\n name: 'Wildo',\n type: WILDO_PLATFORM_ORGANIZATION_TYPE,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rfc8785-canonical-json.d.ts","sourceRoot":"","sources":["../../../../src/canonical-json/rfc8785-canonical-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GACjB,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,SAAS,EAAE,GACpB;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE1C;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAKhD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAGvD"}
1
+ {"version":3,"file":"rfc8785-canonical-json.d.ts","sourceRoot":"","sources":["../../../src/canonical-json/rfc8785-canonical-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GACjB,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,SAAS,EAAE,GACpB;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE1C;;;;GAIG;AACH,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kBAAkB,CAC1B,IAAI,EACJ,qDAAqD,CACtD,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,GAAW;IACjD,OAAO,GAAG,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC;AAC3C,CAAC","sourcesContent":["/**\n * RFC 8785 (JSON Canonicalization Scheme) serialization: the ONE implementation in the repository.\n *\n * Lived in `saas-backend-lib` (`flows-actors/utils/canonical-json.backend.utils.ts`) until 2026-10-19, when the response\n * signatures of #2921 needed it on both sides of the apps-manager boundary. It moved here, to the dependency-light\n * contracts package every runtime and every platform service already depends on, rather than gaining a second copy:\n * a hand-rolled alternative (`stableJsonStringify`) was briefly used for those signatures and was wrong in two ways an\n * RFC 8785 serializer is not. It assigned keys onto an ordinary object, so a `\"__proto__\"` member set the prototype\n * and vanished from the serialization, letting it be added to a signed body undetected; and it let JavaScript order\n * integer-like keys numerically, which no verifier in another language would reproduce.\n *\n * What this serializer guarantees: object keys compared as raw UTF-16 code units; arrays in authored order; numbers in\n * ECMAScript's finite JSON form; strings preserved without Unicode normalization; no whitespace; and members built on\n * null-prototype objects, so `__proto__` is an ordinary member. Values `JSON.stringify` would silently coerce or omit\n * are refused instead, because such coercion would collapse distinct inputs onto one digest.\n *\n * Consumers: apps-manager response signatures (`runtime-response-integrity.ts`), the framework-knowledge generation\n * pipeline (deterministic output bytes), and the meta-workflow compiler tests.\n */\n\n/**\n * The JSON data model accepted by the canonicalization boundary.\n *\n * The runtime functions intentionally accept `unknown` and validate it rather\n * than trusting this compile-time shape. Digest inputs may originate in parsed\n * artifacts or application-owned adapters, so a type assertion must never be\n * enough to admit a non-JSON value into semantic identity.\n */\nexport type JsonValue =\n | null\n | boolean\n | number\n | string\n | readonly JsonValue[]\n | { readonly [key: string]: JsonValue };\n\n/**\n * A fail-closed canonicalization error with the structural location of the\n * invalid value. Error messages intentionally describe shape/type only and do\n * not interpolate the rejected value, which may contain application data.\n */\nexport class CanonicalJsonError extends TypeError {\n public readonly path: string;\n\n public constructor(path: string, reason: string) {\n super(`Canonical JSON rejected ${path}: ${reason}`);\n this.name = 'CanonicalJsonError';\n this.path = path;\n }\n}\n\n/**\n * Produce RFC 8785/JCS-compatible JSON text from strict JSON data.\n *\n * Object keys are compared as raw UTF-16 code units, arrays retain their\n * authored order, numbers use ECMAScript's finite-number JSON form, strings\n * are preserved without Unicode normalization, and no whitespace is emitted.\n * Values that JavaScript's ordinary `JSON.stringify` would silently coerce or\n * omit are rejected instead, because such coercion would collapse distinct\n * semantic inputs onto one digest.\n */\nexport function canonicalizeJson(value: unknown): string {\n const normalized = normalizeJsonValue(value, '$', new WeakSet<object>());\n return serializeNormalizedJsonValue(normalized);\n}\n\nfunction normalizeJsonValue(\n value: unknown,\n path: string,\n ancestors: WeakSet<object>,\n): JsonValue {\n if (value === null) {\n return null;\n }\n\n switch (typeof value) {\n case 'boolean':\n return value;\n case 'number':\n if (!Number.isFinite(value)) {\n throw new CanonicalJsonError(\n path,\n 'numbers must be finite IEEE-754 values',\n );\n }\n return value;\n case 'string':\n assertPairedSurrogates(value, path);\n return value;\n case 'undefined':\n case 'function':\n case 'symbol':\n case 'bigint':\n throw new CanonicalJsonError(\n path,\n `${typeof value} is not JSON data`,\n );\n case 'object':\n if (Array.isArray(value)) {\n return normalizeJsonArray(value, path, ancestors);\n }\n if (!isPlainJsonObject(value)) {\n throw new CanonicalJsonError(\n path,\n 'objects must have Object.prototype or null prototype and no toJSON behavior',\n );\n }\n return normalizePlainJsonObject(value, path, ancestors);\n default:\n throw new CanonicalJsonError(path, 'unsupported JavaScript value');\n }\n}\n\nfunction normalizeJsonArray(\n value: unknown[],\n path: string,\n ancestors: WeakSet<object>,\n): readonly JsonValue[] {\n if (Object.getPrototypeOf(value) !== Array.prototype) {\n throw new CanonicalJsonError(path, 'non-plain arrays are not JSON data');\n }\n enterContainer(value, path, ancestors);\n\n try {\n const indexDescriptors = new Map<number, PropertyDescriptor>();\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key === 'symbol') {\n throw new CanonicalJsonError(\n path,\n 'symbol-keyed array properties are not JSON data',\n );\n }\n if (key === 'length') {\n continue;\n }\n\n const index = parseCanonicalArrayIndex(key);\n if (index === null || index >= value.length) {\n throw new CanonicalJsonError(\n path,\n `array property ${JSON.stringify(key)} is not an element`,\n );\n }\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !('value' in descriptor) || !descriptor.enumerable) {\n throw new CanonicalJsonError(\n `${path}[${index}]`,\n 'array elements must be enumerable data properties',\n );\n }\n indexDescriptors.set(index, descriptor);\n }\n\n if (indexDescriptors.size !== value.length) {\n throw new CanonicalJsonError(path, 'sparse arrays are not permitted');\n }\n\n const normalized: JsonValue[] = [];\n for (let index = 0; index < value.length; index += 1) {\n const descriptor = indexDescriptors.get(index);\n if (descriptor === undefined) {\n throw new CanonicalJsonError(path, 'sparse arrays are not permitted');\n }\n normalized.push(\n normalizeJsonValue(descriptor.value, `${path}[${index}]`, ancestors),\n );\n }\n return normalized;\n } finally {\n ancestors.delete(value);\n }\n}\n\nfunction normalizePlainJsonObject(\n value: object,\n path: string,\n ancestors: WeakSet<object>,\n excludedFields: ReadonlySet<string> = new Set<string>(),\n): { readonly [key: string]: JsonValue } {\n if (!isPlainJsonObject(value)) {\n throw new CanonicalJsonError(\n path,\n 'objects must have Object.prototype or null prototype and no toJSON behavior',\n );\n }\n enterContainer(value, path, ancestors);\n\n try {\n const descriptors = Object.getOwnPropertyDescriptors(value);\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key === 'symbol') {\n throw new CanonicalJsonError(\n path,\n 'symbol-keyed object properties are not JSON data',\n );\n }\n const descriptor = descriptors[key];\n if (descriptor === undefined || !('value' in descriptor) || !descriptor.enumerable) {\n throw new CanonicalJsonError(\n appendObjectPath(path, key),\n 'object members must be enumerable data properties',\n );\n }\n }\n\n const normalized: { [key: string]: JsonValue } = Object.create(null);\n const keys = Object.keys(descriptors).sort(compareUtf16CodeUnits);\n for (const key of keys) {\n assertPairedSurrogates(key, `${path} (object key)`);\n if (excludedFields.has(key)) {\n continue;\n }\n const descriptor = descriptors[key];\n if (descriptor === undefined || !('value' in descriptor)) {\n throw new CanonicalJsonError(\n appendObjectPath(path, key),\n 'object members must be data properties',\n );\n }\n normalized[key] = normalizeJsonValue(\n descriptor.value,\n appendObjectPath(path, key),\n ancestors,\n );\n }\n return normalized;\n } finally {\n ancestors.delete(value);\n }\n}\n\nfunction serializeNormalizedJsonValue(value: JsonValue): string {\n if (value === null || typeof value === 'boolean' || typeof value === 'number') {\n const serialized = JSON.stringify(value);\n if (serialized === undefined) {\n throw new CanonicalJsonError('$', 'failed to serialize JSON primitive');\n }\n return serialized;\n }\n if (typeof value === 'string') {\n return JSON.stringify(value);\n }\n if (Array.isArray(value)) {\n return `[${value.map(serializeNormalizedJsonValue).join(',')}]`;\n }\n\n const objectValue = value as { readonly [key: string]: JsonValue };\n const entries = Object.keys(objectValue)\n .sort(compareUtf16CodeUnits)\n .map(\n (key) =>\n `${JSON.stringify(key)}:${serializeNormalizedJsonValue(objectValue[key])}`,\n );\n return `{${entries.join(',')}}`;\n}\n\nfunction isPlainJsonObject(value: unknown): value is Record<string, unknown> {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction enterContainer(\n value: object,\n path: string,\n ancestors: WeakSet<object>,\n): void {\n if (ancestors.has(value)) {\n throw new CanonicalJsonError(path, 'cyclic references are not permitted');\n }\n ancestors.add(value);\n}\n\nfunction parseCanonicalArrayIndex(key: string): number | null {\n if (key === '') {\n return null;\n }\n const index = Number(key);\n if (\n !Number.isInteger(index)\n || index < 0\n || index >= 0xffff_ffff\n || String(index) !== key\n ) {\n return null;\n }\n return index;\n}\n\nfunction compareUtf16CodeUnits(left: string, right: string): number {\n if (left < right) {\n return -1;\n }\n if (left > right) {\n return 1;\n }\n return 0;\n}\n\nfunction assertPairedSurrogates(value: string, path: string): void {\n for (let index = 0; index < value.length; index += 1) {\n const codeUnit = value.charCodeAt(index);\n if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {\n const nextCodeUnit = value.charCodeAt(index + 1);\n if (\n !Number.isFinite(nextCodeUnit)\n || nextCodeUnit < 0xdc00\n || nextCodeUnit > 0xdfff\n ) {\n throw new CanonicalJsonError(\n path,\n 'strings must not contain unpaired UTF-16 surrogates',\n );\n }\n index += 1;\n continue;\n }\n if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {\n throw new CanonicalJsonError(\n path,\n 'strings must not contain unpaired UTF-16 surrogates',\n );\n }\n }\n}\n\nfunction appendObjectPath(path: string, key: string): string {\n return `${path}[${JSON.stringify(key)}]`;\n}\n"]}
1
+ {"version":3,"file":"rfc8785-canonical-json.js","sourceRoot":"","sources":["../../../src/canonical-json/rfc8785-canonical-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAkBH;;;;GAIG;AACH,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/B,IAAI,CAAS;IAE7B,YAAmB,IAAY,EAAE,MAAc;QAC7C,KAAK,CAAC,2BAA2B,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,MAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,OAAO,EAAU,CAAC,CAAC;IACzE,OAAO,4BAA4B,CAAC,UAAU,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,kBAAkB,CACzB,KAAc,EACd,IAAY,EACZ,SAA0B;IAE1B,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAA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AY,CAAC;mBAC3B,YAAY,GAAG,MAAM;mBACrB,YAAY,GAAG,MAAM,EACxB,CAAC;gBACD,MAAM,IAAI,kBAAkB,CAC1B,IAAI,EACJ,qDAAqD,CACtD,CAAC;YACJ,CAAC;YACD,KAAK,IAAI,CAAC,CAAC;YACX,SAAS;QACX,CAAC;QACD,IAAI,QAAQ,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;YAC7C,MAAM,IAAI,kBAAkB,CAC1B,IAAI,EACJ,qDAAqD,CACtD,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,GAAW;IACjD,OAAO,GAAG,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC;AAC3C,CAAC","sourcesContent":["/**\n * RFC 8785 (JSON Canonicalization Scheme) serialization: the ONE implementation in the repository.\n *\n * Lived in `saas-backend-lib` (`flows-actors/utils/canonical-json.backend.utils.ts`) until 2026-10-19, when the response\n * signatures of #2921 needed it on both sides of the apps-manager boundary. It moved here, to the dependency-light\n * contracts package every runtime and every platform service already depends on, rather than gaining a second copy:\n * a hand-rolled alternative (`stableJsonStringify`) was briefly used for those signatures and was wrong in two ways an\n * RFC 8785 serializer is not. It assigned keys onto an ordinary object, so a `\"__proto__\"` member set the prototype\n * and vanished from the serialization, letting it be added to a signed body undetected; and it let JavaScript order\n * integer-like keys numerically, which no verifier in another language would reproduce.\n *\n * What this serializer guarantees: object keys compared as raw UTF-16 code units; arrays in authored order; numbers in\n * ECMAScript's finite JSON form; strings preserved without Unicode normalization; no whitespace; and members built on\n * null-prototype objects, so `__proto__` is an ordinary member. Values `JSON.stringify` would silently coerce or omit\n * are refused instead, because such coercion would collapse distinct inputs onto one digest.\n *\n * Consumers: apps-manager response signatures (`runtime-response-integrity.ts`), the framework-knowledge generation\n * pipeline (deterministic output bytes), and the meta-workflow compiler tests.\n */\n\n/**\n * The JSON data model accepted by the canonicalization boundary.\n *\n * The runtime functions intentionally accept `unknown` and validate it rather\n * than trusting this compile-time shape. Digest inputs may originate in parsed\n * artifacts or application-owned adapters, so a type assertion must never be\n * enough to admit a non-JSON value into semantic identity.\n */\nexport type JsonValue =\n | null\n | boolean\n | number\n | string\n | readonly JsonValue[]\n | { readonly [key: string]: JsonValue };\n\n/**\n * A fail-closed canonicalization error with the structural location of the\n * invalid value. Error messages intentionally describe shape/type only and do\n * not interpolate the rejected value, which may contain application data.\n */\nexport class CanonicalJsonError extends TypeError {\n public readonly path: string;\n\n public constructor(path: string, reason: string) {\n super(`Canonical JSON rejected ${path}: ${reason}`);\n this.name = 'CanonicalJsonError';\n this.path = path;\n }\n}\n\n/**\n * Produce RFC 8785/JCS-compatible JSON text from strict JSON data.\n *\n * Object keys are compared as raw UTF-16 code units, arrays retain their\n * authored order, numbers use ECMAScript's finite-number JSON form, strings\n * are preserved without Unicode normalization, and no whitespace is emitted.\n * Values that JavaScript's ordinary `JSON.stringify` would silently coerce or\n * omit are rejected instead, because such coercion would collapse distinct\n * semantic inputs onto one digest.\n */\nexport function canonicalizeJson(value: unknown): string {\n const normalized = normalizeJsonValue(value, '$', new WeakSet<object>());\n return serializeNormalizedJsonValue(normalized);\n}\n\nfunction normalizeJsonValue(\n value: unknown,\n path: string,\n ancestors: WeakSet<object>,\n): JsonValue {\n if (value === null) {\n return null;\n }\n\n switch (typeof value) {\n case 'boolean':\n return value;\n case 'number':\n if (!Number.isFinite(value)) {\n throw new CanonicalJsonError(\n path,\n 'numbers must be finite IEEE-754 values',\n );\n }\n return value;\n case 'string':\n assertPairedSurrogates(value, path);\n return value;\n case 'undefined':\n case 'function':\n case 'symbol':\n case 'bigint':\n throw new CanonicalJsonError(\n path,\n `${typeof value} is not JSON data`,\n );\n case 'object':\n if (Array.isArray(value)) {\n return normalizeJsonArray(value, path, ancestors);\n }\n if (!isPlainJsonObject(value)) {\n throw new CanonicalJsonError(\n path,\n 'objects must have Object.prototype or null prototype and no toJSON behavior',\n );\n }\n return normalizePlainJsonObject(value, path, ancestors);\n default:\n throw new CanonicalJsonError(path, 'unsupported JavaScript value');\n }\n}\n\nfunction normalizeJsonArray(\n value: unknown[],\n path: string,\n ancestors: WeakSet<object>,\n): readonly JsonValue[] {\n if (Object.getPrototypeOf(value) !== Array.prototype) {\n throw new CanonicalJsonError(path, 'non-plain arrays are not JSON data');\n }\n enterContainer(value, path, ancestors);\n\n try {\n const indexDescriptors = new Map<number, PropertyDescriptor>();\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key === 'symbol') {\n throw new CanonicalJsonError(\n path,\n 'symbol-keyed array properties are not JSON data',\n );\n }\n if (key === 'length') {\n continue;\n }\n\n const index = parseCanonicalArrayIndex(key);\n if (index === null || index >= value.length) {\n throw new CanonicalJsonError(\n path,\n `array property ${JSON.stringify(key)} is not an element`,\n );\n }\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !('value' in descriptor) || !descriptor.enumerable) {\n throw new CanonicalJsonError(\n `${path}[${index}]`,\n 'array elements must be enumerable data properties',\n );\n }\n indexDescriptors.set(index, descriptor);\n }\n\n if (indexDescriptors.size !== value.length) {\n throw new CanonicalJsonError(path, 'sparse arrays are not permitted');\n }\n\n const normalized: JsonValue[] = [];\n for (let index = 0; index < value.length; index += 1) {\n const descriptor = indexDescriptors.get(index);\n if (descriptor === undefined) {\n throw new CanonicalJsonError(path, 'sparse arrays are not permitted');\n }\n normalized.push(\n normalizeJsonValue(descriptor.value, `${path}[${index}]`, ancestors),\n );\n }\n return normalized;\n } finally {\n ancestors.delete(value);\n }\n}\n\nfunction normalizePlainJsonObject(\n value: object,\n path: string,\n ancestors: WeakSet<object>,\n excludedFields: ReadonlySet<string> = new Set<string>(),\n): { readonly [key: string]: JsonValue } {\n if (!isPlainJsonObject(value)) {\n throw new CanonicalJsonError(\n path,\n 'objects must have Object.prototype or null prototype and no toJSON behavior',\n );\n }\n enterContainer(value, path, ancestors);\n\n try {\n const descriptors = Object.getOwnPropertyDescriptors(value);\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key === 'symbol') {\n throw new CanonicalJsonError(\n path,\n 'symbol-keyed object properties are not JSON data',\n );\n }\n const descriptor = descriptors[key];\n if (descriptor === undefined || !('value' in descriptor) || !descriptor.enumerable) {\n throw new CanonicalJsonError(\n appendObjectPath(path, key),\n 'object members must be enumerable data properties',\n );\n }\n }\n\n const normalized: { [key: string]: JsonValue } = Object.create(null);\n const keys = Object.keys(descriptors).sort(compareUtf16CodeUnits);\n for (const key of keys) {\n assertPairedSurrogates(key, `${path} (object key)`);\n if (excludedFields.has(key)) {\n continue;\n }\n const descriptor = descriptors[key];\n if (descriptor === undefined || !('value' in descriptor)) {\n throw new CanonicalJsonError(\n appendObjectPath(path, key),\n 'object members must be data properties',\n );\n }\n normalized[key] = normalizeJsonValue(\n descriptor.value,\n appendObjectPath(path, key),\n ancestors,\n );\n }\n return normalized;\n } finally {\n ancestors.delete(value);\n }\n}\n\nfunction serializeNormalizedJsonValue(value: JsonValue): string {\n if (value === null || typeof value === 'boolean' || typeof value === 'number') {\n const serialized = JSON.stringify(value);\n if (serialized === undefined) {\n throw new CanonicalJsonError('$', 'failed to serialize JSON primitive');\n }\n return serialized;\n }\n if (typeof value === 'string') {\n return JSON.stringify(value);\n }\n if (Array.isArray(value)) {\n return `[${value.map(serializeNormalizedJsonValue).join(',')}]`;\n }\n\n const objectValue = value as { readonly [key: string]: JsonValue };\n const entries = Object.keys(objectValue)\n .sort(compareUtf16CodeUnits)\n .map(\n (key) =>\n `${JSON.stringify(key)}:${serializeNormalizedJsonValue(objectValue[key])}`,\n );\n return `{${entries.join(',')}}`;\n}\n\nfunction isPlainJsonObject(value: unknown): value is Record<string, unknown> {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction enterContainer(\n value: object,\n path: string,\n ancestors: WeakSet<object>,\n): void {\n if (ancestors.has(value)) {\n throw new CanonicalJsonError(path, 'cyclic references are not permitted');\n }\n ancestors.add(value);\n}\n\nfunction parseCanonicalArrayIndex(key: string): number | null {\n if (key === '') {\n return null;\n }\n const index = Number(key);\n if (\n !Number.isInteger(index)\n || index < 0\n || index >= 0xffff_ffff\n || String(index) !== key\n ) {\n return null;\n }\n return index;\n}\n\nfunction compareUtf16CodeUnits(left: string, right: string): number {\n if (left < right) {\n return -1;\n }\n if (left > right) {\n return 1;\n }\n return 0;\n}\n\nfunction assertPairedSurrogates(value: string, path: string): void {\n for (let index = 0; index < value.length; index += 1) {\n const codeUnit = value.charCodeAt(index);\n if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {\n const nextCodeUnit = value.charCodeAt(index + 1);\n if (\n !Number.isFinite(nextCodeUnit)\n || nextCodeUnit < 0xdc00\n || nextCodeUnit > 0xdfff\n ) {\n throw new CanonicalJsonError(\n path,\n 'strings must not contain unpaired UTF-16 surrogates',\n );\n }\n index += 1;\n continue;\n }\n if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {\n throw new CanonicalJsonError(\n path,\n 'strings must not contain unpaired UTF-16 surrogates',\n );\n }\n }\n}\n\nfunction appendObjectPath(path: string, key: string): string {\n return `${path}[${JSON.stringify(key)}]`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"config-authoring.entry.d.ts","sourceRoot":"","sources":["../../../src/config-authoring.entry.ts"],"names":[],"mappings":"AAsCA,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"config-authoring.entry.d.ts","sourceRoot":"","sources":["../../src/config-authoring.entry.ts"],"names":[],"mappings":"AAsCA,cAAc,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config-authoring.entry.js","sourceRoot":"","sources":["../../../src/config-authoring.entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,iBAAiB,EAAE,CAAC;AAEpB,cAAc,SAAS,CAAC","sourcesContent":["/**\n * What `@wildo-ai/platform-config-lib` resolves to while the CONFIG LOADER evaluates a configuration\n * file from source (`loader.ts` → `resolvePlatformConfigLibEntry`).\n *\n * It is the package root plus one side effect: the Zod decorators are initialized before any schema\n * module in the evaluated graph runs, because a config file's own schemas may be authored with them\n * and the loader owns no other moment to do it.\n *\n * ## It re-exports the WHOLE root, and that is the point\n *\n * Until 2026-09-09 this entry exported `./project-config` and `./workspace-scope` and nothing else,\n * and the narrowing was never a boundary — it was a trap that fired twice, the same way both times.\n * The loader substitutes this file for the package specifier in EVERY module of the evaluated\n * graph, and that graph is not only the authored config: `wildo.saas.config.ts` and the backend\n * config import `@wildo-ai/saas-backend-lib`, which the loader also aliases to source, and the\n * engine's own modules import `@wildo-ai/platform-config-lib` expecting the root. A symbol the\n * root exports but this entry did not was not refused — under jiti it arrived as `undefined`, at\n * the first module-eval use:\n *\n * - `MinionPlatformAccessScope`: an app config importing it beside `AppFrontendType`, same\n * package, same statement, got one and `undefined` for the other. The symptom was answered by\n * moving the enum out of `bootstrap/` into `project-config/` (`minion-platform-access.vocabulary.ts`).\n * - `AdminAppManagedMinionsSchema` / `AdminAppManagedWorkersSchema`: the engine's configuration\n * loader began composing its wire schema from these at module load (removing a hand copy that\n * had silently stripped fields twice). Under the loader it threw\n * \"Cannot read properties of undefined (reading 'optional')\" and `wildo local dev` shut the\n * whole stack down at \"Registering application once and materializing every runtime target\".\n *\n * Moving symbols around cures one name at a time and teaches nothing; an entry that carries the\n * root's value surface cannot have this defect. Nothing in the root is unsafe here — the loader\n * runs under Node, and the root's Node-only modules (lockfile IO, credential generation) are\n * exactly what a Node process may load. If a module ever becomes unsuitable for config evaluation,\n * exclude THAT module from the root, explicitly, with its reason — never narrow this file again.\n */\nimport { initZodDecorators } from '@wildo-ai/zod-decorators';\n\ninitZodDecorators();\n\nexport * from './index';\n"]}
1
+ {"version":3,"file":"config-authoring.entry.js","sourceRoot":"","sources":["../../src/config-authoring.entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,iBAAiB,EAAE,CAAC;AAEpB,cAAc,SAAS,CAAC","sourcesContent":["/**\n * What `@wildo-ai/platform-config-lib` resolves to while the CONFIG LOADER evaluates a configuration\n * file from source (`loader.ts` → `resolvePlatformConfigLibEntry`).\n *\n * It is the package root plus one side effect: the Zod decorators are initialized before any schema\n * module in the evaluated graph runs, because a config file's own schemas may be authored with them\n * and the loader owns no other moment to do it.\n *\n * ## It re-exports the WHOLE root, and that is the point\n *\n * Until 2026-09-09 this entry exported `./project-config` and `./workspace-scope` and nothing else,\n * and the narrowing was never a boundary — it was a trap that fired twice, the same way both times.\n * The loader substitutes this file for the package specifier in EVERY module of the evaluated\n * graph, and that graph is not only the authored config: `wildo.saas.config.ts` and the backend\n * config import `@wildo-ai/saas-backend-lib`, which the loader also aliases to source, and the\n * engine's own modules import `@wildo-ai/platform-config-lib` expecting the root. A symbol the\n * root exports but this entry did not was not refused — under jiti it arrived as `undefined`, at\n * the first module-eval use:\n *\n * - `MinionPlatformAccessScope`: an app config importing it beside `AppFrontendType`, same\n * package, same statement, got one and `undefined` for the other. The symptom was answered by\n * moving the enum out of `bootstrap/` into `project-config/` (`minion-platform-access.vocabulary.ts`).\n * - `AdminAppManagedMinionsSchema` / `AdminAppManagedWorkersSchema`: the engine's configuration\n * loader began composing its wire schema from these at module load (removing a hand copy that\n * had silently stripped fields twice). Under the loader it threw\n * \"Cannot read properties of undefined (reading 'optional')\" and `wildo local dev` shut the\n * whole stack down at \"Registering application once and materializing every runtime target\".\n *\n * Moving symbols around cures one name at a time and teaches nothing; an entry that carries the\n * root's value surface cannot have this defect. Nothing in the root is unsafe here — the loader\n * runs under Node, and the root's Node-only modules (lockfile IO, credential generation) are\n * exactly what a Node process may load. If a module ever becomes unsuitable for config evaluation,\n * exclude THAT module from the root, explicitly, with its reason — never narrow this file again.\n */\nimport { initZodDecorators } from '@wildo-ai/zod-decorators';\n\ninitZodDecorators();\n\nexport * from './index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"credential-generator.service.d.ts","sourceRoot":"","sources":["../../../../src/credentials/credential-generator.service.ts"],"names":[],"mappings":"AAMA,qBAAa,mBAAmB;IAE9B,MAAM,CAAC,iBAAiB,IAAI;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IASrE,MAAM,CAAC,gBAAgB,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM;IAIpD,MAAM,CAAC,cAAc,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM;IAIlD,MAAM,CAAC,oBAAoB,IAAI,MAAM;IAIrC,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;CASpE"}
1
+ {"version":3,"file":"credential-generator.service.d.ts","sourceRoot":"","sources":["../../../src/credentials/credential-generator.service.ts"],"names":[],"mappings":"AAMA,qBAAa,mBAAmB;IAE9B,MAAM,CAAC,iBAAiB,IAAI;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IASrE,MAAM,CAAC,gBAAgB,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM;IAIpD,MAAM,CAAC,cAAc,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM;IAIlD,MAAM,CAAC,oBAAoB,IAAI,MAAM;IAIrC,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;CASpE"}
@@ -1 +1 @@
1
- {"version":3,"file":"credential-generator.service.js","sourceRoot":"","sources":["../../../../src/credentials/credential-generator.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAA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;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF","sourcesContent":["import { generateKeyPairSync, randomBytes } from 'crypto';\n\nconst ALPHANUMERIC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nconst PASSWORD_CHARS = ALPHANUMERIC + '_+-';\n\n\nexport class CredentialGenerator {\n\n static generateECKeyPair(): { privateKey: string; publicKey: string } {\n const { publicKey, privateKey } = generateKeyPairSync('ec', {\n namedCurve: 'prime256v1',\n publicKeyEncoding: { type: 'spki', format: 'pem' },\n privateKeyEncoding: { type: 'sec1', format: 'pem' },\n });\n return { privateKey: privateKey.trim(), publicKey: publicKey.trim() };\n }\n\n static generatePassword(length: number = 24): string {\n return this.generateFromCharset(length, PASSWORD_CHARS);\n }\n\n static generateSecret(length: number = 48): string {\n return this.generateFromCharset(length, ALPHANUMERIC);\n }\n\n static generateErlangCookie(): string {\n return this.generateFromCharset(32, ALPHANUMERIC);\n }\n\n static generateFromCharset(length: number, charset: string): string {\n const bytes = randomBytes(length);\n let result = '';\n for (let i = 0; i < length; i++) {\n result += charset[bytes[i] % charset.length];\n }\n return result;\n }\n\n}\n"]}
1
+ {"version":3,"file":"credential-generator.service.js","sourceRoot":"","sources":["../../../src/credentials/credential-generator.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE1D,MAAM,YAAY,GAAG,gEAAgE,CAAC;AACtF,MAAM,cAAc,GAAG,YAAY,GAAG,KAAK,CAAC;AAG5C,MAAM,OAAO,mBAAmB;IAE9B,MAAM,CAAC,iBAAiB;QACtB,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,mBAAmB,CAAC,IAAI,EAAE;YAC1D,UAAU,EAAE,YAAY;YACxB,iBAAiB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE;YAClD,kBAAkB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE;SACpD,CAAC,CAAC;QACH,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;IACxE,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,SAAiB,EAAE;QACzC,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,SAAiB,EAAE;QACvC,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,oBAAoB;QACzB,OAAO,IAAI,CAAC,mBAAmB,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,CAAC,mBAAmB,CAAC,MAAc,EAAE,OAAe;QACxD,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF","sourcesContent":["import { generateKeyPairSync, randomBytes } from 'crypto';\n\nconst ALPHANUMERIC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nconst PASSWORD_CHARS = ALPHANUMERIC + '_+-';\n\n\nexport class CredentialGenerator {\n\n static generateECKeyPair(): { privateKey: string; publicKey: string } {\n const { publicKey, privateKey } = generateKeyPairSync('ec', {\n namedCurve: 'prime256v1',\n publicKeyEncoding: { type: 'spki', format: 'pem' },\n privateKeyEncoding: { type: 'sec1', format: 'pem' },\n });\n return { privateKey: privateKey.trim(), publicKey: publicKey.trim() };\n }\n\n static generatePassword(length: number = 24): string {\n return this.generateFromCharset(length, PASSWORD_CHARS);\n }\n\n static generateSecret(length: number = 48): string {\n return this.generateFromCharset(length, ALPHANUMERIC);\n }\n\n static generateErlangCookie(): string {\n return this.generateFromCharset(32, ALPHANUMERIC);\n }\n\n static generateFromCharset(length: number, charset: string): string {\n const bytes = randomBytes(length);\n let result = '';\n for (let i = 0; i < length; i++) {\n result += charset[bytes[i] % charset.length];\n }\n return result;\n }\n\n}\n"]}
@@ -17,15 +17,19 @@ export * from './bootstrap/platform-runtime-env.contracts';
17
17
  export * from './bootstrap/runtime-secret-env.contracts';
18
18
  export * from './bootstrap/runtime-topology.contracts';
19
19
  export * from './bootstrap/runtime-principal.contracts';
20
+ export * from './bootstrap/postgresql-owed-grants.contracts';
20
21
  export * from './bootstrap/runtime-response-integrity';
21
22
  export * from './key-management/es256-jws';
22
23
  export * from './key-management/data-key.contracts';
23
24
  export * from './key-management/key-provider.spi';
25
+ export * from './key-management/application-signing-key-rotation.contracts';
26
+ export * from './key-management/application-legacy-envelope-key.contracts';
24
27
  export * from './key-management/keyring-rotation.contracts';
25
28
  export * from './key-management/keyring-status.contracts';
26
29
  export * from './key-management/signature-request.contracts';
27
30
  export * from './key-management/approval-seal.contracts';
28
31
  export * from './key-management/approval-seal-verifier';
32
+ export * from './key-management/approval-seal-manifested-copy';
29
33
  export * from './key-management/signing-log-export.contracts';
30
34
  export * from './key-management/vault-custody.contracts';
31
35
  export * from './bootstrap/runtime-backing-service-access';
@@ -44,7 +48,7 @@ export * from './lockfile/materialize-infra-section';
44
48
  export * from './lockfile/canonical-json';
45
49
  export * from './canonical-json/rfc8785-canonical-json';
46
50
  export * from './registry';
51
+ export * from './pnpm-settings/application-pnpm-settings';
47
52
  export * from './blueprint/blueprint.schemas';
48
53
  export * from './blueprint/anchored-region';
49
- export * from './_unimplemented';
50
54
  //# sourceMappingURL=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