project-tiny-context-harness 0.8.3 → 0.8.5

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 (255) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +400 -366
  3. package/assets/README.md +579 -528
  4. package/assets/README.zh-CN.md +341 -309
  5. package/assets/agents/.gitkeep +1 -1
  6. package/assets/agents/AGENTS_CORE.md +44 -25
  7. package/assets/context_templates/architecture.md +28 -28
  8. package/assets/context_templates/area.md +34 -34
  9. package/assets/context_templates/context.toml +30 -30
  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 +32 -32
  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 +148 -125
  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-templates.js +1 -1
  43. package/dist/lib/design-resource-fact-enums.d.ts +20 -0
  44. package/dist/lib/design-resource-fact-enums.js +170 -0
  45. package/dist/lib/design-resource-fact-locator-extractors.d.ts +8 -0
  46. package/dist/lib/design-resource-fact-locator-extractors.js +108 -0
  47. package/dist/lib/design-resource-fact-locator-resolver.d.ts +3 -0
  48. package/dist/lib/design-resource-fact-locator-resolver.js +112 -0
  49. package/dist/lib/design-resource-fact-locator-validation.d.ts +5 -0
  50. package/dist/lib/design-resource-fact-locator-validation.js +16 -0
  51. package/dist/lib/design-resource-fact-manifest-catalog.d.ts +4 -0
  52. package/dist/lib/design-resource-fact-manifest-catalog.js +249 -0
  53. package/dist/lib/design-resource-fact-manifest-model.d.ts +91 -0
  54. package/dist/lib/design-resource-fact-manifest-model.js +21 -0
  55. package/dist/lib/design-resource-fact-manifest-shape-axes.d.ts +6 -0
  56. package/dist/lib/design-resource-fact-manifest-shape-axes.js +159 -0
  57. package/dist/lib/design-resource-fact-manifest-shape-evidence.d.ts +4 -0
  58. package/dist/lib/design-resource-fact-manifest-shape-evidence.js +59 -0
  59. package/dist/lib/design-resource-fact-manifest-shape-facts.d.ts +4 -0
  60. package/dist/lib/design-resource-fact-manifest-shape-facts.js +109 -0
  61. package/dist/lib/design-resource-fact-manifest-shape-inspector.d.ts +5 -0
  62. package/dist/lib/design-resource-fact-manifest-shape-inspector.js +144 -0
  63. package/dist/lib/design-resource-fact-manifest-shape.d.ts +7 -0
  64. package/dist/lib/design-resource-fact-manifest-shape.js +75 -0
  65. package/dist/lib/design-resource-fact-manifest-types.d.ts +3 -0
  66. package/dist/lib/design-resource-fact-manifest-types.js +3 -0
  67. package/dist/lib/design-resource-fact-manifest-universe.d.ts +5 -0
  68. package/dist/lib/design-resource-fact-manifest-universe.js +50 -0
  69. package/dist/lib/design-resource-fact-manifest-validation.d.ts +3 -0
  70. package/dist/lib/design-resource-fact-manifest-validation.js +106 -0
  71. package/dist/lib/design-resource-fact-policy.d.ts +18 -0
  72. package/dist/lib/design-resource-fact-policy.js +72 -1
  73. package/dist/lib/design-resource-fact-property-methods.d.ts +3 -0
  74. package/dist/lib/design-resource-fact-property-methods.js +158 -0
  75. package/dist/lib/design-resource-fact-shape-primitives.d.ts +3 -0
  76. package/dist/lib/design-resource-fact-shape-primitives.js +18 -0
  77. package/dist/lib/design-resource-fact-types.d.ts +164 -0
  78. package/dist/lib/design-resource-fact-types.js +1 -0
  79. package/dist/lib/design-resource-fact-universe-assets.d.ts +4 -0
  80. package/dist/lib/design-resource-fact-universe-assets.js +71 -0
  81. package/dist/lib/design-resource-fact-universe-catalog.d.ts +4 -0
  82. package/dist/lib/design-resource-fact-universe-catalog.js +151 -0
  83. package/dist/lib/design-resource-fact-universe-conditions.d.ts +2 -0
  84. package/dist/lib/design-resource-fact-universe-conditions.js +92 -0
  85. package/dist/lib/design-resource-fact-universe-facts.d.ts +4 -0
  86. package/dist/lib/design-resource-fact-universe-facts.js +108 -0
  87. package/dist/lib/design-resource-fact-universe-helpers.d.ts +30 -0
  88. package/dist/lib/design-resource-fact-universe-helpers.js +167 -0
  89. package/dist/lib/design-resource-fact-universe-inspector.d.ts +7 -0
  90. package/dist/lib/design-resource-fact-universe-inspector.js +119 -0
  91. package/dist/lib/design-resource-fact-universe-proof.d.ts +4 -0
  92. package/dist/lib/design-resource-fact-universe-proof.js +113 -0
  93. package/dist/lib/design-resource-fact-universe-subjects.d.ts +5 -0
  94. package/dist/lib/design-resource-fact-universe-subjects.js +97 -0
  95. package/dist/lib/design-resource-fact-universe-variations.d.ts +2 -0
  96. package/dist/lib/design-resource-fact-universe-variations.js +75 -0
  97. package/dist/lib/design-resource-fact-value-validation.d.ts +2 -0
  98. package/dist/lib/design-resource-fact-value-validation.js +80 -0
  99. package/dist/lib/design-resource-handoff-file-primitives.js +2 -0
  100. package/dist/lib/design-resource-handoff-file-validation.js +13 -100
  101. package/dist/lib/design-resource-handoff-policy.d.ts +1 -0
  102. package/dist/lib/design-resource-handoff-policy.js +118 -11
  103. package/dist/lib/design-resource-handoff-shape-evidence.js +46 -3
  104. package/dist/lib/design-resource-handoff-shape-primitives.d.ts +5 -0
  105. package/dist/lib/design-resource-handoff-shape-primitives.js +28 -0
  106. package/dist/lib/design-resource-handoff-shape-structure.js +143 -22
  107. package/dist/lib/design-resource-handoff-shape.js +25 -0
  108. package/dist/lib/design-resource-handoff-types.d.ts +97 -21
  109. package/dist/lib/design-resource-handoff-types.js +22 -0
  110. package/dist/lib/design-resource-handoff-validation-coverage.d.ts +1 -1
  111. package/dist/lib/design-resource-handoff-validation-coverage.js +145 -118
  112. package/dist/lib/design-resource-handoff-validation-fact-cells.d.ts +2 -0
  113. package/dist/lib/design-resource-handoff-validation-fact-cells.js +60 -0
  114. package/dist/lib/design-resource-handoff-validation-fact-records.d.ts +2 -0
  115. package/dist/lib/design-resource-handoff-validation-fact-records.js +90 -0
  116. package/dist/lib/design-resource-handoff-validation-facts.js +10 -94
  117. package/dist/lib/design-resource-handoff-validation-proofs.d.ts +2 -0
  118. package/dist/lib/design-resource-handoff-validation-proofs.js +67 -0
  119. package/dist/lib/design-resource-handoff-validation-resource-closure.d.ts +3 -0
  120. package/dist/lib/design-resource-handoff-validation-resource-closure.js +88 -0
  121. package/dist/lib/design-resource-handoff-validation-structure.js +43 -14
  122. package/dist/lib/design-resource-handoff-validation.js +32 -0
  123. package/dist/lib/design-resource-handoff-web-dependency-validation.d.ts +2 -1
  124. package/dist/lib/design-resource-handoff-web-dependency-validation.js +67 -7
  125. package/dist/lib/execution-target-capabilities.d.ts +1 -1
  126. package/dist/lib/execution-target-capabilities.js +14 -0
  127. package/dist/lib/long-task-activation-validation.js +6 -2
  128. package/dist/lib/long-task-applicability-shape.js +3 -3
  129. package/dist/lib/long-task-authoring-authority-preview.js +1 -0
  130. package/dist/lib/long-task-authority-policy.d.ts +1 -0
  131. package/dist/lib/long-task-authority-policy.js +1 -0
  132. package/dist/lib/long-task-authority.js +13 -0
  133. package/dist/lib/long-task-claim-definitions.js +13 -1
  134. package/dist/lib/long-task-claims.js +23 -1
  135. package/dist/lib/long-task-contract-types.d.ts +3 -0
  136. package/dist/lib/long-task-delivery-compiler.js +1 -0
  137. package/dist/lib/long-task-delivery-parser.js +11 -1
  138. package/dist/lib/long-task-delivery-types.d.ts +1 -0
  139. package/dist/lib/long-task-delivery-types.js +1 -0
  140. package/dist/lib/long-task-delivery-validation.js +17 -0
  141. package/dist/lib/long-task-design-resource-handoff.js +62 -38
  142. package/dist/lib/long-task-design-target-capabilities.d.ts +14 -0
  143. package/dist/lib/long-task-design-target-capabilities.js +126 -0
  144. package/dist/lib/long-task-evidence-capability-codec.d.ts +94 -0
  145. package/dist/lib/long-task-evidence-capability-codec.js +395 -22
  146. package/dist/lib/long-task-evidence-capability-policy.js +18 -0
  147. package/dist/lib/long-task-evidence-capability-runtime.js +78 -0
  148. package/dist/lib/long-task-evidence-capability-types.d.ts +114 -1
  149. package/dist/lib/long-task-outcome-parser.js +4 -0
  150. package/dist/lib/long-task-playwright-capability-records.d.ts +5 -0
  151. package/dist/lib/long-task-playwright-capability-records.js +146 -0
  152. package/dist/lib/long-task-playwright-case-evidence.d.ts +3 -2
  153. package/dist/lib/long-task-playwright-case-evidence.js +10 -79
  154. package/dist/lib/long-task-playwright-case-primitives.d.ts +28 -0
  155. package/dist/lib/long-task-playwright-case-primitives.js +143 -0
  156. package/dist/lib/long-task-playwright-evidence.d.ts +1 -1
  157. package/dist/lib/long-task-playwright-evidence.js +10 -75
  158. package/dist/lib/long-task-runner-freeze.d.ts +2 -2
  159. package/dist/lib/long-task-runner-freeze.js +15 -1
  160. package/dist/lib/long-task-runtime-types.d.ts +4 -1
  161. package/dist/lib/long-task-semantic-contract-types.d.ts +1 -1
  162. package/dist/lib/long-task-semantic-drift-migration.js +2 -2
  163. package/dist/lib/long-task-semantic-fact-binding-types.d.ts +57 -0
  164. package/dist/lib/long-task-semantic-fact-binding-types.js +1 -0
  165. package/dist/lib/long-task-semantic-fact-closure-primitives.d.ts +5 -0
  166. package/dist/lib/long-task-semantic-fact-closure-primitives.js +43 -0
  167. package/dist/lib/long-task-semantic-fact-closure.d.ts +13 -0
  168. package/dist/lib/long-task-semantic-fact-closure.js +48 -0
  169. package/dist/lib/long-task-semantic-fact-contract-closure.d.ts +4 -0
  170. package/dist/lib/long-task-semantic-fact-contract-closure.js +24 -0
  171. package/dist/lib/long-task-semantic-fact-contract-facts.d.ts +4 -0
  172. package/dist/lib/long-task-semantic-fact-contract-facts.js +30 -0
  173. package/dist/lib/long-task-semantic-fact-contract-proofs.d.ts +4 -0
  174. package/dist/lib/long-task-semantic-fact-contract-proofs.js +97 -0
  175. package/dist/lib/long-task-semantic-fact-evidence.d.ts +21 -0
  176. package/dist/lib/long-task-semantic-fact-evidence.js +165 -0
  177. package/dist/lib/long-task-semantic-fact-input-closure.d.ts +4 -0
  178. package/dist/lib/long-task-semantic-fact-input-closure.js +101 -0
  179. package/dist/lib/long-task-semantic-fact-provenance-closure.d.ts +4 -0
  180. package/dist/lib/long-task-semantic-fact-provenance-closure.js +140 -0
  181. package/dist/lib/long-task-semantic-fact-shape.d.ts +3 -0
  182. package/dist/lib/long-task-semantic-fact-shape.js +89 -0
  183. package/dist/lib/long-task-semantic-fact-value-closure.d.ts +3 -0
  184. package/dist/lib/long-task-semantic-fact-value-closure.js +110 -0
  185. package/dist/lib/long-task-shape-primitives.d.ts +2 -1
  186. package/dist/lib/long-task-shape-primitives.js +7 -0
  187. package/dist/lib/long-task-source-item-parser.js +25 -6
  188. package/dist/lib/long-task-source-target-continuity.js +4 -1
  189. package/dist/lib/long-task-source-target-index.d.ts +1 -1
  190. package/dist/lib/long-task-source-target-index.js +5 -1
  191. package/dist/lib/long-task-ui-design-policy.js +8 -4
  192. package/dist/lib/long-task-ui-surface-shape.js +83 -1
  193. package/dist/lib/long-task-ui-surface-types.d.ts +29 -0
  194. package/dist/lib/migrations.js +64 -0
  195. package/dist/lib/modularity.js +7 -1
  196. package/dist/lib/profiles.js +0 -2
  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
  255. package/assets/skills/normal-long-task/SKILL.md +0 -12
@@ -69,6 +69,12 @@ export function key(value, label) {
69
69
  fail(label, "must match ^[a-z0-9][a-z0-9-]*$");
70
70
  return result;
71
71
  }
72
+ export function semanticRef(value, label) {
73
+ const result = string(value, label);
74
+ if (!/^[a-z0-9][a-z0-9._:-]*$/u.test(result))
75
+ fail(label, "must be a stable lowercase semantic reference");
76
+ return result;
77
+ }
72
78
  export function nullable(value, parser) {
73
79
  return value === null ? null : parser(value);
74
80
  }
@@ -100,6 +106,7 @@ export const EVIDENCE_CAPABILITIES = [
100
106
  "visual_render",
101
107
  "design_conformance",
102
108
  "design_method",
109
+ "semantic_fact",
103
110
  "target_runtime",
104
111
  "input_variation",
105
112
  ];
@@ -1,7 +1,9 @@
1
1
  import { parseDesignResourceHandoffShape } from "./design-resource-handoff-shape.js";
2
+ import { parseSemanticFactManifestShape } from "./semantic-fact-manifest-shape.js";
2
3
  import { normalizeSourceItemText, parseSourceBackgroundMarker, parseSourceItemStartMarker, SOURCE_BACKGROUND_END, SOURCE_BACKGROUND_START, SOURCE_ITEM_END, SOURCE_ITEM_START, validateSourceBackgroundLine, } from "./long-task-source-markers.js";
3
4
  import { parseStrictYaml, sha256Hex } from "./strict-codec.js";
4
5
  const DESIGN_RESOURCE_START = /^\s*```yaml[ \t]+design-resource-handoff-v1[ \t]*$/u;
6
+ const SEMANTIC_FACT_START = /^\s*```yaml[ \t]+semantic-fact-manifest-v1[ \t]*$/u;
5
7
  const FORMAL_BLOCK_END = /^\s*```[ \t]*$/u;
6
8
  export function parseSourceItems(sourcePath, content) {
7
9
  const state = sourceParseState(sourcePath);
@@ -21,6 +23,7 @@ function sourceParseState(sourcePath) {
21
23
  background: null,
22
24
  formalBlock: null,
23
25
  designResourceBlocks: 0,
26
+ semanticFactBlocks: 0,
24
27
  };
25
28
  }
26
29
  function consumeSourceLine(state, line, lineNumber) {
@@ -42,7 +45,11 @@ function consumeOpenFormalBlock(state, line) {
42
45
  return true;
43
46
  }
44
47
  try {
45
- parseDesignResourceHandoffShape(parseStrictYaml(state.formalBlock.lines.join("\n")));
48
+ const value = parseStrictYaml(state.formalBlock.lines.join("\n"));
49
+ if (state.formalBlock.owner === "design-resource-handoff-v1")
50
+ parseDesignResourceHandoffShape(value);
51
+ else
52
+ parseSemanticFactManifestShape(value);
46
53
  }
47
54
  catch (error) {
48
55
  const message = error instanceof Error ? error.message : String(error);
@@ -52,14 +59,26 @@ function consumeOpenFormalBlock(state, line) {
52
59
  return true;
53
60
  }
54
61
  function startFormalBlock(state, line, lineNumber) {
55
- if (!DESIGN_RESOURCE_START.test(line))
62
+ const owner = DESIGN_RESOURCE_START.test(line)
63
+ ? "design-resource-handoff-v1"
64
+ : SEMANTIC_FACT_START.test(line)
65
+ ? "semantic-fact-manifest-v1"
66
+ : null;
67
+ if (!owner)
56
68
  return false;
57
69
  assertNoOpenOwnedSection(state, lineNumber);
58
- state.designResourceBlocks += 1;
59
- if (state.designResourceBlocks > 1)
60
- throw new Error(`source_formal_block_duplicate:${state.sourcePath}:design-resource-handoff-v1`);
70
+ if (owner === "design-resource-handoff-v1") {
71
+ state.designResourceBlocks += 1;
72
+ if (state.designResourceBlocks > 1)
73
+ throw new Error(`source_formal_block_duplicate:${state.sourcePath}:design-resource-handoff-v1`);
74
+ }
75
+ else {
76
+ state.semanticFactBlocks += 1;
77
+ if (state.semanticFactBlocks > 1)
78
+ throw new Error(`source_formal_block_duplicate:${state.sourcePath}:semantic-fact-manifest-v1`);
79
+ }
61
80
  state.formalBlock = {
62
- owner: "design-resource-handoff-v1",
81
+ owner,
63
82
  lines: [],
64
83
  line: lineNumber,
65
84
  };
@@ -32,7 +32,9 @@ function validateSourceClaimContinuity(claim, state, report) {
32
32
  }
33
33
  const ref = refs[0];
34
34
  const target = state.targets.get(ref);
35
- if (!target || sourceKindForTarget(target) !== item.kind) {
35
+ if (!target ||
36
+ (target.kind !== "semantic_fact" &&
37
+ sourceKindForTarget(target) !== item.kind)) {
36
38
  issue(report, `source_target_kind_mismatch:${claim.key}:${item.kind}:${target ? sourceKindForTarget(target) : "unknown"}:${ref}`);
37
39
  return;
38
40
  }
@@ -63,6 +65,7 @@ function validateSourceClaimContinuity(claim, state, report) {
63
65
  "technical_obligation",
64
66
  "non_completing",
65
67
  "forbidden_shortcut",
68
+ "semantic_fact",
66
69
  ].includes(target.kind))
67
70
  state.sourceBackedOutcomeClaims.add(ref);
68
71
  if (!target.outcome_key &&
@@ -1,7 +1,7 @@
1
1
  import type { DeliveryContractV2, SourceItemKind } from "./long-task-delivery-types.js";
2
2
  export interface CanonicalSourceTarget {
3
3
  ref: string;
4
- kind: "outcome_result" | "requirement" | "control" | "technical_obligation" | "non_completing" | "global_constraint" | "non_goal" | "forbidden_shortcut" | "acceptance" | "risk_fact" | "external_confirmation";
4
+ kind: "outcome_result" | "requirement" | "control" | "technical_obligation" | "non_completing" | "global_constraint" | "non_goal" | "forbidden_shortcut" | "acceptance" | "semantic_fact" | "risk_fact" | "external_confirmation";
5
5
  normalized_text?: string;
6
6
  scope?: "global" | "outcome";
7
7
  outcome_key?: string;
@@ -6,6 +6,8 @@ export function buildCanonicalSourceTargetIndex(contract) {
6
6
  targets.push(target(`${outcome.key}.result`, "outcome_result", outcome.product.observable_result, outcome.key));
7
7
  for (const requirement of outcome.product.requirements)
8
8
  targets.push(target(`${outcome.key}.requirement.${requirement.key}`, "requirement", requirement.statement, outcome.key));
9
+ for (const binding of outcome.semantic_fact_bindings.facts)
10
+ targets.push(target(`${outcome.key}.${binding.claim_ref}`, "semantic_fact", undefined, outcome.key));
9
11
  for (const control of outcome.product.controls)
10
12
  for (const field of controlFieldFacts(control))
11
13
  targets.push(target(`${outcome.key}.control.${control.key}.${field.claim_field}`, "control", field.statement, outcome.key));
@@ -64,5 +66,7 @@ function target(ref, kind, text, outcomeKey, scope) {
64
66
  export function sourceKindForTarget(target) {
65
67
  return target.kind === "global_constraint"
66
68
  ? "technical_obligation"
67
- : target.kind;
69
+ : target.kind === "semantic_fact"
70
+ ? null
71
+ : target.kind;
68
72
  }
@@ -19,7 +19,7 @@ function validateDesignTargets({ outcome, binding, outcomeClaims, checks, carrie
19
19
  if (!target.verification_method_bindings.length)
20
20
  issue(report, "ui_design_target_verification_methods_required", label);
21
21
  const methodArtifactPaths = new Set();
22
- const methodFactRefs = new Set();
22
+ const methodFactObligations = new Set();
23
23
  for (const [name, values] of [
24
24
  ["source_paths", target.source_paths],
25
25
  ["condition_keys", target.condition_keys],
@@ -62,10 +62,14 @@ function validateDesignTargets({ outcome, binding, outcomeClaims, checks, carrie
62
62
  issue(report, "ui_design_method_evidence_conditions_mismatch", `${label}:${methodBinding.method}`);
63
63
  for (const artifact of methodBinding.evidence_artifacts) {
64
64
  unique(artifact.fact_refs, "ui_design_method_fact_ref_duplicate", `${label}:${methodBinding.method}:${artifact.condition_key}`, report);
65
+ unique(artifact.fact_expectations.map((item) => item.fact_ref), "ui_design_method_fact_expectation_duplicate", `${label}:${methodBinding.method}:${artifact.condition_key}`, report);
66
+ if (!sameSet(artifact.fact_expectations.map((item) => item.fact_ref), artifact.fact_refs))
67
+ issue(report, "ui_design_method_fact_expectation_refs_mismatch", `${label}:${methodBinding.method}:${artifact.condition_key}`);
65
68
  for (const factRef of artifact.fact_refs) {
66
- if (methodFactRefs.has(factRef))
67
- issue(report, "ui_design_method_fact_ref_reused", `${label}:${factRef}`);
68
- methodFactRefs.add(factRef);
69
+ const obligationIdentity = `${methodBinding.method}\0${artifact.condition_key}\0${factRef}`;
70
+ if (methodFactObligations.has(obligationIdentity))
71
+ issue(report, "ui_design_method_fact_obligation_reused", `${label}:${methodBinding.method}:${artifact.condition_key}:${factRef}`);
72
+ methodFactObligations.add(obligationIdentity);
69
73
  }
70
74
  for (const [kind, artifactPath] of [
71
75
  ["record", artifact.path],
@@ -1,6 +1,8 @@
1
1
  import { DESIGN_RESOURCE_VERIFICATION_METHODS } from "./design-resource-handoff-types.js";
2
+ import { DESIGN_RESOURCE_COMPARATORS } from "./design-resource-fact-manifest-types.js";
3
+ import { parseDesignResourceLocatedDigest } from "./design-resource-fact-shape-primitives.js";
2
4
  import { EXECUTION_TARGET_CAPABILITIES } from "./execution-target-capabilities.js";
3
- import { array, fail, key, literal, object, repositoryFile, repositoryFiles, string, strings, } from "./long-task-shape-primitives.js";
5
+ import { array, fail, key, literal, nullable, object, repositoryFile, repositoryFiles, string, strings, } from "./long-task-shape-primitives.js";
4
6
  export function parseSurfaceBindings(value, label) {
5
7
  return array(value, label).map((item, index) => {
6
8
  const itemLabel = `${label}[${index}]`;
@@ -100,17 +102,85 @@ function parseVerificationMethodBindings(value, label) {
100
102
  "path",
101
103
  "observation_path",
102
104
  "fact_refs",
105
+ "fact_expectations",
103
106
  ]);
104
107
  return {
105
108
  condition_key: key(entry.condition_key, `${artifactLabel}.condition_key`),
106
109
  path: repositoryFile(entry.path, `${artifactLabel}.path`),
107
110
  observation_path: repositoryFile(entry.observation_path, `${artifactLabel}.observation_path`),
108
111
  fact_refs: designFactRefs(entry.fact_refs, `${artifactLabel}.fact_refs`),
112
+ fact_expectations: parseDesignFactExpectations(entry.fact_expectations, `${artifactLabel}.fact_expectations`),
109
113
  };
110
114
  }),
111
115
  };
112
116
  });
113
117
  }
118
+ function parseDesignFactExpectations(value, label) {
119
+ return array(value, label).map((item, index) => {
120
+ const itemLabel = `${label}[${index}]`;
121
+ const row = object(item, itemLabel, [
122
+ "fact_ref",
123
+ "subject_ref",
124
+ "variation_ref",
125
+ "property_ref",
126
+ "observation_sensitivity",
127
+ "expected",
128
+ "comparison",
129
+ "oracle",
130
+ "environment",
131
+ ]);
132
+ const comparison = object(row.comparison, `${itemLabel}.comparison`, [
133
+ "comparator",
134
+ "mode",
135
+ "parameters",
136
+ "tolerance",
137
+ "mask",
138
+ ]);
139
+ const comparator = string(comparison.comparator, `${itemLabel}.comparison.comparator`);
140
+ if (!DESIGN_RESOURCE_COMPARATORS.includes(comparator) &&
141
+ !/^custom\.[a-z0-9][a-z0-9._-]*$/u.test(comparator))
142
+ fail(`${itemLabel}.comparison.comparator`, "must be a standard comparator or custom.*");
143
+ const oracle = object(row.oracle, `${itemLabel}.oracle`, [
144
+ "key",
145
+ "trust",
146
+ "identity",
147
+ "version",
148
+ "sha256",
149
+ ]);
150
+ const environment = object(row.environment, `${itemLabel}.environment`, [
151
+ "key",
152
+ "identity",
153
+ "definition",
154
+ ]);
155
+ return {
156
+ fact_ref: designFactRef(row.fact_ref, `${itemLabel}.fact_ref`),
157
+ subject_ref: designFactRef(row.subject_ref, `${itemLabel}.subject_ref`),
158
+ variation_ref: designFactRef(row.variation_ref, `${itemLabel}.variation_ref`),
159
+ property_ref: designFactRef(row.property_ref, `${itemLabel}.property_ref`),
160
+ observation_sensitivity: literal(row.observation_sensitivity, ["plain", "protected"], `${itemLabel}.observation_sensitivity`),
161
+ expected: parseDesignResourceLocatedDigest(row.expected, `${itemLabel}.expected`),
162
+ comparison: {
163
+ comparator,
164
+ mode: literal(comparison.mode, ["exact", "tolerance"], `${itemLabel}.comparison.mode`),
165
+ parameters: parseDesignResourceLocatedDigest(comparison.parameters, `${itemLabel}.comparison.parameters`),
166
+ tolerance: nullable(comparison.tolerance, (entry) => parseDesignResourceLocatedDigest(entry, `${itemLabel}.comparison.tolerance`)),
167
+ mask: nullable(comparison.mask, (entry) => parseDesignResourceLocatedDigest(entry, `${itemLabel}.comparison.mask`)),
168
+ },
169
+ oracle: {
170
+ key: designFactRef(oracle.key, `${itemLabel}.oracle.key`),
171
+ trust: literal(oracle.trust, ["frozen_executable", "named_external_tcb"], `${itemLabel}.oracle.trust`),
172
+ identity: string(oracle.identity, `${itemLabel}.oracle.identity`),
173
+ version: string(oracle.version, `${itemLabel}.oracle.version`),
174
+ sha256: nullable(oracle.sha256, (entry) => digest(entry, `${itemLabel}.oracle.sha256`)),
175
+ },
176
+ environment: {
177
+ key: designFactRef(environment.key, `${itemLabel}.environment.key`),
178
+ identity: string(environment.identity, `${itemLabel}.environment.identity`),
179
+ definition: parseDesignResourceLocatedDigest(environment.definition, `${itemLabel}.environment.definition`),
180
+ },
181
+ };
182
+ });
183
+ }
114
184
  function keys(value, label) {
115
185
  return array(value, label).map((item, index) => key(item, `${label}[${index}]`));
116
186
  }
@@ -123,3 +193,15 @@ function designFactRefs(value, label) {
123
193
  return result;
124
194
  });
125
195
  }
196
+ function designFactRef(value, label) {
197
+ const result = string(value, label);
198
+ if (!/^[a-z0-9][a-z0-9._-]*$/u.test(result))
199
+ fail(label, "must match ^[a-z0-9][a-z0-9._-]*$");
200
+ return result;
201
+ }
202
+ function digest(value, label) {
203
+ const result = string(value, label);
204
+ if (!/^[a-f0-9]{64}$/u.test(result))
205
+ fail(label, "must be a lowercase SHA-256");
206
+ return result;
207
+ }
@@ -1,6 +1,34 @@
1
1
  import type { DesignResourceVerificationMethod } from "./design-resource-handoff-types.js";
2
+ import type { DesignResourceComparator, DesignResourceLocatedDigestV1 } from "./design-resource-fact-manifest-types.js";
2
3
  import type { ExecutionTargetCapabilityV2 } from "./execution-target-capabilities.js";
3
4
  export type DesignTargetInterpretationV2 = "exact_target" | "constraint";
5
+ export interface DeliveryDesignFactExpectationV2 {
6
+ fact_ref: string;
7
+ subject_ref: string;
8
+ variation_ref: string;
9
+ property_ref: string;
10
+ observation_sensitivity: "plain" | "protected";
11
+ expected: DesignResourceLocatedDigestV1;
12
+ comparison: {
13
+ comparator: DesignResourceComparator | string;
14
+ mode: "exact" | "tolerance";
15
+ parameters: DesignResourceLocatedDigestV1;
16
+ tolerance: DesignResourceLocatedDigestV1 | null;
17
+ mask: DesignResourceLocatedDigestV1 | null;
18
+ };
19
+ oracle: {
20
+ key: string;
21
+ trust: "frozen_executable" | "named_external_tcb";
22
+ identity: string;
23
+ version: string;
24
+ sha256: string | null;
25
+ };
26
+ environment: {
27
+ key: string;
28
+ identity: string;
29
+ definition: DesignResourceLocatedDigestV1;
30
+ };
31
+ }
4
32
  export interface DeliveryDesignVerificationBindingV2 {
5
33
  method: DesignResourceVerificationMethod;
6
34
  assertion_ref: string;
@@ -9,6 +37,7 @@ export interface DeliveryDesignVerificationBindingV2 {
9
37
  path: string;
10
38
  observation_path: string;
11
39
  fact_refs: string[];
40
+ fact_expectations: DeliveryDesignFactExpectationV2[];
12
41
  }>;
13
42
  }
14
43
  export interface DeliveryDesignTargetV2 {
@@ -1,3 +1,4 @@
1
+ import { createHash } from "node:crypto";
1
2
  import path from "node:path";
2
3
  import { promises as fs } from "node:fs";
3
4
  import { CONTEXT_MANIFEST_PATH, contextManifestFromExistingAreas, } from "./context-manifest.js";
@@ -13,6 +14,8 @@ import { semanticDriftMigrationFields } from "./long-task-semantic-drift-migrati
13
14
  async function verifyNoop() {
14
15
  return;
15
16
  }
17
+ const REMOVED_NORMAL_LONG_TASK_SKILL = "normal-long-task";
18
+ const REMOVED_NORMAL_LONG_TASK_SKILL_SHA256 = "7a4f755da9a32e07f258d6c7fc5e5c70395257c72efb8a9ad4995cddcc4c73ba";
16
19
  export const migrations = [
17
20
  legacySdlcHarnessMigration,
18
21
  {
@@ -25,6 +28,17 @@ export const migrations = [
25
28
  detect: detectLongTaskSemanticDriftAuthority,
26
29
  verify: verifyNoop,
27
30
  },
31
+ {
32
+ id: "remove-normal-long-task-skill",
33
+ introducedIn: "0.8.4",
34
+ description: "Remove the obsolete normal-long-task compatibility Skill; long-task-workflow is the sole explicit Long-Task execution Skill.",
35
+ scope: "<harnessRoot>/skills/normal-long-task",
36
+ risk: "safe",
37
+ manualMessage: "The same-name directory differs from the former package-owned compatibility Skill. Preserve any user-authored content elsewhere, then remove the directory manually.",
38
+ detect: detectRemovedNormalLongTaskSkill,
39
+ apply: migrateRemovedNormalLongTaskSkill,
40
+ verify: verifyRemovedNormalLongTaskSkill,
41
+ },
28
42
  {
29
43
  id: "long-task-v1-retirement",
30
44
  introducedIn: "0.6.0",
@@ -131,6 +145,56 @@ async function detectLongTaskSemanticDriftAuthority(projectRoot, _root, migratio
131
145
  item(migration, "manual_required", ".long-task/delivery-contract.yaml", `The active/draft V2 Contract predates semantic-drift authority and is missing: ${fields.slice(0, 12).join(", ")}${fields.length > 12 ? `, +${fields.length - 12} more` : ""}. Re-author these meanings from Source; do not synthesize them from old passing evidence.`),
132
146
  ];
133
147
  }
148
+ async function detectRemovedNormalLongTaskSkill(projectRoot, root, migration) {
149
+ const skill = removedNormalLongTaskSkillPath(projectRoot, root);
150
+ const state = await removedNormalLongTaskSkillState(skill);
151
+ if (state === "absent")
152
+ return [];
153
+ const relative = path.relative(projectRoot, skill).split(path.sep).join("/");
154
+ return [
155
+ item(migration, state === "package-owned" ? "safe_pending" : "manual_required", relative, state === "package-owned"
156
+ ? "Remove the exact obsolete package-owned compatibility Skill."
157
+ : "The obsolete Skill directory contains modified or additional content; preserve any user-authored material elsewhere and remove it manually."),
158
+ ];
159
+ }
160
+ async function migrateRemovedNormalLongTaskSkill(projectRoot, root, report) {
161
+ const skill = removedNormalLongTaskSkillPath(projectRoot, root);
162
+ const state = await removedNormalLongTaskSkillState(skill);
163
+ const relative = path.relative(projectRoot, skill).split(path.sep).join("/");
164
+ if (state === "absent") {
165
+ report.skipped.push("remove-normal-long-task-skill");
166
+ return;
167
+ }
168
+ if (state !== "package-owned") {
169
+ throw new Error(`${relative} changed after upgrade planning; rerun upgrade and resolve the manual_required item`);
170
+ }
171
+ await fs.rm(skill, { recursive: true, force: true });
172
+ report.changed.push(relative);
173
+ }
174
+ async function verifyRemovedNormalLongTaskSkill(projectRoot, root) {
175
+ if (await pathExists(removedNormalLongTaskSkillPath(projectRoot, root))) {
176
+ throw new Error("remove-normal-long-task-skill migration verification failed");
177
+ }
178
+ }
179
+ function removedNormalLongTaskSkillPath(projectRoot, root) {
180
+ return path.join(projectRoot, root, "skills", REMOVED_NORMAL_LONG_TASK_SKILL);
181
+ }
182
+ async function removedNormalLongTaskSkillState(skill) {
183
+ if (!(await pathExists(skill)))
184
+ return "absent";
185
+ const files = await listFiles(skill);
186
+ if (files.length === 0)
187
+ return "package-owned";
188
+ if (files.length !== 1 ||
189
+ path.relative(skill, files[0]).split(path.sep).join("/") !== "SKILL.md") {
190
+ return "modified";
191
+ }
192
+ const normalized = (await readText(files[0])).replace(/\r\n/g, "\n");
193
+ const digest = createHash("sha256").update(normalized).digest("hex");
194
+ return digest === REMOVED_NORMAL_LONG_TASK_SKILL_SHA256
195
+ ? "package-owned"
196
+ : "modified";
197
+ }
134
198
  async function detectLongTaskV1Retirement(projectRoot, root, migration) {
135
199
  const items = [];
136
200
  const hook = path.join(projectRoot, root, "hooks", "long-task-hook.mjs");
@@ -57,7 +57,8 @@ export async function runModularityCheck(projectRoot, options) {
57
57
  }
58
58
  const files = [];
59
59
  for (const relativePath of [...candidates].sort()) {
60
- if (!shouldIncludeCodeFile(relativePath)) {
60
+ if (isWorkflowAuthorityArtifact(relativePath) ||
61
+ !shouldIncludeCodeFile(relativePath)) {
61
62
  continue;
62
63
  }
63
64
  const absolutePath = path.join(projectRoot, ...relativePath.split("/"));
@@ -103,6 +104,11 @@ export async function runModularityCheck(projectRoot, options) {
103
104
  errors: [...configErrors, ...waiverErrors, ...waiverTargetErrors],
104
105
  };
105
106
  }
107
+ function isWorkflowAuthorityArtifact(relativePath) {
108
+ const normalized = toPosix(relativePath);
109
+ return (normalized.startsWith(".work_products/") &&
110
+ normalized.endsWith("/delivery-contract.yaml"));
111
+ }
106
112
  function analyzeFile(content, limit, relativePath) {
107
113
  const lines = countPhysicalLines(content);
108
114
  const metrics = analyzeModularity(content, relativePath);
@@ -58,8 +58,6 @@ export function enabledManagedSkillNames(config) {
58
58
  "design-system-authoring",
59
59
  "design-resource-authoring",
60
60
  ]);
61
- if (isProfileEnabled(config, "workflow-default"))
62
- names.add("normal-long-task");
63
61
  if (isProfileEnabled(config, "long-task")) {
64
62
  names.add("long-task-workflow");
65
63
  names.add("source-plan-authoring");
@@ -0,0 +1,14 @@
1
+ export type SemanticFactDisposition = "applicable" | "not_applicable" | "decision_required" | "unavailable";
2
+ export type SemanticFactAuthorityKind = "direct" | "logically_derived" | "explicitly_delegated" | "evidence_backed_preservation";
3
+ export type SemanticFactValueKind = "boolean" | "number" | "string" | "enum" | "set" | "ordered_list" | "object" | "schema" | "relation" | "decision_table" | "formula" | "range" | "duration" | "timestamp" | "rate" | "ratio" | "digest" | "trace" | "custom";
4
+ export type SemanticFactLocatorKind = "source_item" | "manifest_pointer" | "json_pointer" | "yaml_pointer" | "whole_resource" | "schema_pointer" | "api_operation" | "code_symbol" | "custom";
5
+ export interface SemanticFactLocatedValueV1 {
6
+ representation: "inline" | "located" | "digest_only";
7
+ locator: {
8
+ material_ref: string;
9
+ kind: SemanticFactLocatorKind;
10
+ value: string;
11
+ };
12
+ sha256: string;
13
+ value?: unknown;
14
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export declare const SEMANTIC_FACT_STANDARD_FAMILIES: readonly ["goal_scope_glossary", "actor_role_tenant_entitlement", "business_rule_calculation", "data_model", "operation_workflow", "state_machine", "temporal_scheduling", "input_validation", "output_error", "api_protocol", "event_message_job", "persistence_cache_search", "transaction_consistency_concurrency_idempotency", "fault_degradation_recovery", "backup_restore_disaster_recovery", "configuration_feature_flag_secret", "compatibility_migration_rollout", "performance_capacity_cost", "reliability_slo", "security", "privacy", "safety_compliance", "observability", "deployment_topology", "external_integration", "notification_file_media", "localization", "commercial_billing", "hardware_sensor", "ai_ml", "architecture_ownership"];
2
+ export declare const SEMANTIC_FACT_STANDARD_CONDITION_AXES: readonly ["actor", "role", "tenant", "organization", "jurisdiction", "residency", "environment", "region", "zone", "platform", "device", "client_version", "api_version", "schema_version", "runtime_version", "feature", "cohort", "configuration", "entitlement", "permission", "consent", "session", "entity_state", "prior_state", "input_class", "boundary_case", "data_volume", "locale", "timezone", "clock", "concurrency", "repetition", "dependency_health", "connectivity", "failure_class", "retry_phase", "consistency", "freshness", "migration_phase", "rollout_phase", "topology", "threat", "operational_mode"];
3
+ export declare const SEMANTIC_FACT_REQUIRED_INSPECTOR_CAPABILITIES: readonly ["source_inventory", "context_inventory", "input_classification", "standard_catalog", "custom_domain_discovery", "subject_inventory", "relation_inventory", "population_inventory", "condition_axis_inventory", "condition_combination_inventory", "property_inventory", "fact_cell_inventory", "proof_obligation_inventory"];
4
+ export declare const SEMANTIC_FACT_PROOF_METHODS: readonly ["exact_value", "schema_contract", "decision_table", "formula_evaluation", "invariant", "transition_trace", "sequence_trace", "durable_roundtrip", "boundary_invocation", "external_side_effect", "population_set_equality", "concurrency_schedule", "idempotency_repetition", "fault_injection", "recovery_drill", "migration", "compatibility", "performance", "capacity", "security", "privacy", "audit", "observability", "deployment", "implementation_structure"];
5
+ export declare const SEMANTIC_FACT_COMPARATORS: readonly ["exact_value", "semantic_equal", "set_equal", "ordered_equal", "schema_compatible", "decision_table_complete", "numeric_tolerance", "range_contains", "trace_equal", "invariant_holds", "population_set_equal", "latency_budget", "capacity_budget", "security_policy", "privacy_policy", "custom"];
6
+ export declare const SEMANTIC_FACT_STANDARD_PROPERTIES: Readonly<Record<(typeof SEMANTIC_FACT_STANDARD_FAMILIES)[number], readonly string[]>>;
7
+ export declare function isCustomSemanticFactName(value: string): boolean;
8
+ export declare function isAtomicSemanticFactAtom(value: string): boolean;