tracelattice 1.2.9 → 1.3.0
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/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__/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 +4 -4
- 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 +91 -0
- package/dist/core/HistoryManager.d.ts.map +1 -1
- package/dist/core/HistoryManager.js +140 -5
- package/dist/core/HistoryManager.js.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/ThoughtEvaluator.d.ts +14 -99
- package/dist/core/ThoughtEvaluator.d.ts.map +1 -1
- package/dist/core/ThoughtEvaluator.js +54 -331
- package/dist/core/ThoughtEvaluator.js.map +1 -1
- package/dist/core/ThoughtFormatter.d.ts.map +1 -1
- package/dist/core/ThoughtFormatter.js +21 -0
- package/dist/core/ThoughtFormatter.js.map +1 -1
- package/dist/core/ThoughtProcessor.d.ts +50 -50
- package/dist/core/ThoughtProcessor.d.ts.map +1 -1
- package/dist/core/ThoughtProcessor.js +123 -2
- 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 +64 -0
- package/dist/core/evaluator/SignalComputer.d.ts.map +1 -0
- package/dist/core/evaluator/SignalComputer.js +68 -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/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 +6 -1
- package/dist/core/reasoning.d.ts.map +1 -1
- package/dist/core/thought.d.ts +29 -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 +56 -12
- package/dist/lib.js.map +1 -1
- package/dist/persistence/FilePersistence.d.ts +49 -0
- package/dist/persistence/FilePersistence.d.ts.map +1 -1
- package/dist/persistence/FilePersistence.js +112 -1
- package/dist/persistence/FilePersistence.js.map +1 -1
- package/dist/persistence/MemoryPersistence.d.ts +34 -0
- package/dist/persistence/MemoryPersistence.d.ts.map +1 -1
- package/dist/persistence/MemoryPersistence.js +30 -0
- package/dist/persistence/MemoryPersistence.js.map +1 -1
- package/dist/persistence/PersistenceBackend.d.ts +34 -0
- package/dist/persistence/PersistenceBackend.d.ts.map +1 -1
- package/dist/persistence/SqlitePersistence.d.ts +35 -0
- package/dist/persistence/SqlitePersistence.d.ts.map +1 -1
- package/dist/persistence/SqlitePersistence.js +98 -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 +26 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +34 -3
- 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 +3 -3
- 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
package/README.md
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
#
|
|
1
|
+
# TraceLattice
|
|
2
2
|
|
|
3
|
-
An MCP (Model Context Protocol) server
|
|
3
|
+
An MCP (Model Context Protocol) server providing structured sequential thinking with tool/skill recommendations, DAG-based thought relationships, configurable reasoning strategies, and confidence calibration for AI agents.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
7
|
+
- **Structured Thinking**: 11 thought types — regular, hypothesis, verification, critique, synthesis, meta, tool_call, tool_observation, assumption, decomposition, backtrack
|
|
8
|
+
- **DAG Thought Graph**: Multi-parent edges (sequence, branch, merge, verifies, critiques, derives_from, tool_invocation, revises) with topological traversal
|
|
9
|
+
- **Reasoning Strategies**: Pluggable strategy system — sequential (default) or Tree-of-Thought (BFS/beam search with plateau detection)
|
|
10
|
+
- **Tool Interleave**: Suspend/resume flow for interleaving tool calls within thinking chains
|
|
11
|
+
- **Confidence Calibration**: Beta(2,2) priors with Brier score and Expected Calibration Error (ECE)
|
|
12
|
+
- **Branch Compression**: Automatic rollup of cold branches into summaries with sliding-window dehydration
|
|
13
|
+
- **Outcome Recording**: Track tool_call/tool_observation results with metadata
|
|
14
|
+
- **Tool & Skill Recommendations**: AI-driven selection with confidence scores, rationales, and automatic skill discovery
|
|
15
|
+
- **Multi-Session**: Per-session isolation with TTL eviction and LRU caching
|
|
16
|
+
- **Multi-Transport**: stdio, SSE (legacy), and Streamable HTTP (production)
|
|
17
|
+
- **Type-Safe**: Strict TypeScript with Valibot validation, 1913 tests, 18-service DI container
|
|
13
18
|
|
|
14
19
|
## Install
|
|
15
20
|
|
|
16
|
-
Requires [Node.js](https://nodejs.org/)
|
|
21
|
+
Requires [Node.js](https://nodejs.org/) v22+.
|
|
17
22
|
|
|
18
23
|
```bash
|
|
19
24
|
npm install -g tracelattice
|
|
@@ -83,9 +88,54 @@ codex mcp add tracelattice -- tracelattice
|
|
|
83
88
|
|
|
84
89
|
## Configuration
|
|
85
90
|
|
|
91
|
+
### Server
|
|
92
|
+
|
|
86
93
|
| Variable | Default | Description |
|
|
87
94
|
|----------|---------|-------------|
|
|
88
95
|
| `MAX_HISTORY_SIZE` | `1000` | Maximum thoughts to keep in history |
|
|
96
|
+
| `MAX_BRANCHES` | `50` | Maximum number of branches |
|
|
97
|
+
| `MAX_BRANCH_SIZE` | `100` | Maximum size of each branch |
|
|
98
|
+
| `LOG_LEVEL` | `info` | Log level: `debug`, `info`, `warn`, `error` |
|
|
99
|
+
| `PRETTY_LOG` | `true` | Enable pretty log output |
|
|
100
|
+
|
|
101
|
+
### Feature Flags
|
|
102
|
+
|
|
103
|
+
All flags default to `false`. Set to `true` or `1` to enable.
|
|
104
|
+
|
|
105
|
+
| Variable | Description |
|
|
106
|
+
|----------|-------------|
|
|
107
|
+
| `TRACELATTICE_FEATURES_DAG_EDGES` | Enable DAG edges for thought relationships |
|
|
108
|
+
| `TRACELATTICE_FEATURES_CALIBRATION` | Enable confidence calibration with Beta(2,2) priors |
|
|
109
|
+
| `TRACELATTICE_FEATURES_COMPRESSION` | Enable branch compression for cold branches |
|
|
110
|
+
| `TRACELATTICE_FEATURES_TOOL_INTERLEAVE` | Enable suspend/resume for tool calls |
|
|
111
|
+
| `TRACELATTICE_FEATURES_NEW_THOUGHT_TYPES` | Enable tool_call, tool_observation, assumption, decomposition, backtrack |
|
|
112
|
+
| `TRACELATTICE_FEATURES_OUTCOME_RECORDING` | Enable outcome recording for tool results |
|
|
113
|
+
| `TRACELATTICE_FEATURES_REASONING_STRATEGY` | Strategy: `sequential` (default) or `tot` |
|
|
114
|
+
|
|
115
|
+
### Transport
|
|
116
|
+
|
|
117
|
+
| Variable | Default | Description |
|
|
118
|
+
|----------|---------|-------------|
|
|
119
|
+
| `TRANSPORT_TYPE` | `stdio` | Transport: `stdio`, `sse`, or `streamable-http` |
|
|
120
|
+
| `STREAMABLE_HTTP_PORT` | `3000` | Port for Streamable HTTP server |
|
|
121
|
+
| `STREAMABLE_HTTP_HOST` | `localhost` | Host for Streamable HTTP server |
|
|
122
|
+
| `STREAMABLE_HTTP_STATEFUL` | `true` | Enable stateful session tracking |
|
|
123
|
+
| `SSE_PORT` | `3000` | Port for SSE server |
|
|
124
|
+
| `SSE_HOST` | `localhost` | Host for SSE server |
|
|
125
|
+
| `SSE_ENABLE_POOL` | `true` | Enable connection pool for session isolation |
|
|
126
|
+
| `SSE_MAX_SESSIONS` | `100` | Maximum concurrent SSE sessions |
|
|
127
|
+
| `SSE_SESSION_TIMEOUT` | `300000` | SSE session timeout (ms) |
|
|
128
|
+
| `CORS_ORIGIN` | `*` | CORS origin |
|
|
129
|
+
| `ENABLE_CORS` | `true` | Enable CORS preflight |
|
|
130
|
+
| `ALLOWED_HOSTS` | (all) | Comma-separated allowed hosts |
|
|
131
|
+
|
|
132
|
+
### Skill Discovery
|
|
133
|
+
|
|
134
|
+
| Variable | Default | Description |
|
|
135
|
+
|----------|---------|-------------|
|
|
136
|
+
| `SKILL_DIRS` | (none) | Colon-separated skill directories |
|
|
137
|
+
| `DISCOVERY_CACHE_TTL` | `300000` | Discovery cache TTL (ms) |
|
|
138
|
+
| `DISCOVERY_CACHE_MAX_SIZE` | `100` | Discovery cache max entries |
|
|
89
139
|
|
|
90
140
|
## Transports
|
|
91
141
|
|
|
@@ -100,10 +150,30 @@ The server supports three transports via the `TRANSPORT_TYPE` environment variab
|
|
|
100
150
|
|
|
101
151
|
```bash
|
|
102
152
|
npm install
|
|
103
|
-
npm run dev
|
|
104
|
-
npm test
|
|
105
|
-
npm run
|
|
106
|
-
npm run
|
|
153
|
+
npm run dev # MCP inspector
|
|
154
|
+
npm test # 1913 tests (vitest)
|
|
155
|
+
npm run test:coverage # with coverage report
|
|
156
|
+
npm run type-check # tsc --noEmit
|
|
157
|
+
npm run lint # eslint
|
|
158
|
+
npm run build # rslib + rsbuild
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Architecture
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
src/
|
|
165
|
+
├── core/ # Domain logic
|
|
166
|
+
│ ├── graph/ # DAG edges: Edge, EdgeStore, GraphView
|
|
167
|
+
│ ├── evaluator/ # SignalComputer, Aggregator, PatternDetector, Calibrator
|
|
168
|
+
│ ├── compression/ # CompressionService, DehydrationPolicy, SummaryStore
|
|
169
|
+
│ ├── reasoning/ # OutcomeRecorder + strategies (Sequential, TreeOfThought)
|
|
170
|
+
│ └── tools/ # InMemorySuspensionStore (suspend/resume)
|
|
171
|
+
├── contracts/ # Shared interfaces (cross-module coupling point)
|
|
172
|
+
├── persistence/ # File, SQLite, Memory backends
|
|
173
|
+
├── transport/ # stdio, SSE, Streamable HTTP
|
|
174
|
+
├── di/ # IoC container (18 services)
|
|
175
|
+
├── registry/ # Tool/Skill discovery with LRU cache
|
|
176
|
+
└── config/ # YAML + env var loading
|
|
107
177
|
```
|
|
108
178
|
|
|
109
179
|
## License
|
package/dist/ServerConfig.d.ts
CHANGED
|
@@ -23,6 +23,29 @@ import type { PersistenceConfig } from './persistence/PersistenceBackend.js';
|
|
|
23
23
|
* };
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
+
/**
|
|
27
|
+
* Feature flags for opt-in TraceLattice capabilities.
|
|
28
|
+
*
|
|
29
|
+
* All flags default to OFF so new features can be merged behind a flag
|
|
30
|
+
* without altering existing behavior. Flags are flat to keep env var
|
|
31
|
+
* mappings predictable (TRACELATTICE_FEATURES_*).
|
|
32
|
+
*/
|
|
33
|
+
export interface FeatureFlags {
|
|
34
|
+
/** Enable DAG edges between thoughts (Item #1). @default false */
|
|
35
|
+
dagEdges: boolean;
|
|
36
|
+
/** Reasoning strategy selector (Item #2). @default 'sequential' */
|
|
37
|
+
reasoningStrategy: 'sequential' | 'tot';
|
|
38
|
+
/** Enable confidence calibration (Item #3). @default false */
|
|
39
|
+
calibration: boolean;
|
|
40
|
+
/** Enable thought compression (Item #5). @default false */
|
|
41
|
+
compression: boolean;
|
|
42
|
+
/** Enable tool interleaving (Item #6). @default false */
|
|
43
|
+
toolInterleave: boolean;
|
|
44
|
+
/** Enable new thought types (Item #8). @default false */
|
|
45
|
+
newThoughtTypes: boolean;
|
|
46
|
+
/** Enable outcome recording (prereq for Item #10). @default false */
|
|
47
|
+
outcomeRecording: boolean;
|
|
48
|
+
}
|
|
26
49
|
export interface ServerConfigOptions {
|
|
27
50
|
/**
|
|
28
51
|
* Maximum number of thoughts to keep in history.
|
|
@@ -78,6 +101,21 @@ export interface ServerConfigOptions {
|
|
|
78
101
|
* @default 3
|
|
79
102
|
*/
|
|
80
103
|
persistenceMaxRetries?: number;
|
|
104
|
+
/**
|
|
105
|
+
* Feature flag overrides. Missing fields are filled with defaults (all OFF,
|
|
106
|
+
* reasoningStrategy='sequential').
|
|
107
|
+
*/
|
|
108
|
+
features?: Partial<FeatureFlags>;
|
|
109
|
+
/**
|
|
110
|
+
* TTL in milliseconds for suspended tool-interleave entries in SuspensionStore.
|
|
111
|
+
* @default 60000
|
|
112
|
+
*/
|
|
113
|
+
toolInterleaveTtlMs?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Sweep interval in milliseconds for SuspensionStore expiration cleanup.
|
|
116
|
+
* @default 60000
|
|
117
|
+
*/
|
|
118
|
+
toolInterleaveSweepMs?: number;
|
|
81
119
|
}
|
|
82
120
|
/**
|
|
83
121
|
* Server configuration with validation and defaults.
|
|
@@ -129,6 +167,12 @@ export declare class ServerConfig {
|
|
|
129
167
|
persistenceFlushInterval: number;
|
|
130
168
|
/** Maximum number of retries for failed persistence flushes. */
|
|
131
169
|
persistenceMaxRetries: number;
|
|
170
|
+
/** Feature flag toggles. */
|
|
171
|
+
features: FeatureFlags;
|
|
172
|
+
/** TTL in milliseconds for suspended tool-interleave entries. */
|
|
173
|
+
toolInterleaveTtlMs: number;
|
|
174
|
+
/** Sweep interval in milliseconds for SuspensionStore expiration cleanup. */
|
|
175
|
+
toolInterleaveSweepMs: number;
|
|
132
176
|
/**
|
|
133
177
|
* Creates a new ServerConfig instance with validation.
|
|
134
178
|
*
|
|
@@ -209,6 +253,22 @@ export declare class ServerConfig {
|
|
|
209
253
|
* @private
|
|
210
254
|
*/
|
|
211
255
|
private validatePersistenceMaxRetries;
|
|
256
|
+
/**
|
|
257
|
+
* Validates feature flags and fills defaults for missing fields.
|
|
258
|
+
* @param value - Partial feature flag overrides
|
|
259
|
+
* @returns Fully populated FeatureFlags with defaults applied
|
|
260
|
+
* @private
|
|
261
|
+
*/
|
|
262
|
+
private validateFeatures;
|
|
263
|
+
/**
|
|
264
|
+
* Validates a positive millisecond value with a default fallback.
|
|
265
|
+
* @param value - The value to validate
|
|
266
|
+
* @param defaultValue - Default applied if value is undefined/null
|
|
267
|
+
* @param fieldName - Field name for error messages
|
|
268
|
+
* @returns The validated millisecond value
|
|
269
|
+
* @private
|
|
270
|
+
*/
|
|
271
|
+
private validatePositiveMs;
|
|
212
272
|
/**
|
|
213
273
|
* Converts the configuration to a plain object.
|
|
214
274
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerConfig.d.ts","sourceRoot":"","sources":["../src/ServerConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB;;OAEG;IACH,cAAc,CAAC,EAAE;QAChB;;;WAGG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;QACb;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF;;OAEG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAEhC;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAC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;IACrB,QAAQ,EAAE,YAAY,CAAC;IAE9B,iEAAiE;IAC1D,mBAAmB,EAAE,MAAM,CAAC;IAEnC,6EAA6E;IACtE,qBAAqB,EAAE,MAAM,CAAC;IAErC;;;;;;;;;;;;;;;OAeG;gBACS,OAAO,GAAE,mBAAwB;IAyB7C;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAe9B;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAe3B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAU9B;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAyB3B;;;;;OAKG;IACH,OAAO,CAAC,6BAA6B;IAerC;;;;;OAKG;IACH,OAAO,CAAC,gCAAgC;IAiBxC;;;;;OAKG;IACH,OAAO,CAAC,6BAA6B;IAerC;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAYxB;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAe1B;;;;;;;;;;;;;;OAcG;IACI,MAAM,IAAI,mBAAmB;CAgBpC"}
|
package/dist/ServerConfig.js
CHANGED
|
@@ -11,6 +11,9 @@ class ServerConfig {
|
|
|
11
11
|
persistenceBufferSize;
|
|
12
12
|
persistenceFlushInterval;
|
|
13
13
|
persistenceMaxRetries;
|
|
14
|
+
features;
|
|
15
|
+
toolInterleaveTtlMs;
|
|
16
|
+
toolInterleaveSweepMs;
|
|
14
17
|
constructor(options = {}){
|
|
15
18
|
this.maxHistorySize = this.validateMaxHistorySize(options.maxHistorySize);
|
|
16
19
|
this.maxBranches = this.validateMaxBranches(options.maxBranches);
|
|
@@ -21,6 +24,9 @@ class ServerConfig {
|
|
|
21
24
|
this.persistenceBufferSize = this.validatePersistenceBufferSize(options.persistenceBufferSize);
|
|
22
25
|
this.persistenceFlushInterval = this.validatePersistenceFlushInterval(options.persistenceFlushInterval);
|
|
23
26
|
this.persistenceMaxRetries = this.validatePersistenceMaxRetries(options.persistenceMaxRetries);
|
|
27
|
+
this.features = this.validateFeatures(options.features);
|
|
28
|
+
this.toolInterleaveTtlMs = this.validatePositiveMs(options.toolInterleaveTtlMs, 60000, 'toolInterleaveTtlMs');
|
|
29
|
+
this.toolInterleaveSweepMs = this.validatePositiveMs(options.toolInterleaveSweepMs, 60000, 'toolInterleaveSweepMs');
|
|
24
30
|
}
|
|
25
31
|
validateMaxHistorySize(value) {
|
|
26
32
|
const defaultValue = 1000;
|
|
@@ -102,6 +108,23 @@ class ServerConfig {
|
|
|
102
108
|
if (value > 10) throw new ConfigurationError(`persistenceMaxRetries must not exceed 10, got ${value}`);
|
|
103
109
|
return value;
|
|
104
110
|
}
|
|
111
|
+
validateFeatures(value) {
|
|
112
|
+
return {
|
|
113
|
+
dagEdges: value?.dagEdges ?? false,
|
|
114
|
+
reasoningStrategy: value?.reasoningStrategy ?? 'sequential',
|
|
115
|
+
calibration: value?.calibration ?? false,
|
|
116
|
+
compression: value?.compression ?? false,
|
|
117
|
+
toolInterleave: value?.toolInterleave ?? false,
|
|
118
|
+
newThoughtTypes: value?.newThoughtTypes ?? false,
|
|
119
|
+
outcomeRecording: value?.outcomeRecording ?? false
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
validatePositiveMs(value, defaultValue, fieldName) {
|
|
123
|
+
if (null == value) return defaultValue;
|
|
124
|
+
if ('number' != typeof value || !Number.isFinite(value)) throw new ConfigurationError(`${fieldName} must be a finite number, got ${value}`);
|
|
125
|
+
if (value < 1) throw new ConfigurationError(`${fieldName} must be at least 1, got ${value}`);
|
|
126
|
+
return value;
|
|
127
|
+
}
|
|
105
128
|
toJSON() {
|
|
106
129
|
return {
|
|
107
130
|
maxHistorySize: this.maxHistorySize,
|
|
@@ -112,7 +135,10 @@ class ServerConfig {
|
|
|
112
135
|
persistence: this.persistence,
|
|
113
136
|
persistenceBufferSize: this.persistenceBufferSize,
|
|
114
137
|
persistenceFlushInterval: this.persistenceFlushInterval,
|
|
115
|
-
persistenceMaxRetries: this.persistenceMaxRetries
|
|
138
|
+
persistenceMaxRetries: this.persistenceMaxRetries,
|
|
139
|
+
features: this.features,
|
|
140
|
+
toolInterleaveTtlMs: this.toolInterleaveTtlMs,
|
|
141
|
+
toolInterleaveSweepMs: this.toolInterleaveSweepMs
|
|
116
142
|
};
|
|
117
143
|
}
|
|
118
144
|
}
|
package/dist/ServerConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerConfig.js","sources":["../src/ServerConfig.ts"],"sourcesContent":["/**\n * Server configuration management with validation.\n *\n * This module provides the `ServerConfig` class which handles all server configuration\n * with built-in validation and sensible defaults. Configuration values are validated\n * on construction and warnings are emitted for out-of-range values.\n *\n * @module ServerConfig\n */\n\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { ConfigurationError } from './errors.js';\nimport type { PersistenceConfig } from './persistence/PersistenceBackend.js';\n\n/**\n * Configuration options for creating a `ServerConfig` instance.\n *\n * All properties are optional with sensible defaults applied during validation.\n *\n * @example\n * ```typescript\n * const options: ServerConfigOptions = {\n * maxHistorySize: 500,\n * maxBranches: 25,\n * skillDirs: ['./custom-skills'],\n * persistence: { enabled: true, backend: 'sqlite' }\n * };\n * ```\n */\nexport interface ServerConfigOptions {\n\t/**\n\t * Maximum number of thoughts to keep in history.\n\t * @default 1000\n\t */\n\tmaxHistorySize?: number;\n\n\t/**\n\t * Maximum number of branches to maintain.\n\t * @default 50\n\t */\n\tmaxBranches?: number;\n\n\t/**\n\t * Maximum size of each branch.\n\t * @default 100\n\t */\n\tmaxBranchSize?: number;\n\n\t/**\n\t * Directory paths to search for skills.\n\t * @default ['.claude/skills', '~/.claude/skills']\n\t */\n\tskillDirs?: string[];\n\n\t/**\n\t * Discovery cache configuration.\n\t */\n\tdiscoveryCache?: {\n\t\t/**\n\t\t * Time-to-live for cache entries in milliseconds.\n\t\t * @default 300000 (5 minutes)\n\t\t */\n\t\tttl?: number;\n\t\t/**\n\t\t * Maximum number of entries in the cache.\n\t\t * @default 100\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 * Maximum number of thoughts to buffer before flushing to persistence.\n\t * @default 100\n\t */\n\tpersistenceBufferSize?: number;\n\n\t/**\n\t * Interval in milliseconds between periodic persistence flushes.\n\t * @default 1000\n\t */\n\tpersistenceFlushInterval?: number;\n\n\t/**\n\t * Maximum number of retries for failed persistence flushes.\n\t * @default 3\n\t */\n\tpersistenceMaxRetries?: number;\n}\n\n/**\n * Server configuration with validation and defaults.\n *\n * This class manages all server configuration including history limits,\n * branch limits, skill directories, discovery cache settings, and persistence.\n * All values are validated on construction with appropriate defaults applied.\n *\n * @remarks\n * - Values outside recommended ranges trigger warnings but are still applied\n * - Environment variables override file-based configuration\n * - The `toJSON()` method provides a plain object representation\n *\n * @example\n * ```typescript\n * // Using defaults\n * const config1 = new ServerConfig();\n * console.log(config1.maxHistorySize); // 1000\n *\n * // With custom options\n * const config2 = new ServerConfig({\n * maxHistorySize: 500,\n * persistence: { enabled: true, backend: 'file', options: { dataDir: './data' } }\n * });\n *\n * // Export as plain object\n * const json = config2.toJSON();\n * ```\n */\nexport class ServerConfig {\n\t/** Maximum number of thoughts to keep in history. */\n\tpublic maxHistorySize: number;\n\n\t/** Maximum number of branches to maintain. */\n\tpublic maxBranches: number;\n\n\t/** Maximum size of each branch. */\n\tpublic maxBranchSize: number;\n\n\t/** Directory paths to search for skills. */\n\tpublic skillDirs: string[];\n\n\t/** Discovery cache configuration. */\n\tpublic discoveryCache: { ttl: number; maxSize: number };\n\n\t/** Persistence configuration. */\n\tpublic persistence: PersistenceConfig;\n\n\t/** Maximum number of thoughts to buffer before flushing to persistence. */\n\tpublic persistenceBufferSize: number;\n\n\t/** Interval in milliseconds between periodic persistence flushes. */\n\tpublic persistenceFlushInterval: number;\n\n\t/** Maximum number of retries for failed persistence flushes. */\n\tpublic persistenceMaxRetries: number;\n\n\t/**\n\t * Creates a new ServerConfig instance with validation.\n\t *\n\t * All values are validated and defaults are applied for undefined options.\n\t * Warnings are emitted to console for values outside recommended ranges.\n\t *\n\t * @param options - Optional configuration overrides\n\t *\n\t * @example\n\t * ```typescript\n\t * const config = new ServerConfig({\n\t * maxHistorySize: 500,\n\t * skillDirs: ['./my-skills']\n\t * });\n\t * ```\n\t */\n\tconstructor(options: ServerConfigOptions = {}) {\n\t\tthis.maxHistorySize = this.validateMaxHistorySize(options.maxHistorySize);\n\t\tthis.maxBranches = this.validateMaxBranches(options.maxBranches);\n\t\tthis.maxBranchSize = this.validateMaxBranchSize(options.maxBranchSize);\n\t\tthis.skillDirs = this.validateSkillDirs(options.skillDirs);\n\t\tthis.discoveryCache = this.validateDiscoveryCache(options.discoveryCache);\n\t\tthis.persistence = this.validatePersistence(options.persistence);\n\t\tthis.persistenceBufferSize = this.validatePersistenceBufferSize(options.persistenceBufferSize);\n\t\tthis.persistenceFlushInterval = this.validatePersistenceFlushInterval(\n\t\t\toptions.persistenceFlushInterval\n\t\t);\n\t\tthis.persistenceMaxRetries = this.validatePersistenceMaxRetries(options.persistenceMaxRetries);\n\t}\n\n\t/**\n\t * Validates the max history size value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default (1000)\n\t * @private\n\t */\n\tprivate validateMaxHistorySize(value?: number): number {\n\t\tconst defaultValue = 1000;\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(`maxHistorySize must be a finite number, got ${value}`);\n\t\t}\n\t\tif (value < 1) {\n\t\t\tthrow new ConfigurationError(`maxHistorySize must be at least 1, got ${value}`);\n\t\t}\n\t\tif (value > 10000) {\n\t\t\tthrow new ConfigurationError(`maxHistorySize must not exceed 10000, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates the max branches value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default (50)\n\t * @private\n\t */\n\tprivate validateMaxBranches(value?: number): number {\n\t\tconst defaultValue = 50;\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(`maxBranches must be a finite number, got ${value}`);\n\t\t}\n\t\tif (value < 0) {\n\t\t\tthrow new ConfigurationError(`maxBranches must be non-negative, got ${value}`);\n\t\t}\n\t\tif (value > 1000) {\n\t\t\tthrow new ConfigurationError(`maxBranches must not exceed 1000, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates the max branch size value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default (100)\n\t * @private\n\t */\n\tprivate validateMaxBranchSize(value?: number): number {\n\t\tconst defaultValue = 100;\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(`maxBranchSize must be a finite number, got ${value}`);\n\t\t}\n\t\tif (value < 1) {\n\t\t\tthrow new ConfigurationError(`maxBranchSize must be at least 1, got ${value}`);\n\t\t}\n\t\tif (value > 1000) {\n\t\t\tthrow new ConfigurationError(`maxBranchSize must not exceed 1000, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates the skill directories value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default ['.claude/skills', '~/.claude/skills']\n\t * @private\n\t */\n\tprivate validateSkillDirs(value?: string[]): string[] {\n\t\tconst defaultValue = ['.claude/skills', join(homedir(), '.claude/skills')];\n\t\tif (!value) return defaultValue;\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates the discovery cache configuration.\n\t * @param value - The value to validate\n\t * @returns The validated value with defaults applied\n\t * @private\n\t */\n\tprivate validateDiscoveryCache(value?: { ttl?: number; maxSize?: number }): {\n\t\tttl: number;\n\t\tmaxSize: number;\n\t} {\n\t\treturn {\n\t\t\tttl: value?.ttl ?? 300000,\n\t\t\tmaxSize: value?.maxSize ?? 100,\n\t\t};\n\t}\n\n\t/**\n\t * Validates the persistence configuration.\n\t * @param value - The value to validate\n\t * @returns The validated value with defaults applied\n\t * @private\n\t */\n\tprivate validatePersistence(value?: PersistenceConfig): PersistenceConfig {\n\t\tif (!value) {\n\t\t\t// Default to in-memory (no actual persistence, just consistency)\n\t\t\treturn {\n\t\t\t\tenabled: false,\n\t\t\t\tbackend: 'memory',\n\t\t\t};\n\t\t}\n\n\t\t// Validate backend type\n\t\tconst validBackends = ['file', 'sqlite', 'memory'];\n\t\tconst backend = value.backend ?? 'memory';\n\t\tif (!validBackends.includes(backend)) {\n\t\t\tthrow new ConfigurationError(\n\t\t\t\t`persistence.backend must be one of ${validBackends.join(', ')}, got ${backend}`\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\tenabled: value.enabled ?? false,\n\t\t\tbackend,\n\t\t\toptions: value.options ?? {},\n\t\t};\n\t}\n\n\t/**\n\t * Validates the persistence buffer size value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default (100)\n\t * @private\n\t */\n\tprivate validatePersistenceBufferSize(value?: number): number {\n\t\tconst defaultValue = 100;\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(`persistenceBufferSize must be a finite number, got ${value}`);\n\t\t}\n\t\tif (value < 1) {\n\t\t\tthrow new ConfigurationError(`persistenceBufferSize must be at least 1, got ${value}`);\n\t\t}\n\t\tif (value > 10000) {\n\t\t\tthrow new ConfigurationError(`persistenceBufferSize must not exceed 10000, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates the persistence flush interval value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default (1000)\n\t * @private\n\t */\n\tprivate validatePersistenceFlushInterval(value?: number): number {\n\t\tconst defaultValue = 1000;\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(\n\t\t\t\t`persistenceFlushInterval must be a finite number, got ${value}`\n\t\t\t);\n\t\t}\n\t\tif (value < 100) {\n\t\t\tthrow new ConfigurationError(`persistenceFlushInterval must be at least 100, got ${value}`);\n\t\t}\n\t\tif (value > 60000) {\n\t\t\tthrow new ConfigurationError(`persistenceFlushInterval must not exceed 60000, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates the persistence max retries value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default (3)\n\t * @private\n\t */\n\tprivate validatePersistenceMaxRetries(value?: number): number {\n\t\tconst defaultValue = 3;\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(`persistenceMaxRetries must be a finite number, got ${value}`);\n\t\t}\n\t\tif (value < 0) {\n\t\t\tthrow new ConfigurationError(`persistenceMaxRetries must be non-negative, got ${value}`);\n\t\t}\n\t\tif (value > 10) {\n\t\t\tthrow new ConfigurationError(`persistenceMaxRetries must not exceed 10, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Converts the configuration to a plain object.\n\t *\n\t * Useful for serialization, logging, or when a plain object representation\n\t * is preferred over the ServerConfig instance.\n\t *\n\t * @returns A plain object representation of the configuration\n\t *\n\t * @example\n\t * ```typescript\n\t * const config = new ServerConfig({ maxHistorySize: 500 });\n\t * const json = config.toJSON();\n\t * console.log(JSON.stringify(json, null, 2));\n\t * ```\n\t */\n\tpublic toJSON(): ServerConfigOptions {\n\t\treturn {\n\t\t\tmaxHistorySize: this.maxHistorySize,\n\t\t\tmaxBranches: this.maxBranches,\n\t\t\tmaxBranchSize: this.maxBranchSize,\n\t\t\tskillDirs: this.skillDirs,\n\t\t\tdiscoveryCache: this.discoveryCache,\n\t\t\tpersistence: this.persistence,\n\t\t\tpersistenceBufferSize: this.persistenceBufferSize,\n\t\t\tpersistenceFlushInterval: this.persistenceFlushInterval,\n\t\t\tpersistenceMaxRetries: this.persistenceMaxRetries,\n\t\t};\n\t}\n}\n"],"names":["ServerConfig","options","value","defaultValue","Number","ConfigurationError","join","homedir","validBackends","backend"],"mappings":";;;AA2HO,MAAMA;IAEL,eAAuB;IAGvB,YAAoB;IAGpB,cAAsB;IAGtB,UAAoB;IAGpB,eAAiD;IAGjD,YAA+B;IAG/B,sBAA8B;IAG9B,yBAAiC;IAGjC,sBAA8B;IAkBrC,YAAYC,UAA+B,CAAC,CAAC,CAAE;QAC9C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,sBAAsB,CAACA,QAAQ,cAAc;QACxE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAACA,QAAQ,WAAW;QAC/D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAACA,QAAQ,aAAa;QACrE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAACA,QAAQ,SAAS;QACzD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,sBAAsB,CAACA,QAAQ,cAAc;QACxE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAACA,QAAQ,WAAW;QAC/D,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,6BAA6B,CAACA,QAAQ,qBAAqB;QAC7F,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,gCAAgC,CACpEA,QAAQ,wBAAwB;QAEjC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,6BAA6B,CAACA,QAAQ,qBAAqB;IAC9F;IAQQ,uBAAuBC,KAAc,EAAU;QACtD,MAAMC,eAAe;QACrB,IAAID,QAAAA,OAAuC,OAAOC;QAClD,IAAI,AAAiB,YAAjB,OAAOD,SAAsB,CAACE,OAAO,QAAQ,CAACF,QACjD,MAAM,IAAIG,mBAAmB,CAAC,4CAA4C,EAAEH,OAAO;QAEpF,IAAIA,Q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CAAC,mDAAmD,EAAEH,OAAO;QAE3F,IAAIA,QAAQ,GACX,MAAM,IAAIG,mBAAmB,CAAC,gDAAgD,EAAEH,OAAO;QAExF,IAAIA,QAAQ,IACX,MAAM,IAAIG,mBAAmB,CAAC,8CAA8C,EAAEH,OAAO;QAEtF,OAAOA;IACR;IAiBO,SAA8B;QACpC,OAAO;YACN,gBAAgB,IAAI,CAAC,cAAc;YACnC,aAAa,IAAI,CAAC,WAAW;YAC7B,eAAe,IAAI,CAAC,aAAa;YACjC,WAAW,IAAI,CAAC,SAAS;YACzB,gBAAgB,IAAI,CAAC,cAAc;YACnC,aAAa,IAAI,CAAC,WAAW;YAC7B,uBAAuB,IAAI,CAAC,qBAAqB;YACjD,0BAA0B,IAAI,CAAC,wBAAwB;YACvD,uBAAuB,IAAI,CAAC,qBAAqB;QAClD;IACD;AACD"}
|
|
1
|
+
{"version":3,"file":"ServerConfig.js","sources":["../src/ServerConfig.ts"],"sourcesContent":["/**\n * Server configuration management with validation.\n *\n * This module provides the `ServerConfig` class which handles all server configuration\n * with built-in validation and sensible defaults. Configuration values are validated\n * on construction and warnings are emitted for out-of-range values.\n *\n * @module ServerConfig\n */\n\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { ConfigurationError } from './errors.js';\nimport type { PersistenceConfig } from './persistence/PersistenceBackend.js';\n\n/**\n * Configuration options for creating a `ServerConfig` instance.\n *\n * All properties are optional with sensible defaults applied during validation.\n *\n * @example\n * ```typescript\n * const options: ServerConfigOptions = {\n * maxHistorySize: 500,\n * maxBranches: 25,\n * skillDirs: ['./custom-skills'],\n * persistence: { enabled: true, backend: 'sqlite' }\n * };\n * ```\n */\n\n/**\n * Feature flags for opt-in TraceLattice capabilities.\n *\n * All flags default to OFF so new features can be merged behind a flag\n * without altering existing behavior. Flags are flat to keep env var\n * mappings predictable (TRACELATTICE_FEATURES_*).\n */\nexport interface FeatureFlags {\n\t/** Enable DAG edges between thoughts (Item #1). @default false */\n\tdagEdges: boolean;\n\t/** Reasoning strategy selector (Item #2). @default 'sequential' */\n\treasoningStrategy: 'sequential' | 'tot';\n\t/** Enable confidence calibration (Item #3). @default false */\n\tcalibration: boolean;\n\t/** Enable thought compression (Item #5). @default false */\n\tcompression: boolean;\n\t/** Enable tool interleaving (Item #6). @default false */\n\ttoolInterleave: boolean;\n\t/** Enable new thought types (Item #8). @default false */\n\tnewThoughtTypes: boolean;\n\t/** Enable outcome recording (prereq for Item #10). @default false */\n\toutcomeRecording: boolean;\n}\nexport interface ServerConfigOptions {\n\t/**\n\t * Maximum number of thoughts to keep in history.\n\t * @default 1000\n\t */\n\tmaxHistorySize?: number;\n\n\t/**\n\t * Maximum number of branches to maintain.\n\t * @default 50\n\t */\n\tmaxBranches?: number;\n\n\t/**\n\t * Maximum size of each branch.\n\t * @default 100\n\t */\n\tmaxBranchSize?: number;\n\n\t/**\n\t * Directory paths to search for skills.\n\t * @default ['.claude/skills', '~/.claude/skills']\n\t */\n\tskillDirs?: string[];\n\n\t/**\n\t * Discovery cache configuration.\n\t */\n\tdiscoveryCache?: {\n\t\t/**\n\t\t * Time-to-live for cache entries in milliseconds.\n\t\t * @default 300000 (5 minutes)\n\t\t */\n\t\tttl?: number;\n\t\t/**\n\t\t * Maximum number of entries in the cache.\n\t\t * @default 100\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 * Maximum number of thoughts to buffer before flushing to persistence.\n\t * @default 100\n\t */\n\tpersistenceBufferSize?: number;\n\n\t/**\n\t * Interval in milliseconds between periodic persistence flushes.\n\t * @default 1000\n\t */\n\tpersistenceFlushInterval?: number;\n\n\t/**\n\t * Maximum number of retries for failed persistence flushes.\n\t * @default 3\n\t */\n\tpersistenceMaxRetries?: number;\n\n\t/**\n\t * Feature flag overrides. Missing fields are filled with defaults (all OFF,\n\t * reasoningStrategy='sequential').\n\t */\n\tfeatures?: Partial<FeatureFlags>;\n\n\t/**\n\t * TTL in milliseconds for suspended tool-interleave entries in SuspensionStore.\n\t * @default 60000\n\t */\n\ttoolInterleaveTtlMs?: number;\n\n\t/**\n\t * Sweep interval in milliseconds for SuspensionStore expiration cleanup.\n\t * @default 60000\n\t */\n\ttoolInterleaveSweepMs?: number;\n}\n\n/**\n * Server configuration with validation and defaults.\n *\n * This class manages all server configuration including history limits,\n * branch limits, skill directories, discovery cache settings, and persistence.\n * All values are validated on construction with appropriate defaults applied.\n *\n * @remarks\n * - Values outside recommended ranges trigger warnings but are still applied\n * - Environment variables override file-based configuration\n * - The `toJSON()` method provides a plain object representation\n *\n * @example\n * ```typescript\n * // Using defaults\n * const config1 = new ServerConfig();\n * console.log(config1.maxHistorySize); // 1000\n *\n * // With custom options\n * const config2 = new ServerConfig({\n * maxHistorySize: 500,\n * persistence: { enabled: true, backend: 'file', options: { dataDir: './data' } }\n * });\n *\n * // Export as plain object\n * const json = config2.toJSON();\n * ```\n */\nexport class ServerConfig {\n\t/** Maximum number of thoughts to keep in history. */\n\tpublic maxHistorySize: number;\n\n\t/** Maximum number of branches to maintain. */\n\tpublic maxBranches: number;\n\n\t/** Maximum size of each branch. */\n\tpublic maxBranchSize: number;\n\n\t/** Directory paths to search for skills. */\n\tpublic skillDirs: string[];\n\n\t/** Discovery cache configuration. */\n\tpublic discoveryCache: { ttl: number; maxSize: number };\n\n\t/** Persistence configuration. */\n\tpublic persistence: PersistenceConfig;\n\n\t/** Maximum number of thoughts to buffer before flushing to persistence. */\n\tpublic persistenceBufferSize: number;\n\n\t/** Interval in milliseconds between periodic persistence flushes. */\n\tpublic persistenceFlushInterval: number;\n\n\t/** Maximum number of retries for failed persistence flushes. */\n\tpublic persistenceMaxRetries: number;\n\n\t/** Feature flag toggles. */\n\tpublic features: FeatureFlags;\n\n\t/** TTL in milliseconds for suspended tool-interleave entries. */\n\tpublic toolInterleaveTtlMs: number;\n\n\t/** Sweep interval in milliseconds for SuspensionStore expiration cleanup. */\n\tpublic toolInterleaveSweepMs: number;\n\n\t/**\n\t * Creates a new ServerConfig instance with validation.\n\t *\n\t * All values are validated and defaults are applied for undefined options.\n\t * Warnings are emitted to console for values outside recommended ranges.\n\t *\n\t * @param options - Optional configuration overrides\n\t *\n\t * @example\n\t * ```typescript\n\t * const config = new ServerConfig({\n\t * maxHistorySize: 500,\n\t * skillDirs: ['./my-skills']\n\t * });\n\t * ```\n\t */\n\tconstructor(options: ServerConfigOptions = {}) {\n\t\tthis.maxHistorySize = this.validateMaxHistorySize(options.maxHistorySize);\n\t\tthis.maxBranches = this.validateMaxBranches(options.maxBranches);\n\t\tthis.maxBranchSize = this.validateMaxBranchSize(options.maxBranchSize);\n\t\tthis.skillDirs = this.validateSkillDirs(options.skillDirs);\n\t\tthis.discoveryCache = this.validateDiscoveryCache(options.discoveryCache);\n\t\tthis.persistence = this.validatePersistence(options.persistence);\n\t\tthis.persistenceBufferSize = this.validatePersistenceBufferSize(options.persistenceBufferSize);\n\t\tthis.persistenceFlushInterval = this.validatePersistenceFlushInterval(\n\t\t\toptions.persistenceFlushInterval\n\t\t);\n\t\tthis.persistenceMaxRetries = this.validatePersistenceMaxRetries(options.persistenceMaxRetries);\n\t\tthis.features = this.validateFeatures(options.features);\n\t\tthis.toolInterleaveTtlMs = this.validatePositiveMs(\n\t\t\toptions.toolInterleaveTtlMs,\n\t\t\t60000,\n\t\t\t'toolInterleaveTtlMs'\n\t\t);\n\t\tthis.toolInterleaveSweepMs = this.validatePositiveMs(\n\t\t\toptions.toolInterleaveSweepMs,\n\t\t\t60000,\n\t\t\t'toolInterleaveSweepMs'\n\t\t);\n\t}\n\n\t/**\n\t * Validates the max history size value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default (1000)\n\t * @private\n\t */\n\tprivate validateMaxHistorySize(value?: number): number {\n\t\tconst defaultValue = 1000;\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(`maxHistorySize must be a finite number, got ${value}`);\n\t\t}\n\t\tif (value < 1) {\n\t\t\tthrow new ConfigurationError(`maxHistorySize must be at least 1, got ${value}`);\n\t\t}\n\t\tif (value > 10000) {\n\t\t\tthrow new ConfigurationError(`maxHistorySize must not exceed 10000, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates the max branches value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default (50)\n\t * @private\n\t */\n\tprivate validateMaxBranches(value?: number): number {\n\t\tconst defaultValue = 50;\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(`maxBranches must be a finite number, got ${value}`);\n\t\t}\n\t\tif (value < 0) {\n\t\t\tthrow new ConfigurationError(`maxBranches must be non-negative, got ${value}`);\n\t\t}\n\t\tif (value > 1000) {\n\t\t\tthrow new ConfigurationError(`maxBranches must not exceed 1000, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates the max branch size value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default (100)\n\t * @private\n\t */\n\tprivate validateMaxBranchSize(value?: number): number {\n\t\tconst defaultValue = 100;\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(`maxBranchSize must be a finite number, got ${value}`);\n\t\t}\n\t\tif (value < 1) {\n\t\t\tthrow new ConfigurationError(`maxBranchSize must be at least 1, got ${value}`);\n\t\t}\n\t\tif (value > 1000) {\n\t\t\tthrow new ConfigurationError(`maxBranchSize must not exceed 1000, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates the skill directories value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default ['.claude/skills', '~/.claude/skills']\n\t * @private\n\t */\n\tprivate validateSkillDirs(value?: string[]): string[] {\n\t\tconst defaultValue = ['.claude/skills', join(homedir(), '.claude/skills')];\n\t\tif (!value) return defaultValue;\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates the discovery cache configuration.\n\t * @param value - The value to validate\n\t * @returns The validated value with defaults applied\n\t * @private\n\t */\n\tprivate validateDiscoveryCache(value?: { ttl?: number; maxSize?: number }): {\n\t\tttl: number;\n\t\tmaxSize: number;\n\t} {\n\t\treturn {\n\t\t\tttl: value?.ttl ?? 300000,\n\t\t\tmaxSize: value?.maxSize ?? 100,\n\t\t};\n\t}\n\n\t/**\n\t * Validates the persistence configuration.\n\t * @param value - The value to validate\n\t * @returns The validated value with defaults applied\n\t * @private\n\t */\n\tprivate validatePersistence(value?: PersistenceConfig): PersistenceConfig {\n\t\tif (!value) {\n\t\t\t// Default to in-memory (no actual persistence, just consistency)\n\t\t\treturn {\n\t\t\t\tenabled: false,\n\t\t\t\tbackend: 'memory',\n\t\t\t};\n\t\t}\n\n\t\t// Validate backend type\n\t\tconst validBackends = ['file', 'sqlite', 'memory'];\n\t\tconst backend = value.backend ?? 'memory';\n\t\tif (!validBackends.includes(backend)) {\n\t\t\tthrow new ConfigurationError(\n\t\t\t\t`persistence.backend must be one of ${validBackends.join(', ')}, got ${backend}`\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\tenabled: value.enabled ?? false,\n\t\t\tbackend,\n\t\t\toptions: value.options ?? {},\n\t\t};\n\t}\n\n\t/**\n\t * Validates the persistence buffer size value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default (100)\n\t * @private\n\t */\n\tprivate validatePersistenceBufferSize(value?: number): number {\n\t\tconst defaultValue = 100;\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(`persistenceBufferSize must be a finite number, got ${value}`);\n\t\t}\n\t\tif (value < 1) {\n\t\t\tthrow new ConfigurationError(`persistenceBufferSize must be at least 1, got ${value}`);\n\t\t}\n\t\tif (value > 10000) {\n\t\t\tthrow new ConfigurationError(`persistenceBufferSize must not exceed 10000, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates the persistence flush interval value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default (1000)\n\t * @private\n\t */\n\tprivate validatePersistenceFlushInterval(value?: number): number {\n\t\tconst defaultValue = 1000;\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(\n\t\t\t\t`persistenceFlushInterval must be a finite number, got ${value}`\n\t\t\t);\n\t\t}\n\t\tif (value < 100) {\n\t\t\tthrow new ConfigurationError(`persistenceFlushInterval must be at least 100, got ${value}`);\n\t\t}\n\t\tif (value > 60000) {\n\t\t\tthrow new ConfigurationError(`persistenceFlushInterval must not exceed 60000, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates the persistence max retries value.\n\t * @param value - The value to validate\n\t * @returns The validated value or default (3)\n\t * @private\n\t */\n\tprivate validatePersistenceMaxRetries(value?: number): number {\n\t\tconst defaultValue = 3;\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(`persistenceMaxRetries must be a finite number, got ${value}`);\n\t\t}\n\t\tif (value < 0) {\n\t\t\tthrow new ConfigurationError(`persistenceMaxRetries must be non-negative, got ${value}`);\n\t\t}\n\t\tif (value > 10) {\n\t\t\tthrow new ConfigurationError(`persistenceMaxRetries must not exceed 10, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Validates feature flags and fills defaults for missing fields.\n\t * @param value - Partial feature flag overrides\n\t * @returns Fully populated FeatureFlags with defaults applied\n\t * @private\n\t */\n\tprivate validateFeatures(value?: Partial<FeatureFlags>): FeatureFlags {\n\t\treturn {\n\t\t\tdagEdges: value?.dagEdges ?? false,\n\t\t\treasoningStrategy: value?.reasoningStrategy ?? 'sequential',\n\t\t\tcalibration: value?.calibration ?? false,\n\t\t\tcompression: value?.compression ?? false,\n\t\t\ttoolInterleave: value?.toolInterleave ?? false,\n\t\t\tnewThoughtTypes: value?.newThoughtTypes ?? false,\n\t\t\toutcomeRecording: value?.outcomeRecording ?? false,\n\t\t};\n\t}\n\n\t/**\n\t * Validates a positive millisecond value with a default fallback.\n\t * @param value - The value to validate\n\t * @param defaultValue - Default applied if value is undefined/null\n\t * @param fieldName - Field name for error messages\n\t * @returns The validated millisecond value\n\t * @private\n\t */\n\tprivate validatePositiveMs(\n\t\tvalue: number | undefined,\n\t\tdefaultValue: number,\n\t\tfieldName: string\n\t): number {\n\t\tif (value === undefined || value === null) return defaultValue;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\tthrow new ConfigurationError(`${fieldName} must be a finite number, got ${value}`);\n\t\t}\n\t\tif (value < 1) {\n\t\t\tthrow new ConfigurationError(`${fieldName} must be at least 1, got ${value}`);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Converts the configuration to a plain object.\n\t *\n\t * Useful for serialization, logging, or when a plain object representation\n\t * is preferred over the ServerConfig instance.\n\t *\n\t * @returns A plain object representation of the configuration\n\t *\n\t * @example\n\t * ```typescript\n\t * const config = new ServerConfig({ maxHistorySize: 500 });\n\t * const json = config.toJSON();\n\t * console.log(JSON.stringify(json, null, 2));\n\t * ```\n\t */\n\tpublic toJSON(): ServerConfigOptions {\n\t\treturn {\n\t\t\tmaxHistorySize: this.maxHistorySize,\n\t\t\tmaxBranches: this.maxBranches,\n\t\t\tmaxBranchSize: this.maxBranchSize,\n\t\t\tskillDirs: this.skillDirs,\n\t\t\tdiscoveryCache: this.discoveryCache,\n\t\t\tpersistence: this.persistence,\n\t\t\tpersistenceBufferSize: this.persistenceBufferSize,\n\t\t\tpersistenceFlushInterval: this.persistenceFlushInterval,\n\t\t\tpersistenceMaxRetries: this.persistenceMaxRetries,\n\t\t\tfeatures: this.features,\n\t\t\ttoolInterleaveTtlMs: this.toolInterleaveTtlMs,\n\t\t\ttoolInterleaveSweepMs: this.toolInterleaveSweepMs,\n\t\t};\n\t}\n}\n"],"names":["ServerConfig","options","value","defaultValue","Number","ConfigurationError","join","homedir","validBackends","backend","fieldName"],"mappings":";;;AAqKO,MAAMA;IAEL,eAAuB;IAGvB,YAAoB;IAGpB,cAAsB;IAGtB,UAAoB;IAGpB,eAAiD;IAGjD,YAA+B;IAG/B,sBAA8B;IAG9B,yBAAiC;IAGjC,sBAA8B;IAG9B,SAAuB;IAGvB,oBAA4B;IAG5B,sBAA8B;IAkBrC,YAAYC,UAA+B,CAAC,CAAC,CAAE;QAC9C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,sBAAsB,CAACA,QAAQ,cAAc;QACxE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAACA,QAAQ,WAAW;QAC/D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAACA,QAAQ,aAAa;QACrE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAACA,QAAQ,SAAS;QACzD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,sBAAsB,CAACA,QAAQ,cAAc;QACxE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAACA,QAAQ,WAAW;QAC/D,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,6BAA6B,CAACA,QAAQ,qBAAqB;QAC7F,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,gCAAgC,CACpEA,QAAQ,wBAAwB;QAEjC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,6BAA6B,CAACA,QAAQ,qBAAqB;QAC7F,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAACA,QAAQ,QAAQ;QACtD,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,kBAAkB,CACjDA,QAAQ,mBAAmB,EAC3B,OACA;QAED,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,kBAAk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AC,WAAW;YAC7B,uBAAuB,IAAI,CAAC,qBAAqB;YACjD,0BAA0B,IAAI,CAAC,wBAAwB;YACvD,uBAAuB,IAAI,CAAC,qBAAqB;YACjD,UAAU,IAAI,CAAC,QAAQ;YACvB,qBAAqB,IAAI,CAAC,mBAAmB;YAC7C,uBAAuB,IAAI,CAAC,qBAAqB;QAClD;IACD;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Calibrator.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/calibrator/Calibrator.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompressionService.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/compression/CompressionService.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DehydrationPolicy.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/compression/DehydrationPolicy.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InMemorySummaryStore.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/compression/InMemorySummaryStore.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigLoader.features.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/config/ConfigLoader.features.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for flag-gated DAG edge emission in HistoryManager.
|
|
3
|
+
*
|
|
4
|
+
* Covers the seven metadata→edge mappings (sequence, branch, merge,
|
|
5
|
+
* verifies, critiques, derives_from, revises) plus flag gating, missing
|
|
6
|
+
* targets, missing ids, and session isolation.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=HistoryManager.dag.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoryManager.dag.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/HistoryManager.dag.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for edge persistence integration in HistoryManager.
|
|
3
|
+
*
|
|
4
|
+
* Covers:
|
|
5
|
+
* - Flag OFF: edges never persisted
|
|
6
|
+
* - Flag ON: edges flushed alongside thoughts on _flushBuffer()
|
|
7
|
+
* - Flag ON: edges restored via loadFromPersistence()
|
|
8
|
+
* - Flag ON: clear() purges EdgeStore as well
|
|
9
|
+
* - Roundtrip: flush then load into a fresh HistoryManager
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=HistoryManager.edge-persistence.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoryManager.edge-persistence.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/HistoryManager.edge-persistence.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoryManager.toolInvocation.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/HistoryManager.toolInvocation.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThoughtProcessor.newThoughtTypes.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/ThoughtProcessor.newThoughtTypes.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThoughtProcessor.toolInterleave.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/ThoughtProcessor.toolInterleave.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Edge.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/core/graph/Edge.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EdgeStore.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/core/graph/EdgeStore.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphView.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/core/graph/GraphView.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutcomeRecorder.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/core/reasoning/OutcomeRecorder.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeOfThought.newTypes.test.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/core/reasoning/strategies/TreeOfThought.newTypes.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for thought.id (ulid) DAG node identity.
|
|
3
|
+
*
|
|
4
|
+
* Verifies:
|
|
5
|
+
* - ThoughtData accepts optional id field
|
|
6
|
+
* - InputNormalizer generates ulid when id not provided
|
|
7
|
+
* - InputNormalizer preserves provided id
|
|
8
|
+
* - Generated ids are unique across many normalizations
|
|
9
|
+
* - Schema validates id field (accepts valid string, rejects empty)
|
|
10
|
+
* - Backward compat: existing thought data without id field works unchanged
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=thought-id.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thought-id.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/thought-id.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InMemorySuspensionStore.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/core/tools/InMemorySuspensionStore.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Eval fixture scenarios — handcrafted thought sequences exercising
|
|
3
|
+
* different reasoning trajectories (convergence, plateau, divergence, …).
|
|
4
|
+
*
|
|
5
|
+
* Consumed by `totVsSequential.eval.ts`. Each scenario describes the
|
|
6
|
+
* minimal `ThoughtData` chain plus the expected ToT behavior under the
|
|
7
|
+
* default {@link TreeOfThoughtStrategy} configuration.
|
|
8
|
+
*
|
|
9
|
+
* @module __tests__/eval/fixtures/scenarios
|
|
10
|
+
*/
|
|
11
|
+
import type { ThoughtData } from '../../../core/thought.js';
|
|
12
|
+
/**
|
|
13
|
+
* Behavior expected of the Tree-of-Thought strategy on a given scenario.
|
|
14
|
+
* Fields are intentionally optional — set only the predicates that matter.
|
|
15
|
+
*/
|
|
16
|
+
export interface ExpectedBehavior {
|
|
17
|
+
readonly totShouldTerminate?: boolean;
|
|
18
|
+
readonly totShouldBranch?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* One eval case: a named thought sequence plus expected ToT outcome.
|
|
22
|
+
*
|
|
23
|
+
* The current thought is always the last entry in `thoughts`. When
|
|
24
|
+
* `branchEdges` is provided, the harness will wire up `branch` edges
|
|
25
|
+
* between the referenced thought ids in addition to the default
|
|
26
|
+
* `sequence` edges (which connect consecutive thoughts).
|
|
27
|
+
*/
|
|
28
|
+
export interface EvalScenario {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly thoughts: readonly ThoughtData[];
|
|
31
|
+
readonly expectedBehavior: ExpectedBehavior;
|
|
32
|
+
/** Optional explicit branch edges as [fromId, toId] pairs. */
|
|
33
|
+
readonly branchEdges?: ReadonlyArray<readonly [string, string]>;
|
|
34
|
+
}
|
|
35
|
+
/** The 10 canonical eval scenarios. */
|
|
36
|
+
export declare const scenarios: readonly EvalScenario[];
|
|
37
|
+
//# sourceMappingURL=scenarios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenarios.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/eval/fixtures/scenarios.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAChE;AA+BD,uCAAuC;AACvC,eAAO,MAAM,SAAS,EAAE,SAAS,YAAY,EA8F5C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal evaluation harness — compares {@link TreeOfThoughtStrategy} against
|
|
3
|
+
* {@link SequentialStrategy} on a fixed set of curated reasoning trajectories.
|
|
4
|
+
*
|
|
5
|
+
* This is **not** a unit test of either strategy. It is a behavioral diff
|
|
6
|
+
* tool: for each scenario it records the action chosen by ToT vs Sequential,
|
|
7
|
+
* checks ToT against the scenario's expected behavior, and prints a JSON
|
|
8
|
+
* report line per scenario. A final aggregate report is printed at the end.
|
|
9
|
+
*
|
|
10
|
+
* The suite is gated by the `RUN_EVAL` environment variable so it never runs
|
|
11
|
+
* in CI by default. Invoke locally with `RUN_EVAL=1 npm test`.
|
|
12
|
+
*
|
|
13
|
+
* @module __tests__/eval/totVsSequential.eval
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=totVsSequential.eval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"totVsSequential.eval.d.ts","sourceRoot":"","sources":["../../../src/__tests__/eval/totVsSequential.eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|