tracelattice 1.3.4 → 1.4.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.
Files changed (150) hide show
  1. package/dist/__tests__/core/HistoryManager.dag.test.d.ts +0 -7
  2. package/dist/__tests__/core/HistoryManager.dag.test.d.ts.map +1 -1
  3. package/dist/__tests__/errors.types.test-d.d.ts +16 -0
  4. package/dist/__tests__/errors.types.test-d.d.ts.map +1 -0
  5. package/dist/__tests__/eval/fixtures/scenarios.d.ts.map +1 -1
  6. package/dist/__tests__/evaluator/EvaluatorBackwardCompat.test.d.ts +0 -13
  7. package/dist/__tests__/evaluator/EvaluatorBackwardCompat.test.d.ts.map +1 -1
  8. package/dist/__tests__/helpers/factories.d.ts +5 -4
  9. package/dist/__tests__/helpers/factories.d.ts.map +1 -1
  10. package/dist/__tests__/integration/CompressionAutoTrigger.test.d.ts +0 -9
  11. package/dist/__tests__/integration/CompressionAutoTrigger.test.d.ts.map +1 -1
  12. package/dist/__tests__/integration/CompressionPersistence.test.d.ts +0 -15
  13. package/dist/__tests__/integration/CompressionPersistence.test.d.ts.map +1 -1
  14. package/dist/__tests__/integration/StrategyIntegration.test.d.ts +0 -8
  15. package/dist/__tests__/integration/StrategyIntegration.test.d.ts.map +1 -1
  16. package/dist/__tests__/integration/ToTStrategyIntegration.test.d.ts +0 -16
  17. package/dist/__tests__/integration/ToTStrategyIntegration.test.d.ts.map +1 -1
  18. package/dist/__tests__/integration/dag-edges.test.d.ts +0 -15
  19. package/dist/__tests__/integration/dag-edges.test.d.ts.map +1 -1
  20. package/dist/__tests__/reasoning-integration.test.d.ts +0 -9
  21. package/dist/__tests__/reasoning-integration.test.d.ts.map +1 -1
  22. package/dist/__tests__/strategies/StrategyContract.test.d.ts +0 -16
  23. package/dist/__tests__/strategies/StrategyContract.test.d.ts.map +1 -1
  24. package/dist/__tests__/thought-processor.test.d.ts +0 -6
  25. package/dist/__tests__/thought-processor.test.d.ts.map +1 -1
  26. package/dist/cli.js +21 -17
  27. package/dist/cli.js.map +1 -1
  28. package/dist/config/ConfigLoader.d.ts +14 -14
  29. package/dist/config/ConfigLoader.d.ts.map +1 -1
  30. package/dist/config/ConfigLoader.js +8 -8
  31. package/dist/config/ConfigLoader.js.map +1 -1
  32. package/dist/contracts/PersistenceBackend.d.ts +4 -3
  33. package/dist/contracts/PersistenceBackend.d.ts.map +1 -1
  34. package/dist/contracts/ids.d.ts +4 -0
  35. package/dist/contracts/ids.d.ts.map +1 -1
  36. package/dist/contracts/ids.js +4 -1
  37. package/dist/contracts/ids.js.map +1 -1
  38. package/dist/contracts/interfaces.d.ts +2 -2
  39. package/dist/contracts/interfaces.d.ts.map +1 -1
  40. package/dist/contracts/strategy.d.ts +2 -1
  41. package/dist/contracts/strategy.d.ts.map +1 -1
  42. package/dist/contracts/summary.d.ts +2 -1
  43. package/dist/contracts/summary.d.ts.map +1 -1
  44. package/dist/core/HistoryManager.d.ts +6 -5
  45. package/dist/core/HistoryManager.d.ts.map +1 -1
  46. package/dist/core/HistoryManager.js +3 -1
  47. package/dist/core/HistoryManager.js.map +1 -1
  48. package/dist/core/IHistoryManager.d.ts +5 -4
  49. package/dist/core/IHistoryManager.d.ts.map +1 -1
  50. package/dist/core/InputNormalizer.d.ts +2 -1
  51. package/dist/core/InputNormalizer.d.ts.map +1 -1
  52. package/dist/core/InputNormalizer.js +7 -3
  53. package/dist/core/InputNormalizer.js.map +1 -1
  54. package/dist/core/PersistenceBuffer.d.ts.map +1 -1
  55. package/dist/core/PersistenceBuffer.js +2 -1
  56. package/dist/core/PersistenceBuffer.js.map +1 -1
  57. package/dist/core/SessionLock.d.ts +2 -1
  58. package/dist/core/SessionLock.d.ts.map +1 -1
  59. package/dist/core/SessionLock.js +3 -2
  60. package/dist/core/SessionLock.js.map +1 -1
  61. package/dist/core/ThoughtFormatter.d.ts.map +1 -1
  62. package/dist/core/ThoughtFormatter.js +2 -2
  63. package/dist/core/ThoughtFormatter.js.map +1 -1
  64. package/dist/core/ThoughtProcessor.d.ts.map +1 -1
  65. package/dist/core/ThoughtProcessor.js +15 -14
  66. package/dist/core/ThoughtProcessor.js.map +1 -1
  67. package/dist/core/compression/CompressionService.d.ts +2 -1
  68. package/dist/core/compression/CompressionService.d.ts.map +1 -1
  69. package/dist/core/compression/CompressionService.js +3 -2
  70. package/dist/core/compression/CompressionService.js.map +1 -1
  71. package/dist/core/compression/DehydrationPolicy.d.ts.map +1 -1
  72. package/dist/core/compression/DehydrationPolicy.js.map +1 -1
  73. package/dist/core/compression/InMemorySummaryStore.d.ts +2 -1
  74. package/dist/core/compression/InMemorySummaryStore.d.ts.map +1 -1
  75. package/dist/core/compression/InMemorySummaryStore.js.map +1 -1
  76. package/dist/core/compression/Summary.d.ts +2 -2
  77. package/dist/core/compression/Summary.d.ts.map +1 -1
  78. package/dist/core/evaluator/Calibrator.d.ts +4 -3
  79. package/dist/core/evaluator/Calibrator.d.ts.map +1 -1
  80. package/dist/core/evaluator/Calibrator.js +2 -1
  81. package/dist/core/evaluator/Calibrator.js.map +1 -1
  82. package/dist/core/graph/EdgeEmitter.d.ts +2 -1
  83. package/dist/core/graph/EdgeEmitter.d.ts.map +1 -1
  84. package/dist/core/graph/EdgeEmitter.js.map +1 -1
  85. package/dist/core/graph/EdgeStore.d.ts +6 -5
  86. package/dist/core/graph/EdgeStore.d.ts.map +1 -1
  87. package/dist/core/graph/EdgeStore.js.map +1 -1
  88. package/dist/core/graph/GraphView.d.ts +7 -6
  89. package/dist/core/graph/GraphView.d.ts.map +1 -1
  90. package/dist/core/graph/GraphView.js.map +1 -1
  91. package/dist/core/reasoning/strategies/totScoring.d.ts +2 -1
  92. package/dist/core/reasoning/strategies/totScoring.d.ts.map +1 -1
  93. package/dist/core/reasoning/strategies/totScoring.js.map +1 -1
  94. package/dist/core/reasoning.d.ts +29 -29
  95. package/dist/core/reasoning.d.ts.map +1 -1
  96. package/dist/core/thought.d.ts +62 -170
  97. package/dist/core/thought.d.ts.map +1 -1
  98. package/dist/di/Container.d.ts +9 -5
  99. package/dist/di/Container.d.ts.map +1 -1
  100. package/dist/di/Container.js +3 -0
  101. package/dist/di/Container.js.map +1 -1
  102. package/dist/di/ServiceRegistry.d.ts +3 -2
  103. package/dist/di/ServiceRegistry.d.ts.map +1 -1
  104. package/dist/lib.d.ts +2 -1
  105. package/dist/lib.d.ts.map +1 -1
  106. package/dist/lib.js +2 -1
  107. package/dist/lib.js.map +1 -1
  108. package/dist/logger/StructuredLogger.d.ts +6 -6
  109. package/dist/logger/StructuredLogger.d.ts.map +1 -1
  110. package/dist/logger/StructuredLogger.js.map +1 -1
  111. package/dist/persistence/FilePersistence.d.ts +4 -3
  112. package/dist/persistence/FilePersistence.d.ts.map +1 -1
  113. package/dist/persistence/FilePersistence.js +2 -1
  114. package/dist/persistence/FilePersistence.js.map +1 -1
  115. package/dist/persistence/MemoryPersistence.d.ts +4 -3
  116. package/dist/persistence/MemoryPersistence.d.ts.map +1 -1
  117. package/dist/persistence/MemoryPersistence.js +2 -1
  118. package/dist/persistence/MemoryPersistence.js.map +1 -1
  119. package/dist/persistence/SqlitePersistence.d.ts +4 -3
  120. package/dist/persistence/SqlitePersistence.d.ts.map +1 -1
  121. package/dist/persistence/SqlitePersistence.js +3 -2
  122. package/dist/persistence/SqlitePersistence.js.map +1 -1
  123. package/dist/registry/SkillRegistry.d.ts +0 -2
  124. package/dist/registry/SkillRegistry.d.ts.map +1 -1
  125. package/dist/registry/SkillRegistry.js +0 -3
  126. package/dist/registry/SkillRegistry.js.map +1 -1
  127. package/dist/sanitize.d.ts +31 -0
  128. package/dist/sanitize.d.ts.map +1 -1
  129. package/dist/sanitize.js +12 -2
  130. package/dist/sanitize.js.map +1 -1
  131. package/dist/schema.d.ts +2 -0
  132. package/dist/schema.d.ts.map +1 -1
  133. package/dist/schema.js.map +1 -1
  134. package/dist/transport/BaseTransport.d.ts +9 -9
  135. package/dist/transport/BaseTransport.d.ts.map +1 -1
  136. package/dist/transport/BaseTransport.js.map +1 -1
  137. package/dist/transport/HttpTransport.d.ts.map +1 -1
  138. package/dist/transport/HttpTransport.js +7 -5
  139. package/dist/transport/HttpTransport.js.map +1 -1
  140. package/dist/transport/SseTransport.d.ts.map +1 -1
  141. package/dist/transport/SseTransport.js +6 -4
  142. package/dist/transport/SseTransport.js.map +1 -1
  143. package/dist/transport/StreamableHttpTransport.d.ts.map +1 -1
  144. package/dist/transport/StreamableHttpTransport.js +6 -4
  145. package/dist/transport/StreamableHttpTransport.js.map +1 -1
  146. package/dist/utils.d.ts +27 -0
  147. package/dist/utils.d.ts.map +1 -0
  148. package/dist/utils.js +6 -0
  149. package/dist/utils.js.map +1 -0
  150. package/package.json +5 -5
@@ -1,9 +1,2 @@
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
1
  export {};
9
2
  //# sourceMappingURL=HistoryManager.dag.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HistoryManager.dag.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/HistoryManager.dag.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
1
+ {"version":3,"file":"HistoryManager.dag.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/HistoryManager.dag.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Compile-time exhaustiveness check between `ErrorCode` and the set of
3
+ * error codes actually used by error subclasses (or by direct
4
+ * `SequentialThinkingError` instantiations).
5
+ *
6
+ * Purpose: if a new code is added to `ERROR_CODES` without a corresponding
7
+ * subclass (or known direct usage) being added to the union below, this file
8
+ * fails type-checking. Likewise, if a subclass code is removed from
9
+ * `ERROR_CODES`, TypeScript flags the orphan literal.
10
+ *
11
+ * This file contains NO runtime tests. Vitest's `*.test-d.ts` convention
12
+ * is used purely so the file is type-checked by the project's tsc pass
13
+ * without being treated as a runnable test module.
14
+ */
15
+ export {};
16
+ //# sourceMappingURL=errors.types.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.types.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/errors.types.test-d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
@@ -1 +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;AAG5D;;;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"}
1
+ {"version":3,"file":"scenarios.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/eval/fixtures/scenarios.ts"],"names":[],"mappings":"AACA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D;;;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"}
@@ -1,15 +1,2 @@
1
- /**
2
- * Backward-compatibility snapshot tests for the {@link ThoughtEvaluator} facade.
3
- *
4
- * These tests lock the public API of the post-refactor `ThoughtEvaluator`
5
- * (which composes `SignalComputer` + `Aggregator` + `PatternDetector` +
6
- * `Calibrator`) so that future changes cannot silently alter observable
7
- * behavior.
8
- *
9
- * Tests intentionally exercise only the public {@link ThoughtEvaluator} API —
10
- * no imports from `core/evaluator/*` internals.
11
- *
12
- * @module __tests__/evaluator/EvaluatorBackwardCompat
13
- */
14
1
  export {};
15
2
  //# sourceMappingURL=EvaluatorBackwardCompat.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EvaluatorBackwardCompat.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/evaluator/EvaluatorBackwardCompat.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
1
+ {"version":3,"file":"EvaluatorBackwardCompat.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/evaluator/EvaluatorBackwardCompat.test.ts"],"names":[],"mappings":""}
@@ -1,6 +1,7 @@
1
1
  import type { ThoughtData } from '../../core/thought.js';
2
2
  import type { IToolRegistry } from '../../contracts/interfaces.js';
3
3
  import { type SessionId, type ThoughtId, type EdgeId, type SuspensionToken } from '../../contracts/ids.js';
4
+ import { type BranchId } from '../../contracts/ids.js';
4
5
  import type { ToolRecommendation } from '../../types/tool.js';
5
6
  import type { SkillRecommendation } from '../../types/skill.js';
6
7
  import type { StepRecommendation } from '../../core/step.js';
@@ -36,10 +37,10 @@ export declare class MockHistoryManager implements IHistoryManager {
36
37
  addThought(thought: ThoughtData): void;
37
38
  getHistory(sessionId?: string): ThoughtData[];
38
39
  getHistoryLength(sessionId?: string): number;
39
- getBranches(sessionId?: string): Record<string, ThoughtData[]>;
40
- getBranchIds(sessionId?: string): string[];
41
- registerBranch(_sessionId: string | undefined, _branchId: string): void;
42
- branchExists(sessionId: string | undefined, branchId: string): boolean;
40
+ getBranches(sessionId?: string): Record<BranchId, ThoughtData[]>;
41
+ getBranchIds(sessionId?: string): BranchId[];
42
+ registerBranch(_sessionId: string | undefined, _branchId: BranchId): void;
43
+ branchExists(sessionId: string | undefined, branchId: BranchId): boolean;
43
44
  clear(sessionId?: string): void;
44
45
  getClearCallCount(): number;
45
46
  getAvailableMcpTools(sessionId?: string): string[] | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../src/__tests__/helpers/factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAKN,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,eAAe,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAA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YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO;IAIxE,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAM/B,iBAAiB,IAAI,MAAM;IAI3B,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;IAI9D,kBAAkB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;IAI5D,YAAY,IAAI,SAAS;CAGzB;AAID,wBAAgB,mBAAmB,IAAI,IAAI,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAY7E;AAID;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,GAAE,MAAM,EAAkB,GAAG,aAAa,CAM5F"}
@@ -1,11 +1,2 @@
1
- /**
2
- * Integration tests for the auto-compression trigger in ThoughtProcessor.
3
- *
4
- * Verifies that when a reasoning strategy returns `action: 'terminate'` AND
5
- * the compression service is wired AND the current thought has a `branch_id`,
6
- * the processor invokes `CompressionService.compressBranch()` to produce a
7
- * Summary in the SummaryStore. Also verifies that compression failures never
8
- * break the thought pipeline.
9
- */
10
1
  export {};
11
2
  //# sourceMappingURL=CompressionAutoTrigger.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CompressionAutoTrigger.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/CompressionAutoTrigger.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
1
+ {"version":3,"file":"CompressionAutoTrigger.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/CompressionAutoTrigger.test.ts"],"names":[],"mappings":""}
@@ -1,17 +1,2 @@
1
- /**
2
- * Integration tests for compression persistence across all 3 backends.
3
- *
4
- * Verifies the end-to-end flow:
5
- * 1. Build a branched session in HistoryManager (with dagEdges so the
6
- * compression service can walk descendants).
7
- * 2. Run CompressionService.compressBranch() to produce a Summary in the
8
- * InMemorySummaryStore (flag-ON path).
9
- * 3. Persist via persistence.saveSummaries(...) and round-trip via
10
- * persistence.loadSummaries(...) — assert structural equality.
11
- *
12
- * Matrix: 3 backends (Memory / File / SQLite) × 2 flag states (on / off).
13
- *
14
- * SQLite: skipped at module level when `better-sqlite3` is unavailable.
15
- */
16
1
  export {};
17
2
  //# sourceMappingURL=CompressionPersistence.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CompressionPersistence.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/CompressionPersistence.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
1
+ {"version":3,"file":"CompressionPersistence.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/CompressionPersistence.test.ts"],"names":[],"mappings":""}
@@ -1,10 +1,2 @@
1
- /**
2
- * End-to-end integration tests for the Strategy layer.
3
- *
4
- * Tests the full Strategy integration from {@link ThoughtProcessor} through
5
- * the MCP response shape. Covers default strategy wiring, terminal vs. ongoing
6
- * thought hint emission, branch handling, multi-thought sequences, backward
7
- * compatible response shape, and graceful degradation when a strategy throws.
8
- */
9
1
  export {};
10
2
  //# sourceMappingURL=StrategyIntegration.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StrategyIntegration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/StrategyIntegration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
1
+ {"version":3,"file":"StrategyIntegration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/StrategyIntegration.test.ts"],"names":[],"mappings":""}
@@ -1,18 +1,2 @@
1
- /**
2
- * End-to-end integration tests for the {@link TreeOfThoughtStrategy}.
3
- *
4
- * Drives the strategy through the full {@link ThoughtProcessor} pipeline
5
- * with a real {@link HistoryManager} + {@link EdgeStore} + {@link MemoryPersistence}
6
- * so that `ctx.graph.leaves(sessionId)` reflects the actual DAG built from
7
- * processed thoughts.
8
- *
9
- * Scenarios covered:
10
- * a. Single thought → no strategy_hint (frontier empty → continue)
11
- * b. High-confidence frontier → terminate with reason 'confidence threshold'
12
- * c. Wide frontier (branches) → branch hint emitted when current is outside beam
13
- * d. Flag-off (SequentialStrategy) → no strategy_hint for ongoing thoughts
14
- * e. Plateau across low-score thoughts → terminate with reason 'plateau'
15
- * f. Strategy throws → graceful degradation: response intact, no strategy_hint
16
- */
17
1
  export {};
18
2
  //# sourceMappingURL=ToTStrategyIntegration.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToTStrategyIntegration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/ToTStrategyIntegration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
1
+ {"version":3,"file":"ToTStrategyIntegration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/ToTStrategyIntegration.test.ts"],"names":[],"mappings":""}
@@ -1,17 +1,2 @@
1
- /**
2
- * Integration tests for DAG edge emission and persistence.
3
- *
4
- * Covers end-to-end behavior across all 3 persistence backends:
5
- * - Memory (MemoryPersistence)
6
- * - File (FilePersistence with os.tmpdir())
7
- * - SQLite (SqlitePersistence with :memory:)
8
- *
9
- * Scenarios:
10
- * 1. Flag-OFF parity — no edges emitted/persisted when dagEdges=false
11
- * 2. Flag-ON edge kinds — every relational edge kind (except tool_invocation)
12
- * 3. Three-backend roundtrip — flush + load preserves edges across all backends
13
- * 4. Multi-session isolation — edges stay scoped to their session
14
- * 5. Restart roundtrip with GraphView — restored edges traverse correctly
15
- */
16
1
  export {};
17
2
  //# sourceMappingURL=dag-edges.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dag-edges.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/dag-edges.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
1
+ {"version":3,"file":"dag-edges.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/dag-edges.test.ts"],"names":[],"mappings":""}
@@ -1,11 +1,2 @@
1
- /**
2
- * Integration tests for the full reasoning pipeline.
3
- *
4
- * Exercises ThoughtProcessor + ThoughtEvaluator together across multi-step
5
- * reasoning chains: hypothesis → verification → synthesis, branching + merge,
6
- * backward compatibility, metacognitive observations, and confidence tracking.
7
- *
8
- * @module __tests__/reasoning-integration
9
- */
10
1
  export {};
11
2
  //# sourceMappingURL=reasoning-integration.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reasoning-integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/reasoning-integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
1
+ {"version":3,"file":"reasoning-integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/reasoning-integration.test.ts"],"names":[],"mappings":""}
@@ -1,18 +1,2 @@
1
- /**
2
- * Strategy Contract Tests — enforces purity constraints on all
3
- * {@link IReasoningStrategy} implementations (Oracle review concern C2).
4
- *
5
- * Every strategy MUST be:
6
- * - Idempotent: repeated `decide()` calls with identical context produce
7
- * deeply-equal output.
8
- * - Stateless: instances hold no own mutable fields (only the readonly
9
- * `name` discriminator is allowed).
10
- * - Deterministic: separate instances yield identical decisions for the
11
- * same context.
12
- * - Side-effect free: `decide()` must not mutate the input
13
- * {@link StrategyContext}.
14
- *
15
- * @module __tests__/strategies/StrategyContract.test
16
- */
17
1
  export {};
18
2
  //# sourceMappingURL=StrategyContract.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StrategyContract.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/strategies/StrategyContract.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
1
+ {"version":3,"file":"StrategyContract.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/strategies/StrategyContract.test.ts"],"names":[],"mappings":""}
@@ -1,8 +1,2 @@
1
- /**
2
- * Comprehensive tests for ThoughtProcessor.
3
- *
4
- * This test file covers input validation, error handling, history integration,
5
- * response formatting, and edge cases for the ThoughtProcessor class.
6
- */
7
1
  export {};
8
2
  //# sourceMappingURL=thought-processor.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"thought-processor.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/thought-processor.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
1
+ {"version":3,"file":"thought-processor.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/thought-processor.test.ts"],"names":[],"mappings":""}
package/dist/cli.js CHANGED
@@ -11,7 +11,7 @@ import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
11
11
  import * as __rspack_external_node_path_c5b9b54f from "node:path";
12
12
  import * as __rspack_external_tmcp from "tmcp";
13
13
  var __webpack_modules__ = ({
14
- 923(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
14
+ 502(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
15
15
 
16
16
  // EXPORTS
17
17
  __webpack_require__.d(__webpack_exports__, {
@@ -1629,7 +1629,7 @@ You should:
1629
1629
 
1630
1630
 
1631
1631
  },
1632
- 419(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
1632
+ 130(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
1633
1633
 
1634
1634
  // EXPORTS
1635
1635
  __webpack_require__.d(__webpack_exports__, {
@@ -2013,8 +2013,8 @@ __webpack_require__.d(__webpack_exports__, {
2013
2013
  /* import */ var node_url__rspack_import_2 = __webpack_require__(61);
2014
2014
  /* import */ var valibot__rspack_import_3 = __webpack_require__(821);
2015
2015
  /* import */ var _schema_js__rspack_import_4 = __webpack_require__(613);
2016
- /* import */ var _BaseTransport_js__rspack_import_5 = __webpack_require__(419);
2017
- /* import */ var _context_RequestContext_js__rspack_import_6 = __webpack_require__(923);
2016
+ /* import */ var _BaseTransport_js__rspack_import_5 = __webpack_require__(130);
2017
+ /* import */ var _context_RequestContext_js__rspack_import_6 = __webpack_require__(502);
2018
2018
  /**
2019
2019
  * SSE (Server-Sent Events) Transport implementation.
2020
2020
  *
@@ -2310,8 +2310,9 @@ __webpack_require__.d(__webpack_exports__, {
2310
2310
  body += chunk.toString();
2311
2311
  }
2312
2312
  try {
2313
- const jsonRpcRequest = JSON.parse(body);
2314
- const parseResult = (0,valibot__rspack_import_3.safeParse)(_schema_js__rspack_import_4/* .JsonRpcRequestSchema */.Uv, jsonRpcRequest);
2313
+ const rawBody = JSON.parse(body);
2314
+ const parseResult = (0,valibot__rspack_import_3.safeParse)(_schema_js__rspack_import_4/* .JsonRpcRequestSchema */.Uv, rawBody);
2315
+ const rawId = rawBody && typeof rawBody === 'object' && 'id' in rawBody ? rawBody.id ?? null : null;
2315
2316
  if (!parseResult.success) {
2316
2317
  this._metrics?.counter('http_request_errors_total', 1, {
2317
2318
  transport: 'sse',
@@ -2322,7 +2323,7 @@ __webpack_require__.d(__webpack_exports__, {
2322
2323
  });
2323
2324
  res.end(JSON.stringify({
2324
2325
  jsonrpc: '2.0',
2325
- id: jsonRpcRequest?.id ?? null,
2326
+ id: rawId,
2326
2327
  error: {
2327
2328
  code: -32600,
2328
2329
  message: 'Invalid Request',
@@ -2331,6 +2332,7 @@ __webpack_require__.d(__webpack_exports__, {
2331
2332
  }));
2332
2333
  return;
2333
2334
  }
2335
+ const jsonRpcRequest = parseResult.output;
2334
2336
  // Process message through MCP server with owner context
2335
2337
  if (this._mcpServer) {
2336
2338
  const sessionId = this._clientSessionMap.get(res);
@@ -2349,7 +2351,7 @@ __webpack_require__.d(__webpack_exports__, {
2349
2351
  } else {
2350
2352
  res.end(JSON.stringify({
2351
2353
  jsonrpc: '2.0',
2352
- id: jsonRpcRequest?.id ?? null,
2354
+ id: jsonRpcRequest.id ?? null,
2353
2355
  result: null
2354
2356
  }));
2355
2357
  }
@@ -2473,7 +2475,7 @@ __webpack_require__.d(__webpack_exports__, {
2473
2475
 
2474
2476
 
2475
2477
  },
2476
- 34(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
2478
+ 803(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
2477
2479
 
2478
2480
  // EXPORTS
2479
2481
  __webpack_require__.d(__webpack_exports__, {
@@ -2493,7 +2495,7 @@ var errors = __webpack_require__(937);
2493
2495
  // EXTERNAL MODULE: ./src/schema.ts
2494
2496
  var schema = __webpack_require__(613);
2495
2497
  // EXTERNAL MODULE: ./src/transport/BaseTransport.ts + 1 modules
2496
- var BaseTransport = __webpack_require__(419);
2498
+ var BaseTransport = __webpack_require__(130);
2497
2499
  ;// CONCATENATED MODULE: ./src/transport/HttpHelpers.ts
2498
2500
  /**
2499
2501
  * Shared HTTP helper utilities for MCP transport implementations.
@@ -2586,7 +2588,7 @@ var BaseTransport = __webpack_require__(419);
2586
2588
  }
2587
2589
 
2588
2590
  // EXTERNAL MODULE: ./src/context/RequestContext.ts + 1 modules
2589
- var RequestContext = __webpack_require__(923);
2591
+ var RequestContext = __webpack_require__(502);
2590
2592
  ;// CONCATENATED MODULE: ./src/transport/StreamableHttpTransport.ts
2591
2593
  /**
2592
2594
  * Streamable HTTP Transport implementation (MCP spec recommended transport).
@@ -2829,9 +2831,9 @@ var RequestContext = __webpack_require__(923);
2829
2831
  return;
2830
2832
  }
2831
2833
  // Parse JSON
2832
- let jsonRpcRequest;
2834
+ let rawBody;
2833
2835
  try {
2834
- jsonRpcRequest = JSON.parse(body);
2836
+ rawBody = JSON.parse(body);
2835
2837
  } catch {
2836
2838
  clearTimeout(timeout);
2837
2839
  this._activeRequests--;
@@ -2839,15 +2841,17 @@ var RequestContext = __webpack_require__(923);
2839
2841
  return;
2840
2842
  }
2841
2843
  // Validate JSON-RPC schema
2842
- const parseResult = (0,external_valibot_.safeParse)(schema/* .JsonRpcRequestSchema */.Uv, jsonRpcRequest);
2844
+ const parseResult = (0,external_valibot_.safeParse)(schema/* .JsonRpcRequestSchema */.Uv, rawBody);
2845
+ const rawId = rawBody && typeof rawBody === 'object' && 'id' in rawBody ? rawBody.id ?? null : null;
2843
2846
  if (!parseResult.success) {
2844
2847
  clearTimeout(timeout);
2845
2848
  this._activeRequests--;
2846
- this._sendJsonRpcError(res, 200, -32600, 'Invalid Request', jsonRpcRequest?.id ?? null, {
2849
+ this._sendJsonRpcError(res, 200, -32600, 'Invalid Request', rawId, {
2847
2850
  data: parseResult.issues
2848
2851
  });
2849
2852
  return;
2850
2853
  }
2854
+ const jsonRpcRequest = parseResult.output;
2851
2855
  // Session management (stateful mode)
2852
2856
  let sessionId;
2853
2857
  if (this._stateful) {
@@ -3271,7 +3275,7 @@ var external_node_url_ = __webpack_require__(61);
3271
3275
  // EXTERNAL MODULE: external "./lib.js"
3272
3276
  var external_lib_js_ = __webpack_require__(65);
3273
3277
  // EXTERNAL MODULE: ./src/context/RequestContext.ts + 1 modules
3274
- var RequestContext = __webpack_require__(923);
3278
+ var RequestContext = __webpack_require__(502);
3275
3279
  ;// CONCATENATED MODULE: ./src/logger/StructuredLogger.ts
3276
3280
  /**
3277
3281
  * Lightweight structured logging without external dependencies.
@@ -3633,7 +3637,7 @@ async function main() {
3633
3637
  /**
3634
3638
  * Start Streamable HTTP transport (MCP spec recommended)
3635
3639
  */ async function startStreamableHttpTransport(server, thinkingServer) {
3636
- const { StreamableHttpTransport } = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 34));
3640
+ const { StreamableHttpTransport } = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 803));
3637
3641
  const port = parseInt(process.env.STREAMABLE_HTTP_PORT || process.env.SSE_PORT || '3000', 10);
3638
3642
  const host = process.env.STREAMABLE_HTTP_HOST || process.env.SSE_HOST || 'localhost';
3639
3643
  const transportMetrics = thinkingServer.getContainer().resolve('Metrics');
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env bun\n\n// CLI entry point for tracelattice MCP server.\n// This file handles CLI argument parsing, transport selection, and signal handlers.\n// For library usage, import from './lib.js' or './index.js' instead.\n\nimport { ValibotJsonSchemaAdapter } from '@tmcp/adapter-valibot';\nimport { StdioTransport } from '@tmcp/transport-stdio';\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { McpServer } from 'tmcp';\nimport type { ToolAwareSequentialThinkingServer } from './lib.js';\nimport { initializeServer } from './lib.js';\nimport { StructuredLogger } from './logger/StructuredLogger.js';\nimport { getErrorMessage } from './errors.js';\nimport { Metrics } from './metrics/metrics.impl.js';\nimport { SEQUENTIAL_THINKING_TOOL, SequentialThinkingSchema } from './schema.js';\n\n// Get version from package.json\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst package_json = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));\nconst { name, version } = package_json;\n// Handle CLI arguments\nconst args = process.argv.slice(2);\nconst shouldShowVersion = args.includes('--version') || args.includes('-v');\n\nif (shouldShowVersion) {\n\tconsole.log(`${name} v${version}`);\n\tprocess.exit(0);\n}\nasync function main() {\n\tconst adapter = new ValibotJsonSchemaAdapter();\n\tconst server = new McpServer(\n\t\t{\n\t\t\tname,\n\t\t\tversion,\n\t\t\tdescription: 'Semantic Sequential Thinking MCP Server',\n\t\t},\n\t\t{\n\t\t\tadapter,\n\t\t\tcapabilities: {\n\t\t\t\ttools: { listChanged: true },\n\t\t\t},\n\t\t}\n\t);\n\n\tconst thinkingServer = await initializeServer();\n\n\tserver.tool(\n\t\t{\n\t\t\tname: 'sequentialthinking_tools',\n\t\t\tdescription: SEQUENTIAL_THINKING_TOOL.description,\n\t\t\tschema: SequentialThinkingSchema,\n\t\t},\n\t\tasync (input) => {\n\t\t\treturn thinkingServer.processThought(input);\n\t\t}\n\t);\n\n\tconst transportType = process.env.TRANSPORT_TYPE || 'stdio';\n\tif (transportType === 'sse') {\n\t\tawait startSseTransport(server, thinkingServer);\n\t} else if (transportType === 'streamable-http') {\n\t\tawait startStreamableHttpTransport(server, thinkingServer);\n\t} else {\n\t\tawait startStdioTransport(server, thinkingServer);\n\t}\n}\n/**\n * Start SSE transport for multi-user support\n */\nasync function startSseTransport(server: McpServer, thinkingServer: ToolAwareSequentialThinkingServer): Promise<void> {\n const { SseTransport } = await import('./transport/SseTransport.js');\n const { createConnectionPool } = await import('./pool/ConnectionPool.js');\n const port = parseInt(process.env.SSE_PORT || '3000', 10);\n const host = process.env.SSE_HOST || 'localhost';\n const transportMetrics = thinkingServer.getContainer().resolve<Metrics>('Metrics');\n const enablePool = process.env.SSE_ENABLE_POOL !== 'false';\n const maxSessions = parseInt(process.env.SSE_MAX_SESSIONS || '100', 10);\n const sessionTimeout = parseInt(process.env.SSE_SESSION_TIMEOUT || '300000', 10);\n const connectionPool = enablePool\n ? createConnectionPool({\n maxSessions,\n sessionTimeout,\n logger: thinkingServer['_logger'],\n serverFactory: async () => {\n const { createServer: createThinkingServer } = await import('./lib.js');\n const sessionServer = await createThinkingServer({ autoDiscover: true });\n return sessionServer;\n },\n })\n : undefined;\n const sseTransport = new SseTransport({\n port,\n host,\n corsOrigin: process.env.CORS_ORIGIN || '*',\n enableCors: process.env.ENABLE_CORS !== 'false',\n allowedHosts: process.env.ALLOWED_HOSTS?.split(',').map((hostValue) => hostValue.trim()),\n metrics: transportMetrics,\n connectionPool,\n });\n // Connect the SSE transport\n await sseTransport.connect(server);\n const shutdown = async (): Promise<void> => {\n await sseTransport.stop();\n await thinkingServer.stop();\n };\n registerShutdownHandlers(shutdown);\n thinkingServer['_logger'].info(\n `Sequential Thinking MCP Server running on SSE transport at http://${host}:${port}`\n );\n}\n/**\n * Start Streamable HTTP transport (MCP spec recommended)\n */\nasync function startStreamableHttpTransport(server: McpServer, thinkingServer: ToolAwareSequentialThinkingServer): Promise<void> {\n const { StreamableHttpTransport } = await import('./transport/StreamableHttpTransport.js');\n const port = parseInt(process.env.STREAMABLE_HTTP_PORT || process.env.SSE_PORT || '3000', 10);\n const host = process.env.STREAMABLE_HTTP_HOST || process.env.SSE_HOST || 'localhost';\n const transportMetrics = thinkingServer.getContainer().resolve<Metrics>('Metrics');\n const stateful = process.env.STREAMABLE_HTTP_STATEFUL !== 'false';\n const streamableTransport = new StreamableHttpTransport({\n\t port,\n host,\n corsOrigin: process.env.CORS_ORIGIN || '*',\n enableCors: process.env.ENABLE_CORS !== 'false',\n allowedHosts: process.env.ALLOWED_HOSTS?.split(',').map((hostValue) => hostValue.trim()),\n\t metrics: transportMetrics,\n\t stateful,\n });\n // Connect the Streamable HTTP transport\n await streamableTransport.connect(server);\n const shutdown = async (): Promise<void> => {\n await streamableTransport.stop();\n await thinkingServer.stop();\n };\n registerShutdownHandlers(shutdown);\n thinkingServer['_logger'].info(\n `Sequential Thinking MCP Server running on Streamable HTTP transport at http://${host}:${port}`\n );\n}\n/**\n * Start stdio transport (default, single-user)\n */\nasync function startStdioTransport(server: McpServer, thinkingServer: ToolAwareSequentialThinkingServer): Promise<void> {\n const transport = new StdioTransport(server);\n transport.listen();\n const shutdown = async (): Promise<void> => {\n const forceExit = setTimeout(() => {\n thinkingServer['_logger'].error('Graceful shutdown timed out after 30s - forcing exit');\n process.exit(1);\n }, 30_000).unref(); // 30s timeout, don't keep process alive\n try {\n await thinkingServer.stop();\n clearTimeout(forceExit);\n process.exit(0);\n } catch (error) {\n thinkingServer['_logger'].error('Error during shutdown', {\n error: getErrorMessage(error),\n });\n process.exit(1);\n }\n };\n // Register signal handlers ONCE (fixes double-registration bug)\n process.once('SIGINT', () => void shutdown());\n process.once('SIGTERM', () => void shutdown());\n thinkingServer['_logger'].info('Sequential Thinking MCP Server running on stdio');\n}\n/**\n * Register shutdown signal handlers for a common pattern\n */\nfunction registerShutdownHandlers(shutdown: () => Promise<void>): void {\n process.once('SIGINT', () => {\n shutdown()\n .then(() => process.exit(0))\n .catch(() => process.exit(1));\n });\n process.once('SIGTERM', () => {\n shutdown()\n .then(() => process.exit(0))\n .catch(() => process.exit(1));\n });\n}\nmain().catch((error) => {\n const logger = new StructuredLogger({\n level: 'error',\n context: 'SequentialThinking',\n pretty: true,\n });\n logger.error('Fatal error running server', {\n error: getErrorMessage(error),\n });\n process.exit(1);\n});\n"],"names":["__filename","fileURLToPath","__dirname","dirname","package_json","JSON","readFileSync","join","name","version","args","process","shouldShowVersion","console","main","adapter","ValibotJsonSchemaAdapter","server","McpServer","thinkingServer","initializeServer","SEQUENTIAL_THINKING_TOOL","SequentialThinkingSchema","input","transportType","startSseTransport","startStreamableHttpTransport","startStdioTransport","SseTransport","createConnectionPool","port","parseInt","host","transportMetrics","enablePool","maxSessions","sessionTimeout","connectionPool","createThinkingServer","sessionServer","undefined","sseTransport","hostValue","shutdown","registerShutdownHandlers","StreamableHttpTransport","stateful","streamableTransport","transport","StdioTransport","forceExit","setTimeout","clearTimeout","error","getErrorMessage","logger","StructuredLogger"],"mappings":";;;;;;;;;;;AAoBA,MAAMA,eAAaC,cAAc,YAAY,GAAG;AAChD,MAAMC,cAAYC,QAAQH;AAC1B,MAAMI,eAAeC,KAAK,KAAK,CAACC,aAAaC,KAAKL,aAAW,oBAAoB;AACjF,MAAM,EAAEM,MAAAA,QAAI,EAAEC,SAAAA,OAAO,EAAE,GAAGL;AAE1B,MAAMM,OAAOC,QAAQ,IAAI,CAAC,KAAK,CAAC;AAChC,MAAMC,oBAAoBF,KAAK,QAAQ,CAAC,gBAAgBA,KAAK,QAAQ,CAAC;AAEtE,IAAIE,mBAAmB;IACtBC,QAAQ,GAAG,CAAC,GAAGL,SAAK,EAAE,EAAEC,SAAS;IACjCE,QAAQ,IAAI,CAAC;AACd;AACA,eAAeG;IACd,MAAMC,UAAU,IAAIC;IACpB,MAAMC,SAAS,IAAIC,UAClB;QACCV,MAAAA;QACAC,SAAAA;QACA,aAAa;IACd,GACA;QACCM;QACA,cAAc;YACb,OAAO;gBAAE,aAAa;YAAK;QAC5B;IACD;IAGD,MAAMI,iBAAiB,MAAMC;IAE7BH,OAAO,IAAI,CACV;QACC,MAAM;QACN,aAAaI,yBAAyB,WAAW;QACjD,QAAQC;IACT,GACA,OAAOC,QACCJ,eAAe,cAAc,CAACI;IAIvC,MAAMC,gBA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ACrC+B,UAAU,MAAM;IAChB,MAAML,WAAW;QACb,MAAMO,YAAYC,WAAW;YACzBhC,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC;YAChCR,QAAQ,IAAI,CAAC;QACjB,GAAG,OAAQ,KAAK;QAChB,IAAI;YACA,MAAMQ,eAAe,IAAI;YACzBiC,aAAaF;YACbvC,QAAQ,IAAI,CAAC;QACjB,EAAE,OAAO0C,OAAO;YACZlC,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,yBAAyB;gBACrD,OAAOmC,gBAAgBD;YAC3B;YACA1C,QAAQ,IAAI,CAAC;QACjB;IACJ;IAEAA,QAAQ,IAAI,CAAC,UAAU,IAAM,KAAKgC;IAClChC,QAAQ,IAAI,CAAC,WAAW,IAAM,KAAKgC;IACnCxB,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC;AACnC;AAIA,SAASyB,yBAAyBD,QAA6B;IAC3DhC,QAAQ,IAAI,CAAC,UAAU;QACnBgC,WACK,IAAI,CAAC,IAAMhC,QAAQ,IAAI,CAAC,IACxB,KAAK,CAAC,IAAMA,QAAQ,IAAI,CAAC;IAClC;IACAA,QAAQ,IAAI,CAAC,WAAW;QACpBgC,WACK,IAAI,CAAC,IAAMhC,QAAQ,IAAI,CAAC,IACxB,KAAK,CAAC,IAAMA,QAAQ,IAAI,CAAC;IAClC;AACJ;AACAG,OAAO,KAAK,CAAC,CAACuC;IACV,MAAME,SAAS,IAAIC,iBAAiB;QAChC,OAAO;QACP,SAAS;QACT,QAAQ;IACZ;IACAD,OAAO,KAAK,CAAC,8BAA8B;QACvC,OAAOD,gBAAgBD;IAC3B;IACA1C,QAAQ,IAAI,CAAC;AACjB"}
1
+ {"version":3,"file":"cli.js","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env bun\n\n// CLI entry point for tracelattice MCP server.\n// This file handles CLI argument parsing, transport selection, and signal handlers.\n// For library usage, import from './lib.js' or './index.js' instead.\n\nimport { ValibotJsonSchemaAdapter } from '@tmcp/adapter-valibot';\nimport { StdioTransport } from '@tmcp/transport-stdio';\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { McpServer } from 'tmcp';\nimport type { ToolAwareSequentialThinkingServer } from './lib.js';\nimport { initializeServer } from './lib.js';\nimport { StructuredLogger } from './logger/StructuredLogger.js';\nimport { getErrorMessage } from './errors.js';\nimport { SEQUENTIAL_THINKING_TOOL, SequentialThinkingSchema } from './schema.js';\n\n// Get version from package.json\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst package_json = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));\nconst { name, version } = package_json;\n// Handle CLI arguments\nconst args = process.argv.slice(2);\nconst shouldShowVersion = args.includes('--version') || args.includes('-v');\n\nif (shouldShowVersion) {\n\tconsole.log(`${name} v${version}`);\n\tprocess.exit(0);\n}\nasync function main() {\n\tconst adapter = new ValibotJsonSchemaAdapter();\n\tconst server = new McpServer(\n\t\t{\n\t\t\tname,\n\t\t\tversion,\n\t\t\tdescription: 'Semantic Sequential Thinking MCP Server',\n\t\t},\n\t\t{\n\t\t\tadapter,\n\t\t\tcapabilities: {\n\t\t\t\ttools: { listChanged: true },\n\t\t\t},\n\t\t}\n\t);\n\n\tconst thinkingServer = await initializeServer();\n\n\tserver.tool(\n\t\t{\n\t\t\tname: 'sequentialthinking_tools',\n\t\t\tdescription: SEQUENTIAL_THINKING_TOOL.description,\n\t\t\tschema: SequentialThinkingSchema,\n\t\t},\n\t\tasync (input) => {\n\t\t\treturn thinkingServer.processThought(input);\n\t\t}\n\t);\n\n\tconst transportType = process.env.TRANSPORT_TYPE || 'stdio';\n\tif (transportType === 'sse') {\n\t\tawait startSseTransport(server, thinkingServer);\n\t} else if (transportType === 'streamable-http') {\n\t\tawait startStreamableHttpTransport(server, thinkingServer);\n\t} else {\n\t\tawait startStdioTransport(server, thinkingServer);\n\t}\n}\n/**\n * Start SSE transport for multi-user support\n */\nasync function startSseTransport(server: McpServer, thinkingServer: ToolAwareSequentialThinkingServer): Promise<void> {\n const { SseTransport } = await import('./transport/SseTransport.js');\n const { createConnectionPool } = await import('./pool/ConnectionPool.js');\n const port = parseInt(process.env.SSE_PORT || '3000', 10);\n const host = process.env.SSE_HOST || 'localhost';\n const transportMetrics = thinkingServer.getContainer().resolve('Metrics');\n const enablePool = process.env.SSE_ENABLE_POOL !== 'false';\n const maxSessions = parseInt(process.env.SSE_MAX_SESSIONS || '100', 10);\n const sessionTimeout = parseInt(process.env.SSE_SESSION_TIMEOUT || '300000', 10);\n const connectionPool = enablePool\n ? createConnectionPool({\n maxSessions,\n sessionTimeout,\n logger: thinkingServer['_logger'],\n serverFactory: async () => {\n const { createServer: createThinkingServer } = await import('./lib.js');\n const sessionServer = await createThinkingServer({ autoDiscover: true });\n return sessionServer;\n },\n })\n : undefined;\n const sseTransport = new SseTransport({\n port,\n host,\n corsOrigin: process.env.CORS_ORIGIN || '*',\n enableCors: process.env.ENABLE_CORS !== 'false',\n allowedHosts: process.env.ALLOWED_HOSTS?.split(',').map((hostValue) => hostValue.trim()),\n metrics: transportMetrics,\n connectionPool,\n });\n // Connect the SSE transport\n await sseTransport.connect(server);\n const shutdown = async (): Promise<void> => {\n await sseTransport.stop();\n await thinkingServer.stop();\n };\n registerShutdownHandlers(shutdown);\n thinkingServer['_logger'].info(\n `Sequential Thinking MCP Server running on SSE transport at http://${host}:${port}`\n );\n}\n/**\n * Start Streamable HTTP transport (MCP spec recommended)\n */\nasync function startStreamableHttpTransport(server: McpServer, thinkingServer: ToolAwareSequentialThinkingServer): Promise<void> {\n const { StreamableHttpTransport } = await import('./transport/StreamableHttpTransport.js');\n const port = parseInt(process.env.STREAMABLE_HTTP_PORT || process.env.SSE_PORT || '3000', 10);\n const host = process.env.STREAMABLE_HTTP_HOST || process.env.SSE_HOST || 'localhost';\n const transportMetrics = thinkingServer.getContainer().resolve('Metrics');\n const stateful = process.env.STREAMABLE_HTTP_STATEFUL !== 'false';\n const streamableTransport = new StreamableHttpTransport({\n\t port,\n host,\n corsOrigin: process.env.CORS_ORIGIN || '*',\n enableCors: process.env.ENABLE_CORS !== 'false',\n allowedHosts: process.env.ALLOWED_HOSTS?.split(',').map((hostValue) => hostValue.trim()),\n\t metrics: transportMetrics,\n\t stateful,\n });\n // Connect the Streamable HTTP transport\n await streamableTransport.connect(server);\n const shutdown = async (): Promise<void> => {\n await streamableTransport.stop();\n await thinkingServer.stop();\n };\n registerShutdownHandlers(shutdown);\n thinkingServer['_logger'].info(\n `Sequential Thinking MCP Server running on Streamable HTTP transport at http://${host}:${port}`\n );\n}\n/**\n * Start stdio transport (default, single-user)\n */\nasync function startStdioTransport(server: McpServer, thinkingServer: ToolAwareSequentialThinkingServer): Promise<void> {\n const transport = new StdioTransport(server);\n transport.listen();\n const shutdown = async (): Promise<void> => {\n const forceExit = setTimeout(() => {\n thinkingServer['_logger'].error('Graceful shutdown timed out after 30s - forcing exit');\n process.exit(1);\n }, 30_000).unref(); // 30s timeout, don't keep process alive\n try {\n await thinkingServer.stop();\n clearTimeout(forceExit);\n process.exit(0);\n } catch (error) {\n thinkingServer['_logger'].error('Error during shutdown', {\n error: getErrorMessage(error),\n });\n process.exit(1);\n }\n };\n // Register signal handlers ONCE (fixes double-registration bug)\n process.once('SIGINT', () => void shutdown());\n process.once('SIGTERM', () => void shutdown());\n thinkingServer['_logger'].info('Sequential Thinking MCP Server running on stdio');\n}\n/**\n * Register shutdown signal handlers for a common pattern\n */\nfunction registerShutdownHandlers(shutdown: () => Promise<void>): void {\n process.once('SIGINT', () => {\n shutdown()\n .then(() => process.exit(0))\n .catch(() => process.exit(1));\n });\n process.once('SIGTERM', () => {\n shutdown()\n .then(() => process.exit(0))\n .catch(() => process.exit(1));\n });\n}\nmain().catch((error) => {\n const logger = new StructuredLogger({\n level: 'error',\n context: 'SequentialThinking',\n pretty: true,\n });\n logger.error('Fatal error running server', {\n error: getErrorMessage(error),\n });\n process.exit(1);\n});\n"],"names":["__filename","fileURLToPath","__dirname","dirname","package_json","JSON","readFileSync","join","name","version","args","process","shouldShowVersion","console","main","adapter","ValibotJsonSchemaAdapter","server","McpServer","thinkingServer","initializeServer","SEQUENTIAL_THINKING_TOOL","SequentialThinkingSchema","input","transportType","startSseTransport","startStreamableHttpTransport","startStdioTransport","SseTransport","createConnectionPool","port","parseInt","host","transportMetrics","enablePool","maxSessions","sessionTimeout","connectionPool","createThinkingServer","sessionServer","undefined","sseTransport","hostValue","shutdown","registerShutdownHandlers","StreamableHttpTransport","stateful","streamableTransport","transport","StdioTransport","forceExit","setTimeout","clearTimeout","error","getErrorMessage","logger","StructuredLogger"],"mappings":";;;;;;;;;;;AAmBA,MAAMA,eAAaC,cAAc,YAAY,GAAG;AAChD,MAAMC,cAAYC,QAAQH;AAC1B,MAAMI,eAAeC,KAAK,KAAK,CAACC,aAAaC,KAAKL,aAAW,oBAAoB;AACjF,MAAM,EAAEM,MAAAA,QAAI,EAAEC,SAAAA,OAAO,EAAE,GAAGL;AAE1B,MAAMM,OAAOC,QAAQ,IAAI,CAAC,KAAK,CAAC;AAChC,MAAMC,oBAAoBF,KAAK,QAAQ,CAAC,gBAAgBA,KAAK,QAAQ,CAAC;AAEtE,IAAIE,mBAAmB;IACtBC,QAAQ,GAAG,CAAC,GAAGL,SAAK,EAAE,EAAEC,SAAS;IACjCE,QAAQ,IAAI,CAAC;AACd;AACA,eAAeG;IACd,MAAMC,UAAU,IAAIC;IACpB,MAAMC,SAAS,IAAIC,UAClB;QACCV,MAAAA;QACAC,SAAAA;QACA,aAAa;IACd,GACA;QACCM;QACA,cAAc;YACb,OAAO;gBAAE,aAAa;YAAK;QAC5B;IACD;IAGD,MAAMI,iBAAiB,MAAMC;IAE7BH,OAAO,IAAI,CACV;QACC,MAAM;QACN,aAAaI,yBAAyB,WAAW;QACjD,QAAQC;IACT,GACA,OAAOC,QACCJ,eAAe,cAAc,CAACI;IAIvC,MAAMC,gBAAgBb,QAAQ,GAAG,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M;IAChB,MAAML,WAAW;QACb,MAAMO,YAAYC,WAAW;YACzBhC,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC;YAChCR,QAAQ,IAAI,CAAC;QACjB,GAAG,OAAQ,KAAK;QAChB,IAAI;YACA,MAAMQ,eAAe,IAAI;YACzBiC,aAAaF;YACbvC,QAAQ,IAAI,CAAC;QACjB,EAAE,OAAO0C,OAAO;YACZlC,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,yBAAyB;gBACrD,OAAOmC,gBAAgBD;YAC3B;YACA1C,QAAQ,IAAI,CAAC;QACjB;IACJ;IAEAA,QAAQ,IAAI,CAAC,UAAU,IAAM,KAAKgC;IAClChC,QAAQ,IAAI,CAAC,WAAW,IAAM,KAAKgC;IACnCxB,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC;AACnC;AAIA,SAASyB,yBAAyBD,QAA6B;IAC3DhC,QAAQ,IAAI,CAAC,UAAU;QACnBgC,WACK,IAAI,CAAC,IAAMhC,QAAQ,IAAI,CAAC,IACxB,KAAK,CAAC,IAAMA,QAAQ,IAAI,CAAC;IAClC;IACAA,QAAQ,IAAI,CAAC,WAAW;QACpBgC,WACK,IAAI,CAAC,IAAMhC,QAAQ,IAAI,CAAC,IACxB,KAAK,CAAC,IAAMA,QAAQ,IAAI,CAAC;IAClC;AACJ;AACAG,OAAO,KAAK,CAAC,CAACuC;IACV,MAAME,SAAS,IAAIC,iBAAiB;QAChC,OAAO;QACP,SAAS;QACT,QAAQ;IACZ;IACAD,OAAO,KAAK,CAAC,8BAA8B;QACvC,OAAOD,gBAAgBD;IAC3B;IACA1C,QAAQ,IAAI,CAAC;AACjB"}
@@ -40,72 +40,72 @@ export interface ConfigFileOptions {
40
40
  * Maximum number of thoughts to keep in history.
41
41
  * Can be overridden by `MAX_HISTORY_SIZE` environment variable.
42
42
  */
43
- maxHistorySize?: number;
43
+ readonly maxHistorySize?: number;
44
44
  /**
45
45
  * Maximum number of branches to maintain.
46
46
  * Can be overridden by `MAX_BRANCHES` environment variable.
47
47
  */
48
- maxBranches?: number;
48
+ readonly maxBranches?: number;
49
49
  /**
50
50
  * Maximum size of each branch.
51
51
  * Can be overridden by `MAX_BRANCH_SIZE` environment variable.
52
52
  */
53
- maxBranchSize?: number;
53
+ readonly maxBranchSize?: number;
54
54
  /**
55
55
  * Logging level for the application.
56
56
  * Can be overridden by `LOG_LEVEL` environment variable.
57
57
  */
58
- logLevel?: 'debug' | 'info' | 'warn' | 'error';
58
+ readonly logLevel?: 'debug' | 'info' | 'warn' | 'error';
59
59
  /**
60
60
  * Whether to enable pretty (formatted) logging output.
61
61
  * Can be overridden by `PRETTY_LOG` environment variable (set to "false" to disable).
62
62
  */
63
- prettyLog?: boolean;
63
+ readonly prettyLog?: boolean;
64
64
  /**
65
65
  * Directory paths to search for skills.
66
66
  * Can be overridden by `SKILL_DIRS` environment variable (colon-separated).
67
67
  */
68
- skillDirs?: string[];
68
+ readonly skillDirs?: string[];
69
69
  /**
70
70
  * Discovery cache configuration.
71
71
  * Can be overridden by `DISCOVERY_CACHE_TTL` and `DISCOVERY_CACHE_MAX_SIZE` environment variables.
72
72
  */
73
- discoveryCache?: {
73
+ readonly discoveryCache?: {
74
74
  /**
75
75
  * Time-to-live for cache entries in milliseconds.
76
76
  * Environment variable `DISCOVERY_CACHE_TTL` accepts seconds.
77
77
  */
78
- ttl?: number;
78
+ readonly ttl?: number;
79
79
  /**
80
80
  * Maximum number of entries in the cache.
81
81
  */
82
- maxSize?: number;
82
+ readonly maxSize?: number;
83
83
  };
84
84
  /**
85
85
  * Persistence configuration for storing history and state.
86
86
  */
87
- persistence?: PersistenceConfig;
87
+ readonly persistence?: PersistenceConfig;
88
88
  /**
89
89
  * Feature flag overrides. Each field can be set independently.
90
90
  * Can be overridden by `TRACELATTICE_FEATURES_*` environment variables.
91
91
  */
92
- features?: Partial<FeatureFlags>;
92
+ readonly features?: Partial<FeatureFlags>;
93
93
  /**
94
94
  * TTL in milliseconds for suspended tool-interleave entries.
95
95
  * Can be overridden by `TRACELATTICE_TOOL_INTERLEAVE_TTL_MS` environment variable.
96
96
  */
97
- toolInterleaveTtlMs?: number;
97
+ readonly toolInterleaveTtlMs?: number;
98
98
  /**
99
99
  * Sweep interval in milliseconds for SuspensionStore expiration cleanup.
100
100
  * Can be overridden by `TRACELATTICE_TOOL_INTERLEAVE_SWEEP_MS` environment variable.
101
101
  */
102
- toolInterleaveSweepMs?: number;
102
+ readonly toolInterleaveSweepMs?: number;
103
103
  /**
104
104
  * Maximum sessions per owner. Per-owner LRU bucket prevents one user from
105
105
  * consuming all session slots.
106
106
  * Can be overridden by `SESSION_MAX_PER_OWNER` environment variable.
107
107
  */
108
- maxSessionsPerOwner?: number;
108
+ readonly maxSessionsPerOwner?: number;
109
109
  }
110
110
  /**
111
111
  * Loads configuration from files with environment variable overrides.
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigLoader.d.ts","sourceRoot":"","sources":["../../src/config/ConfigLoader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAE5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;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,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAE/C;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE;QAChB;;;WAGG;QACH,GAAG,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,qBAAa,YAAY;IACxB,+DAA+D;IAC/D,OAAO,CAAC,YAAY,CAAW;IAE/B;;;;;;;;;;;;;OAaG;gBACS,UAAU,CAAC,EAAE,MAAM;IAa/B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,IAAI,iBAAiB,GAAG,IAAI;IAoBhC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,yBAAyB;IAqEjC;;;;;;;OAOG;IACH,OAAO,CAAC,yBAAyB;IA0CjC;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY;IAOpB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,WAAW;IAWnB;;;;;;;;;;;;;;;;;;OAkBG;IACH,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG;QACjD,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;QACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC7B;CAWD"}
@@ -53,17 +53,17 @@ class ConfigLoader {
53
53
  if (process.env.SKILL_DIRS) result.skillDirs = process.env.SKILL_DIRS.split(':');
54
54
  if (process.env.DISCOVERY_CACHE_TTL) {
55
55
  const parsed = parseInt(process.env.DISCOVERY_CACHE_TTL, 10);
56
- if (Number.isFinite(parsed)) {
57
- result.discoveryCache = result.discoveryCache || {};
58
- result.discoveryCache.ttl = 1000 * parsed;
59
- }
56
+ if (Number.isFinite(parsed)) result.discoveryCache = {
57
+ ...result.discoveryCache ?? {},
58
+ ttl: 1000 * parsed
59
+ };
60
60
  }
61
61
  if (process.env.DISCOVERY_CACHE_MAX_SIZE) {
62
62
  const parsed = parseInt(process.env.DISCOVERY_CACHE_MAX_SIZE, 10);
63
- if (Number.isFinite(parsed)) {
64
- result.discoveryCache = result.discoveryCache || {};
65
- result.discoveryCache.maxSize = parsed;
66
- }
63
+ if (Number.isFinite(parsed)) result.discoveryCache = {
64
+ ...result.discoveryCache ?? {},
65
+ maxSize: parsed
66
+ };
67
67
  }
68
68
  if (process.env.TRACELATTICE_TOOL_INTERLEAVE_TTL_MS) {
69
69
  const parsed = parseInt(process.env.TRACELATTICE_TOOL_INTERLEAVE_TTL_MS, 10);