project-tiny-context-harness 0.8.4 → 0.8.6

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.
Files changed (254) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +394 -363
  3. package/assets/README.md +570 -514
  4. package/assets/README.zh-CN.md +331 -300
  5. package/assets/agents/.gitkeep +1 -1
  6. package/assets/agents/AGENTS_CORE.md +45 -25
  7. package/assets/context_templates/architecture.md +26 -25
  8. package/assets/context_templates/area.md +32 -31
  9. package/assets/context_templates/context.toml +30 -24
  10. package/assets/context_templates/deployment.md +35 -35
  11. package/assets/context_templates/global.md +57 -57
  12. package/assets/context_templates/product-surface-contract.md +70 -70
  13. package/assets/context_templates/screen-contract.md +189 -189
  14. package/assets/context_templates/verification.md +31 -30
  15. package/assets/github/.gitkeep +1 -1
  16. package/assets/github/harness.yml +39 -39
  17. package/assets/make/.gitkeep +1 -1
  18. package/assets/make/ty-context.mk +48 -48
  19. package/assets/skills/context_development_engineer/SKILL.md +155 -122
  20. package/assets/skills/context_full_project_export/SKILL.md +28 -28
  21. package/assets/skills/context_harness_upgrade/SKILL.md +60 -60
  22. package/assets/skills/context_product_plan/SKILL.md +99 -79
  23. package/assets/skills/context_surface_contract/SKILL.md +191 -191
  24. package/assets/skills/context_uiux_design/SKILL.md +171 -171
  25. package/assets/skills/design-resource-authoring/SKILL.md +86 -84
  26. package/assets/skills/design-resource-authoring/references/downstream-handoff.md +138 -123
  27. package/assets/skills/design-resource-authoring/references/open-design-provider.md +132 -127
  28. package/assets/skills/design-resource-authoring/references/resource-selection.md +181 -154
  29. package/assets/skills/design-system-authoring/SKILL.md +57 -57
  30. package/assets/skills/design-system-authoring/agents/openai.yaml +6 -6
  31. package/assets/skills/design-system-authoring/references/authority-adoption.md +48 -48
  32. package/assets/skills/design-system-authoring/references/open-design-design-system-provider.md +110 -110
  33. package/assets/skills/long-task-workflow/SKILL.md +98 -92
  34. package/assets/skills/long-task-workflow/agents/openai.yaml +3 -1
  35. package/assets/skills/long-task-workflow/references/authority-lifecycle.md +72 -72
  36. package/assets/skills/long-task-workflow/references/contract-authoring.md +122 -101
  37. package/assets/skills/long-task-workflow/references/evidence-design.md +82 -61
  38. package/assets/skills/long-task-workflow/references/source-authoring.md +109 -90
  39. package/assets/skills/source-plan-authoring/SKILL.md +14 -14
  40. package/assets/tools/validate_context.py +442 -442
  41. package/dist/commands/long-task-authoring.js +27 -2
  42. package/dist/lib/context-default-footprint.js +2 -0
  43. package/dist/lib/context-manifest.js +6 -0
  44. package/dist/lib/context-templates.js +1 -1
  45. package/dist/lib/design-resource-fact-enums.d.ts +20 -0
  46. package/dist/lib/design-resource-fact-enums.js +170 -0
  47. package/dist/lib/design-resource-fact-locator-extractors.d.ts +8 -0
  48. package/dist/lib/design-resource-fact-locator-extractors.js +108 -0
  49. package/dist/lib/design-resource-fact-locator-resolver.d.ts +3 -0
  50. package/dist/lib/design-resource-fact-locator-resolver.js +112 -0
  51. package/dist/lib/design-resource-fact-locator-validation.d.ts +5 -0
  52. package/dist/lib/design-resource-fact-locator-validation.js +16 -0
  53. package/dist/lib/design-resource-fact-manifest-catalog.d.ts +4 -0
  54. package/dist/lib/design-resource-fact-manifest-catalog.js +249 -0
  55. package/dist/lib/design-resource-fact-manifest-model.d.ts +91 -0
  56. package/dist/lib/design-resource-fact-manifest-model.js +21 -0
  57. package/dist/lib/design-resource-fact-manifest-shape-axes.d.ts +6 -0
  58. package/dist/lib/design-resource-fact-manifest-shape-axes.js +159 -0
  59. package/dist/lib/design-resource-fact-manifest-shape-evidence.d.ts +4 -0
  60. package/dist/lib/design-resource-fact-manifest-shape-evidence.js +59 -0
  61. package/dist/lib/design-resource-fact-manifest-shape-facts.d.ts +4 -0
  62. package/dist/lib/design-resource-fact-manifest-shape-facts.js +109 -0
  63. package/dist/lib/design-resource-fact-manifest-shape-inspector.d.ts +5 -0
  64. package/dist/lib/design-resource-fact-manifest-shape-inspector.js +144 -0
  65. package/dist/lib/design-resource-fact-manifest-shape.d.ts +7 -0
  66. package/dist/lib/design-resource-fact-manifest-shape.js +75 -0
  67. package/dist/lib/design-resource-fact-manifest-types.d.ts +3 -0
  68. package/dist/lib/design-resource-fact-manifest-types.js +3 -0
  69. package/dist/lib/design-resource-fact-manifest-universe.d.ts +5 -0
  70. package/dist/lib/design-resource-fact-manifest-universe.js +50 -0
  71. package/dist/lib/design-resource-fact-manifest-validation.d.ts +3 -0
  72. package/dist/lib/design-resource-fact-manifest-validation.js +106 -0
  73. package/dist/lib/design-resource-fact-policy.d.ts +18 -0
  74. package/dist/lib/design-resource-fact-policy.js +72 -1
  75. package/dist/lib/design-resource-fact-property-methods.d.ts +3 -0
  76. package/dist/lib/design-resource-fact-property-methods.js +158 -0
  77. package/dist/lib/design-resource-fact-shape-primitives.d.ts +3 -0
  78. package/dist/lib/design-resource-fact-shape-primitives.js +18 -0
  79. package/dist/lib/design-resource-fact-types.d.ts +164 -0
  80. package/dist/lib/design-resource-fact-types.js +1 -0
  81. package/dist/lib/design-resource-fact-universe-assets.d.ts +4 -0
  82. package/dist/lib/design-resource-fact-universe-assets.js +71 -0
  83. package/dist/lib/design-resource-fact-universe-catalog.d.ts +4 -0
  84. package/dist/lib/design-resource-fact-universe-catalog.js +151 -0
  85. package/dist/lib/design-resource-fact-universe-conditions.d.ts +2 -0
  86. package/dist/lib/design-resource-fact-universe-conditions.js +92 -0
  87. package/dist/lib/design-resource-fact-universe-facts.d.ts +4 -0
  88. package/dist/lib/design-resource-fact-universe-facts.js +108 -0
  89. package/dist/lib/design-resource-fact-universe-helpers.d.ts +30 -0
  90. package/dist/lib/design-resource-fact-universe-helpers.js +167 -0
  91. package/dist/lib/design-resource-fact-universe-inspector.d.ts +7 -0
  92. package/dist/lib/design-resource-fact-universe-inspector.js +119 -0
  93. package/dist/lib/design-resource-fact-universe-proof.d.ts +4 -0
  94. package/dist/lib/design-resource-fact-universe-proof.js +113 -0
  95. package/dist/lib/design-resource-fact-universe-subjects.d.ts +5 -0
  96. package/dist/lib/design-resource-fact-universe-subjects.js +97 -0
  97. package/dist/lib/design-resource-fact-universe-variations.d.ts +2 -0
  98. package/dist/lib/design-resource-fact-universe-variations.js +75 -0
  99. package/dist/lib/design-resource-fact-value-validation.d.ts +2 -0
  100. package/dist/lib/design-resource-fact-value-validation.js +80 -0
  101. package/dist/lib/design-resource-handoff-file-primitives.js +2 -0
  102. package/dist/lib/design-resource-handoff-file-validation.js +13 -100
  103. package/dist/lib/design-resource-handoff-policy.d.ts +1 -0
  104. package/dist/lib/design-resource-handoff-policy.js +118 -11
  105. package/dist/lib/design-resource-handoff-shape-evidence.js +46 -3
  106. package/dist/lib/design-resource-handoff-shape-primitives.d.ts +5 -0
  107. package/dist/lib/design-resource-handoff-shape-primitives.js +28 -0
  108. package/dist/lib/design-resource-handoff-shape-structure.js +143 -22
  109. package/dist/lib/design-resource-handoff-shape.js +25 -0
  110. package/dist/lib/design-resource-handoff-types.d.ts +97 -21
  111. package/dist/lib/design-resource-handoff-types.js +22 -0
  112. package/dist/lib/design-resource-handoff-validation-coverage.d.ts +1 -1
  113. package/dist/lib/design-resource-handoff-validation-coverage.js +145 -118
  114. package/dist/lib/design-resource-handoff-validation-fact-cells.d.ts +2 -0
  115. package/dist/lib/design-resource-handoff-validation-fact-cells.js +60 -0
  116. package/dist/lib/design-resource-handoff-validation-fact-records.d.ts +2 -0
  117. package/dist/lib/design-resource-handoff-validation-fact-records.js +90 -0
  118. package/dist/lib/design-resource-handoff-validation-facts.js +10 -94
  119. package/dist/lib/design-resource-handoff-validation-proofs.d.ts +2 -0
  120. package/dist/lib/design-resource-handoff-validation-proofs.js +67 -0
  121. package/dist/lib/design-resource-handoff-validation-resource-closure.d.ts +3 -0
  122. package/dist/lib/design-resource-handoff-validation-resource-closure.js +88 -0
  123. package/dist/lib/design-resource-handoff-validation-structure.js +43 -14
  124. package/dist/lib/design-resource-handoff-validation.js +32 -0
  125. package/dist/lib/design-resource-handoff-web-dependency-validation.d.ts +2 -1
  126. package/dist/lib/design-resource-handoff-web-dependency-validation.js +67 -7
  127. package/dist/lib/execution-target-capabilities.d.ts +1 -1
  128. package/dist/lib/execution-target-capabilities.js +14 -0
  129. package/dist/lib/long-task-activation-validation.js +6 -2
  130. package/dist/lib/long-task-applicability-shape.js +3 -3
  131. package/dist/lib/long-task-authoring-authority-preview.js +1 -0
  132. package/dist/lib/long-task-authority-policy.d.ts +1 -0
  133. package/dist/lib/long-task-authority-policy.js +1 -0
  134. package/dist/lib/long-task-authority.js +13 -0
  135. package/dist/lib/long-task-claim-definitions.js +13 -1
  136. package/dist/lib/long-task-claims.js +23 -1
  137. package/dist/lib/long-task-contract-types.d.ts +3 -0
  138. package/dist/lib/long-task-delivery-compiler.js +1 -0
  139. package/dist/lib/long-task-delivery-parser.js +11 -1
  140. package/dist/lib/long-task-delivery-types.d.ts +1 -0
  141. package/dist/lib/long-task-delivery-types.js +1 -0
  142. package/dist/lib/long-task-delivery-validation.js +17 -0
  143. package/dist/lib/long-task-design-resource-handoff.js +62 -38
  144. package/dist/lib/long-task-design-target-capabilities.d.ts +14 -0
  145. package/dist/lib/long-task-design-target-capabilities.js +126 -0
  146. package/dist/lib/long-task-evidence-capability-codec.d.ts +94 -0
  147. package/dist/lib/long-task-evidence-capability-codec.js +395 -22
  148. package/dist/lib/long-task-evidence-capability-policy.js +18 -0
  149. package/dist/lib/long-task-evidence-capability-runtime.js +78 -0
  150. package/dist/lib/long-task-evidence-capability-types.d.ts +114 -1
  151. package/dist/lib/long-task-outcome-parser.js +4 -0
  152. package/dist/lib/long-task-playwright-capability-records.d.ts +5 -0
  153. package/dist/lib/long-task-playwright-capability-records.js +146 -0
  154. package/dist/lib/long-task-playwright-case-evidence.d.ts +3 -2
  155. package/dist/lib/long-task-playwright-case-evidence.js +10 -79
  156. package/dist/lib/long-task-playwright-case-primitives.d.ts +28 -0
  157. package/dist/lib/long-task-playwright-case-primitives.js +143 -0
  158. package/dist/lib/long-task-playwright-evidence.d.ts +1 -1
  159. package/dist/lib/long-task-playwright-evidence.js +10 -75
  160. package/dist/lib/long-task-runner-freeze.d.ts +2 -2
  161. package/dist/lib/long-task-runner-freeze.js +15 -1
  162. package/dist/lib/long-task-runtime-types.d.ts +4 -1
  163. package/dist/lib/long-task-semantic-contract-types.d.ts +1 -1
  164. package/dist/lib/long-task-semantic-drift-migration.js +2 -2
  165. package/dist/lib/long-task-semantic-fact-binding-types.d.ts +57 -0
  166. package/dist/lib/long-task-semantic-fact-binding-types.js +1 -0
  167. package/dist/lib/long-task-semantic-fact-closure-primitives.d.ts +5 -0
  168. package/dist/lib/long-task-semantic-fact-closure-primitives.js +43 -0
  169. package/dist/lib/long-task-semantic-fact-closure.d.ts +13 -0
  170. package/dist/lib/long-task-semantic-fact-closure.js +48 -0
  171. package/dist/lib/long-task-semantic-fact-contract-closure.d.ts +4 -0
  172. package/dist/lib/long-task-semantic-fact-contract-closure.js +24 -0
  173. package/dist/lib/long-task-semantic-fact-contract-facts.d.ts +4 -0
  174. package/dist/lib/long-task-semantic-fact-contract-facts.js +30 -0
  175. package/dist/lib/long-task-semantic-fact-contract-proofs.d.ts +4 -0
  176. package/dist/lib/long-task-semantic-fact-contract-proofs.js +97 -0
  177. package/dist/lib/long-task-semantic-fact-evidence.d.ts +21 -0
  178. package/dist/lib/long-task-semantic-fact-evidence.js +165 -0
  179. package/dist/lib/long-task-semantic-fact-input-closure.d.ts +4 -0
  180. package/dist/lib/long-task-semantic-fact-input-closure.js +101 -0
  181. package/dist/lib/long-task-semantic-fact-provenance-closure.d.ts +4 -0
  182. package/dist/lib/long-task-semantic-fact-provenance-closure.js +140 -0
  183. package/dist/lib/long-task-semantic-fact-shape.d.ts +3 -0
  184. package/dist/lib/long-task-semantic-fact-shape.js +89 -0
  185. package/dist/lib/long-task-semantic-fact-value-closure.d.ts +3 -0
  186. package/dist/lib/long-task-semantic-fact-value-closure.js +110 -0
  187. package/dist/lib/long-task-shape-primitives.d.ts +2 -1
  188. package/dist/lib/long-task-shape-primitives.js +7 -0
  189. package/dist/lib/long-task-source-item-parser.js +25 -6
  190. package/dist/lib/long-task-source-target-continuity.js +4 -1
  191. package/dist/lib/long-task-source-target-index.d.ts +1 -1
  192. package/dist/lib/long-task-source-target-index.js +5 -1
  193. package/dist/lib/long-task-ui-design-policy.js +8 -4
  194. package/dist/lib/long-task-ui-surface-shape.js +83 -1
  195. package/dist/lib/long-task-ui-surface-types.d.ts +29 -0
  196. package/dist/lib/modularity.js +7 -1
  197. package/dist/lib/semantic-fact-base-types.d.ts +14 -0
  198. package/dist/lib/semantic-fact-base-types.js +1 -0
  199. package/dist/lib/semantic-fact-catalog.d.ts +8 -0
  200. package/dist/lib/semantic-fact-catalog.js +191 -0
  201. package/dist/lib/semantic-fact-condition-shape.d.ts +48 -0
  202. package/dist/lib/semantic-fact-condition-shape.js +111 -0
  203. package/dist/lib/semantic-fact-input-shape.d.ts +34 -0
  204. package/dist/lib/semantic-fact-input-shape.js +111 -0
  205. package/dist/lib/semantic-fact-inventory-types.d.ts +147 -0
  206. package/dist/lib/semantic-fact-inventory-types.js +1 -0
  207. package/dist/lib/semantic-fact-manifest-shape.d.ts +4 -0
  208. package/dist/lib/semantic-fact-manifest-shape.js +135 -0
  209. package/dist/lib/semantic-fact-manifest-types.d.ts +58 -0
  210. package/dist/lib/semantic-fact-manifest-types.js +19 -0
  211. package/dist/lib/semantic-fact-policy-authority.d.ts +8 -0
  212. package/dist/lib/semantic-fact-policy-authority.js +79 -0
  213. package/dist/lib/semantic-fact-policy-census.d.ts +2 -0
  214. package/dist/lib/semantic-fact-policy-census.js +80 -0
  215. package/dist/lib/semantic-fact-policy-condition-references.d.ts +7 -0
  216. package/dist/lib/semantic-fact-policy-condition-references.js +19 -0
  217. package/dist/lib/semantic-fact-policy-conditions.d.ts +2 -0
  218. package/dist/lib/semantic-fact-policy-conditions.js +105 -0
  219. package/dist/lib/semantic-fact-policy-facts.d.ts +3 -0
  220. package/dist/lib/semantic-fact-policy-facts.js +73 -0
  221. package/dist/lib/semantic-fact-policy-primitives.d.ts +26 -0
  222. package/dist/lib/semantic-fact-policy-primitives.js +169 -0
  223. package/dist/lib/semantic-fact-policy-proofs.d.ts +2 -0
  224. package/dist/lib/semantic-fact-policy-proofs.js +75 -0
  225. package/dist/lib/semantic-fact-policy-properties.d.ts +3 -0
  226. package/dist/lib/semantic-fact-policy-properties.js +84 -0
  227. package/dist/lib/semantic-fact-policy-units.d.ts +4 -0
  228. package/dist/lib/semantic-fact-policy-units.js +103 -0
  229. package/dist/lib/semantic-fact-policy.d.ts +17 -0
  230. package/dist/lib/semantic-fact-policy.js +41 -0
  231. package/dist/lib/semantic-fact-proof-shape.d.ts +51 -0
  232. package/dist/lib/semantic-fact-proof-shape.js +121 -0
  233. package/dist/lib/semantic-fact-proof-types.d.ts +74 -0
  234. package/dist/lib/semantic-fact-proof-types.js +1 -0
  235. package/dist/lib/semantic-fact-property-shape.d.ts +29 -0
  236. package/dist/lib/semantic-fact-property-shape.js +77 -0
  237. package/dist/lib/semantic-fact-shape-constants.d.ts +3 -0
  238. package/dist/lib/semantic-fact-shape-constants.js +38 -0
  239. package/dist/lib/semantic-fact-shape-primitives.d.ts +15 -0
  240. package/dist/lib/semantic-fact-shape-primitives.js +68 -0
  241. package/dist/lib/semantic-fact-source-parser.d.ts +9 -0
  242. package/dist/lib/semantic-fact-source-parser.js +46 -0
  243. package/dist/lib/semantic-fact-support-shape.d.ts +21 -0
  244. package/dist/lib/semantic-fact-support-shape.js +59 -0
  245. package/dist/lib/semantic-fact-types.d.ts +5 -0
  246. package/dist/lib/semantic-fact-types.js +5 -0
  247. package/dist/lib/semantic-fact-unit-shape.d.ts +34 -0
  248. package/dist/lib/semantic-fact-unit-shape.js +89 -0
  249. package/dist/lib/semantic-fact-value-shape.d.ts +12 -0
  250. package/dist/lib/semantic-fact-value-shape.js +39 -0
  251. package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +1339 -131
  252. package/migrations/README.md +15 -15
  253. package/package.json +84 -84
  254. package/source-mappings.yaml +25 -25
@@ -0,0 +1,109 @@
1
+ import { DESIGN_RESOURCE_COMPARATORS, DESIGN_RESOURCE_INSPECTOR_CAPABILITIES, DESIGN_RESOURCE_PROPERTY_FAMILIES, DESIGN_RESOURCE_VALUE_KINDS, } from "./design-resource-fact-manifest-types.js";
2
+ import { parseDesignResourceLocatedDigest } from "./design-resource-fact-shape-primitives.js";
3
+ import { DESIGN_RESOURCE_DIMENSIONS, DESIGN_RESOURCE_VERIFICATION_METHODS, } from "./design-resource-handoff-types.js";
4
+ import { contractKey, sourceItemKeys, stableKey, stableKeys, } from "./design-resource-handoff-shape-primitives.js";
5
+ import { array, boolean, literal, nullable, object, string, } from "./long-task-shape-primitives.js";
6
+ export function parseDesignResourceProperties(value, label = "design_resource_handoff.properties") {
7
+ return array(value, label).map((item, index) => {
8
+ const itemLabel = `${label}[${index}]`;
9
+ const row = object(item, itemLabel, [
10
+ "key",
11
+ "family",
12
+ "dimension",
13
+ "value_kind",
14
+ "required_methods",
15
+ "standard",
16
+ "inspector_capability_refs",
17
+ "census_refs",
18
+ ]);
19
+ return {
20
+ key: stableKey(row.key, `${itemLabel}.key`),
21
+ family: literal(row.family, DESIGN_RESOURCE_PROPERTY_FAMILIES, `${itemLabel}.family`),
22
+ dimension: literal(row.dimension, DESIGN_RESOURCE_DIMENSIONS, `${itemLabel}.dimension`),
23
+ value_kind: literal(row.value_kind, DESIGN_RESOURCE_VALUE_KINDS, `${itemLabel}.value_kind`),
24
+ required_methods: array(row.required_methods, `${itemLabel}.required_methods`).map((method, methodIndex) => literal(method, DESIGN_RESOURCE_VERIFICATION_METHODS, `${itemLabel}.required_methods[${methodIndex}]`)),
25
+ standard: boolean(row.standard, `${itemLabel}.standard`),
26
+ inspector_capability_refs: array(row.inspector_capability_refs, `${itemLabel}.inspector_capability_refs`).map((capability, capabilityIndex) => literal(capability, DESIGN_RESOURCE_INSPECTOR_CAPABILITIES, `${itemLabel}.inspector_capability_refs[${capabilityIndex}]`)),
27
+ census_refs: stableKeys(row.census_refs, `${itemLabel}.census_refs`),
28
+ };
29
+ });
30
+ }
31
+ export function parseDesignResourceFactCells(value, label = "design_resource_handoff.fact_cells") {
32
+ return array(value, label).map((item, index) => {
33
+ const itemLabel = `${label}[${index}]`;
34
+ const row = object(item, itemLabel, [
35
+ "key",
36
+ "subject_ref",
37
+ "target_ref",
38
+ "condition_ref",
39
+ "variation_ref",
40
+ "property_ref",
41
+ "disposition",
42
+ "fact_ref",
43
+ "source_item_refs",
44
+ "basis_refs",
45
+ "rationale",
46
+ ]);
47
+ return {
48
+ key: stableKey(row.key, `${itemLabel}.key`),
49
+ subject_ref: stableKey(row.subject_ref, `${itemLabel}.subject_ref`),
50
+ target_ref: contractKey(row.target_ref, `${itemLabel}.target_ref`),
51
+ condition_ref: contractKey(row.condition_ref, `${itemLabel}.condition_ref`),
52
+ variation_ref: stableKey(row.variation_ref, `${itemLabel}.variation_ref`),
53
+ property_ref: stableKey(row.property_ref, `${itemLabel}.property_ref`),
54
+ disposition: literal(row.disposition, [
55
+ "covered",
56
+ "not_applicable",
57
+ "excluded_by_scope",
58
+ "decision_required",
59
+ "unavailable",
60
+ ], `${itemLabel}.disposition`),
61
+ fact_ref: nullable(row.fact_ref, (factRef) => stableKey(factRef, `${itemLabel}.fact_ref`)),
62
+ source_item_refs: sourceItemKeys(row.source_item_refs, `${itemLabel}.source_item_refs`),
63
+ basis_refs: stableKeys(row.basis_refs, `${itemLabel}.basis_refs`),
64
+ rationale: string(row.rationale, `${itemLabel}.rationale`),
65
+ };
66
+ });
67
+ }
68
+ export function parseDesignResourceProofObligations(value, label = "design_resource_handoff.proof_obligations") {
69
+ return array(value, label).map((item, index) => {
70
+ const itemLabel = `${label}[${index}]`;
71
+ const row = object(item, itemLabel, [
72
+ "key",
73
+ "fact_ref",
74
+ "method",
75
+ "comparison",
76
+ "oracle_ref",
77
+ "environment_ref",
78
+ ]);
79
+ const comparison = object(row.comparison, `${itemLabel}.comparison`, [
80
+ "comparator",
81
+ "mode",
82
+ "parameters",
83
+ "tolerance",
84
+ "mask",
85
+ ]);
86
+ const comparator = parseComparator(comparison.comparator, `${itemLabel}.comparison.comparator`);
87
+ return {
88
+ key: stableKey(row.key, `${itemLabel}.key`),
89
+ fact_ref: stableKey(row.fact_ref, `${itemLabel}.fact_ref`),
90
+ method: literal(row.method, DESIGN_RESOURCE_VERIFICATION_METHODS, `${itemLabel}.method`),
91
+ comparison: {
92
+ comparator,
93
+ mode: literal(comparison.mode, ["exact", "tolerance"], `${itemLabel}.comparison.mode`),
94
+ parameters: parseDesignResourceLocatedDigest(comparison.parameters, `${itemLabel}.comparison.parameters`),
95
+ tolerance: nullable(comparison.tolerance, (entry) => parseDesignResourceLocatedDigest(entry, `${itemLabel}.comparison.tolerance`)),
96
+ mask: nullable(comparison.mask, (entry) => parseDesignResourceLocatedDigest(entry, `${itemLabel}.comparison.mask`)),
97
+ },
98
+ oracle_ref: stableKey(row.oracle_ref, `${itemLabel}.oracle_ref`),
99
+ environment_ref: stableKey(row.environment_ref, `${itemLabel}.environment_ref`),
100
+ };
101
+ });
102
+ }
103
+ function parseComparator(value, label) {
104
+ const comparator = string(value, label);
105
+ if (!DESIGN_RESOURCE_COMPARATORS.includes(comparator) &&
106
+ !/^custom\.[a-z0-9][a-z0-9._-]*$/u.test(comparator))
107
+ throw new Error(`design_resource_handoff_invalid:${label}:must be a standard comparator or custom.*`);
108
+ return comparator;
109
+ }
@@ -0,0 +1,5 @@
1
+ import { type DesignResourceDesignSystemSnapshotV1, type DesignResourceInspectorV1, type DesignResourceLineageNodeV1, type DesignResourceManifestGenerationV1 } from "./design-resource-fact-manifest-types.js";
2
+ export declare function parseDesignResourceLineageNodes(value: unknown, label?: string): DesignResourceLineageNodeV1[];
3
+ export declare function parseDesignResourceFactManifestInspector(value: unknown, label: string): DesignResourceInspectorV1;
4
+ export declare function parseDesignResourceManifestDesignSystem(value: unknown, label: string): DesignResourceDesignSystemSnapshotV1;
5
+ export declare function parseDesignResourceFactManifestGeneration(value: unknown, label: string): DesignResourceManifestGenerationV1;
@@ -0,0 +1,144 @@
1
+ import { DESIGN_RESOURCE_CENSUS_KINDS, DESIGN_RESOURCE_INSPECTOR_CAPABILITIES, DESIGN_RESOURCE_LINEAGE_NODE_KINDS, DESIGN_RESOURCE_MANIFEST_COLLECTIONS, } from "./design-resource-fact-manifest-types.js";
2
+ import { parseDesignResourceLocatedDigest } from "./design-resource-fact-shape-primitives.js";
3
+ import { DESIGN_RESOURCE_LOCATOR_KINDS } from "./design-resource-handoff-types.js";
4
+ import { nonnegativeInteger, positiveInteger, sha256, sourceItemKeys, stableKey, stableKeys, } from "./design-resource-handoff-shape-primitives.js";
5
+ import { array, literal, nullable, object, repositoryFile, string, } from "./long-task-shape-primitives.js";
6
+ export function parseDesignResourceLineageNodes(value, label = "design_resource_handoff.lineage_nodes") {
7
+ return array(value, label).map((item, index) => {
8
+ const itemLabel = `${label}[${index}]`;
9
+ const row = object(item, itemLabel, [
10
+ "key",
11
+ "kind",
12
+ "predecessor_refs",
13
+ "value",
14
+ "census_refs",
15
+ ]);
16
+ return {
17
+ key: stableKey(row.key, `${itemLabel}.key`),
18
+ kind: literal(row.kind, DESIGN_RESOURCE_LINEAGE_NODE_KINDS, `${itemLabel}.kind`),
19
+ predecessor_refs: stableKeys(row.predecessor_refs, `${itemLabel}.predecessor_refs`),
20
+ value: parseDesignResourceLocatedDigest(row.value, `${itemLabel}.value`),
21
+ census_refs: stableKeys(row.census_refs, `${itemLabel}.census_refs`),
22
+ };
23
+ });
24
+ }
25
+ export function parseDesignResourceFactManifestInspector(value, label) {
26
+ const row = object(value, label, [
27
+ "trust",
28
+ "identity",
29
+ "version",
30
+ "implementation_sha256",
31
+ "capability_refs",
32
+ "entry_resource_ref",
33
+ "input_resources",
34
+ "traversal",
35
+ "dynamic_discovery",
36
+ "census",
37
+ ]);
38
+ return {
39
+ trust: literal(row.trust, ["frozen_executable", "named_external_tcb"], `${label}.trust`),
40
+ identity: string(row.identity, `${label}.identity`),
41
+ version: string(row.version, `${label}.version`),
42
+ implementation_sha256: nullable(row.implementation_sha256, (item) => sha256(item, `${label}.implementation_sha256`)),
43
+ capability_refs: array(row.capability_refs, `${label}.capability_refs`).map((item, index) => literal(item, DESIGN_RESOURCE_INSPECTOR_CAPABILITIES, `${label}.capability_refs[${index}]`)),
44
+ entry_resource_ref: stableKey(row.entry_resource_ref, `${label}.entry_resource_ref`),
45
+ input_resources: array(row.input_resources, `${label}.input_resources`).map((item, index) => {
46
+ const itemLabel = `${label}.input_resources[${index}]`;
47
+ const input = object(item, itemLabel, [
48
+ "resource_ref",
49
+ "path",
50
+ "sha256",
51
+ ]);
52
+ return {
53
+ resource_ref: stableKey(input.resource_ref, `${itemLabel}.resource_ref`),
54
+ path: repositoryFile(input.path, `${itemLabel}.path`),
55
+ sha256: sha256(input.sha256, `${itemLabel}.sha256`),
56
+ };
57
+ }),
58
+ traversal: literal(row.traversal, ["complete_enumeration"], `${label}.traversal`),
59
+ dynamic_discovery: literal(row.dynamic_discovery, ["fully_enumerated"], `${label}.dynamic_discovery`),
60
+ census: parseInspectorCensus(row.census, `${label}.census`),
61
+ };
62
+ }
63
+ function parseInspectorCensus(value, label) {
64
+ return array(value, label).map((item, index) => {
65
+ const itemLabel = `${label}[${index}]`;
66
+ const entry = object(item, itemLabel, [
67
+ "key",
68
+ "kind",
69
+ "resource_ref",
70
+ "locator",
71
+ "disposition",
72
+ "fact_refs",
73
+ "fact_cell_refs",
74
+ "source_item_refs",
75
+ "basis_refs",
76
+ "rationale",
77
+ ]);
78
+ const locator = object(entry.locator, `${itemLabel}.locator`, [
79
+ "kind",
80
+ "value",
81
+ ]);
82
+ return {
83
+ key: stableKey(entry.key, `${itemLabel}.key`),
84
+ kind: literal(entry.kind, DESIGN_RESOURCE_CENSUS_KINDS, `${itemLabel}.kind`),
85
+ resource_ref: stableKey(entry.resource_ref, `${itemLabel}.resource_ref`),
86
+ locator: {
87
+ kind: literal(locator.kind, DESIGN_RESOURCE_LOCATOR_KINDS, `${itemLabel}.locator.kind`),
88
+ value: string(locator.value, `${itemLabel}.locator.value`),
89
+ },
90
+ disposition: literal(entry.disposition, ["covered", "non_material"], `${itemLabel}.disposition`),
91
+ fact_refs: stableKeys(entry.fact_refs, `${itemLabel}.fact_refs`),
92
+ fact_cell_refs: stableKeys(entry.fact_cell_refs, `${itemLabel}.fact_cell_refs`),
93
+ source_item_refs: sourceItemKeys(entry.source_item_refs, `${itemLabel}.source_item_refs`),
94
+ basis_refs: stableKeys(entry.basis_refs, `${itemLabel}.basis_refs`),
95
+ rationale: string(entry.rationale, `${itemLabel}.rationale`),
96
+ };
97
+ });
98
+ }
99
+ export function parseDesignResourceManifestDesignSystem(value, label) {
100
+ const row = object(value, label, [
101
+ "disposition",
102
+ "id",
103
+ "revision",
104
+ "resource_ref",
105
+ "sha256",
106
+ ]);
107
+ return {
108
+ disposition: literal(row.disposition, ["used", "not_applicable"], `${label}.disposition`),
109
+ id: string(row.id, `${label}.id`),
110
+ revision: string(row.revision, `${label}.revision`),
111
+ resource_ref: stableKey(row.resource_ref, `${label}.resource_ref`),
112
+ sha256: sha256(row.sha256, `${label}.sha256`),
113
+ };
114
+ }
115
+ export function parseDesignResourceFactManifestGeneration(value, label) {
116
+ const row = object(value, label, [
117
+ "strategy",
118
+ "sampling",
119
+ "truncation",
120
+ "chunk_count",
121
+ "chunk_indexes",
122
+ "collections",
123
+ ]);
124
+ return {
125
+ strategy: literal(row.strategy, ["complete_explicit"], `${label}.strategy`),
126
+ sampling: literal(row.sampling, ["forbidden"], `${label}.sampling`),
127
+ truncation: literal(row.truncation, ["forbidden"], `${label}.truncation`),
128
+ chunk_count: positiveInteger(row.chunk_count, `${label}.chunk_count`),
129
+ chunk_indexes: array(row.chunk_indexes, `${label}.chunk_indexes`).map((item, index) => nonnegativeInteger(item, `${label}.chunk_indexes[${index}]`)),
130
+ collections: array(row.collections, `${label}.collections`).map((item, index) => {
131
+ const itemLabel = `${label}.collections[${index}]`;
132
+ const collection = object(item, itemLabel, [
133
+ "name",
134
+ "expected_count",
135
+ "identity_sha256",
136
+ ]);
137
+ return {
138
+ name: literal(collection.name, DESIGN_RESOURCE_MANIFEST_COLLECTIONS, `${itemLabel}.name`),
139
+ expected_count: nonnegativeInteger(collection.expected_count, `${itemLabel}.expected_count`),
140
+ identity_sha256: sha256(collection.identity_sha256, `${itemLabel}.identity_sha256`),
141
+ };
142
+ }),
143
+ };
144
+ }
@@ -0,0 +1,7 @@
1
+ import type { DesignResourceObservableFactManifestV1 } from "./design-resource-fact-manifest-types.js";
2
+ export * from "./design-resource-fact-manifest-shape-inspector.js";
3
+ export * from "./design-resource-fact-manifest-shape-axes.js";
4
+ export * from "./design-resource-fact-manifest-shape-facts.js";
5
+ export * from "./design-resource-fact-manifest-shape-evidence.js";
6
+ export declare function parseDesignResourceFactManifestJson(content: string): DesignResourceObservableFactManifestV1;
7
+ export declare function parseDesignResourceFactManifestShape(value: unknown): DesignResourceObservableFactManifestV1;
@@ -0,0 +1,75 @@
1
+ import { parseDesignResourceHandoffBlockers, parseDesignResourceHandoffEvidence, parseDesignResourceHandoffFacts, } from "./design-resource-handoff-shape-evidence.js";
2
+ import { parseDesignResourceHandoffConditions, parseDesignResourceHandoffSubjects, } from "./design-resource-handoff-shape-structure.js";
3
+ import { contractKey } from "./design-resource-handoff-shape-primitives.js";
4
+ import { literal, object } from "./long-task-shape-primitives.js";
5
+ import { parseDesignResourceFactManifestGeneration, parseDesignResourceFactManifestInspector, parseDesignResourceLineageNodes, parseDesignResourceManifestDesignSystem, } from "./design-resource-fact-manifest-shape-inspector.js";
6
+ import { parseDesignResourceAxisDispositions, parseDesignResourceConditionExclusions, parseDesignResourceVariationAxisDispositions, parseDesignResourceVariationExclusions, parseDesignResourceVariations, } from "./design-resource-fact-manifest-shape-axes.js";
7
+ import { parseDesignResourceFactCells, parseDesignResourceProofObligations, parseDesignResourceProperties, } from "./design-resource-fact-manifest-shape-facts.js";
8
+ import { parseDesignResourceAssetBindings, parseDesignResourceEnvironments, parseDesignResourceOracles, } from "./design-resource-fact-manifest-shape-evidence.js";
9
+ export * from "./design-resource-fact-manifest-shape-inspector.js";
10
+ export * from "./design-resource-fact-manifest-shape-axes.js";
11
+ export * from "./design-resource-fact-manifest-shape-facts.js";
12
+ export * from "./design-resource-fact-manifest-shape-evidence.js";
13
+ export function parseDesignResourceFactManifestJson(content) {
14
+ let value;
15
+ try {
16
+ value = JSON.parse(content);
17
+ }
18
+ catch (error) {
19
+ throw new Error(`design_resource_fact_manifest_invalid:json:${error instanceof Error ? error.message : String(error)}`);
20
+ }
21
+ return parseDesignResourceFactManifestShape(value);
22
+ }
23
+ export function parseDesignResourceFactManifestShape(value) {
24
+ const label = "design_resource_fact_manifest";
25
+ const root = object(value, label, [
26
+ "schema_version",
27
+ "scope_key",
28
+ "target_key",
29
+ "inspector",
30
+ "design_system",
31
+ "generation",
32
+ "axis_dispositions",
33
+ "condition_exclusions",
34
+ "conditions",
35
+ "subjects",
36
+ "variation_axis_dispositions",
37
+ "variation_exclusions",
38
+ "variations",
39
+ "properties",
40
+ "lineage_nodes",
41
+ "fact_cells",
42
+ "facts",
43
+ "evidence",
44
+ "proof_obligations",
45
+ "oracles",
46
+ "environments",
47
+ "asset_bindings",
48
+ "acceptance_blockers",
49
+ ]);
50
+ return {
51
+ schema_version: literal(root.schema_version, ["design-resource-observable-fact-manifest-v1"], `${label}.schema_version`),
52
+ scope_key: contractKey(root.scope_key, `${label}.scope_key`),
53
+ target_key: contractKey(root.target_key, `${label}.target_key`),
54
+ inspector: parseDesignResourceFactManifestInspector(root.inspector, `${label}.inspector`),
55
+ design_system: parseDesignResourceManifestDesignSystem(root.design_system, `${label}.design_system`),
56
+ generation: parseDesignResourceFactManifestGeneration(root.generation, `${label}.generation`),
57
+ axis_dispositions: parseDesignResourceAxisDispositions(root.axis_dispositions, `${label}.axis_dispositions`),
58
+ condition_exclusions: parseDesignResourceConditionExclusions(root.condition_exclusions, `${label}.condition_exclusions`),
59
+ conditions: parseDesignResourceHandoffConditions(root.conditions),
60
+ subjects: parseDesignResourceHandoffSubjects(root.subjects),
61
+ variation_axis_dispositions: parseDesignResourceVariationAxisDispositions(root.variation_axis_dispositions, `${label}.variation_axis_dispositions`),
62
+ variation_exclusions: parseDesignResourceVariationExclusions(root.variation_exclusions, `${label}.variation_exclusions`),
63
+ variations: parseDesignResourceVariations(root.variations, `${label}.variations`),
64
+ properties: parseDesignResourceProperties(root.properties, `${label}.properties`),
65
+ lineage_nodes: parseDesignResourceLineageNodes(root.lineage_nodes, `${label}.lineage_nodes`),
66
+ fact_cells: parseDesignResourceFactCells(root.fact_cells, `${label}.fact_cells`),
67
+ facts: parseDesignResourceHandoffFacts(root.facts),
68
+ evidence: parseDesignResourceHandoffEvidence(root.evidence),
69
+ proof_obligations: parseDesignResourceProofObligations(root.proof_obligations, `${label}.proof_obligations`),
70
+ oracles: parseDesignResourceOracles(root.oracles, `${label}.oracles`),
71
+ environments: parseDesignResourceEnvironments(root.environments, `${label}.environments`),
72
+ asset_bindings: parseDesignResourceAssetBindings(root.asset_bindings, `${label}.asset_bindings`),
73
+ acceptance_blockers: parseDesignResourceHandoffBlockers(root.acceptance_blockers),
74
+ };
75
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./design-resource-fact-enums.js";
2
+ export * from "./design-resource-fact-types.js";
3
+ export * from "./design-resource-fact-manifest-model.js";
@@ -0,0 +1,3 @@
1
+ export * from "./design-resource-fact-enums.js";
2
+ export * from "./design-resource-fact-types.js";
3
+ export * from "./design-resource-fact-manifest-model.js";
@@ -0,0 +1,5 @@
1
+ import type { DesignResourceObservableFactManifestV1 } from "./design-resource-fact-manifest-types.js";
2
+ import type { DesignResource } from "./design-resource-handoff-file-primitives.js";
3
+ import type { DesignResourceHandoffTargetV1, DesignResourceHandoffV1 } from "./design-resource-handoff-types.js";
4
+ export { conditionAxisValue, manifestIdentityDigest, } from "./design-resource-fact-universe-helpers.js";
5
+ export declare function validateDesignResourceFactManifestUniverse(manifest: DesignResourceObservableFactManifestV1, handoff: DesignResourceHandoffV1, target: DesignResourceHandoffTargetV1, resources: Map<string, DesignResource>, contents: Map<string, Buffer>, sourceItems: Map<string, string>): void;
@@ -0,0 +1,50 @@
1
+ import { validateManifestInspector, validateManifestLineageNodes, } from "./design-resource-fact-universe-inspector.js";
2
+ import { validateManifestDesignSystem, validateManifestSubjects, } from "./design-resource-fact-universe-subjects.js";
3
+ import { validateManifestConditionUniverse } from "./design-resource-fact-universe-conditions.js";
4
+ import { validateManifestVariationUniverse } from "./design-resource-fact-universe-variations.js";
5
+ import { validateManifestCensusOwnership, validateManifestFactCells, validateManifestPropertyCatalog, } from "./design-resource-fact-universe-catalog.js";
6
+ import { validateManifestFacts } from "./design-resource-fact-universe-facts.js";
7
+ import { validateManifestProofAndEvidence } from "./design-resource-fact-universe-proof.js";
8
+ import { validateManifestAssets, validateManifestGeneration, } from "./design-resource-fact-universe-assets.js";
9
+ import { unique } from "./design-resource-fact-universe-helpers.js";
10
+ export { conditionAxisValue, manifestIdentityDigest, } from "./design-resource-fact-universe-helpers.js";
11
+ export function validateDesignResourceFactManifestUniverse(manifest, handoff, target, resources, contents, sourceItems) {
12
+ validateUniqueManifestCollections(manifest);
13
+ const census = new Map(manifest.inspector.census.map((item) => [item.key, item]));
14
+ validateManifestInspector(manifest, handoff, target, resources, contents, sourceItems);
15
+ validateManifestDesignSystem(manifest, handoff, target, resources);
16
+ validateManifestSubjects(manifest, census);
17
+ validateManifestConditionUniverse(manifest, census, sourceItems);
18
+ validateManifestVariationUniverse(manifest, census, sourceItems);
19
+ validateManifestPropertyCatalog(manifest, census);
20
+ validateManifestLineageNodes(manifest, census, resources, contents);
21
+ validateManifestCensusOwnership(manifest);
22
+ validateManifestFactCells(manifest, sourceItems, census);
23
+ validateManifestFacts(manifest, handoff, resources, contents, sourceItems);
24
+ validateManifestProofAndEvidence(manifest, target, resources, contents);
25
+ validateManifestAssets(manifest, resources);
26
+ validateManifestGeneration(manifest);
27
+ }
28
+ function validateUniqueManifestCollections(manifest) {
29
+ for (const [name, rows] of [
30
+ ["inspector_census", manifest.inspector.census],
31
+ ["axis_disposition", manifest.axis_dispositions],
32
+ ["condition_exclusion", manifest.condition_exclusions],
33
+ ["condition", manifest.conditions],
34
+ ["subject", manifest.subjects],
35
+ ["variation_axis_disposition", manifest.variation_axis_dispositions],
36
+ ["variation_exclusion", manifest.variation_exclusions],
37
+ ["variation", manifest.variations],
38
+ ["property", manifest.properties],
39
+ ["lineage_node", manifest.lineage_nodes],
40
+ ["fact_cell", manifest.fact_cells],
41
+ ["fact", manifest.facts],
42
+ ["evidence", manifest.evidence],
43
+ ["proof_obligation", manifest.proof_obligations],
44
+ ["oracle", manifest.oracles],
45
+ ["environment", manifest.environments],
46
+ ["asset_binding", manifest.asset_bindings],
47
+ ["acceptance_blocker", manifest.acceptance_blockers],
48
+ ])
49
+ unique(rows.map((item) => item.key), `manifest_${name}_key_duplicate`);
50
+ }
@@ -0,0 +1,3 @@
1
+ import type { DesignResourceObservableFactManifestV1 } from "./design-resource-fact-manifest-types.js";
2
+ import type { ParsedDesignResourceHandoffV1 } from "./design-resource-handoff-types.js";
3
+ export declare function loadAndValidateDesignResourceFactManifests(repository: string, parsed: ParsedDesignResourceHandoffV1): Promise<Map<string, DesignResourceObservableFactManifestV1>>;
@@ -0,0 +1,106 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { parseDesignResourceFactManifestJson } from "./design-resource-fact-manifest-shape.js";
4
+ import { validateDesignResourceFactManifestUniverse } from "./design-resource-fact-manifest-universe.js";
5
+ import { invalidDesignResourceHandoff } from "./design-resource-handoff-validation-primitives.js";
6
+ import { assertProtectedRepositoryFile } from "./long-task-protected-files.js";
7
+ export async function loadAndValidateDesignResourceFactManifests(repository, parsed) {
8
+ const resources = new Map(parsed.handoff.resources.map((resource) => [resource.key, resource]));
9
+ const contents = new Map();
10
+ for (const resource of parsed.handoff.resources) {
11
+ const file = await assertProtectedRepositoryFile(repository, path.resolve(repository, ...resource.path.split("/")), `design_resource:${resource.key}`);
12
+ contents.set(resource.key, await readFile(file));
13
+ }
14
+ const manifests = new Map();
15
+ const sourceItems = new Map(Object.entries(parsed.source_item_kinds));
16
+ for (const target of parsed.handoff.targets) {
17
+ const manifestRef = target.source_profile.fact_manifest_resource_ref;
18
+ const manifestResource = resources.get(manifestRef);
19
+ if (!manifestResource)
20
+ invalid("fact_manifest_resource_unknown", `${target.key}:${manifestRef}`);
21
+ if (manifestResource.media_type !== "application/json")
22
+ invalid("fact_manifest_media_type_invalid", `${target.key}:${manifestResource.media_type}`);
23
+ if (manifestResource.role !== "supporting")
24
+ invalid("fact_manifest_supporting_role_required", `${target.key}:${manifestResource.role}`);
25
+ if (target.source_profile.entry_resource_ref === manifestRef)
26
+ invalid("fact_manifest_must_not_be_entry", target.key);
27
+ if (!target.source_profile.dependency_resource_refs.includes(manifestRef))
28
+ invalid("fact_manifest_dependency_required", target.key);
29
+ const manifest = parseDesignResourceFactManifestJson(contents.get(manifestRef).toString("utf8"));
30
+ if (manifests.has(manifest.target_key))
31
+ invalid("fact_manifest_target_duplicate", manifest.target_key);
32
+ if (manifest.target_key !== target.key ||
33
+ manifest.scope_key !== parsed.handoff.scope.key)
34
+ invalid("fact_manifest_identity_mismatch", `${target.key}:${manifest.scope_key}:${manifest.target_key}`);
35
+ validateDesignResourceFactManifestUniverse(manifest, parsed.handoff, target, resources, contents, sourceItems);
36
+ validateManifestProjection(parsed.handoff, target.key, manifest);
37
+ manifests.set(target.key, manifest);
38
+ }
39
+ sameSet([...manifests.keys()], parsed.handoff.targets.map((target) => target.key), "fact_manifest_target_set_mismatch", "handoff");
40
+ return manifests;
41
+ }
42
+ function validateManifestProjection(handoff, targetKey, manifest) {
43
+ const target = handoff.targets.find((item) => item.key === targetKey);
44
+ const targetConditions = new Set(target.condition_refs);
45
+ const targetSubjects = new Set(handoff.subjects
46
+ .filter((subject) => subject.target_refs.includes(targetKey))
47
+ .map((subject) => subject.key));
48
+ const targetVariations = new Set(handoff.variations
49
+ .filter((variation) => targetSubjects.has(variation.subject_ref))
50
+ .map((variation) => variation.key));
51
+ const targetFacts = handoff.facts.filter((fact) => fact.target_ref === targetKey);
52
+ const targetFactRefs = new Set(targetFacts.map((fact) => fact.key));
53
+ const targetEvidenceRefs = new Set(targetFacts.flatMap((fact) => fact.evidence_refs));
54
+ const targetProof = handoff.proof_obligations.filter((proof) => targetFactRefs.has(proof.fact_ref));
55
+ const targetOracleRefs = new Set(targetProof.map((proof) => proof.oracle_ref));
56
+ const targetEnvironmentRefs = new Set(targetProof.map((proof) => proof.environment_ref));
57
+ exactRows(handoff.axis_dispositions.filter((row) => row.target_ref === targetKey), manifest.axis_dispositions, "axis_dispositions", targetKey);
58
+ exactRows(handoff.condition_exclusions.filter((row) => row.target_ref === targetKey), manifest.condition_exclusions, "condition_exclusions", targetKey);
59
+ exactRows(handoff.conditions.filter((row) => targetConditions.has(row.key)), manifest.conditions, "conditions", targetKey);
60
+ exactRows(handoff.subjects.filter((row) => targetSubjects.has(row.key)), manifest.subjects, "subjects", targetKey);
61
+ exactRows(handoff.variation_axis_dispositions.filter((row) => targetSubjects.has(row.subject_ref)), manifest.variation_axis_dispositions, "variation_axis_dispositions", targetKey);
62
+ exactRows(handoff.variation_exclusions.filter((row) => targetSubjects.has(row.subject_ref)), manifest.variation_exclusions, "variation_exclusions", targetKey);
63
+ exactRows(handoff.variations.filter((row) => targetVariations.has(row.key)), manifest.variations, "variations", targetKey);
64
+ exactRows(handoff.properties, manifest.properties, "properties", targetKey);
65
+ const targetLineageRefs = new Set(targetFacts.flatMap((fact) => [
66
+ ...fact.lineage.token_chain_refs,
67
+ ...fact.lineage.override_chain_refs,
68
+ ]));
69
+ exactRows(handoff.lineage_nodes.filter((row) => targetLineageRefs.has(row.key)), manifest.lineage_nodes, "lineage_nodes", targetKey);
70
+ exactRows(handoff.fact_cells.filter((row) => row.target_ref === targetKey), manifest.fact_cells, "fact_cells", targetKey);
71
+ exactRows(targetFacts, manifest.facts, "facts", targetKey);
72
+ exactRows(handoff.evidence.filter((row) => targetEvidenceRefs.has(row.key)), manifest.evidence, "evidence", targetKey);
73
+ exactRows(targetProof, manifest.proof_obligations, "proof_obligations", targetKey);
74
+ exactRows(handoff.oracles.filter((row) => targetOracleRefs.has(row.key)), manifest.oracles, "oracles", targetKey);
75
+ exactRows(handoff.environments.filter((row) => targetEnvironmentRefs.has(row.key)), manifest.environments, "environments", targetKey);
76
+ exactRows(handoff.asset_bindings.filter((row) => row.target_refs.includes(targetKey)), manifest.asset_bindings, "asset_bindings", targetKey);
77
+ exactRows(handoff.acceptance_blockers.filter((row) => row.target_refs.includes(targetKey)), manifest.acceptance_blockers, "acceptance_blockers", targetKey);
78
+ }
79
+ function exactRows(handoffRows, manifestRows, collection, targetKey) {
80
+ const handoff = new Map(handoffRows.map((row) => [row.key, canonicalJson(row)]));
81
+ const manifest = new Map(manifestRows.map((row) => [row.key, canonicalJson(row)]));
82
+ sameSet([...handoff.keys()], [...manifest.keys()], `manifest_handoff_${collection}_set_mismatch`, targetKey);
83
+ for (const [key, value] of manifest)
84
+ if (handoff.get(key) !== value)
85
+ invalid(`manifest_handoff_${collection}_row_mismatch`, `${targetKey}:${key}`);
86
+ }
87
+ function canonicalJson(value) {
88
+ if (Array.isArray(value))
89
+ return `[${value.map((item) => canonicalJson(item)).join(",")}]`;
90
+ if (value && typeof value === "object")
91
+ return `{${Object.entries(value)
92
+ .sort(([left], [right]) => left.localeCompare(right))
93
+ .map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`)
94
+ .join(",")}}`;
95
+ return JSON.stringify(value);
96
+ }
97
+ function sameSet(actual, expected, code, detail) {
98
+ const left = [...new Set(actual)].sort();
99
+ const right = [...new Set(expected)].sort();
100
+ if (left.length !== right.length ||
101
+ left.some((item, index) => item !== right[index]))
102
+ invalid(code, `${detail}:${left.join(",")}:${right.join(",")}`);
103
+ }
104
+ function invalid(code, detail) {
105
+ invalidDesignResourceHandoff(code, detail);
106
+ }
@@ -1,4 +1,5 @@
1
1
  import type { DesignResourceDimension, DesignResourceEvidenceKind, DesignResourceVerificationMethod } from "./design-resource-handoff-types.js";
2
+ import type { DesignResourceInspectorCapability } from "./design-resource-fact-manifest-types.js";
2
3
  export declare const DESIGN_RESOURCE_FACT_INVARIANTS: Readonly<{
3
4
  readonly complete_observable_design_fact_delivery: true;
4
5
  readonly resource_fact_inventory_closure_required: true;
@@ -12,6 +13,20 @@ export declare const DESIGN_RESOURCE_FACT_INVARIANTS: Readonly<{
12
13
  readonly no_second_design_fact_authority: true;
13
14
  readonly fact_inventory_required: true;
14
15
  readonly contract_evidence_fact_binding_required: true;
16
+ readonly authoring_obligation_universe_precedes_generation: true;
17
+ readonly frozen_inspector_census_required: true;
18
+ readonly first_class_condition_variation_property_axes_required: true;
19
+ readonly atomic_fact_cell_identity_required: true;
20
+ readonly expected_canonical_handoff_fact_universe_equality_required: true;
21
+ readonly aggregate_state_or_condition_labels_forbidden: true;
22
+ readonly complete_generation_without_sampling_or_truncation_required: true;
23
+ readonly fact_identity_and_proof_method_obligation_separation_required: true;
24
+ readonly property_required_methods_cannot_be_weakened: true;
25
+ readonly design_system_effective_value_lineage_required: true;
26
+ readonly dynamic_relation_and_asset_fact_closure_required: true;
27
+ readonly per_fact_expected_comparison_authority_required: true;
28
+ readonly per_fact_current_result_required: true;
29
+ readonly protected_fact_observation_redaction_required: true;
15
30
  readonly selected_design_fact_antidegradation_required: true;
16
31
  readonly design_fact_distribution_context_cost: true;
17
32
  readonly forbidden_design_fact_shortcuts_absent: true;
@@ -23,3 +38,6 @@ export declare const EXACT_TARGET_FULL_TARGET_METHODS: readonly ["layout_geometr
23
38
  export declare function assertDesignResourceFactPolicyEnabled(): void;
24
39
  export declare function designFactMethodIsCompatible(dimension: DesignResourceDimension, method: DesignResourceVerificationMethod): boolean;
25
40
  export declare function designFactEvidenceIsCompatible(dimension: DesignResourceDimension, kind: DesignResourceEvidenceKind): boolean;
41
+ export declare function designFactEvidenceSupportsMethod(method: DesignResourceVerificationMethod, kind: DesignResourceEvidenceKind): boolean;
42
+ export declare function designFactComparatorSupportsMethod(method: DesignResourceVerificationMethod, comparator: string): boolean;
43
+ export declare function designFactOracleSupportsMethod(method: DesignResourceVerificationMethod, capabilities: readonly DesignResourceInspectorCapability[]): boolean;