@travisennis/acai 0.0.7 → 0.0.9

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 (486) hide show
  1. package/README.md +76 -27
  2. package/dist/agent/index.d.ts +21 -25
  3. package/dist/agent/index.d.ts.map +1 -1
  4. package/dist/agent/index.js +145 -103
  5. package/dist/cli.d.ts +2 -2
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +23 -17
  8. package/dist/commands/add-directory/index.d.ts +3 -0
  9. package/dist/commands/add-directory/index.d.ts.map +1 -0
  10. package/dist/commands/{add-directory-command.js → add-directory/index.js} +6 -10
  11. package/dist/commands/add-directory/types.d.ts +6 -0
  12. package/dist/commands/add-directory/types.d.ts.map +1 -0
  13. package/dist/commands/add-directory/types.js +1 -0
  14. package/dist/commands/add-directory/utils.d.ts +3 -0
  15. package/dist/commands/add-directory/utils.d.ts.map +1 -0
  16. package/dist/commands/add-directory/utils.js +15 -0
  17. package/dist/commands/clear/index.d.ts +3 -0
  18. package/dist/commands/clear/index.d.ts.map +1 -0
  19. package/dist/commands/{clear-command.js → clear/index.js} +0 -2
  20. package/dist/commands/copy/index.d.ts +3 -0
  21. package/dist/commands/copy/index.d.ts.map +1 -0
  22. package/dist/commands/{copy-command.js → copy/index.js} +4 -26
  23. package/dist/commands/copy/types.d.ts +3 -0
  24. package/dist/commands/copy/types.d.ts.map +1 -0
  25. package/dist/commands/copy/types.js +1 -0
  26. package/dist/commands/copy/utils.d.ts +3 -0
  27. package/dist/commands/copy/utils.d.ts.map +1 -0
  28. package/dist/commands/copy/utils.js +22 -0
  29. package/dist/commands/{exit-command.d.ts → exit/index.d.ts} +4 -4
  30. package/dist/commands/exit/index.d.ts.map +1 -0
  31. package/dist/commands/exit/index.js +21 -0
  32. package/dist/commands/exit/types.d.ts +8 -0
  33. package/dist/commands/exit/types.d.ts.map +1 -0
  34. package/dist/commands/exit/types.js +1 -0
  35. package/dist/commands/exit/utils.d.ts +2 -0
  36. package/dist/commands/exit/utils.d.ts.map +1 -0
  37. package/dist/commands/exit/utils.js +13 -0
  38. package/dist/commands/generate-rules/index.d.ts +3 -0
  39. package/dist/commands/generate-rules/index.d.ts.map +1 -0
  40. package/dist/commands/{generate-rules-command.js → generate-rules/index.js} +57 -96
  41. package/dist/commands/generate-rules/utils.d.ts +5 -0
  42. package/dist/commands/generate-rules/utils.d.ts.map +1 -0
  43. package/dist/commands/generate-rules/utils.js +25 -0
  44. package/dist/commands/handoff/index.d.ts +3 -0
  45. package/dist/commands/handoff/index.d.ts.map +1 -0
  46. package/dist/commands/handoff/index.js +97 -0
  47. package/dist/commands/handoff/utils.d.ts +4 -0
  48. package/dist/commands/handoff/utils.d.ts.map +1 -0
  49. package/dist/commands/{handoff-command.js → handoff/utils.js} +24 -92
  50. package/dist/commands/health/index.d.ts +3 -0
  51. package/dist/commands/health/index.d.ts.map +1 -0
  52. package/dist/commands/health/index.js +56 -0
  53. package/dist/commands/health/utils.d.ts +15 -0
  54. package/dist/commands/health/utils.d.ts.map +1 -0
  55. package/dist/commands/health/utils.js +52 -0
  56. package/dist/commands/{help-command.d.ts → help/index.d.ts} +2 -2
  57. package/dist/commands/help/index.d.ts.map +1 -0
  58. package/dist/commands/{help-command.js → help/index.js} +1 -1
  59. package/dist/commands/history/index.d.ts +3 -0
  60. package/dist/commands/history/index.d.ts.map +1 -0
  61. package/dist/commands/{history-command.js → history/index.js} +16 -100
  62. package/dist/commands/history/types.d.ts +11 -0
  63. package/dist/commands/history/types.d.ts.map +1 -0
  64. package/dist/commands/history/types.js +1 -0
  65. package/dist/commands/history/utils.d.ts +4 -0
  66. package/dist/commands/history/utils.d.ts.map +1 -0
  67. package/dist/commands/history/utils.js +86 -0
  68. package/dist/commands/init/index.d.ts +3 -0
  69. package/dist/commands/init/index.d.ts.map +1 -0
  70. package/dist/commands/{init-command.js → init/index.js} +16 -7
  71. package/dist/commands/init-project/index.d.ts +3 -0
  72. package/dist/commands/init-project/index.d.ts.map +1 -0
  73. package/dist/commands/init-project/index.js +51 -0
  74. package/dist/commands/init-project/utils.d.ts +9 -0
  75. package/dist/commands/init-project/utils.d.ts.map +1 -0
  76. package/dist/commands/init-project/utils.js +43 -0
  77. package/dist/commands/list-directories/index.d.ts +3 -0
  78. package/dist/commands/list-directories/index.d.ts.map +1 -0
  79. package/dist/commands/{list-directories-command.js → list-directories/index.js} +1 -1
  80. package/dist/commands/list-tools/index.d.ts +3 -0
  81. package/dist/commands/list-tools/index.d.ts.map +1 -0
  82. package/dist/commands/{list-tools-command.js → list-tools/index.js} +4 -16
  83. package/dist/commands/manager.d.ts +2 -2
  84. package/dist/commands/manager.d.ts.map +1 -1
  85. package/dist/commands/manager.js +35 -43
  86. package/dist/commands/model/index.d.ts +3 -0
  87. package/dist/commands/model/index.d.ts.map +1 -0
  88. package/dist/commands/{model-command.js → model/index.js} +15 -52
  89. package/dist/commands/model/utils.d.ts +3 -0
  90. package/dist/commands/model/utils.d.ts.map +1 -0
  91. package/dist/commands/model/utils.js +5 -0
  92. package/dist/commands/{paste-command.d.ts → paste/index.d.ts} +2 -2
  93. package/dist/commands/paste/index.d.ts.map +1 -0
  94. package/dist/commands/{paste-command.js → paste/index.js} +6 -111
  95. package/dist/commands/paste/utils.d.ts +5 -0
  96. package/dist/commands/paste/utils.d.ts.map +1 -0
  97. package/dist/commands/paste/utils.js +86 -0
  98. package/dist/commands/pickup/index.d.ts +3 -0
  99. package/dist/commands/pickup/index.d.ts.map +1 -0
  100. package/dist/commands/pickup/index.js +138 -0
  101. package/dist/commands/pickup/types.d.ts +6 -0
  102. package/dist/commands/pickup/types.d.ts.map +1 -0
  103. package/dist/commands/pickup/types.js +1 -0
  104. package/dist/commands/pickup/utils.d.ts +7 -0
  105. package/dist/commands/pickup/utils.d.ts.map +1 -0
  106. package/dist/commands/pickup/utils.js +56 -0
  107. package/dist/commands/prompt/index.d.ts +5 -0
  108. package/dist/commands/prompt/index.d.ts.map +1 -0
  109. package/dist/commands/prompt/index.js +122 -0
  110. package/dist/commands/prompt/types.d.ts +15 -0
  111. package/dist/commands/prompt/types.d.ts.map +1 -0
  112. package/dist/commands/prompt/types.js +1 -0
  113. package/dist/commands/prompt/utils.d.ts +12 -0
  114. package/dist/commands/prompt/utils.d.ts.map +1 -0
  115. package/dist/commands/prompt/utils.js +107 -0
  116. package/dist/commands/remove-directory/index.d.ts +3 -0
  117. package/dist/commands/remove-directory/index.d.ts.map +1 -0
  118. package/dist/commands/{remove-directory-command.js → remove-directory/index.js} +2 -2
  119. package/dist/commands/reset/index.d.ts +3 -0
  120. package/dist/commands/reset/index.d.ts.map +1 -0
  121. package/dist/commands/{reset-command.js → reset/index.js} +7 -2
  122. package/dist/commands/reset/types.d.ts +1 -0
  123. package/dist/commands/reset/types.d.ts.map +1 -0
  124. package/dist/commands/reset/types.js +3 -0
  125. package/dist/commands/resources/index.d.ts +3 -0
  126. package/dist/commands/resources/index.d.ts.map +1 -0
  127. package/dist/commands/resources/index.js +84 -0
  128. package/dist/commands/review/index.d.ts +3 -0
  129. package/dist/commands/review/index.d.ts.map +1 -0
  130. package/dist/commands/review/index.js +126 -0
  131. package/dist/commands/review/types.d.ts +12 -0
  132. package/dist/commands/review/types.d.ts.map +1 -0
  133. package/dist/commands/review/types.js +1 -0
  134. package/dist/commands/review/utils.d.ts +4 -0
  135. package/dist/commands/review/utils.d.ts.map +1 -0
  136. package/dist/commands/review/utils.js +87 -0
  137. package/dist/commands/save/index.d.ts +3 -0
  138. package/dist/commands/save/index.d.ts.map +1 -0
  139. package/dist/commands/{save-command.js → save/index.js} +3 -3
  140. package/dist/commands/session/index.d.ts +3 -0
  141. package/dist/commands/session/index.d.ts.map +1 -0
  142. package/dist/commands/session/index.js +230 -0
  143. package/dist/commands/session/types.d.ts +20 -0
  144. package/dist/commands/session/types.d.ts.map +1 -0
  145. package/dist/commands/session/types.js +7 -0
  146. package/dist/commands/share/html-renderer.d.ts +25 -0
  147. package/dist/commands/share/html-renderer.d.ts.map +1 -0
  148. package/dist/commands/share/html-renderer.js +384 -0
  149. package/dist/commands/share/index.d.ts +3 -0
  150. package/dist/commands/share/index.d.ts.map +1 -0
  151. package/dist/commands/share/index.js +122 -0
  152. package/dist/commands/shell/index.d.ts +3 -0
  153. package/dist/commands/shell/index.d.ts.map +1 -0
  154. package/dist/commands/{shell-command.js → shell/index.js} +3 -3
  155. package/dist/commands/types.d.ts +2 -2
  156. package/dist/commands/types.d.ts.map +1 -1
  157. package/dist/config.d.ts +25 -7
  158. package/dist/config.d.ts.map +1 -1
  159. package/dist/config.js +45 -20
  160. package/dist/dedent.d.ts.map +1 -1
  161. package/dist/dedent.js +7 -7
  162. package/dist/execution/index.d.ts +1 -0
  163. package/dist/execution/index.d.ts.map +1 -1
  164. package/dist/execution/index.js +60 -64
  165. package/dist/formatting.d.ts +27 -0
  166. package/dist/formatting.d.ts.map +1 -1
  167. package/dist/formatting.js +40 -0
  168. package/dist/index.d.ts.map +1 -1
  169. package/dist/index.js +194 -95
  170. package/dist/logger.d.ts.map +1 -1
  171. package/dist/logger.js +4 -11
  172. package/dist/mentions.d.ts.map +1 -1
  173. package/dist/mentions.js +3 -53
  174. package/dist/middleware/audit-message.d.ts +2 -2
  175. package/dist/middleware/audit-message.d.ts.map +1 -1
  176. package/dist/middleware/audit-message.js +40 -2
  177. package/dist/middleware/cache.d.ts +2 -2
  178. package/dist/middleware/cache.d.ts.map +1 -1
  179. package/dist/middleware/cache.js +111 -27
  180. package/dist/middleware/rate-limit.d.ts +2 -2
  181. package/dist/middleware/rate-limit.d.ts.map +1 -1
  182. package/dist/middleware/rate-limit.js +1 -0
  183. package/dist/models/ai-config.d.ts.map +1 -1
  184. package/dist/models/ai-config.js +46 -29
  185. package/dist/models/anthropic-provider.d.ts +14 -13
  186. package/dist/models/anthropic-provider.d.ts.map +1 -1
  187. package/dist/models/deepseek-provider.d.ts +9 -8
  188. package/dist/models/deepseek-provider.d.ts.map +1 -1
  189. package/dist/models/google-provider.d.ts +10 -9
  190. package/dist/models/google-provider.d.ts.map +1 -1
  191. package/dist/models/groq-provider.d.ts +8 -7
  192. package/dist/models/groq-provider.d.ts.map +1 -1
  193. package/dist/models/manager.d.ts +7 -4
  194. package/dist/models/manager.d.ts.map +1 -1
  195. package/dist/models/manager.js +5 -25
  196. package/dist/models/openai-provider.d.ts +14 -10
  197. package/dist/models/openai-provider.d.ts.map +1 -1
  198. package/dist/models/openai-provider.js +39 -0
  199. package/dist/models/opencode-zen-provider.d.ts +24 -0
  200. package/dist/models/opencode-zen-provider.d.ts.map +1 -0
  201. package/dist/models/opencode-zen-provider.js +94 -0
  202. package/dist/models/openrouter-provider.d.ts +35 -29
  203. package/dist/models/openrouter-provider.d.ts.map +1 -1
  204. package/dist/models/openrouter-provider.js +108 -80
  205. package/dist/models/providers.d.ts +4 -4
  206. package/dist/models/providers.d.ts.map +1 -1
  207. package/dist/models/providers.js +7 -1
  208. package/dist/models/xai-provider.d.ts +9 -8
  209. package/dist/models/xai-provider.d.ts.map +1 -1
  210. package/dist/prompts/manager.d.ts +1 -1
  211. package/dist/prompts/manager.d.ts.map +1 -1
  212. package/dist/prompts/manager.js +1 -1
  213. package/dist/prompts.d.ts +12 -2
  214. package/dist/prompts.d.ts.map +1 -1
  215. package/dist/prompts.js +74 -411
  216. package/dist/repl/project-status.d.ts +19 -0
  217. package/dist/repl/project-status.d.ts.map +1 -0
  218. package/dist/repl/project-status.js +78 -0
  219. package/dist/repl-new.d.ts +18 -4
  220. package/dist/repl-new.d.ts.map +1 -1
  221. package/dist/repl-new.js +256 -43
  222. package/dist/{messages.d.ts → sessions/manager.d.ts} +10 -4
  223. package/dist/sessions/manager.d.ts.map +1 -0
  224. package/dist/{messages.js → sessions/manager.js} +62 -14
  225. package/dist/skills.d.ts +0 -4
  226. package/dist/skills.d.ts.map +1 -1
  227. package/dist/skills.js +100 -59
  228. package/dist/stdin.d.ts +9 -0
  229. package/dist/stdin.d.ts.map +1 -0
  230. package/dist/stdin.js +26 -0
  231. package/dist/terminal/control.d.ts +1 -0
  232. package/dist/terminal/control.d.ts.map +1 -1
  233. package/dist/terminal/control.js +29 -6
  234. package/dist/terminal/formatting.d.ts +1 -2
  235. package/dist/terminal/formatting.d.ts.map +1 -1
  236. package/dist/terminal/formatting.js +1 -2
  237. package/dist/terminal/keys.d.ts +211 -0
  238. package/dist/terminal/keys.d.ts.map +1 -0
  239. package/dist/terminal/keys.js +546 -0
  240. package/dist/terminal/segmenter.d.ts +6 -0
  241. package/dist/terminal/segmenter.d.ts.map +1 -0
  242. package/dist/terminal/segmenter.js +11 -0
  243. package/dist/terminal/select-prompt.d.ts.map +1 -1
  244. package/dist/terminal/select-prompt.js +9 -21
  245. package/dist/terminal/string-width.d.ts.map +1 -1
  246. package/dist/terminal/string-width.js +40 -21
  247. package/dist/terminal/strip-ansi.d.ts.map +1 -1
  248. package/dist/terminal/strip-ansi.js +9 -15
  249. package/dist/tokens/tracker.d.ts.map +1 -1
  250. package/dist/tokens/tracker.js +58 -16
  251. package/dist/tools/bash.d.ts +9 -11
  252. package/dist/tools/bash.d.ts.map +1 -1
  253. package/dist/tools/bash.js +104 -123
  254. package/dist/tools/directory-tree.d.ts +9 -7
  255. package/dist/tools/directory-tree.d.ts.map +1 -1
  256. package/dist/tools/directory-tree.js +89 -70
  257. package/dist/tools/dynamic-tool-loader.d.ts +22 -4
  258. package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
  259. package/dist/tools/dynamic-tool-loader.js +39 -44
  260. package/dist/tools/edit-file.d.ts +6 -16
  261. package/dist/tools/edit-file.d.ts.map +1 -1
  262. package/dist/tools/edit-file.js +19 -76
  263. package/dist/tools/glob.d.ts +15 -16
  264. package/dist/tools/glob.d.ts.map +1 -1
  265. package/dist/tools/glob.js +77 -119
  266. package/dist/tools/grep.d.ts +19 -22
  267. package/dist/tools/grep.d.ts.map +1 -1
  268. package/dist/tools/grep.js +61 -108
  269. package/dist/tools/index.d.ts +200 -179
  270. package/dist/tools/index.d.ts.map +1 -1
  271. package/dist/tools/index.js +17 -315
  272. package/dist/tools/ls.d.ts +26 -0
  273. package/dist/tools/ls.d.ts.map +1 -0
  274. package/dist/tools/ls.js +80 -0
  275. package/dist/tools/read-file.d.ts +15 -15
  276. package/dist/tools/read-file.d.ts.map +1 -1
  277. package/dist/tools/read-file.js +49 -82
  278. package/dist/tools/save-file.d.ts +4 -4
  279. package/dist/tools/save-file.d.ts.map +1 -1
  280. package/dist/tools/save-file.js +37 -66
  281. package/dist/tools/think.d.ts +4 -4
  282. package/dist/tools/think.d.ts.map +1 -1
  283. package/dist/tools/think.js +9 -38
  284. package/dist/tools/types.d.ts +5 -25
  285. package/dist/tools/types.d.ts.map +1 -1
  286. package/dist/tools/types.js +0 -9
  287. package/dist/tui/autocomplete/attachment-provider.d.ts +18 -0
  288. package/dist/tui/autocomplete/attachment-provider.d.ts.map +1 -0
  289. package/dist/tui/autocomplete/attachment-provider.js +159 -0
  290. package/dist/tui/autocomplete/base-provider.d.ts +17 -0
  291. package/dist/tui/autocomplete/base-provider.d.ts.map +1 -0
  292. package/dist/tui/autocomplete/base-provider.js +1 -0
  293. package/dist/tui/autocomplete/combined-provider.d.ts +20 -0
  294. package/dist/tui/autocomplete/combined-provider.d.ts.map +1 -0
  295. package/dist/tui/autocomplete/combined-provider.js +61 -0
  296. package/dist/tui/autocomplete/command-provider.d.ts +20 -0
  297. package/dist/tui/autocomplete/command-provider.d.ts.map +1 -0
  298. package/dist/tui/autocomplete/command-provider.js +90 -0
  299. package/dist/tui/autocomplete/file-search-provider.d.ts +16 -0
  300. package/dist/tui/autocomplete/file-search-provider.d.ts.map +1 -0
  301. package/dist/tui/autocomplete/file-search-provider.js +123 -0
  302. package/dist/tui/autocomplete/path-provider.d.ts +21 -0
  303. package/dist/tui/autocomplete/path-provider.d.ts.map +1 -0
  304. package/dist/tui/autocomplete/path-provider.js +164 -0
  305. package/dist/tui/autocomplete/utils.d.ts +16 -0
  306. package/dist/tui/autocomplete/utils.d.ts.map +1 -0
  307. package/dist/tui/autocomplete/utils.js +137 -0
  308. package/dist/tui/autocomplete.d.ts +12 -43
  309. package/dist/tui/autocomplete.d.ts.map +1 -1
  310. package/dist/tui/autocomplete.js +20 -465
  311. package/dist/tui/components/box.d.ts.map +1 -1
  312. package/dist/tui/components/box.js +16 -10
  313. package/dist/tui/components/editor.d.ts +6 -2
  314. package/dist/tui/components/editor.d.ts.map +1 -1
  315. package/dist/tui/components/editor.js +166 -107
  316. package/dist/tui/components/footer.d.ts +20 -7
  317. package/dist/tui/components/footer.d.ts.map +1 -1
  318. package/dist/tui/components/footer.js +89 -196
  319. package/dist/tui/components/input.d.ts.map +1 -1
  320. package/dist/tui/components/input.js +8 -7
  321. package/dist/tui/components/loader.d.ts +2 -1
  322. package/dist/tui/components/loader.d.ts.map +1 -1
  323. package/dist/tui/components/loader.js +7 -2
  324. package/dist/tui/components/markdown.d.ts +5 -4
  325. package/dist/tui/components/markdown.d.ts.map +1 -1
  326. package/dist/tui/components/markdown.js +51 -40
  327. package/dist/tui/components/modal.d.ts.map +1 -1
  328. package/dist/tui/components/modal.js +9 -8
  329. package/dist/tui/components/notification.d.ts +28 -0
  330. package/dist/tui/components/notification.d.ts.map +1 -0
  331. package/dist/tui/components/notification.js +64 -0
  332. package/dist/tui/components/progress-bar.d.ts.map +1 -1
  333. package/dist/tui/components/progress-bar.js +3 -15
  334. package/dist/tui/components/select-list.d.ts +0 -15
  335. package/dist/tui/components/select-list.d.ts.map +1 -1
  336. package/dist/tui/components/select-list.js +5 -28
  337. package/dist/tui/components/tool-execution.d.ts +3 -6
  338. package/dist/tui/components/tool-execution.d.ts.map +1 -1
  339. package/dist/tui/components/tool-execution.js +26 -38
  340. package/dist/tui/components/welcome.d.ts +8 -1
  341. package/dist/tui/components/welcome.d.ts.map +1 -1
  342. package/dist/tui/components/welcome.js +45 -6
  343. package/dist/tui/editor-launcher.d.ts +13 -0
  344. package/dist/tui/editor-launcher.d.ts.map +1 -0
  345. package/dist/tui/editor-launcher.js +39 -0
  346. package/dist/tui/index.d.ts +7 -3
  347. package/dist/tui/index.d.ts.map +1 -1
  348. package/dist/tui/index.js +3 -2
  349. package/dist/tui/terminal.d.ts +29 -2
  350. package/dist/tui/terminal.d.ts.map +1 -1
  351. package/dist/tui/terminal.js +153 -28
  352. package/dist/tui/tui.d.ts +2 -0
  353. package/dist/tui/tui.d.ts.map +1 -1
  354. package/dist/tui/tui.js +39 -29
  355. package/dist/tui/utils.d.ts.map +1 -1
  356. package/dist/tui/utils.js +2 -3
  357. package/dist/utils/filesystem/security.d.ts.map +1 -1
  358. package/dist/utils/filesystem/security.js +4 -1
  359. package/dist/utils/yaml.d.ts +11 -0
  360. package/dist/utils/yaml.d.ts.map +1 -0
  361. package/dist/utils/yaml.js +207 -0
  362. package/dist/utils/zod.d.ts +1 -0
  363. package/dist/utils/zod.d.ts.map +1 -1
  364. package/dist/utils/zod.js +17 -0
  365. package/package.json +31 -29
  366. package/bin/acai-wrapper.js +0 -26
  367. package/dist/api/exa/index.d.ts +0 -177
  368. package/dist/api/exa/index.d.ts.map +0 -1
  369. package/dist/api/exa/index.js +0 -439
  370. package/dist/commands/add-directory-command.d.ts +0 -3
  371. package/dist/commands/add-directory-command.d.ts.map +0 -1
  372. package/dist/commands/application-log-command.d.ts +0 -3
  373. package/dist/commands/application-log-command.d.ts.map +0 -1
  374. package/dist/commands/application-log-command.js +0 -43
  375. package/dist/commands/clear-command.d.ts +0 -3
  376. package/dist/commands/clear-command.d.ts.map +0 -1
  377. package/dist/commands/compact-command.d.ts +0 -3
  378. package/dist/commands/compact-command.d.ts.map +0 -1
  379. package/dist/commands/compact-command.js +0 -55
  380. package/dist/commands/context-command.d.ts +0 -3
  381. package/dist/commands/context-command.d.ts.map +0 -1
  382. package/dist/commands/context-command.js +0 -124
  383. package/dist/commands/copy-command.d.ts +0 -3
  384. package/dist/commands/copy-command.d.ts.map +0 -1
  385. package/dist/commands/edit-command.d.ts +0 -3
  386. package/dist/commands/edit-command.d.ts.map +0 -1
  387. package/dist/commands/edit-command.js +0 -42
  388. package/dist/commands/edit-prompt-command.d.ts +0 -3
  389. package/dist/commands/edit-prompt-command.d.ts.map +0 -1
  390. package/dist/commands/edit-prompt-command.js +0 -36
  391. package/dist/commands/exit-command.d.ts.map +0 -1
  392. package/dist/commands/exit-command.js +0 -30
  393. package/dist/commands/files-command.d.ts +0 -3
  394. package/dist/commands/files-command.d.ts.map +0 -1
  395. package/dist/commands/files-command.js +0 -68
  396. package/dist/commands/generate-rules-command.d.ts +0 -3
  397. package/dist/commands/generate-rules-command.d.ts.map +0 -1
  398. package/dist/commands/handoff-command.d.ts +0 -3
  399. package/dist/commands/handoff-command.d.ts.map +0 -1
  400. package/dist/commands/health-command.d.ts +0 -4
  401. package/dist/commands/health-command.d.ts.map +0 -1
  402. package/dist/commands/health-command.js +0 -118
  403. package/dist/commands/help-command.d.ts.map +0 -1
  404. package/dist/commands/history-command.d.ts +0 -3
  405. package/dist/commands/history-command.d.ts.map +0 -1
  406. package/dist/commands/init-command.d.ts +0 -3
  407. package/dist/commands/init-command.d.ts.map +0 -1
  408. package/dist/commands/last-log-command.d.ts +0 -3
  409. package/dist/commands/last-log-command.d.ts.map +0 -1
  410. package/dist/commands/last-log-command.js +0 -71
  411. package/dist/commands/list-directories-command.d.ts +0 -3
  412. package/dist/commands/list-directories-command.d.ts.map +0 -1
  413. package/dist/commands/list-tools-command.d.ts +0 -3
  414. package/dist/commands/list-tools-command.d.ts.map +0 -1
  415. package/dist/commands/model-command.d.ts +0 -3
  416. package/dist/commands/model-command.d.ts.map +0 -1
  417. package/dist/commands/paste-command.d.ts.map +0 -1
  418. package/dist/commands/pickup-command.d.ts +0 -3
  419. package/dist/commands/pickup-command.d.ts.map +0 -1
  420. package/dist/commands/pickup-command.js +0 -109
  421. package/dist/commands/prompt-command.d.ts +0 -21
  422. package/dist/commands/prompt-command.d.ts.map +0 -1
  423. package/dist/commands/prompt-command.js +0 -258
  424. package/dist/commands/remove-directory-command.d.ts +0 -3
  425. package/dist/commands/remove-directory-command.d.ts.map +0 -1
  426. package/dist/commands/reset-command.d.ts +0 -3
  427. package/dist/commands/reset-command.d.ts.map +0 -1
  428. package/dist/commands/rules-command.d.ts +0 -3
  429. package/dist/commands/rules-command.d.ts.map +0 -1
  430. package/dist/commands/rules-command.js +0 -73
  431. package/dist/commands/save-command.d.ts +0 -3
  432. package/dist/commands/save-command.d.ts.map +0 -1
  433. package/dist/commands/shell-command.d.ts +0 -3
  434. package/dist/commands/shell-command.d.ts.map +0 -1
  435. package/dist/commands/usage-command.d.ts +0 -3
  436. package/dist/commands/usage-command.d.ts.map +0 -1
  437. package/dist/commands/usage-command.js +0 -31
  438. package/dist/messages.d.ts.map +0 -1
  439. package/dist/repl/project-status-line.d.ts +0 -3
  440. package/dist/repl/project-status-line.d.ts.map +0 -1
  441. package/dist/repl/project-status-line.js +0 -61
  442. package/dist/repl/tool-call-repair.d.ts +0 -4
  443. package/dist/repl/tool-call-repair.d.ts.map +0 -1
  444. package/dist/repl/tool-call-repair.js +0 -54
  445. package/dist/terminal/markdown.d.ts +0 -2
  446. package/dist/terminal/markdown.d.ts.map +0 -1
  447. package/dist/terminal/markdown.js +0 -120
  448. package/dist/tokens/threshold.d.ts +0 -20
  449. package/dist/tokens/threshold.d.ts.map +0 -1
  450. package/dist/tokens/threshold.js +0 -67
  451. package/dist/tools/advanced-edit-file.d.ts +0 -69
  452. package/dist/tools/advanced-edit-file.d.ts.map +0 -1
  453. package/dist/tools/advanced-edit-file.js +0 -285
  454. package/dist/tools/agent.d.ts +0 -29
  455. package/dist/tools/agent.d.ts.map +0 -1
  456. package/dist/tools/agent.js +0 -117
  457. package/dist/tools/batch.d.ts +0 -34
  458. package/dist/tools/batch.d.ts.map +0 -1
  459. package/dist/tools/batch.js +0 -174
  460. package/dist/tools/code-interpreter.d.ts +0 -25
  461. package/dist/tools/code-interpreter.d.ts.map +0 -1
  462. package/dist/tools/code-interpreter.js +0 -183
  463. package/dist/tools/delete-file.d.ts +0 -24
  464. package/dist/tools/delete-file.d.ts.map +0 -1
  465. package/dist/tools/delete-file.js +0 -77
  466. package/dist/tools/dynamic-tool-parser.d.ts +0 -21
  467. package/dist/tools/dynamic-tool-parser.d.ts.map +0 -1
  468. package/dist/tools/dynamic-tool-parser.js +0 -22
  469. package/dist/tools/llm-edit-fixer.d.ts +0 -24
  470. package/dist/tools/llm-edit-fixer.d.ts.map +0 -1
  471. package/dist/tools/llm-edit-fixer.js +0 -136
  472. package/dist/tools/move-file.d.ts +0 -26
  473. package/dist/tools/move-file.d.ts.map +0 -1
  474. package/dist/tools/move-file.js +0 -65
  475. package/dist/tools/read-multiple-files.d.ts +0 -26
  476. package/dist/tools/read-multiple-files.d.ts.map +0 -1
  477. package/dist/tools/read-multiple-files.js +0 -196
  478. package/dist/tools/web-fetch.d.ts +0 -56
  479. package/dist/tools/web-fetch.d.ts.map +0 -1
  480. package/dist/tools/web-fetch.js +0 -247
  481. package/dist/tools/web-search.d.ts +0 -23
  482. package/dist/tools/web-search.d.ts.map +0 -1
  483. package/dist/tools/web-search.js +0 -148
  484. package/dist/tui/components/prompt-status.d.ts +0 -17
  485. package/dist/tui/components/prompt-status.d.ts.map +0 -1
  486. package/dist/tui/components/prompt-status.js +0 -26
@@ -1,439 +0,0 @@
1
- import { isZodSchema, zodToJsonSchema } from "../../utils/zod.js";
2
- // Prefer global fetch/Headers from Node >= 18
3
- const fetchImpl = globalThis.fetch;
4
- const HeadersImpl = globalThis.Headers;
5
- /**
6
- * HTTP status codes
7
- */
8
- const HttpStatusCode = {
9
- badRequest: 400,
10
- notFound: 404,
11
- unauthorized: 401,
12
- forbidden: 403,
13
- tooManyRequests: 429,
14
- requestTimeout: 408,
15
- internalServerError: 500,
16
- serviceUnavailable: 503,
17
- };
18
- /**
19
- * Base error class for all Exa API errors
20
- */
21
- class ExaError extends Error {
22
- statusCode;
23
- timestamp;
24
- path;
25
- constructor(message, statusCode, timestamp, path) {
26
- super(message);
27
- this.name = "ExaError";
28
- this.statusCode = statusCode;
29
- this.timestamp = timestamp ?? new Date().toISOString();
30
- this.path = path;
31
- }
32
- }
33
- export default class Exa {
34
- baseUrl;
35
- headers;
36
- constructor(apiKey, baseUrl = "https://api.exa.ai") {
37
- this.baseUrl = baseUrl;
38
- let resolvedKey = apiKey;
39
- if (!resolvedKey) {
40
- resolvedKey = process.env["EXA_API_KEY"];
41
- if (!resolvedKey) {
42
- throw new ExaError("API key must be provided as an argument or as an environment variable (EXA_API_KEY)", HttpStatusCode.unauthorized);
43
- }
44
- }
45
- // Build base headers
46
- const headers = new HeadersImpl();
47
- headers.set("x-api-key", resolvedKey);
48
- headers.set("Content-Type", "application/json");
49
- headers.set("User-Agent", "acai-exa");
50
- // Store as a simple record for easier merging and type safety in this codebase
51
- const headerRecord = {};
52
- headers.forEach((value, key) => {
53
- headerRecord[key] = value;
54
- });
55
- this.headers = headerRecord;
56
- }
57
- extractContentsOptions(options) {
58
- const { text, highlights, summary, subpages, subpageTarget, extras, livecrawl, livecrawlTimeout, context, ...rest } = options;
59
- const contentsOptions = {};
60
- if (text === undefined &&
61
- summary === undefined &&
62
- highlights === undefined &&
63
- extras === undefined) {
64
- contentsOptions.text = true;
65
- }
66
- if (text !== undefined)
67
- contentsOptions.text = text;
68
- if (summary !== undefined) {
69
- if (typeof summary === "object" &&
70
- summary !== null &&
71
- "schema" in summary &&
72
- summary.schema &&
73
- isZodSchema(summary.schema)) {
74
- const { schema, ...restSummary } = summary;
75
- contentsOptions.summary = {
76
- ...restSummary,
77
- schema: zodToJsonSchema(schema),
78
- };
79
- }
80
- else {
81
- contentsOptions.summary = summary;
82
- }
83
- }
84
- if (highlights !== undefined)
85
- contentsOptions.highlights = highlights;
86
- if (subpages !== undefined)
87
- contentsOptions.subpages = subpages;
88
- if (subpageTarget !== undefined)
89
- contentsOptions.subpageTarget = subpageTarget;
90
- if (extras !== undefined)
91
- contentsOptions.extras = extras;
92
- if (livecrawl !== undefined)
93
- contentsOptions.livecrawl = livecrawl;
94
- if (livecrawlTimeout !== undefined)
95
- contentsOptions.livecrawlTimeout = livecrawlTimeout;
96
- if (context !== undefined)
97
- contentsOptions.context = context;
98
- return {
99
- contentsOptions,
100
- restOptions: rest,
101
- };
102
- }
103
- async request(endpoint, method, body, params, headers) {
104
- if (!fetchImpl) {
105
- throw new ExaError("Global fetch is not available in this environment.", HttpStatusCode.internalServerError);
106
- }
107
- let url = this.baseUrl + endpoint;
108
- if (params && Object.keys(params).length > 0) {
109
- const searchParams = new URLSearchParams();
110
- for (const [key, value] of Object.entries(params)) {
111
- if (Array.isArray(value)) {
112
- for (const item of value) {
113
- searchParams.append(key, String(item));
114
- }
115
- }
116
- else if (value !== undefined && value !== null) {
117
- searchParams.append(key, String(value));
118
- }
119
- }
120
- url += `?${searchParams.toString()}`;
121
- }
122
- const combinedHeaders = {
123
- ...this.headers,
124
- ...(headers ?? {}),
125
- };
126
- const response = await fetchImpl(url, {
127
- method,
128
- headers: combinedHeaders,
129
- body: body !== undefined ? JSON.stringify(body) : undefined,
130
- });
131
- if (!response.ok) {
132
- let errorMessage = `HTTP ${response.status}`;
133
- let errorTimestamp;
134
- let errorPath = endpoint;
135
- try {
136
- const errorData = await response.json();
137
- const message = (errorData &&
138
- (errorData.error || errorData.message));
139
- if (typeof message === "string" && message.length > 0) {
140
- errorMessage = message;
141
- }
142
- errorTimestamp =
143
- (errorData && errorData.timestamp) ??
144
- new Date().toISOString();
145
- errorPath =
146
- (errorData && errorData.path) ?? endpoint;
147
- }
148
- catch {
149
- // ignore body parse errors
150
- }
151
- throw new ExaError(errorMessage, response.status, errorTimestamp, errorPath);
152
- }
153
- const contentType = response.headers.get("content-type") || "";
154
- if (contentType.includes("text/event-stream")) {
155
- return (await this.parseSseStream(response));
156
- }
157
- return (await response.json());
158
- }
159
- async rawRequest(endpoint, method = "POST", body, queryParams) {
160
- if (!fetchImpl) {
161
- throw new ExaError("Global fetch is not available in this environment.", HttpStatusCode.internalServerError);
162
- }
163
- let url = this.baseUrl + endpoint;
164
- if (queryParams) {
165
- const searchParams = new URLSearchParams();
166
- for (const [key, value] of Object.entries(queryParams)) {
167
- if (Array.isArray(value)) {
168
- for (const item of value) {
169
- searchParams.append(key, String(item));
170
- }
171
- }
172
- else if (value !== undefined && value !== null) {
173
- searchParams.append(key, String(value));
174
- }
175
- }
176
- url += `?${searchParams.toString()}`;
177
- }
178
- const response = await fetchImpl(url, {
179
- method,
180
- headers: this.headers,
181
- body: body ? JSON.stringify(body) : undefined,
182
- });
183
- return response;
184
- }
185
- async search(query, options) {
186
- return await this.request("/search", "POST", { query, ...options });
187
- }
188
- async searchAndContents(query, options) {
189
- const { contentsOptions, restOptions } = options === undefined
190
- ? {
191
- contentsOptions: { text: true },
192
- restOptions: {},
193
- }
194
- : this.extractContentsOptions(options);
195
- return await this.request("/search", "POST", {
196
- query,
197
- contents: contentsOptions,
198
- ...restOptions,
199
- });
200
- }
201
- async findSimilar(url, options) {
202
- return await this.request("/findSimilar", "POST", { url, ...options });
203
- }
204
- async findSimilarAndContents(url, options) {
205
- const { contentsOptions, restOptions } = options === undefined
206
- ? {
207
- contentsOptions: { text: true },
208
- restOptions: {},
209
- }
210
- : this.extractContentsOptions(options);
211
- return await this.request("/findSimilar", "POST", {
212
- url,
213
- contents: contentsOptions,
214
- ...restOptions,
215
- });
216
- }
217
- async getContents(urls, options) {
218
- if (!urls || (Array.isArray(urls) && urls.length === 0)) {
219
- throw new ExaError("Must provide at least one URL", HttpStatusCode.badRequest);
220
- }
221
- let requestUrls;
222
- if (typeof urls === "string") {
223
- requestUrls = [urls];
224
- }
225
- else if (Array.isArray(urls) && typeof urls[0] === "string") {
226
- requestUrls = urls;
227
- }
228
- else {
229
- requestUrls = urls.map((result) => result.url);
230
- }
231
- const payload = {
232
- urls: requestUrls,
233
- ...(options ?? {}),
234
- };
235
- return await this.request("/contents", "POST", payload);
236
- }
237
- async answer(query, options) {
238
- if (options?.stream) {
239
- throw new ExaError("For streaming responses, please use streamAnswer() instead:\n\n" +
240
- "for await (const chunk of exa.streamAnswer(query)) {\n" +
241
- " // Handle chunks\n" +
242
- "}", HttpStatusCode.badRequest);
243
- }
244
- let outputSchema = options
245
- ?.outputSchema;
246
- if (outputSchema && isZodSchema(outputSchema)) {
247
- outputSchema = zodToJsonSchema(outputSchema);
248
- }
249
- const requestBody = {
250
- query,
251
- stream: false,
252
- text: options?.text ?? false,
253
- model: options?.model ?? "exa",
254
- systemPrompt: options
255
- ?.systemPrompt,
256
- outputSchema,
257
- userLocation: options
258
- ?.userLocation,
259
- };
260
- return await this.request("/answer", "POST", requestBody);
261
- }
262
- async *streamAnswer(query, options) {
263
- if (!fetchImpl) {
264
- throw new ExaError("Global fetch is not available in this environment.", HttpStatusCode.internalServerError);
265
- }
266
- let outputSchema = options?.outputSchema;
267
- if (outputSchema && isZodSchema(outputSchema)) {
268
- outputSchema = zodToJsonSchema(outputSchema);
269
- }
270
- const body = {
271
- query,
272
- text: options?.text ?? false,
273
- stream: true,
274
- model: options?.model ?? "exa",
275
- systemPrompt: options?.systemPrompt,
276
- outputSchema,
277
- };
278
- const response = await fetchImpl(`${this.baseUrl}/answer`, {
279
- method: "POST",
280
- headers: this.headers,
281
- body: JSON.stringify(body),
282
- });
283
- if (!response.ok) {
284
- const message = await response.text();
285
- throw new ExaError(message, response.status, new Date().toISOString());
286
- }
287
- const reader = response.body?.getReader();
288
- if (!reader) {
289
- throw new ExaError("No response body available for streaming.", 500, new Date().toISOString());
290
- }
291
- const decoder = new TextDecoder();
292
- let buffer = "";
293
- try {
294
- while (true) {
295
- const { done, value } = await reader.read();
296
- if (done)
297
- break;
298
- buffer += decoder.decode(value, { stream: true });
299
- const lines = buffer.split("\n");
300
- buffer = lines.pop() ?? "";
301
- for (const line of lines) {
302
- if (!line.startsWith("data: "))
303
- continue;
304
- const jsonStr = line.replace(/^data:\s*/, "").trim();
305
- if (!jsonStr || jsonStr === "[DONE]") {
306
- continue;
307
- }
308
- let chunkData;
309
- try {
310
- chunkData = JSON.parse(jsonStr);
311
- }
312
- catch {
313
- continue;
314
- }
315
- const chunk = this.processChunk(chunkData);
316
- if (chunk.content || chunk.citations) {
317
- yield chunk;
318
- }
319
- }
320
- }
321
- if (buffer.startsWith("data: ")) {
322
- const leftover = buffer.replace(/^data:\s*/, "").trim();
323
- if (leftover && leftover !== "[DONE]") {
324
- try {
325
- const chunkData = JSON.parse(leftover);
326
- const chunk = this.processChunk(chunkData);
327
- if (chunk.content || chunk.citations) {
328
- yield chunk;
329
- }
330
- }
331
- catch {
332
- // ignore
333
- }
334
- }
335
- }
336
- }
337
- finally {
338
- reader.releaseLock();
339
- }
340
- }
341
- processChunk(chunkData) {
342
- let content;
343
- let citations;
344
- const data = chunkData;
345
- const choices = data?.["choices"] ?? undefined;
346
- if (choices?.[0]?.delta) {
347
- const c = choices[0].delta.content;
348
- if (typeof c === "string") {
349
- content = c;
350
- }
351
- }
352
- const rawCitations = data?.["citations"];
353
- if (rawCitations &&
354
- rawCitations !== "null" &&
355
- Array.isArray(rawCitations)) {
356
- citations = rawCitations.map((c) => ({
357
- id: String(c["id"] ?? ""),
358
- url: String(c["url"] ?? ""),
359
- title: typeof c["title"] === "string"
360
- ? c["title"]
361
- : undefined,
362
- publishedDate: typeof c["publishedDate"] === "string"
363
- ? c["publishedDate"]
364
- : undefined,
365
- author: typeof c["author"] === "string"
366
- ? c["author"]
367
- : undefined,
368
- text: typeof c["text"] === "string"
369
- ? c["text"]
370
- : undefined,
371
- }));
372
- }
373
- return { content, citations };
374
- }
375
- async parseSseStream(response) {
376
- const reader = response.body?.getReader();
377
- if (!reader) {
378
- throw new ExaError("No response body available for streaming.", 500, new Date().toISOString());
379
- }
380
- const decoder = new TextDecoder();
381
- let buffer = "";
382
- return await new Promise((resolve, reject) => {
383
- (async () => {
384
- try {
385
- while (true) {
386
- const { done, value } = await reader.read();
387
- if (done)
388
- break;
389
- buffer += decoder.decode(value, { stream: true });
390
- const lines = buffer.split("\n");
391
- buffer = lines.pop() ?? "";
392
- for (const line of lines) {
393
- if (!line.startsWith("data: "))
394
- continue;
395
- const jsonStr = line.replace(/^data:\s*/, "").trim();
396
- if (!jsonStr || jsonStr === "[DONE]") {
397
- continue;
398
- }
399
- let chunk;
400
- try {
401
- chunk = JSON.parse(jsonStr);
402
- }
403
- catch {
404
- continue;
405
- }
406
- const tagged = chunk;
407
- switch (tagged.tag) {
408
- case "complete":
409
- reader.releaseLock();
410
- resolve(tagged.data);
411
- return;
412
- case "error": {
413
- const message = tagged.error?.message || "Unknown error";
414
- reader.releaseLock();
415
- reject(new ExaError(message, HttpStatusCode.internalServerError, new Date().toISOString()));
416
- return;
417
- }
418
- default:
419
- break;
420
- }
421
- }
422
- }
423
- reject(new ExaError("Stream ended without a completion event.", HttpStatusCode.internalServerError, new Date().toISOString()));
424
- }
425
- catch (err) {
426
- reject(err);
427
- }
428
- finally {
429
- try {
430
- reader.releaseLock();
431
- }
432
- catch {
433
- // ignore
434
- }
435
- }
436
- })();
437
- });
438
- }
439
- }
@@ -1,3 +0,0 @@
1
- import type { CommandOptions, ReplCommand } from "./types.ts";
2
- export declare const addDirectoryCommand: ({ workspace, }: CommandOptions) => ReplCommand;
3
- //# sourceMappingURL=add-directory-command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-directory-command.d.ts","sourceRoot":"","sources":["../../source/commands/add-directory-command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,mBAAmB,GAAI,gBAEjC,cAAc,KAAG,WA2FnB,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { CommandOptions, ReplCommand } from "./types.ts";
2
- export declare const applicationLogCommand: (_options: CommandOptions) => ReplCommand;
3
- //# sourceMappingURL=application-log-command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"application-log-command.d.ts","sourceRoot":"","sources":["../../source/commands/application-log-command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,qBAAqB,GAChC,UAAU,cAAc,KACvB,WAiFF,CAAC"}
@@ -1,43 +0,0 @@
1
- import { readFile } from "node:fs/promises";
2
- import { config } from "../config.js";
3
- import style from "../terminal/style.js";
4
- import { Text } from "../tui/index.js";
5
- export const applicationLogCommand = (_options) => {
6
- return {
7
- command: "/application-logs",
8
- description: "Opens the application log file defined in acai.json in the editor.",
9
- getSubCommands: () => Promise.resolve([]),
10
- async handle(_args, { tui, container, editor, }) {
11
- let logFilePath;
12
- try {
13
- const projectConfig = await config.getConfig();
14
- logFilePath = projectConfig.logs?.path;
15
- if (!logFilePath) {
16
- container.addChild(new Text(style.red("Application log path is not defined in .acai/acai.json under the 'logs.path' key."), 1, 0));
17
- tui.requestRender();
18
- editor.setText("");
19
- return "continue";
20
- }
21
- const content = await readFile(logFilePath, { encoding: "utf8" });
22
- // For TUI mode, we'll just display a message since we can't use the editor prompt
23
- container.addChild(new Text(`Viewing application log: ${style.blue(logFilePath)}`, 0, 1));
24
- container.addChild(new Text(`Content length: ${content.length} characters`, 2, 0));
25
- container.addChild(new Text(style.dim("Note: Full log viewing not available in TUI mode"), 3, 0));
26
- tui.requestRender();
27
- editor.setText("");
28
- return "continue";
29
- }
30
- catch (error) {
31
- if (logFilePath && error.code === "ENOENT") {
32
- container.addChild(new Text(style.red(`Application log file not found at: ${logFilePath}`), 1, 0));
33
- }
34
- else {
35
- container.addChild(new Text(style.red(`Error reading log file ${logFilePath ?? "specified in config"}: ${error}`), 1, 0));
36
- }
37
- tui.requestRender();
38
- editor.setText("");
39
- return "continue";
40
- }
41
- },
42
- };
43
- };
@@ -1,3 +0,0 @@
1
- import type { CommandOptions, ReplCommand } from "./types.ts";
2
- export declare const clearCommand: (_options: CommandOptions) => ReplCommand;
3
- //# sourceMappingURL=clear-command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clear-command.d.ts","sourceRoot":"","sources":["../../source/commands/clear-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,YAAY,GAAI,UAAU,cAAc,KAAG,WAqBvD,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { CommandOptions, ReplCommand } from "./types.ts";
2
- export declare const compactCommand: (options: CommandOptions) => ReplCommand;
3
- //# sourceMappingURL=compact-command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compact-command.d.ts","sourceRoot":"","sources":["../../source/commands/compact-command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,cAAc,GAAI,SAAS,cAAc,KAAG,WA6BxD,CAAC"}
@@ -1,55 +0,0 @@
1
- import { generateText } from "ai";
2
- import { createUserMessage } from "../messages.js";
3
- import style from "../terminal/style.js";
4
- import { Text } from "../tui/index.js";
5
- export const compactCommand = (options) => {
6
- return {
7
- command: "/compact",
8
- description: "Saves, summarizes, and resets the chat history. Optional instructions can be provided for the summary.",
9
- getSubCommands: () => Promise.resolve([]),
10
- async handle(args, { tui, container, editor, }) {
11
- const { messageHistory } = options;
12
- if (!messageHistory.isEmpty()) {
13
- const additionalInstructions = args.join(" ");
14
- await summarizeAndReset(options, additionalInstructions);
15
- }
16
- container.addChild(new Text(style.green("Message history summarized and reset."), 0, 1));
17
- tui.requestRender();
18
- editor.setText("");
19
- return "continue";
20
- },
21
- };
22
- };
23
- async function summarizeAndReset({ messageHistory, modelManager, tokenTracker }, additionalInstructions) {
24
- const app = "conversation-summarizer";
25
- // save existing message history
26
- await messageHistory.save();
27
- // summarize message history
28
- let userPrompt = `Your tasks is to provide a detailed summary of our conversation so far. Focus on information that would be helpful for continuing the conversation and the task, including what was the orginal task requested by the user, what we have done so far and why, which files we're working on, and what we're going to do next. Pay special attention to specific user feedback that you received, especially if the user told you to do something differently. You need to provide enough information that another coding agent can you use your summary to pick up where you have left off.
29
-
30
- Your summary should include the following sections:
31
- 1. Primary Request and Intent: Capture all of the user's explicit requests and intents in detail
32
- 2. Key Technical Concepts: List all important technical concepts, technologies, and frameworks discussed.
33
- 3. Files and Code Sections: Enumerate specific files and code sections examined, modified, or created. Pay special attention to the most recent messages and include full code snippets where applicable and include a summary of why this file read or edit is important.
34
- 4. Errors and fixes: List all errors that you ran into, and how you fixed them. Pay special attention to specific user feedback that you received, especially if the user told you to do something differently.
35
- 5. Problem Solving: Document problems solved and any ongoing troubleshooting efforts.
36
- 6. All user messages: List ALL user messages that are not tool results. These are critical for understanding the users' feedback and changing intent.
37
- 7. Pending Tasks: Outline any pending tasks that you have explicitly been asked to work on.
38
- 8. Current Work: Describe in detail precisely what was being worked on immediately before this summary request, paying special attention to the most recent messages from both user and assistant. Include file names and code snippets where applicable.
39
- 9. Optional Next Step: List the next step that you will take that is related to the most recent work you were doing. IMPORTANT: ensure that this step is DIRECTLY in line with the user's explicit requests, and the task you were working on immediately before this summary request. If your last task was concluded, then only list next steps if they are explicitly in line with the users request. Do not start on tangential requests without confirming with the user first.
40
-
41
- If there is a next step, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no drift in task interpretation.`;
42
- if (additionalInstructions && additionalInstructions.trim().length > 0) {
43
- userPrompt += `\n\nAdditional instructions provided by the user: ${additionalInstructions}`;
44
- }
45
- messageHistory.appendUserMessage(createUserMessage([], userPrompt));
46
- const { text, usage } = await generateText({
47
- model: modelManager.getModel(app),
48
- system: "You are a helpful AI assistant tasked with summarizing conversations so that a coding agent such as yourself can understand what actions have been taken on a code base and what future work still needs to be done.",
49
- messages: messageHistory.get(),
50
- });
51
- tokenTracker.trackUsage(app, usage);
52
- //create new session
53
- messageHistory.create(modelManager.getModel("repl").modelId);
54
- messageHistory.appendUserMessage(createUserMessage([text]));
55
- }
@@ -1,3 +0,0 @@
1
- import type { CommandOptions, ReplCommand } from "./types.ts";
2
- export declare function contextCommand({ config, tokenCounter, modelManager, messageHistory, workspace, }: CommandOptions): ReplCommand;
3
- //# sourceMappingURL=context-command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-command.d.ts","sourceRoot":"","sources":["../../source/commands/context-command.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA4C9D,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,SAAS,GACV,EAAE,cAAc,GAAG,WAAW,CAuH9B"}