project-tiny-context-harness 0.8.16 → 0.11.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 +119 -41
- package/assets/README.md +184 -55
- package/assets/README.zh-CN.md +114 -40
- package/assets/agents/AGENTS_CORE.md +2 -2
- package/assets/context_templates/context.toml +6 -1
- package/assets/context_templates/screen-contract.md +16 -0
- package/assets/runtime/windows-job-supervisor/formal_process_supervisor_native_helpers.cs +301 -0
- package/assets/runtime/windows-job-supervisor/formal_process_supervisor_native_run.cs +197 -0
- package/assets/runtime/windows-job-supervisor/formal_process_supervisor_native_types.cs +215 -0
- package/assets/runtime/windows-job-supervisor/windows_job_process_supervisor.ps1 +117 -0
- package/assets/skills/context_development_engineer/SKILL.md +16 -30
- package/assets/skills/context_development_engineer/references/engineering-design-reasoning.md +93 -0
- package/assets/skills/context_surface_contract/SKILL.md +13 -2
- package/assets/skills/context_uiux_design/SKILL.md +7 -3
- package/assets/skills/context_uiux_design/references/task-uiux-analysis.md +82 -0
- package/assets/skills/design-resource-authoring/SKILL.md +18 -9
- package/assets/skills/design-resource-authoring/references/authority-delta-assessment.md +52 -0
- package/assets/skills/design-resource-authoring/references/downstream-handoff.md +22 -6
- package/assets/skills/design-resource-authoring/references/formal-selected-web-app-handoff.md +26 -8
- package/assets/skills/design-resource-authoring/references/implementation-feasibility.md +111 -0
- package/assets/skills/design-resource-authoring/references/open-design-provider.md +45 -7
- package/assets/skills/design-resource-authoring/references/recovery-and-writeback.md +7 -1
- package/assets/skills/design-resource-authoring/references/resource-selection.md +115 -3
- package/assets/skills/design-system-authoring/SKILL.md +23 -17
- package/assets/skills/design-system-authoring/references/authority-adoption.md +19 -9
- package/assets/skills/design-system-authoring/references/open-design-design-system-provider.md +4 -0
- package/assets/skills/long-task-workflow/SKILL.md +6 -6
- package/assets/skills/long-task-workflow/references/authority-lifecycle.md +10 -4
- package/assets/skills/long-task-workflow/references/contract-authoring.md +5 -5
- package/assets/skills/long-task-workflow/references/evidence-design.md +14 -3
- package/assets/skills/long-task-workflow/references/source-authoring.md +11 -8
- package/assets/tools/context_rules.json +53 -0
- package/assets/tools/validate_context.py +302 -77
- package/dist/cli.js +2 -1
- package/dist/commands/context-create.d.ts +1 -0
- package/dist/commands/context-create.js +90 -0
- package/dist/commands/context-inspect.d.ts +1 -0
- package/dist/commands/context-inspect.js +98 -0
- package/dist/commands/context-move.d.ts +1 -0
- package/dist/commands/context-move.js +78 -0
- package/dist/commands/context-register.d.ts +1 -0
- package/dist/commands/context-register.js +110 -0
- package/dist/commands/context-transaction.d.ts +1 -0
- package/dist/commands/context-transaction.js +84 -0
- package/dist/commands/context.d.ts +1 -0
- package/dist/commands/context.js +36 -0
- package/dist/commands/design-authority-delta.d.ts +1 -0
- package/dist/commands/design-authority-delta.js +53 -0
- package/dist/commands/design-authority.d.ts +1 -0
- package/dist/commands/design-authority.js +104 -0
- package/dist/commands/design-resource.js +17 -3
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.js +61 -3
- package/dist/commands/index.js +19 -2
- package/dist/commands/long-task-authoring.js +20 -2
- package/dist/commands/long-task-workdir.d.ts +2 -0
- package/dist/commands/long-task-workdir.js +23 -0
- package/dist/commands/long-task.js +75 -6
- package/dist/commands/route.d.ts +15 -0
- package/dist/commands/route.js +142 -0
- package/dist/index.d.ts +3 -13
- package/dist/index.js +3 -12
- package/dist/lib/cli-exit.d.ts +14 -0
- package/dist/lib/cli-exit.js +19 -0
- package/dist/lib/context-catalog/catalog-default-footprint.d.ts +3 -0
- package/dist/lib/context-catalog/catalog-default-footprint.js +53 -0
- package/dist/lib/context-catalog/catalog-diagnostics.d.ts +9 -0
- package/dist/lib/context-catalog/catalog-diagnostics.js +34 -0
- package/dist/lib/context-catalog/catalog-discovery.d.ts +7 -0
- package/dist/lib/context-catalog/catalog-discovery.js +81 -0
- package/dist/lib/context-catalog/catalog-load.d.ts +8 -0
- package/dist/lib/context-catalog/catalog-load.js +187 -0
- package/dist/lib/context-catalog/catalog-path-validation.d.ts +7 -0
- package/dist/lib/context-catalog/catalog-path-validation.js +62 -0
- package/dist/lib/context-catalog/catalog-paths.d.ts +11 -0
- package/dist/lib/context-catalog/catalog-paths.js +41 -0
- package/dist/lib/context-catalog/catalog-portable-contract.d.ts +15 -0
- package/dist/lib/context-catalog/catalog-portable-contract.js +68 -0
- package/dist/lib/context-catalog/catalog-staged-path-safety.d.ts +1 -0
- package/dist/lib/context-catalog/catalog-staged-path-safety.js +36 -0
- package/dist/lib/context-catalog/catalog-types.d.ts +40 -0
- package/dist/lib/context-catalog/catalog-types.js +1 -0
- package/dist/lib/context-catalog/catalog-validation.d.ts +9 -0
- package/dist/lib/context-catalog/catalog-validation.js +148 -0
- package/dist/lib/context-create/context-create-path.d.ts +2 -0
- package/dist/lib/context-create/context-create-path.js +30 -0
- package/dist/lib/context-create/context-create-template.d.ts +2 -0
- package/dist/lib/context-create/context-create-template.js +95 -0
- package/dist/lib/context-create/context-create-types.d.ts +28 -0
- package/dist/lib/context-create/context-create-types.js +1 -0
- package/dist/lib/context-create/context-create-write.d.ts +1 -0
- package/dist/lib/context-create/context-create-write.js +85 -0
- package/dist/lib/context-create/context-create.d.ts +2 -0
- package/dist/lib/context-create/context-create.js +84 -0
- package/dist/lib/context-default-footprint.d.ts +2 -3
- package/dist/lib/context-default-footprint.js +49 -57
- package/dist/lib/context-doctor/context-doctor-types.d.ts +16 -0
- package/dist/lib/context-doctor/context-doctor-types.js +15 -0
- package/dist/lib/context-doctor/context-doctor.d.ts +2 -0
- package/dist/lib/context-doctor/context-doctor.js +130 -0
- package/dist/lib/context-graph-snapshot.d.ts +5 -0
- package/dist/lib/context-graph-snapshot.js +46 -25
- package/dist/lib/context-inspect/context-inspect-projection.d.ts +9 -0
- package/dist/lib/context-inspect/context-inspect-projection.js +49 -0
- package/dist/lib/context-inspect/context-inspect-render.d.ts +2 -0
- package/dist/lib/context-inspect/context-inspect-render.js +29 -0
- package/dist/lib/context-inspect/context-inspect-types.d.ts +43 -0
- package/dist/lib/context-inspect/context-inspect-types.js +1 -0
- package/dist/lib/context-inspect/context-inspect.d.ts +2 -0
- package/dist/lib/context-inspect/context-inspect.js +104 -0
- package/dist/lib/context-manifest-schema.d.ts +1 -1
- package/dist/lib/context-manifest-schema.js +4 -20
- package/dist/lib/context-markdown/context-markdown-analysis.d.ts +15 -0
- package/dist/lib/context-markdown/context-markdown-analysis.js +245 -0
- package/dist/lib/context-markdown/context-markdown-extract.d.ts +7 -0
- package/dist/lib/context-markdown/context-markdown-extract.js +114 -0
- package/dist/lib/context-markdown/context-markdown-types.d.ts +57 -0
- package/dist/lib/context-markdown/context-markdown-types.js +1 -0
- package/dist/lib/context-move/context-move-input.d.ts +8 -0
- package/dist/lib/context-move/context-move-input.js +17 -0
- package/dist/lib/context-move/context-move-literal-scan.d.ts +20 -0
- package/dist/lib/context-move/context-move-literal-scan.js +213 -0
- package/dist/lib/context-move/context-move-live-validation.d.ts +3 -0
- package/dist/lib/context-move/context-move-live-validation.js +56 -0
- package/dist/lib/context-move/context-move-markdown-plan.d.ts +22 -0
- package/dist/lib/context-move/context-move-markdown-plan.js +39 -0
- package/dist/lib/context-move/context-move-projection.d.ts +3 -0
- package/dist/lib/context-move/context-move-projection.js +11 -0
- package/dist/lib/context-move/context-move-reference-validation.d.ts +11 -0
- package/dist/lib/context-move/context-move-reference-validation.js +64 -0
- package/dist/lib/context-move/context-move-render.d.ts +2 -0
- package/dist/lib/context-move/context-move-render.js +24 -0
- package/dist/lib/context-move/context-move-support.d.ts +10 -0
- package/dist/lib/context-move/context-move-support.js +88 -0
- package/dist/lib/context-move/context-move-transaction-plan.d.ts +24 -0
- package/dist/lib/context-move/context-move-transaction-plan.js +108 -0
- package/dist/lib/context-move/context-move-types.d.ts +74 -0
- package/dist/lib/context-move/context-move-types.js +1 -0
- package/dist/lib/context-move/context-move.d.ts +8 -0
- package/dist/lib/context-move/context-move.js +180 -0
- package/dist/lib/context-mutation/manifest-lossless-patch.d.ts +28 -0
- package/dist/lib/context-mutation/manifest-lossless-patch.js +208 -0
- package/dist/lib/context-mutation/markdown-link-patch.d.ts +34 -0
- package/dist/lib/context-mutation/markdown-link-patch.js +143 -0
- package/dist/lib/context-mutation/markdown-link-spans.d.ts +10 -0
- package/dist/lib/context-mutation/markdown-link-spans.js +179 -0
- package/dist/lib/context-mutation/mutation-cas.d.ts +13 -0
- package/dist/lib/context-mutation/mutation-cas.js +365 -0
- package/dist/lib/context-mutation/mutation-command-support.d.ts +12 -0
- package/dist/lib/context-mutation/mutation-command-support.js +57 -0
- package/dist/lib/context-mutation/mutation-commit.d.ts +12 -0
- package/dist/lib/context-mutation/mutation-commit.js +89 -0
- package/dist/lib/context-mutation/mutation-directories.d.ts +5 -0
- package/dist/lib/context-mutation/mutation-directories.js +56 -0
- package/dist/lib/context-mutation/mutation-file-state.d.ts +14 -0
- package/dist/lib/context-mutation/mutation-file-state.js +137 -0
- package/dist/lib/context-mutation/mutation-journal-file-validation.d.ts +1 -0
- package/dist/lib/context-mutation/mutation-journal-file-validation.js +106 -0
- package/dist/lib/context-mutation/mutation-journal-io.d.ts +5 -0
- package/dist/lib/context-mutation/mutation-journal-io.js +55 -0
- package/dist/lib/context-mutation/mutation-journal-storage.d.ts +18 -0
- package/dist/lib/context-mutation/mutation-journal-storage.js +283 -0
- package/dist/lib/context-mutation/mutation-journal-validation-support.d.ts +16 -0
- package/dist/lib/context-mutation/mutation-journal-validation-support.js +140 -0
- package/dist/lib/context-mutation/mutation-journal-validation.d.ts +3 -0
- package/dist/lib/context-mutation/mutation-journal-validation.js +177 -0
- package/dist/lib/context-mutation/mutation-journal.d.ts +8 -0
- package/dist/lib/context-mutation/mutation-journal.js +111 -0
- package/dist/lib/context-mutation/mutation-live-validation.d.ts +3 -0
- package/dist/lib/context-mutation/mutation-live-validation.js +51 -0
- package/dist/lib/context-mutation/mutation-long-task-guard.d.ts +6 -0
- package/dist/lib/context-mutation/mutation-long-task-guard.js +57 -0
- package/dist/lib/context-mutation/mutation-recovery.d.ts +4 -0
- package/dist/lib/context-mutation/mutation-recovery.js +189 -0
- package/dist/lib/context-mutation/mutation-staged-fs.d.ts +5 -0
- package/dist/lib/context-mutation/mutation-staged-fs.js +56 -0
- package/dist/lib/context-mutation/mutation-types.d.ts +103 -0
- package/dist/lib/context-mutation/mutation-types.js +1 -0
- package/dist/lib/context-register/context-register-input.d.ts +11 -0
- package/dist/lib/context-register/context-register-input.js +43 -0
- package/dist/lib/context-register/context-register-render.d.ts +2 -0
- package/dist/lib/context-register/context-register-render.js +21 -0
- package/dist/lib/context-register/context-register-support.d.ts +6 -0
- package/dist/lib/context-register/context-register-support.js +46 -0
- package/dist/lib/context-register/context-register-types.d.ts +46 -0
- package/dist/lib/context-register/context-register-types.js +1 -0
- package/dist/lib/context-register/context-register.d.ts +8 -0
- package/dist/lib/context-register/context-register.js +155 -0
- package/dist/lib/context-router/context-route-budget.d.ts +15 -0
- package/dist/lib/context-router/context-route-budget.js +14 -0
- package/dist/lib/context-router/context-route-candidates.d.ts +15 -0
- package/dist/lib/context-router/context-route-candidates.js +112 -0
- package/dist/lib/context-router/context-route-order.d.ts +6 -0
- package/dist/lib/context-router/context-route-order.js +53 -0
- package/dist/lib/context-router/context-route-paths.d.ts +16 -0
- package/dist/lib/context-router/context-route-paths.js +109 -0
- package/dist/lib/context-router/context-route-render.d.ts +2 -0
- package/dist/lib/context-router/context-route-render.js +32 -0
- package/dist/lib/context-router/context-route-scan.d.ts +18 -0
- package/dist/lib/context-router/context-route-scan.js +156 -0
- package/dist/lib/context-router/context-route-selection.d.ts +16 -0
- package/dist/lib/context-router/context-route-selection.js +72 -0
- package/dist/lib/context-router/context-route-terms.d.ts +13 -0
- package/dist/lib/context-router/context-route-terms.js +202 -0
- package/dist/lib/context-router/context-route-types.d.ts +101 -0
- package/dist/lib/context-router/context-route-types.js +1 -0
- package/dist/lib/context-router/context-route.d.ts +2 -0
- package/dist/lib/context-router/context-route.js +127 -0
- package/dist/lib/context-units-migration.d.ts +13 -0
- package/dist/lib/context-units-migration.js +217 -0
- package/dist/lib/design-authority-binding.d.ts +7 -0
- package/dist/lib/design-authority-binding.js +96 -0
- package/dist/lib/design-authority-closure.d.ts +3 -0
- package/dist/lib/design-authority-closure.js +201 -0
- package/dist/lib/design-authority-delta-codec-primitives.d.ts +10 -0
- package/dist/lib/design-authority-delta-codec-primitives.js +58 -0
- package/dist/lib/design-authority-delta-codec.d.ts +2 -0
- package/dist/lib/design-authority-delta-codec.js +193 -0
- package/dist/lib/design-authority-delta-types.d.ts +65 -0
- package/dist/lib/design-authority-delta-types.js +6 -0
- package/dist/lib/design-authority-delta-validation.d.ts +2 -0
- package/dist/lib/design-authority-delta-validation.js +16 -0
- package/dist/lib/design-authority-digest.d.ts +8 -0
- package/dist/lib/design-authority-digest.js +36 -0
- package/dist/lib/design-authority-files.d.ts +9 -0
- package/dist/lib/design-authority-files.js +62 -0
- package/dist/lib/design-authority-format.d.ts +2 -0
- package/dist/lib/design-authority-format.js +93 -0
- package/dist/lib/design-authority-links.d.ts +10 -0
- package/dist/lib/design-authority-links.js +137 -0
- package/dist/lib/design-authority-manifest.d.ts +4 -0
- package/dist/lib/design-authority-manifest.js +144 -0
- package/dist/lib/design-authority-tokens.d.ts +9 -0
- package/dist/lib/design-authority-tokens.js +45 -0
- package/dist/lib/design-authority-types.d.ts +80 -0
- package/dist/lib/design-authority-types.js +23 -0
- package/dist/lib/design-md-tool-adapter.d.ts +9 -0
- package/dist/lib/design-md-tool-adapter.js +152 -0
- package/dist/lib/design-md-tool-normalization.d.ts +7 -0
- package/dist/lib/design-md-tool-normalization.js +78 -0
- package/dist/lib/design-md-tool-types.d.ts +99 -0
- package/dist/lib/design-md-tool-types.js +8 -0
- package/dist/lib/design-resource-handoff-bundle.js +5 -0
- package/dist/lib/design-resource-handoff-input-types.d.ts +1 -1
- package/dist/lib/design-resource-handoff-manifest-projection.js +4 -0
- package/dist/lib/design-resource-handoff-set-integrity.js +1 -0
- package/dist/lib/design-resource-handoff-shape.js +18 -2
- package/dist/lib/design-resource-handoff-types.d.ts +8 -0
- package/dist/lib/design-resource-handoff-validation.js +24 -0
- package/dist/lib/design-resource-implementation-feasibility-model.d.ts +35 -0
- package/dist/lib/design-resource-implementation-feasibility-model.js +62 -0
- package/dist/lib/design-resource-implementation-feasibility-shape-sections.d.ts +43 -0
- package/dist/lib/design-resource-implementation-feasibility-shape-sections.js +142 -0
- package/dist/lib/design-resource-implementation-feasibility-shape.d.ts +4 -0
- package/dist/lib/design-resource-implementation-feasibility-shape.js +154 -0
- package/dist/lib/design-resource-implementation-feasibility-source-decision-projection.d.ts +24 -0
- package/dist/lib/design-resource-implementation-feasibility-source-decision-projection.js +106 -0
- package/dist/lib/design-resource-implementation-feasibility-source-decision.d.ts +21 -0
- package/dist/lib/design-resource-implementation-feasibility-source-decision.js +75 -0
- package/dist/lib/design-resource-implementation-feasibility-types.d.ts +135 -0
- package/dist/lib/design-resource-implementation-feasibility-types.js +37 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-cells.d.ts +5 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-cells.js +125 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-document.d.ts +4 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-document.js +167 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-facts.d.ts +3 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-facts.js +76 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-realizations.d.ts +8 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-realizations.js +76 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-support.d.ts +10 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-support.js +75 -0
- package/dist/lib/design-resource-implementation-feasibility-validation.d.ts +3 -0
- package/dist/lib/design-resource-implementation-feasibility-validation.js +138 -0
- package/dist/lib/design-resource-recovery-current.js +22 -0
- package/dist/lib/design-resource-recovery-shape.js +64 -7
- package/dist/lib/design-resource-recovery-types.d.ts +4 -1
- package/dist/lib/design-resource-symbolic-fact-shape.js +9 -1
- package/dist/lib/design-resource-symbolic-fact-types.d.ts +8 -0
- package/dist/lib/design-resource-symbolic-fact-validation.js +25 -0
- package/dist/lib/doctor.d.ts +2 -1
- package/dist/lib/doctor.js +29 -1
- package/dist/lib/fs.js +1 -1
- package/dist/lib/long-task-acceptance-reachability-claims.d.ts +2 -0
- package/dist/lib/long-task-acceptance-reachability-claims.js +279 -0
- package/dist/lib/long-task-acceptance-reachability-design.d.ts +2 -0
- package/dist/lib/long-task-acceptance-reachability-design.js +96 -0
- package/dist/lib/long-task-acceptance-reachability-external.d.ts +9 -0
- package/dist/lib/long-task-acceptance-reachability-external.js +123 -0
- package/dist/lib/long-task-acceptance-reachability-helpers.d.ts +64 -0
- package/dist/lib/long-task-acceptance-reachability-helpers.js +473 -0
- package/dist/lib/long-task-acceptance-reachability-semantic.d.ts +2 -0
- package/dist/lib/long-task-acceptance-reachability-semantic.js +122 -0
- package/dist/lib/long-task-acceptance-reachability-types.d.ts +91 -0
- package/dist/lib/long-task-acceptance-reachability-types.js +1 -0
- package/dist/lib/long-task-acceptance-reachability.d.ts +4 -0
- package/dist/lib/long-task-acceptance-reachability.js +115 -0
- package/dist/lib/long-task-activation-validation.d.ts +6 -0
- package/dist/lib/long-task-activation-validation.js +96 -23
- package/dist/lib/long-task-active-authority-lock-context.d.ts +4 -0
- package/dist/lib/long-task-active-authority-lock-context.js +29 -0
- package/dist/lib/long-task-applicability-identity.d.ts +25 -0
- package/dist/lib/long-task-applicability-identity.js +60 -0
- package/dist/lib/long-task-authoring-preflight-diagnostics.js +8 -0
- package/dist/lib/long-task-authoring-preflight-types.d.ts +2 -0
- package/dist/lib/long-task-authoring-preflight-types.js +9 -0
- package/dist/lib/long-task-authoring-preflight.js +18 -2
- package/dist/lib/long-task-authority-material-diff.js +4 -0
- package/dist/lib/long-task-authority-materials.js +19 -0
- package/dist/lib/long-task-authority-policy.d.ts +3 -0
- package/dist/lib/long-task-authority-policy.js +3 -0
- package/dist/lib/long-task-authority-revision-details.js +2 -1
- package/dist/lib/long-task-authority-types.d.ts +2 -0
- package/dist/lib/long-task-authority.js +2 -0
- package/dist/lib/long-task-check-runner.js +3 -296
- package/dist/lib/long-task-check-shape.js +6 -1
- package/dist/lib/long-task-claim-definitions.js +1 -3
- package/dist/lib/long-task-claim-semantic-proof-floor.d.ts +3 -0
- package/dist/lib/long-task-claim-semantic-proof-floor.js +78 -0
- package/dist/lib/long-task-claims.d.ts +0 -18
- package/dist/lib/long-task-claims.js +15 -14
- package/dist/lib/long-task-command-process.d.ts +9 -0
- package/dist/lib/long-task-command-process.js +178 -0
- package/dist/lib/long-task-compact-authoring.js +3 -0
- package/dist/lib/long-task-compact-projections.js +10 -0
- package/dist/lib/long-task-complete-delivery-evidence-types.d.ts +38 -0
- package/dist/lib/long-task-complete-delivery-evidence-types.js +1 -0
- package/dist/lib/long-task-completion-types.d.ts +109 -0
- package/dist/lib/long-task-completion-types.js +1 -0
- package/dist/lib/long-task-conformance-policy.d.ts +2 -1
- package/dist/lib/long-task-conformance-policy.js +11 -4
- package/dist/lib/long-task-context-authority-topology.js +6 -4
- package/dist/lib/long-task-contract-types.d.ts +52 -1
- package/dist/lib/long-task-counterfactual-sandbox.d.ts +7 -1
- package/dist/lib/long-task-counterfactual-sandbox.js +86 -6
- package/dist/lib/long-task-delivery-compiler-preflight.d.ts +24 -0
- package/dist/lib/long-task-delivery-compiler-preflight.js +32 -0
- package/dist/lib/long-task-delivery-compiler.d.ts +1 -0
- package/dist/lib/long-task-delivery-compiler.js +59 -44
- package/dist/lib/long-task-delivery-parser.d.ts +3 -0
- package/dist/lib/long-task-delivery-parser.js +26 -8
- package/dist/lib/long-task-delivery-types.d.ts +2 -0
- package/dist/lib/long-task-delivery-types.js +2 -0
- package/dist/lib/long-task-delivery-validation.d.ts +11 -3
- package/dist/lib/long-task-delivery-validation.js +23 -8
- package/dist/lib/long-task-design-feasibility-binding-owners.d.ts +6 -0
- package/dist/lib/long-task-design-feasibility-binding-owners.js +52 -0
- package/dist/lib/long-task-design-feasibility-binding.d.ts +14 -0
- package/dist/lib/long-task-design-feasibility-binding.js +114 -0
- package/dist/lib/long-task-design-feasibility-source-closure.d.ts +11 -0
- package/dist/lib/long-task-design-feasibility-source-closure.js +87 -0
- package/dist/lib/long-task-design-obligation.d.ts +50 -0
- package/dist/lib/long-task-design-obligation.js +99 -0
- package/dist/lib/long-task-design-resource-handoff.d.ts +5 -3
- package/dist/lib/long-task-design-resource-handoff.js +64 -4
- package/dist/lib/long-task-design-resource-method-binding.js +20 -2
- package/dist/lib/long-task-effective-external-takeover.d.ts +15 -0
- package/dist/lib/long-task-effective-external-takeover.js +109 -0
- package/dist/lib/long-task-effective-external-ui-takeover.d.ts +5 -0
- package/dist/lib/long-task-effective-external-ui-takeover.js +117 -0
- package/dist/lib/long-task-evidence-capability-codec.js +91 -0
- package/dist/lib/long-task-evidence-capability-runtime.js +62 -14
- package/dist/lib/long-task-evidence-capability-types.d.ts +3 -2
- package/dist/lib/long-task-evidence-v2.d.ts +6 -1
- package/dist/lib/long-task-evidence-v2.js +253 -170
- package/dist/lib/long-task-execution-observation.d.ts +7 -0
- package/dist/lib/long-task-execution-observation.js +21 -4
- package/dist/lib/long-task-expected-authority.d.ts +4 -0
- package/dist/lib/long-task-expected-authority.js +126 -0
- package/dist/lib/long-task-external-confirmation-artifacts.d.ts +9 -0
- package/dist/lib/long-task-external-confirmation-artifacts.js +138 -0
- package/dist/lib/long-task-external-confirmation-attestation.d.ts +20 -0
- package/dist/lib/long-task-external-confirmation-attestation.js +115 -0
- package/dist/lib/long-task-external-confirmation-challenge.d.ts +23 -0
- package/dist/lib/long-task-external-confirmation-challenge.js +164 -0
- package/dist/lib/long-task-external-confirmation-context.d.ts +14 -0
- package/dist/lib/long-task-external-confirmation-context.js +53 -0
- package/dist/lib/long-task-external-confirmation-evaluation.d.ts +11 -0
- package/dist/lib/long-task-external-confirmation-evaluation.js +454 -0
- package/dist/lib/long-task-external-confirmation-expected.d.ts +8 -0
- package/dist/lib/long-task-external-confirmation-expected.js +200 -0
- package/dist/lib/long-task-external-confirmation-identity.d.ts +10 -0
- package/dist/lib/long-task-external-confirmation-identity.js +77 -0
- package/dist/lib/long-task-external-confirmation-plan.d.ts +25 -0
- package/dist/lib/long-task-external-confirmation-plan.js +148 -0
- package/dist/lib/long-task-external-confirmation-preparation.d.ts +4 -0
- package/dist/lib/long-task-external-confirmation-preparation.js +100 -0
- package/dist/lib/long-task-external-confirmation-shape.d.ts +8 -0
- package/dist/lib/long-task-external-confirmation-shape.js +387 -0
- package/dist/lib/long-task-external-confirmation-state.d.ts +10 -0
- package/dist/lib/long-task-external-confirmation-state.js +109 -0
- package/dist/lib/long-task-external-confirmation-types.d.ts +195 -0
- package/dist/lib/long-task-external-confirmation-types.js +1 -0
- package/dist/lib/long-task-final-integrity.d.ts +2 -0
- package/dist/lib/long-task-final-integrity.js +21 -10
- package/dist/lib/long-task-final-v2.d.ts +7 -2
- package/dist/lib/long-task-final-v2.js +179 -55
- package/dist/lib/long-task-finalization-identity.d.ts +27 -0
- package/dist/lib/long-task-finalization-identity.js +58 -0
- package/dist/lib/long-task-finding-context.d.ts +1 -1
- package/dist/lib/long-task-finding-context.js +139 -13
- package/dist/lib/long-task-freshness.d.ts +27 -0
- package/dist/lib/long-task-freshness.js +129 -6
- package/dist/lib/long-task-git.js +3 -3
- package/dist/lib/long-task-material-input-closure.d.ts +3 -0
- package/dist/lib/long-task-material-input-closure.js +92 -0
- package/dist/lib/long-task-obligation-authority-resolution.d.ts +12 -0
- package/dist/lib/long-task-obligation-authority-resolution.js +57 -0
- package/dist/lib/long-task-obligation-semantic-identity.d.ts +16 -0
- package/dist/lib/long-task-obligation-semantic-identity.js +116 -0
- package/dist/lib/long-task-observation-authority.d.ts +11 -0
- package/dist/lib/long-task-observation-authority.js +137 -6
- package/dist/lib/long-task-process-table.d.ts +9 -0
- package/dist/lib/long-task-process-table.js +87 -0
- package/dist/lib/long-task-process-tree.d.ts +8 -0
- package/dist/lib/long-task-process-tree.js +108 -0
- package/dist/lib/long-task-proof-adequacy.d.ts +12 -0
- package/dist/lib/long-task-proof-adequacy.js +57 -0
- package/dist/lib/long-task-proof-capability-floor.d.ts +6 -0
- package/dist/lib/long-task-proof-capability-floor.js +137 -0
- package/dist/lib/long-task-protected-files.d.ts +1 -1
- package/dist/lib/long-task-protected-files.js +1 -1
- package/dist/lib/long-task-repair-frontier-checks.d.ts +8 -0
- package/dist/lib/long-task-repair-frontier-checks.js +93 -0
- package/dist/lib/long-task-repair-frontier-groups.d.ts +2 -0
- package/dist/lib/long-task-repair-frontier-groups.js +64 -0
- package/dist/lib/long-task-repair-frontier-utils.d.ts +6 -0
- package/dist/lib/long-task-repair-frontier-utils.js +27 -0
- package/dist/lib/long-task-repair-frontier.d.ts +14 -0
- package/dist/lib/long-task-repair-frontier.js +132 -0
- package/dist/lib/long-task-risk.d.ts +3 -2
- package/dist/lib/long-task-risk.js +73 -24
- package/dist/lib/long-task-root-shape.js +148 -8
- package/dist/lib/long-task-runner-freeze.d.ts +2 -1
- package/dist/lib/long-task-runner-freeze.js +23 -8
- package/dist/lib/long-task-runtime-types.d.ts +34 -40
- package/dist/lib/long-task-semantic-assurance-policy.js +2 -11
- package/dist/lib/long-task-semantic-contract-types.d.ts +2 -1
- package/dist/lib/long-task-semantic-drift-migration.js +48 -2
- package/dist/lib/long-task-semantic-fact-binding-types.d.ts +20 -0
- package/dist/lib/long-task-semantic-fact-closure.d.ts +5 -1
- package/dist/lib/long-task-semantic-fact-closure.js +33 -5
- package/dist/lib/long-task-semantic-fact-contract-closure.js +176 -1
- package/dist/lib/long-task-semantic-fact-contract-proofs.js +18 -1
- package/dist/lib/long-task-semantic-fact-input-closure.d.ts +16 -2
- package/dist/lib/long-task-semantic-fact-input-closure.js +138 -15
- package/dist/lib/long-task-semantic-fact-provenance-closure.js +1 -1
- package/dist/lib/long-task-semantic-fact-shape.d.ts +2 -1
- package/dist/lib/long-task-semantic-fact-shape.js +35 -1
- package/dist/lib/long-task-semantic-proof-adequacy.d.ts +2 -0
- package/dist/lib/long-task-semantic-proof-adequacy.js +19 -0
- package/dist/lib/long-task-semantic-proof-profile.d.ts +5 -0
- package/dist/lib/long-task-semantic-proof-profile.js +187 -0
- package/dist/lib/long-task-shape-primitives.d.ts +1 -1
- package/dist/lib/long-task-shape-primitives.js +5 -0
- package/dist/lib/long-task-source-anchors.d.ts +10 -0
- package/dist/lib/long-task-source-anchors.js +102 -0
- package/dist/lib/long-task-source-authority-types.d.ts +46 -0
- package/dist/lib/long-task-source-claim-validation.js +36 -0
- package/dist/lib/long-task-source-conservation-facts.d.ts +8 -0
- package/dist/lib/long-task-source-conservation-facts.js +57 -0
- package/dist/lib/long-task-source-conservation-types.d.ts +34 -0
- package/dist/lib/long-task-source-conservation-types.js +1 -0
- package/dist/lib/long-task-source-conservation.d.ts +7 -0
- package/dist/lib/long-task-source-conservation.js +110 -0
- package/dist/lib/long-task-source-fragments.d.ts +6 -0
- package/dist/lib/long-task-source-fragments.js +219 -0
- package/dist/lib/long-task-source-projection-resolution.d.ts +5 -0
- package/dist/lib/long-task-source-projection-resolution.js +57 -0
- package/dist/lib/long-task-source-projection-validation.d.ts +17 -0
- package/dist/lib/long-task-source-projection-validation.js +154 -0
- package/dist/lib/long-task-source-shape.js +14 -6
- package/dist/lib/long-task-source-supersession.d.ts +5 -0
- package/dist/lib/long-task-source-supersession.js +138 -0
- package/dist/lib/long-task-stage-policy.d.ts +7 -2
- package/dist/lib/long-task-stage-policy.js +67 -23
- package/dist/lib/long-task-state.d.ts +18 -4
- package/dist/lib/long-task-state.js +319 -33
- package/dist/lib/long-task-static-observation-freeze.js +4 -3
- package/dist/lib/long-task-status-projection.d.ts +3 -1
- package/dist/lib/long-task-status-projection.js +44 -13
- package/dist/lib/long-task-status-v2.d.ts +10 -6
- package/dist/lib/long-task-status-v2.js +70 -58
- package/dist/lib/long-task-target-policy.d.ts +8 -3
- package/dist/lib/long-task-target-policy.js +40 -9
- package/dist/lib/long-task-terminal-finalization.d.ts +12 -0
- package/dist/lib/long-task-terminal-finalization.js +190 -0
- package/dist/lib/long-task-ui-design-policy.js +15 -4
- package/dist/lib/long-task-ui-surface-policy.d.ts +2 -1
- package/dist/lib/long-task-ui-surface-policy.js +7 -4
- package/dist/lib/long-task-ui-surface-validation.d.ts +3 -1
- package/dist/lib/long-task-ui-surface-validation.js +2 -2
- package/dist/lib/long-task-verifier-counterfactuals.d.ts +11 -0
- package/dist/lib/long-task-verifier-counterfactuals.js +96 -0
- package/dist/lib/long-task-verifier-execution.d.ts +9 -0
- package/dist/lib/long-task-verifier-execution.js +67 -0
- package/dist/lib/long-task-verifier-identity.js +16 -5
- package/dist/lib/long-task-verifier-v2.js +52 -65
- package/dist/lib/long-task-windows-job-supervisor-helper.d.ts +1 -0
- package/dist/lib/long-task-windows-job-supervisor-helper.js +104 -0
- package/dist/lib/long-task-windows-job-supervisor-protocol.d.ts +28 -0
- package/dist/lib/long-task-windows-job-supervisor-protocol.js +124 -0
- package/dist/lib/long-task-windows-job-supervisor-result.d.ts +11 -0
- package/dist/lib/long-task-windows-job-supervisor-result.js +152 -0
- package/dist/lib/long-task-windows-job-supervisor.d.ts +2 -0
- package/dist/lib/long-task-windows-job-supervisor.js +126 -0
- package/dist/lib/long-task-workspace-scope.d.ts +1 -0
- package/dist/lib/long-task-workspace-scope.js +4 -1
- package/dist/lib/long-task-workspace.d.ts +1 -0
- package/dist/lib/long-task-workspace.js +10 -0
- package/dist/lib/migrations.js +43 -2
- package/dist/lib/repository-path-safety.d.ts +3 -0
- package/dist/lib/repository-path-safety.js +39 -3
- package/dist/lib/semantic-fact-input-shape.d.ts +7 -2
- package/dist/lib/semantic-fact-input-shape.js +25 -1
- package/dist/lib/semantic-fact-inventory-types.d.ts +8 -2
- package/dist/lib/semantic-fact-policy-census.d.ts +1 -1
- package/dist/lib/semantic-fact-policy-census.js +5 -2
- package/dist/lib/semantic-fact-policy.d.ts +1 -1
- package/dist/lib/semantic-fact-policy.js +2 -2
- package/dist/lib/semantic-fact-proof-shape.d.ts +1 -1
- package/dist/lib/semantic-fact-property-shape.d.ts +1 -1
- package/dist/lib/validators.d.ts +3 -0
- package/dist/lib/validators.js +45 -157
- package/dist/public-api-core.d.ts +12 -0
- package/dist/public-api-core.js +12 -0
- package/dist/public-api-long-task.d.ts +10 -0
- package/dist/public-api-long-task.js +10 -0
- package/dist/public-types.d.ts +6 -1
- package/dist/schemas/design-authority-delta-assessment-v1.schema.json +191 -0
- package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +166 -2
- package/dist/schemas/long-task-external-confirmation-record-v1.schema.json +155 -0
- package/dist/schemas/long-task-external-confirmation-record-v2.schema.json +209 -0
- package/migrations/README.md +99 -0
- package/package.json +7 -5
- package/source-mappings.yaml +18 -0
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { access, link, lstat, mkdir, open, readFile, readdir, rename, rm, unlink, writeFile, } from "node:fs/promises";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { canonicalJson, canonicalValueJson, sha256Hex, } from "./strict-codec.js";
|
|
4
5
|
import { gitCommonDir, gitConfigGet, gitConfigSet, gitConfigUnset, gitPath, } from "./long-task-workspace.js";
|
|
5
6
|
import { verifierAuthorityDiff } from "./long-task-verifier-authority.js";
|
|
7
|
+
import { deliveryCompileFreshness } from "./long-task-freshness.js";
|
|
8
|
+
import { assertNoUnfinishedContextMutationForAuthority } from "./context-mutation/mutation-journal.js";
|
|
9
|
+
import { assertActiveAuthorityLockToken, runWithActiveAuthorityLockToken, } from "./long-task-active-authority-lock-context.js";
|
|
6
10
|
const RUNTIME_FOLDER = ".ty-context";
|
|
7
11
|
const COMPILED_FILE = "compiled-contract.json";
|
|
8
12
|
const PROGRESS_FOLDER = "progress";
|
|
@@ -37,40 +41,210 @@ async function withActiveAuthorityLockInternal(repositoryRoot, operation, action
|
|
|
37
41
|
const activeFile = await activeRecordPath(root);
|
|
38
42
|
await mkdir(path.dirname(activeFile), { recursive: true });
|
|
39
43
|
const lockFile = await activeAuthorityLockPath(root);
|
|
40
|
-
|
|
44
|
+
const owner = {
|
|
45
|
+
schema_version: "active-authority-lock-owner-v1",
|
|
46
|
+
lock_id: randomUUID(),
|
|
47
|
+
pid: process.pid,
|
|
48
|
+
operation,
|
|
49
|
+
created_at: new Date().toISOString(),
|
|
50
|
+
};
|
|
51
|
+
const ownerBytes = Buffer.from(canonicalJson(owner), "utf8");
|
|
52
|
+
const lock = await acquireActiveAuthorityLock(lockFile, ownerBytes, breakStaleLock);
|
|
53
|
+
const acquired = await readActiveAuthorityLockSnapshot(lockFile);
|
|
54
|
+
assertLockSnapshotOwner(acquired, ownerBytes);
|
|
55
|
+
try {
|
|
56
|
+
const token = Object.freeze({
|
|
57
|
+
repository_root: root,
|
|
58
|
+
operation,
|
|
59
|
+
lock_id: owner.lock_id,
|
|
60
|
+
});
|
|
61
|
+
return await runWithActiveAuthorityLockToken(token, () => action(token));
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
await lock.close();
|
|
65
|
+
await releaseActiveAuthorityLock(lockFile, ownerBytes, acquired.identity);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function acquireActiveAuthorityLock(lockFile, ownerBytes, forceClear) {
|
|
41
69
|
try {
|
|
42
|
-
|
|
70
|
+
return await createActiveAuthorityLock(lockFile, ownerBytes);
|
|
43
71
|
}
|
|
44
72
|
catch (error) {
|
|
45
|
-
if (error.code
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
73
|
+
if (error.code !== "EEXIST")
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
let stale;
|
|
77
|
+
try {
|
|
78
|
+
stale = await readActiveAuthorityLockSnapshot(lockFile);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
throw new Error(`active_authority_compare_and_swap_failed:lock_unavailable:owner_unreadable_manual_recovery_required:${message(error)}`);
|
|
82
|
+
}
|
|
83
|
+
if (stale.identity.nlink !== 1n)
|
|
84
|
+
throw new Error("active_authority_compare_and_swap_failed:lock_owner_hardlinked_manual_recovery_required");
|
|
85
|
+
if (processIsLive(stale.owner.pid))
|
|
86
|
+
throw new Error(`active_authority_compare_and_swap_failed:lock_unavailable:live_owner:${stale.owner.pid}:${stale.owner.operation}`);
|
|
87
|
+
const claim = `${lockFile}.reclaim-${stale.owner.lock_id}`;
|
|
88
|
+
try {
|
|
89
|
+
await link(lockFile, claim);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (error.code === "EEXIST")
|
|
93
|
+
throw new Error(`active_authority_compare_and_swap_failed:lock_reclaim_interrupted_manual_recovery_required:${forceClear ? "force_clear" : "automatic"}:${stale.owner.lock_id}`);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
let acquired = null;
|
|
97
|
+
try {
|
|
98
|
+
const [current, claimed] = await Promise.all([
|
|
99
|
+
readActiveAuthorityLockSnapshot(lockFile),
|
|
100
|
+
readActiveAuthorityLockSnapshot(claim),
|
|
101
|
+
]);
|
|
102
|
+
assertSameLockSnapshot(current, claimed);
|
|
103
|
+
assertClaimedLockTransition(current, stale);
|
|
104
|
+
if (processIsLive(stale.owner.pid))
|
|
105
|
+
throw new Error(`active_authority_compare_and_swap_failed:lock_unavailable:owner_became_live:${stale.owner.pid}`);
|
|
106
|
+
await unlink(lockFile);
|
|
107
|
+
try {
|
|
108
|
+
acquired = await createActiveAuthorityLock(lockFile, ownerBytes);
|
|
55
109
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (error.code === "EEXIST")
|
|
112
|
+
throw new Error("active_authority_compare_and_swap_failed:lock_unavailable:reclaim_lost");
|
|
59
113
|
throw error;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
await unlink(claim).catch(() => undefined);
|
|
118
|
+
throw error;
|
|
60
119
|
}
|
|
61
120
|
try {
|
|
62
|
-
await
|
|
63
|
-
pid: process.pid,
|
|
64
|
-
operation,
|
|
65
|
-
created_at: new Date().toISOString(),
|
|
66
|
-
}), "utf8");
|
|
67
|
-
await lock.sync();
|
|
68
|
-
return await action();
|
|
121
|
+
await unlink(claim);
|
|
69
122
|
}
|
|
70
|
-
|
|
71
|
-
await
|
|
72
|
-
await
|
|
123
|
+
catch (error) {
|
|
124
|
+
await acquired.close().catch(() => undefined);
|
|
125
|
+
await removeOwnedAcquisition(lockFile, ownerBytes).catch(() => undefined);
|
|
126
|
+
throw new Error(`active_authority_lock_reclaim_cleanup_failed:${message(error)}`);
|
|
73
127
|
}
|
|
128
|
+
return acquired;
|
|
129
|
+
}
|
|
130
|
+
async function createActiveAuthorityLock(lockFile, ownerBytes) {
|
|
131
|
+
const handle = await open(lockFile, "wx");
|
|
132
|
+
try {
|
|
133
|
+
await handle.writeFile(ownerBytes);
|
|
134
|
+
await handle.sync();
|
|
135
|
+
return handle;
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
await handle.close().catch(() => undefined);
|
|
139
|
+
await unlink(lockFile).catch(() => undefined);
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async function releaseActiveAuthorityLock(lockFile, ownerBytes, identity) {
|
|
144
|
+
const current = await readActiveAuthorityLockSnapshot(lockFile).catch((error) => {
|
|
145
|
+
throw new Error(`active_authority_lock_release_ownership_lost:${message(error)}`);
|
|
146
|
+
});
|
|
147
|
+
if (!current.bytes.equals(ownerBytes) ||
|
|
148
|
+
!sameLockIdentity(current.identity, identity))
|
|
149
|
+
throw new Error("active_authority_lock_release_ownership_lost");
|
|
150
|
+
await unlink(lockFile);
|
|
151
|
+
}
|
|
152
|
+
async function readActiveAuthorityLockSnapshot(lockFile) {
|
|
153
|
+
const before = await lstat(lockFile, { bigint: true });
|
|
154
|
+
if (!before.isFile() || before.isSymbolicLink())
|
|
155
|
+
throw new Error("active_authority_lock_owner_unsafe");
|
|
156
|
+
const bytes = await readFile(lockFile);
|
|
157
|
+
const after = await lstat(lockFile, { bigint: true });
|
|
158
|
+
if (!sameLockIdentity(before, after))
|
|
159
|
+
throw new Error("active_authority_lock_owner_changed_during_read");
|
|
160
|
+
if (after.ino === 0n)
|
|
161
|
+
throw new Error("active_authority_lock_owner_identity_unavailable");
|
|
162
|
+
let value;
|
|
163
|
+
try {
|
|
164
|
+
value = JSON.parse(bytes.toString("utf8"));
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
throw new Error(`active_authority_lock_owner_invalid:${message(error)}`);
|
|
168
|
+
}
|
|
169
|
+
const owner = validateActiveAuthorityLockOwner(value);
|
|
170
|
+
if (!bytes.equals(Buffer.from(canonicalJson(owner), "utf8")))
|
|
171
|
+
throw new Error("active_authority_lock_owner_noncanonical");
|
|
172
|
+
return { bytes, identity: after, owner };
|
|
173
|
+
}
|
|
174
|
+
function validateActiveAuthorityLockOwner(value) {
|
|
175
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
176
|
+
throw new Error("active_authority_lock_owner_object_required");
|
|
177
|
+
const row = value;
|
|
178
|
+
if (Object.keys(row).sort().join("\0") !==
|
|
179
|
+
["created_at", "lock_id", "operation", "pid", "schema_version"]
|
|
180
|
+
.sort()
|
|
181
|
+
.join("\0") ||
|
|
182
|
+
row.schema_version !== "active-authority-lock-owner-v1" ||
|
|
183
|
+
typeof row.lock_id !== "string" ||
|
|
184
|
+
!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u.test(row.lock_id) ||
|
|
185
|
+
typeof row.pid !== "number" ||
|
|
186
|
+
!Number.isSafeInteger(row.pid) ||
|
|
187
|
+
row.pid <= 0 ||
|
|
188
|
+
!activeAuthorityLockOperation(row.operation) ||
|
|
189
|
+
typeof row.created_at !== "string" ||
|
|
190
|
+
!Number.isFinite(Date.parse(row.created_at)))
|
|
191
|
+
throw new Error("active_authority_lock_owner_invalid");
|
|
192
|
+
return row;
|
|
193
|
+
}
|
|
194
|
+
function activeAuthorityLockOperation(value) {
|
|
195
|
+
return [
|
|
196
|
+
"compile",
|
|
197
|
+
"commit",
|
|
198
|
+
"clear",
|
|
199
|
+
"abandon",
|
|
200
|
+
"migrate",
|
|
201
|
+
"external_confirmation",
|
|
202
|
+
"context_mutation",
|
|
203
|
+
"finalize",
|
|
204
|
+
].includes(value);
|
|
205
|
+
}
|
|
206
|
+
function processIsLive(pid) {
|
|
207
|
+
try {
|
|
208
|
+
process.kill(pid, 0);
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
return error.code !== "ESRCH";
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function assertLockSnapshotOwner(snapshot, ownerBytes) {
|
|
216
|
+
if (!snapshot.bytes.equals(ownerBytes))
|
|
217
|
+
throw new Error("active_authority_lock_acquire_ownership_lost");
|
|
218
|
+
}
|
|
219
|
+
function assertSameLockSnapshot(current, expected) {
|
|
220
|
+
if (!current.bytes.equals(expected.bytes) ||
|
|
221
|
+
!sameLockIdentity(current.identity, expected.identity))
|
|
222
|
+
throw new Error("active_authority_compare_and_swap_failed:lock_reclaim_owner_changed");
|
|
223
|
+
}
|
|
224
|
+
function assertClaimedLockTransition(current, expected) {
|
|
225
|
+
if (!current.bytes.equals(expected.bytes) ||
|
|
226
|
+
current.identity.dev !== expected.identity.dev ||
|
|
227
|
+
current.identity.ino !== expected.identity.ino ||
|
|
228
|
+
current.identity.size !== expected.identity.size ||
|
|
229
|
+
current.identity.mode !== expected.identity.mode ||
|
|
230
|
+
current.identity.mtimeNs !== expected.identity.mtimeNs ||
|
|
231
|
+
current.identity.nlink !== 2n)
|
|
232
|
+
throw new Error("active_authority_compare_and_swap_failed:lock_reclaim_owner_changed");
|
|
233
|
+
}
|
|
234
|
+
async function removeOwnedAcquisition(lockFile, ownerBytes) {
|
|
235
|
+
const current = await readActiveAuthorityLockSnapshot(lockFile);
|
|
236
|
+
if (!current.bytes.equals(ownerBytes))
|
|
237
|
+
throw new Error("active_authority_lock_acquire_cleanup_ownership_lost");
|
|
238
|
+
await unlink(lockFile);
|
|
239
|
+
}
|
|
240
|
+
function sameLockIdentity(left, right) {
|
|
241
|
+
return (left.dev === right.dev &&
|
|
242
|
+
left.ino === right.ino &&
|
|
243
|
+
left.nlink === right.nlink &&
|
|
244
|
+
left.size === right.size &&
|
|
245
|
+
left.mode === right.mode &&
|
|
246
|
+
left.mtimeNs === right.mtimeNs &&
|
|
247
|
+
left.ctimeNs === right.ctimeNs);
|
|
74
248
|
}
|
|
75
249
|
export async function writeCompiledDeliveryContract(compiled) {
|
|
76
250
|
const staged = await stageCompiledDeliveryContract(compiled);
|
|
@@ -167,9 +341,13 @@ export async function commitActiveAuthority(options) {
|
|
|
167
341
|
? "migrate"
|
|
168
342
|
: "commit";
|
|
169
343
|
return withActiveAuthorityLock(root, operation, async () => {
|
|
344
|
+
await assertNoUnfinishedContextMutationForAuthority(root);
|
|
170
345
|
const current = await loadActiveLongTaskAuthorityUnlocked(root);
|
|
171
346
|
assertAuthorityCasCandidate(current.authority, options.candidate, options.expected_previous_identity);
|
|
172
347
|
await ensureRuntimeExcludes(root, options.candidate.workdir);
|
|
348
|
+
const stale = await deliveryCompileFreshness(options.candidate);
|
|
349
|
+
if (stale.length)
|
|
350
|
+
throw new Error(`active_authority_candidate_stale:${stale.join(",")}`);
|
|
173
351
|
const authority = activeAuthorityFromCompiled(options.candidate, current.authority?.activated_at ?? new Date().toISOString());
|
|
174
352
|
await persistActiveAuthorityCasUnlocked(root, authority, options.expected_previous_identity);
|
|
175
353
|
return authority;
|
|
@@ -393,17 +571,83 @@ export async function invalidateDerivedProgress(workdir) {
|
|
|
393
571
|
rm(runtimePath(workdir, FINAL_FILE), { force: true }),
|
|
394
572
|
]);
|
|
395
573
|
}
|
|
396
|
-
export
|
|
397
|
-
|
|
574
|
+
export function sealFinalReceipt(unsigned) {
|
|
575
|
+
return {
|
|
398
576
|
...unsigned,
|
|
399
577
|
receipt_sha256: sha256Hex(canonicalValueJson(unsigned)),
|
|
400
578
|
};
|
|
579
|
+
}
|
|
580
|
+
export async function commitFinalReceiptTransaction(input) {
|
|
581
|
+
const root = path.resolve(input.repository_root);
|
|
582
|
+
assertFinalizationLockToken(input.lock_token, root);
|
|
583
|
+
const active = await assertCurrentAuthorityCas(root, input.workdir, input.expected_authority);
|
|
584
|
+
const receipt = sealFinalReceipt(input.unsigned);
|
|
401
585
|
const content = canonicalJson(receipt);
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
586
|
+
const workdirReceipt = runtimePath(input.workdir, FINAL_FILE);
|
|
587
|
+
const auditReceipt = await auditReceiptPath(root);
|
|
588
|
+
const activeFile = await activeRecordPath(root);
|
|
589
|
+
const marker = markerKey(worktreeIdentity(root));
|
|
590
|
+
const [oldWorkdirReceipt, oldAuditReceipt, oldActiveRecord, oldMarker] = await Promise.all([
|
|
591
|
+
readOptionalText(workdirReceipt),
|
|
592
|
+
readOptionalText(auditReceipt),
|
|
593
|
+
readOptionalText(activeFile),
|
|
594
|
+
gitConfigGet(root, marker),
|
|
405
595
|
]);
|
|
406
|
-
|
|
596
|
+
if (oldActiveRecord === null || oldMarker !== markerValue(active))
|
|
597
|
+
throw new Error("finalization_authority_persistence_cas_failed");
|
|
598
|
+
const stagedWorkdirReceipt = await stageAtomicText(workdirReceipt, content);
|
|
599
|
+
const stagedAuditReceipt = await stageAtomicText(auditReceipt, content);
|
|
600
|
+
let activeBackup = null;
|
|
601
|
+
try {
|
|
602
|
+
await input.validate_current("after_receipt_stage");
|
|
603
|
+
await assertCurrentAuthorityCas(root, input.workdir, input.expected_authority);
|
|
604
|
+
await rename(stagedWorkdirReceipt, workdirReceipt);
|
|
605
|
+
await rename(stagedAuditReceipt, auditReceipt);
|
|
606
|
+
await input.validate_current("after_receipt_publish");
|
|
607
|
+
await assertCurrentAuthorityCas(root, input.workdir, input.expected_authority);
|
|
608
|
+
if (input.close_on_accept) {
|
|
609
|
+
activeBackup = `${activeFile}.finalize-${process.pid}-${Date.now()}`;
|
|
610
|
+
await rename(activeFile, activeBackup);
|
|
611
|
+
if ((await readFile(activeBackup, "utf8")) !== oldActiveRecord)
|
|
612
|
+
throw new Error("finalization_authority_record_changed_before_clear");
|
|
613
|
+
if ((await gitConfigGet(root, marker)) !== oldMarker)
|
|
614
|
+
throw new Error("finalization_authority_marker_changed_before_clear");
|
|
615
|
+
await gitConfigUnset(root, marker);
|
|
616
|
+
await input.validate_current("after_authority_clear");
|
|
617
|
+
if ((await readOptionalText(activeFile)) !== null)
|
|
618
|
+
throw new Error("finalization_authority_reappeared_during_clear");
|
|
619
|
+
if ((await gitConfigGet(root, marker)) !== null)
|
|
620
|
+
throw new Error("finalization_authority_marker_reappeared_during_clear");
|
|
621
|
+
await rm(activeBackup, { force: true });
|
|
622
|
+
activeBackup = null;
|
|
623
|
+
}
|
|
624
|
+
return receipt;
|
|
625
|
+
}
|
|
626
|
+
catch (error) {
|
|
627
|
+
await Promise.allSettled([
|
|
628
|
+
restoreOptionalText(workdirReceipt, oldWorkdirReceipt),
|
|
629
|
+
restoreOptionalText(auditReceipt, oldAuditReceipt),
|
|
630
|
+
restoreAuthorityAfterFinalizationFailure({
|
|
631
|
+
active_file: activeFile,
|
|
632
|
+
active_backup: activeBackup,
|
|
633
|
+
old_active_record: oldActiveRecord,
|
|
634
|
+
repository_root: root,
|
|
635
|
+
marker,
|
|
636
|
+
old_marker: oldMarker,
|
|
637
|
+
}),
|
|
638
|
+
]).then((results) => {
|
|
639
|
+
const rejected = results.find((result) => result.status === "rejected");
|
|
640
|
+
if (rejected?.status === "rejected")
|
|
641
|
+
throw new Error(`finalization_transaction_rollback_failed:${message(rejected.reason)}`);
|
|
642
|
+
});
|
|
643
|
+
throw error;
|
|
644
|
+
}
|
|
645
|
+
finally {
|
|
646
|
+
await Promise.all([
|
|
647
|
+
rm(stagedWorkdirReceipt, { force: true }),
|
|
648
|
+
rm(stagedAuditReceipt, { force: true }),
|
|
649
|
+
]);
|
|
650
|
+
}
|
|
407
651
|
}
|
|
408
652
|
export async function readFinalReceipt(_repositoryRoot, workdir) {
|
|
409
653
|
const value = await readOptionalJson(runtimePath(workdir, FINAL_FILE));
|
|
@@ -411,11 +655,19 @@ export async function readFinalReceipt(_repositoryRoot, workdir) {
|
|
|
411
655
|
return null;
|
|
412
656
|
const receipt = value;
|
|
413
657
|
const { receipt_sha256: receiptHash, ...unsigned } = receipt;
|
|
414
|
-
if (receipt
|
|
658
|
+
if (!["long-task-final-receipt-v2", "long-task-final-receipt-v3"].includes(receipt.schema_version) ||
|
|
415
659
|
receipt.authority_scope !== "audit_only" ||
|
|
416
660
|
receipt.reusable_for_acceptance !== false ||
|
|
661
|
+
(receipt.finalization_identity_sha256 !== undefined &&
|
|
662
|
+
!/^[a-f0-9]{64}$/u.test(receipt.finalization_identity_sha256)) ||
|
|
417
663
|
sha256Hex(canonicalValueJson(unsigned)) !== receiptHash)
|
|
418
664
|
throw new Error("final_receipt_integrity_mismatch");
|
|
665
|
+
if ((receipt.schema_version === "long-task-final-receipt-v2" &&
|
|
666
|
+
receipt.workflow_status === "delivery_accepted") ||
|
|
667
|
+
(receipt.schema_version === "long-task-final-receipt-v3" &&
|
|
668
|
+
(receipt.workflow_status === "machine_accepted_external_pending" ||
|
|
669
|
+
!Array.isArray(receipt.external_confirmation_results))))
|
|
670
|
+
throw new Error("final_receipt_schema_status_mismatch");
|
|
419
671
|
return receipt;
|
|
420
672
|
}
|
|
421
673
|
export function activeAuthorityIdentityMatches(authority, expected) {
|
|
@@ -602,6 +854,40 @@ async function stageAtomicText(file, content) {
|
|
|
602
854
|
}
|
|
603
855
|
return temporary;
|
|
604
856
|
}
|
|
857
|
+
function assertFinalizationLockToken(token, repositoryRoot) {
|
|
858
|
+
try {
|
|
859
|
+
assertActiveAuthorityLockToken(token, repositoryRoot);
|
|
860
|
+
}
|
|
861
|
+
catch {
|
|
862
|
+
throw new Error("finalization_active_authority_lock_required");
|
|
863
|
+
}
|
|
864
|
+
if (token.operation !== "finalize")
|
|
865
|
+
throw new Error("finalization_active_authority_lock_required");
|
|
866
|
+
}
|
|
867
|
+
async function assertCurrentAuthorityCas(repositoryRoot, workdir, expected) {
|
|
868
|
+
const current = (await loadActiveLongTaskAuthorityUnlocked(repositoryRoot))
|
|
869
|
+
.authority;
|
|
870
|
+
if (!current ||
|
|
871
|
+
normalizePath(current.workdir) !== normalizePath(workdir) ||
|
|
872
|
+
!activeAuthorityIdentityMatches(current, expected))
|
|
873
|
+
throw new Error("finalization_authority_compare_and_swap_failed");
|
|
874
|
+
return current;
|
|
875
|
+
}
|
|
876
|
+
async function restoreOptionalText(file, previous) {
|
|
877
|
+
if (previous === null)
|
|
878
|
+
await rm(file, { force: true });
|
|
879
|
+
else
|
|
880
|
+
await atomicText(file, previous);
|
|
881
|
+
}
|
|
882
|
+
async function restoreAuthorityAfterFinalizationFailure(input) {
|
|
883
|
+
await atomicText(input.active_file, input.old_active_record);
|
|
884
|
+
if (input.active_backup)
|
|
885
|
+
await rm(input.active_backup, { force: true });
|
|
886
|
+
if (input.old_marker === null)
|
|
887
|
+
await gitConfigUnset(input.repository_root, input.marker);
|
|
888
|
+
else
|
|
889
|
+
await gitConfigSet(input.repository_root, input.marker, input.old_marker);
|
|
890
|
+
}
|
|
605
891
|
function missingError(error) {
|
|
606
892
|
const value = message(error);
|
|
607
893
|
return value.includes("ENOENT") || value.includes("no such file");
|
|
@@ -3,6 +3,7 @@ import { constants, watch } from "node:fs";
|
|
|
3
3
|
import { lstat, open, realpath } from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { JSON_POINTER_EXACT_LIMITS, assertJsonTree, decodeUtf8Json, extractJsonPointerExactObservationFromBytes, normalizeObservationArtifactPath, parseJsonWithoutDuplicateKeys, resolveJsonPointer, } from "./long-task-json-pointer-observation.js";
|
|
6
|
+
const OBSERVATION_HASH_READ_BUFFER_BYTES = 1_048_576;
|
|
6
7
|
export class StaticObservationFreezeError extends Error {
|
|
7
8
|
code;
|
|
8
9
|
artifact_path;
|
|
@@ -227,7 +228,7 @@ async function captureStaticObservationFile(root, artifactPath, maxFileBytes, re
|
|
|
227
228
|
assertMetadataEqual(expected, openedMetadata, artifactPath, expected);
|
|
228
229
|
if (openedMetadata.size > maxFileBytes)
|
|
229
230
|
throw freezeError("static_observation_size_limit", artifactPath);
|
|
230
|
-
const content = await readAndHashBounded(handle, artifactPath, maxFileBytes, retainBytes);
|
|
231
|
+
const content = await readAndHashBounded(handle, artifactPath, maxFileBytes, retainBytes, openedMetadata.size);
|
|
231
232
|
const afterRead = fileMetadata(await handle.stat({ bigint: true }));
|
|
232
233
|
assertMetadataEqual(openedMetadata, afterRead, artifactPath, expected);
|
|
233
234
|
const pathAfter = fileMetadata(await lstat(absolute, { bigint: true }).catch((error) => {
|
|
@@ -335,8 +336,8 @@ function assertMetadataEqual(left, right, artifactPath, postRunExpected) {
|
|
|
335
336
|
? "static_observation_changed_by_runner"
|
|
336
337
|
: "static_observation_not_in_pre_run_snapshot", artifactPath, `file_identity.${mismatch}`);
|
|
337
338
|
}
|
|
338
|
-
async function readAndHashBounded(handle, artifactPath, limit, retainBytes) {
|
|
339
|
-
const buffer = Buffer.allocUnsafe(Math.min(
|
|
339
|
+
async function readAndHashBounded(handle, artifactPath, limit, retainBytes, expectedSize) {
|
|
340
|
+
const buffer = Buffer.allocUnsafe(Math.min(OBSERVATION_HASH_READ_BUFFER_BYTES, limit + 1, Math.max(1, expectedSize + 1)));
|
|
340
341
|
const chunks = [];
|
|
341
342
|
const hash = createHash("sha256");
|
|
342
343
|
let offset = 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompiledDeliveryContractV2, FinalReceiptV2, LongTaskFindingV2, OutcomeStatusV2, ProgressRecordV2, StageStatusV2, WorkspaceManifestV2 } from "./long-task-delivery-types.js";
|
|
1
|
+
import type { CompiledDeliveryContractV2, FinalReceiptV2, LongTaskFindingV2, OutcomeStatusV2, ProgressRecordV2, StageStatusV2, WorkspaceManifestV2, ExternalConfirmationEvaluationV1 } from "./long-task-delivery-types.js";
|
|
2
2
|
interface StatusProjectionInputV2 {
|
|
3
3
|
compiled: CompiledDeliveryContractV2;
|
|
4
4
|
manifest: WorkspaceManifestV2;
|
|
@@ -6,6 +6,8 @@ interface StatusProjectionInputV2 {
|
|
|
6
6
|
progress: Record<string, ProgressRecordV2>;
|
|
7
7
|
receipt: FinalReceiptV2 | null;
|
|
8
8
|
receiptError: string | null;
|
|
9
|
+
finalizationIdentitySha256: string | null;
|
|
10
|
+
externalConfirmations: ExternalConfirmationEvaluationV1[];
|
|
9
11
|
}
|
|
10
12
|
export type AuditGateStatusV2 = "no_final_gate" | "last_gate_passed" | "last_gate_failed" | "last_gate_blocked" | "last_gate_inputs_stale";
|
|
11
13
|
export declare function projectDeliveryStatus(input: StatusProjectionInputV2): {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { outcomeResultExternallyBlocked } from "./long-task-claims.js";
|
|
2
1
|
import { progressRecordFresh } from "./long-task-progress.js";
|
|
2
|
+
import { blockingExternalRows } from "./long-task-external-confirmation-identity.js";
|
|
3
3
|
export function projectDeliveryStatus(input) {
|
|
4
4
|
const outcomes = projectOutcomes(input);
|
|
5
5
|
const stages = projectStages(input.compiled, outcomes);
|
|
@@ -32,6 +32,8 @@ export function projectDeliveryStatus(input) {
|
|
|
32
32
|
function projectOutcomes(input) {
|
|
33
33
|
const outcomes = {};
|
|
34
34
|
for (const outcome of input.compiled.outcomes) {
|
|
35
|
+
const external = input.externalConfirmations.filter((evaluation) => evaluation.blocks_target &&
|
|
36
|
+
externalConfirmationImpactsOutcome(input.compiled, evaluation, outcome.key));
|
|
35
37
|
const states = outcome.acceptance.checks.map((check) => {
|
|
36
38
|
const record = input.progress[check.internal_id];
|
|
37
39
|
if (!record)
|
|
@@ -45,20 +47,29 @@ function projectOutcomes(input) {
|
|
|
45
47
|
return "blocked_external";
|
|
46
48
|
return "progress_failing";
|
|
47
49
|
});
|
|
48
|
-
outcomes[outcome.key] =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
? "
|
|
55
|
-
: states.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
outcomes[outcome.key] =
|
|
51
|
+
states.includes("progress_failing") ||
|
|
52
|
+
external.some((evaluation) => evaluation.state !== "fulfilled" && evaluation.state !== "pending")
|
|
53
|
+
? "progress_failing"
|
|
54
|
+
: external.some((evaluation) => evaluation.state === "pending") ||
|
|
55
|
+
states.includes("blocked_external")
|
|
56
|
+
? "blocked_external"
|
|
57
|
+
: states.includes("progress_stale")
|
|
58
|
+
? "progress_stale"
|
|
59
|
+
: states.length > 0 &&
|
|
60
|
+
states.every((state) => state === "progress_passing")
|
|
61
|
+
? "progress_passing"
|
|
62
|
+
: "unverified";
|
|
59
63
|
}
|
|
60
64
|
return outcomes;
|
|
61
65
|
}
|
|
66
|
+
function externalConfirmationImpactsOutcome(compiled, evaluation, outcomeKey) {
|
|
67
|
+
return blockingExternalRows(compiled, evaluation.confirmation_ref).some((row) => row.outcome_key === outcomeKey ||
|
|
68
|
+
row.claim_ref === outcomeKey ||
|
|
69
|
+
row.claim_ref.startsWith(`${outcomeKey}.`) ||
|
|
70
|
+
row.local_claim_ref === outcomeKey ||
|
|
71
|
+
row.local_claim_ref.startsWith(`${outcomeKey}.`));
|
|
72
|
+
}
|
|
62
73
|
function projectFindings(input) {
|
|
63
74
|
const findings = input.stale.map((code) => ({
|
|
64
75
|
code,
|
|
@@ -110,7 +121,7 @@ function readyOutcomes(compiled, outcomes, stages) {
|
|
|
110
121
|
}
|
|
111
122
|
function legacyTargetState(receipt) {
|
|
112
123
|
if (receipt.workflow_status === "machine_accepted" ||
|
|
113
|
-
receipt.workflow_status === "
|
|
124
|
+
receipt.workflow_status === "delivery_accepted")
|
|
114
125
|
return receipt.target_profile.required_state;
|
|
115
126
|
return receipt.workflow_status === "blocked_external"
|
|
116
127
|
? "blocked_external"
|
|
@@ -165,6 +176,8 @@ function projectFinalResult(input) {
|
|
|
165
176
|
return "last_gate_inputs_stale";
|
|
166
177
|
if (input.receipt.workflow_status === "blocked_external")
|
|
167
178
|
return "last_gate_blocked";
|
|
179
|
+
if (input.receipt.workflow_status === "machine_accepted_external_pending")
|
|
180
|
+
return "last_gate_blocked";
|
|
168
181
|
if (input.receipt.workflow_status === "needs_work")
|
|
169
182
|
return "last_gate_failed";
|
|
170
183
|
return "last_gate_passed";
|
|
@@ -172,9 +185,27 @@ function projectFinalResult(input) {
|
|
|
172
185
|
function receiptFresh(input) {
|
|
173
186
|
return Boolean(input.receipt &&
|
|
174
187
|
!input.receiptError &&
|
|
188
|
+
input.finalizationIdentitySha256 !== null &&
|
|
189
|
+
input.receipt.finalization_identity_sha256 ===
|
|
190
|
+
input.finalizationIdentitySha256 &&
|
|
175
191
|
!input.stale.length &&
|
|
192
|
+
blockingExternalInputsFresh(input) &&
|
|
176
193
|
input.receipt.compiled_identity === input.compiled.compiled_identity &&
|
|
177
194
|
input.receipt.snapshot_sha256 === input.manifest.snapshot_sha256 &&
|
|
178
195
|
input.receipt.git_head === input.manifest.git_head &&
|
|
179
196
|
input.receipt.git_tree === input.manifest.fingerprint.head_tree);
|
|
180
197
|
}
|
|
198
|
+
function blockingExternalInputsFresh(input) {
|
|
199
|
+
if (!input.receipt)
|
|
200
|
+
return false;
|
|
201
|
+
const project = (rows) => rows
|
|
202
|
+
.filter((row) => row.blocks_target)
|
|
203
|
+
.map((row) => ({
|
|
204
|
+
confirmation_ref: row.confirmation_ref,
|
|
205
|
+
state: row.state,
|
|
206
|
+
record_sha256: row.record_sha256,
|
|
207
|
+
relevant_input_identity: row.relevant_input_identity,
|
|
208
|
+
}))
|
|
209
|
+
.sort((left, right) => left.confirmation_ref.localeCompare(right.confirmation_ref));
|
|
210
|
+
return (JSON.stringify(project(input.receipt.external_confirmation_results ?? [])) === JSON.stringify(project(input.externalConfirmations)));
|
|
211
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AuthorityRevisionDecisionV2 } from "./long-task-authority-revision-types.js";
|
|
2
|
-
import type { ExternalConfirmationV2, FinalReceiptV2, LongTaskFindingV2, OutcomeStatusV2, StageStatusV2, TargetProfileV2 } from "./long-task-delivery-types.js";
|
|
2
|
+
import type { ExternalConfirmationV2, ExternalConfirmationEvaluationV1, FinalReceiptV2, LongTaskFindingV2, OutcomeStatusV2, RepairFrontierV1, StageStatusV2, TargetProfileV2 } from "./long-task-delivery-types.js";
|
|
3
3
|
import { type AuditGateStatusV2 } from "./long-task-status-projection.js";
|
|
4
4
|
export interface DeliveryStatusV2 {
|
|
5
5
|
schema_version: "long-task-status-v2";
|
|
@@ -8,11 +8,12 @@ export interface DeliveryStatusV2 {
|
|
|
8
8
|
effective_risk: "standard" | "strict";
|
|
9
9
|
workspace_snapshot_sha256: string;
|
|
10
10
|
acceptance_authority: "live_final_gate_required";
|
|
11
|
-
acceptance_scope: "
|
|
11
|
+
acceptance_scope: "declared_delivery_authority";
|
|
12
12
|
native_goal_effect: "none";
|
|
13
13
|
final_result: AuditGateStatusV2;
|
|
14
14
|
final_workflow_status: FinalReceiptV2["workflow_status"] | null;
|
|
15
15
|
external_confirmations: ExternalConfirmationV2[];
|
|
16
|
+
external_confirmation_results: ExternalConfirmationEvaluationV1[];
|
|
16
17
|
target_profile: TargetProfileV2;
|
|
17
18
|
target_state: FinalReceiptV2["target_state"];
|
|
18
19
|
outcomes: Record<string, OutcomeStatusV2>;
|
|
@@ -25,6 +26,7 @@ export interface DeliveryStatusV2 {
|
|
|
25
26
|
progress_passing: string[];
|
|
26
27
|
progress_failing: string[];
|
|
27
28
|
findings: LongTaskFindingV2[];
|
|
29
|
+
repair_frontier: RepairFrontierV1;
|
|
28
30
|
pending_authority_revision: AuthorityRevisionDecisionV2 | null;
|
|
29
31
|
}
|
|
30
32
|
export declare function readDeliveryStatus(workdir: string): Promise<DeliveryStatusV2>;
|
|
@@ -36,22 +38,24 @@ export interface StopCheckDeliveryResultV2 {
|
|
|
36
38
|
reason: string;
|
|
37
39
|
workflow_status?: FinalReceiptV2["workflow_status"];
|
|
38
40
|
external_confirmations?: ExternalConfirmationV2[];
|
|
41
|
+
external_confirmation_results?: ExternalConfirmationEvaluationV1[];
|
|
39
42
|
target_profile?: TargetProfileV2;
|
|
40
43
|
target_state?: FinalReceiptV2["target_state"];
|
|
41
44
|
stage_results?: FinalReceiptV2["stage_results"];
|
|
42
|
-
acceptance_scope?: "
|
|
45
|
+
acceptance_scope?: "declared_delivery_authority";
|
|
43
46
|
native_goal_effect?: "none";
|
|
44
47
|
message?: string;
|
|
45
48
|
}
|
|
46
49
|
export interface CloseDeliveryResultV2 {
|
|
47
50
|
status: "closed";
|
|
48
|
-
workflow_status: Extract<FinalReceiptV2["workflow_status"], "machine_accepted" | "
|
|
51
|
+
workflow_status: Extract<FinalReceiptV2["workflow_status"], "machine_accepted" | "delivery_accepted">;
|
|
49
52
|
external_confirmations: ExternalConfirmationV2[];
|
|
53
|
+
external_confirmation_results: ExternalConfirmationEvaluationV1[];
|
|
50
54
|
target_profile: TargetProfileV2;
|
|
51
55
|
target_state: FinalReceiptV2["target_state"];
|
|
52
56
|
stage_results: FinalReceiptV2["stage_results"];
|
|
53
|
-
acceptance_scope: "
|
|
54
|
-
closed_scope: "
|
|
57
|
+
acceptance_scope: "declared_delivery_authority";
|
|
58
|
+
closed_scope: "complete_long_task_authority";
|
|
55
59
|
native_goal_effect: "none";
|
|
56
60
|
}
|
|
57
61
|
export declare function closeDeliveryTask(workdir: string): Promise<CloseDeliveryResultV2>;
|