create-agdf 0.30.0 → 0.31.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 (341) hide show
  1. package/generated/.agdf/control/README.md +5 -0
  2. package/generated/.agdf/control/templates/BRAND.md +28 -0
  3. package/generated/.agdf/control/templates/artefacts/PRD.md +11 -0
  4. package/generated/.agdf/control/templates/artefacts/SD.md +4 -0
  5. package/generated/.agdf/control/templates/artefacts/UX_INTENT_DEFINITION.md +1 -1
  6. package/generated/.opencode/agdf-interaction-locales.json +292 -2
  7. package/generated/.opencode/contracts/gate-artifact-preparation.md +9 -3
  8. package/generated/.opencode/contracts/interaction.md +10 -4
  9. package/generated/.opencode/contracts/modes.md +5 -0
  10. package/generated/.opencode/contracts/prd-definition.md +40 -1
  11. package/generated/.opencode/contracts/quality.md +35 -0
  12. package/generated/.opencode/contracts/request-activation.md +6 -3
  13. package/generated/.opencode/contracts/sd-definition.md +46 -0
  14. package/generated/.opencode/contracts/tp-definition.md +8 -0
  15. package/generated/.opencode/contracts/ur-definition.md +9 -5
  16. package/generated/.opencode/skills/agdf-ux-intent-definition/SKILL.md +31 -2
  17. package/generated/plugins/agdf/.claude-plugin/plugin.json +1 -1
  18. package/generated/plugins/agdf/.codex-plugin/plugin.json +1 -1
  19. package/generated/plugins/agdf/companion/events.mjs +117 -0
  20. package/generated/plugins/agdf/companion/figure.mjs +6 -6
  21. package/generated/plugins/agdf/companion/gate-bar.mjs +10 -28
  22. package/generated/plugins/agdf/companion/localization.mjs +10 -32
  23. package/generated/plugins/agdf/companion/notice.mjs +10 -8
  24. package/generated/plugins/agdf/companion/register.mjs +229 -43
  25. package/generated/plugins/agdf/companion/run-state.mjs +77 -90
  26. package/generated/plugins/agdf/companion/state.mjs +6 -32
  27. package/generated/plugins/agdf/companion/view.mjs +57 -12
  28. package/generated/plugins/agdf/control/README.md +5 -0
  29. package/generated/plugins/agdf/control/templates/BRAND.md +28 -0
  30. package/generated/plugins/agdf/control/templates/artefacts/PRD.md +11 -0
  31. package/generated/plugins/agdf/control/templates/artefacts/SD.md +4 -0
  32. package/generated/plugins/agdf/control/templates/artefacts/UX_INTENT_DEFINITION.md +1 -1
  33. package/generated/plugins/agdf/mcp/server/README.md +26 -2
  34. package/generated/plugins/agdf/mcp/server/package.json +3 -3
  35. package/generated/plugins/agdf/mcp/server/src/generation-runtime.js +11 -2
  36. package/generated/plugins/agdf/mcp/server/src/main.js +1 -0
  37. package/generated/plugins/agdf/mcp/server/src/next-action.js +227 -0
  38. package/generated/plugins/agdf/mcp/server/src/prepared-call-transport.js +306 -0
  39. package/generated/plugins/agdf/mcp/server/src/safe-read-continuation.js +62 -0
  40. package/generated/plugins/agdf/mcp/server/src/server.js +139 -35
  41. package/generated/plugins/agdf/mcp/server/ui/cockpit.html +2 -2
  42. package/generated/plugins/agdf/mcp/server/ui/decision-manifest.json +3 -3
  43. package/generated/plugins/agdf/mcp/server/ui/decision.html +2 -2
  44. package/generated/plugins/agdf/mcp/server/ui/manifest.json +3 -3
  45. package/generated/plugins/agdf/meta/agdf-interaction-locales.json +292 -2
  46. package/generated/plugins/agdf/meta/agdf-mcp-capability.json +1 -1
  47. package/generated/plugins/agdf/meta/agdf-plugin.definition.json +1 -1
  48. package/generated/plugins/agdf/meta/contracts/gate-artifact-preparation.md +9 -3
  49. package/generated/plugins/agdf/meta/contracts/interaction.md +10 -4
  50. package/generated/plugins/agdf/meta/contracts/modes.md +5 -0
  51. package/generated/plugins/agdf/meta/contracts/prd-definition.md +40 -1
  52. package/generated/plugins/agdf/meta/contracts/quality.md +35 -0
  53. package/generated/plugins/agdf/meta/contracts/request-activation.md +6 -3
  54. package/generated/plugins/agdf/meta/contracts/sd-definition.md +46 -0
  55. package/generated/plugins/agdf/meta/contracts/tp-definition.md +8 -0
  56. package/generated/plugins/agdf/meta/contracts/ur-definition.md +9 -5
  57. package/generated/plugins/agdf/meta/copilot-payload-baseline.json +3 -3
  58. package/generated/plugins/agdf/meta/distribution-profile-history.json +7 -0
  59. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-interaction-locales.json +292 -2
  60. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-plugin.definition.json +1 -1
  61. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/gate-artifact-preparation.md +9 -3
  62. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/interaction.md +10 -4
  63. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/modes.md +5 -0
  64. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/prd-definition.md +40 -1
  65. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/quality.md +35 -0
  66. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/request-activation.md +6 -3
  67. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/sd-definition.md +46 -0
  68. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/tp-definition.md +8 -0
  69. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/ur-definition.md +9 -5
  70. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/command-registry.js +2 -1
  71. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/parse-args.js +7 -4
  72. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/project-read-command.js +29 -0
  73. package/generated/plugins/agdf/runtime/create-agdf/lib/cli/validation-handlers.js +2 -1
  74. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-dispatch-runtime.js +32 -6
  75. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/package.js +7 -0
  76. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/plugin-runtime.js +34 -6
  77. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/prepared-call-journal.js +269 -0
  78. package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-worker-runtime.js +86 -83
  79. package/generated/plugins/agdf/runtime/create-agdf/lib/runtime/validator-application.js +2 -2
  80. package/generated/plugins/agdf/runtime/create-agdf/package.json +1 -1
  81. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/companion/events.js +154 -0
  82. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/companion/figure-state.js +36 -0
  83. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/companion/journal.js +180 -0
  84. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/companion/run-view.js +184 -0
  85. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/acceptance-criteria.js +2 -0
  86. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/closeout-readiness.js +24 -6
  87. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-check.js +44 -6
  88. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy-inputs.js +2 -0
  89. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy-pure.js +7 -3
  90. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/prd-readiness.js +7 -2
  91. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/report-decision.js +9 -0
  92. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/traceability-readiness.js +57 -8
  93. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/ur-readiness.js +15 -2
  94. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/artifact-readiness.js +5 -3
  95. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/authoring-inputs.js +107 -22
  96. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit.js +4 -20
  97. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/contract.js +64 -24
  98. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/material-recording-calls.js +54 -0
  99. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/project-state.js +2 -1
  100. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/run-classification.js +31 -0
  101. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/selection.js +6 -0
  102. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/service.js +32 -5
  103. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/authoring-text-handoff.js +3 -0
  104. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/input-resolution.js +7 -5
  105. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/material-limits.js +4 -0
  106. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/prepared-control-calls.js +137 -0
  107. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/presentation-delivery.js +4 -1
  108. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-contract.js +10 -4
  109. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-schema.js +9 -3
  110. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-service.js +35 -11
  111. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-identity.js +2 -0
  112. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-inventory-reader.js +5 -3
  113. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-material.js +25 -7
  114. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation-render.js +84 -28
  115. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision.js +38 -20
  116. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-source-revisions.js +37 -17
  117. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-reader.js +10 -3
  118. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-steps.js +8 -5
  119. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/index.js +3 -1
  120. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/interaction-catalog-validation.js +6 -1
  121. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/interaction-catalog.js +8 -0
  122. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/interaction-presentation.js +26 -1
  123. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-hints.js +30 -1
  124. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/mcp-tool-errors.js +5 -3
  125. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/resources/canonical-init-plan.js +1 -1
  126. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/runtime/plugin-provenance.js +9 -2
  127. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/contract.js +6 -4
  128. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/delivery-intake.js +3 -1
  129. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/mcp-continuation.js +25 -2
  130. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/prd-definition.js +3 -2
  131. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/readiness-findings.js +7 -0
  132. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/sd-definition.js +4 -2
  133. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/service.js +17 -4
  134. package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/tp-definition.js +4 -2
  135. package/generated/plugins/agdf/runtime/runtime-manifest.json +2 -2
  136. package/generated/plugins/agdf/scripts/check-runtime-integrity.mjs +4 -3
  137. package/generated/plugins/agdf/skills/ux-intent-definition/SKILL.md +31 -2
  138. package/generated/plugins/agdf/skills/ux-intent-definition/help.md +8 -1
  139. package/generated/plugins/agdf/submission/openai/availability.md +1 -1
  140. package/generated/plugins/agdf/submission/openai/capability-matrix.json +1 -1
  141. package/generated/plugins/agdf/submission/openai/release-notes.md +8 -8
  142. package/generated/plugins/agdf/submission/openai/reviewer-cases.json +1 -1
  143. package/generated/plugins/agdf-planning/.codex-plugin/plugin.json +1 -1
  144. package/generated/plugins/agdf-planning/plugin.json +1 -1
  145. package/generated/plugins/copilot/agdf/.agdf-payload-inventory.json +332 -195
  146. package/generated/plugins/copilot/agdf/control/README.md +5 -0
  147. package/generated/plugins/copilot/agdf/control/templates/BRAND.md +28 -0
  148. package/generated/plugins/copilot/agdf/control/templates/artefacts/PRD.md +11 -0
  149. package/generated/plugins/copilot/agdf/control/templates/artefacts/SD.md +4 -0
  150. package/generated/plugins/copilot/agdf/control/templates/artefacts/UX_INTENT_DEFINITION.md +1 -1
  151. package/generated/plugins/copilot/agdf/mcp/server/README.md +26 -2
  152. package/generated/plugins/copilot/agdf/mcp/server/package.json +3 -3
  153. package/generated/plugins/copilot/agdf/mcp/server/src/generation-runtime.js +11 -2
  154. package/generated/plugins/copilot/agdf/mcp/server/src/main.js +1 -0
  155. package/generated/plugins/copilot/agdf/mcp/server/src/next-action.js +227 -0
  156. package/generated/plugins/copilot/agdf/mcp/server/src/prepared-call-transport.js +306 -0
  157. package/generated/plugins/copilot/agdf/mcp/server/src/safe-read-continuation.js +62 -0
  158. package/generated/plugins/copilot/agdf/mcp/server/src/server.js +139 -35
  159. package/generated/plugins/copilot/agdf/meta/agdf-plugin.definition.json +1 -1
  160. package/generated/plugins/copilot/agdf/meta/distribution-profile-history.json +7 -0
  161. package/generated/plugins/copilot/agdf/plugin.json +1 -1
  162. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-interaction-locales.json +292 -2
  163. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-plugin.definition.json +1 -1
  164. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/gate-artifact-preparation.md +9 -3
  165. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/interaction.md +10 -4
  166. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/modes.md +5 -0
  167. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/prd-definition.md +40 -1
  168. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/quality.md +35 -0
  169. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/request-activation.md +6 -3
  170. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/sd-definition.md +46 -0
  171. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/tp-definition.md +8 -0
  172. package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/ur-definition.md +9 -5
  173. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/command-registry.js +2 -1
  174. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/parse-args.js +7 -4
  175. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/project-read-command.js +29 -0
  176. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/validation-handlers.js +2 -1
  177. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-dispatch-runtime.js +32 -6
  178. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/package.js +7 -0
  179. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/plugin-runtime.js +34 -6
  180. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/prepared-call-journal.js +269 -0
  181. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-worker-runtime.js +81 -78
  182. package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/runtime/validator-application.js +2 -2
  183. package/generated/plugins/copilot/agdf/runtime/create-agdf/package.json +1 -1
  184. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/companion/events.js +154 -0
  185. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/companion/figure-state.js +36 -0
  186. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/companion/journal.js +180 -0
  187. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/companion/run-view.js +184 -0
  188. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/acceptance-criteria.js +2 -0
  189. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/closeout-readiness.js +24 -6
  190. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-check.js +44 -6
  191. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy-inputs.js +2 -0
  192. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy-pure.js +7 -3
  193. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/prd-readiness.js +7 -2
  194. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/report-decision.js +9 -0
  195. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/traceability-readiness.js +57 -8
  196. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/ur-readiness.js +15 -2
  197. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/artifact-readiness.js +5 -3
  198. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/authoring-inputs.js +107 -22
  199. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/contract.js +64 -24
  200. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/material-recording-calls.js +54 -0
  201. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/project-state.js +2 -1
  202. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/run-classification.js +31 -0
  203. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/selection.js +6 -0
  204. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/service.js +32 -5
  205. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/authoring-text-handoff.js +3 -0
  206. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/input-resolution.js +7 -5
  207. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/material-limits.js +4 -0
  208. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/prepared-control-calls.js +137 -0
  209. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/presentation-delivery.js +4 -1
  210. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-contract.js +10 -4
  211. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-schema.js +9 -3
  212. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-service.js +35 -11
  213. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-identity.js +2 -0
  214. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-inventory-reader.js +5 -3
  215. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-material.js +25 -7
  216. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation-render.js +84 -28
  217. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision.js +38 -20
  218. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-source-revisions.js +37 -17
  219. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-reader.js +10 -3
  220. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-steps.js +8 -5
  221. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/index.js +3 -1
  222. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/interaction-catalog-validation.js +6 -1
  223. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/interaction-catalog.js +8 -0
  224. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/interaction-presentation.js +26 -1
  225. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-hints.js +30 -1
  226. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/mcp-tool-errors.js +5 -3
  227. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/resources/canonical-init-plan.js +1 -1
  228. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/runtime/plugin-provenance.js +9 -2
  229. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/contract.js +6 -4
  230. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/delivery-intake.js +3 -1
  231. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/mcp-continuation.js +25 -2
  232. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/prd-definition.js +3 -2
  233. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/readiness-findings.js +7 -0
  234. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/sd-definition.js +4 -2
  235. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/service.js +17 -4
  236. package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/tp-definition.js +4 -2
  237. package/generated/plugins/copilot/agdf/runtime/runtime-manifest.json +2 -2
  238. package/generated/plugins/copilot/agdf/skills/agdf-interaction-locales.json +1 -1
  239. package/generated/plugins/copilot/agdf/skills/agdf-ux-intent-definition/SKILL.md +31 -2
  240. package/generated/plugins/copilot/agdf/skills/contracts/gate-artifact-preparation.md +9 -3
  241. package/generated/plugins/copilot/agdf/skills/contracts/interaction.md +10 -4
  242. package/generated/plugins/copilot/agdf/skills/contracts/modes.md +5 -0
  243. package/generated/plugins/copilot/agdf/skills/contracts/prd-definition.md +40 -1
  244. package/generated/plugins/copilot/agdf/skills/contracts/quality.md +35 -0
  245. package/generated/plugins/copilot/agdf/skills/contracts/request-activation.md +6 -3
  246. package/generated/plugins/copilot/agdf/skills/contracts/sd-definition.md +46 -0
  247. package/generated/plugins/copilot/agdf/skills/contracts/tp-definition.md +8 -0
  248. package/generated/plugins/copilot/agdf/skills/contracts/ur-definition.md +9 -5
  249. package/generated/submissions/openai/agdf/.codex-plugin/plugin.json +1 -1
  250. package/generated/submissions/openai/agdf/meta/agdf-interaction-locales.json +292 -2
  251. package/generated/submissions/openai/agdf/meta/agdf-plugin.definition.json +1 -1
  252. package/generated/submissions/openai/agdf/meta/contracts/gate-artifact-preparation.md +9 -3
  253. package/generated/submissions/openai/agdf/meta/contracts/interaction.md +10 -4
  254. package/generated/submissions/openai/agdf/meta/contracts/modes.md +5 -0
  255. package/generated/submissions/openai/agdf/meta/contracts/prd-definition.md +40 -1
  256. package/generated/submissions/openai/agdf/meta/contracts/quality.md +35 -0
  257. package/generated/submissions/openai/agdf/meta/contracts/request-activation.md +6 -3
  258. package/generated/submissions/openai/agdf/meta/contracts/sd-definition.md +46 -0
  259. package/generated/submissions/openai/agdf/meta/contracts/tp-definition.md +8 -0
  260. package/generated/submissions/openai/agdf/meta/contracts/ur-definition.md +9 -5
  261. package/generated/submissions/openai/agdf/meta/copilot-payload-baseline.json +3 -3
  262. package/generated/submissions/openai/agdf/meta/distribution-profile-history.json +7 -0
  263. package/generated/submissions/openai/agdf/plugin.json +1 -1
  264. package/generated/submissions/openai/agdf/skills/ux-intent-definition/SKILL.md +31 -2
  265. package/generated/submissions/openai/agdf/skills/ux-intent-definition/help.md +8 -1
  266. package/generated/submissions/openai/agdf/submission/openai/availability.md +1 -1
  267. package/generated/submissions/openai/agdf/submission/openai/capability-matrix.json +1 -1
  268. package/generated/submissions/openai/agdf/submission/openai/inventory.json +24 -24
  269. package/generated/submissions/openai/agdf/submission/openai/listing.json +1 -1
  270. package/generated/submissions/openai/agdf/submission/openai/readiness.json +2 -2
  271. package/generated/submissions/openai/agdf/submission/openai/readiness.md +2 -2
  272. package/generated/submissions/openai/agdf/submission/openai/release-notes.md +8 -8
  273. package/generated/submissions/openai/agdf/submission/openai/reviewer-cases.json +1 -1
  274. package/lib/cli/command-registry.js +2 -1
  275. package/lib/cli/parse-args.js +7 -4
  276. package/lib/cli/project-read-command.js +29 -0
  277. package/lib/cli/validation-handlers.js +2 -1
  278. package/lib/mcp-dispatch-runtime.js +32 -6
  279. package/lib/mcp-lifecycle/package.js +7 -0
  280. package/lib/mcp-lifecycle/plugin-runtime.js +34 -6
  281. package/lib/mcp-lifecycle/prepared-call-journal.js +269 -0
  282. package/lib/mcp-worker-runtime.js +86 -83
  283. package/lib/runtime/validator-application.js +2 -2
  284. package/lib/scaffold/plan.js +2 -0
  285. package/package.json +1 -1
  286. package/runtime/core/lib/companion/events.js +154 -0
  287. package/runtime/core/lib/companion/figure-state.js +36 -0
  288. package/runtime/core/lib/companion/journal.js +180 -0
  289. package/runtime/core/lib/companion/run-view.js +184 -0
  290. package/runtime/core/lib/control-evaluation/acceptance-criteria.js +2 -0
  291. package/runtime/core/lib/control-evaluation/closeout-readiness.js +24 -6
  292. package/runtime/core/lib/control-evaluation/gate-check.js +44 -6
  293. package/runtime/core/lib/control-evaluation/gate-policy-inputs.js +2 -0
  294. package/runtime/core/lib/control-evaluation/gate-policy-pure.js +7 -3
  295. package/runtime/core/lib/control-evaluation/prd-readiness.js +7 -2
  296. package/runtime/core/lib/control-evaluation/report-decision.js +9 -0
  297. package/runtime/core/lib/control-evaluation/traceability-readiness.js +57 -8
  298. package/runtime/core/lib/control-evaluation/ur-readiness.js +15 -2
  299. package/runtime/core/lib/control-inspect/artifact-readiness.js +5 -3
  300. package/runtime/core/lib/control-inspect/authoring-inputs.js +107 -22
  301. package/runtime/core/lib/control-inspect/cockpit.js +4 -20
  302. package/runtime/core/lib/control-inspect/contract.js +64 -24
  303. package/runtime/core/lib/control-inspect/material-recording-calls.js +54 -0
  304. package/runtime/core/lib/control-inspect/project-state.js +2 -1
  305. package/runtime/core/lib/control-inspect/run-classification.js +31 -0
  306. package/runtime/core/lib/control-inspect/selection.js +6 -0
  307. package/runtime/core/lib/control-inspect/service.js +32 -5
  308. package/runtime/core/lib/control-state/authoring-text-handoff.js +3 -0
  309. package/runtime/core/lib/control-state/input-resolution.js +7 -5
  310. package/runtime/core/lib/control-state/material-limits.js +4 -0
  311. package/runtime/core/lib/control-state/prepared-control-calls.js +137 -0
  312. package/runtime/core/lib/control-state/presentation-delivery.js +4 -1
  313. package/runtime/core/lib/control-state/run-command-contract.js +10 -4
  314. package/runtime/core/lib/control-state/run-command-schema.js +9 -3
  315. package/runtime/core/lib/control-state/run-command-service.js +35 -11
  316. package/runtime/core/lib/control-state/run-identity.js +2 -0
  317. package/runtime/core/lib/control-state/run-inventory-reader.js +5 -3
  318. package/runtime/core/lib/control-state/run-material.js +25 -7
  319. package/runtime/core/lib/control-state/run-presentation-render.js +84 -28
  320. package/runtime/core/lib/control-state/run-revision.js +38 -20
  321. package/runtime/core/lib/control-state/run-source-revisions.js +37 -17
  322. package/runtime/core/lib/control-state/run-state-reader.js +10 -3
  323. package/runtime/core/lib/control-state/run-steps.js +8 -5
  324. package/runtime/core/lib/index.js +3 -1
  325. package/runtime/core/lib/interaction-catalog-validation.js +6 -1
  326. package/runtime/core/lib/interaction-catalog.js +8 -0
  327. package/runtime/core/lib/interaction-presentation.js +26 -1
  328. package/runtime/core/lib/mcp-input-hints.js +30 -1
  329. package/runtime/core/lib/mcp-tool-errors.js +5 -3
  330. package/runtime/core/lib/resources/canonical-init-plan.js +1 -1
  331. package/runtime/core/lib/runtime/plugin-provenance.js +9 -2
  332. package/runtime/core/lib/skill-dispatch/contract.js +6 -4
  333. package/runtime/core/lib/skill-dispatch/delivery-intake.js +3 -1
  334. package/runtime/core/lib/skill-dispatch/mcp-continuation.js +25 -2
  335. package/runtime/core/lib/skill-dispatch/prd-definition.js +3 -2
  336. package/runtime/core/lib/skill-dispatch/readiness-findings.js +7 -0
  337. package/runtime/core/lib/skill-dispatch/sd-definition.js +4 -2
  338. package/runtime/core/lib/skill-dispatch/service.js +17 -4
  339. package/runtime/core/lib/skill-dispatch/tp-definition.js +4 -2
  340. package/generated/plugins/agdf/companion/core.mjs +0 -16
  341. package/generated/plugins/agdf/companion/locales.json +0 -200
@@ -1,13 +1,18 @@
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
1
+ // AGDF Companion host adapter (SDD-07 to SDD-10; follow-up SDD-05 to SDD-12; companion core SDD-007, SDD-010):
2
+ // the `/agdf-companion` command, the persisted choices, main-loop turn observation, the refresh cadence,
3
+ // the own pane, the status line and toasts. Run state comes only from the plugin runtime's read-only
4
+ // `run-view` command through `$.process`, called on a changed run-file fingerprint, a new journal event
5
+ // of this root or a changed language; the companion imports no Core module. Observation only: no
6
+ // gating hook, every hook passes its event on through a catch path, and nothing is written under
7
+ // .agdf/control. Session state lives in this module and is
5
8
  // redrawn through `$.ui.invalidate`. Elements come from the surface table and are built with the
6
9
  // host's global `h`.
7
10
 
8
11
  import { assignRun, namedRun, openRuns, stepSelection } from './assignment.mjs';
12
+ import { EVENT_POLL_MS, JOURNAL_FILE, JOURNAL_READ_LIMIT, JOURNAL_ROTATED_FILE, PANE_EVENTS, STICKY_KINDS, TOAST_KINDS, eventText,
13
+ isConfirmed, isStillUncertain, journalDirectory, namedEventText, parseJournal, unseenEvents } from './events.mjs';
9
14
  import { figureSvg } from './figure.mjs';
10
- import { chatLocale, label } from './localization.mjs';
15
+ import { chatLocale, companionLabels, gateTitle, label } from './localization.mjs';
11
16
  import { CHIME, chimeClip, noticeText, observeNotice, observedRun, statusText } from './notice.mjs';
12
17
  import { STATE_FILE, defaultCompanionState, parseCompanionState, pluginDataDir, serializeCompanionState } from './persistence.mjs';
13
18
  import { readSnapshot, settleSnapshot } from './run-state.mjs';
@@ -36,10 +41,17 @@ const ID_ROOM = 18;
36
41
  const COLOR = Object.freeze({ laeuft: 'suggestion', baut: 'suggestion', wartet: 'warning', blockiert: 'error', fertig: 'success' });
37
42
 
38
43
  function createSession() {
39
- return { startedAt: 0, root: '', registry: null, labels: null, locale: 'en', statePath: null, version: null, icon: null,
44
+ return { startedAt: 0, root: '', registry: null, labels: null, locale: 'en', statePath: null, dataDir: null, version: null, icon: null,
40
45
  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 };
46
+ isPreviewExpanded: false, isAboutShown: false, isMenuOpen: false, timer: null, eventTimer: null, reads: 0, appliedRead: 0,
47
+ observation: null, chatMention: null, isBrowsing: false, conversation: null,
48
+ // Companion core SDD-007: the run-file fingerprint of the last run-view call, the journal cursor and
49
+ // stamp, this root's events since the last main-loop turn and the drift warnings already announced.
50
+ fingerprint: null, journalCursor: null, journalStamp: null, eventsAvailable: null, events: [], driftSeen: null,
51
+ // Durable events of this root waiting for a fresh run view to confirm them (CR delta review RV-1).
52
+ unconfirmed: [],
53
+ // The start's first read, running beside the host (CR finding B5).
54
+ background: null };
43
55
  }
44
56
 
45
57
  // One companion per session: the module is loaded once per session.
@@ -47,8 +59,15 @@ const session = createSession();
47
59
  const t = (path, params) => label(session.labels, session.locale, path, params);
48
60
  const selection = () => session.choices.selections[session.root] ?? null;
49
61
  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) });
62
+ // Event toasts name a run only when it is not the run the status line and toasts follow; another run
63
+ // is named by its objective (owner request of 2026-11-06, T-013).
64
+ const eventNaming = () => ({
65
+ shownRunId: observedRun({ snapshot: session.snapshot, sessionStartedAt: session.startedAt, selection: selection(), mention: session.chatMention }).runId ?? null,
66
+ runs: session.snapshot?.status === 'ok' ? session.snapshot.runs : [] });
67
+ // The host loads a hooks module only when every use of `$` is spelled `$.noun.member(...)` at the call
68
+ // site; passing `$.process` itself refuses the whole module (T-013 native check). The run-view reader
69
+ // receives this call-site wrapper instead.
70
+ const processes = $ => ({ run: (argv, init) => $.process.run(argv, init) });
52
71
 
53
72
  // Applies one change to this session's choices and, where the AGDF plugin data directory already
54
73
  // exists, to the freshly read state file, so choices another session stored meanwhile survive.
@@ -67,7 +86,7 @@ async function persist($, change) {
67
86
  // The status line and toasts follow the run-derived state of the run the panel shows without browsing,
68
87
  // 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
88
  // announces anything. Each host call has its own catch path: a missing channel stays silent (SDD-12).
70
- function announce($) {
89
+ function announce($, { quiet = new Set() } = {}) {
71
90
  const observed = observedRun({ snapshot: session.snapshot, sessionStartedAt: session.startedAt, selection: selection(),
72
91
  mention: session.chatMention });
73
92
  // Every applied read sets the line again, unchanged text included: the desktop dropped the one set
@@ -76,16 +95,33 @@ function announce($) {
76
95
  if (session.snapshot?.stale) return;
77
96
  const { observation, notice } = observeNotice(session.observation, observed);
78
97
  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
- }
98
+ // A run whose own event raises a toast in the same read gets no second state toast (decision P1).
99
+ if (notice && !quiet.has(observed.runId)) toast($, noticeText(notice, { registry: session.registry, labels: session.labels, locale: session.locale }));
100
+ announceDrift($);
101
+ }
102
+
103
+ // One toast, with the chime only when it was shown; a missing channel stays silent (SDD-12, CR-F01).
104
+ function toast($, text) {
105
+ if (!session.choices.notice) return false;
106
+ try { $.ui.toast(text); } catch { return false; }
85
107
  // The chime plays only with a shown toast; a host without a player skips it, a failure stays silent.
86
108
  if (session.choices.sound) {
87
109
  try { $.audio.play(chimeClip(), { gain: CHIME.gain }).catch(() => {}); } catch { /* no audio on this host */ }
88
110
  }
111
+ return true;
112
+ }
113
+
114
+ // A bound document changed after recording raises one toast per change (decision P1, PRD AC-008); the
115
+ // pane keeps the warning while the run view reports it. The first read is a baseline.
116
+ function announceDrift($) {
117
+ if (session.snapshot?.status !== 'ok') return;
118
+ const warnings = session.snapshot.runs.flatMap(run => (run.drift ?? []).map(item => ({ run: run.id, document: item.document,
119
+ key: `${run.id}|${item.path}|${item.current_digest}` })));
120
+ const seen = session.driftSeen;
121
+ session.driftSeen = new Set(warnings.map(item => item.key));
122
+ if (!seen) return;
123
+ const naming = eventNaming();
124
+ for (const item of warnings.filter(warning => !seen.has(warning.key))) toast($, namedEventText(t('events.drift', { document: item.document }), item.run, t, naming));
89
125
  }
90
126
 
91
127
  // Switching off clears the status line, forgets the observation and discards reads still running, so
@@ -96,19 +132,38 @@ function silence($) {
96
132
  try { $.ui.status(undefined); } catch { /* no status line on this host */ }
97
133
  }
98
134
 
99
- // Reads the run states of the current project root, which `/cd` or a worktree move can change.
135
+ // Reads the run view of the current project root, which `/cd` or a worktree move can change; a
136
+ // remembered selection is requested by id, so a selected completed run is shown in full.
100
137
  // Only the newest of overlapping reads is applied. A snapshot without any runs, as during a branch
101
138
  // switch, never drops the remembered selection.
102
- async function refresh($) {
139
+ async function refresh($, { quiet } = {}) {
103
140
  const read = ++session.reads;
104
141
  try {
105
142
  const root = await $.session.root();
106
143
  await followConversation($);
107
- const next = await readSnapshot(files($), root, { now: await $.clock.now() });
144
+ const remembered = session.choices.selections[root];
145
+ // Taken before the call: a change during the call shows up at the next check.
146
+ const ids = fingerprintIds(root);
147
+ const print = await fingerprint($, root, ids);
148
+ const next = await readSnapshot(processes($), { pluginRoot: $.plugin.root, root, language: session.locale,
149
+ runIds: remembered ? [remembered] : [], now: await $.clock.now(), clock: () => $.clock.now() });
108
150
  if (read < session.appliedRead) return;
109
151
  session.appliedRead = read;
152
+ if (root !== session.root) {
153
+ // Another project root: its drift baseline, pane entries and preview start over (CR finding B3).
154
+ session.driftSeen = null;
155
+ session.events = [];
156
+ session.unconfirmed = [];
157
+ session.isPreviewExpanded = false;
158
+ }
110
159
  session.root = root;
111
160
  session.snapshot = settleSnapshot(session.snapshot, next);
161
+ if (next.status === 'ok') session.events = session.events.filter(event => !STICKY_KINDS.includes(event.kind) || isStillUncertain(event, next.runs));
162
+ // A changed set of open runs is listed again, so the next check compares like with like. A failed
163
+ // read keeps no fingerprint, so the next check reads again (CR finding B1).
164
+ const after = fingerprintIds(root);
165
+ session.fingerprint = next.status === 'failed' ? null
166
+ : `${session.locale}|${after.join() === ids.join() ? print : await fingerprint($, root, after)}`;
112
167
  const chosen = selection();
113
168
  if (chosen && next.status === 'ok' && next.runs.length) {
114
169
  const { dropSelection } = assignRun({ runs: next.runs, sessionStartedAt: session.startedAt, selection: chosen });
@@ -117,12 +172,100 @@ async function refresh($) {
117
172
  } catch (error) {
118
173
  if (read < session.appliedRead) return;
119
174
  session.appliedRead = read;
120
- session.snapshot = settleSnapshot(session.snapshot, { status: 'failed', runs: [], unreadable: [], readAt: Date.now(), error: String(error?.message ?? error) });
175
+ session.fingerprint = null;
176
+ session.snapshot = settleSnapshot(session.snapshot, { status: 'failed', runs: [], unreadable: [], readAt: Date.now(), error: 'unavailable' });
121
177
  }
122
- if (session.choices.enabled) announce($);
178
+ if (session.choices.enabled) announce($, { quiet });
123
179
  redraw($);
124
180
  }
125
181
 
182
+ // The run-file fingerprint (SDD-007): the run folders, `config.json` and, for each open or selected
183
+ // run, its RUN_STATE and documents entries with size and modification time from `$.fs.list`. It reads
184
+ // listings only, never a run file.
185
+ const fingerprintIds = root => [...new Set([...(session.snapshot?.runs ?? []).filter(run => run.lifecycle === 'active').map(run => run.id),
186
+ session.choices.selections[root]].filter(Boolean))].sort();
187
+
188
+ async function fingerprint($, root, ids = fingerprintIds(root)) {
189
+ const list = async path => { try { return await $.fs.list(path); } catch { return null; } };
190
+ const files = entries => (entries ?? []).filter(entry => entry.kind === 'file').map(entry => `${entry.name}:${entry.size}:${entry.mtimeMs}`).sort().join(',');
191
+ const control = `${root}/.agdf/control`;
192
+ const runs = await list(`${control}/runs`);
193
+ const parts = [`config:${files((await list(control))?.filter(entry => entry.name === 'config.json'))}`,
194
+ `runs:${(runs ?? []).map(entry => entry.name).sort().join(',')}`];
195
+ for (const id of ids) parts.push(`${id}:${files(await list(`${control}/runs/${id}`))}|${files(await list(`${control}/runs/${id}/documents`))}`);
196
+ return parts.join(';');
197
+ }
198
+
199
+ // The 30-second check and the check after a main-loop turn (SDD-007): the run view is read again only
200
+ // when the conversation, the root, the language or the run-file fingerprint changed.
201
+ async function check($) {
202
+ try {
203
+ const root = await $.session.root();
204
+ session.locale = await readLocale($, root);
205
+ const conversationChanged = await followConversation($);
206
+ if (!conversationChanged && root === session.root && `${session.locale}|${await fingerprint($, root)}` === session.fingerprint) return false;
207
+ await refresh($);
208
+ return true;
209
+ } catch {
210
+ return false;
211
+ }
212
+ }
213
+
214
+ // Reads the journal (SDD-007): a bounded read of its own file in the plugin data directory, only when
215
+ // its size or time changed. New events of this root are kept for the pane, read the run view once and
216
+ // raise the toasts of decision P1. A missing or unreadable journal shows "events unavailable".
217
+ async function pollEvents($) {
218
+ const available = value => { if (session.eventsAvailable !== value) { session.eventsAvailable = value; redraw($); } };
219
+ try {
220
+ if (!session.dataDir) { available(false); return; }
221
+ // The current root, which `/cd` or a worktree move can change since the last read (CR finding B3).
222
+ const root = await $.session.root();
223
+ if (root !== session.root) await refresh($);
224
+ const directory = journalDirectory(session.dataDir);
225
+ const listing = await $.fs.list(directory);
226
+ const entry = listing.find(item => item.name === JOURNAL_FILE && item.kind === 'file');
227
+ if (!entry || entry.size > JOURNAL_READ_LIMIT) { available(false); return; }
228
+ const stamp = `${entry.size}:${entry.mtimeMs}`;
229
+ let fresh = [];
230
+ if (stamp !== session.journalStamp) {
231
+ let events = parseJournal(await $.fs.read(`${directory}/${JOURNAL_FILE}`));
232
+ // Lines written after the last read but before a rotation sit in the rotation file (CR finding B6).
233
+ const cursorId = session.journalCursor?.id;
234
+ const rotated = listing.find(item => item.name === JOURNAL_ROTATED_FILE && item.kind === 'file');
235
+ if (cursorId && !events.some(event => event.id === cursorId) && rotated && rotated.size <= JOURNAL_READ_LIMIT) {
236
+ events = parseJournal(await $.fs.read(`${directory}/${JOURNAL_ROTATED_FILE}`)).concat(events);
237
+ }
238
+ session.journalStamp = stamp;
239
+ const unseen = unseenEvents(events, { root, cursor: session.journalCursor });
240
+ fresh = unseen.fresh;
241
+ session.journalCursor = unseen.cursor;
242
+ }
243
+ available(true);
244
+ if (!fresh.length && !session.unconfirmed.length) return;
245
+ if (fresh.length) {
246
+ const toasts = fresh.filter(event => TOAST_KINDS.includes(event.kind));
247
+ await refresh($, { quiet: new Set(toasts.map(event => event.run_id)) });
248
+ }
249
+ // A durable fact is shown, in the pane and as a toast, only once the run view confirms it (SD 2,
250
+ // CR finding B4). Without a fresh view it waits for one instead of being dropped (CR delta review
251
+ // RV-1); a fresh view that does not confirm it drops it.
252
+ const current = session.snapshot?.status === 'ok' && !session.snapshot.stale;
253
+ const runs = current ? session.snapshot.runs : [];
254
+ const candidates = session.unconfirmed.concat(fresh);
255
+ const shown = candidates.filter(event => isConfirmed(event, runs));
256
+ session.unconfirmed = current ? [] : candidates.filter(event => !shown.includes(event)).slice(-PANE_EVENTS);
257
+ if (!shown.length) return;
258
+ session.events = [...shown].reverse().concat(session.events).slice(0, PANE_EVENTS);
259
+ if (!session.choices.enabled) { redraw($); return; }
260
+ const gate = value => gateTitle(session.registry, session.locale, value);
261
+ const naming = eventNaming();
262
+ for (const event of shown.filter(item => TOAST_KINDS.includes(item.kind))) toast($, eventText(event, t, { gateTitle: gate, ...naming }));
263
+ redraw($);
264
+ } catch {
265
+ available(false);
266
+ }
267
+ }
268
+
126
269
  // Takes the last open run a main-loop text names as the chat's run at host time `at` (chat-run navigation
127
270
  // SDD-01, SDD-02). Returns whether a mention was recorded: a repeated name can still move the chat's run
128
271
  // back from a later change, so every recorded mention is announced (CR-F02).
@@ -139,43 +282,50 @@ function noteMention(text, at) {
139
282
  async function followConversation($) {
140
283
  let conversation = session.conversation;
141
284
  try { conversation = await $.session.id(); } catch { /* no conversation id on this host */ }
142
- if (session.conversation && conversation !== session.conversation) {
285
+ const changed = Boolean(session.conversation) && conversation !== session.conversation;
286
+ if (changed) {
143
287
  session.chatMention = null;
144
288
  session.isBrowsing = false;
145
289
  session.observation = null;
146
290
  session.startedAt = await $.clock.now();
147
291
  }
148
292
  session.conversation = conversation;
293
+ return changed;
149
294
  }
150
295
 
151
296
  function stopRefreshing() {
152
297
  session.timer?.cancel();
298
+ session.eventTimer?.cancel();
153
299
  session.timer = null;
300
+ session.eventTimer = null;
154
301
  }
155
302
 
156
- // The timer is replaced before the first read, so overlapping starts never leave a second timer.
303
+ // The timers are replaced before the first read, so overlapping starts never leave a second one: the
304
+ // journal is read every 2 seconds, the run files are checked every 30 seconds (SDD-007). Events written
305
+ // before the start are history, never announced.
157
306
  async function startRefreshing($) {
158
307
  stopRefreshing();
159
- session.timer = $.clock.every(REFRESH_MS, () => { void refresh($); });
160
- await refresh($);
308
+ session.journalCursor = { id: null, at: new Date(await $.clock.now()).toISOString() };
309
+ session.journalStamp = null;
310
+ session.eventTimer = $.clock.every(EVENT_POLL_MS, () => { void pollEvents($); });
311
+ session.timer = $.clock.every(REFRESH_MS, () => { void check($); });
312
+ // The first read runs beside the host: session start and the command never wait for the run-view
313
+ // process (CR finding B5); the pane draws "reading" until it lands.
314
+ session.background = (async () => { await refresh($); await pollEvents($); })().catch(() => {});
161
315
  return $.ui.open({ id: PANE, title: t('title') });
162
316
  }
163
317
 
318
+ // Settles once the latest background read finished (for the adapter test).
319
+ export const whenIdle = () => session.background ?? Promise.resolve();
320
+
164
321
  const openedText = opened => (opened?.isPlaced === false ? t('command.waiting', { reason: opened.reason }) : t('command.enabled'));
165
322
 
166
323
  async function loadSession($) {
167
324
  session.startedAt = await $.clock.now();
168
325
  session.root = await $.session.root();
169
- session.labels = JSON.parse(await $.fs.read(`${$.plugin.root}/companion/locales.json`));
170
326
  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 });
327
+ session.labels = companionLabels(session.registry);
328
+ session.locale = await readLocale($, session.root);
179
329
  // The About entry names the plugin version; a missing or unreadable manifest only leaves it out.
180
330
  try {
181
331
  const { version } = JSON.parse(await $.fs.read(`${$.plugin.root}/.claude-plugin/plugin.json`));
@@ -188,15 +338,31 @@ async function loadSession($) {
188
338
  } catch { /* no icon shown */ }
189
339
  const dir = pluginDataDir({ configDir: await $.env.get('CLAUDE_CONFIG_DIR'), userProfile: await $.env.get('USERPROFILE'), home: await $.env.get('HOME') });
190
340
  session.statePath = dir ? `${dir}/${STATE_FILE}` : null;
341
+ // The MCP server journals below the same plugin data root (companion core SDD-006).
342
+ session.dataDir = dir;
191
343
  if (session.statePath && (await $.fs.exists(session.statePath))) session.choices = parseCompanionState(await $.fs.read(session.statePath));
192
344
  }
193
345
 
346
+ // The AGDF chat language of the project; without AGDF control, Claude's own `language` setting
347
+ // (follow-up SDD-11). Read again at every check, so a language change reads the run view again.
348
+ async function readLocale($, root) {
349
+ const config = `${root}/.agdf/control/config.json`;
350
+ const configText = (await $.fs.exists(config)) ? await $.fs.read(config) : null;
351
+ let setting = null;
352
+ if (configText === null) {
353
+ try { setting = await $.settings.read({ key: 'language' }); } catch { /* no setting: the fallback locale */ }
354
+ }
355
+ return chatLocale(session.registry, configText, { setting, labels: session.labels });
356
+ }
357
+
194
358
  const wrappedRows = (value, columns) => (value ? Math.ceil(value.length / Math.max(columns, 10)) : 0);
195
359
 
196
360
  // How many open runs the desktop list shows: the body rows left beside the other blocks, never fewer
197
361
  // than the terminal's six (the pane then scrolls). One row of them goes to "+ N more" when runs remain.
198
362
  export function listCapacity(view, { rows, columns, isAboutShown = false }) {
199
- const blocks = [view.message, view.hint, view.stale].filter(Boolean);
363
+ const blocks = [view.message, view.hint, view.unreadableHint !== view.message ? view.unreadableHint : null, view.stale,
364
+ ...(view.drift ?? []), ...(view.events ? [view.events.join(' '), ...view.events.map(() => ' ')] : []),
365
+ ...(view.review ? [view.review.summary, view.review.match, ' ', ' '] : []), view.eventsHint].filter(Boolean);
200
366
  const fixed = DESKTOP_ROWS.figure + DESKTOP_ROWS.footer + DESKTOP_ROWS.spare + (isAboutShown ? DESKTOP_ROWS.about : 0) + 1
201
367
  + blocks.reduce((sum, value) => sum + wrappedRows(value, columns), 0) + DESKTOP_ROWS.gap * (blocks.length + 3);
202
368
  return Math.max(LISTED_RUNS, Math.floor(rows - fixed));
@@ -238,7 +404,7 @@ function body($, e, view) {
238
404
  const commands = [
239
405
  ...(canReturn ? [['chat', t('actions.backToChat'), back]] : []),
240
406
  ['still', session.choices.still ? t('actions.stillOff') : t('actions.stillOn'), toggle('still')],
241
- ['retry', t('actions.retry'), () => refresh($)],
407
+ ['retry', t('actions.retry'), async () => { session.journalStamp = null; await refresh($); await pollEvents($); }],
242
408
  ['notice', session.choices.notice ? t('actions.noticeOff') : t('actions.noticeOn'), toggle('notice')],
243
409
  ['sound', session.choices.sound ? t('actions.soundOff') : t('actions.soundOn'), toggle('sound')],
244
410
  ['about', t('actions.about'), async () => { session.isAboutShown = true; }],
@@ -322,6 +488,7 @@ function body($, e, view) {
322
488
  view.reason ? h(Text, { dimColor: true, wrap: 'truncate-end' }, view.reason) : null),
323
489
  view.message ? h(Text, {}, view.message) : null,
324
490
  view.hint ? h(Text, { dimColor: true }, view.hint) : null,
491
+ view.unreadableHint && view.unreadableHint !== view.message ? h(Text, { color: 'warning' }, view.unreadableHint) : null,
325
492
  view.gateBar ? h(Text, { mono: true, wrap: 'truncate-end' }, view.gateBar) : null,
326
493
  view.runId ? h(Box, { flexDirection: 'column' },
327
494
  h(Text, { weight: 'semibold', wrap: 'truncate-end' }, view.runId),
@@ -333,6 +500,19 @@ function body($, e, view) {
333
500
  view.nextStep ? h(Box, { flexDirection: 'column' },
334
501
  h(Text, { dimColor: true }, t('fields.nextStep')),
335
502
  h(Text, {}, view.nextStep)) : null,
503
+ ...(view.drift ?? []).map(text => h(Text, { color: 'warning' }, text)),
504
+ view.events ? h(Box, { flexDirection: 'column' },
505
+ h(Text, { dimColor: true }, t('fields.events')),
506
+ ...view.events.map(line => h(Text, { wrap: 'truncate-end' }, line))) : null,
507
+ view.review ? h(Box, { flexDirection: 'column' },
508
+ h(Text, { dimColor: true }, t('fields.material')),
509
+ h(Text, {}, `${view.review.summary} · ${view.review.match}`),
510
+ view.review.preview ? h(Text, { mono: true, dimColor: true, wrap: session.isPreviewExpanded ? 'wrap' : 'truncate-end' },
511
+ session.isPreviewExpanded ? view.review.preview : view.review.preview.split('\n')[0]) : null,
512
+ view.review.preview ? h(Button, { key: 'preview', plain: true, label: session.isPreviewExpanded ? t('actions.collapse') : t('actions.expand'),
513
+ onPress: press($, async () => { session.isPreviewExpanded = !session.isPreviewExpanded; }) }) : null,
514
+ view.review.truncated ? h(Text, { dimColor: true }, view.review.truncated) : null) : null,
515
+ view.eventsHint ? h(Text, { dimColor: true }, view.eventsHint) : null,
336
516
  runList,
337
517
  view.stale ? h(Text, { color: 'warning' }, view.stale) : null,
338
518
  about),
@@ -387,6 +567,9 @@ export const register = on => {
387
567
  // A main-loop turn ends browsing and may name the chat's run (chat-run navigation SDD-02, SDD-04);
388
568
  // the host clock is read beside the event, never before it is passed on (SDD-11).
389
569
  session.isBrowsing = false;
570
+ // Pane entries of events clear at the next main-loop turn (PRD state transitions); an uncertain
571
+ // outcome stays until its run recorded a later operation (CR finding B7).
572
+ session.events = session.events.filter(event => STICKY_KINDS.includes(event.kind));
390
573
  if (!session.isHidden) session.isTurnActive = true;
391
574
  redraw($);
392
575
  const prompt = e.text;
@@ -402,15 +585,17 @@ export const register = on => {
402
585
  if (e.agentId === undefined) {
403
586
  // Cleared on every main-loop completion, also while switched off, so no stale overlay remains.
404
587
  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).
588
+ // The check runs after the host has its answer, never inside the hook; a hidden pane keeps
589
+ // the status line and toasts current (follow-up SDD-08). It reads the journal and, on a
590
+ // changed run-file fingerprint, the run view (SDD-007); the turn overlay ends with a redraw
591
+ // either way. The turn's final answer (`e.answer`, else the text `next(e)` returned) is matched
592
+ // at the turn's end time, so a run created during the turn counts (CR-F05, CR-F06).
409
593
  if (session.choices.enabled) {
410
594
  const answer = typeof e.answer === 'string' ? e.answer : answered?.text;
411
595
  void (async () => {
412
596
  const at = await $.clock.now();
413
- await refresh($);
597
+ await pollEvents($);
598
+ if (!(await check($))) redraw($);
414
599
  if (session.choices.enabled && noteMention(answer, at)) { announce($); redraw($); }
415
600
  })().catch(() => {});
416
601
  }
@@ -435,7 +620,8 @@ export const register = on => {
435
620
  return body($, e, buildPanelView({ snapshot: session.snapshot, sessionStartedAt: session.startedAt, selection: selection(),
436
621
  mention: session.chatMention, isBrowsing: session.isBrowsing,
437
622
  isTurnActive: session.isTurnActive, registry: session.registry, labels: session.labels, locale: session.locale,
438
- columns: e.props?.bodyColumns ?? Infinity, isObjectiveExpanded: session.isObjectiveExpanded }));
623
+ columns: e.props?.bodyColumns ?? Infinity, isObjectiveExpanded: session.isObjectiveExpanded,
624
+ events: session.events, eventsAvailable: session.eventsAvailable ?? undefined }));
439
625
  } catch (error) {
440
626
  const { Text } = $.ui.resolve(e);
441
627
  return h(Text, { dimColor: true }, `AGDF Companion: ${String(error?.message ?? error).slice(0, 200)}`);