@travisennis/acai 0.0.5 → 0.0.7

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 (421) hide show
  1. package/README.md +190 -19
  2. package/bin/acai-wrapper.js +26 -0
  3. package/dist/agent/index.d.ts +132 -0
  4. package/dist/agent/index.d.ts.map +1 -0
  5. package/dist/agent/index.js +434 -0
  6. package/dist/api/exa/index.js +1 -1
  7. package/dist/cli.d.ts +4 -1
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +67 -40
  10. package/dist/commands/add-directory-command.d.ts +3 -0
  11. package/dist/commands/add-directory-command.d.ts.map +1 -0
  12. package/dist/commands/add-directory-command.js +54 -0
  13. package/dist/commands/application-log-command.d.ts +1 -1
  14. package/dist/commands/application-log-command.d.ts.map +1 -1
  15. package/dist/commands/application-log-command.js +18 -20
  16. package/dist/commands/clear-command.d.ts +1 -1
  17. package/dist/commands/clear-command.d.ts.map +1 -1
  18. package/dist/commands/clear-command.js +7 -3
  19. package/dist/commands/compact-command.d.ts.map +1 -1
  20. package/dist/commands/compact-command.js +9 -5
  21. package/dist/commands/context-command.d.ts +3 -0
  22. package/dist/commands/context-command.d.ts.map +1 -0
  23. package/dist/commands/context-command.js +124 -0
  24. package/dist/commands/copy-command.d.ts.map +1 -1
  25. package/dist/commands/copy-command.js +14 -5
  26. package/dist/commands/edit-command.d.ts +1 -1
  27. package/dist/commands/edit-command.d.ts.map +1 -1
  28. package/dist/commands/edit-command.js +21 -34
  29. package/dist/commands/edit-prompt-command.d.ts +1 -1
  30. package/dist/commands/edit-prompt-command.d.ts.map +1 -1
  31. package/dist/commands/edit-prompt-command.js +18 -15
  32. package/dist/commands/exit-command.d.ts +1 -4
  33. package/dist/commands/exit-command.d.ts.map +1 -1
  34. package/dist/commands/exit-command.js +9 -5
  35. package/dist/commands/files-command.d.ts +1 -1
  36. package/dist/commands/files-command.d.ts.map +1 -1
  37. package/dist/commands/files-command.js +20 -16
  38. package/dist/commands/generate-rules-command.d.ts +1 -1
  39. package/dist/commands/generate-rules-command.d.ts.map +1 -1
  40. package/dist/commands/generate-rules-command.js +307 -39
  41. package/dist/commands/handoff-command.d.ts +3 -0
  42. package/dist/commands/handoff-command.d.ts.map +1 -0
  43. package/dist/commands/handoff-command.js +191 -0
  44. package/dist/commands/health-command.d.ts +1 -1
  45. package/dist/commands/health-command.d.ts.map +1 -1
  46. package/dist/commands/health-command.js +49 -27
  47. package/dist/commands/help-command.d.ts +1 -1
  48. package/dist/commands/help-command.d.ts.map +1 -1
  49. package/dist/commands/help-command.js +25 -5
  50. package/dist/commands/history-command.d.ts +3 -0
  51. package/dist/commands/history-command.d.ts.map +1 -0
  52. package/dist/commands/history-command.js +458 -0
  53. package/dist/commands/init-command.d.ts +1 -1
  54. package/dist/commands/init-command.d.ts.map +1 -1
  55. package/dist/commands/init-command.js +40 -22
  56. package/dist/commands/last-log-command.d.ts +1 -1
  57. package/dist/commands/last-log-command.d.ts.map +1 -1
  58. package/dist/commands/last-log-command.js +15 -15
  59. package/dist/commands/list-directories-command.d.ts +3 -0
  60. package/dist/commands/list-directories-command.d.ts.map +1 -0
  61. package/dist/commands/list-directories-command.js +35 -0
  62. package/dist/commands/list-tools-command.d.ts.map +1 -1
  63. package/dist/commands/list-tools-command.js +61 -21
  64. package/dist/commands/manager.d.ts +9 -4
  65. package/dist/commands/manager.d.ts.map +1 -1
  66. package/dist/commands/manager.js +64 -39
  67. package/dist/commands/model-command.d.ts.map +1 -1
  68. package/dist/commands/model-command.js +201 -66
  69. package/dist/commands/paste-command.d.ts +1 -1
  70. package/dist/commands/paste-command.d.ts.map +1 -1
  71. package/dist/commands/paste-command.js +23 -9
  72. package/dist/commands/pickup-command.d.ts +3 -0
  73. package/dist/commands/pickup-command.d.ts.map +1 -0
  74. package/dist/commands/pickup-command.js +109 -0
  75. package/dist/commands/prompt-command.d.ts +19 -1
  76. package/dist/commands/prompt-command.d.ts.map +1 -1
  77. package/dist/commands/prompt-command.js +191 -98
  78. package/dist/commands/remove-directory-command.d.ts +3 -0
  79. package/dist/commands/remove-directory-command.d.ts.map +1 -0
  80. package/dist/commands/remove-directory-command.js +55 -0
  81. package/dist/commands/reset-command.d.ts +1 -1
  82. package/dist/commands/reset-command.d.ts.map +1 -1
  83. package/dist/commands/reset-command.js +8 -5
  84. package/dist/commands/rules-command.d.ts +1 -1
  85. package/dist/commands/rules-command.d.ts.map +1 -1
  86. package/dist/commands/rules-command.js +25 -22
  87. package/dist/commands/save-command.d.ts +1 -1
  88. package/dist/commands/save-command.d.ts.map +1 -1
  89. package/dist/commands/save-command.js +8 -3
  90. package/dist/commands/shell-command.d.ts.map +1 -1
  91. package/dist/commands/shell-command.js +45 -24
  92. package/dist/commands/types.d.ts +9 -7
  93. package/dist/commands/types.d.ts.map +1 -1
  94. package/dist/commands/usage-command.d.ts +1 -1
  95. package/dist/commands/usage-command.d.ts.map +1 -1
  96. package/dist/commands/usage-command.js +18 -7
  97. package/dist/config.d.ts +21 -11
  98. package/dist/config.d.ts.map +1 -1
  99. package/dist/config.js +90 -63
  100. package/dist/execution/index.d.ts +17 -2
  101. package/dist/execution/index.d.ts.map +1 -1
  102. package/dist/execution/index.js +62 -20
  103. package/dist/formatting.d.ts +127 -0
  104. package/dist/formatting.d.ts.map +1 -1
  105. package/dist/formatting.js +201 -0
  106. package/dist/index.d.ts +7 -2
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +263 -102
  109. package/dist/logger.d.ts.map +1 -1
  110. package/dist/logger.js +47 -18
  111. package/dist/mentions.d.ts +2 -1
  112. package/dist/mentions.d.ts.map +1 -1
  113. package/dist/mentions.js +16 -1
  114. package/dist/messages.d.ts +11 -0
  115. package/dist/messages.d.ts.map +1 -1
  116. package/dist/messages.js +122 -21
  117. package/dist/middleware/cache.d.ts +3 -0
  118. package/dist/middleware/cache.d.ts.map +1 -0
  119. package/dist/middleware/cache.js +53 -0
  120. package/dist/middleware/index.d.ts +1 -0
  121. package/dist/middleware/index.d.ts.map +1 -1
  122. package/dist/middleware/index.js +1 -0
  123. package/dist/models/ai-config.d.ts +4 -2
  124. package/dist/models/ai-config.d.ts.map +1 -1
  125. package/dist/models/ai-config.js +12 -2
  126. package/dist/models/anthropic-provider.d.ts.map +1 -1
  127. package/dist/models/anthropic-provider.js +3 -67
  128. package/dist/models/deepseek-provider.d.ts.map +1 -1
  129. package/dist/models/deepseek-provider.js +0 -2
  130. package/dist/models/google-provider.d.ts.map +1 -1
  131. package/dist/models/google-provider.js +0 -3
  132. package/dist/models/groq-provider.d.ts.map +1 -1
  133. package/dist/models/groq-provider.js +0 -1
  134. package/dist/models/manager.d.ts +2 -1
  135. package/dist/models/manager.d.ts.map +1 -1
  136. package/dist/models/manager.js +26 -2
  137. package/dist/models/openai-provider.d.ts.map +1 -1
  138. package/dist/models/openai-provider.js +0 -4
  139. package/dist/models/openrouter-provider.d.ts +16 -22
  140. package/dist/models/openrouter-provider.d.ts.map +1 -1
  141. package/dist/models/openrouter-provider.js +175 -236
  142. package/dist/models/providers.d.ts +4 -14
  143. package/dist/models/providers.d.ts.map +1 -1
  144. package/dist/models/providers.js +1 -57
  145. package/dist/models/xai-provider.d.ts.map +1 -1
  146. package/dist/models/xai-provider.js +0 -2
  147. package/dist/prompts.d.ts +10 -4
  148. package/dist/prompts.d.ts.map +1 -1
  149. package/dist/prompts.js +447 -70
  150. package/dist/repl/project-status-line.d.ts +3 -0
  151. package/dist/repl/project-status-line.d.ts.map +1 -0
  152. package/dist/repl/project-status-line.js +61 -0
  153. package/dist/repl/tool-call-repair.d.ts.map +1 -1
  154. package/dist/repl/tool-call-repair.js +8 -4
  155. package/dist/repl-new.d.ts +51 -0
  156. package/dist/repl-new.d.ts.map +1 -0
  157. package/dist/repl-new.js +354 -0
  158. package/dist/skills.d.ts +20 -0
  159. package/dist/skills.d.ts.map +1 -0
  160. package/dist/skills.js +192 -0
  161. package/dist/terminal/control.d.ts +55 -0
  162. package/dist/terminal/control.d.ts.map +1 -0
  163. package/dist/terminal/control.js +109 -0
  164. package/dist/terminal/default-theme.d.ts +1 -1
  165. package/dist/terminal/default-theme.d.ts.map +1 -1
  166. package/dist/terminal/default-theme.js +24 -28
  167. package/dist/terminal/formatting.d.ts +23 -25
  168. package/dist/terminal/formatting.d.ts.map +1 -1
  169. package/dist/terminal/formatting.js +35 -52
  170. package/dist/terminal/highlight/index.d.ts.map +1 -1
  171. package/dist/terminal/highlight/index.js +3 -6
  172. package/dist/terminal/highlight/theme.d.ts.map +1 -1
  173. package/dist/terminal/highlight/theme.js +2 -6
  174. package/dist/terminal/index.d.ts +2 -94
  175. package/dist/terminal/index.d.ts.map +1 -1
  176. package/dist/terminal/index.js +2 -370
  177. package/dist/terminal/markdown.js +10 -5
  178. package/dist/terminal/select-prompt.d.ts +2 -2
  179. package/dist/terminal/select-prompt.d.ts.map +1 -1
  180. package/dist/terminal/select-prompt.js +47 -39
  181. package/dist/terminal/strip-ansi.js +4 -4
  182. package/dist/terminal/table/cell.d.ts +114 -0
  183. package/dist/terminal/table/cell.d.ts.map +1 -0
  184. package/dist/terminal/table/cell.js +407 -0
  185. package/dist/terminal/table/debug.d.ts +15 -0
  186. package/dist/terminal/table/debug.d.ts.map +1 -0
  187. package/dist/terminal/table/debug.js +32 -0
  188. package/dist/terminal/table/index.d.ts +3 -0
  189. package/dist/terminal/table/index.d.ts.map +1 -0
  190. package/dist/terminal/table/index.js +2 -0
  191. package/dist/terminal/table/layout-manager.d.ts +27 -0
  192. package/dist/terminal/table/layout-manager.d.ts.map +1 -0
  193. package/dist/terminal/table/layout-manager.js +257 -0
  194. package/dist/terminal/table/table.d.ts +9 -0
  195. package/dist/terminal/table/table.d.ts.map +1 -0
  196. package/dist/terminal/table/table.js +97 -0
  197. package/dist/terminal/table/utils.d.ts +63 -0
  198. package/dist/terminal/table/utils.d.ts.map +1 -0
  199. package/dist/terminal/table/utils.js +326 -0
  200. package/dist/tokens/threshold.d.ts +20 -0
  201. package/dist/tokens/threshold.d.ts.map +1 -0
  202. package/dist/tokens/threshold.js +67 -0
  203. package/dist/tools/advanced-edit-file.d.ts +69 -0
  204. package/dist/tools/advanced-edit-file.d.ts.map +1 -0
  205. package/dist/tools/advanced-edit-file.js +285 -0
  206. package/dist/tools/agent.d.ts +16 -5
  207. package/dist/tools/agent.d.ts.map +1 -1
  208. package/dist/tools/agent.js +86 -59
  209. package/dist/tools/bash.d.ts +23 -12
  210. package/dist/tools/bash.d.ts.map +1 -1
  211. package/dist/tools/bash.js +243 -128
  212. package/dist/tools/batch.d.ts +34 -0
  213. package/dist/tools/batch.d.ts.map +1 -0
  214. package/dist/tools/batch.js +174 -0
  215. package/dist/tools/code-interpreter.d.ts +21 -9
  216. package/dist/tools/code-interpreter.d.ts.map +1 -1
  217. package/dist/tools/code-interpreter.js +151 -134
  218. package/dist/tools/delete-file.d.ts +17 -10
  219. package/dist/tools/delete-file.d.ts.map +1 -1
  220. package/dist/tools/delete-file.js +60 -97
  221. package/dist/tools/directory-tree.d.ts +17 -12
  222. package/dist/tools/directory-tree.d.ts.map +1 -1
  223. package/dist/tools/directory-tree.js +57 -48
  224. package/dist/tools/dynamic-tool-loader.d.ts +16 -10
  225. package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
  226. package/dist/tools/dynamic-tool-loader.js +122 -130
  227. package/dist/tools/dynamic-tool-parser.d.ts +1 -0
  228. package/dist/tools/dynamic-tool-parser.d.ts.map +1 -1
  229. package/dist/tools/dynamic-tool-parser.js +1 -0
  230. package/dist/tools/edit-file.d.ts +35 -15
  231. package/dist/tools/edit-file.d.ts.map +1 -1
  232. package/dist/tools/edit-file.js +127 -114
  233. package/dist/tools/glob.d.ts +36 -0
  234. package/dist/tools/glob.d.ts.map +1 -0
  235. package/dist/tools/glob.js +154 -0
  236. package/dist/tools/grep.d.ts +73 -12
  237. package/dist/tools/grep.d.ts.map +1 -1
  238. package/dist/tools/grep.js +425 -165
  239. package/dist/tools/index.d.ts +220 -126
  240. package/dist/tools/index.d.ts.map +1 -1
  241. package/dist/tools/index.js +284 -135
  242. package/dist/tools/llm-edit-fixer.d.ts +24 -0
  243. package/dist/tools/llm-edit-fixer.d.ts.map +1 -0
  244. package/dist/tools/llm-edit-fixer.js +136 -0
  245. package/dist/tools/move-file.d.ts +19 -7
  246. package/dist/tools/move-file.d.ts.map +1 -1
  247. package/dist/tools/move-file.js +48 -34
  248. package/dist/tools/read-file.d.ts +47 -9
  249. package/dist/tools/read-file.d.ts.map +1 -1
  250. package/dist/tools/read-file.js +84 -70
  251. package/dist/tools/read-multiple-files.d.ts +17 -6
  252. package/dist/tools/read-multiple-files.d.ts.map +1 -1
  253. package/dist/tools/read-multiple-files.js +132 -72
  254. package/dist/tools/save-file.d.ts +45 -12
  255. package/dist/tools/save-file.d.ts.map +1 -1
  256. package/dist/tools/save-file.js +76 -101
  257. package/dist/tools/think.d.ts +15 -7
  258. package/dist/tools/think.d.ts.map +1 -1
  259. package/dist/tools/think.js +34 -20
  260. package/dist/tools/types.d.ts +8 -10
  261. package/dist/tools/types.d.ts.map +1 -1
  262. package/dist/tools/types.js +9 -0
  263. package/dist/tools/utils.d.ts +14 -0
  264. package/dist/tools/utils.d.ts.map +1 -0
  265. package/dist/tools/utils.js +16 -0
  266. package/dist/tools/web-fetch.d.ts +11 -4
  267. package/dist/tools/web-fetch.d.ts.map +1 -1
  268. package/dist/tools/web-fetch.js +39 -38
  269. package/dist/tools/web-search.d.ts +15 -6
  270. package/dist/tools/web-search.d.ts.map +1 -1
  271. package/dist/tools/web-search.js +64 -31
  272. package/dist/tui/autocomplete.d.ts +44 -0
  273. package/dist/tui/autocomplete.d.ts.map +1 -0
  274. package/dist/tui/autocomplete.js +466 -0
  275. package/dist/tui/components/assistant-message.d.ts +18 -0
  276. package/dist/tui/components/assistant-message.d.ts.map +1 -0
  277. package/dist/tui/components/assistant-message.js +29 -0
  278. package/dist/tui/components/box.d.ts +20 -0
  279. package/dist/tui/components/box.d.ts.map +1 -0
  280. package/dist/tui/components/box.js +81 -0
  281. package/dist/tui/components/editor.d.ts +106 -0
  282. package/dist/tui/components/editor.d.ts.map +1 -0
  283. package/dist/tui/components/editor.js +1220 -0
  284. package/dist/tui/components/footer.d.ts +12 -0
  285. package/dist/tui/components/footer.d.ts.map +1 -0
  286. package/dist/tui/components/footer.js +209 -0
  287. package/dist/tui/components/header.d.ts +21 -0
  288. package/dist/tui/components/header.d.ts.map +1 -0
  289. package/dist/tui/components/header.js +63 -0
  290. package/dist/tui/components/input.d.ts +14 -0
  291. package/dist/tui/components/input.d.ts.map +1 -0
  292. package/dist/tui/components/input.js +122 -0
  293. package/dist/tui/components/loader.d.ts +23 -0
  294. package/dist/tui/components/loader.d.ts.map +1 -0
  295. package/dist/tui/components/loader.js +45 -0
  296. package/dist/tui/components/markdown.d.ts +106 -0
  297. package/dist/tui/components/markdown.d.ts.map +1 -0
  298. package/dist/tui/components/markdown.js +586 -0
  299. package/dist/tui/components/modal.d.ts +29 -0
  300. package/dist/tui/components/modal.d.ts.map +1 -0
  301. package/dist/tui/components/modal.js +263 -0
  302. package/dist/tui/components/progress-bar.d.ts +19 -0
  303. package/dist/tui/components/progress-bar.d.ts.map +1 -0
  304. package/dist/tui/components/progress-bar.js +78 -0
  305. package/dist/tui/components/prompt-status.d.ts +17 -0
  306. package/dist/tui/components/prompt-status.d.ts.map +1 -0
  307. package/dist/tui/components/prompt-status.js +26 -0
  308. package/dist/tui/components/select-list.d.ts +48 -0
  309. package/dist/tui/components/select-list.d.ts.map +1 -0
  310. package/dist/tui/components/select-list.js +207 -0
  311. package/dist/tui/components/spacer.d.ts +16 -0
  312. package/dist/tui/components/spacer.d.ts.map +1 -0
  313. package/dist/tui/components/spacer.js +27 -0
  314. package/dist/tui/components/table.d.ts +27 -0
  315. package/dist/tui/components/table.d.ts.map +1 -0
  316. package/dist/tui/components/table.js +125 -0
  317. package/dist/tui/components/text.d.ts +26 -0
  318. package/dist/tui/components/text.d.ts.map +1 -0
  319. package/dist/tui/components/text.js +143 -0
  320. package/dist/tui/components/thinking-block.d.ts +14 -0
  321. package/dist/tui/components/thinking-block.d.ts.map +1 -0
  322. package/dist/tui/components/thinking-block.js +33 -0
  323. package/dist/tui/components/tool-execution.d.ts +21 -0
  324. package/dist/tui/components/tool-execution.d.ts.map +1 -0
  325. package/dist/tui/components/tool-execution.js +161 -0
  326. package/dist/tui/components/user-message.d.ts +9 -0
  327. package/dist/tui/components/user-message.d.ts.map +1 -0
  328. package/dist/tui/components/user-message.js +23 -0
  329. package/dist/tui/components/welcome.d.ts +6 -0
  330. package/dist/tui/components/welcome.d.ts.map +1 -0
  331. package/dist/tui/components/welcome.js +30 -0
  332. package/dist/tui/index.d.ts +18 -0
  333. package/dist/tui/index.d.ts.map +1 -0
  334. package/dist/tui/index.js +22 -0
  335. package/dist/tui/terminal.d.ts +38 -0
  336. package/dist/tui/terminal.d.ts.map +1 -0
  337. package/dist/tui/terminal.js +94 -0
  338. package/dist/tui/tui.d.ts +69 -0
  339. package/dist/tui/tui.d.ts.map +1 -0
  340. package/dist/tui/tui.js +204 -0
  341. package/dist/tui/utils.d.ts +24 -0
  342. package/dist/tui/utils.d.ts.map +1 -0
  343. package/dist/tui/utils.js +111 -0
  344. package/dist/utils/bash.d.ts +7 -0
  345. package/dist/utils/bash.d.ts.map +1 -0
  346. package/dist/{tools/bash-utils.js → utils/bash.js} +31 -12
  347. package/dist/utils/{filesystem.d.ts → filesystem/operations.d.ts} +1 -1
  348. package/dist/utils/filesystem/operations.d.ts.map +1 -0
  349. package/dist/utils/filesystem/security.d.ts +9 -0
  350. package/dist/utils/filesystem/security.d.ts.map +1 -0
  351. package/dist/{tools/filesystem-utils.js → utils/filesystem/security.js} +93 -21
  352. package/dist/utils/funcs.d.ts +6 -0
  353. package/dist/utils/funcs.d.ts.map +1 -0
  354. package/dist/utils/funcs.js +6 -0
  355. package/dist/utils/generators.d.ts +3 -0
  356. package/dist/utils/generators.d.ts.map +1 -0
  357. package/dist/utils/generators.js +25 -0
  358. package/dist/{tools/git-utils.d.ts → utils/git.d.ts} +1 -1
  359. package/dist/utils/git.d.ts.map +1 -0
  360. package/dist/{tools/git-utils.js → utils/git.js} +0 -6
  361. package/dist/utils/glob.js +1 -1
  362. package/dist/utils/iterables.d.ts +2 -0
  363. package/dist/utils/iterables.d.ts.map +1 -0
  364. package/dist/utils/iterables.js +6 -0
  365. package/dist/utils/{zod-utils.d.ts → zod.d.ts} +1 -1
  366. package/dist/utils/zod.d.ts.map +1 -0
  367. package/package.json +21 -21
  368. package/dist/conversation-analyzer.d.ts +0 -11
  369. package/dist/conversation-analyzer.d.ts.map +0 -1
  370. package/dist/conversation-analyzer.js +0 -88
  371. package/dist/repl/display-tool-messages.d.ts +0 -4
  372. package/dist/repl/display-tool-messages.d.ts.map +0 -1
  373. package/dist/repl/display-tool-messages.js +0 -55
  374. package/dist/repl/display-tool-use.d.ts +0 -14
  375. package/dist/repl/display-tool-use.d.ts.map +0 -1
  376. package/dist/repl/display-tool-use.js +0 -63
  377. package/dist/repl/get-prompt-header.d.ts +0 -8
  378. package/dist/repl/get-prompt-header.d.ts.map +0 -1
  379. package/dist/repl/get-prompt-header.js +0 -38
  380. package/dist/repl-prompt.d.ts +0 -15
  381. package/dist/repl-prompt.d.ts.map +0 -1
  382. package/dist/repl-prompt.js +0 -147
  383. package/dist/repl.d.ts +0 -31
  384. package/dist/repl.d.ts.map +0 -1
  385. package/dist/repl.js +0 -310
  386. package/dist/terminal/checkbox-prompt.d.ts +0 -36
  387. package/dist/terminal/checkbox-prompt.d.ts.map +0 -1
  388. package/dist/terminal/checkbox-prompt.js +0 -362
  389. package/dist/terminal/editor-prompt.d.ts +0 -10
  390. package/dist/terminal/editor-prompt.d.ts.map +0 -1
  391. package/dist/terminal/editor-prompt.js +0 -61
  392. package/dist/terminal/errors.d.ts +0 -19
  393. package/dist/terminal/errors.d.ts.map +0 -1
  394. package/dist/terminal/errors.js +0 -37
  395. package/dist/terminal/input-prompt.d.ts +0 -16
  396. package/dist/terminal/input-prompt.d.ts.map +0 -1
  397. package/dist/terminal/input-prompt.js +0 -181
  398. package/dist/terminal/search-prompt.d.ts +0 -20
  399. package/dist/terminal/search-prompt.d.ts.map +0 -1
  400. package/dist/terminal/search-prompt.js +0 -279
  401. package/dist/terminal/types.d.ts +0 -35
  402. package/dist/terminal/types.d.ts.map +0 -1
  403. package/dist/terminal/types.js +0 -1
  404. package/dist/tokens/manage-output.d.ts +0 -34
  405. package/dist/tokens/manage-output.d.ts.map +0 -1
  406. package/dist/tokens/manage-output.js +0 -44
  407. package/dist/tool-executor.d.ts +0 -28
  408. package/dist/tool-executor.d.ts.map +0 -1
  409. package/dist/tool-executor.js +0 -74
  410. package/dist/tools/bash-utils.d.ts +0 -7
  411. package/dist/tools/bash-utils.d.ts.map +0 -1
  412. package/dist/tools/file-editing-utils.d.ts +0 -2
  413. package/dist/tools/file-editing-utils.d.ts.map +0 -1
  414. package/dist/tools/file-editing-utils.js +0 -135
  415. package/dist/tools/filesystem-utils.d.ts +0 -7
  416. package/dist/tools/filesystem-utils.d.ts.map +0 -1
  417. package/dist/tools/git-utils.d.ts.map +0 -1
  418. package/dist/utils/filesystem.d.ts.map +0 -1
  419. package/dist/utils/zod-utils.d.ts.map +0 -1
  420. /package/dist/utils/{filesystem.js → filesystem/operations.js} +0 -0
  421. /package/dist/utils/{zod-utils.js → zod.js} +0 -0
package/dist/prompts.js CHANGED
@@ -1,15 +1,17 @@
1
+ import { execSync } from "node:child_process";
1
2
  import { readFile } from "node:fs/promises";
2
3
  import { platform } from "node:os";
3
4
  import path from "node:path";
4
5
  import { config } from "./config.js";
5
6
  import { dedent } from "./dedent.js";
7
+ import { formatSkillsForPrompt, loadSkills } from "./skills.js";
6
8
  import { getShell } from "./terminal/index.js";
7
9
  import { AgentTool } from "./tools/agent.js";
8
10
  import { BashTool } from "./tools/bash.js";
9
11
  import { CodeInterpreterTool } from "./tools/code-interpreter.js";
10
12
  import { DeleteFileTool } from "./tools/delete-file.js";
13
+ import { DirectoryTreeTool } from "./tools/directory-tree.js";
11
14
  import { EditFileTool } from "./tools/edit-file.js";
12
- import { getCurrentBranch, inGitDirectory } from "./tools/git-utils.js";
13
15
  import { GrepTool } from "./tools/grep.js";
14
16
  import { ReadFileTool } from "./tools/read-file.js";
15
17
  import { ReadMultipleFilesTool } from "./tools/read-multiple-files.js";
@@ -17,19 +19,25 @@ import { SaveFileTool } from "./tools/save-file.js";
17
19
  import { ThinkTool } from "./tools/think.js";
18
20
  import { WebFetchTool } from "./tools/web-fetch.js";
19
21
  import { WebSearchTool } from "./tools/web-search.js";
20
- function intro() {
21
- return "You are acai, an AI-powered CLI assistant that accelerates software engineering workflows through intelligent command-line assistance.";
22
- }
23
- async function instructions() {
22
+ import { getCurrentBranch, inGitDirectory } from "./utils/git.js";
23
+ async function getCustomSystemPrompt() {
24
24
  const systemMdPath = path.join(config.project.getPath(), "system.md");
25
25
  try {
26
26
  const content = await readFile(systemMdPath, "utf8");
27
- if (content.trim()) {
28
- return content;
29
- }
27
+ return content.trim() || null;
30
28
  }
31
29
  catch {
32
- // system.md doesn't exist or is empty, use default instructions
30
+ // system.md doesn't exist or can't be read
31
+ return null;
32
+ }
33
+ }
34
+ function intro() {
35
+ return "You are acai. You are running as a coding agent in a CLI on the user's computer.";
36
+ }
37
+ async function instructions() {
38
+ const systemMdPath = await getCustomSystemPrompt();
39
+ if (systemMdPath) {
40
+ return systemMdPath;
33
41
  }
34
42
  return `## Core Principles
35
43
 
@@ -39,13 +47,104 @@ async function instructions() {
39
47
  - **Security-First**: Prioritize secure coding practices in all suggestions.
40
48
  - **Completion Focus**: Continue working until the user's query is completely resolved.
41
49
  - **Expert Level**: Assume the user is an experienced software engineer.
50
+ - **Be Efficient**: When multiple tool calls can be parallelized, make these tool calls in parallel instead of sequential. Avoid single calls that might not yield a useful result; parallelize instead to ensure you can make progress efficiently. Always use the most efficient workflow to complete tasks
51
+ - **Default expectation**: Deliver working code, not just a plan. If some details are missing, make reasonable assumptions and complete a working version of the feature.
52
+
53
+ ## Autonomy and Persistence
54
+
55
+ - You are autonomous senior engineer: once the user gives a direction, proactively gather context, plan, implement, test, and refine without waiting for additional prompts at each step.
56
+ - Persist until the task is fully handled end-to-end within the current turn whenever feasible: do not stop at analysis or partial fixes; carry changes through implementation, verification, and a clear explanation of outcomes unless the user explicitly pauses or redirects you.
57
+ - Bias to action: default to implementing with reasonable assumptions; do not end your turn with clarifications unless truly blocked.
58
+ - Avoid excessive looping or repetition; if you find yourself re-reading or re-editing the same files without clear progress, stop and end the turn with a concise summary and any clarifying questions needed.
59
+
60
+ ## Exploration and reading files
61
+
62
+ - **Think first.** Before any tool call, decide ALL files/resources you will need.
63
+ - **Batch everything.** If you need multiple files (even from different places), read them together.
64
+ - **Only make sequential calls if you truly cannot know the next file without seeing a result first.**
65
+ - **Workflow:** (a) plan all needed reads → (b) issue one parallel batch → (c) analyze results → (d) repeat if new, unpredictable reads arise.
66
+ - Additional notes:
67
+ - Always maximize parallelism. Never read files one-by-one unless logically unavoidable.
68
+ - This concerns every read/list/search operations including, but not only, \`cat\`, \`rg\`, \`sed\`, \`ls\`, \`git show\`, \`nl\`, \`wc\`, ...
69
+
70
+ ## Presenting your work and final message
42
71
 
43
- ## Response Format
72
+ You are producing plain text that will later be styled by the CLI. Follow these rules exactly. Formatting should make results easy to scan, but not feel mechanical. Use judgment to decide how much structure adds value.
73
+ - Default: be very concise; friendly coding teammate tone.
74
+ - Format: Use natural language with high-level headings.
75
+ - Ask only when needed; suggest ideas; mirror the user's style.
76
+ - For substantial work, summarize clearly; follow final‑answer formatting.
77
+ - Skip heavy formatting for simple confirmations.
78
+ - Don't dump large files you've written; reference paths only.
79
+ - No "save/copy this file" - User is on the same machine.
80
+ - Offer logical next steps (tests, commits, build) briefly; add verify steps if you couldn't do something.
81
+ - For code changes:
82
+ * Lead with a quick explanation of the change, and then give more details on the context covering where and why a change was made. Do not start this explanation with "summary", just jump right in.
83
+ * If there are natural next steps the user may want to take, suggest them at the end of your response. Do not make suggestions if there are no natural next steps.
84
+ * When suggesting multiple options, use numeric lists for the suggestions so the user can quickly respond with a single number.
85
+ - The user does not command execution outputs. When asked to show the output of a command (e.g. \`git show\`), relay the important details in your answer or summarize the key lines so the user understands the result.
44
86
 
45
- - **Direct Answers**: One-word or concise answers when possible.
46
- - **Code First**: Lead with code snippets for code-related queries.
47
- - **No Fluff**: Avoid preambles or phrases like "Here is the content..."
48
- - **Error Reporting**: Specify error, location, and fix (e.g., \`Error: TypeError at auth.ts:42. Fix: Add null check.\`).
87
+ ### Final answer structure and style guidelines
88
+
89
+ - Plain text; CLI handles styling. Use structure only when it helps scanability.
90
+ - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help.
91
+ - Bullets: use - ; merge related points; keep to one line when possible; 4–6 per list ordered by importance; keep phrasing consistent.
92
+ - Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **.
93
+ - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible.
94
+ - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task.
95
+ - Tone: collaborative, concise, factual; present tense, active voice; self‑contained; no "above/below"; parallel wording.
96
+ - Don'ts: no nested bullets/hierarchies; no ANSI codes; don't cram unrelated keywords; keep keyword lists short—wrap/reformat if long; avoid naming formatting styles in answers.
97
+ - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets.
98
+ - File References: When referencing files in your response follow the below rules:
99
+ * Use inline code to make file paths clickable.
100
+ * Each reference should have a stand alone path. Even if it's the same file.
101
+ * Accepted: absolute, workspace‑relative, a/ or b/ diff prefixes, or bare filename/suffix.
102
+ * Optionally include line/column (1‑based): :line[:column] or #Lline[Ccolumn] (column defaults to 1).
103
+ * Do not use URIs like file://, vscode://, or https://.
104
+ * Do not provide range of lines
105
+ * Examples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\\repo\\project\\main.rs:12:5
106
+
107
+ ## Tool Calling
108
+
109
+ <tool_calling>
110
+ 1. Use only provided tools; follow their schemas exactly.
111
+ 2. Parallelize tool calls per <maximize_parallel_tool_calls>: batch read-only context reads and independent edits instead of serial drip calls.
112
+ 3. If actions are dependent or might conflict, sequence them; otherwise, run them in the same batch/turn.
113
+ 4. Don't mention tool names to the user; describe actions naturally.
114
+ 5. If info is discoverable via tools, prefer that over asking the user.
115
+ 6. Read multiple files as needed; don't guess.
116
+ 7. Give a brief progress note before the first tool call each turn; add another before any new batch and before ending your turn.
117
+ 8. After any substantive code edit or schema change, run tests/build; fix failures before proceeding or marking tasks complete.
118
+ 9. Before closing the goal, ensure a green test/build run.
119
+ </tool_calling>
120
+
121
+ <context_understanding>
122
+ Grep search (grep and ripgrep) is your MAIN exploration tool.
123
+ - CRITICAL: Start with a broad set of queries that capture keywords based on the USER's request and provided context.
124
+ - MANDATORY: Run multiple Grep searches in parallel with different patterns and variations; exact matches often miss related code.
125
+ - Keep searching new areas until you're CONFIDENT nothing important remains.
126
+ - When you have found some relevant code, narrow your search and read the most likely important files.
127
+ If you've performed an edit that may partially fulfill the USER's query, but you're not confident, gather more information or use more tools before ending your turn.
128
+ Bias towards not asking the user for help if you can find the answer yourself.
129
+ </context_understanding>
130
+
131
+ <maximize_parallel_tool_calls>
132
+ CRITICAL INSTRUCTION: For maximum efficiency, whenever you perform multiple operations, invoke all relevant tools concurrently rather than sequentially. Prioritize calling tools in parallel whenever possible. For example, when reading 3 files, run 3 tool calls in parallel to read all 3 files into context at the same time. When running multiple read-only commands, always run all of the commands in parallel. Err on the side of maximizing parallel tool calls rather than running too many tools sequentially.
133
+
134
+ When gathering information about a topic, plan your searches upfront in your thinking and then execute all tool calls together. For instance, all of these cases SHOULD use parallel tool calls:
135
+
136
+ - Searching for different patterns (imports, usage, definitions) should happen in parallel
137
+ - Multiple grep searches with different regex patterns should run simultaneously
138
+ - Reading multiple files or searching different directories can be done all at once
139
+ - Combining Glob with Grep for comprehensive results
140
+ - Any information gathering where you know upfront what you're looking for
141
+
142
+ And you should use parallel tool calls in many more cases beyond those listed above.
143
+
144
+ Before making tool calls, briefly consider: What information do I need to fully answer this question? Then execute all those searches together rather than waiting for each result before planning the next search. Most of the time, parallel tool calls can be used rather than sequential. Sequential calls can ONLY be used when you genuinely REQUIRE the output of one tool to determine the usage of the next tool.
145
+
146
+ DEFAULT TO PARALLEL: Unless you have a specific reason why operations MUST be sequential (output of A required for input of B), always execute multiple tools simultaneously. This is not just an optimization - it's the expected behavior. Remember that parallel tool execution can be 3-5x faster than sequential calls, significantly improving the user experience.
147
+ </maximize_parallel_tool_calls>
49
148
 
50
149
  ## Work Standards
51
150
 
@@ -62,55 +161,218 @@ async function instructions() {
62
161
  - If a tool fails, ask the user how to proceed
63
162
  - Report errors with specific locations and suggested fixes`;
64
163
  }
65
- function toolUsage() {
66
- return `## Tool Usage Guidelines
67
-
68
- ### Information Gathering
69
- - Prefer targeted queries: use \`${GrepTool.name}\` for code pattern searches and \`${ReadMultipleFilesTool.name}\` to fetch files. Avoid full directory dumps for large repositories.
70
- - Use \`${ReadFileTool.name}\` or \`${ReadMultipleFilesTool.name}\` for file contents if filenames are provided in the prompt
71
- - Use \`${GrepTool.name}\` for code pattern searches
72
- - Use \`${WebFetchTool.name}\` for text-based URLs provided in the prompt
73
- - Use \`${WebSearchTool.name}\` for external research (e.g., libraries, errors)
74
- - Use \`${AgentTool.name}\` for iterative keyword/file searches. Use this if you need to explore the project to find what you are looking for.
75
- - If file contents or URLs are provided in the prompt, use them directly without re-fetching
76
- - Always verify file contents before suggesting changes unless provided in the prompt
77
-
78
- ### Code Modification
79
- - Use \`${EditFileTool.name}\` to edit existing files
80
- - Use \`${SaveFileTool.name}\` to create new files only
81
- - Use \`${DeleteFileTool.name}\` to delete files
82
-
83
- ### Planning & Complex Tasks
84
- - Use \`${ThinkTool.name}\` for structured reasoning on complex problems
85
- - Outline multi-step tasks before execution
86
-
87
- ### Bash Commands (\`${BashTool.name}\`)
88
- - Execute commands with a sandboxed executor that supports pipes (|), conditional chaining (&&, ||, ;), and redirection (> >> < 2> 2>>).
89
- - Run single commands or compose multi-step flows using shell operators.
90
- - For large gh/git messages with newlines:
91
- 1. Create temp file with ${SaveFileTool.name} in the project's .tmp directory
92
- 2. Use git commit --file path/to/temp/file or gh pr create --title "Title of PR" --body-file path/to/temp/file
93
- - Note: The .tmp directory in the current working directory is deleted each time the agent shuts down.
94
- - Commands execute only within the project directory; always use absolute paths.
95
- - Avoid interactive commands; prefer non-interactive flags (e.g., npm init -y).
96
-
97
- ### Code Interpreter (\`${CodeInterpreterTool.name}\`)
98
- - Executes JavaScript code in a separate Node.js process using Node's Permission Model
99
- - By default, the child process has no permissions except read/write within the current working directory
100
- - Returns stdout, stderr, and exitCode
101
- - Use console.log/console.error to produce output`;
164
+ async function minimalInstructions() {
165
+ const systemMdPath = await getCustomSystemPrompt();
166
+ if (systemMdPath) {
167
+ return systemMdPath;
168
+ }
169
+ return `- Be concise and direct
170
+ - Work through problems methodically until resolution
171
+ - Continue working until the user's query is completely resolved.
172
+ - Assume the user is an experienced software engineer.`;
102
173
  }
103
- function escalationProcedures() {
104
- return `## Escalation
105
-
106
- - If stuck, state the limitation, suggest alternatives, and ask the user for guidance`;
174
+ const toolSections = [
175
+ {
176
+ id: "information-gathering-file-system",
177
+ title: "#### File System",
178
+ tools: [
179
+ ReadFileTool.name,
180
+ ReadMultipleFilesTool.name,
181
+ GrepTool.name,
182
+ AgentTool.name,
183
+ DirectoryTreeTool.name,
184
+ ],
185
+ content: (_activeTools, allActiveTools) => {
186
+ const lines = [];
187
+ // Helper to check if tool is active
188
+ const isActive = (tool) => allActiveTools === undefined ||
189
+ allActiveTools.includes(tool);
190
+ // Read tools
191
+ const readTools = [];
192
+ if (isActive(ReadFileTool.name))
193
+ readTools.push(`\`${ReadFileTool.name}\``);
194
+ if (isActive(ReadMultipleFilesTool.name))
195
+ readTools.push(`\`${ReadMultipleFilesTool.name}\``);
196
+ if (readTools.length > 0) {
197
+ lines.push(`- Use ${readTools.join(" or ")} for file contents if filenames are provided in the prompt. If you do not know the path to a file use one of the following tools to find the files available.`);
198
+ }
199
+ if (isActive(GrepTool.name)) {
200
+ lines.push(`- Use \`${GrepTool.name}\` for code pattern searches`);
201
+ }
202
+ if (isActive(AgentTool.name)) {
203
+ lines.push(`- Use \`${AgentTool.name}\` for iterative keyword/file searches. Use this if you need to explore the project to find what you are looking for.`);
204
+ }
205
+ if (isActive(DirectoryTreeTool.name)) {
206
+ lines.push(`- Use \`${DirectoryTreeTool.name}\` if you need a high-level overview of the project.`);
207
+ }
208
+ // Add general guidelines that reference specific tools only if those tools are active
209
+ if (isActive(GrepTool.name) && isActive(ReadMultipleFilesTool.name)) {
210
+ lines.push(`- Prefer targeted queries: use \`${GrepTool.name}\` for code pattern searches and \`${ReadMultipleFilesTool.name}\` to fetch files. Avoid full directory dumps for large repositories.`);
211
+ }
212
+ // Add general guidelines that don't reference specific tools
213
+ lines.push("- If the contents of files are provided in the prompt, assume the content is up-to-date and use it directly without re-fetching");
214
+ lines.push("- Always verify file contents before suggesting changes unless provided in the prompt");
215
+ return lines.join("\n");
216
+ },
217
+ },
218
+ {
219
+ id: "information-gathering-web",
220
+ title: "#### Web and Internet",
221
+ tools: [WebFetchTool.name, WebSearchTool.name],
222
+ content: (_activeTools, allActiveTools) => {
223
+ const lines = [];
224
+ const isActive = (tool) => allActiveTools === undefined ||
225
+ allActiveTools.includes(tool);
226
+ if (isActive(WebFetchTool.name)) {
227
+ lines.push(`- Use \`${WebFetchTool.name}\` for text-based URLs provided in the prompt`);
228
+ }
229
+ if (isActive(WebSearchTool.name)) {
230
+ lines.push(`- Use \`${WebSearchTool.name}\` for external research (e.g., libraries, errors)`);
231
+ }
232
+ // Add general guideline
233
+ lines.push("- If the contents of URLs are provided in the prompt, assume the content is up-to-date and use it directly without re-fetching");
234
+ return lines.join("\n");
235
+ },
236
+ },
237
+ {
238
+ id: "code-modification",
239
+ title: "### Code Modification",
240
+ tools: [EditFileTool.name, SaveFileTool.name, DeleteFileTool.name],
241
+ content: (_activeTools, allActiveTools) => {
242
+ const lines = [];
243
+ const isActive = (tool) => allActiveTools === undefined ||
244
+ allActiveTools.includes(tool);
245
+ if (isActive(EditFileTool.name)) {
246
+ lines.push(`- Use \`${EditFileTool.name}\` to edit existing files`);
247
+ }
248
+ if (isActive(SaveFileTool.name)) {
249
+ lines.push(`- Use \`${SaveFileTool.name}\` to create new files only`);
250
+ }
251
+ if (isActive(DeleteFileTool.name)) {
252
+ lines.push(`- Use \`${DeleteFileTool.name}\` to delete files`);
253
+ }
254
+ return lines.join("\n");
255
+ },
256
+ },
257
+ {
258
+ id: "planning-complex-tasks",
259
+ title: "### Planning & Complex Tasks",
260
+ tools: [ThinkTool.name],
261
+ content: (_activeTools, allActiveTools) => {
262
+ const isActive = (tool) => allActiveTools === undefined ||
263
+ allActiveTools.includes(tool);
264
+ if (isActive(ThinkTool.name)) {
265
+ return `- Use \`${ThinkTool.name}\` for structured reasoning on complex problems\n- Outline multi-step tasks before execution`;
266
+ }
267
+ return "";
268
+ },
269
+ },
270
+ {
271
+ id: "bash-commands",
272
+ title: `### Bash Commands (\`${BashTool.name}\`)`,
273
+ tools: [BashTool.name],
274
+ content: (_activeTools, allActiveTools) => {
275
+ const isActive = (tool) => allActiveTools === undefined ||
276
+ allActiveTools.includes(tool);
277
+ if (isActive(BashTool.name)) {
278
+ return `- Execute commands with a sandboxed executor that supports pipes (|), conditional chaining (&&, ||, ;), and redirection (> >> < 2> 2>>).\n- Run single commands or compose multi-step flows using shell operators.\n- For extremely large gh/git messages:\n 1. Create temp file with ${SaveFileTool.name} in the project's .tmp directory\n 2. Use git commit --file path/to/temp/file or gh pr create --title "Title of PR" --body-file path/to/temp/file\n- Note: The .tmp directory in the current working directory is deleted each time the agent shuts down.\n- Commands execute only within the project directory; always use absolute paths.\n- Avoid interactive commands; prefer non-interactive flags (e.g., npm init -y).\n\n#### Tools available via \`${BashTool.name}\`\n\n${getInstalledTools()}\n\n#### Using acai as sub-agent\n\nYou can run acai in cli mode and it will receive a prompt and return a result. This version of acai is a separate process, but it has access to the same system prompt and tools as you do.\n\nHow to run: \`acai -p <prompt>\``;
279
+ }
280
+ return "";
281
+ },
282
+ },
283
+ {
284
+ id: "code-interpreter",
285
+ title: `### Code Interpreter (\`${CodeInterpreterTool.name}\`)`,
286
+ tools: [CodeInterpreterTool.name],
287
+ content: (_activeTools, allActiveTools) => {
288
+ const isActive = (tool) => allActiveTools === undefined ||
289
+ allActiveTools.includes(tool);
290
+ if (isActive(CodeInterpreterTool.name)) {
291
+ return `- Executes JavaScript code in a separate Node.js process using Node's Permission Model\n- By default, the child process has no permissions except read/write within the current working directory\n- Returns stdout, stderr, and exitCode\n- Use console.log/console.error to produce output`;
292
+ }
293
+ return "";
294
+ },
295
+ },
296
+ {
297
+ id: "git-workflow",
298
+ title: "### Git Workflow",
299
+ tools: [], // This section doesn't have its own tools
300
+ dependencies: [BashTool.name], // Only show if bash tool is active
301
+ content: () => {
302
+ return "- Always stage changes before attempting to commit them\n- Never amend git commits without approval from the user\n- Never use `git add -A` when preparing for multiple, distinct commits; instead, selectively add files or hunks relevant to each commit\n- Always use `git checkout -b <branch-name>` with a branch name that accurately reflects the *type* of changes being made\n- Never stage changes for files that are specified in `.gitignore`\n- Always stage changes after running a formatter that modifies files, before attempting to commit";
303
+ },
304
+ },
305
+ {
306
+ id: "efficiency-guidelines",
307
+ title: "### Efficiency Guidelines",
308
+ tools: [],
309
+ alwaysInclude: true,
310
+ content: () => {
311
+ return "- Always use the most efficient workflow to complete tasks\n- Never re-read file content that has already been provided in the current turn or is directly accessible via a tool; instead, reuse the provided content or reference the file path directly\n- Always use direct file paths or established methods to pass content to tools that accept file input, rather than re-creating content in command strings\n- Always run a build after making code changes to verify correctness";
312
+ },
313
+ },
314
+ ];
315
+ function toolUsage(activeTools) {
316
+ const sections = [];
317
+ // Always include the header
318
+ sections.push("## Tool Usage Guidelines");
319
+ // Helper to check if any of the specified tools are active
320
+ const hasAnyTool = (...tools) => {
321
+ // If activeTools is undefined, all tools are active
322
+ if (activeTools === undefined)
323
+ return true;
324
+ // If activeTools is empty array, no tools are active
325
+ if (activeTools.length === 0)
326
+ return false;
327
+ return tools.some((tool) => activeTools.includes(tool));
328
+ };
329
+ // Track if we've added the Information Gathering header
330
+ let addedInformationGatheringHeader = false;
331
+ for (const section of toolSections) {
332
+ // Check if section should be included
333
+ let shouldInclude = false;
334
+ if (section.alwaysInclude) {
335
+ shouldInclude = true;
336
+ }
337
+ else if (section.tools.length > 0) {
338
+ shouldInclude = hasAnyTool(...section.tools);
339
+ }
340
+ else if (section.dependencies) {
341
+ shouldInclude = hasAnyTool(...section.dependencies);
342
+ }
343
+ else {
344
+ // Section with no tools and no dependencies shouldn't be included
345
+ continue;
346
+ }
347
+ if (!shouldInclude) {
348
+ continue;
349
+ }
350
+ // Generate content for the section
351
+ const content = section.content(activeTools, activeTools);
352
+ if (!content.trim()) {
353
+ continue;
354
+ }
355
+ // Handle Information Gathering sections specially
356
+ if (section.id === "information-gathering-file-system" ||
357
+ section.id === "information-gathering-web") {
358
+ if (!addedInformationGatheringHeader) {
359
+ sections.push("\n\n### Information Gathering");
360
+ addedInformationGatheringHeader = true;
361
+ }
362
+ sections.push(`\n\n${section.title}\n${content}`);
363
+ }
364
+ else {
365
+ sections.push(`\n\n${section.title}\n${content}`);
366
+ }
367
+ }
368
+ return sections.join("");
107
369
  }
108
- async function getRules() {
370
+ async function getProjectContext() {
109
371
  const rules = (await config.readAgentsFile()).trim();
110
372
  const learnedRules = (await config.readProjectLearnedRulesFile()).trim();
111
373
  let result = "";
112
374
  if (rules) {
113
- result += `## Project Rules:\n\n${rules}\n`;
375
+ result += `## Project Context:\n\n### AGENTS.md for ./\n\n<instructions>\n${rules}\n</instructions>\n\n`;
114
376
  }
115
377
  if (learnedRules) {
116
378
  if (!rules) {
@@ -120,7 +382,7 @@ async function getRules() {
120
382
  }
121
383
  return result.trim();
122
384
  }
123
- async function environmentInfo() {
385
+ async function environmentInfo(allowedDirs) {
124
386
  const gitDirectory = await inGitDirectory();
125
387
  let gitSection = `- **Is directory a git repo**: ${gitDirectory ? "Yes" : "No"}`;
126
388
  if (gitDirectory) {
@@ -128,39 +390,154 @@ async function environmentInfo() {
128
390
  }
129
391
  return `## Environment
130
392
 
131
- - **Current working directory**: ${process.cwd()}. [Use this value directly instead of calling the \`${BashTool.name}(pwd)\` tool unless you have a specific reason to verify it].
393
+ ### Allowed directories:
394
+
395
+ ${allowedDirs.map((dir) => `- ${dir}`).join("\n")}
396
+
397
+ ### Information:
398
+
132
399
  ${gitSection}
133
400
  - **Platform**: ${platform()}
134
401
  - **Shell**: ${getShell()}
135
- - **Today's date**: ${(new Date()).toISOString()}
402
+ - **Today's date**: ${new Date().toISOString().split("T")[0]}
403
+
136
404
  - Note: The .tmp directory in the current working directory is deleted each time the agent shuts down.`;
137
405
  }
138
406
  export async function systemPrompt(options) {
139
- const { supportsToolCalling = true } = options ?? {};
407
+ const { type = "full" } = options ?? {};
408
+ switch (type) {
409
+ case "full":
410
+ return fullSystemPrompt(options);
411
+ case "minimal":
412
+ return minSystemPrompt(options);
413
+ case "cli":
414
+ return cliSystemPrompt(options);
415
+ default:
416
+ return fullSystemPrompt(options);
417
+ }
418
+ }
419
+ const DEFAULT_ALLOWED_DIRS = [process.cwd()];
420
+ async function fullSystemPrompt(options) {
421
+ const { allowedDirs = DEFAULT_ALLOWED_DIRS, includeRules = true, skillsEnabled = true, } = options ?? {};
422
+ const instructionsText = await instructions();
423
+ const projectContextText = includeRules ? await getProjectContext() : "";
424
+ const environmentInfoText = await environmentInfo(allowedDirs);
425
+ let skillsText = "";
426
+ if (skillsEnabled) {
427
+ const skills = await loadSkills();
428
+ skillsText = formatSkillsForPrompt(skills);
429
+ }
140
430
  const prompt = dedent `
141
431
  ${intro()}
142
432
 
143
- ${await instructions()}
433
+ ${instructionsText}
144
434
 
145
- ${supportsToolCalling ? toolUsage() : ""}
435
+ ${projectContextText}
146
436
 
147
- ${escalationProcedures()}
437
+ ${environmentInfoText}${skillsText}
438
+ `;
439
+ return prompt;
440
+ }
441
+ async function minSystemPrompt(options) {
442
+ const { allowedDirs = DEFAULT_ALLOWED_DIRS, activeTools = undefined, includeRules = true, skillsEnabled = true, } = options ?? {};
443
+ const minimalInstructionsText = await minimalInstructions();
444
+ const projectContextText = includeRules ? await getProjectContext() : "";
445
+ const environmentInfoText = await environmentInfo(allowedDirs);
446
+ let skillsText = "";
447
+ if (skillsEnabled) {
448
+ const skills = await loadSkills();
449
+ skillsText = formatSkillsForPrompt(skills);
450
+ }
451
+ const prompt = dedent `
452
+ ${intro()}
453
+
454
+ ${minimalInstructionsText}
148
455
 
149
- ${await getRules()}
456
+ ${toolUsage(activeTools)}
150
457
 
151
- ${await environmentInfo()}
458
+ ${projectContextText}
459
+
460
+ ${environmentInfoText}${skillsText}
152
461
  `;
153
462
  return prompt;
154
463
  }
155
- export async function minSystemPrompt() {
464
+ async function cliSystemPrompt(options) {
465
+ const { allowedDirs = DEFAULT_ALLOWED_DIRS, activeTools = undefined, skillsEnabled = true, } = options ?? {};
466
+ const minimalInstructionsText = await minimalInstructions();
467
+ const projectContextText = await getProjectContext();
468
+ const environmentInfoText = await environmentInfo(allowedDirs);
469
+ let skillsText = "";
470
+ if (skillsEnabled) {
471
+ const skills = await loadSkills();
472
+ skillsText = formatSkillsForPrompt(skills);
473
+ }
156
474
  const prompt = dedent `
157
475
  ${intro()}
158
476
 
159
- ${await instructions()}
477
+ ${minimalInstructionsText}
478
+
479
+ ${activeTools && activeTools.length > 0 ? "Tools:" : ""}
480
+ ${activeTools && activeTools.length > 0 ? activeTools.map((tool) => `- ${tool}`).join("\n") : ""}
160
481
 
161
- ${await getRules()}
482
+ ${projectContextText}
162
483
 
163
- ${await environmentInfo()}
484
+ ${environmentInfoText}${skillsText}
164
485
  `;
165
486
  return prompt;
166
487
  }
488
+ function getInstalledTools() {
489
+ // Check for required bash tools
490
+ const tools = [
491
+ {
492
+ name: "git",
493
+ command: "git --version",
494
+ description: "Version control system - used for cloning repositories, checking out branches, committing changes, viewing history, and managing code versions",
495
+ },
496
+ {
497
+ name: "gh",
498
+ command: "gh --version",
499
+ description: "GitHub CLI - used for creating pull requests, managing issues, interacting with GitHub API, and automating GitHub workflows",
500
+ },
501
+ {
502
+ name: "rg",
503
+ command: "rg --version",
504
+ description: "ripgrep - fast text search tool for searching code patterns, file contents, and regular expressions across the codebase (use this instead of grep)",
505
+ },
506
+ {
507
+ name: "fd",
508
+ command: "fd --version",
509
+ description: "Fast file finder - alternative to find command, used for finding files by name, pattern, or type with intuitive syntax (use this instead of find)",
510
+ },
511
+ {
512
+ name: "ast-grep",
513
+ command: "ast-grep --version",
514
+ description: "AST-based code search - used for structural code search, refactoring, finding patterns in abstract syntax trees, and code transformations",
515
+ },
516
+ {
517
+ name: "jq",
518
+ command: "jq --version",
519
+ description: "JSON processor - used for parsing, filtering, and manipulating JSON output from APIs, commands, and configuration files",
520
+ },
521
+ {
522
+ name: "yq",
523
+ command: "yq --version",
524
+ description: "YAML processor - used for parsing and manipulating YAML files (configs, CI/CD pipelines, Kubernetes manifests) with jq-like syntax",
525
+ },
526
+ ];
527
+ const toolStatus = tools
528
+ .map((tool) => {
529
+ let status = false;
530
+ try {
531
+ execSync(tool.command, { stdio: "ignore", timeout: 5000 });
532
+ status = true;
533
+ }
534
+ catch (_error) {
535
+ // Ignore error, tool is not installed
536
+ }
537
+ return { name: tool.name, description: tool.description, status };
538
+ })
539
+ .filter((tool) => tool.status)
540
+ .map((tool) => `- **${tool.name}**: ${tool.description}`)
541
+ .join("\n");
542
+ return toolStatus;
543
+ }
@@ -0,0 +1,3 @@
1
+ export declare function getProjectStatusLine(): Promise<string>;
2
+ export declare function clearProjectStatusCache(): void;
3
+ //# sourceMappingURL=project-status-line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-status-line.d.ts","sourceRoot":"","sources":["../../source/repl/project-status-line.ts"],"names":[],"mappings":"AAkEA,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAE5D;AAID,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}