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,444 @@
1
+ // AGDF Companion host adapter (SDD-07 to SDD-10; follow-up SDD-05 to SDD-12): the `/agdf-companion`
2
+ // command, the persisted choices, main-loop turn observation, the refresh cadence, the own pane, the
3
+ // status line and toasts. Observation only: no gating hook, every hook passes its event on through a
4
+ // catch path, and nothing is written under .agdf/control. Session state lives in this module and is
5
+ // redrawn through `$.ui.invalidate`. Elements come from the surface table and are built with the
6
+ // host's global `h`.
7
+
8
+ import { assignRun, namedRun, openRuns, stepSelection } from './assignment.mjs';
9
+ import { figureSvg } from './figure.mjs';
10
+ import { chatLocale, label } from './localization.mjs';
11
+ import { CHIME, chimeClip, noticeText, observeNotice, observedRun, statusText } from './notice.mjs';
12
+ import { STATE_FILE, defaultCompanionState, parseCompanionState, pluginDataDir, serializeCompanionState } from './persistence.mjs';
13
+ import { readSnapshot, settleSnapshot } from './run-state.mjs';
14
+ import { buildPanelView, terminalText } from './view.mjs';
15
+
16
+ export const PANE = 'agdf-companion';
17
+ export const COMMAND = 'agdf-companion';
18
+ export const REFRESH_MS = 30_000;
19
+ export const MENU = 'menu';
20
+ export const ABOUT_URL = 'https://agdf.iself.eu';
21
+ const LISTED_RUNS = 6;
22
+ // The surfaces whose element table has a picker; the mobile app draws none and turns one into an empty
23
+ // box (`claude plugin test` 2.1.302), so its table entry alone does not decide.
24
+ const PICKER_SURFACES = new Set(['terminal', 'desktop', 'vscode']);
25
+ // Body rows the desktop spends around the run list, measured live on 2026-10-28 (a body row is about
26
+ // 28 px): the figure with its state and reason, the framed footer with its picker, the About block,
27
+ // the space between two blocks, and one spare row, since a body taller than the pane scrolls.
28
+ const DESKTOP_ROWS = Object.freeze({ figure: 7, footer: 2, about: 7, gap: 0.6, spare: 1 });
29
+ // Rows the desktop body leaves below the pane's body rows. The T-001 probe of 2026-10-28 showed no
30
+ // scrollbar for a framed footer at 0, 0.25, 0.5 and 1 row in the narrow, widened and taller pane, so
31
+ // the smallest reserve applies (chat-run navigation SDD-08).
32
+ const BODY_RESERVE = 0;
33
+ // Listed runs show their condensed gate bars beside the ids while at least this many characters of an id
34
+ // stay beside the widest bar (owner request of 2026-10-28); a narrower pane lists the ids alone.
35
+ const ID_ROOM = 18;
36
+ const COLOR = Object.freeze({ laeuft: 'suggestion', baut: 'suggestion', wartet: 'warning', blockiert: 'error', fertig: 'success' });
37
+
38
+ function createSession() {
39
+ return { startedAt: 0, root: '', registry: null, labels: null, locale: 'en', statePath: null, version: null, icon: null,
40
+ choices: defaultCompanionState(), isHidden: false, snapshot: null, isTurnActive: false, isObjectiveExpanded: false,
41
+ isAboutShown: false, isMenuOpen: false, timer: null, reads: 0, appliedRead: 0, observation: null,
42
+ chatMention: null, isBrowsing: false, conversation: null };
43
+ }
44
+
45
+ // One companion per session: the module is loaded once per session.
46
+ const session = createSession();
47
+ const t = (path, params) => label(session.labels, session.locale, path, params);
48
+ const selection = () => session.choices.selections[session.root] ?? null;
49
+ const redraw = $ => $.ui.invalidate('ui.render');
50
+ // File access for the host-independent reader, each call spelled on `$` (read-only).
51
+ const files = $ => ({ exists: path => $.fs.exists(path), list: path => $.fs.list(path), read: path => $.fs.read(path) });
52
+
53
+ // Applies one change to this session's choices and, where the AGDF plugin data directory already
54
+ // exists, to the freshly read state file, so choices another session stored meanwhile survive.
55
+ // Without the directory the choices last for this session (SDD-07). The state file is the module's
56
+ // only write. `change` sets values, never toggles, because it runs on both copies.
57
+ async function persist($, change) {
58
+ change(session.choices);
59
+ if (!session.statePath) return;
60
+ const dir = session.statePath.slice(0, -STATE_FILE.length - 1);
61
+ if (!(await $.fs.exists(dir))) return;
62
+ const stored = (await $.fs.exists(session.statePath)) ? parseCompanionState(await $.fs.read(session.statePath)) : defaultCompanionState();
63
+ change(stored);
64
+ await $.fs.write(session.statePath, serializeCompanionState(stored));
65
+ }
66
+
67
+ // The status line and toasts follow the run-derived state of the run the panel shows without browsing,
68
+ // so browsing never changes them (follow-up SDD-05 to SDD-07; chat-run navigation SDD-06). A stale snapshot keeps the last observation, so a failed read never
69
+ // announces anything. Each host call has its own catch path: a missing channel stays silent (SDD-12).
70
+ function announce($) {
71
+ const observed = observedRun({ snapshot: session.snapshot, sessionStartedAt: session.startedAt, selection: selection(),
72
+ mention: session.chatMention });
73
+ // Every applied read sets the line again, unchanged text included: the desktop dropped the one set
74
+ // during session start, before its surface was attached (live finding of 2026-10-27).
75
+ try { $.ui.status(statusText(observed, { labels: session.labels, locale: session.locale })); } catch { /* no status line on this host */ }
76
+ if (session.snapshot?.stale) return;
77
+ const { observation, notice } = observeNotice(session.observation, observed);
78
+ session.observation = observation;
79
+ if (!notice || !session.choices.notice) return;
80
+ try {
81
+ $.ui.toast(noticeText(observed.runId, notice, { registry: session.registry, labels: session.labels, locale: session.locale }));
82
+ } catch {
83
+ return; // no toast on this host, and so no chime either (CR-F01)
84
+ }
85
+ // The chime plays only with a shown toast; a host without a player skips it, a failure stays silent.
86
+ if (session.choices.sound) {
87
+ try { $.audio.play(chimeClip(), { gain: CHIME.gain }).catch(() => {}); } catch { /* no audio on this host */ }
88
+ }
89
+ }
90
+
91
+ // Switching off clears the status line, forgets the observation and discards reads still running, so
92
+ // switching on starts from a fresh baseline without a toast (CR-F02).
93
+ function silence($) {
94
+ session.observation = null;
95
+ session.appliedRead = session.reads + 1;
96
+ try { $.ui.status(undefined); } catch { /* no status line on this host */ }
97
+ }
98
+
99
+ // Reads the run states of the current project root, which `/cd` or a worktree move can change.
100
+ // Only the newest of overlapping reads is applied. A snapshot without any runs, as during a branch
101
+ // switch, never drops the remembered selection.
102
+ async function refresh($) {
103
+ const read = ++session.reads;
104
+ try {
105
+ const root = await $.session.root();
106
+ await followConversation($);
107
+ const next = await readSnapshot(files($), root, { now: await $.clock.now() });
108
+ if (read < session.appliedRead) return;
109
+ session.appliedRead = read;
110
+ session.root = root;
111
+ session.snapshot = settleSnapshot(session.snapshot, next);
112
+ const chosen = selection();
113
+ if (chosen && next.status === 'ok' && next.runs.length) {
114
+ const { dropSelection } = assignRun({ runs: next.runs, sessionStartedAt: session.startedAt, selection: chosen });
115
+ if (dropSelection && !next.unreadable.some(item => item.id === chosen)) await persist($, choices => { delete choices.selections[root]; });
116
+ }
117
+ } catch (error) {
118
+ if (read < session.appliedRead) return;
119
+ session.appliedRead = read;
120
+ session.snapshot = settleSnapshot(session.snapshot, { status: 'failed', runs: [], unreadable: [], readAt: Date.now(), error: String(error?.message ?? error) });
121
+ }
122
+ if (session.choices.enabled) announce($);
123
+ redraw($);
124
+ }
125
+
126
+ // Takes the last open run a main-loop text names as the chat's run at host time `at` (chat-run navigation
127
+ // SDD-01, SDD-02). Returns whether a mention was recorded: a repeated name can still move the chat's run
128
+ // back from a later change, so every recorded mention is announced (CR-F02).
129
+ function noteMention(text, at) {
130
+ const runs = session.snapshot?.status === 'ok' ? session.snapshot.runs : [];
131
+ const runId = namedRun(text, openRuns(runs).map(run => run.id));
132
+ if (!runId) return false;
133
+ session.chatMention = { runId, at };
134
+ return true;
135
+ }
136
+
137
+ // A `/clear` or a resumed transcript starts a new conversation without `session.start`: it starts without
138
+ // a chat run and counts changes from its own start (CR-F03). A host without the id keeps the session's.
139
+ async function followConversation($) {
140
+ let conversation = session.conversation;
141
+ try { conversation = await $.session.id(); } catch { /* no conversation id on this host */ }
142
+ if (session.conversation && conversation !== session.conversation) {
143
+ session.chatMention = null;
144
+ session.isBrowsing = false;
145
+ session.observation = null;
146
+ session.startedAt = await $.clock.now();
147
+ }
148
+ session.conversation = conversation;
149
+ }
150
+
151
+ function stopRefreshing() {
152
+ session.timer?.cancel();
153
+ session.timer = null;
154
+ }
155
+
156
+ // The timer is replaced before the first read, so overlapping starts never leave a second timer.
157
+ async function startRefreshing($) {
158
+ stopRefreshing();
159
+ session.timer = $.clock.every(REFRESH_MS, () => { void refresh($); });
160
+ await refresh($);
161
+ return $.ui.open({ id: PANE, title: t('title') });
162
+ }
163
+
164
+ const openedText = opened => (opened?.isPlaced === false ? t('command.waiting', { reason: opened.reason }) : t('command.enabled'));
165
+
166
+ async function loadSession($) {
167
+ session.startedAt = await $.clock.now();
168
+ session.root = await $.session.root();
169
+ session.labels = JSON.parse(await $.fs.read(`${$.plugin.root}/companion/locales.json`));
170
+ session.registry = JSON.parse(await $.fs.read(`${$.plugin.root}/meta/agdf-interaction-locales.json`));
171
+ const config = `${session.root}/.agdf/control/config.json`;
172
+ const configText = (await $.fs.exists(config)) ? await $.fs.read(config) : null;
173
+ // Without AGDF control, Claude's own `language` setting chooses the language (follow-up SDD-11).
174
+ let setting = null;
175
+ if (configText === null) {
176
+ try { setting = await $.settings.read({ key: 'language' }); } catch { /* no setting: the fallback locale */ }
177
+ }
178
+ session.locale = chatLocale(session.registry, configText, { setting, labels: session.labels });
179
+ // The About entry names the plugin version; a missing or unreadable manifest only leaves it out.
180
+ try {
181
+ const { version } = JSON.parse(await $.fs.read(`${$.plugin.root}/.claude-plugin/plugin.json`));
182
+ session.version = typeof version === 'string' ? version : null;
183
+ } catch { /* no version shown */ }
184
+ // The footer shows the plugin's own AGDF icon; without it the footer starts with the name.
185
+ try {
186
+ const icon = await $.fs.read(`${$.plugin.root}/assets/agdf-icon.svg`);
187
+ session.icon = icon.trimStart().startsWith('<svg') ? icon : null;
188
+ } catch { /* no icon shown */ }
189
+ const dir = pluginDataDir({ configDir: await $.env.get('CLAUDE_CONFIG_DIR'), userProfile: await $.env.get('USERPROFILE'), home: await $.env.get('HOME') });
190
+ session.statePath = dir ? `${dir}/${STATE_FILE}` : null;
191
+ if (session.statePath && (await $.fs.exists(session.statePath))) session.choices = parseCompanionState(await $.fs.read(session.statePath));
192
+ }
193
+
194
+ const wrappedRows = (value, columns) => (value ? Math.ceil(value.length / Math.max(columns, 10)) : 0);
195
+
196
+ // How many open runs the desktop list shows: the body rows left beside the other blocks, never fewer
197
+ // than the terminal's six (the pane then scrolls). One row of them goes to "+ N more" when runs remain.
198
+ export function listCapacity(view, { rows, columns, isAboutShown = false }) {
199
+ const blocks = [view.message, view.hint, view.stale].filter(Boolean);
200
+ const fixed = DESKTOP_ROWS.figure + DESKTOP_ROWS.footer + DESKTOP_ROWS.spare + (isAboutShown ? DESKTOP_ROWS.about : 0) + 1
201
+ + blocks.reduce((sum, value) => sum + wrappedRows(value, columns), 0) + DESKTOP_ROWS.gap * (blocks.length + 3);
202
+ return Math.max(LISTED_RUNS, Math.floor(rows - fixed));
203
+ }
204
+
205
+ // A run id shortened in the middle to `room` characters, so its date and sequence stay readable.
206
+ export function fitRunId(id, room) {
207
+ if (id.length <= room) return id;
208
+ const tail = Math.min(12, Math.floor((room - 1) / 2));
209
+ return `${id.slice(0, room - 1 - tail)}…${id.slice(id.length - tail)}`;
210
+ }
211
+
212
+ const press = ($, action) => async () => {
213
+ try { await action(); } catch { /* a failed action leaves the last drawing */ }
214
+ redraw($);
215
+ };
216
+
217
+ function body($, e, view) {
218
+ const { Box, Text, Button, Svg, Link, Select } = $.ui.resolve(e);
219
+ const isTerminal = e.surface === 'terminal' || !Svg;
220
+ const rows = e.props?.scroll?.bodyRows;
221
+ const fits = Number.isInteger(rows) && rows > 0;
222
+ const columns = Number.isInteger(e.props?.bodyColumns) ? e.props.bodyColumns : 40;
223
+ const select = runId => press($, async () => {
224
+ const root = session.root;
225
+ // A pick of another run than the chat's browses until the next main-loop turn (SDD-04, CR-F07).
226
+ if (view.chatRunId) session.isBrowsing = runId !== view.chatRunId;
227
+ await persist($, choices => { choices.selections[root] = runId; });
228
+ await refresh($);
229
+ });
230
+ const step = offset => press($, async () => {
231
+ const next = stepSelection(view.openRuns, view.runId ?? selection(), offset);
232
+ if (next) await select(next)();
233
+ });
234
+ const toggle = key => async () => { const value = !session.choices[key]; await persist($, choices => { choices[key] = value; }); };
235
+ // While another run than the chat's run is shown, the menu offers the way back first (SDD-05).
236
+ const canReturn = Boolean(view.chatRunId) && view.runId !== view.chatRunId;
237
+ const back = async () => { session.isBrowsing = false; };
238
+ const commands = [
239
+ ...(canReturn ? [['chat', t('actions.backToChat'), back]] : []),
240
+ ['still', session.choices.still ? t('actions.stillOff') : t('actions.stillOn'), toggle('still')],
241
+ ['retry', t('actions.retry'), () => refresh($)],
242
+ ['notice', session.choices.notice ? t('actions.noticeOff') : t('actions.noticeOn'), toggle('notice')],
243
+ ['sound', session.choices.sound ? t('actions.soundOff') : t('actions.soundOn'), toggle('sound')],
244
+ ['about', t('actions.about'), async () => { session.isAboutShown = true; }],
245
+ ];
246
+ // The actions open from the panel's foot (owner requests of 2026-10-28): the AGDF icon, the menu and
247
+ // the read time at the right edge, set off by a dim frame (a dim line on the terminal). Where the
248
+ // surface has a picker, the app draws the open menu itself as a popover above the footer; the picker
249
+ // always shows its neutral entry, the name, so every pick runs its action. The mobile app draws no
250
+ // picker and gets the name as a plain button that opens the entries above the footer.
251
+ const hasPicker = Boolean(Select) && PICKER_SURFACES.has(e.surface);
252
+ const run = action => press($, async () => { session.isMenuOpen = false; await action(); });
253
+ const trigger = hasPicker
254
+ ? h(Select, { key: MENU, value: MENU, options: [{ value: MENU, label: t('title') }, ...commands.map(([value, text]) => ({ value, label: text }))],
255
+ onSelect: value => { const command = commands.find(([key]) => key === value); return command ? run(command[2])() : undefined; } })
256
+ : h(Button, { key: MENU, plain: true, label: `${t('title')} ${session.isMenuOpen ? '▴' : '▾'}`,
257
+ onPress: press($, async () => { session.isMenuOpen = !session.isMenuOpen; }) });
258
+ const entries = !hasPicker && session.isMenuOpen
259
+ ? h(Box, { flexDirection: 'column', alignItems: 'flex-start', ...(isTerminal ? {} : { borderStyle: 'single', borderDimColor: true, paddingX: 1 }) },
260
+ ...commands.map(([key, text, action]) => h(Button, { key, plain: true, label: text, onPress: run(action) })))
261
+ : null;
262
+ const footer = h(Box, { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', gap: 1,
263
+ ...(isTerminal ? {} : { borderStyle: 'single', borderDimColor: true, paddingX: 1 }) },
264
+ h(Box, { flexDirection: 'row', alignItems: 'center', gap: 1, flexShrink: 1 },
265
+ !isTerminal && session.icon ? h(Svg, { source: session.icon, alt: 'AGDF', width: 20, height: 20 }) : null,
266
+ trigger),
267
+ view.readAt ? h(Box, { flexShrink: 0 }, h(Text, { dimColor: true }, view.readAt)) : null);
268
+ const actions = h(Box, { flexDirection: 'column', gap: isTerminal ? 0 : 1, flexShrink: 0 }, entries,
269
+ isTerminal ? h(Text, { dimColor: true }, '─'.repeat(Math.min(columns, 40))) : null, footer);
270
+ const about = session.isAboutShown ? h(Box, { flexDirection: 'column' },
271
+ h(Text, { weight: 'semibold' }, t('title')),
272
+ h(Text, { dimColor: true }, t('about.text')),
273
+ session.version ? h(Text, { dimColor: true }, t('about.version', { version: session.version })) : null,
274
+ Link ? h(Link, { href: ABOUT_URL, label: ABOUT_URL.slice('https://'.length) }) : h(Text, {}, ABOUT_URL),
275
+ h(Button, { key: 'about-close', plain: true, label: t('actions.closeAbout'), onPress: press($, async () => { session.isAboutShown = false; }) })) : null;
276
+ const capacity = !isTerminal && fits ? listCapacity(view, { rows: rows - BODY_RESERVE, columns, isAboutShown: session.isAboutShown }) : LISTED_RUNS;
277
+ // The terminal keeps its six; the desktop lists as many as fit and gives the last row to "+ N more".
278
+ const listed = isTerminal ? view.openRuns.slice(0, LISTED_RUNS)
279
+ : view.openRuns.length <= capacity ? view.openRuns : view.openRuns.slice(0, capacity - 1);
280
+ // One listed run: the id as a plain button and, where the pane has room for the widest listed bar, its
281
+ // condensed gate bar at the right edge, every id shortened to the same room (the same rule for all rows,
282
+ // live check of 2026-10-28). The bar keeps its width; an id that still runs over is cut by the surface.
283
+ const widest = Math.max(0, ...listed.map(run => run.bar?.length ?? 0));
284
+ const room = columns - widest - 2;
285
+ const withBars = widest > 0 && room >= ID_ROOM;
286
+ const runRow = run => {
287
+ const id = h(Button, { key: `run-${run.id}`, plain: true, label: withBars ? fitRunId(run.id, room) : run.id, onPress: select(run.id) });
288
+ return withBars && run.bar
289
+ ? h(Box, { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', gap: 1 },
290
+ h(Box, { flexShrink: 1 }, id), h(Box, { flexShrink: 0 }, h(Text, { dimColor: true, mono: true }, run.bar)))
291
+ : id;
292
+ };
293
+ // The stepping row stands under every shown run, the chat's run included (SDD-04).
294
+ const runList = view.openRuns.length
295
+ ? (view.runId
296
+ // The count has its own line, so the two stepping buttons fit the default width. The desktop
297
+ // draws a Button's label, which also names it, so the label is the visible localized text.
298
+ ? h(Box, { flexDirection: 'column' },
299
+ h(Text, { dimColor: true }, view.openCount),
300
+ h(Box, { flexDirection: 'row', gap: 1, alignItems: 'center' },
301
+ h(Button, { key: 'previous', label: t('actions.previous'), onPress: step(-1) }),
302
+ h(Button, { key: 'next', label: t('actions.next'), onPress: step(1) })),
303
+ canReturn ? h(Button, { key: 'chat-return', plain: true, label: t('actions.backToChat'), onPress: press($, back) }) : null)
304
+ : h(Box, { flexDirection: 'column' },
305
+ h(Text, { dimColor: true }, view.openCount),
306
+ ...listed.map(runRow),
307
+ !isTerminal && view.openRuns.length > listed.length ? h(Text, { dimColor: true }, t('fields.moreRuns', { count: view.openRuns.length - listed.length })) : null))
308
+ : null;
309
+ if (isTerminal) {
310
+ return h(Box, { flexDirection: 'column', gap: 1 },
311
+ h(Text, { color: COLOR[view.mood] }, terminalText(view, { labels: session.labels, locale: session.locale })), runList, about, actions);
312
+ }
313
+ const figure = h(Svg, { source: figureSvg(view.mood, { still: session.choices.still, title: `${view.title}: ${view.stateLabel}` }),
314
+ alt: `${view.title}: ${view.stateLabel}`, width: 200, height: 140, isInteractive: !session.choices.still });
315
+ // The body is as tall as the pane's body rows less the probed reserve and the content grows, so the
316
+ // footer sits at the bottom edge; a taller body scrolls with the footer last (live probes of
317
+ // 2026-10-28: a cell count sizes the body, a percentage does not; SDD-08).
318
+ return h(Box, { flexDirection: 'column', gap: 1, ...(fits ? { minHeight: rows - BODY_RESERVE } : {}) }, h(Box, { flexDirection: 'column', gap: 1, flexGrow: 1 },
319
+ h(Box, { flexDirection: 'column', alignItems: 'center' },
320
+ figure,
321
+ h(Text, { color: COLOR[view.mood], size: 'heading', weight: 'bold' }, view.stateLabel),
322
+ view.reason ? h(Text, { dimColor: true, wrap: 'truncate-end' }, view.reason) : null),
323
+ view.message ? h(Text, {}, view.message) : null,
324
+ view.hint ? h(Text, { dimColor: true }, view.hint) : null,
325
+ view.gateBar ? h(Text, { mono: true, wrap: 'truncate-end' }, view.gateBar) : null,
326
+ view.runId ? h(Box, { flexDirection: 'column' },
327
+ h(Text, { weight: 'semibold', wrap: 'truncate-end' }, view.runId),
328
+ view.origin ? h(Text, { dimColor: true }, view.origin) : null) : null,
329
+ view.objective ? h(Box, { flexDirection: 'row', gap: 1, alignItems: 'center' },
330
+ h(Text, { dimColor: true, wrap: view.isObjectiveExpanded ? 'wrap' : 'truncate-end' }, view.objective),
331
+ h(Button, { key: 'objective', plain: true, label: view.isObjectiveExpanded ? t('actions.collapse') : t('actions.expand'),
332
+ onPress: press($, async () => { session.isObjectiveExpanded = !session.isObjectiveExpanded; }) })) : null,
333
+ view.nextStep ? h(Box, { flexDirection: 'column' },
334
+ h(Text, { dimColor: true }, t('fields.nextStep')),
335
+ h(Text, {}, view.nextStep)) : null,
336
+ runList,
337
+ view.stale ? h(Text, { color: 'warning' }, view.stale) : null,
338
+ about),
339
+ actions);
340
+ }
341
+
342
+ // Each registration carries a `.catch` that passes the event on, so even an overrun or a
343
+ // misreturn leaves the host's own behaviour in place (SDD-10).
344
+ const passOn = ($, e, next) => next(e);
345
+
346
+ export const register = on => {
347
+ on('session.start', async ($, e, next) => {
348
+ try {
349
+ await loadSession($);
350
+ await $.command.register({ name: COMMAND, description: t('command.description'), immediate: true });
351
+ if (session.choices.enabled) await startRefreshing($);
352
+ } catch { /* the companion stays unavailable; AGDF is unaffected (SDD-10) */ }
353
+ return next(e);
354
+ }).catch(passOn);
355
+
356
+ on('command.run', { command: COMMAND }, async $ => {
357
+ try {
358
+ // A pane the person hid for this session comes back; the stored choice stays as it is.
359
+ if (session.choices.enabled && session.isHidden) {
360
+ session.isHidden = false;
361
+ return { text: openedText(await startRefreshing($)) };
362
+ }
363
+ const enabled = !session.choices.enabled;
364
+ if (!enabled) {
365
+ // Reading, the status line and the pane stop before the choice is stored, so a failing write
366
+ // leaves none of them running (CR-F03); the choice is stored even if closing the pane fails.
367
+ stopRefreshing();
368
+ silence($);
369
+ try {
370
+ await $.ui.close({ id: PANE });
371
+ } finally {
372
+ await persist($, choices => { choices.enabled = false; });
373
+ }
374
+ return { text: t('command.disabled') };
375
+ }
376
+ await persist($, choices => { choices.enabled = true; });
377
+ session.isHidden = false;
378
+ return { text: openedText(await startRefreshing($)) };
379
+ } catch (error) {
380
+ return { text: `${COMMAND}: ${String(error?.message ?? error).slice(0, 200)}` };
381
+ }
382
+ }).catch(() => ({ text: `${COMMAND}: unavailable` }));
383
+
384
+ on('turn.start', async ($, e, next) => {
385
+ try {
386
+ if (e.agentId === undefined && session.choices.enabled) {
387
+ // A main-loop turn ends browsing and may name the chat's run (chat-run navigation SDD-02, SDD-04);
388
+ // the host clock is read beside the event, never before it is passed on (SDD-11).
389
+ session.isBrowsing = false;
390
+ if (!session.isHidden) session.isTurnActive = true;
391
+ redraw($);
392
+ const prompt = e.text;
393
+ void $.clock.now().then(at => { if (noteMention(prompt, at)) { announce($); redraw($); } }).catch(() => {});
394
+ }
395
+ } catch { /* observation only */ }
396
+ return next(e);
397
+ }).catch(passOn);
398
+
399
+ on('turn.complete', async ($, e, next) => {
400
+ const answered = await next(e);
401
+ try {
402
+ if (e.agentId === undefined) {
403
+ // Cleared on every main-loop completion, also while switched off, so no stale overlay remains.
404
+ session.isTurnActive = false;
405
+ // The read runs after the host has its answer, never inside the hook; a hidden pane keeps
406
+ // the status line and toasts current (follow-up SDD-08). The turn's final answer (`e.answer`,
407
+ // else the text `next(e)` returned) is matched against that read at the turn's end time, so a
408
+ // run created during the turn counts (CR-F05, CR-F06).
409
+ if (session.choices.enabled) {
410
+ const answer = typeof e.answer === 'string' ? e.answer : answered?.text;
411
+ void (async () => {
412
+ const at = await $.clock.now();
413
+ await refresh($);
414
+ if (session.choices.enabled && noteMention(answer, at)) { announce($); redraw($); }
415
+ })().catch(() => {});
416
+ }
417
+ }
418
+ } catch { /* observation only */ }
419
+ return answered;
420
+ }).catch(passOn);
421
+
422
+ // Closing the pane by its own mark hides only the pane for this session (SDD-07); reading goes on
423
+ // for the status line and toasts until the companion is switched off (follow-up SDD-08). The host
424
+ // stamps `origin` as `{ kind: 'plugin' | 'person' | 'unload' }`.
425
+ on('ui.close', { id: PANE }, async ($, e, next) => {
426
+ try {
427
+ if (e.origin?.kind === 'person') session.isHidden = true;
428
+ } catch { /* observation only */ }
429
+ return next(e);
430
+ }).catch(passOn);
431
+
432
+ // A logic failure draws a neutral line instead of the panel; it never throws into the host.
433
+ on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
434
+ try {
435
+ return body($, e, buildPanelView({ snapshot: session.snapshot, sessionStartedAt: session.startedAt, selection: selection(),
436
+ mention: session.chatMention, isBrowsing: session.isBrowsing,
437
+ isTurnActive: session.isTurnActive, registry: session.registry, labels: session.labels, locale: session.locale,
438
+ columns: e.props?.bodyColumns ?? Infinity, isObjectiveExpanded: session.isObjectiveExpanded }));
439
+ } catch (error) {
440
+ const { Text } = $.ui.resolve(e);
441
+ return h(Text, { dimColor: true }, `AGDF Companion: ${String(error?.message ?? error).slice(0, 200)}`);
442
+ }
443
+ });
444
+ };
@@ -0,0 +1,110 @@
1
+ import { projectStoredRun } from './core.mjs';
2
+ // Bounded, read-only current-Run projection. Typed records and display policy come
3
+ // from the canonical pure Core modules. This does not qualify seals or file evidence
4
+ // and never authorizes a gate or command. File access remains injected by the host.
5
+
6
+ export const GATES = Object.freeze(['UR', 'PRD', 'SD', 'TP', 'QA', 'UAT', 'OR']);
7
+ // The internal steps between an approved TP and QA, shown as the build phase (SDD-02, SDD-03).
8
+ export const BUILD_GATES = Object.freeze(['Brownfield Analysis', 'CD+Tests', 'CR']);
9
+ export const isStructured = route => route === 'structured_delivery' || route === 'structured_slice';
10
+ // The host rejects reads over 4 MiB; the largest observed run state is about 280 KB.
11
+ export const MAX_RUN_STATE_BYTES = 1024 * 1024;
12
+ const TEXT_LIMIT = 240;
13
+
14
+ // The run lifecycles the core reader accepts (`LIFECYCLES` in run-state-parser.js); the logic suite
15
+ // asserts that both sets are equal, so a new core lifecycle fails it instead of reading unreadable.
16
+ export const LIFECYCLES = Object.freeze(['active', 'completed', 'superseded', 'abandoned']);
17
+ const KNOWN_LIFECYCLES = new Set(LIFECYCLES);
18
+ const plain = value => String(value ?? '').replace(/`/gu, '').trim();
19
+ const clip = text => (text.length > TEXT_LIMIT ? `${text.slice(0, TEXT_LIMIT - 1)}…` : text);
20
+
21
+ // Body of a level-two section, without its heading; '' when absent.
22
+ export function section(text, heading) {
23
+ const lines = text.split('\n');
24
+ const start = lines.findIndex(line => line.trimEnd() === `## ${heading}`);
25
+ if (start < 0) return '';
26
+ const rest = lines.slice(start + 1);
27
+ const end = rest.findIndex(line => line.startsWith('## '));
28
+ return (end < 0 ? rest : rest.slice(0, end)).join('\n');
29
+ }
30
+
31
+ const field = (body, key) => plain(body.match(new RegExp(`^- ${key}:[ \\t]*(.*)$`, 'mu'))?.[1]);
32
+
33
+ // Canonical writers keep a review or gate result in the Artefacts row of the step that produced it
34
+ // (`CR | … | revise`, `QA | … | block`); a Quick Task's Code Review is the CR row. The Run Meta
35
+ // `decision` stays `in_progress` (CR-F02).
36
+ const RESULT_ROWS = Object.freeze({ 'Quick Task Execution': ['CR'] });
37
+ const RESULTS = new Set(['revise', 'block', 'blocked']);
38
+ // The core's decision-content placeholder rule (`isDecisionContentPlaceholder`,
39
+ // decision-content-readiness.js), so a template objective is never shown as the run's goal.
40
+ const PROMPTS = new Set(['describe the trustworthy outcome.', 'what outcome should become possible?',
41
+ 'which tp tasks are fully done, partially done or not done?', 'what remains unverified?', 'which risks remain and what is their impact?']);
42
+ export function isPlaceholderText(value) {
43
+ if (typeof value !== 'string') return true;
44
+ const text = value.trim().replace(/^`([^`]+)`$/u, '$1').replace(/\s+/gu, ' ').toLowerCase();
45
+ return !text || PROMPTS.has(text)
46
+ || /^(?:todo|tbd|<[^>]+>|(?:draft|done|ready|blocked|pass|revise|block)(?:\s*\|\s*(?:draft|done|ready|blocked|pass|revise|block))+)$/u.test(text);
47
+ }
48
+
49
+ // Returns { ok: true, run } or { ok: false, id, reason } with reason missing | too_large | format.
50
+ // Only version 4 typed records are accepted; retired persisted derived tables are refused.
51
+ export function parseRunState(id, text) {
52
+ if (typeof text !== 'string') return { ok: false, id, reason: 'missing' };
53
+ if (text.length > MAX_RUN_STATE_BYTES) return { ok: false, id, reason: 'too_large' };
54
+ const normalized = text.replace(/^/u, '').replace(/\r\n?/gu, '\n');
55
+ const meta = section(normalized, 'Run Meta');
56
+ let projection; try { projection = projectStoredRun(normalized); } catch { return { ok: false, id, reason: 'format' }; }
57
+ const control = projection.control;
58
+ const runId = field(meta, 'run_id');
59
+ const lifecycle = field(meta, 'lifecycle');
60
+ const gate = control.current_gate;
61
+ const decision = lifecycle === 'completed' ? 'completed' : 'in_progress';
62
+ const updatedAt = Number.isNaN(Date.parse(field(meta, 'updated_at'))) ? '' : field(meta, 'updated_at');
63
+ if (!meta || runId !== id || !KNOWN_LIFECYCLES.has(lifecycle) || !gate) return { ok: false, id, reason: 'format' };
64
+ const objective = section(normalized, 'Objective').split('\n').map(line => line.trim()).find(Boolean) ?? '';
65
+ const statuses = new Map([...projection.facts.artefacts].map(([name, row]) => [name, row.status]));
66
+ const gateResult = (RESULT_ROWS[gate] ?? [gate]).map(type => statuses.get(type)).find(status => RESULTS.has(status)) ?? null;
67
+ return { ok: true, run: Object.freeze({
68
+ id,
69
+ lifecycle,
70
+ gate,
71
+ decision,
72
+ route: projection.route,
73
+ gateResult,
74
+ gateDecision: control.presentation_decision?.action ?? null,
75
+ updatedAt,
76
+ missing: clip(projection.facts.artefacts.get(gate)?.path || gate === 'UAT' ? control.missing_approval ?? '' : 'none'),
77
+ next: clip(control.next_allowed_action ?? ''),
78
+ approved: Object.freeze([...projection.facts.approvals].filter(([, row]) => row.status === 'approved').map(([name]) => name)),
79
+ objective: isPlaceholderText(objective) ? '' : clip(objective),
80
+ }) };
81
+ }
82
+
83
+ // Reads every run state below <projectRoot>/.agdf/control/runs through the injected file access
84
+ // ({ exists, list, read }, as `$.fs` provides). Never writes. A failing directory read is
85
+ // transient (status 'failed'); a single unreadable run state is reported per run. Without a
86
+ // control folder the snapshot names the checked project root, so the panel can say where it looked.
87
+ export async function readSnapshot(fs, projectRoot, { now }) {
88
+ const runsDir = `${projectRoot}/.agdf/control/runs`;
89
+ try {
90
+ if (!(await fs.exists(`${projectRoot}/.agdf/control`))) return { status: 'no_control', root: projectRoot, runs: [], unreadable: [], readAt: now };
91
+ if (!(await fs.exists(runsDir))) return { status: 'ok', runs: [], unreadable: [], readAt: now };
92
+ const folders = (await fs.list(runsDir)).filter(entry => entry.kind === 'dir' && !entry.isLink);
93
+ const results = await Promise.all(folders.map(folder => fs.read(`${runsDir}/${folder.name}/RUN_STATE.md`)
94
+ .then(text => parseRunState(folder.name, text), () => ({ ok: false, id: folder.name, reason: 'missing' }))));
95
+ return {
96
+ status: 'ok',
97
+ runs: results.filter(result => result.ok).map(result => result.run),
98
+ unreadable: results.filter(result => !result.ok).map(({ id, reason }) => ({ id, reason })),
99
+ readAt: now,
100
+ };
101
+ } catch (error) {
102
+ return { status: 'failed', runs: [], unreadable: [], readAt: now, error: String(error?.message ?? error).slice(0, TEXT_LIMIT) };
103
+ }
104
+ }
105
+
106
+ // A transient failure keeps the last good snapshot, marked stale with the failed read time (AC-006).
107
+ export function settleSnapshot(previous, next) {
108
+ if (next.status !== 'failed' || !previous || previous.status === 'failed') return next;
109
+ return { ...previous, stale: { failedAt: next.readAt, error: next.error } };
110
+ }
@@ -0,0 +1,48 @@
1
+ // State rules (AC-003, AC-002 of the follow-up): which of the five moods a run shows and why, as a
2
+ // reason descriptor the view localizes. A run matching no rule is reported unreadable rather than
3
+ // guessed (SDD-04).
4
+
5
+ import { BUILD_GATES, isStructured } from './run-state.mjs';
6
+
7
+ export const MOODS = Object.freeze(['laeuft', 'baut', 'wartet', 'blockiert', 'fertig']);
8
+ const BLOCKING = new Set(['revise', 'block', 'blocked', 'decline']);
9
+ const AWAITING = new Set(['pending', 'awaiting_uat']);
10
+ const WORKING = new Set(['in_progress', 'pass', 'qa_approved', 'completed']);
11
+
12
+ // The gate a pending approval names, as in "Exact Approval: QA." or "Exact Approval: PRD for the new revision."
13
+ export const pendingApproval = missing => String(missing ?? '').match(/\bApproval: (UR|PRD|SD|TP|QA|UAT|OR)\b/u)?.[1] ?? null;
14
+
15
+ // The blocking outcome of a run: a legacy Run Meta decision, the current gate's recorded result
16
+ // (`revise`, `block`, `blocked`) or a deliberate decision on its presented material.
17
+ function blockingOutcome(run) {
18
+ if (BLOCKING.has(run.decision)) return run.decision;
19
+ if (run.gateResult) return run.gateResult;
20
+ return { reject: 'decline', request_change: 'revise' }[run.gateDecision] ?? null;
21
+ }
22
+
23
+ // { mood, reason: { key, gate?, decision? } } or { mood: null, reason: { key: 'unknownState' } }.
24
+ // A structured run between an approved TP and QA (Brownfield Analysis, CD+Tests, CR) is being built.
25
+ export function runState(run) {
26
+ if (run.lifecycle === 'completed') return { mood: 'fertig', reason: { key: 'done' } };
27
+ const outcome = blockingOutcome(run);
28
+ if (outcome) return { mood: 'blockiert', reason: { key: 'blocked', gate: run.gate, decision: outcome } };
29
+ const approval = pendingApproval(run.missing);
30
+ if (approval) return { mood: 'wartet', reason: { key: 'waitingApproval', gate: approval } };
31
+ if (AWAITING.has(run.decision)) return { mood: 'wartet', reason: { key: 'waitingDecision', gate: run.gate } };
32
+ if (WORKING.has(run.decision) && isStructured(run.route) && BUILD_GATES.includes(run.gate)) return { mood: 'baut', reason: { key: 'building', gate: run.gate } };
33
+ if (WORKING.has(run.decision)) return { mood: 'laeuft', reason: { key: 'working', gate: run.gate } };
34
+ return { mood: null, reason: { key: 'unknownState' } };
35
+ }
36
+
37
+ // Moods a main-loop turn does not cover: a run being built stays baut, and a run waiting for an
38
+ // approval or a decision stays wartet, since the chat usually asks for it during that turn (chat-run
39
+ // navigation SDD-07). A blocked run shows läuft, since the chat usually resolves it.
40
+ const THROUGH_TURN = new Set(['baut', 'wartet']);
41
+
42
+ // A main-loop turn in progress shows läuft for every other mood; the run-derived state returns after
43
+ // the turn.
44
+ export function displayState(run, { isTurnActive = false } = {}) {
45
+ const derived = runState(run);
46
+ if (isTurnActive && derived.mood !== null && !THROUGH_TURN.has(derived.mood)) return { mood: 'laeuft', reason: { key: 'turnActive' } };
47
+ return derived;
48
+ }