@knights-eye-chess/ai-analysis 0.0.0-stage → 0.1.0-dev.17

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 (258) hide show
  1. package/LICENSE +235 -0
  2. package/LICENSING.md +26 -0
  3. package/NOTICE +5 -0
  4. package/NPM-PUBLISHING.md +28 -0
  5. package/README.md +139 -2
  6. package/SOURCE-ORIGIN.json +16 -0
  7. package/THIRD_PARTY_NOTICES.md +18 -0
  8. package/build.mjs +22 -0
  9. package/dist/answer-pipeline.test.mjs +375 -0
  10. package/dist/chunk-PLKNJRPF.js +10662 -0
  11. package/dist/chunk-XQDZJOYD.js +2515 -0
  12. package/dist/index.js +146 -0
  13. package/dist/owner-tests/chess-reasoning-compact-search-preparation.test.mjs +963 -0
  14. package/dist/owner-tests/mechanism-encoding.test.mjs +529 -0
  15. package/dist/owner-tests/move-mechanism-facts.test.mjs +396 -0
  16. package/dist/owner-tests/pipeline-host-preparation.test.mjs +10556 -0
  17. package/dist/owner-tests/position-preparation.test.mjs +625 -0
  18. package/dist/owner-tests/preparation-consolidation.test.mjs +1052 -0
  19. package/dist/owner-tests/prose-reference-admission.test.mjs +1770 -0
  20. package/dist/owner-tests/score-comparison-notices.test.mjs +240 -0
  21. package/dist/owner-tests/simple-engine-presentation.test.mjs +233 -0
  22. package/dist/owner-tests/tool-input-loop-guard.test.mjs +78 -0
  23. package/dist/research.js +2274 -0
  24. package/dist/runtime-closure.json +103 -0
  25. package/dist/shared-runtime-closure.json +39 -0
  26. package/dist/shared.js +152 -0
  27. package/dist/types/ai-request-failure.d.ts +14 -0
  28. package/dist/types/ai-request-limits.d.ts +4 -0
  29. package/dist/types/ai-routing-diagnostics.d.ts +14 -0
  30. package/dist/types/chess-reasoning/ablation-adaptive-evidence-loop.d.ts +127 -0
  31. package/dist/types/chess-reasoning/ablation-adaptive-runtime.d.ts +178 -0
  32. package/dist/types/chess-reasoning/ablation-direct-synthesis.d.ts +1030 -0
  33. package/dist/types/chess-reasoning/ablation-evidence-bundle.d.ts +185 -0
  34. package/dist/types/chess-reasoning/ablation-evidence-capture.d.ts +37 -0
  35. package/dist/types/chess-reasoning/ablation-lean-direct-runtime.d.ts +193 -0
  36. package/dist/types/chess-reasoning/ablation-model-facing-evidence.d.ts +38 -0
  37. package/dist/types/chess-reasoning/ablation-transport-correction.d.ts +13 -0
  38. package/dist/types/chess-reasoning/ai-sdk-runtime-support.d.ts +93 -0
  39. package/dist/types/chess-reasoning/answer-host-contracts.d.ts +59 -0
  40. package/dist/types/chess-reasoning/answer-model-connector.d.ts +68 -0
  41. package/dist/types/chess-reasoning/answer-pipeline-exports.d.ts +98 -0
  42. package/dist/types/chess-reasoning/answer-pipeline.d.ts +41 -0
  43. package/dist/types/chess-reasoning/answer-reference-validation.d.ts +40 -0
  44. package/dist/types/chess-reasoning/answer-tool-host.d.ts +8 -0
  45. package/dist/types/chess-reasoning/branch-expansion-policy.d.ts +13 -0
  46. package/dist/types/chess-reasoning/branch-expansion.d.ts +39 -0
  47. package/dist/types/chess-reasoning/causal-claim-checks.d.ts +21 -0
  48. package/dist/types/chess-reasoning/chess-reference-dictionary.d.ts +13 -0
  49. package/dist/types/chess-reasoning/classification-question-target.d.ts +22 -0
  50. package/dist/types/chess-reasoning/classification-reassessment.d.ts +31 -0
  51. package/dist/types/chess-reasoning/compact-search-preparation.d.ts +7 -0
  52. package/dist/types/chess-reasoning/concept-registry.d.ts +99 -0
  53. package/dist/types/chess-reasoning/conversation-context.d.ts +12 -0
  54. package/dist/types/chess-reasoning/engine-search-failure.d.ts +7 -0
  55. package/dist/types/chess-reasoning/evidence-citation-normalization.d.ts +9 -0
  56. package/dist/types/chess-reasoning/evidence-licenses.d.ts +57 -0
  57. package/dist/types/chess-reasoning/evidence-selector-contract.d.ts +5 -0
  58. package/dist/types/chess-reasoning/existing-analysis-context.d.ts +104 -0
  59. package/dist/types/chess-reasoning/fact-observation-provider.d.ts +15 -0
  60. package/dist/types/chess-reasoning/fact-provider.d.ts +111 -0
  61. package/dist/types/chess-reasoning/fresh-engine-pv-witnesses.d.ts +67 -0
  62. package/dist/types/chess-reasoning/historical-prose.d.ts +23 -0
  63. package/dist/types/chess-reasoning/idea-graph.d.ts +34 -0
  64. package/dist/types/chess-reasoning/initial-search-plan.d.ts +37 -0
  65. package/dist/types/chess-reasoning/lossless-evidence-sharing.d.ts +18 -0
  66. package/dist/types/chess-reasoning/matched-comparison.d.ts +10 -0
  67. package/dist/types/chess-reasoning/material-accounting.d.ts +80 -0
  68. package/dist/types/chess-reasoning/material-format.d.ts +4 -0
  69. package/dist/types/chess-reasoning/mechanical-fact-provider.d.ts +33 -0
  70. package/dist/types/chess-reasoning/mechanical-ray-facts.d.ts +19 -0
  71. package/dist/types/chess-reasoning/mechanism-presentation.d.ts +9 -0
  72. package/dist/types/chess-reasoning/move-mechanism-facts.d.ts +45 -0
  73. package/dist/types/chess-reasoning/native-answer-connector.d.ts +4 -0
  74. package/dist/types/chess-reasoning/opening-source-contracts.d.ts +54 -0
  75. package/dist/types/chess-reasoning/opening-source-credits.d.ts +16 -0
  76. package/dist/types/chess-reasoning/opponent-threat-preparation.d.ts +7 -0
  77. package/dist/types/chess-reasoning/piece-identities.d.ts +11 -0
  78. package/dist/types/chess-reasoning/poc-contracts.d.ts +1026 -0
  79. package/dist/types/chess-reasoning/poc-hypotheses.d.ts +74 -0
  80. package/dist/types/chess-reasoning/poc-move-witnesses.d.ts +13 -0
  81. package/dist/types/chess-reasoning/poc-observations.d.ts +23 -0
  82. package/dist/types/chess-reasoning/poc-piece-refs.d.ts +12 -0
  83. package/dist/types/chess-reasoning/poc-plan-model.d.ts +45 -0
  84. package/dist/types/chess-reasoning/poc-semantic-text.d.ts +8 -0
  85. package/dist/types/chess-reasoning/poc-tools.d.ts +81 -0
  86. package/dist/types/chess-reasoning/portable-answer-runtime.d.ts +291 -0
  87. package/dist/types/chess-reasoning/position-analysis-contracts.d.ts +31 -0
  88. package/dist/types/chess-reasoning/position-analysis-scope.d.ts +3 -0
  89. package/dist/types/chess-reasoning/preparation-consolidation.d.ts +21 -0
  90. package/dist/types/chess-reasoning/production-observation-provider.d.ts +16 -0
  91. package/dist/types/chess-reasoning/question-routing.d.ts +326 -0
  92. package/dist/types/chess-reasoning/recorded-main-line.d.ts +37 -0
  93. package/dist/types/chess-reasoning/recorded-position-tools.d.ts +11 -0
  94. package/dist/types/chess-reasoning/recorded-reference-context.d.ts +13 -0
  95. package/dist/types/chess-reasoning/recorded-selected-classification.d.ts +36 -0
  96. package/dist/types/chess-reasoning/reference-limits.d.ts +2 -0
  97. package/dist/types/chess-reasoning/research-exports.d.ts +197 -0
  98. package/dist/types/chess-reasoning/saved-score-presentation.d.ts +14 -0
  99. package/dist/types/chess-reasoning/score-comparison-notices.d.ts +33 -0
  100. package/dist/types/chess-reasoning/server-simple-policy.d.ts +31 -0
  101. package/dist/types/chess-reasoning/simple-agent-config.d.ts +73 -0
  102. package/dist/types/chess-reasoning/simple-board-analysis.d.ts +85 -0
  103. package/dist/types/chess-reasoning/simple-compact-evidence.d.ts +7 -0
  104. package/dist/types/chess-reasoning/simple-completion.d.ts +23 -0
  105. package/dist/types/chess-reasoning/simple-engine-presentation.d.ts +3 -0
  106. package/dist/types/chess-reasoning/simple-evidence-preparation.d.ts +17 -0
  107. package/dist/types/chess-reasoning/simple-evidence-view.d.ts +17 -0
  108. package/dist/types/chess-reasoning/simple-explanation-coverage.d.ts +90 -0
  109. package/dist/types/chess-reasoning/simple-fact-delivery.d.ts +43 -0
  110. package/dist/types/chess-reasoning/simple-fallback-premise.d.ts +5 -0
  111. package/dist/types/chess-reasoning/simple-prose-references.d.ts +108 -0
  112. package/dist/types/chess-reasoning/simple-runtime-version.d.ts +1 -0
  113. package/dist/types/chess-reasoning/stable.d.ts +2 -0
  114. package/dist/types/chess-reasoning/tool-input-loop-guard.d.ts +5 -0
  115. package/dist/types/chess-reasoning/types.d.ts +180 -0
  116. package/dist/types/chess-reasoning/visible-support-lines.d.ts +12 -0
  117. package/dist/types/chess-reasoning/wikibooks-index.d.ts +30 -0
  118. package/dist/types/chess-reasoning/wikibooks-tool-context.d.ts +10 -0
  119. package/dist/types/player-perspective.d.ts +16 -0
  120. package/dist/types/shared-exports.d.ts +22 -0
  121. package/docs/API.md +82 -0
  122. package/docs/OWNERSHIP-ADOPTION.md +35 -0
  123. package/docs/OWNERSHIP-DRIFT.json +55 -0
  124. package/docs/RESEARCH-API.md +28 -0
  125. package/licenses/third-party/INVENTORY.json +202 -0
  126. package/licenses/third-party/ai-7.0.85/LICENSE +13 -0
  127. package/licenses/third-party/ai-sdk--gateway-4.0.69/LICENSE +13 -0
  128. package/licenses/third-party/ai-sdk--provider-4.0.9/LICENSE +13 -0
  129. package/licenses/third-party/ai-sdk--provider-utils-5.0.34/APACHE-2.0.txt +73 -0
  130. package/licenses/third-party/ai-sdk--provider-utils-5.0.34/src/to-json-schema/zod3-to-json-schema/LICENSE +16 -0
  131. package/licenses/third-party/chess.js-1.4.0/LICENSE +23 -0
  132. package/licenses/third-party/eventsource-parser-3.1.1/LICENSE +21 -0
  133. package/licenses/third-party/json-schema-0.4.0/LICENSE +195 -0
  134. package/licenses/third-party/standard-schema--spec-1.1.0/LICENSE +21 -0
  135. package/licenses/third-party/types--json-schema-7.0.15/LICENSE +21 -0
  136. package/licenses/third-party/types--node-22.19.19/LICENSE +21 -0
  137. package/licenses/third-party/undici-7.30.0/LICENSE +21 -0
  138. package/licenses/third-party/undici-7.30.0/lib/web/fetch/LICENSE +21 -0
  139. package/licenses/third-party/undici-types-6.21.0/LICENSE +21 -0
  140. package/licenses/third-party/vercel--oidc-3.2.0/LICENSE +202 -0
  141. package/licenses/third-party/workflow--serde-4.1.0/APACHE-2.0.txt +73 -0
  142. package/licenses/third-party/workflow--serde-4.1.0/LICENSE.md +3 -0
  143. package/licenses/third-party/zod-4.6.5/LICENSE +21 -0
  144. package/npm-release.json +5 -0
  145. package/package.json +72 -4
  146. package/scripts/check-release-tooling.mjs +22 -0
  147. package/scripts/pack.mjs +68 -0
  148. package/scripts/publish-reviewed.mjs +85 -0
  149. package/scripts/release-tooling.json +13 -0
  150. package/scripts/update-dependency.mjs +44 -0
  151. package/scripts/verify-release.mjs +52 -0
  152. package/src/ai-request-failure.ts +34 -0
  153. package/src/ai-request-limits.ts +4 -0
  154. package/src/ai-routing-diagnostics.ts +33 -0
  155. package/src/chess-reasoning/ablation-adaptive-evidence-loop.ts +515 -0
  156. package/src/chess-reasoning/ablation-adaptive-runtime.ts +924 -0
  157. package/src/chess-reasoning/ablation-direct-synthesis.ts +1128 -0
  158. package/src/chess-reasoning/ablation-evidence-bundle.ts +726 -0
  159. package/src/chess-reasoning/ablation-evidence-capture.ts +513 -0
  160. package/src/chess-reasoning/ablation-lean-direct-runtime.ts +670 -0
  161. package/src/chess-reasoning/ablation-model-facing-evidence.ts +212 -0
  162. package/src/chess-reasoning/ablation-transport-correction.ts +106 -0
  163. package/src/chess-reasoning/ai-sdk-runtime-support.ts +381 -0
  164. package/src/chess-reasoning/answer-host-contracts.ts +10 -0
  165. package/src/chess-reasoning/answer-model-connector.ts +83 -0
  166. package/src/chess-reasoning/answer-pipeline-exports.ts +98 -0
  167. package/src/chess-reasoning/answer-pipeline.ts +195 -0
  168. package/src/chess-reasoning/answer-reference-validation.ts +124 -0
  169. package/src/chess-reasoning/answer-tool-host.ts +10 -0
  170. package/src/chess-reasoning/branch-expansion-policy.ts +32 -0
  171. package/src/chess-reasoning/branch-expansion.ts +80 -0
  172. package/src/chess-reasoning/causal-claim-checks.ts +256 -0
  173. package/src/chess-reasoning/chess-reference-dictionary.ts +21 -0
  174. package/src/chess-reasoning/classification-question-target.ts +30 -0
  175. package/src/chess-reasoning/classification-reassessment.ts +34 -0
  176. package/src/chess-reasoning/compact-search-preparation.ts +125 -0
  177. package/src/chess-reasoning/concept-registry.ts +275 -0
  178. package/src/chess-reasoning/conversation-context.ts +29 -0
  179. package/src/chess-reasoning/engine-search-failure.ts +11 -0
  180. package/src/chess-reasoning/evidence-citation-normalization.ts +15 -0
  181. package/src/chess-reasoning/evidence-licenses.ts +166 -0
  182. package/src/chess-reasoning/evidence-selector-contract.ts +5 -0
  183. package/src/chess-reasoning/existing-analysis-context.ts +544 -0
  184. package/src/chess-reasoning/fact-observation-provider.ts +134 -0
  185. package/src/chess-reasoning/fact-provider.ts +250 -0
  186. package/src/chess-reasoning/fresh-engine-pv-witnesses.ts +128 -0
  187. package/src/chess-reasoning/historical-prose.ts +116 -0
  188. package/src/chess-reasoning/idea-graph.ts +224 -0
  189. package/src/chess-reasoning/initial-search-plan.ts +115 -0
  190. package/src/chess-reasoning/lossless-evidence-sharing.ts +135 -0
  191. package/src/chess-reasoning/matched-comparison.ts +40 -0
  192. package/src/chess-reasoning/material-accounting.ts +55 -0
  193. package/src/chess-reasoning/material-format.ts +47 -0
  194. package/src/chess-reasoning/mechanical-fact-provider.ts +1602 -0
  195. package/src/chess-reasoning/mechanical-ray-facts.ts +123 -0
  196. package/src/chess-reasoning/mechanism-presentation.ts +94 -0
  197. package/src/chess-reasoning/move-mechanism-facts.ts +185 -0
  198. package/src/chess-reasoning/native-answer-connector.ts +13 -0
  199. package/src/chess-reasoning/opening-source-contracts.ts +47 -0
  200. package/src/chess-reasoning/opening-source-credits.ts +53 -0
  201. package/src/chess-reasoning/opponent-threat-preparation.ts +98 -0
  202. package/src/chess-reasoning/piece-identities.ts +159 -0
  203. package/src/chess-reasoning/poc-contracts.ts +1097 -0
  204. package/src/chess-reasoning/poc-hypotheses.ts +759 -0
  205. package/src/chess-reasoning/poc-move-witnesses.ts +170 -0
  206. package/src/chess-reasoning/poc-observations.ts +611 -0
  207. package/src/chess-reasoning/poc-piece-refs.ts +62 -0
  208. package/src/chess-reasoning/poc-plan-model.ts +345 -0
  209. package/src/chess-reasoning/poc-semantic-text.ts +10 -0
  210. package/src/chess-reasoning/poc-tools.ts +978 -0
  211. package/src/chess-reasoning/portable-answer-runtime.ts +684 -0
  212. package/src/chess-reasoning/position-analysis-contracts.ts +88 -0
  213. package/src/chess-reasoning/position-analysis-scope.ts +20 -0
  214. package/src/chess-reasoning/preparation-consolidation.ts +91 -0
  215. package/src/chess-reasoning/production-observation-provider.ts +41 -0
  216. package/src/chess-reasoning/question-routing.ts +332 -0
  217. package/src/chess-reasoning/recorded-main-line.ts +55 -0
  218. package/src/chess-reasoning/recorded-position-tools.ts +78 -0
  219. package/src/chess-reasoning/recorded-reference-context.ts +44 -0
  220. package/src/chess-reasoning/recorded-selected-classification.ts +54 -0
  221. package/src/chess-reasoning/reference-limits.ts +2 -0
  222. package/src/chess-reasoning/research-exports.ts +197 -0
  223. package/src/chess-reasoning/saved-score-presentation.ts +6 -0
  224. package/src/chess-reasoning/score-comparison-notices.ts +115 -0
  225. package/src/chess-reasoning/server-simple-policy.ts +75 -0
  226. package/src/chess-reasoning/simple-agent-config.ts +58 -0
  227. package/src/chess-reasoning/simple-board-analysis.ts +57 -0
  228. package/src/chess-reasoning/simple-compact-evidence.ts +79 -0
  229. package/src/chess-reasoning/simple-completion.ts +37 -0
  230. package/src/chess-reasoning/simple-engine-presentation.ts +95 -0
  231. package/src/chess-reasoning/simple-evidence-preparation.ts +32 -0
  232. package/src/chess-reasoning/simple-evidence-view.ts +69 -0
  233. package/src/chess-reasoning/simple-explanation-coverage.ts +118 -0
  234. package/src/chess-reasoning/simple-fact-delivery.ts +52 -0
  235. package/src/chess-reasoning/simple-fallback-premise.ts +65 -0
  236. package/src/chess-reasoning/simple-prose-references.ts +528 -0
  237. package/src/chess-reasoning/simple-runtime-version.ts +2 -0
  238. package/src/chess-reasoning/stable.ts +18 -0
  239. package/src/chess-reasoning/tool-input-loop-guard.ts +38 -0
  240. package/src/chess-reasoning/types.ts +195 -0
  241. package/src/chess-reasoning/visible-support-lines.ts +44 -0
  242. package/src/chess-reasoning/wikibooks-index.ts +56 -0
  243. package/src/chess-reasoning/wikibooks-tool-context.ts +91 -0
  244. package/src/player-perspective.ts +41 -0
  245. package/src/shared-exports.ts +23 -0
  246. package/test/answer-pipeline.test.mjs +375 -0
  247. package/test/owner/chess-reasoning-compact-search-preparation.test.mjs +111 -0
  248. package/test/owner/mechanism-encoding.test.mjs +78 -0
  249. package/test/owner/move-mechanism-facts.test.mjs +105 -0
  250. package/test/owner/pipeline-host-preparation.test.mjs +115 -0
  251. package/test/owner/position-preparation.test.mjs +22 -0
  252. package/test/owner/preparation-consolidation.test.mjs +74 -0
  253. package/test/owner/prose-reference-admission.test.mjs +26 -0
  254. package/test/owner/score-comparison-notices.test.mjs +116 -0
  255. package/test/owner/simple-engine-presentation.test.mjs +50 -0
  256. package/test/owner/tool-input-loop-guard.test.mjs +25 -0
  257. package/test-types.mts +23 -0
  258. package/tsconfig.json +22 -0
@@ -0,0 +1,2274 @@
1
+ import {
2
+ ABLATION_ADAPTIVE_EVIDENCE_LOOP_VERSION,
3
+ ABLATION_EVIDENCE_BUNDLE_VERSION,
4
+ ABLATION_LEAN_DIRECT_PROPOSAL_VERSION,
5
+ ABLATION_LEAN_DIRECT_RUNTIME_VERSION,
6
+ ABLATION_PROBE_TELEMETRY_VERSION,
7
+ AI_SDK_ANSWER_OBLIGATION_RUNTIME,
8
+ AI_SDK_CRITIC_RUNTIME,
9
+ AI_SDK_DISCOURSE_RUNTIME,
10
+ AI_SDK_GRAPH_PLANNING_RUNTIME,
11
+ AI_SDK_GRAPH_SELECTION_RUNTIME,
12
+ AI_SDK_HYPOTHESIS_RUNTIME,
13
+ AI_SDK_PURPOSE_PROBE_RUNTIME,
14
+ AI_SDK_REASONING_RUNTIME,
15
+ AI_SDK_RENDER_RUNTIME,
16
+ AI_SDK_REPAIR_RUNTIME,
17
+ AI_SDK_RESOLUTION_AUDIT_RUNTIME,
18
+ AI_SDK_TERMINAL_REVIEW_RUNTIME,
19
+ ANALYSIS_CONTEXT_PROVENANCE_TIER,
20
+ ATTRIBUTE_KEYS,
21
+ BRANCH_EXPANSION_OPTIONS,
22
+ CANONICAL_EDGE_ANALYSIS_SNAPSHOT_VERSION,
23
+ CAPTURE_RESPONSE_FACT_KIND,
24
+ CHESS_FACT_REQUEST_VERSION,
25
+ CHESS_FACT_RESULT_VERSION,
26
+ CHESS_FACT_SCHEMA_VERSION,
27
+ CHESS_REFERENCE_DICTIONARY,
28
+ CLASSIFICATION_REASSESSMENT_GUIDANCE,
29
+ COMPACT_ENGINE_INSTRUCTIONS,
30
+ COMPLETED_TOOL_REPLAY_ADMISSION_KEY,
31
+ CONCEPT_KEYS,
32
+ CONVERSATION_CONTEXT_INSTRUCTIONS,
33
+ ChessFactObservationProvider,
34
+ CompositeObservationProvider,
35
+ CriticResolutionAuditHarnessRejection,
36
+ DEFAULT_CONCEPT_REGISTRY,
37
+ DEFAULT_MATERIAL_FORMAT,
38
+ DETERMINISTIC_DISCOURSE_RUNTIME,
39
+ DETERMINISTIC_OBSERVATION_PROVIDER_VERSION,
40
+ DeterministicObservationProvider,
41
+ ENTITY_TYPES,
42
+ EXISTING_ANALYSIS_CONTEXT_MODE,
43
+ EXISTING_ANALYSIS_CONTEXT_VERSION,
44
+ EXISTING_ANALYSIS_OBSERVATION_PROVIDER_ID,
45
+ EXISTING_ANALYSIS_RECORD_VERSION,
46
+ EXPLAIN_PLAN_SELECTION_DESCRIPTOR,
47
+ EXPLANATION_REVIEW_SCHEMA,
48
+ ExistingAnalysisObservationProvider,
49
+ FACT_DELIVERY_INSTRUCTIONS,
50
+ FACT_OBSERVATION_ADAPTER_VERSION,
51
+ GraphSelectionHarnessRejection,
52
+ HypothesisHarnessRejection,
53
+ HypothesisLedger,
54
+ HypothesisProviderRuntimeFailure,
55
+ HypothesisReviewHarnessRejection,
56
+ LEAN_DIRECT_PROPOSAL_JSON_SCHEMA,
57
+ LEGACY_EXISTING_ANALYSIS_CONTEXT_VERSION,
58
+ MATCHED_COMPARISON_GUIDANCE,
59
+ MATERIAL_OFFER_SET_VERSION,
60
+ MAX_ANSWER_TOOL_REQUESTS_PER_TURN,
61
+ MECHANICAL_CHESS_FACT_PROVIDER_ID,
62
+ MECHANICAL_CHESS_FACT_PROVIDER_VERSION,
63
+ MECHANISM_FACT_INSTRUCTIONS,
64
+ MechanicalChessFactProvider,
65
+ ModelOwnedAdaptiveEvidenceLoop,
66
+ OPENING_SOURCE_INSTRUCTIONS,
67
+ PARTICIPANT_ROLES,
68
+ PRECOMMITTED_PROBE_ATTRIBUTION_CATEGORIES,
69
+ PRODUCTION_OBSERVATION_PROVIDER_VERSION,
70
+ QUESTION_SALIENCE_POLICY_VERSION,
71
+ QuestionConditionedSaliencePolicy,
72
+ RECORDED_POSITION_DESCRIPTORS,
73
+ RECORD_HYPOTHESES_DESCRIPTOR,
74
+ REFERENCE_DOMAINS,
75
+ RELATION_TYPES,
76
+ REVIEW_HYPOTHESES_DESCRIPTOR,
77
+ ReasoningCriticHarnessRejection,
78
+ ReasoningWorkflowFailure,
79
+ SIMPLE_BOARD_ANALYSIS_GUIDANCE,
80
+ SIMPLE_BUDGETS,
81
+ SIMPLE_CONTENT_SELECTION_GUIDANCE,
82
+ SIMPLE_DISCLOSURE,
83
+ SIMPLE_EVIDENCE_VIEW_VERSION,
84
+ SIMPLE_EXAMPLE_GUIDANCE,
85
+ SIMPLE_EXPANDED_BUDGETS,
86
+ SIMPLE_EXPLANATION_GUIDANCE,
87
+ SIMPLE_MODELS,
88
+ SIMPLE_PURPOSE_GUIDANCE,
89
+ SIMPLE_RECOVERY_BUDGETS,
90
+ SIMPLE_REFERENCE_INSTRUCTIONS,
91
+ SIMPLE_SEARCH_BREADTH_GUIDANCE,
92
+ SIMPLE_SECTION_GUIDANCE,
93
+ SIMPLE_STOPPING_GUIDANCE,
94
+ SIMPLE_SYSTEM,
95
+ SimpleFactDelivery,
96
+ TerminalReviewHarnessRejection,
97
+ ablationHistoryThroughTargetHash,
98
+ ablationLeanDirectSystem,
99
+ abortSource,
100
+ assertDirectedDestinationAnchors,
101
+ assertFactProofWithinAuthority,
102
+ bytes,
103
+ captureAblationOriginalEvidenceBundle,
104
+ checkCausalClaims,
105
+ chessFactRecordLicenses,
106
+ chessSquareColor,
107
+ classificationReassessment,
108
+ classifyGraphSelectionHarnessRejection,
109
+ classifyGraphSelectionRuntimeFailure,
110
+ classifyHypothesisHarnessRejection,
111
+ classifyProviderHypothesisRejection,
112
+ classifyReasoningCriticHarnessRejection,
113
+ classifyRuntimeFailure,
114
+ compactLeanEvidencePacket,
115
+ compactMechanism,
116
+ compactPreparedSearchResult,
117
+ compactSearchRecord,
118
+ compactSimpleEngineResult,
119
+ compactSimpleInitialPacket,
120
+ compactSimpleToolResult,
121
+ conceptDefinition,
122
+ conceptsOf,
123
+ consolidatePreparedSearches,
124
+ createAblationEvidenceClosureBundle,
125
+ createAblationProbeTelemetry,
126
+ createConceptRegistry,
127
+ createDefaultObservationProvider,
128
+ createDefaultSaliencePolicy,
129
+ createIdeaGraph,
130
+ createMechanicalFactRequest,
131
+ createNativeAnswerConnector,
132
+ createPocToolHost,
133
+ createProductionObservationProvider,
134
+ createSemanticEntity,
135
+ createSemanticRelation,
136
+ createToolInputLoopGuard,
137
+ deepestError,
138
+ deriveAdmittedCaptureResponseAvailabilityFact,
139
+ emitObservableTrace,
140
+ enrichAblationEvidenceBundleWithAdmittedCaptureResponses,
141
+ enrichAblationEvidenceClosureBundle,
142
+ evidenceFallback,
143
+ expandCompactEngineEvidence,
144
+ expandMechanismPresentation,
145
+ expandPrincipalBranches,
146
+ explanationBranches,
147
+ explanationCoverage,
148
+ explanationSummary,
149
+ extendConceptRegistry,
150
+ extendIdeaGraph,
151
+ factCoverageSupportsAbsence,
152
+ factProofStrength,
153
+ forcedWinPremiseFallback,
154
+ forkIdeaGraph,
155
+ graphIdentityCompatible,
156
+ hasConcept,
157
+ isChessFactAuthority,
158
+ isTerminalEntity,
159
+ matchedRootComparison,
160
+ materializeLeanDirectProposal,
161
+ maximumFactProofStrength,
162
+ memoizeToolResults,
163
+ normalizeExistingAnalysisContext,
164
+ numericUsage,
165
+ observableTraceMessages,
166
+ openEntityCount,
167
+ parseExplainPlanRequest,
168
+ participant,
169
+ participantIds,
170
+ planInitialSearches,
171
+ planningEvidence,
172
+ precommittedProbeAttributionCategories,
173
+ prepareOpponentThreats,
174
+ prepareSimpleEvidence,
175
+ preparedMoveComparison,
176
+ primaryConcept,
177
+ projectAblationEvidenceForModel,
178
+ projectCompactEngineEvidence,
179
+ projectEnginePresentation,
180
+ projectLeanDirectEvidence,
181
+ projectLeanEpisodeEvidence,
182
+ projectMaterial,
183
+ reasoningMetrics,
184
+ recordedPositionContext,
185
+ requestId,
186
+ resolveAndSelectPlan,
187
+ retainedEvidenceCatalogue,
188
+ runAnswerPipeline,
189
+ runLeanDirect,
190
+ runPreparedAnswer,
191
+ scoreComparisonNotices,
192
+ selectBranchHost,
193
+ simpleBoardAnalysis,
194
+ simpleInitialEvidenceView,
195
+ simplePastHistory,
196
+ simpleSystemPolicy,
197
+ simpleToolDescription,
198
+ simpleUsageForTrace,
199
+ squaresBetween,
200
+ stabilizeSimplePolicy,
201
+ stringListAttribute,
202
+ validateAblationEvidenceClosureBundle,
203
+ validateAblationProbeTelemetry,
204
+ validateAnswerReferences,
205
+ validateChessFactRecord,
206
+ validateChessFactRequest,
207
+ validateExplanationReview,
208
+ validateHypothesisAcceptancePolicies,
209
+ validateSimpleToolInput,
210
+ visibleSupportLines,
211
+ wikibooksTargetsForTool,
212
+ withBranchPreparation,
213
+ withRecordedPositionTools
214
+ } from "./chunk-PLKNJRPF.js";
215
+ import {
216
+ CHESS_REASONING_POLICY_VERSION,
217
+ CHESS_REASONING_SCHEMA_VERSION,
218
+ DEFAULT_REASONING_RUN_CONTROLS,
219
+ EVALUATED_ASTRA_CONFIG,
220
+ EVIDENCE_LICENSE,
221
+ EVIDENCE_SHARING_GUIDANCE_CHARS,
222
+ EVIDENCE_SHARING_INSTRUCTIONS,
223
+ EVIDENCE_SHARING_VERSION,
224
+ MAX_FRESH_ENGINE_WITNESS_ACQUISITIONS,
225
+ MAX_INTERACTIVE_LINE_PLIES,
226
+ ModelRuntimeFailure,
227
+ OPENING_SOURCE_LICENSE_URL,
228
+ QUESTION_ROUTING_VERSION,
229
+ REASONING_DISCOURSE_PLAN_VERSION,
230
+ REASONING_POC_CRITIC_CORRECTION_ALLOWANCE,
231
+ REASONING_POC_MAX_CRITIC_OUTPUT_TOKENS,
232
+ REASONING_POC_MAX_DISCOURSE_OUTPUT_TOKENS,
233
+ REASONING_POC_MAX_GRAPH_SELECTION_OUTPUT_TOKENS,
234
+ REASONING_POC_MAX_HYPOTHESIS_BATCHES,
235
+ REASONING_POC_MAX_HYPOTHESIS_OUTPUT_TOKENS,
236
+ REASONING_POC_MAX_OUTPUT_TOKENS,
237
+ REASONING_POC_MAX_PURPOSE_PROBE_OUTPUT_TOKENS,
238
+ REASONING_POC_MAX_RENDER_OUTPUT_TOKENS,
239
+ REASONING_POC_MAX_RESOLUTION_AUDIT_OUTPUT_TOKENS,
240
+ REASONING_POC_MAX_TERMINAL_REVIEW_OUTPUT_TOKENS,
241
+ REASONING_POC_PURPOSE_PROBE_ALLOWANCE,
242
+ REASONING_POC_RESERVED_MANDATORY_STEPS,
243
+ REASONING_POC_REVISION_EVIDENCE_ALLOWANCE,
244
+ REASONING_POC_VERSION,
245
+ REVIEW_SUBJECTS,
246
+ SIMPLE_EXTENSION_CONFIGS,
247
+ SIMPLE_MODEL_CATALOGUE,
248
+ SIMPLE_REFERENCE_VERSION,
249
+ SIMPLE_TOOL_AGENT_VERSION,
250
+ SIMPLE_VENDOR_CONFIGS,
251
+ admitFreshEnginePvWitnesses,
252
+ applyIdentityMove,
253
+ canonicalPieceLabel,
254
+ classificationTargetAtSelection,
255
+ classifyQuestionRoutingAnswers,
256
+ classifyReviewSubject,
257
+ collectReasoningMoveWitnesses,
258
+ createContextEvidence,
259
+ createIdentityState,
260
+ createPocIdentityTimeline,
261
+ createQueryContract,
262
+ decodeWikibooksIndex,
263
+ decorateSimpleVariations,
264
+ effectiveEvidenceLicenses,
265
+ effectiveLicensesForRecord,
266
+ evidenceLicenseInput,
267
+ expandSharedEvidence,
268
+ forkIdentityState,
269
+ hasMoveClassificationQuestion,
270
+ hasSharedEvidence,
271
+ historyPositionContext,
272
+ licensesBoundedRouteRelevance,
273
+ licensesSemanticChessGrounding,
274
+ makeQuestionRoutingRequest,
275
+ materialAlongLine,
276
+ materialAtPosition,
277
+ materialForVariations,
278
+ maximumEvidenceLicenses,
279
+ moveMechanismFacts,
280
+ moveSectionScope,
281
+ normalizedEvidenceCitations,
282
+ openingSourceLinks,
283
+ openingSourcesInMessages,
284
+ openingTitle,
285
+ parseOpeningSourceCredits,
286
+ parseQuestionRoutingAnswers,
287
+ pieceIdAt,
288
+ pieceIdentity,
289
+ positionKey,
290
+ priorConversationMessages,
291
+ reasoningContextHash,
292
+ reasoningEvidenceReplayStartPhase,
293
+ recordedMainLineResult,
294
+ recordedNavigation,
295
+ repairFrozenCitationLabels,
296
+ replayWikibooksTitle,
297
+ safeSimpleSourceLink,
298
+ savedScorePresentation,
299
+ scopePositionAnalysis,
300
+ selectIndexedOpening,
301
+ selectSimpleModel,
302
+ shareEvidence,
303
+ shareEvidenceMessages,
304
+ simpleEffortsForModel,
305
+ simpleProseReferences,
306
+ squareForPiece,
307
+ stableHash,
308
+ stableJson,
309
+ stripSimpleCitationLinks,
310
+ stripSimpleMarkdownFences,
311
+ toLegacyPositionAnalysis,
312
+ toLegacyPositionAnalysisProvider,
313
+ toPositionAnalysis,
314
+ toPositionAnalysisProvider,
315
+ validateEvidenceLicenseClaims,
316
+ validateReasoningPositionContext,
317
+ validateSimpleAgentConfig,
318
+ withEvidenceLicenses
319
+ } from "./chunk-XQDZJOYD.js";
320
+
321
+ // src/chess-reasoning/ablation-direct-synthesis.ts
322
+ import { SQUARES } from "chess.js";
323
+
324
+ // src/chess-reasoning/poc-semantic-text.ts
325
+ var RAW_CHESS_TEXT_PATTERN_SOURCE = String.raw`(?:\b(?:(?:[Ww]hite|[Bb]lack)(?:['’]s)?\s+)?(?:[Bb]ishop|[Kk]night(?!['’]s\s+[Ee]ye\b)|[Rr]ook|[Qq]ueen(?!-[Ss]ide\b)|[Kk]ing(?!-[Ss]ide\b)|[Pp]awn)\b|\b(?:[a-h][1-8][a-h][1-8][qrbn]?|[KQRBN][a-h1-8]?x?[a-h][1-8](?:=[QRBN])?[+#]?|[a-h]x[a-h][1-8](?:=[QRBN])?[+#]?|O-O(?:-O)?|[a-h][1-8])\b)`;
326
+ var RAW_CHESS_TEXT = new RegExp(RAW_CHESS_TEXT_PATTERN_SOURCE, "i");
327
+ var SEMANTIC_TEXT_JSON_PATTERN = `^(?![\\s\\S]*${RAW_CHESS_TEXT_PATTERN_SOURCE})[\\s\\S]{1,600}$`;
328
+
329
+ // src/chess-reasoning/ablation-direct-synthesis.ts
330
+ var ABLATION_DIRECT_SYNTHESIS_VERSION = "architecture-ablation-direct-synthesis/2";
331
+ var DIRECT_SYNTHESIS_PROPOSAL_JSON_SCHEMA = {
332
+ type: "object",
333
+ additionalProperties: false,
334
+ required: ["schemaVersion", "hypotheses", "relations", "claims", "demonstrations", "coverage", "limitations", "riskProfile"],
335
+ properties: {
336
+ schemaVersion: { const: ABLATION_DIRECT_SYNTHESIS_VERSION },
337
+ hypotheses: { type: "array", minItems: 1, maxItems: 16, items: { $ref: "#/$defs/hypothesis" } },
338
+ relations: { type: "array", maxItems: 24, items: { $ref: "#/$defs/relation" } },
339
+ claims: { type: "array", minItems: 1, maxItems: 16, items: { $ref: "#/$defs/claim" } },
340
+ demonstrations: { type: ["array", "null"], maxItems: 8, items: { $ref: "#/$defs/demonstration" } },
341
+ coverage: { $ref: "#/$defs/coverage" },
342
+ limitations: { type: "array", maxItems: 24, items: { type: "string", minLength: 1, maxLength: 1e3 } },
343
+ riskProfile: { $ref: "#/$defs/riskProfile" }
344
+ },
345
+ $defs: {
346
+ reference: { type: "object", additionalProperties: false, required: ["domain", "id"], properties: { domain: { type: "string", minLength: 1, maxLength: 160 }, id: { type: "string", minLength: 1, maxLength: 200 } } },
347
+ participant: { type: "object", additionalProperties: false, required: ["role", "ref"], properties: { role: { type: "string", minLength: 1, maxLength: 160 }, ref: { $ref: "#/$defs/reference" } } },
348
+ anchor: { type: "object", additionalProperties: false, required: ["participant", "disposition"], properties: { participant: { $ref: "#/$defs/participant" }, disposition: { const: "required" } } },
349
+ attributeEntry: { type: "object", additionalProperties: false, required: ["key", "value"], properties: { key: { type: "string", minLength: 1, maxLength: 160 }, value: { $ref: "#/$defs/attributeValue" } } },
350
+ attributeObject: { type: "object", additionalProperties: false, required: ["entries"], properties: { entries: { type: "array", maxItems: 32, items: { $ref: "#/$defs/attributeEntry" } } } },
351
+ attributeValue: { anyOf: [
352
+ { type: "object", additionalProperties: false, required: ["type", "value"], properties: { type: { const: "string" }, value: { type: "string", maxLength: 1e3 } } },
353
+ { type: "object", additionalProperties: false, required: ["type", "value"], properties: { type: { const: "number" }, value: { type: "number" } } },
354
+ { type: "object", additionalProperties: false, required: ["type", "value"], properties: { type: { const: "boolean" }, value: { type: "boolean" } } },
355
+ { type: "object", additionalProperties: false, required: ["type", "value"], properties: { type: { const: "null" }, value: { type: "null" } } },
356
+ { type: "object", additionalProperties: false, required: ["type", "items"], properties: { type: { const: "array" }, items: { type: "array", maxItems: 32, items: { $ref: "#/$defs/attributeValue" } } } },
357
+ { type: "object", additionalProperties: false, required: ["type", "entries"], properties: { type: { const: "object" }, entries: { type: "array", maxItems: 32, items: { $ref: "#/$defs/attributeEntry" } } } }
358
+ ] },
359
+ hypothesis: {
360
+ type: "object",
361
+ additionalProperties: false,
362
+ required: ["localId", "entityType", "concepts", "owner", "participants", "attributes", "proofStrength", "evidenceIds", "sourceObservationIds", "parentHypothesisIds", "anchorRequirements"],
363
+ properties: {
364
+ localId: { type: "string", minLength: 1, maxLength: 160 },
365
+ entityType: { type: "string", minLength: 1, maxLength: 160 },
366
+ concepts: { type: "array", minItems: 1, maxItems: 4, items: { type: "string", minLength: 1, maxLength: 160 } },
367
+ owner: { enum: ["w", "b", null] },
368
+ participants: { type: "array", maxItems: 12, items: { $ref: "#/$defs/participant" } },
369
+ attributes: { $ref: "#/$defs/attributeObject" },
370
+ proofStrength: { enum: ["observed", "supported", "forced", null] },
371
+ evidenceIds: { type: "array", maxItems: 12, items: { type: "string", minLength: 1, maxLength: 200 } },
372
+ sourceObservationIds: { type: "array", maxItems: 12, items: { type: "string", minLength: 1, maxLength: 200 } },
373
+ parentHypothesisIds: { type: "array", maxItems: 8, items: { type: "string", minLength: 1, maxLength: 200 } },
374
+ anchorRequirements: { type: "array", maxItems: 12, items: { $ref: "#/$defs/anchor" } }
375
+ }
376
+ },
377
+ relation: { type: "object", additionalProperties: false, required: ["localId", "relationType", "from", "to", "attributes", "evidenceIds", "sourceObservationIds"], properties: { localId: { type: "string", minLength: 1, maxLength: 160 }, relationType: { type: "string", minLength: 1, maxLength: 160 }, from: { type: "string", minLength: 1, maxLength: 160 }, to: { type: "string", minLength: 1, maxLength: 160 }, attributes: { $ref: "#/$defs/attributeObject" }, evidenceIds: { type: "array", minItems: 1, maxItems: 12, items: { type: "string", minLength: 1, maxLength: 200 } }, sourceObservationIds: { type: "array", maxItems: 12, items: { type: "string", minLength: 1, maxLength: 200 } } } },
378
+ segment: { anyOf: [
379
+ { type: "object", additionalProperties: false, required: ["type", "text"], properties: { type: { const: "text" }, text: { type: "string", minLength: 1, maxLength: 600 } } },
380
+ { type: "object", additionalProperties: false, required: ["type", "pieceId", "form", "capitalize", "label"], properties: { type: { const: "piece" }, pieceId: { type: "string", minLength: 1, maxLength: 200 }, form: { enum: ["definite", "color-qualified", "square-qualified", "canonical", "bare", "bare-square-qualified", null] }, capitalize: { type: ["boolean", "null"] }, label: { type: ["string", "null"], minLength: 1, maxLength: 120 } } },
381
+ { type: "object", additionalProperties: false, required: ["type", "pieceKind", "color", "label"], properties: { type: { const: "piece-kind" }, pieceKind: { enum: ["bishop", "king", "knight", "pawn", "queen", "rook"] }, color: { enum: ["w", "b", null] }, label: { type: ["string", "null"], minLength: 1, maxLength: 120 } } },
382
+ { type: "object", additionalProperties: false, required: ["type", "square", "label"], properties: { type: { const: "square" }, square: { type: "string", minLength: 1, maxLength: 2 }, label: { type: ["string", "null"], minLength: 1, maxLength: 120 } } },
383
+ { type: "object", additionalProperties: false, required: ["type", "uci", "pieceId", "san", "label"], properties: { type: { const: "move" }, uci: { type: "string", minLength: 1, maxLength: 5 }, pieceId: { type: "string", minLength: 1, maxLength: 200 }, san: { type: "string", minLength: 1, maxLength: 40 }, label: { type: ["string", "null"], minLength: 1, maxLength: 120 } } },
384
+ { type: "object", additionalProperties: false, required: ["type", "entityLocalId", "label"], properties: { type: { const: "entity" }, entityLocalId: { type: "string", minLength: 1, maxLength: 160 }, label: { type: ["string", "null"], minLength: 1, maxLength: 120 } } },
385
+ { type: "object", additionalProperties: false, required: ["type", "relationLocalId", "fromEntityLocalId", "toEntityLocalId", "label"], properties: { type: { const: "relation" }, relationLocalId: { type: "string", minLength: 1, maxLength: 160 }, fromEntityLocalId: { type: "string", minLength: 1, maxLength: 160 }, toEntityLocalId: { type: "string", minLength: 1, maxLength: 160 }, label: { type: ["string", "null"], minLength: 1, maxLength: 120 } } }
386
+ ] },
387
+ claim: { type: "object", additionalProperties: false, required: ["localId", "kind", "content", "proofStrength", "evidenceIds", "qualifications"], properties: { localId: { type: "string", minLength: 1, maxLength: 160 }, kind: { enum: ["fact", "interpretation", "consequence", "defense", "uncertainty"] }, content: { type: "array", minItems: 1, maxItems: 32, items: { $ref: "#/$defs/segment" } }, proofStrength: { enum: ["observed", "supported", "forced", null] }, evidenceIds: { type: "array", minItems: 1, maxItems: 12, items: { type: "string", minLength: 1, maxLength: 200 } }, qualifications: { type: "array", maxItems: 8, items: { type: "array", minItems: 1, maxItems: 16, items: { $ref: "#/$defs/segment" } } } } },
388
+ demonstration: { anyOf: [
389
+ { type: "object", additionalProperties: false, required: ["localId", "type", "start", "moves", "label", "evidenceIds"], properties: { localId: { type: "string", minLength: 1, maxLength: 160 }, type: { const: "legal-variation" }, start: { enum: ["before", "after"] }, moves: { type: "array", minItems: 1, maxItems: 16, items: { type: "object", additionalProperties: false, required: ["uci", "pieceId", "san"], properties: { uci: { type: "string", minLength: 1, maxLength: 5 }, pieceId: { type: "string", minLength: 1, maxLength: 200 }, san: { type: "string", minLength: 1, maxLength: 40 } } } }, label: { type: "string", minLength: 1, maxLength: 160 }, evidenceIds: { type: "array", minItems: 1, maxItems: 12, items: { type: "string", minLength: 1, maxLength: 200 } } } },
390
+ { type: "object", additionalProperties: false, required: ["localId", "type", "pieceId", "waypoints", "prerequisiteRefs", "label", "evidenceIds"], properties: { localId: { type: "string", minLength: 1, maxLength: 160 }, type: { const: "conditional-route" }, pieceId: { type: "string", minLength: 1, maxLength: 200 }, waypoints: { type: "array", minItems: 1, maxItems: 16, items: { type: "string", minLength: 1, maxLength: 1e3 } }, prerequisiteRefs: { type: "array", minItems: 1, maxItems: 16, items: { $ref: "#/$defs/segment" } }, label: { type: "string", minLength: 1, maxLength: 160 }, evidenceIds: { type: "array", minItems: 1, maxItems: 12, items: { type: "string", minLength: 1, maxLength: 200 } } } },
391
+ { type: "object", additionalProperties: false, required: ["localId", "type", "relationLocalId", "fromEntityLocalId", "toEntityLocalId", "label", "evidenceIds"], properties: { localId: { type: "string", minLength: 1, maxLength: 160 }, type: { const: "static-relationship" }, relationLocalId: { type: "string", minLength: 1, maxLength: 160 }, fromEntityLocalId: { type: "string", minLength: 1, maxLength: 160 }, toEntityLocalId: { type: "string", minLength: 1, maxLength: 160 }, label: { type: "string", minLength: 1, maxLength: 160 }, evidenceIds: { type: "array", minItems: 1, maxItems: 12, items: { type: "string", minLength: 1, maxLength: 200 } } } }
392
+ ] },
393
+ coverageLane: { type: "object", additionalProperties: false, required: ["status", "evidenceIds", "unresolved"], properties: { status: { enum: ["complete", "partial", "unavailable"] }, evidenceIds: { type: "array", maxItems: 12, items: { type: "string", minLength: 1, maxLength: 200 } }, unresolved: { type: "array", maxItems: 24, items: { type: "string", minLength: 1, maxLength: 1e3 } } } },
394
+ omission: { type: "object", additionalProperties: false, required: ["localId", "reason"], properties: { localId: { type: "string", minLength: 1, maxLength: 160 }, reason: { type: "string", minLength: 1, maxLength: 500 } } },
395
+ coverage: { type: "object", additionalProperties: false, required: ["responseCoverage", "continuationCoverage", "unresolvedEvidenceObligations", "omittedHypotheses", "omittedRelations"], properties: { responseCoverage: { $ref: "#/$defs/coverageLane" }, continuationCoverage: { $ref: "#/$defs/coverageLane" }, unresolvedEvidenceObligations: { type: "array", maxItems: 24, items: { type: "object", additionalProperties: false, required: ["id", "reason"], properties: { id: { type: "string", minLength: 1, maxLength: 160 }, reason: { type: "string", minLength: 1, maxLength: 500 } } } }, omittedHypotheses: { type: "array", maxItems: 24, items: { $ref: "#/$defs/omission" } }, omittedRelations: { type: "array", maxItems: 24, items: { $ref: "#/$defs/omission" } } } },
396
+ riskProfile: { type: "object", additionalProperties: false, required: ["level", "reasons"], properties: { level: { enum: ["low", "medium", "high"] }, reasons: { type: "array", maxItems: 12, items: { type: "string", minLength: 1, maxLength: 1e3 } } } }
397
+ }
398
+ };
399
+ var AdmissionFailure = class extends Error {
400
+ constructor(issue) {
401
+ super(issue.message);
402
+ this.issue = issue;
403
+ }
404
+ issue;
405
+ };
406
+ function fail(path, code, message, permittedReferences = []) {
407
+ throw new AdmissionFailure({ path, code, message, permittedReferences });
408
+ }
409
+ function isRecord(value) {
410
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
411
+ }
412
+ function exactKeys(value, keys, path) {
413
+ if (Object.keys(value).some((key) => !keys.includes(key))) fail(path, "unsupported_field", "Direct synthesis contains an unsupported field");
414
+ }
415
+ function nonEmptyString(value, path, max = 1e3) {
416
+ if (typeof value !== "string" || !value.trim() || value.length > max) fail(path, "invalid_string", "Expected a bounded non-empty string");
417
+ return value.trim();
418
+ }
419
+ function stringArray(value, path, max, allowEmpty = true) {
420
+ if (!Array.isArray(value) || value.length > max || !allowEmpty && !value.length) fail(path, "invalid_string_array", "Expected a bounded string array");
421
+ const result = value.map((item, index) => nonEmptyString(item, `${path}[${index}]`));
422
+ if (new Set(result).size !== result.length) fail(path, "duplicate_reference", "References must not be duplicated");
423
+ return result;
424
+ }
425
+ function proof(value, path) {
426
+ if (value === null) return null;
427
+ if (value === "observed" || value === "supported" || value === "forced") return value;
428
+ return fail(path, "invalid_proof_strength", "Proof strength must be observed, supported, forced, or null");
429
+ }
430
+ function parseProviderAttributeEntries(value, path) {
431
+ if (!Array.isArray(value) || value.length > 32) fail(path, "invalid_attribute_entries", "Attribute entries must be a bounded array");
432
+ const attributes = {};
433
+ for (const [index, entry] of value.entries()) {
434
+ if (!isRecord(entry)) fail(`${path}[${index}]`, "invalid_attribute_entry", "Attribute entry must be structured");
435
+ exactKeys(entry, ["key", "value"], `${path}[${index}]`);
436
+ const key = nonEmptyString(entry.key, `${path}[${index}].key`, 160);
437
+ if (Object.hasOwn(attributes, key)) fail(`${path}[${index}].key`, "duplicate_attribute_key", "Attribute keys must be unique");
438
+ attributes[key] = parseProviderAttributeValue(entry.value, `${path}[${index}].value`);
439
+ }
440
+ return attributes;
441
+ }
442
+ function parseProviderAttributeValue(value, path) {
443
+ if (!isRecord(value)) fail(path, "invalid_attribute_value", "Attribute values must use the typed provider transport");
444
+ const type = value.type;
445
+ if (type === "string") {
446
+ exactKeys(value, ["type", "value"], path);
447
+ return nonEmptyString(value.value, `${path}.value`, 1e3);
448
+ }
449
+ if (type === "number") {
450
+ exactKeys(value, ["type", "value"], path);
451
+ if (typeof value.value !== "number" || !Number.isFinite(value.value)) fail(`${path}.value`, "invalid_attribute_number", "Attribute number must be finite");
452
+ return value.value;
453
+ }
454
+ if (type === "boolean") {
455
+ exactKeys(value, ["type", "value"], path);
456
+ if (typeof value.value !== "boolean") fail(`${path}.value`, "invalid_attribute_boolean", "Attribute boolean must be boolean");
457
+ return value.value;
458
+ }
459
+ if (type === "null") {
460
+ exactKeys(value, ["type", "value"], path);
461
+ if (value.value !== null) fail(`${path}.value`, "invalid_attribute_null", "Null attribute must carry null");
462
+ return null;
463
+ }
464
+ if (type === "array") {
465
+ exactKeys(value, ["type", "items"], path);
466
+ if (!Array.isArray(value.items) || value.items.length > 32) fail(`${path}.items`, "invalid_attribute_array", "Attribute array must be bounded");
467
+ return value.items.map((item, index) => parseProviderAttributeValue(item, `${path}.items[${index}]`));
468
+ }
469
+ if (type === "object") {
470
+ exactKeys(value, ["type", "entries"], path);
471
+ return parseProviderAttributeEntries(value.entries, `${path}.entries`);
472
+ }
473
+ return fail(`${path}.type`, "invalid_attribute_type", "Attribute value type is invalid");
474
+ }
475
+ function parseAttributes(value, path) {
476
+ if (!isRecord(value)) fail(path, "invalid_attributes", "Attributes must be an object");
477
+ if (Array.isArray(value.entries)) {
478
+ exactKeys(value, ["entries"], path);
479
+ return parseProviderAttributeEntries(value.entries, `${path}.entries`);
480
+ }
481
+ return value;
482
+ }
483
+ function assertNoCArtifacts(value, path = "proposal", topLevel = true) {
484
+ if (Array.isArray(value)) {
485
+ value.forEach((item, index) => assertNoCArtifacts(item, `${path}[${index}]`, false));
486
+ return;
487
+ }
488
+ if (!isRecord(value)) return;
489
+ const forbiddenTopLevel = /* @__PURE__ */ new Set([
490
+ "review",
491
+ "reviews",
492
+ "critic",
493
+ "critics",
494
+ "challenge",
495
+ "challenges",
496
+ "terminalReview",
497
+ "answerObligation",
498
+ "answerObligations",
499
+ "selectedGraph",
500
+ "selectedEntities",
501
+ "selectedRelations",
502
+ "graphRefs",
503
+ "hypothesisLedgerRevision",
504
+ "discourse",
505
+ "discoursePlan",
506
+ "render",
507
+ "repair"
508
+ ]);
509
+ if (topLevel) {
510
+ for (const key of Object.keys(value)) if (forbiddenTopLevel.has(key)) {
511
+ fail(`${path}.${key}`, "semantic_c_artifact", "Direct synthesis must not transport staged-C semantic artifacts");
512
+ }
513
+ }
514
+ if (Array.isArray(value.selectedEntities) || Array.isArray(value.selectedRelations) || typeof value.hypothesisLedgerRevision === "string" || isRecord(value.discoursePlan) && typeof value.discoursePlan.checkpointId === "string" || isRecord(value.reasoningCheckpoint) && typeof value.reasoningCheckpoint.checkpointVersion === "string") {
515
+ fail(path, "semantic_c_artifact", "Direct synthesis must not transport a staged-C envelope");
516
+ }
517
+ for (const [key, child] of Object.entries(value)) assertNoCArtifacts(child, `${path}.${key}`, false);
518
+ }
519
+ function parseSegment(value, path) {
520
+ if (!isRecord(value)) return fail(path, "invalid_segment", "Narrative segments must be typed objects");
521
+ const type = nonEmptyString(value.type, `${path}.type`, 64);
522
+ if (type === "text") {
523
+ exactKeys(value, ["type", "text"], path);
524
+ const text = nonEmptyString(value.text, `${path}.text`, 600);
525
+ if (RAW_CHESS_TEXT.test(text)) fail(`${path}.text`, "raw_chess_reference", "Concrete chess references must use typed segments");
526
+ return { type: "text", text };
527
+ }
528
+ if (type === "piece") {
529
+ exactKeys(value, ["type", "pieceId", "form", "capitalize", "label"], path);
530
+ const form = value.form;
531
+ if (form !== void 0 && form !== null && form !== "definite" && form !== "color-qualified" && form !== "square-qualified" && form !== "canonical" && form !== "bare" && form !== "bare-square-qualified") {
532
+ fail(`${path}.form`, "invalid_piece_form", "Piece reference form is invalid");
533
+ }
534
+ if (value.capitalize !== void 0 && value.capitalize !== null && typeof value.capitalize !== "boolean") fail(`${path}.capitalize`, "invalid_piece_capitalization", "Piece capitalization must be boolean");
535
+ if (value.label !== void 0 && value.label !== null) nonEmptyString(value.label, `${path}.label`, 120);
536
+ return { type: "piece", pieceId: nonEmptyString(value.pieceId, `${path}.pieceId`, 200), ...form === void 0 || form === null ? {} : { form }, ...value.capitalize === void 0 || value.capitalize === null ? {} : { capitalize: value.capitalize }, ...value.label === void 0 || value.label === null ? {} : { label: value.label } };
537
+ }
538
+ if (type === "piece-kind") {
539
+ exactKeys(value, ["type", "pieceKind", "color", "label"], path);
540
+ const pieceKind = nonEmptyString(value.pieceKind, `${path}.pieceKind`, 20);
541
+ if (!["bishop", "king", "knight", "pawn", "queen", "rook"].includes(pieceKind)) fail(`${path}.pieceKind`, "invalid_piece_kind", "Piece kind is invalid");
542
+ if (value.color !== "w" && value.color !== "b" && value.color !== null) fail(`${path}.color`, "invalid_piece_color", "Piece-kind color is invalid");
543
+ if (value.label !== void 0 && value.label !== null) nonEmptyString(value.label, `${path}.label`, 120);
544
+ return { type: "piece-kind", pieceKind, color: value.color, ...value.label === void 0 || value.label === null ? {} : { label: value.label } };
545
+ }
546
+ if (type === "square") {
547
+ exactKeys(value, ["type", "square", "label"], path);
548
+ if (value.label !== void 0 && value.label !== null) nonEmptyString(value.label, `${path}.label`, 120);
549
+ return { type: "square", square: nonEmptyString(value.square, `${path}.square`, 2), ...value.label === void 0 || value.label === null ? {} : { label: value.label } };
550
+ }
551
+ if (type === "move") {
552
+ exactKeys(value, ["type", "uci", "pieceId", "san", "label"], path);
553
+ if (value.label !== void 0 && value.label !== null) nonEmptyString(value.label, `${path}.label`, 120);
554
+ return { type: "move", uci: nonEmptyString(value.uci, `${path}.uci`, 5), pieceId: nonEmptyString(value.pieceId, `${path}.pieceId`, 200), san: nonEmptyString(value.san, `${path}.san`, 40), ...value.label === void 0 || value.label === null ? {} : { label: value.label } };
555
+ }
556
+ if (type === "entity") {
557
+ exactKeys(value, ["type", "entityLocalId", "label"], path);
558
+ if (value.label !== void 0 && value.label !== null) nonEmptyString(value.label, `${path}.label`, 120);
559
+ return { type: "entity", entityLocalId: nonEmptyString(value.entityLocalId, `${path}.entityLocalId`, 160), ...value.label === void 0 || value.label === null ? {} : { label: value.label } };
560
+ }
561
+ if (type === "relation") {
562
+ exactKeys(value, ["type", "relationLocalId", "fromEntityLocalId", "toEntityLocalId", "label"], path);
563
+ if (value.label !== void 0 && value.label !== null) nonEmptyString(value.label, `${path}.label`, 120);
564
+ return {
565
+ type: "relation",
566
+ relationLocalId: nonEmptyString(value.relationLocalId, `${path}.relationLocalId`, 160),
567
+ fromEntityLocalId: nonEmptyString(value.fromEntityLocalId, `${path}.fromEntityLocalId`, 160),
568
+ toEntityLocalId: nonEmptyString(value.toEntityLocalId, `${path}.toEntityLocalId`, 160),
569
+ ...value.label === void 0 || value.label === null ? {} : { label: value.label }
570
+ };
571
+ }
572
+ return fail(`${path}.type`, "unknown_segment_type", "Narrative segment type is not supported");
573
+ }
574
+ function parseClaim(value, path) {
575
+ if (!isRecord(value)) return fail(path, "invalid_claim", "Claim must be an object");
576
+ exactKeys(value, ["localId", "kind", "content", "proofStrength", "evidenceIds", "qualifications"], path);
577
+ const kind = value.kind;
578
+ if (kind !== "fact" && kind !== "interpretation" && kind !== "consequence" && kind !== "defense" && kind !== "uncertainty") fail(`${path}.kind`, "invalid_claim_kind", "Claim kind is invalid");
579
+ if (!Array.isArray(value.content) || !value.content.length || value.content.length > 32) fail(`${path}.content`, "invalid_claim_content", "Claim requires bounded typed content");
580
+ if (!Array.isArray(value.qualifications) || value.qualifications.length > 8) fail(`${path}.qualifications`, "invalid_qualifications", "Claim qualifications must be bounded typed segment arrays");
581
+ return {
582
+ localId: nonEmptyString(value.localId, `${path}.localId`, 160),
583
+ kind,
584
+ content: value.content.map((segment, index) => parseSegment(segment, `${path}.content[${index}]`)),
585
+ proofStrength: proof(value.proofStrength, `${path}.proofStrength`),
586
+ evidenceIds: stringArray(value.evidenceIds, `${path}.evidenceIds`, 12, false),
587
+ qualifications: value.qualifications.map((qualification, index) => {
588
+ if (!Array.isArray(qualification) || !qualification.length || qualification.length > 16) fail(`${path}.qualifications[${index}]`, "invalid_qualification", "Each qualification requires typed content");
589
+ return qualification.map((segment, segmentIndex) => parseSegment(segment, `${path}.qualifications[${index}][${segmentIndex}]`));
590
+ })
591
+ };
592
+ }
593
+ function parseHypothesis(value, path) {
594
+ if (!isRecord(value)) return fail(path, "invalid_hypothesis", "Hypothesis must be an object");
595
+ exactKeys(value, ["localId", "entityType", "concepts", "owner", "participants", "attributes", "proofStrength", "evidenceIds", "sourceObservationIds", "parentHypothesisIds", "anchorRequirements"], path);
596
+ if (value.owner !== "w" && value.owner !== "b" && value.owner !== null) fail(`${path}.owner`, "invalid_owner", "Hypothesis owner is invalid");
597
+ if (!Array.isArray(value.participants) || value.participants.length > 12) fail(`${path}.participants`, "invalid_participants", "Hypothesis participants must be bounded");
598
+ const participants = value.participants.map((participant2, index) => {
599
+ if (!isRecord(participant2) || !isRecord(participant2.ref)) fail(`${path}.participants[${index}]`, "invalid_participant", "Participant must have a typed reference");
600
+ exactKeys(participant2, ["role", "ref"], `${path}.participants[${index}]`);
601
+ exactKeys(participant2.ref, ["domain", "id"], `${path}.participants[${index}].ref`);
602
+ return {
603
+ role: nonEmptyString(participant2.role, `${path}.participants[${index}].role`, 160),
604
+ ref: {
605
+ domain: nonEmptyString(participant2.ref.domain, `${path}.participants[${index}].ref.domain`, 160),
606
+ id: nonEmptyString(participant2.ref.id, `${path}.participants[${index}].ref.id`, 200)
607
+ }
608
+ };
609
+ });
610
+ if (!Array.isArray(value.anchorRequirements) || value.anchorRequirements.length > 12) fail(`${path}.anchorRequirements`, "invalid_anchor_requirements", "Hypothesis anchors must be bounded");
611
+ const anchorRequirements = value.anchorRequirements.map((anchor, index) => {
612
+ if (!isRecord(anchor) || !isRecord(anchor.participant) || !isRecord(anchor.participant.ref)) fail(`${path}.anchorRequirements[${index}]`, "invalid_anchor_requirement", "Anchor requirement is malformed");
613
+ exactKeys(anchor, ["participant", "disposition"], `${path}.anchorRequirements[${index}]`);
614
+ exactKeys(anchor.participant, ["role", "ref"], `${path}.anchorRequirements[${index}].participant`);
615
+ exactKeys(anchor.participant.ref, ["domain", "id"], `${path}.anchorRequirements[${index}].participant.ref`);
616
+ if (anchor.disposition !== "required") fail(`${path}.anchorRequirements[${index}].disposition`, "invalid_anchor_disposition", "Anchor disposition must be required");
617
+ return {
618
+ disposition: "required",
619
+ participant: {
620
+ role: nonEmptyString(anchor.participant.role, `${path}.anchorRequirements[${index}].participant.role`, 160),
621
+ ref: {
622
+ domain: nonEmptyString(anchor.participant.ref.domain, `${path}.anchorRequirements[${index}].participant.ref.domain`, 160),
623
+ id: nonEmptyString(anchor.participant.ref.id, `${path}.anchorRequirements[${index}].participant.ref.id`, 200)
624
+ }
625
+ }
626
+ };
627
+ });
628
+ return {
629
+ localId: nonEmptyString(value.localId, `${path}.localId`, 160),
630
+ entityType: nonEmptyString(value.entityType, `${path}.entityType`, 160),
631
+ concepts: stringArray(value.concepts, `${path}.concepts`, 4, false),
632
+ owner: value.owner,
633
+ participants,
634
+ attributes: parseAttributes(value.attributes, `${path}.attributes`),
635
+ proofStrength: proof(value.proofStrength, `${path}.proofStrength`),
636
+ evidenceIds: stringArray(value.evidenceIds, `${path}.evidenceIds`, 12),
637
+ sourceObservationIds: stringArray(value.sourceObservationIds, `${path}.sourceObservationIds`, 12),
638
+ parentHypothesisIds: stringArray(value.parentHypothesisIds, `${path}.parentHypothesisIds`, 8),
639
+ anchorRequirements
640
+ };
641
+ }
642
+ function parseRelation(value, path) {
643
+ if (!isRecord(value)) return fail(path, "invalid_relation", "Relation must be an object");
644
+ exactKeys(value, ["localId", "relationType", "from", "to", "attributes", "evidenceIds", "sourceObservationIds"], path);
645
+ return {
646
+ localId: nonEmptyString(value.localId, `${path}.localId`, 160),
647
+ relationType: nonEmptyString(value.relationType, `${path}.relationType`, 160),
648
+ from: nonEmptyString(value.from, `${path}.from`, 160),
649
+ to: nonEmptyString(value.to, `${path}.to`, 160),
650
+ attributes: parseAttributes(value.attributes, `${path}.attributes`),
651
+ evidenceIds: stringArray(value.evidenceIds, `${path}.evidenceIds`, 12, false),
652
+ sourceObservationIds: stringArray(value.sourceObservationIds, `${path}.sourceObservationIds`, 12)
653
+ };
654
+ }
655
+ function parseCoverageLane(value, path) {
656
+ if (!isRecord(value)) return fail(path, "invalid_coverage_lane", "Coverage lane must be structured");
657
+ exactKeys(value, ["status", "evidenceIds", "unresolved"], path);
658
+ if (value.status !== "complete" && value.status !== "partial" && value.status !== "unavailable") fail(`${path}.status`, "invalid_coverage_status", "Coverage status is invalid");
659
+ const evidenceIds = stringArray(value.evidenceIds, `${path}.evidenceIds`, 12);
660
+ const unresolved = stringArray(value.unresolved, `${path}.unresolved`, 24);
661
+ if (value.status === "complete" && unresolved.length) fail(`${path}.unresolved`, "complete_coverage_has_unresolved", "Complete coverage cannot retain unresolved obligations");
662
+ return { status: value.status, evidenceIds, unresolved };
663
+ }
664
+ function parseOmissions(value, path) {
665
+ if (!Array.isArray(value) || value.length > 24) fail(path, "invalid_omissions", "Omissions must be a bounded array");
666
+ const omissions = value.map((item, index) => {
667
+ if (!isRecord(item)) return fail(`${path}[${index}]`, "invalid_omission", "Omission must be structured");
668
+ exactKeys(item, ["localId", "reason"], `${path}[${index}]`);
669
+ return { localId: nonEmptyString(item.localId, `${path}[${index}].localId`, 160), reason: nonEmptyString(item.reason, `${path}[${index}].reason`, 500) };
670
+ });
671
+ if (new Set(omissions.map((item) => item.localId)).size !== omissions.length) fail(path, "duplicate_omission", "Omitted local IDs must be unique");
672
+ return omissions;
673
+ }
674
+ function parseCoverage(value, path) {
675
+ if (!isRecord(value)) return fail(path, "invalid_coverage", "Direct synthesis requires structured coverage");
676
+ exactKeys(value, ["responseCoverage", "continuationCoverage", "unresolvedEvidenceObligations", "omittedHypotheses", "omittedRelations"], path);
677
+ if (!Array.isArray(value.unresolvedEvidenceObligations) || value.unresolvedEvidenceObligations.length > 24) fail(`${path}.unresolvedEvidenceObligations`, "invalid_unresolved_obligations", "Unresolved evidence obligations must be bounded");
678
+ const unresolvedEvidenceObligations = value.unresolvedEvidenceObligations.map((item, index) => {
679
+ if (!isRecord(item)) return fail(`${path}.unresolvedEvidenceObligations[${index}]`, "invalid_unresolved_obligation", "Unresolved evidence obligation must be structured");
680
+ exactKeys(item, ["id", "reason"], `${path}.unresolvedEvidenceObligations[${index}]`);
681
+ return { id: nonEmptyString(item.id, `${path}.unresolvedEvidenceObligations[${index}].id`, 160), reason: nonEmptyString(item.reason, `${path}.unresolvedEvidenceObligations[${index}].reason`, 500) };
682
+ });
683
+ if (new Set(unresolvedEvidenceObligations.map((item) => item.id)).size !== unresolvedEvidenceObligations.length) fail(`${path}.unresolvedEvidenceObligations`, "duplicate_unresolved_obligation", "Unresolved evidence obligations must be unique");
684
+ return {
685
+ responseCoverage: parseCoverageLane(value.responseCoverage, `${path}.responseCoverage`),
686
+ continuationCoverage: parseCoverageLane(value.continuationCoverage, `${path}.continuationCoverage`),
687
+ unresolvedEvidenceObligations,
688
+ omittedHypotheses: parseOmissions(value.omittedHypotheses, `${path}.omittedHypotheses`),
689
+ omittedRelations: parseOmissions(value.omittedRelations, `${path}.omittedRelations`)
690
+ };
691
+ }
692
+ function parseDemonstration(value, path) {
693
+ if (!isRecord(value)) return fail(path, "invalid_demonstration", "Demonstration must be an object");
694
+ const type = value.type;
695
+ if (type === "legal-variation") {
696
+ exactKeys(value, ["localId", "type", "start", "moves", "label", "evidenceIds"], path);
697
+ if (value.start !== "before" && value.start !== "after") fail(`${path}.start`, "invalid_variation_start", "Variation start must be before or after");
698
+ if (!Array.isArray(value.moves) || !value.moves.length || value.moves.length > 16) fail(`${path}.moves`, "invalid_variation_moves", "Variation requires bounded moves");
699
+ return {
700
+ localId: nonEmptyString(value.localId, `${path}.localId`, 160),
701
+ type,
702
+ start: value.start,
703
+ moves: value.moves.map((move, index) => {
704
+ if (!isRecord(move)) return fail(`${path}.moves[${index}]`, "invalid_variation_move", "Variation move must be typed");
705
+ exactKeys(move, ["uci", "pieceId", "san"], `${path}.moves[${index}]`);
706
+ return { uci: nonEmptyString(move.uci, `${path}.moves[${index}].uci`, 5), pieceId: nonEmptyString(move.pieceId, `${path}.moves[${index}].pieceId`, 200), san: nonEmptyString(move.san, `${path}.moves[${index}].san`, 40) };
707
+ }),
708
+ label: nonEmptyString(value.label, `${path}.label`, 160),
709
+ evidenceIds: stringArray(value.evidenceIds, `${path}.evidenceIds`, 12, false)
710
+ };
711
+ }
712
+ if (type === "conditional-route") {
713
+ exactKeys(value, ["localId", "type", "pieceId", "waypoints", "prerequisiteRefs", "label", "evidenceIds"], path);
714
+ if (!Array.isArray(value.prerequisiteRefs) || !value.prerequisiteRefs.length || value.prerequisiteRefs.length > 16) fail(`${path}.prerequisiteRefs`, "invalid_route_prerequisites", "Route prerequisites require typed references");
715
+ return {
716
+ localId: nonEmptyString(value.localId, `${path}.localId`, 160),
717
+ type,
718
+ pieceId: nonEmptyString(value.pieceId, `${path}.pieceId`, 200),
719
+ waypoints: stringArray(value.waypoints, `${path}.waypoints`, 16, false),
720
+ prerequisiteRefs: value.prerequisiteRefs.map((segment, index) => parseSegment(segment, `${path}.prerequisiteRefs[${index}]`)),
721
+ label: nonEmptyString(value.label, `${path}.label`, 160),
722
+ evidenceIds: stringArray(value.evidenceIds, `${path}.evidenceIds`, 12, false)
723
+ };
724
+ }
725
+ if (type === "static-relationship") {
726
+ exactKeys(value, ["localId", "type", "relationLocalId", "fromEntityLocalId", "toEntityLocalId", "label", "evidenceIds"], path);
727
+ return {
728
+ localId: nonEmptyString(value.localId, `${path}.localId`, 160),
729
+ type,
730
+ relationLocalId: nonEmptyString(value.relationLocalId, `${path}.relationLocalId`, 160),
731
+ fromEntityLocalId: nonEmptyString(value.fromEntityLocalId, `${path}.fromEntityLocalId`, 160),
732
+ toEntityLocalId: nonEmptyString(value.toEntityLocalId, `${path}.toEntityLocalId`, 160),
733
+ label: nonEmptyString(value.label, `${path}.label`, 160),
734
+ evidenceIds: stringArray(value.evidenceIds, `${path}.evidenceIds`, 12, false)
735
+ };
736
+ }
737
+ return fail(`${path}.type`, "invalid_demonstration_type", "Demonstration type is invalid");
738
+ }
739
+ function parseDirectSynthesisProposal(value) {
740
+ assertNoCArtifacts(value);
741
+ if (!isRecord(value)) return fail("proposal", "invalid_proposal", "Direct synthesis proposal must be an object");
742
+ exactKeys(value, ["schemaVersion", "hypotheses", "relations", "claims", "demonstrations", "coverage", "limitations", "riskProfile"], "proposal");
743
+ if (value.schemaVersion !== ABLATION_DIRECT_SYNTHESIS_VERSION) fail("proposal.schemaVersion", "unsupported_version", "Unsupported direct synthesis schema version");
744
+ if (!Array.isArray(value.hypotheses) || !value.hypotheses.length || value.hypotheses.length > 16) fail("proposal.hypotheses", "invalid_hypotheses", "Direct synthesis requires one bounded hypothesis batch");
745
+ if (!Array.isArray(value.relations) || value.relations.length > 24) fail("proposal.relations", "invalid_relations", "Relations must be a bounded array");
746
+ if (!Array.isArray(value.claims) || !value.claims.length || value.claims.length > 16) fail("proposal.claims", "invalid_claims", "Direct synthesis requires bounded typed claims");
747
+ if (value.demonstrations !== void 0 && value.demonstrations !== null && (!Array.isArray(value.demonstrations) || value.demonstrations.length > 8)) fail("proposal.demonstrations", "invalid_demonstrations", "Demonstrations must be a bounded array or null");
748
+ if (!isRecord(value.riskProfile)) fail("proposal.riskProfile", "invalid_risk_profile", "Risk profile must be structured");
749
+ exactKeys(value.riskProfile, ["level", "reasons"], "proposal.riskProfile");
750
+ if (value.riskProfile.level !== "low" && value.riskProfile.level !== "medium" && value.riskProfile.level !== "high") fail("proposal.riskProfile.level", "invalid_risk_level", "Risk level is invalid");
751
+ return {
752
+ schemaVersion: ABLATION_DIRECT_SYNTHESIS_VERSION,
753
+ hypotheses: value.hypotheses.map((hypothesis, index) => parseHypothesis(hypothesis, `proposal.hypotheses[${index}]`)),
754
+ relations: value.relations.map((relation, index) => parseRelation(relation, `proposal.relations[${index}]`)),
755
+ claims: value.claims.map((claim, index) => parseClaim(claim, `proposal.claims[${index}]`)),
756
+ ...value.demonstrations === void 0 || value.demonstrations === null ? {} : { demonstrations: value.demonstrations.map((demonstration, index) => parseDemonstration(demonstration, `proposal.demonstrations[${index}]`)) },
757
+ coverage: parseCoverage(value.coverage, "proposal.coverage"),
758
+ limitations: stringArray(value.limitations, "proposal.limitations", 24),
759
+ riskProfile: { level: value.riskProfile.level, reasons: stringArray(value.riskProfile.reasons, "proposal.riskProfile.reasons", 12) }
760
+ };
761
+ }
762
+ function proofRank(value) {
763
+ return value === "observed" ? 1 : value === "supported" ? 2 : 3;
764
+ }
765
+ function assertDistinctLocalIds(proposal) {
766
+ const localIds = [
767
+ ...proposal.hypotheses.map((item) => item.localId),
768
+ ...proposal.relations.map((item) => item.localId),
769
+ ...proposal.claims.map((item) => item.localId),
770
+ ...(proposal.demonstrations || []).map((item) => item.localId)
771
+ ];
772
+ if (new Set(localIds).size !== localIds.length) fail("proposal", "duplicate_local_id", "Model-local IDs must be unique within one direct synthesis result");
773
+ }
774
+ function admittedEvidenceIds(bundle, ids, path) {
775
+ const allowed = new Set(bundle.referenceAllowlists.evidenceIds);
776
+ const records = new Map(bundle.evidence.map((record) => [record.id, record]));
777
+ for (const id of ids) if (!allowed.has(id) || !records.has(id)) fail(path, "unknown_evidence", "Evidence is outside the frozen closure", [...allowed]);
778
+ return ids.map((id) => records.get(id));
779
+ }
780
+ function assertEvidenceProof(bundle, ids, path, requestedProof) {
781
+ const records = admittedEvidenceIds(bundle, ids, path);
782
+ if (requestedProof && !records.some((record) => record.proofStrength && proofRank(record.proofStrength) >= proofRank(requestedProof))) {
783
+ fail(path, "unsupported_proof_strength", "Claimed proof strength exceeds cited evidence");
784
+ }
785
+ return records;
786
+ }
787
+ function hasMeaningLicense(record) {
788
+ return record.some((item) => licensesSemanticChessGrounding(effectiveLicensesForRecord(item)));
789
+ }
790
+ function assertEvidenceSupportsMeaning(bundle, ids, path, requestedProof) {
791
+ const records = assertEvidenceProof(bundle, ids, path, requestedProof);
792
+ if (!hasMeaningLicense(records)) fail(path, "underlicensed_semantic_meaning", "Semantic meaning requires centrally licensed position, bounded-engine, or reviewed-semantic evidence; legality and identity alone are insufficient");
793
+ }
794
+ function assertEvidenceSupportsRouteMeaning(bundle, ids, path) {
795
+ const records = admittedEvidenceIds(bundle, ids, path);
796
+ if (!records.some((record) => licensesBoundedRouteRelevance(effectiveLicensesForRecord(record)))) {
797
+ fail(path, "underlicensed_route_meaning", "Conditional routes and plans require bounded continuation, comparison, or response-coverage evidence");
798
+ }
799
+ }
800
+ function assertEvidenceSupportsClaim(bundle, ids, path, kind, requestedProof) {
801
+ const records = assertEvidenceProof(bundle, ids, path, requestedProof);
802
+ const licenses = records.flatMap((record) => effectiveLicensesForRecord(record));
803
+ if (kind === "fact" || kind === "uncertainty") {
804
+ if (!licenses.some((license) => license === EVIDENCE_LICENSE.CHESS_LEGALITY || license === EVIDENCE_LICENSE.CHESS_IDENTITY || license === EVIDENCE_LICENSE.CHESS_POSITION_FACT || license.startsWith("engine."))) {
805
+ fail(path, "underlicensed_fact_claim", "Fact claim lacks exact or bounded-engine evidence");
806
+ }
807
+ return;
808
+ }
809
+ if (kind === "interpretation" || kind === "consequence") {
810
+ if (!hasMeaningLicense(records)) fail(path, "underlicensed_semantic_meaning", "Interpretation/consequence claims cannot be grounded only by legality, identity, or bounded comparison score evidence");
811
+ return;
812
+ }
813
+ if (!licenses.includes(EVIDENCE_LICENSE.ENGINE_BOUNDED_RESPONSE_COVERAGE) && !licenses.includes(EVIDENCE_LICENSE.ENGINE_BOUNDED_CONTINUATION)) {
814
+ fail(path, "underlicensed_defense_claim", "Defense claims require bounded response or continuation evidence");
815
+ }
816
+ }
817
+ function referenceAuthority(bundle) {
818
+ const pieces = new Set(bundle.referenceAllowlists.semanticReferences.filter((item) => item.domain === REFERENCE_DOMAINS.PIECE).map((item) => item.id));
819
+ const squares = new Set(bundle.referenceAllowlists.semanticReferences.filter((item) => item.domain === REFERENCE_DOMAINS.SQUARE).map((item) => item.id));
820
+ const moveIds = new Set(bundle.referenceAllowlists.semanticReferences.filter((item) => item.domain === REFERENCE_DOMAINS.MOVE).map((item) => item.id));
821
+ const moves = /* @__PURE__ */ new Map();
822
+ for (const witness of bundle.referenceAllowlists.moveWitnesses) {
823
+ const key = `${witness.uci}:${witness.pieceId}:${witness.san}`;
824
+ const evidence = moves.get(key) || /* @__PURE__ */ new Set();
825
+ evidence.add(witness.evidenceId);
826
+ moves.set(key, evidence);
827
+ }
828
+ return { pieces, squares, moveIds, moves };
829
+ }
830
+ function addClosureReferences(value, global, scoped) {
831
+ if (typeof value === "string") {
832
+ if (global.pieces.has(value)) scoped.pieces.add(value);
833
+ if (global.squares.has(value)) scoped.squares.add(value);
834
+ return;
835
+ }
836
+ if (Array.isArray(value)) {
837
+ value.forEach((item) => addClosureReferences(item, global, scoped));
838
+ return;
839
+ }
840
+ if (isRecord(value)) Object.values(value).forEach((item) => addClosureReferences(item, global, scoped));
841
+ }
842
+ function scopedReferenceAuthority(bundle, evidenceIds, semanticParticipants = []) {
843
+ const global = referenceAuthority(bundle);
844
+ const pieces = /* @__PURE__ */ new Set();
845
+ const squares = /* @__PURE__ */ new Set();
846
+ const moves = /* @__PURE__ */ new Map();
847
+ const addWitness = (witness) => {
848
+ if (!global.moveIds.has(witness.uci)) return;
849
+ const key = `${witness.uci}:${witness.pieceId}:${witness.san}`;
850
+ const sources = moves.get(key) || /* @__PURE__ */ new Set();
851
+ sources.add(witness.evidenceId);
852
+ moves.set(key, sources);
853
+ if (global.pieces.has(witness.pieceId)) pieces.add(witness.pieceId);
854
+ if (global.squares.has(witness.uci.slice(0, 2))) squares.add(witness.uci.slice(0, 2));
855
+ if (global.squares.has(witness.uci.slice(2, 4))) squares.add(witness.uci.slice(2, 4));
856
+ };
857
+ bundle.referenceAllowlists.moveWitnesses.filter((witness) => witness.uci === bundle.context.moveUci).forEach(addWitness);
858
+ const requested = new Set(evidenceIds);
859
+ for (const record of bundle.evidence) {
860
+ if (!requested.has(record.id)) continue;
861
+ addClosureReferences(record.data, global, { pieces, squares });
862
+ collectReasoningMoveWitnesses([record], bundle.context).forEach(addWitness);
863
+ }
864
+ for (const participant2 of semanticParticipants) {
865
+ if (participant2.ref.domain === REFERENCE_DOMAINS.PIECE && global.pieces.has(participant2.ref.id)) pieces.add(participant2.ref.id);
866
+ if (participant2.ref.domain === REFERENCE_DOMAINS.SQUARE && global.squares.has(participant2.ref.id)) squares.add(participant2.ref.id);
867
+ }
868
+ return { pieces, squares, moveIds: global.moveIds, moves };
869
+ }
870
+ function assertTypedParticipantReference(reference, evidenceIds, authority, path) {
871
+ if (reference.domain === REFERENCE_DOMAINS.PIECE) {
872
+ if (!authority.pieces.has(reference.id)) fail(path, "participant_outside_closure", "Piece participant is outside the frozen semantic-reference allowlist", [...authority.pieces]);
873
+ return;
874
+ }
875
+ if (reference.domain === REFERENCE_DOMAINS.SQUARE) {
876
+ if (!authority.squares.has(reference.id)) fail(path, "participant_outside_closure", "Square participant is outside the frozen semantic-reference allowlist", [...authority.squares]);
877
+ return;
878
+ }
879
+ if (reference.domain === REFERENCE_DOMAINS.MOVE) {
880
+ const witnessed = [...authority.moves.entries()].some(([key, evidence]) => key.startsWith(`${reference.id}:`) && [...evidence].some((id) => evidenceIds.includes(id)));
881
+ if (!authority.moveIds.has(reference.id) || !witnessed) fail(path, "participant_move_unwitnessed", "Move participant lacks a typed allowlist entry or cited exact witness in the frozen closure", [...authority.moves.keys()]);
882
+ return;
883
+ }
884
+ fail(path, "participant_outside_closure", "Participant domain is outside the frozen semantic-reference allowlist", [REFERENCE_DOMAINS.PIECE, REFERENCE_DOMAINS.SQUARE, REFERENCE_DOMAINS.MOVE]);
885
+ }
886
+ function assertHypothesisReferenceAuthority(hypothesis, evidenceIds, authority, path) {
887
+ hypothesis.participants.forEach((participant2, index) => assertTypedParticipantReference(participant2.ref, evidenceIds, authority, `${path}.participants[${index}].ref`));
888
+ hypothesis.anchorRequirements.forEach((anchor, index) => assertTypedParticipantReference(anchor.participant.ref, evidenceIds, authority, `${path}.anchorRequirements[${index}].participant.ref`));
889
+ }
890
+ function hasEvidenceAssociation(itemEvidenceIds, semanticEvidenceIds) {
891
+ return itemEvidenceIds.some((id) => semanticEvidenceIds.includes(id));
892
+ }
893
+ function semanticParticipantsForSegments(segments, hypothesesByLocalId, relationsByLocalId) {
894
+ const participants = [];
895
+ const addHypothesis = (localId) => {
896
+ const hypothesis = hypothesesByLocalId.get(localId);
897
+ if (hypothesis) participants.push(...hypothesis.participants);
898
+ };
899
+ for (const segment of segments) {
900
+ if (segment.type === "entity") addHypothesis(segment.entityLocalId);
901
+ if (segment.type === "relation") {
902
+ const relation = relationsByLocalId.get(segment.relationLocalId);
903
+ if (relation) {
904
+ addHypothesis(relation.from);
905
+ addHypothesis(relation.to);
906
+ }
907
+ }
908
+ }
909
+ return participants;
910
+ }
911
+ function remapSegments(segments, path, evidenceIds, authority, localToCanonical, relationByLocalId, hypothesisByCanonicalId, semanticParticipants, bundle) {
912
+ const itemAuthority = scopedReferenceAuthority(bundle, evidenceIds, semanticParticipants);
913
+ const evidenceSet = new Set(evidenceIds);
914
+ const timeline = createPocIdentityTimeline(bundle.context);
915
+ return segments.map((segment, index) => {
916
+ const segmentPath = `${path}[${index}]`;
917
+ if (segment.type === "text") return segment;
918
+ if (segment.type === "piece") {
919
+ if (!authority.pieces.has(segment.pieceId) || !pieceIdentity(timeline.before, segment.pieceId) && !pieceIdentity(timeline.after, segment.pieceId)) {
920
+ fail(segmentPath, "untyped_piece_reference", "Piece reference is not admitted by the frozen closure", [...authority.pieces]);
921
+ }
922
+ if (!itemAuthority.pieces.has(segment.pieceId)) {
923
+ fail(segmentPath, "item_unscoped_piece_reference", "Piece reference is not grounded by this item's target, cited evidence, or typed semantic binding", [...itemAuthority.pieces]);
924
+ }
925
+ return segment;
926
+ }
927
+ if (segment.type === "piece-kind") {
928
+ const type = { bishop: "b", king: "k", knight: "n", pawn: "p", queen: "q", rook: "r" }[segment.pieceKind];
929
+ const authorized = [...itemAuthority.pieces].some((pieceId) => {
930
+ const identity = pieceIdentity(timeline.before, pieceId) || pieceIdentity(timeline.after, pieceId);
931
+ return identity?.type === type && (segment.color === null || identity.color === segment.color);
932
+ });
933
+ if (!authorized) fail(segmentPath, "item_unscoped_piece_kind_reference", "Generic piece reference is not grounded by this item's authority", [...itemAuthority.pieces]);
934
+ return segment;
935
+ }
936
+ if (segment.type === "square") {
937
+ if (!SQUARES.includes(segment.square) || !authority.squares.has(segment.square)) {
938
+ fail(segmentPath, "untyped_square_reference", "Square reference is not admitted by the frozen closure", [...authority.squares]);
939
+ }
940
+ if (!itemAuthority.squares.has(segment.square)) {
941
+ fail(segmentPath, "item_unscoped_square_reference", "Square reference is not grounded by this item's target, cited evidence, or typed semantic binding", [...itemAuthority.squares]);
942
+ }
943
+ return segment;
944
+ }
945
+ if (segment.type === "move") {
946
+ const witnesses = itemAuthority.moves.get(`${segment.uci}:${segment.pieceId}:${segment.san}`);
947
+ if (!itemAuthority.moveIds.has(segment.uci) || !witnesses || ![...witnesses].some((id) => evidenceSet.has(id))) {
948
+ fail(segmentPath, "untyped_move_reference", "Move reference lacks an exact cited evidence witness", [...itemAuthority.moves.keys()]);
949
+ }
950
+ return { type: "move", uci: segment.uci, pieceId: segment.pieceId, san: segment.san, ...segment.label === void 0 ? {} : { label: segment.label } };
951
+ }
952
+ if (segment.type === "entity") {
953
+ const entityId = localToCanonical[segment.entityLocalId];
954
+ if (!entityId) fail(segmentPath, "unknown_local_entity", "Entity local reference is not declared by this proposal");
955
+ const hypothesis = hypothesisByCanonicalId.get(entityId);
956
+ if (!hypothesis || !hasEvidenceAssociation(evidenceIds, hypothesis.evidenceIds)) {
957
+ fail(segmentPath, "unrelated_semantic_evidence", "Entity segment must cite evidence associated with its canonical hypothesis");
958
+ }
959
+ return { type: "entity", entityId, ...segment.label === void 0 ? {} : { label: segment.label } };
960
+ }
961
+ const relation = relationByLocalId.get(segment.relationLocalId);
962
+ const fromEntityId = localToCanonical[segment.fromEntityLocalId];
963
+ const toEntityId = localToCanonical[segment.toEntityLocalId];
964
+ if (!relation || !fromEntityId || !toEntityId) fail(segmentPath, "dangling_local_relation", "Relation local reference is not declared by this proposal");
965
+ if (relation.fromHypothesisId !== fromEntityId || relation.toHypothesisId !== toEntityId) {
966
+ fail(segmentPath, "relation_endpoint_mismatch", "Relation segment endpoints do not match the canonical relation");
967
+ }
968
+ if (!hasEvidenceAssociation(evidenceIds, relation.evidenceIds)) {
969
+ fail(segmentPath, "unrelated_semantic_evidence", "Relation segment must cite evidence associated with its canonical relation");
970
+ }
971
+ return { type: "relation", relationId: relation.id, fromEntityId, toEntityId, ...segment.label === void 0 ? {} : { label: segment.label } };
972
+ });
973
+ }
974
+ function validateVariation(demonstration, bundle, path) {
975
+ const citedEvidence = new Set(demonstration.evidenceIds);
976
+ const witnesses = collectReasoningMoveWitnesses(
977
+ bundle.evidence.filter((record) => citedEvidence.has(record.id)),
978
+ bundle.context
979
+ );
980
+ const submitted = demonstration.moves.map((move) => `${move.uci}:${move.pieceId}:${move.san}`);
981
+ for (const key of submitted) if (!witnesses.some((witness) => `${witness.uci}:${witness.pieceId}:${witness.san}` === key)) {
982
+ fail(path, "variation_witness_missing", "Variation move lacks an exact cited evidence witness");
983
+ }
984
+ const starts = bundle.evidence.filter((record) => citedEvidence.has(record.id)).flatMap((record) => {
985
+ const replay = record.replay;
986
+ if (!replay) return [];
987
+ const start = replay.fen === bundle.context.fenBefore ? "before" : replay.fen === bundle.context.fenAfter ? "after" : null;
988
+ const moves = Array.isArray(replay.movesUci) ? replay.movesUci : Array.isArray(replay.moves) ? replay.moves : Array.isArray(replay.line) ? replay.line : typeof replay.move === "string" ? [replay.move] : [];
989
+ return start && moves.every((move) => typeof move === "string") ? [{ start, moves }] : [];
990
+ });
991
+ const submittedUci = demonstration.moves.map((move) => move.uci);
992
+ if (!starts.some((candidate) => candidate.start === demonstration.start && submittedUci.every((move, index) => candidate.moves[index] === move))) {
993
+ fail(path, "variation_sequence_not_grounded", "Variation must be an exact prefix of one cited replayable evidence line");
994
+ }
995
+ }
996
+ function assertCoverageEvidence(bundle, coverage) {
997
+ for (const [path, lane] of [["responseCoverage", coverage.responseCoverage], ["continuationCoverage", coverage.continuationCoverage]]) {
998
+ admittedEvidenceIds(bundle, lane.evidenceIds, `proposal.coverage.${path}.evidenceIds`);
999
+ }
1000
+ }
1001
+ function validateAndMaterializeCoverage(coverage, records, relations, localToCanonical, relationByLocalId, claims, demonstrations) {
1002
+ const omittedHypotheses = coverage.omittedHypotheses.map((item) => {
1003
+ const hypothesisId = localToCanonical[item.localId];
1004
+ if (!hypothesisId) fail("proposal.coverage.omittedHypotheses", "unknown_omitted_hypothesis", "Omitted hypothesis does not name a local hypothesis");
1005
+ return { hypothesisId, reason: item.reason };
1006
+ });
1007
+ const omittedRelations = coverage.omittedRelations.map((item) => {
1008
+ const relation = relationByLocalId.get(item.localId);
1009
+ if (!relation) fail("proposal.coverage.omittedRelations", "unknown_omitted_relation", "Omitted relation does not name a local relation");
1010
+ return { relationId: relation.id, reason: item.reason };
1011
+ });
1012
+ const presentedHypothesisIds = /* @__PURE__ */ new Set();
1013
+ const presentedRelationIds = /* @__PURE__ */ new Set();
1014
+ const visitSegments = (segments) => {
1015
+ for (const segment of segments) {
1016
+ if (segment.type === "entity") presentedHypothesisIds.add(segment.entityId);
1017
+ if (segment.type === "relation") {
1018
+ presentedRelationIds.add(segment.relationId);
1019
+ presentedHypothesisIds.add(segment.fromEntityId);
1020
+ presentedHypothesisIds.add(segment.toEntityId);
1021
+ }
1022
+ }
1023
+ };
1024
+ claims.forEach((claim) => {
1025
+ visitSegments(claim.content);
1026
+ claim.qualifications.forEach(visitSegments);
1027
+ });
1028
+ demonstrations.forEach((demonstration) => {
1029
+ if (demonstration.type === "conditional-route") visitSegments(demonstration.prerequisiteRefs);
1030
+ if (demonstration.type === "static-relationship") {
1031
+ presentedRelationIds.add(demonstration.relationId);
1032
+ presentedHypothesisIds.add(demonstration.fromEntityId);
1033
+ presentedHypothesisIds.add(demonstration.toEntityId);
1034
+ }
1035
+ });
1036
+ const omittedHypothesisIds = new Set(omittedHypotheses.map((item) => item.hypothesisId));
1037
+ const omittedRelationIds = new Set(omittedRelations.map((item) => item.relationId));
1038
+ for (const record of records) {
1039
+ if (!presentedHypothesisIds.has(record.id) && !omittedHypothesisIds.has(record.id)) {
1040
+ fail("proposal.coverage.omittedHypotheses", "uncommunicated_hypothesis", "Every emitted hypothesis must be typed-presented or explicitly omitted");
1041
+ }
1042
+ if (presentedHypothesisIds.has(record.id) && omittedHypothesisIds.has(record.id)) {
1043
+ fail("proposal.coverage.omittedHypotheses", "presented_and_omitted_hypothesis", "A hypothesis cannot be both presented and omitted");
1044
+ }
1045
+ }
1046
+ for (const relation of relations) {
1047
+ if (!presentedRelationIds.has(relation.id) && !omittedRelationIds.has(relation.id)) {
1048
+ fail("proposal.coverage.omittedRelations", "uncommunicated_relation", "Every emitted relation must be typed-presented or explicitly omitted");
1049
+ }
1050
+ if (presentedRelationIds.has(relation.id) && omittedRelationIds.has(relation.id)) {
1051
+ fail("proposal.coverage.omittedRelations", "presented_and_omitted_relation", "A relation cannot be both presented and omitted");
1052
+ }
1053
+ }
1054
+ return {
1055
+ responseCoverage: { ...coverage.responseCoverage, evidenceIds: [...coverage.responseCoverage.evidenceIds], unresolved: [...coverage.responseCoverage.unresolved] },
1056
+ continuationCoverage: { ...coverage.continuationCoverage, evidenceIds: [...coverage.continuationCoverage.evidenceIds], unresolved: [...coverage.continuationCoverage.unresolved] },
1057
+ unresolvedEvidenceObligations: coverage.unresolvedEvidenceObligations.map((item) => ({ ...item })),
1058
+ omittedHypothesisIds: omittedHypotheses,
1059
+ omittedRelationIds: omittedRelations
1060
+ };
1061
+ }
1062
+ function materializeDirectSynthesis(input) {
1063
+ const metadata = { arm: input.arm };
1064
+ try {
1065
+ if (input.arm !== "A1" && input.arm !== "B" && input.arm !== "B-prime") fail("arm", "invalid_arm", "Direct synthesis arm is invalid");
1066
+ validateAblationEvidenceClosureBundle(input.bundle);
1067
+ const sourceBundleHash = input.bundle.bundleHash;
1068
+ input = { ...input, bundle: projectAblationEvidenceForModel(input.bundle).bundle };
1069
+ const proposal = parseDirectSynthesisProposal(input.proposal);
1070
+ assertDistinctLocalIds(proposal);
1071
+ const authority = referenceAuthority(input.bundle);
1072
+ assertCoverageEvidence(input.bundle, proposal.coverage);
1073
+ const hypothesisIds = new Set(proposal.hypotheses.map((item) => item.localId));
1074
+ for (const [index, relation] of proposal.relations.entries()) {
1075
+ if (!hypothesisIds.has(relation.from) || !hypothesisIds.has(relation.to)) fail(`proposal.relations[${index}]`, "dangling_local_relation", "Relation endpoint does not name a local hypothesis");
1076
+ assertEvidenceSupportsMeaning(input.bundle, relation.evidenceIds, `proposal.relations[${index}].evidenceIds`, null);
1077
+ }
1078
+ for (const [index, hypothesis] of proposal.hypotheses.entries()) {
1079
+ assertEvidenceSupportsMeaning(input.bundle, hypothesis.evidenceIds, `proposal.hypotheses[${index}].evidenceIds`, hypothesis.proofStrength);
1080
+ if (hypothesis.entityType === "plan") assertEvidenceSupportsRouteMeaning(input.bundle, hypothesis.evidenceIds, `proposal.hypotheses[${index}].evidenceIds`);
1081
+ assertHypothesisReferenceAuthority(
1082
+ hypothesis,
1083
+ hypothesis.evidenceIds,
1084
+ scopedReferenceAuthority(input.bundle, hypothesis.evidenceIds),
1085
+ `proposal.hypotheses[${index}]`
1086
+ );
1087
+ for (const observationId of hypothesis.sourceObservationIds) {
1088
+ if (!input.bundle.referenceAllowlists.observationIds.includes(observationId)) fail(`proposal.hypotheses[${index}].sourceObservationIds`, "unknown_observation", "Source observation is outside the frozen closure");
1089
+ }
1090
+ }
1091
+ const observations = {
1092
+ schemaVersion: input.bundle.observations[0]?.schemaVersion || "conceptual-explanation-poc/57",
1093
+ contextHash: input.bundle.contextHash,
1094
+ observations: input.bundle.observations.map((observation) => ({ ...observation, salience: 1, salienceReasons: ["frozen-ablation-closure"], presentedToModel: true })),
1095
+ evidence: input.bundle.evidence,
1096
+ providers: [],
1097
+ limitations: [...input.bundle.coverage.limitations],
1098
+ saliencePolicy: "ablation-direct-frozen-closure/1"
1099
+ };
1100
+ const ledger = new HypothesisLedger(
1101
+ input.bundle.contextHash,
1102
+ observations,
1103
+ new Map(input.bundle.evidence.map((record) => [record.id, record])),
1104
+ proposal.hypotheses.length,
1105
+ input.bundle.context
1106
+ );
1107
+ const recorded = ledger.record(
1108
+ {
1109
+ hypotheses: proposal.hypotheses,
1110
+ relations: proposal.relations.map((relation) => {
1111
+ const withoutLocalId = { ...relation };
1112
+ Reflect.deleteProperty(withoutLocalId, "localId");
1113
+ return withoutLocalId;
1114
+ })
1115
+ },
1116
+ input.provenance || { provider: "knights-eye/ablation-direct", version: ABLATION_DIRECT_SYNTHESIS_VERSION, origin: "model" }
1117
+ );
1118
+ const evidenceById = new Map(input.bundle.evidence.map((record) => [record.id, record]));
1119
+ const observationById = new Map(input.bundle.observations.map((observation) => [observation.id, observation]));
1120
+ for (const [index, record] of recorded.records.entries()) {
1121
+ const policyIssues = validateHypothesisAcceptancePolicies(record, evidenceById);
1122
+ if (policyIssues.length) fail(`proposal.hypotheses[${index}]`, "acceptance_policy_rejected", "Direct hypothesis fails a registered production acceptance policy");
1123
+ const usesConditionalRouteAffordance = record.sourceObservationIds.some((id) => observationById.get(id)?.observationType === "conditional-route-affordance");
1124
+ if (usesConditionalRouteAffordance && !record.evidenceIds.some((id) => {
1125
+ const evidence = evidenceById.get(id);
1126
+ return Boolean(evidence && licensesBoundedRouteRelevance(effectiveLicensesForRecord(evidence)));
1127
+ })) {
1128
+ fail(`proposal.hypotheses[${index}].evidenceIds`, "underlicensed_route_meaning", "Hypotheses sourced from conditional-route affordances require separate bounded route-relevance evidence");
1129
+ }
1130
+ }
1131
+ const relationByLocalId = new Map(proposal.relations.map((relation, index) => [relation.localId, recorded.relations[index]]));
1132
+ const hypothesisByCanonicalId = new Map(recorded.records.map((record) => [record.id, record]));
1133
+ const hypothesesByLocalId = new Map(proposal.hypotheses.map((hypothesis) => [hypothesis.localId, hypothesis]));
1134
+ const relationsByLocalId = new Map(proposal.relations.map((relation) => [relation.localId, relation]));
1135
+ const claimIds = /* @__PURE__ */ new Set();
1136
+ const claims = proposal.claims.map((claim, index) => {
1137
+ if (claimIds.has(claim.localId)) fail(`proposal.claims[${index}].localId`, "duplicate_local_id", "Claim local ID is duplicated");
1138
+ claimIds.add(claim.localId);
1139
+ assertEvidenceSupportsClaim(input.bundle, claim.evidenceIds, `proposal.claims[${index}].evidenceIds`, claim.kind, claim.proofStrength);
1140
+ const semanticParticipants = semanticParticipantsForSegments([...claim.content, ...claim.qualifications.flat()], hypothesesByLocalId, relationsByLocalId);
1141
+ const content = remapSegments(claim.content, `proposal.claims[${index}].content`, claim.evidenceIds, authority, recorded.localToHypothesisIds, relationByLocalId, hypothesisByCanonicalId, semanticParticipants, input.bundle);
1142
+ const qualifications = claim.qualifications.map((segments, qualificationIndex) => remapSegments(segments, `proposal.claims[${index}].qualifications[${qualificationIndex}]`, claim.evidenceIds, authority, recorded.localToHypothesisIds, relationByLocalId, hypothesisByCanonicalId, semanticParticipants, input.bundle));
1143
+ return { id: `direct-claim:${stableHash({ contextHash: input.bundle.contextHash, kind: claim.kind, content, evidenceIds: claim.evidenceIds, qualifications })}`, kind: claim.kind, content, proofStrength: claim.proofStrength, evidenceIds: [...claim.evidenceIds], qualifications };
1144
+ });
1145
+ const demonstrationIds = /* @__PURE__ */ new Set();
1146
+ const demonstrations = (proposal.demonstrations || []).map((demonstration, index) => {
1147
+ if (demonstrationIds.has(demonstration.localId)) fail(`proposal.demonstrations[${index}].localId`, "duplicate_local_id", "Demonstration local ID is duplicated");
1148
+ demonstrationIds.add(demonstration.localId);
1149
+ if (demonstration.type === "legal-variation") {
1150
+ admittedEvidenceIds(input.bundle, demonstration.evidenceIds, `proposal.demonstrations[${index}].evidenceIds`);
1151
+ validateVariation(demonstration, input.bundle, `proposal.demonstrations[${index}].moves`);
1152
+ return { id: `direct-demonstration:${stableHash({ contextHash: input.bundle.contextHash, type: demonstration.type, start: demonstration.start, moves: demonstration.moves, evidenceIds: demonstration.evidenceIds })}`, type: demonstration.type, start: demonstration.start, moves: demonstration.moves.map((move) => ({ ...move })), label: demonstration.label, evidenceIds: [...demonstration.evidenceIds] };
1153
+ }
1154
+ if (demonstration.type === "static-relationship") {
1155
+ assertEvidenceSupportsMeaning(input.bundle, demonstration.evidenceIds, `proposal.demonstrations[${index}].evidenceIds`, null);
1156
+ const relation = relationByLocalId.get(demonstration.relationLocalId);
1157
+ const fromEntityId = recorded.localToHypothesisIds[demonstration.fromEntityLocalId];
1158
+ const toEntityId = recorded.localToHypothesisIds[demonstration.toEntityLocalId];
1159
+ if (!relation || !fromEntityId || !toEntityId) fail(`proposal.demonstrations[${index}]`, "dangling_local_relation", "Static relationship does not name direct local records");
1160
+ if (relation.fromHypothesisId !== fromEntityId || relation.toHypothesisId !== toEntityId) fail(`proposal.demonstrations[${index}]`, "relation_endpoint_mismatch", "Static relationship endpoints do not match the canonical relation");
1161
+ if (!hasEvidenceAssociation(demonstration.evidenceIds, relation.evidenceIds)) fail(`proposal.demonstrations[${index}].evidenceIds`, "unrelated_semantic_evidence", "Static relationship must cite evidence associated with its canonical relation");
1162
+ return { id: `direct-demonstration:${stableHash({ contextHash: input.bundle.contextHash, type: demonstration.type, relationId: relation.id, fromEntityId, toEntityId, evidenceIds: demonstration.evidenceIds })}`, type: demonstration.type, relationId: relation.id, fromEntityId, toEntityId, relationType: relation.relationType, label: demonstration.label, evidenceIds: [...demonstration.evidenceIds] };
1163
+ }
1164
+ assertEvidenceSupportsRouteMeaning(input.bundle, demonstration.evidenceIds, `proposal.demonstrations[${index}].evidenceIds`);
1165
+ const routeAuthority = scopedReferenceAuthority(input.bundle, demonstration.evidenceIds, semanticParticipantsForSegments(demonstration.prerequisiteRefs, hypothesesByLocalId, relationsByLocalId));
1166
+ if (!routeAuthority.pieces.has(demonstration.pieceId) || demonstration.waypoints.some((square) => !routeAuthority.squares.has(square))) {
1167
+ fail(`proposal.demonstrations[${index}]`, "untyped_route_reference", "Route references are outside the frozen closure");
1168
+ }
1169
+ const prerequisiteRefs = remapSegments(demonstration.prerequisiteRefs, `proposal.demonstrations[${index}].prerequisiteRefs`, demonstration.evidenceIds, authority, recorded.localToHypothesisIds, relationByLocalId, hypothesisByCanonicalId, semanticParticipantsForSegments(demonstration.prerequisiteRefs, hypothesesByLocalId, relationsByLocalId), input.bundle);
1170
+ return { id: `direct-demonstration:${stableHash({ contextHash: input.bundle.contextHash, type: demonstration.type, pieceId: demonstration.pieceId, waypoints: demonstration.waypoints, prerequisiteRefs, evidenceIds: demonstration.evidenceIds })}`, type: demonstration.type, pieceId: demonstration.pieceId, waypoints: [...demonstration.waypoints], prerequisiteRefs, label: demonstration.label, evidenceIds: [...demonstration.evidenceIds] };
1171
+ });
1172
+ const coverage = validateAndMaterializeCoverage(proposal.coverage, recorded.records, recorded.relations, recorded.localToHypothesisIds, relationByLocalId, claims, demonstrations);
1173
+ return {
1174
+ ok: true,
1175
+ metadata,
1176
+ artifact: {
1177
+ schemaVersion: ABLATION_DIRECT_SYNTHESIS_VERSION,
1178
+ contextHash: input.bundle.contextHash,
1179
+ bundleHash: sourceBundleHash,
1180
+ hypotheses: recorded.records.map((record) => {
1181
+ const withoutLocalId = { ...record };
1182
+ Reflect.deleteProperty(withoutLocalId, "localId");
1183
+ return withoutLocalId;
1184
+ }),
1185
+ relations: recorded.relations,
1186
+ claims,
1187
+ demonstrations,
1188
+ coverage,
1189
+ admission: "pre-checkpoint-proposed",
1190
+ productSupport: "not-a-validated-graph-checkpoint-or-product-result",
1191
+ limitations: [...proposal.limitations],
1192
+ riskProfile: { level: proposal.riskProfile.level, reasons: [...proposal.riskProfile.reasons] }
1193
+ }
1194
+ };
1195
+ } catch (error) {
1196
+ const issue = error instanceof AdmissionFailure ? error.issue : { path: "proposal", code: "production_admission_failure", message: "Direct synthesis failed production admission", permittedReferences: [] };
1197
+ return { ok: false, metadata, code: "direct-synthesis-rejected", issues: [issue] };
1198
+ }
1199
+ }
1200
+
1201
+ // src/chess-reasoning/ablation-transport-correction.ts
1202
+ var AblationTransportCorrectionError = class extends Error {
1203
+ code = "transport-correction-outside-validator-paths";
1204
+ constructor(message) {
1205
+ super(message);
1206
+ this.name = "AblationTransportCorrectionError";
1207
+ }
1208
+ };
1209
+ function sameRecord(left, right) {
1210
+ return stableJson(left) === stableJson(right);
1211
+ }
1212
+ function transportCorrectionPath(issue) {
1213
+ if (!(/* @__PURE__ */ new Set(["unknown_evidence", "unknown_local_entity", "unknown_local_relation", "invalid_piece_form", "raw_chess_reference"])).has(issue.code)) return null;
1214
+ const tokens = [...issue.path.matchAll(/(?:^|\.)([A-Za-z_][A-Za-z0-9_]*)|\[(\d+)\]/g)].map((match) => match[1] || Number(match[2]));
1215
+ if (tokens[0] !== "proposal" || tokens.length < 3 || tokens.some((token) => typeof token === "string" && token === "__proto__")) return null;
1216
+ const leaf = tokens.at(-1);
1217
+ if (issue.code === "raw_chess_reference") {
1218
+ const [proposal, claims, claimIndex, qualifications, qualificationIndex, segmentIndex, text] = tokens;
1219
+ return proposal === "proposal" && claims === "claims" && typeof claimIndex === "number" && qualifications === "qualifications" && typeof qualificationIndex === "number" && typeof segmentIndex === "number" && text === "text" && tokens.length === 7 ? tokens : null;
1220
+ }
1221
+ if (!["evidenceIds", "entityLocalId", "relationLocalId", "form"].includes(leaf)) return null;
1222
+ if (issue.code === "unknown_evidence" && leaf !== "evidenceIds") return null;
1223
+ if (issue.code === "unknown_local_entity" && leaf !== "entityLocalId" || issue.code === "unknown_local_relation" && leaf !== "relationLocalId" || issue.code === "invalid_piece_form" && leaf !== "form") return null;
1224
+ return tokens;
1225
+ }
1226
+ function deleteExactPath(value, path) {
1227
+ let cursor = value;
1228
+ for (const token of path.slice(1, -1)) {
1229
+ if (typeof token === "number") {
1230
+ if (!Array.isArray(cursor) || !Object.prototype.hasOwnProperty.call(cursor, token)) throw new AblationTransportCorrectionError("Transport correction issue path is not an exact existing array path");
1231
+ cursor = cursor[token];
1232
+ } else {
1233
+ if (!cursor || typeof cursor !== "object" || Array.isArray(cursor) || !Object.prototype.hasOwnProperty.call(cursor, token)) throw new AblationTransportCorrectionError("Transport correction issue path is not an exact existing object path");
1234
+ cursor = cursor[token];
1235
+ }
1236
+ }
1237
+ const leaf = path.at(-1);
1238
+ if (typeof leaf !== "string" || !cursor || typeof cursor !== "object" || Array.isArray(cursor) || !Object.prototype.hasOwnProperty.call(cursor, leaf)) {
1239
+ throw new AblationTransportCorrectionError("Transport correction issue path is too broad or absent");
1240
+ }
1241
+ delete cursor[leaf];
1242
+ }
1243
+ function isTransportCorrectableDirectSynthesisIssues(issues) {
1244
+ return issues.length > 0 && issues.every((issue) => transportCorrectionPath(issue) !== null);
1245
+ }
1246
+ function assertTransportOnlyDirectCorrection(originalProposal, correctedProposal, issues) {
1247
+ const paths = issues.map(transportCorrectionPath);
1248
+ if (!paths.length || paths.some((path) => path === null)) throw new AblationTransportCorrectionError("Transport correction does not have a narrow validator-authorized path");
1249
+ if (!originalProposal || typeof originalProposal !== "object" || Array.isArray(originalProposal) || !correctedProposal || typeof correctedProposal !== "object" || Array.isArray(correctedProposal)) {
1250
+ throw new AblationTransportCorrectionError("Transport correction requires complete object proposals");
1251
+ }
1252
+ for (const collection of ["hypotheses", "relations", "claims", "demonstrations"]) {
1253
+ const before2 = originalProposal[collection];
1254
+ const after2 = correctedProposal[collection];
1255
+ if (!Array.isArray(before2) || !Array.isArray(after2) || before2.length !== after2.length) throw new AblationTransportCorrectionError("Transport correction changed proposal item cardinality");
1256
+ for (let index = 0; index < before2.length; index += 1) {
1257
+ const beforeId = before2[index] && typeof before2[index] === "object" ? before2[index].localId : void 0;
1258
+ const afterId = after2[index] && typeof after2[index] === "object" ? after2[index].localId : void 0;
1259
+ if (beforeId !== afterId) throw new AblationTransportCorrectionError("Transport correction changed a proposal item identity");
1260
+ }
1261
+ }
1262
+ const before = structuredClone(originalProposal);
1263
+ const after = structuredClone(correctedProposal);
1264
+ for (const path of paths) {
1265
+ deleteExactPath(before, path);
1266
+ deleteExactPath(after, path);
1267
+ }
1268
+ if (!sameRecord(before, after)) throw new AblationTransportCorrectionError("Transport correction changed semantic content outside validator-authorized paths");
1269
+ }
1270
+
1271
+ // src/chess-reasoning/ablation-adaptive-runtime.ts
1272
+ import { Output, generateText, jsonSchema } from "ai";
1273
+ var ABLATION_ADAPTIVE_RUNTIME_VERSION = "architecture-ablation-adaptive-runtime/2";
1274
+ var ABLATION_B_SYSTEM = `You are Knight's Eye in adaptive direct arm B. You may use only the supplied bounded fact and probe tools to acquire evidence about the selected move. Work iteratively, stop as soon as the available evidence is sufficient, and do not infer purpose, safety, forcedness, or a plan merely from a legal move. The verbatim user question is authoritative. You receive no later game history, evaluator answer keys, graph, critic, review, checkpoint, or render state.`;
1275
+ var ABLATION_B_DIRECT_SYSTEM = `You are Knight's Eye in adaptive direct arm B. Return exactly one object matching the direct-synthesis schema over the frozen evidence closure. This is a pre-checkpoint proposal, not a supported product answer. Cite only allowed evidence and observations. Evidence licenses are strict ceilings: legal sequence evidence establishes legality and identity, and bounded engine evidence establishes only the recorded bounded line, score, comparison, or response coverage. Do not claim intent, a forced plan, or strategic relevance unless the evidence itself licenses the bounded claim.`;
1276
+ var ABLATION_B_PRIME_CRITIC_SYSTEM = `You are the single bounded semantic reconsideration for Knight's Eye architecture-ablation arm B-prime. You have no tools and may not acquire evidence. Given a frozen direct proposal, explicit generic trigger values, and the same frozen evidence closure, decide whether the proposal can be retained or needs one corrected replacement. A correction may only use existing IDs and evidence licenses; it may narrow, qualify, or remove unsupported meaning but may not add evidence, broaden authority, change the user question, or invoke another critic. Return exactly the required object.`;
1277
+ var ABLATION_B_PRIME_TRIGGER_VALUES = Object.freeze([
1278
+ "claim.forced-best-unique-safe-winning-principal-purpose",
1279
+ "coverage.requested-defense-or-continuation-incomplete",
1280
+ "evidence.conflict",
1281
+ "claim.sacrifice-or-long-multistep",
1282
+ "plan.legal-affordance-only",
1283
+ "model.high-uncertainty",
1284
+ "validation.semantic-reconsideration-required"
1285
+ ]);
1286
+ var AdaptiveAblationPreconditionError = class extends Error {
1287
+ code = "starting-bundle-must-be-original";
1288
+ constructor() {
1289
+ super("Adaptive ablation B/B-prime must start from an original initial-exact evidence bundle");
1290
+ this.name = "AdaptiveAblationPreconditionError";
1291
+ }
1292
+ };
1293
+ var CRITIC_SCHEMA = {
1294
+ type: "object",
1295
+ additionalProperties: false,
1296
+ required: ["schemaVersion", "decision", "rationale"],
1297
+ properties: {
1298
+ schemaVersion: { const: ABLATION_ADAPTIVE_RUNTIME_VERSION },
1299
+ decision: { enum: ["retain", "replace"] },
1300
+ rationale: { type: "string", minLength: 1, maxLength: 2e3 },
1301
+ replacement: DIRECT_SYNTHESIS_PROPOSAL_JSON_SCHEMA
1302
+ }
1303
+ };
1304
+ var PRESEMANTIC_TOOLS = /* @__PURE__ */ new Set([
1305
+ "inspect_position",
1306
+ "analyze_move",
1307
+ "explore_continuations",
1308
+ "compare_moves",
1309
+ "enumerate_defenses",
1310
+ "test_line"
1311
+ ]);
1312
+ var FORBIDDEN_ADAPTIVE_TELEMETRY_KEYS = /* @__PURE__ */ new Set([
1313
+ "evaluatorAnchor",
1314
+ "evaluatorAnchors",
1315
+ "idealProse",
1316
+ "answerKey",
1317
+ "laterMoves"
1318
+ ]);
1319
+ function bytes2(value) {
1320
+ return new TextEncoder().encode(typeof value === "string" ? value : JSON.stringify(value)).length;
1321
+ }
1322
+ function nonEmptyNonce(value) {
1323
+ if (!/^[A-Za-z0-9._:-]{1,128}$/.test(value)) throw new Error("Adaptive ablation calls require a bounded supplied benchmark nonce");
1324
+ return value;
1325
+ }
1326
+ function firstPrefix(nonce, body) {
1327
+ return `[Benchmark cache-isolation nonce: ${nonce}. Ignore this opaque identifier; it has no chess, workflow, or output meaning.]
1328
+
1329
+ ${body}`;
1330
+ }
1331
+ function sum(values) {
1332
+ return values.every((value) => value === null) ? null : values.reduce((total, value) => total + (value || 0), 0);
1333
+ }
1334
+ function sameRecord2(left, right) {
1335
+ return stableJson(left) === stableJson(right);
1336
+ }
1337
+ function assertNoEvaluatorTelemetryPayload(value, path = "adaptive loop telemetry") {
1338
+ if (Array.isArray(value)) {
1339
+ value.forEach((item, index) => assertNoEvaluatorTelemetryPayload(item, `${path}[${index}]`));
1340
+ return;
1341
+ }
1342
+ if (!value || typeof value !== "object") return;
1343
+ for (const [key, child] of Object.entries(value)) {
1344
+ if (FORBIDDEN_ADAPTIVE_TELEMETRY_KEYS.has(key)) throw new Error(`Adaptive loop telemetry contains evaluator-only payload at ${path}.${key}`);
1345
+ assertNoEvaluatorTelemetryPayload(child, `${path}.${key}`);
1346
+ }
1347
+ }
1348
+ function createAdaptiveAbortScope(external, maxWallTimeMs) {
1349
+ const controller = new AbortController();
1350
+ let stopped = null;
1351
+ const abortExternally = () => {
1352
+ if (stopped) return;
1353
+ stopped = "adaptive-aborted";
1354
+ controller.abort(new Error("Adaptive ablation episode cancelled"));
1355
+ };
1356
+ if (external?.aborted) abortExternally();
1357
+ else external?.addEventListener("abort", abortExternally, { once: true });
1358
+ const timer = setTimeout(() => {
1359
+ if (stopped) return;
1360
+ stopped = "adaptive-timeout";
1361
+ controller.abort(new Error("Adaptive ablation episode exceeded its wall-time budget"));
1362
+ }, maxWallTimeMs);
1363
+ return {
1364
+ signal: controller.signal,
1365
+ code: () => stopped,
1366
+ dispose: () => {
1367
+ clearTimeout(timer);
1368
+ external?.removeEventListener("abort", abortExternally);
1369
+ }
1370
+ };
1371
+ }
1372
+ function throwIfAdaptiveStopped(scope) {
1373
+ const code = scope.code();
1374
+ if (code) throw Object.assign(new Error("Adaptive ablation episode stopped"), { adaptiveAbortCode: code });
1375
+ }
1376
+ function adaptiveAbortCode(scope, error) {
1377
+ const explicit = error && typeof error === "object" ? error.adaptiveAbortCode : null;
1378
+ return explicit === "adaptive-timeout" || explicit === "adaptive-aborted" ? explicit : scope.code();
1379
+ }
1380
+ async function abortable(scope, work) {
1381
+ if (scope.signal.aborted) {
1382
+ void work.catch(() => void 0);
1383
+ throwIfAdaptiveStopped(scope);
1384
+ }
1385
+ return await new Promise((resolve, reject) => {
1386
+ const abort = () => reject(Object.assign(new Error("Adaptive ablation episode stopped"), { adaptiveAbortCode: scope.code() || "adaptive-aborted" }));
1387
+ scope.signal.addEventListener("abort", abort, { once: true });
1388
+ work.then(
1389
+ (value) => {
1390
+ scope.signal.removeEventListener("abort", abort);
1391
+ resolve(value);
1392
+ },
1393
+ (error) => {
1394
+ scope.signal.removeEventListener("abort", abort);
1395
+ reject(error);
1396
+ }
1397
+ );
1398
+ });
1399
+ }
1400
+ function deriveAblationBPrimeTriggers(input) {
1401
+ const triggers = /* @__PURE__ */ new Set();
1402
+ const claimText = input.artifact?.claims.flatMap((claim) => [
1403
+ ...claim.content.filter((segment) => segment.type === "text").map((segment) => segment.text),
1404
+ ...claim.qualifications.flatMap((qualification) => qualification.filter((segment) => segment.type === "text").map((segment) => segment.text))
1405
+ ]).join(" ").toLowerCase() || "";
1406
+ const riskReasons = input.artifact?.riskProfile.reasons.join(" ").toLowerCase() || "";
1407
+ if (/\b(forced|best|unique|safe|winning|principal purpose)\b/.test(claimText)) triggers.add("claim.forced-best-unique-safe-winning-principal-purpose");
1408
+ if (input.artifact && (input.artifact.coverage.responseCoverage.status !== "complete" || input.artifact.coverage.continuationCoverage.status !== "complete")) {
1409
+ triggers.add("coverage.requested-defense-or-continuation-incomplete");
1410
+ }
1411
+ if (input.artifact && input.artifact.coverage.unresolvedEvidenceObligations.length > 0 && /\b(always|only|must|cannot)\b/.test(claimText)) triggers.add("evidence.conflict");
1412
+ if (/\b(sacrifice|sac|long[- ]term|multi[- ]step)\b/.test(claimText)) triggers.add("claim.sacrifice-or-long-multistep");
1413
+ const planHypotheses = input.artifact?.hypotheses.filter((hypothesis) => hypothesis.entityType === "plan" || hypothesis.concepts.some((concept) => concept.startsWith("plan."))) || [];
1414
+ if (planHypotheses.length && input.artifact && !planHypotheses.some((hypothesis) => hypothesis.evidenceIds.some((id) => {
1415
+ const evidence = input.bundle.evidence.find((record) => record.id === id);
1416
+ return evidence ? effectiveLicensesForRecord(evidence).some((license) => license.startsWith("engine.bounded-")) : false;
1417
+ }))) {
1418
+ triggers.add("plan.legal-affordance-only");
1419
+ }
1420
+ if (input.artifact?.riskProfile.level === "high" || /\b(uncertain|unclear|unknown|insufficient)\b/.test(riskReasons)) triggers.add("model.high-uncertainty");
1421
+ if (input.initialIssues.length) triggers.add("validation.semantic-reconsideration-required");
1422
+ return [...triggers].sort();
1423
+ }
1424
+ function exactTriggers(values) {
1425
+ if (values.some((value) => !ABLATION_B_PRIME_TRIGGER_VALUES.includes(value))) throw new Error("Adaptive B-prime trigger policy returned an unsupported trigger");
1426
+ return [...new Set(values)].sort();
1427
+ }
1428
+ function normalizedDescriptors(values) {
1429
+ return [...values].map((value) => structuredClone(value)).sort((left, right) => left.name.localeCompare(right.name));
1430
+ }
1431
+ function validateLoopResult(original, result, limits, advertisedTools) {
1432
+ if (!Number.isInteger(result.modelCalls) || result.modelCalls < 0 || result.modelCalls > limits.maxModelSteps || !Array.isArray(result.rounds) || !Array.isArray(result.failedToolCalls) || result.rounds.length + result.failedToolCalls.length > limits.maxToolCalls) {
1433
+ throw new Error("Adaptive evidence loop exceeded its model or tool budget");
1434
+ }
1435
+ if (!result.coverage || !result.stopping?.rationale?.trim() || !Array.isArray(result.stopping.unusedRelevantTools) || !["model-finished", "tool-budget-exhausted", "probe-budget-exhausted", "model-decision-budget-exhausted"].includes(result.stopping.reason)) {
1436
+ throw new Error("Adaptive evidence loop omitted explicit stopping telemetry");
1437
+ }
1438
+ if (!Array.isArray(result.coverage.covered) || !Array.isArray(result.coverage.omitted) || !Array.isArray(result.coverage.unavailable) || !Array.isArray(result.coverage.limitations)) {
1439
+ throw new Error("Adaptive evidence loop omitted explicit coverage telemetry");
1440
+ }
1441
+ if (!Array.isArray(result.saliencePresentedFactIds) || result.saliencePresentedFactIds.some((id) => typeof id !== "string" || !id.trim())) throw new Error("Adaptive evidence loop omitted salience membership");
1442
+ const descriptors = normalizedDescriptors(result.availableTools);
1443
+ if (sameRecord2(descriptors, normalizedDescriptors(advertisedTools)) === false) throw new Error("Adaptive evidence loop changed the advertised tool set");
1444
+ const descriptorByName = new Map(descriptors.map((item) => [item.name, item]));
1445
+ const calls = /* @__PURE__ */ new Set();
1446
+ const attempts = /* @__PURE__ */ new Set();
1447
+ let probes = 0;
1448
+ for (const round of result.rounds) {
1449
+ if (!Number.isInteger(round.attempt) || round.attempt < 1 || attempts.has(round.attempt) || !round.callId?.trim() || calls.has(round.callId) || !round.requestId?.trim() || !PRESEMANTIC_TOOLS.has(round.tool)) {
1450
+ throw new Error("Adaptive evidence loop returned an invalid tool round");
1451
+ }
1452
+ attempts.add(round.attempt);
1453
+ calls.add(round.callId);
1454
+ assertNoEvaluatorTelemetryPayload(round.input, `adaptive tool round ${round.callId}.input`);
1455
+ assertNoEvaluatorTelemetryPayload(round.result, `adaptive tool round ${round.callId}.result`);
1456
+ if (!descriptorByName.has(round.tool) || round.result.schemaVersion !== REASONING_POC_VERSION || round.result.callId !== round.callId || round.result.tool !== round.tool || round.result.contextHash !== original.contextHash) throw new Error("Adaptive evidence loop returned a cross-context or unadvertised tool result");
1457
+ if (round.tool !== "inspect_position" && round.tool !== "analyze_move") probes += 1;
1458
+ if (!round.selectionRationale?.trim() || !round.result || !Array.isArray(round.result.evidence)) throw new Error("Adaptive evidence loop round lacks its model-owned selection rationale");
1459
+ }
1460
+ for (const failed of result.failedToolCalls) {
1461
+ if (!Number.isInteger(failed.attempt) || failed.attempt < 1 || attempts.has(failed.attempt) || !failed.callId?.trim() || calls.has(failed.callId) || !failed.requestId?.trim() || !PRESEMANTIC_TOOLS.has(failed.tool) || !descriptorByName.has(failed.tool) || !failed.selectionRationale?.trim() || !failed.input || typeof failed.input !== "object" || Array.isArray(failed.input) || failed.failureCode !== "tool-execution-failed") {
1462
+ throw new Error("Adaptive evidence loop returned malformed failed-tool telemetry");
1463
+ }
1464
+ attempts.add(failed.attempt);
1465
+ calls.add(failed.callId);
1466
+ assertNoEvaluatorTelemetryPayload(failed.input, `adaptive failed tool ${failed.callId}.input`);
1467
+ if (failed.tool !== "inspect_position" && failed.tool !== "analyze_move") probes += 1;
1468
+ }
1469
+ if (probes > limits.maxProbeCalls) throw new Error("Adaptive evidence loop exceeded its probe budget");
1470
+ if (result.stopping.unusedRelevantTools.some((tool) => !descriptorByName.has(tool) || result.rounds.some((round) => round.tool === tool) || result.failedToolCalls.some((failed) => failed.tool === tool))) {
1471
+ throw new Error("Adaptive evidence loop reported invalid unused tools");
1472
+ }
1473
+ const attemptedToolCalls = result.rounds.length + result.failedToolCalls.length;
1474
+ if (result.stopping.reason === "tool-budget-exhausted" && attemptedToolCalls !== limits.maxToolCalls || result.stopping.reason === "model-decision-budget-exhausted" && result.modelCalls !== limits.maxModelSteps || result.stopping.reason === "probe-budget-exhausted" && (probes < limits.maxProbeCalls || descriptors.some((descriptor) => descriptor.name === "inspect_position" || descriptor.name === "analyze_move"))) {
1475
+ throw new Error("Adaptive evidence loop stopping reason does not match its recorded budget state");
1476
+ }
1477
+ const modelFacingIds = new Set(projectAblationEvidenceForModel(original).visibleEvidenceIds);
1478
+ for (const round of result.rounds) for (const evidence of round.result.evidence) modelFacingIds.add(evidence.id);
1479
+ if (result.saliencePresentedFactIds.some((id) => !modelFacingIds.has(id))) throw new Error("Adaptive evidence loop presented evidence that was never available to the model");
1480
+ return descriptors;
1481
+ }
1482
+ function enrichedBundle(original, result) {
1483
+ const additions = result.rounds.flatMap((round) => round.result.evidence);
1484
+ if (!additions.length) return original;
1485
+ const allEvidence = [...original.evidence, ...additions];
1486
+ const witnesses = collectReasoningMoveWitnesses(allEvidence, original.context);
1487
+ const addedReferences = witnesses.flatMap((witness) => [
1488
+ { domain: "move", id: witness.uci },
1489
+ { domain: "piece", id: witness.pieceId }
1490
+ ]);
1491
+ const oldReferences = original.referenceAllowlists.semanticReferences;
1492
+ const references = [...new Map([...oldReferences, ...addedReferences].map((value) => [`${value.domain}:${value.id}`, value])).values()];
1493
+ return enrichAblationEvidenceClosureBundle(original, {
1494
+ observations: [...result.addedObservations || []],
1495
+ evidence: additions,
1496
+ coverage: mergedCoverage(original.coverage, result.coverage),
1497
+ referenceAllowlists: {
1498
+ evidenceIds: allEvidence.map((record) => record.id),
1499
+ observationIds: [...original.observations, ...result.addedObservations || []].map((observation) => observation.id),
1500
+ toolNames: [.../* @__PURE__ */ new Set([...original.referenceAllowlists.toolNames, ...result.rounds.map((round) => round.tool)])].sort(),
1501
+ semanticReferences: references,
1502
+ moveWitnesses: witnesses
1503
+ }
1504
+ });
1505
+ }
1506
+ function mergedCoverage(original, acquired) {
1507
+ const union = (items, key) => [...new Map(items.map((item) => [key(item), item])).values()];
1508
+ const omitted = union([...original.omitted, ...acquired.omitted], (item) => `${item.domain}:${item.id}`).sort((left, right) => `${left.domain}:${left.id}`.localeCompare(`${right.domain}:${right.id}`));
1509
+ const unavailable = union([...original.unavailable, ...acquired.unavailable], (item) => item.id).sort((left, right) => left.id.localeCompare(right.id));
1510
+ return {
1511
+ // An acquisition pass can add coverage but cannot erase inherited scope
1512
+ // limits or turn an incomplete starting cell into an exhaustive closure.
1513
+ complete: original.complete && acquired.complete && !omitted.length && !unavailable.length,
1514
+ covered: [.../* @__PURE__ */ new Set([...original.covered, ...acquired.covered])].sort(),
1515
+ omitted,
1516
+ unavailable,
1517
+ limitations: [.../* @__PURE__ */ new Set([...original.limitations, ...acquired.limitations])].sort()
1518
+ };
1519
+ }
1520
+ function probeTelemetry(bundle, descriptors, result, artifact, diagnostics, limits) {
1521
+ const modelView = projectAblationEvidenceForModel(bundle);
1522
+ const modelBundle = modelView.bundle;
1523
+ const hypothesisIdsForEvidence = (evidenceIds) => artifact ? artifact.hypotheses.filter((hypothesis) => hypothesis.evidenceIds.some((id) => evidenceIds.includes(id))).map((hypothesis) => hypothesis.id).sort() : [];
1524
+ const priorEvidenceIds = new Set(modelView.visibleEvidenceIds.filter((id) => bundle.lineage.kind !== "enriched" || !bundle.lineage.acquiredEvidenceIds.includes(id)));
1525
+ const beforeProbeEvidenceIds = new Set(priorEvidenceIds);
1526
+ const effectForRound = (round, evidenceIds, hypotheses, hypothesesWithCompleteBasis) => {
1527
+ if (!evidenceIds.length || !hypotheses.length) return "no-change";
1528
+ if (round.result.support === "unsupported") return "rejected";
1529
+ const complete = artifact.hypotheses.filter((hypothesis) => hypothesesWithCompleteBasis.includes(hypothesis.id));
1530
+ return complete.some((hypothesis) => hypothesis.evidenceIds.every((id) => !beforeProbeEvidenceIds.has(id))) ? "materially-changed" : "supported";
1531
+ };
1532
+ const calls = [...result.rounds].sort((left, right) => left.attempt - right.attempt).map((round, callIndex) => {
1533
+ const evidenceIds = round.result.evidence.map((record) => record.id).filter((id) => modelBundle.referenceAllowlists.evidenceIds.includes(id));
1534
+ const candidateHypotheses = hypothesisIdsForEvidence(evidenceIds);
1535
+ const availableAfterThisRound = /* @__PURE__ */ new Set([...priorEvidenceIds, ...evidenceIds]);
1536
+ const hypothesesWithCompleteBasis = artifact ? artifact.hypotheses.filter((hypothesis) => candidateHypotheses.includes(hypothesis.id) && hypothesis.evidenceIds.every((id) => availableAfterThisRound.has(id))).map((hypothesis) => hypothesis.id).sort() : [];
1537
+ const hypotheses = candidateHypotheses;
1538
+ const admitted = evidenceIds.length > 0;
1539
+ const consumed = admitted && hypotheses.length > 0;
1540
+ const descriptor = descriptors.find((item) => item.name === round.tool);
1541
+ const lineRecord = round.result.evidence.find((record) => Array.isArray(record.data.lines));
1542
+ const coverage = lineRecord?.coverage || { complete: false, covered: [], unresolved: [] };
1543
+ const effect = artifact ? effectForRound(round, evidenceIds, hypotheses, hypothesesWithCompleteBasis) : "no-change";
1544
+ for (const evidenceId of evidenceIds) priorEvidenceIds.add(evidenceId);
1545
+ return { attempt: round.attempt, call: {
1546
+ callId: round.callId,
1547
+ requestId: round.requestId,
1548
+ tool: round.tool,
1549
+ request: { descriptor, input: structuredClone(round.input), selectionRationale: round.selectionRationale },
1550
+ target: { fen: bundle.context.fenAfter, historyThroughTargetHash: ablationHistoryThroughTargetHash(bundle.context) },
1551
+ permittedLimits: { maxToolCalls: limits.maxToolCalls, maxProbeCalls: limits.maxProbeCalls, engine: null },
1552
+ approval: {
1553
+ approved: true,
1554
+ budgetReason: "within-frozen-adaptive-budget",
1555
+ remainingToolCalls: Math.max(0, limits.maxToolCalls - callIndex - 1),
1556
+ remainingProbeCalls: Math.max(0, limits.maxProbeCalls - result.rounds.slice(0, callIndex + 1).filter((item) => item.tool !== "inspect_position" && item.tool !== "analyze_move").length)
1557
+ },
1558
+ status: { started: true, finished: "returned" },
1559
+ returned: { lines: Array.isArray(lineRecord?.data.lines) ? lineRecord.data.lines.length : 0, coverage },
1560
+ admission: { status: admitted ? "admitted" : "not-produced", reason: admitted ? "admitted-into-frozen-direct-closure" : "tool-returned-no-admissible-evidence" },
1561
+ admittedEvidence: evidenceIds.map((evidenceId) => ({ evidenceId, licenses: effectiveLicensesForRecord(modelBundle.evidence.find((record) => record.id === evidenceId)) })),
1562
+ presentation: { presentedToModel: admitted, reason: admitted ? "frozen-direct-submission-context" : "no-admitted-evidence" },
1563
+ semanticConsumption: { status: consumed ? "consumed" : "not-consumed", hypothesisIds: hypotheses },
1564
+ modelStatedRationale: round.modelStatedRationale,
1565
+ effect,
1566
+ hypothesisIds: hypotheses,
1567
+ usage: { ...round.usage, corrections: 0 }
1568
+ } };
1569
+ });
1570
+ for (const failed of result.failedToolCalls) {
1571
+ const descriptor = descriptors.find((item) => item.name === failed.tool);
1572
+ calls.push({ attempt: failed.attempt, call: {
1573
+ callId: failed.callId,
1574
+ requestId: failed.requestId,
1575
+ tool: failed.tool,
1576
+ request: { descriptor, input: structuredClone(failed.input), selectionRationale: failed.selectionRationale },
1577
+ target: { fen: bundle.context.fenAfter, historyThroughTargetHash: ablationHistoryThroughTargetHash(bundle.context) },
1578
+ permittedLimits: { maxToolCalls: limits.maxToolCalls, maxProbeCalls: limits.maxProbeCalls, engine: null },
1579
+ approval: { approved: true, budgetReason: "within-frozen-adaptive-budget", remainingToolCalls: Math.max(0, limits.maxToolCalls - failed.attempt), remainingProbeCalls: Math.max(0, limits.maxProbeCalls - result.rounds.filter((round) => round.attempt <= failed.attempt && round.tool !== "inspect_position" && round.tool !== "analyze_move").length) },
1580
+ status: { started: true, finished: "failed" },
1581
+ returned: null,
1582
+ admission: { status: "not-produced", reason: failed.failureCode },
1583
+ admittedEvidence: [],
1584
+ presentation: { presentedToModel: false, reason: failed.failureCode },
1585
+ semanticConsumption: { status: "not-reached", hypothesisIds: [] },
1586
+ modelStatedRationale: failed.modelStatedRationale,
1587
+ effect: "failure",
1588
+ hypothesisIds: [],
1589
+ usage: { ...failed.usage, corrections: 0 }
1590
+ } });
1591
+ }
1592
+ const orderedCalls = calls.sort((left, right) => left.attempt - right.attempt).map((item) => item.call);
1593
+ const modelDiagnostics = diagnostics.filter((item) => item.stage !== "B-evidence");
1594
+ const acquiredEvidenceIds = bundle.lineage.kind === "enriched" ? bundle.lineage.acquiredEvidenceIds : [];
1595
+ return createAblationProbeTelemetry(bundle, {
1596
+ beforeProbeEvidenceIds: modelView.visibleEvidenceIds.filter((id) => !acquiredEvidenceIds.includes(id)),
1597
+ postSaliencePresentedFactIds: [...result.saliencePresentedFactIds].filter((id) => modelView.visibleEvidenceIds.includes(id)),
1598
+ availableTools: [...descriptors],
1599
+ calledProbes: orderedCalls,
1600
+ missedAnchorAttributions: [],
1601
+ stopping: { rationale: result.stopping.rationale, unusedRelevantTools: result.stopping.unusedRelevantTools },
1602
+ usage: {
1603
+ modelCalls: result.modelCalls + modelDiagnostics.filter((item) => item.outcome !== "skipped").length,
1604
+ toolCalls: orderedCalls.length,
1605
+ // `result.usage` is the loop's complete evidence-decision accounting.
1606
+ // Round usage is only the tool execution view and must not replace it.
1607
+ inputTokens: sum([result.usage.inputTokens, ...modelDiagnostics.map((item) => item.inputTokens)]),
1608
+ outputTokens: sum([result.usage.outputTokens, ...modelDiagnostics.map((item) => item.outputTokens)]),
1609
+ latencyMs: sum([result.usage.latencyMs, ...modelDiagnostics.map((item) => item.latencyMs)]),
1610
+ cache: { hits: result.usage.cache.hits, misses: result.usage.cache.misses },
1611
+ cost: sum([result.usage.cost, ...modelDiagnostics.map((item) => item.cost)]),
1612
+ corrections: result.usage.corrections + modelDiagnostics.reduce((total, item) => total + item.correctionCount, 0)
1613
+ }
1614
+ });
1615
+ }
1616
+ function prepareAblationAdaptiveEvidenceForStagedReference(original, loop, evidenceTools, limits) {
1617
+ validateAblationEvidenceClosureBundle(original);
1618
+ if (original.lineage.kind !== "original") throw new AdaptiveAblationPreconditionError();
1619
+ const descriptors = validateLoopResult(original, loop, limits, evidenceTools);
1620
+ const bundle = enrichedBundle(original, loop);
1621
+ return Object.freeze({ bundle, telemetry: probeTelemetry(bundle, descriptors, loop, void 0, [], limits) });
1622
+ }
1623
+ function providerDiagnostic(stage, nonce, input) {
1624
+ return { stage, nonce, inputBytes: bytes2(input), outputBytes: null, latencyMs: null, inputTokens: null, outputTokens: null, cacheTokens: null, cost: null, correctionCount: 0, outcome: "failed", failureCode: null };
1625
+ }
1626
+ function abortedAfterValidLoop(scope, arm, bundle, descriptors, loop, diagnostics, options, triggers = []) {
1627
+ const code = scope.code();
1628
+ if (!code) throw new Error("Adaptive abort result requires a stopped episode");
1629
+ return {
1630
+ arm,
1631
+ ok: false,
1632
+ bundle,
1633
+ telemetry: probeTelemetry(bundle, descriptors, loop, void 0, diagnostics, options),
1634
+ triggers,
1635
+ diagnostics: [...diagnostics],
1636
+ failure: { code }
1637
+ };
1638
+ }
1639
+ function finishDiagnostic(diagnostic, result) {
1640
+ diagnostic.outputBytes = bytes2(result.output ?? result.text);
1641
+ const input = result.usage.inputTokens;
1642
+ const output = result.usage.outputTokens;
1643
+ diagnostic.inputTokens = typeof input === "number" ? input : input && typeof input === "object" && typeof input.total === "number" ? input.total : null;
1644
+ diagnostic.outputTokens = typeof output === "number" ? output : output && typeof output === "object" && typeof output.total === "number" ? output.total : null;
1645
+ diagnostic.latencyMs = result.steps.at(-1)?.performance.responseTimeMs ?? null;
1646
+ diagnostic.outcome = "succeeded";
1647
+ }
1648
+ async function directCall(options, abort, arm, bundle, nonce, stage, correction) {
1649
+ throwIfAdaptiveStopped(abort);
1650
+ const modelView = projectAblationEvidenceForModel(bundle);
1651
+ const modelFacingBundle = modelView.bundle;
1652
+ const prompt = correction ? JSON.stringify({ sourceBundleHash: modelView.sourceBundleHash, modelFacingEvidenceViewVersion: modelView.schemaVersion, modelFacingEvidenceViewHash: modelView.viewHash, bundle: modelFacingBundle, correction: { issues: correction, instruction: "Return a complete replacement. Fix only the listed transport/reference/schema paths; do not add evidence, observations, concepts, claims, relations, or demonstrations. For raw_chess_reference in a qualification text segment, retain the qualification's bounded meaning but replace only that raw text with a narrower generic text phrase that omits the unsupported concrete reference. Preserve all item IDs, evidence IDs, scope, and every other semantic association." } }) : JSON.stringify({ schemaVersion: ABLATION_ADAPTIVE_RUNTIME_VERSION, arm, sourceBundleHash: modelView.sourceBundleHash, modelFacingEvidenceViewVersion: modelView.schemaVersion, modelFacingEvidenceViewHash: modelView.viewHash, bundle: modelFacingBundle });
1653
+ const system = firstPrefix(nonce, ABLATION_B_DIRECT_SYSTEM);
1654
+ const diagnostic = providerDiagnostic(stage, nonce, { system, prompt, schema: DIRECT_SYNTHESIS_PROPOSAL_JSON_SCHEMA });
1655
+ const started = performance.now();
1656
+ try {
1657
+ const result = await abortable(abort, generateText({
1658
+ model: options.model,
1659
+ system,
1660
+ prompt,
1661
+ output: Output.object({ schema: jsonSchema(DIRECT_SYNTHESIS_PROPOSAL_JSON_SCHEMA), name: "knights_eye_ablation_adaptive_direct", description: "Pre-checkpoint direct synthesis proposal." }),
1662
+ abortSignal: abort.signal,
1663
+ maxOutputTokens: options.maxOutputTokens,
1664
+ maxRetries: 0,
1665
+ reasoning: options.reasoning || "provider-default",
1666
+ ...options.temperature === void 0 ? {} : { temperature: options.temperature }
1667
+ }));
1668
+ diagnostic.latencyMs = Math.round(performance.now() - started);
1669
+ finishDiagnostic(diagnostic, result);
1670
+ if (correction) diagnostic.correctionCount = 1;
1671
+ return { proposal: result.output, diagnostic };
1672
+ } catch (error) {
1673
+ diagnostic.latencyMs = Math.round(performance.now() - started);
1674
+ const code = adaptiveAbortCode(abort, error);
1675
+ diagnostic.outcome = code ? "aborted" : "failed";
1676
+ diagnostic.failureCode = code || "provider-or-structured-output";
1677
+ throw Object.assign(error instanceof Error ? error : new Error("Adaptive direct provider failure"), { adaptiveDiagnostic: diagnostic });
1678
+ }
1679
+ }
1680
+ function ensureUniqueNonce(used, options, stage) {
1681
+ const nonce = nonEmptyNonce(options.benchmarkNonceForCall(stage, used.size));
1682
+ if (used.has(nonce)) throw new Error("Every adaptive provider call requires a distinct benchmark nonce");
1683
+ used.add(nonce);
1684
+ return nonce;
1685
+ }
1686
+ function criticPayload(bundle, proposal, triggers, initialIssues) {
1687
+ const modelView = projectAblationEvidenceForModel(bundle);
1688
+ return {
1689
+ schemaVersion: ABLATION_ADAPTIVE_RUNTIME_VERSION,
1690
+ sourceBundleHash: modelView.sourceBundleHash,
1691
+ modelFacingEvidenceViewVersion: modelView.schemaVersion,
1692
+ modelFacingEvidenceViewHash: modelView.viewHash,
1693
+ bundle: modelView.bundle,
1694
+ proposal,
1695
+ triggers,
1696
+ validationIssues: initialIssues
1697
+ };
1698
+ }
1699
+ function assertCriticDecision(value) {
1700
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("B-prime critic returned no object");
1701
+ const record = value;
1702
+ if (record.schemaVersion !== ABLATION_ADAPTIVE_RUNTIME_VERSION || record.decision !== "retain" && record.decision !== "replace" || typeof record.rationale !== "string" || !record.rationale.trim()) throw new Error("B-prime critic returned an invalid decision");
1703
+ if (record.decision === "replace" && !("replacement" in record)) throw new Error("B-prime critic replacement is missing");
1704
+ if (record.decision === "retain" && "replacement" in record) throw new Error("B-prime critic retain decision cannot rewrite the proposal");
1705
+ }
1706
+ async function runAblationAdaptiveDirect(options, arm, original, signal) {
1707
+ if (arm !== "B" && arm !== "B-prime") throw new Error("Adaptive ablation arm must be B or B-prime");
1708
+ if (!Number.isInteger(options.maxToolCalls) || options.maxToolCalls < 0 || !Number.isInteger(options.maxProbeCalls) || options.maxProbeCalls < 0 || !Number.isInteger(options.maxModelSteps) || options.maxModelSteps < 1 || !Number.isInteger(options.maxOutputTokens) || options.maxOutputTokens < 1 || !Number.isInteger(options.maxWallTimeMs) || options.maxWallTimeMs < 1) throw new Error("Adaptive ablation runtime requires bounded positive budgets and a positive wall-time budget");
1709
+ validateAblationEvidenceClosureBundle(original);
1710
+ if (original.lineage.kind !== "original") throw new AdaptiveAblationPreconditionError();
1711
+ const abort = createAdaptiveAbortScope(signal, options.maxWallTimeMs);
1712
+ try {
1713
+ const diagnostics = [];
1714
+ const usedNonces = /* @__PURE__ */ new Set();
1715
+ const evidenceNonce = ensureUniqueNonce(usedNonces, options, "evidence");
1716
+ const originalModelView = projectAblationEvidenceForModel(original);
1717
+ const evidenceDiagnostic = providerDiagnostic("B-evidence", evidenceNonce, {
1718
+ system: firstPrefix(evidenceNonce, ABLATION_B_SYSTEM),
1719
+ sourceBundleHash: originalModelView.sourceBundleHash,
1720
+ modelFacingEvidenceViewVersion: originalModelView.schemaVersion,
1721
+ modelFacingEvidenceViewHash: originalModelView.viewHash,
1722
+ bundle: originalModelView.bundle
1723
+ });
1724
+ if (abort.code()) {
1725
+ evidenceDiagnostic.outcome = "aborted";
1726
+ evidenceDiagnostic.failureCode = abort.code();
1727
+ diagnostics.push(evidenceDiagnostic);
1728
+ const telemetry2 = createAblationProbeTelemetry(original, {
1729
+ beforeProbeEvidenceIds: [...originalModelView.visibleEvidenceIds],
1730
+ postSaliencePresentedFactIds: [...originalModelView.visibleEvidenceIds],
1731
+ availableTools: [],
1732
+ calledProbes: [],
1733
+ missedAnchorAttributions: [],
1734
+ stopping: { rationale: "Adaptive ablation stopped before evidence collection began.", unusedRelevantTools: [] },
1735
+ usage: { modelCalls: 0, toolCalls: 0, inputTokens: null, outputTokens: null, latencyMs: null, cache: { hits: 0, misses: 0 }, cost: null, corrections: 0 }
1736
+ });
1737
+ return { arm, ok: false, bundle: original, telemetry: telemetry2, triggers: [], diagnostics, failure: { code: abort.code() } };
1738
+ }
1739
+ let loop;
1740
+ let descriptors;
1741
+ let bundle = original;
1742
+ try {
1743
+ loop = await abortable(abort, options.evidenceLoop.run({
1744
+ arm,
1745
+ system: firstPrefix(evidenceNonce, ABLATION_B_SYSTEM),
1746
+ firstProviderVisiblePrefix: `[Benchmark cache-isolation nonce: ${evidenceNonce}. Ignore this opaque identifier; it has no chess, workflow, or output meaning.]`,
1747
+ nextProviderVisiblePrefix: () => {
1748
+ const nonce = ensureUniqueNonce(usedNonces, options, "evidence");
1749
+ return `[Benchmark cache-isolation nonce: ${nonce}. Ignore this opaque identifier; it has no chess, workflow, or output meaning.]`;
1750
+ },
1751
+ bundle: original,
1752
+ tools: options.evidenceTools,
1753
+ maxToolCalls: options.maxToolCalls,
1754
+ maxProbeCalls: options.maxProbeCalls,
1755
+ maxModelSteps: options.maxModelSteps,
1756
+ signal: abort.signal
1757
+ }));
1758
+ descriptors = validateLoopResult(original, loop, options, options.evidenceTools);
1759
+ bundle = enrichedBundle(original, loop);
1760
+ evidenceDiagnostic.outcome = "succeeded";
1761
+ evidenceDiagnostic.latencyMs = loop.usage.latencyMs;
1762
+ evidenceDiagnostic.inputTokens = loop.usage.inputTokens;
1763
+ evidenceDiagnostic.outputTokens = loop.usage.outputTokens;
1764
+ evidenceDiagnostic.cost = loop.usage.cost;
1765
+ } catch (error) {
1766
+ const code = adaptiveAbortCode(abort, error);
1767
+ evidenceDiagnostic.failureCode = code || "adaptive-evidence-loop-rejected";
1768
+ evidenceDiagnostic.outcome = code ? "aborted" : "failed";
1769
+ diagnostics.push(evidenceDiagnostic);
1770
+ const emptyLoop = { rounds: [], failedToolCalls: [], availableTools: [], saliencePresentedFactIds: [], coverage: original.coverage, stopping: { reason: "model-finished", rationale: "Adaptive evidence loop failed before a valid closure was available.", unusedRelevantTools: [] }, modelCalls: 0, usage: { inputTokens: null, outputTokens: null, latencyMs: null, cache: { hits: 0, misses: 0 }, cost: null, corrections: 0 } };
1771
+ const telemetry2 = createAblationProbeTelemetry(original, { beforeProbeEvidenceIds: [...originalModelView.visibleEvidenceIds], postSaliencePresentedFactIds: [...originalModelView.visibleEvidenceIds], availableTools: [], calledProbes: [], missedAnchorAttributions: [], stopping: { rationale: emptyLoop.stopping.rationale, unusedRelevantTools: emptyLoop.stopping.unusedRelevantTools }, usage: { modelCalls: 0, toolCalls: 0, inputTokens: null, outputTokens: null, latencyMs: null, cache: { hits: 0, misses: 0 }, cost: null, corrections: 0 } });
1772
+ return { arm, ok: false, bundle: original, telemetry: telemetry2, triggers: [], diagnostics, failure: { code: code || "adaptive-evidence-loop-rejected" } };
1773
+ }
1774
+ diagnostics.push(evidenceDiagnostic);
1775
+ if (abort.code()) return abortedAfterValidLoop(abort, arm, bundle, descriptors, loop, diagnostics, options);
1776
+ let proposal;
1777
+ let initialIssues = [];
1778
+ let artifact;
1779
+ let transportCorrectionAttempted = false;
1780
+ try {
1781
+ const direct = await directCall(options, abort, arm, bundle, ensureUniqueNonce(usedNonces, options, "direct"), "B-direct", null);
1782
+ diagnostics.push(direct.diagnostic);
1783
+ proposal = direct.proposal;
1784
+ const admission = materializeDirectSynthesis({ arm, bundle, proposal, provenance: { provider: `knights-eye/ablation-${arm}`, version: ABLATION_ADAPTIVE_RUNTIME_VERSION, origin: "model" } });
1785
+ if (admission.ok) artifact = admission.artifact;
1786
+ else initialIssues = admission.issues;
1787
+ } catch (error) {
1788
+ const diagnostic = error.adaptiveDiagnostic;
1789
+ if (diagnostic) diagnostics.push(diagnostic);
1790
+ const telemetry2 = probeTelemetry(bundle, descriptors, loop, void 0, diagnostics, options);
1791
+ const code = adaptiveAbortCode(abort, error);
1792
+ return code ? abortedAfterValidLoop(abort, arm, bundle, descriptors, loop, diagnostics, options) : { arm, ok: false, bundle, telemetry: telemetry2, triggers: [], diagnostics, failure: { code: "provider-or-structured-output" } };
1793
+ }
1794
+ if (abort.code()) return abortedAfterValidLoop(abort, arm, bundle, descriptors, loop, diagnostics, options);
1795
+ if (!artifact && isTransportCorrectableDirectSynthesisIssues(initialIssues)) {
1796
+ try {
1797
+ const corrected = await directCall(options, abort, arm, bundle, ensureUniqueNonce(usedNonces, options, "transport-correction"), "B-transport-correction", initialIssues);
1798
+ diagnostics.push(corrected.diagnostic);
1799
+ transportCorrectionAttempted = true;
1800
+ assertTransportOnlyDirectCorrection(proposal, corrected.proposal, initialIssues);
1801
+ proposal = corrected.proposal;
1802
+ const admission = materializeDirectSynthesis({ arm, bundle, proposal, provenance: { provider: `knights-eye/ablation-${arm}`, version: ABLATION_ADAPTIVE_RUNTIME_VERSION, origin: "model" } });
1803
+ if (admission.ok) artifact = admission.artifact;
1804
+ else {
1805
+ initialIssues = admission.issues;
1806
+ diagnostics[diagnostics.length - 1] = { ...diagnostics.at(-1), outcome: "failed", failureCode: "transport-correction-rejected" };
1807
+ }
1808
+ } catch (error) {
1809
+ const diagnostic = error.adaptiveDiagnostic;
1810
+ if (diagnostic) diagnostics.push(diagnostic);
1811
+ else if (diagnostics.at(-1)?.stage === "B-transport-correction") {
1812
+ diagnostics[diagnostics.length - 1] = { ...diagnostics.at(-1), outcome: "failed", failureCode: error instanceof AblationTransportCorrectionError ? error.code : "transport-correction-rejected" };
1813
+ }
1814
+ if (adaptiveAbortCode(abort, error)) return abortedAfterValidLoop(abort, arm, bundle, descriptors, loop, diagnostics, options);
1815
+ }
1816
+ }
1817
+ if (abort.code()) return abortedAfterValidLoop(abort, arm, bundle, descriptors, loop, diagnostics, options);
1818
+ let triggers = [];
1819
+ if (arm === "B-prime") {
1820
+ triggers = exactTriggers((options.triggerPolicy || deriveAblationBPrimeTriggers)({ bundle, proposal, artifact: artifact || null, initialIssues }));
1821
+ if (triggers.length && (artifact || initialIssues.length)) {
1822
+ const nonce = ensureUniqueNonce(usedNonces, options, "critic");
1823
+ const payload = criticPayload(bundle, proposal, triggers, initialIssues);
1824
+ const diagnostic = providerDiagnostic("B-prime-critic", nonce, { system: firstPrefix(nonce, ABLATION_B_PRIME_CRITIC_SYSTEM), payload, schema: CRITIC_SCHEMA });
1825
+ const started = performance.now();
1826
+ try {
1827
+ throwIfAdaptiveStopped(abort);
1828
+ const result = await abortable(abort, generateText({
1829
+ model: options.criticModel || options.model,
1830
+ system: firstPrefix(nonce, ABLATION_B_PRIME_CRITIC_SYSTEM),
1831
+ prompt: JSON.stringify(payload),
1832
+ output: Output.object({ schema: jsonSchema(CRITIC_SCHEMA), name: "knights_eye_ablation_b_prime_critic", description: "One bounded tool-free semantic reconsideration." }),
1833
+ abortSignal: abort.signal,
1834
+ maxOutputTokens: options.maxOutputTokens,
1835
+ maxRetries: 0,
1836
+ reasoning: options.criticReasoning || options.reasoning || "provider-default",
1837
+ ...options.temperature === void 0 ? {} : { temperature: options.temperature }
1838
+ }));
1839
+ diagnostic.latencyMs = Math.round(performance.now() - started);
1840
+ finishDiagnostic(diagnostic, result);
1841
+ assertCriticDecision(result.output);
1842
+ if (result.output.decision === "replace") {
1843
+ const reconsidered = materializeDirectSynthesis({ arm, bundle, proposal: result.output.replacement, provenance: { provider: "knights-eye/ablation-b-prime-critic", version: ABLATION_ADAPTIVE_RUNTIME_VERSION, origin: "model" } });
1844
+ if (!reconsidered.ok) {
1845
+ diagnostic.outcome = "failed";
1846
+ diagnostic.failureCode = "critic-rejected";
1847
+ artifact = void 0;
1848
+ initialIssues = reconsidered.issues;
1849
+ } else artifact = reconsidered.artifact;
1850
+ } else if (!artifact) {
1851
+ diagnostic.outcome = "failed";
1852
+ diagnostic.failureCode = "critic-rejected";
1853
+ }
1854
+ } catch (error) {
1855
+ diagnostic.latencyMs = Math.round(performance.now() - started);
1856
+ const code = adaptiveAbortCode(abort, error);
1857
+ diagnostic.outcome = code ? "aborted" : "failed";
1858
+ diagnostic.failureCode = code || "critic-rejected";
1859
+ artifact = void 0;
1860
+ }
1861
+ diagnostics.push(diagnostic);
1862
+ if (abort.code()) return abortedAfterValidLoop(abort, arm, bundle, descriptors, loop, diagnostics, options, triggers);
1863
+ } else {
1864
+ diagnostics.push({ ...providerDiagnostic("B-prime-critic", "skipped", {}), outcome: "skipped" });
1865
+ }
1866
+ }
1867
+ const telemetry = probeTelemetry(bundle, descriptors, loop, artifact, diagnostics, options);
1868
+ if (!artifact) {
1869
+ return { arm, ok: false, bundle, telemetry, triggers, diagnostics, failure: { code: transportCorrectionAttempted ? "transport-correction-rejected" : "direct-synthesis-rejected", issues: initialIssues } };
1870
+ }
1871
+ return { arm, ok: true, bundle, artifact, telemetry, triggers, diagnostics };
1872
+ } finally {
1873
+ abort.dispose();
1874
+ }
1875
+ }
1876
+
1877
+ // src/chess-reasoning/recorded-selected-classification.ts
1878
+ import { Chess } from "chess.js";
1879
+ function recordedSelectedClassification(context, line) {
1880
+ if (context.kind === "position" || !line || line.selectedAtStart || !Array.isArray(line.moves) || !Number.isInteger(line.selectedIndex) || line.selectedIndex < 0 || line.selectedIndex >= line.moves.length || line.selectedIndex !== context.historyUci.length || line.moves.length > 512 || line.startFen !== (context.historyStartFen ?? new Chess().fen())) return void 0;
1881
+ try {
1882
+ validateReasoningPositionContext(context);
1883
+ const selected = line.moves[line.selectedIndex];
1884
+ if (selected.san !== context.moveSan || selected.uci !== context.moveUci) return void 0;
1885
+ const prefix = line.moves.slice(0, line.selectedIndex + 1);
1886
+ const validated = recordedMainLineResult({ ...line, moves: prefix, totalPlies: prefix.length, truncated: false }, context);
1887
+ const row = validated.recordedAnalysis.rows.find((item) => item[0] === line.selectedIndex + 1);
1888
+ if (!row) return void 0;
1889
+ const [
1890
+ ply,
1891
+ engine,
1892
+ recordedDepth,
1893
+ requestedDepth,
1894
+ classifierVersion,
1895
+ classification,
1896
+ beforeCp,
1897
+ afterCp,
1898
+ lossCp,
1899
+ mateBefore,
1900
+ mateAfter
1901
+ ] = row;
1902
+ const snapshot = {
1903
+ version: "recorded-selected-classification/1",
1904
+ authority: "historical-reported-label-only",
1905
+ source: "loaded-game-stored-selected-move-analysis",
1906
+ position: { fenBefore: context.fenBefore, fenAfter: context.fenAfter, moveUci: context.moveUci, moveSan: context.moveSan, ply },
1907
+ classification,
1908
+ classifierVersion,
1909
+ engine,
1910
+ reportedDepth: recordedDepth,
1911
+ recordedRequestedDepth: requestedDepth,
1912
+ freshlyRecomputed: false,
1913
+ savedEvaluation: { perspective: "selected-mover", units: "centipawns; mate separate", beforeCp, afterCp, lossCp, mateBefore, mateAfter },
1914
+ limitations: [
1915
+ "This is the recorded classification under the supplied historical classifier version, not necessarily the current app badge or current policy.",
1916
+ "Preparation and subsequent engine searches do not recompute this stored label. Prefer a separately supplied refreshed board classification when available.",
1917
+ "The label is not proof of its chess explanation. Saved scores may differ from fresh searches; lossCp is a saved search delta, not a matched comparison.",
1918
+ "No future recorded moves, alternative candidates or other moves' classifications are included."
1919
+ ]
1920
+ };
1921
+ const contextHash = reasoningContextHash(context);
1922
+ const record = {
1923
+ schemaVersion: REASONING_POC_VERSION,
1924
+ id: `evidence:recorded-selected-classification:${stableHash({ contextHash, snapshot })}`,
1925
+ contextHash,
1926
+ kind: "context",
1927
+ source: snapshot.source,
1928
+ proofStrength: null,
1929
+ summary: `The stored analysis labelled ${context.moveSan} ${classification} under classifier version ${classifierVersion}; this is historical reported context, not a new classification.`,
1930
+ data: snapshot,
1931
+ coverage: { complete: false, covered: ["historical-selected-classification"], unresolved: ["current-policy-classification", "causal-explanation"] },
1932
+ replay: { fen: context.fenBefore, moveUci: context.moveUci },
1933
+ licenses: [EVIDENCE_LICENSE.ATTENTION_AFFORDANCE]
1934
+ };
1935
+ return { record, snapshot: { ...snapshot, evidenceId: record.id } };
1936
+ } catch {
1937
+ return void 0;
1938
+ }
1939
+ }
1940
+ export {
1941
+ ABLATION_ADAPTIVE_EVIDENCE_LOOP_VERSION,
1942
+ ABLATION_ADAPTIVE_RUNTIME_VERSION,
1943
+ ABLATION_B_PRIME_TRIGGER_VALUES,
1944
+ ABLATION_B_SYSTEM,
1945
+ ABLATION_DIRECT_SYNTHESIS_VERSION,
1946
+ ABLATION_EVIDENCE_BUNDLE_VERSION,
1947
+ ABLATION_LEAN_DIRECT_PROPOSAL_VERSION,
1948
+ ABLATION_LEAN_DIRECT_RUNTIME_VERSION,
1949
+ ABLATION_PROBE_TELEMETRY_VERSION,
1950
+ AI_SDK_ANSWER_OBLIGATION_RUNTIME,
1951
+ AI_SDK_CRITIC_RUNTIME,
1952
+ AI_SDK_DISCOURSE_RUNTIME,
1953
+ AI_SDK_GRAPH_PLANNING_RUNTIME,
1954
+ AI_SDK_GRAPH_SELECTION_RUNTIME,
1955
+ AI_SDK_HYPOTHESIS_RUNTIME,
1956
+ AI_SDK_PURPOSE_PROBE_RUNTIME,
1957
+ AI_SDK_REASONING_RUNTIME,
1958
+ AI_SDK_RENDER_RUNTIME,
1959
+ AI_SDK_REPAIR_RUNTIME,
1960
+ AI_SDK_RESOLUTION_AUDIT_RUNTIME,
1961
+ AI_SDK_TERMINAL_REVIEW_RUNTIME,
1962
+ ANALYSIS_CONTEXT_PROVENANCE_TIER,
1963
+ ATTRIBUTE_KEYS,
1964
+ AblationTransportCorrectionError,
1965
+ AdaptiveAblationPreconditionError,
1966
+ BRANCH_EXPANSION_OPTIONS,
1967
+ CANONICAL_EDGE_ANALYSIS_SNAPSHOT_VERSION,
1968
+ CAPTURE_RESPONSE_FACT_KIND,
1969
+ CHESS_FACT_REQUEST_VERSION,
1970
+ CHESS_FACT_RESULT_VERSION,
1971
+ CHESS_FACT_SCHEMA_VERSION,
1972
+ CHESS_REASONING_POLICY_VERSION,
1973
+ CHESS_REASONING_SCHEMA_VERSION,
1974
+ CHESS_REFERENCE_DICTIONARY,
1975
+ CLASSIFICATION_REASSESSMENT_GUIDANCE,
1976
+ COMPACT_ENGINE_INSTRUCTIONS,
1977
+ COMPLETED_TOOL_REPLAY_ADMISSION_KEY,
1978
+ CONCEPT_KEYS,
1979
+ CONVERSATION_CONTEXT_INSTRUCTIONS,
1980
+ ChessFactObservationProvider,
1981
+ CompositeObservationProvider,
1982
+ CriticResolutionAuditHarnessRejection,
1983
+ DEFAULT_CONCEPT_REGISTRY,
1984
+ DEFAULT_MATERIAL_FORMAT,
1985
+ DEFAULT_REASONING_RUN_CONTROLS,
1986
+ DETERMINISTIC_DISCOURSE_RUNTIME,
1987
+ DETERMINISTIC_OBSERVATION_PROVIDER_VERSION,
1988
+ DIRECT_SYNTHESIS_PROPOSAL_JSON_SCHEMA,
1989
+ DeterministicObservationProvider,
1990
+ ENTITY_TYPES,
1991
+ EVALUATED_ASTRA_CONFIG,
1992
+ EVIDENCE_LICENSE,
1993
+ EVIDENCE_SHARING_GUIDANCE_CHARS,
1994
+ EVIDENCE_SHARING_INSTRUCTIONS,
1995
+ EVIDENCE_SHARING_VERSION,
1996
+ EXISTING_ANALYSIS_CONTEXT_MODE,
1997
+ EXISTING_ANALYSIS_CONTEXT_VERSION,
1998
+ EXISTING_ANALYSIS_OBSERVATION_PROVIDER_ID,
1999
+ EXISTING_ANALYSIS_RECORD_VERSION,
2000
+ EXPLAIN_PLAN_SELECTION_DESCRIPTOR,
2001
+ EXPLANATION_REVIEW_SCHEMA,
2002
+ ExistingAnalysisObservationProvider,
2003
+ FACT_DELIVERY_INSTRUCTIONS,
2004
+ FACT_OBSERVATION_ADAPTER_VERSION,
2005
+ GraphSelectionHarnessRejection,
2006
+ HypothesisHarnessRejection,
2007
+ HypothesisLedger,
2008
+ HypothesisProviderRuntimeFailure,
2009
+ HypothesisReviewHarnessRejection,
2010
+ LEAN_DIRECT_PROPOSAL_JSON_SCHEMA,
2011
+ LEGACY_EXISTING_ANALYSIS_CONTEXT_VERSION,
2012
+ MATCHED_COMPARISON_GUIDANCE,
2013
+ MATERIAL_OFFER_SET_VERSION,
2014
+ MAX_ANSWER_TOOL_REQUESTS_PER_TURN,
2015
+ MAX_FRESH_ENGINE_WITNESS_ACQUISITIONS,
2016
+ MAX_INTERACTIVE_LINE_PLIES,
2017
+ MECHANICAL_CHESS_FACT_PROVIDER_ID,
2018
+ MECHANICAL_CHESS_FACT_PROVIDER_VERSION,
2019
+ MECHANISM_FACT_INSTRUCTIONS,
2020
+ MechanicalChessFactProvider,
2021
+ ModelOwnedAdaptiveEvidenceLoop,
2022
+ ModelRuntimeFailure,
2023
+ OPENING_SOURCE_INSTRUCTIONS,
2024
+ OPENING_SOURCE_LICENSE_URL,
2025
+ PARTICIPANT_ROLES,
2026
+ PRECOMMITTED_PROBE_ATTRIBUTION_CATEGORIES,
2027
+ PRODUCTION_OBSERVATION_PROVIDER_VERSION,
2028
+ QUESTION_ROUTING_VERSION,
2029
+ QUESTION_SALIENCE_POLICY_VERSION,
2030
+ QuestionConditionedSaliencePolicy,
2031
+ RAW_CHESS_TEXT,
2032
+ RAW_CHESS_TEXT_PATTERN_SOURCE,
2033
+ REASONING_DISCOURSE_PLAN_VERSION,
2034
+ REASONING_POC_CRITIC_CORRECTION_ALLOWANCE,
2035
+ REASONING_POC_MAX_CRITIC_OUTPUT_TOKENS,
2036
+ REASONING_POC_MAX_DISCOURSE_OUTPUT_TOKENS,
2037
+ REASONING_POC_MAX_GRAPH_SELECTION_OUTPUT_TOKENS,
2038
+ REASONING_POC_MAX_HYPOTHESIS_BATCHES,
2039
+ REASONING_POC_MAX_HYPOTHESIS_OUTPUT_TOKENS,
2040
+ REASONING_POC_MAX_OUTPUT_TOKENS,
2041
+ REASONING_POC_MAX_PURPOSE_PROBE_OUTPUT_TOKENS,
2042
+ REASONING_POC_MAX_RENDER_OUTPUT_TOKENS,
2043
+ REASONING_POC_MAX_RESOLUTION_AUDIT_OUTPUT_TOKENS,
2044
+ REASONING_POC_MAX_TERMINAL_REVIEW_OUTPUT_TOKENS,
2045
+ REASONING_POC_PURPOSE_PROBE_ALLOWANCE,
2046
+ REASONING_POC_RESERVED_MANDATORY_STEPS,
2047
+ REASONING_POC_REVISION_EVIDENCE_ALLOWANCE,
2048
+ REASONING_POC_VERSION,
2049
+ RECORDED_POSITION_DESCRIPTORS,
2050
+ RECORD_HYPOTHESES_DESCRIPTOR,
2051
+ REFERENCE_DOMAINS,
2052
+ RELATION_TYPES,
2053
+ REVIEW_HYPOTHESES_DESCRIPTOR,
2054
+ REVIEW_SUBJECTS,
2055
+ ReasoningCriticHarnessRejection,
2056
+ ReasoningWorkflowFailure,
2057
+ SEMANTIC_TEXT_JSON_PATTERN,
2058
+ SIMPLE_BOARD_ANALYSIS_GUIDANCE,
2059
+ SIMPLE_BUDGETS,
2060
+ SIMPLE_CONTENT_SELECTION_GUIDANCE,
2061
+ SIMPLE_DISCLOSURE,
2062
+ SIMPLE_EVIDENCE_VIEW_VERSION,
2063
+ SIMPLE_EXAMPLE_GUIDANCE,
2064
+ SIMPLE_EXPANDED_BUDGETS,
2065
+ SIMPLE_EXPLANATION_GUIDANCE,
2066
+ SIMPLE_EXTENSION_CONFIGS,
2067
+ SIMPLE_MODELS,
2068
+ SIMPLE_MODEL_CATALOGUE,
2069
+ SIMPLE_PURPOSE_GUIDANCE,
2070
+ SIMPLE_RECOVERY_BUDGETS,
2071
+ SIMPLE_REFERENCE_INSTRUCTIONS,
2072
+ SIMPLE_REFERENCE_VERSION,
2073
+ SIMPLE_SEARCH_BREADTH_GUIDANCE,
2074
+ SIMPLE_SECTION_GUIDANCE,
2075
+ SIMPLE_STOPPING_GUIDANCE,
2076
+ SIMPLE_SYSTEM,
2077
+ SIMPLE_TOOL_AGENT_VERSION,
2078
+ SIMPLE_VENDOR_CONFIGS,
2079
+ SimpleFactDelivery,
2080
+ TerminalReviewHarnessRejection,
2081
+ ablationHistoryThroughTargetHash,
2082
+ ablationLeanDirectSystem,
2083
+ abortSource,
2084
+ admitFreshEnginePvWitnesses,
2085
+ applyIdentityMove,
2086
+ assertDirectedDestinationAnchors,
2087
+ assertFactProofWithinAuthority,
2088
+ assertTransportOnlyDirectCorrection,
2089
+ bytes,
2090
+ canonicalPieceLabel,
2091
+ captureAblationOriginalEvidenceBundle,
2092
+ checkCausalClaims,
2093
+ chessFactRecordLicenses,
2094
+ chessSquareColor,
2095
+ classificationReassessment,
2096
+ classificationTargetAtSelection,
2097
+ classifyGraphSelectionHarnessRejection,
2098
+ classifyGraphSelectionRuntimeFailure,
2099
+ classifyHypothesisHarnessRejection,
2100
+ classifyProviderHypothesisRejection,
2101
+ classifyQuestionRoutingAnswers,
2102
+ classifyReasoningCriticHarnessRejection,
2103
+ classifyReviewSubject,
2104
+ classifyRuntimeFailure,
2105
+ collectReasoningMoveWitnesses,
2106
+ compactLeanEvidencePacket,
2107
+ compactMechanism,
2108
+ compactPreparedSearchResult,
2109
+ compactSearchRecord,
2110
+ compactSimpleEngineResult,
2111
+ compactSimpleInitialPacket,
2112
+ compactSimpleToolResult,
2113
+ conceptDefinition,
2114
+ conceptsOf,
2115
+ consolidatePreparedSearches,
2116
+ createAblationEvidenceClosureBundle,
2117
+ createAblationProbeTelemetry,
2118
+ createConceptRegistry,
2119
+ createContextEvidence,
2120
+ createDefaultObservationProvider,
2121
+ createDefaultSaliencePolicy,
2122
+ createIdeaGraph,
2123
+ createIdentityState,
2124
+ createMechanicalFactRequest,
2125
+ createNativeAnswerConnector,
2126
+ createPocIdentityTimeline,
2127
+ createPocToolHost,
2128
+ createProductionObservationProvider,
2129
+ createQueryContract,
2130
+ createSemanticEntity,
2131
+ createSemanticRelation,
2132
+ createToolInputLoopGuard,
2133
+ decodeWikibooksIndex,
2134
+ decorateSimpleVariations,
2135
+ deepestError,
2136
+ deriveAblationBPrimeTriggers,
2137
+ deriveAdmittedCaptureResponseAvailabilityFact,
2138
+ effectiveEvidenceLicenses,
2139
+ effectiveLicensesForRecord,
2140
+ emitObservableTrace,
2141
+ enrichAblationEvidenceBundleWithAdmittedCaptureResponses,
2142
+ enrichAblationEvidenceClosureBundle,
2143
+ evidenceFallback,
2144
+ evidenceLicenseInput,
2145
+ expandCompactEngineEvidence,
2146
+ expandMechanismPresentation,
2147
+ expandPrincipalBranches,
2148
+ expandSharedEvidence,
2149
+ explanationBranches,
2150
+ explanationCoverage,
2151
+ explanationSummary,
2152
+ extendConceptRegistry,
2153
+ extendIdeaGraph,
2154
+ factCoverageSupportsAbsence,
2155
+ factProofStrength,
2156
+ forcedWinPremiseFallback,
2157
+ forkIdeaGraph,
2158
+ forkIdentityState,
2159
+ graphIdentityCompatible,
2160
+ hasConcept,
2161
+ hasMoveClassificationQuestion,
2162
+ hasSharedEvidence,
2163
+ historyPositionContext,
2164
+ isChessFactAuthority,
2165
+ isTerminalEntity,
2166
+ isTransportCorrectableDirectSynthesisIssues,
2167
+ licensesBoundedRouteRelevance,
2168
+ licensesSemanticChessGrounding,
2169
+ makeQuestionRoutingRequest,
2170
+ matchedRootComparison,
2171
+ materialAlongLine,
2172
+ materialAtPosition,
2173
+ materialForVariations,
2174
+ materializeDirectSynthesis,
2175
+ materializeLeanDirectProposal,
2176
+ maximumEvidenceLicenses,
2177
+ maximumFactProofStrength,
2178
+ memoizeToolResults,
2179
+ moveMechanismFacts,
2180
+ moveSectionScope,
2181
+ normalizeExistingAnalysisContext,
2182
+ normalizedEvidenceCitations,
2183
+ numericUsage,
2184
+ observableTraceMessages,
2185
+ openEntityCount,
2186
+ openingSourceLinks,
2187
+ openingSourcesInMessages,
2188
+ openingTitle,
2189
+ parseDirectSynthesisProposal,
2190
+ parseExplainPlanRequest,
2191
+ parseOpeningSourceCredits,
2192
+ parseQuestionRoutingAnswers,
2193
+ participant,
2194
+ participantIds,
2195
+ pieceIdAt,
2196
+ pieceIdentity,
2197
+ planInitialSearches,
2198
+ planningEvidence,
2199
+ positionKey,
2200
+ precommittedProbeAttributionCategories,
2201
+ prepareAblationAdaptiveEvidenceForStagedReference,
2202
+ prepareOpponentThreats,
2203
+ prepareSimpleEvidence,
2204
+ preparedMoveComparison,
2205
+ primaryConcept,
2206
+ priorConversationMessages,
2207
+ projectAblationEvidenceForModel,
2208
+ projectCompactEngineEvidence,
2209
+ projectEnginePresentation,
2210
+ projectLeanDirectEvidence,
2211
+ projectLeanEpisodeEvidence,
2212
+ projectMaterial,
2213
+ reasoningContextHash,
2214
+ reasoningEvidenceReplayStartPhase,
2215
+ reasoningMetrics,
2216
+ recordedMainLineResult,
2217
+ recordedNavigation,
2218
+ recordedPositionContext,
2219
+ recordedSelectedClassification,
2220
+ repairFrozenCitationLabels,
2221
+ replayWikibooksTitle,
2222
+ requestId,
2223
+ resolveAndSelectPlan,
2224
+ retainedEvidenceCatalogue,
2225
+ runAblationAdaptiveDirect,
2226
+ runAnswerPipeline,
2227
+ runLeanDirect,
2228
+ runPreparedAnswer,
2229
+ safeSimpleSourceLink,
2230
+ savedScorePresentation,
2231
+ scopePositionAnalysis,
2232
+ scoreComparisonNotices,
2233
+ selectBranchHost,
2234
+ selectIndexedOpening,
2235
+ selectSimpleModel,
2236
+ shareEvidence,
2237
+ shareEvidenceMessages,
2238
+ simpleBoardAnalysis,
2239
+ simpleEffortsForModel,
2240
+ simpleInitialEvidenceView,
2241
+ simplePastHistory,
2242
+ simpleProseReferences,
2243
+ simpleSystemPolicy,
2244
+ simpleToolDescription,
2245
+ simpleUsageForTrace,
2246
+ squareForPiece,
2247
+ squaresBetween,
2248
+ stabilizeSimplePolicy,
2249
+ stableHash,
2250
+ stableJson,
2251
+ stringListAttribute,
2252
+ stripSimpleCitationLinks,
2253
+ stripSimpleMarkdownFences,
2254
+ toLegacyPositionAnalysis,
2255
+ toLegacyPositionAnalysisProvider,
2256
+ toPositionAnalysis,
2257
+ toPositionAnalysisProvider,
2258
+ validateAblationEvidenceClosureBundle,
2259
+ validateAblationProbeTelemetry,
2260
+ validateAnswerReferences,
2261
+ validateChessFactRecord,
2262
+ validateChessFactRequest,
2263
+ validateEvidenceLicenseClaims,
2264
+ validateExplanationReview,
2265
+ validateHypothesisAcceptancePolicies,
2266
+ validateReasoningPositionContext,
2267
+ validateSimpleAgentConfig,
2268
+ validateSimpleToolInput,
2269
+ visibleSupportLines,
2270
+ wikibooksTargetsForTool,
2271
+ withBranchPreparation,
2272
+ withEvidenceLicenses,
2273
+ withRecordedPositionTools
2274
+ };