@mragentix/cli 4.2.37

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 (461) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +149 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +772 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/config.d.ts +16 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +29 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/core/agent-session.d.ts +87 -0
  12. package/dist/core/agent-session.d.ts.map +1 -0
  13. package/dist/core/agent-session.js +498 -0
  14. package/dist/core/agent-session.js.map +1 -0
  15. package/dist/core/agents.d.ts +30 -0
  16. package/dist/core/agents.d.ts.map +1 -0
  17. package/dist/core/agents.js +91 -0
  18. package/dist/core/agents.js.map +1 -0
  19. package/dist/core/auth-storage.d.ts +35 -0
  20. package/dist/core/auth-storage.d.ts.map +1 -0
  21. package/dist/core/auth-storage.js +144 -0
  22. package/dist/core/auth-storage.js.map +1 -0
  23. package/dist/core/auto-update.d.ts +8 -0
  24. package/dist/core/auto-update.d.ts.map +1 -0
  25. package/dist/core/auto-update.js +152 -0
  26. package/dist/core/auto-update.js.map +1 -0
  27. package/dist/core/compaction/compactor.d.ts +69 -0
  28. package/dist/core/compaction/compactor.d.ts.map +1 -0
  29. package/dist/core/compaction/compactor.js +405 -0
  30. package/dist/core/compaction/compactor.js.map +1 -0
  31. package/dist/core/compaction/compactor.test.d.ts +2 -0
  32. package/dist/core/compaction/compactor.test.d.ts.map +1 -0
  33. package/dist/core/compaction/compactor.test.js +461 -0
  34. package/dist/core/compaction/compactor.test.js.map +1 -0
  35. package/dist/core/compaction/token-estimator.d.ts +10 -0
  36. package/dist/core/compaction/token-estimator.d.ts.map +1 -0
  37. package/dist/core/compaction/token-estimator.js +75 -0
  38. package/dist/core/compaction/token-estimator.js.map +1 -0
  39. package/dist/core/compaction/token-estimator.test.d.ts +2 -0
  40. package/dist/core/compaction/token-estimator.test.d.ts.map +1 -0
  41. package/dist/core/compaction/token-estimator.test.js +137 -0
  42. package/dist/core/compaction/token-estimator.test.js.map +1 -0
  43. package/dist/core/custom-commands.d.ts +13 -0
  44. package/dist/core/custom-commands.d.ts.map +1 -0
  45. package/dist/core/custom-commands.js +40 -0
  46. package/dist/core/custom-commands.js.map +1 -0
  47. package/dist/core/event-bus.d.ts +95 -0
  48. package/dist/core/event-bus.d.ts.map +1 -0
  49. package/dist/core/event-bus.js +99 -0
  50. package/dist/core/event-bus.js.map +1 -0
  51. package/dist/core/extensions/loader.d.ts +8 -0
  52. package/dist/core/extensions/loader.d.ts.map +1 -0
  53. package/dist/core/extensions/loader.js +48 -0
  54. package/dist/core/extensions/loader.js.map +1 -0
  55. package/dist/core/extensions/types.d.ts +19 -0
  56. package/dist/core/extensions/types.d.ts.map +1 -0
  57. package/dist/core/extensions/types.js +2 -0
  58. package/dist/core/extensions/types.js.map +1 -0
  59. package/dist/core/file-lock.d.ts +6 -0
  60. package/dist/core/file-lock.d.ts.map +1 -0
  61. package/dist/core/file-lock.js +76 -0
  62. package/dist/core/file-lock.js.map +1 -0
  63. package/dist/core/index.d.ts +14 -0
  64. package/dist/core/index.d.ts.map +1 -0
  65. package/dist/core/index.js +13 -0
  66. package/dist/core/index.js.map +1 -0
  67. package/dist/core/logger.d.ts +26 -0
  68. package/dist/core/logger.d.ts.map +1 -0
  69. package/dist/core/logger.js +132 -0
  70. package/dist/core/logger.js.map +1 -0
  71. package/dist/core/mcp/client.d.ts +9 -0
  72. package/dist/core/mcp/client.d.ts.map +1 -0
  73. package/dist/core/mcp/client.js +126 -0
  74. package/dist/core/mcp/client.js.map +1 -0
  75. package/dist/core/mcp/defaults.d.ts +9 -0
  76. package/dist/core/mcp/defaults.d.ts.map +1 -0
  77. package/dist/core/mcp/defaults.js +47 -0
  78. package/dist/core/mcp/defaults.js.map +1 -0
  79. package/dist/core/mcp/index.d.ts +4 -0
  80. package/dist/core/mcp/index.d.ts.map +1 -0
  81. package/dist/core/mcp/index.js +3 -0
  82. package/dist/core/mcp/index.js.map +1 -0
  83. package/dist/core/mcp/types.d.ts +15 -0
  84. package/dist/core/mcp/types.d.ts.map +1 -0
  85. package/dist/core/mcp/types.js +2 -0
  86. package/dist/core/mcp/types.js.map +1 -0
  87. package/dist/core/model-registry.d.ts +25 -0
  88. package/dist/core/model-registry.d.ts.map +1 -0
  89. package/dist/core/model-registry.js +135 -0
  90. package/dist/core/model-registry.js.map +1 -0
  91. package/dist/core/oauth/anthropic.d.ts +4 -0
  92. package/dist/core/oauth/anthropic.d.ts.map +1 -0
  93. package/dist/core/oauth/anthropic.js +75 -0
  94. package/dist/core/oauth/anthropic.js.map +1 -0
  95. package/dist/core/oauth/openai.d.ts +4 -0
  96. package/dist/core/oauth/openai.d.ts.map +1 -0
  97. package/dist/core/oauth/openai.js +186 -0
  98. package/dist/core/oauth/openai.js.map +1 -0
  99. package/dist/core/oauth/pkce.d.ts +5 -0
  100. package/dist/core/oauth/pkce.d.ts.map +1 -0
  101. package/dist/core/oauth/pkce.js +17 -0
  102. package/dist/core/oauth/pkce.js.map +1 -0
  103. package/dist/core/oauth/types.d.ts +12 -0
  104. package/dist/core/oauth/types.d.ts.map +1 -0
  105. package/dist/core/oauth/types.js +2 -0
  106. package/dist/core/oauth/types.js.map +1 -0
  107. package/dist/core/process-manager.d.ts +30 -0
  108. package/dist/core/process-manager.d.ts.map +1 -0
  109. package/dist/core/process-manager.js +130 -0
  110. package/dist/core/process-manager.js.map +1 -0
  111. package/dist/core/prompt-commands.d.ts +14 -0
  112. package/dist/core/prompt-commands.d.ts.map +1 -0
  113. package/dist/core/prompt-commands.js +496 -0
  114. package/dist/core/prompt-commands.js.map +1 -0
  115. package/dist/core/session-manager.d.ts +112 -0
  116. package/dist/core/session-manager.d.ts.map +1 -0
  117. package/dist/core/session-manager.js +326 -0
  118. package/dist/core/session-manager.js.map +1 -0
  119. package/dist/core/settings-manager.d.ts +43 -0
  120. package/dist/core/settings-manager.d.ts.map +1 -0
  121. package/dist/core/settings-manager.js +64 -0
  122. package/dist/core/settings-manager.js.map +1 -0
  123. package/dist/core/skills.d.ts +23 -0
  124. package/dist/core/skills.d.ts.map +1 -0
  125. package/dist/core/skills.js +89 -0
  126. package/dist/core/skills.js.map +1 -0
  127. package/dist/core/slash-commands.d.ts +35 -0
  128. package/dist/core/slash-commands.d.ts.map +1 -0
  129. package/dist/core/slash-commands.js +183 -0
  130. package/dist/core/slash-commands.js.map +1 -0
  131. package/dist/core/telegram.d.ts +94 -0
  132. package/dist/core/telegram.d.ts.map +1 -0
  133. package/dist/core/telegram.js +227 -0
  134. package/dist/core/telegram.js.map +1 -0
  135. package/dist/index.d.ts +10 -0
  136. package/dist/index.d.ts.map +1 -0
  137. package/dist/index.js +15 -0
  138. package/dist/index.js.map +1 -0
  139. package/dist/interactive.d.ts +3 -0
  140. package/dist/interactive.d.ts.map +1 -0
  141. package/dist/interactive.js +173 -0
  142. package/dist/interactive.js.map +1 -0
  143. package/dist/modes/index.d.ts +3 -0
  144. package/dist/modes/index.d.ts.map +1 -0
  145. package/dist/modes/index.js +3 -0
  146. package/dist/modes/index.js.map +1 -0
  147. package/dist/modes/json-mode.d.ts +13 -0
  148. package/dist/modes/json-mode.d.ts.map +1 -0
  149. package/dist/modes/json-mode.js +74 -0
  150. package/dist/modes/json-mode.js.map +1 -0
  151. package/dist/modes/print-mode.d.ts +12 -0
  152. package/dist/modes/print-mode.d.ts.map +1 -0
  153. package/dist/modes/print-mode.js +49 -0
  154. package/dist/modes/print-mode.js.map +1 -0
  155. package/dist/modes/rpc-mode.d.ts +28 -0
  156. package/dist/modes/rpc-mode.d.ts.map +1 -0
  157. package/dist/modes/rpc-mode.js +145 -0
  158. package/dist/modes/rpc-mode.js.map +1 -0
  159. package/dist/modes/serve-mode.d.ts +21 -0
  160. package/dist/modes/serve-mode.d.ts.map +1 -0
  161. package/dist/modes/serve-mode.js +649 -0
  162. package/dist/modes/serve-mode.js.map +1 -0
  163. package/dist/session.d.ts +16 -0
  164. package/dist/session.d.ts.map +1 -0
  165. package/dist/session.js +129 -0
  166. package/dist/session.js.map +1 -0
  167. package/dist/system-prompt.d.ts +6 -0
  168. package/dist/system-prompt.d.ts.map +1 -0
  169. package/dist/system-prompt.js +115 -0
  170. package/dist/system-prompt.js.map +1 -0
  171. package/dist/tools/bash.d.ts +13 -0
  172. package/dist/tools/bash.d.ts.map +1 -0
  173. package/dist/tools/bash.js +165 -0
  174. package/dist/tools/bash.js.map +1 -0
  175. package/dist/tools/edit-diff.d.ts +18 -0
  176. package/dist/tools/edit-diff.d.ts.map +1 -0
  177. package/dist/tools/edit-diff.js +92 -0
  178. package/dist/tools/edit-diff.js.map +1 -0
  179. package/dist/tools/edit.d.ts +11 -0
  180. package/dist/tools/edit.d.ts.map +1 -0
  181. package/dist/tools/edit.js +57 -0
  182. package/dist/tools/edit.js.map +1 -0
  183. package/dist/tools/find.d.ts +9 -0
  184. package/dist/tools/find.d.ts.map +1 -0
  185. package/dist/tools/find.js +59 -0
  186. package/dist/tools/find.js.map +1 -0
  187. package/dist/tools/grep.d.ts +13 -0
  188. package/dist/tools/grep.d.ts.map +1 -0
  189. package/dist/tools/grep.js +121 -0
  190. package/dist/tools/grep.js.map +1 -0
  191. package/dist/tools/index.d.ts +30 -0
  192. package/dist/tools/index.d.ts.map +1 -0
  193. package/dist/tools/index.js +50 -0
  194. package/dist/tools/index.js.map +1 -0
  195. package/dist/tools/ls.d.ts +10 -0
  196. package/dist/tools/ls.d.ts.map +1 -0
  197. package/dist/tools/ls.js +56 -0
  198. package/dist/tools/ls.js.map +1 -0
  199. package/dist/tools/operations.d.ts +39 -0
  200. package/dist/tools/operations.d.ts.map +1 -0
  201. package/dist/tools/operations.js +27 -0
  202. package/dist/tools/operations.js.map +1 -0
  203. package/dist/tools/path-utils.d.ts +7 -0
  204. package/dist/tools/path-utils.d.ts.map +1 -0
  205. package/dist/tools/path-utils.js +27 -0
  206. package/dist/tools/path-utils.js.map +1 -0
  207. package/dist/tools/read.d.ts +12 -0
  208. package/dist/tools/read.d.ts.map +1 -0
  209. package/dist/tools/read.js +113 -0
  210. package/dist/tools/read.js.map +1 -0
  211. package/dist/tools/subagent.d.ts +26 -0
  212. package/dist/tools/subagent.d.ts.map +1 -0
  213. package/dist/tools/subagent.js +210 -0
  214. package/dist/tools/subagent.js.map +1 -0
  215. package/dist/tools/task-output.d.ts +10 -0
  216. package/dist/tools/task-output.d.ts.map +1 -0
  217. package/dist/tools/task-output.js +33 -0
  218. package/dist/tools/task-output.js.map +1 -0
  219. package/dist/tools/task-stop.d.ts +9 -0
  220. package/dist/tools/task-stop.d.ts.map +1 -0
  221. package/dist/tools/task-stop.js +15 -0
  222. package/dist/tools/task-stop.js.map +1 -0
  223. package/dist/tools/tasks.d.ts +16 -0
  224. package/dist/tools/tasks.d.ts.map +1 -0
  225. package/dist/tools/tasks.js +132 -0
  226. package/dist/tools/tasks.js.map +1 -0
  227. package/dist/tools/truncate.d.ts +19 -0
  228. package/dist/tools/truncate.d.ts.map +1 -0
  229. package/dist/tools/truncate.js +59 -0
  230. package/dist/tools/truncate.js.map +1 -0
  231. package/dist/tools/truncate.test.d.ts +2 -0
  232. package/dist/tools/truncate.test.d.ts.map +1 -0
  233. package/dist/tools/truncate.test.js +100 -0
  234. package/dist/tools/truncate.test.js.map +1 -0
  235. package/dist/tools/web-fetch.d.ts +9 -0
  236. package/dist/tools/web-fetch.d.ts.map +1 -0
  237. package/dist/tools/web-fetch.js +97 -0
  238. package/dist/tools/web-fetch.js.map +1 -0
  239. package/dist/tools/write.d.ts +10 -0
  240. package/dist/tools/write.d.ts.map +1 -0
  241. package/dist/tools/write.js +30 -0
  242. package/dist/tools/write.js.map +1 -0
  243. package/dist/tools/write.test.d.ts +2 -0
  244. package/dist/tools/write.test.d.ts.map +1 -0
  245. package/dist/tools/write.test.js +84 -0
  246. package/dist/tools/write.test.js.map +1 -0
  247. package/dist/types.d.ts +36 -0
  248. package/dist/types.d.ts.map +1 -0
  249. package/dist/types.js +2 -0
  250. package/dist/types.js.map +1 -0
  251. package/dist/ui/App.d.ts +148 -0
  252. package/dist/ui/App.d.ts.map +1 -0
  253. package/dist/ui/App.js +1191 -0
  254. package/dist/ui/App.js.map +1 -0
  255. package/dist/ui/components/ActivityIndicator.d.ts +13 -0
  256. package/dist/ui/components/ActivityIndicator.d.ts.map +1 -0
  257. package/dist/ui/components/ActivityIndicator.js +313 -0
  258. package/dist/ui/components/ActivityIndicator.js.map +1 -0
  259. package/dist/ui/components/AnimationContext.d.ts +22 -0
  260. package/dist/ui/components/AnimationContext.d.ts.map +1 -0
  261. package/dist/ui/components/AnimationContext.js +35 -0
  262. package/dist/ui/components/AnimationContext.js.map +1 -0
  263. package/dist/ui/components/AssistantMessage.d.ts +9 -0
  264. package/dist/ui/components/AssistantMessage.d.ts.map +1 -0
  265. package/dist/ui/components/AssistantMessage.js +11 -0
  266. package/dist/ui/components/AssistantMessage.js.map +1 -0
  267. package/dist/ui/components/BackgroundTasksBar.d.ts +15 -0
  268. package/dist/ui/components/BackgroundTasksBar.d.ts.map +1 -0
  269. package/dist/ui/components/BackgroundTasksBar.js +74 -0
  270. package/dist/ui/components/BackgroundTasksBar.js.map +1 -0
  271. package/dist/ui/components/Banner.d.ts +11 -0
  272. package/dist/ui/components/Banner.d.ts.map +1 -0
  273. package/dist/ui/components/Banner.js +55 -0
  274. package/dist/ui/components/Banner.js.map +1 -0
  275. package/dist/ui/components/CompactionNotice.d.ts +10 -0
  276. package/dist/ui/components/CompactionNotice.d.ts.map +1 -0
  277. package/dist/ui/components/CompactionNotice.js +27 -0
  278. package/dist/ui/components/CompactionNotice.js.map +1 -0
  279. package/dist/ui/components/DiffView.d.ts +4 -0
  280. package/dist/ui/components/DiffView.d.ts.map +1 -0
  281. package/dist/ui/components/DiffView.js +20 -0
  282. package/dist/ui/components/DiffView.js.map +1 -0
  283. package/dist/ui/components/Footer.d.ts +10 -0
  284. package/dist/ui/components/Footer.d.ts.map +1 -0
  285. package/dist/ui/components/Footer.js +105 -0
  286. package/dist/ui/components/Footer.js.map +1 -0
  287. package/dist/ui/components/InputArea.d.ts +21 -0
  288. package/dist/ui/components/InputArea.d.ts.map +1 -0
  289. package/dist/ui/components/InputArea.js +465 -0
  290. package/dist/ui/components/InputArea.js.map +1 -0
  291. package/dist/ui/components/Markdown.d.ts +9 -0
  292. package/dist/ui/components/Markdown.d.ts.map +1 -0
  293. package/dist/ui/components/Markdown.js +246 -0
  294. package/dist/ui/components/Markdown.js.map +1 -0
  295. package/dist/ui/components/ModelSelector.d.ts +11 -0
  296. package/dist/ui/components/ModelSelector.d.ts.map +1 -0
  297. package/dist/ui/components/ModelSelector.js +20 -0
  298. package/dist/ui/components/ModelSelector.js.map +1 -0
  299. package/dist/ui/components/Overlay.d.ts +8 -0
  300. package/dist/ui/components/Overlay.d.ts.map +1 -0
  301. package/dist/ui/components/Overlay.js +9 -0
  302. package/dist/ui/components/Overlay.js.map +1 -0
  303. package/dist/ui/components/SelectList.d.ts +14 -0
  304. package/dist/ui/components/SelectList.d.ts.map +1 -0
  305. package/dist/ui/components/SelectList.js +46 -0
  306. package/dist/ui/components/SelectList.js.map +1 -0
  307. package/dist/ui/components/ServerToolExecution.d.ts +17 -0
  308. package/dist/ui/components/ServerToolExecution.d.ts.map +1 -0
  309. package/dist/ui/components/ServerToolExecution.js +26 -0
  310. package/dist/ui/components/ServerToolExecution.js.map +1 -0
  311. package/dist/ui/components/SessionSelector.d.ts +9 -0
  312. package/dist/ui/components/SessionSelector.d.ts.map +1 -0
  313. package/dist/ui/components/SessionSelector.js +13 -0
  314. package/dist/ui/components/SessionSelector.js.map +1 -0
  315. package/dist/ui/components/SettingsSelector.d.ts +9 -0
  316. package/dist/ui/components/SettingsSelector.d.ts.map +1 -0
  317. package/dist/ui/components/SettingsSelector.js +13 -0
  318. package/dist/ui/components/SettingsSelector.js.map +1 -0
  319. package/dist/ui/components/SlashCommandMenu.d.ts +15 -0
  320. package/dist/ui/components/SlashCommandMenu.d.ts.map +1 -0
  321. package/dist/ui/components/SlashCommandMenu.js +32 -0
  322. package/dist/ui/components/SlashCommandMenu.js.map +1 -0
  323. package/dist/ui/components/Spinner.d.ts +4 -0
  324. package/dist/ui/components/Spinner.d.ts.map +1 -0
  325. package/dist/ui/components/Spinner.js +13 -0
  326. package/dist/ui/components/Spinner.js.map +1 -0
  327. package/dist/ui/components/StreamingArea.d.ts +10 -0
  328. package/dist/ui/components/StreamingArea.d.ts.map +1 -0
  329. package/dist/ui/components/StreamingArea.js +58 -0
  330. package/dist/ui/components/StreamingArea.js.map +1 -0
  331. package/dist/ui/components/SubAgentPanel.d.ts +21 -0
  332. package/dist/ui/components/SubAgentPanel.d.ts.map +1 -0
  333. package/dist/ui/components/SubAgentPanel.js +71 -0
  334. package/dist/ui/components/SubAgentPanel.js.map +1 -0
  335. package/dist/ui/components/TaskOverlay.d.ts +10 -0
  336. package/dist/ui/components/TaskOverlay.d.ts.map +1 -0
  337. package/dist/ui/components/TaskOverlay.js +263 -0
  338. package/dist/ui/components/TaskOverlay.js.map +1 -0
  339. package/dist/ui/components/ThinkingBlock.d.ts +11 -0
  340. package/dist/ui/components/ThinkingBlock.d.ts.map +1 -0
  341. package/dist/ui/components/ThinkingBlock.js +43 -0
  342. package/dist/ui/components/ThinkingBlock.js.map +1 -0
  343. package/dist/ui/components/ThinkingIndicator.d.ts +6 -0
  344. package/dist/ui/components/ThinkingIndicator.d.ts.map +1 -0
  345. package/dist/ui/components/ThinkingIndicator.js +144 -0
  346. package/dist/ui/components/ThinkingIndicator.js.map +1 -0
  347. package/dist/ui/components/ToolExecution.d.ts +16 -0
  348. package/dist/ui/components/ToolExecution.d.ts.map +1 -0
  349. package/dist/ui/components/ToolExecution.js +490 -0
  350. package/dist/ui/components/ToolExecution.js.map +1 -0
  351. package/dist/ui/components/ToolGroupExecution.d.ts +7 -0
  352. package/dist/ui/components/ToolGroupExecution.d.ts.map +1 -0
  353. package/dist/ui/components/ToolGroupExecution.js +115 -0
  354. package/dist/ui/components/ToolGroupExecution.js.map +1 -0
  355. package/dist/ui/components/UserMessage.d.ts +7 -0
  356. package/dist/ui/components/UserMessage.d.ts.map +1 -0
  357. package/dist/ui/components/UserMessage.js +16 -0
  358. package/dist/ui/components/UserMessage.js.map +1 -0
  359. package/dist/ui/components/index.d.ts +15 -0
  360. package/dist/ui/components/index.d.ts.map +1 -0
  361. package/dist/ui/components/index.js +15 -0
  362. package/dist/ui/components/index.js.map +1 -0
  363. package/dist/ui/hooks/useAgentLoop.d.ts +69 -0
  364. package/dist/ui/hooks/useAgentLoop.d.ts.map +1 -0
  365. package/dist/ui/hooks/useAgentLoop.js +483 -0
  366. package/dist/ui/hooks/useAgentLoop.js.map +1 -0
  367. package/dist/ui/hooks/useSessionManager.d.ts +13 -0
  368. package/dist/ui/hooks/useSessionManager.d.ts.map +1 -0
  369. package/dist/ui/hooks/useSessionManager.js +43 -0
  370. package/dist/ui/hooks/useSessionManager.js.map +1 -0
  371. package/dist/ui/hooks/useSlashCommands.d.ts +7 -0
  372. package/dist/ui/hooks/useSlashCommands.d.ts.map +1 -0
  373. package/dist/ui/hooks/useSlashCommands.js +11 -0
  374. package/dist/ui/hooks/useSlashCommands.js.map +1 -0
  375. package/dist/ui/hooks/useTerminalSize.d.ts +20 -0
  376. package/dist/ui/hooks/useTerminalSize.d.ts.map +1 -0
  377. package/dist/ui/hooks/useTerminalSize.js +55 -0
  378. package/dist/ui/hooks/useTerminalSize.js.map +1 -0
  379. package/dist/ui/hooks/useTerminalTitle.d.ts +3 -0
  380. package/dist/ui/hooks/useTerminalTitle.d.ts.map +1 -0
  381. package/dist/ui/hooks/useTerminalTitle.js +41 -0
  382. package/dist/ui/hooks/useTerminalTitle.js.map +1 -0
  383. package/dist/ui/live-item-flush.d.ts +59 -0
  384. package/dist/ui/live-item-flush.d.ts.map +1 -0
  385. package/dist/ui/live-item-flush.js +135 -0
  386. package/dist/ui/live-item-flush.js.map +1 -0
  387. package/dist/ui/live-item-flush.test.d.ts +2 -0
  388. package/dist/ui/live-item-flush.test.d.ts.map +1 -0
  389. package/dist/ui/live-item-flush.test.js +307 -0
  390. package/dist/ui/live-item-flush.test.js.map +1 -0
  391. package/dist/ui/login.d.ts +3 -0
  392. package/dist/ui/login.d.ts.map +1 -0
  393. package/dist/ui/login.js +117 -0
  394. package/dist/ui/login.js.map +1 -0
  395. package/dist/ui/render.d.ts +38 -0
  396. package/dist/ui/render.d.ts.map +1 -0
  397. package/dist/ui/render.js +72 -0
  398. package/dist/ui/render.js.map +1 -0
  399. package/dist/ui/sessions.d.ts +2 -0
  400. package/dist/ui/sessions.d.ts.map +1 -0
  401. package/dist/ui/sessions.js +208 -0
  402. package/dist/ui/sessions.js.map +1 -0
  403. package/dist/ui/spinner-frames.d.ts +3 -0
  404. package/dist/ui/spinner-frames.d.ts.map +1 -0
  405. package/dist/ui/spinner-frames.js +7 -0
  406. package/dist/ui/spinner-frames.js.map +1 -0
  407. package/dist/ui/theme/dark.json +24 -0
  408. package/dist/ui/theme/detect-theme.d.ts +12 -0
  409. package/dist/ui/theme/detect-theme.d.ts.map +1 -0
  410. package/dist/ui/theme/detect-theme.js +152 -0
  411. package/dist/ui/theme/detect-theme.js.map +1 -0
  412. package/dist/ui/theme/light.json +24 -0
  413. package/dist/ui/theme/theme.d.ts +29 -0
  414. package/dist/ui/theme/theme.d.ts.map +1 -0
  415. package/dist/ui/theme/theme.js +11 -0
  416. package/dist/ui/theme/theme.js.map +1 -0
  417. package/dist/ui/utils/highlight.d.ts +8 -0
  418. package/dist/ui/utils/highlight.d.ts.map +1 -0
  419. package/dist/ui/utils/highlight.js +49 -0
  420. package/dist/ui/utils/highlight.js.map +1 -0
  421. package/dist/ui/utils/table-text.d.ts +25 -0
  422. package/dist/ui/utils/table-text.d.ts.map +1 -0
  423. package/dist/ui/utils/table-text.js +78 -0
  424. package/dist/ui/utils/table-text.js.map +1 -0
  425. package/dist/ui/utils/table-text.test.d.ts +2 -0
  426. package/dist/ui/utils/table-text.test.d.ts.map +1 -0
  427. package/dist/ui/utils/table-text.test.js +202 -0
  428. package/dist/ui/utils/table-text.test.js.map +1 -0
  429. package/dist/utils/error-handler.d.ts +5 -0
  430. package/dist/utils/error-handler.d.ts.map +1 -0
  431. package/dist/utils/error-handler.js +120 -0
  432. package/dist/utils/error-handler.js.map +1 -0
  433. package/dist/utils/format.d.ts +21 -0
  434. package/dist/utils/format.d.ts.map +1 -0
  435. package/dist/utils/format.js +120 -0
  436. package/dist/utils/format.js.map +1 -0
  437. package/dist/utils/git.d.ts +2 -0
  438. package/dist/utils/git.d.ts.map +1 -0
  439. package/dist/utils/git.js +13 -0
  440. package/dist/utils/git.js.map +1 -0
  441. package/dist/utils/image.d.ts +30 -0
  442. package/dist/utils/image.d.ts.map +1 -0
  443. package/dist/utils/image.js +231 -0
  444. package/dist/utils/image.js.map +1 -0
  445. package/dist/utils/markdown.d.ts +6 -0
  446. package/dist/utils/markdown.d.ts.map +1 -0
  447. package/dist/utils/markdown.js +25 -0
  448. package/dist/utils/markdown.js.map +1 -0
  449. package/dist/utils/process.d.ts +6 -0
  450. package/dist/utils/process.d.ts.map +1 -0
  451. package/dist/utils/process.js +19 -0
  452. package/dist/utils/process.js.map +1 -0
  453. package/dist/utils/shell.d.ts +3 -0
  454. package/dist/utils/shell.d.ts.map +1 -0
  455. package/dist/utils/shell.js +8 -0
  456. package/dist/utils/shell.js.map +1 -0
  457. package/dist/utils/sound.d.ts +2 -0
  458. package/dist/utils/sound.d.ts.map +1 -0
  459. package/dist/utils/sound.js +11 -0
  460. package/dist/utils/sound.js.map +1 -0
  461. package/package.json +56 -0
@@ -0,0 +1,144 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import React, { useMemo } from "react";
3
+ import { Text, Box } from "ink";
4
+ import { useTheme } from "../theme/theme.js";
5
+ import { SPINNER_FRAMES, SPINNER_INTERVAL } from "../spinner-frames.js";
6
+ import { useAnimationTick, deriveFrame } from "./AnimationContext.js";
7
+ // ── Color pulse cycle ─────────────────────────────────────
8
+ const PULSE_COLORS = [
9
+ "#60a5fa", // blue
10
+ "#818cf8", // indigo
11
+ "#a78bfa", // violet
12
+ "#818cf8", // indigo (back)
13
+ "#60a5fa", // blue (back)
14
+ "#38bdf8", // sky
15
+ "#60a5fa", // blue (back)
16
+ ];
17
+ const PULSE_INTERVAL = 400;
18
+ // ── Ellipsis animation ────────────────────────────────────
19
+ const ELLIPSIS_FRAMES = ["", ".", "..", "..."];
20
+ const ELLIPSIS_INTERVAL = 500;
21
+ // ── Phrase rotation ───────────────────────────────────────
22
+ const PHRASE_INTERVAL = 3000;
23
+ const CONTEXTUAL_PHRASES = [
24
+ {
25
+ keywords: /\b(bug|fix|error|issue|broken|crash|fail|wrong)\b/i,
26
+ phrases: [
27
+ "Investigating",
28
+ "Diagnosing",
29
+ "Tracing the issue",
30
+ "Hunting the bug",
31
+ "Analyzing the problem",
32
+ "Narrowing it down",
33
+ ],
34
+ },
35
+ {
36
+ keywords: /\b(refactor|clean|improve|optimize|simplify|restructure)\b/i,
37
+ phrases: [
38
+ "Studying the code",
39
+ "Planning improvements",
40
+ "Mapping dependencies",
41
+ "Finding patterns",
42
+ "Designing the approach",
43
+ ],
44
+ },
45
+ {
46
+ keywords: /\b(test|spec|coverage|assert|expect|describe|it\()\b/i,
47
+ phrases: [
48
+ "Designing tests",
49
+ "Thinking about edge cases",
50
+ "Planning test coverage",
51
+ "Considering scenarios",
52
+ ],
53
+ },
54
+ {
55
+ keywords: /\b(build|deploy|ci|cd|pipeline|docker|config)\b/i,
56
+ phrases: [
57
+ "Checking the config",
58
+ "Analyzing the pipeline",
59
+ "Working through setup",
60
+ "Reviewing the build",
61
+ ],
62
+ },
63
+ {
64
+ keywords: /\b(style|css|ui|layout|design|color|theme|display|render)\b/i,
65
+ phrases: [
66
+ "Visualizing the layout",
67
+ "Crafting the design",
68
+ "Considering the aesthetics",
69
+ "Sketching it out",
70
+ "Polishing the pixels",
71
+ ],
72
+ },
73
+ {
74
+ keywords: /\b(add|create|new|implement|feature|make|build)\b/i,
75
+ phrases: [
76
+ "Architecting",
77
+ "Drafting the approach",
78
+ "Planning the implementation",
79
+ "Mapping it out",
80
+ "Designing the solution",
81
+ ],
82
+ },
83
+ {
84
+ keywords: /\b(explain|how|why|what|understand|describe)\b/i,
85
+ phrases: [
86
+ "Reading through the code",
87
+ "Connecting the dots",
88
+ "Building understanding",
89
+ "Tracing the logic",
90
+ "Piecing it together",
91
+ ],
92
+ },
93
+ ];
94
+ const GENERAL_PHRASES = [
95
+ "Thinking",
96
+ "Reasoning",
97
+ "Processing",
98
+ "Mulling it over",
99
+ "Working on it",
100
+ "Contemplating",
101
+ "Figuring it out",
102
+ "Crunching",
103
+ "Assembling thoughts",
104
+ "Cooking up a plan",
105
+ "Brewing ideas",
106
+ "Spinning up neurons",
107
+ "Loading wisdom",
108
+ "Parsing the universe",
109
+ "Channeling clarity",
110
+ ];
111
+ function selectPhrases(userMessage) {
112
+ for (const set of CONTEXTUAL_PHRASES) {
113
+ if (set.keywords.test(userMessage)) {
114
+ return [...set.phrases, ...GENERAL_PHRASES.slice(0, 3)];
115
+ }
116
+ }
117
+ return GENERAL_PHRASES;
118
+ }
119
+ function shuffleArray(arr) {
120
+ const shuffled = [...arr];
121
+ for (let i = shuffled.length - 1; i > 0; i--) {
122
+ const j = Math.floor(Math.random() * (i + 1));
123
+ [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
124
+ }
125
+ return shuffled;
126
+ }
127
+ export function ThinkingIndicator({ userMessage = "" }) {
128
+ const theme = useTheme();
129
+ const tick = useAnimationTick();
130
+ // Derive all animation frames from the single global tick
131
+ const spinnerFrame = deriveFrame(tick, SPINNER_INTERVAL, SPINNER_FRAMES.length);
132
+ const colorFrame = deriveFrame(tick, PULSE_INTERVAL, PULSE_COLORS.length);
133
+ const ellipsisFrame = deriveFrame(tick, ELLIPSIS_INTERVAL, ELLIPSIS_FRAMES.length);
134
+ // Phrase rotation — pick phrases based on user message, shuffle, rotate
135
+ const phrases = useMemo(() => shuffleArray(selectPhrases(userMessage)), [userMessage]);
136
+ const phraseIndex = deriveFrame(tick, PHRASE_INTERVAL, phrases.length);
137
+ const spinnerColor = PULSE_COLORS[colorFrame];
138
+ const phrase = phrases[phraseIndex];
139
+ const ellipsis = ELLIPSIS_FRAMES[ellipsisFrame];
140
+ // Pad ellipsis to prevent text from shifting
141
+ const paddedEllipsis = ellipsis + " ".repeat(3 - ellipsis.length);
142
+ return (_jsxs(Box, { children: [_jsxs(Text, { color: spinnerColor, bold: true, children: [SPINNER_FRAMES[spinnerFrame], " "] }), _jsx(Text, { color: spinnerColor, bold: true, children: phrase }), _jsx(Text, { color: theme.textDim, children: paddedEllipsis })] }));
143
+ }
144
+ //# sourceMappingURL=ThinkingIndicator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThinkingIndicator.js","sourceRoot":"","sources":["../../../src/ui/components/ThinkingIndicator.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,16 @@
1
+ interface ToolRunningProps {
2
+ status: "running";
3
+ name: string;
4
+ args: Record<string, unknown>;
5
+ }
6
+ interface ToolDoneProps {
7
+ status: "done";
8
+ name: string;
9
+ args: Record<string, unknown>;
10
+ result: string;
11
+ isError: boolean;
12
+ }
13
+ type ToolExecutionProps = ToolRunningProps | ToolDoneProps;
14
+ export declare function ToolExecution(props: ToolExecutionProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
16
+ //# sourceMappingURL=ToolExecution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolExecution.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ToolExecution.tsx"],"names":[],"mappings":"AAeA,UAAU,gBAAgB;IACxB,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,KAAK,kBAAkB,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAK3D,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CA6GtD"}
@@ -0,0 +1,490 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { memo } from "react";
3
+ import { Text, Box } from "ink";
4
+ import { useTheme } from "../theme/theme.js";
5
+ import { Spinner } from "./Spinner.js";
6
+ import { highlightCode, langFromPath } from "../utils/highlight.js";
7
+ const MAX_OUTPUT_LINES = 4; // max lines shown per tool result
8
+ /** Truncate a line so it fits within ~1 terminal row. */
9
+ function truncateLine(line, reservedChars = 6) {
10
+ const cols = process.stdout.columns || 80;
11
+ const max = cols - reservedChars;
12
+ return line.length > max ? line.slice(0, max) + "…" : line;
13
+ }
14
+ /** Tools that use compact one-line summaries instead of showing output. */
15
+ const COMPACT_TOOLS = new Set(["read", "grep", "find", "ls"]);
16
+ export function ToolExecution(props) {
17
+ const theme = useTheme();
18
+ if (props.status === "running") {
19
+ // Compact tools get a summary label while running
20
+ if (COMPACT_TOOLS.has(props.name)) {
21
+ const summary = getCompactRunningLabel(props.name, props.args);
22
+ return (_jsx(Box, { marginTop: 1, children: _jsx(Spinner, { label: `${summary} (ctrl+o to expand)` }) }));
23
+ }
24
+ const { label, detail } = getToolHeaderParts(props.name, props.args);
25
+ return (_jsx(Box, { marginTop: 1, children: _jsx(Spinner, { label: detail ? `${label}(${detail})` : label }) }));
26
+ }
27
+ const { name, args, result, isError } = props;
28
+ // Compact tools — one-line summary, no output content
29
+ if (COMPACT_TOOLS.has(name) && !isError) {
30
+ const summary = getCompactDoneLabel(name, args, result);
31
+ return (_jsx(Box, { marginTop: 1, flexShrink: 1, children: _jsxs(Text, { children: [_jsx(Text, { color: theme.primary, children: "⏺ " }), _jsx(Text, { bold: true, color: theme.toolName, children: summary })] }) }));
32
+ }
33
+ const isDiff = name === "edit" && !isError && result.includes("---");
34
+ const { label, detail } = getToolHeaderParts(name, args);
35
+ const body = isDiff ? buildDiffBody(result, args) : buildResultBody(name, result, isError);
36
+ const headerColor = isError ? theme.toolError : theme.toolName;
37
+ // Compact display — no body to show, but show inline summary
38
+ if (!body) {
39
+ const inline = getInlineSummary(name, result, isError);
40
+ return (_jsx(Box, { marginTop: 1, flexShrink: 1, children: _jsxs(Text, { children: [_jsx(Text, { color: theme.primary, children: "⏺ " }), _jsx(Text, { bold: true, color: headerColor, children: label }), detail && (_jsxs(Text, { color: theme.text, children: ["(", detail, ")"] })), inline && _jsxs(Text, { color: theme.textDim, children: [" ", inline] })] }) }));
41
+ }
42
+ const { lines, totalLines } = body;
43
+ const hiddenCount = totalLines - lines.length;
44
+ return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: theme.primary, children: "⏺ " }), _jsx(Text, { bold: true, color: headerColor, children: label }), detail && (_jsxs(Text, { color: theme.text, children: ["(", detail, ")"] }))] }) }), _jsxs(Box, { flexDirection: "column", paddingLeft: 2, children: [lines.map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { color: theme.textDim, children: i === 0 ? "⎿ " : " " }), _jsx(Box, { flexShrink: 1, children: line })] }, i))), hiddenCount > 0 && (_jsx(Box, { children: _jsxs(Text, { color: theme.textDim, children: [" … +", hiddenCount, " lines (ctrl+o to expand)"] }) }))] })] }));
45
+ }
46
+ // ── Compact tool labels ─────────────────────────────────────
47
+ function getCompactRunningLabel(name, _args) {
48
+ switch (name) {
49
+ case "grep":
50
+ return "Searching…";
51
+ case "read":
52
+ return "Reading…";
53
+ case "find":
54
+ return "Finding files…";
55
+ case "ls":
56
+ return "Listing…";
57
+ default:
58
+ return `${name}…`;
59
+ }
60
+ }
61
+ function getCompactDoneLabel(name, args, result) {
62
+ switch (name) {
63
+ case "grep": {
64
+ const lines = result.split("\n").filter((l) => l.length > 0);
65
+ // Filter out the summary line ("N match(es) found" or "[Truncated at N matches]")
66
+ const matchCount = lines.filter((l) => !l.match(/^\d+ match|^\[Truncated/)).length;
67
+ return `Searched for 1 pattern${matchCount > 0 ? ` (${matchCount} match${matchCount !== 1 ? "es" : ""})` : ""}`;
68
+ }
69
+ case "read": {
70
+ const filePath = String(args.file_path ?? "");
71
+ const shortPath = shortenPath(filePath);
72
+ return `Read ${shortPath}`;
73
+ }
74
+ case "find": {
75
+ const lines = result.split("\n").filter((l) => l.length > 0);
76
+ return `Found ${lines.length} file${lines.length !== 1 ? "s" : ""}`;
77
+ }
78
+ case "ls": {
79
+ const lines = result.split("\n").filter((l) => l.length > 0);
80
+ return `Listed ${lines.length} item${lines.length !== 1 ? "s" : ""}`;
81
+ }
82
+ default:
83
+ return name;
84
+ }
85
+ }
86
+ // ── Header formatting ──────────────────────────────────────
87
+ function shortenPath(filePath) {
88
+ // Show last 2 path segments max, e.g. "src/components/App.tsx"
89
+ const parts = filePath.split("/");
90
+ if (parts.length <= 3)
91
+ return filePath;
92
+ return "…/" + parts.slice(-2).join("/");
93
+ }
94
+ function getToolHeaderParts(name, args) {
95
+ const displayName = toolDisplayName(name);
96
+ switch (name) {
97
+ case "bash": {
98
+ const cmd = String(args.command ?? "");
99
+ const firstLine = cmd.split("\n")[0];
100
+ const truncCmd = firstLine.length > 60 ? firstLine.slice(0, 57) + "…" : firstLine;
101
+ const multiline = cmd.includes("\n");
102
+ return { label: displayName, detail: `${truncCmd}${multiline ? " …" : ""}` };
103
+ }
104
+ case "edit":
105
+ return { label: displayName, detail: shortenPath(String(args.file_path ?? "")) };
106
+ case "write":
107
+ return { label: displayName, detail: shortenPath(String(args.file_path ?? "")) };
108
+ case "read":
109
+ return { label: "Read", detail: shortenPath(String(args.file_path ?? "")) };
110
+ case "grep": {
111
+ const pat = String(args.pattern ?? "");
112
+ return { label: displayName, detail: pat.length > 40 ? pat.slice(0, 37) + "…" : pat };
113
+ }
114
+ case "find": {
115
+ const pat = String(args.pattern ?? "");
116
+ return { label: displayName, detail: pat.length > 40 ? pat.slice(0, 37) + "…" : pat };
117
+ }
118
+ case "ls":
119
+ return { label: displayName, detail: shortenPath(String(args.path ?? ".")) };
120
+ case "subagent": {
121
+ const task = String(args.task ?? "");
122
+ const trunc = task.length > 50 ? task.slice(0, 47) + "…" : task;
123
+ return { label: displayName, detail: trunc };
124
+ }
125
+ case "web_fetch": {
126
+ const url = String(args.url ?? "");
127
+ const trunc = url.length > 60 ? url.slice(0, 57) + "…" : url;
128
+ return { label: displayName, detail: trunc };
129
+ }
130
+ case "tasks": {
131
+ const action = String(args.action ?? "");
132
+ return { label: displayName, detail: action };
133
+ }
134
+ default: {
135
+ if (name.startsWith("mcp__")) {
136
+ // Show all args as key: "value" pairs
137
+ const argParts = Object.entries(args)
138
+ .filter(([, v]) => v !== undefined && v !== null && v !== "")
139
+ .map(([k, v]) => {
140
+ const s = String(v);
141
+ const truncated = s.length > 40 ? s.slice(0, 37) + "…" : s;
142
+ return `${k}: "${truncated}"`;
143
+ });
144
+ const detail = argParts.join(", ");
145
+ const truncDetail = detail.length > 80 ? detail.slice(0, 77) + "…" : detail;
146
+ return { label: displayName, detail: truncDetail };
147
+ }
148
+ return { label: displayName, detail: "" };
149
+ }
150
+ }
151
+ }
152
+ function toolDisplayName(name) {
153
+ if (name.startsWith("mcp__")) {
154
+ // mcp__grep__searchGitHub → "grep - searchGitHub (MCP)"
155
+ const parts = name.split("__");
156
+ const server = parts[1] ?? "mcp";
157
+ const toolFn = parts[2] ?? "";
158
+ return `${server} - ${toolFn} (MCP)`;
159
+ }
160
+ switch (name) {
161
+ case "bash":
162
+ return "Bash";
163
+ case "read":
164
+ return "Read";
165
+ case "write":
166
+ return "Write";
167
+ case "edit":
168
+ return "Update";
169
+ case "grep":
170
+ return "Search";
171
+ case "find":
172
+ return "Find";
173
+ case "ls":
174
+ return "List";
175
+ case "subagent":
176
+ return "Agent";
177
+ case "web_fetch":
178
+ return "Fetch";
179
+ case "tasks":
180
+ return "Task";
181
+ default:
182
+ return name.charAt(0).toUpperCase() + name.slice(1);
183
+ }
184
+ }
185
+ // ── Inline summary for compact tools ───────────────────────
186
+ function getInlineSummary(name, result, isError) {
187
+ if (isError) {
188
+ const firstLine = result.split("\n")[0];
189
+ return firstLine.length > 60 ? firstLine.slice(0, 57) + "…" : firstLine;
190
+ }
191
+ switch (name) {
192
+ case "read": {
193
+ const lines = result.split("\n").filter((l) => l.length > 0);
194
+ return `${lines.length} line${lines.length !== 1 ? "s" : ""}`;
195
+ }
196
+ case "write": {
197
+ const firstLine = result.split("\n")[0];
198
+ return firstLine;
199
+ }
200
+ case "bash": {
201
+ const match = result.match(/^Exit code: (.+)/);
202
+ return match ? `exit ${match[1]}` : "done";
203
+ }
204
+ case "subagent":
205
+ return "completed";
206
+ case "web_fetch": {
207
+ const lines = result.split("\n").filter((l) => l.length > 0);
208
+ if (result.startsWith("Error"))
209
+ return result.split("\n")[0];
210
+ return `${lines.length} line${lines.length !== 1 ? "s" : ""}`;
211
+ }
212
+ case "tasks": {
213
+ // Extract just the task text from results like 'Task added: "Fix bug" (id: abc…)'
214
+ const quoted = result.match(/"([^"]+)"/);
215
+ if (quoted) {
216
+ const text = quoted[1];
217
+ return text.length > 50 ? text.slice(0, 47) + "…" : text;
218
+ }
219
+ return result.split("\n")[0];
220
+ }
221
+ default: {
222
+ if (name.startsWith("mcp__")) {
223
+ const lines = result.split("\n").filter((l) => l.length > 0);
224
+ if (lines.length === 0)
225
+ return "no results";
226
+ // Show first meaningful line as summary for compact display
227
+ const first = lines[0].length > 50 ? lines[0].slice(0, 47) + "…" : lines[0];
228
+ return lines.length === 1 ? first : `${lines.length} lines`;
229
+ }
230
+ return "";
231
+ }
232
+ }
233
+ }
234
+ function parseDiffWithLineNumbers(result) {
235
+ const allLines = result.split("\n");
236
+ const diffLines = allLines.filter((l) => !l.startsWith("---") && !l.startsWith("+++") && !l.startsWith("@@"));
237
+ const numbered = [];
238
+ let oldLine = 1;
239
+ let newLine = 1;
240
+ for (const line of diffLines) {
241
+ const prefix = line[0];
242
+ const content = line.slice(1);
243
+ if (prefix === "+") {
244
+ numbered.push({ type: "add", lineNo: newLine, content });
245
+ newLine++;
246
+ }
247
+ else if (prefix === "-") {
248
+ numbered.push({ type: "remove", lineNo: oldLine, content });
249
+ oldLine++;
250
+ }
251
+ else {
252
+ numbered.push({ type: "context", lineNo: newLine, content });
253
+ oldLine++;
254
+ newLine++;
255
+ }
256
+ }
257
+ return numbered;
258
+ }
259
+ function buildDiffBody(result, args) {
260
+ const added = (result.match(/^\+[^+]/gm) ?? []).length;
261
+ const removed = (result.match(/^-[^-]/gm) ?? []).length;
262
+ const summaryText = `Added ${added} line${added !== 1 ? "s" : ""}, removed ${removed} line${removed !== 1 ? "s" : ""}`;
263
+ const numbered = parseDiffWithLineNumbers(result);
264
+ const firstChangeIdx = numbered.findIndex((l) => l.type !== "context");
265
+ const lastChangeIdx = numbered.length - 1 - [...numbered].reverse().findIndex((l) => l.type !== "context");
266
+ const startIdx = Math.max(0, firstChangeIdx - 2);
267
+ const endIdx = Math.min(numbered.length, lastChangeIdx + 3);
268
+ const focused = numbered.slice(startIdx, endIdx);
269
+ // Highlight context lines using file extension
270
+ const filePath = String(args?.file_path ?? "");
271
+ const lang = langFromPath(filePath);
272
+ const highlighted = focused.map((line) => line.type === "context" ? { ...line, content: highlightCode(line.content, lang) } : line);
273
+ const maxLineNo = highlighted.reduce((m, l) => Math.max(m, l.lineNo), 0);
274
+ const padWidth = String(maxLineNo).length;
275
+ const displayLines = highlighted.slice(0, MAX_OUTPUT_LINES);
276
+ const rendered = displayLines.map((line, i) => (_jsx(DiffLine, { line: line, padWidth: padWidth }, i)));
277
+ return {
278
+ lines: [
279
+ _jsx(Text, { color: "#9ca3af", children: summaryText }, "summary"),
280
+ ...rendered,
281
+ ],
282
+ totalLines: focused.length + 1,
283
+ };
284
+ }
285
+ function buildResultBody(name, result, isError) {
286
+ if (isError) {
287
+ const lines = result.split("\n");
288
+ const display = lines.slice(0, MAX_OUTPUT_LINES);
289
+ return {
290
+ lines: display.map((l, i) => (_jsx(Text, { color: "#f87171", children: truncateLine(l) }, i))),
291
+ totalLines: lines.length,
292
+ };
293
+ }
294
+ switch (name) {
295
+ case "bash": {
296
+ const allLines = result.split("\n");
297
+ // Check exit code
298
+ const exitMatch = allLines[0]?.match(/^Exit code: (.+)/);
299
+ const exitCode = exitMatch ? exitMatch[1].trim() : "0";
300
+ const outputLines = allLines.slice(1).filter((l) => l.length > 0);
301
+ if (outputLines.length === 0)
302
+ return null;
303
+ const display = outputLines.slice(0, MAX_OUTPUT_LINES);
304
+ return {
305
+ lines: display.map((l, i) => (_jsx(Text, { color: exitCode !== "0" ? "#fbbf24" : "#9ca3af", children: truncateLine(l) }, i))),
306
+ totalLines: outputLines.length,
307
+ };
308
+ }
309
+ case "read":
310
+ return null;
311
+ case "write":
312
+ return null;
313
+ case "grep": {
314
+ const lines = result.split("\n").filter((l) => l.length > 0);
315
+ if (lines.length === 0 || result === "No matches found.")
316
+ return null;
317
+ const display = lines.slice(0, MAX_OUTPUT_LINES);
318
+ return {
319
+ lines: display.map((l, i) => _jsx(GrepLine, { line: l }, i)),
320
+ totalLines: lines.length,
321
+ };
322
+ }
323
+ case "find": {
324
+ const lines = result.split("\n").filter((l) => l.length > 0);
325
+ if (lines.length === 0)
326
+ return null;
327
+ const display = lines.slice(0, MAX_OUTPUT_LINES);
328
+ return {
329
+ lines: display.map((l, i) => _jsx(FindLine, { line: l }, i)),
330
+ totalLines: lines.length,
331
+ };
332
+ }
333
+ case "ls": {
334
+ const lines = result.split("\n").filter((l) => l.length > 0);
335
+ if (lines.length === 0)
336
+ return null;
337
+ const display = lines.slice(0, MAX_OUTPUT_LINES);
338
+ return {
339
+ lines: display.map((l, i) => _jsx(LsLine, { line: l }, i)),
340
+ totalLines: lines.length,
341
+ };
342
+ }
343
+ case "subagent": {
344
+ const lines = result.split("\n").filter((l) => l.length > 0);
345
+ if (lines.length === 0)
346
+ return null;
347
+ const display = lines.slice(0, MAX_OUTPUT_LINES);
348
+ return {
349
+ lines: display.map((l, i) => (_jsx(Text, { color: "#9ca3af", children: truncateLine(l) }, i))),
350
+ totalLines: lines.length,
351
+ };
352
+ }
353
+ case "web_fetch": {
354
+ if (result.startsWith("Error")) {
355
+ return {
356
+ lines: [
357
+ _jsx(Text, { color: "#f87171", children: result.split("\n")[0] }, 0),
358
+ ],
359
+ totalLines: 1,
360
+ };
361
+ }
362
+ return null; // compact display with inline summary
363
+ }
364
+ case "tasks": {
365
+ const lines = result.split("\n").filter((l) => l.length > 0);
366
+ // Single-line results (add, done, remove) → compact inline display
367
+ if (lines.length <= 1)
368
+ return null;
369
+ // Multi-line = list action → show styled task list
370
+ const display = lines.slice(0, MAX_OUTPUT_LINES);
371
+ return {
372
+ lines: display.map((l, i) => _jsx(TaskLine, { line: l }, i)),
373
+ totalLines: lines.length,
374
+ };
375
+ }
376
+ default: {
377
+ if (name.startsWith("mcp__")) {
378
+ const lines = result.split("\n").filter((l) => l.length > 0);
379
+ if (lines.length === 0)
380
+ return null;
381
+ const maxLines = 4;
382
+ const display = lines.slice(0, maxLines);
383
+ return {
384
+ lines: display.map((l, i) => _jsx(MCPResultLine, { line: l }, i)),
385
+ totalLines: lines.length,
386
+ };
387
+ }
388
+ return null;
389
+ }
390
+ }
391
+ }
392
+ // ── Diff line component ────────────────────────────────────
393
+ const DiffLine = memo(function DiffLine({ line, padWidth, }) {
394
+ const lineNo = String(line.lineNo).padStart(padWidth, " ");
395
+ if (line.type === "add") {
396
+ return (_jsxs(Text, { backgroundColor: "#16a34a", color: "#ffffff", children: [lineNo, " ", line.content] }));
397
+ }
398
+ if (line.type === "remove") {
399
+ return (_jsxs(Text, { backgroundColor: "#dc2626", color: "#ffffff", children: [lineNo, " ", line.content] }));
400
+ }
401
+ return (_jsxs(Text, { children: [_jsxs(Text, { color: "#6b7280", children: [lineNo, " "] }), line.content] }));
402
+ });
403
+ // ── Grep result line ───────────────────────────────────────
404
+ const GrepLine = memo(function GrepLine({ line }) {
405
+ // Format: filepath:lineNo:content
406
+ const firstColon = line.indexOf(":");
407
+ if (firstColon === -1)
408
+ return _jsx(Text, { color: "#9ca3af", children: line });
409
+ const secondColon = line.indexOf(":", firstColon + 1);
410
+ if (secondColon === -1)
411
+ return _jsx(Text, { color: "#9ca3af", children: line });
412
+ const file = line.slice(0, firstColon);
413
+ const lineNo = line.slice(firstColon + 1, secondColon);
414
+ const rawContent = line.slice(secondColon + 1);
415
+ // Truncate so the full line fits within ~4 terminal rows
416
+ const prefixLen = file.length + lineNo.length + 2; // 2 = colons
417
+ const content = truncateLine(rawContent, prefixLen + 6);
418
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "#60a5fa", children: file }), _jsx(Text, { color: "#6b7280", children: ":" }), _jsx(Text, { color: "#fbbf24", children: lineNo }), _jsx(Text, { color: "#6b7280", children: ":" }), _jsx(Text, { color: "#9ca3af", children: content })] }));
419
+ });
420
+ // ── Find result line ───────────────────────────────────────
421
+ const FindLine = memo(function FindLine({ line }) {
422
+ const trimmed = line.trim();
423
+ if (trimmed.endsWith("/")) {
424
+ return _jsx(Text, { color: "#60a5fa", children: trimmed });
425
+ }
426
+ // Highlight the filename, dim the path
427
+ const lastSlash = trimmed.lastIndexOf("/");
428
+ if (lastSlash === -1) {
429
+ return _jsx(Text, { color: "#e5e7eb", children: trimmed });
430
+ }
431
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "#6b7280", children: trimmed.slice(0, lastSlash + 1) }), _jsx(Text, { color: "#e5e7eb", children: trimmed.slice(lastSlash + 1) })] }));
432
+ });
433
+ // ── Ls result line ─────────────────────────────────────────
434
+ const LsLine = memo(function LsLine({ line }) {
435
+ // Format: "d - dirname/" or "f 1.2K filename"
436
+ const parts = line.match(/^([dfl])\s+(\S+)\s+(.+)$/);
437
+ if (!parts)
438
+ return _jsx(Text, { color: "#9ca3af", children: line });
439
+ const [, type, size, name] = parts;
440
+ if (type === "d") {
441
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "#60a5fa", bold: true, children: name }), _jsxs(Text, { color: "#6b7280", children: [" ", size === "-" ? "" : size] })] }));
442
+ }
443
+ // File or symlink
444
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "#e5e7eb", children: name }), _jsxs(Text, { color: "#6b7280", children: [" ", size] })] }));
445
+ });
446
+ // ── Task result line ────────────────────────────────────
447
+ const TaskLine = memo(function TaskLine({ line }) {
448
+ // Format: "[✓] Task text (id: abcd1234, done)" or "[ ] Task text (id: ..., pending)"
449
+ const match = line.match(/^\[(.)\]\s+(.+?)\s{2}\(id:\s*(\w+),\s*(\S+)\)$/);
450
+ if (!match)
451
+ return _jsx(Text, { color: "#9ca3af", children: line });
452
+ const [, check, text, id] = match;
453
+ const isDone = check === "✓";
454
+ const isActive = check === "~";
455
+ return (_jsxs(Text, { children: [_jsxs(Text, { color: isDone ? "#4ade80" : isActive ? "#fbbf24" : "#6b7280", children: ["[", check, "]"] }), _jsxs(Text, { color: isDone ? "#4ade80" : isActive ? "#fbbf24" : "#e5e7eb", children: [" ", text] }), _jsxs(Text, { color: "#6b7280", children: [" ", id] })] }));
456
+ });
457
+ // ── MCP result line ─────────────────────────────────────
458
+ const MAX_MCP_LINE_LENGTH = 120;
459
+ function truncLine(s, max = MAX_MCP_LINE_LENGTH) {
460
+ return s.length > max ? s.slice(0, max - 1) + "…" : s;
461
+ }
462
+ const MCPResultLine = memo(function MCPResultLine({ line }) {
463
+ // Key-value pattern: "Repository: value" or "Path: value" or "Title: value"
464
+ const kvMatch = line.match(/^([A-Z][A-Za-z_ ]+):\s+(.+)$/);
465
+ if (kvMatch) {
466
+ return (_jsxs(Text, { children: [_jsxs(Text, { color: "#6b7280", children: [kvMatch[1], ": "] }), _jsx(Text, { color: "#60a5fa", children: truncLine(kvMatch[2]) })] }));
467
+ }
468
+ // URL on its own line
469
+ if (line.match(/^https?:\/\//)) {
470
+ return _jsx(Text, { color: "#60a5fa", children: truncLine(line) });
471
+ }
472
+ // Numbered list item: "1. Title" or "- Item"
473
+ const listMatch = line.match(/^(\d+\.\s+|- )(.+)$/);
474
+ if (listMatch) {
475
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "#6b7280", children: listMatch[1] }), _jsx(Text, { color: "#e5e7eb", children: truncLine(listMatch[2]) })] }));
476
+ }
477
+ // Dash-separated results: "repo/path — content"
478
+ const dashMatch = line.match(/^(.+?)\s+—\s+(.+)$/);
479
+ if (dashMatch) {
480
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "#60a5fa", children: truncLine(dashMatch[1], 50) }), _jsx(Text, { color: "#6b7280", children: " \u2014 " }), _jsx(Text, { color: "#9ca3af", children: truncLine(dashMatch[2], 60) })] }));
481
+ }
482
+ // Colon-separated: "file:lineNo:content"
483
+ const colonMatch = line.match(/^([^:]+):(\d+):(.+)$/);
484
+ if (colonMatch) {
485
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "#60a5fa", children: colonMatch[1] }), _jsx(Text, { color: "#6b7280", children: ":" }), _jsx(Text, { color: "#fbbf24", children: colonMatch[2] }), _jsx(Text, { color: "#6b7280", children: ":" }), _jsx(Text, { color: "#9ca3af", children: truncLine(colonMatch[3], 80) })] }));
486
+ }
487
+ // Fallback: truncate long plain text
488
+ return _jsx(Text, { color: "#9ca3af", children: truncLine(line) });
489
+ });
490
+ //# sourceMappingURL=ToolExecution.js.map