project-tiny-context-harness 0.8.11 → 0.8.12

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 (272) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +490 -472
  3. package/assets/README.md +762 -749
  4. package/assets/README.zh-CN.md +446 -431
  5. package/assets/agents/.gitkeep +1 -1
  6. package/assets/agents/AGENTS_CORE.md +17 -23
  7. package/assets/agents/long-task-implementation.toml +15 -0
  8. package/assets/context_templates/architecture.md +18 -18
  9. package/assets/context_templates/area.md +30 -30
  10. package/assets/context_templates/context.toml +24 -24
  11. package/assets/context_templates/deployment.md +35 -35
  12. package/assets/context_templates/global.md +56 -56
  13. package/assets/context_templates/product-surface-contract.md +70 -70
  14. package/assets/context_templates/screen-contract.md +189 -189
  15. package/assets/context_templates/verification.md +25 -25
  16. package/assets/github/.gitkeep +1 -1
  17. package/assets/github/harness.yml +39 -39
  18. package/assets/make/.gitkeep +1 -1
  19. package/assets/make/ty-context.mk +48 -48
  20. package/assets/skills/context_development_engineer/SKILL.md +64 -185
  21. package/assets/skills/context_full_project_export/SKILL.md +28 -28
  22. package/assets/skills/context_harness_upgrade/SKILL.md +60 -60
  23. package/assets/skills/context_product_plan/SKILL.md +35 -101
  24. package/assets/skills/context_surface_contract/SKILL.md +194 -191
  25. package/assets/skills/context_uiux_design/SKILL.md +49 -172
  26. package/assets/skills/design-resource-authoring/SKILL.md +52 -88
  27. package/assets/skills/design-resource-authoring/references/downstream-handoff.md +51 -163
  28. package/assets/skills/design-resource-authoring/references/formal-selected-web-app-handoff.md +96 -0
  29. package/assets/skills/design-resource-authoring/references/open-design-provider.md +119 -119
  30. package/assets/skills/design-resource-authoring/references/resource-selection.md +158 -181
  31. package/assets/skills/design-system-authoring/SKILL.md +57 -57
  32. package/assets/skills/design-system-authoring/agents/openai.yaml +6 -6
  33. package/assets/skills/design-system-authoring/references/authority-adoption.md +48 -48
  34. package/assets/skills/design-system-authoring/references/open-design-design-system-provider.md +110 -110
  35. package/assets/skills/long-task-workflow/SKILL.md +71 -106
  36. package/assets/skills/long-task-workflow/agents/openai.yaml +1 -1
  37. package/assets/skills/long-task-workflow/references/authority-lifecycle.md +71 -69
  38. package/assets/skills/long-task-workflow/references/contract-authoring.md +98 -94
  39. package/assets/skills/long-task-workflow/references/evidence-design.md +67 -63
  40. package/assets/skills/long-task-workflow/references/source-authoring.md +90 -90
  41. package/assets/tools/validate_context.py +442 -442
  42. package/dist/commands/design-resource.js +9 -2
  43. package/dist/commands/enable.js +2 -0
  44. package/dist/commands/index.js +1 -1
  45. package/dist/commands/long-task-revision.js +8 -7
  46. package/dist/commands/sync.js +2 -0
  47. package/dist/index.d.ts +3 -3
  48. package/dist/index.js +2 -0
  49. package/dist/lib/compact-authoring-support.d.ts +22 -0
  50. package/dist/lib/compact-authoring-support.js +143 -0
  51. package/dist/lib/compact-shared-structure-authoring.d.ts +5 -0
  52. package/dist/lib/compact-shared-structure-authoring.js +9 -0
  53. package/dist/lib/compact-shared-structure-types.d.ts +61 -0
  54. package/dist/lib/compact-shared-structure-types.js +1 -0
  55. package/dist/lib/compact-shared-structure-validation.d.ts +2 -0
  56. package/dist/lib/compact-shared-structure-validation.js +159 -0
  57. package/dist/lib/compact-shared-structures.d.ts +3 -0
  58. package/dist/lib/compact-shared-structures.js +204 -0
  59. package/dist/lib/design-resource-fact-enums.d.ts +4 -0
  60. package/dist/lib/design-resource-fact-enums.js +12 -0
  61. package/dist/lib/design-resource-fact-manifest-shape-evidence.js +2 -2
  62. package/dist/lib/design-resource-fact-policy.d.ts +2 -2
  63. package/dist/lib/design-resource-fact-types.d.ts +2 -2
  64. package/dist/lib/design-resource-handoff-bundle-draft.js +4 -2
  65. package/dist/lib/design-resource-handoff-input-types.d.ts +3 -0
  66. package/dist/lib/design-resource-handoff-parser.d.ts +2 -2
  67. package/dist/lib/design-resource-handoff-parser.js +2 -2
  68. package/dist/lib/design-resource-handoff-shape.d.ts +2 -0
  69. package/dist/lib/design-resource-handoff-shape.js +10 -0
  70. package/dist/lib/design-resource-handoff-snapshot.js +4 -0
  71. package/dist/lib/design-resource-handoff-validation.d.ts +4 -1
  72. package/dist/lib/design-resource-handoff-validation.js +11 -0
  73. package/dist/lib/design-resource-handoff-web-dependency-validation.d.ts +4 -2
  74. package/dist/lib/design-resource-symbolic-applicability-authority.d.ts +7 -0
  75. package/dist/lib/design-resource-symbolic-applicability-authority.js +19 -0
  76. package/dist/lib/design-resource-symbolic-applicability-policy.d.ts +12 -0
  77. package/dist/lib/design-resource-symbolic-applicability-policy.js +79 -0
  78. package/dist/lib/design-resource-symbolic-applicability-profiles.d.ts +8 -0
  79. package/dist/lib/design-resource-symbolic-applicability-profiles.js +55 -0
  80. package/dist/lib/design-resource-symbolic-applicability-shape.d.ts +2 -0
  81. package/dist/lib/design-resource-symbolic-applicability-shape.js +76 -0
  82. package/dist/lib/design-resource-symbolic-applicability-validation.d.ts +7 -0
  83. package/dist/lib/design-resource-symbolic-applicability-validation.js +128 -0
  84. package/dist/lib/design-resource-symbolic-compilation.d.ts +3 -0
  85. package/dist/lib/design-resource-symbolic-compilation.js +13 -0
  86. package/dist/lib/design-resource-symbolic-denotation.d.ts +3 -0
  87. package/dist/lib/design-resource-symbolic-denotation.js +167 -0
  88. package/dist/lib/design-resource-symbolic-disposition-validation.d.ts +4 -0
  89. package/dist/lib/design-resource-symbolic-disposition-validation.js +28 -0
  90. package/dist/lib/design-resource-symbolic-fact-policy.d.ts +12 -0
  91. package/dist/lib/design-resource-symbolic-fact-policy.js +12 -0
  92. package/dist/lib/design-resource-symbolic-fact-shape.d.ts +3 -0
  93. package/dist/lib/design-resource-symbolic-fact-shape.js +138 -0
  94. package/dist/lib/design-resource-symbolic-fact-types.d.ts +213 -0
  95. package/dist/lib/design-resource-symbolic-fact-types.js +1 -0
  96. package/dist/lib/design-resource-symbolic-fact-validation.d.ts +3 -0
  97. package/dist/lib/design-resource-symbolic-fact-validation.js +86 -0
  98. package/dist/lib/design-resource-symbolic-indexes.d.ts +23 -0
  99. package/dist/lib/design-resource-symbolic-indexes.js +54 -0
  100. package/dist/lib/design-resource-symbolic-manifest-shape.d.ts +3 -0
  101. package/dist/lib/design-resource-symbolic-manifest-shape.js +155 -0
  102. package/dist/lib/design-resource-symbolic-manifest-validation.d.ts +6 -0
  103. package/dist/lib/design-resource-symbolic-manifest-validation.js +132 -0
  104. package/dist/lib/design-resource-symbolic-noninterference-artifact.d.ts +33 -0
  105. package/dist/lib/design-resource-symbolic-noninterference-artifact.js +110 -0
  106. package/dist/lib/design-resource-symbolic-noninterference-equivalence.d.ts +3 -0
  107. package/dist/lib/design-resource-symbolic-noninterference-equivalence.js +77 -0
  108. package/dist/lib/design-resource-symbolic-noninterference-recompute.d.ts +4 -0
  109. package/dist/lib/design-resource-symbolic-noninterference-recompute.js +146 -0
  110. package/dist/lib/design-resource-symbolic-noninterference-scope.d.ts +7 -0
  111. package/dist/lib/design-resource-symbolic-noninterference-scope.js +49 -0
  112. package/dist/lib/design-resource-symbolic-noninterference-shape.d.ts +2 -0
  113. package/dist/lib/design-resource-symbolic-noninterference-shape.js +152 -0
  114. package/dist/lib/design-resource-symbolic-noninterference-types.d.ts +103 -0
  115. package/dist/lib/design-resource-symbolic-noninterference-types.js +1 -0
  116. package/dist/lib/design-resource-symbolic-noninterference-validation.d.ts +5 -0
  117. package/dist/lib/design-resource-symbolic-noninterference-validation.js +62 -0
  118. package/dist/lib/design-resource-symbolic-oracle-fingerprint.d.ts +1 -0
  119. package/dist/lib/design-resource-symbolic-oracle-fingerprint.js +47 -0
  120. package/dist/lib/design-resource-symbolic-predicate-shape.d.ts +6 -0
  121. package/dist/lib/design-resource-symbolic-predicate-shape.js +123 -0
  122. package/dist/lib/design-resource-symbolic-production-closure.d.ts +4 -0
  123. package/dist/lib/design-resource-symbolic-production-closure.js +144 -0
  124. package/dist/lib/design-resource-symbolic-proof-authority-validation.d.ts +10 -0
  125. package/dist/lib/design-resource-symbolic-proof-authority-validation.js +68 -0
  126. package/dist/lib/design-resource-symbolic-proof-validation.d.ts +10 -0
  127. package/dist/lib/design-resource-symbolic-proof-validation.js +89 -0
  128. package/dist/lib/design-resource-symbolic-region-validation.d.ts +19 -0
  129. package/dist/lib/design-resource-symbolic-region-validation.js +146 -0
  130. package/dist/lib/design-resource-symbolic-resource-validation.d.ts +5 -0
  131. package/dist/lib/design-resource-symbolic-resource-validation.js +90 -0
  132. package/dist/lib/design-resource-symbolic-rule-shape.d.ts +27 -0
  133. package/dist/lib/design-resource-symbolic-rule-shape.js +158 -0
  134. package/dist/lib/design-resource-symbolic-safety-validation.d.ts +6 -0
  135. package/dist/lib/design-resource-symbolic-safety-validation.js +29 -0
  136. package/dist/lib/design-resource-symbolic-source-ir-evaluation.d.ts +19 -0
  137. package/dist/lib/design-resource-symbolic-source-ir-evaluation.js +74 -0
  138. package/dist/lib/design-resource-symbolic-source-ir-evidence.d.ts +44 -0
  139. package/dist/lib/design-resource-symbolic-source-ir-evidence.js +88 -0
  140. package/dist/lib/design-resource-symbolic-source-ir-oracle.d.ts +13 -0
  141. package/dist/lib/design-resource-symbolic-source-ir-oracle.js +96 -0
  142. package/dist/lib/design-resource-symbolic-source-ir-proof.d.ts +14 -0
  143. package/dist/lib/design-resource-symbolic-source-ir-proof.js +98 -0
  144. package/dist/lib/design-resource-symbolic-source-ir-shape.d.ts +2 -0
  145. package/dist/lib/design-resource-symbolic-source-ir-shape.js +38 -0
  146. package/dist/lib/design-resource-symbolic-source-ir-types.d.ts +17 -0
  147. package/dist/lib/design-resource-symbolic-source-ir-types.js +2 -0
  148. package/dist/lib/design-resource-symbolic-static-dependency-validation.d.ts +2 -0
  149. package/dist/lib/design-resource-symbolic-static-dependency-validation.js +83 -0
  150. package/dist/lib/design-resource-symbolic-structural-closure-validation.d.ts +6 -0
  151. package/dist/lib/design-resource-symbolic-structural-closure-validation.js +79 -0
  152. package/dist/lib/design-resource-symbolic-validation-support.d.ts +29 -0
  153. package/dist/lib/design-resource-symbolic-validation-support.js +111 -0
  154. package/dist/lib/design-resource-v1-capacity-header.d.ts +8 -0
  155. package/dist/lib/design-resource-v1-capacity-header.js +231 -0
  156. package/dist/lib/design-resource-v1-capacity.d.ts +5 -0
  157. package/dist/lib/design-resource-v1-capacity.js +45 -0
  158. package/dist/lib/init.js +1 -0
  159. package/dist/lib/long-task-activation-validation.js +2 -2
  160. package/dist/lib/long-task-authority-policy.d.ts +3 -0
  161. package/dist/lib/long-task-authority-policy.js +3 -0
  162. package/dist/lib/long-task-codex-agent-profile.d.ts +42 -0
  163. package/dist/lib/long-task-codex-agent-profile.js +276 -0
  164. package/dist/lib/long-task-compact-authoring-projections.d.ts +12 -0
  165. package/dist/lib/long-task-compact-authoring-projections.js +67 -0
  166. package/dist/lib/long-task-compact-authoring.d.ts +3 -0
  167. package/dist/lib/long-task-compact-authoring.js +173 -0
  168. package/dist/lib/long-task-compact-carrier.d.ts +7 -0
  169. package/dist/lib/long-task-compact-carrier.js +132 -0
  170. package/dist/lib/long-task-compact-parser.d.ts +14 -0
  171. package/dist/lib/long-task-compact-parser.js +123 -0
  172. package/dist/lib/long-task-compact-primitives.d.ts +22 -0
  173. package/dist/lib/long-task-compact-primitives.js +132 -0
  174. package/dist/lib/long-task-compact-projections.d.ts +4 -0
  175. package/dist/lib/long-task-compact-projections.js +153 -0
  176. package/dist/lib/long-task-compact-structure-targets.d.ts +2 -0
  177. package/dist/lib/long-task-compact-structure-targets.js +90 -0
  178. package/dist/lib/long-task-counterfactual-sandbox.d.ts +1 -1
  179. package/dist/lib/long-task-counterfactual-sandbox.js +7 -5
  180. package/dist/lib/long-task-delivery-parser.d.ts +1 -0
  181. package/dist/lib/long-task-delivery-parser.js +38 -6
  182. package/dist/lib/long-task-design-resource-handoff.d.ts +2 -1
  183. package/dist/lib/long-task-design-resource-handoff.js +71 -11
  184. package/dist/lib/long-task-design-resource-method-binding.d.ts +8 -1
  185. package/dist/lib/long-task-design-resource-method-binding.js +150 -0
  186. package/dist/lib/long-task-evidence-capability-codec.js +256 -34
  187. package/dist/lib/long-task-evidence-capability-policy.js +28 -0
  188. package/dist/lib/long-task-evidence-capability-runtime.js +271 -63
  189. package/dist/lib/long-task-evidence-capability-types.d.ts +70 -2
  190. package/dist/lib/long-task-evidence-v2.d.ts +1 -1
  191. package/dist/lib/long-task-evidence-v2.js +5 -5
  192. package/dist/lib/long-task-hook-install.d.ts +19 -2
  193. package/dist/lib/long-task-hook-install.js +288 -91
  194. package/dist/lib/long-task-playwright-capability-records.d.ts +2 -0
  195. package/dist/lib/long-task-playwright-capability-records.js +74 -2
  196. package/dist/lib/long-task-runner-freeze.d.ts +1 -1
  197. package/dist/lib/long-task-runner-freeze.js +4 -2
  198. package/dist/lib/long-task-semantic-contract-types.d.ts +1 -1
  199. package/dist/lib/long-task-semantic-fact-binding-types.d.ts +8 -0
  200. package/dist/lib/long-task-semantic-fact-closure.js +4 -1
  201. package/dist/lib/long-task-semantic-fact-contract-closure.d.ts +1 -1
  202. package/dist/lib/long-task-semantic-fact-contract-closure.js +15 -3
  203. package/dist/lib/long-task-semantic-fact-contract-facts.d.ts +1 -1
  204. package/dist/lib/long-task-semantic-fact-contract-facts.js +4 -1
  205. package/dist/lib/long-task-semantic-fact-contract-proofs.d.ts +1 -1
  206. package/dist/lib/long-task-semantic-fact-contract-proofs.js +12 -3
  207. package/dist/lib/long-task-semantic-fact-evidence.d.ts +5 -1
  208. package/dist/lib/long-task-semantic-fact-evidence.js +47 -4
  209. package/dist/lib/long-task-semantic-fact-shape.js +17 -6
  210. package/dist/lib/long-task-shape-primitives.d.ts +1 -1
  211. package/dist/lib/long-task-shape-primitives.js +1 -0
  212. package/dist/lib/long-task-source-item-parser.d.ts +2 -2
  213. package/dist/lib/long-task-source-item-parser.js +20 -11
  214. package/dist/lib/long-task-ui-design-policy.js +64 -4
  215. package/dist/lib/long-task-ui-surface-shape.js +195 -0
  216. package/dist/lib/long-task-ui-surface-types.d.ts +53 -0
  217. package/dist/lib/long-task-verifier-v2.js +1 -1
  218. package/dist/lib/long-task-worker-selection.d.ts +2 -0
  219. package/dist/lib/long-task-worker-selection.js +7 -0
  220. package/dist/lib/long-task-workspace-scope.js +3 -1
  221. package/dist/lib/long-task-workspace.js +11 -1
  222. package/dist/lib/migrations.js +58 -0
  223. package/dist/lib/profiles.js +0 -1
  224. package/dist/lib/semantic-fact-compact-authoring.d.ts +2 -0
  225. package/dist/lib/semantic-fact-compact-authoring.js +160 -0
  226. package/dist/lib/semantic-fact-compact-capacity.d.ts +9 -0
  227. package/dist/lib/semantic-fact-compact-capacity.js +40 -0
  228. package/dist/lib/semantic-fact-compact-carrier.d.ts +16 -0
  229. package/dist/lib/semantic-fact-compact-carrier.js +146 -0
  230. package/dist/lib/semantic-fact-compact-parser.d.ts +17 -0
  231. package/dist/lib/semantic-fact-compact-parser.js +168 -0
  232. package/dist/lib/semantic-fact-compact-revision.d.ts +11 -0
  233. package/dist/lib/semantic-fact-compact-revision.js +64 -0
  234. package/dist/lib/semantic-fact-compact-support.d.ts +23 -0
  235. package/dist/lib/semantic-fact-compact-support.js +159 -0
  236. package/dist/lib/semantic-fact-policy-census.d.ts +1 -0
  237. package/dist/lib/semantic-fact-policy-census.js +43 -0
  238. package/dist/lib/semantic-fact-proof-shape.d.ts +1 -1
  239. package/dist/lib/semantic-fact-property-shape.d.ts +1 -1
  240. package/dist/lib/semantic-fact-source-parser.d.ts +5 -0
  241. package/dist/lib/semantic-fact-source-parser.js +47 -6
  242. package/dist/lib/structural-closure-cost.d.ts +79 -0
  243. package/dist/lib/structural-closure-cost.js +91 -0
  244. package/dist/lib/symbolic-denotation-dag-builder.d.ts +25 -0
  245. package/dist/lib/symbolic-denotation-dag-builder.js +176 -0
  246. package/dist/lib/symbolic-denotation-domain-validation.d.ts +3 -0
  247. package/dist/lib/symbolic-denotation-domain-validation.js +56 -0
  248. package/dist/lib/symbolic-denotation-engine.d.ts +32 -0
  249. package/dist/lib/symbolic-denotation-engine.js +140 -0
  250. package/dist/lib/symbolic-denotation-public.d.ts +11 -0
  251. package/dist/lib/symbolic-denotation-public.js +12 -0
  252. package/dist/lib/symbolic-denotation-runtime.d.ts +20 -0
  253. package/dist/lib/symbolic-denotation-runtime.js +90 -0
  254. package/dist/lib/symbolic-denotation-support.d.ts +11 -0
  255. package/dist/lib/symbolic-denotation-support.js +49 -0
  256. package/dist/lib/symbolic-denotation-types.d.ts +133 -0
  257. package/dist/lib/symbolic-denotation-types.js +18 -0
  258. package/dist/lib/symbolic-denotation-validation.d.ts +6 -0
  259. package/dist/lib/symbolic-denotation-validation.js +126 -0
  260. package/dist/lib/sync-engine.d.ts +1 -0
  261. package/dist/lib/sync-engine.js +4 -1
  262. package/dist/lib/upgrade.js +1 -0
  263. package/dist/long-task-hook.js +40 -1
  264. package/dist/public-types.d.ts +8 -0
  265. package/dist/public-types.js +1 -0
  266. package/dist/schemas/design-resource-symbolic-noninterference-artifact-v2.schema.json +289 -0
  267. package/dist/schemas/design-resource-symbolic-source-ir-v1.schema.json +130 -0
  268. package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +390 -5
  269. package/migrations/README.md +15 -15
  270. package/package.json +2 -2
  271. package/source-mappings.yaml +28 -25
  272. package/assets/skills/source-plan-authoring/SKILL.md +0 -14
@@ -1,6 +1,7 @@
1
1
  import { DESIGN_RESOURCE_VERIFICATION_METHODS } from "./design-resource-handoff-types.js";
2
2
  import { DESIGN_RESOURCE_COMPARATORS } from "./design-resource-fact-manifest-types.js";
3
3
  import { parseDesignResourceLocatedDigest } from "./design-resource-fact-shape-primitives.js";
4
+ import { nonnegativeInteger } from "./design-resource-handoff-shape-primitives.js";
4
5
  import { EXECUTION_TARGET_CAPABILITIES } from "./execution-target-capabilities.js";
5
6
  import { array, fail, key, literal, nullable, object, repositoryFile, repositoryFiles, string, strings, } from "./long-task-shape-primitives.js";
6
7
  export function parseSurfaceBindings(value, label) {
@@ -46,9 +47,17 @@ function parseDesignTargets(value, label) {
46
47
  "verification_method_bindings",
47
48
  "actual_artifact_path",
48
49
  "comparison_artifact_path",
50
+ ], [
51
+ "fact_model",
52
+ "symbolic_method_bindings",
53
+ "symbolic_certificate_binding",
49
54
  ]);
55
+ const factModel = row.fact_model === undefined
56
+ ? undefined
57
+ : literal(row.fact_model, ["symbolic_rules_v2"], `${itemLabel}.fact_model`);
50
58
  return {
51
59
  key: key(row.key, `${itemLabel}.key`),
60
+ ...(factModel ? { fact_model: factModel } : {}),
52
61
  interpretation: literal(row.interpretation, ["exact_target", "constraint"], `${itemLabel}.interpretation`),
53
62
  source_paths: repositoryFiles(row.source_paths, `${itemLabel}.source_paths`),
54
63
  condition_keys: keys(row.condition_keys, `${itemLabel}.condition_keys`),
@@ -56,11 +65,197 @@ function parseDesignTargets(value, label) {
56
65
  conformance_check_ref: key(row.conformance_check_ref, `${itemLabel}.conformance_check_ref`),
57
66
  conformance_assertion_ref: key(row.conformance_assertion_ref, `${itemLabel}.conformance_assertion_ref`),
58
67
  verification_method_bindings: parseVerificationMethodBindings(row.verification_method_bindings, `${itemLabel}.verification_method_bindings`),
68
+ ...(row.symbolic_method_bindings === undefined
69
+ ? {}
70
+ : {
71
+ symbolic_method_bindings: parseSymbolicMethodBindings(row.symbolic_method_bindings, `${itemLabel}.symbolic_method_bindings`),
72
+ }),
73
+ ...(row.symbolic_certificate_binding === undefined
74
+ ? {}
75
+ : {
76
+ symbolic_certificate_binding: parseSymbolicCertificateBinding(row.symbolic_certificate_binding, `${itemLabel}.symbolic_certificate_binding`),
77
+ }),
59
78
  actual_artifact_path: repositoryFile(row.actual_artifact_path, `${itemLabel}.actual_artifact_path`),
60
79
  comparison_artifact_path: repositoryFile(row.comparison_artifact_path, `${itemLabel}.comparison_artifact_path`),
61
80
  };
62
81
  });
63
82
  }
83
+ function parseSymbolicMethodBindings(value, label) {
84
+ return array(value, label).map((item, index) => {
85
+ const itemLabel = `${label}[${index}]`;
86
+ const row = object(item, itemLabel, [
87
+ "method",
88
+ "assertion_ref",
89
+ "artifact_path",
90
+ "observation_path",
91
+ "rule_expectations",
92
+ ]);
93
+ return {
94
+ method: literal(row.method, DESIGN_RESOURCE_VERIFICATION_METHODS, `${itemLabel}.method`),
95
+ assertion_ref: key(row.assertion_ref, `${itemLabel}.assertion_ref`),
96
+ artifact_path: repositoryFile(row.artifact_path, `${itemLabel}.artifact_path`),
97
+ observation_path: repositoryFile(row.observation_path, `${itemLabel}.observation_path`),
98
+ rule_expectations: array(row.rule_expectations, `${itemLabel}.rule_expectations`).map((expectation, expectationIndex) => parseSymbolicRuleExpectation(expectation, `${itemLabel}.rule_expectations[${expectationIndex}]`)),
99
+ };
100
+ });
101
+ }
102
+ function parseSymbolicRuleExpectation(value, label) {
103
+ const row = object(value, label, [
104
+ "obligation_ref",
105
+ "fact_rule_ref",
106
+ "region_sha256",
107
+ "subject_or_relation_ref",
108
+ "property_ref",
109
+ "population_ref",
110
+ "quantifier",
111
+ "observation_sensitivity",
112
+ "expected",
113
+ "proof_surface",
114
+ "observation_boundary",
115
+ "comparison",
116
+ "oracle",
117
+ "environment",
118
+ "protected_value_policy",
119
+ "completion_effect",
120
+ ]);
121
+ const comparison = object(row.comparison, `${label}.comparison`, [
122
+ "comparator",
123
+ "mode",
124
+ "parameters",
125
+ "tolerance",
126
+ "mask",
127
+ ]);
128
+ const comparator = string(comparison.comparator, `${label}.comparison.comparator`);
129
+ if (!DESIGN_RESOURCE_COMPARATORS.includes(comparator) &&
130
+ !/^custom\.[a-z0-9][a-z0-9._-]*$/u.test(comparator))
131
+ fail(`${label}.comparison.comparator`, "must be a standard comparator or custom.*");
132
+ const oracle = object(row.oracle, `${label}.oracle`, [
133
+ "key",
134
+ "trust",
135
+ "identity",
136
+ "version",
137
+ "sha256",
138
+ ]);
139
+ const environment = object(row.environment, `${label}.environment`, [
140
+ "key",
141
+ "identity",
142
+ "definition",
143
+ ]);
144
+ const quantifier = object(row.quantifier, `${label}.quantifier`, [
145
+ "kind",
146
+ "minimum",
147
+ "maximum",
148
+ ]);
149
+ return {
150
+ obligation_ref: designFactRef(row.obligation_ref, `${label}.obligation_ref`),
151
+ fact_rule_ref: designFactRef(row.fact_rule_ref, `${label}.fact_rule_ref`),
152
+ region_sha256: digest(row.region_sha256, `${label}.region_sha256`),
153
+ subject_or_relation_ref: designFactRef(row.subject_or_relation_ref, `${label}.subject_or_relation_ref`),
154
+ property_ref: designFactRef(row.property_ref, `${label}.property_ref`),
155
+ population_ref: nullable(row.population_ref, (entry) => designFactRef(entry, `${label}.population_ref`)),
156
+ quantifier: {
157
+ kind: literal(quantifier.kind, [
158
+ "one",
159
+ "all",
160
+ "any",
161
+ "none",
162
+ "exactly",
163
+ "at_least",
164
+ "at_most",
165
+ "range",
166
+ ], `${label}.quantifier.kind`),
167
+ minimum: nullable(quantifier.minimum, (entry) => nonnegativeInteger(entry, `${label}.quantifier.minimum`)),
168
+ maximum: nullable(quantifier.maximum, (entry) => nonnegativeInteger(entry, `${label}.quantifier.maximum`)),
169
+ },
170
+ observation_sensitivity: literal(row.observation_sensitivity, ["plain", "protected"], `${label}.observation_sensitivity`),
171
+ expected: parseDesignResourceLocatedDigest(row.expected, `${label}.expected`),
172
+ proof_surface: string(row.proof_surface, `${label}.proof_surface`),
173
+ observation_boundary: string(row.observation_boundary, `${label}.observation_boundary`),
174
+ comparison: {
175
+ comparator,
176
+ mode: literal(comparison.mode, ["exact", "tolerance"], `${label}.comparison.mode`),
177
+ parameters: parseDesignResourceLocatedDigest(comparison.parameters, `${label}.comparison.parameters`),
178
+ tolerance: nullable(comparison.tolerance, (entry) => parseDesignResourceLocatedDigest(entry, `${label}.comparison.tolerance`)),
179
+ mask: nullable(comparison.mask, (entry) => parseDesignResourceLocatedDigest(entry, `${label}.comparison.mask`)),
180
+ },
181
+ oracle: {
182
+ key: designFactRef(oracle.key, `${label}.oracle.key`),
183
+ trust: literal(oracle.trust, ["frozen_executable", "named_external_tcb"], `${label}.oracle.trust`),
184
+ identity: string(oracle.identity, `${label}.oracle.identity`),
185
+ version: string(oracle.version, `${label}.oracle.version`),
186
+ sha256: nullable(oracle.sha256, (entry) => digest(entry, `${label}.oracle.sha256`)),
187
+ },
188
+ environment: {
189
+ key: designFactRef(environment.key, `${label}.environment.key`),
190
+ identity: string(environment.identity, `${label}.environment.identity`),
191
+ definition: parseDesignResourceLocatedDigest(environment.definition, `${label}.environment.definition`),
192
+ },
193
+ protected_value_policy: string(row.protected_value_policy, `${label}.protected_value_policy`),
194
+ completion_effect: string(row.completion_effect, `${label}.completion_effect`),
195
+ };
196
+ }
197
+ function parseSymbolicCertificateBinding(value, label) {
198
+ const row = object(value, label, [
199
+ "assertion_ref",
200
+ "artifact_path",
201
+ "expectations",
202
+ "metrics",
203
+ ]);
204
+ const metrics = object(row.metrics, `${label}.metrics`, [
205
+ "semantic_obligations",
206
+ "certificate_obligations",
207
+ "certificate_covered_omitted_axes",
208
+ "certificate_covered_dependency_edges",
209
+ "canonical_dag_nodes",
210
+ "canonical_partition_edges",
211
+ "canonical_bytes",
212
+ "theoretical_ground_cardinality",
213
+ ]);
214
+ return {
215
+ assertion_ref: key(row.assertion_ref, `${label}.assertion_ref`),
216
+ artifact_path: repositoryFile(row.artifact_path, `${label}.artifact_path`),
217
+ expectations: array(row.expectations, `${label}.expectations`).map((item, index) => {
218
+ const itemLabel = `${label}.expectations[${index}]`;
219
+ const expectation = object(item, itemLabel, [
220
+ "certificate_ref",
221
+ "fact_rule_refs",
222
+ "omitted_axis_refs",
223
+ "dependency_edge_refs",
224
+ "canonical_rule_dag_sha256",
225
+ ], [
226
+ "source_noninterference_proof_sha256",
227
+ "production_noninterference_proof_sha256",
228
+ ]);
229
+ return {
230
+ certificate_ref: designFactRef(expectation.certificate_ref, `${itemLabel}.certificate_ref`),
231
+ fact_rule_refs: designFactRefs(expectation.fact_rule_refs, `${itemLabel}.fact_rule_refs`),
232
+ omitted_axis_refs: designFactRefs(expectation.omitted_axis_refs, `${itemLabel}.omitted_axis_refs`),
233
+ dependency_edge_refs: designFactRefs(expectation.dependency_edge_refs, `${itemLabel}.dependency_edge_refs`),
234
+ canonical_rule_dag_sha256: digest(expectation.canonical_rule_dag_sha256, `${itemLabel}.canonical_rule_dag_sha256`),
235
+ ...(expectation.source_noninterference_proof_sha256 === undefined
236
+ ? {}
237
+ : {
238
+ source_noninterference_proof_sha256: digest(expectation.source_noninterference_proof_sha256, `${itemLabel}.source_noninterference_proof_sha256`),
239
+ }),
240
+ ...(expectation.production_noninterference_proof_sha256 === undefined
241
+ ? {}
242
+ : {
243
+ production_noninterference_proof_sha256: digest(expectation.production_noninterference_proof_sha256, `${itemLabel}.production_noninterference_proof_sha256`),
244
+ }),
245
+ };
246
+ }),
247
+ metrics: {
248
+ semantic_obligations: nonnegativeInteger(metrics.semantic_obligations, `${label}.metrics.semantic_obligations`),
249
+ certificate_obligations: nonnegativeInteger(metrics.certificate_obligations, `${label}.metrics.certificate_obligations`),
250
+ certificate_covered_omitted_axes: nonnegativeInteger(metrics.certificate_covered_omitted_axes, `${label}.metrics.certificate_covered_omitted_axes`),
251
+ certificate_covered_dependency_edges: nonnegativeInteger(metrics.certificate_covered_dependency_edges, `${label}.metrics.certificate_covered_dependency_edges`),
252
+ canonical_dag_nodes: nonnegativeInteger(metrics.canonical_dag_nodes, `${label}.metrics.canonical_dag_nodes`),
253
+ canonical_partition_edges: nonnegativeInteger(metrics.canonical_partition_edges, `${label}.metrics.canonical_partition_edges`),
254
+ canonical_bytes: nonnegativeInteger(metrics.canonical_bytes, `${label}.metrics.canonical_bytes`),
255
+ theoretical_ground_cardinality: string(metrics.theoretical_ground_cardinality, `${label}.metrics.theoretical_ground_cardinality`),
256
+ },
257
+ };
258
+ }
64
259
  function parseAcceptanceBlockers(value, label) {
65
260
  return array(value, label).map((item, index) => {
66
261
  const itemLabel = `${label}[${index}]`;
@@ -1,6 +1,7 @@
1
1
  import type { DesignResourceVerificationMethod } from "./design-resource-handoff-types.js";
2
2
  import type { DesignResourceComparator, DesignResourceLocatedDigestV1 } from "./design-resource-fact-manifest-types.js";
3
3
  import type { ExecutionTargetCapabilityV2 } from "./execution-target-capabilities.js";
4
+ import type { SymbolicExtensionalPointV1 } from "./symbolic-denotation-types.js";
4
5
  export type DesignTargetInterpretationV2 = "exact_target" | "constraint";
5
6
  export interface DeliveryDesignFactExpectationV2 {
6
7
  fact_ref: string;
@@ -40,8 +41,58 @@ export interface DeliveryDesignVerificationBindingV2 {
40
41
  fact_expectations: DeliveryDesignFactExpectationV2[];
41
42
  }>;
42
43
  }
44
+ export interface DeliveryDesignSymbolicRuleExpectationV2 {
45
+ obligation_ref: string;
46
+ fact_rule_ref: string;
47
+ region_sha256: string;
48
+ subject_or_relation_ref: string;
49
+ property_ref: string;
50
+ population_ref: string | null;
51
+ quantifier: SymbolicExtensionalPointV1["quantifier"];
52
+ observation_sensitivity: "plain" | "protected";
53
+ expected: DesignResourceLocatedDigestV1;
54
+ proof_surface: string;
55
+ observation_boundary: string;
56
+ comparison: DeliveryDesignFactExpectationV2["comparison"];
57
+ oracle: DeliveryDesignFactExpectationV2["oracle"];
58
+ environment: DeliveryDesignFactExpectationV2["environment"];
59
+ protected_value_policy: string;
60
+ completion_effect: string;
61
+ }
62
+ export interface DeliveryDesignSymbolicVerificationBindingV2 {
63
+ method: DesignResourceVerificationMethod;
64
+ assertion_ref: string;
65
+ artifact_path: string;
66
+ observation_path: string;
67
+ rule_expectations: DeliveryDesignSymbolicRuleExpectationV2[];
68
+ }
69
+ export interface DeliveryDesignSymbolicCertificateExpectationV2 {
70
+ certificate_ref: string;
71
+ fact_rule_refs: string[];
72
+ omitted_axis_refs: string[];
73
+ dependency_edge_refs: string[];
74
+ canonical_rule_dag_sha256: string;
75
+ source_noninterference_proof_sha256?: string;
76
+ production_noninterference_proof_sha256?: string;
77
+ }
78
+ export interface DeliveryDesignSymbolicCertificateBindingV2 {
79
+ assertion_ref: string;
80
+ artifact_path: string;
81
+ expectations: DeliveryDesignSymbolicCertificateExpectationV2[];
82
+ metrics: {
83
+ semantic_obligations: number;
84
+ certificate_obligations: number;
85
+ certificate_covered_omitted_axes: number;
86
+ certificate_covered_dependency_edges: number;
87
+ canonical_dag_nodes: number;
88
+ canonical_partition_edges: number;
89
+ canonical_bytes: number;
90
+ theoretical_ground_cardinality: string;
91
+ };
92
+ }
43
93
  export interface DeliveryDesignTargetV2 {
44
94
  key: string;
95
+ fact_model?: "symbolic_rules_v2";
45
96
  interpretation: DesignTargetInterpretationV2;
46
97
  source_paths: string[];
47
98
  condition_keys: string[];
@@ -49,6 +100,8 @@ export interface DeliveryDesignTargetV2 {
49
100
  conformance_check_ref: string;
50
101
  conformance_assertion_ref: string;
51
102
  verification_method_bindings: DeliveryDesignVerificationBindingV2[];
103
+ symbolic_method_bindings?: DeliveryDesignSymbolicVerificationBindingV2[];
104
+ symbolic_certificate_binding?: DeliveryDesignSymbolicCertificateBindingV2;
52
105
  actual_artifact_path: string;
53
106
  comparison_artifact_path: string;
54
107
  }
@@ -137,7 +137,7 @@ export async function runDeliveryChecks(compiled, snapshot, checks, includeCount
137
137
  ...outcome.acceptance,
138
138
  counterfactual_controls: outcome.acceptance.counterfactual_controls.filter((control) => selectedKeys.has(control.check_key)),
139
139
  },
140
- }, snapshot.root, snapshot.manifest)));
140
+ }, snapshot.root, snapshot.manifest, compiled.context_snapshot.files)));
141
141
  }
142
142
  }
143
143
  const unassignedCounterfactuals = counterfactualFindings.filter((finding) => !mainCheckResults.some((result) => findingBelongsToCheck(finding, result)));
@@ -0,0 +1,2 @@
1
+ export declare const LONG_TASK_IMPLEMENTATION_AGENT = "long_task_implementation";
2
+ export declare function selectedAgentType(toolInput: unknown): string | null;
@@ -0,0 +1,7 @@
1
+ export const LONG_TASK_IMPLEMENTATION_AGENT = "long_task_implementation";
2
+ export function selectedAgentType(toolInput) {
3
+ if (!toolInput || typeof toolInput !== "object" || Array.isArray(toolInput))
4
+ return null;
5
+ const value = toolInput.agent_type;
6
+ return typeof value === "string" && value.length > 0 ? value : null;
7
+ }
@@ -3,8 +3,9 @@ import { readConfig } from "./config.js";
3
3
  import { harnessConfigPath, harnessPath, harnessRoot } from "./harness-root.js";
4
4
  import { listFiles, pathExists } from "./fs.js";
5
5
  import { matchesRepoPattern, normalizeRepositoryFile, } from "./long-task-paths.js";
6
+ import { longTaskCodexAgentProfileBootstrapPaths } from "./long-task-codex-agent-profile.js";
6
7
  import { packageAssetPath } from "./paths.js";
7
- import { enabledManagedSkillNames } from "./profiles.js";
8
+ import { enabledManagedSkillNames, isProfileEnabled } from "./profiles.js";
8
9
  export function classifyWorkspaceScope(authority, changedPaths, protectedPaths) {
9
10
  const protectedSet = new Set(normalizeFiles(protectedPaths));
10
11
  const expectedPatterns = authority.outcomes.flatMap((outcome) => outcome.technical.expected_change_paths);
@@ -51,6 +52,7 @@ export async function firstLockManagedWorkspacePaths(repository, changedPaths) {
51
52
  const managedFiles = new Set([
52
53
  await harnessConfigPath(repository),
53
54
  ".codex/hooks.json",
55
+ ...(await longTaskCodexAgentProfileBootstrapPaths(repository, root, isProfileEnabled(config, "long-task"))),
54
56
  ...(await packageManagedBootstrapFiles(root, config)),
55
57
  ].map(normalizeManagedRoot));
56
58
  return normalizeFiles(changedPaths).filter((file) => managedFiles.has(file));
@@ -317,7 +317,7 @@ async function removeExcludedSnapshotPaths(snapshotRoot, excluded) {
317
317
  async function overlayTrackedEolDifferences(sourceRoot, snapshotRoot) {
318
318
  const [raw, autocrlf] = await Promise.all([
319
319
  gitBuffer(sourceRoot, ["ls-files", "--eol", "-z"]),
320
- gitConfigGet(sourceRoot, "core.autocrlf"),
320
+ gitEffectiveConfigGet(sourceRoot, "core.autocrlf"),
321
321
  ]);
322
322
  for (const record of splitZero(raw)) {
323
323
  const tab = record.indexOf("\t");
@@ -341,6 +341,16 @@ async function overlayTrackedEolDifferences(sourceRoot, snapshotRoot) {
341
341
  await copyFile(source, target);
342
342
  }
343
343
  }
344
+ async function gitEffectiveConfigGet(root, name) {
345
+ try {
346
+ return await gitOutput(root, ["config", "--get", name]);
347
+ }
348
+ catch (error) {
349
+ if (message(error).includes("git_exit:1"))
350
+ return null;
351
+ throw error;
352
+ }
353
+ }
344
354
  function checkoutEol(indexEol, attributes, autocrlf) {
345
355
  const explicit = attributes.match(/(?:^|\s)eol=(lf|crlf)(?:\s|$)/u)?.[1];
346
356
  if (explicit)
@@ -17,6 +17,8 @@ async function verifyNoop() {
17
17
  }
18
18
  const REMOVED_NORMAL_LONG_TASK_SKILL = "normal-long-task";
19
19
  const REMOVED_NORMAL_LONG_TASK_SKILL_SHA256 = "7a4f755da9a32e07f258d6c7fc5e5c70395257c72efb8a9ad4995cddcc4c73ba";
20
+ const REMOVED_SOURCE_PLAN_SKILL = "source-plan-authoring";
21
+ const REMOVED_SOURCE_PLAN_SKILL_SHA256 = "902de1cca912a8c4a0f26461d0271f5fb87b970316b58efe1c06418f4531f10f";
20
22
  export const migrations = [
21
23
  legacySdlcHarnessMigration,
22
24
  modularityCapabilityWaiverMigration,
@@ -41,6 +43,17 @@ export const migrations = [
41
43
  apply: migrateRemovedNormalLongTaskSkill,
42
44
  verify: verifyRemovedNormalLongTaskSkill,
43
45
  },
46
+ {
47
+ id: "remove-source-plan-authoring-skill",
48
+ introducedIn: "0.8.12",
49
+ description: "Remove the retired source-plan-authoring compatibility pointer; long-task-workflow owns machine-assurance Source authoring and legacy Source Plans remain ordinary Source.",
50
+ scope: "<harnessRoot>/skills/source-plan-authoring",
51
+ risk: "safe",
52
+ manualMessage: "The same-name directory differs from the former package-owned compatibility pointer. Preserve the user-authored Skill or move its content explicitly; Tiny Context will not delete it.",
53
+ detect: detectRemovedSourcePlanSkill,
54
+ apply: migrateRemovedSourcePlanSkill,
55
+ verify: verifyRemovedSourcePlanSkill,
56
+ },
44
57
  {
45
58
  id: "long-task-v1-retirement",
46
59
  introducedIn: "0.6.0",
@@ -178,6 +191,51 @@ async function verifyRemovedNormalLongTaskSkill(projectRoot, root) {
178
191
  throw new Error("remove-normal-long-task-skill migration verification failed");
179
192
  }
180
193
  }
194
+ async function detectRemovedSourcePlanSkill(projectRoot, root, migration) {
195
+ const skill = removedSourcePlanSkillPath(projectRoot, root);
196
+ const state = await removedSourcePlanSkillState(skill);
197
+ if (state === "absent")
198
+ return [];
199
+ const relative = path.relative(projectRoot, skill).split(path.sep).join("/");
200
+ return [
201
+ item(migration, state === "package-owned" ? "safe_pending" : "manual_required", relative, state === "package-owned"
202
+ ? "Remove the exact retired package-owned Source Plan compatibility pointer."
203
+ : "The retired same-name Skill contains modified or additional content; preserve it and resolve removal manually."),
204
+ ];
205
+ }
206
+ async function migrateRemovedSourcePlanSkill(projectRoot, root, report) {
207
+ const skill = removedSourcePlanSkillPath(projectRoot, root);
208
+ const state = await removedSourcePlanSkillState(skill);
209
+ const relative = path.relative(projectRoot, skill).split(path.sep).join("/");
210
+ if (state === "absent") {
211
+ report.skipped.push("remove-source-plan-authoring-skill");
212
+ return;
213
+ }
214
+ if (state !== "package-owned")
215
+ throw new Error(`${relative} changed after upgrade planning; rerun upgrade and resolve the manual_required item`);
216
+ await fs.rm(skill, { recursive: true, force: true });
217
+ report.changed.push(relative);
218
+ }
219
+ async function verifyRemovedSourcePlanSkill(projectRoot, root) {
220
+ if (await pathExists(removedSourcePlanSkillPath(projectRoot, root)))
221
+ throw new Error("remove-source-plan-authoring-skill migration verification failed");
222
+ }
223
+ function removedSourcePlanSkillPath(projectRoot, root) {
224
+ return path.join(projectRoot, root, "skills", REMOVED_SOURCE_PLAN_SKILL);
225
+ }
226
+ async function removedSourcePlanSkillState(skill) {
227
+ if (!(await pathExists(skill)))
228
+ return "absent";
229
+ const files = await listFiles(skill);
230
+ if (files.length !== 1 ||
231
+ path.relative(skill, files[0]).split(path.sep).join("/") !== "SKILL.md")
232
+ return "modified";
233
+ const normalized = (await readText(files[0])).replace(/\r\n/g, "\n");
234
+ const digest = createHash("sha256").update(normalized).digest("hex");
235
+ return digest === REMOVED_SOURCE_PLAN_SKILL_SHA256
236
+ ? "package-owned"
237
+ : "modified";
238
+ }
181
239
  function removedNormalLongTaskSkillPath(projectRoot, root) {
182
240
  return path.join(projectRoot, root, "skills", REMOVED_NORMAL_LONG_TASK_SKILL);
183
241
  }
@@ -60,7 +60,6 @@ export function enabledManagedSkillNames(config) {
60
60
  ]);
61
61
  if (isProfileEnabled(config, "long-task")) {
62
62
  names.add("long-task-workflow");
63
- names.add("source-plan-authoring");
64
63
  }
65
64
  return names;
66
65
  }
@@ -0,0 +1,2 @@
1
+ import type { SemanticFactManifestV1 } from "./semantic-fact-types.js";
2
+ export declare function createSemanticFactCompactCarrier(manifestInput: SemanticFactManifestV1): Record<string, unknown>;
@@ -0,0 +1,160 @@
1
+ import { Buffer } from "node:buffer";
2
+ import { indexSemanticFactRevisionInputs, semanticFactRevisionDigest, semanticObligationRevisionDigest, } from "./semantic-fact-compact-carrier.js";
3
+ import { buildSemanticFactInspectorCensus } from "./semantic-fact-policy-census.js";
4
+ import { semanticFactCollectionIdentity } from "./semantic-fact-policy.js";
5
+ import { canonicalValueJson } from "./strict-codec.js";
6
+ import { applyCompactAuthoringSelectors, compactAuthoringTable, compactCapacityBudget, compactDeterministicTemplates, compactWithoutFields as withoutFields, } from "./compact-authoring-support.js";
7
+ import { applyCompactSharedStructures } from "./compact-shared-structure-authoring.js";
8
+ import { semanticCompactSharedStructureTargets } from "./semantic-fact-compact-support.js";
9
+ export function createSemanticFactCompactCarrier(manifestInput) {
10
+ const manifest = normalizedMaterializedManifest(manifestInput);
11
+ const inputRevisionsByFact = indexSemanticFactRevisionInputs(manifest.inputs);
12
+ const factRevisionByKey = new Map(manifest.facts.map((fact) => [
13
+ fact.key,
14
+ semanticFactRevisionDigest(fact, inputRevisionsByFact),
15
+ ]));
16
+ const proofRecords = manifest.proof_obligations;
17
+ const proofFamilies = compactDeterministicTemplates(proofRecords, ["key", "fact_ref", "comparison", "counterfactual"], "proof-template");
18
+ const proofFamilyByKey = new Map(proofFamilies.templates.map((template) => [template.key, template.value]));
19
+ const base = {
20
+ schema_version: "semantic-fact-compact-carrier-v1",
21
+ key: manifest.key,
22
+ capacity: {},
23
+ scope: structuredClone(manifest.scope),
24
+ inspector: {
25
+ trust: manifest.inspector.trust,
26
+ identity: manifest.inspector.identity,
27
+ version: manifest.inspector.version,
28
+ implementation_sha256: manifest.inspector.implementation_sha256,
29
+ capabilities: structuredClone(manifest.inspector.capabilities),
30
+ traversal: manifest.inspector.traversal,
31
+ dynamic_discovery: manifest.inspector.dynamic_discovery,
32
+ },
33
+ selectors: [],
34
+ shared_structures: [],
35
+ catalogs: {
36
+ inputs: compactTable(manifest.inputs),
37
+ family_dispositions: compactTable(manifest.family_dispositions),
38
+ subjects: compactTable(manifest.subjects),
39
+ relations: compactTable(manifest.relations),
40
+ populations: compactTable(manifest.populations),
41
+ axis_dispositions: compactTable(manifest.axis_dispositions),
42
+ condition_rules: compactTable(manifest.condition_rules),
43
+ conditions: compactTable(manifest.conditions),
44
+ condition_exclusions: compactTable(manifest.condition_exclusions),
45
+ property_dispositions: compactTable(manifest.property_dispositions),
46
+ fact_cells: compactTable(manifest.fact_cells),
47
+ oracles: compactTable(manifest.oracles),
48
+ environments: compactTable(manifest.environments),
49
+ blockers: compactTable(manifest.blockers),
50
+ },
51
+ fact_sets: [
52
+ {
53
+ key: "fact-set.complete-source",
54
+ ...compactTable(manifest.facts.map((fact) => ({
55
+ fact_revision_digest: semanticFactRevisionDigest(fact, inputRevisionsByFact),
56
+ ...fact,
57
+ })), ["key"]),
58
+ },
59
+ ],
60
+ proof_templates: proofFamilies.templates.map((template) => ({
61
+ key: template.key,
62
+ proof: template.value,
63
+ })),
64
+ obligations: compactTable(manifest.proof_obligations.map((proof, index) => ({
65
+ obligation_key: proof.key,
66
+ obligation_revision_digest: semanticObligationRevisionDigest(proof, requiredFactRevision(factRevisionByKey, proof.fact_ref)),
67
+ fact_key: proof.fact_ref,
68
+ template_ref: proofFamilies.template_refs[index],
69
+ overrides: withoutFields(proof, [
70
+ "key",
71
+ "fact_ref",
72
+ ...Object.keys(proofFamilyByKey.get(proofFamilies.template_refs[index])),
73
+ ]),
74
+ }))),
75
+ exceptions: [],
76
+ };
77
+ const { value: compact, selectors } = applyCompactAuthoringSelectors(base);
78
+ compact.selectors = selectors;
79
+ const structures = applyCompactSharedStructures(semanticCompactSharedStructureTargets(compact));
80
+ compact.shared_structures = structures.catalog;
81
+ const measured = {
82
+ inputs: manifest.inputs.length,
83
+ catalog_rows: manifest.inputs.length +
84
+ manifest.family_dispositions.length +
85
+ manifest.subjects.length +
86
+ manifest.relations.length +
87
+ manifest.populations.length +
88
+ manifest.axis_dispositions.length +
89
+ manifest.condition_rules.length +
90
+ manifest.conditions.length +
91
+ manifest.condition_exclusions.length +
92
+ manifest.property_dispositions.length +
93
+ manifest.fact_cells.length +
94
+ manifest.oracles.length +
95
+ manifest.environments.length +
96
+ manifest.blockers.length,
97
+ selector_members: selectors.reduce((sum, selector) => sum + selector.members.length, 0),
98
+ structure_families: structures.statistics.emitted_family_count,
99
+ structure_references: structures.statistics.reference_count,
100
+ structure_arguments: structures.statistics.argument_count,
101
+ facts: manifest.facts.length,
102
+ obligations: manifest.proof_obligations.length,
103
+ census: manifest.inspector.census.length,
104
+ canonical_bytes: Buffer.byteLength(canonicalValueJson(manifest), "utf8"),
105
+ };
106
+ compact.capacity = {
107
+ theoretical_ground_universe: "not_materialized",
108
+ measured,
109
+ maximum: Object.fromEntries(Object.entries(measured).map(([name, count]) => [
110
+ name,
111
+ compactCapacityBudget(name, count),
112
+ ])),
113
+ };
114
+ return compact;
115
+ }
116
+ function requiredFactRevision(revisions, factRef) {
117
+ const revision = revisions.get(factRef);
118
+ if (!revision)
119
+ throw new Error(`semantic_fact_compact_authoring_fact_revision_missing:${factRef}`);
120
+ return revision;
121
+ }
122
+ function normalizedMaterializedManifest(input) {
123
+ const manifest = structuredClone(input);
124
+ manifest.inspector.census = buildSemanticFactInspectorCensus(manifest);
125
+ const rows = {
126
+ inputs: manifest.inputs,
127
+ inspector_census: manifest.inspector.census,
128
+ family_dispositions: manifest.family_dispositions,
129
+ subjects: manifest.subjects,
130
+ relations: manifest.relations,
131
+ populations: manifest.populations,
132
+ axis_dispositions: manifest.axis_dispositions,
133
+ condition_rules: manifest.condition_rules,
134
+ conditions: manifest.conditions,
135
+ condition_exclusions: manifest.condition_exclusions,
136
+ property_dispositions: manifest.property_dispositions,
137
+ fact_cells: manifest.fact_cells,
138
+ facts: manifest.facts,
139
+ proof_obligations: manifest.proof_obligations,
140
+ oracles: manifest.oracles,
141
+ environments: manifest.environments,
142
+ blockers: manifest.blockers,
143
+ };
144
+ manifest.generation = {
145
+ strategy: "complete_explicit",
146
+ sampling: "forbidden",
147
+ truncation: "forbidden",
148
+ chunk_count: 1,
149
+ chunk_indexes: [0],
150
+ collections: Object.entries(rows).map(([name, collection]) => ({
151
+ name: name,
152
+ expected_count: collection.length,
153
+ identity_sha256: semanticFactCollectionIdentity(collection),
154
+ })),
155
+ };
156
+ return manifest;
157
+ }
158
+ function compactTable(input, excludedDefaults = []) {
159
+ return compactAuthoringTable(input, excludedDefaults);
160
+ }
@@ -0,0 +1,9 @@
1
+ export declare const SEMANTIC_COMPACT_CAPACITY_FIELDS: readonly ["inputs", "catalog_rows", "selector_members", "structure_families", "structure_references", "structure_arguments", "facts", "obligations", "census", "canonical_bytes"];
2
+ type CapacityField = (typeof SEMANTIC_COMPACT_CAPACITY_FIELDS)[number];
3
+ export type SemanticCompactCapacityCounts = Record<CapacityField, number>;
4
+ export declare function validateSemanticCompactCapacity(capacity: {
5
+ measured: SemanticCompactCapacityCounts;
6
+ maximum: SemanticCompactCapacityCounts;
7
+ }, measured: SemanticCompactCapacityCounts, label: string): void;
8
+ export declare function validateSemanticCompactDeclaredMaximum(maximum: SemanticCompactCapacityCounts, label: string): void;
9
+ export {};