@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,32 +1,4 @@
1
- import { generateText } from "ai";
2
- import style from "../terminal/style.js";
3
- import { initCliTools } from "../tools/index.js";
4
- import { Text } from "../tui/index.js";
5
- export const handoffCommand = (options) => {
6
- return {
7
- command: "/handoff",
8
- description: "Creates a detailed handoff plan of the conversation for continuing the work in a new session. Usage: /handoff <the purpose of the handoff>",
9
- getSubCommands: () => Promise.resolve([]),
10
- async handle(args, { tui, container, editor, }) {
11
- // Validate that purpose is provided
12
- const purpose = args.join(" ").trim();
13
- if (!purpose) {
14
- container.addChild(new Text(style.red("Please provide a purpose for the handoff. Usage: /handoff <the purpose of the handoff>"), 1, 0));
15
- tui.requestRender();
16
- editor.setText("");
17
- return "continue";
18
- }
19
- container.addChild(new Text(`Creating handoff document for purpose: ${style.blue(purpose)}`, 1, 0));
20
- tui.requestRender();
21
- await createHandoffDocument(options, purpose);
22
- container.addChild(new Text(style.green("Handoff document created"), 2, 0));
23
- tui.requestRender();
24
- editor.setText("");
25
- return "continue";
26
- },
27
- };
28
- };
29
- const handoffPrompt = (purpose) => {
1
+ export const handoffPrompt = (purpose) => {
30
2
  return `Creates a detailed handoff plan of the conversation for continuing the work in a new session.
31
3
 
32
4
  The user specified purpose:
@@ -124,68 +96,28 @@ Here's an example of how your output should be structured:
124
96
 
125
97
  ## Final Step
126
98
 
127
- After providing your analysis and summary, write the handoff summary to a markdown file at \`handoff-[timestamp]-[slug].md\` where [timestamp] is the current date in format YYYY-MM-DD and the slug is what we defined before.
99
+ Provide your complete handoff summary with all the sections above. The system will save it to a file automatically.
128
100
 
129
- Then tell the user about this file and that they can use \`/pickup FILENAME\` to continue.`;
101
+ Make sure to include both the slug and readable summary in your response as described.`;
102
+ };
103
+ export const generateHandoffSlug = (purpose, maxLength = 20) => {
104
+ let slug = purpose
105
+ .toLowerCase()
106
+ .replace(/[^a-z0-9\s-]/g, "")
107
+ .replace(/\s+/g, "-")
108
+ .replace(/-+/g, "-")
109
+ .trim();
110
+ // Remove leading and trailing hyphens
111
+ slug = slug.replace(/^-+|-+$/g, "");
112
+ // Apply maxLength after trimming hyphens
113
+ slug = slug.slice(0, maxLength);
114
+ if (!slug) {
115
+ slug = "session";
116
+ }
117
+ return slug;
118
+ };
119
+ export const generateHandoffFilename = (slug) => {
120
+ const now = new Date();
121
+ const timestamp = now.toISOString().split("T")[0];
122
+ return `${timestamp}-${slug}.md`;
130
123
  };
131
- async function createHandoffDocument({ modelManager, tokenTracker, tokenCounter, workspace }, purpose) {
132
- const app = "handoff-agent";
133
- const { text, usage } = await generateText({
134
- model: modelManager.getModel(app),
135
- system: "You are a helpful AI assistant tasked with creating detailed handoff summaries for coding agents. Focus on technical accuracy and completeness so that another agent can seamlessly continue the work.",
136
- prompt: handoffPrompt(purpose),
137
- tools: (await initCliTools({ tokenCounter, workspace })).toolDefs,
138
- });
139
- tokenTracker.trackUsage(app, usage);
140
- console.info(text);
141
- // // Parse the response to extract the readable summary and slug
142
- // const lines = text.split("\n");
143
- // let readableSummary = "";
144
- // let slug = "";
145
- // const planContent = text;
146
- // // Extract readable summary (first heading after markdown)
147
- // for (let i = 0; i < lines.length; i++) {
148
- // const line = lines[i].trim();
149
- // if (line.startsWith("# ") && !readableSummary) {
150
- // readableSummary = line.substring(2).trim();
151
- // break;
152
- // }
153
- // }
154
- // // Create slug from readable summary
155
- // if (readableSummary) {
156
- // slug = readableSummary
157
- // .toLowerCase()
158
- // .replace(/[^a-z0-9\s-]/g, "")
159
- // .replace(/\s+/g, "-")
160
- // .replace(/-+/g, "-")
161
- // .trim();
162
- // }
163
- // // Generate filename with timestamp
164
- // const now = new Date();
165
- // const timestamp = now.toISOString().split("T")[0]; // YYYY-MM-DD format
166
- // const filename = `handoff-${timestamp}-${slug || "session"}.md`;
167
- // // Create the final handoff document
168
- // const handoffDocument = `# ${readableSummary || "Session Handoff"}
169
- // ${planContent}
170
- // ---
171
- // *Generated on ${now.toISOString()} for purpose: ${purpose}*
172
- // *This handoff file can be used to continue the work using the /pickup command*`;
173
- // // Save the handoff document using the saveFile tool
174
- // const saveFileTool = await createSaveFileTool({
175
- // workingDir: workspace.primaryDir,
176
- // allowedDirs: workspace.allowedDirs,
177
- // });
178
- // saveFileTool.execute(
179
- // {
180
- // path: `./${filename}`,
181
- // content: handoffDocument,
182
- // encoding: "utf-8",
183
- // },
184
- // {
185
- // toolCallId: `handoff-${Date.now()}`,
186
- // abortSignal: undefined,
187
- // messages: messageHistory.get(),
188
- // },
189
- // );
190
- // console.info(`Handoff document created: ${filename}`);
191
- }
@@ -0,0 +1,3 @@
1
+ import type { CommandOptions, ReplCommand } from "../types.ts";
2
+ export declare function healthCommand(_options: CommandOptions): ReplCommand;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/health/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAQ/D,wBAAgB,aAAa,CAAC,QAAQ,EAAE,cAAc,GAAG,WAAW,CA6FnE"}
@@ -0,0 +1,56 @@
1
+ import { Container, Modal, ModalText, TableComponent, } from "../../tui/index.js";
2
+ import { checkEnvironmentVariables, checkTools, formatEnvStatus, formatToolStatus, } from "./utils.js";
3
+ export function healthCommand(_options) {
4
+ return {
5
+ command: "/health",
6
+ description: "Show application health status and environment variables",
7
+ getSubCommands: () => Promise.resolve([]),
8
+ async handle(_args, { tui, editor }) {
9
+ const envStatus = checkEnvironmentVariables();
10
+ const toolStatus = checkTools();
11
+ const setCount = envStatus.filter((row) => row[1] === "✓ Set").length;
12
+ const totalCount = envStatus.length;
13
+ const installedCount = toolStatus.filter((row) => row[1] === "✓ Installed").length;
14
+ const totalTools = toolStatus.length;
15
+ const usage = process.memoryUsage().rss;
16
+ const modalContent = new Container();
17
+ modalContent.addChild(new ModalText("Environment Variables Status:", 0, 1));
18
+ modalContent.addChild(new TableComponent(formatEnvStatus(envStatus), {
19
+ headers: ["Variable", "Status", "Description"],
20
+ }));
21
+ const envSummary = `Summary: ${setCount}/${totalCount} environment variables are set`;
22
+ modalContent.addChild(new ModalText(envSummary, 0, 1));
23
+ if (setCount === 0) {
24
+ modalContent.addChild(new ModalText("⚠️ No AI provider API keys are configured. The app may not function properly.", 0, 1));
25
+ }
26
+ else {
27
+ modalContent.addChild(new ModalText("✓ At least one AI provider is configured.", 0, 1));
28
+ }
29
+ modalContent.addChild(new ModalText("", 0, 1));
30
+ modalContent.addChild(new ModalText("Bash Tools Status:", 0, 1));
31
+ modalContent.addChild(new TableComponent(formatToolStatus(toolStatus), {
32
+ headers: ["Tool", "Status"],
33
+ }));
34
+ const toolSummary = `Tool Summary: ${installedCount}/${totalTools} tools are installed.`;
35
+ modalContent.addChild(new ModalText(toolSummary, 0, 1));
36
+ if (installedCount < totalTools) {
37
+ modalContent.addChild(new ModalText("⚠️ Some tools are missing. Install them for full functionality.", 0, 1));
38
+ }
39
+ else {
40
+ modalContent.addChild(new ModalText("✓ All required tools are installed.", 0, 1));
41
+ }
42
+ modalContent.addChild(new ModalText("", 0, 1));
43
+ modalContent.addChild(new ModalText("Current Process:", 0, 1));
44
+ const { formatMemoryUsage } = await import("../../formatting.js");
45
+ const formattedUsage = formatMemoryUsage(usage);
46
+ const memoryText = `Memory Usage: ${formattedUsage}`;
47
+ modalContent.addChild(new ModalText(memoryText, 0, 1));
48
+ const modal = new Modal("Health Status", modalContent, true, () => {
49
+ editor.setText("");
50
+ tui.requestRender();
51
+ });
52
+ tui.showModal(modal);
53
+ return "continue";
54
+ },
55
+ };
56
+ }
@@ -0,0 +1,15 @@
1
+ export interface EnvVarInfo {
2
+ name: string;
3
+ description: string;
4
+ }
5
+ export interface ToolInfo {
6
+ name: string;
7
+ command: string;
8
+ }
9
+ export declare const ENVIRONMENT_VARIABLES: EnvVarInfo[];
10
+ export declare const BASH_TOOLS: ToolInfo[];
11
+ export declare function checkEnvironmentVariables(): (string | number)[][];
12
+ export declare function checkTools(execFn?: (command: string, options: object) => void): string[][];
13
+ export declare function formatEnvStatus(status: (string | number)[][]): (string | number)[][];
14
+ export declare function formatToolStatus(status: string[][]): string[][];
15
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,52 @@
1
+ import { execSync } from "node:child_process";
2
+ export const ENVIRONMENT_VARIABLES = [
3
+ { name: "OPENAI_API_KEY", description: "OpenAI (GPT models)" },
4
+ { name: "ANTHROPIC_API_KEY", description: "Anthropic (Claude models)" },
5
+ {
6
+ name: "GOOGLE_GENERATIVE_AI_API_KEY",
7
+ description: "Google (Gemini models)",
8
+ },
9
+ { name: "DEEPSEEK_API_KEY", description: "DeepSeek" },
10
+ { name: "GROQ_API_KEY", description: "Groq (multiple models)" },
11
+ { name: "X_AI_API_KEY", description: "X.AI (Grok models)" },
12
+ { name: "XAI_API_KEY", description: "X.AI (Grok models - alt)" },
13
+ { name: "OPENROUTER_API_KEY", description: "OpenRouter (multiple models)" },
14
+ { name: "OPENCODE_ZEN_API_TOKEN", description: "OpenCode Zen" },
15
+ { name: "LOG_LEVEL", description: "Logging level" },
16
+ ];
17
+ export const BASH_TOOLS = [
18
+ { name: "git", command: "git --version" },
19
+ { name: "gh", command: "gh --version" },
20
+ { name: "rg", command: "rg --version" },
21
+ { name: "fd", command: "fd --version" },
22
+ { name: "ast-grep", command: "ast-grep --version" },
23
+ { name: "jq", command: "jq --version" },
24
+ { name: "yq", command: "yq --version" },
25
+ ];
26
+ export function checkEnvironmentVariables() {
27
+ return ENVIRONMENT_VARIABLES.map((envVar) => {
28
+ const value = process.env[envVar.name];
29
+ const hasValue = value !== undefined && value !== null && value.trim() !== "";
30
+ const status = hasValue ? "✓ Set" : "✗ Not set";
31
+ return [envVar.name, status, envVar.description];
32
+ });
33
+ }
34
+ export function checkTools(execFn = execSync) {
35
+ return BASH_TOOLS.map((tool) => {
36
+ let status = "✗ Not installed";
37
+ try {
38
+ execFn(tool.command, { stdio: "ignore", timeout: 5000 });
39
+ status = "✓ Installed";
40
+ }
41
+ catch {
42
+ // Ignore error, tool is not installed
43
+ }
44
+ return [tool.name, status];
45
+ });
46
+ }
47
+ export function formatEnvStatus(status) {
48
+ return status;
49
+ }
50
+ export function formatToolStatus(status) {
51
+ return status;
52
+ }
@@ -1,3 +1,3 @@
1
- import type { CommandOptions, ReplCommand } from "./types.ts";
1
+ import type { CommandOptions, ReplCommand } from "../types.ts";
2
2
  export declare const helpCommand: (_options: CommandOptions, cmds: Map<string, ReplCommand>) => ReplCommand;
3
- //# sourceMappingURL=help-command.d.ts.map
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/help/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,WAAW,GACtB,UAAU,cAAc,EACxB,MAAM,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,KAC7B,WA6CF,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Modal, Container as ModalContainer, ModalText, TableComponent, } from "../tui/index.js";
1
+ import { Modal, Container as ModalContainer, ModalText, TableComponent, } from "../../tui/index.js";
2
2
  export const helpCommand = (_options, cmds) => {
3
3
  return {
4
4
  command: "/help",
@@ -0,0 +1,3 @@
1
+ import type { CommandOptions, ReplCommand } from "../types.ts";
2
+ export declare const historyCommand: ({ sessionManager: messageHistory, config, modelManager, tokenTracker, }: CommandOptions) => ReplCommand;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,94 +1,10 @@
1
- import { writeFile } from "node:fs/promises";
1
+ /* biome-ignore-all lint/suspicious/noExplicitAny: internal function uses simplified types */
2
2
  import { generateText } from "ai";
3
- import { MessageHistory } from "../messages.js";
4
- import { getTerminalSize, setTerminalTitle } from "../terminal/formatting.js";
5
- import style from "../terminal/style.js";
6
- import { Container, Input, Markdown, Spacer, Text } from "../tui/index.js";
7
- async function exportConversation(history) {
8
- const sanitizedTitle = history.title
9
- .replace(/[^a-zA-Z0-9\s-_]/g, "")
10
- .replace(/\s+/g, "-")
11
- .toLowerCase();
12
- const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, -5);
13
- const filename = `${sanitizedTitle}_${timestamp}.md`;
14
- const markdownContent = generateMarkdown(history);
15
- await writeFile(filename, markdownContent);
16
- return filename;
17
- }
18
- function generateMarkdown(history) {
19
- const lines = [];
20
- // Header
21
- lines.push(`# ${history.title}`);
22
- lines.push("");
23
- lines.push("## Conversation Metadata");
24
- lines.push(`- **Session ID**: ${history.sessionId}`);
25
- lines.push(`- **Model**: ${history.modelId}`);
26
- lines.push(`- **Created**: ${history.createdAt.toISOString()}`);
27
- lines.push(`- **Last Updated**: ${history.updatedAt.toISOString()}`);
28
- lines.push(`- **Total Messages**: ${history.messages.length}`);
29
- lines.push("");
30
- // Messages
31
- lines.push("## Conversation History");
32
- lines.push("");
33
- history.messages.forEach((message, index) => {
34
- const role = message.role.toUpperCase();
35
- lines.push(`### ${role} (Message ${index + 1})`);
36
- lines.push("");
37
- if (Array.isArray(message.content)) {
38
- message.content.forEach((part) => {
39
- if (part.type === "text" && part.text?.trim()) {
40
- lines.push(part.text);
41
- lines.push("");
42
- }
43
- else if (part.type === "tool-call") {
44
- lines.push(`**Tool Call**: ${part.toolName}`);
45
- lines.push(`**Call ID**: ${part.toolCallId}`);
46
- lines.push("**Input**:");
47
- lines.push("```json");
48
- lines.push(JSON.stringify(part.input, null, 2));
49
- lines.push("```");
50
- lines.push("");
51
- }
52
- else if (part.type === "tool-result") {
53
- lines.push(`**Tool Result**: ${part.toolName}`);
54
- lines.push(`**Call ID**: ${part.toolCallId}`);
55
- lines.push("**Output**:");
56
- if (typeof part.output === "object" &&
57
- part.output !== null &&
58
- "type" in part.output &&
59
- part.output.type === "text" &&
60
- "text" in part.output) {
61
- lines.push("```");
62
- lines.push(String(part.output.text));
63
- lines.push("```");
64
- }
65
- else {
66
- lines.push("```json");
67
- lines.push(JSON.stringify(part.output, null, 2));
68
- lines.push("```");
69
- }
70
- lines.push("");
71
- }
72
- else if (part.type === "tool-error") {
73
- lines.push(`**Tool Error**: ${part.toolName}`);
74
- lines.push(`**Call ID**: ${part.toolCallId}`);
75
- lines.push("**Error**:");
76
- lines.push("```");
77
- lines.push(String(part.output));
78
- lines.push("```");
79
- lines.push("");
80
- }
81
- });
82
- }
83
- else if (typeof message.content === "string" && message.content.trim()) {
84
- lines.push(message.content);
85
- lines.push("");
86
- }
87
- lines.push("---");
88
- lines.push("");
89
- });
90
- return lines.join("\n");
91
- }
3
+ import { SessionManager } from "../../sessions/manager.js";
4
+ import { getTerminalSize, isArrowDown, isArrowUp, isEnter, isEscape, setTerminalTitle, } from "../../terminal/control.js";
5
+ import style from "../../terminal/style.js";
6
+ import { Container, Input, Markdown, Spacer, Text } from "../../tui/index.js";
7
+ import { exportConversation } from "./utils.js";
92
8
  async function summarizeConversation(history, modelManager, tokenTracker) {
93
9
  const systemPrompt = `You are an expert at summarizing conversations between a coding assistant and a user. Your task is to provide a clear, concise summary of the conversation that captures:
94
10
 
@@ -128,7 +44,7 @@ Keep the summary focused and informative, around 3-5 paragraphs. Use plain text
128
44
  results.push("");
129
45
  return results.join("\n");
130
46
  }
131
- export const historyCommand = ({ messageHistory, config, modelManager, tokenTracker, }) => {
47
+ export const historyCommand = ({ sessionManager: messageHistory, config, modelManager, tokenTracker, }) => {
132
48
  return {
133
49
  command: "/history",
134
50
  description: "Browse and manage previous conversations.",
@@ -137,7 +53,7 @@ export const historyCommand = ({ messageHistory, config, modelManager, tokenTrac
137
53
  const appDir = config.app;
138
54
  const messageHistoryDir = await appDir.ensurePath("message-history");
139
55
  // Load all histories (use a large number to get all)
140
- const histories = await MessageHistory.load(messageHistoryDir, 1000);
56
+ const histories = await SessionManager.load(messageHistoryDir, 1000);
141
57
  if (histories.length === 0) {
142
58
  container.addChild(new Text(style.yellow("No previous conversations found."), 0, 1));
143
59
  tui.requestRender();
@@ -313,24 +229,24 @@ class ConversationSelectorComponent extends Container {
313
229
  }
314
230
  handleInput(keyData) {
315
231
  // Up arrow
316
- if (keyData === "\x1b[A") {
232
+ if (isArrowUp(keyData)) {
317
233
  this.selectedIndex = Math.max(0, this.selectedIndex - 1);
318
234
  this.updateList();
319
235
  }
320
236
  // Down arrow
321
- else if (keyData === "\x1b[B") {
237
+ else if (isArrowDown(keyData)) {
322
238
  this.selectedIndex = Math.min(this.filteredConversations.length - 1, this.selectedIndex + 1);
323
239
  this.updateList();
324
240
  }
325
241
  // Enter
326
- else if (keyData === "\r") {
242
+ else if (isEnter(keyData)) {
327
243
  const selectedConversation = this.filteredConversations[this.selectedIndex];
328
244
  if (selectedConversation) {
329
245
  this.handleSelect(selectedConversation);
330
246
  }
331
247
  }
332
248
  // Escape
333
- else if (keyData === "\x1b") {
249
+ else if (isEscape(keyData)) {
334
250
  this.onCancelCallback();
335
251
  }
336
252
  // Pass everything else to search input
@@ -394,17 +310,17 @@ class ActionSelectorComponent extends Container {
394
310
  }
395
311
  handleInput(keyData) {
396
312
  // Up arrow
397
- if (keyData === "\x1b[A") {
313
+ if (isArrowUp(keyData)) {
398
314
  this.selectedIndex = Math.max(0, this.selectedIndex - 1);
399
315
  this.updateList();
400
316
  }
401
317
  // Down arrow
402
- else if (keyData === "\x1b[B") {
318
+ else if (isArrowDown(keyData)) {
403
319
  this.selectedIndex = Math.min(2, this.selectedIndex + 1);
404
320
  this.updateList();
405
321
  }
406
322
  // Enter
407
- else if (keyData === "\r") {
323
+ else if (isEnter(keyData)) {
408
324
  const actions = ["resume", "export", "summarize"];
409
325
  const selectedAction = actions[this.selectedIndex];
410
326
  if (selectedAction) {
@@ -412,7 +328,7 @@ class ActionSelectorComponent extends Container {
412
328
  }
413
329
  }
414
330
  // Escape
415
- else if (keyData === "\x1b") {
331
+ else if (isEscape(keyData)) {
416
332
  this.onCancelCallback();
417
333
  }
418
334
  }
@@ -0,0 +1,11 @@
1
+ import type { ModelMessage } from "ai";
2
+ export interface ConversationHistory {
3
+ title: string;
4
+ createdAt: Date;
5
+ updatedAt: Date;
6
+ messages: ModelMessage[];
7
+ sessionId: string;
8
+ modelId: string;
9
+ project: string;
10
+ }
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ConversationHistory } from "./types.ts";
2
+ export declare function exportConversation(history: ConversationHistory): Promise<string>;
3
+ export declare function generateMarkdown(history: ConversationHistory): string;
4
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,86 @@
1
+ import { writeFile } from "node:fs/promises";
2
+ export async function exportConversation(history) {
3
+ const sanitizedTitle = history.title
4
+ .replace(/[^a-zA-Z0-9\s-_]/g, "")
5
+ .replace(/\s+/g, "-")
6
+ .toLowerCase();
7
+ const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, -5);
8
+ const filename = `${sanitizedTitle}_${timestamp}.md`;
9
+ const markdownContent = generateMarkdown(history);
10
+ await writeFile(filename, markdownContent);
11
+ return filename;
12
+ }
13
+ 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("");
28
+ history.messages.forEach((message, index) => {
29
+ const role = message.role.toUpperCase();
30
+ lines.push(`### ${role} (Message ${index + 1})`);
31
+ lines.push("");
32
+ 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
+ });
77
+ }
78
+ else if (typeof message.content === "string" && message.content.trim()) {
79
+ lines.push(message.content);
80
+ lines.push("");
81
+ }
82
+ lines.push("---");
83
+ lines.push("");
84
+ });
85
+ return lines.join("\n");
86
+ }
@@ -0,0 +1,3 @@
1
+ import type { CommandOptions, ReplCommand } from "../types.ts";
2
+ export declare const initCommand: ({ modelManager, workspace, }: CommandOptions) => ReplCommand;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,9 +1,9 @@
1
1
  import { platform } from "node:os";
2
- import { stepCountIs, streamText } from "ai";
3
- import style from "../terminal/style.js";
4
- import { initCliTools } from "../tools/index.js";
5
- import { Markdown, Spacer, Text } from "../tui/index.js";
6
- import { inGitDirectory } from "../utils/git.js";
2
+ import { stepCountIs, streamText, tool } from "ai";
3
+ import style from "../../terminal/style.js";
4
+ import { initTools } from "../../tools/index.js";
5
+ import { Markdown, Spacer, Text } from "../../tui/index.js";
6
+ import { inGitDirectory } from "../../utils/git.js";
7
7
  const initPrompt = `Please analyze this codebase and create a AGENTS.md file containing:
8
8
  1. An overview of the project including how the project is structured and the tech stack used.
9
9
  2. Build/lint/test commands - especially for running a single test
@@ -22,7 +22,7 @@ If there are Cursor rules (in .cursor/rules/ or .cursorrules), Copilot rules (in
22
22
  Your current working directory is ${process.cwd()}
23
23
  Is directory a git repo: ${(await inGitDirectory()) ? "Yes" : "No"}
24
24
  Platform: ${platform()}`;
25
- export const initCommand = ({ modelManager, tokenCounter, workspace, }) => {
25
+ export const initCommand = ({ modelManager, workspace, }) => {
26
26
  return {
27
27
  command: "/init",
28
28
  description: "Creates the AGENTS.md file.",
@@ -30,12 +30,21 @@ export const initCommand = ({ modelManager, tokenCounter, workspace, }) => {
30
30
  async handle(_args, { tui, container, editor, }) {
31
31
  container.addChild(new Text("Initializing project and creating AGENTS.md...", 1, 1));
32
32
  tui.requestRender();
33
+ const tools = await initTools({
34
+ workspace,
35
+ });
33
36
  const result = streamText({
34
37
  model: modelManager.getModel("init-project"),
35
38
  temperature: 0.5,
36
39
  prompt: initPrompt,
37
40
  stopWhen: stepCountIs(40),
38
- tools: (await initCliTools({ tokenCounter, workspace })).toolDefs,
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
+ ])),
39
48
  });
40
49
  container.addChild(new Spacer(1));
41
50
  let output = "";
@@ -0,0 +1,3 @@
1
+ import type { CommandOptions, ReplCommand } from "../types.ts";
2
+ export declare const initProjectCommand: (_options: CommandOptions) => ReplCommand;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}