@empire-builder-kit/nx 1.0.0-rc.46 → 1.0.0-rc.48

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 (780) hide show
  1. package/README.md +14 -169
  2. package/executors.json +24 -79
  3. package/generators.json +18 -18
  4. package/package.json +13 -71
  5. package/src/aws/identity.d.ts +1 -1
  6. package/src/aws-authority/boundary-transforms.d.ts +9 -0
  7. package/src/aws-authority/boundary-transforms.js +78 -0
  8. package/src/aws-authority/contracts.d.ts +116 -0
  9. package/src/aws-authority/contracts.js +40 -0
  10. package/src/aws-authority/deployment-guardrails.d.ts +4 -0
  11. package/src/aws-authority/deployment-guardrails.js +543 -0
  12. package/src/aws-authority/deployment-policy-groups.d.ts +3 -0
  13. package/src/aws-authority/deployment-policy-groups.js +299 -0
  14. package/src/aws-authority/deployment-resources.d.ts +64 -0
  15. package/src/aws-authority/deployment-resources.js +265 -0
  16. package/src/aws-authority/deployment-services.d.ts +3 -0
  17. package/src/aws-authority/deployment-services.js +717 -0
  18. package/src/aws-authority/development-authority.d.ts +11 -0
  19. package/src/aws-authority/development-authority.js +160 -0
  20. package/src/aws-authority/guardrail-actions.d.ts +87 -0
  21. package/src/aws-authority/guardrail-actions.js +463 -0
  22. package/src/aws-authority/policy-document.d.ts +15 -0
  23. package/src/aws-authority/policy-document.js +264 -0
  24. package/src/aws-authority/runtime-boundary.d.ts +7 -0
  25. package/src/aws-authority/runtime-boundary.js +211 -0
  26. package/src/aws-authority/service-actions.d.ts +96 -0
  27. package/src/aws-authority/service-actions.js +512 -0
  28. package/src/aws-authority/stage-authority.d.ts +6 -244
  29. package/src/aws-authority/stage-authority.js +114 -3419
  30. package/src/aws-authority/stage-identity.d.ts +6 -0
  31. package/src/aws-authority/stage-identity.js +134 -0
  32. package/src/cli/bootstrap.d.ts +0 -20
  33. package/src/cli/bootstrap.js +2 -153
  34. package/src/cli/dev-command.d.ts +2 -4
  35. package/src/cli/dev-command.js +1 -19
  36. package/src/cli/main.d.ts +0 -4
  37. package/src/cli/main.js +22 -80
  38. package/src/cli/output.d.ts +2 -4
  39. package/src/cli/output.js +2 -8
  40. package/src/executors/deployment-plan/deployment-plan.d.ts +0 -2
  41. package/src/executors/deployment-plan/deployment-plan.js +5 -67
  42. package/src/executors/dev-doctor/dev-doctor.d.ts +25 -3
  43. package/src/executors/dev-doctor/dev-doctor.js +137 -50
  44. package/src/executors/dev-setup/dev-setup.d.ts +18 -1
  45. package/src/executors/dev-setup/dev-setup.js +320 -196
  46. package/src/executors/foundation-preflight/foundation-preflight.js +9 -1
  47. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +2 -2
  48. package/src/executors/local-deploy/deployed-smoke.d.ts +12 -0
  49. package/src/executors/local-deploy/deployed-smoke.js +115 -0
  50. package/src/executors/local-deploy/deployment-authority.d.ts +24 -0
  51. package/src/executors/local-deploy/deployment-authority.js +81 -0
  52. package/src/executors/local-deploy/deployment-child.d.ts +18 -0
  53. package/src/executors/local-deploy/deployment-child.js +77 -0
  54. package/src/executors/local-deploy/deployment-contracts.d.ts +96 -0
  55. package/src/executors/local-deploy/deployment-contracts.js +3 -0
  56. package/src/executors/local-deploy/deployment-projects.d.ts +4 -0
  57. package/src/executors/local-deploy/deployment-projects.js +16 -0
  58. package/src/executors/local-deploy/deployment-receipt.d.ts +4 -0
  59. package/src/executors/local-deploy/deployment-receipt.js +55 -0
  60. package/src/executors/local-deploy/deployment-scope.d.ts +17 -0
  61. package/src/executors/local-deploy/deployment-scope.js +239 -0
  62. package/src/executors/local-deploy/deployment-source.d.ts +13 -0
  63. package/src/executors/local-deploy/deployment-source.js +86 -0
  64. package/src/executors/local-deploy/local-deploy.d.ts +5 -106
  65. package/src/executors/local-deploy/local-deploy.js +56 -855
  66. package/src/executors/sst-lifecycle/governed-child-process.d.ts +27 -0
  67. package/src/executors/sst-lifecycle/governed-child-process.js +277 -0
  68. package/src/executors/sst-lifecycle/governed-native-operation.js +4 -10
  69. package/src/executors/sst-lifecycle/run-sst-command.d.ts +4 -85
  70. package/src/executors/sst-lifecycle/run-sst-command.js +28 -788
  71. package/src/executors/sst-lifecycle/sst-contracts.d.ts +44 -0
  72. package/src/executors/sst-lifecycle/sst-contracts.js +3 -0
  73. package/src/executors/sst-lifecycle/sst-invocation.d.ts +17 -0
  74. package/src/executors/sst-lifecycle/sst-invocation.js +502 -0
  75. package/src/executors/sst-lifecycle/task-unlock.js +3 -3
  76. package/src/foundation/discovery.d.ts +1 -5
  77. package/src/foundation/discovery.js +0 -2
  78. package/src/foundation/identity-domain-parent-ready.d.ts +91 -0
  79. package/src/foundation/identity-domain-parent-ready.js +333 -0
  80. package/src/foundation/identity-domain.d.ts +94 -0
  81. package/src/foundation/identity-domain.js +115 -0
  82. package/src/foundation/index.d.ts +2 -2
  83. package/src/foundation/index.js +7 -9
  84. package/src/foundation/local-private-smoke-access.d.ts +6 -15
  85. package/src/foundation/local-private-smoke-access.js +8 -192
  86. package/src/foundation/observability.d.ts +16 -26
  87. package/src/foundation/observability.js +34 -135
  88. package/src/foundation/preflight.js +16 -14
  89. package/src/foundation/private-smoke-access.d.ts +7 -14
  90. package/src/foundation/private-smoke-access.js +4 -126
  91. package/src/foundation/root-site-workspace.d.ts +35 -0
  92. package/src/foundation/root-site-workspace.js +80 -0
  93. package/src/foundation/root-site.d.ts +82 -0
  94. package/src/foundation/root-site.js +276 -0
  95. package/src/generators/formatting.js +5 -4
  96. package/src/generators/framework-prerequisites.d.ts +2 -0
  97. package/src/generators/framework-prerequisites.js +34 -0
  98. package/src/generators/function/function.d.ts +20 -1
  99. package/src/generators/function/function.js +143 -90
  100. package/src/generators/function/schema.d.ts +1 -0
  101. package/src/generators/function/schema.json +8 -2
  102. package/src/generators/function-access/function-access.d.ts +8 -0
  103. package/src/generators/function-access/function-access.js +73 -0
  104. package/src/generators/function-access/schema.d.ts +6 -0
  105. package/src/generators/function-access/schema.json +25 -0
  106. package/src/generators/observability-policy.js +1 -2
  107. package/src/{supply-chain → generators}/pnpm-toolchain-authority.d.ts +3 -3
  108. package/src/{supply-chain → generators}/pnpm-toolchain-authority.js +12 -12
  109. package/src/generators/post-generation-install.d.ts +2 -9
  110. package/src/generators/post-generation-install.js +12 -140
  111. package/src/generators/preset/dependency-overrides.d.ts +14 -20
  112. package/src/generators/preset/dependency-overrides.js +13 -57
  113. package/src/generators/preset/generator.js +0 -3
  114. package/src/generators/preset/workspace-files-foundation-infra.d.ts +6 -0
  115. package/src/generators/preset/workspace-files-foundation-infra.js +586 -0
  116. package/src/generators/preset/workspace-files-foundation-readme.d.ts +5 -0
  117. package/src/generators/preset/workspace-files-foundation-readme.js +90 -0
  118. package/src/generators/preset/workspace-files-foundation.d.ts +3 -0
  119. package/src/generators/preset/workspace-files-foundation.js +170 -0
  120. package/src/generators/preset/workspace-files-ownership.d.ts +9 -0
  121. package/src/generators/preset/workspace-files-ownership.js +124 -0
  122. package/src/generators/preset/workspace-files-root-config.d.ts +32 -0
  123. package/src/generators/preset/workspace-files-root-config.js +356 -0
  124. package/src/generators/preset/workspace-files-root-docs.d.ts +5 -0
  125. package/src/generators/preset/workspace-files-root-docs.js +109 -0
  126. package/src/generators/preset/workspace-files-shared.d.ts +18 -0
  127. package/src/generators/preset/workspace-files-shared.js +7 -0
  128. package/src/generators/preset/workspace-files-workflows.d.ts +39 -0
  129. package/src/generators/preset/workspace-files-workflows.js +306 -0
  130. package/src/generators/preset/workspace-files-workspace-health.d.ts +6 -0
  131. package/src/generators/preset/workspace-files-workspace-health.js +148 -0
  132. package/src/generators/preset/workspace-files.d.ts +10 -24
  133. package/src/generators/preset/workspace-files.js +48 -10511
  134. package/src/generators/site/built-in-site-documentation-files.d.ts +3 -0
  135. package/src/generators/site/built-in-site-documentation-files.js +51 -0
  136. package/src/generators/site/built-in-site-files.d.ts +11 -0
  137. package/src/generators/site/built-in-site-files.js +41 -0
  138. package/src/generators/site/built-in-site-infrastructure-files.d.ts +3 -0
  139. package/src/generators/site/built-in-site-infrastructure-files.js +115 -0
  140. package/src/generators/site/built-in-site-plan.d.ts +23 -0
  141. package/src/generators/site/built-in-site-plan.js +67 -0
  142. package/src/generators/site/built-in-site-project-files.d.ts +11 -0
  143. package/src/generators/site/built-in-site-project-files.js +212 -0
  144. package/src/generators/site/built-in-site-script-files.d.ts +4 -0
  145. package/src/generators/site/built-in-site-script-files.js +102 -0
  146. package/src/generators/site/built-in-site-shared.d.ts +69 -0
  147. package/src/generators/site/built-in-site-shared.js +314 -0
  148. package/src/generators/site/built-in-site-sst-config-files.d.ts +3 -0
  149. package/src/generators/site/built-in-site-sst-config-files.js +107 -0
  150. package/src/generators/site/built-in-site-web-files.d.ts +3 -0
  151. package/src/generators/site/built-in-site-web-files.js +78 -0
  152. package/src/generators/site/schema.d.ts +9 -0
  153. package/src/generators/site/schema.json +26 -0
  154. package/src/generators/site/site.d.ts +5 -0
  155. package/src/generators/site/site.js +153 -0
  156. package/src/generators/slice/built-in-plan-api-files.d.ts +1 -2
  157. package/src/generators/slice/built-in-plan-api-files.js +30 -890
  158. package/src/generators/slice/built-in-plan-database-lifecycle-files.js +57 -1851
  159. package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +5 -2
  160. package/src/generators/slice/built-in-plan-infrastructure-files.js +80 -3358
  161. package/src/generators/slice/built-in-plan-key-value-files.d.ts +3 -2
  162. package/src/generators/slice/built-in-plan-key-value-files.js +3 -21
  163. package/src/generators/slice/built-in-plan-project-files.d.ts +5 -3
  164. package/src/generators/slice/built-in-plan-project-files.js +79 -897
  165. package/src/generators/slice/built-in-plan-shared.d.ts +4 -19
  166. package/src/generators/slice/built-in-plan-shared.js +5 -58
  167. package/src/generators/slice/built-in-plan-sst-config.d.ts +49 -0
  168. package/src/generators/slice/built-in-plan-sst-config.js +160 -0
  169. package/src/generators/slice/built-in-plan-web-files.d.ts +1 -1
  170. package/src/generators/slice/built-in-plan-web-files.js +14 -475
  171. package/src/generators/slice/built-in-plan.d.ts +2 -3
  172. package/src/generators/slice/built-in-plan.js +79 -277
  173. package/src/{developer-agent/preview-changes.d.ts → generators/slice/generation-tree.d.ts} +1 -5
  174. package/src/generators/slice/generation-tree.js +161 -0
  175. package/src/generators/slice/persistence-contract.js +2 -2
  176. package/src/generators/slice/schema.json +12 -4
  177. package/src/generators/slice/slice-config.d.ts +7 -0
  178. package/src/generators/slice/slice-config.js +125 -0
  179. package/src/generators/slice/slice.js +52 -257
  180. package/src/generators/slice/sql-bootstrap.d.ts +1 -0
  181. package/src/generators/slice/sql-bootstrap.js +505 -0
  182. package/src/generators/slice/sql-client.d.ts +1 -0
  183. package/src/generators/slice/sql-client.js +107 -0
  184. package/src/generators/slice/sql-infrastructure.d.ts +1 -0
  185. package/src/generators/slice/sql-infrastructure.js +225 -0
  186. package/src/generators/slice/sql-logging.d.ts +1 -0
  187. package/src/generators/slice/sql-logging.js +266 -0
  188. package/src/generators/slice/sql-migration.d.ts +2 -0
  189. package/src/generators/slice/sql-migration.js +202 -0
  190. package/src/generators/slice/standard-slice-contract.d.ts +25 -0
  191. package/src/generators/slice/standard-slice-contract.js +64 -0
  192. package/src/generators/sql/schema.json +1 -1
  193. package/src/generators/sql/sql.d.ts +1 -1
  194. package/src/generators/sql/sql.js +13 -7
  195. package/src/generators/upgrade/framework-package-upgrade.d.ts +35 -0
  196. package/src/generators/upgrade/framework-package-upgrade.js +55 -0
  197. package/src/generators/upgrade/framework-packages.d.ts +25 -0
  198. package/src/generators/upgrade/framework-packages.js +138 -0
  199. package/src/generators/upgrade/function-authentication-notice.d.ts +21 -0
  200. package/src/generators/upgrade/function-authentication-notice.js +54 -0
  201. package/src/generators/upgrade/schema.d.ts +0 -3
  202. package/src/generators/upgrade/schema.json +7 -17
  203. package/src/generators/upgrade/slice-compositions.d.ts +20 -0
  204. package/src/generators/upgrade/slice-compositions.js +100 -0
  205. package/src/generators/upgrade/slice-upgrade-guidance.d.ts +19 -0
  206. package/src/generators/upgrade/slice-upgrade-guidance.js +50 -0
  207. package/src/generators/upgrade/slice-upgrade.d.ts +4 -0
  208. package/src/generators/upgrade/slice-upgrade.js +231 -0
  209. package/src/generators/upgrade/upgrade-plan.d.ts +49 -0
  210. package/src/generators/upgrade/upgrade-plan.js +242 -0
  211. package/src/generators/upgrade/upgrade-preflight.d.ts +20 -0
  212. package/src/generators/upgrade/upgrade-preflight.js +64 -0
  213. package/src/generators/upgrade/upgrade.d.ts +8 -87
  214. package/src/generators/upgrade/upgrade.js +27 -1909
  215. package/src/generators/workload/schema.json +2 -2
  216. package/src/generators/workload/workload.d.ts +11 -11
  217. package/src/generators/workload/workload.js +167 -1200
  218. package/src/index.d.ts +0 -5
  219. package/src/index.js +0 -5
  220. package/src/local-dev/browser-verification.d.ts +0 -7
  221. package/src/local-dev/browser-verification.js +0 -136
  222. package/src/local-dev/contracts.d.ts +6 -0
  223. package/src/local-dev/contracts.js +17 -9
  224. package/src/local-dev/environment-checks.d.ts +126 -0
  225. package/src/local-dev/environment-checks.js +81 -0
  226. package/src/local-dev/environment-inspector.d.ts +3 -124
  227. package/src/local-dev/environment-inspector.js +9 -148
  228. package/src/local-dev/fleet-process.d.ts +9 -2
  229. package/src/local-dev/fleet-process.js +27 -7
  230. package/src/local-dev/gateway-daemon.d.ts +1 -1
  231. package/src/local-dev/gateway-daemon.js +6 -4
  232. package/src/local-dev/portless.d.ts +5 -0
  233. package/src/local-dev/portless.js +5 -0
  234. package/src/local-dev/private-state.d.ts +1 -0
  235. package/src/local-dev/private-state.js +19 -23
  236. package/src/local-dev/process-group.d.ts +10 -0
  237. package/src/local-dev/process-group.js +33 -0
  238. package/src/local-dev/process-identity.js +4 -2
  239. package/src/local-dev/slice-runner-child.d.ts +37 -0
  240. package/src/local-dev/slice-runner-child.js +127 -0
  241. package/src/local-dev/slice-runner-recovery.d.ts +32 -0
  242. package/src/local-dev/slice-runner-recovery.js +216 -0
  243. package/src/local-dev/slice-runner-state.d.ts +82 -0
  244. package/src/local-dev/slice-runner-state.js +265 -0
  245. package/src/local-dev/slice-runner.d.ts +4 -117
  246. package/src/local-dev/slice-runner.js +59 -594
  247. package/src/local-dev/tls.js +39 -99
  248. package/src/local-dev/trust-store.d.ts +42 -0
  249. package/src/local-dev/trust-store.js +87 -0
  250. package/src/ownership/composition.d.ts +7 -0
  251. package/src/ownership/composition.js +64 -56
  252. package/src/ownership/index.d.ts +2 -0
  253. package/src/ownership/index.js +7 -0
  254. package/src/ownership/pnpm-workspace.d.ts +77 -0
  255. package/src/ownership/pnpm-workspace.js +225 -0
  256. package/src/ownership/record.d.ts +19 -0
  257. package/src/ownership/record.js +26 -2
  258. package/src/ownership/site-record.d.ts +26 -0
  259. package/src/ownership/site-record.js +120 -0
  260. package/src/repository-policy/capacity-migration.d.ts +1 -1
  261. package/src/repository-policy/capacity-migration.js +1 -1
  262. package/src/repository-policy/deployment-plan.d.ts +3 -0
  263. package/src/repository-policy/deployment-plan.js +33 -4
  264. package/src/repository-policy/foundation-router.d.ts +17 -0
  265. package/src/repository-policy/foundation-router.js +44 -0
  266. package/src/repository-policy/index.d.ts +3 -0
  267. package/src/repository-policy/index.js +3 -0
  268. package/src/repository-policy/policy-accounts.d.ts +22 -0
  269. package/src/repository-policy/policy-accounts.js +134 -0
  270. package/src/repository-policy/policy-files.d.ts +8 -0
  271. package/src/repository-policy/policy-files.js +201 -0
  272. package/src/repository-policy/policy-internal.d.ts +2 -0
  273. package/src/repository-policy/policy-internal.js +11 -0
  274. package/src/repository-policy/policy-model.d.ts +95 -0
  275. package/src/repository-policy/policy-model.js +42 -0
  276. package/src/repository-policy/policy-validation.d.ts +4 -0
  277. package/src/repository-policy/policy-validation.js +308 -0
  278. package/src/repository-policy/policy.d.ts +6 -109
  279. package/src/repository-policy/policy.js +52 -626
  280. package/src/repository-policy/public-dns.d.ts +69 -0
  281. package/src/repository-policy/public-dns.js +265 -0
  282. package/src/{generators/repository-policy → repository-policy}/tree-policy.d.ts +1 -1
  283. package/src/{generators/repository-policy → repository-policy}/tree-policy.js +5 -5
  284. package/src/schemas/generated-ownership-v2.json +6 -0
  285. package/src/schemas/repository-policy-v1.json +106 -3
  286. package/src/secrets/index.d.ts +0 -5
  287. package/src/secrets/index.js +0 -5
  288. package/src/slice-infra/index.d.ts +57 -0
  289. package/src/slice-infra/index.js +117 -0
  290. package/src/slice-scripts/build.d.ts +27 -0
  291. package/src/slice-scripts/build.js +120 -0
  292. package/src/slice-scripts/database.d.ts +87 -0
  293. package/src/slice-scripts/database.js +328 -0
  294. package/src/slice-scripts/index.d.ts +11 -0
  295. package/src/slice-scripts/index.js +23 -0
  296. package/src/slice-scripts/root-site-routes.d.ts +11 -0
  297. package/src/slice-scripts/root-site-routes.js +83 -0
  298. package/src/slice-scripts/sql-migration-engine.mjs +180 -0
  299. package/src/workload-roles/effective-policy.d.ts +0 -37
  300. package/src/workload-roles/effective-policy.js +1 -174
  301. package/src/workload-roles/standard-slice.d.ts +2 -19
  302. package/src/workload-roles/standard-slice.js +3 -129
  303. package/src/workspace-deployment/ownership.d.ts +15 -0
  304. package/src/workspace-deployment/ownership.js +19 -3
  305. package/src/api-contract/baseline-update.d.ts +0 -82
  306. package/src/api-contract/baseline-update.js +0 -225
  307. package/src/api-contract/compatibility.d.ts +0 -30
  308. package/src/api-contract/compatibility.js +0 -643
  309. package/src/api-contract/contract-graph.d.ts +0 -35
  310. package/src/api-contract/contract-graph.js +0 -141
  311. package/src/api-contract/evidence.d.ts +0 -23
  312. package/src/api-contract/evidence.js +0 -87
  313. package/src/api-contract/index.d.ts +0 -6
  314. package/src/api-contract/index.js +0 -10
  315. package/src/api-contract/model.d.ts +0 -144
  316. package/src/api-contract/model.js +0 -993
  317. package/src/api-contract/rollout.d.ts +0 -32
  318. package/src/api-contract/rollout.js +0 -88
  319. package/src/authorization/compatibility.d.ts +0 -62
  320. package/src/authorization/compatibility.js +0 -175
  321. package/src/authorization/index.d.ts +0 -1
  322. package/src/authorization/index.js +0 -5
  323. package/src/blueprints/execution.d.ts +0 -55
  324. package/src/blueprints/execution.js +0 -329
  325. package/src/blueprints/external-sandbox.d.ts +0 -53
  326. package/src/blueprints/external-sandbox.js +0 -1194
  327. package/src/blueprints/index.d.ts +0 -5
  328. package/src/blueprints/index.js +0 -9
  329. package/src/blueprints/inputs.d.ts +0 -43
  330. package/src/blueprints/inputs.js +0 -103
  331. package/src/blueprints/manifest.d.ts +0 -281
  332. package/src/blueprints/manifest.js +0 -424
  333. package/src/blueprints/resolver.d.ts +0 -37
  334. package/src/blueprints/resolver.js +0 -387
  335. package/src/blueprints/transitions.d.ts +0 -20
  336. package/src/blueprints/transitions.js +0 -61
  337. package/src/cli/agent-command.d.ts +0 -30
  338. package/src/cli/agent-command.js +0 -204
  339. package/src/cli/agent-runtime.d.ts +0 -25
  340. package/src/cli/agent-runtime.js +0 -498
  341. package/src/cli/blueprint-authority.d.ts +0 -9
  342. package/src/cli/blueprint-authority.js +0 -43
  343. package/src/cli/blueprint-command.d.ts +0 -24
  344. package/src/cli/blueprint-command.js +0 -63
  345. package/src/data-lifecycle/index.d.ts +0 -3
  346. package/src/data-lifecycle/index.js +0 -7
  347. package/src/data-lifecycle/model.d.ts +0 -172
  348. package/src/data-lifecycle/model.js +0 -95
  349. package/src/data-lifecycle/sensitive-artifacts.d.ts +0 -28
  350. package/src/data-lifecycle/sensitive-artifacts.js +0 -146
  351. package/src/data-lifecycle/validation.d.ts +0 -32
  352. package/src/data-lifecycle/validation.js +0 -837
  353. package/src/database-retirement/contract.d.ts +0 -68
  354. package/src/database-retirement/contract.js +0 -166
  355. package/src/database-retirement/index.d.ts +0 -1
  356. package/src/database-retirement/index.js +0 -5
  357. package/src/developer-agent/context.d.ts +0 -57
  358. package/src/developer-agent/context.js +0 -662
  359. package/src/developer-agent/generator-planning.d.ts +0 -34
  360. package/src/developer-agent/generator-planning.js +0 -666
  361. package/src/developer-agent/generator-preview.d.ts +0 -8
  362. package/src/developer-agent/generator-preview.js +0 -650
  363. package/src/developer-agent/git-inspection.d.ts +0 -112
  364. package/src/developer-agent/git-inspection.js +0 -887
  365. package/src/developer-agent/handoff.d.ts +0 -43
  366. package/src/developer-agent/handoff.js +0 -713
  367. package/src/developer-agent/index.d.ts +0 -10
  368. package/src/developer-agent/index.js +0 -14
  369. package/src/developer-agent/model.d.ts +0 -493
  370. package/src/developer-agent/model.js +0 -143
  371. package/src/developer-agent/operation-registry.d.ts +0 -60
  372. package/src/developer-agent/operation-registry.js +0 -1550
  373. package/src/developer-agent/ordering.d.ts +0 -9
  374. package/src/developer-agent/ordering.js +0 -15
  375. package/src/developer-agent/planning.d.ts +0 -25
  376. package/src/developer-agent/planning.js +0 -478
  377. package/src/developer-agent/preview-changes.js +0 -215
  378. package/src/developer-agent/preview-source.d.ts +0 -2
  379. package/src/developer-agent/preview-source.js +0 -19
  380. package/src/developer-agent/validation.d.ts +0 -30
  381. package/src/developer-agent/validation.js +0 -2725
  382. package/src/developer-agent/workspace-inspection.d.ts +0 -20
  383. package/src/developer-agent/workspace-inspection.js +0 -1189
  384. package/src/developer-agent/workspace-path.d.ts +0 -6
  385. package/src/developer-agent/workspace-path.js +0 -22
  386. package/src/executors/blueprint-trust/blueprint-trust.d.ts +0 -29
  387. package/src/executors/blueprint-trust/blueprint-trust.js +0 -121
  388. package/src/executors/blueprint-trust/schema.json +0 -27
  389. package/src/executors/blueprint-verification/blueprint-verification.d.ts +0 -13
  390. package/src/executors/blueprint-verification/blueprint-verification.js +0 -110
  391. package/src/executors/blueprint-verification/schema.json +0 -44
  392. package/src/executors/developer-context/developer-context.d.ts +0 -38
  393. package/src/executors/developer-context/developer-context.js +0 -78
  394. package/src/executors/developer-context/schema.json +0 -87
  395. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +0 -19
  396. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +0 -105
  397. package/src/executors/foundation-profile-preflight/schema.json +0 -32
  398. package/src/executors/github-bootstrap/github-bootstrap.d.ts +0 -13
  399. package/src/executors/github-bootstrap/github-bootstrap.js +0 -62
  400. package/src/executors/github-bootstrap/schema.json +0 -50
  401. package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +0 -37
  402. package/src/executors/infrastructure-plan/infrastructure-plan.js +0 -268
  403. package/src/executors/infrastructure-plan/schema.json +0 -38
  404. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.d.ts +0 -42
  405. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +0 -1229
  406. package/src/executors/router-waf-rehearsal/schema.json +0 -29
  407. package/src/executors/secret-guardrails/schema.json +0 -6
  408. package/src/executors/secret-guardrails/secret-guardrails.d.ts +0 -3
  409. package/src/executors/secret-guardrails/secret-guardrails.js +0 -44
  410. package/src/executors/secret-initialize/schema.json +0 -42
  411. package/src/executors/secret-initialize/secret-initialize.d.ts +0 -34
  412. package/src/executors/secret-initialize/secret-initialize.js +0 -297
  413. package/src/executors/secret-metadata/schema.json +0 -36
  414. package/src/executors/secret-metadata/secret-metadata.d.ts +0 -46
  415. package/src/executors/secret-metadata/secret-metadata.js +0 -230
  416. package/src/executors/sst-lifecycle/generated-secret-retirement.d.ts +0 -53
  417. package/src/executors/sst-lifecycle/generated-secret-retirement.js +0 -192
  418. package/src/executors/sst-lifecycle/logging-preflight.d.ts +0 -22
  419. package/src/executors/sst-lifecycle/logging-preflight.js +0 -206
  420. package/src/executors/sst-lifecycle/secret-preflight.d.ts +0 -27
  421. package/src/executors/sst-lifecycle/secret-preflight.js +0 -125
  422. package/src/executors/work-markers/schema.json +0 -14
  423. package/src/executors/work-markers/work-markers.d.ts +0 -6
  424. package/src/executors/work-markers/work-markers.js +0 -20
  425. package/src/foundation/cost-estimate.d.ts +0 -175
  426. package/src/foundation/cost-estimate.js +0 -706
  427. package/src/foundation/private-smoke-admission.d.ts +0 -45
  428. package/src/foundation/private-smoke-admission.js +0 -180
  429. package/src/foundation/private-smoke-control-plane.d.ts +0 -18
  430. package/src/foundation/private-smoke-control-plane.js +0 -184
  431. package/src/foundation/router-waf-rate-rehearsal.d.ts +0 -97
  432. package/src/foundation/router-waf-rate-rehearsal.js +0 -210
  433. package/src/foundation/router-waf.d.ts +0 -149
  434. package/src/foundation/router-waf.js +0 -809
  435. package/src/frontend-security/index.d.ts +0 -1
  436. package/src/frontend-security/index.js +0 -5
  437. package/src/frontend-security/security-headers.d.ts +0 -50
  438. package/src/frontend-security/security-headers.js +0 -418
  439. package/src/generators/blueprint/blueprint.d.ts +0 -5
  440. package/src/generators/blueprint/blueprint.js +0 -102
  441. package/src/generators/blueprint/files.d.ts +0 -6
  442. package/src/generators/blueprint/files.js +0 -217
  443. package/src/generators/blueprint/schema.d.ts +0 -4
  444. package/src/generators/blueprint/schema.json +0 -18
  445. package/src/generators/feature-registry.d.ts +0 -13
  446. package/src/generators/feature-registry.js +0 -73
  447. package/src/generators/observability-infrastructure.d.ts +0 -2
  448. package/src/generators/observability-infrastructure.js +0 -31
  449. package/src/generators/preset/workspace-files-adopter-skills.d.ts +0 -7
  450. package/src/generators/preset/workspace-files-adopter-skills.js +0 -345
  451. package/src/generators/preset/workspace-files-agent-development.d.ts +0 -9
  452. package/src/generators/preset/workspace-files-agent-development.js +0 -42
  453. package/src/generators/preset/workspace-files-ci-acceptance.d.ts +0 -1
  454. package/src/generators/preset/workspace-files-ci-acceptance.js +0 -791
  455. package/src/generators/preset/workspace-files-ci-install.d.ts +0 -2
  456. package/src/generators/preset/workspace-files-ci-install.js +0 -196
  457. package/src/generators/preset/workspace-files-developer-agent.d.ts +0 -16
  458. package/src/generators/preset/workspace-files-developer-agent.js +0 -638
  459. package/src/generators/preset/workspace-files-ecr-inspector.d.ts +0 -18
  460. package/src/generators/preset/workspace-files-ecr-inspector.js +0 -298
  461. package/src/generators/preset/workspace-files-foundation-workload-roles.d.ts +0 -6
  462. package/src/generators/preset/workspace-files-foundation-workload-roles.js +0 -409
  463. package/src/generators/preset/workspace-files-performance-cost.d.ts +0 -66
  464. package/src/generators/preset/workspace-files-performance-cost.js +0 -866
  465. package/src/generators/preset/workspace-files-performance-load.d.ts +0 -73
  466. package/src/generators/preset/workspace-files-performance-load.js +0 -815
  467. package/src/generators/preset/workspace-files-shared-operation-claims.d.ts +0 -10
  468. package/src/generators/preset/workspace-files-shared-operation-claims.js +0 -59
  469. package/src/generators/preset/workspace-files-stage-authority.d.ts +0 -6
  470. package/src/generators/preset/workspace-files-stage-authority.js +0 -529
  471. package/src/generators/preset/workspace-files-thin-deploy.d.ts +0 -65
  472. package/src/generators/preset/workspace-files-thin-deploy.js +0 -2520
  473. package/src/generators/preset/workspace-files-thin-docs.d.ts +0 -7
  474. package/src/generators/preset/workspace-files-thin-docs.js +0 -358
  475. package/src/generators/preset/workspace-files-thin-release.d.ts +0 -14
  476. package/src/generators/preset/workspace-files-thin-release.js +0 -26
  477. package/src/generators/preset/workspace-files-workload-role-baseline.d.ts +0 -9
  478. package/src/generators/preset/workspace-files-workload-role-baseline.js +0 -1314
  479. package/src/generators/repository-policy/repository-policy.d.ts +0 -4
  480. package/src/generators/repository-policy/repository-policy.js +0 -293
  481. package/src/generators/repository-policy/schema.d.ts +0 -28
  482. package/src/generators/repository-policy/schema.json +0 -122
  483. package/src/generators/slice/built-in-plan-alarm-identity.d.ts +0 -173
  484. package/src/generators/slice/built-in-plan-alarm-identity.js +0 -202
  485. package/src/generators/slice/built-in-plan-api-contract-files.d.ts +0 -2
  486. package/src/generators/slice/built-in-plan-api-contract-files.js +0 -2830
  487. package/src/generators/slice/built-in-plan-async-work-files.d.ts +0 -2
  488. package/src/generators/slice/built-in-plan-async-work-files.js +0 -6100
  489. package/src/generators/slice/built-in-plan-authorization-files.d.ts +0 -2
  490. package/src/generators/slice/built-in-plan-authorization-files.js +0 -2082
  491. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.d.ts +0 -2
  492. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +0 -1301
  493. package/src/generators/slice/built-in-plan-authorization-storage.d.ts +0 -3
  494. package/src/generators/slice/built-in-plan-authorization-storage.js +0 -119
  495. package/src/generators/slice/built-in-plan-background-work-files.d.ts +0 -2
  496. package/src/generators/slice/built-in-plan-background-work-files.js +0 -99
  497. package/src/generators/slice/built-in-plan-data-deletion-files.d.ts +0 -2
  498. package/src/generators/slice/built-in-plan-data-deletion-files.js +0 -273
  499. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.d.ts +0 -2
  500. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +0 -223
  501. package/src/generators/slice/built-in-plan-data-files.d.ts +0 -2
  502. package/src/generators/slice/built-in-plan-data-files.js +0 -513
  503. package/src/generators/slice/built-in-plan-data-lifecycle-files.d.ts +0 -2
  504. package/src/generators/slice/built-in-plan-data-lifecycle-files.js +0 -775
  505. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.d.ts +0 -2
  506. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +0 -863
  507. package/src/generators/slice/built-in-plan-data-retention-job-files.d.ts +0 -2
  508. package/src/generators/slice/built-in-plan-data-retention-job-files.js +0 -169
  509. package/src/generators/slice/built-in-plan-data-retention-launcher-files.d.ts +0 -2
  510. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +0 -186
  511. package/src/generators/slice/built-in-plan-data-rights-files.d.ts +0 -2
  512. package/src/generators/slice/built-in-plan-data-rights-files.js +0 -152
  513. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.d.ts +0 -2
  514. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +0 -508
  515. package/src/generators/slice/built-in-plan-event-contract-literal.d.ts +0 -6
  516. package/src/generators/slice/built-in-plan-event-contract-literal.js +0 -52
  517. package/src/generators/slice/built-in-plan-foundation-files.d.ts +0 -3
  518. package/src/generators/slice/built-in-plan-foundation-files.js +0 -205
  519. package/src/generators/slice/built-in-plan-frontend-files.d.ts +0 -2
  520. package/src/generators/slice/built-in-plan-frontend-files.js +0 -2244
  521. package/src/generators/slice/built-in-plan-infrastructure-safety-files.d.ts +0 -2
  522. package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +0 -373
  523. package/src/generators/slice/built-in-plan-key-value-cleanup.d.ts +0 -4
  524. package/src/generators/slice/built-in-plan-key-value-cleanup.js +0 -100
  525. package/src/generators/slice/built-in-plan-key-value-consumer.d.ts +0 -4
  526. package/src/generators/slice/built-in-plan-key-value-consumer.js +0 -151
  527. package/src/generators/slice/built-in-plan-key-value-deletion.d.ts +0 -2
  528. package/src/generators/slice/built-in-plan-key-value-deletion.js +0 -377
  529. package/src/generators/slice/built-in-plan-key-value-delivery.d.ts +0 -2
  530. package/src/generators/slice/built-in-plan-key-value-delivery.js +0 -137
  531. package/src/generators/slice/built-in-plan-key-value-export.d.ts +0 -2
  532. package/src/generators/slice/built-in-plan-key-value-export.js +0 -595
  533. package/src/generators/slice/built-in-plan-key-value-holds.d.ts +0 -2
  534. package/src/generators/slice/built-in-plan-key-value-holds.js +0 -189
  535. package/src/generators/slice/built-in-plan-key-value-infrastructure.d.ts +0 -2
  536. package/src/generators/slice/built-in-plan-key-value-infrastructure.js +0 -102
  537. package/src/generators/slice/built-in-plan-key-value-performance.d.ts +0 -5
  538. package/src/generators/slice/built-in-plan-key-value-performance.js +0 -530
  539. package/src/generators/slice/built-in-plan-key-value-provider.d.ts +0 -4
  540. package/src/generators/slice/built-in-plan-key-value-provider.js +0 -366
  541. package/src/generators/slice/built-in-plan-key-value-records.d.ts +0 -3
  542. package/src/generators/slice/built-in-plan-key-value-records.js +0 -232
  543. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.d.ts +0 -2
  544. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +0 -103
  545. package/src/generators/slice/built-in-plan-key-value-retention-job-files.d.ts +0 -2
  546. package/src/generators/slice/built-in-plan-key-value-retention-job-files.js +0 -160
  547. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.d.ts +0 -2
  548. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.js +0 -329
  549. package/src/generators/slice/built-in-plan-key-value-retention-worker.d.ts +0 -2
  550. package/src/generators/slice/built-in-plan-key-value-retention-worker.js +0 -477
  551. package/src/generators/slice/built-in-plan-key-value-retention.d.ts +0 -2
  552. package/src/generators/slice/built-in-plan-key-value-retention.js +0 -184
  553. package/src/generators/slice/built-in-plan-metadata-files.d.ts +0 -3
  554. package/src/generators/slice/built-in-plan-metadata-files.js +0 -384
  555. package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +0 -2
  556. package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +0 -324
  557. package/src/generators/slice/built-in-plan-operations-files.d.ts +0 -2
  558. package/src/generators/slice/built-in-plan-operations-files.js +0 -1218
  559. package/src/generators/slice/built-in-plan-performance-files.d.ts +0 -4
  560. package/src/generators/slice/built-in-plan-performance-files.js +0 -2439
  561. package/src/generators/slice/built-in-plan-release-files.d.ts +0 -2
  562. package/src/generators/slice/built-in-plan-release-files.js +0 -6585
  563. package/src/generators/slice/built-in-plan-reliability-files.d.ts +0 -2
  564. package/src/generators/slice/built-in-plan-reliability-files.js +0 -4724
  565. package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +0 -2
  566. package/src/generators/slice/built-in-plan-secret-runtime-files.js +0 -1015
  567. package/src/generators/slice/built-in-plan-sql-events.d.ts +0 -2
  568. package/src/generators/slice/built-in-plan-sql-events.js +0 -276
  569. package/src/generators/slice/built-in-plan-testing-files.d.ts +0 -2
  570. package/src/generators/slice/built-in-plan-testing-files.js +0 -2575
  571. package/src/generators/slice/built-in-plan-testing-persistence-event-files.d.ts +0 -7
  572. package/src/generators/slice/built-in-plan-testing-persistence-event-files.js +0 -487
  573. package/src/generators/slice/built-in-plan-testing-persistence-files.d.ts +0 -2
  574. package/src/generators/slice/built-in-plan-testing-persistence-files.js +0 -180
  575. package/src/generators/slice/built-in-plan-thin-release-files.d.ts +0 -11
  576. package/src/generators/slice/built-in-plan-thin-release-files.js +0 -162
  577. package/src/generators/slice/built-in-plan-verification-files.d.ts +0 -2
  578. package/src/generators/slice/built-in-plan-verification-files.js +0 -431
  579. package/src/generators/slice/built-in-plan-workload-role-files.d.ts +0 -2
  580. package/src/generators/slice/built-in-plan-workload-role-files.js +0 -2220
  581. package/src/generators/slice/data-policy-review-seed.d.ts +0 -2
  582. package/src/generators/slice/data-policy-review-seed.js +0 -22
  583. package/src/generators/slice/deployed-smoke-readiness.d.ts +0 -2
  584. package/src/generators/slice/deployed-smoke-readiness.js +0 -214
  585. package/src/generators/slice/local-source-identity.d.ts +0 -2
  586. package/src/generators/slice/local-source-identity.js +0 -31
  587. package/src/generators/upgrade/sql-seeded-reconciliation.d.ts +0 -2
  588. package/src/generators/upgrade/sql-seeded-reconciliation.js +0 -170
  589. package/src/generators/workload/performance-registration.d.ts +0 -33
  590. package/src/generators/workload/performance-registration.js +0 -224
  591. package/src/generators/workload/reliability-registration.d.ts +0 -16
  592. package/src/generators/workload/reliability-registration.js +0 -150
  593. package/src/generators/workload/service-performance-files.d.ts +0 -5
  594. package/src/generators/workload/service-performance-files.js +0 -1883
  595. package/src/git-policy/action-pins.d.ts +0 -43
  596. package/src/git-policy/action-pins.js +0 -50
  597. package/src/git-policy/github-bootstrap.d.ts +0 -94
  598. package/src/git-policy/github-bootstrap.js +0 -1248
  599. package/src/git-policy/index.d.ts +0 -3
  600. package/src/git-policy/index.js +0 -7
  601. package/src/git-policy/routing.d.ts +0 -21
  602. package/src/git-policy/routing.js +0 -138
  603. package/src/infrastructure-change/convergence.d.ts +0 -13
  604. package/src/infrastructure-change/convergence.js +0 -85
  605. package/src/infrastructure-change/drift.d.ts +0 -13
  606. package/src/infrastructure-change/drift.js +0 -112
  607. package/src/infrastructure-change/index.d.ts +0 -7
  608. package/src/infrastructure-change/index.js +0 -11
  609. package/src/infrastructure-change/local-capability.d.ts +0 -73
  610. package/src/infrastructure-change/local-capability.js +0 -114
  611. package/src/infrastructure-change/model.d.ts +0 -274
  612. package/src/infrastructure-change/model.js +0 -29
  613. package/src/infrastructure-change/normalize.d.ts +0 -16
  614. package/src/infrastructure-change/normalize.js +0 -285
  615. package/src/infrastructure-change/plan.d.ts +0 -67
  616. package/src/infrastructure-change/plan.js +0 -671
  617. package/src/infrastructure-change/risk.d.ts +0 -9
  618. package/src/infrastructure-change/risk.js +0 -349
  619. package/src/infrastructure-change/summary.d.ts +0 -20
  620. package/src/infrastructure-change/summary.js +0 -130
  621. package/src/performance/cost-collection.d.ts +0 -225
  622. package/src/performance/cost-collection.js +0 -827
  623. package/src/performance/cost-controls.d.ts +0 -135
  624. package/src/performance/cost-controls.js +0 -347
  625. package/src/performance/evidence.d.ts +0 -140
  626. package/src/performance/evidence.js +0 -601
  627. package/src/performance/index.d.ts +0 -10
  628. package/src/performance/index.js +0 -14
  629. package/src/performance/load-safety.d.ts +0 -84
  630. package/src/performance/load-safety.js +0 -348
  631. package/src/performance/model.d.ts +0 -129
  632. package/src/performance/model.js +0 -451
  633. package/src/performance/pr-artifact-budget.d.ts +0 -42
  634. package/src/performance/pr-artifact-budget.js +0 -151
  635. package/src/performance/runner.d.ts +0 -75
  636. package/src/performance/runner.js +0 -227
  637. package/src/performance/scenario-endpoint.d.ts +0 -1
  638. package/src/performance/scenario-endpoint.js +0 -5
  639. package/src/performance/scenario.d.ts +0 -215
  640. package/src/performance/scenario.js +0 -744
  641. package/src/performance/unit-cost.d.ts +0 -105
  642. package/src/performance/unit-cost.js +0 -364
  643. package/src/release/index.d.ts +0 -2
  644. package/src/release/index.js +0 -6
  645. package/src/release/lifecycle.d.ts +0 -132
  646. package/src/release/lifecycle.js +0 -411
  647. package/src/release/manifest.d.ts +0 -148
  648. package/src/release/manifest.js +0 -503
  649. package/src/release/rollout.d.ts +0 -170
  650. package/src/release/rollout.js +0 -578
  651. package/src/release/source-authority.d.ts +0 -19
  652. package/src/release/source-authority.js +0 -212
  653. package/src/schemas/aggregate-count-evidence-v1.json +0 -135
  654. package/src/schemas/api-contract-baseline-v1.json +0 -674
  655. package/src/schemas/api-contract-compatibility-report-v1.json +0 -126
  656. package/src/schemas/aws-billing-actual-evidence-v1.json +0 -407
  657. package/src/schemas/blueprint-input-schema-v1.json +0 -23
  658. package/src/schemas/blueprint-v1.json +0 -188
  659. package/src/schemas/data-lifecycle-policy-v1.json +0 -517
  660. package/src/schemas/performance-policy-v1.json +0 -335
  661. package/src/schemas/testing-evidence-quarantine-v1.json +0 -168
  662. package/src/schemas/testing-evidence-result-v1.json +0 -319
  663. package/src/secrets/aws-control-plane.d.ts +0 -29
  664. package/src/secrets/aws-control-plane.js +0 -322
  665. package/src/secrets/generated-aws-control-plane.d.ts +0 -33
  666. package/src/secrets/generated-aws-control-plane.js +0 -322
  667. package/src/secrets/guardrails.d.ts +0 -26
  668. package/src/secrets/guardrails.js +0 -328
  669. package/src/secrets/metadata.d.ts +0 -48
  670. package/src/secrets/metadata.js +0 -199
  671. package/src/secrets/operator.d.ts +0 -190
  672. package/src/secrets/operator.js +0 -701
  673. package/src/secrets/verification.d.ts +0 -18
  674. package/src/secrets/verification.js +0 -152
  675. package/src/supply-chain/action-pins.d.ts +0 -26
  676. package/src/supply-chain/action-pins.js +0 -262
  677. package/src/supply-chain/blueprint-trust-git.d.ts +0 -130
  678. package/src/supply-chain/blueprint-trust-git.js +0 -1642
  679. package/src/supply-chain/blueprint-trust-process.d.ts +0 -4
  680. package/src/supply-chain/blueprint-trust-process.js +0 -88
  681. package/src/supply-chain/blueprint-trust.d.ts +0 -354
  682. package/src/supply-chain/blueprint-trust.js +0 -1558
  683. package/src/supply-chain/blueprint-verification-authority.d.ts +0 -62
  684. package/src/supply-chain/blueprint-verification-authority.js +0 -661
  685. package/src/supply-chain/blueprint-verification-execution.d.ts +0 -68
  686. package/src/supply-chain/blueprint-verification-execution.js +0 -639
  687. package/src/supply-chain/build-output-bounds.d.ts +0 -2
  688. package/src/supply-chain/build-output-bounds.js +0 -12
  689. package/src/supply-chain/build-output.d.ts +0 -41
  690. package/src/supply-chain/build-output.js +0 -551
  691. package/src/supply-chain/common.d.ts +0 -21
  692. package/src/supply-chain/common.js +0 -107
  693. package/src/supply-chain/container-artifact-contract.d.ts +0 -23
  694. package/src/supply-chain/container-artifact-contract.js +0 -208
  695. package/src/supply-chain/container-release.d.ts +0 -119
  696. package/src/supply-chain/container-release.js +0 -496
  697. package/src/supply-chain/ecr-applicability.d.ts +0 -19
  698. package/src/supply-chain/ecr-applicability.js +0 -103
  699. package/src/supply-chain/ecr-scanning.d.ts +0 -85
  700. package/src/supply-chain/ecr-scanning.js +0 -325
  701. package/src/supply-chain/ecs-deployed-image.d.ts +0 -87
  702. package/src/supply-chain/ecs-deployed-image.js +0 -302
  703. package/src/supply-chain/errors.d.ts +0 -6
  704. package/src/supply-chain/errors.js +0 -15
  705. package/src/supply-chain/generated-blueprint-trust-command.d.ts +0 -4
  706. package/src/supply-chain/generated-blueprint-trust-command.js +0 -1379
  707. package/src/supply-chain/generated-command.d.ts +0 -1
  708. package/src/supply-chain/generated-command.js +0 -775
  709. package/src/supply-chain/generated-container-release-command.d.ts +0 -16
  710. package/src/supply-chain/generated-container-release-command.js +0 -3248
  711. package/src/supply-chain/generated-ecr-collector-command.d.ts +0 -20
  712. package/src/supply-chain/generated-ecr-collector-command.js +0 -1445
  713. package/src/supply-chain/generated-files.d.ts +0 -13
  714. package/src/supply-chain/generated-files.js +0 -421
  715. package/src/supply-chain/generated-scanner-command.d.ts +0 -1
  716. package/src/supply-chain/generated-scanner-command.js +0 -778
  717. package/src/supply-chain/index.d.ts +0 -28
  718. package/src/supply-chain/index.js +0 -36
  719. package/src/supply-chain/inventory.d.ts +0 -96
  720. package/src/supply-chain/inventory.js +0 -828
  721. package/src/supply-chain/license-expression.d.ts +0 -7
  722. package/src/supply-chain/license-expression.js +0 -128
  723. package/src/supply-chain/policy.d.ts +0 -105
  724. package/src/supply-chain/policy.js +0 -304
  725. package/src/supply-chain/publication.d.ts +0 -48
  726. package/src/supply-chain/publication.js +0 -85
  727. package/src/supply-chain/sbom.d.ts +0 -228
  728. package/src/supply-chain/sbom.js +0 -913
  729. package/src/supply-chain/scanner.d.ts +0 -77
  730. package/src/supply-chain/scanner.js +0 -514
  731. package/src/supply-chain/vendored-source.d.ts +0 -95
  732. package/src/supply-chain/vendored-source.js +0 -315
  733. package/src/testing-evidence/fixture-scope.d.ts +0 -53
  734. package/src/testing-evidence/fixture-scope.js +0 -142
  735. package/src/testing-evidence/index.d.ts +0 -5
  736. package/src/testing-evidence/index.js +0 -9
  737. package/src/testing-evidence/quarantine.d.ts +0 -48
  738. package/src/testing-evidence/quarantine.js +0 -253
  739. package/src/testing-evidence/result.d.ts +0 -109
  740. package/src/testing-evidence/result.js +0 -585
  741. package/src/testing-evidence/runner-adapter.d.ts +0 -51
  742. package/src/testing-evidence/runner-adapter.js +0 -288
  743. package/src/testing-evidence/sensitive-artifacts.d.ts +0 -13
  744. package/src/testing-evidence/sensitive-artifacts.js +0 -93
  745. package/src/work-markers/index.d.ts +0 -1
  746. package/src/work-markers/index.js +0 -5
  747. package/src/work-markers/work-markers.d.ts +0 -39
  748. package/src/work-markers/work-markers.js +0 -360
  749. package/src/workload-roles/account-baseline.d.ts +0 -143
  750. package/src/workload-roles/account-baseline.js +0 -980
  751. package/src/workload-roles/authority.d.ts +0 -40
  752. package/src/workload-roles/authority.js +0 -202
  753. package/src/workload-roles/aws-adapter.d.ts +0 -99
  754. package/src/workload-roles/aws-adapter.js +0 -416
  755. package/src/workload-roles/aws-internal-handler.d.ts +0 -27
  756. package/src/workload-roles/aws-internal-handler.js +0 -58
  757. package/src/workload-roles/aws-s3-state.d.ts +0 -52
  758. package/src/workload-roles/aws-s3-state.js +0 -191
  759. package/src/workload-roles/aws-sdk-control-plane.d.ts +0 -12
  760. package/src/workload-roles/aws-sdk-control-plane.js +0 -291
  761. package/src/workload-roles/boundary.d.ts +0 -34
  762. package/src/workload-roles/boundary.js +0 -137
  763. package/src/workload-roles/convergence.d.ts +0 -66
  764. package/src/workload-roles/convergence.js +0 -186
  765. package/src/workload-roles/handler.d.ts +0 -43
  766. package/src/workload-roles/handler.js +0 -158
  767. package/src/workload-roles/history.d.ts +0 -47
  768. package/src/workload-roles/history.js +0 -324
  769. package/src/workload-roles/injection.d.ts +0 -119
  770. package/src/workload-roles/injection.js +0 -495
  771. package/src/workload-roles/manifest.d.ts +0 -54
  772. package/src/workload-roles/manifest.js +0 -343
  773. package/src/workload-roles/provisioner.d.ts +0 -70
  774. package/src/workload-roles/provisioner.js +0 -239
  775. package/src/workload-roles/registration.d.ts +0 -102
  776. package/src/workload-roles/registration.js +0 -462
  777. package/src/workload-roles/stage-boundary.d.ts +0 -31
  778. package/src/workload-roles/stage-boundary.js +0 -208
  779. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.d.ts +0 -0
  780. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.js +0 -0
@@ -1,159 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SERVICE_WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS = exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS = void 0;
3
+ exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS = void 0;
4
4
  exports.createWorkloadFilePlan = createWorkloadFilePlan;
5
5
  exports.workloadGenerator = workloadGenerator;
6
- const deterministic_order_js_1 = require("../../deterministic-order.js");
7
- const observability_infrastructure_js_1 = require("../observability-infrastructure.js");
8
- const observability_policy_js_1 = require("../observability-policy.js");
9
6
  const node_path_1 = require("node:path");
10
- const index_js_1 = require("../../ownership/index.js");
11
7
  const capability_plan_js_1 = require("../../foundation/capability-plan.js");
12
- const preview_changes_js_1 = require("../../developer-agent/preview-changes.js");
13
- const upgrade_js_1 = require("../upgrade/upgrade.js");
14
- const built_in_plan_foundation_files_js_1 = require("../slice/built-in-plan-foundation-files.js");
15
- const feature_registry_js_1 = require("../feature-registry.js");
8
+ const index_js_1 = require("../../ownership/index.js");
16
9
  const formatting_js_1 = require("../formatting.js");
17
- const logging_registry_js_1 = require("../logging-registry.js");
10
+ const function_js_1 = require("../function/function.js");
18
11
  const post_generation_install_js_1 = require("../post-generation-install.js");
19
12
  const tool_versions_js_1 = require("../preset/tool-versions.js");
20
- const workspace_files_js_1 = require("../preset/workspace-files.js");
21
- const built_in_plan_js_1 = require("../slice/built-in-plan.js");
22
- const built_in_plan_shared_js_1 = require("../slice/built-in-plan-shared.js");
13
+ const generation_tree_js_1 = require("../slice/generation-tree.js");
14
+ const framework_packages_js_1 = require("../upgrade/framework-packages.js");
23
15
  const frozen_container_js_1 = require("./frozen-container.js");
24
- const performance_registration_js_1 = require("./performance-registration.js");
25
- const reliability_registration_js_1 = require("./reliability-registration.js");
26
- const service_performance_files_js_1 = require("./service-performance-files.js");
27
- const RELEASE_REGISTRY_PATH = 'operations/release.json';
28
- function name(value, label) {
29
- const normalized = value.trim();
30
- if (!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(normalized)) {
31
- throw new Error(`${label} must start with a lowercase letter and use only lowercase letters, numbers, and hyphens.`);
32
- }
33
- return normalized;
34
- }
35
- function pascal(value) {
36
- return value
37
- .split('-')
38
- .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
39
- .join('');
40
- }
41
- function replaceMarker(tree, path, marker, line) {
42
- const source = tree.read(path, 'utf8');
43
- if (source === null || !source.includes(marker)) {
44
- throw new Error(`Product Slice composition marker ${marker} is missing from ${path}.`);
45
- }
46
- tree.write(path, source.replace(marker, `${line}\n${marker}`));
47
- }
48
- function requireCompositionMarker(tree, path, marker) {
49
- const source = tree.read(path, 'utf8');
50
- if (source === null || !source.includes(marker)) {
51
- throw new Error(`Product Slice composition marker ${marker} is missing from ${path}.`);
52
- }
53
- }
54
- function json(value) {
55
- return `${JSON.stringify(value, null, 2)}\n`;
56
- }
57
- function registerReleaseArtifact(tree, sliceRoot, slice, workload, kind) {
58
- const path = node_path_1.posix.join(sliceRoot, RELEASE_REGISTRY_PATH);
59
- const source = tree.read(path, 'utf8');
60
- if (source === null) {
61
- throw new Error(`Product Slice release registry is missing from ${path}.`);
62
- }
63
- let release;
64
- try {
65
- release = JSON.parse(source);
66
- }
67
- catch {
68
- throw new Error(`Product Slice release registry is invalid at ${path}.`);
69
- }
70
- if (release.schemaVersion !== 1 ||
71
- !Array.isArray(release.artifactInventory)) {
72
- throw new Error(`Product Slice release registry lacks a v1 artifact inventory at ${path}.`);
73
- }
74
- const id = `${slice}.${kind}.${workload}`;
75
- const name = `${slice}-${kind}-${workload}`;
76
- if (release.artifactInventory.some((entry) => entry.id === id || entry.name === name)) {
77
- throw new Error(`Release artifact ${id} is already registered.`);
78
- }
79
- release.artifactInventory.push({
80
- candidate: {
81
- materialPaths: [
82
- `packages/${slice}/${kind === 'service' ? 'services' : 'jobs'}/${workload}/dist`,
83
- ],
84
- recipePaths: [
85
- 'pnpm-lock.yaml',
86
- `packages/${slice}/${kind === 'service' ? 'services' : 'jobs'}/${workload}/Dockerfile`,
87
- `packages/${slice}/${kind === 'service' ? 'services' : 'jobs'}/${workload}/package.json`,
88
- `packages/${slice}/sst.config.ts`,
89
- ],
90
- sourceInputPaths: [
91
- `packages/${slice}/${kind === 'service' ? 'services' : 'jobs'}/${workload}/src`,
92
- `packages/${slice}/${kind === 'service' ? 'services' : 'jobs'}/${workload}/tsconfig.json`,
93
- ],
94
- },
95
- classification: 'stage-neutral',
96
- finalArtifact: {
97
- container: {
98
- context: '.',
99
- dockerfile: `packages/${slice}/${kind === 'service' ? 'services' : 'jobs'}/${workload}/Dockerfile`,
100
- nativeLifecycleProof: kind === 'service' ? 'service-default-health' : 'job-default-success',
101
- proofEntrypoints: [kind === 'service' ? 'dist/main.js' : 'dist/run.js'],
102
- proofImports: [
103
- '@aws-sdk/client-appconfigdata',
104
- '@empire-builder-kit/runtime/logging',
105
- ],
106
- role: kind,
107
- },
108
- family: 'oci-image',
109
- imageConsumption: 'digest-qualified',
110
- support: 'supported',
111
- },
112
- id,
113
- name,
114
- workload: kind,
115
- });
116
- release.artifactInventory.sort((left, right) => (0, deterministic_order_js_1.compareUtf16)(String(left.id), String(right.id)));
117
- tree.write(path, json(release));
118
- }
119
16
  exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS = [
120
17
  '/name',
18
+ '/version',
121
19
  '/private',
122
20
  '/type',
123
- '/version',
124
- '/scripts/build',
125
- '/scripts/docker-build',
126
- '/scripts/dev',
127
- '/scripts/lint',
128
- '/scripts/test',
129
- '/scripts/typecheck',
130
- '/scripts/verify',
131
21
  '/dependencies/@empire-builder-kit~1runtime',
132
- '/dependencies/@aws-sdk~1client-appconfigdata',
133
- '/devDependencies/@types~1node',
134
- '/devDependencies/typescript',
135
- '/devDependencies/vitest',
136
- ];
137
- exports.SERVICE_WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS = [
138
- ...exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS,
139
- '/dependencies/@aws-sdk~1client-dynamodb',
140
- '/dependencies/sst',
141
22
  ];
142
- function createWorkloadFilePlan(workspace, slice, workload, kind, runtimeVersion, feature, ownsProtectedLoadAdapter, protectedRuntimeStages) {
143
- const plural = kind === 'service' ? 'services' : 'jobs';
144
- const relativeRoot = node_path_1.posix.join(plural, workload);
145
- const className = `${pascal(slice)}${pascal(workload)}${pascal(kind)}`;
23
+ function createWorkloadFilePlan(workspace, slice, workload, kind, runtimeVersion, feature) {
24
+ const service = kind === 'service';
25
+ const relativeRoot = `${kind}s/${workload}`;
26
+ const className = `${(0, function_js_1.pascal)(slice)}${(0, function_js_1.pascal)(workload)}${(0, function_js_1.pascal)(kind)}`;
146
27
  const factoryName = `register${className}`;
147
- const resource = kind === 'service' ? 'Service' : 'Task';
148
- const entry = kind === 'service' ? 'dist/main.js' : 'dist/run.js';
149
- const sourceName = kind === 'service' ? 'main.ts' : 'run.ts';
28
+ const resource = service ? 'Service' : 'Task';
29
+ const entry = service ? 'main' : 'run';
150
30
  const packageName = `@${slice}/${kind}-${workload}`;
31
+ const workspacePath = `packages/${slice}/${relativeRoot}`;
32
+ const json = (value) => JSON.stringify(value, null, 2) + '\n';
151
33
  const files = {
152
- ...(kind === 'service'
153
- ? {
154
- [`${relativeRoot}/src/service-runtime.ts`]: 'export const DEFAULT_SERVICE_PORT = 3000 as const;\n',
155
- }
156
- : {}),
157
34
  [`${relativeRoot}/package.json`]: json({
158
35
  name: packageName,
159
36
  private: true,
@@ -161,24 +38,14 @@ function createWorkloadFilePlan(workspace, slice, workload, kind, runtimeVersion
161
38
  version: '0.0.0',
162
39
  scripts: {
163
40
  build: 'tsc -p tsconfig.json',
164
- 'docker-build': 'docker build -f Dockerfile ' +
165
- `-t ${slice}-${kind}-${workload}:local ../../../..`,
166
- dev: `node --experimental-strip-types ${kind === 'service' ? 'src/main.ts' : 'src/run.ts'}`,
41
+ 'docker-build': `docker build -f Dockerfile -t ${slice}-${kind}-${workload}:local ../../../..`,
42
+ dev: `node --experimental-strip-types src/${entry}.ts`,
167
43
  lint: 'eslint .',
168
44
  test: 'vitest run',
169
45
  typecheck: 'tsc --noEmit -p tsconfig.json',
170
46
  verify: 'pnpm run lint && pnpm run typecheck && pnpm test && pnpm run build',
171
47
  },
172
- dependencies: {
173
- '@aws-sdk/client-appconfigdata': built_in_plan_shared_js_1.PRODUCT_VERSIONS.awsAppConfigData,
174
- ...(kind === 'service' && ownsProtectedLoadAdapter
175
- ? {
176
- '@aws-sdk/client-dynamodb': built_in_plan_shared_js_1.PRODUCT_VERSIONS.awsDynamoDb,
177
- sst: tool_versions_js_1.WORKSPACE_SST_VERSION,
178
- }
179
- : {}),
180
- '@empire-builder-kit/runtime': runtimeVersion,
181
- },
48
+ dependencies: { '@empire-builder-kit/runtime': runtimeVersion },
182
49
  devDependencies: {
183
50
  '@types/node': '25.5.0',
184
51
  typescript: '~5.9.2',
@@ -187,9 +54,7 @@ function createWorkloadFilePlan(workspace, slice, workload, kind, runtimeVersion
187
54
  }),
188
55
  [`${relativeRoot}/tsconfig.json`]: json({
189
56
  compilerOptions: {
190
- forceConsistentCasingInFileNames: true,
191
57
  module: 'nodenext',
192
- moduleResolution: 'nodenext',
193
58
  noEmitOnError: true,
194
59
  outDir: 'dist',
195
60
  rootDir: 'src',
@@ -199,879 +64,135 @@ function createWorkloadFilePlan(workspace, slice, workload, kind, runtimeVersion
199
64
  },
200
65
  include: ['src/**/*.ts'],
201
66
  }),
202
- [`${relativeRoot}/vitest.config.ts`]: `import { configDefaults, defineConfig } from 'vitest/config';\n\nexport default defineConfig({\n test: {\n environment: 'node',\n exclude: [...configDefaults.exclude, '**/dist/**'],\n },\n});\n`,
67
+ [`${relativeRoot}/vitest.config.ts`]: `import { defineConfig } from 'vitest/config';
68
+ export default defineConfig({ test: { include: ['src/**/*.spec.ts'] } });
69
+ `,
203
70
  [`${relativeRoot}/Dockerfile`]: (0, frozen_container_js_1.renderFrozenWorkloadDockerfile)({
204
- entry,
71
+ entry: `dist/${entry}.js`,
205
72
  packageName,
206
- workspacePath: `packages/${slice}/${relativeRoot}`,
73
+ workspacePath,
207
74
  }),
208
- [`${relativeRoot}/README.md`]: `# ${workload} ${kind}\n\nOwned by the ${slice} Product Slice. Run build, test, typecheck, verify, dev, and docker-build through this package's inferred Nx targets. Add runtime dependencies with \`pnpm --filter @${slice}/${kind}-${workload} add <package>\`; EBK upgrades preserve adopter-owned manifest keys and the production image retains installed runtime dependencies. Document ${kind === 'service' ? 'health, scaling, and rollback' : 'invocation, retry, idempotency, and failure recovery'} before production use.\n`,
209
- [`${relativeRoot}/src/${sourceName}`]: kind === 'service'
210
- ? `import { createLogger, type Logger } from '@empire-builder-kit/runtime/logging';\nimport { createServer } from 'node:http';\nimport { hostProviderDeliveryAssignment } from './provider-delivery.js';\n\nexport function healthResponse(path: string | undefined) {\n const healthy = path === '/health';\n return { body: { service: '${workload}', status: healthy ? 'ok' : 'not_found' }, status: healthy ? 200 : 404 };\n}\n\nfunction serviceLogger(): Logger {\n return createLogger({\n component: 'service-${workload}',\n feature: '${feature}',\n operation: 'serve',\n slice: '${slice}',\n stage: process.env.EBK_STAGE ?? 'development',\n workspace: '${workspace}',\n });\n}\n\nexport async function start(logger = serviceLogger()) {\n const port = Number(process.env.PORT ?? 3000);\n const assignment = await hostProviderDeliveryAssignment(\n 'service-${slice}-${workload}-host-v1',\n );\n logger.info('${workload} service starting', {\n attributes: { port, providerDeliveryAssigned: assignment.assigned },\n });\n const server = createServer((request, response) => {\n const result = healthResponse(request.url);\n logger.info('${workload} service health request completed', {\n attributes: { httpStatus: result.status },\n outcome: result.status === 200 ? 'success' : 'failure',\n });\n response.writeHead(result.status, { 'content-type': 'application/json' });\n response.end(JSON.stringify(result.body));\n });\n server.on('error', (error) => {\n logger.error('${workload} service failed', { error, outcome: 'failure' });\n });\n return server.listen(port, () => {\n logger.info('${workload} service started', { outcome: 'success' });\n });\n}\n\nif (import.meta.url === new URL(process.argv[1] ?? '', 'file:').href) {\n await start();\n}\n`
211
- : `import { createLogger, type Logger } from '@empire-builder-kit/runtime/logging';\nimport { hostProviderDeliveryAssignment } from './provider-delivery.js';\n\nfunction jobLogger(): Logger {\n return createLogger({\n component: 'job-${workload}',\n feature: '${feature}',\n operation: 'run',\n slice: '${slice}',\n stage: process.env.EBK_STAGE ?? 'development',\n workspace: '${workspace}',\n });\n}\n\nexport async function run(logger = jobLogger()) {\n logger.info('${workload} job started', {\n attributes: { trigger: process.env.JOB_TRIGGER ?? 'manual' },\n });\n try {\n const assignment = await hostProviderDeliveryAssignment(\n 'job-${slice}-${workload}-host-v1',\n );\n const result = { ok: true, providerDeliveryAssigned: assignment.assigned };\n logger.info('${workload} job completed', { outcome: 'success' });\n return result;\n } catch (error) {\n logger.error('${workload} job failed', { error, outcome: 'failure' });\n throw error;\n }\n}\n\nif (import.meta.url === new URL(process.argv[1] ?? '', 'file:').href) {\n await run();\n}\n`,
212
- [`${relativeRoot}/src/workload.spec.ts`]: kind === 'service'
213
- ? `import { describe, expect, it } from 'vitest';\nimport { healthResponse } from './main.js';\n\ndescribe('${workload} service', () => {\n it('reports healthy only on the health endpoint', () => {\n expect(healthResponse('/health')).toEqual({ body: { service: '${workload}', status: 'ok' }, status: 200 });\n expect(healthResponse('/missing').status).toBe(404);\n });\n});\n`
214
- : `import { createLogger, type LogEntry } from '@empire-builder-kit/runtime/logging';\nimport { describe, expect, it } from 'vitest';\nimport { run } from './run.js';\n\ndescribe('${workload} job', () => {\n it('emits canonical start and completion records', async () => {\n const entries: LogEntry[] = [];\n const logger = createLogger({\n component: 'job-${workload}', feature: '${feature}', operation: 'run',\n slice: '${slice}', stage: 'test', workspace: '${workspace}',\n sink: (entry) => entries.push(entry as LogEntry),\n });\n await expect(run(logger)).resolves.toEqual({\n ok: true,\n providerDeliveryAssigned: false,\n });\n expect(entries.map(({ message, outcome }) => ({ message, outcome }))).toEqual([\n { message: '${workload} job started', outcome: undefined },\n { message: '${workload} job completed', outcome: 'success' },\n ]);\n });\n});\n`,
215
- [`${relativeRoot}/infra.ts`]: `import { createManagedLogGroupContract } from '@empire-builder-kit/nx/foundation';\nimport { standardSliceExtensionTaskFamily } from '../../infra/workload-roles/effective-intent.js';\n\nexport function ${factoryName}(\n cluster: any,\n alertTopicArn: any,\n roles?: { executionRole: string; taskRole: string },\n links: any[] = [],\n configuration?: {\n applicationId: any;\n deployment: any;\n environmentId: any;\n profileId: any;\n },\n) {\n const contract = createManagedLogGroupContract({\n component: '${kind}-${workload}',\n slice: '${slice}',\n stage: $app.stage,\n workspace: '${workspace}',\n });\n const workload = new sst.aws.${resource}('${className}', {\n ...(roles ?? {}),\n cluster,\n environment: {\n EBK_STAGE: $app.stage,\n ...(configuration\n ? {\n EBK_APPCONFIG_APPLICATION_ID: configuration.applicationId,\n EBK_APPCONFIG_ENVIRONMENT_ID: configuration.environmentId,\n EBK_APPCONFIG_PROFILE_ID: configuration.profileId,\n }\n : {}),\n },\n link: links,\n ${kind === 'service' ? "image: { context: './services/" + workload + "', dockerfile: 'Dockerfile' },\n health: { command: ['CMD-SHELL', 'wget -qO- http://localhost:3000/health || exit 1'] },\n logging: { name: contract.name, retention: '1 month' },\n serviceRegistry: { port: 3000 }," : "image: { context: './jobs/" + workload + "', dockerfile: 'Dockerfile' },\n logging: { name: contract.name, retention: '1 month' },"}\n transform: {\n logGroup: {\n logGroupClass: contract.logGroupClass,\n tags: contract.tags,\n },\n taskDefinition: {\n family: standardSliceExtensionTaskFamily(\n $app.stage,\n '${workload}',\n '${kind}',\n ),\n },\n },\n }, configuration?.deployment\n ? { dependsOn: [configuration.deployment] }\n : {});\n${kind === 'service' ? ' if ($dev) return workload;\n' : ''} const dataProtection = new aws.cloudwatch.LogDataProtectionPolicy(\n '${className}LogDataProtection',\n {\n logGroupName: contract.name,\n policyDocument: JSON.stringify(contract.dataProtectionPolicy),\n },\n { dependsOn: [workload.nodes.taskDefinition] },\n );\n const dataProtectionAlarm = new aws.cloudwatch.MetricAlarm(\n '${className}LogDataProtectionFindings',\n {\n alarmActions: [alertTopicArn],\n comparisonOperator: 'GreaterThanOrEqualToThreshold',\n dimensions: { LogGroupName: contract.name },\n evaluationPeriods: 1,\n metricName: 'LogEventsWithFindings',\n namespace: 'AWS/Logs',\n period: 300,\n statistic: 'Sum',\n threshold: 1,\n treatMissingData: 'notBreaching',\n },\n { dependsOn: [dataProtection] },\n );\n void dataProtectionAlarm;\n return workload;\n}\n`,
216
- };
217
- if (kind === 'service') {
218
- const serviceMainPath = `${relativeRoot}/src/main.ts`;
219
- const serviceInfrastructurePath = `${relativeRoot}/infra.ts`;
220
- const mainSource = files[serviceMainPath] ?? '';
221
- const infrastructureSource = files[serviceInfrastructurePath] ?? '';
222
- if (!mainSource.includes("import { hostProviderDeliveryAssignment } from './provider-delivery.js';\n") ||
223
- !mainSource.includes('process.env.PORT ?? 3000') ||
224
- !infrastructureSource.includes("import { standardSliceExtensionTaskFamily } from '../../infra/workload-roles/effective-intent.js';\n") ||
225
- !infrastructureSource.includes("health: { command: ['CMD-SHELL', 'wget -qO- http://localhost:3000/health || exit 1'] },") ||
226
- !infrastructureSource.includes('serviceRegistry: { port: 3000 },')) {
227
- throw new Error('Built-in Service runtime is missing its shared port integration point.');
228
- }
229
- files[serviceMainPath] = mainSource
230
- .replace("import { hostProviderDeliveryAssignment } from './provider-delivery.js';\n", "import { hostProviderDeliveryAssignment } from './provider-delivery.js';\nimport { DEFAULT_SERVICE_PORT } from './service-runtime.js';\n")
231
- .replace('process.env.PORT ?? 3000', 'process.env.PORT ?? DEFAULT_SERVICE_PORT');
232
- files[serviceInfrastructurePath] = infrastructureSource
233
- .replace("import { standardSliceExtensionTaskFamily } from '../../infra/workload-roles/effective-intent.js';\n", "import { standardSliceExtensionTaskFamily } from '../../infra/workload-roles/effective-intent.js';\nimport { DEFAULT_SERVICE_PORT } from './src/service-runtime.js';\n")
234
- .replace("health: { command: ['CMD-SHELL', 'wget -qO- http://localhost:3000/health || exit 1'] },", "health: { command: ['CMD-SHELL', 'wget -qO- http://localhost:' + DEFAULT_SERVICE_PORT + '/health || exit 1'] },")
235
- .replace('serviceRegistry: { port: 3000 },', 'serviceRegistry: { port: DEFAULT_SERVICE_PORT },');
236
- }
237
- const nativeAuthorityInfrastructurePath = `${relativeRoot}/infra.ts`;
238
- const nativeAuthorityInfrastructure = files[nativeAuthorityInfrastructurePath] ?? '';
239
- const nativeAuthoritySeams = [
240
- '../../infra/workload-roles/effective-intent.js',
241
- ' roles?: { executionRole: string; taskRole: string },',
242
- ' ...(roles ?? {}),',
243
- ];
244
- if (nativeAuthoritySeams.some((fragment) => !nativeAuthorityInfrastructure.includes(fragment))) {
245
- throw new Error(`Built-in ${kind} infrastructure is missing its native permission integration point.`);
246
- }
247
- files[nativeAuthorityInfrastructurePath] = nativeAuthorityInfrastructure
248
- .replace('../../infra/workload-roles/effective-intent.js', '../../infra/native-runtime-authority/effective-intent.js')
249
- .replace(' roles?: { executionRole: string; taskRole: string },', ' permissions: any,')
250
- .replace(' ...(roles ?? {}),', ' permissions,');
251
- if (kind === 'service' && ownsProtectedLoadAdapter) {
252
- const mainPath = `${relativeRoot}/src/main.ts`;
253
- let mainSource = files[mainPath] ?? '';
254
- const replaceMainFragment = (expected, replacement) => {
255
- if (!mainSource.includes(expected)) {
256
- throw new Error('Built-in Service runtime is missing its protected performance integration point.');
257
- }
258
- mainSource = mainSource.replace(expected, replacement);
259
- };
260
- replaceMainFragment(`import { hostProviderDeliveryAssignment } from './provider-delivery.js';\n`, `import { hostProviderDeliveryAssignment } from './provider-delivery.js';\nimport { serveProtectedServicePerformanceRequest } from './performance.js';\n`);
261
- replaceMainFragment('export async function start(logger = serviceLogger()) {', `export async function start(\n logger = serviceLogger(),\n performanceHandler = serveProtectedServicePerformanceRequest,\n) {`);
262
- replaceMainFragment(` const server = createServer((request, response) => {\n const result = healthResponse(request.url);`, ` const server = createServer(async (request, response) => {\n const path = request.url?.split('?')[0];\n if (\n path === '/${slice}/__ebk/performance/service' ||\n path === '/${slice}/__ebk/performance/service/cleanup'\n ) {\n try {\n await performanceHandler(request, response);\n } catch (error) {\n logger.error('${workload} protected performance request failed', {\n error,\n outcome: 'failure',\n });\n if (!response.headersSent) {\n response.writeHead(404, { 'content-type': 'application/json' });\n response.end(JSON.stringify({\n kind: 'ebk-protected-load-endpoint-refusal',\n status: 'not-found',\n }));\n } else {\n response.destroy();\n }\n }\n return;\n }\n const result = healthResponse(request.url);`);
263
- replaceMainFragment(`response.writeHead(404, { 'content-type': 'application/json' });`, `response.writeHead(404, {
264
- 'cache-control': 'no-store',
265
- 'content-type': 'application/json',
266
- });`);
267
- files[mainPath] = mainSource;
268
- Object.assign(files, (0, service_performance_files_js_1.renderServicePerformanceFiles)({
269
- protectedRuntimeStages,
75
+ [`${relativeRoot}/README.md`]: `# ${workload} ${kind}
76
+
77
+ Run build, test, typecheck, verify, dev, and docker-build through the project's inferred Nx targets.
78
+ ${service ? 'The service answers /health for the ECS health check.' : 'Invoke the ECS task when the job should run.'}
79
+ `,
80
+ [`${relativeRoot}/src/${entry}.ts`]: renderWorkloadEntry({
81
+ entry,
82
+ feature,
83
+ kind,
270
84
  slice,
271
85
  workload,
272
- }));
273
- }
274
- const infrastructurePath = `${relativeRoot}/infra.ts`;
275
- const packageLocalImage = `image: { context: './${plural}/${workload}', dockerfile: 'Dockerfile' }`;
276
- const protectedReleaseImage = 'image: container.image';
277
- let infrastructureSource = files[infrastructurePath] ?? '';
278
- const replaceInfrastructureFragment = (expected, replacement) => {
279
- if (!infrastructureSource.includes(expected)) {
280
- throw new Error(`Built-in ${kind} infrastructure is missing its performance integration point.`);
281
- }
282
- infrastructureSource = infrastructureSource.replace(expected, replacement);
283
- };
284
- replaceInfrastructureFragment(`import { createManagedLogGroupContract } from '@empire-builder-kit/nx/foundation';
285
- `, `import { createManagedLogGroupContract } from '@empire-builder-kit/nx/foundation';
286
- import { createStandardResourceTags } from '@empire-builder-kit/nx/performance';
287
- import { resolveStandardContainerImage } from '../../infra/container-images.js';
288
- `);
289
- replaceInfrastructureFragment(` alertTopicArn: any,
290
- permissions: any,
291
- `, ` alertTopicArn: any,
292
- performance: {
293
- frameworkVersion: string;
294
- owner: string;
295
- productionProfile: 'cost-optimized' | 'balanced' | 'standard';
296
- repository: string;
297
- },
298
- ${kind !== 'service' || ownsProtectedLoadAdapter
299
- ? ` performanceDeploymentBinding: {
300
- candidateDigest: string;
301
- releaseId: string;
302
- releaseMaterialDigest: string;
303
- target: {
304
- accountFingerprint: string;
305
- origin: any;
306
- region: string;
307
- slice: string;
308
- };
309
- } | undefined,
310
- `
311
- : ''}${kind === 'service' && ownsProtectedLoadAdapter
312
- ? ` performanceIngress: {
313
- api: any;
314
- originProof: any;
315
- router: any;
316
- } | undefined,
317
- `
318
- : ''} permissions: any,
319
- `);
320
- replaceInfrastructureFragment(` workspace: '${workspace}',
321
- });
322
- const workload = new sst.aws.${resource}`, ` workspace: '${workspace}',
323
- });
324
- const standardTags = createStandardResourceTags({
325
- ...performance,
326
- slice: '${slice}',
327
- stage: $app.stage,
328
- workspace: '${workspace}',
329
- });
330
- const container = resolveStandardContainerImage({
331
- artifactId: '${slice}.${kind}.${workload}',
332
- local: {
333
- context: '../..',
334
- dockerfile: 'packages/${slice}/${relativeRoot}/Dockerfile',
335
- },
336
- sourceCommit: process.env.EBK_RELEASE_SOURCE_COMMIT ??
337
- process.env.EBK_SOURCE_COMMIT ?? '',
338
- stage: $app.stage,
339
- });
340
- const workload = new sst.aws.${resource}`);
341
- replaceInfrastructureFragment(` environment: {
342
- EBK_STAGE: $app.stage,
343
- `, ` environment: {
344
- ...container.environment,
345
- EBK_STAGE: $app.stage,
346
- `);
347
- replaceInfrastructureFragment(` tags: contract.tags,
348
- `, ` tags: { ...contract.tags, ...standardTags },
349
- `);
350
- replaceInfrastructureFragment(` taskDefinition: {
351
- `, `${kind === 'service' ? ' service: { tags: standardTags },\n' : ''} taskDefinition: {
352
- `);
353
- replaceInfrastructureFragment(` '${kind}',
354
- ),
355
- },
356
- `, ` '${kind}',
357
- ),
358
- tags: standardTags,
359
- },
360
- `);
361
- replaceInfrastructureFragment(` treatMissingData: 'notBreaching',
362
- `, ` tags: standardTags,
363
- treatMissingData: 'notBreaching',
364
- `);
365
- replaceInfrastructureFragment(` alarmActions: [alertTopicArn],
366
- comparisonOperator: 'GreaterThanOrEqualToThreshold',
367
- `, ` alarmActions: [alertTopicArn],
368
- alarmDescription: JSON.stringify({
369
- businessSymptom:
370
- '${kind} ${workload} emitted a protected-data log finding.',
371
- id: 'data-protection-findings',
372
- owner: '${slice}-product',
373
- route: '${slice}-on-call',
374
- runbook: 'docs/runbooks/log-investigation.md',
375
- schemaVersion: 1,
376
- slice: '${slice}',
377
- }),
378
- comparisonOperator: 'GreaterThanOrEqualToThreshold',
379
- `);
380
- replaceInfrastructureFragment(` void dataProtectionAlarm;
381
- return workload;
382
- `, ` void dataProtectionAlarm;
383
- ${kind === 'job'
384
- ? `const reliabilityTaskStopped = new aws.cloudwatch.EventRule(
385
- '${className}EssentialContainerStopped',
386
- {
387
- description:
388
- 'AWS-native hard-crash signal for the exact ${workload} Job task family.',
389
- eventPattern: $jsonStringify({
390
- 'detail-type': ['ECS Task State Change'],
391
- detail: {
392
- lastStatus: ['STOPPED'],
393
- stopCode: ['EssentialContainerExited'],
394
- taskDefinitionArn: [
395
- {
396
- wildcard: $interpolate\`*task-definition/\${standardSliceExtensionTaskFamily(
397
- $app.stage,
398
- '${workload}',
399
- 'job',
400
- )}:*\`,
401
- },
402
- ],
403
- },
404
- source: ['aws.ecs'],
405
- }),
406
- },
407
- );`
408
- : ''}
409
- const reliabilityAlarm = new aws.cloudwatch.MetricAlarm(
410
- '${className}Reliability',
411
- {
412
- alarmActions: [alertTopicArn],
413
- alarmDescription: JSON.stringify({
414
- businessSymptom:
415
- '${kind === 'service'
416
- ? `${workload} Service task presence is below one or telemetry is missing.`
417
- : `${workload} Job essential container exited.`}',
418
- id: '${kind === 'service'
419
- ? `service-${workload}-health`
420
- : `job-${workload}-failure`}',
421
- owner: '${slice}-product',
422
- route: '${slice}-on-call',
423
- runbook: '${relativeRoot}/RUNBOOK.md',
424
- schemaVersion: 1,
425
- slice: '${slice}',
426
- }),
427
- comparisonOperator: '${kind === 'service'
428
- ? 'LessThanThreshold'
429
- : 'GreaterThanOrEqualToThreshold'}',
430
- dimensions: ${kind === 'service'
431
- ? `{ ClusterName: cluster.nodes.cluster.name, ServiceName: workload.nodes.service.name }`
432
- : `{ RuleName: reliabilityTaskStopped.name }`},
433
- evaluationPeriods: 1,
434
- metricName: '${kind === 'service' ? 'LiveTaskCount' : 'MatchedEvents'}',
435
- name: '${slice}-' + $app.stage + '-${kind}-${workload}-${kind === 'service' ? 'running' : 'hard-crash'}',
436
- namespace: '${kind === 'service' ? 'AWS/ECS' : 'AWS/Events'}',
437
- period: 60,
438
- statistic: '${kind === 'service' ? 'Minimum' : 'Sum'}',
439
- tags: standardTags,
440
- threshold: 1,
441
- treatMissingData: '${kind === 'service' ? 'breaching' : 'notBreaching'}',
442
- },
443
- );
444
- void reliabilityAlarm;
445
- return workload;
446
- `);
447
- if (!infrastructureSource.includes(packageLocalImage)) {
448
- throw new Error(`Built-in ${kind} infrastructure is missing its image context.`);
449
- }
450
- infrastructureSource = infrastructureSource.replace(packageLocalImage, protectedReleaseImage);
451
- if (kind === 'service' && ownsProtectedLoadAdapter) {
452
- replaceInfrastructureFragment(`import { standardSliceExtensionTaskFamily } from '../../infra/native-runtime-authority/effective-intent.js';`, `import {
453
- standardSliceExtensionTaskFamily,
454
- standardSliceServicePerformanceReservationTableName,
455
- } from '../../infra/native-runtime-authority/effective-intent.js';`);
456
- replaceInfrastructureFragment(` const workload = new sst.aws.Service`, ` const performanceReservations = performanceDeploymentBinding
457
- ? new aws.dynamodb.Table(
458
- '${className}PerformanceReservationsTable',
459
- {
460
- attributes: [
461
- { name: 'pk', type: 'S' },
462
- { name: 'sk', type: 'S' },
463
- ],
464
- billingMode: 'PAY_PER_REQUEST',
465
- hashKey: 'pk',
466
- name: standardSliceServicePerformanceReservationTableName(
467
- $app.stage,
468
- '${workload}',
469
- ),
470
- pointInTimeRecovery: { enabled: true },
471
- rangeKey: 'sk',
472
- tags: standardTags,
473
- ttl: {
474
- attributeName: 'expires_at_epoch_seconds',
475
- enabled: true,
476
- },
477
- },
478
- )
479
- : undefined;
480
- const performanceReservationsLink = performanceReservations
481
- ? new sst.Linkable(
482
- '${className}PerformanceReservations',
483
- {
484
- properties: { tableName: performanceReservations.name },
485
- },
486
- )
487
- : undefined;
488
- const workload = new sst.aws.Service`);
489
- replaceInfrastructureFragment(` link: links,`, ` link: [
490
- ...links,
491
- ...(performanceReservationsLink ? [performanceReservationsLink] : []),
492
- ],`);
493
- replaceInfrastructureFragment(` EBK_STAGE: $app.stage,`, ` EBK_PERFORMANCE_ACCOUNT_FINGERPRINT:
494
- performanceDeploymentBinding?.target.accountFingerprint ?? '',
495
- EBK_PERFORMANCE_CANDIDATE_DIGEST:
496
- performanceDeploymentBinding?.candidateDigest ?? '',
497
- EBK_PERFORMANCE_LOAD_ENABLED:
498
- performanceDeploymentBinding ? 'true' : 'false',
499
- EBK_PERFORMANCE_INGRESS_PROOF:
500
- performanceIngress?.originProof ?? '',
501
- EBK_PERFORMANCE_ORIGIN:
502
- performanceDeploymentBinding?.target.origin ?? '',
503
- EBK_PERFORMANCE_REGION:
504
- performanceDeploymentBinding?.target.region ?? '',
505
- EBK_PERFORMANCE_RELEASE_ID:
506
- performanceDeploymentBinding?.releaseId ?? '',
507
- EBK_PERFORMANCE_RELEASE_MATERIAL_DIGEST:
508
- performanceDeploymentBinding?.releaseMaterialDigest ?? '',
509
- EBK_PERFORMANCE_SLICE:
510
- performanceDeploymentBinding?.target.slice ?? '',
511
- EBK_STAGE: $app.stage,`);
512
- replaceInfrastructureFragment(` const dataProtection = new aws.cloudwatch.LogDataProtectionPolicy(`, ` if (performanceIngress) {
513
- performanceIngress.api.routePrivate(
514
- 'GET /${slice}/__ebk/performance/service',
515
- workload.nodes.cloudmapService.arn,
516
- { name: '${className}PerformanceExecute' },
517
- );
518
- performanceIngress.api.routePrivate(
519
- 'POST /${slice}/__ebk/performance/service/cleanup',
520
- workload.nodes.cloudmapService.arn,
521
- { name: '${className}PerformanceCleanup' },
522
- );
523
- performanceIngress.router.route(
524
- '/${slice}/__ebk/performance/service',
525
- performanceIngress.api.url,
526
- {
527
- connectionAttempts: 1,
528
- connectionTimeout: '3 seconds',
529
- readTimeout: '30 seconds',
530
- },
531
- );
532
- performanceIngress.router.route(
533
- '/${slice}/__ebk/performance/service/cleanup',
534
- performanceIngress.api.url,
535
- {
536
- connectionAttempts: 1,
537
- connectionTimeout: '3 seconds',
538
- readTimeout: '30 seconds',
539
- },
540
- );
541
- }
542
- const dataProtection = new aws.cloudwatch.LogDataProtectionPolicy(`);
543
- }
544
- files[infrastructurePath] =
545
- (0, observability_infrastructure_js_1.renderExtensionObservability)(infrastructureSource);
546
- files[`${relativeRoot}/RUNBOOK.md`] = `# ${workload} ${kind} recovery
547
-
548
- Confirm the exact Slice, stage, release, configuration, alarm, and workload
549
- identity before acting. Inspect health or completion signals and sanitized logs
550
- through the read-only diagnostic path. Do not restart, scale, retry, or replace
551
- protected resources without the named approval.
552
-
553
- ${kind === 'service'
554
- ? `The native AWS/ECS LiveTaskCount alarm uses Minimum over 60 seconds and
555
- counts tasks in ACTIVATING, RUNNING, and DEACTIVATING states. It breaches below
556
- one or when telemetry is missing. ECS can emit no metrics when there are no
557
- RUNNING tasks; missing telemetry is actionable but does not prove zero tasks.
558
-
559
- Startup, emission gaps, and lifecycle transitions can cause false positives.
560
- Activating, draining, or repeatedly replaced tasks can keep the count positive
561
- while readiness or useful work fails. ALARM is not a diagnosis. OK does not
562
- prove readiness, freedom from crash loops, or successful business traffic.
563
-
564
- Inspect ECS events, task states and exit reasons, the existing container health
565
- check, and the Slice API health and burn alarms. Do not infer that every Service
566
- has a load-balancer readiness alarm. Prefer a verified roll-forward; verify
567
- stable tasks, readiness, dependency protection, and the critical Service journey
568
- after recovery, then confirm telemetry and alarm recovery.
569
-
570
- LiveTaskCount adds no metric collection charge and needs no Container Insights
571
- opt-in. Existing alarm, compute, log, and request charges still apply; this is
572
- not a measured account-cost claim.`
573
- : 'Preserve idempotency and checkpoint state; verify the business deadline and postconditions before retrying or declaring recovery.'}
574
- `;
575
- files[`${relativeRoot}/src/reliability.ts`] = `import {
576
- createMetricEmitter,
577
- type MetricEmitter,
578
- } from '@empire-builder-kit/runtime/observability';
86
+ workspace,
87
+ }),
88
+ [`${relativeRoot}/src/workload.spec.ts`]: service
89
+ ? `import { describe, expect, it } from 'vitest';
90
+ import { healthResponse } from './main.js';
579
91
 
580
- export function recordWorkloadReliability(
581
- failed: boolean,
582
- metrics: MetricEmitter = createMetricEmitter(),
583
- ) {
584
- return metrics.emit({
585
- dimensions: {
586
- component: '${kind}-${workload}',
587
- feature: '${feature}',
588
- slice: '${slice}',
589
- stage: process.env.EBK_STAGE ?? 'development',
590
- },
591
- metricName: '${kind === 'service' ? 'ServiceHealthFailures' : 'JobFailures'}',
592
- unit: 'Count',
593
- value: failed ? 1 : 0,
594
- });
595
- }
596
- `;
597
- files[`${relativeRoot}/src/reliability.spec.ts`] =
598
- `import { describe, expect, it } from 'vitest';
599
- import { recordWorkloadReliability } from './reliability.js';
600
-
601
- describe('${workload} ${kind} reliability signal', () => {
602
- it('emits the exact generated alarm metric and dimensions', () => {
603
- const records: unknown[] = [];
604
- recordWorkloadReliability(true, {
605
- emit(input) {
606
- records.push(input);
607
- return undefined;
608
- },
609
- });
610
- expect(records).toEqual([
611
- expect.objectContaining({
612
- dimensions: {
613
- component: '${kind}-${workload}',
614
- feature: '${feature}',
615
- slice: '${slice}',
616
- stage: 'development',
617
- },
618
- metricName: '${kind === 'service' ? 'ServiceHealthFailures' : 'JobFailures'}',
619
- value: 1,
620
- }),
621
- ]);
92
+ describe('service health', () => {
93
+ it('answers its health check', () => {
94
+ expect(healthResponse('/health')).toEqual({ status: 200, body: { ok: true } });
95
+ expect(healthResponse('/other').status).toBe(404);
622
96
  });
623
97
  });
624
- `;
625
- const sourcePath = `${relativeRoot}/src/${sourceName}`;
626
- let source = files[sourcePath] ?? '';
627
- source = source.replace(`import { hostProviderDeliveryAssignment } from './provider-delivery.js';`, `import { hostProviderDeliveryAssignment } from './provider-delivery.js';
628
- import { recordWorkloadReliability } from './reliability.js';`);
629
- if (kind === 'service') {
630
- source = source
631
- .replace(` const result = healthResponse(request.url);
632
- `, ` const result = healthResponse(request.url);
633
- recordWorkloadReliability(result.status !== 200);
634
- `)
635
- .replace(` server.on('error', (error) => {
636
- logger.error('${workload} service failed', { error, outcome: 'failure' });
637
- `, ` server.on('error', (error) => {
638
- recordWorkloadReliability(true);
639
- logger.error('${workload} service failed', { error, outcome: 'failure' });
640
- `);
641
- }
642
- else {
643
- source = source
644
- .replace(` const result = { ok: true, providerDeliveryAssigned: assignment.assigned };
645
- logger.info('${workload} job completed', { outcome: 'success' });
646
- `, ` const result = { ok: true, providerDeliveryAssigned: assignment.assigned };
647
- recordWorkloadReliability(false);
648
- logger.info('${workload} job completed', { outcome: 'success' });
649
- `)
650
- .replace(` } catch (error) {
651
- logger.error('${workload} job failed', { error, outcome: 'failure' });
652
- `, ` } catch (error) {
653
- recordWorkloadReliability(true);
654
- logger.error('${workload} job failed', { error, outcome: 'failure' });
655
- `);
656
- }
657
- files[sourcePath] = source;
658
- files[`${relativeRoot}/src/provider-delivery.ts`] = `import {
659
- AppConfigDataClient,
660
- GetLatestConfigurationCommand,
661
- StartConfigurationSessionCommand,
662
- } from '@aws-sdk/client-appconfigdata';
663
- import {
664
- deriveOperationalRolloutStableKey,
665
- evaluatePercentageRollout,
666
- type OperationalRolloutStableKey,
667
- } from '@empire-builder-kit/runtime/configuration';
668
-
669
- type EvaluationReason = 'CACHED' | 'ERROR' | 'STALE' | 'STATIC';
670
- interface Evaluation<Value extends boolean | number> {
671
- errorCategory?: 'PROVIDER_UNAVAILABLE';
672
- flagKey: string;
673
- providerName: string;
674
- providerVersion?: string;
675
- reason: EvaluationReason;
676
- value: Value;
677
- }
678
- export interface HostConfigurationProvider {
679
- resolveBooleanEvaluation(
680
- key: string,
681
- defaultValue: boolean,
682
- ): Promise<Evaluation<boolean>>;
683
- resolveNumberEvaluation(
684
- key: string,
685
- defaultValue: number,
686
- ): Promise<Evaluation<number>>;
687
- }
688
- interface Snapshot {
689
- loadedAt: number;
690
- values: Record<string, unknown>;
691
- version: string;
692
- }
693
-
694
- const REFRESH_AFTER_MS = 45_000;
695
- const MAX_STALE_MS = 5 * 60_000;
98
+ `
99
+ : `import { expect, it } from 'vitest';
100
+ import { run } from './run.js';
696
101
 
697
- function required(name: string): string {
698
- const value = process.env[name]?.trim();
699
- if (!value) throw new Error(name + ' is required in a protected stage.');
700
- return value;
102
+ it('runs the job', async () => {
103
+ await expect(run()).resolves.toEqual({ ok: true });
104
+ });
105
+ `,
106
+ [`${relativeRoot}/infra.ts`]: `export function ${factoryName}(cluster: any) {
107
+ return new sst.aws.${resource}('${className}', {
108
+ cluster,
109
+ environment: { EBK_STAGE: $app.stage },
110
+ image: { context: '../..', dockerfile: '${workspacePath}/Dockerfile' },
111
+ logging: { retention: '1 month' },
112
+ ${service
113
+ ? ` dev: { command: 'pnpm dev', directory: '${relativeRoot}' },
114
+ health: { command: ['CMD-SHELL', 'wget -qO- http://localhost:3000/health || exit 1'] },
115
+ serviceRegistry: { port: 3000 },
116
+ `
117
+ : ''} });
701
118
  }
702
-
703
- function createHostConfigurationProvider(): HostConfigurationProvider {
704
- const protectedStage = ['staging', 'production'].includes(
705
- process.env.EBK_STAGE ?? '',
706
- );
707
- if (!protectedStage) {
708
- return {
709
- async resolveBooleanEvaluation(flagKey, defaultValue) {
710
- return {
711
- flagKey,
712
- providerName: 'ebk-local',
713
- providerVersion: 'local-v1',
714
- reason: 'STATIC',
715
- value: defaultValue,
716
- };
717
- },
718
- async resolveNumberEvaluation(flagKey, defaultValue) {
719
- return {
720
- flagKey,
721
- providerName: 'ebk-local',
722
- providerVersion: 'local-v1',
723
- reason: 'STATIC',
724
- value: defaultValue,
725
- };
726
- },
727
- };
728
- }
729
-
730
- const client = new AppConfigDataClient({});
731
- let cached: Snapshot | undefined;
732
- let inFlight: Promise<Snapshot> | undefined;
733
- let token: string | undefined;
734
- const refresh = async (): Promise<Snapshot> => {
735
- if (!token) {
736
- const session = await client.send(
737
- new StartConfigurationSessionCommand({
738
- ApplicationIdentifier: required('EBK_APPCONFIG_APPLICATION_ID'),
739
- ConfigurationProfileIdentifier: required(
740
- 'EBK_APPCONFIG_PROFILE_ID',
741
- ),
742
- EnvironmentIdentifier: required('EBK_APPCONFIG_ENVIRONMENT_ID'),
743
- }),
744
- );
745
- token = session.InitialConfigurationToken;
746
- }
747
- if (!token) throw new Error('AppConfig did not return a session token.');
748
- const latest = await client.send(
749
- new GetLatestConfigurationCommand({ ConfigurationToken: token }),
750
- );
751
- token = latest.NextPollConfigurationToken;
752
- if (!token) throw new Error('AppConfig did not return the next poll token.');
753
- if (!latest.Configuration?.byteLength) {
754
- if (!cached) {
755
- throw new Error('AppConfig returned no initial configuration.');
756
- }
757
- cached = { ...cached, loadedAt: Date.now() };
758
- return cached;
759
- }
760
- if (!latest.VersionLabel) {
761
- throw new Error('AppConfig did not return a versioned document.');
762
- }
763
- const document = JSON.parse(
764
- new TextDecoder().decode(latest.Configuration),
765
- ) as { schemaVersion?: unknown; values?: unknown };
766
- const values = document.values as Record<string, unknown> | undefined;
767
- if (
768
- document.schemaVersion !== 1 ||
769
- !values ||
770
- typeof values !== 'object' ||
771
- Array.isArray(values) ||
772
- typeof values['${slice}.provider-delivery-v1'] !== 'boolean' ||
773
- !Number.isInteger(
774
- values['${slice}.provider-delivery-percentage'],
775
- )
776
- ) {
777
- throw new Error('AppConfig document is invalid.');
778
- }
779
- cached = {
780
- loadedAt: Date.now(),
781
- values,
782
- version: latest.VersionLabel,
119
+ `,
783
120
  };
784
- return cached;
785
- };
786
- const load = async (): Promise<{
787
- snapshot?: Snapshot;
788
- stale: boolean;
789
- }> => {
790
- const age = cached ? Date.now() - cached.loadedAt : Infinity;
791
- if (cached && age < REFRESH_AFTER_MS) {
792
- return { snapshot: cached, stale: false };
793
- }
794
- inFlight ??= refresh().finally(() => {
795
- inFlight = undefined;
796
- });
797
- try {
798
- return { snapshot: await inFlight, stale: false };
799
- } catch {
800
- token = undefined;
801
- const staleAge = cached ? Date.now() - cached.loadedAt : Infinity;
802
- return {
803
- ...(cached && staleAge <= MAX_STALE_MS ? { snapshot: cached } : {}),
804
- stale: true,
805
- };
806
- }
807
- };
808
- const resolve = async <Value extends boolean | number>(
809
- flagKey: string,
810
- defaultValue: Value,
811
- valid: (value: unknown) => value is Value,
812
- ): Promise<Evaluation<Value>> => {
813
- const loaded = await load();
814
- const value = loaded.snapshot?.values[flagKey];
815
- if (!loaded.snapshot || !valid(value)) {
816
- return {
817
- errorCategory: 'PROVIDER_UNAVAILABLE',
818
- flagKey,
819
- providerName: 'aws-appconfig',
820
- reason: 'ERROR',
821
- value: defaultValue,
822
- };
823
- }
121
+ const seeded = new Set([
122
+ `${relativeRoot}/README.md`,
123
+ `${relativeRoot}/src/${entry}.ts`,
124
+ `${relativeRoot}/src/workload.spec.ts`,
125
+ ]);
824
126
  return {
825
- ...(loaded.stale
826
- ? { errorCategory: 'PROVIDER_UNAVAILABLE' as const }
827
- : {}),
828
- flagKey,
829
- providerName: 'aws-appconfig',
830
- providerVersion: loaded.snapshot.version,
831
- reason: loaded.stale ? 'STALE' : 'CACHED',
832
- value,
127
+ factoryName,
128
+ files,
129
+ paths: Object.keys(files).map((path) => ({
130
+ ...(seeded.has(path) ? { mode: 'seeded' } : {}),
131
+ ...(path === `${relativeRoot}/package.json`
132
+ ? { managedJsonPointers: exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS }
133
+ : {}),
134
+ path,
135
+ })),
136
+ project: packageName,
833
137
  };
834
- };
835
- return {
836
- resolveBooleanEvaluation: (flagKey, defaultValue) =>
837
- resolve(
838
- flagKey,
839
- defaultValue,
840
- (value): value is boolean => typeof value === 'boolean',
841
- ),
842
- resolveNumberEvaluation: (flagKey, defaultValue) =>
843
- resolve(
844
- flagKey,
845
- defaultValue,
846
- (value): value is number => Number.isInteger(value),
847
- ),
848
- };
849
138
  }
850
-
851
- export async function providerDeliveryAssignment(
852
- provider: HostConfigurationProvider,
853
- operationalIdentity:
854
- | OperationalRolloutStableKey
855
- | typeof workloadOperationalIdentity,
856
- ) {
857
- const [enabled, percentage] = await Promise.all([
858
- provider.resolveBooleanEvaluation('${slice}.provider-delivery-v1', false),
859
- provider.resolveNumberEvaluation(
860
- '${slice}.provider-delivery-percentage',
861
- 0,
862
- ),
863
- ]);
864
- const safeDefault =
865
- enabled.value === false &&
866
- percentage.value === 0 &&
867
- enabled.errorCategory !== undefined &&
868
- percentage.errorCategory !== undefined;
869
- const staleLastKnownValid =
870
- enabled.reason === 'STALE' &&
871
- percentage.reason === 'STALE' &&
872
- enabled.providerVersion !== undefined &&
873
- enabled.providerVersion === percentage.providerVersion;
874
- if (
875
- ((!safeDefault && !staleLastKnownValid) &&
876
- (enabled.errorCategory || percentage.errorCategory)) ||
877
- (!safeDefault &&
878
- (
879
- !enabled.providerVersion ||
880
- enabled.providerVersion !== percentage.providerVersion
881
- )) ||
882
- !Number.isInteger(percentage.value) ||
883
- percentage.value < 0 ||
884
- percentage.value > 100
885
- ) {
886
- throw new Error('Provider-delivery configuration is unavailable.');
887
- }
888
- const providerVersion =
889
- enabled.providerVersion ?? 'safe-default-v1';
890
- const operationalStableKey =
891
- operationalIdentity === workloadOperationalIdentity
892
- ? workloadOperationalStableKey
893
- : operationalIdentity;
894
- return {
895
- ...evaluatePercentageRollout({
896
- enabled: enabled.value,
897
- percentage: percentage.value,
898
- rolloutId: '${slice}-provider-delivery',
899
- stableKey: operationalStableKey,
900
- version: providerVersion,
901
- }),
902
- host: '${kind}' as const,
903
- providerVersion,
904
- };
139
+ function renderWorkloadEntry(input) {
140
+ const { feature, kind, slice, workload, workspace } = input;
141
+ const service = kind === 'service';
142
+ const operation = service ? 'start' : 'run';
143
+ return `import { createLogger } from '@empire-builder-kit/runtime/logging';
144
+ import { pathToFileURL } from 'node:url';
145
+ ${service ? "import { createServer } from 'node:http';\n" : ''}
146
+ const logger = createLogger({
147
+ component: '${kind}-${workload}',
148
+ feature: '${feature}',
149
+ operation: '${operation}',
150
+ slice: '${slice}',
151
+ stage: process.env.EBK_STAGE ?? 'development',
152
+ workspace: '${workspace}',
153
+ });
154
+ ${service
155
+ ? `
156
+ export function healthResponse(path: string | undefined) {
157
+ return path === '/health'
158
+ ? { status: 200, body: { ok: true } }
159
+ : { status: 404, body: { ok: false } };
905
160
  }
906
161
 
907
- let hostProvider: HostConfigurationProvider | undefined;
908
- export const workloadOperationalIdentity =
909
- '${kind}-${slice}-${workload}-host-v1' as const;
910
- export const workloadOperationalStableKey =
911
- deriveOperationalRolloutStableKey({
912
- kind: '${kind}',
913
- slice: '${slice}',
914
- workload: '${workload}',
162
+ export function start() {
163
+ const port = Number(process.env.PORT ?? 3000);
164
+ const server = createServer((request, response) => {
165
+ const result = healthResponse(request.url);
166
+ response.writeHead(result.status, { 'content-type': 'application/json' });
167
+ response.end(JSON.stringify(result.body));
915
168
  });
916
- export function hostProviderDeliveryAssignment(
917
- operationalIdentity:
918
- | OperationalRolloutStableKey
919
- | typeof workloadOperationalIdentity,
920
- ) {
921
- hostProvider ??= createHostConfigurationProvider();
922
- return providerDeliveryAssignment(
923
- hostProvider,
924
- operationalIdentity,
925
- );
169
+ return server.listen(port, () => logger.info('Service started', { attributes: { port } }));
170
+ }
171
+ `
172
+ : `
173
+ export async function run() {
174
+ logger.info('Job completed', { outcome: 'success' });
175
+ return { ok: true };
176
+ }
177
+ `}
178
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
179
+ ${service ? 'start();' : 'await run();'}
926
180
  }
927
181
  `;
928
- files[`${relativeRoot}/src/provider-delivery.spec.ts`] =
929
- `import { describe, expect, it } from 'vitest';
930
- import {
931
- providerDeliveryAssignment,
932
- workloadOperationalIdentity,
933
- workloadOperationalStableKey,
934
- } from './provider-delivery.js';
935
-
936
- const provider = {
937
- async resolveBooleanEvaluation(flagKey: string) {
938
- return {
939
- flagKey,
940
- providerName: 'aws-appconfig',
941
- providerVersion: 'release-018f8d',
942
- reason: 'STATIC' as const,
943
- value: true,
944
- };
945
- },
946
- async resolveNumberEvaluation(flagKey: string) {
947
- return {
948
- flagKey,
949
- providerName: 'aws-appconfig',
950
- providerVersion: 'release-018f8d',
951
- reason: 'STATIC' as const,
952
- value: 25,
953
- };
954
- },
955
- };
956
-
957
- describe('${workload} ${kind} rollout binding', () => {
958
- it('imports and uses the declared operational workload identity', async () => {
959
- expect(workloadOperationalStableKey).toMatch(/^opk_v1_[a-f0-9]{64}$/);
960
- await expect(
961
- providerDeliveryAssignment(
962
- provider,
963
- workloadOperationalIdentity,
964
- ),
965
- ).resolves.toEqual(
966
- expect.objectContaining({
967
- host: '${kind}',
968
- providerVersion: 'release-018f8d',
969
- }),
970
- );
971
- });
972
- });
973
-
974
- describe('${workload} ${kind} outage behavior', () => {
975
- it('uses a safe disabled assignment before a valid snapshot exists', async () => {
976
- const unavailable = {
977
- async resolveBooleanEvaluation(flagKey: string) {
978
- return {
979
- errorCategory: 'PROVIDER_UNAVAILABLE' as const,
980
- flagKey,
981
- providerName: 'aws-appconfig',
982
- reason: 'ERROR' as const,
983
- value: false,
984
- };
985
- },
986
- async resolveNumberEvaluation(flagKey: string) {
987
- return {
988
- errorCategory: 'PROVIDER_UNAVAILABLE' as const,
989
- flagKey,
990
- providerName: 'aws-appconfig',
991
- reason: 'ERROR' as const,
992
- value: 0,
993
- };
994
- },
995
- };
996
-
997
- await expect(
998
- providerDeliveryAssignment(
999
- unavailable,
1000
- workloadOperationalIdentity,
1001
- ),
1002
- ).resolves.toEqual(
1003
- expect.objectContaining({
1004
- assigned: false,
1005
- providerVersion: 'safe-default-v1',
1006
- }),
1007
- );
1008
- });
1009
- });
1010
- `;
1011
- (0, index_js_1.assertManagedJsonPointersExist)(files[`${relativeRoot}/package.json`] ?? '', kind === 'service' && ownsProtectedLoadAdapter
1012
- ? exports.SERVICE_WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS
1013
- : exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS, `Built-in ${kind} package.json`);
1014
- return {
1015
- factoryName,
1016
- files,
1017
- paths: [
1018
- { mode: 'seeded', path: `${relativeRoot}/README.md` },
1019
- { mode: 'seeded', path: `${relativeRoot}/RUNBOOK.md` },
1020
- { path: `${relativeRoot}/Dockerfile` },
1021
- { path: `${relativeRoot}/infra.ts` },
1022
- {
1023
- managedJsonPointers: [
1024
- ...(kind === 'service' && ownsProtectedLoadAdapter
1025
- ? exports.SERVICE_WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS
1026
- : exports.WORKLOAD_PACKAGE_MANAGED_JSON_POINTERS),
1027
- ],
1028
- path: `${relativeRoot}/package.json`,
1029
- },
1030
- { mode: 'seeded', path: `${relativeRoot}/src/${sourceName}` },
1031
- ...(kind === 'service'
1032
- ? [{ path: `${relativeRoot}/src/service-runtime.ts` }]
1033
- : []),
1034
- ...(kind === 'service' && ownsProtectedLoadAdapter
1035
- ? [
1036
- { path: `${relativeRoot}/PERFORMANCE.md` },
1037
- { path: `${relativeRoot}/src/performance.spec.ts` },
1038
- { path: `${relativeRoot}/src/performance.ts` },
1039
- ]
1040
- : []),
1041
- { path: `${relativeRoot}/src/reliability.spec.ts` },
1042
- { path: `${relativeRoot}/src/reliability.ts` },
1043
- {
1044
- mode: 'seeded',
1045
- path: `${relativeRoot}/src/provider-delivery.spec.ts`,
1046
- },
1047
- {
1048
- mode: 'seeded',
1049
- path: `${relativeRoot}/src/provider-delivery.ts`,
1050
- },
1051
- { mode: 'seeded', path: `${relativeRoot}/src/workload.spec.ts` },
1052
- { path: `${relativeRoot}/tsconfig.json` },
1053
- { path: `${relativeRoot}/vitest.config.ts` },
1054
- ],
1055
- project: `@${slice}/${kind}-${workload}`,
1056
- };
1057
182
  }
1058
- async function executeWorkloadGenerator(tree, options, kind) {
1059
- const slice = name(options.slice, 'Product Slice name');
1060
- const workload = name(options.name, kind === 'service' ? 'Service name' : 'Job name');
1061
- const requestedFeature = name(options.feature, 'Feature');
1062
- (0, observability_policy_js_1.requireObservabilityPolicyFromTree)(tree);
1063
- const plural = kind === 'service' ? 'services' : 'jobs';
1064
- const sliceRoot = node_path_1.posix.join('packages', slice);
1065
- const root = node_path_1.posix.join(sliceRoot, plural, workload);
1066
- const productPath = node_path_1.posix.join(sliceRoot, 'infra/product.ts');
1067
- const topologyPath = node_path_1.posix.join(sliceRoot, 'infra/native-runtime-authority/topology.ts');
1068
- const intentPath = node_path_1.posix.join(sliceRoot, 'infra/native-runtime-authority/effective-intent.ts');
183
+ async function workloadGenerator(tree, options, kind) {
184
+ const workspace = (0, function_js_1.readFunctionWorkspaceName)(tree);
185
+ const slice = (0, function_js_1.requireName)(options.slice, 'Product Slice name');
186
+ const workload = (0, function_js_1.requireName)(options.name, 'Workload name');
187
+ const feature = (0, function_js_1.requireName)(options.feature, 'Feature');
188
+ const relativeRoot = `${kind}s/${workload}`;
189
+ const sourceRoot = node_path_1.posix.join('packages', slice, relativeRoot);
1069
190
  const installOperation = {
1070
191
  generator: 'workload',
1071
192
  id: `generator:workload:${slice}:${kind}:${workload}`,
1072
193
  key: `workload-${slice}-${kind}-${workload}`,
1073
194
  request: {
1074
- feature: requestedFeature,
195
+ feature,
1075
196
  kind,
1076
197
  name: workload,
1077
198
  skipFormat: options.skipFormat ?? false,
@@ -1079,242 +200,88 @@ async function executeWorkloadGenerator(tree, options, kind) {
1079
200
  },
1080
201
  resumeArguments: [
1081
202
  'pnpm',
1082
- '--config.verify-deps-before-run=warn',
1083
203
  'nx',
1084
204
  'generate',
1085
205
  `@empire-builder-kit/nx:${kind}`,
1086
206
  `--name=${workload}`,
1087
207
  `--slice=${slice}`,
1088
- `--feature=${requestedFeature}`,
208
+ `--feature=${feature}`,
1089
209
  `--skipFormat=${String(options.skipFormat ?? false)}`,
1090
210
  '--skipInstall=false',
1091
211
  '--interactive=false',
1092
212
  ],
1093
- semanticPrerequisites: [
1094
- (0, post_generation_install_js_1.postGenerationInstallFeaturePrerequisite)(node_path_1.posix.join(sliceRoot, feature_registry_js_1.SLICE_FEATURE_REGISTRY_PATH), requestedFeature),
1095
- ],
1096
- sourceRoot: root,
213
+ sourceRoot,
1097
214
  };
1098
215
  const pendingInstall = (0, post_generation_install_js_1.resumePendingPostGenerationInstall)(tree, installOperation, options.skipInstall);
1099
216
  if (pendingInstall)
1100
217
  return pendingInstall;
1101
- const packageSource = tree.read('package.json', 'utf8');
1102
- if (packageSource === null) {
1103
- throw new Error('Workspace package.json is required.');
1104
- }
1105
- let packageJson;
1106
- try {
1107
- packageJson = JSON.parse(packageSource);
1108
- }
1109
- catch {
1110
- throw new Error('Workspace package.json must be valid JSON.');
1111
- }
1112
- const workspace = name(typeof packageJson.name === 'string' ? packageJson.name : '', 'Workspace name');
1113
- const runtimeVersion = packageJson.dependencies?.['@empire-builder-kit/runtime'];
218
+ const { ownership, ownershipPath, product, productPath, root } = (0, function_js_1.readManagedProduct)(tree, slice);
219
+ if (tree.exists(sourceRoot) ||
220
+ tree.children(sourceRoot).length > 0 ||
221
+ ownership.compositions.some((item) => item.kind === kind && (0, function_js_1.pascal)(item.name) === (0, function_js_1.pascal)(workload))) {
222
+ throw new Error(`${kind} ${workload} already exists at ${sourceRoot}.`);
223
+ }
224
+ const packageSource = JSON.parse(tree.read(node_path_1.posix.join(root, 'package.json'), 'utf8') ?? 'null');
225
+ const runtimeVersion = packageSource &&
226
+ typeof packageSource === 'object' &&
227
+ 'dependencies' in packageSource &&
228
+ packageSource.dependencies &&
229
+ typeof packageSource.dependencies === 'object' &&
230
+ '@empire-builder-kit/runtime' in packageSource.dependencies
231
+ ? packageSource.dependencies['@empire-builder-kit/runtime']
232
+ : undefined;
1114
233
  if (typeof runtimeVersion !== 'string' || runtimeVersion.trim() === '') {
1115
- throw new Error('Workspace package.json must declare @empire-builder-kit/runtime before generating a workload.');
1116
- }
1117
- if (!tree.exists(productPath)) {
1118
- throw new Error(`${slice} is not an EBK v1 Product Slice.`);
234
+ throw new Error('The Product Slice must declare @empire-builder-kit/runtime before generating a workload.');
1119
235
  }
1120
- const ownership = (0, index_js_1.validateGeneratedOwnershipRecord)(JSON.parse(tree.read(node_path_1.posix.join(sliceRoot, '.ebk/ownership.json'), 'utf8') ?? 'null'));
1121
- if (!ownership.valid)
1122
- throw new Error('Product Slice ownership is invalid before workload composition.');
1123
- const foundationPath = node_path_1.posix.join(sliceRoot, 'infra/foundation.ts');
1124
- const foundationSource = tree.read(foundationPath, 'utf8');
1125
- const foundationOwner = ownership.value.paths.find(({ path }) => path === 'infra/foundation.ts');
1126
- if (foundationSource === null ||
1127
- foundationOwner?.mode !== 'managed' ||
1128
- (0, index_js_1.hashOwnedContent)(foundationSource, foundationOwner) !==
1129
- foundationOwner.sha256)
1130
- throw new Error('Product Slice Foundation bindings have managed drift; reconcile ownership before workload generation.');
1131
- const foundationRequirement = {
1132
- contract: ownership.value.foundation.contract,
236
+ const plan = createWorkloadFilePlan(workspace, slice, workload, kind, runtimeVersion, feature);
237
+ const foundation = {
238
+ contract: ownership.foundation.contract,
1133
239
  capabilities: (0, capability_plan_js_1.planFoundationCapabilities)({
1134
240
  requirements: [
1135
- ownership.value.foundation,
1136
- { contract: '^2.0.0', capabilities: ['network', 'container-compute'] },
241
+ ownership.foundation,
242
+ {
243
+ contract: ownership.foundation.contract,
244
+ capabilities: ['network', 'container-compute'],
245
+ },
1137
246
  ],
1138
247
  }).descriptor.capabilities,
1139
248
  };
1140
- requireCompositionMarker(tree, topologyPath, '// <ebk:native-runtime-extensions:end>');
1141
- requireCompositionMarker(tree, intentPath, '// <ebk:native-runtime-intent-contributions:end>');
1142
- for (const marker of [
1143
- '// <ebk:composition-imports:end>',
1144
- '// <ebk:workload-registrations:end>',
1145
- '// <ebk:composition-outputs:end>',
1146
- ]) {
1147
- requireCompositionMarker(tree, productPath, marker);
1148
- }
1149
- const feature = (0, feature_registry_js_1.requireRegisteredSliceFeature)(tree, sliceRoot, requestedFeature);
1150
- if (tree.exists(root)) {
1151
- throw new Error(`${kind} ${workload} already exists at ${root}.`);
1152
- }
1153
- const loggingRegistration = (0, logging_registry_js_1.planSliceLoggingComponentRegistration)(tree, sliceRoot, `${kind}-${workload}`);
1154
- const performanceRegistration = (0, performance_registration_js_1.planWorkloadPerformanceRegistration)(tree, {
1155
- kind,
1156
- name: workload,
1157
- runtimeVersion,
1158
- slice,
1159
- sliceRoot,
1160
- workspace,
1161
- });
1162
- const reliabilityRegistration = (0, reliability_registration_js_1.planWorkloadReliabilityRegistration)(tree, {
1163
- feature,
1164
- kind,
1165
- name: workload,
1166
- slice,
1167
- sliceRoot,
1168
- });
1169
- const plan = createWorkloadFilePlan(workspace, slice, workload, kind, runtimeVersion, feature, performanceRegistration.ownsProtectedLoadAdapter, performanceRegistration.protectedRuntimeStages);
1170
- const additionalPerformancePaths = performanceRegistration.additionalFiles.map(({ path }) => path);
249
+ const variable = `${kind}${(0, function_js_1.pascal)(workload)}`;
250
+ const composed = (0, function_js_1.insertComposition)((0, function_js_1.insertComposition)((0, function_js_1.insertComposition)(product, 'composition-imports', `import { ${plan.factoryName} } from '../${relativeRoot}/infra.js';`), 'workload-registrations', `const ${variable} = ${plan.factoryName}(workloadCluster());`), 'composition-outputs', `${variable},`);
1171
251
  const installScope = {
1172
- exactPaths: [
1173
- foundationPath,
1174
- productPath,
1175
- topologyPath,
1176
- intentPath,
1177
- node_path_1.posix.join(sliceRoot, logging_registry_js_1.SLICE_LOGGING_REGISTRY_PATH),
1178
- node_path_1.posix.join(sliceRoot, performance_registration_js_1.WORKLOAD_PERFORMANCE_POLICY_PATH),
1179
- ...additionalPerformancePaths,
1180
- node_path_1.posix.join(sliceRoot, reliability_registration_js_1.WORKLOAD_RELIABILITY_REGISTRY_PATH),
1181
- node_path_1.posix.join(sliceRoot, RELEASE_REGISTRY_PATH),
1182
- node_path_1.posix.join(sliceRoot, '.ebk/ownership.json'),
1183
- ],
252
+ exactPaths: [ownershipPath, productPath],
1184
253
  requiredPaths: [
1185
- node_path_1.posix.join(root, 'package.json'),
254
+ ownershipPath,
1186
255
  productPath,
1187
- topologyPath,
1188
- intentPath,
1189
- node_path_1.posix.join(sliceRoot, logging_registry_js_1.SLICE_LOGGING_REGISTRY_PATH),
1190
- node_path_1.posix.join(sliceRoot, performance_registration_js_1.WORKLOAD_PERFORMANCE_POLICY_PATH),
1191
- ...additionalPerformancePaths,
1192
- node_path_1.posix.join(sliceRoot, reliability_registration_js_1.WORKLOAD_RELIABILITY_REGISTRY_PATH),
1193
- node_path_1.posix.join(sliceRoot, RELEASE_REGISTRY_PATH),
1194
- node_path_1.posix.join(sliceRoot, '.ebk/ownership.json'),
256
+ node_path_1.posix.join(sourceRoot, 'package.json'),
1195
257
  ],
1196
- roots: [root, 'packages/foundation'],
258
+ roots: [sourceRoot, 'packages/foundation'],
1197
259
  };
1198
260
  const installState = options.skipInstall
1199
261
  ? undefined
1200
262
  : (0, post_generation_install_js_1.capturePostGenerationInstallState)(tree, installScope, installOperation);
1201
- const { factoryName } = plan;
1202
- // Capability growth and its consuming bindings are a single deferred source
1203
- // operation. A container needs network/compute, never an implicit database.
1204
- await (0, upgrade_js_1.upgradeFoundationForRequirements)(tree, [foundationRequirement], true);
1205
- if (!ownership.value.foundation.capabilities.includes('network')) {
1206
- // Capability growth must update the API's consuming network binding in
1207
- // this same generation, before a Service registers private ingress.
1208
- const source = tree.read(productPath, 'utf8');
1209
- if (source === null)
1210
- throw new Error('Product Slice API source is missing; no workload files changed.');
1211
- const anchor = ` const api = new sst.aws.ApiGatewayV2('${pascal(slice)}Api', {`;
1212
- if (source.split(anchor).length !== 2)
1213
- throw new Error('Product Slice API composition is not recognized; no workload files changed.');
1214
- tree.write(productPath, source.replace(anchor, anchor +
1215
- '\n ...(performanceDeploymentAuthority ? { vpc: foundation.vpc } : {}),'));
1216
- }
1217
- tree.write(foundationPath, (0, built_in_plan_foundation_files_js_1.renderSliceFoundationFiles)(slice, pascal(slice), foundationRequirement.capabilities)['infra/foundation.ts']);
1218
- const infraRelative = `../${plural}/${workload}/infra.js`;
263
+ const deferred = new generation_tree_js_1.GenerationTree(tree);
264
+ await (0, framework_packages_js_1.upgradeFoundationForRequirements)(deferred, [foundation], true);
1219
265
  for (const [path, contents] of Object.entries(plan.files)) {
1220
- tree.write(node_path_1.posix.join(sliceRoot, path), contents);
266
+ deferred.write(node_path_1.posix.join(root, path), contents);
1221
267
  }
1222
- tree.write(loggingRegistration.path, loggingRegistration.contents);
1223
- tree.write(performanceRegistration.path, performanceRegistration.contents);
1224
- for (const file of performanceRegistration.additionalFiles) {
1225
- tree.write(file.path, file.contents);
1226
- }
1227
- tree.write(reliabilityRegistration.path, reliabilityRegistration.contents);
1228
- registerReleaseArtifact(tree, sliceRoot, slice, workload, kind);
1229
- replaceMarker(tree, productPath, '// <ebk:composition-imports:end>', `import { ${factoryName} } from '${infraRelative}';`);
1230
- replaceMarker(tree, productPath, '// <ebk:workload-registrations:end>', ` const ${kind}${pascal(workload)} = ${factoryName}(
1231
- foundation.cluster,
1232
- foundation.discovery.alertTopicArn,
1233
- {
1234
- frameworkVersion: ${JSON.stringify(performanceRegistration.tagContext.frameworkVersion)},
1235
- owner: ${JSON.stringify(performanceRegistration.tagContext.owner)},
1236
- productionProfile: ${JSON.stringify(performanceRegistration.tagContext.productionProfile)},
1237
- repository: ${JSON.stringify(performanceRegistration.tagContext.repository)},
1238
- },
1239
- ${kind !== 'service' || performanceRegistration.ownsProtectedLoadAdapter
1240
- ? ` performanceDeploymentBinding,
1241
- `
1242
- : ''}
1243
- ${kind === 'service' && performanceRegistration.ownsProtectedLoadAdapter
1244
- ? ` performanceIngress,
1245
- performanceDeploymentBinding
1246
- ? nativeAuthority.permissions('${workload}-service-performance-task')
1247
- : nativeAuthority.permissions('${workload}-service-task'),
1248
- `
1249
- : kind === 'service'
1250
- ? ` nativeAuthority.permissions('${workload}-service-task'),
1251
- `
1252
- : ` nativeAuthority.permissions('${workload}-job-task'),
1253
- `}
1254
- ${kind === 'service' && performanceRegistration.ownsProtectedLoadAdapter
1255
- ? ` performanceDeploymentBinding
1256
- ? secretLinksForWorkloads(
1257
- '${workload}-service-task',
1258
- '${workload}-service-performance-task',
1259
- )
1260
- : secretLinksFor('${workload}-service-task'),`
1261
- : kind === 'service'
1262
- ? ` secretLinksFor('${workload}-service-task'),`
1263
- : ` secretLinksFor('${workload}-job-task'),`}
1264
- runtimeConfiguration
1265
- ? {
1266
- applicationId: runtimeConfiguration.application.id,
1267
- deployment: runtimeConfiguration.deployment,
1268
- environmentId: runtimeConfiguration.environment.environmentId,
1269
- profileId: runtimeConfiguration.profile.configurationProfileId,
1270
- }
1271
- : undefined,
1272
- );`);
1273
- replaceMarker(tree, productPath, '// <ebk:composition-outputs:end>', ` ${kind}${pascal(workload)},`);
1274
- replaceMarker(tree, topologyPath, '// <ebk:native-runtime-extensions:end>', ` { id: '${workload}', kind: '${kind}' },`);
1275
- replaceMarker(tree, intentPath, '// <ebk:native-runtime-intent-contributions:end>', ` ...extensionWorkloadRoleIntentContributions(context, topology, '${workload}', '${kind}'),`);
268
+ deferred.write(productPath, composed);
1276
269
  if (!options.skipFormat) {
1277
- const slicePrefix = `${sliceRoot}/`;
1278
- const restoreProtectedFiles = (0, formatting_js_1.createTreeFileRestorer)(tree, (path) => (0, workspace_files_js_1.isRawWorkspaceAuthorityPath)(path) ||
1279
- (path.startsWith(slicePrefix) &&
1280
- (0, built_in_plan_js_1.isBuiltInSliceFormatSensitivePath)(path.slice(slicePrefix.length))));
1281
- await (0, formatting_js_1.formatChangedTreeToFixedPoint)(tree, restoreProtectedFiles);
270
+ for (const path of [...Object.keys(plan.files), 'infra/product.ts']) {
271
+ await (0, formatting_js_1.formatTreeFileToFixedPoint)(deferred, node_path_1.posix.join(root, path));
272
+ }
1282
273
  }
1283
- (0, index_js_1.recordCompositionOwnership)(tree, {
274
+ (0, index_js_1.recordCompositionOwnership)(deferred, {
1284
275
  compositions: [{ feature, kind, name: workload }],
1285
- foundation: foundationRequirement,
1286
- paths: [
1287
- ...plan.paths,
1288
- { path: 'infra/foundation.ts' },
1289
- { path: 'infra/product.ts' },
1290
- { path: 'infra/native-runtime-authority/topology.ts' },
1291
- { path: 'infra/native-runtime-authority/effective-intent.ts' },
1292
- { path: logging_registry_js_1.SLICE_LOGGING_REGISTRY_PATH },
1293
- { mode: 'seeded', path: performance_registration_js_1.WORKLOAD_PERFORMANCE_POLICY_PATH },
1294
- ...performanceRegistration.additionalFiles.map(({ mode, path }) => ({
1295
- mode,
1296
- path: node_path_1.posix.relative(sliceRoot, path),
1297
- })),
1298
- { mode: 'seeded', path: reliability_registration_js_1.WORKLOAD_RELIABILITY_REGISTRY_PATH },
1299
- { mode: 'seeded', path: RELEASE_REGISTRY_PATH },
1300
- ],
276
+ foundation,
277
+ paths: [...plan.paths, { path: 'infra/product.ts' }],
1301
278
  projects: [plan.project],
1302
279
  slice,
1303
280
  });
1304
- if (!options.skipFormat) {
1305
- await (0, formatting_js_1.formatTreeFileToFixedPoint)(tree, node_path_1.posix.join(sliceRoot, '.ebk/ownership.json'));
1306
- }
1307
- if (options.skipInstall)
1308
- return undefined;
1309
- if (!installState) {
1310
- throw new Error('Post-generation install state was not prepared.');
1311
- }
1312
- return (0, post_generation_install_js_1.createPostGenerationInstallCallback)(tree, installState, installScope, installOperation);
1313
- }
1314
- async function workloadGenerator(tree, options, kind) {
1315
- const deferred = new preview_changes_js_1.DeferredDeveloperAgentTree(tree);
1316
- const install = await executeWorkloadGenerator(deferred, options, kind);
281
+ if (!options.skipFormat)
282
+ await (0, formatting_js_1.formatTreeFileToFixedPoint)(deferred, ownershipPath);
1317
283
  deferred.apply();
1318
- return install;
284
+ if (installState)
285
+ return (0, post_generation_install_js_1.createPostGenerationInstallCallback)(tree, installState, installScope, installOperation);
1319
286
  }
1320
287
  //# sourceMappingURL=workload.js.map