@vybestack/llxprt-code-tools 0.10.0-nightly.260613.1adad3b34

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 (364) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +294 -0
  3. package/dist/.last_build +0 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +2 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/src/__tests__/fixtures/filesystem-tool-fixtures.d.ts +29 -0
  8. package/dist/src/__tests__/fixtures/filesystem-tool-fixtures.js +30 -0
  9. package/dist/src/__tests__/fixtures/filesystem-tool-fixtures.js.map +1 -0
  10. package/dist/src/__tests__/fixtures/key-storage-fixtures.d.ts +39 -0
  11. package/dist/src/__tests__/fixtures/key-storage-fixtures.js +53 -0
  12. package/dist/src/__tests__/fixtures/key-storage-fixtures.js.map +1 -0
  13. package/dist/src/__tests__/fixtures/provider-formatting-fixtures.d.ts +140 -0
  14. package/dist/src/__tests__/fixtures/provider-formatting-fixtures.js +157 -0
  15. package/dist/src/__tests__/fixtures/provider-formatting-fixtures.js.map +1 -0
  16. package/dist/src/__tests__/red-test-helpers.d.ts +14 -0
  17. package/dist/src/__tests__/red-test-helpers.js +18 -0
  18. package/dist/src/__tests__/red-test-helpers.js.map +1 -0
  19. package/dist/src/formatters/IToolFormatter.d.ts +84 -0
  20. package/dist/src/formatters/IToolFormatter.js +6 -0
  21. package/dist/src/formatters/IToolFormatter.js.map +1 -0
  22. package/dist/src/formatters/ToolFormatter.d.ts +94 -0
  23. package/dist/src/formatters/ToolFormatter.js +379 -0
  24. package/dist/src/formatters/ToolFormatter.js.map +1 -0
  25. package/dist/src/formatters/ToolIdStrategy.d.ts +79 -0
  26. package/dist/src/formatters/ToolIdStrategy.js +173 -0
  27. package/dist/src/formatters/ToolIdStrategy.js.map +1 -0
  28. package/dist/src/formatters/doubleEscapeUtils.d.ts +46 -0
  29. package/dist/src/formatters/doubleEscapeUtils.js +223 -0
  30. package/dist/src/formatters/doubleEscapeUtils.js.map +1 -0
  31. package/dist/src/formatters/index.d.ts +21 -0
  32. package/dist/src/formatters/index.js +12 -0
  33. package/dist/src/formatters/index.js.map +1 -0
  34. package/dist/src/formatters/toolIdNormalization.d.ts +28 -0
  35. package/dist/src/formatters/toolIdNormalization.js +97 -0
  36. package/dist/src/formatters/toolIdNormalization.js.map +1 -0
  37. package/dist/src/formatters/toolNameUtils.d.ts +43 -0
  38. package/dist/src/formatters/toolNameUtils.js +143 -0
  39. package/dist/src/formatters/toolNameUtils.js.map +1 -0
  40. package/dist/src/index.d.ts +88 -0
  41. package/dist/src/index.js +68 -0
  42. package/dist/src/index.js.map +1 -0
  43. package/dist/src/interfaces/IAsyncTaskService.d.ts +57 -0
  44. package/dist/src/interfaces/IAsyncTaskService.js +6 -0
  45. package/dist/src/interfaces/IAsyncTaskService.js.map +1 -0
  46. package/dist/src/interfaces/IIdeService.d.ts +62 -0
  47. package/dist/src/interfaces/IIdeService.js +6 -0
  48. package/dist/src/interfaces/IIdeService.js.map +1 -0
  49. package/dist/src/interfaces/ILspService.d.ts +54 -0
  50. package/dist/src/interfaces/ILspService.js +6 -0
  51. package/dist/src/interfaces/ILspService.js.map +1 -0
  52. package/dist/src/interfaces/IMcpToolService.d.ts +47 -0
  53. package/dist/src/interfaces/IMcpToolService.js +6 -0
  54. package/dist/src/interfaces/IMcpToolService.js.map +1 -0
  55. package/dist/src/interfaces/IPromptRegistryService.d.ts +51 -0
  56. package/dist/src/interfaces/IPromptRegistryService.js +6 -0
  57. package/dist/src/interfaces/IPromptRegistryService.js.map +1 -0
  58. package/dist/src/interfaces/ISettingsService.d.ts +50 -0
  59. package/dist/src/interfaces/ISettingsService.js +6 -0
  60. package/dist/src/interfaces/ISettingsService.js.map +1 -0
  61. package/dist/src/interfaces/IShellExecutionService.d.ts +55 -0
  62. package/dist/src/interfaces/IShellExecutionService.js +6 -0
  63. package/dist/src/interfaces/IShellExecutionService.js.map +1 -0
  64. package/dist/src/interfaces/IShellToolHost.d.ts +176 -0
  65. package/dist/src/interfaces/IShellToolHost.js +6 -0
  66. package/dist/src/interfaces/IShellToolHost.js.map +1 -0
  67. package/dist/src/interfaces/ISkillService.d.ts +69 -0
  68. package/dist/src/interfaces/ISkillService.js +6 -0
  69. package/dist/src/interfaces/ISkillService.js.map +1 -0
  70. package/dist/src/interfaces/IStorageService.d.ts +42 -0
  71. package/dist/src/interfaces/IStorageService.js +6 -0
  72. package/dist/src/interfaces/IStorageService.js.map +1 -0
  73. package/dist/src/interfaces/ISubagentService.d.ts +112 -0
  74. package/dist/src/interfaces/ISubagentService.js +6 -0
  75. package/dist/src/interfaces/ISubagentService.js.map +1 -0
  76. package/dist/src/interfaces/ITaskToolHost.d.ts +185 -0
  77. package/dist/src/interfaces/ITaskToolHost.js +6 -0
  78. package/dist/src/interfaces/ITaskToolHost.js.map +1 -0
  79. package/dist/src/interfaces/ITodoService.d.ts +79 -0
  80. package/dist/src/interfaces/ITodoService.js +6 -0
  81. package/dist/src/interfaces/ITodoService.js.map +1 -0
  82. package/dist/src/interfaces/IToolHost.d.ts +91 -0
  83. package/dist/src/interfaces/IToolHost.js +6 -0
  84. package/dist/src/interfaces/IToolHost.js.map +1 -0
  85. package/dist/src/interfaces/IToolKeyStorage.d.ts +62 -0
  86. package/dist/src/interfaces/IToolKeyStorage.js +6 -0
  87. package/dist/src/interfaces/IToolKeyStorage.js.map +1 -0
  88. package/dist/src/interfaces/IToolMessageBus.d.ts +63 -0
  89. package/dist/src/interfaces/IToolMessageBus.js +6 -0
  90. package/dist/src/interfaces/IToolMessageBus.js.map +1 -0
  91. package/dist/src/interfaces/IToolRegistryHost.d.ts +43 -0
  92. package/dist/src/interfaces/IToolRegistryHost.js +6 -0
  93. package/dist/src/interfaces/IToolRegistryHost.js.map +1 -0
  94. package/dist/src/interfaces/IWebSearchService.d.ts +16 -0
  95. package/dist/src/interfaces/IWebSearchService.js +7 -0
  96. package/dist/src/interfaces/IWebSearchService.js.map +1 -0
  97. package/dist/src/interfaces/index.d.ts +33 -0
  98. package/dist/src/interfaces/index.js +6 -0
  99. package/dist/src/interfaces/index.js.map +1 -0
  100. package/dist/src/tools/activate-skill.d.ts +26 -0
  101. package/dist/src/tools/activate-skill.js +121 -0
  102. package/dist/src/tools/activate-skill.js.map +1 -0
  103. package/dist/src/tools/apply-patch.d.ts +65 -0
  104. package/dist/src/tools/apply-patch.js +528 -0
  105. package/dist/src/tools/apply-patch.js.map +1 -0
  106. package/dist/src/tools/ast-edit/ast-config.d.ts +67 -0
  107. package/dist/src/tools/ast-edit/ast-config.js +72 -0
  108. package/dist/src/tools/ast-edit/ast-config.js.map +1 -0
  109. package/dist/src/tools/ast-edit/ast-edit-invocation.d.ts +40 -0
  110. package/dist/src/tools/ast-edit/ast-edit-invocation.js +410 -0
  111. package/dist/src/tools/ast-edit/ast-edit-invocation.js.map +1 -0
  112. package/dist/src/tools/ast-edit/ast-query-extractor.d.ts +21 -0
  113. package/dist/src/tools/ast-edit/ast-query-extractor.js +178 -0
  114. package/dist/src/tools/ast-edit/ast-query-extractor.js.map +1 -0
  115. package/dist/src/tools/ast-edit/ast-read-file-invocation.d.ts +26 -0
  116. package/dist/src/tools/ast-edit/ast-read-file-invocation.js +149 -0
  117. package/dist/src/tools/ast-edit/ast-read-file-invocation.js.map +1 -0
  118. package/dist/src/tools/ast-edit/constants.d.ts +30 -0
  119. package/dist/src/tools/ast-edit/constants.js +36 -0
  120. package/dist/src/tools/ast-edit/constants.js.map +1 -0
  121. package/dist/src/tools/ast-edit/context-collector.d.ts +25 -0
  122. package/dist/src/tools/ast-edit/context-collector.js +115 -0
  123. package/dist/src/tools/ast-edit/context-collector.js.map +1 -0
  124. package/dist/src/tools/ast-edit/context-optimizer.d.ts +29 -0
  125. package/dist/src/tools/ast-edit/context-optimizer.js +86 -0
  126. package/dist/src/tools/ast-edit/context-optimizer.js.map +1 -0
  127. package/dist/src/tools/ast-edit/cross-file-analyzer.d.ts +41 -0
  128. package/dist/src/tools/ast-edit/cross-file-analyzer.js +294 -0
  129. package/dist/src/tools/ast-edit/cross-file-analyzer.js.map +1 -0
  130. package/dist/src/tools/ast-edit/edit-calculator.d.ts +71 -0
  131. package/dist/src/tools/ast-edit/edit-calculator.js +249 -0
  132. package/dist/src/tools/ast-edit/edit-calculator.js.map +1 -0
  133. package/dist/src/tools/ast-edit/edit-helpers.d.ts +22 -0
  134. package/dist/src/tools/ast-edit/edit-helpers.js +36 -0
  135. package/dist/src/tools/ast-edit/edit-helpers.js.map +1 -0
  136. package/dist/src/tools/ast-edit/language-analysis.d.ts +19 -0
  137. package/dist/src/tools/ast-edit/language-analysis.js +123 -0
  138. package/dist/src/tools/ast-edit/language-analysis.js.map +1 -0
  139. package/dist/src/tools/ast-edit/local-context-analyzer.d.ts +84 -0
  140. package/dist/src/tools/ast-edit/local-context-analyzer.js +267 -0
  141. package/dist/src/tools/ast-edit/local-context-analyzer.js.map +1 -0
  142. package/dist/src/tools/ast-edit/repository-context-provider.d.ts +22 -0
  143. package/dist/src/tools/ast-edit/repository-context-provider.js +139 -0
  144. package/dist/src/tools/ast-edit/repository-context-provider.js.map +1 -0
  145. package/dist/src/tools/ast-edit/types.d.ts +155 -0
  146. package/dist/src/tools/ast-edit/types.js +7 -0
  147. package/dist/src/tools/ast-edit/types.js.map +1 -0
  148. package/dist/src/tools/ast-edit/workspace-context-provider.d.ts +22 -0
  149. package/dist/src/tools/ast-edit/workspace-context-provider.js +39 -0
  150. package/dist/src/tools/ast-edit/workspace-context-provider.js.map +1 -0
  151. package/dist/src/tools/ast-edit.d.ts +43 -0
  152. package/dist/src/tools/ast-edit.js +183 -0
  153. package/dist/src/tools/ast-edit.js.map +1 -0
  154. package/dist/src/tools/ast-grep.d.ts +22 -0
  155. package/dist/src/tools/ast-grep.js +291 -0
  156. package/dist/src/tools/ast-grep.js.map +1 -0
  157. package/dist/src/tools/check-async-tasks.d.ts +46 -0
  158. package/dist/src/tools/check-async-tasks.js +241 -0
  159. package/dist/src/tools/check-async-tasks.js.map +1 -0
  160. package/dist/src/tools/codesearch.d.ts +25 -0
  161. package/dist/src/tools/codesearch.js +153 -0
  162. package/dist/src/tools/codesearch.js.map +1 -0
  163. package/dist/src/tools/delete_line_range.d.ts +41 -0
  164. package/dist/src/tools/delete_line_range.js +238 -0
  165. package/dist/src/tools/delete_line_range.js.map +1 -0
  166. package/dist/src/tools/direct-web-fetch.d.ts +22 -0
  167. package/dist/src/tools/direct-web-fetch.js +215 -0
  168. package/dist/src/tools/direct-web-fetch.js.map +1 -0
  169. package/dist/src/tools/edit-utils.d.ts +53 -0
  170. package/dist/src/tools/edit-utils.js +250 -0
  171. package/dist/src/tools/edit-utils.js.map +1 -0
  172. package/dist/src/tools/edit.d.ts +70 -0
  173. package/dist/src/tools/edit.js +816 -0
  174. package/dist/src/tools/edit.js.map +1 -0
  175. package/dist/src/tools/exa-web-search.d.ts +27 -0
  176. package/dist/src/tools/exa-web-search.js +153 -0
  177. package/dist/src/tools/exa-web-search.js.map +1 -0
  178. package/dist/src/tools/glob.d.ts +55 -0
  179. package/dist/src/tools/glob.js +284 -0
  180. package/dist/src/tools/glob.js.map +1 -0
  181. package/dist/src/tools/google-web-fetch.d.ts +34 -0
  182. package/dist/src/tools/google-web-fetch.js +417 -0
  183. package/dist/src/tools/google-web-fetch.js.map +1 -0
  184. package/dist/src/tools/google-web-search-invocation.d.ts +53 -0
  185. package/dist/src/tools/google-web-search-invocation.js +180 -0
  186. package/dist/src/tools/google-web-search-invocation.js.map +1 -0
  187. package/dist/src/tools/google-web-search.d.ts +16 -0
  188. package/dist/src/tools/google-web-search.js +34 -0
  189. package/dist/src/tools/google-web-search.js.map +1 -0
  190. package/dist/src/tools/grep.d.ts +56 -0
  191. package/dist/src/tools/grep.js +883 -0
  192. package/dist/src/tools/grep.js.map +1 -0
  193. package/dist/src/tools/insert_at_line.d.ts +41 -0
  194. package/dist/src/tools/insert_at_line.js +287 -0
  195. package/dist/src/tools/insert_at_line.js.map +1 -0
  196. package/dist/src/tools/list-subagents.d.ts +31 -0
  197. package/dist/src/tools/list-subagents.js +122 -0
  198. package/dist/src/tools/list-subagents.js.map +1 -0
  199. package/dist/src/tools/ls.d.ts +71 -0
  200. package/dist/src/tools/ls.js +238 -0
  201. package/dist/src/tools/ls.js.map +1 -0
  202. package/dist/src/tools/memoryTool.d.ts +66 -0
  203. package/dist/src/tools/memoryTool.js +435 -0
  204. package/dist/src/tools/memoryTool.js.map +1 -0
  205. package/dist/src/tools/modifiable-tool.d.ts +37 -0
  206. package/dist/src/tools/modifiable-tool.js +120 -0
  207. package/dist/src/tools/modifiable-tool.js.map +1 -0
  208. package/dist/src/tools/read-file.d.ts +49 -0
  209. package/dist/src/tools/read-file.js +279 -0
  210. package/dist/src/tools/read-file.js.map +1 -0
  211. package/dist/src/tools/read-many-files.d.ts +60 -0
  212. package/dist/src/tools/read-many-files.js +529 -0
  213. package/dist/src/tools/read-many-files.js.map +1 -0
  214. package/dist/src/tools/read_line_range.d.ts +47 -0
  215. package/dist/src/tools/read_line_range.js +248 -0
  216. package/dist/src/tools/read_line_range.js.map +1 -0
  217. package/dist/src/tools/ripGrep.d.ts +41 -0
  218. package/dist/src/tools/ripGrep.js +395 -0
  219. package/dist/src/tools/ripGrep.js.map +1 -0
  220. package/dist/src/tools/shell.d.ts +60 -0
  221. package/dist/src/tools/shell.js +735 -0
  222. package/dist/src/tools/shell.js.map +1 -0
  223. package/dist/src/tools/structural-analysis.d.ts +27 -0
  224. package/dist/src/tools/structural-analysis.js +1089 -0
  225. package/dist/src/tools/structural-analysis.js.map +1 -0
  226. package/dist/src/tools/stubs.d.ts +10 -0
  227. package/dist/src/tools/stubs.js +6 -0
  228. package/dist/src/tools/stubs.js.map +1 -0
  229. package/dist/src/tools/task.d.ts +41 -0
  230. package/dist/src/tools/task.js +195 -0
  231. package/dist/src/tools/task.js.map +1 -0
  232. package/dist/src/tools/todo-events.d.ts +22 -0
  233. package/dist/src/tools/todo-events.js +24 -0
  234. package/dist/src/tools/todo-events.js.map +1 -0
  235. package/dist/src/tools/todo-pause.d.ts +29 -0
  236. package/dist/src/tools/todo-pause.js +172 -0
  237. package/dist/src/tools/todo-pause.js.map +1 -0
  238. package/dist/src/tools/todo-read.d.ts +18 -0
  239. package/dist/src/tools/todo-read.js +98 -0
  240. package/dist/src/tools/todo-read.js.map +1 -0
  241. package/dist/src/tools/todo-store.d.ts +35 -0
  242. package/dist/src/tools/todo-store.js +124 -0
  243. package/dist/src/tools/todo-store.js.map +1 -0
  244. package/dist/src/tools/todo-write.d.ts +29 -0
  245. package/dist/src/tools/todo-write.js +366 -0
  246. package/dist/src/tools/todo-write.js.map +1 -0
  247. package/dist/src/tools/tool-registry.d.ts +156 -0
  248. package/dist/src/tools/tool-registry.js +623 -0
  249. package/dist/src/tools/tool-registry.js.map +1 -0
  250. package/dist/src/tools/tools.d.ts +403 -0
  251. package/dist/src/tools/tools.js +519 -0
  252. package/dist/src/tools/tools.js.map +1 -0
  253. package/dist/src/tools/write-file.d.ts +45 -0
  254. package/dist/src/tools/write-file.js +320 -0
  255. package/dist/src/tools/write-file.js.map +1 -0
  256. package/dist/src/types/index.d.ts +17 -0
  257. package/dist/src/types/index.js +9 -0
  258. package/dist/src/types/index.js.map +1 -0
  259. package/dist/src/types/provider-content-types.d.ts +56 -0
  260. package/dist/src/types/provider-content-types.js +6 -0
  261. package/dist/src/types/provider-content-types.js.map +1 -0
  262. package/dist/src/types/todo-schemas.d.ts +263 -0
  263. package/dist/src/types/todo-schemas.js +32 -0
  264. package/dist/src/types/todo-schemas.js.map +1 -0
  265. package/dist/src/types/tool-confirmation-types.d.ts +34 -0
  266. package/dist/src/types/tool-confirmation-types.js +29 -0
  267. package/dist/src/types/tool-confirmation-types.js.map +1 -0
  268. package/dist/src/types/tool-context.d.ts +31 -0
  269. package/dist/src/types/tool-context.js +6 -0
  270. package/dist/src/types/tool-context.js.map +1 -0
  271. package/dist/src/types/tool-error.d.ts +69 -0
  272. package/dist/src/types/tool-error.js +94 -0
  273. package/dist/src/types/tool-error.js.map +1 -0
  274. package/dist/src/types/tool-names.d.ts +57 -0
  275. package/dist/src/types/tool-names.js +64 -0
  276. package/dist/src/types/tool-names.js.map +1 -0
  277. package/dist/src/utils/EmojiFilter.d.ts +134 -0
  278. package/dist/src/utils/EmojiFilter.js +370 -0
  279. package/dist/src/utils/EmojiFilter.js.map +1 -0
  280. package/dist/src/utils/ast-grep-utils.d.ts +42 -0
  281. package/dist/src/utils/ast-grep-utils.js +140 -0
  282. package/dist/src/utils/ast-grep-utils.js.map +1 -0
  283. package/dist/src/utils/debugLogger.d.ts +11 -0
  284. package/dist/src/utils/debugLogger.js +16 -0
  285. package/dist/src/utils/debugLogger.js.map +1 -0
  286. package/dist/src/utils/diffOptions.d.ts +14 -0
  287. package/dist/src/utils/diffOptions.js +46 -0
  288. package/dist/src/utils/diffOptions.js.map +1 -0
  289. package/dist/src/utils/editor.d.ts +39 -0
  290. package/dist/src/utils/editor.js +212 -0
  291. package/dist/src/utils/editor.js.map +1 -0
  292. package/dist/src/utils/ensure-dirs.d.ts +10 -0
  293. package/dist/src/utils/ensure-dirs.js +16 -0
  294. package/dist/src/utils/ensure-dirs.js.map +1 -0
  295. package/dist/src/utils/errors.d.ts +59 -0
  296. package/dist/src/utils/errors.js +178 -0
  297. package/dist/src/utils/errors.js.map +1 -0
  298. package/dist/src/utils/fetch.d.ts +11 -0
  299. package/dist/src/utils/fetch.js +74 -0
  300. package/dist/src/utils/fetch.js.map +1 -0
  301. package/dist/src/utils/fileUtils.d.ts +32 -0
  302. package/dist/src/utils/fileUtils.js +363 -0
  303. package/dist/src/utils/fileUtils.js.map +1 -0
  304. package/dist/src/utils/fuzzy-replacer.d.ts +61 -0
  305. package/dist/src/utils/fuzzy-replacer.js +492 -0
  306. package/dist/src/utils/fuzzy-replacer.js.map +1 -0
  307. package/dist/src/utils/gitLineChanges.d.ts +12 -0
  308. package/dist/src/utils/gitLineChanges.js +171 -0
  309. package/dist/src/utils/gitLineChanges.js.map +1 -0
  310. package/dist/src/utils/gitUtils.d.ts +6 -0
  311. package/dist/src/utils/gitUtils.js +31 -0
  312. package/dist/src/utils/gitUtils.js.map +1 -0
  313. package/dist/src/utils/lsp-diagnostics-helper.d.ts +27 -0
  314. package/dist/src/utils/lsp-diagnostics-helper.js +62 -0
  315. package/dist/src/utils/lsp-diagnostics-helper.js.map +1 -0
  316. package/dist/src/utils/mediaUtils.d.ts +38 -0
  317. package/dist/src/utils/mediaUtils.js +22 -0
  318. package/dist/src/utils/mediaUtils.js.map +1 -0
  319. package/dist/src/utils/pathValidation.d.ts +7 -0
  320. package/dist/src/utils/pathValidation.js +39 -0
  321. package/dist/src/utils/pathValidation.js.map +1 -0
  322. package/dist/src/utils/paths.d.ts +7 -0
  323. package/dist/src/utils/paths.js +158 -0
  324. package/dist/src/utils/paths.js.map +1 -0
  325. package/dist/src/utils/resolveTextSearchTarget.d.ts +17 -0
  326. package/dist/src/utils/resolveTextSearchTarget.js +45 -0
  327. package/dist/src/utils/resolveTextSearchTarget.js.map +1 -0
  328. package/dist/src/utils/retry.d.ts +17 -0
  329. package/dist/src/utils/retry.js +185 -0
  330. package/dist/src/utils/retry.js.map +1 -0
  331. package/dist/src/utils/ripgrepPathResolver.d.ts +23 -0
  332. package/dist/src/utils/ripgrepPathResolver.js +179 -0
  333. package/dist/src/utils/ripgrepPathResolver.js.map +1 -0
  334. package/dist/src/utils/safeJsonStringify.d.ts +9 -0
  335. package/dist/src/utils/safeJsonStringify.js +21 -0
  336. package/dist/src/utils/safeJsonStringify.js.map +1 -0
  337. package/dist/src/utils/schemaValidator.d.ts +13 -0
  338. package/dist/src/utils/schemaValidator.js +275 -0
  339. package/dist/src/utils/schemaValidator.js.map +1 -0
  340. package/dist/src/utils/terminalSerializer.d.ts +33 -0
  341. package/dist/src/utils/terminalSerializer.js +6 -0
  342. package/dist/src/utils/terminalSerializer.js.map +1 -0
  343. package/dist/src/utils/todoContextTracker.d.ts +12 -0
  344. package/dist/src/utils/todoContextTracker.js +28 -0
  345. package/dist/src/utils/todoContextTracker.js.map +1 -0
  346. package/dist/src/utils/todoFormatter.d.ts +24 -0
  347. package/dist/src/utils/todoFormatter.js +157 -0
  348. package/dist/src/utils/todoFormatter.js.map +1 -0
  349. package/dist/src/utils/todoReminderService.d.ts +22 -0
  350. package/dist/src/utils/todoReminderService.js +43 -0
  351. package/dist/src/utils/todoReminderService.js.map +1 -0
  352. package/dist/src/utils/tool-key-storage-facade.d.ts +32 -0
  353. package/dist/src/utils/tool-key-storage-facade.js +56 -0
  354. package/dist/src/utils/tool-key-storage-facade.js.map +1 -0
  355. package/dist/src/utils/tool-key-storage-types.d.ts +56 -0
  356. package/dist/src/utils/tool-key-storage-types.js +56 -0
  357. package/dist/src/utils/tool-key-storage-types.js.map +1 -0
  358. package/dist/src/utils/toolOutputLimiter.d.ts +29 -0
  359. package/dist/src/utils/toolOutputLimiter.js +107 -0
  360. package/dist/src/utils/toolOutputLimiter.js.map +1 -0
  361. package/dist/src/utils/unicodeUtils.d.ts +55 -0
  362. package/dist/src/utils/unicodeUtils.js +129 -0
  363. package/dist/src/utils/unicodeUtils.js.map +1 -0
  364. package/package.json +75 -0
@@ -0,0 +1,403 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { type FunctionDeclaration, type PartListUnion } from '@google/genai';
7
+ import type { IToolMessageBus } from '../interfaces/IToolMessageBus.js';
8
+ import type { DiffUpdateResult } from '../interfaces/IIdeService.js';
9
+ import type { AnsiOutput } from '../utils/terminalSerializer.js';
10
+ import type { ContextAwareTool, ToolContext } from '../types/tool-context.js';
11
+ import { ToolConfirmationOutcome, type ToolConfirmationPayload } from '../types/tool-confirmation-types.js';
12
+ import { ToolErrorType } from '../types/tool-error.js';
13
+ export { ToolConfirmationOutcome } from '../types/tool-confirmation-types.js';
14
+ export type { ToolConfirmationPayload } from '../types/tool-confirmation-types.js';
15
+ /**
16
+ * Represents a validated and ready-to-execute tool call.
17
+ * An instance of this is created by a `ToolBuilder`.
18
+ */
19
+ export interface ToolInvocation<TParams extends object, TResult extends ToolResult> {
20
+ /**
21
+ * The validated parameters for this specific invocation.
22
+ */
23
+ params: TParams;
24
+ /**
25
+ * Gets a pre-execution description of the tool operation.
26
+ *
27
+ * @returns A markdown string describing what the tool will do.
28
+ */
29
+ getDescription(): string;
30
+ /**
31
+ * Determines what file system paths the tool will affect.
32
+ * @returns A list of such paths.
33
+ */
34
+ toolLocations(): ToolLocation[];
35
+ /**
36
+ * Determines if the tool should prompt for confirmation before execution.
37
+ * @returns Confirmation details or false if no confirmation is needed.
38
+ */
39
+ shouldConfirmExecute(abortSignal: AbortSignal): Promise<ToolCallConfirmationDetails | false>;
40
+ /**
41
+ * Executes the tool with the validated parameters.
42
+ * @param signal AbortSignal for tool cancellation.
43
+ * @param updateOutput Optional callback to stream output.
44
+ * @param terminalColumns Optional terminal width for PTY mode.
45
+ * @param terminalRows Optional terminal height for PTY mode.
46
+ * @param setPidCallback Optional callback to propagate PTY PID.
47
+ * @returns Result of the tool execution.
48
+ */
49
+ execute(signal: AbortSignal, updateOutput?: (output: string | AnsiOutput) => void, terminalColumns?: number, terminalRows?: number, setPidCallback?: (pid: number) => void): Promise<TResult>;
50
+ }
51
+ /**
52
+ * Options for policy updates that can be customized by tool invocations.
53
+ */
54
+ export interface PolicyUpdateOptions {
55
+ persist?: boolean;
56
+ commandPrefix?: string | string[];
57
+ mcpName?: string;
58
+ }
59
+ /**
60
+ * A convenience base class for ToolInvocation.
61
+ */
62
+ export declare abstract class BaseToolInvocation<TParams extends object, TResult extends ToolResult> implements ToolInvocation<TParams, TResult> {
63
+ readonly params: TParams;
64
+ protected readonly messageBus?: IToolMessageBus | undefined;
65
+ readonly _toolName?: string | undefined;
66
+ readonly _toolDisplayName?: string | undefined;
67
+ readonly _serverName?: string | undefined;
68
+ constructor(params: TParams, messageBus?: IToolMessageBus | undefined, _toolName?: string | undefined, _toolDisplayName?: string | undefined, _serverName?: string | undefined);
69
+ protected requireMessageBus(): any;
70
+ abstract getDescription(): string;
71
+ toolLocations(): ToolLocation[];
72
+ /**
73
+ * Returns confirmation details for this tool invocation.
74
+ * Tools that require confirmation should override this method.
75
+ * @returns Confirmation details or null if no confirmation needed.
76
+ */
77
+ /**
78
+ * Returns tool-specific options for policy updates.
79
+ * Subclasses can override this to provide additional options like
80
+ * commandPrefix (for shell) or mcpName (for MCP tools).
81
+ */
82
+ protected getPolicyUpdateOptions(_outcome: ToolConfirmationOutcome): PolicyUpdateOptions | undefined;
83
+ /**
84
+ * Helper method to publish a policy update when user selects
85
+ * ProceedAlways or ProceedAlwaysAndSave.
86
+ */
87
+ protected publishPolicyUpdate(outcome: ToolConfirmationOutcome): Promise<void>;
88
+ protected getConfirmationDetails(): ToolCallConfirmationDetails | null;
89
+ /**
90
+ * Attempts to obtain a policy decision via message bus.
91
+ *
92
+ * Semantics:
93
+ * - `'ALLOW'`: auto-proceed
94
+ * - `'DENY'`: tool must not execute
95
+ * - `'ASK_USER'`: fall back to legacy tool confirmation UI
96
+ */
97
+ protected getMessageBusDecision(abortSignal: AbortSignal): Promise<'ALLOW' | 'DENY' | 'ASK_USER'>;
98
+ private getInterfaceMessageBusDecision;
99
+ /**
100
+ * Returns the tool name for this invocation.
101
+ * Subclasses can override to provide a specific tool name.
102
+ */
103
+ protected getToolName(): string;
104
+ /**
105
+ * Returns the server name for MCP tools.
106
+ * Regular tools should return undefined.
107
+ */
108
+ protected getServerName(): string | undefined;
109
+ /**
110
+ * Returns metadata used by the policy engine/message bus.
111
+ */
112
+ getPolicyContext(): {
113
+ toolName: string;
114
+ args: Record<string, unknown>;
115
+ serverName?: string;
116
+ };
117
+ shouldConfirmExecute(_abortSignal: AbortSignal): Promise<ToolCallConfirmationDetails | false>;
118
+ abstract execute(signal: AbortSignal, updateOutput?: (output: string | AnsiOutput) => void, terminalColumns?: number, terminalRows?: number, setPidCallback?: (pid: number) => void): Promise<TResult>;
119
+ }
120
+ /**
121
+ * A type alias for a tool invocation where the specific parameter and result types are not known.
122
+ */
123
+ export type AnyToolInvocation = ToolInvocation<object, ToolResult>;
124
+ /**
125
+ * Interface for a tool builder that validates parameters and creates invocations.
126
+ */
127
+ export interface ToolBuilder<TParams extends object, TResult extends ToolResult> {
128
+ /**
129
+ * The internal name of the tool (used for API calls).
130
+ */
131
+ name: string;
132
+ /**
133
+ * The user-friendly display name of the tool.
134
+ */
135
+ displayName: string;
136
+ /**
137
+ * Description of what the tool does.
138
+ */
139
+ description: string;
140
+ /**
141
+ * The kind of tool for categorization and permissions
142
+ */
143
+ kind: Kind;
144
+ /**
145
+ * Function declaration schema from @google/genai.
146
+ */
147
+ schema: FunctionDeclaration;
148
+ /**
149
+ * Whether the tool's output should be rendered as markdown.
150
+ */
151
+ isOutputMarkdown: boolean;
152
+ /**
153
+ * Whether the tool supports live (streaming) output.
154
+ */
155
+ canUpdateOutput: boolean;
156
+ /**
157
+ * Validates raw parameters and builds a ready-to-execute invocation.
158
+ * @param params The raw, untrusted parameters from the model.
159
+ * @returns A valid `ToolInvocation` if successful. Throws an error if validation fails.
160
+ */
161
+ build(params: TParams): ToolInvocation<TParams, TResult>;
162
+ }
163
+ /**
164
+ * New base class for tools that separates validation from execution.
165
+ * New tools should extend this class.
166
+ */
167
+ export declare abstract class DeclarativeTool<TParams extends object, TResult extends ToolResult> implements ToolBuilder<TParams, TResult> {
168
+ readonly name: string;
169
+ readonly displayName: string;
170
+ readonly description: string;
171
+ readonly kind: Kind;
172
+ readonly parameterSchema: unknown;
173
+ readonly isOutputMarkdown: boolean;
174
+ readonly canUpdateOutput: boolean;
175
+ protected readonly messageBus?: IToolMessageBus;
176
+ constructor(name: string, displayName: string, description: string, kind: Kind, parameterSchema: unknown, isOutputMarkdown?: boolean, canUpdateOutput?: boolean, messageBus?: IToolMessageBus);
177
+ /**
178
+ * @plan PLAN-20260309-MESSAGEBUS-DI-REMEDIATION.P11
179
+ * @requirement REQ-D01-002
180
+ * @requirement REQ-D01-003
181
+ * @pseudocode lines 122-133
182
+ */
183
+ protected requireMessageBus(): any;
184
+ get schema(): FunctionDeclaration;
185
+ /**
186
+ * Validates the raw tool parameters.
187
+ * Subclasses should override this to add custom validation logic
188
+ * beyond the JSON schema check.
189
+ * @param params The raw parameters from the model.
190
+ * @returns An error message string if invalid, null otherwise.
191
+ */
192
+ validateToolParams(_params: TParams): string | null;
193
+ /**
194
+ * The core of the new pattern. It validates parameters and, if successful,
195
+ * returns a `ToolInvocation` object that encapsulates the logic for the
196
+ * specific, validated call.
197
+ * @param params The raw, untrusted parameters from the model.
198
+ * @returns A `ToolInvocation` instance.
199
+ */
200
+ abstract build(params: TParams): ToolInvocation<TParams, TResult>;
201
+ /**
202
+ * A convenience method that builds and executes the tool in one step.
203
+ * Throws an error if validation fails.
204
+ * @param params The raw, untrusted parameters from the model.
205
+ * @param signal AbortSignal for tool cancellation.
206
+ * @param updateOutput Optional callback to stream output.
207
+ * @returns The result of the tool execution.
208
+ */
209
+ buildAndExecute(params: TParams, signal: AbortSignal, updateOutput?: (output: string | AnsiOutput) => void): Promise<TResult>;
210
+ /**
211
+ * Similar to `build` but never throws.
212
+ * @param params The raw, untrusted parameters from the model.
213
+ * @returns A `ToolInvocation` instance.
214
+ */
215
+ private silentBuild;
216
+ /**
217
+ * A convenience method that builds and executes the tool in one step.
218
+ * Never throws.
219
+ * @param params The raw, untrusted parameters from the model.
220
+ * @param abortSignal a signal to abort.
221
+ * @returns The result of the tool execution.
222
+ */
223
+ validateBuildAndExecute(params: TParams, abortSignal: AbortSignal): Promise<ToolResult>;
224
+ }
225
+ /**
226
+ * New base class for declarative tools that separates validation from execution.
227
+ * New tools should extend this class, which provides a `build` method that
228
+ * validates parameters before deferring to a `createInvocation` method for
229
+ * the final `ToolInvocation` object instantiation.
230
+ */
231
+ export declare abstract class BaseDeclarativeTool<TParams extends object, TResult extends ToolResult> extends DeclarativeTool<TParams, TResult> {
232
+ build(params: TParams): ToolInvocation<TParams, TResult>;
233
+ validateToolParams(params: TParams): string | null;
234
+ protected validateToolParamValues(_params: TParams): string | null;
235
+ protected abstract createInvocation(params: TParams, messageBus?: any): ToolInvocation<TParams, TResult>;
236
+ }
237
+ /**
238
+ * A type alias for a declarative tool where the specific parameter and result types are not known.
239
+ */
240
+ export type AnyDeclarativeTool = DeclarativeTool<object, ToolResult>;
241
+ /**
242
+ * Type guard to check if an object is a Tool.
243
+ * @param obj The object to check.
244
+ * @returns True if the object is a Tool, false otherwise.
245
+ */
246
+ export declare function isTool(obj: unknown): obj is AnyDeclarativeTool;
247
+ export interface ToolResult {
248
+ /**
249
+ * Content meant to be included in LLM history.
250
+ * This should represent the factual outcome of the tool execution.
251
+ */
252
+ llmContent: PartListUnion;
253
+ /**
254
+ * Markdown string for user display.
255
+ * This provides a user-friendly summary or visualization of the result.
256
+ * NOTE: This might also be considered UI-specific and could potentially be
257
+ * removed or modified in a further refactor if the server becomes purely API-driven.
258
+ * For now, we keep it as the core logic in ReadFileTool currently produces it.
259
+ */
260
+ returnDisplay: ToolResultDisplay;
261
+ /**
262
+ * Optional metadata about the tool execution
263
+ */
264
+ metadata?: Record<string, unknown>;
265
+ /**
266
+ * If this property is present, the tool call is considered a failure.
267
+ */
268
+ error?: {
269
+ message: string;
270
+ type?: ToolErrorType;
271
+ };
272
+ /**
273
+ * Optional flag to suppress display of this tool result
274
+ * @requirement:HOOK-132 - AfterTool suppressOutput support
275
+ */
276
+ suppressDisplay?: boolean;
277
+ }
278
+ /**
279
+ * Detects cycles in a JSON schemas due to `$ref`s.
280
+ * @param schema The root of the JSON schema.
281
+ * @returns `true` if a cycle is detected, `false` otherwise.
282
+ */
283
+ export declare function hasCycleInSchema(schema: object): boolean;
284
+ export interface FileRead {
285
+ content: string;
286
+ fileName: string;
287
+ filePath: string;
288
+ metadata?: Record<string, unknown>;
289
+ }
290
+ export type ToolResultDisplay = string | FileDiff | FileRead | AnsiOutput;
291
+ export interface FileDiff {
292
+ fileDiff: string;
293
+ fileName: string;
294
+ filePath?: string;
295
+ originalContent: string | null;
296
+ newContent: string;
297
+ diffStat?: DiffStat;
298
+ metadata?: Record<string, unknown>;
299
+ applied?: boolean;
300
+ isNewFile?: boolean;
301
+ }
302
+ export interface DiffStat {
303
+ ai_removed_lines: number;
304
+ ai_added_lines: number;
305
+ user_added_lines: number;
306
+ user_removed_lines: number;
307
+ }
308
+ export interface ToolEditConfirmationDetails {
309
+ type: 'edit';
310
+ title: string;
311
+ onConfirm: (outcome: ToolConfirmationOutcome, payload?: ToolConfirmationPayload) => Promise<void>;
312
+ fileName: string;
313
+ filePath: string;
314
+ fileDiff: string;
315
+ originalContent: string | null;
316
+ newContent: string;
317
+ isModifying?: boolean;
318
+ ideConfirmation?: Promise<DiffUpdateResult>;
319
+ correlationId?: string;
320
+ metadata?: Record<string, unknown>;
321
+ }
322
+ export interface ToolExecuteConfirmationDetails {
323
+ type: 'exec';
324
+ title: string;
325
+ onConfirm: (outcome: ToolConfirmationOutcome, payload?: ToolConfirmationPayload) => Promise<void>;
326
+ command: string;
327
+ rootCommand: string;
328
+ rootCommands: string[];
329
+ commands?: string[];
330
+ correlationId?: string;
331
+ }
332
+ export interface ToolMcpConfirmationDetails {
333
+ type: 'mcp';
334
+ title: string;
335
+ serverName: string;
336
+ toolName: string;
337
+ toolDisplayName: string;
338
+ onConfirm: (outcome: ToolConfirmationOutcome, payload?: ToolConfirmationPayload) => Promise<void>;
339
+ correlationId?: string;
340
+ }
341
+ export interface ToolInfoConfirmationDetails {
342
+ type: 'info';
343
+ title: string;
344
+ onConfirm: (outcome: ToolConfirmationOutcome, payload?: ToolConfirmationPayload) => Promise<void>;
345
+ prompt: string;
346
+ urls?: string[];
347
+ correlationId?: string;
348
+ }
349
+ export type ToolCallConfirmationDetails = ToolEditConfirmationDetails | ToolExecuteConfirmationDetails | ToolMcpConfirmationDetails | ToolInfoConfirmationDetails;
350
+ export declare enum Kind {
351
+ Read = "read",
352
+ Edit = "edit",
353
+ Delete = "delete",
354
+ Move = "move",
355
+ Search = "search",
356
+ Execute = "execute",
357
+ Think = "think",
358
+ Fetch = "fetch",
359
+ Other = "other"
360
+ }
361
+ export interface ToolLocation {
362
+ path: string;
363
+ line?: number;
364
+ }
365
+ /**
366
+ * Legacy BaseTool class for backward compatibility with existing LLxprt tools.
367
+ * New tools should use BaseDeclarativeTool instead.
368
+ * @deprecated Use BaseDeclarativeTool for new tools
369
+ */
370
+ export declare abstract class BaseTool<TParams extends object, TResult extends ToolResult> extends DeclarativeTool<TParams, TResult> implements ContextAwareTool {
371
+ context?: ToolContext;
372
+ constructor(name: string, displayName: string, description: string, kind: Kind, parameterSchema: unknown, isOutputMarkdown?: boolean, canUpdateOutput?: boolean, messageBus?: IToolMessageBus);
373
+ /**
374
+ * Get the schema for this tool. Maintains backward compatibility.
375
+ */
376
+ get schema(): FunctionDeclaration;
377
+ /**
378
+ * Legacy method signature for getDescription.
379
+ * Subclasses can override this method.
380
+ */
381
+ getDescription(_params: TParams): string;
382
+ /**
383
+ * Legacy method signature for validateToolParams.
384
+ * Subclasses can override this method.
385
+ * Note: The base class expects TParams, but legacy tools pass unknown.
386
+ */
387
+ validateToolParams(params: TParams): string | null;
388
+ /**
389
+ * Legacy validateToolParams method that accepts unknown params.
390
+ * This maintains compatibility with existing tool implementations.
391
+ */
392
+ validateToolParamsLegacy?(params: unknown): string | null;
393
+ /**
394
+ * Legacy execute method signature.
395
+ * Subclasses should implement this method.
396
+ */
397
+ abstract execute(params: TParams, signal: AbortSignal, updateOutput?: (output: string) => void): Promise<TResult>;
398
+ /**
399
+ * Implementation of the new declarative pattern.
400
+ * Creates a tool invocation that bridges to the legacy execute method.
401
+ */
402
+ build(params: TParams): ToolInvocation<TParams, TResult>;
403
+ }