@prestyj/cli 4.2.15

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