@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,185 @@
1
+ import { type ReasoningEvidenceRecord, type ReasoningObservation, type ReasoningPositionContext, type ReasoningToolDescriptor, type ReasoningToolName } from "./poc-contracts.js";
2
+ import { type ReasoningMoveWitness } from "./poc-move-witnesses.js";
3
+ /**
4
+ * A deliberately pre-semantic snapshot for the architecture ablation. This
5
+ * is not a replay/checkpoint format: hypothesis, graph, and disposition
6
+ * state must remain outside the acquisition/deliberation boundary.
7
+ */
8
+ export declare const ABLATION_EVIDENCE_BUNDLE_VERSION: "architecture-ablation-evidence-bundle/1";
9
+ export declare const ABLATION_PROBE_TELEMETRY_VERSION: "architecture-ablation-probe-telemetry/2";
10
+ export declare const PRECOMMITTED_PROBE_ATTRIBUTION_CATEGORIES: readonly ["fact-unavailable", "fact-available-not-presented", "fact-presented-ignored", "fact-recognized-not-probed", "hypothesis-formed-later-discarded", "correct-graph-poor-rendering", "unsupported-claim-admitted", "safe-fail-closed-termination"];
11
+ export type ProbeAttributionCategory = typeof PRECOMMITTED_PROBE_ATTRIBUTION_CATEGORIES[number];
12
+ export type AblationBundleOmissionReason = "budget" | "not-requested" | "unavailable" | "withheld";
13
+ export type AblationEvidenceClosureCoverage = {
14
+ complete: boolean;
15
+ covered: string[];
16
+ omitted: Array<{
17
+ domain: "observation" | "evidence" | "tool";
18
+ id: string;
19
+ reason: AblationBundleOmissionReason;
20
+ }>;
21
+ unavailable: Array<{
22
+ id: string;
23
+ reason: string;
24
+ }>;
25
+ limitations: string[];
26
+ };
27
+ export type AblationEvidenceReferenceAllowlists = {
28
+ evidenceIds: string[];
29
+ observationIds: string[];
30
+ toolNames: ReasoningToolName[];
31
+ semanticReferences: Array<{
32
+ domain: "piece" | "square" | "move";
33
+ id: string;
34
+ }>;
35
+ moveWitnesses: ReasoningMoveWitness[];
36
+ };
37
+ export type AblationEvidenceBundleLineage = {
38
+ kind: "original";
39
+ } | {
40
+ kind: "enriched";
41
+ originalBundleHash: string;
42
+ acquiredEvidenceIds: string[];
43
+ acquiredObservationIds: string[];
44
+ };
45
+ export type AblationEvidenceClosureBundle = {
46
+ schemaVersion: typeof ABLATION_EVIDENCE_BUNDLE_VERSION;
47
+ contextHash: string;
48
+ context: ReasoningPositionContext;
49
+ question: string;
50
+ observations: ReasoningObservation[];
51
+ evidence: ReasoningEvidenceRecord[];
52
+ referenceAllowlists: AblationEvidenceReferenceAllowlists;
53
+ coverage: AblationEvidenceClosureCoverage;
54
+ lineage: AblationEvidenceBundleLineage;
55
+ bundleHash: string;
56
+ };
57
+ export type CreateAblationEvidenceClosureBundleInput = Omit<AblationEvidenceClosureBundle, "schemaVersion" | "contextHash" | "lineage" | "bundleHash">;
58
+ export type EnrichAblationEvidenceClosureBundleInput = {
59
+ observations: ReasoningObservation[];
60
+ evidence: ReasoningEvidenceRecord[];
61
+ referenceAllowlists?: Partial<AblationEvidenceReferenceAllowlists>;
62
+ coverage: AblationEvidenceClosureCoverage;
63
+ };
64
+ export type AblationAnchorAcquirability = {
65
+ /** Evaluator metadata only; no evaluator anchor is carried in this value. */
66
+ telemetryOnly: true;
67
+ status: "not-applicable" | "acquirable-from-admitted-evidence" | "requires-probe" | "unacquirable-within-budget";
68
+ basisEvidenceIds: string[];
69
+ rationale: string;
70
+ };
71
+ export type AblationProbeEffect = "materially-changed" | "supported" | "narrowed" | "rejected" | "no-change" | "failure";
72
+ export type AblationCalledProbe = {
73
+ callId: string;
74
+ requestId: string;
75
+ tool: ReasoningToolName;
76
+ request: {
77
+ descriptor: ReasoningToolDescriptor;
78
+ input: Record<string, unknown>;
79
+ selectionRationale: string;
80
+ };
81
+ target: {
82
+ fen: string;
83
+ historyThroughTargetHash: string;
84
+ };
85
+ permittedLimits: {
86
+ maxToolCalls: number;
87
+ maxProbeCalls: number;
88
+ engine: {
89
+ depth: number | null;
90
+ multiPv: number | null;
91
+ threads: number | null;
92
+ rootMoves: string[];
93
+ } | null;
94
+ };
95
+ approval: {
96
+ approved: boolean;
97
+ budgetReason: string;
98
+ remainingToolCalls: number;
99
+ remainingProbeCalls: number;
100
+ };
101
+ status: {
102
+ started: boolean;
103
+ finished: "not-started" | "returned" | "failed" | "cancelled";
104
+ };
105
+ returned: {
106
+ lines: number;
107
+ coverage: {
108
+ complete: boolean;
109
+ covered: string[];
110
+ unresolved: string[];
111
+ };
112
+ } | null;
113
+ admission: {
114
+ status: "admitted" | "withheld" | "rejected" | "not-produced";
115
+ reason: string;
116
+ };
117
+ admittedEvidence: Array<{
118
+ evidenceId: string;
119
+ licenses: string[];
120
+ }>;
121
+ presentation: {
122
+ presentedToModel: boolean;
123
+ reason: string;
124
+ };
125
+ semanticConsumption: {
126
+ status: "not-reached" | "not-consumed" | "consumed" | "misused";
127
+ hypothesisIds: string[];
128
+ };
129
+ modelStatedRationale: string | null;
130
+ effect: AblationProbeEffect;
131
+ hypothesisIds: string[];
132
+ usage: {
133
+ inputTokens: number | null;
134
+ outputTokens: number | null;
135
+ latencyMs: number | null;
136
+ cache: {
137
+ hits: number;
138
+ misses: number;
139
+ };
140
+ cost: number | null;
141
+ corrections: number;
142
+ };
143
+ };
144
+ export type AblationProbeTelemetry = {
145
+ schemaVersion: typeof ABLATION_PROBE_TELEMETRY_VERSION;
146
+ bundleHash: string;
147
+ beforeProbeEvidenceIds: string[];
148
+ postSaliencePresentedFactIds: string[];
149
+ availableTools: ReasoningToolDescriptor[];
150
+ calledProbes: AblationCalledProbe[];
151
+ missedAnchorAttributions: Array<{
152
+ /** Opaque evaluator-side handle; it never identifies or carries the anchor. */
153
+ anchorId: string;
154
+ category: ProbeAttributionCategory;
155
+ acquirability: AblationAnchorAcquirability;
156
+ unusedRelevantTools: ReasoningToolName[];
157
+ }>;
158
+ stopping: {
159
+ rationale: string;
160
+ unusedRelevantTools: ReasoningToolName[];
161
+ };
162
+ usage: {
163
+ modelCalls: number;
164
+ toolCalls: number;
165
+ inputTokens: number | null;
166
+ outputTokens: number | null;
167
+ latencyMs: number | null;
168
+ cache: {
169
+ hits: number;
170
+ misses: number;
171
+ };
172
+ cost: number | null;
173
+ corrections: number;
174
+ };
175
+ telemetryHash: string;
176
+ };
177
+ export type CreateAblationProbeTelemetryInput = Omit<AblationProbeTelemetry, "schemaVersion" | "bundleHash" | "telemetryHash">;
178
+ export declare function ablationHistoryThroughTargetHash(context: ReasoningPositionContext): string;
179
+ export declare function createAblationEvidenceClosureBundle(input: CreateAblationEvidenceClosureBundleInput): Readonly<AblationEvidenceClosureBundle>;
180
+ export declare function enrichAblationEvidenceClosureBundle(original: Readonly<AblationEvidenceClosureBundle>, input: EnrichAblationEvidenceClosureBundleInput): Readonly<AblationEvidenceClosureBundle>;
181
+ export declare function validateAblationEvidenceClosureBundle(value: unknown): asserts value is Readonly<AblationEvidenceClosureBundle>;
182
+ export declare function createAblationProbeTelemetry(bundle: Readonly<AblationEvidenceClosureBundle>, input: CreateAblationProbeTelemetryInput): Readonly<AblationProbeTelemetry>;
183
+ export declare function validateAblationProbeTelemetry(bundle: Readonly<AblationEvidenceClosureBundle>, value: unknown): asserts value is Readonly<AblationProbeTelemetry>;
184
+ /** The fixed category order makes reporting stable and prevents ad-hoc labels. */
185
+ export declare function precommittedProbeAttributionCategories(): readonly ProbeAttributionCategory[];
@@ -0,0 +1,37 @@
1
+ import { type AblationEvidenceClosureBundle } from "./ablation-evidence-bundle.js";
2
+ import { type ReasoningObservationSet, type ReasoningPositionContext, type ReasoningRankedObservationSet, type ReasoningToolResult } from "./poc-contracts.js";
3
+ /**
4
+ * The capture boundary is deliberately narrower than a full reasoning trace:
5
+ * it accepts only the completed evidence-acquisition phase. No model-created
6
+ * hypothesis, review, graph, or answer state can cross this boundary.
7
+ */
8
+ export declare const ABLATION_EVIDENCE_CAPTURE_VERSION: "architecture-ablation-evidence-capture/1";
9
+ export declare const CAPTURE_RESPONSE_FACT_KIND: "move.capture_response_availability_after";
10
+ export declare const COMPLETED_TOOL_REPLAY_ADMISSION_KEY: "ablationCompletedToolReplayAdmission";
11
+ export type AblationEvidenceCaptureInput = {
12
+ context: ReasoningPositionContext;
13
+ question: string;
14
+ /** Provider output before salience; retained to make membership auditable. */
15
+ observations: ReasoningObservationSet;
16
+ /** The exact output of the production salience policy for `observations`. */
17
+ rankedObservations: ReasoningRankedObservationSet;
18
+ /** Already completed fact/probe calls from the evidence phase. */
19
+ admittedToolResults?: readonly ReasoningToolResult[];
20
+ /**
21
+ * Retain exact fact records that the supplied salience result explicitly
22
+ * presents. This is for consumers whose model packet is defined by that
23
+ * production presentation decision; the original 2x2 baseline remains
24
+ * response-fact-withheld by default.
25
+ */
26
+ retainPresentedExactFacts?: boolean;
27
+ /** Generic acquisition keeps every admitted record discoverable; frozen 2x2 defaults stay unchanged. */
28
+ retainAllExactFacts?: boolean;
29
+ };
30
+ /** Freeze the evidence-acquisition state without allowing semantic artifacts across the boundary. */
31
+ export declare function captureAblationOriginalEvidenceBundle(input: AblationEvidenceCaptureInput): Readonly<AblationEvidenceClosureBundle>;
32
+ /**
33
+ * Derive the opt-in response-availability cell strictly from the immutable
34
+ * original closure. `null` means that the target/its already-admitted lines
35
+ * contain no capture, so the 2x2 experiment has no enriched cell to run.
36
+ */
37
+ export declare function enrichAblationEvidenceBundleWithAdmittedCaptureResponses(original: Readonly<AblationEvidenceClosureBundle>): Readonly<AblationEvidenceClosureBundle> | null;
@@ -0,0 +1,193 @@
1
+ import { type LanguageModel, type LanguageModelCallOptions } from "ai";
2
+ import type { LeanDirectEvidenceSelector } from "./evidence-selector-contract.js";
3
+ import { type AblationEvidenceClosureBundle } from "./ablation-evidence-bundle.js";
4
+ import { type ObservableLlmTraceSink } from "./ai-sdk-runtime-support.js";
5
+ /**
6
+ * A deliberately small development diagnostic. It is not a product stage and
7
+ * does not create hypotheses, a graph, a checkpoint, or an answer repair
8
+ * loop. Its purpose is to test whether the model can synthesize a useful,
9
+ * evidence-cited answer when the evidence transport is not the bottleneck.
10
+ */
11
+ export declare const ABLATION_LEAN_DIRECT_RUNTIME_VERSION: "architecture-ablation-lean-direct-runtime/8";
12
+ export declare const ABLATION_LEAN_DIRECT_PROPOSAL_VERSION: "architecture-ablation-lean-direct-proposal/3";
13
+ export declare const ABLATION_LEAN_DIRECT_EVIDENCE_VIEW_VERSION: "architecture-ablation-lean-direct-evidence-view/2";
14
+ /**
15
+ * The direct arm normally sees the production salience projection. It also
16
+ * admits at most one already-captured bounded continuation/comparison record,
17
+ * plus observations that cite it. This is deterministic transport selection,
18
+ * not an engine call or a chess-purpose heuristic: it prevents a previously
19
+ * available discriminating witness from being silently withheld before the
20
+ * sole model call.
21
+ */
22
+ export type LeanDirectEvidenceView = Readonly<{
23
+ schemaVersion: typeof ABLATION_LEAN_DIRECT_EVIDENCE_VIEW_VERSION;
24
+ sourceBundleHash: string;
25
+ bundle: Readonly<AblationEvidenceClosureBundle>;
26
+ salienceEvidenceIds: readonly string[];
27
+ requiredEvidenceIds: readonly string[];
28
+ supplementalBoundedEvidenceIds: readonly string[];
29
+ /** Present only for the compact fixture-declared packet, never model-authored semantics. */
30
+ selectedSelectorIds: readonly string[];
31
+ viewHash: string;
32
+ }>;
33
+ export declare const ablationLeanDirectSystem = "You are Knight's Eye in a private development diagnostic. Return exactly one object matching the supplied schema. This is one compact synthesis call: there are no tools, hypothesis ledger, critic, graph selection, checkpoint, discourse stage, rendering stage, repair call, or hidden answer key.\n\nAnswer the user's verbatim chess question naturally and concisely. Before drafting, silently compare the evidence-backed causal chains. Lead with the smallest chain that directly answers the question and explains the move's most decision-relevant change to an option, resource, constraint, threat, or comparison. When exact structured evidence gives the mechanism for an unavailable or legal response--for example a blocking occupant or ray, a pin, or a defender constraint--state that mechanism before any incidental attack, square, or material side effect. Then include only the supporting links needed to show why it works, its practical consequence, or a necessary qualification. Deliberately omit exact but incidental facts: do not enumerate records merely because they are available or use them to make the answer look complete. A factual observation is not automatically a strategic explanation: do not invent purpose, force, safety, or a continuation beyond the cited evidence. Bounded engine evidence establishes only its recorded line, comparison, score, or response coverage. Exact legal facts establish only what they state. If the available evidence does not settle a point, say so in limitations instead of guessing.\n\nUse only the supplied evidence IDs. Cite evidence for every claim. Each claim is plain concise prose; do not encode moves, pieces, squares, or other references as structured fields. The answer remains an unvalidated diagnostic proposal, never a supported Knight's Eye result.";
34
+ export declare const LEAN_DIRECT_PROPOSAL_JSON_SCHEMA: {
35
+ readonly type: "object";
36
+ readonly additionalProperties: false;
37
+ readonly required: readonly ["schemaVersion", "claims", "limitations", "coverage"];
38
+ readonly properties: {
39
+ readonly schemaVersion: {
40
+ readonly const: "architecture-ablation-lean-direct-proposal/3";
41
+ };
42
+ readonly claims: {
43
+ readonly type: "array";
44
+ readonly minItems: 1;
45
+ readonly maxItems: 4;
46
+ readonly items: {
47
+ readonly type: "object";
48
+ readonly additionalProperties: false;
49
+ readonly required: readonly ["text", "kind", "evidenceIds"];
50
+ readonly properties: {
51
+ readonly text: {
52
+ readonly type: "string";
53
+ readonly minLength: 1;
54
+ readonly maxLength: 700;
55
+ };
56
+ readonly kind: {
57
+ readonly enum: readonly ["fact", "interpretation", "consequence", "defense", "uncertainty", "comparison"];
58
+ };
59
+ readonly evidenceIds: {
60
+ readonly type: "array";
61
+ readonly minItems: 1;
62
+ readonly maxItems: 8;
63
+ readonly items: {
64
+ readonly type: "string";
65
+ readonly minLength: 1;
66
+ readonly maxLength: 200;
67
+ };
68
+ };
69
+ };
70
+ };
71
+ };
72
+ readonly limitations: {
73
+ readonly type: "array";
74
+ readonly maxItems: 4;
75
+ readonly items: {
76
+ readonly type: "string";
77
+ readonly minLength: 1;
78
+ readonly maxLength: 400;
79
+ };
80
+ };
81
+ readonly coverage: {
82
+ readonly type: "object";
83
+ readonly additionalProperties: false;
84
+ readonly required: readonly ["status", "unresolved"];
85
+ readonly properties: {
86
+ readonly status: {
87
+ readonly enum: readonly ["complete", "partial", "unavailable"];
88
+ };
89
+ readonly unresolved: {
90
+ readonly type: "array";
91
+ readonly maxItems: 4;
92
+ readonly items: {
93
+ readonly type: "string";
94
+ readonly minLength: 1;
95
+ readonly maxLength: 400;
96
+ };
97
+ };
98
+ };
99
+ };
100
+ };
101
+ };
102
+ export type LeanDirectClaim = {
103
+ text: string;
104
+ kind: "fact" | "interpretation" | "consequence" | "defense" | "uncertainty" | "comparison";
105
+ evidenceIds: string[];
106
+ };
107
+ export type LeanDirectArtifact = {
108
+ schemaVersion: typeof ABLATION_LEAN_DIRECT_PROPOSAL_VERSION;
109
+ sourceBundleHash: string;
110
+ modelFacingEvidenceViewHash: string;
111
+ claims: LeanDirectClaim[];
112
+ limitations: string[];
113
+ coverage: {
114
+ status: "complete" | "partial" | "unavailable";
115
+ unresolved: string[];
116
+ };
117
+ admission: "diagnostic-proposed";
118
+ productSupport: "not-a-validated-graph-checkpoint-or-product-result";
119
+ };
120
+ export type LeanDirectFailure = {
121
+ kind: "provider-or-structured-output" | "lean-contract-rejected" | "aborted" | "wall-time";
122
+ code: string;
123
+ issues?: Array<{
124
+ path: string;
125
+ code: string;
126
+ }>;
127
+ };
128
+ export type LeanDirectCallDiagnostic = {
129
+ stage: "lean-direct" | "lean-acquisition";
130
+ runtime: typeof ABLATION_LEAN_DIRECT_RUNTIME_VERSION;
131
+ model: string;
132
+ route: string;
133
+ effort: string;
134
+ temperature: number | null;
135
+ bundleHash: string;
136
+ inputBytes: number;
137
+ schemaBytes: number;
138
+ outputBytes: number;
139
+ finishReason: string | null;
140
+ latencyMs: number | null;
141
+ inputTokens: number | null;
142
+ outputTokens: number | null;
143
+ cost: number | null;
144
+ cacheTokens: number | null;
145
+ outcome: "succeeded" | "failed" | "aborted";
146
+ failureCode: string | null;
147
+ };
148
+ export type LeanDirectRuntimeOptions = {
149
+ model: LanguageModel;
150
+ modelName?: string;
151
+ providerRoute?: string;
152
+ reasoning?: NonNullable<LanguageModelCallOptions["reasoning"]>;
153
+ temperature?: number;
154
+ maxOutputTokens: number;
155
+ maxWallTimeMs: number;
156
+ benchmarkNonce?: string | null;
157
+ /** Deterministically acquired, fixture-scoped evidence that must reach this sole synthesis call. */
158
+ requiredEvidenceIds?: readonly string[];
159
+ /**
160
+ * Fixture-declared fact/observation selectors for a deliberately compact
161
+ * evidence packet. Absent selectors retain the generic salience projection
162
+ * used by non-fixture diagnostics.
163
+ */
164
+ evidenceSelectors?: readonly LeanDirectEvidenceSelector[];
165
+ /** Generic acquisition: only records actually presented or retrieved in this episode. */
166
+ modelEvidenceIds?: readonly string[];
167
+ episodeCoverage?: AblationEvidenceClosureBundle["coverage"];
168
+ consumeProviderMetadata?: () => readonly {
169
+ cost?: number | null;
170
+ cacheTokens?: number | null;
171
+ model?: string | null;
172
+ route?: string | null;
173
+ effort?: string | null;
174
+ }[];
175
+ observableTraceSink?: ObservableLlmTraceSink;
176
+ };
177
+ export type LeanDirectResult = {
178
+ ok: true;
179
+ artifact: LeanDirectArtifact;
180
+ diagnostics: LeanDirectCallDiagnostic[];
181
+ modelView: LeanDirectEvidenceView;
182
+ } | {
183
+ ok: false;
184
+ diagnostics: LeanDirectCallDiagnostic[];
185
+ failure: LeanDirectFailure;
186
+ modelView: LeanDirectEvidenceView;
187
+ };
188
+ export declare function projectLeanDirectEvidence(bundle: Readonly<AblationEvidenceClosureBundle>, requiredEvidenceIds?: readonly string[], evidenceSelectors?: readonly LeanDirectEvidenceSelector[]): LeanDirectEvidenceView;
189
+ /** Exact episode membership; no salience reranking or fixture selection at synthesis. */
190
+ export declare function projectLeanEpisodeEvidence(source: Readonly<AblationEvidenceClosureBundle>, ids: readonly string[], coverage?: import("./ablation-evidence-bundle.js").AblationEvidenceClosureCoverage): LeanDirectEvidenceView;
191
+ /** Deterministic admission checks evidence identity and source ceilings; it never interprets generated prose. */
192
+ export declare function materializeLeanDirectProposal(view: LeanDirectEvidenceView, proposal: unknown): LeanDirectArtifact;
193
+ export declare function runLeanDirect(options: LeanDirectRuntimeOptions, bundle: Readonly<AblationEvidenceClosureBundle>, signal?: AbortSignal): Promise<LeanDirectResult>;
@@ -0,0 +1,38 @@
1
+ import { type AblationEvidenceClosureBundle, type AblationEvidenceClosureCoverage } from "./ablation-evidence-bundle.js";
2
+ /**
3
+ * The closure is deliberately larger than the model view: it retains all
4
+ * pre-salience records for evaluator audit. This projection is the one and
5
+ * only boundary at which that closure becomes provider-visible.
6
+ */
7
+ export declare const ABLATION_MODEL_FACING_EVIDENCE_VIEW_VERSION: "architecture-ablation-model-facing-evidence/1";
8
+ /** Lean-only transport: evidence is unchanged; observations are an index, not a second copy of its data. */
9
+ export declare function compactLeanEvidencePacket(bundle: Readonly<AblationEvidenceClosureBundle>): {
10
+ context: import("./poc-contracts.js").ReasoningPositionContext;
11
+ contextHash: string;
12
+ question: string;
13
+ evidence: import("./poc-contracts.js").ReasoningEvidenceRecord[];
14
+ observations: {
15
+ id: string;
16
+ observationType: string;
17
+ exactness: "exact" | "heuristic";
18
+ factEvidenceIds: string[];
19
+ }[];
20
+ coverage: AblationEvidenceClosureCoverage;
21
+ };
22
+ export type AblationModelFacingEvidenceView = Readonly<{
23
+ schemaVersion: typeof ABLATION_MODEL_FACING_EVIDENCE_VIEW_VERSION;
24
+ /** Immutable audit identity of the complete, pre-salience closure. */
25
+ sourceBundleHash: string;
26
+ /** A separately validated, non-mutating closure containing only visible material. */
27
+ bundle: Readonly<AblationEvidenceClosureBundle>;
28
+ visibleObservationIds: readonly string[];
29
+ visibleEvidenceIds: readonly string[];
30
+ viewHash: string;
31
+ }>;
32
+ /**
33
+ * Project a full ablation closure to material that the relevant arm may see.
34
+ * Original observations must retain exact ranked presentation metadata. New
35
+ * acquisition/enrichment records are intentionally visible by lineage, while
36
+ * an unlinked admitted probe remains available as concrete evidence.
37
+ */
38
+ export declare function projectAblationEvidenceForModel(source: Readonly<AblationEvidenceClosureBundle>): AblationModelFacingEvidenceView;
@@ -0,0 +1,13 @@
1
+ import type { DirectSynthesisIssue } from "./ablation-direct-synthesis.js";
2
+ /** A narrow transport-only correction is never a second semantic authoring turn. */
3
+ export declare class AblationTransportCorrectionError extends Error {
4
+ readonly code: "transport-correction-outside-validator-paths";
5
+ constructor(message: string);
6
+ }
7
+ export declare function isTransportCorrectableDirectSynthesisIssues(issues: readonly DirectSynthesisIssue[]): boolean;
8
+ /**
9
+ * The model may change only exact validator-named reference leaves. Item
10
+ * identity/cardinality and every other semantic/evidence association remain
11
+ * structure-equivalent. This guard is shared by A1 and B/B′ for fairness.
12
+ */
13
+ export declare function assertTransportOnlyDirectCorrection(originalProposal: unknown, correctedProposal: unknown, issues: readonly DirectSynthesisIssue[]): void;
@@ -0,0 +1,93 @@
1
+ import type { ModelMessage } from "@ai-sdk/provider-utils";
2
+ import type { ReasoningRuntimeDiagnostic } from "./poc-contracts.js";
3
+ export type SanitizedHttpAttempt = {
4
+ status: number | null;
5
+ requestId: string | null;
6
+ latencyMs: number;
7
+ aborted: boolean;
8
+ requestBytes?: number | null;
9
+ };
10
+ export type ObservableLlmTraceEvent = {
11
+ stage: string;
12
+ direction: "input" | "output" | "error";
13
+ model: string;
14
+ providerRoute: string;
15
+ reasoningEffort: string;
16
+ payload: Record<string, unknown>;
17
+ excluded: string[];
18
+ };
19
+ export type ObservableLlmTraceSink = (event: ObservableLlmTraceEvent) => void;
20
+ export declare const AI_SDK_REASONING_RUNTIME = "ai-sdk-tool-loop-agent/99";
21
+ export declare const AI_SDK_HYPOTHESIS_RUNTIME = "ai-sdk-hypothesis-provider/31";
22
+ export declare const AI_SDK_PURPOSE_PROBE_RUNTIME = "ai-sdk-future-purpose-probe/1";
23
+ export declare const AI_SDK_CRITIC_RUNTIME = "ai-sdk-reasoning-critic/32";
24
+ export declare const AI_SDK_TERMINAL_REVIEW_RUNTIME = "ai-sdk-terminal-reasoning-review/7";
25
+ export declare const AI_SDK_RESOLUTION_AUDIT_RUNTIME = "ai-sdk-critic-resolution-audit/4";
26
+ export declare const AI_SDK_GRAPH_SELECTION_RUNTIME = "ai-sdk-graph-selector/8";
27
+ export declare const AI_SDK_ANSWER_OBLIGATION_RUNTIME = "ai-sdk-answer-obligation-audit/4";
28
+ export declare const AI_SDK_GRAPH_PLANNING_RUNTIME = "ai-sdk-answer-obligation-and-graph-selector/3";
29
+ export declare const AI_SDK_DISCOURSE_RUNTIME = "ai-sdk-discourse-planner/3";
30
+ export declare const DETERMINISTIC_DISCOURSE_RUNTIME = "harness-discourse-aggregator/3";
31
+ export declare const AI_SDK_RENDER_RUNTIME = "ai-sdk-checkpoint-render/24";
32
+ export declare const AI_SDK_REPAIR_RUNTIME = "ai-sdk-semantic-draft-repair/13";
33
+ export declare function bytes(value: unknown): number;
34
+ export declare function observableTraceMessages(messages: readonly ModelMessage[]): unknown[];
35
+ export declare function emitObservableTrace(sink: ObservableLlmTraceSink | undefined, event: Omit<ObservableLlmTraceEvent, "excluded">): void;
36
+ export declare function reasoningMetrics(content: readonly unknown[]): {
37
+ reasoningPartCount: number;
38
+ reasoningBytes: number;
39
+ reasoningDetailsPresent: boolean;
40
+ };
41
+ export declare function numericUsage(value: unknown): number | null;
42
+ export declare function requestId(headers?: Record<string, string>, fallback?: string): string | null;
43
+ export declare class ReasoningWorkflowFailure extends Error {
44
+ readonly code: "continuation-coverage-unavailable" | "response-coverage-unavailable";
45
+ constructor(code: ReasoningWorkflowFailure["code"]);
46
+ }
47
+ export declare function classifyRuntimeFailure(error: unknown, lastStep?: Pick<ReasoningRuntimeDiagnostic, "finishReason" | "structuredOutputBytes" | "toolCallCount"> & Partial<Pick<ReasoningRuntimeDiagnostic, "lastHarnessPhase" | "sdkRuntime">>): string;
48
+ export declare function deepestError(error: unknown): unknown;
49
+ export declare function abortSource(signal: AbortSignal | undefined, error: unknown): ReasoningRuntimeDiagnostic["abortSource"];
50
+ export type HypothesisRejection = {
51
+ stage: NonNullable<ReasoningRuntimeDiagnostic["hypothesisRejectionStage"]>;
52
+ code: NonNullable<ReasoningRuntimeDiagnostic["hypothesisRejectionCode"]>;
53
+ };
54
+ export declare class HypothesisProviderRuntimeFailure extends Error {
55
+ readonly diagnostics: ReasoningRuntimeDiagnostic[];
56
+ readonly usage: {
57
+ inputTokens: number | null;
58
+ outputTokens: number | null;
59
+ };
60
+ constructor(diagnostics: ReasoningRuntimeDiagnostic[], usage: {
61
+ inputTokens: number | null;
62
+ outputTokens: number | null;
63
+ });
64
+ }
65
+ export declare class HypothesisHarnessRejection extends Error {
66
+ readonly rejection: HypothesisRejection;
67
+ constructor(rejection: HypothesisRejection);
68
+ }
69
+ export declare class ReasoningCriticHarnessRejection extends Error {
70
+ readonly code: string;
71
+ constructor(code: string);
72
+ }
73
+ export declare class CriticResolutionAuditHarnessRejection extends Error {
74
+ readonly code: string;
75
+ constructor(code: string);
76
+ }
77
+ export declare class GraphSelectionHarnessRejection extends Error {
78
+ readonly code: string;
79
+ constructor(code: string);
80
+ }
81
+ export declare class HypothesisReviewHarnessRejection extends Error {
82
+ readonly code: string;
83
+ constructor(code: string);
84
+ }
85
+ export declare class TerminalReviewHarnessRejection extends Error {
86
+ readonly code: string;
87
+ constructor(code: string);
88
+ }
89
+ export declare function classifyProviderHypothesisRejection(error: unknown): HypothesisRejection;
90
+ export declare function classifyHypothesisHarnessRejection(error: unknown): HypothesisRejection;
91
+ export declare function classifyReasoningCriticHarnessRejection(error: unknown): string;
92
+ export declare function classifyGraphSelectionHarnessRejection(error: unknown): string;
93
+ export declare function classifyGraphSelectionRuntimeFailure(error: unknown, lastStep?: Pick<ReasoningRuntimeDiagnostic, "finishReason" | "structuredOutputBytes" | "toolCallCount">): string;
@@ -0,0 +1,59 @@
1
+ import type { ReasoningPositionContext } from './poc-contracts.js';
2
+ import type { QuestionRoutingDecision } from './question-routing.js';
3
+ import type { WikibooksContextResult, WikibooksTarget } from './opening-source-contracts.js';
4
+ export type RecordedMoveAnalysis = {
5
+ version: string;
6
+ fenBefore: string;
7
+ fenAfter: string;
8
+ moveUci: string;
9
+ engine: string;
10
+ actualDepth: number;
11
+ requestedDepth: number;
12
+ classifierVersion: number;
13
+ classification: string;
14
+ beforeCp: number | null;
15
+ afterCp: number | null;
16
+ lossCp: number | null;
17
+ mateBefore: number | null;
18
+ mateAfter: number | null;
19
+ };
20
+ export type RecordedMainLine = {
21
+ selectedAtStart?: boolean;
22
+ startFen: string;
23
+ moves: Array<{
24
+ uci: string;
25
+ san: string;
26
+ edgeId: string;
27
+ analysis?: RecordedMoveAnalysis;
28
+ }>;
29
+ selectedIndex: number;
30
+ totalPlies: number;
31
+ truncated: boolean;
32
+ };
33
+ export type AnswerSelection = {
34
+ deliveryId: string;
35
+ selectionKey: string;
36
+ edgeId: string;
37
+ context: ReasoningPositionContext;
38
+ existingAnalysis: unknown;
39
+ };
40
+ export type AnswerRoutingPreparation = {
41
+ decision: QuestionRoutingDecision;
42
+ mainLine?: RecordedMainLine;
43
+ omitSelectedContext: boolean;
44
+ elapsedMs: number;
45
+ question: string;
46
+ selectionKey: string;
47
+ deliveryId: string;
48
+ };
49
+ export type AnswerHistoryPort = {
50
+ getMainLine?: (selected: AnswerSelection, signal?: AbortSignal) => Promise<RecordedMainLine>;
51
+ refreshContext?: (selected: AnswerSelection, signal?: AbortSignal) => Promise<{
52
+ existingAnalysis: unknown;
53
+ }>;
54
+ };
55
+ export type AnswerOpeningSession = {
56
+ initial: (signal?: AbortSignal) => Promise<WikibooksContextResult>;
57
+ gameReview: (line: RecordedMainLine, signal?: AbortSignal) => Promise<WikibooksContextResult>;
58
+ lookup: (targets: WikibooksTarget[], signal?: AbortSignal, root?: ReasoningPositionContext) => Promise<WikibooksContextResult>;
59
+ };