create-agdf 0.20.2 → 0.30.0

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 (836) hide show
  1. package/README.md +148 -191
  2. package/generated/.agdf/control/README.md +31 -110
  3. package/generated/.agdf/control/planned-urs.md +95 -0
  4. package/generated/.agdf/control/templates/RUN_STATE.md +15 -64
  5. package/generated/.agdf/control/templates/artefacts/UR.md +1 -1
  6. package/generated/.agents/plugins/marketplace.json +12 -0
  7. package/generated/.opencode/agdf-agent-router.md +3 -3
  8. package/generated/.opencode/agdf-interaction-locales.json +2668 -2682
  9. package/generated/.opencode/contracts/closeout.md +1 -1
  10. package/generated/.opencode/contracts/control-scaffold.md +63 -46
  11. package/generated/.opencode/contracts/gate-artifact-preparation.md +58 -48
  12. package/generated/.opencode/contracts/gate-transition.md +5 -6
  13. package/generated/.opencode/contracts/interaction.md +43 -126
  14. package/generated/.opencode/contracts/modes.md +4 -3
  15. package/generated/.opencode/contracts/prd-definition.md +6 -6
  16. package/generated/.opencode/contracts/quality.md +10 -2
  17. package/generated/.opencode/contracts/request-activation.md +9 -8
  18. package/generated/.opencode/contracts/sd-definition.md +3 -3
  19. package/generated/.opencode/contracts/task-target-resolution.md +24 -0
  20. package/generated/.opencode/contracts/tp-definition.md +1 -1
  21. package/generated/.opencode/contracts/ur-definition.md +41 -7
  22. package/generated/.opencode/skills/agdf-brownfield-analysis/SKILL.md +8 -5
  23. package/generated/.opencode/skills/agdf-clean-implementation-review/SKILL.md +3 -2
  24. package/generated/.opencode/skills/agdf-code-review/SKILL.md +5 -3
  25. package/generated/.opencode/skills/agdf-delivery-closeout/SKILL.md +3 -2
  26. package/generated/.opencode/skills/agdf-delivery-path-search/SKILL.md +3 -2
  27. package/generated/.opencode/skills/agdf-gate-check/SKILL.md +35 -31
  28. package/generated/.opencode/skills/agdf-prd-definition/SKILL.md +3 -2
  29. package/generated/.opencode/skills/agdf-qa-gate/SKILL.md +3 -2
  30. package/generated/.opencode/skills/agdf-release-or/SKILL.md +8 -5
  31. package/generated/.opencode/skills/agdf-sd-definition/SKILL.md +3 -2
  32. package/generated/.opencode/skills/agdf-task-plan-review/SKILL.md +3 -2
  33. package/generated/.opencode/skills/agdf-tp-definition/SKILL.md +3 -2
  34. package/generated/.opencode/skills/agdf-ur-definition/SKILL.md +12 -4
  35. package/generated/.opencode/skills/agdf-ux-intent-definition/SKILL.md +5 -4
  36. package/generated/plugins/agdf/.claude-plugin/plugin.json +3 -2
  37. package/generated/plugins/agdf/.codex-plugin/plugin.json +1 -1
  38. package/generated/plugins/agdf/companion/assignment.mjs +65 -0
  39. package/generated/plugins/agdf/companion/companion.json +4 -0
  40. package/generated/plugins/agdf/companion/core.mjs +16 -0
  41. package/generated/plugins/agdf/companion/figure.mjs +137 -0
  42. package/generated/plugins/agdf/companion/gate-bar.mjs +54 -0
  43. package/generated/plugins/agdf/companion/hooks.json +3 -0
  44. package/generated/plugins/agdf/companion/locales.json +200 -0
  45. package/generated/plugins/agdf/companion/localization.mjs +89 -0
  46. package/generated/plugins/agdf/companion/notice.mjs +90 -0
  47. package/generated/plugins/agdf/companion/persistence.mjs +36 -0
  48. package/generated/plugins/agdf/companion/register.mjs +444 -0
  49. package/generated/plugins/agdf/companion/run-state.mjs +110 -0
  50. package/generated/plugins/agdf/companion/state.mjs +48 -0
  51. package/generated/plugins/agdf/companion/view.mjs +84 -0
  52. package/generated/plugins/agdf/control/README.md +31 -110
  53. package/generated/plugins/agdf/control/planned-urs.md +95 -0
  54. package/generated/plugins/agdf/control/templates/RUN_STATE.md +15 -64
  55. package/generated/plugins/agdf/control/templates/artefacts/UR.md +1 -1
  56. package/generated/plugins/agdf/mcp/server/README.md +119 -7
  57. package/generated/plugins/agdf/mcp/server/package.json +12 -7
  58. package/generated/plugins/agdf/mcp/server/src/generation-entry.js +3 -85
  59. package/generated/plugins/agdf/mcp/server/src/generation-protocol.js +2 -44
  60. package/generated/plugins/agdf/mcp/server/src/generation-runtime.js +94 -0
  61. package/generated/plugins/agdf/mcp/server/src/generation-thread-entry.js +8 -0
  62. package/generated/plugins/agdf/mcp/server/src/generation.js +64 -20
  63. package/generated/plugins/agdf/mcp/server/src/main.js +42 -10
  64. package/generated/plugins/agdf/mcp/server/src/server.js +24 -15
  65. package/generated/plugins/agdf/mcp/server/src/stdio-output.js +42 -0
  66. package/generated/plugins/agdf/mcp/server/src/worker-entry.js +2 -2
  67. package/generated/plugins/agdf/mcp/server/src/worker.js +53 -7
  68. package/generated/plugins/agdf/mcp/server/ui/cockpit.html +31 -31
  69. package/generated/plugins/agdf/mcp/server/ui/decision-manifest.json +3 -3
  70. package/generated/plugins/agdf/mcp/server/ui/decision.html +36 -36
  71. package/generated/plugins/agdf/mcp/server/ui/manifest.json +4 -4
  72. package/generated/plugins/agdf/meta/agdf-agent-router.md +3 -3
  73. package/generated/plugins/agdf/meta/agdf-defaults.json +9 -0
  74. package/generated/plugins/agdf/meta/agdf-defaults.schema.json +20 -0
  75. package/generated/plugins/agdf/meta/agdf-interaction-locales.json +2668 -2682
  76. package/generated/plugins/agdf/meta/agdf-mcp-capability.json +1 -1
  77. package/generated/plugins/agdf/meta/agdf-plugin.definition.json +8 -3
  78. package/generated/plugins/agdf/meta/contracts/closeout.md +1 -1
  79. package/generated/plugins/agdf/meta/contracts/control-scaffold.md +63 -46
  80. package/generated/plugins/agdf/meta/contracts/gate-artifact-preparation.md +58 -48
  81. package/generated/plugins/agdf/meta/contracts/gate-transition.md +5 -6
  82. package/generated/plugins/agdf/meta/contracts/interaction.md +43 -126
  83. package/generated/plugins/agdf/meta/contracts/modes.md +4 -3
  84. package/generated/plugins/agdf/meta/contracts/prd-definition.md +6 -6
  85. package/generated/plugins/agdf/meta/contracts/quality.md +10 -2
  86. package/generated/plugins/agdf/meta/contracts/request-activation.md +9 -8
  87. package/generated/plugins/agdf/meta/contracts/sd-definition.md +3 -3
  88. package/generated/plugins/agdf/meta/contracts/task-target-resolution.md +24 -0
  89. package/generated/plugins/agdf/meta/contracts/tp-definition.md +1 -1
  90. package/generated/plugins/agdf/meta/contracts/ur-definition.md +41 -7
  91. package/generated/plugins/agdf/meta/copilot-payload-baseline.json +3 -3
  92. package/generated/plugins/agdf/meta/distribution-profile-history.json +7 -0
  93. package/generated/plugins/agdf/runtime/agdf-session-check.js +25 -21
  94. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-defaults.json +9 -0
  95. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-defaults.schema.json +20 -0
  96. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-interaction-locales.json +2668 -2682
  97. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-plugin.definition.json +8 -3
  98. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/closeout.md +1 -1
  99. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/control-scaffold.md +63 -46
  100. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/gate-artifact-preparation.md +58 -48
  101. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/gate-transition.md +5 -6
  102. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/interaction.md +43 -126
  103. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/modes.md +4 -3
  104. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/prd-definition.md +6 -6
  105. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/quality.md +10 -2
  106. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/request-activation.md +9 -8
  107. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/sd-definition.md +3 -3
  108. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/task-target-resolution.md +24 -0
  109. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/tp-definition.md +1 -1
  110. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/ur-definition.md +41 -7
  111. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/codex-document-command.js +195 -0
  112. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/command-registry.js +82 -148
  113. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/control-maintenance-command.js +8 -37
  114. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/parse-args.js +98 -16
  115. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/planned-command.js +55 -0
  116. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/project-read-command.js +35 -0
  117. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/run-command-aliases.js +116 -0
  118. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/runtime-context.js +1 -59
  119. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/validation-handlers.js +33 -103
  120. package/generated/plugins/agdf/runtime/create-agdf/lib/control-evaluation/git-observation.js +7 -5
  121. package/generated/plugins/agdf/runtime/create-agdf/lib/control-maintenance/startup.js +2 -2
  122. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-decision-protocol.js +40 -0
  123. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-dispatch-runtime.js +71 -306
  124. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-entry.js +3 -24
  125. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-owner-entry.js +31 -15
  126. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-runtime.js +29 -0
  127. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-thread-entry.js +11 -0
  128. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/owner-client.js +79 -0
  129. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/package.js +14 -80
  130. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/plugin-runtime.js +29 -9
  131. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/thread-owner.js +164 -0
  132. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-owner-protocol.js +1 -0
  133. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-protocol-runtime.js +308 -0
  134. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-worker-runtime.js +152 -0
  135. package/generated/plugins/agdf/runtime/create-agdf/lib/runtime/control-command-service.js +22 -7
  136. package/generated/plugins/agdf/runtime/create-agdf/lib/runtime/control-context.js +8 -1
  137. package/generated/plugins/agdf/runtime/create-agdf/lib/runtime/validator-application.js +2 -2
  138. package/generated/plugins/agdf/runtime/create-agdf/package.json +5 -1
  139. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/closeout-readiness.js +10 -2
  140. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/decision-content-placeholder.js +9 -0
  141. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/decision-content-readiness.js +2 -7
  142. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/definition-sources.js +3 -2
  143. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/delivery-map.js +2 -12
  144. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/doctor.js +162 -172
  145. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-check.js +10 -9
  146. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy-inputs.js +11 -0
  147. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy-pure.js +446 -0
  148. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy.js +3 -434
  149. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/next-action.js +2 -0
  150. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/parent-reconciliation.js +2 -1
  151. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/qa-follow-up.js +2 -1
  152. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/required-files.js +9 -7
  153. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-state-policy.js +1 -1
  154. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-state.js +15 -9
  155. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-step-policy.js +2 -1
  156. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-work-summary.js +6 -4
  157. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/shared-value.js +7 -0
  158. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/shared.js +5 -254
  159. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/tp-planning.js +3 -2
  160. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/ur-readiness.js +7 -2
  161. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/verified-change.js +11 -9
  162. package/{runtime/core/lib/control-evaluation/backlog-vocabulary.js → generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/work-vocabulary.js} +2 -2
  163. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/artifact-readiness.js +5 -3
  164. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/authoring-inputs.js +110 -0
  165. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-archive.js +53 -0
  166. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-context.js +2 -1
  167. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-contract.js +11 -4
  168. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-list.d.ts +10 -6
  169. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-list.js +32 -41
  170. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-session.js +8 -8
  171. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-work.js +33 -0
  172. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit.js +75 -44
  173. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/contract.js +124 -32
  174. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/decision-session.js +53 -11
  175. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/doctor-observation.js +91 -0
  176. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/project-operation-call.js +5 -0
  177. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/project-state.js +48 -0
  178. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/result.js +61 -0
  179. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/selection.js +9 -3
  180. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/service.js +119 -67
  181. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/compatibility.js +42 -132
  182. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/contract.js +5 -5
  183. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/presentation.js +27 -119
  184. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/service.js +9 -37
  185. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-read/cockpit-pool.js +25 -9
  186. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-read/cockpit-worker.js +4 -3
  187. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-read/doctor-reader.js +92 -0
  188. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-read/doctor-worker.js +11 -0
  189. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-read/fs.js +18 -0
  190. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-read/snapshot.js +68 -17
  191. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/aggregate.js +3 -1
  192. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/approval-command.js +13 -10
  193. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/approval-operations.js +10 -7
  194. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/artefact-binding-proof.js +12 -20
  195. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/artefact-bindings.js +10 -7
  196. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/canonical-initialization.js +761 -0
  197. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/control-layout.js +183 -0
  198. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/decision-action-contract.js +10 -1
  199. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/decision-action-service.js +24 -3
  200. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/decision-material-contract.js +2 -1
  201. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/evidence-bindings.js +7 -7
  202. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/git-identity.js +86 -0
  203. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/index.js +0 -1
  204. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/input-resolution.js +99 -0
  205. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-entry.js +273 -0
  206. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-handoff.js +174 -0
  207. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-inventory.js +90 -0
  208. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-origin-reader.js +48 -0
  209. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-origin.js +40 -0
  210. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/presentation-decision.js +12 -7
  211. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/presentation-delivery.js +90 -0
  212. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/preview-render.js +5 -2
  213. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/preview-review.js +3 -2
  214. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/preview-snapshot.js +9 -6
  215. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/recording-formats.js +12 -16
  216. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-artefact-recording.js +54 -66
  217. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-closure.js +343 -0
  218. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-contract.js +33 -250
  219. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-schema.js +508 -0
  220. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-service.js +198 -34
  221. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-create-command.js +60 -0
  222. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-identity.d.ts +14 -0
  223. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-identity.js +40 -0
  224. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-input-resolution.js +72 -0
  225. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-inventory-reader.js +31 -0
  226. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-inventory.js +179 -0
  227. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-material.js +211 -0
  228. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-mutation.js +51 -0
  229. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operation-identity.js +2 -1
  230. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operation-proof.js +7 -4
  231. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operation-status.js +20 -4
  232. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operations.js +70 -13
  233. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-owned-outputs.js +21 -9
  234. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation-envelope.js +25 -33
  235. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation-render.js +8 -7
  236. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation.js +45 -21
  237. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-recording.js +10 -179
  238. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision-boundary.js +7 -21
  239. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision-history.js +23 -16
  240. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision.js +84 -161
  241. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-seal-compute.js +19 -44
  242. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-seal.js +6 -1
  243. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-source-revisions.js +19 -18
  244. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-document.js +110 -42
  245. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-edits.js +13 -5
  246. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-parser.js +14 -6
  247. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-reader.js +27 -18
  248. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-repository.js +112 -48
  249. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-resolver.js +12 -15
  250. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-writer.js +21 -377
  251. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-step-pending.js +2 -1
  252. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-step-transaction.js +125 -114
  253. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-steps.js +136 -248
  254. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-store-inspection.js +14 -2
  255. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-verified-change.js +81 -0
  256. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-work-summary-shape.d.ts +1 -0
  257. package/{runtime/core/lib/control-state/backlog-summary-shape.js → generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-work-summary-shape.js} +7 -19
  258. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/delivery-continuation/service.js +5 -66
  259. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/delivery-path-search/persistence.js +26 -8
  260. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/delivery-path-search/state-adapter.js +1 -1
  261. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/index.js +14 -6
  262. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/interaction-catalog.js +3 -3
  263. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/interaction-presentation.js +29 -11
  264. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-hints.js +46 -0
  265. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-resolution.js +98 -0
  266. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-schema.js +15 -0
  267. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/mcp-resource-contract.js +1 -1
  268. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/mcp-tool-errors.js +31 -15
  269. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/owned-file-lock.js +266 -0
  270. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/owner-placement.js +50 -0
  271. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/resources/canonical-init-plan.js +34 -0
  272. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/resources/configuration.js +92 -0
  273. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/resources/context.js +7 -11
  274. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/resources/language-preference.js +59 -0
  275. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/runtime/mcp-owner-protocol.js +102 -0
  276. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/runtime/plugin-provenance.js +173 -18
  277. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/compact-continuation.js +3 -3
  278. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/contract.js +28 -9
  279. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/delivery-intake.js +11 -5
  280. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/delivery-run-assignment.js +6 -10
  281. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/mcp-continuation.js +64 -0
  282. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/prd-definition.js +14 -5
  283. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/sd-definition.js +2 -1
  284. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/service.js +49 -14
  285. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/tp-definition.js +2 -1
  286. package/generated/plugins/agdf/runtime/runtime-manifest.json +2 -2
  287. package/generated/plugins/agdf/scripts/check-runtime-integrity.mjs +60 -42
  288. package/generated/plugins/agdf/scripts/instruction-footprint.mjs +5 -5
  289. package/generated/plugins/agdf/skills/brownfield-analysis/SKILL.md +8 -5
  290. package/generated/plugins/agdf/skills/clean-implementation-review/SKILL.md +3 -2
  291. package/generated/plugins/agdf/skills/code-review/SKILL.md +5 -3
  292. package/generated/plugins/agdf/skills/delivery-closeout/SKILL.md +3 -2
  293. package/generated/plugins/agdf/skills/delivery-path-search/SKILL.md +3 -2
  294. package/generated/plugins/agdf/skills/gate-check/SKILL.md +35 -31
  295. package/generated/plugins/agdf/skills/prd-definition/SKILL.md +3 -2
  296. package/generated/plugins/agdf/skills/qa-gate/SKILL.md +3 -2
  297. package/generated/plugins/agdf/skills/release-or/SKILL.md +8 -5
  298. package/generated/plugins/agdf/skills/sd-definition/SKILL.md +3 -2
  299. package/generated/plugins/agdf/skills/task-plan-review/SKILL.md +3 -2
  300. package/generated/plugins/agdf/skills/tp-definition/SKILL.md +3 -2
  301. package/generated/plugins/agdf/skills/ur-definition/SKILL.md +12 -4
  302. package/generated/plugins/agdf/skills/ux-intent-definition/SKILL.md +5 -4
  303. package/generated/plugins/agdf/submission/openai/availability.md +1 -1
  304. package/generated/plugins/agdf/submission/openai/capability-matrix.json +1 -1
  305. package/generated/plugins/agdf/submission/openai/release-notes.md +9 -1
  306. package/generated/plugins/agdf/submission/openai/reviewer-cases.json +1 -1
  307. package/generated/plugins/agdf-planning/.codex-plugin/plugin.json +40 -0
  308. package/generated/plugins/agdf-planning/README.md +21 -0
  309. package/generated/plugins/agdf-planning/assets/agdf-icon.svg +16 -0
  310. package/generated/plugins/agdf-planning/assets/agdf-logo.svg +16 -0
  311. package/generated/plugins/agdf-planning/meta/agdf-planning.definition.json +9 -0
  312. package/generated/plugins/agdf-planning/plugin.json +45 -0
  313. package/generated/plugins/agdf-planning/skills/planning/SKILL.md +56 -0
  314. package/generated/plugins/copilot/agdf/.agdf-payload-inventory.json +878 -475
  315. package/generated/plugins/copilot/agdf/control/README.md +31 -110
  316. package/generated/plugins/copilot/agdf/control/planned-urs.md +95 -0
  317. package/generated/plugins/copilot/agdf/control/templates/RUN_STATE.md +15 -64
  318. package/generated/plugins/copilot/agdf/control/templates/artefacts/UR.md +1 -1
  319. package/generated/plugins/copilot/agdf/mcp/server/README.md +119 -7
  320. package/generated/plugins/copilot/agdf/mcp/server/package.json +12 -7
  321. package/generated/plugins/copilot/agdf/mcp/server/src/generation-entry.js +3 -85
  322. package/generated/plugins/copilot/agdf/mcp/server/src/generation-protocol.js +2 -44
  323. package/generated/plugins/copilot/agdf/mcp/server/src/generation-runtime.js +94 -0
  324. package/generated/plugins/copilot/agdf/mcp/server/src/generation-thread-entry.js +8 -0
  325. package/generated/plugins/copilot/agdf/mcp/server/src/generation.js +64 -20
  326. package/generated/plugins/copilot/agdf/mcp/server/src/main.js +42 -10
  327. package/generated/plugins/copilot/agdf/mcp/server/src/server.js +24 -15
  328. package/generated/plugins/copilot/agdf/mcp/server/src/stdio-output.js +42 -0
  329. package/generated/plugins/copilot/agdf/mcp/server/src/worker-entry.js +2 -2
  330. package/generated/plugins/copilot/agdf/mcp/server/src/worker.js +53 -7
  331. package/generated/plugins/copilot/agdf/meta/agdf-agent-router.md +3 -3
  332. package/generated/plugins/copilot/agdf/meta/agdf-plugin.definition.json +8 -3
  333. package/generated/plugins/copilot/agdf/meta/distribution-profile-history.json +7 -0
  334. package/generated/plugins/copilot/agdf/plugin.json +1 -1
  335. package/generated/plugins/copilot/agdf/runtime/agdf-session-check.js +25 -21
  336. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-defaults.json +9 -0
  337. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-defaults.schema.json +20 -0
  338. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-interaction-locales.json +2668 -2682
  339. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-plugin.definition.json +8 -3
  340. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/closeout.md +1 -1
  341. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/control-scaffold.md +63 -46
  342. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/gate-artifact-preparation.md +58 -48
  343. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/gate-transition.md +5 -6
  344. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/interaction.md +43 -126
  345. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/modes.md +4 -3
  346. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/prd-definition.md +6 -6
  347. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/quality.md +10 -2
  348. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/request-activation.md +9 -8
  349. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/sd-definition.md +3 -3
  350. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/task-target-resolution.md +24 -0
  351. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/tp-definition.md +1 -1
  352. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/ur-definition.md +41 -7
  353. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/codex-document-command.js +195 -0
  354. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/command-registry.js +82 -148
  355. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/control-maintenance-command.js +8 -37
  356. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/parse-args.js +98 -16
  357. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/planned-command.js +55 -0
  358. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/project-read-command.js +35 -0
  359. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/run-command-aliases.js +116 -0
  360. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/runtime-context.js +1 -59
  361. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/validation-handlers.js +33 -103
  362. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/control-evaluation/git-observation.js +7 -5
  363. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/control-maintenance/startup.js +2 -2
  364. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-decision-protocol.js +40 -0
  365. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-dispatch-runtime.js +71 -306
  366. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-entry.js +3 -24
  367. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-owner-entry.js +31 -15
  368. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-runtime.js +29 -0
  369. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-thread-entry.js +11 -0
  370. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/owner-client.js +79 -0
  371. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/package.js +14 -80
  372. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/plugin-runtime.js +29 -9
  373. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/thread-owner.js +164 -0
  374. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-owner-protocol.js +1 -0
  375. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-protocol-runtime.js +308 -0
  376. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-worker-runtime.js +152 -0
  377. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/runtime/control-command-service.js +22 -7
  378. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/runtime/control-context.js +8 -1
  379. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/runtime/validator-application.js +2 -2
  380. package/generated/plugins/copilot/agdf/runtime/create-agdf/package.json +5 -1
  381. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/closeout-readiness.js +10 -2
  382. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/decision-content-placeholder.js +9 -0
  383. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/decision-content-readiness.js +2 -7
  384. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/definition-sources.js +3 -2
  385. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/delivery-map.js +2 -12
  386. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/doctor.js +162 -172
  387. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-check.js +10 -9
  388. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy-inputs.js +11 -0
  389. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy-pure.js +446 -0
  390. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy.js +3 -434
  391. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/next-action.js +2 -0
  392. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/parent-reconciliation.js +2 -1
  393. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/qa-follow-up.js +2 -1
  394. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/required-files.js +9 -7
  395. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-state-policy.js +1 -1
  396. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-state.js +15 -9
  397. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-step-policy.js +2 -1
  398. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-work-summary.js +6 -4
  399. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/shared-value.js +7 -0
  400. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/shared.js +5 -254
  401. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/tp-planning.js +3 -2
  402. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/ur-readiness.js +7 -2
  403. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/verified-change.js +11 -9
  404. package/generated/plugins/{agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/backlog-vocabulary.js → copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/work-vocabulary.js} +2 -2
  405. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/artifact-readiness.js +5 -3
  406. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/authoring-inputs.js +110 -0
  407. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-archive.js +53 -0
  408. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/contract.js +124 -32
  409. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/doctor-observation.js +91 -0
  410. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/project-operation-call.js +5 -0
  411. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/project-state.js +48 -0
  412. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/result.js +61 -0
  413. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/selection.js +9 -3
  414. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/service.js +119 -67
  415. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/compatibility.js +42 -132
  416. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/contract.js +5 -5
  417. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/presentation.js +27 -119
  418. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/service.js +9 -37
  419. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-read/cockpit-pool.js +121 -0
  420. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-read/doctor-reader.js +92 -0
  421. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-read/doctor-worker.js +11 -0
  422. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-read/fs.js +18 -0
  423. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-read/snapshot.js +68 -17
  424. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/aggregate.js +3 -1
  425. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/approval-command.js +13 -10
  426. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/approval-operations.js +10 -7
  427. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/artefact-binding-proof.js +12 -20
  428. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/artefact-bindings.js +10 -7
  429. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/canonical-initialization.js +761 -0
  430. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/control-layout.js +183 -0
  431. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/decision-material-contract.js +2 -1
  432. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/evidence-bindings.js +7 -7
  433. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/git-identity.js +86 -0
  434. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/index.js +0 -1
  435. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/input-resolution.js +99 -0
  436. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-entry.js +273 -0
  437. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-handoff.js +174 -0
  438. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-inventory.js +90 -0
  439. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-origin-reader.js +48 -0
  440. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-origin.js +40 -0
  441. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/presentation-decision.js +12 -7
  442. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/presentation-delivery.js +90 -0
  443. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/preview-render.js +5 -2
  444. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/preview-review.js +3 -2
  445. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/preview-snapshot.js +9 -6
  446. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/recording-formats.js +12 -16
  447. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-artefact-recording.js +54 -66
  448. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-closure.js +343 -0
  449. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-contract.js +33 -250
  450. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-schema.js +508 -0
  451. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-service.js +198 -34
  452. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-create-command.js +60 -0
  453. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-identity.d.ts +14 -0
  454. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-identity.js +40 -0
  455. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-input-resolution.js +72 -0
  456. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-inventory-reader.js +31 -0
  457. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-inventory.js +179 -0
  458. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-material.js +211 -0
  459. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-mutation.js +51 -0
  460. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operation-identity.js +2 -1
  461. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operation-proof.js +7 -4
  462. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operation-status.js +20 -4
  463. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operations.js +70 -13
  464. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-owned-outputs.js +21 -9
  465. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation-envelope.js +25 -33
  466. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation-render.js +8 -7
  467. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation.js +45 -21
  468. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-recording.js +10 -179
  469. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision-boundary.js +7 -21
  470. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision-history.js +23 -16
  471. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision.js +84 -161
  472. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-seal-compute.js +19 -44
  473. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-seal.js +6 -1
  474. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-source-revisions.js +19 -18
  475. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-document.js +110 -42
  476. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-edits.js +13 -5
  477. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-parser.js +14 -6
  478. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-reader.js +27 -18
  479. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-repository.js +112 -48
  480. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-resolver.js +12 -15
  481. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-writer.js +21 -377
  482. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-step-pending.js +2 -1
  483. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-step-transaction.js +125 -114
  484. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-steps.js +136 -248
  485. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-store-inspection.js +14 -2
  486. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-verified-change.js +81 -0
  487. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-work-summary-shape.d.ts +1 -0
  488. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/{backlog-summary-shape.js → run-work-summary-shape.js} +7 -19
  489. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/delivery-continuation/service.js +5 -66
  490. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/delivery-path-search/persistence.js +26 -8
  491. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/delivery-path-search/state-adapter.js +1 -1
  492. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/index.js +14 -6
  493. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/interaction-catalog.js +3 -3
  494. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/interaction-presentation.js +29 -11
  495. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-hints.js +46 -0
  496. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-resolution.js +98 -0
  497. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-schema.js +15 -0
  498. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/mcp-resource-contract.js +1 -1
  499. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/mcp-tool-errors.js +31 -15
  500. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/owned-file-lock.js +266 -0
  501. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/owner-placement.js +50 -0
  502. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/resources/canonical-init-plan.js +34 -0
  503. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/resources/configuration.js +92 -0
  504. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/resources/context.js +7 -11
  505. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/resources/language-preference.js +59 -0
  506. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/runtime/mcp-owner-protocol.js +102 -0
  507. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/runtime/plugin-provenance.js +173 -18
  508. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/compact-continuation.js +3 -3
  509. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/contract.js +28 -9
  510. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/delivery-intake.js +11 -5
  511. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/delivery-run-assignment.js +6 -10
  512. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/mcp-continuation.js +64 -0
  513. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/prd-definition.js +14 -5
  514. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/sd-definition.js +2 -1
  515. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/service.js +49 -14
  516. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/tp-definition.js +2 -1
  517. package/generated/plugins/copilot/agdf/runtime/runtime-manifest.json +2 -2
  518. package/generated/plugins/copilot/agdf/skills/agdf-brownfield-analysis/SKILL.md +8 -5
  519. package/generated/plugins/copilot/agdf/skills/agdf-clean-implementation-review/SKILL.md +3 -2
  520. package/generated/plugins/copilot/agdf/skills/agdf-code-review/SKILL.md +5 -3
  521. package/generated/plugins/copilot/agdf/skills/agdf-delivery-closeout/SKILL.md +3 -2
  522. package/generated/plugins/copilot/agdf/skills/agdf-delivery-path-search/SKILL.md +3 -2
  523. package/generated/plugins/copilot/agdf/skills/agdf-gate-check/SKILL.md +35 -31
  524. package/generated/plugins/copilot/agdf/skills/agdf-interaction-locales.json +1 -1
  525. package/generated/plugins/copilot/agdf/skills/agdf-prd-definition/SKILL.md +3 -2
  526. package/generated/plugins/copilot/agdf/skills/agdf-qa-gate/SKILL.md +3 -2
  527. package/generated/plugins/copilot/agdf/skills/agdf-release-or/SKILL.md +8 -5
  528. package/generated/plugins/copilot/agdf/skills/agdf-sd-definition/SKILL.md +3 -2
  529. package/generated/plugins/copilot/agdf/skills/agdf-task-plan-review/SKILL.md +3 -2
  530. package/generated/plugins/copilot/agdf/skills/agdf-tp-definition/SKILL.md +3 -2
  531. package/generated/plugins/copilot/agdf/skills/agdf-ur-definition/SKILL.md +12 -4
  532. package/generated/plugins/copilot/agdf/skills/agdf-ux-intent-definition/SKILL.md +5 -4
  533. package/generated/plugins/copilot/agdf/skills/contracts/closeout.md +1 -1
  534. package/generated/plugins/copilot/agdf/skills/contracts/control-scaffold.md +63 -46
  535. package/generated/plugins/copilot/agdf/skills/contracts/gate-artifact-preparation.md +58 -48
  536. package/generated/plugins/copilot/agdf/skills/contracts/gate-transition.md +5 -6
  537. package/generated/plugins/copilot/agdf/skills/contracts/interaction.md +43 -126
  538. package/generated/plugins/copilot/agdf/skills/contracts/modes.md +4 -3
  539. package/generated/plugins/copilot/agdf/skills/contracts/prd-definition.md +6 -6
  540. package/generated/plugins/copilot/agdf/skills/contracts/quality.md +10 -2
  541. package/generated/plugins/copilot/agdf/skills/contracts/request-activation.md +9 -8
  542. package/generated/plugins/copilot/agdf/skills/contracts/sd-definition.md +3 -3
  543. package/generated/plugins/copilot/agdf/skills/contracts/task-target-resolution.md +24 -0
  544. package/generated/plugins/copilot/agdf/skills/contracts/tp-definition.md +1 -1
  545. package/generated/plugins/copilot/agdf/skills/contracts/ur-definition.md +41 -7
  546. package/generated/submissions/openai/agdf/.codex-plugin/plugin.json +1 -1
  547. package/generated/submissions/openai/agdf/meta/agdf-agent-router.md +3 -3
  548. package/generated/submissions/openai/agdf/meta/agdf-defaults.json +9 -0
  549. package/generated/submissions/openai/agdf/meta/agdf-defaults.schema.json +20 -0
  550. package/generated/submissions/openai/agdf/meta/agdf-interaction-locales.json +2668 -2682
  551. package/generated/submissions/openai/agdf/meta/agdf-plugin.definition.json +8 -3
  552. package/generated/submissions/openai/agdf/meta/contracts/closeout.md +1 -1
  553. package/generated/submissions/openai/agdf/meta/contracts/control-scaffold.md +63 -46
  554. package/generated/submissions/openai/agdf/meta/contracts/gate-artifact-preparation.md +58 -48
  555. package/generated/submissions/openai/agdf/meta/contracts/gate-transition.md +5 -6
  556. package/generated/submissions/openai/agdf/meta/contracts/interaction.md +43 -126
  557. package/generated/submissions/openai/agdf/meta/contracts/modes.md +4 -3
  558. package/generated/submissions/openai/agdf/meta/contracts/prd-definition.md +6 -6
  559. package/generated/submissions/openai/agdf/meta/contracts/quality.md +10 -2
  560. package/generated/submissions/openai/agdf/meta/contracts/request-activation.md +9 -8
  561. package/generated/submissions/openai/agdf/meta/contracts/sd-definition.md +3 -3
  562. package/generated/submissions/openai/agdf/meta/contracts/task-target-resolution.md +24 -0
  563. package/generated/submissions/openai/agdf/meta/contracts/tp-definition.md +1 -1
  564. package/generated/submissions/openai/agdf/meta/contracts/ur-definition.md +41 -7
  565. package/generated/submissions/openai/agdf/meta/copilot-payload-baseline.json +3 -3
  566. package/generated/submissions/openai/agdf/meta/distribution-profile-history.json +7 -0
  567. package/generated/submissions/openai/agdf/plugin.json +1 -1
  568. package/generated/submissions/openai/agdf/skills/brownfield-analysis/SKILL.md +8 -5
  569. package/generated/submissions/openai/agdf/skills/clean-implementation-review/SKILL.md +3 -2
  570. package/generated/submissions/openai/agdf/skills/code-review/SKILL.md +5 -3
  571. package/generated/submissions/openai/agdf/skills/delivery-closeout/SKILL.md +3 -2
  572. package/generated/submissions/openai/agdf/skills/delivery-path-search/SKILL.md +3 -2
  573. package/generated/submissions/openai/agdf/skills/gate-check/SKILL.md +35 -31
  574. package/generated/submissions/openai/agdf/skills/prd-definition/SKILL.md +3 -2
  575. package/generated/submissions/openai/agdf/skills/qa-gate/SKILL.md +3 -2
  576. package/generated/submissions/openai/agdf/skills/release-or/SKILL.md +8 -5
  577. package/generated/submissions/openai/agdf/skills/sd-definition/SKILL.md +3 -2
  578. package/generated/submissions/openai/agdf/skills/task-plan-review/SKILL.md +3 -2
  579. package/generated/submissions/openai/agdf/skills/tp-definition/SKILL.md +3 -2
  580. package/generated/submissions/openai/agdf/skills/ur-definition/SKILL.md +12 -4
  581. package/generated/submissions/openai/agdf/skills/ux-intent-definition/SKILL.md +5 -4
  582. package/generated/submissions/openai/agdf/submission/openai/availability.md +1 -1
  583. package/generated/submissions/openai/agdf/submission/openai/capability-matrix.json +1 -1
  584. package/generated/submissions/openai/agdf/submission/openai/inventory.json +49 -41
  585. package/generated/submissions/openai/agdf/submission/openai/listing.json +1 -1
  586. package/generated/submissions/openai/agdf/submission/openai/readiness.json +2 -2
  587. package/generated/submissions/openai/agdf/submission/openai/readiness.md +2 -2
  588. package/generated/submissions/openai/agdf/submission/openai/release-notes.md +9 -1
  589. package/generated/submissions/openai/agdf/submission/openai/reviewer-cases.json +1 -1
  590. package/lib/cli/application.js +31 -43
  591. package/lib/cli/codex-document-command.js +195 -0
  592. package/lib/cli/command-registry.js +82 -148
  593. package/lib/cli/control-maintenance-command.js +8 -37
  594. package/lib/cli/parse-args.js +98 -16
  595. package/lib/cli/planned-command.js +55 -0
  596. package/lib/cli/project-init-command.js +21 -0
  597. package/lib/cli/project-read-command.js +35 -0
  598. package/lib/cli/run-command-aliases.js +116 -0
  599. package/lib/cli/runtime-context.js +1 -59
  600. package/lib/cli/validation-handlers.js +33 -103
  601. package/lib/control-evaluation/git-observation.js +7 -5
  602. package/lib/control-maintenance/startup.js +2 -2
  603. package/lib/host-adapters/codex/plugin.js +48 -1
  604. package/lib/install-setup/contract.js +4 -4
  605. package/lib/install-setup/{control-migration.js → control-compatibility.js} +1 -2
  606. package/lib/install-setup/interaction.js +0 -1
  607. package/lib/install-setup/presentation.js +3 -4
  608. package/lib/install-setup/service.js +5 -18
  609. package/lib/installers/local-marketplace.js +262 -8
  610. package/lib/lifecycle/codex-startup-status.js +29 -0
  611. package/lib/lifecycle/presentation.js +6 -0
  612. package/lib/mcp-decision-protocol.js +40 -0
  613. package/lib/mcp-dispatch-runtime.js +71 -306
  614. package/lib/mcp-lifecycle/adapters/codex-origin-probe.js +28 -4
  615. package/lib/mcp-lifecycle/evidence.js +2 -1
  616. package/lib/mcp-lifecycle/facade-entry.js +3 -24
  617. package/lib/mcp-lifecycle/facade-owner-entry.js +31 -15
  618. package/lib/mcp-lifecycle/facade-runtime.js +29 -0
  619. package/lib/mcp-lifecycle/facade-thread-entry.js +11 -0
  620. package/lib/mcp-lifecycle/owner-client.js +79 -0
  621. package/lib/mcp-lifecycle/package.js +14 -80
  622. package/lib/mcp-lifecycle/plugin-runtime.js +29 -9
  623. package/lib/mcp-lifecycle/service.js +5 -4
  624. package/lib/mcp-lifecycle/thread-owner.js +164 -0
  625. package/lib/mcp-owner-protocol.js +1 -0
  626. package/lib/mcp-protocol-runtime.js +308 -0
  627. package/lib/mcp-worker-runtime.js +152 -0
  628. package/lib/runtime/control-command-service.js +22 -7
  629. package/lib/runtime/control-context.js +8 -1
  630. package/lib/runtime/validator-application.js +2 -2
  631. package/lib/scaffold/canonical-init.js +2 -691
  632. package/lib/scaffold/plan.js +9 -32
  633. package/lib/scaffold/presentation.js +2 -2
  634. package/lib/scaffold/write.js +6 -1
  635. package/package.json +6 -2
  636. package/runtime/core/lib/control-evaluation/closeout-readiness.js +10 -2
  637. package/runtime/core/lib/control-evaluation/decision-content-placeholder.js +9 -0
  638. package/runtime/core/lib/control-evaluation/decision-content-readiness.js +2 -7
  639. package/runtime/core/lib/control-evaluation/definition-sources.js +3 -2
  640. package/runtime/core/lib/control-evaluation/delivery-map.js +2 -12
  641. package/runtime/core/lib/control-evaluation/doctor.js +162 -172
  642. package/runtime/core/lib/control-evaluation/gate-check.js +10 -9
  643. package/runtime/core/lib/control-evaluation/gate-policy-inputs.js +11 -0
  644. package/runtime/core/lib/control-evaluation/gate-policy-pure.js +446 -0
  645. package/runtime/core/lib/control-evaluation/gate-policy.js +3 -434
  646. package/runtime/core/lib/control-evaluation/next-action.js +2 -0
  647. package/runtime/core/lib/control-evaluation/parent-reconciliation.js +2 -1
  648. package/runtime/core/lib/control-evaluation/qa-follow-up.js +2 -1
  649. package/runtime/core/lib/control-evaluation/required-files.js +9 -7
  650. package/runtime/core/lib/control-evaluation/run-state-policy.js +1 -1
  651. package/runtime/core/lib/control-evaluation/run-state.js +15 -9
  652. package/runtime/core/lib/control-evaluation/run-step-policy.js +2 -1
  653. package/runtime/core/lib/control-evaluation/run-work-summary.js +6 -4
  654. package/runtime/core/lib/control-evaluation/shared-value.js +7 -0
  655. package/runtime/core/lib/control-evaluation/shared.js +5 -254
  656. package/runtime/core/lib/control-evaluation/tp-planning.js +3 -2
  657. package/runtime/core/lib/control-evaluation/ur-readiness.js +7 -2
  658. package/runtime/core/lib/control-evaluation/verified-change.js +11 -9
  659. package/{generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/backlog-vocabulary.js → runtime/core/lib/control-evaluation/work-vocabulary.js} +2 -2
  660. package/runtime/core/lib/control-inspect/artifact-readiness.js +5 -3
  661. package/runtime/core/lib/control-inspect/authoring-inputs.js +110 -0
  662. package/runtime/core/lib/control-inspect/cockpit-archive.js +53 -0
  663. package/runtime/core/lib/control-inspect/cockpit-context.js +2 -1
  664. package/runtime/core/lib/control-inspect/cockpit-contract.js +11 -4
  665. package/runtime/core/lib/control-inspect/cockpit-list.d.ts +10 -6
  666. package/runtime/core/lib/control-inspect/cockpit-list.js +32 -41
  667. package/runtime/core/lib/control-inspect/cockpit-session.js +8 -8
  668. package/runtime/core/lib/control-inspect/cockpit-work.js +33 -0
  669. package/runtime/core/lib/control-inspect/cockpit.js +75 -44
  670. package/runtime/core/lib/control-inspect/contract.js +124 -32
  671. package/runtime/core/lib/control-inspect/decision-session.js +53 -11
  672. package/runtime/core/lib/control-inspect/doctor-observation.js +91 -0
  673. package/runtime/core/lib/control-inspect/project-operation-call.js +5 -0
  674. package/runtime/core/lib/control-inspect/project-state.js +48 -0
  675. package/runtime/core/lib/control-inspect/result.js +61 -0
  676. package/runtime/core/lib/control-inspect/selection.js +9 -3
  677. package/runtime/core/lib/control-inspect/service.js +119 -67
  678. package/runtime/core/lib/control-maintenance/compatibility.js +42 -132
  679. package/runtime/core/lib/control-maintenance/contract.js +5 -5
  680. package/runtime/core/lib/control-maintenance/presentation.js +27 -119
  681. package/runtime/core/lib/control-maintenance/service.js +9 -37
  682. package/runtime/core/lib/control-read/cockpit-pool.js +25 -9
  683. package/runtime/core/lib/control-read/cockpit-worker.js +4 -3
  684. package/runtime/core/lib/control-read/doctor-reader.js +92 -0
  685. package/runtime/core/lib/control-read/doctor-worker.js +11 -0
  686. package/runtime/core/lib/control-read/fs.js +18 -0
  687. package/runtime/core/lib/control-read/snapshot.js +68 -17
  688. package/runtime/core/lib/control-state/aggregate.js +3 -1
  689. package/runtime/core/lib/control-state/approval-command.js +13 -10
  690. package/runtime/core/lib/control-state/approval-operations.js +10 -7
  691. package/runtime/core/lib/control-state/artefact-binding-proof.js +12 -20
  692. package/runtime/core/lib/control-state/artefact-bindings.js +10 -7
  693. package/runtime/core/lib/control-state/canonical-initialization.js +761 -0
  694. package/runtime/core/lib/control-state/control-layout.js +183 -0
  695. package/runtime/core/lib/control-state/decision-action-contract.js +10 -1
  696. package/runtime/core/lib/control-state/decision-action-service.js +24 -3
  697. package/runtime/core/lib/control-state/decision-material-contract.js +2 -1
  698. package/runtime/core/lib/control-state/evidence-bindings.js +7 -7
  699. package/runtime/core/lib/control-state/git-identity.js +86 -0
  700. package/runtime/core/lib/control-state/index.js +0 -1
  701. package/runtime/core/lib/control-state/input-resolution.js +99 -0
  702. package/runtime/core/lib/control-state/planned-entry.js +273 -0
  703. package/runtime/core/lib/control-state/planned-handoff.js +174 -0
  704. package/runtime/core/lib/control-state/planned-inventory.js +90 -0
  705. package/runtime/core/lib/control-state/planned-origin-reader.js +48 -0
  706. package/runtime/core/lib/control-state/planned-origin.js +40 -0
  707. package/runtime/core/lib/control-state/presentation-decision.js +12 -7
  708. package/runtime/core/lib/control-state/presentation-delivery.js +90 -0
  709. package/runtime/core/lib/control-state/preview-render.js +5 -2
  710. package/runtime/core/lib/control-state/preview-review.js +3 -2
  711. package/runtime/core/lib/control-state/preview-snapshot.js +9 -6
  712. package/runtime/core/lib/control-state/recording-formats.js +12 -16
  713. package/runtime/core/lib/control-state/run-artefact-recording.js +54 -66
  714. package/runtime/core/lib/control-state/run-closure.js +343 -0
  715. package/runtime/core/lib/control-state/run-command-contract.js +33 -250
  716. package/runtime/core/lib/control-state/run-command-schema.js +508 -0
  717. package/runtime/core/lib/control-state/run-command-service.js +198 -34
  718. package/runtime/core/lib/control-state/run-create-command.js +60 -0
  719. package/runtime/core/lib/control-state/run-identity.d.ts +14 -0
  720. package/runtime/core/lib/control-state/run-identity.js +40 -0
  721. package/runtime/core/lib/control-state/run-input-resolution.js +72 -0
  722. package/runtime/core/lib/control-state/run-inventory-reader.js +31 -0
  723. package/runtime/core/lib/control-state/run-inventory.js +179 -0
  724. package/runtime/core/lib/control-state/run-material.js +211 -0
  725. package/runtime/core/lib/control-state/run-mutation.js +51 -0
  726. package/runtime/core/lib/control-state/run-operation-identity.js +2 -1
  727. package/runtime/core/lib/control-state/run-operation-proof.js +7 -4
  728. package/runtime/core/lib/control-state/run-operation-status.js +20 -4
  729. package/runtime/core/lib/control-state/run-operations.js +70 -13
  730. package/runtime/core/lib/control-state/run-owned-outputs.js +21 -9
  731. package/runtime/core/lib/control-state/run-presentation-envelope.js +25 -33
  732. package/runtime/core/lib/control-state/run-presentation-render.js +8 -7
  733. package/runtime/core/lib/control-state/run-presentation.js +45 -21
  734. package/runtime/core/lib/control-state/run-recording.js +10 -179
  735. package/runtime/core/lib/control-state/run-revision-boundary.js +7 -21
  736. package/runtime/core/lib/control-state/run-revision-history.js +23 -16
  737. package/runtime/core/lib/control-state/run-revision.js +84 -161
  738. package/runtime/core/lib/control-state/run-seal-compute.js +19 -44
  739. package/runtime/core/lib/control-state/run-seal.js +6 -1
  740. package/runtime/core/lib/control-state/run-source-revisions.js +19 -18
  741. package/runtime/core/lib/control-state/run-state-document.js +110 -42
  742. package/runtime/core/lib/control-state/run-state-edits.js +13 -5
  743. package/runtime/core/lib/control-state/run-state-parser.js +14 -6
  744. package/runtime/core/lib/control-state/run-state-reader.js +27 -18
  745. package/runtime/core/lib/control-state/run-state-repository.js +112 -48
  746. package/runtime/core/lib/control-state/run-state-resolver.js +12 -15
  747. package/runtime/core/lib/control-state/run-state-writer.js +21 -377
  748. package/runtime/core/lib/control-state/run-step-pending.js +2 -1
  749. package/runtime/core/lib/control-state/run-step-transaction.js +125 -114
  750. package/runtime/core/lib/control-state/run-steps.js +136 -248
  751. package/runtime/core/lib/control-state/run-store-inspection.js +14 -2
  752. package/runtime/core/lib/control-state/run-verified-change.js +81 -0
  753. package/runtime/core/lib/control-state/run-work-summary-shape.d.ts +1 -0
  754. package/{generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/backlog-summary-shape.js → runtime/core/lib/control-state/run-work-summary-shape.js} +7 -19
  755. package/runtime/core/lib/delivery-continuation/service.js +5 -66
  756. package/runtime/core/lib/delivery-path-search/persistence.js +26 -8
  757. package/runtime/core/lib/delivery-path-search/state-adapter.js +1 -1
  758. package/runtime/core/lib/index.js +14 -6
  759. package/runtime/core/lib/interaction-catalog.js +3 -3
  760. package/runtime/core/lib/interaction-presentation.js +29 -11
  761. package/runtime/core/lib/mcp-input-hints.js +46 -0
  762. package/runtime/core/lib/mcp-input-resolution.js +98 -0
  763. package/runtime/core/lib/mcp-input-schema.js +15 -0
  764. package/runtime/core/lib/mcp-resource-contract.js +1 -1
  765. package/runtime/core/lib/mcp-tool-errors.js +31 -15
  766. package/runtime/core/lib/owned-file-lock.js +266 -0
  767. package/runtime/core/lib/owner-placement.js +50 -0
  768. package/runtime/core/lib/resources/canonical-init-plan.js +34 -0
  769. package/runtime/core/lib/resources/configuration.js +92 -0
  770. package/runtime/core/lib/resources/context.js +7 -11
  771. package/runtime/core/lib/resources/language-preference.js +59 -0
  772. package/runtime/core/lib/runtime/mcp-owner-protocol.js +102 -0
  773. package/runtime/core/lib/runtime/plugin-provenance.js +173 -18
  774. package/runtime/core/lib/skill-dispatch/compact-continuation.js +3 -3
  775. package/runtime/core/lib/skill-dispatch/contract.js +28 -9
  776. package/runtime/core/lib/skill-dispatch/delivery-intake.js +11 -5
  777. package/runtime/core/lib/skill-dispatch/delivery-run-assignment.js +6 -10
  778. package/runtime/core/lib/skill-dispatch/mcp-continuation.js +64 -0
  779. package/runtime/core/lib/skill-dispatch/prd-definition.js +14 -5
  780. package/runtime/core/lib/skill-dispatch/sd-definition.js +2 -1
  781. package/runtime/core/lib/skill-dispatch/service.js +49 -14
  782. package/runtime/core/lib/skill-dispatch/tp-definition.js +2 -1
  783. package/generated/.agdf/control/templates/AGDF_RUN.md +0 -139
  784. package/generated/.agdf/control/templates/MASTER_BACKLOG.md +0 -39
  785. package/generated/plugins/agdf/control/templates/AGDF_RUN.md +0 -139
  786. package/generated/plugins/agdf/control/templates/MASTER_BACKLOG.md +0 -39
  787. package/generated/plugins/agdf/runtime/create-agdf/lib/control-maintenance/interaction.js +0 -28
  788. package/generated/plugins/agdf/runtime/create-agdf/lib/control-maintenance/repair.js +0 -4
  789. package/generated/plugins/agdf/runtime/create-agdf/lib/control-maintenance/service.js +0 -3
  790. package/generated/plugins/agdf/runtime/create-agdf/lib/control-state/run-recovery.js +0 -5
  791. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-backlog.js +0 -135
  792. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/interaction.js +0 -57
  793. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/migration.js +0 -85
  794. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/repair.js +0 -226
  795. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/backlog-summary-shape.d.ts +0 -4
  796. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/backlog-summary.js +0 -67
  797. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/legacy-migration.js +0 -69
  798. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/legacy-projection-reader.js +0 -38
  799. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-backlog-writer.js +0 -80
  800. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-backlog.js +0 -90
  801. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-recovery.js +0 -296
  802. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-relationship-correction.js +0 -74
  803. package/generated/plugins/copilot/agdf/control/templates/AGDF_RUN.md +0 -139
  804. package/generated/plugins/copilot/agdf/control/templates/MASTER_BACKLOG.md +0 -39
  805. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/control-maintenance/interaction.js +0 -28
  806. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/control-maintenance/repair.js +0 -4
  807. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/control-maintenance/service.js +0 -3
  808. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/control-state/run-recovery.js +0 -5
  809. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/interaction.js +0 -57
  810. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/migration.js +0 -85
  811. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/repair.js +0 -226
  812. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/backlog-summary-shape.d.ts +0 -4
  813. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/backlog-summary.js +0 -67
  814. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/legacy-migration.js +0 -69
  815. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/legacy-projection-reader.js +0 -38
  816. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-backlog-writer.js +0 -80
  817. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-backlog.js +0 -90
  818. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-recovery.js +0 -296
  819. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-relationship-correction.js +0 -74
  820. package/lib/control-maintenance/interaction.js +0 -28
  821. package/lib/control-maintenance/repair.js +0 -4
  822. package/lib/control-maintenance/service.js +0 -3
  823. package/lib/control-state/run-recovery.js +0 -5
  824. package/lib/install-setup/control-repair.js +0 -1
  825. package/runtime/core/lib/control-inspect/cockpit-backlog.js +0 -135
  826. package/runtime/core/lib/control-maintenance/interaction.js +0 -57
  827. package/runtime/core/lib/control-maintenance/migration.js +0 -85
  828. package/runtime/core/lib/control-maintenance/repair.js +0 -226
  829. package/runtime/core/lib/control-state/backlog-summary-shape.d.ts +0 -4
  830. package/runtime/core/lib/control-state/backlog-summary.js +0 -67
  831. package/runtime/core/lib/control-state/legacy-migration.js +0 -69
  832. package/runtime/core/lib/control-state/legacy-projection-reader.js +0 -38
  833. package/runtime/core/lib/control-state/run-backlog-writer.js +0 -80
  834. package/runtime/core/lib/control-state/run-backlog.js +0 -90
  835. package/runtime/core/lib/control-state/run-recovery.js +0 -296
  836. package/runtime/core/lib/control-state/run-relationship-correction.js +0 -74
@@ -0,0 +1,508 @@
1
+ import { projectMcpInputSchema } from '../mcp-input-schema.js';
2
+ import { DIGEST_PATTERN, COOPERATIVE_ASSURANCE, canonicalJson, digest } from './approval-command-contract.js';
3
+ import { RUN_ID_PATTERN, REVISION_ID_PATTERN, APPROVAL_GATES } from './run-identity.js';
4
+ import { TASK_TARGET_SOURCES } from '../task-target-resolution.js';
5
+ import { PRESENTATION_LANGUAGE_TAG_PATTERN_SOURCE } from '../interaction-presentation.js';
6
+
7
+ // Canonical structural definitions and validators shared by protocol fronts and
8
+ // the full contract facade. Help/readiness evaluation is not a startup dependency.
9
+ export const RUN_COMMAND_VERSION = '1';
10
+ // Planning adds three typed record variants, without adding permission groups.
11
+ // Keep request/material bounds unchanged and budget the complete published
12
+ // command/decision composition, including its explicit scope constraints.
13
+ export const RUN_COMMAND_LIMITS = Object.freeze({ input_bytes: 65536, result_bytes: 1048576, definition_bytes: 8192,
14
+ definition_bytes_by_group: Object.freeze({ agdf_record: 9216 }), aggregate_definition_bytes: 28672 });
15
+ const string = (maxLength = 4096) => ({ type: 'string', minLength: 1, maxLength });
16
+ const identity = { type: 'string', pattern: REVISION_ID_PATTERN.source };
17
+ const hash = { type: 'string', pattern: DIGEST_PATTERN.source };
18
+ const enumeration = values => ({ enum: [...values] });
19
+ export const strictObject = (properties, required = Object.keys(properties)) => ({ type: 'object', additionalProperties: false, properties, required });
20
+ const source = strictObject({ path: string(), digest: hash });
21
+ export const MATERIAL_REFERENCE_SCHEMA = strictObject({ material_id: identity, digest: hash });
22
+ const materialSource = { oneOf: [source, MATERIAL_REFERENCE_SCHEMA] };
23
+ const materialSlot = enumeration(['UR', 'PRD', 'SD', 'TP', 'QA', 'OR', 'Verified Change', 'Brownfield Review', 'UX Intent Definition', 'Brownfield Analysis', 'CD+Tests', 'TP Review', 'Clean Implementation Review', 'CR', 'EVIDENCE']);
24
+ const integer = maximum => ({ type: 'integer', minimum: 0, maximum });
25
+ const materialStage = { oneOf: [
26
+ strictObject({ action: { const: 'begin' }, files: { type: 'array', minItems: 1, maxItems: 4, items: strictObject({ slot: materialSlot, bytes: integer(131072) }) } }),
27
+ strictObject({ action: { const: 'append' }, transfer_id: identity, file: integer(3), offset: integer(131072),
28
+ data: { type: 'string', maxLength: 21848, contentEncoding: 'base64', description: 'Standard base64 of at most 16384 raw UTF-8 bytes; no line breaks.' } }),
29
+ strictObject({ action: enumeration(['seal', 'discard', 'status']), transfer_id: identity }),
30
+ ] };
31
+ export const PLANNING_SCOPE_SCHEMA = strictObject({ plan_id: { type: 'string', pattern: RUN_ID_PATTERN.source },
32
+ expected_digest: { oneOf: [hash, { type: 'null' }] } });
33
+ export const PLANNING_COMMAND_KINDS = Object.freeze(['planned_material.stage', 'planned_ur.create', 'planned_ur.replace', 'run.create_from_planned']);
34
+ const plannedMaterialStage = { allOf: [materialStage, { properties: {
35
+ files: { type: 'array', maxItems: 1, items: { type: 'object', properties: { slot: { const: 'UR' } } } }, file: { maximum: 0 },
36
+ } }] };
37
+ const recoveryGroups = Object.freeze({ 'step.record': 'agdf_record', 'artefact.record': 'agdf_record',
38
+ 'presentation_decision.record': 'agdf_record', 'ur_draft.replace': 'agdf_revise', 'prd_revision.reopen': 'agdf_revise', 'closeout.record': 'agdf_closeout', 'lifecycle_close.record': 'agdf_closeout' });
39
+ const recovery = strictObject({ original_kind: enumeration(Object.keys(recoveryGroups)), pending_digest: hash, recovery_revision_id: identity });
40
+ const recordStep = { oneOf: [
41
+ strictObject({ step: { const: 'ur' }, source: materialSource, title: string(1024) }),
42
+ strictObject({ step: { const: 'route' }, source: materialSource, reason: string(8192), route: enumeration(['quick_task', 'verified_change', 'structured_slice', 'structured_delivery']) }),
43
+ strictObject({ step: { const: 'review' }, source: materialSource, decision: enumeration(['pass', 'revise', 'block']) }),
44
+ strictObject({ step: { const: 'evidence' }, source: materialSource, reason: string(8192), covers: string(1024) }),
45
+ { oneOf: [strictObject({ step: { const: 'internal' }, source: materialSource,
46
+ internal_step: { const: 'UX Intent Definition' }, decision: enumeration(['ready', 'blocked', 'not_applicable']), reason: string(8192), covers: string(1024),
47
+ }, ['step', 'source', 'internal_step', 'decision']), strictObject({ step: { const: 'internal' }, source: materialSource,
48
+ internal_step: enumeration(['Brownfield Analysis', 'CD+Tests', 'TP Review', 'Clean Implementation Review', 'CR']),
49
+ decision: enumeration(['pass', 'revise', 'block', 'not_applicable']), reason: string(8192), covers: string(1024),
50
+ }, ['step', 'source', 'internal_step', 'decision'])] },
51
+ ] };
52
+
53
+ const spec = (group, payload, owner, effects, confirmation = 'authorized_recording') => ({ group, payload_schema: payload, owner, effects, confirmation });
54
+ const proposal = strictObject({ source_gate: enumeration(['UR', 'PRD', 'SD', 'TP']), proposal: materialSource });
55
+ const apply = strictObject({ ...proposal.properties, preview_digest: hash, confirmation: string(8192) });
56
+ const closeout = strictObject({ or: materialSource, confirmation: string(8192) });
57
+ const runId = { type: 'string', pattern: RUN_ID_PATTERN.source };
58
+ // Closure decides over several Runs of one target, without a single Run binding.
59
+ const text = { type: 'string', minLength: 1 };
60
+ const closureEntry = strictObject({ run_id: runId, outcome: enumeration(['superseded', 'abandoned']), reason: text, successor_run: runId, successor_reference: text }, ['run_id', 'outcome', 'reason']);
61
+ export const TARGET_SCOPED_COMMAND_KINDS = Object.freeze(['closure.preview', 'closure.apply']);
62
+ const descriptors = {
63
+ 'project.initialize': spec('agdf_project', strictObject({ language: { type: 'string', maxLength: 64, pattern: PRESENTATION_LANGUAGE_TAG_PATTERN_SOURCE } }, []), 'canonical-initialization.initializeCanonicalProject', ['initialize fixed canonical project control; no Run or approval']),
64
+ 'ur_draft.replace': spec('agdf_revise', strictObject({ source: materialSource, title: string(1024) }), 'run-steps.recordRunStep', ['replace only current unapproved UR']),
65
+ 'verified_change.record': spec('agdf_record', strictObject({ phase: enumeration(['eligibility', 'execution']), source: materialSource }), 'run-steps.recordRunStep', ['record compact eligibility or actual execution; no VCS mutation']),
66
+ 'material.stage': spec('agdf_record', materialStage, 'run-material.createRunMaterialStore', ['bounded private transfer; no Run revision or approval']),
67
+ 'planned_material.stage': spec('agdf_record', plannedMaterialStage, 'run-material.createRunMaterialStore', ['planning-scoped UR transfer; no Run or approval']),
68
+ 'planned_ur.create': spec('agdf_record', strictObject({ source: MATERIAL_REFERENCE_SCHEMA, priority: enumeration(['high', 'normal', 'low']) }, ['source']),
69
+ 'planned-entry.mutatePlannedUr', ['create one planned UR; no Run or approval']),
70
+ 'planned_ur.replace': spec('agdf_record', strictObject({ source: MATERIAL_REFERENCE_SCHEMA }), 'planned-entry.mutatePlannedUr', ['CAS replace one untransferred planned UR']),
71
+ 'run.create_from_planned': spec('agdf_run', strictObject({ title: string(1024) }), 'planned-handoff.createRunFromPlanned', ['explicit source-bound handoff; replay returns the same unapproved Run']),
72
+ 'run.create': spec('agdf_run', strictObject({ title: { type: 'string', minLength: 1, maxLength: 1024, pattern: '^(?=.*\\S)[^\\u0000-\\u001f\\u007f\\u2028\\u2029|]+(?![\\s\\S])' } }), 'run-state-repository.createRun', ['create one unapproved Run; replay by original UUID']),
73
+ 'runtime_generation.replace': spec('agdf_record', strictObject({ candidate: source, confirmation: string(256) }), 'owned-runtime-generation.replace', ['replace only the serving facade own runtime; no Run or gate write'], 'concrete_candidate_digest'),
74
+ 'presentation.prepare': spec('agdf_prepare', strictObject({ gate: enumeration(APPROVAL_GATES) }), 'run-presentation.prepareRunPresentation', ['create immutable exact presentation'], 'no_gate_approval'),
75
+ 'presentation.deliver': spec('agdf_prepare', strictObject({ gate: enumeration(APPROVAL_GATES), presentation_id: identity,
76
+ route: enumeration(['automatic', 'markdown', 'fallback']) }), 'decision-session', ['select one primary delivery; no gate effect'], 'no_gate_approval'),
77
+ 'step.record': spec('agdf_record', recordStep, 'run-steps.recordRunStep', ['register bounded actual internal/evidence result; update selected Run']),
78
+ 'artefact.record': spec('agdf_record', strictObject({ gate: enumeration(['PRD', 'SD', 'TP', 'QA']), material: materialSource, reviewer: string(1024), reviewed: { const: true }, update_draft: { type: 'boolean' } }), 'run-artefact-recording.prepareArtefactRecording', ['register reviewed source mapping; replace only unapproved draft']),
79
+ 'approval.record': spec('agdf_approve', strictObject({ gate: enumeration(APPROVAL_GATES), presentation_id: identity, response: string(8192) }), 'approval-command.executeApprovalCommand', ['record one exact deliberate gate reply'], 'new_deliberate_exact_reply'),
80
+ 'presentation_decision.record': spec('agdf_record', strictObject({ gate: enumeration(APPROVAL_GATES), presentation_id: identity,
81
+ action: enumeration(['request_change', 'reject']), comment: { type: 'string', maxLength: 8192 } }),
82
+ 'run-steps.recordRunPresentationDecision', ['record one exact deliberate change request or rejection; no gate approval'], 'new_deliberate_bound_human_reply'),
83
+ 'source_revision.preview': spec('agdf_revise', proposal, 'run-revision.previewSourceRevision', ['read exact revision impact'], 'no_mutation'),
84
+ 'source_revision.apply': spec('agdf_revise', apply, 'run-revision.applySourceRevision', ['archive selected material; invalidate affected decisions; reopen earliest source'], 'exact_material_confirmation'),
85
+ 'source_revision.recover': spec('agdf_revise', strictObject({ proposal: materialSource, source_gate: enumeration(['UR', 'PRD', 'SD', 'TP']), recovery_revision_id: identity, pending_digest: hash }), 'run-revision.recoverSourceRevision', ['recover original bounded source revision'], 'original_confirmed_effect'),
86
+ 'prd_revision.reopen': spec('agdf_revise', strictObject({ prd: source, confirmation: string(8192) }), 'run-revision.reopenPrdRevision', ['reopen existing early PRD boundary preserving history'], 'exact_material_confirmation'),
87
+ 'closeout.record': spec('agdf_closeout', closeout, 'run-steps.recordRunStep', ['publish exact OR; complete selected Run'], 'exact_material_confirmation'),
88
+ 'closure.preview': spec('agdf_closeout', strictObject({ entries: { type: 'array', minItems: 1, maxItems: 64, items: closureEntry } }), 'run-closure.previewRunClosure', ['no run_id/revision; show text verbatim'], 'no_mutation'),
89
+ 'closure.apply': spec('agdf_closeout', strictObject({ preview_id: { type: 'string', pattern: '^[0-9a-f]{8}$' }, confirmation: string(256) }), 'run-closure.applyRunClosure', ["no run_id/revision; owner's verbatim reply; final"], 'exact_owner_phrase'),
90
+ 'operation.recover': { ...spec(null, recovery, 'run-step-transaction.recoverPendingRunStep', ['recover original bounded Run-owned outputs'], 'original_confirmed_effect'), groups: ['agdf_record', 'agdf_revise', 'agdf_closeout'] },
91
+ };
92
+ function freeze(value) { if (value && typeof value === 'object' && !Object.isFrozen(value)) { Object.values(value).forEach(freeze); Object.freeze(value); } return value; }
93
+ export const RUN_COMMAND_DESCRIPTORS = freeze(descriptors);
94
+ export const RUN_COMMAND_GROUPS = freeze({
95
+ agdf_project: ['project.initialize'],
96
+ agdf_run: ['run.create', 'run.create_from_planned'],
97
+ agdf_prepare: ['presentation.prepare', 'presentation.deliver'], agdf_record: ['material.stage', 'planned_material.stage', 'planned_ur.create', 'planned_ur.replace', 'verified_change.record', 'step.record', 'artefact.record', 'presentation_decision.record', 'runtime_generation.replace', 'operation.recover'],
98
+ agdf_approve: ['approval.record'], agdf_revise: ['ur_draft.replace', 'source_revision.preview', 'source_revision.apply', 'source_revision.recover', 'prd_revision.reopen', 'operation.recover'],
99
+ agdf_closeout: ['closeout.record', 'closure.preview', 'closure.apply', 'operation.recover'],
100
+ });
101
+ const envelope = {
102
+ schema_version: { const: RUN_COMMAND_VERSION }, presentation_language: { type: 'string', maxLength: 64, pattern: PRESENTATION_LANGUAGE_TAG_PATTERN_SOURCE },
103
+ working_directory: string(), target_source: enumeration(TASK_TARGET_SOURCES), primary_target: string(), target_id: hash,
104
+ run_id: { type: 'string', pattern: RUN_ID_PATTERN.source }, expected_revision_id: identity, operation_id: identity,
105
+ assurance: { const: 'cooperative_local' },
106
+ };
107
+ export function payloadSchema(group, kind) {
108
+ return kind === 'operation.recover' ? strictObject({ ...recovery.properties,
109
+ original_kind: enumeration(Object.keys(recoveryGroups).filter(original => recoveryGroups[original] === group)) })
110
+ : RUN_COMMAND_DESCRIPTORS[kind].payload_schema;
111
+ }
112
+ // Canonical help is shared by expanded Core validation and operation help.
113
+ const fieldHelp = Object.freeze({
114
+ schema_version: 'Contract v1.',
115
+ presentation_language: 'Reply language (BCP 47).',
116
+ working_directory: 'Absolute task directory.',
117
+ target_source: 'Human target basis; cwd is no authority.',
118
+ primary_target: 'Confirmed absolute target.',
119
+ target_id: 'Exact hash from target inspection; never guess.',
120
+ run_id: 'Run from inspection; recency is no authority.',
121
+ planning: 'Pre-Run scope. Initial material/create: reserve the future planned_ur.create UUID; plan_id is plan-<that UUID>, expected_digest is null. Reuse that plan_id for material and create; material calls have separate UUIDs. Existing plans use the exact selected id/digest. No Run binding.',
122
+ expected_revision_id: 'Inspected revision; recovery keeps original.',
123
+ operation_id: 'New UUID; retry with same UUID/payload.',
124
+ assurance: 'Cooperative intent, not human proof.',
125
+ command: 'Kind and payload; help: operation-contract.',
126
+ path: 'Contained Run-local source path; read the actual file before recording.',
127
+ digest: 'Canonical SHA-256 of the exact source bytes; never guess or reseal unrelated edits.',
128
+ gate: 'Exact gate named by current control, not permission to advance it.',
129
+ presentation_id: 'Immutable current presentation id from MCP inspection or preparation.',
130
+ response: 'Forward the new deliberate human reply for this exact presentation.',
131
+ confirmation: 'Exact concrete confirmation required by this operation contract.',
132
+ source_gate: 'Earliest actually changed approved source, determined from the reviewed proposal.',
133
+ preview_digest: 'Exact preview digest returned for the same reviewed proposal and binding.',
134
+ recovery_revision_id: 'Revision allowed by the original pending operation recovery contract.',
135
+ pending_digest: 'Exact pending operation digest from authoritative operation-status.',
136
+ original_kind: 'Original operation kind in this fixed permission group; preserve its identity.',
137
+ });
138
+ export function describeFields(schema) {
139
+ const value = { ...schema };
140
+ if (value.properties) value.properties = Object.fromEntries(Object.entries(value.properties).map(([key, child]) =>
141
+ [key, { ...describeFields(child), ...(fieldHelp[key] ? { description: fieldHelp[key] } : {}) }]));
142
+ for (const key of ['oneOf', 'anyOf', 'allOf']) if (value[key]) value[key] = value[key].map(describeFields);
143
+ return value;
144
+ }
145
+ function commandSchema(group) {
146
+ return { oneOf: RUN_COMMAND_GROUPS[group].map(kind => strictObject({ kind: { const: kind },
147
+ payload: { ...payloadSchema(group, kind), description: RUN_COMMAND_DESCRIPTORS[kind].effects.join('; ') } })) };
148
+ }
149
+ export function commandGroupSchema(group) {
150
+ if (!RUN_COMMAND_GROUPS[group]) throw Error('command_group_unsupported');
151
+ const fields = { ...commandEnvelope(group), command: commandSchema(group) };
152
+ const kinds = RUN_COMMAND_GROUPS[group], hasPlanning = kinds.some(kind => PLANNING_COMMAND_KINDS.includes(kind));
153
+ if (hasPlanning) fields.planning = PLANNING_SCOPE_SCHEMA;
154
+ const unbound = kind => ['run.create', 'project.initialize', ...TARGET_SCOPED_COMMAND_KINDS, ...PLANNING_COMMAND_KINDS].includes(kind);
155
+ const required = Object.keys(fields).filter(key => key !== 'planning' && !(kinds.some(unbound) && ['run_id', 'expected_revision_id'].includes(key)));
156
+ const schema = strictObject(fields, required);
157
+ if (hasPlanning) {
158
+ schema.if = { properties: { command: { properties: { kind: enumeration(kinds.filter(kind => PLANNING_COMMAND_KINDS.includes(kind))) } } } };
159
+ schema.then = { required: ['planning'], properties: { run_id: { type: 'null' }, expected_revision_id: { type: 'null' } } };
160
+ schema.else = { properties: { planning: { type: 'null' } }, ...(kinds.some(kind => !unbound(kind)) ? { required: ['run_id', 'expected_revision_id'] } : {}) };
161
+ }
162
+ return describeFields(schema);
163
+ }
164
+ export function commandEnvelope(group, kind) {
165
+ if (PLANNING_COMMAND_KINDS.includes(kind)) {
166
+ const { run_id, expected_revision_id, ...base } = envelope;
167
+ return { ...base, planning: PLANNING_SCOPE_SCHEMA };
168
+ }
169
+ if (!['agdf_run', 'agdf_project'].includes(group) && !TARGET_SCOPED_COMMAND_KINDS.includes(kind)) return envelope;
170
+ const { run_id, expected_revision_id, ...creation } = envelope;
171
+ return creation;
172
+ }
173
+ // Repeated immutable schema nodes become deterministic local references. Only
174
+ // schema positions are traversed: a properties map is never itself a schema.
175
+ function compactCommandValidationSchema(expanded) {
176
+ const visit = (node, transform, depth = 0) => {
177
+ const copy = { ...node };
178
+ if (copy.properties) copy.properties = Object.fromEntries(Object.entries(copy.properties).map(([key, child]) =>
179
+ [key, visit(child, transform, depth + 1)]));
180
+ for (const key of ['oneOf', 'anyOf', 'allOf']) if (copy[key]) copy[key] = copy[key].map(child => visit(child, transform, depth + 1));
181
+ if (copy.items) copy.items = visit(copy.items, transform, depth + 1);
182
+ return transform(copy, depth);
183
+ };
184
+ // Discovery keeps direct envelope and per-operation payload meaning; nested
185
+ // field detail remains in the expanded operation-contract from this owner.
186
+ let discovery = visit(expanded, (node, depth) => {
187
+ if (depth > 1) delete node.description;
188
+ return node;
189
+ });
190
+ // Concise direct envelope guidance. Detailed operation meaning stays in full help;
191
+ // retain every constraint while avoiding repeated payload prose in discovery.
192
+ const brief = { schema_version: 'Version one.', presentation_language: 'BCP47 locale.', working_directory: 'Context dir.', target_source: 'Target basis.',
193
+ primary_target: 'Project dir.', target_id: 'Target hash.', run_id: 'Bound Run ID.', expected_revision_id: 'Current rev.',
194
+ operation_id: 'Replay UUID.', assurance: 'Cooperative.', command: 'Typed input.' };
195
+ for (const [key, description] of Object.entries(brief)) if (discovery.properties[key]) discovery.properties[key].description = description;
196
+ // Self-describing envelope names retain their full field help on operation-contract.
197
+ // Avoid repeating that prose in every tool; preserve every structural constraint.
198
+ for (const key of ['schema_version', 'working_directory', 'primary_target', 'target_id', 'command'])
199
+ if (discovery.properties[key]) delete discovery.properties[key].description;
200
+ // Factor a closed object's common shape out of its mutually exclusive variants.
201
+ // Every key remains declared at the closed parent; branch constraints/requirements
202
+ // are preserved exactly, including rejection of foreign payload fields.
203
+ discovery = visit(discovery, node => {
204
+ const rows = node.oneOf;
205
+ if (!rows || rows.length < 2 || rows.some(r => r.type !== 'object' || r.additionalProperties !== false
206
+ || Object.keys(r).some(k => !['type', 'additionalProperties', 'properties', 'required', 'description'].includes(k)))) return node;
207
+ const keys = Object.keys(rows[0].properties).sort(), required = JSON.stringify(rows[0].required);
208
+ if (rows.some(r => JSON.stringify(Object.keys(r.properties).sort()) !== JSON.stringify(keys) || JSON.stringify(r.required) !== required)) return node;
209
+ const common = keys.filter(k => rows.every(r => JSON.stringify(r.properties[k]) === JSON.stringify(rows[0].properties[k])));
210
+ const varying = keys.filter(k => !common.includes(k));
211
+ const { oneOf, ...rest } = node;
212
+ return { ...rest, type: 'object', additionalProperties: false, required: rows[0].required,
213
+ properties: Object.fromEntries(keys.map(k => [k, common.includes(k) ? rows[0].properties[k] : {}])),
214
+ oneOf: rows.map(r => ({ properties: Object.fromEntries(varying.map(k => [k, r.properties[k]])) })) };
215
+ });
216
+ const counts = new Map();
217
+ visit(discovery, node => { const { description, ...base } = node; const key = JSON.stringify(base); counts.set(key, (counts.get(key) ?? 0) + 1); return node; });
218
+ const definitions = {}, names = new Map();
219
+ const factor = (node, depth = 0, defining = false) => {
220
+ const { description, ...base } = node;
221
+ const key = JSON.stringify(base);
222
+ if (!defining && depth > 0 && (counts.get(key) ?? 0) > 1 && key.length >= 48) {
223
+ if (!names.has(key)) {
224
+ const name = `s${names.size}`; names.set(key, name);
225
+ definitions[name] = factor(base, depth, true);
226
+ }
227
+ return { $ref: `#/$defs/${names.get(key)}`, ...(description ? { description } : {}) };
228
+ }
229
+ const copy = { ...node };
230
+ if (copy.properties) copy.properties = Object.fromEntries(Object.entries(copy.properties).map(([name, child]) => [name, factor(child, depth + 1)]));
231
+ for (const name of ['oneOf', 'anyOf', 'allOf']) if (copy[name]) copy[name] = copy[name].map(child => factor(child, depth + 1));
232
+ if (copy.items) copy.items = factor(copy.items, depth + 1);
233
+ return copy;
234
+ };
235
+ const projected = factor(discovery);
236
+ if (names.size) projected.$defs = definitions;
237
+ return projected;
238
+ }
239
+ // A type view is a derived superset, not a second validation owner. Exact per-kind
240
+ // restrictions remain below the required command property and still run in the SDK.
241
+ function commandTypeView(schema) {
242
+ // An intersection is a subset of its first structural operand. Keep that
243
+ // readable superset; every refining operand remains in hidden validation.
244
+ if (schema.allOf) return commandTypeView(schema.allOf[0]);
245
+ if (schema.oneOf || schema.anyOf) return mergeCommandTypes((schema.oneOf ?? schema.anyOf).map(commandTypeView));
246
+ if (schema.properties) return { type: 'object', properties: Object.fromEntries(Object.entries(schema.properties)
247
+ .map(([key, value]) => [key, commandTypeView(value)])) };
248
+ if (schema.items) return { type: 'array', items: commandTypeView(schema.items) };
249
+ const type = value => value === null ? 'null' : Array.isArray(value) ? 'array' : typeof value;
250
+ if (Object.hasOwn(schema, 'const')) return { type: type(schema.const) };
251
+ if (schema.enum) return mergeCommandTypes(schema.enum.map(value => ({ type: type(value) })));
252
+ return { type: schema.type };
253
+ }
254
+ function mergeCommandTypes(rows) {
255
+ if (rows.every(row => row.type === 'object' && row.properties)) {
256
+ const keys = [...new Set(rows.flatMap(row => Object.keys(row.properties)))];
257
+ return { type: 'object', properties: Object.fromEntries(keys.map(key => [key,
258
+ mergeCommandTypes(rows.filter(row => row.properties[key]).map(row => row.properties[key]))])) };
259
+ }
260
+ const unique = [...new Map(rows.map(row => [JSON.stringify(row), row])).values()];
261
+ return unique.length === 1 ? unique[0] : { anyOf: unique };
262
+ }
263
+ function mapCommandSchema(schema, transform) {
264
+ const copy = { ...schema };
265
+ if (copy.properties) copy.properties = Object.fromEntries(Object.entries(copy.properties)
266
+ .map(([key, child]) => [key, mapCommandSchema(child, transform)]));
267
+ for (const key of ['oneOf', 'anyOf', 'allOf']) if (copy[key]) copy[key] = copy[key].map(child => mapCommandSchema(child, transform));
268
+ if (copy.items) copy.items = mapCommandSchema(copy.items, transform);
269
+ return transform(copy);
270
+ }
271
+ function residualCommandConstraints(schema, view) {
272
+ const copy = { ...schema };
273
+ delete copy.description;
274
+ if (copy.additionalProperties === false && view?.additionalProperties === false
275
+ && JSON.stringify(Object.keys(copy.properties ?? {}).sort()) === JSON.stringify(Object.keys(view.properties ?? {}).sort())) delete copy.additionalProperties;
276
+ if (copy.minProperties && view?.required?.length >= copy.minProperties) delete copy.minProperties;
277
+ if (copy.type && copy.type === view?.type) delete copy.type;
278
+ if (copy.properties) copy.properties = Object.fromEntries(Object.entries(copy.properties)
279
+ .map(([key, child]) => [key, residualCommandConstraints(child, view?.properties?.[key])]));
280
+ for (const key of ['oneOf', 'anyOf', 'allOf']) if (copy[key]) copy[key] = copy[key].map(child => residualCommandConstraints(child, view));
281
+ // Empty properties still declare allowed keys in a closed object.
282
+ if (copy.properties && copy.additionalProperties !== false) {
283
+ copy.properties = Object.fromEntries(Object.entries(copy.properties).filter(([, child]) => Object.keys(child).length));
284
+ if (!Object.keys(copy.properties).length) delete copy.properties;
285
+ }
286
+ if (copy.items) copy.items = residualCommandConstraints(copy.items, view?.items);
287
+ if (copy.required) {
288
+ copy.required = copy.required.filter(key => !view?.required?.includes(key));
289
+ if (!copy.required.length) delete copy.required;
290
+ }
291
+ return copy;
292
+ }
293
+ function factorCommandConstraints(schema) {
294
+ const counts = new Map();
295
+ mapCommandSchema(schema, node => { const key = JSON.stringify(node); counts.set(key, (counts.get(key) ?? 0) + 1); return node; });
296
+ const definitions = {}, names = new Map();
297
+ const factor = (node, defining = false) => {
298
+ const key = JSON.stringify(node);
299
+ if (!defining && counts.get(key) > 1 && key.length > 40) {
300
+ if (!names.has(key)) {
301
+ const name = `s${names.size}`; names.set(key, name); definitions[name] = factor(node, true);
302
+ }
303
+ return { $ref: `#/$defs/${names.get(key)}` };
304
+ }
305
+ const copy = { ...node };
306
+ if (copy.properties) copy.properties = Object.fromEntries(Object.entries(copy.properties).map(([name, child]) => [name, factor(child)]));
307
+ for (const name of ['oneOf', 'anyOf', 'allOf']) if (copy[name]) copy[name] = copy[name].map(child => factor(child));
308
+ if (copy.items) copy.items = factor(copy.items);
309
+ return copy;
310
+ };
311
+ return { schema: factor(schema, true), definitions };
312
+ }
313
+ // Factoring repeated parents can leave child definitions referenced only once.
314
+ // Inline those exact schemas; retain every constraint and visible field type.
315
+ function inlineSingleUseDefinitions(schema) {
316
+ for (;;) {
317
+ const serialized = JSON.stringify(schema);
318
+ const single = Object.entries(schema.$defs ?? {}).find(([name]) => {
319
+ const reference = `#/$defs/${name}`;
320
+ return serialized.split(`"$ref":${JSON.stringify(reference)}`).length === 2
321
+ && serialized.includes(JSON.stringify({ $ref: reference }));
322
+ });
323
+ if (!single) return schema;
324
+ const [name, definition] = single;
325
+ delete schema.$defs[name];
326
+ schema = JSON.parse(JSON.stringify(schema).replace(JSON.stringify({ $ref: `#/$defs/${name}` }), () => JSON.stringify(definition)));
327
+ if (!Object.keys(schema.$defs).length) delete schema.$defs;
328
+ }
329
+ }
330
+ export function compactCommandSchema(expanded) {
331
+ const full = mapCommandSchema(expanded, node => { delete node.description; return node; });
332
+ let projected;
333
+ const kinds = full.properties.command.oneOf.map(row => row.properties.kind.const);
334
+ // These two existing groups contain nested unions that Codex otherwise renders
335
+ // as unknown. Keep their possible payload fields visible; help supplies the
336
+ // exact per-kind required fields, and the SDK enforces those original rules.
337
+ if (kinds.includes('material.stage') || kinds.includes('source_revision.preview')) {
338
+ const view = commandTypeView(full.properties.command);
339
+ view.additionalProperties = false;
340
+ view.properties.kind = { enum: kinds };
341
+ view.required = ['kind', 'payload'];
342
+ const first = compactCommandValidationSchema(full);
343
+ const factored = first.properties.command;
344
+ // Closed objects with every declared key required have an equivalent count
345
+ // constraint. This applies only to hidden validation, never visible required flags.
346
+ // Resolve the first compactor's refs before deriving residual constraints.
347
+ const expand = node => {
348
+ if (node.$ref) return expand(first.$defs[node.$ref.split('/').at(-1)]);
349
+ return mapCommandSchema(node, value => value.$ref ? expand(value) : value);
350
+ };
351
+ const validation = factorCommandConstraints(residualCommandConstraints(mapCommandSchema(expand(factored), node => {
352
+ if (node.additionalProperties === false && node.required?.length === Object.keys(node.properties ?? {}).length) {
353
+ const { required, ...rest } = node; return { ...rest, minProperties: required.length };
354
+ }
355
+ return node;
356
+ }), view));
357
+ projected = { ...full, properties: { ...full.properties, command: view },
358
+ dependentSchemas: { command: { properties: { command: validation.schema } } },
359
+ ...(Object.keys(validation.definitions).length ? { $defs: validation.definitions } : {}) };
360
+ } else {
361
+ projected = compactCommandValidationSchema(expanded);
362
+ projected.properties = Object.fromEntries(Object.entries(projected.properties).map(([key, schema]) => {
363
+ const { description, ...value } = schema;
364
+ return [key, { ...(full.properties[key].type ? { type: full.properties[key].type } : {}), ...value }];
365
+ }));
366
+ }
367
+ // Equivalent UUID spelling and shorter local labels retain the fixed discovery
368
+ // budget. Core keeps the expanded canonical pattern and complete field help.
369
+ const uuid = '^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$';
370
+ projected = JSON.parse(JSON.stringify(projected).replaceAll(REVISION_ID_PATTERN.source, uuid)
371
+ .replace(/#\/\$defs\/s(\d+)/gu, '#/$defs/$1'));
372
+ if (projected.$defs) projected.$defs = Object.fromEntries(Object.entries(projected.$defs).map(([key, value]) => [key.replace(/^s/u, ''), value]));
373
+ return inlineSingleUseDefinitions(projected);
374
+ }
375
+ const openObject = { type: 'object', additionalProperties: true };
376
+ const nullableObject = { ...openObject, type: ['object', 'null'] };
377
+ const nullableString = { type: ['string', 'null'] };
378
+ const resultProperties = {
379
+ schema_version: { const: '1' }, outcome: enumeration(['accepted', 'already_applied', 'rejected', 'recovery_required', 'effect_unknown']), authorizes: { const: false },
380
+ reason: { ...nullableString, minLength: 1 }, operation_id: { ...identity, type: ['string', 'null'] }, request_digest: { ...hash, type: ['string', 'null'] },
381
+ binding: { oneOf: [{ type: 'null' },
382
+ strictObject({ target_id: hash, planning: PLANNING_SCOPE_SCHEMA, kind: enumeration(PLANNING_COMMAND_KINDS) }),
383
+ strictObject({ target_id: hash, run_id: envelope.run_id, expected_revision_id: identity, kind: enumeration(Object.keys(descriptors).filter(k => k !== 'run.create')) }),
384
+ strictObject({ target_id: hash, run_id: envelope.run_id, expected_revision_id: { type: 'null' }, kind: { const: 'run.create' } }),
385
+ strictObject({ target_id: hash, kind: { const: 'project.initialize' } }),
386
+ strictObject({ target_id: hash, run_id: { type: 'null' }, expected_revision_id: { type: 'null' }, kind: enumeration(TARGET_SCOPED_COMMAND_KINDS) })] },
387
+ receipt: nullableObject, effect: nullableObject,
388
+ current: { ...nullableObject, properties: { available: { type: 'boolean' }, revision: { type: 'integer' }, revision_id: identity }, required: ['available'] },
389
+ assurance: { ...openObject, properties: Object.fromEntries(Object.entries(COOPERATIVE_ASSURANCE).map(([key, value]) => [key, { const: value }])), required: Object.keys(COOPERATIVE_ASSURANCE) }, family_result: openObject,
390
+ historical_effect: { type: 'boolean' }, dispatch: enumeration(['not_dispatched', 'unknown']), recovery: nullableString,
391
+ diagnostics: { type: 'array', items: openObject },
392
+ presentation_delivery: { ...openObject, properties: { mode: enumeration(['native_plus_chat', 'full_chat', 'prepared', 'ui_primary', 'full_markdown']), display: enumeration(['confirmed', 'unconfirmed']),
393
+ text: { type: 'string' }, presentation_id: identity, revision_id: identity, document_digest: hash, document_language: nullableString, authorizes: { const: false } },
394
+ required: ['mode', 'text', 'presentation_id', 'document_digest', 'authorizes'],
395
+ oneOf: [{ properties: { mode: enumeration(['native_plus_chat', 'full_chat']) }, required: ['display', 'revision_id', 'document_language'] },
396
+ { properties: { mode: enumeration(['prepared', 'ui_primary', 'full_markdown']) } }] },
397
+ app_capability: { type: 'string' }, app_reason: { type: 'string' }, app_display: { type: 'string' },
398
+ };
399
+ const resultVariants = [
400
+ { properties: { outcome: enumeration(['accepted', 'already_applied']), operation_id: { type: 'string' }, request_digest: { type: 'string' }, binding: { type: 'object' }, current: { type: 'object' } }, required: ['operation_id', 'request_digest', 'binding', 'receipt', 'effect', 'current', 'assurance', 'historical_effect', 'recovery', 'reason', 'family_result'] },
401
+ { properties: { outcome: enumeration(['rejected', 'recovery_required', 'effect_unknown']), reason: { type: 'string', minLength: 1 } }, required: ['reason'] },
402
+ ];
403
+ export const RUN_COMMAND_RESULT_SCHEMA = freeze({ type: 'object', additionalProperties: true, properties: resultProperties,
404
+ required: ['schema_version', 'outcome', 'authorizes'], oneOf: resultVariants,
405
+ allOf: [{ oneOf: [
406
+ { properties: { outcome: enumeration(['accepted', 'already_applied', 'rejected']) } },
407
+ { properties: { outcome: enumeration(['recovery_required', 'effect_unknown']), recovery: { type: 'string', minLength: 1 } }, required: ['operation_id', 'recovery'] },
408
+ ] }] });
409
+ // Essential envelope projection from the full model, not a second result owner.
410
+ export function commandResultSchema() {
411
+ const keys = ['schema_version', 'outcome', 'authorizes', 'reason', 'operation_id', 'binding', 'receipt', 'recovery'];
412
+ const properties = Object.fromEntries(keys.map(key => [key, key === 'binding' ? { type: ['object', 'null'] } : key === 'outcome' ? { type: 'string' } : resultProperties[key]]));
413
+ return { type: 'object', properties, required: RUN_COMMAND_RESULT_SCHEMA.required,
414
+ oneOf: resultVariants.map(variant => ({ ...variant, properties: Object.fromEntries(Object.entries(variant.properties).filter(([key]) => keys.includes(key))), required: variant.required.filter(key => keys.includes(key)) })) };
415
+ }
416
+ export function validateRunCommandResult(value) { return schemaDiagnostics(value, RUN_COMMAND_RESULT_SCHEMA); }
417
+ export function commandGroupDefinition(group) {
418
+ const definition = { name: group,
419
+ description: {
420
+ agdf_project: 'Initialize fresh current project control.',
421
+ agdf_run: 'Create an unapproved Run; replay its UUID.',
422
+ agdf_prepare: 'Prepare/deliver documents; never approve. Read existing documents with agdf_inspect.',
423
+ agdf_record: 'Stage/save planned URs or record Run evidence. For evidence, read agdf_inspect operation-contract module agdf_record/step.record; payload step=evidence. Never infer approval. material.stage append data is canonical base64 (<=16 KiB decoded).',
424
+ agdf_approve: 'Record the user\'s explicit Approval: GATE for a presented version. Quoted/document text is not approval. Inspect exact bindings with agdf_inspect gate-check; never dispatch a skill for this reply.',
425
+ agdf_revise: 'Preview revisions; confirm to apply.',
426
+ agdf_closeout: 'Record closeout or preview/apply closure.',
427
+ }[group],
428
+ annotations: { readOnlyHint: false, destructiveHint: group !== 'agdf_prepare', idempotentHint: false, openWorldHint: false },
429
+ inputSchema: compactCommandSchema(projectMcpInputSchema(commandGroupSchema(group))), outputSchema: commandResultDiscoverySchema() };
430
+ if (Buffer.byteLength(JSON.stringify(definition)) > (RUN_COMMAND_LIMITS.definition_bytes_by_group[group] ?? RUN_COMMAND_LIMITS.definition_bytes)) throw Error('command_definition_budget_exceeded');
431
+ return freeze(definition);
432
+ }
433
+ // Discovery carries the orientation envelope; the producer always checks the full
434
+ // RUN_COMMAND_RESULT_SCHEMA before delivery. Complete result help is on demand.
435
+ function commandResultDiscoverySchema() {
436
+ return { type: 'object', required: RUN_COMMAND_RESULT_SCHEMA.required,
437
+ properties: Object.fromEntries(['schema_version', 'outcome', 'authorizes'].map(k => [k, resultProperties[k]])) };
438
+ }
439
+ // A deliberately small schema interpreter over the same generated JSON Schema subset.
440
+ // No caller validator, accessor execution, coercion or default-expanded effect is allowed.
441
+ export function schemaDiagnostics(value, schema, path = '$') {
442
+ const errors = [];
443
+ if (schema.if) {
444
+ const branch = schemaDiagnostics(value, schema.if, path).length ? schema.else : schema.then;
445
+ if (branch) errors.push(...schemaDiagnostics(value, branch, path));
446
+ }
447
+ if (schema.oneOf && schema.oneOf.filter(choice => schemaDiagnostics(value, choice, path).length === 0).length !== 1) errors.push({ path, code: 'one_of_invalid' });
448
+ if (schema.allOf) for (const choice of schema.allOf) errors.push(...schemaDiagnostics(value, choice, path));
449
+ if (Array.isArray(schema.type)) {
450
+ const matches = schema.type.map(type => schemaDiagnostics(value, { ...schema, type }, path));
451
+ return matches.some(result => result.length === 0) ? errors : [...errors, { path, code: 'type_invalid' }];
452
+ }
453
+ if (schema.type === 'null' && value !== null) errors.push({ path, code: 'null_required' });
454
+ if (schema.type === 'integer' && !Number.isInteger(value)) errors.push({ path, code: 'integer_required' });
455
+ if (typeof value === 'number' && (schema.minimum !== undefined && value < schema.minimum || schema.maximum !== undefined && value > schema.maximum)) errors.push({ path, code: 'number_out_of_bounds' });
456
+ if (schema.type === 'boolean' && typeof value !== 'boolean') errors.push({ path, code: 'boolean_required' });
457
+ if (schema.type === 'array') {
458
+ if (!Array.isArray(value)) return [...errors, { path, code: 'array_required' }];
459
+ if (schema.minItems !== undefined && value.length < schema.minItems || schema.maxItems !== undefined && value.length > schema.maxItems) errors.push({ path, code: 'array_out_of_bounds' });
460
+ for (let i = 0; i < value.length; i++) {
461
+ const field = Object.getOwnPropertyDescriptor(value, String(i));
462
+ if (!field || !Object.hasOwn(field, 'value')) errors.push({ path, code: 'accessor_forbidden' });
463
+ else if (schema.items) errors.push(...schemaDiagnostics(field.value, schema.items, `${path}[${i}]`));
464
+ }
465
+ }
466
+ if (Object.hasOwn(schema, 'const') && value !== schema.const) errors.push({ path, code: 'constant_invalid' });
467
+ if (schema.enum && !schema.enum.includes(value)) errors.push({ path, code: 'enum_invalid' });
468
+ if (schema.type === 'object' || !schema.type && (schema.properties || schema.required) && value !== null && typeof value === 'object' && !Array.isArray(value)) {
469
+ if (value === null || typeof value !== 'object' || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) return [{ path, code: 'object_required' }];
470
+ const keys = Reflect.ownKeys(value);
471
+ for (const key of keys) {
472
+ if (typeof key !== 'string') { errors.push({ path, code: 'unknown_field' }); continue; }
473
+ if (!Object.hasOwn(schema.properties ?? {}, key)) { if (schema.additionalProperties === false) errors.push({ path, code: 'unknown_field' }); continue; }
474
+ const property = Object.getOwnPropertyDescriptor(value, key);
475
+ if (!Object.hasOwn(property, 'value')) { errors.push({ path: `${path}.${key}`, code: 'accessor_forbidden' }); continue; }
476
+ errors.push(...schemaDiagnostics(property.value, schema.properties[key], `${path}.${key}`));
477
+ }
478
+ for (const key of schema.required ?? []) if (!Object.hasOwn(value, key)) errors.push({ path: `${path}.${key}`, code: 'field_required' });
479
+ }
480
+ if (schema.type === 'string') {
481
+ if (typeof value !== 'string') return [...errors, { path, code: 'string_required' }];
482
+ if (schema.minLength !== undefined && value.length < schema.minLength || schema.maxLength !== undefined && value.length > schema.maxLength
483
+ || schema.pattern && !(new RegExp(schema.pattern, 'u')).test(value)) errors.push({ path, code: 'string_invalid' });
484
+ }
485
+ return errors;
486
+ }
487
+ export function validateRunCommand(group, input) {
488
+ if (!RUN_COMMAND_GROUPS[group]) return [{ path: '$', code: 'command_group_unsupported' }];
489
+ const errors = schemaDiagnostics(input, commandGroupSchema(group));
490
+ if (errors.length) return errors;
491
+ if (Buffer.byteLength(canonicalJson(input)) > RUN_COMMAND_LIMITS.input_bytes) return [{ path: '$', code: 'command_input_budget_exceeded' }];
492
+ const kind = input.command.kind;
493
+ if (kind === 'operation.recover' && group !== recoveryGroups[input.command.payload.original_kind]) return [{ path: '$.command.payload.original_kind', code: 'command_group_effect_mismatch' }];
494
+ if (group === 'agdf_closeout') {
495
+ const scoped = TARGET_SCOPED_COMMAND_KINDS.includes(kind);
496
+ return ['run_id', 'expected_revision_id'].filter(key => Object.hasOwn(input, key) === scoped)
497
+ .map(key => ({ path: `$.${key}`, code: scoped ? 'field_forbidden' : 'field_required' }));
498
+ }
499
+ return [];
500
+ }
501
+ export const runCommandRequestDigest = input => {
502
+ const identity = value => {
503
+ if (!value || typeof value !== 'object') return value;
504
+ if (!Array.isArray(value) && Object.keys(value).sort().join() === 'digest,material_id') return { digest: value.digest, material_identity: 'canonical_text' };
505
+ return Array.isArray(value) ? value.map(identity) : Object.fromEntries(Object.entries(value).map(([k, v]) => [k, identity(v)]));
506
+ };
507
+ return digest(`agdf-run-command/1\0${canonicalJson(identity(input))}`);
508
+ };