tracelattice 1.2.9 → 1.3.1
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/README.md +83 -13
- package/dist/ServerConfig.d.ts +60 -0
- package/dist/ServerConfig.d.ts.map +1 -1
- package/dist/ServerConfig.js +27 -1
- package/dist/ServerConfig.js.map +1 -1
- package/dist/__tests__/calibrator/Calibrator.test.d.ts +6 -0
- package/dist/__tests__/calibrator/Calibrator.test.d.ts.map +1 -0
- package/dist/__tests__/compression/CompressionService.test.d.ts +5 -0
- package/dist/__tests__/compression/CompressionService.test.d.ts.map +1 -0
- package/dist/__tests__/compression/DehydrationPolicy.test.d.ts +5 -0
- package/dist/__tests__/compression/DehydrationPolicy.test.d.ts.map +1 -0
- package/dist/__tests__/compression/InMemorySummaryStore.test.d.ts +5 -0
- package/dist/__tests__/compression/InMemorySummaryStore.test.d.ts.map +1 -0
- package/dist/__tests__/config/ConfigLoader.features.test.d.ts +2 -0
- package/dist/__tests__/config/ConfigLoader.features.test.d.ts.map +1 -0
- package/dist/__tests__/core/HistoryManager.dag.test.d.ts +9 -0
- package/dist/__tests__/core/HistoryManager.dag.test.d.ts.map +1 -0
- package/dist/__tests__/core/HistoryManager.edge-persistence.test.d.ts +12 -0
- package/dist/__tests__/core/HistoryManager.edge-persistence.test.d.ts.map +1 -0
- package/dist/__tests__/core/HistoryManager.toolInvocation.test.d.ts +2 -0
- package/dist/__tests__/core/HistoryManager.toolInvocation.test.d.ts.map +1 -0
- package/dist/__tests__/core/ThoughtProcessor.newThoughtTypes.test.d.ts +2 -0
- package/dist/__tests__/core/ThoughtProcessor.newThoughtTypes.test.d.ts.map +1 -0
- package/dist/__tests__/core/ThoughtProcessor.toolInterleave.test.d.ts +2 -0
- package/dist/__tests__/core/ThoughtProcessor.toolInterleave.test.d.ts.map +1 -0
- package/dist/__tests__/core/graph/Edge.test.d.ts +5 -0
- package/dist/__tests__/core/graph/Edge.test.d.ts.map +1 -0
- package/dist/__tests__/core/graph/EdgeStore.test.d.ts +5 -0
- package/dist/__tests__/core/graph/EdgeStore.test.d.ts.map +1 -0
- package/dist/__tests__/core/graph/GraphView.test.d.ts +5 -0
- package/dist/__tests__/core/graph/GraphView.test.d.ts.map +1 -0
- package/dist/__tests__/core/reasoning/OutcomeRecorder.test.d.ts +5 -0
- package/dist/__tests__/core/reasoning/OutcomeRecorder.test.d.ts.map +1 -0
- package/dist/__tests__/core/reasoning/strategies/TreeOfThought.newTypes.test.d.ts +2 -0
- package/dist/__tests__/core/reasoning/strategies/TreeOfThought.newTypes.test.d.ts.map +1 -0
- package/dist/__tests__/core/retraction.test.d.ts +2 -0
- package/dist/__tests__/core/retraction.test.d.ts.map +1 -0
- package/dist/__tests__/core/thought-id.test.d.ts +13 -0
- package/dist/__tests__/core/thought-id.test.d.ts.map +1 -0
- package/dist/__tests__/core/tools/InMemorySuspensionStore.test.d.ts +2 -0
- package/dist/__tests__/core/tools/InMemorySuspensionStore.test.d.ts.map +1 -0
- package/dist/__tests__/eval/fixtures/scenarios.d.ts +37 -0
- package/dist/__tests__/eval/fixtures/scenarios.d.ts.map +1 -0
- package/dist/__tests__/eval/totVsSequential.eval.d.ts +16 -0
- package/dist/__tests__/eval/totVsSequential.eval.d.ts.map +1 -0
- package/dist/__tests__/evaluator/EvaluatorBackwardCompat.test.d.ts +15 -0
- package/dist/__tests__/evaluator/EvaluatorBackwardCompat.test.d.ts.map +1 -0
- package/dist/__tests__/helpers/factories.d.ts +2 -0
- package/dist/__tests__/helpers/factories.d.ts.map +1 -1
- package/dist/__tests__/integration/CompressionAutoTrigger.test.d.ts +11 -0
- package/dist/__tests__/integration/CompressionAutoTrigger.test.d.ts.map +1 -0
- package/dist/__tests__/integration/CompressionPersistence.test.d.ts +17 -0
- package/dist/__tests__/integration/CompressionPersistence.test.d.ts.map +1 -0
- package/dist/__tests__/integration/StrategyIntegration.test.d.ts +10 -0
- package/dist/__tests__/integration/StrategyIntegration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/ToTStrategyIntegration.test.d.ts +18 -0
- package/dist/__tests__/integration/ToTStrategyIntegration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/dag-edges.test.d.ts +17 -0
- package/dist/__tests__/integration/dag-edges.test.d.ts.map +1 -0
- package/dist/__tests__/strategies/SequentialStrategy.test.d.ts +2 -0
- package/dist/__tests__/strategies/SequentialStrategy.test.d.ts.map +1 -0
- package/dist/__tests__/strategies/StrategyContract.test.d.ts +18 -0
- package/dist/__tests__/strategies/StrategyContract.test.d.ts.map +1 -0
- package/dist/__tests__/strategies/TreeOfThoughtStrategy.test.d.ts +9 -0
- package/dist/__tests__/strategies/TreeOfThoughtStrategy.test.d.ts.map +1 -0
- package/dist/__tests__/strategies/plateau.test.d.ts +2 -0
- package/dist/__tests__/strategies/plateau.test.d.ts.map +1 -0
- package/dist/__tests__/strategies/totScoring.test.d.ts +2 -0
- package/dist/__tests__/strategies/totScoring.test.d.ts.map +1 -0
- package/dist/cli.js +9 -9
- package/dist/cli.js.map +1 -1
- package/dist/config/ConfigLoader.d.ts +37 -0
- package/dist/config/ConfigLoader.d.ts.map +1 -1
- package/dist/config/ConfigLoader.js +52 -2
- package/dist/config/ConfigLoader.js.map +1 -1
- package/dist/context/RequestContext.d.ts +2 -46
- package/dist/context/RequestContext.d.ts.map +1 -1
- package/dist/context/RequestContext.js +1 -10
- package/dist/context/RequestContext.js.map +1 -1
- package/dist/contracts/calibrator.d.ts +88 -0
- package/dist/contracts/calibrator.d.ts.map +1 -0
- package/dist/contracts/calibrator.js +1 -0
- package/dist/contracts/index.d.ts +5 -1
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/interfaces.d.ts +114 -35
- package/dist/contracts/interfaces.d.ts.map +1 -1
- package/dist/contracts/strategy.d.ts +106 -0
- package/dist/contracts/strategy.d.ts.map +1 -0
- package/dist/contracts/strategy.js +1 -0
- package/dist/contracts/summary.d.ts +104 -0
- package/dist/contracts/summary.d.ts.map +1 -0
- package/dist/contracts/summary.js +1 -0
- package/dist/contracts/suspension.d.ts +181 -0
- package/dist/contracts/suspension.d.ts.map +1 -0
- package/dist/contracts/suspension.js +1 -0
- package/dist/core/HistoryManager.d.ts +54 -441
- package/dist/core/HistoryManager.d.ts.map +1 -1
- package/dist/core/HistoryManager.js +132 -145
- package/dist/core/HistoryManager.js.map +1 -1
- package/dist/core/IHistoryManager.d.ts +17 -0
- package/dist/core/IHistoryManager.d.ts.map +1 -1
- package/dist/core/InputNormalizer.d.ts.map +1 -1
- package/dist/core/InputNormalizer.js +13 -24
- package/dist/core/InputNormalizer.js.map +1 -1
- package/dist/core/PersistenceBuffer.d.ts +110 -0
- package/dist/core/PersistenceBuffer.d.ts.map +1 -0
- package/dist/core/PersistenceBuffer.js +141 -0
- package/dist/core/PersistenceBuffer.js.map +1 -0
- package/dist/core/SessionManager.d.ts +58 -0
- package/dist/core/SessionManager.d.ts.map +1 -0
- package/dist/core/SessionManager.js +65 -0
- package/dist/core/SessionManager.js.map +1 -0
- package/dist/core/ThoughtEvaluator.d.ts +14 -99
- package/dist/core/ThoughtEvaluator.d.ts.map +1 -1
- package/dist/core/ThoughtEvaluator.js +66 -331
- package/dist/core/ThoughtEvaluator.js.map +1 -1
- package/dist/core/ThoughtFormatter.d.ts.map +1 -1
- package/dist/core/ThoughtFormatter.js +23 -1
- package/dist/core/ThoughtFormatter.js.map +1 -1
- package/dist/core/ThoughtProcessor.d.ts +68 -50
- package/dist/core/ThoughtProcessor.d.ts.map +1 -1
- package/dist/core/ThoughtProcessor.js +159 -7
- package/dist/core/ThoughtProcessor.js.map +1 -1
- package/dist/core/compression/CompressionService.d.ts +74 -0
- package/dist/core/compression/CompressionService.d.ts.map +1 -0
- package/dist/core/compression/CompressionService.js +159 -0
- package/dist/core/compression/CompressionService.js.map +1 -0
- package/dist/core/compression/DehydrationPolicy.d.ts +74 -0
- package/dist/core/compression/DehydrationPolicy.d.ts.map +1 -0
- package/dist/core/compression/DehydrationPolicy.js +45 -0
- package/dist/core/compression/DehydrationPolicy.js.map +1 -0
- package/dist/core/compression/InMemorySummaryStore.d.ts +130 -0
- package/dist/core/compression/InMemorySummaryStore.d.ts.map +1 -0
- package/dist/core/compression/InMemorySummaryStore.js +55 -0
- package/dist/core/compression/InMemorySummaryStore.js.map +1 -0
- package/dist/core/compression/Summary.d.ts +55 -0
- package/dist/core/compression/Summary.d.ts.map +1 -0
- package/dist/core/compression/Summary.js +1 -0
- package/dist/core/evaluator/Aggregator.d.ts +40 -0
- package/dist/core/evaluator/Aggregator.d.ts.map +1 -0
- package/dist/core/evaluator/Aggregator.js +32 -0
- package/dist/core/evaluator/Aggregator.js.map +1 -0
- package/dist/core/evaluator/Calibrator.d.ts +49 -0
- package/dist/core/evaluator/Calibrator.d.ts.map +1 -0
- package/dist/core/evaluator/Calibrator.js +172 -0
- package/dist/core/evaluator/Calibrator.js.map +1 -0
- package/dist/core/evaluator/PatternDetector.d.ts +69 -0
- package/dist/core/evaluator/PatternDetector.d.ts.map +1 -0
- package/dist/core/evaluator/PatternDetector.js +188 -0
- package/dist/core/evaluator/PatternDetector.js.map +1 -0
- package/dist/core/evaluator/SignalComputer.d.ts +116 -0
- package/dist/core/evaluator/SignalComputer.d.ts.map +1 -0
- package/dist/core/evaluator/SignalComputer.js +106 -0
- package/dist/core/evaluator/SignalComputer.js.map +1 -0
- package/dist/core/evaluator/internals.d.ts +36 -0
- package/dist/core/evaluator/internals.d.ts.map +1 -0
- package/dist/core/evaluator/internals.js +43 -0
- package/dist/core/evaluator/internals.js.map +1 -0
- package/dist/core/graph/Edge.d.ts +51 -0
- package/dist/core/graph/Edge.d.ts.map +1 -0
- package/dist/core/graph/Edge.js +1 -0
- package/dist/core/graph/EdgeEmitter.d.ts +64 -0
- package/dist/core/graph/EdgeEmitter.d.ts.map +1 -0
- package/dist/core/graph/EdgeEmitter.js +99 -0
- package/dist/core/graph/EdgeEmitter.js.map +1 -0
- package/dist/core/graph/EdgeStore.d.ts +104 -0
- package/dist/core/graph/EdgeStore.d.ts.map +1 -0
- package/dist/core/graph/EdgeStore.js +78 -0
- package/dist/core/graph/EdgeStore.js.map +1 -0
- package/dist/core/graph/GraphView.d.ts +156 -0
- package/dist/core/graph/GraphView.d.ts.map +1 -0
- package/dist/core/graph/GraphView.js +149 -0
- package/dist/core/graph/GraphView.js.map +1 -0
- package/dist/core/ids.d.ts +33 -0
- package/dist/core/ids.d.ts.map +1 -0
- package/dist/core/ids.js +11 -0
- package/dist/core/ids.js.map +1 -0
- package/dist/core/reasoning/OutcomeRecorder.d.ts +78 -0
- package/dist/core/reasoning/OutcomeRecorder.d.ts.map +1 -0
- package/dist/core/reasoning/OutcomeRecorder.js +36 -0
- package/dist/core/reasoning/OutcomeRecorder.js.map +1 -0
- package/dist/core/reasoning/strategies/SequentialStrategy.d.ts +54 -0
- package/dist/core/reasoning/strategies/SequentialStrategy.d.ts.map +1 -0
- package/dist/core/reasoning/strategies/SequentialStrategy.js +22 -0
- package/dist/core/reasoning/strategies/SequentialStrategy.js.map +1 -0
- package/dist/core/reasoning/strategies/StrategyFactory.d.ts +25 -0
- package/dist/core/reasoning/strategies/StrategyFactory.d.ts.map +1 -0
- package/dist/core/reasoning/strategies/StrategyFactory.js +15 -0
- package/dist/core/reasoning/strategies/StrategyFactory.js.map +1 -0
- package/dist/core/reasoning/strategies/TreeOfThoughtStrategy.d.ts +58 -0
- package/dist/core/reasoning/strategies/TreeOfThoughtStrategy.d.ts.map +1 -0
- package/dist/core/reasoning/strategies/TreeOfThoughtStrategy.js +98 -0
- package/dist/core/reasoning/strategies/TreeOfThoughtStrategy.js.map +1 -0
- package/dist/core/reasoning/strategies/plateau.d.ts +18 -0
- package/dist/core/reasoning/strategies/plateau.d.ts.map +1 -0
- package/dist/core/reasoning/strategies/plateau.js +12 -0
- package/dist/core/reasoning/strategies/plateau.js.map +1 -0
- package/dist/core/reasoning/strategies/totScoring.d.ts +90 -0
- package/dist/core/reasoning/strategies/totScoring.d.ts.map +1 -0
- package/dist/core/reasoning/strategies/totScoring.js +79 -0
- package/dist/core/reasoning/strategies/totScoring.js.map +1 -0
- package/dist/core/reasoning.d.ts +23 -3
- package/dist/core/reasoning.d.ts.map +1 -1
- package/dist/core/thought.d.ts +36 -0
- package/dist/core/thought.d.ts.map +1 -1
- package/dist/core/tools/InMemorySuspensionStore.d.ts +59 -0
- package/dist/core/tools/InMemorySuspensionStore.d.ts.map +1 -0
- package/dist/core/tools/InMemorySuspensionStore.js +91 -0
- package/dist/core/tools/InMemorySuspensionStore.js.map +1 -0
- package/dist/di/ServiceRegistry.d.ts +14 -0
- package/dist/di/ServiceRegistry.d.ts.map +1 -1
- package/dist/errors.d.ts +117 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +40 -1
- package/dist/errors.js.map +1 -1
- package/dist/health/HealthChecker.d.ts.map +1 -1
- package/dist/health/HealthChecker.js +3 -2
- package/dist/health/HealthChecker.js.map +1 -1
- package/dist/lib.d.ts +0 -5
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +67 -12
- package/dist/lib.js.map +1 -1
- package/dist/persistence/FilePersistence.d.ts +55 -0
- package/dist/persistence/FilePersistence.d.ts.map +1 -1
- package/dist/persistence/FilePersistence.js +120 -1
- package/dist/persistence/FilePersistence.js.map +1 -1
- package/dist/persistence/MemoryPersistence.d.ts +40 -0
- package/dist/persistence/MemoryPersistence.d.ts.map +1 -1
- package/dist/persistence/MemoryPersistence.js +33 -0
- package/dist/persistence/MemoryPersistence.js.map +1 -1
- package/dist/persistence/PersistenceBackend.d.ts +40 -0
- package/dist/persistence/PersistenceBackend.d.ts.map +1 -1
- package/dist/persistence/SqlitePersistence.d.ts +41 -0
- package/dist/persistence/SqlitePersistence.d.ts.map +1 -1
- package/dist/persistence/SqlitePersistence.js +102 -0
- package/dist/persistence/SqlitePersistence.js.map +1 -1
- package/dist/registry/BaseRegistry.d.ts.map +1 -1
- package/dist/registry/BaseRegistry.js +4 -3
- package/dist/registry/BaseRegistry.js.map +1 -1
- package/dist/registry/SkillRegistry.d.ts +1 -1
- package/dist/registry/SkillRegistry.js.map +1 -1
- package/dist/schema.d.ts +27 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +41 -9
- package/dist/schema.js.map +1 -1
- package/dist/transport/BaseTransport.d.ts +1 -20
- package/dist/transport/BaseTransport.d.ts.map +1 -1
- package/dist/transport/BaseTransport.js +1 -2
- package/dist/transport/BaseTransport.js.map +1 -1
- package/dist/transport/HttpHelpers.d.ts +0 -7
- package/dist/transport/HttpHelpers.d.ts.map +1 -1
- package/dist/transport/HttpHelpers.js +1 -7
- package/dist/transport/HttpHelpers.js.map +1 -1
- package/dist/transport/HttpTransport.d.ts.map +1 -1
- package/dist/transport/HttpTransport.js +2 -1
- package/dist/transport/HttpTransport.js.map +1 -1
- package/dist/transport/StreamableHttpTransport.d.ts +0 -6
- package/dist/transport/StreamableHttpTransport.d.ts.map +1 -1
- package/dist/transport/StreamableHttpTransport.js +4 -13
- package/dist/transport/StreamableHttpTransport.js.map +1 -1
- package/dist/watchers/SkillWatcher.d.ts.map +1 -1
- package/dist/watchers/SkillWatcher.js +3 -2
- package/dist/watchers/SkillWatcher.js.map +1 -1
- package/dist/watchers/ToolWatcher.d.ts.map +1 -1
- package/dist/watchers/ToolWatcher.js +2 -1
- package/dist/watchers/ToolWatcher.js.map +1 -1
- package/package.json +4 -4
- package/dist/__tests__/request-context.test.d.ts +0 -2
- package/dist/__tests__/request-context.test.d.ts.map +0 -1
- package/dist/__tests__/worker-manager-cov.test.d.ts +0 -2
- package/dist/__tests__/worker-manager-cov.test.d.ts.map +0 -1
- package/dist/__tests__/worker-manager.test.d.ts +0 -2
- package/dist/__tests__/worker-manager.test.d.ts.map +0 -1
- package/dist/cluster/WorkerManager.d.ts +0 -166
- package/dist/cluster/WorkerManager.d.ts.map +0 -1
- package/dist/cluster/WorkerManager.js +0 -202
- package/dist/cluster/WorkerManager.js.map +0 -1
- package/dist/cluster/worker.d.ts +0 -11
- package/dist/cluster/worker.d.ts.map +0 -1
- package/dist/cluster/worker.js +0 -36
- package/dist/cluster/worker.js.map +0 -1
- package/dist/telemetry/Telemetry.d.ts +0 -36
- package/dist/telemetry/Telemetry.d.ts.map +0 -1
- package/dist/telemetry/Telemetry.js +0 -68
- package/dist/telemetry/Telemetry.js.map +0 -1
- package/dist/telemetry/__tests__/Telemetry.test.d.ts +0 -2
- package/dist/telemetry/__tests__/Telemetry.test.d.ts.map +0 -1
|
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from "node:fs";
|
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { parse } from "yaml";
|
|
5
|
+
import { getErrorMessage } from "../errors.js";
|
|
5
6
|
class ConfigLoader {
|
|
6
7
|
_configPaths;
|
|
7
8
|
constructor(customPath){
|
|
@@ -22,7 +23,7 @@ class ConfigLoader {
|
|
|
22
23
|
config = this.parseConfig(configPath);
|
|
23
24
|
break;
|
|
24
25
|
} catch (error) {
|
|
25
|
-
console.error(`Failed to load config from ${configPath}:`,
|
|
26
|
+
console.error(`Failed to load config from ${configPath}:`, getErrorMessage(error));
|
|
26
27
|
}
|
|
27
28
|
return this.applyEnvironmentOverrides(config || {});
|
|
28
29
|
}
|
|
@@ -64,8 +65,54 @@ class ConfigLoader {
|
|
|
64
65
|
result.discoveryCache.maxSize = parsed;
|
|
65
66
|
}
|
|
66
67
|
}
|
|
68
|
+
if (process.env.TRACELATTICE_TOOL_INTERLEAVE_TTL_MS) {
|
|
69
|
+
const parsed = parseInt(process.env.TRACELATTICE_TOOL_INTERLEAVE_TTL_MS, 10);
|
|
70
|
+
if (Number.isFinite(parsed)) result.toolInterleaveTtlMs = parsed;
|
|
71
|
+
}
|
|
72
|
+
if (process.env.TRACELATTICE_TOOL_INTERLEAVE_SWEEP_MS) {
|
|
73
|
+
const parsed = parseInt(process.env.TRACELATTICE_TOOL_INTERLEAVE_SWEEP_MS, 10);
|
|
74
|
+
if (Number.isFinite(parsed)) result.toolInterleaveSweepMs = parsed;
|
|
75
|
+
}
|
|
76
|
+
this.applyFeatureFlagOverrides(result);
|
|
67
77
|
return result;
|
|
68
78
|
}
|
|
79
|
+
applyFeatureFlagOverrides(result) {
|
|
80
|
+
const boolMap = {
|
|
81
|
+
TRACELATTICE_FEATURES_DAG_EDGES: 'dagEdges',
|
|
82
|
+
TRACELATTICE_FEATURES_CALIBRATION: 'calibration',
|
|
83
|
+
TRACELATTICE_FEATURES_COMPRESSION: 'compression',
|
|
84
|
+
TRACELATTICE_FEATURES_TOOL_INTERLEAVE: 'toolInterleave',
|
|
85
|
+
TRACELATTICE_FEATURES_NEW_THOUGHT_TYPES: 'newThoughtTypes',
|
|
86
|
+
TRACELATTICE_FEATURES_OUTCOME_RECORDING: 'outcomeRecording'
|
|
87
|
+
};
|
|
88
|
+
for (const [envVar, key] of Object.entries(boolMap)){
|
|
89
|
+
const raw = process.env[envVar];
|
|
90
|
+
if (void 0 === raw) continue;
|
|
91
|
+
const parsed = this.parseBoolean(raw);
|
|
92
|
+
if (void 0 === parsed) {
|
|
93
|
+
console.warn(`Invalid boolean value for ${envVar}: "${raw}" (expected true/false/1/0). Ignoring.`);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
result.features = result.features || {};
|
|
97
|
+
result.features[key] = parsed;
|
|
98
|
+
}
|
|
99
|
+
const strategyRaw = process.env.TRACELATTICE_FEATURES_REASONING_STRATEGY;
|
|
100
|
+
if (void 0 !== strategyRaw) {
|
|
101
|
+
const allowed = [
|
|
102
|
+
'sequential',
|
|
103
|
+
'tot'
|
|
104
|
+
];
|
|
105
|
+
if (allowed.includes(strategyRaw)) {
|
|
106
|
+
result.features = result.features || {};
|
|
107
|
+
result.features.reasoningStrategy = strategyRaw;
|
|
108
|
+
} else console.warn(`Invalid value for TRACELATTICE_FEATURES_REASONING_STRATEGY: "${strategyRaw}" (expected one of ${allowed.join(', ')}). Falling back to 'sequential'.`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
parseBoolean(raw) {
|
|
112
|
+
const v = raw.trim().toLowerCase();
|
|
113
|
+
if ('true' === v || '1' === v) return true;
|
|
114
|
+
if ('false' === v || '0' === v) return false;
|
|
115
|
+
}
|
|
69
116
|
parseConfig(filePath) {
|
|
70
117
|
const content = readFileSync(filePath, 'utf-8');
|
|
71
118
|
const ext = filePath.split('.').pop()?.toLowerCase();
|
|
@@ -76,7 +123,10 @@ class ConfigLoader {
|
|
|
76
123
|
return {
|
|
77
124
|
maxHistorySize: config.maxHistorySize,
|
|
78
125
|
maxBranches: config.maxBranches,
|
|
79
|
-
maxBranchSize: config.maxBranchSize
|
|
126
|
+
maxBranchSize: config.maxBranchSize,
|
|
127
|
+
features: config.features,
|
|
128
|
+
toolInterleaveTtlMs: config.toolInterleaveTtlMs,
|
|
129
|
+
toolInterleaveSweepMs: config.toolInterleaveSweepMs
|
|
80
130
|
};
|
|
81
131
|
}
|
|
82
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config/ConfigLoader.js","sources":["../../src/config/ConfigLoader.ts"],"sourcesContent":["/**\n * Configuration file loading with environment variable override support.\n *\n * This module provides the `ConfigLoader` class which handles loading configuration\n * from YAML and JSON files in standard locations, with automatic environment variable\n * overrides for all settings.\n *\n * @module config\n */\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { parse as parseYaml } from 'yaml';\nimport type { PersistenceConfig } from '../persistence/PersistenceBackend.js';\n\n/**\n * Configuration options loaded from config files.\n *\n * These options represent the structure of configuration files (JSON or YAML)\n * that can be loaded from standard locations. All values can be overridden\n * by environment variables.\n *\n * @example\n * ```yaml\n * # .claude/config.yaml\n * maxHistorySize: 500\n * maxBranches: 25\n * logLevel: debug\n * prettyLog: true\n * skillDirs:\n * - ./custom-skills\n * discoveryCache:\n * ttl: 600000\n * maxSize: 200\n * persistence:\n * enabled: true\n * backend: sqlite\n * options:\n * dbPath: ./data/history.db\n * ```\n */\nexport interface ConfigFileOptions {\n\t/**\n\t * Maximum number of thoughts to keep in history.\n\t * Can be overridden by `MAX_HISTORY_SIZE` environment variable.\n\t */\n\tmaxHistorySize?: number;\n\n\t/**\n\t * Maximum number of branches to maintain.\n\t * Can be overridden by `MAX_BRANCHES` environment variable.\n\t */\n\tmaxBranches?: number;\n\n\t/**\n\t * Maximum size of each branch.\n\t * Can be overridden by `MAX_BRANCH_SIZE` environment variable.\n\t */\n\tmaxBranchSize?: number;\n\n\t/**\n\t * Logging level for the application.\n\t * Can be overridden by `LOG_LEVEL` environment variable.\n\t */\n\tlogLevel?: 'debug' | 'info' | 'warn' | 'error';\n\n\t/**\n\t * Whether to enable pretty (formatted) logging output.\n\t * Can be overridden by `PRETTY_LOG` environment variable (set to \"false\" to disable).\n\t */\n\tprettyLog?: boolean;\n\n\t/**\n\t * Directory paths to search for skills.\n\t * Can be overridden by `SKILL_DIRS` environment variable (colon-separated).\n\t */\n\tskillDirs?: string[];\n\n\t/**\n\t * Discovery cache configuration.\n\t * Can be overridden by `DISCOVERY_CACHE_TTL` and `DISCOVERY_CACHE_MAX_SIZE` environment variables.\n\t */\n\tdiscoveryCache?: {\n\t\t/**\n\t\t * Time-to-live for cache entries in milliseconds.\n\t\t * Environment variable `DISCOVERY_CACHE_TTL` accepts seconds.\n\t\t */\n\t\tttl?: number;\n\t\t/**\n\t\t * Maximum number of entries in the cache.\n\t\t */\n\t\tmaxSize?: number;\n\t};\n\n\t/**\n\t * Persistence configuration for storing history and state.\n\t */\n\tpersistence?: PersistenceConfig;\n}\n\n/**\n * Loads configuration from files with environment variable overrides.\n *\n * This class searches for configuration files in standard locations and applies\n * environment variable overrides. Files are searched in priority order, with the\n * first match being used. Environment variables always take precedence over file values.\n *\n * @remarks\n * **Config File Search Order (priority):**\n * 1. Custom path (if provided to constructor)\n * 2. `.claude/config.json` (project-local)\n * 3. `.claude/config.yaml` (project-local)\n * 4. `.claude/config.yml` (project-local)\n * 5. `~/.claude/config.json` (user-global)\n * 6. `~/.claude/config.yaml` (user-global)\n * 7. `~/.claude/config.yml` (user-global)\n *\n * **Environment Variable Overrides:**\n * | Variable | Type | Description |\n * |----------|------|-------------|\n * | `MAX_HISTORY_SIZE` | number | Max thoughts in history |\n * | `MAX_BRANCHES` | number | Max number of branches |\n * | `MAX_BRANCH_SIZE` | number | Max size of each branch |\n * | `LOG_LEVEL` | string | Logging level (debug/info/warn/error) |\n * | `PRETTY_LOG` | string | \"false\" to disable pretty logging |\n * | `SKILL_DIRS` | string | Colon-separated directory paths |\n * | `DISCOVERY_CACHE_TTL` | number | TTL in seconds (converted to ms) |\n * | `DISCOVERY_CACHE_MAX_SIZE` | number | Max cache entries |\n *\n * @example\n * ```typescript\n * // Use default search paths\n * const loader1 = new ConfigLoader();\n * const config1 = loader1.load();\n *\n * // Use custom config path\n * const loader2 = new ConfigLoader('./my-config.yaml');\n * const config2 = loader2.load();\n *\n * // Convert to ServerConfig options\n * const serverOptions = loader2.toServerConfigOptions(config2);\n * ```\n */\nexport class ConfigLoader {\n\t/** Array of config file paths to search, in priority order. */\n\tprivate _configPaths: string[];\n\n\t/**\n\t * Creates a new ConfigLoader instance.\n\t *\n\t * @param customPath - Optional custom config file path. If provided, only this path will be checked.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Use default search paths\n\t * const loader1 = new ConfigLoader();\n\t *\n\t * // Use a specific config file\n\t * const loader2 = new ConfigLoader('./custom-config.json');\n\t * ```\n\t */\n\tconstructor(customPath?: string) {\n\t\tthis._configPaths = customPath\n\t\t\t? [customPath]\n\t\t\t: [\n\t\t\t\t\t'.claude/config.json',\n\t\t\t\t\t'.claude/config.yaml',\n\t\t\t\t\t'.claude/config.yml',\n\t\t\t\t\tjoin(homedir(), '.claude/config.json'),\n\t\t\t\t\tjoin(homedir(), '.claude/config.yaml'),\n\t\t\t\t\tjoin(homedir(), '.claude/config.yml'),\n\t\t\t\t];\n\t}\n\n\t/**\n\t * Loads configuration from files and applies environment overrides.\n\t *\n\t * Searches for config files in the configured paths (in priority order),\n\t * parses the first match, and applies environment variable overrides.\n\t * Returns null if no config file is found and no environment overrides are set.\n\t *\n\t * @returns The loaded configuration with environment overrides applied, or null if no config found\n\t *\n\t * @example\n\t * ```typescript\n\t * const loader = new ConfigLoader();\n\t * const config = loader.load();\n\t *\n\t * if (config) {\n\t * console.log('Max history size:', config.maxHistorySize);\n\t * console.log('Log level:', config.logLevel);\n\t * }\n\t * ```\n\t */\n\tload(): ConfigFileOptions | null {\n\t\tlet config: ConfigFileOptions | null = null;\n\n\t\tfor (const configPath of this._configPaths) {\n\t\t\tif (existsSync(configPath)) {\n\t\t\t\ttry {\n\t\t\t\t\tconfig = this.parseConfig(configPath);\n\t\t\t\t\tbreak;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t`Failed to load config from ${configPath}:`,\n\t\t\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this.applyEnvironmentOverrides(config || {});\n\t}\n\n\t/**\n\t * Applies environment variable overrides to the configuration.\n\t *\n\t * Environment variables take precedence over file-based configuration.\n\t * Supported environment variables:\n\t * - `MAX_HISTORY_SIZE`, `MAX_BRANCHES`, `MAX_BRANCH_SIZE` (numbers)\n\t * - `LOG_LEVEL` (debug/info/warn/error)\n\t * - `PRETTY_LOG` (\"false\" to disable)\n\t * - `SKILL_DIRS` (colon-separated paths)\n\t * - `DISCOVERY_CACHE_TTL` (in seconds, converted to ms)\n\t * - `DISCOVERY_CACHE_MAX_SIZE` (number)\n\t *\n\t * @param config - The configuration to apply overrides to\n\t * @returns A new configuration object with environment overrides applied\n\t * @private\n\t */\n\tprivate applyEnvironmentOverrides(config: ConfigFileOptions): ConfigFileOptions {\n\t\tconst result: ConfigFileOptions = { ...config };\n\n\t\tif (process.env.MAX_HISTORY_SIZE) {\n\t\t\tconst parsed = parseInt(process.env.MAX_HISTORY_SIZE, 10);\n\t\t\tif (Number.isFinite(parsed)) {\n\t\t\t\tresult.maxHistorySize = parsed;\n\t\t\t}\n\t\t}\n\t\tif (process.env.MAX_BRANCHES) {\n\t\t\tconst parsed = parseInt(process.env.MAX_BRANCHES, 10);\n\t\t\tif (Number.isFinite(parsed)) {\n\t\t\t\tresult.maxBranches = parsed;\n\t\t\t}\n\t\t}\n\t\tif (process.env.MAX_BRANCH_SIZE) {\n\t\t\tconst parsed = parseInt(process.env.MAX_BRANCH_SIZE, 10);\n\t\t\tif (Number.isFinite(parsed)) {\n\t\t\t\tresult.maxBranchSize = parsed;\n\t\t\t}\n\t\t}\n\t\tif (\n\t\t\tprocess.env.LOG_LEVEL &&\n\t\t\t['debug', 'info', 'warn', 'error'].includes(process.env.LOG_LEVEL)\n\t\t) {\n\t\t\tresult.logLevel = process.env.LOG_LEVEL as 'debug' | 'info' | 'warn' | 'error';\n\t\t}\n\t\tif (process.env.PRETTY_LOG === 'false') {\n\t\t\tresult.prettyLog = false;\n\t\t}\n\t\tif (process.env.SKILL_DIRS) {\n\t\t\tresult.skillDirs = process.env.SKILL_DIRS.split(':');\n\t\t}\n\t\tif (process.env.DISCOVERY_CACHE_TTL) {\n\t\t\tconst parsed = parseInt(process.env.DISCOVERY_CACHE_TTL, 10);\n\t\t\tif (Number.isFinite(parsed)) {\n\t\t\t\tresult.discoveryCache = result.discoveryCache || {};\n\t\t\t\tresult.discoveryCache.ttl = parsed * 1000;\n\t\t\t}\n\t\t}\n\t\tif (process.env.DISCOVERY_CACHE_MAX_SIZE) {\n\t\t\tconst parsed = parseInt(process.env.DISCOVERY_CACHE_MAX_SIZE, 10);\n\t\t\tif (Number.isFinite(parsed)) {\n\t\t\t\tresult.discoveryCache = result.discoveryCache || {};\n\t\t\t\tresult.discoveryCache.maxSize = parsed;\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Parses a configuration file (JSON or YAML).\n\t *\n\t * Detects the file type by extension and uses the appropriate parser.\n\t * Supports `.json`, `.yaml`, and `.yml` file extensions.\n\t *\n\t * @param filePath - Path to the configuration file to parse\n\t * @returns The parsed configuration object\n\t * @throws {Error} If the file cannot be parsed\n\t * @private\n\t */\n\tprivate parseConfig(filePath: string): ConfigFileOptions {\n\t\tconst content = readFileSync(filePath, 'utf-8');\n\t\tconst ext = filePath.split('.').pop()?.toLowerCase();\n\n\t\tif (ext === 'yaml' || ext === 'yml') {\n\t\t\treturn parseYaml(content) as ConfigFileOptions;\n\t\t}\n\n\t\treturn JSON.parse(content) as ConfigFileOptions;\n\t}\n\n\t/**\n\t * Converts file-based configuration to ServerConfig options.\n\t *\n\t * This is a convenience method for extracting the ServerConfig-relevant\n\t * options from a file-based configuration.\n\t *\n\t * @param config - The configuration to convert\n\t * @returns An object with ServerConfig-compatible options\n\t *\n\t * @example\n\t * ```typescript\n\t * const loader = new ConfigLoader();\n\t * const config = loader.load();\n\t * if (config) {\n\t * const serverOpts = loader.toServerConfigOptions(config);\n\t * const serverConfig = new ServerConfig(serverOpts);\n\t * }\n\t * ```\n\t */\n\ttoServerConfigOptions(config: ConfigFileOptions): {\n\t\tmaxHistorySize?: number;\n\t\tmaxBranches?: number;\n\t\tmaxBranchSize?: number;\n\t} {\n\t\treturn {\n\t\t\tmaxHistorySize: config.maxHistorySize,\n\t\t\tmaxBranches: config.maxBranches,\n\t\t\tmaxBranchSize: config.maxBranchSize,\n\t\t};\n\t}\n}\n"],"names":["ConfigLoader","customPath","join","homedir","config","configPath","existsSync","error","console","Error","String","result","process","parsed","parseInt","Number","filePath","content","readFileSync","ext","parseYaml","JSON"],"mappings":";;;;AAgJO,MAAMA;IAEJ,aAAuB;IAgB/B,YAAYC,UAAmB,CAAE;QAChC,IAAI,CAAC,YAAY,GAAGA,aACjB;YAACA;SAAW,GACZ;YACA;YACA;YACA;YACAC,KAAKC,WAAW;YAChBD,KAAKC,WAAW;YAChBD,KAAKC,WAAW;SAChB;IACJ;IAsBA,OAAiC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O,SAAS,GAAGC,QAAQ,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC;QAEjD,IAAIA,QAAQ,GAAG,CAAC,mBAAmB,EAAE;YACpC,MAAMC,SAASC,SAASF,QAAQ,GAAG,CAAC,mBAAmB,EAAE;YACzD,IAAIG,OAAO,QAAQ,CAACF,SAAS;gBAC5BF,OAAO,cAAc,GAAGA,OAAO,cAAc,IAAI,CAAC;gBAClDA,OAAO,cAAc,CAAC,GAAG,GAAGE,AAAS,OAATA;YAC7B;QACD;QACA,IAAID,QAAQ,GAAG,CAAC,wBAAwB,EAAE;YACzC,MAAMC,SAASC,SAASF,QAAQ,GAAG,CAAC,wBAAwB,EAAE;YAC9D,IAAIG,OAAO,QAAQ,CAACF,SAAS;gBAC5BF,OAAO,cAAc,GAAGA,OAAO,cAAc,IAAI,CAAC;gBAClDA,OAAO,cAAc,CAAC,OAAO,GAAGE;YACjC;QACD;QAEA,OAAOF;IACR;IAaQ,YAAYK,QAAgB,EAAqB;QACxD,MAAMC,UAAUC,aAAaF,UAAU;QACvC,MAAMG,MAAMH,SAAS,KAAK,CAAC,KAAK,GAAG,IAAI;QAEvC,IAAIG,AAAQ,WAARA,OAAkBA,AAAQ,UAARA,KACrB,OAAOC,MAAUH;QAGlB,OAAOI,KAAK,KAAK,CAACJ;IACnB;IAqBA,sBAAsBb,MAAyB,EAI7C;QACD,OAAO;YACN,gBAAgBA,OAAO,cAAc;YACrC,aAAaA,OAAO,WAAW;YAC/B,eAAeA,OAAO,aAAa;QACpC;IACD;AACD"}
|
|
1
|
+
{"version":3,"file":"config/ConfigLoader.js","sources":["../../src/config/ConfigLoader.ts"],"sourcesContent":["/**\n * Configuration file loading with environment variable override support.\n *\n * This module provides the `ConfigLoader` class which handles loading configuration\n * from YAML and JSON files in standard locations, with automatic environment variable\n * overrides for all settings.\n *\n * @module config\n */\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { parse as parseYaml } from 'yaml';\nimport type { PersistenceConfig } from '../persistence/PersistenceBackend.js';\nimport { getErrorMessage } from '../errors.js';\nimport type { FeatureFlags } from '../ServerConfig.js';\n\n/**\n * Configuration options loaded from config files.\n *\n * These options represent the structure of configuration files (JSON or YAML)\n * that can be loaded from standard locations. All values can be overridden\n * by environment variables.\n *\n * @example\n * ```yaml\n * # .claude/config.yaml\n * maxHistorySize: 500\n * maxBranches: 25\n * logLevel: debug\n * prettyLog: true\n * skillDirs:\n * - ./custom-skills\n * discoveryCache:\n * ttl: 600000\n * maxSize: 200\n * persistence:\n * enabled: true\n * backend: sqlite\n * options:\n * dbPath: ./data/history.db\n * ```\n */\nexport interface ConfigFileOptions {\n\t/**\n\t * Maximum number of thoughts to keep in history.\n\t * Can be overridden by `MAX_HISTORY_SIZE` environment variable.\n\t */\n\tmaxHistorySize?: number;\n\n\t/**\n\t * Maximum number of branches to maintain.\n\t * Can be overridden by `MAX_BRANCHES` environment variable.\n\t */\n\tmaxBranches?: number;\n\n\t/**\n\t * Maximum size of each branch.\n\t * Can be overridden by `MAX_BRANCH_SIZE` environment variable.\n\t */\n\tmaxBranchSize?: number;\n\n\t/**\n\t * Logging level for the application.\n\t * Can be overridden by `LOG_LEVEL` environment variable.\n\t */\n\tlogLevel?: 'debug' | 'info' | 'warn' | 'error';\n\n\t/**\n\t * Whether to enable pretty (formatted) logging output.\n\t * Can be overridden by `PRETTY_LOG` environment variable (set to \"false\" to disable).\n\t */\n\tprettyLog?: boolean;\n\n\t/**\n\t * Directory paths to search for skills.\n\t * Can be overridden by `SKILL_DIRS` environment variable (colon-separated).\n\t */\n\tskillDirs?: string[];\n\n\t/**\n\t * Discovery cache configuration.\n\t * Can be overridden by `DISCOVERY_CACHE_TTL` and `DISCOVERY_CACHE_MAX_SIZE` environment variables.\n\t */\n\tdiscoveryCache?: {\n\t\t/**\n\t\t * Time-to-live for cache entries in milliseconds.\n\t\t * Environment variable `DISCOVERY_CACHE_TTL` accepts seconds.\n\t\t */\n\t\tttl?: number;\n\t\t/**\n\t\t * Maximum number of entries in the cache.\n\t\t */\n\t\tmaxSize?: number;\n\t};\n\n\t/**\n\t * Persistence configuration for storing history and state.\n\t */\n\tpersistence?: PersistenceConfig;\n\n\t/**\n\t * Feature flag overrides. Each field can be set independently.\n\t * Can be overridden by `TRACELATTICE_FEATURES_*` environment variables.\n\t */\n\tfeatures?: Partial<FeatureFlags>;\n\n\t/**\n\t * TTL in milliseconds for suspended tool-interleave entries.\n\t * Can be overridden by `TRACELATTICE_TOOL_INTERLEAVE_TTL_MS` environment variable.\n\t */\n\ttoolInterleaveTtlMs?: number;\n\n\t/**\n\t * Sweep interval in milliseconds for SuspensionStore expiration cleanup.\n\t * Can be overridden by `TRACELATTICE_TOOL_INTERLEAVE_SWEEP_MS` environment variable.\n\t */\n\ttoolInterleaveSweepMs?: number;\n}\n\n/**\n * Loads configuration from files with environment variable overrides.\n *\n * This class searches for configuration files in standard locations and applies\n * environment variable overrides. Files are searched in priority order, with the\n * first match being used. Environment variables always take precedence over file values.\n *\n * @remarks\n * **Config File Search Order (priority):**\n * 1. Custom path (if provided to constructor)\n * 2. `.claude/config.json` (project-local)\n * 3. `.claude/config.yaml` (project-local)\n * 4. `.claude/config.yml` (project-local)\n * 5. `~/.claude/config.json` (user-global)\n * 6. `~/.claude/config.yaml` (user-global)\n * 7. `~/.claude/config.yml` (user-global)\n *\n * **Environment Variable Overrides:**\n * | Variable | Type | Description |\n * |----------|------|-------------|\n * | `MAX_HISTORY_SIZE` | number | Max thoughts in history |\n * | `MAX_BRANCHES` | number | Max number of branches |\n * | `MAX_BRANCH_SIZE` | number | Max size of each branch |\n * | `LOG_LEVEL` | string | Logging level (debug/info/warn/error) |\n * | `PRETTY_LOG` | string | \"false\" to disable pretty logging |\n * | `SKILL_DIRS` | string | Colon-separated directory paths |\n * | `DISCOVERY_CACHE_TTL` | number | TTL in seconds (converted to ms) |\n * | `DISCOVERY_CACHE_MAX_SIZE` | number | Max cache entries |\n *\n * @example\n * ```typescript\n * // Use default search paths\n * const loader1 = new ConfigLoader();\n * const config1 = loader1.load();\n *\n * // Use custom config path\n * const loader2 = new ConfigLoader('./my-config.yaml');\n * const config2 = loader2.load();\n *\n * // Convert to ServerConfig options\n * const serverOptions = loader2.toServerConfigOptions(config2);\n * ```\n */\nexport class ConfigLoader {\n\t/** Array of config file paths to search, in priority order. */\n\tprivate _configPaths: string[];\n\n\t/**\n\t * Creates a new ConfigLoader instance.\n\t *\n\t * @param customPath - Optional custom config file path. If provided, only this path will be checked.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Use default search paths\n\t * const loader1 = new ConfigLoader();\n\t *\n\t * // Use a specific config file\n\t * const loader2 = new ConfigLoader('./custom-config.json');\n\t * ```\n\t */\n\tconstructor(customPath?: string) {\n\t\tthis._configPaths = customPath\n\t\t\t? [customPath]\n\t\t\t: [\n\t\t\t\t\t'.claude/config.json',\n\t\t\t\t\t'.claude/config.yaml',\n\t\t\t\t\t'.claude/config.yml',\n\t\t\t\t\tjoin(homedir(), '.claude/config.json'),\n\t\t\t\t\tjoin(homedir(), '.claude/config.yaml'),\n\t\t\t\t\tjoin(homedir(), '.claude/config.yml'),\n\t\t\t\t];\n\t}\n\n\t/**\n\t * Loads configuration from files and applies environment overrides.\n\t *\n\t * Searches for config files in the configured paths (in priority order),\n\t * parses the first match, and applies environment variable overrides.\n\t * Returns null if no config file is found and no environment overrides are set.\n\t *\n\t * @returns The loaded configuration with environment overrides applied, or null if no config found\n\t *\n\t * @example\n\t * ```typescript\n\t * const loader = new ConfigLoader();\n\t * const config = loader.load();\n\t *\n\t * if (config) {\n\t * console.log('Max history size:', config.maxHistorySize);\n\t * console.log('Log level:', config.logLevel);\n\t * }\n\t * ```\n\t */\n\tload(): ConfigFileOptions | null {\n\t\tlet config: ConfigFileOptions | null = null;\n\n\t\tfor (const configPath of this._configPaths) {\n\t\t\tif (existsSync(configPath)) {\n\t\t\t\ttry {\n\t\t\t\t\tconfig = this.parseConfig(configPath);\n\t\t\t\t\tbreak;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t`Failed to load config from ${configPath}:`,\n\t\t\t\t\t\tgetErrorMessage(error)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this.applyEnvironmentOverrides(config || {});\n\t}\n\n\t/**\n\t * Applies environment variable overrides to the configuration.\n\t *\n\t * Environment variables take precedence over file-based configuration.\n\t * Supported environment variables:\n\t * - `MAX_HISTORY_SIZE`, `MAX_BRANCHES`, `MAX_BRANCH_SIZE` (numbers)\n\t * - `LOG_LEVEL` (debug/info/warn/error)\n\t * - `PRETTY_LOG` (\"false\" to disable)\n\t * - `SKILL_DIRS` (colon-separated paths)\n\t * - `DISCOVERY_CACHE_TTL` (in seconds, converted to ms)\n\t * - `DISCOVERY_CACHE_MAX_SIZE` (number)\n\t *\n\t * @param config - The configuration to apply overrides to\n\t * @returns A new configuration object with environment overrides applied\n\t * @private\n\t */\n\tprivate applyEnvironmentOverrides(config: ConfigFileOptions): ConfigFileOptions {\n\t\tconst result: ConfigFileOptions = { ...config };\n\n\t\tif (process.env.MAX_HISTORY_SIZE) {\n\t\t\tconst parsed = parseInt(process.env.MAX_HISTORY_SIZE, 10);\n\t\t\tif (Number.isFinite(parsed)) {\n\t\t\t\tresult.maxHistorySize = parsed;\n\t\t\t}\n\t\t}\n\t\tif (process.env.MAX_BRANCHES) {\n\t\t\tconst parsed = parseInt(process.env.MAX_BRANCHES, 10);\n\t\t\tif (Number.isFinite(parsed)) {\n\t\t\t\tresult.maxBranches = parsed;\n\t\t\t}\n\t\t}\n\t\tif (process.env.MAX_BRANCH_SIZE) {\n\t\t\tconst parsed = parseInt(process.env.MAX_BRANCH_SIZE, 10);\n\t\t\tif (Number.isFinite(parsed)) {\n\t\t\t\tresult.maxBranchSize = parsed;\n\t\t\t}\n\t\t}\n\t\tif (\n\t\t\tprocess.env.LOG_LEVEL &&\n\t\t\t['debug', 'info', 'warn', 'error'].includes(process.env.LOG_LEVEL)\n\t\t) {\n\t\t\tresult.logLevel = process.env.LOG_LEVEL as 'debug' | 'info' | 'warn' | 'error';\n\t\t}\n\t\tif (process.env.PRETTY_LOG === 'false') {\n\t\t\tresult.prettyLog = false;\n\t\t}\n\t\tif (process.env.SKILL_DIRS) {\n\t\t\tresult.skillDirs = process.env.SKILL_DIRS.split(':');\n\t\t}\n\t\tif (process.env.DISCOVERY_CACHE_TTL) {\n\t\t\tconst parsed = parseInt(process.env.DISCOVERY_CACHE_TTL, 10);\n\t\t\tif (Number.isFinite(parsed)) {\n\t\t\t\tresult.discoveryCache = result.discoveryCache || {};\n\t\t\t\tresult.discoveryCache.ttl = parsed * 1000;\n\t\t\t}\n\t\t}\n\t\tif (process.env.DISCOVERY_CACHE_MAX_SIZE) {\n\t\t\tconst parsed = parseInt(process.env.DISCOVERY_CACHE_MAX_SIZE, 10);\n\t\t\tif (Number.isFinite(parsed)) {\n\t\t\t\tresult.discoveryCache = result.discoveryCache || {};\n\t\t\t\tresult.discoveryCache.maxSize = parsed;\n\t\t\t}\n\t\t}\n\t\tif (process.env.TRACELATTICE_TOOL_INTERLEAVE_TTL_MS) {\n\t\t\tconst parsed = parseInt(process.env.TRACELATTICE_TOOL_INTERLEAVE_TTL_MS, 10);\n\t\t\tif (Number.isFinite(parsed)) {\n\t\t\t\tresult.toolInterleaveTtlMs = parsed;\n\t\t\t}\n\t\t}\n\t\tif (process.env.TRACELATTICE_TOOL_INTERLEAVE_SWEEP_MS) {\n\t\t\tconst parsed = parseInt(process.env.TRACELATTICE_TOOL_INTERLEAVE_SWEEP_MS, 10);\n\t\t\tif (Number.isFinite(parsed)) {\n\t\t\t\tresult.toolInterleaveSweepMs = parsed;\n\t\t\t}\n\t\t}\n\n\t\tthis.applyFeatureFlagOverrides(result);\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Applies TRACELATTICE_FEATURES_* environment variable overrides for feature flags.\n\t * Booleans accept 'true'/'false'/'1'/'0' (case-insensitive).\n\t * Invalid reasoningStrategy values are warned and ignored (fall back to default).\n\t *\n\t * @param result - Configuration object to mutate with feature flag overrides\n\t * @private\n\t */\n\tprivate applyFeatureFlagOverrides(result: ConfigFileOptions): void {\n\t\tconst boolMap: Record<string, keyof FeatureFlags> = {\n\t\t\tTRACELATTICE_FEATURES_DAG_EDGES: 'dagEdges',\n\t\t\tTRACELATTICE_FEATURES_CALIBRATION: 'calibration',\n\t\t\tTRACELATTICE_FEATURES_COMPRESSION: 'compression',\n\t\t\tTRACELATTICE_FEATURES_TOOL_INTERLEAVE: 'toolInterleave',\n\t\t\tTRACELATTICE_FEATURES_NEW_THOUGHT_TYPES: 'newThoughtTypes',\n\t\t\tTRACELATTICE_FEATURES_OUTCOME_RECORDING: 'outcomeRecording',\n\t\t};\n\t\tfor (const [envVar, key] of Object.entries(boolMap)) {\n\t\t\tconst raw = process.env[envVar];\n\t\t\tif (raw === undefined) continue;\n\t\t\tconst parsed = this.parseBoolean(raw);\n\t\t\tif (parsed === undefined) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`Invalid boolean value for ${envVar}: \"${raw}\" (expected true/false/1/0). Ignoring.`\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tresult.features = result.features || {};\n\t\t\t(result.features as Record<string, unknown>)[key] = parsed;\n\t\t}\n\n\t\tconst strategyRaw = process.env.TRACELATTICE_FEATURES_REASONING_STRATEGY;\n\t\tif (strategyRaw !== undefined) {\n\t\t\tconst allowed = ['sequential', 'tot'] as const;\n\t\t\tif ((allowed as readonly string[]).includes(strategyRaw)) {\n\t\t\t\tresult.features = result.features || {};\n\t\t\t\tresult.features.reasoningStrategy =\n\t\t\t\t\tstrategyRaw as FeatureFlags['reasoningStrategy'];\n\t\t\t} else {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`Invalid value for TRACELATTICE_FEATURES_REASONING_STRATEGY: \"${strategyRaw}\" ` +\n\t\t\t\t\t\t`(expected one of ${allowed.join(', ')}). Falling back to 'sequential'.`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Parses a boolean from an environment variable string.\n\t * Accepts 'true'/'false'/'1'/'0' case-insensitively.\n\t *\n\t * @param raw - Raw environment variable string\n\t * @returns Parsed boolean, or undefined if the value is invalid\n\t * @private\n\t */\n\tprivate parseBoolean(raw: string): boolean | undefined {\n\t\tconst v = raw.trim().toLowerCase();\n\t\tif (v === 'true' || v === '1') return true;\n\t\tif (v === 'false' || v === '0') return false;\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Parses a configuration file (JSON or YAML).\n\t *\n\t * Detects the file type by extension and uses the appropriate parser.\n\t * Supports `.json`, `.yaml`, and `.yml` file extensions.\n\t *\n\t * @param filePath - Path to the configuration file to parse\n\t * @returns The parsed configuration object\n\t * @throws {Error} If the file cannot be parsed\n\t * @private\n\t */\n\tprivate parseConfig(filePath: string): ConfigFileOptions {\n\t\tconst content = readFileSync(filePath, 'utf-8');\n\t\tconst ext = filePath.split('.').pop()?.toLowerCase();\n\n\t\tif (ext === 'yaml' || ext === 'yml') {\n\t\t\treturn parseYaml(content) as ConfigFileOptions;\n\t\t}\n\n\t\treturn JSON.parse(content) as ConfigFileOptions;\n\t}\n\n\t/**\n\t * Converts file-based configuration to ServerConfig options.\n\t *\n\t * This is a convenience method for extracting the ServerConfig-relevant\n\t * options from a file-based configuration.\n\t *\n\t * @param config - The configuration to convert\n\t * @returns An object with ServerConfig-compatible options\n\t *\n\t * @example\n\t * ```typescript\n\t * const loader = new ConfigLoader();\n\t * const config = loader.load();\n\t * if (config) {\n\t * const serverOpts = loader.toServerConfigOptions(config);\n\t * const serverConfig = new ServerConfig(serverOpts);\n\t * }\n\t * ```\n\t */\n\ttoServerConfigOptions(config: ConfigFileOptions): {\n\t\tmaxHistorySize?: number;\n\t\tmaxBranches?: number;\n\t\tmaxBranchSize?: number;\n\t\tfeatures?: Partial<FeatureFlags>;\n\t\ttoolInterleaveTtlMs?: number;\n\t\ttoolInterleaveSweepMs?: number;\n\t} {\n\t\treturn {\n\t\t\tmaxHistorySize: config.maxHistorySize,\n\t\t\tmaxBranches: config.maxBranches,\n\t\t\tmaxBranchSize: config.maxBranchSize,\n\t\t\tfeatures: config.features,\n\t\t\ttoolInterleaveTtlMs: config.toolInterleaveTtlMs,\n\t\t\ttoolInterleaveSweepMs: config.toolInterleaveSweepMs,\n\t\t};\n\t}\n}\n"],"names":["ConfigLoader","customPath","join","homedir","config","configPath","existsSync","error","console","getErrorMessage","result","process","parsed","parseInt","Number","boolMap","envVar","key","Object","raw","undefined","strategyRaw","allowed","v","filePath","content","readFileSync","ext","parseYaml","JSON"],"mappings":";;;;;AAoKO,MAAMA;IAEJ,aAAuB;IAgB/B,YAAYC,UAAmB,CAAE;QAChC,IAAI,CAAC,YAAY,GAAGA,aACjB;YAACA;SAAW,GACZ;YACA;YACA;YACA;YACAC,KAAKC,WAAW;YAChBD,KAAKC,WAAW;YAChBD,KAAKC,WAAW;SAChB;IACJ;IAsBA,OAAiC;QAChC,IAAIC,SAAmC;QAEvC,KAAK,MAAMC,cAAc,IAAI,CAAC,YAAY,CACzC,IAAIC,WAAWD,aACd,IAAI;YACHD,SAAS,IAAI,CAAC,WAAW,CAACC;YAC1B;QACD,EAAE,OAAOE,OAAO;YACfC,QAAQ,KAAK,CACZ,CAAC,2BAA2B,EAAEH,WAAW,CAAC,CAAC,EAC3CI,gBAAgBF;QAElB;QAIF,OAAO,IAAI,CAAC,yBAAyB,CAACH,UAAU,CAAC;IAClD;IAkBQ,0BAA0BA,MAAyB,EAAqB;QAC/E,MAAMM,SAA4B;YAAE,GAAGN,MAAM;QAAC;QAE9C,IAAIO,QAAQ,GAAG,CAAC,gBAAgB,EAAE;YACjC,MAAMC,SAASC,SAASF,QAAQ,GAAG,CAAC,gBAAgB,EAAE;YACtD,IAAIG,OAAO,QAAQ,CAACF,SACnBF,OAAO,cAAc,GAAGE;QAE1B;QACA,IAAID,QAAQ,GAAG,C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9D,mBAAiB,EAAEC,QAAQ,IAAI,CAAC,MAAM,gCAAgC,CADO;QAIlF;IACD;IAUQ,aAAaH,GAAW,EAAuB;QACtD,MAAMI,IAAIJ,IAAI,IAAI,GAAG,WAAW;QAChC,IAAII,AAAM,WAANA,KAAgBA,AAAM,QAANA,GAAW,OAAO;QACtC,IAAIA,AAAM,YAANA,KAAiBA,AAAM,QAANA,GAAW,OAAO;IAExC;IAaQ,YAAYC,QAAgB,EAAqB;QACxD,MAAMC,UAAUC,aAAaF,UAAU;QACvC,MAAMG,MAAMH,SAAS,KAAK,CAAC,KAAK,GAAG,IAAI;QAEvC,IAAIG,AAAQ,WAARA,OAAkBA,AAAQ,UAARA,KACrB,OAAOC,MAAUH;QAGlB,OAAOI,KAAK,KAAK,CAACJ;IACnB;IAqBA,sBAAsBrB,MAAyB,EAO7C;QACD,OAAO;YACN,gBAAgBA,OAAO,cAAc;YACrC,aAAaA,OAAO,WAAW;YAC/B,eAAeA,OAAO,aAAa;YACnC,UAAUA,OAAO,QAAQ;YACzB,qBAAqBA,OAAO,mBAAmB;YAC/C,uBAAuBA,OAAO,qBAAqB;QACpD;IACD;AACD"}
|
|
@@ -1,61 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Request context management using AsyncLocalStorage for correlation IDs.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* zero-cost context propagation.
|
|
4
|
+
* Provides zero-cost request ID propagation across async boundaries
|
|
5
|
+
* via Node.js AsyncLocalStorage.
|
|
7
6
|
*
|
|
8
7
|
* @module context
|
|
9
8
|
*/
|
|
10
|
-
/**
|
|
11
|
-
* Run a function within a request context.
|
|
12
|
-
*
|
|
13
|
-
* The requestId will be available via getRequestId() inside the callback
|
|
14
|
-
* and any async operations it spawns.
|
|
15
|
-
*
|
|
16
|
-
* @param requestId - The correlation ID for this request
|
|
17
|
-
* @param fn - The function to run within the context
|
|
18
|
-
* @returns The return value of fn
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```typescript
|
|
22
|
-
* await runWithContext('req-123', async () => {
|
|
23
|
-
* console.log(getRequestId()); // 'req-123'
|
|
24
|
-
* await someAsyncOperation();
|
|
25
|
-
* console.log(getRequestId()); // still 'req-123'
|
|
26
|
-
* });
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export declare function runWithContext<T>(requestId: string, fn: () => T | Promise<T>): T | Promise<T>;
|
|
30
9
|
/**
|
|
31
10
|
* Get the current request ID from context.
|
|
32
11
|
*
|
|
33
12
|
* Returns undefined if called outside of a runWithContext() call.
|
|
34
13
|
*
|
|
35
14
|
* @returns The current request ID or undefined
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```typescript
|
|
39
|
-
* // Outside context
|
|
40
|
-
* getRequestId(); // undefined
|
|
41
|
-
*
|
|
42
|
-
* // Inside context
|
|
43
|
-
* runWithContext('abc', () => {
|
|
44
|
-
* getRequestId(); // 'abc'
|
|
45
|
-
* });
|
|
46
|
-
* ```
|
|
47
15
|
*/
|
|
48
16
|
export declare function getRequestId(): string | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Generate a new unique request ID using UUID v4.
|
|
51
|
-
*
|
|
52
|
-
* @returns A UUID string in standard format
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```typescript
|
|
56
|
-
* const id = generateRequestId();
|
|
57
|
-
* // '550e8400-e29b-41d4-a716-446655440000'
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export declare function generateRequestId(): string;
|
|
61
17
|
//# sourceMappingURL=RequestContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestContext.d.ts","sourceRoot":"","sources":["../../src/context/RequestContext.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"RequestContext.d.ts","sourceRoot":"","sources":["../../src/context/RequestContext.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAEjD"}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
import { randomUUID } from "node:crypto";
|
|
3
2
|
const store = new AsyncLocalStorage();
|
|
4
|
-
function runWithContext(requestId, fn) {
|
|
5
|
-
return store.run({
|
|
6
|
-
requestId
|
|
7
|
-
}, fn);
|
|
8
|
-
}
|
|
9
3
|
function getRequestId() {
|
|
10
4
|
return store.getStore()?.requestId;
|
|
11
5
|
}
|
|
12
|
-
|
|
13
|
-
return randomUUID();
|
|
14
|
-
}
|
|
15
|
-
export { generateRequestId, getRequestId, runWithContext };
|
|
6
|
+
export { getRequestId };
|
|
16
7
|
|
|
17
8
|
//# sourceMappingURL=RequestContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context/RequestContext.js","sources":["../../src/context/RequestContext.ts"],"sourcesContent":["/**\n * Request context management using AsyncLocalStorage for correlation IDs.\n *\n *
|
|
1
|
+
{"version":3,"file":"context/RequestContext.js","sources":["../../src/context/RequestContext.ts"],"sourcesContent":["/**\n * Request context management using AsyncLocalStorage for correlation IDs.\n *\n * Provides zero-cost request ID propagation across async boundaries\n * via Node.js AsyncLocalStorage.\n *\n * @module context\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\n/**\n * Internal context structure stored per-request.\n */\ninterface RequestCtx {\n\trequestId: string;\n}\n\n/**\n * AsyncLocalStorage instance for request context.\n * Stores requestId that propagates across async boundaries.\n */\nconst store = new AsyncLocalStorage<RequestCtx>();\n\n/**\n * Get the current request ID from context.\n *\n * Returns undefined if called outside of a runWithContext() call.\n *\n * @returns The current request ID or undefined\n */\nexport function getRequestId(): string | undefined {\n\treturn store.getStore()?.requestId;\n}\n"],"names":["store","AsyncLocalStorage","getRequestId"],"mappings":";AAsBA,MAAMA,QAAQ,IAAIC;AASX,SAASC;IACf,OAAOF,MAAM,QAAQ,IAAI;AAC1B"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calibrator contracts — interfaces for confidence calibration.
|
|
3
|
+
*
|
|
4
|
+
* Defines the shape of calibration metrics, results, and the calibrator
|
|
5
|
+
* service that maps raw model confidence to calibrated probabilities.
|
|
6
|
+
*
|
|
7
|
+
* @module contracts/calibrator
|
|
8
|
+
*/
|
|
9
|
+
import type { ThoughtType } from '../core/reasoning.js';
|
|
10
|
+
/**
|
|
11
|
+
* Aggregate calibration quality metrics for a session (or globally).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const m: CalibrationMetrics = calibrator.metrics('session-1');
|
|
16
|
+
* console.log(m.brierScore, m.ece, m.sampleCount);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export interface CalibrationMetrics {
|
|
20
|
+
/** Brier score across all samples (lower is better). `null` if no samples. */
|
|
21
|
+
readonly brierScore: number | null;
|
|
22
|
+
/** Expected Calibration Error (lower is better). `null` if no samples. */
|
|
23
|
+
readonly ece: number | null;
|
|
24
|
+
/** Number of (prediction, outcome) samples backing the metrics. */
|
|
25
|
+
readonly sampleCount: number;
|
|
26
|
+
/** Per-thought-type Brier score breakdown. `null` per bucket if empty. */
|
|
27
|
+
readonly perTypeBrier: Record<ThoughtType, number | null>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Result of calibrating a single raw confidence value.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const r: CalibrationResult = calibrator.calibrate(0.9, 'hypothesis', 'session-1');
|
|
35
|
+
* // r.calibrated may be lower than r.raw if the model is over-confident.
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export interface CalibrationResult {
|
|
39
|
+
/** Original raw confidence in `[0, 1]`. */
|
|
40
|
+
readonly raw: number;
|
|
41
|
+
/** Calibrated confidence in `[0, 1]`. */
|
|
42
|
+
readonly calibrated: number;
|
|
43
|
+
/** Temperature used in the calibration mapping (1.0 = identity). */
|
|
44
|
+
readonly temperature: number;
|
|
45
|
+
/** Weight applied to the prior when blending with the raw signal. */
|
|
46
|
+
readonly priorWeight: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Calibrator service contract — converts raw confidence into calibrated
|
|
50
|
+
* probabilities and reports calibration quality.
|
|
51
|
+
*
|
|
52
|
+
* Implementations should be deterministic for the same `(raw, type, sessionId)`
|
|
53
|
+
* triple given a fixed internal state.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const result = calibrator.calibrate(0.85, 'verification', 'session-1');
|
|
58
|
+
* const stats = calibrator.metrics('session-1');
|
|
59
|
+
* calibrator.refit('session-1');
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export interface ICalibrator {
|
|
63
|
+
/** Whether calibration is enabled. When `false`, `calibrate()` returns `raw` unchanged. */
|
|
64
|
+
readonly enabled: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Map a raw confidence value to a calibrated value.
|
|
67
|
+
*
|
|
68
|
+
* @param rawConfidence - Raw confidence in `[0, 1]`.
|
|
69
|
+
* @param type - Thought type the confidence is associated with.
|
|
70
|
+
* @param sessionId - Session identifier for per-session calibration state.
|
|
71
|
+
* @returns The calibration result.
|
|
72
|
+
*/
|
|
73
|
+
calibrate(rawConfidence: number, type: ThoughtType, sessionId: string): CalibrationResult;
|
|
74
|
+
/**
|
|
75
|
+
* Get calibration metrics for a session, or globally if `sessionId` is omitted.
|
|
76
|
+
*
|
|
77
|
+
* @param sessionId - Optional session id; omit for global metrics.
|
|
78
|
+
* @returns Aggregate calibration metrics.
|
|
79
|
+
*/
|
|
80
|
+
metrics(sessionId?: string): CalibrationMetrics;
|
|
81
|
+
/**
|
|
82
|
+
* Refit the calibration model from accumulated samples.
|
|
83
|
+
*
|
|
84
|
+
* @param sessionId - Optional session id; omit to refit global state.
|
|
85
|
+
*/
|
|
86
|
+
refit(sessionId?: string): void;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=calibrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calibrator.d.ts","sourceRoot":"","sources":["../../src/contracts/calibrator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IAClC,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,0EAA0E;IAC1E,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;CAC1D;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IACjC,2CAA2C;IAC3C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qEAAqE;IACrE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,WAAW;IAC3B,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;;;;;OAOG;IACH,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,CAAC;IAC1F;;;;;OAKG;IACH,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,kBAAkB,CAAC;IAChD;;;;OAIG;IACH,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -6,5 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module contracts
|
|
8
8
|
*/
|
|
9
|
-
export { type DiscoveryCacheOptions, type IDiscoveryCache, type IMetrics, type
|
|
9
|
+
export { type DiscoveryCacheOptions, type IDiscoveryCache, type IMetrics, type IOutcomeRecorder, type VerificationOutcome, } from './interfaces.js';
|
|
10
|
+
export type { StrategyContext, StrategyDecision, IReasoningStrategy } from './strategy.js';
|
|
11
|
+
export type { CalibrationMetrics, CalibrationResult, ICalibrator } from './calibrator.js';
|
|
12
|
+
export type { Summary, ISummaryStore } from './summary.js';
|
|
13
|
+
export type { SuspensionRecord, ISuspensionStore } from './suspension.js';
|
|
10
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACxB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE3F,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE1F,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE3D,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @module contracts
|
|
12
12
|
*/
|
|
13
|
+
import type { Edge } from '../core/graph/Edge.js';
|
|
13
14
|
/**
|
|
14
15
|
* Metrics interface for observability.
|
|
15
16
|
*
|
|
@@ -57,51 +58,129 @@ export interface DiscoveryCacheOptions {
|
|
|
57
58
|
metrics?: IMetrics;
|
|
58
59
|
}
|
|
59
60
|
/**
|
|
60
|
-
*
|
|
61
|
+
* Outcome recording interface for calibration data collection.
|
|
61
62
|
*
|
|
62
|
-
*
|
|
63
|
+
* Captures verification outcomes (predicted vs actual) to enable
|
|
64
|
+
* confidence calibration (Brier score, ECE) in later phases.
|
|
63
65
|
*/
|
|
64
|
-
export interface
|
|
65
|
-
|
|
66
|
+
export interface VerificationOutcome {
|
|
67
|
+
/** The thought id that made the prediction. */
|
|
68
|
+
thoughtId: string;
|
|
69
|
+
/** The thought number of the prediction (backward compat). */
|
|
70
|
+
thoughtNumber: number;
|
|
71
|
+
/** The session this outcome belongs to. */
|
|
72
|
+
sessionId: string;
|
|
73
|
+
/** The predicted confidence (0-1). */
|
|
74
|
+
predicted: number;
|
|
75
|
+
/** The actual outcome (0 = wrong, 1 = correct). */
|
|
76
|
+
actual: 0 | 1;
|
|
77
|
+
/** The thought type that made the prediction. */
|
|
78
|
+
type: string;
|
|
79
|
+
/** Timestamp of outcome recording. */
|
|
80
|
+
recordedAt: number;
|
|
66
81
|
}
|
|
67
82
|
/**
|
|
68
|
-
*
|
|
83
|
+
* Interface for recording verification outcomes for calibration.
|
|
69
84
|
*
|
|
70
|
-
*
|
|
85
|
+
* Implementation is no-op when feature flags disable outcome recording.
|
|
86
|
+
* Enabled outcomes feed into the Calibrator (Phase 1 Wave A.3) for
|
|
87
|
+
* Brier score and ECE computation.
|
|
71
88
|
*/
|
|
72
|
-
export interface
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
export interface IOutcomeRecorder {
|
|
90
|
+
/**
|
|
91
|
+
* Record a verification outcome.
|
|
92
|
+
* No-op when outcome recording is disabled.
|
|
93
|
+
*/
|
|
94
|
+
recordVerification(outcome: Omit<VerificationOutcome, 'recordedAt'>): void;
|
|
95
|
+
/**
|
|
96
|
+
* Get all recorded outcomes for a session.
|
|
97
|
+
* Returns empty array when disabled or no outcomes recorded.
|
|
98
|
+
*/
|
|
99
|
+
getOutcomes(sessionId: string): VerificationOutcome[];
|
|
100
|
+
/**
|
|
101
|
+
* Get outcomes across all sessions.
|
|
102
|
+
* Returns empty array when disabled.
|
|
103
|
+
*/
|
|
104
|
+
getAllOutcomes(): VerificationOutcome[];
|
|
105
|
+
/**
|
|
106
|
+
* Clear outcomes for a specific session.
|
|
107
|
+
*/
|
|
108
|
+
clearOutcomes(sessionId: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Whether outcome recording is currently enabled.
|
|
111
|
+
*/
|
|
112
|
+
readonly enabled: boolean;
|
|
82
113
|
}
|
|
83
114
|
/**
|
|
84
|
-
*
|
|
115
|
+
* Edge store interface for managing directed acyclic graph edges.
|
|
85
116
|
*
|
|
86
|
-
*
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
discover(): void;
|
|
93
|
-
discoverAsync(): Promise<number>;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Skill registry interface for managing Claude skills.
|
|
117
|
+
* Stores relationships between thoughts as typed directed edges.
|
|
118
|
+
* Each edge connects two thoughts (by their `id` field) with a semantic
|
|
119
|
+
* relationship kind that drives reasoning controller decisions.
|
|
120
|
+
*
|
|
121
|
+
* Implementations must provide per-session isolation — edges in one
|
|
122
|
+
* session are invisible to another.
|
|
97
123
|
*
|
|
98
|
-
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const store: IEdgeStore = new EdgeStore();
|
|
127
|
+
* store.addEdge({ id: 'abc', from: 'thought-1', to: 'thought-2', kind: 'sequence', sessionId: 's1', createdAt: Date.now() });
|
|
128
|
+
* const edges = store.outgoing('s1', 'thought-1');
|
|
129
|
+
* ```
|
|
99
130
|
*/
|
|
100
|
-
export interface
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
131
|
+
export interface IEdgeStore {
|
|
132
|
+
/**
|
|
133
|
+
* Add a directed edge to the store.
|
|
134
|
+
* Rejects self-edges (from === to) by throwing InvalidEdgeError.
|
|
135
|
+
* Deduplicates identical (from, to, kind, sessionId) tuples silently.
|
|
136
|
+
*
|
|
137
|
+
* @param edge - The edge to add
|
|
138
|
+
* @throws {InvalidEdgeError} When from === to
|
|
139
|
+
*/
|
|
140
|
+
addEdge(edge: Edge): void;
|
|
141
|
+
/**
|
|
142
|
+
* Retrieve a specific edge by its id.
|
|
143
|
+
*
|
|
144
|
+
* @param id - The edge's unique identifier
|
|
145
|
+
* @returns The edge, or undefined if not found
|
|
146
|
+
*/
|
|
147
|
+
getEdge(id: string): Edge | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Get all outgoing edges from a thought, sorted by createdAt ascending.
|
|
150
|
+
*
|
|
151
|
+
* @param sessionId - Session to query within
|
|
152
|
+
* @param from - Source thought id
|
|
153
|
+
* @returns Array of outgoing edges (may be empty)
|
|
154
|
+
*/
|
|
155
|
+
outgoing(sessionId: string, from: string): readonly Edge[];
|
|
156
|
+
/**
|
|
157
|
+
* Get all incoming edges to a thought, sorted by createdAt ascending.
|
|
158
|
+
*
|
|
159
|
+
* @param sessionId - Session to query within
|
|
160
|
+
* @param to - Target thought id
|
|
161
|
+
* @returns Array of incoming edges (may be empty)
|
|
162
|
+
*/
|
|
163
|
+
incoming(sessionId: string, to: string): readonly Edge[];
|
|
164
|
+
/**
|
|
165
|
+
* Get all edges in a session.
|
|
166
|
+
*
|
|
167
|
+
* @param sessionId - Session to query
|
|
168
|
+
* @returns All edges in the session (may be empty)
|
|
169
|
+
*/
|
|
170
|
+
edgesForSession(sessionId: string): readonly Edge[];
|
|
171
|
+
/**
|
|
172
|
+
* Clear all edges for a specific session.
|
|
173
|
+
* Other sessions are unaffected.
|
|
174
|
+
*
|
|
175
|
+
* @param sessionId - Session to clear
|
|
176
|
+
*/
|
|
177
|
+
clearSession(sessionId: string): void;
|
|
178
|
+
/**
|
|
179
|
+
* Count edges.
|
|
180
|
+
*
|
|
181
|
+
* @param sessionId - If provided, count for that session only
|
|
182
|
+
* @returns Total edge count (across all sessions if no sessionId provided)
|
|
183
|
+
*/
|
|
184
|
+
size(sessionId?: string): number;
|
|
106
185
|
}
|
|
107
186
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/contracts/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/contracts/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACxB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5F,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,E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