@travisennis/acai 0.0.4 → 0.0.6

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 (433) hide show
  1. package/README.md +229 -8
  2. package/dist/agent/index.d.ts +119 -0
  3. package/dist/agent/index.d.ts.map +1 -0
  4. package/dist/agent/index.js +406 -0
  5. package/dist/agent/manual-loop.d.ts +41 -0
  6. package/dist/agent/manual-loop.d.ts.map +1 -0
  7. package/dist/agent/manual-loop.js +278 -0
  8. package/dist/api/exa/index.d.ts +177 -0
  9. package/dist/api/exa/index.d.ts.map +1 -0
  10. package/dist/api/exa/index.js +439 -0
  11. package/dist/cli.d.ts +5 -2
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +27 -33
  14. package/dist/commands/add-directory-command.d.ts +3 -0
  15. package/dist/commands/add-directory-command.d.ts.map +1 -0
  16. package/dist/commands/add-directory-command.js +85 -0
  17. package/dist/commands/application-log-command.d.ts +1 -0
  18. package/dist/commands/application-log-command.d.ts.map +1 -0
  19. package/dist/commands/application-log-command.js +39 -3
  20. package/dist/commands/clear-command.d.ts +1 -0
  21. package/dist/commands/clear-command.d.ts.map +1 -0
  22. package/dist/commands/clear-command.js +10 -3
  23. package/dist/commands/compact-command.d.ts +1 -0
  24. package/dist/commands/compact-command.d.ts.map +1 -0
  25. package/dist/commands/compact-command.js +16 -3
  26. package/dist/commands/context-command.d.ts +3 -0
  27. package/dist/commands/context-command.d.ts.map +1 -0
  28. package/dist/commands/context-command.js +183 -0
  29. package/dist/commands/copy-command.d.ts +1 -0
  30. package/dist/commands/copy-command.d.ts.map +1 -0
  31. package/dist/commands/copy-command.js +31 -2
  32. package/dist/commands/edit-command.d.ts +1 -0
  33. package/dist/commands/edit-command.d.ts.map +1 -0
  34. package/dist/commands/edit-command.js +40 -5
  35. package/dist/commands/edit-prompt-command.d.ts +2 -1
  36. package/dist/commands/edit-prompt-command.d.ts.map +1 -0
  37. package/dist/commands/edit-prompt-command.js +43 -7
  38. package/dist/commands/exit-command.d.ts +13 -2
  39. package/dist/commands/exit-command.d.ts.map +1 -0
  40. package/dist/commands/exit-command.js +34 -2
  41. package/dist/commands/files-command.d.ts +1 -0
  42. package/dist/commands/files-command.d.ts.map +1 -0
  43. package/dist/commands/files-command.js +66 -8
  44. package/dist/commands/generate-rules-command.d.ts +1 -0
  45. package/dist/commands/generate-rules-command.d.ts.map +1 -0
  46. package/dist/commands/generate-rules-command.js +315 -4
  47. package/dist/commands/handoff-command.d.ts +3 -0
  48. package/dist/commands/handoff-command.d.ts.map +1 -0
  49. package/dist/commands/handoff-command.js +202 -0
  50. package/dist/commands/health-command.d.ts +3 -1
  51. package/dist/commands/health-command.d.ts.map +1 -0
  52. package/dist/commands/health-command.js +160 -6
  53. package/dist/commands/help-command.d.ts +1 -0
  54. package/dist/commands/help-command.d.ts.map +1 -0
  55. package/dist/commands/help-command.js +30 -3
  56. package/dist/commands/history-command.d.ts +3 -0
  57. package/dist/commands/history-command.d.ts.map +1 -0
  58. package/dist/commands/history-command.js +534 -0
  59. package/dist/commands/init-command.d.ts +2 -1
  60. package/dist/commands/init-command.d.ts.map +1 -0
  61. package/dist/commands/init-command.js +56 -20
  62. package/dist/commands/last-log-command.d.ts +1 -0
  63. package/dist/commands/last-log-command.d.ts.map +1 -0
  64. package/dist/commands/last-log-command.js +39 -17
  65. package/dist/commands/list-directories-command.d.ts +3 -0
  66. package/dist/commands/list-directories-command.d.ts.map +1 -0
  67. package/dist/commands/list-directories-command.js +48 -0
  68. package/dist/commands/list-tools-command.d.ts +3 -0
  69. package/dist/commands/list-tools-command.d.ts.map +1 -0
  70. package/dist/commands/list-tools-command.js +124 -0
  71. package/dist/commands/manager.d.ts +20 -3
  72. package/dist/commands/manager.d.ts.map +1 -0
  73. package/dist/commands/manager.js +123 -26
  74. package/dist/commands/model-command.d.ts +23 -0
  75. package/dist/commands/model-command.d.ts.map +1 -0
  76. package/dist/commands/model-command.js +261 -5
  77. package/dist/commands/paste-command.d.ts +1 -0
  78. package/dist/commands/paste-command.d.ts.map +1 -0
  79. package/dist/commands/paste-command.js +98 -5
  80. package/dist/commands/pickup-command.d.ts +3 -0
  81. package/dist/commands/pickup-command.d.ts.map +1 -0
  82. package/dist/commands/pickup-command.js +161 -0
  83. package/dist/commands/prompt-command.d.ts +2 -1
  84. package/dist/commands/prompt-command.d.ts.map +1 -0
  85. package/dist/commands/prompt-command.js +178 -9
  86. package/dist/commands/remove-directory-command.d.ts +3 -0
  87. package/dist/commands/remove-directory-command.d.ts.map +1 -0
  88. package/dist/commands/remove-directory-command.js +87 -0
  89. package/dist/commands/reset-command.d.ts +2 -1
  90. package/dist/commands/reset-command.d.ts.map +1 -0
  91. package/dist/commands/reset-command.js +14 -3
  92. package/dist/commands/rules-command.d.ts +1 -0
  93. package/dist/commands/rules-command.d.ts.map +1 -0
  94. package/dist/commands/rules-command.js +70 -3
  95. package/dist/commands/save-command.d.ts +1 -0
  96. package/dist/commands/save-command.d.ts.map +1 -0
  97. package/dist/commands/save-command.js +13 -1
  98. package/dist/commands/shell-command.d.ts +3 -0
  99. package/dist/commands/shell-command.d.ts.map +1 -0
  100. package/dist/commands/shell-command.js +128 -0
  101. package/dist/commands/types.d.ts +16 -8
  102. package/dist/commands/types.d.ts.map +1 -0
  103. package/dist/commands/usage-command.d.ts +1 -0
  104. package/dist/commands/usage-command.d.ts.map +1 -0
  105. package/dist/commands/usage-command.js +24 -3
  106. package/dist/config.d.ts +21 -34
  107. package/dist/config.d.ts.map +1 -0
  108. package/dist/config.js +55 -15
  109. package/dist/dedent.d.ts +1 -0
  110. package/dist/dedent.d.ts.map +1 -0
  111. package/dist/execution/index.d.ts +112 -0
  112. package/dist/execution/index.d.ts.map +1 -0
  113. package/dist/execution/index.js +432 -0
  114. package/dist/formatting.d.ts +107 -10
  115. package/dist/formatting.d.ts.map +1 -0
  116. package/dist/formatting.js +150 -62
  117. package/dist/index.d.ts +8 -2
  118. package/dist/index.d.ts.map +1 -0
  119. package/dist/index.js +150 -38
  120. package/dist/logger.d.ts +1 -0
  121. package/dist/logger.d.ts.map +1 -0
  122. package/dist/logger.js +47 -18
  123. package/dist/mentions.d.ts +6 -1
  124. package/dist/mentions.d.ts.map +1 -0
  125. package/dist/mentions.js +58 -11
  126. package/dist/messages.d.ts +16 -20
  127. package/dist/messages.d.ts.map +1 -0
  128. package/dist/messages.js +89 -72
  129. package/dist/middleware/audit-message.d.ts +1 -0
  130. package/dist/middleware/audit-message.d.ts.map +1 -0
  131. package/dist/middleware/cache.d.ts +3 -0
  132. package/dist/middleware/cache.d.ts.map +1 -0
  133. package/dist/middleware/cache.js +53 -0
  134. package/dist/middleware/index.d.ts +2 -0
  135. package/dist/middleware/index.d.ts.map +1 -0
  136. package/dist/middleware/index.js +1 -0
  137. package/dist/middleware/rate-limit.d.ts +1 -0
  138. package/dist/middleware/rate-limit.d.ts.map +1 -0
  139. package/dist/models/ai-config.d.ts +5 -2
  140. package/dist/models/ai-config.d.ts.map +1 -0
  141. package/dist/models/ai-config.js +12 -2
  142. package/dist/models/anthropic-provider.d.ts +1 -0
  143. package/dist/models/anthropic-provider.d.ts.map +1 -0
  144. package/dist/models/anthropic-provider.js +3 -60
  145. package/dist/models/deepseek-provider.d.ts +1 -0
  146. package/dist/models/deepseek-provider.d.ts.map +1 -0
  147. package/dist/models/google-provider.d.ts +1 -0
  148. package/dist/models/google-provider.d.ts.map +1 -0
  149. package/dist/models/groq-provider.d.ts +20 -0
  150. package/dist/models/groq-provider.d.ts.map +1 -0
  151. package/dist/models/groq-provider.js +31 -0
  152. package/dist/models/manager.d.ts +3 -1
  153. package/dist/models/manager.d.ts.map +1 -0
  154. package/dist/models/manager.js +26 -2
  155. package/dist/models/openai-provider.d.ts +2 -1
  156. package/dist/models/openai-provider.d.ts.map +1 -0
  157. package/dist/models/openrouter-provider.d.ts +25 -23
  158. package/dist/models/openrouter-provider.d.ts.map +1 -0
  159. package/dist/models/openrouter-provider.js +181 -122
  160. package/dist/models/providers.d.ts +4 -5
  161. package/dist/models/providers.d.ts.map +1 -0
  162. package/dist/models/providers.js +7 -3
  163. package/dist/models/xai-provider.d.ts +1 -0
  164. package/dist/models/xai-provider.d.ts.map +1 -0
  165. package/dist/parsing.d.ts +2 -1
  166. package/dist/parsing.d.ts.map +1 -0
  167. package/dist/prompts/manager.d.ts +14 -2
  168. package/dist/prompts/manager.d.ts.map +1 -0
  169. package/dist/prompts.d.ts +2 -0
  170. package/dist/prompts.d.ts.map +1 -0
  171. package/dist/prompts.js +65 -12
  172. package/dist/repl/display-tool-messages.d.ts +4 -0
  173. package/dist/repl/display-tool-messages.d.ts.map +1 -0
  174. package/dist/repl/display-tool-messages.js +58 -0
  175. package/dist/repl/display-tool-use.d.ts +14 -0
  176. package/dist/repl/display-tool-use.d.ts.map +1 -0
  177. package/dist/repl/display-tool-use.js +63 -0
  178. package/dist/repl/get-prompt-header.d.ts +8 -0
  179. package/dist/repl/get-prompt-header.d.ts.map +1 -0
  180. package/dist/repl/get-prompt-header.js +9 -0
  181. package/dist/repl/project-status-line.d.ts +2 -0
  182. package/dist/repl/project-status-line.d.ts.map +1 -0
  183. package/dist/repl/project-status-line.js +31 -0
  184. package/dist/repl/prompt.d.ts +21 -0
  185. package/dist/repl/prompt.d.ts.map +1 -0
  186. package/dist/{repl-prompt.js → repl/prompt.js} +119 -22
  187. package/dist/repl/tool-call-repair.d.ts +4 -0
  188. package/dist/repl/tool-call-repair.d.ts.map +1 -0
  189. package/dist/repl/tool-call-repair.js +54 -0
  190. package/dist/repl-new.d.ts +53 -0
  191. package/dist/repl-new.d.ts.map +1 -0
  192. package/dist/repl-new.js +374 -0
  193. package/dist/repl.d.ts +9 -7
  194. package/dist/repl.d.ts.map +1 -0
  195. package/dist/repl.js +142 -378
  196. package/dist/terminal/ansi-styles.d.ts +77 -0
  197. package/dist/terminal/ansi-styles.d.ts.map +1 -0
  198. package/dist/terminal/ansi-styles.js +215 -0
  199. package/dist/terminal/checkbox-prompt.d.ts +36 -0
  200. package/dist/terminal/checkbox-prompt.d.ts.map +1 -0
  201. package/dist/terminal/checkbox-prompt.js +368 -0
  202. package/dist/terminal/default-theme.d.ts +6 -0
  203. package/dist/terminal/default-theme.d.ts.map +1 -0
  204. package/dist/terminal/default-theme.js +182 -0
  205. package/dist/terminal/east-asian-width.d.ts +8 -0
  206. package/dist/terminal/east-asian-width.d.ts.map +1 -0
  207. package/dist/terminal/east-asian-width.js +409 -0
  208. package/dist/terminal/editor-prompt.d.ts +10 -0
  209. package/dist/terminal/editor-prompt.d.ts.map +1 -0
  210. package/dist/terminal/editor-prompt.js +61 -0
  211. package/dist/terminal/errors.d.ts +19 -0
  212. package/dist/terminal/errors.d.ts.map +1 -0
  213. package/dist/terminal/errors.js +37 -0
  214. package/dist/terminal/formatting.d.ts +1 -11
  215. package/dist/terminal/formatting.d.ts.map +1 -0
  216. package/dist/terminal/formatting.js +4 -20
  217. package/dist/terminal/highlight/index.d.ts +53 -0
  218. package/dist/terminal/highlight/index.d.ts.map +1 -0
  219. package/dist/terminal/highlight/index.js +90 -0
  220. package/dist/terminal/highlight/theme.d.ts +233 -0
  221. package/dist/terminal/highlight/theme.d.ts.map +1 -0
  222. package/dist/terminal/highlight/theme.js +83 -0
  223. package/dist/terminal/index.d.ts +23 -9
  224. package/dist/terminal/index.d.ts.map +1 -0
  225. package/dist/terminal/index.js +136 -126
  226. package/dist/terminal/input-prompt.d.ts +17 -0
  227. package/dist/terminal/input-prompt.d.ts.map +1 -0
  228. package/dist/terminal/input-prompt.js +181 -0
  229. package/dist/terminal/markdown-utils.d.ts +1 -0
  230. package/dist/terminal/markdown-utils.d.ts.map +1 -0
  231. package/dist/terminal/markdown.d.ts +1 -0
  232. package/dist/terminal/markdown.d.ts.map +1 -0
  233. package/dist/terminal/markdown.js +20 -12
  234. package/dist/terminal/search-prompt.d.ts +20 -0
  235. package/dist/terminal/search-prompt.d.ts.map +1 -0
  236. package/dist/terminal/search-prompt.js +280 -0
  237. package/dist/terminal/select-prompt.d.ts +26 -0
  238. package/dist/terminal/select-prompt.d.ts.map +1 -0
  239. package/dist/terminal/select-prompt.js +306 -0
  240. package/dist/terminal/string-width.d.ts +7 -0
  241. package/dist/terminal/string-width.d.ts.map +1 -0
  242. package/dist/terminal/string-width.js +61 -0
  243. package/dist/terminal/strip-ansi.d.ts +2 -0
  244. package/dist/terminal/strip-ansi.d.ts.map +1 -0
  245. package/dist/terminal/strip-ansi.js +20 -0
  246. package/dist/terminal/style.d.ts +191 -0
  247. package/dist/terminal/style.d.ts.map +1 -0
  248. package/dist/terminal/style.js +259 -0
  249. package/dist/terminal/supports-color.d.ts +1 -0
  250. package/dist/terminal/supports-color.d.ts.map +1 -0
  251. package/dist/terminal/supports-hyperlinks.d.ts +1 -3
  252. package/dist/terminal/supports-hyperlinks.d.ts.map +1 -0
  253. package/dist/terminal/supports-hyperlinks.js +1 -1
  254. package/dist/terminal/types.d.ts +1 -37
  255. package/dist/terminal/types.d.ts.map +1 -0
  256. package/dist/terminal/wrap-ansi.d.ts +8 -0
  257. package/dist/terminal/wrap-ansi.d.ts.map +1 -0
  258. package/dist/terminal/wrap-ansi.js +190 -0
  259. package/dist/{token-utils.d.ts → tokens/counter.d.ts} +1 -0
  260. package/dist/tokens/counter.d.ts.map +1 -0
  261. package/dist/{token-utils.js → tokens/counter.js} +1 -1
  262. package/dist/tokens/threshold.d.ts +35 -0
  263. package/dist/tokens/threshold.d.ts.map +1 -0
  264. package/dist/tokens/threshold.js +85 -0
  265. package/dist/{token-tracker.d.ts → tokens/tracker.d.ts} +1 -0
  266. package/dist/tokens/tracker.d.ts.map +1 -0
  267. package/dist/tools/advanced-edit-file.d.ts +69 -0
  268. package/dist/tools/advanced-edit-file.d.ts.map +1 -0
  269. package/dist/tools/advanced-edit-file.js +281 -0
  270. package/dist/tools/agent.d.ts +19 -7
  271. package/dist/tools/agent.d.ts.map +1 -0
  272. package/dist/tools/agent.js +70 -54
  273. package/dist/tools/bash-utils.d.ts +7 -0
  274. package/dist/tools/bash-utils.d.ts.map +1 -0
  275. package/dist/tools/bash-utils.js +220 -0
  276. package/dist/tools/bash.d.ts +25 -14
  277. package/dist/tools/bash.d.ts.map +1 -0
  278. package/dist/tools/bash.js +87 -251
  279. package/dist/tools/code-interpreter.d.ts +22 -10
  280. package/dist/tools/code-interpreter.d.ts.map +1 -0
  281. package/dist/tools/code-interpreter.js +146 -210
  282. package/dist/tools/delete-file.d.ts +18 -9
  283. package/dist/tools/delete-file.d.ts.map +1 -0
  284. package/dist/tools/delete-file.js +55 -85
  285. package/dist/tools/directory-tree.d.ts +26 -6
  286. package/dist/tools/directory-tree.d.ts.map +1 -0
  287. package/dist/tools/directory-tree.js +109 -28
  288. package/dist/tools/dynamic-tool-loader.d.ts +22 -0
  289. package/dist/tools/dynamic-tool-loader.d.ts.map +1 -0
  290. package/dist/tools/dynamic-tool-loader.js +272 -0
  291. package/dist/tools/dynamic-tool-parser.d.ts +21 -0
  292. package/dist/tools/dynamic-tool-parser.d.ts.map +1 -0
  293. package/dist/tools/dynamic-tool-parser.js +22 -0
  294. package/dist/tools/edit-file.d.ts +41 -13
  295. package/dist/tools/edit-file.d.ts.map +1 -0
  296. package/dist/tools/edit-file.js +173 -96
  297. package/dist/tools/filesystem-utils.d.ts +7 -21
  298. package/dist/tools/filesystem-utils.d.ts.map +1 -0
  299. package/dist/tools/filesystem-utils.js +111 -149
  300. package/dist/tools/git-utils.d.ts +1 -0
  301. package/dist/tools/git-utils.d.ts.map +1 -0
  302. package/dist/tools/glob.d.ts +36 -0
  303. package/dist/tools/glob.d.ts.map +1 -0
  304. package/dist/tools/glob.js +143 -0
  305. package/dist/tools/grep.d.ts +76 -13
  306. package/dist/tools/grep.d.ts.map +1 -0
  307. package/dist/tools/grep.js +420 -135
  308. package/dist/tools/index.d.ts +207 -133
  309. package/dist/tools/index.d.ts.map +1 -0
  310. package/dist/tools/index.js +245 -127
  311. package/dist/tools/llm-edit-fixer.d.ts +25 -0
  312. package/dist/tools/llm-edit-fixer.d.ts.map +1 -0
  313. package/dist/tools/llm-edit-fixer.js +150 -0
  314. package/dist/tools/move-file.d.ts +20 -7
  315. package/dist/tools/move-file.d.ts.map +1 -0
  316. package/dist/tools/move-file.js +43 -29
  317. package/dist/tools/read-file.d.ts +49 -10
  318. package/dist/tools/read-file.d.ts.map +1 -0
  319. package/dist/tools/read-file.js +79 -67
  320. package/dist/tools/read-multiple-files.d.ts +19 -7
  321. package/dist/tools/read-multiple-files.d.ts.map +1 -0
  322. package/dist/tools/read-multiple-files.js +117 -33
  323. package/dist/tools/save-file.d.ts +46 -11
  324. package/dist/tools/save-file.d.ts.map +1 -0
  325. package/dist/tools/save-file.js +63 -78
  326. package/dist/tools/think.d.ts +16 -7
  327. package/dist/tools/think.d.ts.map +1 -0
  328. package/dist/tools/think.js +34 -22
  329. package/dist/tools/types.d.ts +18 -11
  330. package/dist/tools/types.d.ts.map +1 -0
  331. package/dist/tools/types.js +9 -0
  332. package/dist/tools/utils.d.ts +14 -0
  333. package/dist/tools/utils.d.ts.map +1 -0
  334. package/dist/tools/utils.js +16 -0
  335. package/dist/tools/web-fetch.d.ts +15 -6
  336. package/dist/tools/web-fetch.d.ts.map +1 -0
  337. package/dist/tools/web-fetch.js +40 -39
  338. package/dist/tools/web-search.d.ts +17 -7
  339. package/dist/tools/web-search.d.ts.map +1 -0
  340. package/dist/tools/web-search.js +86 -33
  341. package/dist/tui/autocomplete.d.ts +44 -0
  342. package/dist/tui/autocomplete.d.ts.map +1 -0
  343. package/dist/tui/autocomplete.js +466 -0
  344. package/dist/tui/components/assistant-message.d.ts +18 -0
  345. package/dist/tui/components/assistant-message.d.ts.map +1 -0
  346. package/dist/tui/components/assistant-message.js +29 -0
  347. package/dist/tui/components/editor.d.ts +51 -0
  348. package/dist/tui/components/editor.d.ts.map +1 -0
  349. package/dist/tui/components/editor.js +758 -0
  350. package/dist/tui/components/footer.d.ts +24 -0
  351. package/dist/tui/components/footer.d.ts.map +1 -0
  352. package/dist/tui/components/footer.js +197 -0
  353. package/dist/tui/components/input.d.ts +14 -0
  354. package/dist/tui/components/input.d.ts.map +1 -0
  355. package/dist/tui/components/input.js +122 -0
  356. package/dist/tui/components/loader.d.ts +19 -0
  357. package/dist/tui/components/loader.d.ts.map +1 -0
  358. package/dist/tui/components/loader.js +45 -0
  359. package/dist/tui/components/markdown.d.ts +103 -0
  360. package/dist/tui/components/markdown.d.ts.map +1 -0
  361. package/dist/tui/components/markdown.js +533 -0
  362. package/dist/tui/components/modal.d.ts +40 -0
  363. package/dist/tui/components/modal.d.ts.map +1 -0
  364. package/dist/tui/components/modal.js +292 -0
  365. package/dist/tui/components/prompt-status.d.ts +16 -0
  366. package/dist/tui/components/prompt-status.d.ts.map +1 -0
  367. package/dist/tui/components/prompt-status.js +21 -0
  368. package/dist/tui/components/select-list.d.ts +22 -0
  369. package/dist/tui/components/select-list.d.ts.map +1 -0
  370. package/dist/tui/components/select-list.js +143 -0
  371. package/dist/tui/components/spacer.d.ts +16 -0
  372. package/dist/tui/components/spacer.d.ts.map +1 -0
  373. package/dist/tui/components/spacer.js +27 -0
  374. package/dist/tui/components/text.d.ts +26 -0
  375. package/dist/tui/components/text.d.ts.map +1 -0
  376. package/dist/tui/components/text.js +143 -0
  377. package/dist/tui/components/thinking-block.d.ts +14 -0
  378. package/dist/tui/components/thinking-block.d.ts.map +1 -0
  379. package/dist/tui/components/thinking-block.js +30 -0
  380. package/dist/tui/components/tool-execution.d.ts +17 -0
  381. package/dist/tui/components/tool-execution.d.ts.map +1 -0
  382. package/dist/tui/components/tool-execution.js +153 -0
  383. package/dist/tui/components/user-message.d.ts +9 -0
  384. package/dist/tui/components/user-message.d.ts.map +1 -0
  385. package/dist/tui/components/user-message.js +21 -0
  386. package/dist/tui/components/welcome.d.ts +6 -0
  387. package/dist/tui/components/welcome.d.ts.map +1 -0
  388. package/dist/tui/components/welcome.js +30 -0
  389. package/dist/tui/index.d.ts +14 -0
  390. package/dist/tui/index.d.ts.map +1 -0
  391. package/dist/tui/index.js +18 -0
  392. package/dist/tui/terminal.d.ts +37 -0
  393. package/dist/tui/terminal.d.ts.map +1 -0
  394. package/dist/tui/terminal.js +104 -0
  395. package/dist/tui/tui.d.ts +67 -0
  396. package/dist/tui/tui.d.ts.map +1 -0
  397. package/dist/tui/tui.js +184 -0
  398. package/dist/tui/utils.d.ts +19 -0
  399. package/dist/tui/utils.d.ts.map +1 -0
  400. package/dist/tui/utils.js +31 -0
  401. package/dist/utils/filesystem.d.ts +23 -0
  402. package/dist/utils/filesystem.d.ts.map +1 -0
  403. package/dist/utils/filesystem.js +140 -0
  404. package/dist/utils/filetype-detection.d.ts +3 -0
  405. package/dist/utils/filetype-detection.d.ts.map +1 -0
  406. package/dist/utils/filetype-detection.js +112 -0
  407. package/dist/utils/generators.d.ts +3 -0
  408. package/dist/utils/generators.d.ts.map +1 -0
  409. package/dist/utils/generators.js +25 -0
  410. package/dist/utils/glob.d.ts +52 -0
  411. package/dist/utils/glob.d.ts.map +1 -0
  412. package/dist/utils/glob.js +376 -0
  413. package/dist/utils/ignore.d.ts +104 -0
  414. package/dist/utils/ignore.d.ts.map +1 -0
  415. package/dist/utils/ignore.js +649 -0
  416. package/dist/utils/iterables.d.ts +2 -0
  417. package/dist/utils/iterables.d.ts.map +1 -0
  418. package/dist/utils/iterables.js +6 -0
  419. package/dist/utils/process.d.ts +3 -2
  420. package/dist/utils/process.d.ts.map +1 -0
  421. package/dist/utils/process.js +17 -2
  422. package/dist/utils/zod-utils.d.ts +4 -0
  423. package/dist/utils/zod-utils.d.ts.map +1 -0
  424. package/dist/utils/zod-utils.js +7 -0
  425. package/dist/version.d.ts +1 -0
  426. package/dist/version.d.ts.map +1 -0
  427. package/package.json +34 -32
  428. package/dist/conversation-analyzer.d.ts +0 -10
  429. package/dist/conversation-analyzer.js +0 -88
  430. package/dist/repl-prompt.d.ts +0 -14
  431. package/dist/tools/command-validation.d.ts +0 -11
  432. package/dist/tools/command-validation.js +0 -45
  433. /package/dist/{token-tracker.js → tokens/tracker.js} +0 -0
@@ -0,0 +1,24 @@
1
+ import type { AgentState } from "../../agent/index.ts";
2
+ import { Container } from "../tui.ts";
3
+ /**
4
+ * Footer component that shows pwd, token stats, and context usage
5
+ */
6
+ export declare class FooterComponent extends Container {
7
+ private state;
8
+ constructor(state: AgentState);
9
+ updateState(state: AgentState): void;
10
+ render(width: number): string[];
11
+ }
12
+ interface MinimalStep {
13
+ toolResults: Array<{
14
+ toolName: string;
15
+ }>;
16
+ toolCalls: Array<{
17
+ toolName: string;
18
+ }>;
19
+ }
20
+ export declare function displayToolUse(result: {
21
+ steps: MinimalStep[];
22
+ }): string[];
23
+ export {};
24
+ //# sourceMappingURL=footer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../source/tui/components/footer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,qBAAa,eAAgB,SAAQ,SAAS;IAC5C,OAAO,CAAC,KAAK,CAAa;gBAEd,KAAK,EAAE,UAAU;IAK7B,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAI3B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CAwIzC;AAGD,UAAU,WAAW;IACnB,WAAW,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzC,SAAS,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxC;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,WAAW,EAAE,CAAA;CAAE,YA6E9D"}
@@ -0,0 +1,197 @@
1
+ import { formatDuration } from "../../formatting.js";
2
+ import { hr } from "../../terminal/index.js";
3
+ import style from "../../terminal/style.js";
4
+ import { Container } from "../tui.js";
5
+ /**
6
+ * Footer component that shows pwd, token stats, and context usage
7
+ */
8
+ export class FooterComponent extends Container {
9
+ state;
10
+ constructor(state) {
11
+ super();
12
+ this.state = state;
13
+ }
14
+ updateState(state) {
15
+ this.state = state;
16
+ }
17
+ render(width) {
18
+ const results = [];
19
+ if (this.state.steps.length === 0) {
20
+ return results;
21
+ }
22
+ results.push(hr(width));
23
+ // Create a more visual representation of steps/tool usage
24
+ results.push(...displayToolUse(this.state));
25
+ let status = `Steps: ${this.state.steps.length} - `;
26
+ // Show time spend on this prompt
27
+ status += `Time: ${formatDuration(this.state.timestamps.stop - this.state.timestamps.start)} - `;
28
+ const total = this.state.totalUsage;
29
+ const inputTokens = total.inputTokens;
30
+ const outputTokens = total.outputTokens;
31
+ const cachedInputTokens = total.cachedInputTokens;
32
+ const tokenSummary = `Tokens: ↑ ${inputTokens} (${cachedInputTokens}) ↓ ${outputTokens} - `;
33
+ status += tokenSummary;
34
+ const inputCost = this.state.modelConfig.costPerInputToken * inputTokens;
35
+ const outputCost = this.state.modelConfig.costPerOutputToken * outputTokens;
36
+ status += `Cost: $${(inputCost + outputCost).toFixed(2)}`;
37
+ results.push(style.dim(status));
38
+ return results;
39
+ // // Calculate cumulative usage from all assistant messages
40
+ // let totalInput = 0;
41
+ // let totalOutput = 0;
42
+ // let totalCacheRead = 0;
43
+ // let totalCacheWrite = 0;
44
+ // let totalCost = 0;
45
+ // for (const message of this.state.messages) {
46
+ // if (message.role === "assistant") {
47
+ // const assistantMsg = message as AssistantMessage;
48
+ // totalInput += assistantMsg.usage.input;
49
+ // totalOutput += assistantMsg.usage.output;
50
+ // totalCacheRead += assistantMsg.usage.cacheRead;
51
+ // totalCacheWrite += assistantMsg.usage.cacheWrite;
52
+ // totalCost += assistantMsg.usage.cost.total;
53
+ // }
54
+ // }
55
+ // // Get last assistant message for context percentage calculation (skip aborted messages)
56
+ // const lastAssistantMessage = this.state.messages
57
+ // .slice()
58
+ // .reverse()
59
+ // .find((m) => m.role === "assistant" && m.stopReason !== "aborted") as
60
+ // | AssistantMessage
61
+ // | undefined;
62
+ // // Calculate context percentage from last message (input + output + cacheRead + cacheWrite)
63
+ // const contextTokens = lastAssistantMessage
64
+ // ? lastAssistantMessage.usage.input +
65
+ // lastAssistantMessage.usage.output +
66
+ // lastAssistantMessage.usage.cacheRead +
67
+ // lastAssistantMessage.usage.cacheWrite
68
+ // : 0;
69
+ // const contextWindow = this.state.model.contextWindow;
70
+ // const contextPercent =
71
+ // contextWindow > 0
72
+ // ? ((contextTokens / contextWindow) * 100).toFixed(1)
73
+ // : "0.0";
74
+ // // Format token counts (similar to web-ui)
75
+ // const formatTokens = (count: number): string => {
76
+ // if (count < 1000) return count.toString();
77
+ // if (count < 10000) return (count / 1000).toFixed(1) + "k";
78
+ // return Math.round(count / 1000) + "k";
79
+ // };
80
+ // // Replace home directory with ~
81
+ // let pwd = process.cwd();
82
+ // const home = process.env.HOME || process.env.USERPROFILE;
83
+ // if (home && pwd.startsWith(home)) {
84
+ // pwd = "~" + pwd.slice(home.length);
85
+ // }
86
+ // // Truncate path if too long to fit width
87
+ // const maxPathLength = Math.max(20, width - 10); // Leave some margin
88
+ // if (pwd.length > maxPathLength) {
89
+ // const start = pwd.slice(0, Math.floor(maxPathLength / 2) - 2);
90
+ // const end = pwd.slice(-(Math.floor(maxPathLength / 2) - 1));
91
+ // pwd = `${start}...${end}`;
92
+ // }
93
+ // // Build stats line
94
+ // const statsParts = [];
95
+ // if (totalInput) statsParts.push(`↑${formatTokens(totalInput)}`);
96
+ // if (totalOutput) statsParts.push(`↓${formatTokens(totalOutput)}`);
97
+ // if (totalCacheRead) statsParts.push(`R${formatTokens(totalCacheRead)}`);
98
+ // if (totalCacheWrite) statsParts.push(`W${formatTokens(totalCacheWrite)}`);
99
+ // if (totalCost) statsParts.push(`$${totalCost.toFixed(3)}`);
100
+ // statsParts.push(`${contextPercent}%`);
101
+ // const statsLeft = statsParts.join(" ");
102
+ // // Add model name on the right side
103
+ // let modelName = this.state.model.id;
104
+ // const statsLeftWidth = visibleWidth(statsLeft);
105
+ // const modelWidth = visibleWidth(modelName);
106
+ // // Calculate available space for padding (minimum 2 spaces between stats and model)
107
+ // const minPadding = 2;
108
+ // const totalNeeded = statsLeftWidth + minPadding + modelWidth;
109
+ // let statsLine: string;
110
+ // if (totalNeeded <= width) {
111
+ // // Both fit - add padding to right-align model
112
+ // const padding = " ".repeat(width - statsLeftWidth - modelWidth);
113
+ // statsLine = statsLeft + padding + modelName;
114
+ // } else {
115
+ // // Need to truncate model name
116
+ // const availableForModel = width - statsLeftWidth - minPadding;
117
+ // if (availableForModel > 3) {
118
+ // // Truncate model name to fit
119
+ // modelName = modelName.substring(0, availableForModel);
120
+ // const padding = " ".repeat(
121
+ // width - statsLeftWidth - visibleWidth(modelName),
122
+ // );
123
+ // statsLine = statsLeft + padding + modelName;
124
+ // } else {
125
+ // // Not enough space for model name at all
126
+ // statsLine = statsLeft;
127
+ // }
128
+ // }
129
+ // // Return two lines: pwd and stats
130
+ // return [chalk.gray(pwd), chalk.gray(statsLine)];
131
+ }
132
+ }
133
+ export function displayToolUse(result) {
134
+ const toolsCalled = [];
135
+ const toolColors = new Map();
136
+ const styleColors = [
137
+ "red",
138
+ "green",
139
+ "yellow",
140
+ "blue",
141
+ "magenta",
142
+ "cyan",
143
+ "white",
144
+ "gray",
145
+ "redBright",
146
+ "greenBright",
147
+ "yellowBright",
148
+ "blueBright",
149
+ "magentaBright",
150
+ "cyanBright",
151
+ "whiteBright",
152
+ "blackBright",
153
+ ];
154
+ const results = [];
155
+ for (const step of result.steps) {
156
+ let currentToolCalls = [];
157
+ if (step.toolResults.length > 0) {
158
+ currentToolCalls = step.toolResults;
159
+ }
160
+ else if (step.toolCalls.length > 0) {
161
+ currentToolCalls = step.toolCalls;
162
+ }
163
+ for (const toolCallOrResult of currentToolCalls) {
164
+ const toolName = toolCallOrResult.toolName;
165
+ if (!toolColors.has(toolName)) {
166
+ const availableColors = styleColors.filter((color) => !Array.from(toolColors.values()).some((c) => c === style[color]));
167
+ const color = availableColors.length > 0
168
+ ? (availableColors[Math.floor(Math.random() * availableColors.length)] ?? "white")
169
+ : "white";
170
+ toolColors.set(toolName, style[color]);
171
+ }
172
+ toolsCalled.push(toolName);
173
+ }
174
+ }
175
+ if (toolsCalled.length > 0) {
176
+ results.push(style.dim("Tools:"));
177
+ let toolBlocks = "";
178
+ for (const toolCalled of toolsCalled) {
179
+ const colorFn = toolColors.get(toolCalled) ?? style.white;
180
+ toolBlocks += `${colorFn("██")} `;
181
+ }
182
+ results.push(toolBlocks);
183
+ results.push("");
184
+ let toolLegend = "";
185
+ const uniqueTools = new Set(toolsCalled);
186
+ for (const [index, toolCalled] of Array.from(uniqueTools).entries()) {
187
+ const colorFn = toolColors.get(toolCalled) ?? style.white;
188
+ toolLegend += colorFn(toolCalled);
189
+ if (index < new Set(toolsCalled).size - 1) {
190
+ toolLegend += " - ";
191
+ }
192
+ }
193
+ results.push(toolLegend);
194
+ results.push("");
195
+ }
196
+ return results;
197
+ }
@@ -0,0 +1,14 @@
1
+ import type { Component } from "../tui.ts";
2
+ /**
3
+ * Input component - single-line text input with horizontal scrolling
4
+ */
5
+ export declare class Input implements Component {
6
+ private value;
7
+ private cursor;
8
+ onSubmit?: (value: string) => void;
9
+ getValue(): string;
10
+ setValue(value: string): void;
11
+ handleInput(data: string): void;
12
+ render(width: number): string[];
13
+ }
14
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../source/tui/components/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C;;GAEG;AACH,qBAAa,KAAM,YAAW,SAAS;IACrC,OAAO,CAAC,KAAK,CAAM;IACnB,OAAO,CAAC,MAAM,CAAK;IACZ,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAE1C,QAAQ,IAAI,MAAM;IAIlB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAiE/B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CAuDhC"}
@@ -0,0 +1,122 @@
1
+ import { visibleWidth } from "../utils.js";
2
+ /**
3
+ * Input component - single-line text input with horizontal scrolling
4
+ */
5
+ export class Input {
6
+ value = "";
7
+ cursor = 0; // Cursor position in the value
8
+ onSubmit;
9
+ getValue() {
10
+ return this.value;
11
+ }
12
+ setValue(value) {
13
+ this.value = value;
14
+ this.cursor = Math.min(this.cursor, value.length);
15
+ }
16
+ handleInput(data) {
17
+ // Handle special keys
18
+ if (data === "\r" || data === "\n") {
19
+ // Enter - submit
20
+ if (this.onSubmit) {
21
+ this.onSubmit(this.value);
22
+ }
23
+ return;
24
+ }
25
+ if (data === "\x7f" || data === "\x08") {
26
+ // Backspace
27
+ if (this.cursor > 0) {
28
+ this.value =
29
+ this.value.slice(0, this.cursor - 1) + this.value.slice(this.cursor);
30
+ this.cursor--;
31
+ }
32
+ return;
33
+ }
34
+ if (data === "\x1b[D") {
35
+ // Left arrow
36
+ if (this.cursor > 0) {
37
+ this.cursor--;
38
+ }
39
+ return;
40
+ }
41
+ if (data === "\x1b[C") {
42
+ // Right arrow
43
+ if (this.cursor < this.value.length) {
44
+ this.cursor++;
45
+ }
46
+ return;
47
+ }
48
+ if (data === "\x1b[3~") {
49
+ // Delete
50
+ if (this.cursor < this.value.length) {
51
+ this.value =
52
+ this.value.slice(0, this.cursor) + this.value.slice(this.cursor + 1);
53
+ }
54
+ return;
55
+ }
56
+ if (data === "\x01") {
57
+ // Ctrl+A - beginning of line
58
+ this.cursor = 0;
59
+ return;
60
+ }
61
+ if (data === "\x05") {
62
+ // Ctrl+E - end of line
63
+ this.cursor = this.value.length;
64
+ return;
65
+ }
66
+ // Regular character input
67
+ if (data.length === 1 && data >= " " && data <= "~") {
68
+ this.value =
69
+ this.value.slice(0, this.cursor) + data + this.value.slice(this.cursor);
70
+ this.cursor++;
71
+ }
72
+ }
73
+ render(width) {
74
+ // Calculate visible window
75
+ const prompt = "> ";
76
+ const availableWidth = width - prompt.length;
77
+ if (availableWidth <= 0) {
78
+ return [prompt];
79
+ }
80
+ let visibleText = "";
81
+ let cursorDisplay = this.cursor;
82
+ if (this.value.length < availableWidth) {
83
+ // Everything fits (leave room for cursor at end)
84
+ visibleText = this.value;
85
+ }
86
+ else {
87
+ // Need horizontal scrolling
88
+ // Reserve one character for cursor if it's at the end
89
+ const scrollWidth = this.cursor === this.value.length ? availableWidth - 1 : availableWidth;
90
+ const halfWidth = Math.floor(scrollWidth / 2);
91
+ if (this.cursor < halfWidth) {
92
+ // Cursor near start
93
+ visibleText = this.value.slice(0, scrollWidth);
94
+ cursorDisplay = this.cursor;
95
+ }
96
+ else if (this.cursor > this.value.length - halfWidth) {
97
+ // Cursor near end
98
+ visibleText = this.value.slice(this.value.length - scrollWidth);
99
+ cursorDisplay = scrollWidth - (this.value.length - this.cursor);
100
+ }
101
+ else {
102
+ // Cursor in middle
103
+ const start = this.cursor - halfWidth;
104
+ visibleText = this.value.slice(start, start + scrollWidth);
105
+ cursorDisplay = halfWidth;
106
+ }
107
+ }
108
+ // Build line with fake cursor
109
+ // Insert cursor character at cursor position
110
+ const beforeCursor = visibleText.slice(0, cursorDisplay);
111
+ const atCursor = visibleText[cursorDisplay] || " "; // Character at cursor, or space if at end
112
+ const afterCursor = visibleText.slice(cursorDisplay + 1);
113
+ // Use inverse video to show cursor
114
+ const cursorChar = `\x1b[7m${atCursor}\x1b[27m`; // ESC[7m = reverse video, ESC[27m = normal
115
+ const textWithCursor = beforeCursor + cursorChar + afterCursor;
116
+ // Calculate visual width
117
+ const visualLength = visibleWidth(textWithCursor);
118
+ const padding = " ".repeat(Math.max(0, availableWidth - visualLength));
119
+ const line = prompt + textWithCursor + padding;
120
+ return [line];
121
+ }
122
+ }
@@ -0,0 +1,19 @@
1
+ import type { TUI } from "../tui.ts";
2
+ import { Text } from "./text.ts";
3
+ /**
4
+ * Loader component that updates every 80ms with spinning animation
5
+ */
6
+ export declare class Loader extends Text {
7
+ private frames;
8
+ private currentFrame;
9
+ private intervalId;
10
+ private ui;
11
+ private message;
12
+ constructor(ui: TUI, message?: string);
13
+ render(width: number): string[];
14
+ start(): void;
15
+ stop(): void;
16
+ setMessage(message: string): void;
17
+ private updateDisplay;
18
+ }
19
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../source/tui/components/loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,qBAAa,MAAO,SAAQ,IAAI;IAC9B,OAAO,CAAC,MAAM,CAAsD;IACpE,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,EAAE,CAAoB;IAC9B,OAAO,CAAC,OAAO,CAAS;gBAEZ,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,MAAM;IAO5B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAIxC,KAAK;IAQL,IAAI;IAOJ,UAAU,CAAC,OAAO,EAAE,MAAM;IAK1B,OAAO,CAAC,aAAa;CAOtB"}
@@ -0,0 +1,45 @@
1
+ import style from "../../terminal/style.js";
2
+ import { Text } from "./text.js";
3
+ /**
4
+ * Loader component that updates every 80ms with spinning animation
5
+ */
6
+ export class Loader extends Text {
7
+ frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
8
+ currentFrame = 0;
9
+ intervalId = null;
10
+ ui = null;
11
+ message;
12
+ constructor(ui, message) {
13
+ super("", 1, 0);
14
+ this.message = message ?? "Loading...";
15
+ this.ui = ui;
16
+ this.start();
17
+ }
18
+ render(width) {
19
+ return ["", ...super.render(width)];
20
+ }
21
+ start() {
22
+ this.updateDisplay();
23
+ this.intervalId = setInterval(() => {
24
+ this.currentFrame = (this.currentFrame + 1) % this.frames.length;
25
+ this.updateDisplay();
26
+ }, 80);
27
+ }
28
+ stop() {
29
+ if (this.intervalId) {
30
+ clearInterval(this.intervalId);
31
+ this.intervalId = null;
32
+ }
33
+ }
34
+ setMessage(message) {
35
+ this.message = message;
36
+ this.updateDisplay();
37
+ }
38
+ updateDisplay() {
39
+ const frame = this.frames[this.currentFrame];
40
+ this.setText(`${style.cyan(frame)} ${style.dim(this.message)}`);
41
+ if (this.ui) {
42
+ this.ui.requestRender();
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,103 @@
1
+ import type { Component } from "../tui.ts";
2
+ type Color = "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray";
3
+ /**
4
+ * Default text styling for markdown content.
5
+ * Applied to all text unless overridden by markdown formatting.
6
+ */
7
+ export interface DefaultTextStyle {
8
+ /** Foreground color function */
9
+ color?: (text: string) => string;
10
+ /** Background color function */
11
+ bgColor?: (text: string) => string;
12
+ /** Bold text */
13
+ bold?: boolean;
14
+ /** Italic text */
15
+ italic?: boolean;
16
+ /** Strikethrough text */
17
+ strikethrough?: boolean;
18
+ /** Underline text */
19
+ underline?: boolean;
20
+ }
21
+ /**
22
+ * Theme functions for markdown elements.
23
+ * Each function takes text and returns styled text with ANSI codes.
24
+ */
25
+ export interface MarkdownTheme {
26
+ heading: (text: string) => string;
27
+ link: (text: string) => string;
28
+ linkUrl: (text: string) => string;
29
+ code: (text: string) => string;
30
+ codeBlock: (text: string) => string;
31
+ codeBlockBorder: (text: string) => string;
32
+ quote: (text: string) => string;
33
+ quoteBorder: (text: string) => string;
34
+ hr: (text: string) => string;
35
+ listBullet: (text: string) => string;
36
+ bold: (text: string) => string;
37
+ italic: (text: string) => string;
38
+ strikethrough: (text: string) => string;
39
+ underline: (text: string) => string;
40
+ }
41
+ export declare class Markdown implements Component {
42
+ private text;
43
+ private bgColor?;
44
+ private customBgRgb?;
45
+ private paddingX;
46
+ private paddingY;
47
+ private cachedText?;
48
+ private cachedWidth?;
49
+ private cachedLines?;
50
+ constructor(text?: string, bgColor?: Color, _fgColor?: Color, customBgRgb?: {
51
+ r: number;
52
+ g: number;
53
+ b: number;
54
+ }, paddingX?: number, paddingY?: number);
55
+ setText(text: string): void;
56
+ setBgColor(bgColor?: Color): void;
57
+ setCustomBgRgb(customBgRgb?: {
58
+ r: number;
59
+ g: number;
60
+ b: number;
61
+ }): void;
62
+ invalidate(): void;
63
+ /**
64
+ * Get the background color function based on current configuration
65
+ */
66
+ private getBackgroundFunction;
67
+ render(width: number): string[];
68
+ private renderToken;
69
+ private renderInlineTokens;
70
+ private wrapLine;
71
+ /**
72
+ * Protect inline code spans by replacing them with placeholders
73
+ * This prevents wrapAnsi from breaking code spans across lines
74
+ */
75
+ private protectCodeSpans;
76
+ /**
77
+ * Check if a potential code span is an actual code span (not escaped backticks)
78
+ */
79
+ private isActualCodeSpan;
80
+ /**
81
+ * Check if a line represents a nested list item
82
+ */
83
+ private isNestedListLine;
84
+ /**
85
+ * Restore code spans from placeholders after wrapping
86
+ */
87
+ private restoreCodeSpans;
88
+ /**
89
+ * Render a list with proper nesting support
90
+ */
91
+ private renderList;
92
+ /**
93
+ * Render list item tokens, handling nested lists
94
+ * Returns lines WITHOUT the parent indent (renderList will add it)
95
+ */
96
+ private renderListItem;
97
+ /**
98
+ * Render a table
99
+ */
100
+ private renderTable;
101
+ }
102
+ export {};
103
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../source/tui/components/markdown.ts"],"names":[],"mappings":"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"}