@empire-builder-kit/nx 1.0.0-rc.47 → 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 (764) hide show
  1. package/README.md +14 -169
  2. package/executors.json +24 -79
  3. package/generators.json +8 -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 -272
  29. package/src/aws-authority/stage-authority.js +109 -3609
  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 +3 -68
  42. package/src/executors/dev-doctor/dev-doctor.js +2 -2
  43. package/src/executors/local-deploy/deployed-smoke.d.ts +12 -0
  44. package/src/executors/local-deploy/deployed-smoke.js +115 -0
  45. package/src/executors/local-deploy/deployment-authority.d.ts +24 -0
  46. package/src/executors/local-deploy/deployment-authority.js +81 -0
  47. package/src/executors/local-deploy/deployment-child.d.ts +18 -0
  48. package/src/executors/local-deploy/deployment-child.js +77 -0
  49. package/src/executors/local-deploy/deployment-contracts.d.ts +96 -0
  50. package/src/executors/local-deploy/deployment-contracts.js +3 -0
  51. package/src/executors/local-deploy/deployment-projects.d.ts +4 -0
  52. package/src/executors/local-deploy/deployment-projects.js +16 -0
  53. package/src/executors/local-deploy/deployment-receipt.d.ts +4 -0
  54. package/src/executors/local-deploy/deployment-receipt.js +55 -0
  55. package/src/executors/local-deploy/deployment-scope.d.ts +17 -0
  56. package/src/executors/local-deploy/deployment-scope.js +239 -0
  57. package/src/executors/local-deploy/deployment-source.d.ts +13 -0
  58. package/src/executors/local-deploy/deployment-source.js +86 -0
  59. package/src/executors/local-deploy/local-deploy.d.ts +5 -121
  60. package/src/executors/local-deploy/local-deploy.js +55 -936
  61. package/src/executors/sst-lifecycle/governed-child-process.d.ts +27 -0
  62. package/src/executors/sst-lifecycle/governed-child-process.js +277 -0
  63. package/src/executors/sst-lifecycle/governed-native-operation.js +4 -10
  64. package/src/executors/sst-lifecycle/run-sst-command.d.ts +4 -85
  65. package/src/executors/sst-lifecycle/run-sst-command.js +28 -834
  66. package/src/executors/sst-lifecycle/sst-contracts.d.ts +44 -0
  67. package/src/executors/sst-lifecycle/sst-contracts.js +3 -0
  68. package/src/executors/sst-lifecycle/sst-invocation.d.ts +17 -0
  69. package/src/executors/sst-lifecycle/sst-invocation.js +502 -0
  70. package/src/executors/sst-lifecycle/task-unlock.js +3 -3
  71. package/src/foundation/discovery.d.ts +1 -5
  72. package/src/foundation/discovery.js +0 -2
  73. package/src/foundation/index.d.ts +0 -2
  74. package/src/foundation/index.js +0 -9
  75. package/src/foundation/local-private-smoke-access.d.ts +6 -15
  76. package/src/foundation/local-private-smoke-access.js +8 -192
  77. package/src/foundation/observability.d.ts +16 -26
  78. package/src/foundation/observability.js +34 -135
  79. package/src/foundation/preflight.js +0 -14
  80. package/src/foundation/private-smoke-access.d.ts +7 -14
  81. package/src/foundation/private-smoke-access.js +4 -126
  82. package/src/foundation/root-site-workspace.d.ts +35 -0
  83. package/src/foundation/root-site-workspace.js +80 -0
  84. package/src/foundation/root-site.d.ts +8 -7
  85. package/src/foundation/root-site.js +17 -9
  86. package/src/generators/formatting.js +5 -4
  87. package/src/generators/function/function.d.ts +9 -5
  88. package/src/generators/function/function.js +106 -136
  89. package/src/generators/function/schema.json +2 -2
  90. package/src/generators/function-access/function-access.d.ts +0 -6
  91. package/src/generators/function-access/function-access.js +41 -109
  92. package/src/generators/observability-policy.js +1 -2
  93. package/src/{supply-chain → generators}/pnpm-toolchain-authority.d.ts +3 -3
  94. package/src/{supply-chain → generators}/pnpm-toolchain-authority.js +12 -12
  95. package/src/generators/post-generation-install.d.ts +1 -8
  96. package/src/generators/post-generation-install.js +11 -139
  97. package/src/generators/preset/dependency-overrides.d.ts +13 -19
  98. package/src/generators/preset/dependency-overrides.js +12 -56
  99. package/src/generators/preset/generator.js +0 -3
  100. package/src/generators/preset/workspace-files-foundation-infra.d.ts +6 -0
  101. package/src/generators/preset/workspace-files-foundation-infra.js +586 -0
  102. package/src/generators/preset/workspace-files-foundation-readme.d.ts +5 -0
  103. package/src/generators/preset/workspace-files-foundation-readme.js +90 -0
  104. package/src/generators/preset/workspace-files-foundation.d.ts +3 -0
  105. package/src/generators/preset/workspace-files-foundation.js +170 -0
  106. package/src/generators/preset/workspace-files-ownership.d.ts +9 -0
  107. package/src/generators/preset/workspace-files-ownership.js +124 -0
  108. package/src/generators/preset/workspace-files-root-config.d.ts +32 -0
  109. package/src/generators/preset/workspace-files-root-config.js +356 -0
  110. package/src/generators/preset/workspace-files-root-docs.d.ts +5 -0
  111. package/src/generators/preset/workspace-files-root-docs.js +109 -0
  112. package/src/generators/preset/workspace-files-shared.d.ts +18 -0
  113. package/src/generators/preset/workspace-files-shared.js +7 -0
  114. package/src/generators/preset/workspace-files-workflows.d.ts +39 -0
  115. package/src/generators/preset/workspace-files-workflows.js +306 -0
  116. package/src/generators/preset/workspace-files-workspace-health.d.ts +6 -0
  117. package/src/generators/preset/workspace-files-workspace-health.js +148 -0
  118. package/src/generators/preset/workspace-files.d.ts +10 -24
  119. package/src/generators/preset/workspace-files.js +48 -10705
  120. package/src/generators/site/built-in-site-documentation-files.d.ts +2 -1
  121. package/src/generators/site/built-in-site-documentation-files.js +15 -56
  122. package/src/generators/site/built-in-site-files.d.ts +4 -1
  123. package/src/generators/site/built-in-site-files.js +12 -11
  124. package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -1
  125. package/src/generators/site/built-in-site-infrastructure-files.js +46 -206
  126. package/src/generators/site/built-in-site-plan.d.ts +5 -1
  127. package/src/generators/site/built-in-site-plan.js +7 -5
  128. package/src/generators/site/built-in-site-project-files.d.ts +10 -2
  129. package/src/generators/site/built-in-site-project-files.js +131 -177
  130. package/src/generators/site/built-in-site-script-files.d.ts +2 -0
  131. package/src/generators/site/built-in-site-script-files.js +76 -280
  132. package/src/generators/site/built-in-site-shared.d.ts +64 -4
  133. package/src/generators/site/built-in-site-shared.js +307 -14
  134. package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -1
  135. package/src/generators/site/built-in-site-sst-config-files.js +90 -22
  136. package/src/generators/site/built-in-site-web-files.d.ts +2 -1
  137. package/src/generators/site/built-in-site-web-files.js +19 -225
  138. package/src/generators/site/schema.d.ts +5 -0
  139. package/src/generators/site/schema.json +6 -0
  140. package/src/generators/site/site.d.ts +0 -8
  141. package/src/generators/site/site.js +17 -85
  142. package/src/generators/slice/built-in-plan-api-files.d.ts +1 -2
  143. package/src/generators/slice/built-in-plan-api-files.js +30 -890
  144. package/src/generators/slice/built-in-plan-database-lifecycle-files.js +57 -1851
  145. package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +5 -2
  146. package/src/generators/slice/built-in-plan-infrastructure-files.js +80 -3272
  147. package/src/generators/slice/built-in-plan-key-value-files.d.ts +3 -2
  148. package/src/generators/slice/built-in-plan-key-value-files.js +3 -21
  149. package/src/generators/slice/built-in-plan-project-files.d.ts +5 -3
  150. package/src/generators/slice/built-in-plan-project-files.js +79 -897
  151. package/src/generators/slice/built-in-plan-shared.d.ts +3 -18
  152. package/src/generators/slice/built-in-plan-shared.js +4 -57
  153. package/src/generators/slice/built-in-plan-web-files.d.ts +1 -1
  154. package/src/generators/slice/built-in-plan-web-files.js +14 -540
  155. package/src/generators/slice/built-in-plan.d.ts +2 -3
  156. package/src/generators/slice/built-in-plan.js +79 -277
  157. package/src/{developer-agent/preview-changes.d.ts → generators/slice/generation-tree.d.ts} +1 -5
  158. package/src/generators/slice/generation-tree.js +161 -0
  159. package/src/generators/slice/schema.json +12 -4
  160. package/src/generators/slice/slice-config.d.ts +7 -0
  161. package/src/generators/slice/slice-config.js +125 -0
  162. package/src/generators/slice/slice.js +29 -261
  163. package/src/generators/slice/sql-bootstrap.d.ts +1 -0
  164. package/src/generators/slice/sql-bootstrap.js +505 -0
  165. package/src/generators/slice/sql-client.d.ts +1 -0
  166. package/src/generators/slice/sql-client.js +107 -0
  167. package/src/generators/slice/sql-infrastructure.d.ts +1 -0
  168. package/src/generators/slice/sql-infrastructure.js +225 -0
  169. package/src/generators/slice/sql-logging.d.ts +1 -0
  170. package/src/generators/slice/sql-logging.js +266 -0
  171. package/src/generators/slice/sql-migration.d.ts +2 -0
  172. package/src/generators/slice/sql-migration.js +202 -0
  173. package/src/generators/slice/standard-slice-contract.d.ts +25 -0
  174. package/src/generators/slice/standard-slice-contract.js +64 -0
  175. package/src/generators/sql/schema.json +1 -1
  176. package/src/generators/sql/sql.d.ts +1 -1
  177. package/src/generators/sql/sql.js +13 -7
  178. package/src/generators/upgrade/framework-package-upgrade.d.ts +4 -27
  179. package/src/generators/upgrade/framework-package-upgrade.js +16 -39
  180. package/src/generators/upgrade/framework-packages.d.ts +25 -0
  181. package/src/generators/upgrade/framework-packages.js +138 -0
  182. package/src/generators/upgrade/function-authentication-notice.d.ts +10 -18
  183. package/src/generators/upgrade/function-authentication-notice.js +24 -44
  184. package/src/generators/upgrade/schema.d.ts +0 -3
  185. package/src/generators/upgrade/schema.json +6 -16
  186. package/src/generators/upgrade/slice-compositions.d.ts +20 -0
  187. package/src/generators/upgrade/slice-compositions.js +100 -0
  188. package/src/generators/upgrade/slice-upgrade-guidance.d.ts +19 -0
  189. package/src/generators/upgrade/slice-upgrade-guidance.js +50 -0
  190. package/src/generators/upgrade/slice-upgrade.d.ts +4 -0
  191. package/src/generators/upgrade/slice-upgrade.js +231 -0
  192. package/src/generators/upgrade/upgrade-plan.d.ts +10 -13
  193. package/src/generators/upgrade/upgrade-plan.js +33 -197
  194. package/src/generators/upgrade/upgrade-preflight.d.ts +20 -0
  195. package/src/generators/upgrade/upgrade-preflight.js +64 -0
  196. package/src/generators/upgrade/upgrade.d.ts +8 -53
  197. package/src/generators/upgrade/upgrade.js +23 -1571
  198. package/src/generators/workload/schema.json +2 -2
  199. package/src/generators/workload/workload.d.ts +11 -11
  200. package/src/generators/workload/workload.js +166 -1255
  201. package/src/index.d.ts +0 -5
  202. package/src/index.js +0 -5
  203. package/src/local-dev/browser-verification.d.ts +0 -7
  204. package/src/local-dev/browser-verification.js +0 -136
  205. package/src/local-dev/contracts.d.ts +6 -0
  206. package/src/local-dev/contracts.js +17 -9
  207. package/src/local-dev/environment-checks.d.ts +126 -0
  208. package/src/local-dev/environment-checks.js +81 -0
  209. package/src/local-dev/environment-inspector.d.ts +3 -124
  210. package/src/local-dev/environment-inspector.js +9 -148
  211. package/src/local-dev/private-state.d.ts +1 -0
  212. package/src/local-dev/private-state.js +19 -23
  213. package/src/local-dev/process-identity.js +4 -2
  214. package/src/local-dev/slice-runner-child.d.ts +37 -0
  215. package/src/local-dev/slice-runner-child.js +127 -0
  216. package/src/local-dev/slice-runner-recovery.d.ts +32 -0
  217. package/src/local-dev/slice-runner-recovery.js +216 -0
  218. package/src/local-dev/slice-runner-state.d.ts +82 -0
  219. package/src/local-dev/slice-runner-state.js +265 -0
  220. package/src/local-dev/slice-runner.d.ts +4 -117
  221. package/src/local-dev/slice-runner.js +59 -594
  222. package/src/local-dev/tls.js +8 -97
  223. package/src/ownership/index.d.ts +1 -0
  224. package/src/ownership/index.js +6 -0
  225. package/src/ownership/pnpm-workspace.d.ts +77 -0
  226. package/src/ownership/pnpm-workspace.js +225 -0
  227. package/src/ownership/site-record.d.ts +8 -0
  228. package/src/ownership/site-record.js +17 -2
  229. package/src/repository-policy/capacity-migration.d.ts +1 -1
  230. package/src/repository-policy/capacity-migration.js +1 -1
  231. package/src/repository-policy/foundation-router.d.ts +17 -0
  232. package/src/repository-policy/foundation-router.js +44 -0
  233. package/src/repository-policy/index.d.ts +2 -0
  234. package/src/repository-policy/index.js +2 -0
  235. package/src/repository-policy/policy-accounts.d.ts +22 -0
  236. package/src/repository-policy/policy-accounts.js +134 -0
  237. package/src/repository-policy/policy-files.d.ts +8 -0
  238. package/src/repository-policy/policy-files.js +201 -0
  239. package/src/repository-policy/policy-internal.d.ts +2 -0
  240. package/src/repository-policy/policy-internal.js +11 -0
  241. package/src/repository-policy/policy-model.d.ts +95 -0
  242. package/src/repository-policy/policy-model.js +42 -0
  243. package/src/repository-policy/policy-validation.d.ts +4 -0
  244. package/src/repository-policy/policy-validation.js +308 -0
  245. package/src/repository-policy/policy.d.ts +5 -120
  246. package/src/repository-policy/policy.js +34 -662
  247. package/src/repository-policy/public-dns.d.ts +4 -0
  248. package/src/repository-policy/public-dns.js +102 -5
  249. package/src/{generators/repository-policy → repository-policy}/tree-policy.d.ts +1 -1
  250. package/src/{generators/repository-policy → repository-policy}/tree-policy.js +5 -5
  251. package/src/schemas/repository-policy-v1.json +40 -3
  252. package/src/secrets/index.d.ts +0 -5
  253. package/src/secrets/index.js +0 -5
  254. package/src/slice-infra/index.d.ts +57 -0
  255. package/src/slice-infra/index.js +117 -0
  256. package/src/slice-scripts/build.d.ts +27 -0
  257. package/src/slice-scripts/build.js +120 -0
  258. package/src/slice-scripts/database.d.ts +87 -0
  259. package/src/slice-scripts/database.js +328 -0
  260. package/src/slice-scripts/index.d.ts +11 -0
  261. package/src/slice-scripts/index.js +23 -0
  262. package/src/slice-scripts/root-site-routes.d.ts +11 -0
  263. package/src/slice-scripts/root-site-routes.js +83 -0
  264. package/src/slice-scripts/sql-migration-engine.mjs +180 -0
  265. package/src/workload-roles/effective-policy.d.ts +0 -37
  266. package/src/workload-roles/effective-policy.js +1 -174
  267. package/src/workload-roles/standard-slice.d.ts +2 -19
  268. package/src/workload-roles/standard-slice.js +3 -129
  269. package/src/api-contract/baseline-update.d.ts +0 -82
  270. package/src/api-contract/baseline-update.js +0 -225
  271. package/src/api-contract/compatibility.d.ts +0 -30
  272. package/src/api-contract/compatibility.js +0 -643
  273. package/src/api-contract/contract-graph.d.ts +0 -35
  274. package/src/api-contract/contract-graph.js +0 -141
  275. package/src/api-contract/evidence.d.ts +0 -23
  276. package/src/api-contract/evidence.js +0 -87
  277. package/src/api-contract/index.d.ts +0 -6
  278. package/src/api-contract/index.js +0 -10
  279. package/src/api-contract/model.d.ts +0 -144
  280. package/src/api-contract/model.js +0 -993
  281. package/src/api-contract/rollout.d.ts +0 -32
  282. package/src/api-contract/rollout.js +0 -88
  283. package/src/authorization/compatibility.d.ts +0 -62
  284. package/src/authorization/compatibility.js +0 -175
  285. package/src/authorization/index.d.ts +0 -1
  286. package/src/authorization/index.js +0 -5
  287. package/src/blueprints/execution.d.ts +0 -55
  288. package/src/blueprints/execution.js +0 -329
  289. package/src/blueprints/external-sandbox.d.ts +0 -53
  290. package/src/blueprints/external-sandbox.js +0 -1194
  291. package/src/blueprints/index.d.ts +0 -5
  292. package/src/blueprints/index.js +0 -9
  293. package/src/blueprints/inputs.d.ts +0 -43
  294. package/src/blueprints/inputs.js +0 -103
  295. package/src/blueprints/manifest.d.ts +0 -281
  296. package/src/blueprints/manifest.js +0 -424
  297. package/src/blueprints/resolver.d.ts +0 -37
  298. package/src/blueprints/resolver.js +0 -387
  299. package/src/blueprints/transitions.d.ts +0 -20
  300. package/src/blueprints/transitions.js +0 -61
  301. package/src/cli/agent-command.d.ts +0 -30
  302. package/src/cli/agent-command.js +0 -204
  303. package/src/cli/agent-runtime.d.ts +0 -25
  304. package/src/cli/agent-runtime.js +0 -498
  305. package/src/cli/blueprint-authority.d.ts +0 -9
  306. package/src/cli/blueprint-authority.js +0 -43
  307. package/src/cli/blueprint-command.d.ts +0 -24
  308. package/src/cli/blueprint-command.js +0 -63
  309. package/src/data-lifecycle/index.d.ts +0 -3
  310. package/src/data-lifecycle/index.js +0 -7
  311. package/src/data-lifecycle/model.d.ts +0 -172
  312. package/src/data-lifecycle/model.js +0 -95
  313. package/src/data-lifecycle/sensitive-artifacts.d.ts +0 -28
  314. package/src/data-lifecycle/sensitive-artifacts.js +0 -146
  315. package/src/data-lifecycle/validation.d.ts +0 -32
  316. package/src/data-lifecycle/validation.js +0 -837
  317. package/src/database-retirement/contract.d.ts +0 -68
  318. package/src/database-retirement/contract.js +0 -166
  319. package/src/database-retirement/index.d.ts +0 -1
  320. package/src/database-retirement/index.js +0 -5
  321. package/src/developer-agent/context.d.ts +0 -57
  322. package/src/developer-agent/context.js +0 -662
  323. package/src/developer-agent/generator-planning.d.ts +0 -34
  324. package/src/developer-agent/generator-planning.js +0 -759
  325. package/src/developer-agent/generator-preview.d.ts +0 -8
  326. package/src/developer-agent/generator-preview.js +0 -650
  327. package/src/developer-agent/git-inspection.d.ts +0 -112
  328. package/src/developer-agent/git-inspection.js +0 -887
  329. package/src/developer-agent/handoff.d.ts +0 -43
  330. package/src/developer-agent/handoff.js +0 -713
  331. package/src/developer-agent/index.d.ts +0 -10
  332. package/src/developer-agent/index.js +0 -14
  333. package/src/developer-agent/model.d.ts +0 -497
  334. package/src/developer-agent/model.js +0 -144
  335. package/src/developer-agent/operation-registry.d.ts +0 -61
  336. package/src/developer-agent/operation-registry.js +0 -1591
  337. package/src/developer-agent/ordering.d.ts +0 -9
  338. package/src/developer-agent/ordering.js +0 -15
  339. package/src/developer-agent/planning.d.ts +0 -25
  340. package/src/developer-agent/planning.js +0 -481
  341. package/src/developer-agent/preview-changes.js +0 -225
  342. package/src/developer-agent/preview-source.d.ts +0 -2
  343. package/src/developer-agent/preview-source.js +0 -19
  344. package/src/developer-agent/validation.d.ts +0 -30
  345. package/src/developer-agent/validation.js +0 -2729
  346. package/src/developer-agent/workspace-inspection.d.ts +0 -20
  347. package/src/developer-agent/workspace-inspection.js +0 -1236
  348. package/src/developer-agent/workspace-path.d.ts +0 -6
  349. package/src/developer-agent/workspace-path.js +0 -22
  350. package/src/executors/blueprint-trust/blueprint-trust.d.ts +0 -29
  351. package/src/executors/blueprint-trust/blueprint-trust.js +0 -121
  352. package/src/executors/blueprint-trust/schema.json +0 -27
  353. package/src/executors/blueprint-verification/blueprint-verification.d.ts +0 -13
  354. package/src/executors/blueprint-verification/blueprint-verification.js +0 -110
  355. package/src/executors/blueprint-verification/schema.json +0 -44
  356. package/src/executors/developer-context/developer-context.d.ts +0 -38
  357. package/src/executors/developer-context/developer-context.js +0 -78
  358. package/src/executors/developer-context/schema.json +0 -87
  359. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +0 -19
  360. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +0 -105
  361. package/src/executors/foundation-profile-preflight/schema.json +0 -32
  362. package/src/executors/github-bootstrap/github-bootstrap.d.ts +0 -13
  363. package/src/executors/github-bootstrap/github-bootstrap.js +0 -62
  364. package/src/executors/github-bootstrap/schema.json +0 -50
  365. package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +0 -37
  366. package/src/executors/infrastructure-plan/infrastructure-plan.js +0 -275
  367. package/src/executors/infrastructure-plan/schema.json +0 -38
  368. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.d.ts +0 -42
  369. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +0 -1229
  370. package/src/executors/router-waf-rehearsal/schema.json +0 -29
  371. package/src/executors/secret-guardrails/schema.json +0 -6
  372. package/src/executors/secret-guardrails/secret-guardrails.d.ts +0 -3
  373. package/src/executors/secret-guardrails/secret-guardrails.js +0 -44
  374. package/src/executors/secret-initialize/schema.json +0 -42
  375. package/src/executors/secret-initialize/secret-initialize.d.ts +0 -34
  376. package/src/executors/secret-initialize/secret-initialize.js +0 -297
  377. package/src/executors/secret-metadata/schema.json +0 -36
  378. package/src/executors/secret-metadata/secret-metadata.d.ts +0 -46
  379. package/src/executors/secret-metadata/secret-metadata.js +0 -230
  380. package/src/executors/sst-lifecycle/generated-secret-retirement.d.ts +0 -53
  381. package/src/executors/sst-lifecycle/generated-secret-retirement.js +0 -192
  382. package/src/executors/sst-lifecycle/logging-preflight.d.ts +0 -22
  383. package/src/executors/sst-lifecycle/logging-preflight.js +0 -217
  384. package/src/executors/sst-lifecycle/secret-preflight.d.ts +0 -27
  385. package/src/executors/sst-lifecycle/secret-preflight.js +0 -125
  386. package/src/executors/work-markers/schema.json +0 -14
  387. package/src/executors/work-markers/work-markers.d.ts +0 -6
  388. package/src/executors/work-markers/work-markers.js +0 -20
  389. package/src/foundation/cost-estimate.d.ts +0 -175
  390. package/src/foundation/cost-estimate.js +0 -706
  391. package/src/foundation/private-smoke-admission.d.ts +0 -45
  392. package/src/foundation/private-smoke-admission.js +0 -180
  393. package/src/foundation/private-smoke-control-plane.d.ts +0 -18
  394. package/src/foundation/private-smoke-control-plane.js +0 -184
  395. package/src/foundation/root-site-readiness.d.ts +0 -27
  396. package/src/foundation/root-site-readiness.js +0 -78
  397. package/src/foundation/router-waf-rate-rehearsal.d.ts +0 -97
  398. package/src/foundation/router-waf-rate-rehearsal.js +0 -210
  399. package/src/foundation/router-waf.d.ts +0 -149
  400. package/src/foundation/router-waf.js +0 -809
  401. package/src/frontend-security/index.d.ts +0 -1
  402. package/src/frontend-security/index.js +0 -5
  403. package/src/frontend-security/security-headers.d.ts +0 -50
  404. package/src/frontend-security/security-headers.js +0 -418
  405. package/src/generators/blueprint/blueprint.d.ts +0 -5
  406. package/src/generators/blueprint/blueprint.js +0 -102
  407. package/src/generators/blueprint/files.d.ts +0 -6
  408. package/src/generators/blueprint/files.js +0 -217
  409. package/src/generators/blueprint/schema.d.ts +0 -4
  410. package/src/generators/blueprint/schema.json +0 -18
  411. package/src/generators/feature-registry.d.ts +0 -13
  412. package/src/generators/feature-registry.js +0 -73
  413. package/src/generators/function/function-registration.d.ts +0 -24
  414. package/src/generators/function/function-registration.js +0 -66
  415. package/src/generators/observability-infrastructure.d.ts +0 -2
  416. package/src/generators/observability-infrastructure.js +0 -31
  417. package/src/generators/preset/workspace-files-adopter-skills.d.ts +0 -7
  418. package/src/generators/preset/workspace-files-adopter-skills.js +0 -359
  419. package/src/generators/preset/workspace-files-agent-development.d.ts +0 -9
  420. package/src/generators/preset/workspace-files-agent-development.js +0 -42
  421. package/src/generators/preset/workspace-files-ci-acceptance.d.ts +0 -1
  422. package/src/generators/preset/workspace-files-ci-acceptance.js +0 -791
  423. package/src/generators/preset/workspace-files-ci-install.d.ts +0 -2
  424. package/src/generators/preset/workspace-files-ci-install.js +0 -196
  425. package/src/generators/preset/workspace-files-developer-agent.d.ts +0 -16
  426. package/src/generators/preset/workspace-files-developer-agent.js +0 -644
  427. package/src/generators/preset/workspace-files-ecr-inspector.d.ts +0 -18
  428. package/src/generators/preset/workspace-files-ecr-inspector.js +0 -298
  429. package/src/generators/preset/workspace-files-foundation-workload-roles.d.ts +0 -6
  430. package/src/generators/preset/workspace-files-foundation-workload-roles.js +0 -409
  431. package/src/generators/preset/workspace-files-performance-cost.d.ts +0 -66
  432. package/src/generators/preset/workspace-files-performance-cost.js +0 -866
  433. package/src/generators/preset/workspace-files-performance-load.d.ts +0 -73
  434. package/src/generators/preset/workspace-files-performance-load.js +0 -815
  435. package/src/generators/preset/workspace-files-shared-operation-claims.d.ts +0 -10
  436. package/src/generators/preset/workspace-files-shared-operation-claims.js +0 -59
  437. package/src/generators/preset/workspace-files-stage-authority.d.ts +0 -6
  438. package/src/generators/preset/workspace-files-stage-authority.js +0 -586
  439. package/src/generators/preset/workspace-files-thin-deploy.d.ts +0 -76
  440. package/src/generators/preset/workspace-files-thin-deploy.js +0 -2563
  441. package/src/generators/preset/workspace-files-thin-docs.d.ts +0 -7
  442. package/src/generators/preset/workspace-files-thin-docs.js +0 -386
  443. package/src/generators/preset/workspace-files-thin-release.d.ts +0 -14
  444. package/src/generators/preset/workspace-files-thin-release.js +0 -26
  445. package/src/generators/preset/workspace-files-workload-role-baseline.d.ts +0 -9
  446. package/src/generators/preset/workspace-files-workload-role-baseline.js +0 -1314
  447. package/src/generators/repository-policy/repository-policy.d.ts +0 -4
  448. package/src/generators/repository-policy/repository-policy.js +0 -294
  449. package/src/generators/repository-policy/schema.d.ts +0 -30
  450. package/src/generators/repository-policy/schema.json +0 -127
  451. package/src/generators/site/built-in-site-smoke-files.d.ts +0 -2
  452. package/src/generators/site/built-in-site-smoke-files.js +0 -37
  453. package/src/generators/slice/built-in-plan-alarm-identity.d.ts +0 -182
  454. package/src/generators/slice/built-in-plan-alarm-identity.js +0 -209
  455. package/src/generators/slice/built-in-plan-api-contract-files.d.ts +0 -2
  456. package/src/generators/slice/built-in-plan-api-contract-files.js +0 -2848
  457. package/src/generators/slice/built-in-plan-async-work-files.d.ts +0 -2
  458. package/src/generators/slice/built-in-plan-async-work-files.js +0 -6118
  459. package/src/generators/slice/built-in-plan-authorization-files.d.ts +0 -2
  460. package/src/generators/slice/built-in-plan-authorization-files.js +0 -2082
  461. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.d.ts +0 -2
  462. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +0 -1301
  463. package/src/generators/slice/built-in-plan-authorization-storage.d.ts +0 -3
  464. package/src/generators/slice/built-in-plan-authorization-storage.js +0 -119
  465. package/src/generators/slice/built-in-plan-background-work-files.d.ts +0 -2
  466. package/src/generators/slice/built-in-plan-background-work-files.js +0 -99
  467. package/src/generators/slice/built-in-plan-data-deletion-files.d.ts +0 -2
  468. package/src/generators/slice/built-in-plan-data-deletion-files.js +0 -273
  469. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.d.ts +0 -2
  470. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +0 -223
  471. package/src/generators/slice/built-in-plan-data-files.d.ts +0 -2
  472. package/src/generators/slice/built-in-plan-data-files.js +0 -618
  473. package/src/generators/slice/built-in-plan-data-lifecycle-files.d.ts +0 -2
  474. package/src/generators/slice/built-in-plan-data-lifecycle-files.js +0 -775
  475. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.d.ts +0 -2
  476. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +0 -863
  477. package/src/generators/slice/built-in-plan-data-retention-job-files.d.ts +0 -2
  478. package/src/generators/slice/built-in-plan-data-retention-job-files.js +0 -169
  479. package/src/generators/slice/built-in-plan-data-retention-launcher-files.d.ts +0 -2
  480. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +0 -186
  481. package/src/generators/slice/built-in-plan-data-rights-files.d.ts +0 -2
  482. package/src/generators/slice/built-in-plan-data-rights-files.js +0 -152
  483. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.d.ts +0 -2
  484. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +0 -508
  485. package/src/generators/slice/built-in-plan-event-contract-literal.d.ts +0 -6
  486. package/src/generators/slice/built-in-plan-event-contract-literal.js +0 -52
  487. package/src/generators/slice/built-in-plan-foundation-files.d.ts +0 -15
  488. package/src/generators/slice/built-in-plan-foundation-files.js +0 -314
  489. package/src/generators/slice/built-in-plan-frontend-files.d.ts +0 -2
  490. package/src/generators/slice/built-in-plan-frontend-files.js +0 -1975
  491. package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +0 -6
  492. package/src/generators/slice/built-in-plan-frontend-header-proof.js +0 -282
  493. package/src/generators/slice/built-in-plan-infrastructure-safety-files.d.ts +0 -2
  494. package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +0 -373
  495. package/src/generators/slice/built-in-plan-key-value-cleanup.d.ts +0 -4
  496. package/src/generators/slice/built-in-plan-key-value-cleanup.js +0 -101
  497. package/src/generators/slice/built-in-plan-key-value-consumer.d.ts +0 -4
  498. package/src/generators/slice/built-in-plan-key-value-consumer.js +0 -151
  499. package/src/generators/slice/built-in-plan-key-value-deletion.d.ts +0 -2
  500. package/src/generators/slice/built-in-plan-key-value-deletion.js +0 -377
  501. package/src/generators/slice/built-in-plan-key-value-delivery.d.ts +0 -2
  502. package/src/generators/slice/built-in-plan-key-value-delivery.js +0 -137
  503. package/src/generators/slice/built-in-plan-key-value-export.d.ts +0 -2
  504. package/src/generators/slice/built-in-plan-key-value-export.js +0 -595
  505. package/src/generators/slice/built-in-plan-key-value-holds.d.ts +0 -2
  506. package/src/generators/slice/built-in-plan-key-value-holds.js +0 -189
  507. package/src/generators/slice/built-in-plan-key-value-infrastructure.d.ts +0 -2
  508. package/src/generators/slice/built-in-plan-key-value-infrastructure.js +0 -102
  509. package/src/generators/slice/built-in-plan-key-value-performance.d.ts +0 -5
  510. package/src/generators/slice/built-in-plan-key-value-performance.js +0 -530
  511. package/src/generators/slice/built-in-plan-key-value-provider.d.ts +0 -4
  512. package/src/generators/slice/built-in-plan-key-value-provider.js +0 -366
  513. package/src/generators/slice/built-in-plan-key-value-records.d.ts +0 -3
  514. package/src/generators/slice/built-in-plan-key-value-records.js +0 -232
  515. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.d.ts +0 -2
  516. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +0 -103
  517. package/src/generators/slice/built-in-plan-key-value-retention-job-files.d.ts +0 -2
  518. package/src/generators/slice/built-in-plan-key-value-retention-job-files.js +0 -160
  519. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.d.ts +0 -2
  520. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.js +0 -329
  521. package/src/generators/slice/built-in-plan-key-value-retention-worker.d.ts +0 -2
  522. package/src/generators/slice/built-in-plan-key-value-retention-worker.js +0 -477
  523. package/src/generators/slice/built-in-plan-key-value-retention.d.ts +0 -2
  524. package/src/generators/slice/built-in-plan-key-value-retention.js +0 -184
  525. package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +0 -29
  526. package/src/generators/slice/built-in-plan-log-group-helpers.js +0 -130
  527. package/src/generators/slice/built-in-plan-metadata-files.d.ts +0 -3
  528. package/src/generators/slice/built-in-plan-metadata-files.js +0 -401
  529. package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +0 -2
  530. package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +0 -324
  531. package/src/generators/slice/built-in-plan-next-build-authority.d.ts +0 -5
  532. package/src/generators/slice/built-in-plan-next-build-authority.js +0 -124
  533. package/src/generators/slice/built-in-plan-operations-files.d.ts +0 -8
  534. package/src/generators/slice/built-in-plan-operations-files.js +0 -1106
  535. package/src/generators/slice/built-in-plan-performance-files.d.ts +0 -4
  536. package/src/generators/slice/built-in-plan-performance-files.js +0 -2444
  537. package/src/generators/slice/built-in-plan-release-files.d.ts +0 -2
  538. package/src/generators/slice/built-in-plan-release-files.js +0 -6585
  539. package/src/generators/slice/built-in-plan-reliability-files.d.ts +0 -2
  540. package/src/generators/slice/built-in-plan-reliability-files.js +0 -4728
  541. package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +0 -2
  542. package/src/generators/slice/built-in-plan-secret-runtime-files.js +0 -1015
  543. package/src/generators/slice/built-in-plan-sql-events.d.ts +0 -2
  544. package/src/generators/slice/built-in-plan-sql-events.js +0 -276
  545. package/src/generators/slice/built-in-plan-testing-files.d.ts +0 -2
  546. package/src/generators/slice/built-in-plan-testing-files.js +0 -2618
  547. package/src/generators/slice/built-in-plan-testing-persistence-event-files.d.ts +0 -7
  548. package/src/generators/slice/built-in-plan-testing-persistence-event-files.js +0 -487
  549. package/src/generators/slice/built-in-plan-testing-persistence-files.d.ts +0 -2
  550. package/src/generators/slice/built-in-plan-testing-persistence-files.js +0 -180
  551. package/src/generators/slice/built-in-plan-thin-release-files.d.ts +0 -11
  552. package/src/generators/slice/built-in-plan-thin-release-files.js +0 -162
  553. package/src/generators/slice/built-in-plan-verification-files.d.ts +0 -2
  554. package/src/generators/slice/built-in-plan-verification-files.js +0 -442
  555. package/src/generators/slice/built-in-plan-workload-role-files.d.ts +0 -2
  556. package/src/generators/slice/built-in-plan-workload-role-files.js +0 -2220
  557. package/src/generators/slice/data-policy-review-seed.d.ts +0 -2
  558. package/src/generators/slice/data-policy-review-seed.js +0 -22
  559. package/src/generators/slice/deployed-smoke-diagnostics.d.ts +0 -35
  560. package/src/generators/slice/deployed-smoke-diagnostics.js +0 -189
  561. package/src/generators/slice/deployed-smoke-readiness.d.ts +0 -9
  562. package/src/generators/slice/deployed-smoke-readiness.js +0 -309
  563. package/src/generators/slice/local-source-identity.d.ts +0 -2
  564. package/src/generators/slice/local-source-identity.js +0 -31
  565. package/src/generators/slice/pnpm-launch-script.d.ts +0 -13
  566. package/src/generators/slice/pnpm-launch-script.js +0 -28
  567. package/src/generators/upgrade/custom-domain-notice.d.ts +0 -19
  568. package/src/generators/upgrade/custom-domain-notice.js +0 -38
  569. package/src/generators/upgrade/external-blueprint-compositions.d.ts +0 -84
  570. package/src/generators/upgrade/external-blueprint-compositions.js +0 -478
  571. package/src/generators/upgrade/sql-seeded-reconciliation.d.ts +0 -2
  572. package/src/generators/upgrade/sql-seeded-reconciliation.js +0 -170
  573. package/src/generators/workload/performance-registration.d.ts +0 -33
  574. package/src/generators/workload/performance-registration.js +0 -224
  575. package/src/generators/workload/reliability-registration.d.ts +0 -16
  576. package/src/generators/workload/reliability-registration.js +0 -150
  577. package/src/generators/workload/service-performance-files.d.ts +0 -5
  578. package/src/generators/workload/service-performance-files.js +0 -1883
  579. package/src/git-policy/action-pins.d.ts +0 -43
  580. package/src/git-policy/action-pins.js +0 -50
  581. package/src/git-policy/github-bootstrap.d.ts +0 -95
  582. package/src/git-policy/github-bootstrap.js +0 -1250
  583. package/src/git-policy/index.d.ts +0 -3
  584. package/src/git-policy/index.js +0 -7
  585. package/src/git-policy/routing.d.ts +0 -21
  586. package/src/git-policy/routing.js +0 -138
  587. package/src/infrastructure-change/convergence.d.ts +0 -13
  588. package/src/infrastructure-change/convergence.js +0 -85
  589. package/src/infrastructure-change/drift.d.ts +0 -13
  590. package/src/infrastructure-change/drift.js +0 -112
  591. package/src/infrastructure-change/index.d.ts +0 -7
  592. package/src/infrastructure-change/index.js +0 -11
  593. package/src/infrastructure-change/local-capability.d.ts +0 -73
  594. package/src/infrastructure-change/local-capability.js +0 -114
  595. package/src/infrastructure-change/model.d.ts +0 -274
  596. package/src/infrastructure-change/model.js +0 -29
  597. package/src/infrastructure-change/normalize.d.ts +0 -16
  598. package/src/infrastructure-change/normalize.js +0 -285
  599. package/src/infrastructure-change/plan.d.ts +0 -67
  600. package/src/infrastructure-change/plan.js +0 -671
  601. package/src/infrastructure-change/risk.d.ts +0 -9
  602. package/src/infrastructure-change/risk.js +0 -349
  603. package/src/infrastructure-change/summary.d.ts +0 -20
  604. package/src/infrastructure-change/summary.js +0 -130
  605. package/src/performance/cost-collection.d.ts +0 -225
  606. package/src/performance/cost-collection.js +0 -827
  607. package/src/performance/cost-controls.d.ts +0 -135
  608. package/src/performance/cost-controls.js +0 -347
  609. package/src/performance/evidence.d.ts +0 -140
  610. package/src/performance/evidence.js +0 -601
  611. package/src/performance/index.d.ts +0 -10
  612. package/src/performance/index.js +0 -14
  613. package/src/performance/load-safety.d.ts +0 -84
  614. package/src/performance/load-safety.js +0 -348
  615. package/src/performance/model.d.ts +0 -129
  616. package/src/performance/model.js +0 -451
  617. package/src/performance/pr-artifact-budget.d.ts +0 -42
  618. package/src/performance/pr-artifact-budget.js +0 -151
  619. package/src/performance/runner.d.ts +0 -75
  620. package/src/performance/runner.js +0 -227
  621. package/src/performance/scenario-endpoint.d.ts +0 -1
  622. package/src/performance/scenario-endpoint.js +0 -5
  623. package/src/performance/scenario.d.ts +0 -215
  624. package/src/performance/scenario.js +0 -744
  625. package/src/performance/unit-cost.d.ts +0 -105
  626. package/src/performance/unit-cost.js +0 -364
  627. package/src/release/index.d.ts +0 -2
  628. package/src/release/index.js +0 -6
  629. package/src/release/lifecycle.d.ts +0 -132
  630. package/src/release/lifecycle.js +0 -411
  631. package/src/release/manifest.d.ts +0 -148
  632. package/src/release/manifest.js +0 -503
  633. package/src/release/rollout.d.ts +0 -170
  634. package/src/release/rollout.js +0 -578
  635. package/src/release/source-authority.d.ts +0 -19
  636. package/src/release/source-authority.js +0 -212
  637. package/src/schemas/aggregate-count-evidence-v1.json +0 -135
  638. package/src/schemas/api-contract-baseline-v1.json +0 -674
  639. package/src/schemas/api-contract-compatibility-report-v1.json +0 -126
  640. package/src/schemas/aws-billing-actual-evidence-v1.json +0 -407
  641. package/src/schemas/blueprint-input-schema-v1.json +0 -23
  642. package/src/schemas/blueprint-v1.json +0 -188
  643. package/src/schemas/data-lifecycle-policy-v1.json +0 -517
  644. package/src/schemas/performance-policy-v1.json +0 -335
  645. package/src/schemas/testing-evidence-quarantine-v1.json +0 -168
  646. package/src/schemas/testing-evidence-result-v1.json +0 -319
  647. package/src/secrets/aws-control-plane.d.ts +0 -29
  648. package/src/secrets/aws-control-plane.js +0 -322
  649. package/src/secrets/generated-aws-control-plane.d.ts +0 -33
  650. package/src/secrets/generated-aws-control-plane.js +0 -322
  651. package/src/secrets/guardrails.d.ts +0 -26
  652. package/src/secrets/guardrails.js +0 -328
  653. package/src/secrets/metadata.d.ts +0 -48
  654. package/src/secrets/metadata.js +0 -199
  655. package/src/secrets/operator.d.ts +0 -190
  656. package/src/secrets/operator.js +0 -701
  657. package/src/secrets/verification.d.ts +0 -18
  658. package/src/secrets/verification.js +0 -152
  659. package/src/supply-chain/action-pins.d.ts +0 -26
  660. package/src/supply-chain/action-pins.js +0 -262
  661. package/src/supply-chain/blueprint-trust-git.d.ts +0 -130
  662. package/src/supply-chain/blueprint-trust-git.js +0 -1666
  663. package/src/supply-chain/blueprint-trust-process.d.ts +0 -4
  664. package/src/supply-chain/blueprint-trust-process.js +0 -88
  665. package/src/supply-chain/blueprint-trust.d.ts +0 -354
  666. package/src/supply-chain/blueprint-trust.js +0 -1558
  667. package/src/supply-chain/blueprint-verification-authority.d.ts +0 -62
  668. package/src/supply-chain/blueprint-verification-authority.js +0 -679
  669. package/src/supply-chain/blueprint-verification-execution.d.ts +0 -68
  670. package/src/supply-chain/blueprint-verification-execution.js +0 -639
  671. package/src/supply-chain/build-output-bounds.d.ts +0 -2
  672. package/src/supply-chain/build-output-bounds.js +0 -12
  673. package/src/supply-chain/build-output.d.ts +0 -41
  674. package/src/supply-chain/build-output.js +0 -551
  675. package/src/supply-chain/common.d.ts +0 -21
  676. package/src/supply-chain/common.js +0 -107
  677. package/src/supply-chain/container-artifact-contract.d.ts +0 -23
  678. package/src/supply-chain/container-artifact-contract.js +0 -208
  679. package/src/supply-chain/container-release.d.ts +0 -119
  680. package/src/supply-chain/container-release.js +0 -496
  681. package/src/supply-chain/ecr-applicability.d.ts +0 -19
  682. package/src/supply-chain/ecr-applicability.js +0 -103
  683. package/src/supply-chain/ecr-scanning.d.ts +0 -85
  684. package/src/supply-chain/ecr-scanning.js +0 -325
  685. package/src/supply-chain/ecs-deployed-image.d.ts +0 -87
  686. package/src/supply-chain/ecs-deployed-image.js +0 -302
  687. package/src/supply-chain/errors.d.ts +0 -6
  688. package/src/supply-chain/errors.js +0 -15
  689. package/src/supply-chain/generated-blueprint-trust-command.d.ts +0 -4
  690. package/src/supply-chain/generated-blueprint-trust-command.js +0 -1394
  691. package/src/supply-chain/generated-command.d.ts +0 -1
  692. package/src/supply-chain/generated-command.js +0 -775
  693. package/src/supply-chain/generated-container-release-command.d.ts +0 -16
  694. package/src/supply-chain/generated-container-release-command.js +0 -3248
  695. package/src/supply-chain/generated-ecr-collector-command.d.ts +0 -20
  696. package/src/supply-chain/generated-ecr-collector-command.js +0 -1445
  697. package/src/supply-chain/generated-files.d.ts +0 -13
  698. package/src/supply-chain/generated-files.js +0 -421
  699. package/src/supply-chain/generated-scanner-command.d.ts +0 -1
  700. package/src/supply-chain/generated-scanner-command.js +0 -778
  701. package/src/supply-chain/index.d.ts +0 -28
  702. package/src/supply-chain/index.js +0 -36
  703. package/src/supply-chain/inventory.d.ts +0 -96
  704. package/src/supply-chain/inventory.js +0 -828
  705. package/src/supply-chain/license-expression.d.ts +0 -7
  706. package/src/supply-chain/license-expression.js +0 -128
  707. package/src/supply-chain/policy.d.ts +0 -105
  708. package/src/supply-chain/policy.js +0 -304
  709. package/src/supply-chain/publication.d.ts +0 -48
  710. package/src/supply-chain/publication.js +0 -85
  711. package/src/supply-chain/sbom.d.ts +0 -228
  712. package/src/supply-chain/sbom.js +0 -913
  713. package/src/supply-chain/scanner.d.ts +0 -77
  714. package/src/supply-chain/scanner.js +0 -514
  715. package/src/supply-chain/vendored-source.d.ts +0 -95
  716. package/src/supply-chain/vendored-source.js +0 -315
  717. package/src/testing-evidence/fixture-scope.d.ts +0 -53
  718. package/src/testing-evidence/fixture-scope.js +0 -142
  719. package/src/testing-evidence/index.d.ts +0 -5
  720. package/src/testing-evidence/index.js +0 -9
  721. package/src/testing-evidence/quarantine.d.ts +0 -48
  722. package/src/testing-evidence/quarantine.js +0 -253
  723. package/src/testing-evidence/result.d.ts +0 -109
  724. package/src/testing-evidence/result.js +0 -585
  725. package/src/testing-evidence/runner-adapter.d.ts +0 -51
  726. package/src/testing-evidence/runner-adapter.js +0 -288
  727. package/src/testing-evidence/sensitive-artifacts.d.ts +0 -13
  728. package/src/testing-evidence/sensitive-artifacts.js +0 -93
  729. package/src/work-markers/index.d.ts +0 -1
  730. package/src/work-markers/index.js +0 -5
  731. package/src/work-markers/work-markers.d.ts +0 -39
  732. package/src/work-markers/work-markers.js +0 -363
  733. package/src/workload-roles/account-baseline.d.ts +0 -143
  734. package/src/workload-roles/account-baseline.js +0 -980
  735. package/src/workload-roles/authority.d.ts +0 -40
  736. package/src/workload-roles/authority.js +0 -202
  737. package/src/workload-roles/aws-adapter.d.ts +0 -99
  738. package/src/workload-roles/aws-adapter.js +0 -416
  739. package/src/workload-roles/aws-internal-handler.d.ts +0 -27
  740. package/src/workload-roles/aws-internal-handler.js +0 -58
  741. package/src/workload-roles/aws-s3-state.d.ts +0 -52
  742. package/src/workload-roles/aws-s3-state.js +0 -191
  743. package/src/workload-roles/aws-sdk-control-plane.d.ts +0 -12
  744. package/src/workload-roles/aws-sdk-control-plane.js +0 -291
  745. package/src/workload-roles/boundary.d.ts +0 -34
  746. package/src/workload-roles/boundary.js +0 -137
  747. package/src/workload-roles/convergence.d.ts +0 -66
  748. package/src/workload-roles/convergence.js +0 -186
  749. package/src/workload-roles/handler.d.ts +0 -43
  750. package/src/workload-roles/handler.js +0 -158
  751. package/src/workload-roles/history.d.ts +0 -47
  752. package/src/workload-roles/history.js +0 -324
  753. package/src/workload-roles/injection.d.ts +0 -119
  754. package/src/workload-roles/injection.js +0 -495
  755. package/src/workload-roles/manifest.d.ts +0 -54
  756. package/src/workload-roles/manifest.js +0 -343
  757. package/src/workload-roles/provisioner.d.ts +0 -70
  758. package/src/workload-roles/provisioner.js +0 -239
  759. package/src/workload-roles/registration.d.ts +0 -102
  760. package/src/workload-roles/registration.js +0 -462
  761. package/src/workload-roles/stage-boundary.d.ts +0 -31
  762. package/src/workload-roles/stage-boundary.js +0 -208
  763. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.d.ts +0 -0
  764. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.js +0 -0
@@ -1,2729 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeveloperAgentContractValidationError = void 0;
4
- exports.validateDeveloperAgentContext = validateDeveloperAgentContext;
5
- exports.validateDeveloperAgentGeneratorPreview = validateDeveloperAgentGeneratorPreview;
6
- exports.validateDeveloperAgentGeneratorPreviewReceipt = validateDeveloperAgentGeneratorPreviewReceipt;
7
- exports.validateDeveloperAgentPlan = validateDeveloperAgentPlan;
8
- exports.validateDeveloperAgentResult = validateDeveloperAgentResult;
9
- exports.validateDeveloperAgentHandoff = validateDeveloperAgentHandoff;
10
- exports.serializeDeveloperAgentContext = serializeDeveloperAgentContext;
11
- exports.assertDeveloperAgentContextStructure = assertDeveloperAgentContextStructure;
12
- exports.serializeDeveloperAgentGeneratorPreview = serializeDeveloperAgentGeneratorPreview;
13
- exports.serializeDeveloperAgentGeneratorPreviewReceipt = serializeDeveloperAgentGeneratorPreviewReceipt;
14
- exports.serializeDeveloperAgentPlan = serializeDeveloperAgentPlan;
15
- exports.serializeDeveloperAgentResult = serializeDeveloperAgentResult;
16
- exports.serializeDeveloperAgentHandoff = serializeDeveloperAgentHandoff;
17
- const node_crypto_1 = require("node:crypto");
18
- const node_util_1 = require("node:util");
19
- const canonical_json_1 = require("@empire-builder-kit/runtime/canonical-json");
20
- const safe_reference_1 = require("@empire-builder-kit/runtime/safe-reference");
21
- const index_js_1 = require("../testing-evidence/index.js");
22
- const validation_js_1 = require("../validation.js");
23
- const model_js_1 = require("./model.js");
24
- const ordering_js_1 = require("./ordering.js");
25
- const workspace_path_js_1 = require("./workspace-path.js");
26
- const MAX_COLLECTION_ITEMS = 256;
27
- const MAX_AFFECTED_FILE_REFERENCES = 128;
28
- const MAX_CONCURRENT_PATHS = 2_048;
29
- const MAX_GENERATED_SURFACES = 512;
30
- const MAX_RESULTS = 16;
31
- const MAX_COMMAND_ARGUMENTS = 64;
32
- const MAX_IDENTIFIER_LENGTH = (0, safe_reference_1.safeReferenceMaximumLength)('supply-chain');
33
- const MAX_PATH_LENGTH = 1024;
34
- const MAX_SUMMARY_LENGTH = 1024;
35
- const MAX_INPUT_VALUE_LENGTH = 512;
36
- const COMMIT_PATTERN = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
37
- const SHA256_DIGEST_PATTERN = /^sha256:[a-f0-9]{64}$/;
38
- const GENERATOR_PREVIEW_CHANGE_SET = new Set(['create', 'delete', 'update']);
39
- const IDENTIFIER_PATTERN = new RegExp((0, safe_reference_1.safeReferencePatternSource)('supply-chain'));
40
- const FIELD_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9._-]*$/;
41
- const WORKSPACE_RELATIVE_PATH_PATTERN = /^(?![\\/])(?![A-Za-z]:[\\/])(?!.*(?:^|[\\/])\.\.(?:[\\/]|$)).+$/;
42
- const GENERATOR_PREVIEW_REFERENCE_PATTERN = /^\.ebk\/agent\/previews\/[a-z][a-z0-9-]{0,62}\.json$/;
43
- const GENERATOR_SLUG_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
44
- const AUTHORITY_SET = new Set(model_js_1.DEVELOPER_AGENT_AUTHORITY_CLASSES);
45
- const CANONICAL_STAGE_SET = new Set(model_js_1.DEVELOPER_AGENT_CANONICAL_STAGES);
46
- const FAILURE_SET = new Set(model_js_1.DEVELOPER_AGENT_FAILURE_CLASSIFICATIONS);
47
- const RESULT_OUTCOME_SET = new Set(model_js_1.DEVELOPER_AGENT_RESULT_OUTCOMES);
48
- const HANDOFF_STATE_SET = new Set(model_js_1.DEVELOPER_AGENT_HANDOFF_STATES);
49
- const PRIVACY_CLASS_SET = new Set(model_js_1.DEVELOPER_AGENT_ARTIFACT_PRIVACY_CLASSES);
50
- const CLEANUP_RECOVERY_SET = new Set(model_js_1.DEVELOPER_AGENT_CLEANUP_RECOVERY_OUTCOMES);
51
- const OWNERSHIP_MODE_SET = new Set(model_js_1.DEVELOPER_AGENT_OWNERSHIP_MODES);
52
- const CONTRACT_CLASS_SET = new Set(model_js_1.DEVELOPER_AGENT_CONTRACT_CLASSES);
53
- const RISK_CLASS_SET = new Set(model_js_1.DEVELOPER_AGENT_RISK_CLASSES);
54
- const OPERATION_OWNER_SET = new Set(model_js_1.DEVELOPER_AGENT_OPERATION_OWNERS);
55
- const POLICY_LIFECYCLE_ACTION_SET = new Set(model_js_1.DEVELOPER_AGENT_POLICY_LIFECYCLE_ACTIONS);
56
- const STABLE_GENERATOR_SET = new Set(model_js_1.DEVELOPER_AGENT_STABLE_GENERATORS);
57
- const GENERATOR_MODE_SET = new Set(model_js_1.DEVELOPER_AGENT_GENERATOR_MODES);
58
- const PRODUCTION_PROFILE_SET = new Set([
59
- 'cost-optimized',
60
- 'balanced',
61
- 'standard',
62
- ]);
63
- const BLOCKING_FAILURES = new Set([
64
- 'unsupported-operation',
65
- 'invalid-input',
66
- 'dirty-worktree',
67
- 'stale-base',
68
- 'ownership-conflict',
69
- 'generated-drift',
70
- 'policy-conflict',
71
- 'marker-blocked',
72
- 'authority-required',
73
- 'prerequisite-missing',
74
- ]);
75
- const FAILED_FAILURES = new Set([
76
- 'verification-failed',
77
- 'cleanup-incomplete',
78
- 'tool-internal-error',
79
- ]);
80
- class DeveloperAgentContractValidationError extends Error {
81
- issues;
82
- constructor(label, issues) {
83
- super(`${label} is invalid: ${issues
84
- .slice(0, 3)
85
- .map(({ message, path }) => `${path} ${message}`)
86
- .join('; ')}`);
87
- this.name = 'DeveloperAgentContractValidationError';
88
- this.issues = issues;
89
- }
90
- }
91
- exports.DeveloperAgentContractValidationError = DeveloperAgentContractValidationError;
92
- function addIssue(issues, path, message) {
93
- issues.push({ message, path });
94
- }
95
- function has(value, property) {
96
- return Object.prototype.hasOwnProperty.call(value, property);
97
- }
98
- function requireRecord(value, path, required, optional, issues) {
99
- if (!(0, validation_js_1.isRecord)(value)) {
100
- addIssue(issues, path, 'must be an object');
101
- return undefined;
102
- }
103
- const allowed = new Set([...required, ...optional]);
104
- for (const property of Object.keys(value)) {
105
- if (!allowed.has(property)) {
106
- addIssue(issues, `${path}.*`, 'is not an allowlisted property');
107
- }
108
- }
109
- for (const property of required) {
110
- if (!has(value, property)) {
111
- addIssue(issues, `${path}.${property}`, 'is required');
112
- }
113
- }
114
- return value;
115
- }
116
- function requireSafeString(value, path, issues, options = {}) {
117
- if (typeof value !== 'string' ||
118
- value.length === 0 ||
119
- value !== value.trim()) {
120
- addIssue(issues, path, 'must be a non-empty trimmed string');
121
- return false;
122
- }
123
- if (value.length > (options.maximumLength ?? MAX_IDENTIFIER_LENGTH)) {
124
- addIssue(issues, path, `must contain at most ${options.maximumLength ?? MAX_IDENTIFIER_LENGTH} characters`);
125
- return false;
126
- }
127
- for (const character of value) {
128
- const codePoint = character.codePointAt(0) ?? 0;
129
- if (codePoint <= 31 ||
130
- (codePoint >= 127 && codePoint <= 159) ||
131
- codePoint === 0x2028 ||
132
- codePoint === 0x2029) {
133
- addIssue(issues, path, 'must not contain unsafe control characters');
134
- return false;
135
- }
136
- }
137
- if (options.pattern && !options.pattern.test(value)) {
138
- addIssue(issues, path, 'has an unsupported format');
139
- return false;
140
- }
141
- const inspection = (0, index_js_1.inspectTestingEvidenceText)(value);
142
- if (!inspection.safe) {
143
- addIssue(issues, path, 'must not contain protected data');
144
- return false;
145
- }
146
- return true;
147
- }
148
- function requireBoolean(value, path, issues) {
149
- if (typeof value !== 'boolean') {
150
- addIssue(issues, path, 'must be a boolean');
151
- return false;
152
- }
153
- return true;
154
- }
155
- function requireInteger(value, path, issues, minimum = 0, maximum = Number.MAX_SAFE_INTEGER) {
156
- if (typeof value !== 'number' ||
157
- !Number.isSafeInteger(value) ||
158
- value < minimum ||
159
- value > maximum) {
160
- addIssue(issues, path, `must be an integer from ${minimum} through ${maximum}`);
161
- return false;
162
- }
163
- return true;
164
- }
165
- function requireEnum(value, path, allowed, issues) {
166
- if (typeof value !== 'string' || !allowed.has(value)) {
167
- addIssue(issues, path, `must equal one of ${[...allowed].join(', ')}`);
168
- return false;
169
- }
170
- return true;
171
- }
172
- function requireArray(value, path, issues, maximumItems = MAX_COLLECTION_ITEMS) {
173
- if (!Array.isArray(value)) {
174
- addIssue(issues, path, 'must be an array');
175
- return undefined;
176
- }
177
- if (value.length > maximumItems) {
178
- addIssue(issues, path, `must contain at most ${maximumItems} items`);
179
- }
180
- return value;
181
- }
182
- function validateStringArray(value, path, issues, options = {}) {
183
- const entries = requireArray(value, path, issues, options.maximumItems ?? MAX_COLLECTION_ITEMS);
184
- if (!entries)
185
- return false;
186
- const seen = new Set();
187
- entries.forEach((entry, index) => {
188
- if (requireSafeString(entry, `${path}[${index}]`, issues, {
189
- maximumLength: options.maximumLength,
190
- pattern: options.pattern,
191
- }) &&
192
- options.unique !== false) {
193
- if (seen.has(entry)) {
194
- addIssue(issues, `${path}[${index}]`, 'must not duplicate another item');
195
- }
196
- seen.add(entry);
197
- }
198
- });
199
- return entries.every((entry) => typeof entry === 'string');
200
- }
201
- function validateVersionRecord(value, path, issues) {
202
- const record = requireRecord(value, path, ['name', 'version'], [], issues);
203
- if (!record)
204
- return false;
205
- requireSafeString(record.name, `${path}.name`, issues, {
206
- pattern: IDENTIFIER_PATTERN,
207
- });
208
- requireSafeString(record.version, `${path}.version`, issues);
209
- return true;
210
- }
211
- function validateVersionRecords(value, path, issues) {
212
- const entries = requireArray(value, path, issues);
213
- if (!entries)
214
- return false;
215
- const names = new Set();
216
- entries.forEach((entry, index) => {
217
- if (validateVersionRecord(entry, `${path}[${index}]`, issues)) {
218
- const name = entry.name;
219
- if (names.has(name)) {
220
- addIssue(issues, `${path}[${index}].name`, 'must be unique');
221
- }
222
- names.add(name);
223
- }
224
- });
225
- return true;
226
- }
227
- function validateCandidateProvenance(value, path, issues) {
228
- const record = requireRecord(value, path, ['reference'], ['digest'], issues);
229
- if (!record)
230
- return false;
231
- requireSafeString(record.reference, `${path}.reference`, issues, {
232
- maximumLength: MAX_PATH_LENGTH,
233
- });
234
- if (has(record, 'digest')) {
235
- requireSafeString(record.digest, `${path}.digest`, issues, {
236
- maximumLength: 71,
237
- pattern: SHA256_DIGEST_PATTERN,
238
- });
239
- }
240
- return true;
241
- }
242
- function validateCommand(value, path, issues) {
243
- const record = requireRecord(value, path, ['args', 'executable'], ['cwd'], issues);
244
- if (!record)
245
- return false;
246
- requireSafeString(record.executable, `${path}.executable`, issues, {
247
- maximumLength: MAX_PATH_LENGTH,
248
- });
249
- validateStringArray(record.args, `${path}.args`, issues, {
250
- maximumItems: MAX_COMMAND_ARGUMENTS,
251
- maximumLength: MAX_INPUT_VALUE_LENGTH,
252
- unique: false,
253
- });
254
- if (has(record, 'cwd')) {
255
- requireSafeString(record.cwd, `${path}.cwd`, issues, {
256
- maximumLength: MAX_PATH_LENGTH,
257
- });
258
- }
259
- return true;
260
- }
261
- function validateNextSafeAction(value, path, issues) {
262
- const record = requireRecord(value, path, ['approvalRequired', 'authority', 'description'], ['command', 'operationId', 'owner'], issues);
263
- if (!record)
264
- return false;
265
- requireBoolean(record.approvalRequired, `${path}.approvalRequired`, issues);
266
- requireEnum(record.authority, `${path}.authority`, AUTHORITY_SET, issues);
267
- requireSafeString(record.description, `${path}.description`, issues, {
268
- maximumLength: MAX_SUMMARY_LENGTH,
269
- });
270
- if (has(record, 'command')) {
271
- validateCommand(record.command, `${path}.command`, issues);
272
- }
273
- if (has(record, 'operationId')) {
274
- requireSafeString(record.operationId, `${path}.operationId`, issues, {
275
- maximumLength: MAX_IDENTIFIER_LENGTH,
276
- pattern: IDENTIFIER_PATTERN,
277
- });
278
- }
279
- if (has(record, 'owner')) {
280
- requireEnum(record.owner, `${path}.owner`, OPERATION_OWNER_SET, issues);
281
- }
282
- if (has(record, 'operationId') !== has(record, 'owner')) {
283
- addIssue(issues, path, 'operationId and owner must be retained together');
284
- }
285
- if ((record.authority === 'protected-mutate' ||
286
- record.authority === 'destructive') &&
287
- record.approvalRequired !== true) {
288
- addIssue(issues, `${path}.approvalRequired`, 'must be true for protected or destructive action');
289
- }
290
- return true;
291
- }
292
- function validateCleanupRecovery(value, path, issues) {
293
- const record = requireRecord(value, path, ['outcome'], ['owner', 'sanitizedSummary'], issues);
294
- if (!record)
295
- return false;
296
- requireEnum(record.outcome, `${path}.outcome`, CLEANUP_RECOVERY_SET, issues);
297
- if (has(record, 'owner')) {
298
- requireSafeString(record.owner, `${path}.owner`, issues);
299
- }
300
- if (has(record, 'sanitizedSummary')) {
301
- requireSafeString(record.sanitizedSummary, `${path}.sanitizedSummary`, issues, { maximumLength: MAX_SUMMARY_LENGTH });
302
- }
303
- if (record.outcome === 'incomplete' && !has(record, 'sanitizedSummary')) {
304
- addIssue(issues, path, 'must include a sanitized summary when incomplete');
305
- }
306
- return true;
307
- }
308
- function validateArtifact(value, path, issues) {
309
- const record = requireRecord(value, path, ['digest', 'evidenceClass', 'name', 'privacyClass', 'reference'], [], issues);
310
- if (!record)
311
- return false;
312
- requireSafeString(record.digest, `${path}.digest`, issues, {
313
- maximumLength: 71,
314
- pattern: SHA256_DIGEST_PATTERN,
315
- });
316
- requireSafeString(record.evidenceClass, `${path}.evidenceClass`, issues, {
317
- maximumLength: MAX_IDENTIFIER_LENGTH,
318
- pattern: IDENTIFIER_PATTERN,
319
- });
320
- requireSafeString(record.name, `${path}.name`, issues, {
321
- maximumLength: MAX_PATH_LENGTH,
322
- });
323
- validateCanonicalWorkspacePath(record.reference, `${path}.reference`, issues);
324
- requireEnum(record.privacyClass, `${path}.privacyClass`, PRIVACY_CLASS_SET, issues);
325
- return true;
326
- }
327
- function validateArtifacts(value, path, issues) {
328
- const entries = requireArray(value, path, issues);
329
- if (!entries)
330
- return false;
331
- const names = new Set();
332
- entries.forEach((entry, index) => {
333
- if (validateArtifact(entry, `${path}[${index}]`, issues)) {
334
- const name = entry.name;
335
- if (names.has(name)) {
336
- addIssue(issues, `${path}[${index}].name`, 'must be unique');
337
- }
338
- names.add(name);
339
- }
340
- });
341
- return true;
342
- }
343
- function validateContractReference(value, path, issues) {
344
- const record = requireRecord(value, path, ['class', 'reference'], [], issues);
345
- if (!record)
346
- return false;
347
- requireEnum(record.class, `${path}.class`, CONTRACT_CLASS_SET, issues);
348
- requireSafeString(record.reference, `${path}.reference`, issues, {
349
- maximumLength: MAX_PATH_LENGTH,
350
- });
351
- return true;
352
- }
353
- function validateContractReferences(value, path, issues) {
354
- const entries = requireArray(value, path, issues);
355
- if (!entries)
356
- return false;
357
- const identities = new Set();
358
- entries.forEach((entry, index) => {
359
- if (validateContractReference(entry, `${path}[${index}]`, issues)) {
360
- const contract = entry;
361
- const identity = `${contract.class}:${contract.reference}`;
362
- if (identities.has(identity)) {
363
- addIssue(issues, `${path}[${index}]`, 'must be unique');
364
- }
365
- identities.add(identity);
366
- }
367
- });
368
- return true;
369
- }
370
- function validateWorkspaceContext(value, path, issues) {
371
- const record = requireRecord(value, path, [
372
- 'blueprintVersions',
373
- 'frameworkVersion',
374
- 'identity',
375
- 'ownershipVersions',
376
- 'ownershipAgreement',
377
- 'repositoryRoot',
378
- ], ['candidateProvenance'], issues);
379
- if (!record)
380
- return false;
381
- validateVersionRecords(record.blueprintVersions, `${path}.blueprintVersions`, issues);
382
- requireSafeString(record.frameworkVersion, `${path}.frameworkVersion`, issues);
383
- requireSafeString(record.identity, `${path}.identity`, issues, {
384
- pattern: IDENTIFIER_PATTERN,
385
- });
386
- validateOwnershipVersionStates(record.ownershipVersions, `${path}.ownershipVersions`, issues);
387
- requireEnum(record.ownershipAgreement, `${path}.ownershipAgreement`, new Set(['agrees', 'conflict', 'unavailable']), issues);
388
- requireSafeString(record.repositoryRoot, `${path}.repositoryRoot`, issues, {
389
- maximumLength: MAX_PATH_LENGTH,
390
- });
391
- if (has(record, 'candidateProvenance')) {
392
- validateCandidateProvenance(record.candidateProvenance, `${path}.candidateProvenance`, issues);
393
- }
394
- return true;
395
- }
396
- function validateOwnershipVersionState(value, path, issues) {
397
- const record = requireRecord(value, path, ['kind', 'target'], [
398
- 'blueprintName',
399
- 'installedBlueprintVersion',
400
- 'installedFrameworkVersion',
401
- 'recordedBlueprintVersion',
402
- 'recordedFrameworkVersion',
403
- ], issues);
404
- if (!record)
405
- return false;
406
- requireEnum(record.kind, `${path}.kind`, new Set(['foundation', 'site', 'slice', 'workspace']), issues);
407
- requireSafeString(record.target, `${path}.target`, issues, {
408
- pattern: IDENTIFIER_PATTERN,
409
- });
410
- for (const field of [
411
- 'blueprintName',
412
- 'installedBlueprintVersion',
413
- 'installedFrameworkVersion',
414
- 'recordedBlueprintVersion',
415
- 'recordedFrameworkVersion',
416
- ]) {
417
- if (has(record, field)) {
418
- requireSafeString(record[field], `${path}.${field}`, issues);
419
- }
420
- }
421
- const kind = record.kind;
422
- if ((kind === 'workspace' || kind === 'foundation' || kind === 'site') &&
423
- record.target !== kind) {
424
- addIssue(issues, `${path}.target`, `must equal ${kind}`);
425
- }
426
- if (kind === 'slice') {
427
- for (const field of ['blueprintName', 'recordedBlueprintVersion']) {
428
- if (!has(record, field)) {
429
- addIssue(issues, `${path}.${field}`, 'is required for a Slice');
430
- }
431
- }
432
- }
433
- else {
434
- if (!has(record, 'recordedFrameworkVersion')) {
435
- addIssue(issues, `${path}.recordedFrameworkVersion`, `is required for ${String(kind)} ownership`);
436
- }
437
- for (const field of [
438
- 'blueprintName',
439
- 'installedBlueprintVersion',
440
- 'recordedBlueprintVersion',
441
- ]) {
442
- if (has(record, field)) {
443
- addIssue(issues, `${path}.${field}`, 'is accepted only for Slice ownership');
444
- }
445
- }
446
- }
447
- return true;
448
- }
449
- function validateOwnershipVersionStates(value, path, issues) {
450
- const entries = requireArray(value, path, issues, MAX_COLLECTION_ITEMS);
451
- if (!entries)
452
- return false;
453
- const targets = new Set();
454
- let previousTarget;
455
- entries.forEach((entry, index) => {
456
- if (validateOwnershipVersionState(entry, `${path}[${index}]`, issues)) {
457
- if (targets.has(entry.target)) {
458
- addIssue(issues, `${path}[${index}].target`, 'must be unique');
459
- }
460
- if (previousTarget !== undefined &&
461
- (0, ordering_js_1.compareDeveloperAgentStrings)(previousTarget, entry.target) >= 0) {
462
- addIssue(issues, `${path}[${index}].target`, 'must be in ascending canonical order');
463
- }
464
- targets.add(entry.target);
465
- previousTarget = entry.target;
466
- }
467
- });
468
- return true;
469
- }
470
- const CONCURRENT_CHANGE_SUMMARY_KEYS = [
471
- 'concurrentChangeCount',
472
- 'concurrentChangesDigest',
473
- 'concurrentChangesTruncated',
474
- ];
475
- /**
476
- * The complete concurrent-change list is summarized by an exact count, a
477
- * digest and a truncation flag. The three fields appear together or not at
478
- * all, and an emitted subset must state honestly that it is a subset.
479
- */
480
- function validateConcurrentChangeSummary(record, concurrentChanges, path, issues) {
481
- const present = CONCURRENT_CHANGE_SUMMARY_KEYS.filter((key) => has(record, key));
482
- if (present.length === 0)
483
- return;
484
- if (present.length !== CONCURRENT_CHANGE_SUMMARY_KEYS.length) {
485
- addIssue(issues, path, 'must carry concurrentChangeCount, concurrentChangesDigest and concurrentChangesTruncated together');
486
- return;
487
- }
488
- const countValid = requireInteger(record.concurrentChangeCount, `${path}.concurrentChangeCount`, issues, 0, MAX_CONCURRENT_PATHS);
489
- requireSafeString(record.concurrentChangesDigest, `${path}.concurrentChangesDigest`, issues, { maximumLength: 71, pattern: SHA256_DIGEST_PATTERN });
490
- const truncatedValid = requireBoolean(record.concurrentChangesTruncated, `${path}.concurrentChangesTruncated`, issues);
491
- if (!countValid || !truncatedValid || !concurrentChanges)
492
- return;
493
- const count = record.concurrentChangeCount;
494
- if ((record.concurrentChangesTruncated === false &&
495
- count !== concurrentChanges.length) ||
496
- (record.concurrentChangesTruncated === true &&
497
- count <= concurrentChanges.length)) {
498
- addIssue(issues, path, 'must retain an exact concurrent-change count and an honest truncation state');
499
- }
500
- }
501
- function validateGitContext(value, path, issues) {
502
- const record = requireRecord(value, path, [
503
- 'ahead',
504
- 'behind',
505
- 'commit',
506
- 'concurrentChangeInspectionComplete',
507
- 'concurrentChanges',
508
- 'defaultBaseCommit',
509
- 'defaultBaseRef',
510
- 'dirty',
511
- 'worktreeRoot',
512
- ], [
513
- 'baseCommit',
514
- 'branch',
515
- 'concurrentChangeCount',
516
- 'concurrentChangesDigest',
517
- 'concurrentChangesTruncated',
518
- 'headCommit',
519
- 'upstream',
520
- ], issues);
521
- if (!record)
522
- return false;
523
- requireInteger(record.ahead, `${path}.ahead`, issues, 0, 1_000_000);
524
- requireInteger(record.behind, `${path}.behind`, issues, 0, 1_000_000);
525
- if (record.commit !== null) {
526
- requireSafeString(record.commit, `${path}.commit`, issues, {
527
- maximumLength: 64,
528
- pattern: COMMIT_PATTERN,
529
- });
530
- }
531
- else if (typeof record.branch !== 'string' ||
532
- record.ahead !== 0 ||
533
- record.behind !== 0 ||
534
- has(record, 'upstream') ||
535
- has(record, 'baseCommit') ||
536
- has(record, 'headCommit')) {
537
- addIssue(issues, `${path}.commit`, 'uncommitted state requires a symbolic branch without upstream or comparison authority');
538
- }
539
- requireBoolean(record.concurrentChangeInspectionComplete, `${path}.concurrentChangeInspectionComplete`, issues);
540
- const concurrentChanges = requireArray(record.concurrentChanges, `${path}.concurrentChanges`, issues, MAX_CONCURRENT_PATHS);
541
- const concurrentPaths = new Set();
542
- let previousConcurrentPath;
543
- concurrentChanges?.forEach((entry, index) => {
544
- const entryPath = `${path}.concurrentChanges[${index}]`;
545
- const concurrent = requireRecord(entry, entryPath, ['committed', 'dirty', 'path', 'worktreeCount'], [], issues);
546
- if (!concurrent)
547
- return;
548
- const committedValid = requireBoolean(concurrent.committed, `${entryPath}.committed`, issues);
549
- const dirtyValid = requireBoolean(concurrent.dirty, `${entryPath}.dirty`, issues);
550
- if (committedValid &&
551
- dirtyValid &&
552
- concurrent.committed === false &&
553
- concurrent.dirty === false) {
554
- addIssue(issues, entryPath, 'must identify a dirty or committed concurrent change');
555
- }
556
- if (validateCanonicalWorkspacePath(concurrent.path, `${entryPath}.path`, issues)) {
557
- const change = concurrent;
558
- const collisionKey = change.path
559
- .normalize('NFC')
560
- .toLocaleLowerCase('en-US');
561
- if (concurrentPaths.has(collisionKey)) {
562
- addIssue(issues, `${entryPath}.path`, 'must not duplicate or case-alias another concurrent path');
563
- }
564
- if (previousConcurrentPath !== undefined &&
565
- previousConcurrentPath >= collisionKey) {
566
- addIssue(issues, `${entryPath}.path`, 'must be in ascending canonical order');
567
- }
568
- concurrentPaths.add(collisionKey);
569
- previousConcurrentPath = collisionKey;
570
- }
571
- requireInteger(concurrent.worktreeCount, `${entryPath}.worktreeCount`, issues, 1, 64);
572
- });
573
- validateConcurrentChangeSummary(record, concurrentChanges, path, issues);
574
- if (record.defaultBaseCommit !== null) {
575
- requireSafeString(record.defaultBaseCommit, `${path}.defaultBaseCommit`, issues, {
576
- maximumLength: 64,
577
- pattern: COMMIT_PATTERN,
578
- });
579
- }
580
- requireSafeString(record.defaultBaseRef, `${path}.defaultBaseRef`, issues, {
581
- maximumLength: MAX_PATH_LENGTH,
582
- });
583
- requireBoolean(record.dirty, `${path}.dirty`, issues);
584
- requireSafeString(record.worktreeRoot, `${path}.worktreeRoot`, issues, {
585
- maximumLength: MAX_PATH_LENGTH,
586
- });
587
- for (const property of ['baseCommit', 'headCommit']) {
588
- if (has(record, property)) {
589
- requireSafeString(record[property], `${path}.${property}`, issues, {
590
- maximumLength: 64,
591
- pattern: COMMIT_PATTERN,
592
- });
593
- }
594
- }
595
- for (const property of ['branch', 'upstream']) {
596
- if (has(record, property)) {
597
- requireSafeString(record[property], `${path}.${property}`, issues, {
598
- maximumLength: MAX_PATH_LENGTH,
599
- });
600
- }
601
- }
602
- return true;
603
- }
604
- function validatePolicyField(value, path, issues) {
605
- const record = requireRecord(value, path, ['name', 'value'], [], issues);
606
- if (!record)
607
- return false;
608
- requireSafeString(record.name, `${path}.name`, issues, {
609
- pattern: FIELD_NAME_PATTERN,
610
- });
611
- requireSafeString(record.value, `${path}.value`, issues, {
612
- maximumLength: MAX_INPUT_VALUE_LENGTH,
613
- });
614
- return true;
615
- }
616
- function validateEffectivePolicyDecision(value, path, issues) {
617
- const record = requireRecord(value, path, ['action', 'allowed', 'projects', 'reasons', 'stage'], ['effectiveProductionProfile'], issues);
618
- if (!record)
619
- return false;
620
- requireEnum(record.action, `${path}.action`, POLICY_LIFECYCLE_ACTION_SET, issues);
621
- requireBoolean(record.allowed, `${path}.allowed`, issues);
622
- validateStringArray(record.projects, `${path}.projects`, issues, {
623
- pattern: IDENTIFIER_PATTERN,
624
- });
625
- validateStringArray(record.reasons, `${path}.reasons`, issues, {
626
- maximumLength: MAX_SUMMARY_LENGTH,
627
- });
628
- requireEnum(record.stage, `${path}.stage`, CANONICAL_STAGE_SET, issues);
629
- if (has(record, 'effectiveProductionProfile')) {
630
- requireEnum(record.effectiveProductionProfile, `${path}.effectiveProductionProfile`, PRODUCTION_PROFILE_SET, issues);
631
- }
632
- if (record.allowed === true &&
633
- Array.isArray(record.reasons) &&
634
- record.reasons.length > 0) {
635
- addIssue(issues, `${path}.reasons`, 'must be empty when allowed is true');
636
- }
637
- if (record.allowed === false &&
638
- Array.isArray(record.reasons) &&
639
- record.reasons.length === 0) {
640
- addIssue(issues, `${path}.reasons`, 'must explain a denied decision');
641
- }
642
- return true;
643
- }
644
- function validatePolicyContext(value, path, issues) {
645
- const record = requireRecord(value, path, [
646
- 'canonicalStage',
647
- 'effectiveDecisions',
648
- 'effectivePolicyDigest',
649
- 'effectivePolicyReferences',
650
- 'repositoryPolicyFields',
651
- ], [], issues);
652
- if (!record)
653
- return false;
654
- requireEnum(record.canonicalStage, `${path}.canonicalStage`, CANONICAL_STAGE_SET, issues);
655
- const decisions = requireArray(record.effectiveDecisions, `${path}.effectiveDecisions`, issues);
656
- const decisionKeys = new Set();
657
- decisions?.forEach((entry, index) => {
658
- if (validateEffectivePolicyDecision(entry, `${path}.effectiveDecisions[${index}]`, issues)) {
659
- const decision = entry;
660
- const key = `${decision.stage}:${decision.action}:${decision.projects.join(',')}`;
661
- if (decisionKeys.has(key)) {
662
- addIssue(issues, `${path}.effectiveDecisions[${index}]`, 'must not duplicate another stage/action decision');
663
- }
664
- decisionKeys.add(key);
665
- if (decision.stage !== record.canonicalStage) {
666
- addIssue(issues, `${path}.effectiveDecisions[${index}].stage`, 'must equal the canonical stage');
667
- }
668
- }
669
- });
670
- requireSafeString(record.effectivePolicyDigest, `${path}.effectivePolicyDigest`, issues, {
671
- maximumLength: 71,
672
- pattern: SHA256_DIGEST_PATTERN,
673
- });
674
- validateStringArray(record.effectivePolicyReferences, `${path}.effectivePolicyReferences`, issues, { maximumLength: MAX_PATH_LENGTH });
675
- const fields = requireArray(record.repositoryPolicyFields, `${path}.repositoryPolicyFields`, issues);
676
- if (fields) {
677
- const names = new Set();
678
- fields.forEach((entry, index) => {
679
- if (validatePolicyField(entry, `${path}.repositoryPolicyFields[${index}]`, issues)) {
680
- const name = entry.name;
681
- if (names.has(name)) {
682
- addIssue(issues, `${path}.repositoryPolicyFields[${index}].name`, 'must be unique');
683
- }
684
- names.add(name);
685
- }
686
- });
687
- }
688
- return true;
689
- }
690
- function validateProjectContext(value, path, issues) {
691
- const record = requireRecord(value, path, ['dependencies', 'name', 'root', 'tags', 'targets'], [], issues);
692
- if (!record)
693
- return false;
694
- validateStringArray(record.dependencies, `${path}.dependencies`, issues, {
695
- pattern: IDENTIFIER_PATTERN,
696
- });
697
- requireSafeString(record.name, `${path}.name`, issues, {
698
- pattern: IDENTIFIER_PATTERN,
699
- });
700
- requireSafeString(record.root, `${path}.root`, issues, {
701
- maximumLength: MAX_PATH_LENGTH,
702
- });
703
- validateStringArray(record.tags, `${path}.tags`, issues, {
704
- pattern: IDENTIFIER_PATTERN,
705
- });
706
- validateStringArray(record.targets, `${path}.targets`, issues, {
707
- pattern: IDENTIFIER_PATTERN,
708
- });
709
- return true;
710
- }
711
- function validateProjectContexts(value, path, issues) {
712
- const entries = requireArray(value, path, issues);
713
- if (!entries)
714
- return false;
715
- const names = new Set();
716
- entries.forEach((entry, index) => {
717
- if (validateProjectContext(entry, `${path}[${index}]`, issues)) {
718
- const name = entry.name;
719
- if (names.has(name)) {
720
- addIssue(issues, `${path}[${index}].name`, 'must be unique');
721
- }
722
- names.add(name);
723
- }
724
- });
725
- return true;
726
- }
727
- function validateSelectionContext(value, path, issues) {
728
- const record = requireRecord(value, path, ['contracts', 'foundationCapabilities', 'projectInventory'], ['feature', 'files', 'slice'], issues);
729
- if (!record)
730
- return false;
731
- validateContractReferences(record.contracts, `${path}.contracts`, issues);
732
- validateStringArray(record.foundationCapabilities, `${path}.foundationCapabilities`, issues, { pattern: IDENTIFIER_PATTERN });
733
- requireEnum(record.projectInventory, `${path}.projectInventory`, new Set(['bounded', 'full']), issues);
734
- for (const property of ['feature', 'slice']) {
735
- if (has(record, property)) {
736
- requireSafeString(record[property], `${path}.${property}`, issues, {
737
- pattern: IDENTIFIER_PATTERN,
738
- });
739
- }
740
- }
741
- if (has(record, 'files')) {
742
- const files = requireArray(record.files, `${path}.files`, issues);
743
- const paths = new Set();
744
- files?.forEach((entry, index) => {
745
- if (validateSelectedFileContext(entry, `${path}.files[${index}]`, issues)) {
746
- const selected = entry;
747
- if (paths.has(selected.path)) {
748
- addIssue(issues, `${path}.files[${index}].path`, 'must not duplicate another selected file');
749
- }
750
- paths.add(selected.path);
751
- }
752
- });
753
- }
754
- return true;
755
- }
756
- function validateSelectedFileContext(value, path, issues) {
757
- const record = requireRecord(value, path, ['ownershipMode', 'path', 'project'], [], issues);
758
- if (!record)
759
- return false;
760
- requireEnum(record.ownershipMode, `${path}.ownershipMode`, OWNERSHIP_MODE_SET, issues);
761
- validateCanonicalWorkspacePath(record.path, `${path}.path`, issues);
762
- requireSafeString(record.project, `${path}.project`, issues, {
763
- pattern: IDENTIFIER_PATTERN,
764
- });
765
- return true;
766
- }
767
- function validateCanonicalWorkspacePath(value, path, issues) {
768
- const valid = requireSafeString(value, path, issues, {
769
- maximumLength: MAX_PATH_LENGTH,
770
- pattern: WORKSPACE_RELATIVE_PATH_PATTERN,
771
- });
772
- if (valid && !(0, workspace_path_js_1.isCanonicalDeveloperAgentWorkspacePath)(value)) {
773
- addIssue(issues, path, 'must be a canonical relative path');
774
- }
775
- return valid;
776
- }
777
- function validateAffectedContext(value, path, issues) {
778
- const record = requireRecord(value, path, [
779
- 'baseCommit',
780
- 'fileCount',
781
- 'files',
782
- 'filesDigest',
783
- 'filesTruncated',
784
- 'headCommit',
785
- 'projects',
786
- 'targets',
787
- ], [], issues);
788
- if (!record)
789
- return false;
790
- for (const property of ['baseCommit', 'headCommit']) {
791
- requireSafeString(record[property], `${path}.${property}`, issues, {
792
- maximumLength: 64,
793
- pattern: COMMIT_PATTERN,
794
- });
795
- }
796
- const fileCountValid = requireInteger(record.fileCount, `${path}.fileCount`, issues, 0, MAX_CONCURRENT_PATHS);
797
- const files = requireArray(record.files, `${path}.files`, issues, MAX_AFFECTED_FILE_REFERENCES);
798
- const fileKeys = new Set();
799
- let previousFileKey;
800
- files?.forEach((entry, index) => {
801
- if (validateCanonicalWorkspacePath(entry, `${path}.files[${index}]`, issues)) {
802
- const file = entry;
803
- const key = file.normalize('NFC').toLocaleLowerCase('en-US');
804
- if (fileKeys.has(key)) {
805
- addIssue(issues, `${path}.files[${index}]`, 'must not duplicate or case-alias another affected path');
806
- }
807
- if (previousFileKey !== undefined && previousFileKey >= key) {
808
- addIssue(issues, `${path}.files[${index}]`, 'must be in ascending canonical order');
809
- }
810
- fileKeys.add(key);
811
- previousFileKey = key;
812
- }
813
- });
814
- requireSafeString(record.filesDigest, `${path}.filesDigest`, issues, {
815
- maximumLength: 71,
816
- pattern: SHA256_DIGEST_PATTERN,
817
- });
818
- const truncatedValid = requireBoolean(record.filesTruncated, `${path}.filesTruncated`, issues);
819
- if (fileCountValid && truncatedValid && files) {
820
- const fileCount = record.fileCount;
821
- if ((record.filesTruncated === false && fileCount !== files.length) ||
822
- (record.filesTruncated === true &&
823
- (files.length !== MAX_AFFECTED_FILE_REFERENCES ||
824
- fileCount <= files.length))) {
825
- addIssue(issues, path, 'must retain an exact file count and an honest bounded-file truncation state');
826
- }
827
- if (record.filesTruncated === false &&
828
- files.every((entry) => typeof entry === 'string') &&
829
- record.filesDigest !==
830
- `sha256:${(0, node_crypto_1.createHash)('sha256')
831
- .update(JSON.stringify(files), 'utf8')
832
- .digest('hex')}`) {
833
- addIssue(issues, `${path}.filesDigest`, 'must bind the complete retained affected-path set');
834
- }
835
- }
836
- validateStringArray(record.projects, `${path}.projects`, issues, {
837
- pattern: IDENTIFIER_PATTERN,
838
- });
839
- validateStringArray(record.targets, `${path}.targets`, issues, {
840
- pattern: IDENTIFIER_PATTERN,
841
- });
842
- return true;
843
- }
844
- function validateMarkerContext(value, path, issues) {
845
- const record = requireRecord(value, path, ['blocking', 'path', 'reference', 'sanitizedSummary'], [], issues);
846
- if (!record)
847
- return false;
848
- requireBoolean(record.blocking, `${path}.blocking`, issues);
849
- validateCanonicalWorkspacePath(record.path, `${path}.path`, issues);
850
- requireSafeString(record.reference, `${path}.reference`, issues);
851
- requireSafeString(record.sanitizedSummary, `${path}.sanitizedSummary`, issues, { maximumLength: MAX_SUMMARY_LENGTH });
852
- return true;
853
- }
854
- function validateReportContext(value, path, issues) {
855
- const record = requireRecord(value, path, ['name', 'outcome'], ['reference'], issues);
856
- if (!record)
857
- return false;
858
- requireSafeString(record.name, `${path}.name`, issues, {
859
- pattern: IDENTIFIER_PATTERN,
860
- });
861
- requireEnum(record.outcome, `${path}.outcome`, new Set(['passed', 'failed', 'blocked', 'unavailable']), issues);
862
- if (has(record, 'reference')) {
863
- requireSafeString(record.reference, `${path}.reference`, issues, {
864
- maximumLength: MAX_PATH_LENGTH,
865
- });
866
- }
867
- return true;
868
- }
869
- function validateWarning(value, path, issues) {
870
- const record = requireRecord(value, path, ['classification', 'sanitizedSummary'], ['upgradeVersionDrift'], issues);
871
- if (!record)
872
- return false;
873
- requireEnum(record.classification, `${path}.classification`, FAILURE_SET, issues);
874
- requireSafeString(record.sanitizedSummary, `${path}.sanitizedSummary`, issues, { maximumLength: MAX_SUMMARY_LENGTH });
875
- if (has(record, 'upgradeVersionDrift')) {
876
- const drift = requireRecord(record.upgradeVersionDrift, `${path}.upgradeVersionDrift`, ['kind', 'target'], [], issues);
877
- if (drift) {
878
- requireEnum(drift.kind, `${path}.upgradeVersionDrift.kind`, new Set(['foundation', 'site', 'slice', 'workspace']), issues);
879
- requireSafeString(drift.target, `${path}.upgradeVersionDrift.target`, issues, { pattern: IDENTIFIER_PATTERN });
880
- }
881
- if (record.classification !== 'ownership-conflict') {
882
- addIssue(issues, `${path}.upgradeVersionDrift`, 'is accepted only for ownership-conflict warnings');
883
- }
884
- }
885
- return true;
886
- }
887
- function validateWarnings(value, path, issues) {
888
- const entries = requireArray(value, path, issues);
889
- if (!entries)
890
- return false;
891
- entries.forEach((entry, index) => validateWarning(entry, `${path}[${index}]`, issues));
892
- return true;
893
- }
894
- function validateGeneratorOperation(value, path, issues) {
895
- const record = requireRecord(value, path, ['generator', 'mode'], [], issues);
896
- if (!record)
897
- return false;
898
- requireEnum(record.generator, `${path}.generator`, STABLE_GENERATOR_SET, issues);
899
- requireEnum(record.mode, `${path}.mode`, GENERATOR_MODE_SET, issues);
900
- return true;
901
- }
902
- function validateGeneratorInput(value, path, issues) {
903
- if (!(0, validation_js_1.isRecord)(value) || typeof value.generator !== 'string') {
904
- addIssue(issues, path, 'must be one closed typed stable-generator input');
905
- return false;
906
- }
907
- const slug = (entry, entryPath) => requireSafeString(entry, entryPath, issues, {
908
- maximumLength: 63,
909
- pattern: GENERATOR_SLUG_PATTERN,
910
- });
911
- if (value.generator === 'slice') {
912
- const record = requireRecord(value, path, ['generator', 'name'], [], issues);
913
- if (record)
914
- slug(record.name, `${path}.name`);
915
- return record !== undefined;
916
- }
917
- // The root site is one fixed project, so its generator takes no name.
918
- if (value.generator === 'site') {
919
- return requireRecord(value, path, ['generator'], [], issues) !== undefined;
920
- }
921
- if (value.generator === 'function' ||
922
- value.generator === 'service' ||
923
- value.generator === 'job') {
924
- const record = requireRecord(value, path, ['feature', 'generator', 'name', 'slice'], [], issues);
925
- if (record) {
926
- slug(record.feature, `${path}.feature`);
927
- slug(record.name, `${path}.name`);
928
- slug(record.slice, `${path}.slice`);
929
- }
930
- return record !== undefined;
931
- }
932
- if (value.generator === 'upgrade') {
933
- const record = requireRecord(value, path, ['generator', 'name'], ['preview'], issues);
934
- if (!record)
935
- return false;
936
- slug(record.name, `${path}.name`);
937
- if (has(record, 'preview')) {
938
- const preview = requireRecord(record.preview, `${path}.preview`, ['digest', 'reference'], [], issues);
939
- if (preview) {
940
- requireSafeString(preview.digest, `${path}.preview.digest`, issues, {
941
- pattern: SHA256_DIGEST_PATTERN,
942
- });
943
- requireSafeString(preview.reference, `${path}.preview.reference`, issues, {
944
- maximumLength: MAX_PATH_LENGTH,
945
- pattern: GENERATOR_PREVIEW_REFERENCE_PATTERN,
946
- });
947
- }
948
- }
949
- return true;
950
- }
951
- addIssue(issues, `${path}.generator`, 'must identify a stable typed generator');
952
- return false;
953
- }
954
- function validateSupportedOperation(value, path, issues) {
955
- const record = requireRecord(value, path, [
956
- 'applicableStages',
957
- 'approvalRequired',
958
- 'authority',
959
- 'contracts',
960
- 'documentationPaths',
961
- 'evidenceClasses',
962
- 'id',
963
- 'owner',
964
- 'projects',
965
- 'requiredVerification',
966
- ], ['command', 'generator', 'policyLifecycleAction'], issues);
967
- if (!record)
968
- return false;
969
- const applicableStages = requireArray(record.applicableStages, `${path}.applicableStages`, issues);
970
- const stages = new Set();
971
- applicableStages?.forEach((stage, index) => {
972
- if (requireEnum(stage, `${path}.applicableStages[${index}]`, CANONICAL_STAGE_SET, issues)) {
973
- if (stages.has(stage)) {
974
- addIssue(issues, `${path}.applicableStages[${index}]`, 'must not duplicate another stage');
975
- }
976
- stages.add(stage);
977
- }
978
- });
979
- if (applicableStages?.length === 0) {
980
- addIssue(issues, `${path}.applicableStages`, 'must declare at least one canonical stage');
981
- }
982
- requireBoolean(record.approvalRequired, `${path}.approvalRequired`, issues);
983
- requireEnum(record.authority, `${path}.authority`, AUTHORITY_SET, issues);
984
- if (has(record, 'command')) {
985
- validateCommand(record.command, `${path}.command`, issues);
986
- }
987
- if (has(record, 'generator')) {
988
- validateGeneratorOperation(record.generator, `${path}.generator`, issues);
989
- }
990
- validateContractReferences(record.contracts, `${path}.contracts`, issues);
991
- validateStringArray(record.documentationPaths, `${path}.documentationPaths`, issues, { maximumLength: MAX_PATH_LENGTH });
992
- validateStringArray(record.evidenceClasses, `${path}.evidenceClasses`, issues);
993
- requireSafeString(record.id, `${path}.id`, issues, {
994
- pattern: IDENTIFIER_PATTERN,
995
- });
996
- requireEnum(record.owner, `${path}.owner`, OPERATION_OWNER_SET, issues);
997
- if (has(record, 'policyLifecycleAction')) {
998
- requireEnum(record.policyLifecycleAction, `${path}.policyLifecycleAction`, POLICY_LIFECYCLE_ACTION_SET, issues);
999
- }
1000
- validateStringArray(record.projects, `${path}.projects`, issues, {
1001
- pattern: IDENTIFIER_PATTERN,
1002
- });
1003
- validateStringArray(record.requiredVerification, `${path}.requiredVerification`, issues);
1004
- if ((record.authority === 'protected-mutate' ||
1005
- record.authority === 'destructive') &&
1006
- record.approvalRequired !== true) {
1007
- addIssue(issues, `${path}.approvalRequired`, 'must be true for protected or destructive operation');
1008
- }
1009
- if ((record.authority === 'protected-mutate' ||
1010
- record.authority === 'destructive') &&
1011
- has(record, 'command')) {
1012
- addIssue(issues, `${path}.command`, 'must be absent because protected or destructive authority is not local argv');
1013
- }
1014
- if (record.authority !== 'protected-mutate' &&
1015
- record.authority !== 'destructive' &&
1016
- record.owner !== 'source-edit' &&
1017
- record.owner !== 'nx-generator' &&
1018
- !has(record, 'command')) {
1019
- addIssue(issues, `${path}.command`, 'is required for a locally invocable operation');
1020
- }
1021
- const generator = (0, validation_js_1.isRecord)(record.generator) ? record.generator : undefined;
1022
- if (record.owner === 'nx-generator') {
1023
- if (!generator) {
1024
- addIssue(issues, `${path}.generator`, 'is required for a typed Nx generator template');
1025
- }
1026
- else {
1027
- if (typeof generator.generator === 'string' &&
1028
- typeof generator.mode === 'string' &&
1029
- record.id !== `generator:${generator.generator}:${generator.mode}`) {
1030
- addIssue(issues, `${path}.id`, 'must exactly identify the typed generator and mode');
1031
- }
1032
- if ((generator.mode === 'preview' || generator.mode === 'apply') &&
1033
- record.authority !== 'local-source') {
1034
- addIssue(issues, `${path}.authority`, 'must be local-source because generator preview and apply execute the owning generator against a workspace tree');
1035
- }
1036
- }
1037
- if (has(record, 'command')) {
1038
- addIssue(issues, `${path}.command`, 'must be absent until typed generator inputs are bound by planning');
1039
- }
1040
- }
1041
- else if (generator) {
1042
- addIssue(issues, `${path}.generator`, 'is valid only for an nx-generator owner');
1043
- }
1044
- if (record.authority === 'development-mutate' &&
1045
- (stages.size !== 1 || !stages.has('development'))) {
1046
- addIssue(issues, `${path}.applicableStages`, 'must equal development for development mutation');
1047
- }
1048
- if (record.policyLifecycleAction === 'dev' &&
1049
- (stages.size !== 1 || !stages.has('development'))) {
1050
- addIssue(issues, `${path}.applicableStages`, 'must equal development for repository-policy dev actions');
1051
- }
1052
- if ((record.authority === 'protected-mutate' ||
1053
- record.authority === 'destructive') &&
1054
- ['deploy', 'migrate', 'refresh', 'remove'].includes(String(record.policyLifecycleAction)) &&
1055
- stages.has('development')) {
1056
- addIssue(issues, `${path}.applicableStages`, 'must route protected lifecycle mutation through staging or production');
1057
- }
1058
- return true;
1059
- }
1060
- function validateSerializedBound(value, path, maximumBytes, issues) {
1061
- try {
1062
- const serialized = (0, canonical_json_1.canonicalJson)(value);
1063
- if (Buffer.byteLength(serialized, 'utf8') > maximumBytes) {
1064
- addIssue(issues, path, `must serialize to at most ${maximumBytes} bytes`);
1065
- }
1066
- }
1067
- catch {
1068
- addIssue(issues, path, 'must be canonically JSON serializable');
1069
- }
1070
- }
1071
- function validateDeveloperAgentContext(value, options = {}) {
1072
- const issues = [];
1073
- if (options.transportBound !== false) {
1074
- validateSerializedBound(value, '$', model_js_1.DEVELOPER_AGENT_CONTEXT_MAX_BYTES, issues);
1075
- }
1076
- const record = requireRecord(value, '$', [
1077
- 'authenticatedTargets',
1078
- 'documentationPaths',
1079
- 'evidenceClasses',
1080
- 'git',
1081
- 'kind',
1082
- 'markers',
1083
- 'nonPlannableTargets',
1084
- 'policy',
1085
- 'projectNames',
1086
- 'projects',
1087
- 'reports',
1088
- 'requiredVerification',
1089
- 'schemaVersion',
1090
- 'selection',
1091
- 'supportedOperations',
1092
- 'warnings',
1093
- 'workspace',
1094
- ], ['affected'], issues);
1095
- if (!record)
1096
- return (0, validation_js_1.validationResult)(value, issues);
1097
- if (record.kind !== model_js_1.DEVELOPER_AGENT_CONTEXT_KIND) {
1098
- addIssue(issues, '$.kind', `must equal ${model_js_1.DEVELOPER_AGENT_CONTEXT_KIND}`);
1099
- }
1100
- if (record.schemaVersion !== model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION) {
1101
- addIssue(issues, '$.schemaVersion', `must equal ${model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION}`);
1102
- }
1103
- validateStringArray(record.authenticatedTargets, '$.authenticatedTargets', issues, { pattern: IDENTIFIER_PATTERN });
1104
- validateStringArray(record.documentationPaths, '$.documentationPaths', issues, {
1105
- maximumLength: MAX_PATH_LENGTH,
1106
- });
1107
- validateStringArray(record.evidenceClasses, '$.evidenceClasses', issues);
1108
- validateGitContext(record.git, '$.git', issues);
1109
- const markers = requireArray(record.markers, '$.markers', issues);
1110
- markers?.forEach((entry, index) => validateMarkerContext(entry, `$.markers[${index}]`, issues));
1111
- const nonPlannableTargets = requireArray(record.nonPlannableTargets, '$.nonPlannableTargets', issues);
1112
- const nonPlannableNames = new Set();
1113
- nonPlannableTargets?.forEach((entry, index) => {
1114
- const path = `$.nonPlannableTargets[${index}]`;
1115
- const target = requireRecord(entry, path, ['rationale', 'target'], [], issues);
1116
- if (!target)
1117
- return;
1118
- requireSafeString(target.rationale, `${path}.rationale`, issues, {
1119
- maximumLength: MAX_SUMMARY_LENGTH,
1120
- });
1121
- if (requireSafeString(target.target, `${path}.target`, issues, {
1122
- pattern: IDENTIFIER_PATTERN,
1123
- })) {
1124
- const name = target.target;
1125
- if (nonPlannableNames.has(name)) {
1126
- addIssue(issues, `${path}.target`, 'must be unique');
1127
- }
1128
- nonPlannableNames.add(name);
1129
- }
1130
- });
1131
- if (Array.isArray(record.authenticatedTargets)) {
1132
- for (const target of record.authenticatedTargets) {
1133
- if (typeof target === 'string' && nonPlannableNames.has(target)) {
1134
- addIssue(issues, '$.nonPlannableTargets', `${target} cannot be both authenticated and non-plannable`);
1135
- }
1136
- }
1137
- }
1138
- validatePolicyContext(record.policy, '$.policy', issues);
1139
- const projectNamesValid = validateStringArray(record.projectNames, '$.projectNames', issues, {
1140
- maximumItems: model_js_1.DEVELOPER_AGENT_MAX_PROJECT_NAMES,
1141
- pattern: IDENTIFIER_PATTERN,
1142
- });
1143
- const projectNames = projectNamesValid
1144
- ? record.projectNames
1145
- : undefined;
1146
- if (projectNames) {
1147
- if (projectNames.length === 0) {
1148
- addIssue(issues, '$.projectNames', 'must contain the Nx workspace project');
1149
- }
1150
- for (let index = 1; index < projectNames.length; index += 1) {
1151
- if ((0, ordering_js_1.compareDeveloperAgentStrings)(projectNames[index - 1], projectNames[index]) >= 0) {
1152
- addIssue(issues, `$.projectNames[${index}]`, 'must be in ascending canonical order');
1153
- }
1154
- }
1155
- }
1156
- const projectsValid = validateProjectContexts(record.projects, '$.projects', issues);
1157
- const projects = projectsValid
1158
- ? record.projects
1159
- : undefined;
1160
- const reports = requireArray(record.reports, '$.reports', issues);
1161
- reports?.forEach((entry, index) => validateReportContext(entry, `$.reports[${index}]`, issues));
1162
- validateStringArray(record.requiredVerification, '$.requiredVerification', issues);
1163
- validateSelectionContext(record.selection, '$.selection', issues);
1164
- const operations = requireArray(record.supportedOperations, '$.supportedOperations', issues);
1165
- const operationIds = new Set();
1166
- operations?.forEach((entry, index) => {
1167
- if (validateSupportedOperation(entry, `$.supportedOperations[${index}]`, issues)) {
1168
- const id = entry.id;
1169
- if (operationIds.has(id)) {
1170
- addIssue(issues, `$.supportedOperations[${index}].id`, 'must be unique');
1171
- }
1172
- operationIds.add(id);
1173
- }
1174
- });
1175
- validateWarnings(record.warnings, '$.warnings', issues);
1176
- validateWorkspaceContext(record.workspace, '$.workspace', issues);
1177
- if (projectNames) {
1178
- const inventory = new Set(projectNames);
1179
- if (projects) {
1180
- for (const [index, project] of projects.entries()) {
1181
- if (!inventory.has(project.name)) {
1182
- addIssue(issues, `$.projects[${index}].name`, 'must be included in the full Nx project-name inventory');
1183
- }
1184
- }
1185
- }
1186
- if ((0, validation_js_1.isRecord)(record.workspace) &&
1187
- typeof record.workspace.identity === 'string' &&
1188
- !inventory.has(record.workspace.identity)) {
1189
- addIssue(issues, '$.workspace.identity', 'must be included in the full Nx project-name inventory');
1190
- }
1191
- }
1192
- if (has(record, 'affected')) {
1193
- validateAffectedContext(record.affected, '$.affected', issues);
1194
- }
1195
- if ((0, validation_js_1.isRecord)(record.git) && Array.isArray(record.warnings)) {
1196
- const classifications = new Set(record.warnings.filter(validation_js_1.isRecord).map((warning) => warning.classification));
1197
- if (record.git.dirty === true && !classifications.has('dirty-worktree')) {
1198
- addIssue(issues, '$.warnings', 'must report dirty-worktree when Git context is dirty');
1199
- }
1200
- if ((0, validation_js_1.isRecord)(record.workspace) &&
1201
- record.workspace.ownershipAgreement === 'conflict' &&
1202
- !classifications.has('ownership-conflict')) {
1203
- addIssue(issues, '$.warnings', 'must report ownership-conflict when records disagree');
1204
- }
1205
- if ((0, validation_js_1.isRecord)(record.workspace) &&
1206
- Array.isArray(record.workspace.ownershipVersions)) {
1207
- for (const [index, entry] of record.warnings.entries()) {
1208
- if (!(0, validation_js_1.isRecord)(entry) || !(0, validation_js_1.isRecord)(entry.upgradeVersionDrift)) {
1209
- continue;
1210
- }
1211
- const drift = entry.upgradeVersionDrift;
1212
- const state = record.workspace.ownershipVersions.find((candidate) => (0, validation_js_1.isRecord)(candidate) &&
1213
- candidate.kind === drift.kind &&
1214
- candidate.target === drift.target);
1215
- const frameworkDrift = (0, validation_js_1.isRecord)(state) &&
1216
- typeof state.installedFrameworkVersion === 'string' &&
1217
- typeof state.recordedFrameworkVersion === 'string' &&
1218
- state.installedFrameworkVersion !== state.recordedFrameworkVersion;
1219
- const blueprintDrift = (0, validation_js_1.isRecord)(state) &&
1220
- typeof state.installedBlueprintVersion === 'string' &&
1221
- typeof state.recordedBlueprintVersion === 'string' &&
1222
- state.installedBlueprintVersion !== state.recordedBlueprintVersion;
1223
- if (!frameworkDrift && !blueprintDrift) {
1224
- addIssue(issues, `$.warnings[${index}].upgradeVersionDrift`, 'must identify one exact inspected installed/recorded version mismatch');
1225
- }
1226
- }
1227
- }
1228
- }
1229
- if (has(record, 'affected') &&
1230
- (0, validation_js_1.isRecord)(record.affected) &&
1231
- (0, validation_js_1.isRecord)(record.git)) {
1232
- if (typeof record.git.baseCommit === 'string' &&
1233
- record.affected.baseCommit !== record.git.baseCommit) {
1234
- addIssue(issues, '$.affected.baseCommit', 'must agree with Git baseCommit');
1235
- }
1236
- if (typeof record.git.headCommit === 'string' &&
1237
- record.affected.headCommit !== record.git.headCommit) {
1238
- addIssue(issues, '$.affected.headCommit', 'must agree with Git headCommit');
1239
- }
1240
- }
1241
- return (0, validation_js_1.validationResult)(value, issues);
1242
- }
1243
- function validateGeneratedSurface(value, path, issues) {
1244
- const record = requireRecord(value, path, ['ownershipMode', 'path'], [], issues);
1245
- if (!record)
1246
- return false;
1247
- requireEnum(record.ownershipMode, `${path}.ownershipMode`, OWNERSHIP_MODE_SET, issues);
1248
- requireSafeString(record.path, `${path}.path`, issues, {
1249
- maximumLength: MAX_PATH_LENGTH,
1250
- });
1251
- return true;
1252
- }
1253
- function validateGeneratorPreviewChange(value, path, issues) {
1254
- const record = requireRecord(value, path, ['change', 'ownershipMode', 'path'], ['contentDigest', 'mode'], issues);
1255
- if (!record)
1256
- return false;
1257
- requireEnum(record.change, `${path}.change`, GENERATOR_PREVIEW_CHANGE_SET, issues);
1258
- requireEnum(record.ownershipMode, `${path}.ownershipMode`, OWNERSHIP_MODE_SET, issues);
1259
- requireSafeString(record.path, `${path}.path`, issues, {
1260
- maximumLength: MAX_PATH_LENGTH,
1261
- });
1262
- if (record.change === 'delete') {
1263
- if (has(record, 'contentDigest')) {
1264
- addIssue(issues, `${path}.contentDigest`, 'must be absent for a deleted file');
1265
- }
1266
- }
1267
- else {
1268
- requireSafeString(record.contentDigest, `${path}.contentDigest`, issues, {
1269
- pattern: SHA256_DIGEST_PATTERN,
1270
- });
1271
- }
1272
- if (has(record, 'mode')) {
1273
- requireSafeString(record.mode, `${path}.mode`, issues, {
1274
- pattern: /^[0-7]{3,4}$/,
1275
- });
1276
- }
1277
- return true;
1278
- }
1279
- function validateGeneratorPreviewSource(value, path, issues) {
1280
- const record = requireRecord(value, path, [
1281
- 'blueprintVersions',
1282
- 'commit',
1283
- 'frameworkVersion',
1284
- 'ownershipVersions',
1285
- 'workspace',
1286
- ], ['candidateProvenance'], issues);
1287
- if (!record)
1288
- return false;
1289
- validateVersionRecords(record.blueprintVersions, `${path}.blueprintVersions`, issues);
1290
- if (has(record, 'candidateProvenance')) {
1291
- validateCandidateProvenance(record.candidateProvenance, `${path}.candidateProvenance`, issues);
1292
- }
1293
- requireSafeString(record.commit, `${path}.commit`, issues, {
1294
- maximumLength: 64,
1295
- pattern: COMMIT_PATTERN,
1296
- });
1297
- requireSafeString(record.frameworkVersion, `${path}.frameworkVersion`, issues);
1298
- validateOwnershipVersionStates(record.ownershipVersions, `${path}.ownershipVersions`, issues);
1299
- requireSafeString(record.workspace, `${path}.workspace`, issues, {
1300
- pattern: IDENTIFIER_PATTERN,
1301
- });
1302
- return true;
1303
- }
1304
- function validateDeveloperAgentGeneratorPreview(value) {
1305
- const issues = [];
1306
- validateSerializedBound(value, '$', model_js_1.DEVELOPER_AGENT_GENERATOR_PREVIEW_MAX_BYTES, issues);
1307
- const record = requireRecord(value, '$', [
1308
- 'changes',
1309
- 'generatedSurfaces',
1310
- 'generator',
1311
- 'input',
1312
- 'kind',
1313
- 'operationId',
1314
- 'schemaVersion',
1315
- 'source',
1316
- ], [], issues);
1317
- if (!record)
1318
- return (0, validation_js_1.validationResult)(value, issues);
1319
- if (record.kind !== model_js_1.DEVELOPER_AGENT_GENERATOR_PREVIEW_KIND) {
1320
- addIssue(issues, '$.kind', `must equal ${model_js_1.DEVELOPER_AGENT_GENERATOR_PREVIEW_KIND}`);
1321
- }
1322
- if (record.schemaVersion !== model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION) {
1323
- addIssue(issues, '$.schemaVersion', `must equal ${model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION}`);
1324
- }
1325
- if (record.generator !== 'upgrade') {
1326
- addIssue(issues, '$.generator', 'must equal upgrade');
1327
- }
1328
- if (record.operationId !== 'generator:upgrade:preview') {
1329
- addIssue(issues, '$.operationId', 'must equal generator:upgrade:preview');
1330
- }
1331
- const input = requireRecord(record.input, '$.input', ['generator', 'name'], [], issues);
1332
- if (input) {
1333
- if (input.generator !== 'upgrade') {
1334
- addIssue(issues, '$.input.generator', 'must equal upgrade');
1335
- }
1336
- requireSafeString(input.name, '$.input.name', issues, {
1337
- maximumLength: 63,
1338
- pattern: /^[a-z0-9][a-z0-9-]*$/,
1339
- });
1340
- }
1341
- validateGeneratorPreviewSource(record.source, '$.source', issues);
1342
- const changes = requireArray(record.changes, '$.changes', issues, MAX_GENERATED_SURFACES);
1343
- const changePaths = new Set();
1344
- let previousChangePath;
1345
- changes?.forEach((entry, index) => {
1346
- if (validateGeneratorPreviewChange(entry, `$.changes[${index}]`, issues)) {
1347
- validateCanonicalWorkspacePath(entry.path, `$.changes[${index}].path`, issues);
1348
- if (changePaths.has(entry.path)) {
1349
- addIssue(issues, `$.changes[${index}].path`, 'must be unique');
1350
- }
1351
- if (previousChangePath !== undefined &&
1352
- (0, ordering_js_1.compareDeveloperAgentStrings)(previousChangePath, entry.path) >= 0) {
1353
- addIssue(issues, `$.changes[${index}].path`, 'must be in ascending canonical order');
1354
- }
1355
- changePaths.add(entry.path);
1356
- previousChangePath = entry.path;
1357
- }
1358
- });
1359
- const surfaces = requireArray(record.generatedSurfaces, '$.generatedSurfaces', issues, MAX_GENERATED_SURFACES);
1360
- const paths = new Set();
1361
- let previousPath;
1362
- surfaces?.forEach((entry, index) => {
1363
- if (validateGeneratedSurface(entry, `$.generatedSurfaces[${index}]`, issues)) {
1364
- validateCanonicalWorkspacePath(entry.path, `$.generatedSurfaces[${index}].path`, issues);
1365
- if (paths.has(entry.path)) {
1366
- addIssue(issues, `$.generatedSurfaces[${index}].path`, 'must be unique');
1367
- }
1368
- if (previousPath !== undefined &&
1369
- (0, ordering_js_1.compareDeveloperAgentStrings)(previousPath, entry.path) >= 0) {
1370
- addIssue(issues, `$.generatedSurfaces[${index}].path`, 'must be in ascending canonical order');
1371
- }
1372
- paths.add(entry.path);
1373
- previousPath = entry.path;
1374
- }
1375
- });
1376
- if (changes &&
1377
- surfaces &&
1378
- changes.every(validation_js_1.isRecord) &&
1379
- surfaces.every(validation_js_1.isRecord) &&
1380
- !(0, node_util_1.isDeepStrictEqual)(surfaces, changes.map(({ ownershipMode, path }) => ({ ownershipMode, path })))) {
1381
- addIssue(issues, '$.generatedSurfaces', 'must exactly project the preview change paths and ownership modes');
1382
- }
1383
- return (0, validation_js_1.validationResult)(value, issues);
1384
- }
1385
- function validateDeveloperAgentGeneratorPreviewReceipt(value) {
1386
- const issues = [];
1387
- validateSerializedBound(value, '$', model_js_1.DEVELOPER_AGENT_GENERATOR_PREVIEW_RECEIPT_MAX_BYTES, issues);
1388
- const record = requireRecord(value, '$', ['digest', 'kind', 'preview', 'reference', 'schemaVersion'], [], issues);
1389
- if (!record)
1390
- return (0, validation_js_1.validationResult)(value, issues);
1391
- if (record.kind !== model_js_1.DEVELOPER_AGENT_GENERATOR_PREVIEW_RECEIPT_KIND) {
1392
- addIssue(issues, '$.kind', `must equal ${model_js_1.DEVELOPER_AGENT_GENERATOR_PREVIEW_RECEIPT_KIND}`);
1393
- }
1394
- if (record.schemaVersion !== model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION) {
1395
- addIssue(issues, '$.schemaVersion', `must equal ${model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION}`);
1396
- }
1397
- requireSafeString(record.digest, '$.digest', issues, {
1398
- pattern: SHA256_DIGEST_PATTERN,
1399
- });
1400
- requireSafeString(record.reference, '$.reference', issues, {
1401
- maximumLength: MAX_PATH_LENGTH,
1402
- pattern: GENERATOR_PREVIEW_REFERENCE_PATTERN,
1403
- });
1404
- const previewValidation = validateDeveloperAgentGeneratorPreview(record.preview);
1405
- if (!previewValidation.valid) {
1406
- for (const issue of previewValidation.issues) {
1407
- addIssue(issues, `$.preview${issue.path === '$' ? '' : issue.path.slice(1)}`, issue.message);
1408
- }
1409
- }
1410
- else if (record.digest !==
1411
- `sha256:${(0, node_crypto_1.createHash)('sha256')
1412
- .update((0, canonical_json_1.canonicalJson)(previewValidation.value), 'utf8')
1413
- .digest('hex')}`) {
1414
- addIssue(issues, '$.digest', 'must bind the canonical preview bytes exactly');
1415
- }
1416
- return (0, validation_js_1.validationResult)(value, issues);
1417
- }
1418
- function validateInvocation(value, path, issues) {
1419
- const record = requireRecord(value, path, ['command', 'owner'], [], issues);
1420
- if (!record)
1421
- return false;
1422
- validateCommand(record.command, `${path}.command`, issues);
1423
- requireEnum(record.owner, `${path}.owner`, OPERATION_OWNER_SET, issues);
1424
- return true;
1425
- }
1426
- function validateApprovalPoint(value, path, issues) {
1427
- const record = requireRecord(value, path, ['authority', 'description'], [], issues);
1428
- if (!record)
1429
- return false;
1430
- requireEnum(record.authority, `${path}.authority`, AUTHORITY_SET, issues);
1431
- requireSafeString(record.description, `${path}.description`, issues, {
1432
- maximumLength: MAX_SUMMARY_LENGTH,
1433
- });
1434
- return true;
1435
- }
1436
- function validateRisk(value, path, issues) {
1437
- const record = requireRecord(value, path, ['class', 'sanitizedSummary'], [], issues);
1438
- if (!record)
1439
- return false;
1440
- requireEnum(record.class, `${path}.class`, RISK_CLASS_SET, issues);
1441
- requireSafeString(record.sanitizedSummary, `${path}.sanitizedSummary`, issues, { maximumLength: MAX_SUMMARY_LENGTH });
1442
- return true;
1443
- }
1444
- function validateDeveloperAgentPlan(value) {
1445
- const issues = [];
1446
- validateSerializedBound(value, '$', model_js_1.DEVELOPER_AGENT_PLAN_MAX_BYTES, issues);
1447
- const record = requireRecord(value, '$', [
1448
- 'acceptanceCriteriaReference',
1449
- 'affectedContracts',
1450
- 'approvalPoints',
1451
- 'assumptions',
1452
- 'authority',
1453
- 'blockers',
1454
- 'cleanup',
1455
- 'evidenceClasses',
1456
- 'generatedSurfaces',
1457
- 'invocations',
1458
- 'kind',
1459
- 'nextSafeAction',
1460
- 'operation',
1461
- 'recovery',
1462
- 'requestedOutcome',
1463
- 'risks',
1464
- 'schemaVersion',
1465
- 'selectedFiles',
1466
- 'selectedProjects',
1467
- 'verification',
1468
- ], [], issues);
1469
- if (!record)
1470
- return (0, validation_js_1.validationResult)(value, issues);
1471
- if (record.kind !== model_js_1.DEVELOPER_AGENT_PLAN_KIND) {
1472
- addIssue(issues, '$.kind', `must equal ${model_js_1.DEVELOPER_AGENT_PLAN_KIND}`);
1473
- }
1474
- if (record.schemaVersion !== model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION) {
1475
- addIssue(issues, '$.schemaVersion', `must equal ${model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION}`);
1476
- }
1477
- requireSafeString(record.acceptanceCriteriaReference, '$.acceptanceCriteriaReference', issues, { maximumLength: MAX_PATH_LENGTH });
1478
- validateContractReferences(record.affectedContracts, '$.affectedContracts', issues);
1479
- const approvalPoints = requireArray(record.approvalPoints, '$.approvalPoints', issues);
1480
- approvalPoints?.forEach((entry, index) => validateApprovalPoint(entry, `$.approvalPoints[${index}]`, issues));
1481
- validateStringArray(record.assumptions, '$.assumptions', issues, {
1482
- maximumLength: MAX_SUMMARY_LENGTH,
1483
- });
1484
- requireEnum(record.authority, '$.authority', AUTHORITY_SET, issues);
1485
- validateWarnings(record.blockers, '$.blockers', issues);
1486
- validateCleanupRecovery(record.cleanup, '$.cleanup', issues);
1487
- validateStringArray(record.evidenceClasses, '$.evidenceClasses', issues);
1488
- const surfaces = requireArray(record.generatedSurfaces, '$.generatedSurfaces', issues, MAX_GENERATED_SURFACES);
1489
- surfaces?.forEach((entry, index) => validateGeneratedSurface(entry, `$.generatedSurfaces[${index}]`, issues));
1490
- const invocations = requireArray(record.invocations, '$.invocations', issues);
1491
- invocations?.forEach((entry, index) => validateInvocation(entry, `$.invocations[${index}]`, issues));
1492
- validateNextSafeAction(record.nextSafeAction, '$.nextSafeAction', issues);
1493
- validateHandoffOperation(record.operation, '$.operation', issues);
1494
- validateCleanupRecovery(record.recovery, '$.recovery', issues);
1495
- requireSafeString(record.requestedOutcome, '$.requestedOutcome', issues, {
1496
- maximumLength: MAX_SUMMARY_LENGTH,
1497
- });
1498
- const risks = requireArray(record.risks, '$.risks', issues);
1499
- risks?.forEach((entry, index) => validateRisk(entry, `$.risks[${index}]`, issues));
1500
- validateStringArray(record.selectedFiles, '$.selectedFiles', issues, {
1501
- maximumItems: MAX_GENERATED_SURFACES,
1502
- maximumLength: MAX_PATH_LENGTH,
1503
- });
1504
- if (Array.isArray(record.selectedFiles)) {
1505
- record.selectedFiles.forEach((entry, index) => validateCanonicalWorkspacePath(entry, `$.selectedFiles[${index}]`, issues));
1506
- }
1507
- validateStringArray(record.selectedProjects, '$.selectedProjects', issues, {
1508
- pattern: IDENTIFIER_PATTERN,
1509
- });
1510
- validateStringArray(record.verification, '$.verification', issues);
1511
- if ((0, validation_js_1.isRecord)(record.operation) && (0, validation_js_1.isRecord)(record.operation.scope)) {
1512
- if (record.operation.authority !== record.authority) {
1513
- addIssue(issues, '$.operation.authority', 'must equal the effective plan authority');
1514
- }
1515
- const sameStringSet = (left, right) => Array.isArray(left) &&
1516
- Array.isArray(right) &&
1517
- left.length === right.length &&
1518
- [...left]
1519
- .sort()
1520
- .every((entry, index) => entry === [...right].sort()[index]);
1521
- const contractIdentity = (value) => (0, validation_js_1.isRecord)(value)
1522
- ? `${String(value.class)}\u0000${String(value.reference)}`
1523
- : '';
1524
- if (!sameStringSet(record.operation.scope.projects, record.selectedProjects)) {
1525
- addIssue(issues, '$.operation.scope.projects', 'must equal the effective selected project scope');
1526
- }
1527
- if (!sameStringSet(Array.isArray(record.operation.scope.contracts)
1528
- ? record.operation.scope.contracts.map(contractIdentity)
1529
- : undefined, Array.isArray(record.affectedContracts)
1530
- ? record.affectedContracts.map(contractIdentity)
1531
- : undefined)) {
1532
- addIssue(issues, '$.operation.scope.contracts', 'must equal the effective affected contract scope');
1533
- }
1534
- if (!sameStringSet(record.operation.scope.evidenceClasses, record.evidenceClasses)) {
1535
- addIssue(issues, '$.operation.scope.evidenceClasses', 'must equal the effective evidence scope');
1536
- }
1537
- const planVerification = Array.isArray(record.verification)
1538
- ? record.verification
1539
- : [];
1540
- if (Array.isArray(record.operation.scope.requiredVerification) &&
1541
- record.operation.scope.requiredVerification.some((entry) => !planVerification.includes(entry))) {
1542
- addIssue(issues, '$.operation.scope.requiredVerification', 'must be included in the complete plan verification set');
1543
- }
1544
- }
1545
- if ((0, validation_js_1.isRecord)(record.operation) &&
1546
- (0, validation_js_1.isRecord)(record.nextSafeAction) &&
1547
- Array.isArray(record.invocations) &&
1548
- Array.isArray(record.blockers)) {
1549
- const blocked = record.blockers.length > 0;
1550
- const protectedOrDestructive = record.operation.authority === 'protected-mutate' ||
1551
- record.operation.authority === 'destructive';
1552
- const sourceEdit = record.operation.owner === 'source-edit';
1553
- if (blocked) {
1554
- if (record.nextSafeAction.authority !== 'read-only' ||
1555
- has(record.nextSafeAction, 'command') ||
1556
- has(record.nextSafeAction, 'operationId') ||
1557
- has(record.nextSafeAction, 'owner')) {
1558
- addIssue(issues, '$.nextSafeAction', 'a blocked plan must retain only a non-actionable read-only remediation');
1559
- }
1560
- if (record.invocations.length !== 0) {
1561
- addIssue(issues, '$.invocations', 'a blocked plan must not retain an invocation');
1562
- }
1563
- }
1564
- else {
1565
- if (record.nextSafeAction.authority !== record.operation.authority) {
1566
- addIssue(issues, '$.nextSafeAction.authority', 'must equal the effective operation authority');
1567
- }
1568
- if (record.nextSafeAction.operationId !== record.operation.id) {
1569
- addIssue(issues, '$.nextSafeAction.operationId', 'must equal the effective operation id');
1570
- }
1571
- if (record.nextSafeAction.owner !== record.operation.owner) {
1572
- addIssue(issues, '$.nextSafeAction.owner', 'must equal the effective operation owner');
1573
- }
1574
- if (protectedOrDestructive || sourceEdit) {
1575
- if (record.invocations.length !== 0) {
1576
- addIssue(issues, '$.invocations', 'this authority boundary must not retain a local invocation');
1577
- }
1578
- if (has(record.nextSafeAction, 'command')) {
1579
- addIssue(issues, '$.nextSafeAction.command', 'this authority boundary must not retain executable argv');
1580
- }
1581
- }
1582
- else {
1583
- if (record.invocations.length !== 1) {
1584
- addIssue(issues, '$.invocations', 'an executable local plan must retain exactly one owning-tool invocation');
1585
- }
1586
- else {
1587
- const invocation = record.invocations[0];
1588
- if (!(0, validation_js_1.isRecord)(invocation) ||
1589
- invocation.owner !== record.operation.owner) {
1590
- addIssue(issues, '$.invocations[0].owner', 'must equal the effective operation owner');
1591
- }
1592
- if (!(0, validation_js_1.isRecord)(invocation) ||
1593
- !has(record.nextSafeAction, 'command') ||
1594
- !(0, node_util_1.isDeepStrictEqual)(record.nextSafeAction.command, invocation.command)) {
1595
- addIssue(issues, '$.nextSafeAction.command', 'must equal the sole owning-tool invocation command');
1596
- }
1597
- }
1598
- }
1599
- }
1600
- }
1601
- if (Array.isArray(record.generatedSurfaces) &&
1602
- Array.isArray(record.selectedFiles)) {
1603
- const surfacePaths = record.generatedSurfaces.map((surface) => (0, validation_js_1.isRecord)(surface) && typeof surface.path === 'string'
1604
- ? surface.path
1605
- : undefined);
1606
- if (surfacePaths.length !== record.selectedFiles.length ||
1607
- surfacePaths.some((surfacePath, index) => surfacePath !== record.selectedFiles[index])) {
1608
- addIssue(issues, '$.generatedSurfaces', 'must be derived in order from selectedFiles');
1609
- }
1610
- }
1611
- if ((record.authority === 'protected-mutate' ||
1612
- record.authority === 'destructive') &&
1613
- Array.isArray(record.approvalPoints) &&
1614
- record.approvalPoints.length === 0) {
1615
- addIssue(issues, '$.approvalPoints', 'must identify an approval point for protected or destructive work');
1616
- }
1617
- if ((record.authority === 'protected-mutate' ||
1618
- record.authority === 'destructive') &&
1619
- Array.isArray(record.invocations) &&
1620
- record.invocations.length > 0) {
1621
- addIssue(issues, '$.invocations', 'must not materialize local argv for protected or destructive work');
1622
- }
1623
- return (0, validation_js_1.validationResult)(value, issues);
1624
- }
1625
- function validateSourceIdentity(value, path, issues) {
1626
- const record = requireRecord(value, path, ['commit', 'worktree'], [], issues);
1627
- if (!record)
1628
- return false;
1629
- requireSafeString(record.commit, `${path}.commit`, issues, {
1630
- maximumLength: 64,
1631
- pattern: COMMIT_PATTERN,
1632
- });
1633
- requireSafeString(record.worktree, `${path}.worktree`, issues, {
1634
- maximumLength: MAX_PATH_LENGTH,
1635
- });
1636
- return true;
1637
- }
1638
- function validateToolIdentity(value, path, issues) {
1639
- const record = requireRecord(value, path, ['contractVersion', 'name', 'version'], [], issues);
1640
- if (!record)
1641
- return false;
1642
- if (record.contractVersion !== model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION) {
1643
- addIssue(issues, `${path}.contractVersion`, `must equal ${model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION}`);
1644
- }
1645
- requireSafeString(record.name, `${path}.name`, issues, {
1646
- pattern: IDENTIFIER_PATTERN,
1647
- });
1648
- requireSafeString(record.version, `${path}.version`, issues);
1649
- return true;
1650
- }
1651
- function validateNormalizedInput(value, path, issues) {
1652
- const record = requireRecord(value, path, ['name', 'value'], [], issues);
1653
- if (!record)
1654
- return false;
1655
- requireSafeString(record.name, `${path}.name`, issues, {
1656
- pattern: FIELD_NAME_PATTERN,
1657
- });
1658
- requireSafeString(record.value, `${path}.value`, issues, {
1659
- maximumLength: MAX_INPUT_VALUE_LENGTH,
1660
- });
1661
- return true;
1662
- }
1663
- function validateOperationIdentity(value, path, issues) {
1664
- const record = requireRecord(value, path, ['name', 'normalizedInputs'], [], issues);
1665
- if (!record)
1666
- return false;
1667
- requireSafeString(record.name, `${path}.name`, issues, {
1668
- pattern: IDENTIFIER_PATTERN,
1669
- });
1670
- const entries = requireArray(record.normalizedInputs, `${path}.normalizedInputs`, issues);
1671
- const names = new Set();
1672
- entries?.forEach((entry, index) => {
1673
- if (validateNormalizedInput(entry, `${path}.normalizedInputs[${index}]`, issues)) {
1674
- const name = entry.name;
1675
- if (names.has(name)) {
1676
- addIssue(issues, `${path}.normalizedInputs[${index}].name`, 'must be unique');
1677
- }
1678
- names.add(name);
1679
- }
1680
- });
1681
- return true;
1682
- }
1683
- function validateAffectedResult(value, path, issues) {
1684
- const record = requireRecord(value, path, ['contracts', 'projects'], [], issues);
1685
- if (!record)
1686
- return false;
1687
- validateContractReferences(record.contracts, `${path}.contracts`, issues);
1688
- validateStringArray(record.projects, `${path}.projects`, issues, {
1689
- pattern: IDENTIFIER_PATTERN,
1690
- });
1691
- return true;
1692
- }
1693
- function validateChangeSet(value, path, issues) {
1694
- const record = requireRecord(value, path, ['externalResources', 'files'], [], issues);
1695
- if (!record)
1696
- return false;
1697
- validateStringArray(record.externalResources, `${path}.externalResources`, issues, { maximumLength: MAX_PATH_LENGTH });
1698
- validateStringArray(record.files, `${path}.files`, issues, {
1699
- maximumLength: MAX_PATH_LENGTH,
1700
- });
1701
- if (Array.isArray(record.files)) {
1702
- record.files.forEach((entry, index) => validateCanonicalWorkspacePath(entry, `${path}.files[${index}]`, issues));
1703
- }
1704
- return true;
1705
- }
1706
- function validateVerificationSummary(value, path, issues) {
1707
- const record = requireRecord(value, path, ['executed', 'omitted'], [], issues);
1708
- if (!record)
1709
- return false;
1710
- validateStringArray(record.executed, `${path}.executed`, issues);
1711
- validateStringArray(record.omitted, `${path}.omitted`, issues);
1712
- if (Array.isArray(record.executed) && Array.isArray(record.omitted)) {
1713
- const executed = new Set(record.executed);
1714
- record.omitted.forEach((entry, index) => {
1715
- if (executed.has(entry)) {
1716
- addIssue(issues, `${path}.omitted[${index}]`, 'must not also be recorded as executed');
1717
- }
1718
- });
1719
- }
1720
- return true;
1721
- }
1722
- function validateTestingEvidenceComposition(value, path, issues) {
1723
- const record = requireRecord(value, path, ['digest', 'reference', 'result', 'schemaVersion'], [], issues);
1724
- if (!record)
1725
- return false;
1726
- requireSafeString(record.digest, `${path}.digest`, issues, {
1727
- maximumLength: 71,
1728
- pattern: SHA256_DIGEST_PATTERN,
1729
- });
1730
- validateCanonicalWorkspacePath(record.reference, `${path}.reference`, issues);
1731
- if (record.schemaVersion !== index_js_1.TESTING_EVIDENCE_RESULT_SCHEMA_VERSION) {
1732
- addIssue(issues, `${path}.schemaVersion`, `must equal consumed Testing/Evidence revision ${index_js_1.TESTING_EVIDENCE_RESULT_SCHEMA_VERSION}`);
1733
- }
1734
- const result = (0, index_js_1.validateTestingEvidenceResult)(record.result);
1735
- if (!result.valid) {
1736
- result.issues.forEach((issue) => addIssue(issues, `${path}.result${issue.path === 'result' ? '' : issue.path.replace(/^result/, '')}`, issue.message));
1737
- }
1738
- return true;
1739
- }
1740
- function validateUnresolvedState(value, path, issues) {
1741
- const record = requireRecord(value, path, ['approvalNeeds', 'assumptions', 'conflicts', 'markers'], [], issues);
1742
- if (!record)
1743
- return false;
1744
- for (const property of [
1745
- 'approvalNeeds',
1746
- 'assumptions',
1747
- 'conflicts',
1748
- 'markers',
1749
- ]) {
1750
- validateStringArray(record[property], `${path}.${property}`, issues, {
1751
- maximumLength: MAX_SUMMARY_LENGTH,
1752
- });
1753
- }
1754
- return true;
1755
- }
1756
- function validateResultCoherence(record, path, issues) {
1757
- const outcome = record.outcome;
1758
- const classification = record.failureClassification;
1759
- const changes = (0, validation_js_1.isRecord)(record.changes) ? record.changes : undefined;
1760
- const cleanup = (0, validation_js_1.isRecord)(record.cleanup) ? record.cleanup : undefined;
1761
- const recovery = (0, validation_js_1.isRecord)(record.recovery) ? record.recovery : undefined;
1762
- const verification = (0, validation_js_1.isRecord)(record.verification)
1763
- ? record.verification
1764
- : undefined;
1765
- if (outcome === 'succeeded' && classification !== undefined) {
1766
- addIssue(issues, `${path}.failureClassification`, 'must be omitted for a succeeded result');
1767
- }
1768
- if ((outcome === 'blocked' || outcome === 'failed') &&
1769
- classification === undefined) {
1770
- addIssue(issues, `${path}.failureClassification`, `is required for a ${outcome} result`);
1771
- }
1772
- if (typeof classification === 'string' &&
1773
- BLOCKING_FAILURES.has(classification) &&
1774
- outcome !== 'blocked') {
1775
- addIssue(issues, `${path}.outcome`, `must be blocked for ${classification}`);
1776
- }
1777
- if (typeof classification === 'string' &&
1778
- FAILED_FAILURES.has(classification) &&
1779
- outcome !== 'failed') {
1780
- addIssue(issues, `${path}.outcome`, `must be failed for ${classification}`);
1781
- }
1782
- if (classification === 'external-proof-pending' && outcome !== 'incomplete') {
1783
- addIssue(issues, `${path}.outcome`, 'must be incomplete while external proof is pending');
1784
- }
1785
- if (classification === 'external-proof-pending' &&
1786
- (!verification ||
1787
- !Array.isArray(verification.omitted) ||
1788
- verification.omitted.length === 0)) {
1789
- addIssue(issues, `${path}.verification.omitted`, 'must identify the pending external proof');
1790
- }
1791
- if (classification === 'cleanup-incomplete' &&
1792
- cleanup?.outcome !== 'incomplete' &&
1793
- recovery?.outcome !== 'incomplete') {
1794
- addIssue(issues, `${path}.cleanup`, 'or recovery must be incomplete for cleanup-incomplete');
1795
- }
1796
- if (outcome === 'succeeded' &&
1797
- (cleanup?.outcome === 'incomplete' || recovery?.outcome === 'incomplete')) {
1798
- addIssue(issues, `${path}.outcome`, 'cannot succeed with incomplete cleanup or recovery');
1799
- }
1800
- if (outcome === 'blocked' &&
1801
- changes &&
1802
- ((Array.isArray(changes.files) && changes.files.length > 0) ||
1803
- (Array.isArray(changes.externalResources) &&
1804
- changes.externalResources.length > 0))) {
1805
- addIssue(issues, `${path}.changes`, 'must be empty when blocked before mutation');
1806
- }
1807
- if (outcome === 'incomplete' &&
1808
- classification === undefined &&
1809
- changes &&
1810
- ((Array.isArray(changes.files) && changes.files.length > 0) ||
1811
- (Array.isArray(changes.externalResources) &&
1812
- changes.externalResources.length > 0))) {
1813
- addIssue(issues, `${path}.failureClassification`, 'is required when incomplete work changed state');
1814
- }
1815
- }
1816
- function validateDeveloperAgentResult(value) {
1817
- const issues = [];
1818
- validateSerializedBound(value, '$', model_js_1.DEVELOPER_AGENT_RESULT_MAX_BYTES, issues);
1819
- const record = requireRecord(value, '$', [
1820
- 'affected',
1821
- 'artifacts',
1822
- 'changes',
1823
- 'cleanup',
1824
- 'kind',
1825
- 'nextSafeAction',
1826
- 'operation',
1827
- 'outcome',
1828
- 'recovery',
1829
- 'schemaVersion',
1830
- 'source',
1831
- 'tool',
1832
- 'unresolved',
1833
- 'verification',
1834
- ], ['failureClassification', 'testingEvidence'], issues);
1835
- if (!record)
1836
- return (0, validation_js_1.validationResult)(value, issues);
1837
- if (record.kind !== model_js_1.DEVELOPER_AGENT_RESULT_KIND) {
1838
- addIssue(issues, '$.kind', `must equal ${model_js_1.DEVELOPER_AGENT_RESULT_KIND}`);
1839
- }
1840
- if (record.schemaVersion !== model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION) {
1841
- addIssue(issues, '$.schemaVersion', `must equal ${model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION}`);
1842
- }
1843
- validateAffectedResult(record.affected, '$.affected', issues);
1844
- validateArtifacts(record.artifacts, '$.artifacts', issues);
1845
- validateChangeSet(record.changes, '$.changes', issues);
1846
- validateCleanupRecovery(record.cleanup, '$.cleanup', issues);
1847
- if (has(record, 'failureClassification')) {
1848
- requireEnum(record.failureClassification, '$.failureClassification', FAILURE_SET, issues);
1849
- }
1850
- validateNextSafeAction(record.nextSafeAction, '$.nextSafeAction', issues);
1851
- validateOperationIdentity(record.operation, '$.operation', issues);
1852
- requireEnum(record.outcome, '$.outcome', RESULT_OUTCOME_SET, issues);
1853
- validateCleanupRecovery(record.recovery, '$.recovery', issues);
1854
- validateSourceIdentity(record.source, '$.source', issues);
1855
- if (has(record, 'testingEvidence')) {
1856
- validateTestingEvidenceComposition(record.testingEvidence, '$.testingEvidence', issues);
1857
- }
1858
- validateToolIdentity(record.tool, '$.tool', issues);
1859
- validateUnresolvedState(record.unresolved, '$.unresolved', issues);
1860
- validateVerificationSummary(record.verification, '$.verification', issues);
1861
- validateResultCoherence(record, '$', issues);
1862
- return (0, validation_js_1.validationResult)(value, issues);
1863
- }
1864
- function validateHandoffWork(value, path, issues) {
1865
- const record = requireRecord(value, path, ['acceptanceCriteriaRevision', 'reference'], [], issues);
1866
- if (!record)
1867
- return false;
1868
- requireSafeString(record.acceptanceCriteriaRevision, `${path}.acceptanceCriteriaRevision`, issues, { maximumLength: MAX_PATH_LENGTH });
1869
- requireSafeString(record.reference, `${path}.reference`, issues, {
1870
- maximumLength: MAX_PATH_LENGTH,
1871
- });
1872
- return true;
1873
- }
1874
- function validateHandoffRepository(value, path, issues) {
1875
- const record = requireRecord(value, path, ['baseCommit', 'baseRef', 'branch', 'headCommit', 'identity', 'worktree'], [], issues);
1876
- if (!record)
1877
- return false;
1878
- for (const property of ['baseCommit', 'headCommit']) {
1879
- requireSafeString(record[property], `${path}.${property}`, issues, {
1880
- maximumLength: 64,
1881
- pattern: COMMIT_PATTERN,
1882
- });
1883
- }
1884
- requireSafeString(record.baseRef, `${path}.baseRef`, issues, {
1885
- maximumLength: MAX_PATH_LENGTH,
1886
- });
1887
- requireSafeString(record.branch, `${path}.branch`, issues, {
1888
- maximumLength: MAX_PATH_LENGTH,
1889
- });
1890
- requireSafeString(record.identity, `${path}.identity`, issues, {
1891
- pattern: IDENTIFIER_PATTERN,
1892
- });
1893
- requireSafeString(record.worktree, `${path}.worktree`, issues, {
1894
- maximumLength: MAX_PATH_LENGTH,
1895
- });
1896
- return true;
1897
- }
1898
- function validateHandoffVersions(value, path, issues) {
1899
- const record = requireRecord(value, path, [
1900
- 'blueprintVersions',
1901
- 'canonicalStage',
1902
- 'effectivePolicyDigest',
1903
- 'frameworkVersion',
1904
- 'policyReferences',
1905
- ], ['candidateEvidenceReference'], issues);
1906
- if (!record)
1907
- return false;
1908
- validateVersionRecords(record.blueprintVersions, `${path}.blueprintVersions`, issues);
1909
- requireEnum(record.canonicalStage, `${path}.canonicalStage`, CANONICAL_STAGE_SET, issues);
1910
- requireSafeString(record.effectivePolicyDigest, `${path}.effectivePolicyDigest`, issues, {
1911
- maximumLength: 71,
1912
- pattern: SHA256_DIGEST_PATTERN,
1913
- });
1914
- requireSafeString(record.frameworkVersion, `${path}.frameworkVersion`, issues);
1915
- validateStringArray(record.policyReferences, `${path}.policyReferences`, issues, { maximumLength: MAX_PATH_LENGTH });
1916
- if (has(record, 'candidateEvidenceReference')) {
1917
- validateCandidateProvenance(record.candidateEvidenceReference, `${path}.candidateEvidenceReference`, issues);
1918
- if (!(0, validation_js_1.isRecord)(record.candidateEvidenceReference) ||
1919
- typeof record.candidateEvidenceReference.digest !== 'string') {
1920
- addIssue(issues, `${path}.candidateEvidenceReference.digest`, 'is required for a resumable candidate reference');
1921
- }
1922
- }
1923
- return true;
1924
- }
1925
- function validateHandoffSelection(value, path, issues) {
1926
- const record = requireRecord(value, path, ['affectedTargets', 'projects'], ['feature', 'slice'], issues);
1927
- if (!record)
1928
- return false;
1929
- validateStringArray(record.affectedTargets, `${path}.affectedTargets`, issues, { pattern: IDENTIFIER_PATTERN });
1930
- validateStringArray(record.projects, `${path}.projects`, issues, {
1931
- pattern: IDENTIFIER_PATTERN,
1932
- });
1933
- if (has(record, 'slice')) {
1934
- requireSafeString(record.slice, `${path}.slice`, issues, {
1935
- pattern: IDENTIFIER_PATTERN,
1936
- });
1937
- }
1938
- if (has(record, 'feature')) {
1939
- requireSafeString(record.feature, `${path}.feature`, issues, {
1940
- pattern: IDENTIFIER_PATTERN,
1941
- });
1942
- if (!has(record, 'slice')) {
1943
- addIssue(issues, `${path}.feature`, 'requires a selected Slice');
1944
- }
1945
- }
1946
- if (typeof record.slice === 'string' &&
1947
- Array.isArray(record.projects) &&
1948
- !record.projects.includes(record.slice)) {
1949
- addIssue(issues, `${path}.slice`, 'must be included in the selected projects');
1950
- }
1951
- return true;
1952
- }
1953
- function validateHandoffOperation(value, path, issues) {
1954
- const record = requireRecord(value, path, ['authority', 'id', 'owner', 'scope'], ['generatorInput'], issues);
1955
- if (!record)
1956
- return false;
1957
- requireEnum(record.authority, `${path}.authority`, AUTHORITY_SET, issues);
1958
- requireSafeString(record.id, `${path}.id`, issues, {
1959
- maximumLength: MAX_IDENTIFIER_LENGTH,
1960
- pattern: IDENTIFIER_PATTERN,
1961
- });
1962
- requireEnum(record.owner, `${path}.owner`, OPERATION_OWNER_SET, issues);
1963
- if (record.owner === 'nx-generator') {
1964
- if (!has(record, 'generatorInput')) {
1965
- addIssue(issues, `${path}.generatorInput`, 'is required to rebind a completed typed generator scope');
1966
- }
1967
- else if (validateGeneratorInput(record.generatorInput, `${path}.generatorInput`, issues) &&
1968
- (0, validation_js_1.isRecord)(record.generatorInput) &&
1969
- typeof record.generatorInput.generator === 'string' &&
1970
- typeof record.id === 'string') {
1971
- const previewId = `generator:${record.generatorInput.generator}:preview`;
1972
- const applyId = `generator:${record.generatorInput.generator}:apply`;
1973
- if (record.id !== previewId && record.id !== applyId) {
1974
- addIssue(issues, `${path}.generatorInput.generator`, 'must exactly match the retained generator operation id');
1975
- }
1976
- if (record.generatorInput.generator === 'upgrade') {
1977
- const hasPreview = has(record.generatorInput, 'preview');
1978
- if (record.id === previewId && hasPreview) {
1979
- addIssue(issues, `${path}.generatorInput.preview`, 'must be absent for a completed Upgrade preview operation');
1980
- }
1981
- if (record.id === applyId && !hasPreview) {
1982
- addIssue(issues, `${path}.generatorInput.preview`, 'is required to bind a completed Upgrade apply operation');
1983
- }
1984
- }
1985
- }
1986
- }
1987
- else if (has(record, 'generatorInput')) {
1988
- addIssue(issues, `${path}.generatorInput`, 'is valid only for a typed Nx generator operation');
1989
- }
1990
- const scope = requireRecord(record.scope, `${path}.scope`, ['contracts', 'evidenceClasses', 'projects', 'requiredVerification'], [], issues);
1991
- if (scope) {
1992
- validateContractReferences(scope.contracts, `${path}.scope.contracts`, issues);
1993
- validateStringArray(scope.evidenceClasses, `${path}.scope.evidenceClasses`, issues);
1994
- validateStringArray(scope.projects, `${path}.scope.projects`, issues, {
1995
- pattern: IDENTIFIER_PATTERN,
1996
- });
1997
- validateStringArray(scope.requiredVerification, `${path}.scope.requiredVerification`, issues);
1998
- }
1999
- return true;
2000
- }
2001
- function validateHandoffMarkerSnapshot(value, path, issues) {
2002
- const record = requireRecord(value, path, ['blocking', 'reference'], [], issues);
2003
- if (!record)
2004
- return false;
2005
- requireBoolean(record.blocking, `${path}.blocking`, issues);
2006
- requireSafeString(record.reference, `${path}.reference`, issues, {
2007
- maximumLength: MAX_PATH_LENGTH,
2008
- });
2009
- return true;
2010
- }
2011
- function validateExternalState(value, path, issues) {
2012
- const record = requireRecord(value, path, ['cleanupOperationId', 'cleanupOwner', 'reference'], [], issues);
2013
- if (!record)
2014
- return false;
2015
- requireSafeString(record.cleanupOperationId, `${path}.cleanupOperationId`, issues, {
2016
- maximumLength: MAX_IDENTIFIER_LENGTH,
2017
- pattern: IDENTIFIER_PATTERN,
2018
- });
2019
- requireEnum(record.cleanupOwner, `${path}.cleanupOwner`, OPERATION_OWNER_SET, issues);
2020
- requireSafeString(record.reference, `${path}.reference`, issues, {
2021
- maximumLength: MAX_PATH_LENGTH,
2022
- });
2023
- return true;
2024
- }
2025
- function nestedResultIssues(value, path, issues) {
2026
- const result = validateDeveloperAgentResult(value);
2027
- if (result.valid)
2028
- return true;
2029
- result.issues.forEach((issue) => {
2030
- addIssue(issues, issue.path === '$' ? path : `${path}${issue.path.replace(/^\$/, '')}`, issue.message);
2031
- });
2032
- return false;
2033
- }
2034
- function validateHandoffCoherence(record, issues) {
2035
- const state = record.state;
2036
- const results = Array.isArray(record.results)
2037
- ? record.results.filter(validation_js_1.isRecord)
2038
- : [];
2039
- const changedFiles = Array.isArray(record.changedFiles)
2040
- ? record.changedFiles
2041
- : [];
2042
- const changedContracts = Array.isArray(record.changedContracts)
2043
- ? record.changedContracts
2044
- : [];
2045
- const externalState = Array.isArray(record.externalState)
2046
- ? record.externalState
2047
- : [];
2048
- const pending = Array.isArray(record.requiredVerificationPending)
2049
- ? record.requiredVerificationPending
2050
- : [];
2051
- const requiredVerification = Array.isArray(record.requiredVerification)
2052
- ? record.requiredVerification
2053
- : [];
2054
- const requiredEvidence = Array.isArray(record.requiredEvidence)
2055
- ? record.requiredEvidence
2056
- : [];
2057
- const requiredEvidencePending = Array.isArray(record.requiredEvidencePending)
2058
- ? record.requiredEvidencePending
2059
- : [];
2060
- const markerSnapshot = Array.isArray(record.markerSnapshot)
2061
- ? record.markerSnapshot.filter(validation_js_1.isRecord)
2062
- : [];
2063
- const operations = Array.isArray(record.operations)
2064
- ? record.operations.filter(validation_js_1.isRecord)
2065
- : [];
2066
- const cleanup = (0, validation_js_1.isRecord)(record.cleanup) ? record.cleanup : undefined;
2067
- const recovery = (0, validation_js_1.isRecord)(record.recovery) ? record.recovery : undefined;
2068
- const unresolved = (0, validation_js_1.isRecord)(record.unresolved)
2069
- ? record.unresolved
2070
- : undefined;
2071
- const repository = (0, validation_js_1.isRecord)(record.repository)
2072
- ? record.repository
2073
- : undefined;
2074
- const selection = (0, validation_js_1.isRecord)(record.selection) ? record.selection : undefined;
2075
- const nextSafeAction = (0, validation_js_1.isRecord)(record.nextSafeAction)
2076
- ? record.nextSafeAction
2077
- : undefined;
2078
- if (nextSafeAction && has(nextSafeAction, 'command')) {
2079
- addIssue(issues, '$.nextSafeAction.command', 'handoffs retain an operation identity, never executable argv');
2080
- }
2081
- if (nextSafeAction &&
2082
- (nextSafeAction.owner === 'nx-generator' ||
2083
- (typeof nextSafeAction.operationId === 'string' &&
2084
- nextSafeAction.operationId.startsWith('generator:')))) {
2085
- addIssue(issues, '$.nextSafeAction', 'typed generator operations are not resumable because handoffs retain neither typed inputs nor preview references');
2086
- }
2087
- results.forEach((result, index) => {
2088
- const resultNextSafeAction = (0, validation_js_1.isRecord)(result.nextSafeAction)
2089
- ? result.nextSafeAction
2090
- : undefined;
2091
- if (resultNextSafeAction && has(resultNextSafeAction, 'command')) {
2092
- addIssue(issues, `$.results[${index}].nextSafeAction.command`, 'handoffs retain nested operation identity, never executable argv');
2093
- }
2094
- if (resultNextSafeAction &&
2095
- (resultNextSafeAction.owner === 'nx-generator' ||
2096
- (typeof resultNextSafeAction.operationId === 'string' &&
2097
- resultNextSafeAction.operationId.startsWith('generator:')))) {
2098
- addIssue(issues, `$.results[${index}].nextSafeAction`, 'typed generator operations are not resumable from a retained result');
2099
- }
2100
- const operation = (0, validation_js_1.isRecord)(result.operation) ? result.operation : undefined;
2101
- if (Array.isArray(operation?.normalizedInputs) &&
2102
- operation.normalizedInputs.length > 0) {
2103
- addIssue(issues, `$.results[${index}].operation.normalizedInputs`, 'handoffs must not retain normalized operation inputs');
2104
- }
2105
- });
2106
- if (nextSafeAction &&
2107
- nextSafeAction.authority !== 'read-only' &&
2108
- (!has(nextSafeAction, 'operationId') || !has(nextSafeAction, 'owner'))) {
2109
- addIssue(issues, '$.nextSafeAction', 'an actionable handoff step requires a rebound operationId and owner');
2110
- }
2111
- const sortedUniqueStrings = (values) => [
2112
- ...new Set(values.filter((value) => typeof value === 'string')),
2113
- ].sort();
2114
- const sameStrings = (left, right) => {
2115
- const normalizedLeft = sortedUniqueStrings(left);
2116
- const normalizedRight = sortedUniqueStrings(right);
2117
- return (normalizedLeft.length === normalizedRight.length &&
2118
- normalizedLeft.every((value, index) => value === normalizedRight[index]));
2119
- };
2120
- const contractKey = (value) => (0, validation_js_1.isRecord)(value) &&
2121
- typeof value.class === 'string' &&
2122
- typeof value.reference === 'string'
2123
- ? `${value.class}\u0000${value.reference}`
2124
- : undefined;
2125
- const selectedProjects = Array.isArray(selection?.projects)
2126
- ? selection.projects.filter((value) => typeof value === 'string')
2127
- : [];
2128
- const retainedScopeProjects = sortedUniqueStrings(operations.flatMap((operation) => {
2129
- const scope = (0, validation_js_1.isRecord)(operation.scope) ? operation.scope : undefined;
2130
- return Array.isArray(scope?.projects) ? scope.projects : [];
2131
- }));
2132
- if (operations.length > 0 &&
2133
- !sameStrings(retainedScopeProjects, selectedProjects)) {
2134
- addIssue(issues, '$.selection.projects', 'must equal the exact performed-operation project-scope union');
2135
- }
2136
- const retainedScopeEvidence = sortedUniqueStrings(operations.flatMap((operation) => {
2137
- const scope = (0, validation_js_1.isRecord)(operation.scope) ? operation.scope : undefined;
2138
- return Array.isArray(scope?.evidenceClasses) ? scope.evidenceClasses : [];
2139
- }));
2140
- if (state !== 'proposal-or-research-only' &&
2141
- !sameStrings(retainedScopeEvidence, requiredEvidence)) {
2142
- addIssue(issues, '$.requiredEvidence', 'must equal the exact performed-operation evidence-scope union');
2143
- }
2144
- results.forEach((result, index) => {
2145
- const resultOperation = (0, validation_js_1.isRecord)(result.operation)
2146
- ? result.operation
2147
- : undefined;
2148
- const retained = operations.find((operation) => operation.id === resultOperation?.name);
2149
- const scope = (0, validation_js_1.isRecord)(retained?.scope) ? retained.scope : undefined;
2150
- if (!scope)
2151
- return;
2152
- if (result.outcome === 'blocked')
2153
- return;
2154
- const affected = (0, validation_js_1.isRecord)(result.affected) ? result.affected : undefined;
2155
- const affectedProjects = Array.isArray(affected?.projects)
2156
- ? affected.projects
2157
- : [];
2158
- const affectedContracts = Array.isArray(affected?.contracts)
2159
- ? affected.contracts
2160
- .map(contractKey)
2161
- .filter((value) => value !== undefined)
2162
- : [];
2163
- const scopeContracts = Array.isArray(scope.contracts)
2164
- ? scope.contracts
2165
- .map(contractKey)
2166
- .filter((value) => value !== undefined)
2167
- : [];
2168
- if (!Array.isArray(scope.projects) ||
2169
- !sameStrings(affectedProjects, scope.projects)) {
2170
- addIssue(issues, `$.results[${index}].affected.projects`, 'must equal the exact retained effective-operation project scope');
2171
- }
2172
- if (!sameStrings(affectedContracts, scopeContracts)) {
2173
- addIssue(issues, `$.results[${index}].affected.contracts`, 'must equal the exact retained effective-operation contract scope');
2174
- }
2175
- const verification = (0, validation_js_1.isRecord)(result.verification)
2176
- ? result.verification
2177
- : undefined;
2178
- const resultVerification = [
2179
- ...(Array.isArray(verification?.executed) ? verification.executed : []),
2180
- ...(Array.isArray(verification?.omitted) ? verification.omitted : []),
2181
- ];
2182
- if (!Array.isArray(scope.requiredVerification) ||
2183
- !sameStrings(resultVerification, scope.requiredVerification)) {
2184
- addIssue(issues, `$.results[${index}].verification`, 'must equal the exact retained effective-operation verification scope');
2185
- }
2186
- });
2187
- const executedVerification = sortedUniqueStrings(results.flatMap((result) => {
2188
- const verification = (0, validation_js_1.isRecord)(result.verification)
2189
- ? result.verification
2190
- : undefined;
2191
- return Array.isArray(verification?.executed) ? verification.executed : [];
2192
- }));
2193
- const omittedVerification = sortedUniqueStrings(results.flatMap((result) => {
2194
- const verification = (0, validation_js_1.isRecord)(result.verification)
2195
- ? result.verification
2196
- : undefined;
2197
- return Array.isArray(verification?.omitted) ? verification.omitted : [];
2198
- }));
2199
- if (!sameStrings(requiredVerification, [...executedVerification, ...pending])) {
2200
- addIssue(issues, '$.requiredVerification', 'must equal the exact executed-or-pending verification union');
2201
- }
2202
- if (!sameStrings(omittedVerification, pending)) {
2203
- addIssue(issues, '$.requiredVerificationPending', 'must equal the exact omitted verification union');
2204
- }
2205
- const artifacts = results.flatMap((result) => Array.isArray(result.artifacts) ? result.artifacts.filter(validation_js_1.isRecord) : []);
2206
- const satisfiedEvidence = sortedUniqueStrings(artifacts.map((artifact) => artifact.evidenceClass));
2207
- if (!sameStrings(requiredEvidence, [
2208
- ...satisfiedEvidence,
2209
- ...requiredEvidencePending,
2210
- ])) {
2211
- addIssue(issues, '$.requiredEvidence', 'must equal the exact referenced-or-pending evidence union');
2212
- }
2213
- const protectedEvidenceClasses = new Set([
2214
- 'protected-promotion-proof',
2215
- 'recovery-proof',
2216
- ]);
2217
- const externalEvidencePending = requiredEvidencePending.some((value) => typeof value === 'string' && protectedEvidenceClasses.has(value));
2218
- if (record.externalProofPending !== externalEvidencePending) {
2219
- addIssue(issues, '$.externalProofPending', 'must reflect whether required evidence remains pending');
2220
- }
2221
- for (const evidenceClass of protectedEvidenceClasses) {
2222
- if (satisfiedEvidence.includes(evidenceClass) &&
2223
- artifacts.some((artifact) => artifact.evidenceClass === evidenceClass)) {
2224
- addIssue(issues, '$.results', `${evidenceClass} cannot be marked satisfied until a semantic validator binds repository head, workspace, stage, policy, and candidate identity`);
2225
- }
2226
- }
2227
- const retainedOperationIds = operations.map((operation) => operation.id);
2228
- const resultOperationIds = results.flatMap((result) => {
2229
- const operation = (0, validation_js_1.isRecord)(result.operation) ? result.operation : undefined;
2230
- return typeof operation?.name === 'string' ? [operation.name] : [];
2231
- });
2232
- if (!sameStrings(retainedOperationIds, resultOperationIds)) {
2233
- addIssue(issues, '$.operations', 'must identify exactly the operations represented by retained results');
2234
- }
2235
- results.forEach((result, index) => {
2236
- const affected = (0, validation_js_1.isRecord)(result.affected) ? result.affected : undefined;
2237
- const affectedProjects = Array.isArray(affected?.projects)
2238
- ? affected.projects.filter((value) => typeof value === 'string')
2239
- : [];
2240
- if (affectedProjects.some((project) => !selectedProjects.includes(project))) {
2241
- addIssue(issues, `$.results[${index}].affected.projects`, 'must remain within the exact retained project selection');
2242
- }
2243
- });
2244
- const resultFiles = [
2245
- ...new Set(results.flatMap((result) => {
2246
- const changes = (0, validation_js_1.isRecord)(result.changes) ? result.changes : undefined;
2247
- return Array.isArray(changes?.files)
2248
- ? changes.files.filter((value) => typeof value === 'string')
2249
- : [];
2250
- })),
2251
- ].sort();
2252
- const retainedFiles = changedFiles
2253
- .filter((value) => typeof value === 'string')
2254
- .sort();
2255
- if (resultFiles.length !== retainedFiles.length ||
2256
- resultFiles.some((value, index) => value !== retainedFiles[index])) {
2257
- addIssue(issues, '$.changedFiles', 'must equal the unique file-change union of retained results');
2258
- }
2259
- const resultContracts = [
2260
- ...new Set(results.flatMap((result) => {
2261
- const affected = (0, validation_js_1.isRecord)(result.affected)
2262
- ? result.affected
2263
- : undefined;
2264
- return Array.isArray(affected?.contracts)
2265
- ? affected.contracts
2266
- .map(contractKey)
2267
- .filter((value) => value !== undefined)
2268
- : [];
2269
- })),
2270
- ].sort();
2271
- const retainedContracts = changedContracts
2272
- .map(contractKey)
2273
- .filter((value) => value !== undefined)
2274
- .sort();
2275
- if (resultContracts.length !== retainedContracts.length ||
2276
- resultContracts.some((value, index) => value !== retainedContracts[index])) {
2277
- addIssue(issues, '$.changedContracts', 'must equal the unique contract-change union of retained results');
2278
- }
2279
- const resultExternalResources = sortedUniqueStrings(results.flatMap((result) => {
2280
- const changes = (0, validation_js_1.isRecord)(result.changes) ? result.changes : undefined;
2281
- return Array.isArray(changes?.externalResources)
2282
- ? changes.externalResources
2283
- : [];
2284
- }));
2285
- const retainedExternalResources = externalState.flatMap((entry) => (0, validation_js_1.isRecord)(entry) && typeof entry.reference === 'string'
2286
- ? [entry.reference]
2287
- : []);
2288
- if (!sameStrings(resultExternalResources, retainedExternalResources)) {
2289
- addIssue(issues, '$.externalState', 'must bind every nested external resource to one cleanup owner');
2290
- }
2291
- if (externalState.length > 0 &&
2292
- !externalState.some((entry) => (0, validation_js_1.isRecord)(entry) &&
2293
- entry.cleanupOperationId === nextSafeAction?.operationId &&
2294
- entry.cleanupOwner === nextSafeAction?.owner)) {
2295
- addIssue(issues, '$.nextSafeAction', 'must exactly bind one retained external-state cleanup operation and owner');
2296
- }
2297
- if (unresolved) {
2298
- for (const property of [
2299
- 'approvalNeeds',
2300
- 'assumptions',
2301
- 'conflicts',
2302
- 'markers',
2303
- ]) {
2304
- const nested = results.flatMap((result) => {
2305
- const resultUnresolved = (0, validation_js_1.isRecord)(result.unresolved)
2306
- ? result.unresolved
2307
- : undefined;
2308
- return Array.isArray(resultUnresolved?.[property])
2309
- ? resultUnresolved[property]
2310
- : [];
2311
- });
2312
- const retained = Array.isArray(unresolved[property])
2313
- ? unresolved[property]
2314
- : [];
2315
- if (!sameStrings(nested, retained)) {
2316
- addIssue(issues, `$.unresolved.${property}`, 'must equal the exact nested unresolved-state union');
2317
- }
2318
- }
2319
- }
2320
- if (repository) {
2321
- results.forEach((result, index) => {
2322
- const source = (0, validation_js_1.isRecord)(result.source) ? result.source : undefined;
2323
- if (source?.commit !== repository.headCommit ||
2324
- source?.worktree !== repository.worktree) {
2325
- addIssue(issues, `$.results[${index}].source`, 'must match the retained repository head commit and worktree');
2326
- }
2327
- const testingEvidence = (0, validation_js_1.isRecord)(result.testingEvidence)
2328
- ? result.testingEvidence
2329
- : undefined;
2330
- const testingResult = (0, validation_js_1.isRecord)(testingEvidence?.result)
2331
- ? testingEvidence.result
2332
- : undefined;
2333
- const testingSource = (0, validation_js_1.isRecord)(testingResult?.source)
2334
- ? testingResult.source
2335
- : undefined;
2336
- if (testingSource && testingSource.commit !== repository.headCommit) {
2337
- addIssue(issues, `$.results[${index}].testingEvidence.result.source.commit`, 'must match the retained repository head commit');
2338
- }
2339
- if (testingResult && testingResult.workspace !== repository.identity) {
2340
- addIssue(issues, `$.results[${index}].testingEvidence.result.workspace`, 'must match the retained repository identity');
2341
- }
2342
- const versions = (0, validation_js_1.isRecord)(record.versions) ? record.versions : undefined;
2343
- const affected = (0, validation_js_1.isRecord)(result.affected) ? result.affected : undefined;
2344
- const affectedProjects = Array.isArray(affected?.projects)
2345
- ? affected.projects.filter((value) => typeof value === 'string')
2346
- : [];
2347
- // Generated native producers record the workspace's exact
2348
- // @empire-builder-kit/runtime pin, which the preset keeps equal to the
2349
- // installed @empire-builder-kit/nx version; the package-qualified form
2350
- // stays accepted for hand-composed evidence. Both are exact equality to
2351
- // the retained framework version, so evidence from another candidate is
2352
- // refused.
2353
- if (testingSource &&
2354
- typeof versions?.frameworkVersion === 'string' &&
2355
- testingSource.frameworkCandidate !== versions.frameworkVersion &&
2356
- testingSource.frameworkCandidate !==
2357
- `@empire-builder-kit/nx@${versions.frameworkVersion}`) {
2358
- addIssue(issues, `$.results[${index}].testingEvidence.result.source.frameworkCandidate`, 'must match the retained framework candidate');
2359
- }
2360
- if (testingSource &&
2361
- Array.isArray(testingSource.blueprintCandidates) &&
2362
- Array.isArray(versions?.blueprintVersions)) {
2363
- const affectedProjectSet = new Set(affectedProjects);
2364
- const expectedBlueprints = versions.blueprintVersions.flatMap((entry) => {
2365
- if (!(0, validation_js_1.isRecord)(entry) ||
2366
- typeof entry.name !== 'string' ||
2367
- typeof entry.version !== 'string') {
2368
- return [];
2369
- }
2370
- const separator = entry.name.indexOf(':@');
2371
- const project = separator === -1 ? undefined : entry.name.slice(0, separator);
2372
- if (project && !affectedProjectSet.has(project))
2373
- return [];
2374
- const packageName = separator === -1 ? entry.name : entry.name.slice(separator + 1);
2375
- return [`${packageName}@${entry.version}`];
2376
- });
2377
- if (!sameStrings(testingSource.blueprintCandidates, expectedBlueprints)) {
2378
- addIssue(issues, `$.results[${index}].testingEvidence.result.source.blueprintCandidates`, 'must match the retained Blueprint candidates for affected projects');
2379
- }
2380
- }
2381
- const testingOperation = (0, validation_js_1.isRecord)(testingResult?.operation)
2382
- ? testingResult.operation
2383
- : undefined;
2384
- const testingEnvironment = (0, validation_js_1.isRecord)(testingResult?.environment)
2385
- ? testingResult.environment
2386
- : undefined;
2387
- const testingCleanup = (0, validation_js_1.isRecord)(testingResult?.cleanup)
2388
- ? testingResult.cleanup
2389
- : undefined;
2390
- if (testingResult && testingResult.outcome !== 'passed') {
2391
- addIssue(issues, `$.results[${index}].testingEvidence.result.outcome`, 'must be passed before Testing/Evidence can satisfy a handoff');
2392
- }
2393
- if (testingCleanup &&
2394
- testingCleanup.outcome !== 'passed' &&
2395
- testingCleanup.outcome !== 'not-required') {
2396
- addIssue(issues, `$.results[${index}].testingEvidence.result.cleanup.outcome`, 'must be passed or not-required');
2397
- }
2398
- if (typeof testingOperation?.project === 'string' &&
2399
- (!affectedProjects.includes(testingOperation.project) ||
2400
- (Array.isArray(selection?.projects) &&
2401
- !selection.projects.includes(testingOperation.project)))) {
2402
- addIssue(issues, `$.results[${index}].testingEvidence.result.operation.project`, 'must identify an affected project in the retained selection');
2403
- }
2404
- if (testingResult &&
2405
- (typeof selection?.slice === 'string'
2406
- ? testingResult.slice !== selection.slice
2407
- : has(testingResult, 'slice'))) {
2408
- addIssue(issues, `$.results[${index}].testingEvidence.result.slice`, 'must exactly match the retained Slice selection');
2409
- }
2410
- if (typeof versions?.canonicalStage === 'string' &&
2411
- ((testingEnvironment?.deployed === true &&
2412
- testingEnvironment.stage !== versions.canonicalStage) ||
2413
- (typeof testingEnvironment?.stage === 'string' &&
2414
- testingEnvironment.stage !== versions.canonicalStage))) {
2415
- addIssue(issues, `$.results[${index}].testingEvidence.result.environment.stage`, 'must be present for deployed proof and exactly match the retained canonical stage');
2416
- }
2417
- // Registered target operations scope requiredVerification by proof
2418
- // class (for example local-integration), so their own native evidence is
2419
- // bound by operation identity instead; proofLayer stays bound to the
2420
- // retained required evidence below. Source-edit results keep the
2421
- // project:target verification vocabulary.
2422
- const resultOperation = (0, validation_js_1.isRecord)(result.operation)
2423
- ? result.operation
2424
- : undefined;
2425
- const evidenceIsOwnOperation = typeof testingOperation?.project === 'string' &&
2426
- typeof testingOperation.target === 'string' &&
2427
- resultOperation?.name ===
2428
- `target:${testingOperation.project}:${testingOperation.target}`;
2429
- if (typeof testingOperation?.target === 'string' &&
2430
- !evidenceIsOwnOperation &&
2431
- !requiredVerification.some((value) => typeof value === 'string' &&
2432
- (value === testingOperation.target ||
2433
- value.endsWith(`:${testingOperation.target}`)))) {
2434
- addIssue(issues, `$.results[${index}].testingEvidence.result.operation.target`, 'must be accounted for by retained required verification');
2435
- }
2436
- // An own registered target's proof class is bound to that operation's
2437
- // retained evidence scope, never to a class another operation
2438
- // contributes to the handoff-wide union. Resume separately requires the
2439
- // retained scope to equal the current registry scope.
2440
- const ownRetainedOperation = evidenceIsOwnOperation
2441
- ? operations.find((operation) => operation.id === resultOperation?.name)
2442
- : undefined;
2443
- const ownRetainedScope = (0, validation_js_1.isRecord)(ownRetainedOperation?.scope)
2444
- ? ownRetainedOperation.scope
2445
- : undefined;
2446
- const proofLayerScope = evidenceIsOwnOperation
2447
- ? Array.isArray(ownRetainedScope?.evidenceClasses)
2448
- ? ownRetainedScope.evidenceClasses
2449
- : []
2450
- : requiredEvidence;
2451
- if (typeof testingOperation?.proofLayer === 'string' &&
2452
- (!requiredEvidence.includes(testingOperation.proofLayer) ||
2453
- !proofLayerScope.includes(testingOperation.proofLayer))) {
2454
- addIssue(issues, `$.results[${index}].testingEvidence.result.operation.proofLayer`, evidenceIsOwnOperation
2455
- ? 'must be accounted for by the retained evidence scope of its own operation'
2456
- : 'must be accounted for by retained required evidence');
2457
- }
2458
- if (testingEvidence && testingResult) {
2459
- const outerArtifacts = Array.isArray(result.artifacts)
2460
- ? result.artifacts.filter(validation_js_1.isRecord)
2461
- : [];
2462
- if (!outerArtifacts.some((artifact) => artifact.reference === testingEvidence.reference &&
2463
- artifact.digest === testingEvidence.digest &&
2464
- artifact.evidenceClass === testingOperation?.proofLayer)) {
2465
- addIssue(issues, `$.results[${index}].testingEvidence`, 'must have an exact outer artifact reference, digest, and evidence-class identity');
2466
- }
2467
- const nestedArtifacts = Array.isArray(testingResult.artifacts)
2468
- ? testingResult.artifacts.filter(validation_js_1.isRecord)
2469
- : [];
2470
- nestedArtifacts.forEach((artifact, artifactIndex) => {
2471
- if (!outerArtifacts.some((outer) => outer.name === artifact.name &&
2472
- outer.digest === artifact.digest)) {
2473
- addIssue(issues, `$.results[${index}].testingEvidence.result.artifacts[${artifactIndex}]`, 'must match an exact outer artifact name and digest');
2474
- }
2475
- });
2476
- }
2477
- });
2478
- }
2479
- if (resultExternalResources.length > 0 &&
2480
- cleanup?.outcome === 'not-required') {
2481
- addIssue(issues, '$.cleanup.outcome', 'cannot be not-required when external state was created');
2482
- }
2483
- if (state === 'implemented-and-verified') {
2484
- if (markerSnapshot.some((marker) => marker.blocking === true)) {
2485
- addIssue(issues, '$.markerSnapshot', 'cannot retain a blocking repository marker when verified');
2486
- }
2487
- if (results.length === 0 ||
2488
- results.some((result) => result.outcome !== 'succeeded')) {
2489
- addIssue(issues, '$.results', 'must contain only succeeded results when implemented and verified');
2490
- }
2491
- if (results.some((result) => !(0, validation_js_1.isRecord)(result.testingEvidence))) {
2492
- addIssue(issues, '$.results', 'implemented work must retain ingested Testing/Evidence results');
2493
- }
2494
- if (results.some((result) => !(0, validation_js_1.isRecord)(result.verification) ||
2495
- !Array.isArray(result.verification.executed) ||
2496
- result.verification.executed.length === 0)) {
2497
- addIssue(issues, '$.results', 'must retain executed verification for implemented work');
2498
- }
2499
- if (pending.length > 0 || record.externalProofPending !== false) {
2500
- addIssue(issues, '$.state', 'cannot claim verified completion while proof is pending');
2501
- }
2502
- if (cleanup?.outcome === 'incomplete' ||
2503
- recovery?.outcome === 'incomplete' ||
2504
- results.some((result) => (0, validation_js_1.isRecord)(result.cleanup) && result.cleanup.outcome === 'incomplete') ||
2505
- results.some((result) => (0, validation_js_1.isRecord)(result.recovery) && result.recovery.outcome === 'incomplete') ||
2506
- results.some((result) => (0, validation_js_1.isRecord)(result.verification) &&
2507
- Array.isArray(result.verification.omitted) &&
2508
- result.verification.omitted.length > 0)) {
2509
- addIssue(issues, '$.state', 'cannot claim verified completion with omitted proof or incomplete cleanup/recovery');
2510
- }
2511
- if (unresolved &&
2512
- ['approvalNeeds', 'assumptions', 'conflicts', 'markers'].some((property) => Array.isArray(unresolved[property]) &&
2513
- unresolved[property].length > 0)) {
2514
- addIssue(issues, '$.unresolved', 'cannot retain unresolved approval, assumption, conflict, or marker state when verified');
2515
- }
2516
- }
2517
- if (state === 'implemented-external-proof-pending') {
2518
- if (record.externalProofPending !== true ||
2519
- requiredEvidencePending.length === 0) {
2520
- addIssue(issues, '$.requiredEvidencePending', 'must identify required external evidence');
2521
- }
2522
- if (results.length === 0 ||
2523
- !results.some((result) => result.outcome === 'incomplete' &&
2524
- result.failureClassification === 'external-proof-pending')) {
2525
- addIssue(issues, '$.results', 'must include an external-proof-pending incomplete result');
2526
- }
2527
- if (results.some((result) => !(0, validation_js_1.isRecord)(result.testingEvidence))) {
2528
- addIssue(issues, '$.results', 'implemented work must retain ingested Testing/Evidence results');
2529
- }
2530
- if (results.some((result) => result.outcome !== 'succeeded' &&
2531
- !(result.outcome === 'incomplete' &&
2532
- result.failureClassification === 'external-proof-pending'))) {
2533
- addIssue(issues, '$.results', 'may contain only succeeded or external-proof-pending results');
2534
- }
2535
- if (cleanup?.outcome === 'incomplete' ||
2536
- recovery?.outcome === 'incomplete' ||
2537
- results.some((result) => ((0, validation_js_1.isRecord)(result.cleanup) &&
2538
- result.cleanup.outcome === 'incomplete') ||
2539
- ((0, validation_js_1.isRecord)(result.recovery) &&
2540
- result.recovery.outcome === 'incomplete'))) {
2541
- addIssue(issues, '$.state', 'external-proof-pending cannot hide incomplete cleanup or recovery');
2542
- }
2543
- }
2544
- if (state === 'blocked-before-mutation') {
2545
- if (results.length === 0 ||
2546
- results.some((result) => result.outcome !== 'blocked')) {
2547
- addIssue(issues, '$.results', 'must contain only blocked results when blocked before mutation');
2548
- }
2549
- if (changedContracts.length > 0 ||
2550
- changedFiles.length > 0 ||
2551
- externalState.length > 0) {
2552
- addIssue(issues, '$.state', 'blocked-before-mutation cannot report changed or external state');
2553
- }
2554
- }
2555
- if (state === 'failed-recovery-complete') {
2556
- if (!results.some((result) => result.outcome === 'failed') ||
2557
- recovery?.outcome !== 'complete' ||
2558
- cleanup?.outcome === 'incomplete') {
2559
- addIssue(issues, '$.state', 'requires a failed result, complete recovery, and no incomplete cleanup');
2560
- }
2561
- if (results.some((result) => ((0, validation_js_1.isRecord)(result.cleanup) &&
2562
- result.cleanup.outcome === 'incomplete') ||
2563
- ((0, validation_js_1.isRecord)(result.recovery) &&
2564
- result.recovery.outcome === 'incomplete'))) {
2565
- addIssue(issues, '$.results', 'cannot retain incomplete nested cleanup or recovery');
2566
- }
2567
- }
2568
- if (state === 'failed-recovery-or-cleanup-required') {
2569
- if (!results.some((result) => result.outcome === 'failed') ||
2570
- (recovery?.outcome !== 'incomplete' && cleanup?.outcome !== 'incomplete')) {
2571
- addIssue(issues, '$.state', 'requires a failed result and incomplete recovery or cleanup');
2572
- }
2573
- }
2574
- if (state === 'proposal-or-research-only') {
2575
- if (changedContracts.length > 0 ||
2576
- changedFiles.length > 0 ||
2577
- externalState.length > 0 ||
2578
- results.some((result) => Array.isArray(result.changes) ||
2579
- ((0, validation_js_1.isRecord)(result.changes) &&
2580
- ((Array.isArray(result.changes.files) &&
2581
- result.changes.files.length > 0) ||
2582
- (Array.isArray(result.changes.externalResources) &&
2583
- result.changes.externalResources.length > 0))))) {
2584
- addIssue(issues, '$.state', 'proposal or research handoff cannot report mutation');
2585
- }
2586
- if (results.some((result) => result.outcome !== 'incomplete' && result.outcome !== 'blocked')) {
2587
- addIssue(issues, '$.results', 'proposal or research results must be incomplete or blocked');
2588
- }
2589
- }
2590
- }
2591
- function validateDeveloperAgentHandoff(value) {
2592
- const issues = [];
2593
- validateSerializedBound(value, '$', model_js_1.DEVELOPER_AGENT_HANDOFF_MAX_BYTES, issues);
2594
- const record = requireRecord(value, '$', [
2595
- 'changedContracts',
2596
- 'changedFiles',
2597
- 'cleanup',
2598
- 'externalProofPending',
2599
- 'externalState',
2600
- 'kind',
2601
- 'markerSnapshot',
2602
- 'nextSafeAction',
2603
- 'operations',
2604
- 'recovery',
2605
- 'repository',
2606
- 'requiredEvidence',
2607
- 'requiredEvidencePending',
2608
- 'requiredVerification',
2609
- 'requiredVerificationPending',
2610
- 'results',
2611
- 'schemaVersion',
2612
- 'selection',
2613
- 'state',
2614
- 'unresolved',
2615
- 'versions',
2616
- 'work',
2617
- ], [], issues);
2618
- if (!record)
2619
- return (0, validation_js_1.validationResult)(value, issues);
2620
- if (record.kind !== model_js_1.DEVELOPER_AGENT_HANDOFF_KIND) {
2621
- addIssue(issues, '$.kind', `must equal ${model_js_1.DEVELOPER_AGENT_HANDOFF_KIND}`);
2622
- }
2623
- if (record.schemaVersion !== model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION) {
2624
- addIssue(issues, '$.schemaVersion', `must equal ${model_js_1.DEVELOPER_AGENT_CONTRACT_SCHEMA_VERSION}`);
2625
- }
2626
- validateContractReferences(record.changedContracts, '$.changedContracts', issues);
2627
- validateStringArray(record.changedFiles, '$.changedFiles', issues, {
2628
- maximumLength: MAX_PATH_LENGTH,
2629
- pattern: WORKSPACE_RELATIVE_PATH_PATTERN,
2630
- });
2631
- if (Array.isArray(record.changedFiles)) {
2632
- record.changedFiles.forEach((entry, index) => validateCanonicalWorkspacePath(entry, `$.changedFiles[${index}]`, issues));
2633
- }
2634
- validateCleanupRecovery(record.cleanup, '$.cleanup', issues);
2635
- requireBoolean(record.externalProofPending, '$.externalProofPending', issues);
2636
- const externalState = requireArray(record.externalState, '$.externalState', issues);
2637
- const externalReferences = new Set();
2638
- const externalCleanupOwners = new Set();
2639
- externalState?.forEach((entry, index) => {
2640
- if (validateExternalState(entry, `$.externalState[${index}]`, issues)) {
2641
- const retained = entry;
2642
- if (externalReferences.has(retained.reference)) {
2643
- addIssue(issues, `$.externalState[${index}].reference`, 'must be unique');
2644
- }
2645
- externalReferences.add(retained.reference);
2646
- const cleanupIdentity = `${retained.cleanupOwner}\u0000${retained.cleanupOperationId}`;
2647
- if (externalCleanupOwners.has(cleanupIdentity)) {
2648
- addIssue(issues, `$.externalState[${index}]`, 'must have a unique cleanup operation owner');
2649
- }
2650
- externalCleanupOwners.add(cleanupIdentity);
2651
- }
2652
- });
2653
- const markerSnapshot = requireArray(record.markerSnapshot, '$.markerSnapshot', issues);
2654
- const markerReferences = new Set();
2655
- markerSnapshot?.forEach((entry, index) => {
2656
- if (validateHandoffMarkerSnapshot(entry, `$.markerSnapshot[${index}]`, issues)) {
2657
- const reference = entry
2658
- .reference;
2659
- if (markerReferences.has(reference)) {
2660
- addIssue(issues, `$.markerSnapshot[${index}].reference`, 'must be unique');
2661
- }
2662
- markerReferences.add(reference);
2663
- }
2664
- });
2665
- validateNextSafeAction(record.nextSafeAction, '$.nextSafeAction', issues);
2666
- const operations = requireArray(record.operations, '$.operations', issues);
2667
- const operationIds = new Set();
2668
- operations?.forEach((entry, index) => {
2669
- if (validateHandoffOperation(entry, `$.operations[${index}]`, issues)) {
2670
- const id = entry.id;
2671
- if (operationIds.has(id)) {
2672
- addIssue(issues, `$.operations[${index}].id`, 'must be unique');
2673
- }
2674
- operationIds.add(id);
2675
- }
2676
- });
2677
- validateCleanupRecovery(record.recovery, '$.recovery', issues);
2678
- validateHandoffRepository(record.repository, '$.repository', issues);
2679
- validateStringArray(record.requiredEvidence, '$.requiredEvidence', issues);
2680
- validateStringArray(record.requiredEvidencePending, '$.requiredEvidencePending', issues);
2681
- validateStringArray(record.requiredVerification, '$.requiredVerification', issues);
2682
- validateStringArray(record.requiredVerificationPending, '$.requiredVerificationPending', issues);
2683
- validateHandoffSelection(record.selection, '$.selection', issues);
2684
- const results = requireArray(record.results, '$.results', issues, MAX_RESULTS);
2685
- results?.forEach((entry, index) => nestedResultIssues(entry, `$.results[${index}]`, issues));
2686
- requireEnum(record.state, '$.state', HANDOFF_STATE_SET, issues);
2687
- validateUnresolvedState(record.unresolved, '$.unresolved', issues);
2688
- validateHandoffVersions(record.versions, '$.versions', issues);
2689
- validateHandoffWork(record.work, '$.work', issues);
2690
- validateHandoffCoherence(record, issues);
2691
- return (0, validation_js_1.validationResult)(value, issues);
2692
- }
2693
- function serializeValidated(label, value, validate) {
2694
- const result = validate(value);
2695
- if (!result.valid) {
2696
- throw new DeveloperAgentContractValidationError(label, result.issues);
2697
- }
2698
- return (0, canonical_json_1.canonicalJson)(result.value);
2699
- }
2700
- /** Serializes an emitted context and enforces its transport byte bound. */
2701
- function serializeDeveloperAgentContext(value) {
2702
- return serializeValidated('Developer-Agent context', value, (candidate) => validateDeveloperAgentContext(candidate));
2703
- }
2704
- /** Validates the in-process context for structure only and returns it. */
2705
- function assertDeveloperAgentContextStructure(value) {
2706
- const result = validateDeveloperAgentContext(value, {
2707
- transportBound: false,
2708
- });
2709
- if (!result.valid) {
2710
- throw new DeveloperAgentContractValidationError('Developer-Agent context', result.issues);
2711
- }
2712
- return result.value;
2713
- }
2714
- function serializeDeveloperAgentGeneratorPreview(value) {
2715
- return serializeValidated('Developer-Agent generator preview', value, validateDeveloperAgentGeneratorPreview);
2716
- }
2717
- function serializeDeveloperAgentGeneratorPreviewReceipt(value) {
2718
- return serializeValidated('Developer-Agent generator preview receipt', value, validateDeveloperAgentGeneratorPreviewReceipt);
2719
- }
2720
- function serializeDeveloperAgentPlan(value) {
2721
- return serializeValidated('Developer-Agent plan', value, validateDeveloperAgentPlan);
2722
- }
2723
- function serializeDeveloperAgentResult(value) {
2724
- return serializeValidated('Developer-Agent result', value, validateDeveloperAgentResult);
2725
- }
2726
- function serializeDeveloperAgentHandoff(value) {
2727
- return serializeValidated('Developer-Agent handoff', value, validateDeveloperAgentHandoff);
2728
- }
2729
- //# sourceMappingURL=validation.js.map