attocode 0.2.4 → 0.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 (577) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/dist/src/adapters.d.ts +2 -1
  3. package/dist/src/adapters.d.ts.map +1 -1
  4. package/dist/src/adapters.js +60 -2
  5. package/dist/src/adapters.js.map +1 -1
  6. package/dist/src/agent/agent-builder.d.ts +117 -0
  7. package/dist/src/agent/agent-builder.d.ts.map +1 -0
  8. package/dist/src/agent/agent-builder.js +204 -0
  9. package/dist/src/agent/agent-builder.js.map +1 -0
  10. package/dist/src/agent/feature-initializer.d.ts +80 -0
  11. package/dist/src/agent/feature-initializer.d.ts.map +1 -0
  12. package/dist/src/agent/feature-initializer.js +677 -0
  13. package/dist/src/agent/feature-initializer.js.map +1 -0
  14. package/dist/src/agent/index.d.ts +13 -0
  15. package/dist/src/agent/index.d.ts.map +1 -0
  16. package/dist/src/agent/index.js +13 -0
  17. package/dist/src/agent/index.js.map +1 -0
  18. package/dist/src/agent/message-builder.d.ts +50 -0
  19. package/dist/src/agent/message-builder.d.ts.map +1 -0
  20. package/dist/src/agent/message-builder.js +173 -0
  21. package/dist/src/agent/message-builder.js.map +1 -0
  22. package/dist/src/agent/session-api.d.ts +94 -0
  23. package/dist/src/agent/session-api.d.ts.map +1 -0
  24. package/dist/src/agent/session-api.js +262 -0
  25. package/dist/src/agent/session-api.js.map +1 -0
  26. package/dist/src/agent-tools/lsp-file-tools.d.ts +1 -1
  27. package/dist/src/agent-tools/lsp-file-tools.d.ts.map +1 -1
  28. package/dist/src/agent.d.ts +14 -115
  29. package/dist/src/agent.d.ts.map +1 -1
  30. package/dist/src/agent.js +36 -1177
  31. package/dist/src/agent.js.map +1 -1
  32. package/dist/src/cli.js +1 -1
  33. package/dist/src/cli.js.map +1 -1
  34. package/dist/src/commands/handler.d.ts.map +1 -1
  35. package/dist/src/commands/handler.js +8 -7
  36. package/dist/src/commands/handler.js.map +1 -1
  37. package/dist/src/commands/init.js +1 -1
  38. package/dist/src/commands/init.js.map +1 -1
  39. package/dist/src/config/schema.d.ts +6 -6
  40. package/dist/src/core/execution-loop.d.ts.map +1 -1
  41. package/dist/src/core/execution-loop.js +155 -16
  42. package/dist/src/core/execution-loop.js.map +1 -1
  43. package/dist/src/core/response-handler.d.ts.map +1 -1
  44. package/dist/src/core/response-handler.js +3 -2
  45. package/dist/src/core/response-handler.js.map +1 -1
  46. package/dist/src/core/subagent-spawner.d.ts.map +1 -1
  47. package/dist/src/core/subagent-spawner.js +13 -6
  48. package/dist/src/core/subagent-spawner.js.map +1 -1
  49. package/dist/src/core/tool-executor.d.ts.map +1 -1
  50. package/dist/src/core/tool-executor.js +7 -2
  51. package/dist/src/core/tool-executor.js.map +1 -1
  52. package/dist/src/core/types.d.ts +1 -0
  53. package/dist/src/core/types.d.ts.map +1 -1
  54. package/dist/src/core/types.js.map +1 -1
  55. package/dist/src/integrations/agents/agent-registry.d.ts +262 -0
  56. package/dist/src/integrations/agents/agent-registry.d.ts.map +1 -0
  57. package/dist/src/integrations/agents/agent-registry.js +686 -0
  58. package/dist/src/integrations/agents/agent-registry.js.map +1 -0
  59. package/dist/src/integrations/agents/async-subagent.d.ts +135 -0
  60. package/dist/src/integrations/agents/async-subagent.d.ts.map +1 -0
  61. package/dist/src/integrations/agents/async-subagent.js +213 -0
  62. package/dist/src/integrations/agents/async-subagent.js.map +1 -0
  63. package/dist/src/integrations/agents/complexity-classifier.d.ts +86 -0
  64. package/dist/src/integrations/agents/complexity-classifier.d.ts.map +1 -0
  65. package/dist/src/integrations/agents/complexity-classifier.js +233 -0
  66. package/dist/src/integrations/agents/complexity-classifier.js.map +1 -0
  67. package/dist/src/integrations/agents/delegation-protocol.d.ts +86 -0
  68. package/dist/src/integrations/agents/delegation-protocol.d.ts.map +1 -0
  69. package/dist/src/integrations/agents/delegation-protocol.js +127 -0
  70. package/dist/src/integrations/agents/delegation-protocol.js.map +1 -0
  71. package/dist/src/integrations/agents/multi-agent.d.ts +150 -0
  72. package/dist/src/integrations/agents/multi-agent.d.ts.map +1 -0
  73. package/dist/src/integrations/agents/multi-agent.js +306 -0
  74. package/dist/src/integrations/agents/multi-agent.js.map +1 -0
  75. package/dist/src/integrations/agents/result-synthesizer.d.ts +389 -0
  76. package/dist/src/integrations/agents/result-synthesizer.d.ts.map +1 -0
  77. package/dist/src/integrations/agents/result-synthesizer.js +951 -0
  78. package/dist/src/integrations/agents/result-synthesizer.js.map +1 -0
  79. package/dist/src/integrations/agents/shared-blackboard.d.ts +406 -0
  80. package/dist/src/integrations/agents/shared-blackboard.d.ts.map +1 -0
  81. package/dist/src/integrations/agents/shared-blackboard.js +757 -0
  82. package/dist/src/integrations/agents/shared-blackboard.js.map +1 -0
  83. package/dist/src/integrations/agents/subagent-output-store.d.ts +91 -0
  84. package/dist/src/integrations/agents/subagent-output-store.d.ts.map +1 -0
  85. package/dist/src/integrations/agents/subagent-output-store.js +257 -0
  86. package/dist/src/integrations/agents/subagent-output-store.js.map +1 -0
  87. package/dist/src/integrations/budget/budget-pool.d.ts +115 -0
  88. package/dist/src/integrations/budget/budget-pool.d.ts.map +1 -0
  89. package/dist/src/integrations/budget/budget-pool.js +205 -0
  90. package/dist/src/integrations/budget/budget-pool.js.map +1 -0
  91. package/dist/src/integrations/budget/cancellation.d.ts +229 -0
  92. package/dist/src/integrations/budget/cancellation.d.ts.map +1 -0
  93. package/dist/src/integrations/budget/cancellation.js +520 -0
  94. package/dist/src/integrations/budget/cancellation.js.map +1 -0
  95. package/dist/src/integrations/budget/dynamic-budget.d.ts +81 -0
  96. package/dist/src/integrations/budget/dynamic-budget.d.ts.map +1 -0
  97. package/dist/src/integrations/budget/dynamic-budget.js +151 -0
  98. package/dist/src/integrations/budget/dynamic-budget.js.map +1 -0
  99. package/dist/src/integrations/budget/economics.d.ts +435 -0
  100. package/dist/src/integrations/budget/economics.d.ts.map +1 -0
  101. package/dist/src/integrations/budget/economics.js +1007 -0
  102. package/dist/src/integrations/budget/economics.js.map +1 -0
  103. package/dist/src/integrations/budget/injection-budget.d.ts +71 -0
  104. package/dist/src/integrations/budget/injection-budget.d.ts.map +1 -0
  105. package/dist/src/integrations/budget/injection-budget.js +137 -0
  106. package/dist/src/integrations/budget/injection-budget.js.map +1 -0
  107. package/dist/src/integrations/budget/loop-detector.d.ts +105 -0
  108. package/dist/src/integrations/budget/loop-detector.d.ts.map +1 -0
  109. package/dist/src/integrations/budget/loop-detector.js +287 -0
  110. package/dist/src/integrations/budget/loop-detector.js.map +1 -0
  111. package/dist/src/integrations/budget/phase-tracker.d.ts +114 -0
  112. package/dist/src/integrations/budget/phase-tracker.d.ts.map +1 -0
  113. package/dist/src/integrations/budget/phase-tracker.js +262 -0
  114. package/dist/src/integrations/budget/phase-tracker.js.map +1 -0
  115. package/dist/src/integrations/budget/resources.d.ts +182 -0
  116. package/dist/src/integrations/budget/resources.d.ts.map +1 -0
  117. package/dist/src/integrations/budget/resources.js +318 -0
  118. package/dist/src/integrations/budget/resources.js.map +1 -0
  119. package/dist/src/integrations/context/auto-compaction.d.ts +210 -0
  120. package/dist/src/integrations/context/auto-compaction.d.ts.map +1 -0
  121. package/dist/src/integrations/context/auto-compaction.js +477 -0
  122. package/dist/src/integrations/context/auto-compaction.js.map +1 -0
  123. package/dist/src/integrations/context/code-analyzer.d.ts +71 -0
  124. package/dist/src/integrations/context/code-analyzer.d.ts.map +1 -0
  125. package/dist/src/integrations/context/code-analyzer.js +448 -0
  126. package/dist/src/integrations/context/code-analyzer.js.map +1 -0
  127. package/dist/src/integrations/context/code-selector.d.ts +78 -0
  128. package/dist/src/integrations/context/code-selector.d.ts.map +1 -0
  129. package/dist/src/integrations/context/code-selector.js +649 -0
  130. package/dist/src/integrations/context/code-selector.js.map +1 -0
  131. package/dist/src/integrations/context/codebase-ast.d.ts +138 -0
  132. package/dist/src/integrations/context/codebase-ast.d.ts.map +1 -0
  133. package/dist/src/integrations/context/codebase-ast.js +818 -0
  134. package/dist/src/integrations/context/codebase-ast.js.map +1 -0
  135. package/dist/src/integrations/context/codebase-context.d.ts +473 -0
  136. package/dist/src/integrations/context/codebase-context.d.ts.map +1 -0
  137. package/dist/src/integrations/context/codebase-context.js +685 -0
  138. package/dist/src/integrations/context/codebase-context.js.map +1 -0
  139. package/dist/src/integrations/context/compaction.d.ts +191 -0
  140. package/dist/src/integrations/context/compaction.d.ts.map +1 -0
  141. package/dist/src/integrations/context/compaction.js +384 -0
  142. package/dist/src/integrations/context/compaction.js.map +1 -0
  143. package/dist/src/integrations/context/context-engineering.d.ts +274 -0
  144. package/dist/src/integrations/context/context-engineering.d.ts.map +1 -0
  145. package/dist/src/integrations/context/context-engineering.js +437 -0
  146. package/dist/src/integrations/context/context-engineering.js.map +1 -0
  147. package/dist/src/integrations/context/file-cache.d.ts +97 -0
  148. package/dist/src/integrations/context/file-cache.d.ts.map +1 -0
  149. package/dist/src/integrations/context/file-cache.js +218 -0
  150. package/dist/src/integrations/context/file-cache.js.map +1 -0
  151. package/dist/src/integrations/context/semantic-cache.d.ts +178 -0
  152. package/dist/src/integrations/context/semantic-cache.d.ts.map +1 -0
  153. package/dist/src/integrations/context/semantic-cache.js +372 -0
  154. package/dist/src/integrations/context/semantic-cache.js.map +1 -0
  155. package/dist/src/integrations/index.d.ts +72 -68
  156. package/dist/src/integrations/index.d.ts.map +1 -1
  157. package/dist/src/integrations/index.js +76 -68
  158. package/dist/src/integrations/index.js.map +1 -1
  159. package/dist/src/integrations/lsp/lsp.d.ts +196 -0
  160. package/dist/src/integrations/lsp/lsp.d.ts.map +1 -0
  161. package/dist/src/integrations/lsp/lsp.js +583 -0
  162. package/dist/src/integrations/lsp/lsp.js.map +1 -0
  163. package/dist/src/integrations/mcp/mcp-client.d.ts +279 -0
  164. package/dist/src/integrations/mcp/mcp-client.d.ts.map +1 -0
  165. package/dist/src/integrations/mcp/mcp-client.js +755 -0
  166. package/dist/src/integrations/mcp/mcp-client.js.map +1 -0
  167. package/dist/src/integrations/mcp/mcp-custom-tools.d.ts +102 -0
  168. package/dist/src/integrations/mcp/mcp-custom-tools.d.ts.map +1 -0
  169. package/dist/src/integrations/mcp/mcp-custom-tools.js +232 -0
  170. package/dist/src/integrations/mcp/mcp-custom-tools.js.map +1 -0
  171. package/dist/src/integrations/mcp/mcp-tool-search.d.ts +77 -0
  172. package/dist/src/integrations/mcp/mcp-tool-search.d.ts.map +1 -0
  173. package/dist/src/integrations/mcp/mcp-tool-search.js +220 -0
  174. package/dist/src/integrations/mcp/mcp-tool-search.js.map +1 -0
  175. package/dist/src/integrations/mcp/mcp-tool-validator.d.ts +60 -0
  176. package/dist/src/integrations/mcp/mcp-tool-validator.d.ts.map +1 -0
  177. package/dist/src/integrations/mcp/mcp-tool-validator.js +141 -0
  178. package/dist/src/integrations/mcp/mcp-tool-validator.js.map +1 -0
  179. package/dist/src/integrations/persistence/codebase-repository.d.ts +45 -0
  180. package/dist/src/integrations/persistence/codebase-repository.d.ts.map +1 -0
  181. package/dist/src/integrations/persistence/codebase-repository.js +81 -0
  182. package/dist/src/integrations/persistence/codebase-repository.js.map +1 -0
  183. package/dist/src/integrations/persistence/goal-repository.d.ts +71 -0
  184. package/dist/src/integrations/persistence/goal-repository.d.ts.map +1 -0
  185. package/dist/src/integrations/persistence/goal-repository.js +184 -0
  186. package/dist/src/integrations/persistence/goal-repository.js.map +1 -0
  187. package/dist/src/integrations/persistence/history.d.ts +72 -0
  188. package/dist/src/integrations/persistence/history.d.ts.map +1 -0
  189. package/dist/src/integrations/persistence/history.js +165 -0
  190. package/dist/src/integrations/persistence/history.js.map +1 -0
  191. package/dist/src/integrations/persistence/persistence.d.ts +49 -0
  192. package/dist/src/integrations/persistence/persistence.d.ts.map +1 -0
  193. package/dist/src/integrations/persistence/persistence.js +197 -0
  194. package/dist/src/integrations/persistence/persistence.js.map +1 -0
  195. package/dist/src/integrations/persistence/session-repository.d.ts +212 -0
  196. package/dist/src/integrations/persistence/session-repository.d.ts.map +1 -0
  197. package/dist/src/integrations/persistence/session-repository.js +770 -0
  198. package/dist/src/integrations/persistence/session-repository.js.map +1 -0
  199. package/dist/src/integrations/persistence/session-store.d.ts +184 -0
  200. package/dist/src/integrations/persistence/session-store.d.ts.map +1 -0
  201. package/dist/src/integrations/persistence/session-store.js +346 -0
  202. package/dist/src/integrations/persistence/session-store.js.map +1 -0
  203. package/dist/src/integrations/persistence/sqlite-store.d.ts +453 -0
  204. package/dist/src/integrations/persistence/sqlite-store.d.ts.map +1 -0
  205. package/dist/src/integrations/persistence/sqlite-store.js +676 -0
  206. package/dist/src/integrations/persistence/sqlite-store.js.map +1 -0
  207. package/dist/src/integrations/persistence/worker-repository.d.ts +65 -0
  208. package/dist/src/integrations/persistence/worker-repository.d.ts.map +1 -0
  209. package/dist/src/integrations/persistence/worker-repository.js +183 -0
  210. package/dist/src/integrations/persistence/worker-repository.js.map +1 -0
  211. package/dist/src/integrations/quality/auto-checkpoint.d.ts +98 -0
  212. package/dist/src/integrations/quality/auto-checkpoint.d.ts.map +1 -0
  213. package/dist/src/integrations/quality/auto-checkpoint.js +252 -0
  214. package/dist/src/integrations/quality/auto-checkpoint.js.map +1 -0
  215. package/dist/src/integrations/quality/dead-letter-queue.d.ts +233 -0
  216. package/dist/src/integrations/quality/dead-letter-queue.d.ts.map +1 -0
  217. package/dist/src/integrations/quality/dead-letter-queue.js +543 -0
  218. package/dist/src/integrations/quality/dead-letter-queue.js.map +1 -0
  219. package/dist/src/integrations/quality/health-check.d.ts +218 -0
  220. package/dist/src/integrations/quality/health-check.d.ts.map +1 -0
  221. package/dist/src/integrations/quality/health-check.js +415 -0
  222. package/dist/src/integrations/quality/health-check.js.map +1 -0
  223. package/dist/src/integrations/quality/learning-store.d.ts +291 -0
  224. package/dist/src/integrations/quality/learning-store.d.ts.map +1 -0
  225. package/dist/src/integrations/quality/learning-store.js +646 -0
  226. package/dist/src/integrations/quality/learning-store.js.map +1 -0
  227. package/dist/src/integrations/quality/self-improvement.d.ts +90 -0
  228. package/dist/src/integrations/quality/self-improvement.d.ts.map +1 -0
  229. package/dist/src/integrations/quality/self-improvement.js +229 -0
  230. package/dist/src/integrations/quality/self-improvement.js.map +1 -0
  231. package/dist/src/integrations/quality/tool-recommendation.d.ts +61 -0
  232. package/dist/src/integrations/quality/tool-recommendation.d.ts.map +1 -0
  233. package/dist/src/integrations/quality/tool-recommendation.js +268 -0
  234. package/dist/src/integrations/quality/tool-recommendation.js.map +1 -0
  235. package/dist/src/integrations/safety/bash-policy.d.ts +33 -0
  236. package/dist/src/integrations/safety/bash-policy.d.ts.map +1 -0
  237. package/dist/src/integrations/safety/bash-policy.js +144 -0
  238. package/dist/src/integrations/safety/bash-policy.js.map +1 -0
  239. package/dist/src/integrations/safety/edit-validator.d.ts +30 -0
  240. package/dist/src/integrations/safety/edit-validator.d.ts.map +1 -0
  241. package/dist/src/integrations/safety/edit-validator.js +87 -0
  242. package/dist/src/integrations/safety/edit-validator.js.map +1 -0
  243. package/dist/src/integrations/safety/execution-policy.d.ts +189 -0
  244. package/dist/src/integrations/safety/execution-policy.d.ts.map +1 -0
  245. package/dist/src/integrations/safety/execution-policy.js +352 -0
  246. package/dist/src/integrations/safety/execution-policy.js.map +1 -0
  247. package/dist/src/integrations/safety/policy-engine.d.ts +55 -0
  248. package/dist/src/integrations/safety/policy-engine.d.ts.map +1 -0
  249. package/dist/src/integrations/safety/policy-engine.js +247 -0
  250. package/dist/src/integrations/safety/policy-engine.js.map +1 -0
  251. package/dist/src/integrations/safety/safety.d.ts +174 -0
  252. package/dist/src/integrations/safety/safety.d.ts.map +1 -0
  253. package/dist/src/integrations/safety/safety.js +470 -0
  254. package/dist/src/integrations/safety/safety.js.map +1 -0
  255. package/dist/src/integrations/safety/sandbox/basic.d.ts +81 -0
  256. package/dist/src/integrations/safety/sandbox/basic.d.ts.map +1 -0
  257. package/dist/src/integrations/safety/sandbox/basic.js +335 -0
  258. package/dist/src/integrations/safety/sandbox/basic.js.map +1 -0
  259. package/dist/src/integrations/safety/sandbox/docker.d.ts +94 -0
  260. package/dist/src/integrations/safety/sandbox/docker.d.ts.map +1 -0
  261. package/dist/src/integrations/safety/sandbox/docker.js +294 -0
  262. package/dist/src/integrations/safety/sandbox/docker.js.map +1 -0
  263. package/dist/src/integrations/safety/sandbox/index.d.ts +188 -0
  264. package/dist/src/integrations/safety/sandbox/index.d.ts.map +1 -0
  265. package/dist/src/integrations/safety/sandbox/index.js +386 -0
  266. package/dist/src/integrations/safety/sandbox/index.js.map +1 -0
  267. package/dist/src/integrations/safety/sandbox/landlock.d.ts +59 -0
  268. package/dist/src/integrations/safety/sandbox/landlock.d.ts.map +1 -0
  269. package/dist/src/integrations/safety/sandbox/landlock.js +329 -0
  270. package/dist/src/integrations/safety/sandbox/landlock.js.map +1 -0
  271. package/dist/src/integrations/safety/sandbox/seatbelt.d.ts +68 -0
  272. package/dist/src/integrations/safety/sandbox/seatbelt.d.ts.map +1 -0
  273. package/dist/src/integrations/safety/sandbox/seatbelt.js +298 -0
  274. package/dist/src/integrations/safety/sandbox/seatbelt.js.map +1 -0
  275. package/dist/src/integrations/safety/type-checker.d.ts +53 -0
  276. package/dist/src/integrations/safety/type-checker.d.ts.map +1 -0
  277. package/dist/src/integrations/safety/type-checker.js +142 -0
  278. package/dist/src/integrations/safety/type-checker.js.map +1 -0
  279. package/dist/src/integrations/skills/skill-executor.d.ts +113 -0
  280. package/dist/src/integrations/skills/skill-executor.d.ts.map +1 -0
  281. package/dist/src/integrations/skills/skill-executor.js +270 -0
  282. package/dist/src/integrations/skills/skill-executor.js.map +1 -0
  283. package/dist/src/integrations/skills/skills.d.ts +262 -0
  284. package/dist/src/integrations/skills/skills.d.ts.map +1 -0
  285. package/dist/src/integrations/skills/skills.js +602 -0
  286. package/dist/src/integrations/skills/skills.js.map +1 -0
  287. package/dist/src/integrations/streaming/pty-shell.d.ts +169 -0
  288. package/dist/src/integrations/streaming/pty-shell.d.ts.map +1 -0
  289. package/dist/src/integrations/streaming/pty-shell.js +367 -0
  290. package/dist/src/integrations/streaming/pty-shell.js.map +1 -0
  291. package/dist/src/integrations/streaming/streaming.d.ts +102 -0
  292. package/dist/src/integrations/streaming/streaming.d.ts.map +1 -0
  293. package/dist/src/integrations/streaming/streaming.js +362 -0
  294. package/dist/src/integrations/streaming/streaming.js.map +1 -0
  295. package/dist/src/integrations/swarm/index.d.ts +2 -1
  296. package/dist/src/integrations/swarm/index.d.ts.map +1 -1
  297. package/dist/src/integrations/swarm/index.js +2 -0
  298. package/dist/src/integrations/swarm/index.js.map +1 -1
  299. package/dist/src/integrations/swarm/model-selector.js +1 -1
  300. package/dist/src/integrations/swarm/model-selector.js.map +1 -1
  301. package/dist/src/integrations/swarm/swarm-budget.d.ts +1 -1
  302. package/dist/src/integrations/swarm/swarm-budget.d.ts.map +1 -1
  303. package/dist/src/integrations/swarm/swarm-budget.js +1 -1
  304. package/dist/src/integrations/swarm/swarm-budget.js.map +1 -1
  305. package/dist/src/integrations/swarm/swarm-config-loader.d.ts.map +1 -1
  306. package/dist/src/integrations/swarm/swarm-config-loader.js +7 -0
  307. package/dist/src/integrations/swarm/swarm-config-loader.js.map +1 -1
  308. package/dist/src/integrations/swarm/swarm-events.d.ts +1 -1
  309. package/dist/src/integrations/swarm/swarm-events.d.ts.map +1 -1
  310. package/dist/src/integrations/swarm/swarm-execution.d.ts +27 -0
  311. package/dist/src/integrations/swarm/swarm-execution.d.ts.map +1 -0
  312. package/dist/src/integrations/swarm/swarm-execution.js +1021 -0
  313. package/dist/src/integrations/swarm/swarm-execution.js.map +1 -0
  314. package/dist/src/integrations/swarm/swarm-helpers.d.ts +26 -0
  315. package/dist/src/integrations/swarm/swarm-helpers.d.ts.map +1 -0
  316. package/dist/src/integrations/swarm/swarm-helpers.js +95 -0
  317. package/dist/src/integrations/swarm/swarm-helpers.js.map +1 -0
  318. package/dist/src/integrations/swarm/swarm-lifecycle.d.ts +100 -0
  319. package/dist/src/integrations/swarm/swarm-lifecycle.d.ts.map +1 -0
  320. package/dist/src/integrations/swarm/swarm-lifecycle.js +922 -0
  321. package/dist/src/integrations/swarm/swarm-lifecycle.js.map +1 -0
  322. package/dist/src/integrations/swarm/swarm-orchestrator.d.ts +84 -203
  323. package/dist/src/integrations/swarm/swarm-orchestrator.d.ts.map +1 -1
  324. package/dist/src/integrations/swarm/swarm-orchestrator.js +251 -2870
  325. package/dist/src/integrations/swarm/swarm-orchestrator.js.map +1 -1
  326. package/dist/src/integrations/swarm/swarm-quality-gate.js +1 -1
  327. package/dist/src/integrations/swarm/swarm-quality-gate.js.map +1 -1
  328. package/dist/src/integrations/swarm/swarm-recovery.d.ts +75 -0
  329. package/dist/src/integrations/swarm/swarm-recovery.d.ts.map +1 -0
  330. package/dist/src/integrations/swarm/swarm-recovery.js +550 -0
  331. package/dist/src/integrations/swarm/swarm-recovery.js.map +1 -0
  332. package/dist/src/integrations/swarm/swarm-state-store.d.ts.map +1 -1
  333. package/dist/src/integrations/swarm/swarm-state-store.js +6 -0
  334. package/dist/src/integrations/swarm/swarm-state-store.js.map +1 -1
  335. package/dist/src/integrations/swarm/task-queue.d.ts +1 -1
  336. package/dist/src/integrations/swarm/task-queue.d.ts.map +1 -1
  337. package/dist/src/integrations/swarm/task-queue.js +28 -1
  338. package/dist/src/integrations/swarm/task-queue.js.map +1 -1
  339. package/dist/src/integrations/swarm/types.d.ts +17 -5
  340. package/dist/src/integrations/swarm/types.d.ts.map +1 -1
  341. package/dist/src/integrations/swarm/types.js.map +1 -1
  342. package/dist/src/integrations/swarm/worker-pool.d.ts +1 -1
  343. package/dist/src/integrations/swarm/worker-pool.d.ts.map +1 -1
  344. package/dist/src/integrations/swarm/worker-pool.js +13 -9
  345. package/dist/src/integrations/swarm/worker-pool.js.map +1 -1
  346. package/dist/src/integrations/tasks/dependency-analyzer.d.ts +34 -0
  347. package/dist/src/integrations/tasks/dependency-analyzer.d.ts.map +1 -0
  348. package/dist/src/integrations/tasks/dependency-analyzer.js +232 -0
  349. package/dist/src/integrations/tasks/dependency-analyzer.js.map +1 -0
  350. package/dist/src/integrations/tasks/interactive-planning.d.ts +322 -0
  351. package/dist/src/integrations/tasks/interactive-planning.d.ts.map +1 -0
  352. package/dist/src/integrations/tasks/interactive-planning.js +655 -0
  353. package/dist/src/integrations/tasks/interactive-planning.js.map +1 -0
  354. package/dist/src/integrations/tasks/pending-plan.d.ts +196 -0
  355. package/dist/src/integrations/tasks/pending-plan.d.ts.map +1 -0
  356. package/dist/src/integrations/tasks/pending-plan.js +431 -0
  357. package/dist/src/integrations/tasks/pending-plan.js.map +1 -0
  358. package/dist/src/integrations/tasks/planning.d.ts +115 -0
  359. package/dist/src/integrations/tasks/planning.d.ts.map +1 -0
  360. package/dist/src/integrations/tasks/planning.js +413 -0
  361. package/dist/src/integrations/tasks/planning.js.map +1 -0
  362. package/dist/src/integrations/tasks/smart-decomposer.d.ts +316 -0
  363. package/dist/src/integrations/tasks/smart-decomposer.d.ts.map +1 -0
  364. package/dist/src/integrations/tasks/smart-decomposer.js +661 -0
  365. package/dist/src/integrations/tasks/smart-decomposer.js.map +1 -0
  366. package/dist/src/integrations/tasks/task-manager.d.ts +164 -0
  367. package/dist/src/integrations/tasks/task-manager.d.ts.map +1 -0
  368. package/dist/src/integrations/tasks/task-manager.js +383 -0
  369. package/dist/src/integrations/tasks/task-manager.js.map +1 -0
  370. package/dist/src/integrations/tasks/task-splitter.d.ts +56 -0
  371. package/dist/src/integrations/tasks/task-splitter.d.ts.map +1 -0
  372. package/dist/src/integrations/tasks/task-splitter.js +537 -0
  373. package/dist/src/integrations/tasks/task-splitter.js.map +1 -0
  374. package/dist/src/integrations/tasks/verification-gate.d.ts +103 -0
  375. package/dist/src/integrations/tasks/verification-gate.d.ts.map +1 -0
  376. package/dist/src/integrations/tasks/verification-gate.js +193 -0
  377. package/dist/src/integrations/tasks/verification-gate.js.map +1 -0
  378. package/dist/src/integrations/tasks/work-log.d.ts +87 -0
  379. package/dist/src/integrations/tasks/work-log.d.ts.map +1 -0
  380. package/dist/src/integrations/tasks/work-log.js +275 -0
  381. package/dist/src/integrations/tasks/work-log.js.map +1 -0
  382. package/dist/src/integrations/utilities/capabilities.d.ts +160 -0
  383. package/dist/src/integrations/utilities/capabilities.d.ts.map +1 -0
  384. package/dist/src/integrations/utilities/capabilities.js +426 -0
  385. package/dist/src/integrations/utilities/capabilities.js.map +1 -0
  386. package/dist/src/integrations/utilities/diff-utils.d.ts +105 -0
  387. package/dist/src/integrations/utilities/diff-utils.d.ts.map +1 -0
  388. package/dist/src/integrations/utilities/diff-utils.js +497 -0
  389. package/dist/src/integrations/utilities/diff-utils.js.map +1 -0
  390. package/dist/src/integrations/utilities/environment-facts.d.ts +52 -0
  391. package/dist/src/integrations/utilities/environment-facts.d.ts.map +1 -0
  392. package/dist/src/integrations/utilities/environment-facts.js +84 -0
  393. package/dist/src/integrations/utilities/environment-facts.js.map +1 -0
  394. package/dist/src/integrations/utilities/file-change-tracker.d.ts +162 -0
  395. package/dist/src/integrations/utilities/file-change-tracker.d.ts.map +1 -0
  396. package/dist/src/integrations/utilities/file-change-tracker.js +538 -0
  397. package/dist/src/integrations/utilities/file-change-tracker.js.map +1 -0
  398. package/dist/src/integrations/utilities/graph-visualization.d.ts +72 -0
  399. package/dist/src/integrations/utilities/graph-visualization.d.ts.map +1 -0
  400. package/dist/src/integrations/utilities/graph-visualization.js +383 -0
  401. package/dist/src/integrations/utilities/graph-visualization.js.map +1 -0
  402. package/dist/src/integrations/utilities/hierarchical-config.d.ts +215 -0
  403. package/dist/src/integrations/utilities/hierarchical-config.d.ts.map +1 -0
  404. package/dist/src/integrations/utilities/hierarchical-config.js +504 -0
  405. package/dist/src/integrations/utilities/hierarchical-config.js.map +1 -0
  406. package/dist/src/integrations/utilities/hooks.d.ts +116 -0
  407. package/dist/src/integrations/utilities/hooks.d.ts.map +1 -0
  408. package/dist/src/integrations/utilities/hooks.js +410 -0
  409. package/dist/src/integrations/utilities/hooks.js.map +1 -0
  410. package/dist/src/integrations/utilities/ignore.d.ts +143 -0
  411. package/dist/src/integrations/utilities/ignore.d.ts.map +1 -0
  412. package/dist/src/integrations/utilities/ignore.js +417 -0
  413. package/dist/src/integrations/utilities/ignore.js.map +1 -0
  414. package/dist/src/integrations/utilities/image-renderer.d.ts +119 -0
  415. package/dist/src/integrations/utilities/image-renderer.d.ts.map +1 -0
  416. package/dist/src/integrations/utilities/image-renderer.js +306 -0
  417. package/dist/src/integrations/utilities/image-renderer.js.map +1 -0
  418. package/dist/src/integrations/utilities/logger.d.ts +104 -0
  419. package/dist/src/integrations/utilities/logger.d.ts.map +1 -0
  420. package/dist/src/integrations/utilities/logger.js +219 -0
  421. package/dist/src/integrations/utilities/logger.js.map +1 -0
  422. package/dist/src/integrations/utilities/memory.d.ts +116 -0
  423. package/dist/src/integrations/utilities/memory.d.ts.map +1 -0
  424. package/dist/src/integrations/utilities/memory.js +311 -0
  425. package/dist/src/integrations/utilities/memory.js.map +1 -0
  426. package/dist/src/integrations/utilities/observability.d.ts +162 -0
  427. package/dist/src/integrations/utilities/observability.d.ts.map +1 -0
  428. package/dist/src/integrations/utilities/observability.js +407 -0
  429. package/dist/src/integrations/utilities/observability.js.map +1 -0
  430. package/dist/src/integrations/utilities/openrouter-pricing.d.ts +67 -0
  431. package/dist/src/integrations/utilities/openrouter-pricing.d.ts.map +1 -0
  432. package/dist/src/integrations/utilities/openrouter-pricing.js +166 -0
  433. package/dist/src/integrations/utilities/openrouter-pricing.js.map +1 -0
  434. package/dist/src/integrations/utilities/react.d.ts +139 -0
  435. package/dist/src/integrations/utilities/react.d.ts.map +1 -0
  436. package/dist/src/integrations/utilities/react.js +273 -0
  437. package/dist/src/integrations/utilities/react.js.map +1 -0
  438. package/dist/src/integrations/utilities/retry.d.ts +132 -0
  439. package/dist/src/integrations/utilities/retry.d.ts.map +1 -0
  440. package/dist/src/integrations/utilities/retry.js +233 -0
  441. package/dist/src/integrations/utilities/retry.js.map +1 -0
  442. package/dist/src/integrations/utilities/routing.d.ts +118 -0
  443. package/dist/src/integrations/utilities/routing.d.ts.map +1 -0
  444. package/dist/src/integrations/utilities/routing.js +348 -0
  445. package/dist/src/integrations/utilities/routing.js.map +1 -0
  446. package/dist/src/integrations/utilities/rules.d.ts +131 -0
  447. package/dist/src/integrations/utilities/rules.d.ts.map +1 -0
  448. package/dist/src/integrations/utilities/rules.js +284 -0
  449. package/dist/src/integrations/utilities/rules.js.map +1 -0
  450. package/dist/src/integrations/utilities/sourcegraph.d.ts +169 -0
  451. package/dist/src/integrations/utilities/sourcegraph.d.ts.map +1 -0
  452. package/dist/src/integrations/utilities/sourcegraph.js +379 -0
  453. package/dist/src/integrations/utilities/sourcegraph.js.map +1 -0
  454. package/dist/src/integrations/utilities/thinking-strategy.d.ts +52 -0
  455. package/dist/src/integrations/utilities/thinking-strategy.d.ts.map +1 -0
  456. package/dist/src/integrations/utilities/thinking-strategy.js +129 -0
  457. package/dist/src/integrations/utilities/thinking-strategy.js.map +1 -0
  458. package/dist/src/integrations/utilities/thread-manager.d.ts +199 -0
  459. package/dist/src/integrations/utilities/thread-manager.d.ts.map +1 -0
  460. package/dist/src/integrations/utilities/thread-manager.js +357 -0
  461. package/dist/src/integrations/utilities/thread-manager.js.map +1 -0
  462. package/dist/src/integrations/utilities/token-estimate.d.ts +11 -0
  463. package/dist/src/integrations/utilities/token-estimate.d.ts.map +1 -0
  464. package/dist/src/integrations/utilities/token-estimate.js +14 -0
  465. package/dist/src/integrations/utilities/token-estimate.js.map +1 -0
  466. package/dist/src/main.js +10 -4
  467. package/dist/src/main.js.map +1 -1
  468. package/dist/src/modes/repl.d.ts.map +1 -1
  469. package/dist/src/modes/repl.js +22 -5
  470. package/dist/src/modes/repl.js.map +1 -1
  471. package/dist/src/modes/tui.d.ts.map +1 -1
  472. package/dist/src/modes/tui.js +23 -6
  473. package/dist/src/modes/tui.js.map +1 -1
  474. package/dist/src/modes.js +1 -1
  475. package/dist/src/modes.js.map +1 -1
  476. package/dist/src/observability/tracer.js +1 -1
  477. package/dist/src/observability/tracer.js.map +1 -1
  478. package/dist/src/persistence/schema.d.ts +2 -0
  479. package/dist/src/persistence/schema.d.ts.map +1 -1
  480. package/dist/src/persistence/schema.js +31 -0
  481. package/dist/src/persistence/schema.js.map +1 -1
  482. package/dist/src/providers/adapters/anthropic.d.ts +6 -0
  483. package/dist/src/providers/adapters/anthropic.d.ts.map +1 -1
  484. package/dist/src/providers/adapters/anthropic.js +99 -15
  485. package/dist/src/providers/adapters/anthropic.js.map +1 -1
  486. package/dist/src/providers/adapters/azure.d.ts +74 -0
  487. package/dist/src/providers/adapters/azure.d.ts.map +1 -0
  488. package/dist/src/providers/adapters/azure.js +354 -0
  489. package/dist/src/providers/adapters/azure.js.map +1 -0
  490. package/dist/src/providers/adapters/mock.d.ts +16 -2
  491. package/dist/src/providers/adapters/mock.d.ts.map +1 -1
  492. package/dist/src/providers/adapters/mock.js +44 -3
  493. package/dist/src/providers/adapters/mock.js.map +1 -1
  494. package/dist/src/providers/adapters/openai.d.ts +6 -1
  495. package/dist/src/providers/adapters/openai.d.ts.map +1 -1
  496. package/dist/src/providers/adapters/openai.js +39 -8
  497. package/dist/src/providers/adapters/openai.js.map +1 -1
  498. package/dist/src/providers/adapters/openrouter.d.ts +6 -0
  499. package/dist/src/providers/adapters/openrouter.d.ts.map +1 -1
  500. package/dist/src/providers/adapters/openrouter.js +73 -3
  501. package/dist/src/providers/adapters/openrouter.js.map +1 -1
  502. package/dist/src/providers/provider.js +1 -1
  503. package/dist/src/providers/provider.js.map +1 -1
  504. package/dist/src/providers/resilient-provider.js +1 -1
  505. package/dist/src/providers/resilient-provider.js.map +1 -1
  506. package/dist/src/providers/types.d.ts +23 -2
  507. package/dist/src/providers/types.d.ts.map +1 -1
  508. package/dist/src/session-picker.d.ts +1 -1
  509. package/dist/src/session-picker.d.ts.map +1 -1
  510. package/dist/src/session-picker.js +1 -1
  511. package/dist/src/session-picker.js.map +1 -1
  512. package/dist/src/shared/budget-tracker.js +1 -1
  513. package/dist/src/shared/budget-tracker.js.map +1 -1
  514. package/dist/src/tools/agent.d.ts +1 -1
  515. package/dist/src/tools/agent.d.ts.map +1 -1
  516. package/dist/src/tools/bash.js +1 -1
  517. package/dist/src/tools/bash.js.map +1 -1
  518. package/dist/src/tools/file.js +1 -1
  519. package/dist/src/tools/file.js.map +1 -1
  520. package/dist/src/tools/permission.js +2 -2
  521. package/dist/src/tools/permission.js.map +1 -1
  522. package/dist/src/tools/registry.d.ts +1 -1
  523. package/dist/src/tools/registry.d.ts.map +1 -1
  524. package/dist/src/tools/registry.js +1 -1
  525. package/dist/src/tools/registry.js.map +1 -1
  526. package/dist/src/tools/tasks.d.ts +1 -1
  527. package/dist/src/tools/tasks.d.ts.map +1 -1
  528. package/dist/src/tools/undo.d.ts +1 -1
  529. package/dist/src/tools/undo.d.ts.map +1 -1
  530. package/dist/src/tracing/cache-boundary-tracker.d.ts.map +1 -1
  531. package/dist/src/tracing/cache-boundary-tracker.js +2 -2
  532. package/dist/src/tracing/cache-boundary-tracker.js.map +1 -1
  533. package/dist/src/tracing/trace-collector.d.ts +22 -0
  534. package/dist/src/tracing/trace-collector.d.ts.map +1 -1
  535. package/dist/src/tracing/trace-collector.js +27 -3
  536. package/dist/src/tracing/trace-collector.js.map +1 -1
  537. package/dist/src/tracing/types.d.ts +17 -1
  538. package/dist/src/tracing/types.d.ts.map +1 -1
  539. package/dist/src/tracing/types.js.map +1 -1
  540. package/dist/src/tricks/failure-evidence.js +1 -1
  541. package/dist/src/tricks/failure-evidence.js.map +1 -1
  542. package/dist/src/tricks/recitation.d.ts.map +1 -1
  543. package/dist/src/tricks/recitation.js +2 -1
  544. package/dist/src/tricks/recitation.js.map +1 -1
  545. package/dist/src/tricks/recursive-context.d.ts.map +1 -1
  546. package/dist/src/tricks/recursive-context.js +2 -2
  547. package/dist/src/tricks/recursive-context.js.map +1 -1
  548. package/dist/src/tricks/reversible-compaction.d.ts.map +1 -1
  549. package/dist/src/tricks/reversible-compaction.js +6 -2
  550. package/dist/src/tricks/reversible-compaction.js.map +1 -1
  551. package/dist/src/tui/app.d.ts +3 -3
  552. package/dist/src/tui/app.d.ts.map +1 -1
  553. package/dist/src/tui/app.js +86 -14
  554. package/dist/src/tui/app.js.map +1 -1
  555. package/dist/src/tui/components/CollapsibleDiffView.d.ts +1 -1
  556. package/dist/src/tui/components/CollapsibleDiffView.d.ts.map +1 -1
  557. package/dist/src/tui/components/DiagnosticsPanel.d.ts +24 -0
  558. package/dist/src/tui/components/DiagnosticsPanel.d.ts.map +1 -0
  559. package/dist/src/tui/components/DiagnosticsPanel.js +47 -0
  560. package/dist/src/tui/components/DiagnosticsPanel.js.map +1 -0
  561. package/dist/src/tui/components/DiffView.d.ts +1 -1
  562. package/dist/src/tui/components/DiffView.d.ts.map +1 -1
  563. package/dist/src/tui/components/ErrorBoundary.js +1 -1
  564. package/dist/src/tui/components/ErrorBoundary.js.map +1 -1
  565. package/dist/src/tui/components/TasksPanel.d.ts +1 -1
  566. package/dist/src/tui/components/TasksPanel.d.ts.map +1 -1
  567. package/dist/src/tui/event-display.js +1 -1
  568. package/dist/src/tui/event-display.js.map +1 -1
  569. package/dist/src/tui/index.js +1 -1
  570. package/dist/src/tui/index.js.map +1 -1
  571. package/dist/src/tui/transparency-aggregator.d.ts +13 -0
  572. package/dist/src/tui/transparency-aggregator.d.ts.map +1 -1
  573. package/dist/src/tui/transparency-aggregator.js +21 -0
  574. package/dist/src/tui/transparency-aggregator.js.map +1 -1
  575. package/dist/src/types.d.ts +27 -2
  576. package/dist/src/types.d.ts.map +1 -1
  577. package/package.json +1 -1
@@ -0,0 +1,220 @@
1
+ /**
2
+ * MCP Tool Search
3
+ *
4
+ * Provides a meta-tool for searching and dynamically loading MCP tools.
5
+ * Enables lazy loading of tool schemas to reduce context window usage.
6
+ *
7
+ * Token Savings:
8
+ * - 50 tools with full schemas: ~15,000 tokens
9
+ * - 50 tools as summaries: ~2,500 tokens
10
+ * - Savings: ~83% reduction in MCP tool context
11
+ */
12
+ // =============================================================================
13
+ // TOOL SEARCH TOOL
14
+ // =============================================================================
15
+ /**
16
+ * Create the mcp_tool_search tool.
17
+ *
18
+ * This tool allows the agent to search for MCP tools by name or description,
19
+ * then automatically loads matching tools so they become available for use.
20
+ *
21
+ * @example
22
+ * // Search for browser tools
23
+ * mcp_tool_search({ query: "browser click" })
24
+ *
25
+ * // Search with regex
26
+ * mcp_tool_search({ query: "browser_(click|hover)", regex: true })
27
+ *
28
+ * // Limit results
29
+ * mcp_tool_search({ query: "screenshot", limit: 3 })
30
+ */
31
+ export function createMCPToolSearchTool(mcpClient, options = {}) {
32
+ const { autoLoad = true, defaultLimit = 5, onToolsLoaded, } = options;
33
+ return {
34
+ name: 'mcp_tool_search',
35
+ description: `Search for MCP tools by name or description.
36
+ Found tools are automatically loaded and become available for use.
37
+
38
+ Examples:
39
+ - "browser click" - find click-related browser tools
40
+ - "screenshot" - find screenshot tools
41
+ - "file read" - find file reading tools
42
+
43
+ Use this when you need an MCP tool but don't see it in your available tools.`,
44
+ parameters: {
45
+ type: 'object',
46
+ properties: {
47
+ query: {
48
+ type: 'string',
49
+ description: 'Search keywords (e.g., "browser click", "file read")',
50
+ },
51
+ regex: {
52
+ type: 'boolean',
53
+ description: 'Use regex matching instead of keyword search',
54
+ },
55
+ limit: {
56
+ type: 'number',
57
+ description: `Max results to return (default: ${defaultLimit})`,
58
+ },
59
+ },
60
+ required: ['query'],
61
+ },
62
+ execute: async (args) => {
63
+ const query = String(args.query || '');
64
+ const regex = Boolean(args.regex);
65
+ const limit = typeof args.limit === 'number' ? args.limit : defaultLimit;
66
+ // Search for matching tools
67
+ const matches = mcpClient.searchTools(query, { limit, regex });
68
+ // Get total count for context
69
+ const allSummaries = mcpClient.getAllToolSummaries();
70
+ const totalAvailable = allSummaries.length;
71
+ // Auto-load found tools if enabled
72
+ let loadedTools = [];
73
+ if (autoLoad && matches.length > 0) {
74
+ loadedTools = mcpClient.loadTools(matches.map(m => m.name));
75
+ // Notify callback if provided
76
+ if (onToolsLoaded && loadedTools.length > 0) {
77
+ onToolsLoaded(loadedTools);
78
+ }
79
+ }
80
+ // Build result message
81
+ let message;
82
+ if (matches.length === 0) {
83
+ message = `No tools found matching "${query}". Try different keywords.`;
84
+ }
85
+ else if (autoLoad) {
86
+ message = `Found and loaded ${matches.length} tool(s) matching "${query}". They are now available for use.`;
87
+ }
88
+ else {
89
+ message = `Found ${matches.length} tool(s) matching "${query}".`;
90
+ }
91
+ return {
92
+ tools: matches,
93
+ totalAvailable,
94
+ autoLoaded: autoLoad && matches.length > 0,
95
+ message,
96
+ };
97
+ },
98
+ };
99
+ }
100
+ /**
101
+ * Create a tool that lists all available MCP tools as summaries.
102
+ * Useful when the agent needs to understand what tools are available.
103
+ */
104
+ export function createMCPToolListTool(mcpClient) {
105
+ return {
106
+ name: 'mcp_tool_list',
107
+ description: `List all available MCP tools with brief descriptions.
108
+ Use this to see what tools are available before searching for specific ones.`,
109
+ parameters: {
110
+ type: 'object',
111
+ properties: {
112
+ server: {
113
+ type: 'string',
114
+ description: 'Filter by server name (optional)',
115
+ },
116
+ },
117
+ },
118
+ execute: async (args) => {
119
+ const serverFilter = args.server ? String(args.server) : undefined;
120
+ let summaries = mcpClient.getAllToolSummaries();
121
+ if (serverFilter) {
122
+ summaries = summaries.filter(s => s.serverName === serverFilter);
123
+ }
124
+ return {
125
+ tools: summaries,
126
+ count: summaries.length,
127
+ };
128
+ },
129
+ };
130
+ }
131
+ /**
132
+ * Create a tool that shows MCP context usage statistics.
133
+ * Useful for monitoring token usage with lazy loading.
134
+ */
135
+ export function createMCPContextStatsTool(mcpClient) {
136
+ return {
137
+ name: 'mcp_context_stats',
138
+ description: `Show MCP tool context usage statistics.
139
+ Reports token usage for tool summaries vs full definitions.`,
140
+ parameters: {
141
+ type: 'object',
142
+ properties: {},
143
+ },
144
+ execute: async () => {
145
+ const stats = mcpClient.getContextStats();
146
+ // Calculate savings
147
+ const fullLoadTokens = stats.totalTools * 200; // Estimate: ~200 tokens per full tool
148
+ const currentTokens = stats.summaryTokens + stats.definitionTokens;
149
+ const savingsPercent = fullLoadTokens > 0
150
+ ? Math.round((1 - currentTokens / fullLoadTokens) * 100)
151
+ : 0;
152
+ // Generate recommendation
153
+ let recommendation;
154
+ if (stats.loadedCount > 20) {
155
+ recommendation = 'Consider using lazy loading more aggressively - many tools are fully loaded.';
156
+ }
157
+ else if (stats.loadedCount === 0) {
158
+ recommendation = 'All tools are summaries. Use mcp_tool_search to load specific tools when needed.';
159
+ }
160
+ else {
161
+ recommendation = `Good balance: ${stats.loadedCount} tools loaded, ${stats.summaryCount} as summaries.`;
162
+ }
163
+ return {
164
+ stats,
165
+ savings: `${savingsPercent}% token savings vs loading all full schemas`,
166
+ recommendation,
167
+ };
168
+ },
169
+ };
170
+ }
171
+ // =============================================================================
172
+ // FACTORY
173
+ // =============================================================================
174
+ /**
175
+ * Create all MCP meta-tools for dynamic tool discovery.
176
+ */
177
+ export function createMCPMetaTools(mcpClient, options = {}) {
178
+ return [
179
+ createMCPToolSearchTool(mcpClient, options),
180
+ createMCPToolListTool(mcpClient),
181
+ createMCPContextStatsTool(mcpClient),
182
+ ];
183
+ }
184
+ // =============================================================================
185
+ // UTILITIES
186
+ // =============================================================================
187
+ /**
188
+ * Format tool summaries for display.
189
+ */
190
+ export function formatToolSummaries(summaries) {
191
+ if (summaries.length === 0) {
192
+ return 'No tools available.';
193
+ }
194
+ const lines = ['MCP Tools:'];
195
+ // Group by server
196
+ const byServer = new Map();
197
+ for (const s of summaries) {
198
+ const existing = byServer.get(s.serverName) || [];
199
+ existing.push(s);
200
+ byServer.set(s.serverName, existing);
201
+ }
202
+ for (const [server, tools] of byServer) {
203
+ lines.push(`\n ${server}:`);
204
+ for (const tool of tools) {
205
+ lines.push(` - ${tool.originalName}: ${tool.description}`);
206
+ }
207
+ }
208
+ return lines.join('\n');
209
+ }
210
+ /**
211
+ * Format context stats for display.
212
+ */
213
+ export function formatContextStats(stats) {
214
+ const total = stats.summaryTokens + stats.definitionTokens;
215
+ return `MCP Tool Context:
216
+ Tool summaries: ${stats.summaryCount} tools (~${stats.summaryTokens.toLocaleString()} tokens)
217
+ Full definitions: ${stats.loadedCount} tools (~${stats.definitionTokens.toLocaleString()} tokens)
218
+ Total: ${stats.totalTools} tools (~${total.toLocaleString()} tokens)`;
219
+ }
220
+ //# sourceMappingURL=mcp-tool-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-tool-search.js","sourceRoot":"","sources":["../../../../src/integrations/mcp/mcp-tool-search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAmCH,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,uBAAuB,CACrC,SAAoB,EACpB,UAAgC,EAAE;IAElC,MAAM,EACJ,QAAQ,GAAG,IAAI,EACf,YAAY,GAAG,CAAC,EAChB,aAAa,GACd,GAAG,OAAO,CAAC;IAEZ,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE;;;;;;;;6EAQ4D;QACzE,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sDAAsD;iBACpE;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,8CAA8C;iBAC5D;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,mCAAmC,YAAY,GAAG;iBAChE;aACF;YACD,QAAQ,EAAE,CAAC,OAAO,CAAC;SACpB;QACD,OAAO,EAAE,KAAK,EAAE,IAA6B,EAAgC,EAAE;YAC7E,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YACvC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAClC,MAAM,KAAK,GAAG,OAAO,I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MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QAClD,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,QAAQ,EAAE,CAAC;QACvC,KAAK,CAAC,IAAI,CAAC,OAAO,MAAM,GAAG,CAAC,CAAC;QAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAA+C;IAChF,MAAM,KAAK,GAAG,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,gBAAgB,CAAC;IAE3D,OAAO;uBACc,KAAK,CAAC,YAAY,YAAY,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE;uBAClE,KAAK,CAAC,WAAW,YAAY,KAAK,CAAC,gBAAgB,CAAC,cAAc,EAAE;uBACpE,KAAK,CAAC,UAAU,YAAY,KAAK,CAAC,cAAc,EAAE,UAAU,CAAC;AACpF,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * MCP Tool Description Validator
3
+ *
4
+ * Validates MCP tool descriptions for quality, helping ensure
5
+ * that LLMs can understand and correctly use the tools.
6
+ *
7
+ * Quality checks:
8
+ * 1. Description length (minimum useful length)
9
+ * 2. Input schema has property descriptions
10
+ * 3. Required parameters are marked
11
+ * 4. Description contains usage patterns
12
+ * 5. Naming conventions (snake_case, prefixed)
13
+ */
14
+ export interface ToolValidationResult {
15
+ /** Tool name */
16
+ toolName: string;
17
+ /** Quality score (0-100) */
18
+ score: number;
19
+ /** Specific problems found */
20
+ issues: string[];
21
+ /** Improvement suggestions */
22
+ suggestions: string[];
23
+ }
24
+ export interface ToolValidationConfig {
25
+ /** Minimum description length (default: 20) */
26
+ minDescriptionLength: number;
27
+ /** Require input schema property descriptions (default: true) */
28
+ requirePropertyDescriptions: boolean;
29
+ /** Require at least one example in description (default: false) */
30
+ requireExamples: boolean;
31
+ /** Minimum quality score to pass (default: 40) */
32
+ minimumPassScore: number;
33
+ }
34
+ interface ValidatableToolInfo {
35
+ name: string;
36
+ description?: string;
37
+ inputSchema?: Record<string, unknown>;
38
+ }
39
+ /**
40
+ * Validate a single tool's description quality.
41
+ */
42
+ export declare function validateToolDescription(tool: ValidatableToolInfo, config?: Partial<ToolValidationConfig>): ToolValidationResult;
43
+ /**
44
+ * Validate all tools and return results sorted by score (worst first).
45
+ */
46
+ export declare function validateAllTools(tools: ValidatableToolInfo[], config?: Partial<ToolValidationConfig>): ToolValidationResult[];
47
+ /**
48
+ * Get a summary of validation results.
49
+ */
50
+ export declare function formatValidationSummary(results: ToolValidationResult[]): string;
51
+ /**
52
+ * Create a tool validator.
53
+ */
54
+ export declare function createToolValidator(config?: Partial<ToolValidationConfig>): {
55
+ validate: (tool: ValidatableToolInfo) => ToolValidationResult;
56
+ validateAll: (tools: ValidatableToolInfo[]) => ToolValidationResult[];
57
+ formatSummary: typeof formatValidationSummary;
58
+ };
59
+ export {};
60
+ //# sourceMappingURL=mcp-tool-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-tool-validator.d.ts","sourceRoot":"","sources":["../../../../src/integrations/mcp/mcp-tool-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,MAAM,WAAW,oBAAoB;IACnC,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,8BAA8B;IAC9B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,+CAA+C;IAC/C,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iEAAiE;IACjE,2BAA2B,EAAE,OAAO,CAAC;IACrC,mEAAmE;IACnE,eAAe,EAAE,OAAO,CAAC;IACzB,kDAAkD;IAClD,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAiBD;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,mBAAmB,EACzB,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACrC,oBAAoB,CAmFtB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,mBAAmB,EAAE,EAC5B,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACrC,oBAAoB,EAAE,CAIxB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAgB/E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC;qBAErD,mBAAmB;yBACf,mBAAmB,EAAE;;EAG7C"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * MCP Tool Description Validator
3
+ *
4
+ * Validates MCP tool descriptions for quality, helping ensure
5
+ * that LLMs can understand and correctly use the tools.
6
+ *
7
+ * Quality checks:
8
+ * 1. Description length (minimum useful length)
9
+ * 2. Input schema has property descriptions
10
+ * 3. Required parameters are marked
11
+ * 4. Description contains usage patterns
12
+ * 5. Naming conventions (snake_case, prefixed)
13
+ */
14
+ // =============================================================================
15
+ // CONSTANTS
16
+ // =============================================================================
17
+ const DEFAULT_CONFIG = {
18
+ minDescriptionLength: 20,
19
+ requirePropertyDescriptions: true,
20
+ requireExamples: false,
21
+ minimumPassScore: 40,
22
+ };
23
+ // =============================================================================
24
+ // VALIDATOR
25
+ // =============================================================================
26
+ /**
27
+ * Validate a single tool's description quality.
28
+ */
29
+ export function validateToolDescription(tool, config) {
30
+ const cfg = { ...DEFAULT_CONFIG, ...config };
31
+ const issues = [];
32
+ const suggestions = [];
33
+ let score = 100;
34
+ const description = tool.description || '';
35
+ // Check 1: Description exists and has minimum length
36
+ if (!description) {
37
+ issues.push('No description provided');
38
+ score -= 40;
39
+ }
40
+ else if (description.length < cfg.minDescriptionLength) {
41
+ issues.push(`Description too short (${description.length} chars, min: ${cfg.minDescriptionLength})`);
42
+ suggestions.push('Add more detail about what this tool does and when to use it');
43
+ score -= 20;
44
+ }
45
+ // Check 2: Description is informative (not just tool name restated)
46
+ if (description && tool.name) {
47
+ const nameWords = tool.name.replace(/[_-]/g, ' ').toLowerCase().split(/\s+/);
48
+ const descWords = description.toLowerCase().split(/\s+/);
49
+ const overlap = nameWords.filter(w => descWords.includes(w)).length;
50
+ if (overlap === nameWords.length && description.split(/\s+/).length < 5) {
51
+ issues.push('Description merely restates the tool name');
52
+ suggestions.push('Explain what the tool does, its purpose, and any important behavior');
53
+ score -= 15;
54
+ }
55
+ }
56
+ // Check 3: Input schema has property descriptions
57
+ if (cfg.requirePropertyDescriptions && tool.inputSchema) {
58
+ const properties = tool.inputSchema.properties;
59
+ if (properties) {
60
+ const undocumented = [];
61
+ for (const [propName, propSchema] of Object.entries(properties)) {
62
+ if (!propSchema.description) {
63
+ undocumented.push(propName);
64
+ }
65
+ }
66
+ if (undocumented.length > 0) {
67
+ issues.push(`Properties missing descriptions: ${undocumented.join(', ')}`);
68
+ suggestions.push('Add "description" to each property in the input schema');
69
+ score -= Math.min(undocumented.length * 5, 20);
70
+ }
71
+ }
72
+ }
73
+ // Check 4: Required parameters are specified
74
+ if (tool.inputSchema) {
75
+ const required = tool.inputSchema.required;
76
+ const properties = tool.inputSchema.properties;
77
+ if (properties && Object.keys(properties).length > 0 && (!required || required.length === 0)) {
78
+ suggestions.push('Consider marking required parameters in the schema');
79
+ score -= 5;
80
+ }
81
+ }
82
+ // Check 5: Description mentions examples or usage patterns
83
+ if (cfg.requireExamples && description) {
84
+ const hasExample = /example|e\.g\.|for instance|usage:|such as/i.test(description);
85
+ if (!hasExample) {
86
+ suggestions.push('Add a usage example to the description');
87
+ score -= 10;
88
+ }
89
+ }
90
+ // Check 6: Naming conventions
91
+ if (tool.name) {
92
+ const isSnakeCase = /^[a-z][a-z0-9_]*$/.test(tool.name);
93
+ const hasMCPPrefix = tool.name.startsWith('mcp_');
94
+ if (!isSnakeCase && !hasMCPPrefix) {
95
+ suggestions.push('Consider using snake_case for tool names');
96
+ score -= 5;
97
+ }
98
+ }
99
+ return {
100
+ toolName: tool.name,
101
+ score: Math.max(0, score),
102
+ issues,
103
+ suggestions,
104
+ };
105
+ }
106
+ /**
107
+ * Validate all tools and return results sorted by score (worst first).
108
+ */
109
+ export function validateAllTools(tools, config) {
110
+ return tools
111
+ .map(tool => validateToolDescription(tool, config))
112
+ .sort((a, b) => a.score - b.score);
113
+ }
114
+ /**
115
+ * Get a summary of validation results.
116
+ */
117
+ export function formatValidationSummary(results) {
118
+ const passed = results.filter(r => r.score >= (DEFAULT_CONFIG.minimumPassScore));
119
+ const failed = results.filter(r => r.score < (DEFAULT_CONFIG.minimumPassScore));
120
+ const lines = [
121
+ `Tool Description Quality: ${passed.length}/${results.length} passed`,
122
+ ];
123
+ if (failed.length > 0) {
124
+ lines.push('', 'Failed:');
125
+ for (const r of failed) {
126
+ lines.push(` ${r.toolName} (score: ${r.score}): ${r.issues.join('; ')}`);
127
+ }
128
+ }
129
+ return lines.join('\n');
130
+ }
131
+ /**
132
+ * Create a tool validator.
133
+ */
134
+ export function createToolValidator(config) {
135
+ return {
136
+ validate: (tool) => validateToolDescription(tool, config),
137
+ validateAll: (tools) => validateAllTools(tools, config),
138
+ formatSummary: formatValidationSummary,
139
+ };
140
+ }
141
+ //# sourceMappingURL=mcp-tool-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-tool-validator.js","sourceRoot":"","sources":["../../../../src/integrations/mcp/mcp-tool-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAkCH,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,cAAc,GAAyB;IAC3C,oBAAoB,EAAE,EAAE;IACxB,2BAA2B,EAAE,IAAI;IACjC,eAAe,EAAE,KAAK;IACtB,gBAAgB,EAAE,EAAE;CACrB,CAAC;AAEF,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,IAAyB,EACzB,MAAsC;IAEtC,MAAM,GAAG,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;IAC7C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAI,KAAK,GAAG,GAAG,CAAC;IAEhB,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC;IAE3C,qDAAqD;IACrD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACvC,KAAK,IAAI,EAAE,CAAC;IACd,CAAC;SAAM,IAAI,WAAW,CAAC,MAAM,GAAG,GAAG,CAAC,oBAAoB,EAAE,CAAC;QACzD,MAAM,CAAC,IAAI,CAAC,0BAA0B,WAAW,CAAC,MAAM,gBAAgB,GAAG,CAAC,oBAAoB,GAAG,CAAC,CAAC;QACrG,WAAW,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;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AAK,CAAC,CAAC,QAAQ,YAAY,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAsC;IACxE,OAAO;QACL,QAAQ,EAAE,CAAC,IAAyB,EAAE,EAAE,CAAC,uBAAuB,CAAC,IAAI,EAAE,MAAM,CAAC;QAC9E,WAAW,EAAE,CAAC,KAA4B,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC;QAC9E,aAAa,EAAE,uBAAuB;KACvC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Codebase Repository
3
+ *
4
+ * Persistence layer for codebase analysis results.
5
+ * Stores/loads chunk metadata and dependency graph to/from SQLite
6
+ * for warm startup across sessions.
7
+ */
8
+ import type { SQLiteStoreDeps } from './sqlite-store.js';
9
+ export interface SavedChunk {
10
+ filePath: string;
11
+ contentHash: string;
12
+ symbolsJson: string;
13
+ dependenciesJson: string;
14
+ importance: number;
15
+ chunkType: string;
16
+ tokenCount: number;
17
+ analyzedAt: number;
18
+ }
19
+ export interface SavedCodebaseAnalysis {
20
+ chunks: Map<string, SavedChunk>;
21
+ deps: Map<string, Set<string>>;
22
+ }
23
+ /**
24
+ * Save codebase analysis to SQLite for persistence across sessions.
25
+ */
26
+ export declare function saveCodebaseAnalysis(deps: SQLiteStoreDeps, root: string, chunks: Iterable<{
27
+ filePath: string;
28
+ content: string;
29
+ symbolDetails: Array<{
30
+ name: string;
31
+ kind: string;
32
+ exported: boolean;
33
+ line: number;
34
+ }>;
35
+ dependencies: string[];
36
+ importance: number;
37
+ type: string;
38
+ tokenCount: number;
39
+ }>, dependencyGraph: Map<string, Set<string>>): void;
40
+ /**
41
+ * Load persisted codebase analysis from SQLite.
42
+ * Returns null if no analysis exists for the given workspace root.
43
+ */
44
+ export declare function loadCodebaseAnalysis(deps: SQLiteStoreDeps, root: string): SavedCodebaseAnalysis | null;
45
+ //# sourceMappingURL=codebase-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codebase-repository.d.ts","sourceRoot":"","sources":["../../../../src/integrations/persistence/codebase-repository.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAOzD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAChC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;CAChC;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,eAAe,EACrB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtF,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,EACF,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,GACxC,IAAI,CAkCN;AAMD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,eAAe,EACrB,IAAI,EAAE,MAAM,GACX,qBAAqB,GAAG,IAAI,CA8C9B"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Codebase Repository
3
+ *
4
+ * Persistence layer for codebase analysis results.
5
+ * Stores/loads chunk metadata and dependency graph to/from SQLite
6
+ * for warm startup across sessions.
7
+ */
8
+ import { djb2Hash } from '../context/codebase-ast.js';
9
+ // =============================================================================
10
+ // SAVE
11
+ // =============================================================================
12
+ /**
13
+ * Save codebase analysis to SQLite for persistence across sessions.
14
+ */
15
+ export function saveCodebaseAnalysis(deps, root, chunks, dependencyGraph) {
16
+ if (!deps.features.codebaseAnalysis)
17
+ return;
18
+ const { db } = deps;
19
+ const deleteChunks = db.prepare('DELETE FROM codebase_chunks WHERE workspace_root = ?');
20
+ const deleteDeps = db.prepare('DELETE FROM codebase_deps WHERE workspace_root = ?');
21
+ const insertChunk = db.prepare(`
22
+ INSERT INTO codebase_chunks (file_path, workspace_root, content_hash, symbols_json,
23
+ dependencies_json, importance, chunk_type, token_count, analyzed_at)
24
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
25
+ `);
26
+ const insertDep = db.prepare(`
27
+ INSERT INTO codebase_deps (workspace_root, source_file, target_file) VALUES (?, ?, ?)
28
+ `);
29
+ const transaction = db.transaction(() => {
30
+ deleteChunks.run(root);
31
+ deleteDeps.run(root);
32
+ for (const chunk of chunks) {
33
+ const contentHash = djb2Hash(chunk.content).toString(36);
34
+ insertChunk.run(chunk.filePath, root, contentHash, JSON.stringify(chunk.symbolDetails), JSON.stringify(chunk.dependencies), chunk.importance, chunk.type, chunk.tokenCount, Date.now());
35
+ }
36
+ for (const [source, targets] of dependencyGraph) {
37
+ for (const target of targets) {
38
+ insertDep.run(root, source, target);
39
+ }
40
+ }
41
+ });
42
+ transaction();
43
+ }
44
+ // =============================================================================
45
+ // LOAD
46
+ // =============================================================================
47
+ /**
48
+ * Load persisted codebase analysis from SQLite.
49
+ * Returns null if no analysis exists for the given workspace root.
50
+ */
51
+ export function loadCodebaseAnalysis(deps, root) {
52
+ if (!deps.features.codebaseAnalysis)
53
+ return null;
54
+ const { db } = deps;
55
+ const rows = db.prepare('SELECT * FROM codebase_chunks WHERE workspace_root = ?').all(root);
56
+ if (rows.length === 0)
57
+ return null;
58
+ const chunks = new Map();
59
+ for (const row of rows) {
60
+ chunks.set(row.file_path, {
61
+ filePath: row.file_path,
62
+ contentHash: row.content_hash,
63
+ symbolsJson: row.symbols_json,
64
+ dependenciesJson: row.dependencies_json,
65
+ importance: row.importance,
66
+ chunkType: row.chunk_type,
67
+ tokenCount: row.token_count,
68
+ analyzedAt: row.analyzed_at,
69
+ });
70
+ }
71
+ const depRows = db.prepare('SELECT source_file, target_file FROM codebase_deps WHERE workspace_root = ?').all(root);
72
+ const depsMap = new Map();
73
+ for (const row of depRows) {
74
+ if (!depsMap.has(row.source_file)) {
75
+ depsMap.set(row.source_file, new Set());
76
+ }
77
+ depsMap.get(row.source_file).add(row.target_file);
78
+ }
79
+ return { chunks, deps: depsMap };
80
+ }
81
+ //# sourceMappingURL=codebase-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codebase-repository.js","sourceRoot":"","sources":["../../../../src/integrations/persistence/codebase-repository.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAsBtD,gFAAgF;AAChF,OAAO;AACP,gFAAgF;AAEhF;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAqB,EACrB,IAAY,EACZ,MAQE,EACF,eAAyC;IAEzC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB;QAAE,OAAO;IAE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ACD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAE,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACnC,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Goal Repository
3
+ *
4
+ * Goal CRUD operations and critical juncture tracking.
5
+ * Goals persist outside of context and survive compaction.
6
+ *
7
+ * Extracted from sqlite-store.ts as part of Phase 3c restructuring.
8
+ */
9
+ import type { Goal, GoalStatus, Juncture, JunctureType, SQLiteStoreDeps } from './sqlite-store.js';
10
+ /**
11
+ * Create a new goal for the current session.
12
+ * Goals persist outside of context and survive compaction.
13
+ * Returns undefined if goals feature is not available.
14
+ */
15
+ export declare function createGoal(deps: SQLiteStoreDeps, goalText: string, options?: {
16
+ priority?: number;
17
+ parentGoalId?: string;
18
+ progressTotal?: number;
19
+ metadata?: Record<string, unknown>;
20
+ }): string | undefined;
21
+ /**
22
+ * Update a goal's status or progress.
23
+ */
24
+ export declare function updateGoal(deps: SQLiteStoreDeps, goalId: string, updates: {
25
+ goalText?: string;
26
+ status?: GoalStatus;
27
+ priority?: number;
28
+ progressCurrent?: number;
29
+ progressTotal?: number;
30
+ metadata?: Record<string, unknown>;
31
+ }): void;
32
+ /**
33
+ * Mark a goal as completed.
34
+ */
35
+ export declare function completeGoal(deps: SQLiteStoreDeps, goalId: string): void;
36
+ /**
37
+ * Get a goal by ID.
38
+ */
39
+ export declare function getGoal(deps: SQLiteStoreDeps, goalId: string): Goal | undefined;
40
+ /**
41
+ * List all goals for a session.
42
+ */
43
+ export declare function listGoals(deps: SQLiteStoreDeps, sessionId?: string): Goal[];
44
+ /**
45
+ * List active goals for a session.
46
+ */
47
+ export declare function listActiveGoals(deps: SQLiteStoreDeps, sessionId?: string): Goal[];
48
+ /**
49
+ * Get a summary of the current goals for context injection.
50
+ * This is what gets recited to maintain goal awareness.
51
+ */
52
+ export declare function getGoalsSummary(deps: SQLiteStoreDeps, sessionId?: string): string;
53
+ /**
54
+ * Log a critical juncture (decision, failure, breakthrough, pivot).
55
+ * Returns -1 if goals feature is not available.
56
+ */
57
+ export declare function logJuncture(deps: SQLiteStoreDeps, type: JunctureType, description: string, options?: {
58
+ goalId?: string;
59
+ outcome?: string;
60
+ importance?: number;
61
+ context?: Record<string, unknown>;
62
+ }): number;
63
+ /**
64
+ * List junctures for a session.
65
+ */
66
+ export declare function listJunctures(deps: SQLiteStoreDeps, sessionId?: string, limit?: number): Juncture[];
67
+ /**
68
+ * Get recent critical junctures for context.
69
+ */
70
+ export declare function getJuncturesSummary(deps: SQLiteStoreDeps, sessionId?: string, limit?: number): string;
71
+ //# sourceMappingURL=goal-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"goal-repository.d.ts","sourceRoot":"","sources":["../../../../src/integrations/persistence/goal-repository.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAM3B;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,GACL,MAAM,GAAG,SAAS,CA4BpB;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,eAAe,EACrB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,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