@travisennis/acai 0.0.7 → 0.0.8

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 (471) hide show
  1. package/README.md +42 -25
  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 +115 -104
  5. package/dist/cli.d.ts +2 -2
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +21 -16
  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} +55 -95
  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 +33 -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 +126 -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 +197 -0
  143. package/dist/commands/session/types.d.ts +13 -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/shell/index.d.ts +3 -0
  147. package/dist/commands/shell/index.d.ts.map +1 -0
  148. package/dist/commands/{shell-command.js → shell/index.js} +3 -3
  149. package/dist/commands/types.d.ts +2 -2
  150. package/dist/commands/types.d.ts.map +1 -1
  151. package/dist/config.d.ts +25 -7
  152. package/dist/config.d.ts.map +1 -1
  153. package/dist/config.js +45 -20
  154. package/dist/dedent.d.ts.map +1 -1
  155. package/dist/dedent.js +7 -7
  156. package/dist/execution/index.d.ts +1 -0
  157. package/dist/execution/index.d.ts.map +1 -1
  158. package/dist/execution/index.js +60 -64
  159. package/dist/formatting.d.ts +27 -0
  160. package/dist/formatting.d.ts.map +1 -1
  161. package/dist/formatting.js +40 -0
  162. package/dist/index.d.ts.map +1 -1
  163. package/dist/index.js +138 -75
  164. package/dist/logger.d.ts.map +1 -1
  165. package/dist/logger.js +4 -11
  166. package/dist/mentions.d.ts.map +1 -1
  167. package/dist/mentions.js +3 -53
  168. package/dist/middleware/audit-message.d.ts +2 -2
  169. package/dist/middleware/audit-message.d.ts.map +1 -1
  170. package/dist/middleware/audit-message.js +40 -2
  171. package/dist/middleware/cache.d.ts +2 -2
  172. package/dist/middleware/cache.d.ts.map +1 -1
  173. package/dist/middleware/cache.js +111 -27
  174. package/dist/middleware/rate-limit.d.ts +2 -2
  175. package/dist/middleware/rate-limit.d.ts.map +1 -1
  176. package/dist/middleware/rate-limit.js +1 -0
  177. package/dist/models/ai-config.d.ts.map +1 -1
  178. package/dist/models/ai-config.js +46 -29
  179. package/dist/models/anthropic-provider.d.ts +14 -13
  180. package/dist/models/anthropic-provider.d.ts.map +1 -1
  181. package/dist/models/deepseek-provider.d.ts +9 -8
  182. package/dist/models/deepseek-provider.d.ts.map +1 -1
  183. package/dist/models/google-provider.d.ts +10 -9
  184. package/dist/models/google-provider.d.ts.map +1 -1
  185. package/dist/models/groq-provider.d.ts +8 -7
  186. package/dist/models/groq-provider.d.ts.map +1 -1
  187. package/dist/models/manager.d.ts +7 -4
  188. package/dist/models/manager.d.ts.map +1 -1
  189. package/dist/models/manager.js +5 -25
  190. package/dist/models/openai-provider.d.ts +11 -10
  191. package/dist/models/openai-provider.d.ts.map +1 -1
  192. package/dist/models/opencode-zen-provider.d.ts +23 -0
  193. package/dist/models/opencode-zen-provider.d.ts.map +1 -0
  194. package/dist/models/opencode-zen-provider.js +76 -0
  195. package/dist/models/openrouter-provider.d.ts +34 -29
  196. package/dist/models/openrouter-provider.d.ts.map +1 -1
  197. package/dist/models/openrouter-provider.js +95 -80
  198. package/dist/models/providers.d.ts +4 -4
  199. package/dist/models/providers.d.ts.map +1 -1
  200. package/dist/models/providers.js +7 -1
  201. package/dist/models/xai-provider.d.ts +9 -8
  202. package/dist/models/xai-provider.d.ts.map +1 -1
  203. package/dist/prompts/manager.d.ts +1 -1
  204. package/dist/prompts/manager.d.ts.map +1 -1
  205. package/dist/prompts/manager.js +1 -1
  206. package/dist/prompts.d.ts +0 -1
  207. package/dist/prompts.d.ts.map +1 -1
  208. package/dist/prompts.js +56 -406
  209. package/dist/repl/project-status.d.ts +19 -0
  210. package/dist/repl/project-status.d.ts.map +1 -0
  211. package/dist/repl/project-status.js +78 -0
  212. package/dist/repl-new.d.ts +15 -4
  213. package/dist/repl-new.d.ts.map +1 -1
  214. package/dist/repl-new.js +245 -42
  215. package/dist/{messages.d.ts → sessions/manager.d.ts} +10 -4
  216. package/dist/sessions/manager.d.ts.map +1 -0
  217. package/dist/{messages.js → sessions/manager.js} +60 -14
  218. package/dist/skills.d.ts +0 -4
  219. package/dist/skills.d.ts.map +1 -1
  220. package/dist/skills.js +100 -59
  221. package/dist/terminal/control.d.ts +1 -0
  222. package/dist/terminal/control.d.ts.map +1 -1
  223. package/dist/terminal/control.js +2 -0
  224. package/dist/terminal/formatting.d.ts +1 -2
  225. package/dist/terminal/formatting.d.ts.map +1 -1
  226. package/dist/terminal/formatting.js +1 -2
  227. package/dist/terminal/keys.d.ts +211 -0
  228. package/dist/terminal/keys.d.ts.map +1 -0
  229. package/dist/terminal/keys.js +546 -0
  230. package/dist/terminal/segmenter.d.ts +6 -0
  231. package/dist/terminal/segmenter.d.ts.map +1 -0
  232. package/dist/terminal/segmenter.js +11 -0
  233. package/dist/terminal/select-prompt.d.ts.map +1 -1
  234. package/dist/terminal/select-prompt.js +9 -21
  235. package/dist/terminal/string-width.d.ts.map +1 -1
  236. package/dist/terminal/string-width.js +40 -21
  237. package/dist/terminal/strip-ansi.d.ts.map +1 -1
  238. package/dist/terminal/strip-ansi.js +9 -15
  239. package/dist/tokens/tracker.d.ts.map +1 -1
  240. package/dist/tokens/tracker.js +58 -16
  241. package/dist/tools/bash.d.ts +9 -11
  242. package/dist/tools/bash.d.ts.map +1 -1
  243. package/dist/tools/bash.js +69 -123
  244. package/dist/tools/directory-tree.d.ts +9 -7
  245. package/dist/tools/directory-tree.d.ts.map +1 -1
  246. package/dist/tools/directory-tree.js +89 -70
  247. package/dist/tools/dynamic-tool-loader.d.ts +22 -4
  248. package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
  249. package/dist/tools/dynamic-tool-loader.js +39 -44
  250. package/dist/tools/edit-file.d.ts +6 -16
  251. package/dist/tools/edit-file.d.ts.map +1 -1
  252. package/dist/tools/edit-file.js +19 -76
  253. package/dist/tools/glob.d.ts +15 -16
  254. package/dist/tools/glob.d.ts.map +1 -1
  255. package/dist/tools/glob.js +77 -119
  256. package/dist/tools/grep.d.ts +19 -22
  257. package/dist/tools/grep.d.ts.map +1 -1
  258. package/dist/tools/grep.js +61 -108
  259. package/dist/tools/index.d.ts +200 -179
  260. package/dist/tools/index.d.ts.map +1 -1
  261. package/dist/tools/index.js +17 -315
  262. package/dist/tools/ls.d.ts +26 -0
  263. package/dist/tools/ls.d.ts.map +1 -0
  264. package/dist/tools/ls.js +80 -0
  265. package/dist/tools/read-file.d.ts +15 -15
  266. package/dist/tools/read-file.d.ts.map +1 -1
  267. package/dist/tools/read-file.js +49 -82
  268. package/dist/tools/save-file.d.ts +4 -4
  269. package/dist/tools/save-file.d.ts.map +1 -1
  270. package/dist/tools/save-file.js +37 -66
  271. package/dist/tools/think.d.ts +4 -4
  272. package/dist/tools/think.d.ts.map +1 -1
  273. package/dist/tools/think.js +9 -38
  274. package/dist/tools/types.d.ts +5 -25
  275. package/dist/tools/types.d.ts.map +1 -1
  276. package/dist/tools/types.js +0 -9
  277. package/dist/tui/autocomplete/attachment-provider.d.ts +18 -0
  278. package/dist/tui/autocomplete/attachment-provider.d.ts.map +1 -0
  279. package/dist/tui/autocomplete/attachment-provider.js +159 -0
  280. package/dist/tui/autocomplete/base-provider.d.ts +17 -0
  281. package/dist/tui/autocomplete/base-provider.d.ts.map +1 -0
  282. package/dist/tui/autocomplete/base-provider.js +1 -0
  283. package/dist/tui/autocomplete/combined-provider.d.ts +20 -0
  284. package/dist/tui/autocomplete/combined-provider.d.ts.map +1 -0
  285. package/dist/tui/autocomplete/combined-provider.js +61 -0
  286. package/dist/tui/autocomplete/command-provider.d.ts +20 -0
  287. package/dist/tui/autocomplete/command-provider.d.ts.map +1 -0
  288. package/dist/tui/autocomplete/command-provider.js +90 -0
  289. package/dist/tui/autocomplete/file-search-provider.d.ts +16 -0
  290. package/dist/tui/autocomplete/file-search-provider.d.ts.map +1 -0
  291. package/dist/tui/autocomplete/file-search-provider.js +123 -0
  292. package/dist/tui/autocomplete/path-provider.d.ts +21 -0
  293. package/dist/tui/autocomplete/path-provider.d.ts.map +1 -0
  294. package/dist/tui/autocomplete/path-provider.js +164 -0
  295. package/dist/tui/autocomplete/utils.d.ts +16 -0
  296. package/dist/tui/autocomplete/utils.d.ts.map +1 -0
  297. package/dist/tui/autocomplete/utils.js +137 -0
  298. package/dist/tui/autocomplete.d.ts +12 -43
  299. package/dist/tui/autocomplete.d.ts.map +1 -1
  300. package/dist/tui/autocomplete.js +20 -465
  301. package/dist/tui/components/box.d.ts.map +1 -1
  302. package/dist/tui/components/box.js +16 -10
  303. package/dist/tui/components/editor.d.ts +1 -2
  304. package/dist/tui/components/editor.d.ts.map +1 -1
  305. package/dist/tui/components/editor.js +148 -107
  306. package/dist/tui/components/footer.d.ts +20 -7
  307. package/dist/tui/components/footer.d.ts.map +1 -1
  308. package/dist/tui/components/footer.js +89 -196
  309. package/dist/tui/components/input.d.ts.map +1 -1
  310. package/dist/tui/components/input.js +8 -7
  311. package/dist/tui/components/loader.d.ts +2 -1
  312. package/dist/tui/components/loader.d.ts.map +1 -1
  313. package/dist/tui/components/loader.js +7 -2
  314. package/dist/tui/components/markdown.d.ts +5 -4
  315. package/dist/tui/components/markdown.d.ts.map +1 -1
  316. package/dist/tui/components/markdown.js +51 -40
  317. package/dist/tui/components/modal.d.ts.map +1 -1
  318. package/dist/tui/components/modal.js +9 -8
  319. package/dist/tui/components/notification.d.ts +28 -0
  320. package/dist/tui/components/notification.d.ts.map +1 -0
  321. package/dist/tui/components/notification.js +63 -0
  322. package/dist/tui/components/progress-bar.d.ts.map +1 -1
  323. package/dist/tui/components/progress-bar.js +3 -15
  324. package/dist/tui/components/select-list.d.ts +0 -15
  325. package/dist/tui/components/select-list.d.ts.map +1 -1
  326. package/dist/tui/components/select-list.js +5 -28
  327. package/dist/tui/components/tool-execution.d.ts +3 -6
  328. package/dist/tui/components/tool-execution.d.ts.map +1 -1
  329. package/dist/tui/components/tool-execution.js +26 -38
  330. package/dist/tui/components/welcome.d.ts +8 -1
  331. package/dist/tui/components/welcome.d.ts.map +1 -1
  332. package/dist/tui/components/welcome.js +45 -6
  333. package/dist/tui/index.d.ts +4 -2
  334. package/dist/tui/index.d.ts.map +1 -1
  335. package/dist/tui/index.js +2 -2
  336. package/dist/tui/terminal.d.ts +2 -2
  337. package/dist/tui/terminal.d.ts.map +1 -1
  338. package/dist/tui/terminal.js +23 -19
  339. package/dist/tui/tui.d.ts +1 -0
  340. package/dist/tui/tui.d.ts.map +1 -1
  341. package/dist/tui/tui.js +24 -29
  342. package/dist/tui/utils.d.ts.map +1 -1
  343. package/dist/tui/utils.js +2 -3
  344. package/dist/utils/yaml.d.ts +11 -0
  345. package/dist/utils/yaml.d.ts.map +1 -0
  346. package/dist/utils/yaml.js +207 -0
  347. package/dist/utils/zod.d.ts +1 -0
  348. package/dist/utils/zod.d.ts.map +1 -1
  349. package/dist/utils/zod.js +17 -0
  350. package/package.json +31 -29
  351. package/bin/acai-wrapper.js +0 -26
  352. package/dist/api/exa/index.d.ts +0 -177
  353. package/dist/api/exa/index.d.ts.map +0 -1
  354. package/dist/api/exa/index.js +0 -439
  355. package/dist/commands/add-directory-command.d.ts +0 -3
  356. package/dist/commands/add-directory-command.d.ts.map +0 -1
  357. package/dist/commands/application-log-command.d.ts +0 -3
  358. package/dist/commands/application-log-command.d.ts.map +0 -1
  359. package/dist/commands/application-log-command.js +0 -43
  360. package/dist/commands/clear-command.d.ts +0 -3
  361. package/dist/commands/clear-command.d.ts.map +0 -1
  362. package/dist/commands/compact-command.d.ts +0 -3
  363. package/dist/commands/compact-command.d.ts.map +0 -1
  364. package/dist/commands/compact-command.js +0 -55
  365. package/dist/commands/context-command.d.ts +0 -3
  366. package/dist/commands/context-command.d.ts.map +0 -1
  367. package/dist/commands/context-command.js +0 -124
  368. package/dist/commands/copy-command.d.ts +0 -3
  369. package/dist/commands/copy-command.d.ts.map +0 -1
  370. package/dist/commands/edit-command.d.ts +0 -3
  371. package/dist/commands/edit-command.d.ts.map +0 -1
  372. package/dist/commands/edit-command.js +0 -42
  373. package/dist/commands/edit-prompt-command.d.ts +0 -3
  374. package/dist/commands/edit-prompt-command.d.ts.map +0 -1
  375. package/dist/commands/edit-prompt-command.js +0 -36
  376. package/dist/commands/exit-command.d.ts.map +0 -1
  377. package/dist/commands/exit-command.js +0 -30
  378. package/dist/commands/files-command.d.ts +0 -3
  379. package/dist/commands/files-command.d.ts.map +0 -1
  380. package/dist/commands/files-command.js +0 -68
  381. package/dist/commands/generate-rules-command.d.ts +0 -3
  382. package/dist/commands/generate-rules-command.d.ts.map +0 -1
  383. package/dist/commands/handoff-command.d.ts +0 -3
  384. package/dist/commands/handoff-command.d.ts.map +0 -1
  385. package/dist/commands/health-command.d.ts +0 -4
  386. package/dist/commands/health-command.d.ts.map +0 -1
  387. package/dist/commands/health-command.js +0 -118
  388. package/dist/commands/help-command.d.ts.map +0 -1
  389. package/dist/commands/history-command.d.ts +0 -3
  390. package/dist/commands/history-command.d.ts.map +0 -1
  391. package/dist/commands/init-command.d.ts +0 -3
  392. package/dist/commands/init-command.d.ts.map +0 -1
  393. package/dist/commands/last-log-command.d.ts +0 -3
  394. package/dist/commands/last-log-command.d.ts.map +0 -1
  395. package/dist/commands/last-log-command.js +0 -71
  396. package/dist/commands/list-directories-command.d.ts +0 -3
  397. package/dist/commands/list-directories-command.d.ts.map +0 -1
  398. package/dist/commands/list-tools-command.d.ts +0 -3
  399. package/dist/commands/list-tools-command.d.ts.map +0 -1
  400. package/dist/commands/model-command.d.ts +0 -3
  401. package/dist/commands/model-command.d.ts.map +0 -1
  402. package/dist/commands/paste-command.d.ts.map +0 -1
  403. package/dist/commands/pickup-command.d.ts +0 -3
  404. package/dist/commands/pickup-command.d.ts.map +0 -1
  405. package/dist/commands/pickup-command.js +0 -109
  406. package/dist/commands/prompt-command.d.ts +0 -21
  407. package/dist/commands/prompt-command.d.ts.map +0 -1
  408. package/dist/commands/prompt-command.js +0 -258
  409. package/dist/commands/remove-directory-command.d.ts +0 -3
  410. package/dist/commands/remove-directory-command.d.ts.map +0 -1
  411. package/dist/commands/reset-command.d.ts +0 -3
  412. package/dist/commands/reset-command.d.ts.map +0 -1
  413. package/dist/commands/rules-command.d.ts +0 -3
  414. package/dist/commands/rules-command.d.ts.map +0 -1
  415. package/dist/commands/rules-command.js +0 -73
  416. package/dist/commands/save-command.d.ts +0 -3
  417. package/dist/commands/save-command.d.ts.map +0 -1
  418. package/dist/commands/shell-command.d.ts +0 -3
  419. package/dist/commands/shell-command.d.ts.map +0 -1
  420. package/dist/commands/usage-command.d.ts +0 -3
  421. package/dist/commands/usage-command.d.ts.map +0 -1
  422. package/dist/commands/usage-command.js +0 -31
  423. package/dist/messages.d.ts.map +0 -1
  424. package/dist/repl/project-status-line.d.ts +0 -3
  425. package/dist/repl/project-status-line.d.ts.map +0 -1
  426. package/dist/repl/project-status-line.js +0 -61
  427. package/dist/repl/tool-call-repair.d.ts +0 -4
  428. package/dist/repl/tool-call-repair.d.ts.map +0 -1
  429. package/dist/repl/tool-call-repair.js +0 -54
  430. package/dist/terminal/markdown.d.ts +0 -2
  431. package/dist/terminal/markdown.d.ts.map +0 -1
  432. package/dist/terminal/markdown.js +0 -120
  433. package/dist/tokens/threshold.d.ts +0 -20
  434. package/dist/tokens/threshold.d.ts.map +0 -1
  435. package/dist/tokens/threshold.js +0 -67
  436. package/dist/tools/advanced-edit-file.d.ts +0 -69
  437. package/dist/tools/advanced-edit-file.d.ts.map +0 -1
  438. package/dist/tools/advanced-edit-file.js +0 -285
  439. package/dist/tools/agent.d.ts +0 -29
  440. package/dist/tools/agent.d.ts.map +0 -1
  441. package/dist/tools/agent.js +0 -117
  442. package/dist/tools/batch.d.ts +0 -34
  443. package/dist/tools/batch.d.ts.map +0 -1
  444. package/dist/tools/batch.js +0 -174
  445. package/dist/tools/code-interpreter.d.ts +0 -25
  446. package/dist/tools/code-interpreter.d.ts.map +0 -1
  447. package/dist/tools/code-interpreter.js +0 -183
  448. package/dist/tools/delete-file.d.ts +0 -24
  449. package/dist/tools/delete-file.d.ts.map +0 -1
  450. package/dist/tools/delete-file.js +0 -77
  451. package/dist/tools/dynamic-tool-parser.d.ts +0 -21
  452. package/dist/tools/dynamic-tool-parser.d.ts.map +0 -1
  453. package/dist/tools/dynamic-tool-parser.js +0 -22
  454. package/dist/tools/llm-edit-fixer.d.ts +0 -24
  455. package/dist/tools/llm-edit-fixer.d.ts.map +0 -1
  456. package/dist/tools/llm-edit-fixer.js +0 -136
  457. package/dist/tools/move-file.d.ts +0 -26
  458. package/dist/tools/move-file.d.ts.map +0 -1
  459. package/dist/tools/move-file.js +0 -65
  460. package/dist/tools/read-multiple-files.d.ts +0 -26
  461. package/dist/tools/read-multiple-files.d.ts.map +0 -1
  462. package/dist/tools/read-multiple-files.js +0 -196
  463. package/dist/tools/web-fetch.d.ts +0 -56
  464. package/dist/tools/web-fetch.d.ts.map +0 -1
  465. package/dist/tools/web-fetch.js +0 -247
  466. package/dist/tools/web-search.d.ts +0 -23
  467. package/dist/tools/web-search.d.ts.map +0 -1
  468. package/dist/tools/web-search.js +0 -148
  469. package/dist/tui/components/prompt-status.d.ts +0 -17
  470. package/dist/tui/components/prompt-status.d.ts.map +0 -1
  471. package/dist/tui/components/prompt-status.js +0 -26
@@ -0,0 +1,17 @@
1
+ export interface AutocompleteItem {
2
+ value: string;
3
+ label: string;
4
+ description?: string;
5
+ }
6
+ export interface AutocompleteProvider {
7
+ getSuggestions(lines: string[], cursorLine: number, cursorCol: number): Promise<{
8
+ items: AutocompleteItem[];
9
+ prefix: string;
10
+ } | null>;
11
+ applyCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
12
+ lines: string[];
13
+ cursorLine: number;
14
+ cursorCol: number;
15
+ };
16
+ }
17
+ //# sourceMappingURL=base-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-provider.d.ts","sourceRoot":"","sources":["../../../source/tui/autocomplete/base-provider.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IAGnC,cAAc,CACZ,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAIjE,eAAe,CACb,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,GACb;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/D"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import type { AutocompleteItem, AutocompleteProvider } from "./base-provider.ts";
2
+ export declare class CombinedProvider implements AutocompleteProvider {
3
+ private providers;
4
+ constructor(providers: AutocompleteProvider[]);
5
+ getSuggestions(lines: string[], cursorLine: number, cursorCol: number): Promise<{
6
+ items: AutocompleteItem[];
7
+ prefix: string;
8
+ } | null>;
9
+ applyCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
10
+ lines: string[];
11
+ cursorLine: number;
12
+ cursorCol: number;
13
+ };
14
+ getForceFileSuggestions(lines: string[], cursorLine: number, cursorCol: number): Promise<{
15
+ items: AutocompleteItem[];
16
+ prefix: string;
17
+ } | null>;
18
+ shouldTriggerFileCompletion(lines: string[], cursorLine: number, cursorCol: number): boolean;
19
+ }
20
+ //# sourceMappingURL=combined-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combined-provider.d.ts","sourceRoot":"","sources":["../../../source/tui/autocomplete/combined-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,gBAAiB,YAAW,oBAAoB;IAC3D,OAAO,CAAC,SAAS,CAAyB;gBAE9B,SAAS,EAAE,oBAAoB,EAAE;IAIvC,cAAc,CAClB,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAehE,eAAe,CACb,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,GACb;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IAwBvD,uBAAuB,CAC3B,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAwBhE,2BAA2B,CACzB,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO;CAmBX"}
@@ -0,0 +1,61 @@
1
+ export class CombinedProvider {
2
+ providers;
3
+ constructor(providers) {
4
+ this.providers = providers;
5
+ }
6
+ async getSuggestions(lines, cursorLine, cursorCol) {
7
+ // Try each provider in order until we get suggestions
8
+ for (const provider of this.providers) {
9
+ const result = await provider.getSuggestions(lines, cursorLine, cursorCol);
10
+ if (result) {
11
+ return result;
12
+ }
13
+ }
14
+ return null;
15
+ }
16
+ applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
17
+ // Try each provider to find the one that can handle this completion
18
+ for (const provider of this.providers) {
19
+ const result = provider.applyCompletion(lines, cursorLine, cursorCol, item, prefix);
20
+ // If the result is different from input, this provider handled it
21
+ if (result.lines !== lines ||
22
+ result.cursorLine !== cursorLine ||
23
+ result.cursorCol !== cursorCol) {
24
+ return result;
25
+ }
26
+ }
27
+ // If no provider handled it, return unchanged
28
+ return { lines, cursorLine, cursorCol };
29
+ }
30
+ // Force file completion (called on Tab key) - always returns suggestions
31
+ async getForceFileSuggestions(lines, cursorLine, cursorCol) {
32
+ if (!this.shouldTriggerFileCompletion(lines, cursorLine, cursorCol)) {
33
+ return null;
34
+ }
35
+ // Try each provider that has getForceFileSuggestions method
36
+ for (const provider of this.providers) {
37
+ if ("getForceFileSuggestions" in provider &&
38
+ typeof provider.getForceFileSuggestions === "function") {
39
+ const result = await provider.getForceFileSuggestions(lines, cursorLine, cursorCol);
40
+ if (result) {
41
+ return result;
42
+ }
43
+ }
44
+ }
45
+ return null;
46
+ }
47
+ // Check if we should trigger file completion (called on Tab key)
48
+ shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
49
+ // Try each provider that has shouldTriggerFileCompletion method
50
+ for (const provider of this.providers) {
51
+ if ("shouldTriggerFileCompletion" in provider &&
52
+ typeof provider.shouldTriggerFileCompletion === "function") {
53
+ const result = provider.shouldTriggerFileCompletion(lines, cursorLine, cursorCol);
54
+ if (result === false) {
55
+ return false;
56
+ }
57
+ }
58
+ }
59
+ return true;
60
+ }
61
+ }
@@ -0,0 +1,20 @@
1
+ import type { AutocompleteItem, AutocompleteProvider } from "./base-provider.ts";
2
+ export interface SlashCommand {
3
+ name: string;
4
+ description?: string;
5
+ getArgumentCompletions?(argumentPrefix: string): AutocompleteItem[] | null;
6
+ }
7
+ export declare class CommandProvider<T extends SlashCommand | AutocompleteItem> implements AutocompleteProvider {
8
+ private commands;
9
+ constructor(commands?: T[]);
10
+ getSuggestions(lines: string[], cursorLine: number, cursorCol: number): Promise<{
11
+ items: AutocompleteItem[];
12
+ prefix: string;
13
+ } | null>;
14
+ applyCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
15
+ lines: string[];
16
+ cursorLine: number;
17
+ cursorCol: number;
18
+ };
19
+ }
20
+ //# sourceMappingURL=command-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-provider.d.ts","sourceRoot":"","sources":["../../../source/tui/autocomplete/command-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,sBAAsB,CAAC,CAAC,cAAc,EAAE,MAAM,GAAG,gBAAgB,EAAE,GAAG,IAAI,CAAC;CAC5E;AAED,qBAAa,eAAe,CAAC,CAAC,SAAS,YAAY,GAAG,gBAAgB,CACpE,YAAW,oBAAoB;IAE/B,OAAO,CAAC,QAAQ,CAAM;gBAEV,QAAQ,GAAE,CAAC,EAAO;IAIxB,cAAc,CAClB,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA8DhE,eAAe,CACb,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,GACb;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;CAwC9D"}
@@ -0,0 +1,90 @@
1
+ export class CommandProvider {
2
+ commands;
3
+ constructor(commands = []) {
4
+ this.commands = commands;
5
+ }
6
+ async getSuggestions(lines, cursorLine, cursorCol) {
7
+ const currentLine = lines[cursorLine] || "";
8
+ const textBeforeCursor = currentLine.slice(0, cursorCol);
9
+ // Check for slash commands
10
+ if (textBeforeCursor.startsWith("/")) {
11
+ const spaceIndex = textBeforeCursor.indexOf(" ");
12
+ if (spaceIndex === -1) {
13
+ // No space yet - complete command names
14
+ const prefix = textBeforeCursor.slice(1); // Remove the "/"
15
+ const filtered = this.commands
16
+ .filter((cmd) => {
17
+ const name = "name" in cmd ? cmd.name : cmd.value; // Check if SlashCommand or AutocompleteItem
18
+ return name?.toLowerCase().startsWith(prefix.toLowerCase());
19
+ })
20
+ .map((cmd) => ({
21
+ value: "name" in cmd ? cmd.name : cmd.value,
22
+ label: "name" in cmd ? cmd.name : cmd.label,
23
+ ...(cmd.description && { description: cmd.description }),
24
+ }));
25
+ if (filtered.length === 0)
26
+ return null;
27
+ return {
28
+ items: filtered,
29
+ prefix: prefix, // Return the actual prefix used for filtering (without "/")
30
+ };
31
+ }
32
+ // Space found - complete command arguments
33
+ const commandName = textBeforeCursor.slice(1, spaceIndex); // Command without "/"
34
+ const argumentText = textBeforeCursor.slice(spaceIndex + 1); // Text after space
35
+ const command = this.commands.find((cmd) => {
36
+ const name = "name" in cmd ? cmd.name : cmd.value;
37
+ return name === commandName;
38
+ });
39
+ if (!command ||
40
+ !("getArgumentCompletions" in command) ||
41
+ !command.getArgumentCompletions) {
42
+ return null; // No argument completion for this command
43
+ }
44
+ const argumentSuggestions = command.getArgumentCompletions?.(argumentText);
45
+ if (!argumentSuggestions || argumentSuggestions.length === 0) {
46
+ return null;
47
+ }
48
+ return {
49
+ items: argumentSuggestions,
50
+ prefix: argumentText,
51
+ };
52
+ }
53
+ return null;
54
+ }
55
+ applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
56
+ const currentLine = lines[cursorLine] || "";
57
+ const textBeforeCursor = currentLine.slice(0, cursorCol);
58
+ // Check if we're completing a slash command (prefix doesn't start with "/" but we're in slash command context)
59
+ if (textBeforeCursor.startsWith("/") && !textBeforeCursor.includes(" ")) {
60
+ // This is a command name completion
61
+ const beforePrefix = currentLine.slice(0, cursorCol - prefix.length);
62
+ const afterCursor = currentLine.slice(cursorCol);
63
+ const newLine = `${beforePrefix}${item.value} ${afterCursor}`;
64
+ const newLines = [...lines];
65
+ newLines[cursorLine] = newLine;
66
+ return {
67
+ lines: newLines,
68
+ cursorLine,
69
+ cursorCol: beforePrefix.length + item.value.length + 1, // +1 for space
70
+ };
71
+ }
72
+ // Check if we're in a slash command context (beforePrefix contains "/command ")
73
+ if (textBeforeCursor.includes("/") && textBeforeCursor.includes(" ")) {
74
+ // This is likely a command argument completion
75
+ const beforePrefix = currentLine.slice(0, cursorCol - prefix.length);
76
+ const afterCursor = currentLine.slice(cursorCol);
77
+ const newLine = beforePrefix + item.value + afterCursor;
78
+ const newLines = [...lines];
79
+ newLines[cursorLine] = newLine;
80
+ return {
81
+ lines: newLines,
82
+ cursorLine,
83
+ cursorCol: beforePrefix.length + item.value.length,
84
+ };
85
+ }
86
+ // If we get here, this provider shouldn't handle the completion
87
+ // Return unchanged to let other providers handle it
88
+ return { lines, cursorLine, cursorCol };
89
+ }
90
+ }
@@ -0,0 +1,16 @@
1
+ import type { AutocompleteItem, AutocompleteProvider } from "./base-provider.ts";
2
+ export declare class FileSearchProvider implements AutocompleteProvider {
3
+ private maxResults;
4
+ private maxDepth;
5
+ getSuggestions(lines: string[], cursorLine: number, cursorCol: number): Promise<{
6
+ items: AutocompleteItem[];
7
+ prefix: string;
8
+ } | null>;
9
+ applyCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
10
+ lines: string[];
11
+ cursorLine: number;
12
+ cursorCol: number;
13
+ };
14
+ private searchFiles;
15
+ }
16
+ //# sourceMappingURL=file-search-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-search-provider.d.ts","sourceRoot":"","sources":["../../../source/tui/autocomplete/file-search-provider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AA+B5B,qBAAa,kBAAmB,YAAW,oBAAoB;IAC7D,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,QAAQ,CAAK;IAEf,cAAc,CAClB,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAuBhE,eAAe,CACb,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,GACb;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;YAqB/C,WAAW;CA+D1B"}
@@ -0,0 +1,123 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { join, normalize, relative, resolve } from "node:path";
3
+ import { fdir } from "fdir";
4
+ import ignore from "../../utils/ignore.js";
5
+ const defaultIgnoredPatterns = [
6
+ "**/node_modules",
7
+ "**/dist",
8
+ "**/.git",
9
+ "**/coverage",
10
+ "**/flow-typed",
11
+ "**/.DS_Store",
12
+ "**/*.log",
13
+ "**/*.lock",
14
+ ];
15
+ async function loadGitignorePatterns(cwd) {
16
+ const gitignorePath = join(cwd, ".gitignore");
17
+ try {
18
+ const content = await readFile(gitignorePath, "utf8");
19
+ const patterns = [];
20
+ for (const line of content.split(/\r?\n/)) {
21
+ const trimmed = line.trim();
22
+ if (!trimmed || trimmed.startsWith("#")) {
23
+ continue;
24
+ }
25
+ patterns.push(trimmed);
26
+ }
27
+ return patterns;
28
+ }
29
+ catch {
30
+ return [];
31
+ }
32
+ }
33
+ export class FileSearchProvider {
34
+ maxResults = 20;
35
+ maxDepth = 3;
36
+ async getSuggestions(lines, cursorLine, cursorCol) {
37
+ const currentLine = lines[cursorLine] || "";
38
+ const textBeforeCursor = currentLine.slice(0, cursorCol);
39
+ const pathMatch = textBeforeCursor.match(/#([^\s]*)$/);
40
+ if (!pathMatch) {
41
+ return null;
42
+ }
43
+ const prefix = pathMatch[0];
44
+ const searchTerm = pathMatch[1];
45
+ const suggestions = await this.searchFiles(searchTerm);
46
+ if (suggestions.length === 0) {
47
+ return null;
48
+ }
49
+ return {
50
+ items: suggestions,
51
+ prefix,
52
+ };
53
+ }
54
+ applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
55
+ // Only handle completions that start with #
56
+ if (!prefix.startsWith("#")) {
57
+ return { lines, cursorLine, cursorCol };
58
+ }
59
+ const currentLine = lines[cursorLine] || "";
60
+ const beforePrefix = currentLine.slice(0, cursorCol - prefix.length);
61
+ const afterCursor = currentLine.slice(cursorCol);
62
+ const newLine = `${beforePrefix}${item.value} ${afterCursor}`;
63
+ const newLines = [...lines];
64
+ newLines[cursorLine] = newLine;
65
+ return {
66
+ lines: newLines,
67
+ cursorLine,
68
+ cursorCol: beforePrefix.length + item.value.length + 1,
69
+ };
70
+ }
71
+ async searchFiles(searchTerm) {
72
+ const results = [];
73
+ const cwd = process.cwd();
74
+ // Build ignore instance with .gitignore patterns + defaults
75
+ const ig = ignore().add(defaultIgnoredPatterns);
76
+ const gitignorePatterns = await loadGitignorePatterns(cwd);
77
+ if (gitignorePatterns.length > 0) {
78
+ ig.add(gitignorePatterns);
79
+ }
80
+ try {
81
+ const crawler = new fdir()
82
+ .withBasePath()
83
+ .withMaxDepth(this.maxDepth)
84
+ .exclude((dirName, dirPath) => {
85
+ const fullPath = dirPath ? `${dirPath}/${dirName}` : dirName;
86
+ const absolutePath = resolve(cwd, fullPath);
87
+ const relativePath = normalize(relative(cwd, absolutePath));
88
+ return ig.ignores(relativePath);
89
+ });
90
+ const files = await crawler.crawl(cwd).withPromise();
91
+ const lowerSearchTerm = searchTerm.toLowerCase();
92
+ const matches = files.filter((file) => file.toLowerCase().includes(lowerSearchTerm));
93
+ for (const match of matches) {
94
+ const absolutePath = resolve(cwd, match);
95
+ const relativePath = normalize(relative(cwd, absolutePath));
96
+ if (ig.ignores(relativePath)) {
97
+ continue;
98
+ }
99
+ const isDirectory = match.endsWith("/");
100
+ const pathWithoutTrailingSlash = isDirectory
101
+ ? match.slice(0, -1)
102
+ : match;
103
+ const label = pathWithoutTrailingSlash.split("/").pop() || pathWithoutTrailingSlash;
104
+ const parentPath = pathWithoutTrailingSlash
105
+ .split("/")
106
+ .slice(0, -1)
107
+ .join("/");
108
+ results.push({
109
+ value: isDirectory ? `${match} ` : match,
110
+ label,
111
+ description: parentPath || ".",
112
+ });
113
+ if (results.length >= this.maxResults) {
114
+ break;
115
+ }
116
+ }
117
+ }
118
+ catch {
119
+ // Directory doesn't exist or not accessible
120
+ }
121
+ return results;
122
+ }
123
+ }
@@ -0,0 +1,21 @@
1
+ import type { AutocompleteItem, AutocompleteProvider } from "./base-provider.ts";
2
+ export declare class PathProvider implements AutocompleteProvider {
3
+ protected allowedDirs: string[];
4
+ constructor(allowedDirs?: string[]);
5
+ getSuggestions(lines: string[], cursorLine: number, cursorCol: number): Promise<{
6
+ items: AutocompleteItem[];
7
+ prefix: string;
8
+ } | null>;
9
+ applyCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
10
+ lines: string[];
11
+ cursorLine: number;
12
+ cursorCol: number;
13
+ };
14
+ getForceFileSuggestions(lines: string[], cursorLine: number, cursorCol: number): Promise<{
15
+ items: AutocompleteItem[];
16
+ prefix: string;
17
+ } | null>;
18
+ shouldTriggerFileCompletion(lines: string[], cursorLine: number, cursorCol: number): boolean;
19
+ protected getFileSuggestions(prefix: string): Promise<AutocompleteItem[]>;
20
+ }
21
+ //# sourceMappingURL=path-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-provider.d.ts","sourceRoot":"","sources":["../../../source/tui/autocomplete/path-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAQ5B,qBAAa,YAAa,YAAW,oBAAoB;IACvD,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;gBAEpB,WAAW,GAAE,MAAM,EAAoB;IAI7C,cAAc,CAClB,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAoBhE,eAAe,CACb,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,GACb;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IAkBvD,uBAAuB,CAC3B,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAoBhE,2BAA2B,CACzB,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO;cAaM,kBAAkB,CAChC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAgH/B"}
@@ -0,0 +1,164 @@
1
+ import { basename, dirname, isAbsolute, join } from "node:path";
2
+ import { extractPathPrefix, getDirectoryEntries, isPathWithinAllowedDirs, } from "./utils.js";
3
+ export class PathProvider {
4
+ allowedDirs;
5
+ constructor(allowedDirs = [process.cwd()]) {
6
+ this.allowedDirs = allowedDirs;
7
+ }
8
+ async getSuggestions(lines, cursorLine, cursorCol) {
9
+ const currentLine = lines[cursorLine] || "";
10
+ const textBeforeCursor = currentLine.slice(0, cursorCol);
11
+ // Check for file paths - triggered by Tab or if we detect a path pattern
12
+ const pathMatch = extractPathPrefix(textBeforeCursor, false);
13
+ if (pathMatch !== null) {
14
+ const suggestions = await this.getFileSuggestions(pathMatch);
15
+ if (suggestions.length === 0)
16
+ return null;
17
+ return {
18
+ items: suggestions,
19
+ prefix: pathMatch,
20
+ };
21
+ }
22
+ return null;
23
+ }
24
+ applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
25
+ const currentLine = lines[cursorLine] || "";
26
+ const beforePrefix = currentLine.slice(0, cursorCol - prefix.length);
27
+ const afterCursor = currentLine.slice(cursorCol);
28
+ // For file paths, complete the path
29
+ const newLine = beforePrefix + item.value + afterCursor;
30
+ const newLines = [...lines];
31
+ newLines[cursorLine] = newLine;
32
+ return {
33
+ lines: newLines,
34
+ cursorLine,
35
+ cursorCol: beforePrefix.length + item.value.length,
36
+ };
37
+ }
38
+ // Force file completion (called on Tab key) - always returns suggestions
39
+ async getForceFileSuggestions(lines, cursorLine, cursorCol) {
40
+ const currentLine = lines[cursorLine] || "";
41
+ const textBeforeCursor = currentLine.slice(0, cursorCol);
42
+ // Force extract path prefix - this will always return something
43
+ const pathMatch = extractPathPrefix(textBeforeCursor, true);
44
+ if (pathMatch !== null) {
45
+ const suggestions = await this.getFileSuggestions(pathMatch);
46
+ if (suggestions.length === 0)
47
+ return null;
48
+ return {
49
+ items: suggestions,
50
+ prefix: pathMatch,
51
+ };
52
+ }
53
+ return null;
54
+ }
55
+ // Check if we should trigger file completion (called on Tab key)
56
+ shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
57
+ const currentLine = lines[cursorLine] || "";
58
+ const textBeforeCursor = currentLine.slice(0, cursorCol);
59
+ // Don't trigger if we're in a slash command
60
+ if (textBeforeCursor.startsWith("/") && !textBeforeCursor.includes(" ")) {
61
+ return false;
62
+ }
63
+ return true;
64
+ }
65
+ // Get file/directory suggestions for a given path prefix
66
+ async getFileSuggestions(prefix) {
67
+ try {
68
+ let searchDirs;
69
+ let searchPrefix;
70
+ if (prefix === "" || prefix === "./" || prefix === "../") {
71
+ searchDirs = this.allowedDirs;
72
+ searchPrefix = "";
73
+ }
74
+ else if (isAbsolute(prefix)) {
75
+ // Handle absolute paths
76
+ const isWithinAllowed = await isPathWithinAllowedDirs(prefix, this.allowedDirs);
77
+ if (!isWithinAllowed) {
78
+ return [];
79
+ }
80
+ if (prefix.endsWith("/")) {
81
+ searchDirs = [prefix];
82
+ searchPrefix = "";
83
+ }
84
+ else {
85
+ searchDirs = [dirname(prefix)];
86
+ searchPrefix = basename(prefix);
87
+ }
88
+ }
89
+ else if (prefix.endsWith("/")) {
90
+ // If prefix ends with /, show contents of that directory
91
+ // Try to find which allowed directory this path belongs to
92
+ const allowedDirs = [];
93
+ for (const allowedDir of this.allowedDirs) {
94
+ const resolvedPath = join(allowedDir, prefix);
95
+ const isWithinAllowed = await isPathWithinAllowedDirs(resolvedPath, this.allowedDirs);
96
+ if (isWithinAllowed) {
97
+ allowedDirs.push(resolvedPath);
98
+ }
99
+ }
100
+ if (allowedDirs.length === 0) {
101
+ return [];
102
+ }
103
+ searchDirs = allowedDirs;
104
+ searchPrefix = "";
105
+ }
106
+ else {
107
+ // Split into directory and file prefix
108
+ const dir = dirname(prefix);
109
+ const file = basename(prefix);
110
+ const allowedDirs = [];
111
+ for (const allowedDir of this.allowedDirs) {
112
+ const resolvedPath = join(allowedDir, dir);
113
+ const isWithinAllowed = await isPathWithinAllowedDirs(resolvedPath, this.allowedDirs);
114
+ if (isWithinAllowed) {
115
+ allowedDirs.push(resolvedPath);
116
+ }
117
+ }
118
+ if (allowedDirs.length === 0) {
119
+ return [];
120
+ }
121
+ searchDirs = allowedDirs;
122
+ searchPrefix = file;
123
+ }
124
+ const entries = await getDirectoryEntries(searchDirs);
125
+ const suggestions = [];
126
+ // Filter entries by prefix first (fast string operation)
127
+ const matchingEntries = entries.filter((entry) => entry.name.toLowerCase().startsWith(searchPrefix.toLowerCase()));
128
+ // Batch check allowed paths (reduces repeated realpath calls)
129
+ const validEntries = [];
130
+ for (const entry of matchingEntries) {
131
+ const fullPath = join(entry.parentPath, entry.name);
132
+ if (await isPathWithinAllowedDirs(fullPath, this.allowedDirs)) {
133
+ validEntries.push({ entry, fullPath });
134
+ }
135
+ }
136
+ for (const { entry, fullPath } of validEntries) {
137
+ // Use Dirent.isDirectory() - no extra stat() call needed
138
+ const isDirectory = entry.isDirectory();
139
+ suggestions.push({
140
+ value: isDirectory ? `${fullPath}/` : fullPath,
141
+ label: entry.name,
142
+ description: isDirectory
143
+ ? `directory ${entry.parentPath}`
144
+ : `file ${entry.parentPath}`,
145
+ });
146
+ }
147
+ // Sort directories first, then alphabetically
148
+ suggestions.sort((a, b) => {
149
+ const aIsDir = a.description === "directory";
150
+ const bIsDir = b.description === "directory";
151
+ if (aIsDir && !bIsDir)
152
+ return -1;
153
+ if (!aIsDir && bIsDir)
154
+ return 1;
155
+ return a.label.localeCompare(b.label);
156
+ });
157
+ return suggestions;
158
+ }
159
+ catch (_e) {
160
+ // Directory doesn't exist or not accessible
161
+ return [];
162
+ }
163
+ }
164
+ }
@@ -0,0 +1,16 @@
1
+ import type { Dirent } from "node:fs";
2
+ export declare class DirectoryCache {
3
+ private cache;
4
+ private ttl;
5
+ get(dir: string): Promise<Dirent[] | null>;
6
+ set(dir: string, entries: Dirent[]): void;
7
+ clear(): void;
8
+ }
9
+ export declare const directoryCache: DirectoryCache;
10
+ export interface DirentWithPath extends Dirent {
11
+ parentPath: string;
12
+ }
13
+ export declare function getDirectoryEntries(dirs: string[]): Promise<DirentWithPath[]>;
14
+ export declare function isPathWithinAllowedDirs(requestedPath: string, allowedDirs: string[]): Promise<boolean>;
15
+ export declare function extractPathPrefix(text: string, forceExtract?: boolean): string | null;
16
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/tui/autocomplete/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAKtC,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAA+D;IAC5E,OAAO,CAAC,GAAG,CAAQ;IAEb,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;IAQhD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAIzC,KAAK,IAAI,IAAI;CAGd;AAED,eAAO,MAAM,cAAc,gBAAuB,CAAC;AAGnD,MAAM,WAAW,cAAe,SAAQ,MAAM;IAC5C,UAAU,EAAE,MAAM,CAAC;CACpB;AAGD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EAAE,GACb,OAAO,CAAC,cAAc,EAAE,CAAC,CA4B3B;AA8BD,wBAAsB,uBAAuB,CAC3C,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAWlB;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,YAAY,UAAQ,GACnB,MAAM,GAAG,IAAI,CAgEf"}