@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,32 @@
1
+ /**
2
+ * @plan:PLAN-20260608-ISSUE1585.P11
3
+ * @requirement:REQ-API-001, REQ-TEMPORARY-INTERFACES
4
+ */
5
+ /**
6
+ * @license
7
+ * Copyright 2025 Google LLC
8
+ * SPDX-License-Identifier: Apache-2.0
9
+ */
10
+ import type { IToolKeyStorage } from '../interfaces/IToolKeyStorage.js';
11
+ import { type ToolKeyRegistryEntry } from './tool-key-storage-types.js';
12
+ /**
13
+ * Tools-package facade over an injected tool-key storage implementation.
14
+ *
15
+ * The concrete persistence mechanism remains outside packages/tools. Core
16
+ * supplies SecureStore-backed persistence through CoreToolKeyStorageAdapter,
17
+ * while tools own registry metadata, display helpers, and this stable boundary.
18
+ */
19
+ export declare class ToolKeyStorageFacade implements IToolKeyStorage {
20
+ private readonly storage;
21
+ constructor(storage: IToolKeyStorage);
22
+ saveKey(toolName: string, key: string): Promise<void>;
23
+ getKey(toolName: string): Promise<string | null>;
24
+ deleteKey(toolName: string): Promise<void>;
25
+ hasKey(toolName: string): Promise<boolean>;
26
+ resolveKey(toolName: string): Promise<string | null>;
27
+ maskKeyForDisplay(key: string): string;
28
+ getSupportedToolNames(): string[];
29
+ getToolKeyEntry(toolName: string): ToolKeyRegistryEntry | undefined;
30
+ isValidToolKeyName(toolName: string): boolean;
31
+ private assertSupportedTool;
32
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @plan:PLAN-20260608-ISSUE1585.P11
3
+ * @requirement:REQ-API-001, REQ-TEMPORARY-INTERFACES
4
+ */
5
+ import { getSupportedToolNames, getToolKeyEntry, isValidToolKeyName, maskKeyForDisplay, } from './tool-key-storage-types.js';
6
+ /**
7
+ * Tools-package facade over an injected tool-key storage implementation.
8
+ *
9
+ * The concrete persistence mechanism remains outside packages/tools. Core
10
+ * supplies SecureStore-backed persistence through CoreToolKeyStorageAdapter,
11
+ * while tools own registry metadata, display helpers, and this stable boundary.
12
+ */
13
+ export class ToolKeyStorageFacade {
14
+ storage;
15
+ constructor(storage) {
16
+ this.storage = storage;
17
+ }
18
+ async saveKey(toolName, key) {
19
+ this.assertSupportedTool(toolName);
20
+ await this.storage.saveKey(toolName, key);
21
+ }
22
+ async getKey(toolName) {
23
+ this.assertSupportedTool(toolName);
24
+ return this.storage.getKey(toolName);
25
+ }
26
+ async deleteKey(toolName) {
27
+ this.assertSupportedTool(toolName);
28
+ await this.storage.deleteKey(toolName);
29
+ }
30
+ async hasKey(toolName) {
31
+ this.assertSupportedTool(toolName);
32
+ return this.storage.hasKey(toolName);
33
+ }
34
+ async resolveKey(toolName) {
35
+ this.assertSupportedTool(toolName);
36
+ return this.storage.resolveKey(toolName);
37
+ }
38
+ maskKeyForDisplay(key) {
39
+ return maskKeyForDisplay(key);
40
+ }
41
+ getSupportedToolNames() {
42
+ return getSupportedToolNames();
43
+ }
44
+ getToolKeyEntry(toolName) {
45
+ return getToolKeyEntry(toolName);
46
+ }
47
+ isValidToolKeyName(toolName) {
48
+ return isValidToolKeyName(toolName);
49
+ }
50
+ assertSupportedTool(toolName) {
51
+ if (!isValidToolKeyName(toolName)) {
52
+ throw new Error(`Unsupported tool key storage name: ${toolName}`);
53
+ }
54
+ }
55
+ }
56
+ //# sourceMappingURL=tool-key-storage-facade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-key-storage-facade.js","sourceRoot":"","sources":["../../../src/utils/tool-key-storage-facade.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,GAElB,MAAM,6BAA6B,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,OAAO,oBAAoB;IACF;IAA7B,YAA6B,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;IAAG,CAAC;IAEzD,KAAK,CAAC,OAAO,CAAC,QAAgB,EAAE,GAAW;QACzC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACnC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAAgB;QAC3B,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAAgB;QAC9B,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACnC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAAgB;QAC3B,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAgB;QAC/B,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,iBAAiB,CAAC,GAAW;QAC3B,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,qBAAqB;QACnB,OAAO,qBAAqB,EAAE,CAAC;IACjC,CAAC;IAED,eAAe,CAAC,QAAgB;QAC9B,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,kBAAkB,CAAC,QAAgB;QACjC,OAAO,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAEO,mBAAmB,CAAC,QAAgB;QAC1C,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,sCAAsC,QAAQ,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @plan:PLAN-20260608-ISSUE1585.P05
3
+ * @requirement:REQ-API-001, REQ-TEMPORARY-INTERFACES
4
+ */
5
+ /**
6
+ * @license
7
+ * Copyright 2025 Google LLC
8
+ * SPDX-License-Identifier: Apache-2.0
9
+ */
10
+ /**
11
+ * Package-local tool key storage types and pure-utility helpers.
12
+ *
13
+ * Provides the registry metadata types and display helpers needed by
14
+ * tool-key-storage, codesearch, exa-web-search, and google-web-search.
15
+ * The actual ToolKeyStorage class with SecureStore integration remains
16
+ * in core. Self-contained with zero core imports.
17
+ */
18
+ /** Metadata about a registered tool key. */
19
+ export interface ToolKeyRegistryEntry {
20
+ /** The key used to reference the tool (e.g., 'exa'). */
21
+ toolKeyName: string;
22
+ /** Human-readable display name (e.g., 'Exa Search'). */
23
+ displayName: string;
24
+ /** URL parameter name for API key. */
25
+ urlParamName: string;
26
+ /** Description of the key's purpose. */
27
+ description: string;
28
+ }
29
+ /**
30
+ * Registry of supported tool keys and their metadata.
31
+ */
32
+ export declare const TOOL_KEY_REGISTRY: Map<string, ToolKeyRegistryEntry>;
33
+ /**
34
+ * Checks if a tool name is a valid key storage name.
35
+ * @param toolName - The tool name to check.
36
+ * @returns true if the tool name has a registered entry.
37
+ */
38
+ export declare function isValidToolKeyName(toolName: string): boolean;
39
+ /**
40
+ * Gets the registry entry for a tool key name.
41
+ * @param toolName - The tool name to look up.
42
+ * @returns The registry entry, or undefined if not found.
43
+ */
44
+ export declare function getToolKeyEntry(toolName: string): ToolKeyRegistryEntry | undefined;
45
+ /**
46
+ * Returns the list of all supported tool key names.
47
+ * @returns Array of supported tool key name strings.
48
+ */
49
+ export declare function getSupportedToolNames(): string[];
50
+ /**
51
+ * Masks an API key for safe display, showing only first 2 and last 2 characters.
52
+ * Keys of 8 characters or fewer are fully masked.
53
+ * @param key - The API key to mask.
54
+ * @returns The masked key string.
55
+ */
56
+ export declare function maskKeyForDisplay(key: string): string;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @plan:PLAN-20260608-ISSUE1585.P05
3
+ * @requirement:REQ-API-001, REQ-TEMPORARY-INTERFACES
4
+ */
5
+ /**
6
+ * Registry of supported tool keys and their metadata.
7
+ */
8
+ export const TOOL_KEY_REGISTRY = new Map([
9
+ [
10
+ 'exa',
11
+ {
12
+ toolKeyName: 'exa',
13
+ displayName: 'Exa Search',
14
+ urlParamName: 'exaApiKey',
15
+ description: 'API key for Exa web and code search',
16
+ },
17
+ ],
18
+ ]);
19
+ /**
20
+ * Checks if a tool name is a valid key storage name.
21
+ * @param toolName - The tool name to check.
22
+ * @returns true if the tool name has a registered entry.
23
+ */
24
+ export function isValidToolKeyName(toolName) {
25
+ return TOOL_KEY_REGISTRY.has(toolName);
26
+ }
27
+ /**
28
+ * Gets the registry entry for a tool key name.
29
+ * @param toolName - The tool name to look up.
30
+ * @returns The registry entry, or undefined if not found.
31
+ */
32
+ export function getToolKeyEntry(toolName) {
33
+ return TOOL_KEY_REGISTRY.get(toolName);
34
+ }
35
+ /**
36
+ * Returns the list of all supported tool key names.
37
+ * @returns Array of supported tool key name strings.
38
+ */
39
+ export function getSupportedToolNames() {
40
+ return Array.from(TOOL_KEY_REGISTRY.keys());
41
+ }
42
+ /**
43
+ * Masks an API key for safe display, showing only first 2 and last 2 characters.
44
+ * Keys of 8 characters or fewer are fully masked.
45
+ * @param key - The API key to mask.
46
+ * @returns The masked key string.
47
+ */
48
+ export function maskKeyForDisplay(key) {
49
+ if (key.length <= 8)
50
+ return '*'.repeat(key.length);
51
+ const first2 = key.substring(0, 2);
52
+ const last2 = key.substring(key.length - 2);
53
+ const middle = '*'.repeat(key.length - 4);
54
+ return `${first2}${middle}${last2}`;
55
+ }
56
+ //# sourceMappingURL=tool-key-storage-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-key-storage-types.js","sourceRoot":"","sources":["../../../src/utils/tool-key-storage-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA6BH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAA+B;IACrE;QACE,KAAK;QACL;YACE,WAAW,EAAE,KAAK;YAClB,WAAW,EAAE,YAAY;YACzB,YAAY,EAAE,WAAW;YACzB,WAAW,EAAE,qCAAqC;SACnD;KACF;CACF,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,OAAO,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAgB;IAEhB,OAAO,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC1C,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Vybestack LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export interface ToolOutputSettingsProvider {
7
+ getEphemeralSettings(): Record<string, unknown>;
8
+ }
9
+ export declare const DEFAULT_MAX_TOKENS = 50000;
10
+ export declare const DEFAULT_TRUNCATE_MODE = "warn";
11
+ export declare const ESCAPE_BUFFER_PERCENTAGE = 0.8;
12
+ export interface TruncatedOutput {
13
+ content: string;
14
+ wasTruncated: boolean;
15
+ originalTokens?: number;
16
+ message?: string;
17
+ }
18
+ export declare function estimateTokens(text: string): number;
19
+ export declare function getEffectiveTokenLimit(maxTokens: number): number;
20
+ export interface OutputLimitConfig {
21
+ maxTokens?: number;
22
+ truncateMode?: 'warn' | 'truncate' | 'sample';
23
+ }
24
+ export declare function getOutputLimits(config: ToolOutputSettingsProvider): OutputLimitConfig;
25
+ export declare function limitOutputTokens(content: string, config: ToolOutputSettingsProvider, toolName: string): TruncatedOutput;
26
+ export declare function formatLimitedOutput(result: TruncatedOutput): {
27
+ llmContent: string;
28
+ returnDisplay: string;
29
+ };
@@ -0,0 +1,107 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Vybestack LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export const DEFAULT_MAX_TOKENS = 50000;
7
+ export const DEFAULT_TRUNCATE_MODE = 'warn';
8
+ export const ESCAPE_BUFFER_PERCENTAGE = 0.8;
9
+ export function estimateTokens(text) {
10
+ return Math.ceil(text.length / 3);
11
+ }
12
+ export function getEffectiveTokenLimit(maxTokens) {
13
+ return Math.floor(maxTokens * ESCAPE_BUFFER_PERCENTAGE);
14
+ }
15
+ export function getOutputLimits(config) {
16
+ const ephemeralSettings = config.getEphemeralSettings();
17
+ return {
18
+ maxTokens: ephemeralSettings['tool-output-max-tokens'] ??
19
+ DEFAULT_MAX_TOKENS,
20
+ truncateMode: ephemeralSettings['tool-output-truncate-mode'] ?? DEFAULT_TRUNCATE_MODE,
21
+ };
22
+ }
23
+ function shouldSkipTruncation(rawMaxTokens, maxTokens, tokens, effectiveLimit) {
24
+ return (rawMaxTokens === false ||
25
+ rawMaxTokens === '' ||
26
+ maxTokens === 0 ||
27
+ Number.isNaN(maxTokens) ||
28
+ tokens <= effectiveLimit);
29
+ }
30
+ function truncateWarn(originalTokens, effectiveLimit, toolName) {
31
+ return {
32
+ content: '',
33
+ wasTruncated: true,
34
+ originalTokens,
35
+ message: `${toolName} output exceeded token limit (${originalTokens} > ${effectiveLimit}). The results were found but are too large to display. Please:\n1. Use more specific search patterns or file paths to narrow results\n2. Search for specific function/class names instead of generic terms\n3. Look in specific directories rather than the entire codebase\n4. Use exact match patterns when possible`,
36
+ };
37
+ }
38
+ function truncateHard(content, originalTokens, effectiveLimit) {
39
+ const approxChars = Math.floor(content.length * (effectiveLimit / originalTokens));
40
+ return {
41
+ content: `${content.slice(0, Math.max(0, approxChars))}\n\n[Output truncated due to token limit]`,
42
+ wasTruncated: true,
43
+ originalTokens,
44
+ message: `Output truncated from ${originalTokens} to ${effectiveLimit} tokens`,
45
+ };
46
+ }
47
+ function sampleLines(content, originalTokens, effectiveLimit, maxTokens) {
48
+ const lines = content.split('\n');
49
+ if (lines.length > 1) {
50
+ const targetLines = Math.max(1, Math.floor(effectiveLimit / 10));
51
+ const step = Math.ceil(lines.length / targetLines);
52
+ const sampledLines = [];
53
+ for (let i = 0; i < lines.length; i += step) {
54
+ const candidateLines = [...sampledLines, lines[i]];
55
+ if (estimateTokens(candidateLines.join('\n')) > effectiveLimit) {
56
+ break;
57
+ }
58
+ sampledLines.push(lines[i]);
59
+ }
60
+ if (sampledLines.length > 0) {
61
+ return {
62
+ content: sampledLines.join('\n') +
63
+ `\n\n[Sampled ${sampledLines.length} of ${lines.length} lines due to token limit]`,
64
+ wasTruncated: true,
65
+ originalTokens,
66
+ message: `Output sampled to fit within ${maxTokens} token limit`,
67
+ };
68
+ }
69
+ }
70
+ return truncateHard(content, originalTokens, effectiveLimit);
71
+ }
72
+ export function limitOutputTokens(content, config, toolName) {
73
+ const limits = getOutputLimits(config);
74
+ const maxTokens = limits.maxTokens ?? DEFAULT_MAX_TOKENS;
75
+ const rawMaxTokens = limits.maxTokens;
76
+ const effectiveLimit = getEffectiveTokenLimit(maxTokens);
77
+ const tokens = estimateTokens(content);
78
+ if (shouldSkipTruncation(rawMaxTokens, maxTokens, tokens, effectiveLimit)) {
79
+ return { content, wasTruncated: false };
80
+ }
81
+ if (limits.truncateMode === 'warn') {
82
+ return truncateWarn(tokens, effectiveLimit, toolName);
83
+ }
84
+ if (limits.truncateMode === 'truncate') {
85
+ return truncateHard(content, tokens, effectiveLimit);
86
+ }
87
+ return sampleLines(content, tokens, effectiveLimit, limits.maxTokens);
88
+ }
89
+ export function formatLimitedOutput(result) {
90
+ if (!result.wasTruncated) {
91
+ return {
92
+ llmContent: result.content,
93
+ returnDisplay: result.content,
94
+ };
95
+ }
96
+ if (result.message && !result.content) {
97
+ return {
98
+ llmContent: result.message,
99
+ returnDisplay: `## Token Limit Exceeded\n\n${result.message}`,
100
+ };
101
+ }
102
+ return {
103
+ llmContent: result.content,
104
+ returnDisplay: result.content + (result.message ? `\n\n## Note\n${result.message}` : ''),
105
+ };
106
+ }
107
+ //# sourceMappingURL=toolOutputLimiter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolOutputLimiter.js","sourceRoot":"","sources":["../../../src/utils/toolOutputLimiter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAC5C,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAS5C,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,SAAiB;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,wBAAwB,CAAC,CAAC;AAC1D,CAAC;AAOD,MAAM,UAAU,eAAe,CAC7B,MAAkC;IAElC,MAAM,iBAAiB,GAAG,MAAM,CAAC,oBAAoB,EAAE,CAAC;IAExD,OAAO;QACL,SAAS,EACN,iBAAiB,CAAC,wBAAwB,CAAwB;YACnE,kBAAkB;QACpB,YAAY,EACT,iBAAiB,CAAC,2BAA2B,CAIhC,IAAI,qBAAqB;KAC1C,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAC3B,YAAqB,EACrB,SAAiB,EACjB,MAAc,EACd,cAAsB;IAEtB,OAAO,CACL,YAAY,KAAK,KAAK;QACtB,YAAY,KAAK,EAAE;QACnB,SAAS,KAAK,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;QACvB,MAAM,IAAI,cAAc,CACzB,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,cAAsB,EACtB,cAAsB,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EAAE,CAAC;QACvC,OAAO,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAuB;IAIzD,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QACzB,OAAO;YACL,UAAU,EAAE,MAAM,CAAC,OAAO;YAC1B,aAAa,EAAE,MAAM,CAAC,OAAO;SAC9B,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtC,OAAO;YACL,UAAU,EAAE,MAAM,CAAC,OAAO;YAC1B,aAAa,EAAE,8BAA8B,MAAM,CAAC,OAAO,EAAE;SAC9D,CAAC;IACJ,CAAC;IAED,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,OAAO;QAC1B,aAAa,EACX,MAAM,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Vybestack LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Sanitizes Unicode strings by handling replacement characters and ensuring
8
+ * proper UTF-8 encoding for API transmission.
9
+ */
10
+ /**
11
+ * Removes or replaces Unicode replacement characters (U+FFFD) from a string.
12
+ * These characters often appear when there are encoding/decoding errors.
13
+ *
14
+ * @param text The text to sanitize
15
+ * @param replacement What to replace U+FFFD with (default: '?')
16
+ * @returns The sanitized text
17
+ */
18
+ export declare function sanitizeUnicodeReplacements(text: string, replacement?: string): string;
19
+ /**
20
+ * Checks if a string contains Unicode replacement characters (U+FFFD).
21
+ *
22
+ * @param text The text to check
23
+ * @returns True if the text contains replacement characters
24
+ */
25
+ export declare function hasUnicodeReplacements(text: string): boolean;
26
+ /**
27
+ * Checks if a string contains characters that are unsafe for JSON serialization.
28
+ * This includes:
29
+ * - Unicode replacement characters (U+FFFD)
30
+ * - Unpaired surrogates (high surrogate without low, or low without high)
31
+ * - Control characters (except tab, newline, carriage return)
32
+ *
33
+ * @param text The text to check
34
+ * @returns True if the text contains JSON-unsafe characters
35
+ */
36
+ export declare function hasJsonUnsafeCharacters(text: string): boolean;
37
+ /**
38
+ * Ensures a string is safe for JSON serialization and API transmission.
39
+ * This handles various edge cases including:
40
+ * - Unicode replacement characters
41
+ * - Control characters
42
+ * - Invalid surrogate pairs
43
+ *
44
+ * @param text The text to make safe
45
+ * @returns The sanitized text
46
+ */
47
+ export declare function ensureJsonSafe(text: string): string;
48
+ /**
49
+ * Attempts to detect and fix common cp932 (Shift-JIS) decoding issues.
50
+ * This is specifically for Windows Japanese locale users.
51
+ *
52
+ * @param text The text that may have cp932 encoding issues
53
+ * @returns The cleaned text
54
+ */
55
+ export declare function cleanCp932Artifacts(text: string): string;
@@ -0,0 +1,129 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Vybestack LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Sanitizes Unicode strings by handling replacement characters and ensuring
8
+ * proper UTF-8 encoding for API transmission.
9
+ */
10
+ /**
11
+ * Removes or replaces Unicode replacement characters (U+FFFD) from a string.
12
+ * These characters often appear when there are encoding/decoding errors.
13
+ *
14
+ * @param text The text to sanitize
15
+ * @param replacement What to replace U+FFFD with (default: '?')
16
+ * @returns The sanitized text
17
+ */
18
+ export function sanitizeUnicodeReplacements(text, replacement = '?') {
19
+ // U+FFFD is the Unicode replacement character
20
+ return text.replace(/\uFFFD/g, replacement);
21
+ }
22
+ /**
23
+ * Checks if a string contains Unicode replacement characters (U+FFFD).
24
+ *
25
+ * @param text The text to check
26
+ * @returns True if the text contains replacement characters
27
+ */
28
+ export function hasUnicodeReplacements(text) {
29
+ return /\uFFFD/.test(text);
30
+ }
31
+ /**
32
+ * Checks if a string contains characters that are unsafe for JSON serialization.
33
+ * This includes:
34
+ * - Unicode replacement characters (U+FFFD)
35
+ * - Unpaired surrogates (high surrogate without low, or low without high)
36
+ * - Control characters (except tab, newline, carriage return)
37
+ *
38
+ * @param text The text to check
39
+ * @returns True if the text contains JSON-unsafe characters
40
+ */
41
+ export function hasJsonUnsafeCharacters(text) {
42
+ // Check for replacement chars, unpaired surrogates, and control chars in one pass
43
+ for (let i = 0; i < text.length; i++) {
44
+ const code = text.charCodeAt(i);
45
+ // U+FFFD replacement character
46
+ if (code === 0xfffd)
47
+ return true;
48
+ // Control characters (except tab, newline, carriage return)
49
+ if (code <= 0x1f && code !== 0x09 && code !== 0x0a && code !== 0x0d)
50
+ return true;
51
+ if (code === 0x7f)
52
+ return true;
53
+ // High surrogate without matching low surrogate
54
+ if (code >= 0xd800 && code <= 0xdbff) {
55
+ const next = i + 1 < text.length ? text.charCodeAt(i + 1) : 0;
56
+ if (next < 0xdc00 || next > 0xdfff)
57
+ return true;
58
+ i++; // skip the valid low surrogate
59
+ }
60
+ // Low surrogate without preceding high surrogate
61
+ else if (code >= 0xdc00 && code <= 0xdfff) {
62
+ return true;
63
+ }
64
+ }
65
+ return false;
66
+ }
67
+ /**
68
+ * Ensures a string is safe for JSON serialization and API transmission.
69
+ * This handles various edge cases including:
70
+ * - Unicode replacement characters
71
+ * - Control characters
72
+ * - Invalid surrogate pairs
73
+ *
74
+ * @param text The text to make safe
75
+ * @returns The sanitized text
76
+ */
77
+ export function ensureJsonSafe(text) {
78
+ // First, handle replacement characters
79
+ let safe = sanitizeUnicodeReplacements(text);
80
+ // Remove control characters except common ones (tab, newline, carriage return)
81
+ let result = '';
82
+ for (let i = 0; i < safe.length; i++) {
83
+ const char = safe[i];
84
+ const code = safe.charCodeAt(i);
85
+ // Keep tab (0x09), newline (0x0A), and carriage return (0x0D)
86
+ if (code === 0x09 || code === 0x0a || code === 0x0d) {
87
+ result += char;
88
+ }
89
+ // Skip other control characters
90
+ else if ((code >= 0x00 && code <= 0x1f) || code === 0x7f) {
91
+ continue;
92
+ }
93
+ // Keep all other characters
94
+ else {
95
+ result += char;
96
+ }
97
+ }
98
+ safe = result;
99
+ // Ensure valid UTF-16 surrogate pairs
100
+ // This regex matches unpaired surrogates
101
+ safe = safe.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g, '?');
102
+ return safe;
103
+ }
104
+ /**
105
+ * Attempts to detect and fix common cp932 (Shift-JIS) decoding issues.
106
+ * This is specifically for Windows Japanese locale users.
107
+ *
108
+ * @param text The text that may have cp932 encoding issues
109
+ * @returns The cleaned text
110
+ */
111
+ export function cleanCp932Artifacts(text) {
112
+ // Common cp932 decoding artifacts when incorrectly decoded as UTF-8
113
+ const commonArtifacts = {
114
+ '髮「': '陰',
115
+ 邨ア: '結',
116
+ 繧ウ: 'コ',
117
+ 繝シ: 'ー',
118
+ '繝。': 'メ',
119
+ 繝ウ: 'ン',
120
+ 繝医: 'ト',
121
+ // Add more common patterns as discovered
122
+ };
123
+ let cleaned = text;
124
+ for (const [artifact, replacement] of Object.entries(commonArtifacts)) {
125
+ cleaned = cleaned.replace(new RegExp(artifact, 'g'), replacement);
126
+ }
127
+ return cleaned;
128
+ }
129
+ //# sourceMappingURL=unicodeUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unicodeUtils.js","sourceRoot":"","sources":["../../../src/utils/unicodeUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CACzC,IAAY,EACZ,cAAsB,GAAG;IAEzB,8CAA8C;IAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAC9C,CAAC;AAED;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AAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QACtE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@vybestack/llxprt-code-tools",
3
+ "version": "0.10.0-nightly.260613.1adad3b34",
4
+ "description": "LLxprt Code Tools — built-in tool implementations, contracts, formatters, and registry",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/vybestack/llxprt-code.git"
9
+ },
10
+ "type": "module",
11
+ "main": "dist/index.js",
12
+ "types": "dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ },
18
+ "./IToolFormatter.js": "./dist/src/formatters/IToolFormatter.js",
19
+ "./ToolFormatter.js": "./dist/src/formatters/ToolFormatter.js",
20
+ "./ToolIdStrategy.js": "./dist/src/formatters/ToolIdStrategy.js",
21
+ "./toolIdNormalization.js": "./dist/src/formatters/toolIdNormalization.js",
22
+ "./doubleEscapeUtils.js": "./dist/src/formatters/doubleEscapeUtils.js",
23
+ "./toolNameUtils.js": "./dist/src/formatters/toolNameUtils.js",
24
+ "./utils/fetch.js": {
25
+ "types": "./dist/src/utils/fetch.d.ts",
26
+ "import": "./dist/src/utils/fetch.js"
27
+ }
28
+ },
29
+ "scripts": {
30
+ "build": "node ../../scripts/build_package.js",
31
+ "lint": "eslint . --ext .ts,.tsx",
32
+ "format": "prettier --write .",
33
+ "test": "vitest run",
34
+ "test:ci": "vitest run",
35
+ "typecheck": "tsc --noEmit"
36
+ },
37
+ "files": [
38
+ "dist"
39
+ ],
40
+ "dependencies": {
41
+ "@ast-grep/napi": "^0.40.5",
42
+ "ajv": "^8.17.1",
43
+ "@google/genai": "1.30.0",
44
+ "cheerio": "^1.1.2",
45
+ "diff": "^8.0.3",
46
+ "fast-glob": "^3.3.3",
47
+ "glob": "^12.0.0",
48
+ "html-to-text": "^9.0.5",
49
+ "node-fetch": "^3.3.2",
50
+ "shell-quote": "^1.8.3",
51
+ "turndown": "^7.2.2",
52
+ "zod": "^3.25.76",
53
+ "zod-to-json-schema": "^3.25.1",
54
+ "@ast-grep/lang-c": "^0.0.5",
55
+ "@ast-grep/lang-cpp": "^0.0.5",
56
+ "@ast-grep/lang-go": "^0.0.5",
57
+ "@ast-grep/lang-java": "^0.0.6",
58
+ "@ast-grep/lang-json": "^0.0.6",
59
+ "@ast-grep/lang-python": "^0.0.5",
60
+ "@ast-grep/lang-ruby": "^0.0.6",
61
+ "@ast-grep/lang-rust": "^0.0.6",
62
+ "@lvce-editor/ripgrep": "^1.6.0",
63
+ "mime-types": "^2.1.35"
64
+ },
65
+ "devDependencies": {
66
+ "@types/node": "^24.2.1",
67
+ "@vybestack/llxprt-code-test-utils": "file:../test-utils",
68
+ "typescript": "^5.3.3",
69
+ "vitest": "^3.2.4",
70
+ "@types/mime-types": "^3.0.1"
71
+ },
72
+ "engines": {
73
+ "node": ">=20"
74
+ }
75
+ }