tracelattice 1.2.5

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 (294) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +112 -0
  3. package/dist/ServerConfig.d.ts +229 -0
  4. package/dist/ServerConfig.d.ts.map +1 -0
  5. package/dist/ServerConfig.js +121 -0
  6. package/dist/ServerConfig.js.map +1 -0
  7. package/dist/__tests__/base-registry.test.d.ts +2 -0
  8. package/dist/__tests__/base-registry.test.d.ts.map +1 -0
  9. package/dist/__tests__/base-transport-cov.test.d.ts +2 -0
  10. package/dist/__tests__/base-transport-cov.test.d.ts.map +1 -0
  11. package/dist/__tests__/base-transport.test.d.ts +2 -0
  12. package/dist/__tests__/base-transport.test.d.ts.map +1 -0
  13. package/dist/__tests__/config-loader.test.d.ts +2 -0
  14. package/dist/__tests__/config-loader.test.d.ts.map +1 -0
  15. package/dist/__tests__/connection-pool-cov.test.d.ts +2 -0
  16. package/dist/__tests__/connection-pool-cov.test.d.ts.map +1 -0
  17. package/dist/__tests__/connection-pool.test.d.ts +2 -0
  18. package/dist/__tests__/connection-pool.test.d.ts.map +1 -0
  19. package/dist/__tests__/container.test.d.ts +2 -0
  20. package/dist/__tests__/container.test.d.ts.map +1 -0
  21. package/dist/__tests__/crud.test.d.ts +2 -0
  22. package/dist/__tests__/crud.test.d.ts.map +1 -0
  23. package/dist/__tests__/discovery-cache.test.d.ts +2 -0
  24. package/dist/__tests__/discovery-cache.test.d.ts.map +1 -0
  25. package/dist/__tests__/errors.test.d.ts +2 -0
  26. package/dist/__tests__/errors.test.d.ts.map +1 -0
  27. package/dist/__tests__/factories.test.d.ts +2 -0
  28. package/dist/__tests__/factories.test.d.ts.map +1 -0
  29. package/dist/__tests__/health-checker-cov.test.d.ts +2 -0
  30. package/dist/__tests__/health-checker-cov.test.d.ts.map +1 -0
  31. package/dist/__tests__/health-checker.test.d.ts +2 -0
  32. package/dist/__tests__/health-checker.test.d.ts.map +1 -0
  33. package/dist/__tests__/helpers/factories.d.ts +36 -0
  34. package/dist/__tests__/helpers/factories.d.ts.map +1 -0
  35. package/dist/__tests__/helpers/index.d.ts +3 -0
  36. package/dist/__tests__/helpers/index.d.ts.map +1 -0
  37. package/dist/__tests__/helpers/timers.d.ts +4 -0
  38. package/dist/__tests__/helpers/timers.d.ts.map +1 -0
  39. package/dist/__tests__/history-manager.test.d.ts +2 -0
  40. package/dist/__tests__/history-manager.test.d.ts.map +1 -0
  41. package/dist/__tests__/http-helpers-cov.test.d.ts +2 -0
  42. package/dist/__tests__/http-helpers-cov.test.d.ts.map +1 -0
  43. package/dist/__tests__/http-transport-cov.test.d.ts +2 -0
  44. package/dist/__tests__/http-transport-cov.test.d.ts.map +1 -0
  45. package/dist/__tests__/http-transport.test.d.ts +2 -0
  46. package/dist/__tests__/http-transport.test.d.ts.map +1 -0
  47. package/dist/__tests__/input-normalizer.test.d.ts +8 -0
  48. package/dist/__tests__/input-normalizer.test.d.ts.map +1 -0
  49. package/dist/__tests__/integration.test.d.ts +2 -0
  50. package/dist/__tests__/integration.test.d.ts.map +1 -0
  51. package/dist/__tests__/lib-server.test.d.ts +2 -0
  52. package/dist/__tests__/lib-server.test.d.ts.map +1 -0
  53. package/dist/__tests__/memory-persistence.test.d.ts +2 -0
  54. package/dist/__tests__/memory-persistence.test.d.ts.map +1 -0
  55. package/dist/__tests__/metrics-integration.test.d.ts +2 -0
  56. package/dist/__tests__/metrics-integration.test.d.ts.map +1 -0
  57. package/dist/__tests__/persistence.test.d.ts +2 -0
  58. package/dist/__tests__/persistence.test.d.ts.map +1 -0
  59. package/dist/__tests__/reasoning-integration.test.d.ts +11 -0
  60. package/dist/__tests__/reasoning-integration.test.d.ts.map +1 -0
  61. package/dist/__tests__/reasoning-types.test.d.ts +2 -0
  62. package/dist/__tests__/reasoning-types.test.d.ts.map +1 -0
  63. package/dist/__tests__/request-context.test.d.ts +2 -0
  64. package/dist/__tests__/request-context.test.d.ts.map +1 -0
  65. package/dist/__tests__/sanitize.test.d.ts +2 -0
  66. package/dist/__tests__/sanitize.test.d.ts.map +1 -0
  67. package/dist/__tests__/schema.test.d.ts +2 -0
  68. package/dist/__tests__/schema.test.d.ts.map +1 -0
  69. package/dist/__tests__/sequentialthinking-tools.test.d.ts +2 -0
  70. package/dist/__tests__/sequentialthinking-tools.test.d.ts.map +1 -0
  71. package/dist/__tests__/server-config.test.d.ts +2 -0
  72. package/dist/__tests__/server-config.test.d.ts.map +1 -0
  73. package/dist/__tests__/skill-discovery.test.d.ts +2 -0
  74. package/dist/__tests__/skill-discovery.test.d.ts.map +1 -0
  75. package/dist/__tests__/skill-registry.test.d.ts +2 -0
  76. package/dist/__tests__/skill-registry.test.d.ts.map +1 -0
  77. package/dist/__tests__/skill-watcher.test.d.ts +2 -0
  78. package/dist/__tests__/skill-watcher.test.d.ts.map +1 -0
  79. package/dist/__tests__/sqlite-persistence.test.d.ts +2 -0
  80. package/dist/__tests__/sqlite-persistence.test.d.ts.map +1 -0
  81. package/dist/__tests__/sse-transport-cov.test.d.ts +2 -0
  82. package/dist/__tests__/sse-transport-cov.test.d.ts.map +1 -0
  83. package/dist/__tests__/sse-transport.test.d.ts +2 -0
  84. package/dist/__tests__/sse-transport.test.d.ts.map +1 -0
  85. package/dist/__tests__/streamable-http-cov.test.d.ts +2 -0
  86. package/dist/__tests__/streamable-http-cov.test.d.ts.map +1 -0
  87. package/dist/__tests__/streamable-http-transport.test.d.ts +2 -0
  88. package/dist/__tests__/streamable-http-transport.test.d.ts.map +1 -0
  89. package/dist/__tests__/structured-logger.test.d.ts +2 -0
  90. package/dist/__tests__/structured-logger.test.d.ts.map +1 -0
  91. package/dist/__tests__/thought-evaluator.test.d.ts +2 -0
  92. package/dist/__tests__/thought-evaluator.test.d.ts.map +1 -0
  93. package/dist/__tests__/thought-formatter.test.d.ts +2 -0
  94. package/dist/__tests__/thought-formatter.test.d.ts.map +1 -0
  95. package/dist/__tests__/thought-processor.test.d.ts +8 -0
  96. package/dist/__tests__/thought-processor.test.d.ts.map +1 -0
  97. package/dist/__tests__/tool-registry-cov.test.d.ts +2 -0
  98. package/dist/__tests__/tool-registry-cov.test.d.ts.map +1 -0
  99. package/dist/__tests__/tool-registry.test.d.ts +2 -0
  100. package/dist/__tests__/tool-registry.test.d.ts.map +1 -0
  101. package/dist/__tests__/tool-watcher.test.d.ts +2 -0
  102. package/dist/__tests__/tool-watcher.test.d.ts.map +1 -0
  103. package/dist/__tests__/worker-manager-cov.test.d.ts +2 -0
  104. package/dist/__tests__/worker-manager-cov.test.d.ts.map +1 -0
  105. package/dist/__tests__/worker-manager.test.d.ts +2 -0
  106. package/dist/__tests__/worker-manager.test.d.ts.map +1 -0
  107. package/dist/cache/DiscoveryCache.d.ts +269 -0
  108. package/dist/cache/DiscoveryCache.d.ts.map +1 -0
  109. package/dist/cache/DiscoveryCache.js +100 -0
  110. package/dist/cache/DiscoveryCache.js.map +1 -0
  111. package/dist/cli.d.ts +3 -0
  112. package/dist/cli.d.ts.map +1 -0
  113. package/dist/cli.js +114 -0
  114. package/dist/cli.js.map +1 -0
  115. package/dist/cluster/WorkerManager.d.ts +166 -0
  116. package/dist/cluster/WorkerManager.d.ts.map +1 -0
  117. package/dist/cluster/WorkerManager.js +202 -0
  118. package/dist/cluster/WorkerManager.js.map +1 -0
  119. package/dist/cluster/worker.d.ts +11 -0
  120. package/dist/cluster/worker.d.ts.map +1 -0
  121. package/dist/cluster/worker.js +36 -0
  122. package/dist/cluster/worker.js.map +1 -0
  123. package/dist/config/ConfigLoader.d.ts +224 -0
  124. package/dist/config/ConfigLoader.d.ts.map +1 -0
  125. package/dist/config/ConfigLoader.js +85 -0
  126. package/dist/config/ConfigLoader.js.map +1 -0
  127. package/dist/context/RequestContext.d.ts +61 -0
  128. package/dist/context/RequestContext.d.ts.map +1 -0
  129. package/dist/context/RequestContext.js +17 -0
  130. package/dist/context/RequestContext.js.map +1 -0
  131. package/dist/contracts/index.d.ts +10 -0
  132. package/dist/contracts/index.d.ts.map +1 -0
  133. package/dist/contracts/index.js +1 -0
  134. package/dist/contracts/interfaces.d.ts +107 -0
  135. package/dist/contracts/interfaces.d.ts.map +1 -0
  136. package/dist/contracts/interfaces.js +1 -0
  137. package/dist/core/HistoryManager.d.ts +514 -0
  138. package/dist/core/HistoryManager.d.ts.map +1 -0
  139. package/dist/core/HistoryManager.js +331 -0
  140. package/dist/core/HistoryManager.js.map +1 -0
  141. package/dist/core/IHistoryManager.d.ts +100 -0
  142. package/dist/core/IHistoryManager.d.ts.map +1 -0
  143. package/dist/core/IHistoryManager.js +1 -0
  144. package/dist/core/InputNormalizer.d.ts +139 -0
  145. package/dist/core/InputNormalizer.d.ts.map +1 -0
  146. package/dist/core/InputNormalizer.js +101 -0
  147. package/dist/core/InputNormalizer.js.map +1 -0
  148. package/dist/core/ThoughtEvaluator.d.ts +127 -0
  149. package/dist/core/ThoughtEvaluator.d.ts.map +1 -0
  150. package/dist/core/ThoughtEvaluator.js +346 -0
  151. package/dist/core/ThoughtEvaluator.js.map +1 -0
  152. package/dist/core/ThoughtFormatter.d.ts +133 -0
  153. package/dist/core/ThoughtFormatter.d.ts.map +1 -0
  154. package/dist/core/ThoughtFormatter.js +70 -0
  155. package/dist/core/ThoughtFormatter.js.map +1 -0
  156. package/dist/core/ThoughtProcessor.d.ts +218 -0
  157. package/dist/core/ThoughtProcessor.d.ts.map +1 -0
  158. package/dist/core/ThoughtProcessor.js +205 -0
  159. package/dist/core/ThoughtProcessor.js.map +1 -0
  160. package/dist/core/reasoning.d.ts +169 -0
  161. package/dist/core/reasoning.d.ts.map +1 -0
  162. package/dist/core/reasoning.js +1 -0
  163. package/dist/core/step.d.ts +45 -0
  164. package/dist/core/step.d.ts.map +1 -0
  165. package/dist/core/step.js +1 -0
  166. package/dist/core/thought.d.ts +190 -0
  167. package/dist/core/thought.d.ts.map +1 -0
  168. package/dist/core/thought.js +1 -0
  169. package/dist/di/Container.d.ts +226 -0
  170. package/dist/di/Container.d.ts.map +1 -0
  171. package/dist/di/Container.js +96 -0
  172. package/dist/di/Container.js.map +1 -0
  173. package/dist/di/ServiceRegistry.d.ts +32 -0
  174. package/dist/di/ServiceRegistry.d.ts.map +1 -0
  175. package/dist/di/ServiceRegistry.js +1 -0
  176. package/dist/errors.d.ts +482 -0
  177. package/dist/errors.d.ts.map +1 -0
  178. package/dist/errors.js +108 -0
  179. package/dist/errors.js.map +1 -0
  180. package/dist/health/HealthChecker.d.ts +73 -0
  181. package/dist/health/HealthChecker.d.ts.map +1 -0
  182. package/dist/health/HealthChecker.js +69 -0
  183. package/dist/health/HealthChecker.js.map +1 -0
  184. package/dist/index.d.ts +2 -0
  185. package/dist/index.d.ts.map +1 -0
  186. package/dist/index.js +1 -0
  187. package/dist/lib.d.ts +205 -0
  188. package/dist/lib.d.ts.map +1 -0
  189. package/dist/lib.js +219 -0
  190. package/dist/lib.js.map +1 -0
  191. package/dist/logger/NullLogger.d.ts +154 -0
  192. package/dist/logger/NullLogger.d.ts.map +1 -0
  193. package/dist/logger/NullLogger.js +24 -0
  194. package/dist/logger/NullLogger.js.map +1 -0
  195. package/dist/logger/StructuredLogger.d.ts +327 -0
  196. package/dist/logger/StructuredLogger.d.ts.map +1 -0
  197. package/dist/logger/StructuredLogger.js +72 -0
  198. package/dist/logger/StructuredLogger.js.map +1 -0
  199. package/dist/metrics/__tests__/metrics.test.d.ts +2 -0
  200. package/dist/metrics/__tests__/metrics.test.d.ts.map +1 -0
  201. package/dist/metrics/metrics.impl.d.ts +252 -0
  202. package/dist/metrics/metrics.impl.d.ts.map +1 -0
  203. package/dist/metrics/metrics.impl.js +197 -0
  204. package/dist/metrics/metrics.impl.js.map +1 -0
  205. package/dist/persistence/FilePersistence.d.ts +66 -0
  206. package/dist/persistence/FilePersistence.d.ts.map +1 -0
  207. package/dist/persistence/FilePersistence.js +132 -0
  208. package/dist/persistence/FilePersistence.js.map +1 -0
  209. package/dist/persistence/MemoryPersistence.d.ts +68 -0
  210. package/dist/persistence/MemoryPersistence.d.ts.map +1 -0
  211. package/dist/persistence/MemoryPersistence.js +51 -0
  212. package/dist/persistence/MemoryPersistence.js.map +1 -0
  213. package/dist/persistence/PersistenceBackend.d.ts +69 -0
  214. package/dist/persistence/PersistenceBackend.d.ts.map +1 -0
  215. package/dist/persistence/PersistenceBackend.js +1 -0
  216. package/dist/persistence/PersistenceFactory.d.ts +21 -0
  217. package/dist/persistence/PersistenceFactory.d.ts.map +1 -0
  218. package/dist/persistence/PersistenceFactory.js +25 -0
  219. package/dist/persistence/PersistenceFactory.js.map +1 -0
  220. package/dist/persistence/SqlitePersistence.d.ts +60 -0
  221. package/dist/persistence/SqlitePersistence.d.ts.map +1 -0
  222. package/dist/persistence/SqlitePersistence.js +136 -0
  223. package/dist/persistence/SqlitePersistence.js.map +1 -0
  224. package/dist/pool/ConnectionPool.d.ts +215 -0
  225. package/dist/pool/ConnectionPool.d.ts.map +1 -0
  226. package/dist/pool/ConnectionPool.js +187 -0
  227. package/dist/pool/ConnectionPool.js.map +1 -0
  228. package/dist/registry/BaseRegistry.d.ts +203 -0
  229. package/dist/registry/BaseRegistry.d.ts.map +1 -0
  230. package/dist/registry/BaseRegistry.js +165 -0
  231. package/dist/registry/BaseRegistry.js.map +1 -0
  232. package/dist/registry/SkillRegistry.d.ts +69 -0
  233. package/dist/registry/SkillRegistry.d.ts.map +1 -0
  234. package/dist/registry/SkillRegistry.js +88 -0
  235. package/dist/registry/SkillRegistry.js.map +1 -0
  236. package/dist/registry/ToolRegistry.d.ts +69 -0
  237. package/dist/registry/ToolRegistry.d.ts.map +1 -0
  238. package/dist/registry/ToolRegistry.js +93 -0
  239. package/dist/registry/ToolRegistry.js.map +1 -0
  240. package/dist/sanitize.d.ts +63 -0
  241. package/dist/sanitize.d.ts.map +1 -0
  242. package/dist/sanitize.js +14 -0
  243. package/dist/sanitize.js.map +1 -0
  244. package/dist/schema.d.ts +531 -0
  245. package/dist/schema.d.ts.map +1 -0
  246. package/dist/schema.js +204 -0
  247. package/dist/schema.js.map +1 -0
  248. package/dist/telemetry/Telemetry.d.ts +36 -0
  249. package/dist/telemetry/Telemetry.d.ts.map +1 -0
  250. package/dist/telemetry/Telemetry.js +68 -0
  251. package/dist/telemetry/Telemetry.js.map +1 -0
  252. package/dist/telemetry/__tests__/Telemetry.test.d.ts +2 -0
  253. package/dist/telemetry/__tests__/Telemetry.test.d.ts.map +1 -0
  254. package/dist/transport/BaseTransport.d.ts +184 -0
  255. package/dist/transport/BaseTransport.d.ts.map +1 -0
  256. package/dist/transport/BaseTransport.js +200 -0
  257. package/dist/transport/BaseTransport.js.map +1 -0
  258. package/dist/transport/HttpHelpers.d.ts +60 -0
  259. package/dist/transport/HttpHelpers.d.ts.map +1 -0
  260. package/dist/transport/HttpHelpers.js +50 -0
  261. package/dist/transport/HttpHelpers.js.map +1 -0
  262. package/dist/transport/HttpTransport.d.ts +134 -0
  263. package/dist/transport/HttpTransport.d.ts.map +1 -0
  264. package/dist/transport/HttpTransport.js +175 -0
  265. package/dist/transport/HttpTransport.js.map +1 -0
  266. package/dist/transport/SseTransport.d.ts +133 -0
  267. package/dist/transport/SseTransport.d.ts.map +1 -0
  268. package/dist/transport/SseTransport.js +318 -0
  269. package/dist/transport/SseTransport.js.map +1 -0
  270. package/dist/transport/StreamableHttpTransport.d.ts +224 -0
  271. package/dist/transport/StreamableHttpTransport.d.ts.map +1 -0
  272. package/dist/transport/StreamableHttpTransport.js +407 -0
  273. package/dist/transport/StreamableHttpTransport.js.map +1 -0
  274. package/dist/types/disposable.d.ts +22 -0
  275. package/dist/types/disposable.d.ts.map +1 -0
  276. package/dist/types/disposable.js +1 -0
  277. package/dist/types/server-config.d.ts +32 -0
  278. package/dist/types/server-config.d.ts.map +1 -0
  279. package/dist/types/server-config.js +1 -0
  280. package/dist/types/skill.d.ts +69 -0
  281. package/dist/types/skill.d.ts.map +1 -0
  282. package/dist/types/skill.js +1 -0
  283. package/dist/types/tool.d.ts +68 -0
  284. package/dist/types/tool.d.ts.map +1 -0
  285. package/dist/types/tool.js +1 -0
  286. package/dist/watchers/SkillWatcher.d.ts +132 -0
  287. package/dist/watchers/SkillWatcher.d.ts.map +1 -0
  288. package/dist/watchers/SkillWatcher.js +73 -0
  289. package/dist/watchers/SkillWatcher.js.map +1 -0
  290. package/dist/watchers/ToolWatcher.d.ts +109 -0
  291. package/dist/watchers/ToolWatcher.d.ts.map +1 -0
  292. package/dist/watchers/ToolWatcher.js +71 -0
  293. package/dist/watchers/ToolWatcher.js.map +1 -0
  294. package/package.json +95 -0
@@ -0,0 +1,14 @@
1
+ const DANGEROUS_TAG_REGEX = /<\/?(script|iframe|img|style|svg|embed|object|link|meta|base|form)(\s[^>]*)?\s*\/?>/gi;
2
+ const CONTROL_CHAR_REGEX = /[\x00-\x08\x0B\x0C\x0E-\x1F]/g;
3
+ function stripDangerousTags(input) {
4
+ return input.replace(DANGEROUS_TAG_REGEX, '');
5
+ }
6
+ function stripControlChars(input) {
7
+ return input.replace(CONTROL_CHAR_REGEX, '');
8
+ }
9
+ function sanitizeString(input) {
10
+ return stripDangerousTags(stripControlChars(input));
11
+ }
12
+ export { sanitizeString, stripControlChars, stripDangerousTags };
13
+
14
+ //# sourceMappingURL=sanitize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize.js","sources":["../src/sanitize.ts"],"sourcesContent":["/**\n * Input sanitization for the sequential thinking MCP tool.\n *\n * Provides pure functions for stripping dangerous content from free-text fields.\n * Uses a targeted blocklist approach: only removes HTML tags that can execute code,\n * while preserving generic angle-bracket content like TypeScript generics (`Array<string>`),\n * mathematical comparisons (`x < 5`), and markdown formatting.\n *\n * @module sanitize\n */\n\n/**\n * Regex matching dangerous HTML tags that can execute JavaScript or load external resources.\n * Targets: script, iframe, img, style, svg, embed, object, link, meta, base, form.\n * Preserves: `Array<string>`, `x < 5 && y > 3`, `<details>`, `<code>`, `<pre>`, etc.\n */\nconst DANGEROUS_TAG_REGEX =\n\t/<\\/?(script|iframe|img|style|svg|embed|object|link|meta|base|form)(\\s[^>]*)?\\s*\\/?>/gi;\n\n/**\n * Null bytes and C0 control characters (except tab \\t, newline \\n, carriage return \\r).\n * These can cause truncation in C bindings, file I/O, and some databases.\n */\n// eslint-disable-next-line no-control-regex -- intentional: matches C0 control chars to strip them\nconst CONTROL_CHAR_REGEX = /[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]/g;\n\n/**\n * Strip dangerous HTML tags that can execute JavaScript or load external resources.\n *\n * Uses a targeted blocklist to remove only tags known to be dangerous (script, iframe,\n * img, style, svg, embed, object, link, meta, base, form) while preserving safe\n * angle-bracket content like TypeScript generics and mathematical comparisons.\n *\n * @param input - The string to sanitize\n * @returns The input with dangerous HTML tags removed\n *\n * @example\n * ```ts\n * stripDangerousTags('<script>alert(1)</script>hello'); // 'hello'\n * stripDangerousTags('Array<string>'); // 'Array<string>' (preserved)\n * stripDangerousTags('x < 5 && y > 3'); // 'x < 5 && y > 3' (preserved)\n * ```\n */\nexport function stripDangerousTags(input: string): string {\n\treturn input.replace(DANGEROUS_TAG_REGEX, '');\n}\n\n/**\n * Strip null bytes and C0 control characters from a string.\n *\n * Removes characters in the range U+0000–U+0008, U+000B, U+000C, U+000E–U+001F.\n * Preserves tab (`\\t`, U+0009), newline (`\\n`, U+000A), and carriage return (`\\r`, U+000D)\n * as these are commonly used in thought content.\n *\n * @param input - The string to sanitize\n * @returns The input with control characters removed\n *\n * @example\n * ```ts\n * stripControlChars('a\\x00b'); // 'ab'\n * stripControlChars('a\\tb\\nc'); // 'a\\tb\\nc' (tab and newline preserved)\n * ```\n */\nexport function stripControlChars(input: string): string {\n\treturn input.replace(CONTROL_CHAR_REGEX, '');\n}\n\n/**\n * Sanitize a string by stripping both control characters and dangerous HTML tags.\n *\n * Composes {@link stripControlChars} and {@link stripDangerousTags} in sequence.\n * Does not trim whitespace — thought content may depend on leading/trailing spaces.\n * Always returns a string, even if the input is empty.\n *\n * @param input - The string to sanitize\n * @returns The fully sanitized string\n *\n * @example\n * ```ts\n * sanitizeString('<script>alert(1)</script>hello\\x00world'); // 'helloworld'\n * sanitizeString('Array<string>\\x00'); // 'Array<string>'\n * ```\n */\nexport function sanitizeString(input: string): string {\n\treturn stripDangerousTags(stripControlChars(input));\n}\n"],"names":["DANGEROUS_TAG_REGEX","CONTROL_CHAR_REGEX","stripDangerousTags","input","stripControlChars","sanitizeString"],"mappings":"AAgBA,MAAMA,sBACL;AAOD,MAAMC,qBAAqB;AAmBpB,SAASC,mBAAmBC,KAAa;IAC/C,OAAOA,MAAM,OAAO,CAACH,qBAAqB;AAC3C;AAkBO,SAASI,kBAAkBD,KAAa;IAC9C,OAAOA,MAAM,OAAO,CAACF,oBAAoB;AAC1C;AAkBO,SAASI,eAAeF,KAAa;IAC3C,OAAOD,mBAAmBE,kBAAkBD;AAC7C"}
@@ -0,0 +1,531 @@
1
+ /**
2
+ * Valibot validation schemas for the sequential thinking MCP tool.
3
+ *
4
+ * This module defines the validation schemas used for the sequential thinking tool,
5
+ * including schemas for tool recommendations, skill recommendations, step recommendations,
6
+ * and the main sequential thinking input. All schemas use Valibot for runtime validation
7
+ * and provide detailed descriptions for MCP protocol compatibility.
8
+ *
9
+ * @remarks
10
+ * **Schema Overview:**
11
+ * - `ToolRecommendationSchema` - Validates tool recommendation objects with confidence scores
12
+ * - `SkillRecommendationSchema` - Validates skill recommendation objects
13
+ * - `StepRecommendationSchema` - Validates step coordination structures
14
+ * - `SequentialThinkingSchema` - Main schema for thought input validation
15
+ * - Reasoning enhancement fields: thought_type, quality_score, confidence, hypothesis_id, etc.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * import { SequentialThinkingSchema } from './schema.js';
20
+ * import { safeParse } from 'valibot';
21
+ *
22
+ * const result = safeParse(SequentialThinkingSchema, inputData);
23
+ * if (result.success) {
24
+ * const thought = result.output;
25
+ * // Process the valid thought
26
+ * } else {
27
+ * console.error('Validation failed:', result.issues);
28
+ * }
29
+ * ```
30
+ * @module schema
31
+ */
32
+ import * as v from 'valibot';
33
+ import type { Tool } from './types/tool.js';
34
+ /**
35
+ * Valibot schema for validating tool recommendation objects.
36
+ *
37
+ * Validates that a tool recommendation has:
38
+ * - A tool name (string)
39
+ * - A confidence score between 0 and 1
40
+ * - A rationale explaining the recommendation
41
+ * - A priority number for ordering
42
+ * - Optional suggested input parameters
43
+ * - Optional alternative tools
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * import { safeParse } from 'valibot';
48
+ * import { ToolRecommendationSchema } from './schema.js';
49
+ *
50
+ * const result = safeParse(ToolRecommendationSchema, {
51
+ * tool_name: 'mcp__tavily-mcp__tavily-search',
52
+ * confidence: 0.9,
53
+ * rationale: 'Best for web search',
54
+ * priority: 1
55
+ * });
56
+ * ```
57
+ */
58
+ export declare const ToolRecommendationSchema: v.ObjectSchema<{
59
+ readonly tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the tool being recommended">]>;
60
+ readonly confidence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation">]>;
61
+ readonly rationale: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Why this tool is recommended">]>;
62
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
63
+ readonly suggested_inputs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.DescriptionAction<{
64
+ [x: string]: unknown;
65
+ }, "Optional suggested parameters">]>, undefined>;
66
+ readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative tools that could be used">]>, undefined>;
67
+ }, undefined>;
68
+ /**
69
+ * Valibot schema for validating skill recommendation objects.
70
+ *
71
+ * Validates that a skill recommendation has:
72
+ * - A skill name (string)
73
+ * - A confidence score between 0 and 1
74
+ * - A rationale explaining the recommendation
75
+ * - A priority number for ordering
76
+ * - Optional alternative skills
77
+ * - Optional allowed tools list
78
+ * - Optional user invocable flag
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * import { safeParse } from 'valibot';
83
+ * import { SkillRecommendationSchema } from './schema.js';
84
+ *
85
+ * const result = safeParse(SkillRecommendationSchema, {
86
+ * skill_name: 'commit',
87
+ * confidence: 0.95,
88
+ * rationale: 'Handles git commit workflow',
89
+ * priority: 1,
90
+ * user_invocable: true
91
+ * });
92
+ * ```
93
+ */
94
+ export declare const SkillRecommendationSchema: v.ObjectSchema<{
95
+ readonly skill_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the skill being recommended">]>;
96
+ readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
97
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Why this skill is recommended (default: empty string)">]>, undefined>;
98
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
99
+ readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative skills that could be used">]>, undefined>;
100
+ readonly allowed_tools: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Tools this skill is allowed to use (from skill frontmatter)">]>, undefined>;
101
+ readonly user_invocable: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this skill can be user-invoked">]>, undefined>;
102
+ }, undefined>;
103
+ /**
104
+ * Valibot schema for validating step recommendation objects.
105
+ *
106
+ * Validates that a step recommendation has:
107
+ * - A step description
108
+ * - An array of recommended tools
109
+ * - An optional array of recommended skills
110
+ * - An expected outcome
111
+ * - Optional conditions for the next step
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * import { safeParse } from 'valibot';
116
+ * import { StepRecommendationSchema } from './schema.js';
117
+ *
118
+ * const result = safeParse(StepRecommendationSchema, {
119
+ * step_description: 'Search for TypeScript files',
120
+ * recommended_tools: [{ ... }],
121
+ * expected_outcome: 'List of all TypeScript files'
122
+ * });
123
+ * ```
124
+ */
125
+ export declare const StepRecommendationSchema: v.ObjectSchema<{
126
+ readonly step_description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What needs to be done">]>;
127
+ readonly recommended_tools: v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
128
+ readonly tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the tool being recommended">]>;
129
+ readonly confidence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation">]>;
130
+ readonly rationale: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Why this tool is recommended">]>;
131
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
132
+ readonly suggested_inputs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.DescriptionAction<{
133
+ [x: string]: unknown;
134
+ }, "Optional suggested parameters">]>, undefined>;
135
+ readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative tools that could be used">]>, undefined>;
136
+ }, undefined>, undefined>, v.DescriptionAction<{
137
+ tool_name: string;
138
+ confidence: number;
139
+ rationale: string;
140
+ priority?: number | undefined;
141
+ suggested_inputs?: {
142
+ [x: string]: unknown;
143
+ } | undefined;
144
+ alternatives?: string[] | undefined;
145
+ }[], "Tools recommended for this step">]>;
146
+ readonly recommended_skills: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
147
+ readonly skill_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the skill being recommended">]>;
148
+ readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
149
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Why this skill is recommended (default: empty string)">]>, undefined>;
150
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
151
+ readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative skills that could be used">]>, undefined>;
152
+ readonly allowed_tools: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Tools this skill is allowed to use (from skill frontmatter)">]>, undefined>;
153
+ readonly user_invocable: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this skill can be user-invoked">]>, undefined>;
154
+ }, undefined>, undefined>, v.DescriptionAction<{
155
+ skill_name: string;
156
+ confidence?: number | undefined;
157
+ rationale?: string | undefined;
158
+ priority?: number | undefined;
159
+ alternatives?: string[] | undefined;
160
+ allowed_tools?: string[] | undefined;
161
+ user_invocable?: boolean | undefined;
162
+ }[], "Skills recommended for this step">]>, undefined>;
163
+ readonly expected_outcome: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What to expect from this step">]>;
164
+ readonly next_step_conditions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Conditions to consider for the next step">]>, undefined>;
165
+ }, undefined>;
166
+ /**
167
+ * Valibot schema for validating partial tool recommendation objects.
168
+ *
169
+ * This is a lenient version of ToolRecommendationSchema used for previous_steps,
170
+ * where LLMs naturally provide partial/skeletal data. Only tool_name and rationale
171
+ * are required, while confidence and priority are optional with default values.
172
+ *
173
+ * Validates that a partial tool recommendation has:
174
+ * - A tool name (required)
175
+ * - A rationale explaining the recommendation (required)
176
+ * - An optional confidence score (defaults to 0.5)
177
+ * - An optional priority number (defaults to 999)
178
+ * - Optional suggested input parameters
179
+ * - Optional alternative tools
180
+ *
181
+ * @remarks
182
+ * **Design Rationale:**
183
+ * LLMs tend to provide complete data for current_step but only partial data
184
+ * for previous_steps (historical context). This schema accommodates that natural
185
+ * LLM behavior while maintaining data integrity through sensible defaults.
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * import { safeParse } from 'valibot';
190
+ * import { PartialToolRecommendationSchema } from './schema.js';
191
+ *
192
+ * // Minimal valid input (LLM often generates this for previous_steps)
193
+ * const result = safeParse(PartialToolRecommendationSchema, {
194
+ * tool_name: 'Read',
195
+ * rationale: 'Read the file'
196
+ * });
197
+ * // confidence and priority will be filled in by the normalizer
198
+ * ```
199
+ */
200
+ export declare const PartialToolRecommendationSchema: v.ObjectSchema<{
201
+ readonly tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the tool being recommended">]>;
202
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Why this tool is recommended (default: empty string)">]>, undefined>;
203
+ readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
204
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
205
+ readonly suggested_inputs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.DescriptionAction<{
206
+ [x: string]: unknown;
207
+ }, "Optional suggested parameters">]>, undefined>;
208
+ readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative tools that could be used">]>, undefined>;
209
+ }, undefined>;
210
+ /**
211
+ * Valibot schema for validating partial step recommendation objects.
212
+ *
213
+ * This is a lenient version of StepRecommendationSchema used for previous_steps,
214
+ * where LLMs naturally provide partial/skeletal data. Only step_description is
215
+ * strictly required, while expected_outcome and tool recommendation fields are
216
+ * optional with default values.
217
+ *
218
+ * Validates that a partial step recommendation has:
219
+ * - A step description (required)
220
+ * - An array of recommended tools (with optional confidence/priority)
221
+ * - An optional array of recommended skills
222
+ * - An optional expected outcome (defaults to empty string)
223
+ * - Optional conditions for the next step
224
+ *
225
+ * @remarks
226
+ * **Design Rationale:**
227
+ * LLMs provide complete, detailed data for current_step but only brief summaries
228
+ * for previous_steps. This schema allows the natural LLM behavior while the
229
+ * InputNormalizer fills in sensible defaults for missing fields.
230
+ *
231
+ * @example
232
+ * ```typescript
233
+ * import { safeParse } from 'valibot';
234
+ * import { PartialStepRecommendationSchema } from './schema.js';
235
+ *
236
+ * // Minimal valid input (LLM often generates this for previous_steps)
237
+ * const result = safeParse(PartialStepRecommendationSchema, {
238
+ * step_description: 'Read the file',
239
+ * recommended_tools: [{
240
+ * tool_name: 'Read',
241
+ * rationale: 'Read the file'
242
+ * }]
243
+ * });
244
+ * // confidence, priority, and expected_outcome will be filled in by normalizer
245
+ * ```
246
+ */
247
+ export declare const PartialStepRecommendationSchema: v.ObjectSchema<{
248
+ readonly step_description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What needs to be done">]>;
249
+ readonly recommended_tools: v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
250
+ readonly tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the tool being recommended">]>;
251
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Why this tool is recommended (default: empty string)">]>, undefined>;
252
+ readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
253
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
254
+ readonly suggested_inputs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.DescriptionAction<{
255
+ [x: string]: unknown;
256
+ }, "Optional suggested parameters">]>, undefined>;
257
+ readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative tools that could be used">]>, undefined>;
258
+ }, undefined>, undefined>, v.DescriptionAction<{
259
+ tool_name: string;
260
+ rationale?: string | undefined;
261
+ confidence?: number | undefined;
262
+ priority?: number | undefined;
263
+ suggested_inputs?: {
264
+ [x: string]: unknown;
265
+ } | undefined;
266
+ alternatives?: string[] | undefined;
267
+ }[], "Tools recommended for this step">]>;
268
+ readonly recommended_skills: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
269
+ readonly skill_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the skill being recommended">]>;
270
+ readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
271
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Why this skill is recommended (default: empty string)">]>, undefined>;
272
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
273
+ readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative skills that could be used">]>, undefined>;
274
+ readonly allowed_tools: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Tools this skill is allowed to use (from skill frontmatter)">]>, undefined>;
275
+ readonly user_invocable: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this skill can be user-invoked">]>, undefined>;
276
+ }, undefined>, undefined>, v.DescriptionAction<{
277
+ skill_name: string;
278
+ confidence?: number | undefined;
279
+ rationale?: string | undefined;
280
+ priority?: number | undefined;
281
+ alternatives?: string[] | undefined;
282
+ allowed_tools?: string[] | undefined;
283
+ user_invocable?: boolean | undefined;
284
+ }[], "Skills recommended for this step">]>, undefined>;
285
+ readonly expected_outcome: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What to expect from this step (default: empty string)">]>, undefined>;
286
+ readonly next_step_conditions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Conditions to consider for the next step">]>, undefined>;
287
+ }, undefined>;
288
+ /**
289
+ * Main Valibot schema for validating sequential thinking tool input.
290
+ *
291
+ * This is the primary schema used for the sequential thinking MCP tool.
292
+ * It validates all thought data including:
293
+ * - Optional available tools and skills arrays
294
+ * - The thought content (required)
295
+ * - Thought numbering (thought_number, total_thoughts)
296
+ * - Revision and branching metadata
297
+ * - Current, previous, and remaining step recommendations
298
+ *
299
+ * @remarks
300
+ * **Validation Rules:**
301
+ * - `thought_number` must be >= 1
302
+ * - `total_thoughts` must be >= 1
303
+ * - `branch_id` must be 1-50 characters, alphanumeric/hyphens/underscores only
304
+ * - `confidence` values must be between 0 and 1
305
+ * - `thought_type` must be one of: regular, hypothesis, verification, critique, synthesis, meta
306
+ * - `quality_score` and `confidence` must be between 0 and 1
307
+ * - `hypothesis_id` must be 1-50 characters, alphanumeric/hyphens/underscores only
308
+ *
309
+ * @example
310
+ * ```typescript
311
+ * import { safeParse } from 'valibot';
312
+ * import { SequentialThinkingSchema } from './schema.js';
313
+ *
314
+ * const result = safeParse(SequentialThinkingSchema, {
315
+ * thought: 'I need to analyze the problem',
316
+ * thought_number: 1,
317
+ * total_thoughts: 5,
318
+ * next_thought_needed: true,
319
+ * available_mcp_tools: ['Read', 'Write', 'Grep']
320
+ * });
321
+ *
322
+ * if (result.success) {
323
+ * console.log('Valid thought:', result.output);
324
+ * } else {
325
+ * console.error('Validation errors:', result.issues);
326
+ * }
327
+ * ```
328
+ */
329
+ export declare const SequentialThinkingSchema: v.ObjectSchema<{
330
+ readonly available_mcp_tools: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Array of MCP tool names available for use (e.g., [\"mcp-omnisearch\", \"mcp-turso-cloud\"])">]>, undefined>;
331
+ readonly available_skills: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Array of skill names available for use (e.g., [\"commit\", \"review-pr\", \"pdf\"])">]>, undefined>;
332
+ readonly thought: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Your current thinking step">]>;
333
+ readonly next_thought_needed: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether another thought step is needed (defaults to true if not provided)">]>, undefined>;
334
+ readonly thought_number: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Current thought number">]>;
335
+ readonly total_thoughts: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Estimated total thoughts needed">]>;
336
+ readonly is_revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this revises previous thinking">]>, undefined>;
337
+ readonly revises_thought: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Which thought is being reconsidered">]>, undefined>;
338
+ readonly branch_from_thought: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Branching point thought number">]>, undefined>;
339
+ readonly branch_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Branch ID must contain only letters, numbers, hyphens, and underscores">, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 50, undefined>, v.DescriptionAction<string, "Branch identifier (alphanumeric, hyphens, underscores only, max 50 chars)">]>, undefined>;
340
+ readonly needs_more_thoughts: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "If more thoughts are needed">]>, undefined>;
341
+ readonly current_step: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
342
+ readonly step_description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What needs to be done">]>;
343
+ readonly recommended_tools: v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
344
+ readonly tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the tool being recommended">]>;
345
+ readonly confidence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation">]>;
346
+ readonly rationale: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Why this tool is recommended">]>;
347
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
348
+ readonly suggested_inputs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.DescriptionAction<{
349
+ [x: string]: unknown;
350
+ }, "Optional suggested parameters">]>, undefined>;
351
+ readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative tools that could be used">]>, undefined>;
352
+ }, undefined>, undefined>, v.DescriptionAction<{
353
+ tool_name: string;
354
+ confidence: number;
355
+ rationale: string;
356
+ priority?: number | undefined;
357
+ suggested_inputs?: {
358
+ [x: string]: unknown;
359
+ } | undefined;
360
+ alternatives?: string[] | undefined;
361
+ }[], "Tools recommended for this step">]>;
362
+ readonly recommended_skills: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
363
+ readonly skill_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the skill being recommended">]>;
364
+ readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
365
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Why this skill is recommended (default: empty string)">]>, undefined>;
366
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
367
+ readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative skills that could be used">]>, undefined>;
368
+ readonly allowed_tools: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Tools this skill is allowed to use (from skill frontmatter)">]>, undefined>;
369
+ readonly user_invocable: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this skill can be user-invoked">]>, undefined>;
370
+ }, undefined>, undefined>, v.DescriptionAction<{
371
+ skill_name: string;
372
+ confidence?: number | undefined;
373
+ rationale?: string | undefined;
374
+ priority?: number | undefined;
375
+ alternatives?: string[] | undefined;
376
+ allowed_tools?: string[] | undefined;
377
+ user_invocable?: boolean | undefined;
378
+ }[], "Skills recommended for this step">]>, undefined>;
379
+ readonly expected_outcome: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What to expect from this step">]>;
380
+ readonly next_step_conditions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Conditions to consider for the next step">]>, undefined>;
381
+ }, undefined>, v.DescriptionAction<{
382
+ step_description: string;
383
+ recommended_tools: {
384
+ tool_name: string;
385
+ confidence: number;
386
+ rationale: string;
387
+ priority?: number | undefined;
388
+ suggested_inputs?: {
389
+ [x: string]: unknown;
390
+ } | undefined;
391
+ alternatives?: string[] | undefined;
392
+ }[];
393
+ recommended_skills?: {
394
+ skill_name: string;
395
+ confidence?: number | undefined;
396
+ rationale?: string | undefined;
397
+ priority?: number | undefined;
398
+ alternatives?: string[] | undefined;
399
+ allowed_tools?: string[] | undefined;
400
+ user_invocable?: boolean | undefined;
401
+ }[] | undefined;
402
+ expected_outcome: string;
403
+ next_step_conditions?: string[] | undefined;
404
+ }, "Current step recommendation">]>, undefined>;
405
+ readonly previous_steps: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
406
+ readonly step_description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What needs to be done">]>;
407
+ readonly recommended_tools: v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
408
+ readonly tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the tool being recommended">]>;
409
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Why this tool is recommended (default: empty string)">]>, undefined>;
410
+ readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
411
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
412
+ readonly suggested_inputs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.DescriptionAction<{
413
+ [x: string]: unknown;
414
+ }, "Optional suggested parameters">]>, undefined>;
415
+ readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative tools that could be used">]>, undefined>;
416
+ }, undefined>, undefined>, v.DescriptionAction<{
417
+ tool_name: string;
418
+ rationale?: string | undefined;
419
+ confidence?: number | undefined;
420
+ priority?: number | undefined;
421
+ suggested_inputs?: {
422
+ [x: string]: unknown;
423
+ } | undefined;
424
+ alternatives?: string[] | undefined;
425
+ }[], "Tools recommended for this step">]>;
426
+ readonly recommended_skills: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
427
+ readonly skill_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Name of the skill being recommended">]>;
428
+ readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "0-1 indicating confidence in recommendation (default: 0.5)">]>, undefined>;
429
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Why this skill is recommended (default: empty string)">]>, undefined>;
430
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.DescriptionAction<number, "Order in the recommendation sequence (default: 999)">]>, undefined>;
431
+ readonly alternatives: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Alternative skills that could be used">]>, undefined>;
432
+ readonly allowed_tools: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Tools this skill is allowed to use (from skill frontmatter)">]>, undefined>;
433
+ readonly user_invocable: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether this skill can be user-invoked">]>, undefined>;
434
+ }, undefined>, undefined>, v.DescriptionAction<{
435
+ skill_name: string;
436
+ confidence?: number | undefined;
437
+ rationale?: string | undefined;
438
+ priority?: number | undefined;
439
+ alternatives?: string[] | undefined;
440
+ allowed_tools?: string[] | undefined;
441
+ user_invocable?: boolean | undefined;
442
+ }[], "Skills recommended for this step">]>, undefined>;
443
+ readonly expected_outcome: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "What to expect from this step (default: empty string)">]>, undefined>;
444
+ readonly next_step_conditions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "Conditions to consider for the next step">]>, undefined>;
445
+ }, undefined>, undefined>, v.DescriptionAction<{
446
+ step_description: string;
447
+ recommended_tools: {
448
+ tool_name: string;
449
+ rationale?: string | undefined;
450
+ confidence?: number | undefined;
451
+ priority?: number | undefined;
452
+ suggested_inputs?: {
453
+ [x: string]: unknown;
454
+ } | undefined;
455
+ alternatives?: string[] | undefined;
456
+ }[];
457
+ recommended_skills?: {
458
+ skill_name: string;
459
+ confidence?: number | undefined;
460
+ rationale?: string | undefined;
461
+ priority?: number | undefined;
462
+ alternatives?: string[] | undefined;
463
+ allowed_tools?: string[] | undefined;
464
+ user_invocable?: boolean | undefined;
465
+ }[] | undefined;
466
+ expected_outcome?: string | undefined;
467
+ next_step_conditions?: string[] | undefined;
468
+ }[], "Steps already recommended (lenient schema - allows partial data with defaults)">]>, undefined>;
469
+ readonly remaining_steps: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string[], "High-level descriptions of upcoming steps">]>, undefined>;
470
+ readonly thought_type: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["regular", "hypothesis", "verification", "critique", "synthesis", "meta"], undefined>, v.DescriptionAction<"regular" | "hypothesis" | "verification" | "critique" | "synthesis" | "meta", "Classified purpose: regular, hypothesis, verification, critique, synthesis, meta">]>, undefined>;
471
+ readonly quality_score: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "Self-assessed quality score (0-1)">]>, undefined>;
472
+ readonly confidence: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>, v.DescriptionAction<number, "Explicit confidence in correctness (0-1)">]>, undefined>;
473
+ readonly hypothesis_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Hypothesis ID must contain only letters, numbers, hyphens, and underscores">, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 50, undefined>, v.DescriptionAction<string, "Identifier linking hypothesis to verification thoughts">]>, undefined>;
474
+ readonly verification_target: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Thought number being verified or critiqued">]>, undefined>;
475
+ readonly synthesis_sources: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>, v.DescriptionAction<number[], "Thought numbers being synthesized">]>, undefined>;
476
+ readonly merge_from_thoughts: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>, v.DescriptionAction<number[], "Thought numbers from other branches being merged (DAG)">]>, undefined>;
477
+ readonly merge_branch_ids: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MaxLengthAction<string, 50, undefined>]>, undefined>, v.DescriptionAction<string[], "Branch IDs being merged into current context">]>, undefined>;
478
+ readonly meta_observation: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "Metacognitive observation about reasoning process">]>, undefined>;
479
+ readonly reasoning_depth: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["shallow", "moderate", "deep"], undefined>, v.DescriptionAction<"shallow" | "moderate" | "deep", "Effort signal: how deep reasoning should go">]>, undefined>;
480
+ readonly session_id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Session ID must contain only letters, numbers, hyphens, and underscores">, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>, v.DescriptionAction<string, "Optional session identifier for state isolation. When provided, thought history, branches, and statistics are scoped to this session. Omitting preserves global behavior.">]>, undefined>;
481
+ readonly reset_state: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "When true, clears all state for the target session before processing this thought. The thought is then processed as the first in a fresh session.">]>, undefined>;
482
+ }, undefined>;
483
+ /**
484
+ * The sequential thinking tool definition for MCP registration.
485
+ *
486
+ * This object defines the tool that is registered with the MCP server.
487
+ * The inputSchema is left empty as the schema is handled by tmcp
488
+ * when registering the tool using the Valibot adapter.
489
+ *
490
+ * @example
491
+ * ```typescript
492
+ * import { SEQUENTIAL_THINKING_TOOL } from './schema.js';
493
+ * import { McpServer } from 'tmcp';
494
+ *
495
+ * const server = new McpServer({ name: 'my-server', version: '1.0.0' });
496
+ * server.tool({
497
+ * name: SEQUENTIAL_THINKING_TOOL.name,
498
+ * description: SEQUENTIAL_THINKING_TOOL.description,
499
+ * schema: SequentialThinkingSchema
500
+ * }, handler);
501
+ * ```
502
+ */
503
+ export declare const SEQUENTIAL_THINKING_TOOL: Tool;
504
+ /**
505
+ * Valibot schema for validating JSON-RPC 2.0 request messages.
506
+ *
507
+ * Validates that a JSON-RPC request has:
508
+ * - A jsonrpc version (must be "2.0")
509
+ * - A method name (string)
510
+ * - Optional params (object or array)
511
+ * - Optional id (string, number, or null for notifications)
512
+ *
513
+ * @example
514
+ * ```typescript
515
+ * import { safeParse } from 'valibot';
516
+ * import { JsonRpcRequestSchema } from './schema.js';
517
+ *
518
+ * const result = safeParse(JsonRpcRequestSchema, {
519
+ * jsonrpc: '2.0',
520
+ * method: 'tools/list',
521
+ * id: 1
522
+ * });
523
+ * ```
524
+ */
525
+ export declare const JsonRpcRequestSchema: v.ObjectSchema<{
526
+ readonly jsonrpc: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.LiteralSchema<"2.0", undefined>, v.DescriptionAction<"2.0", "JSON-RPC protocol version (must be \"2.0\")">]>;
527
+ readonly method: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "Method name to invoke">]>;
528
+ readonly params: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.ObjectSchema<{}, undefined>, v.ArraySchema<v.UnknownSchema, undefined>], undefined>, v.DescriptionAction<unknown[] | {}, "Method parameters (object or array)">]>, undefined>;
529
+ readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.NullSchema<undefined>], undefined>, v.DescriptionAction<string | number | null, "Request ID (omit for notifications)">]>, undefined>;
530
+ }, undefined>;
531
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAgH5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;aAkBnC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;aA4BpC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAanC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;aAsB1C,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAe1C,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA8JnC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,wBAAwB,EAAE,IAItC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,oBAAoB;;;;;aAmB/B,CAAC"}