@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,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"runtimeInputs": [
|
|
3
|
+
"src/ai-request-failure.ts",
|
|
4
|
+
"src/ai-request-limits.ts",
|
|
5
|
+
"src/ai-routing-diagnostics.ts",
|
|
6
|
+
"src/chess-reasoning/ablation-adaptive-evidence-loop.ts",
|
|
7
|
+
"src/chess-reasoning/ablation-adaptive-runtime.ts",
|
|
8
|
+
"src/chess-reasoning/ablation-direct-synthesis.ts",
|
|
9
|
+
"src/chess-reasoning/ablation-evidence-bundle.ts",
|
|
10
|
+
"src/chess-reasoning/ablation-evidence-capture.ts",
|
|
11
|
+
"src/chess-reasoning/ablation-lean-direct-runtime.ts",
|
|
12
|
+
"src/chess-reasoning/ablation-model-facing-evidence.ts",
|
|
13
|
+
"src/chess-reasoning/ablation-transport-correction.ts",
|
|
14
|
+
"src/chess-reasoning/ai-sdk-runtime-support.ts",
|
|
15
|
+
"src/chess-reasoning/answer-model-connector.ts",
|
|
16
|
+
"src/chess-reasoning/answer-pipeline-exports.ts",
|
|
17
|
+
"src/chess-reasoning/answer-pipeline.ts",
|
|
18
|
+
"src/chess-reasoning/answer-reference-validation.ts",
|
|
19
|
+
"src/chess-reasoning/answer-tool-host.ts",
|
|
20
|
+
"src/chess-reasoning/branch-expansion-policy.ts",
|
|
21
|
+
"src/chess-reasoning/branch-expansion.ts",
|
|
22
|
+
"src/chess-reasoning/causal-claim-checks.ts",
|
|
23
|
+
"src/chess-reasoning/chess-reference-dictionary.ts",
|
|
24
|
+
"src/chess-reasoning/classification-question-target.ts",
|
|
25
|
+
"src/chess-reasoning/classification-reassessment.ts",
|
|
26
|
+
"src/chess-reasoning/compact-search-preparation.ts",
|
|
27
|
+
"src/chess-reasoning/concept-registry.ts",
|
|
28
|
+
"src/chess-reasoning/conversation-context.ts",
|
|
29
|
+
"src/chess-reasoning/engine-search-failure.ts",
|
|
30
|
+
"src/chess-reasoning/evidence-citation-normalization.ts",
|
|
31
|
+
"src/chess-reasoning/evidence-licenses.ts",
|
|
32
|
+
"src/chess-reasoning/existing-analysis-context.ts",
|
|
33
|
+
"src/chess-reasoning/fact-observation-provider.ts",
|
|
34
|
+
"src/chess-reasoning/fact-provider.ts",
|
|
35
|
+
"src/chess-reasoning/fresh-engine-pv-witnesses.ts",
|
|
36
|
+
"src/chess-reasoning/historical-prose.ts",
|
|
37
|
+
"src/chess-reasoning/idea-graph.ts",
|
|
38
|
+
"src/chess-reasoning/initial-search-plan.ts",
|
|
39
|
+
"src/chess-reasoning/lossless-evidence-sharing.ts",
|
|
40
|
+
"src/chess-reasoning/matched-comparison.ts",
|
|
41
|
+
"src/chess-reasoning/material-accounting.ts",
|
|
42
|
+
"src/chess-reasoning/material-format.ts",
|
|
43
|
+
"src/chess-reasoning/mechanical-fact-provider.ts",
|
|
44
|
+
"src/chess-reasoning/mechanical-ray-facts.ts",
|
|
45
|
+
"src/chess-reasoning/mechanism-presentation.ts",
|
|
46
|
+
"src/chess-reasoning/move-mechanism-facts.ts",
|
|
47
|
+
"src/chess-reasoning/native-answer-connector.ts",
|
|
48
|
+
"src/chess-reasoning/opening-source-credits.ts",
|
|
49
|
+
"src/chess-reasoning/opponent-threat-preparation.ts",
|
|
50
|
+
"src/chess-reasoning/piece-identities.ts",
|
|
51
|
+
"src/chess-reasoning/poc-contracts.ts",
|
|
52
|
+
"src/chess-reasoning/poc-hypotheses.ts",
|
|
53
|
+
"src/chess-reasoning/poc-move-witnesses.ts",
|
|
54
|
+
"src/chess-reasoning/poc-observations.ts",
|
|
55
|
+
"src/chess-reasoning/poc-piece-refs.ts",
|
|
56
|
+
"src/chess-reasoning/poc-plan-model.ts",
|
|
57
|
+
"src/chess-reasoning/poc-semantic-text.ts",
|
|
58
|
+
"src/chess-reasoning/poc-tools.ts",
|
|
59
|
+
"src/chess-reasoning/portable-answer-runtime.ts",
|
|
60
|
+
"src/chess-reasoning/position-analysis-contracts.ts",
|
|
61
|
+
"src/chess-reasoning/position-analysis-scope.ts",
|
|
62
|
+
"src/chess-reasoning/preparation-consolidation.ts",
|
|
63
|
+
"src/chess-reasoning/production-observation-provider.ts",
|
|
64
|
+
"src/chess-reasoning/question-routing.ts",
|
|
65
|
+
"src/chess-reasoning/recorded-main-line.ts",
|
|
66
|
+
"src/chess-reasoning/recorded-position-tools.ts",
|
|
67
|
+
"src/chess-reasoning/recorded-reference-context.ts",
|
|
68
|
+
"src/chess-reasoning/recorded-selected-classification.ts",
|
|
69
|
+
"src/chess-reasoning/reference-limits.ts",
|
|
70
|
+
"src/chess-reasoning/research-exports.ts",
|
|
71
|
+
"src/chess-reasoning/saved-score-presentation.ts",
|
|
72
|
+
"src/chess-reasoning/score-comparison-notices.ts",
|
|
73
|
+
"src/chess-reasoning/server-simple-policy.ts",
|
|
74
|
+
"src/chess-reasoning/simple-agent-config.ts",
|
|
75
|
+
"src/chess-reasoning/simple-board-analysis.ts",
|
|
76
|
+
"src/chess-reasoning/simple-compact-evidence.ts",
|
|
77
|
+
"src/chess-reasoning/simple-completion.ts",
|
|
78
|
+
"src/chess-reasoning/simple-engine-presentation.ts",
|
|
79
|
+
"src/chess-reasoning/simple-evidence-preparation.ts",
|
|
80
|
+
"src/chess-reasoning/simple-evidence-view.ts",
|
|
81
|
+
"src/chess-reasoning/simple-explanation-coverage.ts",
|
|
82
|
+
"src/chess-reasoning/simple-fact-delivery.ts",
|
|
83
|
+
"src/chess-reasoning/simple-fallback-premise.ts",
|
|
84
|
+
"src/chess-reasoning/simple-prose-references.ts",
|
|
85
|
+
"src/chess-reasoning/simple-runtime-version.ts",
|
|
86
|
+
"src/chess-reasoning/stable.ts",
|
|
87
|
+
"src/chess-reasoning/tool-input-loop-guard.ts",
|
|
88
|
+
"src/chess-reasoning/types.ts",
|
|
89
|
+
"src/chess-reasoning/visible-support-lines.ts",
|
|
90
|
+
"src/chess-reasoning/wikibooks-index.ts",
|
|
91
|
+
"src/chess-reasoning/wikibooks-tool-context.ts",
|
|
92
|
+
"src/player-perspective.ts",
|
|
93
|
+
"src/shared-exports.ts"
|
|
94
|
+
],
|
|
95
|
+
"externalImports": [
|
|
96
|
+
"chess.js",
|
|
97
|
+
"ai",
|
|
98
|
+
"@knights-eye-chess/move-classifier/contracts",
|
|
99
|
+
"@ai-sdk/provider",
|
|
100
|
+
"@ai-sdk/provider-utils"
|
|
101
|
+
],
|
|
102
|
+
"runtimeBytes": 969108
|
|
103
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"runtimeInputs": [
|
|
3
|
+
"src/ai-request-failure.ts",
|
|
4
|
+
"src/ai-request-limits.ts",
|
|
5
|
+
"src/ai-routing-diagnostics.ts",
|
|
6
|
+
"src/chess-reasoning/classification-question-target.ts",
|
|
7
|
+
"src/chess-reasoning/conversation-context.ts",
|
|
8
|
+
"src/chess-reasoning/evidence-citation-normalization.ts",
|
|
9
|
+
"src/chess-reasoning/evidence-licenses.ts",
|
|
10
|
+
"src/chess-reasoning/fresh-engine-pv-witnesses.ts",
|
|
11
|
+
"src/chess-reasoning/historical-prose.ts",
|
|
12
|
+
"src/chess-reasoning/lossless-evidence-sharing.ts",
|
|
13
|
+
"src/chess-reasoning/material-accounting.ts",
|
|
14
|
+
"src/chess-reasoning/move-mechanism-facts.ts",
|
|
15
|
+
"src/chess-reasoning/opening-source-credits.ts",
|
|
16
|
+
"src/chess-reasoning/piece-identities.ts",
|
|
17
|
+
"src/chess-reasoning/poc-contracts.ts",
|
|
18
|
+
"src/chess-reasoning/poc-move-witnesses.ts",
|
|
19
|
+
"src/chess-reasoning/poc-piece-refs.ts",
|
|
20
|
+
"src/chess-reasoning/position-analysis-contracts.ts",
|
|
21
|
+
"src/chess-reasoning/position-analysis-scope.ts",
|
|
22
|
+
"src/chess-reasoning/question-routing.ts",
|
|
23
|
+
"src/chess-reasoning/recorded-main-line.ts",
|
|
24
|
+
"src/chess-reasoning/recorded-reference-context.ts",
|
|
25
|
+
"src/chess-reasoning/reference-limits.ts",
|
|
26
|
+
"src/chess-reasoning/saved-score-presentation.ts",
|
|
27
|
+
"src/chess-reasoning/simple-agent-config.ts",
|
|
28
|
+
"src/chess-reasoning/simple-prose-references.ts",
|
|
29
|
+
"src/chess-reasoning/simple-runtime-version.ts",
|
|
30
|
+
"src/chess-reasoning/stable.ts",
|
|
31
|
+
"src/chess-reasoning/types.ts",
|
|
32
|
+
"src/chess-reasoning/wikibooks-index.ts",
|
|
33
|
+
"src/player-perspective.ts",
|
|
34
|
+
"src/shared-exports.ts"
|
|
35
|
+
],
|
|
36
|
+
"externalImports": [
|
|
37
|
+
"chess.js"
|
|
38
|
+
]
|
|
39
|
+
}
|
package/dist/shared.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AI_MODEL_CONTEXT_MAX_BYTES,
|
|
3
|
+
AI_RELAY_MAX_REQUEST_BYTES,
|
|
4
|
+
AI_ROUTING_HEADER,
|
|
5
|
+
DEFAULT_REASONING_RUN_CONTROLS,
|
|
6
|
+
EVALUATED_ASTRA_CONFIG,
|
|
7
|
+
EVIDENCE_SHARING_VERSION,
|
|
8
|
+
MAX_FRESH_ENGINE_WITNESS_ACQUISITIONS,
|
|
9
|
+
MAX_INTERACTIVE_LINE_PLIES,
|
|
10
|
+
OPENING_SOURCE_LICENSE_URL,
|
|
11
|
+
QUESTION_ROUTING_VERSION,
|
|
12
|
+
REASONING_POC_VERSION,
|
|
13
|
+
REVIEW_SUBJECTS,
|
|
14
|
+
SIMPLE_EXTENSION_CONFIGS,
|
|
15
|
+
SIMPLE_MODEL_CATALOGUE,
|
|
16
|
+
SIMPLE_REFERENCE_VERSION,
|
|
17
|
+
SIMPLE_TOOL_AGENT_VERSION,
|
|
18
|
+
SIMPLE_VENDOR_CONFIGS,
|
|
19
|
+
admitFreshEnginePvWitnesses,
|
|
20
|
+
aiFailureDetails,
|
|
21
|
+
aiFailureMessage,
|
|
22
|
+
classificationTargetAtSelection,
|
|
23
|
+
classifyQuestionRoutingAnswers,
|
|
24
|
+
classifyReviewSubject,
|
|
25
|
+
createContextEvidence,
|
|
26
|
+
createQueryContract,
|
|
27
|
+
decodeWikibooksIndex,
|
|
28
|
+
decorateSimpleVariations,
|
|
29
|
+
expandSharedEvidence,
|
|
30
|
+
failureFromError,
|
|
31
|
+
hasMoveClassificationQuestion,
|
|
32
|
+
hasSharedEvidence,
|
|
33
|
+
historyPositionContext,
|
|
34
|
+
makeQuestionRoutingRequest,
|
|
35
|
+
moveSectionScope,
|
|
36
|
+
openingSourceLinks,
|
|
37
|
+
openingSourcesInMessages,
|
|
38
|
+
openingTitle,
|
|
39
|
+
parseOpeningSourceCredits,
|
|
40
|
+
parseQuestionRoutingAnswers,
|
|
41
|
+
positionKey,
|
|
42
|
+
priorConversationMessages,
|
|
43
|
+
readAiRoutingDiagnostics,
|
|
44
|
+
reasoningContextHash,
|
|
45
|
+
recordedMainLineResult,
|
|
46
|
+
recordedNavigation,
|
|
47
|
+
repairFrozenCitationLabels,
|
|
48
|
+
replayWikibooksTitle,
|
|
49
|
+
safeSimpleSourceLink,
|
|
50
|
+
scopePositionAnalysis,
|
|
51
|
+
selectIndexedOpening,
|
|
52
|
+
selectSimpleModel,
|
|
53
|
+
shareEvidence,
|
|
54
|
+
shareEvidenceMessages,
|
|
55
|
+
simpleEffortsForModel,
|
|
56
|
+
simpleProseReferences,
|
|
57
|
+
stripSimpleCitationLinks,
|
|
58
|
+
stripSimpleMarkdownFences,
|
|
59
|
+
toLegacyPositionAnalysis,
|
|
60
|
+
toLegacyPositionAnalysisProvider,
|
|
61
|
+
toPositionAnalysis,
|
|
62
|
+
toPositionAnalysisProvider,
|
|
63
|
+
validateReasoningPositionContext,
|
|
64
|
+
validateSimpleAgentConfig
|
|
65
|
+
} from "./chunk-XQDZJOYD.js";
|
|
66
|
+
|
|
67
|
+
// src/player-perspective.ts
|
|
68
|
+
function normalizedPlayerName(value) {
|
|
69
|
+
return String(value || "").trim().toLocaleLowerCase();
|
|
70
|
+
}
|
|
71
|
+
function uniquelyMatchedSide(white, black, names) {
|
|
72
|
+
const candidates = new Set(names.map(normalizedPlayerName).filter(Boolean));
|
|
73
|
+
if (!candidates.size) return null;
|
|
74
|
+
const whiteMatch = candidates.has(normalizedPlayerName(white));
|
|
75
|
+
const blackMatch = candidates.has(normalizedPlayerName(black));
|
|
76
|
+
return whiteMatch === blackMatch ? null : whiteMatch ? "white" : "black";
|
|
77
|
+
}
|
|
78
|
+
function resolvePlayerPerspective(input) {
|
|
79
|
+
const lichessNames = (input.providerIdentities || []).filter((identity) => identity.provider === "lichess").flatMap((identity) => [identity.providerUserId, identity.displayName]);
|
|
80
|
+
const lichessSide = uniquelyMatchedSide(input.white, input.black, lichessNames);
|
|
81
|
+
const chessComSide = uniquelyMatchedSide(input.white, input.black, [input.chessComLookupHandle || ""]);
|
|
82
|
+
if (lichessSide && chessComSide && lichessSide !== chessComSide) return null;
|
|
83
|
+
if (lichessSide) return { side: lichessSide, basis: "linked-lichess-identity" };
|
|
84
|
+
if (chessComSide) return { side: chessComSide, basis: "chesscom-lookup-handle" };
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
AI_MODEL_CONTEXT_MAX_BYTES,
|
|
89
|
+
AI_RELAY_MAX_REQUEST_BYTES,
|
|
90
|
+
AI_ROUTING_HEADER,
|
|
91
|
+
DEFAULT_REASONING_RUN_CONTROLS,
|
|
92
|
+
EVALUATED_ASTRA_CONFIG,
|
|
93
|
+
EVIDENCE_SHARING_VERSION,
|
|
94
|
+
MAX_FRESH_ENGINE_WITNESS_ACQUISITIONS,
|
|
95
|
+
MAX_INTERACTIVE_LINE_PLIES,
|
|
96
|
+
OPENING_SOURCE_LICENSE_URL,
|
|
97
|
+
QUESTION_ROUTING_VERSION,
|
|
98
|
+
REASONING_POC_VERSION,
|
|
99
|
+
REVIEW_SUBJECTS,
|
|
100
|
+
SIMPLE_EXTENSION_CONFIGS,
|
|
101
|
+
SIMPLE_MODEL_CATALOGUE,
|
|
102
|
+
SIMPLE_REFERENCE_VERSION,
|
|
103
|
+
SIMPLE_TOOL_AGENT_VERSION,
|
|
104
|
+
SIMPLE_VENDOR_CONFIGS,
|
|
105
|
+
admitFreshEnginePvWitnesses,
|
|
106
|
+
aiFailureDetails,
|
|
107
|
+
aiFailureMessage,
|
|
108
|
+
classificationTargetAtSelection,
|
|
109
|
+
classifyQuestionRoutingAnswers,
|
|
110
|
+
classifyReviewSubject,
|
|
111
|
+
createContextEvidence,
|
|
112
|
+
createQueryContract,
|
|
113
|
+
decodeWikibooksIndex,
|
|
114
|
+
decorateSimpleVariations,
|
|
115
|
+
expandSharedEvidence,
|
|
116
|
+
failureFromError,
|
|
117
|
+
hasMoveClassificationQuestion,
|
|
118
|
+
hasSharedEvidence,
|
|
119
|
+
historyPositionContext,
|
|
120
|
+
makeQuestionRoutingRequest,
|
|
121
|
+
moveSectionScope,
|
|
122
|
+
openingSourceLinks,
|
|
123
|
+
openingSourcesInMessages,
|
|
124
|
+
openingTitle,
|
|
125
|
+
parseOpeningSourceCredits,
|
|
126
|
+
parseQuestionRoutingAnswers,
|
|
127
|
+
positionKey,
|
|
128
|
+
priorConversationMessages,
|
|
129
|
+
readAiRoutingDiagnostics,
|
|
130
|
+
reasoningContextHash,
|
|
131
|
+
recordedMainLineResult,
|
|
132
|
+
recordedNavigation,
|
|
133
|
+
repairFrozenCitationLabels,
|
|
134
|
+
replayWikibooksTitle,
|
|
135
|
+
resolvePlayerPerspective,
|
|
136
|
+
safeSimpleSourceLink,
|
|
137
|
+
scopePositionAnalysis,
|
|
138
|
+
selectIndexedOpening,
|
|
139
|
+
selectSimpleModel,
|
|
140
|
+
shareEvidence,
|
|
141
|
+
shareEvidenceMessages,
|
|
142
|
+
simpleEffortsForModel,
|
|
143
|
+
simpleProseReferences,
|
|
144
|
+
stripSimpleCitationLinks,
|
|
145
|
+
stripSimpleMarkdownFences,
|
|
146
|
+
toLegacyPositionAnalysis,
|
|
147
|
+
toLegacyPositionAnalysisProvider,
|
|
148
|
+
toPositionAnalysis,
|
|
149
|
+
toPositionAnalysisProvider,
|
|
150
|
+
validateReasoningPositionContext,
|
|
151
|
+
validateSimpleAgentConfig
|
|
152
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Public finite error vocabulary. Never copy arbitrary provider text or transport bodies. */
|
|
2
|
+
export type AiFailureDetails = {
|
|
3
|
+
code: string;
|
|
4
|
+
status?: number;
|
|
5
|
+
retryAfterSeconds?: number;
|
|
6
|
+
providerDispatched?: boolean;
|
|
7
|
+
requestId?: string;
|
|
8
|
+
providerRequestId?: string;
|
|
9
|
+
stage: string;
|
|
10
|
+
reportable: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function aiFailureDetails(code: string, fields?: Partial<AiFailureDetails>): AiFailureDetails;
|
|
13
|
+
export declare function aiFailureMessage(f: AiFailureDetails, reported?: boolean): string;
|
|
14
|
+
export declare function failureFromError(error: unknown, code?: string): AiFailureDetails;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Byte safety ceilings, not token estimates. Wire encoding, server policy and
|
|
2
|
+
* opaque provider continuation require headroom beyond model evidence JSON. */
|
|
3
|
+
export declare const AI_MODEL_CONTEXT_MAX_BYTES = 1000000;
|
|
4
|
+
export declare const AI_RELAY_MAX_REQUEST_BYTES = 2000000;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Public, bounded routing facts only. Never provider text, headers or credentials. */
|
|
2
|
+
export declare const AI_ROUTING_HEADER = "x-knights-eye-ai-routing";
|
|
3
|
+
export type AiRoutingDiagnostics = {
|
|
4
|
+
requestedTier: 'flex' | 'default' | 'priority' | null;
|
|
5
|
+
actualTier: 'flex' | 'default' | 'priority' | null;
|
|
6
|
+
reason: 'flex_available' | 'cooldown_active' | 'storage_unavailable' | 'unsupported' | 'user_disabled' | 'user_standard' | 'user_fast';
|
|
7
|
+
elapsedMs: number;
|
|
8
|
+
slowThresholdMs: number;
|
|
9
|
+
timingEligible?: boolean;
|
|
10
|
+
cooldownUntil: number | null;
|
|
11
|
+
cooldownTriggered: boolean;
|
|
12
|
+
persistenceError?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function readAiRoutingDiagnostics(headers?: Headers | Record<string, string>): AiRoutingDiagnostics | undefined;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { type LanguageModel, type LanguageModelCallOptions } from "ai";
|
|
2
|
+
import type { AdaptiveEvidenceLoop, AdaptiveEvidenceLoopInput, AdaptiveEvidenceLoopResult } from "./ablation-adaptive-runtime.js";
|
|
3
|
+
import { type AblationEvidenceClosureBundle } from "./ablation-evidence-bundle.js";
|
|
4
|
+
import { type ObservableLlmTraceSink } from "./ai-sdk-runtime-support.js";
|
|
5
|
+
import { type ReasoningPositionContext, type ReasoningToolName, type ReasoningToolResult } from "./poc-contracts.js";
|
|
6
|
+
/**
|
|
7
|
+
* A deliberately transparent evidence adapter for B/B′. Unlike ToolLoopAgent,
|
|
8
|
+
* it makes one provider request for each decision, so an ablation runner can
|
|
9
|
+
* put a fresh cache-isolation nonce at the start of every provider request.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ABLATION_ADAPTIVE_EVIDENCE_LOOP_VERSION: "architecture-ablation-adaptive-evidence-loop/2";
|
|
12
|
+
export declare const ADAPTIVE_EVIDENCE_DECISION_SCHEMA: Readonly<{
|
|
13
|
+
type: "object";
|
|
14
|
+
additionalProperties: false;
|
|
15
|
+
required: string[];
|
|
16
|
+
properties: {
|
|
17
|
+
schemaVersion: {
|
|
18
|
+
const: "architecture-ablation-adaptive-evidence-loop/2";
|
|
19
|
+
};
|
|
20
|
+
decision: {
|
|
21
|
+
oneOf: ({
|
|
22
|
+
type: string;
|
|
23
|
+
additionalProperties: boolean;
|
|
24
|
+
required: string[];
|
|
25
|
+
properties: {
|
|
26
|
+
type: {
|
|
27
|
+
const: string;
|
|
28
|
+
};
|
|
29
|
+
tool: {
|
|
30
|
+
type: string;
|
|
31
|
+
minLength: number;
|
|
32
|
+
maxLength: number;
|
|
33
|
+
};
|
|
34
|
+
input: {
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
selectionRationale: {
|
|
38
|
+
type: string;
|
|
39
|
+
minLength: number;
|
|
40
|
+
maxLength: number;
|
|
41
|
+
};
|
|
42
|
+
modelStatedRationale: {
|
|
43
|
+
type: string;
|
|
44
|
+
minLength: number;
|
|
45
|
+
maxLength: number;
|
|
46
|
+
};
|
|
47
|
+
rationale?: undefined;
|
|
48
|
+
};
|
|
49
|
+
} | {
|
|
50
|
+
type: string;
|
|
51
|
+
additionalProperties: boolean;
|
|
52
|
+
required: string[];
|
|
53
|
+
properties: {
|
|
54
|
+
type: {
|
|
55
|
+
const: string;
|
|
56
|
+
};
|
|
57
|
+
rationale: {
|
|
58
|
+
type: string;
|
|
59
|
+
minLength: number;
|
|
60
|
+
maxLength: number;
|
|
61
|
+
};
|
|
62
|
+
modelStatedRationale: {
|
|
63
|
+
type: string;
|
|
64
|
+
minLength: number;
|
|
65
|
+
maxLength: number;
|
|
66
|
+
};
|
|
67
|
+
tool?: undefined;
|
|
68
|
+
input?: undefined;
|
|
69
|
+
selectionRationale?: undefined;
|
|
70
|
+
};
|
|
71
|
+
})[];
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
}>;
|
|
75
|
+
export type AdaptiveEvidenceToolExecutorInput = Readonly<{
|
|
76
|
+
callId: string;
|
|
77
|
+
requestId: string;
|
|
78
|
+
tool: ReasoningToolName;
|
|
79
|
+
input: Record<string, unknown>;
|
|
80
|
+
context: Readonly<ReasoningPositionContext>;
|
|
81
|
+
signal?: AbortSignal;
|
|
82
|
+
}>;
|
|
83
|
+
/** Browser and Node hosts adapt their existing exact fact/probe toolset here. */
|
|
84
|
+
export interface AdaptiveEvidenceToolExecutor {
|
|
85
|
+
execute(input: AdaptiveEvidenceToolExecutorInput): Promise<ReasoningToolResult>;
|
|
86
|
+
}
|
|
87
|
+
export type AdaptiveEvidenceProviderMetadata = Readonly<{
|
|
88
|
+
cost?: number | null;
|
|
89
|
+
cacheTokens?: number | null;
|
|
90
|
+
}>;
|
|
91
|
+
export type AdaptiveEvidenceLoopOptions = Readonly<{
|
|
92
|
+
model: LanguageModel;
|
|
93
|
+
toolExecutor: AdaptiveEvidenceToolExecutor;
|
|
94
|
+
maxOutputTokens: number;
|
|
95
|
+
/** Optional compact, immutable subset; the full source stays local for retrieval. */
|
|
96
|
+
initialEvidenceView?: Readonly<AblationEvidenceClosureBundle>;
|
|
97
|
+
discoverRetainedEvidence?: boolean;
|
|
98
|
+
observableTraceSink?: ObservableLlmTraceSink;
|
|
99
|
+
reasoning?: NonNullable<LanguageModelCallOptions["reasoning"]>;
|
|
100
|
+
temperature?: number;
|
|
101
|
+
/** Optional sanitized relay metadata; never provider bodies or credentials. */
|
|
102
|
+
consumeProviderMetadata?: () => readonly AdaptiveEvidenceProviderMetadata[];
|
|
103
|
+
}>;
|
|
104
|
+
/** Discovery metadata is not evidence; retrieval preserves the source records verbatim. */
|
|
105
|
+
export declare function retainedEvidenceCatalogue(bundle: Readonly<AblationEvidenceClosureBundle>): {
|
|
106
|
+
id: string;
|
|
107
|
+
kind: import("./poc-contracts.js").ReasoningEvidenceKind;
|
|
108
|
+
source: string;
|
|
109
|
+
preview: string;
|
|
110
|
+
previewTruncated: boolean;
|
|
111
|
+
scope: string | number | true | import("./types.js").SemanticValue[] | {
|
|
112
|
+
[key: string]: import("./types.js").SemanticValue;
|
|
113
|
+
};
|
|
114
|
+
licenses: import("./evidence-licenses.js").EvidenceLicense[] | undefined;
|
|
115
|
+
observations: {
|
|
116
|
+
type: string;
|
|
117
|
+
factKind: string | number | true | import("./types.js").SemanticValue[] | {
|
|
118
|
+
[key: string]: import("./types.js").SemanticValue;
|
|
119
|
+
} | null;
|
|
120
|
+
}[];
|
|
121
|
+
}[];
|
|
122
|
+
/** A browser/Node-neutral implementation of B/B′'s model-owned evidence loop. */
|
|
123
|
+
export declare class ModelOwnedAdaptiveEvidenceLoop implements AdaptiveEvidenceLoop {
|
|
124
|
+
private readonly options;
|
|
125
|
+
constructor(options: AdaptiveEvidenceLoopOptions);
|
|
126
|
+
run(input: AdaptiveEvidenceLoopInput): Promise<AdaptiveEvidenceLoopResult>;
|
|
127
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { type LanguageModel, type LanguageModelCallOptions } from "ai";
|
|
2
|
+
import { type DirectSynthesisArtifact, type DirectSynthesisIssue } from "./ablation-direct-synthesis.js";
|
|
3
|
+
import { type AblationEvidenceClosureBundle, type AblationEvidenceClosureCoverage, type AblationProbeTelemetry } from "./ablation-evidence-bundle.js";
|
|
4
|
+
import type { ReasoningObservation, ReasoningToolDescriptor, ReasoningToolName, ReasoningToolResult } from "./poc-contracts.js";
|
|
5
|
+
export { AblationTransportCorrectionError, assertTransportOnlyDirectCorrection } from "./ablation-transport-correction.js";
|
|
6
|
+
/** @deprecated Use AblationTransportCorrectionError from the shared module. */
|
|
7
|
+
export { AblationTransportCorrectionError as AdaptiveTransportCorrectionError } from "./ablation-transport-correction.js";
|
|
8
|
+
/**
|
|
9
|
+
* Adaptive direct arms remain deliberately outside the staged-C review chain.
|
|
10
|
+
* The evidence-loop boundary is injectable so the browser and Node adapters can
|
|
11
|
+
* drive the same episode without giving this experiment its own tool runtime.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ABLATION_ADAPTIVE_RUNTIME_VERSION: "architecture-ablation-adaptive-runtime/2";
|
|
14
|
+
export declare const 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.";
|
|
15
|
+
export declare const 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.";
|
|
16
|
+
export declare const 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.";
|
|
17
|
+
export declare const ABLATION_B_PRIME_TRIGGER_VALUES: readonly ["claim.forced-best-unique-safe-winning-principal-purpose", "coverage.requested-defense-or-continuation-incomplete", "evidence.conflict", "claim.sacrifice-or-long-multistep", "plan.legal-affordance-only", "model.high-uncertainty", "validation.semantic-reconsideration-required"];
|
|
18
|
+
export type AblationAdaptiveArm = "B" | "B-prime";
|
|
19
|
+
export type AblationBPrimeTrigger = typeof ABLATION_B_PRIME_TRIGGER_VALUES[number];
|
|
20
|
+
export type AdaptiveCallUsage = {
|
|
21
|
+
inputTokens: number | null;
|
|
22
|
+
outputTokens: number | null;
|
|
23
|
+
latencyMs: number | null;
|
|
24
|
+
cache: {
|
|
25
|
+
hits: number;
|
|
26
|
+
misses: number;
|
|
27
|
+
};
|
|
28
|
+
cost: number | null;
|
|
29
|
+
};
|
|
30
|
+
export type AdaptiveEvidenceToolRound = {
|
|
31
|
+
/** Monotonic across both returned and failed tool executions. */
|
|
32
|
+
attempt: number;
|
|
33
|
+
callId: string;
|
|
34
|
+
requestId: string;
|
|
35
|
+
tool: ReasoningToolName;
|
|
36
|
+
input: Record<string, unknown>;
|
|
37
|
+
selectionRationale: string;
|
|
38
|
+
modelStatedRationale: string | null;
|
|
39
|
+
result: ReasoningToolResult;
|
|
40
|
+
usage: AdaptiveCallUsage;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A requested tool is still a telemetry event when its host execution fails.
|
|
44
|
+
* Keep this transport-only record separate from a valid tool result: inventing
|
|
45
|
+
* a result/evidence record for a failure would make the closure dishonest.
|
|
46
|
+
*/
|
|
47
|
+
export type AdaptiveEvidenceToolFailure = {
|
|
48
|
+
attempt: number;
|
|
49
|
+
callId: string;
|
|
50
|
+
requestId: string;
|
|
51
|
+
tool: ReasoningToolName;
|
|
52
|
+
input: Record<string, unknown>;
|
|
53
|
+
selectionRationale: string;
|
|
54
|
+
modelStatedRationale: string | null;
|
|
55
|
+
failureCode: "tool-execution-failed";
|
|
56
|
+
usage: AdaptiveCallUsage;
|
|
57
|
+
};
|
|
58
|
+
export type AdaptiveEvidenceStoppingReason = "model-finished" | "tool-budget-exhausted" | "probe-budget-exhausted" | "model-decision-budget-exhausted";
|
|
59
|
+
export type AdaptiveEvidenceLoopResult = {
|
|
60
|
+
/** Only already-executed presemantic fact/probe calls may cross this boundary. */
|
|
61
|
+
rounds: readonly AdaptiveEvidenceToolRound[];
|
|
62
|
+
/** Requested executions that started but did not return an admissible result. */
|
|
63
|
+
failedToolCalls: readonly AdaptiveEvidenceToolFailure[];
|
|
64
|
+
/** Exact descriptors advertised to the model for this bounded episode. */
|
|
65
|
+
availableTools: readonly ReasoningToolDescriptor[];
|
|
66
|
+
/** Fact/probe evidence actually retained by the existing salience policy. */
|
|
67
|
+
saliencePresentedFactIds: readonly string[];
|
|
68
|
+
addedObservations?: readonly ReasoningObservation[];
|
|
69
|
+
coverage: AblationEvidenceClosureCoverage;
|
|
70
|
+
stopping: {
|
|
71
|
+
reason: AdaptiveEvidenceStoppingReason;
|
|
72
|
+
rationale: string;
|
|
73
|
+
unusedRelevantTools: ReasoningToolName[];
|
|
74
|
+
};
|
|
75
|
+
/** Counts provider calls made by the injected model-owned loop. */
|
|
76
|
+
modelCalls: number;
|
|
77
|
+
usage: AdaptiveCallUsage & {
|
|
78
|
+
corrections: number;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export type AdaptiveEvidenceLoopInput = {
|
|
82
|
+
arm: AblationAdaptiveArm;
|
|
83
|
+
system: string;
|
|
84
|
+
/** The first provider-visible bytes of every loop call must be this prefix. */
|
|
85
|
+
firstProviderVisiblePrefix: string;
|
|
86
|
+
/** Call once for every additional provider attempt/retry after the first. */
|
|
87
|
+
nextProviderVisiblePrefix: () => string;
|
|
88
|
+
bundle: Readonly<AblationEvidenceClosureBundle>;
|
|
89
|
+
tools: readonly ReasoningToolDescriptor[];
|
|
90
|
+
maxToolCalls: number;
|
|
91
|
+
maxProbeCalls: number;
|
|
92
|
+
maxModelSteps: number;
|
|
93
|
+
signal?: AbortSignal;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Adapters own tool-call transport and may use ToolLoopAgent. This contract
|
|
97
|
+
* makes its evidence output auditable while forbidding it from adding semantic
|
|
98
|
+
* state or bypassing production evidence records.
|
|
99
|
+
*/
|
|
100
|
+
export interface AdaptiveEvidenceLoop {
|
|
101
|
+
run(input: AdaptiveEvidenceLoopInput): Promise<AdaptiveEvidenceLoopResult>;
|
|
102
|
+
}
|
|
103
|
+
export type AblationAdaptiveCallDiagnostic = {
|
|
104
|
+
stage: "B-evidence" | "B-direct" | "B-prime-critic" | "B-transport-correction";
|
|
105
|
+
nonce: string;
|
|
106
|
+
inputBytes: number;
|
|
107
|
+
outputBytes: number | null;
|
|
108
|
+
latencyMs: number | null;
|
|
109
|
+
inputTokens: number | null;
|
|
110
|
+
outputTokens: number | null;
|
|
111
|
+
cacheTokens: number | null;
|
|
112
|
+
cost: number | null;
|
|
113
|
+
correctionCount: number;
|
|
114
|
+
outcome: "succeeded" | "failed" | "skipped" | "aborted";
|
|
115
|
+
failureCode: string | null;
|
|
116
|
+
};
|
|
117
|
+
export type AblationAdaptiveRuntimeOptions = {
|
|
118
|
+
model: LanguageModel;
|
|
119
|
+
/**
|
|
120
|
+
* Optional isolated B-prime critic transport. The original adaptive model
|
|
121
|
+
* and reasoning setting remain the backwards-compatible default for every
|
|
122
|
+
* stage unless the bounded critic explicitly supplies its own profile.
|
|
123
|
+
*/
|
|
124
|
+
criticModel?: LanguageModel;
|
|
125
|
+
evidenceLoop: AdaptiveEvidenceLoop;
|
|
126
|
+
/** The exact fact/probe descriptor set exposed to the model-owned loop. */
|
|
127
|
+
evidenceTools: readonly ReasoningToolDescriptor[];
|
|
128
|
+
/** Fresh, opaque, unique values supplied by the benchmark runner. */
|
|
129
|
+
benchmarkNonceForCall: (stage: "evidence" | "direct" | "critic" | "transport-correction", ordinal: number) => string;
|
|
130
|
+
modelName?: string;
|
|
131
|
+
providerRoute?: string;
|
|
132
|
+
reasoning?: NonNullable<LanguageModelCallOptions["reasoning"]>;
|
|
133
|
+
criticReasoning?: NonNullable<LanguageModelCallOptions["reasoning"]>;
|
|
134
|
+
temperature?: number;
|
|
135
|
+
maxOutputTokens: number;
|
|
136
|
+
/** One precommitted wall-time envelope for the complete B/B′ episode. */
|
|
137
|
+
maxWallTimeMs: number;
|
|
138
|
+
maxToolCalls: number;
|
|
139
|
+
maxProbeCalls: number;
|
|
140
|
+
maxModelSteps: number;
|
|
141
|
+
triggerPolicy?: (input: AdaptiveTriggerPolicyInput) => readonly AblationBPrimeTrigger[];
|
|
142
|
+
};
|
|
143
|
+
export type AdaptiveTriggerPolicyInput = {
|
|
144
|
+
bundle: Readonly<AblationEvidenceClosureBundle>;
|
|
145
|
+
proposal: unknown;
|
|
146
|
+
artifact: DirectSynthesisArtifact | null;
|
|
147
|
+
initialIssues: readonly DirectSynthesisIssue[];
|
|
148
|
+
};
|
|
149
|
+
export type AblationAdaptiveFailure = {
|
|
150
|
+
code: "adaptive-evidence-loop-rejected" | "direct-synthesis-rejected" | "transport-correction-rejected" | "critic-rejected" | "provider-or-structured-output" | "adaptive-timeout" | "adaptive-aborted";
|
|
151
|
+
issues?: DirectSynthesisIssue[];
|
|
152
|
+
};
|
|
153
|
+
/** B/B′ deliberately start from the frozen initial-exact cell, never a prior enrichment. */
|
|
154
|
+
export declare class AdaptiveAblationPreconditionError extends Error {
|
|
155
|
+
readonly code: "starting-bundle-must-be-original";
|
|
156
|
+
constructor();
|
|
157
|
+
}
|
|
158
|
+
export type AblationAdaptiveResult = {
|
|
159
|
+
arm: AblationAdaptiveArm;
|
|
160
|
+
ok: boolean;
|
|
161
|
+
bundle: Readonly<AblationEvidenceClosureBundle>;
|
|
162
|
+
artifact?: DirectSynthesisArtifact;
|
|
163
|
+
telemetry: Readonly<AblationProbeTelemetry>;
|
|
164
|
+
triggers: readonly AblationBPrimeTrigger[];
|
|
165
|
+
diagnostics: AblationAdaptiveCallDiagnostic[];
|
|
166
|
+
failure?: AblationAdaptiveFailure;
|
|
167
|
+
};
|
|
168
|
+
export declare function deriveAblationBPrimeTriggers(input: AdaptiveTriggerPolicyInput): AblationBPrimeTrigger[];
|
|
169
|
+
/**
|
|
170
|
+
* C-plus consumes exactly B's model-owned evidence episode, then hands its
|
|
171
|
+
* admitted closure to the frozen C chain. Keeping this adapter here prevents
|
|
172
|
+
* a second, subtly different evidence-to-bundle conversion in Gate 2.
|
|
173
|
+
*/
|
|
174
|
+
export declare function prepareAblationAdaptiveEvidenceForStagedReference(original: Readonly<AblationEvidenceClosureBundle>, loop: AdaptiveEvidenceLoopResult, evidenceTools: readonly ReasoningToolDescriptor[], limits: Pick<AblationAdaptiveRuntimeOptions, "maxToolCalls" | "maxProbeCalls" | "maxModelSteps">): Readonly<{
|
|
175
|
+
bundle: Readonly<AblationEvidenceClosureBundle>;
|
|
176
|
+
telemetry: Readonly<AblationProbeTelemetry>;
|
|
177
|
+
}>;
|
|
178
|
+
export declare function runAblationAdaptiveDirect(options: AblationAdaptiveRuntimeOptions, arm: AblationAdaptiveArm, original: Readonly<AblationEvidenceClosureBundle>, signal?: AbortSignal): Promise<AblationAdaptiveResult>;
|