@hiroshi.inoue/agent-spectrum-kernel 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1559) hide show
  1. package/LICENSE +21 -0
  2. package/README.ja.md +158 -0
  3. package/README.md +18 -2
  4. package/bin/ask.mjs +9 -0
  5. package/dist/AGENTS.md +266 -0
  6. package/dist/CHANGELOG.md +110 -0
  7. package/dist/CUSTOM_INSTRUCTIONS.md +72 -0
  8. package/dist/LICENSE +21 -0
  9. package/dist/README.md +19 -0
  10. package/dist/adapters/claude-code/README.md +185 -0
  11. package/dist/adapters/claude-code/github-actions/README.md +45 -0
  12. package/dist/adapters/claude-code/github-actions/claude-review-on-mention.yml +151 -0
  13. package/dist/adapters/claude-code/plugin/.claude-plugin/plugin.json +15 -0
  14. package/dist/adapters/claude-code/plugin/README.md +48 -0
  15. package/dist/adapters/claude-code/plugin/bin/ai-skills-metrics-record +18 -0
  16. package/dist/adapters/claude-code/plugin/contracts/claim-evidence-status-contract.md +60 -0
  17. package/dist/adapters/claude-code/plugin/contracts/execution-envelope-contract.md +105 -0
  18. package/dist/adapters/claude-code/plugin/contracts/lifecycle-traceability-contract.md +169 -0
  19. package/dist/adapters/claude-code/plugin/contracts/review-signal-gate-map.json +128 -0
  20. package/dist/adapters/claude-code/plugin/hooks/hooks.json +25 -0
  21. package/dist/adapters/claude-code/plugin/schemas/claim-evidence-status.schema.json +85 -0
  22. package/dist/adapters/claude-code/plugin/schemas/codex-risk-action.schema.json +58 -0
  23. package/dist/adapters/claude-code/plugin/schemas/codex-risk-approval-request.schema.json +204 -0
  24. package/dist/adapters/claude-code/plugin/schemas/execution-envelope.schema.json +127 -0
  25. package/dist/adapters/claude-code/plugin/schemas/metrics-event.schema.json +395 -0
  26. package/dist/adapters/claude-code/plugin/scripts/claim-evidence-status.mjs +162 -0
  27. package/dist/adapters/claude-code/plugin/skills/adoption-report/SKILL.md +19 -0
  28. package/dist/adapters/claude-code/plugin/skills/evidence-ledger/SKILL.md +96 -0
  29. package/dist/adapters/claude-code/plugin/skills/handoff/SKILL.md +36 -0
  30. package/dist/adapters/claude-code/plugin/skills/implement/SKILL.md +41 -0
  31. package/dist/adapters/claude-code/plugin/skills/implementation-context-check/SKILL.md +21 -0
  32. package/dist/adapters/claude-code/plugin/skills/investigate/SKILL.md +40 -0
  33. package/dist/adapters/claude-code/plugin/skills/ledger-refresh/SKILL.md +22 -0
  34. package/dist/adapters/claude-code/plugin/skills/review-pr/SKILL.md +54 -0
  35. package/dist/adapters/claude-code/plugin/skills/verify/SKILL.md +44 -0
  36. package/dist/adapters/claude-code/plugin/templates/handoff.md +30 -0
  37. package/dist/adapters/claude-code/plugin/templates/implement.md +35 -0
  38. package/dist/adapters/claude-code/plugin/templates/investigate.md +34 -0
  39. package/dist/adapters/claude-code/plugin/templates/review-pr.md +48 -0
  40. package/dist/adapters/claude-code/plugin/templates/verify.md +38 -0
  41. package/dist/adapters/claude-code/project/.claude/commands/skill-handoff.md +27 -0
  42. package/dist/adapters/claude-code/project/.claude/commands/skill-implement.md +32 -0
  43. package/dist/adapters/claude-code/project/.claude/commands/skill-investigate.md +29 -0
  44. package/dist/adapters/claude-code/project/.claude/commands/skill-ledger-refresh.md +22 -0
  45. package/dist/adapters/claude-code/project/.claude/commands/skill-report.md +17 -0
  46. package/dist/adapters/claude-code/project/.claude/commands/skill-review.md +43 -0
  47. package/dist/adapters/claude-code/project/.claude/commands/skill-verify.md +37 -0
  48. package/dist/adapters/claude-code/project/.claude/hooks/hooks.json +52 -0
  49. package/dist/adapters/claude-code/project/.claude/skills/README.md +11 -0
  50. package/dist/adapters/codex/README.md +128 -0
  51. package/dist/adapters/codex/commands/codex-exec.md +69 -0
  52. package/dist/adapters/codex/project/.agents/skills/README.md +36 -0
  53. package/dist/adapters/codex/prompts/skill-handoff.md +23 -0
  54. package/dist/adapters/codex/prompts/skill-implement.md +28 -0
  55. package/dist/adapters/codex/prompts/skill-investigate.md +27 -0
  56. package/dist/adapters/codex/prompts/skill-review.md +44 -0
  57. package/dist/adapters/codex/prompts/skill-verify.md +28 -0
  58. package/dist/benchmarks/README.md +125 -0
  59. package/dist/benchmarks/adaptive-portfolio.config.json +439 -0
  60. package/dist/benchmarks/admission-decision-overlay.md +72 -0
  61. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/common/operation-and-observation.md +35 -0
  62. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch02-report-operations/TASK.md +15 -0
  63. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch02-report-operations/acceptance.md +29 -0
  64. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch02-report-operations/business-decisions.md +21 -0
  65. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch02-report-operations/contract.md +37 -0
  66. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch02-report-operations/delivery-provider.md +7 -0
  67. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch02-report-operations/fixture-format.md +13 -0
  68. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch02-report-operations/fixtures/example.json +237 -0
  69. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch02-report-operations/goal-pr.txt +5 -0
  70. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch02-report-operations/nonfunctional.md +3 -0
  71. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch02-report-operations/prompt.txt +5 -0
  72. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch02-report-operations/roles.md +24 -0
  73. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch02-report-operations/workflows.md +35 -0
  74. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch03-price-rollout/TASK.md +15 -0
  75. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch03-price-rollout/acceptance.md +30 -0
  76. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch03-price-rollout/business-decisions.md +23 -0
  77. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch03-price-rollout/contract.md +45 -0
  78. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch03-price-rollout/fixture-format.md +15 -0
  79. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch03-price-rollout/fixtures/campaign-stores.json +284 -0
  80. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch03-price-rollout/fixtures/example.json +299 -0
  81. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch03-price-rollout/goal-pr.txt +5 -0
  82. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch03-price-rollout/nonfunctional.md +3 -0
  83. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch03-price-rollout/prompt.txt +5 -0
  84. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch03-price-rollout/roles.md +28 -0
  85. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch03-price-rollout/workflows.md +35 -0
  86. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch04-document-access/TASK.md +15 -0
  87. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch04-document-access/acceptance.md +30 -0
  88. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch04-document-access/business-decisions.md +23 -0
  89. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch04-document-access/contract.md +39 -0
  90. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch04-document-access/fixture-format.md +11 -0
  91. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch04-document-access/fixtures/dossier-delivery.json +325 -0
  92. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch04-document-access/fixtures/example.json +289 -0
  93. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch04-document-access/goal-pr.txt +5 -0
  94. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch04-document-access/nonfunctional.md +3 -0
  95. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch04-document-access/prompt.txt +5 -0
  96. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch04-document-access/roles.md +27 -0
  97. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch04-document-access/workflows.md +35 -0
  98. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch05-sales-reconciliation/TASK.md +15 -0
  99. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch05-sales-reconciliation/acceptance.md +30 -0
  100. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch05-sales-reconciliation/business-decisions.md +27 -0
  101. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch05-sales-reconciliation/contract.md +39 -0
  102. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch05-sales-reconciliation/fixture-format.md +11 -0
  103. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch05-sales-reconciliation/fixtures/example.json +276 -0
  104. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch05-sales-reconciliation/goal-pr.txt +5 -0
  105. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch05-sales-reconciliation/nonfunctional.md +3 -0
  106. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch05-sales-reconciliation/prompt.txt +5 -0
  107. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch05-sales-reconciliation/roles.md +27 -0
  108. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch05-sales-reconciliation/workflows.md +35 -0
  109. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch06-build-operations/TASK.md +15 -0
  110. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch06-build-operations/acceptance.md +30 -0
  111. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch06-build-operations/business-decisions.md +23 -0
  112. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch06-build-operations/compiler-provider.md +9 -0
  113. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch06-build-operations/contract.md +39 -0
  114. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch06-build-operations/fixture-format.md +11 -0
  115. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch06-build-operations/fixtures/example.json +292 -0
  116. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch06-build-operations/goal-pr.txt +5 -0
  117. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch06-build-operations/nonfunctional.md +3 -0
  118. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch06-build-operations/prompt.txt +5 -0
  119. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch06-build-operations/roles.md +25 -0
  120. package/dist/benchmarks/challenge-candidates/business-five-v3-decisions/public/tasks/ch06-build-operations/workflows.md +35 -0
  121. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/evaluation-protocol.md +58 -0
  122. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/LICENSE +21 -0
  123. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/PROVENANCE.md +9 -0
  124. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/README-ja.md +29 -0
  125. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/README.md +47 -0
  126. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/brief/adr/001-local-storage.md +6 -0
  127. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/brief/adr/007-shared-boundary.md +9 -0
  128. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/brief/adr/009-retention-draft.md +4 -0
  129. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/brief/architecture.md +29 -0
  130. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/brief/contracts.md +14 -0
  131. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/brief/library-policy.md +16 -0
  132. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/brief/open-decisions.md +10 -0
  133. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/brief/release.md +32 -0
  134. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/brief/spec-index.md +17 -0
  135. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/docs/design.md +1624 -0
  136. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/docs/requirements.md +1194 -0
  137. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/eslint.config.mjs +23 -0
  138. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/evidence/ci-summary.json +11 -0
  139. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/evidence/operational-observations.md +11 -0
  140. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/evidence/pilot-desk/approval-history.csv +6 -0
  141. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/evidence/pilot-desk/batches.csv +21 -0
  142. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/evidence/pilot-desk/bookings.csv +6 -0
  143. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/evidence/pilot-desk/clearance.csv +6 -0
  144. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/evidence/pilot-desk/desk-ledger.csv +13 -0
  145. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/evidence/pilot-desk/service-agreement.md +11 -0
  146. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/evidence/pilot-desk/signoffs.csv +12 -0
  147. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/evidence/previous-readiness-note.md +7 -0
  148. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/package.json +26 -0
  149. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/package.json +21 -0
  150. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/action-log.test.ts +32 -0
  151. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/artifact-store.test.ts +64 -0
  152. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/command-catalog.test.ts +89 -0
  153. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/config-store.test.ts +28 -0
  154. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/core-info.test.ts +13 -0
  155. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/cycle-meta.test.ts +491 -0
  156. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/field-report.test.ts +107 -0
  157. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/fix-flow.test.ts +289 -0
  158. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/flow-manifest.test.ts +126 -0
  159. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/flow-run.test.ts +44 -0
  160. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/knowledge-capture.test.ts +288 -0
  161. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/meta-status.test.ts +109 -0
  162. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/p0-readiness.test.ts +192 -0
  163. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/project-context.test.ts +172 -0
  164. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/project-init.test.ts +82 -0
  165. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/prompt-renderer.test.ts +87 -0
  166. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/prompt-template.test.ts +55 -0
  167. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/response-import.test.ts +40 -0
  168. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/response-normalize.test.ts +59 -0
  169. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/review-resolution.test.ts +187 -0
  170. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/review-work-metrics.test.ts +173 -0
  171. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/runtime-ports.test.ts +118 -0
  172. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/__tests__/skill-evidence.test.ts +101 -0
  173. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/actions/action-log.ts +48 -0
  174. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/application/project-context.ts +291 -0
  175. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/application/project-init.ts +224 -0
  176. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/artifacts/artifact-store.ts +2 -0
  177. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/artifacts/open-artifact.ts +21 -0
  178. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/config/config-store.ts +73 -0
  179. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/cycles/state.ts +799 -0
  180. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/domain/artifacts.ts +20 -0
  181. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/domain/diff-classification.ts +65 -0
  182. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/flows/manifest.ts +1648 -0
  183. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/flows/run.ts +77 -0
  184. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/index.ts +48 -0
  185. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/infrastructure/fs/artifact-store.ts +60 -0
  186. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/infrastructure/fs/runtime.ts +22 -0
  187. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/infrastructure/fs/workspace-store.ts +107 -0
  188. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/infrastructure/memory/runtime.ts +185 -0
  189. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/knowledge/capture.ts +666 -0
  190. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/meta/command-catalog.ts +909 -0
  191. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/meta/readiness.ts +519 -0
  192. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/meta/status.ts +58 -0
  193. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/metrics/review-work.ts +317 -0
  194. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/ports/artifact-store.ts +16 -0
  195. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/ports/runtime.ts +56 -0
  196. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/project/context.ts +46 -0
  197. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/project/init.ts +20 -0
  198. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/prompts/render.ts +369 -0
  199. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/prompts/templates.ts +153 -0
  200. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/reports/field-report.ts +230 -0
  201. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/responses/import.ts +127 -0
  202. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/responses/normalize.ts +389 -0
  203. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/reviews/action-plan-understanding.ts +136 -0
  204. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/reviews/comment-resolution.ts +605 -0
  205. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/reviews/fix-flow.ts +863 -0
  206. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/serialization/json.ts +18 -0
  207. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/serialization/paths.ts +27 -0
  208. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/serialization/yaml.ts +20 -0
  209. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/skill/evidence.ts +207 -0
  210. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/src/types.ts +634 -0
  211. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/core/tsconfig.json +10 -0
  212. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/README.md +18 -0
  213. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/package.json +13 -0
  214. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/public/app.js +357 -0
  215. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/public/index.html +35 -0
  216. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/public/styles.css +172 -0
  217. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/API.md +41 -0
  218. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/access.mjs +17 -0
  219. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/app.mjs +320 -0
  220. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/artifacts.mjs +81 -0
  221. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/core-bridge.mjs +48 -0
  222. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/errors.mjs +9 -0
  223. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/fixtures.mjs +75 -0
  224. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/index.mjs +14 -0
  225. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/jobs.mjs +93 -0
  226. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/journal.mjs +46 -0
  227. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/provider.mjs +59 -0
  228. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/reviews.mjs +80 -0
  229. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/server/store.mjs +105 -0
  230. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/test/helpers/review-fixture.mjs +9 -0
  231. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/test/persistence.test.mjs +60 -0
  232. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/portal/test/portal.test.mjs +364 -0
  233. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/providers/package.json +21 -0
  234. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/providers/src/__tests__/github.test.ts +335 -0
  235. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/providers/src/__tests__/local-git.test.ts +98 -0
  236. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/providers/src/__tests__/provider-boundary.test.ts +18 -0
  237. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/providers/src/github.ts +643 -0
  238. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/providers/src/index.ts +54 -0
  239. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/providers/src/local-git.ts +520 -0
  240. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/providers/tsconfig.json +15 -0
  241. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/l10n/bundle.l10n.ja.json +868 -0
  242. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/l10n/bundle.l10n.json +868 -0
  243. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/package.json +474 -0
  244. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/package.nls.ja.json +38 -0
  245. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/package.nls.json +38 -0
  246. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/resources/reviewops-activitybar.svg +12 -0
  247. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/resources/reviewops-command-dark.svg +12 -0
  248. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/resources/reviewops-command-light.svg +12 -0
  249. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/resources/reviewops_guard_icon_128.png +0 -0
  250. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/artifact-browser.ts +380 -0
  251. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/artifact-loader.ts +460 -0
  252. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/command-center-renderer.ts +1341 -0
  253. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/command-center-results.ts +183 -0
  254. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/command-center.ts +819 -0
  255. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/extension-runtime.ts +2670 -0
  256. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/extension.ts +1 -0
  257. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/localization.ts +19 -0
  258. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/publish-draft-artifacts.ts +58 -0
  259. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/review-targets.ts +178 -0
  260. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/review-work-artifacts.ts +200 -0
  261. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/run-id.ts +3 -0
  262. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/scoped-cycle-prompt.ts +119 -0
  263. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/tree-views.ts +243 -0
  264. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/src/webview-renderers.ts +184 -0
  265. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/packages/vscode-extension/tsconfig.json +18 -0
  266. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/pnpm-lock.yaml +1708 -0
  267. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/pnpm-workspace.yaml +2 -0
  268. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/scripts/check-policy.mjs +14 -0
  269. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/scripts/generate-vsix.command +226 -0
  270. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/scripts/pilot-board.mjs +20 -0
  271. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/scripts/policy-checker.mjs +145 -0
  272. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/scripts/smoke-vsix.command +129 -0
  273. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/task.md +11 -0
  274. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/tests/policy/ai-network-guard.test.ts +9 -0
  275. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/tests/vscode-extension-activation.test.ts +474 -0
  276. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/tests/vscode-extension-artifacts.test.ts +2087 -0
  277. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/tests/vscode-extension-package.test.ts +336 -0
  278. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/tests/vsix-smoke-command.test.ts +32 -0
  279. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/tsconfig.base.json +15 -0
  280. package/dist/benchmarks/challenge-candidates/review-ceiling-v1/workspace/vitest.config.ts +11 -0
  281. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/README.md +66 -0
  282. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/brief/data-contract.md +51 -0
  283. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/brief/rubric.json +756 -0
  284. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/brief/scenarios.json +333 -0
  285. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/brief/spec.md +35 -0
  286. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/fixtures/assessment-valid.json +53 -0
  287. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/fixtures/assessment-wrong-evidence.json +53 -0
  288. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/fixtures/backup-dangling.json +565 -0
  289. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/fixtures/career-valid.json +51 -0
  290. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/fixtures/plan-over-limit.json +61 -0
  291. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/fixtures/plan-valid.json +61 -0
  292. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/fixtures/plan-wrong-request.json +61 -0
  293. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/fixtures/seed.json +565 -0
  294. package/dist/benchmarks/challenge-candidates/ui-reconstruction-v1/workspace/task.md +29 -0
  295. package/dist/benchmarks/contracts/rule-batch/2.0.0/bundle.json +270 -0
  296. package/dist/benchmarks/contracts/rule-batch/2.0.0/examples/mutants.mjs +129 -0
  297. package/dist/benchmarks/contracts/rule-batch/2.0.0/examples/reference.mjs +150 -0
  298. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/cases.mjs +261 -0
  299. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/contract.test.mjs +5 -0
  300. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/legacy-baseline/src/errors.mjs +17 -0
  301. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/legacy-baseline/src/index.mjs +3 -0
  302. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/legacy-baseline/src/rule-service.mjs +27 -0
  303. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/legacy-baseline/src/rule-store.mjs +38 -0
  304. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/legacy-baseline/src/validation.mjs +20 -0
  305. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/legacy-case-ids.json +458 -0
  306. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/legacy-results.mjs +37 -0
  307. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/legacy-verifier.v1.2.mjs +115 -0
  308. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/legacy.test.mjs +4 -0
  309. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/r1.test.mjs +10 -0
  310. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/r10.test.mjs +10 -0
  311. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/r2.test.mjs +10 -0
  312. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/r3.test.mjs +10 -0
  313. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/r4.test.mjs +10 -0
  314. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/r5.test.mjs +10 -0
  315. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/r6.test.mjs +10 -0
  316. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/r7.test.mjs +10 -0
  317. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/r8.test.mjs +10 -0
  318. package/dist/benchmarks/contracts/rule-batch/2.0.0/fixed/r9.test.mjs +10 -0
  319. package/dist/benchmarks/contracts/rule-batch/2.0.0/history.json +27 -0
  320. package/dist/benchmarks/contracts/rule-batch/2.0.0/requirements.json +547 -0
  321. package/dist/benchmarks/contracts/rule-batch/2.0.0/seed/docs/rule-batch.schema.json +27 -0
  322. package/dist/benchmarks/contracts/rule-batch/2.0.0/seed/docs/rule-batches.md +140 -0
  323. package/dist/benchmarks/contracts/rule-batch/2.0.0/seed/package.json +7 -0
  324. package/dist/benchmarks/contracts/rule-batch/2.0.0/seed/src/errors.mjs +17 -0
  325. package/dist/benchmarks/contracts/rule-batch/2.0.0/seed/src/index.mjs +3 -0
  326. package/dist/benchmarks/contracts/rule-batch/2.0.0/seed/src/rule-service.mjs +27 -0
  327. package/dist/benchmarks/contracts/rule-batch/2.0.0/seed/src/rule-store.mjs +38 -0
  328. package/dist/benchmarks/contracts/rule-batch/2.0.0/seed/src/validation.mjs +20 -0
  329. package/dist/benchmarks/contracts/rule-batch/2.0.0/seed/test/rule-service.test.mjs +34 -0
  330. package/dist/benchmarks/contracts/rule-batch/2.0.0/spec.md +140 -0
  331. package/dist/benchmarks/contracts/rule-batch/2.0.0/task.md +35 -0
  332. package/dist/benchmarks/contracts/rule-batch/2.0.0/verification-contract.md +56 -0
  333. package/dist/benchmarks/contracts/rule-batch/2.0.0/verification.json +100 -0
  334. package/dist/benchmarks/evaluation-tasks.json +1645 -0
  335. package/dist/benchmarks/evaluator-boundary.md +107 -0
  336. package/dist/benchmarks/portfolio-admission-policy.json +1171 -0
  337. package/dist/benchmarks/portfolio-catalog.json +837 -0
  338. package/dist/benchmarks/portfolio-design-admission-manifest.json +170 -0
  339. package/dist/benchmarks/portfolio-design-admission-records/hi-authorization-exception.json +99 -0
  340. package/dist/benchmarks/portfolio-design-admission-records/hi-external-action-approval.json +105 -0
  341. package/dist/benchmarks/portfolio-design-admission-records/hi-financial-state-integrity.json +105 -0
  342. package/dist/benchmarks/portfolio-design-admission-records/hi-versioned-migration-safety.json +108 -0
  343. package/dist/benchmarks/portfolio-design-admission-records/mn-build-option-update.json +108 -0
  344. package/dist/benchmarks/portfolio-design-admission-records/mn-client-compatibility-fix.json +108 -0
  345. package/dist/benchmarks/portfolio-design-admission-records/mn-doc-config-correction.json +108 -0
  346. package/dist/benchmarks/portfolio-design-admission-records/mn-focused-regression-test.json +108 -0
  347. package/dist/benchmarks/portfolio-design-admission-records/mn-frontend-default-fix.json +108 -0
  348. package/dist/benchmarks/portfolio-design-admission-records/mn-schema-field-alignment.json +108 -0
  349. package/dist/benchmarks/portfolio-design-admission-records/mp-accessibility-interaction-review.json +103 -0
  350. package/dist/benchmarks/portfolio-design-admission-records/mp-ci-evidence-gap.json +103 -0
  351. package/dist/benchmarks/portfolio-design-admission-records/mp-data-migration-handoff.json +108 -0
  352. package/dist/benchmarks/portfolio-design-admission-records/mp-frontend-state-review.json +103 -0
  353. package/dist/benchmarks/portfolio-design-admission-records/mp-iac-rollback-design.json +106 -0
  354. package/dist/benchmarks/portfolio-design-admission-records/mp-performance-investigation.json +106 -0
  355. package/dist/benchmarks/portfolio-design-admission-records/pf-api-pagination-behavior.json +108 -0
  356. package/dist/benchmarks/portfolio-design-admission-records/pf-ci-cache-flake.json +106 -0
  357. package/dist/benchmarks/portfolio-design-admission-records/pf-data-schema-evolution.json +105 -0
  358. package/dist/benchmarks/portfolio-design-admission-records/pf-frontend-async-state.json +108 -0
  359. package/dist/benchmarks/portfolio-design-admission-records/pf-library-compat-upgrade.json +105 -0
  360. package/dist/benchmarks/portfolio-design-admission-records/pf-observability-redaction.json +99 -0
  361. package/dist/benchmarks/portfolio-design-admission-records/pf-performance-regression.json +108 -0
  362. package/dist/benchmarks/portfolio-design-admission-records/pf-review-error-contract.json +103 -0
  363. package/dist/benchmarks/portfolio-design-independent-review.json +1666 -0
  364. package/dist/benchmarks/portfolio-design-review-package.json +249 -0
  365. package/dist/benchmarks/portfolio-design-reviewed-state.json +152 -0
  366. package/dist/benchmarks/portfolio-high-impact-sensitivity-policy.json +40 -0
  367. package/dist/benchmarks/portfolio-lineage-policy.json +213 -0
  368. package/dist/benchmarks/portfolio-policy-manifest.json +32 -0
  369. package/dist/benchmarks/portfolio-scoring-policy.json +589 -0
  370. package/dist/benchmarks/portfolio-similarity.json +2222 -0
  371. package/dist/benchmarks/prompt-v2-preregistration.json +411 -0
  372. package/dist/benchmarks/protocol-adaptive.md +487 -0
  373. package/dist/benchmarks/protocol-b2.md +113 -0
  374. package/dist/benchmarks/protocol-prompt-v2.md +108 -0
  375. package/dist/benchmarks/protocol.md +122 -0
  376. package/dist/benchmarks/report-template.md +61 -0
  377. package/dist/benchmarks/schemas/adaptive-selection-input.schema.json +82 -0
  378. package/dist/benchmarks/schemas/adaptive-selection-state.schema.json +45 -0
  379. package/dist/benchmarks/schemas/adaptive-selection.schema.json +137 -0
  380. package/dist/benchmarks/schemas/agent-output.schema.json +66 -0
  381. package/dist/benchmarks/schemas/core-evaluator-result-envelope.schema.json +708 -0
  382. package/dist/benchmarks/schemas/core-native-compatibility-provenance.schema.json +130 -0
  383. package/dist/benchmarks/schemas/core-normalized-portfolio-result.schema.json +945 -0
  384. package/dist/benchmarks/schemas/core-normalized-portfolio-run.schema.json +676 -0
  385. package/dist/benchmarks/schemas/core-original-workspace-authority.schema.json +315 -0
  386. package/dist/benchmarks/schemas/core-portfolio-command-evidence.schema.json +548 -0
  387. package/dist/benchmarks/schemas/core-portfolio-engineering-result.schema.json +1187 -0
  388. package/dist/benchmarks/schemas/core-portfolio-terminal-workspace-authority.schema.json +395 -0
  389. package/dist/benchmarks/schemas/core-repository-diff-artifact.schema.json +253 -0
  390. package/dist/benchmarks/schemas/evaluation-input-failure-artifact.schema.json +36 -0
  391. package/dist/benchmarks/schemas/evaluator-authority-manifest.schema.json +63 -0
  392. package/dist/benchmarks/schemas/evaluator-check-artifact.schema.json +35 -0
  393. package/dist/benchmarks/schemas/evaluator-reference.schema.json +129 -0
  394. package/dist/benchmarks/schemas/evaluator-result-envelope.schema.json +261 -0
  395. package/dist/benchmarks/schemas/execution-plan.schema.json +121 -0
  396. package/dist/benchmarks/schemas/materialization-manifest.schema.json +187 -0
  397. package/dist/benchmarks/schemas/normalized-portfolio-result.schema.json +379 -0
  398. package/dist/benchmarks/schemas/normalized-portfolio-root.schema.json +49 -0
  399. package/dist/benchmarks/schemas/normalized-portfolio-run.schema.json +289 -0
  400. package/dist/benchmarks/schemas/original-workspace-authority.schema.json +99 -0
  401. package/dist/benchmarks/schemas/portfolio-adapter-identity.schema.json +148 -0
  402. package/dist/benchmarks/schemas/portfolio-admission-decision.schema.json +140 -0
  403. package/dist/benchmarks/schemas/portfolio-admission-policy.schema.json +347 -0
  404. package/dist/benchmarks/schemas/portfolio-admission-review-authority.schema.json +60 -0
  405. package/dist/benchmarks/schemas/portfolio-aggregate-result-v2.schema.json +1107 -0
  406. package/dist/benchmarks/schemas/portfolio-aggregate-result.schema.json +140 -0
  407. package/dist/benchmarks/schemas/portfolio-attempt-commit.schema.json +30 -0
  408. package/dist/benchmarks/schemas/portfolio-attempt-request.schema.json +134 -0
  409. package/dist/benchmarks/schemas/portfolio-attempt-result.schema.json +256 -0
  410. package/dist/benchmarks/schemas/portfolio-case-state.schema.json +38 -0
  411. package/dist/benchmarks/schemas/portfolio-catalog.schema.json +122 -0
  412. package/dist/benchmarks/schemas/portfolio-claim.schema.json +72 -0
  413. package/dist/benchmarks/schemas/portfolio-classification-record.schema.json +46 -0
  414. package/dist/benchmarks/schemas/portfolio-command-evidence.schema.json +122 -0
  415. package/dist/benchmarks/schemas/portfolio-config.schema.json +138 -0
  416. package/dist/benchmarks/schemas/portfolio-consumer-report.schema.json +289 -0
  417. package/dist/benchmarks/schemas/portfolio-design-admission-manifest.schema.json +76 -0
  418. package/dist/benchmarks/schemas/portfolio-design-admission-record.schema.json +205 -0
  419. package/dist/benchmarks/schemas/portfolio-design-independent-review.schema.json +264 -0
  420. package/dist/benchmarks/schemas/portfolio-design-review-package.schema.json +96 -0
  421. package/dist/benchmarks/schemas/portfolio-design-reviewed-state.schema.json +99 -0
  422. package/dist/benchmarks/schemas/portfolio-directional-outcome-report.schema.json +164 -0
  423. package/dist/benchmarks/schemas/portfolio-engineering-result-set.schema.json +222 -0
  424. package/dist/benchmarks/schemas/portfolio-engineering-result-source-manifest.schema.json +93 -0
  425. package/dist/benchmarks/schemas/portfolio-engineering-result.schema.json +515 -0
  426. package/dist/benchmarks/schemas/portfolio-evolution-binding.schema.json +71 -0
  427. package/dist/benchmarks/schemas/portfolio-final-admission-record.schema.json +125 -0
  428. package/dist/benchmarks/schemas/portfolio-high-impact-sensitivity-policy.schema.json +44 -0
  429. package/dist/benchmarks/schemas/portfolio-high-impact-sensitivity-registration.schema.json +136 -0
  430. package/dist/benchmarks/schemas/portfolio-high-impact-sensitivity-report.schema.json +384 -0
  431. package/dist/benchmarks/schemas/portfolio-legacy-calibration-migration.schema.json +308 -0
  432. package/dist/benchmarks/schemas/portfolio-lineage-policy.schema.json +180 -0
  433. package/dist/benchmarks/schemas/portfolio-lineage-record.schema.json +52 -0
  434. package/dist/benchmarks/schemas/portfolio-mechanism-scorecard.schema.json +197 -0
  435. package/dist/benchmarks/schemas/portfolio-output-contract.schema.json +52 -0
  436. package/dist/benchmarks/schemas/portfolio-paired-comparison-report.schema.json +346 -0
  437. package/dist/benchmarks/schemas/portfolio-policy-manifest.schema.json +85 -0
  438. package/dist/benchmarks/schemas/portfolio-repetition-report.schema.json +204 -0
  439. package/dist/benchmarks/schemas/portfolio-requirement-record.schema.json +72 -0
  440. package/dist/benchmarks/schemas/portfolio-run-identity.schema.json +58 -0
  441. package/dist/benchmarks/schemas/portfolio-runtime-config.schema.json +147 -0
  442. package/dist/benchmarks/schemas/portfolio-scoring-policy.schema.json +497 -0
  443. package/dist/benchmarks/schemas/portfolio-similarity.schema.json +64 -0
  444. package/dist/benchmarks/schemas/portfolio-terminal-workspace-authority.schema.json +134 -0
  445. package/dist/benchmarks/schemas/portfolio-verification-command-contract.schema.json +69 -0
  446. package/dist/benchmarks/schemas/primary-evaluator-result-envelope.schema.json +708 -0
  447. package/dist/benchmarks/schemas/primary-k2-evaluator-result-envelope.schema.json +708 -0
  448. package/dist/benchmarks/schemas/primary-k2-normalized-portfolio-result.schema.json +945 -0
  449. package/dist/benchmarks/schemas/primary-k2-normalized-portfolio-run.schema.json +676 -0
  450. package/dist/benchmarks/schemas/primary-k2-original-workspace-authority.schema.json +315 -0
  451. package/dist/benchmarks/schemas/primary-k2-portfolio-command-evidence.schema.json +554 -0
  452. package/dist/benchmarks/schemas/primary-k2-portfolio-engineering-result.schema.json +1187 -0
  453. package/dist/benchmarks/schemas/primary-k2-portfolio-terminal-workspace-authority.schema.json +395 -0
  454. package/dist/benchmarks/schemas/primary-k2-repository-diff-artifact.schema.json +253 -0
  455. package/dist/benchmarks/schemas/primary-k2-saved-v10-evaluator-result-envelope.schema.json +3604 -0
  456. package/dist/benchmarks/schemas/primary-k2-saved-v10-normalized-portfolio-result.schema.json +3804 -0
  457. package/dist/benchmarks/schemas/primary-k2-saved-v10-portfolio-command-evidence.schema.json +3531 -0
  458. package/dist/benchmarks/schemas/primary-k2-saved-v10-portfolio-engineering-result.schema.json +4126 -0
  459. package/dist/benchmarks/schemas/primary-k2-saved-v2-portfolio-command-evidence.schema.json +548 -0
  460. package/dist/benchmarks/schemas/primary-k2-saved-v3-portfolio-command-evidence.schema.json +548 -0
  461. package/dist/benchmarks/schemas/primary-k2-saved-v4-portfolio-command-evidence.schema.json +548 -0
  462. package/dist/benchmarks/schemas/primary-k2-saved-v5-portfolio-command-evidence.schema.json +558 -0
  463. package/dist/benchmarks/schemas/primary-k2-saved-v6-portfolio-command-evidence.schema.json +668 -0
  464. package/dist/benchmarks/schemas/primary-k2-saved-v7-evaluator-result-envelope.schema.json +708 -0
  465. package/dist/benchmarks/schemas/primary-k2-saved-v7-portfolio-command-evidence.schema.json +676 -0
  466. package/dist/benchmarks/schemas/primary-k2-saved-v8-evaluator-result-envelope.schema.json +760 -0
  467. package/dist/benchmarks/schemas/primary-k2-saved-v8-normalized-portfolio-result.schema.json +960 -0
  468. package/dist/benchmarks/schemas/primary-k2-saved-v8-portfolio-command-evidence.schema.json +687 -0
  469. package/dist/benchmarks/schemas/primary-k2-saved-v8-portfolio-engineering-result.schema.json +1282 -0
  470. package/dist/benchmarks/schemas/primary-k2-saved-v9-evaluator-result-envelope.schema.json +760 -0
  471. package/dist/benchmarks/schemas/primary-k2-saved-v9-normalized-portfolio-result.schema.json +960 -0
  472. package/dist/benchmarks/schemas/primary-k2-saved-v9-portfolio-command-evidence.schema.json +687 -0
  473. package/dist/benchmarks/schemas/primary-k2-saved-v9-portfolio-engineering-result.schema.json +1282 -0
  474. package/dist/benchmarks/schemas/primary-normalized-portfolio-result.schema.json +945 -0
  475. package/dist/benchmarks/schemas/primary-normalized-portfolio-run.schema.json +676 -0
  476. package/dist/benchmarks/schemas/primary-original-workspace-authority.schema.json +315 -0
  477. package/dist/benchmarks/schemas/primary-portfolio-command-evidence.schema.json +554 -0
  478. package/dist/benchmarks/schemas/primary-portfolio-engineering-result.schema.json +1187 -0
  479. package/dist/benchmarks/schemas/primary-portfolio-terminal-workspace-authority.schema.json +395 -0
  480. package/dist/benchmarks/schemas/primary-public-capability-selection-v2.schema.json +31 -0
  481. package/dist/benchmarks/schemas/primary-repository-diff-artifact.schema.json +253 -0
  482. package/dist/benchmarks/schemas/primary-runtime-v10-binding.schema.json +2843 -0
  483. package/dist/benchmarks/schemas/primary-saved-v10-evaluator-result-envelope.schema.json +3604 -0
  484. package/dist/benchmarks/schemas/primary-saved-v10-normalized-portfolio-result.schema.json +3804 -0
  485. package/dist/benchmarks/schemas/primary-saved-v10-portfolio-command-evidence.schema.json +3531 -0
  486. package/dist/benchmarks/schemas/primary-saved-v10-portfolio-engineering-result.schema.json +4126 -0
  487. package/dist/benchmarks/schemas/primary-saved-v2-portfolio-command-evidence.schema.json +548 -0
  488. package/dist/benchmarks/schemas/primary-saved-v3-portfolio-command-evidence.schema.json +548 -0
  489. package/dist/benchmarks/schemas/primary-saved-v4-portfolio-command-evidence.schema.json +548 -0
  490. package/dist/benchmarks/schemas/primary-saved-v5-portfolio-command-evidence.schema.json +558 -0
  491. package/dist/benchmarks/schemas/primary-saved-v6-portfolio-command-evidence.schema.json +668 -0
  492. package/dist/benchmarks/schemas/primary-saved-v7-evaluator-result-envelope.schema.json +708 -0
  493. package/dist/benchmarks/schemas/primary-saved-v7-portfolio-command-evidence.schema.json +676 -0
  494. package/dist/benchmarks/schemas/primary-saved-v8-evaluator-result-envelope.schema.json +760 -0
  495. package/dist/benchmarks/schemas/primary-saved-v8-normalized-portfolio-result.schema.json +960 -0
  496. package/dist/benchmarks/schemas/primary-saved-v8-portfolio-command-evidence.schema.json +687 -0
  497. package/dist/benchmarks/schemas/primary-saved-v8-portfolio-engineering-result.schema.json +1282 -0
  498. package/dist/benchmarks/schemas/primary-saved-v9-evaluator-result-envelope.schema.json +760 -0
  499. package/dist/benchmarks/schemas/primary-saved-v9-normalized-portfolio-result.schema.json +960 -0
  500. package/dist/benchmarks/schemas/primary-saved-v9-portfolio-command-evidence.schema.json +687 -0
  501. package/dist/benchmarks/schemas/primary-saved-v9-portfolio-engineering-result.schema.json +1282 -0
  502. package/dist/benchmarks/schemas/private-evaluation-record.schema.json +311 -0
  503. package/dist/benchmarks/schemas/private-evaluator-bundle.schema.json +224 -0
  504. package/dist/benchmarks/schemas/private-evaluator-fragment.schema.json +140 -0
  505. package/dist/benchmarks/schemas/private-evaluator-independence-statement.schema.json +168 -0
  506. package/dist/benchmarks/schemas/prompt-v2-comparison-report.schema.json +94 -0
  507. package/dist/benchmarks/schemas/prompt-v2-execution-plan.schema.json +115 -0
  508. package/dist/benchmarks/schemas/prompt-v2-materialization-manifest.schema.json +58 -0
  509. package/dist/benchmarks/schemas/prompt-v2-normalized-result.schema.json +109 -0
  510. package/dist/benchmarks/schemas/prompt-v2-preregistration.schema.json +266 -0
  511. package/dist/benchmarks/schemas/prompt-v2-resume-state.schema.json +60 -0
  512. package/dist/benchmarks/schemas/repository-diff-artifact.schema.json +78 -0
  513. package/dist/benchmarks/schemas/result.schema.json +292 -0
  514. package/dist/benchmarks/schemas/runtime-observation-carrier.schema.json +480 -0
  515. package/dist/benchmarks/schemas/scoring-input-freeze-manifest.schema.json +77 -0
  516. package/dist/benchmarks/task-revisions/ch01-inventory-reservation-logistics/rubric.json +41 -0
  517. package/dist/benchmarks/task-revisions/ch02-report-operations/input-manifest.json +141 -0
  518. package/dist/benchmarks/task-revisions/ch02-report-operations/rubric.json +40 -0
  519. package/dist/benchmarks/task-revisions/ch03-price-rollout/input-manifest.json +141 -0
  520. package/dist/benchmarks/task-revisions/ch03-price-rollout/rubric.json +49 -0
  521. package/dist/benchmarks/task-revisions/ch04-document-access/input-manifest.json +141 -0
  522. package/dist/benchmarks/task-revisions/ch04-document-access/rubric.json +49 -0
  523. package/dist/benchmarks/task-revisions/ch05-sales-reconciliation/input-manifest.json +131 -0
  524. package/dist/benchmarks/task-revisions/ch05-sales-reconciliation/rubric.json +49 -0
  525. package/dist/benchmarks/task-revisions/ch06-build-operations/input-manifest.json +141 -0
  526. package/dist/benchmarks/task-revisions/ch06-build-operations/rubric.json +49 -0
  527. package/dist/benchmarks/task-revisions/ch08-growth-workspace/input-manifest.json +78 -0
  528. package/dist/benchmarks/task-revisions/ch08-growth-workspace/rubric.json +49 -0
  529. package/dist/benchmarks/task-revisions/hi-authorization-exception/input-manifest.json +72 -0
  530. package/dist/benchmarks/task-revisions/hi-authorization-exception/rubric.json +52 -0
  531. package/dist/benchmarks/task-revisions/hi-authorization-exception/task.md +17 -0
  532. package/dist/benchmarks/task-revisions/hi-authorization-exception/workspace/base/authorization.mjs +6 -0
  533. package/dist/benchmarks/task-revisions/hi-authorization-exception/workspace/data/access-cases.json +251 -0
  534. package/dist/benchmarks/task-revisions/hi-authorization-exception/workspace/docs/ownership-contract.md +11 -0
  535. package/dist/benchmarks/task-revisions/hi-authorization-exception/workspace/package.json +13 -0
  536. package/dist/benchmarks/task-revisions/hi-authorization-exception/workspace/pr.diff +12 -0
  537. package/dist/benchmarks/task-revisions/hi-authorization-exception/workspace/review.schema.json +175 -0
  538. package/dist/benchmarks/task-revisions/hi-authorization-exception/workspace/scripts/trace-access.mjs +14 -0
  539. package/dist/benchmarks/task-revisions/hi-authorization-exception/workspace/scripts/validate-review.mjs +12 -0
  540. package/dist/benchmarks/task-revisions/hi-authorization-exception/workspace/src/authorization.mjs +6 -0
  541. package/dist/benchmarks/task-revisions/hi-authorization-exception/workspace/test/access-subset.test.mjs +1 -0
  542. package/dist/benchmarks/task-revisions/hi-external-action-approval/input-manifest.json +87 -0
  543. package/dist/benchmarks/task-revisions/hi-external-action-approval/rubric.json +44 -0
  544. package/dist/benchmarks/task-revisions/hi-external-action-approval/task.md +7 -0
  545. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/data/approval-receipts.json +162 -0
  546. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/data/operation-cases.json +257 -0
  547. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/data/review-attestations.json +257 -0
  548. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/data/state.json +1 -0
  549. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/docs/action-contract.md +15 -0
  550. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/operation-plan.json +5 -0
  551. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/package.json +13 -0
  552. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/plan.schema.json +127 -0
  553. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/scripts/controller.mjs +45 -0
  554. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/scripts/dry-run.mjs +1 -0
  555. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/scripts/validate-plan.mjs +1 -0
  556. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/scripts/validate-shape.mjs +16 -0
  557. package/dist/benchmarks/task-revisions/hi-external-action-approval/workspace/test/approval.test.mjs +55 -0
  558. package/dist/benchmarks/task-revisions/hi-financial-state-integrity/input-manifest.json +52 -0
  559. package/dist/benchmarks/task-revisions/hi-financial-state-integrity/rubric.json +45 -0
  560. package/dist/benchmarks/task-revisions/hi-financial-state-integrity/task.md +17 -0
  561. package/dist/benchmarks/task-revisions/hi-financial-state-integrity/workspace/data/incident.json +19 -0
  562. package/dist/benchmarks/task-revisions/hi-financial-state-integrity/workspace/data/initial-state.json +9 -0
  563. package/dist/benchmarks/task-revisions/hi-financial-state-integrity/workspace/docs/ledger-contract.md +9 -0
  564. package/dist/benchmarks/task-revisions/hi-financial-state-integrity/workspace/package.json +11 -0
  565. package/dist/benchmarks/task-revisions/hi-financial-state-integrity/workspace/src/ledger.mjs +11 -0
  566. package/dist/benchmarks/task-revisions/hi-financial-state-integrity/workspace/test/ledger.test.mjs +15 -0
  567. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/input-manifest.json +87 -0
  568. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/rubric.json +45 -0
  569. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/task.md +7 -0
  570. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/data/mixed-state.json +17 -0
  571. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/data/rollback-cases.json +84 -0
  572. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/data/schema-phases.json +54 -0
  573. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/data/timeline.json +52 -0
  574. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/docs/migration-contract.md +17 -0
  575. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/migration-plan.json +10 -0
  576. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/package.json +13 -0
  577. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/plan.schema.json +110 -0
  578. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/scripts/compatibility.mjs +51 -0
  579. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/scripts/dry-run.mjs +1 -0
  580. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/scripts/validate-plan.mjs +1 -0
  581. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/scripts/validate-shape.mjs +16 -0
  582. package/dist/benchmarks/task-revisions/hi-versioned-migration-safety/workspace/test/mixed-version.test.mjs +61 -0
  583. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/input-manifest.json +85 -0
  584. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/rubric.json +34 -0
  585. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/task.md +5 -0
  586. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/workspace/data/incident.json +8 -0
  587. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/workspace/data/initial-state.json +21 -0
  588. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/workspace/data/service-save.json +160 -0
  589. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/workspace/docs/bank-interchange.md +37 -0
  590. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/workspace/docs/close-instructions.md +27 -0
  591. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/workspace/docs/ledger-contract.md +21 -0
  592. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/workspace/package.json +11 -0
  593. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/workspace/src/archive.mjs +46 -0
  594. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/workspace/src/clearing.mjs +47 -0
  595. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/workspace/src/ledger.mjs +36 -0
  596. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/workspace/src/money.mjs +11 -0
  597. package/dist/benchmarks/task-revisions/implementation-clearing-cutover/workspace/test/ledger.test.mjs +50 -0
  598. package/dist/benchmarks/task-revisions/implementation-timeline-restore/input-manifest.json +52 -0
  599. package/dist/benchmarks/task-revisions/implementation-timeline-restore/rubric.json +44 -0
  600. package/dist/benchmarks/task-revisions/implementation-timeline-restore/task.md +5 -0
  601. package/dist/benchmarks/task-revisions/implementation-timeline-restore/workspace/docs/archive-operations.md +13 -0
  602. package/dist/benchmarks/task-revisions/implementation-timeline-restore/workspace/docs/interchange.md +16 -0
  603. package/dist/benchmarks/task-revisions/implementation-timeline-restore/workspace/docs/statement-interface.md +9 -0
  604. package/dist/benchmarks/task-revisions/implementation-timeline-restore/workspace/package.json +8 -0
  605. package/dist/benchmarks/task-revisions/implementation-timeline-restore/workspace/src/event-lookup.mjs +39 -0
  606. package/dist/benchmarks/task-revisions/implementation-timeline-restore/workspace/test/client.test.mjs +38 -0
  607. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/input-manifest.json +94 -0
  608. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/rubric.json +84 -0
  609. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/task.md +5 -0
  610. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/docs/dispatch.md +25 -0
  611. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/docs/installed-clients.md +35 -0
  612. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/docs/returned-sheets.md +15 -0
  613. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/package.json +8 -0
  614. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/release/console.mjs +2 -0
  615. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/release/database.mjs +52 -0
  616. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/release/desk.mjs +24 -0
  617. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/release/kiosk.mjs +47 -0
  618. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/release/operator.mjs +17 -0
  619. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/release/printer.mjs +63 -0
  620. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/src/delivery.mjs +28 -0
  621. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/src/reconcile.mjs +16 -0
  622. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/src/workspace.mjs +44 -0
  623. package/dist/benchmarks/task-revisions/implementation-workspace-upgrade/workspace/test/desk.test.mjs +34 -0
  624. package/dist/benchmarks/task-revisions/mn-build-option-update/input-manifest.json +52 -0
  625. package/dist/benchmarks/task-revisions/mn-build-option-update/rubric.json +38 -0
  626. package/dist/benchmarks/task-revisions/mn-build-option-update/task.md +5 -0
  627. package/dist/benchmarks/task-revisions/mn-build-option-update/workspace/build.config.json +14 -0
  628. package/dist/benchmarks/task-revisions/mn-build-option-update/workspace/ci/release-build.log +7 -0
  629. package/dist/benchmarks/task-revisions/mn-build-option-update/workspace/docs/build-options.md +12 -0
  630. package/dist/benchmarks/task-revisions/mn-build-option-update/workspace/package.json +9 -0
  631. package/dist/benchmarks/task-revisions/mn-build-option-update/workspace/scripts/validate-build-config.mjs +11 -0
  632. package/dist/benchmarks/task-revisions/mn-build-option-update/workspace/test/build-config.test.mjs +15 -0
  633. package/dist/benchmarks/task-revisions/mn-client-compatibility-fix/input-manifest.json +48 -0
  634. package/dist/benchmarks/task-revisions/mn-client-compatibility-fix/rubric.json +29 -0
  635. package/dist/benchmarks/task-revisions/mn-client-compatibility-fix/task.md +5 -0
  636. package/dist/benchmarks/task-revisions/mn-client-compatibility-fix/workspace/docs/client-support.md +12 -0
  637. package/dist/benchmarks/task-revisions/mn-client-compatibility-fix/workspace/docs/preferences.md +5 -0
  638. package/dist/benchmarks/task-revisions/mn-client-compatibility-fix/workspace/package.json +6 -0
  639. package/dist/benchmarks/task-revisions/mn-client-compatibility-fix/workspace/src/preferences.mjs +3 -0
  640. package/dist/benchmarks/task-revisions/mn-client-compatibility-fix/workspace/test/preferences.test.mjs +20 -0
  641. package/dist/benchmarks/task-revisions/mn-doc-config-correction/input-manifest.json +42 -0
  642. package/dist/benchmarks/task-revisions/mn-doc-config-correction/rubric.json +37 -0
  643. package/dist/benchmarks/task-revisions/mn-doc-config-correction/task.md +3 -0
  644. package/dist/benchmarks/task-revisions/mn-doc-config-correction/workspace/config/retry-policy.json +6 -0
  645. package/dist/benchmarks/task-revisions/mn-doc-config-correction/workspace/docs/worker-retries.md +12 -0
  646. package/dist/benchmarks/task-revisions/mn-doc-config-correction/workspace/package.json +8 -0
  647. package/dist/benchmarks/task-revisions/mn-doc-config-correction/workspace/test/worker-retries.test.mjs +16 -0
  648. package/dist/benchmarks/task-revisions/mn-focused-regression-test/input-manifest.json +42 -0
  649. package/dist/benchmarks/task-revisions/mn-focused-regression-test/rubric.json +37 -0
  650. package/dist/benchmarks/task-revisions/mn-focused-regression-test/task.md +5 -0
  651. package/dist/benchmarks/task-revisions/mn-focused-regression-test/workspace/package.json +9 -0
  652. package/dist/benchmarks/task-revisions/mn-focused-regression-test/workspace/spec/session-key.md +7 -0
  653. package/dist/benchmarks/task-revisions/mn-focused-regression-test/workspace/src/session-key.mjs +12 -0
  654. package/dist/benchmarks/task-revisions/mn-focused-regression-test/workspace/test/session-key.test.mjs +11 -0
  655. package/dist/benchmarks/task-revisions/mn-frontend-default-fix/input-manifest.json +48 -0
  656. package/dist/benchmarks/task-revisions/mn-frontend-default-fix/rubric.json +45 -0
  657. package/dist/benchmarks/task-revisions/mn-frontend-default-fix/task.md +5 -0
  658. package/dist/benchmarks/task-revisions/mn-frontend-default-fix/workspace/package.json +7 -0
  659. package/dist/benchmarks/task-revisions/mn-frontend-default-fix/workspace/spec/default-state.md +14 -0
  660. package/dist/benchmarks/task-revisions/mn-frontend-default-fix/workspace/src/display-controls.mjs +6 -0
  661. package/dist/benchmarks/task-revisions/mn-frontend-default-fix/workspace/src/display-preferences.mjs +18 -0
  662. package/dist/benchmarks/task-revisions/mn-frontend-default-fix/workspace/test/display-preferences.test.mjs +54 -0
  663. package/dist/benchmarks/task-revisions/mn-schema-field-alignment/input-manifest.json +58 -0
  664. package/dist/benchmarks/task-revisions/mn-schema-field-alignment/rubric.json +45 -0
  665. package/dist/benchmarks/task-revisions/mn-schema-field-alignment/task.md +5 -0
  666. package/dist/benchmarks/task-revisions/mn-schema-field-alignment/workspace/package.json +7 -0
  667. package/dist/benchmarks/task-revisions/mn-schema-field-alignment/workspace/schemas/member.schema.json +12 -0
  668. package/dist/benchmarks/task-revisions/mn-schema-field-alignment/workspace/spec/member-contract.md +13 -0
  669. package/dist/benchmarks/task-revisions/mn-schema-field-alignment/workspace/spec/schema-alignment-plan.md +5 -0
  670. package/dist/benchmarks/task-revisions/mn-schema-field-alignment/workspace/src/member-export.mjs +3 -0
  671. package/dist/benchmarks/task-revisions/mn-schema-field-alignment/workspace/src/member-import.mjs +23 -0
  672. package/dist/benchmarks/task-revisions/mn-schema-field-alignment/workspace/test/member-record.test.mjs +36 -0
  673. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/input-manifest.json +82 -0
  674. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/rubric.json +52 -0
  675. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/task.md +7 -0
  676. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/workspace/docs/interaction-notes.md +11 -0
  677. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/workspace/notice-editor.html +31 -0
  678. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/workspace/package-lock.json +15 -0
  679. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/workspace/package.json +14 -0
  680. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/workspace/pr.diff +83 -0
  681. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/workspace/review.schema.json +57 -0
  682. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/workspace/scripts/validate-review.mjs +40 -0
  683. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/workspace/src/format-toolbar.html +10 -0
  684. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/workspace/src/format-toolbar.mjs +42 -0
  685. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/workspace/test/helpers/toolbar-fixture.mjs +19 -0
  686. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/workspace/test/integration/format-toolbar.test.mjs +16 -0
  687. package/dist/benchmarks/task-revisions/mp-accessibility-interaction-review/workspace/test/unit/format-toolbar.test.mjs +23 -0
  688. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/input-manifest.json +87 -0
  689. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/rubric.json +52 -0
  690. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/task.md +5 -0
  691. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/.github/workflows/pull-request.yml +23 -0
  692. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/ci/pull-request-314.log +22 -0
  693. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/docs/verification.md +9 -0
  694. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/package-lock.json +13 -0
  695. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/package.json +14 -0
  696. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/pr.diff +49 -0
  697. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/review.schema.json +61 -0
  698. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/scripts/upload-diagnostics.mjs +4 -0
  699. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/scripts/validate-review.mjs +40 -0
  700. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/src/checkout.mjs +6 -0
  701. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/src/quote-order.mjs +13 -0
  702. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/test/checkout/quote-order-contract.test.mjs +12 -0
  703. package/dist/benchmarks/task-revisions/mp-ci-evidence-gap/workspace/test/unit/quote-order.test.mjs +23 -0
  704. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/input-manifest.json +97 -0
  705. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/rubric.json +44 -0
  706. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/task.md +7 -0
  707. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/docs/migration-plan.md +21 -0
  708. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/docs/rollback-runbook.md +3 -0
  709. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/evidence/checkpoint-journal.ndjson +10 -0
  710. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/evidence/comparisons.ndjson +6 -0
  711. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/evidence/compatibility.json +25 -0
  712. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/evidence/outbox.ndjson +4 -0
  713. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/handoff.schema.json +216 -0
  714. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/operations/commands.json +71 -0
  715. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/operations/pages.json +134 -0
  716. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/operations/work-orders.json +39 -0
  717. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/package-lock.json +13 -0
  718. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/package.json +11 -0
  719. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/scripts/validate-handoff.mjs +63 -0
  720. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/state/grants.ndjson +5 -0
  721. package/dist/benchmarks/task-revisions/mp-data-migration-handoff/workspace/state/routing.json +22 -0
  722. package/dist/benchmarks/task-revisions/mp-frontend-state-review/input-manifest.json +77 -0
  723. package/dist/benchmarks/task-revisions/mp-frontend-state-review/rubric.json +44 -0
  724. package/dist/benchmarks/task-revisions/mp-frontend-state-review/task.md +5 -0
  725. package/dist/benchmarks/task-revisions/mp-frontend-state-review/workspace/docs/state-contract.md +14 -0
  726. package/dist/benchmarks/task-revisions/mp-frontend-state-review/workspace/package-lock.json +15 -0
  727. package/dist/benchmarks/task-revisions/mp-frontend-state-review/workspace/package.json +14 -0
  728. package/dist/benchmarks/task-revisions/mp-frontend-state-review/workspace/pr.diff +116 -0
  729. package/dist/benchmarks/task-revisions/mp-frontend-state-review/workspace/review.schema.json +57 -0
  730. package/dist/benchmarks/task-revisions/mp-frontend-state-review/workspace/scripts/validate-review.mjs +40 -0
  731. package/dist/benchmarks/task-revisions/mp-frontend-state-review/workspace/src/inbox-state.mjs +47 -0
  732. package/dist/benchmarks/task-revisions/mp-frontend-state-review/workspace/src/inbox-view.mjs +19 -0
  733. package/dist/benchmarks/task-revisions/mp-frontend-state-review/workspace/test/helpers/inbox-fixture.mjs +8 -0
  734. package/dist/benchmarks/task-revisions/mp-frontend-state-review/workspace/test/integration/inbox-view.test.mjs +32 -0
  735. package/dist/benchmarks/task-revisions/mp-frontend-state-review/workspace/test/unit/inbox-state.test.mjs +20 -0
  736. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/input-manifest.json +87 -0
  737. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/rubric.json +52 -0
  738. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/task.md +7 -0
  739. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/change-plan.schema.json +186 -0
  740. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/docs/change-request.md +9 -0
  741. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/docs/knowledge-policy.md +6 -0
  742. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/docs/rollback-policy.md +8 -0
  743. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/infra/alias.tf +11 -0
  744. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/infra/iam.tf +12 -0
  745. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/operations/commands.json +46 -0
  746. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/package-lock.json +15 -0
  747. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/package.json +12 -0
  748. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/plans/candidate-plan.json +15 -0
  749. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/plans/pre-apply-records.json +117 -0
  750. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/scripts/validate-change-plan.mjs +138 -0
  751. package/dist/benchmarks/task-revisions/mp-iac-rollback-design/workspace/state/current-state.json +23 -0
  752. package/dist/benchmarks/task-revisions/mp-performance-investigation/input-manifest.json +97 -0
  753. package/dist/benchmarks/task-revisions/mp-performance-investigation/rubric.json +44 -0
  754. package/dist/benchmarks/task-revisions/mp-performance-investigation/task.md +7 -0
  755. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/docs/investigation-contract.md +14 -0
  756. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/investigation.schema.json +92 -0
  757. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/observability/cache-samples.csv +7 -0
  758. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/observability/release-events.json +14 -0
  759. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/observability/request-windows.csv +4 -0
  760. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/observability/runtime-profile.json +25 -0
  761. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/package-lock.json +15 -0
  762. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/package.json +15 -0
  763. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/scripts/replay-summary.mjs +12 -0
  764. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/scripts/validate-investigation.mjs +84 -0
  765. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/src/cache-key.mjs +6 -0
  766. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/src/summary-replay.mjs +42 -0
  767. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/src/summary-service.mjs +9 -0
  768. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/test/integration/summary-replay.test.mjs +11 -0
  769. package/dist/benchmarks/task-revisions/mp-performance-investigation/workspace/test/unit/cache-key.test.mjs +9 -0
  770. package/dist/benchmarks/task-revisions/pf-api-pagination-behavior/input-manifest.json +53 -0
  771. package/dist/benchmarks/task-revisions/pf-api-pagination-behavior/rubric.json +44 -0
  772. package/dist/benchmarks/task-revisions/pf-api-pagination-behavior/task.md +7 -0
  773. package/dist/benchmarks/task-revisions/pf-api-pagination-behavior/workspace/package.json +6 -0
  774. package/dist/benchmarks/task-revisions/pf-api-pagination-behavior/workspace/spec/pagination-contract.md +9 -0
  775. package/dist/benchmarks/task-revisions/pf-api-pagination-behavior/workspace/src/api-pages.mjs +16 -0
  776. package/dist/benchmarks/task-revisions/pf-api-pagination-behavior/workspace/src/catalog-consumer.mjs +5 -0
  777. package/dist/benchmarks/task-revisions/pf-api-pagination-behavior/workspace/src/pagination.mjs +19 -0
  778. package/dist/benchmarks/task-revisions/pf-api-pagination-behavior/workspace/test/pagination.test.mjs +76 -0
  779. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/input-manifest.json +77 -0
  780. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/rubric.json +44 -0
  781. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/task.md +11 -0
  782. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/workspace/ci/build-config.json +11 -0
  783. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/workspace/ci/build-history.log +6 -0
  784. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/workspace/ci/scenarios.json +38 -0
  785. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/workspace/docs/investigation-contract.md +19 -0
  786. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/workspace/investigation.schema.json +503 -0
  787. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/workspace/package.json +14 -0
  788. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/workspace/scripts/reproduce-cache.mjs +5 -0
  789. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/workspace/scripts/validate-report.mjs +31 -0
  790. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/workspace/src/cache-model.mjs +9 -0
  791. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/workspace/test/cache-observation.test.mjs +33 -0
  792. package/dist/benchmarks/task-revisions/pf-ci-cache-flake/workspace/test/report-structure.test.mjs +2 -0
  793. package/dist/benchmarks/task-revisions/pf-data-schema-evolution/input-manifest.json +68 -0
  794. package/dist/benchmarks/task-revisions/pf-data-schema-evolution/rubric.json +45 -0
  795. package/dist/benchmarks/task-revisions/pf-data-schema-evolution/task.md +11 -0
  796. package/dist/benchmarks/task-revisions/pf-data-schema-evolution/workspace/data/legacy-customers.json +17 -0
  797. package/dist/benchmarks/task-revisions/pf-data-schema-evolution/workspace/migrations/v1-v2.plan.json +11 -0
  798. package/dist/benchmarks/task-revisions/pf-data-schema-evolution/workspace/package.json +12 -0
  799. package/dist/benchmarks/task-revisions/pf-data-schema-evolution/workspace/schemas/customer-v1.schema.json +27 -0
  800. package/dist/benchmarks/task-revisions/pf-data-schema-evolution/workspace/schemas/customer-v2.schema.json +25 -0
  801. package/dist/benchmarks/task-revisions/pf-data-schema-evolution/workspace/spec/evolution-contract.md +8 -0
  802. package/dist/benchmarks/task-revisions/pf-data-schema-evolution/workspace/src/readers.mjs +3 -0
  803. package/dist/benchmarks/task-revisions/pf-data-schema-evolution/workspace/src/schema-contract.mjs +7 -0
  804. package/dist/benchmarks/task-revisions/pf-data-schema-evolution/workspace/test/schema-evolution.test.mjs +15 -0
  805. package/dist/benchmarks/task-revisions/pf-frontend-async-state/input-manifest.json +47 -0
  806. package/dist/benchmarks/task-revisions/pf-frontend-async-state/rubric.json +37 -0
  807. package/dist/benchmarks/task-revisions/pf-frontend-async-state/task.md +7 -0
  808. package/dist/benchmarks/task-revisions/pf-frontend-async-state/workspace/package.json +1 -0
  809. package/dist/benchmarks/task-revisions/pf-frontend-async-state/workspace/spec/search-state-contract.md +6 -0
  810. package/dist/benchmarks/task-revisions/pf-frontend-async-state/workspace/src/search-controller.mjs +5 -0
  811. package/dist/benchmarks/task-revisions/pf-frontend-async-state/workspace/src/search-view.mjs +3 -0
  812. package/dist/benchmarks/task-revisions/pf-frontend-async-state/workspace/test/search-state.test.mjs +14 -0
  813. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/input-manifest.json +90 -0
  814. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/rubric.json +42 -0
  815. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/task.md +9 -0
  816. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/config/migration-settings.json +5 -0
  817. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/data/compatibility-matrix.json +44 -0
  818. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/docs/migration-contract.md +13 -0
  819. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/package.json +13 -0
  820. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/scripts/check-rollback.mjs +5 -0
  821. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/scripts/validate-migration.mjs +2 -0
  822. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/src/archive-compat.mjs +2 -0
  823. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/src/download-export.mjs +5 -0
  824. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/src/scheduled-export.mjs +5 -0
  825. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/test/application-callers.test.mjs +19 -0
  826. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/test/archive-compat.test.mjs +13 -0
  827. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/vendor/archive-v1.mjs +3 -0
  828. package/dist/benchmarks/task-revisions/pf-library-compat-upgrade/workspace/vendor/archive-v2.mjs +3 -0
  829. package/dist/benchmarks/task-revisions/pf-observability-redaction/input-manifest.json +88 -0
  830. package/dist/benchmarks/task-revisions/pf-observability-redaction/rubric.json +45 -0
  831. package/dist/benchmarks/task-revisions/pf-observability-redaction/task.md +11 -0
  832. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/base/projection-policy.json +14 -0
  833. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/config/field-contract.json +24 -0
  834. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/config/projection-policy.json +18 -0
  835. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/config/proposed-policy.json +18 -0
  836. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/data/events.json +80 -0
  837. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/docs/projection-contract.md +11 -0
  838. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/package.json +13 -0
  839. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/pr.diff +19 -0
  840. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/review.schema.json +120 -0
  841. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/scripts/trace-policy.mjs +1 -0
  842. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/scripts/validate-review.mjs +12 -0
  843. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/src/project-event.mjs +7 -0
  844. package/dist/benchmarks/task-revisions/pf-observability-redaction/workspace/test/project-event.test.mjs +3 -0
  845. package/dist/benchmarks/task-revisions/pf-performance-regression/input-manifest.json +62 -0
  846. package/dist/benchmarks/task-revisions/pf-performance-regression/rubric.json +45 -0
  847. package/dist/benchmarks/task-revisions/pf-performance-regression/task.md +11 -0
  848. package/dist/benchmarks/task-revisions/pf-performance-regression/workspace/data/measurement-config.json +21 -0
  849. package/dist/benchmarks/task-revisions/pf-performance-regression/workspace/docs/lookup-contract.md +11 -0
  850. package/dist/benchmarks/task-revisions/pf-performance-regression/workspace/package.json +12 -0
  851. package/dist/benchmarks/task-revisions/pf-performance-regression/workspace/reference/scan-lookup.mjs +7 -0
  852. package/dist/benchmarks/task-revisions/pf-performance-regression/workspace/scripts/generate-data.mjs +5 -0
  853. package/dist/benchmarks/task-revisions/pf-performance-regression/workspace/scripts/measure-lookup.mjs +103 -0
  854. package/dist/benchmarks/task-revisions/pf-performance-regression/workspace/src/event-lookup.mjs +7 -0
  855. package/dist/benchmarks/task-revisions/pf-performance-regression/workspace/test/event-lookup.test.mjs +17 -0
  856. package/dist/benchmarks/task-revisions/pf-review-error-contract/input-manifest.json +87 -0
  857. package/dist/benchmarks/task-revisions/pf-review-error-contract/rubric.json +44 -0
  858. package/dist/benchmarks/task-revisions/pf-review-error-contract/task.md +11 -0
  859. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/base/response-adapter.mjs +10 -0
  860. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/comparisons/option-a.diff +10 -0
  861. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/comparisons/option-b.diff +11 -0
  862. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/data/cases.json +65 -0
  863. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/docs/error-contract.md +10 -0
  864. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/package.json +10 -0
  865. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/pr.diff +13 -0
  866. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/review.schema.json +407 -0
  867. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/scripts/trace-cases.mjs +7 -0
  868. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/scripts/validate-review.mjs +12 -0
  869. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/src/client-policy.mjs +8 -0
  870. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/src/response-adapter.mjs +10 -0
  871. package/dist/benchmarks/task-revisions/pf-review-error-contract/workspace/test/api-error.test.mjs +6 -0
  872. package/dist/benchmarks/task-revisions/rc01-shared-review-platform/input-manifest.json +808 -0
  873. package/dist/benchmarks/task-revisions/rc01-shared-review-platform/rubric.json +40 -0
  874. package/dist/bin/ask.mjs +9 -0
  875. package/dist/docs/README.md +81 -0
  876. package/dist/docs/adapter-capability-matrix.md +75 -0
  877. package/dist/docs/adapter-conformance-contract.md +81 -0
  878. package/dist/docs/adapter-cross-conformance-report.md +43 -0
  879. package/dist/docs/adapter-deployment-governance.md +110 -0
  880. package/dist/docs/adapter-runtime-boundary-contract.md +211 -0
  881. package/dist/docs/adapter-runtime-migration.md +130 -0
  882. package/dist/docs/adoption-apply.md +97 -0
  883. package/dist/docs/adoption-setup.md +150 -0
  884. package/dist/docs/adr/0001-verification-evidence-trust-boundary.md +100 -0
  885. package/dist/docs/adr/0002-epic-admission-work-package-plan-authority.md +76 -0
  886. package/dist/docs/adr/0003-asset-registry-authority-boundary.md +120 -0
  887. package/dist/docs/adr/0004-portfolio-activation-authority-boundary.md +290 -0
  888. package/dist/docs/adr/0005-evolution-authority-boundary.md +195 -0
  889. package/dist/docs/adr/0006-claim-evidence-status-boundary.md +57 -0
  890. package/dist/docs/adr/0007-runner-owned-execution-envelope-record.md +28 -0
  891. package/dist/docs/adr/0008-monotonic-verification-proof-path.md +122 -0
  892. package/dist/docs/adr/0009-baseline-semantic-review-authority.md +74 -0
  893. package/dist/docs/adr/0010-one-task-effectiveness-authority-boundary.md +143 -0
  894. package/dist/docs/adr/0011-prompt-v2-result-blind-canary-authority.md +155 -0
  895. package/dist/docs/adr/0025-discarded-evaluation-result-use.md +31 -0
  896. package/dist/docs/agent-session-state-contract.md +67 -0
  897. package/dist/docs/ai/adoption-report-template.md +179 -0
  898. package/dist/docs/ai/architecture-decision-memory.md +83 -0
  899. package/dist/docs/ai/documentation-knowledge-ledger.md +85 -0
  900. package/dist/docs/ai/domain-rule-ledger.md +115 -0
  901. package/dist/docs/ai/engineering-capability-ledger.md +90 -0
  902. package/dist/docs/ai/engineering-pattern-ledger.md +81 -0
  903. package/dist/docs/ai/implementation-context.md +158 -0
  904. package/dist/docs/ai/improvement-ledger.md +212 -0
  905. package/dist/docs/ai/metrics/README.md +9 -0
  906. package/dist/docs/ai/metrics/fixtures/stakeholder-readiness-events.jsonl +3 -0
  907. package/dist/docs/ai/observability-config.yml +54 -0
  908. package/dist/docs/ai/reports/README.md +5 -0
  909. package/dist/docs/ai/reports/examples/ai-promotion-readiness-sample.md +43 -0
  910. package/dist/docs/ai/reports/examples/business-unit-client-value-readiness-sample.md +37 -0
  911. package/dist/docs/ai/reports/examples/development-manager-readiness-sample.md +41 -0
  912. package/dist/docs/ai/reports/examples/senior-engineer-readiness-sample.md +42 -0
  913. package/dist/docs/ai/review-context.md +127 -0
  914. package/dist/docs/ai/review-rule-ledger.md +78 -0
  915. package/dist/docs/ai/skill-adoption-metrics.md +251 -0
  916. package/dist/docs/ai/stakeholder-readiness-report-template.md +139 -0
  917. package/dist/docs/ai/verification-pattern-ledger.md +83 -0
  918. package/dist/docs/ask-autonomous-development.md +237 -0
  919. package/dist/docs/ask-core-bundle-implementation.md +155 -0
  920. package/dist/docs/asset-registry-contract.md +392 -0
  921. package/dist/docs/bounded-target-snapshot.md +90 -0
  922. package/dist/docs/claim-evidence-status-contract.md +60 -0
  923. package/dist/docs/claude-github-review-setup.md +65 -0
  924. package/dist/docs/codex-metrics-collector.md +149 -0
  925. package/dist/docs/cross-runtime-environment-loop.md +345 -0
  926. package/dist/docs/customization-guide.md +175 -0
  927. package/dist/docs/debt-lifecycle-contract.md +134 -0
  928. package/dist/docs/demos/personal-loop-saved-demo-ja.md +38 -0
  929. package/dist/docs/epic-admission-work-package-plan-contract.md +239 -0
  930. package/dist/docs/evaluation-task-catalog.md +107 -0
  931. package/dist/docs/evolution-loop-contract.md +395 -0
  932. package/dist/docs/evolution-loop-sample-prompt-candidate.md +15 -0
  933. package/dist/docs/execution-envelope-contract.md +105 -0
  934. package/dist/docs/finding-intake.md +165 -0
  935. package/dist/docs/first-workflow-mac-codex-ja.md +132 -0
  936. package/dist/docs/fixtures/adapter-cross-conformance.json +272 -0
  937. package/dist/docs/fixtures/adapter-runtime-bundle.json +867 -0
  938. package/dist/docs/fixtures/adapter-runtime-evidence.json +111 -0
  939. package/dist/docs/fixtures/adapter-runtime-profiles.json +2055 -0
  940. package/dist/docs/fixtures/asset-registry/reference.json +89 -0
  941. package/dist/docs/fixtures/asset-registry/store/objects/sha256/06/cacaea5b7b84bb2a9f6a6e849f1e561967637cfc0c28bd60675b665f090a54.json +1 -0
  942. package/dist/docs/fixtures/asset-registry/store/objects/sha256/0a/1bf5ec027954e2def2bf6591655365258e4ed6c3e58a151ea242b961591dcc.json +1 -0
  943. package/dist/docs/fixtures/asset-registry/store/objects/sha256/12/4a398892b63295e43b894776bea049625e3847010acd2dce61880a207cf1da.json +1 -0
  944. package/dist/docs/fixtures/asset-registry/store/objects/sha256/33/d26707d82e68099085b91f60b26b6bea6ea17af802a493dd70ee4629dfc72b.json +1 -0
  945. package/dist/docs/fixtures/asset-registry/store/objects/sha256/34/a511af596bc1317941241135f053153d9862ff7552a243c0231fc079c4edba.json +1 -0
  946. package/dist/docs/fixtures/asset-registry/store/objects/sha256/39/f30afcc78d50c1ff2cf85d4c18d546b47811c370146193535af08cc030cc65.json +1 -0
  947. package/dist/docs/fixtures/asset-registry/store/objects/sha256/43/e18c25bca6279ab7b333b5e4ce3bfdc8ada01023bfe47d0889d61e71872c56.json +1 -0
  948. package/dist/docs/fixtures/asset-registry/store/objects/sha256/5b/50712f43feecf82d532178310cf2e0fe2fe709e0d951eb797a3876ff0cf92d.json +1 -0
  949. package/dist/docs/fixtures/asset-registry/store/objects/sha256/5c/c2ab9ca47824d2d13438f7f4460b71db1a6f939cfce1b0f84291e3e5935be5.json +1 -0
  950. package/dist/docs/fixtures/asset-registry/store/objects/sha256/62/1237eed65b92d996a11b259d7ef8854357c9fd1e7170071d59c4f50f4e7b3e.json +1 -0
  951. package/dist/docs/fixtures/asset-registry/store/objects/sha256/9b/fd6af3c3768f8760fb1fe8b8ab98e6d4753d4802e38f7604b446dc7b14a95a.json +1 -0
  952. package/dist/docs/fixtures/asset-registry/store/objects/sha256/be/c5d5f8f9ee2f8fdab1902f73888b251eb9e62e55bef3529542ab0deb8a48e2.json +1 -0
  953. package/dist/docs/fixtures/asset-registry/store/objects/sha256/c6/19c6c426da2f6fac9185c2426908ea83ff1598e5e9af7add61f509678a5853.json +1 -0
  954. package/dist/docs/fixtures/asset-registry/store/objects/sha256/d6/e6ac3acac3ee396987fd0333b6193c809156c88eb343b43c9e0b0c72fbe1c5.json +1 -0
  955. package/dist/docs/fixtures/asset-registry/store/objects/sha256/d9/6f3131c5d6556d2fa74665befef66c0d279dd1177dc6d41f232f2844eafba6.json +1 -0
  956. package/dist/docs/fixtures/asset-registry/store/objects/sha256/f4/6abf273daaaf13cc96c10e54d2de72ba8cd269a58d1ea047331c38ba13dc18.json +1 -0
  957. package/dist/docs/fixtures/claude-fixed-entry-route-baseline.json +36 -0
  958. package/dist/docs/fixtures/claude-pre-fixed-commands/skill-handoff.md +32 -0
  959. package/dist/docs/fixtures/claude-pre-fixed-commands/skill-implement.md +30 -0
  960. package/dist/docs/fixtures/claude-pre-fixed-commands/skill-investigate.md +25 -0
  961. package/dist/docs/fixtures/claude-pre-fixed-commands/skill-review.md +54 -0
  962. package/dist/docs/fixtures/claude-pre-fixed-commands/skill-verify.md +36 -0
  963. package/dist/docs/fixtures/codex-compact-route-baseline.json +42 -0
  964. package/dist/docs/fixtures/codex-pre-compact-prompts/skill-handoff.md +43 -0
  965. package/dist/docs/fixtures/codex-pre-compact-prompts/skill-implement.md +55 -0
  966. package/dist/docs/fixtures/codex-pre-compact-prompts/skill-investigate.md +55 -0
  967. package/dist/docs/fixtures/codex-pre-compact-prompts/skill-review.md +68 -0
  968. package/dist/docs/fixtures/codex-pre-compact-prompts/skill-verify.md +55 -0
  969. package/dist/docs/fixtures/epic-admission-policy.json +50 -0
  970. package/dist/docs/fixtures/epic-admission-work-package-plan-cases.json +766 -0
  971. package/dist/docs/fixtures/evolution-loop/reference.json +551 -0
  972. package/dist/docs/fixtures/first-workflow-315/bypass-input-ja.md +2 -0
  973. package/dist/docs/fixtures/first-workflow-315/implementation-input-ja.md +15 -0
  974. package/dist/docs/fixtures/issue-275-slice-1-epic-admission-decision.json +86 -0
  975. package/dist/docs/fixtures/issue-275-slice-1-work-package-plan-r1.json +1053 -0
  976. package/dist/docs/fixtures/issue-275-slice-1-work-package-plan-r2.json +1078 -0
  977. package/dist/docs/fixtures/issue-275-slice-1-work-package-plan-validation-context-r1.json +81 -0
  978. package/dist/docs/fixtures/issue-275-slice-1-work-package-plan-validation-context-r2.json +117 -0
  979. package/dist/docs/fixtures/issue-275-slice-1-work-package-plan-validation-context.json +117 -0
  980. package/dist/docs/fixtures/issue-275-slice-1-work-package-plan.json +1126 -0
  981. package/dist/docs/fixtures/kernel-principles-source-5f36081.md +266 -0
  982. package/dist/docs/fixtures/lifecycle-artifact-chains.json +108 -0
  983. package/dist/docs/fixtures/lifecycle-traceability-chains.json +356 -0
  984. package/dist/docs/fixtures/portfolio-manager/reference.json +70 -0
  985. package/dist/docs/fixtures/pragmatic-evaluation/notes-template.json +39 -0
  986. package/dist/docs/fixtures/prompt-v2-preregistration/binding.json +170 -0
  987. package/dist/docs/fixtures/prompt-v2-preregistration/reference.json +397 -0
  988. package/dist/docs/fixtures/prompt-v2-preregistration/rendered/claude_code/skill-handoff.md +32 -0
  989. package/dist/docs/fixtures/prompt-v2-preregistration/rendered/claude_code/skill-implement.md +38 -0
  990. package/dist/docs/fixtures/prompt-v2-preregistration/rendered/claude_code/skill-investigate.md +35 -0
  991. package/dist/docs/fixtures/prompt-v2-preregistration/rendered/claude_code/skill-review.md +49 -0
  992. package/dist/docs/fixtures/prompt-v2-preregistration/rendered/claude_code/skill-verify.md +43 -0
  993. package/dist/docs/fixtures/prompt-v2-preregistration/rendered/codex/skill-handoff.md +29 -0
  994. package/dist/docs/fixtures/prompt-v2-preregistration/rendered/codex/skill-implement.md +34 -0
  995. package/dist/docs/fixtures/prompt-v2-preregistration/rendered/codex/skill-investigate.md +33 -0
  996. package/dist/docs/fixtures/prompt-v2-preregistration/rendered/codex/skill-review.md +50 -0
  997. package/dist/docs/fixtures/prompt-v2-preregistration/rendered/codex/skill-verify.md +34 -0
  998. package/dist/docs/fixtures/prompt-v2-preregistration/rendered/reference.json +94 -0
  999. package/dist/docs/fixtures/release-evidence-gate/current-main-756c72-claim-matrix.json +74 -0
  1000. package/dist/docs/fixtures/release-evidence-gate/current-main-756c72-evidence.json +30 -0
  1001. package/dist/docs/fixtures/release-evidence-gate/current-main-d4ad39-claim-matrix.json +389 -0
  1002. package/dist/docs/fixtures/release-evidence-gate/current-main-d4ad39-evidence.json +1024 -0
  1003. package/dist/docs/fixtures/release-evidence-gate/current-main-d4ad39-independent-review.md +95 -0
  1004. package/dist/docs/fixtures/release-evidence-gate/current-main-d4ad39-observations.json +87 -0
  1005. package/dist/docs/fixtures/release-evidence-gate/mac-install-recovery-candidate.json +232 -0
  1006. package/dist/docs/fixtures/release-evidence-gate/mac-install-recovery-review.md +112 -0
  1007. package/dist/docs/fixtures/review-route-cases.json +830 -0
  1008. package/dist/docs/fixtures/skill-effectiveness-outcome-cases.json +549 -0
  1009. package/dist/docs/fixtures/sufficient-change-scope/stage-1.md +51 -0
  1010. package/dist/docs/fixtures/sufficient-change-scope/stage-2.md +30 -0
  1011. package/dist/docs/fixtures/ui-ux-design/README.md +36 -0
  1012. package/dist/docs/fixtures/ui-ux-design/fixture-state.mjs +140 -0
  1013. package/dist/docs/fixtures/ui-ux-design/fixture-state.test.mjs +171 -0
  1014. package/dist/docs/fixtures/ui-ux-design/fixture.mjs +154 -0
  1015. package/dist/docs/fixtures/verification-proof-formal-baseline.md +14 -0
  1016. package/dist/docs/fixtures/verification-proof-policy-cases.json +906 -0
  1017. package/dist/docs/glossary-ja.md +433 -0
  1018. package/dist/docs/instruction-improvement-continuity.md +237 -0
  1019. package/dist/docs/instruction-improvement-delivery.md +130 -0
  1020. package/dist/docs/instruction-improvement-learning-context.md +118 -0
  1021. package/dist/docs/instruction-improvement-readiness.md +116 -0
  1022. package/dist/docs/instruction-loop-failed-preparation.md +45 -0
  1023. package/dist/docs/instruction-loop-fixed-reference-scoring.md +57 -0
  1024. package/dist/docs/instruction-loop-host-authoring.md +83 -0
  1025. package/dist/docs/instruction-loop-reference-evidence.md +185 -0
  1026. package/dist/docs/instruction-loop-retained-authoring.md +115 -0
  1027. package/dist/docs/instruction-loop-source-application.md +110 -0
  1028. package/dist/docs/instruction-loop-source-validation.md +65 -0
  1029. package/dist/docs/instruction-loop-standard-execution.md +101 -0
  1030. package/dist/docs/kernel-principles-candidate-v2.md +124 -0
  1031. package/dist/docs/kernel-principles-comparison.md +135 -0
  1032. package/dist/docs/kernel-principles-v2-adoption.md +118 -0
  1033. package/dist/docs/kernel-standalone-design-proposal.md +198 -0
  1034. package/dist/docs/kernel-standalone-instruction-draft.md +206 -0
  1035. package/dist/docs/lifecycle-artifact-contract.md +274 -0
  1036. package/dist/docs/lifecycle-traceability-contract.md +169 -0
  1037. package/dist/docs/local-codex-admission.md +177 -0
  1038. package/dist/docs/local-codex-connection.md +60 -0
  1039. package/dist/docs/local-codex-read-policy.md +210 -0
  1040. package/dist/docs/local-codex-single-sandbox-design.md +73 -0
  1041. package/dist/docs/local-eval-distribution.md +222 -0
  1042. package/dist/docs/local-full-static-preparation.md +137 -0
  1043. package/dist/docs/local-three-arm-comparison.md +142 -0
  1044. package/dist/docs/local-three-arm-qualification.md +89 -0
  1045. package/dist/docs/mac-ask-full-reference-supplement.json +249 -0
  1046. package/dist/docs/mac-ask-full-static-inventory.json +1488 -0
  1047. package/dist/docs/mac-kernel-value-screening.md +253 -0
  1048. package/dist/docs/measured-review-adoption.md +88 -0
  1049. package/dist/docs/metrics-event-contract.md +252 -0
  1050. package/dist/docs/npm-distribution-ja.md +135 -0
  1051. package/dist/docs/npm-distribution.md +299 -0
  1052. package/dist/docs/npm-loop-spec-example.mjs +34 -0
  1053. package/dist/docs/observability-runtime-contract.md +164 -0
  1054. package/dist/docs/operation-automation-contract.md +89 -0
  1055. package/dist/docs/personal-evolution-bridge.md +33 -0
  1056. package/dist/docs/personal-evolution-cli.md +238 -0
  1057. package/dist/docs/personal-evolution-codex-generation.md +166 -0
  1058. package/dist/docs/personal-evolution-driver.md +15 -0
  1059. package/dist/docs/personal-evolution-generation-connector.md +139 -0
  1060. package/dist/docs/personal-evolution-generation-status.md +86 -0
  1061. package/dist/docs/personal-evolution-generation.md +31 -0
  1062. package/dist/docs/personal-evolution-primary-loop.md +241 -0
  1063. package/dist/docs/personal-evolution-primary-pair-contract.md +72 -0
  1064. package/dist/docs/personal-evolution-saved-results.md +31 -0
  1065. package/dist/docs/personal-evolution-source-reviewer.md +84 -0
  1066. package/dist/docs/personal-evolution-unattended.md +169 -0
  1067. package/dist/docs/personal-loop-quickstart-ja.md +79 -0
  1068. package/dist/docs/personal-v1-release-preparation-ja.md +41 -0
  1069. package/dist/docs/portfolio-manager-contract.md +596 -0
  1070. package/dist/docs/practical-challenge-evaluation.md +273 -0
  1071. package/dist/docs/practical-evaluation-recovery.md +487 -0
  1072. package/dist/docs/practical-grade-supplement.md +193 -0
  1073. package/dist/docs/practical-partial-grading.md +121 -0
  1074. package/dist/docs/practical-quality-observations.md +69 -0
  1075. package/dist/docs/practical-retained-grade-report.md +106 -0
  1076. package/dist/docs/pragmatic-evaluation.md +149 -0
  1077. package/dist/docs/primary-24-practical-review.md +281 -0
  1078. package/dist/docs/primary-24-practical-revision.md +256 -0
  1079. package/dist/docs/primary-24-private-v2.md +28 -0
  1080. package/dist/docs/primary-24-task-assembly.md +276 -0
  1081. package/dist/docs/primary-24-unsafe-action-v8.md +28 -0
  1082. package/dist/docs/primary-evaluation-correctness-v7.md +188 -0
  1083. package/dist/docs/primary-principles-v2-connection.md +88 -0
  1084. package/dist/docs/project-overlay-template.md +152 -0
  1085. package/dist/docs/prompt-recipes-ja.md +955 -0
  1086. package/dist/docs/prompt-v2-execution-handoff.md +81 -0
  1087. package/dist/docs/quality-rubric.md +145 -0
  1088. package/dist/docs/quickstart-ja.md +388 -0
  1089. package/dist/docs/quickstart-mac-codex-ja.md +160 -0
  1090. package/dist/docs/references.md +18 -0
  1091. package/dist/docs/release-evidence-gate-contract.md +198 -0
  1092. package/dist/docs/release-package-2026-10.md +129 -0
  1093. package/dist/docs/review-finding-contract.md +54 -0
  1094. package/dist/docs/review-rule-lifecycle.md +205 -0
  1095. package/dist/docs/routing-model.md +274 -0
  1096. package/dist/docs/rule-batch-prospective-comparison.md +88 -0
  1097. package/dist/docs/skill-effectiveness-evaluation-contract.md +146 -0
  1098. package/dist/docs/skill-matrix.md +190 -0
  1099. package/dist/docs/stack-implementation-overlay-contract.md +122 -0
  1100. package/dist/docs/sufficient-change-scope-evaluation.md +120 -0
  1101. package/dist/docs/supervised-instruction-loop.md +464 -0
  1102. package/dist/docs/unattended-user-comparison-contract.md +90 -0
  1103. package/dist/docs/usage-ja.md +501 -0
  1104. package/dist/docs/user-comparison-contract.md +75 -0
  1105. package/dist/docs/user-repository-comparison-mac-codex-ja.md +571 -0
  1106. package/dist/docs/validation-report.md +756 -0
  1107. package/dist/docs/verification-evidence-contract.md +175 -0
  1108. package/dist/docs/verification-proof-policy-contract.md +177 -0
  1109. package/dist/docs/verification-reuse-completion-contract.md +129 -0
  1110. package/dist/docs/verification-reuse-measurement.md +130 -0
  1111. package/dist/docs/workflow-examples.md +539 -0
  1112. package/dist/examples/01-small-change.md +32 -0
  1113. package/dist/examples/02-new-feature.md +53 -0
  1114. package/dist/examples/03-bug-fix.md +39 -0
  1115. package/dist/examples/04-design-grill.md +40 -0
  1116. package/dist/examples/05-pr-review.md +43 -0
  1117. package/dist/examples/06-handoff-to-agent.md +49 -0
  1118. package/dist/examples/07-mr-readme.md +32 -0
  1119. package/dist/examples/08-code-health-review.md +50 -0
  1120. package/dist/examples/09-improvement-ledger-update.md +90 -0
  1121. package/dist/examples/10-safe-refactor.md +76 -0
  1122. package/dist/examples/11-prevention-rule-feedback.md +104 -0
  1123. package/dist/examples/12-claude-adapter-adoption.md +36 -0
  1124. package/dist/manifest.json +804 -0
  1125. package/dist/npm-runtime-inventory.json +7774 -0
  1126. package/dist/package.json +38 -0
  1127. package/dist/products/ask-core-bundle/AGENTS.md +195 -0
  1128. package/dist/products/ask-core-bundle/capabilities.json +65 -0
  1129. package/dist/products/ask-core-bundle/manifest.json +2738 -0
  1130. package/dist/schemas/adapter-runtime-event.schema.json +169 -0
  1131. package/dist/schemas/adapter-runtime-evidence.schema.json +60 -0
  1132. package/dist/schemas/adapter-runtime-profile.schema.json +281 -0
  1133. package/dist/schemas/adoption-apply-result.schema.json +215 -0
  1134. package/dist/schemas/adoption-plan.schema.json +366 -0
  1135. package/dist/schemas/adoption-report.schema.json +252 -0
  1136. package/dist/schemas/architecture-decision-memory-entry.schema.json +56 -0
  1137. package/dist/schemas/asset-content.schema.json +107 -0
  1138. package/dist/schemas/asset-lifecycle-authority-context.schema.json +69 -0
  1139. package/dist/schemas/asset-record.schema.json +362 -0
  1140. package/dist/schemas/asset-registry-snapshot.schema.json +59 -0
  1141. package/dist/schemas/claim-evidence-status.schema.json +85 -0
  1142. package/dist/schemas/codex-risk-action.schema.json +58 -0
  1143. package/dist/schemas/codex-risk-approval-request.schema.json +204 -0
  1144. package/dist/schemas/codex-risk-approval.schema.json +15 -0
  1145. package/dist/schemas/codex-runner-result.schema.json +41 -0
  1146. package/dist/schemas/compact-profile-control-map.json +154 -0
  1147. package/dist/schemas/context-rollover.schema.json +726 -0
  1148. package/dist/schemas/documentation-knowledge-ledger-entry.schema.json +49 -0
  1149. package/dist/schemas/domain-rule-ledger-entry.schema.json +93 -0
  1150. package/dist/schemas/effectiveness-decision-vocabulary.schema.json +24 -0
  1151. package/dist/schemas/engineering-capability-ledger-entry.schema.json +50 -0
  1152. package/dist/schemas/engineering-pattern-ledger-entry.schema.json +48 -0
  1153. package/dist/schemas/epic-admission-decision.schema.json +196 -0
  1154. package/dist/schemas/epic-admission-policy.schema.json +153 -0
  1155. package/dist/schemas/evolution-action-proposal.schema.json +183 -0
  1156. package/dist/schemas/evolution-application-receipt.schema.json +263 -0
  1157. package/dist/schemas/evolution-candidate.schema.json +269 -0
  1158. package/dist/schemas/evolution-experiment.schema.json +368 -0
  1159. package/dist/schemas/evolution-human-decision.schema.json +79 -0
  1160. package/dist/schemas/evolution-recommendation.schema.json +211 -0
  1161. package/dist/schemas/execution-envelope-record.schema.json +127 -0
  1162. package/dist/schemas/execution-envelope.schema.json +127 -0
  1163. package/dist/schemas/fixed-entry-profile-registry.json +44 -0
  1164. package/dist/schemas/improvement-ledger-entry.schema.json +98 -0
  1165. package/dist/schemas/instruction-asset-package.schema.json +343 -0
  1166. package/dist/schemas/metrics-event.schema.json +395 -0
  1167. package/dist/schemas/normalized-event-schema-registry.json +13 -0
  1168. package/dist/schemas/portfolio-authority-context.schema.json +151 -0
  1169. package/dist/schemas/portfolio-lock.schema.json +99 -0
  1170. package/dist/schemas/portfolio-manifest.schema.json +414 -0
  1171. package/dist/schemas/portfolio-selection-context.schema.json +101 -0
  1172. package/dist/schemas/portfolio-selection.schema.json +266 -0
  1173. package/dist/schemas/release-assessment.schema.json +64 -0
  1174. package/dist/schemas/release-claim-matrix.schema.json +89 -0
  1175. package/dist/schemas/release-evidence-catalog.schema.json +154 -0
  1176. package/dist/schemas/repository-snapshot.schema.json +244 -0
  1177. package/dist/schemas/review-finding.schema.json +110 -0
  1178. package/dist/schemas/review-rule-ledger-entry.schema.json +52 -0
  1179. package/dist/schemas/review-signal-gate-map.json +128 -0
  1180. package/dist/schemas/rollover-evaluation.schema.json +397 -0
  1181. package/dist/schemas/session-checkpoint.schema.json +206 -0
  1182. package/dist/schemas/skill-effectiveness-outcome.schema.json +490 -0
  1183. package/dist/schemas/verification-completion-policy.schema.json +79 -0
  1184. package/dist/schemas/verification-evidence-transfer.schema.json +67 -0
  1185. package/dist/schemas/verification-evidence.schema.json +352 -0
  1186. package/dist/schemas/verification-pattern-ledger-entry.schema.json +52 -0
  1187. package/dist/schemas/verification-proof-policy.schema.json +326 -0
  1188. package/dist/schemas/verification-reuse-measurement.schema.json +370 -0
  1189. package/dist/schemas/verification-reuse-plan.schema.json +239 -0
  1190. package/dist/schemas/verification-scoped-reuse.schema.json +484 -0
  1191. package/dist/schemas/work-package-plan-validation-context.schema.json +244 -0
  1192. package/dist/schemas/work-package-plan.schema.json +495 -0
  1193. package/dist/scripts/adapter-cross-conformance.mjs +431 -0
  1194. package/dist/scripts/adapter-runtime-bundle.mjs +452 -0
  1195. package/dist/scripts/adapter-runtime-event.mjs +233 -0
  1196. package/dist/scripts/adapter-runtime-inventory.mjs +69 -0
  1197. package/dist/scripts/adapter-runtime-smoke.mjs +372 -0
  1198. package/dist/scripts/ai-ledger-refresh.mjs +387 -0
  1199. package/dist/scripts/ai-metrics-record.mjs +1318 -0
  1200. package/dist/scripts/ai-metrics-summarize.mjs +1085 -0
  1201. package/dist/scripts/ask-benchmark-admission-decision.mjs +675 -0
  1202. package/dist/scripts/ask-benchmark-atomic-publication.mjs +85 -0
  1203. package/dist/scripts/ask-benchmark-calibration-source.mjs +49 -0
  1204. package/dist/scripts/ask-benchmark-command-evidence.mjs +1048 -0
  1205. package/dist/scripts/ask-benchmark-design-admission.mjs +524 -0
  1206. package/dist/scripts/ask-benchmark-design-review.mjs +387 -0
  1207. package/dist/scripts/ask-benchmark-duplicate-key-json.mjs +133 -0
  1208. package/dist/scripts/ask-benchmark-evaluator-boundary.mjs +3869 -0
  1209. package/dist/scripts/ask-benchmark-execution.mjs +2442 -0
  1210. package/dist/scripts/ask-benchmark-materialize.mjs +582 -0
  1211. package/dist/scripts/ask-benchmark-mn-build-option-update.mjs +506 -0
  1212. package/dist/scripts/ask-benchmark-mn-client-probe-v2.mjs +185 -0
  1213. package/dist/scripts/ask-benchmark-mn-focused-probe-v2.mjs +318 -0
  1214. package/dist/scripts/ask-benchmark-mn-focused-regression-test.mjs +168 -0
  1215. package/dist/scripts/ask-benchmark-mp-ci-evidence-gap.mjs +167 -0
  1216. package/dist/scripts/ask-benchmark-normalized-results.mjs +884 -0
  1217. package/dist/scripts/ask-benchmark-pf-performance-probe.mjs +342 -0
  1218. package/dist/scripts/ask-benchmark-pf-performance-source.mjs +248 -0
  1219. package/dist/scripts/ask-benchmark-plan.mjs +284 -0
  1220. package/dist/scripts/ask-benchmark-portfolio-aggregate-result-v2.mjs +929 -0
  1221. package/dist/scripts/ask-benchmark-portfolio-aggregate-result.mjs +354 -0
  1222. package/dist/scripts/ask-benchmark-portfolio-catalog.mjs +378 -0
  1223. package/dist/scripts/ask-benchmark-portfolio-consumer-report.mjs +193 -0
  1224. package/dist/scripts/ask-benchmark-portfolio-directional-outcome-report.mjs +274 -0
  1225. package/dist/scripts/ask-benchmark-portfolio-evolution-evidence.mjs +169 -0
  1226. package/dist/scripts/ask-benchmark-portfolio-high-impact-sensitivity.mjs +209 -0
  1227. package/dist/scripts/ask-benchmark-portfolio-legacy-calibration-migration.mjs +383 -0
  1228. package/dist/scripts/ask-benchmark-portfolio-mechanism-scorecard.mjs +382 -0
  1229. package/dist/scripts/ask-benchmark-portfolio-paired-comparison-report.mjs +460 -0
  1230. package/dist/scripts/ask-benchmark-portfolio-policy.mjs +1809 -0
  1231. package/dist/scripts/ask-benchmark-portfolio-repetition-report.mjs +314 -0
  1232. package/dist/scripts/ask-benchmark-portfolio-result-set.mjs +664 -0
  1233. package/dist/scripts/ask-benchmark-portfolio-score.mjs +541 -0
  1234. package/dist/scripts/ask-benchmark-private-evaluator-runner.mjs +615 -0
  1235. package/dist/scripts/ask-benchmark-prompt-successor-bridge.mjs +234 -0
  1236. package/dist/scripts/ask-benchmark-prompt-successor-check.mjs +68 -0
  1237. package/dist/scripts/ask-benchmark-prompt-successor-collection.mjs +113 -0
  1238. package/dist/scripts/ask-benchmark-prompt-successor-control.mjs +115 -0
  1239. package/dist/scripts/ask-benchmark-prompt-successor-delivery.mjs +270 -0
  1240. package/dist/scripts/ask-benchmark-prompt-successor-measured-authority.mjs +249 -0
  1241. package/dist/scripts/ask-benchmark-prompt-successor-measured-execution.mjs +733 -0
  1242. package/dist/scripts/ask-benchmark-prompt-successor-native.mjs +137 -0
  1243. package/dist/scripts/ask-benchmark-prompt-successor-provenance.mjs +191 -0
  1244. package/dist/scripts/ask-benchmark-prompt-successor-report.mjs +256 -0
  1245. package/dist/scripts/ask-benchmark-prompt-successor-repository.mjs +107 -0
  1246. package/dist/scripts/ask-benchmark-prompt-successor-scoring-inputs.mjs +218 -0
  1247. package/dist/scripts/ask-benchmark-prompt-successor-usage.mjs +174 -0
  1248. package/dist/scripts/ask-benchmark-prompt-successor.mjs +263 -0
  1249. package/dist/scripts/ask-benchmark-prompt-v2.mjs +1332 -0
  1250. package/dist/scripts/ask-benchmark-runtime-observation.mjs +235 -0
  1251. package/dist/scripts/ask-benchmark-schema.mjs +29 -0
  1252. package/dist/scripts/ask-benchmark-scoring-contract.mjs +802 -0
  1253. package/dist/scripts/ask-benchmark-selection.mjs +387 -0
  1254. package/dist/scripts/ask-benchmark-source-session.mjs +70 -0
  1255. package/dist/scripts/ask-benchmark-stable-file.mjs +89 -0
  1256. package/dist/scripts/ask-benchmark-terminal-candidate.mjs +432 -0
  1257. package/dist/scripts/ask-benchmark-terminal-workspace.mjs +427 -0
  1258. package/dist/scripts/ask-comparison-conditions.mjs +8 -0
  1259. package/dist/scripts/ask-core-bundle-product.mjs +93 -0
  1260. package/dist/scripts/ask-core-capabilities.mjs +40 -0
  1261. package/dist/scripts/ask-core-capture-producer.mjs +298 -0
  1262. package/dist/scripts/ask-core-codex-native-contract.mjs +61 -0
  1263. package/dist/scripts/ask-core-connected-normalizer.mjs +173 -0
  1264. package/dist/scripts/ask-core-controller-attribution.mjs +74 -0
  1265. package/dist/scripts/ask-core-controller-records.mjs +49 -0
  1266. package/dist/scripts/ask-core-grading-authority.mjs +161 -0
  1267. package/dist/scripts/ask-core-native-authority.mjs +42 -0
  1268. package/dist/scripts/ask-core-native-compatibility-provenance.mjs +77 -0
  1269. package/dist/scripts/ask-core-native-connection.mjs +76 -0
  1270. package/dist/scripts/ask-core-native-files.mjs +16 -0
  1271. package/dist/scripts/ask-core-native-preparation.mjs +61 -0
  1272. package/dist/scripts/ask-core-native-receiver.mjs +91 -0
  1273. package/dist/scripts/ask-core-producer-scope.mjs +38 -0
  1274. package/dist/scripts/ask-core-runner-contract.mjs +65 -0
  1275. package/dist/scripts/ask-core-scored-replay.mjs +12 -0
  1276. package/dist/scripts/ask-core-task-admission.mjs +53 -0
  1277. package/dist/scripts/ask-doctor.mjs +1037 -0
  1278. package/dist/scripts/ask-local-codex-boundaries.mjs +141 -0
  1279. package/dist/scripts/ask-local-codex-time-budget.mjs +119 -0
  1280. package/dist/scripts/ask-local-codex-time-policy.mjs +4 -0
  1281. package/dist/scripts/ask-local-codex-timing.mjs +46 -0
  1282. package/dist/scripts/ask-local-codex.mjs +653 -0
  1283. package/dist/scripts/ask-local-eval.mjs +101 -0
  1284. package/dist/scripts/ask-package-cli.mjs +64 -0
  1285. package/dist/scripts/ask-package-environment.mjs +10 -0
  1286. package/dist/scripts/ask-package-loop-prepare.mjs +87 -0
  1287. package/dist/scripts/ask-package-workspace.mjs +55 -0
  1288. package/dist/scripts/ask-personal-evolution-alignment.mjs +126 -0
  1289. package/dist/scripts/ask-personal-evolution-codex-generation.mjs +224 -0
  1290. package/dist/scripts/ask-personal-evolution-driver.mjs +139 -0
  1291. package/dist/scripts/ask-personal-evolution-generation-connector.mjs +316 -0
  1292. package/dist/scripts/ask-personal-evolution-generation.mjs +122 -0
  1293. package/dist/scripts/ask-personal-evolution-observation.mjs +71 -0
  1294. package/dist/scripts/ask-personal-evolution-primary-pair.mjs +474 -0
  1295. package/dist/scripts/ask-personal-evolution-saved-results.mjs +112 -0
  1296. package/dist/scripts/ask-personal-evolution-source-reviewer.mjs +139 -0
  1297. package/dist/scripts/ask-personal-evolution-unattended.mjs +206 -0
  1298. package/dist/scripts/ask-personal-evolution.mjs +142 -0
  1299. package/dist/scripts/ask-personal-prompt-adoption-materialization.mjs +126 -0
  1300. package/dist/scripts/ask-personal-prompt-materialization.mjs +104 -0
  1301. package/dist/scripts/ask-personal-prompt-repetition-binding.mjs +16 -0
  1302. package/dist/scripts/ask-personal-prompt-repetition-evaluation.mjs +163 -0
  1303. package/dist/scripts/ask-personal-prompt-repetition-statistics.mjs +53 -0
  1304. package/dist/scripts/ask-personal-prompt-target-lock.mjs +34 -0
  1305. package/dist/scripts/ask-pragmatic-evaluation-report.mjs +120 -0
  1306. package/dist/scripts/ask-preparation-git-diagnostic.mjs +14 -0
  1307. package/dist/scripts/ask-primary-client-focused-controller.mjs +119 -0
  1308. package/dist/scripts/ask-primary-discovery-grammar-v9.mjs +105 -0
  1309. package/dist/scripts/ask-primary-engineering-safety.mjs +147 -0
  1310. package/dist/scripts/ask-primary-evaluation-batch.mjs +318 -0
  1311. package/dist/scripts/ask-primary-evaluation-grading.mjs +451 -0
  1312. package/dist/scripts/ask-primary-evaluation-private-grading.mjs +270 -0
  1313. package/dist/scripts/ask-primary-evaluation-producer.mjs +549 -0
  1314. package/dist/scripts/ask-primary-evaluation-profile.mjs +29 -0
  1315. package/dist/scripts/ask-primary-evaluation-scope.mjs +531 -0
  1316. package/dist/scripts/ask-primary-evaluation-start.mjs +34 -0
  1317. package/dist/scripts/ask-primary-execution-input.mjs +299 -0
  1318. package/dist/scripts/ask-primary-fixture-recipe.mjs +102 -0
  1319. package/dist/scripts/ask-primary-fixture-registry.mjs +3 -0
  1320. package/dist/scripts/ask-primary-metadata-task-contract.mjs +31 -0
  1321. package/dist/scripts/ask-primary-native-probe-lifetime.mjs +233 -0
  1322. package/dist/scripts/ask-primary-public-catalog-registry.mjs +13 -0
  1323. package/dist/scripts/ask-primary-runtime-collection-support.mjs +5 -0
  1324. package/dist/scripts/ask-primary-runtime-lineage.mjs +420 -0
  1325. package/dist/scripts/ask-primary-runtime-v10.mjs +59 -0
  1326. package/dist/scripts/ask-primary-scoring-version.mjs +269 -0
  1327. package/dist/scripts/ask-primary-unsafe-action-contract.mjs +86 -0
  1328. package/dist/scripts/ask-review-target-requirement.mjs +118 -0
  1329. package/dist/scripts/ask-rule-batch-bundle.mjs +191 -0
  1330. package/dist/scripts/ask-sensors.mjs +978 -0
  1331. package/dist/scripts/ask-setup-apply-state.mjs +359 -0
  1332. package/dist/scripts/ask-setup-apply.mjs +257 -0
  1333. package/dist/scripts/ask-setup-diagnostics.mjs +45 -0
  1334. package/dist/scripts/ask-setup-doctor-inputs.mjs +78 -0
  1335. package/dist/scripts/ask-setup-git.mjs +130 -0
  1336. package/dist/scripts/ask-setup-inputs.mjs +181 -0
  1337. package/dist/scripts/ask-setup.mjs +762 -0
  1338. package/dist/scripts/ask-shared.mjs +627 -0
  1339. package/dist/scripts/ask-synthetic-json-pilot.mjs +561 -0
  1340. package/dist/scripts/ask-user-comparison-logs.mjs +74 -0
  1341. package/dist/scripts/ask-user-comparison-prepare.mjs +846 -0
  1342. package/dist/scripts/ask-user-comparison-state.mjs +329 -0
  1343. package/dist/scripts/ask-user-comparison-test-reporter.mjs +22 -0
  1344. package/dist/scripts/ask-user-comparison.mjs +1087 -0
  1345. package/dist/scripts/asset-registry.mjs +1002 -0
  1346. package/dist/scripts/claim-evidence-status.mjs +162 -0
  1347. package/dist/scripts/claude-fixed-entry-profile.mjs +218 -0
  1348. package/dist/scripts/claude-native-runtime.mjs +108 -0
  1349. package/dist/scripts/claude-plugin-fixed-entries.mjs +53 -0
  1350. package/dist/scripts/codex-exec-runner.mjs +1479 -0
  1351. package/dist/scripts/codex-metrics-collector.mjs +188 -0
  1352. package/dist/scripts/codex-risk-approval.mjs +477 -0
  1353. package/dist/scripts/codex-risk-workspace.mjs +585 -0
  1354. package/dist/scripts/codex-runtime-profile.mjs +153 -0
  1355. package/dist/scripts/content-addressed-store.mjs +379 -0
  1356. package/dist/scripts/environment-evaluation.mjs +69 -0
  1357. package/dist/scripts/environment-evolution-binding.mjs +66 -0
  1358. package/dist/scripts/environment-saved-results.mjs +122 -0
  1359. package/dist/scripts/environment-target-owner.mjs +103 -0
  1360. package/dist/scripts/environment-target.mjs +260 -0
  1361. package/dist/scripts/epic-admission-work-package-plan.mjs +2009 -0
  1362. package/dist/scripts/evaluation-task-catalog.mjs +268 -0
  1363. package/dist/scripts/evaluation-task-inputs.mjs +166 -0
  1364. package/dist/scripts/evaluation-task-scoring.mjs +237 -0
  1365. package/dist/scripts/evolution-loop.mjs +1773 -0
  1366. package/dist/scripts/execution-envelope.mjs +293 -0
  1367. package/dist/scripts/finding-intake.mjs +114 -0
  1368. package/dist/scripts/fixed-entry-profile.mjs +239 -0
  1369. package/dist/scripts/fixtures/ask-core-receiver-child.mjs +35 -0
  1370. package/dist/scripts/fixtures/instruction-loop/fake-codex.py +6 -0
  1371. package/dist/scripts/generate-ask-core-bundle.mjs +41 -0
  1372. package/dist/scripts/generate-ask-core-grading-schemas.mjs +9 -0
  1373. package/dist/scripts/generate-ask-primary-grading-schemas.mjs +226 -0
  1374. package/dist/scripts/install-ask-core-bundle.mjs +117 -0
  1375. package/dist/scripts/install-claude-adapter.mjs +1444 -0
  1376. package/dist/scripts/install-codex-adapter.mjs +1578 -0
  1377. package/dist/scripts/install-kernel.mjs +408 -0
  1378. package/dist/scripts/installer-lifecycle.mjs +698 -0
  1379. package/dist/scripts/instruction-asset-package.mjs +252 -0
  1380. package/dist/scripts/instruction-composition.mjs +62 -0
  1381. package/dist/scripts/instruction-environment-authoring.mjs +265 -0
  1382. package/dist/scripts/instruction-environment-cli.mjs +129 -0
  1383. package/dist/scripts/instruction-environment-compiler.mjs +92 -0
  1384. package/dist/scripts/instruction-environment.mjs +148 -0
  1385. package/dist/scripts/instruction-evaluation-recovery.mjs +86 -0
  1386. package/dist/scripts/instruction-loop-artifact.mjs +6 -0
  1387. package/dist/scripts/instruction-loop-assets.mjs +67 -0
  1388. package/dist/scripts/instruction-loop-case-selection.mjs +31 -0
  1389. package/dist/scripts/instruction-loop-command-runtime.mjs +108 -0
  1390. package/dist/scripts/instruction-loop-component-candidate.mjs +116 -0
  1391. package/dist/scripts/instruction-loop-component-continuation.mjs +61 -0
  1392. package/dist/scripts/instruction-loop-component-runtime.mjs +151 -0
  1393. package/dist/scripts/instruction-loop-environment-approval.mjs +51 -0
  1394. package/dist/scripts/instruction-loop-failed-preparation.mjs +243 -0
  1395. package/dist/scripts/instruction-loop-feedback.mjs +226 -0
  1396. package/dist/scripts/instruction-loop-fixed-scoring.mjs +39 -0
  1397. package/dist/scripts/instruction-loop-fixed-scoring.py +98 -0
  1398. package/dist/scripts/instruction-loop-full-candidate.mjs +351 -0
  1399. package/dist/scripts/instruction-loop-host-authoring.mjs +66 -0
  1400. package/dist/scripts/instruction-loop-host-scoring.mjs +110 -0
  1401. package/dist/scripts/instruction-loop-measured-adoption.mjs +106 -0
  1402. package/dist/scripts/instruction-loop-native-configuration.mjs +150 -0
  1403. package/dist/scripts/instruction-loop-native-host.mjs +229 -0
  1404. package/dist/scripts/instruction-loop-native-prepare.py +107 -0
  1405. package/dist/scripts/instruction-loop-native-public-inputs.mjs +52 -0
  1406. package/dist/scripts/instruction-loop-native-worker.mjs +10 -0
  1407. package/dist/scripts/instruction-loop-normal-owner-worker.mjs +97 -0
  1408. package/dist/scripts/instruction-loop-operation.mjs +108 -0
  1409. package/dist/scripts/instruction-loop-practical-runtime.mjs +188 -0
  1410. package/dist/scripts/instruction-loop-provider-policy.mjs +23 -0
  1411. package/dist/scripts/instruction-loop-reference-evidence.mjs +95 -0
  1412. package/dist/scripts/instruction-loop-reference-preparation.mjs +138 -0
  1413. package/dist/scripts/instruction-loop-reference-report.mjs +84 -0
  1414. package/dist/scripts/instruction-loop-reference-scoring-runtime.mjs +48 -0
  1415. package/dist/scripts/instruction-loop-result-disposition.mjs +26 -0
  1416. package/dist/scripts/instruction-loop-retained-authoring.mjs +125 -0
  1417. package/dist/scripts/instruction-loop-runtime.mjs +8 -0
  1418. package/dist/scripts/instruction-loop-source-application.mjs +106 -0
  1419. package/dist/scripts/instruction-loop-source-binding.mjs +37 -0
  1420. package/dist/scripts/instruction-projection-paths.mjs +16 -0
  1421. package/dist/scripts/instruction-run-journal.mjs +45 -0
  1422. package/dist/scripts/instruction-source-version.mjs +104 -0
  1423. package/dist/scripts/json-schema-validation.mjs +419 -0
  1424. package/dist/scripts/kernel-principles-candidate-v2.mjs +71 -0
  1425. package/dist/scripts/kernel-principles-v2-catalog24.mjs +86 -0
  1426. package/dist/scripts/kernel-principles-v2.mjs +122 -0
  1427. package/dist/scripts/kernel-principles.mjs +81 -0
  1428. package/dist/scripts/local-codex-probe-worker.mjs +143 -0
  1429. package/dist/scripts/observability-paths.mjs +31 -0
  1430. package/dist/scripts/portfolio-manager.mjs +1870 -0
  1431. package/dist/scripts/practical-challenge-evaluation.mjs +194 -0
  1432. package/dist/scripts/practical-challenge-worker.mjs +126 -0
  1433. package/dist/scripts/practical-codex-adapter.mjs +107 -0
  1434. package/dist/scripts/practical-evaluation-assessor.mjs +92 -0
  1435. package/dist/scripts/practical-evaluation-cli.mjs +134 -0
  1436. package/dist/scripts/practical-evaluation-runner.mjs +261 -0
  1437. package/dist/scripts/practical-evaluation-worker.mjs +193 -0
  1438. package/dist/scripts/practical-grade-report-revision.mjs +12 -0
  1439. package/dist/scripts/practical-grade-source-binding.mjs +53 -0
  1440. package/dist/scripts/practical-grade-supplement.mjs +457 -0
  1441. package/dist/scripts/practical-host-reporting-policy.mjs +85 -0
  1442. package/dist/scripts/practical-initialization-clearance.mjs +143 -0
  1443. package/dist/scripts/practical-initialization-recovery-cli.mjs +44 -0
  1444. package/dist/scripts/practical-isolated-grade-continuation-cli.mjs +19 -0
  1445. package/dist/scripts/practical-isolated-grade-continuation.mjs +179 -0
  1446. package/dist/scripts/practical-primary-grading.mjs +130 -0
  1447. package/dist/scripts/practical-quality-observation.mjs +61 -0
  1448. package/dist/scripts/practical-reporting-grader.mjs +160 -0
  1449. package/dist/scripts/practical-reporting-policy.mjs +126 -0
  1450. package/dist/scripts/practical-retained-grade-report-cli.mjs +19 -0
  1451. package/dist/scripts/practical-retained-grade-report.mjs +80 -0
  1452. package/dist/scripts/practical-saved-command-observation.mjs +159 -0
  1453. package/dist/scripts/practical-session-usage.mjs +73 -0
  1454. package/dist/scripts/prepare-historical-full-test-root.mjs +155 -0
  1455. package/dist/scripts/prompt-v2-historical-renderer.mjs +61 -0
  1456. package/dist/scripts/prompt-v2-preregistration-samples.mjs +1410 -0
  1457. package/dist/scripts/release-evidence-gate.mjs +421 -0
  1458. package/dist/scripts/retained-instruction-comparison.mjs +154 -0
  1459. package/dist/scripts/retained-instruction-layout.mjs +103 -0
  1460. package/dist/scripts/review-route-contract.mjs +135 -0
  1461. package/dist/scripts/review-rule-lifecycle.mjs +171 -0
  1462. package/dist/scripts/saved-instruction-pair-evidence.mjs +37 -0
  1463. package/dist/scripts/skill-assets.mjs +48 -0
  1464. package/dist/scripts/skill-effectiveness-outcome.mjs +501 -0
  1465. package/dist/scripts/skill-usage-evidence.mjs +80 -0
  1466. package/dist/scripts/supervised-instruction-loop-cli.mjs +180 -0
  1467. package/dist/scripts/supervised-instruction-loop.mjs +392 -0
  1468. package/dist/scripts/verification-decision-core.mjs +248 -0
  1469. package/dist/scripts/verification-evidence.mjs +754 -0
  1470. package/dist/scripts/verification-host-provider.mjs +61 -0
  1471. package/dist/scripts/verification-proof-policy.mjs +318 -0
  1472. package/dist/scripts/verification-reuse-completion.mjs +338 -0
  1473. package/dist/scripts/verification-review-dispatch.mjs +144 -0
  1474. package/dist/scripts/verification-scoped-reuse.mjs +993 -0
  1475. package/dist/skills/adr-review/SKILL.md +108 -0
  1476. package/dist/skills/angular-implementation-architecture/SKILL.md +187 -0
  1477. package/dist/skills/application-boundary-architecture/SKILL.md +412 -0
  1478. package/dist/skills/architecture-decision-memory/SKILL.md +102 -0
  1479. package/dist/skills/code-visualization/SKILL.md +24 -0
  1480. package/dist/skills/code-visualization/references/examples/pr497.json +328 -0
  1481. package/dist/skills/code-visualization/references/examples/skill-assets.json +257 -0
  1482. package/dist/skills/code-visualization/references/guide-input.md +48 -0
  1483. package/dist/skills/code-visualization/references/render-guide.mjs +238 -0
  1484. package/dist/skills/code-visualization/references/scene-model.mjs +96 -0
  1485. package/dist/skills/code-visualization/references/visual-player.js +346 -0
  1486. package/dist/skills/code-visualization/references/visual-surface.css +15 -0
  1487. package/dist/skills/controlled-implementation/SKILL.md +195 -0
  1488. package/dist/skills/documentation-knowledge-compiler/SKILL.md +100 -0
  1489. package/dist/skills/domain-rule-ledger/SKILL.md +109 -0
  1490. package/dist/skills/doubt-driven-development/SKILL.md +101 -0
  1491. package/dist/skills/engineering-capability-evaluation/SKILL.md +103 -0
  1492. package/dist/skills/engineering-pattern-ledger/SKILL.md +110 -0
  1493. package/dist/skills/evidence-ledger/SKILL.md +96 -0
  1494. package/dist/skills/grill-design/SKILL.md +92 -0
  1495. package/dist/skills/grill-with-docs/SKILL.md +89 -0
  1496. package/dist/skills/handoff-generation/SKILL.md +99 -0
  1497. package/dist/skills/implementation-context-generation/SKILL.md +185 -0
  1498. package/dist/skills/improvement-ledger/SKILL.md +206 -0
  1499. package/dist/skills/mr-readme-generation/SKILL.md +201 -0
  1500. package/dist/skills/next-best-change-finder/SKILL.md +112 -0
  1501. package/dist/skills/operating-mode-router/SKILL.md +141 -0
  1502. package/dist/skills/planning-with-files/SKILL.md +81 -0
  1503. package/dist/skills/project-adoption-pack-generation/SKILL.md +113 -0
  1504. package/dist/skills/refactor-implementation/SKILL.md +142 -0
  1505. package/dist/skills/release-readiness-gate/SKILL.md +161 -0
  1506. package/dist/skills/repository-orientation/SKILL.md +94 -0
  1507. package/dist/skills/requirement-grill/SKILL.md +137 -0
  1508. package/dist/skills/review-adversarial-risk/SKILL.md +117 -0
  1509. package/dist/skills/review-ai-quality/SKILL.md +127 -0
  1510. package/dist/skills/review-architecture-impact/SKILL.md +144 -0
  1511. package/dist/skills/review-automated-gate/SKILL.md +84 -0
  1512. package/dist/skills/review-code-health/SKILL.md +140 -0
  1513. package/dist/skills/review-context-generation/SKILL.md +175 -0
  1514. package/dist/skills/review-domain-impact/SKILL.md +182 -0
  1515. package/dist/skills/review-final-merge-gate/SKILL.md +120 -0
  1516. package/dist/skills/review-finding-compiler/SKILL.md +96 -0
  1517. package/dist/skills/review-output-quality/SKILL.md +167 -0
  1518. package/dist/skills/review-router/SKILL.md +161 -0
  1519. package/dist/skills/review-to-rule-compiler/SKILL.md +91 -0
  1520. package/dist/skills/risk-gate/SKILL.md +94 -0
  1521. package/dist/skills/scope-control/SKILL.md +97 -0
  1522. package/dist/skills/skill-adoption-metrics/SKILL.md +210 -0
  1523. package/dist/skills/skill-effectiveness-evaluation/SKILL.md +248 -0
  1524. package/dist/skills/skill-effectiveness-evaluation/references/practical-evaluation.md +204 -0
  1525. package/dist/skills/skill-router/SKILL.md +205 -0
  1526. package/dist/skills/spec-driven-development/SKILL.md +136 -0
  1527. package/dist/skills/spec-driven-development/references/context-retrieval.md +40 -0
  1528. package/dist/skills/spec-driven-development/references/decision-led-test-strategy.md +46 -0
  1529. package/dist/skills/spec-driven-development/references/examples/domain-context.md +20 -0
  1530. package/dist/skills/spec-driven-development/references/examples/javascript/reservation.cases.mjs +26 -0
  1531. package/dist/skills/spec-driven-development/references/examples/javascript/reservation.mjs +11 -0
  1532. package/dist/skills/spec-driven-development/references/examples/javascript/reservation.test.mjs +65 -0
  1533. package/dist/skills/spec-driven-development/references/examples/javascript/scenario-observer.mjs +47 -0
  1534. package/dist/skills/spec-driven-development/references/examples/javascript/scenario-player.html +109 -0
  1535. package/dist/skills/spec-driven-development/references/examples/javascript/scenario-review.mjs +166 -0
  1536. package/dist/skills/spec-driven-development/references/examples/python/reservation.py +10 -0
  1537. package/dist/skills/spec-driven-development/references/examples/python/test_reservation.py +40 -0
  1538. package/dist/skills/spec-driven-development/references/examples/quote-reissue/confirmed-quote.mjs +16 -0
  1539. package/dist/skills/spec-driven-development/references/examples/quote-reissue/confirmed-quote.test.mjs +19 -0
  1540. package/dist/skills/spec-driven-development/references/examples/quote-reissue/decision-record.md +25 -0
  1541. package/dist/skills/spec-driven-development/references/examples/quote-reissue/quote-reissue.mjs +28 -0
  1542. package/dist/skills/spec-driven-development/references/examples/quote-reissue/quote-reissue.test.mjs +69 -0
  1543. package/dist/skills/spec-driven-development/references/executable-spec-workflow.md +52 -0
  1544. package/dist/skills/spec-driven-development/references/project-templates.md +92 -0
  1545. package/dist/skills/spec-driven-development/references/quote-reissue-decision.md +35 -0
  1546. package/dist/skills/spec-driven-development/references/scenario-visual-review.md +92 -0
  1547. package/dist/skills/spec-driven-development/references/spec-index.md +51 -0
  1548. package/dist/skills/spec-driven-development/references/spec-writing-conventions.md +52 -0
  1549. package/dist/skills/spec-driven-development/references/verification-selection.md +44 -0
  1550. package/dist/skills/test-first-verification/SKILL.md +170 -0
  1551. package/dist/skills/ui-ux-design/SKILL.md +98 -0
  1552. package/dist/skills/ui-ux-design/references/anti-patterns.md +51 -0
  1553. package/dist/skills/ui-ux-design/references/decision-patterns.md +213 -0
  1554. package/dist/skills/ui-ux-design/references/principles.md +55 -0
  1555. package/dist/skills/ui-ux-design/references/ui-capability-contract.md +70 -0
  1556. package/dist/skills/ui-ux-design/references/working-state.md +52 -0
  1557. package/dist/skills/verification-pattern-ledger/SKILL.md +96 -0
  1558. package/dist/skills/work-package-compiler/SKILL.md +129 -0
  1559. package/package.json +36 -4
@@ -0,0 +1,2009 @@
1
+ #!/usr/bin/env node
2
+ import { createHash } from "node:crypto";
3
+ import { existsSync, readFileSync } from "node:fs";
4
+ import { dirname, resolve } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import {
7
+ canonicalDigest,
8
+ readJsonFileStrict,
9
+ stableCanonicalJson,
10
+ } from "./content-addressed-store.mjs";
11
+ import { validateJsonSchema } from "./execution-envelope.mjs";
12
+
13
+ export const EPIC_ADMISSION_SCHEMA_VERSION = "1.1.0";
14
+ export const WORK_PACKAGE_PLAN_SCHEMA_VERSION = "1.2.0";
15
+ export const EPIC_ADMISSION_PROGRAM = "ask_epic_admission";
16
+ export const WORK_PACKAGE_PLAN_PROGRAM = "ask_work_package_plan";
17
+
18
+ const MODULE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
19
+ const DEFAULT_PATHS = Object.freeze({
20
+ policySchema: "schemas/epic-admission-policy.schema.json",
21
+ decisionSchema: "schemas/epic-admission-decision.schema.json",
22
+ contextSchema: "schemas/work-package-plan-validation-context.schema.json",
23
+ planSchema: "schemas/work-package-plan.schema.json",
24
+ policy: "docs/fixtures/epic-admission-policy.json",
25
+ decision: "docs/fixtures/issue-275-slice-1-epic-admission-decision.json",
26
+ context: "docs/fixtures/issue-275-slice-1-work-package-plan-validation-context.json",
27
+ plan: "docs/fixtures/issue-275-slice-1-work-package-plan.json",
28
+ firstContext: "docs/fixtures/issue-275-slice-1-work-package-plan-validation-context-r1.json",
29
+ firstPlan: "docs/fixtures/issue-275-slice-1-work-package-plan-r1.json",
30
+ previousContext: "docs/fixtures/issue-275-slice-1-work-package-plan-validation-context-r2.json",
31
+ previousPlan: "docs/fixtures/issue-275-slice-1-work-package-plan-r2.json",
32
+ cases: "docs/fixtures/epic-admission-work-package-plan-cases.json",
33
+ });
34
+
35
+ const HISTORICAL_ARTIFACT_PINS = Object.freeze({
36
+ firstContext: Object.freeze({
37
+ label: "r1 context",
38
+ schemaVersion: "1.0.0",
39
+ revision: 1,
40
+ digestField: "context_digest",
41
+ canonicalDigest: "sha256:77d060f40ac11a74f5d9e39bf28f5653ecade591b09bb090b9a42958ec6c11db",
42
+ rawDigest: "sha256:0d1de9f8979799c16fd7ed8ea677e360d74dd3a980a3eab58f73a9e6afb51236",
43
+ }),
44
+ firstPlan: Object.freeze({
45
+ label: "r1 plan",
46
+ schemaVersion: "1.0.0",
47
+ revision: 1,
48
+ digestField: "plan_digest",
49
+ canonicalDigest: "sha256:11adfda1e0a27c5aee8460807ef26f77b65ebd13ed26835b9e1e3af7654bb65d",
50
+ rawDigest: "sha256:c65c703eb760467289847364d6dcb68c0bcc863ae091a641d892550e3a815437",
51
+ }),
52
+ previousContext: Object.freeze({
53
+ label: "r2 context",
54
+ schemaVersion: "1.1.0",
55
+ revision: 2,
56
+ digestField: "context_digest",
57
+ canonicalDigest: "sha256:e33aebb1eacbeb9edb0dea3a33e252c4e686556677c44c47b013b45894d8bc1e",
58
+ rawDigest: "sha256:e8d28d9b431d3118563d2db44f8eeeb56851678f3fc9163aeb485b8df3de0d3b",
59
+ }),
60
+ previousPlan: Object.freeze({
61
+ label: "r2 plan",
62
+ schemaVersion: "1.1.0",
63
+ revision: 2,
64
+ digestField: "plan_digest",
65
+ canonicalDigest: "sha256:e97a2ef854ab5350d11ca00e305aaf44eb01939744500513bfee313ff94b8e3f",
66
+ rawDigest: "sha256:545a7d08d055c1e99e95d9b49fca4e26021945328865b686febe94b276c275b4",
67
+ }),
68
+ });
69
+
70
+ const AUTHORITY_SIGNAL_NAMES = Object.freeze([
71
+ "acceptance_condition_count",
72
+ "acceptance_registry_digest",
73
+ "configured_epic",
74
+ "independent_publication_units",
75
+ "ordered_dependency",
76
+ "scope_boundary_count",
77
+ "scope_resolution",
78
+ ]);
79
+
80
+ const REQUIRED_CASE_IDS = Object.freeze([
81
+ "POS-SMALL-ORDINARY",
82
+ "POS-CONFIGURED-EPIC",
83
+ "POS-CONFIGURED-EPIC-ONLY",
84
+ "POS-MULTI-BOUNDARY-THRESHOLD-ONLY",
85
+ "POS-ORDERED-DEPENDENCY-ONLY",
86
+ "POS-INDEPENDENT-PUBLICATION-ONLY",
87
+ "POS-SCOPE-HUMAN-DECISION",
88
+ "POS-VALID-MULTI-PACKAGE",
89
+ "POS-VALID-SHARED-OWNERSHIP",
90
+ "POS-PLAN-DERIVED-STACK-ORDER",
91
+ "POS-INDEPENDENT-PUBLICATION-CONSOLIDATED",
92
+ "POS-TRUSTED-HUMAN-APPROVAL",
93
+ "POS-LIFECYCLE-WORK-PACKAGE-PROJECTION",
94
+ "POS-OBSERVED-ARTIFACT-CLOSURE",
95
+ "POS-EXPLICIT-OVERRIDE",
96
+ "POS-DETERMINISTIC-IDENTITY",
97
+ "POS-REVISION-ONE-TO-TWO",
98
+ "NEG-SMALL-FALSE-EPIC",
99
+ "NEG-AI-ESTIMATE-SOLE-BLOCK",
100
+ "NEG-EVIDENCE-REF-BLANK",
101
+ "NEG-EVALUATION-INPUT-COUNT",
102
+ "NEG-EVALUATION-INPUT-EVIDENCE",
103
+ "NEG-EVALUATION-INPUT-SCOPE",
104
+ "NEG-POLICY-UNKNOWN-SCOPE-FAIL-OPEN",
105
+ "NEG-OVERRIDE-REASON",
106
+ "NEG-OVERRIDE-AUTHORITY",
107
+ "NEG-OVERRIDE-AUTHORITY-REF",
108
+ "NEG-OVERRIDE-GRANT",
109
+ "NEG-OVERRIDE-GRANT-EVIDENCE-BLANK",
110
+ "NEG-OVERRIDE-BASIS-REPLAY",
111
+ "NEG-OVERRIDE-NOT-REQUESTED-PAYLOAD",
112
+ "NEG-OVERRIDE-POLICY",
113
+ "NEG-OVERRIDE-BOUNDARY",
114
+ "NEG-PACKAGE-ID-MISSING",
115
+ "NEG-PACKAGE-ID-DUPLICATE",
116
+ "NEG-DAG-CYCLE",
117
+ "NEG-DEPENDENCY-UNKNOWN",
118
+ "NEG-DEPENDENCY-TARGET-MISSING",
119
+ "NEG-AC-UNCOVERED",
120
+ "NEG-AC-CONFLICT",
121
+ "NEG-AC-OWNER-UNKNOWN",
122
+ "NEG-AC-SHARED-AMBIGUOUS",
123
+ "NEG-SCOPE-MISSING",
124
+ "NEG-SCOPE-OVERLAP",
125
+ "NEG-SCOPE-PATH-BACKSLASH",
126
+ "NEG-SCOPE-PATH-CONTROL",
127
+ "NEG-STACK-BASE",
128
+ "NEG-INTEGRATION-ORDER",
129
+ "NEG-INDEPENDENT-BRANCH",
130
+ "NEG-PUBLICATION-UNRECONSTRUCTABLE",
131
+ "NEG-REVIEW-UNRECONSTRUCTABLE",
132
+ "NEG-ARTIFACT-OWNERSHIP-CONFLICT",
133
+ "NEG-WORK-PACKAGE-ARTIFACT-ID-DUPLICATE",
134
+ "NEG-TASK-ID-DUPLICATE",
135
+ "NEG-STOP-CONDITION-DUPLICATE",
136
+ "NEG-EXPECTED-ARTIFACT-PATH-INVALID",
137
+ "NEG-EXPECTED-ARTIFACT-OUTSIDE-SCOPE",
138
+ "NEG-EXPECTED-ARTIFACT-FORBIDDEN",
139
+ "NEG-FOCUSED-GATE-MISSING",
140
+ "NEG-FULL-GATE-PROCEDURE-BLANK",
141
+ "NEG-FULL-GATE-PURPOSE-BLANK",
142
+ "NEG-FULL-CHECKPOINT-MISSING",
143
+ "NEG-HIDDEN-BLOCKER",
144
+ "NEG-BLOCKER-STATUS-DOWNGRADE",
145
+ "NEG-HIDDEN-HUMAN-DECISION",
146
+ "NEG-HIDDEN-HUMAN-APPROVAL",
147
+ "NEG-BLOCKER-ID-DUPLICATE",
148
+ "NEG-DECISION-ID-DUPLICATE",
149
+ "NEG-APPROVAL-ID-DUPLICATE",
150
+ "NEG-APPROVAL-AUTHORITY-MISSING",
151
+ "NEG-APPROVAL-AUTHORITY-MISMATCH",
152
+ "NEG-APPROVAL-STATUS-SELF-ASSERTED",
153
+ "NEG-DIGEST-TAMPER",
154
+ "NEG-IDENTITY-TAMPER",
155
+ "NEG-STALE",
156
+ "NEG-PLAN-CONTENT-STALE",
157
+ "NEG-GATE-DEFINITION-WEAKENED",
158
+ "NEG-ADMISSION-AC-COUNT-STALE",
159
+ "NEG-ADMISSION-AC-REGISTRY-STALE",
160
+ "NEG-ORDERED-DEPENDENCY-SIGNAL-MISMATCH",
161
+ "NEG-STACK-DEPENDENCY-CLOSURE",
162
+ "NEG-REVISION-ONE-LINEAGE-PAYLOAD",
163
+ "NEG-LIFECYCLE-PROJECTION-DRIFT",
164
+ "NEG-PREVIOUS-PLAN-CONTENT-MISMATCH",
165
+ "NEG-OBSERVED-ARTIFACT-MISSING",
166
+ "NEG-OBSERVED-ARTIFACT-UNPLANNED",
167
+ "NEG-CROSS-PLAN",
168
+ "NEG-CROSS-REPOSITORY",
169
+ "NEG-PARTIAL",
170
+ "NEG-PROPOSED-NOT-EXECUTABLE",
171
+ "NEG-EXECUTABLE-OPEN-BLOCKER",
172
+ "NEG-EXECUTABLE-UNRESOLVED-DECISION",
173
+ "NEG-EXECUTABLE-APPROVAL-REQUIRED",
174
+ "NEG-EXECUTABLE-ADMISSION-HUMAN",
175
+ "NEG-DUPLICATE-KEY",
176
+ "NEG-UNKNOWN-FIELD",
177
+ "NEG-UNKNOWN-STATE",
178
+ "NEG-ADMISSION-DECISION-DEPENDENCY-MALFORMED",
179
+ "NEG-PREVIOUS-REVISION-DEPENDENCY-MALFORMED",
180
+ "NEG-PREVIOUS-REVISION-ONE-PLAN-LINEAGE-PAYLOAD",
181
+ "NEG-PREVIOUS-REVISION-ONE-CONTEXT-LINEAGE-PAYLOAD",
182
+ "NEG-PREVIOUS-PLAN-SCHEMA-DOWNGRADE",
183
+ "NEG-PREVIOUS-CONTEXT-SCHEMA-DOWNGRADE",
184
+ "NEG-REPOSITORY-DECISION-MALFORMED",
185
+ "NEG-REPOSITORY-HISTORICAL-R1-CONTEXT-MALFORMED",
186
+ "NEG-REPOSITORY-HISTORICAL-R1-PLAN-MALFORMED",
187
+ "NEG-REPOSITORY-HISTORICAL-R2-CONTEXT-MALFORMED",
188
+ "NEG-REPOSITORY-HISTORICAL-R2-PLAN-MALFORMED",
189
+ "NEG-POLICY-DEPENDENCY-MALFORMED",
190
+ "NEG-REPOSITORY-POLICY-MALFORMED",
191
+ "NEG-REPOSITORY-CATALOG-MALFORMED",
192
+ "NEG-PREVIOUS-R1-DEPENDENCY",
193
+ "NEG-PREVIOUS-R2-DEPENDENCY",
194
+ "NEG-PREVIOUS-R1-DAG",
195
+ "NEG-PREVIOUS-R2-DAG",
196
+ "NEG-PREVIOUS-R1-SCOPE",
197
+ "NEG-PREVIOUS-R2-SCOPE",
198
+ "NEG-PREVIOUS-R1-AC-OWNER",
199
+ "NEG-PREVIOUS-R2-AC-OWNER",
200
+ "NEG-PREVIOUS-R1-AC-COVERAGE",
201
+ "NEG-PREVIOUS-R2-AC-COVERAGE",
202
+ "NEG-PREVIOUS-R1-TOPOLOGY",
203
+ "NEG-PREVIOUS-R2-TOPOLOGY",
204
+ "NEG-PREVIOUS-R1-GATE",
205
+ "NEG-PREVIOUS-R2-GATE",
206
+ "NEG-PREVIOUS-R1-BLOCKER",
207
+ "NEG-PREVIOUS-R2-BLOCKER",
208
+ "NEG-PREVIOUS-R1-APPROVAL",
209
+ "NEG-PREVIOUS-R2-APPROVAL",
210
+ "NEG-PREVIOUS-R1-DECISION",
211
+ "NEG-PREVIOUS-R2-DECISION",
212
+ "POS-REVISION-TWO-TO-THREE",
213
+ "NEG-PREVIOUS-ADMISSION-HUMAN",
214
+ "NEG-PREVIOUS-AUTHORITY-MISSING",
215
+ "NEG-PREVIOUS-AUTHORITY-MALFORMED",
216
+ "NEG-PREVIOUS-DECISION-MALFORMED",
217
+ "NEG-PREVIOUS-PLAN-CYCLE",
218
+ "NEG-PREVIOUS-CONTEXT-CYCLE",
219
+ "NEG-PREVIOUS-ANCESTOR-BINDING",
220
+ "POS-PREVIOUS-BOUND-AUTHORITY",
221
+ "POS-PREVIOUS-PROPOSED",
222
+ "POS-PREVIOUS-BOUNDED",
223
+ "NEG-UNSAFE-PLAN-REVISION",
224
+ "NEG-UNSAFE-CONTEXT-REVISION",
225
+ "NEG-UNSAFE-CONTEXT-THROUGH-PLAN",
226
+ "NEG-UNSAFE-PREVIOUS-PLAN-REVISION",
227
+ "NEG-UNSAFE-PREVIOUS-CONTEXT-REVISION",
228
+ "NEG-UNSAFE-SAME-REVISION",
229
+ "NEG-REVISION-SUCCESSOR-OVERFLOW",
230
+ "POS-REVISION-MAX-SAFE",
231
+ ]);
232
+
233
+ function compareAscii(left, right) {
234
+ return left < right ? -1 : left > right ? 1 : 0;
235
+ }
236
+
237
+ function deepClone(value) {
238
+ return structuredClone(value);
239
+ }
240
+
241
+ function withoutField(value, field) {
242
+ const clone = deepClone(value);
243
+ delete clone[field];
244
+ return clone;
245
+ }
246
+
247
+ function uniqueSorted(values) {
248
+ return [...new Set(values)].sort(compareAscii);
249
+ }
250
+
251
+ function sortByKey(values, key) {
252
+ return [...values].sort((left, right) => compareAscii(left[key], right[key]));
253
+ }
254
+
255
+ function tupleKey(reference) {
256
+ return `${reference.artifact_id}\0${reference.observed_revision}\0${reference.item_id ?? ""}`;
257
+ }
258
+
259
+ function sameJson(left, right) {
260
+ return stableCanonicalJson(left) === stableCanonicalJson(right);
261
+ }
262
+
263
+ function derivedStableId(prefix, seed) {
264
+ return `${prefix}-${canonicalDigest(seed).slice("sha256:".length, "sha256:".length + 24)}`;
265
+ }
266
+
267
+ function issue(code, path, message) {
268
+ return { code, path, message };
269
+ }
270
+
271
+ function sortedIssues(issues) {
272
+ return [...issues].sort((left, right) => compareAscii(
273
+ `${left.code}\0${left.path}\0${left.message}`,
274
+ `${right.code}\0${right.path}\0${right.message}`,
275
+ ));
276
+ }
277
+
278
+ function schemaIssues(value, schemaPath) {
279
+ return validateJsonSchema(value, { schemaPath }).map((message) => {
280
+ const deterministicSeparator = message.indexOf(": keyword ");
281
+ if (message.startsWith("instance $") && deterministicSeparator !== -1) {
282
+ return issue("SCHEMA_INVALID", message.slice("instance ".length, deterministicSeparator), message.slice(deterministicSeparator + 2));
283
+ }
284
+ const separator = message.indexOf(":");
285
+ return issue(
286
+ "SCHEMA_INVALID",
287
+ separator === -1 ? "$" : message.slice(0, separator),
288
+ separator === -1 ? message : message.slice(separator + 1).trim(),
289
+ );
290
+ });
291
+ }
292
+
293
+ function resolvedPaths(root, overrides = {}) {
294
+ return Object.fromEntries(Object.entries({ ...DEFAULT_PATHS, ...overrides }).map(([key, path]) => [key, resolve(root, path)]));
295
+ }
296
+
297
+ function normalizePolicyDraft(value) {
298
+ const normalized = deepClone(value);
299
+ if (normalized.rules) {
300
+ normalized.rules.configured_epic_goal_ids = uniqueSorted(normalized.rules.configured_epic_goal_ids ?? []);
301
+ normalized.rules.human_decision_scope_states = uniqueSorted(normalized.rules.human_decision_scope_states ?? []);
302
+ normalized.rules.accepted_authority_evidence_statuses = uniqueSorted(normalized.rules.accepted_authority_evidence_statuses ?? []);
303
+ }
304
+ normalized.override_rules = sortByKey(normalized.override_rules ?? [], "rule_id").map((rule) => ({
305
+ ...rule,
306
+ authority_grants: sortByKey(rule.authority_grants ?? [], "grant_id"),
307
+ non_overridable_reason_codes: uniqueSorted(rule.non_overridable_reason_codes ?? []),
308
+ }));
309
+ return normalized;
310
+ }
311
+
312
+ export function sealEpicAdmissionPolicy(draft) {
313
+ const normalized = normalizePolicyDraft(withoutField(withoutField(draft, "policy_id"), "policy_digest"));
314
+ normalized.schema_version = EPIC_ADMISSION_SCHEMA_VERSION;
315
+ normalized.artifact_type = "epic_admission_policy";
316
+ normalized.program = EPIC_ADMISSION_PROGRAM;
317
+ normalized.policy_id = derivedStableId("EAP", {
318
+ program: normalized.program,
319
+ policy_key: normalized.policy_key,
320
+ });
321
+ normalized.digest_contract = {
322
+ algorithm: "sha256",
323
+ canonicalization: "sorted_key_canonical_json",
324
+ excluded_field: "policy_digest",
325
+ };
326
+ normalized.policy_digest = canonicalDigest(normalized);
327
+ return normalized;
328
+ }
329
+
330
+ function normalizeDecisionDraft(value) {
331
+ const normalized = deepClone(value);
332
+ normalized.reason_codes = uniqueSorted(normalized.reason_codes ?? []);
333
+ normalized.unresolved_scope = uniqueSorted(normalized.unresolved_scope ?? []);
334
+ normalized.blockers = uniqueSorted(normalized.blockers ?? []);
335
+ return normalized;
336
+ }
337
+
338
+ export function sealEpicAdmissionDecision(draft) {
339
+ const normalized = normalizeDecisionDraft(withoutField(withoutField(draft, "decision_id"), "decision_digest"));
340
+ normalized.schema_version = EPIC_ADMISSION_SCHEMA_VERSION;
341
+ normalized.artifact_type = "epic_admission_decision";
342
+ normalized.program = EPIC_ADMISSION_PROGRAM;
343
+ normalized.decision_id = derivedStableId("EAD", {
344
+ program: normalized.program,
345
+ repository_id: normalized.subject?.repository_id,
346
+ goal_id: normalized.subject?.goal_id,
347
+ task_id: normalized.subject?.task_id,
348
+ });
349
+ normalized.digest_contract = {
350
+ algorithm: "sha256",
351
+ canonicalization: "sorted_key_canonical_json",
352
+ excluded_field: "decision_digest",
353
+ };
354
+ normalized.decision_digest = canonicalDigest(normalized);
355
+ return normalized;
356
+ }
357
+
358
+ function policyRef(policy) {
359
+ return {
360
+ policy_id: policy.policy_id,
361
+ policy_revision: policy.policy_revision,
362
+ policy_digest: policy.policy_digest,
363
+ };
364
+ }
365
+
366
+ function decisionRef(decision) {
367
+ return {
368
+ decision_id: decision.decision_id,
369
+ decision_revision: decision.decision_revision,
370
+ decision_digest: decision.decision_digest,
371
+ };
372
+ }
373
+
374
+ function contextRef(context) {
375
+ return {
376
+ context_id: context.context_id,
377
+ context_revision: context.context_revision,
378
+ context_digest: context.context_digest,
379
+ };
380
+ }
381
+
382
+ export function validateEpicAdmissionPolicy(policy, { schemaPath = resolve(MODULE_ROOT, DEFAULT_PATHS.policySchema) } = {}) {
383
+ const issues = schemaIssues(policy, schemaPath);
384
+ if (issues.length > 0) return sortedIssues(issues);
385
+
386
+ const resealed = sealEpicAdmissionPolicy(policy);
387
+ if (policy.policy_id !== resealed.policy_id) {
388
+ issues.push(issue("POLICY_IDENTITY_MISMATCH", "$.policy_id", "policy_id does not match the deterministic policy identity"));
389
+ }
390
+ if (policy.policy_digest !== resealed.policy_digest) {
391
+ issues.push(issue("POLICY_DIGEST_MISMATCH", "$.policy_digest", "policy_digest does not match canonical policy content"));
392
+ }
393
+ if (!sameJson(withoutField(withoutField(policy, "policy_id"), "policy_digest"), withoutField(withoutField(resealed, "policy_id"), "policy_digest"))) {
394
+ issues.push(issue("POLICY_NON_CANONICAL", "$", "policy set-like fields are not in canonical order"));
395
+ }
396
+
397
+ const ruleIds = policy.override_rules.map((rule) => rule.rule_id);
398
+ if (new Set(ruleIds).size !== ruleIds.length) {
399
+ issues.push(issue("OVERRIDE_RULE_DUPLICATE", "$.override_rules", "override rule IDs must be unique"));
400
+ }
401
+ policy.override_rules.forEach((rule, index) => {
402
+ if (rule.from_decision === rule.to_decision) {
403
+ issues.push(issue("OVERRIDE_TRANSITION_NOOP", `$.override_rules[${index}]`, "override transition must change the admission decision"));
404
+ }
405
+ if (rule.from_decision === "human_decision_required" || rule.to_decision === "human_decision_required") {
406
+ issues.push(issue("OVERRIDE_AUTHORITY_BOUNDARY", `$.override_rules[${index}]`, "human decision state is not policy-overridable"));
407
+ }
408
+ for (const grantId of duplicateIds(rule.authority_grants, "grant_id")) {
409
+ issues.push(issue("OVERRIDE_GRANT_DUPLICATE", `$.override_rules[${index}].authority_grants`, `authority grant ${grantId} is duplicated`));
410
+ }
411
+ const grantClaims = rule.authority_grants.map((grant) => stableCanonicalJson({
412
+ authority_kind: grant.authority_kind,
413
+ authority_ref: grant.authority_ref,
414
+ subject_binding: grant.subject_binding,
415
+ }));
416
+ if (new Set(grantClaims).size !== grantClaims.length) {
417
+ issues.push(issue("OVERRIDE_GRANT_CLAIM_DUPLICATE", `$.override_rules[${index}].authority_grants`, "the same authority claim and subject binding must not appear under multiple grant IDs"));
418
+ }
419
+ });
420
+ for (const state of ["contradictory", "unknown", "unresolved"]) {
421
+ if (!policy.rules.human_decision_scope_states.includes(state)) {
422
+ issues.push(issue("POLICY_HUMAN_STATE_COVERAGE", "$.rules.human_decision_scope_states", `scope state ${state} must fail closed to a human decision`));
423
+ }
424
+ }
425
+ return sortedIssues(issues);
426
+ }
427
+
428
+ function admissionReasonState(policy, subject, observedSignals) {
429
+ const reasonCodes = [];
430
+ const blockers = [];
431
+ const unresolvedScope = [];
432
+ const acceptedEvidence = new Set(policy.rules.accepted_authority_evidence_statuses);
433
+ const weakSignals = AUTHORITY_SIGNAL_NAMES.filter((name) => !acceptedEvidence.has(observedSignals[name].evidence_status));
434
+ const configuredByPolicy = policy.rules.configured_epic_goal_ids.includes(subject.goal_id);
435
+
436
+ if (observedSignals.configured_epic.value !== configuredByPolicy) {
437
+ reasonCodes.push("CONFIGURED_EPIC_SIGNAL_CONTRADICTION");
438
+ blockers.push("CONFIGURED_EPIC_SIGNAL_CONTRADICTION");
439
+ }
440
+ if (weakSignals.length > 0) {
441
+ reasonCodes.push("ADMISSION_SIGNAL_INSUFFICIENT");
442
+ blockers.push(...weakSignals.map((name) => `ADMISSION_SIGNAL_INSUFFICIENT:${name}`));
443
+ }
444
+ if (policy.rules.human_decision_scope_states.includes(observedSignals.scope_resolution.value)) {
445
+ const code = `SCOPE_${observedSignals.scope_resolution.value.toUpperCase()}`;
446
+ reasonCodes.push(code);
447
+ blockers.push(code);
448
+ unresolvedScope.push(observedSignals.scope_resolution.value);
449
+ }
450
+
451
+ if (blockers.length > 0) {
452
+ return {
453
+ computedDecision: "human_decision_required",
454
+ reasonCodes: uniqueSorted(reasonCodes),
455
+ blockers: uniqueSorted(blockers),
456
+ unresolvedScope: uniqueSorted(unresolvedScope),
457
+ };
458
+ }
459
+
460
+ if (configuredByPolicy) reasonCodes.push("CONFIGURED_EPIC");
461
+ if (observedSignals.ordered_dependency.value) reasonCodes.push("ORDERED_DEPENDENCY");
462
+ if (observedSignals.independent_publication_units.value) reasonCodes.push("INDEPENDENT_PUBLICATION_UNITS");
463
+ if (
464
+ observedSignals.acceptance_condition_count.value >= policy.rules.multi_boundary_threshold.acceptance_condition_count
465
+ && observedSignals.scope_boundary_count.value >= policy.rules.multi_boundary_threshold.scope_boundary_count
466
+ ) reasonCodes.push("MULTI_BOUNDARY_THRESHOLD");
467
+
468
+ if (reasonCodes.length > 0) {
469
+ return {
470
+ computedDecision: "work_package_plan_required",
471
+ reasonCodes: uniqueSorted(reasonCodes),
472
+ blockers: [],
473
+ unresolvedScope: [],
474
+ };
475
+ }
476
+ return {
477
+ computedDecision: "ordinary_execution_allowed",
478
+ reasonCodes: ["SINGLE_BOUNDARY_ORDINARY_TASK"],
479
+ blockers: [],
480
+ unresolvedScope: [],
481
+ };
482
+ }
483
+
484
+ export function deriveEpicAdmissionOverrideBasisDigest({
485
+ subject,
486
+ observed_signals: observedSignals,
487
+ computed_decision: computedDecision,
488
+ requested_decision: requestedDecision,
489
+ }) {
490
+ return canonicalDigest({
491
+ digest_domain: "ask_epic_admission_override_basis_v1",
492
+ subject: deepClone(subject),
493
+ observed_signals: deepClone(observedSignals),
494
+ computed_decision: computedDecision,
495
+ requested_decision: requestedDecision,
496
+ });
497
+ }
498
+
499
+ const OVERRIDE_REQUEST_FIELDS = Object.freeze([
500
+ "rule_id",
501
+ "requested_decision",
502
+ "reason",
503
+ "authority_grant_id",
504
+ "authority_ref",
505
+ "authority_kind",
506
+ ]);
507
+
508
+ function admissionEvaluationInputIssues({ policy, subject, observedSignals, overrideRequest, decisionRevision }) {
509
+ const issues = [];
510
+ const requestIsObject = overrideRequest !== null && typeof overrideRequest === "object" && !Array.isArray(overrideRequest);
511
+ if (overrideRequest !== null && !requestIsObject) {
512
+ issues.push(issue("SCHEMA_INVALID", "$.override_request", "override request must be an object or null"));
513
+ }
514
+ if (requestIsObject) {
515
+ for (const key of Object.keys(overrideRequest)) {
516
+ if (!OVERRIDE_REQUEST_FIELDS.includes(key)) {
517
+ issues.push(issue("SCHEMA_INVALID", `$.override_request.${key}`, "override request contains an unknown field"));
518
+ }
519
+ }
520
+ }
521
+
522
+ const override = requestIsObject
523
+ ? {
524
+ state: "rejected",
525
+ rule_id: overrideRequest.rule_id ?? null,
526
+ requested_decision: overrideRequest.requested_decision ?? null,
527
+ reason: overrideRequest.reason ?? null,
528
+ authority_grant_id: overrideRequest.authority_grant_id ?? null,
529
+ authority_ref: overrideRequest.authority_ref ?? null,
530
+ authority_kind: overrideRequest.authority_kind ?? null,
531
+ }
532
+ : {
533
+ state: "not_requested",
534
+ rule_id: null,
535
+ requested_decision: null,
536
+ reason: null,
537
+ authority_grant_id: null,
538
+ authority_ref: null,
539
+ authority_kind: null,
540
+ };
541
+ const probe = {
542
+ schema_version: EPIC_ADMISSION_SCHEMA_VERSION,
543
+ artifact_type: "epic_admission_decision",
544
+ program: EPIC_ADMISSION_PROGRAM,
545
+ decision_id: "EAD-INPUT-PREFLIGHT",
546
+ decision_revision: decisionRevision,
547
+ subject,
548
+ policy_ref: policyRef(policy),
549
+ observed_signals: observedSignals,
550
+ computed_decision: "human_decision_required",
551
+ effective_decision: "human_decision_required",
552
+ reason_codes: ["ADMISSION_INPUT_PREFLIGHT"],
553
+ unresolved_scope: [],
554
+ blockers: ["ADMISSION_INPUT_PREFLIGHT"],
555
+ override,
556
+ digest_contract: {
557
+ algorithm: "sha256",
558
+ canonicalization: "sorted_key_canonical_json",
559
+ excluded_field: "decision_digest",
560
+ },
561
+ decision_digest: `sha256:${"0".repeat(64)}`,
562
+ };
563
+ issues.push(...schemaIssues(probe, resolve(MODULE_ROOT, DEFAULT_PATHS.decisionSchema)));
564
+
565
+ if (subject && typeof subject === "object" && !Array.isArray(subject) && typeof subject.branch === "string" && !subject.branch.trim()) {
566
+ issues.push(issue("SCHEMA_INVALID", "$.subject.branch", "branch must contain non-whitespace text"));
567
+ }
568
+ if (observedSignals && typeof observedSignals === "object" && !Array.isArray(observedSignals)) {
569
+ for (const [signalName, signalRecord] of Object.entries(observedSignals)) {
570
+ if (
571
+ signalRecord
572
+ && typeof signalRecord === "object"
573
+ && !Array.isArray(signalRecord)
574
+ && typeof signalRecord.evidence_ref === "string"
575
+ && !signalRecord.evidence_ref.trim()
576
+ ) {
577
+ issues.push(issue("ADMISSION_EVIDENCE_REF_INVALID", `$.observed_signals.${signalName}.evidence_ref`, "admission evidence references must contain non-whitespace authority text"));
578
+ }
579
+ }
580
+ }
581
+ return sortedIssues(issues.filter((entry, index, values) => values.findIndex((candidate) => (
582
+ candidate.code === entry.code && candidate.path === entry.path && candidate.message === entry.message
583
+ )) === index));
584
+ }
585
+
586
+ function resolveOverride(policy, subject, computedDecision, baseReasonCodes, request) {
587
+ if (!request) {
588
+ return {
589
+ effectiveDecision: computedDecision,
590
+ reasonCodes: baseReasonCodes,
591
+ blockers: [],
592
+ record: {
593
+ state: "not_requested",
594
+ rule_id: null,
595
+ requested_decision: null,
596
+ reason: null,
597
+ authority_grant_id: null,
598
+ authority_ref: null,
599
+ authority_kind: null,
600
+ },
601
+ };
602
+ }
603
+
604
+ const blockers = [];
605
+ const rule = policy.override_rules.find((candidate) => candidate.rule_id === request.rule_id);
606
+ const grant = rule?.authority_grants.find((candidate) => candidate.grant_id === request.authority_grant_id);
607
+ const expectedBasisDigest = deriveEpicAdmissionOverrideBasisDigest({
608
+ subject,
609
+ observed_signals: request.observed_signals,
610
+ computed_decision: computedDecision,
611
+ requested_decision: request.requested_decision,
612
+ });
613
+ if (!rule) blockers.push("OVERRIDE_POLICY_MISMATCH");
614
+ if (!request.reason?.trim()) blockers.push("OVERRIDE_REASON_MISSING");
615
+ if (rule && (
616
+ !request.authority_grant_id?.trim()
617
+ || !request.authority_ref?.trim()
618
+ || !request.authority_kind?.trim()
619
+ || !grant
620
+ || grant.approval_status !== "approved"
621
+ || grant.authority_kind !== request.authority_kind
622
+ || grant.authority_ref !== request.authority_ref
623
+ || !sameJson(grant.subject_binding, subject)
624
+ || grant.admission_basis_digest !== expectedBasisDigest
625
+ )) {
626
+ blockers.push("OVERRIDE_AUTHORITY_INVALID");
627
+ }
628
+ if (rule && (rule.from_decision !== computedDecision || rule.to_decision !== request.requested_decision)) {
629
+ blockers.push("OVERRIDE_TRANSITION_INVALID");
630
+ }
631
+ if (rule && (rule.may_weaken_required_gates || baseReasonCodes.some((code) => rule.non_overridable_reason_codes.includes(code)))) {
632
+ blockers.push("OVERRIDE_AUTHORITY_BOUNDARY");
633
+ }
634
+
635
+ const record = {
636
+ state: blockers.length === 0 ? "applied" : "rejected",
637
+ rule_id: request.rule_id ?? null,
638
+ requested_decision: request.requested_decision ?? null,
639
+ reason: request.reason ?? null,
640
+ authority_grant_id: request.authority_grant_id ?? null,
641
+ authority_ref: request.authority_ref ?? null,
642
+ authority_kind: request.authority_kind ?? null,
643
+ };
644
+ return blockers.length === 0
645
+ ? {
646
+ effectiveDecision: rule.to_decision,
647
+ reasonCodes: uniqueSorted([...baseReasonCodes, "EPIC_ADMISSION_OVERRIDE_APPLIED"]),
648
+ blockers: [],
649
+ record,
650
+ }
651
+ : {
652
+ effectiveDecision: "human_decision_required",
653
+ reasonCodes: uniqueSorted([...baseReasonCodes, "EPIC_ADMISSION_OVERRIDE_REJECTED"]),
654
+ blockers: uniqueSorted(blockers),
655
+ record,
656
+ };
657
+ }
658
+
659
+ export function evaluateEpicAdmission({
660
+ policy,
661
+ subject,
662
+ observed_signals: observedSignals,
663
+ override_request: overrideRequest = null,
664
+ decision_revision: decisionRevision = 1,
665
+ }) {
666
+ const policyIssues = validateEpicAdmissionPolicy(policy);
667
+ if (policyIssues.length > 0) throw new Error(`epic admission policy is invalid: ${formatIssues(policyIssues)}`);
668
+ const inputIssues = admissionEvaluationInputIssues({ policy, subject, observedSignals, overrideRequest, decisionRevision });
669
+ if (inputIssues.length > 0) {
670
+ const error = new Error(`epic admission input is invalid: ${formatIssues(inputIssues)}`);
671
+ error.code = "EPIC_ADMISSION_INPUT_INVALID";
672
+ error.issues = inputIssues;
673
+ throw error;
674
+ }
675
+ const base = admissionReasonState(policy, subject, observedSignals);
676
+ const override = resolveOverride(policy, subject, base.computedDecision, base.reasonCodes, overrideRequest
677
+ ? { ...overrideRequest, observed_signals: observedSignals }
678
+ : null);
679
+ return sealEpicAdmissionDecision({
680
+ decision_revision: decisionRevision,
681
+ subject: deepClone(subject),
682
+ policy_ref: policyRef(policy),
683
+ observed_signals: deepClone(observedSignals),
684
+ computed_decision: base.computedDecision,
685
+ effective_decision: override.effectiveDecision,
686
+ reason_codes: override.reasonCodes,
687
+ unresolved_scope: base.unresolvedScope,
688
+ blockers: uniqueSorted([...base.blockers, ...override.blockers]),
689
+ override: override.record,
690
+ });
691
+ }
692
+
693
+ export function validateEpicAdmissionDecision(decision, {
694
+ policy,
695
+ expectedSubject = null,
696
+ schemaPath = resolve(MODULE_ROOT, DEFAULT_PATHS.decisionSchema),
697
+ policySchemaPath = resolve(MODULE_ROOT, DEFAULT_PATHS.policySchema),
698
+ } = {}) {
699
+ const issues = schemaIssues(decision, schemaPath);
700
+ if (issues.length > 0) return sortedIssues(issues);
701
+ const policyIssues = validateEpicAdmissionPolicy(policy, { schemaPath: policySchemaPath });
702
+ if (policyIssues.length > 0) {
703
+ return sortedIssues([issue("POLICY_INVALID", "$.policy_ref", formatIssues(policyIssues))]);
704
+ }
705
+
706
+ const resealed = sealEpicAdmissionDecision(decision);
707
+ if (decision.decision_id !== resealed.decision_id) {
708
+ issues.push(issue("DECISION_IDENTITY_MISMATCH", "$.decision_id", "decision_id does not match the deterministic subject identity"));
709
+ }
710
+ if (decision.decision_digest !== resealed.decision_digest) {
711
+ issues.push(issue("DECISION_DIGEST_MISMATCH", "$.decision_digest", "decision_digest does not match canonical decision content"));
712
+ }
713
+ if (!sameJson(decision.policy_ref, policyRef(policy))) {
714
+ issues.push(issue("POLICY_BINDING_MISMATCH", "$.policy_ref", "decision is not bound to the supplied current policy"));
715
+ }
716
+ if (expectedSubject && !sameJson(decision.subject, expectedSubject)) {
717
+ issues.push(issue("DECISION_SUBJECT_MISMATCH", "$.subject", "decision subject does not match the caller-supplied repository and goal context"));
718
+ }
719
+ for (const [signalName, signalRecord] of Object.entries(decision.observed_signals)) {
720
+ if (!signalRecord.evidence_ref?.trim()) {
721
+ issues.push(issue("ADMISSION_EVIDENCE_REF_INVALID", `$.observed_signals.${signalName}.evidence_ref`, "admission evidence references must contain non-whitespace authority text"));
722
+ }
723
+ }
724
+
725
+ const request = decision.override.state === "not_requested" ? null : {
726
+ rule_id: decision.override.rule_id,
727
+ requested_decision: decision.override.requested_decision,
728
+ reason: decision.override.reason,
729
+ authority_grant_id: decision.override.authority_grant_id,
730
+ authority_ref: decision.override.authority_ref,
731
+ authority_kind: decision.override.authority_kind,
732
+ };
733
+ let recomputed;
734
+ try {
735
+ recomputed = evaluateEpicAdmission({
736
+ policy,
737
+ subject: decision.subject,
738
+ observed_signals: decision.observed_signals,
739
+ override_request: request,
740
+ decision_revision: decision.decision_revision,
741
+ });
742
+ } catch (error) {
743
+ if (error.code !== "EPIC_ADMISSION_INPUT_INVALID") throw error;
744
+ for (const inputIssue of error.issues) {
745
+ if (!issues.some((entry) => entry.code === inputIssue.code && entry.path === inputIssue.path)) issues.push(inputIssue);
746
+ }
747
+ return sortedIssues(issues);
748
+ }
749
+
750
+ if (decision.override.state === "applied") {
751
+ if (!decision.override.reason?.trim()) issues.push(issue("OVERRIDE_REASON_MISSING", "$.override.reason", "applied override requires an explicit reason"));
752
+ const rule = policy.override_rules.find((candidate) => candidate.rule_id === decision.override.rule_id);
753
+ const grant = rule?.authority_grants.find((candidate) => candidate.grant_id === decision.override.authority_grant_id);
754
+ if (!rule) issues.push(issue("OVERRIDE_POLICY_MISMATCH", "$.override.rule_id", "applied override does not reference the current policy"));
755
+ if (rule && (
756
+ !decision.override.authority_grant_id?.trim()
757
+ || !decision.override.authority_ref?.trim()
758
+ || !grant
759
+ || grant.approval_status !== "approved"
760
+ || grant.authority_kind !== decision.override.authority_kind
761
+ || grant.authority_ref !== decision.override.authority_ref
762
+ || !sameJson(grant.subject_binding, decision.subject)
763
+ || grant.admission_basis_digest !== deriveEpicAdmissionOverrideBasisDigest({
764
+ subject: decision.subject,
765
+ observed_signals: decision.observed_signals,
766
+ computed_decision: decision.computed_decision,
767
+ requested_decision: decision.override.requested_decision,
768
+ })
769
+ )) {
770
+ issues.push(issue("OVERRIDE_AUTHORITY_INVALID", "$.override.authority_grant_id", "applied override lacks an exact approved policy grant bound to this subject"));
771
+ }
772
+ if (rule?.may_weaken_required_gates || rule?.non_overridable_reason_codes.some((code) => decision.reason_codes.includes(code))) {
773
+ issues.push(issue("OVERRIDE_AUTHORITY_BOUNDARY", "$.override", "override would weaken a non-overridable authority boundary"));
774
+ }
775
+ }
776
+ if (decision.override.state === "not_requested" && [
777
+ decision.override.rule_id,
778
+ decision.override.requested_decision,
779
+ decision.override.reason,
780
+ decision.override.authority_grant_id,
781
+ decision.override.authority_ref,
782
+ decision.override.authority_kind,
783
+ ].some((value) => value !== null)) {
784
+ issues.push(issue("OVERRIDE_NOT_REQUESTED_PAYLOAD", "$.override", "not_requested override state requires every request and authority field to be null"));
785
+ }
786
+
787
+ if (decision.computed_decision !== recomputed.computed_decision) {
788
+ const nonAiSignalsAreOrdinary = admissionReasonState(policy, decision.subject, {
789
+ ...decision.observed_signals,
790
+ ai_estimated_complexity: { value: "unknown", evidence_status: "unknown", evidence_ref: "ignored-by-policy" },
791
+ }).computedDecision === "ordinary_execution_allowed";
792
+ const claimsAiAuthority = decision.reason_codes.includes("AI_ESTIMATED_COMPLEXITY");
793
+ issues.push(issue(
794
+ decision.computed_decision === "work_package_plan_required" && nonAiSignalsAreOrdinary && claimsAiAuthority ? "AI_ESTIMATE_SOLE_AUTHORITY" : "ADMISSION_DECISION_MISMATCH",
795
+ "$.computed_decision",
796
+ "stored computed decision does not match deterministic policy evaluation",
797
+ ));
798
+ }
799
+ if (
800
+ decision.effective_decision !== recomputed.effective_decision
801
+ || decision.override.state !== recomputed.override.state
802
+ || !sameJson(decision.reason_codes, recomputed.reason_codes)
803
+ || !sameJson(decision.unresolved_scope, recomputed.unresolved_scope)
804
+ || !sameJson(decision.blockers, recomputed.blockers)
805
+ ) {
806
+ issues.push(issue("DECISION_RECOMPUTATION_MISMATCH", "$", "stored admission result does not match deterministic recomputation"));
807
+ }
808
+ return sortedIssues(issues);
809
+ }
810
+
811
+ function normalizeArtifactRefs(references) {
812
+ return [...(references ?? [])].sort((left, right) => compareAscii(tupleKey(left), tupleKey(right)));
813
+ }
814
+
815
+ function normalizeScopeEntries(entries) {
816
+ return [...(entries ?? [])].sort((left, right) => compareAscii(
817
+ `${left.kind}\0${left.value}\0${left.match}`,
818
+ `${right.kind}\0${right.value}\0${right.match}`,
819
+ ));
820
+ }
821
+
822
+ function normalizeContextDraft(value) {
823
+ const normalized = deepClone(value);
824
+ normalized.upstream_artifacts = sortByKey(normalized.upstream_artifacts ?? [], "artifact_id").map((artifact) => ({
825
+ ...artifact,
826
+ item_ids: uniqueSorted(artifact.item_ids ?? []),
827
+ }));
828
+ normalized.required_full_checkpoint_ids = uniqueSorted(normalized.required_full_checkpoint_ids ?? []);
829
+ normalized.non_overridable_gates = sortByKey(normalized.non_overridable_gates ?? [], "verification_id");
830
+ normalized.known_blockers = sortByKey(normalized.known_blockers ?? [], "blocker_id");
831
+ normalized.required_human_decisions = sortByKey(normalized.required_human_decisions ?? [], "decision_id");
832
+ normalized.required_human_approvals = sortByKey(normalized.required_human_approvals ?? [], "approval_id");
833
+ return normalized;
834
+ }
835
+
836
+ export function deriveWorkPackagePlanId({ goal_id: goalId, repository, upstream_refs: upstreamRefs }) {
837
+ return derivedStableId("WPP", {
838
+ program: WORK_PACKAGE_PLAN_PROGRAM,
839
+ goal_id: goalId,
840
+ repository_id: repository.repository_id,
841
+ upstream_artifact_ids: uniqueSorted((upstreamRefs ?? []).map((reference) => reference.artifact_id)),
842
+ });
843
+ }
844
+
845
+ export function sealWorkPackagePlanValidationContext(draft) {
846
+ const normalized = normalizeContextDraft(withoutField(withoutField(draft, "context_id"), "context_digest"));
847
+ normalized.schema_version = WORK_PACKAGE_PLAN_SCHEMA_VERSION;
848
+ normalized.artifact_type = "work_package_plan_validation_context";
849
+ normalized.program = WORK_PACKAGE_PLAN_PROGRAM;
850
+ normalized.context_id = derivedStableId("WPPC", {
851
+ program: normalized.program,
852
+ context_key: normalized.context_key,
853
+ repository_id: normalized.repository?.repository_id,
854
+ goal_id: normalized.goal_id,
855
+ });
856
+ normalized.digest_contract = {
857
+ algorithm: "sha256",
858
+ canonicalization: "sorted_key_canonical_json",
859
+ excluded_field: "context_digest",
860
+ };
861
+ normalized.context_digest = canonicalDigest(normalized);
862
+ return normalized;
863
+ }
864
+
865
+ function normalizePlanDraft(value) {
866
+ const normalized = deepClone(value);
867
+ normalized.upstream_refs = normalizeArtifactRefs(normalized.upstream_refs);
868
+ normalized.packages = (normalized.packages ?? []).map((workPackage) => ({
869
+ ...workPackage,
870
+ upstream_refs: normalizeArtifactRefs(workPackage.upstream_refs),
871
+ depends_on_package_ids: uniqueSorted(workPackage.depends_on_package_ids ?? []),
872
+ dependencies: uniqueSorted(workPackage.dependencies ?? []),
873
+ allowed_scope: normalizeScopeEntries(workPackage.allowed_scope),
874
+ forbidden_scope: normalizeScopeEntries(workPackage.forbidden_scope),
875
+ expected_artifacts: sortByKey(workPackage.expected_artifacts ?? [], "artifact_id"),
876
+ expected_evidence_ids: uniqueSorted(workPackage.expected_evidence_ids ?? []),
877
+ stop_conditions: sortByKey(workPackage.stop_conditions ?? [], "code"),
878
+ }));
879
+ normalized.acceptance_ownership = [...(normalized.acceptance_ownership ?? [])]
880
+ .map((ownership) => ({ ...ownership, owner_package_ids: uniqueSorted(ownership.owner_package_ids ?? []) }))
881
+ .sort((left, right) => compareAscii(tupleKey(left.acceptance_ref), tupleKey(right.acceptance_ref)));
882
+ if (normalized.topology) {
883
+ normalized.topology.publication_units = sortByKey(normalized.topology.publication_units ?? [], "unit_id").map((unit) => ({
884
+ ...unit,
885
+ artifact_ids: uniqueSorted(unit.artifact_ids ?? []),
886
+ }));
887
+ normalized.topology.review_units = sortByKey(normalized.topology.review_units ?? [], "unit_id").map((unit) => ({
888
+ ...unit,
889
+ artifact_ids: uniqueSorted(unit.artifact_ids ?? []),
890
+ }));
891
+ }
892
+ if (normalized.verification) {
893
+ normalized.verification.steps = sortByKey(normalized.verification.steps ?? [], "verification_id");
894
+ normalized.verification.focused_cadence = sortByKey(normalized.verification.focused_cadence ?? [], "after_package_id").map((entry) => ({
895
+ ...entry,
896
+ verification_ids: uniqueSorted(entry.verification_ids ?? []),
897
+ }));
898
+ normalized.verification.full_gate_checkpoints = sortByKey(normalized.verification.full_gate_checkpoints ?? [], "checkpoint_id").map((entry) => ({
899
+ ...entry,
900
+ verification_ids: uniqueSorted(entry.verification_ids ?? []),
901
+ }));
902
+ }
903
+ normalized.unresolved_decisions = sortByKey(normalized.unresolved_decisions ?? [], "decision_id");
904
+ normalized.human_approvals = sortByKey(normalized.human_approvals ?? [], "approval_id");
905
+ normalized.blockers = sortByKey(normalized.blockers ?? [], "blocker_id");
906
+ return normalized;
907
+ }
908
+
909
+ export function sealWorkPackagePlan(draft) {
910
+ const normalized = normalizePlanDraft(withoutField(withoutField(draft, "plan_id"), "plan_digest"));
911
+ normalized.schema_version = WORK_PACKAGE_PLAN_SCHEMA_VERSION;
912
+ normalized.artifact_type = "work_package_plan";
913
+ normalized.program = WORK_PACKAGE_PLAN_PROGRAM;
914
+ normalized.plan_id = deriveWorkPackagePlanId(normalized);
915
+ normalized.digest_contract = {
916
+ algorithm: "sha256",
917
+ canonicalization: "sorted_key_canonical_json",
918
+ excluded_field: "plan_digest",
919
+ };
920
+ normalized.plan_digest = canonicalDigest(normalized);
921
+ return normalized;
922
+ }
923
+
924
+ export function deriveWorkPackagePlanContentDigest(plan) {
925
+ const content = deepClone(plan);
926
+ delete content.plan_digest;
927
+ if (content.validation_context_ref) delete content.validation_context_ref.context_digest;
928
+ return canonicalDigest(content);
929
+ }
930
+
931
+ function storedDigestMatches(value, digestField) {
932
+ const content = deepClone(value);
933
+ const stored = content[digestField];
934
+ delete content[digestField];
935
+ return stored === canonicalDigest(content);
936
+ }
937
+
938
+ function rawFileDigest(path) {
939
+ return `sha256:${createHash("sha256").update(readFileSync(path)).digest("hex")}`;
940
+ }
941
+
942
+ function isPlainRecord(value) {
943
+ return value !== null && typeof value === "object" && !Array.isArray(value);
944
+ }
945
+
946
+ function isNonEmptyString(value) {
947
+ return typeof value === "string" && value.trim().length > 0;
948
+ }
949
+
950
+ function isPositiveRevision(value) {
951
+ return Number.isInteger(value) && value >= 1;
952
+ }
953
+
954
+ // Schema checks own shape; these local checks own the numeric lineage domain.
955
+ function positiveSafeRevisionIssues(entries) {
956
+ return sortedIssues(entries
957
+ .filter(([value]) => !Number.isSafeInteger(value) || value < 1)
958
+ .map(([, path]) => issue(
959
+ "REVISION_OUT_OF_RANGE",
960
+ path,
961
+ "revision must be a positive safe integer (1..9007199254740991)",
962
+ )));
963
+ }
964
+
965
+ function planRevisionIssues(plan) {
966
+ const entries = [
967
+ [plan.plan_revision, "$.plan_revision"],
968
+ [plan.validation_context_ref.context_revision, "$.validation_context_ref.context_revision"],
969
+ ...plan.packages.map((workPackage, index) => [
970
+ workPackage.plan_binding.plan_revision, `$.packages[${index}].plan_binding.plan_revision`,
971
+ ]),
972
+ ];
973
+ if (plan.supersedes_plan_ref) entries.push([plan.supersedes_plan_ref.plan_revision, "$.supersedes_plan_ref.plan_revision"]);
974
+ return positiveSafeRevisionIssues(entries);
975
+ }
976
+
977
+ function contextRevisionIssues(context) {
978
+ const entries = [
979
+ [context.context_revision, "$.context_revision"],
980
+ [context.current_plan_ref.plan_revision, "$.current_plan_ref.plan_revision"],
981
+ ];
982
+ if (context.supersedes_context_ref) entries.push([context.supersedes_context_ref.context_revision, "$.supersedes_context_ref.context_revision"]);
983
+ if (context.supersedes_plan_ref) entries.push([context.supersedes_plan_ref.plan_revision, "$.supersedes_plan_ref.plan_revision"]);
984
+ return positiveSafeRevisionIssues(entries);
985
+ }
986
+
987
+ function isDigest(value) {
988
+ return typeof value === "string" && /^sha256:[0-9a-f]{64}$/.test(value);
989
+ }
990
+
991
+ function hasOwn(value, key) {
992
+ return Object.prototype.hasOwnProperty.call(value, key);
993
+ }
994
+
995
+ function isKnownWorkPackagePlanSchemaVersion(value) {
996
+ return ["1.0.0", "1.1.0", WORK_PACKAGE_PLAN_SCHEMA_VERSION].includes(value);
997
+ }
998
+
999
+ function isPlanReference(value) {
1000
+ return isPlainRecord(value)
1001
+ && isNonEmptyString(value.plan_id)
1002
+ && isPositiveRevision(value.plan_revision)
1003
+ && isDigest(value.plan_digest);
1004
+ }
1005
+
1006
+ function isContextReference(value) {
1007
+ return isPlainRecord(value)
1008
+ && isNonEmptyString(value.context_id)
1009
+ && isPositiveRevision(value.context_revision)
1010
+ && isDigest(value.context_digest);
1011
+ }
1012
+
1013
+ function isCurrentPlanReference(value, { requireContentDigest = false } = {}) {
1014
+ return isPlainRecord(value)
1015
+ && isNonEmptyString(value.plan_id)
1016
+ && isPositiveRevision(value.plan_revision)
1017
+ && isNonEmptyString(value.lifecycle_state)
1018
+ && (!requireContentDigest || isDigest(value.plan_content_digest));
1019
+ }
1020
+
1021
+ function hasRevisionAwarePlanLineage(value) {
1022
+ return value.plan_revision === 1
1023
+ ? !hasOwn(value, "supersedes_plan_ref") && !hasOwn(value, "revision_reason")
1024
+ : isPlanReference(value.supersedes_plan_ref) && isNonEmptyString(value.revision_reason);
1025
+ }
1026
+
1027
+ function hasRevisionAwareContextLineage(value) {
1028
+ return value.context_revision === 1
1029
+ ? !hasOwn(value, "supersedes_plan_ref")
1030
+ && !hasOwn(value, "supersedes_context_ref")
1031
+ && !hasOwn(value, "revision_reason")
1032
+ : isPlanReference(value.supersedes_plan_ref)
1033
+ && isContextReference(value.supersedes_context_ref)
1034
+ && isNonEmptyString(value.revision_reason);
1035
+ }
1036
+
1037
+ function matchesPinnedLegacyArtifact(value, pinKey, revisionField) {
1038
+ const pin = HISTORICAL_ARTIFACT_PINS[pinKey];
1039
+ return isPlainRecord(value)
1040
+ && value.schema_version === pin.schemaVersion
1041
+ && value[revisionField] === pin.revision
1042
+ && value[pin.digestField] === pin.canonicalDigest
1043
+ && storedDigestMatches(value, pin.digestField);
1044
+ }
1045
+
1046
+ function isHistoricalPlanArtifact(value, { schemaPath } = {}) {
1047
+ const structured = isPlainRecord(value)
1048
+ && isKnownWorkPackagePlanSchemaVersion(value.schema_version)
1049
+ && isNonEmptyString(value.plan_id)
1050
+ && isPositiveRevision(value.plan_revision)
1051
+ && isDigest(value.plan_digest)
1052
+ && isNonEmptyString(value.lifecycle_state)
1053
+ && isContextReference(value.validation_context_ref)
1054
+ && hasRevisionAwarePlanLineage(value);
1055
+ return structured
1056
+ && (value.schema_version !== WORK_PACKAGE_PLAN_SCHEMA_VERSION || schemaIssues(value, schemaPath).length === 0);
1057
+ }
1058
+
1059
+ function isHistoricalContextArtifact(value, { schemaPath } = {}) {
1060
+ const structured = isPlainRecord(value)
1061
+ && isKnownWorkPackagePlanSchemaVersion(value.schema_version)
1062
+ && isNonEmptyString(value.context_id)
1063
+ && isPositiveRevision(value.context_revision)
1064
+ && isDigest(value.context_digest)
1065
+ && isCurrentPlanReference(value.current_plan_ref, { requireContentDigest: value.context_revision > 1 })
1066
+ && hasRevisionAwareContextLineage(value);
1067
+ return structured
1068
+ && (value.schema_version !== WORK_PACKAGE_PLAN_SCHEMA_VERSION || schemaIssues(value, schemaPath).length === 0);
1069
+ }
1070
+
1071
+ function isAdmissiblePreviousPlanArtifact(value, { schemaPath } = {}) {
1072
+ return isHistoricalPlanArtifact(value, { schemaPath })
1073
+ && (value.schema_version === WORK_PACKAGE_PLAN_SCHEMA_VERSION
1074
+ || matchesPinnedLegacyArtifact(value, "firstPlan", "plan_revision")
1075
+ || matchesPinnedLegacyArtifact(value, "previousPlan", "plan_revision"));
1076
+ }
1077
+
1078
+ function isAdmissiblePreviousContextArtifact(value, { schemaPath } = {}) {
1079
+ return isHistoricalContextArtifact(value, { schemaPath })
1080
+ && (value.schema_version === WORK_PACKAGE_PLAN_SCHEMA_VERSION
1081
+ || matchesPinnedLegacyArtifact(value, "firstContext", "context_revision")
1082
+ || matchesPinnedLegacyArtifact(value, "previousContext", "context_revision"));
1083
+ }
1084
+
1085
+ function historicalArtifactShapeIssues(paths, artifacts) {
1086
+ const checks = [
1087
+ ["firstContext", "HISTORICAL_R1_CONTEXT_INVALID", isHistoricalContextArtifact(artifacts.firstContext, { schemaPath: paths.contextSchema })],
1088
+ ["firstPlan", "HISTORICAL_R1_PLAN_INVALID", isHistoricalPlanArtifact(artifacts.firstPlan, { schemaPath: paths.planSchema })],
1089
+ ["previousContext", "HISTORICAL_R2_CONTEXT_INVALID", isHistoricalContextArtifact(artifacts.previousContext, { schemaPath: paths.contextSchema })],
1090
+ ["previousPlan", "HISTORICAL_R2_PLAN_INVALID", isHistoricalPlanArtifact(artifacts.previousPlan, { schemaPath: paths.planSchema })],
1091
+ ];
1092
+ return checks
1093
+ .filter(([, , valid]) => !valid)
1094
+ .map(([key, code]) => issue(
1095
+ code,
1096
+ `$paths.${key}`,
1097
+ `${key} must satisfy the current Schema or match an exact pinned legacy audit artifact before lineage and digest validation`,
1098
+ ));
1099
+ }
1100
+
1101
+ function historicalArtifactIssues(paths, artifacts) {
1102
+ const shapeIssues = historicalArtifactShapeIssues(paths, artifacts);
1103
+ if (shapeIssues.length > 0) return sortedIssues(shapeIssues);
1104
+ const issues = [];
1105
+ for (const [key, pin] of Object.entries(HISTORICAL_ARTIFACT_PINS)) {
1106
+ const artifact = artifacts[key];
1107
+ const revision = key.startsWith("first") ? "R1" : "R2";
1108
+ const kind = key.endsWith("Plan") ? "PLAN" : "CONTEXT";
1109
+ const prefix = `HISTORICAL_${revision}_${kind}`;
1110
+ const content = deepClone(artifact);
1111
+ const storedDigest = content[pin.digestField];
1112
+ delete content[pin.digestField];
1113
+ const computedDigest = canonicalDigest(content);
1114
+ if (storedDigest !== pin.canonicalDigest || computedDigest !== pin.canonicalDigest) {
1115
+ issues.push(issue(
1116
+ `${prefix}_DIGEST_MISMATCH`,
1117
+ `$paths.${key}`,
1118
+ `${pin.label} must preserve its pinned stored and recomputed canonical digest`,
1119
+ ));
1120
+ }
1121
+ if (rawFileDigest(paths[key]) !== pin.rawDigest) {
1122
+ issues.push(issue(
1123
+ `${prefix}_BYTES_MISMATCH`,
1124
+ `$paths.${key}`,
1125
+ `${pin.label} must preserve its pinned repository bytes`,
1126
+ ));
1127
+ }
1128
+ }
1129
+
1130
+ const { firstContext, firstPlan, previousContext, previousPlan } = artifacts;
1131
+ const firstPlanRef = {
1132
+ plan_id: firstPlan.plan_id,
1133
+ plan_revision: firstPlan.plan_revision,
1134
+ plan_digest: firstPlan.plan_digest,
1135
+ };
1136
+ const firstContextRef = contextRef(firstContext);
1137
+ if (!sameJson(firstPlan.validation_context_ref, firstContextRef)) {
1138
+ issues.push(issue("HISTORICAL_R1_PLAN_CONTEXT_BINDING_MISMATCH", "$paths.firstPlan", "r1 plan must bind the exact pinned r1 context"));
1139
+ }
1140
+ if (
1141
+ firstContext.current_plan_ref?.plan_id !== firstPlan.plan_id
1142
+ || firstContext.current_plan_ref?.plan_revision !== firstPlan.plan_revision
1143
+ || firstContext.current_plan_ref?.lifecycle_state !== firstPlan.lifecycle_state
1144
+ ) {
1145
+ issues.push(issue("HISTORICAL_R1_CONTEXT_PLAN_BINDING_MISMATCH", "$paths.firstContext", "r1 context must name the exact pinned r1 plan revision and lifecycle state"));
1146
+ }
1147
+
1148
+ const previousPlanRef = {
1149
+ plan_id: previousPlan.plan_id,
1150
+ plan_revision: previousPlan.plan_revision,
1151
+ plan_digest: previousPlan.plan_digest,
1152
+ };
1153
+ if (!sameJson(previousPlan.validation_context_ref, contextRef(previousContext))) {
1154
+ issues.push(issue("HISTORICAL_R2_PLAN_CONTEXT_BINDING_MISMATCH", "$paths.previousPlan", "r2 plan must bind the exact pinned r2 context"));
1155
+ }
1156
+ if (
1157
+ previousContext.current_plan_ref?.plan_id !== previousPlan.plan_id
1158
+ || previousContext.current_plan_ref?.plan_revision !== previousPlan.plan_revision
1159
+ || previousContext.current_plan_ref?.lifecycle_state !== previousPlan.lifecycle_state
1160
+ || previousContext.current_plan_ref?.plan_content_digest !== deriveWorkPackagePlanContentDigest(previousPlan)
1161
+ ) {
1162
+ issues.push(issue("HISTORICAL_R2_CONTEXT_PLAN_BINDING_MISMATCH", "$paths.previousContext", "r2 context must bind the exact pinned r2 plan meaning"));
1163
+ }
1164
+ if (
1165
+ !sameJson(previousPlan.supersedes_plan_ref, firstPlanRef)
1166
+ || previousPlan.plan_id !== firstPlan.plan_id
1167
+ || previousPlan.plan_revision !== firstPlan.plan_revision + 1
1168
+ ) {
1169
+ issues.push(issue("HISTORICAL_R2_PLAN_LINEAGE_MISMATCH", "$paths.previousPlan", "r2 plan must exactly supersede the pinned r1 plan"));
1170
+ }
1171
+ if (
1172
+ !sameJson(previousContext.supersedes_plan_ref, firstPlanRef)
1173
+ || !sameJson(previousContext.supersedes_context_ref, firstContextRef)
1174
+ || previousContext.context_id !== firstContext.context_id
1175
+ || previousContext.context_revision !== firstContext.context_revision + 1
1176
+ || !sameJson(previousContext.supersedes_plan_ref, previousPlan.supersedes_plan_ref)
1177
+ ) {
1178
+ issues.push(issue("HISTORICAL_R2_CONTEXT_LINEAGE_MISMATCH", "$paths.previousContext", "r2 context must exactly supersede the pinned r1 plan and context"));
1179
+ }
1180
+ if (previousPlanRef.plan_revision !== previousContext.current_plan_ref?.plan_revision) {
1181
+ issues.push(issue("HISTORICAL_R2_PAIR_REVISION_MISMATCH", "$paths.previousPlan", "r2 plan and context must describe the same plan revision"));
1182
+ }
1183
+ return sortedIssues(issues);
1184
+ }
1185
+
1186
+ function duplicateIds(values, key) {
1187
+ const seen = new Set();
1188
+ const duplicates = new Set();
1189
+ for (const value of values) {
1190
+ const id = value[key];
1191
+ if (seen.has(id)) duplicates.add(id);
1192
+ seen.add(id);
1193
+ }
1194
+ return [...duplicates].sort(compareAscii);
1195
+ }
1196
+
1197
+ export function validateWorkPackagePlanValidationContext(context, {
1198
+ policy,
1199
+ decision,
1200
+ schemaPath = resolve(MODULE_ROOT, DEFAULT_PATHS.contextSchema),
1201
+ policySchemaPath = resolve(MODULE_ROOT, DEFAULT_PATHS.policySchema),
1202
+ decisionSchemaPath = resolve(MODULE_ROOT, DEFAULT_PATHS.decisionSchema),
1203
+ } = {}) {
1204
+ const revisionOneLineage = context?.context_revision === 1 && (
1205
+ context.supersedes_context_ref
1206
+ || context.supersedes_plan_ref
1207
+ || context.revision_reason
1208
+ );
1209
+ const issues = schemaIssues(context, schemaPath);
1210
+ if (revisionOneLineage
1211
+ && issues.length === 1
1212
+ && issues[0].path === "$"
1213
+ && issues[0].message.includes("keyword then:")
1214
+ && issues[0].message.includes("keyword not:")) {
1215
+ return [issue("REVISION_LINEAGE_UNEXPECTED", "$.supersedes_context_ref", "context revision 1 cannot claim a predecessor or revision reason")];
1216
+ }
1217
+ if (issues.length > 0) return sortedIssues(issues);
1218
+ issues.push(...contextRevisionIssues(context));
1219
+ if (issues.length > 0) return sortedIssues(issues);
1220
+ if (policy !== undefined) {
1221
+ const policyIssues = validateEpicAdmissionPolicy(policy, { schemaPath: policySchemaPath });
1222
+ if (policyIssues.length > 0) {
1223
+ return sortedIssues([issue("POLICY_INVALID", "$.current_policy_ref", formatIssues(policyIssues))]);
1224
+ }
1225
+ }
1226
+ if (decision !== undefined) {
1227
+ const decisionIssues = schemaIssues(decision, decisionSchemaPath);
1228
+ if (decisionIssues.length > 0) {
1229
+ return sortedIssues([issue("ADMISSION_DECISION_INVALID", "$.current_admission_decision_ref", formatIssues(decisionIssues))]);
1230
+ }
1231
+ }
1232
+
1233
+ const resealed = sealWorkPackagePlanValidationContext(context);
1234
+ if (context.context_id !== resealed.context_id) {
1235
+ issues.push(issue("CONTEXT_IDENTITY_MISMATCH", "$.context_id", "context_id does not match the deterministic authority context identity"));
1236
+ }
1237
+ if (context.context_digest !== resealed.context_digest) {
1238
+ issues.push(issue("CONTEXT_DIGEST_MISMATCH", "$.context_digest", "context_digest does not match canonical context content"));
1239
+ }
1240
+ if (!sameJson(withoutField(withoutField(context, "context_id"), "context_digest"), withoutField(withoutField(resealed, "context_id"), "context_digest"))) {
1241
+ issues.push(issue("CONTEXT_NON_CANONICAL", "$", "validation context set-like fields are not in canonical order"));
1242
+ }
1243
+ if (policy && !sameJson(context.current_policy_ref, policyRef(policy))) {
1244
+ issues.push(issue("CONTEXT_POLICY_MISMATCH", "$.current_policy_ref", "validation context does not bind the supplied current policy"));
1245
+ }
1246
+ if (decision && !sameJson(context.current_admission_decision_ref, decisionRef(decision))) {
1247
+ issues.push(issue("CONTEXT_DECISION_MISMATCH", "$.current_admission_decision_ref", "validation context does not bind the supplied current admission decision"));
1248
+ }
1249
+ if (decision && (
1250
+ context.goal_id !== decision.subject.goal_id
1251
+ || context.repository.repository_id !== decision.subject.repository_id
1252
+ || context.repository.base_commit !== decision.subject.base_commit
1253
+ || context.repository.base_tree !== decision.subject.base_tree
1254
+ || context.repository.branch !== decision.subject.branch
1255
+ )) {
1256
+ issues.push(issue("CONTEXT_SUBJECT_MISMATCH", "$.repository", "validation context target differs from the admission decision subject"));
1257
+ }
1258
+ for (const [collection, key, code] of [
1259
+ [context.upstream_artifacts, "artifact_id", "UPSTREAM_ARTIFACT_DUPLICATE"],
1260
+ [context.known_blockers, "blocker_id", "CONTEXT_BLOCKER_DUPLICATE"],
1261
+ [context.required_human_decisions, "decision_id", "CONTEXT_HUMAN_DECISION_DUPLICATE"],
1262
+ [context.required_human_approvals, "approval_id", "CONTEXT_HUMAN_APPROVAL_DUPLICATE"],
1263
+ [context.non_overridable_gates, "verification_id", "CONTEXT_GATE_DUPLICATE"],
1264
+ ]) {
1265
+ for (const id of duplicateIds(collection, key)) issues.push(issue(code, "$", `${key} ${id} is duplicated`));
1266
+ }
1267
+ return sortedIssues(issues);
1268
+ }
1269
+
1270
+ function validRepositoryPath(value) {
1271
+ if (!value || !/^[A-Za-z0-9._-][A-Za-z0-9._/-]*$/.test(value) || value.startsWith("/") || value.endsWith("/") || value.includes("//")) return false;
1272
+ return !value.split("/").some((part) => part === "." || part === "..");
1273
+ }
1274
+
1275
+ function pathContains(parent, child) {
1276
+ return child === parent || child.startsWith(`${parent}/`);
1277
+ }
1278
+
1279
+ function pathScopeContains(scope, path) {
1280
+ if (scope.kind !== "repository_path") return false;
1281
+ return scope.match === "exact" ? scope.value === path : pathContains(scope.value, path);
1282
+ }
1283
+
1284
+ function scopesOverlap(left, right) {
1285
+ if (left.kind !== right.kind) return false;
1286
+ if (left.kind !== "repository_path") return left.value === right.value;
1287
+ if (left.value === right.value) return true;
1288
+ if (left.match === "subtree" && pathContains(left.value, right.value)) return true;
1289
+ return right.match === "subtree" && pathContains(right.value, left.value);
1290
+ }
1291
+
1292
+ function cyclePath(packagesById) {
1293
+ const visiting = new Set();
1294
+ const visited = new Set();
1295
+ const stack = [];
1296
+ function visit(packageId) {
1297
+ if (visiting.has(packageId)) return [...stack.slice(stack.indexOf(packageId)), packageId];
1298
+ if (visited.has(packageId)) return null;
1299
+ visiting.add(packageId);
1300
+ stack.push(packageId);
1301
+ for (const dependencyId of packagesById.get(packageId)?.depends_on_package_ids ?? []) {
1302
+ if (!packagesById.has(dependencyId)) continue;
1303
+ const cycle = visit(dependencyId);
1304
+ if (cycle) return cycle;
1305
+ }
1306
+ stack.pop();
1307
+ visiting.delete(packageId);
1308
+ visited.add(packageId);
1309
+ return null;
1310
+ }
1311
+ for (const packageId of packagesById.keys()) {
1312
+ const cycle = visit(packageId);
1313
+ if (cycle) return cycle;
1314
+ }
1315
+ return null;
1316
+ }
1317
+
1318
+ export function deriveAcceptanceRegistryDigest(references) {
1319
+ const normalizedReferences = [...(references ?? [])]
1320
+ .map((reference) => ({
1321
+ artifact_id: reference.artifact_id,
1322
+ item_id: reference.item_id,
1323
+ observed_revision: reference.observed_revision,
1324
+ }))
1325
+ .sort((left, right) => compareAscii(tupleKey(left), tupleKey(right)));
1326
+ return canonicalDigest({
1327
+ digest_domain: "ask_epic_admission_acceptance_registry_v1",
1328
+ acceptance_refs: normalizedReferences,
1329
+ });
1330
+ }
1331
+
1332
+ function expectedAcceptanceRefs(context) {
1333
+ const references = [];
1334
+ for (const artifact of context.upstream_artifacts) {
1335
+ for (const itemId of artifact.item_ids) {
1336
+ references.push({
1337
+ artifact_id: artifact.artifact_id,
1338
+ item_id: itemId,
1339
+ observed_revision: artifact.revision,
1340
+ });
1341
+ }
1342
+ }
1343
+ return references.sort((left, right) => compareAscii(tupleKey(left), tupleKey(right)));
1344
+ }
1345
+
1346
+ export function projectWorkPackagePlanEntryToLifecycleArtifact(workPackage) {
1347
+ return {
1348
+ id: workPackage.artifact_id,
1349
+ type: "work_package",
1350
+ revision: workPackage.revision,
1351
+ upstream_refs: normalizeArtifactRefs(workPackage.upstream_refs ?? []),
1352
+ fields: {
1353
+ allowed_scope: deepClone(workPackage.allowed_scope ?? []),
1354
+ forbidden_scope: deepClone(workPackage.forbidden_scope ?? []),
1355
+ ordered_tasks: deepClone(workPackage.ordered_tasks ?? []),
1356
+ dependencies: uniqueSorted(workPackage.dependencies ?? []),
1357
+ stop_conditions: deepClone(workPackage.stop_conditions ?? []),
1358
+ evidence_expectations: uniqueSorted(workPackage.expected_evidence_ids ?? []),
1359
+ },
1360
+ };
1361
+ }
1362
+
1363
+ export function validateWorkPackageLifecycleProjection(workPackage, lifecycleArtifact) {
1364
+ const expected = projectWorkPackagePlanEntryToLifecycleArtifact(workPackage);
1365
+ return sameJson(lifecycleArtifact, expected)
1366
+ ? []
1367
+ : [issue("LIFECYCLE_PROJECTION_MISMATCH", "$lifecycleArtifact", `lifecycle Work Package projection ${expected.id} differs from the accepted plan package` )];
1368
+ }
1369
+
1370
+ function allExpectedArtifactIds(packages) {
1371
+ return uniqueSorted(packages.flatMap((workPackage) => workPackage.expected_artifacts.map((artifact) => artifact.artifact_id)));
1372
+ }
1373
+
1374
+ function allExpectedArtifactPaths(packages) {
1375
+ return uniqueSorted(packages.flatMap((workPackage) => workPackage.expected_artifacts.map((artifact) => artifact.path)));
1376
+ }
1377
+
1378
+ export function validateObservedWorkPackageArtifacts(plan, observedPaths) {
1379
+ if (!Array.isArray(observedPaths)) return [issue("OBSERVED_ARTIFACT_PATHS_INVALID", "$observedPaths", "observed artifact paths must be an array")];
1380
+ const issues = [];
1381
+ const expectedPaths = allExpectedArtifactPaths(plan.packages ?? []);
1382
+ const normalizedObservedPaths = uniqueSorted(observedPaths);
1383
+ for (const path of normalizedObservedPaths) {
1384
+ if (!validRepositoryPath(path)) issues.push(issue("OBSERVED_ARTIFACT_PATH_INVALID", "$observedPaths", `observed artifact path ${path} is not normalized and repository-relative`));
1385
+ if (!expectedPaths.includes(path)) issues.push(issue("OBSERVED_ARTIFACT_UNPLANNED", "$observedPaths", `observed artifact path ${path} is absent from the accepted plan`));
1386
+ }
1387
+ for (const path of expectedPaths) {
1388
+ if (!normalizedObservedPaths.includes(path)) issues.push(issue("OBSERVED_ARTIFACT_MISSING", "$observedPaths", `planned artifact path ${path} is absent from observed publication content`));
1389
+ }
1390
+ return sortedIssues(issues);
1391
+ }
1392
+
1393
+ function exactArray(left, right) {
1394
+ return left.length === right.length && left.every((value, index) => value === right[index]);
1395
+ }
1396
+
1397
+ export function validateWorkPackagePlan(plan, options = {}) {
1398
+ const issues = validateWorkPackagePlanRevision(plan, options);
1399
+ if (issues.length > 0) return issues;
1400
+
1401
+ const { previousPlan, previousContext, policy, decision, previousPolicy = policy, previousDecision = decision } = options;
1402
+ // Exact pinned legacy artifacts retain their audit-only admission path.
1403
+ if (plan.plan_revision === 1 || previousPlan.schema_version !== WORK_PACKAGE_PLAN_SCHEMA_VERSION) return issues;
1404
+
1405
+ // Validate exactly one predecessor under its own authority. This private
1406
+ // revision check never follows ancestors or calls the public validator.
1407
+ const previousIssues = validateWorkPackagePlanRevision(previousPlan, {
1408
+ ...options,
1409
+ policy: previousPolicy,
1410
+ decision: previousDecision,
1411
+ context: previousContext,
1412
+ }, false);
1413
+ if (previousIssues.length > 0) {
1414
+ return [issue("PREVIOUS_REVISION_INVALID", "$.supersedes_plan_ref", formatIssues(previousIssues))];
1415
+ }
1416
+ return issues;
1417
+ }
1418
+
1419
+ function validateWorkPackagePlanRevision(plan, {
1420
+ policy,
1421
+ decision,
1422
+ context,
1423
+ previousPlan = null,
1424
+ previousContext = null,
1425
+ planSchemaPath = resolve(MODULE_ROOT, DEFAULT_PATHS.planSchema),
1426
+ contextSchemaPath = resolve(MODULE_ROOT, DEFAULT_PATHS.contextSchema),
1427
+ policySchemaPath = resolve(MODULE_ROOT, DEFAULT_PATHS.policySchema),
1428
+ decisionSchemaPath = resolve(MODULE_ROOT, DEFAULT_PATHS.decisionSchema),
1429
+ } = {}, validateLineage = true) {
1430
+ const issues = schemaIssues(plan, planSchemaPath);
1431
+ if (issues.length > 0) return sortedIssues(issues);
1432
+ issues.push(...planRevisionIssues(plan));
1433
+ if (issues.length > 0) return sortedIssues(issues);
1434
+
1435
+ const policyIssues = validateEpicAdmissionPolicy(policy, { schemaPath: policySchemaPath });
1436
+ if (policyIssues.length > 0) {
1437
+ return sortedIssues([issue("POLICY_INVALID", "$.admission_decision_ref", formatIssues(policyIssues))]);
1438
+ }
1439
+ const initialDecisionIssues = validateEpicAdmissionDecision(decision, {
1440
+ policy,
1441
+ schemaPath: decisionSchemaPath,
1442
+ policySchemaPath,
1443
+ });
1444
+ if (initialDecisionIssues.length > 0) {
1445
+ return sortedIssues([issue("ADMISSION_DECISION_INVALID", "$.admission_decision_ref", formatIssues(initialDecisionIssues))]);
1446
+ }
1447
+ const contextIssues = validateWorkPackagePlanValidationContext(context, {
1448
+ policy,
1449
+ decision,
1450
+ schemaPath: contextSchemaPath,
1451
+ policySchemaPath,
1452
+ decisionSchemaPath,
1453
+ });
1454
+ if (contextIssues.length > 0) {
1455
+ return sortedIssues([issue("VALIDATION_CONTEXT_INVALID", "$.validation_context_ref", formatIssues(contextIssues))]);
1456
+ }
1457
+ const decisionIssues = validateEpicAdmissionDecision(decision, {
1458
+ policy,
1459
+ schemaPath: decisionSchemaPath,
1460
+ policySchemaPath,
1461
+ expectedSubject: {
1462
+ repository_id: context.repository.repository_id,
1463
+ goal_id: context.goal_id,
1464
+ task_id: decision.subject.task_id,
1465
+ base_commit: context.repository.base_commit,
1466
+ base_tree: context.repository.base_tree,
1467
+ branch: context.repository.branch,
1468
+ },
1469
+ });
1470
+ if (decisionIssues.length > 0) {
1471
+ return sortedIssues([issue("ADMISSION_DECISION_INVALID", "$.admission_decision_ref", formatIssues(decisionIssues))]);
1472
+ }
1473
+ if (validateLineage && plan.plan_revision > 1 && previousPlan && previousContext) {
1474
+ if (
1475
+ !isAdmissiblePreviousPlanArtifact(previousPlan, { schemaPath: planSchemaPath })
1476
+ || !isAdmissiblePreviousContextArtifact(previousContext, { schemaPath: contextSchemaPath })
1477
+ ) {
1478
+ return sortedIssues([issue(
1479
+ "PREVIOUS_REVISION_INVALID",
1480
+ "$.supersedes_plan_ref",
1481
+ "the supplied previous plan and validation context must satisfy the current Schemas or match exact pinned legacy audit artifacts before lineage and digest validation",
1482
+ )]);
1483
+ }
1484
+ // Preflight supplied revisions before the current pair uses them in lineage
1485
+ // arithmetic. The full predecessor semantic check still runs exactly once.
1486
+ const previousIssues = previousPlan.schema_version === WORK_PACKAGE_PLAN_SCHEMA_VERSION
1487
+ ? planRevisionIssues(previousPlan) : [];
1488
+ const previousContextIssues = previousContext.schema_version === WORK_PACKAGE_PLAN_SCHEMA_VERSION
1489
+ ? contextRevisionIssues(previousContext) : [];
1490
+ if (previousContextIssues.length > 0) {
1491
+ previousIssues.push(issue("VALIDATION_CONTEXT_INVALID", "$.validation_context_ref", formatIssues(previousContextIssues)));
1492
+ }
1493
+ if (previousIssues.length > 0) {
1494
+ return [issue("PREVIOUS_REVISION_INVALID", "$.supersedes_plan_ref", formatIssues(sortedIssues(previousIssues)))];
1495
+ }
1496
+ }
1497
+
1498
+ const resealed = sealWorkPackagePlan(plan);
1499
+ if (plan.plan_id !== resealed.plan_id) {
1500
+ issues.push(issue("PLAN_IDENTITY_MISMATCH", "$.plan_id", "plan_id does not match repository, goal, and upstream identities"));
1501
+ }
1502
+ if (plan.plan_digest !== resealed.plan_digest) {
1503
+ issues.push(issue("PLAN_DIGEST_MISMATCH", "$.plan_digest", "plan_digest does not match canonical plan content"));
1504
+ }
1505
+ if (!sameJson(withoutField(withoutField(plan, "plan_id"), "plan_digest"), withoutField(withoutField(resealed, "plan_id"), "plan_digest"))) {
1506
+ issues.push(issue("PLAN_NON_CANONICAL", "$", "plan set-like fields are not in canonical order"));
1507
+ }
1508
+ if (!sameJson(plan.validation_context_ref, contextRef(context))) {
1509
+ issues.push(issue("PLAN_CONTEXT_BINDING_MISMATCH", "$.validation_context_ref", "plan is not bound to the supplied current validation context"));
1510
+ }
1511
+ if (!sameJson(plan.admission_decision_ref, decisionRef(decision))) {
1512
+ issues.push(issue("PLAN_ADMISSION_BINDING_MISMATCH", "$.admission_decision_ref", "plan is not bound to the supplied current admission decision"));
1513
+ }
1514
+ if (!sameJson(plan.repository, context.repository) || plan.goal_id !== context.goal_id) {
1515
+ issues.push(issue("PLAN_REPOSITORY_MISMATCH", "$.repository", "plan repository or goal differs from current validation context"));
1516
+ }
1517
+ if (
1518
+ context.current_plan_ref.plan_id !== plan.plan_id
1519
+ || context.current_plan_ref.plan_revision !== plan.plan_revision
1520
+ || context.current_plan_ref.lifecycle_state !== plan.lifecycle_state
1521
+ ) {
1522
+ issues.push(issue("PLAN_STALE", "$.plan_revision", "plan is not the current revision and lifecycle state named by the trusted context"));
1523
+ }
1524
+ if (context.current_plan_ref.plan_content_digest !== deriveWorkPackagePlanContentDigest(plan)) {
1525
+ issues.push(issue("PLAN_CONTENT_BINDING_MISMATCH", "$.plan_digest", "plan content differs from the exact content digest named by the trusted current context"));
1526
+ }
1527
+ if (context.context_revision !== plan.plan_revision) {
1528
+ issues.push(issue("PLAN_CONTEXT_REVISION_MISMATCH", "$.validation_context_ref", "current plan and validation context must advance as one paired revision"));
1529
+ }
1530
+
1531
+ if (plan.plan_revision > 1 && !validateLineage) {
1532
+ // Only the immediate pair is supplied. Check its ancestor references for
1533
+ // consistency and strict revision descent without fetching ancestor bytes.
1534
+ if (plan.supersedes_plan_ref.plan_id !== plan.plan_id
1535
+ || plan.supersedes_plan_ref.plan_revision !== plan.plan_revision - 1) {
1536
+ issues.push(issue("PLAN_REVISION_LINEAGE_MISMATCH", "$.supersedes_plan_ref", "predecessor must reference its own immediately prior plan revision"));
1537
+ }
1538
+ if (!sameJson(context.supersedes_plan_ref, plan.supersedes_plan_ref)) {
1539
+ issues.push(issue("CONTEXT_PREVIOUS_PLAN_BINDING_MISMATCH", "$.supersedes_plan_ref", "predecessor plan and context must reference the same ancestor plan"));
1540
+ }
1541
+ if (context.supersedes_context_ref?.context_id !== context.context_id
1542
+ || context.supersedes_context_ref?.context_revision !== context.context_revision - 1) {
1543
+ issues.push(issue("CONTEXT_REVISION_LINEAGE_MISMATCH", "$.supersedes_context_ref", "predecessor context must reference its own immediately prior revision"));
1544
+ }
1545
+ } else if (plan.plan_revision > 1) {
1546
+ if (!previousPlan || !previousContext) {
1547
+ issues.push(issue("PREVIOUS_REVISION_REQUIRED", "$.supersedes_plan_ref", "a revised plan requires the exact previous plan and context for lineage validation"));
1548
+ } else {
1549
+ if (!storedDigestMatches(previousPlan, "plan_digest")) issues.push(issue("PREVIOUS_PLAN_DIGEST_MISMATCH", "$.supersedes_plan_ref", "superseded plan bytes do not match their stored digest"));
1550
+ if (!storedDigestMatches(previousContext, "context_digest")) issues.push(issue("PREVIOUS_CONTEXT_DIGEST_MISMATCH", "$.supersedes_context_ref", "superseded context bytes do not match their stored digest"));
1551
+ if (previousContext.current_plan_ref?.plan_content_digest && previousContext.current_plan_ref.plan_content_digest !== deriveWorkPackagePlanContentDigest(previousPlan)) {
1552
+ issues.push(issue("PREVIOUS_PLAN_CONTENT_BINDING_MISMATCH", "$.supersedes_plan_ref", "superseded plan content differs from its trusted predecessor context"));
1553
+ }
1554
+ if (previousPlan.validation_context_ref && !sameJson(previousPlan.validation_context_ref, contextRef(previousContext))) {
1555
+ issues.push(issue("PREVIOUS_PLAN_CONTEXT_BINDING_MISMATCH", "$.supersedes_plan_ref", "superseded plan does not bind the supplied predecessor context"));
1556
+ }
1557
+ if (
1558
+ previousContext.current_plan_ref?.plan_id !== previousPlan.plan_id
1559
+ || previousContext.current_plan_ref?.plan_revision !== previousPlan.plan_revision
1560
+ || previousContext.current_plan_ref?.lifecycle_state !== previousPlan.lifecycle_state
1561
+ ) {
1562
+ issues.push(issue("PREVIOUS_PLAN_STALE", "$.supersedes_plan_ref", "superseded plan is not the plan revision/state named by its predecessor context"));
1563
+ }
1564
+ const expectedPlanRef = {
1565
+ plan_id: previousPlan.plan_id,
1566
+ plan_revision: previousPlan.plan_revision,
1567
+ plan_digest: previousPlan.plan_digest,
1568
+ };
1569
+ const expectedContextRef = {
1570
+ context_id: previousContext.context_id,
1571
+ context_revision: previousContext.context_revision,
1572
+ context_digest: previousContext.context_digest,
1573
+ };
1574
+ if (!sameJson(plan.supersedes_plan_ref, expectedPlanRef) || previousPlan.plan_id !== plan.plan_id || previousPlan.plan_revision !== plan.plan_revision - 1) {
1575
+ issues.push(issue("PLAN_REVISION_LINEAGE_MISMATCH", "$.supersedes_plan_ref", "plan revision does not exactly supersede the supplied immediately previous stable plan"));
1576
+ }
1577
+ if (!sameJson(context.supersedes_plan_ref, expectedPlanRef) || !sameJson(context.supersedes_plan_ref, plan.supersedes_plan_ref)) {
1578
+ issues.push(issue("CONTEXT_PREVIOUS_PLAN_BINDING_MISMATCH", "$.supersedes_plan_ref", "trusted current context does not bind the exact plan predecessor claimed by the current plan"));
1579
+ }
1580
+ if (!sameJson(context.supersedes_context_ref, expectedContextRef) || previousContext.context_id !== context.context_id || previousContext.context_revision !== context.context_revision - 1) {
1581
+ issues.push(issue("CONTEXT_REVISION_LINEAGE_MISMATCH", "$.supersedes_context_ref", "context revision does not exactly supersede the supplied immediately previous stable context"));
1582
+ }
1583
+ }
1584
+ } else if (
1585
+ plan.supersedes_plan_ref
1586
+ || plan.revision_reason
1587
+ || context.supersedes_context_ref
1588
+ || context.supersedes_plan_ref
1589
+ || context.revision_reason
1590
+ ) {
1591
+ issues.push(issue("REVISION_LINEAGE_UNEXPECTED", "$.supersedes_plan_ref", "revision 1 cannot claim a superseded predecessor"));
1592
+ }
1593
+
1594
+ const expectedUpstreamRefs = context.upstream_artifacts.map((artifact) => ({
1595
+ artifact_id: artifact.artifact_id,
1596
+ observed_revision: artifact.revision,
1597
+ })).sort((left, right) => compareAscii(tupleKey(left), tupleKey(right)));
1598
+ if (!sameJson(plan.upstream_refs, expectedUpstreamRefs)) {
1599
+ issues.push(issue("UPSTREAM_REFERENCE_CLOSURE_MISMATCH", "$.upstream_refs", "plan upstream refs do not exactly match current authority artifacts"));
1600
+ }
1601
+
1602
+ const duplicatePackageIds = duplicateIds(plan.packages, "package_id");
1603
+ for (const packageId of duplicatePackageIds) {
1604
+ issues.push(issue("PACKAGE_ID_DUPLICATE", "$.packages", `package ID ${packageId} is duplicated`));
1605
+ }
1606
+ if (duplicatePackageIds.length > 0) return sortedIssues(issues);
1607
+ const packagesById = new Map(plan.packages.map((workPackage) => [workPackage.package_id, workPackage]));
1608
+ const packageIds = plan.packages.map((workPackage) => workPackage.package_id);
1609
+ const verificationStepsById = new Map(plan.verification.steps.map((step) => [step.verification_id, step]));
1610
+ const artifactOwnerById = new Map();
1611
+ const artifactOwnerByPath = new Map();
1612
+
1613
+ const hasOrderedPackageDependency = plan.packages.some((workPackage) => workPackage.depends_on_package_ids.length > 0);
1614
+ if (decision.observed_signals.ordered_dependency.value && !hasOrderedPackageDependency) {
1615
+ issues.push(issue("ADMISSION_ORDERED_DEPENDENCY_MISMATCH", "$.admission_decision_ref", "an observed ordered dependency is absent from the plan package DAG"));
1616
+ }
1617
+ const missingStackDependencies = plan.packages.slice(1).filter((workPackage, index) => !workPackage.depends_on_package_ids.includes(plan.packages[index].package_id));
1618
+ if (missingStackDependencies.length > 0) {
1619
+ issues.push(issue("STACK_DEPENDENCY_CLOSURE_MISMATCH", "$.packages", `stacked packages omit their immediate predecessor dependency: ${missingStackDependencies.map((entry) => entry.package_id).join(", ")}`));
1620
+ }
1621
+ for (const artifactId of duplicateIds(plan.packages, "artifact_id")) {
1622
+ issues.push(issue("WORK_PACKAGE_ARTIFACT_ID_DUPLICATE", "$.packages", `Work Package lifecycle artifact ID ${artifactId} is duplicated`));
1623
+ }
1624
+
1625
+ plan.packages.forEach((workPackage, index) => {
1626
+ const path = `$.packages[${index}]`;
1627
+ if (workPackage.plan_binding.plan_id !== plan.plan_id || workPackage.plan_binding.plan_revision !== plan.plan_revision) {
1628
+ issues.push(issue("PACKAGE_PLAN_BINDING_MISMATCH", `${path}.plan_binding`, "package was transplanted from another plan or revision"));
1629
+ }
1630
+ if (!sameJson(workPackage.target_binding, plan.repository)) {
1631
+ issues.push(issue("PACKAGE_TARGET_BINDING_MISMATCH", `${path}.target_binding`, "package target differs from the plan repository/base/branch"));
1632
+ }
1633
+ if (!sameJson(workPackage.upstream_refs, plan.upstream_refs)) {
1634
+ issues.push(issue("PACKAGE_UPSTREAM_BINDING_MISMATCH", `${path}.upstream_refs`, "package upstream refs differ from the plan authority set"));
1635
+ }
1636
+ for (const dependencyId of workPackage.depends_on_package_ids) {
1637
+ if (!packagesById.has(dependencyId)) issues.push(issue("DEPENDENCY_TARGET_MISSING", `${path}.depends_on_package_ids`, `dependency ${dependencyId} is not a plan package`));
1638
+ if (dependencyId === workPackage.package_id) issues.push(issue("DEPENDENCY_SELF_REFERENCE", `${path}.depends_on_package_ids`, "package cannot depend on itself"));
1639
+ }
1640
+ for (const [scopeName, entries] of [["allowed_scope", workPackage.allowed_scope], ["forbidden_scope", workPackage.forbidden_scope]]) {
1641
+ entries.forEach((entry, entryIndex) => {
1642
+ if (entry.kind === "repository_path" && !validRepositoryPath(entry.value)) {
1643
+ issues.push(issue("SCOPE_PATH_INVALID", `${path}.${scopeName}[${entryIndex}].value`, "repository path must be normalized and repository-relative"));
1644
+ }
1645
+ if (entry.kind !== "repository_path" && entry.match !== "exact") {
1646
+ issues.push(issue("SCOPE_MATCH_INVALID", `${path}.${scopeName}[${entryIndex}].match`, "non-path scope kinds support exact matching only"));
1647
+ }
1648
+ });
1649
+ }
1650
+ for (const allowed of workPackage.allowed_scope) {
1651
+ for (const forbidden of workPackage.forbidden_scope) {
1652
+ if (scopesOverlap(allowed, forbidden)) {
1653
+ issues.push(issue("SCOPE_ALLOWED_FORBIDDEN_OVERLAP", `${path}.allowed_scope`, `${allowed.kind}:${allowed.value} overlaps forbidden scope ${forbidden.kind}:${forbidden.value}`));
1654
+ }
1655
+ }
1656
+ }
1657
+ for (const artifactId of duplicateIds(workPackage.expected_artifacts, "artifact_id")) {
1658
+ issues.push(issue("EXPECTED_ARTIFACT_ID_DUPLICATE", `${path}.expected_artifacts`, `expected artifact ${artifactId} is duplicated`));
1659
+ }
1660
+ for (const taskId of duplicateIds(workPackage.ordered_tasks, "task_id")) {
1661
+ issues.push(issue("ORDERED_TASK_ID_DUPLICATE", `${path}.ordered_tasks`, `ordered task ${taskId} is duplicated`));
1662
+ }
1663
+ for (const stopCode of duplicateIds(workPackage.stop_conditions, "code")) {
1664
+ issues.push(issue("STOP_CONDITION_CODE_DUPLICATE", `${path}.stop_conditions`, `stop condition ${stopCode} is duplicated`));
1665
+ }
1666
+ for (const artifact of workPackage.expected_artifacts) {
1667
+ if (!validRepositoryPath(artifact.path)) {
1668
+ issues.push(issue("EXPECTED_ARTIFACT_PATH_INVALID", `${path}.expected_artifacts`, `expected artifact path ${artifact.path} must be normalized and repository-relative`));
1669
+ }
1670
+ if (!workPackage.allowed_scope.some((scope) => pathScopeContains(scope, artifact.path))) {
1671
+ issues.push(issue("EXPECTED_ARTIFACT_OUTSIDE_ALLOWED_SCOPE", `${path}.expected_artifacts`, `expected artifact path ${artifact.path} is not contained by repository_path allowed scope`));
1672
+ }
1673
+ if (workPackage.forbidden_scope.some((scope) => pathScopeContains(scope, artifact.path))) {
1674
+ issues.push(issue("EXPECTED_ARTIFACT_IN_FORBIDDEN_SCOPE", `${path}.expected_artifacts`, `expected artifact path ${artifact.path} is contained by forbidden scope`));
1675
+ }
1676
+ if (artifactOwnerById.has(artifact.artifact_id)) {
1677
+ issues.push(issue("EXPECTED_ARTIFACT_OWNERSHIP_CONFLICT", `${path}.expected_artifacts`, `artifact ${artifact.artifact_id} is also owned by package ${artifactOwnerById.get(artifact.artifact_id)}`));
1678
+ } else artifactOwnerById.set(artifact.artifact_id, workPackage.package_id);
1679
+ if (artifactOwnerByPath.has(artifact.path)) {
1680
+ issues.push(issue("EXPECTED_ARTIFACT_PATH_CONFLICT", `${path}.expected_artifacts`, `path ${artifact.path} is also owned by package ${artifactOwnerByPath.get(artifact.path)}`));
1681
+ } else artifactOwnerByPath.set(artifact.path, workPackage.package_id);
1682
+ }
1683
+ for (const evidenceId of workPackage.expected_evidence_ids) {
1684
+ if (!verificationStepsById.has(evidenceId)) issues.push(issue("EXPECTED_EVIDENCE_UNKNOWN", `${path}.expected_evidence_ids`, `verification step ${evidenceId} is not declared`));
1685
+ }
1686
+ });
1687
+
1688
+ const cycle = cyclePath(packagesById);
1689
+ if (cycle) issues.push(issue("DEPENDENCY_CYCLE", "$.packages", `dependency cycle: ${cycle.join(" -> ")}`));
1690
+
1691
+ const integrationOrder = plan.topology.integration_order;
1692
+ if (!exactArray(integrationOrder, packageIds) || new Set(integrationOrder).size !== packagesById.size) {
1693
+ issues.push(issue("INTEGRATION_ORDER_INVALID", "$.topology.integration_order", "integration order must list every package exactly once in declared package order"));
1694
+ }
1695
+ const integrationIndex = new Map(integrationOrder.map((packageId, index) => [packageId, index]));
1696
+ for (const workPackage of plan.packages) {
1697
+ for (const dependencyId of workPackage.depends_on_package_ids) {
1698
+ if (integrationIndex.has(dependencyId) && integrationIndex.get(dependencyId) >= integrationIndex.get(workPackage.package_id)) {
1699
+ issues.push(issue("DEPENDENCY_ORDER_IMPOSSIBLE", "$.topology.integration_order", `${workPackage.package_id} is integrated before dependency ${dependencyId}`));
1700
+ }
1701
+ }
1702
+ }
1703
+ plan.packages.forEach((workPackage, index) => {
1704
+ const expectedBase = index === 0
1705
+ ? { kind: "repository_base", package_id: null }
1706
+ : { kind: "package", package_id: plan.packages[index - 1].package_id };
1707
+ if (!sameJson(workPackage.stack_base, expectedBase)) {
1708
+ issues.push(issue("STACK_BASE_INCOMPATIBLE", `$.packages[${index}].stack_base`, "stack base must follow the single-branch integration predecessor"));
1709
+ }
1710
+ });
1711
+
1712
+ const expectedAcceptance = expectedAcceptanceRefs(context);
1713
+ if (decision.observed_signals.acceptance_condition_count.value !== expectedAcceptance.length) {
1714
+ issues.push(issue("ADMISSION_ACCEPTANCE_COUNT_MISMATCH", "$.admission_decision_ref", "admission acceptance-condition count differs from the trusted current acceptance registry"));
1715
+ }
1716
+ if (decision.observed_signals.acceptance_registry_digest.value !== deriveAcceptanceRegistryDigest(expectedAcceptance)) {
1717
+ issues.push(issue("ADMISSION_ACCEPTANCE_REGISTRY_MISMATCH", "$.admission_decision_ref", "admission acceptance registry digest differs from the trusted current acceptance identities"));
1718
+ }
1719
+ const ownershipByRef = new Map();
1720
+ plan.acceptance_ownership.forEach((ownership, index) => {
1721
+ const key = tupleKey(ownership.acceptance_ref);
1722
+ if (ownershipByRef.has(key)) {
1723
+ issues.push(issue("AC_OWNERSHIP_CONFLICT", `$.acceptance_ownership[${index}]`, `acceptance ref ${key} has multiple ownership records`));
1724
+ }
1725
+ ownershipByRef.set(key, ownership);
1726
+ for (const ownerId of ownership.owner_package_ids) {
1727
+ if (!packagesById.has(ownerId)) issues.push(issue("AC_OWNER_UNKNOWN", `$.acceptance_ownership[${index}].owner_package_ids`, `owner package ${ownerId} is unknown`));
1728
+ }
1729
+ if (ownership.mode === "exclusive" && (ownership.owner_package_ids.length !== 1 || ownership.shared_reason !== null)) {
1730
+ issues.push(issue("AC_EXCLUSIVE_OWNERSHIP_INVALID", `$.acceptance_ownership[${index}]`, "exclusive ownership requires one owner and no shared reason"));
1731
+ }
1732
+ if (ownership.mode === "shared" && (ownership.owner_package_ids.length < 2 || !ownership.shared_reason?.trim())) {
1733
+ issues.push(issue("AC_SHARED_OWNERSHIP_AMBIGUOUS", `$.acceptance_ownership[${index}]`, "shared ownership requires at least two owners and an explicit reason"));
1734
+ }
1735
+ });
1736
+ const expectedAcceptanceKeys = expectedAcceptance.map(tupleKey);
1737
+ for (const key of expectedAcceptanceKeys) {
1738
+ if (!ownershipByRef.has(key)) issues.push(issue("AC_UNCOVERED", "$.acceptance_ownership", `current acceptance ref ${key} has no owner`));
1739
+ }
1740
+ for (const key of ownershipByRef.keys()) {
1741
+ if (!expectedAcceptanceKeys.includes(key)) issues.push(issue("AC_REFERENCE_STALE_OR_UNKNOWN", "$.acceptance_ownership", `acceptance ref ${key} is not current`));
1742
+ }
1743
+
1744
+ const expectedArtifactIds = allExpectedArtifactIds(plan.packages);
1745
+ if (plan.topology.publication_units.length !== 1) {
1746
+ issues.push(issue("PUBLICATION_UNIT_COUNT_INVALID", "$.topology.publication_units", "Slice 1 topology requires one reconstructable pull request unit"));
1747
+ }
1748
+ const publicationById = new Map();
1749
+ plan.topology.publication_units.forEach((unit, index) => {
1750
+ publicationById.set(unit.unit_id, unit);
1751
+ if (unit.branch !== plan.repository.branch || unit.base_commit !== plan.repository.base_commit) {
1752
+ issues.push(issue("PUBLICATION_TARGET_MISMATCH", `$.topology.publication_units[${index}]`, "publication unit target differs from the plan target"));
1753
+ }
1754
+ if (!exactArray(unit.package_ids, integrationOrder)) {
1755
+ issues.push(issue("PUBLICATION_PACKAGE_COVERAGE_MISMATCH", `$.topology.publication_units[${index}].package_ids`, "publication unit cannot reconstruct the integrated package sequence"));
1756
+ }
1757
+ if (!exactArray(unit.artifact_ids, expectedArtifactIds)) {
1758
+ issues.push(issue("PUBLICATION_ARTIFACT_COVERAGE_MISMATCH", `$.topology.publication_units[${index}].artifact_ids`, "publication unit does not cover the exact planned artifact set"));
1759
+ }
1760
+ });
1761
+ if (plan.topology.review_units.length !== 1) {
1762
+ issues.push(issue("REVIEW_UNIT_COUNT_INVALID", "$.topology.review_units", "Slice 1 topology requires one exact-head independent review unit"));
1763
+ }
1764
+ plan.topology.review_units.forEach((unit, index) => {
1765
+ const publication = publicationById.get(unit.publication_unit_id);
1766
+ if (!publication) issues.push(issue("REVIEW_PUBLICATION_UNKNOWN", `$.topology.review_units[${index}].publication_unit_id`, "review unit references an unknown publication unit"));
1767
+ else if (!exactArray(unit.package_ids, publication.package_ids) || !exactArray(unit.artifact_ids, publication.artifact_ids)) {
1768
+ issues.push(issue("REVIEW_CONTENT_COVERAGE_MISMATCH", `$.topology.review_units[${index}]`, "review unit content cannot be related exactly to its publication unit"));
1769
+ }
1770
+ });
1771
+
1772
+ for (const verificationId of duplicateIds(plan.verification.steps, "verification_id")) {
1773
+ issues.push(issue("VERIFICATION_ID_DUPLICATE", "$.verification.steps", `verification step ${verificationId} is duplicated`));
1774
+ }
1775
+ const cadenceByPackage = new Map();
1776
+ plan.verification.focused_cadence.forEach((entry, index) => {
1777
+ if (cadenceByPackage.has(entry.after_package_id)) issues.push(issue("FOCUSED_CADENCE_DUPLICATE", `$.verification.focused_cadence[${index}]`, "package has more than one focused cadence record"));
1778
+ cadenceByPackage.set(entry.after_package_id, entry);
1779
+ if (!packagesById.has(entry.after_package_id)) issues.push(issue("FOCUSED_CADENCE_PACKAGE_UNKNOWN", `$.verification.focused_cadence[${index}].after_package_id`, "focused cadence references an unknown package"));
1780
+ for (const verificationId of entry.verification_ids) {
1781
+ if (verificationStepsById.get(verificationId)?.kind !== "focused") issues.push(issue("FOCUSED_VERIFICATION_INVALID", `$.verification.focused_cadence[${index}].verification_ids`, `${verificationId} is not a declared focused verification step`));
1782
+ }
1783
+ });
1784
+ for (const packageId of packageIds) {
1785
+ if (!cadenceByPackage.has(packageId)) issues.push(issue("FOCUSED_CADENCE_MISSING", "$.verification.focused_cadence", `package ${packageId} has no focused verification boundary`));
1786
+ }
1787
+
1788
+ const checkpointsById = new Map(plan.verification.full_gate_checkpoints.map((checkpoint) => [checkpoint.checkpoint_id, checkpoint]));
1789
+ for (const checkpointId of duplicateIds(plan.verification.full_gate_checkpoints, "checkpoint_id")) {
1790
+ issues.push(issue("FULL_CHECKPOINT_DUPLICATE", "$.verification.full_gate_checkpoints", `checkpoint ${checkpointId} is duplicated`));
1791
+ }
1792
+ for (const requiredId of context.required_full_checkpoint_ids) {
1793
+ if (!checkpointsById.has(requiredId)) issues.push(issue("FULL_CHECKPOINT_MISSING", "$.verification.full_gate_checkpoints", `required checkpoint ${requiredId} is missing`));
1794
+ }
1795
+ plan.verification.full_gate_checkpoints.forEach((checkpoint, index) => {
1796
+ if (!exactArray(checkpoint.after_package_ids, integrationOrder)) {
1797
+ issues.push(issue("FULL_CHECKPOINT_BOUNDARY_INVALID", `$.verification.full_gate_checkpoints[${index}].after_package_ids`, "full checkpoint must bind the complete integrated package sequence"));
1798
+ }
1799
+ for (const verificationId of checkpoint.verification_ids) {
1800
+ if (verificationStepsById.get(verificationId)?.kind !== "full") issues.push(issue("FULL_VERIFICATION_INVALID", `$.verification.full_gate_checkpoints[${index}].verification_ids`, `${verificationId} is not a declared full verification step`));
1801
+ }
1802
+ });
1803
+ const fullCheckpointEvidence = new Set(plan.verification.full_gate_checkpoints.flatMap((checkpoint) => checkpoint.verification_ids));
1804
+ for (const gate of context.non_overridable_gates) {
1805
+ const plannedGate = verificationStepsById.get(gate.verification_id);
1806
+ if (!sameJson(plannedGate, { ...gate, kind: "full" })) {
1807
+ issues.push(issue("NON_OVERRIDABLE_GATE_DEFINITION_MISMATCH", "$.verification.steps", `required authority gate ${gate.verification_id} differs from the trusted procedure and purpose`));
1808
+ }
1809
+ if (plannedGate?.kind !== "full" || !fullCheckpointEvidence.has(gate.verification_id)) {
1810
+ issues.push(issue("NON_OVERRIDABLE_GATE_MISSING", "$.verification", `required authority gate ${gate.verification_id} is absent from full checkpoints`));
1811
+ }
1812
+ }
1813
+ for (const workPackage of plan.packages) {
1814
+ const focusedEvidence = new Set(cadenceByPackage.get(workPackage.package_id)?.verification_ids ?? []);
1815
+ const applicableFullEvidence = new Set(plan.verification.full_gate_checkpoints
1816
+ .filter((checkpoint) => checkpoint.after_package_ids.includes(workPackage.package_id))
1817
+ .flatMap((checkpoint) => checkpoint.verification_ids));
1818
+ for (const evidenceId of workPackage.expected_evidence_ids) {
1819
+ if (!focusedEvidence.has(evidenceId) && !applicableFullEvidence.has(evidenceId)) {
1820
+ issues.push(issue("EXPECTED_EVIDENCE_UNBOUND", "$.verification", `package ${workPackage.package_id} evidence ${evidenceId} is not bound to a focused cadence or full checkpoint`));
1821
+ }
1822
+ }
1823
+ }
1824
+
1825
+ const planBlockers = new Map(plan.blockers.map((blocker) => [blocker.blocker_id, blocker]));
1826
+ for (const blocker of context.known_blockers.filter((candidate) => candidate.status !== "resolved")) {
1827
+ if (!planBlockers.has(blocker.blocker_id)) issues.push(issue("HIDDEN_BLOCKER", "$.blockers", `current blocker ${blocker.blocker_id} is omitted from the plan`));
1828
+ else if (planBlockers.get(blocker.blocker_id).status !== blocker.status) issues.push(issue("BLOCKER_STATUS_MISMATCH", "$.blockers", `plan blocker ${blocker.blocker_id} does not preserve current status ${blocker.status}`));
1829
+ }
1830
+ const planDecisions = new Map(plan.unresolved_decisions.map((decisionRecord) => [decisionRecord.decision_id, decisionRecord]));
1831
+ for (const requiredDecision of context.required_human_decisions) {
1832
+ if (!planDecisions.has(requiredDecision.decision_id)) issues.push(issue("HIDDEN_HUMAN_DECISION", "$.unresolved_decisions", `required human decision ${requiredDecision.decision_id} is omitted from the plan`));
1833
+ else if (planDecisions.get(requiredDecision.decision_id).authority_kind !== requiredDecision.authority_kind) issues.push(issue("HUMAN_DECISION_AUTHORITY_MISMATCH", "$.unresolved_decisions", `human decision ${requiredDecision.decision_id} has the wrong authority kind`));
1834
+ }
1835
+ const planApprovals = new Map(plan.human_approvals.map((approval) => [approval.approval_id, approval]));
1836
+ for (const blockerId of duplicateIds(plan.blockers, "blocker_id")) issues.push(issue("PLAN_BLOCKER_DUPLICATE", "$.blockers", `plan blocker ${blockerId} is duplicated`));
1837
+ for (const decisionId of duplicateIds(plan.unresolved_decisions, "decision_id")) issues.push(issue("PLAN_HUMAN_DECISION_DUPLICATE", "$.unresolved_decisions", `plan human decision ${decisionId} is duplicated`));
1838
+ for (const approvalId of duplicateIds(plan.human_approvals, "approval_id")) issues.push(issue("PLAN_HUMAN_APPROVAL_DUPLICATE", "$.human_approvals", `plan human approval ${approvalId} is duplicated`));
1839
+ for (const requiredApproval of context.required_human_approvals) {
1840
+ if (!planApprovals.has(requiredApproval.approval_id)) issues.push(issue("HIDDEN_HUMAN_APPROVAL", "$.human_approvals", `required human approval ${requiredApproval.approval_id} is omitted from the plan`));
1841
+ else {
1842
+ const plannedApproval = planApprovals.get(requiredApproval.approval_id);
1843
+ if (!sameJson(plannedApproval, requiredApproval)) {
1844
+ issues.push(issue("HUMAN_APPROVAL_AUTHORITY_MISMATCH", "$.human_approvals", `human approval ${requiredApproval.approval_id} must exactly mirror status, authority, and immutable evidence from the trusted context`));
1845
+ }
1846
+ }
1847
+ }
1848
+ for (const plannedApproval of plan.human_approvals) {
1849
+ if (!context.required_human_approvals.some((requiredApproval) => requiredApproval.approval_id === plannedApproval.approval_id)) {
1850
+ issues.push(issue("HUMAN_APPROVAL_CLOSURE_MISMATCH", "$.human_approvals", `plan approval ${plannedApproval.approval_id} is absent from the trusted context`));
1851
+ }
1852
+ }
1853
+ for (const approval of plan.human_approvals) {
1854
+ if (approval.status === "approved" && (
1855
+ !approval.authority_ref?.trim()
1856
+ || !approval.approval_evidence_ref?.trim()
1857
+ || !approval.approval_evidence_digest?.startsWith("sha256:")
1858
+ )) {
1859
+ issues.push(issue("HUMAN_APPROVAL_AUTHORITY_MISSING", "$.human_approvals", `approved record ${approval.approval_id} lacks trusted authority or immutable approval evidence`));
1860
+ }
1861
+ }
1862
+ if (plan.lifecycle_state === "accepted") {
1863
+ if (plan.unresolved_decisions.some((entry) => entry.status !== "resolved")) issues.push(issue("UNRESOLVED_HUMAN_DECISION", "$.unresolved_decisions", "accepted plan cannot contain an unresolved or unknown human decision"));
1864
+ if (plan.human_approvals.some((entry) => entry.status !== "approved")) issues.push(issue("HUMAN_APPROVAL_UNRESOLVED", "$.human_approvals", "accepted plan cannot contain a required, rejected, or unknown approval"));
1865
+ if (plan.blockers.some((entry) => entry.status !== "resolved")) issues.push(issue("OPEN_BLOCKER_IN_EXECUTABLE_PLAN", "$.blockers", "accepted plan cannot contain an open or unknown blocker"));
1866
+ if (context.known_blockers.some((entry) => entry.status !== "resolved")) issues.push(issue("CURRENT_BLOCKER_UNRESOLVED", "$.blockers", "trusted current context still contains an open or unknown blocker"));
1867
+ if (context.required_human_decisions.length > 0) issues.push(issue("CURRENT_HUMAN_DECISION_REQUIRED", "$.unresolved_decisions", "trusted current context still requires a human decision"));
1868
+ if (context.required_human_approvals.some((entry) => entry.status !== "approved")) issues.push(issue("CURRENT_HUMAN_APPROVAL_UNRESOLVED", "$.human_approvals", "trusted current context still contains a non-approved human approval"));
1869
+ if (decision.effective_decision === "human_decision_required") issues.push(issue("ADMISSION_HUMAN_DECISION", "$.admission_decision_ref", "human admission decision remains unresolved"));
1870
+ }
1871
+ return sortedIssues(issues);
1872
+ }
1873
+
1874
+ export function validateWorkPackagePlanExecutable(plan, options = {}) {
1875
+ const issues = validateWorkPackagePlan(plan, options);
1876
+ if (issues.some((entry) => entry.code === "SCHEMA_INVALID")) return issues;
1877
+ if (plan.lifecycle_state !== "accepted") {
1878
+ issues.push(issue("PLAN_NOT_EXECUTABLE", "$.lifecycle_state", "repository mutation requires an accepted current Work Package Plan"));
1879
+ }
1880
+ if (plan.unresolved_decisions.some((entry) => entry.status !== "resolved")) {
1881
+ issues.push(issue("UNRESOLVED_HUMAN_DECISION", "$.unresolved_decisions", "executable plan cannot contain an unresolved or unknown human decision"));
1882
+ }
1883
+ if (plan.human_approvals.some((entry) => entry.status !== "approved")) {
1884
+ issues.push(issue("HUMAN_APPROVAL_UNRESOLVED", "$.human_approvals", "executable plan cannot contain a required, rejected, or unknown approval"));
1885
+ }
1886
+ if (plan.blockers.some((entry) => entry.status !== "resolved")) {
1887
+ issues.push(issue("OPEN_BLOCKER_IN_EXECUTABLE_PLAN", "$.blockers", "executable plan cannot contain an open or unknown blocker"));
1888
+ }
1889
+ if (options.context?.known_blockers?.some((entry) => entry.status !== "resolved")) {
1890
+ issues.push(issue("CURRENT_BLOCKER_UNRESOLVED", "$.blockers", "trusted current context still contains an open or unknown blocker"));
1891
+ }
1892
+ if ((options.context?.required_human_decisions?.length ?? 0) > 0) {
1893
+ issues.push(issue("CURRENT_HUMAN_DECISION_REQUIRED", "$.unresolved_decisions", "trusted current context still requires a human decision"));
1894
+ }
1895
+ if (options.context?.required_human_approvals?.some((entry) => entry.status !== "approved")) {
1896
+ issues.push(issue("CURRENT_HUMAN_APPROVAL_UNRESOLVED", "$.human_approvals", "trusted current context still contains a non-approved human approval"));
1897
+ }
1898
+ if (options.decision?.effective_decision === "human_decision_required") {
1899
+ issues.push(issue("ADMISSION_HUMAN_DECISION", "$.admission_decision_ref", "human admission decision remains unresolved"));
1900
+ }
1901
+ return sortedIssues(issues.filter((entry, index, values) => values.findIndex((candidate) => candidate.code === entry.code && candidate.path === entry.path) === index));
1902
+ }
1903
+
1904
+ function validateCaseCatalog(catalog) {
1905
+ const issues = [];
1906
+ if (!catalog || typeof catalog !== "object" || Array.isArray(catalog)) return [issue("FIXTURE_CATALOG_INVALID", "$", "fixture catalog must be an object")];
1907
+ if (catalog.schema_version !== EPIC_ADMISSION_SCHEMA_VERSION) issues.push(issue("FIXTURE_CATALOG_INVALID", "$.schema_version", `fixture catalog schema_version must be ${EPIC_ADMISSION_SCHEMA_VERSION}`));
1908
+ if (!Array.isArray(catalog.cases)) return [issue("FIXTURE_CATALOG_INVALID", "$.cases", "fixture catalog cases must be an array")];
1909
+ const caseIds = catalog.cases.map((entry) => entry?.case_id);
1910
+ for (const id of REQUIRED_CASE_IDS) {
1911
+ if (!caseIds.includes(id)) issues.push(issue("FIXTURE_CASE_MISSING", "$.cases", `required case ${id} is missing`));
1912
+ }
1913
+ for (const id of caseIds) {
1914
+ if (!REQUIRED_CASE_IDS.includes(id)) issues.push(issue("FIXTURE_CASE_UNKNOWN", "$.cases", `unknown case ${id}`));
1915
+ }
1916
+ if (new Set(caseIds).size !== caseIds.length) issues.push(issue("FIXTURE_CASE_DUPLICATE", "$.cases", "fixture case IDs must be unique"));
1917
+ return sortedIssues(issues);
1918
+ }
1919
+
1920
+ export function validateRepositoryEpicAdmissionWorkPackagePlan({ root = MODULE_ROOT, paths: pathOverrides = {} } = {}) {
1921
+ const paths = resolvedPaths(root, pathOverrides);
1922
+ for (const key of ["policy", "decision", "context", "plan", "firstContext", "firstPlan", "previousContext", "previousPlan", "cases"]) {
1923
+ if (!existsSync(paths[key])) return { issues: [issue("ARTIFACT_MISSING", `$paths.${key}`, `${paths[key]} is missing`)] };
1924
+ }
1925
+ let policy;
1926
+ let decision;
1927
+ let context;
1928
+ let plan;
1929
+ let firstContext;
1930
+ let firstPlan;
1931
+ let previousContext;
1932
+ let previousPlan;
1933
+ let cases;
1934
+ try {
1935
+ policy = readJsonFileStrict(paths.policy, "epic admission policy");
1936
+ decision = readJsonFileStrict(paths.decision, "epic admission decision");
1937
+ context = readJsonFileStrict(paths.context, "Work Package Plan validation context");
1938
+ plan = readJsonFileStrict(paths.plan, "Work Package Plan");
1939
+ firstContext = readJsonFileStrict(paths.firstContext, "pinned r1 Work Package Plan validation context");
1940
+ firstPlan = readJsonFileStrict(paths.firstPlan, "pinned r1 Work Package Plan");
1941
+ previousContext = readJsonFileStrict(paths.previousContext, "superseded Work Package Plan validation context");
1942
+ previousPlan = readJsonFileStrict(paths.previousPlan, "superseded Work Package Plan");
1943
+ cases = readJsonFileStrict(paths.cases, "epic admission and Work Package Plan fixture catalog");
1944
+ } catch (error) {
1945
+ return { issues: [issue(error.code === "DUPLICATE_JSON_OBJECT_KEY" ? "DUPLICATE_JSON_KEY" : "STRICT_JSON_READ_FAILED", "$", error.message)] };
1946
+ }
1947
+ const policyIssues = validateEpicAdmissionPolicy(policy, { schemaPath: paths.policySchema });
1948
+ const decisionIssues = policyIssues.length === 0
1949
+ ? validateEpicAdmissionDecision(decision, {
1950
+ policy,
1951
+ schemaPath: paths.decisionSchema,
1952
+ policySchemaPath: paths.policySchema,
1953
+ })
1954
+ : [];
1955
+ const historicalIssues = historicalArtifactIssues(paths, { firstContext, firstPlan, previousContext, previousPlan });
1956
+ const dependencyIssues = policyIssues.length > 0
1957
+ ? [issue("POLICY_INVALID", "$paths.policy", formatIssues(policyIssues))]
1958
+ : decisionIssues.length > 0
1959
+ ? [issue("ADMISSION_DECISION_INVALID", "$paths.decision", formatIssues(decisionIssues))]
1960
+ : [];
1961
+ const planIssues = policyIssues.length === 0 && decisionIssues.length === 0 && historicalIssues.length === 0
1962
+ ? validateWorkPackagePlanExecutable(plan, {
1963
+ policy,
1964
+ decision,
1965
+ context,
1966
+ previousContext,
1967
+ previousPlan,
1968
+ planSchemaPath: paths.planSchema,
1969
+ contextSchemaPath: paths.contextSchema,
1970
+ policySchemaPath: paths.policySchema,
1971
+ decisionSchemaPath: paths.decisionSchema,
1972
+ })
1973
+ : [];
1974
+ const issues = [
1975
+ ...dependencyIssues,
1976
+ ...historicalIssues,
1977
+ ...planIssues,
1978
+ ...validateCaseCatalog(cases),
1979
+ ];
1980
+ return {
1981
+ issues: sortedIssues(issues),
1982
+ policy,
1983
+ decision,
1984
+ context,
1985
+ plan,
1986
+ caseCount: Array.isArray(cases?.cases) ? cases.cases.length : 0,
1987
+ };
1988
+ }
1989
+
1990
+ export function formatIssues(issues) {
1991
+ return issues.map((entry) => `${entry.code} ${entry.path}: ${entry.message}`).join("; ");
1992
+ }
1993
+
1994
+ function runCli() {
1995
+ const unsupported = process.argv.slice(2).filter((argument) => argument !== "--check");
1996
+ if (unsupported.length > 0) throw new Error(`unsupported arguments: ${unsupported.join(" ")}`);
1997
+ const result = validateRepositoryEpicAdmissionWorkPackagePlan();
1998
+ if (result.issues.length > 0) throw new Error(formatIssues(result.issues));
1999
+ console.log(`Epic admission and Work Package Plan validation passed: plan=${result.plan.plan_id}@${result.plan.plan_revision} digest=${result.plan.plan_digest} cases=${result.caseCount}`);
2000
+ }
2001
+
2002
+ if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
2003
+ try {
2004
+ runCli();
2005
+ } catch (error) {
2006
+ console.error(`Epic admission and Work Package Plan validation failed: ${error.message}`);
2007
+ process.exitCode = 1;
2008
+ }
2009
+ }