@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.
- package/LICENSE +235 -0
- package/LICENSING.md +26 -0
- package/NOTICE +5 -0
- package/NPM-PUBLISHING.md +28 -0
- package/README.md +139 -2
- package/SOURCE-ORIGIN.json +16 -0
- package/THIRD_PARTY_NOTICES.md +18 -0
- package/build.mjs +22 -0
- package/dist/answer-pipeline.test.mjs +375 -0
- package/dist/chunk-PLKNJRPF.js +10662 -0
- package/dist/chunk-XQDZJOYD.js +2515 -0
- package/dist/index.js +146 -0
- package/dist/owner-tests/chess-reasoning-compact-search-preparation.test.mjs +963 -0
- package/dist/owner-tests/mechanism-encoding.test.mjs +529 -0
- package/dist/owner-tests/move-mechanism-facts.test.mjs +396 -0
- package/dist/owner-tests/pipeline-host-preparation.test.mjs +10556 -0
- package/dist/owner-tests/position-preparation.test.mjs +625 -0
- package/dist/owner-tests/preparation-consolidation.test.mjs +1052 -0
- package/dist/owner-tests/prose-reference-admission.test.mjs +1770 -0
- package/dist/owner-tests/score-comparison-notices.test.mjs +240 -0
- package/dist/owner-tests/simple-engine-presentation.test.mjs +233 -0
- package/dist/owner-tests/tool-input-loop-guard.test.mjs +78 -0
- package/dist/research.js +2274 -0
- package/dist/runtime-closure.json +103 -0
- package/dist/shared-runtime-closure.json +39 -0
- package/dist/shared.js +152 -0
- package/dist/types/ai-request-failure.d.ts +14 -0
- package/dist/types/ai-request-limits.d.ts +4 -0
- package/dist/types/ai-routing-diagnostics.d.ts +14 -0
- package/dist/types/chess-reasoning/ablation-adaptive-evidence-loop.d.ts +127 -0
- package/dist/types/chess-reasoning/ablation-adaptive-runtime.d.ts +178 -0
- package/dist/types/chess-reasoning/ablation-direct-synthesis.d.ts +1030 -0
- package/dist/types/chess-reasoning/ablation-evidence-bundle.d.ts +185 -0
- package/dist/types/chess-reasoning/ablation-evidence-capture.d.ts +37 -0
- package/dist/types/chess-reasoning/ablation-lean-direct-runtime.d.ts +193 -0
- package/dist/types/chess-reasoning/ablation-model-facing-evidence.d.ts +38 -0
- package/dist/types/chess-reasoning/ablation-transport-correction.d.ts +13 -0
- package/dist/types/chess-reasoning/ai-sdk-runtime-support.d.ts +93 -0
- package/dist/types/chess-reasoning/answer-host-contracts.d.ts +59 -0
- package/dist/types/chess-reasoning/answer-model-connector.d.ts +68 -0
- package/dist/types/chess-reasoning/answer-pipeline-exports.d.ts +98 -0
- package/dist/types/chess-reasoning/answer-pipeline.d.ts +41 -0
- package/dist/types/chess-reasoning/answer-reference-validation.d.ts +40 -0
- package/dist/types/chess-reasoning/answer-tool-host.d.ts +8 -0
- package/dist/types/chess-reasoning/branch-expansion-policy.d.ts +13 -0
- package/dist/types/chess-reasoning/branch-expansion.d.ts +39 -0
- package/dist/types/chess-reasoning/causal-claim-checks.d.ts +21 -0
- package/dist/types/chess-reasoning/chess-reference-dictionary.d.ts +13 -0
- package/dist/types/chess-reasoning/classification-question-target.d.ts +22 -0
- package/dist/types/chess-reasoning/classification-reassessment.d.ts +31 -0
- package/dist/types/chess-reasoning/compact-search-preparation.d.ts +7 -0
- package/dist/types/chess-reasoning/concept-registry.d.ts +99 -0
- package/dist/types/chess-reasoning/conversation-context.d.ts +12 -0
- package/dist/types/chess-reasoning/engine-search-failure.d.ts +7 -0
- package/dist/types/chess-reasoning/evidence-citation-normalization.d.ts +9 -0
- package/dist/types/chess-reasoning/evidence-licenses.d.ts +57 -0
- package/dist/types/chess-reasoning/evidence-selector-contract.d.ts +5 -0
- package/dist/types/chess-reasoning/existing-analysis-context.d.ts +104 -0
- package/dist/types/chess-reasoning/fact-observation-provider.d.ts +15 -0
- package/dist/types/chess-reasoning/fact-provider.d.ts +111 -0
- package/dist/types/chess-reasoning/fresh-engine-pv-witnesses.d.ts +67 -0
- package/dist/types/chess-reasoning/historical-prose.d.ts +23 -0
- package/dist/types/chess-reasoning/idea-graph.d.ts +34 -0
- package/dist/types/chess-reasoning/initial-search-plan.d.ts +37 -0
- package/dist/types/chess-reasoning/lossless-evidence-sharing.d.ts +18 -0
- package/dist/types/chess-reasoning/matched-comparison.d.ts +10 -0
- package/dist/types/chess-reasoning/material-accounting.d.ts +80 -0
- package/dist/types/chess-reasoning/material-format.d.ts +4 -0
- package/dist/types/chess-reasoning/mechanical-fact-provider.d.ts +33 -0
- package/dist/types/chess-reasoning/mechanical-ray-facts.d.ts +19 -0
- package/dist/types/chess-reasoning/mechanism-presentation.d.ts +9 -0
- package/dist/types/chess-reasoning/move-mechanism-facts.d.ts +45 -0
- package/dist/types/chess-reasoning/native-answer-connector.d.ts +4 -0
- package/dist/types/chess-reasoning/opening-source-contracts.d.ts +54 -0
- package/dist/types/chess-reasoning/opening-source-credits.d.ts +16 -0
- package/dist/types/chess-reasoning/opponent-threat-preparation.d.ts +7 -0
- package/dist/types/chess-reasoning/piece-identities.d.ts +11 -0
- package/dist/types/chess-reasoning/poc-contracts.d.ts +1026 -0
- package/dist/types/chess-reasoning/poc-hypotheses.d.ts +74 -0
- package/dist/types/chess-reasoning/poc-move-witnesses.d.ts +13 -0
- package/dist/types/chess-reasoning/poc-observations.d.ts +23 -0
- package/dist/types/chess-reasoning/poc-piece-refs.d.ts +12 -0
- package/dist/types/chess-reasoning/poc-plan-model.d.ts +45 -0
- package/dist/types/chess-reasoning/poc-semantic-text.d.ts +8 -0
- package/dist/types/chess-reasoning/poc-tools.d.ts +81 -0
- package/dist/types/chess-reasoning/portable-answer-runtime.d.ts +291 -0
- package/dist/types/chess-reasoning/position-analysis-contracts.d.ts +31 -0
- package/dist/types/chess-reasoning/position-analysis-scope.d.ts +3 -0
- package/dist/types/chess-reasoning/preparation-consolidation.d.ts +21 -0
- package/dist/types/chess-reasoning/production-observation-provider.d.ts +16 -0
- package/dist/types/chess-reasoning/question-routing.d.ts +326 -0
- package/dist/types/chess-reasoning/recorded-main-line.d.ts +37 -0
- package/dist/types/chess-reasoning/recorded-position-tools.d.ts +11 -0
- package/dist/types/chess-reasoning/recorded-reference-context.d.ts +13 -0
- package/dist/types/chess-reasoning/recorded-selected-classification.d.ts +36 -0
- package/dist/types/chess-reasoning/reference-limits.d.ts +2 -0
- package/dist/types/chess-reasoning/research-exports.d.ts +197 -0
- package/dist/types/chess-reasoning/saved-score-presentation.d.ts +14 -0
- package/dist/types/chess-reasoning/score-comparison-notices.d.ts +33 -0
- package/dist/types/chess-reasoning/server-simple-policy.d.ts +31 -0
- package/dist/types/chess-reasoning/simple-agent-config.d.ts +73 -0
- package/dist/types/chess-reasoning/simple-board-analysis.d.ts +85 -0
- package/dist/types/chess-reasoning/simple-compact-evidence.d.ts +7 -0
- package/dist/types/chess-reasoning/simple-completion.d.ts +23 -0
- package/dist/types/chess-reasoning/simple-engine-presentation.d.ts +3 -0
- package/dist/types/chess-reasoning/simple-evidence-preparation.d.ts +17 -0
- package/dist/types/chess-reasoning/simple-evidence-view.d.ts +17 -0
- package/dist/types/chess-reasoning/simple-explanation-coverage.d.ts +90 -0
- package/dist/types/chess-reasoning/simple-fact-delivery.d.ts +43 -0
- package/dist/types/chess-reasoning/simple-fallback-premise.d.ts +5 -0
- package/dist/types/chess-reasoning/simple-prose-references.d.ts +108 -0
- package/dist/types/chess-reasoning/simple-runtime-version.d.ts +1 -0
- package/dist/types/chess-reasoning/stable.d.ts +2 -0
- package/dist/types/chess-reasoning/tool-input-loop-guard.d.ts +5 -0
- package/dist/types/chess-reasoning/types.d.ts +180 -0
- package/dist/types/chess-reasoning/visible-support-lines.d.ts +12 -0
- package/dist/types/chess-reasoning/wikibooks-index.d.ts +30 -0
- package/dist/types/chess-reasoning/wikibooks-tool-context.d.ts +10 -0
- package/dist/types/player-perspective.d.ts +16 -0
- package/dist/types/shared-exports.d.ts +22 -0
- package/docs/API.md +82 -0
- package/docs/OWNERSHIP-ADOPTION.md +35 -0
- package/docs/OWNERSHIP-DRIFT.json +55 -0
- package/docs/RESEARCH-API.md +28 -0
- package/licenses/third-party/INVENTORY.json +202 -0
- package/licenses/third-party/ai-7.0.85/LICENSE +13 -0
- package/licenses/third-party/ai-sdk--gateway-4.0.69/LICENSE +13 -0
- package/licenses/third-party/ai-sdk--provider-4.0.9/LICENSE +13 -0
- package/licenses/third-party/ai-sdk--provider-utils-5.0.34/APACHE-2.0.txt +73 -0
- package/licenses/third-party/ai-sdk--provider-utils-5.0.34/src/to-json-schema/zod3-to-json-schema/LICENSE +16 -0
- package/licenses/third-party/chess.js-1.4.0/LICENSE +23 -0
- package/licenses/third-party/eventsource-parser-3.1.1/LICENSE +21 -0
- package/licenses/third-party/json-schema-0.4.0/LICENSE +195 -0
- package/licenses/third-party/standard-schema--spec-1.1.0/LICENSE +21 -0
- package/licenses/third-party/types--json-schema-7.0.15/LICENSE +21 -0
- package/licenses/third-party/types--node-22.19.19/LICENSE +21 -0
- package/licenses/third-party/undici-7.30.0/LICENSE +21 -0
- package/licenses/third-party/undici-7.30.0/lib/web/fetch/LICENSE +21 -0
- package/licenses/third-party/undici-types-6.21.0/LICENSE +21 -0
- package/licenses/third-party/vercel--oidc-3.2.0/LICENSE +202 -0
- package/licenses/third-party/workflow--serde-4.1.0/APACHE-2.0.txt +73 -0
- package/licenses/third-party/workflow--serde-4.1.0/LICENSE.md +3 -0
- package/licenses/third-party/zod-4.6.5/LICENSE +21 -0
- package/npm-release.json +5 -0
- package/package.json +72 -4
- package/scripts/check-release-tooling.mjs +22 -0
- package/scripts/pack.mjs +68 -0
- package/scripts/publish-reviewed.mjs +85 -0
- package/scripts/release-tooling.json +13 -0
- package/scripts/update-dependency.mjs +44 -0
- package/scripts/verify-release.mjs +52 -0
- package/src/ai-request-failure.ts +34 -0
- package/src/ai-request-limits.ts +4 -0
- package/src/ai-routing-diagnostics.ts +33 -0
- package/src/chess-reasoning/ablation-adaptive-evidence-loop.ts +515 -0
- package/src/chess-reasoning/ablation-adaptive-runtime.ts +924 -0
- package/src/chess-reasoning/ablation-direct-synthesis.ts +1128 -0
- package/src/chess-reasoning/ablation-evidence-bundle.ts +726 -0
- package/src/chess-reasoning/ablation-evidence-capture.ts +513 -0
- package/src/chess-reasoning/ablation-lean-direct-runtime.ts +670 -0
- package/src/chess-reasoning/ablation-model-facing-evidence.ts +212 -0
- package/src/chess-reasoning/ablation-transport-correction.ts +106 -0
- package/src/chess-reasoning/ai-sdk-runtime-support.ts +381 -0
- package/src/chess-reasoning/answer-host-contracts.ts +10 -0
- package/src/chess-reasoning/answer-model-connector.ts +83 -0
- package/src/chess-reasoning/answer-pipeline-exports.ts +98 -0
- package/src/chess-reasoning/answer-pipeline.ts +195 -0
- package/src/chess-reasoning/answer-reference-validation.ts +124 -0
- package/src/chess-reasoning/answer-tool-host.ts +10 -0
- package/src/chess-reasoning/branch-expansion-policy.ts +32 -0
- package/src/chess-reasoning/branch-expansion.ts +80 -0
- package/src/chess-reasoning/causal-claim-checks.ts +256 -0
- package/src/chess-reasoning/chess-reference-dictionary.ts +21 -0
- package/src/chess-reasoning/classification-question-target.ts +30 -0
- package/src/chess-reasoning/classification-reassessment.ts +34 -0
- package/src/chess-reasoning/compact-search-preparation.ts +125 -0
- package/src/chess-reasoning/concept-registry.ts +275 -0
- package/src/chess-reasoning/conversation-context.ts +29 -0
- package/src/chess-reasoning/engine-search-failure.ts +11 -0
- package/src/chess-reasoning/evidence-citation-normalization.ts +15 -0
- package/src/chess-reasoning/evidence-licenses.ts +166 -0
- package/src/chess-reasoning/evidence-selector-contract.ts +5 -0
- package/src/chess-reasoning/existing-analysis-context.ts +544 -0
- package/src/chess-reasoning/fact-observation-provider.ts +134 -0
- package/src/chess-reasoning/fact-provider.ts +250 -0
- package/src/chess-reasoning/fresh-engine-pv-witnesses.ts +128 -0
- package/src/chess-reasoning/historical-prose.ts +116 -0
- package/src/chess-reasoning/idea-graph.ts +224 -0
- package/src/chess-reasoning/initial-search-plan.ts +115 -0
- package/src/chess-reasoning/lossless-evidence-sharing.ts +135 -0
- package/src/chess-reasoning/matched-comparison.ts +40 -0
- package/src/chess-reasoning/material-accounting.ts +55 -0
- package/src/chess-reasoning/material-format.ts +47 -0
- package/src/chess-reasoning/mechanical-fact-provider.ts +1602 -0
- package/src/chess-reasoning/mechanical-ray-facts.ts +123 -0
- package/src/chess-reasoning/mechanism-presentation.ts +94 -0
- package/src/chess-reasoning/move-mechanism-facts.ts +185 -0
- package/src/chess-reasoning/native-answer-connector.ts +13 -0
- package/src/chess-reasoning/opening-source-contracts.ts +47 -0
- package/src/chess-reasoning/opening-source-credits.ts +53 -0
- package/src/chess-reasoning/opponent-threat-preparation.ts +98 -0
- package/src/chess-reasoning/piece-identities.ts +159 -0
- package/src/chess-reasoning/poc-contracts.ts +1097 -0
- package/src/chess-reasoning/poc-hypotheses.ts +759 -0
- package/src/chess-reasoning/poc-move-witnesses.ts +170 -0
- package/src/chess-reasoning/poc-observations.ts +611 -0
- package/src/chess-reasoning/poc-piece-refs.ts +62 -0
- package/src/chess-reasoning/poc-plan-model.ts +345 -0
- package/src/chess-reasoning/poc-semantic-text.ts +10 -0
- package/src/chess-reasoning/poc-tools.ts +978 -0
- package/src/chess-reasoning/portable-answer-runtime.ts +684 -0
- package/src/chess-reasoning/position-analysis-contracts.ts +88 -0
- package/src/chess-reasoning/position-analysis-scope.ts +20 -0
- package/src/chess-reasoning/preparation-consolidation.ts +91 -0
- package/src/chess-reasoning/production-observation-provider.ts +41 -0
- package/src/chess-reasoning/question-routing.ts +332 -0
- package/src/chess-reasoning/recorded-main-line.ts +55 -0
- package/src/chess-reasoning/recorded-position-tools.ts +78 -0
- package/src/chess-reasoning/recorded-reference-context.ts +44 -0
- package/src/chess-reasoning/recorded-selected-classification.ts +54 -0
- package/src/chess-reasoning/reference-limits.ts +2 -0
- package/src/chess-reasoning/research-exports.ts +197 -0
- package/src/chess-reasoning/saved-score-presentation.ts +6 -0
- package/src/chess-reasoning/score-comparison-notices.ts +115 -0
- package/src/chess-reasoning/server-simple-policy.ts +75 -0
- package/src/chess-reasoning/simple-agent-config.ts +58 -0
- package/src/chess-reasoning/simple-board-analysis.ts +57 -0
- package/src/chess-reasoning/simple-compact-evidence.ts +79 -0
- package/src/chess-reasoning/simple-completion.ts +37 -0
- package/src/chess-reasoning/simple-engine-presentation.ts +95 -0
- package/src/chess-reasoning/simple-evidence-preparation.ts +32 -0
- package/src/chess-reasoning/simple-evidence-view.ts +69 -0
- package/src/chess-reasoning/simple-explanation-coverage.ts +118 -0
- package/src/chess-reasoning/simple-fact-delivery.ts +52 -0
- package/src/chess-reasoning/simple-fallback-premise.ts +65 -0
- package/src/chess-reasoning/simple-prose-references.ts +528 -0
- package/src/chess-reasoning/simple-runtime-version.ts +2 -0
- package/src/chess-reasoning/stable.ts +18 -0
- package/src/chess-reasoning/tool-input-loop-guard.ts +38 -0
- package/src/chess-reasoning/types.ts +195 -0
- package/src/chess-reasoning/visible-support-lines.ts +44 -0
- package/src/chess-reasoning/wikibooks-index.ts +56 -0
- package/src/chess-reasoning/wikibooks-tool-context.ts +91 -0
- package/src/player-perspective.ts +41 -0
- package/src/shared-exports.ts +23 -0
- package/test/answer-pipeline.test.mjs +375 -0
- package/test/owner/chess-reasoning-compact-search-preparation.test.mjs +111 -0
- package/test/owner/mechanism-encoding.test.mjs +78 -0
- package/test/owner/move-mechanism-facts.test.mjs +105 -0
- package/test/owner/pipeline-host-preparation.test.mjs +115 -0
- package/test/owner/position-preparation.test.mjs +22 -0
- package/test/owner/preparation-consolidation.test.mjs +74 -0
- package/test/owner/prose-reference-admission.test.mjs +26 -0
- package/test/owner/score-comparison-notices.test.mjs +116 -0
- package/test/owner/simple-engine-presentation.test.mjs +50 -0
- package/test/owner/tool-input-loop-guard.test.mjs +25 -0
- package/test-types.mts +23 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import type { Color, PieceSymbol, Square } from "chess.js";
|
|
2
|
+
|
|
3
|
+
export const CHESS_REASONING_SCHEMA_VERSION = "0.2.0" as const;
|
|
4
|
+
export const CHESS_REASONING_POLICY_VERSION = "shadow-2" as const;
|
|
5
|
+
|
|
6
|
+
export type BranchId = string;
|
|
7
|
+
export type PieceId = string;
|
|
8
|
+
export type EntityId = string;
|
|
9
|
+
export type EvidenceId = string;
|
|
10
|
+
export type CandidateId = string;
|
|
11
|
+
export type ConceptKey = string;
|
|
12
|
+
export type RegistryKey = string;
|
|
13
|
+
export type ProofStrength = "observed" | "supported" | "forced";
|
|
14
|
+
export type CandidateDisposition = "accepted" | "rejected" | "unsupported";
|
|
15
|
+
export type ConceptCoverage = "evaluated" | "partial" | "unsupported";
|
|
16
|
+
|
|
17
|
+
export type SemanticScalar = string | number | boolean | null;
|
|
18
|
+
export type SemanticValue = SemanticScalar | SemanticValue[] | { [key: string]: SemanticValue };
|
|
19
|
+
export type SemanticAttributes = Record<string, SemanticValue>;
|
|
20
|
+
|
|
21
|
+
export type SemanticReference = {
|
|
22
|
+
domain: RegistryKey;
|
|
23
|
+
id: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type SemanticParticipant = {
|
|
27
|
+
role: RegistryKey;
|
|
28
|
+
ref: SemanticReference;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type PieceIdentity = {
|
|
32
|
+
id: PieceId;
|
|
33
|
+
color: Color;
|
|
34
|
+
type: PieceSymbol;
|
|
35
|
+
originSquare: Square;
|
|
36
|
+
createdPly: number;
|
|
37
|
+
promotedFrom: PieceId | null;
|
|
38
|
+
capturedAtPly: number | null;
|
|
39
|
+
retiredAtPly: number | null;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type IdentityState = {
|
|
43
|
+
schemaVersion: typeof CHESS_REASONING_SCHEMA_VERSION;
|
|
44
|
+
branchId: BranchId;
|
|
45
|
+
fen: string;
|
|
46
|
+
ply: number;
|
|
47
|
+
pieces: Record<PieceId, PieceIdentity>;
|
|
48
|
+
squares: Partial<Record<Square, PieceId>>;
|
|
49
|
+
promotionSequence: number;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type MoveIdentityDelta = {
|
|
53
|
+
branchId: BranchId;
|
|
54
|
+
ply: number;
|
|
55
|
+
uci: string;
|
|
56
|
+
san: string;
|
|
57
|
+
mover: PieceId;
|
|
58
|
+
captured: PieceId | null;
|
|
59
|
+
promoted: PieceId | null;
|
|
60
|
+
rookMoved: PieceId | null;
|
|
61
|
+
beforeFen: string;
|
|
62
|
+
afterFen: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type ProposalReason = {
|
|
66
|
+
code: RegistryKey;
|
|
67
|
+
detail: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Candidates and persisted entities deliberately share generic semantic
|
|
72
|
+
* building blocks. Chess concepts are registry values in `concepts`; they do
|
|
73
|
+
* not add flags, fields, or concept-specific entity subclasses.
|
|
74
|
+
*/
|
|
75
|
+
export type SemanticCandidate = {
|
|
76
|
+
schemaVersion: typeof CHESS_REASONING_SCHEMA_VERSION;
|
|
77
|
+
id: CandidateId;
|
|
78
|
+
branchId: BranchId;
|
|
79
|
+
ply: number;
|
|
80
|
+
uci: string;
|
|
81
|
+
san: string;
|
|
82
|
+
entityType: RegistryKey;
|
|
83
|
+
concepts: ConceptKey[];
|
|
84
|
+
owner: Color | null;
|
|
85
|
+
participants: SemanticParticipant[];
|
|
86
|
+
attributes: SemanticAttributes;
|
|
87
|
+
proposalReasons: ProposalReason[];
|
|
88
|
+
verification: "not-requested";
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export type CandidateGenerationReport = {
|
|
92
|
+
schemaVersion: typeof CHESS_REASONING_SCHEMA_VERSION;
|
|
93
|
+
branchId: BranchId;
|
|
94
|
+
ply: number;
|
|
95
|
+
move: MoveIdentityDelta;
|
|
96
|
+
candidates: SemanticCandidate[];
|
|
97
|
+
conceptCoverage: Record<ConceptKey, ConceptCoverage>;
|
|
98
|
+
skipped: Array<{ concept: ConceptKey; reason: string }>;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type ProbeBudget = {
|
|
102
|
+
depth: number | null;
|
|
103
|
+
nodes: number | null;
|
|
104
|
+
timeMs: number | null;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export type EvidenceRecord = {
|
|
108
|
+
schemaVersion: typeof CHESS_REASONING_SCHEMA_VERSION;
|
|
109
|
+
id: EvidenceId;
|
|
110
|
+
candidateId: CandidateId;
|
|
111
|
+
disposition: CandidateDisposition;
|
|
112
|
+
proofStrength: ProofStrength | null;
|
|
113
|
+
summary: string;
|
|
114
|
+
engine: string;
|
|
115
|
+
engineBuild: string;
|
|
116
|
+
budget: ProbeBudget;
|
|
117
|
+
rootMovesCovered: string[];
|
|
118
|
+
unresolvedMoves: string[];
|
|
119
|
+
principalVariations: string[][];
|
|
120
|
+
scoreCp: number | null;
|
|
121
|
+
matePly: number | null;
|
|
122
|
+
replay: {
|
|
123
|
+
fen: string;
|
|
124
|
+
command: string;
|
|
125
|
+
} | null;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export type SemanticTransition = {
|
|
129
|
+
ply: number;
|
|
130
|
+
uci: string;
|
|
131
|
+
state: RegistryKey;
|
|
132
|
+
annotation: RegistryKey;
|
|
133
|
+
evidence: EvidenceId[];
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export type SemanticEntity = {
|
|
137
|
+
schemaVersion: typeof CHESS_REASONING_SCHEMA_VERSION;
|
|
138
|
+
id: EntityId;
|
|
139
|
+
branchId: BranchId;
|
|
140
|
+
entityType: RegistryKey;
|
|
141
|
+
concepts: ConceptKey[];
|
|
142
|
+
owner: Color | null;
|
|
143
|
+
createdByPly: number;
|
|
144
|
+
createdByUci: string;
|
|
145
|
+
participants: SemanticParticipant[];
|
|
146
|
+
attributes: SemanticAttributes;
|
|
147
|
+
proofStrength: ProofStrength | null;
|
|
148
|
+
state: RegistryKey;
|
|
149
|
+
evidence: EvidenceId[];
|
|
150
|
+
transitions: SemanticTransition[];
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export type SemanticRelation = {
|
|
154
|
+
id: string;
|
|
155
|
+
branchId: BranchId;
|
|
156
|
+
relationType: RegistryKey;
|
|
157
|
+
from: EntityId;
|
|
158
|
+
to: EntityId;
|
|
159
|
+
createdAtPly: number;
|
|
160
|
+
attributes: SemanticAttributes;
|
|
161
|
+
evidence: EvidenceId[];
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export type IdeaGraph = {
|
|
165
|
+
schemaVersion: typeof CHESS_REASONING_SCHEMA_VERSION;
|
|
166
|
+
policyVersion: typeof CHESS_REASONING_POLICY_VERSION;
|
|
167
|
+
branchId: BranchId;
|
|
168
|
+
ply: number;
|
|
169
|
+
inputHash: string;
|
|
170
|
+
entities: SemanticEntity[];
|
|
171
|
+
relations: SemanticRelation[];
|
|
172
|
+
candidateOutcomes: Array<{
|
|
173
|
+
candidateId: CandidateId;
|
|
174
|
+
disposition: CandidateDisposition;
|
|
175
|
+
evidence: EvidenceId[];
|
|
176
|
+
}>;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export type SemanticMoveRecord = {
|
|
180
|
+
schemaVersion: typeof CHESS_REASONING_SCHEMA_VERSION;
|
|
181
|
+
identity: IdentityState;
|
|
182
|
+
generation: CandidateGenerationReport;
|
|
183
|
+
evidence: EvidenceRecord[];
|
|
184
|
+
graph: IdeaGraph;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export type ToolSupport = "supported" | "insufficient-evidence" | "unsupported-concept";
|
|
188
|
+
|
|
189
|
+
export type ReasoningToolResponse<T> = {
|
|
190
|
+
schemaVersion: typeof CHESS_REASONING_SCHEMA_VERSION;
|
|
191
|
+
support: ToolSupport;
|
|
192
|
+
answer: T | null;
|
|
193
|
+
evidence: EvidenceId[];
|
|
194
|
+
limitations: string[];
|
|
195
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Chess } from 'chess.js';
|
|
2
|
+
import { historicalProseRoots, type RecordedReferenceLine } from './historical-prose';
|
|
3
|
+
import { simpleProseReferences, type SimpleReference } from './simple-prose-references';
|
|
4
|
+
import { reasoningContextHash, type ReasoningPositionContext, type ReasoningEvidenceRecord } from './poc-contracts';
|
|
5
|
+
|
|
6
|
+
/** Expose only a path the answer already explicitly referenced and admission verified. */
|
|
7
|
+
export function visibleSupportLines(answer: string, context: ReasoningPositionContext,
|
|
8
|
+
records: readonly ReasoningEvidenceRecord[], recordedLine?: RecordedReferenceLine) {
|
|
9
|
+
const view = simpleProseReferences(answer, context, records, recordedLine);
|
|
10
|
+
const historical = historicalProseRoots(context, records, recordedLine);
|
|
11
|
+
const refs = view.blocks.flatMap(block => block.tokens.flatMap(token => token.reference ? [token.reference] : []));
|
|
12
|
+
const rootKey = (r: SimpleReference) => JSON.stringify([reasoningContextHash(r.position.recordedContext ?? context), r.position.start]);
|
|
13
|
+
const path = (r: SimpleReference) => r.position.moves.map(m => m.uci);
|
|
14
|
+
const isPrefix = (a: string[], b: string[]) => a.length <= b.length && a.every((m,i) => m === b[i]);
|
|
15
|
+
const candidates = refs.filter(r => path(r).length > 1);
|
|
16
|
+
const maximal = candidates.filter((r,i) => !candidates.some((other,j) => rootKey(r) === rootKey(other)
|
|
17
|
+
&& isPrefix(path(r),path(other)) && (path(r).length < path(other).length || j < i)));
|
|
18
|
+
const additions: Array<{target:string;label:string;evidenceIds:string[];authority:string}> = [];
|
|
19
|
+
for (const ref of maximal) {
|
|
20
|
+
const moves = path(ref);
|
|
21
|
+
const visible = new Set(refs.filter(r => r.kind === 'move' && rootKey(r) === rootKey(ref)
|
|
22
|
+
&& isPrefix(path(r),moves)).map(r => path(r).length));
|
|
23
|
+
if (moves.every((_,i) => visible.has(i+1))) continue;
|
|
24
|
+
const rootContext = ref.position.recordedContext ?? context;
|
|
25
|
+
let target = `move:${ref.position.start}:${moves.join(',')}`;
|
|
26
|
+
if (ref.position.recordedContext) {
|
|
27
|
+
const root = [...historical.roots].find(([,value]) => reasoningContextHash(value.context) === reasoningContextHash(rootContext));
|
|
28
|
+
if (!root) continue;
|
|
29
|
+
target = `game:${root[0]}:${moves.join(',')}`;
|
|
30
|
+
}
|
|
31
|
+
const board = new Chess(ref.position.start === 'before' ? rootContext.fenBefore : rootContext.fenAfter);
|
|
32
|
+
const label = moves.map(uci => {
|
|
33
|
+
const [,turn,,,,number] = board.fen().split(' ');
|
|
34
|
+
const san = board.move({from:uci.slice(0,2),to:uci.slice(2,4),promotion:uci[4]}).san;
|
|
35
|
+
return `${number}${turn === 'w' ? '.' : '...'}${san}`;
|
|
36
|
+
}).join(' ');
|
|
37
|
+
const line = `[${label}](${target})`;
|
|
38
|
+
// Square/piece admission alone must never broaden move-path authority.
|
|
39
|
+
const checked = simpleProseReferences(line,context,records,recordedLine);
|
|
40
|
+
if (checked.coverage.resolved !== 1 || checked.gaps.some(g => !g.startsWith('Unbound text:'))) continue;
|
|
41
|
+
additions.push({target,label,evidenceIds:ref.evidenceIds,authority:'Existing admitted reference path; not proof of best play, force or purpose.'});
|
|
42
|
+
}
|
|
43
|
+
return {answer: answer + additions.map(a => `\n\nReferenced line: [${a.label}](${a.target}).`).join(''), additions};
|
|
44
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Chess } from 'chess.js';
|
|
2
|
+
const ROOT = 'Chess Opening Theory';
|
|
3
|
+
export type WikibooksIndexData = { v: number; at: string; run: string; extractor: string; entries: string[][] };
|
|
4
|
+
export type IndexedOpening = { title: string; canonicalTitle: string; positionKey: string; plies: number };
|
|
5
|
+
export type WikibooksIndex = { at: string; byPath: Map<string, IndexedOpening[]>; byPosition: Map<string, IndexedOpening[]> };
|
|
6
|
+
export function openingTitle(moves: string[]): string {
|
|
7
|
+
return ROOT + '/' + moves.map((san, ply) => `${Math.floor(ply / 2) + 1}${ply % 2 ? '...' : '. '}${san.replace(/[+#?!]+$/g, '')}`).join('/');
|
|
8
|
+
}
|
|
9
|
+
export function decodeWikibooksIndex(data: WikibooksIndexData): WikibooksIndex {
|
|
10
|
+
if (data.v !== 1 || !data.at || !Array.isArray(data.entries) || data.entries.length > 20_000) throw Error('Invalid opening catalog');
|
|
11
|
+
const byPath = new Map<string, IndexedOpening[]>(), byPosition = new Map<string, IndexedOpening[]>();
|
|
12
|
+
for (const row of data.entries) {
|
|
13
|
+
if (row.length < 2 || row.length > 3 || row.some(x => typeof x !== 'string')) throw Error('Invalid opening catalog row');
|
|
14
|
+
const moves = row[0].split(' '), canonicalTitle = openingTitle(moves);
|
|
15
|
+
const entry = {title: row[2] ? ROOT + '/' + row[2] : canonicalTitle, canonicalTitle, positionKey: row[1], plies: moves.length};
|
|
16
|
+
for (const [map, key] of [[byPath, canonicalTitle], [byPosition, entry.positionKey]] as const) {
|
|
17
|
+
const values = map.get(key) || []; values.push(entry); map.set(key, values);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return {at: data.at, byPath, byPosition};
|
|
21
|
+
}
|
|
22
|
+
export function positionKey(fen: string): string { return fen.split(' ').slice(0, 4).join(' '); }
|
|
23
|
+
/** Normalize only title notation; every move must replay legally with its actual side/number. */
|
|
24
|
+
export function replayWikibooksTitle(title: string): string | null {
|
|
25
|
+
if (title === ROOT) return new Chess().fen();
|
|
26
|
+
if (!title.startsWith(ROOT + '/')) return null;
|
|
27
|
+
const board = new Chess();
|
|
28
|
+
try {
|
|
29
|
+
for (const part of title.slice(ROOT.length + 1).replace(/\/$/, '').split('/')) {
|
|
30
|
+
const tokens = part.trim().replace(/…/g, '...').replace(/^\d+\s*\.+\s*/, '').split(/\s+/);
|
|
31
|
+
for (const token of tokens) {
|
|
32
|
+
const moveText = token.replace(/0/g, 'O').replace(/[+#?!]+$/g, '');
|
|
33
|
+
if (!/^[KQRBN]?[a-h]?[1-8]?x?[a-h][1-8](?:=[QRBN])?$|^O-O(?:-O)?$/.test(moveText)) return null;
|
|
34
|
+
board.move(moveText);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return board.fen();
|
|
38
|
+
} catch { return null; }
|
|
39
|
+
}
|
|
40
|
+
export type IndexedSelection = { entry: IndexedOpening; requestedTitle: string; ancestorPlies: number; transposition: boolean };
|
|
41
|
+
export function selectIndexedOpening(index: WikibooksIndex, title: string, maxAncestorPlies = 2, minSourcePlies = 0): IndexedSelection | null {
|
|
42
|
+
let ancestor = title;
|
|
43
|
+
for (let distance = 0; distance <= maxAncestorPlies && ancestor !== ROOT; distance++) {
|
|
44
|
+
const fen = replayWikibooksTitle(ancestor);
|
|
45
|
+
if (!fen) return null;
|
|
46
|
+
const key = positionKey(fen), exact = index.byPath.get(ancestor) || [];
|
|
47
|
+
const candidates = [...exact, ...(index.byPosition.get(key) || []).filter(e => !exact.includes(e))];
|
|
48
|
+
for (const entry of candidates) {
|
|
49
|
+
const actual = replayWikibooksTitle(entry.title);
|
|
50
|
+
if (entry.plies >= minSourcePlies && entry.positionKey === key && actual && positionKey(actual) === key)
|
|
51
|
+
return {entry, requestedTitle: title, ancestorPlies: distance, transposition: entry.canonicalTitle !== ancestor};
|
|
52
|
+
}
|
|
53
|
+
ancestor = ancestor.slice(0, ancestor.lastIndexOf('/'));
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { openingTitle, positionKey, type WikibooksIndex } from './wikibooks-index';
|
|
2
|
+
import { recordedEvidenceContext, recordedDetailsMatch } from './recorded-reference-context';
|
|
3
|
+
import { Chess } from 'chess.js';
|
|
4
|
+
import { reasoningContextHash, validateReasoningPositionContext, type ReasoningPositionContext, type ReasoningToolResult } from './poc-contracts';
|
|
5
|
+
import { type WikibooksTarget } from './opening-source-contracts';
|
|
6
|
+
|
|
7
|
+
const object = (value: unknown): Record<string, unknown> => value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {};
|
|
8
|
+
const ucis = (value: unknown): string[] | null => Array.isArray(value) && value.every(v => typeof v === 'string' && /^[a-h][1-8][a-h][1-8][qrbn]?$/.test(v)) ? value : null;
|
|
9
|
+
|
|
10
|
+
/** Legacy unfiltered planner; production uses the indexed entrypoint below. */
|
|
11
|
+
export function wikibooksTargetsForTool(context: ReasoningPositionContext, name: string, args: Record<string, unknown>, result: ReasoningToolResult): WikibooksTarget[] {
|
|
12
|
+
return targetsForTool(context,name,args,result).targets;
|
|
13
|
+
}
|
|
14
|
+
export function wikibooksTargetsForToolIndexed(context: ReasoningPositionContext, name: string, args: Record<string, unknown>, result: ReasoningToolResult, catalog: WikibooksIndex) {
|
|
15
|
+
return targetsForTool(context,name,args,result,catalog);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Check board positions before allocating possibly long page-address strings.
|
|
19
|
+
* Ancestors follow the actual replayed path, including tool continuations. */
|
|
20
|
+
function targetsForTool(context: ReasoningPositionContext, name: string, args: Record<string, unknown>, result: ReasoningToolResult, catalog?: WikibooksIndex): {targets:WikibooksTarget[];positionChecks:number;candidateCount:number} {
|
|
21
|
+
const empty = () => ({targets:[] as WikibooksTarget[],positionChecks:0,candidateCount:0});
|
|
22
|
+
if (result.contextHash !== reasoningContextHash(context) || result.tool !== name) return empty();
|
|
23
|
+
if (name === 'analyze_game_position' || name === 'test_game_line') {
|
|
24
|
+
try {
|
|
25
|
+
const root = recordedEvidenceContext(context,result.data.recordedPosition), details = object(result.data.details);
|
|
26
|
+
if (Number(args.ply) !== Number(object(result.data.recordedPosition).ply) || !recordedDetailsMatch(root,details)) return empty();
|
|
27
|
+
const mapped = name === 'test_game_line' ? 'test_line' : args.rootMoves ? 'compare_moves' : 'explore_continuations';
|
|
28
|
+
return targetsForTool(root,mapped,{...args,phase:'after',...(args.rootMoves?{movesUci:args.rootMoves}:{})},
|
|
29
|
+
{...result,tool:mapped,contextHash:reasoningContextHash(root),data:details as ReasoningToolResult['data']},catalog);
|
|
30
|
+
} catch { return empty(); }
|
|
31
|
+
}
|
|
32
|
+
if (!['analyze_move','inspect_position','compare_moves','enumerate_defenses','explore_continuations','test_line'].includes(name)) return empty();
|
|
33
|
+
try {
|
|
34
|
+
validateReasoningPositionContext(context);
|
|
35
|
+
const board = new Chess();
|
|
36
|
+
if (context.historyStartFen && new Chess(context.historyStartFen).fen() !== board.fen()) return empty();
|
|
37
|
+
const sans:string[] = [], fens = [board.fen()];
|
|
38
|
+
for (const uci of [...context.historyUci,...(context.kind === 'position'?[]:[context.moveUci])]) {
|
|
39
|
+
sans.push(board.move({from:uci.slice(0,2),to:uci.slice(2,4),promotion:uci[4]}).san); fens.push(board.fen());
|
|
40
|
+
}
|
|
41
|
+
if (board.fen() !== new Chess(context.fenAfter).fen()) return empty();
|
|
42
|
+
const targets = new Map<string,WikibooksTarget>(), seen = new Set<string>();
|
|
43
|
+
let positionChecks=0,candidateCount=0;
|
|
44
|
+
const add = (moves:string[],positions:string[],relation:WikibooksTarget['relation']) => {
|
|
45
|
+
const key=moves.join(' ');
|
|
46
|
+
if (seen.has(key)) return;
|
|
47
|
+
seen.add(key); candidateCount++;
|
|
48
|
+
if (!catalog) {const title=moves.length?openingTitle(moves):'Chess Opening Theory';targets.set(title,{title,relation});return;}
|
|
49
|
+
for (let distance=0;distance<=2 && moves.length-distance>0;distance++) {
|
|
50
|
+
positionChecks++;
|
|
51
|
+
if (!catalog.byPosition.has(positionKey(positions[moves.length-distance]))) continue;
|
|
52
|
+
const title=openingTitle(moves);
|
|
53
|
+
if (!targets.has(title)) targets.set(title,{title,relation});
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const beforeLength=context.kind === 'position'?sans.length:sans.length-1;
|
|
58
|
+
if (name === 'analyze_move') {
|
|
59
|
+
if(context.kind !== 'position')add(sans.slice(0,beforeLength),fens.slice(0,beforeLength+1),'before');
|
|
60
|
+
add(sans,fens,'current'); return {targets:[...targets.values()],positionChecks,candidateCount};
|
|
61
|
+
}
|
|
62
|
+
const phase=name === 'enumerate_defenses'?'after':args.phase??'after';
|
|
63
|
+
if (phase !== 'before' && phase !== 'after') return empty();
|
|
64
|
+
const length=phase === 'before'?beforeLength:sans.length, baseSans=sans.slice(0,length), baseFens=fens.slice(0,length+1), fen=baseFens.at(-1)!;
|
|
65
|
+
const data=object(result.data),scope=object(data.searchScope);
|
|
66
|
+
if (data.phase !== undefined && data.phase !== phase || name !== 'test_line' && scope.fen !== undefined && scope.fen !== fen) return empty();
|
|
67
|
+
add(baseSans,baseFens,phase === 'before' && context.kind !== 'position'?'before':'current');
|
|
68
|
+
const path=(moves:string[],expectedFen?:string) => {
|
|
69
|
+
const branch=new Chess(fen), branchSans=[...baseSans],branchFens=[...baseFens];
|
|
70
|
+
try {
|
|
71
|
+
for(const uci of moves){branchSans.push(branch.move({from:uci.slice(0,2),to:uci.slice(2,4),promotion:uci[4]}).san);branchFens.push(branch.fen());}
|
|
72
|
+
if(expectedFen && branch.fen()!==expectedFen)return false;
|
|
73
|
+
for(let end=baseSans.length+1;end<=branchSans.length;end++)add(branchSans.slice(0,end),branchFens.slice(0,end+1),'continuation');
|
|
74
|
+
return true;
|
|
75
|
+
} catch {return false;}
|
|
76
|
+
};
|
|
77
|
+
if(name === 'compare_moves' || name === 'enumerate_defenses'){
|
|
78
|
+
const requested=ucis(name === 'compare_moves'?args.movesUci:args.rootMoves)??[],returned=ucis(data.rootMoves)??[];
|
|
79
|
+
for(const move of new Set([...requested,...returned]))path([move]);
|
|
80
|
+
} else if(name === 'test_line'){
|
|
81
|
+
const moves=ucis(args.movesUci);
|
|
82
|
+
if(!moves || moves.length>32 || typeof data.finalFen!=='string' || !path(moves,data.finalFen))return empty();
|
|
83
|
+
if(scope.fen===data.finalFen && Array.isArray(data.lines))for(const candidate of data.lines){
|
|
84
|
+
const line=object(candidate),pv=ucis(line.pv);if(pv?.length && line.rootMove===pv[0])path([...moves,...pv].slice(0,32));
|
|
85
|
+
}
|
|
86
|
+
} else if(name === 'explore_continuations' && scope.fen===fen && Array.isArray(data.lines))for(const candidate of data.lines){
|
|
87
|
+
const line=object(candidate),pv=ucis(line.pv);if(pv?.length && line.rootMove===pv[0])path(pv.slice(0,32));
|
|
88
|
+
}
|
|
89
|
+
return {targets:[...targets.values()],positionChecks,candidateCount};
|
|
90
|
+
} catch {return empty();}
|
|
91
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type PlayerPerspective = Readonly<{
|
|
2
|
+
side: "white" | "black";
|
|
3
|
+
basis: "linked-lichess-identity" | "chesscom-lookup-handle";
|
|
4
|
+
}>;
|
|
5
|
+
|
|
6
|
+
export type PlayerPerspectiveIdentity = Readonly<{
|
|
7
|
+
provider: string;
|
|
8
|
+
providerUserId: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
}>;
|
|
11
|
+
|
|
12
|
+
function normalizedPlayerName(value: unknown) {
|
|
13
|
+
return String(value || "").trim().toLocaleLowerCase();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function uniquelyMatchedSide(white: string, black: string, names: readonly string[]): PlayerPerspective["side"] | null {
|
|
17
|
+
const candidates = new Set(names.map(normalizedPlayerName).filter(Boolean));
|
|
18
|
+
if (!candidates.size) return null;
|
|
19
|
+
const whiteMatch = candidates.has(normalizedPlayerName(white));
|
|
20
|
+
const blackMatch = candidates.has(normalizedPlayerName(black));
|
|
21
|
+
return whiteMatch === blackMatch ? null : whiteMatch ? "white" : "black";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Resolve the current viewer's side without using board orientation or stored game data. */
|
|
25
|
+
export function resolvePlayerPerspective(input: {
|
|
26
|
+
white: string;
|
|
27
|
+
black: string;
|
|
28
|
+
providerIdentities?: readonly PlayerPerspectiveIdentity[];
|
|
29
|
+
chessComLookupHandle?: string;
|
|
30
|
+
}): PlayerPerspective | null {
|
|
31
|
+
const lichessNames = (input.providerIdentities || [])
|
|
32
|
+
.filter((identity) => identity.provider === "lichess")
|
|
33
|
+
.flatMap((identity) => [identity.providerUserId, identity.displayName]);
|
|
34
|
+
const lichessSide = uniquelyMatchedSide(input.white, input.black, lichessNames);
|
|
35
|
+
const chessComSide = uniquelyMatchedSide(input.white, input.black, [input.chessComLookupHandle || ""]);
|
|
36
|
+
if (lichessSide && chessComSide && lichessSide !== chessComSide) return null;
|
|
37
|
+
if (lichessSide) return { side: lichessSide, basis: "linked-lichess-identity" };
|
|
38
|
+
if (chessComSide) return { side: chessComSide, basis: "chesscom-lookup-handle" };
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Pure host protocol, presentation and error helpers; no model connector or answer loop. */
|
|
2
|
+
export * from './ai-request-failure';
|
|
3
|
+
export * from './ai-request-limits';
|
|
4
|
+
export * from './ai-routing-diagnostics';
|
|
5
|
+
export * from './player-perspective';
|
|
6
|
+
export {validateReasoningPositionContext,reasoningContextHash,createContextEvidence,createQueryContract,DEFAULT_REASONING_RUN_CONTROLS,REASONING_POC_VERSION} from './chess-reasoning/poc-contracts';
|
|
7
|
+
export {toPositionAnalysis,toLegacyPositionAnalysis,toPositionAnalysisProvider,toLegacyPositionAnalysisProvider} from './chess-reasoning/position-analysis-contracts';
|
|
8
|
+
export {simpleProseReferences,SIMPLE_REFERENCE_VERSION,safeSimpleSourceLink,decorateSimpleVariations,repairFrozenCitationLabels,stripSimpleMarkdownFences,stripSimpleCitationLinks} from './chess-reasoning/simple-prose-references';
|
|
9
|
+
export {admitFreshEnginePvWitnesses,MAX_FRESH_ENGINE_WITNESS_ACQUISITIONS} from './chess-reasoning/fresh-engine-pv-witnesses';
|
|
10
|
+
export {MAX_INTERACTIVE_LINE_PLIES} from './chess-reasoning/reference-limits';
|
|
11
|
+
export {recordedMainLineResult} from './chess-reasoning/recorded-main-line';
|
|
12
|
+
export {recordedNavigation,historyPositionContext} from './chess-reasoning/recorded-reference-context';
|
|
13
|
+
export {classificationTargetAtSelection} from './chess-reasoning/classification-question-target';
|
|
14
|
+
export {scopePositionAnalysis} from './chess-reasoning/position-analysis-scope';
|
|
15
|
+
export {priorConversationMessages} from './chess-reasoning/conversation-context';
|
|
16
|
+
export {parseOpeningSourceCredits,openingSourceLinks,OPENING_SOURCE_LICENSE_URL,openingSourcesInMessages} from './chess-reasoning/opening-source-credits';
|
|
17
|
+
export {openingTitle,positionKey,replayWikibooksTitle,selectIndexedOpening,decodeWikibooksIndex} from './chess-reasoning/wikibooks-index';
|
|
18
|
+
export {QUESTION_ROUTING_VERSION,classifyQuestionRoutingAnswers,classifyReviewSubject,makeQuestionRoutingRequest,parseQuestionRoutingAnswers,hasMoveClassificationQuestion,moveSectionScope,REVIEW_SUBJECTS} from './chess-reasoning/question-routing';
|
|
19
|
+
export {SIMPLE_TOOL_AGENT_VERSION} from './chess-reasoning/simple-runtime-version';
|
|
20
|
+
export {SIMPLE_MODEL_CATALOGUE,simpleEffortsForModel,validateSimpleAgentConfig,selectSimpleModel,SIMPLE_EXTENSION_CONFIGS,SIMPLE_VENDOR_CONFIGS,EVALUATED_ASTRA_CONFIG} from './chess-reasoning/simple-agent-config';
|
|
21
|
+
export {hasSharedEvidence,expandSharedEvidence,EVIDENCE_SHARING_VERSION,shareEvidence,shareEvidenceMessages} from './chess-reasoning/lossless-evidence-sharing';
|
|
22
|
+
// Public types are erased and do not bring the pipeline into a browser runtime.
|
|
23
|
+
export type * from './chess-reasoning/answer-pipeline-exports';
|