@travisennis/acai 0.0.8 → 0.0.10

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 (386) hide show
  1. package/README.md +48 -729
  2. package/bin/acai +52 -0
  3. package/dist/agent/index.d.ts +12 -2
  4. package/dist/agent/index.d.ts.map +1 -1
  5. package/dist/agent/index.js +378 -168
  6. package/dist/agent/sub-agent.d.ts +23 -0
  7. package/dist/agent/sub-agent.d.ts.map +1 -0
  8. package/dist/agent/sub-agent.js +109 -0
  9. package/dist/cli/index.d.ts +26 -0
  10. package/dist/cli/index.d.ts.map +1 -0
  11. package/dist/{cli.js → cli/index.js} +84 -76
  12. package/dist/cli/stdin.d.ts +9 -0
  13. package/dist/cli/stdin.d.ts.map +1 -0
  14. package/dist/cli/stdin.js +37 -0
  15. package/dist/commands/copy/index.js +2 -2
  16. package/dist/commands/copy/utils.d.ts.map +1 -1
  17. package/dist/commands/copy/utils.js +15 -13
  18. package/dist/commands/generate-rules/index.d.ts +1 -1
  19. package/dist/commands/generate-rules/index.d.ts.map +1 -1
  20. package/dist/commands/generate-rules/index.js +16 -100
  21. package/dist/commands/generate-rules/service.d.ts +21 -0
  22. package/dist/commands/generate-rules/service.d.ts.map +1 -0
  23. package/dist/commands/generate-rules/service.js +103 -0
  24. package/dist/commands/handoff/index.js +2 -2
  25. package/dist/commands/health/index.js +1 -1
  26. package/dist/commands/health/utils.d.ts.map +1 -1
  27. package/dist/commands/health/utils.js +6 -0
  28. package/dist/commands/history/index.d.ts +1 -1
  29. package/dist/commands/history/index.d.ts.map +1 -1
  30. package/dist/commands/history/index.js +17 -18
  31. package/dist/commands/history/types.d.ts +38 -0
  32. package/dist/commands/history/types.d.ts.map +1 -1
  33. package/dist/commands/history/utils.d.ts.map +1 -1
  34. package/dist/commands/history/utils.js +63 -58
  35. package/dist/commands/init/index.d.ts.map +1 -1
  36. package/dist/commands/init/index.js +3 -8
  37. package/dist/commands/init-project/index.d.ts.map +1 -1
  38. package/dist/commands/init-project/index.js +3 -3
  39. package/dist/commands/init-project/utils.d.ts.map +1 -1
  40. package/dist/commands/init-project/utils.js +10 -2
  41. package/dist/commands/list-tools/index.d.ts.map +1 -1
  42. package/dist/commands/list-tools/index.js +7 -31
  43. package/dist/commands/manager.d.ts +2 -2
  44. package/dist/commands/manager.d.ts.map +1 -1
  45. package/dist/commands/manager.js +57 -33
  46. package/dist/commands/model/index.d.ts.map +1 -1
  47. package/dist/commands/model/index.js +20 -151
  48. package/dist/commands/model/model-panel.d.ts +4 -0
  49. package/dist/commands/model/model-panel.d.ts.map +1 -0
  50. package/dist/commands/model/model-panel.js +144 -0
  51. package/dist/commands/paste/index.d.ts.map +1 -1
  52. package/dist/commands/paste/index.js +59 -62
  53. package/dist/commands/paste/utils.d.ts.map +1 -1
  54. package/dist/commands/paste/utils.js +88 -58
  55. package/dist/commands/pickup/index.d.ts.map +1 -1
  56. package/dist/commands/pickup/index.js +6 -3
  57. package/dist/commands/pickup/utils.js +3 -3
  58. package/dist/commands/resources/index.d.ts.map +1 -1
  59. package/dist/commands/resources/index.js +33 -50
  60. package/dist/commands/review/index.d.ts.map +1 -1
  61. package/dist/commands/review/index.js +3 -117
  62. package/dist/commands/review/review-panel.d.ts +3 -0
  63. package/dist/commands/review/review-panel.d.ts.map +1 -0
  64. package/dist/commands/review/review-panel.js +186 -0
  65. package/dist/commands/review/utils.d.ts +9 -0
  66. package/dist/commands/review/utils.d.ts.map +1 -1
  67. package/dist/commands/review/utils.js +127 -68
  68. package/dist/commands/session/index.d.ts +1 -1
  69. package/dist/commands/session/index.d.ts.map +1 -1
  70. package/dist/commands/session/index.js +134 -112
  71. package/dist/commands/session/types.d.ts +7 -0
  72. package/dist/commands/session/types.d.ts.map +1 -1
  73. package/dist/commands/share/html-renderer.d.ts +25 -0
  74. package/dist/commands/share/html-renderer.d.ts.map +1 -0
  75. package/dist/commands/share/html-renderer.js +384 -0
  76. package/dist/commands/share/index.d.ts +3 -0
  77. package/dist/commands/share/index.d.ts.map +1 -0
  78. package/dist/commands/share/index.js +122 -0
  79. package/dist/commands/shell/index.d.ts.map +1 -1
  80. package/dist/commands/shell/index.js +16 -1
  81. package/dist/commands/types.d.ts +2 -2
  82. package/dist/commands/types.d.ts.map +1 -1
  83. package/dist/{config.d.ts → config/index.d.ts} +20 -9
  84. package/dist/config/index.d.ts.map +1 -0
  85. package/dist/{config.js → config/index.js} +43 -42
  86. package/dist/execution/index.d.ts.map +1 -1
  87. package/dist/execution/index.js +75 -55
  88. package/dist/index.d.ts +1 -0
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +170 -127
  91. package/dist/middleware/cache.d.ts.map +1 -1
  92. package/dist/middleware/cache.js +18 -36
  93. package/dist/models/ai-config.d.ts +1 -0
  94. package/dist/models/ai-config.d.ts.map +1 -1
  95. package/dist/models/ai-config.js +4 -3
  96. package/dist/models/anthropic-provider.d.ts +2 -5
  97. package/dist/models/anthropic-provider.d.ts.map +1 -1
  98. package/dist/models/anthropic-provider.js +3 -70
  99. package/dist/models/deepseek-provider.d.ts +1 -0
  100. package/dist/models/deepseek-provider.d.ts.map +1 -1
  101. package/dist/models/google-provider.d.ts +2 -3
  102. package/dist/models/google-provider.d.ts.map +1 -1
  103. package/dist/models/google-provider.js +0 -26
  104. package/dist/models/groq-provider.d.ts +1 -0
  105. package/dist/models/groq-provider.d.ts.map +1 -1
  106. package/dist/models/manager.d.ts +13 -2
  107. package/dist/models/manager.d.ts.map +1 -1
  108. package/dist/models/manager.js +20 -8
  109. package/dist/models/openai-provider.d.ts +5 -5
  110. package/dist/models/openai-provider.d.ts.map +1 -1
  111. package/dist/models/openai-provider.js +27 -40
  112. package/dist/models/opencode-zen-provider.d.ts +8 -3
  113. package/dist/models/opencode-zen-provider.d.ts.map +1 -1
  114. package/dist/models/opencode-zen-provider.js +68 -11
  115. package/dist/models/openrouter-provider.d.ts +24 -30
  116. package/dist/models/openrouter-provider.d.ts.map +1 -1
  117. package/dist/models/openrouter-provider.js +92 -177
  118. package/dist/models/providers.d.ts +1 -1
  119. package/dist/models/providers.d.ts.map +1 -1
  120. package/dist/models/xai-provider.d.ts +4 -3
  121. package/dist/models/xai-provider.d.ts.map +1 -1
  122. package/dist/models/xai-provider.js +18 -18
  123. package/dist/modes/manager.d.ts +23 -0
  124. package/dist/modes/manager.d.ts.map +1 -0
  125. package/dist/modes/manager.js +77 -0
  126. package/dist/modes/prompts.d.ts +2 -0
  127. package/dist/modes/prompts.d.ts.map +1 -0
  128. package/dist/modes/prompts.js +143 -0
  129. package/dist/prompts/mentions.d.ts +11 -0
  130. package/dist/prompts/mentions.d.ts.map +1 -0
  131. package/dist/{mentions.js → prompts/mentions.js} +21 -80
  132. package/dist/prompts/system-prompt.d.ts +26 -0
  133. package/dist/prompts/system-prompt.d.ts.map +1 -0
  134. package/dist/{prompts.js → prompts/system-prompt.js} +50 -22
  135. package/dist/repl/index.d.ts +174 -0
  136. package/dist/repl/index.d.ts.map +1 -0
  137. package/dist/{repl-new.js → repl/index.js} +399 -76
  138. package/dist/repl/project-status.d.ts +1 -0
  139. package/dist/repl/project-status.d.ts.map +1 -1
  140. package/dist/repl/project-status.js +4 -1
  141. package/dist/sessions/manager.d.ts +93 -1
  142. package/dist/sessions/manager.d.ts.map +1 -1
  143. package/dist/sessions/manager.js +264 -9
  144. package/dist/sessions/summary.d.ts +4 -0
  145. package/dist/sessions/summary.d.ts.map +1 -0
  146. package/dist/sessions/summary.js +30 -0
  147. package/dist/{skills.d.ts → skills/index.d.ts} +14 -2
  148. package/dist/skills/index.d.ts.map +1 -0
  149. package/dist/skills/index.js +294 -0
  150. package/dist/subagents/index.d.ts +15 -0
  151. package/dist/subagents/index.d.ts.map +1 -0
  152. package/dist/subagents/index.js +231 -0
  153. package/dist/terminal/control.d.ts +1 -1
  154. package/dist/terminal/control.d.ts.map +1 -1
  155. package/dist/terminal/control.js +30 -9
  156. package/dist/terminal/east-asian-width.d.ts.map +1 -1
  157. package/dist/terminal/east-asian-width.js +404 -351
  158. package/dist/terminal/keys.d.ts +17 -0
  159. package/dist/terminal/keys.d.ts.map +1 -1
  160. package/dist/terminal/keys.js +37 -0
  161. package/dist/terminal/select-prompt.d.ts.map +1 -1
  162. package/dist/terminal/select-prompt.js +24 -12
  163. package/dist/terminal/string-width.d.ts.map +1 -1
  164. package/dist/terminal/string-width.js +25 -27
  165. package/dist/terminal/style.d.ts.map +1 -1
  166. package/dist/terminal/style.js +4 -7
  167. package/dist/terminal/supports-color.d.ts.map +1 -1
  168. package/dist/terminal/supports-color.js +41 -27
  169. package/dist/terminal/table/cell.d.ts +12 -0
  170. package/dist/terminal/table/cell.d.ts.map +1 -1
  171. package/dist/terminal/table/cell.js +40 -25
  172. package/dist/terminal/table/layout-manager.d.ts.map +1 -1
  173. package/dist/terminal/table/layout-manager.js +100 -68
  174. package/dist/terminal/table/utils.d.ts.map +1 -1
  175. package/dist/terminal/table/utils.js +17 -10
  176. package/dist/terminal/wrap-ansi.d.ts.map +1 -1
  177. package/dist/terminal/wrap-ansi.js +172 -103
  178. package/dist/tokens/tracker.d.ts +1 -0
  179. package/dist/tokens/tracker.d.ts.map +1 -1
  180. package/dist/tokens/tracker.js +3 -0
  181. package/dist/tools/agent.d.ts +27 -0
  182. package/dist/tools/agent.d.ts.map +1 -0
  183. package/dist/tools/agent.js +81 -0
  184. package/dist/tools/bash.d.ts +4 -3
  185. package/dist/tools/bash.d.ts.map +1 -1
  186. package/dist/tools/bash.js +343 -121
  187. package/dist/tools/code-search.d.ts +41 -0
  188. package/dist/tools/code-search.d.ts.map +1 -0
  189. package/dist/tools/code-search.js +195 -0
  190. package/dist/tools/directory-tree.d.ts +3 -3
  191. package/dist/tools/directory-tree.d.ts.map +1 -1
  192. package/dist/tools/directory-tree.js +8 -5
  193. package/dist/tools/dynamic-tool-loader.d.ts +2 -5
  194. package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
  195. package/dist/tools/dynamic-tool-loader.js +20 -4
  196. package/dist/tools/edit-file.d.ts +7 -7
  197. package/dist/tools/edit-file.d.ts.map +1 -1
  198. package/dist/tools/edit-file.js +164 -66
  199. package/dist/tools/glob.d.ts +6 -6
  200. package/dist/tools/glob.d.ts.map +1 -1
  201. package/dist/tools/glob.js +95 -55
  202. package/dist/tools/grep.d.ts +15 -12
  203. package/dist/tools/grep.d.ts.map +1 -1
  204. package/dist/tools/grep.js +300 -192
  205. package/dist/tools/index.d.ts +143 -5
  206. package/dist/tools/index.d.ts.map +1 -1
  207. package/dist/tools/index.js +39 -24
  208. package/dist/tools/ls.d.ts +2 -2
  209. package/dist/tools/ls.d.ts.map +1 -1
  210. package/dist/tools/ls.js +7 -5
  211. package/dist/tools/read-file.d.ts +3 -3
  212. package/dist/tools/read-file.d.ts.map +1 -1
  213. package/dist/tools/read-file.js +74 -34
  214. package/dist/tools/save-file.d.ts +3 -3
  215. package/dist/tools/save-file.d.ts.map +1 -1
  216. package/dist/tools/save-file.js +11 -11
  217. package/dist/tools/skill.d.ts +23 -0
  218. package/dist/tools/skill.d.ts.map +1 -0
  219. package/dist/tools/skill.js +65 -0
  220. package/dist/tools/think.d.ts.map +1 -1
  221. package/dist/tools/think.js +2 -9
  222. package/dist/tools/utils.d.ts +2 -0
  223. package/dist/tools/utils.d.ts.map +1 -1
  224. package/dist/tools/utils.js +12 -0
  225. package/dist/tools/web-fetch.d.ts +62 -0
  226. package/dist/tools/web-fetch.d.ts.map +1 -0
  227. package/dist/tools/web-fetch.js +429 -0
  228. package/dist/tools/web-search.d.ts +62 -0
  229. package/dist/tools/web-search.d.ts.map +1 -0
  230. package/dist/tools/web-search.js +226 -0
  231. package/dist/tui/autocomplete/attachment-provider.d.ts +3 -6
  232. package/dist/tui/autocomplete/attachment-provider.d.ts.map +1 -1
  233. package/dist/tui/autocomplete/attachment-provider.js +25 -78
  234. package/dist/tui/autocomplete/base-provider.d.ts +1 -0
  235. package/dist/tui/autocomplete/base-provider.d.ts.map +1 -1
  236. package/dist/tui/autocomplete/combined-provider.d.ts +1 -4
  237. package/dist/tui/autocomplete/combined-provider.d.ts.map +1 -1
  238. package/dist/tui/autocomplete/combined-provider.js +3 -17
  239. package/dist/tui/autocomplete/command-provider.d.ts +1 -0
  240. package/dist/tui/autocomplete/command-provider.d.ts.map +1 -1
  241. package/dist/tui/autocomplete/command-provider.js +3 -0
  242. package/dist/tui/autocomplete/file-search-provider.d.ts +2 -1
  243. package/dist/tui/autocomplete/file-search-provider.d.ts.map +1 -1
  244. package/dist/tui/autocomplete/file-search-provider.js +36 -16
  245. package/dist/tui/autocomplete/skill-provider.d.ts +17 -0
  246. package/dist/tui/autocomplete/skill-provider.d.ts.map +1 -0
  247. package/dist/tui/autocomplete/skill-provider.js +49 -0
  248. package/dist/tui/autocomplete.d.ts +2 -2
  249. package/dist/tui/autocomplete.d.ts.map +1 -1
  250. package/dist/tui/autocomplete.js +3 -5
  251. package/dist/tui/components/assistant-message.d.ts.map +1 -1
  252. package/dist/tui/components/assistant-message.js +0 -4
  253. package/dist/tui/components/editor.d.ts +21 -2
  254. package/dist/tui/components/editor.d.ts.map +1 -1
  255. package/dist/tui/components/editor.js +228 -236
  256. package/dist/tui/components/footer.d.ts +6 -4
  257. package/dist/tui/components/footer.d.ts.map +1 -1
  258. package/dist/tui/components/footer.js +49 -25
  259. package/dist/tui/components/markdown.d.ts +8 -5
  260. package/dist/tui/components/markdown.d.ts.map +1 -1
  261. package/dist/tui/components/markdown.js +57 -39
  262. package/dist/tui/components/modal.d.ts.map +1 -1
  263. package/dist/tui/components/modal.js +35 -33
  264. package/dist/tui/components/notification.d.ts +13 -2
  265. package/dist/tui/components/notification.d.ts.map +1 -1
  266. package/dist/tui/components/notification.js +37 -2
  267. package/dist/tui/components/progress-bar.js +1 -1
  268. package/dist/tui/components/select-list.d.ts +1 -0
  269. package/dist/tui/components/select-list.d.ts.map +1 -1
  270. package/dist/tui/components/select-list.js +14 -11
  271. package/dist/tui/components/text.d.ts +16 -0
  272. package/dist/tui/components/text.d.ts.map +1 -1
  273. package/dist/tui/components/text.js +72 -57
  274. package/dist/tui/components/thinking-block.d.ts +9 -0
  275. package/dist/tui/components/thinking-block.d.ts.map +1 -1
  276. package/dist/tui/components/thinking-block.js +43 -11
  277. package/dist/tui/components/tool-execution.d.ts +5 -1
  278. package/dist/tui/components/tool-execution.d.ts.map +1 -1
  279. package/dist/tui/components/tool-execution.js +19 -10
  280. package/dist/tui/components/user-message.d.ts.map +1 -1
  281. package/dist/tui/components/user-message.js +0 -3
  282. package/dist/tui/components/welcome.js +2 -2
  283. package/dist/tui/editor-launcher.d.ts +13 -0
  284. package/dist/tui/editor-launcher.d.ts.map +1 -0
  285. package/dist/tui/editor-launcher.js +39 -0
  286. package/dist/tui/index.d.ts +3 -1
  287. package/dist/tui/index.d.ts.map +1 -1
  288. package/dist/tui/index.js +1 -0
  289. package/dist/tui/terminal.d.ts +27 -0
  290. package/dist/tui/terminal.d.ts.map +1 -1
  291. package/dist/tui/terminal.js +144 -15
  292. package/dist/tui/tui.d.ts +43 -0
  293. package/dist/tui/tui.d.ts.map +1 -1
  294. package/dist/tui/tui.js +172 -41
  295. package/dist/utils/bash/parse.d.ts +19 -0
  296. package/dist/utils/bash/parse.d.ts.map +1 -0
  297. package/dist/utils/bash/parse.js +223 -0
  298. package/dist/utils/bash/quote.d.ts +6 -0
  299. package/dist/utils/bash/quote.d.ts.map +1 -0
  300. package/dist/utils/bash/quote.js +23 -0
  301. package/dist/utils/bash.d.ts.map +1 -1
  302. package/dist/utils/bash.js +211 -126
  303. package/dist/utils/command-protection.d.ts +28 -0
  304. package/dist/utils/command-protection.d.ts.map +1 -0
  305. package/dist/utils/command-protection.js +324 -0
  306. package/dist/utils/dedent.d.ts.map +1 -0
  307. package/dist/utils/env-expand.d.ts +2 -0
  308. package/dist/utils/env-expand.d.ts.map +1 -0
  309. package/dist/utils/env-expand.js +8 -0
  310. package/dist/utils/filesystem/path-display.d.ts +11 -0
  311. package/dist/utils/filesystem/path-display.d.ts.map +1 -0
  312. package/dist/utils/filesystem/path-display.js +32 -0
  313. package/dist/utils/filesystem/security.d.ts +2 -2
  314. package/dist/utils/filesystem/security.d.ts.map +1 -1
  315. package/dist/utils/filesystem/security.js +32 -31
  316. package/dist/utils/formatting.d.ts.map +1 -0
  317. package/dist/{formatting.js → utils/formatting.js} +1 -1
  318. package/dist/utils/git.d.ts +4 -0
  319. package/dist/utils/git.d.ts.map +1 -1
  320. package/dist/utils/git.js +30 -0
  321. package/dist/utils/glob.d.ts +1 -1
  322. package/dist/utils/glob.d.ts.map +1 -1
  323. package/dist/utils/logger.d.ts.map +1 -0
  324. package/dist/{logger.js → utils/logger.js} +1 -1
  325. package/dist/utils/parsing.d.ts.map +1 -0
  326. package/dist/utils/process.d.ts.map +1 -1
  327. package/dist/utils/process.js +90 -37
  328. package/dist/utils/templates.d.ts +2 -0
  329. package/dist/utils/templates.d.ts.map +1 -0
  330. package/dist/utils/templates.js +24 -0
  331. package/dist/utils/version.d.ts.map +1 -0
  332. package/dist/{version.js → utils/version.js} +1 -1
  333. package/package.json +34 -25
  334. package/dist/cli.d.ts +0 -23
  335. package/dist/cli.d.ts.map +0 -1
  336. package/dist/commands/exit/index.d.ts +0 -10
  337. package/dist/commands/exit/index.d.ts.map +0 -1
  338. package/dist/commands/exit/index.js +0 -21
  339. package/dist/commands/exit/types.d.ts +0 -8
  340. package/dist/commands/exit/types.d.ts.map +0 -1
  341. package/dist/commands/exit/types.js +0 -1
  342. package/dist/commands/exit/utils.d.ts +0 -2
  343. package/dist/commands/exit/utils.d.ts.map +0 -1
  344. package/dist/commands/exit/utils.js +0 -13
  345. package/dist/commands/prompt/index.d.ts +0 -5
  346. package/dist/commands/prompt/index.d.ts.map +0 -1
  347. package/dist/commands/prompt/index.js +0 -126
  348. package/dist/commands/prompt/types.d.ts +0 -15
  349. package/dist/commands/prompt/types.d.ts.map +0 -1
  350. package/dist/commands/prompt/types.js +0 -1
  351. package/dist/commands/prompt/utils.d.ts +0 -12
  352. package/dist/commands/prompt/utils.d.ts.map +0 -1
  353. package/dist/commands/prompt/utils.js +0 -107
  354. package/dist/commands/reset/index.d.ts +0 -3
  355. package/dist/commands/reset/index.d.ts.map +0 -1
  356. package/dist/commands/reset/index.js +0 -25
  357. package/dist/commands/reset/types.d.ts +0 -1
  358. package/dist/commands/reset/types.d.ts.map +0 -1
  359. package/dist/commands/reset/types.js +0 -3
  360. package/dist/commands/save/index.d.ts +0 -3
  361. package/dist/commands/save/index.d.ts.map +0 -1
  362. package/dist/commands/save/index.js +0 -19
  363. package/dist/config.d.ts.map +0 -1
  364. package/dist/dedent.d.ts.map +0 -1
  365. package/dist/formatting.d.ts.map +0 -1
  366. package/dist/logger.d.ts.map +0 -1
  367. package/dist/mentions.d.ts +0 -14
  368. package/dist/mentions.d.ts.map +0 -1
  369. package/dist/parsing.d.ts.map +0 -1
  370. package/dist/prompts.d.ts +0 -10
  371. package/dist/prompts.d.ts.map +0 -1
  372. package/dist/repl-new.d.ts +0 -62
  373. package/dist/repl-new.d.ts.map +0 -1
  374. package/dist/skills.d.ts.map +0 -1
  375. package/dist/skills.js +0 -233
  376. package/dist/tui/autocomplete/path-provider.d.ts +0 -21
  377. package/dist/tui/autocomplete/path-provider.d.ts.map +0 -1
  378. package/dist/tui/autocomplete/path-provider.js +0 -164
  379. package/dist/version.d.ts.map +0 -1
  380. /package/dist/{dedent.d.ts → utils/dedent.d.ts} +0 -0
  381. /package/dist/{dedent.js → utils/dedent.js} +0 -0
  382. /package/dist/{formatting.d.ts → utils/formatting.d.ts} +0 -0
  383. /package/dist/{logger.d.ts → utils/logger.d.ts} +0 -0
  384. /package/dist/{parsing.d.ts → utils/parsing.d.ts} +0 -0
  385. /package/dist/{parsing.js → utils/parsing.js} +0 -0
  386. /package/dist/{version.d.ts → utils/version.d.ts} +0 -0
@@ -16,10 +16,10 @@ export declare function initTools({ workspace, }: {
16
16
  description: string;
17
17
  inputSchema: import("zod").ZodObject<{
18
18
  path: import("zod").ZodString;
19
- edits: import("zod").ZodArray<import("zod").ZodObject<{
19
+ edits: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodArray<import("zod").ZodObject<{
20
20
  oldText: import("zod").ZodString;
21
21
  newText: import("zod").ZodString;
22
- }, import("zod/v4/core").$strip>>;
22
+ }, import("zod/v4/core").$strip>>>;
23
23
  }, import("zod/v4/core").$strip>;
24
24
  };
25
25
  display({ path, edits }: {
@@ -134,12 +134,12 @@ export declare function initTools({ workspace, }: {
134
134
  toolDef: {
135
135
  description: string;
136
136
  inputSchema: import("zod").ZodObject<{
137
- patterns: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>;
138
- path: import("zod").ZodString;
137
+ patterns: import("zod").ZodPipe<import("zod").ZodTransform<{}, unknown>, import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>;
138
+ path: import("zod").ZodPipe<import("zod").ZodTransform<{}, unknown>, import("zod").ZodString>;
139
139
  gitignore: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
140
140
  recursive: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
141
141
  expandDirectories: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
142
- ignoreFiles: import("zod").ZodNullable<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>;
142
+ ignoreFiles: import("zod").ZodPipe<import("zod").ZodTransform<{} | null | undefined, unknown>, import("zod").ZodNullable<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>>;
143
143
  cwd: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedString<unknown>>>;
144
144
  maxResults: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
145
145
  }, import("zod/v4/core").$strip>;
@@ -203,6 +203,50 @@ export declare function initTools({ workspace, }: {
203
203
  maxResults: number | null;
204
204
  }, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
205
205
  };
206
+ readonly CodeSearch: {
207
+ toolDef: {
208
+ description: string;
209
+ inputSchema: import("zod").ZodObject<{
210
+ query: import("zod").ZodString;
211
+ path: import("zod").ZodDefault<import("zod").ZodString>;
212
+ regexPattern: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodString>>;
213
+ filePattern: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodString>>;
214
+ excludePattern: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodString>>;
215
+ excludeDir: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodString>>;
216
+ maxResults: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
217
+ contextLines: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>;
218
+ filesOnly: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
219
+ showContent: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
220
+ codeOnly: import("zod").ZodPipe<import("zod").ZodTransform<unknown, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>;
221
+ }, import("zod/v4/core").$strip>;
222
+ };
223
+ display({ query, path, regexPattern, filePattern, excludePattern, excludeDir, maxResults, contextLines, filesOnly, showContent, codeOnly, }: {
224
+ query: string;
225
+ path: string;
226
+ regexPattern: string | null;
227
+ filePattern: string | null;
228
+ excludePattern: string | null;
229
+ excludeDir: string | null;
230
+ maxResults: number | null;
231
+ contextLines: number | null;
232
+ filesOnly: boolean | null;
233
+ showContent: boolean | null;
234
+ codeOnly: boolean | null;
235
+ }): string;
236
+ execute({ query, path, regexPattern, filePattern, excludePattern, excludeDir, maxResults, contextLines, filesOnly, showContent, codeOnly, }: {
237
+ query: string;
238
+ path: string;
239
+ regexPattern: string | null;
240
+ filePattern: string | null;
241
+ excludePattern: string | null;
242
+ excludeDir: string | null;
243
+ maxResults: number | null;
244
+ contextLines: number | null;
245
+ filesOnly: boolean | null;
246
+ showContent: boolean | null;
247
+ codeOnly: boolean | null;
248
+ }, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
249
+ };
206
250
  readonly DirectoryTree: {
207
251
  toolDef: {
208
252
  description: string;
@@ -252,5 +296,99 @@ export declare function initTools({ workspace, }: {
252
296
  path?: string | undefined;
253
297
  }, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
254
298
  };
299
+ readonly Skill: {
300
+ toolDef: {
301
+ description: string;
302
+ inputSchema: import("zod").ZodObject<{
303
+ skill: import("zod").ZodString;
304
+ args: import("zod").ZodOptional<import("zod").ZodString>;
305
+ }, import("zod/v4/core").$strip>;
306
+ };
307
+ display({ skill: skillName }: {
308
+ skill: string;
309
+ args?: string | undefined;
310
+ }): string;
311
+ execute({ skill: skillName, args }: {
312
+ skill: string;
313
+ args?: string | undefined;
314
+ }, { abortSignal }: import("./types.ts").ToolExecutionOptions): Promise<string>;
315
+ };
316
+ readonly Agent: {
317
+ toolDef: {
318
+ description: string;
319
+ inputSchema: import("zod").ZodObject<{
320
+ prompt: import("zod").ZodString;
321
+ type: import("zod").ZodString;
322
+ timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
323
+ }, import("zod/v4/core").$strip>;
324
+ };
325
+ display: ({ prompt, type }: import("zod").infer<import("zod").ZodObject<{
326
+ prompt: import("zod").ZodString;
327
+ type: import("zod").ZodString;
328
+ timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
329
+ }, import("zod/v4/core").$strip>>) => string;
330
+ execute: ({ prompt, type, timeout }: import("zod").infer<import("zod").ZodObject<{
331
+ prompt: import("zod").ZodString;
332
+ type: import("zod").ZodString;
333
+ timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
334
+ }, import("zod/v4/core").$strip>>, { abortSignal }: import("./types.ts").ToolExecutionOptions) => Promise<string>;
335
+ };
336
+ readonly WebSearch: {
337
+ toolDef: {
338
+ description: string;
339
+ inputSchema: import("zod").ZodObject<{
340
+ query: import("zod").ZodString;
341
+ numResults: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodTransform<string | null, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>>;
342
+ timeout: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodTransform<string | null, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>>;
343
+ provider: import("zod").ZodOptional<import("zod").ZodEnum<{
344
+ exa: "exa";
345
+ duckduckgo: "duckduckgo";
346
+ }>>;
347
+ }, import("zod/v4/core").$strip>;
348
+ };
349
+ display({ query }: {
350
+ query: string;
351
+ numResults?: number | null | undefined;
352
+ timeout?: number | null | undefined;
353
+ provider?: "exa" | "duckduckgo" | undefined;
354
+ }): string;
355
+ execute(options: {
356
+ query: string;
357
+ numResults?: number | null | undefined;
358
+ timeout?: number | null | undefined;
359
+ provider?: "exa" | "duckduckgo" | undefined;
360
+ }, executionOptions: import("./types.ts").ToolExecutionOptions): Promise<string>;
361
+ };
362
+ readonly WebFetch: {
363
+ toolDef: {
364
+ description: string;
365
+ inputSchema: import("zod").ZodObject<{
366
+ url: import("zod").ZodString;
367
+ output: import("zod").ZodDefault<import("zod").ZodEnum<{
368
+ markdown: "markdown";
369
+ text: "text";
370
+ html: "html";
371
+ json: "json";
372
+ }>>;
373
+ jina: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodTransform<string | null, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>>;
374
+ timeout: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodTransform<string | null, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedNumber<unknown>>>>;
375
+ headers: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodTransform<string | null, unknown>, import("zod").ZodNullable<import("zod").ZodCoercedBoolean<unknown>>>>;
376
+ }, import("zod/v4/core").$strip>;
377
+ };
378
+ display({ url }: {
379
+ url: string;
380
+ output: "markdown" | "text" | "html" | "json";
381
+ jina?: boolean | null | undefined;
382
+ timeout?: number | null | undefined;
383
+ headers?: boolean | null | undefined;
384
+ }): string;
385
+ execute(options: {
386
+ url: string;
387
+ output: "markdown" | "text" | "html" | "json";
388
+ jina?: boolean | null | undefined;
389
+ timeout?: number | null | undefined;
390
+ headers?: boolean | null | undefined;
391
+ }, executionOptions: import("./types.ts").ToolExecutionOptions): Promise<string>;
392
+ };
255
393
  }>;
256
394
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAepD,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,UAAU,CAAC,IAAI,MAAM,eAAe,CAAC,OAAO,SAAS,CAAC,GAAG,eAAe,CACvE,OAAO,SAAS,CACjB,CAAC,CAAC,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,UAAU,CAAC,IAAI,MAAM,eAAe,CAAC,OAAO,SAAS,CAAC,GAAG,IAAI,CAC5D,OAAO,EACP,MAAM,CACP;CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,eAAe,CAAC;AAEtD,wBAAsB,SAAS,CAAC,EAC9B,SAAS,GACV,EAAE;IACD,SAAS,EAAE,gBAAgB,CAAC;CAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAoBpD,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,UAAU,CAAC,IAAI,MAAM,eAAe,CAAC,OAAO,SAAS,CAAC,GAAG,eAAe,CACvE,OAAO,SAAS,CACjB,CAAC,CAAC,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,UAAU,CAAC,IAAI,MAAM,eAAe,CAAC,OAAO,SAAS,CAAC,GAAG,IAAI,CAC5D,OAAO,EACP,MAAM,CACP;CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,eAAe,CAAC;AAEtD,wBAAsB,SAAS,CAAC,EAC9B,SAAS,GACV,EAAE;IACD,SAAS,EAAE,gBAAgB,CAAC;CAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EA"}
@@ -1,4 +1,7 @@
1
+ import { config } from "../config/index.js";
2
+ import { AgentTool, createAgentTools } from "./agent.js";
1
3
  import { BashTool, createBashTool } from "./bash.js";
4
+ import { CodeSearchTool, createCodeSearchTool } from "./code-search.js";
2
5
  import { createDirectoryTreeTool, DirectoryTreeTool, } from "./directory-tree.js";
3
6
  import { loadDynamicTools } from "./dynamic-tool-loader.js";
4
7
  import { createEditFileTool, EditFileTool } from "./edit-file.js";
@@ -7,37 +10,44 @@ import { createGrepTool, GrepTool } from "./grep.js";
7
10
  import { createLsTool, LsTool } from "./ls.js";
8
11
  import { createReadFileTool, ReadFileTool } from "./read-file.js";
9
12
  import { createSaveFileTool, SaveFileTool } from "./save-file.js";
13
+ import { createSkillTool, SkillTool } from "./skill.js";
10
14
  import { createThinkTool, ThinkTool } from "./think.js";
15
+ import { createWebFetchTool, WebFetchTool } from "./web-fetch.js";
16
+ import { createWebSearchTool, WebSearchTool } from "./web-search.js";
11
17
  export async function initTools({ workspace, }) {
12
- const readFileTool = await createReadFileTool({
13
- workingDir: workspace.primaryDir,
14
- allowedDirs: workspace.allowedDirs,
15
- });
16
- const editFileTool = await createEditFileTool({
17
- workingDir: workspace.primaryDir,
18
- allowedDirs: workspace.allowedDirs,
19
- });
20
- const saveFileTool = await createSaveFileTool({
21
- workingDir: workspace.primaryDir,
22
- allowedDirs: workspace.allowedDirs,
23
- });
24
- const directoryTreeTool = await createDirectoryTreeTool({
25
- workingDir: workspace.primaryDir,
26
- allowedDirs: workspace.allowedDirs,
27
- });
18
+ const readFileTool = await createReadFileTool({ workspace });
19
+ const editFileTool = await createEditFileTool({ workspace });
20
+ const saveFileTool = await createSaveFileTool({ workspace });
21
+ const directoryTreeTool = await createDirectoryTreeTool({ workspace });
28
22
  const globTool = createGlobTool();
29
23
  const grepTool = createGrepTool();
24
+ const codeSearchTool = createCodeSearchTool();
30
25
  const thinkTool = createThinkTool();
31
- const lsTool = await createLsTool({
32
- workingDir: workspace.primaryDir,
33
- allowedDirs: workspace.allowedDirs,
34
- });
35
- const bashTool = await createBashTool({
36
- baseDir: workspace.primaryDir,
37
- allowedDirs: workspace.allowedDirs,
38
- });
26
+ const lsTool = await createLsTool({ workspace });
27
+ const projectConfig = await config.getConfig();
28
+ const bashTool = await createBashTool({ workspace, env: projectConfig.env });
29
+ const skillTool = await createSkillTool();
30
+ const agentTool = await createAgentTools({ workspace });
31
+ const webSearchTool = await createWebSearchTool();
32
+ const webFetchTool = await createWebFetchTool();
39
33
  const dynamicTools = await loadDynamicTools({
40
34
  baseDir: workspace.primaryDir,
35
+ existingToolNames: [
36
+ EditFileTool.name,
37
+ BashTool.name,
38
+ SaveFileTool.name,
39
+ ReadFileTool.name,
40
+ GlobTool.name,
41
+ GrepTool.name,
42
+ CodeSearchTool.name,
43
+ DirectoryTreeTool.name,
44
+ ThinkTool.name,
45
+ LsTool.name,
46
+ SkillTool.name,
47
+ AgentTool.name,
48
+ WebSearchTool.name,
49
+ WebFetchTool.name,
50
+ ],
41
51
  });
42
52
  // Build tools object for AI SDK
43
53
  const tools = {
@@ -47,9 +57,14 @@ export async function initTools({ workspace, }) {
47
57
  [ReadFileTool.name]: readFileTool,
48
58
  [GlobTool.name]: globTool,
49
59
  [GrepTool.name]: grepTool,
60
+ [CodeSearchTool.name]: codeSearchTool,
50
61
  [DirectoryTreeTool.name]: directoryTreeTool,
51
62
  [ThinkTool.name]: thinkTool,
52
63
  [LsTool.name]: lsTool,
64
+ [SkillTool.name]: skillTool,
65
+ [AgentTool.name]: agentTool,
66
+ [WebSearchTool.name]: webSearchTool,
67
+ [WebFetchTool.name]: webFetchTool,
53
68
  // Add dynamic tools - they already have toolDef structure
54
69
  ...Object.fromEntries(Object.entries(dynamicTools).map(([name, toolObj]) => [name, toolObj])),
55
70
  };
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import type { WorkspaceContext } from "../index.ts";
2
3
  import type { ToolExecutionOptions } from "./types.ts";
3
4
  export declare const LsTool: {
4
5
  name: "LS";
@@ -9,8 +10,7 @@ declare const inputSchema: z.ZodObject<{
9
10
  }, z.core.$strip>;
10
11
  type LsInputSchema = z.infer<typeof inputSchema>;
11
12
  export declare const createLsTool: (options: {
12
- workingDir: string;
13
- allowedDirs?: string[];
13
+ workspace: WorkspaceContext;
14
14
  }) => Promise<{
15
15
  toolDef: {
16
16
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../source/tools/ls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,eAAO,MAAM,MAAM;;CAElB,CAAC;AAEF,QAAA,MAAM,WAAW;;;iBAQf,CAAC;AAEH,KAAK,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAIjD,eAAO,MAAM,YAAY,GAAU,SAAS;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;;;;;;;;2CAS0C,aAAa;2CAMnB,aAAa,mBAC3B,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EA6DrB,CAAC"}
1
+ {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../source/tools/ls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAMpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,eAAO,MAAM,MAAM;;CAElB,CAAC;AAEF,QAAA,MAAM,WAAW;;;iBAQf,CAAC;AAEH,KAAK,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAIjD,eAAO,MAAM,YAAY,GAAU,SAAS;IAC1C,SAAS,EAAE,gBAAgB,CAAC;CAC7B;;;;;;;;2CAS0C,aAAa;2CAOnB,aAAa,mBAC3B,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EA6DrB,CAAC"}
package/dist/tools/ls.js CHANGED
@@ -3,6 +3,7 @@ import path from "node:path";
3
3
  import { z } from "zod";
4
4
  import style from "../terminal/style.js";
5
5
  import { isDirectory } from "../utils/filesystem/operations.js";
6
+ import { toDisplayPath } from "../utils/filesystem/path-display.js";
6
7
  import { validatePath } from "../utils/filesystem/security.js";
7
8
  import { convertNullString } from "../utils/zod.js";
8
9
  export const LsTool = {
@@ -19,17 +20,18 @@ const inputSchema = z.object({
19
20
  });
20
21
  const DEFAULT_ENTRY_LIMIT = 500;
21
22
  export const createLsTool = async (options) => {
22
- const { workingDir, allowedDirs } = options;
23
- const allowedDirectory = allowedDirs ?? [workingDir];
23
+ const { primaryDir, allowedDirs } = options.workspace;
24
+ const allowedDirectory = allowedDirs ?? [primaryDir];
24
25
  return {
25
26
  toolDef: {
26
- description: `List directory contents. Returns entries sorted alphabetically, with '/' suffix for directories. Includes dotfiles. Output is limited to ${DEFAULT_ENTRY_LIMIT} entries by default. Use the limit parameter to adjust.`,
27
+ description: "List files in a directory.",
27
28
  inputSchema,
28
29
  },
29
30
  display({ path: providedPath, limit }) {
30
31
  const dirPath = providedPath ?? ".";
31
32
  const effectiveLimit = limit ?? 500;
32
- return `\n> Listing ${style.cyan(dirPath)} (limit: ${effectiveLimit})`;
33
+ const displayPath = toDisplayPath(dirPath);
34
+ return `${style.cyan(displayPath)} (limit: ${effectiveLimit})`;
33
35
  },
34
36
  async execute({ path: providedPath, limit }, { abortSignal }) {
35
37
  if (abortSignal?.aborted) {
@@ -37,7 +39,7 @@ export const createLsTool = async (options) => {
37
39
  }
38
40
  const dirPath = providedPath ?? ".";
39
41
  const effectiveLimit = limit ?? DEFAULT_ENTRY_LIMIT;
40
- const resolvedPath = await validatePath(path.resolve(workingDir, dirPath), allowedDirectory, { requireExistence: true, abortSignal });
42
+ const resolvedPath = await validatePath(path.resolve(primaryDir, dirPath), allowedDirectory, { requireExistence: true, abortSignal });
41
43
  if (abortSignal?.aborted) {
42
44
  throw new Error("Directory listing aborted before validation");
43
45
  }
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import type { WorkspaceContext } from "../index.ts";
2
3
  import type { ToolExecutionOptions } from "./types.ts";
3
4
  export declare const ReadFileTool: {
4
5
  name: "Read";
@@ -23,9 +24,8 @@ declare const inputSchema: z.ZodObject<{
23
24
  maxBytes: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
24
25
  }, z.core.$strip>;
25
26
  type ReadFileInputSchema = z.infer<typeof inputSchema>;
26
- export declare const createReadFileTool: ({ workingDir, allowedDirs, }: {
27
- workingDir: string;
28
- allowedDirs?: string[];
27
+ export declare const createReadFileTool: (options: {
28
+ workspace: WorkspaceContext;
29
29
  }) => Promise<{
30
30
  toolDef: {
31
31
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../source/tools/read-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAMvD,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;iBAuBf,CAAC;AAEH,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD,eAAO,MAAM,kBAAkB,GAAU,8BAGtC;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;;;;;;;;;;;;;;;;;;;;;;;0DAOyD,mBAAmB;+EAUpE,mBAAmB,mBACL,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EAqDrB,CAAC"}
1
+ {"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../source/tools/read-file.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAKpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAMvD,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;iBAuBf,CAAC;AAEH,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD,eAAO,MAAM,kBAAkB,GAAU,SAAS;IAChD,SAAS,EAAE,gBAAgB,CAAC;CAC7B;;;;;;;;;;;;;;;;;;;;;;;0DAQyD,mBAAmB;+EAWpE,mBAAmB,mBACL,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EA2BrB,CAAC"}
@@ -1,12 +1,14 @@
1
1
  import fs from "node:fs/promises";
2
+ import { createInterface } from "node:readline/promises";
2
3
  import { isNumber } from "@travisennis/stdlib/typeguards";
3
4
  import { z } from "zod";
4
5
  import style from "../terminal/style.js";
6
+ import { toDisplayPath } from "../utils/filesystem/path-display.js";
5
7
  import { joinWorkingDir, validatePath } from "../utils/filesystem/security.js";
6
8
  import { convertNullString } from "../utils/zod.js";
7
9
  import { fileEncodingSchema } from "./types.js";
8
- // default limit in bytes
9
- const DEFAULT_BYTE_LIMIT = 80 * 1024;
10
+ // default limit in bytes (20KB)
11
+ const DEFAULT_BYTE_LIMIT = 20 * 1024;
10
12
  export const ReadFileTool = {
11
13
  name: "Read",
12
14
  };
@@ -24,51 +26,89 @@ const inputSchema = z.object({
24
26
  .describe("Maximum number of lines to read. Required but nullable. Pass null to get all lines."),
25
27
  maxBytes: z
26
28
  .preprocess((val) => convertNullString(val), z.coerce.number().nullable())
27
- .describe("Maximum number of bytes to read. Set to 0 for no limit. (Default: 80KB)"),
29
+ .describe("Maximum number of bytes to read. Set to 0 for no limit. (Default: 20KB)"),
28
30
  });
29
- export const createReadFileTool = async ({ workingDir, allowedDirs, }) => {
30
- const allowedDirectory = allowedDirs ?? [workingDir];
31
+ export const createReadFileTool = async (options) => {
32
+ const { primaryDir, allowedDirs } = options.workspace;
33
+ const allowedDirectory = allowedDirs ?? [primaryDir];
31
34
  return {
32
35
  toolDef: {
33
- description: `Read the complete contents of a file from the file system unless startLine and lineCount are given to read a file selection. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to examine the contents of a single file. Only works within allowed directories. Automatically limits file size to prevent overwhelming output. Default limit is ${DEFAULT_BYTE_LIMIT} bytes (${DEFAULT_BYTE_LIMIT / 1024}KB). Use maxBytes parameter to override this limit.`,
36
+ description: "Read the contents of a file.",
34
37
  inputSchema,
35
38
  },
36
39
  display({ path: providedPath, startLine, lineCount }) {
37
- return `\n> ${style.cyan(providedPath)}${startLine ? style.cyan(`:${startLine}`) : ""}${lineCount ? style.cyan(`:${lineCount}`) : ""}`;
40
+ const displayPath = toDisplayPath(providedPath);
41
+ return `${style.cyan(displayPath)}${startLine ? style.cyan(`:${startLine}`) : ""}${lineCount ? style.cyan(`:${lineCount}`) : ""}`;
38
42
  },
39
43
  async execute({ path: providedPath, encoding, startLine, lineCount, maxBytes, }, { abortSignal }) {
40
44
  if (abortSignal?.aborted) {
41
45
  throw new Error("File reading aborted");
42
46
  }
43
- const filePath = await validatePath(joinWorkingDir(providedPath, workingDir), allowedDirectory, { abortSignal });
44
- if (abortSignal?.aborted) {
45
- throw new Error("File reading aborted before file read");
46
- }
47
- let file = await fs.readFile(filePath, {
48
- encoding: encoding ?? "utf-8",
49
- });
50
- if (isNumber(startLine) || isNumber(lineCount)) {
51
- const lines = file.split("\n");
52
- const totalLines = lines.length;
53
- const startIndex = (startLine ?? 1) - 1;
54
- const count = lineCount ?? totalLines - startIndex;
55
- if (startIndex < 0 || startIndex >= totalLines) {
56
- throw new Error(`startLine ${startLine} is out of bounds for file with ${totalLines} lines.`);
57
- }
58
- const endIndex = Math.min(startIndex + count, totalLines);
59
- file = lines.slice(startIndex, endIndex).join("\n");
60
- }
47
+ const filePath = await validatePath(joinWorkingDir(providedPath, primaryDir), allowedDirectory, { abortSignal });
48
+ const effectiveEncoding = encoding ?? "utf-8";
61
49
  const effectiveMaxBytes = maxBytes ?? DEFAULT_BYTE_LIMIT;
62
- if (effectiveMaxBytes !== null &&
63
- effectiveMaxBytes !== undefined &&
64
- effectiveMaxBytes > 0) {
65
- const buffer = Buffer.from(file, encoding ?? "utf-8");
66
- if (buffer.byteLength > effectiveMaxBytes) {
67
- const truncatedBuffer = buffer.subarray(0, effectiveMaxBytes);
68
- file = truncatedBuffer.toString(encoding ?? "utf-8");
69
- }
70
- }
50
+ const file = await readFileContent(filePath, effectiveEncoding, startLine, lineCount, abortSignal);
51
+ validateByteLimit(file, effectiveEncoding, effectiveMaxBytes);
71
52
  return file;
72
53
  },
73
54
  };
74
55
  };
56
+ // Read file content either line-by-line or as a whole
57
+ async function readFileContent(filePath, encoding, startLine, lineCount, abortSignal) {
58
+ const useLineBasedRead = isNumber(startLine) || isNumber(lineCount);
59
+ if (useLineBasedRead) {
60
+ return readFileLines(filePath, startLine, lineCount, abortSignal);
61
+ }
62
+ if (abortSignal?.aborted) {
63
+ throw new Error("File reading aborted before file read");
64
+ }
65
+ return fs.readFile(filePath, { encoding });
66
+ }
67
+ // Read specific lines from a file using streaming
68
+ async function readFileLines(filePath, startLine, lineCount, abortSignal) {
69
+ const fileStream = await fs.open(filePath, "r");
70
+ const rl = createInterface({
71
+ input: fileStream.createReadStream(),
72
+ crlfDelay: Number.POSITIVE_INFINITY,
73
+ });
74
+ const lines = [];
75
+ const startIndex = (startLine ?? 1) - 1;
76
+ const count = lineCount ?? Number.POSITIVE_INFINITY;
77
+ let currentIndex = 0;
78
+ for await (const line of rl) {
79
+ if (currentIndex >= startIndex && currentIndex < startIndex + count) {
80
+ lines.push(line);
81
+ }
82
+ currentIndex++;
83
+ if (currentIndex >= startIndex + count) {
84
+ break;
85
+ }
86
+ if (abortSignal?.aborted) {
87
+ rl.close();
88
+ await fileStream.close();
89
+ throw new Error("File reading aborted");
90
+ }
91
+ }
92
+ rl.close();
93
+ await fileStream.close();
94
+ if (startIndex >= currentIndex) {
95
+ throw new Error(`startLine ${startLine} is out of bounds for file with ${currentIndex} lines.`);
96
+ }
97
+ return lines.join("\n");
98
+ }
99
+ // Validate that file content doesn't exceed byte limit
100
+ function validateByteLimit(file, encoding, maxBytes) {
101
+ if (maxBytes <= 0) {
102
+ return;
103
+ }
104
+ const byteLength = Buffer.byteLength(file, encoding);
105
+ if (byteLength > maxBytes) {
106
+ const fileSizeKb = (byteLength / 1024).toFixed(1);
107
+ const limitKb = (maxBytes / 1024).toFixed(0);
108
+ throw new Error(`File (${fileSizeKb}KB) exceeds the ${limitKb}KB read limit. To read this file, use one of these options:\n` +
109
+ "• Set maxBytes: 0 to read the entire file\n" +
110
+ "• Use startLine and lineCount to read specific portions (e.g., startLine: 1, lineCount: 100)\n" +
111
+ "• Use the Grep tool to search for specific content\n" +
112
+ `• Use the Bash tool with 'tail' or 'head' commands`);
113
+ }
114
+ }
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import type { WorkspaceContext } from "../index.ts";
2
3
  import { type ToolExecutionOptions } from "./types.ts";
3
4
  export declare const SaveFileTool: {
4
5
  name: "Write";
@@ -21,9 +22,8 @@ declare const inputSchema: z.ZodObject<{
21
22
  }>>;
22
23
  }, z.core.$strip>;
23
24
  type SaveFileInputSchema = z.infer<typeof inputSchema>;
24
- export declare const createSaveFileTool: ({ workingDir, allowedDirs, }: {
25
- workingDir: string;
26
- allowedDirs?: string[];
25
+ export declare const createSaveFileTool: (options: {
26
+ workspace: WorkspaceContext;
27
27
  }) => Promise<{
28
28
  toolDef: {
29
29
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"save-file.d.ts","sourceRoot":"","sources":["../../source/tools/save-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,EAAsB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE3E,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;iBAQf,CAAC;AAEH,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD,eAAO,MAAM,kBAAkB,GAAU,8BAGtC;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;;;;;;;;;;;;;;;;;;;;;sBAYqB,mBAAmB;mDAII,mBAAmB,mBACzC,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EAqDrB,CAAC"}
1
+ {"version":3,"file":"save-file.d.ts","sourceRoot":"","sources":["../../source/tools/save-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AASpD,OAAO,EAAsB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE3E,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;iBAQf,CAAC;AAEH,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD,eAAO,MAAM,kBAAkB,GAAU,SAAS;IAChD,SAAS,EAAE,gBAAgB,CAAC;CAC7B;;;;;;;;;;;;;;;;;;;;;sBAUqB,mBAAmB;mDAKI,mBAAmB,mBACzC,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EAoDrB,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { z } from "zod";
4
- import { config } from "../config.js";
4
+ import { config } from "../config/index.js";
5
5
  import { clearProjectStatusCache } from "../repl/project-status.js";
6
6
  import style from "../terminal/style.js";
7
+ import { toDisplayPath } from "../utils/filesystem/path-display.js";
7
8
  import { joinWorkingDir, validateFileNotReadOnly, validatePath, } from "../utils/filesystem/security.js";
8
9
  import { fileEncodingSchema } from "./types.js";
9
10
  export const SaveFileTool = {
@@ -16,28 +17,27 @@ const inputSchema = z.object({
16
17
  .describe('Encoding format for saving the file. Use "utf-8" as default for text files')
17
18
  .default("utf-8"),
18
19
  });
19
- export const createSaveFileTool = async ({ workingDir, allowedDirs, }) => {
20
- const allowedDirectory = allowedDirs ?? [workingDir];
20
+ export const createSaveFileTool = async (options) => {
21
+ const { primaryDir, allowedDirs } = options.workspace;
22
+ const allowedDirectory = allowedDirs ?? [primaryDir];
23
+ const projectConfig = await config.getConfig();
21
24
  return {
22
25
  toolDef: {
23
- description: "Create a new file or completely overwrite an existing file with new content. " +
24
- "Automatically creates all missing parent directories. " +
25
- "Use with caution as it will overwrite existing files without warning. " +
26
- "Handles text content with proper encoding. Only works within allowed directories.",
26
+ description: "Create or overwrite a file with new content.",
27
27
  inputSchema,
28
28
  },
29
29
  display({ path }) {
30
- return `\n> ${style.cyan(path)}`;
30
+ const displayPath = toDisplayPath(path);
31
+ return `${style.cyan(displayPath)}`;
31
32
  },
32
33
  async execute({ path: userPath, content, encoding }, { abortSignal }) {
33
34
  if (abortSignal?.aborted) {
34
35
  throw new Error("File saving aborted");
35
36
  }
36
- const filePath = await validatePath(joinWorkingDir(userPath, workingDir), allowedDirectory, { requireExistence: false, abortSignal });
37
+ const filePath = await validatePath(joinWorkingDir(userPath, primaryDir), allowedDirectory, { requireExistence: false, abortSignal });
37
38
  try {
38
39
  await fs.stat(filePath);
39
- const projectConfig = await config.getConfig();
40
- validateFileNotReadOnly(filePath, projectConfig, workingDir);
40
+ validateFileNotReadOnly(filePath, projectConfig, primaryDir);
41
41
  }
42
42
  catch (error) {
43
43
  if (error.code !== "ENOENT") {
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ import type { ToolExecutionOptions } from "./types.ts";
3
+ export declare const SkillTool: {
4
+ name: "Skill";
5
+ };
6
+ declare const inputSchema: z.ZodObject<{
7
+ skill: z.ZodString;
8
+ args: z.ZodOptional<z.ZodString>;
9
+ }, z.core.$strip>;
10
+ type SkillInputSchema = z.infer<typeof inputSchema>;
11
+ export declare function createSkillTool(): Promise<{
12
+ toolDef: {
13
+ description: string;
14
+ inputSchema: z.ZodObject<{
15
+ skill: z.ZodString;
16
+ args: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ };
19
+ display({ skill: skillName }: SkillInputSchema): string;
20
+ execute({ skill: skillName, args }: SkillInputSchema, { abortSignal }: ToolExecutionOptions): Promise<string>;
21
+ }>;
22
+ export {};
23
+ //# sourceMappingURL=skill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../source/tools/skill.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,eAAO,MAAM,SAAS;;CAErB,CAAC;AAEF,QAAA,MAAM,WAAW;;;iBAKf,CAAC;AAEH,KAAK,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD,wBAAsB,eAAe;;;;;;;;kCAWH,gBAAgB,GAAG,MAAM;wCAIzB,gBAAgB,mBAC3B,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;GA4CrB"}