project-tiny-context-harness 0.8.11 → 0.8.13
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/LICENSE +21 -21
- package/README.md +514 -472
- package/assets/README.md +803 -749
- package/assets/README.zh-CN.md +468 -431
- package/assets/agents/.gitkeep +1 -1
- package/assets/agents/AGENTS_CORE.md +22 -24
- package/assets/agents/long-task-implementation.toml +15 -0
- package/assets/context_templates/architecture.md +18 -18
- package/assets/context_templates/area.md +30 -30
- package/assets/context_templates/context.toml +24 -24
- package/assets/context_templates/deployment.md +35 -35
- package/assets/context_templates/global.md +56 -56
- package/assets/context_templates/product-surface-contract.md +70 -70
- package/assets/context_templates/screen-contract.md +189 -189
- package/assets/context_templates/verification.md +25 -25
- package/assets/github/.gitkeep +1 -1
- package/assets/github/harness.yml +39 -39
- package/assets/make/.gitkeep +1 -1
- package/assets/make/ty-context.mk +48 -48
- package/assets/skills/context_development_engineer/SKILL.md +72 -185
- package/assets/skills/context_full_project_export/SKILL.md +28 -28
- package/assets/skills/context_harness_upgrade/SKILL.md +60 -60
- package/assets/skills/context_product_plan/SKILL.md +35 -101
- package/assets/skills/context_surface_contract/SKILL.md +194 -191
- package/assets/skills/context_uiux_design/SKILL.md +49 -172
- package/assets/skills/design-resource-authoring/SKILL.md +54 -88
- package/assets/skills/design-resource-authoring/references/downstream-handoff.md +51 -163
- package/assets/skills/design-resource-authoring/references/formal-selected-web-app-handoff.md +96 -0
- package/assets/skills/design-resource-authoring/references/open-design-provider.md +140 -120
- package/assets/skills/design-resource-authoring/references/recovery-and-writeback.md +199 -0
- package/assets/skills/design-resource-authoring/references/resource-selection.md +158 -181
- package/assets/skills/design-system-authoring/SKILL.md +57 -57
- package/assets/skills/design-system-authoring/agents/openai.yaml +6 -6
- package/assets/skills/design-system-authoring/references/authority-adoption.md +48 -48
- package/assets/skills/design-system-authoring/references/open-design-design-system-provider.md +110 -110
- package/assets/skills/long-task-workflow/SKILL.md +71 -106
- package/assets/skills/long-task-workflow/agents/openai.yaml +1 -1
- package/assets/skills/long-task-workflow/references/authority-lifecycle.md +71 -69
- package/assets/skills/long-task-workflow/references/contract-authoring.md +110 -101
- package/assets/skills/long-task-workflow/references/evidence-design.md +99 -78
- package/assets/skills/long-task-workflow/references/source-authoring.md +90 -90
- package/assets/tools/validate_context.py +442 -442
- package/dist/commands/design-resource-recovery.d.ts +1 -0
- package/dist/commands/design-resource-recovery.js +152 -0
- package/dist/commands/design-resource.js +29 -3
- package/dist/commands/enable.js +2 -0
- package/dist/commands/index.js +2 -2
- package/dist/commands/long-task-revision.js +8 -7
- package/dist/commands/sync.js +2 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -0
- package/dist/lib/compact-authoring-support.d.ts +22 -0
- package/dist/lib/compact-authoring-support.js +143 -0
- package/dist/lib/compact-shared-structure-authoring.d.ts +5 -0
- package/dist/lib/compact-shared-structure-authoring.js +9 -0
- package/dist/lib/compact-shared-structure-types.d.ts +61 -0
- package/dist/lib/compact-shared-structure-types.js +1 -0
- package/dist/lib/compact-shared-structure-validation.d.ts +2 -0
- package/dist/lib/compact-shared-structure-validation.js +159 -0
- package/dist/lib/compact-shared-structures.d.ts +3 -0
- package/dist/lib/compact-shared-structures.js +204 -0
- package/dist/lib/design-resource-fact-enums.d.ts +4 -0
- package/dist/lib/design-resource-fact-enums.js +12 -0
- package/dist/lib/design-resource-fact-manifest-shape-evidence.js +2 -2
- package/dist/lib/design-resource-fact-policy.d.ts +2 -2
- package/dist/lib/design-resource-fact-types.d.ts +2 -2
- package/dist/lib/design-resource-handoff-bundle-draft.js +4 -2
- package/dist/lib/design-resource-handoff-input-types.d.ts +3 -0
- package/dist/lib/design-resource-handoff-parser.d.ts +2 -2
- package/dist/lib/design-resource-handoff-parser.js +2 -2
- package/dist/lib/design-resource-handoff-shape.d.ts +2 -0
- package/dist/lib/design-resource-handoff-shape.js +10 -0
- package/dist/lib/design-resource-handoff-snapshot.js +4 -0
- package/dist/lib/design-resource-handoff-validation.d.ts +4 -1
- package/dist/lib/design-resource-handoff-validation.js +11 -0
- package/dist/lib/design-resource-handoff-web-dependency-validation.d.ts +4 -2
- package/dist/lib/design-resource-reconciliation-codec.d.ts +2 -0
- package/dist/lib/design-resource-reconciliation-codec.js +174 -0
- package/dist/lib/design-resource-reconciliation-types.d.ts +62 -0
- package/dist/lib/design-resource-reconciliation-types.js +1 -0
- package/dist/lib/design-resource-reconciliation.d.ts +3 -0
- package/dist/lib/design-resource-reconciliation.js +224 -0
- package/dist/lib/design-resource-recovery-authority-policy.d.ts +8 -0
- package/dist/lib/design-resource-recovery-authority-policy.js +123 -0
- package/dist/lib/design-resource-recovery-catalog-resources.d.ts +6 -0
- package/dist/lib/design-resource-recovery-catalog-resources.js +121 -0
- package/dist/lib/design-resource-recovery-catalog-shape.d.ts +3 -0
- package/dist/lib/design-resource-recovery-catalog-shape.js +104 -0
- package/dist/lib/design-resource-recovery-catalog.d.ts +9 -0
- package/dist/lib/design-resource-recovery-catalog.js +103 -0
- package/dist/lib/design-resource-recovery-cleanup.d.ts +2 -0
- package/dist/lib/design-resource-recovery-cleanup.js +11 -0
- package/dist/lib/design-resource-recovery-codec-primitives.d.ts +19 -0
- package/dist/lib/design-resource-recovery-codec-primitives.js +92 -0
- package/dist/lib/design-resource-recovery-codec.d.ts +4 -0
- package/dist/lib/design-resource-recovery-codec.js +93 -0
- package/dist/lib/design-resource-recovery-current.d.ts +9 -0
- package/dist/lib/design-resource-recovery-current.js +41 -0
- package/dist/lib/design-resource-recovery-delta-policy.d.ts +5 -0
- package/dist/lib/design-resource-recovery-delta-policy.js +108 -0
- package/dist/lib/design-resource-recovery-files.d.ts +37 -0
- package/dist/lib/design-resource-recovery-files.js +204 -0
- package/dist/lib/design-resource-recovery-final-disposition-shape.d.ts +2 -0
- package/dist/lib/design-resource-recovery-final-disposition-shape.js +47 -0
- package/dist/lib/design-resource-recovery-patch-types.d.ts +54 -0
- package/dist/lib/design-resource-recovery-patch-types.js +1 -0
- package/dist/lib/design-resource-recovery-replay.d.ts +7 -0
- package/dist/lib/design-resource-recovery-replay.js +112 -0
- package/dist/lib/design-resource-recovery-repository-bindings.d.ts +9 -0
- package/dist/lib/design-resource-recovery-repository-bindings.js +49 -0
- package/dist/lib/design-resource-recovery-schema.d.ts +5 -0
- package/dist/lib/design-resource-recovery-schema.js +5 -0
- package/dist/lib/design-resource-recovery-shape.d.ts +10 -0
- package/dist/lib/design-resource-recovery-shape.js +184 -0
- package/dist/lib/design-resource-recovery-source-authority.d.ts +5 -0
- package/dist/lib/design-resource-recovery-source-authority.js +219 -0
- package/dist/lib/design-resource-recovery-text.d.ts +17 -0
- package/dist/lib/design-resource-recovery-text.js +186 -0
- package/dist/lib/design-resource-recovery-types.d.ts +197 -0
- package/dist/lib/design-resource-recovery-types.js +1 -0
- package/dist/lib/design-resource-recovery-writeback-policy.d.ts +5 -0
- package/dist/lib/design-resource-recovery-writeback-policy.js +326 -0
- package/dist/lib/design-resource-recovery-writeback-shape.d.ts +6 -0
- package/dist/lib/design-resource-recovery-writeback-shape.js +155 -0
- package/dist/lib/design-resource-recovery.d.ts +44 -0
- package/dist/lib/design-resource-recovery.js +216 -0
- package/dist/lib/design-resource-symbolic-applicability-authority.d.ts +7 -0
- package/dist/lib/design-resource-symbolic-applicability-authority.js +19 -0
- package/dist/lib/design-resource-symbolic-applicability-policy.d.ts +12 -0
- package/dist/lib/design-resource-symbolic-applicability-policy.js +79 -0
- package/dist/lib/design-resource-symbolic-applicability-profiles.d.ts +8 -0
- package/dist/lib/design-resource-symbolic-applicability-profiles.js +55 -0
- package/dist/lib/design-resource-symbolic-applicability-shape.d.ts +2 -0
- package/dist/lib/design-resource-symbolic-applicability-shape.js +76 -0
- package/dist/lib/design-resource-symbolic-applicability-validation.d.ts +7 -0
- package/dist/lib/design-resource-symbolic-applicability-validation.js +128 -0
- package/dist/lib/design-resource-symbolic-compilation.d.ts +3 -0
- package/dist/lib/design-resource-symbolic-compilation.js +13 -0
- package/dist/lib/design-resource-symbolic-denotation.d.ts +3 -0
- package/dist/lib/design-resource-symbolic-denotation.js +167 -0
- package/dist/lib/design-resource-symbolic-disposition-validation.d.ts +4 -0
- package/dist/lib/design-resource-symbolic-disposition-validation.js +28 -0
- package/dist/lib/design-resource-symbolic-fact-policy.d.ts +12 -0
- package/dist/lib/design-resource-symbolic-fact-policy.js +12 -0
- package/dist/lib/design-resource-symbolic-fact-shape.d.ts +3 -0
- package/dist/lib/design-resource-symbolic-fact-shape.js +138 -0
- package/dist/lib/design-resource-symbolic-fact-types.d.ts +213 -0
- package/dist/lib/design-resource-symbolic-fact-types.js +1 -0
- package/dist/lib/design-resource-symbolic-fact-validation.d.ts +3 -0
- package/dist/lib/design-resource-symbolic-fact-validation.js +86 -0
- package/dist/lib/design-resource-symbolic-indexes.d.ts +23 -0
- package/dist/lib/design-resource-symbolic-indexes.js +54 -0
- package/dist/lib/design-resource-symbolic-manifest-shape.d.ts +3 -0
- package/dist/lib/design-resource-symbolic-manifest-shape.js +155 -0
- package/dist/lib/design-resource-symbolic-manifest-validation.d.ts +6 -0
- package/dist/lib/design-resource-symbolic-manifest-validation.js +132 -0
- package/dist/lib/design-resource-symbolic-noninterference-artifact.d.ts +33 -0
- package/dist/lib/design-resource-symbolic-noninterference-artifact.js +110 -0
- package/dist/lib/design-resource-symbolic-noninterference-equivalence.d.ts +3 -0
- package/dist/lib/design-resource-symbolic-noninterference-equivalence.js +77 -0
- package/dist/lib/design-resource-symbolic-noninterference-recompute.d.ts +4 -0
- package/dist/lib/design-resource-symbolic-noninterference-recompute.js +146 -0
- package/dist/lib/design-resource-symbolic-noninterference-scope.d.ts +7 -0
- package/dist/lib/design-resource-symbolic-noninterference-scope.js +49 -0
- package/dist/lib/design-resource-symbolic-noninterference-shape.d.ts +2 -0
- package/dist/lib/design-resource-symbolic-noninterference-shape.js +152 -0
- package/dist/lib/design-resource-symbolic-noninterference-types.d.ts +103 -0
- package/dist/lib/design-resource-symbolic-noninterference-types.js +1 -0
- package/dist/lib/design-resource-symbolic-noninterference-validation.d.ts +5 -0
- package/dist/lib/design-resource-symbolic-noninterference-validation.js +62 -0
- package/dist/lib/design-resource-symbolic-oracle-fingerprint.d.ts +1 -0
- package/dist/lib/design-resource-symbolic-oracle-fingerprint.js +47 -0
- package/dist/lib/design-resource-symbolic-predicate-shape.d.ts +6 -0
- package/dist/lib/design-resource-symbolic-predicate-shape.js +123 -0
- package/dist/lib/design-resource-symbolic-production-closure.d.ts +4 -0
- package/dist/lib/design-resource-symbolic-production-closure.js +144 -0
- package/dist/lib/design-resource-symbolic-proof-authority-validation.d.ts +10 -0
- package/dist/lib/design-resource-symbolic-proof-authority-validation.js +68 -0
- package/dist/lib/design-resource-symbolic-proof-validation.d.ts +10 -0
- package/dist/lib/design-resource-symbolic-proof-validation.js +89 -0
- package/dist/lib/design-resource-symbolic-region-validation.d.ts +19 -0
- package/dist/lib/design-resource-symbolic-region-validation.js +146 -0
- package/dist/lib/design-resource-symbolic-resource-validation.d.ts +5 -0
- package/dist/lib/design-resource-symbolic-resource-validation.js +90 -0
- package/dist/lib/design-resource-symbolic-rule-shape.d.ts +27 -0
- package/dist/lib/design-resource-symbolic-rule-shape.js +158 -0
- package/dist/lib/design-resource-symbolic-safety-validation.d.ts +6 -0
- package/dist/lib/design-resource-symbolic-safety-validation.js +29 -0
- package/dist/lib/design-resource-symbolic-source-ir-evaluation.d.ts +19 -0
- package/dist/lib/design-resource-symbolic-source-ir-evaluation.js +74 -0
- package/dist/lib/design-resource-symbolic-source-ir-evidence.d.ts +44 -0
- package/dist/lib/design-resource-symbolic-source-ir-evidence.js +88 -0
- package/dist/lib/design-resource-symbolic-source-ir-oracle.d.ts +13 -0
- package/dist/lib/design-resource-symbolic-source-ir-oracle.js +96 -0
- package/dist/lib/design-resource-symbolic-source-ir-proof.d.ts +14 -0
- package/dist/lib/design-resource-symbolic-source-ir-proof.js +98 -0
- package/dist/lib/design-resource-symbolic-source-ir-shape.d.ts +2 -0
- package/dist/lib/design-resource-symbolic-source-ir-shape.js +38 -0
- package/dist/lib/design-resource-symbolic-source-ir-types.d.ts +17 -0
- package/dist/lib/design-resource-symbolic-source-ir-types.js +2 -0
- package/dist/lib/design-resource-symbolic-static-dependency-validation.d.ts +2 -0
- package/dist/lib/design-resource-symbolic-static-dependency-validation.js +83 -0
- package/dist/lib/design-resource-symbolic-structural-closure-validation.d.ts +6 -0
- package/dist/lib/design-resource-symbolic-structural-closure-validation.js +79 -0
- package/dist/lib/design-resource-symbolic-validation-support.d.ts +29 -0
- package/dist/lib/design-resource-symbolic-validation-support.js +111 -0
- package/dist/lib/design-resource-v1-capacity-header.d.ts +8 -0
- package/dist/lib/design-resource-v1-capacity-header.js +231 -0
- package/dist/lib/design-resource-v1-capacity.d.ts +5 -0
- package/dist/lib/design-resource-v1-capacity.js +45 -0
- package/dist/lib/init.js +1 -0
- package/dist/lib/long-task-acceptance-shape.js +8 -2
- package/dist/lib/long-task-activation-validation.js +13 -3
- package/dist/lib/long-task-admitted-observation-records.d.ts +25 -0
- package/dist/lib/long-task-admitted-observation-records.js +40 -0
- package/dist/lib/long-task-admitted-observation.d.ts +93 -0
- package/dist/lib/long-task-admitted-observation.js +201 -0
- package/dist/lib/long-task-artifacts.d.ts +1 -0
- package/dist/lib/long-task-artifacts.js +1 -0
- package/dist/lib/long-task-authority-material-diff.js +1 -0
- package/dist/lib/long-task-authority-policy.d.ts +5 -0
- package/dist/lib/long-task-authority-policy.js +5 -0
- package/dist/lib/long-task-authority-revision-details.js +3 -1
- package/dist/lib/long-task-authority.js +2 -1
- package/dist/lib/long-task-check-execution-policy.js +5 -0
- package/dist/lib/long-task-check-runner.d.ts +2 -2
- package/dist/lib/long-task-check-runner.js +440 -23
- package/dist/lib/long-task-claims.d.ts +18 -0
- package/dist/lib/long-task-claims.js +35 -0
- package/dist/lib/long-task-codex-agent-profile.d.ts +42 -0
- package/dist/lib/long-task-codex-agent-profile.js +276 -0
- package/dist/lib/long-task-compact-authoring-projections.d.ts +12 -0
- package/dist/lib/long-task-compact-authoring-projections.js +67 -0
- package/dist/lib/long-task-compact-authoring.d.ts +3 -0
- package/dist/lib/long-task-compact-authoring.js +173 -0
- package/dist/lib/long-task-compact-carrier.d.ts +7 -0
- package/dist/lib/long-task-compact-carrier.js +132 -0
- package/dist/lib/long-task-compact-parser.d.ts +14 -0
- package/dist/lib/long-task-compact-parser.js +123 -0
- package/dist/lib/long-task-compact-primitives.d.ts +22 -0
- package/dist/lib/long-task-compact-primitives.js +132 -0
- package/dist/lib/long-task-compact-projections.d.ts +4 -0
- package/dist/lib/long-task-compact-projections.js +153 -0
- package/dist/lib/long-task-compact-structure-targets.d.ts +2 -0
- package/dist/lib/long-task-compact-structure-targets.js +91 -0
- package/dist/lib/long-task-conformance-policy.js +3 -1
- package/dist/lib/long-task-counterfactual-claim-policy.d.ts +3 -4
- package/dist/lib/long-task-counterfactual-claim-policy.js +11 -3
- package/dist/lib/long-task-counterfactual-sandbox.d.ts +1 -1
- package/dist/lib/long-task-counterfactual-sandbox.js +8 -5
- package/dist/lib/long-task-counterfactual-types.d.ts +2 -0
- package/dist/lib/long-task-delivery-compiler.js +2 -0
- package/dist/lib/long-task-delivery-parser.d.ts +1 -0
- package/dist/lib/long-task-delivery-parser.js +38 -6
- package/dist/lib/long-task-design-resource-handoff.d.ts +2 -1
- package/dist/lib/long-task-design-resource-handoff.js +71 -11
- package/dist/lib/long-task-design-resource-method-binding.d.ts +8 -1
- package/dist/lib/long-task-design-resource-method-binding.js +150 -0
- package/dist/lib/long-task-evidence-capability-codec.js +256 -34
- package/dist/lib/long-task-evidence-capability-policy.d.ts +3 -2
- package/dist/lib/long-task-evidence-capability-policy.js +142 -8
- package/dist/lib/long-task-evidence-capability-runtime.d.ts +5 -2
- package/dist/lib/long-task-evidence-capability-runtime.js +420 -68
- package/dist/lib/long-task-evidence-capability-types.d.ts +70 -2
- package/dist/lib/long-task-evidence-sensitivity-policy.d.ts +9 -0
- package/dist/lib/long-task-evidence-sensitivity-policy.js +31 -1
- package/dist/lib/long-task-evidence-v2.d.ts +4 -4
- package/dist/lib/long-task-evidence-v2.js +322 -44
- package/dist/lib/long-task-exact-comparison.d.ts +16 -0
- package/dist/lib/long-task-exact-comparison.js +28 -0
- package/dist/lib/long-task-execution-observation.d.ts +24 -0
- package/dist/lib/long-task-execution-observation.js +332 -0
- package/dist/lib/long-task-explain-acceptance-link.d.ts +4 -0
- package/dist/lib/long-task-explain-acceptance-link.js +4 -0
- package/dist/lib/long-task-explain-claim-links.d.ts +2 -0
- package/dist/lib/long-task-explain-claim-links.js +2 -0
- package/dist/lib/long-task-explain-source-links.d.ts +6 -0
- package/dist/lib/long-task-final-v2.js +7 -4
- package/dist/lib/long-task-hook-install.d.ts +19 -2
- package/dist/lib/long-task-hook-install.js +288 -91
- package/dist/lib/long-task-json-pointer-observation.d.ts +59 -0
- package/dist/lib/long-task-json-pointer-observation.js +184 -0
- package/dist/lib/long-task-observation-artifact.d.ts +8 -0
- package/dist/lib/long-task-observation-artifact.js +58 -0
- package/dist/lib/long-task-observation-authority.d.ts +17 -0
- package/dist/lib/long-task-observation-authority.js +348 -0
- package/dist/lib/long-task-paths.js +1 -1
- package/dist/lib/long-task-playwright-capability-records.d.ts +2 -0
- package/dist/lib/long-task-playwright-capability-records.js +74 -2
- package/dist/lib/long-task-process-observation.d.ts +6 -0
- package/dist/lib/long-task-process-observation.js +117 -0
- package/dist/lib/long-task-process-runtime-closure.d.ts +13 -0
- package/dist/lib/long-task-process-runtime-closure.js +175 -0
- package/dist/lib/long-task-progress.js +2 -0
- package/dist/lib/long-task-protected-files.d.ts +1 -1
- package/dist/lib/long-task-protected-files.js +1 -30
- package/dist/lib/long-task-risk.js +8 -3
- package/dist/lib/long-task-root-shape.js +10 -1
- package/dist/lib/long-task-runner-environment.d.ts +1 -1
- package/dist/lib/long-task-runner-environment.js +4 -4
- package/dist/lib/long-task-runner-freeze.d.ts +4 -2
- package/dist/lib/long-task-runner-freeze.js +130 -28
- package/dist/lib/long-task-runtime-types.d.ts +111 -0
- package/dist/lib/long-task-scoped-binding.d.ts +13 -0
- package/dist/lib/long-task-scoped-binding.js +11 -0
- package/dist/lib/long-task-semantic-contract-types.d.ts +2 -1
- package/dist/lib/long-task-semantic-fact-binding-types.d.ts +8 -0
- package/dist/lib/long-task-semantic-fact-closure.js +4 -1
- package/dist/lib/long-task-semantic-fact-contract-closure.d.ts +1 -1
- package/dist/lib/long-task-semantic-fact-contract-closure.js +18 -6
- package/dist/lib/long-task-semantic-fact-contract-facts.d.ts +1 -1
- package/dist/lib/long-task-semantic-fact-contract-facts.js +4 -1
- package/dist/lib/long-task-semantic-fact-contract-proofs.d.ts +1 -1
- package/dist/lib/long-task-semantic-fact-contract-proofs.js +12 -3
- package/dist/lib/long-task-semantic-fact-evidence.d.ts +8 -4
- package/dist/lib/long-task-semantic-fact-evidence.js +103 -43
- package/dist/lib/long-task-semantic-fact-shape.js +17 -6
- package/dist/lib/long-task-shape-primitives.d.ts +1 -1
- package/dist/lib/long-task-shape-primitives.js +1 -0
- package/dist/lib/long-task-source-claim-validation.js +4 -1
- package/dist/lib/long-task-source-item-parser.d.ts +2 -2
- package/dist/lib/long-task-source-item-parser.js +20 -11
- package/dist/lib/long-task-source-target-continuity.d.ts +2 -2
- package/dist/lib/long-task-source-target-continuity.js +35 -2
- package/dist/lib/long-task-source-target-index.d.ts +3 -0
- package/dist/lib/long-task-source-target-index.js +19 -0
- package/dist/lib/long-task-stage-policy.js +10 -4
- package/dist/lib/long-task-static-observation-freeze.d.ts +83 -0
- package/dist/lib/long-task-static-observation-freeze.js +428 -0
- package/dist/lib/long-task-status-projection.js +5 -1
- package/dist/lib/long-task-target-policy.d.ts +1 -1
- package/dist/lib/long-task-target-policy.js +3 -0
- package/dist/lib/long-task-ui-design-policy.js +64 -4
- package/dist/lib/long-task-ui-surface-shape.js +195 -0
- package/dist/lib/long-task-ui-surface-types.d.ts +53 -0
- package/dist/lib/long-task-verifier-dependency-closure.js +7 -3
- package/dist/lib/long-task-verifier-v2.js +70 -9
- package/dist/lib/long-task-worker-selection.d.ts +2 -0
- package/dist/lib/long-task-worker-selection.js +7 -0
- package/dist/lib/long-task-workspace-scope.js +3 -1
- package/dist/lib/long-task-workspace.d.ts +1 -1
- package/dist/lib/long-task-workspace.js +12 -13
- package/dist/lib/migrations.js +58 -0
- package/dist/lib/profiles.js +0 -1
- package/dist/lib/repository-path-safety.d.ts +14 -0
- package/dist/lib/repository-path-safety.js +126 -0
- package/dist/lib/semantic-fact-compact-authoring.d.ts +2 -0
- package/dist/lib/semantic-fact-compact-authoring.js +160 -0
- package/dist/lib/semantic-fact-compact-capacity.d.ts +9 -0
- package/dist/lib/semantic-fact-compact-capacity.js +40 -0
- package/dist/lib/semantic-fact-compact-carrier.d.ts +16 -0
- package/dist/lib/semantic-fact-compact-carrier.js +146 -0
- package/dist/lib/semantic-fact-compact-parser.d.ts +17 -0
- package/dist/lib/semantic-fact-compact-parser.js +168 -0
- package/dist/lib/semantic-fact-compact-revision.d.ts +11 -0
- package/dist/lib/semantic-fact-compact-revision.js +64 -0
- package/dist/lib/semantic-fact-compact-support.d.ts +23 -0
- package/dist/lib/semantic-fact-compact-support.js +159 -0
- package/dist/lib/semantic-fact-policy-census.d.ts +1 -0
- package/dist/lib/semantic-fact-policy-census.js +43 -0
- 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/semantic-fact-source-parser.d.ts +5 -0
- package/dist/lib/semantic-fact-source-parser.js +47 -6
- package/dist/lib/structural-closure-cost.d.ts +79 -0
- package/dist/lib/structural-closure-cost.js +91 -0
- package/dist/lib/symbolic-denotation-dag-builder.d.ts +25 -0
- package/dist/lib/symbolic-denotation-dag-builder.js +176 -0
- package/dist/lib/symbolic-denotation-domain-validation.d.ts +3 -0
- package/dist/lib/symbolic-denotation-domain-validation.js +56 -0
- package/dist/lib/symbolic-denotation-engine.d.ts +32 -0
- package/dist/lib/symbolic-denotation-engine.js +140 -0
- package/dist/lib/symbolic-denotation-public.d.ts +11 -0
- package/dist/lib/symbolic-denotation-public.js +12 -0
- package/dist/lib/symbolic-denotation-runtime.d.ts +20 -0
- package/dist/lib/symbolic-denotation-runtime.js +90 -0
- package/dist/lib/symbolic-denotation-support.d.ts +11 -0
- package/dist/lib/symbolic-denotation-support.js +49 -0
- package/dist/lib/symbolic-denotation-types.d.ts +133 -0
- package/dist/lib/symbolic-denotation-types.js +18 -0
- package/dist/lib/symbolic-denotation-validation.d.ts +6 -0
- package/dist/lib/symbolic-denotation-validation.js +126 -0
- package/dist/lib/sync-engine.d.ts +1 -0
- package/dist/lib/sync-engine.js +4 -1
- package/dist/lib/upgrade.js +1 -0
- package/dist/long-task-hook.js +40 -1
- package/dist/public-types.d.ts +8 -0
- package/dist/public-types.js +1 -0
- package/dist/schemas/design-resource-symbolic-noninterference-artifact-v2.schema.json +289 -0
- package/dist/schemas/design-resource-symbolic-source-ir-v1.schema.json +130 -0
- package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +435 -5
- package/migrations/README.md +92 -15
- package/package.json +2 -2
- package/source-mappings.yaml +28 -25
- package/assets/skills/source-plan-authoring/SKILL.md +0 -14
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type LongTaskCompactCapacityCounts } from "./long-task-compact-primitives.js";
|
|
2
|
+
export declare function parseLongTaskCompactFactSets(value: unknown, selectors: Map<string, string[]>, label: string): Record<string, unknown>[];
|
|
3
|
+
export declare function parseLongTaskCompactProofTemplates(value: unknown, selectors: Map<string, string[]>, label: string): Map<string, Record<string, unknown>>;
|
|
4
|
+
export declare function parseLongTaskCompactCapacity(value: unknown, label: string): {
|
|
5
|
+
measured: LongTaskCompactCapacityCounts;
|
|
6
|
+
maximum: LongTaskCompactCapacityCounts;
|
|
7
|
+
};
|
|
8
|
+
export declare function parseLongTaskCompactSelectors(value: unknown, label: string): Map<string, string[]>;
|
|
9
|
+
export declare function parseLongTaskCompactTable(value: unknown, selectors: Map<string, string[]>, label: string): Record<string, unknown>[];
|
|
10
|
+
export declare function parseLongTaskCompactExceptions(value: unknown, label: string): Array<{
|
|
11
|
+
key: string;
|
|
12
|
+
target_ref: string;
|
|
13
|
+
rationale: string;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { LONG_TASK_COMPACT_CAPACITY_FIELDS, compactArray, compactFail, compactInteger, compactNonemptyString, compactPlainObject, compactResolveSelectors, compactStableRef, compactStableRefs, compactStrictObject, } from "./long-task-compact-primitives.js";
|
|
2
|
+
export function parseLongTaskCompactFactSets(value, selectors, label) {
|
|
3
|
+
const result = [];
|
|
4
|
+
const keys = new Set();
|
|
5
|
+
for (const [index, item] of compactArray(value, label).entries()) {
|
|
6
|
+
const itemLabel = `${label}[${index}]`;
|
|
7
|
+
const row = compactStrictObject(item, itemLabel, [
|
|
8
|
+
"key",
|
|
9
|
+
"defaults",
|
|
10
|
+
"columns",
|
|
11
|
+
"rows",
|
|
12
|
+
]);
|
|
13
|
+
const key = compactStableRef(row.key, `${itemLabel}.key`);
|
|
14
|
+
if (keys.has(key))
|
|
15
|
+
compactFail(itemLabel, `duplicate key: ${key}`);
|
|
16
|
+
keys.add(key);
|
|
17
|
+
result.push(...parseLongTaskCompactTable({ defaults: row.defaults, columns: row.columns, rows: row.rows }, selectors, itemLabel));
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
export function parseLongTaskCompactProofTemplates(value, selectors, label) {
|
|
22
|
+
const result = new Map();
|
|
23
|
+
for (const [index, item] of compactArray(value, label).entries()) {
|
|
24
|
+
const itemLabel = `${label}[${index}]`;
|
|
25
|
+
const row = compactStrictObject(item, itemLabel, ["key", "binding"]);
|
|
26
|
+
const key = compactStableRef(row.key, `${itemLabel}.key`);
|
|
27
|
+
if (result.has(key))
|
|
28
|
+
compactFail(itemLabel, `duplicate key: ${key}`);
|
|
29
|
+
const binding = compactPlainObject(compactResolveSelectors(row.binding, selectors, `${itemLabel}.binding`), `${itemLabel}.binding`);
|
|
30
|
+
if (["proof_ref", "fact_ref"].some((field) => Object.hasOwn(binding, field)))
|
|
31
|
+
compactFail(`${itemLabel}.binding`, "identity fields belong to rows");
|
|
32
|
+
result.set(key, binding);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
export function parseLongTaskCompactCapacity(value, label) {
|
|
37
|
+
const row = compactStrictObject(value, label, [
|
|
38
|
+
"theoretical_ground_universe",
|
|
39
|
+
"measured",
|
|
40
|
+
"maximum",
|
|
41
|
+
]);
|
|
42
|
+
if (row.theoretical_ground_universe !== "not_materialized")
|
|
43
|
+
compactFail(`${label}.theoretical_ground_universe`, "must be not_materialized");
|
|
44
|
+
return {
|
|
45
|
+
measured: capacityCounts(row.measured, `${label}.measured`),
|
|
46
|
+
maximum: capacityCounts(row.maximum, `${label}.maximum`),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function capacityCounts(value, label) {
|
|
50
|
+
const row = compactStrictObject(value, label, [
|
|
51
|
+
...LONG_TASK_COMPACT_CAPACITY_FIELDS,
|
|
52
|
+
]);
|
|
53
|
+
return Object.fromEntries(LONG_TASK_COMPACT_CAPACITY_FIELDS.map((field) => [
|
|
54
|
+
field,
|
|
55
|
+
compactInteger(row[field], `${label}.${field}`),
|
|
56
|
+
]));
|
|
57
|
+
}
|
|
58
|
+
export function parseLongTaskCompactSelectors(value, label) {
|
|
59
|
+
const result = new Map();
|
|
60
|
+
for (const [index, item] of compactArray(value, label).entries()) {
|
|
61
|
+
const itemLabel = `${label}[${index}]`;
|
|
62
|
+
const row = compactStrictObject(item, itemLabel, ["key", "members"]);
|
|
63
|
+
const key = compactStableRef(row.key, `${itemLabel}.key`);
|
|
64
|
+
const members = compactStableRefs(row.members, `${itemLabel}.members`);
|
|
65
|
+
if (result.has(key))
|
|
66
|
+
compactFail(itemLabel, `duplicate key: ${key}`);
|
|
67
|
+
if (new Set(members).size !== members.length)
|
|
68
|
+
compactFail(`${itemLabel}.members`, "members must be unique");
|
|
69
|
+
result.set(key, members);
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
export function parseLongTaskCompactTable(value, selectors, label) {
|
|
74
|
+
const table = compactStrictObject(value, label, [
|
|
75
|
+
"defaults",
|
|
76
|
+
"columns",
|
|
77
|
+
"rows",
|
|
78
|
+
]);
|
|
79
|
+
const defaults = compactPlainObject(compactResolveSelectors(table.defaults, selectors, `${label}.defaults`), `${label}.defaults`);
|
|
80
|
+
const columns = compactArray(table.columns, `${label}.columns`).map((item, index) => {
|
|
81
|
+
const column = compactNonemptyString(item, `${label}.columns[${index}]`);
|
|
82
|
+
if (!/^[a-z][a-z0-9_]*$/u.test(column))
|
|
83
|
+
compactFail(`${label}.columns[${index}]`, "invalid column name");
|
|
84
|
+
return column;
|
|
85
|
+
});
|
|
86
|
+
if (new Set(columns).size !== columns.length)
|
|
87
|
+
compactFail(`${label}.columns`, "columns must be unique");
|
|
88
|
+
for (const column of columns)
|
|
89
|
+
if (Object.hasOwn(defaults, column))
|
|
90
|
+
compactFail(`${label}.columns`, `column duplicates default: ${column}`);
|
|
91
|
+
return compactArray(table.rows, `${label}.rows`).map((item, index) => {
|
|
92
|
+
const values = compactArray(item, `${label}.rows[${index}]`);
|
|
93
|
+
if (values.length !== columns.length)
|
|
94
|
+
compactFail(`${label}.rows[${index}]`, `column count mismatch: ${values.length}:${columns.length}`);
|
|
95
|
+
return {
|
|
96
|
+
...defaults,
|
|
97
|
+
...Object.fromEntries(columns.map((column, columnIndex) => [
|
|
98
|
+
column,
|
|
99
|
+
compactResolveSelectors(values[columnIndex], selectors, `${label}.rows[${index}][${columnIndex}]`),
|
|
100
|
+
])),
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
export function parseLongTaskCompactExceptions(value, label) {
|
|
105
|
+
const result = [];
|
|
106
|
+
const seen = new Set();
|
|
107
|
+
for (const [index, item] of compactArray(value, label).entries()) {
|
|
108
|
+
const itemLabel = `${label}[${index}]`;
|
|
109
|
+
const row = compactStrictObject(item, itemLabel, [
|
|
110
|
+
"key",
|
|
111
|
+
"target_ref",
|
|
112
|
+
"rationale",
|
|
113
|
+
]);
|
|
114
|
+
const key = compactStableRef(row.key, `${itemLabel}.key`);
|
|
115
|
+
const targetRef = compactStableRef(row.target_ref, `${itemLabel}.target_ref`);
|
|
116
|
+
const rationale = compactNonemptyString(row.rationale, `${itemLabel}.rationale`);
|
|
117
|
+
if (seen.has(key))
|
|
118
|
+
compactFail(itemLabel, `duplicate key: ${key}`);
|
|
119
|
+
seen.add(key);
|
|
120
|
+
result.push({ key, target_ref: targetRef, rationale });
|
|
121
|
+
}
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { longTaskCompactSharedStructureTargets } from "./long-task-compact-structure-targets.js";
|
|
2
|
+
export declare const LONG_TASK_COMPACT_CAPACITY_FIELDS: readonly ["claims", "claim_projections", "selector_members", "structure_families", "structure_references", "structure_arguments", "facts", "obligations", "assertions", "canonical_bytes"];
|
|
3
|
+
type CapacityField = (typeof LONG_TASK_COMPACT_CAPACITY_FIELDS)[number];
|
|
4
|
+
export type LongTaskCompactCapacityCounts = Record<CapacityField, number>;
|
|
5
|
+
export declare function compactRequiredOutcome(value: unknown, outcomes: Map<string, Record<string, unknown>>, label: string): Record<string, unknown>;
|
|
6
|
+
export declare function compactResolveSelectors(value: unknown, selectors: Map<string, string[]>, label: string): unknown;
|
|
7
|
+
export declare function validateLongTaskCompactCapacity(capacity: {
|
|
8
|
+
measured: LongTaskCompactCapacityCounts;
|
|
9
|
+
maximum: LongTaskCompactCapacityCounts;
|
|
10
|
+
}, measured: LongTaskCompactCapacityCounts, label: string): void;
|
|
11
|
+
export declare function validateLongTaskCompactDeclaredMaximum(maximum: LongTaskCompactCapacityCounts, label: string): void;
|
|
12
|
+
export declare function compactUniqueRows(rows: Record<string, unknown>[], field: string, label: string): void;
|
|
13
|
+
export declare function compactStrictObject(value: unknown, label: string, fields: string[]): Record<string, unknown>;
|
|
14
|
+
export declare function compactPlainObject(value: unknown, label: string): Record<string, unknown>;
|
|
15
|
+
export declare function compactArray(value: unknown, label: string): unknown[];
|
|
16
|
+
export declare function compactStableRef(value: unknown, label: string): string;
|
|
17
|
+
export declare function compactStableRefs(value: unknown, label: string): string[];
|
|
18
|
+
export declare function compactSha256(value: unknown, label: string): string;
|
|
19
|
+
export declare function compactNonemptyString(value: unknown, label: string): string;
|
|
20
|
+
export declare function compactInteger(value: unknown, label: string): number;
|
|
21
|
+
export declare function compactLiteral<T extends string>(value: unknown, values: readonly T[], label: string): T;
|
|
22
|
+
export declare function compactFail(label: string, message: string): never;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
const STABLE_REF = /^[a-z0-9][a-z0-9._:-]*$/u;
|
|
2
|
+
const SHA256 = /^[a-f0-9]{64}$/u;
|
|
3
|
+
export { longTaskCompactSharedStructureTargets } from "./long-task-compact-structure-targets.js";
|
|
4
|
+
export const LONG_TASK_COMPACT_CAPACITY_FIELDS = [
|
|
5
|
+
"claims",
|
|
6
|
+
"claim_projections",
|
|
7
|
+
"selector_members",
|
|
8
|
+
"structure_families",
|
|
9
|
+
"structure_references",
|
|
10
|
+
"structure_arguments",
|
|
11
|
+
"facts",
|
|
12
|
+
"obligations",
|
|
13
|
+
"assertions",
|
|
14
|
+
"canonical_bytes",
|
|
15
|
+
];
|
|
16
|
+
const PACKAGE_MAXIMUM = {
|
|
17
|
+
claims: 1_000_000,
|
|
18
|
+
claim_projections: 2_000_000,
|
|
19
|
+
selector_members: 5_000_000,
|
|
20
|
+
structure_families: 1_000_000,
|
|
21
|
+
structure_references: 10_000_000,
|
|
22
|
+
structure_arguments: 50_000_000,
|
|
23
|
+
facts: 1_000_000,
|
|
24
|
+
obligations: 2_000_000,
|
|
25
|
+
assertions: 5_000_000,
|
|
26
|
+
canonical_bytes: 256 * 1024 * 1024,
|
|
27
|
+
};
|
|
28
|
+
export function compactRequiredOutcome(value, outcomes, label) {
|
|
29
|
+
const ref = compactStableRef(value, `${label}.outcome_ref`);
|
|
30
|
+
const outcome = outcomes.get(ref);
|
|
31
|
+
if (!outcome)
|
|
32
|
+
compactFail(`${label}.outcome_ref`, `unknown outcome: ${ref}`);
|
|
33
|
+
return outcome;
|
|
34
|
+
}
|
|
35
|
+
export function compactResolveSelectors(value, selectors, label) {
|
|
36
|
+
if (Array.isArray(value))
|
|
37
|
+
return value.map((item, index) => compactResolveSelectors(item, selectors, `${label}[${index}]`));
|
|
38
|
+
if (!value || typeof value !== "object")
|
|
39
|
+
return value;
|
|
40
|
+
const row = value;
|
|
41
|
+
if (Object.keys(row).length === 1 && Object.hasOwn(row, "selector_ref")) {
|
|
42
|
+
const ref = compactStableRef(row.selector_ref, `${label}.selector_ref`);
|
|
43
|
+
const members = selectors.get(ref);
|
|
44
|
+
if (!members)
|
|
45
|
+
compactFail(`${label}.selector_ref`, `unknown selector: ${ref}`);
|
|
46
|
+
return [...members];
|
|
47
|
+
}
|
|
48
|
+
if (Object.hasOwn(row, "selector_ref"))
|
|
49
|
+
compactFail(label, "selector_ref must be the only key");
|
|
50
|
+
return Object.fromEntries(Object.entries(row).map(([key, item]) => [
|
|
51
|
+
key,
|
|
52
|
+
compactResolveSelectors(item, selectors, `${label}.${key}`),
|
|
53
|
+
]));
|
|
54
|
+
}
|
|
55
|
+
export function validateLongTaskCompactCapacity(capacity, measured, label) {
|
|
56
|
+
for (const field of LONG_TASK_COMPACT_CAPACITY_FIELDS) {
|
|
57
|
+
if (capacity.maximum[field] > PACKAGE_MAXIMUM[field])
|
|
58
|
+
compactFail(`${label}.capacity.maximum.${field}`, `exceeds package maximum ${PACKAGE_MAXIMUM[field]}`);
|
|
59
|
+
if (capacity.measured[field] !== measured[field])
|
|
60
|
+
compactFail(`${label}.capacity.measured.${field}`, `measured mismatch: ${capacity.measured[field]}:${measured[field]}`);
|
|
61
|
+
if (measured[field] > capacity.maximum[field])
|
|
62
|
+
compactFail(`${label}.capacity.maximum.${field}`, `capacity exceeded: ${measured[field]}:${capacity.maximum[field]}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export function validateLongTaskCompactDeclaredMaximum(maximum, label) {
|
|
66
|
+
for (const field of LONG_TASK_COMPACT_CAPACITY_FIELDS)
|
|
67
|
+
if (maximum[field] > PACKAGE_MAXIMUM[field])
|
|
68
|
+
compactFail(`${label}.capacity.maximum.${field}`, `exceeds package maximum ${PACKAGE_MAXIMUM[field]}`);
|
|
69
|
+
}
|
|
70
|
+
export function compactUniqueRows(rows, field, label) {
|
|
71
|
+
const seen = new Set();
|
|
72
|
+
for (const [index, row] of rows.entries()) {
|
|
73
|
+
const value = compactStableRef(row[field], `${label}.rows[${index}].${field}`);
|
|
74
|
+
if (seen.has(value))
|
|
75
|
+
compactFail(label, `duplicate ${field}: ${value}`);
|
|
76
|
+
seen.add(value);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export function compactStrictObject(value, label, fields) {
|
|
80
|
+
const row = compactPlainObject(value, label);
|
|
81
|
+
const allowed = new Set(fields);
|
|
82
|
+
const unknown = Object.keys(row).filter((key) => !allowed.has(key));
|
|
83
|
+
if (unknown.length)
|
|
84
|
+
compactFail(label, `unknown keys: ${unknown.join(",")}`);
|
|
85
|
+
const missing = fields.filter((field) => !Object.hasOwn(row, field));
|
|
86
|
+
if (missing.length)
|
|
87
|
+
compactFail(label, `missing keys: ${missing.join(",")}`);
|
|
88
|
+
return row;
|
|
89
|
+
}
|
|
90
|
+
export function compactPlainObject(value, label) {
|
|
91
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
92
|
+
compactFail(label, "must be an object");
|
|
93
|
+
return value;
|
|
94
|
+
}
|
|
95
|
+
export function compactArray(value, label) {
|
|
96
|
+
if (!Array.isArray(value))
|
|
97
|
+
compactFail(label, "must be an array");
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
export function compactStableRef(value, label) {
|
|
101
|
+
const result = compactNonemptyString(value, label);
|
|
102
|
+
if (!STABLE_REF.test(result))
|
|
103
|
+
compactFail(label, "must be a stable reference");
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
export function compactStableRefs(value, label) {
|
|
107
|
+
return compactArray(value, label).map((item, index) => compactStableRef(item, `${label}[${index}]`));
|
|
108
|
+
}
|
|
109
|
+
export function compactSha256(value, label) {
|
|
110
|
+
const result = compactNonemptyString(value, label);
|
|
111
|
+
if (!SHA256.test(result))
|
|
112
|
+
compactFail(label, "must be a lowercase SHA-256");
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
export function compactNonemptyString(value, label) {
|
|
116
|
+
if (typeof value !== "string" || !value.trim())
|
|
117
|
+
compactFail(label, "must be a non-empty string");
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
export function compactInteger(value, label) {
|
|
121
|
+
if (!Number.isInteger(value) || Number(value) < 0)
|
|
122
|
+
compactFail(label, "must be an integer >= 0");
|
|
123
|
+
return Number(value);
|
|
124
|
+
}
|
|
125
|
+
export function compactLiteral(value, values, label) {
|
|
126
|
+
if (typeof value !== "string" || !values.includes(value))
|
|
127
|
+
compactFail(label, `must be one of ${values.join(",")}`);
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
130
|
+
export function compactFail(label, message) {
|
|
131
|
+
throw new Error(`long_task_compact_carrier_invalid:${label}:${message}`);
|
|
132
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function prepareLongTaskCompactOutcomeTargets(outcomes: Record<string, unknown>[]): void;
|
|
2
|
+
export declare function materializeLongTaskCompactClaimProjections(projections: Record<string, unknown>[], claims: Map<string, Record<string, unknown>>, outcomes: Map<string, Record<string, unknown>>): void;
|
|
3
|
+
export declare function materializeLongTaskCompactFactBindings(facts: Record<string, unknown>[], obligations: Record<string, unknown>[], factByKey: Map<string, Record<string, unknown>>, templates: Map<string, Record<string, unknown>>, outcomes: Map<string, Record<string, unknown>>): void;
|
|
4
|
+
export declare function materializeLongTaskCompactAssertions(assertions: Record<string, unknown>[], claims: Map<string, Record<string, unknown>>, facts: Map<string, Record<string, unknown>>, outcomes: Map<string, Record<string, unknown>>): void;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { compactArray, compactFail, compactInteger, compactLiteral, compactNonemptyString, compactPlainObject, compactRequiredOutcome, compactSha256, compactStableRef, compactStableRefs, } from "./long-task-compact-primitives.js";
|
|
2
|
+
export function prepareLongTaskCompactOutcomeTargets(outcomes) {
|
|
3
|
+
for (const [index, outcome] of outcomes.entries()) {
|
|
4
|
+
const label = `outcomes[${index}]`;
|
|
5
|
+
if (Object.hasOwn(outcome, "semantic_fact_bindings"))
|
|
6
|
+
compactFail(label, "expanded semantic_fact_bindings cannot coexist");
|
|
7
|
+
const product = compactPlainObject(outcome.product, `${label}.product`);
|
|
8
|
+
const technical = compactPlainObject(outcome.technical, `${label}.technical`);
|
|
9
|
+
for (const field of ["requirements", "non_completing_outcomes"])
|
|
10
|
+
if (Object.hasOwn(product, field))
|
|
11
|
+
compactFail(`${label}.product.${field}`, "expanded projection cannot coexist");
|
|
12
|
+
for (const field of ["obligations", "forbidden_shortcuts"])
|
|
13
|
+
if (Object.hasOwn(technical, field))
|
|
14
|
+
compactFail(`${label}.technical.${field}`, "expanded projection cannot coexist");
|
|
15
|
+
product.requirements = [];
|
|
16
|
+
product.non_completing_outcomes = [];
|
|
17
|
+
technical.obligations = [];
|
|
18
|
+
technical.forbidden_shortcuts = [];
|
|
19
|
+
outcome.semantic_fact_bindings = {
|
|
20
|
+
manifest_ref: "",
|
|
21
|
+
facts: [],
|
|
22
|
+
proofs: [],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function materializeLongTaskCompactClaimProjections(projections, claims, outcomes) {
|
|
27
|
+
for (const [index, projection] of projections.entries()) {
|
|
28
|
+
const label = `compact_semantic_carrier.claim_projections.rows[${index}]`;
|
|
29
|
+
const outcome = compactRequiredOutcome(projection.outcome_ref, outcomes, label);
|
|
30
|
+
const claimKey = projection.claim_key === null
|
|
31
|
+
? null
|
|
32
|
+
: compactStableRef(projection.claim_key, `${label}.claim_key`);
|
|
33
|
+
const claim = claimKey ? claims.get(claimKey) : null;
|
|
34
|
+
if (claimKey && !claim)
|
|
35
|
+
compactFail(`${label}.claim_key`, `unknown claim: ${claimKey}`);
|
|
36
|
+
const statement = claim
|
|
37
|
+
? compactNonemptyString(claim.statement, `${label}.statement`)
|
|
38
|
+
: compactNonemptyString(projection.statement, `${label}.statement`);
|
|
39
|
+
const applicabilityRefs = compactStableRefs(projection.applicability_refs, `${label}.applicability_refs`);
|
|
40
|
+
const kind = compactLiteral(projection.projection_kind, [
|
|
41
|
+
"requirement",
|
|
42
|
+
"obligation",
|
|
43
|
+
"forbidden_shortcut",
|
|
44
|
+
"non_completing_outcome",
|
|
45
|
+
], `${label}.projection_kind`);
|
|
46
|
+
const product = compactPlainObject(outcome.product, `${label}.product`);
|
|
47
|
+
const technical = compactPlainObject(outcome.technical, `${label}.technical`);
|
|
48
|
+
const base = {
|
|
49
|
+
key: compactStableRef(projection.projection_key ?? projection.claim_key, `${label}.projection_key`),
|
|
50
|
+
statement,
|
|
51
|
+
applicability_refs: applicabilityRefs,
|
|
52
|
+
};
|
|
53
|
+
if (kind === "requirement" || kind === "obligation") {
|
|
54
|
+
const requiredProofSurfaces = compactStableRefs(projection.required_proof_surfaces, `${label}.required_proof_surfaces`);
|
|
55
|
+
const row = { ...base, required_proof_surfaces: requiredProofSurfaces };
|
|
56
|
+
if (kind === "requirement")
|
|
57
|
+
product.requirements.push(row);
|
|
58
|
+
else
|
|
59
|
+
technical.obligations.push(row);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (projection.required_proof_surfaces !== null)
|
|
63
|
+
compactFail(`${label}.required_proof_surfaces`, "must be null for statement-only projection");
|
|
64
|
+
if (kind === "forbidden_shortcut")
|
|
65
|
+
technical.forbidden_shortcuts.push(base);
|
|
66
|
+
else
|
|
67
|
+
product.non_completing_outcomes.push(base);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export function materializeLongTaskCompactFactBindings(facts, obligations, factByKey, templates, outcomes) {
|
|
72
|
+
for (const [index, fact] of facts.entries()) {
|
|
73
|
+
const label = `compact_semantic_carrier.facts[${index}]`;
|
|
74
|
+
const outcome = compactRequiredOutcome(fact.outcome_ref, outcomes, label);
|
|
75
|
+
const binding = compactPlainObject(outcome.semantic_fact_bindings, `${label}.semantic_fact_bindings`);
|
|
76
|
+
if (!binding.manifest_ref)
|
|
77
|
+
binding.manifest_ref = compactStableRef(fact.manifest_ref, `${label}.manifest_ref`);
|
|
78
|
+
else if (binding.manifest_ref !== fact.manifest_ref)
|
|
79
|
+
compactFail(`${label}.manifest_ref`, "outcome manifest_ref mismatch");
|
|
80
|
+
binding.facts.push({
|
|
81
|
+
fact_ref: compactStableRef(fact.fact_key, `${label}.fact_key`),
|
|
82
|
+
fact_revision_digest: compactSha256(fact.fact_revision_digest, `${label}.fact_revision_digest`),
|
|
83
|
+
claim_ref: compactStableRef(fact.claim_ref, `${label}.claim_ref`),
|
|
84
|
+
applicability_ref: compactStableRef(fact.applicability_ref, `${label}.applicability_ref`),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
for (const [index, obligation] of obligations.entries()) {
|
|
88
|
+
const label = `compact_semantic_carrier.obligations.rows[${index}]`;
|
|
89
|
+
const outcome = compactRequiredOutcome(obligation.outcome_ref, outcomes, label);
|
|
90
|
+
const factKey = compactStableRef(obligation.fact_key, `${label}.fact_key`);
|
|
91
|
+
if (!factByKey.has(factKey))
|
|
92
|
+
compactFail(`${label}.fact_key`, `unknown fact: ${factKey}`);
|
|
93
|
+
const templateRef = compactStableRef(obligation.template_ref, `${label}.template_ref`);
|
|
94
|
+
const template = templates.get(templateRef);
|
|
95
|
+
if (!template)
|
|
96
|
+
compactFail(`${label}.template_ref`, `unknown template: ${templateRef}`);
|
|
97
|
+
const overrides = compactPlainObject(obligation.overrides, `${label}.overrides`);
|
|
98
|
+
if (["proof_ref", "fact_ref", "obligation_revision_digest"].some((field) => Object.hasOwn(overrides, field)))
|
|
99
|
+
compactFail(`${label}.overrides`, "identity fields cannot be overridden");
|
|
100
|
+
const binding = compactPlainObject(outcome.semantic_fact_bindings, `${label}.semantic_fact_bindings`);
|
|
101
|
+
binding.proofs.push({
|
|
102
|
+
...template,
|
|
103
|
+
...overrides,
|
|
104
|
+
proof_ref: compactStableRef(obligation.obligation_key, `${label}.obligation_key`),
|
|
105
|
+
obligation_revision_digest: compactSha256(obligation.obligation_revision_digest, `${label}.obligation_revision_digest`),
|
|
106
|
+
fact_ref: factKey,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export function materializeLongTaskCompactAssertions(assertions, claims, facts, outcomes) {
|
|
111
|
+
for (const [index, projection] of assertions.entries()) {
|
|
112
|
+
const label = `compact_semantic_carrier.assertion_projections.rows[${index}]`;
|
|
113
|
+
const outcome = compactRequiredOutcome(projection.outcome_ref, outcomes, label);
|
|
114
|
+
const acceptance = compactPlainObject(outcome.acceptance, `${label}.acceptance`);
|
|
115
|
+
const checkRef = compactStableRef(projection.check_ref, `${label}.check_ref`);
|
|
116
|
+
const check = compactArray(acceptance.checks, `${label}.checks`)
|
|
117
|
+
.map((item, checkIndex) => compactPlainObject(item, `${label}.checks[${checkIndex}]`))
|
|
118
|
+
.find((item) => item.key === checkRef);
|
|
119
|
+
if (!check)
|
|
120
|
+
compactFail(`${label}.check_ref`, `unknown check: ${checkRef}`);
|
|
121
|
+
const criterionKind = compactLiteral(projection.criterion_kind, ["claim_statement", "semantic_fact"], `${label}.criterion_kind`);
|
|
122
|
+
const criterionRef = compactStableRef(projection.criterion_ref, `${label}.criterion_ref`);
|
|
123
|
+
let criterion;
|
|
124
|
+
if (criterionKind === "claim_statement") {
|
|
125
|
+
const claim = claims.get(criterionRef);
|
|
126
|
+
if (!claim)
|
|
127
|
+
compactFail(`${label}.criterion_ref`, `unknown claim: ${criterionRef}`);
|
|
128
|
+
criterion = compactNonemptyString(claim.statement, `${label}.criterion`);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
if (!facts.has(criterionRef))
|
|
132
|
+
compactFail(`${label}.criterion_ref`, `unknown fact: ${criterionRef}`);
|
|
133
|
+
criterion = `The current candidate satisfies the exact Source Fact ${criterionRef}.`;
|
|
134
|
+
}
|
|
135
|
+
const assertion = {
|
|
136
|
+
key: compactStableRef(projection.key, `${label}.key`),
|
|
137
|
+
criterion,
|
|
138
|
+
claims: compactStableRefs(projection.claims, `${label}.claims`),
|
|
139
|
+
applicability_ref: compactStableRef(projection.applicability_ref, `${label}.applicability_ref`),
|
|
140
|
+
observation: compactNonemptyString(projection.observation, `${label}.observation`),
|
|
141
|
+
evidence_capabilities: compactStableRefs(projection.evidence_capabilities, `${label}.evidence_capabilities`),
|
|
142
|
+
operator: compactNonemptyString(projection.operator, `${label}.operator`),
|
|
143
|
+
expected: projection.expected,
|
|
144
|
+
};
|
|
145
|
+
const positive = compactArray(check.positive_assertions, `${label}.positive_assertions`);
|
|
146
|
+
if (positive.some((item) => compactPlainObject(item, label).key === assertion.key))
|
|
147
|
+
compactFail(`${label}.key`, `duplicate assertion: ${assertion.key}`);
|
|
148
|
+
const position = compactInteger(projection.position, `${label}.position`);
|
|
149
|
+
if (position > positive.length)
|
|
150
|
+
compactFail(`${label}.position`, `position exceeds current assertion length: ${position}:${positive.length}`);
|
|
151
|
+
positive.splice(position, 0, assertion);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const BASE_STRUCTURE_BOUNDARY_BY_FIELD = {
|
|
2
|
+
path_globs: "contract.path-set",
|
|
3
|
+
expected_change_paths: "contract.path-set",
|
|
4
|
+
input_paths: "contract.check.input-paths",
|
|
5
|
+
verification_inputs: "contract.check.verification-inputs",
|
|
6
|
+
scenario: "contract.check.scenario",
|
|
7
|
+
expected_output_paths: "contract.check.output-paths",
|
|
8
|
+
mutation: "contract.counterfactual.mutation",
|
|
9
|
+
execution_target: "contract.check.execution-target",
|
|
10
|
+
artifact_globs: "contract.check.artifact-globs",
|
|
11
|
+
journey_roles: "contract.check.journey-roles",
|
|
12
|
+
carrier_paths: "contract.binding.carrier-paths",
|
|
13
|
+
preserved_assertions: "contract.counterfactual.preserved-assertions",
|
|
14
|
+
allowed_fanout_assertions: "contract.counterfactual.allowed-fanout-assertions",
|
|
15
|
+
expected_assertion_failures: "contract.counterfactual.expected-assertion-failures",
|
|
16
|
+
};
|
|
17
|
+
export function longTaskCompactSharedStructureTargets(root, carrier) {
|
|
18
|
+
const targets = [];
|
|
19
|
+
for (const [field, boundary] of [
|
|
20
|
+
["claim_catalog", "contract.claim"],
|
|
21
|
+
["claim_projections", "contract.claim-projection"],
|
|
22
|
+
["obligations", "contract.obligation"],
|
|
23
|
+
["assertion_projections", "contract.assertion"],
|
|
24
|
+
])
|
|
25
|
+
addCompactTableTargets(targets, carrier[field], boundary);
|
|
26
|
+
if (Array.isArray(carrier.fact_sets))
|
|
27
|
+
for (const factSet of carrier.fact_sets)
|
|
28
|
+
addCompactTableTargets(targets, factSet, "contract.fact");
|
|
29
|
+
if (Array.isArray(carrier.proof_templates))
|
|
30
|
+
for (const template of carrier.proof_templates) {
|
|
31
|
+
const row = plainRecord(template);
|
|
32
|
+
if (row && Object.hasOwn(row, "binding"))
|
|
33
|
+
addTarget(targets, row, "binding", "contract.proof.policy");
|
|
34
|
+
}
|
|
35
|
+
for (const [key, value] of Object.entries(root)) {
|
|
36
|
+
if (key === "compact_semantic_carrier")
|
|
37
|
+
continue;
|
|
38
|
+
collectBaseTargets(targets, value);
|
|
39
|
+
}
|
|
40
|
+
return targets;
|
|
41
|
+
}
|
|
42
|
+
function collectBaseTargets(targets, value) {
|
|
43
|
+
if (Array.isArray(value)) {
|
|
44
|
+
value.forEach((item) => collectBaseTargets(targets, item));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const row = plainRecord(value);
|
|
48
|
+
if (!row)
|
|
49
|
+
return;
|
|
50
|
+
for (const [key, child] of Object.entries(row)) {
|
|
51
|
+
const boundary = BASE_STRUCTURE_BOUNDARY_BY_FIELD[key];
|
|
52
|
+
if (boundary && child && typeof child === "object") {
|
|
53
|
+
addTarget(targets, row, key, boundary);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
collectBaseTargets(targets, child);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function addCompactTableTargets(targets, value, boundary) {
|
|
60
|
+
const table = plainRecord(value);
|
|
61
|
+
if (!table || !Array.isArray(table.columns) || !Array.isArray(table.rows))
|
|
62
|
+
return;
|
|
63
|
+
const columns = table.columns.map(String);
|
|
64
|
+
const defaults = plainRecord(table.defaults);
|
|
65
|
+
if (defaults)
|
|
66
|
+
for (const key of Object.keys(defaults))
|
|
67
|
+
if (defaults[key] && typeof defaults[key] === "object")
|
|
68
|
+
addTarget(targets, defaults, key, `${boundary}.default.${key}`);
|
|
69
|
+
for (const rowValue of table.rows) {
|
|
70
|
+
if (!Array.isArray(rowValue) || rowValue.length !== columns.length)
|
|
71
|
+
continue;
|
|
72
|
+
for (const [index, column] of columns.entries())
|
|
73
|
+
if (rowValue[index] && typeof rowValue[index] === "object")
|
|
74
|
+
addTarget(targets, rowValue, index, `${boundary}.${column}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function addTarget(targets, parent, key, boundary) {
|
|
78
|
+
const indexed = parent;
|
|
79
|
+
targets.push({
|
|
80
|
+
boundary,
|
|
81
|
+
read: () => indexed[key],
|
|
82
|
+
write: (value) => {
|
|
83
|
+
indexed[key] = value;
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function plainRecord(value) {
|
|
88
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
89
|
+
? value
|
|
90
|
+
: null;
|
|
91
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { allOutcomeResultsExternallyBlocked } from "./long-task-claims.js";
|
|
1
2
|
export function semanticConformanceRequired(contract, _effectiveRisk) {
|
|
2
3
|
const productFamilies = new Set(contract.task.execution_targets
|
|
3
4
|
.filter((target) => contract.task.target_profile.required_target_refs.includes(target.key))
|
|
@@ -8,7 +9,8 @@ export function semanticConformanceRequired(contract, _effectiveRisk) {
|
|
|
8
9
|
export function validateSemanticConformance(contract, effectiveRisk, compiledChecks, report) {
|
|
9
10
|
const declared = contract.global.acceptance.checks.filter((check) => check.journey_roles.includes("conformance"));
|
|
10
11
|
if (semanticConformanceRequired(contract, effectiveRisk) &&
|
|
11
|
-
!declared.length
|
|
12
|
+
!declared.length &&
|
|
13
|
+
!allOutcomeResultsExternallyBlocked(contract)) {
|
|
12
14
|
issue(report, "semantic_conformance_check_required", contract.task.id);
|
|
13
15
|
return;
|
|
14
16
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { CounterfactualControlV2, DeliveryContractV2, DeliveryBindingV2, DeliveryOutcomeV2, GlobalCounterfactualControlV2 } from "./long-task-delivery-types.js";
|
|
2
|
+
import { type ScopedDeliveryBindingV2 } from "./long-task-scoped-binding.js";
|
|
2
3
|
export declare function validateCounterfactualBindingClaims(outcome: DeliveryOutcomeV2, control: CounterfactualControlV2, binding: DeliveryBindingV2): void;
|
|
3
|
-
export declare function resolveGlobalCounterfactualBinding(contract: DeliveryContractV2, control: GlobalCounterfactualControlV2): {
|
|
4
|
+
export declare function resolveGlobalCounterfactualBinding(contract: DeliveryContractV2, control: GlobalCounterfactualControlV2): ScopedDeliveryBindingV2 & {
|
|
4
5
|
outcome: DeliveryOutcomeV2;
|
|
5
|
-
binding: DeliveryBindingV2;
|
|
6
6
|
};
|
|
7
|
-
export declare function validateGlobalCounterfactualBindingClaims(contract: DeliveryContractV2, control: GlobalCounterfactualControlV2): {
|
|
7
|
+
export declare function validateGlobalCounterfactualBindingClaims(contract: DeliveryContractV2, control: GlobalCounterfactualControlV2): ScopedDeliveryBindingV2 & {
|
|
8
8
|
outcome: DeliveryOutcomeV2;
|
|
9
|
-
binding: DeliveryBindingV2;
|
|
10
9
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { scopeDeliveryBindings, } from "./long-task-scoped-binding.js";
|
|
1
2
|
export function validateCounterfactualBindingClaims(outcome, control, binding) {
|
|
2
3
|
if (binding.verification_check_key &&
|
|
3
4
|
binding.verification_check_key !== control.check_key)
|
|
@@ -21,10 +22,10 @@ export function resolveGlobalCounterfactualBinding(contract, control) {
|
|
|
21
22
|
const outcome = contract.outcomes.find((item) => item.key === outcomeKey);
|
|
22
23
|
if (!outcome)
|
|
23
24
|
throw new Error(`global_counterfactual_binding_ref_invalid:${control.key}:${control.binding_ref}`);
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
25
|
+
const scoped = scopeDeliveryBindings(outcome.key, outcome.technical.bindings).find((item) => item.binding_ref === control.binding_ref && item.local_key === bindingKey);
|
|
26
|
+
if (!scoped)
|
|
26
27
|
throw new Error(`global_counterfactual_binding_unknown:${control.key}:${control.binding_ref}`);
|
|
27
|
-
return { outcome,
|
|
28
|
+
return { outcome, ...scoped };
|
|
28
29
|
}
|
|
29
30
|
export function validateGlobalCounterfactualBindingClaims(contract, control) {
|
|
30
31
|
const resolved = resolveGlobalCounterfactualBinding(contract, control);
|
|
@@ -55,10 +56,17 @@ function validateExpectedAssertions(control, check, unknownPrefix) {
|
|
|
55
56
|
if (!assertions.has(key))
|
|
56
57
|
throw new Error(`${unknownPrefix}:${key}`);
|
|
57
58
|
const failures = new Set(control.expected_assertion_failures);
|
|
59
|
+
const preserved = new Set(control.preserved_assertions);
|
|
58
60
|
for (const key of control.preserved_assertions) {
|
|
59
61
|
if (!assertions.has(key))
|
|
60
62
|
throw new Error(`${unknownPrefix}:${key}`);
|
|
61
63
|
if (failures.has(key))
|
|
62
64
|
throw new Error(`counterfactual_preserved_assertion_conflict:${unknownPrefix}:${key}`);
|
|
63
65
|
}
|
|
66
|
+
for (const key of control.allowed_fanout_assertions) {
|
|
67
|
+
if (!assertions.has(key))
|
|
68
|
+
throw new Error(`${unknownPrefix}:${key}`);
|
|
69
|
+
if (failures.has(key) || preserved.has(key))
|
|
70
|
+
throw new Error(`counterfactual_fanout_assertion_conflict:${unknownPrefix}:${key}`);
|
|
71
|
+
}
|
|
64
72
|
}
|
|
@@ -8,6 +8,6 @@ type RemoveTree = (target: string, options: {
|
|
|
8
8
|
force: true;
|
|
9
9
|
}) => Promise<void>;
|
|
10
10
|
type Wait = (milliseconds: number) => Promise<void>;
|
|
11
|
-
export declare function createCounterfactualSandbox(snapshotRoot: string, check: CompiledCheckV2, control: CounterfactualControlV2 | GlobalCounterfactualControlV2, bindingCarrierPaths: string[], manifest?: WorkspaceManifestV2): Promise<CounterfactualSandboxV2>;
|
|
11
|
+
export declare function createCounterfactualSandbox(snapshotRoot: string, check: CompiledCheckV2, control: CounterfactualControlV2 | GlobalCounterfactualControlV2, bindingCarrierPaths: string[], manifest?: WorkspaceManifestV2, protectedAuthorityPaths?: readonly string[]): Promise<CounterfactualSandboxV2>;
|
|
12
12
|
export declare function removeCounterfactualSandboxRoot(root: string, removeTree?: RemoveTree, wait?: Wait): Promise<void>;
|
|
13
13
|
export {};
|