@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,529 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { BaseDeclarativeTool, BaseToolInvocation, Kind, } from './tools.js';
7
+ import { getErrorMessage } from '../utils/errors.js';
8
+ import * as fs from 'fs';
9
+ import * as path from 'path';
10
+ import { glob, escape as globEscape } from 'glob';
11
+ import { detectFileType, processSingleFileContent, DEFAULT_ENCODING, getSpecificMimeType, DEFAULT_MAX_LINES_TEXT_FILE, } from '../utils/fileUtils.js';
12
+ import { stat } from 'fs/promises';
13
+ import { ToolErrorType } from '../types/tool-error.js';
14
+ import { validatePathWithinWorkspace } from '../utils/pathValidation.js';
15
+ // Simple token estimation - roughly 4 characters per token
16
+ function estimateTokens(text) {
17
+ return Math.ceil(text.length / 4);
18
+ }
19
+ /**
20
+ * Creates the default exclusion patterns including dynamic patterns.
21
+ * This combines the shared patterns with dynamic patterns like LLXPRT.md.
22
+ * Task(adh): Consider making this configurable or extendable through a command line argument.
23
+ */
24
+ function getDefaultExcludes(host) {
25
+ return host?.getReadManyFilesExclusions() ?? [];
26
+ }
27
+ const DEFAULT_OUTPUT_SEPARATOR_FORMAT = '--- {filePath} ---';
28
+ const DEFAULT_OUTPUT_TERMINATOR = '\n--- End of content ---';
29
+ // Default limits for ReadManyFiles
30
+ const DEFAULT_MAX_FILE_COUNT = 50;
31
+ const DEFAULT_MAX_TOKENS = 50000;
32
+ const DEFAULT_TRUNCATE_MODE = 'warn';
33
+ const DEFAULT_FILE_SIZE_LIMIT = 524288; // 512KB
34
+ class ReadManyFilesToolInvocation extends BaseToolInvocation {
35
+ host;
36
+ llxprtIgnorePatterns = [];
37
+ constructor(host, params, messageBus) {
38
+ super(params, messageBus);
39
+ this.host = host;
40
+ this.llxprtIgnorePatterns = host.getLlxprtIgnorePatterns();
41
+ }
42
+ getDescription() {
43
+ const allPatterns = [...this.params.paths, ...(this.params.include ?? [])];
44
+ const pathDesc = `using patterns:
45
+ ${allPatterns.join('`, `')}
46
+ (within target directory:
47
+ ${this.host.getTargetDir()}
48
+ ) `;
49
+ // Determine the final list of exclusion patterns exactly as in execute method
50
+ const paramExcludes = this.params.exclude ?? [];
51
+ const paramUseDefaultExcludes = this.params.useDefaultExcludes !== false;
52
+ const finalExclusionPatternsForDescription = paramUseDefaultExcludes
53
+ ? [...getDefaultExcludes(this.host), ...paramExcludes]
54
+ : [...paramExcludes];
55
+ const excludeDesc = `Excluding: ${finalExclusionPatternsForDescription.length > 0
56
+ ? `patterns like
57
+ ${finalExclusionPatternsForDescription.slice(0, 2).join('`, `')}${finalExclusionPatternsForDescription.length > 2 ? '...`' : '`'}`
58
+ : 'none specified'}`;
59
+ return `Will attempt to read and concatenate files ${pathDesc}. ${excludeDesc}. File encoding: ${DEFAULT_ENCODING}. Separator: "${DEFAULT_OUTPUT_SEPARATOR_FORMAT.replace('{filePath}', 'path/to/file.ext')}".`;
60
+ }
61
+ async execute(signal) {
62
+ const { paths: inputPatterns, include = [], exclude = [], useDefaultExcludes = true, } = this.params;
63
+ const { fileFilteringOptions, fileDiscovery, effectiveExcludes } = this.resolveFileParams(useDefaultExcludes, exclude);
64
+ const filesToConsider = new Set();
65
+ const skippedFiles = [];
66
+ const processedFilesRelativePaths = [];
67
+ const contentParts = [];
68
+ const searchResult = await this.discoverFiles(inputPatterns, include, effectiveExcludes, fileFilteringOptions, fileDiscovery, filesToConsider, skippedFiles, signal);
69
+ if (searchResult) {
70
+ return searchResult;
71
+ }
72
+ const sortedFiles = Array.from(filesToConsider).sort();
73
+ const limits = this.resolveLimits();
74
+ const fileCountResult = this.applyFileCountLimit(sortedFiles, skippedFiles, limits);
75
+ if (fileCountResult) {
76
+ return fileCountResult;
77
+ }
78
+ return this.processAndFormat(sortedFiles, inputPatterns, skippedFiles, processedFilesRelativePaths, contentParts, limits);
79
+ }
80
+ resolveFileParams(useDefaultExcludes, exclude) {
81
+ const defaultFileIgnores = this.host.getFileFilteringOptions();
82
+ const fileFilteringOptions = {
83
+ respectGitIgnore: this.params.file_filtering_options?.respect_git_ignore ??
84
+ defaultFileIgnores.respectGitIgnore,
85
+ respectLlxprtIgnore: this.params.file_filtering_options?.respect_llxprt_ignore ??
86
+ defaultFileIgnores.respectLlxprtIgnore,
87
+ };
88
+ const fileDiscovery = this.host.getFileService();
89
+ const effectiveExcludes = useDefaultExcludes
90
+ ? [
91
+ ...getDefaultExcludes(this.host),
92
+ ...exclude,
93
+ ...this.llxprtIgnorePatterns,
94
+ ]
95
+ : [...exclude, ...this.llxprtIgnorePatterns];
96
+ return { fileFilteringOptions, fileDiscovery, effectiveExcludes };
97
+ }
98
+ async processAndFormat(sortedFiles, inputPatterns, skippedFiles, processedFilesRelativePaths, contentParts, limits) {
99
+ const totalTokens = await this.processFiles(sortedFiles, inputPatterns, skippedFiles, processedFilesRelativePaths, contentParts, limits);
100
+ const displayMessage = this.buildDisplayMessage(processedFilesRelativePaths, skippedFiles, totalTokens);
101
+ if (contentParts.length > 0) {
102
+ contentParts.push(DEFAULT_OUTPUT_TERMINATOR);
103
+ }
104
+ else {
105
+ contentParts.push('No files matching the criteria were found or all were skipped.');
106
+ }
107
+ return {
108
+ llmContent: contentParts,
109
+ returnDisplay: displayMessage.trim(),
110
+ };
111
+ }
112
+ async discoverFiles(inputPatterns, include, effectiveExcludes, fileFilteringOptions, fileDiscovery, filesToConsider, skippedFiles, signal) {
113
+ const searchPatterns = [...inputPatterns, ...include];
114
+ try {
115
+ const allEntries = new Set();
116
+ const workspaceDirs = this.host.getWorkspaceRoots();
117
+ for (const dir of workspaceDirs) {
118
+ const processedPatterns = this.processSearchPatterns(dir, searchPatterns);
119
+ const entriesInDir = await glob(processedPatterns, {
120
+ cwd: dir,
121
+ ignore: effectiveExcludes,
122
+ nodir: true,
123
+ dot: true,
124
+ absolute: true,
125
+ nocase: true,
126
+ signal,
127
+ });
128
+ for (const entry of entriesInDir) {
129
+ allEntries.add(entry);
130
+ }
131
+ }
132
+ this.filterEntries(Array.from(allEntries), fileFilteringOptions, fileDiscovery, filesToConsider, skippedFiles);
133
+ }
134
+ catch (error) {
135
+ const errorMessage = `Error during file search: ${getErrorMessage(error)}`;
136
+ return {
137
+ llmContent: errorMessage,
138
+ returnDisplay: `## File Search Error\n\nAn error occurred while searching for files:\n\`\`\`\n${getErrorMessage(error)}\n\`\`\``,
139
+ error: {
140
+ message: errorMessage,
141
+ type: ToolErrorType.READ_MANY_FILES_SEARCH_ERROR,
142
+ },
143
+ };
144
+ }
145
+ return undefined;
146
+ }
147
+ processSearchPatterns(dir, searchPatterns) {
148
+ const processedPatterns = [];
149
+ for (const p of searchPatterns) {
150
+ const normalizedP = p.replace(/\\/g, '/');
151
+ const fullPath = path.join(dir, normalizedP);
152
+ if (fs.existsSync(fullPath)) {
153
+ processedPatterns.push(globEscape(normalizedP));
154
+ }
155
+ else {
156
+ processedPatterns.push(normalizedP);
157
+ }
158
+ }
159
+ return processedPatterns;
160
+ }
161
+ filterEntries(entries, fileFilteringOptions, fileDiscovery, filesToConsider, skippedFiles) {
162
+ let gitIgnoredCount = 0;
163
+ let llxprtIgnoredCount = 0;
164
+ // eslint-disable-next-line sonarjs/too-many-break-or-continue-in-loop -- Existing structure is intentionally preserved; refactoring this boundary is outside the lint slice.
165
+ for (const absoluteFilePath of entries) {
166
+ const pathError = validatePathWithinWorkspace(this.host.getWorkspaceRoots(), absoluteFilePath);
167
+ if (pathError) {
168
+ skippedFiles.push({
169
+ path: absoluteFilePath,
170
+ reason: 'Security: ' + pathError,
171
+ });
172
+ continue;
173
+ }
174
+ const normalizedPath = path.normalize(absoluteFilePath);
175
+ if (fileFilteringOptions.respectGitIgnore &&
176
+ fileDiscovery.shouldGitIgnoreFile(absoluteFilePath)) {
177
+ gitIgnoredCount++;
178
+ continue;
179
+ }
180
+ if (fileFilteringOptions.respectLlxprtIgnore &&
181
+ fileDiscovery.shouldLlxprtIgnoreFile(absoluteFilePath)) {
182
+ llxprtIgnoredCount++;
183
+ continue;
184
+ }
185
+ filesToConsider.add(normalizedPath);
186
+ }
187
+ if (gitIgnoredCount > 0) {
188
+ skippedFiles.push({
189
+ path: `${gitIgnoredCount} file(s)`,
190
+ reason: 'git ignored',
191
+ });
192
+ }
193
+ if (llxprtIgnoredCount > 0) {
194
+ skippedFiles.push({
195
+ path: `${llxprtIgnoredCount} file(s)`,
196
+ reason: 'llxprt ignored',
197
+ });
198
+ }
199
+ }
200
+ resolveLimits() {
201
+ const ephemeralSettings = this.host.getEphemeralSettings();
202
+ return {
203
+ maxFileCount: ephemeralSettings['tool-output-max-items'] ??
204
+ DEFAULT_MAX_FILE_COUNT,
205
+ maxTokens: ephemeralSettings['tool-output-max-tokens'] ??
206
+ DEFAULT_MAX_TOKENS,
207
+ truncateMode: ephemeralSettings['tool-output-truncate-mode'] ?? DEFAULT_TRUNCATE_MODE,
208
+ fileSizeLimit: ephemeralSettings['tool-output-item-size-limit'] ?? DEFAULT_FILE_SIZE_LIMIT,
209
+ };
210
+ }
211
+ applyFileCountLimit(sortedFiles, skippedFiles, limits) {
212
+ if (sortedFiles.length <= limits.maxFileCount) {
213
+ return undefined;
214
+ }
215
+ if (limits.truncateMode === 'warn') {
216
+ const warnMessage = `Found ${sortedFiles.length} files matching your pattern, but limiting to ${limits.maxFileCount} files. Please use more specific patterns to narrow your search.`;
217
+ return {
218
+ llmContent: warnMessage,
219
+ returnDisplay: `## File Count Limit Exceeded\n\n${warnMessage}\n\n**Matched files:** ${sortedFiles.length}\n**Limit:** ${limits.maxFileCount}\n\n**Suggestion:** Use more specific glob patterns or paths to reduce the number of matched files.`,
220
+ };
221
+ }
222
+ else if (limits.truncateMode === 'sample') {
223
+ const step = Math.ceil(sortedFiles.length / limits.maxFileCount);
224
+ const sampledFiles = [];
225
+ for (let i = 0; i < sortedFiles.length; i += step) {
226
+ if (sampledFiles.length < limits.maxFileCount) {
227
+ sampledFiles.push(sortedFiles[i]);
228
+ }
229
+ }
230
+ const originalCount = sortedFiles.length;
231
+ sortedFiles.length = 0;
232
+ sortedFiles.push(...sampledFiles);
233
+ skippedFiles.push({
234
+ path: `${originalCount - sampledFiles.length} file(s)`,
235
+ reason: `sampling to stay within ${limits.maxFileCount} file limit`,
236
+ });
237
+ }
238
+ else {
239
+ const truncatedCount = sortedFiles.length - limits.maxFileCount;
240
+ sortedFiles.length = limits.maxFileCount;
241
+ skippedFiles.push({
242
+ path: `${truncatedCount} file(s)`,
243
+ reason: `truncated to stay within ${limits.maxFileCount} file limit`,
244
+ });
245
+ }
246
+ return undefined;
247
+ }
248
+ async processFiles(sortedFiles, inputPatterns, skippedFiles, processedFilesRelativePaths, contentParts, limits) {
249
+ let totalTokens = 0;
250
+ // eslint-disable-next-line sonarjs/too-many-break-or-continue-in-loop -- Existing structure is intentionally preserved; refactoring this boundary is outside the lint slice.
251
+ for (const filePath of sortedFiles) {
252
+ const relativePathForDisplay = path
253
+ .relative(this.host.getTargetDir(), filePath)
254
+ .replace(/\\/g, '/');
255
+ const sizeCheck = await this.checkFileSize(filePath, relativePathForDisplay, skippedFiles, limits.fileSizeLimit);
256
+ if (sizeCheck === 'skip')
257
+ continue;
258
+ const assetCheck = await this.checkAssetFile(filePath, relativePathForDisplay, inputPatterns, skippedFiles);
259
+ if (assetCheck === 'skip')
260
+ continue;
261
+ const fileReadResult = await this.readFileContent(filePath);
262
+ if (fileReadResult.error) {
263
+ skippedFiles.push({
264
+ path: relativePathForDisplay,
265
+ reason: `Read error: ${fileReadResult.error}`,
266
+ });
267
+ continue;
268
+ }
269
+ const addResult = this.addFileContent(fileReadResult, filePath, relativePathForDisplay, skippedFiles, processedFilesRelativePaths, contentParts, limits, totalTokens, sortedFiles);
270
+ if (addResult.action === 'stop') {
271
+ return addResult.totalTokens;
272
+ }
273
+ totalTokens = addResult.totalTokens;
274
+ processedFilesRelativePaths.push(relativePathForDisplay);
275
+ this.recordReadMetric(filePath, fileReadResult.llmContent);
276
+ if (addResult.action === 'stopAfterRecord') {
277
+ return totalTokens;
278
+ }
279
+ }
280
+ return totalTokens;
281
+ }
282
+ async checkFileSize(filePath, relativePathForDisplay, skippedFiles, fileSizeLimit) {
283
+ try {
284
+ const stats = await stat(filePath);
285
+ if (stats.size > fileSizeLimit) {
286
+ skippedFiles.push({
287
+ path: relativePathForDisplay,
288
+ reason: `file size (${Math.round(stats.size / 1024)}KB) exceeds limit (${Math.round(fileSizeLimit / 1024)}KB)`,
289
+ });
290
+ return 'skip';
291
+ }
292
+ }
293
+ catch (error) {
294
+ skippedFiles.push({
295
+ path: relativePathForDisplay,
296
+ reason: `stat error: ${getErrorMessage(error)}`,
297
+ });
298
+ return 'skip';
299
+ }
300
+ return 'continue';
301
+ }
302
+ async checkAssetFile(filePath, relativePathForDisplay, inputPatterns, skippedFiles) {
303
+ const fileType = await detectFileType(filePath);
304
+ if (fileType === 'image' || fileType === 'pdf' || fileType === 'audio') {
305
+ const fileExtension = path.extname(filePath).toLowerCase();
306
+ const fileNameWithoutExtension = path.basename(filePath, fileExtension);
307
+ const requestedExplicitly = inputPatterns.some((pattern) => pattern.toLowerCase().includes(fileExtension) ||
308
+ pattern.includes(fileNameWithoutExtension));
309
+ if (!requestedExplicitly) {
310
+ skippedFiles.push({
311
+ path: relativePathForDisplay,
312
+ reason: 'asset file (image/pdf/audio) was not explicitly requested by name or extension',
313
+ });
314
+ return 'skip';
315
+ }
316
+ }
317
+ return 'continue';
318
+ }
319
+ async readFileContent(filePath) {
320
+ const maxLinesPerFile = this.host.getEphemeralSettings()['file-read-max-lines'] ?? DEFAULT_MAX_LINES_TEXT_FILE;
321
+ return processSingleFileContent(filePath, this.host.getTargetDir(), undefined, maxLinesPerFile);
322
+ }
323
+ addFileContent(fileReadResult, filePath, relativePathForDisplay, skippedFiles, _processedFilesRelativePaths, contentParts, limits, totalTokens, sortedFiles) {
324
+ if (typeof fileReadResult.llmContent === 'string') {
325
+ return this.addTextFileContent(fileReadResult, filePath, relativePathForDisplay, skippedFiles, contentParts, limits, totalTokens, sortedFiles, _processedFilesRelativePaths);
326
+ }
327
+ // Non-text content (images/PDFs)
328
+ const estimatedTokens = 85;
329
+ if (totalTokens + estimatedTokens > limits.maxTokens) {
330
+ skippedFiles.push({
331
+ path: relativePathForDisplay,
332
+ reason: 'would exceed token limit (non-text content)',
333
+ });
334
+ return { totalTokens, action: 'continue' };
335
+ }
336
+ totalTokens += estimatedTokens;
337
+ contentParts.push(fileReadResult.llmContent);
338
+ return { totalTokens, action: 'continue' };
339
+ }
340
+ addTextFileContent(fileReadResult, filePath, relativePathForDisplay, skippedFiles, contentParts, limits, totalTokens, sortedFiles, processedFilesRelativePaths) {
341
+ const separator = DEFAULT_OUTPUT_SEPARATOR_FORMAT.replace('{filePath}', filePath);
342
+ let fileContentForLlm = '';
343
+ if (fileReadResult.isTruncated === true) {
344
+ fileContentForLlm += `[WARNING: This file was truncated. To view the full content, use the 'read_file' tool on this specific file.]\n\n`;
345
+ }
346
+ fileContentForLlm += fileReadResult.llmContent;
347
+ const contentToAdd = `${separator}\n\n${fileContentForLlm}\n\n`;
348
+ const contentTokens = estimateTokens(contentToAdd);
349
+ if (totalTokens + contentTokens > limits.maxTokens) {
350
+ return this.handleTokenOverflow(limits, relativePathForDisplay, sortedFiles, processedFilesRelativePaths, contentParts, contentToAdd, totalTokens, skippedFiles);
351
+ }
352
+ totalTokens += contentTokens;
353
+ contentParts.push(contentToAdd);
354
+ return { totalTokens, action: 'continue' };
355
+ }
356
+ handleTokenOverflow(limits, relativePathForDisplay, sortedFiles, processedFilesRelativePaths, contentParts, contentToAdd, totalTokens, skippedFiles) {
357
+ if (limits.truncateMode === 'warn') {
358
+ skippedFiles.push({
359
+ path: `${sortedFiles.length - processedFilesRelativePaths.length} remaining file(s)`,
360
+ reason: `would exceed token limit of ${limits.maxTokens}`,
361
+ });
362
+ return { totalTokens, action: 'stop' };
363
+ }
364
+ else if (limits.truncateMode === 'truncate') {
365
+ const remainingTokens = limits.maxTokens - totalTokens;
366
+ if (remainingTokens > 100) {
367
+ const truncatedContent = contentToAdd.substring(0, remainingTokens * 4);
368
+ const finalContent = truncatedContent + '\n\n[CONTENT TRUNCATED DUE TO TOKEN LIMIT]';
369
+ contentParts.push(finalContent);
370
+ const updatedTokens = totalTokens + estimateTokens(finalContent);
371
+ skippedFiles.push({
372
+ path: relativePathForDisplay,
373
+ reason: 'content truncated to fit token limit',
374
+ });
375
+ return { totalTokens: updatedTokens, action: 'stopAfterRecord' };
376
+ }
377
+ return { totalTokens, action: 'stop' };
378
+ }
379
+ skippedFiles.push({
380
+ path: relativePathForDisplay,
381
+ reason: 'skipped to stay within token limit',
382
+ });
383
+ return { totalTokens, action: 'continue' };
384
+ }
385
+ recordReadMetric(filePath, llmContent) {
386
+ const lines = typeof llmContent === 'string'
387
+ ? llmContent.split('\n').length
388
+ : undefined;
389
+ const mimetype = getSpecificMimeType(filePath);
390
+ this.host.recordFileRead(filePath, lines, mimetype);
391
+ }
392
+ buildDisplayMessage(processedFilesRelativePaths, skippedFiles, totalTokens) {
393
+ let displayMessage = `### ReadManyFiles Result (Target Dir: \`${this.host.getTargetDir()}\`)\n\n`;
394
+ if (processedFilesRelativePaths.length > 0) {
395
+ displayMessage += `Successfully read and concatenated content from **${processedFilesRelativePaths.length} file(s)**`;
396
+ if (totalTokens > 0) {
397
+ displayMessage += ` (approximately ${totalTokens.toLocaleString()} tokens)`;
398
+ }
399
+ displayMessage += `.\n`;
400
+ if (processedFilesRelativePaths.length <= 10) {
401
+ displayMessage += `\n**Processed Files:**\n`;
402
+ processedFilesRelativePaths.forEach((p) => (displayMessage += `- \`${p}\`\n`));
403
+ }
404
+ else {
405
+ displayMessage += `\n**Processed Files (first 10 shown):**\n`;
406
+ processedFilesRelativePaths
407
+ .slice(0, 10)
408
+ .forEach((p) => (displayMessage += `- \`${p}\`\n`));
409
+ displayMessage += `- ...and ${processedFilesRelativePaths.length - 10} more.\n`;
410
+ }
411
+ }
412
+ if (skippedFiles.length > 0) {
413
+ if (processedFilesRelativePaths.length === 0) {
414
+ displayMessage += `No files were read and concatenated based on the criteria.\n`;
415
+ }
416
+ if (skippedFiles.length <= 5) {
417
+ displayMessage += `\n**Skipped ${skippedFiles.length} item(s):**\n`;
418
+ }
419
+ else {
420
+ displayMessage += `\n**Skipped ${skippedFiles.length} item(s) (first 5 shown):**\n`;
421
+ }
422
+ skippedFiles
423
+ .slice(0, 5)
424
+ .forEach((f) => (displayMessage += `- \`${f.path}\` (Reason: ${f.reason})\n`));
425
+ if (skippedFiles.length > 5) {
426
+ displayMessage += `- ...and ${skippedFiles.length - 5} more.\n`;
427
+ }
428
+ }
429
+ else if (processedFilesRelativePaths.length === 0 &&
430
+ skippedFiles.length === 0) {
431
+ displayMessage += `No files were read and concatenated based on the criteria.\n`;
432
+ }
433
+ return displayMessage;
434
+ }
435
+ }
436
+ /**
437
+ * Tool implementation for finding and reading multiple text files from the local filesystem
438
+ * within a specified target directory. The content is concatenated.
439
+ * It is intended to run in an environment with access to the local file system (e.g., a Node.js backend).
440
+ */
441
+ export class ReadManyFilesTool extends BaseDeclarativeTool {
442
+ host;
443
+ static Name = 'read_many_files';
444
+ constructor(host) {
445
+ super(ReadManyFilesTool.Name, 'ReadManyFiles', `Reads content from multiple files specified by paths or glob patterns within a configured target directory. For text files, it concatenates their content into a single string. It is primarily designed for text-based files. However, it can also process image (e.g., .png, .jpg), audio (e.g., .mp3, .wav), and PDF (.pdf) files if their file names or extensions are explicitly included in the 'paths' argument. For these explicitly requested non-text files, their data is read and included in a format suitable for model consumption (e.g., base64 encoded).
446
+
447
+ This tool is useful when you need to understand or analyze a collection of files, such as:
448
+ - Getting an overview of a codebase or parts of it (e.g., all TypeScript files in the 'src' directory).
449
+ - Finding where specific functionality is implemented if the user asks broad questions about code.
450
+ - Reviewing documentation files (e.g., all Markdown files in the 'docs' directory).
451
+ - Gathering context from multiple configuration files.
452
+ - When the user asks to "read all files in X directory" or "show me the content of all Y files".
453
+
454
+ Use this tool when the user's query implies needing the content of several files simultaneously for context, analysis, or summarization. For text files, it uses default UTF-8 encoding and a '--- {filePath} ---' separator between file contents. The tool inserts a '--- End of content ---' after the last file. Ensure paths are relative to the target directory. Glob patterns like 'src/**/*.js' are supported. Avoid using for single files if a more specific single-file reading tool is available, unless the user specifically requests to process a list containing just one file via this tool. Other binary files (not explicitly requested as image/audio/PDF) are generally skipped. Default excludes apply to common non-text files (except for explicitly requested images/audio/PDFs) and large dependency directories unless 'useDefaultExcludes' is false.
455
+
456
+ IMPORTANT LIMITS:
457
+ - Maximum files: 50 (default, configurable via 'tool-output-max-items' setting)
458
+ - Maximum tokens: 50,000 (default, configurable via 'tool-output-max-tokens' setting)
459
+ - Maximum file size: 512KB per file (configurable via 'tool-output-item-size-limit' setting)
460
+ - If limits are exceeded, the tool will warn and suggest more specific patterns (configurable behavior via 'tool-output-truncate-mode')`, Kind.Read, buildParameterSchema());
461
+ this.host = host;
462
+ }
463
+ createInvocation(params, messageBus) {
464
+ return new ReadManyFilesToolInvocation(this.host, params, messageBus);
465
+ }
466
+ async execute(params, signal = new AbortController().signal) {
467
+ return this.build(params).execute(signal);
468
+ }
469
+ }
470
+ function buildParameterSchema() {
471
+ return {
472
+ type: 'object',
473
+ properties: {
474
+ paths: {
475
+ type: 'array',
476
+ items: {
477
+ type: 'string',
478
+ minLength: 1,
479
+ },
480
+ minItems: 1,
481
+ description: "Required. An array of glob patterns or paths relative to the tool's target directory. Examples: ['src/**/*.ts'], ['README.md', 'docs/']",
482
+ },
483
+ include: {
484
+ type: 'array',
485
+ items: {
486
+ type: 'string',
487
+ minLength: 1,
488
+ },
489
+ description: 'Optional. Additional glob patterns to include. These are merged with `paths`. Example: "*.test.ts" to specifically add test files if they were broadly excluded.',
490
+ default: [],
491
+ },
492
+ exclude: {
493
+ type: 'array',
494
+ items: {
495
+ type: 'string',
496
+ minLength: 1,
497
+ },
498
+ description: 'Optional. Glob patterns for files/directories to exclude. Added to default excludes if useDefaultExcludes is true. Example: "**/*.log", "temp/"',
499
+ default: [],
500
+ },
501
+ recursive: {
502
+ type: 'boolean',
503
+ description: 'Optional. Whether to search recursively (primarily controlled by `**` in glob patterns). Defaults to true.',
504
+ default: true,
505
+ },
506
+ useDefaultExcludes: {
507
+ type: 'boolean',
508
+ description: 'Optional. Whether to apply a list of default exclusion patterns (e.g., node_modules, .git, binary files). Defaults to true.',
509
+ default: true,
510
+ },
511
+ file_filtering_options: {
512
+ description: 'Whether to respect ignore patterns from .gitignore or .llxprtignore',
513
+ type: 'object',
514
+ properties: {
515
+ respect_git_ignore: {
516
+ description: 'Optional: Whether to respect .gitignore patterns when listing files. Only available in git repositories. Defaults to true.',
517
+ type: 'boolean',
518
+ },
519
+ respect_llxprt_ignore: {
520
+ description: 'Optional: Whether to respect .llxprtignore patterns when listing files. Defaults to true.',
521
+ type: 'boolean',
522
+ },
523
+ },
524
+ },
525
+ },
526
+ required: ['paths'],
527
+ };
528
+ }
529
+ //# sourceMappingURL=read-many-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-many-files.js","sourceRoot":"","sources":["../../../src/tools/read-many-files.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,IAAI,GAGL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAEzE,2DAA2D;AAC3D,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC;AAwDD;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,IAAgB;IAC1C,OAAO,IAAI,EAAE,0BAA0B,EAAE,IAAI,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,+BAA+B,GAAG,oBAAoB,CAAC;AAC7D,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AAE7D,mCAAmC;AACnC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AACrC,MAAM,uBAAuB,GAAG,MAAM,CAAC,C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b,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,SAAS,EAAE,CAAC;iBACb;gBACD,WAAW,EACT,iJAAiJ;gBACnJ,OAAO,EAAE,EAAE;aACZ;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,SAAS;gBACf,WAAW,EACT,4GAA4G;gBAC9G,OAAO,EAAE,IAAI;aACd;YACD,kBAAkB,EAAE;gBAClB,IAAI,EAAE,SAAS;gBACf,WAAW,EACT,6HAA6H;gBAC/H,OAAO,EAAE,IAAI;aACd;YACD,sBAAsB,EAAE;gBACtB,WAAW,EACT,qEAAqE;gBACvE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,kBAAkB,EAAE;wBAClB,WAAW,EACT,4HAA4H;wBAC9H,IAAI,EAAE,SAAS;qBAChB;oBACD,qBAAqB,EAAE;wBACrB,WAAW,EACT,2FAA2F;wBAC7F,IAAI,EAAE,SAAS;qBAChB;iBACF;aACF;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,CAAC;KACpB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { BaseDeclarativeTool, type ToolInvocation, type ToolResult } from './tools.js';
7
+ import type { IToolHost, IToolMessageBus } from '../interfaces/index.js';
8
+ /**
9
+ * Parameters for the ReadLineRange tool
10
+ */
11
+ export interface ReadLineRangeToolParams {
12
+ /**
13
+ * The absolute path to the file to read
14
+ */
15
+ absolute_path: string;
16
+ /**
17
+ * The 1-based line number to start reading from (inclusive)
18
+ */
19
+ start_line: number;
20
+ /**
21
+ * The 1-based line number to end reading at (inclusive)
22
+ */
23
+ end_line: number;
24
+ /**
25
+ * Alternative parameter name for absolute_path (for compatibility)
26
+ */
27
+ file_path?: string;
28
+ /**
29
+ * When true, prefixes each returned line with a virtual line number.
30
+ */
31
+ showLineNumbers?: boolean;
32
+ /**
33
+ * When true, prefixes each returned text line with a git-change marker column.
34
+ */
35
+ showGitChanges?: boolean;
36
+ }
37
+ /**
38
+ * Implementation of the ReadLineRange tool logic
39
+ */
40
+ export declare class ReadLineRangeTool extends BaseDeclarativeTool<ReadLineRangeToolParams, ToolResult> {
41
+ private host;
42
+ static readonly Name: string;
43
+ constructor(host: IToolHost);
44
+ protected validateToolParamValues(params: ReadLineRangeToolParams): string | null;
45
+ protected createInvocation(params: ReadLineRangeToolParams, messageBus: IToolMessageBus): ToolInvocation<ReadLineRangeToolParams, ToolResult>;
46
+ execute(params: ReadLineRangeToolParams, signal?: AbortSignal): Promise<ToolResult>;
47
+ }