@wildo-ai/platform-config-lib 1.0.1 → 1.1.1

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 (414) hide show
  1. package/LICENSE +34 -0
  2. package/dist/esm/.builder.pid +9 -0
  3. package/dist/esm/_unimplemented/index.d.ts +3 -0
  4. package/dist/esm/_unimplemented/index.d.ts.map +1 -0
  5. package/dist/esm/_unimplemented/index.js +3 -0
  6. package/dist/esm/_unimplemented/index.js.map +1 -0
  7. package/dist/esm/_unimplemented/soft-warn.d.ts +124 -0
  8. package/dist/esm/_unimplemented/soft-warn.d.ts.map +1 -0
  9. package/dist/esm/_unimplemented/soft-warn.js +170 -0
  10. package/dist/esm/_unimplemented/soft-warn.js.map +1 -0
  11. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts +137 -0
  12. package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts.map +1 -0
  13. package/dist/esm/_unimplemented/unimplemented-field-warning.js +153 -0
  14. package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +1 -0
  15. package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
  16. package/dist/esm/bootstrap/application-backend-env.contracts.js +1 -1
  17. package/dist/esm/bootstrap/application-backend-env.contracts.js.map +1 -1
  18. package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts +13 -0
  19. package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts.map +1 -0
  20. package/dist/esm/bootstrap/application-creation-verification-env.contracts.js +14 -0
  21. package/dist/esm/bootstrap/application-creation-verification-env.contracts.js.map +1 -0
  22. package/dist/esm/bootstrap/bootstrap-planner.d.ts +1 -1
  23. package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
  24. package/dist/esm/bootstrap/bootstrap-planner.js +1 -1
  25. package/dist/esm/bootstrap/bootstrap-planner.js.map +1 -1
  26. package/dist/esm/bootstrap/bootstrap.contracts.d.ts +141 -37
  27. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  28. package/dist/esm/bootstrap/bootstrap.contracts.js +104 -18
  29. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  30. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +430 -421
  31. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  32. package/dist/esm/bootstrap/bootstrap.schemas.js +383 -21
  33. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  34. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +213 -8
  35. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  36. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +230 -5
  37. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  38. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts +79 -0
  39. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -0
  40. package/dist/esm/bootstrap/runtime-backing-service-access.js +83 -0
  41. package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -0
  42. package/dist/esm/bootstrap/runtime-network-policy.d.ts +63 -0
  43. package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -0
  44. package/dist/esm/bootstrap/runtime-network-policy.js +104 -0
  45. package/dist/esm/bootstrap/runtime-network-policy.js.map +1 -0
  46. package/dist/esm/bootstrap/runtime-network-topology.d.ts +78 -0
  47. package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -0
  48. package/dist/esm/bootstrap/runtime-network-topology.js +134 -0
  49. package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -0
  50. package/dist/esm/bootstrap/runtime-platform-access.d.ts +67 -0
  51. package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -0
  52. package/dist/esm/bootstrap/runtime-platform-access.js +57 -0
  53. package/dist/esm/bootstrap/runtime-platform-access.js.map +1 -0
  54. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts +173 -0
  55. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -0
  56. package/dist/esm/bootstrap/runtime-principal.contracts.js +218 -0
  57. package/dist/esm/bootstrap/runtime-principal.contracts.js.map +1 -0
  58. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts +112 -1
  59. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
  60. package/dist/esm/bootstrap/runtime-topology.contracts.js +141 -8
  61. package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
  62. package/dist/esm/config-authoring.entry.d.ts +3 -0
  63. package/dist/esm/config-authoring.entry.d.ts.map +1 -0
  64. package/dist/esm/config-authoring.entry.js +5 -0
  65. package/dist/esm/config-authoring.entry.js.map +1 -0
  66. package/dist/esm/credentials/credential-generator.service.d.ts.map +1 -1
  67. package/dist/esm/credentials/credential-generator.service.js +1 -1
  68. package/dist/esm/credentials/credential-generator.service.js.map +1 -1
  69. package/dist/esm/index.d.ts +30 -15
  70. package/dist/esm/index.d.ts.map +1 -1
  71. package/dist/esm/index.js +16 -1
  72. package/dist/esm/index.js.map +1 -1
  73. package/dist/esm/lockfile/canonical-json.d.ts +41 -0
  74. package/dist/esm/lockfile/canonical-json.d.ts.map +1 -0
  75. package/dist/esm/lockfile/canonical-json.js +56 -0
  76. package/dist/esm/lockfile/canonical-json.js.map +1 -0
  77. package/dist/esm/lockfile/lockfile-io.d.ts +231 -0
  78. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -0
  79. package/dist/esm/lockfile/lockfile-io.js +303 -0
  80. package/dist/esm/lockfile/lockfile-io.js.map +1 -0
  81. package/dist/esm/lockfile/materialize-infra-section.d.ts +99 -0
  82. package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -0
  83. package/dist/esm/lockfile/materialize-infra-section.js +153 -0
  84. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -0
  85. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +522 -0
  86. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -0
  87. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +116 -0
  88. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -0
  89. package/dist/esm/project-config/define-framework-config.d.ts +36 -10
  90. package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
  91. package/dist/esm/project-config/define-framework-config.js +67 -3
  92. package/dist/esm/project-config/define-framework-config.js.map +1 -1
  93. package/dist/esm/project-config/define-infra-env-config.d.ts +570 -0
  94. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -0
  95. package/dist/esm/project-config/define-infra-env-config.js +726 -0
  96. package/dist/esm/project-config/define-infra-env-config.js.map +1 -0
  97. package/dist/esm/project-config/define-minion-config.d.ts +221 -23
  98. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  99. package/dist/esm/project-config/define-minion-config.js +228 -11
  100. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  101. package/dist/esm/project-config/define-saas-config.d.ts +427 -218
  102. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  103. package/dist/esm/project-config/define-saas-config.js +704 -75
  104. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  105. package/dist/esm/project-config/define-worker-config.d.ts +106 -10
  106. package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
  107. package/dist/esm/project-config/define-worker-config.js +99 -9
  108. package/dist/esm/project-config/define-worker-config.js.map +1 -1
  109. package/dist/esm/project-config/index.d.ts +28 -21
  110. package/dist/esm/project-config/index.d.ts.map +1 -1
  111. package/dist/esm/project-config/index.js +14 -7
  112. package/dist/esm/project-config/index.js.map +1 -1
  113. package/dist/esm/project-config/loader.d.ts +120 -10
  114. package/dist/esm/project-config/loader.d.ts.map +1 -1
  115. package/dist/esm/project-config/loader.js +290 -38
  116. package/dist/esm/project-config/loader.js.map +1 -1
  117. package/dist/esm/project-config/minion-local-provider-registration.d.ts +69 -0
  118. package/dist/esm/project-config/minion-local-provider-registration.d.ts.map +1 -0
  119. package/dist/esm/project-config/minion-local-provider-registration.js +72 -0
  120. package/dist/esm/project-config/minion-local-provider-registration.js.map +1 -0
  121. package/dist/esm/project-config/provider-catalog-types.d.ts +12 -0
  122. package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -0
  123. package/dist/esm/project-config/provider-catalog-types.js +49 -0
  124. package/dist/esm/project-config/provider-catalog-types.js.map +1 -0
  125. package/dist/esm/project-config/provider-companion-discovery.d.ts +24 -0
  126. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -0
  127. package/dist/esm/project-config/provider-companion-discovery.js +244 -0
  128. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -0
  129. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +297 -0
  130. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -0
  131. package/dist/esm/project-config/provider-runtime-artifacts.js +860 -0
  132. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -0
  133. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts +18 -0
  134. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -0
  135. package/dist/esm/project-config/shared/application-creation-verification.schemas.js +25 -0
  136. package/dist/esm/project-config/shared/application-creation-verification.schemas.js.map +1 -0
  137. package/dist/esm/project-config/shared/application-modules.schemas.d.ts +10 -2
  138. package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
  139. package/dist/esm/project-config/shared/application-modules.schemas.js +12 -1
  140. package/dist/esm/project-config/shared/application-modules.schemas.js.map +1 -1
  141. package/dist/esm/project-config/shared/application-modules.utils.d.ts +2 -1
  142. package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
  143. package/dist/esm/project-config/shared/application-modules.utils.js +6 -1
  144. package/dist/esm/project-config/shared/application-modules.utils.js.map +1 -1
  145. package/dist/esm/project-config/shared/auth.schemas.d.ts +102 -0
  146. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -0
  147. package/dist/esm/project-config/shared/auth.schemas.js +100 -0
  148. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -0
  149. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +316 -39
  150. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  151. package/dist/esm/project-config/shared/backing-services.schemas.js +359 -24
  152. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  153. package/dist/esm/project-config/shared/cdn.example.d.ts +14 -0
  154. package/dist/esm/project-config/shared/cdn.example.d.ts.map +1 -0
  155. package/dist/esm/project-config/shared/cdn.example.js +38 -0
  156. package/dist/esm/project-config/shared/cdn.example.js.map +1 -0
  157. package/dist/esm/project-config/shared/cdn.schemas.d.ts +182 -0
  158. package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -0
  159. package/dist/esm/project-config/shared/cdn.schemas.js +151 -0
  160. package/dist/esm/project-config/shared/cdn.schemas.js.map +1 -0
  161. package/dist/esm/project-config/shared/csp-defaults.d.ts +92 -0
  162. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -0
  163. package/dist/esm/project-config/shared/csp-defaults.js +195 -0
  164. package/dist/esm/project-config/shared/csp-defaults.js.map +1 -0
  165. package/dist/esm/project-config/shared/csp-emit.d.ts +106 -0
  166. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -0
  167. package/dist/esm/project-config/shared/csp-emit.js +305 -0
  168. package/dist/esm/project-config/shared/csp-emit.js.map +1 -0
  169. package/dist/esm/project-config/shared/csp.schemas.d.ts +266 -0
  170. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -0
  171. package/dist/esm/project-config/shared/csp.schemas.js +281 -0
  172. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -0
  173. package/dist/esm/project-config/shared/data-services.schemas.d.ts +45 -9
  174. package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
  175. package/dist/esm/project-config/shared/data-services.schemas.js +45 -9
  176. package/dist/esm/project-config/shared/data-services.schemas.js.map +1 -1
  177. package/dist/esm/project-config/shared/env-example-defaults.d.ts +0 -1
  178. package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
  179. package/dist/esm/project-config/shared/env-example-defaults.js +1 -2
  180. package/dist/esm/project-config/shared/env-example-defaults.js.map +1 -1
  181. package/dist/esm/project-config/shared/environment.schemas.d.ts +134 -8
  182. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  183. package/dist/esm/project-config/shared/environment.schemas.js +185 -2
  184. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  185. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +779 -0
  186. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -0
  187. package/dist/esm/project-config/shared/infra-providers.schemas.js +210 -0
  188. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -0
  189. package/dist/esm/project-config/shared/infra-service.schemas.d.ts +18 -0
  190. package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -0
  191. package/dist/esm/project-config/shared/infra-service.schemas.js +16 -0
  192. package/dist/esm/project-config/shared/infra-service.schemas.js.map +1 -0
  193. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +83 -1
  194. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  195. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +99 -2
  196. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  197. package/dist/esm/project-config/shared/k8s-utils.d.ts +51 -7
  198. package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
  199. package/dist/esm/project-config/shared/k8s-utils.js +59 -12
  200. package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
  201. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts +31 -0
  202. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -0
  203. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js +32 -0
  204. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -0
  205. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +142 -0
  206. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -0
  207. package/dist/esm/project-config/shared/minion-resource-access.validation.js +159 -0
  208. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -0
  209. package/dist/esm/project-config/shared/object-storage-session-policy.d.ts +100 -0
  210. package/dist/esm/project-config/shared/object-storage-session-policy.d.ts.map +1 -0
  211. package/dist/esm/project-config/shared/object-storage-session-policy.js +130 -0
  212. package/dist/esm/project-config/shared/object-storage-session-policy.js.map +1 -0
  213. package/dist/esm/project-config/shared/platform-services.schemas.d.ts +9 -14
  214. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  215. package/dist/esm/project-config/shared/platform-services.schemas.js +13 -9
  216. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  217. package/dist/esm/project-config/shared/schema-version.schemas.d.ts +15 -0
  218. package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +1 -0
  219. package/dist/esm/project-config/shared/schema-version.schemas.js +40 -0
  220. package/dist/esm/project-config/shared/schema-version.schemas.js.map +1 -0
  221. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts +283 -8
  222. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
  223. package/dist/esm/project-config/shared/service-definitions.schemas.js +325 -8
  224. package/dist/esm/project-config/shared/service-definitions.schemas.js.map +1 -1
  225. package/dist/esm/registry/artifact-domain.schemas.d.ts +54 -0
  226. package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -0
  227. package/dist/esm/registry/artifact-domain.schemas.js +40 -0
  228. package/dist/esm/registry/artifact-domain.schemas.js.map +1 -0
  229. package/dist/esm/registry/companion-api.schemas.d.ts +176 -0
  230. package/dist/esm/registry/companion-api.schemas.d.ts.map +1 -0
  231. package/dist/esm/registry/companion-api.schemas.js +165 -0
  232. package/dist/esm/registry/companion-api.schemas.js.map +1 -0
  233. package/dist/esm/registry/digest.schemas.d.ts +20 -0
  234. package/dist/esm/registry/digest.schemas.d.ts.map +1 -0
  235. package/dist/esm/registry/digest.schemas.js +21 -0
  236. package/dist/esm/registry/digest.schemas.js.map +1 -0
  237. package/dist/esm/registry/index.d.ts +33 -0
  238. package/dist/esm/registry/index.d.ts.map +1 -0
  239. package/dist/esm/registry/index.js +33 -0
  240. package/dist/esm/registry/index.js.map +1 -0
  241. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +107 -0
  242. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -0
  243. package/dist/esm/registry/lockfile-modules-section.schemas.js +67 -0
  244. package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -0
  245. package/dist/esm/registry/module-artifact.schemas.d.ts +94 -0
  246. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -0
  247. package/dist/esm/registry/module-artifact.schemas.js +69 -0
  248. package/dist/esm/registry/module-artifact.schemas.js.map +1 -0
  249. package/dist/esm/registry/module-manifest.schemas.d.ts +134 -0
  250. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -0
  251. package/dist/esm/registry/module-manifest.schemas.js +155 -0
  252. package/dist/esm/registry/module-manifest.schemas.js.map +1 -0
  253. package/dist/esm/registry/registry-config.schemas.d.ts +31 -0
  254. package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -0
  255. package/dist/esm/registry/registry-config.schemas.js +24 -0
  256. package/dist/esm/registry/registry-config.schemas.js.map +1 -0
  257. package/dist/esm/registry/registry-defaults.constants.d.ts +37 -0
  258. package/dist/esm/registry/registry-defaults.constants.d.ts.map +1 -0
  259. package/dist/esm/registry/registry-defaults.constants.js +37 -0
  260. package/dist/esm/registry/registry-defaults.constants.js.map +1 -0
  261. package/dist/esm/registry/registry-errors.d.ts +109 -0
  262. package/dist/esm/registry/registry-errors.d.ts.map +1 -0
  263. package/dist/esm/registry/registry-errors.js +185 -0
  264. package/dist/esm/registry/registry-errors.js.map +1 -0
  265. package/dist/esm/registry/registry-section-schemas.constants.d.ts +39 -0
  266. package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -0
  267. package/dist/esm/registry/registry-section-schemas.constants.js +22 -0
  268. package/dist/esm/registry/registry-section-schemas.constants.js.map +1 -0
  269. package/dist/esm/release/framework-release.constants.d.ts +26 -1
  270. package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
  271. package/dist/esm/release/framework-release.constants.js +27 -2
  272. package/dist/esm/release/framework-release.constants.js.map +1 -1
  273. package/dist/esm/schemas/framework-info.schemas.d.ts +1 -1
  274. package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
  275. package/dist/esm/schemas/framework-info.schemas.js +1 -1
  276. package/dist/esm/schemas/framework-info.schemas.js.map +1 -1
  277. package/dist/esm/schemas/framework-secrets.schemas.d.ts +5 -5
  278. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  279. package/dist/esm/schemas/framework-secrets.schemas.js +1 -1
  280. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  281. package/dist/esm/schemas/platform-application-config.schemas.d.ts +1 -1
  282. package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
  283. package/dist/esm/schemas/platform-application-config.schemas.js +11 -2
  284. package/dist/esm/schemas/platform-application-config.schemas.js.map +1 -1
  285. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts +7 -7
  286. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
  287. package/dist/esm/schemas/platform-application-secrets.schemas.js +17 -2
  288. package/dist/esm/schemas/platform-application-secrets.schemas.js.map +1 -1
  289. package/dist/esm/schemas/platform-config.schemas.d.ts +12 -13
  290. package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
  291. package/dist/esm/schemas/platform-config.schemas.js +15 -3
  292. package/dist/esm/schemas/platform-config.schemas.js.map +1 -1
  293. package/dist/esm/workspace-scope/application-subject-manifest.d.ts +26 -0
  294. package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -0
  295. package/dist/esm/workspace-scope/application-subject-manifest.js +43 -0
  296. package/dist/esm/workspace-scope/application-subject-manifest.js.map +1 -0
  297. package/dist/esm/workspace-scope/index.d.ts +5 -2
  298. package/dist/esm/workspace-scope/index.d.ts.map +1 -1
  299. package/dist/esm/workspace-scope/index.js +4 -1
  300. package/dist/esm/workspace-scope/index.js.map +1 -1
  301. package/dist/esm/workspace-scope/resolve-homes.d.ts +20 -0
  302. package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -0
  303. package/dist/esm/workspace-scope/resolve-homes.js +62 -0
  304. package/dist/esm/workspace-scope/resolve-homes.js.map +1 -0
  305. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +211 -0
  306. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -0
  307. package/dist/esm/workspace-scope/workspace-homes.schemas.js +113 -0
  308. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -0
  309. package/dist/esm/workspace-scope/workspace-scope-detector.d.ts +10 -5
  310. package/dist/esm/workspace-scope/workspace-scope-detector.d.ts.map +1 -1
  311. package/dist/esm/workspace-scope/workspace-scope-detector.js +22 -36
  312. package/dist/esm/workspace-scope/workspace-scope-detector.js.map +1 -1
  313. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts +147 -58
  314. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  315. package/dist/esm/workspace-scope/workspace-scope.schemas.js +174 -78
  316. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  317. package/dist/tsconfig.build.tsbuildinfo +1 -1
  318. package/package.json +31 -17
  319. package/dist/esm/credentials/credentials-provisioner.service.d.ts +0 -190
  320. package/dist/esm/credentials/credentials-provisioner.service.d.ts.map +0 -1
  321. package/dist/esm/credentials/credentials-provisioner.service.js +0 -278
  322. package/dist/esm/credentials/credentials-provisioner.service.js.map +0 -1
  323. package/dist/esm/infra-managers/infra-manager.models.d.ts +0 -146
  324. package/dist/esm/infra-managers/infra-manager.models.d.ts.map +0 -1
  325. package/dist/esm/infra-managers/infra-manager.models.js +0 -2
  326. package/dist/esm/infra-managers/infra-manager.models.js.map +0 -1
  327. package/dist/esm/infra-managers/mongo-atlas-manager.service.d.ts +0 -64
  328. package/dist/esm/infra-managers/mongo-atlas-manager.service.d.ts.map +0 -1
  329. package/dist/esm/infra-managers/mongo-atlas-manager.service.js +0 -307
  330. package/dist/esm/infra-managers/mongo-atlas-manager.service.js.map +0 -1
  331. package/dist/esm/infra-managers/postgresql-manager.service.d.ts +0 -115
  332. package/dist/esm/infra-managers/postgresql-manager.service.d.ts.map +0 -1
  333. package/dist/esm/infra-managers/postgresql-manager.service.js +0 -403
  334. package/dist/esm/infra-managers/postgresql-manager.service.js.map +0 -1
  335. package/dist/esm/infra-managers/rabbitmq-manager.service.d.ts +0 -64
  336. package/dist/esm/infra-managers/rabbitmq-manager.service.d.ts.map +0 -1
  337. package/dist/esm/infra-managers/rabbitmq-manager.service.js +0 -288
  338. package/dist/esm/infra-managers/rabbitmq-manager.service.js.map +0 -1
  339. package/dist/esm/infra-managers/redis-manager.service.d.ts +0 -78
  340. package/dist/esm/infra-managers/redis-manager.service.d.ts.map +0 -1
  341. package/dist/esm/infra-managers/redis-manager.service.js +0 -326
  342. package/dist/esm/infra-managers/redis-manager.service.js.map +0 -1
  343. package/dist/esm/project-config/define-infra-config.d.ts +0 -128
  344. package/dist/esm/project-config/define-infra-config.d.ts.map +0 -1
  345. package/dist/esm/project-config/define-infra-config.js +0 -87
  346. package/dist/esm/project-config/define-infra-config.js.map +0 -1
  347. package/dist/esm/project-config/define-platform-config.d.ts +0 -65
  348. package/dist/esm/project-config/define-platform-config.d.ts.map +0 -1
  349. package/dist/esm/project-config/define-platform-config.js +0 -22
  350. package/dist/esm/project-config/define-platform-config.js.map +0 -1
  351. package/dist/esm/project-config/define-platform-env-config.d.ts +0 -41
  352. package/dist/esm/project-config/define-platform-env-config.d.ts.map +0 -1
  353. package/dist/esm/project-config/define-platform-env-config.js +0 -45
  354. package/dist/esm/project-config/define-platform-env-config.js.map +0 -1
  355. package/dist/esm/project-config/define-project-config.d.ts +0 -38
  356. package/dist/esm/project-config/define-project-config.d.ts.map +0 -1
  357. package/dist/esm/project-config/define-project-config.js +0 -57
  358. package/dist/esm/project-config/define-project-config.js.map +0 -1
  359. package/dist/esm/project-config/define-sharing-policy.d.ts +0 -35
  360. package/dist/esm/project-config/define-sharing-policy.d.ts.map +0 -1
  361. package/dist/esm/project-config/define-sharing-policy.js +0 -30
  362. package/dist/esm/project-config/define-sharing-policy.js.map +0 -1
  363. package/dist/esm/project-config/sharing-policy-validation.d.ts +0 -40
  364. package/dist/esm/project-config/sharing-policy-validation.d.ts.map +0 -1
  365. package/dist/esm/project-config/sharing-policy-validation.js +0 -143
  366. package/dist/esm/project-config/sharing-policy-validation.js.map +0 -1
  367. package/dist/esm/runtime-bridge/platform-runtime-bridge.contracts.d.ts +0 -23
  368. package/dist/esm/runtime-bridge/platform-runtime-bridge.contracts.d.ts.map +0 -1
  369. package/dist/esm/runtime-bridge/platform-runtime-bridge.contracts.js +0 -13
  370. package/dist/esm/runtime-bridge/platform-runtime-bridge.contracts.js.map +0 -1
  371. package/src/bootstrap/application-backend-env.contracts.ts +0 -17
  372. package/src/bootstrap/bootstrap-planner.ts +0 -46
  373. package/src/bootstrap/bootstrap.contracts.ts +0 -251
  374. package/src/bootstrap/bootstrap.schemas.ts +0 -164
  375. package/src/bootstrap/platform-runtime-env.contracts.ts +0 -99
  376. package/src/bootstrap/runtime-topology.contracts.ts +0 -102
  377. package/src/credentials/credential-generator.service.ts +0 -39
  378. package/src/index.ts +0 -16
  379. package/src/project-config/__tests__/application-modules.utils.test.ts +0 -53
  380. package/src/project-config/__tests__/define-framework-config.test.ts +0 -43
  381. package/src/project-config/__tests__/define-saas-config.test.ts +0 -210
  382. package/src/project-config/__tests__/loader.test.ts +0 -100
  383. package/src/project-config/define-framework-config.ts +0 -44
  384. package/src/project-config/define-infra-config.ts +0 -168
  385. package/src/project-config/define-minion-config.ts +0 -27
  386. package/src/project-config/define-platform-config.ts +0 -28
  387. package/src/project-config/define-platform-env-config.ts +0 -59
  388. package/src/project-config/define-project-config.ts +0 -63
  389. package/src/project-config/define-saas-config.ts +0 -171
  390. package/src/project-config/define-sharing-policy.ts +0 -36
  391. package/src/project-config/define-worker-config.ts +0 -27
  392. package/src/project-config/index.ts +0 -23
  393. package/src/project-config/loader.ts +0 -220
  394. package/src/project-config/shared/application-modules.schemas.ts +0 -12
  395. package/src/project-config/shared/application-modules.utils.ts +0 -65
  396. package/src/project-config/shared/backing-services.schemas.ts +0 -59
  397. package/src/project-config/shared/data-services.schemas.ts +0 -58
  398. package/src/project-config/shared/env-example-defaults.ts +0 -50
  399. package/src/project-config/shared/environment.schemas.ts +0 -136
  400. package/src/project-config/shared/infrastructure-defaults.schemas.ts +0 -47
  401. package/src/project-config/shared/k8s-utils.ts +0 -56
  402. package/src/project-config/shared/platform-services.schemas.ts +0 -33
  403. package/src/project-config/shared/service-definitions.schemas.ts +0 -38
  404. package/src/project-config/sharing-policy-validation.ts +0 -159
  405. package/src/release/framework-release.constants.ts +0 -2
  406. package/src/schemas/__tests__/platform-config.schemas.test.ts +0 -90
  407. package/src/schemas/framework-info.schemas.ts +0 -13
  408. package/src/schemas/framework-secrets.schemas.ts +0 -19
  409. package/src/schemas/platform-application-config.schemas.ts +0 -25
  410. package/src/schemas/platform-application-secrets.schemas.ts +0 -78
  411. package/src/schemas/platform-config.schemas.ts +0 -45
  412. package/src/workspace-scope/index.ts +0 -2
  413. package/src/workspace-scope/workspace-scope-detector.ts +0 -98
  414. package/src/workspace-scope/workspace-scope.schemas.ts +0 -224
@@ -0,0 +1,67 @@
1
+ import { type ApplicationRuntimePrincipal } from './runtime-principal.contracts';
2
+ import { MinionPlatformAccessScope } from '../project-config/shared/minion-platform-access.vocabulary';
3
+ /**
4
+ * The PLATFORM-ACCESS axis (Step 3 / R4 / R5) — a minion reading its own
5
+ * platform-level records, today its cron/schedule entries.
6
+ *
7
+ * ## Why this is a SECOND axis and not part of `resourceAccess`
8
+ *
9
+ * `resourceAccess` answers "which of the APPLICATION's resources may this minion
10
+ * touch?". This answers "may it see the PLATFORM's record OF ITSELF?" — a
11
+ * different subject, a different store, and a different blast radius. R5 requires
12
+ * the two be separately declarable with neither implying the other, so nothing
13
+ * here consults `resourceAccess` and nothing there consults this.
14
+ *
15
+ * A minion that declares data access but no platform access is a normal shape
16
+ * (it works on todos, never inspects its own schedule). So is the reverse (a
17
+ * health-reporting minion that reads its tick history and touches no app data).
18
+ */
19
+ /** The authored declaration — optional, and absent means none. */
20
+ export interface MinionPlatformAccessDeclaration {
21
+ readonly scopes?: readonly MinionPlatformAccessScope[];
22
+ }
23
+ /**
24
+ * A filter that can ONLY ever address the caller's own records.
25
+ *
26
+ * ## Scoped-to-self BY SHAPE, which is the whole point of R4
27
+ *
28
+ * The obvious implementation takes a minion NAME and refuses when it does not
29
+ * match the caller. That is scoped-to-self by CHECK, and it fails the way every
30
+ * check fails: someone adds an admin path, or an internal caller passes the name
31
+ * it was given, and the refusal is one conditional away from gone.
32
+ *
33
+ * This takes **no target parameter at all**. The subject is derived from the
34
+ * PRINCIPAL, so "read minion B's schedule" is not a request that gets refused —
35
+ * it is a request that cannot be expressed. A future caller wanting cross-minion
36
+ * reads must add a new function, which is a reviewable act, rather than passing a
37
+ * different string to this one, which is not.
38
+ *
39
+ * Returns `null` when the principal may not read platform records at all, so the
40
+ * caller has nothing to query WITH — the same fail-closed shape as
41
+ * `deriveMinionResourceGrants` returning `null`.
42
+ *
43
+ * ## ⚠️ PRECONDITION: `principal` must be VERIFIED, not self-asserted
44
+ *
45
+ * The by-shape property above is real and it is CONDITIONAL. This function makes a
46
+ * cross-minion read inexpressible *given a trustworthy principal* — it says
47
+ * nothing about where the principal came from, and a caller that accepts a
48
+ * self-asserted one has a hole this signature cannot close.
49
+ *
50
+ * That is not hypothetical. A minion is delivered the application's
51
+ * `APPLICATION_PLATFORM_REQUEST` **private** key: the delivery projection strips
52
+ * per-app CREDENTIAL paths (`database.*`) and the JWT material is not among them,
53
+ * so it survives in the base blob. A minion can therefore sign a token naming a
54
+ * sibling minion or the application backend, and a by-shape endpoint would
55
+ * satisfy "no selector exists" while still failing R4's acceptance criterion.
56
+ *
57
+ * So a caller MUST obtain the principal from a party that learns it from the
58
+ * secret PRESENTED rather than one asserted in a claim — today that is
59
+ * apps-manager, which resolves it by matching the presenting secret against the
60
+ * minted per-principal set. Found by the `Minion Scope` session while building the
61
+ * transport for this axis; recorded here because the precondition belongs with the
62
+ * contract, not only in the transport that happens to satisfy it.
63
+ */
64
+ export declare function buildOwnCronRecordFilter(principal: ApplicationRuntimePrincipal | undefined, declaration: MinionPlatformAccessDeclaration | undefined): {
65
+ readonly minionName: string;
66
+ } | null;
67
+ //# sourceMappingURL=runtime-platform-access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-platform-access.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-platform-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAGlH,OAAO,EAAE,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AAEvG;;;;;;;;;;;;;;;GAeG;AAGH,kEAAkE;AAClE,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,yBAAyB,EAAE,CAAC;CACxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,2BAA2B,GAAG,SAAS,EAClD,WAAW,EAAE,+BAA+B,GAAG,SAAS,GACvD;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQxC"}
@@ -0,0 +1,57 @@
1
+ import { ApplicationRuntimePrincipalKind } from './runtime-principal.contracts.js';
2
+ // Declared under `project-config` so an authored config can NAME it — see that
3
+ // file for why the authoring entry cannot reach `bootstrap/`.
4
+ import { MinionPlatformAccessScope } from '../project-config/shared/minion-platform-access.vocabulary.js';
5
+ /**
6
+ * A filter that can ONLY ever address the caller's own records.
7
+ *
8
+ * ## Scoped-to-self BY SHAPE, which is the whole point of R4
9
+ *
10
+ * The obvious implementation takes a minion NAME and refuses when it does not
11
+ * match the caller. That is scoped-to-self by CHECK, and it fails the way every
12
+ * check fails: someone adds an admin path, or an internal caller passes the name
13
+ * it was given, and the refusal is one conditional away from gone.
14
+ *
15
+ * This takes **no target parameter at all**. The subject is derived from the
16
+ * PRINCIPAL, so "read minion B's schedule" is not a request that gets refused —
17
+ * it is a request that cannot be expressed. A future caller wanting cross-minion
18
+ * reads must add a new function, which is a reviewable act, rather than passing a
19
+ * different string to this one, which is not.
20
+ *
21
+ * Returns `null` when the principal may not read platform records at all, so the
22
+ * caller has nothing to query WITH — the same fail-closed shape as
23
+ * `deriveMinionResourceGrants` returning `null`.
24
+ *
25
+ * ## ⚠️ PRECONDITION: `principal` must be VERIFIED, not self-asserted
26
+ *
27
+ * The by-shape property above is real and it is CONDITIONAL. This function makes a
28
+ * cross-minion read inexpressible *given a trustworthy principal* — it says
29
+ * nothing about where the principal came from, and a caller that accepts a
30
+ * self-asserted one has a hole this signature cannot close.
31
+ *
32
+ * That is not hypothetical. A minion is delivered the application's
33
+ * `APPLICATION_PLATFORM_REQUEST` **private** key: the delivery projection strips
34
+ * per-app CREDENTIAL paths (`database.*`) and the JWT material is not among them,
35
+ * so it survives in the base blob. A minion can therefore sign a token naming a
36
+ * sibling minion or the application backend, and a by-shape endpoint would
37
+ * satisfy "no selector exists" while still failing R4's acceptance criterion.
38
+ *
39
+ * So a caller MUST obtain the principal from a party that learns it from the
40
+ * secret PRESENTED rather than one asserted in a claim — today that is
41
+ * apps-manager, which resolves it by matching the presenting secret against the
42
+ * minted per-principal set. Found by the `Minion Scope` session while building the
43
+ * transport for this axis; recorded here because the precondition belongs with the
44
+ * contract, not only in the transport that happens to satisfy it.
45
+ */
46
+ export function buildOwnCronRecordFilter(principal, declaration) {
47
+ // Only a MINION has cron records of its own. The application backend reads
48
+ // schedules through its own authority, and a worker has none — so neither is a
49
+ // subject here, and granting them a filter would invent a record that has no
50
+ // referent.
51
+ if (principal?.kind !== ApplicationRuntimePrincipalKind.MINION || !principal.name)
52
+ return null;
53
+ if (!declaration?.scopes?.includes(MinionPlatformAccessScope.OWN_CRON_RECORDS))
54
+ return null;
55
+ return { minionName: principal.name };
56
+ }
57
+ //# sourceMappingURL=runtime-platform-access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-platform-access.js","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-platform-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAoC,MAAM,+BAA+B,CAAC;AAClH,+EAA+E;AAC/E,8DAA8D;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AAyBvG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,UAAU,wBAAwB,CACtC,SAAkD,EAClD,WAAwD;IAExD,2EAA2E;IAC3E,+EAA+E;IAC/E,6EAA6E;IAC7E,YAAY;IACZ,IAAI,SAAS,EAAE,IAAI,KAAK,+BAA+B,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/F,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,yBAAyB,CAAC,gBAAgB,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5F,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;AACxC,CAAC","sourcesContent":["import { ApplicationRuntimePrincipalKind, type ApplicationRuntimePrincipal } from './runtime-principal.contracts';\n// Declared under `project-config` so an authored config can NAME it — see that\n// file for why the authoring entry cannot reach `bootstrap/`.\nimport { MinionPlatformAccessScope } from '../project-config/shared/minion-platform-access.vocabulary';\n\n/**\n * The PLATFORM-ACCESS axis (Step 3 / R4 / R5) — a minion reading its own\n * platform-level records, today its cron/schedule entries.\n *\n * ## Why this is a SECOND axis and not part of `resourceAccess`\n *\n * `resourceAccess` answers \"which of the APPLICATION's resources may this minion\n * touch?\". This answers \"may it see the PLATFORM's record OF ITSELF?\" — a\n * different subject, a different store, and a different blast radius. R5 requires\n * the two be separately declarable with neither implying the other, so nothing\n * here consults `resourceAccess` and nothing there consults this.\n *\n * A minion that declares data access but no platform access is a normal shape\n * (it works on todos, never inspects its own schedule). So is the reverse (a\n * health-reporting minion that reads its tick history and touches no app data).\n */\n\n\n/** The authored declaration — optional, and absent means none. */\nexport interface MinionPlatformAccessDeclaration {\n readonly scopes?: readonly MinionPlatformAccessScope[];\n}\n\n/**\n * A filter that can ONLY ever address the caller's own records.\n *\n * ## Scoped-to-self BY SHAPE, which is the whole point of R4\n *\n * The obvious implementation takes a minion NAME and refuses when it does not\n * match the caller. That is scoped-to-self by CHECK, and it fails the way every\n * check fails: someone adds an admin path, or an internal caller passes the name\n * it was given, and the refusal is one conditional away from gone.\n *\n * This takes **no target parameter at all**. The subject is derived from the\n * PRINCIPAL, so \"read minion B's schedule\" is not a request that gets refused —\n * it is a request that cannot be expressed. A future caller wanting cross-minion\n * reads must add a new function, which is a reviewable act, rather than passing a\n * different string to this one, which is not.\n *\n * Returns `null` when the principal may not read platform records at all, so the\n * caller has nothing to query WITH — the same fail-closed shape as\n * `deriveMinionResourceGrants` returning `null`.\n *\n * ## ⚠️ PRECONDITION: `principal` must be VERIFIED, not self-asserted\n *\n * The by-shape property above is real and it is CONDITIONAL. This function makes a\n * cross-minion read inexpressible *given a trustworthy principal* — it says\n * nothing about where the principal came from, and a caller that accepts a\n * self-asserted one has a hole this signature cannot close.\n *\n * That is not hypothetical. A minion is delivered the application's\n * `APPLICATION_PLATFORM_REQUEST` **private** key: the delivery projection strips\n * per-app CREDENTIAL paths (`database.*`) and the JWT material is not among them,\n * so it survives in the base blob. A minion can therefore sign a token naming a\n * sibling minion or the application backend, and a by-shape endpoint would\n * satisfy \"no selector exists\" while still failing R4's acceptance criterion.\n *\n * So a caller MUST obtain the principal from a party that learns it from the\n * secret PRESENTED rather than one asserted in a claim — today that is\n * apps-manager, which resolves it by matching the presenting secret against the\n * minted per-principal set. Found by the `Minion Scope` session while building the\n * transport for this axis; recorded here because the precondition belongs with the\n * contract, not only in the transport that happens to satisfy it.\n */\nexport function buildOwnCronRecordFilter(\n principal: ApplicationRuntimePrincipal | undefined,\n declaration: MinionPlatformAccessDeclaration | undefined,\n): { readonly minionName: string } | null {\n // Only a MINION has cron records of its own. The application backend reads\n // schedules through its own authority, and a worker has none — so neither is a\n // subject here, and granting them a filter would invent a record that has no\n // referent.\n if (principal?.kind !== ApplicationRuntimePrincipalKind.MINION || !principal.name) return null;\n if (!declaration?.scopes?.includes(MinionPlatformAccessScope.OWN_CRON_RECORDS)) return null;\n return { minionName: principal.name };\n}\n"]}
@@ -0,0 +1,173 @@
1
+ import { BackgroundRuntimeType } from '@wildo-ai/saas-models';
2
+ /**
3
+ * WHOSE credentials are these? — the credential-principal axis.
4
+ *
5
+ * Wildo now has three runtime-identity vocabularies and they answer three
6
+ * different questions. They are deliberately NOT collapsed, even where their
7
+ * members currently coincide:
8
+ *
9
+ * - `BackgroundRuntimeType` (`MINION | WORKER`) — *what kind of deployable is
10
+ * this?* A compose service, a K8s workload, a provider-runtime scope. It has
11
+ * no application-backend member because the backend is not a background
12
+ * runtime.
13
+ * - `ApplicationRuntimeProfile` (`APPLICATION_BACKEND | MINION`) — *does this
14
+ * boot assertion apply to me?* Inside a single process. It has no worker
15
+ * member because workers never boot that lifecycle.
16
+ * - **This enum** (`APPLICATION_BACKEND | MINION | WORKER`) — *which principal
17
+ * is authenticating, and whose secrets may it receive?* It is the only one of
18
+ * the three that spans every runtime capable of presenting a credential, which
19
+ * is exactly why it cannot be expressed as either neighbour.
20
+ *
21
+ * Merging any pair would be convenient and wrong: a future runtime that boots no
22
+ * lifecycle but does hold credentials (or the reverse) would silently inherit a
23
+ * decision made for a different question.
24
+ *
25
+ * @see BackgroundRuntimeType — the deployable-kind axis this maps FROM
26
+ */
27
+ export declare enum ApplicationRuntimePrincipalKind {
28
+ /**
29
+ * The application's own backend service. Historically the ONLY principal:
30
+ * before per-runtime identity, one `primarySecret` per application was held
31
+ * identically by the backend and by every minion and worker, so at the
32
+ * apps-manager door they were indistinguishable.
33
+ */
34
+ APPLICATION_BACKEND = "application_backend",
35
+ MINION = "minion",
36
+ WORKER = "worker"
37
+ }
38
+ /**
39
+ * Map a deployable background-runtime kind onto its credential principal.
40
+ *
41
+ * The one place the two vocabularies meet. Keeping the translation in a single
42
+ * exhaustive switch means adding a member to `BackgroundRuntimeType` is a
43
+ * COMPILE error here rather than a silent gap at whichever call site happened to
44
+ * assume a mapping.
45
+ */
46
+ export declare function principalKindForBackgroundRuntime(runtimeType: BackgroundRuntimeType): ApplicationRuntimePrincipalKind;
47
+ /**
48
+ * A runtime principal's stable identity within one application.
49
+ *
50
+ * `name` is the `wildo.saas.config.ts` bucket key (`marketingScrapper`,
51
+ * `myNodeWorker`) — the SAME identity axis the deploy path already carries as
52
+ * `wildo.ai/owned-service-name` and `APP_OWNED_SERVICE_NAME`. Reusing the bucket
53
+ * key rather than the `serviceName` matters: the bucket key is what the
54
+ * declaration, the config lookup and the pod label all agree on, while
55
+ * `serviceName` is a rendering concern that is normalised for DNS.
56
+ *
57
+ * The backend principal carries no name — an application has exactly one, so a
58
+ * name would be a second way to say `APPLICATION_BACKEND`.
59
+ */
60
+ export interface ApplicationRuntimePrincipal {
61
+ kind: ApplicationRuntimePrincipalKind;
62
+ /** Absent for {@link ApplicationRuntimePrincipalKind.APPLICATION_BACKEND}. */
63
+ name?: string | undefined;
64
+ }
65
+ /** The canonical backend principal — one per application, by definition. */
66
+ export declare const APPLICATION_BACKEND_PRINCIPAL: ApplicationRuntimePrincipal;
67
+ /**
68
+ * Render a principal as a single stable string.
69
+ *
70
+ * Used as the stored key for a principal's secret, as the URL segment when the
71
+ * CLI asks for a named principal's bootstrap credentials, and in log/audit
72
+ * fields. ONE renderer so those three never drift into three spellings of the
73
+ * same identity.
74
+ *
75
+ * `:` is the separator because neither half can contain it — the kinds are a
76
+ * closed enum, and a bucket key is a TypeScript object key in
77
+ * `wildo.saas.config.ts`. {@link parseRuntimePrincipalKey} rejects anything that
78
+ * does not round-trip, so a key that ever gains a colon fails loudly at the
79
+ * boundary rather than resolving to the wrong principal.
80
+ */
81
+ export declare function buildRuntimePrincipalKey(principal: ApplicationRuntimePrincipal): string;
82
+ /**
83
+ * Inverse of {@link buildRuntimePrincipalKey}. Returns `null` for anything
84
+ * malformed — an unknown kind, a missing name on a named kind, or a name
85
+ * containing the separator.
86
+ *
87
+ * Fail-closed by returning `null` rather than throwing OR guessing: this parses
88
+ * values that reach the system from a URL segment and from stored rows, and a
89
+ * lenient parse there is how one principal's key resolves to another's secret.
90
+ */
91
+ export declare function parseRuntimePrincipalKey(key: string): ApplicationRuntimePrincipal | null;
92
+ /**
93
+ * Every principal an application declares: its backend, plus one per declared
94
+ * minion and worker.
95
+ *
96
+ * Derived from the managed declaration — the same input the config seed already
97
+ * consumes — so the credential set and the deployed runtime set cannot diverge.
98
+ * That is also what makes revocation fall out for free: a runtime removed from
99
+ * `wildo.saas.config.ts` simply stops appearing here, and the mint step prunes
100
+ * any stored secret whose key is no longer in this list (R15).
101
+ *
102
+ * The backend is ALWAYS included, including for an application that declares no
103
+ * minions and no workers — it is the principal that must never be absent.
104
+ */
105
+ export declare function enumerateDeclaredRuntimePrincipals(declaration: {
106
+ minions?: Record<string, unknown> | undefined;
107
+ workers?: Record<string, unknown> | undefined;
108
+ }): ApplicationRuntimePrincipal[];
109
+ /**
110
+ * The Redis key namespace a MINION owns (D20).
111
+ *
112
+ * `<appSlug>:minions:<name>:` — a strict extension of the application's own
113
+ * `<appSlug>:` prefix, which is what lets `RedisService` keep enforcing "an
114
+ * authored prefix must start with `<appSlug>:`" unchanged.
115
+ *
116
+ * ## One derivation, deliberately, because it is a COUPLED PAIR
117
+ *
118
+ * Two places consume this and they must agree exactly: the Redis ACL key pattern
119
+ * apps-manager grants the minion's user, and the `REDIS_KEY_PREFIX` the CLI
120
+ * writes into that minion's environment. If they disagree by even a character,
121
+ * every Redis operation the minion performs is DENIED — and the error names an
122
+ * ACL, not the mismatch, so nothing in the minion's own configuration explains
123
+ * it. Deriving both from this function is what makes that class of failure
124
+ * unrepresentable rather than merely unlikely.
125
+ *
126
+ * Based on `appSlug` rather than an authored `dataServices.redis.keyPrefix`
127
+ * because the ACL pattern already is (`RedisSelfInfraProviderModule`), and one
128
+ * inconsistency is better than two competing bases. An application that authors
129
+ * a custom prefix therefore has a PRE-EXISTING mismatch with its own ACL; that
130
+ * gap is older than per-principal credentials and is not narrowed here.
131
+ */
132
+ export declare function buildMinionRedisKeyPrefix(appSlug: string, minionName: string): string;
133
+ /**
134
+ * Map an `ApplicationRuntimeProfile` value onto the credential-principal axis.
135
+ *
136
+ * The two vocabularies are deliberately SEPARATE — a runtime profile answers
137
+ * "which declaration class am I?", a principal kind answers "whose credential do
138
+ * I hold?" — but their string values coincide today. A consumer that relies on
139
+ * that coincidence by comparing raw strings has made the coupling invisible; this
140
+ * function is where the crossing is allowed to happen, once.
141
+ *
142
+ * Fail-closed: an unrecognised profile returns `undefined` rather than a
143
+ * plausible default, because every caller uses the result to decide how narrowly
144
+ * a runtime is confined, and guessing there widens confinement silently.
145
+ */
146
+ export declare function runtimePrincipalKindFromRuntimeProfile(runtimeProfile: string | undefined): ApplicationRuntimePrincipalKind | undefined;
147
+ /**
148
+ * The principal segment embedded in a runtime's RPC reply-queue name.
149
+ *
150
+ * ## Why this exists — the same reason as {@link buildMinionRedisKeyPrefix}
151
+ *
152
+ * Two places consume this and they must agree EXACTLY: the broker permission
153
+ * pattern apps-manager grants a minion's user, and the reply-queue name the
154
+ * minion's own AMQP adapter declares and consumes. If they disagree by even a
155
+ * character the minion's every reply is refused with `403 ACCESS_REFUSED`, and
156
+ * the error names a permission rather than the mismatch — so nothing in the
157
+ * minion's own configuration explains it.
158
+ *
159
+ * It previously WAS derived twice: the adapter sanitised its runtime key while
160
+ * the permission builder escaped the raw minion name, coupled only by a comment
161
+ * saying the two "mirror" each other. They agreed for `marketingScrapper` and
162
+ * would have diverged for any name containing a character sanitisation rewrites
163
+ * (`marketing.scrapper` → `marketing-scrapper` on one side, `marketing.scrapper`
164
+ * on the other). A comment describing what the other side must do is not a site
165
+ * that upholds an invariant; deriving both from here makes the divergence
166
+ * unrepresentable instead of merely unlikely.
167
+ *
168
+ * Returns `undefined` for the APPLICATION BACKEND, which keeps the historical
169
+ * segment-less reply-queue layout — that is what stops a minion's permission
170
+ * from ever matching the backend's replies.
171
+ */
172
+ export declare function buildRuntimePrincipalQueueSegment(principalKind: ApplicationRuntimePrincipalKind | undefined, principalName: string | undefined): string | undefined;
173
+ //# sourceMappingURL=runtime-principal.contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-principal.contracts.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-principal.contracts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,oBAAY,+BAA+B;IACzC;;;;;OAKG;IACH,mBAAmB,wBAAwB;IAC3C,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,qBAAqB,GACjC,+BAA+B,CAOjC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,+BAA+B,CAAC;IACtC,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,4EAA4E;AAC5E,eAAO,MAAM,6BAA6B,EAAE,2BAE3C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,2BAA2B,GAAG,MAAM,CAIvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,2BAA2B,GAAG,IAAI,CAaxF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kCAAkC,CAAC,WAAW,EAAE;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC/C,GAAG,2BAA2B,EAAE,CAYhC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAErF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sCAAsC,CACpD,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,+BAA+B,GAAG,SAAS,CAW7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iCAAiC,CAC/C,aAAa,EAAE,+BAA+B,GAAG,SAAS,EAC1D,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,MAAM,GAAG,SAAS,CAQpB"}
@@ -0,0 +1,218 @@
1
+ // Root barrel, matching the sibling bootstrap files: `BackgroundRuntimeType`
2
+ // lives in the decorator-bound graph, not the browser-safe `/public-runtime`
3
+ // atom subset. This module is platform/CLI-side only and never reaches a
4
+ // browser bundle, so the root import costs nothing here.
5
+ import { BackgroundRuntimeType } from '@wildo-ai/saas-models';
6
+ /**
7
+ * WHOSE credentials are these? — the credential-principal axis.
8
+ *
9
+ * Wildo now has three runtime-identity vocabularies and they answer three
10
+ * different questions. They are deliberately NOT collapsed, even where their
11
+ * members currently coincide:
12
+ *
13
+ * - `BackgroundRuntimeType` (`MINION | WORKER`) — *what kind of deployable is
14
+ * this?* A compose service, a K8s workload, a provider-runtime scope. It has
15
+ * no application-backend member because the backend is not a background
16
+ * runtime.
17
+ * - `ApplicationRuntimeProfile` (`APPLICATION_BACKEND | MINION`) — *does this
18
+ * boot assertion apply to me?* Inside a single process. It has no worker
19
+ * member because workers never boot that lifecycle.
20
+ * - **This enum** (`APPLICATION_BACKEND | MINION | WORKER`) — *which principal
21
+ * is authenticating, and whose secrets may it receive?* It is the only one of
22
+ * the three that spans every runtime capable of presenting a credential, which
23
+ * is exactly why it cannot be expressed as either neighbour.
24
+ *
25
+ * Merging any pair would be convenient and wrong: a future runtime that boots no
26
+ * lifecycle but does hold credentials (or the reverse) would silently inherit a
27
+ * decision made for a different question.
28
+ *
29
+ * @see BackgroundRuntimeType — the deployable-kind axis this maps FROM
30
+ */
31
+ export var ApplicationRuntimePrincipalKind;
32
+ (function (ApplicationRuntimePrincipalKind) {
33
+ /**
34
+ * The application's own backend service. Historically the ONLY principal:
35
+ * before per-runtime identity, one `primarySecret` per application was held
36
+ * identically by the backend and by every minion and worker, so at the
37
+ * apps-manager door they were indistinguishable.
38
+ */
39
+ ApplicationRuntimePrincipalKind["APPLICATION_BACKEND"] = "application_backend";
40
+ ApplicationRuntimePrincipalKind["MINION"] = "minion";
41
+ ApplicationRuntimePrincipalKind["WORKER"] = "worker";
42
+ })(ApplicationRuntimePrincipalKind || (ApplicationRuntimePrincipalKind = {}));
43
+ /**
44
+ * Map a deployable background-runtime kind onto its credential principal.
45
+ *
46
+ * The one place the two vocabularies meet. Keeping the translation in a single
47
+ * exhaustive switch means adding a member to `BackgroundRuntimeType` is a
48
+ * COMPILE error here rather than a silent gap at whichever call site happened to
49
+ * assume a mapping.
50
+ */
51
+ export function principalKindForBackgroundRuntime(runtimeType) {
52
+ switch (runtimeType) {
53
+ case BackgroundRuntimeType.MINION:
54
+ return ApplicationRuntimePrincipalKind.MINION;
55
+ case BackgroundRuntimeType.WORKER:
56
+ return ApplicationRuntimePrincipalKind.WORKER;
57
+ }
58
+ }
59
+ /** The canonical backend principal — one per application, by definition. */
60
+ export const APPLICATION_BACKEND_PRINCIPAL = {
61
+ kind: ApplicationRuntimePrincipalKind.APPLICATION_BACKEND,
62
+ };
63
+ /**
64
+ * Render a principal as a single stable string.
65
+ *
66
+ * Used as the stored key for a principal's secret, as the URL segment when the
67
+ * CLI asks for a named principal's bootstrap credentials, and in log/audit
68
+ * fields. ONE renderer so those three never drift into three spellings of the
69
+ * same identity.
70
+ *
71
+ * `:` is the separator because neither half can contain it — the kinds are a
72
+ * closed enum, and a bucket key is a TypeScript object key in
73
+ * `wildo.saas.config.ts`. {@link parseRuntimePrincipalKey} rejects anything that
74
+ * does not round-trip, so a key that ever gains a colon fails loudly at the
75
+ * boundary rather than resolving to the wrong principal.
76
+ */
77
+ export function buildRuntimePrincipalKey(principal) {
78
+ return principal.kind === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND
79
+ ? ApplicationRuntimePrincipalKind.APPLICATION_BACKEND
80
+ : `${principal.kind}:${principal.name ?? ''}`;
81
+ }
82
+ /**
83
+ * Inverse of {@link buildRuntimePrincipalKey}. Returns `null` for anything
84
+ * malformed — an unknown kind, a missing name on a named kind, or a name
85
+ * containing the separator.
86
+ *
87
+ * Fail-closed by returning `null` rather than throwing OR guessing: this parses
88
+ * values that reach the system from a URL segment and from stored rows, and a
89
+ * lenient parse there is how one principal's key resolves to another's secret.
90
+ */
91
+ export function parseRuntimePrincipalKey(key) {
92
+ if (key === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND) {
93
+ return APPLICATION_BACKEND_PRINCIPAL;
94
+ }
95
+ const separatorIndex = key.indexOf(':');
96
+ if (separatorIndex <= 0)
97
+ return null;
98
+ const kind = key.slice(0, separatorIndex);
99
+ const name = key.slice(separatorIndex + 1);
100
+ if (name.length === 0 || name.includes(':'))
101
+ return null;
102
+ if (kind !== ApplicationRuntimePrincipalKind.MINION && kind !== ApplicationRuntimePrincipalKind.WORKER) {
103
+ return null;
104
+ }
105
+ return { kind, name };
106
+ }
107
+ /**
108
+ * Every principal an application declares: its backend, plus one per declared
109
+ * minion and worker.
110
+ *
111
+ * Derived from the managed declaration — the same input the config seed already
112
+ * consumes — so the credential set and the deployed runtime set cannot diverge.
113
+ * That is also what makes revocation fall out for free: a runtime removed from
114
+ * `wildo.saas.config.ts` simply stops appearing here, and the mint step prunes
115
+ * any stored secret whose key is no longer in this list (R15).
116
+ *
117
+ * The backend is ALWAYS included, including for an application that declares no
118
+ * minions and no workers — it is the principal that must never be absent.
119
+ */
120
+ export function enumerateDeclaredRuntimePrincipals(declaration) {
121
+ return [
122
+ APPLICATION_BACKEND_PRINCIPAL,
123
+ ...Object.keys(declaration.minions ?? {}).map((name) => ({
124
+ kind: ApplicationRuntimePrincipalKind.MINION,
125
+ name,
126
+ })),
127
+ ...Object.keys(declaration.workers ?? {}).map((name) => ({
128
+ kind: ApplicationRuntimePrincipalKind.WORKER,
129
+ name,
130
+ })),
131
+ ];
132
+ }
133
+ /**
134
+ * The Redis key namespace a MINION owns (D20).
135
+ *
136
+ * `<appSlug>:minions:<name>:` — a strict extension of the application's own
137
+ * `<appSlug>:` prefix, which is what lets `RedisService` keep enforcing "an
138
+ * authored prefix must start with `<appSlug>:`" unchanged.
139
+ *
140
+ * ## One derivation, deliberately, because it is a COUPLED PAIR
141
+ *
142
+ * Two places consume this and they must agree exactly: the Redis ACL key pattern
143
+ * apps-manager grants the minion's user, and the `REDIS_KEY_PREFIX` the CLI
144
+ * writes into that minion's environment. If they disagree by even a character,
145
+ * every Redis operation the minion performs is DENIED — and the error names an
146
+ * ACL, not the mismatch, so nothing in the minion's own configuration explains
147
+ * it. Deriving both from this function is what makes that class of failure
148
+ * unrepresentable rather than merely unlikely.
149
+ *
150
+ * Based on `appSlug` rather than an authored `dataServices.redis.keyPrefix`
151
+ * because the ACL pattern already is (`RedisSelfInfraProviderModule`), and one
152
+ * inconsistency is better than two competing bases. An application that authors
153
+ * a custom prefix therefore has a PRE-EXISTING mismatch with its own ACL; that
154
+ * gap is older than per-principal credentials and is not narrowed here.
155
+ */
156
+ export function buildMinionRedisKeyPrefix(appSlug, minionName) {
157
+ return `${appSlug}:minions:${minionName}:`;
158
+ }
159
+ /**
160
+ * Map an `ApplicationRuntimeProfile` value onto the credential-principal axis.
161
+ *
162
+ * The two vocabularies are deliberately SEPARATE — a runtime profile answers
163
+ * "which declaration class am I?", a principal kind answers "whose credential do
164
+ * I hold?" — but their string values coincide today. A consumer that relies on
165
+ * that coincidence by comparing raw strings has made the coupling invisible; this
166
+ * function is where the crossing is allowed to happen, once.
167
+ *
168
+ * Fail-closed: an unrecognised profile returns `undefined` rather than a
169
+ * plausible default, because every caller uses the result to decide how narrowly
170
+ * a runtime is confined, and guessing there widens confinement silently.
171
+ */
172
+ export function runtimePrincipalKindFromRuntimeProfile(runtimeProfile) {
173
+ switch (runtimeProfile) {
174
+ case ApplicationRuntimePrincipalKind.APPLICATION_BACKEND:
175
+ return ApplicationRuntimePrincipalKind.APPLICATION_BACKEND;
176
+ case ApplicationRuntimePrincipalKind.MINION:
177
+ return ApplicationRuntimePrincipalKind.MINION;
178
+ case ApplicationRuntimePrincipalKind.WORKER:
179
+ return ApplicationRuntimePrincipalKind.WORKER;
180
+ default:
181
+ return undefined;
182
+ }
183
+ }
184
+ /**
185
+ * The principal segment embedded in a runtime's RPC reply-queue name.
186
+ *
187
+ * ## Why this exists — the same reason as {@link buildMinionRedisKeyPrefix}
188
+ *
189
+ * Two places consume this and they must agree EXACTLY: the broker permission
190
+ * pattern apps-manager grants a minion's user, and the reply-queue name the
191
+ * minion's own AMQP adapter declares and consumes. If they disagree by even a
192
+ * character the minion's every reply is refused with `403 ACCESS_REFUSED`, and
193
+ * the error names a permission rather than the mismatch — so nothing in the
194
+ * minion's own configuration explains it.
195
+ *
196
+ * It previously WAS derived twice: the adapter sanitised its runtime key while
197
+ * the permission builder escaped the raw minion name, coupled only by a comment
198
+ * saying the two "mirror" each other. They agreed for `marketingScrapper` and
199
+ * would have diverged for any name containing a character sanitisation rewrites
200
+ * (`marketing.scrapper` → `marketing-scrapper` on one side, `marketing.scrapper`
201
+ * on the other). A comment describing what the other side must do is not a site
202
+ * that upholds an invariant; deriving both from here makes the divergence
203
+ * unrepresentable instead of merely unlikely.
204
+ *
205
+ * Returns `undefined` for the APPLICATION BACKEND, which keeps the historical
206
+ * segment-less reply-queue layout — that is what stops a minion's permission
207
+ * from ever matching the backend's replies.
208
+ */
209
+ export function buildRuntimePrincipalQueueSegment(principalKind, principalName) {
210
+ if (!principalKind || principalKind === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND) {
211
+ return undefined;
212
+ }
213
+ // Sanitised for the same reason the ACL usernames are: a principal name comes
214
+ // from a TypeScript object key and may hold characters a queue name should not.
215
+ const sanitized = (principalName ?? '').replace(/[^a-zA-Z0-9]+/g, '-').replace(/^-+|-+$/g, '');
216
+ return sanitized ? `${principalKind}-${sanitized}` : undefined;
217
+ }
218
+ //# sourceMappingURL=runtime-principal.contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-principal.contracts.js","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-principal.contracts.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,yDAAyD;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAN,IAAY,+BAUX;AAVD,WAAY,+BAA+B;IACzC;;;;;OAKG;IACH,8EAA2C,CAAA;IAC3C,oDAAiB,CAAA;IACjB,oDAAiB,CAAA;AACnB,CAAC,EAVW,+BAA+B,KAA/B,+BAA+B,QAU1C;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iCAAiC,CAC/C,WAAkC;IAElC,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,qBAAqB,CAAC,MAAM;YAC/B,OAAO,+BAA+B,CAAC,MAAM,CAAC;QAChD,KAAK,qBAAqB,CAAC,MAAM;YAC/B,OAAO,+BAA+B,CAAC,MAAM,CAAC;IAClD,CAAC;AACH,CAAC;AAqBD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,6BAA6B,GAAgC;IACxE,IAAI,EAAE,+BAA+B,CAAC,mBAAmB;CAC1D,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,wBAAwB,CAAC,SAAsC;IAC7E,OAAO,SAAS,CAAC,IAAI,KAAK,+BAA+B,CAAC,mBAAmB;QAC3E,CAAC,CAAC,+BAA+B,CAAC,mBAAmB;QACrD,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;AAClD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAW;IAClD,IAAI,GAAG,KAAK,+BAA+B,CAAC,mBAAmB,EAAE,CAAC;QAChE,OAAO,6BAA6B,CAAC;IACvC,CAAC;IACD,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,cAAc,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;IAC3C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACzD,IAAI,IAAI,KAAK,+BAA+B,CAAC,MAAM,IAAI,IAAI,KAAK,+BAA+B,CAAC,MAAM,EAAE,CAAC;QACvG,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kCAAkC,CAAC,WAGlD;IACC,OAAO;QACL,6BAA6B;QAC7B,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACvD,IAAI,EAAE,+BAA+B,CAAC,MAAM;YAC5C,IAAI;SACL,CAAC,CAAC;QACH,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACvD,IAAI,EAAE,+BAA+B,CAAC,MAAM;YAC5C,IAAI;SACL,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAe,EAAE,UAAkB;IAC3E,OAAO,GAAG,OAAO,YAAY,UAAU,GAAG,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,sCAAsC,CACpD,cAAkC;IAElC,QAAQ,cAAc,EAAE,CAAC;QACvB,KAAK,+BAA+B,CAAC,mBAAmB;YACtD,OAAO,+BAA+B,CAAC,mBAAmB,CAAC;QAC7D,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,+BAA+B,CAAC,MAAM,CAAC;QAChD,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,+BAA+B,CAAC,MAAM,CAAC;QAChD;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,iCAAiC,CAC/C,aAA0D,EAC1D,aAAiC;IAEjC,IAAI,CAAC,aAAa,IAAI,aAAa,KAAK,+BAA+B,CAAC,mBAAmB,EAAE,CAAC;QAC5F,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IAC9E,gFAAgF;IAChF,MAAM,SAAS,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAC/F,OAAO,SAAS,CAAC,CAAC,CAAC,GAAG,aAAa,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC","sourcesContent":["// Root barrel, matching the sibling bootstrap files: `BackgroundRuntimeType`\n// lives in the decorator-bound graph, not the browser-safe `/public-runtime`\n// atom subset. This module is platform/CLI-side only and never reaches a\n// browser bundle, so the root import costs nothing here.\nimport { BackgroundRuntimeType } from '@wildo-ai/saas-models';\n\n/**\n * WHOSE credentials are these? — the credential-principal axis.\n *\n * Wildo now has three runtime-identity vocabularies and they answer three\n * different questions. They are deliberately NOT collapsed, even where their\n * members currently coincide:\n *\n * - `BackgroundRuntimeType` (`MINION | WORKER`) — *what kind of deployable is\n * this?* A compose service, a K8s workload, a provider-runtime scope. It has\n * no application-backend member because the backend is not a background\n * runtime.\n * - `ApplicationRuntimeProfile` (`APPLICATION_BACKEND | MINION`) — *does this\n * boot assertion apply to me?* Inside a single process. It has no worker\n * member because workers never boot that lifecycle.\n * - **This enum** (`APPLICATION_BACKEND | MINION | WORKER`) — *which principal\n * is authenticating, and whose secrets may it receive?* It is the only one of\n * the three that spans every runtime capable of presenting a credential, which\n * is exactly why it cannot be expressed as either neighbour.\n *\n * Merging any pair would be convenient and wrong: a future runtime that boots no\n * lifecycle but does hold credentials (or the reverse) would silently inherit a\n * decision made for a different question.\n *\n * @see BackgroundRuntimeType — the deployable-kind axis this maps FROM\n */\nexport enum ApplicationRuntimePrincipalKind {\n /**\n * The application's own backend service. Historically the ONLY principal:\n * before per-runtime identity, one `primarySecret` per application was held\n * identically by the backend and by every minion and worker, so at the\n * apps-manager door they were indistinguishable.\n */\n APPLICATION_BACKEND = 'application_backend',\n MINION = 'minion',\n WORKER = 'worker',\n}\n\n/**\n * Map a deployable background-runtime kind onto its credential principal.\n *\n * The one place the two vocabularies meet. Keeping the translation in a single\n * exhaustive switch means adding a member to `BackgroundRuntimeType` is a\n * COMPILE error here rather than a silent gap at whichever call site happened to\n * assume a mapping.\n */\nexport function principalKindForBackgroundRuntime(\n runtimeType: BackgroundRuntimeType,\n): ApplicationRuntimePrincipalKind {\n switch (runtimeType) {\n case BackgroundRuntimeType.MINION:\n return ApplicationRuntimePrincipalKind.MINION;\n case BackgroundRuntimeType.WORKER:\n return ApplicationRuntimePrincipalKind.WORKER;\n }\n}\n\n/**\n * A runtime principal's stable identity within one application.\n *\n * `name` is the `wildo.saas.config.ts` bucket key (`marketingScrapper`,\n * `myNodeWorker`) — the SAME identity axis the deploy path already carries as\n * `wildo.ai/owned-service-name` and `APP_OWNED_SERVICE_NAME`. Reusing the bucket\n * key rather than the `serviceName` matters: the bucket key is what the\n * declaration, the config lookup and the pod label all agree on, while\n * `serviceName` is a rendering concern that is normalised for DNS.\n *\n * The backend principal carries no name — an application has exactly one, so a\n * name would be a second way to say `APPLICATION_BACKEND`.\n */\nexport interface ApplicationRuntimePrincipal {\n kind: ApplicationRuntimePrincipalKind;\n /** Absent for {@link ApplicationRuntimePrincipalKind.APPLICATION_BACKEND}. */\n name?: string | undefined;\n}\n\n/** The canonical backend principal — one per application, by definition. */\nexport const APPLICATION_BACKEND_PRINCIPAL: ApplicationRuntimePrincipal = {\n kind: ApplicationRuntimePrincipalKind.APPLICATION_BACKEND,\n};\n\n/**\n * Render a principal as a single stable string.\n *\n * Used as the stored key for a principal's secret, as the URL segment when the\n * CLI asks for a named principal's bootstrap credentials, and in log/audit\n * fields. ONE renderer so those three never drift into three spellings of the\n * same identity.\n *\n * `:` is the separator because neither half can contain it — the kinds are a\n * closed enum, and a bucket key is a TypeScript object key in\n * `wildo.saas.config.ts`. {@link parseRuntimePrincipalKey} rejects anything that\n * does not round-trip, so a key that ever gains a colon fails loudly at the\n * boundary rather than resolving to the wrong principal.\n */\nexport function buildRuntimePrincipalKey(principal: ApplicationRuntimePrincipal): string {\n return principal.kind === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND\n ? ApplicationRuntimePrincipalKind.APPLICATION_BACKEND\n : `${principal.kind}:${principal.name ?? ''}`;\n}\n\n/**\n * Inverse of {@link buildRuntimePrincipalKey}. Returns `null` for anything\n * malformed — an unknown kind, a missing name on a named kind, or a name\n * containing the separator.\n *\n * Fail-closed by returning `null` rather than throwing OR guessing: this parses\n * values that reach the system from a URL segment and from stored rows, and a\n * lenient parse there is how one principal's key resolves to another's secret.\n */\nexport function parseRuntimePrincipalKey(key: string): ApplicationRuntimePrincipal | null {\n if (key === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND) {\n return APPLICATION_BACKEND_PRINCIPAL;\n }\n const separatorIndex = key.indexOf(':');\n if (separatorIndex <= 0) return null;\n const kind = key.slice(0, separatorIndex);\n const name = key.slice(separatorIndex + 1);\n if (name.length === 0 || name.includes(':')) return null;\n if (kind !== ApplicationRuntimePrincipalKind.MINION && kind !== ApplicationRuntimePrincipalKind.WORKER) {\n return null;\n }\n return { kind, name };\n}\n\n/**\n * Every principal an application declares: its backend, plus one per declared\n * minion and worker.\n *\n * Derived from the managed declaration — the same input the config seed already\n * consumes — so the credential set and the deployed runtime set cannot diverge.\n * That is also what makes revocation fall out for free: a runtime removed from\n * `wildo.saas.config.ts` simply stops appearing here, and the mint step prunes\n * any stored secret whose key is no longer in this list (R15).\n *\n * The backend is ALWAYS included, including for an application that declares no\n * minions and no workers — it is the principal that must never be absent.\n */\nexport function enumerateDeclaredRuntimePrincipals(declaration: {\n minions?: Record<string, unknown> | undefined;\n workers?: Record<string, unknown> | undefined;\n}): ApplicationRuntimePrincipal[] {\n return [\n APPLICATION_BACKEND_PRINCIPAL,\n ...Object.keys(declaration.minions ?? {}).map((name) => ({\n kind: ApplicationRuntimePrincipalKind.MINION,\n name,\n })),\n ...Object.keys(declaration.workers ?? {}).map((name) => ({\n kind: ApplicationRuntimePrincipalKind.WORKER,\n name,\n })),\n ];\n}\n\n/**\n * The Redis key namespace a MINION owns (D20).\n *\n * `<appSlug>:minions:<name>:` — a strict extension of the application's own\n * `<appSlug>:` prefix, which is what lets `RedisService` keep enforcing \"an\n * authored prefix must start with `<appSlug>:`\" unchanged.\n *\n * ## One derivation, deliberately, because it is a COUPLED PAIR\n *\n * Two places consume this and they must agree exactly: the Redis ACL key pattern\n * apps-manager grants the minion's user, and the `REDIS_KEY_PREFIX` the CLI\n * writes into that minion's environment. If they disagree by even a character,\n * every Redis operation the minion performs is DENIED — and the error names an\n * ACL, not the mismatch, so nothing in the minion's own configuration explains\n * it. Deriving both from this function is what makes that class of failure\n * unrepresentable rather than merely unlikely.\n *\n * Based on `appSlug` rather than an authored `dataServices.redis.keyPrefix`\n * because the ACL pattern already is (`RedisSelfInfraProviderModule`), and one\n * inconsistency is better than two competing bases. An application that authors\n * a custom prefix therefore has a PRE-EXISTING mismatch with its own ACL; that\n * gap is older than per-principal credentials and is not narrowed here.\n */\nexport function buildMinionRedisKeyPrefix(appSlug: string, minionName: string): string {\n return `${appSlug}:minions:${minionName}:`;\n}\n\n/**\n * Map an `ApplicationRuntimeProfile` value onto the credential-principal axis.\n *\n * The two vocabularies are deliberately SEPARATE — a runtime profile answers\n * \"which declaration class am I?\", a principal kind answers \"whose credential do\n * I hold?\" — but their string values coincide today. A consumer that relies on\n * that coincidence by comparing raw strings has made the coupling invisible; this\n * function is where the crossing is allowed to happen, once.\n *\n * Fail-closed: an unrecognised profile returns `undefined` rather than a\n * plausible default, because every caller uses the result to decide how narrowly\n * a runtime is confined, and guessing there widens confinement silently.\n */\nexport function runtimePrincipalKindFromRuntimeProfile(\n runtimeProfile: string | undefined,\n): ApplicationRuntimePrincipalKind | undefined {\n switch (runtimeProfile) {\n case ApplicationRuntimePrincipalKind.APPLICATION_BACKEND:\n return ApplicationRuntimePrincipalKind.APPLICATION_BACKEND;\n case ApplicationRuntimePrincipalKind.MINION:\n return ApplicationRuntimePrincipalKind.MINION;\n case ApplicationRuntimePrincipalKind.WORKER:\n return ApplicationRuntimePrincipalKind.WORKER;\n default:\n return undefined;\n }\n}\n\n/**\n * The principal segment embedded in a runtime's RPC reply-queue name.\n *\n * ## Why this exists — the same reason as {@link buildMinionRedisKeyPrefix}\n *\n * Two places consume this and they must agree EXACTLY: the broker permission\n * pattern apps-manager grants a minion's user, and the reply-queue name the\n * minion's own AMQP adapter declares and consumes. If they disagree by even a\n * character the minion's every reply is refused with `403 ACCESS_REFUSED`, and\n * the error names a permission rather than the mismatch — so nothing in the\n * minion's own configuration explains it.\n *\n * It previously WAS derived twice: the adapter sanitised its runtime key while\n * the permission builder escaped the raw minion name, coupled only by a comment\n * saying the two \"mirror\" each other. They agreed for `marketingScrapper` and\n * would have diverged for any name containing a character sanitisation rewrites\n * (`marketing.scrapper` → `marketing-scrapper` on one side, `marketing.scrapper`\n * on the other). A comment describing what the other side must do is not a site\n * that upholds an invariant; deriving both from here makes the divergence\n * unrepresentable instead of merely unlikely.\n *\n * Returns `undefined` for the APPLICATION BACKEND, which keeps the historical\n * segment-less reply-queue layout — that is what stops a minion's permission\n * from ever matching the backend's replies.\n */\nexport function buildRuntimePrincipalQueueSegment(\n principalKind: ApplicationRuntimePrincipalKind | undefined,\n principalName: string | undefined,\n): string | undefined {\n if (!principalKind || principalKind === ApplicationRuntimePrincipalKind.APPLICATION_BACKEND) {\n return undefined;\n }\n // Sanitised for the same reason the ACL usernames are: a principal name comes\n // from a TypeScript object key and may hold characters a queue name should not.\n const sanitized = (principalName ?? '').replace(/[^a-zA-Z0-9]+/g, '-').replace(/^-+|-+$/g, '');\n return sanitized ? `${principalKind}-${sanitized}` : undefined;\n}\n\n"]}