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.
- package/README.md +148 -191
- package/generated/.agdf/control/README.md +31 -110
- package/generated/.agdf/control/planned-urs.md +95 -0
- package/generated/.agdf/control/templates/RUN_STATE.md +15 -64
- package/generated/.agdf/control/templates/artefacts/UR.md +1 -1
- package/generated/.agents/plugins/marketplace.json +12 -0
- package/generated/.opencode/agdf-agent-router.md +3 -3
- package/generated/.opencode/agdf-interaction-locales.json +2668 -2682
- package/generated/.opencode/contracts/closeout.md +1 -1
- package/generated/.opencode/contracts/control-scaffold.md +63 -46
- package/generated/.opencode/contracts/gate-artifact-preparation.md +58 -48
- package/generated/.opencode/contracts/gate-transition.md +5 -6
- package/generated/.opencode/contracts/interaction.md +43 -126
- package/generated/.opencode/contracts/modes.md +4 -3
- package/generated/.opencode/contracts/prd-definition.md +6 -6
- package/generated/.opencode/contracts/quality.md +10 -2
- package/generated/.opencode/contracts/request-activation.md +9 -8
- package/generated/.opencode/contracts/sd-definition.md +3 -3
- package/generated/.opencode/contracts/task-target-resolution.md +24 -0
- package/generated/.opencode/contracts/tp-definition.md +1 -1
- package/generated/.opencode/contracts/ur-definition.md +41 -7
- package/generated/.opencode/skills/agdf-brownfield-analysis/SKILL.md +8 -5
- package/generated/.opencode/skills/agdf-clean-implementation-review/SKILL.md +3 -2
- package/generated/.opencode/skills/agdf-code-review/SKILL.md +5 -3
- package/generated/.opencode/skills/agdf-delivery-closeout/SKILL.md +3 -2
- package/generated/.opencode/skills/agdf-delivery-path-search/SKILL.md +3 -2
- package/generated/.opencode/skills/agdf-gate-check/SKILL.md +35 -31
- package/generated/.opencode/skills/agdf-prd-definition/SKILL.md +3 -2
- package/generated/.opencode/skills/agdf-qa-gate/SKILL.md +3 -2
- package/generated/.opencode/skills/agdf-release-or/SKILL.md +8 -5
- package/generated/.opencode/skills/agdf-sd-definition/SKILL.md +3 -2
- package/generated/.opencode/skills/agdf-task-plan-review/SKILL.md +3 -2
- package/generated/.opencode/skills/agdf-tp-definition/SKILL.md +3 -2
- package/generated/.opencode/skills/agdf-ur-definition/SKILL.md +12 -4
- package/generated/.opencode/skills/agdf-ux-intent-definition/SKILL.md +5 -4
- package/generated/plugins/agdf/.claude-plugin/plugin.json +3 -2
- package/generated/plugins/agdf/.codex-plugin/plugin.json +1 -1
- package/generated/plugins/agdf/companion/assignment.mjs +65 -0
- package/generated/plugins/agdf/companion/companion.json +4 -0
- package/generated/plugins/agdf/companion/core.mjs +16 -0
- package/generated/plugins/agdf/companion/figure.mjs +137 -0
- package/generated/plugins/agdf/companion/gate-bar.mjs +54 -0
- package/generated/plugins/agdf/companion/hooks.json +3 -0
- package/generated/plugins/agdf/companion/locales.json +200 -0
- package/generated/plugins/agdf/companion/localization.mjs +89 -0
- package/generated/plugins/agdf/companion/notice.mjs +90 -0
- package/generated/plugins/agdf/companion/persistence.mjs +36 -0
- package/generated/plugins/agdf/companion/register.mjs +444 -0
- package/generated/plugins/agdf/companion/run-state.mjs +110 -0
- package/generated/plugins/agdf/companion/state.mjs +48 -0
- package/generated/plugins/agdf/companion/view.mjs +84 -0
- package/generated/plugins/agdf/control/README.md +31 -110
- package/generated/plugins/agdf/control/planned-urs.md +95 -0
- package/generated/plugins/agdf/control/templates/RUN_STATE.md +15 -64
- package/generated/plugins/agdf/control/templates/artefacts/UR.md +1 -1
- package/generated/plugins/agdf/mcp/server/README.md +119 -7
- package/generated/plugins/agdf/mcp/server/package.json +12 -7
- package/generated/plugins/agdf/mcp/server/src/generation-entry.js +3 -85
- package/generated/plugins/agdf/mcp/server/src/generation-protocol.js +2 -44
- package/generated/plugins/agdf/mcp/server/src/generation-runtime.js +94 -0
- package/generated/plugins/agdf/mcp/server/src/generation-thread-entry.js +8 -0
- package/generated/plugins/agdf/mcp/server/src/generation.js +64 -20
- package/generated/plugins/agdf/mcp/server/src/main.js +42 -10
- package/generated/plugins/agdf/mcp/server/src/server.js +24 -15
- package/generated/plugins/agdf/mcp/server/src/stdio-output.js +42 -0
- package/generated/plugins/agdf/mcp/server/src/worker-entry.js +2 -2
- package/generated/plugins/agdf/mcp/server/src/worker.js +53 -7
- package/generated/plugins/agdf/mcp/server/ui/cockpit.html +31 -31
- package/generated/plugins/agdf/mcp/server/ui/decision-manifest.json +3 -3
- package/generated/plugins/agdf/mcp/server/ui/decision.html +36 -36
- package/generated/plugins/agdf/mcp/server/ui/manifest.json +4 -4
- package/generated/plugins/agdf/meta/agdf-agent-router.md +3 -3
- package/generated/plugins/agdf/meta/agdf-defaults.json +9 -0
- package/generated/plugins/agdf/meta/agdf-defaults.schema.json +20 -0
- package/generated/plugins/agdf/meta/agdf-interaction-locales.json +2668 -2682
- package/generated/plugins/agdf/meta/agdf-mcp-capability.json +1 -1
- package/generated/plugins/agdf/meta/agdf-plugin.definition.json +8 -3
- package/generated/plugins/agdf/meta/contracts/closeout.md +1 -1
- package/generated/plugins/agdf/meta/contracts/control-scaffold.md +63 -46
- package/generated/plugins/agdf/meta/contracts/gate-artifact-preparation.md +58 -48
- package/generated/plugins/agdf/meta/contracts/gate-transition.md +5 -6
- package/generated/plugins/agdf/meta/contracts/interaction.md +43 -126
- package/generated/plugins/agdf/meta/contracts/modes.md +4 -3
- package/generated/plugins/agdf/meta/contracts/prd-definition.md +6 -6
- package/generated/plugins/agdf/meta/contracts/quality.md +10 -2
- package/generated/plugins/agdf/meta/contracts/request-activation.md +9 -8
- package/generated/plugins/agdf/meta/contracts/sd-definition.md +3 -3
- package/generated/plugins/agdf/meta/contracts/task-target-resolution.md +24 -0
- package/generated/plugins/agdf/meta/contracts/tp-definition.md +1 -1
- package/generated/plugins/agdf/meta/contracts/ur-definition.md +41 -7
- package/generated/plugins/agdf/meta/copilot-payload-baseline.json +3 -3
- package/generated/plugins/agdf/meta/distribution-profile-history.json +7 -0
- package/generated/plugins/agdf/runtime/agdf-session-check.js +25 -21
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-defaults.json +9 -0
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-defaults.schema.json +20 -0
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-interaction-locales.json +2668 -2682
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-plugin.definition.json +8 -3
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/closeout.md +1 -1
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/control-scaffold.md +63 -46
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/gate-artifact-preparation.md +58 -48
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/gate-transition.md +5 -6
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/interaction.md +43 -126
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/modes.md +4 -3
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/prd-definition.md +6 -6
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/quality.md +10 -2
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/request-activation.md +9 -8
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/sd-definition.md +3 -3
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/task-target-resolution.md +24 -0
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/tp-definition.md +1 -1
- package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/ur-definition.md +41 -7
- package/generated/plugins/agdf/runtime/create-agdf/lib/cli/codex-document-command.js +195 -0
- package/generated/plugins/agdf/runtime/create-agdf/lib/cli/command-registry.js +82 -148
- package/generated/plugins/agdf/runtime/create-agdf/lib/cli/control-maintenance-command.js +8 -37
- package/generated/plugins/agdf/runtime/create-agdf/lib/cli/parse-args.js +98 -16
- package/generated/plugins/agdf/runtime/create-agdf/lib/cli/planned-command.js +55 -0
- package/generated/plugins/agdf/runtime/create-agdf/lib/cli/project-read-command.js +35 -0
- package/generated/plugins/agdf/runtime/create-agdf/lib/cli/run-command-aliases.js +116 -0
- package/generated/plugins/agdf/runtime/create-agdf/lib/cli/runtime-context.js +1 -59
- package/generated/plugins/agdf/runtime/create-agdf/lib/cli/validation-handlers.js +33 -103
- package/generated/plugins/agdf/runtime/create-agdf/lib/control-evaluation/git-observation.js +7 -5
- package/generated/plugins/agdf/runtime/create-agdf/lib/control-maintenance/startup.js +2 -2
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-decision-protocol.js +40 -0
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-dispatch-runtime.js +71 -306
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-entry.js +3 -24
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-owner-entry.js +31 -15
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-runtime.js +29 -0
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-thread-entry.js +11 -0
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/owner-client.js +79 -0
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/package.js +14 -80
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/plugin-runtime.js +29 -9
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-lifecycle/thread-owner.js +164 -0
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-owner-protocol.js +1 -0
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-protocol-runtime.js +308 -0
- package/generated/plugins/agdf/runtime/create-agdf/lib/mcp-worker-runtime.js +152 -0
- package/generated/plugins/agdf/runtime/create-agdf/lib/runtime/control-command-service.js +22 -7
- package/generated/plugins/agdf/runtime/create-agdf/lib/runtime/control-context.js +8 -1
- package/generated/plugins/agdf/runtime/create-agdf/lib/runtime/validator-application.js +2 -2
- package/generated/plugins/agdf/runtime/create-agdf/package.json +5 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/closeout-readiness.js +10 -2
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/decision-content-placeholder.js +9 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/decision-content-readiness.js +2 -7
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/definition-sources.js +3 -2
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/delivery-map.js +2 -12
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/doctor.js +162 -172
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-check.js +10 -9
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy-inputs.js +11 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy-pure.js +446 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy.js +3 -434
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/next-action.js +2 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/parent-reconciliation.js +2 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/qa-follow-up.js +2 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/required-files.js +9 -7
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-state-policy.js +1 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-state.js +15 -9
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-step-policy.js +2 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-work-summary.js +6 -4
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/shared-value.js +7 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/shared.js +5 -254
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/tp-planning.js +3 -2
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/ur-readiness.js +7 -2
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/verified-change.js +11 -9
- 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
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/artifact-readiness.js +5 -3
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/authoring-inputs.js +110 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-archive.js +53 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-context.js +2 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-contract.js +11 -4
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-list.d.ts +10 -6
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-list.js +32 -41
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-session.js +8 -8
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-work.js +33 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit.js +75 -44
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/contract.js +124 -32
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/decision-session.js +53 -11
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/doctor-observation.js +91 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/project-operation-call.js +5 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/project-state.js +48 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/result.js +61 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/selection.js +9 -3
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/service.js +119 -67
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/compatibility.js +42 -132
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/contract.js +5 -5
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/presentation.js +27 -119
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/service.js +9 -37
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-read/cockpit-pool.js +25 -9
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-read/cockpit-worker.js +4 -3
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-read/doctor-reader.js +92 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-read/doctor-worker.js +11 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-read/fs.js +18 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-read/snapshot.js +68 -17
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/aggregate.js +3 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/approval-command.js +13 -10
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/approval-operations.js +10 -7
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/artefact-binding-proof.js +12 -20
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/artefact-bindings.js +10 -7
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/canonical-initialization.js +761 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/control-layout.js +183 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/decision-action-contract.js +10 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/decision-action-service.js +24 -3
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/decision-material-contract.js +2 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/evidence-bindings.js +7 -7
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/git-identity.js +86 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/index.js +0 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/input-resolution.js +99 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-entry.js +273 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-handoff.js +174 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-inventory.js +90 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-origin-reader.js +48 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-origin.js +40 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/presentation-decision.js +12 -7
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/presentation-delivery.js +90 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/preview-render.js +5 -2
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/preview-review.js +3 -2
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/preview-snapshot.js +9 -6
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/recording-formats.js +12 -16
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-artefact-recording.js +54 -66
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-closure.js +343 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-contract.js +33 -250
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-schema.js +508 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-service.js +198 -34
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-create-command.js +60 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-identity.d.ts +14 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-identity.js +40 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-input-resolution.js +72 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-inventory-reader.js +31 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-inventory.js +179 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-material.js +211 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-mutation.js +51 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operation-identity.js +2 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operation-proof.js +7 -4
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operation-status.js +20 -4
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operations.js +70 -13
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-owned-outputs.js +21 -9
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation-envelope.js +25 -33
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation-render.js +8 -7
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation.js +45 -21
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-recording.js +10 -179
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision-boundary.js +7 -21
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision-history.js +23 -16
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision.js +84 -161
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-seal-compute.js +19 -44
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-seal.js +6 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-source-revisions.js +19 -18
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-document.js +110 -42
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-edits.js +13 -5
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-parser.js +14 -6
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-reader.js +27 -18
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-repository.js +112 -48
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-resolver.js +12 -15
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-writer.js +21 -377
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-step-pending.js +2 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-step-transaction.js +125 -114
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-steps.js +136 -248
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-store-inspection.js +14 -2
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-verified-change.js +81 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-work-summary-shape.d.ts +1 -0
- 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
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/delivery-continuation/service.js +5 -66
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/delivery-path-search/persistence.js +26 -8
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/delivery-path-search/state-adapter.js +1 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/index.js +14 -6
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/interaction-catalog.js +3 -3
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/interaction-presentation.js +29 -11
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-hints.js +46 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-resolution.js +98 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-schema.js +15 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/mcp-resource-contract.js +1 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/mcp-tool-errors.js +31 -15
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/owned-file-lock.js +266 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/owner-placement.js +50 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/resources/canonical-init-plan.js +34 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/resources/configuration.js +92 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/resources/context.js +7 -11
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/resources/language-preference.js +59 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/runtime/mcp-owner-protocol.js +102 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/runtime/plugin-provenance.js +173 -18
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/compact-continuation.js +3 -3
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/contract.js +28 -9
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/delivery-intake.js +11 -5
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/delivery-run-assignment.js +6 -10
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/mcp-continuation.js +64 -0
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/prd-definition.js +14 -5
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/sd-definition.js +2 -1
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/service.js +49 -14
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/tp-definition.js +2 -1
- package/generated/plugins/agdf/runtime/runtime-manifest.json +2 -2
- package/generated/plugins/agdf/scripts/check-runtime-integrity.mjs +60 -42
- package/generated/plugins/agdf/scripts/instruction-footprint.mjs +5 -5
- package/generated/plugins/agdf/skills/brownfield-analysis/SKILL.md +8 -5
- package/generated/plugins/agdf/skills/clean-implementation-review/SKILL.md +3 -2
- package/generated/plugins/agdf/skills/code-review/SKILL.md +5 -3
- package/generated/plugins/agdf/skills/delivery-closeout/SKILL.md +3 -2
- package/generated/plugins/agdf/skills/delivery-path-search/SKILL.md +3 -2
- package/generated/plugins/agdf/skills/gate-check/SKILL.md +35 -31
- package/generated/plugins/agdf/skills/prd-definition/SKILL.md +3 -2
- package/generated/plugins/agdf/skills/qa-gate/SKILL.md +3 -2
- package/generated/plugins/agdf/skills/release-or/SKILL.md +8 -5
- package/generated/plugins/agdf/skills/sd-definition/SKILL.md +3 -2
- package/generated/plugins/agdf/skills/task-plan-review/SKILL.md +3 -2
- package/generated/plugins/agdf/skills/tp-definition/SKILL.md +3 -2
- package/generated/plugins/agdf/skills/ur-definition/SKILL.md +12 -4
- package/generated/plugins/agdf/skills/ux-intent-definition/SKILL.md +5 -4
- package/generated/plugins/agdf/submission/openai/availability.md +1 -1
- package/generated/plugins/agdf/submission/openai/capability-matrix.json +1 -1
- package/generated/plugins/agdf/submission/openai/release-notes.md +9 -1
- package/generated/plugins/agdf/submission/openai/reviewer-cases.json +1 -1
- package/generated/plugins/agdf-planning/.codex-plugin/plugin.json +40 -0
- package/generated/plugins/agdf-planning/README.md +21 -0
- package/generated/plugins/agdf-planning/assets/agdf-icon.svg +16 -0
- package/generated/plugins/agdf-planning/assets/agdf-logo.svg +16 -0
- package/generated/plugins/agdf-planning/meta/agdf-planning.definition.json +9 -0
- package/generated/plugins/agdf-planning/plugin.json +45 -0
- package/generated/plugins/agdf-planning/skills/planning/SKILL.md +56 -0
- package/generated/plugins/copilot/agdf/.agdf-payload-inventory.json +878 -475
- package/generated/plugins/copilot/agdf/control/README.md +31 -110
- package/generated/plugins/copilot/agdf/control/planned-urs.md +95 -0
- package/generated/plugins/copilot/agdf/control/templates/RUN_STATE.md +15 -64
- package/generated/plugins/copilot/agdf/control/templates/artefacts/UR.md +1 -1
- package/generated/plugins/copilot/agdf/mcp/server/README.md +119 -7
- package/generated/plugins/copilot/agdf/mcp/server/package.json +12 -7
- package/generated/plugins/copilot/agdf/mcp/server/src/generation-entry.js +3 -85
- package/generated/plugins/copilot/agdf/mcp/server/src/generation-protocol.js +2 -44
- package/generated/plugins/copilot/agdf/mcp/server/src/generation-runtime.js +94 -0
- package/generated/plugins/copilot/agdf/mcp/server/src/generation-thread-entry.js +8 -0
- package/generated/plugins/copilot/agdf/mcp/server/src/generation.js +64 -20
- package/generated/plugins/copilot/agdf/mcp/server/src/main.js +42 -10
- package/generated/plugins/copilot/agdf/mcp/server/src/server.js +24 -15
- package/generated/plugins/copilot/agdf/mcp/server/src/stdio-output.js +42 -0
- package/generated/plugins/copilot/agdf/mcp/server/src/worker-entry.js +2 -2
- package/generated/plugins/copilot/agdf/mcp/server/src/worker.js +53 -7
- package/generated/plugins/copilot/agdf/meta/agdf-agent-router.md +3 -3
- package/generated/plugins/copilot/agdf/meta/agdf-plugin.definition.json +8 -3
- package/generated/plugins/copilot/agdf/meta/distribution-profile-history.json +7 -0
- package/generated/plugins/copilot/agdf/plugin.json +1 -1
- package/generated/plugins/copilot/agdf/runtime/agdf-session-check.js +25 -21
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-defaults.json +9 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-defaults.schema.json +20 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-interaction-locales.json +2668 -2682
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-plugin.definition.json +8 -3
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/closeout.md +1 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/control-scaffold.md +63 -46
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/gate-artifact-preparation.md +58 -48
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/gate-transition.md +5 -6
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/interaction.md +43 -126
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/modes.md +4 -3
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/prd-definition.md +6 -6
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/quality.md +10 -2
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/request-activation.md +9 -8
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/sd-definition.md +3 -3
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/task-target-resolution.md +24 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/tp-definition.md +1 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/generated/plugins/agdf/meta/contracts/ur-definition.md +41 -7
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/codex-document-command.js +195 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/command-registry.js +82 -148
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/control-maintenance-command.js +8 -37
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/parse-args.js +98 -16
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/planned-command.js +55 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/project-read-command.js +35 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/run-command-aliases.js +116 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/runtime-context.js +1 -59
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/cli/validation-handlers.js +33 -103
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/control-evaluation/git-observation.js +7 -5
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/control-maintenance/startup.js +2 -2
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-decision-protocol.js +40 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-dispatch-runtime.js +71 -306
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-entry.js +3 -24
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-owner-entry.js +31 -15
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-runtime.js +29 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/facade-thread-entry.js +11 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/owner-client.js +79 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/package.js +14 -80
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/plugin-runtime.js +29 -9
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-lifecycle/thread-owner.js +164 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-owner-protocol.js +1 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-protocol-runtime.js +308 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/mcp-worker-runtime.js +152 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/runtime/control-command-service.js +22 -7
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/runtime/control-context.js +8 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/runtime/validator-application.js +2 -2
- package/generated/plugins/copilot/agdf/runtime/create-agdf/package.json +5 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/closeout-readiness.js +10 -2
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/decision-content-placeholder.js +9 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/decision-content-readiness.js +2 -7
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/definition-sources.js +3 -2
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/delivery-map.js +2 -12
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/doctor.js +162 -172
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-check.js +10 -9
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy-inputs.js +11 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy-pure.js +446 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/gate-policy.js +3 -434
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/next-action.js +2 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/parent-reconciliation.js +2 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/qa-follow-up.js +2 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/required-files.js +9 -7
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-state-policy.js +1 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-state.js +15 -9
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-step-policy.js +2 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/run-work-summary.js +6 -4
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/shared-value.js +7 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/shared.js +5 -254
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/tp-planning.js +3 -2
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/ur-readiness.js +7 -2
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-evaluation/verified-change.js +11 -9
- 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
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/artifact-readiness.js +5 -3
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/authoring-inputs.js +110 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-archive.js +53 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/contract.js +124 -32
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/doctor-observation.js +91 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/project-operation-call.js +5 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/project-state.js +48 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/result.js +61 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/selection.js +9 -3
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/service.js +119 -67
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/compatibility.js +42 -132
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/contract.js +5 -5
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/presentation.js +27 -119
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/service.js +9 -37
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-read/cockpit-pool.js +121 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-read/doctor-reader.js +92 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-read/doctor-worker.js +11 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-read/fs.js +18 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-read/snapshot.js +68 -17
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/aggregate.js +3 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/approval-command.js +13 -10
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/approval-operations.js +10 -7
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/artefact-binding-proof.js +12 -20
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/artefact-bindings.js +10 -7
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/canonical-initialization.js +761 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/control-layout.js +183 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/decision-material-contract.js +2 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/evidence-bindings.js +7 -7
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/git-identity.js +86 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/index.js +0 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/input-resolution.js +99 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-entry.js +273 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-handoff.js +174 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-inventory.js +90 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-origin-reader.js +48 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/planned-origin.js +40 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/presentation-decision.js +12 -7
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/presentation-delivery.js +90 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/preview-render.js +5 -2
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/preview-review.js +3 -2
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/preview-snapshot.js +9 -6
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/recording-formats.js +12 -16
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-artefact-recording.js +54 -66
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-closure.js +343 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-contract.js +33 -250
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-schema.js +508 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-command-service.js +198 -34
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-create-command.js +60 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-identity.d.ts +14 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-identity.js +40 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-input-resolution.js +72 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-inventory-reader.js +31 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-inventory.js +179 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-material.js +211 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-mutation.js +51 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operation-identity.js +2 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operation-proof.js +7 -4
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operation-status.js +20 -4
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-operations.js +70 -13
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-owned-outputs.js +21 -9
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation-envelope.js +25 -33
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation-render.js +8 -7
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-presentation.js +45 -21
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-recording.js +10 -179
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision-boundary.js +7 -21
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision-history.js +23 -16
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-revision.js +84 -161
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-seal-compute.js +19 -44
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-seal.js +6 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-source-revisions.js +19 -18
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-document.js +110 -42
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-edits.js +13 -5
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-parser.js +14 -6
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-reader.js +27 -18
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-repository.js +112 -48
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-resolver.js +12 -15
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-state-writer.js +21 -377
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-step-pending.js +2 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-step-transaction.js +125 -114
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-steps.js +136 -248
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-store-inspection.js +14 -2
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-verified-change.js +81 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-work-summary-shape.d.ts +1 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/{backlog-summary-shape.js → run-work-summary-shape.js} +7 -19
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/delivery-continuation/service.js +5 -66
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/delivery-path-search/persistence.js +26 -8
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/delivery-path-search/state-adapter.js +1 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/index.js +14 -6
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/interaction-catalog.js +3 -3
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/interaction-presentation.js +29 -11
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-hints.js +46 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-resolution.js +98 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/mcp-input-schema.js +15 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/mcp-resource-contract.js +1 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/mcp-tool-errors.js +31 -15
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/owned-file-lock.js +266 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/owner-placement.js +50 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/resources/canonical-init-plan.js +34 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/resources/configuration.js +92 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/resources/context.js +7 -11
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/resources/language-preference.js +59 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/runtime/mcp-owner-protocol.js +102 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/runtime/plugin-provenance.js +173 -18
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/compact-continuation.js +3 -3
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/contract.js +28 -9
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/delivery-intake.js +11 -5
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/delivery-run-assignment.js +6 -10
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/mcp-continuation.js +64 -0
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/prd-definition.js +14 -5
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/sd-definition.js +2 -1
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/service.js +49 -14
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/skill-dispatch/tp-definition.js +2 -1
- package/generated/plugins/copilot/agdf/runtime/runtime-manifest.json +2 -2
- package/generated/plugins/copilot/agdf/skills/agdf-brownfield-analysis/SKILL.md +8 -5
- package/generated/plugins/copilot/agdf/skills/agdf-clean-implementation-review/SKILL.md +3 -2
- package/generated/plugins/copilot/agdf/skills/agdf-code-review/SKILL.md +5 -3
- package/generated/plugins/copilot/agdf/skills/agdf-delivery-closeout/SKILL.md +3 -2
- package/generated/plugins/copilot/agdf/skills/agdf-delivery-path-search/SKILL.md +3 -2
- package/generated/plugins/copilot/agdf/skills/agdf-gate-check/SKILL.md +35 -31
- package/generated/plugins/copilot/agdf/skills/agdf-interaction-locales.json +1 -1
- package/generated/plugins/copilot/agdf/skills/agdf-prd-definition/SKILL.md +3 -2
- package/generated/plugins/copilot/agdf/skills/agdf-qa-gate/SKILL.md +3 -2
- package/generated/plugins/copilot/agdf/skills/agdf-release-or/SKILL.md +8 -5
- package/generated/plugins/copilot/agdf/skills/agdf-sd-definition/SKILL.md +3 -2
- package/generated/plugins/copilot/agdf/skills/agdf-task-plan-review/SKILL.md +3 -2
- package/generated/plugins/copilot/agdf/skills/agdf-tp-definition/SKILL.md +3 -2
- package/generated/plugins/copilot/agdf/skills/agdf-ur-definition/SKILL.md +12 -4
- package/generated/plugins/copilot/agdf/skills/agdf-ux-intent-definition/SKILL.md +5 -4
- package/generated/plugins/copilot/agdf/skills/contracts/closeout.md +1 -1
- package/generated/plugins/copilot/agdf/skills/contracts/control-scaffold.md +63 -46
- package/generated/plugins/copilot/agdf/skills/contracts/gate-artifact-preparation.md +58 -48
- package/generated/plugins/copilot/agdf/skills/contracts/gate-transition.md +5 -6
- package/generated/plugins/copilot/agdf/skills/contracts/interaction.md +43 -126
- package/generated/plugins/copilot/agdf/skills/contracts/modes.md +4 -3
- package/generated/plugins/copilot/agdf/skills/contracts/prd-definition.md +6 -6
- package/generated/plugins/copilot/agdf/skills/contracts/quality.md +10 -2
- package/generated/plugins/copilot/agdf/skills/contracts/request-activation.md +9 -8
- package/generated/plugins/copilot/agdf/skills/contracts/sd-definition.md +3 -3
- package/generated/plugins/copilot/agdf/skills/contracts/task-target-resolution.md +24 -0
- package/generated/plugins/copilot/agdf/skills/contracts/tp-definition.md +1 -1
- package/generated/plugins/copilot/agdf/skills/contracts/ur-definition.md +41 -7
- package/generated/submissions/openai/agdf/.codex-plugin/plugin.json +1 -1
- package/generated/submissions/openai/agdf/meta/agdf-agent-router.md +3 -3
- package/generated/submissions/openai/agdf/meta/agdf-defaults.json +9 -0
- package/generated/submissions/openai/agdf/meta/agdf-defaults.schema.json +20 -0
- package/generated/submissions/openai/agdf/meta/agdf-interaction-locales.json +2668 -2682
- package/generated/submissions/openai/agdf/meta/agdf-plugin.definition.json +8 -3
- package/generated/submissions/openai/agdf/meta/contracts/closeout.md +1 -1
- package/generated/submissions/openai/agdf/meta/contracts/control-scaffold.md +63 -46
- package/generated/submissions/openai/agdf/meta/contracts/gate-artifact-preparation.md +58 -48
- package/generated/submissions/openai/agdf/meta/contracts/gate-transition.md +5 -6
- package/generated/submissions/openai/agdf/meta/contracts/interaction.md +43 -126
- package/generated/submissions/openai/agdf/meta/contracts/modes.md +4 -3
- package/generated/submissions/openai/agdf/meta/contracts/prd-definition.md +6 -6
- package/generated/submissions/openai/agdf/meta/contracts/quality.md +10 -2
- package/generated/submissions/openai/agdf/meta/contracts/request-activation.md +9 -8
- package/generated/submissions/openai/agdf/meta/contracts/sd-definition.md +3 -3
- package/generated/submissions/openai/agdf/meta/contracts/task-target-resolution.md +24 -0
- package/generated/submissions/openai/agdf/meta/contracts/tp-definition.md +1 -1
- package/generated/submissions/openai/agdf/meta/contracts/ur-definition.md +41 -7
- package/generated/submissions/openai/agdf/meta/copilot-payload-baseline.json +3 -3
- package/generated/submissions/openai/agdf/meta/distribution-profile-history.json +7 -0
- package/generated/submissions/openai/agdf/plugin.json +1 -1
- package/generated/submissions/openai/agdf/skills/brownfield-analysis/SKILL.md +8 -5
- package/generated/submissions/openai/agdf/skills/clean-implementation-review/SKILL.md +3 -2
- package/generated/submissions/openai/agdf/skills/code-review/SKILL.md +5 -3
- package/generated/submissions/openai/agdf/skills/delivery-closeout/SKILL.md +3 -2
- package/generated/submissions/openai/agdf/skills/delivery-path-search/SKILL.md +3 -2
- package/generated/submissions/openai/agdf/skills/gate-check/SKILL.md +35 -31
- package/generated/submissions/openai/agdf/skills/prd-definition/SKILL.md +3 -2
- package/generated/submissions/openai/agdf/skills/qa-gate/SKILL.md +3 -2
- package/generated/submissions/openai/agdf/skills/release-or/SKILL.md +8 -5
- package/generated/submissions/openai/agdf/skills/sd-definition/SKILL.md +3 -2
- package/generated/submissions/openai/agdf/skills/task-plan-review/SKILL.md +3 -2
- package/generated/submissions/openai/agdf/skills/tp-definition/SKILL.md +3 -2
- package/generated/submissions/openai/agdf/skills/ur-definition/SKILL.md +12 -4
- package/generated/submissions/openai/agdf/skills/ux-intent-definition/SKILL.md +5 -4
- package/generated/submissions/openai/agdf/submission/openai/availability.md +1 -1
- package/generated/submissions/openai/agdf/submission/openai/capability-matrix.json +1 -1
- package/generated/submissions/openai/agdf/submission/openai/inventory.json +49 -41
- package/generated/submissions/openai/agdf/submission/openai/listing.json +1 -1
- package/generated/submissions/openai/agdf/submission/openai/readiness.json +2 -2
- package/generated/submissions/openai/agdf/submission/openai/readiness.md +2 -2
- package/generated/submissions/openai/agdf/submission/openai/release-notes.md +9 -1
- package/generated/submissions/openai/agdf/submission/openai/reviewer-cases.json +1 -1
- package/lib/cli/application.js +31 -43
- package/lib/cli/codex-document-command.js +195 -0
- package/lib/cli/command-registry.js +82 -148
- package/lib/cli/control-maintenance-command.js +8 -37
- package/lib/cli/parse-args.js +98 -16
- package/lib/cli/planned-command.js +55 -0
- package/lib/cli/project-init-command.js +21 -0
- package/lib/cli/project-read-command.js +35 -0
- package/lib/cli/run-command-aliases.js +116 -0
- package/lib/cli/runtime-context.js +1 -59
- package/lib/cli/validation-handlers.js +33 -103
- package/lib/control-evaluation/git-observation.js +7 -5
- package/lib/control-maintenance/startup.js +2 -2
- package/lib/host-adapters/codex/plugin.js +48 -1
- package/lib/install-setup/contract.js +4 -4
- package/lib/install-setup/{control-migration.js → control-compatibility.js} +1 -2
- package/lib/install-setup/interaction.js +0 -1
- package/lib/install-setup/presentation.js +3 -4
- package/lib/install-setup/service.js +5 -18
- package/lib/installers/local-marketplace.js +262 -8
- package/lib/lifecycle/codex-startup-status.js +29 -0
- package/lib/lifecycle/presentation.js +6 -0
- package/lib/mcp-decision-protocol.js +40 -0
- package/lib/mcp-dispatch-runtime.js +71 -306
- package/lib/mcp-lifecycle/adapters/codex-origin-probe.js +28 -4
- package/lib/mcp-lifecycle/evidence.js +2 -1
- package/lib/mcp-lifecycle/facade-entry.js +3 -24
- package/lib/mcp-lifecycle/facade-owner-entry.js +31 -15
- package/lib/mcp-lifecycle/facade-runtime.js +29 -0
- package/lib/mcp-lifecycle/facade-thread-entry.js +11 -0
- package/lib/mcp-lifecycle/owner-client.js +79 -0
- package/lib/mcp-lifecycle/package.js +14 -80
- package/lib/mcp-lifecycle/plugin-runtime.js +29 -9
- package/lib/mcp-lifecycle/service.js +5 -4
- package/lib/mcp-lifecycle/thread-owner.js +164 -0
- package/lib/mcp-owner-protocol.js +1 -0
- package/lib/mcp-protocol-runtime.js +308 -0
- package/lib/mcp-worker-runtime.js +152 -0
- package/lib/runtime/control-command-service.js +22 -7
- package/lib/runtime/control-context.js +8 -1
- package/lib/runtime/validator-application.js +2 -2
- package/lib/scaffold/canonical-init.js +2 -691
- package/lib/scaffold/plan.js +9 -32
- package/lib/scaffold/presentation.js +2 -2
- package/lib/scaffold/write.js +6 -1
- package/package.json +6 -2
- package/runtime/core/lib/control-evaluation/closeout-readiness.js +10 -2
- package/runtime/core/lib/control-evaluation/decision-content-placeholder.js +9 -0
- package/runtime/core/lib/control-evaluation/decision-content-readiness.js +2 -7
- package/runtime/core/lib/control-evaluation/definition-sources.js +3 -2
- package/runtime/core/lib/control-evaluation/delivery-map.js +2 -12
- package/runtime/core/lib/control-evaluation/doctor.js +162 -172
- package/runtime/core/lib/control-evaluation/gate-check.js +10 -9
- package/runtime/core/lib/control-evaluation/gate-policy-inputs.js +11 -0
- package/runtime/core/lib/control-evaluation/gate-policy-pure.js +446 -0
- package/runtime/core/lib/control-evaluation/gate-policy.js +3 -434
- package/runtime/core/lib/control-evaluation/next-action.js +2 -0
- package/runtime/core/lib/control-evaluation/parent-reconciliation.js +2 -1
- package/runtime/core/lib/control-evaluation/qa-follow-up.js +2 -1
- package/runtime/core/lib/control-evaluation/required-files.js +9 -7
- package/runtime/core/lib/control-evaluation/run-state-policy.js +1 -1
- package/runtime/core/lib/control-evaluation/run-state.js +15 -9
- package/runtime/core/lib/control-evaluation/run-step-policy.js +2 -1
- package/runtime/core/lib/control-evaluation/run-work-summary.js +6 -4
- package/runtime/core/lib/control-evaluation/shared-value.js +7 -0
- package/runtime/core/lib/control-evaluation/shared.js +5 -254
- package/runtime/core/lib/control-evaluation/tp-planning.js +3 -2
- package/runtime/core/lib/control-evaluation/ur-readiness.js +7 -2
- package/runtime/core/lib/control-evaluation/verified-change.js +11 -9
- 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
- package/runtime/core/lib/control-inspect/artifact-readiness.js +5 -3
- package/runtime/core/lib/control-inspect/authoring-inputs.js +110 -0
- package/runtime/core/lib/control-inspect/cockpit-archive.js +53 -0
- package/runtime/core/lib/control-inspect/cockpit-context.js +2 -1
- package/runtime/core/lib/control-inspect/cockpit-contract.js +11 -4
- package/runtime/core/lib/control-inspect/cockpit-list.d.ts +10 -6
- package/runtime/core/lib/control-inspect/cockpit-list.js +32 -41
- package/runtime/core/lib/control-inspect/cockpit-session.js +8 -8
- package/runtime/core/lib/control-inspect/cockpit-work.js +33 -0
- package/runtime/core/lib/control-inspect/cockpit.js +75 -44
- package/runtime/core/lib/control-inspect/contract.js +124 -32
- package/runtime/core/lib/control-inspect/decision-session.js +53 -11
- package/runtime/core/lib/control-inspect/doctor-observation.js +91 -0
- package/runtime/core/lib/control-inspect/project-operation-call.js +5 -0
- package/runtime/core/lib/control-inspect/project-state.js +48 -0
- package/runtime/core/lib/control-inspect/result.js +61 -0
- package/runtime/core/lib/control-inspect/selection.js +9 -3
- package/runtime/core/lib/control-inspect/service.js +119 -67
- package/runtime/core/lib/control-maintenance/compatibility.js +42 -132
- package/runtime/core/lib/control-maintenance/contract.js +5 -5
- package/runtime/core/lib/control-maintenance/presentation.js +27 -119
- package/runtime/core/lib/control-maintenance/service.js +9 -37
- package/runtime/core/lib/control-read/cockpit-pool.js +25 -9
- package/runtime/core/lib/control-read/cockpit-worker.js +4 -3
- package/runtime/core/lib/control-read/doctor-reader.js +92 -0
- package/runtime/core/lib/control-read/doctor-worker.js +11 -0
- package/runtime/core/lib/control-read/fs.js +18 -0
- package/runtime/core/lib/control-read/snapshot.js +68 -17
- package/runtime/core/lib/control-state/aggregate.js +3 -1
- package/runtime/core/lib/control-state/approval-command.js +13 -10
- package/runtime/core/lib/control-state/approval-operations.js +10 -7
- package/runtime/core/lib/control-state/artefact-binding-proof.js +12 -20
- package/runtime/core/lib/control-state/artefact-bindings.js +10 -7
- package/runtime/core/lib/control-state/canonical-initialization.js +761 -0
- package/runtime/core/lib/control-state/control-layout.js +183 -0
- package/runtime/core/lib/control-state/decision-action-contract.js +10 -1
- package/runtime/core/lib/control-state/decision-action-service.js +24 -3
- package/runtime/core/lib/control-state/decision-material-contract.js +2 -1
- package/runtime/core/lib/control-state/evidence-bindings.js +7 -7
- package/runtime/core/lib/control-state/git-identity.js +86 -0
- package/runtime/core/lib/control-state/index.js +0 -1
- package/runtime/core/lib/control-state/input-resolution.js +99 -0
- package/runtime/core/lib/control-state/planned-entry.js +273 -0
- package/runtime/core/lib/control-state/planned-handoff.js +174 -0
- package/runtime/core/lib/control-state/planned-inventory.js +90 -0
- package/runtime/core/lib/control-state/planned-origin-reader.js +48 -0
- package/runtime/core/lib/control-state/planned-origin.js +40 -0
- package/runtime/core/lib/control-state/presentation-decision.js +12 -7
- package/runtime/core/lib/control-state/presentation-delivery.js +90 -0
- package/runtime/core/lib/control-state/preview-render.js +5 -2
- package/runtime/core/lib/control-state/preview-review.js +3 -2
- package/runtime/core/lib/control-state/preview-snapshot.js +9 -6
- package/runtime/core/lib/control-state/recording-formats.js +12 -16
- package/runtime/core/lib/control-state/run-artefact-recording.js +54 -66
- package/runtime/core/lib/control-state/run-closure.js +343 -0
- package/runtime/core/lib/control-state/run-command-contract.js +33 -250
- package/runtime/core/lib/control-state/run-command-schema.js +508 -0
- package/runtime/core/lib/control-state/run-command-service.js +198 -34
- package/runtime/core/lib/control-state/run-create-command.js +60 -0
- package/runtime/core/lib/control-state/run-identity.d.ts +14 -0
- package/runtime/core/lib/control-state/run-identity.js +40 -0
- package/runtime/core/lib/control-state/run-input-resolution.js +72 -0
- package/runtime/core/lib/control-state/run-inventory-reader.js +31 -0
- package/runtime/core/lib/control-state/run-inventory.js +179 -0
- package/runtime/core/lib/control-state/run-material.js +211 -0
- package/runtime/core/lib/control-state/run-mutation.js +51 -0
- package/runtime/core/lib/control-state/run-operation-identity.js +2 -1
- package/runtime/core/lib/control-state/run-operation-proof.js +7 -4
- package/runtime/core/lib/control-state/run-operation-status.js +20 -4
- package/runtime/core/lib/control-state/run-operations.js +70 -13
- package/runtime/core/lib/control-state/run-owned-outputs.js +21 -9
- package/runtime/core/lib/control-state/run-presentation-envelope.js +25 -33
- package/runtime/core/lib/control-state/run-presentation-render.js +8 -7
- package/runtime/core/lib/control-state/run-presentation.js +45 -21
- package/runtime/core/lib/control-state/run-recording.js +10 -179
- package/runtime/core/lib/control-state/run-revision-boundary.js +7 -21
- package/runtime/core/lib/control-state/run-revision-history.js +23 -16
- package/runtime/core/lib/control-state/run-revision.js +84 -161
- package/runtime/core/lib/control-state/run-seal-compute.js +19 -44
- package/runtime/core/lib/control-state/run-seal.js +6 -1
- package/runtime/core/lib/control-state/run-source-revisions.js +19 -18
- package/runtime/core/lib/control-state/run-state-document.js +110 -42
- package/runtime/core/lib/control-state/run-state-edits.js +13 -5
- package/runtime/core/lib/control-state/run-state-parser.js +14 -6
- package/runtime/core/lib/control-state/run-state-reader.js +27 -18
- package/runtime/core/lib/control-state/run-state-repository.js +112 -48
- package/runtime/core/lib/control-state/run-state-resolver.js +12 -15
- package/runtime/core/lib/control-state/run-state-writer.js +21 -377
- package/runtime/core/lib/control-state/run-step-pending.js +2 -1
- package/runtime/core/lib/control-state/run-step-transaction.js +125 -114
- package/runtime/core/lib/control-state/run-steps.js +136 -248
- package/runtime/core/lib/control-state/run-store-inspection.js +14 -2
- package/runtime/core/lib/control-state/run-verified-change.js +81 -0
- package/runtime/core/lib/control-state/run-work-summary-shape.d.ts +1 -0
- 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
- package/runtime/core/lib/delivery-continuation/service.js +5 -66
- package/runtime/core/lib/delivery-path-search/persistence.js +26 -8
- package/runtime/core/lib/delivery-path-search/state-adapter.js +1 -1
- package/runtime/core/lib/index.js +14 -6
- package/runtime/core/lib/interaction-catalog.js +3 -3
- package/runtime/core/lib/interaction-presentation.js +29 -11
- package/runtime/core/lib/mcp-input-hints.js +46 -0
- package/runtime/core/lib/mcp-input-resolution.js +98 -0
- package/runtime/core/lib/mcp-input-schema.js +15 -0
- package/runtime/core/lib/mcp-resource-contract.js +1 -1
- package/runtime/core/lib/mcp-tool-errors.js +31 -15
- package/runtime/core/lib/owned-file-lock.js +266 -0
- package/runtime/core/lib/owner-placement.js +50 -0
- package/runtime/core/lib/resources/canonical-init-plan.js +34 -0
- package/runtime/core/lib/resources/configuration.js +92 -0
- package/runtime/core/lib/resources/context.js +7 -11
- package/runtime/core/lib/resources/language-preference.js +59 -0
- package/runtime/core/lib/runtime/mcp-owner-protocol.js +102 -0
- package/runtime/core/lib/runtime/plugin-provenance.js +173 -18
- package/runtime/core/lib/skill-dispatch/compact-continuation.js +3 -3
- package/runtime/core/lib/skill-dispatch/contract.js +28 -9
- package/runtime/core/lib/skill-dispatch/delivery-intake.js +11 -5
- package/runtime/core/lib/skill-dispatch/delivery-run-assignment.js +6 -10
- package/runtime/core/lib/skill-dispatch/mcp-continuation.js +64 -0
- package/runtime/core/lib/skill-dispatch/prd-definition.js +14 -5
- package/runtime/core/lib/skill-dispatch/sd-definition.js +2 -1
- package/runtime/core/lib/skill-dispatch/service.js +49 -14
- package/runtime/core/lib/skill-dispatch/tp-definition.js +2 -1
- package/generated/.agdf/control/templates/AGDF_RUN.md +0 -139
- package/generated/.agdf/control/templates/MASTER_BACKLOG.md +0 -39
- package/generated/plugins/agdf/control/templates/AGDF_RUN.md +0 -139
- package/generated/plugins/agdf/control/templates/MASTER_BACKLOG.md +0 -39
- package/generated/plugins/agdf/runtime/create-agdf/lib/control-maintenance/interaction.js +0 -28
- package/generated/plugins/agdf/runtime/create-agdf/lib/control-maintenance/repair.js +0 -4
- package/generated/plugins/agdf/runtime/create-agdf/lib/control-maintenance/service.js +0 -3
- package/generated/plugins/agdf/runtime/create-agdf/lib/control-state/run-recovery.js +0 -5
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-inspect/cockpit-backlog.js +0 -135
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/interaction.js +0 -57
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/migration.js +0 -85
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/repair.js +0 -226
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/backlog-summary-shape.d.ts +0 -4
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/backlog-summary.js +0 -67
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/legacy-migration.js +0 -69
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/legacy-projection-reader.js +0 -38
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-backlog-writer.js +0 -80
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-backlog.js +0 -90
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-recovery.js +0 -296
- package/generated/plugins/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-relationship-correction.js +0 -74
- package/generated/plugins/copilot/agdf/control/templates/AGDF_RUN.md +0 -139
- package/generated/plugins/copilot/agdf/control/templates/MASTER_BACKLOG.md +0 -39
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/control-maintenance/interaction.js +0 -28
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/control-maintenance/repair.js +0 -4
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/control-maintenance/service.js +0 -3
- package/generated/plugins/copilot/agdf/runtime/create-agdf/lib/control-state/run-recovery.js +0 -5
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/interaction.js +0 -57
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/migration.js +0 -85
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-maintenance/repair.js +0 -226
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/backlog-summary-shape.d.ts +0 -4
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/backlog-summary.js +0 -67
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/legacy-migration.js +0 -69
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/legacy-projection-reader.js +0 -38
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-backlog-writer.js +0 -80
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-backlog.js +0 -90
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-recovery.js +0 -296
- package/generated/plugins/copilot/agdf/runtime/create-agdf/runtime/core/lib/control-state/run-relationship-correction.js +0 -74
- package/lib/control-maintenance/interaction.js +0 -28
- package/lib/control-maintenance/repair.js +0 -4
- package/lib/control-maintenance/service.js +0 -3
- package/lib/control-state/run-recovery.js +0 -5
- package/lib/install-setup/control-repair.js +0 -1
- package/runtime/core/lib/control-inspect/cockpit-backlog.js +0 -135
- package/runtime/core/lib/control-maintenance/interaction.js +0 -57
- package/runtime/core/lib/control-maintenance/migration.js +0 -85
- package/runtime/core/lib/control-maintenance/repair.js +0 -226
- package/runtime/core/lib/control-state/backlog-summary-shape.d.ts +0 -4
- package/runtime/core/lib/control-state/backlog-summary.js +0 -67
- package/runtime/core/lib/control-state/legacy-migration.js +0 -69
- package/runtime/core/lib/control-state/legacy-projection-reader.js +0 -38
- package/runtime/core/lib/control-state/run-backlog-writer.js +0 -80
- package/runtime/core/lib/control-state/run-backlog.js +0 -90
- package/runtime/core/lib/control-state/run-recovery.js +0 -296
- package/runtime/core/lib/control-state/run-relationship-correction.js +0 -74
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { existsSync, lstatSync, mkdirSync, readdirSync, unlinkSync } from 'node:fs';
|
|
3
|
+
import { join, dirname } from 'node:path';
|
|
4
|
+
import { atomicWrite, fsyncDirectory, withOwnedFileLock } from '../owned-file-lock.js';
|
|
5
|
+
import { renameSyncWithRetry } from '../fs-swap.js';
|
|
6
|
+
import { canonicalRunText } from './run-seal-compute.js';
|
|
7
|
+
import { exactObject, canonicalJson } from './approval-command-contract.js';
|
|
8
|
+
import { RUN_ID_PATTERN, REVISION_ID_PATTERN } from './run-identity.js';
|
|
9
|
+
import { hasSymlinkComponent, containedRegularFile } from './contained-file.js';
|
|
10
|
+
import { CURRENT_LAYOUT, readControlLayout, withControlMutation, withControlRecovery, inspectMutationClaims, markControlMutationEffect } from './control-layout.js';
|
|
11
|
+
import { evaluateUrContentReadiness } from '../control-evaluation/ur-readiness.js';
|
|
12
|
+
import { resolveArtifactPresentationLanguages } from '../resources/context.js';
|
|
13
|
+
import { readContainedControlText, controlPathPresent } from '../control-read/snapshot.js';
|
|
14
|
+
import { assertPlannedNotTransferred } from './planned-origin-reader.js';
|
|
15
|
+
import { bindInputResolution, resolutionRecord } from './input-resolution.js';
|
|
16
|
+
import { existsSync as observedExists } from '../control-read/fs.js';
|
|
17
|
+
|
|
18
|
+
export const PLANNED_SCHEMA = 'planned-ur-v1';
|
|
19
|
+
export const PLANNED_ROOT = '.agdf/control/planned';
|
|
20
|
+
export const PLANNED_INTENT_BYTES = 1048576;
|
|
21
|
+
export const plannedTextDigest = text => 'sha256:' + createHash('sha256').update(canonicalRunText(text)).digest('hex');
|
|
22
|
+
export const plannedRawDigest = text => 'sha256:' + createHash('sha256').update(text).digest('hex');
|
|
23
|
+
const digestPattern = /^sha256:[a-f0-9]{64}$/u;
|
|
24
|
+
const fail = code => { throw Error(code); };
|
|
25
|
+
const priorities = ['high', 'normal', 'low'];
|
|
26
|
+
const json = value => JSON.stringify(value) + '\n';
|
|
27
|
+
export const planningId = operationId => {
|
|
28
|
+
if (!REVISION_ID_PATTERN.test(operationId)) fail('AGDF_PLANNED_OPERATION_INVALID');
|
|
29
|
+
return `plan-${operationId}`;
|
|
30
|
+
};
|
|
31
|
+
export function plannedEntryPath(id) {
|
|
32
|
+
if (typeof id !== 'string' || !RUN_ID_PATTERN.test(id)) fail('AGDF_PLANNED_ID_INVALID');
|
|
33
|
+
return `${PLANNED_ROOT}/${id}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function safeRead(root, path, limit = 131072) {
|
|
37
|
+
try { return readContainedControlText(root, path, limit); }
|
|
38
|
+
catch (error) { if (error.code === 'resource_denied') fail('AGDF_PLANNED_PATH_INVALID'); throw error; }
|
|
39
|
+
}
|
|
40
|
+
function ensureDirectory(root, relative) {
|
|
41
|
+
if (hasSymlinkComponent(root, relative)) fail('AGDF_PLANNED_PATH_INVALID');
|
|
42
|
+
const path = join(root, relative);
|
|
43
|
+
if (!existsSync(path)) {
|
|
44
|
+
try { mkdirSync(path, { mode: 0o700 }); fsyncDirectory(dirname(path)); }
|
|
45
|
+
catch (error) { if (error.code !== 'EEXIST') throw error; }
|
|
46
|
+
}
|
|
47
|
+
const stat = lstatSync(path);
|
|
48
|
+
if (!stat.isDirectory() || stat.isSymbolicLink()) fail('AGDF_PLANNED_PATH_INVALID');
|
|
49
|
+
}
|
|
50
|
+
function validateContent(content) {
|
|
51
|
+
if (typeof content !== 'string' || !content.isWellFormed() || Buffer.byteLength(content) > 131072
|
|
52
|
+
|| /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/u.test(content)) fail('AGDF_PLANNED_CONTENT_INVALID');
|
|
53
|
+
return canonicalRunText(content);
|
|
54
|
+
}
|
|
55
|
+
export function parsePlannedUr(content, expectedId) {
|
|
56
|
+
const text = validateContent(content), metadata = text.split(/^##[ \t]+/mu)[0];
|
|
57
|
+
const field = key => {
|
|
58
|
+
const rows = [...metadata.matchAll(new RegExp(`^${key}:[ \\t]*([^\\n]*)$`, 'gmu'))];
|
|
59
|
+
if (rows.length !== 1) fail('AGDF_PLANNED_METADATA_INVALID');
|
|
60
|
+
return rows[0][1].trim();
|
|
61
|
+
};
|
|
62
|
+
const schema = field('Planning schema'), id = field('Planning id'), priority = field('Planning priority');
|
|
63
|
+
if (schema !== PLANNED_SCHEMA || !RUN_ID_PATTERN.test(id) || expectedId && id !== expectedId || !priorities.includes(priority)) fail('AGDF_PLANNED_METADATA_INVALID');
|
|
64
|
+
const titles = [...text.matchAll(/^# ([^\n]+)$/gmu)];
|
|
65
|
+
if (titles.length !== 1 || !text.startsWith('# ') || !titles[0][1].trim() || titles[0][1].length > 1024) fail('AGDF_PLANNED_TITLE_INVALID');
|
|
66
|
+
const title = titles[0][1].replace(/^UR:[ \t]*/u, '').trim();
|
|
67
|
+
if (!title) fail('AGDF_PLANNED_TITLE_INVALID');
|
|
68
|
+
return { schema, plan_id: id, priority, title, content: text, digest: plannedTextDigest(text) };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function preparePlannedUr(content, id, priority = 'normal') {
|
|
72
|
+
plannedEntryPath(id);
|
|
73
|
+
const text = validateContent(content);
|
|
74
|
+
if (!priorities.includes(priority) || /^Planning (schema|id|priority):/mu.test(text)) fail('AGDF_PLANNED_METADATA_INVALID');
|
|
75
|
+
const end = text.indexOf('\n');
|
|
76
|
+
if (end < 0) fail('AGDF_PLANNED_TITLE_INVALID');
|
|
77
|
+
const candidate = text.slice(0, end + 1) + `\nPlanning schema: ${PLANNED_SCHEMA}\nPlanning id: ${id}\nPlanning priority: ${priority}\n` + text.slice(end + 1);
|
|
78
|
+
return parsePlannedUr(candidate, id).content;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function inspectPlannedEntry(root, id, { presentationLanguage } = {}) {
|
|
82
|
+
const path = `${plannedEntryPath(id)}/UR.md`;
|
|
83
|
+
const raw = safeRead(root, path), entry = parsePlannedUr(raw, id);
|
|
84
|
+
const readiness = evaluateUrContentReadiness(entry.content, { languages: resolveArtifactPresentationLanguages(root, presentationLanguage), path, requireClarification: true });
|
|
85
|
+
return { ...entry, raw_digest: plannedRawDigest(raw), path, readiness, pending: controlPathPresent(root, `${plannedEntryPath(id)}/MUTATION_PENDING.json`), authorizes: false };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function withPlannedEntryLock(root, id, work, { operation_id, recovery = false, resume = false, proveOutcome, checkpoint } = {}) {
|
|
89
|
+
const path = plannedEntryPath(id);
|
|
90
|
+
readControlLayout(root);
|
|
91
|
+
ensureDirectory(root, PLANNED_ROOT);
|
|
92
|
+
if (hasSymlinkComponent(root, path)) fail('AGDF_PLANNED_PATH_INVALID');
|
|
93
|
+
return withOwnedFileLock(join(root, PLANNED_ROOT, `.entry-${id}`), () => {
|
|
94
|
+
const resource = `planned:${id}`;
|
|
95
|
+
const recovering = recovery || resume && inspectMutationClaims(root, { strict: false }).some(row => row.resource === resource && row.operation_id === operation_id);
|
|
96
|
+
return recovering ? withControlRecovery(root, { resource, operation_id, proveOutcome }, work)
|
|
97
|
+
: withControlMutation(root, { resource, operation_id, checkpoint }, work);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function validReceipt(receipt, id) {
|
|
102
|
+
receipt = resolutionRecord(receipt);
|
|
103
|
+
if (!receipt) return false;
|
|
104
|
+
return exactObject(receipt, ['schema_version', 'kind', 'operation_id', 'plan_id', 'request_digest', 'previous_digest', 'resulting_digest'])
|
|
105
|
+
&& receipt.schema_version === 1 && ['planned_ur.create', 'planned_ur.replace'].includes(receipt.kind)
|
|
106
|
+
&& REVISION_ID_PATTERN.test(receipt.operation_id) && receipt.plan_id === id && digestPattern.test(receipt.request_digest)
|
|
107
|
+
&& (receipt.previous_digest === null || digestPattern.test(receipt.previous_digest)) && digestPattern.test(receipt.resulting_digest)
|
|
108
|
+
&& (receipt.kind === 'planned_ur.create' ? receipt.previous_digest === null : receipt.previous_digest !== null);
|
|
109
|
+
}
|
|
110
|
+
function receiptPath(id, operationId) { return `${plannedEntryPath(id)}/operations/${operationId}.json`; }
|
|
111
|
+
function receiptAt(root, id, operationId) {
|
|
112
|
+
const path = receiptPath(id, operationId);
|
|
113
|
+
if (!existsSync(join(root, path))) return null;
|
|
114
|
+
let receipt; try { receipt = JSON.parse(safeRead(root, path, 16384)); } catch { fail('AGDF_PLANNED_RECOVERY_REQUIRED'); }
|
|
115
|
+
if (!validReceipt(receipt, id) || receipt.operation_id !== operationId) fail('AGDF_PLANNED_RECOVERY_REQUIRED');
|
|
116
|
+
return receipt;
|
|
117
|
+
}
|
|
118
|
+
function publishReceipt(root, receipt) {
|
|
119
|
+
const path = receiptPath(receipt.plan_id, receipt.operation_id);
|
|
120
|
+
ensureDirectory(root, `${plannedEntryPath(receipt.plan_id)}/operations`);
|
|
121
|
+
if (existsSync(join(root, path))) {
|
|
122
|
+
if (safeRead(root, path, 16384) !== json(receipt)) fail('AGDF_PLANNED_RECOVERY_REQUIRED');
|
|
123
|
+
} else atomicWrite(join(root, path), json(receipt));
|
|
124
|
+
}
|
|
125
|
+
function readIntent(root, id) {
|
|
126
|
+
const path = `${plannedEntryPath(id)}/MUTATION_PENDING.json`;
|
|
127
|
+
let intent; try { intent = JSON.parse(safeRead(root, path, PLANNED_INTENT_BYTES)); } catch { fail('AGDF_PLANNED_RECOVERY_REQUIRED'); }
|
|
128
|
+
if (!exactObject(intent, ['schema_version', 'receipt', 'old', 'next']) || intent.schema_version !== 1
|
|
129
|
+
|| !validReceipt(intent.receipt, id) || intent.receipt.kind !== 'planned_ur.replace'
|
|
130
|
+
|| typeof intent.old !== 'string' || typeof intent.next !== 'string'
|
|
131
|
+
|| parsePlannedUr(intent.old, id).digest !== intent.receipt.previous_digest
|
|
132
|
+
|| parsePlannedUr(intent.next, id).digest !== intent.receipt.resulting_digest) fail('AGDF_PLANNED_RECOVERY_REQUIRED');
|
|
133
|
+
return { path, intent };
|
|
134
|
+
}
|
|
135
|
+
export function recoverPlannedMutationLocked(root, id, operationId) {
|
|
136
|
+
const path = `${plannedEntryPath(id)}/MUTATION_PENDING.json`;
|
|
137
|
+
if (!existsSync(join(root, path))) return { status: 'none' };
|
|
138
|
+
const { intent } = readIntent(root, id);
|
|
139
|
+
if (intent.receipt.operation_id !== operationId) fail('AGDF_PLANNED_RECOVERY_REQUIRED');
|
|
140
|
+
const current = safeRead(root, `${plannedEntryPath(id)}/UR.md`);
|
|
141
|
+
let status;
|
|
142
|
+
if (current === intent.old) status = 'rolled_back';
|
|
143
|
+
else if (current === intent.next) { publishReceipt(root, intent.receipt); status = 'completed'; }
|
|
144
|
+
else fail('AGDF_PLANNED_RECOVERY_REQUIRED');
|
|
145
|
+
unlinkSync(join(root, path)); fsyncDirectory(join(root, plannedEntryPath(id)));
|
|
146
|
+
return { status, receipt: status === 'completed' ? intent.receipt : null };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function recoverPlannedMutation(root, id, operationId) {
|
|
150
|
+
return withPlannedEntryLock(root, id, () => recoverPlannedMutationLocked(root, id, operationId), {
|
|
151
|
+
recovery: true, operation_id: operationId, proveOutcome: result => ['none', 'completed', 'rolled_back'].includes(result.status),
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function inspectPlannedOperation(root, id, operationId) {
|
|
156
|
+
plannedEntryPath(id);
|
|
157
|
+
if (!REVISION_ID_PATTERN.test(operationId ?? '')) fail('AGDF_PLANNED_OPERATION_INVALID');
|
|
158
|
+
const receipt = receiptAt(root, id, operationId);
|
|
159
|
+
const pendingPath = `${plannedEntryPath(id)}/MUTATION_PENDING.json`;
|
|
160
|
+
const pending = observedExists(join(root, pendingPath)) ? readIntent(root, id).intent.receipt : null;
|
|
161
|
+
const stagePath = `${PLANNED_ROOT}/.stage-${id}-${operationId}/OWNER.json`;
|
|
162
|
+
let creation = null;
|
|
163
|
+
if (observedExists(join(root, stagePath))) {
|
|
164
|
+
creation = JSON.parse(safeRead(root, stagePath, 16384));
|
|
165
|
+
if (!validReceipt(creation, id) || creation.operation_id !== operationId) fail('AGDF_PLANNED_RECOVERY_REQUIRED');
|
|
166
|
+
}
|
|
167
|
+
return { status: receipt ? pending?.operation_id === operationId ? 'committed_recovery_required' : 'recorded'
|
|
168
|
+
: pending?.operation_id === operationId || creation ? 'pending' : 'absent', receipt,
|
|
169
|
+
pending: pending?.operation_id === operationId ? pending : creation, authorizes: false };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function inspectPlannedSelection(root, scope, options) {
|
|
173
|
+
plannedEntryPath(scope.plan_id);
|
|
174
|
+
if (readControlLayout(root).layout !== CURRENT_LAYOUT) fail('AGDF_CONTROL_LAYOUT_MIGRATION_REQUIRED');
|
|
175
|
+
if (scope.expected_digest === null) return { available: true, planning: scope, authorizes: false };
|
|
176
|
+
const entry = inspectPlannedEntry(root, scope.plan_id, options);
|
|
177
|
+
if (entry.digest !== scope.expected_digest) {
|
|
178
|
+
if (!entry.pending || readIntent(root, scope.plan_id).intent.receipt.previous_digest !== scope.expected_digest) fail('AGDF_PLANNED_SOURCE_STALE');
|
|
179
|
+
}
|
|
180
|
+
return { available: true, planning: scope, source_digest: entry.digest, authorizes: false };
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function replayPlannedUr(root, { plan_id, operation_id, request_digest }) {
|
|
184
|
+
return withPlannedEntryLock(root, plan_id, () => {
|
|
185
|
+
const previous = receiptAt(root, plan_id, operation_id);
|
|
186
|
+
if (!previous || previous.request_digest !== request_digest) fail('AGDF_OPERATION_PAYLOAD_CONFLICT');
|
|
187
|
+
if (existsSync(join(root, plannedEntryPath(plan_id), 'MUTATION_PENDING.json')) && readIntent(root, plan_id).intent.receipt.operation_id === operation_id)
|
|
188
|
+
recoverPlannedMutationLocked(root, plan_id, operation_id);
|
|
189
|
+
return { outcome: 'already_applied', receipt: previous, entry: inspectPlannedEntry(root, plan_id) };
|
|
190
|
+
}, { operation_id, resume: true, proveOutcome: result => result.outcome === 'already_applied' });
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Source content is the only editable authority. Receipts retain operation/source
|
|
194
|
+
// history but are never used as a saved title, priority, status or approval.
|
|
195
|
+
export function mutatePlannedUr(root, { kind, operation_id, plan_id = planningId(operation_id), expected_digest, content, priority, request_digest: commandDigest }, { checkpoint = () => {} } = {}) {
|
|
196
|
+
if (!['planned_ur.create', 'planned_ur.replace'].includes(kind) || !REVISION_ID_PATTERN.test(operation_id)
|
|
197
|
+
|| kind === 'planned_ur.create' && (expected_digest !== null || plan_id !== planningId(operation_id))
|
|
198
|
+
|| kind === 'planned_ur.replace' && (!digestPattern.test(expected_digest) || priority !== undefined)) fail('AGDF_PLANNED_OPERATION_INVALID');
|
|
199
|
+
const text = kind === 'planned_ur.create' ? preparePlannedUr(content, plan_id, priority) : parsePlannedUr(content, plan_id).content;
|
|
200
|
+
if (commandDigest !== undefined && !digestPattern.test(commandDigest)) fail('AGDF_PLANNED_OPERATION_INVALID');
|
|
201
|
+
const request_digest = commandDigest ?? plannedTextDigest(canonicalJson({ kind, plan_id, expected_digest, content: text }));
|
|
202
|
+
let effectStarted = false;
|
|
203
|
+
const execute = () => {
|
|
204
|
+
const base = plannedEntryPath(plan_id), destination = join(root, base);
|
|
205
|
+
const existing = receiptAt(root, plan_id, operation_id);
|
|
206
|
+
if (existing) {
|
|
207
|
+
if (existing.kind !== kind || existing.request_digest !== request_digest) fail('AGDF_OPERATION_PAYLOAD_CONFLICT');
|
|
208
|
+
if (existsSync(join(destination, 'MUTATION_PENDING.json')) && readIntent(root, plan_id).intent.receipt.operation_id === operation_id)
|
|
209
|
+
recoverPlannedMutationLocked(root, plan_id, operation_id);
|
|
210
|
+
return { outcome: 'already_applied', receipt: existing, entry: inspectPlannedEntry(root, plan_id) };
|
|
211
|
+
}
|
|
212
|
+
if (existsSync(join(destination, 'MUTATION_PENDING.json'))) {
|
|
213
|
+
if (readIntent(root, plan_id).intent.receipt.request_digest !== request_digest) fail('AGDF_OPERATION_PAYLOAD_CONFLICT');
|
|
214
|
+
recoverPlannedMutationLocked(root, plan_id, operation_id);
|
|
215
|
+
const recovered = receiptAt(root, plan_id, operation_id);
|
|
216
|
+
if (recovered) {
|
|
217
|
+
if (recovered.request_digest !== request_digest) fail('AGDF_OPERATION_PAYLOAD_CONFLICT');
|
|
218
|
+
return { outcome: 'already_applied', receipt: recovered, entry: inspectPlannedEntry(root, plan_id) };
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
for (const name of ['HANDOFF_PENDING.json', 'TRANSFER.json'])
|
|
222
|
+
if (existsSync(join(destination, name))) fail('AGDF_PLANNED_ALREADY_TRANSFERRED');
|
|
223
|
+
assertPlannedNotTransferred(root, plan_id);
|
|
224
|
+
const receipt = bindInputResolution({ schema_version: 1, kind, operation_id, plan_id, request_digest,
|
|
225
|
+
previous_digest: expected_digest, resulting_digest: plannedTextDigest(text) });
|
|
226
|
+
if (kind === 'planned_ur.create') {
|
|
227
|
+
if (existsSync(destination)) fail('AGDF_PLANNED_COLLISION');
|
|
228
|
+
const stage = `${PLANNED_ROOT}/.stage-${plan_id}-${operation_id}`, stagePath = join(root, stage);
|
|
229
|
+
if (hasSymlinkComponent(root, stage)) fail('AGDF_PLANNED_PATH_INVALID');
|
|
230
|
+
if (existsSync(stagePath)) {
|
|
231
|
+
if (!lstatSync(stagePath).isDirectory() || readdirSync(stagePath).some(name => !['OWNER.json', 'UR.md', 'operations'].includes(name))
|
|
232
|
+
|| safeRead(root, `${stage}/OWNER.json`, 16384) !== json(receipt)) fail('AGDF_PLANNED_RECOVERY_REQUIRED');
|
|
233
|
+
if (existsSync(join(stagePath, 'UR.md')) && safeRead(root, `${stage}/UR.md`) !== text) fail('AGDF_PLANNED_RECOVERY_REQUIRED');
|
|
234
|
+
if (existsSync(join(stagePath, 'operations'))) {
|
|
235
|
+
ensureDirectory(root, `${stage}/operations`);
|
|
236
|
+
if (readdirSync(join(stagePath, 'operations')).some(name => name !== `${operation_id}.json`)
|
|
237
|
+
|| existsSync(join(stagePath, 'operations', `${operation_id}.json`)) && safeRead(root, `${stage}/operations/${operation_id}.json`, 16384) !== json(receipt)) fail('AGDF_PLANNED_RECOVERY_REQUIRED');
|
|
238
|
+
}
|
|
239
|
+
} else {
|
|
240
|
+
effectStarted = true;
|
|
241
|
+
markControlMutationEffect();
|
|
242
|
+
ensureDirectory(root, stage);
|
|
243
|
+
atomicWrite(join(stagePath, 'OWNER.json'), json(receipt)); checkpoint('create_intent');
|
|
244
|
+
}
|
|
245
|
+
effectStarted = true;
|
|
246
|
+
markControlMutationEffect();
|
|
247
|
+
if (!existsSync(join(stagePath, 'UR.md'))) atomicWrite(join(stagePath, 'UR.md'), text);
|
|
248
|
+
checkpoint('create_source');
|
|
249
|
+
ensureDirectory(root, `${stage}/operations`);
|
|
250
|
+
if (!existsSync(join(stagePath, 'operations', `${operation_id}.json`))) atomicWrite(join(stagePath, 'operations', `${operation_id}.json`), json(receipt));
|
|
251
|
+
fsyncDirectory(join(stagePath, 'operations')); fsyncDirectory(stagePath); checkpoint('create_staged');
|
|
252
|
+
renameSyncWithRetry(stagePath, destination); fsyncDirectory(join(root, PLANNED_ROOT)); checkpoint('create_committed');
|
|
253
|
+
} else {
|
|
254
|
+
const old = safeRead(root, `${base}/UR.md`);
|
|
255
|
+
if (parsePlannedUr(old, plan_id).digest !== expected_digest) fail('AGDF_PLANNED_SOURCE_STALE');
|
|
256
|
+
if (old === text) fail('AGDF_PLANNED_SOURCE_UNCHANGED');
|
|
257
|
+
effectStarted = true;
|
|
258
|
+
markControlMutationEffect();
|
|
259
|
+
atomicWrite(join(destination, 'MUTATION_PENDING.json'), json({ schema_version: 1, receipt, old, next: text })); checkpoint('replace_intent');
|
|
260
|
+
atomicWrite(join(destination, 'UR.md'), text); checkpoint('replace_committed');
|
|
261
|
+
publishReceipt(root, receipt); checkpoint('replace_receipt');
|
|
262
|
+
unlinkSync(join(destination, 'MUTATION_PENDING.json')); fsyncDirectory(destination); checkpoint('replace_retired');
|
|
263
|
+
}
|
|
264
|
+
return { outcome: 'accepted', receipt, entry: inspectPlannedEntry(root, plan_id) };
|
|
265
|
+
};
|
|
266
|
+
return withPlannedEntryLock(root, plan_id, () => {
|
|
267
|
+
try { return execute(); }
|
|
268
|
+
catch (error) {
|
|
269
|
+
if (!effectStarted || /RECOVERY_REQUIRED/u.test(error.message)) throw error;
|
|
270
|
+
throw Object.assign(Error('AGDF_PLANNED_RECOVERY_REQUIRED'), { cause: error, operation_id, plan_id });
|
|
271
|
+
}
|
|
272
|
+
}, { operation_id, resume: true, proveOutcome: result => ['accepted', 'already_applied'].includes(result.outcome) });
|
|
273
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { RUN_OPERATION_VERSION } from './run-operations.js';
|
|
2
|
+
import { runDocumentPath, runHistoryPath } from './run-identity.js';
|
|
3
|
+
import { existsSync, lstatSync, mkdirSync, unlinkSync, readdirSync, rmdirSync } from 'node:fs';
|
|
4
|
+
import { join, dirname } from 'node:path';
|
|
5
|
+
import { atomicWrite, fsyncDirectory, withOwnedFileLock } from '../owned-file-lock.js';
|
|
6
|
+
import { readContainedControlText, controlPathPresent } from '../control-read/snapshot.js';
|
|
7
|
+
import { inspectPlannedEntry, withPlannedEntryLock, plannedEntryPath, plannedTextDigest, plannedRawDigest, PLANNED_INTENT_BYTES } from './planned-entry.js';
|
|
8
|
+
import { inspectPlannedOrigins } from './planned-origin-reader.js';
|
|
9
|
+
import { validPlannedOrigin } from './planned-origin.js';
|
|
10
|
+
import { exactObject, canonicalJson, digest, COOPERATIVE_ASSURANCE, resolveControlCommandTarget } from './approval-command-contract.js';
|
|
11
|
+
import { REVISION_ID_PATTERN, creationRunId } from './run-identity.js';
|
|
12
|
+
import { hasSymlinkComponent } from './contained-file.js';
|
|
13
|
+
import { markControlMutationEffect, withControlRecovery } from './control-layout.js';
|
|
14
|
+
import { createRun, recoverRunCreationStage } from './run-state-repository.js';
|
|
15
|
+
import { parseRunState } from './run-state-parser.js';
|
|
16
|
+
import { readRunOperations, appendRunOperation } from './run-operations.js';
|
|
17
|
+
import { projectUrObjective, upsertTableRow, appendTableRow, replaceFirstScalar } from './run-state-edits.js';
|
|
18
|
+
import { runSealState, computeRunSeals } from './run-seal.js';
|
|
19
|
+
import { bindInputResolution, resolutionRecord, recordedInputResolution } from './input-resolution.js';
|
|
20
|
+
|
|
21
|
+
const json = value => JSON.stringify(value) + '\n';
|
|
22
|
+
const fail = code => { throw Error(code); };
|
|
23
|
+
function ensureDirectory(root, path) {
|
|
24
|
+
if (hasSymlinkComponent(root, path)) fail('AGDF_PLANNED_HANDOFF_RECOVERY_REQUIRED');
|
|
25
|
+
const full = join(root, path);
|
|
26
|
+
if (!existsSync(full)) { mkdirSync(full, { mode: 0o700 }); fsyncDirectory(dirname(full)); }
|
|
27
|
+
if (!lstatSync(full).isDirectory() || lstatSync(full).isSymbolicLink()) fail('AGDF_PLANNED_HANDOFF_RECOVERY_REQUIRED');
|
|
28
|
+
}
|
|
29
|
+
function validateIntent(stored, id) {
|
|
30
|
+
const intent = resolutionRecord(stored);
|
|
31
|
+
if (!intent) fail('AGDF_PLANNED_HANDOFF_RECOVERY_REQUIRED');
|
|
32
|
+
if (!exactObject(intent, ['schema_version', 'origin', 'outputs']) || intent.schema_version !== 1 || !validPlannedOrigin(intent.origin)
|
|
33
|
+
|| intent.origin.plan_id !== id || !Array.isArray(intent.outputs) || intent.outputs.length !== 2) fail('AGDF_PLANNED_HANDOFF_RECOVERY_REQUIRED');
|
|
34
|
+
const { origin, outputs } = intent, base = `${runDocumentPath(origin.run_id, '')}/`;
|
|
35
|
+
const expected = [origin.initial_ur.path, origin.snapshot.path];
|
|
36
|
+
if (outputs.some((row, i) => !exactObject(row, ['path', 'content', 'digest']) || row.path !== expected[i]
|
|
37
|
+
|| typeof row.content !== 'string' || Buffer.byteLength(row.content) > 131072 || plannedTextDigest(row.content) !== row.digest)
|
|
38
|
+
|| outputs[0].content !== outputs[1].content || outputs[0].digest !== origin.planned.digest
|
|
39
|
+
|| plannedRawDigest(outputs[1].content) !== origin.raw_digest) fail('AGDF_PLANNED_HANDOFF_RECOVERY_REQUIRED');
|
|
40
|
+
const resolution = recordedInputResolution(stored);
|
|
41
|
+
if (resolution && (resolution.operation_id !== intent.origin.operation_id || resolution.kind !== 'run.create_from_planned'
|
|
42
|
+
|| resolution.effective_digest !== intent.origin.request_digest)) fail('AGDF_PLANNED_HANDOFF_RECOVERY_REQUIRED');
|
|
43
|
+
return stored;
|
|
44
|
+
}
|
|
45
|
+
function transferRecord(origin, originDigest) {
|
|
46
|
+
return { schema_version: 1, plan_id: origin.plan_id, run_id: origin.run_id, operation_id: origin.operation_id,
|
|
47
|
+
request_digest: origin.request_digest, source_digest: origin.planned.digest, origin_digest: originDigest };
|
|
48
|
+
}
|
|
49
|
+
function finishEntry(root, origin, originDigest, checkpoint) {
|
|
50
|
+
const base = plannedEntryPath(origin.plan_id), transfer = `${base}/TRANSFER.json`, pending = `${base}/HANDOFF_PENDING.json`;
|
|
51
|
+
const receipt = transferRecord(origin, originDigest), text = json(receipt);
|
|
52
|
+
if (existsSync(join(root, transfer))) {
|
|
53
|
+
if (readContainedControlText(root, transfer, 4096) !== text) fail('AGDF_PLANNED_HANDOFF_RECOVERY_REQUIRED');
|
|
54
|
+
} else { markControlMutationEffect(); atomicWrite(join(root, transfer), text); checkpoint('handoff_entry_receipt'); }
|
|
55
|
+
if (existsSync(join(root, pending))) {
|
|
56
|
+
const intent = validateIntent(JSON.parse(readContainedControlText(root, pending, PLANNED_INTENT_BYTES)), origin.plan_id);
|
|
57
|
+
if (canonicalJson(intent.origin) !== canonicalJson(origin)) fail('AGDF_PLANNED_HANDOFF_RECOVERY_REQUIRED');
|
|
58
|
+
unlinkSync(join(root, pending)); fsyncDirectory(join(root, base)); checkpoint('handoff_retired');
|
|
59
|
+
}
|
|
60
|
+
return receipt;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function inspectPlannedHandoffOperation(root, planId, operationId) {
|
|
64
|
+
plannedEntryPath(planId);
|
|
65
|
+
if (!REVISION_ID_PATTERN.test(operationId ?? '')) fail('AGDF_PLANNED_HANDOFF_INPUT_INVALID');
|
|
66
|
+
const observed = inspectPlannedOrigins(root, planId);
|
|
67
|
+
if (!observed.complete) return { status: 'unknown', reason: 'planned_origin_unconfirmed', findings: observed.findings, authorizes: false };
|
|
68
|
+
const known = observed.matches[0], path = `${plannedEntryPath(planId)}/HANDOFF_PENDING.json`;
|
|
69
|
+
if (known) {
|
|
70
|
+
if (known.origin.operation_id !== operationId) return { status: 'already_transferred', run_id: known.run_id, authorizes: false };
|
|
71
|
+
return { status: existsSync(join(root, path)) ? 'committed_recovery_required' : 'recorded', receipt: known.receipt,
|
|
72
|
+
request_digest: known.origin.request_digest, run_id: known.run_id, historical_effect: true, authorizes: false };
|
|
73
|
+
}
|
|
74
|
+
if (controlPathPresent(root, `${plannedEntryPath(planId)}/TRANSFER.json`)) return { status: 'unknown', reason: 'planned_transfer_unconfirmed', authorizes: false };
|
|
75
|
+
if (!existsSync(join(root, path))) return { status: 'absent', reason: 'absence_is_not_proof_of_non_execution', authorizes: false };
|
|
76
|
+
const pending = validateIntent(JSON.parse(readContainedControlText(root, path, PLANNED_INTENT_BYTES)), planId);
|
|
77
|
+
if (pending.origin.operation_id !== operationId) return { status: 'unknown', reason: 'another_pending_handoff', authorizes: false };
|
|
78
|
+
return { status: 'pending', request_digest: pending.origin.request_digest, pending, run_id: pending.origin.run_id, authorizes: false };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Explicit selected-source handoff, never approval. Entry -> deterministic
|
|
82
|
+
// creation -> staged Run publication. No active UR synchronization afterwards.
|
|
83
|
+
export function createRunFromPlanned(root, { plan_id, expected_digest, operation_id, target_id, request_digest, presentation_language = 'en', title },
|
|
84
|
+
{ packageVersion = '0.20.2', checkpoint = () => {} } = {}) {
|
|
85
|
+
plannedEntryPath(plan_id);
|
|
86
|
+
if (!REVISION_ID_PATTERN.test(operation_id ?? '') || !/^sha256:[a-f0-9]{64}$/u.test(expected_digest ?? '')
|
|
87
|
+
|| !/^sha256:[a-f0-9]{64}$/u.test(request_digest ?? '') || target_id !== resolveControlCommandTarget(root).target_id) fail('AGDF_PLANNED_HANDOFF_INPUT_INVALID');
|
|
88
|
+
let effectStarted = false;
|
|
89
|
+
return withPlannedEntryLock(root, plan_id, () => {
|
|
90
|
+
const execute = () => {
|
|
91
|
+
const origins = inspectPlannedOrigins(root, plan_id);
|
|
92
|
+
if (!origins.complete) fail('AGDF_PLANNED_ORIGIN_UNCONFIRMED');
|
|
93
|
+
if (origins.matches.length) {
|
|
94
|
+
const known = origins.matches[0], originDigest = digest(canonicalJson(known.receipt.effect.record));
|
|
95
|
+
if (known.origin.operation_id === operation_id && (known.origin.request_digest !== request_digest || known.origin.target_id !== target_id)) fail('AGDF_OPERATION_PAYLOAD_CONFLICT');
|
|
96
|
+
effectStarted = true;
|
|
97
|
+
const finish = () => withOwnedFileLock(join(root, '.agdf/control/runs', `.create-${known.origin.operation_id}`),
|
|
98
|
+
() => finishEntry(root, known.origin, originDigest, checkpoint));
|
|
99
|
+
if (known.origin.operation_id === operation_id) finish();
|
|
100
|
+
else withControlRecovery(root, { resource: `planned:${plan_id}`, operation_id: known.origin.operation_id,
|
|
101
|
+
proveOutcome: () => inspectPlannedOrigins(root, plan_id).matches.length === 1 }, finish);
|
|
102
|
+
return { outcome: known.origin.operation_id === operation_id ? 'already_applied' : 'already_transferred', run_id: known.run_id, receipt: known.receipt, historical_effect: true, authorizes: false };
|
|
103
|
+
}
|
|
104
|
+
if (controlPathPresent(root, `${plannedEntryPath(plan_id)}/TRANSFER.json`)) fail('AGDF_PLANNED_ORIGIN_UNCONFIRMED');
|
|
105
|
+
const entry = inspectPlannedEntry(root, plan_id, { presentationLanguage: presentation_language });
|
|
106
|
+
if (entry.pending) fail('AGDF_PLANNED_RECOVERY_REQUIRED');
|
|
107
|
+
if (entry.digest !== expected_digest) fail('AGDF_PLANNED_SOURCE_STALE');
|
|
108
|
+
if (!entry.readiness.ready) throw Object.assign(Error('AGDF_PLANNED_UR_NOT_READY'), { readiness: entry.readiness });
|
|
109
|
+
if (title !== undefined && title !== entry.title) fail('AGDF_PLANNED_TITLE_INVALID');
|
|
110
|
+
const rawSource = readContainedControlText(root, entry.path);
|
|
111
|
+
if (plannedRawDigest(rawSource) !== entry.raw_digest) fail('AGDF_PLANNED_SOURCE_STALE');
|
|
112
|
+
const runId = creationRunId(operation_id), base = plannedEntryPath(plan_id), runBase = `${runDocumentPath(runId, '')}/`;
|
|
113
|
+
const origin = { schema_version: 1, plan_id, operation_id, run_id: runId, target_id, request_digest, raw_digest: entry.raw_digest,
|
|
114
|
+
planned: { path: entry.path, digest: entry.digest }, snapshot: { path: runHistoryPath(runId, 'planning/UR.md'), digest: entry.digest },
|
|
115
|
+
initial_ur: { path: `${runBase}UR.md`, digest: entry.digest } };
|
|
116
|
+
const outputs = [{ path: origin.initial_ur.path, content: rawSource, digest: entry.digest },
|
|
117
|
+
{ path: origin.snapshot.path, content: rawSource, digest: entry.digest }];
|
|
118
|
+
const intent = validateIntent(bindInputResolution({ schema_version: 1, origin, outputs }), plan_id), pendingPath = `${base}/HANDOFF_PENDING.json`;
|
|
119
|
+
function matching(content, staged) {
|
|
120
|
+
const parsed = parseRunState(content, runId), receipt = readRunOperations(content).receipts.find(row => row.operation_id === operation_id);
|
|
121
|
+
const seals = staged ? computeRunSeals(root, content, { artefactDigests: staged.artefactDigests }) : null;
|
|
122
|
+
const sealed = staged ? seals.content_seal === parsed.meta.content_seal && seals.approval_seal === parsed.meta.approval_seal : runSealState(root, content).status === 'valid';
|
|
123
|
+
if (!parsed.valid || !sealed || receipt?.kind !== 'run.create_from_planned'
|
|
124
|
+
|| receipt.target_id !== target_id || receipt.request_digest !== request_digest
|
|
125
|
+
|| canonicalJson(receipt.effect.record.planned) !== canonicalJson({ plan_id, path: entry.path, digest: entry.digest })) fail('AGDF_PLANNED_HANDOFF_RECOVERY_REQUIRED');
|
|
126
|
+
return receipt;
|
|
127
|
+
}
|
|
128
|
+
return withOwnedFileLock(join(root, '.agdf/control/runs', `.create-${operation_id}`), () => {
|
|
129
|
+
if (existsSync(join(root, pendingPath))) {
|
|
130
|
+
const previous = validateIntent(JSON.parse(readContainedControlText(root, pendingPath, PLANNED_INTENT_BYTES)), plan_id);
|
|
131
|
+
if (canonicalJson(previous) !== canonicalJson(intent)) fail('AGDF_PLANNED_HANDOFF_RECOVERY_REQUIRED');
|
|
132
|
+
// Roll back only the original sealed stage and exact owned bytes.
|
|
133
|
+
// Foreign or partially unprovable state remains recovery-required.
|
|
134
|
+
effectStarted = true; markControlMutationEffect();
|
|
135
|
+
recoverRunCreationStage(root, runId, matching, { discard: true, outputs });
|
|
136
|
+
checkpoint('handoff_rolled_back');
|
|
137
|
+
} else {
|
|
138
|
+
// No pre-existing publication or sibling output may be adopted just
|
|
139
|
+
// because its bytes happen to match the requested content.
|
|
140
|
+
if (existsSync(join(root, `.agdf/control/runs/${runId}`)) || outputs.some(row => existsSync(join(root, row.path)))) fail('AGDF_PLANNED_HANDOFF_COLLISION');
|
|
141
|
+
}
|
|
142
|
+
effectStarted = true; markControlMutationEffect();
|
|
143
|
+
if (existsSync(join(root, pendingPath))) {
|
|
144
|
+
if (readContainedControlText(root, pendingPath, PLANNED_INTENT_BYTES) !== json(intent)) fail('AGDF_PLANNED_HANDOFF_RECOVERY_REQUIRED');
|
|
145
|
+
} else atomicWrite(join(root, pendingPath), json(intent));
|
|
146
|
+
checkpoint('handoff_intent');
|
|
147
|
+
let receipt = recoverRunCreationStage(root, runId, matching, { outputs });
|
|
148
|
+
if (!receipt) {
|
|
149
|
+
createRun(root, runId, undefined, { outputs, checkpoint, prepare(content) {
|
|
150
|
+
const next = projectUrObjective(content, entry.content);
|
|
151
|
+
const parsed = parseRunState(next, runId);
|
|
152
|
+
receipt = bindInputResolution({ schema_version: RUN_OPERATION_VERSION, kind: 'run.create_from_planned', operation_id, request_digest, target_id,
|
|
153
|
+
run_id: runId, expected_revision_id: null, created_at: new Date().toISOString(), producer: { contract: 'run-command/1', package_version: packageVersion },
|
|
154
|
+
assurance: COOPERATIVE_ASSURANCE, effect: { previous_revision_id: null, resulting_revision_id: parsed.meta.revision_id, revision: 1,
|
|
155
|
+
record: { title: entry.title, planned: { plan_id, path: entry.path, digest: entry.digest },
|
|
156
|
+
snapshot: { ...origin.snapshot, raw_digest: origin.raw_digest } } } });
|
|
157
|
+
return appendRunOperation(next, receipt);
|
|
158
|
+
}, beforePublish: () => {
|
|
159
|
+
checkpoint('handoff_before_run_publish');
|
|
160
|
+
if (readContainedControlText(root, entry.path) !== rawSource) fail('AGDF_PLANNED_SOURCE_STALE');
|
|
161
|
+
} });
|
|
162
|
+
}
|
|
163
|
+
checkpoint('handoff_run_committed');
|
|
164
|
+
finishEntry(root, origin, digest(canonicalJson(receipt.effect.record)), checkpoint);
|
|
165
|
+
return { outcome: 'accepted', run_id: runId, receipt, historical_effect: false, authorizes: false };
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
try { return execute(); }
|
|
169
|
+
catch (error) {
|
|
170
|
+
if (!effectStarted || /RECOVERY_REQUIRED/u.test(error.message)) throw error;
|
|
171
|
+
throw Object.assign(Error('AGDF_PLANNED_HANDOFF_RECOVERY_REQUIRED'), { cause: error, operation_id, plan_id });
|
|
172
|
+
}
|
|
173
|
+
}, { operation_id, resume: true, proveOutcome: result => ['accepted', 'already_applied', 'already_transferred'].includes(result.outcome) });
|
|
174
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { readControlLayout } from './control-layout.js';
|
|
2
|
+
import { existsSync, readdirSync, lstatSync, currentControlReadView } from '../control-read/fs.js';
|
|
3
|
+
import { captureControlScope, controlPathPresent } from '../control-read/snapshot.js';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { inspectPlannedEntry, inspectPlannedOperation, PLANNED_ROOT } from './planned-entry.js';
|
|
6
|
+
import { inspectPlannedOrigins } from './planned-origin-reader.js';
|
|
7
|
+
import { readRunInventory } from './run-inventory-reader.js';
|
|
8
|
+
import { artefactFileDigest } from './run-seal.js';
|
|
9
|
+
import { RUN_ID_PATTERN } from './run-identity.js';
|
|
10
|
+
import { hasSymlinkComponent } from './contained-file.js';
|
|
11
|
+
|
|
12
|
+
const compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
13
|
+
const titleKey = title => title.normalize('NFKC').replace(/\s+/gu, ' ').trim().toLowerCase();
|
|
14
|
+
const rank = { high: 0, normal: 1, low: 2 };
|
|
15
|
+
|
|
16
|
+
export function projectPlannedInventory(root, { language = 'en' } = {}) {
|
|
17
|
+
readControlLayout(root);
|
|
18
|
+
const entries = [], findings = [];
|
|
19
|
+
if (!existsSync(join(root, PLANNED_ROOT))) throw Error('AGDF_PLANNED_STORE_MISSING');
|
|
20
|
+
if (hasSymlinkComponent(root, PLANNED_ROOT) || !lstatSync(join(root, PLANNED_ROOT)).isDirectory()) throw Error('AGDF_PLANNED_PATH_INVALID');
|
|
21
|
+
const names = readdirSync(join(root, PLANNED_ROOT));
|
|
22
|
+
if (names.length > 20000) throw Error('AGDF_PLANNED_INVENTORY_LIMIT');
|
|
23
|
+
for (const name of names.filter(name => !RUN_ID_PATTERN.test(name))) {
|
|
24
|
+
if (name === '.gitkeep') {
|
|
25
|
+
const marker = lstatSync(join(root, PLANNED_ROOT, name));
|
|
26
|
+
if (marker.isFile() && !marker.isSymbolicLink() && marker.size === 0) continue;
|
|
27
|
+
}
|
|
28
|
+
if (/^\.entry-[a-z0-9][a-z0-9._-]{0,127}\.lock(?:\.reclaim)?$/u.test(name)) continue;
|
|
29
|
+
const staged = name.match(/^\.stage-(plan-[a-f0-9-]{36})-([a-f0-9-]{36})$/u);
|
|
30
|
+
if (staged) {
|
|
31
|
+
try {
|
|
32
|
+
const operation = inspectPlannedOperation(root, staged[1], staged[2]);
|
|
33
|
+
if (operation.status !== 'pending' || !operation.pending) throw Error('planned_stage_unknown');
|
|
34
|
+
findings.push({ plan_id: staged[1], code: 'planned_creation_pending', operation_id: staged[2] });
|
|
35
|
+
entries.push({ kind: 'planned', identity: `planned/${staged[1]}`, plan_id: staged[1], title: staged[1], priority: null,
|
|
36
|
+
source: { path: `${PLANNED_ROOT}/${staged[1]}/UR.md`, digest: null, raw_digest: null }, coverage: 'recovery_required',
|
|
37
|
+
run_id: null, handoff_ready: false, diagnostics: [{ code: 'planned_creation_pending', operation_id: staged[2] }],
|
|
38
|
+
actions: ['inspect_original_operation'], authorizes: false });
|
|
39
|
+
} catch (error) { findings.push({ code: 'planned_stage_unknown', path: `${PLANNED_ROOT}/${name}`, reason: error.code ?? error.message }); }
|
|
40
|
+
} else findings.push({ code: 'planned_name_unsupported', path: `${PLANNED_ROOT}/${name}` });
|
|
41
|
+
}
|
|
42
|
+
for (const id of names.filter(name => RUN_ID_PATTERN.test(name)).sort()) {
|
|
43
|
+
try {
|
|
44
|
+
const entry = inspectPlannedEntry(root, id, { presentationLanguage: language }), origins = inspectPlannedOrigins(root, id);
|
|
45
|
+
const handedOff = origins.matches.length === 1 && origins.complete;
|
|
46
|
+
const handoffPending = controlPathPresent(root, `${PLANNED_ROOT}/${id}/HANDOFF_PENDING.json`);
|
|
47
|
+
const orphanTransfer = !handedOff && controlPathPresent(root, `${PLANNED_ROOT}/${id}/TRANSFER.json`);
|
|
48
|
+
if (orphanTransfer) origins.findings.push({ code: 'planned_transfer_unconfirmed', plan_id: id });
|
|
49
|
+
const coverage = !origins.complete || orphanTransfer ? 'unconfirmed' : handedOff ? 'transferred' : entry.pending || handoffPending ? 'recovery_required'
|
|
50
|
+
: entry.readiness.ready ? 'ready' : 'draft';
|
|
51
|
+
entries.push({ kind: 'planned', identity: `planned/${id}`, plan_id: id, title: entry.title, priority: entry.priority,
|
|
52
|
+
source: { path: entry.path, digest: entry.digest, raw_digest: entry.raw_digest }, coverage,
|
|
53
|
+
run_id: handedOff ? origins.matches[0].run_id : null, handoff_ready: coverage === 'ready',
|
|
54
|
+
diagnostics: origins.findings, actions: handedOff ? ['inspect_source', 'open_run'] : coverage === 'unconfirmed' || coverage === 'recovery_required'
|
|
55
|
+
? ['inspect_source', 'inspect_original_operation'] : ['inspect_source', 'continue_planning'], authorizes: false });
|
|
56
|
+
findings.push(...origins.findings.map(row => ({ ...row, plan_id: id })));
|
|
57
|
+
} catch (error) {
|
|
58
|
+
findings.push({ plan_id: id, code: error.code ?? error.message });
|
|
59
|
+
entries.push({ kind: 'planned', identity: `planned/${id}`, plan_id: id, title: id, priority: null,
|
|
60
|
+
source: { path: `${PLANNED_ROOT}/${id}/UR.md`, digest: null, raw_digest: null }, coverage: 'unavailable', run_id: null,
|
|
61
|
+
handoff_ready: false, diagnostics: [{ code: error.code ?? error.message }], actions: ['retry_inspection'], authorizes: false });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
entries.sort((a, b) => (rank[a.priority] ?? 3) - (rank[b.priority] ?? 3) || compare(titleKey(a.title), titleKey(b.title)) || compare(a.plan_id, b.plan_id));
|
|
65
|
+
return { schema_version: 'planned-inventory/1', state: findings.length ? 'partial' : 'complete', entries, findings, authorizes: false };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function readPlannedInventory(root, options) {
|
|
69
|
+
try { return currentControlReadView()?.readOptionalFileSync ? projectPlannedInventory(root, options) : captureControlScope(root, () => projectPlannedInventory(root, options)).data; }
|
|
70
|
+
catch (error) { return { schema_version: 'planned-inventory/1', state: 'unavailable', entries: [], findings: [{ code: error.code ?? error.message }], authorizes: false }; }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function readWorkInventory(root, options = {}) {
|
|
74
|
+
try {
|
|
75
|
+
readControlLayout(root);
|
|
76
|
+
const project = () => {
|
|
77
|
+
const planned = projectPlannedInventory(root, options), runs = readRunInventory(root, options);
|
|
78
|
+
const references = planned.entries.filter(row => row.coverage === 'transferred');
|
|
79
|
+
const entries = [...planned.entries.filter(row => row.coverage !== 'transferred'), ...runs.runs.map(row => ({ ...row,
|
|
80
|
+
kind: 'run', identity: `run/${row.run_id}`, source: { path: row.path, digest: row.valid ? artefactFileDigest(root, row.path) : null },
|
|
81
|
+
planning_origins: references.filter(ref => ref.run_id === row.run_id).map(ref => ({ plan_id: ref.plan_id, source: ref.source })),
|
|
82
|
+
coverage: row.valid ? 'available' : 'unavailable', actions: ['open_run'], authorizes: false }))];
|
|
83
|
+
return { schema_version: 'work-inventory/1', state: planned.state === 'partial' || runs.state !== 'complete' ? 'partial' : 'complete',
|
|
84
|
+
entries, planning_references: references, findings: [...planned.findings, ...runs.findings, ...runs.runs.flatMap(row => row.findings)],
|
|
85
|
+
counts: { planned: planned.entries.length - references.length, runs: runs.runs.length, planning_references: references.length }, authorizes: false };
|
|
86
|
+
};
|
|
87
|
+
return currentControlReadView()?.readOptionalFileSync ? project() : captureControlScope(root, project).data;
|
|
88
|
+
} catch (error) { return { schema_version: 'work-inventory/1', state: 'unavailable', entries: [], planning_references: [],
|
|
89
|
+
findings: [{ code: error.code ?? error.message }], counts: null, authorizes: false }; }
|
|
90
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Live origin discovery composes current proof and seal validation. The seal's
|
|
2
|
+
// immutable-origin proof stays below this reader to keep the dependency acyclic.
|
|
3
|
+
import { RUN_ID_PATTERN } from './run-identity.js';
|
|
4
|
+
import { existsSync, readdirSync, memoizeControlRead } from '../control-read/fs.js';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { readContainedControlText, controlPathPresent, READ_LIMITS } from '../control-read/snapshot.js';
|
|
7
|
+
import { parseRunState } from './run-state-parser.js';
|
|
8
|
+
import { readRunOperations } from './run-operations.js';
|
|
9
|
+
import { runSealState } from './run-seal.js';
|
|
10
|
+
import { hasSymlinkComponent } from './contained-file.js';
|
|
11
|
+
import { plannedOriginFromReceipt, validPlannedOrigin } from './planned-origin.js';
|
|
12
|
+
|
|
13
|
+
function collectPlannedOrigins(root) {
|
|
14
|
+
const directory = '.agdf/control/runs', matches = [], findings = [];
|
|
15
|
+
if (hasSymlinkComponent(root, directory)) throw Error('AGDF_PLANNED_ORIGIN_UNCONFIRMED');
|
|
16
|
+
if (!existsSync(join(root, directory))) return { matches, findings };
|
|
17
|
+
const names = readdirSync(join(root, directory));
|
|
18
|
+
if (names.length > 20000) throw Error('AGDF_PLANNED_ORIGIN_LIMIT');
|
|
19
|
+
for (const id of names.filter(name => RUN_ID_PATTERN.test(name))) {
|
|
20
|
+
let receipt, origin;
|
|
21
|
+
try {
|
|
22
|
+
const path = `${directory}/${id}/RUN_STATE.md`;
|
|
23
|
+
if (!controlPathPresent(root, path)) continue;
|
|
24
|
+
const content = readContainedControlText(root, path, READ_LIMITS.file), parsed = parseRunState(content, id);
|
|
25
|
+
if (!parsed.valid) throw Error();
|
|
26
|
+
const creations = readRunOperations(content).receipts.filter(row => row.kind === 'run.create_from_planned');
|
|
27
|
+
if (creations.length > 1) throw Error();
|
|
28
|
+
receipt = creations[0]; if (!receipt) continue;
|
|
29
|
+
origin = plannedOriginFromReceipt(receipt);
|
|
30
|
+
if (!validPlannedOrigin(origin) || runSealState(root, content).status !== 'valid') throw Error();
|
|
31
|
+
matches.push({ origin, receipt, run_id: id, current_revision_id: parsed.meta.revision_id });
|
|
32
|
+
} catch { findings.push({ run_id: id, ...(origin ? { plan_id: origin.plan_id } : {}), code: 'planned_origin_unconfirmed' }); }
|
|
33
|
+
}
|
|
34
|
+
return { matches, findings };
|
|
35
|
+
}
|
|
36
|
+
export function inspectPlannedOrigins(root, planId) {
|
|
37
|
+
if (!RUN_ID_PATTERN.test(planId ?? '')) throw Error('AGDF_PLANNED_ID_INVALID');
|
|
38
|
+
const inventory = memoizeControlRead(`plannedOrigins:${root}`, () => collectPlannedOrigins(root));
|
|
39
|
+
const matches = inventory.matches.filter(row => row.origin.plan_id === planId);
|
|
40
|
+
const findings = inventory.findings.filter(row => !row.plan_id || row.plan_id === planId);
|
|
41
|
+
if (matches.length > 1) findings.push({ code: 'planned_origin_ambiguous', plan_id: planId });
|
|
42
|
+
return { matches, findings, complete: findings.length === 0 };
|
|
43
|
+
}
|
|
44
|
+
export function assertPlannedNotTransferred(root, id) {
|
|
45
|
+
const origins = inspectPlannedOrigins(root, id);
|
|
46
|
+
if (!origins.complete) throw Error('AGDF_PLANNED_ORIGIN_UNCONFIRMED');
|
|
47
|
+
if (origins.matches.length) throw Object.assign(Error('AGDF_PLANNED_ALREADY_TRANSFERRED'), { run_id: origins.matches[0].run_id });
|
|
48
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { runDocumentPath, runHistoryPath, RUN_ID_PATTERN, REVISION_ID_PATTERN } from './run-identity.js';
|
|
2
|
+
import { readContainedControlText } from '../control-read/snapshot.js';
|
|
3
|
+
import { exactObject, digest, canonicalJson } from './approval-command-contract.js';
|
|
4
|
+
import { readRunOperations } from './run-operations.js';
|
|
5
|
+
import { artefactFileDigest } from './run-seal-compute.js';
|
|
6
|
+
|
|
7
|
+
const hash = value => typeof value === 'string' && /^sha256:[a-f0-9]{64}$/u.test(value);
|
|
8
|
+
const reference = (value, path) => exactObject(value, ['path', 'digest']) && value.path === path && hash(value.digest);
|
|
9
|
+
// The pending handoff retains its exact original effect for recovery. After
|
|
10
|
+
// publication, the creation receipt and immutable snapshot are the authority.
|
|
11
|
+
export function validPlannedOrigin(origin) {
|
|
12
|
+
if (!exactObject(origin, ['schema_version', 'plan_id', 'operation_id', 'run_id', 'target_id', 'request_digest', 'raw_digest', 'planned', 'snapshot', 'initial_ur'])
|
|
13
|
+
|| origin.schema_version !== 1 || !RUN_ID_PATTERN.test(origin.plan_id ?? '') || !REVISION_ID_PATTERN.test(origin.operation_id ?? '')
|
|
14
|
+
|| origin.run_id !== `run-${origin.operation_id}` || !hash(origin.target_id) || !hash(origin.request_digest) || !hash(origin.raw_digest)) return false;
|
|
15
|
+
return reference(origin.planned, `.agdf/control/planned/${origin.plan_id}/UR.md`)
|
|
16
|
+
&& reference(origin.snapshot, runHistoryPath(origin.run_id, 'planning/UR.md'))
|
|
17
|
+
&& reference(origin.initial_ur, runDocumentPath(origin.run_id, 'UR.md'))
|
|
18
|
+
&& origin.snapshot.digest === origin.planned.digest && origin.initial_ur.digest === origin.planned.digest;
|
|
19
|
+
}
|
|
20
|
+
export function plannedOriginFromReceipt(receipt) {
|
|
21
|
+
const r = receipt.effect.record;
|
|
22
|
+
return { schema_version: 1, plan_id: r.planned.plan_id, operation_id: receipt.operation_id, run_id: receipt.run_id,
|
|
23
|
+
target_id: receipt.target_id, request_digest: receipt.request_digest, raw_digest: r.snapshot.raw_digest,
|
|
24
|
+
planned: { path: r.planned.path, digest: r.planned.digest }, snapshot: { path: r.snapshot.path, digest: r.snapshot.digest },
|
|
25
|
+
initial_ur: { path: runDocumentPath(receipt.run_id, 'UR.md'), digest: r.planned.digest } };
|
|
26
|
+
}
|
|
27
|
+
export function assertPlannedOriginImmutable(root, before, after) {
|
|
28
|
+
const creation = readRunOperations(before).receipts.find(row => row.kind === 'run.create_from_planned');
|
|
29
|
+
if (!creation) return;
|
|
30
|
+
try {
|
|
31
|
+
const next = readRunOperations(after).receipts.find(row => row.operation_id === creation.operation_id);
|
|
32
|
+
const origin = plannedOriginFromReceipt(creation);
|
|
33
|
+
if (canonicalJson(next) !== canonicalJson(creation) || !validPlannedOrigin(origin)
|
|
34
|
+
|| artefactFileDigest(root, origin.snapshot.path) !== origin.snapshot.digest
|
|
35
|
+
|| digest(readContainedControlText(root, origin.snapshot.path)) !== origin.raw_digest) throw Error();
|
|
36
|
+
} catch { throw Error('AGDF_PLANNED_ORIGIN_IMMUTABLE'); }
|
|
37
|
+
}
|
|
38
|
+
export function validPlannedOriginHistory(root, content) {
|
|
39
|
+
try { assertPlannedOriginImmutable(root, content, content); return true; } catch { return false; }
|
|
40
|
+
}
|