@empire-builder-kit/nx 1.0.0-beta.9 → 1.0.0-rc.2

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 (824) hide show
  1. package/NOTICE +6 -0
  2. package/README.md +113 -3
  3. package/executors.json +30 -0
  4. package/package.json +84 -6
  5. package/src/api-contract/baseline-update.d.ts +82 -0
  6. package/src/api-contract/baseline-update.js +225 -0
  7. package/src/api-contract/baseline-update.js.map +1 -0
  8. package/src/api-contract/compatibility.d.ts +30 -0
  9. package/src/api-contract/compatibility.js +643 -0
  10. package/src/api-contract/compatibility.js.map +1 -0
  11. package/src/api-contract/contract-graph.d.ts +35 -0
  12. package/src/api-contract/contract-graph.js +141 -0
  13. package/src/api-contract/contract-graph.js.map +1 -0
  14. package/src/api-contract/evidence.d.ts +23 -0
  15. package/src/api-contract/evidence.js +87 -0
  16. package/src/api-contract/evidence.js.map +1 -0
  17. package/src/api-contract/index.d.ts +6 -0
  18. package/src/api-contract/index.js +10 -0
  19. package/src/api-contract/index.js.map +1 -0
  20. package/src/api-contract/model.d.ts +144 -0
  21. package/src/api-contract/model.fixtures.d.ts +2 -0
  22. package/src/api-contract/model.fixtures.js +81 -0
  23. package/src/api-contract/model.fixtures.js.map +1 -0
  24. package/src/api-contract/model.js +993 -0
  25. package/src/api-contract/model.js.map +1 -0
  26. package/src/api-contract/rollout.d.ts +32 -0
  27. package/src/api-contract/rollout.js +88 -0
  28. package/src/api-contract/rollout.js.map +1 -0
  29. package/src/authorization/compatibility.d.ts +62 -0
  30. package/src/authorization/compatibility.js +175 -0
  31. package/src/authorization/compatibility.js.map +1 -0
  32. package/src/authorization/index.d.ts +1 -0
  33. package/src/authorization/index.js +5 -0
  34. package/src/authorization/index.js.map +1 -0
  35. package/src/blueprints/execution.d.ts +25 -1
  36. package/src/blueprints/execution.js +246 -83
  37. package/src/blueprints/execution.js.map +1 -1
  38. package/src/blueprints/external-sandbox.d.ts +53 -0
  39. package/src/blueprints/external-sandbox.js +1182 -0
  40. package/src/blueprints/external-sandbox.js.map +1 -0
  41. package/src/blueprints/manifest.d.ts +42 -2
  42. package/src/blueprints/manifest.js +82 -27
  43. package/src/blueprints/manifest.js.map +1 -1
  44. package/src/blueprints/resolver.d.ts +14 -5
  45. package/src/blueprints/resolver.js +228 -68
  46. package/src/blueprints/resolver.js.map +1 -1
  47. package/src/cli/agent-command.d.ts +30 -0
  48. package/src/cli/agent-command.js +204 -0
  49. package/src/cli/agent-command.js.map +1 -0
  50. package/src/cli/agent-runtime.d.ts +25 -0
  51. package/src/cli/agent-runtime.js +488 -0
  52. package/src/cli/agent-runtime.js.map +1 -0
  53. package/src/cli/blueprint-authority.d.ts +9 -0
  54. package/src/cli/blueprint-authority.js +43 -0
  55. package/src/cli/blueprint-authority.js.map +1 -0
  56. package/src/cli/blueprint-command.d.ts +24 -0
  57. package/src/cli/blueprint-command.js +63 -0
  58. package/src/cli/blueprint-command.js.map +1 -0
  59. package/src/cli/bootstrap.d.ts +31 -0
  60. package/src/cli/bootstrap.js +165 -0
  61. package/src/cli/bootstrap.js.map +1 -0
  62. package/src/cli/dev-command.d.ts +92 -0
  63. package/src/cli/dev-command.js +561 -0
  64. package/src/cli/dev-command.js.map +1 -0
  65. package/src/cli/main.d.ts +131 -0
  66. package/src/cli/main.js +1199 -0
  67. package/src/cli/main.js.map +1 -0
  68. package/src/cli/output.d.ts +19 -0
  69. package/src/cli/output.js +51 -0
  70. package/src/cli/output.js.map +1 -0
  71. package/src/cli/personal-secret-runtime.d.ts +81 -0
  72. package/src/cli/personal-secret-runtime.js +567 -0
  73. package/src/cli/personal-secret-runtime.js.map +1 -0
  74. package/src/cli/secret-terminal.d.ts +12 -0
  75. package/src/cli/secret-terminal.js +128 -0
  76. package/src/cli/secret-terminal.js.map +1 -0
  77. package/src/container-images.d.ts +1 -0
  78. package/src/container-images.js +5 -0
  79. package/src/container-images.js.map +1 -0
  80. package/src/data-lifecycle/index.d.ts +3 -0
  81. package/src/data-lifecycle/index.js +7 -0
  82. package/src/data-lifecycle/index.js.map +1 -0
  83. package/src/data-lifecycle/model.d.ts +172 -0
  84. package/src/data-lifecycle/model.fixtures.d.ts +2 -0
  85. package/src/data-lifecycle/model.fixtures.js +244 -0
  86. package/src/data-lifecycle/model.fixtures.js.map +1 -0
  87. package/src/data-lifecycle/model.js +95 -0
  88. package/src/data-lifecycle/model.js.map +1 -0
  89. package/src/data-lifecycle/sensitive-artifacts.d.ts +28 -0
  90. package/src/data-lifecycle/sensitive-artifacts.js +146 -0
  91. package/src/data-lifecycle/sensitive-artifacts.js.map +1 -0
  92. package/src/data-lifecycle/validation.d.ts +32 -0
  93. package/src/data-lifecycle/validation.js +837 -0
  94. package/src/data-lifecycle/validation.js.map +1 -0
  95. package/src/database-retirement/contract.d.ts +68 -0
  96. package/src/database-retirement/contract.js +166 -0
  97. package/src/database-retirement/contract.js.map +1 -0
  98. package/src/database-retirement/index.d.ts +1 -0
  99. package/src/database-retirement/index.js +5 -0
  100. package/src/database-retirement/index.js.map +1 -0
  101. package/src/deterministic-order.d.ts +2 -0
  102. package/src/deterministic-order.js +7 -0
  103. package/src/deterministic-order.js.map +1 -0
  104. package/src/developer-agent/context.d.ts +27 -0
  105. package/src/developer-agent/context.js +497 -0
  106. package/src/developer-agent/context.js.map +1 -0
  107. package/src/developer-agent/generator-planning.d.ts +34 -0
  108. package/src/developer-agent/generator-planning.js +645 -0
  109. package/src/developer-agent/generator-planning.js.map +1 -0
  110. package/src/developer-agent/generator-preview.d.ts +8 -0
  111. package/src/developer-agent/generator-preview.js +650 -0
  112. package/src/developer-agent/generator-preview.js.map +1 -0
  113. package/src/developer-agent/git-inspection.d.ts +108 -0
  114. package/src/developer-agent/git-inspection.js +815 -0
  115. package/src/developer-agent/git-inspection.js.map +1 -0
  116. package/src/developer-agent/handoff.d.ts +43 -0
  117. package/src/developer-agent/handoff.js +698 -0
  118. package/src/developer-agent/handoff.js.map +1 -0
  119. package/src/developer-agent/index.d.ts +10 -0
  120. package/src/developer-agent/index.js +14 -0
  121. package/src/developer-agent/index.js.map +1 -0
  122. package/src/developer-agent/model.d.ts +481 -0
  123. package/src/developer-agent/model.js +143 -0
  124. package/src/developer-agent/model.js.map +1 -0
  125. package/src/developer-agent/operation-registry.d.ts +45 -0
  126. package/src/developer-agent/operation-registry.js +1255 -0
  127. package/src/developer-agent/operation-registry.js.map +1 -0
  128. package/src/developer-agent/ordering.d.ts +9 -0
  129. package/src/developer-agent/ordering.js +15 -0
  130. package/src/developer-agent/ordering.js.map +1 -0
  131. package/src/developer-agent/planning.d.ts +18 -0
  132. package/src/developer-agent/planning.js +447 -0
  133. package/src/developer-agent/planning.js.map +1 -0
  134. package/src/developer-agent/preview-changes.d.ts +26 -0
  135. package/src/developer-agent/preview-changes.js +203 -0
  136. package/src/developer-agent/preview-changes.js.map +1 -0
  137. package/src/developer-agent/preview-source.d.ts +2 -0
  138. package/src/developer-agent/preview-source.js +16 -0
  139. package/src/developer-agent/preview-source.js.map +1 -0
  140. package/src/developer-agent/validation.d.ts +18 -0
  141. package/src/developer-agent/validation.js +2617 -0
  142. package/src/developer-agent/validation.js.map +1 -0
  143. package/src/developer-agent/workspace-inspection.d.ts +20 -0
  144. package/src/developer-agent/workspace-inspection.js +1134 -0
  145. package/src/developer-agent/workspace-inspection.js.map +1 -0
  146. package/src/developer-agent/workspace-path.d.ts +6 -0
  147. package/src/developer-agent/workspace-path.js +22 -0
  148. package/src/developer-agent/workspace-path.js.map +1 -0
  149. package/src/executors/blueprint-trust/blueprint-trust.d.ts +29 -0
  150. package/src/executors/blueprint-trust/blueprint-trust.js +115 -0
  151. package/src/executors/blueprint-trust/blueprint-trust.js.map +1 -0
  152. package/src/executors/blueprint-trust/schema.json +27 -0
  153. package/src/executors/blueprint-verification/blueprint-verification.d.ts +13 -0
  154. package/src/executors/blueprint-verification/blueprint-verification.js +110 -0
  155. package/src/executors/blueprint-verification/blueprint-verification.js.map +1 -0
  156. package/src/executors/blueprint-verification/schema.json +44 -0
  157. package/src/executors/deployment-plan/deployment-plan.js +1 -0
  158. package/src/executors/deployment-plan/deployment-plan.js.map +1 -1
  159. package/src/executors/dev-doctor/dev-doctor.d.ts +19 -5
  160. package/src/executors/dev-doctor/dev-doctor.js +186 -32
  161. package/src/executors/dev-doctor/dev-doctor.js.map +1 -1
  162. package/src/executors/dev-doctor/schema.json +1 -6
  163. package/src/executors/dev-setup/dev-setup.d.ts +7 -1
  164. package/src/executors/dev-setup/dev-setup.js +14 -3
  165. package/src/executors/dev-setup/dev-setup.js.map +1 -1
  166. package/src/executors/developer-context/developer-context.d.ts +38 -0
  167. package/src/executors/developer-context/developer-context.js +78 -0
  168. package/src/executors/developer-context/developer-context.js.map +1 -0
  169. package/src/executors/developer-context/schema.json +87 -0
  170. package/src/executors/fleet/fleet.d.ts +12 -43
  171. package/src/executors/fleet/fleet.js +120 -500
  172. package/src/executors/fleet/fleet.js.map +1 -1
  173. package/src/executors/fleet/schema.json +64 -14
  174. package/src/executors/github-bootstrap/github-bootstrap.d.ts +1 -0
  175. package/src/executors/github-bootstrap/github-bootstrap.js +1 -0
  176. package/src/executors/github-bootstrap/github-bootstrap.js.map +1 -1
  177. package/src/executors/github-bootstrap/schema.json +5 -0
  178. package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +144 -0
  179. package/src/executors/infrastructure-plan/infrastructure-plan.js +3320 -0
  180. package/src/executors/infrastructure-plan/infrastructure-plan.js.map +1 -0
  181. package/src/executors/infrastructure-plan/schema.json +78 -0
  182. package/src/executors/secret-guardrails/schema.json +6 -0
  183. package/src/executors/secret-guardrails/secret-guardrails.d.ts +3 -0
  184. package/src/executors/secret-guardrails/secret-guardrails.js +44 -0
  185. package/src/executors/secret-guardrails/secret-guardrails.js.map +1 -0
  186. package/src/executors/secret-metadata/schema.json +31 -0
  187. package/src/executors/secret-metadata/secret-metadata.d.ts +32 -0
  188. package/src/executors/secret-metadata/secret-metadata.js +131 -0
  189. package/src/executors/secret-metadata/secret-metadata.js.map +1 -0
  190. package/src/executors/sst-lifecycle/logging-preflight.d.ts +17 -0
  191. package/src/executors/sst-lifecycle/logging-preflight.js +196 -0
  192. package/src/executors/sst-lifecycle/logging-preflight.js.map +1 -0
  193. package/src/executors/sst-lifecycle/run-sst-command.d.ts +23 -3
  194. package/src/executors/sst-lifecycle/run-sst-command.js +113 -10
  195. package/src/executors/sst-lifecycle/run-sst-command.js.map +1 -1
  196. package/src/executors/sst-lifecycle/schema.json +9 -5
  197. package/src/executors/sst-lifecycle/secret-preflight.d.ts +25 -0
  198. package/src/executors/sst-lifecycle/secret-preflight.js +119 -0
  199. package/src/executors/sst-lifecycle/secret-preflight.js.map +1 -0
  200. package/src/foundation/discovery.d.ts +17 -1
  201. package/src/foundation/discovery.js +16 -1
  202. package/src/foundation/discovery.js.map +1 -1
  203. package/src/foundation/index.d.ts +3 -0
  204. package/src/foundation/index.js +3 -0
  205. package/src/foundation/index.js.map +1 -1
  206. package/src/foundation/local-database-contract.d.ts +1 -0
  207. package/src/foundation/local-database-contract.js +3 -0
  208. package/src/foundation/local-database-contract.js.map +1 -1
  209. package/src/foundation/logging-preflight.d.ts +30 -0
  210. package/src/foundation/logging-preflight.js +138 -0
  211. package/src/foundation/logging-preflight.js.map +1 -0
  212. package/src/foundation/logging.d.ts +70 -0
  213. package/src/foundation/logging.js +133 -0
  214. package/src/foundation/logging.js.map +1 -0
  215. package/src/foundation/preflight.d.ts +9 -0
  216. package/src/foundation/preflight.js +58 -2
  217. package/src/foundation/preflight.js.map +1 -1
  218. package/src/foundation/provision-database-bindings.d.ts +9 -1
  219. package/src/foundation/provision-database-bindings.js +25 -5
  220. package/src/foundation/provision-database-bindings.js.map +1 -1
  221. package/src/foundation/provision-logical-database.d.ts +10 -2
  222. package/src/foundation/provision-logical-database.js +68 -113
  223. package/src/foundation/provision-logical-database.js.map +1 -1
  224. package/src/foundation/router-origin-proof.d.ts +2 -0
  225. package/src/foundation/router-origin-proof.js +25 -0
  226. package/src/foundation/router-origin-proof.js.map +1 -0
  227. package/src/foundation/stages.d.ts +1 -0
  228. package/src/foundation/stages.js +9 -1
  229. package/src/foundation/stages.js.map +1 -1
  230. package/src/frontend-security/index.d.ts +1 -0
  231. package/src/frontend-security/index.js +5 -0
  232. package/src/frontend-security/index.js.map +1 -0
  233. package/src/frontend-security/security-headers.d.ts +50 -0
  234. package/src/frontend-security/security-headers.js +418 -0
  235. package/src/frontend-security/security-headers.js.map +1 -0
  236. package/src/generators/feature-registry.d.ts +13 -0
  237. package/src/generators/feature-registry.js +73 -0
  238. package/src/generators/feature-registry.js.map +1 -0
  239. package/src/generators/function/function.d.ts +1 -1
  240. package/src/generators/function/function.js +51 -6
  241. package/src/generators/function/function.js.map +1 -1
  242. package/src/generators/function/schema.d.ts +1 -0
  243. package/src/generators/function/schema.json +6 -1
  244. package/src/generators/logging-registry.d.ts +13 -0
  245. package/src/generators/logging-registry.js +62 -0
  246. package/src/generators/logging-registry.js.map +1 -0
  247. package/src/generators/post-generation-install.d.ts +67 -0
  248. package/src/generators/post-generation-install.js +3308 -0
  249. package/src/generators/post-generation-install.js.map +1 -0
  250. package/src/generators/preset/generator.js +3 -0
  251. package/src/generators/preset/generator.js.map +1 -1
  252. package/src/generators/preset/tool-versions.d.ts +18 -0
  253. package/src/generators/preset/tool-versions.js +22 -0
  254. package/src/generators/preset/tool-versions.js.map +1 -0
  255. package/src/generators/preset/workspace-files-developer-agent.d.ts +14 -0
  256. package/src/generators/preset/workspace-files-developer-agent.js +511 -0
  257. package/src/generators/preset/workspace-files-developer-agent.js.map +1 -0
  258. package/src/generators/preset/workspace-files-foundation-workload-roles.d.ts +6 -0
  259. package/src/generators/preset/workspace-files-foundation-workload-roles.js +406 -0
  260. package/src/generators/preset/workspace-files-foundation-workload-roles.js.map +1 -0
  261. package/src/generators/preset/workspace-files-performance-cost.d.ts +66 -0
  262. package/src/generators/preset/workspace-files-performance-cost.js +866 -0
  263. package/src/generators/preset/workspace-files-performance-cost.js.map +1 -0
  264. package/src/generators/preset/workspace-files-performance-load.d.ts +73 -0
  265. package/src/generators/preset/workspace-files-performance-load.js +801 -0
  266. package/src/generators/preset/workspace-files-performance-load.js.map +1 -0
  267. package/src/generators/preset/workspace-files-workload-role-baseline.d.ts +9 -0
  268. package/src/generators/preset/workspace-files-workload-role-baseline.js +1102 -0
  269. package/src/generators/preset/workspace-files-workload-role-baseline.js.map +1 -0
  270. package/src/generators/preset/workspace-files.d.ts +14 -1
  271. package/src/generators/preset/workspace-files.js +8189 -245
  272. package/src/generators/preset/workspace-files.js.map +1 -1
  273. package/src/generators/repository-policy/repository-policy.js +3 -47
  274. package/src/generators/repository-policy/repository-policy.js.map +1 -1
  275. package/src/generators/slice/built-in-plan-api-contract-files.d.ts +2 -0
  276. package/src/generators/slice/built-in-plan-api-contract-files.js +2656 -0
  277. package/src/generators/slice/built-in-plan-api-contract-files.js.map +1 -0
  278. package/src/generators/slice/built-in-plan-api-files.d.ts +2 -0
  279. package/src/generators/slice/built-in-plan-api-files.js +1186 -0
  280. package/src/generators/slice/built-in-plan-api-files.js.map +1 -0
  281. package/src/generators/slice/built-in-plan-async-work-files.d.ts +2 -0
  282. package/src/generators/slice/built-in-plan-async-work-files.js +7903 -0
  283. package/src/generators/slice/built-in-plan-async-work-files.js.map +1 -0
  284. package/src/generators/slice/built-in-plan-authorization-files.d.ts +2 -0
  285. package/src/generators/slice/built-in-plan-authorization-files.js +2314 -0
  286. package/src/generators/slice/built-in-plan-authorization-files.js.map +1 -0
  287. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.d.ts +2 -0
  288. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +559 -0
  289. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js.map +1 -0
  290. package/src/generators/slice/built-in-plan-data-deletion-files.d.ts +2 -0
  291. package/src/generators/slice/built-in-plan-data-deletion-files.js +1101 -0
  292. package/src/generators/slice/built-in-plan-data-deletion-files.js.map +1 -0
  293. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.d.ts +2 -0
  294. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +249 -0
  295. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js.map +1 -0
  296. package/src/generators/slice/built-in-plan-data-files.d.ts +2 -0
  297. package/src/generators/slice/built-in-plan-data-files.js +1530 -0
  298. package/src/generators/slice/built-in-plan-data-files.js.map +1 -0
  299. package/src/generators/slice/built-in-plan-data-lifecycle-files.d.ts +2 -0
  300. package/src/generators/slice/built-in-plan-data-lifecycle-files.js +750 -0
  301. package/src/generators/slice/built-in-plan-data-lifecycle-files.js.map +1 -0
  302. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.d.ts +2 -0
  303. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +828 -0
  304. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js.map +1 -0
  305. package/src/generators/slice/built-in-plan-data-retention-job-files.d.ts +2 -0
  306. package/src/generators/slice/built-in-plan-data-retention-job-files.js +2604 -0
  307. package/src/generators/slice/built-in-plan-data-retention-job-files.js.map +1 -0
  308. package/src/generators/slice/built-in-plan-data-retention-launcher-files.d.ts +2 -0
  309. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +144 -0
  310. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js.map +1 -0
  311. package/src/generators/slice/built-in-plan-data-rights-files.d.ts +2 -0
  312. package/src/generators/slice/built-in-plan-data-rights-files.js +4628 -0
  313. package/src/generators/slice/built-in-plan-data-rights-files.js.map +1 -0
  314. package/src/generators/slice/built-in-plan-database-lifecycle-files.d.ts +2 -0
  315. package/src/generators/slice/built-in-plan-database-lifecycle-files.js +1901 -0
  316. package/src/generators/slice/built-in-plan-database-lifecycle-files.js.map +1 -0
  317. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.d.ts +2 -0
  318. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +485 -0
  319. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js.map +1 -0
  320. package/src/generators/slice/built-in-plan-foundation-files.d.ts +2 -0
  321. package/src/generators/slice/built-in-plan-foundation-files.js +184 -0
  322. package/src/generators/slice/built-in-plan-foundation-files.js.map +1 -0
  323. package/src/generators/slice/built-in-plan-frontend-files.d.ts +2 -0
  324. package/src/generators/slice/built-in-plan-frontend-files.js +2233 -0
  325. package/src/generators/slice/built-in-plan-frontend-files.js.map +1 -0
  326. package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +2 -0
  327. package/src/generators/slice/built-in-plan-infrastructure-files.js +3038 -0
  328. package/src/generators/slice/built-in-plan-infrastructure-files.js.map +1 -0
  329. package/src/generators/slice/built-in-plan-infrastructure-safety-files.d.ts +2 -0
  330. package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +312 -0
  331. package/src/generators/slice/built-in-plan-infrastructure-safety-files.js.map +1 -0
  332. package/src/generators/slice/built-in-plan-metadata-files.d.ts +3 -0
  333. package/src/generators/slice/built-in-plan-metadata-files.js +219 -0
  334. package/src/generators/slice/built-in-plan-metadata-files.js.map +1 -0
  335. package/src/generators/slice/built-in-plan-operations-files.d.ts +2 -0
  336. package/src/generators/slice/built-in-plan-operations-files.js +630 -0
  337. package/src/generators/slice/built-in-plan-operations-files.js.map +1 -0
  338. package/src/generators/slice/built-in-plan-performance-files.d.ts +3 -0
  339. package/src/generators/slice/built-in-plan-performance-files.js +3293 -0
  340. package/src/generators/slice/built-in-plan-performance-files.js.map +1 -0
  341. package/src/generators/slice/built-in-plan-project-files.d.ts +3 -0
  342. package/src/generators/slice/built-in-plan-project-files.js +979 -0
  343. package/src/generators/slice/built-in-plan-project-files.js.map +1 -0
  344. package/src/generators/slice/built-in-plan-release-files.d.ts +2 -0
  345. package/src/generators/slice/built-in-plan-release-files.js +6387 -0
  346. package/src/generators/slice/built-in-plan-release-files.js.map +1 -0
  347. package/src/generators/slice/built-in-plan-reliability-files.d.ts +2 -0
  348. package/src/generators/slice/built-in-plan-reliability-files.js +4499 -0
  349. package/src/generators/slice/built-in-plan-reliability-files.js.map +1 -0
  350. package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +2 -0
  351. package/src/generators/slice/built-in-plan-secret-runtime-files.js +1004 -0
  352. package/src/generators/slice/built-in-plan-secret-runtime-files.js.map +1 -0
  353. package/src/generators/slice/built-in-plan-shared.d.ts +53 -0
  354. package/src/generators/slice/built-in-plan-shared.js +113 -0
  355. package/src/generators/slice/built-in-plan-shared.js.map +1 -0
  356. package/src/generators/slice/built-in-plan-testing-files.d.ts +2 -0
  357. package/src/generators/slice/built-in-plan-testing-files.js +2356 -0
  358. package/src/generators/slice/built-in-plan-testing-files.js.map +1 -0
  359. package/src/generators/slice/built-in-plan-verification-files.d.ts +2 -0
  360. package/src/generators/slice/built-in-plan-verification-files.js +358 -0
  361. package/src/generators/slice/built-in-plan-verification-files.js.map +1 -0
  362. package/src/generators/slice/built-in-plan-web-files.d.ts +2 -0
  363. package/src/generators/slice/built-in-plan-web-files.js +430 -0
  364. package/src/generators/slice/built-in-plan-web-files.js.map +1 -0
  365. package/src/generators/slice/built-in-plan-workload-role-files.d.ts +2 -0
  366. package/src/generators/slice/built-in-plan-workload-role-files.js +2356 -0
  367. package/src/generators/slice/built-in-plan-workload-role-files.js.map +1 -0
  368. package/src/generators/slice/built-in-plan.d.ts +8 -0
  369. package/src/generators/slice/built-in-plan.js +264 -0
  370. package/src/generators/slice/built-in-plan.js.map +1 -0
  371. package/src/generators/slice/schema.json +1 -1
  372. package/src/generators/slice/slice.d.ts +1 -22
  373. package/src/generators/slice/slice.js +185 -1510
  374. package/src/generators/slice/slice.js.map +1 -1
  375. package/src/generators/upgrade/schema.d.ts +2 -0
  376. package/src/generators/upgrade/schema.json +11 -1
  377. package/src/generators/upgrade/upgrade.d.ts +51 -1
  378. package/src/generators/upgrade/upgrade.js +820 -82
  379. package/src/generators/upgrade/upgrade.js.map +1 -1
  380. package/src/generators/workload/frozen-container.d.ts +8 -0
  381. package/src/generators/workload/frozen-container.js +36 -0
  382. package/src/generators/workload/frozen-container.js.map +1 -0
  383. package/src/generators/workload/performance-registration.d.ts +32 -0
  384. package/src/generators/workload/performance-registration.js +226 -0
  385. package/src/generators/workload/performance-registration.js.map +1 -0
  386. package/src/generators/workload/reliability-registration.d.ts +16 -0
  387. package/src/generators/workload/reliability-registration.js +150 -0
  388. package/src/generators/workload/reliability-registration.js.map +1 -0
  389. package/src/generators/workload/schema.d.ts +1 -0
  390. package/src/generators/workload/schema.json +6 -1
  391. package/src/generators/workload/service-performance-files.d.ts +4 -0
  392. package/src/generators/workload/service-performance-files.js +1846 -0
  393. package/src/generators/workload/service-performance-files.js.map +1 -0
  394. package/src/generators/workload/workload.d.ts +3 -2
  395. package/src/generators/workload/workload.js +1083 -18
  396. package/src/generators/workload/workload.js.map +1 -1
  397. package/src/git-policy/action-pins.d.ts +10 -0
  398. package/src/git-policy/action-pins.js +10 -0
  399. package/src/git-policy/action-pins.js.map +1 -1
  400. package/src/git-policy/github-bootstrap.d.ts +14 -1
  401. package/src/git-policy/github-bootstrap.js +274 -46
  402. package/src/git-policy/github-bootstrap.js.map +1 -1
  403. package/src/index.d.ts +2 -0
  404. package/src/index.js +2 -0
  405. package/src/index.js.map +1 -1
  406. package/src/infrastructure-change/convergence.d.ts +13 -0
  407. package/src/infrastructure-change/convergence.js +85 -0
  408. package/src/infrastructure-change/convergence.js.map +1 -0
  409. package/src/infrastructure-change/drift.d.ts +13 -0
  410. package/src/infrastructure-change/drift.js +112 -0
  411. package/src/infrastructure-change/drift.js.map +1 -0
  412. package/src/infrastructure-change/index.d.ts +7 -0
  413. package/src/infrastructure-change/index.js +11 -0
  414. package/src/infrastructure-change/index.js.map +1 -0
  415. package/src/infrastructure-change/model.d.ts +253 -0
  416. package/src/infrastructure-change/model.js +28 -0
  417. package/src/infrastructure-change/model.js.map +1 -0
  418. package/src/infrastructure-change/normalize.d.ts +12 -0
  419. package/src/infrastructure-change/normalize.js +245 -0
  420. package/src/infrastructure-change/normalize.js.map +1 -0
  421. package/src/infrastructure-change/plan.d.ts +40 -0
  422. package/src/infrastructure-change/plan.js +361 -0
  423. package/src/infrastructure-change/plan.js.map +1 -0
  424. package/src/infrastructure-change/risk.d.ts +7 -0
  425. package/src/infrastructure-change/risk.js +269 -0
  426. package/src/infrastructure-change/risk.js.map +1 -0
  427. package/src/infrastructure-change/summary.d.ts +20 -0
  428. package/src/infrastructure-change/summary.js +130 -0
  429. package/src/infrastructure-change/summary.js.map +1 -0
  430. package/src/local-dev/context-discovery.d.ts +2 -0
  431. package/src/local-dev/context-discovery.js +59 -0
  432. package/src/local-dev/context-discovery.js.map +1 -0
  433. package/src/local-dev/contract-validation.d.ts +15 -0
  434. package/src/local-dev/contract-validation.js +84 -0
  435. package/src/local-dev/contract-validation.js.map +1 -0
  436. package/src/local-dev/contracts.d.ts +10 -1
  437. package/src/local-dev/contracts.js +57 -5
  438. package/src/local-dev/contracts.js.map +1 -1
  439. package/src/local-dev/control-contract.d.ts +67 -0
  440. package/src/local-dev/control-contract.js +180 -0
  441. package/src/local-dev/control-contract.js.map +1 -0
  442. package/src/local-dev/dev-command-core.d.ts +60 -0
  443. package/src/local-dev/dev-command-core.js +89 -0
  444. package/src/local-dev/dev-command-core.js.map +1 -0
  445. package/src/local-dev/effects.d.ts +16 -0
  446. package/src/local-dev/effects.js +63 -0
  447. package/src/local-dev/effects.js.map +1 -0
  448. package/src/local-dev/environment-inspector.d.ts +125 -0
  449. package/src/local-dev/environment-inspector.js +687 -0
  450. package/src/local-dev/environment-inspector.js.map +1 -0
  451. package/src/local-dev/environment-state.d.ts +113 -0
  452. package/src/local-dev/environment-state.js +463 -0
  453. package/src/local-dev/environment-state.js.map +1 -0
  454. package/src/local-dev/errors.d.ts +6 -0
  455. package/src/local-dev/errors.js +41 -0
  456. package/src/local-dev/errors.js.map +1 -0
  457. package/src/local-dev/fleet-client.d.ts +33 -0
  458. package/src/local-dev/fleet-client.js +156 -0
  459. package/src/local-dev/fleet-client.js.map +1 -0
  460. package/src/local-dev/fleet-configuration.d.ts +13 -0
  461. package/src/local-dev/fleet-configuration.js +71 -0
  462. package/src/local-dev/fleet-configuration.js.map +1 -0
  463. package/src/local-dev/fleet-inventory.d.ts +56 -0
  464. package/src/local-dev/fleet-inventory.js +469 -0
  465. package/src/local-dev/fleet-inventory.js.map +1 -0
  466. package/src/local-dev/fleet-ipc.d.ts +28 -0
  467. package/src/local-dev/fleet-ipc.js +267 -0
  468. package/src/local-dev/fleet-ipc.js.map +1 -0
  469. package/src/local-dev/fleet-launcher.d.ts +53 -0
  470. package/src/local-dev/fleet-launcher.js +379 -0
  471. package/src/local-dev/fleet-launcher.js.map +1 -0
  472. package/src/local-dev/fleet-lock.d.ts +41 -0
  473. package/src/local-dev/fleet-lock.js +135 -0
  474. package/src/local-dev/fleet-lock.js.map +1 -0
  475. package/src/local-dev/fleet-logs.d.ts +66 -0
  476. package/src/local-dev/fleet-logs.js +542 -0
  477. package/src/local-dev/fleet-logs.js.map +1 -0
  478. package/src/local-dev/fleet-process.d.ts +50 -0
  479. package/src/local-dev/fleet-process.js +289 -0
  480. package/src/local-dev/fleet-process.js.map +1 -0
  481. package/src/local-dev/fleet-runtime.d.ts +22 -0
  482. package/src/local-dev/fleet-runtime.js +368 -0
  483. package/src/local-dev/fleet-runtime.js.map +1 -0
  484. package/src/local-dev/fleet-session.d.ts +70 -0
  485. package/src/local-dev/fleet-session.js +301 -0
  486. package/src/local-dev/fleet-session.js.map +1 -0
  487. package/src/local-dev/fleet-slice-runner-daemon.d.ts +1 -0
  488. package/src/local-dev/fleet-slice-runner-daemon.js +21 -0
  489. package/src/local-dev/fleet-slice-runner-daemon.js.map +1 -0
  490. package/src/local-dev/fleet-startup.d.ts +22 -0
  491. package/src/local-dev/fleet-startup.js +114 -0
  492. package/src/local-dev/fleet-startup.js.map +1 -0
  493. package/src/local-dev/fleet-state.d.ts +62 -0
  494. package/src/local-dev/fleet-state.js +297 -0
  495. package/src/local-dev/fleet-state.js.map +1 -0
  496. package/src/local-dev/fleet-supervisor-daemon.d.ts +1 -0
  497. package/src/local-dev/fleet-supervisor-daemon.js +41 -0
  498. package/src/local-dev/fleet-supervisor-daemon.js.map +1 -0
  499. package/src/local-dev/fleet-supervisor.d.ts +52 -0
  500. package/src/local-dev/fleet-supervisor.js +384 -0
  501. package/src/local-dev/fleet-supervisor.js.map +1 -0
  502. package/src/local-dev/gateway.js +1 -1
  503. package/src/local-dev/gateway.js.map +1 -1
  504. package/src/local-dev/identity.js +4 -6
  505. package/src/local-dev/identity.js.map +1 -1
  506. package/src/local-dev/index.d.ts +1 -0
  507. package/src/local-dev/index.js +1 -0
  508. package/src/local-dev/index.js.map +1 -1
  509. package/src/local-dev/local-context.d.ts +62 -0
  510. package/src/local-dev/local-context.js +299 -0
  511. package/src/local-dev/local-context.js.map +1 -0
  512. package/src/local-dev/nx-workspace.d.ts +45 -0
  513. package/src/local-dev/nx-workspace.js +228 -0
  514. package/src/local-dev/nx-workspace.js.map +1 -0
  515. package/src/local-dev/personal-secret-ledger.d.ts +75 -0
  516. package/src/local-dev/personal-secret-ledger.js +391 -0
  517. package/src/local-dev/personal-secret-ledger.js.map +1 -0
  518. package/src/local-dev/personal-stage.d.ts +18 -0
  519. package/src/local-dev/personal-stage.js +129 -0
  520. package/src/local-dev/personal-stage.js.map +1 -0
  521. package/src/local-dev/private-state.d.ts +17 -0
  522. package/src/local-dev/private-state.js +254 -0
  523. package/src/local-dev/private-state.js.map +1 -0
  524. package/src/local-dev/process-identity.d.ts +9 -0
  525. package/src/local-dev/process-identity.js +79 -0
  526. package/src/local-dev/process-identity.js.map +1 -0
  527. package/src/local-dev/runtime-paths.d.ts +17 -0
  528. package/src/local-dev/runtime-paths.js +33 -0
  529. package/src/local-dev/runtime-paths.js.map +1 -0
  530. package/src/local-dev/secret-slice-claim.d.ts +17 -0
  531. package/src/local-dev/secret-slice-claim.js +75 -0
  532. package/src/local-dev/secret-slice-claim.js.map +1 -0
  533. package/src/local-dev/slice-claim.d.ts +36 -0
  534. package/src/local-dev/slice-claim.js +199 -0
  535. package/src/local-dev/slice-claim.js.map +1 -0
  536. package/src/local-dev/slice-runner.d.ts +121 -0
  537. package/src/local-dev/slice-runner.js +715 -0
  538. package/src/local-dev/slice-runner.js.map +1 -0
  539. package/src/local-dev/tls.js +51 -17
  540. package/src/local-dev/tls.js.map +1 -1
  541. package/src/ownership/composition.d.ts +5 -2
  542. package/src/ownership/composition.js +26 -3
  543. package/src/ownership/composition.js.map +1 -1
  544. package/src/ownership/hash.d.ts +1 -1
  545. package/src/ownership/hash.js +3 -1
  546. package/src/ownership/hash.js.map +1 -1
  547. package/src/ownership/record.d.ts +32 -1
  548. package/src/ownership/record.js +139 -2
  549. package/src/ownership/record.js.map +1 -1
  550. package/src/performance/cost-collection.d.ts +225 -0
  551. package/src/performance/cost-collection.js +825 -0
  552. package/src/performance/cost-collection.js.map +1 -0
  553. package/src/performance/cost-controls.d.ts +131 -0
  554. package/src/performance/cost-controls.js +336 -0
  555. package/src/performance/cost-controls.js.map +1 -0
  556. package/src/performance/evidence.d.ts +140 -0
  557. package/src/performance/evidence.js +599 -0
  558. package/src/performance/evidence.js.map +1 -0
  559. package/src/performance/index.d.ts +10 -0
  560. package/src/performance/index.js +14 -0
  561. package/src/performance/index.js.map +1 -0
  562. package/src/performance/load-safety.d.ts +84 -0
  563. package/src/performance/load-safety.js +346 -0
  564. package/src/performance/load-safety.js.map +1 -0
  565. package/src/performance/model.d.ts +129 -0
  566. package/src/performance/model.js +452 -0
  567. package/src/performance/model.js.map +1 -0
  568. package/src/performance/pr-artifact-budget.d.ts +42 -0
  569. package/src/performance/pr-artifact-budget.js +151 -0
  570. package/src/performance/pr-artifact-budget.js.map +1 -0
  571. package/src/performance/runner.d.ts +75 -0
  572. package/src/performance/runner.js +227 -0
  573. package/src/performance/runner.js.map +1 -0
  574. package/src/performance/scenario-endpoint.d.ts +1 -0
  575. package/src/performance/scenario-endpoint.js +5 -0
  576. package/src/performance/scenario-endpoint.js.map +1 -0
  577. package/src/performance/scenario.d.ts +193 -0
  578. package/src/performance/scenario.js +736 -0
  579. package/src/performance/scenario.js.map +1 -0
  580. package/src/performance/test-fixtures.d.ts +7 -0
  581. package/src/performance/test-fixtures.js +169 -0
  582. package/src/performance/test-fixtures.js.map +1 -0
  583. package/src/performance/unit-cost.d.ts +105 -0
  584. package/src/performance/unit-cost.js +364 -0
  585. package/src/performance/unit-cost.js.map +1 -0
  586. package/src/release/index.d.ts +4 -0
  587. package/src/release/index.js +8 -0
  588. package/src/release/index.js.map +1 -0
  589. package/src/release/lifecycle.d.ts +132 -0
  590. package/src/release/lifecycle.js +411 -0
  591. package/src/release/lifecycle.js.map +1 -0
  592. package/src/release/manifest.d.ts +148 -0
  593. package/src/release/manifest.js +503 -0
  594. package/src/release/manifest.js.map +1 -0
  595. package/src/release/rollout.d.ts +170 -0
  596. package/src/release/rollout.js +578 -0
  597. package/src/release/rollout.js.map +1 -0
  598. package/src/release/source-authority.d.ts +19 -0
  599. package/src/release/source-authority.js +195 -0
  600. package/src/release/source-authority.js.map +1 -0
  601. package/src/repository-policy/deployment-plan.d.ts +2 -1
  602. package/src/repository-policy/deployment-plan.js +2 -0
  603. package/src/repository-policy/deployment-plan.js.map +1 -1
  604. package/src/repository-policy/policy.d.ts +1 -1
  605. package/src/repository-policy/policy.js +29 -25
  606. package/src/repository-policy/policy.js.map +1 -1
  607. package/src/schemas/aggregate-count-evidence-v1.json +135 -0
  608. package/src/schemas/api-contract-baseline-v1.json +674 -0
  609. package/src/schemas/api-contract-compatibility-report-v1.json +126 -0
  610. package/src/schemas/aws-billing-actual-evidence-v1.json +407 -0
  611. package/src/schemas/blueprint-v1.json +18 -1
  612. package/src/schemas/data-lifecycle-policy-v1.json +517 -0
  613. package/src/schemas/generated-ownership-v2.json +22 -0
  614. package/src/schemas/performance-policy-v1.json +335 -0
  615. package/src/schemas/repository-policy-v1.json +1 -0
  616. package/src/schemas/testing-evidence-quarantine-v1.json +168 -0
  617. package/src/schemas/testing-evidence-result-v1.json +319 -0
  618. package/src/secrets/adapters.d.ts +49 -0
  619. package/src/secrets/adapters.js +184 -0
  620. package/src/secrets/adapters.js.map +1 -0
  621. package/src/secrets/aws-control-plane.d.ts +20 -0
  622. package/src/secrets/aws-control-plane.js +255 -0
  623. package/src/secrets/aws-control-plane.js.map +1 -0
  624. package/src/secrets/declaration-verification.d.ts +11 -0
  625. package/src/secrets/declaration-verification.js +68 -0
  626. package/src/secrets/declaration-verification.js.map +1 -0
  627. package/src/secrets/guardrails.d.ts +26 -0
  628. package/src/secrets/guardrails.js +328 -0
  629. package/src/secrets/guardrails.js.map +1 -0
  630. package/src/secrets/index.d.ts +12 -0
  631. package/src/secrets/index.js +16 -0
  632. package/src/secrets/index.js.map +1 -0
  633. package/src/secrets/metadata.d.ts +48 -0
  634. package/src/secrets/metadata.js +171 -0
  635. package/src/secrets/metadata.js.map +1 -0
  636. package/src/secrets/model.d.ts +49 -0
  637. package/src/secrets/model.js +125 -0
  638. package/src/secrets/model.js.map +1 -0
  639. package/src/secrets/operator.d.ts +101 -0
  640. package/src/secrets/operator.js +229 -0
  641. package/src/secrets/operator.js.map +1 -0
  642. package/src/secrets/permissions.d.ts +34 -0
  643. package/src/secrets/permissions.js +86 -0
  644. package/src/secrets/permissions.js.map +1 -0
  645. package/src/secrets/personal-command.d.ts +83 -0
  646. package/src/secrets/personal-command.js +197 -0
  647. package/src/secrets/personal-command.js.map +1 -0
  648. package/src/secrets/personal-ledger.d.ts +21 -0
  649. package/src/secrets/personal-ledger.js +135 -0
  650. package/src/secrets/personal-ledger.js.map +1 -0
  651. package/src/secrets/registry.d.ts +9 -0
  652. package/src/secrets/registry.js +86 -0
  653. package/src/secrets/registry.js.map +1 -0
  654. package/src/secrets/verification.d.ts +18 -0
  655. package/src/secrets/verification.js +139 -0
  656. package/src/secrets/verification.js.map +1 -0
  657. package/src/secrets/workload-access.d.ts +46 -0
  658. package/src/secrets/workload-access.js +163 -0
  659. package/src/secrets/workload-access.js.map +1 -0
  660. package/src/supply-chain/action-pins.d.ts +26 -0
  661. package/src/supply-chain/action-pins.js +208 -0
  662. package/src/supply-chain/action-pins.js.map +1 -0
  663. package/src/supply-chain/blueprint-trust-git.d.ts +130 -0
  664. package/src/supply-chain/blueprint-trust-git.js +1581 -0
  665. package/src/supply-chain/blueprint-trust-git.js.map +1 -0
  666. package/src/supply-chain/blueprint-trust-process.d.ts +4 -0
  667. package/src/supply-chain/blueprint-trust-process.js +88 -0
  668. package/src/supply-chain/blueprint-trust-process.js.map +1 -0
  669. package/src/supply-chain/blueprint-trust.d.ts +354 -0
  670. package/src/supply-chain/blueprint-trust.js +1558 -0
  671. package/src/supply-chain/blueprint-trust.js.map +1 -0
  672. package/src/supply-chain/blueprint-verification-authority.d.ts +62 -0
  673. package/src/supply-chain/blueprint-verification-authority.js +588 -0
  674. package/src/supply-chain/blueprint-verification-authority.js.map +1 -0
  675. package/src/supply-chain/blueprint-verification-execution.d.ts +68 -0
  676. package/src/supply-chain/blueprint-verification-execution.js +624 -0
  677. package/src/supply-chain/blueprint-verification-execution.js.map +1 -0
  678. package/src/supply-chain/build-output.d.ts +35 -0
  679. package/src/supply-chain/build-output.js +398 -0
  680. package/src/supply-chain/build-output.js.map +1 -0
  681. package/src/supply-chain/common.d.ts +21 -0
  682. package/src/supply-chain/common.js +107 -0
  683. package/src/supply-chain/common.js.map +1 -0
  684. package/src/supply-chain/container-artifact-contract.d.ts +23 -0
  685. package/src/supply-chain/container-artifact-contract.js +208 -0
  686. package/src/supply-chain/container-artifact-contract.js.map +1 -0
  687. package/src/supply-chain/container-release.d.ts +119 -0
  688. package/src/supply-chain/container-release.js +496 -0
  689. package/src/supply-chain/container-release.js.map +1 -0
  690. package/src/supply-chain/ecr-applicability.d.ts +19 -0
  691. package/src/supply-chain/ecr-applicability.js +103 -0
  692. package/src/supply-chain/ecr-applicability.js.map +1 -0
  693. package/src/supply-chain/ecr-scanning.d.ts +83 -0
  694. package/src/supply-chain/ecr-scanning.js +321 -0
  695. package/src/supply-chain/ecr-scanning.js.map +1 -0
  696. package/src/supply-chain/ecs-deployed-image.d.ts +85 -0
  697. package/src/supply-chain/ecs-deployed-image.js +300 -0
  698. package/src/supply-chain/ecs-deployed-image.js.map +1 -0
  699. package/src/supply-chain/errors.d.ts +6 -0
  700. package/src/supply-chain/errors.js +15 -0
  701. package/src/supply-chain/errors.js.map +1 -0
  702. package/src/supply-chain/generated-blueprint-trust-command.d.ts +4 -0
  703. package/src/supply-chain/generated-blueprint-trust-command.js +1362 -0
  704. package/src/supply-chain/generated-blueprint-trust-command.js.map +1 -0
  705. package/src/supply-chain/generated-command.d.ts +1 -0
  706. package/src/supply-chain/generated-command.js +687 -0
  707. package/src/supply-chain/generated-command.js.map +1 -0
  708. package/src/supply-chain/generated-container-release-command.d.ts +16 -0
  709. package/src/supply-chain/generated-container-release-command.js +2087 -0
  710. package/src/supply-chain/generated-container-release-command.js.map +1 -0
  711. package/src/supply-chain/generated-ecr-collector-command.d.ts +21 -0
  712. package/src/supply-chain/generated-ecr-collector-command.js +1338 -0
  713. package/src/supply-chain/generated-ecr-collector-command.js.map +1 -0
  714. package/src/supply-chain/generated-files.d.ts +13 -0
  715. package/src/supply-chain/generated-files.js +401 -0
  716. package/src/supply-chain/generated-files.js.map +1 -0
  717. package/src/supply-chain/generated-scanner-command.d.ts +1 -0
  718. package/src/supply-chain/generated-scanner-command.js +718 -0
  719. package/src/supply-chain/generated-scanner-command.js.map +1 -0
  720. package/src/supply-chain/index.d.ts +28 -0
  721. package/src/supply-chain/index.js +35 -0
  722. package/src/supply-chain/index.js.map +1 -0
  723. package/src/supply-chain/inventory.d.ts +79 -0
  724. package/src/supply-chain/inventory.js +717 -0
  725. package/src/supply-chain/inventory.js.map +1 -0
  726. package/src/supply-chain/license-expression.d.ts +7 -0
  727. package/src/supply-chain/license-expression.js +128 -0
  728. package/src/supply-chain/license-expression.js.map +1 -0
  729. package/src/supply-chain/pnpm-toolchain-authority.d.ts +31 -0
  730. package/src/supply-chain/pnpm-toolchain-authority.js +316 -0
  731. package/src/supply-chain/pnpm-toolchain-authority.js.map +1 -0
  732. package/src/supply-chain/policy.d.ts +105 -0
  733. package/src/supply-chain/policy.js +301 -0
  734. package/src/supply-chain/policy.js.map +1 -0
  735. package/src/supply-chain/publication.d.ts +48 -0
  736. package/src/supply-chain/publication.js +85 -0
  737. package/src/supply-chain/publication.js.map +1 -0
  738. package/src/supply-chain/sbom.d.ts +228 -0
  739. package/src/supply-chain/sbom.js +826 -0
  740. package/src/supply-chain/sbom.js.map +1 -0
  741. package/src/supply-chain/scanner.d.ts +77 -0
  742. package/src/supply-chain/scanner.js +502 -0
  743. package/src/supply-chain/scanner.js.map +1 -0
  744. package/src/supply-chain/vendored-source.d.ts +95 -0
  745. package/src/supply-chain/vendored-source.js +315 -0
  746. package/src/supply-chain/vendored-source.js.map +1 -0
  747. package/src/testing-evidence/fixture-scope.d.ts +52 -0
  748. package/src/testing-evidence/fixture-scope.js +140 -0
  749. package/src/testing-evidence/fixture-scope.js.map +1 -0
  750. package/src/testing-evidence/index.d.ts +5 -0
  751. package/src/testing-evidence/index.js +9 -0
  752. package/src/testing-evidence/index.js.map +1 -0
  753. package/src/testing-evidence/quarantine.d.ts +48 -0
  754. package/src/testing-evidence/quarantine.js +253 -0
  755. package/src/testing-evidence/quarantine.js.map +1 -0
  756. package/src/testing-evidence/result.d.ts +108 -0
  757. package/src/testing-evidence/result.js +571 -0
  758. package/src/testing-evidence/result.js.map +1 -0
  759. package/src/testing-evidence/runner-adapter.d.ts +51 -0
  760. package/src/testing-evidence/runner-adapter.js +288 -0
  761. package/src/testing-evidence/runner-adapter.js.map +1 -0
  762. package/src/testing-evidence/sensitive-artifacts.d.ts +13 -0
  763. package/src/testing-evidence/sensitive-artifacts.js +93 -0
  764. package/src/testing-evidence/sensitive-artifacts.js.map +1 -0
  765. package/src/work-markers/work-markers.js +4 -3
  766. package/src/work-markers/work-markers.js.map +1 -1
  767. package/src/workload-roles/account-baseline.d.ts +132 -0
  768. package/src/workload-roles/account-baseline.js +743 -0
  769. package/src/workload-roles/account-baseline.js.map +1 -0
  770. package/src/workload-roles/authority.d.ts +38 -0
  771. package/src/workload-roles/authority.js +156 -0
  772. package/src/workload-roles/authority.js.map +1 -0
  773. package/src/workload-roles/aws-adapter.d.ts +99 -0
  774. package/src/workload-roles/aws-adapter.js +416 -0
  775. package/src/workload-roles/aws-adapter.js.map +1 -0
  776. package/src/workload-roles/aws-internal-handler.d.ts +27 -0
  777. package/src/workload-roles/aws-internal-handler.js +58 -0
  778. package/src/workload-roles/aws-internal-handler.js.map +1 -0
  779. package/src/workload-roles/aws-s3-state.d.ts +52 -0
  780. package/src/workload-roles/aws-s3-state.js +164 -0
  781. package/src/workload-roles/aws-s3-state.js.map +1 -0
  782. package/src/workload-roles/aws-sdk-control-plane.d.ts +12 -0
  783. package/src/workload-roles/aws-sdk-control-plane.js +291 -0
  784. package/src/workload-roles/aws-sdk-control-plane.js.map +1 -0
  785. package/src/workload-roles/boundary.d.ts +33 -0
  786. package/src/workload-roles/boundary.js +130 -0
  787. package/src/workload-roles/boundary.js.map +1 -0
  788. package/src/workload-roles/convergence.d.ts +66 -0
  789. package/src/workload-roles/convergence.js +186 -0
  790. package/src/workload-roles/convergence.js.map +1 -0
  791. package/src/workload-roles/effective-policy.d.ts +51 -0
  792. package/src/workload-roles/effective-policy.js +183 -0
  793. package/src/workload-roles/effective-policy.js.map +1 -0
  794. package/src/workload-roles/handler.d.ts +43 -0
  795. package/src/workload-roles/handler.js +130 -0
  796. package/src/workload-roles/handler.js.map +1 -0
  797. package/src/workload-roles/history.d.ts +47 -0
  798. package/src/workload-roles/history.js +324 -0
  799. package/src/workload-roles/history.js.map +1 -0
  800. package/src/workload-roles/index.d.ts +17 -0
  801. package/src/workload-roles/index.js +21 -0
  802. package/src/workload-roles/index.js.map +1 -0
  803. package/src/workload-roles/injection.d.ts +119 -0
  804. package/src/workload-roles/injection.js +495 -0
  805. package/src/workload-roles/injection.js.map +1 -0
  806. package/src/workload-roles/manifest.d.ts +54 -0
  807. package/src/workload-roles/manifest.js +343 -0
  808. package/src/workload-roles/manifest.js.map +1 -0
  809. package/src/workload-roles/provisioner.d.ts +70 -0
  810. package/src/workload-roles/provisioner.js +231 -0
  811. package/src/workload-roles/provisioner.js.map +1 -0
  812. package/src/workload-roles/registration.d.ts +101 -0
  813. package/src/workload-roles/registration.js +457 -0
  814. package/src/workload-roles/registration.js.map +1 -0
  815. package/src/workload-roles/stage-boundary.d.ts +31 -0
  816. package/src/workload-roles/stage-boundary.js +208 -0
  817. package/src/workload-roles/stage-boundary.js.map +1 -0
  818. package/src/workload-roles/standard-slice.d.ts +54 -0
  819. package/src/workload-roles/standard-slice.js +252 -0
  820. package/src/workload-roles/standard-slice.js.map +1 -0
  821. package/migrations/standard-pre-v1-to-v1.md +0 -11
  822. package/src/foundation/aurora-logical-database.d.ts +0 -76
  823. package/src/foundation/aurora-logical-database.js +0 -419
  824. package/src/foundation/aurora-logical-database.js.map +0 -1
@@ -0,0 +1,1581 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BLUEPRINT_TRUST_SNAPSHOT_PATH = exports.BLUEPRINT_TRUST_POLICY_PATH = void 0;
4
+ exports.protectedWorkspaceHasExternalBlueprintOwnership = protectedWorkspaceHasExternalBlueprintOwnership;
5
+ exports.inspectProtectedWorkspaceExternalBlueprintHistory = inspectProtectedWorkspaceExternalBlueprintHistory;
6
+ exports.protectedWorkspaceHistoryRequiresStrictNxAuthority = protectedWorkspaceHistoryRequiresStrictNxAuthority;
7
+ exports.inspectBlueprintTrustGitAuthority = inspectBlueprintTrustGitAuthority;
8
+ exports.inspectProtectedGitFileAuthority = inspectProtectedGitFileAuthority;
9
+ exports.inspectProtectedGitFileRefAuthority = inspectProtectedGitFileRefAuthority;
10
+ exports.createBlueprintVerificationWorkspaceSnapshot = createBlueprintVerificationWorkspaceSnapshot;
11
+ exports.assertBlueprintVerificationWorkspaceSnapshot = assertBlueprintVerificationWorkspaceSnapshot;
12
+ exports.assertProtectedGitWorkingTreeAuthority = assertProtectedGitWorkingTreeAuthority;
13
+ exports.assertProtectedGitVerificationExecutionAuthority = assertProtectedGitVerificationExecutionAuthority;
14
+ const node_child_process_1 = require("node:child_process");
15
+ const node_crypto_1 = require("node:crypto");
16
+ const node_fs_1 = require("node:fs");
17
+ const node_path_1 = require("node:path");
18
+ const deterministic_order_js_1 = require("../deterministic-order.js");
19
+ const validation_js_1 = require("../validation.js");
20
+ const foundation_record_js_1 = require("../ownership/foundation-record.js");
21
+ const record_js_1 = require("../ownership/record.js");
22
+ const workspace_record_js_1 = require("../ownership/workspace-record.js");
23
+ const blueprint_verification_authority_js_1 = require("./blueprint-verification-authority.js");
24
+ const blueprint_trust_js_1 = require("./blueprint-trust.js");
25
+ const errors_js_1 = require("./errors.js");
26
+ const FULL_GIT_OBJECT_ID = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
27
+ const SAFE_GIT_REFERENCE = /^(?:HEAD|HEAD\^1|refs\/(?:heads|remotes\/origin)\/[A-Za-z0-9][A-Za-z0-9._/-]{0,254}|[a-f0-9]{40}|[a-f0-9]{64})$/;
28
+ const SAFE_PROTECTED_GIT_REFERENCE = /^(?:refs\/remotes\/origin\/[A-Za-z0-9][A-Za-z0-9._/-]{0,254}|[a-f0-9]{40}|[a-f0-9]{64})$/;
29
+ const SAFE_REPOSITORY_PATH = /^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[A-Za-z0-9._@+~/-]{1,512}$/;
30
+ const AMBIGUOUS_TRACKED_PATH_CHARACTER =
31
+ // eslint-disable-next-line no-control-regex -- C0/C1 characters are deliberately rejected in tracked path names.
32
+ /[\u0000-\u001f\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069\ufffd]/u;
33
+ const OWNERSHIP_PATH = /^packages\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/\.ebk\/ownership\.json$/;
34
+ const OWNERSHIP_PATHSPEC = ':(glob,top)packages/*/.ebk/ownership.json';
35
+ const VERIFICATION_RECEIPT_PATH = /^supply-chain\/blueprint-verification-receipts\/([a-z][a-z0-9]*(?:-[a-z0-9]+)*)\.json$/;
36
+ const VERIFICATION_RECEIPT_DIRECTORY = 'supply-chain/blueprint-verification-receipts';
37
+ const PROTECTED_BLUEPRINT_OWNERSHIP_REFS = [
38
+ 'refs/remotes/origin/develop',
39
+ 'refs/remotes/origin/main',
40
+ ];
41
+ const MAX_GIT_OUTPUT_BYTES = 30 * 1024 * 1024;
42
+ const MAX_TRACKED_REPOSITORY_PATH_BYTES = 4 * 1024;
43
+ const MAX_HISTORY_COMMITS = 20_000;
44
+ const MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS = 512;
45
+ const MAX_PREGRAPH_OWNERSHIP_HISTORY_RECORDS = 8_192;
46
+ const MAX_JSON_BYTES = 5 * 1024 * 1024;
47
+ const MAX_OWNERSHIP_RECORDS = 1_000;
48
+ const MAX_EXECUTION_SNAPSHOT_BYTES = 512 * 1024 * 1024;
49
+ const MAX_EXECUTION_SNAPSHOT_ENTRIES = 50_000;
50
+ const MAX_EXECUTION_SNAPSHOT_FILE_BYTES = 25 * 1024 * 1024;
51
+ const TRUSTED_GIT_CONFIGURATION = [
52
+ '-c',
53
+ 'core.fsmonitor=false',
54
+ '-c',
55
+ 'core.untrackedCache=false',
56
+ ];
57
+ exports.BLUEPRINT_TRUST_POLICY_PATH = 'supply-chain/blueprint-trust-policy.json';
58
+ exports.BLUEPRINT_TRUST_SNAPSHOT_PATH = 'supply-chain/blueprint-trust-snapshot.json';
59
+ function supplyChainGitEnvironment(source) {
60
+ return Object.fromEntries(['SystemRoot', 'SYSTEMROOT', 'TEMP', 'TMP', 'WINDIR'].flatMap((name) => source[name] === undefined ? [] : [[name, source[name]]]));
61
+ }
62
+ function trustedGitExecutable(workspaceRoot) {
63
+ const candidates = process.platform === 'win32'
64
+ ? [
65
+ 'C:\\Program Files\\Git\\cmd\\git.exe',
66
+ 'C:\\Program Files\\Git\\bin\\git.exe',
67
+ 'C:\\Program Files (x86)\\Git\\cmd\\git.exe',
68
+ ]
69
+ : ['/usr/bin/git'];
70
+ for (const candidate of candidates) {
71
+ if (!(0, node_path_1.isAbsolute)(candidate) || !(0, node_fs_1.existsSync)(candidate))
72
+ continue;
73
+ let executable;
74
+ try {
75
+ executable = (0, node_fs_1.realpathSync)(candidate);
76
+ }
77
+ catch {
78
+ continue;
79
+ }
80
+ const child = (0, node_path_1.relative)(workspaceRoot, executable);
81
+ if (!(0, node_fs_1.lstatSync)(executable).isFile() ||
82
+ child === '' ||
83
+ (child !== '..' && !child.startsWith(`..${node_path_1.sep}`) && !(0, node_path_1.isAbsolute)(child))) {
84
+ continue;
85
+ }
86
+ return executable;
87
+ }
88
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git', 'cannot locate a trusted absolute system Git executable outside the workspace');
89
+ }
90
+ function isSameCanonicalDirectory(left, right) {
91
+ try {
92
+ const leftPath = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(left));
93
+ const rightPath = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(right));
94
+ const leftMetadata = (0, node_fs_1.lstatSync)(leftPath, { bigint: true });
95
+ const rightMetadata = (0, node_fs_1.lstatSync)(rightPath, { bigint: true });
96
+ if (!leftMetadata.isDirectory() || !rightMetadata.isDirectory()) {
97
+ return false;
98
+ }
99
+ return ((leftMetadata.ino !== 0n &&
100
+ leftMetadata.dev === rightMetadata.dev &&
101
+ leftMetadata.ino === rightMetadata.ino) ||
102
+ leftPath === rightPath);
103
+ }
104
+ catch {
105
+ return false;
106
+ }
107
+ }
108
+ function git(context, args, options = {}) {
109
+ const result = (0, node_child_process_1.spawnSync)(context.executable, [...TRUSTED_GIT_CONFIGURATION, ...args], {
110
+ cwd: context.workspaceRoot,
111
+ encoding: 'utf8',
112
+ env: {
113
+ ...context.environment,
114
+ GIT_CONFIG_GLOBAL: process.platform === 'win32' ? 'NUL' : '/dev/null',
115
+ GIT_CONFIG_NOSYSTEM: '1',
116
+ GIT_NO_REPLACE_OBJECTS: '1',
117
+ GIT_OPTIONAL_LOCKS: '0',
118
+ },
119
+ maxBuffer: MAX_GIT_OUTPUT_BYTES,
120
+ shell: false,
121
+ timeout: 15_000,
122
+ windowsHide: true,
123
+ });
124
+ if (result.error ||
125
+ result.status !== 0 ||
126
+ typeof result.stdout !== 'string') {
127
+ if (options.allowFailure)
128
+ return undefined;
129
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git', `cannot establish protected trust history with git ${args[0] ?? 'command'}`);
130
+ }
131
+ return result.stdout.replace(/\r\n/g, '\n').replace(/\n$/, '');
132
+ }
133
+ function hashGitBlob(context, value) {
134
+ const result = (0, node_child_process_1.spawnSync)(context.executable, [...TRUSTED_GIT_CONFIGURATION, 'hash-object', '--stdin'], {
135
+ cwd: context.workspaceRoot,
136
+ encoding: 'utf8',
137
+ env: {
138
+ ...context.environment,
139
+ GIT_CONFIG_GLOBAL: process.platform === 'win32' ? 'NUL' : '/dev/null',
140
+ GIT_CONFIG_NOSYSTEM: '1',
141
+ GIT_NO_REPLACE_OBJECTS: '1',
142
+ GIT_OPTIONAL_LOCKS: '0',
143
+ },
144
+ input: value,
145
+ maxBuffer: MAX_GIT_OUTPUT_BYTES,
146
+ shell: false,
147
+ timeout: 15_000,
148
+ windowsHide: true,
149
+ });
150
+ const objectId = String(result.stdout ?? '').trim();
151
+ if (result.error ||
152
+ result.status !== 0 ||
153
+ !FULL_GIT_OBJECT_ID.test(objectId)) {
154
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.fileAuthority', 'cannot hash the exact working-tree bytes with trusted Git');
155
+ }
156
+ return objectId;
157
+ }
158
+ function hashGitBlobLocally(value, expectedObjectId) {
159
+ const algorithm = expectedObjectId.length === 64 ? 'sha256' : 'sha1';
160
+ return (0, node_crypto_1.createHash)(algorithm)
161
+ .update(Buffer.from(`blob ${value.byteLength}\0`, 'utf8'))
162
+ .update(value)
163
+ .digest('hex');
164
+ }
165
+ function safeRepositoryPath(path, label) {
166
+ if (!SAFE_REPOSITORY_PATH.test(path) || path.split('/').includes('..')) {
167
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', label, 'must be a bounded repository-relative path');
168
+ }
169
+ return path;
170
+ }
171
+ /**
172
+ * Git permits ordinary tracked names outside the framework's deliberately
173
+ * narrow authority-path grammar. Whole-tree review must bind those bytes too,
174
+ * without making spaces or international product documentation illegal.
175
+ * Reject only names whose decoding or repository-relative resolution in the
176
+ * current checkout is ambiguous.
177
+ */
178
+ function safeTrackedRepositoryPath(path, label) {
179
+ const segments = path.split('/');
180
+ if (path.length === 0 ||
181
+ Buffer.byteLength(path, 'utf8') > MAX_TRACKED_REPOSITORY_PATH_BYTES ||
182
+ path.startsWith('/') ||
183
+ /^[A-Za-z]:\//u.test(path) ||
184
+ path.includes('\\') ||
185
+ AMBIGUOUS_TRACKED_PATH_CHARACTER.test(path) ||
186
+ segments.some((segment) => segment.length === 0 || segment === '.' || segment === '..')) {
187
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', label, 'protected tree contains an unsafe or ambiguous tracked path');
188
+ }
189
+ return path;
190
+ }
191
+ function exactCommit(context, reference) {
192
+ if (!SAFE_GIT_REFERENCE.test(reference)) {
193
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'protectedRef', 'must be an exact protected branch, HEAD parent, or Git object ID');
194
+ }
195
+ const commit = git(context, [
196
+ 'rev-parse',
197
+ '--verify',
198
+ `${reference}^{commit}`,
199
+ ]);
200
+ if (!commit || !FULL_GIT_OBJECT_ID.test(commit)) {
201
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'protectedRef', `cannot resolve ${reference} to one full Git commit`);
202
+ }
203
+ return commit;
204
+ }
205
+ function protectedCommit(context, input) {
206
+ if (!SAFE_PROTECTED_GIT_REFERENCE.test(input.protectedRef)) {
207
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'protectedRef', 'must be an explicit full Git object ID or refs/remotes/origin/* default-base ref');
208
+ }
209
+ return exactCommit(context, input.protectedRef);
210
+ }
211
+ function commits(context, args) {
212
+ const output = git(context, [
213
+ 'rev-list',
214
+ '--first-parent',
215
+ '--reverse',
216
+ ...args,
217
+ ]);
218
+ const values = output === '' ? [] : (output ?? '').split('\n');
219
+ if (values.length > MAX_HISTORY_COMMITS ||
220
+ values.some((commit) => !FULL_GIT_OBJECT_ID.test(commit))) {
221
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.history', `must contain at most ${MAX_HISTORY_COMMITS} exact first-parent commits`);
222
+ }
223
+ return values;
224
+ }
225
+ function commitParents(context, commit) {
226
+ if (!FULL_GIT_OBJECT_ID.test(commit)) {
227
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'git.commit', 'must be a full Git object ID');
228
+ }
229
+ const line = git(context, ['rev-list', '--parents', '-n', '1', commit]);
230
+ const values = line?.split(' ') ?? [];
231
+ if (values[0] !== commit ||
232
+ values.some((value) => !FULL_GIT_OBJECT_ID.test(value))) {
233
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:parents`, 'cannot establish one exact Git parent list');
234
+ }
235
+ return values.slice(1);
236
+ }
237
+ function treeObjectId(context, commit) {
238
+ const tree = git(context, ['rev-parse', '--verify', `${commit}^{tree}`]);
239
+ if (!tree || !FULL_GIT_OBJECT_ID.test(tree)) {
240
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:tree`, 'cannot establish one exact Git tree');
241
+ }
242
+ return tree;
243
+ }
244
+ function blobObjectId(context, commit, path) {
245
+ const repositoryPath = safeRepositoryPath(path, 'git.path');
246
+ const object = git(context, ['rev-parse', '--verify', `${commit}:${repositoryPath}`], { allowFailure: true });
247
+ if (object === undefined)
248
+ return undefined;
249
+ if (!FULL_GIT_OBJECT_ID.test(object) ||
250
+ git(context, ['cat-file', '-t', object]) !== 'blob') {
251
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${repositoryPath}`, 'must resolve to one exact Git blob');
252
+ }
253
+ return object;
254
+ }
255
+ function readBlob(context, commit, path) {
256
+ if (!FULL_GIT_OBJECT_ID.test(commit)) {
257
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'git.commit', 'must be a full Git object ID');
258
+ }
259
+ const repositoryPath = safeRepositoryPath(path, 'git.path');
260
+ const treeEntry = git(context, [
261
+ 'ls-tree',
262
+ '--name-only',
263
+ '-z',
264
+ commit,
265
+ '--',
266
+ repositoryPath,
267
+ ]);
268
+ if (treeEntry === '')
269
+ return undefined;
270
+ if (treeEntry !== `${repositoryPath}\0`) {
271
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${repositoryPath}`, 'historical trust path did not resolve to one exact Git tree entry');
272
+ }
273
+ const value = git(context, ['show', `${commit}:${repositoryPath}`]);
274
+ if (value === undefined) {
275
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${repositoryPath}`, 'historical trust blob could not be read');
276
+ }
277
+ if (Buffer.byteLength(value, 'utf8') > MAX_JSON_BYTES) {
278
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', repositoryPath, 'historical trust input exceeds 5 MiB');
279
+ }
280
+ return value;
281
+ }
282
+ function readRawBlob(context, commit, path, maximumBytes) {
283
+ if (!FULL_GIT_OBJECT_ID.test(commit)) {
284
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'git.commit', 'must be a full Git object ID');
285
+ }
286
+ const repositoryPath = safeRepositoryPath(path, 'git.path');
287
+ if (git(context, [
288
+ 'ls-tree',
289
+ '--name-only',
290
+ '-z',
291
+ commit,
292
+ '--',
293
+ repositoryPath,
294
+ ]) !== `${repositoryPath}\0`) {
295
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${repositoryPath}`, 'historical execution authority is not one exact Git tree entry');
296
+ }
297
+ const result = (0, node_child_process_1.spawnSync)(context.executable, [...TRUSTED_GIT_CONFIGURATION, 'show', `${commit}:${repositoryPath}`], {
298
+ cwd: context.workspaceRoot,
299
+ encoding: null,
300
+ env: {
301
+ ...context.environment,
302
+ GIT_CONFIG_GLOBAL: process.platform === 'win32' ? 'NUL' : '/dev/null',
303
+ GIT_CONFIG_NOSYSTEM: '1',
304
+ GIT_NO_REPLACE_OBJECTS: '1',
305
+ GIT_OPTIONAL_LOCKS: '0',
306
+ },
307
+ maxBuffer: Math.min(MAX_GIT_OUTPUT_BYTES, maximumBytes + 1),
308
+ shell: false,
309
+ timeout: 15_000,
310
+ windowsHide: true,
311
+ });
312
+ if (result.error ||
313
+ result.status !== 0 ||
314
+ !Buffer.isBuffer(result.stdout) ||
315
+ result.stdout.length <= 0 ||
316
+ result.stdout.length > maximumBytes) {
317
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${repositoryPath}`, 'historical execution authority cannot be read within its byte bound');
318
+ }
319
+ return result.stdout;
320
+ }
321
+ function readJsonBlob(context, commit, path) {
322
+ const value = readBlob(context, commit, path);
323
+ if (value === undefined)
324
+ return undefined;
325
+ try {
326
+ return JSON.parse(value);
327
+ }
328
+ catch {
329
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical trust input is not valid JSON');
330
+ }
331
+ }
332
+ function stateAtCommit(context, commit, policyPath, snapshotPath) {
333
+ const policy = readJsonBlob(context, commit, policyPath);
334
+ const snapshot = readJsonBlob(context, commit, snapshotPath);
335
+ if (policy === undefined && snapshot === undefined)
336
+ return undefined;
337
+ if (policy === undefined || snapshot === undefined) {
338
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', commit, 'historical trust policy and snapshot must be introduced and retained as one pair');
339
+ }
340
+ return (0, blueprint_trust_js_1.createBlueprintTrustState)({
341
+ policy: policy,
342
+ snapshot: snapshot,
343
+ });
344
+ }
345
+ function historyStates(context, history, policyPath, snapshotPath) {
346
+ const states = [];
347
+ let pairIntroduced = false;
348
+ let lastDigest;
349
+ for (const commit of history) {
350
+ const state = stateAtCommit(context, commit, policyPath, snapshotPath);
351
+ if (!state) {
352
+ if (pairIntroduced) {
353
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', commit, 'cannot remove the protected Blueprint trust pair from Git history');
354
+ }
355
+ continue;
356
+ }
357
+ pairIntroduced = true;
358
+ const digest = (0, blueprint_trust_js_1.blueprintTrustStateDigest)(state);
359
+ if (digest !== lastDigest) {
360
+ states.push({ ...state, commit });
361
+ lastDigest = digest;
362
+ }
363
+ else if (commit === history.at(-1)) {
364
+ states.push({ ...state, commit });
365
+ }
366
+ }
367
+ if (states.length === 0) {
368
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.history', 'does not contain a committed Blueprint trust pair');
369
+ }
370
+ return states;
371
+ }
372
+ function blueprintIdentity(value, path) {
373
+ if (!(0, validation_js_1.isRecord)(value) ||
374
+ !(0, validation_js_1.isRecord)(value.blueprint) ||
375
+ typeof value.blueprint.name !== 'string' ||
376
+ typeof value.blueprint.version !== 'string' ||
377
+ typeof value.slice !== 'string') {
378
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'historical ownership does not retain an exact Blueprint identity');
379
+ }
380
+ return {
381
+ name: value.blueprint.name,
382
+ slice: value.slice,
383
+ version: value.blueprint.version,
384
+ };
385
+ }
386
+ function ownershipRecordsAtCommit(context, commit, paths) {
387
+ if (paths.some((path) => !OWNERSHIP_PATH.test(path))) {
388
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'contains a noncanonical or ambiguous Slice ownership path');
389
+ }
390
+ if (paths.length > MAX_OWNERSHIP_RECORDS) {
391
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, `contains more than ${MAX_OWNERSHIP_RECORDS} Slice ownership records`);
392
+ }
393
+ return paths.flatMap((path) => {
394
+ const value = readJsonBlob(context, commit, path);
395
+ if (value === undefined) {
396
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical ownership disappeared during exact tree inspection');
397
+ }
398
+ return historicalOwnershipRecord(commit, path, value);
399
+ });
400
+ }
401
+ function historicalOwnershipRecord(commit, path, value) {
402
+ if (path === 'packages/foundation/.ebk/ownership.json') {
403
+ const foundation = (0, foundation_record_js_1.validateFoundationOwnershipRecord)(value);
404
+ if (!foundation.valid) {
405
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical Foundation ownership is malformed');
406
+ }
407
+ return [];
408
+ }
409
+ const validation = (0, record_js_1.validateGeneratedOwnershipRecord)(value);
410
+ const slice = path.split('/')[1];
411
+ if (!validation.valid || validation.value.slice !== slice) {
412
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical Slice ownership is malformed or ambiguous');
413
+ }
414
+ return [
415
+ {
416
+ name: validation.value.blueprint.name,
417
+ path,
418
+ projects: validation.value.projects,
419
+ slice: validation.value.slice,
420
+ version: validation.value.blueprint.version,
421
+ },
422
+ ];
423
+ }
424
+ function changedOwnershipValuesAtCommit(context, commit, paths) {
425
+ if (paths.length === 0)
426
+ return [];
427
+ const specifications = paths.map((path) => `${commit}:${path}`);
428
+ const result = (0, node_child_process_1.spawnSync)(context.executable, [...TRUSTED_GIT_CONFIGURATION, 'cat-file', '--batch'], {
429
+ cwd: context.workspaceRoot,
430
+ env: {
431
+ ...context.environment,
432
+ GIT_CONFIG_GLOBAL: process.platform === 'win32' ? 'NUL' : '/dev/null',
433
+ GIT_CONFIG_NOSYSTEM: '1',
434
+ GIT_NO_REPLACE_OBJECTS: '1',
435
+ GIT_OPTIONAL_LOCKS: '0',
436
+ },
437
+ input: Buffer.from(`${specifications.join('\n')}\n`, 'utf8'),
438
+ maxBuffer: MAX_GIT_OUTPUT_BYTES,
439
+ shell: false,
440
+ timeout: 15_000,
441
+ windowsHide: true,
442
+ });
443
+ if (result.error || result.status !== 0 || !Buffer.isBuffer(result.stdout)) {
444
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'historical ownership changes could not be read within their aggregate byte bound');
445
+ }
446
+ const output = result.stdout;
447
+ const values = [];
448
+ let offset = 0;
449
+ for (const [index, specification] of specifications.entries()) {
450
+ const path = paths[index];
451
+ if (path === undefined) {
452
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'historical ownership batch input lost its path identity');
453
+ }
454
+ const headerEnd = output.indexOf(0x0a, offset);
455
+ if (headerEnd < 0) {
456
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'historical ownership batch output ended before its declared entries');
457
+ }
458
+ const header = output.subarray(offset, headerEnd).toString('utf8');
459
+ offset = headerEnd + 1;
460
+ if (header === `${specification} missing`)
461
+ continue;
462
+ const match = /^([a-f0-9]{40}|[a-f0-9]{64}) blob ([1-9][0-9]*)$/u.exec(header);
463
+ const size = match?.[2] ? Number.parseInt(match[2], 10) : Number.NaN;
464
+ if (!match?.[1] ||
465
+ !Number.isSafeInteger(size) ||
466
+ size > MAX_JSON_BYTES ||
467
+ offset + size >= output.length ||
468
+ output[offset + size] !== 0x0a) {
469
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical ownership batch output is not one bounded Git blob');
470
+ }
471
+ let value;
472
+ try {
473
+ value = JSON.parse(output.subarray(offset, offset + size).toString('utf8'));
474
+ }
475
+ catch {
476
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical ownership batch input is not valid JSON');
477
+ }
478
+ values.push({ path, value });
479
+ offset += size + 1;
480
+ }
481
+ if (offset !== output.length) {
482
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'historical ownership batch output contains undeclared trailing bytes');
483
+ }
484
+ return values;
485
+ }
486
+ function ownershipInventoryAtCommit(context, commit) {
487
+ const output = git(context, [
488
+ 'ls-tree',
489
+ '-r',
490
+ '--name-only',
491
+ '-z',
492
+ commit,
493
+ '--',
494
+ 'packages',
495
+ ]);
496
+ const paths = (output === '' ? [] : (output ?? '').split('\0'))
497
+ .filter((path) => path !== '')
498
+ .filter((path) => path.endsWith('/.ebk/ownership.json'));
499
+ return ownershipRecordsAtCommit(context, commit, paths);
500
+ }
501
+ function changedOwnershipAtCommit(context, commit) {
502
+ const output = git(context, [
503
+ 'diff-tree',
504
+ '--root',
505
+ '--first-parent',
506
+ '-m',
507
+ '--no-commit-id',
508
+ '-r',
509
+ '--name-only',
510
+ '-z',
511
+ commit,
512
+ '--',
513
+ OWNERSHIP_PATHSPEC,
514
+ ]);
515
+ const paths = (output === '' ? [] : (output ?? '').split('\0')).filter((path) => path !== '');
516
+ if (paths.some((path) => !OWNERSHIP_PATH.test(path))) {
517
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'contains a noncanonical or ambiguous changed Slice ownership path');
518
+ }
519
+ if (paths.length > MAX_OWNERSHIP_RECORDS) {
520
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, `changes more than ${MAX_OWNERSHIP_RECORDS} Slice ownership records`);
521
+ }
522
+ return changedOwnershipValuesAtCommit(context, commit, paths).flatMap(({ path, value }) => historicalOwnershipRecord(commit, path, value));
523
+ }
524
+ function protectedWorkspaceHasExternalBlueprintOwnership(input) {
525
+ if (!FULL_GIT_OBJECT_ID.test(input.commit)) {
526
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'blueprintOwnership.commit', 'protected ownership inventory requires one full commit object ID');
527
+ }
528
+ const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(input.workspaceRoot));
529
+ const context = {
530
+ environment: supplyChainGitEnvironment(process.env),
531
+ executable: trustedGitExecutable(workspaceRoot),
532
+ workspaceRoot,
533
+ };
534
+ const gitRoot = git(context, ['rev-parse', '--show-toplevel']);
535
+ const commit = git(context, [
536
+ 'rev-parse',
537
+ '--verify',
538
+ `${input.commit}^{commit}`,
539
+ ]);
540
+ if (!gitRoot ||
541
+ !isSameCanonicalDirectory(gitRoot, workspaceRoot) ||
542
+ commit !== input.commit) {
543
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.commit', 'protected ownership inventory requires the exact Git worktree and commit');
544
+ }
545
+ return ownershipInventoryAtCommit(context, commit).some(({ name }) => name !== input.builtInName);
546
+ }
547
+ /**
548
+ * Determines whether an external Blueprint appears anywhere in the bounded
549
+ * first-parent ownership histories of current HEAD or either fixed protected
550
+ * remote ref before Nx is allowed to load workspace plugins. The workspace's
551
+ * mutable defaultBase is deliberately not an authority for this decision, and
552
+ * the stricter pre-graph boundary remains permanently enabled after a
553
+ * protected external adoption is later removed or relabeled. A missing fixed
554
+ * remote ref makes the inventory incomplete and conservatively enables the
555
+ * strict boundary; it does not prevent a local-only repository with safe Nx
556
+ * configuration from being inspected. A shallow repository likewise enables
557
+ * the strict boundary because hidden history cannot prove permanent absence.
558
+ * HEAD is always required and clone/ref state is re-resolved after the
559
+ * immutable commit inventories are inspected so a concurrent rewrite fails
560
+ * closed.
561
+ */
562
+ function inspectProtectedWorkspaceExternalBlueprintHistory(input) {
563
+ const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(input.workspaceRoot));
564
+ const context = {
565
+ environment: supplyChainGitEnvironment(process.env),
566
+ executable: trustedGitExecutable(workspaceRoot),
567
+ workspaceRoot,
568
+ };
569
+ const gitRoot = git(context, ['rev-parse', '--show-toplevel']);
570
+ if (!gitRoot || !isSameCanonicalDirectory(gitRoot, workspaceRoot)) {
571
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', 'protected ownership history requires the exact Git worktree root');
572
+ }
573
+ const shallowBefore = git(context, ['rev-parse', '--is-shallow-repository']);
574
+ if (!['true', 'false'].includes(shallowBefore ?? '')) {
575
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', 'protected ownership history could not establish clone completeness');
576
+ }
577
+ const resolveCommits = () => {
578
+ const head = exactCommit(context, 'HEAD');
579
+ const output = git(context, [
580
+ 'for-each-ref',
581
+ '--format=%(refname) %(objectname)',
582
+ ...PROTECTED_BLUEPRINT_OWNERSHIP_REFS,
583
+ ]);
584
+ const resolved = new Map();
585
+ for (const line of output === '' ? [] : (output ?? '').split('\n')) {
586
+ const match = /^(refs\/remotes\/origin\/(?:develop|main)) ([a-f0-9]{40}|[a-f0-9]{64})$/u.exec(line);
587
+ if (!match?.[1] ||
588
+ !match[2] ||
589
+ !PROTECTED_BLUEPRINT_OWNERSHIP_REFS.includes(match[1]) ||
590
+ resolved.has(match[1])) {
591
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', 'protected ownership refs could not be enumerated exactly');
592
+ }
593
+ const commit = exactCommit(context, match[1]);
594
+ if (commit !== match[2]) {
595
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', match[1], 'protected ownership ref changed while it was resolved');
596
+ }
597
+ resolved.set(match[1], commit);
598
+ }
599
+ return [
600
+ head,
601
+ ...PROTECTED_BLUEPRINT_OWNERSHIP_REFS.map((reference) => resolved.get(reference)),
602
+ ];
603
+ };
604
+ const before = resolveCommits();
605
+ const tips = [
606
+ ...new Set(before.filter((commit) => commit !== undefined)),
607
+ ];
608
+ const history = new Set();
609
+ for (const tip of tips) {
610
+ const tipHistory = commits(context, [
611
+ `--max-count=${MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS + 1}`,
612
+ tip,
613
+ '--',
614
+ OWNERSHIP_PATHSPEC,
615
+ ]);
616
+ if (tipHistory.length > MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS) {
617
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', `protected ownership history exceeds ${MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS} changing commits`);
618
+ }
619
+ for (const commit of tipHistory) {
620
+ history.add(commit);
621
+ if (history.size > MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS) {
622
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', `protected ownership history exceeds ${MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS} distinct changing commits`);
623
+ }
624
+ }
625
+ }
626
+ const externalProjectNames = new Set();
627
+ const externalSliceRoots = new Set();
628
+ let externalRecordFound = false;
629
+ let historicalRecordCount = 0;
630
+ for (const commit of history) {
631
+ const inventory = changedOwnershipAtCommit(context, commit);
632
+ historicalRecordCount += inventory.length;
633
+ if (historicalRecordCount > MAX_PREGRAPH_OWNERSHIP_HISTORY_RECORDS) {
634
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', `protected ownership history exceeds ${MAX_PREGRAPH_OWNERSHIP_HISTORY_RECORDS} aggregate Slice records`);
635
+ }
636
+ for (const record of inventory) {
637
+ if (record.name === input.builtInName)
638
+ continue;
639
+ externalRecordFound = true;
640
+ externalProjectNames.add(record.slice);
641
+ for (const project of record.projects ?? []) {
642
+ externalProjectNames.add(project);
643
+ }
644
+ externalSliceRoots.add(`packages/${record.slice}`);
645
+ }
646
+ }
647
+ const after = resolveCommits();
648
+ const shallowAfter = git(context, ['rev-parse', '--is-shallow-repository']);
649
+ if (shallowAfter !== shallowBefore ||
650
+ before.length !== after.length ||
651
+ before.some((commit, index) => commit !== after[index])) {
652
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', 'HEAD or a protected ownership ref changed during pre-graph inspection');
653
+ }
654
+ const protectedInventoryComplete = before
655
+ .slice(1)
656
+ .every((commit) => commit !== undefined);
657
+ const complete = shallowBefore === 'false' && protectedInventoryComplete;
658
+ return {
659
+ complete,
660
+ externalProjectNames: [...externalProjectNames].sort(deterministic_order_js_1.compareUtf16),
661
+ externalSliceRoots: [...externalSliceRoots].sort(deterministic_order_js_1.compareUtf16),
662
+ requiresStrictNxAuthority: !complete || externalRecordFound,
663
+ };
664
+ }
665
+ function protectedWorkspaceHistoryRequiresStrictNxAuthority(input) {
666
+ return inspectProtectedWorkspaceExternalBlueprintHistory(input)
667
+ .requiresStrictNxAuthority;
668
+ }
669
+ function currentOwnershipInventory(input) {
670
+ if (input.ownership.length > MAX_OWNERSHIP_RECORDS) {
671
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'ownership', `contains more than ${MAX_OWNERSHIP_RECORDS} Slice ownership records`);
672
+ }
673
+ return input.ownership.flatMap(({ path, value }) => {
674
+ const repositoryPath = safeRepositoryPath(path, 'ownership.path');
675
+ return historicalOwnershipRecord('working-tree', repositoryPath, value);
676
+ });
677
+ }
678
+ function ownershipIdentity(record) {
679
+ return `${record.path}\0${record.slice}\0${record.name}\0${record.version}`;
680
+ }
681
+ function changedOwnershipPaths(context, parent, commit) {
682
+ const output = git(context, [
683
+ 'diff-tree',
684
+ '-r',
685
+ '--no-commit-id',
686
+ '--name-only',
687
+ '--no-renames',
688
+ '-z',
689
+ parent,
690
+ commit,
691
+ '--',
692
+ OWNERSHIP_PATHSPEC,
693
+ ]);
694
+ const paths = (output === '' ? [] : (output ?? '').split('\0')).filter((path) => path !== '');
695
+ if (paths.length > MAX_OWNERSHIP_RECORDS ||
696
+ paths.some((path) => !OWNERSHIP_PATH.test(path))) {
697
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, `changes more than ${MAX_OWNERSHIP_RECORDS} canonical Slice ownership records`);
698
+ }
699
+ return paths;
700
+ }
701
+ function historicalOwnershipAudit(context, builtInName, tip) {
702
+ const roots = commits(context, ['--max-parents=0', tip]);
703
+ if (roots.length !== 1) {
704
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${tip}:ownership`, 'must have one exact first-parent repository root');
705
+ }
706
+ const rootCommit = roots[0];
707
+ const root = ownershipInventoryAtCommit(context, rootCommit);
708
+ const external = new Map();
709
+ const rememberExternal = (record) => {
710
+ if (record.name !== builtInName) {
711
+ external.set(ownershipIdentity(record), record);
712
+ }
713
+ };
714
+ root.forEach(rememberExternal);
715
+ for (const commit of commits(context, [tip, '--', OWNERSHIP_PATHSPEC])) {
716
+ if (commit === rootCommit)
717
+ continue;
718
+ const parent = git(context, ['rev-parse', '--verify', `${commit}^1^{commit}`], { allowFailure: true });
719
+ if (!parent || !FULL_GIT_OBJECT_ID.test(parent)) {
720
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'cannot resolve the exact first parent of an ownership change');
721
+ }
722
+ for (const path of changedOwnershipPaths(context, parent, commit)) {
723
+ if (path === 'packages/foundation/.ebk/ownership.json')
724
+ continue;
725
+ const beforeValue = readJsonBlob(context, parent, path);
726
+ const afterValue = readJsonBlob(context, commit, path);
727
+ const before = beforeValue
728
+ ? historicalOwnershipRecord(parent, path, beforeValue)[0]
729
+ : undefined;
730
+ const after = afterValue
731
+ ? historicalOwnershipRecord(commit, path, afterValue)[0]
732
+ : undefined;
733
+ if (before)
734
+ rememberExternal(before);
735
+ if (after)
736
+ rememberExternal(after);
737
+ }
738
+ }
739
+ return {
740
+ external: [...external.values()],
741
+ };
742
+ }
743
+ function assertNoHistoricalPathIndependentRelabel(current, audits) {
744
+ for (const audit of audits) {
745
+ const ambiguous = audit.external.find((record) => ownershipLineageOverlaps(record, current));
746
+ if (!ambiguous)
747
+ continue;
748
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${current.path}#blueprint`, `cannot establish built-in provenance while historical external Blueprint ${ambiguous.name}@${ambiguous.version} ownership at ${ambiguous.path} was removed, moved, or reused`);
749
+ }
750
+ }
751
+ function ownershipLineageOverlaps(left, right) {
752
+ const rightProjects = new Set(right.projects ?? []);
753
+ return (left.slice === right.slice ||
754
+ left.path === right.path ||
755
+ left.projects?.some((project) => rightProjects.has(project)) === true);
756
+ }
757
+ function assertNoPathIndependentRelabel(builtInName, current, before, after) {
758
+ const afterExternal = new Set(after.filter(({ name }) => name !== builtInName).map(ownershipIdentity));
759
+ const relatedExternal = [...before, ...after].find((record) => record.name !== builtInName &&
760
+ ownershipLineageOverlaps(record, current) &&
761
+ (!before.includes(record) ||
762
+ !afterExternal.has(ownershipIdentity(record))));
763
+ if (!relatedExternal)
764
+ return;
765
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${current.path}#blueprint`, `cannot establish built-in provenance while historical external Blueprint ${relatedExternal.name}@${relatedExternal.version} ownership at ${relatedExternal.path} was removed, moved, or reused`);
766
+ }
767
+ function builtInProvenance(context, input, headCommit, protectedCommit) {
768
+ const provenance = [];
769
+ const currentOwnership = currentOwnershipInventory(input);
770
+ const builtInOwnership = currentOwnership.filter(({ name }) => name === input.builtIn.name);
771
+ if (builtInOwnership.length === 0)
772
+ return provenance;
773
+ const protectedOwnership = ownershipInventoryAtCommit(context, protectedCommit);
774
+ const headOwnership = ownershipInventoryAtCommit(context, headCommit);
775
+ const protectedAudit = historicalOwnershipAudit(context, input.builtIn.name, protectedCommit);
776
+ const audits = headCommit === protectedCommit
777
+ ? [protectedAudit]
778
+ : [
779
+ protectedAudit,
780
+ historicalOwnershipAudit(context, input.builtIn.name, headCommit),
781
+ ];
782
+ for (const currentRecord of builtInOwnership) {
783
+ const current = currentRecord;
784
+ const path = current.path;
785
+ const pathCommits = new Set([
786
+ ...commits(context, [headCommit, '--', path]),
787
+ ...commits(context, [protectedCommit, '--', path]),
788
+ ]);
789
+ for (const commit of pathCommits) {
790
+ const historical = readJsonBlob(context, commit, path);
791
+ if (!historical)
792
+ continue;
793
+ const identity = blueprintIdentity(historical, `${commit}:${path}`);
794
+ if (identity.name !== input.builtIn.name) {
795
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${path}#blueprint`, `cannot relabel historical external Blueprint ${identity.name}@${identity.version} as built-in`);
796
+ }
797
+ }
798
+ assertNoHistoricalPathIndependentRelabel(currentRecord, audits);
799
+ const head = readJsonBlob(context, headCommit, path);
800
+ const protectedValue = readJsonBlob(context, protectedCommit, path);
801
+ const headIdentity = head
802
+ ? blueprintIdentity(head, `${headCommit}:${path}`)
803
+ : undefined;
804
+ const protectedIdentity = protectedValue
805
+ ? blueprintIdentity(protectedValue, `${protectedCommit}:${path}`)
806
+ : undefined;
807
+ const matches = (identity) => identity?.name === current.name && identity.version === current.version;
808
+ const protectedLineage = protectedOwnership.some((record) => record.path === path &&
809
+ record.slice === current.slice &&
810
+ record.name === input.builtIn.name);
811
+ if (!protectedLineage) {
812
+ const headLineage = headOwnership.some((record) => record.path === path &&
813
+ record.slice === current.slice &&
814
+ record.name === input.builtIn.name);
815
+ assertNoPathIndependentRelabel(input.builtIn.name, currentRecord, headLineage ? protectedOwnership : headOwnership, headLineage ? headOwnership : currentOwnership);
816
+ }
817
+ if (matches(protectedIdentity)) {
818
+ provenance.push({
819
+ authority: 'protected-git-history',
820
+ commit: protectedCommit,
821
+ name: current.name,
822
+ path,
823
+ version: current.version,
824
+ });
825
+ }
826
+ else if (matches(headIdentity)) {
827
+ provenance.push({
828
+ authority: 'candidate-git-history',
829
+ commit: headCommit,
830
+ name: current.name,
831
+ path,
832
+ version: current.version,
833
+ });
834
+ }
835
+ else {
836
+ provenance.push({
837
+ authority: 'working-tree-adoption',
838
+ name: current.name,
839
+ path,
840
+ version: current.version,
841
+ });
842
+ }
843
+ }
844
+ return provenance;
845
+ }
846
+ function repositoryRootCommit(context, tip) {
847
+ const roots = commits(context, ['--max-parents=0', tip]);
848
+ if (roots.length !== 1 || !roots[0]) {
849
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.repositoryRoot', 'protected Blueprint authority must descend from one exact repository root commit');
850
+ }
851
+ return roots[0];
852
+ }
853
+ function assertCreateOnlyReceiptRetention(context, receiptCommit, executionCommit, paths) {
854
+ const parents = commitParents(context, receiptCommit);
855
+ const changedPaths = (git(context, [
856
+ 'diff-tree',
857
+ '-r',
858
+ '--no-commit-id',
859
+ '--name-only',
860
+ '--no-renames',
861
+ '-z',
862
+ executionCommit,
863
+ receiptCommit,
864
+ ]) ?? '')
865
+ .split('\0')
866
+ .filter(Boolean)
867
+ .map((changedPath) => safeTrackedRepositoryPath(changedPath, 'git.blueprintVerificationReceiptRetention.changedPath'))
868
+ .sort();
869
+ const retainedPaths = [...paths].sort();
870
+ if (parents.length !== 1 ||
871
+ parents[0] !== executionCommit ||
872
+ retainedPaths.length === 0 ||
873
+ retainedPaths.length !== changedPaths.length ||
874
+ retainedPaths.some((path, index) => path !== changedPaths[index]) ||
875
+ retainedPaths.some((path) => !VERIFICATION_RECEIPT_PATH.test(path) ||
876
+ blobObjectId(context, executionCommit, path) !== undefined ||
877
+ blobObjectId(context, receiptCommit, path) === undefined)) {
878
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${receiptCommit}:${VERIFICATION_RECEIPT_DIRECTORY}`, 'protected Blueprint verification receipt retention must be one literal one-parent, receipt-only, create-only commit whose parent is the exact execution commit shared by the complete final set, whose parent tree lacks every retained receipt path in that set, and whose changed paths equal that set');
879
+ }
880
+ }
881
+ function latestReceiptSetCommit(context, tip, paths, label) {
882
+ const latest = paths.map((path) => commits(context, [tip, '--', path]).at(-1));
883
+ const commit = latest[0];
884
+ if (!commit || latest.some((candidate) => candidate !== commit)) {
885
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${tip}:${VERIFICATION_RECEIPT_DIRECTORY}`, `${label} must bind the complete final Blueprint verification receipt set through one exact commit`);
886
+ }
887
+ return commit;
888
+ }
889
+ function protectedReceiptCommit(context, input, protectedCommit, paths, executionCommit, policyPath, snapshotPath) {
890
+ const protectedFirstParent = commits(context, [protectedCommit]);
891
+ const directReceiptCommit = latestReceiptSetCommit(context, protectedCommit, paths, input.protectedBranch === 'main'
892
+ ? 'production promotion'
893
+ : 'protected receipt retention');
894
+ const directExecutionIndex = protectedFirstParent.indexOf(executionCommit);
895
+ const directRetentionIndex = protectedFirstParent.indexOf(directReceiptCommit);
896
+ if (input.protectedBranch !== 'main') {
897
+ if (directExecutionIndex !== -1 &&
898
+ directRetentionIndex !== -1 &&
899
+ directExecutionIndex < directRetentionIndex) {
900
+ assertCreateOnlyReceiptRetention(context, directReceiptCommit, executionCommit, paths);
901
+ return directReceiptCommit;
902
+ }
903
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${VERIFICATION_RECEIPT_DIRECTORY}`, 'execution evidence must originate at an earlier first-parent protected commit and be retained by a later protected Git commit');
904
+ }
905
+ if (directRetentionIndex === -1) {
906
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${VERIFICATION_RECEIPT_DIRECTORY}`, 'production Blueprint receipt must be retained by one exact commit on the selected main first-parent history');
907
+ }
908
+ const promotionCommit = directReceiptCommit;
909
+ const parents = commitParents(context, promotionCommit);
910
+ if (parents.length !== 2) {
911
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${promotionCommit}:${VERIFICATION_RECEIPT_DIRECTORY}`, 'production Blueprint receipt authority requires one literal two-parent develop-to-main promotion merge');
912
+ }
913
+ const developAuthorityCommit = exactCommit(context, 'refs/remotes/origin/develop');
914
+ const promotedParent = parents[1];
915
+ const developFirstParent = commits(context, [developAuthorityCommit]);
916
+ const mainRoot = repositoryRootCommit(context, protectedCommit);
917
+ if (!developFirstParent.includes(promotedParent) ||
918
+ repositoryRootCommit(context, developAuthorityCommit) !== mainRoot ||
919
+ repositoryRootCommit(context, promotedParent) !== mainRoot) {
920
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${promotionCommit}:parents[1]`, 'production Blueprint receipt authority requires its promoted parent on the exact fetched protected develop first-parent lineage in the same repository history');
921
+ }
922
+ for (const parityPath of [policyPath, snapshotPath, ...paths]) {
923
+ const promotedBlob = blobObjectId(context, promotedParent, parityPath);
924
+ const protectedBlob = blobObjectId(context, promotionCommit, parityPath);
925
+ if (!promotedBlob || !protectedBlob || promotedBlob !== protectedBlob) {
926
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${promotionCommit}:${parityPath}`, 'production promotion must retain the exact develop-parent trust and receipt blob');
927
+ }
928
+ }
929
+ if (treeObjectId(context, promotedParent) !==
930
+ treeObjectId(context, promotionCommit)) {
931
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${promotionCommit}:tree`, 'production promotion tree must equal its exact reviewed develop parent');
932
+ }
933
+ const promotedFirstParent = commits(context, [promotedParent]);
934
+ const promotedReceiptCommit = latestReceiptSetCommit(context, promotedParent, paths, 'promoted develop receipt retention');
935
+ const promotedExecutionIndex = promotedFirstParent.indexOf(executionCommit);
936
+ const promotedRetentionIndex = promotedFirstParent.indexOf(promotedReceiptCommit);
937
+ if (promotedExecutionIndex === -1 ||
938
+ promotedRetentionIndex === -1 ||
939
+ promotedExecutionIndex >= promotedRetentionIndex) {
940
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${promotionCommit}:${VERIFICATION_RECEIPT_DIRECTORY}`, 'promoted execution evidence must originate at an earlier first-parent develop commit and be retained by a later first-parent develop commit');
941
+ }
942
+ assertCreateOnlyReceiptRetention(context, promotedReceiptCommit, executionCommit, paths);
943
+ if (exactCommit(context, 'refs/remotes/origin/develop') !==
944
+ developAuthorityCommit) {
945
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'refs/remotes/origin/develop', 'protected develop authority changed during production receipt inspection');
946
+ }
947
+ return promotedReceiptCommit;
948
+ }
949
+ function protectedVerificationReceipts(context, input, protectedCommit, repositoryRoot, policyPath, snapshotPath) {
950
+ const output = git(context, [
951
+ 'ls-tree',
952
+ '-r',
953
+ '--name-only',
954
+ '-z',
955
+ protectedCommit,
956
+ '--',
957
+ VERIFICATION_RECEIPT_DIRECTORY,
958
+ ]);
959
+ const paths = (output === '' ? [] : (output ?? '').split('\0')).filter((path) => path !== '');
960
+ if (paths.length > MAX_OWNERSHIP_RECORDS ||
961
+ paths.some((path) => !VERIFICATION_RECEIPT_PATH.test(path))) {
962
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:blueprintVerificationReceipts`, `must contain at most ${MAX_OWNERSHIP_RECORDS} canonical protected receipt blobs`);
963
+ }
964
+ const receipts = paths.map((path) => {
965
+ const value = readJsonBlob(context, protectedCommit, path);
966
+ if (value === undefined) {
967
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}`, 'protected Blueprint verification receipt disappeared during exact tree inspection');
968
+ }
969
+ const receipt = (0, blueprint_trust_js_1.createBlueprintVerificationExecutionReceipt)(value);
970
+ if (path !== (0, blueprint_trust_js_1.blueprintVerificationExecutionReceiptPath)(receipt.slice)) {
971
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}`, 'protected Blueprint verification receipt path does not match its Slice');
972
+ }
973
+ if (receipt.repositoryRootCommit !== repositoryRoot) {
974
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}#repositoryRootCommit`, 'protected Blueprint verification receipt belongs to a different Git repository history');
975
+ }
976
+ return { path, receipt };
977
+ });
978
+ const firstReceipt = receipts[0];
979
+ if (!firstReceipt)
980
+ return [];
981
+ const executionCommit = firstReceipt.receipt.executionCommit;
982
+ if (receipts.some(({ receipt }) => receipt.executionCommit !== executionCommit)) {
983
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${VERIFICATION_RECEIPT_DIRECTORY}`, 'the complete final Blueprint verification receipt set must share one exact execution commit');
984
+ }
985
+ const receiptCommit = protectedReceiptCommit(context, input, protectedCommit, paths, executionCommit, policyPath, snapshotPath);
986
+ return receipts.map(({ path, receipt }) => {
987
+ const executionLockfile = readRawBlob(context, receipt.executionCommit, 'pnpm-lock.yaml', 25 * 1024 * 1024);
988
+ if ((0, node_crypto_1.createHash)('sha256').update(executionLockfile).digest('hex') !==
989
+ receipt.lockfileSha256) {
990
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}#lockfileSha256`, 'protected receipt does not bind the exact execution-commit pnpm lockfile blob');
991
+ }
992
+ const executionManifestBytes = readRawBlob(context, receipt.executionCommit, 'package.json', MAX_JSON_BYTES);
993
+ const executionNodeVersion = readRawBlob(context, receipt.executionCommit, '.node-version', 128).toString('utf8');
994
+ let executionManifest;
995
+ try {
996
+ executionManifest = JSON.parse(executionManifestBytes.toString('utf8'));
997
+ }
998
+ catch {
999
+ executionManifest = undefined;
1000
+ }
1001
+ const executionNodeEngine = (0, validation_js_1.isRecord)(executionManifest) && (0, validation_js_1.isRecord)(executionManifest.engines)
1002
+ ? executionManifest.engines.node
1003
+ : undefined;
1004
+ if (executionNodeEngine !== receipt.nodeEngine ||
1005
+ executionNodeVersion !== `${receipt.nodeVersionDeclaration}\n`) {
1006
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}#nodeEngine`, 'protected receipt does not bind the exact execution-commit Node declarations');
1007
+ }
1008
+ const changedExecutionAuthority = git(context, [
1009
+ 'diff-tree',
1010
+ '-r',
1011
+ '--no-commit-id',
1012
+ '--name-only',
1013
+ '--no-renames',
1014
+ '-z',
1015
+ receipt.executionCommit,
1016
+ protectedCommit,
1017
+ ]);
1018
+ const changedSelectedAuthority = (changedExecutionAuthority ?? '')
1019
+ .split('\0')
1020
+ .filter(Boolean)
1021
+ .map((entry) => safeTrackedRepositoryPath(entry, 'git.verificationExecutionAuthority.changedPath'))
1022
+ .filter(blueprint_verification_authority_js_1.isBlueprintVerificationExecutionAuthorityPath);
1023
+ if (changedSelectedAuthority.length > 0) {
1024
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}#executionCommit`, 'protected Blueprint verification execution authority changed after receipt execution; rerun the review from the current protected commit');
1025
+ }
1026
+ const executionState = stateAtCommit(context, receipt.executionCommit, policyPath, snapshotPath);
1027
+ const review = executionState?.policy.generatedReviews.find(({ evidenceDigest }) => evidenceDigest === receipt.approvalDigest);
1028
+ if (!executionState || !review) {
1029
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}#approvalDigest`, 'execution commit does not contain the exact protected static approval');
1030
+ }
1031
+ const decision = (0, blueprint_trust_js_1.authorizeBlueprintTrust)({
1032
+ frameworkVersion: input.builtIn.version,
1033
+ integrity: receipt.blueprint.integrity,
1034
+ name: receipt.blueprint.name,
1035
+ now: receipt.generatedAt,
1036
+ operation: 'adopt',
1037
+ policy: executionState.policy,
1038
+ snapshot: executionState.snapshot,
1039
+ version: receipt.blueprint.version,
1040
+ });
1041
+ if (decision.decision !== 'allow') {
1042
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}#executionCommit`, 'execution commit did not authorize the exact Blueprint release');
1043
+ }
1044
+ return {
1045
+ protectedCommit: receiptCommit,
1046
+ receipt,
1047
+ reference: path,
1048
+ };
1049
+ });
1050
+ }
1051
+ function inspectBlueprintTrustGitAuthority(input) {
1052
+ if (!['develop', 'main'].includes(input.protectedBranch)) {
1053
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'protectedBranch', 'must explicitly identify develop or main protected-route authority');
1054
+ }
1055
+ const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(input.workspaceRoot));
1056
+ const context = {
1057
+ environment: supplyChainGitEnvironment(input.environment ?? process.env),
1058
+ executable: trustedGitExecutable(workspaceRoot),
1059
+ workspaceRoot,
1060
+ };
1061
+ const gitRoot = git(context, ['rev-parse', '--show-toplevel']);
1062
+ if (!gitRoot) {
1063
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git', 'workspace is not backed by Git history');
1064
+ }
1065
+ if (!isSameCanonicalDirectory(gitRoot, workspaceRoot)) {
1066
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git', 'workspace root must equal the protected Git worktree root');
1067
+ }
1068
+ if (git(context, ['rev-parse', '--is-shallow-repository']) !== 'false') {
1069
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.history', 'must be complete; fetch full protected history before Blueprint authorization');
1070
+ }
1071
+ const policyPath = safeRepositoryPath(input.policyPath ?? exports.BLUEPRINT_TRUST_POLICY_PATH, 'policyPath');
1072
+ const snapshotPath = safeRepositoryPath(input.snapshotPath ?? exports.BLUEPRINT_TRUST_SNAPSHOT_PATH, 'snapshotPath');
1073
+ const headCommit = exactCommit(context, 'HEAD');
1074
+ const authorityCommit = protectedCommit(context, input);
1075
+ const rootCommit = repositoryRootCommit(context, authorityCommit);
1076
+ const protectedCommits = commits(context, [
1077
+ authorityCommit,
1078
+ '--',
1079
+ policyPath,
1080
+ snapshotPath,
1081
+ ]);
1082
+ if (protectedCommits.at(-1) !== authorityCommit) {
1083
+ protectedCommits.push(authorityCommit);
1084
+ }
1085
+ const protectedStates = historyStates(context, protectedCommits, policyPath, snapshotPath);
1086
+ const protectedHistory = (0, blueprint_trust_js_1.validateBlueprintTrustHistory)(protectedStates);
1087
+ const authorization = (0, blueprint_trust_js_1.createBlueprintTrustState)(protectedStates.at(-1));
1088
+ const mergeBase = git(context, ['merge-base', authorityCommit, headCommit]);
1089
+ if (!mergeBase || !FULL_GIT_OBJECT_ID.test(mergeBase)) {
1090
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.history', 'candidate and protected history do not share one exact merge base');
1091
+ }
1092
+ const candidateCommits = [
1093
+ mergeBase,
1094
+ ...commits(context, [
1095
+ `${mergeBase}..${headCommit}`,
1096
+ '--',
1097
+ policyPath,
1098
+ snapshotPath,
1099
+ ]),
1100
+ ].filter((commit, index, values) => values.indexOf(commit) === index);
1101
+ if (candidateCommits.at(-1) !== headCommit)
1102
+ candidateCommits.push(headCommit);
1103
+ const candidateStates = historyStates(context, candidateCommits, policyPath, snapshotPath);
1104
+ const candidateHistory = (0, blueprint_trust_js_1.validateBlueprintTrustHistory)(candidateStates);
1105
+ const head = (0, blueprint_trust_js_1.createBlueprintTrustState)(candidateStates.at(-1));
1106
+ if ((0, blueprint_trust_js_1.blueprintTrustStateDigest)(authorization) !== (0, blueprint_trust_js_1.blueprintTrustStateDigest)(head)) {
1107
+ (0, blueprint_trust_js_1.planBlueprintTrustStateTransition)(authorization, head);
1108
+ }
1109
+ const current = (0, blueprint_trust_js_1.createBlueprintTrustState)(input.current);
1110
+ const workingTreeTransition = (0, blueprint_trust_js_1.blueprintTrustStateDigest)(head) === (0, blueprint_trust_js_1.blueprintTrustStateDigest)(current)
1111
+ ? undefined
1112
+ : (0, blueprint_trust_js_1.planBlueprintTrustStateTransition)(head, current).receipt;
1113
+ return {
1114
+ authorization,
1115
+ builtInProvenance: builtInProvenance(context, input, headCommit, authorityCommit),
1116
+ candidateHistory,
1117
+ headCommit,
1118
+ protectedCommit: authorityCommit,
1119
+ protectedHistory,
1120
+ protectedVerificationReceipts: protectedVerificationReceipts(context, input, authorityCommit, rootCommit, policyPath, snapshotPath),
1121
+ repositoryRootCommit: rootCommit,
1122
+ ...(workingTreeTransition ? { workingTreeTransition } : {}),
1123
+ };
1124
+ }
1125
+ /**
1126
+ * Binds one working-tree file byte-for-byte to both commits already admitted by
1127
+ * the protected Blueprint trust inspection. `git hash-object --stdin` computes
1128
+ * the repository's native object id without writing an object, so this remains
1129
+ * correct for either SHA-1 or SHA-256 repositories and does not normalize text.
1130
+ */
1131
+ function inspectProtectedGitFileAuthority(input) {
1132
+ if (!FULL_GIT_OBJECT_ID.test(input.headCommit) ||
1133
+ !FULL_GIT_OBJECT_ID.test(input.protectedCommit)) {
1134
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'git.fileAuthority', 'head and protected authority must be full Git commit object ids');
1135
+ }
1136
+ const repositoryPath = safeRepositoryPath(input.path, 'git.fileAuthority.path');
1137
+ const current = Buffer.from(input.current);
1138
+ if (current.byteLength === 0 || current.byteLength > MAX_JSON_BYTES) {
1139
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', repositoryPath, 'protected working-tree authority must be a non-empty file of at most 5 MiB');
1140
+ }
1141
+ const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(input.workspaceRoot));
1142
+ const context = {
1143
+ environment: supplyChainGitEnvironment(input.environment ?? process.env),
1144
+ executable: trustedGitExecutable(workspaceRoot),
1145
+ workspaceRoot,
1146
+ };
1147
+ const gitRoot = git(context, ['rev-parse', '--show-toplevel']);
1148
+ if (!gitRoot || !isSameCanonicalDirectory(gitRoot, workspaceRoot)) {
1149
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', repositoryPath, 'protected file authority requires the exact Git worktree root');
1150
+ }
1151
+ const currentObjectId = hashGitBlob(context, current);
1152
+ const headObjectId = blobObjectId(context, input.headCommit, repositoryPath);
1153
+ const protectedObjectId = blobObjectId(context, input.protectedCommit, repositoryPath);
1154
+ if (!headObjectId ||
1155
+ !protectedObjectId ||
1156
+ currentObjectId !== headObjectId ||
1157
+ currentObjectId !== protectedObjectId) {
1158
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', repositoryPath, 'working, HEAD, and protected Git file bytes must be exactly identical');
1159
+ }
1160
+ return {
1161
+ blobObjectId: currentObjectId,
1162
+ headCommit: input.headCommit,
1163
+ path: repositoryPath,
1164
+ protectedCommit: input.protectedCommit,
1165
+ };
1166
+ }
1167
+ function inspectProtectedGitFileRefAuthority(input) {
1168
+ if (!['refs/remotes/origin/develop', 'refs/remotes/origin/main'].includes(input.protectedRef)) {
1169
+ throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'git.fileAuthority.protectedRef', 'protected file authority requires one exact remote protected ref');
1170
+ }
1171
+ const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(input.workspaceRoot));
1172
+ const context = {
1173
+ environment: supplyChainGitEnvironment(input.environment ?? process.env),
1174
+ executable: trustedGitExecutable(workspaceRoot),
1175
+ workspaceRoot,
1176
+ };
1177
+ const headCommit = git(context, ['rev-parse', '--verify', 'HEAD^{commit}']);
1178
+ const protectedCommit = git(context, [
1179
+ 'rev-parse',
1180
+ '--verify',
1181
+ `${input.protectedRef}^{commit}`,
1182
+ ]);
1183
+ if (!headCommit ||
1184
+ !protectedCommit ||
1185
+ !FULL_GIT_OBJECT_ID.test(headCommit) ||
1186
+ !FULL_GIT_OBJECT_ID.test(protectedCommit)) {
1187
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', input.path, 'protected file authority cannot resolve exact HEAD and remote commits');
1188
+ }
1189
+ return inspectProtectedGitFileAuthority({
1190
+ current: input.current,
1191
+ environment: input.environment,
1192
+ headCommit,
1193
+ path: input.path,
1194
+ protectedCommit,
1195
+ workspaceRoot,
1196
+ });
1197
+ }
1198
+ function readExecutionSnapshotFile(workspaceRoot, path, maximumBytes) {
1199
+ const repositoryPath = safeTrackedRepositoryPath(path, 'blueprintVerification.workspaceSnapshot.path');
1200
+ const absolute = (0, node_path_1.join)(workspaceRoot, repositoryPath);
1201
+ const metadata = (0, node_fs_1.lstatSync)(absolute);
1202
+ if (metadata.isSymbolicLink() ||
1203
+ !metadata.isFile() ||
1204
+ metadata.nlink !== 1 ||
1205
+ metadata.size <= 0 ||
1206
+ metadata.size > maximumBytes ||
1207
+ (0, node_fs_1.realpathSync)(absolute) !== absolute) {
1208
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', repositoryPath, 'workspace execution snapshot requires one canonical bounded file');
1209
+ }
1210
+ const bytes = (0, node_fs_1.readFileSync)(absolute);
1211
+ if (bytes.byteLength !== metadata.size) {
1212
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', repositoryPath, 'workspace execution snapshot file changed while read');
1213
+ }
1214
+ return bytes;
1215
+ }
1216
+ function executionSnapshotOwnedPaths(workspaceRoot) {
1217
+ const paths = new Set();
1218
+ const addOwnedPaths = (prefix, owned) => {
1219
+ for (const entry of owned) {
1220
+ if (entry.mode !== 'managed' && entry.origin !== 'blueprint')
1221
+ continue;
1222
+ paths.add(safeTrackedRepositoryPath(prefix ? `${prefix}/${entry.path}` : entry.path, 'blueprintVerification.workspaceSnapshot.ownedPath'));
1223
+ }
1224
+ };
1225
+ const rootOwnershipPath = (0, node_path_1.join)(workspaceRoot, '.ebk', 'ownership.json');
1226
+ if ((0, node_fs_1.existsSync)(rootOwnershipPath)) {
1227
+ const rootOwnership = readExecutionSnapshotFile(workspaceRoot, '.ebk/ownership.json', MAX_JSON_BYTES);
1228
+ let value;
1229
+ try {
1230
+ value = JSON.parse(rootOwnership.toString('utf8'));
1231
+ }
1232
+ catch {
1233
+ value = undefined;
1234
+ }
1235
+ const validation = (0, workspace_record_js_1.validateWorkspaceOwnershipRecord)(value);
1236
+ if (!validation.valid) {
1237
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', '.ebk/ownership.json', 'workspace execution snapshot requires valid workspace ownership');
1238
+ }
1239
+ paths.add('.ebk/ownership.json');
1240
+ addOwnedPaths('', validation.value.paths);
1241
+ }
1242
+ const packagesRoot = (0, node_path_1.join)(workspaceRoot, 'packages');
1243
+ if (!(0, node_fs_1.existsSync)(packagesRoot))
1244
+ return [...paths];
1245
+ const packagesMetadata = (0, node_fs_1.lstatSync)(packagesRoot);
1246
+ if (packagesMetadata.isSymbolicLink() ||
1247
+ !packagesMetadata.isDirectory() ||
1248
+ (0, node_fs_1.realpathSync)(packagesRoot) !== packagesRoot) {
1249
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'packages', 'workspace execution snapshot requires one canonical packages directory');
1250
+ }
1251
+ const packages = (0, node_fs_1.readdirSync)(packagesRoot, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
1252
+ if (packages.length > 2_000) {
1253
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'packages', 'workspace execution snapshot exceeds 2,000 package entries');
1254
+ }
1255
+ const identities = new Set();
1256
+ for (const entry of packages) {
1257
+ const identity = entry.name.normalize('NFC').toLowerCase();
1258
+ if (identities.has(identity) || entry.isSymbolicLink()) {
1259
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `packages/${entry.name}`, 'workspace execution snapshot refuses ambiguous or symbolic-link packages');
1260
+ }
1261
+ identities.add(identity);
1262
+ if (!entry.isDirectory())
1263
+ continue;
1264
+ const prefix = safeTrackedRepositoryPath(`packages/${entry.name}`, 'blueprintVerification.workspaceSnapshot.package');
1265
+ const ownershipPath = `${prefix}/.ebk/ownership.json`;
1266
+ if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(workspaceRoot, ownershipPath)))
1267
+ continue;
1268
+ const ownership = readExecutionSnapshotFile(workspaceRoot, ownershipPath, MAX_JSON_BYTES);
1269
+ let value;
1270
+ try {
1271
+ value = JSON.parse(ownership.toString('utf8'));
1272
+ }
1273
+ catch {
1274
+ value = undefined;
1275
+ }
1276
+ paths.add(ownershipPath);
1277
+ if (entry.name === 'foundation') {
1278
+ const foundation = (0, foundation_record_js_1.validateFoundationOwnershipRecord)(value);
1279
+ if (!foundation.valid) {
1280
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', ownershipPath, 'workspace execution snapshot requires valid Foundation ownership');
1281
+ }
1282
+ addOwnedPaths(prefix, foundation.value.paths);
1283
+ continue;
1284
+ }
1285
+ const generated = (0, record_js_1.validateGeneratedOwnershipRecord)(value);
1286
+ if (!generated.valid || generated.value.slice !== entry.name) {
1287
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', ownershipPath, 'workspace execution snapshot requires valid unambiguous Slice ownership');
1288
+ }
1289
+ addOwnedPaths(prefix, generated.value.paths);
1290
+ }
1291
+ return [...paths];
1292
+ }
1293
+ /**
1294
+ * Captures the exact entry bytes of every tracked/nonignored path plus every
1295
+ * ignored ownership-managed or Blueprint-origin path. Verification targets may
1296
+ * write ignored evidence/cache outputs, but cannot mutate subsequent target
1297
+ * authority without failing their own executor result.
1298
+ */
1299
+ function createBlueprintVerificationWorkspaceSnapshot(workspace, additionalAuthorityPaths = []) {
1300
+ const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(workspace));
1301
+ const context = {
1302
+ environment: supplyChainGitEnvironment(process.env),
1303
+ executable: trustedGitExecutable(workspaceRoot),
1304
+ workspaceRoot,
1305
+ };
1306
+ const gitRoot = git(context, ['rev-parse', '--show-toplevel']);
1307
+ if (!gitRoot || !isSameCanonicalDirectory(gitRoot, workspaceRoot)) {
1308
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeSnapshot', 'workspace execution snapshot requires the exact Git worktree root');
1309
+ }
1310
+ const inventory = git(context, [
1311
+ 'ls-files',
1312
+ '--cached',
1313
+ '--others',
1314
+ '--exclude-standard',
1315
+ '-z',
1316
+ ]);
1317
+ const paths = new Set((inventory ?? '')
1318
+ .split('\0')
1319
+ .filter(Boolean)
1320
+ .map((path) => safeTrackedRepositoryPath(path, 'blueprintVerification.workspaceSnapshot.path')));
1321
+ const authorityPaths = [...new Set(additionalAuthorityPaths)]
1322
+ .map((path) => safeTrackedRepositoryPath(path, 'blueprintVerification.workspaceSnapshot.authorityPath'))
1323
+ .sort();
1324
+ for (const path of authorityPaths)
1325
+ paths.add(path);
1326
+ for (const path of executionSnapshotOwnedPaths(workspaceRoot)) {
1327
+ paths.add(path);
1328
+ }
1329
+ if (paths.size > MAX_EXECUTION_SNAPSHOT_ENTRIES) {
1330
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeSnapshot', 'workspace execution snapshot exceeds 50,000 files');
1331
+ }
1332
+ const aliases = new Set();
1333
+ let totalBytes = 0;
1334
+ const entries = [...paths]
1335
+ .sort()
1336
+ .map((path) => {
1337
+ const alias = path.normalize('NFC').toLowerCase();
1338
+ if (aliases.has(alias)) {
1339
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'workspace execution snapshot contains a case or Unicode path alias');
1340
+ }
1341
+ aliases.add(alias);
1342
+ const absolute = (0, node_path_1.join)(workspaceRoot, path);
1343
+ const metadata = (0, node_fs_1.lstatSync)(absolute);
1344
+ if (metadata.isSymbolicLink() ||
1345
+ !metadata.isFile() ||
1346
+ metadata.nlink !== 1 ||
1347
+ metadata.size > MAX_EXECUTION_SNAPSHOT_FILE_BYTES ||
1348
+ (0, node_fs_1.realpathSync)(absolute) !== absolute) {
1349
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'workspace execution snapshot requires one canonical bounded file');
1350
+ }
1351
+ totalBytes += metadata.size;
1352
+ if (totalBytes > MAX_EXECUTION_SNAPSHOT_BYTES) {
1353
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'workspace execution snapshot exceeds its 512 MiB byte bound');
1354
+ }
1355
+ const bytes = (0, node_fs_1.readFileSync)(absolute);
1356
+ if (bytes.byteLength !== metadata.size) {
1357
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'workspace execution snapshot file changed while read');
1358
+ }
1359
+ return {
1360
+ mode: process.platform === 'win32' || (metadata.mode & 0o111) === 0
1361
+ ? '100644'
1362
+ : '100755',
1363
+ path,
1364
+ sha256: (0, node_crypto_1.createHash)('sha256').update(bytes).digest('hex'),
1365
+ size: metadata.size,
1366
+ };
1367
+ });
1368
+ return { authorityPaths, entries, workspaceRoot };
1369
+ }
1370
+ function assertBlueprintVerificationWorkspaceSnapshot(snapshot) {
1371
+ const current = createBlueprintVerificationWorkspaceSnapshot(snapshot.workspaceRoot, snapshot.authorityPaths);
1372
+ if (JSON.stringify(current.entries) !== JSON.stringify(snapshot.entries)) {
1373
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeSnapshot', 'workspace execution authority changed during recurring verification');
1374
+ }
1375
+ }
1376
+ /**
1377
+ * Proves that every tracked and non-ignored workspace byte still represents
1378
+ * the exact protected commit selected for receipt-minting execution. Ignored
1379
+ * dependency/cache state remains outside this local-integrity boundary and is
1380
+ * constrained separately by the generated reviewer.
1381
+ */
1382
+ function assertProtectedGitTreeAuthority(input, pathSelector, allowHeadDifference = false, readAuthorityFile = node_fs_1.readFileSync) {
1383
+ if (!FULL_GIT_OBJECT_ID.test(input.headCommit) ||
1384
+ !FULL_GIT_OBJECT_ID.test(input.protectedCommit) ||
1385
+ (!allowHeadDifference && input.headCommit !== input.protectedCommit) ||
1386
+ !['refs/remotes/origin/develop', 'refs/remotes/origin/main'].includes(input.protectedRef)) {
1387
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeAuthority', 'working-tree authority requires one exact protected HEAD commit');
1388
+ }
1389
+ const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(input.workspaceRoot));
1390
+ const context = {
1391
+ environment: supplyChainGitEnvironment(input.environment ?? process.env),
1392
+ executable: trustedGitExecutable(workspaceRoot),
1393
+ workspaceRoot,
1394
+ };
1395
+ const head = git(context, ['rev-parse', '--verify', 'HEAD^{commit}']);
1396
+ const protectedCommit = git(context, [
1397
+ 'rev-parse',
1398
+ '--verify',
1399
+ `${input.protectedRef}^{commit}`,
1400
+ ]);
1401
+ const treeOutput = git(context, [
1402
+ 'ls-tree',
1403
+ '-rz',
1404
+ '--full-tree',
1405
+ input.headCommit,
1406
+ ]);
1407
+ const protectedTreeOutput = allowHeadDifference
1408
+ ? git(context, ['ls-tree', '-rz', '--full-tree', input.protectedCommit])
1409
+ : treeOutput;
1410
+ const indexOutput = git(context, ['ls-files', '--stage', '-z']);
1411
+ const untracked = git(context, [
1412
+ 'ls-files',
1413
+ '--others',
1414
+ '--exclude-standard',
1415
+ '-z',
1416
+ ]);
1417
+ const tree = new Map();
1418
+ const treeAliases = new Set();
1419
+ for (const entry of (treeOutput ?? '').split('\0').filter(Boolean)) {
1420
+ const separator = entry.indexOf('\t');
1421
+ const rawPath = separator === -1 ? '' : entry.slice(separator + 1);
1422
+ if (pathSelector && !pathSelector(rawPath))
1423
+ continue;
1424
+ const match = /^(100644|100755|120000) blob ([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(entry);
1425
+ if (!match || !match[1] || !match[2] || !match[3]) {
1426
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeAuthority', 'protected tree contains an unsupported tracked entry');
1427
+ }
1428
+ const path = safeTrackedRepositoryPath(match[3], 'git.workingTreeAuthority.path');
1429
+ const alias = path.normalize('NFC').toLowerCase();
1430
+ if (tree.has(path) || treeAliases.has(alias)) {
1431
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'protected tree contains a duplicate, case, or Unicode aliased tracked path');
1432
+ }
1433
+ treeAliases.add(alias);
1434
+ tree.set(path, { mode: match[1], objectId: match[2] });
1435
+ }
1436
+ const protectedTree = new Map();
1437
+ const protectedTreeAliases = new Set();
1438
+ for (const entry of (protectedTreeOutput ?? '').split('\0').filter(Boolean)) {
1439
+ const separator = entry.indexOf('\t');
1440
+ const rawPath = separator === -1 ? '' : entry.slice(separator + 1);
1441
+ if (pathSelector && !pathSelector(rawPath))
1442
+ continue;
1443
+ const match = /^(100644|100755|120000) blob ([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(entry);
1444
+ if (!match || !match[1] || !match[2] || !match[3]) {
1445
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeAuthority', 'protected authority tree contains an unsupported tracked entry');
1446
+ }
1447
+ const path = safeTrackedRepositoryPath(match[3], 'git.workingTreeAuthority.path');
1448
+ const alias = path.normalize('NFC').toLowerCase();
1449
+ if (protectedTree.has(path) || protectedTreeAliases.has(alias)) {
1450
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'protected authority tree contains a duplicate, case, or Unicode aliased tracked path');
1451
+ }
1452
+ protectedTreeAliases.add(alias);
1453
+ protectedTree.set(path, { mode: match[1], objectId: match[2] });
1454
+ }
1455
+ const index = new Map();
1456
+ const indexAliases = new Set();
1457
+ for (const entry of (indexOutput ?? '').split('\0').filter(Boolean)) {
1458
+ const separator = entry.indexOf('\t');
1459
+ const rawPath = separator === -1 ? '' : entry.slice(separator + 1);
1460
+ if (pathSelector && !pathSelector(rawPath))
1461
+ continue;
1462
+ const match = /^(100644|100755|120000) ([a-f0-9]{40}|[a-f0-9]{64}) 0\t(.+)$/u.exec(entry);
1463
+ if (!match || !match[1] || !match[2] || !match[3]) {
1464
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeAuthority', 'index contains an unsupported or unresolved tracked entry');
1465
+ }
1466
+ const path = safeTrackedRepositoryPath(match[3], 'git.workingTreeAuthority.path');
1467
+ const alias = path.normalize('NFC').toLowerCase();
1468
+ if (index.has(path) || indexAliases.has(alias)) {
1469
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'index contains a duplicate, case, or Unicode aliased tracked path');
1470
+ }
1471
+ indexAliases.add(alias);
1472
+ index.set(path, { mode: match[1], objectId: match[2] });
1473
+ }
1474
+ const selectedUntracked = (untracked ?? '')
1475
+ .split('\0')
1476
+ .filter(Boolean)
1477
+ .filter((path) => !pathSelector || pathSelector(path))
1478
+ .map((path) => safeTrackedRepositoryPath(path, 'git.workingTreeAuthority.path'));
1479
+ const untrackedAliases = new Set();
1480
+ for (const path of selectedUntracked) {
1481
+ const alias = path.normalize('NFC').toLowerCase();
1482
+ if (untrackedAliases.has(alias) || treeAliases.has(alias)) {
1483
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'untracked authority contains a duplicate, case, or Unicode alias');
1484
+ }
1485
+ untrackedAliases.add(alias);
1486
+ }
1487
+ if (head !== input.headCommit ||
1488
+ protectedCommit !== input.protectedCommit ||
1489
+ selectedUntracked.length > 0 ||
1490
+ tree.size !== index.size ||
1491
+ tree.size !== protectedTree.size) {
1492
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeAuthority', 'protected review requires a clean current tree at the exact protected commit');
1493
+ }
1494
+ const assertCurrentWorkingBytes = (path, expected) => {
1495
+ const candidate = (0, node_path_1.join)(workspaceRoot, ...path.split('/'));
1496
+ const metadata = (0, node_fs_1.lstatSync)(candidate);
1497
+ if (!Number.isSafeInteger(metadata.size) ||
1498
+ metadata.size < 0 ||
1499
+ metadata.size > MAX_GIT_OUTPUT_BYTES) {
1500
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'working authority file exceeds the bounded byte contract');
1501
+ }
1502
+ const bytes = expected.mode === '120000'
1503
+ ? Buffer.from((0, node_fs_1.readlinkSync)(candidate), 'utf8')
1504
+ : readAuthorityFile(candidate);
1505
+ if ((expected.mode === '120000') !== metadata.isSymbolicLink() ||
1506
+ (expected.mode !== '120000' && !metadata.isFile()) ||
1507
+ (process.platform !== 'win32' &&
1508
+ expected.mode !== '120000' &&
1509
+ ((metadata.mode & 0o111) !== 0) !== (expected.mode === '100755')) ||
1510
+ (expected.mode !== '120000' && bytes.byteLength !== metadata.size) ||
1511
+ hashGitBlobLocally(bytes, expected.objectId) !== expected.objectId) {
1512
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'working bytes must equal the exact protected tree');
1513
+ }
1514
+ };
1515
+ for (const [path, expected] of tree) {
1516
+ const staged = index.get(path);
1517
+ const protectedExpected = protectedTree.get(path);
1518
+ if (!staged ||
1519
+ !protectedExpected ||
1520
+ staged.mode !== expected.mode ||
1521
+ staged.objectId !== expected.objectId ||
1522
+ protectedExpected.mode !== expected.mode ||
1523
+ protectedExpected.objectId !== expected.objectId) {
1524
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'index bytes must equal the exact protected tree');
1525
+ }
1526
+ assertCurrentWorkingBytes(path, expected);
1527
+ }
1528
+ for (const [path, expected] of tree) {
1529
+ assertCurrentWorkingBytes(path, expected);
1530
+ }
1531
+ const finalHead = git(context, ['rev-parse', '--verify', 'HEAD^{commit}']);
1532
+ const finalProtectedCommit = git(context, [
1533
+ 'rev-parse',
1534
+ '--verify',
1535
+ `${input.protectedRef}^{commit}`,
1536
+ ]);
1537
+ const finalIndexOutput = git(context, ['ls-files', '--stage', '-z']);
1538
+ const finalUntracked = git(context, [
1539
+ 'ls-files',
1540
+ '--others',
1541
+ '--exclude-standard',
1542
+ '-z',
1543
+ ]);
1544
+ const selectedIndexSignature = (output) => (output ?? '')
1545
+ .split('\0')
1546
+ .filter(Boolean)
1547
+ .filter((entry) => {
1548
+ const separator = entry.indexOf('\t');
1549
+ const path = separator === -1 ? '' : entry.slice(separator + 1);
1550
+ return !pathSelector || pathSelector(path);
1551
+ })
1552
+ .sort()
1553
+ .join('\0');
1554
+ const selectedUntrackedSignature = (output) => (output ?? '')
1555
+ .split('\0')
1556
+ .filter(Boolean)
1557
+ .filter((path) => !pathSelector || pathSelector(path))
1558
+ .sort()
1559
+ .join('\0');
1560
+ if (finalHead !== head ||
1561
+ finalProtectedCommit !== protectedCommit ||
1562
+ selectedIndexSignature(finalIndexOutput) !==
1563
+ selectedIndexSignature(indexOutput) ||
1564
+ selectedUntrackedSignature(finalUntracked) !==
1565
+ selectedUntrackedSignature(untracked)) {
1566
+ throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeAuthority', 'working-tree authority changed during exact inspection');
1567
+ }
1568
+ }
1569
+ function assertProtectedGitWorkingTreeAuthority(input) {
1570
+ assertProtectedGitTreeAuthority(input);
1571
+ }
1572
+ /**
1573
+ * Keeps ordinary source edits available while binding every receipt execution
1574
+ * authority byte, index entry, mode, and non-ignored untracked match to the
1575
+ * current protected commit. Reading working bytes directly also defeats Git
1576
+ * skip-worktree/assume-unchanged hints.
1577
+ */
1578
+ function assertProtectedGitVerificationExecutionAuthority(input, readAuthorityFile = node_fs_1.readFileSync) {
1579
+ assertProtectedGitTreeAuthority(input, blueprint_verification_authority_js_1.isBlueprintVerificationExecutionAuthorityPath, true, readAuthorityFile);
1580
+ }
1581
+ //# sourceMappingURL=blueprint-trust-git.js.map