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,79 @@
|
|
|
1
|
+
import { validateDesignResourceLocatedDigest } from "./design-resource-fact-locator-validation.js";
|
|
2
|
+
import { validateSymbolicQuantifier, validateSymbolicRegionWithinReachable, } from "./design-resource-symbolic-region-validation.js";
|
|
3
|
+
import { assertNoUnprovedOmittedAxes } from "./design-resource-symbolic-safety-validation.js";
|
|
4
|
+
import { assertSameSet, invalid, requireKnownRefs, unique, } from "./design-resource-symbolic-validation-support.js";
|
|
5
|
+
export function validateSymbolicSubjectPopulationClosure(manifest, target, indexes, resources, contents, compilation) {
|
|
6
|
+
validateSubjects(manifest, target.key, indexes);
|
|
7
|
+
validatePopulations(manifest, target, indexes, resources, contents, compilation);
|
|
8
|
+
}
|
|
9
|
+
export function validateSymbolicCensusClosure(manifest, indexes) {
|
|
10
|
+
validateCensusClosure(manifest, indexes);
|
|
11
|
+
}
|
|
12
|
+
function validateSubjects(manifest, targetKey, indexes) {
|
|
13
|
+
const stableKeys = [];
|
|
14
|
+
for (const subject of manifest.subjects) {
|
|
15
|
+
if (!subject.stable_keys.length)
|
|
16
|
+
invalid("v2_subject_stable_keys_required", subject.key);
|
|
17
|
+
unique(subject.stable_keys, `v2_subject_stable_key_duplicate:${subject.key}`);
|
|
18
|
+
stableKeys.push(...subject.stable_keys);
|
|
19
|
+
assertSameSet(subject.target_refs, [targetKey], "v2_subject_target_mismatch", subject.key);
|
|
20
|
+
requireKnownRefs(subject.census_refs, indexes.census, "v2_subject_census_unknown");
|
|
21
|
+
if (subject.population_ref &&
|
|
22
|
+
!indexes.populations.has(subject.population_ref))
|
|
23
|
+
invalid("v2_subject_population_unknown", subject.key);
|
|
24
|
+
for (const ref of [
|
|
25
|
+
subject.parent_ref,
|
|
26
|
+
subject.instance_of_ref,
|
|
27
|
+
subject.override_of_ref,
|
|
28
|
+
subject.family_ref,
|
|
29
|
+
subject.portal_host_ref,
|
|
30
|
+
])
|
|
31
|
+
if (ref !== null && !indexes.subjects.has(ref))
|
|
32
|
+
invalid("v2_subject_hierarchy_ref_unknown", `${subject.key}:${ref}`);
|
|
33
|
+
unique(subject.relation_endpoints.map((item) => item.role), `v2_relation_endpoint_role_duplicate:${subject.key}`);
|
|
34
|
+
for (const endpoint of subject.relation_endpoints)
|
|
35
|
+
if (!indexes.subjects.has(endpoint.subject_ref))
|
|
36
|
+
invalid("v2_relation_endpoint_subject_unknown", `${subject.key}:${endpoint.subject_ref}`);
|
|
37
|
+
if (subject.kind === "relation" && subject.relation_endpoints.length < 2)
|
|
38
|
+
invalid("v2_relation_endpoints_incomplete", subject.key);
|
|
39
|
+
if (subject.presence === "always" && subject.presence_rule_ref !== null)
|
|
40
|
+
invalid("v2_subject_always_presence_rule_forbidden", subject.key);
|
|
41
|
+
}
|
|
42
|
+
unique(stableKeys, "v2_subject_stable_key_ambiguous");
|
|
43
|
+
}
|
|
44
|
+
function validatePopulations(manifest, target, indexes, resources, contents, compilation) {
|
|
45
|
+
const targetResources = new Set(target.resource_refs);
|
|
46
|
+
for (const population of manifest.populations) {
|
|
47
|
+
requireKnownRefs(population.member_subject_refs, indexes.subjects, "v2_population_subject_unknown");
|
|
48
|
+
assertSameSet(population.member_subject_refs, manifest.subjects
|
|
49
|
+
.filter((subject) => subject.population_ref === population.key)
|
|
50
|
+
.map((subject) => subject.key), "v2_population_member_set_mismatch", population.key);
|
|
51
|
+
if ((population.kind === "static" && population.enumeration !== "complete") ||
|
|
52
|
+
(population.kind === "dynamic" &&
|
|
53
|
+
population.enumeration !== "symbolic_partition"))
|
|
54
|
+
invalid("v2_population_enumeration_mismatch", population.key);
|
|
55
|
+
validateDesignResourceLocatedDigest(population.universe, resources, contents, `v2.population.${population.key}.universe`);
|
|
56
|
+
if (!targetResources.has(population.universe.locator.resource_ref))
|
|
57
|
+
invalid("v2_population_resource_outside_target", population.key);
|
|
58
|
+
validateSymbolicQuantifier(population.quantifier, population.key);
|
|
59
|
+
unique(population.exclusions.map((item) => item.key), `v2_population_exclusion_key_duplicate:${population.key}`);
|
|
60
|
+
for (const exclusion of population.exclusions) {
|
|
61
|
+
if (!exclusion.basis_refs.length)
|
|
62
|
+
invalid("v2_population_exclusion_basis_required", exclusion.key);
|
|
63
|
+
const compiled = compilation.compile(exclusion.region);
|
|
64
|
+
assertNoUnprovedOmittedAxes(compiled, exclusion.key);
|
|
65
|
+
validateSymbolicRegionWithinReachable(exclusion.region, manifest.reachable_region, exclusion.key, compilation);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function validateCensusClosure(manifest, indexes) {
|
|
70
|
+
const rules = new Map(manifest.fact_rules.map((item) => [item.key, item]));
|
|
71
|
+
for (const row of manifest.inspector.census) {
|
|
72
|
+
requireKnownRefs(row.fact_refs, rules, "v2_census_rule_unknown");
|
|
73
|
+
requireKnownRefs(row.source_item_refs, indexes.sourceItems, "v2_census_source_item_unknown");
|
|
74
|
+
if (!row.source_item_refs.length || !row.basis_refs.length)
|
|
75
|
+
invalid("v2_census_basis_source_required", row.key);
|
|
76
|
+
unique(row.fact_refs, `v2_census_rule_ref_duplicate:${row.key}`);
|
|
77
|
+
assertSameSet(row.fact_refs, (indexes.rulesByCensus.get(row.key) ?? []).map((rule) => rule.key), "v2_census_rule_set_mismatch", row.key);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DesignResourceObservableRuleManifestV2, DesignResourceSymbolicDependencyEdgeV2, DesignResourceSymbolicFactRuleV2, DesignResourceSymbolicNoninterferenceCertificateV2 } from "./design-resource-symbolic-fact-types.js";
|
|
2
|
+
export declare function designResourceSymbolicRuleKey(rule: Omit<DesignResourceSymbolicFactRuleV2, "key" | "semantic_obligation_refs">, regionSha256: string): string;
|
|
3
|
+
export declare function designResourceSymbolicObligationKey(obligation: Omit<DesignResourceObservableRuleManifestV2["semantic_proof_obligations"][number], "key">): string;
|
|
4
|
+
export declare function designResourceSymbolicDependencyEdge(axisRef: string, factRuleRef: string): DesignResourceSymbolicDependencyEdgeV2;
|
|
5
|
+
export declare function designResourceSymbolicCertificateKey(certificate: Omit<DesignResourceSymbolicNoninterferenceCertificateV2, "key">): string;
|
|
6
|
+
export declare function designResourceSymbolicNoninterferenceProofDigest(proof: DesignResourceSymbolicNoninterferenceCertificateV2["source_noninterference_proof"]): string | null;
|
|
7
|
+
export declare function designResourceSymbolicCombinedRuleDigest(ruleProjections: Array<{
|
|
8
|
+
rule: {
|
|
9
|
+
key: string;
|
|
10
|
+
};
|
|
11
|
+
compiled_region: {
|
|
12
|
+
canonical_sha256: string;
|
|
13
|
+
};
|
|
14
|
+
}>): string;
|
|
15
|
+
export declare function omitRuleIdentityFields(rule: DesignResourceSymbolicFactRuleV2): Omit<DesignResourceSymbolicFactRuleV2, "key" | "semantic_obligation_refs">;
|
|
16
|
+
export declare function omitKey<T extends {
|
|
17
|
+
key: string;
|
|
18
|
+
}>(value: T): Omit<T, "key">;
|
|
19
|
+
export declare function requireExactRefs<T>(refs: string[], values: Map<string, T>, code: string): void;
|
|
20
|
+
export declare function requireKnownRefs(refs: string[], values: ReadonlyMap<string, unknown> | ReadonlySet<string>, code: string): void;
|
|
21
|
+
export declare function unique(values: string[], code: string): void;
|
|
22
|
+
export declare function assertSameSet(actual: string[], expected: string[], code: string, detail: string): void;
|
|
23
|
+
export declare function assertCanonicalSet<T extends {
|
|
24
|
+
key: string;
|
|
25
|
+
}>(actual: T[], expected: T[], code: string): void;
|
|
26
|
+
export declare function stableJson(value: unknown): string;
|
|
27
|
+
export declare function sha256(value: string): string;
|
|
28
|
+
export declare function compareText(left: string, right: string): number;
|
|
29
|
+
export declare function invalid(code: string, detail: string): never;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { invalidDesignResourceHandoff } from "./design-resource-handoff-validation-primitives.js";
|
|
3
|
+
const ALL_EFFECTS = [
|
|
4
|
+
"disposition",
|
|
5
|
+
"expected_semantics",
|
|
6
|
+
"proof_denotation",
|
|
7
|
+
];
|
|
8
|
+
export function designResourceSymbolicRuleKey(rule, regionSha256) {
|
|
9
|
+
return `rule.${sha256(stableJson({
|
|
10
|
+
subject_or_relation_ref: rule.subject_or_relation_ref,
|
|
11
|
+
target_ref: rule.target_ref,
|
|
12
|
+
property_ref: rule.property_ref,
|
|
13
|
+
population_ref: rule.population_ref,
|
|
14
|
+
quantifier: rule.quantifier,
|
|
15
|
+
region_sha256: regionSha256,
|
|
16
|
+
expected: rule.expected,
|
|
17
|
+
value_kind: rule.value_kind,
|
|
18
|
+
provenance_ref: rule.provenance_ref,
|
|
19
|
+
observation_scope: rule.observation_scope,
|
|
20
|
+
observation_sensitivity: rule.observation_sensitivity,
|
|
21
|
+
lineage: rule.lineage,
|
|
22
|
+
evidence_refs: [...rule.evidence_refs].sort(compareText),
|
|
23
|
+
census_refs: [...rule.census_refs].sort(compareText),
|
|
24
|
+
source_item_refs: [...rule.source_item_refs].sort(compareText),
|
|
25
|
+
}))}`;
|
|
26
|
+
}
|
|
27
|
+
export function designResourceSymbolicObligationKey(obligation) {
|
|
28
|
+
return `obligation.${sha256(stableJson(obligation))}`;
|
|
29
|
+
}
|
|
30
|
+
export function designResourceSymbolicDependencyEdge(axisRef, factRuleRef) {
|
|
31
|
+
const body = {
|
|
32
|
+
axis_ref: axisRef,
|
|
33
|
+
fact_rule_ref: factRuleRef,
|
|
34
|
+
effects: [...ALL_EFFECTS],
|
|
35
|
+
};
|
|
36
|
+
return { key: `edge.${sha256(stableJson(body))}`, ...body };
|
|
37
|
+
}
|
|
38
|
+
export function designResourceSymbolicCertificateKey(certificate) {
|
|
39
|
+
return `certificate.${sha256(stableJson({
|
|
40
|
+
...certificate,
|
|
41
|
+
fact_rule_refs: [...certificate.fact_rule_refs].sort(compareText),
|
|
42
|
+
omitted_axis_refs: [...certificate.omitted_axis_refs].sort(compareText),
|
|
43
|
+
dependency_edge_refs: [...certificate.dependency_edge_refs].sort(compareText),
|
|
44
|
+
}))}`;
|
|
45
|
+
}
|
|
46
|
+
export function designResourceSymbolicNoninterferenceProofDigest(proof) {
|
|
47
|
+
return proof ? sha256(stableJson(proof)) : null;
|
|
48
|
+
}
|
|
49
|
+
export function designResourceSymbolicCombinedRuleDigest(ruleProjections) {
|
|
50
|
+
return sha256(stableJson(ruleProjections
|
|
51
|
+
.map((projection) => ({
|
|
52
|
+
rule_ref: projection.rule.key,
|
|
53
|
+
region_sha256: projection.compiled_region.canonical_sha256,
|
|
54
|
+
}))
|
|
55
|
+
.sort((left, right) => compareText(left.rule_ref, right.rule_ref))));
|
|
56
|
+
}
|
|
57
|
+
export function omitRuleIdentityFields(rule) {
|
|
58
|
+
const { key: _key, semantic_obligation_refs: _refs, ...value } = rule;
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
export function omitKey(value) {
|
|
62
|
+
const { key: _key, ...rest } = value;
|
|
63
|
+
return rest;
|
|
64
|
+
}
|
|
65
|
+
export function requireExactRefs(refs, values, code) {
|
|
66
|
+
unique(refs, `${code}_duplicate`);
|
|
67
|
+
requireKnownRefs(refs, values, `${code}_unknown`);
|
|
68
|
+
}
|
|
69
|
+
export function requireKnownRefs(refs, values, code) {
|
|
70
|
+
for (const ref of refs)
|
|
71
|
+
if (!values.has(ref))
|
|
72
|
+
invalid(code, ref);
|
|
73
|
+
}
|
|
74
|
+
export function unique(values, code) {
|
|
75
|
+
if (new Set(values).size !== values.length)
|
|
76
|
+
invalid(code, "");
|
|
77
|
+
}
|
|
78
|
+
export function assertSameSet(actual, expected, code, detail) {
|
|
79
|
+
const left = [...new Set(actual)].sort(compareText);
|
|
80
|
+
const right = [...new Set(expected)].sort(compareText);
|
|
81
|
+
if (left.length !== right.length ||
|
|
82
|
+
left.some((item, index) => item !== right[index]))
|
|
83
|
+
invalid(code, `${detail}:${left.join(",")}:${right.join(",")}`);
|
|
84
|
+
}
|
|
85
|
+
export function assertCanonicalSet(actual, expected, code) {
|
|
86
|
+
const left = new Map(actual.map((item) => [item.key, stableJson(item)]));
|
|
87
|
+
const right = new Map(expected.map((item) => [item.key, stableJson(item)]));
|
|
88
|
+
assertSameSet([...left.keys()], [...right.keys()], code, "keys");
|
|
89
|
+
for (const [key, value] of right)
|
|
90
|
+
if (left.get(key) !== value)
|
|
91
|
+
invalid(code, key);
|
|
92
|
+
}
|
|
93
|
+
export function stableJson(value) {
|
|
94
|
+
if (Array.isArray(value))
|
|
95
|
+
return `[${value.map((item) => stableJson(item)).join(",")}]`;
|
|
96
|
+
if (value && typeof value === "object")
|
|
97
|
+
return `{${Object.entries(value)
|
|
98
|
+
.sort(([left], [right]) => compareText(left, right))
|
|
99
|
+
.map(([key, entry]) => `${JSON.stringify(key)}:${stableJson(entry)}`)
|
|
100
|
+
.join(",")}}`;
|
|
101
|
+
return JSON.stringify(value);
|
|
102
|
+
}
|
|
103
|
+
export function sha256(value) {
|
|
104
|
+
return createHash("sha256").update(value).digest("hex");
|
|
105
|
+
}
|
|
106
|
+
export function compareText(left, right) {
|
|
107
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
108
|
+
}
|
|
109
|
+
export function invalid(code, detail) {
|
|
110
|
+
invalidDesignResourceHandoff(code, detail);
|
|
111
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const V1_SCHEMA = "design-resource-observable-fact-manifest-v1";
|
|
2
|
+
export declare const DESIGN_RESOURCE_V1_REGENERATION_GUIDANCE = "regenerate_as=design-resource-handoff-v2:fact_model=symbolic_rules_v2";
|
|
3
|
+
export interface DesignResourceV1CapacityHeader {
|
|
4
|
+
schema_version: typeof V1_SCHEMA;
|
|
5
|
+
collection_counts: ReadonlyMap<string, number>;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseDesignResourceV1CapacityHeader(prefix: string): DesignResourceV1CapacityHeader;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { invalidDesignResourceHandoff } from "./design-resource-handoff-validation-primitives.js";
|
|
2
|
+
import { DESIGN_RESOURCE_SYMBOLIC_FACT_POLICY } from "./design-resource-symbolic-fact-policy.js";
|
|
3
|
+
const V1_SCHEMA = "design-resource-observable-fact-manifest-v1";
|
|
4
|
+
export const DESIGN_RESOURCE_V1_REGENERATION_GUIDANCE = "regenerate_as=design-resource-handoff-v2:fact_model=symbolic_rules_v2";
|
|
5
|
+
export function parseDesignResourceV1CapacityHeader(prefix) {
|
|
6
|
+
try {
|
|
7
|
+
const reader = new BoundedJsonReader(prefix);
|
|
8
|
+
const header = reader.readRootHeader();
|
|
9
|
+
if (header.first_key !== "schema_version")
|
|
10
|
+
invalid("v1_manifest_capacity_header_order_invalid", `first_key=${header.first_key ?? "missing"}:required=schema_version`);
|
|
11
|
+
if (header.schema_version !== V1_SCHEMA)
|
|
12
|
+
invalid("v1_manifest_capacity_header_schema_invalid", `schema_version=${String(header.schema_version)}`);
|
|
13
|
+
if (!header.generation)
|
|
14
|
+
invalid("v1_manifest_capacity_header_missing_or_late", `prefix_limit=${DESIGN_RESOURCE_SYMBOLIC_FACT_POLICY.v1_capacity.capacity_header_prefix_max_bytes}:${DESIGN_RESOURCE_V1_REGENERATION_GUIDANCE}`);
|
|
15
|
+
const collections = objectValue(header.generation, "v1_manifest_capacity_header_generation_invalid").collections;
|
|
16
|
+
if (!Array.isArray(collections))
|
|
17
|
+
invalid("v1_manifest_capacity_header_collections_invalid", "not_array");
|
|
18
|
+
const collectionCounts = new Map();
|
|
19
|
+
for (const value of collections) {
|
|
20
|
+
const collection = objectValue(value, "v1_manifest_capacity_header_collection_invalid");
|
|
21
|
+
if (typeof collection.name !== "string" || !collection.name)
|
|
22
|
+
invalid("v1_manifest_capacity_header_collection_name_invalid", "");
|
|
23
|
+
if (typeof collection.expected_count !== "number" ||
|
|
24
|
+
!Number.isSafeInteger(collection.expected_count) ||
|
|
25
|
+
collection.expected_count < 0)
|
|
26
|
+
invalid("v1_manifest_capacity_header_expected_count_invalid", collection.name);
|
|
27
|
+
if (collectionCounts.has(collection.name))
|
|
28
|
+
invalid("v1_manifest_capacity_header_collection_duplicate", collection.name);
|
|
29
|
+
collectionCounts.set(collection.name, collection.expected_count);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
schema_version: V1_SCHEMA,
|
|
33
|
+
collection_counts: collectionCounts,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (error instanceof Error &&
|
|
38
|
+
error.message.startsWith("design_resource_handoff_invalid:"))
|
|
39
|
+
throw error;
|
|
40
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
41
|
+
invalid("v1_manifest_capacity_header_missing_or_late", `prefix_limit=${DESIGN_RESOURCE_SYMBOLIC_FACT_POLICY.v1_capacity.capacity_header_prefix_max_bytes}:reason=${message}:${DESIGN_RESOURCE_V1_REGENERATION_GUIDANCE}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
class BoundedJsonReader {
|
|
45
|
+
input;
|
|
46
|
+
offset = 0;
|
|
47
|
+
depth = 0;
|
|
48
|
+
constructor(input) {
|
|
49
|
+
this.input = input;
|
|
50
|
+
}
|
|
51
|
+
readRootHeader() {
|
|
52
|
+
this.whitespace();
|
|
53
|
+
this.character("{");
|
|
54
|
+
const result = {
|
|
55
|
+
first_key: null,
|
|
56
|
+
schema_version: undefined,
|
|
57
|
+
generation: undefined,
|
|
58
|
+
};
|
|
59
|
+
this.whitespace();
|
|
60
|
+
if (this.peek() === "}")
|
|
61
|
+
throw new Error("root_empty");
|
|
62
|
+
for (;;) {
|
|
63
|
+
const key = this.string();
|
|
64
|
+
result.first_key ??= key;
|
|
65
|
+
this.whitespace();
|
|
66
|
+
this.character(":");
|
|
67
|
+
this.whitespace();
|
|
68
|
+
const value = this.value();
|
|
69
|
+
if (key === "schema_version")
|
|
70
|
+
result.schema_version = value;
|
|
71
|
+
if (key === "generation") {
|
|
72
|
+
result.generation = value;
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
this.whitespace();
|
|
76
|
+
const delimiter = this.peek();
|
|
77
|
+
if (delimiter === "}")
|
|
78
|
+
return result;
|
|
79
|
+
this.character(",");
|
|
80
|
+
this.whitespace();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
value() {
|
|
84
|
+
if (++this.depth > 64)
|
|
85
|
+
throw new Error("depth_limit");
|
|
86
|
+
try {
|
|
87
|
+
const next = this.peek();
|
|
88
|
+
if (next === '"')
|
|
89
|
+
return this.string();
|
|
90
|
+
if (next === "{")
|
|
91
|
+
return this.object();
|
|
92
|
+
if (next === "[")
|
|
93
|
+
return this.array();
|
|
94
|
+
if (next === "t")
|
|
95
|
+
return this.literal("true", true);
|
|
96
|
+
if (next === "f")
|
|
97
|
+
return this.literal("false", false);
|
|
98
|
+
if (next === "n")
|
|
99
|
+
return this.literal("null", null);
|
|
100
|
+
return this.number();
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
this.depth -= 1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
object() {
|
|
107
|
+
const value = {};
|
|
108
|
+
this.character("{");
|
|
109
|
+
this.whitespace();
|
|
110
|
+
if (this.peek() === "}") {
|
|
111
|
+
this.offset += 1;
|
|
112
|
+
return value;
|
|
113
|
+
}
|
|
114
|
+
for (;;) {
|
|
115
|
+
const key = this.string();
|
|
116
|
+
if (Object.hasOwn(value, key))
|
|
117
|
+
throw new Error(`duplicate_key:${key}`);
|
|
118
|
+
this.whitespace();
|
|
119
|
+
this.character(":");
|
|
120
|
+
this.whitespace();
|
|
121
|
+
value[key] = this.value();
|
|
122
|
+
this.whitespace();
|
|
123
|
+
if (this.peek() === "}") {
|
|
124
|
+
this.offset += 1;
|
|
125
|
+
return value;
|
|
126
|
+
}
|
|
127
|
+
this.character(",");
|
|
128
|
+
this.whitespace();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
array() {
|
|
132
|
+
const value = [];
|
|
133
|
+
this.character("[");
|
|
134
|
+
this.whitespace();
|
|
135
|
+
if (this.peek() === "]") {
|
|
136
|
+
this.offset += 1;
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
for (;;) {
|
|
140
|
+
value.push(this.value());
|
|
141
|
+
this.whitespace();
|
|
142
|
+
if (this.peek() === "]") {
|
|
143
|
+
this.offset += 1;
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
this.character(",");
|
|
147
|
+
this.whitespace();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
string() {
|
|
151
|
+
this.character('"');
|
|
152
|
+
let value = "";
|
|
153
|
+
for (;;) {
|
|
154
|
+
if (this.offset >= this.input.length)
|
|
155
|
+
throw new Error("prefix_ended");
|
|
156
|
+
const character = this.input[this.offset++];
|
|
157
|
+
if (character === '"')
|
|
158
|
+
return value;
|
|
159
|
+
if (character === "\\") {
|
|
160
|
+
if (this.offset >= this.input.length)
|
|
161
|
+
throw new Error("prefix_ended");
|
|
162
|
+
const escaped = this.input[this.offset++];
|
|
163
|
+
const simple = {
|
|
164
|
+
'"': '"',
|
|
165
|
+
"\\": "\\",
|
|
166
|
+
"/": "/",
|
|
167
|
+
b: "\b",
|
|
168
|
+
f: "\f",
|
|
169
|
+
n: "\n",
|
|
170
|
+
r: "\r",
|
|
171
|
+
t: "\t",
|
|
172
|
+
};
|
|
173
|
+
if (escaped in simple)
|
|
174
|
+
value += simple[escaped];
|
|
175
|
+
else if (escaped === "u") {
|
|
176
|
+
const hex = this.input.slice(this.offset, this.offset + 4);
|
|
177
|
+
if (!/^[0-9a-fA-F]{4}$/u.test(hex))
|
|
178
|
+
throw new Error("unicode_escape_invalid");
|
|
179
|
+
value += String.fromCharCode(Number.parseInt(hex, 16));
|
|
180
|
+
this.offset += 4;
|
|
181
|
+
}
|
|
182
|
+
else
|
|
183
|
+
throw new Error("escape_invalid");
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
if (character.charCodeAt(0) < 0x20)
|
|
187
|
+
throw new Error("string_control_character");
|
|
188
|
+
value += character;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
number() {
|
|
193
|
+
const remaining = this.input.slice(this.offset);
|
|
194
|
+
const match = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/u.exec(remaining);
|
|
195
|
+
if (!match)
|
|
196
|
+
throw new Error("number_invalid");
|
|
197
|
+
this.offset += match[0].length;
|
|
198
|
+
const value = Number(match[0]);
|
|
199
|
+
if (!Number.isFinite(value))
|
|
200
|
+
throw new Error("number_non_finite");
|
|
201
|
+
return value;
|
|
202
|
+
}
|
|
203
|
+
literal(token, value) {
|
|
204
|
+
if (this.input.slice(this.offset, this.offset + token.length) !== token)
|
|
205
|
+
throw new Error(`literal_invalid:${token}`);
|
|
206
|
+
this.offset += token.length;
|
|
207
|
+
return value;
|
|
208
|
+
}
|
|
209
|
+
whitespace() {
|
|
210
|
+
while (/\s/u.test(this.input[this.offset] ?? ""))
|
|
211
|
+
this.offset += 1;
|
|
212
|
+
}
|
|
213
|
+
character(expected) {
|
|
214
|
+
if (this.input[this.offset] !== expected)
|
|
215
|
+
throw new Error(`expected:${expected}:at=${this.offset}`);
|
|
216
|
+
this.offset += 1;
|
|
217
|
+
}
|
|
218
|
+
peek() {
|
|
219
|
+
if (this.offset >= this.input.length)
|
|
220
|
+
throw new Error("prefix_ended");
|
|
221
|
+
return this.input[this.offset];
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function objectValue(value, code) {
|
|
225
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
226
|
+
invalid(code, "not_object");
|
|
227
|
+
return value;
|
|
228
|
+
}
|
|
229
|
+
function invalid(code, detail) {
|
|
230
|
+
invalidDesignResourceHandoff(code, detail);
|
|
231
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DesignResourceV1CapacityHeader } from "./design-resource-v1-capacity-header.js";
|
|
2
|
+
export { parseDesignResourceV1CapacityHeader } from "./design-resource-v1-capacity-header.js";
|
|
3
|
+
export type { DesignResourceV1CapacityHeader } from "./design-resource-v1-capacity-header.js";
|
|
4
|
+
export declare function assertDesignResourceV1HandoffCapacity(file: string): Promise<void>;
|
|
5
|
+
export declare function assertDesignResourceV1ManifestCapacity(file: string): Promise<DesignResourceV1CapacityHeader>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { open, stat } from "node:fs/promises";
|
|
2
|
+
import { invalidDesignResourceHandoff } from "./design-resource-handoff-validation-primitives.js";
|
|
3
|
+
import { DESIGN_RESOURCE_SYMBOLIC_FACT_POLICY } from "./design-resource-symbolic-fact-policy.js";
|
|
4
|
+
import { DESIGN_RESOURCE_V1_REGENERATION_GUIDANCE, parseDesignResourceV1CapacityHeader, } from "./design-resource-v1-capacity-header.js";
|
|
5
|
+
export { parseDesignResourceV1CapacityHeader } from "./design-resource-v1-capacity-header.js";
|
|
6
|
+
export async function assertDesignResourceV1HandoffCapacity(file) {
|
|
7
|
+
const bytes = (await stat(file)).size;
|
|
8
|
+
const limit = DESIGN_RESOURCE_SYMBOLIC_FACT_POLICY.v1_capacity.embedded_handoff_max_bytes;
|
|
9
|
+
if (bytes > limit)
|
|
10
|
+
invalid("v1_handoff_capacity_exceeded", `bytes=${bytes}:limit=${limit}:${DESIGN_RESOURCE_V1_REGENERATION_GUIDANCE}`);
|
|
11
|
+
}
|
|
12
|
+
export async function assertDesignResourceV1ManifestCapacity(file) {
|
|
13
|
+
const bytes = (await stat(file)).size;
|
|
14
|
+
const policy = DESIGN_RESOURCE_SYMBOLIC_FACT_POLICY.v1_capacity;
|
|
15
|
+
if (bytes > policy.canonical_manifest_max_bytes)
|
|
16
|
+
invalid("v1_manifest_capacity_exceeded", `bytes=${bytes}:limit=${policy.canonical_manifest_max_bytes}:${DESIGN_RESOURCE_V1_REGENERATION_GUIDANCE}`);
|
|
17
|
+
const prefixBytes = Math.min(bytes, policy.capacity_header_prefix_max_bytes);
|
|
18
|
+
const buffer = Buffer.alloc(prefixBytes);
|
|
19
|
+
const handle = await open(file, "r");
|
|
20
|
+
try {
|
|
21
|
+
let offset = 0;
|
|
22
|
+
while (offset < prefixBytes) {
|
|
23
|
+
const result = await handle.read(buffer, offset, prefixBytes - offset, offset);
|
|
24
|
+
if (result.bytesRead === 0)
|
|
25
|
+
break;
|
|
26
|
+
offset += result.bytesRead;
|
|
27
|
+
}
|
|
28
|
+
if (offset !== prefixBytes)
|
|
29
|
+
invalid("v1_manifest_capacity_header_read_incomplete", `bytes_read=${offset}:expected=${prefixBytes}`);
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
await handle.close();
|
|
33
|
+
}
|
|
34
|
+
const text = new TextDecoder("utf-8", { fatal: true }).decode(buffer);
|
|
35
|
+
const header = parseDesignResourceV1CapacityHeader(text);
|
|
36
|
+
const expectedFactCells = header.collection_counts.get("fact_cells");
|
|
37
|
+
if (expectedFactCells === undefined)
|
|
38
|
+
invalid("v1_manifest_capacity_header_fact_cells_missing", DESIGN_RESOURCE_V1_REGENERATION_GUIDANCE);
|
|
39
|
+
if (expectedFactCells > policy.expected_fact_cells_max)
|
|
40
|
+
invalid("v1_fact_cell_capacity_exceeded", `expected_count=${expectedFactCells}:limit=${policy.expected_fact_cells_max}:${DESIGN_RESOURCE_V1_REGENERATION_GUIDANCE}`);
|
|
41
|
+
return header;
|
|
42
|
+
}
|
|
43
|
+
function invalid(code, detail) {
|
|
44
|
+
invalidDesignResourceHandoff(code, detail);
|
|
45
|
+
}
|
package/dist/lib/init.js
CHANGED
|
@@ -25,6 +25,7 @@ export async function runInit(projectRoot, options) {
|
|
|
25
25
|
await createDesignMd(projectRoot, report);
|
|
26
26
|
const syncReport = await runSync(projectRoot);
|
|
27
27
|
report.push(`sync changed=${syncReport.changed.length} skipped=${syncReport.skipped.length} blocked=${syncReport.blocked.length}`);
|
|
28
|
+
report.push(...(syncReport.notices ?? []));
|
|
28
29
|
report.push(options.adopt ? "adopt mode complete" : "init complete");
|
|
29
30
|
return report;
|
|
30
31
|
}
|
|
@@ -10,7 +10,7 @@ export function parseCounterfactuals(value, label) {
|
|
|
10
10
|
"check_key",
|
|
11
11
|
"mutation",
|
|
12
12
|
"expected_assertion_failures",
|
|
13
|
-
], ["preserved_assertions"]);
|
|
13
|
+
], ["preserved_assertions", "allowed_fanout_assertions"]);
|
|
14
14
|
const mutation = object(row.mutation, `${itemLabel}.mutation`, ["type"], [
|
|
15
15
|
"paths",
|
|
16
16
|
"path",
|
|
@@ -36,6 +36,9 @@ export function parseCounterfactuals(value, label) {
|
|
|
36
36
|
preserved_assertions: Object.hasOwn(row, "preserved_assertions")
|
|
37
37
|
? strings(row.preserved_assertions, `${itemLabel}.preserved_assertions`).map((item, assertionIndex) => key(item, `${itemLabel}.preserved_assertions[${assertionIndex}]`))
|
|
38
38
|
: [],
|
|
39
|
+
allowed_fanout_assertions: Object.hasOwn(row, "allowed_fanout_assertions")
|
|
40
|
+
? strings(row.allowed_fanout_assertions, `${itemLabel}.allowed_fanout_assertions`).map((item, assertionIndex) => key(item, `${itemLabel}.allowed_fanout_assertions[${assertionIndex}]`))
|
|
41
|
+
: [],
|
|
39
42
|
};
|
|
40
43
|
});
|
|
41
44
|
}
|
|
@@ -49,7 +52,7 @@ export function parseGlobalCounterfactuals(value, label) {
|
|
|
49
52
|
"check_key",
|
|
50
53
|
"mutation",
|
|
51
54
|
"expected_assertion_failures",
|
|
52
|
-
], ["preserved_assertions"]);
|
|
55
|
+
], ["preserved_assertions", "allowed_fanout_assertions"]);
|
|
53
56
|
const bindingRef = string(row.binding_ref, `${itemLabel}.binding_ref`);
|
|
54
57
|
if (!/^[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*$/u.test(bindingRef))
|
|
55
58
|
fail(`${itemLabel}.binding_ref`, "must be <outcome-key>.<binding-key>");
|
|
@@ -69,6 +72,9 @@ export function parseGlobalCounterfactuals(value, label) {
|
|
|
69
72
|
preserved_assertions: Object.hasOwn(row, "preserved_assertions")
|
|
70
73
|
? strings(row.preserved_assertions, `${itemLabel}.preserved_assertions`).map((entry, assertionIndex) => key(entry, `${itemLabel}.preserved_assertions[${assertionIndex}]`))
|
|
71
74
|
: [],
|
|
75
|
+
allowed_fanout_assertions: Object.hasOwn(row, "allowed_fanout_assertions")
|
|
76
|
+
? strings(row.allowed_fanout_assertions, `${itemLabel}.allowed_fanout_assertions`).map((entry, assertionIndex) => key(entry, `${itemLabel}.allowed_fanout_assertions[${assertionIndex}]`))
|
|
77
|
+
: [],
|
|
72
78
|
};
|
|
73
79
|
});
|
|
74
80
|
}
|
|
@@ -9,6 +9,7 @@ import { validateRawExecutionObservationOwnership } from "./long-task-observatio
|
|
|
9
9
|
import { validateLongTaskDesignResourceHandoffs } from "./long-task-design-resource-handoff.js";
|
|
10
10
|
import { validateLongTaskSemanticFactClosure } from "./long-task-semantic-fact-closure.js";
|
|
11
11
|
import { freezeDeliveryCheck } from "./long-task-runner-freeze.js";
|
|
12
|
+
import { scopeDeliveryBindings } from "./long-task-scoped-binding.js";
|
|
12
13
|
import { classifyLongTaskRisk, validateRiskProof, } from "./long-task-risk.js";
|
|
13
14
|
import { validateSourceContinuity } from "./long-task-source-continuity.js";
|
|
14
15
|
import { compileSourceInventory } from "./long-task-source-inventory.js";
|
|
@@ -33,12 +34,13 @@ export async function validateContractForActivation(options) {
|
|
|
33
34
|
}
|
|
34
35
|
const sourceHashes = await attempt(mode, diagnostics, () => hashDeclaredFiles(repository, contract.task.source_paths, "source"));
|
|
35
36
|
await attempt(mode, diagnostics, () => validateSourceAnchors(repository, contract.source_claims));
|
|
37
|
+
let sourceBackedExecutionTargets = new Map();
|
|
36
38
|
const sourceItems = await attempt(mode, diagnostics, async () => {
|
|
37
39
|
const items = await compileSourceInventory(repository, contract.task.source_paths);
|
|
38
40
|
validateSourceContinuity(contract, items, mode === "collect"
|
|
39
41
|
? (error) => addDiagnosticError(diagnostics, new Error(error))
|
|
40
42
|
: undefined);
|
|
41
|
-
validateSourceTargetContinuity(contract, items, mode === "collect"
|
|
43
|
+
sourceBackedExecutionTargets = validateSourceTargetContinuity(contract, items, mode === "collect"
|
|
42
44
|
? (error) => addDiagnosticError(diagnostics, new Error(error))
|
|
43
45
|
: undefined);
|
|
44
46
|
return items;
|
|
@@ -61,12 +63,20 @@ export async function validateContractForActivation(options) {
|
|
|
61
63
|
});
|
|
62
64
|
if (!workspace)
|
|
63
65
|
return emptyCompiledResult(claims, risk, sourceHashes, sourceItems, context);
|
|
66
|
+
const observationAuthorityPaths = [
|
|
67
|
+
...workspace.files
|
|
68
|
+
.map((file) => file.path)
|
|
69
|
+
.filter((file) => file === workdirRelative || file.startsWith(`${workdirRelative}/`)),
|
|
70
|
+
`${workdirRelative}/delivery-contract.yaml`,
|
|
71
|
+
...Object.keys(sourceHashes ?? {}),
|
|
72
|
+
...(context?.files ?? []),
|
|
73
|
+
];
|
|
64
74
|
const globalChecks = [];
|
|
65
75
|
for (const check of contract.global.acceptance.checks) {
|
|
66
76
|
const executionTarget = contract.task.execution_targets.find((target) => target.key === check.execution_target.target_ref);
|
|
67
77
|
if (!executionTarget)
|
|
68
78
|
continue;
|
|
69
|
-
const frozen = await attempt(mode, diagnostics, () => freezeDeliveryCheck(check, null, repository, workspace, executionTarget, contract.task.execution_targets, [], []), null, check.key);
|
|
79
|
+
const frozen = await attempt(mode, diagnostics, () => freezeDeliveryCheck(check, null, repository, workspace, executionTarget, contract.task.execution_targets, [], [], contract.outcomes.flatMap((outcome) => scopeDeliveryBindings(outcome.key, outcome.technical.bindings)), contract.outcomes.flatMap((outcome) => outcome.product.owner.path_globs), sourceBackedExecutionTargets.get(executionTarget.key) ?? null, observationAuthorityPaths), null, check.key);
|
|
70
80
|
if (frozen)
|
|
71
81
|
globalChecks.push(frozen);
|
|
72
82
|
}
|
|
@@ -77,7 +87,7 @@ export async function validateContractForActivation(options) {
|
|
|
77
87
|
const executionTarget = contract.task.execution_targets.find((target) => target.key === check.execution_target.target_ref);
|
|
78
88
|
if (!executionTarget)
|
|
79
89
|
continue;
|
|
80
|
-
const frozen = await attempt(mode, diagnostics, () => freezeDeliveryCheck(check, outcome.key, repository, workspace, executionTarget, contract.task.execution_targets, designTargetsForCheck(outcome, check.key), semanticFactClosure?.expectations_by_check.get(check.key) ?? []), outcome.key, check.key);
|
|
90
|
+
const frozen = await attempt(mode, diagnostics, () => freezeDeliveryCheck(check, outcome.key, repository, workspace, executionTarget, contract.task.execution_targets, designTargetsForCheck(outcome, check.key), semanticFactClosure?.expectations_by_check.get(check.key) ?? [], scopeDeliveryBindings(outcome.key, outcome.technical.bindings), outcome.product.owner.path_globs, sourceBackedExecutionTargets.get(executionTarget.key) ?? null, observationAuthorityPaths), outcome.key, check.key);
|
|
81
91
|
if (frozen)
|
|
82
92
|
checks.push(frozen);
|
|
83
93
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { EvidenceCapabilityRecordV2 } from "./long-task-delivery-types.js";
|
|
2
|
+
import type { JsonPointerExactLocator } from "./long-task-json-pointer-observation.js";
|
|
3
|
+
export type AdmittedObservationCandidate = {
|
|
4
|
+
assertion_key: string;
|
|
5
|
+
identity_ref: string;
|
|
6
|
+
method: string;
|
|
7
|
+
actual_observation: {
|
|
8
|
+
artifact_path: string;
|
|
9
|
+
locator: JsonPointerExactLocator;
|
|
10
|
+
sensitivity: string;
|
|
11
|
+
};
|
|
12
|
+
comparison: {
|
|
13
|
+
comparator: string;
|
|
14
|
+
mode: string;
|
|
15
|
+
tolerance: unknown;
|
|
16
|
+
mask: unknown;
|
|
17
|
+
};
|
|
18
|
+
oracle: {
|
|
19
|
+
trust: string;
|
|
20
|
+
identity: string;
|
|
21
|
+
version: string;
|
|
22
|
+
sha256: string | null;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare function admittedObservationCandidates(records: EvidenceCapabilityRecordV2[]): AdmittedObservationCandidate[];
|