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
|
@@ -1,691 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
closeSync,
|
|
4
|
-
existsSync,
|
|
5
|
-
fstatSync,
|
|
6
|
-
fsyncSync,
|
|
7
|
-
linkSync,
|
|
8
|
-
lstatSync,
|
|
9
|
-
mkdirSync,
|
|
10
|
-
openSync,
|
|
11
|
-
readFileSync,
|
|
12
|
-
readdirSync,
|
|
13
|
-
realpathSync,
|
|
14
|
-
rmdirSync,
|
|
15
|
-
unlinkSync,
|
|
16
|
-
writeFileSync,
|
|
17
|
-
} from "node:fs";
|
|
18
|
-
import { basename, dirname, isAbsolute, join } from "node:path";
|
|
19
|
-
import { parseRunState, RUN_ID_PATTERN } from "#agdf-core/control-state/run-state-parser.js";
|
|
20
|
-
import { renameSyncWithRetry } from "#agdf-core/fs-swap.js";
|
|
21
|
-
|
|
22
|
-
const CONTROL_PREFIX = ".agdf/control/";
|
|
23
|
-
const LEGACY_LIVE_RUN = "AGDF_RUN.md";
|
|
24
|
-
const STAGE_PREFIX = ".control-stage-";
|
|
25
|
-
const STAGE_MARKER = ".agdf-canonical-init-stage.json";
|
|
26
|
-
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
27
|
-
|
|
28
|
-
export class CanonicalInitError extends Error {
|
|
29
|
-
constructor(code, path = "") {
|
|
30
|
-
super(path ? `${code}: ${path}` : code);
|
|
31
|
-
this.name = "CanonicalInitError";
|
|
32
|
-
this.code = code;
|
|
33
|
-
this.path = path;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function normalizedPlan(files) {
|
|
38
|
-
if (!Array.isArray(files) || files.length === 0) throw new CanonicalInitError("AGDF_CANONICAL_INIT_PLAN_INVALID");
|
|
39
|
-
const seen = new Set();
|
|
40
|
-
return files.map((file) => {
|
|
41
|
-
const path = String(file?.path ?? "").replaceAll("\\", "/");
|
|
42
|
-
if (!path.startsWith(CONTROL_PREFIX) || isAbsolute(path) || path.includes("\0")) {
|
|
43
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_PLAN_INVALID", path);
|
|
44
|
-
}
|
|
45
|
-
const relativePath = path.slice(CONTROL_PREFIX.length);
|
|
46
|
-
const parts = relativePath.split("/");
|
|
47
|
-
if (!relativePath || parts.some((part) => !part || part === "." || part === "..") || typeof file.content !== "string") {
|
|
48
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_PLAN_INVALID", path);
|
|
49
|
-
}
|
|
50
|
-
if (relativePath === LEGACY_LIVE_RUN) throw new CanonicalInitError("AGDF_CANONICAL_INIT_LEGACY_AUTHORITY_FORBIDDEN", path);
|
|
51
|
-
if (relativePath === STAGE_MARKER || relativePath === "runs" || relativePath.startsWith("runs/")) {
|
|
52
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_PLAN_INVALID", path);
|
|
53
|
-
}
|
|
54
|
-
if (seen.has(relativePath)) throw new CanonicalInitError("AGDF_CANONICAL_INIT_PLAN_DUPLICATE", path);
|
|
55
|
-
seen.add(relativePath);
|
|
56
|
-
return Object.freeze({ ...file, path, relativePath, content: file.content });
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function directoryIdentity(path) {
|
|
61
|
-
const stats = lstatSync(path);
|
|
62
|
-
if (stats.isSymbolicLink() || !stats.isDirectory()) throw new CanonicalInitError("AGDF_CANONICAL_INIT_PATH_INVALID", path);
|
|
63
|
-
return Object.freeze({ path, realpath: realpathSync(path), dev: stats.dev, ino: stats.ino });
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function sameDirectory(identity, path = identity.path) {
|
|
67
|
-
try {
|
|
68
|
-
const current = directoryIdentity(path);
|
|
69
|
-
return current.realpath === identity.realpath && current.dev === identity.dev && current.ino === identity.ino;
|
|
70
|
-
} catch {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function sameDirectoryEntry(identity, path) {
|
|
76
|
-
try {
|
|
77
|
-
const stats = lstatSync(path);
|
|
78
|
-
return !stats.isSymbolicLink()
|
|
79
|
-
&& stats.isDirectory()
|
|
80
|
-
&& stats.dev === identity.dev
|
|
81
|
-
&& stats.ino === identity.ino;
|
|
82
|
-
} catch {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function regularFileIdentity(path) {
|
|
88
|
-
const stats = lstatSync(path);
|
|
89
|
-
if (stats.isSymbolicLink() || !stats.isFile()) {
|
|
90
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_PATH_INVALID", path);
|
|
91
|
-
}
|
|
92
|
-
return Object.freeze({ path, dev: stats.dev, ino: stats.ino });
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function sameRegularFile(identity, path = identity.path, expectedContent) {
|
|
96
|
-
try {
|
|
97
|
-
const current = regularFileIdentity(path);
|
|
98
|
-
return current.dev === identity.dev
|
|
99
|
-
&& current.ino === identity.ino
|
|
100
|
-
&& (expectedContent === undefined || readFileSync(path, "utf8") === expectedContent);
|
|
101
|
-
} catch {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function writeOwnedFile(path, content, ownership) {
|
|
107
|
-
let descriptor;
|
|
108
|
-
let identity;
|
|
109
|
-
try {
|
|
110
|
-
descriptor = openSync(path, "wx");
|
|
111
|
-
const stats = fstatSync(descriptor);
|
|
112
|
-
identity = Object.freeze({ path, dev: stats.dev, ino: stats.ino });
|
|
113
|
-
writeFileSync(descriptor, content, "utf8");
|
|
114
|
-
fsyncSync(descriptor);
|
|
115
|
-
} catch (error) {
|
|
116
|
-
if (descriptor !== undefined) closeSync(descriptor);
|
|
117
|
-
if (identity && sameRegularFile(identity, path)) {
|
|
118
|
-
try {
|
|
119
|
-
unlinkSync(path);
|
|
120
|
-
} catch (cleanupError) {
|
|
121
|
-
if (cleanupError.code !== "ENOENT") throw cleanupError;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
closeSync(descriptor);
|
|
127
|
-
if (!sameRegularFile(identity, path, content)) {
|
|
128
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_STAGE_INVALID", path);
|
|
129
|
-
}
|
|
130
|
-
const ownedFile = Object.freeze({ ...identity, content });
|
|
131
|
-
ownership.files.push(ownedFile);
|
|
132
|
-
return ownedFile;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function createOwnedDirectory(path, ownership) {
|
|
136
|
-
mkdirSync(path);
|
|
137
|
-
const identity = directoryIdentity(path);
|
|
138
|
-
ownership.directories.push(identity);
|
|
139
|
-
return identity;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function identityKey(identity) {
|
|
143
|
-
return `${identity.path}\0${identity.dev}\0${identity.ino}`;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function sameOwnershipSnapshot(before, after) {
|
|
147
|
-
const beforeDirectories = before.directories.map(identityKey).sort();
|
|
148
|
-
const afterDirectories = after.directories.map(identityKey).sort();
|
|
149
|
-
const beforeFiles = before.files.map(identityKey).sort();
|
|
150
|
-
const afterFiles = after.files.map(identityKey).sort();
|
|
151
|
-
return JSON.stringify(beforeDirectories) === JSON.stringify(afterDirectories)
|
|
152
|
-
&& JSON.stringify(beforeFiles) === JSON.stringify(afterFiles);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function cleanupOwnedTree(ownership) {
|
|
156
|
-
let removed = true;
|
|
157
|
-
for (const file of [...ownership.files].sort((left, right) => right.path.length - left.path.length)) {
|
|
158
|
-
if (!sameRegularFile(file, file.path, file.content)) {
|
|
159
|
-
if (existsSync(file.path)) removed = false;
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
try {
|
|
163
|
-
unlinkSync(file.path);
|
|
164
|
-
} catch (error) {
|
|
165
|
-
if (error.code !== "ENOENT") removed = false;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
for (const directory of [...ownership.directories].sort((left, right) => right.path.length - left.path.length)) {
|
|
169
|
-
if (!sameDirectory(directory, directory.path)) {
|
|
170
|
-
if (existsSync(directory.path)) removed = false;
|
|
171
|
-
continue;
|
|
172
|
-
}
|
|
173
|
-
try {
|
|
174
|
-
rmdirSync(directory.path);
|
|
175
|
-
} catch (error) {
|
|
176
|
-
if (!["ENOENT", "ENOTEMPTY", "EEXIST"].includes(error.code)) throw error;
|
|
177
|
-
if (error.code !== "ENOENT") removed = false;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return removed;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function cleanupCreatedAgdf(createdAgdf, agdfIdentity, agdfPath) {
|
|
184
|
-
if (!createdAgdf || !sameDirectory(agdfIdentity, agdfPath)) return;
|
|
185
|
-
try {
|
|
186
|
-
rmdirSync(agdfPath);
|
|
187
|
-
} catch (error) {
|
|
188
|
-
if (!["ENOENT", "ENOTEMPTY", "EEXIST"].includes(error.code)) throw error;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function allowedDirectories(plan) {
|
|
193
|
-
const allowed = new Set(["", "runs"]);
|
|
194
|
-
for (const file of plan) {
|
|
195
|
-
const parts = file.relativePath.split("/");
|
|
196
|
-
parts.pop();
|
|
197
|
-
while (parts.length) {
|
|
198
|
-
allowed.add(parts.join("/"));
|
|
199
|
-
parts.pop();
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return allowed;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function inspectCanonicalRun(runPath, relativePath, runId) {
|
|
206
|
-
if (!RUN_ID_PATTERN.test(runId)) {
|
|
207
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_UNKNOWN_PATH", relativePath);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
const runStats = lstatSync(runPath);
|
|
211
|
-
if (runStats.isSymbolicLink() || !runStats.isDirectory()) {
|
|
212
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_CONFLICT", relativePath);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const entries = readdirSync(runPath).sort();
|
|
216
|
-
if (entries.length !== 1 || entries[0] !== "RUN_STATE.md") {
|
|
217
|
-
const unexpected = entries.find((entry) => entry !== "RUN_STATE.md");
|
|
218
|
-
throw new CanonicalInitError(
|
|
219
|
-
unexpected ? "AGDF_CANONICAL_INIT_UNKNOWN_PATH" : "AGDF_CANONICAL_INIT_CONFLICT",
|
|
220
|
-
unexpected ? `${relativePath}/${unexpected}` : relativePath,
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
const statePath = join(runPath, "RUN_STATE.md");
|
|
225
|
-
const stateRelativePath = `${relativePath}/RUN_STATE.md`;
|
|
226
|
-
const stateStats = lstatSync(statePath);
|
|
227
|
-
if (stateStats.isSymbolicLink() || !stateStats.isFile() || stateStats.nlink !== 1) {
|
|
228
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_CONFLICT", stateRelativePath);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
const content = readFileSync(statePath, "utf8");
|
|
232
|
-
if (!parseRunState(content, runId).valid) {
|
|
233
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_CONFLICT", stateRelativePath);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return Object.freeze({
|
|
237
|
-
directory: Object.freeze({ path: relativePath, dev: runStats.dev, ino: runStats.ino }),
|
|
238
|
-
state: Object.freeze({ path: stateRelativePath, dev: stateStats.dev, ino: stateStats.ino, content }),
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function inspectExistingControl(controlPath, plan) {
|
|
243
|
-
const expected = new Map(plan.map((file) => [file.relativePath, file]));
|
|
244
|
-
const allowedDirs = allowedDirectories(plan);
|
|
245
|
-
const files = new Map();
|
|
246
|
-
const directories = new Set([""]);
|
|
247
|
-
const retainedRuns = [];
|
|
248
|
-
const visit = (directory, prefix = "") => {
|
|
249
|
-
for (const name of readdirSync(directory).sort()) {
|
|
250
|
-
const relativePath = prefix ? `${prefix}/${name}` : name;
|
|
251
|
-
const path = join(directory, name);
|
|
252
|
-
const stats = lstatSync(path);
|
|
253
|
-
if (stats.isSymbolicLink()) throw new CanonicalInitError("AGDF_CANONICAL_INIT_CONFLICT", relativePath);
|
|
254
|
-
if (stats.isDirectory()) {
|
|
255
|
-
if (prefix === "runs") {
|
|
256
|
-
directories.add(relativePath);
|
|
257
|
-
retainedRuns.push(inspectCanonicalRun(path, relativePath, name));
|
|
258
|
-
continue;
|
|
259
|
-
}
|
|
260
|
-
if (!allowedDirs.has(relativePath)) throw new CanonicalInitError("AGDF_CANONICAL_INIT_UNKNOWN_PATH", relativePath);
|
|
261
|
-
directories.add(relativePath);
|
|
262
|
-
visit(path, relativePath);
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
if (!stats.isFile() || !expected.has(relativePath)) {
|
|
266
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_UNKNOWN_PATH", relativePath);
|
|
267
|
-
}
|
|
268
|
-
const content = readFileSync(path, "utf8");
|
|
269
|
-
if (content !== expected.get(relativePath).content) {
|
|
270
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_CONTENT_CONFLICT", relativePath);
|
|
271
|
-
}
|
|
272
|
-
files.set(relativePath, content);
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
visit(controlPath);
|
|
276
|
-
return Object.freeze({
|
|
277
|
-
files: Object.freeze([...files.keys()].sort()),
|
|
278
|
-
directories: Object.freeze([...directories].sort()),
|
|
279
|
-
retainedRuns: Object.freeze(retainedRuns.sort((left, right) => left.state.path.localeCompare(right.state.path))),
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function snapshotsEqual(left, right) {
|
|
284
|
-
return JSON.stringify(left) === JSON.stringify(right);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function retainedRunsEqual(left, right) {
|
|
288
|
-
return JSON.stringify(left.retainedRuns) === JSON.stringify(right.retainedRuns);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function planFingerprint(plan) {
|
|
292
|
-
const serialized = JSON.stringify(plan.map((file) => [file.relativePath, file.content]));
|
|
293
|
-
return createHash("sha256").update(serialized, "utf8").digest("hex");
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
function stageMarkerContent({ stageName, mode, plan, stagedPlan, rootIdentity, agdfIdentity }) {
|
|
297
|
-
return `${JSON.stringify({
|
|
298
|
-
schema_version: 1,
|
|
299
|
-
owner: "agdf.canonical-init",
|
|
300
|
-
stage_name: stageName,
|
|
301
|
-
mode,
|
|
302
|
-
target: {
|
|
303
|
-
realpath: rootIdentity.realpath,
|
|
304
|
-
dev: String(rootIdentity.dev),
|
|
305
|
-
ino: String(rootIdentity.ino),
|
|
306
|
-
},
|
|
307
|
-
agdf: {
|
|
308
|
-
realpath: agdfIdentity.realpath,
|
|
309
|
-
dev: String(agdfIdentity.dev),
|
|
310
|
-
ino: String(agdfIdentity.ino),
|
|
311
|
-
},
|
|
312
|
-
plan_fingerprint: planFingerprint(plan),
|
|
313
|
-
staged_files: stagedPlan.map((file) => file.relativePath),
|
|
314
|
-
}, null, 2)}\n`;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function newStageSpec(stagePath, mode, plan, stagedPlan, rootIdentity, agdfIdentity) {
|
|
318
|
-
const stageName = basename(stagePath);
|
|
319
|
-
return Object.freeze({
|
|
320
|
-
stagePath,
|
|
321
|
-
stageName,
|
|
322
|
-
mode,
|
|
323
|
-
plan,
|
|
324
|
-
stagedPlan,
|
|
325
|
-
markerContent: stageMarkerContent({ stageName, mode, plan, stagedPlan, rootIdentity, agdfIdentity }),
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function staleStageError(path) {
|
|
330
|
-
return new CanonicalInitError("AGDF_CANONICAL_INIT_STALE_STAGE", path);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
function readStageSpec(containerPath, plan, rootIdentity, agdfIdentity, published = false) {
|
|
334
|
-
const markerPath = join(containerPath, STAGE_MARKER);
|
|
335
|
-
let raw;
|
|
336
|
-
let marker;
|
|
337
|
-
try {
|
|
338
|
-
regularFileIdentity(markerPath);
|
|
339
|
-
raw = readFileSync(markerPath, "utf8");
|
|
340
|
-
marker = JSON.parse(raw);
|
|
341
|
-
} catch {
|
|
342
|
-
throw staleStageError(containerPath);
|
|
343
|
-
}
|
|
344
|
-
const stageName = String(marker?.stage_name ?? "");
|
|
345
|
-
const stageId = stageName.startsWith(STAGE_PREFIX) ? stageName.slice(STAGE_PREFIX.length) : "";
|
|
346
|
-
if (!UUID_PATTERN.test(stageId) || (!published && basename(containerPath) !== stageName)) {
|
|
347
|
-
throw staleStageError(containerPath);
|
|
348
|
-
}
|
|
349
|
-
if (!Array.isArray(marker?.staged_files) || !["new", "repair"].includes(marker?.mode)) {
|
|
350
|
-
throw staleStageError(containerPath);
|
|
351
|
-
}
|
|
352
|
-
const planByPath = new Map(plan.map((file) => [file.relativePath, file]));
|
|
353
|
-
const stagedPlan = [];
|
|
354
|
-
const seen = new Set();
|
|
355
|
-
for (const relativePath of marker.staged_files) {
|
|
356
|
-
if (typeof relativePath !== "string" || seen.has(relativePath) || !planByPath.has(relativePath)) {
|
|
357
|
-
throw staleStageError(containerPath);
|
|
358
|
-
}
|
|
359
|
-
seen.add(relativePath);
|
|
360
|
-
stagedPlan.push(planByPath.get(relativePath));
|
|
361
|
-
}
|
|
362
|
-
const orderedSubset = plan.filter((file) => seen.has(file.relativePath));
|
|
363
|
-
if (orderedSubset.some((file, index) => file !== stagedPlan[index])) throw staleStageError(containerPath);
|
|
364
|
-
if (marker.mode === "new" && stagedPlan.length !== plan.length) throw staleStageError(containerPath);
|
|
365
|
-
const spec = newStageSpec(join(dirname(containerPath), stageName), marker.mode, plan, stagedPlan, rootIdentity, agdfIdentity);
|
|
366
|
-
if (raw !== spec.markerContent) throw staleStageError(containerPath);
|
|
367
|
-
return spec;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
function expectedStageDirectories(stagedPlan) {
|
|
371
|
-
return [...allowedDirectories(stagedPlan)]
|
|
372
|
-
.sort((left, right) => left.split("/").length - right.split("/").length || left.localeCompare(right));
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
function inspectOwnedStage(containerPath, spec, complete) {
|
|
376
|
-
const expectedFiles = new Map([
|
|
377
|
-
[STAGE_MARKER, spec.markerContent],
|
|
378
|
-
...spec.stagedPlan.map((file) => [file.relativePath, file.content]),
|
|
379
|
-
]);
|
|
380
|
-
const expectedDirectories = new Set(expectedStageDirectories(spec.stagedPlan));
|
|
381
|
-
const ownership = { files: [], directories: [directoryIdentity(containerPath)] };
|
|
382
|
-
const seenFiles = new Set();
|
|
383
|
-
const seenDirectories = new Set([""]);
|
|
384
|
-
const visit = (directory, prefix = "") => {
|
|
385
|
-
for (const name of readdirSync(directory).sort()) {
|
|
386
|
-
const relativePath = prefix ? `${prefix}/${name}` : name;
|
|
387
|
-
const path = join(directory, name);
|
|
388
|
-
const stats = lstatSync(path);
|
|
389
|
-
if (stats.isSymbolicLink()) throw new CanonicalInitError("AGDF_CANONICAL_INIT_STAGE_INVALID", path);
|
|
390
|
-
if (stats.isDirectory()) {
|
|
391
|
-
if (!expectedDirectories.has(relativePath)) throw new CanonicalInitError("AGDF_CANONICAL_INIT_STAGE_INVALID", path);
|
|
392
|
-
const identity = directoryIdentity(path);
|
|
393
|
-
ownership.directories.push(identity);
|
|
394
|
-
seenDirectories.add(relativePath);
|
|
395
|
-
visit(path, relativePath);
|
|
396
|
-
continue;
|
|
397
|
-
}
|
|
398
|
-
if (!stats.isFile() || !expectedFiles.has(relativePath)) {
|
|
399
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_STAGE_INVALID", path);
|
|
400
|
-
}
|
|
401
|
-
const content = readFileSync(path, "utf8");
|
|
402
|
-
if (content !== expectedFiles.get(relativePath)) {
|
|
403
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_STAGE_INVALID", path);
|
|
404
|
-
}
|
|
405
|
-
ownership.files.push(Object.freeze({ ...regularFileIdentity(path), content }));
|
|
406
|
-
seenFiles.add(relativePath);
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
|
-
visit(containerPath);
|
|
410
|
-
if (!seenFiles.has(STAGE_MARKER)) throw new CanonicalInitError("AGDF_CANONICAL_INIT_STAGE_INVALID", containerPath);
|
|
411
|
-
if (complete) {
|
|
412
|
-
if ([...expectedFiles.keys()].some((path) => !seenFiles.has(path))
|
|
413
|
-
|| [...expectedDirectories].some((path) => !seenDirectories.has(path))) {
|
|
414
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_STAGE_INVALID", containerPath);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
return ownership;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
function completeStage(containerPath, spec, ownership, hooks) {
|
|
421
|
-
const seenDirectories = new Set(ownership.directories.map((identity) => {
|
|
422
|
-
if (identity.path === containerPath) return "";
|
|
423
|
-
return identity.path.slice(containerPath.length + 1).replaceAll("\\", "/");
|
|
424
|
-
}));
|
|
425
|
-
for (const relativePath of expectedStageDirectories(spec.stagedPlan)) {
|
|
426
|
-
if (!relativePath || seenDirectories.has(relativePath)) continue;
|
|
427
|
-
const path = join(containerPath, ...relativePath.split("/"));
|
|
428
|
-
createOwnedDirectory(path, ownership);
|
|
429
|
-
seenDirectories.add(relativePath);
|
|
430
|
-
}
|
|
431
|
-
const seenFiles = new Set(ownership.files.map((file) => {
|
|
432
|
-
if (file.path === join(containerPath, STAGE_MARKER)) return STAGE_MARKER;
|
|
433
|
-
return file.path.slice(containerPath.length + 1).replaceAll("\\", "/");
|
|
434
|
-
}));
|
|
435
|
-
for (const [index, file] of spec.stagedPlan.entries()) {
|
|
436
|
-
if (seenFiles.has(file.relativePath)) continue;
|
|
437
|
-
hooks.beforeWrite?.({ index, file, stagePath: containerPath });
|
|
438
|
-
writeOwnedFile(join(containerPath, ...file.relativePath.split("/")), file.content, ownership);
|
|
439
|
-
}
|
|
440
|
-
return inspectOwnedStage(containerPath, spec, true);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
function createStage(stagePath, mode, plan, stagedPlan, rootIdentity, agdfIdentity, hooks, ownership) {
|
|
444
|
-
createOwnedDirectory(stagePath, ownership);
|
|
445
|
-
const spec = newStageSpec(stagePath, mode, plan, stagedPlan, rootIdentity, agdfIdentity);
|
|
446
|
-
writeOwnedFile(join(stagePath, STAGE_MARKER), spec.markerContent, ownership);
|
|
447
|
-
return Object.freeze({ spec, ownership: completeStage(stagePath, spec, ownership, hooks) });
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
function staleStageNames(agdfPath) {
|
|
451
|
-
return readdirSync(agdfPath).filter((name) => name.startsWith(STAGE_PREFIX)).sort();
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
function loadStaleStage(agdfPath, names, plan, rootIdentity, agdfIdentity) {
|
|
455
|
-
if (names.length === 0) return null;
|
|
456
|
-
if (names.length !== 1) throw staleStageError(join(agdfPath, names[0]));
|
|
457
|
-
const stagePath = join(agdfPath, names[0]);
|
|
458
|
-
try {
|
|
459
|
-
const spec = readStageSpec(stagePath, plan, rootIdentity, agdfIdentity);
|
|
460
|
-
const ownership = inspectOwnedStage(stagePath, spec, false);
|
|
461
|
-
return Object.freeze({ stagePath, spec, ownership });
|
|
462
|
-
} catch {
|
|
463
|
-
throw staleStageError(stagePath);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
function removeCreatedDirectories(directories) {
|
|
468
|
-
for (const directory of [...directories].sort((left, right) => right.path.length - left.path.length)) {
|
|
469
|
-
if (!sameDirectory(directory, directory.path)) continue;
|
|
470
|
-
try {
|
|
471
|
-
rmdirSync(directory.path);
|
|
472
|
-
} catch (error) {
|
|
473
|
-
if (!["ENOENT", "ENOTEMPTY", "EEXIST"].includes(error.code)) throw error;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
function createdDirectoriesUnchanged(directories) {
|
|
479
|
-
return directories.every((directory) => sameDirectory(directory, directory.path));
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
function result(status, plan, existing = new Set()) {
|
|
483
|
-
return Object.freeze({
|
|
484
|
-
schema_version: 1,
|
|
485
|
-
operation: "canonical_init",
|
|
486
|
-
status,
|
|
487
|
-
authorizes: false,
|
|
488
|
-
created_run: false,
|
|
489
|
-
created_ur: false,
|
|
490
|
-
created_gate_approval: false,
|
|
491
|
-
files: Object.freeze(plan.map((file) => Object.freeze({
|
|
492
|
-
path: file.path,
|
|
493
|
-
content: file.content,
|
|
494
|
-
action: existing.has(file.relativePath) ? "preserved_exact" : "created",
|
|
495
|
-
}))),
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
function resumePublishedControl(controlPath, plan, rootIdentity, agdfIdentity, hooks) {
|
|
500
|
-
let spec;
|
|
501
|
-
let before;
|
|
502
|
-
try {
|
|
503
|
-
spec = readStageSpec(controlPath, plan, rootIdentity, agdfIdentity, true);
|
|
504
|
-
if (spec.mode !== "new") throw staleStageError(controlPath);
|
|
505
|
-
before = inspectOwnedStage(controlPath, spec, true);
|
|
506
|
-
} catch {
|
|
507
|
-
throw staleStageError(controlPath);
|
|
508
|
-
}
|
|
509
|
-
hooks.beforeResumeCleanup?.({ controlPath, stageName: spec.stageName });
|
|
510
|
-
const after = inspectOwnedStage(controlPath, spec, true);
|
|
511
|
-
if (!sameOwnershipSnapshot(before, after)) {
|
|
512
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_TARGET_DRIFT", controlPath);
|
|
513
|
-
}
|
|
514
|
-
const marker = after.files.find((file) => file.path === join(controlPath, STAGE_MARKER));
|
|
515
|
-
if (!marker || !sameRegularFile(marker, marker.path, marker.content)) {
|
|
516
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_TARGET_DRIFT", marker?.path ?? controlPath);
|
|
517
|
-
}
|
|
518
|
-
unlinkSync(marker.path);
|
|
519
|
-
inspectExistingControl(controlPath, plan);
|
|
520
|
-
return result("repaired", plan, new Set(plan.map((file) => file.relativePath)));
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
export function initializeCanonicalControl(targetDir, files, options = {}, hooks = {}) {
|
|
524
|
-
if (options.force) throw new CanonicalInitError("AGDF_CANONICAL_INIT_FORCE_FORBIDDEN");
|
|
525
|
-
const plan = normalizedPlan(files);
|
|
526
|
-
const rootIdentity = directoryIdentity(targetDir);
|
|
527
|
-
const agdfPath = join(targetDir, ".agdf");
|
|
528
|
-
const controlPath = join(agdfPath, "control");
|
|
529
|
-
let createdAgdf = false;
|
|
530
|
-
if (!existsSync(agdfPath)) {
|
|
531
|
-
mkdirSync(agdfPath);
|
|
532
|
-
createdAgdf = true;
|
|
533
|
-
}
|
|
534
|
-
const agdfIdentity = directoryIdentity(agdfPath);
|
|
535
|
-
const staleNames = staleStageNames(agdfPath);
|
|
536
|
-
|
|
537
|
-
if (existsSync(controlPath) && existsSync(join(controlPath, STAGE_MARKER))) {
|
|
538
|
-
if (staleNames.length > 0) throw staleStageError(join(agdfPath, staleNames[0]));
|
|
539
|
-
return resumePublishedControl(controlPath, plan, rootIdentity, agdfIdentity, hooks);
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
const stale = loadStaleStage(agdfPath, staleNames, plan, rootIdentity, agdfIdentity);
|
|
543
|
-
|
|
544
|
-
if (!existsSync(controlPath)) {
|
|
545
|
-
if (stale && stale.spec.mode !== "new") throw staleStageError(stale.stagePath);
|
|
546
|
-
const stagePath = stale?.stagePath ?? join(agdfPath, `${STAGE_PREFIX}${randomUUID()}`);
|
|
547
|
-
let ownership = stale?.ownership ?? { files: [], directories: [] };
|
|
548
|
-
try {
|
|
549
|
-
let spec = stale?.spec;
|
|
550
|
-
if (!spec) {
|
|
551
|
-
const created = createStage(stagePath, "new", plan, plan, rootIdentity, agdfIdentity, hooks, ownership);
|
|
552
|
-
spec = created.spec;
|
|
553
|
-
ownership = created.ownership;
|
|
554
|
-
} else {
|
|
555
|
-
ownership = completeStage(stagePath, spec, ownership, hooks);
|
|
556
|
-
}
|
|
557
|
-
const beforePublish = inspectOwnedStage(stagePath, spec, true);
|
|
558
|
-
hooks.beforePublish?.({ targetDir, controlPath, stagePath, mode: "new" });
|
|
559
|
-
if (!sameDirectory(rootIdentity, targetDir)
|
|
560
|
-
|| !sameDirectory(agdfIdentity, agdfPath)
|
|
561
|
-
|| !sameDirectory(beforePublish.directories[0], stagePath)) {
|
|
562
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_TARGET_DRIFT");
|
|
563
|
-
}
|
|
564
|
-
const afterPublish = inspectOwnedStage(stagePath, spec, true);
|
|
565
|
-
if (!sameOwnershipSnapshot(beforePublish, afterPublish)
|
|
566
|
-
|| existsSync(controlPath)) {
|
|
567
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_TARGET_DRIFT");
|
|
568
|
-
}
|
|
569
|
-
renameSyncWithRetry(stagePath, controlPath);
|
|
570
|
-
hooks.afterPublish?.({ targetDir, controlPath, stagePath, mode: "new" });
|
|
571
|
-
const markerPath = join(controlPath, STAGE_MARKER);
|
|
572
|
-
const marker = afterPublish.files.find((file) => file.path === join(stagePath, STAGE_MARKER));
|
|
573
|
-
if (!marker || !sameDirectoryEntry(afterPublish.directories[0], controlPath)
|
|
574
|
-
|| !sameRegularFile(marker, markerPath, marker.content)) {
|
|
575
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_TARGET_DRIFT", controlPath);
|
|
576
|
-
}
|
|
577
|
-
unlinkSync(markerPath);
|
|
578
|
-
inspectExistingControl(controlPath, plan);
|
|
579
|
-
return result("created", plan);
|
|
580
|
-
} catch (error) {
|
|
581
|
-
cleanupOwnedTree(ownership);
|
|
582
|
-
cleanupCreatedAgdf(createdAgdf, agdfIdentity, agdfPath);
|
|
583
|
-
throw error;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
if (stale && stale.spec.mode !== "repair") throw staleStageError(stale.stagePath);
|
|
588
|
-
const controlIdentity = directoryIdentity(controlPath);
|
|
589
|
-
const before = inspectExistingControl(controlPath, plan);
|
|
590
|
-
const existing = new Set(before.files);
|
|
591
|
-
const missing = plan.filter((file) => !existing.has(file.relativePath));
|
|
592
|
-
const runsMissing = !before.directories.includes("runs");
|
|
593
|
-
if (missing.length === 0 && !runsMissing && !stale) return result("unchanged", plan, existing);
|
|
594
|
-
if (existing.size === 0) throw new CanonicalInitError("AGDF_CANONICAL_INIT_PARTIAL_UNOWNED", ".agdf/control");
|
|
595
|
-
if (stale) {
|
|
596
|
-
const stagedPaths = new Set(stale.spec.stagedPlan.map((file) => file.relativePath));
|
|
597
|
-
if (missing.some((file) => !stagedPaths.has(file.relativePath))) throw staleStageError(stale.stagePath);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
const stagePath = stale?.stagePath ?? join(agdfPath, `${STAGE_PREFIX}${randomUUID()}`);
|
|
601
|
-
let ownership = stale?.ownership ?? { files: [], directories: [] };
|
|
602
|
-
const linked = [];
|
|
603
|
-
const createdDirectories = [];
|
|
604
|
-
try {
|
|
605
|
-
let spec = stale?.spec;
|
|
606
|
-
if (!spec) {
|
|
607
|
-
const created = createStage(stagePath, "repair", plan, missing, rootIdentity, agdfIdentity, hooks, ownership);
|
|
608
|
-
spec = created.spec;
|
|
609
|
-
ownership = created.ownership;
|
|
610
|
-
} else {
|
|
611
|
-
ownership = completeStage(stagePath, spec, ownership, hooks);
|
|
612
|
-
}
|
|
613
|
-
const beforePublish = inspectOwnedStage(stagePath, spec, true);
|
|
614
|
-
hooks.beforePublish?.({ targetDir, controlPath, stagePath, mode: "repair" });
|
|
615
|
-
if (!sameDirectory(rootIdentity, targetDir)
|
|
616
|
-
|| !sameDirectory(agdfIdentity, agdfPath)
|
|
617
|
-
|| !sameDirectory(controlIdentity, controlPath)
|
|
618
|
-
|| !sameDirectory(beforePublish.directories[0], stagePath)) {
|
|
619
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_TARGET_DRIFT");
|
|
620
|
-
}
|
|
621
|
-
const afterPublish = inspectOwnedStage(stagePath, spec, true);
|
|
622
|
-
let controlUnchanged = false;
|
|
623
|
-
try {
|
|
624
|
-
controlUnchanged = snapshotsEqual(before, inspectExistingControl(controlPath, plan));
|
|
625
|
-
} catch {
|
|
626
|
-
controlUnchanged = false;
|
|
627
|
-
}
|
|
628
|
-
if (!sameOwnershipSnapshot(beforePublish, afterPublish)
|
|
629
|
-
|| !controlUnchanged) {
|
|
630
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_TARGET_DRIFT");
|
|
631
|
-
}
|
|
632
|
-
if (runsMissing) {
|
|
633
|
-
const runsPath = join(controlPath, "runs");
|
|
634
|
-
createOwnedDirectory(runsPath, { files: [], directories: createdDirectories });
|
|
635
|
-
}
|
|
636
|
-
for (const [index, file] of missing.entries()) {
|
|
637
|
-
const destination = join(controlPath, ...file.relativePath.split("/"));
|
|
638
|
-
const stagedPath = join(stagePath, ...file.relativePath.split("/"));
|
|
639
|
-
const ancestors = [];
|
|
640
|
-
let parent = dirname(destination);
|
|
641
|
-
while (parent !== controlPath && !existsSync(parent)) {
|
|
642
|
-
ancestors.push(parent);
|
|
643
|
-
parent = dirname(parent);
|
|
644
|
-
}
|
|
645
|
-
for (const directory of ancestors.reverse()) {
|
|
646
|
-
createOwnedDirectory(directory, { files: [], directories: createdDirectories });
|
|
647
|
-
}
|
|
648
|
-
hooks.beforeLink?.({ index, file, destination });
|
|
649
|
-
const stagedFile = afterPublish.files.find((candidate) => candidate.path === stagedPath);
|
|
650
|
-
if (!stagedFile
|
|
651
|
-
|| !sameDirectory(rootIdentity, targetDir)
|
|
652
|
-
|| !sameDirectory(agdfIdentity, agdfPath)
|
|
653
|
-
|| !sameDirectory(controlIdentity, controlPath)
|
|
654
|
-
|| !createdDirectoriesUnchanged(createdDirectories)
|
|
655
|
-
|| !sameRegularFile(stagedFile, stagedPath, file.content)
|
|
656
|
-
|| existsSync(destination)) {
|
|
657
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_TARGET_DRIFT", file.path);
|
|
658
|
-
}
|
|
659
|
-
linkSync(stagedPath, destination);
|
|
660
|
-
const linkedFile = Object.freeze({ ...regularFileIdentity(destination), content: file.content });
|
|
661
|
-
linked.push(linkedFile);
|
|
662
|
-
if (!sameRegularFile(stagedFile, destination, file.content)) {
|
|
663
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_TARGET_DRIFT", file.path);
|
|
664
|
-
}
|
|
665
|
-
hooks.afterLink?.({ index, file, destination, stagePath });
|
|
666
|
-
}
|
|
667
|
-
if (!createdDirectoriesUnchanged(createdDirectories)) {
|
|
668
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_TARGET_DRIFT", controlPath);
|
|
669
|
-
}
|
|
670
|
-
const completedControl = inspectExistingControl(controlPath, plan);
|
|
671
|
-
if (!retainedRunsEqual(before, completedControl)) {
|
|
672
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_TARGET_DRIFT", join(controlPath, "runs"));
|
|
673
|
-
}
|
|
674
|
-
if (!cleanupOwnedTree(afterPublish)) {
|
|
675
|
-
throw new CanonicalInitError("AGDF_CANONICAL_INIT_TARGET_DRIFT", stagePath);
|
|
676
|
-
}
|
|
677
|
-
return result("repaired", plan, existing);
|
|
678
|
-
} catch (error) {
|
|
679
|
-
for (const linkedFile of linked.reverse()) {
|
|
680
|
-
if (!sameRegularFile(linkedFile, linkedFile.path, linkedFile.content)) continue;
|
|
681
|
-
try {
|
|
682
|
-
unlinkSync(linkedFile.path);
|
|
683
|
-
} catch (cleanupError) {
|
|
684
|
-
if (cleanupError.code !== "ENOENT") throw cleanupError;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
removeCreatedDirectories(createdDirectories);
|
|
688
|
-
cleanupOwnedTree(ownership);
|
|
689
|
-
throw error;
|
|
690
|
-
}
|
|
691
|
-
}
|
|
1
|
+
// Compatibility adapter; the canonical initializer has one Core owner.
|
|
2
|
+
export { CanonicalInitError, initializeCanonicalControl } from "#agdf-core/control-state/canonical-initialization.js";
|