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

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