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,155 @@
|
|
|
1
|
+
import { DESIGN_RESOURCE_PATCH_SCHEMA } from "./design-resource-recovery-schema.js";
|
|
2
|
+
import { arrayOf, digest, integer, literal, multilineText, object, oneOf, optionalArrayOf, stringSet, text, } from "./design-resource-recovery-codec-primitives.js";
|
|
3
|
+
const ENCODINGS = ["utf8", "utf8-bom", "utf16le", "utf16be"];
|
|
4
|
+
export function parseProviderReferences(value, label) {
|
|
5
|
+
const row = object(value, label, ["project", "run", "resources"]);
|
|
6
|
+
return {
|
|
7
|
+
project: parseProviderIdentity(row.project, `${label}.project`),
|
|
8
|
+
run: parseProviderIdentity(row.run, `${label}.run`),
|
|
9
|
+
resources: optionalArrayOf(row.resources, `${label}.resources`, parseProviderResourceIdentity),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function parsePatch(value, label) {
|
|
13
|
+
const row = object(value, label, ["schema_version", "operations"]);
|
|
14
|
+
literal(row.schema_version, DESIGN_RESOURCE_PATCH_SCHEMA, `${label}.schema_version`);
|
|
15
|
+
return {
|
|
16
|
+
schema_version: DESIGN_RESOURCE_PATCH_SCHEMA,
|
|
17
|
+
operations: arrayOf(row.operations, `${label}.operations`, (item, itemLabel) => {
|
|
18
|
+
const operation = object(item, itemLabel, [
|
|
19
|
+
"operation_id",
|
|
20
|
+
"operation",
|
|
21
|
+
"target_key",
|
|
22
|
+
"delta_id",
|
|
23
|
+
"before_text",
|
|
24
|
+
"after_text",
|
|
25
|
+
"before_text_sha256",
|
|
26
|
+
"after_text_sha256",
|
|
27
|
+
"source_span",
|
|
28
|
+
"semantic_binding",
|
|
29
|
+
"expected_occurrences",
|
|
30
|
+
]);
|
|
31
|
+
literal(operation.expected_occurrences, 1, `${itemLabel}.expected_occurrences`);
|
|
32
|
+
return {
|
|
33
|
+
operation_id: text(operation.operation_id, `${itemLabel}.operation_id`),
|
|
34
|
+
operation: oneOf(operation.operation, ["add", "replace", "remove"], `${itemLabel}.operation`),
|
|
35
|
+
target_key: text(operation.target_key, `${itemLabel}.target_key`),
|
|
36
|
+
delta_id: text(operation.delta_id, `${itemLabel}.delta_id`),
|
|
37
|
+
before_text: multilineText(operation.before_text, `${itemLabel}.before_text`),
|
|
38
|
+
after_text: multilineText(operation.after_text, `${itemLabel}.after_text`, { allowEmpty: true }),
|
|
39
|
+
before_text_sha256: digest(operation.before_text_sha256, `${itemLabel}.before_text_sha256`),
|
|
40
|
+
after_text_sha256: digest(operation.after_text_sha256, `${itemLabel}.after_text_sha256`),
|
|
41
|
+
source_span: parsePatchSourceSpan(operation.source_span, `${itemLabel}.source_span`),
|
|
42
|
+
semantic_binding: parsePatchSemanticBinding(operation.semantic_binding, `${itemLabel}.semantic_binding`),
|
|
43
|
+
expected_occurrences: 1,
|
|
44
|
+
};
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function parsePatchSourceSpan(value, label) {
|
|
49
|
+
const row = object(value, label, [
|
|
50
|
+
"coordinate_system",
|
|
51
|
+
"start_offset",
|
|
52
|
+
"end_offset",
|
|
53
|
+
"before_text_sha256",
|
|
54
|
+
]);
|
|
55
|
+
literal(row.coordinate_system, "utf16-code-unit-v1", `${label}.coordinate_system`);
|
|
56
|
+
return {
|
|
57
|
+
coordinate_system: "utf16-code-unit-v1",
|
|
58
|
+
start_offset: integer(row.start_offset, `${label}.start_offset`),
|
|
59
|
+
end_offset: integer(row.end_offset, `${label}.end_offset`),
|
|
60
|
+
before_text_sha256: digest(row.before_text_sha256, `${label}.before_text_sha256`),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function parsePatchSemanticBinding(value, label) {
|
|
64
|
+
const row = object(value, label, [
|
|
65
|
+
"delta_id",
|
|
66
|
+
"target_key",
|
|
67
|
+
"before_semantics_sha256",
|
|
68
|
+
"after_semantics_sha256",
|
|
69
|
+
"before_text_projection",
|
|
70
|
+
"after_text_projection",
|
|
71
|
+
]);
|
|
72
|
+
return {
|
|
73
|
+
delta_id: text(row.delta_id, `${label}.delta_id`),
|
|
74
|
+
target_key: text(row.target_key, `${label}.target_key`),
|
|
75
|
+
before_semantics_sha256: digest(row.before_semantics_sha256, `${label}.before_semantics_sha256`),
|
|
76
|
+
after_semantics_sha256: digest(row.after_semantics_sha256, `${label}.after_semantics_sha256`),
|
|
77
|
+
before_text_projection: parseTextProjection(row.before_text_projection, `${label}.before_text_projection`),
|
|
78
|
+
after_text_projection: parseTextProjection(row.after_text_projection, `${label}.after_text_projection`),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function parseTextProjection(value, label) {
|
|
82
|
+
if (value === null)
|
|
83
|
+
return null;
|
|
84
|
+
const row = object(value, label, [
|
|
85
|
+
"semantic_path",
|
|
86
|
+
"start_offset",
|
|
87
|
+
"end_offset",
|
|
88
|
+
]);
|
|
89
|
+
return {
|
|
90
|
+
semantic_path: arrayOf(row.semantic_path, `${label}.semantic_path`, (item, itemLabel) => text(item, itemLabel), { allowEmpty: true }),
|
|
91
|
+
start_offset: integer(row.start_offset, `${label}.start_offset`),
|
|
92
|
+
end_offset: integer(row.end_offset, `${label}.end_offset`),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export function parseWritebackInput(value, label, complete) {
|
|
96
|
+
const fields = [
|
|
97
|
+
"target_locator",
|
|
98
|
+
"pre_write_raw_byte_digest",
|
|
99
|
+
"patch",
|
|
100
|
+
"patch_identity",
|
|
101
|
+
"expected_post_write_raw_byte_digest",
|
|
102
|
+
"resource_identities",
|
|
103
|
+
"proposal_written_delta_ids",
|
|
104
|
+
];
|
|
105
|
+
if (complete)
|
|
106
|
+
fields.push("target_encoding", "target_eol_policy");
|
|
107
|
+
const row = object(value, label, fields);
|
|
108
|
+
const base = {
|
|
109
|
+
target_locator: text(row.target_locator, `${label}.target_locator`),
|
|
110
|
+
pre_write_raw_byte_digest: digest(row.pre_write_raw_byte_digest, `${label}.pre_write_raw_byte_digest`),
|
|
111
|
+
patch: parsePatch(row.patch, `${label}.patch`),
|
|
112
|
+
patch_identity: digest(row.patch_identity, `${label}.patch_identity`),
|
|
113
|
+
expected_post_write_raw_byte_digest: digest(row.expected_post_write_raw_byte_digest, `${label}.expected_post_write_raw_byte_digest`),
|
|
114
|
+
resource_identities: optionalArrayOf(row.resource_identities, `${label}.resource_identities`, parseResourceDigestIdentity),
|
|
115
|
+
proposal_written_delta_ids: stringSet(row.proposal_written_delta_ids, `${label}.proposal_written_delta_ids`, { allowEmpty: true }),
|
|
116
|
+
};
|
|
117
|
+
if (!complete)
|
|
118
|
+
return base;
|
|
119
|
+
return {
|
|
120
|
+
...base,
|
|
121
|
+
target_encoding: oneOf(row.target_encoding, ENCODINGS, `${label}.target_encoding`),
|
|
122
|
+
target_eol_policy: oneOf(row.target_eol_policy, ["none", "lf", "crlf", "cr"], `${label}.target_eol_policy`),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function parseProviderIdentity(value, label) {
|
|
126
|
+
const row = object(value, label, ["key", "locator", "immutable_identity"]);
|
|
127
|
+
return {
|
|
128
|
+
key: text(row.key, `${label}.key`),
|
|
129
|
+
locator: text(row.locator, `${label}.locator`),
|
|
130
|
+
immutable_identity: text(row.immutable_identity, `${label}.immutable_identity`),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function parseProviderResourceIdentity(value, label) {
|
|
134
|
+
const row = object(value, label, [
|
|
135
|
+
"key",
|
|
136
|
+
"locator",
|
|
137
|
+
"immutable_identity",
|
|
138
|
+
"raw_byte_digest",
|
|
139
|
+
]);
|
|
140
|
+
return {
|
|
141
|
+
...parseProviderIdentity({
|
|
142
|
+
key: row.key,
|
|
143
|
+
locator: row.locator,
|
|
144
|
+
immutable_identity: row.immutable_identity,
|
|
145
|
+
}, label),
|
|
146
|
+
raw_byte_digest: digest(row.raw_byte_digest, `${label}.raw_byte_digest`),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function parseResourceDigestIdentity(value, label) {
|
|
150
|
+
const row = object(value, label, ["key", "raw_byte_digest"]);
|
|
151
|
+
return {
|
|
152
|
+
key: text(row.key, `${label}.key`),
|
|
153
|
+
raw_byte_digest: digest(row.raw_byte_digest, `${label}.raw_byte_digest`),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type DesignResourceRecoveryCheckpoint, type DesignResourceRecoveryCreateInput, type DesignResourceReplayProjection } from "./design-resource-recovery-types.js";
|
|
2
|
+
import type { DesignResourceReconciliationResult } from "./design-resource-reconciliation-types.js";
|
|
3
|
+
export interface DesignResourceRecoveryInspection {
|
|
4
|
+
status: "recoverable";
|
|
5
|
+
checkpoint_path: string;
|
|
6
|
+
checkpoint_raw_byte_digest: string;
|
|
7
|
+
replay: DesignResourceReplayProjection;
|
|
8
|
+
writeback: {
|
|
9
|
+
configured: false;
|
|
10
|
+
} | {
|
|
11
|
+
configured: true;
|
|
12
|
+
state: "unapplied" | "applied" | "conflict";
|
|
13
|
+
current_raw_byte_digest: string;
|
|
14
|
+
pre_write_raw_byte_digest: string;
|
|
15
|
+
expected_post_write_raw_byte_digest: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare function createDesignResourceRecoveryCheckpoint(repository: string, input: DesignResourceRecoveryCreateInput): Promise<{
|
|
19
|
+
status: "created" | "already-current";
|
|
20
|
+
checkpoint_path: string;
|
|
21
|
+
checkpoint_raw_byte_digest: string;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function updateDesignResourceRecoveryCheckpoint(repository: string, input: DesignResourceRecoveryCreateInput, expectedCurrentDigest: string): Promise<{
|
|
24
|
+
status: "updated" | "already-current";
|
|
25
|
+
checkpoint_path: string;
|
|
26
|
+
checkpoint_raw_byte_digest: string;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function inspectDesignResourceRecovery(repository: string, sessionId: string): Promise<DesignResourceRecoveryInspection>;
|
|
29
|
+
export declare function previewDesignResourceRecoveryWriteback(repository: string, sessionId: string): Promise<DesignResourceRecoveryInspection & {
|
|
30
|
+
patch: DesignResourceRecoveryCheckpoint["writeback"];
|
|
31
|
+
}>;
|
|
32
|
+
export declare function applyDesignResourceRecoveryWriteback(repository: string, sessionId: string, auditLocator: string): Promise<{
|
|
33
|
+
status: "writeback-applied" | "writeback-idempotent" | "external-resource-revalidation-pending" | "blocked";
|
|
34
|
+
write_transaction: boolean;
|
|
35
|
+
idempotent_replay: boolean;
|
|
36
|
+
reconciliation: DesignResourceReconciliationResult;
|
|
37
|
+
target_raw_byte_digest: string;
|
|
38
|
+
}>;
|
|
39
|
+
export declare function reconcileDesignResourceRecovery(repository: string, sessionId: string, auditLocator: string): Promise<{
|
|
40
|
+
status: "reconciliation-balanced" | "external-resource-revalidation-pending" | "blocked";
|
|
41
|
+
write_transaction: false;
|
|
42
|
+
reconciliation: DesignResourceReconciliationResult;
|
|
43
|
+
}>;
|
|
44
|
+
export { removeDesignResourceRecoveryCheckpoint } from "./design-resource-recovery-cleanup.js";
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { createRecoveryCheckpointFile, deriveDigestCasState, atomicCasWrite, readRecoveryCheckpointFile, readRecoveryRepositoryFile, updateRecoveryCheckpointFile, } from "./design-resource-recovery-files.js";
|
|
2
|
+
import { loadCurrentDesignResourceRecoveryCheckpoint, validateDesignResourceRepositoryAuthority, } from "./design-resource-recovery-current.js";
|
|
3
|
+
import { encodeDesignResourceRecoveryCheckpoint, parseDesignResourceRecoveryCheckpoint, } from "./design-resource-recovery-codec.js";
|
|
4
|
+
import { parseDesignResourceReconciliationAudit } from "./design-resource-reconciliation-codec.js";
|
|
5
|
+
import { reconcileDesignResourceWriteback } from "./design-resource-reconciliation.js";
|
|
6
|
+
import { activeAcceptedDesignResourceDeltas, createDesignResourceReplayProjection, validateDesignResourceRecoverySemantics, } from "./design-resource-recovery-replay.js";
|
|
7
|
+
import { applyDesignResourceExactPatch, decodeDesignResourceText, verifyDesignResourceExactPatchReadback, verifyDesignResourceSupersededTextReadback, } from "./design-resource-recovery-text.js";
|
|
8
|
+
import { validateDesignResourceAuthoritySourceItems } from "./design-resource-recovery-source-authority.js";
|
|
9
|
+
import { validateReconciliationDownstreamOwners, validateSelectedResourceRepositoryBindings, } from "./design-resource-recovery-repository-bindings.js";
|
|
10
|
+
import { DESIGN_RESOURCE_RECOVERY_SCHEMA } from "./design-resource-recovery-schema.js";
|
|
11
|
+
import { sha256Hex } from "./strict-codec.js";
|
|
12
|
+
export async function createDesignResourceRecoveryCheckpoint(repository, input) {
|
|
13
|
+
const { encoded } = await prepareDesignResourceRecoveryCheckpoint(repository, input);
|
|
14
|
+
const written = await createRecoveryCheckpointFile(repository, input.session_id, Buffer.from(encoded, "utf8"));
|
|
15
|
+
return {
|
|
16
|
+
status: written.changed ? "created" : "already-current",
|
|
17
|
+
checkpoint_path: written.path,
|
|
18
|
+
checkpoint_raw_byte_digest: written.raw_byte_digest,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export async function updateDesignResourceRecoveryCheckpoint(repository, input, expectedCurrentDigest) {
|
|
22
|
+
const current = await readRecoveryCheckpointFile(repository, input.session_id);
|
|
23
|
+
assertDigest("checkpoint_update", current.raw_byte_digest, expectedCurrentDigest);
|
|
24
|
+
const currentCheckpoint = parseDesignResourceRecoveryCheckpoint(current.bytes.toString("utf8"));
|
|
25
|
+
if (currentCheckpoint.session_id !== input.session_id)
|
|
26
|
+
throw new Error("design_resource_recovery_invalid:update_session_identity_mismatch");
|
|
27
|
+
validateDesignResourceRecoverySemantics(currentCheckpoint);
|
|
28
|
+
const { encoded } = await prepareDesignResourceRecoveryCheckpoint(repository, input);
|
|
29
|
+
const written = await updateRecoveryCheckpointFile(repository, input.session_id, Buffer.from(encoded, "utf8"), expectedCurrentDigest);
|
|
30
|
+
const readback = await readRecoveryCheckpointFile(repository, input.session_id);
|
|
31
|
+
assertDigest("checkpoint_update_readback", readback.raw_byte_digest, written.raw_byte_digest);
|
|
32
|
+
const parsed = parseDesignResourceRecoveryCheckpoint(readback.bytes.toString("utf8"));
|
|
33
|
+
validateDesignResourceRecoverySemantics(parsed);
|
|
34
|
+
return {
|
|
35
|
+
status: written.changed ? "updated" : "already-current",
|
|
36
|
+
checkpoint_path: written.path,
|
|
37
|
+
checkpoint_raw_byte_digest: written.raw_byte_digest,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
async function prepareDesignResourceRecoveryCheckpoint(repository, input) {
|
|
41
|
+
validateDesignResourceRecoverySemantics(input);
|
|
42
|
+
const baseSnapshot = await readRecoveryRepositoryFile(repository, input.base.locator, "design_resource_recovery_base");
|
|
43
|
+
assertDigest("base", baseSnapshot.raw_byte_digest, input.base.raw_byte_digest);
|
|
44
|
+
const baseText = decodeDesignResourceText(baseSnapshot.bytes);
|
|
45
|
+
await validateDesignResourceRepositoryAuthority(repository, input.design_authority);
|
|
46
|
+
await validateDesignResourceAuthoritySourceItems(repository, input);
|
|
47
|
+
await validateSelectedResourceRepositoryBindings(repository, input);
|
|
48
|
+
let writeback;
|
|
49
|
+
if (input.writeback) {
|
|
50
|
+
const target = await readRecoveryRepositoryFile(repository, input.writeback.target_locator, "design_resource_recovery_writeback_target");
|
|
51
|
+
assertDigest("writeback_pre", target.raw_byte_digest, input.writeback.pre_write_raw_byte_digest);
|
|
52
|
+
const patched = applyDesignResourceExactPatch(target.bytes, input.writeback.patch);
|
|
53
|
+
assertDigest("writeback_expected_post", sha256Hex(patched.bytes), input.writeback.expected_post_write_raw_byte_digest);
|
|
54
|
+
verifyDesignResourceSupersededTextReadback(patched.bytes, input.writeback.patch, supersedingDeltaIds(input));
|
|
55
|
+
writeback = {
|
|
56
|
+
...input.writeback,
|
|
57
|
+
target_encoding: patched.encoding,
|
|
58
|
+
target_eol_policy: patched.eol_policy,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const { schema_version: _inputSchema, base: _inputBase, writeback: _inputWriteback, ...common } = input;
|
|
62
|
+
const checkpoint = {
|
|
63
|
+
...common,
|
|
64
|
+
schema_version: DESIGN_RESOURCE_RECOVERY_SCHEMA,
|
|
65
|
+
owner: "ty-context-design-resource-recovery",
|
|
66
|
+
base: {
|
|
67
|
+
...input.base,
|
|
68
|
+
encoding: baseText.encoding,
|
|
69
|
+
eol_policy: baseText.eol_policy,
|
|
70
|
+
},
|
|
71
|
+
...(writeback ? { writeback } : {}),
|
|
72
|
+
};
|
|
73
|
+
validateDesignResourceRecoverySemantics(checkpoint);
|
|
74
|
+
const encoded = encodeDesignResourceRecoveryCheckpoint(checkpoint);
|
|
75
|
+
const roundTrip = parseDesignResourceRecoveryCheckpoint(encoded);
|
|
76
|
+
validateDesignResourceRecoverySemantics(roundTrip);
|
|
77
|
+
return {
|
|
78
|
+
checkpoint: roundTrip,
|
|
79
|
+
encoded,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export async function inspectDesignResourceRecovery(repository, sessionId) {
|
|
83
|
+
const loaded = await loadCurrentDesignResourceRecoveryCheckpoint(repository, sessionId);
|
|
84
|
+
const writeback = loaded.checkpoint.writeback;
|
|
85
|
+
if (!writeback)
|
|
86
|
+
return {
|
|
87
|
+
status: "recoverable",
|
|
88
|
+
checkpoint_path: loaded.path,
|
|
89
|
+
checkpoint_raw_byte_digest: loaded.digest,
|
|
90
|
+
replay: createDesignResourceReplayProjection(loaded.checkpoint),
|
|
91
|
+
writeback: { configured: false },
|
|
92
|
+
};
|
|
93
|
+
const target = await readRecoveryRepositoryFile(repository, writeback.target_locator, "design_resource_recovery_writeback_target");
|
|
94
|
+
return {
|
|
95
|
+
status: "recoverable",
|
|
96
|
+
checkpoint_path: loaded.path,
|
|
97
|
+
checkpoint_raw_byte_digest: loaded.digest,
|
|
98
|
+
replay: createDesignResourceReplayProjection(loaded.checkpoint),
|
|
99
|
+
writeback: {
|
|
100
|
+
configured: true,
|
|
101
|
+
state: deriveDigestCasState(target.raw_byte_digest, writeback.pre_write_raw_byte_digest, writeback.expected_post_write_raw_byte_digest),
|
|
102
|
+
current_raw_byte_digest: target.raw_byte_digest,
|
|
103
|
+
pre_write_raw_byte_digest: writeback.pre_write_raw_byte_digest,
|
|
104
|
+
expected_post_write_raw_byte_digest: writeback.expected_post_write_raw_byte_digest,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export async function previewDesignResourceRecoveryWriteback(repository, sessionId) {
|
|
109
|
+
const inspection = await inspectDesignResourceRecovery(repository, sessionId);
|
|
110
|
+
const checkpoint = (await loadCurrentDesignResourceRecoveryCheckpoint(repository, sessionId)).checkpoint;
|
|
111
|
+
if (!checkpoint.writeback)
|
|
112
|
+
throw new Error("design_resource_recovery_invalid:writeback_not_configured");
|
|
113
|
+
return { ...inspection, patch: checkpoint.writeback };
|
|
114
|
+
}
|
|
115
|
+
export async function applyDesignResourceRecoveryWriteback(repository, sessionId, auditLocator) {
|
|
116
|
+
const { checkpoint } = await loadCurrentDesignResourceRecoveryCheckpoint(repository, sessionId);
|
|
117
|
+
const writeback = checkpoint.writeback;
|
|
118
|
+
if (!writeback)
|
|
119
|
+
throw new Error("design_resource_recovery_invalid:writeback_not_configured");
|
|
120
|
+
const auditSnapshot = await readRecoveryRepositoryFile(repository, auditLocator, "design_resource_recovery_fresh_audit");
|
|
121
|
+
const audit = parseDesignResourceReconciliationAudit(auditSnapshot.bytes.toString("utf8"));
|
|
122
|
+
const preReconciliation = reconcileDesignResourceWriteback(checkpoint, audit);
|
|
123
|
+
let externalRevalidationRequired = false;
|
|
124
|
+
if (preReconciliation.status === "reconciliation-balanced") {
|
|
125
|
+
try {
|
|
126
|
+
externalRevalidationRequired = (await validateReconciliationDownstreamOwners(repository, checkpoint)).external_revalidation_required;
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
preReconciliation.status = "blocked";
|
|
130
|
+
preReconciliation.findings.push(error instanceof Error ? error.message : String(error));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const target = await readRecoveryRepositoryFile(repository, writeback.target_locator, "design_resource_recovery_writeback_target");
|
|
134
|
+
const state = deriveDigestCasState(target.raw_byte_digest, writeback.pre_write_raw_byte_digest, writeback.expected_post_write_raw_byte_digest);
|
|
135
|
+
if (state === "conflict")
|
|
136
|
+
throw new Error("design_resource_recovery_invalid:writeback_cas_conflict");
|
|
137
|
+
if (preReconciliation.status === "blocked")
|
|
138
|
+
return {
|
|
139
|
+
status: "blocked",
|
|
140
|
+
write_transaction: false,
|
|
141
|
+
idempotent_replay: state === "applied",
|
|
142
|
+
reconciliation: preReconciliation,
|
|
143
|
+
target_raw_byte_digest: target.raw_byte_digest,
|
|
144
|
+
};
|
|
145
|
+
let wrote = false;
|
|
146
|
+
if (state === "unapplied") {
|
|
147
|
+
const patched = applyDesignResourceExactPatch(target.bytes, writeback.patch, writeback.target_encoding, writeback.target_eol_policy);
|
|
148
|
+
assertDigest("writeback_expected_post", sha256Hex(patched.bytes), writeback.expected_post_write_raw_byte_digest);
|
|
149
|
+
await atomicCasWrite(repository, writeback.target_locator, patched.bytes, writeback.pre_write_raw_byte_digest, target.mode);
|
|
150
|
+
wrote = true;
|
|
151
|
+
}
|
|
152
|
+
const post = await readRecoveryRepositoryFile(repository, writeback.target_locator, "design_resource_recovery_writeback_readback");
|
|
153
|
+
assertDigest("writeback_post_readback", post.raw_byte_digest, writeback.expected_post_write_raw_byte_digest);
|
|
154
|
+
verifyDesignResourceExactPatchReadback(post.bytes, writeback.patch);
|
|
155
|
+
verifyDesignResourceSupersededTextReadback(post.bytes, writeback.patch, supersedingDeltaIds(checkpoint));
|
|
156
|
+
const reconciliation = reconcileDesignResourceWriteback(checkpoint, audit);
|
|
157
|
+
if (reconciliation.status === "reconciliation-balanced") {
|
|
158
|
+
try {
|
|
159
|
+
externalRevalidationRequired = (await validateReconciliationDownstreamOwners(repository, checkpoint)).external_revalidation_required;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
reconciliation.status = "blocked";
|
|
163
|
+
reconciliation.findings.push(error instanceof Error ? error.message : String(error));
|
|
164
|
+
reconciliation.findings.sort();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
status: reconciliation.status === "blocked"
|
|
169
|
+
? "blocked"
|
|
170
|
+
: externalRevalidationRequired
|
|
171
|
+
? "external-resource-revalidation-pending"
|
|
172
|
+
: wrote
|
|
173
|
+
? "writeback-applied"
|
|
174
|
+
: "writeback-idempotent",
|
|
175
|
+
write_transaction: wrote,
|
|
176
|
+
idempotent_replay: !wrote,
|
|
177
|
+
reconciliation,
|
|
178
|
+
target_raw_byte_digest: post.raw_byte_digest,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
export async function reconcileDesignResourceRecovery(repository, sessionId, auditLocator) {
|
|
182
|
+
const { checkpoint } = await loadCurrentDesignResourceRecoveryCheckpoint(repository, sessionId, { validateSelectedResources: false });
|
|
183
|
+
if (checkpoint.writeback)
|
|
184
|
+
throw new Error("design_resource_recovery_invalid:read_only_reconcile_requires_no_writeback");
|
|
185
|
+
const auditSnapshot = await readRecoveryRepositoryFile(repository, auditLocator, "design_resource_recovery_fresh_audit");
|
|
186
|
+
const audit = parseDesignResourceReconciliationAudit(auditSnapshot.bytes.toString("utf8"));
|
|
187
|
+
const reconciliation = reconcileDesignResourceWriteback(checkpoint, audit);
|
|
188
|
+
if (reconciliation.status === "blocked")
|
|
189
|
+
return { status: "blocked", write_transaction: false, reconciliation };
|
|
190
|
+
try {
|
|
191
|
+
const current = await validateReconciliationDownstreamOwners(repository, checkpoint);
|
|
192
|
+
return {
|
|
193
|
+
status: current.external_revalidation_required
|
|
194
|
+
? "external-resource-revalidation-pending"
|
|
195
|
+
: "reconciliation-balanced",
|
|
196
|
+
write_transaction: false,
|
|
197
|
+
reconciliation,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
reconciliation.status = "blocked";
|
|
202
|
+
reconciliation.findings.push(error instanceof Error ? error.message : String(error));
|
|
203
|
+
reconciliation.findings.sort();
|
|
204
|
+
return { status: "blocked", write_transaction: false, reconciliation };
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
export { removeDesignResourceRecoveryCheckpoint } from "./design-resource-recovery-cleanup.js";
|
|
208
|
+
function assertDigest(label, actual, expected) {
|
|
209
|
+
if (actual !== expected)
|
|
210
|
+
throw new Error(`design_resource_recovery_invalid:${label}_digest_mismatch:${expected}:${actual}`);
|
|
211
|
+
}
|
|
212
|
+
function supersedingDeltaIds(state) {
|
|
213
|
+
return new Set(activeAcceptedDesignResourceDeltas(state.deltas)
|
|
214
|
+
.filter((delta) => delta.supersedes.length > 0)
|
|
215
|
+
.map((delta) => delta.delta_id));
|
|
216
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SymbolicManifestIndexes } from "./design-resource-symbolic-indexes.js";
|
|
2
|
+
export declare function validateSymbolicApplicabilityAuthorityRefs(row: {
|
|
3
|
+
census_refs: string[];
|
|
4
|
+
source_item_refs: string[];
|
|
5
|
+
basis_refs: string[];
|
|
6
|
+
rationale: string;
|
|
7
|
+
}, indexes: SymbolicManifestIndexes, artifactRefs: ReadonlySet<string>, label: string): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isKnownSymbolicApplicabilityPolicyRef } from "./design-resource-symbolic-applicability-policy.js";
|
|
2
|
+
import { invalid, requireKnownRefs, unique, } from "./design-resource-symbolic-validation-support.js";
|
|
3
|
+
export function validateSymbolicApplicabilityAuthorityRefs(row, indexes, artifactRefs, label) {
|
|
4
|
+
if (!row.census_refs.length ||
|
|
5
|
+
!row.source_item_refs.length ||
|
|
6
|
+
!row.basis_refs.length ||
|
|
7
|
+
!row.rationale.trim())
|
|
8
|
+
invalid("v2_applicability_authority_incomplete", label);
|
|
9
|
+
unique(row.census_refs, `v2_applicability_census_duplicate:${label}`);
|
|
10
|
+
unique(row.source_item_refs, `v2_applicability_source_item_duplicate:${label}`);
|
|
11
|
+
unique(row.basis_refs, `v2_applicability_basis_duplicate:${label}`);
|
|
12
|
+
requireKnownRefs(row.census_refs, indexes.census, "v2_applicability_census_unknown");
|
|
13
|
+
requireKnownRefs(row.source_item_refs, indexes.sourceItems, "v2_applicability_source_item_unknown");
|
|
14
|
+
for (const basisRef of row.basis_refs)
|
|
15
|
+
if (!isKnownSymbolicApplicabilityPolicyRef(basisRef) &&
|
|
16
|
+
!indexes.census.has(basisRef) &&
|
|
17
|
+
!artifactRefs.has(basisRef))
|
|
18
|
+
invalid("v2_applicability_basis_authority_unknown", `${label}:${basisRef}`);
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DesignResourceInspectorCensusEntryV1 } from "./design-resource-fact-manifest-model.js";
|
|
2
|
+
import type { DesignResourceHandoffSubjectV1 } from "./design-resource-handoff-types.js";
|
|
3
|
+
export declare const DESIGN_RESOURCE_SYMBOLIC_APPLICABILITY_POLICY_VERSION: "package-subject-capability-algebra-v1";
|
|
4
|
+
export interface DerivedSymbolicStandardApplicabilityV1 {
|
|
5
|
+
property_refs: string[];
|
|
6
|
+
policy_basis_refs: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function symbolicApplicabilitySubjectPolicyRef(kind: string): string;
|
|
9
|
+
export declare function symbolicApplicabilityCensusPolicyRef(kind: string): string;
|
|
10
|
+
export declare const SYMBOLIC_APPLICABILITY_POPULATION_POLICY_REF: "package-policy.subject-population.v1";
|
|
11
|
+
export declare function deriveRequiredSymbolicStandardApplicability(subject: DesignResourceHandoffSubjectV1, census: ReadonlyMap<string, DesignResourceInspectorCensusEntryV1>): DerivedSymbolicStandardApplicabilityV1;
|
|
12
|
+
export declare function isKnownSymbolicApplicabilityPolicyRef(value: string): boolean;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { DESIGN_RESOURCE_STANDARD_PROPERTIES } from "./design-resource-fact-manifest-catalog.js";
|
|
2
|
+
import { compareText } from "./design-resource-symbolic-validation-support.js";
|
|
3
|
+
export const DESIGN_RESOURCE_SYMBOLIC_APPLICABILITY_POLICY_VERSION = "package-subject-capability-algebra-v1";
|
|
4
|
+
const BASE_VISUAL_PROPERTIES = ["geometry.width", "color.background"];
|
|
5
|
+
const SUBJECT_FAMILIES = {
|
|
6
|
+
surface: [],
|
|
7
|
+
flow: ["navigation"],
|
|
8
|
+
region: [],
|
|
9
|
+
overlay: ["interaction", "accessibility"],
|
|
10
|
+
system_ui: ["system", "accessibility"],
|
|
11
|
+
component_family: [],
|
|
12
|
+
component_instance: [],
|
|
13
|
+
control: ["interaction", "accessibility"],
|
|
14
|
+
anatomy_part: [],
|
|
15
|
+
slot: [],
|
|
16
|
+
primitive: [],
|
|
17
|
+
text: ["typography", "content"],
|
|
18
|
+
icon: ["icon", "asset", "accessibility"],
|
|
19
|
+
media: ["media", "asset", "accessibility"],
|
|
20
|
+
asset: ["asset"],
|
|
21
|
+
relation: ["relation"],
|
|
22
|
+
};
|
|
23
|
+
const CENSUS_FAMILIES = {
|
|
24
|
+
asset_reference: ["asset"],
|
|
25
|
+
relation: ["relation"],
|
|
26
|
+
dynamic_population: ["content"],
|
|
27
|
+
interaction_phase: ["interaction"],
|
|
28
|
+
};
|
|
29
|
+
const propertyRefsByFamily = new Map();
|
|
30
|
+
for (const property of DESIGN_RESOURCE_STANDARD_PROPERTIES) {
|
|
31
|
+
const values = propertyRefsByFamily.get(property.family) ?? [];
|
|
32
|
+
values.push(property.key);
|
|
33
|
+
propertyRefsByFamily.set(property.family, values);
|
|
34
|
+
}
|
|
35
|
+
export function symbolicApplicabilitySubjectPolicyRef(kind) {
|
|
36
|
+
return `package-policy.subject-kind.${kind}.v1`;
|
|
37
|
+
}
|
|
38
|
+
export function symbolicApplicabilityCensusPolicyRef(kind) {
|
|
39
|
+
return `package-policy.census-kind.${kind.replaceAll("_", "-")}.v1`;
|
|
40
|
+
}
|
|
41
|
+
export const SYMBOLIC_APPLICABILITY_POPULATION_POLICY_REF = "package-policy.subject-population.v1";
|
|
42
|
+
export function deriveRequiredSymbolicStandardApplicability(subject, census) {
|
|
43
|
+
const properties = new Set();
|
|
44
|
+
const policyBasis = new Set();
|
|
45
|
+
for (const propertyRef of BASE_VISUAL_PROPERTIES)
|
|
46
|
+
properties.add(propertyRef);
|
|
47
|
+
addFamilies(properties, SUBJECT_FAMILIES[subject.kind] ?? []);
|
|
48
|
+
policyBasis.add(symbolicApplicabilitySubjectPolicyRef(subject.kind));
|
|
49
|
+
for (const censusRef of subject.census_refs) {
|
|
50
|
+
const kind = census.get(censusRef)?.kind;
|
|
51
|
+
if (!kind)
|
|
52
|
+
continue;
|
|
53
|
+
const families = CENSUS_FAMILIES[kind] ?? [];
|
|
54
|
+
if (!families.length)
|
|
55
|
+
continue;
|
|
56
|
+
addFamilies(properties, families);
|
|
57
|
+
policyBasis.add(symbolicApplicabilityCensusPolicyRef(kind));
|
|
58
|
+
}
|
|
59
|
+
if (subject.population_ref !== null) {
|
|
60
|
+
addFamilies(properties, ["content"]);
|
|
61
|
+
policyBasis.add(SYMBOLIC_APPLICABILITY_POPULATION_POLICY_REF);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
property_refs: [...properties].sort(compareText),
|
|
65
|
+
policy_basis_refs: [...policyBasis].sort(compareText),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export function isKnownSymbolicApplicabilityPolicyRef(value) {
|
|
69
|
+
if (value === SYMBOLIC_APPLICABILITY_POPULATION_POLICY_REF)
|
|
70
|
+
return true;
|
|
71
|
+
if (Object.keys(SUBJECT_FAMILIES).some((kind) => value === symbolicApplicabilitySubjectPolicyRef(kind)))
|
|
72
|
+
return true;
|
|
73
|
+
return Object.keys(CENSUS_FAMILIES).some((kind) => value === symbolicApplicabilityCensusPolicyRef(kind));
|
|
74
|
+
}
|
|
75
|
+
function addFamilies(properties, families) {
|
|
76
|
+
for (const family of families)
|
|
77
|
+
for (const propertyRef of propertyRefsByFamily.get(family) ?? [])
|
|
78
|
+
properties.add(propertyRef);
|
|
79
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const DESIGN_RESOURCE_SYMBOLIC_APPLICABILITY_PROFILE_CATALOG: "package-subject-property-applicability-v1";
|
|
2
|
+
export interface DesignResourceSymbolicApplicabilityProfileV1 {
|
|
3
|
+
key: string;
|
|
4
|
+
property_refs: readonly string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const DESIGN_RESOURCE_SYMBOLIC_APPLICABILITY_PROFILES: readonly DesignResourceSymbolicApplicabilityProfileV1[];
|
|
7
|
+
export declare function symbolicPropertyProfileKey(propertyRef: string): string;
|
|
8
|
+
export declare function resolveSymbolicApplicabilityProfiles(profileRefs: readonly string[], label: string): Set<string>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DESIGN_RESOURCE_STANDARD_PROPERTIES, DESIGN_RESOURCE_STANDARD_PROPERTY_KEYS, } from "./design-resource-fact-manifest-catalog.js";
|
|
2
|
+
import { DESIGN_RESOURCE_INSPECTOR_CAPABILITIES, DESIGN_RESOURCE_PROPERTY_FAMILIES, } from "./design-resource-fact-manifest-types.js";
|
|
3
|
+
import { compareText, invalid, } from "./design-resource-symbolic-validation-support.js";
|
|
4
|
+
export const DESIGN_RESOURCE_SYMBOLIC_APPLICABILITY_PROFILE_CATALOG = "package-subject-property-applicability-v1";
|
|
5
|
+
const profiles = buildProfiles();
|
|
6
|
+
export const DESIGN_RESOURCE_SYMBOLIC_APPLICABILITY_PROFILES = Object.freeze(profiles);
|
|
7
|
+
const profileByKey = new Map(profiles.map((profile) => [profile.key, profile]));
|
|
8
|
+
export function symbolicPropertyProfileKey(propertyRef) {
|
|
9
|
+
return `profile.property.${propertyRef}`;
|
|
10
|
+
}
|
|
11
|
+
export function resolveSymbolicApplicabilityProfiles(profileRefs, label) {
|
|
12
|
+
const propertyRefs = new Set();
|
|
13
|
+
for (const profileRef of profileRefs) {
|
|
14
|
+
const profile = profileByKey.get(profileRef);
|
|
15
|
+
if (!profile)
|
|
16
|
+
invalid("v2_applicability_profile_unknown", `${label}:${profileRef}`);
|
|
17
|
+
for (const propertyRef of profile.property_refs)
|
|
18
|
+
propertyRefs.add(propertyRef);
|
|
19
|
+
}
|
|
20
|
+
return propertyRefs;
|
|
21
|
+
}
|
|
22
|
+
function buildProfiles() {
|
|
23
|
+
const result = [
|
|
24
|
+
{
|
|
25
|
+
key: "profile.all-standard",
|
|
26
|
+
property_refs: [...DESIGN_RESOURCE_STANDARD_PROPERTY_KEYS],
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
for (const property of DESIGN_RESOURCE_STANDARD_PROPERTIES)
|
|
30
|
+
result.push({
|
|
31
|
+
key: symbolicPropertyProfileKey(property.key),
|
|
32
|
+
property_refs: [property.key],
|
|
33
|
+
});
|
|
34
|
+
for (const family of DESIGN_RESOURCE_PROPERTY_FAMILIES)
|
|
35
|
+
result.push({
|
|
36
|
+
key: `profile.family.${family}`,
|
|
37
|
+
property_refs: DESIGN_RESOURCE_STANDARD_PROPERTIES.filter((property) => property.family === family).map((property) => property.key),
|
|
38
|
+
});
|
|
39
|
+
for (const capability of DESIGN_RESOURCE_INSPECTOR_CAPABILITIES)
|
|
40
|
+
result.push({
|
|
41
|
+
key: `profile.capability.${capability}`,
|
|
42
|
+
property_refs: DESIGN_RESOURCE_STANDARD_PROPERTIES.filter((property) => property.inspector_capability_refs.includes(capability)).map((property) => property.key),
|
|
43
|
+
});
|
|
44
|
+
result.sort((left, right) => compareText(left.key, right.key));
|
|
45
|
+
if (new Set(result.map((profile) => profile.key)).size !== result.length)
|
|
46
|
+
invalid("v2_applicability_profile_catalog_duplicate", "");
|
|
47
|
+
const covered = new Set(result.flatMap((profile) => profile.property_refs));
|
|
48
|
+
if (covered.size !== DESIGN_RESOURCE_STANDARD_PROPERTY_KEYS.length ||
|
|
49
|
+
DESIGN_RESOURCE_STANDARD_PROPERTY_KEYS.some((key) => !covered.has(key)))
|
|
50
|
+
invalid("v2_applicability_profile_catalog_incomplete", "");
|
|
51
|
+
return result.map((profile) => Object.freeze({
|
|
52
|
+
...profile,
|
|
53
|
+
property_refs: Object.freeze([...profile.property_refs].sort(compareText)),
|
|
54
|
+
}));
|
|
55
|
+
}
|