project-tiny-context-harness 0.8.17 → 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 +93 -30
- package/assets/README.md +158 -44
- package/assets/README.zh-CN.md +88 -29
- package/assets/agents/AGENTS_CORE.md +2 -2
- package/assets/context_templates/context.toml +6 -1
- 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/design-resource-authoring/SKILL.md +6 -3
- package/assets/skills/design-resource-authoring/references/authority-delta-assessment.md +52 -0
- package/assets/skills/design-resource-authoring/references/downstream-handoff.md +5 -1
- 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 +8 -1
- 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-input-types.d.ts +1 -1
- package/dist/lib/design-resource-handoff-manifest-projection.js +3 -0
- package/dist/lib/design-resource-handoff-shape.js +14 -2
- package/dist/lib/design-resource-handoff-types.d.ts +3 -0
- package/dist/lib/design-resource-handoff-validation.js +16 -4
- package/dist/lib/design-resource-implementation-feasibility-validation-support.js +1 -1
- 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 +7 -1
- package/dist/lib/design-resource-symbolic-fact-types.d.ts +3 -0
- package/dist/lib/design-resource-symbolic-fact-validation.js +15 -3
- 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 +72 -69
- 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-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.js +3 -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 +6 -1
- package/dist/lib/long-task-delivery-validation.js +19 -4
- package/dist/lib/long-task-design-feasibility-binding.d.ts +1 -0
- package/dist/lib/long-task-design-feasibility-binding.js +3 -3
- package/dist/lib/long-task-design-feasibility-source-closure.js +11 -2
- 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 +3 -1
- package/dist/lib/long-task-design-resource-handoff.js +36 -12
- package/dist/lib/long-task-design-resource-method-binding.js +12 -0
- 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 +128 -5
- 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 +2 -5
- package/dist/lib/long-task-process-table.js +21 -53
- package/dist/lib/long-task-process-tree.d.ts +0 -1
- package/dist/lib/long-task-process-tree.js +24 -54
- 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-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-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 +1 -0
- package/dist/lib/repository-path-safety.js +3 -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 +5 -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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CompiledSourceItemV2, MaterialTextInputV2 } from "./long-task-source-authority-types.js";
|
|
2
|
+
import type { DesignOwnedSemanticProjectionV1 } from "./long-task-semantic-fact-input-closure.js";
|
|
3
|
+
import type { SemanticFactManifestV1 } from "./semantic-fact-types.js";
|
|
4
|
+
import type { SourceSemanticConservationV2 } from "./long-task-source-conservation-types.js";
|
|
5
|
+
export type { SourceSemanticConservationV2 } from "./long-task-source-conservation-types.js";
|
|
6
|
+
export { semanticFactAuthorityDomain, semanticFactClass, } from "./long-task-source-conservation-facts.js";
|
|
7
|
+
export declare function validateSourceSemanticConservation(sourceItems: CompiledSourceItemV2[], manifest: SemanticFactManifestV1, designInput: Set<string> | DesignOwnedSemanticProjectionV1, materialInput?: MaterialTextInputV2[], factClaimPolarities?: ReadonlyMap<string, ReadonlySet<"positive" | "negative">>): SourceSemanticConservationV2;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { deriveSemanticSourceAnchors, scanMaterialTextInput, sourceAuthorityDomain, } from "./long-task-source-fragments.js";
|
|
2
|
+
import { addSourceConservationFact, semanticFactAuthorityDomain, semanticFactClass, semanticFactExpectedSearchText, } from "./long-task-source-conservation-facts.js";
|
|
3
|
+
import { resolveFragmentProjection } from "./long-task-source-projection-resolution.js";
|
|
4
|
+
import { validateAnchorProjection, validateNoDanglingProjectionInputs, validateProjection, } from "./long-task-source-projection-validation.js";
|
|
5
|
+
export { semanticFactAuthorityDomain, semanticFactClass, } from "./long-task-source-conservation-facts.js";
|
|
6
|
+
export function validateSourceSemanticConservation(sourceItems, manifest, designInput, materialInput, factClaimPolarities = new Map()) {
|
|
7
|
+
const designProjection = designInput instanceof Set
|
|
8
|
+
? { source_items: designInput, facts: [] }
|
|
9
|
+
: designInput;
|
|
10
|
+
const designOwnedSourceItems = designProjection.source_items;
|
|
11
|
+
const sourceByKey = new Map(sourceItems.map((item) => [item.key, item]));
|
|
12
|
+
const sourceDomains = sourceAuthorityDomains(sourceItems, designOwnedSourceItems);
|
|
13
|
+
const facts = sourceConservationFacts(manifest, designProjection, sourceDomains);
|
|
14
|
+
const factClasses = Object.fromEntries([...facts.values()].map((fact) => [fact.key, fact.semantic_class]));
|
|
15
|
+
const factDomains = Object.fromEntries([...facts.values()].map((fact) => [fact.key, fact.authority_domain]));
|
|
16
|
+
const designFactRefsBySource = designFactsBySource(designProjection);
|
|
17
|
+
const materialInputs = materialInput ??
|
|
18
|
+
sourceItems.map((item) => ({
|
|
19
|
+
input_key: item.key,
|
|
20
|
+
input_kind: "source_item",
|
|
21
|
+
source_ref: item.source_path,
|
|
22
|
+
sha256: item.text_sha256,
|
|
23
|
+
authority_source_item_refs: [item.key],
|
|
24
|
+
authority_domain: sourceAuthorityDomain(item, designOwnedSourceItems.has(item.key)),
|
|
25
|
+
normalized_text: item.normalized_text,
|
|
26
|
+
}));
|
|
27
|
+
const fragments = materialInputs.flatMap((input) => scanMaterialTextInput(input).fragments);
|
|
28
|
+
const anchors = [];
|
|
29
|
+
const validationContext = {
|
|
30
|
+
facts,
|
|
31
|
+
factClasses,
|
|
32
|
+
factDomains,
|
|
33
|
+
sourceDomains,
|
|
34
|
+
sourceByKey,
|
|
35
|
+
manifest,
|
|
36
|
+
designFactRefsBySource,
|
|
37
|
+
factClaimPolarities,
|
|
38
|
+
};
|
|
39
|
+
for (const material of materialInputs) {
|
|
40
|
+
const itemFragments = fragments.filter((fragment) => fragment.input_key === material.input_key);
|
|
41
|
+
for (const fragment of itemFragments) {
|
|
42
|
+
const projection = resolveFragmentProjection(fragment, manifest);
|
|
43
|
+
validateProjection(projection, fragment, validationContext);
|
|
44
|
+
const fragmentAnchors = deriveSemanticSourceAnchors(fragment);
|
|
45
|
+
anchors.push(...fragmentAnchors);
|
|
46
|
+
for (const anchor of fragmentAnchors)
|
|
47
|
+
validateAnchorProjection(anchor, projection, validationContext);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
validateNoDanglingProjectionInputs(fragments, anchors, manifest);
|
|
51
|
+
return {
|
|
52
|
+
fragments: fragments.sort((left, right) => left.key.localeCompare(right.key)),
|
|
53
|
+
anchors: anchors.sort((left, right) => left.key.localeCompare(right.key)),
|
|
54
|
+
fact_classes: factClasses,
|
|
55
|
+
fact_domains: factDomains,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function sourceAuthorityDomains(sourceItems, designOwned) {
|
|
59
|
+
return new Map(sourceItems.map((item) => [
|
|
60
|
+
item.key,
|
|
61
|
+
sourceAuthorityDomain(item, designOwned.has(item.key)),
|
|
62
|
+
]));
|
|
63
|
+
}
|
|
64
|
+
function sourceConservationFacts(manifest, designProjection, sourceDomains) {
|
|
65
|
+
const facts = new Map();
|
|
66
|
+
for (const fact of manifest.facts)
|
|
67
|
+
addSourceConservationFact(facts, {
|
|
68
|
+
key: fact.key,
|
|
69
|
+
source_item_refs: fact.source_item_refs,
|
|
70
|
+
basis_refs: fact.provenance.basis_refs,
|
|
71
|
+
semantic_class: semanticFactClass(fact),
|
|
72
|
+
authority_domain: semanticFactAuthorityDomain(fact, sourceDomains),
|
|
73
|
+
expected_search_text: semanticFactExpectedSearchText(fact),
|
|
74
|
+
semantic_cell: {
|
|
75
|
+
outcome_ref: fact.outcome_ref,
|
|
76
|
+
unit_ref: fact.unit_ref,
|
|
77
|
+
family_ref: fact.family_ref,
|
|
78
|
+
condition_ref: fact.condition_ref,
|
|
79
|
+
property_ref: fact.property_ref,
|
|
80
|
+
value_kind: fact.value_kind,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
for (const fact of designProjection.facts)
|
|
84
|
+
addSourceConservationFact(facts, {
|
|
85
|
+
...fact,
|
|
86
|
+
basis_refs: [
|
|
87
|
+
...new Set([
|
|
88
|
+
...fact.basis_refs,
|
|
89
|
+
...manifest.inputs
|
|
90
|
+
.filter((input) => input.kind === "source_fragment" &&
|
|
91
|
+
input.fact_refs.includes(fact.key))
|
|
92
|
+
.map((input) => input.key),
|
|
93
|
+
]),
|
|
94
|
+
],
|
|
95
|
+
semantic_class: "delivery_semantic",
|
|
96
|
+
authority_domain: "design",
|
|
97
|
+
semantic_cell: null,
|
|
98
|
+
});
|
|
99
|
+
return facts;
|
|
100
|
+
}
|
|
101
|
+
function designFactsBySource(designProjection) {
|
|
102
|
+
const result = new Map();
|
|
103
|
+
for (const fact of designProjection.facts)
|
|
104
|
+
for (const sourceRef of fact.source_item_refs) {
|
|
105
|
+
const refs = result.get(sourceRef) ?? [];
|
|
106
|
+
refs.push(fact.key);
|
|
107
|
+
result.set(sourceRef, refs);
|
|
108
|
+
}
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CompiledSourceItemV2, MaterialFragmentScanResultV2, MaterialSourceFragmentV2, MaterialTextInputV2, SourceAuthorityDomain } from "./long-task-source-authority-types.js";
|
|
2
|
+
export { deriveSemanticSourceAnchors, semanticSourceAnchorRef, } from "./long-task-source-anchors.js";
|
|
3
|
+
export declare function sourceAuthorityDomain(item: CompiledSourceItemV2, designOwned: boolean): SourceAuthorityDomain;
|
|
4
|
+
export declare function materialSourceFragmentRef(fragment: Pick<MaterialSourceFragmentV2, "input_key" | "ordinal" | "text_sha256">): string;
|
|
5
|
+
export declare function deriveMaterialSourceFragments(item: CompiledSourceItemV2, designOwned?: boolean): MaterialSourceFragmentV2[];
|
|
6
|
+
export declare function scanMaterialTextInput(input: MaterialTextInputV2): MaterialFragmentScanResultV2;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { sha256Hex } from "./strict-codec.js";
|
|
2
|
+
export { deriveSemanticSourceAnchors, semanticSourceAnchorRef, } from "./long-task-source-anchors.js";
|
|
3
|
+
const FENCE_START = /^\s*(`{3,}|~{3,})([^`]*)$/u;
|
|
4
|
+
const TABLE_ROW = /^\s*\|.*\|\s*$/u;
|
|
5
|
+
const TABLE_SEPARATOR = /^\s*\|?(?:\s*:?-{3,}:?\s*\|)+\s*:?-{3,}:?\s*\|?\s*$/u;
|
|
6
|
+
const MARKDOWN_SEPARATOR = /^\s{0,3}((?:-\s*){3,}|(?:\*\s*){3,}|(?:_\s*){3,})$/u;
|
|
7
|
+
const HEADING = /^\s{0,3}#{1,6}(?:\s+\S|\s*$)/u;
|
|
8
|
+
const BLOCKQUOTE = /^\s{0,3}>/u;
|
|
9
|
+
const TEXTUAL_HTML = /^\s*<(?:[A-Za-z][A-Za-z0-9:-]*(?:\s|>|\/)|!--)/u;
|
|
10
|
+
const GIVEN_WHEN_THEN = /^\s*(?:(?:[-*+] |\d+[.)] ))?(?:(?:Given|When|Then|And|But)\b|(?:假如|当|那么|并且|但是)(?=\s|[::]))/iu;
|
|
11
|
+
const LIST_ITEM = /^\s*(?:[-*+] |\d+[.)] )\S/u;
|
|
12
|
+
const STRUCTURED_CONFIG = /^\s*(?:(?:["']?[A-Za-z_][\w.-]*["']?)\s*[:=]\s*\S|--[a-z0-9][a-z0-9-]*(?:[ =]\S+)?|[A-Z][A-Z0-9_]*\s*=\s*\S)/u;
|
|
13
|
+
export function sourceAuthorityDomain(item, designOwned) {
|
|
14
|
+
if (designOwned)
|
|
15
|
+
return "design";
|
|
16
|
+
if (item.kind === "acceptance")
|
|
17
|
+
return "acceptance";
|
|
18
|
+
if (item.kind === "external_confirmation")
|
|
19
|
+
return "external";
|
|
20
|
+
if (["technical_obligation", "forbidden_shortcut", "risk_fact"].includes(item.kind))
|
|
21
|
+
return "technical";
|
|
22
|
+
return "product";
|
|
23
|
+
}
|
|
24
|
+
export function materialSourceFragmentRef(fragment) {
|
|
25
|
+
return `${fragment.input_key}#fragment:${fragment.ordinal}:${fragment.text_sha256.slice(0, 16)}`;
|
|
26
|
+
}
|
|
27
|
+
export function deriveMaterialSourceFragments(item, designOwned = false) {
|
|
28
|
+
return scanMaterialTextInput({
|
|
29
|
+
input_key: item.key,
|
|
30
|
+
input_kind: "source_item",
|
|
31
|
+
source_ref: item.source_path,
|
|
32
|
+
sha256: item.text_sha256,
|
|
33
|
+
authority_source_item_refs: [item.key],
|
|
34
|
+
authority_domain: sourceAuthorityDomain(item, designOwned),
|
|
35
|
+
normalized_text: item.normalized_text,
|
|
36
|
+
}).fragments;
|
|
37
|
+
}
|
|
38
|
+
export function scanMaterialTextInput(input) {
|
|
39
|
+
const lines = input.normalized_text.replace(/\r\n?/gu, "\n").split("\n");
|
|
40
|
+
const raw = [];
|
|
41
|
+
const excludedSeparatorLines = [];
|
|
42
|
+
let index = 0;
|
|
43
|
+
while (index < lines.length) {
|
|
44
|
+
if (!lines[index].trim()) {
|
|
45
|
+
index += 1;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (isSeparator(lines[index])) {
|
|
49
|
+
excludedSeparatorLines.push(index + 1);
|
|
50
|
+
index += 1;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const fence = FENCE_START.exec(lines[index]);
|
|
54
|
+
if (fence) {
|
|
55
|
+
const start = index;
|
|
56
|
+
const marker = fence[1][0];
|
|
57
|
+
const width = fence[1].length;
|
|
58
|
+
index += 1;
|
|
59
|
+
while (index < lines.length &&
|
|
60
|
+
!new RegExp(`^\\s*${escapeRegex(marker)}{${width},}\\s*$`, "u").test(lines[index]))
|
|
61
|
+
index += 1;
|
|
62
|
+
const end = Math.min(index, lines.length - 1);
|
|
63
|
+
raw.push({
|
|
64
|
+
kind: "fenced_code",
|
|
65
|
+
start,
|
|
66
|
+
end,
|
|
67
|
+
text: lines.slice(start, end + 1).join("\n"),
|
|
68
|
+
});
|
|
69
|
+
index = index < lines.length ? index + 1 : lines.length;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (HEADING.test(lines[index])) {
|
|
73
|
+
raw.push(singleLine("heading", index, lines[index]));
|
|
74
|
+
index += 1;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (BLOCKQUOTE.test(lines[index])) {
|
|
78
|
+
const start = index;
|
|
79
|
+
while (index < lines.length && BLOCKQUOTE.test(lines[index]))
|
|
80
|
+
index += 1;
|
|
81
|
+
raw.push({
|
|
82
|
+
kind: "blockquote",
|
|
83
|
+
start,
|
|
84
|
+
end: index - 1,
|
|
85
|
+
text: lines.slice(start, index).join("\n"),
|
|
86
|
+
});
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (TEXTUAL_HTML.test(lines[index])) {
|
|
90
|
+
const start = index;
|
|
91
|
+
index += 1;
|
|
92
|
+
while (index < lines.length &&
|
|
93
|
+
lines[index].trim() &&
|
|
94
|
+
!isSpecialLine(lines[index]))
|
|
95
|
+
index += 1;
|
|
96
|
+
raw.push({
|
|
97
|
+
kind: "textual_html",
|
|
98
|
+
start,
|
|
99
|
+
end: index - 1,
|
|
100
|
+
text: lines.slice(start, index).join("\n"),
|
|
101
|
+
});
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (TABLE_ROW.test(lines[index])) {
|
|
105
|
+
raw.push(singleLine("table_row", index, lines[index]));
|
|
106
|
+
index += 1;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (GIVEN_WHEN_THEN.test(lines[index])) {
|
|
110
|
+
raw.push(singleLine("given_when_then", index, lines[index]));
|
|
111
|
+
index += 1;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (LIST_ITEM.test(lines[index])) {
|
|
115
|
+
const start = index;
|
|
116
|
+
index += 1;
|
|
117
|
+
while (index < lines.length &&
|
|
118
|
+
lines[index].trim() &&
|
|
119
|
+
/^\s{2,}\S/u.test(lines[index]) &&
|
|
120
|
+
!isSpecialLine(lines[index]))
|
|
121
|
+
index += 1;
|
|
122
|
+
raw.push({
|
|
123
|
+
kind: "list_item",
|
|
124
|
+
start,
|
|
125
|
+
end: index - 1,
|
|
126
|
+
text: lines.slice(start, index).join("\n"),
|
|
127
|
+
});
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (STRUCTURED_CONFIG.test(lines[index])) {
|
|
131
|
+
raw.push(singleLine("structured_config_line", index, lines[index]));
|
|
132
|
+
index += 1;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const start = index;
|
|
136
|
+
index += 1;
|
|
137
|
+
while (index < lines.length &&
|
|
138
|
+
lines[index].trim() &&
|
|
139
|
+
!isSpecialLine(lines[index]))
|
|
140
|
+
index += 1;
|
|
141
|
+
raw.push({
|
|
142
|
+
kind: "paragraph",
|
|
143
|
+
start,
|
|
144
|
+
end: index - 1,
|
|
145
|
+
text: lines.slice(start, index).join("\n"),
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
const fragments = raw.map((entry, ordinalIndex) => {
|
|
149
|
+
const normalizedText = entry.text.trim();
|
|
150
|
+
const textSha256 = sha256Hex(normalizedText);
|
|
151
|
+
const base = {
|
|
152
|
+
input_key: input.input_key,
|
|
153
|
+
source_item_ref: input.authority_source_item_refs[0],
|
|
154
|
+
authority_source_item_refs: [...input.authority_source_item_refs],
|
|
155
|
+
source_path: input.source_ref,
|
|
156
|
+
authority_domain: input.authority_domain,
|
|
157
|
+
kind: entry.kind,
|
|
158
|
+
ordinal: ordinalIndex + 1,
|
|
159
|
+
start_line: entry.start + 1,
|
|
160
|
+
end_line: entry.end + 1,
|
|
161
|
+
normalized_text: normalizedText,
|
|
162
|
+
text_sha256: textSha256,
|
|
163
|
+
};
|
|
164
|
+
return { ...base, key: materialSourceFragmentRef(base) };
|
|
165
|
+
});
|
|
166
|
+
const materialNonblankLines = lines.flatMap((line, lineIndex) => line.trim() ? [lineIndex + 1] : []);
|
|
167
|
+
const coveredLines = fragments.flatMap((fragment) => {
|
|
168
|
+
const result = [];
|
|
169
|
+
for (let line = fragment.start_line; line <= fragment.end_line; line += 1)
|
|
170
|
+
if (lines[line - 1].trim())
|
|
171
|
+
result.push(line);
|
|
172
|
+
return result;
|
|
173
|
+
});
|
|
174
|
+
assertExactCoverage(input.input_key, materialNonblankLines, coveredLines, excludedSeparatorLines);
|
|
175
|
+
return {
|
|
176
|
+
fragments,
|
|
177
|
+
coverage: {
|
|
178
|
+
material_nonblank_lines: materialNonblankLines,
|
|
179
|
+
covered_lines: coveredLines,
|
|
180
|
+
excluded_separator_lines: excludedSeparatorLines,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function singleLine(kind, index, text) {
|
|
185
|
+
return { kind, start: index, end: index, text };
|
|
186
|
+
}
|
|
187
|
+
function isSeparator(line) {
|
|
188
|
+
return TABLE_SEPARATOR.test(line) || MARKDOWN_SEPARATOR.test(line);
|
|
189
|
+
}
|
|
190
|
+
function isSpecialLine(line) {
|
|
191
|
+
return (FENCE_START.test(line) ||
|
|
192
|
+
isSeparator(line) ||
|
|
193
|
+
HEADING.test(line) ||
|
|
194
|
+
BLOCKQUOTE.test(line) ||
|
|
195
|
+
TEXTUAL_HTML.test(line) ||
|
|
196
|
+
TABLE_ROW.test(line) ||
|
|
197
|
+
GIVEN_WHEN_THEN.test(line) ||
|
|
198
|
+
LIST_ITEM.test(line) ||
|
|
199
|
+
STRUCTURED_CONFIG.test(line));
|
|
200
|
+
}
|
|
201
|
+
function assertExactCoverage(inputKey, material, covered, excluded) {
|
|
202
|
+
const seen = new Set();
|
|
203
|
+
for (const line of [...covered, ...excluded]) {
|
|
204
|
+
if (seen.has(line))
|
|
205
|
+
throw new Error(`material_fragment_coverage_overlap:${inputKey}:${line}`);
|
|
206
|
+
seen.add(line);
|
|
207
|
+
}
|
|
208
|
+
if (material.length !== seen.size ||
|
|
209
|
+
material.some((line) => !seen.has(line)) ||
|
|
210
|
+
[...seen].some((line) => !material.includes(line)))
|
|
211
|
+
throw new Error(`material_fragment_coverage_mismatch:${inputKey}:${material.join(",")}:${[
|
|
212
|
+
...seen,
|
|
213
|
+
]
|
|
214
|
+
.sort((left, right) => left - right)
|
|
215
|
+
.join(",")}`);
|
|
216
|
+
}
|
|
217
|
+
function escapeRegex(value) {
|
|
218
|
+
return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
219
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CompiledSourceItemV2, MaterialSourceFragmentV2 } from "./long-task-source-authority-types.js";
|
|
2
|
+
import type { SemanticFactManifestV1 } from "./semantic-fact-types.js";
|
|
3
|
+
import type { ResolvedSourceProjectionV2 } from "./long-task-source-conservation-types.js";
|
|
4
|
+
export declare function resolveFragmentProjection(fragment: MaterialSourceFragmentV2, manifest: SemanticFactManifestV1): ResolvedSourceProjectionV2;
|
|
5
|
+
export declare function isCanonicalSourceIntegrityStatement(item: CompiledSourceItemV2 | undefined): boolean;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { semanticFactClosureInvalid } from "./long-task-semantic-fact-closure-primitives.js";
|
|
2
|
+
import { canonicalValueJson } from "./strict-codec.js";
|
|
3
|
+
export function resolveFragmentProjection(fragment, manifest) {
|
|
4
|
+
const explicit = manifest.inputs.filter((input) => input.kind === "source_fragment" && input.source_ref === fragment.key);
|
|
5
|
+
if (explicit.length > 1)
|
|
6
|
+
semanticFactClosureInvalid("source_fragment_disposition_duplicate", fragment.key);
|
|
7
|
+
if (explicit.length !== 1)
|
|
8
|
+
semanticFactClosureInvalid("source_fragment_disposition_missing", fragment.key);
|
|
9
|
+
const input = explicit[0];
|
|
10
|
+
if (input.sha256 !== fragment.text_sha256)
|
|
11
|
+
semanticFactClosureInvalid("source_fragment_digest_mismatch", `${input.key}:${fragment.key}`);
|
|
12
|
+
return {
|
|
13
|
+
input_key: input.key,
|
|
14
|
+
disposition: input.disposition,
|
|
15
|
+
fact_refs: input.fact_refs,
|
|
16
|
+
basis_refs: input.basis_refs,
|
|
17
|
+
...(input.supporting_relation
|
|
18
|
+
? { supporting_relation: input.supporting_relation }
|
|
19
|
+
: {}),
|
|
20
|
+
explicit: true,
|
|
21
|
+
authority_derived: false,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function isCanonicalSourceIntegrityStatement(item) {
|
|
25
|
+
const prefix = "Execution target authority: ";
|
|
26
|
+
if (item?.kind !== "technical_obligation" ||
|
|
27
|
+
!item.normalized_text.startsWith(`${prefix}{`) ||
|
|
28
|
+
!item.normalized_text.endsWith("}."))
|
|
29
|
+
return false;
|
|
30
|
+
const encoded = item.normalized_text.slice(prefix.length, -1);
|
|
31
|
+
try {
|
|
32
|
+
const value = JSON.parse(encoded);
|
|
33
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
34
|
+
return false;
|
|
35
|
+
const record = value;
|
|
36
|
+
if (!sameStrings(Object.keys(record).sort(), [
|
|
37
|
+
"capabilities",
|
|
38
|
+
"key",
|
|
39
|
+
"role",
|
|
40
|
+
"root_argv",
|
|
41
|
+
"root_entrypoint",
|
|
42
|
+
"runtime_family",
|
|
43
|
+
]) ||
|
|
44
|
+
!["key", "role", "root_entrypoint", "runtime_family"].every((key) => typeof record[key] === "string" && record[key].length > 0) ||
|
|
45
|
+
!["capabilities", "root_argv"].every((key) => Array.isArray(record[key]) &&
|
|
46
|
+
record[key].every((entry) => typeof entry === "string")))
|
|
47
|
+
return false;
|
|
48
|
+
return canonicalValueJson(record) === encoded;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function sameStrings(left, right) {
|
|
55
|
+
return (left.length === right.length &&
|
|
56
|
+
left.every((value, index) => value === right[index]));
|
|
57
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CompiledSourceItemV2, MaterialSourceFragmentV2, SemanticFactClassV2, SemanticSourceAnchorV2, SourceAuthorityDomain } from "./long-task-source-authority-types.js";
|
|
2
|
+
import type { SemanticFactManifestV1 } from "./semantic-fact-types.js";
|
|
3
|
+
import type { ResolvedSourceProjectionV2, SourceConservationFactProjectionV2 } from "./long-task-source-conservation-types.js";
|
|
4
|
+
interface SourceProjectionValidationContextV2 {
|
|
5
|
+
facts: Map<string, SourceConservationFactProjectionV2>;
|
|
6
|
+
factClasses: Record<string, SemanticFactClassV2>;
|
|
7
|
+
factDomains: Record<string, SourceAuthorityDomain>;
|
|
8
|
+
sourceDomains: ReadonlyMap<string, SourceAuthorityDomain>;
|
|
9
|
+
sourceByKey: ReadonlyMap<string, CompiledSourceItemV2>;
|
|
10
|
+
manifest: SemanticFactManifestV1;
|
|
11
|
+
designFactRefsBySource: ReadonlyMap<string, string[]>;
|
|
12
|
+
factClaimPolarities: ReadonlyMap<string, ReadonlySet<"positive" | "negative">>;
|
|
13
|
+
}
|
|
14
|
+
export declare function validateAnchorProjection(anchor: SemanticSourceAnchorV2, fragmentProjection: ResolvedSourceProjectionV2, context: SourceProjectionValidationContextV2): void;
|
|
15
|
+
export declare function validateProjection(projection: ResolvedSourceProjectionV2, material: MaterialSourceFragmentV2 | SemanticSourceAnchorV2, context: SourceProjectionValidationContextV2): void;
|
|
16
|
+
export declare function validateNoDanglingProjectionInputs(fragments: MaterialSourceFragmentV2[], anchors: SemanticSourceAnchorV2[], manifest: SemanticFactManifestV1): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { semanticFactClosureInvalid } from "./long-task-semantic-fact-closure-primitives.js";
|
|
2
|
+
import { semanticExpectedContains } from "./long-task-source-conservation-facts.js";
|
|
3
|
+
import { semanticModalOccurrences, semanticModalPolarity, } from "./long-task-source-anchors.js";
|
|
4
|
+
import { isCanonicalSourceIntegrityStatement } from "./long-task-source-projection-resolution.js";
|
|
5
|
+
import { validateSameDomainScopeExclusion, validateSameDomainSupersession, } from "./long-task-source-supersession.js";
|
|
6
|
+
export function validateAnchorProjection(anchor, fragmentProjection, context) {
|
|
7
|
+
const explicit = context.manifest.inputs.filter((input) => input.kind === "semantic_anchor" && input.source_ref === anchor.key);
|
|
8
|
+
if (explicit.length > 1)
|
|
9
|
+
semanticFactClosureInvalid("semantic_anchor_disposition_duplicate", anchor.key);
|
|
10
|
+
const projection = explicit.length
|
|
11
|
+
? explicitAnchorProjection(anchor, explicit[0])
|
|
12
|
+
: fragmentProjection;
|
|
13
|
+
validateProjection(projection, anchor, context);
|
|
14
|
+
validateAnchorDisposition(anchor, projection, context);
|
|
15
|
+
}
|
|
16
|
+
function explicitAnchorProjection(anchor, input) {
|
|
17
|
+
if (input.sha256 !== anchor.value_sha256)
|
|
18
|
+
semanticFactClosureInvalid("semantic_anchor_digest_mismatch", `${input.key}:${anchor.key}`);
|
|
19
|
+
return {
|
|
20
|
+
input_key: input.key,
|
|
21
|
+
disposition: input.disposition,
|
|
22
|
+
fact_refs: input.fact_refs,
|
|
23
|
+
basis_refs: input.basis_refs,
|
|
24
|
+
...(input.supporting_relation
|
|
25
|
+
? { supporting_relation: input.supporting_relation }
|
|
26
|
+
: {}),
|
|
27
|
+
explicit: true,
|
|
28
|
+
authority_derived: false,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function validateAnchorDisposition(anchor, projection, context) {
|
|
32
|
+
const canonicalSourceIntegrity = isCanonicalSourceIntegrityStatement(context.sourceByKey.get(anchor.source_item_ref));
|
|
33
|
+
if (projection.disposition === "supporting_basis" &&
|
|
34
|
+
!canonicalSourceIntegrity)
|
|
35
|
+
semanticFactClosureInvalid("semantic_anchor_supporting_only_forbidden", anchor.key);
|
|
36
|
+
if (projection.disposition === "fact_bearing" && anchor.kind === "modal_term")
|
|
37
|
+
validateModalProjection(anchor, projection, context);
|
|
38
|
+
else if (projection.disposition === "fact_bearing" &&
|
|
39
|
+
!projection.fact_refs.some((factRef) => semanticExpectedContains(context.facts.get(factRef), anchor.value)))
|
|
40
|
+
semanticFactClosureInvalid("semantic_anchor_expected_projection_missing", `${anchor.key}:${anchor.value}`);
|
|
41
|
+
}
|
|
42
|
+
export function validateProjection(projection, material, context) {
|
|
43
|
+
if (projection.disposition === "decision_required")
|
|
44
|
+
semanticFactClosureInvalid("source_projection_decision_required", material.key);
|
|
45
|
+
if (projection.disposition === "fact_bearing")
|
|
46
|
+
validateFactBearingProjection(projection, material, context);
|
|
47
|
+
if (projection.disposition === "supporting_basis")
|
|
48
|
+
validateSupportingProjection(projection, material, context);
|
|
49
|
+
if (projection.disposition === "superseded")
|
|
50
|
+
validateSameDomainSupersession(projection, material, context.facts, context.factClasses, context.factDomains, context.sourceDomains, context.sourceByKey, context.manifest);
|
|
51
|
+
if (projection.disposition === "scope_excluded")
|
|
52
|
+
validateSameDomainScopeExclusion(projection, material, context.sourceDomains, context.sourceByKey, context.manifest);
|
|
53
|
+
if ("input_key" in material && projection.disposition === "fact_bearing")
|
|
54
|
+
validateCompoundModalProjection(projection, material, context);
|
|
55
|
+
}
|
|
56
|
+
function validateFactBearingProjection(projection, material, context) {
|
|
57
|
+
if (!projection.fact_refs.length)
|
|
58
|
+
semanticFactClosureInvalid("source_projection_fact_required", material.key);
|
|
59
|
+
for (const factRef of projection.fact_refs) {
|
|
60
|
+
const fact = context.facts.get(factRef);
|
|
61
|
+
if (!fact)
|
|
62
|
+
semanticFactClosureInvalid("source_projection_fact_unknown", `${material.key}:${factRef}`);
|
|
63
|
+
if (context.factClasses[factRef] !== "delivery_semantic")
|
|
64
|
+
semanticFactClosureInvalid("source_integrity_fact_cannot_cover_semantics", `${material.key}:${factRef}`);
|
|
65
|
+
if (!materialAuthoritySourceRefs(material).some((ref) => fact.source_item_refs.includes(ref)))
|
|
66
|
+
semanticFactClosureInvalid("source_projection_fact_lineage_mismatch", `${material.key}:${factRef}`);
|
|
67
|
+
if (context.factDomains[factRef] !== material.authority_domain)
|
|
68
|
+
semanticFactClosureInvalid("source_projection_fact_domain_mismatch", `${material.key}:${factRef}:${material.authority_domain}:${context.factDomains[factRef]}`);
|
|
69
|
+
validateFactFragmentProvenance(fact, projection, material, context);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function validateSupportingProjection(projection, material, context) {
|
|
73
|
+
const canonicalSourceIntegrity = isCanonicalSourceIntegrityStatement(context.sourceByKey.get(material.source_item_ref));
|
|
74
|
+
if (!projection.fact_refs.length)
|
|
75
|
+
semanticFactClosureInvalid("source_supporting_basis_fact_required", material.key);
|
|
76
|
+
for (const factRef of projection.fact_refs) {
|
|
77
|
+
const fact = context.facts.get(factRef);
|
|
78
|
+
if (!fact)
|
|
79
|
+
semanticFactClosureInvalid("source_supporting_basis_fact_unknown", `${material.key}:${factRef}`);
|
|
80
|
+
if (context.factClasses[factRef] !== "delivery_semantic")
|
|
81
|
+
semanticFactClosureInvalid("source_supporting_basis_delivery_fact_required", `${material.key}:${factRef}`);
|
|
82
|
+
if (!canonicalSourceIntegrity &&
|
|
83
|
+
!materialAuthoritySourceRefs(material).some((ref) => fact.source_item_refs.includes(ref)))
|
|
84
|
+
semanticFactClosureInvalid("source_supporting_basis_fact_lineage_mismatch", `${material.key}:${factRef}`);
|
|
85
|
+
if (!canonicalSourceIntegrity &&
|
|
86
|
+
context.factDomains[factRef] !== material.authority_domain)
|
|
87
|
+
semanticFactClosureInvalid("source_supporting_basis_fact_domain_mismatch", `${material.key}:${factRef}:${material.authority_domain}:${context.factDomains[factRef]}`);
|
|
88
|
+
validateFactFragmentProvenance(fact, projection, material, context);
|
|
89
|
+
}
|
|
90
|
+
if ("input_key" in material && !canonicalSourceIntegrity)
|
|
91
|
+
validateTypedSupportingRelation(projection, material, context);
|
|
92
|
+
}
|
|
93
|
+
function validateTypedSupportingRelation(projection, material, context) {
|
|
94
|
+
const relation = projection.supporting_relation;
|
|
95
|
+
if (!relation)
|
|
96
|
+
semanticFactClosureInvalid("source_supporting_basis_typed_relation_required", material.key);
|
|
97
|
+
const materialInput = context.manifest.inputs.find((input) => input.key === material.input_key ||
|
|
98
|
+
(input.kind === "source_item" && input.source_ref === material.input_key));
|
|
99
|
+
if (materialInput?.disposition !== "supporting_only")
|
|
100
|
+
semanticFactClosureInvalid("source_supporting_basis_material_disposition_required", `${material.key}:${materialInput?.key ?? material.input_key}`);
|
|
101
|
+
if (projection.fact_refs.length !== 1 ||
|
|
102
|
+
projection.fact_refs[0] !== relation.fact_ref)
|
|
103
|
+
semanticFactClosureInvalid("source_supporting_basis_relation_fact_mismatch", `${material.key}:${relation.fact_ref}:${projection.fact_refs.join(",")}`);
|
|
104
|
+
const cell = context.manifest.fact_cells.find((candidate) => candidate.key === relation.fact_cell_ref);
|
|
105
|
+
if (!cell)
|
|
106
|
+
semanticFactClosureInvalid("source_supporting_basis_relation_cell_unknown", `${material.key}:${relation.fact_cell_ref}`);
|
|
107
|
+
if (cell.disposition !== "specified" || cell.fact_ref !== relation.fact_ref)
|
|
108
|
+
semanticFactClosureInvalid("source_supporting_basis_relation_cell_mismatch", `${material.key}:${relation.fact_cell_ref}:${cell.fact_ref ?? "none"}:${relation.fact_ref}`);
|
|
109
|
+
}
|
|
110
|
+
function validateFactFragmentProvenance(fact, projection, material, context) {
|
|
111
|
+
const fragmentInputKey = owningFragmentInputKey(projection, material, context.manifest);
|
|
112
|
+
if (!fact.basis_refs.includes(fragmentInputKey))
|
|
113
|
+
semanticFactClosureInvalid("source_projection_fact_fragment_provenance_missing", `${material.key}:${fact.key}:${fragmentInputKey}`);
|
|
114
|
+
}
|
|
115
|
+
function owningFragmentInputKey(projection, material, manifest) {
|
|
116
|
+
if ("input_key" in material)
|
|
117
|
+
return projection.input_key;
|
|
118
|
+
const input = manifest.inputs.find((candidate) => candidate.kind === "source_fragment" &&
|
|
119
|
+
candidate.source_ref === material.fragment_ref);
|
|
120
|
+
if (!input)
|
|
121
|
+
semanticFactClosureInvalid("semantic_anchor_fragment_projection_missing", material.key);
|
|
122
|
+
return input.key;
|
|
123
|
+
}
|
|
124
|
+
function materialAuthoritySourceRefs(material) {
|
|
125
|
+
return material.authority_source_item_refs;
|
|
126
|
+
}
|
|
127
|
+
function validateModalProjection(anchor, projection, context) {
|
|
128
|
+
const polarity = semanticModalPolarity(anchor.value);
|
|
129
|
+
if (!polarity)
|
|
130
|
+
semanticFactClosureInvalid("semantic_modal_classification_missing", `${anchor.key}:${anchor.value}`);
|
|
131
|
+
if (!projection.fact_refs.some((factRef) => (context.factClaimPolarities.get(factRef) ?? new Set(["positive"])).has(polarity)))
|
|
132
|
+
semanticFactClosureInvalid("semantic_modal_claim_polarity_mismatch", `${anchor.key}:${polarity}`);
|
|
133
|
+
}
|
|
134
|
+
function validateCompoundModalProjection(projection, fragment, context) {
|
|
135
|
+
const occurrences = semanticModalOccurrences(fragment.normalized_text);
|
|
136
|
+
if (occurrences.length <= 1)
|
|
137
|
+
return;
|
|
138
|
+
const facts = projection.fact_refs
|
|
139
|
+
.map((factRef) => context.facts.get(factRef))
|
|
140
|
+
.filter((fact) => Boolean(fact));
|
|
141
|
+
const composite = facts.some((fact) => ["object", "schema", "relation", "decision_table", "formula"].includes(fact.semantic_cell?.value_kind ?? ""));
|
|
142
|
+
if (!composite && new Set(projection.fact_refs).size < occurrences.length)
|
|
143
|
+
semanticFactClosureInvalid("source_fragment_modal_fact_split_required", `${fragment.key}:${occurrences.length}:${projection.fact_refs.length}`);
|
|
144
|
+
}
|
|
145
|
+
export function validateNoDanglingProjectionInputs(fragments, anchors, manifest) {
|
|
146
|
+
const fragmentRefs = new Set(fragments.map((item) => item.key));
|
|
147
|
+
const anchorRefs = new Set(anchors.map((item) => item.key));
|
|
148
|
+
for (const input of manifest.inputs) {
|
|
149
|
+
if (input.kind === "source_fragment" && !fragmentRefs.has(input.source_ref))
|
|
150
|
+
semanticFactClosureInvalid("source_fragment_projection_dangling", `${input.key}:${input.source_ref}`);
|
|
151
|
+
if (input.kind === "semantic_anchor" && !anchorRefs.has(input.source_ref))
|
|
152
|
+
semanticFactClosureInvalid("semantic_anchor_projection_dangling", `${input.key}:${input.source_ref}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -2,12 +2,7 @@ import { array, fail, key, literal, object, repositorySourceRef, string, strings
|
|
|
2
2
|
export function parseSourceClaims(value, label) {
|
|
3
3
|
return array(value, label).map((item, index) => {
|
|
4
4
|
const itemLabel = `${label}[${index}]`;
|
|
5
|
-
const row = object(item, itemLabel, [
|
|
6
|
-
"key",
|
|
7
|
-
"source_ref",
|
|
8
|
-
"statement",
|
|
9
|
-
"disposition",
|
|
10
|
-
]);
|
|
5
|
+
const row = object(item, itemLabel, ["key", "source_ref", "statement", "disposition"], ["judgment_basis"]);
|
|
11
6
|
const disposition = object(row.disposition, `${itemLabel}.disposition`, ["type"], ["refs", "ref", "reason"]);
|
|
12
7
|
const type = literal(disposition.type, [
|
|
13
8
|
"claim",
|
|
@@ -45,9 +40,22 @@ export function parseSourceClaims(value, label) {
|
|
|
45
40
|
type,
|
|
46
41
|
refs: strings(disposition.refs, `${itemLabel}.disposition.refs`),
|
|
47
42
|
},
|
|
43
|
+
...(Object.hasOwn(row, "judgment_basis")
|
|
44
|
+
? {
|
|
45
|
+
judgment_basis: parseSourceClaimJudgmentBasis(row.judgment_basis, `${itemLabel}.judgment_basis`),
|
|
46
|
+
}
|
|
47
|
+
: {}),
|
|
48
48
|
};
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
+
function parseSourceClaimJudgmentBasis(value, label) {
|
|
52
|
+
const row = object(value, label, ["kind", "claim_ref", "applicability_refs"]);
|
|
53
|
+
return {
|
|
54
|
+
kind: literal(row.kind, ["subjective_preference", "expert_assessment", "authorization"], `${label}.kind`),
|
|
55
|
+
claim_ref: string(row.claim_ref, `${label}.claim_ref`),
|
|
56
|
+
applicability_refs: strings(row.applicability_refs, `${label}.applicability_refs`),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
51
59
|
function acceptanceRefs(value, label) {
|
|
52
60
|
const refs = strings(value, label);
|
|
53
61
|
if (refs.length !== 1)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CompiledSourceItemV2, MaterialSourceFragmentV2, SemanticFactClassV2, SemanticSourceAnchorV2, SourceAuthorityDomain } from "./long-task-source-authority-types.js";
|
|
2
|
+
import type { SemanticFactManifestV1 } from "./semantic-fact-types.js";
|
|
3
|
+
import type { ResolvedSourceProjectionV2, SourceConservationFactProjectionV2 } from "./long-task-source-conservation-types.js";
|
|
4
|
+
export declare function validateSameDomainSupersession(projection: ResolvedSourceProjectionV2, material: MaterialSourceFragmentV2 | SemanticSourceAnchorV2, facts: ReadonlyMap<string, SourceConservationFactProjectionV2>, factClasses: Record<string, SemanticFactClassV2>, factDomains: Record<string, SourceAuthorityDomain>, sourceDomains: ReadonlyMap<string, SourceAuthorityDomain>, sourceByKey: ReadonlyMap<string, CompiledSourceItemV2>, manifest: SemanticFactManifestV1): void;
|
|
5
|
+
export declare function validateSameDomainScopeExclusion(projection: ResolvedSourceProjectionV2, material: MaterialSourceFragmentV2 | SemanticSourceAnchorV2, sourceDomains: ReadonlyMap<string, SourceAuthorityDomain>, sourceByKey: ReadonlyMap<string, CompiledSourceItemV2>, manifest: SemanticFactManifestV1): void;
|