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,428 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { constants, watch } from "node:fs";
|
|
3
|
+
import { lstat, open, realpath } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { JSON_POINTER_EXACT_LIMITS, assertJsonTree, decodeUtf8Json, extractJsonPointerExactObservationFromBytes, normalizeObservationArtifactPath, parseJsonWithoutDuplicateKeys, resolveJsonPointer, } from "./long-task-json-pointer-observation.js";
|
|
6
|
+
export class StaticObservationFreezeError extends Error {
|
|
7
|
+
code;
|
|
8
|
+
artifact_path;
|
|
9
|
+
cause_code;
|
|
10
|
+
constructor(code, artifactPath, causeCode = null) {
|
|
11
|
+
super([code, artifactPath, causeCode]
|
|
12
|
+
.filter((value) => value !== null && value !== "")
|
|
13
|
+
.join(":"));
|
|
14
|
+
this.name = "StaticObservationFreezeError";
|
|
15
|
+
this.code = code;
|
|
16
|
+
this.artifact_path = artifactPath;
|
|
17
|
+
this.cause_code = causeCode;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function createObservationInputFreezeBudget(input) {
|
|
21
|
+
if (!Number.isSafeInteger(input.max_artifacts) ||
|
|
22
|
+
input.max_artifacts <= 0 ||
|
|
23
|
+
!Number.isSafeInteger(input.max_total_artifact_bytes) ||
|
|
24
|
+
input.max_total_artifact_bytes <= 0)
|
|
25
|
+
throw new Error("observation_input_freeze_budget_invalid");
|
|
26
|
+
return {
|
|
27
|
+
seen_artifact_paths: new Set(),
|
|
28
|
+
total_artifact_bytes: 0,
|
|
29
|
+
max_artifacts: input.max_artifacts,
|
|
30
|
+
max_total_artifact_bytes: input.max_total_artifact_bytes,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export async function freezeStaticObservationCarrier(input) {
|
|
34
|
+
const artifactPath = normalizeStaticArtifactPath(input.artifact_path);
|
|
35
|
+
assertArtifactCount(input.budget, artifactPath);
|
|
36
|
+
const prepared = await prepareFrozenObservationInput({
|
|
37
|
+
snapshot_root: input.snapshot_root,
|
|
38
|
+
workspace_manifest: input.workspace_manifest,
|
|
39
|
+
artifact_path: artifactPath,
|
|
40
|
+
max_file_bytes: JSON_POINTER_EXACT_LIMITS.max_file_bytes,
|
|
41
|
+
budget: input.input_freeze_budget,
|
|
42
|
+
retain_bytes: true,
|
|
43
|
+
});
|
|
44
|
+
accountForArtifact(input.budget, artifactPath, prepared.preRunIdentity.size);
|
|
45
|
+
const frozenBytes = prepared.frozenBytes;
|
|
46
|
+
if (!frozenBytes)
|
|
47
|
+
throw new Error("static_observation_frozen_bytes_missing");
|
|
48
|
+
return Object.freeze({
|
|
49
|
+
artifact_path: artifactPath,
|
|
50
|
+
manifest_membership: prepared.manifest,
|
|
51
|
+
pre_run_identity: prepared.preRunIdentity,
|
|
52
|
+
verifyPostRun: async () => {
|
|
53
|
+
try {
|
|
54
|
+
const postRunIdentity = await prepared.verifyPostRunIdentity();
|
|
55
|
+
return Object.freeze({
|
|
56
|
+
artifact_path: artifactPath,
|
|
57
|
+
manifest_membership: prepared.manifest,
|
|
58
|
+
pre_run_identity: prepared.preRunIdentity,
|
|
59
|
+
post_run_identity: postRunIdentity,
|
|
60
|
+
copyFrozenBytes: () => Uint8Array.from(frozenBytes),
|
|
61
|
+
extractJsonPointerExactObservation: (input) => extractJsonPointerExactObservationFromBytes({
|
|
62
|
+
artifact_path: artifactPath,
|
|
63
|
+
bytes: frozenBytes,
|
|
64
|
+
locator: input.locator,
|
|
65
|
+
sensitivity: input.sensitivity,
|
|
66
|
+
budget: input.budget,
|
|
67
|
+
}),
|
|
68
|
+
extractJsonPointerExactValue: (input) => {
|
|
69
|
+
const observation = extractJsonPointerExactObservationFromBytes({
|
|
70
|
+
artifact_path: artifactPath,
|
|
71
|
+
bytes: frozenBytes,
|
|
72
|
+
locator: input.locator,
|
|
73
|
+
sensitivity: input.sensitivity,
|
|
74
|
+
budget: input.budget,
|
|
75
|
+
});
|
|
76
|
+
const parsed = parseJsonWithoutDuplicateKeys(decodeUtf8Json(frozenBytes));
|
|
77
|
+
assertJsonTree(parsed, 0);
|
|
78
|
+
return {
|
|
79
|
+
raw_value: resolveJsonPointer(parsed, observation.locator.value),
|
|
80
|
+
observation,
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
prepared.dispose();
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
dispose: prepared.dispose,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export async function freezeObservationInputFile(input) {
|
|
93
|
+
const prepared = await prepareFrozenObservationInput({
|
|
94
|
+
...input,
|
|
95
|
+
retain_bytes: false,
|
|
96
|
+
});
|
|
97
|
+
return Object.freeze({
|
|
98
|
+
artifact_path: prepared.artifactPath,
|
|
99
|
+
manifest_membership: prepared.manifest,
|
|
100
|
+
pre_run_identity: prepared.preRunIdentity,
|
|
101
|
+
verifyPostRun: async () => {
|
|
102
|
+
try {
|
|
103
|
+
const postRunIdentity = await prepared.verifyPostRunIdentity();
|
|
104
|
+
return Object.freeze({
|
|
105
|
+
artifact_path: prepared.artifactPath,
|
|
106
|
+
manifest_membership: prepared.manifest,
|
|
107
|
+
pre_run_identity: prepared.preRunIdentity,
|
|
108
|
+
post_run_identity: postRunIdentity,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
prepared.dispose();
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
dispose: prepared.dispose,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
async function prepareFrozenObservationInput(input) {
|
|
119
|
+
const artifactPath = normalizeStaticArtifactPath(input.artifact_path);
|
|
120
|
+
const maxFileBytes = observationInputFileLimit(input.max_file_bytes);
|
|
121
|
+
const manifestEntry = manifestMembership(input.workspace_manifest, artifactPath);
|
|
122
|
+
assertObservationInputCount(input.budget, artifactPath);
|
|
123
|
+
const root = path.resolve(input.snapshot_root);
|
|
124
|
+
const captured = await captureStaticObservationFile(root, artifactPath, maxFileBytes, input.retain_bytes);
|
|
125
|
+
accountForObservationInput(input.budget, artifactPath, captured.identity.size);
|
|
126
|
+
const manifest = freezeManifestMembership(manifestEntry);
|
|
127
|
+
const preRunIdentity = freezeFileIdentity(captured.identity);
|
|
128
|
+
const frozenBytes = captured.bytes ? Buffer.from(captured.bytes) : null;
|
|
129
|
+
const mutationMonitor = monitorObservationInput(root, artifactPath);
|
|
130
|
+
return {
|
|
131
|
+
artifactPath,
|
|
132
|
+
manifest,
|
|
133
|
+
preRunIdentity,
|
|
134
|
+
frozenBytes,
|
|
135
|
+
verifyPostRunIdentity: async () => {
|
|
136
|
+
let post;
|
|
137
|
+
try {
|
|
138
|
+
await mutationMonitor.assertUnchanged();
|
|
139
|
+
post = await captureStaticObservationFile(root, artifactPath, maxFileBytes, false, preRunIdentity);
|
|
140
|
+
if (post.identity.content_sha256 !== preRunIdentity.content_sha256)
|
|
141
|
+
throw freezeError("static_observation_changed_by_runner", artifactPath, "content_sha256");
|
|
142
|
+
await mutationMonitor.assertUnchanged();
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
if (error instanceof StaticObservationFreezeError &&
|
|
146
|
+
error.code === "static_observation_changed_by_runner")
|
|
147
|
+
throw error;
|
|
148
|
+
throw freezeError("static_observation_changed_by_runner", artifactPath, freezeCause(error));
|
|
149
|
+
}
|
|
150
|
+
return freezeFileIdentity(post.identity);
|
|
151
|
+
},
|
|
152
|
+
dispose: mutationMonitor.dispose,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function monitorObservationInput(root, artifactPath) {
|
|
156
|
+
const absolute = path.resolve(root, ...artifactPath.split("/"));
|
|
157
|
+
let changedCause = null;
|
|
158
|
+
let disposed = false;
|
|
159
|
+
let watcher;
|
|
160
|
+
try {
|
|
161
|
+
watcher = watch(absolute, { persistent: false }, (eventType) => {
|
|
162
|
+
changedCause ??= `filesystem_event.${eventType}`;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
throw freezeError("static_observation_changed_by_runner", artifactPath, `monitor_unavailable.${nodeErrorCode(error)}`);
|
|
167
|
+
}
|
|
168
|
+
watcher.on("error", (error) => {
|
|
169
|
+
changedCause ??= `filesystem_monitor_error.${nodeErrorCode(error)}`;
|
|
170
|
+
});
|
|
171
|
+
return {
|
|
172
|
+
assertUnchanged: async () => {
|
|
173
|
+
await settleFilesystemEvents();
|
|
174
|
+
if (changedCause)
|
|
175
|
+
throw freezeError("static_observation_changed_by_runner", artifactPath, changedCause);
|
|
176
|
+
},
|
|
177
|
+
dispose: () => {
|
|
178
|
+
if (disposed)
|
|
179
|
+
return;
|
|
180
|
+
disposed = true;
|
|
181
|
+
watcher.close();
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
async function settleFilesystemEvents() {
|
|
186
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
187
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
188
|
+
}
|
|
189
|
+
const STATIC_OBSERVATION_METADATA_KEYS = Object.freeze([
|
|
190
|
+
"device",
|
|
191
|
+
"inode",
|
|
192
|
+
"mode",
|
|
193
|
+
"links",
|
|
194
|
+
"size",
|
|
195
|
+
"modified_time_ns",
|
|
196
|
+
"changed_time_ns",
|
|
197
|
+
"birth_time_ns",
|
|
198
|
+
]);
|
|
199
|
+
async function captureStaticObservationFile(root, artifactPath, maxFileBytes, retainBytes, expected) {
|
|
200
|
+
const rootInfo = await lstat(root, { bigint: true }).catch((error) => {
|
|
201
|
+
throw freezeError("static_observation_root_invalid", artifactPath, nodeErrorCode(error));
|
|
202
|
+
});
|
|
203
|
+
if (rootInfo.isSymbolicLink() || !rootInfo.isDirectory())
|
|
204
|
+
throw freezeError("static_observation_root_invalid", artifactPath);
|
|
205
|
+
const canonicalRoot = await realpath(root);
|
|
206
|
+
const absolute = path.resolve(root, ...artifactPath.split("/"));
|
|
207
|
+
assertContained(root, absolute, artifactPath);
|
|
208
|
+
const pathInfo = await inspectNoFollowPath(root, artifactPath, expected);
|
|
209
|
+
const canonicalFile = await realpath(absolute).catch((error) => {
|
|
210
|
+
throw freezeError(expected
|
|
211
|
+
? "static_observation_changed_by_runner"
|
|
212
|
+
: "static_observation_not_in_pre_run_snapshot", artifactPath, nodeErrorCode(error));
|
|
213
|
+
});
|
|
214
|
+
assertContained(canonicalRoot, canonicalFile, artifactPath);
|
|
215
|
+
const noFollow = typeof constants.O_NOFOLLOW === "number" ? constants.O_NOFOLLOW : 0;
|
|
216
|
+
const handle = await open(absolute, constants.O_RDONLY | noFollow).catch((error) => {
|
|
217
|
+
throw freezeError(expected
|
|
218
|
+
? "static_observation_changed_by_runner"
|
|
219
|
+
: openFailureCode(error), artifactPath, nodeErrorCode(error));
|
|
220
|
+
});
|
|
221
|
+
try {
|
|
222
|
+
const opened = await handle.stat({ bigint: true });
|
|
223
|
+
assertRegularFile(opened, artifactPath);
|
|
224
|
+
const openedMetadata = fileMetadata(opened);
|
|
225
|
+
assertMetadataEqual(pathInfo, openedMetadata, artifactPath, expected);
|
|
226
|
+
if (expected)
|
|
227
|
+
assertMetadataEqual(expected, openedMetadata, artifactPath, expected);
|
|
228
|
+
if (openedMetadata.size > maxFileBytes)
|
|
229
|
+
throw freezeError("static_observation_size_limit", artifactPath);
|
|
230
|
+
const content = await readAndHashBounded(handle, artifactPath, maxFileBytes, retainBytes);
|
|
231
|
+
const afterRead = fileMetadata(await handle.stat({ bigint: true }));
|
|
232
|
+
assertMetadataEqual(openedMetadata, afterRead, artifactPath, expected);
|
|
233
|
+
const pathAfter = fileMetadata(await lstat(absolute, { bigint: true }).catch((error) => {
|
|
234
|
+
throw freezeError(expected
|
|
235
|
+
? "static_observation_changed_by_runner"
|
|
236
|
+
: "static_observation_not_in_pre_run_snapshot", artifactPath, nodeErrorCode(error));
|
|
237
|
+
}));
|
|
238
|
+
assertMetadataEqual(afterRead, pathAfter, artifactPath, expected);
|
|
239
|
+
const canonicalAfter = await realpath(absolute);
|
|
240
|
+
assertContained(canonicalRoot, canonicalAfter, artifactPath);
|
|
241
|
+
if (canonicalAfter !== canonicalFile)
|
|
242
|
+
throw freezeError(expected
|
|
243
|
+
? "static_observation_changed_by_runner"
|
|
244
|
+
: "static_observation_symlink_not_allowed", artifactPath, "realpath_changed");
|
|
245
|
+
return {
|
|
246
|
+
identity: {
|
|
247
|
+
...openedMetadata,
|
|
248
|
+
content_sha256: content.sha256,
|
|
249
|
+
},
|
|
250
|
+
bytes: content.bytes,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
finally {
|
|
254
|
+
await handle.close();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
async function inspectNoFollowPath(root, artifactPath, expected) {
|
|
258
|
+
let current = root;
|
|
259
|
+
const segments = artifactPath.split("/");
|
|
260
|
+
for (const [index, segment] of segments.entries()) {
|
|
261
|
+
current = path.join(current, segment);
|
|
262
|
+
const info = await lstat(current, { bigint: true }).catch((error) => {
|
|
263
|
+
throw freezeError(expected
|
|
264
|
+
? "static_observation_changed_by_runner"
|
|
265
|
+
: "static_observation_not_in_pre_run_snapshot", artifactPath, nodeErrorCode(error));
|
|
266
|
+
});
|
|
267
|
+
if (info.isSymbolicLink())
|
|
268
|
+
throw freezeError(expected
|
|
269
|
+
? "static_observation_changed_by_runner"
|
|
270
|
+
: "static_observation_symlink_not_allowed", artifactPath, "symbolic_link");
|
|
271
|
+
if (index < segments.length - 1) {
|
|
272
|
+
if (!info.isDirectory())
|
|
273
|
+
throw freezeError(expected
|
|
274
|
+
? "static_observation_changed_by_runner"
|
|
275
|
+
: "static_observation_parent_not_directory", artifactPath);
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
assertRegularFile(info, artifactPath);
|
|
279
|
+
return fileMetadata(info);
|
|
280
|
+
}
|
|
281
|
+
throw freezeError("static_observation_path_escape", artifactPath);
|
|
282
|
+
}
|
|
283
|
+
function manifestMembership(manifest, artifactPath) {
|
|
284
|
+
const matches = manifest.files.filter((entry) => entry.path === artifactPath);
|
|
285
|
+
if (!matches.length)
|
|
286
|
+
throw freezeError("static_observation_not_in_pre_run_snapshot", artifactPath);
|
|
287
|
+
if (matches.length !== 1)
|
|
288
|
+
throw freezeError("static_observation_manifest_invalid", artifactPath);
|
|
289
|
+
const entry = matches[0];
|
|
290
|
+
if (!isManifestRegularFile(entry))
|
|
291
|
+
throw freezeError("static_observation_not_regular_file", artifactPath);
|
|
292
|
+
return {
|
|
293
|
+
path: entry.path,
|
|
294
|
+
mode: entry.mode,
|
|
295
|
+
declared_size: entry.size,
|
|
296
|
+
manifest_object_identity: entry.sha256,
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function isManifestRegularFile(entry) {
|
|
300
|
+
return (entry.mode & 0o170000) === 0o100000;
|
|
301
|
+
}
|
|
302
|
+
function normalizeStaticArtifactPath(value) {
|
|
303
|
+
try {
|
|
304
|
+
return normalizeObservationArtifactPath(value);
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
throw freezeError("static_observation_path_escape", value);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function assertRegularFile(info, artifactPath) {
|
|
311
|
+
if (info.isSymbolicLink())
|
|
312
|
+
throw freezeError("static_observation_symlink_not_allowed", artifactPath);
|
|
313
|
+
if (!info.isFile())
|
|
314
|
+
throw freezeError("static_observation_not_regular_file", artifactPath);
|
|
315
|
+
if (info.nlink > 1n)
|
|
316
|
+
throw freezeError("static_observation_hardlink_not_allowed", artifactPath);
|
|
317
|
+
}
|
|
318
|
+
function fileMetadata(info) {
|
|
319
|
+
return {
|
|
320
|
+
device: info.dev.toString(),
|
|
321
|
+
inode: info.ino.toString(),
|
|
322
|
+
mode: Number(info.mode),
|
|
323
|
+
links: info.nlink.toString(),
|
|
324
|
+
size: Number(info.size),
|
|
325
|
+
modified_time_ns: info.mtimeNs.toString(),
|
|
326
|
+
changed_time_ns: info.ctimeNs.toString(),
|
|
327
|
+
birth_time_ns: info.birthtimeNs.toString(),
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
function assertMetadataEqual(left, right, artifactPath, postRunExpected) {
|
|
331
|
+
const mismatch = STATIC_OBSERVATION_METADATA_KEYS.find((key) => left[key] !== right[key]);
|
|
332
|
+
if (!mismatch)
|
|
333
|
+
return;
|
|
334
|
+
throw freezeError(postRunExpected
|
|
335
|
+
? "static_observation_changed_by_runner"
|
|
336
|
+
: "static_observation_not_in_pre_run_snapshot", artifactPath, `file_identity.${mismatch}`);
|
|
337
|
+
}
|
|
338
|
+
async function readAndHashBounded(handle, artifactPath, limit, retainBytes) {
|
|
339
|
+
const buffer = Buffer.allocUnsafe(Math.min(65_536, limit + 1));
|
|
340
|
+
const chunks = [];
|
|
341
|
+
const hash = createHash("sha256");
|
|
342
|
+
let offset = 0;
|
|
343
|
+
while (true) {
|
|
344
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, offset);
|
|
345
|
+
if (!bytesRead)
|
|
346
|
+
break;
|
|
347
|
+
offset += bytesRead;
|
|
348
|
+
if (offset > limit)
|
|
349
|
+
throw freezeError("static_observation_size_limit", artifactPath);
|
|
350
|
+
const chunk = buffer.subarray(0, bytesRead);
|
|
351
|
+
hash.update(chunk);
|
|
352
|
+
if (retainBytes)
|
|
353
|
+
chunks.push(Buffer.from(chunk));
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
bytes: retainBytes ? Uint8Array.from(Buffer.concat(chunks, offset)) : null,
|
|
357
|
+
sha256: hash.digest("hex"),
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
function observationInputFileLimit(value) {
|
|
361
|
+
const limit = value;
|
|
362
|
+
if (!Number.isSafeInteger(limit) || limit <= 0)
|
|
363
|
+
throw new Error("observation_input_freeze_file_limit_invalid");
|
|
364
|
+
return limit;
|
|
365
|
+
}
|
|
366
|
+
function assertContained(root, target, artifactPath) {
|
|
367
|
+
const relative = path.relative(root, target);
|
|
368
|
+
if (relative === "" ||
|
|
369
|
+
relative === ".." ||
|
|
370
|
+
relative.startsWith(`..${path.sep}`) ||
|
|
371
|
+
path.isAbsolute(relative))
|
|
372
|
+
throw freezeError("static_observation_path_escape", artifactPath);
|
|
373
|
+
}
|
|
374
|
+
function assertArtifactCount(budget, artifactPath) {
|
|
375
|
+
if (budget &&
|
|
376
|
+
!budget.seen_artifact_paths.has(artifactPath) &&
|
|
377
|
+
budget.seen_artifact_paths.size >=
|
|
378
|
+
JSON_POINTER_EXACT_LIMITS.max_artifacts_per_check)
|
|
379
|
+
throw new Error("observation_artifact_count_limit");
|
|
380
|
+
}
|
|
381
|
+
function assertObservationInputCount(budget, artifactPath) {
|
|
382
|
+
if (budget &&
|
|
383
|
+
!budget.seen_artifact_paths.has(artifactPath) &&
|
|
384
|
+
budget.seen_artifact_paths.size >= budget.max_artifacts)
|
|
385
|
+
throw new Error("observation_input_freeze_artifact_count_limit");
|
|
386
|
+
}
|
|
387
|
+
function accountForObservationInput(budget, artifactPath, bytes) {
|
|
388
|
+
if (!budget || budget.seen_artifact_paths.has(artifactPath))
|
|
389
|
+
return;
|
|
390
|
+
if (budget.total_artifact_bytes + bytes > budget.max_total_artifact_bytes)
|
|
391
|
+
throw new Error("observation_input_freeze_total_size_limit");
|
|
392
|
+
budget.seen_artifact_paths.add(artifactPath);
|
|
393
|
+
budget.total_artifact_bytes += bytes;
|
|
394
|
+
}
|
|
395
|
+
function accountForArtifact(budget, artifactPath, bytes) {
|
|
396
|
+
if (!budget || budget.seen_artifact_paths.has(artifactPath))
|
|
397
|
+
return;
|
|
398
|
+
if (budget.total_artifact_bytes + bytes >
|
|
399
|
+
JSON_POINTER_EXACT_LIMITS.max_total_artifact_bytes)
|
|
400
|
+
throw new Error("observation_artifact_total_size_limit");
|
|
401
|
+
budget.seen_artifact_paths.add(artifactPath);
|
|
402
|
+
budget.total_artifact_bytes += bytes;
|
|
403
|
+
}
|
|
404
|
+
function freezeManifestMembership(value) {
|
|
405
|
+
return Object.freeze({ ...value });
|
|
406
|
+
}
|
|
407
|
+
function freezeFileIdentity(value) {
|
|
408
|
+
return Object.freeze({ ...value });
|
|
409
|
+
}
|
|
410
|
+
function freezeError(code, artifactPath, causeCode = null) {
|
|
411
|
+
return new StaticObservationFreezeError(code, artifactPath, causeCode);
|
|
412
|
+
}
|
|
413
|
+
function openFailureCode(error) {
|
|
414
|
+
return nodeErrorCode(error) === "ENOENT"
|
|
415
|
+
? "static_observation_not_in_pre_run_snapshot"
|
|
416
|
+
: nodeErrorCode(error) === "ELOOP"
|
|
417
|
+
? "static_observation_symlink_not_allowed"
|
|
418
|
+
: "static_observation_not_regular_file";
|
|
419
|
+
}
|
|
420
|
+
function freezeCause(error) {
|
|
421
|
+
if (error instanceof StaticObservationFreezeError)
|
|
422
|
+
return error.cause_code ?? error.code;
|
|
423
|
+
return nodeErrorCode(error);
|
|
424
|
+
}
|
|
425
|
+
function nodeErrorCode(error) {
|
|
426
|
+
return (error?.code ??
|
|
427
|
+
(error instanceof Error ? error.message : String(error)));
|
|
428
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { outcomeResultExternallyBlocked } from "./long-task-claims.js";
|
|
1
2
|
import { progressRecordFresh } from "./long-task-progress.js";
|
|
2
3
|
export function projectDeliveryStatus(input) {
|
|
3
4
|
const outcomes = projectOutcomes(input);
|
|
@@ -46,7 +47,8 @@ function projectOutcomes(input) {
|
|
|
46
47
|
});
|
|
47
48
|
outcomes[outcome.key] = states.includes("progress_failing")
|
|
48
49
|
? "progress_failing"
|
|
49
|
-
:
|
|
50
|
+
: outcomeResultExternallyBlocked(input.compiled, outcome.key) ||
|
|
51
|
+
states.includes("blocked_external")
|
|
50
52
|
? "blocked_external"
|
|
51
53
|
: states.includes("progress_stale")
|
|
52
54
|
? "progress_stale"
|
|
@@ -99,7 +101,9 @@ function projectFindings(input) {
|
|
|
99
101
|
function readyOutcomes(compiled, outcomes, stages) {
|
|
100
102
|
return compiled.outcomes
|
|
101
103
|
.filter((outcome) => stages[outcome.stage] !== "locked" &&
|
|
104
|
+
stages[outcome.stage] !== "blocked_external" &&
|
|
102
105
|
stages[outcome.stage] !== "progress_passing" &&
|
|
106
|
+
outcomes[outcome.key] !== "blocked_external" &&
|
|
103
107
|
outcomes[outcome.key] !== "progress_passing" &&
|
|
104
108
|
outcome.depends_on.every((dependency) => outcomes[dependency] === "progress_passing"))
|
|
105
109
|
.map((outcome) => outcome.key);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CompiledClaimsV2 } from "./long-task-claims.js";
|
|
2
2
|
import type { DeliveryContractV2 } from "./long-task-delivery-types.js";
|
|
3
3
|
type Reporter = (message: string) => void;
|
|
4
4
|
export declare function validateExecutionTargets(contract: DeliveryContractV2, report?: Reporter): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { outcomeResultExternallyBlocked, } from "./long-task-claims.js";
|
|
1
2
|
const FAMILY_CAPABILITY = {
|
|
2
3
|
browser: "browser-runtime",
|
|
3
4
|
native: "native-runtime",
|
|
@@ -94,6 +95,8 @@ function validateCriticalPathTargets(contract, requiredTargetRefs, report) {
|
|
|
94
95
|
const outcome = contract.outcomes.find((candidate) => candidate.key === outcomeKey);
|
|
95
96
|
if (!outcome)
|
|
96
97
|
continue;
|
|
98
|
+
if (outcomeResultExternallyBlocked(contract, outcome.key))
|
|
99
|
+
continue;
|
|
97
100
|
for (const targetRef of requiredTargetRefs)
|
|
98
101
|
if (!outcome.acceptance.checks.some((check) => provesSuccess(check, targetRef)))
|
|
99
102
|
issue(report, "critical_path_required_target_proof_missing", `${outcome.key}:${targetRef}`);
|
|
@@ -7,6 +7,7 @@ export function validateUiDesignBinding(context) {
|
|
|
7
7
|
function validateDesignTargets({ outcome, binding, outcomeClaims, checks, carriers, designTargetKeys, designAssertionRefs, report, }) {
|
|
8
8
|
for (const target of binding.design_targets) {
|
|
9
9
|
const label = `${outcome.key}:${binding.key}:${target.key}`;
|
|
10
|
+
const symbolic = target.fact_model === "symbolic_rules_v2";
|
|
10
11
|
if (designTargetKeys.has(target.key))
|
|
11
12
|
issue(report, "ui_design_target_key_duplicate", label);
|
|
12
13
|
designTargetKeys.add(target.key);
|
|
@@ -14,10 +15,20 @@ function validateDesignTargets({ outcome, binding, outcomeClaims, checks, carrie
|
|
|
14
15
|
if (designAssertionRefs.has(assertionIdentity))
|
|
15
16
|
issue(report, "ui_design_target_assertion_duplicate", label);
|
|
16
17
|
designAssertionRefs.add(assertionIdentity);
|
|
17
|
-
unique(
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
unique((symbolic
|
|
19
|
+
? (target.symbolic_method_bindings ?? [])
|
|
20
|
+
: target.verification_method_bindings).map((item) => item.method), "ui_design_target_verification_method_duplicate", label, report);
|
|
21
|
+
unique((symbolic
|
|
22
|
+
? (target.symbolic_method_bindings ?? [])
|
|
23
|
+
: target.verification_method_bindings).map((item) => item.assertion_ref), "ui_design_target_verification_assertion_duplicate", label, report);
|
|
24
|
+
if (!(symbolic
|
|
25
|
+
? (target.symbolic_method_bindings ?? [])
|
|
26
|
+
: target.verification_method_bindings).length)
|
|
20
27
|
issue(report, "ui_design_target_verification_methods_required", label);
|
|
28
|
+
if (symbolic &&
|
|
29
|
+
(target.condition_keys.length ||
|
|
30
|
+
target.verification_method_bindings.length))
|
|
31
|
+
issue(report, "ui_design_symbolic_ground_fields_forbidden", label);
|
|
21
32
|
const methodArtifactPaths = new Set();
|
|
22
33
|
const methodFactObligations = new Set();
|
|
23
34
|
for (const [name, values] of [
|
|
@@ -26,7 +37,7 @@ function validateDesignTargets({ outcome, binding, outcomeClaims, checks, carrie
|
|
|
26
37
|
["claim_refs", target.claim_refs],
|
|
27
38
|
]) {
|
|
28
39
|
unique(values, `ui_design_target_${name}_duplicate`, label, report);
|
|
29
|
-
if (!values.length)
|
|
40
|
+
if (!values.length && !(symbolic && name === "condition_keys"))
|
|
30
41
|
issue(report, `ui_design_target_${name}_required`, label);
|
|
31
42
|
}
|
|
32
43
|
for (const claimRef of target.claim_refs) {
|
|
@@ -44,6 +55,11 @@ function validateDesignTargets({ outcome, binding, outcomeClaims, checks, carrie
|
|
|
44
55
|
validateRootJourney(binding, check, label, report);
|
|
45
56
|
validateCarrierInputs(check, carriers, label, report);
|
|
46
57
|
validateDesignAssertion(target, check, label, report);
|
|
58
|
+
if (symbolic) {
|
|
59
|
+
validateSymbolicDesignBindings(target, check, label, methodArtifactPaths, report);
|
|
60
|
+
validateDesignFiles(target, check, label, report);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
47
63
|
for (const methodBinding of target.verification_method_bindings) {
|
|
48
64
|
const identity = `${target.conformance_check_ref}\0${methodBinding.assertion_ref}`;
|
|
49
65
|
if (methodBinding.assertion_ref !== target.conformance_assertion_ref &&
|
|
@@ -86,6 +102,50 @@ function validateDesignTargets({ outcome, binding, outcomeClaims, checks, carrie
|
|
|
86
102
|
validateDesignFiles(target, check, label, report);
|
|
87
103
|
}
|
|
88
104
|
}
|
|
105
|
+
function validateSymbolicDesignBindings(target, check, label, artifactPaths, report) {
|
|
106
|
+
const obligationRefs = new Set();
|
|
107
|
+
for (const binding of target.symbolic_method_bindings ?? []) {
|
|
108
|
+
const assertion = check.positive_assertions.find((item) => item.key === binding.assertion_ref);
|
|
109
|
+
if (!assertion)
|
|
110
|
+
issue(report, "ui_design_symbolic_method_assertion_unknown", `${label}:${binding.method}:${binding.assertion_ref}`);
|
|
111
|
+
else if (!assertion.evidence_capabilities.includes("design_method"))
|
|
112
|
+
issue(report, "ui_design_symbolic_method_capability_required", `${label}:${binding.method}`);
|
|
113
|
+
if (!binding.rule_expectations.length)
|
|
114
|
+
issue(report, "ui_design_symbolic_rule_expectations_required", `${label}:${binding.method}`);
|
|
115
|
+
unique(binding.rule_expectations.map((item) => item.obligation_ref), "ui_design_symbolic_obligation_duplicate", `${label}:${binding.method}`, report);
|
|
116
|
+
for (const expectation of binding.rule_expectations) {
|
|
117
|
+
if (obligationRefs.has(expectation.obligation_ref))
|
|
118
|
+
issue(report, "ui_design_symbolic_obligation_reused", `${label}:${expectation.obligation_ref}`);
|
|
119
|
+
obligationRefs.add(expectation.obligation_ref);
|
|
120
|
+
}
|
|
121
|
+
for (const artifactPath of [
|
|
122
|
+
binding.artifact_path,
|
|
123
|
+
binding.observation_path,
|
|
124
|
+
])
|
|
125
|
+
validateSymbolicArtifactPath(artifactPath, target, check, label, artifactPaths, report);
|
|
126
|
+
}
|
|
127
|
+
const certificate = target.symbolic_certificate_binding;
|
|
128
|
+
if (!certificate) {
|
|
129
|
+
issue(report, "ui_design_symbolic_certificate_binding_required", label);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const assertion = check.positive_assertions.find((item) => item.key === certificate.assertion_ref);
|
|
133
|
+
if (!assertion)
|
|
134
|
+
issue(report, "ui_design_symbolic_certificate_assertion_unknown", `${label}:${certificate.assertion_ref}`);
|
|
135
|
+
else if (!assertion.evidence_capabilities.includes("design_symbolic_certificate"))
|
|
136
|
+
issue(report, "ui_design_symbolic_certificate_capability_required", label);
|
|
137
|
+
if (!certificate.expectations.length)
|
|
138
|
+
issue(report, "ui_design_symbolic_certificate_expectations_required", label);
|
|
139
|
+
unique(certificate.expectations.map((item) => item.certificate_ref), "ui_design_symbolic_certificate_duplicate", label, report);
|
|
140
|
+
validateSymbolicArtifactPath(certificate.artifact_path, target, check, label, artifactPaths, report);
|
|
141
|
+
}
|
|
142
|
+
function validateSymbolicArtifactPath(artifactPath, _target, check, label, artifactPaths, report) {
|
|
143
|
+
if (artifactPaths.has(artifactPath))
|
|
144
|
+
issue(report, "ui_design_symbolic_evidence_artifact_reused", `${label}:${artifactPath}`);
|
|
145
|
+
artifactPaths.add(artifactPath);
|
|
146
|
+
if (!check.artifact_globs.some((pattern) => matchesRepoPattern(artifactPath, pattern)))
|
|
147
|
+
issue(report, "ui_design_symbolic_evidence_artifact_glob_missing", `${label}:${artifactPath}`);
|
|
148
|
+
}
|
|
89
149
|
function sameSet(left, right) {
|
|
90
150
|
const leftSet = [...new Set(left)].sort();
|
|
91
151
|
const rightSet = [...new Set(right)].sort();
|