@compass-ai/nova 1.0.72 → 1.0.74

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 (974) hide show
  1. package/dist/acp/agent.d.ts +318 -0
  2. package/dist/acp/agent.d.ts.map +1 -0
  3. package/dist/acp/agent.js +795 -0
  4. package/dist/acp/agent.js.map +1 -0
  5. package/dist/acp/backpressure-writer.d.ts +49 -0
  6. package/dist/acp/backpressure-writer.d.ts.map +1 -0
  7. package/dist/acp/backpressure-writer.js +153 -0
  8. package/dist/acp/backpressure-writer.js.map +1 -0
  9. package/dist/acp/event-adapter.d.ts +242 -0
  10. package/dist/acp/event-adapter.d.ts.map +1 -0
  11. package/dist/acp/event-adapter.js +456 -0
  12. package/dist/acp/event-adapter.js.map +1 -0
  13. package/dist/acp/index.d.ts +30 -0
  14. package/dist/acp/index.d.ts.map +1 -0
  15. package/dist/acp/index.js +36 -0
  16. package/dist/acp/index.js.map +1 -0
  17. package/dist/acp/modes.d.ts +56 -0
  18. package/dist/acp/modes.d.ts.map +1 -0
  19. package/dist/acp/modes.js +135 -0
  20. package/dist/acp/modes.js.map +1 -0
  21. package/dist/acp/session-manager.d.ts +170 -0
  22. package/dist/acp/session-manager.d.ts.map +1 -0
  23. package/dist/acp/session-manager.js +381 -0
  24. package/dist/acp/session-manager.js.map +1 -0
  25. package/dist/acp/text-coalescer.d.ts +45 -0
  26. package/dist/acp/text-coalescer.d.ts.map +1 -0
  27. package/dist/acp/text-coalescer.js +110 -0
  28. package/dist/acp/text-coalescer.js.map +1 -0
  29. package/dist/acp/tool-bridge.d.ts +156 -0
  30. package/dist/acp/tool-bridge.d.ts.map +1 -0
  31. package/dist/acp/tool-bridge.js +381 -0
  32. package/dist/acp/tool-bridge.js.map +1 -0
  33. package/dist/acp/types.d.ts +314 -0
  34. package/dist/acp/types.d.ts.map +1 -0
  35. package/dist/acp/types.js +8 -0
  36. package/dist/acp/types.js.map +1 -0
  37. package/dist/cli.d.ts +9 -0
  38. package/dist/cli.d.ts.map +1 -0
  39. package/dist/cli.js +185 -184
  40. package/dist/cli.js.map +1 -0
  41. package/dist/commands/acp.d.ts +26 -0
  42. package/dist/commands/acp.d.ts.map +1 -0
  43. package/dist/commands/acp.js +492 -0
  44. package/dist/commands/acp.js.map +1 -0
  45. package/dist/commands/cache.d.ts +33 -0
  46. package/dist/commands/cache.d.ts.map +1 -0
  47. package/dist/commands/cache.js +537 -0
  48. package/dist/commands/cache.js.map +1 -0
  49. package/dist/commands/config.d.ts +10 -0
  50. package/dist/commands/config.d.ts.map +1 -0
  51. package/dist/commands/config.js +367 -0
  52. package/dist/commands/config.js.map +1 -0
  53. package/dist/commands/consent.d.ts +21 -0
  54. package/dist/commands/consent.d.ts.map +1 -0
  55. package/dist/commands/consent.js +334 -0
  56. package/dist/commands/consent.js.map +1 -0
  57. package/dist/commands/data.d.ts +24 -0
  58. package/dist/commands/data.d.ts.map +1 -0
  59. package/dist/commands/data.js +586 -0
  60. package/dist/commands/data.js.map +1 -0
  61. package/dist/commands/index.d.ts +145 -0
  62. package/dist/commands/index.d.ts.map +1 -0
  63. package/dist/commands/index.js +210 -0
  64. package/dist/commands/index.js.map +1 -0
  65. package/dist/commands/init.d.ts +106 -0
  66. package/dist/commands/init.d.ts.map +1 -0
  67. package/dist/commands/init.js +349 -0
  68. package/dist/commands/init.js.map +1 -0
  69. package/dist/commands/logs.d.ts +13 -0
  70. package/dist/commands/logs.d.ts.map +1 -0
  71. package/dist/commands/logs.js +359 -0
  72. package/dist/commands/logs.js.map +1 -0
  73. package/dist/commands/mcp.d.ts +20 -0
  74. package/dist/commands/mcp.d.ts.map +1 -0
  75. package/dist/commands/mcp.js +687 -0
  76. package/dist/commands/mcp.js.map +1 -0
  77. package/dist/commands/reset.d.ts +20 -0
  78. package/dist/commands/reset.d.ts.map +1 -0
  79. package/dist/commands/reset.js +372 -0
  80. package/dist/commands/reset.js.map +1 -0
  81. package/dist/commands/setup.d.ts +74 -0
  82. package/dist/commands/setup.d.ts.map +1 -0
  83. package/dist/commands/setup.js +863 -0
  84. package/dist/commands/setup.js.map +1 -0
  85. package/dist/commands/slash/agents.d.ts +40 -0
  86. package/dist/commands/slash/agents.d.ts.map +1 -0
  87. package/dist/commands/slash/agents.js +519 -0
  88. package/dist/commands/slash/agents.js.map +1 -0
  89. package/dist/commands/slash/approve.d.ts +46 -0
  90. package/dist/commands/slash/approve.d.ts.map +1 -0
  91. package/dist/commands/slash/approve.js +239 -0
  92. package/dist/commands/slash/approve.js.map +1 -0
  93. package/dist/commands/slash/attach.d.ts +70 -0
  94. package/dist/commands/slash/attach.d.ts.map +1 -0
  95. package/dist/commands/slash/attach.js +333 -0
  96. package/dist/commands/slash/attach.js.map +1 -0
  97. package/dist/commands/slash/clear.d.ts +47 -0
  98. package/dist/commands/slash/clear.d.ts.map +1 -0
  99. package/dist/commands/slash/clear.js +261 -0
  100. package/dist/commands/slash/clear.js.map +1 -0
  101. package/dist/commands/slash/commit.d.ts +40 -0
  102. package/dist/commands/slash/commit.d.ts.map +1 -0
  103. package/dist/commands/slash/commit.js +337 -0
  104. package/dist/commands/slash/commit.js.map +1 -0
  105. package/dist/commands/slash/compact.d.ts +48 -0
  106. package/dist/commands/slash/compact.d.ts.map +1 -0
  107. package/dist/commands/slash/compact.js +288 -0
  108. package/dist/commands/slash/compact.js.map +1 -0
  109. package/dist/commands/slash/config.d.ts +20 -0
  110. package/dist/commands/slash/config.d.ts.map +1 -0
  111. package/dist/commands/slash/config.js +136 -0
  112. package/dist/commands/slash/config.js.map +1 -0
  113. package/dist/commands/slash/context.d.ts +49 -0
  114. package/dist/commands/slash/context.d.ts.map +1 -0
  115. package/dist/commands/slash/context.js +430 -0
  116. package/dist/commands/slash/context.js.map +1 -0
  117. package/dist/commands/slash/cost.d.ts +34 -0
  118. package/dist/commands/slash/cost.d.ts.map +1 -0
  119. package/dist/commands/slash/cost.js +312 -0
  120. package/dist/commands/slash/cost.js.map +1 -0
  121. package/dist/commands/slash/custom.d.ts +41 -0
  122. package/dist/commands/slash/custom.d.ts.map +1 -0
  123. package/dist/commands/slash/custom.js +126 -0
  124. package/dist/commands/slash/custom.js.map +1 -0
  125. package/dist/commands/slash/exit.d.ts +25 -0
  126. package/dist/commands/slash/exit.d.ts.map +1 -0
  127. package/dist/commands/slash/exit.js +186 -0
  128. package/dist/commands/slash/exit.js.map +1 -0
  129. package/dist/commands/slash/export.d.ts +27 -0
  130. package/dist/commands/slash/export.d.ts.map +1 -0
  131. package/dist/commands/slash/export.js +318 -0
  132. package/dist/commands/slash/export.js.map +1 -0
  133. package/dist/commands/slash/files.d.ts +47 -0
  134. package/dist/commands/slash/files.d.ts.map +1 -0
  135. package/dist/commands/slash/files.js +521 -0
  136. package/dist/commands/slash/files.js.map +1 -0
  137. package/dist/commands/slash/help.d.ts +50 -0
  138. package/dist/commands/slash/help.d.ts.map +1 -0
  139. package/dist/commands/slash/help.js +282 -0
  140. package/dist/commands/slash/help.js.map +1 -0
  141. package/dist/commands/slash/index-cmd.d.ts +41 -0
  142. package/dist/commands/slash/index-cmd.d.ts.map +1 -0
  143. package/dist/commands/slash/index-cmd.js +349 -0
  144. package/dist/commands/slash/index-cmd.js.map +1 -0
  145. package/dist/commands/slash/index.d.ts +97 -0
  146. package/dist/commands/slash/index.d.ts.map +1 -0
  147. package/dist/commands/slash/index.js +251 -0
  148. package/dist/commands/slash/index.js.map +1 -0
  149. package/dist/commands/slash/login.d.ts +23 -0
  150. package/dist/commands/slash/login.d.ts.map +1 -0
  151. package/dist/commands/slash/login.js +175 -0
  152. package/dist/commands/slash/login.js.map +1 -0
  153. package/dist/commands/slash/logout.d.ts +23 -0
  154. package/dist/commands/slash/logout.d.ts.map +1 -0
  155. package/dist/commands/slash/logout.js +153 -0
  156. package/dist/commands/slash/logout.js.map +1 -0
  157. package/dist/commands/slash/logs.d.ts +29 -0
  158. package/dist/commands/slash/logs.d.ts.map +1 -0
  159. package/dist/commands/slash/logs.js +423 -0
  160. package/dist/commands/slash/logs.js.map +1 -0
  161. package/dist/commands/slash/mcp.d.ts +29 -0
  162. package/dist/commands/slash/mcp.d.ts.map +1 -0
  163. package/dist/commands/slash/mcp.js +1026 -0
  164. package/dist/commands/slash/mcp.js.map +1 -0
  165. package/dist/commands/slash/model.d.ts +60 -0
  166. package/dist/commands/slash/model.d.ts.map +1 -0
  167. package/dist/commands/slash/model.js +466 -0
  168. package/dist/commands/slash/model.js.map +1 -0
  169. package/dist/commands/slash/personality.d.ts +40 -0
  170. package/dist/commands/slash/personality.d.ts.map +1 -0
  171. package/dist/commands/slash/personality.js +272 -0
  172. package/dist/commands/slash/personality.js.map +1 -0
  173. package/dist/commands/slash/purge.d.ts +42 -0
  174. package/dist/commands/slash/purge.d.ts.map +1 -0
  175. package/dist/commands/slash/purge.js +233 -0
  176. package/dist/commands/slash/purge.js.map +1 -0
  177. package/dist/commands/slash/reset.d.ts +44 -0
  178. package/dist/commands/slash/reset.d.ts.map +1 -0
  179. package/dist/commands/slash/reset.js +326 -0
  180. package/dist/commands/slash/reset.js.map +1 -0
  181. package/dist/commands/slash/skills.d.ts +40 -0
  182. package/dist/commands/slash/skills.d.ts.map +1 -0
  183. package/dist/commands/slash/skills.js +207 -0
  184. package/dist/commands/slash/skills.js.map +1 -0
  185. package/dist/commands/slash/tokens.d.ts +34 -0
  186. package/dist/commands/slash/tokens.d.ts.map +1 -0
  187. package/dist/commands/slash/tokens.js +205 -0
  188. package/dist/commands/slash/tokens.js.map +1 -0
  189. package/dist/commands/slash/unleash.d.ts +50 -0
  190. package/dist/commands/slash/unleash.d.ts.map +1 -0
  191. package/dist/commands/slash/unleash.js +262 -0
  192. package/dist/commands/slash/unleash.js.map +1 -0
  193. package/dist/commands/slash/update.d.ts +34 -0
  194. package/dist/commands/slash/update.d.ts.map +1 -0
  195. package/dist/commands/slash/update.js +364 -0
  196. package/dist/commands/slash/update.js.map +1 -0
  197. package/dist/commands/slash/wrap.d.ts +18 -0
  198. package/dist/commands/slash/wrap.d.ts.map +1 -0
  199. package/dist/commands/slash/wrap.js +21 -0
  200. package/dist/commands/slash/wrap.js.map +1 -0
  201. package/dist/commands/tokens.d.ts +26 -0
  202. package/dist/commands/tokens.d.ts.map +1 -0
  203. package/dist/commands/tokens.js +245 -0
  204. package/dist/commands/tokens.js.map +1 -0
  205. package/dist/constants/builtin-agents.d.ts +27 -0
  206. package/dist/constants/builtin-agents.d.ts.map +1 -0
  207. package/dist/constants/builtin-agents.js +710 -0
  208. package/dist/constants/builtin-agents.js.map +1 -0
  209. package/dist/constants/builtin-skills.d.ts +32 -0
  210. package/dist/constants/builtin-skills.d.ts.map +1 -0
  211. package/dist/constants/builtin-skills.js +389 -0
  212. package/dist/constants/builtin-skills.js.map +1 -0
  213. package/dist/constants/defaults.d.ts +448 -0
  214. package/dist/constants/defaults.d.ts.map +1 -0
  215. package/dist/constants/defaults.js +829 -0
  216. package/dist/constants/defaults.js.map +1 -0
  217. package/dist/constants/index.d.ts +27 -0
  218. package/dist/constants/index.d.ts.map +1 -0
  219. package/dist/constants/index.js +85 -0
  220. package/dist/constants/index.js.map +1 -0
  221. package/dist/constants/install-hints.d.ts +7 -0
  222. package/dist/constants/install-hints.d.ts.map +1 -0
  223. package/dist/constants/install-hints.js +123 -0
  224. package/dist/constants/install-hints.js.map +1 -0
  225. package/dist/constants/models.d.ts +255 -0
  226. package/dist/constants/models.d.ts.map +1 -0
  227. package/dist/constants/models.js +596 -0
  228. package/dist/constants/models.js.map +1 -0
  229. package/dist/constants/schedule.d.ts +43 -0
  230. package/dist/constants/schedule.d.ts.map +1 -0
  231. package/dist/constants/schedule.js +110 -0
  232. package/dist/constants/schedule.js.map +1 -0
  233. package/dist/constants/system-utilities.d.ts +57 -0
  234. package/dist/constants/system-utilities.d.ts.map +1 -0
  235. package/dist/constants/system-utilities.js +421 -0
  236. package/dist/constants/system-utilities.js.map +1 -0
  237. package/dist/constants/token-limits.d.ts +102 -0
  238. package/dist/constants/token-limits.d.ts.map +1 -0
  239. package/dist/constants/token-limits.js +286 -0
  240. package/dist/constants/token-limits.js.map +1 -0
  241. package/dist/core/autocomplete.d.ts +132 -0
  242. package/dist/core/autocomplete.d.ts.map +1 -0
  243. package/dist/core/autocomplete.js +653 -0
  244. package/dist/core/autocomplete.js.map +1 -0
  245. package/dist/core/command-parser.d.ts +301 -0
  246. package/dist/core/command-parser.d.ts.map +1 -0
  247. package/dist/core/command-parser.js +526 -0
  248. package/dist/core/command-parser.js.map +1 -0
  249. package/dist/core/context-builder.d.ts +264 -0
  250. package/dist/core/context-builder.d.ts.map +1 -0
  251. package/dist/core/context-builder.js +1018 -0
  252. package/dist/core/context-builder.js.map +1 -0
  253. package/dist/core/event-emitter.d.ts +411 -0
  254. package/dist/core/event-emitter.d.ts.map +1 -0
  255. package/dist/core/event-emitter.js +138 -0
  256. package/dist/core/event-emitter.js.map +1 -0
  257. package/dist/core/history-manager.d.ts +62 -0
  258. package/dist/core/history-manager.d.ts.map +1 -0
  259. package/dist/core/history-manager.js +151 -0
  260. package/dist/core/history-manager.js.map +1 -0
  261. package/dist/core/slash-command-handler.d.ts +352 -0
  262. package/dist/core/slash-command-handler.d.ts.map +1 -0
  263. package/dist/core/slash-command-handler.js +563 -0
  264. package/dist/core/slash-command-handler.js.map +1 -0
  265. package/dist/core/task-processor.d.ts +179 -0
  266. package/dist/core/task-processor.d.ts.map +1 -0
  267. package/dist/core/task-processor.js +519 -0
  268. package/dist/core/task-processor.js.map +1 -0
  269. package/dist/index.d.ts +90 -0
  270. package/dist/index.d.ts.map +1 -0
  271. package/dist/index.js +4 -3
  272. package/dist/index.js.map +1 -0
  273. package/dist/prompts/agent-prompt-generator.d.ts +26 -0
  274. package/dist/prompts/agent-prompt-generator.d.ts.map +1 -0
  275. package/dist/prompts/agent-prompt-generator.js +244 -0
  276. package/dist/prompts/agent-prompt-generator.js.map +1 -0
  277. package/dist/prompts/commit-message.d.ts +35 -0
  278. package/dist/prompts/commit-message.d.ts.map +1 -0
  279. package/dist/prompts/commit-message.js +187 -0
  280. package/dist/prompts/commit-message.js.map +1 -0
  281. package/dist/prompts/conversation.d.ts +51 -0
  282. package/dist/prompts/conversation.d.ts.map +1 -0
  283. package/dist/prompts/conversation.js +115 -0
  284. package/dist/prompts/conversation.js.map +1 -0
  285. package/dist/prompts/index.d.ts +39 -0
  286. package/dist/prompts/index.d.ts.map +1 -0
  287. package/dist/prompts/index.js +74 -0
  288. package/dist/prompts/index.js.map +1 -0
  289. package/dist/prompts/memory.d.ts +6 -0
  290. package/dist/prompts/memory.d.ts.map +1 -0
  291. package/dist/prompts/memory.js +29 -0
  292. package/dist/prompts/memory.js.map +1 -0
  293. package/dist/prompts/personality.d.ts +77 -0
  294. package/dist/prompts/personality.d.ts.map +1 -0
  295. package/dist/prompts/personality.js +393 -0
  296. package/dist/prompts/personality.js.map +1 -0
  297. package/dist/prompts/plan-generator.d.ts +144 -0
  298. package/dist/prompts/plan-generator.d.ts.map +1 -0
  299. package/dist/prompts/plan-generator.js +553 -0
  300. package/dist/prompts/plan-generator.js.map +1 -0
  301. package/dist/prompts/system.d.ts +95 -0
  302. package/dist/prompts/system.d.ts.map +1 -0
  303. package/dist/prompts/system.js +461 -0
  304. package/dist/prompts/system.js.map +1 -0
  305. package/dist/prompts/task-processor.d.ts +94 -0
  306. package/dist/prompts/task-processor.d.ts.map +1 -0
  307. package/dist/prompts/task-processor.js +554 -0
  308. package/dist/prompts/task-processor.js.map +1 -0
  309. package/dist/prompts/unguarded.d.ts +78 -0
  310. package/dist/prompts/unguarded.d.ts.map +1 -0
  311. package/dist/prompts/unguarded.js +418 -0
  312. package/dist/prompts/unguarded.js.map +1 -0
  313. package/dist/prompts/utils.d.ts +73 -0
  314. package/dist/prompts/utils.d.ts.map +1 -0
  315. package/dist/prompts/utils.js +114 -0
  316. package/dist/prompts/utils.js.map +1 -0
  317. package/dist/prompts/workflow.d.ts +241 -0
  318. package/dist/prompts/workflow.d.ts.map +1 -0
  319. package/dist/prompts/workflow.js +608 -0
  320. package/dist/prompts/workflow.js.map +1 -0
  321. package/dist/services/action-logger.d.ts +383 -0
  322. package/dist/services/action-logger.d.ts.map +1 -0
  323. package/dist/services/action-logger.js +544 -0
  324. package/dist/services/action-logger.js.map +1 -0
  325. package/dist/services/agent-budget-allocator.d.ts +111 -0
  326. package/dist/services/agent-budget-allocator.d.ts.map +1 -0
  327. package/dist/services/agent-budget-allocator.js +278 -0
  328. package/dist/services/agent-budget-allocator.js.map +1 -0
  329. package/dist/services/agent-manager.d.ts +181 -0
  330. package/dist/services/agent-manager.d.ts.map +1 -0
  331. package/dist/services/agent-manager.js +749 -0
  332. package/dist/services/agent-manager.js.map +1 -0
  333. package/dist/services/agent-spawner.d.ts +138 -0
  334. package/dist/services/agent-spawner.d.ts.map +1 -0
  335. package/dist/services/agent-spawner.js +748 -0
  336. package/dist/services/agent-spawner.js.map +1 -0
  337. package/dist/services/agent-state-service.d.ts +145 -0
  338. package/dist/services/agent-state-service.d.ts.map +1 -0
  339. package/dist/services/agent-state-service.js +247 -0
  340. package/dist/services/agent-state-service.js.map +1 -0
  341. package/dist/services/anthropic-client.d.ts +357 -0
  342. package/dist/services/anthropic-client.d.ts.map +1 -0
  343. package/dist/services/anthropic-client.js +1451 -0
  344. package/dist/services/anthropic-client.js.map +1 -0
  345. package/dist/services/approval-manager.d.ts +385 -0
  346. package/dist/services/approval-manager.d.ts.map +1 -0
  347. package/dist/services/approval-manager.js +1044 -0
  348. package/dist/services/approval-manager.js.map +1 -0
  349. package/dist/services/audit-logger.d.ts +245 -0
  350. package/dist/services/audit-logger.d.ts.map +1 -0
  351. package/dist/services/audit-logger.js +324 -0
  352. package/dist/services/audit-logger.js.map +1 -0
  353. package/dist/services/backup-manager.d.ts +136 -0
  354. package/dist/services/backup-manager.d.ts.map +1 -0
  355. package/dist/services/backup-manager.js +260 -0
  356. package/dist/services/backup-manager.js.map +1 -0
  357. package/dist/services/cache-service.d.ts +247 -0
  358. package/dist/services/cache-service.d.ts.map +1 -0
  359. package/dist/services/cache-service.js +558 -0
  360. package/dist/services/cache-service.js.map +1 -0
  361. package/dist/services/chat-archival-service.d.ts +108 -0
  362. package/dist/services/chat-archival-service.d.ts.map +1 -0
  363. package/dist/services/chat-archival-service.js +465 -0
  364. package/dist/services/chat-archival-service.js.map +1 -0
  365. package/dist/services/codebase-indexer.d.ts +272 -0
  366. package/dist/services/codebase-indexer.d.ts.map +1 -0
  367. package/dist/services/codebase-indexer.js +863 -0
  368. package/dist/services/codebase-indexer.js.map +1 -0
  369. package/dist/services/compass-auth-service.d.ts +204 -0
  370. package/dist/services/compass-auth-service.d.ts.map +1 -0
  371. package/dist/services/compass-auth-service.js +391 -0
  372. package/dist/services/compass-auth-service.js.map +1 -0
  373. package/dist/services/complexity-classifier.d.ts +208 -0
  374. package/dist/services/complexity-classifier.d.ts.map +1 -0
  375. package/dist/services/complexity-classifier.js +1410 -0
  376. package/dist/services/complexity-classifier.js.map +1 -0
  377. package/dist/services/config-manager.d.ts +278 -0
  378. package/dist/services/config-manager.d.ts.map +1 -0
  379. package/dist/services/config-manager.js +651 -0
  380. package/dist/services/config-manager.js.map +1 -0
  381. package/dist/services/consent-manager.d.ts +239 -0
  382. package/dist/services/consent-manager.d.ts.map +1 -0
  383. package/dist/services/consent-manager.js +516 -0
  384. package/dist/services/consent-manager.js.map +1 -0
  385. package/dist/services/conversation-compactor.d.ts +223 -0
  386. package/dist/services/conversation-compactor.d.ts.map +1 -0
  387. package/dist/services/conversation-compactor.js +750 -0
  388. package/dist/services/conversation-compactor.js.map +1 -0
  389. package/dist/services/cost-tracker.d.ts +167 -0
  390. package/dist/services/cost-tracker.d.ts.map +1 -0
  391. package/dist/services/cost-tracker.js +199 -0
  392. package/dist/services/cost-tracker.js.map +1 -0
  393. package/dist/services/credential-store.d.ts +273 -0
  394. package/dist/services/credential-store.d.ts.map +1 -0
  395. package/dist/services/credential-store.js +877 -0
  396. package/dist/services/credential-store.js.map +1 -0
  397. package/dist/services/custom-command-service.d.ts +112 -0
  398. package/dist/services/custom-command-service.d.ts.map +1 -0
  399. package/dist/services/custom-command-service.js +464 -0
  400. package/dist/services/custom-command-service.js.map +1 -0
  401. package/dist/services/default-statusline-renderer.d.ts +60 -0
  402. package/dist/services/default-statusline-renderer.d.ts.map +1 -0
  403. package/dist/services/default-statusline-renderer.js +110 -0
  404. package/dist/services/default-statusline-renderer.js.map +1 -0
  405. package/dist/services/enhanced-context-gatherer.d.ts +116 -0
  406. package/dist/services/enhanced-context-gatherer.d.ts.map +1 -0
  407. package/dist/services/enhanced-context-gatherer.js +605 -0
  408. package/dist/services/enhanced-context-gatherer.js.map +1 -0
  409. package/dist/services/file-hash-tracker.d.ts +95 -0
  410. package/dist/services/file-hash-tracker.d.ts.map +1 -0
  411. package/dist/services/file-hash-tracker.js +199 -0
  412. package/dist/services/file-hash-tracker.js.map +1 -0
  413. package/dist/services/file-service.d.ts +274 -0
  414. package/dist/services/file-service.d.ts.map +1 -0
  415. package/dist/services/file-service.js +876 -0
  416. package/dist/services/file-service.js.map +1 -0
  417. package/dist/services/git-service.d.ts +536 -0
  418. package/dist/services/git-service.d.ts.map +1 -0
  419. package/dist/services/git-service.js +1215 -0
  420. package/dist/services/git-service.js.map +1 -0
  421. package/dist/services/hook-service.d.ts +148 -0
  422. package/dist/services/hook-service.d.ts.map +1 -0
  423. package/dist/services/hook-service.js +705 -0
  424. package/dist/services/hook-service.js.map +1 -0
  425. package/dist/services/ide-state-service.d.ts +114 -0
  426. package/dist/services/ide-state-service.d.ts.map +1 -0
  427. package/dist/services/ide-state-service.js +204 -0
  428. package/dist/services/ide-state-service.js.map +1 -0
  429. package/dist/services/interactive-clarifier.d.ts +90 -0
  430. package/dist/services/interactive-clarifier.d.ts.map +1 -0
  431. package/dist/services/interactive-clarifier.js +446 -0
  432. package/dist/services/interactive-clarifier.js.map +1 -0
  433. package/dist/services/iteration-scoper.d.ts +225 -0
  434. package/dist/services/iteration-scoper.d.ts.map +1 -0
  435. package/dist/services/iteration-scoper.js +387 -0
  436. package/dist/services/iteration-scoper.js.map +1 -0
  437. package/dist/services/llm-plan-generator.d.ts +44 -0
  438. package/dist/services/llm-plan-generator.d.ts.map +1 -0
  439. package/dist/services/llm-plan-generator.js +863 -0
  440. package/dist/services/llm-plan-generator.js.map +1 -0
  441. package/dist/services/llm-system-prompt-generator.d.ts +85 -0
  442. package/dist/services/llm-system-prompt-generator.d.ts.map +1 -0
  443. package/dist/services/llm-system-prompt-generator.js +257 -0
  444. package/dist/services/llm-system-prompt-generator.js.map +1 -0
  445. package/dist/services/log-interpreter.d.ts +190 -0
  446. package/dist/services/log-interpreter.d.ts.map +1 -0
  447. package/dist/services/log-interpreter.js +520 -0
  448. package/dist/services/log-interpreter.js.map +1 -0
  449. package/dist/services/mcp-config-manager.d.ts +141 -0
  450. package/dist/services/mcp-config-manager.d.ts.map +1 -0
  451. package/dist/services/mcp-config-manager.js +678 -0
  452. package/dist/services/mcp-config-manager.js.map +1 -0
  453. package/dist/services/mcp-oauth-service.d.ts +170 -0
  454. package/dist/services/mcp-oauth-service.d.ts.map +1 -0
  455. package/dist/services/mcp-oauth-service.js +892 -0
  456. package/dist/services/mcp-oauth-service.js.map +1 -0
  457. package/dist/services/mcp-plugin-support.d.ts +81 -0
  458. package/dist/services/mcp-plugin-support.d.ts.map +1 -0
  459. package/dist/services/mcp-plugin-support.js +305 -0
  460. package/dist/services/mcp-plugin-support.js.map +1 -0
  461. package/dist/services/mcp-server-manager.d.ts +134 -0
  462. package/dist/services/mcp-server-manager.d.ts.map +1 -0
  463. package/dist/services/mcp-server-manager.js +613 -0
  464. package/dist/services/mcp-server-manager.js.map +1 -0
  465. package/dist/services/mcp-tool-integration.d.ts +119 -0
  466. package/dist/services/mcp-tool-integration.d.ts.map +1 -0
  467. package/dist/services/mcp-tool-integration.js +381 -0
  468. package/dist/services/mcp-tool-integration.js.map +1 -0
  469. package/dist/services/mcp-transport.d.ts +105 -0
  470. package/dist/services/mcp-transport.d.ts.map +1 -0
  471. package/dist/services/mcp-transport.js +1316 -0
  472. package/dist/services/mcp-transport.js.map +1 -0
  473. package/dist/services/memory-service.d.ts +55 -0
  474. package/dist/services/memory-service.d.ts.map +1 -0
  475. package/dist/services/memory-service.js +251 -0
  476. package/dist/services/memory-service.js.map +1 -0
  477. package/dist/services/model-availability.d.ts +64 -0
  478. package/dist/services/model-availability.d.ts.map +1 -0
  479. package/dist/services/model-availability.js +114 -0
  480. package/dist/services/model-availability.js.map +1 -0
  481. package/dist/services/plan-generator.d.ts +98 -0
  482. package/dist/services/plan-generator.d.ts.map +1 -0
  483. package/dist/services/plan-generator.js +658 -0
  484. package/dist/services/plan-generator.js.map +1 -0
  485. package/dist/services/plan-mode-fallback.d.ts +80 -0
  486. package/dist/services/plan-mode-fallback.d.ts.map +1 -0
  487. package/dist/services/plan-mode-fallback.js +307 -0
  488. package/dist/services/plan-mode-fallback.js.map +1 -0
  489. package/dist/services/plan-mode-handler.d.ts +42 -0
  490. package/dist/services/plan-mode-handler.d.ts.map +1 -0
  491. package/dist/services/plan-mode-handler.js +388 -0
  492. package/dist/services/plan-mode-handler.js.map +1 -0
  493. package/dist/services/plan-persistence.d.ts +203 -0
  494. package/dist/services/plan-persistence.d.ts.map +1 -0
  495. package/dist/services/plan-persistence.js +538 -0
  496. package/dist/services/plan-persistence.js.map +1 -0
  497. package/dist/services/prompt-preprocessor.d.ts +73 -0
  498. package/dist/services/prompt-preprocessor.d.ts.map +1 -0
  499. package/dist/services/prompt-preprocessor.js +146 -0
  500. package/dist/services/prompt-preprocessor.js.map +1 -0
  501. package/dist/services/rating-service.d.ts +84 -0
  502. package/dist/services/rating-service.d.ts.map +1 -0
  503. package/dist/services/rating-service.js +171 -0
  504. package/dist/services/rating-service.js.map +1 -0
  505. package/dist/services/rating-state-manager.d.ts +131 -0
  506. package/dist/services/rating-state-manager.d.ts.map +1 -0
  507. package/dist/services/rating-state-manager.js +270 -0
  508. package/dist/services/rating-state-manager.js.map +1 -0
  509. package/dist/services/sdk-runner.d.ts +113 -0
  510. package/dist/services/sdk-runner.d.ts.map +1 -0
  511. package/dist/services/sdk-runner.js +1424 -0
  512. package/dist/services/sdk-runner.js.map +1 -0
  513. package/dist/services/session-manager.d.ts +528 -0
  514. package/dist/services/session-manager.d.ts.map +1 -0
  515. package/dist/services/session-manager.js +1184 -0
  516. package/dist/services/session-manager.js.map +1 -0
  517. package/dist/services/shell-executor.d.ts +337 -0
  518. package/dist/services/shell-executor.d.ts.map +1 -0
  519. package/dist/services/shell-executor.js +1201 -0
  520. package/dist/services/shell-executor.js.map +1 -0
  521. package/dist/services/skill-service.d.ts +149 -0
  522. package/dist/services/skill-service.d.ts.map +1 -0
  523. package/dist/services/skill-service.js +594 -0
  524. package/dist/services/skill-service.js.map +1 -0
  525. package/dist/services/statusline-executor.d.ts +102 -0
  526. package/dist/services/statusline-executor.d.ts.map +1 -0
  527. package/dist/services/statusline-executor.js +305 -0
  528. package/dist/services/statusline-executor.js.map +1 -0
  529. package/dist/services/step-tracker.d.ts +356 -0
  530. package/dist/services/step-tracker.d.ts.map +1 -0
  531. package/dist/services/step-tracker.js +634 -0
  532. package/dist/services/step-tracker.js.map +1 -0
  533. package/dist/services/system-event-logger.d.ts +473 -0
  534. package/dist/services/system-event-logger.d.ts.map +1 -0
  535. package/dist/services/system-event-logger.js +790 -0
  536. package/dist/services/system-event-logger.js.map +1 -0
  537. package/dist/services/system-utility-detector.d.ts +91 -0
  538. package/dist/services/system-utility-detector.d.ts.map +1 -0
  539. package/dist/services/system-utility-detector.js +238 -0
  540. package/dist/services/system-utility-detector.js.map +1 -0
  541. package/dist/services/team-context-store.d.ts +100 -0
  542. package/dist/services/team-context-store.d.ts.map +1 -0
  543. package/dist/services/team-context-store.js +513 -0
  544. package/dist/services/team-context-store.js.map +1 -0
  545. package/dist/services/temp-file-service.d.ts +164 -0
  546. package/dist/services/temp-file-service.d.ts.map +1 -0
  547. package/dist/services/temp-file-service.js +303 -0
  548. package/dist/services/temp-file-service.js.map +1 -0
  549. package/dist/services/token-limit-enforcer.d.ts +53 -0
  550. package/dist/services/token-limit-enforcer.d.ts.map +1 -0
  551. package/dist/services/token-limit-enforcer.js +90 -0
  552. package/dist/services/token-limit-enforcer.js.map +1 -0
  553. package/dist/services/token-limit-store.d.ts +105 -0
  554. package/dist/services/token-limit-store.d.ts.map +1 -0
  555. package/dist/services/token-limit-store.js +288 -0
  556. package/dist/services/token-limit-store.js.map +1 -0
  557. package/dist/services/token-tracker.d.ts +290 -0
  558. package/dist/services/token-tracker.d.ts.map +1 -0
  559. package/dist/services/token-tracker.js +751 -0
  560. package/dist/services/token-tracker.js.map +1 -0
  561. package/dist/services/tool-registry.d.ts +302 -0
  562. package/dist/services/tool-registry.d.ts.map +1 -0
  563. package/dist/services/tool-registry.js +606 -0
  564. package/dist/services/tool-registry.js.map +1 -0
  565. package/dist/services/tools-logger.d.ts +152 -0
  566. package/dist/services/tools-logger.d.ts.map +1 -0
  567. package/dist/services/tools-logger.js +222 -0
  568. package/dist/services/tools-logger.js.map +1 -0
  569. package/dist/services/update-plan-handler.d.ts +56 -0
  570. package/dist/services/update-plan-handler.d.ts.map +1 -0
  571. package/dist/services/update-plan-handler.js +372 -0
  572. package/dist/services/update-plan-handler.js.map +1 -0
  573. package/dist/services/update-service.d.ts +197 -0
  574. package/dist/services/update-service.d.ts.map +1 -0
  575. package/dist/services/update-service.js +749 -0
  576. package/dist/services/update-service.js.map +1 -0
  577. package/dist/services/verifier.d.ts +113 -0
  578. package/dist/services/verifier.d.ts.map +1 -0
  579. package/dist/services/verifier.js +541 -0
  580. package/dist/services/verifier.js.map +1 -0
  581. package/dist/services/workflow-manager.d.ts +277 -0
  582. package/dist/services/workflow-manager.d.ts.map +1 -0
  583. package/dist/services/workflow-manager.js +616 -0
  584. package/dist/services/workflow-manager.js.map +1 -0
  585. package/dist/services/workflow-orchestrator.d.ts +148 -0
  586. package/dist/services/workflow-orchestrator.d.ts.map +1 -0
  587. package/dist/services/workflow-orchestrator.js +617 -0
  588. package/dist/services/workflow-orchestrator.js.map +1 -0
  589. package/dist/services/worktree-manager.d.ts +36 -0
  590. package/dist/services/worktree-manager.d.ts.map +1 -0
  591. package/dist/services/worktree-manager.js +185 -0
  592. package/dist/services/worktree-manager.js.map +1 -0
  593. package/dist/templates/ascii-art.d.ts +136 -0
  594. package/dist/templates/ascii-art.d.ts.map +1 -0
  595. package/dist/templates/ascii-art.js +286 -0
  596. package/dist/templates/ascii-art.js.map +1 -0
  597. package/dist/templates/help.d.ts +186 -0
  598. package/dist/templates/help.d.ts.map +1 -0
  599. package/dist/templates/help.js +588 -0
  600. package/dist/templates/help.js.map +1 -0
  601. package/dist/templates/prompts/workflow-prompts.d.ts +9 -0
  602. package/dist/templates/prompts/workflow-prompts.d.ts.map +1 -0
  603. package/dist/templates/prompts/workflow-prompts.js +9 -0
  604. package/dist/templates/prompts/workflow-prompts.js.map +1 -0
  605. package/dist/tools/agent-tools.d.ts +9 -0
  606. package/dist/tools/agent-tools.d.ts.map +1 -0
  607. package/dist/tools/agent-tools.js +349 -0
  608. package/dist/tools/agent-tools.js.map +1 -0
  609. package/dist/tools/edit-replacers.d.ts +90 -0
  610. package/dist/tools/edit-replacers.d.ts.map +1 -0
  611. package/dist/tools/edit-replacers.js +553 -0
  612. package/dist/tools/edit-replacers.js.map +1 -0
  613. package/dist/tools/file-tools.d.ts +13 -0
  614. package/dist/tools/file-tools.d.ts.map +1 -0
  615. package/dist/tools/file-tools.js +954 -0
  616. package/dist/tools/file-tools.js.map +1 -0
  617. package/dist/tools/git-tools.d.ts +9 -0
  618. package/dist/tools/git-tools.d.ts.map +1 -0
  619. package/dist/tools/git-tools.js +261 -0
  620. package/dist/tools/git-tools.js.map +1 -0
  621. package/dist/tools/index.d.ts +13 -0
  622. package/dist/tools/index.d.ts.map +1 -0
  623. package/dist/tools/index.js +70 -0
  624. package/dist/tools/index.js.map +1 -0
  625. package/dist/tools/network-tools.d.ts +8 -0
  626. package/dist/tools/network-tools.d.ts.map +1 -0
  627. package/dist/tools/network-tools.js +261 -0
  628. package/dist/tools/network-tools.js.map +1 -0
  629. package/dist/tools/openai-tools.d.ts +16 -0
  630. package/dist/tools/openai-tools.d.ts.map +1 -0
  631. package/dist/tools/openai-tools.js +385 -0
  632. package/dist/tools/openai-tools.js.map +1 -0
  633. package/dist/tools/plan-tools.d.ts +9 -0
  634. package/dist/tools/plan-tools.d.ts.map +1 -0
  635. package/dist/tools/plan-tools.js +223 -0
  636. package/dist/tools/plan-tools.js.map +1 -0
  637. package/dist/tools/schedule-tools.d.ts +9 -0
  638. package/dist/tools/schedule-tools.d.ts.map +1 -0
  639. package/dist/tools/schedule-tools.js +405 -0
  640. package/dist/tools/schedule-tools.js.map +1 -0
  641. package/dist/tools/search-tools.d.ts +8 -0
  642. package/dist/tools/search-tools.d.ts.map +1 -0
  643. package/dist/tools/search-tools.js +357 -0
  644. package/dist/tools/search-tools.js.map +1 -0
  645. package/dist/tools/shared-utils.d.ts +91 -0
  646. package/dist/tools/shared-utils.d.ts.map +1 -0
  647. package/dist/tools/shared-utils.js +385 -0
  648. package/dist/tools/shared-utils.js.map +1 -0
  649. package/dist/tools/shell-tools.d.ts +9 -0
  650. package/dist/tools/shell-tools.d.ts.map +1 -0
  651. package/dist/tools/shell-tools.js +409 -0
  652. package/dist/tools/shell-tools.js.map +1 -0
  653. package/dist/tools/skill-tools.d.ts +13 -0
  654. package/dist/tools/skill-tools.d.ts.map +1 -0
  655. package/dist/tools/skill-tools.js +244 -0
  656. package/dist/tools/skill-tools.js.map +1 -0
  657. package/dist/tools/swarm-tools.d.ts +9 -0
  658. package/dist/tools/swarm-tools.d.ts.map +1 -0
  659. package/dist/tools/swarm-tools.js +422 -0
  660. package/dist/tools/swarm-tools.js.map +1 -0
  661. package/dist/tools/user-tools.d.ts +13 -0
  662. package/dist/tools/user-tools.d.ts.map +1 -0
  663. package/dist/tools/user-tools.js +232 -0
  664. package/dist/tools/user-tools.js.map +1 -0
  665. package/dist/types/agent-process.d.ts +244 -0
  666. package/dist/types/agent-process.d.ts.map +1 -0
  667. package/dist/types/agent-process.js +93 -0
  668. package/dist/types/agent-process.js.map +1 -0
  669. package/dist/types/agent.d.ts +358 -0
  670. package/dist/types/agent.d.ts.map +1 -0
  671. package/dist/types/agent.js +171 -0
  672. package/dist/types/agent.js.map +1 -0
  673. package/dist/types/anthropic.d.ts +438 -0
  674. package/dist/types/anthropic.d.ts.map +1 -0
  675. package/dist/types/anthropic.js +9 -0
  676. package/dist/types/anthropic.js.map +1 -0
  677. package/dist/types/approval.d.ts +332 -0
  678. package/dist/types/approval.d.ts.map +1 -0
  679. package/dist/types/approval.js +44 -0
  680. package/dist/types/approval.js.map +1 -0
  681. package/dist/types/autocomplete.d.ts +57 -0
  682. package/dist/types/autocomplete.d.ts.map +1 -0
  683. package/dist/types/autocomplete.js +7 -0
  684. package/dist/types/autocomplete.js.map +1 -0
  685. package/dist/types/chat-archive.d.ts +161 -0
  686. package/dist/types/chat-archive.d.ts.map +1 -0
  687. package/dist/types/chat-archive.js +36 -0
  688. package/dist/types/chat-archive.js.map +1 -0
  689. package/dist/types/config.d.ts +268 -0
  690. package/dist/types/config.d.ts.map +1 -0
  691. package/dist/types/config.js +188 -0
  692. package/dist/types/config.js.map +1 -0
  693. package/dist/types/consent.d.ts +191 -0
  694. package/dist/types/consent.d.ts.map +1 -0
  695. package/dist/types/consent.js +119 -0
  696. package/dist/types/consent.js.map +1 -0
  697. package/dist/types/custom-command.d.ts +139 -0
  698. package/dist/types/custom-command.d.ts.map +1 -0
  699. package/dist/types/custom-command.js +7 -0
  700. package/dist/types/custom-command.js.map +1 -0
  701. package/dist/types/git.d.ts +20 -0
  702. package/dist/types/git.d.ts.map +1 -0
  703. package/dist/types/git.js +2 -0
  704. package/dist/types/git.js.map +1 -0
  705. package/dist/types/hook.d.ts +342 -0
  706. package/dist/types/hook.d.ts.map +1 -0
  707. package/dist/types/hook.js +84 -0
  708. package/dist/types/hook.js.map +1 -0
  709. package/dist/types/index.d.ts +86 -0
  710. package/dist/types/index.d.ts.map +1 -0
  711. package/dist/types/index.js +71 -0
  712. package/dist/types/index.js.map +1 -0
  713. package/dist/types/mcp.d.ts +456 -0
  714. package/dist/types/mcp.d.ts.map +1 -0
  715. package/dist/types/mcp.js +94 -0
  716. package/dist/types/mcp.js.map +1 -0
  717. package/dist/types/rating.d.ts +110 -0
  718. package/dist/types/rating.d.ts.map +1 -0
  719. package/dist/types/rating.js +53 -0
  720. package/dist/types/rating.js.map +1 -0
  721. package/dist/types/schedule.d.ts +91 -0
  722. package/dist/types/schedule.d.ts.map +1 -0
  723. package/dist/types/schedule.js +8 -0
  724. package/dist/types/schedule.js.map +1 -0
  725. package/dist/types/session.d.ts +361 -0
  726. package/dist/types/session.d.ts.map +1 -0
  727. package/dist/types/session.js +9 -0
  728. package/dist/types/session.js.map +1 -0
  729. package/dist/types/skill.d.ts +258 -0
  730. package/dist/types/skill.d.ts.map +1 -0
  731. package/dist/types/skill.js +79 -0
  732. package/dist/types/skill.js.map +1 -0
  733. package/dist/types/statusline.d.ts +212 -0
  734. package/dist/types/statusline.d.ts.map +1 -0
  735. package/dist/types/statusline.js +8 -0
  736. package/dist/types/statusline.js.map +1 -0
  737. package/dist/types/stream.d.ts +61 -0
  738. package/dist/types/stream.d.ts.map +1 -0
  739. package/dist/types/stream.js +17 -0
  740. package/dist/types/stream.js.map +1 -0
  741. package/dist/types/swarm.d.ts +132 -0
  742. package/dist/types/swarm.d.ts.map +1 -0
  743. package/dist/types/swarm.js +21 -0
  744. package/dist/types/swarm.js.map +1 -0
  745. package/dist/types/token-limits.d.ts +107 -0
  746. package/dist/types/token-limits.d.ts.map +1 -0
  747. package/dist/types/token-limits.js +57 -0
  748. package/dist/types/token-limits.js.map +1 -0
  749. package/dist/types/token.d.ts +329 -0
  750. package/dist/types/token.d.ts.map +1 -0
  751. package/dist/types/token.js +9 -0
  752. package/dist/types/token.js.map +1 -0
  753. package/dist/types/update.d.ts +189 -0
  754. package/dist/types/update.d.ts.map +1 -0
  755. package/dist/types/update.js +55 -0
  756. package/dist/types/update.js.map +1 -0
  757. package/dist/types/workflow.d.ts +396 -0
  758. package/dist/types/workflow.d.ts.map +1 -0
  759. package/dist/types/workflow.js +46 -0
  760. package/dist/types/workflow.js.map +1 -0
  761. package/dist/ui/App.d.ts +62 -0
  762. package/dist/ui/App.d.ts.map +1 -0
  763. package/dist/ui/App.js +511 -0
  764. package/dist/ui/App.js.map +1 -0
  765. package/dist/ui/InteractiveSession.d.ts +34 -0
  766. package/dist/ui/InteractiveSession.d.ts.map +1 -0
  767. package/dist/ui/InteractiveSession.js +3611 -0
  768. package/dist/ui/InteractiveSession.js.map +1 -0
  769. package/dist/ui/MCPApprovalPrompt.d.ts +27 -0
  770. package/dist/ui/MCPApprovalPrompt.d.ts.map +1 -0
  771. package/dist/ui/MCPApprovalPrompt.js +51 -0
  772. package/dist/ui/MCPApprovalPrompt.js.map +1 -0
  773. package/dist/ui/SetupWizard.d.ts +26 -0
  774. package/dist/ui/SetupWizard.d.ts.map +1 -0
  775. package/dist/ui/SetupWizard.js +396 -0
  776. package/dist/ui/SetupWizard.js.map +1 -0
  777. package/dist/ui/components/AgentCreationWizard.d.ts +36 -0
  778. package/dist/ui/components/AgentCreationWizard.d.ts.map +1 -0
  779. package/dist/ui/components/AgentCreationWizard.js +619 -0
  780. package/dist/ui/components/AgentCreationWizard.js.map +1 -0
  781. package/dist/ui/components/AgentManager.d.ts +41 -0
  782. package/dist/ui/components/AgentManager.d.ts.map +1 -0
  783. package/dist/ui/components/AgentManager.js +343 -0
  784. package/dist/ui/components/AgentManager.js.map +1 -0
  785. package/dist/ui/components/ApprovalDialog.d.ts +18 -0
  786. package/dist/ui/components/ApprovalDialog.d.ts.map +1 -0
  787. package/dist/ui/components/ApprovalDialog.js +439 -0
  788. package/dist/ui/components/ApprovalDialog.js.map +1 -0
  789. package/dist/ui/components/AsciiArt.d.ts +54 -0
  790. package/dist/ui/components/AsciiArt.d.ts.map +1 -0
  791. package/dist/ui/components/AsciiArt.js +89 -0
  792. package/dist/ui/components/AsciiArt.js.map +1 -0
  793. package/dist/ui/components/ClarificationWizard.d.ts +36 -0
  794. package/dist/ui/components/ClarificationWizard.d.ts.map +1 -0
  795. package/dist/ui/components/ClarificationWizard.js +407 -0
  796. package/dist/ui/components/ClarificationWizard.js.map +1 -0
  797. package/dist/ui/components/CompassSpinner.d.ts +15 -0
  798. package/dist/ui/components/CompassSpinner.d.ts.map +1 -0
  799. package/dist/ui/components/CompassSpinner.js +50 -0
  800. package/dist/ui/components/CompassSpinner.js.map +1 -0
  801. package/dist/ui/components/ConfirmationSelector.d.ts +45 -0
  802. package/dist/ui/components/ConfirmationSelector.d.ts.map +1 -0
  803. package/dist/ui/components/ConfirmationSelector.js +106 -0
  804. package/dist/ui/components/ConfirmationSelector.js.map +1 -0
  805. package/dist/ui/components/ContextUsage.d.ts +76 -0
  806. package/dist/ui/components/ContextUsage.d.ts.map +1 -0
  807. package/dist/ui/components/ContextUsage.js +188 -0
  808. package/dist/ui/components/ContextUsage.js.map +1 -0
  809. package/dist/ui/components/DiffPreview.d.ts +13 -0
  810. package/dist/ui/components/DiffPreview.d.ts.map +1 -0
  811. package/dist/ui/components/DiffPreview.js +30 -0
  812. package/dist/ui/components/DiffPreview.js.map +1 -0
  813. package/dist/ui/components/ExecutionModeSelector.d.ts +45 -0
  814. package/dist/ui/components/ExecutionModeSelector.d.ts.map +1 -0
  815. package/dist/ui/components/ExecutionModeSelector.js +120 -0
  816. package/dist/ui/components/ExecutionModeSelector.js.map +1 -0
  817. package/dist/ui/components/FileTree.d.ts +47 -0
  818. package/dist/ui/components/FileTree.d.ts.map +1 -0
  819. package/dist/ui/components/FileTree.js +258 -0
  820. package/dist/ui/components/FileTree.js.map +1 -0
  821. package/dist/ui/components/HelpMenu.d.ts +49 -0
  822. package/dist/ui/components/HelpMenu.d.ts.map +1 -0
  823. package/dist/ui/components/HelpMenu.js +91 -0
  824. package/dist/ui/components/HelpMenu.js.map +1 -0
  825. package/dist/ui/components/InterleavedStream.d.ts +42 -0
  826. package/dist/ui/components/InterleavedStream.d.ts.map +1 -0
  827. package/dist/ui/components/InterleavedStream.js +1500 -0
  828. package/dist/ui/components/InterleavedStream.js.map +1 -0
  829. package/dist/ui/components/ModelSelector.d.ts +81 -0
  830. package/dist/ui/components/ModelSelector.d.ts.map +1 -0
  831. package/dist/ui/components/ModelSelector.js +305 -0
  832. package/dist/ui/components/ModelSelector.js.map +1 -0
  833. package/dist/ui/components/PlanApprovalDialog.d.ts +21 -0
  834. package/dist/ui/components/PlanApprovalDialog.d.ts.map +1 -0
  835. package/dist/ui/components/PlanApprovalDialog.js +189 -0
  836. package/dist/ui/components/PlanApprovalDialog.js.map +1 -0
  837. package/dist/ui/components/PlanExecutionTracker.d.ts +53 -0
  838. package/dist/ui/components/PlanExecutionTracker.d.ts.map +1 -0
  839. package/dist/ui/components/PlanExecutionTracker.js +113 -0
  840. package/dist/ui/components/PlanExecutionTracker.js.map +1 -0
  841. package/dist/ui/components/ProgressIndicator.d.ts +151 -0
  842. package/dist/ui/components/ProgressIndicator.d.ts.map +1 -0
  843. package/dist/ui/components/ProgressIndicator.js +171 -0
  844. package/dist/ui/components/ProgressIndicator.js.map +1 -0
  845. package/dist/ui/components/Prompt.d.ts +47 -0
  846. package/dist/ui/components/Prompt.d.ts.map +1 -0
  847. package/dist/ui/components/Prompt.js +632 -0
  848. package/dist/ui/components/Prompt.js.map +1 -0
  849. package/dist/ui/components/RatingPanel.d.ts +45 -0
  850. package/dist/ui/components/RatingPanel.d.ts.map +1 -0
  851. package/dist/ui/components/RatingPanel.js +119 -0
  852. package/dist/ui/components/RatingPanel.js.map +1 -0
  853. package/dist/ui/components/StatusLine.d.ts +43 -0
  854. package/dist/ui/components/StatusLine.d.ts.map +1 -0
  855. package/dist/ui/components/StatusLine.js +44 -0
  856. package/dist/ui/components/StatusLine.js.map +1 -0
  857. package/dist/ui/components/StreamingResponse.d.ts +45 -0
  858. package/dist/ui/components/StreamingResponse.d.ts.map +1 -0
  859. package/dist/ui/components/StreamingResponse.js +56 -0
  860. package/dist/ui/components/StreamingResponse.js.map +1 -0
  861. package/dist/ui/components/TokenUsage.d.ts +89 -0
  862. package/dist/ui/components/TokenUsage.d.ts.map +1 -0
  863. package/dist/ui/components/TokenUsage.js +99 -0
  864. package/dist/ui/components/TokenUsage.js.map +1 -0
  865. package/dist/ui/components/ToolSummary.d.ts +77 -0
  866. package/dist/ui/components/ToolSummary.d.ts.map +1 -0
  867. package/dist/ui/components/ToolSummary.js +162 -0
  868. package/dist/ui/components/ToolSummary.js.map +1 -0
  869. package/dist/ui/components/UpdateNotification.d.ts +65 -0
  870. package/dist/ui/components/UpdateNotification.d.ts.map +1 -0
  871. package/dist/ui/components/UpdateNotification.js +166 -0
  872. package/dist/ui/components/UpdateNotification.js.map +1 -0
  873. package/dist/ui/diff-renderer.d.ts +18 -0
  874. package/dist/ui/diff-renderer.d.ts.map +1 -0
  875. package/dist/ui/diff-renderer.js +206 -0
  876. package/dist/ui/diff-renderer.js.map +1 -0
  877. package/dist/ui/themes/markdown-theme.d.ts +48 -0
  878. package/dist/ui/themes/markdown-theme.d.ts.map +1 -0
  879. package/dist/ui/themes/markdown-theme.js +79 -0
  880. package/dist/ui/themes/markdown-theme.js.map +1 -0
  881. package/dist/ui/themes/ui-theme.d.ts +301 -0
  882. package/dist/ui/themes/ui-theme.d.ts.map +1 -0
  883. package/dist/ui/themes/ui-theme.js +204 -0
  884. package/dist/ui/themes/ui-theme.js.map +1 -0
  885. package/dist/utils/attachment-handler.d.ts +129 -0
  886. package/dist/utils/attachment-handler.d.ts.map +1 -0
  887. package/dist/utils/attachment-handler.js +280 -0
  888. package/dist/utils/attachment-handler.js.map +1 -0
  889. package/dist/utils/backup-cleanup.d.ts +28 -0
  890. package/dist/utils/backup-cleanup.d.ts.map +1 -0
  891. package/dist/utils/backup-cleanup.js +99 -0
  892. package/dist/utils/backup-cleanup.js.map +1 -0
  893. package/dist/utils/clipboard-handler.d.ts +82 -0
  894. package/dist/utils/clipboard-handler.d.ts.map +1 -0
  895. package/dist/utils/clipboard-handler.js +311 -0
  896. package/dist/utils/clipboard-handler.js.map +1 -0
  897. package/dist/utils/cloud-detection.d.ts +14 -0
  898. package/dist/utils/cloud-detection.d.ts.map +1 -0
  899. package/dist/utils/cloud-detection.js +92 -0
  900. package/dist/utils/cloud-detection.js.map +1 -0
  901. package/dist/utils/command-parser.d.ts +56 -0
  902. package/dist/utils/command-parser.d.ts.map +1 -0
  903. package/dist/utils/command-parser.js +206 -0
  904. package/dist/utils/command-parser.js.map +1 -0
  905. package/dist/utils/console-capture.d.ts +30 -0
  906. package/dist/utils/console-capture.d.ts.map +1 -0
  907. package/dist/utils/console-capture.js +88 -0
  908. package/dist/utils/console-capture.js.map +1 -0
  909. package/dist/utils/cron-parser.d.ts +52 -0
  910. package/dist/utils/cron-parser.d.ts.map +1 -0
  911. package/dist/utils/cron-parser.js +455 -0
  912. package/dist/utils/cron-parser.js.map +1 -0
  913. package/dist/utils/crypto.d.ts +351 -0
  914. package/dist/utils/crypto.d.ts.map +1 -0
  915. package/dist/utils/crypto.js +615 -0
  916. package/dist/utils/crypto.js.map +1 -0
  917. package/dist/utils/diff.d.ts +311 -0
  918. package/dist/utils/diff.d.ts.map +1 -0
  919. package/dist/utils/diff.js +566 -0
  920. package/dist/utils/diff.js.map +1 -0
  921. package/dist/utils/editor.d.ts +12 -0
  922. package/dist/utils/editor.d.ts.map +1 -0
  923. package/dist/utils/editor.js +30 -0
  924. package/dist/utils/editor.js.map +1 -0
  925. package/dist/utils/file-system.d.ts +512 -0
  926. package/dist/utils/file-system.d.ts.map +1 -0
  927. package/dist/utils/file-system.js +798 -0
  928. package/dist/utils/file-system.js.map +1 -0
  929. package/dist/utils/format.d.ts +318 -0
  930. package/dist/utils/format.d.ts.map +1 -0
  931. package/dist/utils/format.js +587 -0
  932. package/dist/utils/format.js.map +1 -0
  933. package/dist/utils/ignore-patterns.d.ts +93 -0
  934. package/dist/utils/ignore-patterns.d.ts.map +1 -0
  935. package/dist/utils/ignore-patterns.js +710 -0
  936. package/dist/utils/ignore-patterns.js.map +1 -0
  937. package/dist/utils/log-cleanup.d.ts +16 -0
  938. package/dist/utils/log-cleanup.d.ts.map +1 -0
  939. package/dist/utils/log-cleanup.js +51 -0
  940. package/dist/utils/log-cleanup.js.map +1 -0
  941. package/dist/utils/logger.d.ts +305 -0
  942. package/dist/utils/logger.d.ts.map +1 -0
  943. package/dist/utils/logger.js +447 -0
  944. package/dist/utils/logger.js.map +1 -0
  945. package/dist/utils/path.d.ts +406 -0
  946. package/dist/utils/path.d.ts.map +1 -0
  947. package/dist/utils/path.js +549 -0
  948. package/dist/utils/path.js.map +1 -0
  949. package/dist/utils/schedule-file.d.ts +63 -0
  950. package/dist/utils/schedule-file.d.ts.map +1 -0
  951. package/dist/utils/schedule-file.js +244 -0
  952. package/dist/utils/schedule-file.js.map +1 -0
  953. package/dist/utils/task-id.d.ts +29 -0
  954. package/dist/utils/task-id.d.ts.map +1 -0
  955. package/dist/utils/task-id.js +53 -0
  956. package/dist/utils/task-id.js.map +1 -0
  957. package/dist/utils/temp-cleanup.d.ts +46 -0
  958. package/dist/utils/temp-cleanup.d.ts.map +1 -0
  959. package/dist/utils/temp-cleanup.js +95 -0
  960. package/dist/utils/temp-cleanup.js.map +1 -0
  961. package/dist/utils/terminal-output.d.ts +34 -0
  962. package/dist/utils/terminal-output.d.ts.map +1 -0
  963. package/dist/utils/terminal-output.js +40 -0
  964. package/dist/utils/terminal-output.js.map +1 -0
  965. package/dist/utils/token-counter.d.ts +224 -0
  966. package/dist/utils/token-counter.d.ts.map +1 -0
  967. package/dist/utils/token-counter.js +332 -0
  968. package/dist/utils/token-counter.js.map +1 -0
  969. package/dist/utils/tool-mapper.d.ts +70 -0
  970. package/dist/utils/tool-mapper.d.ts.map +1 -0
  971. package/dist/utils/tool-mapper.js +234 -0
  972. package/dist/utils/tool-mapper.js.map +1 -0
  973. package/package.json +2 -1
  974. package/scripts/preuninstall.mjs +99 -0
@@ -0,0 +1,1500 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /**
3
+ * React/ink component for rendering interleaved text and tool calls
4
+ * in Claude Code CLI style format.
5
+ *
6
+ * Example output:
7
+ * ```
8
+ * ● I'll first look at an existing ADR to understand the format...
9
+ *
10
+ * ● Read(file_path: "docs/adr/adr007.md")
11
+ * ⎿ Read 473 lines
12
+ *
13
+ * ● Search(pattern: "**\/*.ts")
14
+ * ⎿ Found 8 files
15
+ * ```
16
+ */
17
+ import React from 'react';
18
+ import { Box, Text } from 'ink';
19
+ import { marked } from 'marked';
20
+ import cliTruncate from 'cli-truncate';
21
+ import { createMarkdownRenderer } from '../themes/markdown-theme.js';
22
+ import { truncate, formatCompactNumber } from '../../utils/format.js';
23
+ import { getToolRegistry } from '../../services/tool-registry.js';
24
+ import { getSessionManager } from '../../services/session-manager.js';
25
+ import { getRelativePath, isPathWithin } from '../../utils/path.js';
26
+ /**
27
+ * Static activity indicator using empty circle.
28
+ * No animation to prevent layout bouncing from re-renders.
29
+ */
30
+ const ActivityDot = ({ color = 'cyan' }) => {
31
+ return _jsx(Text, { color: color, children: "\u25CB" });
32
+ };
33
+ /**
34
+ * Word-wraps text to fit within a given width, breaking at word boundaries.
35
+ * Returns an array of lines. Sentences that start after a period get their own line
36
+ * when possible for improved readability.
37
+ */
38
+ function wordWrap(text, maxWidth) {
39
+ if (maxWidth <= 0 || !text)
40
+ return [text];
41
+ // Split into sentences (at ". " boundaries) for intelligent breaking
42
+ const sentences = text.split(/(?<=\.)\s+/);
43
+ const lines = [];
44
+ let currentLine = '';
45
+ for (const sentence of sentences) {
46
+ // If adding this sentence would exceed width, start a new line
47
+ if (currentLine && (currentLine.length + 1 + sentence.length > maxWidth)) {
48
+ // If the current line is non-empty, push it
49
+ if (currentLine) {
50
+ lines.push(currentLine);
51
+ currentLine = '';
52
+ }
53
+ }
54
+ // If the sentence itself is longer than maxWidth, do word-level wrapping
55
+ if (sentence.length > maxWidth) {
56
+ const words = sentence.split(' ');
57
+ for (const word of words) {
58
+ if (!currentLine) {
59
+ currentLine = word;
60
+ }
61
+ else if (currentLine.length + 1 + word.length <= maxWidth) {
62
+ currentLine += ' ' + word;
63
+ }
64
+ else {
65
+ lines.push(currentLine);
66
+ currentLine = word;
67
+ }
68
+ }
69
+ }
70
+ else {
71
+ if (!currentLine) {
72
+ currentLine = sentence;
73
+ }
74
+ else {
75
+ currentLine += ' ' + sentence;
76
+ }
77
+ }
78
+ }
79
+ if (currentLine) {
80
+ lines.push(currentLine);
81
+ }
82
+ return lines.length > 0 ? lines : [text];
83
+ }
84
+ /**
85
+ * Converts an absolute file path to a relative path for display.
86
+ * Returns the original path if it's not within the project root or already relative.
87
+ */
88
+ function makePathRelative(filePath) {
89
+ // Skip if already relative
90
+ if (!filePath || (!filePath.startsWith('/') && !filePath.match(/^[A-Za-z]:\\/))) {
91
+ return filePath;
92
+ }
93
+ try {
94
+ const projectRoot = getSessionManager().getProjectRoot();
95
+ if (projectRoot && isPathWithin(filePath, projectRoot)) {
96
+ const relativePath = getRelativePath(filePath, projectRoot);
97
+ // Return relative path, or '.' if it's the root itself
98
+ return relativePath || '.';
99
+ }
100
+ }
101
+ catch {
102
+ // If session manager not available, return original path
103
+ }
104
+ return filePath;
105
+ }
106
+ /**
107
+ * Map of tool names to their essential display parameters.
108
+ * Tools listed here will only show the specified parameters in the UI.
109
+ * Tools not in this map will show all parameters.
110
+ */
111
+ const TOOL_DISPLAY_PARAMS = {
112
+ // File tools - only show path
113
+ read: ['file_path', 'path'],
114
+ read_file: ['file_path', 'path'],
115
+ write: ['file_path', 'path'],
116
+ write_file: ['file_path', 'path'],
117
+ edit: ['file_path', 'path'],
118
+ edit_file: ['file_path', 'path'],
119
+ delete: ['description'],
120
+ delete_file: ['description'],
121
+ create_directory: ['path'],
122
+ get_file_info: ['path'],
123
+ // Read multiple - handled specially, but define to filter params
124
+ read_multiple_files: ['paths'],
125
+ // Search tools - show pattern and path
126
+ glob: ['pattern', 'path'],
127
+ grep: ['pattern', 'path'],
128
+ search: ['pattern', 'path'],
129
+ // List tool - show pattern if present, otherwise path
130
+ list: ['pattern', 'path'],
131
+ list_directory: ['pattern', 'path'],
132
+ // Shell tools - show description in header, command shown separately
133
+ bash: ['description'],
134
+ shell: ['description'],
135
+ execute: ['description'],
136
+ execute_command: ['description'],
137
+ // Plan tools - only show task summary / modification request
138
+ plan: ['task_summary'],
139
+ update_plan: ['modification_request'],
140
+ complete_plan_task: ['task_id', 'summary'],
141
+ // Agent tools - only show task (agent type shown in display name)
142
+ spawn_task: ['task'],
143
+ task: ['prompt'],
144
+ // Poll task - only show process_id
145
+ poll_task: ['process_id'],
146
+ };
147
+ /**
148
+ * Map of tool names to their expected parameters (in generation order).
149
+ * Used to show progress during the 'generating' phase.
150
+ */
151
+ const TOOL_EXPECTED_PARAMS = {
152
+ // Edit tools - typically generate path, then old content, then new content
153
+ edit: ['file_path', 'old_string', 'new_string'],
154
+ edit_file: ['file_path', 'old_string', 'new_string'],
155
+ // Write tools - path then content
156
+ write: ['file_path', 'content'],
157
+ write_file: ['file_path', 'content'],
158
+ // Read tools - just path
159
+ read: ['file_path'],
160
+ read_file: ['file_path'],
161
+ // Search tools
162
+ glob: ['pattern', 'path'],
163
+ grep: ['pattern', 'path'],
164
+ search: ['pattern', 'path'],
165
+ // Shell tools
166
+ bash: ['command', 'timeout'],
167
+ shell: ['command'],
168
+ execute: ['command'],
169
+ execute_command: ['command'],
170
+ // Task/Agent tools
171
+ delegate_task: ['task_description', 'context'],
172
+ task: ['prompt'],
173
+ spawn_task: ['task', 'agent_type'],
174
+ };
175
+ /**
176
+ * Human-readable labels for parameter names
177
+ */
178
+ const PARAM_LABELS = {
179
+ file_path: 'file path',
180
+ old_string: 'content to replace',
181
+ new_string: 'new content',
182
+ content: 'content',
183
+ pattern: 'pattern',
184
+ path: 'path',
185
+ command: 'command',
186
+ timeout: 'timeout',
187
+ task_description: 'task',
188
+ context: 'context',
189
+ prompt: 'prompt',
190
+ subagent_type: 'agent type',
191
+ agent_type: 'agent type',
192
+ task: 'task',
193
+ };
194
+ /**
195
+ * Finds the common directory prefix from an array of file paths.
196
+ * Returns './' if no common prefix is found.
197
+ */
198
+ function findCommonDirectory(paths) {
199
+ if (!paths || paths.length === 0)
200
+ return './';
201
+ // First make all paths relative to project root
202
+ const relativePaths = paths.map((p) => makePathRelative(p));
203
+ if (relativePaths.length === 1) {
204
+ const dir = relativePaths[0].replace(/\\/g, '/').split('/').slice(0, -1).join('/');
205
+ return dir || './';
206
+ }
207
+ // Normalize paths and split into parts
208
+ const normalizedPaths = relativePaths.map((p) => p.replace(/\\/g, '/'));
209
+ const splitPaths = normalizedPaths.map((p) => p.split('/'));
210
+ // Find common prefix
211
+ const minLength = Math.min(...splitPaths.map((p) => p.length));
212
+ const commonParts = [];
213
+ for (let i = 0; i < minLength - 1; i++) { // -1 to exclude filename
214
+ const part = splitPaths[0][i];
215
+ if (splitPaths.every((p) => p[i] === part)) {
216
+ commonParts.push(part);
217
+ }
218
+ else {
219
+ break;
220
+ }
221
+ }
222
+ if (commonParts.length === 0)
223
+ return './';
224
+ return commonParts.join('/');
225
+ }
226
+ /**
227
+ * Extracts a clean display name from an MCP tool registry name.
228
+ * Strips the server name prefix and shows just the tool name.
229
+ * Example: mcp_fetch_fetch -> "Fetch", mcp_compass_web_search -> "Web Search"
230
+ */
231
+ function getMCPDisplayName(registryName) {
232
+ const lowerName = registryName.toLowerCase();
233
+ if (!lowerName.startsWith('mcp_')) {
234
+ return null;
235
+ }
236
+ const parts = registryName.substring(4).split('_'); // Remove 'mcp_' prefix
237
+ if (parts.length < 2) {
238
+ return null;
239
+ }
240
+ // First part is server name, rest is tool name
241
+ const serverName = parts[0];
242
+ const toolParts = parts.slice(1);
243
+ // Capitalize each part
244
+ const capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
245
+ // If server name equals tool name (e.g., mcp_fetch_fetch), just show the tool name
246
+ if (toolParts.length === 1 && toolParts[0].toLowerCase() === serverName.toLowerCase()) {
247
+ return capitalize(serverName);
248
+ }
249
+ // Otherwise show just the tool name without server prefix
250
+ const formattedTool = toolParts.map(capitalize).join(' ');
251
+ return formattedTool;
252
+ }
253
+ /**
254
+ * Computes the generating progress message for a tool.
255
+ * Shows which parameter is currently being generated and overall progress.
256
+ */
257
+ function getGeneratingProgress(toolName, params) {
258
+ const toolLower = toolName.toLowerCase();
259
+ const expectedParams = TOOL_EXPECTED_PARAMS[toolLower];
260
+ if (!expectedParams) {
261
+ // Unknown tool - show generic message with count of received params
262
+ const receivedCount = Object.keys(params).length;
263
+ if (receivedCount === 0) {
264
+ return 'Preparing parameters...';
265
+ }
266
+ return `Preparing parameters (${receivedCount} received)...`;
267
+ }
268
+ const receivedParams = Object.keys(params);
269
+ const receivedCount = receivedParams.length;
270
+ const totalCount = expectedParams.length;
271
+ if (receivedCount === 0) {
272
+ // No params yet - show first expected param
273
+ const firstParam = expectedParams[0];
274
+ const label = PARAM_LABELS[firstParam] || firstParam;
275
+ return `Preparing ${label}...`;
276
+ }
277
+ // Find the next parameter being prepared (first expected param not yet received)
278
+ const nextParam = expectedParams.find((p) => !(p in params));
279
+ if (nextParam) {
280
+ const label = PARAM_LABELS[nextParam] || nextParam;
281
+ return `Preparing ${label} (${receivedCount}/${totalCount})...`;
282
+ }
283
+ // All expected params received, but still finalizing (maybe optional params)
284
+ return `Finalizing (${receivedCount}/${totalCount})...`;
285
+ }
286
+ /**
287
+ * Tools that should show only the value (no parameter name or quotes)
288
+ * These are typically file tools where showing just the path is cleaner
289
+ */
290
+ const TOOLS_VALUE_ONLY = new Set([
291
+ 'read', 'read_file', 'write', 'write_file', 'edit', 'edit_file', 'create_directory', 'plan',
292
+ 'bash', 'shell', 'execute', 'execute_command', 'task', 'spawn_task', 'get_file_info',
293
+ 'list', 'list_directory', 'update_plan', 'complete_plan_task', 'poll_task',
294
+ ]);
295
+ /**
296
+ * Tools that should hide the result line (⎿ Done)
297
+ * These are simple operations where showing "Done" adds no value
298
+ */
299
+ const TOOLS_HIDE_RESULT = new Set([
300
+ 'create_directory',
301
+ 'list_directory_with_sizes',
302
+ 'git_status',
303
+ 'git_diff',
304
+ 'git_log',
305
+ 'git_stage',
306
+ 'git_commit',
307
+ 'git_push',
308
+ ]);
309
+ /**
310
+ * Tools that should collapse (hide) results by default
311
+ * Results are shown only when expanded with Ctrl+O
312
+ */
313
+ const TOOLS_COLLAPSE_RESULT = new Set([
314
+ 'read',
315
+ 'read_file',
316
+ 'read_multiple_files',
317
+ 'grep',
318
+ 'glob',
319
+ 'search',
320
+ 'task',
321
+ 'spawn_task',
322
+ 'delegate_task',
323
+ ]);
324
+ /**
325
+ * Tools that should show only the quoted value (no parameter name, but with quotes)
326
+ * Example: SomeTool("value here") instead of SomeTool(param: "value here")
327
+ */
328
+ const TOOLS_QUOTED_VALUE_ONLY = new Set([
329
+ // Currently empty - add tools here if you want quoted values without param names
330
+ ]);
331
+ /**
332
+ * Extracts line count from a read tool result.
333
+ * Accepts optional pre-parsed data to avoid JSON.parse in the render path.
334
+ */
335
+ function extractLineCount(result, parsedResult) {
336
+ if (!result && !parsedResult)
337
+ return null;
338
+ const data = parsedResult ?? (() => { try {
339
+ return JSON.parse(result);
340
+ }
341
+ catch {
342
+ return null;
343
+ } })();
344
+ if (typeof data === 'object' && data !== null && 'content' in data && typeof data.content === 'string') {
345
+ return data.content.split('\n').length;
346
+ }
347
+ return null;
348
+ }
349
+ /**
350
+ * Gets the file path from a read tool block
351
+ */
352
+ function getReadFilePath(tool) {
353
+ const path = tool.params.file_path || tool.params.path;
354
+ return typeof path === 'string' ? path : null;
355
+ }
356
+ /**
357
+ * Checks if a tool is a read tool
358
+ */
359
+ function isReadTool(name) {
360
+ const lower = name.toLowerCase();
361
+ return lower === 'read' || lower === 'read_file';
362
+ }
363
+ /**
364
+ * Checks if a tool is an edit tool
365
+ */
366
+ function isEditTool(name) {
367
+ const lower = name.toLowerCase();
368
+ return lower === 'edit' || lower === 'edit_file';
369
+ }
370
+ /**
371
+ * Gets the file path from an edit tool block
372
+ */
373
+ function getEditFilePath(tool) {
374
+ const path = tool.params.file_path || tool.params.path;
375
+ return typeof path === 'string' ? path : null;
376
+ }
377
+ /**
378
+ * Extracts additions, deletions, and changes from an edit tool result
379
+ */
380
+ function extractEditChanges(result, parsedResult) {
381
+ if (!result && !parsedResult)
382
+ return null;
383
+ const data = parsedResult ?? (() => { try {
384
+ return JSON.parse(result);
385
+ }
386
+ catch {
387
+ return null;
388
+ } })();
389
+ if (typeof data === 'object' && data !== null && 'success' in data && data.success === true) {
390
+ const obj = data;
391
+ const additions = typeof obj.additions === 'number' ? obj.additions : 0;
392
+ const deletions = typeof obj.deletions === 'number' ? obj.deletions : 0;
393
+ const changes = Array.isArray(obj.changes) ? obj.changes : [];
394
+ return { additions, deletions, changes };
395
+ }
396
+ return null;
397
+ }
398
+ /**
399
+ * Consolidates consecutive read operations on the same file into a single display block.
400
+ * This reduces visual clutter when the LLM reads the same file multiple times in succession.
401
+ */
402
+ function consolidateReadBlocks(blocks) {
403
+ const result = [];
404
+ let i = 0;
405
+ while (i < blocks.length) {
406
+ const block = blocks[i];
407
+ // Check if this is a completed read tool
408
+ if (block.type === 'tool' && isReadTool(block.name) &&
409
+ (block.status === 'success' || block.status === 'error')) {
410
+ const filePath = getReadFilePath(block);
411
+ if (filePath) {
412
+ // Look ahead for consecutive reads of the same file
413
+ const consecutiveReads = [block];
414
+ let j = i + 1;
415
+ while (j < blocks.length) {
416
+ const nextBlock = blocks[j];
417
+ if (nextBlock.type === 'tool' && isReadTool(nextBlock.name) &&
418
+ (nextBlock.status === 'success' || nextBlock.status === 'error') &&
419
+ getReadFilePath(nextBlock) === filePath) {
420
+ consecutiveReads.push(nextBlock);
421
+ j++;
422
+ }
423
+ else {
424
+ break;
425
+ }
426
+ }
427
+ // If we found multiple consecutive reads, consolidate them
428
+ if (consecutiveReads.length > 1) {
429
+ const durations = [];
430
+ const lineCounts = [];
431
+ let hasError = false;
432
+ let errorMsg;
433
+ for (const read of consecutiveReads) {
434
+ if (read.duration_ms !== undefined) {
435
+ durations.push(read.duration_ms);
436
+ }
437
+ const lineCount = extractLineCount(read.result, read.parsedResult);
438
+ if (lineCount !== null) {
439
+ lineCounts.push(lineCount);
440
+ }
441
+ if (read.status === 'error') {
442
+ hasError = true;
443
+ errorMsg = read.error;
444
+ }
445
+ }
446
+ result.push({
447
+ type: 'consolidated_read',
448
+ filePath,
449
+ durations,
450
+ lineCounts,
451
+ status: hasError ? 'error' : 'success',
452
+ error: errorMsg,
453
+ originalBlocks: consecutiveReads,
454
+ });
455
+ i = j;
456
+ continue;
457
+ }
458
+ }
459
+ }
460
+ // Not a read tool or single read - add as-is
461
+ result.push(block);
462
+ i++;
463
+ }
464
+ return result;
465
+ }
466
+ /**
467
+ * Consolidates consecutive edit operations on the same file into a single display block.
468
+ * This reduces visual clutter when the LLM edits the same file multiple times in succession.
469
+ */
470
+ function consolidateEditBlocks(blocks) {
471
+ const result = [];
472
+ let i = 0;
473
+ while (i < blocks.length) {
474
+ const block = blocks[i];
475
+ // Check if this is a completed edit tool
476
+ if (block.type === 'tool' && isEditTool(block.name) &&
477
+ (block.status === 'success' || block.status === 'error')) {
478
+ const filePath = getEditFilePath(block);
479
+ if (filePath) {
480
+ // Look ahead for consecutive edits of the same file
481
+ const consecutiveEdits = [block];
482
+ let j = i + 1;
483
+ while (j < blocks.length) {
484
+ const nextBlock = blocks[j];
485
+ if (nextBlock.type === 'tool' && isEditTool(nextBlock.name) &&
486
+ (nextBlock.status === 'success' || nextBlock.status === 'error') &&
487
+ getEditFilePath(nextBlock) === filePath) {
488
+ consecutiveEdits.push(nextBlock);
489
+ j++;
490
+ }
491
+ else {
492
+ break;
493
+ }
494
+ }
495
+ // If we found multiple consecutive edits, consolidate them
496
+ if (consecutiveEdits.length > 1) {
497
+ const durations = [];
498
+ const additions = [];
499
+ const deletions = [];
500
+ const allChanges = [];
501
+ let hasError = false;
502
+ let errorMsg;
503
+ for (const edit of consecutiveEdits) {
504
+ if (edit.duration_ms !== undefined) {
505
+ durations.push(edit.duration_ms);
506
+ }
507
+ const extracted = extractEditChanges(edit.result, edit.parsedResult);
508
+ if (extracted !== null) {
509
+ additions.push(extracted.additions);
510
+ deletions.push(extracted.deletions);
511
+ allChanges.push(...extracted.changes);
512
+ }
513
+ if (edit.status === 'error') {
514
+ hasError = true;
515
+ errorMsg = edit.error;
516
+ }
517
+ }
518
+ result.push({
519
+ type: 'consolidated_edit',
520
+ filePath,
521
+ durations,
522
+ additions,
523
+ deletions,
524
+ allChanges,
525
+ status: hasError ? 'error' : 'success',
526
+ error: errorMsg,
527
+ originalBlocks: consecutiveEdits,
528
+ });
529
+ i = j;
530
+ continue;
531
+ }
532
+ }
533
+ }
534
+ // Not an edit tool or single edit - add as-is
535
+ result.push(block);
536
+ i++;
537
+ }
538
+ return result;
539
+ }
540
+ /**
541
+ * Extracts an AgentEntry from a ToolStreamBlock for agent/task tools.
542
+ */
543
+ function extractAgentEntry(block) {
544
+ const params = block.params;
545
+ const rawDescription = (params.task || params.prompt || params.description || '');
546
+ const taskDescription = rawDescription.length > 120
547
+ ? rawDescription.slice(0, 117) + '...'
548
+ : rawDescription;
549
+ const agentType = (params.agent_type || params.subagent_type || '');
550
+ const agentTypeLabel = agentType
551
+ ? agentType
552
+ .split(/[-_]/)
553
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
554
+ .join(' ')
555
+ : 'Task';
556
+ let toolCallCount;
557
+ let tokensUsed;
558
+ let resultSummary;
559
+ let rawResult;
560
+ const error = block.error;
561
+ if (block.result) {
562
+ rawResult = block.result;
563
+ try {
564
+ const resultData = block.parsedResult ?? JSON.parse(block.result);
565
+ if (typeof resultData === 'object' && resultData !== null) {
566
+ if (typeof resultData.toolCallCount === 'number') {
567
+ toolCallCount = resultData.toolCallCount;
568
+ }
569
+ if (resultData.usage && typeof resultData.usage === 'object') {
570
+ if (typeof resultData.usage.tokensUsed === 'number') {
571
+ tokensUsed = resultData.usage.tokensUsed;
572
+ }
573
+ }
574
+ // Extract a short result summary
575
+ const content = (resultData.content || resultData.response || '');
576
+ if (typeof content === 'string' && content.length > 0) {
577
+ // Take the last non-empty line as summary
578
+ const lines = content.split('\n').filter((l) => l.trim().length > 0);
579
+ const lastLine = lines[lines.length - 1] || '';
580
+ resultSummary = lastLine.length > 80 ? lastLine.slice(0, 77) + '...' : lastLine;
581
+ }
582
+ }
583
+ }
584
+ catch {
585
+ // Not JSON, use raw result
586
+ }
587
+ }
588
+ if (block.status === 'error') {
589
+ resultSummary = error || 'Error';
590
+ }
591
+ else if (block.status === 'success' && !resultSummary) {
592
+ resultSummary = 'Done';
593
+ }
594
+ return {
595
+ taskDescription,
596
+ agentTypeLabel,
597
+ toolCallCount,
598
+ tokensUsed,
599
+ resultSummary,
600
+ status: block.status,
601
+ error,
602
+ rawResult,
603
+ };
604
+ }
605
+ /**
606
+ * Consolidates consecutive agent/task tool calls into a single display block.
607
+ * Groups 2+ consecutive agent blocks into a ConsolidatedAgentBlock.
608
+ */
609
+ function consolidateAgentBlocks(blocks) {
610
+ const result = [];
611
+ let i = 0;
612
+ while (i < blocks.length) {
613
+ const block = blocks[i];
614
+ // Check if this is an agent tool (any status)
615
+ if (block.type === 'tool' && isAgentTool(block.name)) {
616
+ // Look ahead for consecutive agent blocks
617
+ const consecutiveAgents = [block];
618
+ let j = i + 1;
619
+ while (j < blocks.length) {
620
+ const nextBlock = blocks[j];
621
+ if (nextBlock.type === 'tool' && isAgentTool(nextBlock.name)) {
622
+ consecutiveAgents.push(nextBlock);
623
+ j++;
624
+ }
625
+ else {
626
+ break;
627
+ }
628
+ }
629
+ // If we found multiple consecutive agents, consolidate them
630
+ if (consecutiveAgents.length > 1) {
631
+ const agents = consecutiveAgents.map(extractAgentEntry);
632
+ // Compute combined status: generating > running > error/success
633
+ let combinedStatus = 'success';
634
+ for (const agent of agents) {
635
+ if (agent.status === 'generating') {
636
+ combinedStatus = 'generating';
637
+ break;
638
+ }
639
+ if (agent.status === 'running' || agent.status === 'pending') {
640
+ combinedStatus = 'running';
641
+ }
642
+ if (agent.status === 'error' && combinedStatus !== 'running') {
643
+ combinedStatus = 'error';
644
+ }
645
+ }
646
+ result.push({
647
+ type: 'consolidated_agent',
648
+ agents,
649
+ status: combinedStatus,
650
+ originalBlocks: consecutiveAgents,
651
+ });
652
+ i = j;
653
+ continue;
654
+ }
655
+ }
656
+ // Not an agent tool or single agent - add as-is
657
+ result.push(block);
658
+ i++;
659
+ }
660
+ return result;
661
+ }
662
+ /**
663
+ * Formats tool parameters for display
664
+ * Example for file tools: src/index.ts
665
+ * Example for other tools: pattern: "*.tsx", path: "src"
666
+ */
667
+ function formatParams(params, maxLength = 100, toolName) {
668
+ let entries = Object.entries(params);
669
+ if (entries.length === 0)
670
+ return '';
671
+ // Filter to essential params if tool has a display config
672
+ if (toolName) {
673
+ const toolLower = toolName.toLowerCase();
674
+ const essentialParams = TOOL_DISPLAY_PARAMS[toolLower];
675
+ if (essentialParams) {
676
+ entries = entries.filter(([key]) => essentialParams.includes(key));
677
+ }
678
+ // Special handling for read_multiple_files: show common directory
679
+ if (toolLower === 'read_multiple_files' && 'paths' in params && Array.isArray(params.paths)) {
680
+ const paths = params.paths;
681
+ const commonDir = findCommonDirectory(paths);
682
+ return commonDir;
683
+ }
684
+ // Special handling for List tool: show pattern if present, otherwise path
685
+ if ((toolLower === 'list' || toolLower === 'list_directory') && ('pattern' in params || 'path' in params)) {
686
+ const pattern = params.pattern;
687
+ const path = params.path;
688
+ // Prefer pattern over path for display
689
+ if (pattern && pattern !== '*') {
690
+ return pattern;
691
+ }
692
+ if (path) {
693
+ return makePathRelative(path);
694
+ }
695
+ return '.';
696
+ }
697
+ // Special handling for MCP fetch-like tools: only show URL
698
+ if (toolLower.startsWith('mcp_') && (toolLower.includes('fetch') || toolLower.includes('browse'))) {
699
+ if ('url' in params && typeof params.url === 'string') {
700
+ const url = params.url;
701
+ // Show just the URL, truncated if needed
702
+ return url.length > 70 ? truncate(url, 70) : url;
703
+ }
704
+ }
705
+ // Special handling for MCP search-like tools: only show query
706
+ if (toolLower.startsWith('mcp_') && toolLower.includes('search')) {
707
+ entries = entries.filter(([key]) => key === 'query');
708
+ }
709
+ }
710
+ if (entries.length === 0)
711
+ return '';
712
+ // For file tools (Read, Write, Edit), show just the value without key/quotes
713
+ const toolLower = toolName?.toLowerCase() ?? '';
714
+ const valueOnly = TOOLS_VALUE_ONLY.has(toolLower);
715
+ const quotedValueOnly = TOOLS_QUOTED_VALUE_ONLY.has(toolLower);
716
+ // Parameters that contain file paths and should be made relative
717
+ const FILE_PATH_PARAMS = new Set(['file_path', 'path', 'paths']);
718
+ const formatted = entries
719
+ .map(([key, value]) => {
720
+ if (typeof value === 'string') {
721
+ // Convert file paths to relative paths for display
722
+ let processedValue = value;
723
+ if (FILE_PATH_PARAMS.has(key)) {
724
+ processedValue = makePathRelative(value);
725
+ }
726
+ const valueMaxLen = valueOnly ? maxLength : 70;
727
+ const displayValue = processedValue.length > valueMaxLen ? truncate(processedValue, valueMaxLen) : processedValue;
728
+ // For value-only tools, just show the value without key or quotes
729
+ if (valueOnly) {
730
+ return displayValue;
731
+ }
732
+ // For quoted-value-only tools, show the value with quotes but no key
733
+ if (quotedValueOnly) {
734
+ return `"${displayValue}"`;
735
+ }
736
+ return `${key}: "${displayValue}"`;
737
+ }
738
+ if (typeof value === 'boolean' || typeof value === 'number') {
739
+ return `${key}: ${value}`;
740
+ }
741
+ if (Array.isArray(value)) {
742
+ return `${key}: [${value.length} items]`;
743
+ }
744
+ if (value && typeof value === 'object') {
745
+ return `${key}: {...}`;
746
+ }
747
+ return `${key}: ${String(value)}`;
748
+ })
749
+ .join(', ');
750
+ return formatted.length > maxLength ? truncate(formatted, maxLength) : formatted;
751
+ }
752
+ /**
753
+ * Formats tool result for display based on tool name and result data
754
+ */
755
+ function formatToolResult(name, result, error, parsedResult) {
756
+ if (error) {
757
+ // Simplify common error messages for cleaner UI display
758
+ if (error.startsWith('Text not found in file:')) {
759
+ return 'Text not found';
760
+ }
761
+ if (error.startsWith('Text is not unique:')) {
762
+ return 'Text is not unique';
763
+ }
764
+ if (error.startsWith('No change needed:')) {
765
+ return 'No change needed';
766
+ }
767
+ return error.length > 100 ? truncate(error, 100) : error;
768
+ }
769
+ if (!result)
770
+ return null;
771
+ // Use pre-parsed data if available, otherwise parse
772
+ let data = parsedResult;
773
+ if (data === undefined) {
774
+ try {
775
+ data = JSON.parse(result);
776
+ }
777
+ catch {
778
+ // Not JSON, use raw result
779
+ return result.length > 100 ? truncate(result, 100) : result;
780
+ }
781
+ }
782
+ // Format based on tool name and result structure
783
+ const toolLower = name.toLowerCase();
784
+ if (typeof data === 'object' && data !== null) {
785
+ const obj = data;
786
+ // Read tool - show line count
787
+ if (toolLower === 'read' || toolLower === 'read_file') {
788
+ if ('content' in obj && typeof obj.content === 'string') {
789
+ const lines = obj.content.split('\n').length;
790
+ return `Read ${lines} lines`;
791
+ }
792
+ }
793
+ // Read multiple files - handled specially in ToolBlock for list output
794
+ if (toolLower === 'read_multiple_files') {
795
+ return null;
796
+ }
797
+ // File info - show human-readable size
798
+ if (toolLower === 'get_file_info') {
799
+ if ('size' in obj && typeof obj.size === 'number') {
800
+ const size = obj.size;
801
+ if (size < 1024)
802
+ return `${size} bytes`;
803
+ if (size < 1024 * 1024)
804
+ return `${(size / 1024).toFixed(1)} KB`;
805
+ return `${(size / (1024 * 1024)).toFixed(1)} MB`;
806
+ }
807
+ }
808
+ // Glob/Find files - show file count
809
+ if (toolLower === 'glob' || toolLower === 'list_files' || toolLower === 'find_files') {
810
+ if ('files' in obj && Array.isArray(obj.files)) {
811
+ const count = typeof obj.totalFound === 'number' ? obj.totalFound : obj.files.length;
812
+ const truncatedSuffix = obj.truncated ? '+' : '';
813
+ return count === 0 ? 'No files found' : `Found ${count}${truncatedSuffix} file${count === 1 ? '' : 's'}`;
814
+ }
815
+ }
816
+ // List/list_directory - show total count
817
+ if (toolLower === 'list' || toolLower === 'list_directory') {
818
+ // Use 'total' field if available, otherwise count entries
819
+ const total = typeof obj.total === 'number' ? obj.total : (Array.isArray(obj.entries) ? obj.entries.length : 0);
820
+ return `found ${total} total`;
821
+ }
822
+ // Grep/Search - show match count
823
+ if (toolLower === 'grep' || toolLower === 'search' || toolLower === 'search_code') {
824
+ // Use matchCount for total count (before truncation), fall back to matches.length
825
+ if ('matchCount' in obj && typeof obj.matchCount === 'number') {
826
+ const count = obj.matchCount;
827
+ const truncatedSuffix = obj.truncated ? '+' : '';
828
+ return count === 0 ? 'No matches found' : `Found ${count}${truncatedSuffix} match${count === 1 ? '' : 'es'}`;
829
+ }
830
+ if ('matches' in obj && Array.isArray(obj.matches)) {
831
+ const count = obj.matches.length;
832
+ return count === 0 ? 'No matches found' : `Found ${count} match${count === 1 ? '' : 'es'}`;
833
+ }
834
+ if ('count' in obj && typeof obj.count === 'number') {
835
+ const count = obj.count;
836
+ return count === 0 ? 'No matches found' : `Found ${count} match${count === 1 ? '' : 'es'}`;
837
+ }
838
+ if ('files' in obj && Array.isArray(obj.files)) {
839
+ const count = obj.files.length;
840
+ return count === 0 ? 'No files found' : `Found ${count} file${count === 1 ? '' : 's'}`;
841
+ }
842
+ }
843
+ // Bash/Shell - show exit code and output lines
844
+ if (toolLower === 'bash' || toolLower === 'shell' || toolLower === 'execute' || toolLower === 'execute_command') {
845
+ // Check for timeout first
846
+ if (obj.timedOut === true || obj.timed_out === true) {
847
+ return '(timeout)';
848
+ }
849
+ if ('exitCode' in obj || 'exit_code' in obj) {
850
+ const code = obj.exitCode ?? obj.exit_code ?? 0;
851
+ const stdout = obj.stdout ?? obj.output ?? '';
852
+ if (typeof stdout === 'string' && stdout.length > 0) {
853
+ const lines = stdout.split('\n').filter(Boolean).length;
854
+ return code === 0 ? `Ran successfully (${lines} lines)` : `Exit code ${code}`;
855
+ }
856
+ return code === 0 ? 'Ran successfully' : `Exit code ${code}`;
857
+ }
858
+ }
859
+ // Edit - handled specially in ToolBlock for colored output
860
+ if (toolLower === 'edit' || toolLower === 'edit_file') {
861
+ // Return null to let ToolBlock render the colored version
862
+ return null;
863
+ }
864
+ // Write - show success with line count and size
865
+ if (toolLower === 'write' || toolLower === 'write_file') {
866
+ if ('success' in obj && obj.success === true) {
867
+ const lines = typeof obj.lineCount === 'number' ? obj.lineCount : null;
868
+ const size = typeof obj.byteSize === 'number' ? obj.byteSize : null;
869
+ if (lines !== null && size !== null) {
870
+ const sizeStr = size < 1024 ? `${size} B` : `${(size / 1024).toFixed(1)} KB`;
871
+ return `Wrote ${lines} lines (${sizeStr})`;
872
+ }
873
+ if ('path' in obj && typeof obj.path === 'string') {
874
+ const filename = obj.path.split(/[/\\]/).pop() || obj.path;
875
+ return `Wrote ${filename}`;
876
+ }
877
+ return 'Done';
878
+ }
879
+ }
880
+ // Delete - show path in result instead of "Done"
881
+ if (toolLower === 'delete' || toolLower === 'delete_file') {
882
+ if ('success' in obj && obj.success === true && 'path' in obj && typeof obj.path === 'string') {
883
+ return makePathRelative(obj.path);
884
+ }
885
+ }
886
+ // Agent/Task tools - show model, tokens, and turns (handle both flat and nested fields)
887
+ if (toolLower === 'task' || toolLower === 'spawn_task' || toolLower === 'delegate_task') {
888
+ // Check for failure first
889
+ if (obj.success === false) {
890
+ const errorMsg = typeof obj.error === 'string' ? obj.error : 'Unknown error';
891
+ return `Failed: ${truncate(errorMsg, 80)}`;
892
+ }
893
+ // Background spawn — agent hasn't finished yet, just spawned
894
+ const processStatus = typeof obj.status === 'string' ? obj.status : '';
895
+ if (processStatus === 'running' || processStatus === 'pending') {
896
+ return 'Spawned in background';
897
+ }
898
+ const usage = (typeof obj.usage === 'object' && obj.usage !== null) ? obj.usage : null;
899
+ // Read agentModel with fallback to agentType
900
+ const agentModel = typeof obj.agentModel === 'string' ? obj.agentModel
901
+ : typeof obj.agentType === 'string' ? obj.agentType
902
+ : 'unknown';
903
+ // Read tokensUsed from flat fields or nested usage object
904
+ const tokensUsed = typeof obj.tokensUsed === 'number' ? obj.tokensUsed
905
+ : (usage && typeof usage.tokensUsed === 'number') ? usage.tokensUsed
906
+ : 0;
907
+ // Build concise completion message
908
+ const parts = [`using ${agentModel}`];
909
+ if (tokensUsed > 0) {
910
+ parts.push(`${formatCompactNumber(tokensUsed)} tokens`);
911
+ }
912
+ return `Done (${parts.join(', ')})`;
913
+ }
914
+ // Check for specific error codes first (before generic success/error)
915
+ if ('error' in obj && typeof obj.error === 'string') {
916
+ if (obj.error === 'FILE_MODIFIED_EXTERNALLY') {
917
+ return 'File was modified externally. Please re-read before editing.';
918
+ }
919
+ // Prefer the human-readable 'message' field if available
920
+ if ('message' in obj && typeof obj.message === 'string') {
921
+ return truncate(obj.message, 100);
922
+ }
923
+ return truncate(obj.error, 100);
924
+ }
925
+ // Generic success/error handling
926
+ if ('success' in obj) {
927
+ return obj.success ? 'Done' : 'Failed';
928
+ }
929
+ }
930
+ // Fallback: truncate raw result
931
+ if (typeof result === 'string' && result.length > 0) {
932
+ return truncate(result, 100);
933
+ }
934
+ return 'Done';
935
+ }
936
+ /**
937
+ * Renders markdown text with terminal formatting
938
+ */
939
+ const MarkdownText = ({ children, indent = 2 }) => {
940
+ const rendered = React.useMemo(() => {
941
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
942
+ marked.setOptions({ renderer: createMarkdownRenderer() });
943
+ const raw = String(marked.parse(children)).trim();
944
+ // Truncate lines that exceed terminal width (e.g. table borders)
945
+ const maxWidth = Math.max(20, (process.stdout.columns || 80) - indent - 2);
946
+ return raw
947
+ .split('\n')
948
+ .map(line => cliTruncate(line, maxWidth, { preferTruncationOnSpace: false }))
949
+ .join('\n');
950
+ }, [children, indent]);
951
+ return _jsx(Text, { children: rendered });
952
+ };
953
+ /**
954
+ * Renders a text block with bullet point
955
+ * Uses orange bullet for task-progress variant (plan execution transitions)
956
+ */
957
+ const TextBlock = ({ content, variant = 'default', }) => {
958
+ if (!content.trim())
959
+ return null;
960
+ // Green for task progress, white for default
961
+ const bulletColor = variant === 'task-progress' ? 'green' : 'white';
962
+ return (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: _jsxs(Box, { children: [_jsx(Text, { color: bulletColor, bold: true, children: "\u25CF " }), _jsx(Box, { flexDirection: "column", flexGrow: 1, children: _jsx(MarkdownText, { children: content }) })] }) }));
963
+ };
964
+ /**
965
+ * Extracts file names and line counts from read_multiple_files result
966
+ * Returns an array of file info (name + line count) and error info
967
+ */
968
+ function getReadMultipleFiles(result, parsedResult) {
969
+ if (!result && !parsedResult)
970
+ return null;
971
+ try {
972
+ const data = parsedResult ?? JSON.parse(result);
973
+ if (typeof data === 'object' && data !== null && 'files' in data && Array.isArray(data.files)) {
974
+ const files = [];
975
+ const errors = [];
976
+ for (const file of data.files) {
977
+ if (typeof file === 'object' && file !== null && 'path' in file) {
978
+ const path = String(file.path);
979
+ // Extract just the filename from the path
980
+ const fileName = path.replace(/\\/g, '/').split('/').pop() || path;
981
+ if (file.error) {
982
+ errors.push(`${fileName}: ${file.error}`);
983
+ }
984
+ else {
985
+ const lineCount = typeof file.content === 'string'
986
+ ? file.content.split('\n').length
987
+ : 0;
988
+ files.push({ name: fileName, lineCount });
989
+ }
990
+ }
991
+ }
992
+ return { files, errors };
993
+ }
994
+ }
995
+ catch {
996
+ // Not valid JSON
997
+ }
998
+ return null;
999
+ }
1000
+ /**
1001
+ * Extracts edit statistics from a tool result
1002
+ */
1003
+ function getEditStats(result, parsedResult) {
1004
+ if (!result && !parsedResult)
1005
+ return null;
1006
+ try {
1007
+ const data = parsedResult ?? JSON.parse(result);
1008
+ if (typeof data === 'object' && data !== null) {
1009
+ const obj = data;
1010
+ if ('success' in obj && obj.success === true) {
1011
+ const additions = typeof obj.additions === 'number' ? obj.additions : null;
1012
+ const deletions = typeof obj.deletions === 'number' ? obj.deletions : null;
1013
+ const changes = Array.isArray(obj.changes) ? obj.changes : [];
1014
+ return { additions, deletions, changes };
1015
+ }
1016
+ if ('error' in obj && typeof obj.error === 'string') {
1017
+ const friendlyError = obj.error === 'FILE_MODIFIED_EXTERNALLY'
1018
+ ? 'File was modified externally. Please re-read before editing.'
1019
+ : obj.error;
1020
+ return { additions: null, deletions: null, changes: [], error: friendlyError };
1021
+ }
1022
+ }
1023
+ }
1024
+ catch {
1025
+ // Not JSON
1026
+ }
1027
+ return null;
1028
+ }
1029
+ /**
1030
+ * Renders edit result with colored additions/deletions
1031
+ */
1032
+ const EditResultDisplay = ({ additions, deletions }) => {
1033
+ const hasAdditions = additions !== null && additions > 0;
1034
+ const hasDeletions = deletions !== null && deletions > 0;
1035
+ if (!hasAdditions && !hasDeletions) {
1036
+ return _jsx(Text, { dimColor: true, children: "No changes" });
1037
+ }
1038
+ return (_jsxs(_Fragment, { children: [hasAdditions && (_jsxs(Text, { color: "green", children: ["+", additions, " ", additions === 1 ? 'line' : 'lines'] })), hasAdditions && hasDeletions && (_jsx(Text, { dimColor: true, children: ", " })), hasDeletions && (_jsxs(Text, { color: "red", children: ["-", deletions, " ", deletions === 1 ? 'line' : 'lines'] }))] }));
1039
+ };
1040
+ /**
1041
+ * Renders a consolidated read block that combines multiple consecutive reads of the same file.
1042
+ * Shows combined timing like (43+62)ms and combined lines like Read (20+40) lines
1043
+ */
1044
+ const ConsolidatedReadBlockComponent = ({ block }) => {
1045
+ const { filePath, durations, lineCounts, status, error } = block;
1046
+ // Format the relative file path for display
1047
+ const displayPath = makePathRelative(filePath);
1048
+ // Format combined duration: sum all durations and display total
1049
+ const formatCombinedDuration = () => {
1050
+ if (durations.length === 0)
1051
+ return '';
1052
+ const totalMs = durations.reduce((sum, d) => sum + d, 0);
1053
+ return formatDuration(totalMs);
1054
+ };
1055
+ // Format combined line counts: sum all lines and display total
1056
+ const formatCombinedLines = () => {
1057
+ if (lineCounts.length === 0)
1058
+ return 'Read file';
1059
+ const totalLines = lineCounts.reduce((sum, l) => sum + l, 0);
1060
+ return `Read ${totalLines} lines`;
1061
+ };
1062
+ return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: status === 'error' ? 'red' : 'cyan', children: "\u25CF" }), _jsx(Text, { children: " " }), _jsx(Text, { color: status === 'error' ? 'red' : 'cyan', children: "Read" }), _jsxs(Text, { dimColor: true, children: ["(", displayPath, ")"] }), _jsxs(Text, { dimColor: true, children: [" ", formatCombinedDuration()] })] }), _jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), error ? (_jsx(Text, { color: "red", children: truncate(error, 100) })) : (_jsx(Text, { children: formatCombinedLines() }))] })] }));
1063
+ };
1064
+ /**
1065
+ * Constants for edit diff display
1066
+ */
1067
+ const EDIT_DIFF_MAX_LINES = 20;
1068
+ const EDIT_DIFF_LINE_MAX_CHARS = 120;
1069
+ /**
1070
+ * Renders a consolidated edit block that combines multiple consecutive edits of the same file.
1071
+ * Shows combined timing and combined additions/deletions.
1072
+ * Supports Ctrl+O to expand and show the actual diff.
1073
+ */
1074
+ const ConsolidatedEditBlockComponent = ({ block, expanded = false, isStatic = false }) => {
1075
+ const { filePath, durations, additions, deletions, allChanges, status, error } = block;
1076
+ // Format the relative file path for display
1077
+ const displayPath = makePathRelative(filePath);
1078
+ // Format combined duration: sum all durations and display total
1079
+ const formatCombinedDuration = () => {
1080
+ if (durations.length === 0)
1081
+ return '';
1082
+ const totalMs = durations.reduce((sum, d) => sum + d, 0);
1083
+ return formatDuration(totalMs);
1084
+ };
1085
+ // Calculate total additions and deletions
1086
+ const totalAdditions = additions.reduce((sum, a) => sum + a, 0);
1087
+ const totalDeletions = deletions.reduce((sum, d) => sum + d, 0);
1088
+ // Collect all diff lines for expanded view
1089
+ const diffLines = [];
1090
+ if (expanded && allChanges.length > 0) {
1091
+ for (const change of allChanges) {
1092
+ // Add line range info
1093
+ diffLines.push({ type: 'info', content: `@@ Lines ${change.lineStart}-${change.lineEnd} @@` });
1094
+ // Add removed lines (before)
1095
+ for (const line of change.before) {
1096
+ diffLines.push({ type: 'removed', content: line });
1097
+ }
1098
+ // Add added lines (after)
1099
+ for (const line of change.after) {
1100
+ diffLines.push({ type: 'added', content: line });
1101
+ }
1102
+ }
1103
+ }
1104
+ // Trim diff if too long
1105
+ const isTruncated = diffLines.length > EDIT_DIFF_MAX_LINES;
1106
+ const displayDiffLines = diffLines.slice(0, EDIT_DIFF_MAX_LINES);
1107
+ const hiddenLinesCount = diffLines.length - EDIT_DIFF_MAX_LINES;
1108
+ return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: status === 'error' ? 'red' : 'cyan', children: "\u25CF" }), _jsx(Text, { children: " " }), _jsx(Text, { color: status === 'error' ? 'red' : 'cyan', children: "Edit" }), _jsxs(Text, { dimColor: true, children: ["(", displayPath, ")"] }), _jsxs(Text, { dimColor: true, children: [" ", formatCombinedDuration()] })] }), _jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), error ? (_jsx(Text, { color: "red", children: truncate(error, 100) })) : (_jsx(_Fragment, { children: _jsx(EditResultDisplay, { additions: totalAdditions, deletions: totalDeletions }) }))] }), (expanded || isStatic) && displayDiffLines.length > 0 && (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [displayDiffLines.map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: " " }), line.type === 'info' && (_jsx(Text, { color: "cyan", children: truncate(line.content, EDIT_DIFF_LINE_MAX_CHARS) })), line.type === 'removed' && (_jsxs(Text, { color: "red", children: ["-", truncate(line.content, EDIT_DIFF_LINE_MAX_CHARS - 1)] })), line.type === 'added' && (_jsxs(Text, { color: "green", children: ["+", truncate(line.content, EDIT_DIFF_LINE_MAX_CHARS - 1)] }))] }, i))), isTruncated && (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: " " }), _jsxs(Text, { dimColor: true, children: ["... (", hiddenLinesCount, " more lines)"] })] }))] }))] }));
1109
+ };
1110
+ /**
1111
+ * Renders a consolidated agent block that combines multiple consecutive parallel agent tool calls.
1112
+ * Displays a tree-style UI with agent descriptions, tool use counts, and token counts.
1113
+ */
1114
+ const ConsolidatedAgentBlockComponent = ({ block, expanded = false, isStatic = false }) => {
1115
+ const { agents, status } = block;
1116
+ // Determine header label: if all agents share the same type, use that; otherwise "agents"
1117
+ const allSameType = agents.every(a => a.agentTypeLabel === agents[0].agentTypeLabel);
1118
+ const typeLabel = allSameType ? agents[0].agentTypeLabel : '';
1119
+ const isInProgress = status === 'generating' || status === 'running';
1120
+ const headerText = isInProgress
1121
+ ? `Running ${agents.length} ${typeLabel ? typeLabel + ' ' : ''}agent${agents.length === 1 ? '' : 's'}…`
1122
+ : `Ran ${agents.length} ${typeLabel ? typeLabel + ' ' : ''}agent${agents.length === 1 ? '' : 's'}`;
1123
+ // Status color
1124
+ const statusColor = status === 'error' ? 'red'
1125
+ : isInProgress ? 'cyan'
1126
+ : 'cyan';
1127
+ return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: statusColor, children: isInProgress ? '○' : '●' }), _jsx(Text, { children: " " }), _jsx(Text, { color: statusColor, children: headerText })] }), agents.map((agent, i) => {
1128
+ const isLast = i === agents.length - 1;
1129
+ const branchChar = isLast ? '└─' : '├─';
1130
+ const continueChar = isLast ? ' ' : '│ ';
1131
+ // Build metadata string: "· N tool uses · XK tokens"
1132
+ const metaParts = [];
1133
+ if (agent.toolCallCount !== undefined && agent.toolCallCount > 0) {
1134
+ metaParts.push(`${agent.toolCallCount} tool use${agent.toolCallCount === 1 ? '' : 's'}`);
1135
+ }
1136
+ if (agent.tokensUsed !== undefined && agent.tokensUsed > 0) {
1137
+ metaParts.push(`${formatCompactNumber(agent.tokensUsed)} tokens`);
1138
+ }
1139
+ const metaStr = metaParts.length > 0 ? ' · ' + metaParts.join(' · ') : '';
1140
+ // Agent status indicator color
1141
+ const agentColor = agent.status === 'error' ? 'red'
1142
+ : (agent.status === 'generating' || agent.status === 'running' || agent.status === 'pending') ? 'yellow'
1143
+ : undefined;
1144
+ return (_jsxs(Box, { flexDirection: "column", marginLeft: 3, children: [_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [branchChar, " "] }), _jsx(Text, { children: agent.taskDescription || agent.agentTypeLabel }), metaStr && _jsx(Text, { dimColor: true, children: metaStr })] }), agent.resultSummary && !expanded && (_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [continueChar, " \u23BF "] }), _jsx(Text, { color: agentColor, children: agent.resultSummary })] })), expanded && agent.rawResult && (() => {
1145
+ const contentLines = formatAgentResultContent(agent.rawResult, true, isStatic);
1146
+ if (contentLines.length === 0) {
1147
+ return (_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [continueChar, " \u23BF "] }), _jsx(Text, { children: agent.resultSummary || 'Done' })] }));
1148
+ }
1149
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [continueChar, " \u23BF "] }), _jsx(Text, { children: agent.resultSummary || 'Done' })] }), contentLines.map((line, li) => (_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [continueChar, " "] }), _jsx(Text, { children: line })] }, li)))] }));
1150
+ })(), !agent.resultSummary && (agent.status === 'running' || agent.status === 'pending' || agent.status === 'generating') && (_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [continueChar, " \u23BF "] }), _jsx(Text, { dimColor: true, children: "Running\u2026" })] }))] }, i));
1151
+ })] }));
1152
+ };
1153
+ /**
1154
+ * Renders a tool call block with bullet point and result
1155
+ */
1156
+ const ToolBlock = ({ tool, isStreaming = true, expandMCPResults = false, isStatic = false }) => {
1157
+ const { name, params, status, result, error, duration_ms, parsedResult } = tool;
1158
+ const formattedParams = formatParams(params, 100, name);
1159
+ const formattedResult = formatToolResult(name, result, error, parsedResult);
1160
+ // Check if this is a Plan tool - needs special display format
1161
+ const isPlanTool = name.toLowerCase() === 'plan' || name.toLowerCase() === 'enter_plan_mode';
1162
+ // Compute display name with special handling for certain tools
1163
+ const displayName = (() => {
1164
+ const lowerName = name.toLowerCase();
1165
+ if (lowerName === 'read_multiple_files') {
1166
+ return 'Read';
1167
+ }
1168
+ // Plan tool - show "Nova entered plan mode"
1169
+ if (lowerName === 'plan' || lowerName === 'enter_plan_mode') {
1170
+ return 'Nova entered plan mode';
1171
+ }
1172
+ if (lowerName === 'task' || lowerName === 'spawn_task' || lowerName === 'delegate_task') {
1173
+ // Format as "Explore Agent", "Bash Agent", etc. based on agent_type/subagent_type
1174
+ const agentType = (params.agent_type || params.subagent_type);
1175
+ // Try to extract model from pre-parsed result (avoids JSON.parse in render path)
1176
+ let model;
1177
+ if (result || parsedResult) {
1178
+ try {
1179
+ const resultData = parsedResult ?? JSON.parse(result);
1180
+ if (typeof resultData === 'object' && resultData !== null && 'agentModel' in resultData) {
1181
+ model = String(resultData.agentModel);
1182
+ }
1183
+ }
1184
+ catch {
1185
+ // Ignore parse errors
1186
+ }
1187
+ }
1188
+ if (agentType) {
1189
+ // Convert kebab-case/snake_case to Title Case
1190
+ const formatted = agentType
1191
+ .split(/[-_]/)
1192
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
1193
+ .join(' ');
1194
+ const modelSuffix = model ? ` (${model})` : '';
1195
+ return `${formatted} Agent${modelSuffix}`;
1196
+ }
1197
+ return 'Task';
1198
+ }
1199
+ // Execute tools - use description as the display name (no wrapper)
1200
+ if (lowerName === 'execute' || lowerName === 'execute_command') {
1201
+ const description = params.description;
1202
+ if (description) {
1203
+ return description.length > 80 ? truncate(description, 80) : description;
1204
+ }
1205
+ // Fallback to command if no description
1206
+ const command = params.command;
1207
+ if (command) {
1208
+ return command.length > 80 ? truncate(command, 80) : command;
1209
+ }
1210
+ return getToolRegistry().getDisplayName(name);
1211
+ }
1212
+ // Handle MCP tools - show clean "Mcp Server Tool" format
1213
+ const mcpDisplayName = getMCPDisplayName(name);
1214
+ if (mcpDisplayName) {
1215
+ return mcpDisplayName;
1216
+ }
1217
+ return getToolRegistry().getDisplayName(name);
1218
+ })();
1219
+ // Get plan task summary for special display format
1220
+ const planTaskSummary = isPlanTool ? params.task_summary : undefined;
1221
+ // Status indicator
1222
+ const getStatusIndicator = () => {
1223
+ switch (status) {
1224
+ case 'generating':
1225
+ return isStreaming ? (_jsx(ActivityDot, { color: "cyan" })) : (_jsx(Text, { color: "cyan", children: "\u25CB" }));
1226
+ case 'running':
1227
+ return isStreaming ? (_jsx(ActivityDot, { color: "cyan" })) : (_jsx(Text, { color: "cyan", children: "\u25CB" }));
1228
+ case 'success':
1229
+ return _jsx(Text, { color: "cyan", children: "\u25CF" });
1230
+ case 'error':
1231
+ return _jsx(Text, { color: "red", children: "\u25CF" });
1232
+ case 'skipped':
1233
+ return _jsx(Text, { color: "yellow", children: "\u25CF" });
1234
+ default:
1235
+ return _jsx(Text, { dimColor: true, children: "\u25CF" });
1236
+ }
1237
+ };
1238
+ // Tool name color based on status
1239
+ const getNameColor = () => {
1240
+ switch (status) {
1241
+ case 'generating':
1242
+ return 'cyan';
1243
+ case 'running':
1244
+ return 'cyan';
1245
+ case 'error':
1246
+ return 'red';
1247
+ case 'skipped':
1248
+ return 'yellow';
1249
+ default:
1250
+ return 'cyan';
1251
+ }
1252
+ };
1253
+ return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [getStatusIndicator(), _jsx(Text, { children: " " }), _jsx(Text, { color: getNameColor(), children: displayName }), !isPlanTool && ['spawn_task', 'task', 'delegate_task'].includes(name.toLowerCase()) && (() => {
1254
+ const taskText = (params.task || params.prompt);
1255
+ if (!taskText)
1256
+ return null;
1257
+ const singleLine = taskText.replace(/[\r\n]+/g, ' ').trim();
1258
+ return _jsxs(Text, { dimColor: true, children: ["(", truncate(singleLine, 120), ")"] });
1259
+ })(), !isPlanTool && formattedParams && !['execute', 'execute_command', 'spawn_task', 'task', 'delegate_task'].includes(name.toLowerCase()) && (_jsxs(Text, { dimColor: true, children: ["(", formattedParams, ")"] })), duration_ms !== undefined && status !== 'running' && status !== 'generating' && (_jsxs(Text, { dimColor: true, children: [" ", formatDuration(duration_ms)] }))] }), isPlanTool && planTaskSummary && (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { dimColor: true, children: planTaskSummary })] })), status === 'skipped' && ['bash', 'shell', 'execute', 'execute_command'].includes(name.toLowerCase()) && (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), typeof params.command === 'string' && params.command && (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, children: truncate(params.command, 80) }), _jsx(Text, { dimColor: true, children: " \u2192 " })] })), _jsx(Text, { color: "yellow", children: "Skipped" })] })), status !== 'running' && status !== 'pending' && status !== 'generating' && status !== 'skipped' && formattedResult && !(status === 'success' && TOOLS_HIDE_RESULT.has(name.toLowerCase())) && !(status === 'success' && TOOLS_COLLAPSE_RESULT.has(name.toLowerCase()) && !expandMCPResults) && !isMCPTool(name) && (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), ['bash', 'shell', 'execute', 'execute_command'].includes(name.toLowerCase()) && typeof params.command === 'string' && params.command ? (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, children: truncate(params.command, 80) }), _jsx(Text, { dimColor: true, children: " \u2192 " }), _jsx(Text, { color: status === 'error' ? 'red' : undefined, children: formattedResult })] })) : (_jsx(Text, { color: status === 'error' ? 'red' : undefined, children: formattedResult }))] })), (name.toLowerCase() === 'edit' || name.toLowerCase() === 'edit_file') && status !== 'running' && status !== 'pending' && status !== 'generating' && (() => {
1260
+ const editStats = getEditStats(result, parsedResult);
1261
+ if (editStats?.error) {
1262
+ return (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { color: "red", children: truncate(editStats.error, 100) })] }));
1263
+ }
1264
+ if (editStats) {
1265
+ // Build diff lines for expanded view
1266
+ const diffLines = [];
1267
+ if (expandMCPResults && editStats.changes.length > 0) {
1268
+ for (const change of editStats.changes) {
1269
+ diffLines.push({ type: 'info', content: `@@ Lines ${change.lineStart}-${change.lineEnd} @@` });
1270
+ for (const line of change.before) {
1271
+ diffLines.push({ type: 'removed', content: line });
1272
+ }
1273
+ for (const line of change.after) {
1274
+ diffLines.push({ type: 'added', content: line });
1275
+ }
1276
+ }
1277
+ }
1278
+ const isTruncated = diffLines.length > EDIT_DIFF_MAX_LINES;
1279
+ const displayDiffLines = diffLines.slice(0, EDIT_DIFF_MAX_LINES);
1280
+ const hiddenLinesCount = diffLines.length - EDIT_DIFF_MAX_LINES;
1281
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(EditResultDisplay, { additions: editStats.additions, deletions: editStats.deletions })] }), (expandMCPResults || isStatic) && displayDiffLines.length > 0 && (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [displayDiffLines.map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: " " }), line.type === 'info' && (_jsx(Text, { color: "cyan", children: truncate(line.content, EDIT_DIFF_LINE_MAX_CHARS) })), line.type === 'removed' && (_jsxs(Text, { color: "red", children: ["-", truncate(line.content, EDIT_DIFF_LINE_MAX_CHARS - 1)] })), line.type === 'added' && (_jsxs(Text, { color: "green", children: ["+", truncate(line.content, EDIT_DIFF_LINE_MAX_CHARS - 1)] }))] }, i))), isTruncated && (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: " " }), _jsxs(Text, { dimColor: true, children: ["... (", hiddenLinesCount, " more lines)"] })] }))] }))] }));
1282
+ }
1283
+ return null;
1284
+ })(), name.toLowerCase() === 'read_multiple_files' && status !== 'running' && status !== 'pending' && status !== 'generating' && (() => {
1285
+ const fileData = getReadMultipleFiles(result, parsedResult);
1286
+ if (fileData) {
1287
+ // Only show file list when expanded, but always show errors
1288
+ const showFileList = expandMCPResults || status !== 'success';
1289
+ const maxFilesToShow = 5;
1290
+ const filesToShow = fileData.files.slice(0, maxFilesToShow);
1291
+ const remainingCount = fileData.files.length - maxFilesToShow;
1292
+ // If collapsed and no errors, show nothing
1293
+ if (!showFileList && fileData.errors.length === 0) {
1294
+ return null;
1295
+ }
1296
+ return (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [showFileList && filesToShow.map((file, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: file.name }), _jsxs(Text, { dimColor: true, children: [" (", file.lineCount, " lines)"] })] }, i))), showFileList && remainingCount > 0 && (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsxs(Text, { dimColor: true, children: ["...and ", remainingCount, " more"] })] })), fileData.errors.map((err, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { color: "red", children: err })] }, `err-${i}`)))] }));
1297
+ }
1298
+ return null;
1299
+ })(), isMCPTool(name) && status !== 'running' && status !== 'pending' && status !== 'generating' && (() => {
1300
+ // Handle errors
1301
+ if (error) {
1302
+ return (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { color: "red", children: truncate(error, MCP_RESULT_LINE_MAX_CHARS) })] }));
1303
+ }
1304
+ // Handle successful results with multi-line display
1305
+ if (result) {
1306
+ const lines = formatMCPResultLines(result, expandMCPResults);
1307
+ if (lines.length === 0) {
1308
+ return (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: "Done" })] }));
1309
+ }
1310
+ return (_jsx(Box, { flexDirection: "column", marginLeft: 2, children: lines.map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: i === 0 ? '⎿ ' : ' ' }), _jsx(Text, { color: status === 'error' ? 'red' : undefined, children: line })] }, i))) }));
1311
+ }
1312
+ return (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: "Done" })] }));
1313
+ })(), isAgentTool(name) && status !== 'running' && status !== 'pending' && status !== 'generating' && (() => {
1314
+ // Handle errors
1315
+ if (error) {
1316
+ return (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { color: "red", children: truncate(error, MCP_RESULT_LINE_MAX_CHARS) })] }));
1317
+ }
1318
+ // Handle successful results with multi-line display
1319
+ if (result) {
1320
+ const contentLines = formatAgentResultContent(result, expandMCPResults, isStatic, parsedResult);
1321
+ if (contentLines.length === 0) {
1322
+ // No content to display, show formatted result summary instead
1323
+ return formattedResult ? (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: formattedResult })] })) : (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: "Done" })] }));
1324
+ }
1325
+ // Show content with expand hint
1326
+ const shouldShowHint = false; // Ctrl+O no longer functional
1327
+ return (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), formattedResult && _jsx(Text, { children: formattedResult })] }), contentLines.map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: " " }), _jsx(Text, { color: status === 'error' ? 'red' : undefined, children: line })] }, i))), shouldShowHint && (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: " " }), _jsx(Text, { dimColor: true, children: "(Ctrl+O to expand)" })] }))] }));
1328
+ }
1329
+ return (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: "Done" })] }));
1330
+ })(), status === 'generating' && (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { color: "cyan", children: getGeneratingProgress(name, params) })] })), status === 'running' && (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [tool.complexityReasoning && (() => {
1331
+ const indent = 5; // " ⎿ " = marginLeft(2) + "⎿ "(3)
1332
+ const availableWidth = Math.max(40, (process.stdout.columns || 80) - indent);
1333
+ const wrappedLines = wordWrap(tool.complexityReasoning, availableWidth);
1334
+ return (_jsx(Box, { flexDirection: "column", children: wrappedLines.map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: i === 0 ? '⎿ ' : ' ' }), _jsx(Text, { color: "magenta", children: line })] }, i))) }));
1335
+ })(), ['bash', 'shell', 'execute', 'execute_command'].includes(name.toLowerCase()) && typeof params.command === 'string' && (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: truncate(params.command, 80) })] })), (tool.statusMessage || 'Executing...').split('\n').map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: ' ' }), _jsx(Text, { dimColor: true, children: line })] }, i))), name.toLowerCase() === 'execute_command' && (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: ' ' }), _jsx(Text, { dimColor: true, children: "Ctrl+X to skip" })] }))] }))] }));
1336
+ };
1337
+ /**
1338
+ * Formats duration in ms to human readable
1339
+ */
1340
+ function formatDuration(ms) {
1341
+ if (ms < 1000)
1342
+ return `${ms}ms`;
1343
+ if (ms < 60000)
1344
+ return `${(ms / 1000).toFixed(1)}s`;
1345
+ return `${Math.floor(ms / 60000)}m ${Math.floor((ms % 60000) / 1000)}s`;
1346
+ }
1347
+ /**
1348
+ * Tools that should be hidden from UI display (internal/progress tools)
1349
+ */
1350
+ const HIDDEN_TOOLS = new Set(['complete_plan_task']);
1351
+ /**
1352
+ * Constants for MCP result display
1353
+ */
1354
+ const MCP_RESULT_MAX_LINES = 5;
1355
+ const MCP_RESULT_LINE_MAX_CHARS = 100;
1356
+ /**
1357
+ * Formats MCP tool result into multiple lines for display.
1358
+ * Returns an array of lines, truncated to max lines unless expanded.
1359
+ */
1360
+ function formatMCPResultLines(result, expanded = false) {
1361
+ if (!result)
1362
+ return [];
1363
+ // Clean up the result - remove excessive whitespace and normalize
1364
+ const cleaned = result
1365
+ .replace(/\\n/g, '\n') // Handle escaped newlines
1366
+ .replace(/\r\n/g, '\n') // Normalize line endings
1367
+ .trim();
1368
+ // Split into lines and filter empty ones
1369
+ const lines = cleaned.split('\n').filter(line => line.trim().length > 0);
1370
+ if (lines.length === 0) {
1371
+ return [truncate(cleaned, MCP_RESULT_LINE_MAX_CHARS)];
1372
+ }
1373
+ // When expanded, show all lines; otherwise limit to max
1374
+ const maxLines = expanded ? lines.length : MCP_RESULT_MAX_LINES;
1375
+ const displayLines = lines.slice(0, maxLines);
1376
+ // Truncate each line (even when expanded, keep lines readable)
1377
+ const maxChars = expanded ? 500 : MCP_RESULT_LINE_MAX_CHARS;
1378
+ const truncatedLines = displayLines.map(line => truncate(line.trim(), maxChars));
1379
+ // Add indicator if there are more lines (only when not expanded)
1380
+ if (!expanded && lines.length > maxLines) {
1381
+ truncatedLines.push(`... (${lines.length - maxLines} more lines)`);
1382
+ }
1383
+ return truncatedLines;
1384
+ }
1385
+ /**
1386
+ * Checks if a tool is an MCP tool.
1387
+ */
1388
+ function isMCPTool(toolName) {
1389
+ return toolName.toLowerCase().startsWith('mcp_');
1390
+ }
1391
+ /**
1392
+ * Checks if a tool is an agent/task tool.
1393
+ */
1394
+ function isAgentTool(toolName) {
1395
+ const lowerName = toolName.toLowerCase();
1396
+ return lowerName === 'task' || lowerName === 'spawn_task' || lowerName === 'delegate_task';
1397
+ }
1398
+ /**
1399
+ * Formats agent tool result content for multi-line display.
1400
+ * Extracts the 'content' or 'response' field from the result JSON.
1401
+ */
1402
+ function formatAgentResultContent(result, expanded = false, _isStatic = false, parsedResult) {
1403
+ try {
1404
+ const resultData = parsedResult ?? JSON.parse(result);
1405
+ if (typeof resultData === 'object' && resultData !== null) {
1406
+ // Extract content from either 'content' or 'response' field
1407
+ const content = (resultData.content || resultData.response || '');
1408
+ if (typeof content === 'string' && content.length > 0) {
1409
+ // Use same formatting as MCP tools
1410
+ return formatMCPResultLines(content, expanded);
1411
+ }
1412
+ }
1413
+ }
1414
+ catch {
1415
+ // If parsing fails, return empty array
1416
+ }
1417
+ return [];
1418
+ }
1419
+ /**
1420
+ * InterleavedStream renders a sequence of text and tool blocks
1421
+ * in Claude Code CLI style format.
1422
+ * Memoized to prevent unnecessary re-renders during modal displays.
1423
+ */
1424
+ const InterleavedStreamComponent = ({ blocks, isStreaming, showThinkingIndicator = true, expandMCPResults = false, isStatic = false, maxVisibleBlocks, }) => {
1425
+ // Memoize visible blocks filtering to avoid recalculation on every render
1426
+ const visibleBlocks = React.useMemo(() => blocks.filter((block) => block.type !== 'tool' || !HIDDEN_TOOLS.has(block.name)), [blocks]);
1427
+ // Consolidate consecutive read/edit/agent blocks into compact display blocks.
1428
+ // Only depends on visibleBlocks — removed isStreaming dependency to avoid
1429
+ // re-running O(n) consolidation passes on every throttled render tick (~10fps).
1430
+ const displayBlocks = React.useMemo(() => {
1431
+ const readConsolidated = consolidateReadBlocks(visibleBlocks);
1432
+ const editConsolidated = consolidateEditBlocks(readConsolidated);
1433
+ return consolidateAgentBlocks(editConsolidated);
1434
+ }, [visibleBlocks]);
1435
+ // Truncate to last N blocks while streaming to keep the dynamic area small.
1436
+ // When not streaming, render everything so the full history is visible.
1437
+ const hiddenCount = (isStreaming && maxVisibleBlocks !== undefined && displayBlocks.length > maxVisibleBlocks)
1438
+ ? displayBlocks.length - maxVisibleBlocks
1439
+ : 0;
1440
+ const renderedBlocks = hiddenCount > 0
1441
+ ? displayBlocks.slice(-maxVisibleBlocks)
1442
+ : displayBlocks;
1443
+ // Thinking indicator when no blocks yet
1444
+ if (displayBlocks.length === 0 && isStreaming && showThinkingIndicator) {
1445
+ return (_jsxs(Box, { children: [_jsx(ActivityDot, { color: "cyan" }), _jsx(Text, { dimColor: true, children: " Thinking..." })] }));
1446
+ }
1447
+ // Nothing to render
1448
+ if (displayBlocks.length === 0) {
1449
+ return null;
1450
+ }
1451
+ // Detect task transitions: text blocks that follow tool blocks
1452
+ // These are typically brief progress messages during plan execution
1453
+ const getTextVariant = (index, block) => {
1454
+ // Explicit variant takes precedence
1455
+ if (block.variant)
1456
+ return block.variant;
1457
+ // Heuristic: if this text block follows a tool/consolidated block and is short,
1458
+ // it's likely a task transition message
1459
+ if (index > 0) {
1460
+ // Map renderedBlocks index back to displayBlocks index for prev-block lookup
1461
+ const displayIndex = index + hiddenCount;
1462
+ const prevBlock = displayBlocks[displayIndex - 1];
1463
+ const isShort = block.content.length < 200 && !block.content.includes('```');
1464
+ const isPrevToolSuccess = (prevBlock.type === 'tool' && prevBlock.status === 'success') ||
1465
+ (prevBlock.type === 'consolidated_read' && prevBlock.status === 'success') ||
1466
+ (prevBlock.type === 'consolidated_edit' && prevBlock.status === 'success') ||
1467
+ (prevBlock.type === 'consolidated_agent' && prevBlock.status === 'success');
1468
+ if (isPrevToolSuccess && isShort) {
1469
+ return 'task-progress';
1470
+ }
1471
+ }
1472
+ return 'default';
1473
+ };
1474
+ return (_jsxs(Box, { flexDirection: "column", children: [hiddenCount > 0 && (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { dimColor: true, children: [" \u2191 ", hiddenCount, " block", hiddenCount === 1 ? '' : 's', " above"] }) })), renderedBlocks.map((block, index) => {
1475
+ const isLast = index === renderedBlocks.length - 1;
1476
+ if (block.type === 'text') {
1477
+ return (_jsx(TextBlock, { content: block.content, isLast: isLast, isStreaming: isStreaming, variant: getTextVariant(index, block) }, `text-${index}`));
1478
+ }
1479
+ if (block.type === 'consolidated_read') {
1480
+ // Use first original block's ID for stable key to prevent flicker during consolidation
1481
+ const stableKey = block.originalBlocks[0]?.id || `consolidated-read-${index}`;
1482
+ return _jsx(ConsolidatedReadBlockComponent, { block: block }, stableKey);
1483
+ }
1484
+ if (block.type === 'consolidated_edit') {
1485
+ // Use first original block's ID for stable key to prevent flicker during consolidation
1486
+ const stableKey = block.originalBlocks[0]?.id || `consolidated-edit-${index}`;
1487
+ return _jsx(ConsolidatedEditBlockComponent, { block: block, expanded: expandMCPResults, isStatic: isStatic }, stableKey);
1488
+ }
1489
+ if (block.type === 'consolidated_agent') {
1490
+ const stableKey = block.originalBlocks[0]?.id || `consolidated-agent-${index}`;
1491
+ return _jsx(ConsolidatedAgentBlockComponent, { block: block, expanded: expandMCPResults, isStatic: isStatic }, stableKey);
1492
+ }
1493
+ return _jsx(ToolBlock, { tool: block, isStreaming: isStreaming, expandMCPResults: expandMCPResults, isStatic: isStatic }, block.id || `tool-${index}`);
1494
+ })] }));
1495
+ };
1496
+ // Memoized to prevent unnecessary re-renders when props haven't changed.
1497
+ // Parent triggers re-renders via forceRender counter rather than array reference changes.
1498
+ export const InterleavedStream = React.memo(InterleavedStreamComponent);
1499
+ export default InterleavedStream;
1500
+ //# sourceMappingURL=InterleavedStream.js.map