distill-mcp 0.6.0-beta

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 (440) hide show
  1. package/bin/cli.js +133 -0
  2. package/dist/analytics/session-tracker.d.ts +74 -0
  3. package/dist/analytics/session-tracker.d.ts.map +1 -0
  4. package/dist/analytics/session-tracker.js +123 -0
  5. package/dist/ast/benchmark.test.d.ts +7 -0
  6. package/dist/ast/benchmark.test.d.ts.map +1 -0
  7. package/dist/ast/benchmark.test.js +175 -0
  8. package/dist/ast/go/index.d.ts +9 -0
  9. package/dist/ast/go/index.d.ts.map +1 -0
  10. package/dist/ast/go/index.js +8 -0
  11. package/dist/ast/go/parser.d.ts +31 -0
  12. package/dist/ast/go/parser.d.ts.map +1 -0
  13. package/dist/ast/go/parser.js +428 -0
  14. package/dist/ast/go/parser.test.d.ts +5 -0
  15. package/dist/ast/go/parser.test.d.ts.map +1 -0
  16. package/dist/ast/go/parser.test.js +241 -0
  17. package/dist/ast/go/queries.d.ts +51 -0
  18. package/dist/ast/go/queries.d.ts.map +1 -0
  19. package/dist/ast/go/queries.js +114 -0
  20. package/dist/ast/go/utils.d.ts +66 -0
  21. package/dist/ast/go/utils.d.ts.map +1 -0
  22. package/dist/ast/go/utils.js +140 -0
  23. package/dist/ast/index.d.ts +39 -0
  24. package/dist/ast/index.d.ts.map +1 -0
  25. package/dist/ast/index.js +245 -0
  26. package/dist/ast/php/index.d.ts +9 -0
  27. package/dist/ast/php/index.d.ts.map +1 -0
  28. package/dist/ast/php/index.js +8 -0
  29. package/dist/ast/php/parser.d.ts +31 -0
  30. package/dist/ast/php/parser.d.ts.map +1 -0
  31. package/dist/ast/php/parser.js +388 -0
  32. package/dist/ast/php/parser.test.d.ts +5 -0
  33. package/dist/ast/php/parser.test.d.ts.map +1 -0
  34. package/dist/ast/php/parser.test.js +328 -0
  35. package/dist/ast/php/queries.d.ts +61 -0
  36. package/dist/ast/php/queries.d.ts.map +1 -0
  37. package/dist/ast/php/queries.js +117 -0
  38. package/dist/ast/php/utils.d.ts +83 -0
  39. package/dist/ast/php/utils.d.ts.map +1 -0
  40. package/dist/ast/php/utils.js +246 -0
  41. package/dist/ast/python/index.d.ts +9 -0
  42. package/dist/ast/python/index.d.ts.map +1 -0
  43. package/dist/ast/python/index.js +8 -0
  44. package/dist/ast/python/parser.d.ts +32 -0
  45. package/dist/ast/python/parser.d.ts.map +1 -0
  46. package/dist/ast/python/parser.js +422 -0
  47. package/dist/ast/python/parser.test.d.ts +5 -0
  48. package/dist/ast/python/parser.test.d.ts.map +1 -0
  49. package/dist/ast/python/parser.test.js +186 -0
  50. package/dist/ast/python/queries.d.ts +73 -0
  51. package/dist/ast/python/queries.d.ts.map +1 -0
  52. package/dist/ast/python/queries.js +137 -0
  53. package/dist/ast/python/utils.d.ts +63 -0
  54. package/dist/ast/python/utils.d.ts.map +1 -0
  55. package/dist/ast/python/utils.js +159 -0
  56. package/dist/ast/quick-scan.d.ts +40 -0
  57. package/dist/ast/quick-scan.d.ts.map +1 -0
  58. package/dist/ast/quick-scan.js +287 -0
  59. package/dist/ast/rust/index.d.ts +9 -0
  60. package/dist/ast/rust/index.d.ts.map +1 -0
  61. package/dist/ast/rust/index.js +8 -0
  62. package/dist/ast/rust/parser.d.ts +31 -0
  63. package/dist/ast/rust/parser.d.ts.map +1 -0
  64. package/dist/ast/rust/parser.js +416 -0
  65. package/dist/ast/rust/parser.test.d.ts +5 -0
  66. package/dist/ast/rust/parser.test.d.ts.map +1 -0
  67. package/dist/ast/rust/parser.test.js +329 -0
  68. package/dist/ast/rust/queries.d.ts +66 -0
  69. package/dist/ast/rust/queries.d.ts.map +1 -0
  70. package/dist/ast/rust/queries.js +132 -0
  71. package/dist/ast/rust/utils.d.ts +91 -0
  72. package/dist/ast/rust/utils.d.ts.map +1 -0
  73. package/dist/ast/rust/utils.js +254 -0
  74. package/dist/ast/swift/index.d.ts +10 -0
  75. package/dist/ast/swift/index.d.ts.map +1 -0
  76. package/dist/ast/swift/index.js +8 -0
  77. package/dist/ast/swift/parser.d.ts +31 -0
  78. package/dist/ast/swift/parser.d.ts.map +1 -0
  79. package/dist/ast/swift/parser.js +554 -0
  80. package/dist/ast/swift/parser.test.d.ts +5 -0
  81. package/dist/ast/swift/parser.test.d.ts.map +1 -0
  82. package/dist/ast/swift/parser.test.js +398 -0
  83. package/dist/ast/swift/queries.d.ts +71 -0
  84. package/dist/ast/swift/queries.d.ts.map +1 -0
  85. package/dist/ast/swift/queries.js +137 -0
  86. package/dist/ast/swift/utils.d.ts +94 -0
  87. package/dist/ast/swift/utils.d.ts.map +1 -0
  88. package/dist/ast/swift/utils.js +411 -0
  89. package/dist/ast/types.d.ts +96 -0
  90. package/dist/ast/types.d.ts.map +1 -0
  91. package/dist/ast/types.js +21 -0
  92. package/dist/ast/typescript.d.ts +24 -0
  93. package/dist/ast/typescript.d.ts.map +1 -0
  94. package/dist/ast/typescript.js +357 -0
  95. package/dist/cache/file-hash.d.ts +33 -0
  96. package/dist/cache/file-hash.d.ts.map +1 -0
  97. package/dist/cache/file-hash.js +59 -0
  98. package/dist/cache/index.d.ts +9 -0
  99. package/dist/cache/index.d.ts.map +1 -0
  100. package/dist/cache/index.js +8 -0
  101. package/dist/cache/smart-cache.d.ts +68 -0
  102. package/dist/cache/smart-cache.d.ts.map +1 -0
  103. package/dist/cache/smart-cache.js +266 -0
  104. package/dist/cache/types.d.ts +102 -0
  105. package/dist/cache/types.d.ts.map +1 -0
  106. package/dist/cache/types.js +6 -0
  107. package/dist/cli/analyze.d.ts +43 -0
  108. package/dist/cli/analyze.d.ts.map +1 -0
  109. package/dist/cli/analyze.js +250 -0
  110. package/dist/cli/doctor.d.ts +2 -0
  111. package/dist/cli/doctor.d.ts.map +1 -0
  112. package/dist/cli/doctor.js +127 -0
  113. package/dist/cli/hooks.d.ts +14 -0
  114. package/dist/cli/hooks.d.ts.map +1 -0
  115. package/dist/cli/hooks.js +229 -0
  116. package/dist/cli/index.d.ts +5 -0
  117. package/dist/cli/index.d.ts.map +1 -0
  118. package/dist/cli/index.js +4 -0
  119. package/dist/cli/setup.d.ts +10 -0
  120. package/dist/cli/setup.d.ts.map +1 -0
  121. package/dist/cli/setup.js +117 -0
  122. package/dist/cli/utils.d.ts +30 -0
  123. package/dist/cli/utils.d.ts.map +1 -0
  124. package/dist/cli/utils.js +116 -0
  125. package/dist/compressors/config.d.ts +9 -0
  126. package/dist/compressors/config.d.ts.map +1 -0
  127. package/dist/compressors/config.js +183 -0
  128. package/dist/compressors/conversation.d.ts +109 -0
  129. package/dist/compressors/conversation.d.ts.map +1 -0
  130. package/dist/compressors/conversation.js +404 -0
  131. package/dist/compressors/diff.d.ts +35 -0
  132. package/dist/compressors/diff.d.ts.map +1 -0
  133. package/dist/compressors/diff.js +389 -0
  134. package/dist/compressors/generic.d.ts +9 -0
  135. package/dist/compressors/generic.d.ts.map +1 -0
  136. package/dist/compressors/generic.js +188 -0
  137. package/dist/compressors/index.d.ts +31 -0
  138. package/dist/compressors/index.d.ts.map +1 -0
  139. package/dist/compressors/index.js +82 -0
  140. package/dist/compressors/logs.d.ts +9 -0
  141. package/dist/compressors/logs.d.ts.map +1 -0
  142. package/dist/compressors/logs.js +245 -0
  143. package/dist/compressors/multifile.d.ts +106 -0
  144. package/dist/compressors/multifile.d.ts.map +1 -0
  145. package/dist/compressors/multifile.js +498 -0
  146. package/dist/compressors/semantic.d.ts +33 -0
  147. package/dist/compressors/semantic.d.ts.map +1 -0
  148. package/dist/compressors/semantic.js +233 -0
  149. package/dist/compressors/stacktrace.d.ts +9 -0
  150. package/dist/compressors/stacktrace.d.ts.map +1 -0
  151. package/dist/compressors/stacktrace.js +259 -0
  152. package/dist/compressors/types.d.ts +146 -0
  153. package/dist/compressors/types.d.ts.map +1 -0
  154. package/dist/compressors/types.js +6 -0
  155. package/dist/config/output-config.d.ts +56 -0
  156. package/dist/config/output-config.d.ts.map +1 -0
  157. package/dist/config/output-config.js +78 -0
  158. package/dist/index.d.ts +21 -0
  159. package/dist/index.d.ts.map +1 -0
  160. package/dist/index.js +27 -0
  161. package/dist/middleware/chain.d.ts +49 -0
  162. package/dist/middleware/chain.d.ts.map +1 -0
  163. package/dist/middleware/chain.js +126 -0
  164. package/dist/middleware/index.d.ts +4 -0
  165. package/dist/middleware/index.d.ts.map +1 -0
  166. package/dist/middleware/index.js +3 -0
  167. package/dist/middleware/logging.d.ts +8 -0
  168. package/dist/middleware/logging.d.ts.map +1 -0
  169. package/dist/middleware/logging.js +71 -0
  170. package/dist/middleware/types.d.ts +58 -0
  171. package/dist/middleware/types.d.ts.map +1 -0
  172. package/dist/middleware/types.js +7 -0
  173. package/dist/parsers/eslint.d.ts +8 -0
  174. package/dist/parsers/eslint.d.ts.map +1 -0
  175. package/dist/parsers/eslint.js +132 -0
  176. package/dist/parsers/generic.d.ts +8 -0
  177. package/dist/parsers/generic.d.ts.map +1 -0
  178. package/dist/parsers/generic.js +234 -0
  179. package/dist/parsers/index.d.ts +34 -0
  180. package/dist/parsers/index.d.ts.map +1 -0
  181. package/dist/parsers/index.js +216 -0
  182. package/dist/parsers/types.d.ts +84 -0
  183. package/dist/parsers/types.d.ts.map +1 -0
  184. package/dist/parsers/types.js +6 -0
  185. package/dist/parsers/typescript.d.ts +8 -0
  186. package/dist/parsers/typescript.d.ts.map +1 -0
  187. package/dist/parsers/typescript.js +107 -0
  188. package/dist/pipelines/definitions.d.ts +50 -0
  189. package/dist/pipelines/definitions.d.ts.map +1 -0
  190. package/dist/pipelines/definitions.js +206 -0
  191. package/dist/sandbox/executor.d.ts +12 -0
  192. package/dist/sandbox/executor.d.ts.map +1 -0
  193. package/dist/sandbox/executor.js +191 -0
  194. package/dist/sandbox/index.d.ts +11 -0
  195. package/dist/sandbox/index.d.ts.map +1 -0
  196. package/dist/sandbox/index.js +9 -0
  197. package/dist/sandbox/sandbox.test.d.ts +7 -0
  198. package/dist/sandbox/sandbox.test.d.ts.map +1 -0
  199. package/dist/sandbox/sandbox.test.js +202 -0
  200. package/dist/sandbox/sdk/analyze.d.ts +36 -0
  201. package/dist/sandbox/sdk/analyze.d.ts.map +1 -0
  202. package/dist/sandbox/sdk/analyze.js +413 -0
  203. package/dist/sandbox/sdk/analyze.test.d.ts +7 -0
  204. package/dist/sandbox/sdk/analyze.test.d.ts.map +1 -0
  205. package/dist/sandbox/sdk/analyze.test.js +191 -0
  206. package/dist/sandbox/sdk/code.d.ts +20 -0
  207. package/dist/sandbox/sdk/code.d.ts.map +1 -0
  208. package/dist/sandbox/sdk/code.js +104 -0
  209. package/dist/sandbox/sdk/compress.d.ts +23 -0
  210. package/dist/sandbox/sdk/compress.d.ts.map +1 -0
  211. package/dist/sandbox/sdk/compress.js +107 -0
  212. package/dist/sandbox/sdk/conversation.d.ts +148 -0
  213. package/dist/sandbox/sdk/conversation.d.ts.map +1 -0
  214. package/dist/sandbox/sdk/conversation.js +177 -0
  215. package/dist/sandbox/sdk/files.d.ts +29 -0
  216. package/dist/sandbox/sdk/files.d.ts.map +1 -0
  217. package/dist/sandbox/sdk/files.js +41 -0
  218. package/dist/sandbox/sdk/git.d.ts +37 -0
  219. package/dist/sandbox/sdk/git.d.ts.map +1 -0
  220. package/dist/sandbox/sdk/git.js +313 -0
  221. package/dist/sandbox/sdk/git.test.d.ts +8 -0
  222. package/dist/sandbox/sdk/git.test.d.ts.map +1 -0
  223. package/dist/sandbox/sdk/git.test.js +160 -0
  224. package/dist/sandbox/sdk/index.d.ts +16 -0
  225. package/dist/sandbox/sdk/index.d.ts.map +1 -0
  226. package/dist/sandbox/sdk/index.js +15 -0
  227. package/dist/sandbox/sdk/multifile.d.ts +63 -0
  228. package/dist/sandbox/sdk/multifile.d.ts.map +1 -0
  229. package/dist/sandbox/sdk/multifile.js +130 -0
  230. package/dist/sandbox/sdk/pipeline.d.ts +16 -0
  231. package/dist/sandbox/sdk/pipeline.d.ts.map +1 -0
  232. package/dist/sandbox/sdk/pipeline.js +454 -0
  233. package/dist/sandbox/sdk/pipeline.test.d.ts +7 -0
  234. package/dist/sandbox/sdk/pipeline.test.d.ts.map +1 -0
  235. package/dist/sandbox/sdk/pipeline.test.js +197 -0
  236. package/dist/sandbox/sdk/search.d.ts +36 -0
  237. package/dist/sandbox/sdk/search.d.ts.map +1 -0
  238. package/dist/sandbox/sdk/search.js +338 -0
  239. package/dist/sandbox/sdk/search.test.d.ts +7 -0
  240. package/dist/sandbox/sdk/search.test.d.ts.map +1 -0
  241. package/dist/sandbox/sdk/search.test.js +183 -0
  242. package/dist/sandbox/sdk/utils.d.ts +18 -0
  243. package/dist/sandbox/sdk/utils.d.ts.map +1 -0
  244. package/dist/sandbox/sdk/utils.js +24 -0
  245. package/dist/sandbox/security/code-analyzer.d.ts +15 -0
  246. package/dist/sandbox/security/code-analyzer.d.ts.map +1 -0
  247. package/dist/sandbox/security/code-analyzer.js +87 -0
  248. package/dist/sandbox/security/index.d.ts +6 -0
  249. package/dist/sandbox/security/index.d.ts.map +1 -0
  250. package/dist/sandbox/security/index.js +5 -0
  251. package/dist/sandbox/security/path-validator.d.ts +23 -0
  252. package/dist/sandbox/security/path-validator.d.ts.map +1 -0
  253. package/dist/sandbox/security/path-validator.js +113 -0
  254. package/dist/sandbox/types.d.ts +577 -0
  255. package/dist/sandbox/types.d.ts.map +1 -0
  256. package/dist/sandbox/types.js +14 -0
  257. package/dist/server.d.ts +36 -0
  258. package/dist/server.d.ts.map +1 -0
  259. package/dist/server.js +133 -0
  260. package/dist/summarizers/build-logs.d.ts +11 -0
  261. package/dist/summarizers/build-logs.d.ts.map +1 -0
  262. package/dist/summarizers/build-logs.js +234 -0
  263. package/dist/summarizers/generic.d.ts +11 -0
  264. package/dist/summarizers/generic.d.ts.map +1 -0
  265. package/dist/summarizers/generic.js +93 -0
  266. package/dist/summarizers/index.d.ts +20 -0
  267. package/dist/summarizers/index.d.ts.map +1 -0
  268. package/dist/summarizers/index.js +43 -0
  269. package/dist/summarizers/server-logs.d.ts +11 -0
  270. package/dist/summarizers/server-logs.d.ts.map +1 -0
  271. package/dist/summarizers/server-logs.js +215 -0
  272. package/dist/summarizers/test-logs.d.ts +11 -0
  273. package/dist/summarizers/test-logs.d.ts.map +1 -0
  274. package/dist/summarizers/test-logs.js +258 -0
  275. package/dist/summarizers/types.d.ts +146 -0
  276. package/dist/summarizers/types.d.ts.map +1 -0
  277. package/dist/summarizers/types.js +21 -0
  278. package/dist/tools/analyze-build-output.d.ts +30 -0
  279. package/dist/tools/analyze-build-output.d.ts.map +1 -0
  280. package/dist/tools/analyze-build-output.js +45 -0
  281. package/dist/tools/analyze-context.d.ts +23 -0
  282. package/dist/tools/analyze-context.d.ts.map +1 -0
  283. package/dist/tools/analyze-context.js +78 -0
  284. package/dist/tools/auto-optimize.d.ts +9 -0
  285. package/dist/tools/auto-optimize.d.ts.map +1 -0
  286. package/dist/tools/auto-optimize.js +191 -0
  287. package/dist/tools/code-execute.d.ts +9 -0
  288. package/dist/tools/code-execute.d.ts.map +1 -0
  289. package/dist/tools/code-execute.js +84 -0
  290. package/dist/tools/code-skeleton.d.ts +33 -0
  291. package/dist/tools/code-skeleton.d.ts.map +1 -0
  292. package/dist/tools/code-skeleton.js +206 -0
  293. package/dist/tools/compress-context.d.ts +33 -0
  294. package/dist/tools/compress-context.d.ts.map +1 -0
  295. package/dist/tools/compress-context.js +64 -0
  296. package/dist/tools/context-budget.d.ts +43 -0
  297. package/dist/tools/context-budget.d.ts.map +1 -0
  298. package/dist/tools/context-budget.js +260 -0
  299. package/dist/tools/context-budget.test.d.ts +5 -0
  300. package/dist/tools/context-budget.test.d.ts.map +1 -0
  301. package/dist/tools/context-budget.test.js +219 -0
  302. package/dist/tools/conversation-compress.d.ts +46 -0
  303. package/dist/tools/conversation-compress.d.ts.map +1 -0
  304. package/dist/tools/conversation-compress.js +78 -0
  305. package/dist/tools/conversation-memory.d.ts +75 -0
  306. package/dist/tools/conversation-memory.d.ts.map +1 -0
  307. package/dist/tools/conversation-memory.js +289 -0
  308. package/dist/tools/deduplicate-errors.d.ts +30 -0
  309. package/dist/tools/deduplicate-errors.d.ts.map +1 -0
  310. package/dist/tools/deduplicate-errors.js +72 -0
  311. package/dist/tools/detect-retry-loop.d.ts +40 -0
  312. package/dist/tools/detect-retry-loop.d.ts.map +1 -0
  313. package/dist/tools/detect-retry-loop.js +212 -0
  314. package/dist/tools/diff-compress.d.ts +40 -0
  315. package/dist/tools/diff-compress.d.ts.map +1 -0
  316. package/dist/tools/diff-compress.js +94 -0
  317. package/dist/tools/discover-tools.d.ts +11 -0
  318. package/dist/tools/discover-tools.d.ts.map +1 -0
  319. package/dist/tools/discover-tools.js +163 -0
  320. package/dist/tools/dynamic-loader.d.ts +131 -0
  321. package/dist/tools/dynamic-loader.d.ts.map +1 -0
  322. package/dist/tools/dynamic-loader.js +378 -0
  323. package/dist/tools/dynamic-loader.test.d.ts +10 -0
  324. package/dist/tools/dynamic-loader.test.d.ts.map +1 -0
  325. package/dist/tools/dynamic-loader.test.js +164 -0
  326. package/dist/tools/lazy-mcp.d.ts +31 -0
  327. package/dist/tools/lazy-mcp.d.ts.map +1 -0
  328. package/dist/tools/lazy-mcp.js +151 -0
  329. package/dist/tools/lazy-mcp.test.d.ts +10 -0
  330. package/dist/tools/lazy-mcp.test.d.ts.map +1 -0
  331. package/dist/tools/lazy-mcp.test.js +172 -0
  332. package/dist/tools/multifile-compress.d.ts +36 -0
  333. package/dist/tools/multifile-compress.d.ts.map +1 -0
  334. package/dist/tools/multifile-compress.js +223 -0
  335. package/dist/tools/optimization-tips.d.ts +18 -0
  336. package/dist/tools/optimization-tips.d.ts.map +1 -0
  337. package/dist/tools/optimization-tips.js +133 -0
  338. package/dist/tools/registry.d.ts +70 -0
  339. package/dist/tools/registry.d.ts.map +1 -0
  340. package/dist/tools/registry.js +169 -0
  341. package/dist/tools/semantic-compress.d.ts +39 -0
  342. package/dist/tools/semantic-compress.d.ts.map +1 -0
  343. package/dist/tools/semantic-compress.js +113 -0
  344. package/dist/tools/semantic-compress.test.d.ts +5 -0
  345. package/dist/tools/semantic-compress.test.d.ts.map +1 -0
  346. package/dist/tools/semantic-compress.test.js +182 -0
  347. package/dist/tools/session-stats.d.ts +34 -0
  348. package/dist/tools/session-stats.d.ts.map +1 -0
  349. package/dist/tools/session-stats.js +194 -0
  350. package/dist/tools/set-output-config.d.ts +38 -0
  351. package/dist/tools/set-output-config.d.ts.map +1 -0
  352. package/dist/tools/set-output-config.js +122 -0
  353. package/dist/tools/smart-cache-tool.d.ts +38 -0
  354. package/dist/tools/smart-cache-tool.d.ts.map +1 -0
  355. package/dist/tools/smart-cache-tool.js +224 -0
  356. package/dist/tools/smart-file-read.d.ts +52 -0
  357. package/dist/tools/smart-file-read.d.ts.map +1 -0
  358. package/dist/tools/smart-file-read.js +481 -0
  359. package/dist/tools/smart-pipeline.d.ts +40 -0
  360. package/dist/tools/smart-pipeline.d.ts.map +1 -0
  361. package/dist/tools/smart-pipeline.js +295 -0
  362. package/dist/tools/summarize-logs.d.ts +36 -0
  363. package/dist/tools/summarize-logs.d.ts.map +1 -0
  364. package/dist/tools/summarize-logs.js +184 -0
  365. package/dist/tools/token-budget.test.d.ts +11 -0
  366. package/dist/tools/token-budget.test.d.ts.map +1 -0
  367. package/dist/tools/token-budget.test.js +275 -0
  368. package/dist/utils/bm25.d.ts +86 -0
  369. package/dist/utils/bm25.d.ts.map +1 -0
  370. package/dist/utils/bm25.js +153 -0
  371. package/dist/utils/bm25.test.d.ts +5 -0
  372. package/dist/utils/bm25.test.d.ts.map +1 -0
  373. package/dist/utils/bm25.test.js +156 -0
  374. package/dist/utils/command-normalizer.d.ts +39 -0
  375. package/dist/utils/command-normalizer.d.ts.map +1 -0
  376. package/dist/utils/command-normalizer.js +90 -0
  377. package/dist/utils/content-detector.d.ts +27 -0
  378. package/dist/utils/content-detector.d.ts.map +1 -0
  379. package/dist/utils/content-detector.js +127 -0
  380. package/dist/utils/embeddings.d.ts +54 -0
  381. package/dist/utils/embeddings.d.ts.map +1 -0
  382. package/dist/utils/embeddings.js +97 -0
  383. package/dist/utils/embeddings.test.d.ts +8 -0
  384. package/dist/utils/embeddings.test.d.ts.map +1 -0
  385. package/dist/utils/embeddings.test.js +96 -0
  386. package/dist/utils/error-normalizer.d.ts +39 -0
  387. package/dist/utils/error-normalizer.d.ts.map +1 -0
  388. package/dist/utils/error-normalizer.js +233 -0
  389. package/dist/utils/hybrid-search.d.ts +79 -0
  390. package/dist/utils/hybrid-search.d.ts.map +1 -0
  391. package/dist/utils/hybrid-search.js +146 -0
  392. package/dist/utils/hybrid-search.test.d.ts +5 -0
  393. package/dist/utils/hybrid-search.test.d.ts.map +1 -0
  394. package/dist/utils/hybrid-search.test.js +172 -0
  395. package/dist/utils/index.d.ts +13 -0
  396. package/dist/utils/index.d.ts.map +1 -0
  397. package/dist/utils/index.js +12 -0
  398. package/dist/utils/language-detector.d.ts +27 -0
  399. package/dist/utils/language-detector.d.ts.map +1 -0
  400. package/dist/utils/language-detector.js +94 -0
  401. package/dist/utils/log-parser.d.ts +46 -0
  402. package/dist/utils/log-parser.d.ts.map +1 -0
  403. package/dist/utils/log-parser.js +287 -0
  404. package/dist/utils/output-estimator.d.ts +54 -0
  405. package/dist/utils/output-estimator.d.ts.map +1 -0
  406. package/dist/utils/output-estimator.js +119 -0
  407. package/dist/utils/output-estimator.test.d.ts +5 -0
  408. package/dist/utils/output-estimator.test.d.ts.map +1 -0
  409. package/dist/utils/output-estimator.test.js +115 -0
  410. package/dist/utils/output-similarity.d.ts +48 -0
  411. package/dist/utils/output-similarity.d.ts.map +1 -0
  412. package/dist/utils/output-similarity.js +140 -0
  413. package/dist/utils/project-detector.d.ts +16 -0
  414. package/dist/utils/project-detector.d.ts.map +1 -0
  415. package/dist/utils/project-detector.js +119 -0
  416. package/dist/utils/segment-scorer.d.ts +99 -0
  417. package/dist/utils/segment-scorer.d.ts.map +1 -0
  418. package/dist/utils/segment-scorer.js +148 -0
  419. package/dist/utils/signature-grouper.d.ts +58 -0
  420. package/dist/utils/signature-grouper.d.ts.map +1 -0
  421. package/dist/utils/signature-grouper.js +185 -0
  422. package/dist/utils/tfidf.d.ts +45 -0
  423. package/dist/utils/tfidf.d.ts.map +1 -0
  424. package/dist/utils/tfidf.js +204 -0
  425. package/dist/utils/tfidf.test.d.ts +5 -0
  426. package/dist/utils/tfidf.test.d.ts.map +1 -0
  427. package/dist/utils/tfidf.test.js +115 -0
  428. package/dist/utils/token-counter.d.ts +35 -0
  429. package/dist/utils/token-counter.d.ts.map +1 -0
  430. package/dist/utils/token-counter.js +83 -0
  431. package/dist/utils/toon-serializer.d.ts +120 -0
  432. package/dist/utils/toon-serializer.d.ts.map +1 -0
  433. package/dist/utils/toon-serializer.js +472 -0
  434. package/dist/utils/toon-serializer.test.d.ts +7 -0
  435. package/dist/utils/toon-serializer.test.d.ts.map +1 -0
  436. package/dist/utils/toon-serializer.test.js +290 -0
  437. package/package.json +63 -0
  438. package/scripts/install.ps1 +133 -0
  439. package/scripts/install.sh +183 -0
  440. package/scripts/pre-commit-hook.sh +86 -0
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Semantic Compress Tool Tests
3
+ */
4
+ import { describe, it, expect } from "vitest";
5
+ import { executeSemanticCompress } from "./semantic-compress.js";
6
+ describe("semantic_compress tool", () => {
7
+ describe("basic compression", () => {
8
+ it("should compress content to approximately target ratio", async () => {
9
+ const content = `
10
+ This is the introduction paragraph which contains important context.
11
+
12
+ This is some middle content that provides additional details.
13
+ More middle content here with less critical information.
14
+ Even more content in the middle section that can be removed.
15
+
16
+ Additional filler content that doesn't add much value.
17
+ This paragraph exists mainly to pad the document length.
18
+
19
+ This is the conclusion which summarizes the key points.
20
+ `.trim();
21
+ const result = await executeSemanticCompress({ content, targetRatio: 0.5 });
22
+ expect(result.isError).toBeFalsy();
23
+ // Should contain minimal header with stats
24
+ const text = result.content[0].text;
25
+ expect(text).toContain("[semantic]");
26
+ });
27
+ it("should preserve patterns when specified", async () => {
28
+ const content = `
29
+ Regular content here that can be removed.
30
+
31
+ CRITICAL: This must be preserved at all costs.
32
+
33
+ More regular content that is less important.
34
+ Even more filler content here.
35
+ `.trim();
36
+ const result = await executeSemanticCompress({
37
+ content,
38
+ targetRatio: 0.3,
39
+ preservePatterns: ["CRITICAL:.*"],
40
+ });
41
+ expect(result.isError).toBeFalsy();
42
+ expect(result.content[0].text).toContain("CRITICAL:");
43
+ });
44
+ it("should prioritize error messages", async () => {
45
+ const content = `
46
+ Info: Starting the process now.
47
+
48
+ Debug: Loading configuration files.
49
+
50
+ Error: Failed to connect to database server.
51
+
52
+ Info: Retrying connection attempt.
53
+
54
+ Debug: More debug information here.
55
+ `.trim();
56
+ const result = await executeSemanticCompress({ content, targetRatio: 0.4 });
57
+ expect(result.isError).toBeFalsy();
58
+ expect(result.content[0].text).toContain("Error:");
59
+ });
60
+ });
61
+ describe("code block handling", () => {
62
+ it("should keep code blocks as single units", async () => {
63
+ const content = `
64
+ Here is some introductory text.
65
+
66
+ \`\`\`typescript
67
+ function hello() {
68
+ return "world";
69
+ }
70
+ \`\`\`
71
+
72
+ And some concluding text here.
73
+ `.trim();
74
+ const result = await executeSemanticCompress({ content, targetRatio: 0.8 });
75
+ expect(result.isError).toBeFalsy();
76
+ const text = result.content[0].text;
77
+ // If code block is included, it should be complete
78
+ if (text.includes("function hello")) {
79
+ expect(text).toContain('return "world"');
80
+ expect(text).toContain("```");
81
+ }
82
+ });
83
+ });
84
+ describe("input validation", () => {
85
+ it("should reject empty content", async () => {
86
+ const result = await executeSemanticCompress({ content: "" });
87
+ expect(result.isError).toBe(true);
88
+ expect(result.content[0].text).toContain("Invalid input");
89
+ });
90
+ it("should reject invalid regex patterns", async () => {
91
+ const result = await executeSemanticCompress({
92
+ content: "test content here",
93
+ preservePatterns: ["[invalid"],
94
+ });
95
+ expect(result.isError).toBe(true);
96
+ expect(result.content[0].text).toContain("Invalid regex");
97
+ });
98
+ it("should reject targetRatio below minimum", async () => {
99
+ const result = await executeSemanticCompress({
100
+ content: "test content",
101
+ targetRatio: 0.05,
102
+ });
103
+ expect(result.isError).toBe(true);
104
+ });
105
+ it("should reject targetRatio above maximum", async () => {
106
+ const result = await executeSemanticCompress({
107
+ content: "test content",
108
+ targetRatio: 0.95,
109
+ });
110
+ expect(result.isError).toBe(true);
111
+ });
112
+ });
113
+ describe("edge cases", () => {
114
+ it("should handle content shorter than target gracefully", async () => {
115
+ const result = await executeSemanticCompress({
116
+ content: "Short content",
117
+ targetRatio: 0.5,
118
+ });
119
+ // Should not error, just return content as-is
120
+ expect(result.isError).toBeFalsy();
121
+ });
122
+ it("should handle single paragraph content", async () => {
123
+ const result = await executeSemanticCompress({
124
+ content: "This is a single paragraph without any breaks or structure.",
125
+ targetRatio: 0.5,
126
+ });
127
+ expect(result.isError).toBeFalsy();
128
+ });
129
+ it("should handle content with only code blocks", async () => {
130
+ const content = `
131
+ \`\`\`javascript
132
+ const x = 1;
133
+ const y = 2;
134
+ console.log(x + y);
135
+ \`\`\`
136
+ `.trim();
137
+ const result = await executeSemanticCompress({ content, targetRatio: 0.5 });
138
+ expect(result.isError).toBeFalsy();
139
+ });
140
+ it("should use default targetRatio of 0.5", async () => {
141
+ const content = Array(20).fill("Content paragraph here.").join("\n\n");
142
+ const result = await executeSemanticCompress({ content });
143
+ expect(result.isError).toBeFalsy();
144
+ // Output should show compression occurred (minimal header format)
145
+ expect(result.content[0].text).toContain("[semantic]");
146
+ expect(result.content[0].text).toContain("tokens");
147
+ });
148
+ });
149
+ describe("output format", () => {
150
+ it("should include compression statistics in minimal header", async () => {
151
+ const content = Array(10).fill("Paragraph of content here.").join("\n\n");
152
+ const result = await executeSemanticCompress({ content, targetRatio: 0.5 });
153
+ const text = result.content[0].text;
154
+ // Minimal header format: [semantic] X→Y tokens (-Z%)
155
+ expect(text).toMatch(/\[semantic\] \d+→\d+ tokens \(-\d+%\)/);
156
+ });
157
+ it("should show preserved segments when patterns match", async () => {
158
+ // Need enough content for compression to actually occur
159
+ const content = `
160
+ Normal content here that will be evaluated for compression.
161
+
162
+ IMPORTANT: This is preserved and must remain in the output.
163
+
164
+ More normal content that provides additional context.
165
+
166
+ Additional filler content that adds to the document length.
167
+
168
+ Even more content here to ensure we have enough for compression.
169
+
170
+ Final paragraph with some concluding thoughts about the topic.
171
+ `.trim();
172
+ const result = await executeSemanticCompress({
173
+ content,
174
+ targetRatio: 0.5,
175
+ preservePatterns: ["IMPORTANT:.*"],
176
+ });
177
+ const text = result.content[0].text;
178
+ // The preserved content should definitely be in the output
179
+ expect(text).toContain("IMPORTANT:");
180
+ });
181
+ });
182
+ });
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Session Stats Tool
3
+ *
4
+ * Provides session-wide statistics including:
5
+ * - Total tokens saved
6
+ * - Per-tool usage breakdown
7
+ * - Estimated cost reduction
8
+ * - Session duration and activity
9
+ */
10
+ import type { ToolDefinition } from "./registry.js";
11
+ export declare const sessionStatsSchema: {
12
+ type: "object";
13
+ properties: {
14
+ action: {
15
+ type: string;
16
+ enum: string[];
17
+ description: string;
18
+ };
19
+ format: {
20
+ type: string;
21
+ enum: string[];
22
+ description: string;
23
+ };
24
+ };
25
+ required: never[];
26
+ };
27
+ export declare function executeSessionStats(args: unknown): Promise<{
28
+ content: Array<{
29
+ type: "text";
30
+ text: string;
31
+ }>;
32
+ }>;
33
+ export declare const sessionStatsTool: ToolDefinition;
34
+ //# sourceMappingURL=session-stats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-stats.d.ts","sourceRoot":"","sources":["../../src/tools/session-stats.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAapD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;CAe9B,CAAC;AA4KF,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA0B7D;AAED,eAAO,MAAM,gBAAgB,EAAE,cAM9B,CAAC"}
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Session Stats Tool
3
+ *
4
+ * Provides session-wide statistics including:
5
+ * - Total tokens saved
6
+ * - Per-tool usage breakdown
7
+ * - Estimated cost reduction
8
+ * - Session duration and activity
9
+ */
10
+ import { z } from "zod";
11
+ import { getSessionTracker, resetSessionTracker, } from "../analytics/session-tracker.js";
12
+ // Anthropic pricing (per 1M tokens) - Claude 3.5 Sonnet
13
+ const ANTHROPIC_PRICING = {
14
+ input: 3.0, // $3 per 1M input tokens
15
+ output: 15.0, // $15 per 1M output tokens
16
+ };
17
+ export const sessionStatsSchema = {
18
+ type: "object",
19
+ properties: {
20
+ action: {
21
+ type: "string",
22
+ enum: ["get", "reset", "export"],
23
+ description: "Action to perform: get stats, reset session, or export JSON",
24
+ },
25
+ format: {
26
+ type: "string",
27
+ enum: ["summary", "detailed", "json"],
28
+ description: "Output format (default: summary)",
29
+ },
30
+ },
31
+ required: [],
32
+ };
33
+ const inputSchema = z.object({
34
+ action: z.enum(["get", "reset", "export"]).optional().default("get"),
35
+ format: z.enum(["summary", "detailed", "json"]).optional().default("summary"),
36
+ });
37
+ /**
38
+ * Format duration in human-readable format
39
+ */
40
+ function formatDuration(ms) {
41
+ const seconds = Math.floor(ms / 1000);
42
+ const minutes = Math.floor(seconds / 60);
43
+ const hours = Math.floor(minutes / 60);
44
+ if (hours > 0) {
45
+ return `${hours}h ${minutes % 60}m`;
46
+ }
47
+ if (minutes > 0) {
48
+ return `${minutes}m ${seconds % 60}s`;
49
+ }
50
+ return `${seconds}s`;
51
+ }
52
+ /**
53
+ * Calculate cost reduction based on tokens saved
54
+ */
55
+ function calculateCostReduction(tokensSaved) {
56
+ // Assume saved tokens would have been input tokens
57
+ return (tokensSaved / 1_000_000) * ANTHROPIC_PRICING.input;
58
+ }
59
+ /**
60
+ * Format summary output
61
+ */
62
+ function formatSummary(stats) {
63
+ const durationMs = Date.now() - stats.startTime.getTime();
64
+ const optimizationRate = stats.totalTokensIn > 0
65
+ ? ((stats.totalTokensSaved / stats.totalTokensIn) * 100).toFixed(1)
66
+ : "0";
67
+ const costSaved = calculateCostReduction(stats.totalTokensSaved);
68
+ const parts = [];
69
+ parts.push("## Session Statistics\n");
70
+ // Overview table
71
+ parts.push("### Overview\n");
72
+ parts.push("| Metric | Value |");
73
+ parts.push("|--------|-------|");
74
+ parts.push(`| Session Duration | ${formatDuration(durationMs)} |`);
75
+ parts.push(`| Total Tool Calls | ${stats.totalInvocations} |`);
76
+ parts.push(`| Tokens Processed | ${stats.totalTokensIn.toLocaleString()} |`);
77
+ parts.push(`| Tokens Saved | ${stats.totalTokensSaved.toLocaleString()} |`);
78
+ parts.push(`| Optimization Rate | ${optimizationRate}% |`);
79
+ parts.push(`| Est. Cost Saved | $${costSaved.toFixed(4)} |`);
80
+ if (stats.totalErrors > 0) {
81
+ parts.push(`| Errors | ${stats.totalErrors} |`);
82
+ }
83
+ // Top tools
84
+ const toolEntries = Object.entries(stats.toolStats)
85
+ .sort((a, b) => b[1].tokensSaved - a[1].tokensSaved)
86
+ .slice(0, 5);
87
+ if (toolEntries.length > 0) {
88
+ parts.push("\n### Top Tools by Savings\n");
89
+ parts.push("| Tool | Calls | Saved |");
90
+ parts.push("|------|-------|-------|");
91
+ for (const [name, toolStats] of toolEntries) {
92
+ parts.push(`| ${name} | ${toolStats.invocations} | ${toolStats.tokensSaved.toLocaleString()} |`);
93
+ }
94
+ }
95
+ return parts.join("\n");
96
+ }
97
+ /**
98
+ * Format detailed output
99
+ */
100
+ function formatDetailed(stats) {
101
+ const durationMs = Date.now() - stats.startTime.getTime();
102
+ const optimizationRate = stats.totalTokensIn > 0
103
+ ? ((stats.totalTokensSaved / stats.totalTokensIn) * 100).toFixed(1)
104
+ : "0";
105
+ const costSaved = calculateCostReduction(stats.totalTokensSaved);
106
+ const parts = [];
107
+ parts.push("## Session Statistics (Detailed)\n");
108
+ // Session info
109
+ parts.push("### Session Info\n");
110
+ parts.push(`- **Started**: ${stats.startTime.toISOString()}`);
111
+ parts.push(`- **Duration**: ${formatDuration(durationMs)}`);
112
+ parts.push(`- **Last Activity**: ${stats.lastActivityTime.toISOString()}`);
113
+ // Token metrics
114
+ parts.push("\n### Token Metrics\n");
115
+ parts.push("| Metric | Value |");
116
+ parts.push("|--------|-------|");
117
+ parts.push(`| Tokens In | ${stats.totalTokensIn.toLocaleString()} |`);
118
+ parts.push(`| Tokens Out | ${stats.totalTokensOut.toLocaleString()} |`);
119
+ parts.push(`| Tokens Saved | ${stats.totalTokensSaved.toLocaleString()} |`);
120
+ parts.push(`| Optimization Rate | ${optimizationRate}% |`);
121
+ parts.push(`| Est. Cost Saved | $${costSaved.toFixed(4)} |`);
122
+ // All tools breakdown
123
+ const toolEntries = Object.entries(stats.toolStats).sort((a, b) => b[1].invocations - a[1].invocations);
124
+ if (toolEntries.length > 0) {
125
+ parts.push("\n### Tool Breakdown\n");
126
+ parts.push("| Tool | Calls | In | Out | Saved | Avg Time |");
127
+ parts.push("|------|-------|-----|-----|-------|----------|");
128
+ for (const [name, toolStats] of toolEntries) {
129
+ const avgTime = toolStats.invocations > 0
130
+ ? Math.round(toolStats.totalDurationMs / toolStats.invocations)
131
+ : 0;
132
+ parts.push(`| ${name} | ${toolStats.invocations} | ${toolStats.tokensIn.toLocaleString()} | ${toolStats.tokensOut.toLocaleString()} | ${toolStats.tokensSaved.toLocaleString()} | ${avgTime}ms |`);
133
+ }
134
+ }
135
+ // Error summary
136
+ if (stats.totalErrors > 0) {
137
+ parts.push(`\n### Errors: ${stats.totalErrors} total`);
138
+ }
139
+ return parts.join("\n");
140
+ }
141
+ /**
142
+ * Format JSON export
143
+ */
144
+ function formatJson(stats) {
145
+ const durationMs = Date.now() - stats.startTime.getTime();
146
+ const optimizationRate = stats.totalTokensIn > 0 ? stats.totalTokensSaved / stats.totalTokensIn : 0;
147
+ return JSON.stringify({
148
+ session: {
149
+ startTime: stats.startTime.toISOString(),
150
+ lastActivityTime: stats.lastActivityTime.toISOString(),
151
+ durationMs,
152
+ },
153
+ totals: {
154
+ invocations: stats.totalInvocations,
155
+ tokensIn: stats.totalTokensIn,
156
+ tokensOut: stats.totalTokensOut,
157
+ tokensSaved: stats.totalTokensSaved,
158
+ optimizationRate: Math.round(optimizationRate * 1000) / 10, // percentage with 1 decimal
159
+ estimatedCostSavedUsd: calculateCostReduction(stats.totalTokensSaved),
160
+ errors: stats.totalErrors,
161
+ },
162
+ tools: stats.toolStats,
163
+ }, null, 2);
164
+ }
165
+ export async function executeSessionStats(args) {
166
+ const { action, format } = inputSchema.parse(args);
167
+ if (action === "reset") {
168
+ resetSessionTracker();
169
+ return {
170
+ content: [{ type: "text", text: "Session statistics have been reset." }],
171
+ };
172
+ }
173
+ const tracker = getSessionTracker();
174
+ const stats = tracker.getStats();
175
+ let output;
176
+ if (action === "export" || format === "json") {
177
+ output = formatJson(stats);
178
+ }
179
+ else if (format === "detailed") {
180
+ output = formatDetailed(stats);
181
+ }
182
+ else {
183
+ output = formatSummary(stats);
184
+ }
185
+ return {
186
+ content: [{ type: "text", text: output }],
187
+ };
188
+ }
189
+ export const sessionStatsTool = {
190
+ name: "session_stats",
191
+ description: "Get session-wide statistics including tokens saved, cost reduction, and per-tool usage breakdown. Use action='reset' to start fresh or action='export' for JSON output.",
192
+ inputSchema: sessionStatsSchema,
193
+ execute: executeSessionStats,
194
+ };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Set Output Config Tool
3
+ *
4
+ * Configure global output format and verbosity settings.
5
+ * Affects all tool outputs in the session.
6
+ */
7
+ import type { ToolDefinition } from "./registry.js";
8
+ export declare const setOutputConfigSchema: {
9
+ type: "object";
10
+ properties: {
11
+ action: {
12
+ type: string;
13
+ enum: string[];
14
+ description: string;
15
+ };
16
+ verbosity: {
17
+ type: string;
18
+ enum: string[];
19
+ description: string;
20
+ };
21
+ mode: {
22
+ type: string;
23
+ enum: string[];
24
+ description: string;
25
+ };
26
+ useToon: {
27
+ type: string;
28
+ description: string;
29
+ };
30
+ includeStats: {
31
+ type: string;
32
+ description: string;
33
+ };
34
+ };
35
+ required: never[];
36
+ };
37
+ export declare const setOutputConfigTool: ToolDefinition;
38
+ //# sourceMappingURL=set-output-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-output-config.d.ts","sourceRoot":"","sources":["../../src/tools/set-output-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAUpD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BjC,CAAC;AAgGF,eAAO,MAAM,mBAAmB,EAAE,cAMjC,CAAC"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Set Output Config Tool
3
+ *
4
+ * Configure global output format and verbosity settings.
5
+ * Affects all tool outputs in the session.
6
+ */
7
+ import { z } from "zod";
8
+ import { getOutputConfig, setOutputConfig, resetOutputConfig, } from "../config/output-config.js";
9
+ export const setOutputConfigSchema = {
10
+ type: "object",
11
+ properties: {
12
+ action: {
13
+ type: "string",
14
+ enum: ["get", "set", "reset"],
15
+ description: "Action: get current config, set new values, or reset to defaults",
16
+ },
17
+ verbosity: {
18
+ type: "string",
19
+ enum: ["minimal", "normal", "detailed"],
20
+ description: "Verbosity level for output",
21
+ },
22
+ mode: {
23
+ type: "string",
24
+ enum: ["structured", "prose", "toon"],
25
+ description: "Output format mode",
26
+ },
27
+ useToon: {
28
+ type: "boolean",
29
+ description: "Use TOON format when applicable",
30
+ },
31
+ includeStats: {
32
+ type: "boolean",
33
+ description: "Include statistics in output",
34
+ },
35
+ },
36
+ required: [],
37
+ };
38
+ const inputSchema = z.object({
39
+ action: z.enum(["get", "set", "reset"]).optional().default("set"),
40
+ verbosity: z.enum(["minimal", "normal", "detailed"]).optional(),
41
+ mode: z.enum(["structured", "prose", "toon"]).optional(),
42
+ useToon: z.boolean().optional(),
43
+ includeStats: z.boolean().optional(),
44
+ });
45
+ /**
46
+ * Format config for display
47
+ */
48
+ function formatConfig(config) {
49
+ const lines = [];
50
+ lines.push("[Output Config]");
51
+ lines.push(`verbosity: ${config.verbosity}`);
52
+ lines.push(`mode: ${config.mode}`);
53
+ lines.push(`useToon: ${config.useToon}`);
54
+ lines.push(`includeStats: ${config.includeStats}`);
55
+ return lines.join("\n");
56
+ }
57
+ /**
58
+ * Execute output config tool
59
+ */
60
+ async function executeSetOutputConfig(args) {
61
+ const input = inputSchema.parse(args);
62
+ switch (input.action) {
63
+ case "get": {
64
+ const config = getOutputConfig();
65
+ return {
66
+ content: [{ type: "text", text: formatConfig(config) }],
67
+ };
68
+ }
69
+ case "reset": {
70
+ resetOutputConfig();
71
+ const config = getOutputConfig();
72
+ return {
73
+ content: [
74
+ {
75
+ type: "text",
76
+ text: `Output config reset to defaults.\n\n${formatConfig(config)}`,
77
+ },
78
+ ],
79
+ };
80
+ }
81
+ case "set":
82
+ default: {
83
+ // Build update object from provided values
84
+ const update = {};
85
+ if (input.verbosity !== undefined) {
86
+ update.verbosity = input.verbosity;
87
+ }
88
+ if (input.mode !== undefined) {
89
+ update.mode = input.mode;
90
+ }
91
+ if (input.useToon !== undefined) {
92
+ update.useToon = input.useToon;
93
+ }
94
+ if (input.includeStats !== undefined) {
95
+ update.includeStats = input.includeStats;
96
+ }
97
+ // Apply updates if any
98
+ if (Object.keys(update).length > 0) {
99
+ setOutputConfig(update);
100
+ }
101
+ const config = getOutputConfig();
102
+ const changedFields = Object.keys(update);
103
+ const changeMsg = changedFields.length > 0
104
+ ? `Updated: ${changedFields.join(", ")}`
105
+ : "No changes (provide verbosity, mode, useToon, or includeStats)";
106
+ return {
107
+ content: [
108
+ {
109
+ type: "text",
110
+ text: `${changeMsg}\n\n${formatConfig(config)}`,
111
+ },
112
+ ],
113
+ };
114
+ }
115
+ }
116
+ }
117
+ export const setOutputConfigTool = {
118
+ name: "set_output_config",
119
+ description: "Configure global output format. Set verbosity (minimal/normal/detailed), mode (structured/prose/toon), and stats inclusion.",
120
+ inputSchema: setOutputConfigSchema,
121
+ execute: executeSetOutputConfig,
122
+ };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Smart Cache MCP Tool
3
+ *
4
+ * Exposes cache operations for user interaction:
5
+ * - get: Retrieve cached content
6
+ * - set: Store content in cache
7
+ * - invalidate: Remove specific entries
8
+ * - stats: View cache statistics
9
+ * - clear: Clear all cache entries
10
+ */
11
+ import type { ToolDefinition } from "./registry.js";
12
+ export declare const smartCacheSchema: {
13
+ type: "object";
14
+ properties: {
15
+ action: {
16
+ enum: string[];
17
+ };
18
+ key: {
19
+ type: string;
20
+ };
21
+ value: {
22
+ type: string;
23
+ };
24
+ filePath: {
25
+ type: string;
26
+ };
27
+ };
28
+ required: string[];
29
+ };
30
+ export declare function executeSmartCache(args: unknown): Promise<{
31
+ content: Array<{
32
+ type: "text";
33
+ text: string;
34
+ }>;
35
+ isError?: boolean;
36
+ }>;
37
+ export declare const smartCacheTool: ToolDefinition;
38
+ //# sourceMappingURL=smart-cache-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-cache-tool.d.ts","sourceRoot":"","sources":["../../src/tools/smart-cache-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIpD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;CAS5B,CAAC;AAyCF,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAmKhF;AAED,eAAO,MAAM,cAAc,EAAE,cAK5B,CAAC"}