@adecore/agents-react 0.53.3 → 0.54.1

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 (358) hide show
  1. package/dist/agents/AgentIcon.js +1 -1
  2. package/dist/agents/AgentModelLabel.js +1 -1
  3. package/dist/agents/accounts.js +1 -1
  4. package/dist/chat/attachments.js +1 -1
  5. package/dist/chat/forks.js +1 -1
  6. package/dist/chat/logic/limit.js +1 -1
  7. package/dist/chat/logic/scrubber.js +1 -1
  8. package/dist/chat/logic/selection-switch.d.ts +6 -0
  9. package/dist/chat/logic/selection-switch.js +42 -0
  10. package/dist/chat/logic/timeline-target.d.ts +1 -1
  11. package/dist/chat/logic/timeline.d.ts +6 -1
  12. package/dist/chat/logic/timeline.js +16 -2
  13. package/dist/chat/logic/tool-looks.js +1 -1
  14. package/dist/chat/logic/tools.js +1 -1
  15. package/dist/chat/logic/workflow.js +1 -1
  16. package/dist/chat/preferences.js +1 -1
  17. package/dist/chat/runtime-modes.js +1 -1
  18. package/dist/chat/send-key.js +1 -1
  19. package/dist/chat/stash.js +2 -2
  20. package/dist/chat/subagent-list.js +1 -1
  21. package/dist/chat/ui/AccountPill.js +3 -3
  22. package/dist/chat/ui/BookmarkMarker.js +6 -6
  23. package/dist/chat/ui/BookmarkSubmenu.js +5 -5
  24. package/dist/chat/ui/ChatActivity.js +15 -14
  25. package/dist/chat/ui/CodeBlock.js +9 -7
  26. package/dist/chat/ui/Composer.js +13 -13
  27. package/dist/chat/ui/ComposerInput.d.ts +1 -1
  28. package/dist/chat/ui/ComposerInput.js +35 -18
  29. package/dist/chat/ui/DiffPool.js +1 -1
  30. package/dist/chat/ui/EditDiff.js +2 -2
  31. package/dist/chat/ui/GoalDock.js +5 -5
  32. package/dist/chat/ui/ImageView.js +4 -4
  33. package/dist/chat/ui/LimitState.js +12 -12
  34. package/dist/chat/ui/Markdown.d.ts +1 -1
  35. package/dist/chat/ui/Markdown.js +11 -10
  36. package/dist/chat/ui/MermaidBlock.js +7 -6
  37. package/dist/chat/ui/MessageActions.js +7 -7
  38. package/dist/chat/ui/ModelMarks.js +2 -2
  39. package/dist/chat/ui/Pickers.d.ts +1 -1
  40. package/dist/chat/ui/Pickers.js +32 -27
  41. package/dist/chat/ui/PromptComposer.d.ts +1 -1
  42. package/dist/chat/ui/PromptComposer.js +5 -5
  43. package/dist/chat/ui/PromptEditor.js +3 -3
  44. package/dist/chat/ui/QuoteButton.js +2 -2
  45. package/dist/chat/ui/ReferenceChip.js +3 -3
  46. package/dist/chat/ui/ReferenceTrail.js +2 -2
  47. package/dist/chat/ui/ResumeCompactionDock.js +3 -3
  48. package/dist/chat/ui/RunSettings.js +11 -11
  49. package/dist/chat/ui/Scrubber.js +4 -4
  50. package/dist/chat/ui/SessionLine.js +2 -2
  51. package/dist/chat/ui/ShellCommand.d.ts +1 -1
  52. package/dist/chat/ui/ShellCommand.js +2 -2
  53. package/dist/chat/ui/SubagentControls.js +3 -3
  54. package/dist/chat/ui/SubagentInfo.js +5 -5
  55. package/dist/chat/ui/SubagentStopButton.js +2 -2
  56. package/dist/chat/ui/SubagentTimeline.js +18 -16
  57. package/dist/chat/ui/Timeline.js +231 -145
  58. package/dist/chat/ui/TimelineMenu.js +7 -7
  59. package/dist/chat/ui/UnifiedDiff.js +2 -2
  60. package/dist/chat/ui/VisualDialogs.js +1 -1
  61. package/dist/chat/ui/VisualFrame.js +4 -4
  62. package/dist/chat/ui/WorkflowAgentLine.d.ts +1 -1
  63. package/dist/chat/ui/WorkflowAgentLine.js +3 -3
  64. package/dist/chat/ui/chip-clipboard.d.ts +1 -1
  65. package/dist/chat/ui/composer/ComposerControls.d.ts +1 -1
  66. package/dist/chat/ui/composer/ComposerControls.js +4 -4
  67. package/dist/chat/ui/composer/ComposerMenu.js +5 -4
  68. package/dist/chat/ui/composer/DraftParts.js +2 -2
  69. package/dist/chat/ui/composer/QueuedMessages.js +2 -2
  70. package/dist/chat/ui/composer/chip-paste.d.ts +1 -1
  71. package/dist/chat/ui/composer/chips.d.ts +1 -1
  72. package/dist/chat/ui/composer/chips.js +2 -2
  73. package/dist/chat/ui/composer/key-handler.js +1 -1
  74. package/dist/chat/ui/composer/placeholder.js +1 -1
  75. package/dist/chat/ui/composer/use-composer-menus.d.ts +1 -1
  76. package/dist/chat/ui/composer/use-composer-menus.js +1 -1
  77. package/dist/chat/ui/composer/use-composer-submit.d.ts +1 -1
  78. package/dist/chat/ui/composer/use-draft-files.d.ts +2 -2
  79. package/dist/chat/ui/composer/use-draft-files.js +1 -1
  80. package/dist/chat/ui/composer/use-effort-stepper.js +1 -1
  81. package/dist/chat/ui/composer/use-prompt-menus.d.ts +2 -2
  82. package/dist/chat/ui/composer/use-prompt-menus.js +1 -1
  83. package/dist/chat/ui/diff/ApprovalReview.js +2 -2
  84. package/dist/chat/ui/diff/DiffOmitted.js +1 -1
  85. package/dist/chat/ui/diff/DiffStack.js +2 -2
  86. package/dist/chat/ui/diff/EditorEditDiff.d.ts +1 -1
  87. package/dist/chat/ui/diff/EditorEditDiff.js +5 -5
  88. package/dist/chat/ui/diff/EditorPatchDiff.d.ts +1 -1
  89. package/dist/chat/ui/diff/EditorPatchDiff.js +1 -1
  90. package/dist/chat/ui/diff/LegacyEditDiff.js +47 -31
  91. package/dist/chat/ui/diff/LegacyUnifiedDiff.js +93 -69
  92. package/dist/chat/ui/diff/RawDiff.js +54 -35
  93. package/dist/chat/ui/diff/syntax-runtime.d.ts +1 -1
  94. package/dist/chat/ui/highlighter.d.ts +1 -1
  95. package/dist/chat/ui/highlighter.js +1 -1
  96. package/dist/chat/ui/icons.js +1 -1
  97. package/dist/chat/ui/intelligent-ui/UiBlockFrame.d.ts +1 -1
  98. package/dist/chat/ui/intelligent-ui/UiBlockFrame.js +4 -4
  99. package/dist/chat/ui/intelligent-ui/UiFallbackPart.js +2 -2
  100. package/dist/chat/ui/intelligent-ui/UiReply.d.ts +2 -2
  101. package/dist/chat/ui/intelligent-ui/UiReply.js +8 -8
  102. package/dist/chat/ui/intelligent-ui/node-text.d.ts +1 -1
  103. package/dist/chat/ui/intelligent-ui/render-context.d.ts +1 -1
  104. package/dist/chat/ui/intelligent-ui/renderers/chart.js +28 -15
  105. package/dist/chat/ui/intelligent-ui/renderers/choices.js +4 -4
  106. package/dist/chat/ui/intelligent-ui/renderers/content.js +6 -6
  107. package/dist/chat/ui/intelligent-ui/renderers/data.js +104 -87
  108. package/dist/chat/ui/intelligent-ui/renderers/inputs.js +3 -3
  109. package/dist/chat/ui/intelligent-ui/renderers/links.js +2 -2
  110. package/dist/chat/ui/intelligent-ui/renderers/map-view.js +4 -4
  111. package/dist/chat/ui/intelligent-ui/renderers/map.js +3 -3
  112. package/dist/chat/ui/intelligent-ui/renderers/structure.js +2 -2
  113. package/dist/chat/ui/intelligent-ui/renderers/text.js +5 -5
  114. package/dist/chat/ui/intelligent-ui/tones.d.ts +1 -1
  115. package/dist/chat/ui/intelligent-ui/use-ui-links.d.ts +1 -1
  116. package/dist/chat/ui/intelligent-ui/use-ui-links.js +2 -2
  117. package/dist/chat/ui/intelligent-ui/use-ui-queries.js +1 -1
  118. package/dist/chat/ui/reference-icons.d.ts +1 -1
  119. package/dist/chat/ui/reference-icons.js +2 -2
  120. package/dist/chat/ui/reply-context.d.ts +1 -1
  121. package/dist/chat/ui/rows/ForksRow.js +3 -3
  122. package/dist/chat/ui/rows/GeneratedImageRow.js +5 -5
  123. package/dist/chat/ui/rows/MessageRows.d.ts +6 -1
  124. package/dist/chat/ui/rows/MessageRows.js +151 -22
  125. package/dist/chat/ui/rows/Rows.js +39 -21
  126. package/dist/chat/ui/rows/SubagentRow.js +16 -16
  127. package/dist/chat/ui/rows/TaskRow.js +3 -3
  128. package/dist/chat/ui/rows/VisualRow.js +2 -2
  129. package/dist/chat/ui/rows/WorkRows.d.ts +2 -2
  130. package/dist/chat/ui/rows/WorkRows.js +37 -25
  131. package/dist/chat/ui/rows/WorkflowRow.js +8 -8
  132. package/dist/chat/ui/use-diff-source-tokens.js +1 -1
  133. package/dist/chat/ui/visual-theme.d.ts +1 -1
  134. package/dist/chat/ui/visual-theme.js +2 -2
  135. package/dist/chat/workflow-list.js +1 -1
  136. package/dist/host.d.ts +4 -4
  137. package/dist/host.js +1 -1
  138. package/dist/lazy.js +1 -1
  139. package/dist/locales/en/agent-chat.d.ts +4 -0
  140. package/dist/locales/en/agent-chat.js +4 -0
  141. package/dist/locales/nl/agent-chat.d.ts +4 -0
  142. package/dist/locales/nl/agent-chat.js +4 -0
  143. package/dist/port-transport.js +1 -1
  144. package/dist/prompts/logic/subjects.d.ts +1 -1
  145. package/dist/prompts/ui/ApprovalBody.js +16 -7
  146. package/dist/prompts/ui/PromptActions.js +2 -2
  147. package/dist/prompts/ui/PromptCard.js +5 -4
  148. package/dist/prompts/ui/PromptView.js +1 -1
  149. package/dist/prompts/ui/QuestionBody.js +4 -4
  150. package/dist/providers/AccountDetail.js +4 -4
  151. package/dist/providers/AccountOrderList.js +2 -2
  152. package/dist/providers/AccountVariables.js +3 -3
  153. package/dist/providers/AddAccountForm.js +6 -6
  154. package/dist/providers/CliDetail.js +8 -8
  155. package/dist/providers/InstallPage.js +3 -3
  156. package/dist/providers/ProviderList.js +2 -2
  157. package/dist/providers/ProvidersPane.d.ts +1 -1
  158. package/dist/providers/ProvidersPane.js +5 -5
  159. package/dist/providers/install-steps.d.ts +1 -1
  160. package/dist/settings/sections.d.ts +2 -2
  161. package/dist/state/chats.js +1 -1
  162. package/dist/state/usage.js +2 -2
  163. package/dist/theme.css +4 -4
  164. package/dist/transport.d.ts +1 -1
  165. package/dist/usage/LimitsList.js +4 -4
  166. package/dist/usage/UsageBreakdown.js +5 -5
  167. package/dist/usage/UsageChart.js +1 -1
  168. package/dist/usage/UsageDialog.js +1 -1
  169. package/dist/usage/UsageLimits.js +6 -6
  170. package/dist/usage/UsageLimitsCard.js +2 -2
  171. package/dist/usage/UsagePage.js +202 -191
  172. package/dist/usage/UsagePane.js +4 -3
  173. package/dist/usage/UsageSummary.js +1 -1
  174. package/dist/usage/UsageTiles.js +1 -1
  175. package/dist/usage/format.d.ts +1 -0
  176. package/dist/usage/format.js +5 -0
  177. package/dist/usage/limit-groups.js +2 -2
  178. package/dist/usage/summary.js +1 -1
  179. package/package.json +9 -8
  180. package/src/agents/AgentIcon.tsx +1 -1
  181. package/src/agents/AgentModelLabel.tsx +2 -2
  182. package/src/agents/ProviderLogo.tsx +1 -1
  183. package/src/agents/accounts.ts +1 -1
  184. package/src/agents/option-words.ts +1 -1
  185. package/src/chat/attachments.ts +1 -1
  186. package/src/chat/bookmarks.ts +1 -1
  187. package/src/chat/drafts.ts +1 -1
  188. package/src/chat/forks.ts +1 -1
  189. package/src/chat/logic/fork.ts +1 -1
  190. package/src/chat/logic/limit.ts +1 -1
  191. package/src/chat/logic/scrubber.ts +1 -1
  192. package/src/chat/logic/selection-switch.ts +47 -0
  193. package/src/chat/logic/timeline-copy.ts +1 -1
  194. package/src/chat/logic/timeline-target.ts +1 -1
  195. package/src/chat/logic/timeline.ts +28 -4
  196. package/src/chat/logic/tool-looks.ts +1 -1
  197. package/src/chat/logic/tools.ts +1 -1
  198. package/src/chat/logic/workflow.ts +1 -1
  199. package/src/chat/pending-prompts.ts +1 -1
  200. package/src/chat/preferences.ts +1 -1
  201. package/src/chat/reading-width.ts +1 -1
  202. package/src/chat/runtime-modes.ts +1 -1
  203. package/src/chat/send-key.ts +1 -1
  204. package/src/chat/stash.ts +2 -2
  205. package/src/chat/subagent-conversation.ts +1 -1
  206. package/src/chat/subagent-list.ts +1 -1
  207. package/src/chat/subagent-view.ts +1 -1
  208. package/src/chat/thumbnails.ts +1 -1
  209. package/src/chat/ui/AccountPill.tsx +4 -4
  210. package/src/chat/ui/BookmarkMarker.tsx +6 -6
  211. package/src/chat/ui/BookmarkSubmenu.tsx +5 -5
  212. package/src/chat/ui/ChatActivity.tsx +15 -15
  213. package/src/chat/ui/CodeBlock.tsx +10 -8
  214. package/src/chat/ui/Composer.tsx +13 -13
  215. package/src/chat/ui/ComposerInput.tsx +10 -2
  216. package/src/chat/ui/DiffPool.tsx +1 -1
  217. package/src/chat/ui/EditDiff.tsx +3 -4
  218. package/src/chat/ui/GoalDock.tsx +6 -6
  219. package/src/chat/ui/ImageView.tsx +4 -4
  220. package/src/chat/ui/LimitState.tsx +13 -13
  221. package/src/chat/ui/Markdown.tsx +12 -12
  222. package/src/chat/ui/MermaidBlock.tsx +6 -6
  223. package/src/chat/ui/MessageActions.tsx +7 -7
  224. package/src/chat/ui/ModelMarks.tsx +2 -2
  225. package/src/chat/ui/Pickers.tsx +10 -10
  226. package/src/chat/ui/PromptComposer.tsx +6 -6
  227. package/src/chat/ui/PromptEditor.tsx +4 -4
  228. package/src/chat/ui/QuoteButton.tsx +2 -2
  229. package/src/chat/ui/ReferenceChip.tsx +3 -3
  230. package/src/chat/ui/ReferenceTrail.tsx +2 -2
  231. package/src/chat/ui/ResumeCompactionDock.tsx +3 -3
  232. package/src/chat/ui/RunSettings.tsx +13 -13
  233. package/src/chat/ui/Scrubber.tsx +4 -4
  234. package/src/chat/ui/SessionLine.tsx +2 -2
  235. package/src/chat/ui/ShellCommand.tsx +2 -2
  236. package/src/chat/ui/SubagentControls.tsx +3 -3
  237. package/src/chat/ui/SubagentInfo.tsx +5 -5
  238. package/src/chat/ui/SubagentStopButton.tsx +3 -3
  239. package/src/chat/ui/SubagentTimeline.tsx +20 -17
  240. package/src/chat/ui/Timeline.tsx +232 -143
  241. package/src/chat/ui/TimelineMenu.tsx +7 -7
  242. package/src/chat/ui/UnifiedDiff.tsx +3 -3
  243. package/src/chat/ui/VisualDialogs.tsx +2 -2
  244. package/src/chat/ui/VisualFrame.tsx +4 -4
  245. package/src/chat/ui/WorkflowAgentLine.tsx +4 -4
  246. package/src/chat/ui/chip-clipboard.ts +1 -1
  247. package/src/chat/ui/composer/ComposerControls.tsx +4 -4
  248. package/src/chat/ui/composer/ComposerMenu.tsx +6 -6
  249. package/src/chat/ui/composer/DraftParts.tsx +2 -2
  250. package/src/chat/ui/composer/QueuedMessages.tsx +2 -2
  251. package/src/chat/ui/composer/chip-paste.ts +1 -1
  252. package/src/chat/ui/composer/chips.ts +2 -2
  253. package/src/chat/ui/composer/key-handler.ts +2 -2
  254. package/src/chat/ui/composer/placeholder.ts +1 -1
  255. package/src/chat/ui/composer/use-chat-controls.ts +1 -1
  256. package/src/chat/ui/composer/use-compaction-offer.ts +1 -1
  257. package/src/chat/ui/composer/use-composer-menus.ts +2 -2
  258. package/src/chat/ui/composer/use-composer-submit.ts +2 -2
  259. package/src/chat/ui/composer/use-draft-files.ts +3 -3
  260. package/src/chat/ui/composer/use-effort-stepper.ts +2 -2
  261. package/src/chat/ui/composer/use-pending-requests.ts +1 -1
  262. package/src/chat/ui/composer/use-prompt-menus.ts +3 -3
  263. package/src/chat/ui/composer/use-take-back.ts +1 -1
  264. package/src/chat/ui/diff/ApprovalReview.tsx +3 -3
  265. package/src/chat/ui/diff/DiffOmitted.tsx +1 -1
  266. package/src/chat/ui/diff/DiffStack.tsx +2 -2
  267. package/src/chat/ui/diff/EditorEditDiff.tsx +5 -5
  268. package/src/chat/ui/diff/EditorPatchDiff.tsx +1 -1
  269. package/src/chat/ui/diff/LegacyDiffPool.tsx +1 -1
  270. package/src/chat/ui/diff/LegacyEditDiff.tsx +18 -9
  271. package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +24 -13
  272. package/src/chat/ui/diff/RawDiff.tsx +8 -5
  273. package/src/chat/ui/diff/syntax-runtime.ts +1 -1
  274. package/src/chat/ui/highlighter.ts +1 -1
  275. package/src/chat/ui/icons.tsx +2 -2
  276. package/src/chat/ui/intelligent-ui/UiBlockFrame.tsx +5 -5
  277. package/src/chat/ui/intelligent-ui/UiFallbackPart.tsx +2 -2
  278. package/src/chat/ui/intelligent-ui/UiReply.tsx +18 -18
  279. package/src/chat/ui/intelligent-ui/node-text.ts +1 -1
  280. package/src/chat/ui/intelligent-ui/render-context.ts +1 -1
  281. package/src/chat/ui/intelligent-ui/renderers/chart.tsx +15 -7
  282. package/src/chat/ui/intelligent-ui/renderers/choices.tsx +4 -4
  283. package/src/chat/ui/intelligent-ui/renderers/content.tsx +7 -7
  284. package/src/chat/ui/intelligent-ui/renderers/data.tsx +8 -7
  285. package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +3 -3
  286. package/src/chat/ui/intelligent-ui/renderers/links.tsx +4 -4
  287. package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +4 -4
  288. package/src/chat/ui/intelligent-ui/renderers/map.tsx +5 -5
  289. package/src/chat/ui/intelligent-ui/renderers/structure.tsx +3 -3
  290. package/src/chat/ui/intelligent-ui/renderers/text.tsx +5 -5
  291. package/src/chat/ui/intelligent-ui/tones.ts +1 -1
  292. package/src/chat/ui/intelligent-ui/use-ui-links.ts +2 -2
  293. package/src/chat/ui/intelligent-ui/use-ui-queries.ts +1 -1
  294. package/src/chat/ui/reference-icons.ts +2 -2
  295. package/src/chat/ui/reply-context.ts +1 -1
  296. package/src/chat/ui/rows/ForksRow.tsx +3 -3
  297. package/src/chat/ui/rows/GeneratedImageRow.tsx +7 -7
  298. package/src/chat/ui/rows/MessageRows.tsx +57 -33
  299. package/src/chat/ui/rows/RowContainer.tsx +1 -1
  300. package/src/chat/ui/rows/Rows.tsx +7 -4
  301. package/src/chat/ui/rows/SubagentRow.tsx +16 -16
  302. package/src/chat/ui/rows/TaskRow.tsx +4 -4
  303. package/src/chat/ui/rows/VisualRow.tsx +2 -2
  304. package/src/chat/ui/rows/WorkRows.tsx +44 -32
  305. package/src/chat/ui/rows/WorkflowRow.tsx +9 -9
  306. package/src/chat/ui/rows/row-rhythm.ts +1 -1
  307. package/src/chat/ui/use-diff-source-tokens.ts +1 -1
  308. package/src/chat/ui/visual-theme.ts +2 -2
  309. package/src/chat/workflow-list.ts +1 -1
  310. package/src/host.ts +6 -6
  311. package/src/lazy.tsx +1 -1
  312. package/src/locales/en/agent-chat.ts +4 -0
  313. package/src/locales/nl/agent-chat.ts +4 -0
  314. package/src/port-transport.ts +1 -1
  315. package/src/prompts/logic/subjects.ts +1 -1
  316. package/src/prompts/ui/ApprovalBody.tsx +19 -9
  317. package/src/prompts/ui/PromptActions.tsx +2 -2
  318. package/src/prompts/ui/PromptCard.tsx +4 -4
  319. package/src/prompts/ui/PromptView.tsx +1 -1
  320. package/src/prompts/ui/QuestionBody.tsx +5 -5
  321. package/src/providers/AccountDetail.tsx +5 -5
  322. package/src/providers/AccountOrderList.tsx +2 -2
  323. package/src/providers/AccountVariables.tsx +4 -4
  324. package/src/providers/AddAccountForm.tsx +7 -7
  325. package/src/providers/CliDetail.tsx +9 -9
  326. package/src/providers/InstallPage.tsx +4 -4
  327. package/src/providers/ProviderList.tsx +4 -4
  328. package/src/providers/ProvidersPane.tsx +7 -7
  329. package/src/providers/account-actions.ts +1 -1
  330. package/src/providers/install-steps.ts +1 -1
  331. package/src/providers/parts.tsx +1 -1
  332. package/src/providers/provider-abilities.ts +1 -1
  333. package/src/providers/provider-groups.ts +1 -1
  334. package/src/providers/variables.ts +1 -1
  335. package/src/settings/sections.ts +2 -2
  336. package/src/state/chats.ts +2 -2
  337. package/src/state/provider-accounts.ts +1 -1
  338. package/src/state/providers.ts +1 -1
  339. package/src/state/usage.ts +2 -2
  340. package/src/theme.css +4 -4
  341. package/src/transport.ts +1 -1
  342. package/src/usage/LimitsList.tsx +5 -5
  343. package/src/usage/UsageBreakdown.tsx +6 -6
  344. package/src/usage/UsageChart.tsx +2 -2
  345. package/src/usage/UsageDialog.tsx +2 -2
  346. package/src/usage/UsageLimits.tsx +7 -7
  347. package/src/usage/UsageLimitsCard.tsx +2 -2
  348. package/src/usage/UsagePage.tsx +8 -7
  349. package/src/usage/UsagePane.tsx +4 -4
  350. package/src/usage/UsageSummary.tsx +2 -2
  351. package/src/usage/UsageTiles.tsx +1 -1
  352. package/src/usage/format.ts +7 -0
  353. package/src/usage/limit-groups.ts +2 -2
  354. package/src/usage/limits.ts +1 -1
  355. package/src/usage/summary.ts +1 -1
  356. package/dist/chat/logic/json.d.ts +0 -1
  357. package/dist/chat/logic/json.js +0 -4
  358. package/src/chat/logic/json.ts +0 -4
@@ -1,3 +1,8 @@
1
+ import type { ChatBookmark } from '@adecore/agent-contracts';
2
+ import { ContextMenu, EmptyState, ErrorBoundary, Icon, ScrollArea, SectionLabel } from '@adecore/ui';
3
+ import { defaultRangeExtractor, useVirtualizer, type Virtualizer } from '@tanstack/react-virtual';
4
+ import clsx from 'clsx';
5
+ import { LoaderCircle } from 'lucide-react';
1
6
  import {
2
7
  type CSSProperties,
3
8
  memo,
@@ -12,29 +17,15 @@ import {
12
17
  type ReactNode
13
18
  } from 'react';
14
19
  import { useTranslation } from 'react-i18next';
15
- import { defaultRangeExtractor, useVirtualizer, type Virtualizer } from '@tanstack/react-virtual';
16
- import clsx from 'clsx';
17
- import { LoaderCircle } from 'lucide-react';
18
- import type { ChatBookmark } from '@adecore/agent-contracts';
20
+ import { AgentIcon } from '../../agents/AgentIcon';
21
+ import { useModelName } from '../../agents/model-name';
22
+ import { useChatHost, type TimelineFindOptions } from '../../host';
23
+ import { useHostContextSources, useHostHidesFolder, useHostHidesToolCalls, useHostThreadCards, useHostTimelineFind, useHostWelcome } from '../../host-hooks';
24
+ import { useChatScope } from '../../scope';
25
+ import { useChatRow, useChats } from '../../state/chats';
19
26
  import { useForkedTurns } from '../forks';
20
27
  import { bookmarkRows } from '../logic/bookmarks';
21
- import { deriveTimelineRows, findSubagentBranch, type TimelineRow } from '../logic/timeline';
22
- import { timedRowsOf, withTimedRows } from '../logic/thread-cards';
23
- import { openFromMain, useSubagentTrail, type SubagentStep } from '../subagent-view';
24
- import {
25
- registerItemJumper,
26
- registerMessageStepper,
27
- registerTimeline,
28
- registerTurnJumper,
29
- setTimelineAtEnd,
30
- wantsEarlier,
31
- type ItemJumpOptions,
32
- type ReadingAnchor,
33
- type TurnTarget
34
- } from '../timeline-scroll';
35
- import { useTimelineFlash } from '../timeline-flash';
36
- import { useChatPreferences } from '../preferences';
37
- import { readingMeasure, readingWidthStyle } from '../reading-width';
28
+ import { forkRefusal } from '../logic/fork';
38
29
  import {
39
30
  SCRUBBER_MIN_TICKS,
40
31
  STRIP_INSET_PX,
@@ -48,6 +39,8 @@ import {
48
39
  ticksWithHits,
49
40
  EARLIER_ROW
50
41
  } from '../logic/scrubber';
42
+ import { timedRowsOf, withTimedRows } from '../logic/thread-cards';
43
+ import { deriveTimelineRows, findSubagentBranch, type TimelineRow } from '../logic/timeline';
51
44
  import {
52
45
  EMPTY_TARGET,
53
46
  readTimelineTarget,
@@ -57,32 +50,41 @@ import {
57
50
  type TimelineTarget,
58
51
  type UiReplyTarget
59
52
  } from '../logic/timeline-target';
60
- import { forkRefusal } from '../logic/fork';
61
- import { UiReplyNavigationContext } from './reply-context';
62
- import { FindRevealContext } from './find-reveal';
53
+ import { useChatPreferences } from '../preferences';
54
+ import { readingMeasure, readingWidthStyle } from '../reading-width';
55
+ import { openFromMain, useSubagentTrail, type SubagentStep } from '../subagent-view';
56
+ import { useTimelineFlash } from '../timeline-flash';
57
+ import {
58
+ registerItemJumper,
59
+ registerMessageStepper,
60
+ registerTimeline,
61
+ registerTurnJumper,
62
+ setTimelineAtEnd,
63
+ wantsEarlier,
64
+ type ItemJumpOptions,
65
+ type ReadingAnchor,
66
+ type TurnTarget
67
+ } from '../timeline-scroll';
63
68
  import { BookmarkMarker } from './BookmarkMarker';
69
+ import { FileLinkContext } from './file-links';
70
+ import { FindRevealContext } from './find-reveal';
64
71
  import { MessageActions } from './MessageActions';
72
+ import { QuoteTakerContext, type QuoteTaker } from './quote-selection';
73
+ import { QuoteButton } from './QuoteButton';
74
+ import { UiReplyNavigationContext } from './reply-context';
75
+ import { ReplyHeader } from './rows/MessageRows';
76
+ import { FOLLOW_THRESHOLD_PX, replyHeader } from './rows/row-rhythm';
77
+ import { RowContainer } from './rows/RowContainer';
78
+ import { Row, type RowProps } from './rows/Rows';
65
79
  import { Scrubber, type CardChat } from './Scrubber';
66
80
  import { TimelineMenuPopup } from './TimelineMenu';
67
- import { VisualDialogs } from './VisualDialogs';
68
- import { FOLLOW_THRESHOLD_PX, replyHeader } from './rows/row-rhythm';
69
- import { QuoteButton } from './QuoteButton';
70
- import { QuoteTakerContext, type QuoteTaker } from './quote-selection';
71
81
  import { useToggleSet } from './useToggleSet';
82
+ import { VisualDialogs } from './VisualDialogs';
72
83
  import { WelcomeGreeting } from './Welcome';
73
- import { Row, type RowProps } from './rows/Rows';
74
- import { RowContainer } from './rows/RowContainer';
75
- import { ReplyHeader } from './rows/MessageRows';
76
- import { useChatRow, useChats } from '../../state/chats';
77
- import { useChatHost, type TimelineFindOptions } from '../../host';
78
- import { useChatScope } from '../../scope';
79
- import { FileLinkContext } from './file-links';
80
- import { AgentIcon } from '../../agents/AgentIcon';
81
- import { useModelName } from '../../agents/model-name';
82
- import { ContextMenu, EmptyState, ErrorBoundary, Icon, SectionLabel } from '@adecore/ui';
83
- import { useHostContextSources, useHostHidesFolder, useHostHidesToolCalls, useHostThreadCards, useHostTimelineFind, useHostWelcome } from '../../host-hooks';
84
84
 
85
85
  const ESTIMATED_ROW_PX = 56;
86
+ // A wheel that counts in lines rather than pixels moves this far per line.
87
+ const WHEEL_LINE_PX = 16;
86
88
  // How long a jump waits for a thread that is still loading before it calls the item missing.
87
89
  const JUMP_THREAD_WAIT_MS = 8000;
88
90
 
@@ -92,6 +94,34 @@ function showRowAtTop(virtualizer: Virtualizer<HTMLDivElement, Element>, followR
92
94
  virtualizer.scrollToIndex(index, { align: 'start' });
93
95
  }
94
96
 
97
+ /* What of the composer's height covers the thread: all of it while it fits, none in a welcome or once it fills the frame. */
98
+ function coveredBy(composerHeight: number, frameHeight: number, welcome: boolean): number {
99
+ return !welcome && composerHeight < frameHeight - FOLLOW_THRESHOLD_PX ? composerHeight : 0;
100
+ }
101
+
102
+ /* Whether a wheel over `target` moves a scroller between it and `boundary`, such as a long draft. */
103
+ function scrollsWithin(target: Element, boundary: Element, deltaX: number, deltaY: number): boolean {
104
+ for (let element: Element | null = target; element !== null; element = element.parentElement) {
105
+ const { overflowX, overflowY } = getComputedStyle(element);
106
+ const scrollsY = (overflowY === 'auto' || overflowY === 'scroll') && element.scrollHeight > element.clientHeight;
107
+ const scrollsX = (overflowX === 'auto' || overflowX === 'scroll') && element.scrollWidth > element.clientWidth;
108
+
109
+ if (scrollsY && (deltaY < 0 ? element.scrollTop > 0 : deltaY > 0 && element.scrollTop + element.clientHeight < element.scrollHeight)) {
110
+ return true;
111
+ }
112
+
113
+ if (scrollsX && (deltaX < 0 ? element.scrollLeft > 0 : deltaX > 0 && element.scrollLeft + element.clientWidth < element.scrollWidth)) {
114
+ return true;
115
+ }
116
+
117
+ if (element === boundary) {
118
+ return false;
119
+ }
120
+ }
121
+
122
+ return false;
123
+ }
124
+
95
125
  /*
96
126
  * A thread before its first message: which model answers, what the lines into this node let it read,
97
127
  * and the folder it works in, so a first question can lean on all three.
@@ -250,6 +280,7 @@ export function Timeline({
250
280
  const { trail, show } = useSubagentTrail(chatId);
251
281
  const frameRef = useRef<HTMLDivElement>(null);
252
282
  const composerRef = useRef<HTMLDivElement>(null);
283
+ const spacerRef = useRef<HTMLDivElement>(null);
253
284
  const [composerHeight, setComposerHeight] = useState(0);
254
285
  const [frame, setFrame] = useState({ width: 0, height: 0, column: false });
255
286
  const [loadingEarlier, setLoadingEarlier] = useState(false);
@@ -363,6 +394,9 @@ export function Timeline({
363
394
  return () => observer.disconnect();
364
395
  }, []);
365
396
 
397
+ const coverRef = useRef({ frameHeight: frame.height, welcome });
398
+ coverRef.current = { frameHeight: frame.height, welcome };
399
+
366
400
  useLayoutEffect(() => {
367
401
  const element = composerRef.current;
368
402
 
@@ -370,7 +404,24 @@ export function Timeline({
370
404
  return;
371
405
  }
372
406
 
373
- const measure = () => setComposerHeight(element.offsetHeight);
407
+ // The composer lies outside the scroller, so the space under the thread follows its height here,
408
+ // before the page paints, and the end with it; the state is drawn only after that paint.
409
+ const measure = () => {
410
+ const height = element.offsetHeight;
411
+ const spacer = spacerRef.current;
412
+ const scroller = scrollRef.current;
413
+
414
+ if (spacer !== null && scroller !== null) {
415
+ spacer.style.height = `${coveredBy(height, coverRef.current.frameHeight, coverRef.current.welcome)}px`;
416
+
417
+ if (followRef.current) {
418
+ scroller.scrollTop = scroller.scrollHeight;
419
+ scrollGeometry.current = { top: scroller.scrollTop, height: scroller.scrollHeight, viewport: scroller.clientHeight };
420
+ }
421
+ }
422
+
423
+ setComposerHeight(height);
424
+ };
374
425
 
375
426
  const observer = new ResizeObserver(measure);
376
427
  observer.observe(element);
@@ -379,9 +430,9 @@ export function Timeline({
379
430
  return () => observer.disconnect();
380
431
  }, []);
381
432
 
382
- // Oversized prompts scroll in full instead of sticking with their top outside the viewport.
383
- const stickyComposer = !welcome && composerHeight < frame.height - FOLLOW_THRESHOLD_PX;
384
- const coveredHeight = stickyComposer ? composerHeight : 0;
433
+ // A composer that would leave too little of the thread covers the frame and scrolls by itself.
434
+ const coveredHeight = coveredBy(composerHeight, frame.height, welcome);
435
+ const fillsFrame = !welcome && coveredHeight === 0 && composerHeight > 0;
385
436
  const coveredHeightRef = useRef(coveredHeight);
386
437
  coveredHeightRef.current = coveredHeight;
387
438
 
@@ -481,15 +532,15 @@ export function Timeline({
481
532
  return;
482
533
  }
483
534
 
484
- // The composer is in the scroll flow, so its measured height is part of this end position.
535
+ // The space under the thread is the composer's height, so that height is part of this end position.
485
536
  element.scrollTop = element.scrollHeight;
486
537
  scrollGeometry.current = { top: element.scrollTop, height: element.scrollHeight, viewport: element.clientHeight };
487
538
  }, [rows.length, totalSize, composerHeight, frame.height]);
488
539
 
489
540
  /*
490
- * A height that changes after the first paint (the composer taking its draft, a row measured again) is
491
- * seen by an observer before the page paints, but the state it sets is drawn after that paint. The
492
- * end is pinned here as well, so the page never paints the thread with its end out of view.
541
+ * A row measured again after the first paint is seen by an observer before the page paints, but the
542
+ * state it sets is drawn after that paint. The end is pinned here as well, so the page never paints
543
+ * the thread with its end out of view.
493
544
  */
494
545
  useLayoutEffect(() => {
495
546
  const content = contentRef.current;
@@ -895,110 +946,148 @@ export function Timeline({
895
946
  data-file-scope-id={scope.id}
896
947
  >
897
948
  {searching && chatFind.bar}
898
- <ContextMenu.Root>
899
- <div
900
- ref={scrollRef}
901
- // No CSS scroll-padding here: Chromium counts the sticky composer's caret as hidden behind
902
- // it and scrolls the thread toward the end on every keystroke.
903
- className="chat-scroll min-h-0 grow overflow-auto"
904
- // The thread keeps its reader in place itself when a page goes in above.
905
- style={{ overflowAnchor: 'none' }}
906
- onScrollCapture={(e) => {
907
- const el = e.currentTarget;
908
- // Capture the reader's movement before virtualization remeasures rows and shifts the scroll offset.
909
- const previous = scrollGeometry.current;
910
- const layoutChanged = previous.height !== el.scrollHeight || previous.viewport !== el.clientHeight;
911
- const atEnd = el.scrollHeight - el.scrollTop - el.clientHeight < FOLLOW_THRESHOLD_PX;
912
-
913
- if (!layoutChanged && el.scrollTop < previous.top) {
914
- followRef.current = false;
915
- } else if (atEnd) {
916
- followRef.current = true;
917
- }
949
+ {/* A welcome centers the greeting and the composer as one group. The composer keeps its
950
+ place in the tree, so the first message does not mount it again. */}
951
+ <div className={clsx('relative flex min-h-0 grow flex-col', welcome && 'justify-center')}>
952
+ <ContextMenu.Root>
953
+ <ScrollArea
954
+ // Only down: wide content such as code and diffs scrolls in its own box, so a thread never moves sideways.
955
+ axis="y"
956
+ viewportRef={scrollRef}
957
+ className={clsx(!welcome && 'grow')}
958
+ viewportClassName="chat-scroll"
959
+ coveredBottom={coveredHeight}
960
+ // The thread keeps its reader in place itself when a page goes in above.
961
+ style={{ overflowAnchor: 'none' }}
962
+ onScrollCapture={(e) => {
963
+ const el = e.currentTarget;
964
+ // Capture the reader's movement before virtualization remeasures rows and shifts the scroll offset.
965
+ const previous = scrollGeometry.current;
966
+ const layoutChanged = previous.height !== el.scrollHeight || previous.viewport !== el.clientHeight;
967
+ const atEnd = el.scrollHeight - el.scrollTop - el.clientHeight < FOLLOW_THRESHOLD_PX;
968
+
969
+ if (!layoutChanged && el.scrollTop < previous.top) {
970
+ followRef.current = false;
971
+ } else if (atEnd) {
972
+ followRef.current = true;
973
+ }
974
+
975
+ scrollGeometry.current = { top: el.scrollTop, height: el.scrollHeight, viewport: el.clientHeight };
976
+ setTimelineAtEnd(chatId, followRef.current);
918
977
 
919
- scrollGeometry.current = { top: el.scrollTop, height: el.scrollHeight, viewport: el.clientHeight };
920
- setTimelineAtEnd(chatId, followRef.current);
978
+ if (wantsEarlier(el)) {
979
+ loadEarlier();
980
+ }
921
981
 
922
- if (wantsEarlier(el)) {
923
- loadEarlier();
982
+ followStrip(el);
983
+ }}
984
+ >
985
+ <div ref={contentRef} className="relative flex min-h-full flex-col">
986
+ <ContextMenu.Trigger
987
+ ref={threadRef}
988
+ className={clsx('chat-thread flex flex-col px-4 pt-4', !welcome && 'grow')}
989
+ style={
990
+ {
991
+ paddingLeft,
992
+ '--chat-wide-inset': `${2 * (showsScrubber ? STRIP_CLEARANCE_PX : paddingLeft) - paddingLeft}px`
993
+ } as CSSProperties
994
+ }
995
+ inert={overlay ? true : undefined}
996
+ onContextMenu={(e) =>
997
+ setTarget(readTimelineTarget(e.target as HTMLElement, threadRef.current, withCurrentText(rows, fullItems())))
998
+ }
999
+ >
1000
+ {loadingHistory ? (
1001
+ <div className="flex grow items-center justify-center gap-2 text-sm text-text-muted" role="status">
1002
+ <Icon icon={LoaderCircle} size={16} className="animate-spin" />
1003
+ <span>{t('timeline.loading')}</span>
1004
+ </div>
1005
+ ) : welcome ? (
1006
+ <WelcomeGreeting chatId={chatId} />
1007
+ ) : empty ? (
1008
+ <EmptyThread chatId={chatId} />
1009
+ ) : (
1010
+ <div
1011
+ className="relative w-full shrink-0"
1012
+ style={{ height: totalSize, visibility: initialLayout ? 'hidden' : undefined }}
1013
+ >
1014
+ <UiReplyNavigationContext.Provider value={uiNavigation}>
1015
+ <FindRevealContext.Provider value={chatFind.reveal}>
1016
+ {virtualRows.map((virtualRow) => {
1017
+ const row = rows[virtualRow.index]!;
1018
+
1019
+ return (
1020
+ <ThreadRow
1021
+ key={row.id}
1022
+ row={row}
1023
+ previous={virtualRow.index > 0 ? rows[virtualRow.index - 1]! : null}
1024
+ index={virtualRow.index}
1025
+ top={virtualRow.start}
1026
+ measure={virtualizer.measureElement}
1027
+ chatId={chatId}
1028
+ flashNonce={flash !== null && flashedRow === row.id ? flash.nonce : null}
1029
+ bookmark={marks.get(row.id) ?? null}
1030
+ toggleGroup={groups.toggle}
1031
+ toggleTurn={turns.toggle}
1032
+ toggleSubagent={subagents.toggle}
1033
+ openSubagent={openSubagent}
1034
+ openConversation={openConversation}
1035
+ />
1036
+ );
1037
+ })}
1038
+ </FindRevealContext.Provider>
1039
+ </UiReplyNavigationContext.Provider>
1040
+ </div>
1041
+ )}
1042
+ </ContextMenu.Trigger>
1043
+ <QuoteButton thread={threadRef} frame={contentRef} taker={quoteTakerRef} />
1044
+ <div ref={spacerRef} className="shrink-0" style={{ height: coveredHeight }} aria-hidden />
1045
+ </div>
1046
+ </ScrollArea>
1047
+ <TimelineMenuPopup target={target} thread={threadRef} chatId={onMainAgent ? chatId : null} column={frame.column} />
1048
+ </ContextMenu.Root>
1049
+ {/*
1050
+ * Over the thread rather than in its scroller, so the thread bounces at its end and the
1051
+ * composer stays put. Its own stacking layer keeps the composer under the strip and the overlay.
1052
+ */}
1053
+ <div
1054
+ className="isolate shrink-0"
1055
+ style={
1056
+ welcome
1057
+ ? { position: 'relative' }
1058
+ : fillsFrame
1059
+ ? { position: 'absolute', inset: 0, overflowY: 'auto' }
1060
+ : { position: 'absolute', insetInline: 0, bottom: 0 }
1061
+ }
1062
+ onWheel={(e) => {
1063
+ const scroller = scrollRef.current;
1064
+
1065
+ // A wheel over the composer moves the thread it lies over, as it did inside the scroller.
1066
+ if (
1067
+ scroller === null ||
1068
+ coveredHeight === 0 ||
1069
+ e.ctrlKey ||
1070
+ scrollsWithin(e.target as Element, e.currentTarget, e.deltaX, e.deltaY)
1071
+ ) {
1072
+ return;
924
1073
  }
925
1074
 
926
- followStrip(el);
1075
+ const unit = e.deltaMode === 1 ? WHEEL_LINE_PX : e.deltaMode === 2 ? scroller.clientHeight : 1;
1076
+ scroller.scrollTop += e.deltaY * unit;
1077
+ scroller.scrollLeft += e.deltaX * unit;
927
1078
  }}
928
1079
  >
929
- {/* A welcome centers the greeting and the composer as one group. The composer keeps its
930
- place in the tree, so the first message does not mount it again. */}
931
- <div ref={contentRef} className={clsx('relative flex min-h-full flex-col', welcome && 'justify-center')}>
932
- <ContextMenu.Trigger
933
- ref={threadRef}
934
- className={clsx('chat-thread flex flex-col px-4 pt-4', !welcome && 'grow')}
935
- style={
936
- {
937
- paddingLeft,
938
- '--chat-wide-inset': `${2 * (showsScrubber ? STRIP_CLEARANCE_PX : paddingLeft) - paddingLeft}px`
939
- } as CSSProperties
940
- }
941
- inert={overlay ? true : undefined}
942
- onContextMenu={(e) =>
943
- setTarget(readTimelineTarget(e.target as HTMLElement, threadRef.current, withCurrentText(rows, fullItems())))
944
- }
945
- >
946
- {loadingHistory ? (
947
- <div className="flex grow items-center justify-center gap-2 text-sm text-text-muted" role="status">
948
- <Icon icon={LoaderCircle} size={16} className="animate-spin" />
949
- <span>{t('timeline.loading')}</span>
950
- </div>
951
- ) : welcome ? (
952
- <WelcomeGreeting chatId={chatId} />
953
- ) : empty ? (
954
- <EmptyThread chatId={chatId} />
955
- ) : (
956
- <div className="relative w-full shrink-0" style={{ height: totalSize, visibility: initialLayout ? 'hidden' : undefined }}>
957
- <UiReplyNavigationContext.Provider value={uiNavigation}>
958
- <FindRevealContext.Provider value={chatFind.reveal}>
959
- {virtualRows.map((virtualRow) => {
960
- const row = rows[virtualRow.index]!;
961
-
962
- return (
963
- <ThreadRow
964
- key={row.id}
965
- row={row}
966
- previous={virtualRow.index > 0 ? rows[virtualRow.index - 1]! : null}
967
- index={virtualRow.index}
968
- top={virtualRow.start}
969
- measure={virtualizer.measureElement}
970
- chatId={chatId}
971
- flashNonce={flash !== null && flashedRow === row.id ? flash.nonce : null}
972
- bookmark={marks.get(row.id) ?? null}
973
- toggleGroup={groups.toggle}
974
- toggleTurn={turns.toggle}
975
- toggleSubagent={subagents.toggle}
976
- openSubagent={openSubagent}
977
- openConversation={openConversation}
978
- />
979
- );
980
- })}
981
- </FindRevealContext.Provider>
982
- </UiReplyNavigationContext.Provider>
983
- </div>
984
- )}
985
- </ContextMenu.Trigger>
986
- <QuoteButton thread={threadRef} frame={contentRef} taker={quoteTakerRef} />
987
- <div
988
- ref={composerRef}
989
- // The card is translucent so the thread shows through it, but the pb-3 strip under it must stay opaque.
990
- className={clsx(
991
- 'relative z-10 shrink-0',
992
- composer && 'px-3 pb-3 pt-3 bg-[linear-gradient(to_bottom,transparent_calc(100%-12px),var(--surface)_calc(100%-12px))]'
993
- )}
994
- style={{ position: stickyComposer ? 'sticky' : 'relative', bottom: 0 }}
995
- >
996
- <QuoteTakerContext.Provider value={registerQuoteTaker}>{composer}</QuoteTakerContext.Provider>
997
- </div>
1080
+ <div
1081
+ ref={composerRef}
1082
+ // The card is translucent so the thread shows through it, but the pb-3 strip under it must stay opaque.
1083
+ className={clsx(
1084
+ composer && 'px-3 pb-3 pt-3 bg-[linear-gradient(to_bottom,transparent_calc(100%-12px),var(--surface)_calc(100%-12px))]'
1085
+ )}
1086
+ >
1087
+ <QuoteTakerContext.Provider value={registerQuoteTaker}>{composer}</QuoteTakerContext.Provider>
998
1088
  </div>
999
1089
  </div>
1000
- <TimelineMenuPopup target={target} thread={threadRef} chatId={onMainAgent ? chatId : null} column={frame.column} />
1001
- </ContextMenu.Root>
1090
+ </div>
1002
1091
  {drawsVisuals && <VisualDialogs chatId={chatId} />}
1003
1092
  {loadingEarlier && !overlay && (
1004
1093
  <div className="pointer-events-none absolute inset-x-0 top-3 z-10 flex justify-center" role="status">
@@ -1,19 +1,19 @@
1
+ import { ContextMenu, copyText, DisabledReason, EDIT_SHORTCUTS, Icon, Kbd, selectAllWithin } from '@adecore/ui';
2
+ import { BookmarkPlus, BookmarkX, Braces, Copy, Eye, FileText, GitFork, MessageSquare, MoveHorizontal, Pencil, Scan } from 'lucide-react';
1
3
  import type { RefObject } from 'react';
2
4
  import { useTranslation } from 'react-i18next';
3
- import { BookmarkPlus, BookmarkX, Braces, Copy, Eye, FileText, GitFork, MessageSquare, MoveHorizontal, Pencil, Scan } from 'lucide-react';
5
+ import { useChatHost } from '../../host';
6
+ import { useChatScope } from '../../scope';
7
+ import { useChatRow } from '../../state/chats';
4
8
  import { placeBookmark, removeBookmark, useBookmarkNaming } from '../bookmarks';
5
- import { rememberReadingWidth, useChatPreferences } from '../preferences';
6
- import { CHAT_READING_WIDTHS, readingWidthLabel, type ChatReadingWidth } from '../reading-width';
7
9
  import { forkRefusal, turnIdOfRow } from '../logic/fork';
8
10
  import { markdownOf, messageTextOf } from '../logic/timeline-copy';
9
11
  import type { TimelineTarget } from '../logic/timeline-target';
10
- import { useChatHost } from '../../host';
11
- import { useChatScope } from '../../scope';
12
- import { useChatRow } from '../../state/chats';
12
+ import { rememberReadingWidth, useChatPreferences } from '../preferences';
13
+ import { CHAT_READING_WIDTHS, readingWidthLabel, type ChatReadingWidth } from '../reading-width';
13
14
  import { copyWithChips, rowClipboardChips } from './chip-clipboard';
14
15
  import { useFileLinkCwd, useFileLinkScopeId, useOpenFileLink } from './file-links';
15
16
  import { useReferenceLookup } from './thread-references';
16
- import { ContextMenu, copyText, DisabledReason, EDIT_SHORTCUTS, Icon, Kbd, selectAllWithin } from '@adecore/ui';
17
17
 
18
18
  /* The menu behind a right-click in a thread, mostly for copying: a whole message, a code block or an answer's markdown. */
19
19
  export function TimelineMenuPopup({
@@ -1,13 +1,13 @@
1
1
  import { LazyBoundary } from '@adecore/ui';
2
2
  import { useTranslation } from 'react-i18next';
3
+ import { useChatHost } from '../../host';
3
4
  import { lazyNamed } from '../../lazy';
5
+ import type { UnifiedDiffProps } from './diff/diff-props';
4
6
  import { diffSourceBudget, legacyDiffBudget, patchSourceBudget } from './diff/diff-source-budget';
7
+ import { DiffFallbackBoundary } from './diff/DiffFallbackBoundary';
5
8
  import { DiffOmitted } from './diff/DiffOmitted';
6
9
  import { DiffUnavailable } from './diff/DiffUnavailable';
7
10
  import { RawDiff } from './diff/RawDiff';
8
- import { DiffFallbackBoundary } from './diff/DiffFallbackBoundary';
9
- import { useChatHost } from '../../host';
10
- import type { UnifiedDiffProps } from './diff/diff-props';
11
11
 
12
12
  const LegacyUnifiedDiff = lazyNamed(() => import('./diff/LegacyUnifiedDiff'), 'default', { prefetch: false });
13
13
  const EditorPatchDiff = lazyNamed(() => import('./diff/EditorPatchDiff'), 'default');
@@ -1,7 +1,7 @@
1
- import { useState } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
1
  import type { ChatVisual } from '@adecore/agent-contracts';
4
2
  import { CloseButton, Dialog, ErrorBoundary, PromptDialog } from '@adecore/ui';
3
+ import { useState } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
5
  import { useChatScope } from '../../scope';
6
6
  import { useChatRow } from '../../state/chats';
7
7
  import { useVisualDialog } from '../visuals';
@@ -1,12 +1,12 @@
1
- import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import clsx from 'clsx';
4
1
  import { VISUAL_LIMITS, visualThemeFragment, type ChatVisual, type VisualAppearance, type VisualTheme } from '@adecore/agent-contracts/visual';
5
2
  import { Spinner, useMeasuredWidth } from '@adecore/ui';
3
+ import clsx from 'clsx';
4
+ import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
6
  import { useChatHost } from '../../host';
7
7
  import { useChatScope } from '../../scope';
8
- import { DEFAULT_HEIGHT_PX, initialVisualContentHeight, rememberVisualHeight } from '../logic/visual-height';
9
8
  import { imageDocumentForDisplay } from '../image-display';
9
+ import { DEFAULT_HEIGHT_PX, initialVisualContentHeight, rememberVisualHeight } from '../logic/visual-height';
10
10
  import { VisualBridge } from '../visual-bridge';
11
11
  import { VisualViewportController } from '../visual-viewport';
12
12
  import { useVisualTheme } from './visual-theme';
@@ -1,9 +1,9 @@
1
- import clsx from 'clsx';
2
- import type { Ref } from 'react';
3
- import { Bot, ChevronRight, X } from 'lucide-react';
4
1
  import { workflowAgentRef, type AgentKind } from '@adecore/agent-contracts';
5
- import { formatElapsedShort } from '@adecore/ui/format';
6
2
  import { Icon, useTickingText } from '@adecore/ui';
3
+ import { formatElapsedShort } from '@adecore/ui/format';
4
+ import clsx from 'clsx';
5
+ import { Bot, ChevronRight, X } from 'lucide-react';
6
+ import type { Ref } from 'react';
7
7
  import { AgentIcon } from '../../agents/AgentIcon';
8
8
  import { workflowAgentPreview, workflowAgentTime, type WorkflowAgentState, type WorkflowAgentView } from '../logic/workflow';
9
9
  import type { SubagentStep } from '../subagent-view';
@@ -1,6 +1,7 @@
1
1
  import type { ChatAssistantItem, ChatUserItem } from '@adecore/agent-contracts';
2
2
  import { copyText } from '@adecore/ui';
3
3
  import { referenceTokens } from '../chat-references';
4
+ import type { TimelineRow } from '../logic/timeline';
4
5
  import {
5
6
  clipboardChipsOf,
6
7
  hasClipboardChips,
@@ -10,7 +11,6 @@ import {
10
11
  type ChipSegment,
11
12
  type ClipboardChips
12
13
  } from '../mentions';
13
- import type { TimelineRow } from '../logic/timeline';
14
14
  import type { ReferenceLookup } from './reference-lookup';
15
15
 
16
16
  /* The chips a copy of a whole message carries: what the person picked, or what a reply names. */
@@ -1,9 +1,9 @@
1
- import { useRef, useState, type Ref } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import clsx from 'clsx';
4
- import { ArrowUp, ChevronDown, Play, Plus, Square } from 'lucide-react';
5
1
  import { holdsConversation, type ChatInfo } from '@adecore/agent-contracts';
6
2
  import { Button, ErrorBoundary, Icon, Menu, Tooltip, type Shortcut } from '@adecore/ui';
3
+ import clsx from 'clsx';
4
+ import { ArrowUp, ChevronDown, Play, Plus, Square } from 'lucide-react';
5
+ import { useRef, useState, type Ref } from 'react';
6
+ import { useTranslation } from 'react-i18next';
7
7
  import { useChatHost, type ComposerSendAction, type ComposerSendDraft } from '../../../host';
8
8
  import { useChatScope } from '../../../scope';
9
9
  import { useProviders } from '../../../state/providers';
@@ -1,13 +1,13 @@
1
- import type { ReactNode } from 'react';
2
- import { useTranslation } from 'react-i18next';
1
+ import { FileIcon, Icon, Menu, MiddleTruncate, ScrollArea } from '@adecore/ui';
3
2
  import clsx from 'clsx';
4
3
  import { SquareSlash, Zap } from 'lucide-react';
5
- import { FileIcon, Icon, Menu, MiddleTruncate } from '@adecore/ui';
4
+ import type { ReactNode } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
6
  import { useChatHost } from '../../../host';
7
7
  import type { Referable } from '../../chat-references';
8
8
  import { referenceGlyph } from '../reference-icons';
9
- import type { ComposerMenus as Menus } from './use-composer-menus';
10
9
  import { optionIdOf } from './menu-aria';
10
+ import type { ComposerMenus as Menus } from './use-composer-menus';
11
11
 
12
12
  function splitPath(path: string): { name: string; dir: string } {
13
13
  const slash = path.lastIndexOf('/');
@@ -121,7 +121,7 @@ function ReferenceMenu({ menus }: { menus: Menus }) {
121
121
  }
122
122
 
123
123
  return (
124
- <div className="max-h-96 overflow-y-auto border-b border-border px-1.5 py-1.5">
124
+ <ScrollArea className="max-h-96 border-b border-border" viewportClassName="px-1.5 py-1.5">
125
125
  {referenceMatches.length > 0 ? (
126
126
  <div id={listId} role="listbox" aria-label={t('composer.menu.references')}>
127
127
  {[...groups].map(([key, items]) => (
@@ -161,7 +161,7 @@ function ReferenceMenu({ menus }: { menus: Menus }) {
161
161
  ) : (
162
162
  <div className="px-2 py-1 text-xs text-text-faint">{t('composer.references.noMatch')}</div>
163
163
  )}
164
- </div>
164
+ </ScrollArea>
165
165
  );
166
166
  }
167
167
 
@@ -1,7 +1,7 @@
1
- import { useTranslation } from 'react-i18next';
2
- import { Paperclip, X } from 'lucide-react';
3
1
  import type { ChatAttachmentUpload } from '@adecore/agent-contracts';
4
2
  import { Icon, IconButton, Tooltip } from '@adecore/ui';
3
+ import { Paperclip, X } from 'lucide-react';
4
+ import { useTranslation } from 'react-i18next';
5
5
  import { useChatScope } from '../../../scope';
6
6
  import { formatBytes, isImageAttachment, uploadBytes } from '../../attachments';
7
7
  import { jumpToTimelineItem } from '../../timeline-scroll';