@travisennis/acai 0.0.9 → 0.0.11

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 (403) hide show
  1. package/README.md +51 -760
  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 +380 -199
  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 -77
  12. package/dist/{stdin.d.ts → cli/stdin.d.ts} +2 -1
  13. package/dist/cli/stdin.d.ts.map +1 -0
  14. package/dist/{stdin.js → cli/stdin.js} +11 -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 -101
  21. package/dist/commands/generate-rules/service.d.ts +22 -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 +3 -2
  27. package/dist/commands/health/utils.d.ts.map +1 -1
  28. package/dist/commands/health/utils.js +6 -0
  29. package/dist/commands/history/index.d.ts +1 -1
  30. package/dist/commands/history/index.d.ts.map +1 -1
  31. package/dist/commands/history/index.js +17 -18
  32. package/dist/commands/history/types.d.ts +38 -0
  33. package/dist/commands/history/types.d.ts.map +1 -1
  34. package/dist/commands/history/utils.d.ts.map +1 -1
  35. package/dist/commands/history/utils.js +63 -58
  36. package/dist/commands/init/index.d.ts.map +1 -1
  37. package/dist/commands/init/index.js +3 -8
  38. package/dist/commands/init-project/index.d.ts.map +1 -1
  39. package/dist/commands/init-project/index.js +3 -3
  40. package/dist/commands/init-project/utils.d.ts +2 -1
  41. package/dist/commands/init-project/utils.d.ts.map +1 -1
  42. package/dist/commands/init-project/utils.js +10 -2
  43. package/dist/commands/list-tools/index.d.ts.map +1 -1
  44. package/dist/commands/list-tools/index.js +7 -31
  45. package/dist/commands/manager.d.ts +2 -2
  46. package/dist/commands/manager.d.ts.map +1 -1
  47. package/dist/commands/manager.js +55 -33
  48. package/dist/commands/model/index.d.ts.map +1 -1
  49. package/dist/commands/model/index.js +20 -151
  50. package/dist/commands/model/model-panel.d.ts +4 -0
  51. package/dist/commands/model/model-panel.d.ts.map +1 -0
  52. package/dist/commands/model/model-panel.js +144 -0
  53. package/dist/commands/paste/index.d.ts.map +1 -1
  54. package/dist/commands/paste/index.js +59 -62
  55. package/dist/commands/paste/utils.d.ts.map +1 -1
  56. package/dist/commands/paste/utils.js +88 -58
  57. package/dist/commands/pickup/index.d.ts.map +1 -1
  58. package/dist/commands/pickup/index.js +6 -3
  59. package/dist/commands/pickup/utils.js +3 -3
  60. package/dist/commands/resources/index.d.ts.map +1 -1
  61. package/dist/commands/resources/index.js +33 -50
  62. package/dist/commands/review/index.d.ts.map +1 -1
  63. package/dist/commands/review/index.js +3 -117
  64. package/dist/commands/review/review-panel.d.ts +3 -0
  65. package/dist/commands/review/review-panel.d.ts.map +1 -0
  66. package/dist/commands/review/review-panel.js +186 -0
  67. package/dist/commands/review/utils.d.ts +15 -1
  68. package/dist/commands/review/utils.d.ts.map +1 -1
  69. package/dist/commands/review/utils.js +127 -68
  70. package/dist/commands/session/index.d.ts +1 -1
  71. package/dist/commands/session/index.d.ts.map +1 -1
  72. package/dist/commands/session/index.js +124 -135
  73. package/dist/commands/shell/index.d.ts.map +1 -1
  74. package/dist/commands/shell/index.js +16 -1
  75. package/dist/commands/types.d.ts +2 -2
  76. package/dist/commands/types.d.ts.map +1 -1
  77. package/dist/{config.d.ts → config/index.d.ts} +20 -9
  78. package/dist/config/index.d.ts.map +1 -0
  79. package/dist/{config.js → config/index.js} +43 -42
  80. package/dist/execution/index.d.ts.map +1 -1
  81. package/dist/execution/index.js +75 -55
  82. package/dist/index.d.ts +1 -0
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +148 -141
  85. package/dist/middleware/cache.d.ts.map +1 -1
  86. package/dist/middleware/cache.js +18 -36
  87. package/dist/models/ai-config.d.ts +1 -0
  88. package/dist/models/ai-config.d.ts.map +1 -1
  89. package/dist/models/ai-config.js +4 -3
  90. package/dist/models/anthropic-provider.d.ts +2 -5
  91. package/dist/models/anthropic-provider.d.ts.map +1 -1
  92. package/dist/models/anthropic-provider.js +3 -70
  93. package/dist/models/deepseek-provider.d.ts +1 -0
  94. package/dist/models/deepseek-provider.d.ts.map +1 -1
  95. package/dist/models/google-provider.d.ts +2 -3
  96. package/dist/models/google-provider.d.ts.map +1 -1
  97. package/dist/models/google-provider.js +0 -26
  98. package/dist/models/groq-provider.d.ts +1 -0
  99. package/dist/models/groq-provider.d.ts.map +1 -1
  100. package/dist/models/manager.d.ts +13 -2
  101. package/dist/models/manager.d.ts.map +1 -1
  102. package/dist/models/manager.js +20 -8
  103. package/dist/models/openai-provider.d.ts +2 -5
  104. package/dist/models/openai-provider.d.ts.map +1 -1
  105. package/dist/models/openai-provider.js +0 -52
  106. package/dist/models/opencode-go-provider.d.ts +25 -0
  107. package/dist/models/opencode-go-provider.d.ts.map +1 -0
  108. package/dist/models/opencode-go-provider.js +78 -0
  109. package/dist/models/opencode-zen-provider.d.ts +7 -3
  110. package/dist/models/opencode-zen-provider.d.ts.map +1 -1
  111. package/dist/models/opencode-zen-provider.js +49 -10
  112. package/dist/models/openrouter-provider.d.ts +27 -31
  113. package/dist/models/openrouter-provider.d.ts.map +1 -1
  114. package/dist/models/openrouter-provider.js +121 -180
  115. package/dist/models/providers.d.ts +3 -3
  116. package/dist/models/providers.d.ts.map +1 -1
  117. package/dist/models/providers.js +6 -0
  118. package/dist/models/xai-provider.d.ts +4 -3
  119. package/dist/models/xai-provider.d.ts.map +1 -1
  120. package/dist/models/xai-provider.js +18 -18
  121. package/dist/modes/manager.d.ts +24 -0
  122. package/dist/modes/manager.d.ts.map +1 -0
  123. package/dist/modes/manager.js +77 -0
  124. package/dist/modes/prompts.d.ts +2 -0
  125. package/dist/modes/prompts.d.ts.map +1 -0
  126. package/dist/modes/prompts.js +142 -0
  127. package/dist/prompts/mentions.d.ts +11 -0
  128. package/dist/prompts/mentions.d.ts.map +1 -0
  129. package/dist/{mentions.js → prompts/mentions.js} +55 -85
  130. package/dist/{prompts.d.ts → prompts/system-prompt.d.ts} +7 -2
  131. package/dist/prompts/system-prompt.d.ts.map +1 -0
  132. package/dist/{prompts.js → prompts/system-prompt.js} +31 -16
  133. package/dist/repl/index.d.ts +174 -0
  134. package/dist/repl/index.d.ts.map +1 -0
  135. package/dist/{repl-new.js → repl/index.js} +397 -76
  136. package/dist/repl/project-status.d.ts +1 -0
  137. package/dist/repl/project-status.d.ts.map +1 -1
  138. package/dist/repl/project-status.js +4 -1
  139. package/dist/sessions/manager.d.ts +92 -0
  140. package/dist/sessions/manager.d.ts.map +1 -1
  141. package/dist/sessions/manager.js +262 -9
  142. package/dist/sessions/summary.d.ts +4 -0
  143. package/dist/sessions/summary.d.ts.map +1 -0
  144. package/dist/sessions/summary.js +30 -0
  145. package/dist/skills/index.d.ts +29 -0
  146. package/dist/skills/index.d.ts.map +1 -0
  147. package/dist/skills/index.js +294 -0
  148. package/dist/subagents/index.d.ts +16 -0
  149. package/dist/subagents/index.d.ts.map +1 -0
  150. package/dist/subagents/index.js +231 -0
  151. package/dist/terminal/control.d.ts +1 -1
  152. package/dist/terminal/control.d.ts.map +1 -1
  153. package/dist/terminal/control.js +3 -3
  154. package/dist/terminal/east-asian-width.d.ts.map +1 -1
  155. package/dist/terminal/east-asian-width.js +404 -351
  156. package/dist/terminal/keys.d.ts +17 -0
  157. package/dist/terminal/keys.d.ts.map +1 -1
  158. package/dist/terminal/keys.js +37 -0
  159. package/dist/terminal/select-prompt.d.ts.map +1 -1
  160. package/dist/terminal/select-prompt.js +24 -12
  161. package/dist/terminal/string-width.d.ts.map +1 -1
  162. package/dist/terminal/string-width.js +25 -27
  163. package/dist/terminal/style.d.ts.map +1 -1
  164. package/dist/terminal/style.js +4 -7
  165. package/dist/terminal/supports-color.d.ts.map +1 -1
  166. package/dist/terminal/supports-color.js +41 -27
  167. package/dist/terminal/table/cell.d.ts +12 -0
  168. package/dist/terminal/table/cell.d.ts.map +1 -1
  169. package/dist/terminal/table/cell.js +40 -25
  170. package/dist/terminal/table/layout-manager.d.ts.map +1 -1
  171. package/dist/terminal/table/layout-manager.js +100 -68
  172. package/dist/terminal/table/utils.d.ts +1 -1
  173. package/dist/terminal/table/utils.d.ts.map +1 -1
  174. package/dist/terminal/table/utils.js +17 -10
  175. package/dist/terminal/wrap-ansi.d.ts.map +1 -1
  176. package/dist/terminal/wrap-ansi.js +174 -105
  177. package/dist/tokens/tracker.d.ts +1 -0
  178. package/dist/tokens/tracker.d.ts.map +1 -1
  179. package/dist/tokens/tracker.js +3 -0
  180. package/dist/tools/agent.d.ts +27 -0
  181. package/dist/tools/agent.d.ts.map +1 -0
  182. package/dist/tools/agent.js +81 -0
  183. package/dist/tools/apply-patch.d.ts +62 -0
  184. package/dist/tools/apply-patch.d.ts.map +1 -0
  185. package/dist/tools/apply-patch.js +377 -0
  186. package/dist/tools/bash.d.ts +4 -3
  187. package/dist/tools/bash.d.ts.map +1 -1
  188. package/dist/tools/bash.js +349 -141
  189. package/dist/tools/directory-tree.d.ts +3 -3
  190. package/dist/tools/directory-tree.d.ts.map +1 -1
  191. package/dist/tools/directory-tree.js +8 -5
  192. package/dist/tools/dynamic-tool-loader.d.ts +3 -6
  193. package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
  194. package/dist/tools/dynamic-tool-loader.js +20 -4
  195. package/dist/tools/edit-file.d.ts +7 -7
  196. package/dist/tools/edit-file.d.ts.map +1 -1
  197. package/dist/tools/edit-file.js +292 -85
  198. package/dist/tools/glob.d.ts +6 -6
  199. package/dist/tools/glob.d.ts.map +1 -1
  200. package/dist/tools/glob.js +110 -63
  201. package/dist/tools/grep.d.ts +15 -12
  202. package/dist/tools/grep.d.ts.map +1 -1
  203. package/dist/tools/grep.js +315 -193
  204. package/dist/tools/index.d.ts +114 -9
  205. package/dist/tools/index.d.ts.map +1 -1
  206. package/dist/tools/index.js +39 -24
  207. package/dist/tools/ls.d.ts +2 -2
  208. package/dist/tools/ls.d.ts.map +1 -1
  209. package/dist/tools/ls.js +7 -5
  210. package/dist/tools/read-file.d.ts +4 -6
  211. package/dist/tools/read-file.d.ts.map +1 -1
  212. package/dist/tools/read-file.js +84 -39
  213. package/dist/tools/save-file.d.ts +3 -3
  214. package/dist/tools/save-file.d.ts.map +1 -1
  215. package/dist/tools/save-file.js +36 -31
  216. package/dist/tools/skill.d.ts +23 -0
  217. package/dist/tools/skill.d.ts.map +1 -0
  218. package/dist/tools/skill.js +65 -0
  219. package/dist/tools/think.d.ts.map +1 -1
  220. package/dist/tools/think.js +2 -9
  221. package/dist/tools/utils.d.ts +2 -0
  222. package/dist/tools/utils.d.ts.map +1 -1
  223. package/dist/tools/utils.js +12 -0
  224. package/dist/tools/web-fetch.d.ts +50 -0
  225. package/dist/tools/web-fetch.d.ts.map +1 -0
  226. package/dist/tools/web-fetch.js +446 -0
  227. package/dist/tools/web-search.d.ts +44 -0
  228. package/dist/tools/web-search.d.ts.map +1 -0
  229. package/dist/tools/web-search.js +226 -0
  230. package/dist/tui/autocomplete/attachment-provider.d.ts +3 -6
  231. package/dist/tui/autocomplete/attachment-provider.d.ts.map +1 -1
  232. package/dist/tui/autocomplete/attachment-provider.js +25 -78
  233. package/dist/tui/autocomplete/base-provider.d.ts +1 -0
  234. package/dist/tui/autocomplete/base-provider.d.ts.map +1 -1
  235. package/dist/tui/autocomplete/combined-provider.d.ts +1 -4
  236. package/dist/tui/autocomplete/combined-provider.d.ts.map +1 -1
  237. package/dist/tui/autocomplete/combined-provider.js +3 -17
  238. package/dist/tui/autocomplete/command-provider.d.ts +1 -0
  239. package/dist/tui/autocomplete/command-provider.d.ts.map +1 -1
  240. package/dist/tui/autocomplete/command-provider.js +3 -0
  241. package/dist/tui/autocomplete/file-search-provider.d.ts +2 -1
  242. package/dist/tui/autocomplete/file-search-provider.d.ts.map +1 -1
  243. package/dist/tui/autocomplete/file-search-provider.js +37 -17
  244. package/dist/tui/autocomplete/skill-provider.d.ts +17 -0
  245. package/dist/tui/autocomplete/skill-provider.d.ts.map +1 -0
  246. package/dist/tui/autocomplete/skill-provider.js +49 -0
  247. package/dist/tui/autocomplete/utils.d.ts +2 -1
  248. package/dist/tui/autocomplete/utils.d.ts.map +1 -1
  249. package/dist/tui/autocomplete/utils.js +25 -23
  250. package/dist/tui/autocomplete.d.ts +2 -2
  251. package/dist/tui/autocomplete.d.ts.map +1 -1
  252. package/dist/tui/autocomplete.js +3 -5
  253. package/dist/tui/components/assistant-message.d.ts.map +1 -1
  254. package/dist/tui/components/assistant-message.js +0 -4
  255. package/dist/tui/components/editor.d.ts +18 -3
  256. package/dist/tui/components/editor.d.ts.map +1 -1
  257. package/dist/tui/components/editor.js +211 -237
  258. package/dist/tui/components/footer.d.ts +6 -4
  259. package/dist/tui/components/footer.d.ts.map +1 -1
  260. package/dist/tui/components/footer.js +49 -25
  261. package/dist/tui/components/markdown.d.ts +10 -7
  262. package/dist/tui/components/markdown.d.ts.map +1 -1
  263. package/dist/tui/components/markdown.js +57 -39
  264. package/dist/tui/components/modal.d.ts.map +1 -1
  265. package/dist/tui/components/modal.js +35 -33
  266. package/dist/tui/components/notification.d.ts +13 -2
  267. package/dist/tui/components/notification.d.ts.map +1 -1
  268. package/dist/tui/components/notification.js +36 -2
  269. package/dist/tui/components/progress-bar.js +1 -1
  270. package/dist/tui/components/select-list.d.ts +1 -0
  271. package/dist/tui/components/select-list.d.ts.map +1 -1
  272. package/dist/tui/components/select-list.js +14 -11
  273. package/dist/tui/components/text.d.ts +16 -0
  274. package/dist/tui/components/text.d.ts.map +1 -1
  275. package/dist/tui/components/text.js +72 -57
  276. package/dist/tui/components/thinking-block.d.ts +9 -0
  277. package/dist/tui/components/thinking-block.d.ts.map +1 -1
  278. package/dist/tui/components/thinking-block.js +43 -11
  279. package/dist/tui/components/tool-execution.d.ts +5 -1
  280. package/dist/tui/components/tool-execution.d.ts.map +1 -1
  281. package/dist/tui/components/tool-execution.js +19 -10
  282. package/dist/tui/components/user-message.d.ts.map +1 -1
  283. package/dist/tui/components/user-message.js +0 -3
  284. package/dist/tui/components/welcome.d.ts +2 -1
  285. package/dist/tui/components/welcome.d.ts.map +1 -1
  286. package/dist/tui/components/welcome.js +2 -2
  287. package/dist/tui/editor-launcher.d.ts +3 -2
  288. package/dist/tui/editor-launcher.d.ts.map +1 -1
  289. package/dist/tui/index.d.ts +0 -1
  290. package/dist/tui/index.d.ts.map +1 -1
  291. package/dist/tui/terminal.d.ts.map +1 -1
  292. package/dist/tui/terminal.js +10 -2
  293. package/dist/tui/tui.d.ts +43 -0
  294. package/dist/tui/tui.d.ts.map +1 -1
  295. package/dist/tui/tui.js +166 -41
  296. package/dist/tui/utils.d.ts +1 -5
  297. package/dist/tui/utils.d.ts.map +1 -1
  298. package/dist/tui/utils.js +271 -44
  299. package/dist/utils/bash/parse.d.ts +19 -0
  300. package/dist/utils/bash/parse.d.ts.map +1 -0
  301. package/dist/utils/bash/parse.js +223 -0
  302. package/dist/utils/bash/quote.d.ts +6 -0
  303. package/dist/utils/bash/quote.d.ts.map +1 -0
  304. package/dist/utils/bash/quote.js +23 -0
  305. package/dist/utils/bash.d.ts.map +1 -1
  306. package/dist/utils/bash.js +211 -126
  307. package/dist/utils/command-protection.d.ts +28 -0
  308. package/dist/utils/command-protection.d.ts.map +1 -0
  309. package/dist/utils/command-protection.js +324 -0
  310. package/dist/utils/dedent.d.ts.map +1 -0
  311. package/dist/utils/env-expand.d.ts +2 -0
  312. package/dist/utils/env-expand.d.ts.map +1 -0
  313. package/dist/utils/env-expand.js +8 -0
  314. package/dist/utils/filesystem/path-display.d.ts +11 -0
  315. package/dist/utils/filesystem/path-display.d.ts.map +1 -0
  316. package/dist/utils/filesystem/path-display.js +32 -0
  317. package/dist/utils/filesystem/security.d.ts +2 -2
  318. package/dist/utils/filesystem/security.d.ts.map +1 -1
  319. package/dist/utils/filesystem/security.js +28 -30
  320. package/dist/utils/formatting.d.ts.map +1 -0
  321. package/dist/{formatting.js → utils/formatting.js} +1 -1
  322. package/dist/utils/git.d.ts +4 -0
  323. package/dist/utils/git.d.ts.map +1 -1
  324. package/dist/utils/git.js +30 -0
  325. package/dist/utils/glob.d.ts +1 -1
  326. package/dist/utils/glob.d.ts.map +1 -1
  327. package/dist/utils/logger.d.ts.map +1 -0
  328. package/dist/{logger.js → utils/logger.js} +1 -1
  329. package/dist/utils/parsing.d.ts.map +1 -0
  330. package/dist/utils/process.d.ts.map +1 -1
  331. package/dist/utils/process.js +90 -37
  332. package/dist/utils/templates.d.ts +2 -0
  333. package/dist/utils/templates.d.ts.map +1 -0
  334. package/dist/utils/templates.js +24 -0
  335. package/dist/utils/version.d.ts.map +1 -0
  336. package/dist/{version.js → utils/version.js} +1 -1
  337. package/package.json +35 -26
  338. package/dist/cli.d.ts +0 -23
  339. package/dist/cli.d.ts.map +0 -1
  340. package/dist/commands/add-directory/types.d.ts +0 -6
  341. package/dist/commands/add-directory/types.d.ts.map +0 -1
  342. package/dist/commands/add-directory/types.js +0 -1
  343. package/dist/commands/copy/types.d.ts +0 -3
  344. package/dist/commands/copy/types.d.ts.map +0 -1
  345. package/dist/commands/copy/types.js +0 -1
  346. package/dist/commands/exit/index.d.ts +0 -10
  347. package/dist/commands/exit/index.d.ts.map +0 -1
  348. package/dist/commands/exit/index.js +0 -21
  349. package/dist/commands/exit/types.d.ts +0 -8
  350. package/dist/commands/exit/types.d.ts.map +0 -1
  351. package/dist/commands/exit/types.js +0 -1
  352. package/dist/commands/exit/utils.d.ts +0 -2
  353. package/dist/commands/exit/utils.d.ts.map +0 -1
  354. package/dist/commands/exit/utils.js +0 -13
  355. package/dist/commands/prompt/index.d.ts +0 -5
  356. package/dist/commands/prompt/index.d.ts.map +0 -1
  357. package/dist/commands/prompt/index.js +0 -122
  358. package/dist/commands/prompt/types.d.ts +0 -15
  359. package/dist/commands/prompt/types.d.ts.map +0 -1
  360. package/dist/commands/prompt/types.js +0 -1
  361. package/dist/commands/prompt/utils.d.ts +0 -12
  362. package/dist/commands/prompt/utils.d.ts.map +0 -1
  363. package/dist/commands/prompt/utils.js +0 -107
  364. package/dist/commands/reset/index.d.ts +0 -3
  365. package/dist/commands/reset/index.d.ts.map +0 -1
  366. package/dist/commands/reset/index.js +0 -25
  367. package/dist/commands/reset/types.d.ts +0 -1
  368. package/dist/commands/reset/types.d.ts.map +0 -1
  369. package/dist/commands/reset/types.js +0 -3
  370. package/dist/commands/review/types.d.ts +0 -12
  371. package/dist/commands/review/types.d.ts.map +0 -1
  372. package/dist/commands/review/types.js +0 -1
  373. package/dist/commands/save/index.d.ts +0 -3
  374. package/dist/commands/save/index.d.ts.map +0 -1
  375. package/dist/commands/save/index.js +0 -19
  376. package/dist/config.d.ts.map +0 -1
  377. package/dist/dedent.d.ts.map +0 -1
  378. package/dist/formatting.d.ts.map +0 -1
  379. package/dist/logger.d.ts.map +0 -1
  380. package/dist/mentions.d.ts +0 -14
  381. package/dist/mentions.d.ts.map +0 -1
  382. package/dist/parsing.d.ts.map +0 -1
  383. package/dist/prompts.d.ts.map +0 -1
  384. package/dist/repl-new.d.ts +0 -65
  385. package/dist/repl-new.d.ts.map +0 -1
  386. package/dist/skills.d.ts +0 -16
  387. package/dist/skills.d.ts.map +0 -1
  388. package/dist/skills.js +0 -233
  389. package/dist/stdin.d.ts.map +0 -1
  390. package/dist/tui/autocomplete/path-provider.d.ts +0 -21
  391. package/dist/tui/autocomplete/path-provider.d.ts.map +0 -1
  392. package/dist/tui/autocomplete/path-provider.js +0 -164
  393. package/dist/utils/iterables.d.ts +0 -2
  394. package/dist/utils/iterables.d.ts.map +0 -1
  395. package/dist/utils/iterables.js +0 -6
  396. package/dist/version.d.ts.map +0 -1
  397. /package/dist/{dedent.d.ts → utils/dedent.d.ts} +0 -0
  398. /package/dist/{dedent.js → utils/dedent.js} +0 -0
  399. /package/dist/{formatting.d.ts → utils/formatting.d.ts} +0 -0
  400. /package/dist/{logger.d.ts → utils/logger.d.ts} +0 -0
  401. /package/dist/{parsing.d.ts → utils/parsing.d.ts} +0 -0
  402. /package/dist/{parsing.js → utils/parsing.js} +0 -0
  403. /package/dist/{version.d.ts → utils/version.d.ts} +0 -0
@@ -0,0 +1,22 @@
1
+ import { type ModelMessage } from "ai";
2
+ import type { ConfigManager } from "../../config/index.ts";
3
+ import type { WorkspaceContext } from "../../index.ts";
4
+ import type { ModelManager } from "../../models/manager.ts";
5
+ import type { TokenTracker } from "../../tokens/tracker.ts";
6
+ interface GenerateRulesOptions {
7
+ modelManager: ModelManager;
8
+ messages: ModelMessage[];
9
+ tokenTracker: TokenTracker;
10
+ config: ConfigManager;
11
+ workspace: WorkspaceContext;
12
+ }
13
+ interface GenerateRulesResult {
14
+ rules: string[];
15
+ }
16
+ /**
17
+ * Analyzes conversation and generates rules without UI interaction.
18
+ * Returns the list of generated rules.
19
+ */
20
+ export declare function generateRulesFromSession(options: GenerateRulesOptions): Promise<GenerateRulesResult>;
21
+ export {};
22
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../source/commands/generate-rules/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,IAAI,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D,UAAU,oBAAoB;IAC5B,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,gBAAgB,CAAC;CAC7B;AAED,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC,CA6D9B"}
@@ -0,0 +1,103 @@
1
+ import { generateText } from "ai";
2
+ import { systemPrompt } from "../../prompts/system-prompt.js";
3
+ import { createUserMessage } from "../../sessions/manager.js";
4
+ /**
5
+ * Analyzes conversation and generates rules without UI interaction.
6
+ * Returns the list of generated rules.
7
+ */
8
+ export async function generateRulesFromSession(options) {
9
+ const { modelManager, messages, tokenTracker, config, workspace } = options;
10
+ // Read existing learned rules to avoid duplicates
11
+ const existingRules = await config.readLearnedRulesFile();
12
+ // Add analysis prompt to messages (clone to avoid side effects)
13
+ const analysisMessages = [...messages];
14
+ analysisMessages.push(createUserMessage([
15
+ `Analyze this conversation and identify ONLY rules that are broadly applicable to FUTURE, UNRELATED tasks.
16
+
17
+ **Critical: Most conversations will NOT yield useful generalizable rules.** Only extract a rule if it represents a genuine, reusable principle that would help the agent in completely different contexts.
18
+
19
+ **Key Requirements:**
20
+ - A rule must be *universally* applicable, not just to this project or similar tasks
21
+ - If you're uncertain whether a rule is broadly applicable, DO NOT include it
22
+ - Rules about specific files, functions, or variables are NEVER acceptable
23
+ - Return an EMPTY list if no broadly applicable rules can be inferred
24
+ - Return *only* the Markdown list of rules, with no preamble or explanation
25
+
26
+ <existing-rules>
27
+ ${existingRules}
28
+ </existing-rules>`,
29
+ ]));
30
+ const systemPromptText = await createAnalysisSystemPrompt(config, workspace);
31
+ const { text, usage } = await generateText({
32
+ model: modelManager.getModel("conversation-analyzer"),
33
+ maxOutputTokens: 8192,
34
+ system: systemPromptText,
35
+ messages: analysisMessages,
36
+ });
37
+ tokenTracker.trackUsage("conversation-analyzer", usage);
38
+ const potentialRulesText = text.trim();
39
+ if (!potentialRulesText || potentialRulesText.length === 0) {
40
+ return { rules: [] };
41
+ }
42
+ const potentialRulesList = potentialRulesText
43
+ .split("\n")
44
+ .map((rule) => rule.trim())
45
+ .filter((rule) => rule.length > 0);
46
+ if (potentialRulesList.length === 0) {
47
+ return { rules: [] };
48
+ }
49
+ // Update learned rules file to avoid duplicates in future analysis
50
+ const updatedRules = existingRules.endsWith("\n") || existingRules.length === 0
51
+ ? `${existingRules}${potentialRulesList.join("\n")}`
52
+ : `${existingRules}\n${potentialRulesList.join("\n")}`;
53
+ await config.writeLearnedRulesFile(updatedRules);
54
+ return { rules: potentialRulesList };
55
+ }
56
+ async function createAnalysisSystemPrompt(configManager, workspace) {
57
+ const projectConfig = await configManager.getConfig();
58
+ const sysResult = await systemPrompt({
59
+ activeTools: projectConfig.tools.activeTools,
60
+ includeRules: true,
61
+ allowedDirs: workspace.allowedDirs,
62
+ logsPath: projectConfig.logs?.path,
63
+ });
64
+ const sys = sysResult.prompt;
65
+ return `You are an expert analyst reviewing conversations between a coding agent and a software engineer.
66
+
67
+ **YOUR PRIMARY DIRECTIVE: Be extremely conservative. Most conversations do NOT contain useful generalizable rules.** Your job is to identify ONLY those rare, genuinely universal principles that would help the agent in completely unrelated future tasks.
68
+
69
+ **Your Task:**
70
+ 1. Analyze the conversation provided.
71
+ 2. Identify corrections or redirections that reveal principles TRUE ACROSS ALMOST ANY CONTEXT.
72
+ 3. For each correction, ask yourself: "Would this principle be useful if I were working on a completely different project, with different files, different languages, and different requirements?" If not, DO NOT create a rule.
73
+ 4. List only rules that pass this high bar in Markdown bullet points. No preamble.
74
+
75
+ **RULES ABOUT RULES:**
76
+ - When in doubt, EXCLUDE. It is better to generate no rules than to generate specific ones.
77
+ - If a rule references any specific file name, function name, variable name, or project-specific detail, it is INVALID.
78
+ - If a rule is specific to a particular language, framework, or tool without broader applicability, it is INVALID.
79
+ - If the user simply clarified requirements (not corrected a flawed approach), it is NOT a rule-worthy correction.
80
+
81
+ **Valid General Rule Examples:**
82
+ <examples>
83
+ - Always ask for clarification if the user's request is ambiguous.
84
+ - Never make assumptions about file paths without confirmation.
85
+ - Always follow the user's explicitly stated formatting preferences.
86
+ - Never provide incomplete code snippets without indicating they are partial.
87
+ - Always check for potential null or undefined values before accessing properties.
88
+ </examples>
89
+
90
+ **INVALID Examples (Do NOT generate these):**
91
+ <bad-examples>
92
+ - Always use 'const' instead of 'let' for variables (too specific - depends on mutability needs)
93
+ - Never forget to pass the 'config' object to functions (specific to this codebase)
94
+ - Always add a try-catch block around API calls (too specific - depends on error handling strategy)
95
+ - Always run tests after making changes (task-specific workflow, not a general principle)
96
+ - Never modify the .env file (project-specific)
97
+ </bad-examples>
98
+
99
+ This is the original system prompt the agent operated under:
100
+ <systemPrompt>
101
+ ${sys}
102
+ </systemPrompt>`;
103
+ }
@@ -29,11 +29,11 @@ export const handoffCommand = (options) => {
29
29
  },
30
30
  };
31
31
  };
32
- async function createHandoffDocument({ modelManager, tokenTracker, sessionManager: messageHistory, }, purpose) {
32
+ async function createHandoffDocument({ modelManager, tokenTracker, sessionManager }, purpose) {
33
33
  const app = "handoff-agent";
34
34
  const model = modelManager.getModel(app);
35
35
  const modelConfig = modelManager.getModelMetadata(app);
36
- const messages = messageHistory.get();
36
+ const messages = sessionManager.get();
37
37
  const conversationText = messages
38
38
  .map((msg) => {
39
39
  let content = "";
@@ -41,7 +41,7 @@ export function healthCommand(_options) {
41
41
  }
42
42
  modalContent.addChild(new ModalText("", 0, 1));
43
43
  modalContent.addChild(new ModalText("Current Process:", 0, 1));
44
- const { formatMemoryUsage } = await import("../../formatting.js");
44
+ const { formatMemoryUsage } = await import("../../utils/formatting.js");
45
45
  const formattedUsage = formatMemoryUsage(usage);
46
46
  const memoryText = `Memory Usage: ${formattedUsage}`;
47
47
  modalContent.addChild(new ModalText(memoryText, 0, 1));
@@ -1,8 +1,8 @@
1
- export interface EnvVarInfo {
1
+ interface EnvVarInfo {
2
2
  name: string;
3
3
  description: string;
4
4
  }
5
- export interface ToolInfo {
5
+ interface ToolInfo {
6
6
  name: string;
7
7
  command: string;
8
8
  }
@@ -12,4 +12,5 @@ export declare function checkEnvironmentVariables(): (string | number)[][];
12
12
  export declare function checkTools(execFn?: (command: string, options: object) => void): string[][];
13
13
  export declare function formatEnvStatus(status: (string | number)[][]): (string | number)[][];
14
14
  export declare function formatToolStatus(status: string[][]): string[][];
15
+ export {};
15
16
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/health/utils.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,qBAAqB,EAAE,UAAU,EAc7C,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,QAAQ,EAQhC,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,CASjE;AAED,wBAAgB,UAAU,CACxB,MAAM,GAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAe,GAC5D,MAAM,EAAE,EAAE,CAWZ;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,GAC5B,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,CAEvB;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAE/D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/health/utils.ts"],"names":[],"mappings":"AAEA,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,qBAAqB,EAAE,UAAU,EAmB7C,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,QAAQ,EAShC,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,CASjE;AAED,wBAAgB,UAAU,CACxB,MAAM,GAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAe,GAC5D,MAAM,EAAE,EAAE,CAWZ;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,GAC5B,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,CAEvB;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAE/D"}
@@ -12,6 +12,11 @@ export const ENVIRONMENT_VARIABLES = [
12
12
  { name: "XAI_API_KEY", description: "X.AI (Grok models - alt)" },
13
13
  { name: "OPENROUTER_API_KEY", description: "OpenRouter (multiple models)" },
14
14
  { name: "OPENCODE_ZEN_API_TOKEN", description: "OpenCode Zen" },
15
+ { name: "EXA_API_KEY", description: "Exa (Web Search)" },
16
+ {
17
+ name: "JINA_READER_API_KEY",
18
+ description: "Jina AI (Web Fetch HTML cleaning)",
19
+ },
15
20
  { name: "LOG_LEVEL", description: "Logging level" },
16
21
  ];
17
22
  export const BASH_TOOLS = [
@@ -22,6 +27,7 @@ export const BASH_TOOLS = [
22
27
  { name: "ast-grep", command: "ast-grep --version" },
23
28
  { name: "jq", command: "jq --version" },
24
29
  { name: "yq", command: "yq --version" },
30
+ { name: "colgrep", command: "colgrep --version" },
25
31
  ];
26
32
  export function checkEnvironmentVariables() {
27
33
  return ENVIRONMENT_VARIABLES.map((envVar) => {
@@ -1,3 +1,3 @@
1
1
  import type { CommandOptions, ReplCommand } from "../types.ts";
2
- export declare const historyCommand: ({ sessionManager: messageHistory, config, modelManager, tokenTracker, }: CommandOptions) => ReplCommand;
2
+ export declare const historyCommand: ({ sessionManager, config, modelManager, tokenTracker, }: CommandOptions) => ReplCommand;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/history/index.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAwD/D,eAAO,MAAM,cAAc,GAAI,yEAK5B,cAAc,KAAG,WAkJnB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/history/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAwD/D,eAAO,MAAM,cAAc,GAAI,yDAK5B,cAAc,KAAG,WAoJnB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /* biome-ignore-all lint/suspicious/noExplicitAny: internal function uses simplified types */
2
2
  import { generateText } from "ai";
3
3
  import { SessionManager } from "../../sessions/manager.js";
4
- import { getTerminalSize, isArrowDown, isArrowUp, isEnter, isEscape, setTerminalTitle, } from "../../terminal/control.js";
4
+ import { getTerminalSize, isArrowDown, isArrowUp, isEnter, isEscape, isShiftTab, isTab, setTerminalTitle, } from "../../terminal/control.js";
5
5
  import style from "../../terminal/style.js";
6
6
  import { Container, Input, Markdown, Spacer, Text } from "../../tui/index.js";
7
7
  import { exportConversation } from "./utils.js";
@@ -44,16 +44,16 @@ Keep the summary focused and informative, around 3-5 paragraphs. Use plain text
44
44
  results.push("");
45
45
  return results.join("\n");
46
46
  }
47
- export const historyCommand = ({ sessionManager: messageHistory, config, modelManager, tokenTracker, }) => {
47
+ export const historyCommand = ({ sessionManager, config, modelManager, tokenTracker, }) => {
48
48
  return {
49
49
  command: "/history",
50
50
  description: "Browse and manage previous conversations.",
51
51
  getSubCommands: () => Promise.resolve([]),
52
52
  async handle(_args, { tui, container, inputContainer, editor, }) {
53
53
  const appDir = config.app;
54
- const messageHistoryDir = await appDir.ensurePath("message-history");
54
+ const sessionsDir = await appDir.ensurePath("sessions");
55
55
  // Load all histories (use a large number to get all)
56
- const histories = await SessionManager.load(messageHistoryDir, 1000);
56
+ const histories = await SessionManager.load(sessionsDir, 1000);
57
57
  if (histories.length === 0) {
58
58
  container.addChild(new Text(style.yellow("No previous conversations found."), 0, 1));
59
59
  tui.requestRender();
@@ -67,9 +67,11 @@ export const historyCommand = ({ sessionManager: messageHistory, config, modelMa
67
67
  // Handle action selection
68
68
  switch (action) {
69
69
  case "resume":
70
- messageHistory.restore(conversation);
70
+ sessionManager.restore(conversation);
71
71
  container.addChild(new Text(style.green(`Resuming conversation: ${conversation.title}`), 0, 1));
72
72
  setTerminalTitle(conversation.title || `acai: ${process.cwd()}`);
73
+ // Trigger TUI reconstruction to show restored conversation
74
+ tui.onReconstructSession?.();
73
75
  break;
74
76
  case "export":
75
77
  try {
@@ -227,29 +229,27 @@ class ConversationSelectorComponent extends Container {
227
229
  this.listContainer.addChild(new Text(style.gray(" No matching conversations"), 0, 0));
228
230
  }
229
231
  }
232
+ wantsNavigationKeys() {
233
+ return true;
234
+ }
230
235
  handleInput(keyData) {
231
- // Up arrow
232
- if (isArrowUp(keyData)) {
236
+ if (isArrowUp(keyData) || isShiftTab(keyData)) {
233
237
  this.selectedIndex = Math.max(0, this.selectedIndex - 1);
234
238
  this.updateList();
235
239
  }
236
- // Down arrow
237
- else if (isArrowDown(keyData)) {
240
+ else if (isArrowDown(keyData) || isTab(keyData)) {
238
241
  this.selectedIndex = Math.min(this.filteredConversations.length - 1, this.selectedIndex + 1);
239
242
  this.updateList();
240
243
  }
241
- // Enter
242
244
  else if (isEnter(keyData)) {
243
245
  const selectedConversation = this.filteredConversations[this.selectedIndex];
244
246
  if (selectedConversation) {
245
247
  this.handleSelect(selectedConversation);
246
248
  }
247
249
  }
248
- // Escape
249
250
  else if (isEscape(keyData)) {
250
251
  this.onCancelCallback();
251
252
  }
252
- // Pass everything else to search input
253
253
  else {
254
254
  this.searchInput.handleInput(keyData);
255
255
  this.filterConversations(this.searchInput.getValue());
@@ -308,18 +308,18 @@ class ActionSelectorComponent extends Container {
308
308
  // Add bottom border
309
309
  this.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
310
310
  }
311
+ wantsNavigationKeys() {
312
+ return true;
313
+ }
311
314
  handleInput(keyData) {
312
- // Up arrow
313
- if (isArrowUp(keyData)) {
315
+ if (isArrowUp(keyData) || isShiftTab(keyData)) {
314
316
  this.selectedIndex = Math.max(0, this.selectedIndex - 1);
315
317
  this.updateList();
316
318
  }
317
- // Down arrow
318
- else if (isArrowDown(keyData)) {
319
+ else if (isArrowDown(keyData) || isTab(keyData)) {
319
320
  this.selectedIndex = Math.min(2, this.selectedIndex + 1);
320
321
  this.updateList();
321
322
  }
322
- // Enter
323
323
  else if (isEnter(keyData)) {
324
324
  const actions = ["resume", "export", "summarize"];
325
325
  const selectedAction = actions[this.selectedIndex];
@@ -327,7 +327,6 @@ class ActionSelectorComponent extends Container {
327
327
  this.handleSelect(selectedAction);
328
328
  }
329
329
  }
330
- // Escape
331
330
  else if (isEscape(keyData)) {
332
331
  this.onCancelCallback();
333
332
  }
@@ -1,4 +1,41 @@
1
1
  import type { ModelMessage } from "ai";
2
+ export interface SessionTokenUsage {
3
+ total: {
4
+ inputTokens: number;
5
+ outputTokens: number;
6
+ totalTokens: number;
7
+ cachedInputTokens: number;
8
+ reasoningTokens: number;
9
+ estimatedCost: number;
10
+ };
11
+ lastTurn: {
12
+ inputTokens: number;
13
+ outputTokens: number;
14
+ totalTokens: number;
15
+ cachedInputTokens: number;
16
+ reasoningTokens: number;
17
+ estimatedCost: number;
18
+ };
19
+ }
20
+ export interface TokenUsageTurn {
21
+ stepIndex: number;
22
+ inputTokens: number;
23
+ outputTokens: number;
24
+ totalTokens: number;
25
+ cachedInputTokens: number;
26
+ reasoningTokens: number;
27
+ inputTokenDetails: {
28
+ noCacheTokens: number;
29
+ cacheReadTokens: number;
30
+ cacheWriteTokens: number;
31
+ };
32
+ outputTokenDetails: {
33
+ textTokens: number;
34
+ reasoningTokens: number;
35
+ };
36
+ timestamp: number;
37
+ estimatedCost: number;
38
+ }
2
39
  export interface ConversationHistory {
3
40
  title: string;
4
41
  createdAt: Date;
@@ -7,5 +44,6 @@ export interface ConversationHistory {
7
44
  sessionId: string;
8
45
  modelId: string;
9
46
  project: string;
47
+ tokenUsage?: SessionTokenUsage | TokenUsageTurn[];
10
48
  }
11
49
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/history/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAEvC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/history/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAGvC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE;QACL,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,QAAQ,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAGD,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,kBAAkB,EAAE;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,iBAAiB,GAAG,cAAc,EAAE,CAAC;CACnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/history/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAyFrE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/history/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAYjB;AA8DD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAkCrE"}
@@ -10,70 +10,75 @@ export async function exportConversation(history) {
10
10
  await writeFile(filename, markdownContent);
11
11
  return filename;
12
12
  }
13
+ function formatToolResultOutput(output) {
14
+ if (typeof output === "object" &&
15
+ output !== null &&
16
+ "type" in output &&
17
+ output.type === "text" &&
18
+ "text" in output) {
19
+ return ["```", String(output.text), "```"];
20
+ }
21
+ return ["```json", JSON.stringify(output, null, 2), "```"];
22
+ }
23
+ function formatMessagePart(part) {
24
+ if (part.type === "text" && part.text?.trim()) {
25
+ return [part.text, ""];
26
+ }
27
+ if (part.type === "tool-call") {
28
+ return [
29
+ `**Tool Call**: ${part.toolName}`,
30
+ `**Call ID**: ${part.toolCallId}`,
31
+ "**Input**:",
32
+ "```json",
33
+ JSON.stringify(part.input, null, 2),
34
+ "```",
35
+ "",
36
+ ];
37
+ }
38
+ if (part.type === "tool-result") {
39
+ return [
40
+ `**Tool Result**: ${part.toolName}`,
41
+ `**Call ID**: ${part.toolCallId}`,
42
+ "**Output**:",
43
+ ...formatToolResultOutput(part.output),
44
+ "",
45
+ ];
46
+ }
47
+ if (part.type === "tool-error") {
48
+ return [
49
+ `**Tool Error**: ${part.toolName}`,
50
+ `**Call ID**: ${part.toolCallId}`,
51
+ "**Error**:",
52
+ "```",
53
+ String(part.output),
54
+ "```",
55
+ "",
56
+ ];
57
+ }
58
+ return [];
59
+ }
13
60
  export function generateMarkdown(history) {
14
- const lines = [];
15
- // Header
16
- lines.push(`# ${history.title}`);
17
- lines.push("");
18
- lines.push("## Conversation Metadata");
19
- lines.push(`- **Session ID**: ${history.sessionId}`);
20
- lines.push(`- **Model**: ${history.modelId}`);
21
- lines.push(`- **Created**: ${history.createdAt.toISOString()}`);
22
- lines.push(`- **Last Updated**: ${history.updatedAt.toISOString()}`);
23
- lines.push(`- **Total Messages**: ${history.messages.length}`);
24
- lines.push("");
25
- // Messages
26
- lines.push("## Conversation History");
27
- lines.push("");
61
+ const lines = [
62
+ `# ${history.title}`,
63
+ "",
64
+ "## Conversation Metadata",
65
+ `- **Session ID**: ${history.sessionId}`,
66
+ `- **Model**: ${history.modelId}`,
67
+ `- **Created**: ${history.createdAt.toISOString()}`,
68
+ `- **Last Updated**: ${history.updatedAt.toISOString()}`,
69
+ `- **Total Messages**: ${history.messages.length}`,
70
+ "",
71
+ "## Conversation History",
72
+ "",
73
+ ];
28
74
  history.messages.forEach((message, index) => {
29
75
  const role = message.role.toUpperCase();
30
76
  lines.push(`### ${role} (Message ${index + 1})`);
31
77
  lines.push("");
32
78
  if (Array.isArray(message.content)) {
33
- message.content.forEach((part) => {
34
- if (part.type === "text" && part.text?.trim()) {
35
- lines.push(part.text);
36
- lines.push("");
37
- }
38
- else if (part.type === "tool-call") {
39
- lines.push(`**Tool Call**: ${part.toolName}`);
40
- lines.push(`**Call ID**: ${part.toolCallId}`);
41
- lines.push("**Input**:");
42
- lines.push("```json");
43
- lines.push(JSON.stringify(part.input, null, 2));
44
- lines.push("```");
45
- lines.push("");
46
- }
47
- else if (part.type === "tool-result") {
48
- lines.push(`**Tool Result**: ${part.toolName}`);
49
- lines.push(`**Call ID**: ${part.toolCallId}`);
50
- lines.push("**Output**:");
51
- if (typeof part.output === "object" &&
52
- part.output !== null &&
53
- "type" in part.output &&
54
- part.output.type === "text" &&
55
- "text" in part.output) {
56
- lines.push("```");
57
- lines.push(String(part.output.text));
58
- lines.push("```");
59
- }
60
- else {
61
- lines.push("```json");
62
- lines.push(JSON.stringify(part.output, null, 2));
63
- lines.push("```");
64
- }
65
- lines.push("");
66
- }
67
- else if (part.type === "tool-error") {
68
- lines.push(`**Tool Error**: ${part.toolName}`);
69
- lines.push(`**Call ID**: ${part.toolCallId}`);
70
- lines.push("**Error**:");
71
- lines.push("```");
72
- lines.push(String(part.output));
73
- lines.push("```");
74
- lines.push("");
75
- }
76
- });
79
+ for (const part of message.content) {
80
+ lines.push(...formatMessagePart(part));
81
+ }
77
82
  }
78
83
  else if (typeof message.content === "string" && message.content.trim()) {
79
84
  lines.push(message.content);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/init/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAqB/D,eAAO,MAAM,WAAW,GAAI,8BAGzB,cAAc,KAAG,WAiEnB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/init/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAqB/D,eAAO,MAAM,WAAW,GAAI,8BAGzB,cAAc,KAAG,WAsDnB,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { platform } from "node:os";
2
- import { stepCountIs, streamText, tool } from "ai";
2
+ import { stepCountIs, streamText } from "ai";
3
3
  import style from "../../terminal/style.js";
4
4
  import { initTools } from "../../tools/index.js";
5
+ import { toAiSdkTools } from "../../tools/utils.js";
5
6
  import { Markdown, Spacer, Text } from "../../tui/index.js";
6
7
  import { inGitDirectory } from "../../utils/git.js";
7
8
  const initPrompt = `Please analyze this codebase and create a AGENTS.md file containing:
@@ -38,13 +39,7 @@ export const initCommand = ({ modelManager, workspace, }) => {
38
39
  temperature: 0.5,
39
40
  prompt: initPrompt,
40
41
  stopWhen: stepCountIs(40),
41
- tools: Object.fromEntries(Object.entries(tools).map((t) => [
42
- t[0],
43
- tool({
44
- ...t[1]["toolDef"],
45
- execute: t[1]["execute"],
46
- }),
47
- ])),
42
+ tools: toAiSdkTools(tools),
48
43
  });
49
44
  container.addChild(new Spacer(1));
50
45
  let output = "";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/init-project/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO/D,eAAO,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,WAqF7D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/init-project/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO/D,eAAO,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,WAkF7D,CAAC"}
@@ -1,3 +1,4 @@
1
+ import path from "node:path";
1
2
  import { Spacer, Text } from "../../tui/index.js";
2
3
  import { ensureConfigFile, ensureProjectDirectory, isDevelopmentDirectory, } from "./utils.js";
3
4
  export const initProjectCommand = (_options) => {
@@ -14,7 +15,7 @@ export const initProjectCommand = (_options) => {
14
15
  editor.setText("");
15
16
  return "continue";
16
17
  }
17
- const projectDir = require("node:path").join(currentDir, ".acai");
18
+ const projectDir = path.join(currentDir, ".acai");
18
19
  const dirResult = ensureProjectDirectory(projectDir);
19
20
  const configResult = ensureConfigFile(projectDir);
20
21
  const created = [...dirResult.created, ...configResult.created];
@@ -40,9 +41,8 @@ export const initProjectCommand = (_options) => {
40
41
  }
41
42
  container.addChild(new Spacer(1));
42
43
  container.addChild(new Text("Project initialized successfully. You can now:", 1, 0));
43
- container.addChild(new Text(" • Add project-specific prompts to .acai/prompts/", 2, 0));
44
44
  container.addChild(new Text(" • Configure settings in .acai/acai.json", 2, 0));
45
- container.addChild(new Text(" • Add project skills to .acai/skills/", 2, 0));
45
+ container.addChild(new Text(" • Add project skills to .agents/skills/", 2, 0));
46
46
  tui.requestRender();
47
47
  editor.setText("");
48
48
  return "continue";
@@ -1,9 +1,10 @@
1
1
  export declare const DEVELOPMENT_DIRECTORY = "/Users/travisennis/Github/acai-ts";
2
- export interface InitializationResult {
2
+ interface InitializationResult {
3
3
  created: string[];
4
4
  existing: string[];
5
5
  }
6
6
  export declare function ensureProjectDirectory(projectDir: string): InitializationResult;
7
7
  export declare function ensureConfigFile(projectDir: string): InitializationResult;
8
8
  export declare function isDevelopmentDirectory(dir: string): boolean;
9
+ export {};
9
10
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/init-project/utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,sCAAsC,CAAC;AAEzE,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,GACjB,oBAAoB,CAuBtB;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAazE;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE3D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/init-project/utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,sCAAsC,CAAC;AAEzE,UAAU,oBAAoB;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,GACjB,oBAAoB,CAmCtB;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAazE;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE3D"}
@@ -1,6 +1,6 @@
1
1
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
2
  import path from "node:path";
3
- import { defaultConfig } from "../../config.js";
3
+ import { defaultConfig } from "../../config/index.js";
4
4
  export const DEVELOPMENT_DIRECTORY = "/Users/travisennis/Github/acai-ts";
5
5
  export function ensureProjectDirectory(projectDir) {
6
6
  const created = [];
@@ -12,7 +12,7 @@ export function ensureProjectDirectory(projectDir) {
12
12
  else {
13
13
  existing.push(".acai/");
14
14
  }
15
- const subdirs = ["prompts", "rules", "skills"];
15
+ const subdirs = ["rules"];
16
16
  for (const subdir of subdirs) {
17
17
  const dirPath = path.join(projectDir, subdir);
18
18
  if (!existsSync(dirPath)) {
@@ -23,6 +23,14 @@ export function ensureProjectDirectory(projectDir) {
23
23
  existing.push(`.acai/${subdir}/`);
24
24
  }
25
25
  }
26
+ const agentsSkillsDir = path.join(path.dirname(projectDir), ".agents", "skills");
27
+ if (!existsSync(agentsSkillsDir)) {
28
+ mkdirSync(agentsSkillsDir, { recursive: true });
29
+ created.push(".agents/skills/");
30
+ }
31
+ else {
32
+ existing.push(".agents/skills/");
33
+ }
26
34
  return { created, existing };
27
35
  }
28
36
  export function ensureConfigFile(projectDir) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/list-tools/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAoHrE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/list-tools/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAyFrE"}