@pentoshi/clai 4.14.4 → 4.15.0

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 (463) hide show
  1. package/CONTRIBUTING.md +4 -0
  2. package/PROVIDERS.md +2 -0
  3. package/README.md +41 -5
  4. package/dist/agent/compaction-summary.d.ts +6 -1
  5. package/dist/agent/compaction-summary.js +46 -20
  6. package/dist/agent/compaction-summary.js.map +1 -1
  7. package/dist/agent/confirm-port.d.ts +3 -8
  8. package/dist/agent/confirm-port.js +9 -7
  9. package/dist/agent/confirm-port.js.map +1 -1
  10. package/dist/agent/context/compact-with-summary.js +55 -14
  11. package/dist/agent/context/compact-with-summary.js.map +1 -1
  12. package/dist/agent/context/compaction-recent-history.js +4 -2
  13. package/dist/agent/context/compaction-recent-history.js.map +1 -1
  14. package/dist/agent/context/compaction-user-instructions.d.ts +12 -0
  15. package/dist/agent/context/compaction-user-instructions.js +264 -0
  16. package/dist/agent/context/compaction-user-instructions.js.map +1 -0
  17. package/dist/agent/context/compaction-work-history.d.ts +13 -0
  18. package/dist/agent/context/compaction-work-history.js +150 -0
  19. package/dist/agent/context/compaction-work-history.js.map +1 -0
  20. package/dist/agent/context-manager.js +19 -5
  21. package/dist/agent/context-manager.js.map +1 -1
  22. package/dist/agent/plan-implement-compact.js +2 -1
  23. package/dist/agent/plan-implement-compact.js.map +1 -1
  24. package/dist/agent/subagents/read-only-tools.js +2 -2
  25. package/dist/agent/subagents/read-only-tools.js.map +1 -1
  26. package/dist/agent/turn/loop/stream-session.js +33 -27
  27. package/dist/agent/turn/loop/stream-session.js.map +1 -1
  28. package/dist/agent/turn/tool-execution/authorization.js +1 -1
  29. package/dist/agent/turn/tool-execution/authorization.js.map +1 -1
  30. package/dist/app/adapters/current-store-adapter.js +2 -2
  31. package/dist/app/adapters/current-store-adapter.js.map +1 -1
  32. package/dist/app/adapters/current-updates-adapter.d.ts +1 -1
  33. package/dist/app/adapters/current-updates-adapter.js +4 -13
  34. package/dist/app/adapters/current-updates-adapter.js.map +1 -1
  35. package/dist/app/commands/catalog.js +1 -0
  36. package/dist/app/commands/catalog.js.map +1 -1
  37. package/dist/app/controllers/session-changes.d.ts +24 -0
  38. package/dist/app/controllers/session-changes.js +75 -0
  39. package/dist/app/controllers/session-changes.js.map +1 -0
  40. package/dist/app/controllers/session-controller.d.ts +9 -0
  41. package/dist/app/controllers/session-controller.js +67 -7
  42. package/dist/app/controllers/session-controller.js.map +1 -1
  43. package/dist/app/ports/confirm-port.d.ts +4 -1
  44. package/dist/app/ports/persistence-port.d.ts +2 -0
  45. package/dist/app/ports/transcript-item.d.ts +2 -0
  46. package/dist/app/ports/updates-port.d.ts +1 -1
  47. package/dist/classic/app/ClassicApp.js +42 -33
  48. package/dist/classic/app/ClassicApp.js.map +1 -1
  49. package/dist/classic/app/action-handlers.js +7 -0
  50. package/dist/classic/app/action-handlers.js.map +1 -1
  51. package/dist/classic/app/app-wiring.d.ts +8 -1
  52. package/dist/classic/app/app-wiring.js +23 -4
  53. package/dist/classic/app/app-wiring.js.map +1 -1
  54. package/dist/classic/app/paint-pacing.d.ts +3 -1
  55. package/dist/classic/app/paint-pacing.js +9 -1
  56. package/dist/classic/app/paint-pacing.js.map +1 -1
  57. package/dist/classic/app/use-feed.js +8 -3
  58. package/dist/classic/app/use-feed.js.map +1 -1
  59. package/dist/classic/app/wiring-composer-pointer.d.ts +3 -0
  60. package/dist/classic/app/wiring-composer-pointer.js +22 -0
  61. package/dist/classic/app/wiring-composer-pointer.js.map +1 -0
  62. package/dist/classic/app/wiring-disclosure.d.ts +3 -0
  63. package/dist/classic/app/wiring-disclosure.js +31 -0
  64. package/dist/classic/app/wiring-disclosure.js.map +1 -0
  65. package/dist/classic/app/wiring-interactions.d.ts +1 -0
  66. package/dist/classic/app/wiring-interactions.js +16 -16
  67. package/dist/classic/app/wiring-interactions.js.map +1 -1
  68. package/dist/classic/app/wiring-jump-to-latest.d.ts +3 -0
  69. package/dist/classic/app/wiring-jump-to-latest.js +38 -0
  70. package/dist/classic/app/wiring-jump-to-latest.js.map +1 -0
  71. package/dist/classic/app/wiring-lifecycle.d.ts +1 -1
  72. package/dist/classic/app/wiring-lifecycle.js +19 -10
  73. package/dist/classic/app/wiring-lifecycle.js.map +1 -1
  74. package/dist/classic/app/wiring-selection.d.ts +1 -0
  75. package/dist/classic/app/wiring-selection.js +10 -1
  76. package/dist/classic/app/wiring-selection.js.map +1 -1
  77. package/dist/classic/app/wiring-types.d.ts +12 -1
  78. package/dist/classic/blocks/assistant-lines.js +1 -1
  79. package/dist/classic/blocks/assistant-lines.js.map +1 -1
  80. package/dist/classic/blocks/batch-lines.d.ts +1 -1
  81. package/dist/classic/blocks/batch-lines.js +47 -59
  82. package/dist/classic/blocks/batch-lines.js.map +1 -1
  83. package/dist/classic/blocks/block-context.d.ts +8 -1
  84. package/dist/classic/blocks/block-context.js.map +1 -1
  85. package/dist/classic/blocks/compacted-lines.d.ts +0 -1
  86. package/dist/classic/blocks/compacted-lines.js +12 -44
  87. package/dist/classic/blocks/compacted-lines.js.map +1 -1
  88. package/dist/classic/blocks/diff-lines.d.ts +3 -5
  89. package/dist/classic/blocks/diff-lines.js +113 -152
  90. package/dist/classic/blocks/diff-lines.js.map +1 -1
  91. package/dist/classic/blocks/disclosure-lines.d.ts +16 -0
  92. package/dist/classic/blocks/disclosure-lines.js +20 -0
  93. package/dist/classic/blocks/disclosure-lines.js.map +1 -0
  94. package/dist/classic/blocks/intro-lines.js +2 -0
  95. package/dist/classic/blocks/intro-lines.js.map +1 -1
  96. package/dist/classic/blocks/notice-lines.js +4 -16
  97. package/dist/classic/blocks/notice-lines.js.map +1 -1
  98. package/dist/classic/blocks/output-lines.d.ts +10 -0
  99. package/dist/classic/blocks/output-lines.js +35 -0
  100. package/dist/classic/blocks/output-lines.js.map +1 -0
  101. package/dist/classic/blocks/thinking-lines.d.ts +0 -1
  102. package/dist/classic/blocks/thinking-lines.js +15 -32
  103. package/dist/classic/blocks/thinking-lines.js.map +1 -1
  104. package/dist/classic/blocks/tool-label.d.ts +2 -0
  105. package/dist/classic/blocks/tool-label.js +8 -0
  106. package/dist/classic/blocks/tool-label.js.map +1 -0
  107. package/dist/classic/blocks/tool-lines.d.ts +3 -5
  108. package/dist/classic/blocks/tool-lines.js +90 -150
  109. package/dist/classic/blocks/tool-lines.js.map +1 -1
  110. package/dist/classic/blocks/turn-summary-lines.js +7 -1
  111. package/dist/classic/blocks/turn-summary-lines.js.map +1 -1
  112. package/dist/classic/blocks/user-lines.js +9 -15
  113. package/dist/classic/blocks/user-lines.js.map +1 -1
  114. package/dist/classic/bootstrap/start-classic.js +2 -0
  115. package/dist/classic/bootstrap/start-classic.js.map +1 -1
  116. package/dist/classic/chrome/Composer.d.ts +4 -2
  117. package/dist/classic/chrome/Composer.js +12 -6
  118. package/dist/classic/chrome/Composer.js.map +1 -1
  119. package/dist/classic/chrome/composer-controller.d.ts +3 -0
  120. package/dist/classic/chrome/composer-controller.js +15 -22
  121. package/dist/classic/chrome/composer-controller.js.map +1 -1
  122. package/dist/classic/chrome/composer-frame.d.ts +1 -1
  123. package/dist/classic/chrome/composer-frame.js +2 -1
  124. package/dist/classic/chrome/composer-frame.js.map +1 -1
  125. package/dist/classic/chrome/composer-mentions.d.ts +2 -0
  126. package/dist/classic/chrome/composer-mentions.js +16 -0
  127. package/dist/classic/chrome/composer-mentions.js.map +1 -0
  128. package/dist/classic/chrome/composer-pointer.d.ts +13 -0
  129. package/dist/classic/chrome/composer-pointer.js +22 -0
  130. package/dist/classic/chrome/composer-pointer.js.map +1 -0
  131. package/dist/classic/chrome/directory-row.d.ts +20 -2
  132. package/dist/classic/chrome/directory-row.js +45 -1
  133. package/dist/classic/chrome/directory-row.js.map +1 -1
  134. package/dist/classic/chrome/editor-view.js +6 -1
  135. package/dist/classic/chrome/editor-view.js.map +1 -1
  136. package/dist/classic/chrome/queue-rows.d.ts +1 -0
  137. package/dist/classic/chrome/queue-rows.js +12 -2
  138. package/dist/classic/chrome/queue-rows.js.map +1 -1
  139. package/dist/classic/chrome/status-rows.d.ts +1 -0
  140. package/dist/classic/chrome/status-rows.js +5 -4
  141. package/dist/classic/chrome/status-rows.js.map +1 -1
  142. package/dist/classic/chrome/toast-rows.js +7 -6
  143. package/dist/classic/chrome/toast-rows.js.map +1 -1
  144. package/dist/classic/feed/LiveTail.d.ts +4 -3
  145. package/dist/classic/feed/LiveTail.js +26 -15
  146. package/dist/classic/feed/LiveTail.js.map +1 -1
  147. package/dist/classic/feed/feed-blocks.d.ts +2 -0
  148. package/dist/classic/feed/feed-blocks.js +4 -2
  149. package/dist/classic/feed/feed-blocks.js.map +1 -1
  150. package/dist/classic/feed/transcript-disclosure.d.ts +6 -0
  151. package/dist/classic/feed/transcript-disclosure.js +9 -0
  152. package/dist/classic/feed/transcript-disclosure.js.map +1 -0
  153. package/dist/classic/feed/transcript-resources.d.ts +23 -0
  154. package/dist/classic/feed/transcript-resources.js +140 -0
  155. package/dist/classic/feed/transcript-resources.js.map +1 -0
  156. package/dist/classic/feed/transcript-window.js +43 -18
  157. package/dist/classic/feed/transcript-window.js.map +1 -1
  158. package/dist/classic/input/input-router.d.ts +2 -0
  159. package/dist/classic/input/input-router.js +6 -0
  160. package/dist/classic/input/input-router.js.map +1 -1
  161. package/dist/classic/input/raw-decoder.js +3 -2
  162. package/dist/classic/input/raw-decoder.js.map +1 -1
  163. package/dist/classic/panels/confirm-panel.js +17 -10
  164. package/dist/classic/panels/confirm-panel.js.map +1 -1
  165. package/dist/classic/panels/pager-panel.d.ts +6 -2
  166. package/dist/classic/panels/pager-panel.js +11 -4
  167. package/dist/classic/panels/pager-panel.js.map +1 -1
  168. package/dist/classic/panels/panel-controller.js +4 -1
  169. package/dist/classic/panels/panel-controller.js.map +1 -1
  170. package/dist/classic/panels/panel-host.js +1 -1
  171. package/dist/classic/panels/panel-host.js.map +1 -1
  172. package/dist/classic/panels/panel-wheel.js +1 -1
  173. package/dist/classic/panels/panel-wheel.js.map +1 -1
  174. package/dist/classic/render/shell-width.d.ts +0 -2
  175. package/dist/classic/render/shell-width.js +0 -6
  176. package/dist/classic/render/shell-width.js.map +1 -1
  177. package/dist/commands/update/detection.d.ts +20 -0
  178. package/dist/commands/update/detection.js +207 -0
  179. package/dist/commands/update/detection.js.map +1 -0
  180. package/dist/commands/update/download.d.ts +3 -0
  181. package/dist/commands/update/download.js +63 -0
  182. package/dist/commands/update/download.js.map +1 -0
  183. package/dist/commands/update/installers.d.ts +16 -5
  184. package/dist/commands/update/installers.js +12 -513
  185. package/dist/commands/update/installers.js.map +1 -1
  186. package/dist/commands/update/lock.d.ts +6 -0
  187. package/dist/commands/update/lock.js +86 -0
  188. package/dist/commands/update/lock.js.map +1 -0
  189. package/dist/commands/update/metadata.d.ts +6 -0
  190. package/dist/commands/update/metadata.js +36 -0
  191. package/dist/commands/update/metadata.js.map +1 -0
  192. package/dist/commands/update/native.d.ts +3 -0
  193. package/dist/commands/update/native.js +179 -0
  194. package/dist/commands/update/native.js.map +1 -0
  195. package/dist/commands/update/package-managers.d.ts +4 -0
  196. package/dist/commands/update/package-managers.js +158 -0
  197. package/dist/commands/update/package-managers.js.map +1 -0
  198. package/dist/commands/update/process.d.ts +17 -0
  199. package/dist/commands/update/process.js +114 -0
  200. package/dist/commands/update/process.js.map +1 -0
  201. package/dist/commands/update/source-worker.d.ts +2 -0
  202. package/dist/commands/update/source-worker.js +71 -0
  203. package/dist/commands/update/source-worker.js.map +1 -0
  204. package/dist/commands/update/source.d.ts +2 -0
  205. package/dist/commands/update/source.js +79 -0
  206. package/dist/commands/update/source.js.map +1 -0
  207. package/dist/commands/update/verification.d.ts +7 -0
  208. package/dist/commands/update/verification.js +73 -0
  209. package/dist/commands/update/verification.js.map +1 -0
  210. package/dist/commands/update/windows-stage.d.ts +21 -0
  211. package/dist/commands/update/windows-stage.js +186 -0
  212. package/dist/commands/update/windows-stage.js.map +1 -0
  213. package/dist/commands/update-install.d.ts +4 -13
  214. package/dist/commands/update-install.js +20 -152
  215. package/dist/commands/update-install.js.map +1 -1
  216. package/dist/commands/update.d.ts +4 -9
  217. package/dist/commands/update.js +51 -103
  218. package/dist/commands/update.js.map +1 -1
  219. package/dist/index.js +1 -1
  220. package/dist/index.js.map +1 -1
  221. package/dist/instructions/record.d.ts +1 -1
  222. package/dist/instructions/record.js +3 -3
  223. package/dist/llm/free-client.d.ts +2 -0
  224. package/dist/llm/free-client.js +52 -0
  225. package/dist/llm/free-client.js.map +1 -0
  226. package/dist/llm/free.d.ts +1 -0
  227. package/dist/llm/free.js +77 -176
  228. package/dist/llm/free.js.map +1 -1
  229. package/dist/llm/key-rotation.d.ts +1 -0
  230. package/dist/llm/key-rotation.js +13 -2
  231. package/dist/llm/key-rotation.js.map +1 -1
  232. package/dist/llm/reasoning-errors.js +1 -1
  233. package/dist/llm/reasoning-errors.js.map +1 -1
  234. package/dist/llm/responses-error.d.ts +3 -0
  235. package/dist/llm/responses-error.js +37 -0
  236. package/dist/llm/responses-error.js.map +1 -0
  237. package/dist/llm/responses-http.js +5 -2
  238. package/dist/llm/responses-http.js.map +1 -1
  239. package/dist/llm/responses-replay.d.ts +2 -0
  240. package/dist/llm/responses-replay.js +37 -1
  241. package/dist/llm/responses-replay.js.map +1 -1
  242. package/dist/llm/responses-stream-events.js +3 -20
  243. package/dist/llm/responses-stream-events.js.map +1 -1
  244. package/dist/llm/responses-stream.js +2 -0
  245. package/dist/llm/responses-stream.js.map +1 -1
  246. package/dist/llm/wire/reasoning-artifacts.js +1 -1
  247. package/dist/llm/wire/reasoning-artifacts.js.map +1 -1
  248. package/dist/noninteractive/stdio-confirm-port.js +4 -3
  249. package/dist/noninteractive/stdio-confirm-port.js.map +1 -1
  250. package/dist/os/bun-runtime.js +2 -1
  251. package/dist/os/bun-runtime.js.map +1 -1
  252. package/dist/os/update-origin.d.ts +7 -0
  253. package/dist/os/update-origin.js +30 -0
  254. package/dist/os/update-origin.js.map +1 -0
  255. package/dist/prompts/embedded.js +2 -2
  256. package/dist/prompts/embedded.js.map +1 -1
  257. package/dist/prompts/index.js +25 -22
  258. package/dist/prompts/index.js.map +1 -1
  259. package/dist/prompts/system.agent.md +7 -1
  260. package/dist/prompts/system.ask.md +1 -1
  261. package/dist/safety/filesystem-permissions.d.ts +8 -0
  262. package/dist/safety/filesystem-permissions.js +38 -18
  263. package/dist/safety/filesystem-permissions.js.map +1 -1
  264. package/dist/safety/patterns.d.ts +1 -1
  265. package/dist/safety/patterns.js +7 -7
  266. package/dist/safety/patterns.js.map +1 -1
  267. package/dist/safety/permission-mode.js +1 -1
  268. package/dist/safety/permission-mode.js.map +1 -1
  269. package/dist/safety/shell-classification.js +1 -1
  270. package/dist/safety/shell-classification.js.map +1 -1
  271. package/dist/session-runtime/client.js +2 -1
  272. package/dist/session-runtime/client.js.map +1 -1
  273. package/dist/session-runtime/view-manager.js +1 -1
  274. package/dist/session-runtime/view-manager.js.map +1 -1
  275. package/dist/store/history/jsonl-lock.js +10 -7
  276. package/dist/store/history/jsonl-lock.js.map +1 -1
  277. package/dist/store/history/recovery.d.ts +1 -0
  278. package/dist/store/history/recovery.js +2 -1
  279. package/dist/store/history/recovery.js.map +1 -1
  280. package/dist/store/history/sqlite-backend.js +2 -0
  281. package/dist/store/history/sqlite-backend.js.map +1 -1
  282. package/dist/store/history.d.ts +2 -2
  283. package/dist/store/history.js +8 -4
  284. package/dist/store/history.js.map +1 -1
  285. package/dist/store/session-prompts.d.ts +5 -0
  286. package/dist/store/session-prompts.js +60 -1
  287. package/dist/store/session-prompts.js.map +1 -1
  288. package/dist/tools/definitions/aggregate.js +7 -2
  289. package/dist/tools/definitions/aggregate.js.map +1 -1
  290. package/dist/tools/definitions/fs-read.js +1 -1
  291. package/dist/tools/definitions/fs-read.js.map +1 -1
  292. package/dist/tools/fs/read-input.d.ts +1 -1
  293. package/dist/tools/fs/read-input.js +2 -2
  294. package/dist/tools/fs/read-input.js.map +1 -1
  295. package/dist/tools/instructions.js +8 -1
  296. package/dist/tools/instructions.js.map +1 -1
  297. package/dist/tui-v2/app/App.js +18 -7
  298. package/dist/tui-v2/app/App.js.map +1 -1
  299. package/dist/tui-v2/bootstrap/frame-pacing.d.ts +4 -0
  300. package/dist/tui-v2/bootstrap/frame-pacing.js +5 -0
  301. package/dist/tui-v2/bootstrap/frame-pacing.js.map +1 -0
  302. package/dist/tui-v2/bootstrap/runtime-view.js +2 -0
  303. package/dist/tui-v2/bootstrap/runtime-view.js.map +1 -1
  304. package/dist/tui-v2/bootstrap/start-tui-v2.js +2 -0
  305. package/dist/tui-v2/bootstrap/start-tui-v2.js.map +1 -1
  306. package/dist/tui-v2/components/modal/confirm-modal.d.ts +2 -0
  307. package/dist/tui-v2/components/modal/confirm-modal.js +21 -35
  308. package/dist/tui-v2/components/modal/confirm-modal.js.map +1 -1
  309. package/dist/tui-v2/components/overlay/overlay-host.js +1 -1
  310. package/dist/tui-v2/components/overlay/overlay-host.js.map +1 -1
  311. package/dist/tui-v2/components/pager/pager.js +4 -1
  312. package/dist/tui-v2/components/pager/pager.js.map +1 -1
  313. package/dist/tui-v2/components/plan/plan-interaction.d.ts +11 -0
  314. package/dist/tui-v2/components/plan/plan-interaction.js +56 -0
  315. package/dist/tui-v2/components/plan/plan-interaction.js.map +1 -0
  316. package/dist/tui-v2/components/plan/plan-view.d.ts +7 -1
  317. package/dist/tui-v2/components/plan/plan-view.js +78 -175
  318. package/dist/tui-v2/components/plan/plan-view.js.map +1 -1
  319. package/dist/tui-v2/components/plan/task-title.d.ts +9 -0
  320. package/dist/tui-v2/components/plan/task-title.js +17 -0
  321. package/dist/tui-v2/components/plan/task-title.js.map +1 -0
  322. package/dist/tui-v2/components/plan/use-task-disclosure.d.ts +25 -0
  323. package/dist/tui-v2/components/plan/use-task-disclosure.js +125 -0
  324. package/dist/tui-v2/components/plan/use-task-disclosure.js.map +1 -0
  325. package/dist/tui-v2/components/queue/queue-panel.js +2 -7
  326. package/dist/tui-v2/components/queue/queue-panel.js.map +1 -1
  327. package/dist/tui-v2/components/status/jump-to-latest.d.ts +7 -0
  328. package/dist/tui-v2/components/status/jump-to-latest.js +16 -0
  329. package/dist/tui-v2/components/status/jump-to-latest.js.map +1 -0
  330. package/dist/tui-v2/components/status/status-line.d.ts +1 -0
  331. package/dist/tui-v2/components/status/status-line.js +14 -4
  332. package/dist/tui-v2/components/status/status-line.js.map +1 -1
  333. package/dist/tui-v2/components/toast/toast-host.js +4 -7
  334. package/dist/tui-v2/components/toast/toast-host.js.map +1 -1
  335. package/dist/tui-v2/components/transcript/file-diff-card.d.ts +1 -0
  336. package/dist/tui-v2/components/transcript/file-diff-card.js +25 -11
  337. package/dist/tui-v2/components/transcript/file-diff-card.js.map +1 -1
  338. package/dist/tui-v2/components/transcript/tool-card.js +24 -20
  339. package/dist/tui-v2/components/transcript/tool-card.js.map +1 -1
  340. package/dist/tui-v2/components/transcript/transcript-row.js +6 -3
  341. package/dist/tui-v2/components/transcript/transcript-row.js.map +1 -1
  342. package/dist/tui-v2/components/transcript/transcript-scroll-port.d.ts +1 -0
  343. package/dist/tui-v2/components/transcript/transcript-scroll-port.js +3 -1
  344. package/dist/tui-v2/components/transcript/transcript-scroll-port.js.map +1 -1
  345. package/dist/tui-v2/components/transcript/transcript-scrollbar.js +17 -11
  346. package/dist/tui-v2/components/transcript/transcript-scrollbar.js.map +1 -1
  347. package/dist/tui-v2/components/transcript/transcript-view.js +41 -21
  348. package/dist/tui-v2/components/transcript/transcript-view.js.map +1 -1
  349. package/dist/tui-v2/composer/composer-editor.js +17 -9
  350. package/dist/tui-v2/composer/composer-editor.js.map +1 -1
  351. package/dist/tui-v2/rendering/pager-markdown.d.ts +3 -0
  352. package/dist/tui-v2/rendering/pager-markdown.js +3 -0
  353. package/dist/tui-v2/rendering/pager-markdown.js.map +1 -1
  354. package/dist/types.d.ts +12 -0
  355. package/dist/types.js.map +1 -1
  356. package/dist/ui/mentions/file-suggestions.js +17 -8
  357. package/dist/ui/mentions/file-suggestions.js.map +1 -1
  358. package/dist/ui-core/actions/action-id.d.ts +1 -1
  359. package/dist/ui-core/actions/action-id.js +7 -0
  360. package/dist/ui-core/actions/action-id.js.map +1 -1
  361. package/dist/ui-core/actions/format-shortcuts.js +9 -0
  362. package/dist/ui-core/actions/format-shortcuts.js.map +1 -1
  363. package/dist/ui-core/bootstrap/overlay-ports.js +8 -3
  364. package/dist/ui-core/bootstrap/overlay-ports.js.map +1 -1
  365. package/dist/ui-core/bootstrap/session-resume.js +1 -0
  366. package/dist/ui-core/bootstrap/session-resume.js.map +1 -1
  367. package/dist/ui-core/commands/change-commands.d.ts +4 -0
  368. package/dist/ui-core/commands/change-commands.js +48 -0
  369. package/dist/ui-core/commands/change-commands.js.map +1 -0
  370. package/dist/ui-core/commands/command-handlers.js +2 -0
  371. package/dist/ui-core/commands/command-handlers.js.map +1 -1
  372. package/dist/ui-core/commands/config-commands.js +12 -6
  373. package/dist/ui-core/commands/config-commands.js.map +1 -1
  374. package/dist/ui-core/commands/prompt-commands.d.ts +1 -1
  375. package/dist/ui-core/commands/prompt-commands.js +12 -2
  376. package/dist/ui-core/commands/prompt-commands.js.map +1 -1
  377. package/dist/ui-core/composer/arrow-intent.js +2 -0
  378. package/dist/ui-core/composer/arrow-intent.js.map +1 -1
  379. package/dist/ui-core/composer/paste-placeholder.js +2 -2
  380. package/dist/ui-core/composer/paste-placeholder.js.map +1 -1
  381. package/dist/ui-core/composer/prompt-history.d.ts +12 -0
  382. package/dist/ui-core/composer/prompt-history.js +75 -1
  383. package/dist/ui-core/composer/prompt-history.js.map +1 -1
  384. package/dist/ui-core/composer/saved-prompt-history.d.ts +5 -0
  385. package/dist/ui-core/composer/saved-prompt-history.js +33 -0
  386. package/dist/ui-core/composer/saved-prompt-history.js.map +1 -0
  387. package/dist/ui-core/controllers/overlay-controller.d.ts +1 -0
  388. package/dist/ui-core/controllers/overlay-controller.js.map +1 -1
  389. package/dist/ui-core/controllers/toast-controller.js +4 -4
  390. package/dist/ui-core/controllers/toast-controller.js.map +1 -1
  391. package/dist/ui-core/react/use-transcript-store.js +4 -2
  392. package/dist/ui-core/react/use-transcript-store.js.map +1 -1
  393. package/dist/ui-core/rendering/artifact-pager-source.d.ts +3 -0
  394. package/dist/ui-core/rendering/artifact-pager-source.js.map +1 -1
  395. package/dist/ui-core/rendering/batch-sections.d.ts +3 -2
  396. package/dist/ui-core/rendering/batch-sections.js +5 -5
  397. package/dist/ui-core/rendering/batch-sections.js.map +1 -1
  398. package/dist/ui-core/rendering/card-style.d.ts +2 -0
  399. package/dist/ui-core/rendering/card-style.js +3 -0
  400. package/dist/ui-core/rendering/card-style.js.map +1 -0
  401. package/dist/ui-core/rendering/confirmation-preview.d.ts +9 -0
  402. package/dist/ui-core/rendering/confirmation-preview.js +33 -0
  403. package/dist/ui-core/rendering/confirmation-preview.js.map +1 -0
  404. package/dist/ui-core/rendering/duration.d.ts +2 -1
  405. package/dist/ui-core/rendering/duration.js +4 -6
  406. package/dist/ui-core/rendering/duration.js.map +1 -1
  407. package/dist/ui-core/rendering/intro-header.d.ts +1 -0
  408. package/dist/ui-core/rendering/intro-header.js +19 -15
  409. package/dist/ui-core/rendering/intro-header.js.map +1 -1
  410. package/dist/ui-core/rendering/jump-to-latest.d.ts +1 -0
  411. package/dist/ui-core/rendering/jump-to-latest.js +7 -0
  412. package/dist/ui-core/rendering/jump-to-latest.js.map +1 -0
  413. package/dist/ui-core/rendering/line-change-labels.d.ts +6 -0
  414. package/dist/ui-core/rendering/line-change-labels.js +12 -0
  415. package/dist/ui-core/rendering/line-change-labels.js.map +1 -0
  416. package/dist/ui-core/rendering/markdown.d.ts +5 -1
  417. package/dist/ui-core/rendering/markdown.js +20 -5
  418. package/dist/ui-core/rendering/markdown.js.map +1 -1
  419. package/dist/ui-core/rendering/plan-view.js +24 -12
  420. package/dist/ui-core/rendering/plan-view.js.map +1 -1
  421. package/dist/ui-core/rendering/render-markdown-lines.d.ts +3 -0
  422. package/dist/ui-core/rendering/render-markdown-lines.js +6 -1
  423. package/dist/ui-core/rendering/render-markdown-lines.js.map +1 -1
  424. package/dist/ui-core/rendering/session-prompts-pager-source.js +2 -0
  425. package/dist/ui-core/rendering/session-prompts-pager-source.js.map +1 -1
  426. package/dist/ui-core/rendering/status-segments.js +10 -5
  427. package/dist/ui-core/rendering/status-segments.js.map +1 -1
  428. package/dist/ui-core/rendering/subagent-presentation.js +39 -11
  429. package/dist/ui-core/rendering/subagent-presentation.js.map +1 -1
  430. package/dist/ui-core/rendering/subagent-source.js +11 -48
  431. package/dist/ui-core/rendering/subagent-source.js.map +1 -1
  432. package/dist/ui-core/rendering/subagent-tool-usage.d.ts +5 -0
  433. package/dist/ui-core/rendering/subagent-tool-usage.js +42 -0
  434. package/dist/ui-core/rendering/subagent-tool-usage.js.map +1 -0
  435. package/dist/ui-core/rendering/task-disclosure.d.ts +19 -0
  436. package/dist/ui-core/rendering/task-disclosure.js +70 -0
  437. package/dist/ui-core/rendering/task-disclosure.js.map +1 -0
  438. package/dist/ui-core/rendering/tool-diff-preview.d.ts +21 -0
  439. package/dist/ui-core/rendering/tool-diff-preview.js +27 -0
  440. package/dist/ui-core/rendering/tool-diff-preview.js.map +1 -0
  441. package/dist/ui-core/rendering/tool-presenter.d.ts +4 -2
  442. package/dist/ui-core/rendering/tool-presenter.js +19 -4
  443. package/dist/ui-core/rendering/tool-presenter.js.map +1 -1
  444. package/dist/ui-core/rendering/tool-usage-label.d.ts +2 -0
  445. package/dist/ui-core/rendering/tool-usage-label.js +42 -0
  446. package/dist/ui-core/rendering/tool-usage-label.js.map +1 -0
  447. package/dist/ui-core/state/hydrate/classic-transcript.js +2 -0
  448. package/dist/ui-core/state/hydrate/classic-transcript.js.map +1 -1
  449. package/dist/ui-core/state/transcript/apply-app-event.js +16 -5
  450. package/dist/ui-core/state/transcript/apply-app-event.js.map +1 -1
  451. package/dist/ui-core/state/transcript-hydrate.js +1 -0
  452. package/dist/ui-core/state/transcript-hydrate.js.map +1 -1
  453. package/dist/ui-core/state/transcript-types.d.ts +4 -0
  454. package/dist/ui-core/state/transcript-types.js.map +1 -1
  455. package/dist/version.generated.d.ts +2 -2
  456. package/dist/version.generated.js +2 -2
  457. package/package.json +1 -1
  458. package/dist/classic/feed/ScrollbarGutter.d.ts +0 -9
  459. package/dist/classic/feed/ScrollbarGutter.js +0 -41
  460. package/dist/classic/feed/ScrollbarGutter.js.map +0 -1
  461. package/dist/classic/feed/scrollbar-rows.d.ts +0 -5
  462. package/dist/classic/feed/scrollbar-rows.js +0 -17
  463. package/dist/classic/feed/scrollbar-rows.js.map +0 -1
@@ -1,28 +1,14 @@
1
- import { batchSummaryLine, buildBatchCardsFromSpool, parseBatchSections, presentBatchSection, } from "../../ui-core/rendering/batch-sections.js";
1
+ import { buildBatchCardsFromSpool, parseBatchSections, batchSummaryLine } from "../../ui-core/rendering/batch-sections.js";
2
2
  import { isItemExpanded } from "../../ui-core/state/transcript-types.js";
3
+ import { parseFsReadSections } from "../../tools/fs/read-sections.js";
4
+ import { sanitizeDisplayText } from "../../ui-core/rendering/sanitize-display.js";
3
5
  import { adaptPresenterGlyphs } from "../render/glyphs.js";
4
- import { alignEnds, trimTrailingSpaces } from "../render/ansi-text.js";
5
- import { EXPANDED_LINE_ROWS, joinMeta, SUFFIX_MIN_COLUMNS, wrapBoundedRows, } from "./block-context.js";
6
- import { hintRows, outputToggleLabel, toolHeaderLines } from "./tool-lines.js";
7
- import { isFsReadMultiOutput } from "../../tools/fs/read-sections.js";
8
- export const BATCH_COLLAPSED_ROWS = 8;
9
- const SUB_INDENT = 2;
10
- const SUB_BODY_INDENT = 4;
11
- const SECTION_TOKEN = {
12
- running: "activity",
13
- ok: "success",
14
- fail: "diffDel",
15
- cancelled: "activity",
16
- };
17
- function sectionGlyph(ctx, status) {
18
- if (status === "running")
19
- return ctx.glyphs.toolRunning;
20
- if (status === "ok")
21
- return ctx.glyphs.toolOk;
22
- if (status === "cancelled")
23
- return ctx.glyphs.toolBlocked;
24
- return ctx.glyphs.toolFailed;
25
- }
6
+ import { clipRow } from "./block-context.js";
7
+ import { appendDisclosure } from "./disclosure-lines.js";
8
+ import { classicToolLabel } from "./tool-label.js";
9
+ import { logicalOutputLines, outputBodyRows } from "./output-lines.js";
10
+ import { buildToolLines, toolHeaderLines, toolGlyph, TOOL_STATUS_TOKEN } from "./tool-lines.js";
11
+ export const BATCH_COLLAPSED_ROWS = 3;
26
12
  export function batchSectionsFor(ctx, item) {
27
13
  const tail = ctx.spool.tail(item.toolCallId);
28
14
  const open = item.status === "running" || item.status === "queued";
@@ -31,48 +17,50 @@ export function batchSectionsFor(ctx, item) {
31
17
  const parsed = parseBatchSections(tail);
32
18
  return parsed.length > 0 ? parsed : buildBatchCardsFromSpool(tail);
33
19
  }
20
+ function readPathLine(ctx, path, ok) {
21
+ const label = ctx.ink.fg(ok ? "inputBorder" : "diffDel", sanitizeDisplayText(path).replace(/\n/g, " "));
22
+ return clipRow(ctx, ` ${ctx.ink.fg("toolOutput", "Read")} ${label}`);
23
+ }
24
+ function compactReadLines(ctx, section) {
25
+ const files = parseFsReadSections(section.body);
26
+ if (files.length === 0) {
27
+ const path = section.body.match(/^# fs\.read path=(.+?)(?= (?:lines|pattern|bytes)=|$)/m)?.[1];
28
+ if (path)
29
+ return [readPathLine(ctx, path, section.ok)];
30
+ return outputBodyRows(ctx, logicalOutputLines(section.body, section.name), false, { branch: false });
31
+ }
32
+ return files.flatMap((file) => {
33
+ const lines = [readPathLine(ctx, file.path, file.ok)];
34
+ if (!file.ok)
35
+ lines.push(...outputBodyRows(ctx, logicalOutputLines(file.body, section.name), false, { token: "diffDel", branch: false }));
36
+ return lines;
37
+ });
38
+ }
34
39
  export function buildBatchLines(ctx, item) {
35
40
  const expanded = isItemExpanded(ctx.state, item);
36
41
  const sections = batchSectionsFor(ctx, item);
42
+ if (sections.length === 0)
43
+ return buildToolLines(ctx, item);
37
44
  const lines = toolHeaderLines(ctx, item);
38
- const subIndent = " ".repeat(SUB_INDENT);
39
- if (sections.length === 0) {
40
- lines.push(...hintRows(ctx, subIndent, outputToggleLabel(expanded)));
41
- return lines;
42
- }
43
45
  const shown = expanded ? sections : sections.slice(0, BATCH_COLLAPSED_ROWS);
44
- const bodyIndent = " ".repeat(SUB_BODY_INDENT);
45
- for (const section of shown) {
46
- const status = section.status ?? (section.ok ? "ok" : "fail");
47
- const token = SECTION_TOKEN[status] ?? "muted";
48
- const multiRead = section.name === "fs.read" && isFsReadMultiOutput(section.body);
49
- const presented = presentBatchSection(section, multiRead ? false : expanded, ctx.width - SUB_BODY_INDENT);
50
- const glyph = ctx.ink.fg(token, sectionGlyph(ctx, status));
51
- const name = ctx.ink.fg("cyan", section.name);
52
- const suffix = ctx.width + 2 >= SUFFIX_MIN_COLUMNS && status === "running"
53
- ? ctx.ink.fg(token, presented.statusLabel)
54
- : "";
55
- lines.push(alignEnds(`${subIndent}${glyph} ${name}`, suffix, ctx.width, ctx.glyphs.ellipsis));
56
- if ((!expanded && !multiRead) || !presented.hasBody)
57
- continue;
58
- const budget = Math.max(1, ctx.width - SUB_BODY_INDENT);
59
- const rows = multiRead ? presented.lines : presented.lines.filter((line) => line.trim().length > 0).slice(0, 1);
60
- for (const row of rows) {
61
- const text = adaptPresenterGlyphs(row, ctx.ink.unicode);
62
- for (const chunk of wrapBoundedRows(ctx, text, budget, EXPANDED_LINE_ROWS)) {
63
- lines.push(trimTrailingSpaces(`${bodyIndent}${ctx.ink.fg("toolText", chunk)}`));
64
- }
65
- }
46
+ for (const [index, section] of shown.entries()) {
47
+ const status = section.status === "fail" ? "failed" : section.status === "cancelled" ? "blocked" : section.status;
48
+ const token = section.status === "cancelled" ? "muted" : TOOL_STATUS_TOKEN[status];
49
+ const tool = { ...item, name: section.name, status };
50
+ const name = ctx.ink.fg(token, classicToolLabel(tool));
51
+ const glyph = ctx.ink.fg(token, toolGlyph(ctx, status));
52
+ const prefix = index === 0 ? ` ${ctx.glyphs.bodyBranch} ` : " ";
53
+ const exit = section.exitCode && section.exitCode !== 0 ? ` (exit ${section.exitCode})` : "";
54
+ lines.push(clipRow(ctx, `${prefix}${glyph} ${name}${exit}`));
55
+ if (expanded)
56
+ lines.push(...outputBodyRows(ctx, logicalOutputLines(section.body, section.name), true, { branch: false }));
57
+ else if (section.name === "fs.read")
58
+ lines.push(...compactReadLines(ctx, section));
66
59
  }
67
- const hidden = sections.length - shown.length;
68
- const summary = batchSummaryLine(sections);
69
- const footer = joinMeta(ctx, [
70
- outputToggleLabel(expanded),
71
- summary === "" ? undefined : summary,
72
- hidden > 0 ? `${ctx.glyphs.ellipsis} +${hidden} more` : undefined,
73
- ]);
74
- if (footer !== "")
75
- lines.push(...hintRows(ctx, subIndent, footer));
60
+ const summary = adaptPresenterGlyphs(batchSummaryLine(sections, "glyph"), ctx.ink.unicode);
61
+ if (summary)
62
+ lines.push(clipRow(ctx, ` ${ctx.ink.fg("hint", summary)}`));
63
+ appendDisclosure(ctx, lines, expanded, { hidden: Math.max(0, sections.length - shown.length) });
76
64
  return lines;
77
65
  }
78
66
  //# sourceMappingURL=batch-lines.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"batch-lines.js","sourceRoot":"","sources":["../../../src/classic/blocks/batch-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,cAAc,EAAiB,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,kBAAkB,EAClB,eAAe,GAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,CAAC,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AAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,MAAM,GAAG,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7D,IAAI,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;aACrH,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IACrF,CAAC;IACD,MAAM,OAAO,GAAG,oBAAoB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3F,IAAI,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5E,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAChG,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,13 +1,18 @@
1
1
  import type { ToolCallId } from "../../app/events/app-event.js";
2
2
  import type { BoundedTextState } from "../../app/events/event-buffer.js";
3
+ import type { FileChange } from "../../tools/file-diff.js";
3
4
  import type { MarkdownStreamCache } from "../../ui-core/rendering/streaming-markdown.js";
4
5
  import type { TranscriptState } from "../../ui-core/state/transcript-types.js";
5
6
  import type { Glyphs } from "../render/glyphs.js";
6
7
  import type { InkTheme } from "../render/ink-theme.js";
8
+ import type { BlockDisclosure } from "./disclosure-lines.js";
7
9
  export interface SpoolReader {
8
10
  tail(toolCallId: ToolCallId): string;
9
11
  state(toolCallId: ToolCallId): BoundedTextState | undefined;
10
- version?(toolCallId: ToolCallId): number;
12
+ version?(toolCallId: ToolCallId): number | string;
13
+ notice?(toolCallId: ToolCallId): string | undefined;
14
+ fileChange?(change: FileChange): FileChange;
15
+ fileChangeNotice?(change: FileChange): string | undefined;
11
16
  }
12
17
  export declare const EMPTY_SPOOL: SpoolReader;
13
18
  export interface BlockContext {
@@ -18,6 +23,8 @@ export interface BlockContext {
18
23
  readonly state: TranscriptState;
19
24
  readonly spool: SpoolReader;
20
25
  readonly markdownCache: MarkdownStreamCache | undefined;
26
+ readonly disclosures?: BlockDisclosure[];
27
+ readonly lineOffset?: number;
21
28
  }
22
29
  export declare const SUFFIX_MIN_COLUMNS = 44;
23
30
  export declare const COLLAPSED_LINE_ROWS = 4;
@@ -1 +1 @@
1
- {"version":3,"file":"block-context.js","sourceRoot":"","sources":["../../../src/classic/blocks/block-context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG/G,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQxD,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE;IACd,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;CACvB,CAAC;AAYF,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AACrC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AACrC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAA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} from "../../ui-core/state/transcript-types.js";
2
2
  import { type BlockContext } from "./block-context.js";
3
- export declare const COMPACTED_PREVIEW_ROWS = 4;
4
3
  export declare function buildCompactedLines(ctx: BlockContext, item: CompactedItem): string[];
@@ -1,56 +1,24 @@
1
1
  import { sanitizeDisplayText } from "../../ui-core/rendering/sanitize-display.js";
2
2
  import { compactionElapsedLabel } from "../../ui-core/rendering/duration.js";
3
3
  import { liveCompactionHeadTail } from "../../ui-core/rendering/thinking-tail.js";
4
- import { compactionTokenLabel, isItemExpanded, } from "../../ui-core/state/transcript-types.js";
5
- import { trimTrailingSpaces } from "../render/ansi-text.js";
4
+ import { compactionTokenLabel, isItemExpanded } from "../../ui-core/state/transcript-types.js";
6
5
  import { wrapWithPrefixes } from "../render/wrap.js";
7
6
  import { joinMeta } from "./block-context.js";
8
- import { hintRows, outputToggleLabel } from "./tool-lines.js";
9
- export const COMPACTED_PREVIEW_ROWS = 4;
10
- const BODY_INDENT = 4;
7
+ import { appendDisclosure } from "./disclosure-lines.js";
8
+ import { logicalOutputLines, outputBodyRows, OUTPUT_PREVIEW_LINES } from "./output-lines.js";
11
9
  export function buildCompactedLines(ctx, item) {
12
10
  const expanded = isItemExpanded(ctx.state, item);
13
11
  const label = compactionTokenLabel(item);
14
12
  const elapsed = compactionElapsedLabel(item, ctx.now);
15
- const glyph = ctx.ink.fg("cyan", ctx.glyphs.compacted);
16
- const head = joinMeta(ctx, [
17
- item.error ? "Compaction failed" : "Compacted context",
18
- elapsed,
19
- label === "" ? undefined : label,
20
- ]);
21
- const headRows = wrapWithPrefixes(head, { width: Math.max(1, ctx.width - 2) });
22
- const lines = headRows.map((row, index) => trimTrailingSpaces(`${index === 0 ? `${glyph} ` : " "}${ctx.ink.fg(item.error ? "activity" : "cyan", row)}`));
23
- const indent = " ".repeat(BODY_INDENT);
24
- if (item.error) {
25
- const branch = ctx.ink.fg("muted", ` ${ctx.glyphs.bodyBranch} `);
26
- const indent = " ".repeat(BODY_INDENT);
27
- const errorRows = wrapWithPrefixes(sanitizeDisplayText(item.error), {
28
- width: Math.max(1, ctx.width - BODY_INDENT),
29
- });
30
- for (const [index, row] of errorRows.entries()) {
31
- lines.push(trimTrailingSpaces(`${index === 0 ? branch : indent}${ctx.ink.fg("activity", row)}`));
32
- }
33
- lines.push(...hintRows(ctx, indent, outputToggleLabel(expanded)));
34
- return lines;
35
- }
36
- const summary = sanitizeDisplayText(item.streaming ? liveCompactionHeadTail(item.summary) : item.summary).trim();
37
- if (summary === "") {
38
- lines.push(...hintRows(ctx, indent, outputToggleLabel(expanded)));
39
- return lines;
40
- }
41
- const budget = Math.max(1, ctx.width - BODY_INDENT);
42
- const rows = wrapWithPrefixes(summary, { width: budget });
43
- const cap = expanded ? rows.length : COMPACTED_PREVIEW_ROWS;
44
- const shown = rows.slice(0, cap);
45
- const branch = ctx.ink.fg("hint", ` ${ctx.glyphs.bodyBranch} `);
46
- for (const [index, row] of shown.entries()) {
47
- lines.push(trimTrailingSpaces(`${index === 0 ? branch : indent}${ctx.ink.fg("muted", row)}`));
48
- }
49
- const footer = joinMeta(ctx, [
50
- outputToggleLabel(expanded),
51
- rows.length > shown.length ? `${ctx.glyphs.ellipsis} full memory` : undefined,
52
- ]);
53
- lines.push(...hintRows(ctx, indent, footer));
13
+ const token = item.error ? "activity" : "cyan";
14
+ const mark = ctx.ink.unicode ? "•" : "*";
15
+ const head = joinMeta(ctx, [item.error ? "Compaction failed" : "Compacted context", elapsed, label || undefined]);
16
+ const lines = wrapWithPrefixes(head, { width: ctx.width, firstPrefix: `${mark} `, nextPrefix: " " })
17
+ .map((row) => ctx.ink.fg(token, row));
18
+ const summary = item.error ?? (item.streaming && !expanded ? liveCompactionHeadTail(item.summary) : item.summary);
19
+ const source = logicalOutputLines(sanitizeDisplayText(summary));
20
+ lines.push(...outputBodyRows(ctx, source, expanded, { token: item.error ? "activity" : "muted" }));
21
+ appendDisclosure(ctx, lines, expanded, { hidden: Math.max(0, source.length - OUTPUT_PREVIEW_LINES) });
54
22
  return lines;
55
23
  }
56
24
  //# sourceMappingURL=compacted-lines.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compacted-lines.js","sourceRoot":"","sources":["../../../src/classic/blocks/compacted-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EACL,oBAAoB,EACpB,cAAc,GAEf,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAqB,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,UAAU,mBAAmB,CAAC,GAAiB,EAAE,IAAmB;IACxE,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,sBAAsB,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,EAAE;QACzB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB;QACtD,OAAO;QACP,KAAK,KAAK,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,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACnG,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,oBAAoB,CAAC,EAAE,CAAC,CAAC;IACtG,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,12 +1,10 @@
1
1
  import type { FileChange } from "../../tools/file-diff.js";
2
2
  import { type ToolItem } from "../../ui-core/state/transcript-types.js";
3
3
  import { type BlockContext } from "./block-context.js";
4
- export declare const SINGLE_FILE_PREVIEW_ROWS = 40;
5
- export declare const WRITE_MANY_PREVIEW_ROWS = 8;
4
+ export declare const DIFF_PREVIEW_LINES = 3;
6
5
  export declare const WRITE_MANY_LISTED_FILES = 12;
7
- export declare const DIFF_INDENT = 2;
6
+ export declare const DIFF_INDENT = 4;
8
7
  export declare const DIFF_TAB_WIDTH = 4;
9
- export declare function diffStatsSuffix(ctx: BlockContext, change: FileChange): string;
8
+ export declare function diffStatsSuffix(ctx: BlockContext, change: Pick<FileChange, "stats">): string;
10
9
  export declare function diffTitleLine(ctx: BlockContext, item: ToolItem, change: FileChange | undefined): string;
11
- export declare function diffStatsRow(ctx: BlockContext, change: FileChange): string | undefined;
12
10
  export declare function buildDiffLines(ctx: BlockContext, item: ToolItem): string[];
@@ -1,171 +1,132 @@
1
- import { collapsedFileChangeLabel, gutterWidth, presentFileChangePreview, relativeDisplayPath, syntaxColor, } from "../../ui-core/rendering/file-diff-view.js";
2
- import { presentTool } from "../../ui-core/rendering/tool-presenter.js";
3
- import { isFileDiffExpanded, isItemExpanded, } from "../../ui-core/state/transcript-types.js";
4
- import { alignEnds, clipToWidth, sealStyle, trimTrailingSpaces } from "../render/ansi-text.js";
5
- import { clipRow, SUFFIX_MIN_COLUMNS } from "./block-context.js";
6
- import { hintRows, outputToggleLabel, toolGlyph } from "./tool-lines.js";
7
- export const SINGLE_FILE_PREVIEW_ROWS = 40;
8
- export const WRITE_MANY_PREVIEW_ROWS = 8;
1
+ import { buildModalLines, changeVerb } from "../../tools/file-diff.js";
2
+ import { relativeDisplayPath, syntaxColor } from "../../ui-core/rendering/file-diff-view.js";
3
+ import { emptyCarry, highlightLineForPath } from "../../ui-core/rendering/syntax-highlight.js";
4
+ import { sanitizeDisplayText } from "../../ui-core/rendering/sanitize-display.js";
5
+ import { isFileDiffExpanded, isItemExpanded } from "../../ui-core/state/transcript-types.js";
6
+ import { clipToWidth, expandTabs, sealStyle, trimTrailingSpaces } from "../render/ansi-text.js";
7
+ import { layoutWidth } from "../render/measure.js";
8
+ import { wrapAnsiLine } from "../render/wrap.js";
9
+ import { clipRow } from "./block-context.js";
10
+ import { appendDisclosure } from "./disclosure-lines.js";
11
+ import { buildToolBodyLines, hintRows, toolGlyph, TOOL_STATUS_TOKEN } from "./tool-lines.js";
12
+ export const DIFF_PREVIEW_LINES = 3;
9
13
  export const WRITE_MANY_LISTED_FILES = 12;
10
- export const DIFF_INDENT = 2;
14
+ export const DIFF_INDENT = 4;
11
15
  export const DIFF_TAB_WIDTH = 4;
12
- const GUTTER_RULE_WIDTH = 3;
13
- const CLICK_HINT = " · click for full";
14
- const STATUS_TOKEN = {
15
- queued: "muted",
16
- running: "activity",
17
- ok: "success",
18
- failed: "diffDel",
19
- blocked: "activity",
20
- };
21
- function changeMark(ctx, kind) {
22
- if (kind === "create")
23
- return { mark: "+", token: "success" };
24
- if (kind === "overwrite")
25
- return { mark: "~", token: "activity" };
26
- return { mark: ctx.glyphs.separator, token: "toolOutput" };
27
- }
28
- function washToken(tone) {
29
- if (tone === "add")
30
- return "diffAddBg";
31
- if (tone === "del")
32
- return "diffDelBg";
33
- return undefined;
34
- }
35
- function syntaxCode(ctx, row) {
36
- if (ctx.ink.colorMode === "none")
37
- return row.displayText;
38
- let out = "";
39
- for (const span of row.spans)
40
- out += ctx.ink.hex(syntaxColor(span.kind, ctx.ink.theme), span.text);
41
- return out;
42
- }
43
- function mutedCode(ctx, text) {
44
- return ctx.ink.style(text, { fg: "muted", dim: true });
45
- }
46
- function gutterCell(ctx, row) {
47
- const rail = row.tone === "add" ? "diffAdd" : row.tone === "del" ? "diffDel" : "diffGutter";
48
- return `${ctx.ink.fg("diffGutter", `${row.gutter} `)}${ctx.ink.fg(rail, `${ctx.glyphs.boxVertical} `)}`;
49
- }
50
- function quietText(row) {
51
- return row.tone === "gap" ? row.displayText.replace(CLICK_HINT, "") : row.displayText;
52
- }
53
- function washedRow(ctx, row, rowWidth) {
54
- const gutter = gutterCell(ctx, row);
55
- const line = clipToWidth(`${gutter}${markedBody(ctx, row)}`, rowWidth, ctx.glyphs.ellipsis);
56
- const wash = washToken(row.tone);
57
- return wash ? ctx.ink.band(line, rowWidth, { bg: wash }) : line;
58
- }
59
- function markedRow(ctx, row, rowWidth) {
60
- const gutter = gutterCell(ctx, row);
61
- return clipToWidth(`${gutter}${markedBody(ctx, row)}`, rowWidth, ctx.glyphs.ellipsis);
62
- }
63
- function markedBody(ctx, row) {
64
- if (row.tone === "context")
65
- return ` ${syntaxCode(ctx, row)}`;
66
- if (row.tone !== "add" && row.tone !== "del")
67
- return ` ${mutedCode(ctx, quietText(row))}`;
68
- const marker = row.prefix === "−" ? "-" : row.prefix;
69
- const token = row.tone === "add" ? "diffAdd" : "diffDel";
70
- return `${ctx.ink.style(marker, { fg: token, bold: true })} ${syntaxCode(ctx, row)}`;
71
- }
72
- function diffRowLine(ctx, row) {
73
- const rowWidth = Math.max(1, ctx.width - DIFF_INDENT);
74
- const body = ctx.ink.washColor ? washedRow(ctx, row, rowWidth) : markedRow(ctx, row, rowWidth);
75
- return trimTrailingSpaces(sealStyle(`${" ".repeat(DIFF_INDENT)}${body}`));
76
- }
77
- function codeBudget(ctx, change) {
78
- const marker = 2;
79
- return Math.max(8, ctx.width - DIFF_INDENT - gutterWidth(change) - GUTTER_RULE_WIDTH - marker);
16
+ function verb(item, change) {
17
+ const kind = change?.kind ?? "edit";
18
+ const status = item.status === "failed" || item.status === "blocked" ? "failed" : item.status === "ok" ? "ok" : "running";
19
+ if (kind === "create" && status !== "failed")
20
+ return status === "ok" ? "Added" : "Adding";
21
+ if (kind === "overwrite" || kind === "append")
22
+ return status === "ok" ? "Edited" : changeVerb(kind, status);
23
+ return changeVerb(kind, status);
80
24
  }
81
25
  export function diffStatsSuffix(ctx, change) {
82
- const minus = ctx.ink.unicode ? "−" : "-";
83
26
  const added = ctx.ink.style(`+${change.stats.added}`, { fg: "success", bold: true });
84
- const removed = ctx.ink.style(`${minus}${change.stats.removed}`, { fg: "diffDel", bold: true });
85
- return `${added} ${removed}`;
27
+ const removed = ctx.ink.style(`-${change.stats.removed}`, { fg: "diffDel", bold: true });
28
+ return `(${added} ${removed})`;
86
29
  }
87
- function totalStats(changes) {
30
+ export function diffTitleLine(ctx, item, change) {
31
+ const changes = item.fileChanges ?? [];
32
+ const token = TOOL_STATUS_TOKEN[item.status];
33
+ const title = ctx.ink.style(verb(item, changes[0] ?? change), { fg: token, bold: true });
34
+ const path = changes.length > 1 ? `${changes.length} files` : relativeDisplayPath(change?.path ?? item.argsDisplay);
35
+ const label = ctx.ink.fg("inputBorder", sanitizeDisplayText(path));
36
+ const suffix = change ? ` ${diffStatsSuffix(ctx, change)}` : "";
37
+ const head = `${ctx.ink.fg(token, toolGlyph(ctx, item.status))} ${title} ${label}`;
38
+ const budget = Math.max(1, ctx.width - layoutWidth(suffix));
39
+ return clipRow(ctx, `${clipToWidth(head, budget, ctx.glyphs.ellipsis)}${suffix}`);
40
+ }
41
+ function carrier(changes) {
88
42
  if (changes.length === 0)
89
43
  return undefined;
90
- if (changes.length === 1)
91
- return changes[0].stats;
92
- let added = 0;
93
- let removed = 0;
94
- for (const change of changes) {
95
- added += change.stats.added;
96
- removed += change.stats.removed;
44
+ const added = changes.reduce((sum, change) => sum + change.stats.added, 0);
45
+ const removed = changes.reduce((sum, change) => sum + change.stats.removed, 0);
46
+ return { ...changes[0], stats: { ...changes[0].stats, added, removed } };
47
+ }
48
+ function sourceLines(change, expanded) {
49
+ if (expanded && change.afterText !== undefined && change.truncated) {
50
+ const allAdded = change.stats.added === change.stats.newLines;
51
+ return buildModalLines(change).map((line) => ({
52
+ op: allAdded && line.op === "context" ? "add" : line.op,
53
+ text: line.text, oldLine: line.oldLineNo, newLine: line.lineNo,
54
+ }));
97
55
  }
98
- return { ...changes[0].stats, added, removed };
99
- }
100
- function statsCarrier(changes) {
101
- const stats = totalStats(changes);
102
- return stats ? { ...changes[0], stats } : undefined;
103
- }
104
- export function diffTitleLine(ctx, item, change) {
105
- const presented = presentTool(item);
106
- const glyph = ctx.ink.fg(STATUS_TOKEN[item.status], toolGlyph(ctx, item.status));
107
- const title = ctx.ink.style(presented.name, { fg: "cyan", bold: true });
108
- const suffix = change && ctx.width + 2 >= SUFFIX_MIN_COLUMNS ? diffStatsSuffix(ctx, change) : "";
109
- return alignEnds(`${glyph} ${title}`, suffix, ctx.width, ctx.glyphs.ellipsis);
56
+ return change.previewHunks.flatMap((hunk) => hunk.lines);
57
+ }
58
+ function codeText(ctx, spans) {
59
+ return spans.map((span) => ctx.ink.hex(syntaxColor(span.kind, ctx.ink.theme), span.text)).join("");
60
+ }
61
+ function diffRows(ctx, change, expanded) {
62
+ if (change.binary)
63
+ return [clipRow(ctx, " (binary file)")];
64
+ const source = sourceLines(change, expanded);
65
+ if (source.length === 0)
66
+ return [clipRow(ctx, " (no line changes)")];
67
+ const width = String(Math.max(change.stats.oldLines, change.stats.newLines, 1)).length;
68
+ const carry = emptyCarry();
69
+ const rows = [];
70
+ const shown = expanded ? source : source.slice(0, DIFF_PREVIEW_LINES);
71
+ for (const line of shown) {
72
+ const number = line.op === "del" ? line.oldLine : line.newLine ?? line.oldLine;
73
+ const gutter = number === undefined ? " ".repeat(width) : String(number).padStart(width, " ");
74
+ const marker = line.op === "add" ? "+" : line.op === "del" ? "-" : " ";
75
+ const token = line.op === "add" ? "diffAdd" : line.op === "del" ? "diffDel" : "diffGutter";
76
+ const text = expandTabs(sanitizeDisplayText(line.text), DIFF_TAB_WIDTH);
77
+ const spans = highlightLineForPath(text, change.path, carry);
78
+ const code = codeText(ctx, spans);
79
+ const codeWidth = Math.max(1, ctx.width - DIFF_INDENT - width - 3);
80
+ const chunks = expanded ? wrapAnsiLine(code, codeWidth) : [clipToWidth(code, codeWidth, ctx.glyphs.ellipsis)];
81
+ for (const [index, chunk] of chunks.entries()) {
82
+ const prefix = index === 0 ? `${gutter} ${marker} ` : " ".repeat(width + 3);
83
+ const body = `${" ".repeat(DIFF_INDENT)}${ctx.ink.fg(token, prefix)}${chunk}`;
84
+ const wash = line.op === "add" ? "diffAddBg" : line.op === "del" ? "diffDelBg" : undefined;
85
+ rows.push(trimTrailingSpaces(sealStyle(ctx.ink.washColor && wash ? ctx.ink.band(body, ctx.width, { bg: wash }) : body)));
86
+ }
87
+ }
88
+ return rows;
110
89
  }
111
- export function diffStatsRow(ctx, change) {
112
- if (ctx.width + 2 >= SUFFIX_MIN_COLUMNS)
90
+ function diffNotice(ctx, change) {
91
+ if (!change.truncated || change.binary)
113
92
  return undefined;
114
- return clipRow(ctx, ` ${diffStatsSuffix(ctx, change)}`);
115
- }
116
- function fileRow(ctx, change) {
117
- const { mark, token } = changeMark(ctx, change.kind);
118
- const path = ctx.ink.fg("inputBorder", relativeDisplayPath(change.path));
119
- return clipRow(ctx, ` ${ctx.ink.fg(token, mark)} ${path}`);
120
- }
121
- function labelRow(ctx, change) {
122
- return clipRow(ctx, ` ${ctx.ink.style(collapsedFileChangeLabel(change), { fg: "foreground", bold: true })}`);
123
- }
124
- function moreFilesRow(ctx, hidden) {
125
- return clipRow(ctx, ` ${ctx.ink.fg("muted", `${ctx.glyphs.ellipsis} +${hidden} more file${hidden === 1 ? "" : "s"}`)}`);
93
+ if (change.afterText === undefined) {
94
+ return ctx.spool.fileChangeNotice?.(change) ?? "Full diff unavailable · retained preview shown";
95
+ }
96
+ const removed = change.deletedAt.reduce((count, segment) => count + segment.lines.length, 0);
97
+ const missingMarkers = change.stats.added > change.addedNewLines.length && change.stats.added !== change.stats.newLines;
98
+ if (removed < change.stats.removed || missingMarkers)
99
+ return "Some diff details were not retained · full file shown";
100
+ return undefined;
126
101
  }
127
102
  export function buildDiffLines(ctx, item) {
128
- const changes = item.fileChanges ?? [];
129
- const primary = changes[0];
130
- const multi = changes.length > 1;
131
- const diffExpanded = isFileDiffExpanded(ctx.state, item.id);
132
- const outputExpanded = isItemExpanded(ctx.state, item);
133
- const carrier = multi ? statsCarrier(changes) : primary;
134
- const lines = [diffTitleLine(ctx, item, carrier)];
135
- if (carrier) {
136
- const statsRow = diffStatsRow(ctx, carrier);
137
- if (statsRow)
138
- lines.push(statsRow);
139
- }
140
- const listed = multi ? changes.slice(0, WRITE_MANY_LISTED_FILES) : changes;
141
- const hiddenFiles = changes.length - listed.length;
142
- if (!diffExpanded) {
143
- if (primary && !multi)
144
- lines.push(labelRow(ctx, primary));
145
- if (multi) {
146
- for (const change of listed)
147
- lines.push(fileRow(ctx, change));
148
- if (hiddenFiles > 0)
149
- lines.push(moreFilesRow(ctx, hiddenFiles));
103
+ const changes = (item.fileChanges ?? []).map((change) => ctx.spool.fileChange?.(change) ?? change);
104
+ const expanded = isItemExpanded(ctx.state, item);
105
+ const showDiff = isFileDiffExpanded(ctx.state, item.id);
106
+ const lines = [diffTitleLine(ctx, item, carrier(changes))];
107
+ if (changes.length === 0)
108
+ return [...lines, ...buildToolBodyLines({ ...ctx, lineOffset: lines.length }, item)];
109
+ const listed = expanded ? changes : changes.slice(0, WRITE_MANY_LISTED_FILES);
110
+ for (const [index, change] of listed.entries()) {
111
+ if (changes.length > 1) {
112
+ if (index > 0)
113
+ lines.push("");
114
+ const path = ctx.ink.fg("inputBorder", sanitizeDisplayText(relativeDisplayPath(change.path)));
115
+ lines.push(clipRow(ctx, ` ${ctx.glyphs.bodyBranch} ${path} ${diffStatsSuffix(ctx, change)}`));
150
116
  }
151
- lines.push(...hintRows(ctx, " ", outputToggleLabel(outputExpanded)));
152
- return lines;
117
+ if (showDiff || expanded)
118
+ lines.push(...diffRows(ctx, change, expanded));
119
+ const notice = expanded ? diffNotice(ctx, change) : undefined;
120
+ if (notice)
121
+ lines.push(...hintRows(ctx, " ", notice));
153
122
  }
154
- const maxRows = multi ? WRITE_MANY_PREVIEW_ROWS : SINGLE_FILE_PREVIEW_ROWS;
155
- for (const change of listed) {
156
- if (multi)
157
- lines.push(fileRow(ctx, change));
158
- const rows = presentFileChangePreview(change, {
159
- maxLineChars: codeBudget(ctx, change),
160
- maxRows,
161
- tabWidth: DIFF_TAB_WIDTH,
162
- });
163
- for (const row of rows)
164
- lines.push(diffRowLine(ctx, row));
123
+ if (changes.length > listed.length)
124
+ lines.push(clipRow(ctx, ` ${ctx.ink.fg("hint", `${changes.length - listed.length} more files`)}`));
125
+ if (item.status === "failed" || item.status === "blocked") {
126
+ return [...lines, ...buildToolBodyLines({ ...ctx, lineOffset: lines.length }, item)];
165
127
  }
166
- if (hiddenFiles > 0)
167
- lines.push(moreFilesRow(ctx, hiddenFiles));
168
- lines.push(...hintRows(ctx, " ", outputToggleLabel(outputExpanded)));
128
+ const hidden = changes.reduce((sum, change) => sum + Math.max(0, sourceLines(change, false).length - DIFF_PREVIEW_LINES), 0);
129
+ appendDisclosure(ctx, lines, expanded, { hidden });
169
130
  return lines;
170
131
  }
171
132
  //# sourceMappingURL=diff-lines.js.map