@adecore/agents-react 0.31.12 → 0.33.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 (409) hide show
  1. package/README.md +1 -1
  2. package/dist/agents/AccountDot.js +57 -6
  3. package/dist/agents/AgentIcon.js +88 -12
  4. package/dist/agents/ModelOptionControl.js +153 -18
  5. package/dist/agents/ProviderLogo.js +49 -4
  6. package/dist/agents/account-limits.js +17 -14
  7. package/dist/agents/accounts.js +99 -67
  8. package/dist/agents/agent-marks.js +5 -3
  9. package/dist/agents/model-name.js +42 -31
  10. package/dist/agents/model-options.js +8 -8
  11. package/dist/agents/model-requirement.js +17 -14
  12. package/dist/agents/option-words.d.ts +7 -0
  13. package/dist/agents/option-words.js +35 -0
  14. package/dist/agents/provider-paths.js +6 -6
  15. package/dist/agents/status-look.js +32 -12
  16. package/dist/chat/account-choice.d.ts +13 -0
  17. package/dist/chat/account-choice.js +90 -20
  18. package/dist/chat/actions.js +126 -59
  19. package/dist/chat/activity.js +5 -5
  20. package/dist/chat/attachments.js +74 -53
  21. package/dist/chat/bookmarks.js +58 -48
  22. package/dist/chat/chat-client.js +344 -263
  23. package/dist/chat/chat-references.js +3 -3
  24. package/dist/chat/composer-effort.d.ts +5 -0
  25. package/dist/chat/composer-effort.js +26 -0
  26. package/dist/chat/composer-send.js +13 -13
  27. package/dist/chat/drafts.js +115 -79
  28. package/dist/chat/forks.js +81 -24
  29. package/dist/chat/guards.js +15 -43
  30. package/dist/chat/index.d.ts +3 -1
  31. package/dist/chat/index.js +3 -2
  32. package/dist/chat/logic/ansi.js +170 -167
  33. package/dist/chat/logic/answers.js +2 -2
  34. package/dist/chat/logic/bookmarks.js +19 -19
  35. package/dist/chat/logic/command-looks.js +138 -96
  36. package/dist/chat/logic/context-usage.js +13 -9
  37. package/dist/chat/logic/continue-after-stop.js +15 -19
  38. package/dist/chat/logic/effort.d.ts +14 -0
  39. package/dist/chat/logic/effort.js +34 -0
  40. package/dist/chat/logic/embedded-code.js +387 -326
  41. package/dist/chat/logic/fork.js +134 -110
  42. package/dist/chat/logic/generated-image.js +54 -23
  43. package/dist/chat/logic/goal.js +28 -20
  44. package/dist/chat/logic/handback.js +6 -6
  45. package/dist/chat/logic/json.js +2 -2
  46. package/dist/chat/logic/limit.js +46 -30
  47. package/dist/chat/logic/picker-entries.d.ts +5 -3
  48. package/dist/chat/logic/picker-entries.js +83 -43
  49. package/dist/chat/logic/resume-compaction.d.ts +14 -1
  50. package/dist/chat/logic/resume-compaction.js +93 -24
  51. package/dist/chat/logic/scrubber.js +188 -136
  52. package/dist/chat/logic/thought.js +13 -16
  53. package/dist/chat/logic/thread-cards.js +60 -48
  54. package/dist/chat/logic/timeline-copy.js +30 -38
  55. package/dist/chat/logic/timeline-target.js +92 -63
  56. package/dist/chat/logic/timeline.js +499 -355
  57. package/dist/chat/logic/tool-catalog.js +54 -34
  58. package/dist/chat/logic/tools.js +106 -82
  59. package/dist/chat/logic/visual-height.js +18 -18
  60. package/dist/chat/logic/visual-viewport.js +6 -3
  61. package/dist/chat/logic/welcome.js +9 -9
  62. package/dist/chat/logic/workflow.d.ts +10 -0
  63. package/dist/chat/logic/workflow.js +130 -32
  64. package/dist/chat/mentions.js +149 -109
  65. package/dist/chat/persisted-json.js +51 -54
  66. package/dist/chat/preferences.d.ts +4 -0
  67. package/dist/chat/preferences.js +162 -84
  68. package/dist/chat/prompt-hold.js +9 -9
  69. package/dist/chat/quote.js +21 -30
  70. package/dist/chat/reading-width.js +12 -10
  71. package/dist/chat/recent-messages.js +34 -21
  72. package/dist/chat/resume-compaction-dismissals.js +25 -5
  73. package/dist/chat/runtime-modes.js +3 -3
  74. package/dist/chat/send-key.js +11 -7
  75. package/dist/chat/stash.js +89 -69
  76. package/dist/chat/subagent-conversation.js +181 -139
  77. package/dist/chat/subagent-list.js +65 -67
  78. package/dist/chat/subagent-support.js +12 -7
  79. package/dist/chat/subagent-view.js +132 -44
  80. package/dist/chat/thumbnails.js +88 -60
  81. package/dist/chat/timeline-flash.js +24 -12
  82. package/dist/chat/timeline-scroll.js +116 -86
  83. package/dist/chat/ui/AccountPill.js +126 -15
  84. package/dist/chat/ui/AnsiOutput.js +62 -6
  85. package/dist/chat/ui/BookmarkMarker.js +231 -41
  86. package/dist/chat/ui/BookmarkSubmenu.js +165 -18
  87. package/dist/chat/ui/ChatActivity.js +649 -70
  88. package/dist/chat/ui/ChatReferenceChip.js +104 -9
  89. package/dist/chat/ui/CodeBlock.js +132 -58
  90. package/dist/chat/ui/Composer.js +866 -132
  91. package/dist/chat/ui/ComposerInput.js +309 -120
  92. package/dist/chat/ui/DiffPool.js +75 -14
  93. package/dist/chat/ui/EditDiff.js +160 -21
  94. package/dist/chat/ui/FadingWords.js +32 -3
  95. package/dist/chat/ui/GoalDock.js +235 -42
  96. package/dist/chat/ui/ImageView.js +617 -61
  97. package/dist/chat/ui/LimitState.js +446 -72
  98. package/dist/chat/ui/Markdown.js +991 -173
  99. package/dist/chat/ui/MermaidBlock.js +285 -79
  100. package/dist/chat/ui/MessageActions.js +251 -39
  101. package/dist/chat/ui/ModelMarks.js +55 -5
  102. package/dist/chat/ui/Pickers.js +664 -113
  103. package/dist/chat/ui/PromptComposer.js +281 -51
  104. package/dist/chat/ui/QuoteButton.js +151 -57
  105. package/dist/chat/ui/ResumeCompactionDock.d.ts +6 -2
  106. package/dist/chat/ui/ResumeCompactionDock.js +141 -6
  107. package/dist/chat/ui/RowTime.js +59 -5
  108. package/dist/chat/ui/RunSettings.js +1744 -154
  109. package/dist/chat/ui/Scrubber.js +517 -88
  110. package/dist/chat/ui/ShellCommand.js +183 -107
  111. package/dist/chat/ui/SubagentControls.js +212 -24
  112. package/dist/chat/ui/SubagentInfo.js +170 -13
  113. package/dist/chat/ui/SubagentStopButton.js +115 -24
  114. package/dist/chat/ui/SubagentTimeline.js +357 -91
  115. package/dist/chat/ui/Timeline.js +988 -476
  116. package/dist/chat/ui/TimelineMenu.js +552 -37
  117. package/dist/chat/ui/UnifiedDiff.js +234 -27
  118. package/dist/chat/ui/UploadThumb.js +37 -7
  119. package/dist/chat/ui/VisualDialogs.js +251 -20
  120. package/dist/chat/ui/VisualFrame.js +321 -95
  121. package/dist/chat/ui/Welcome.js +72 -7
  122. package/dist/chat/ui/chips.js +1 -1
  123. package/dist/chat/ui/code-lines.js +36 -36
  124. package/dist/chat/ui/code-streaming.js +1 -1
  125. package/dist/chat/ui/code-theme.js +7 -7
  126. package/dist/chat/ui/composer/ComposerControls.js +329 -21
  127. package/dist/chat/ui/composer/ComposerMenu.js +358 -30
  128. package/dist/chat/ui/composer/DraftParts.js +185 -11
  129. package/dist/chat/ui/composer/QueuedMessages.js +138 -13
  130. package/dist/chat/ui/composer/chips.js +29 -19
  131. package/dist/chat/ui/composer/editor.js +79 -63
  132. package/dist/chat/ui/composer/insert.js +26 -12
  133. package/dist/chat/ui/composer/key-handler.js +180 -127
  134. package/dist/chat/ui/composer/keys.js +90 -73
  135. package/dist/chat/ui/composer/menu-aria.js +18 -9
  136. package/dist/chat/ui/composer/placeholder.js +78 -31
  137. package/dist/chat/ui/composer/surface.js +13 -37
  138. package/dist/chat/ui/composer/use-chat-controls.js +230 -90
  139. package/dist/chat/ui/composer/use-compaction-offer.js +50 -18
  140. package/dist/chat/ui/composer/use-composer-draft.js +65 -34
  141. package/dist/chat/ui/composer/use-composer-menus.js +478 -193
  142. package/dist/chat/ui/composer/use-composer-submit.js +251 -109
  143. package/dist/chat/ui/composer/use-continuable-turn.js +33 -6
  144. package/dist/chat/ui/composer/use-draft-files.js +245 -93
  145. package/dist/chat/ui/composer/use-effort-stepper.d.ts +13 -0
  146. package/dist/chat/ui/composer/use-effort-stepper.js +88 -0
  147. package/dist/chat/ui/composer/use-notice.js +61 -16
  148. package/dist/chat/ui/composer/use-pending-requests.js +38 -17
  149. package/dist/chat/ui/composer/use-prompt-history.js +117 -45
  150. package/dist/chat/ui/composer/use-prompt-hold.js +119 -35
  151. package/dist/chat/ui/composer/use-take-back.js +94 -72
  152. package/dist/chat/ui/diff/ApprovalReview.js +101 -23
  153. package/dist/chat/ui/diff/DiffFallbackBoundary.js +21 -13
  154. package/dist/chat/ui/diff/DiffOmitted.js +56 -6
  155. package/dist/chat/ui/diff/DiffStack.js +92 -8
  156. package/dist/chat/ui/diff/DiffUnavailable.js +56 -6
  157. package/dist/chat/ui/diff/EditorEditDiff.js +263 -51
  158. package/dist/chat/ui/diff/EditorPatchDiff.js +39 -14
  159. package/dist/chat/ui/diff/LegacyDiffPool.js +27 -10
  160. package/dist/chat/ui/diff/LegacyEditDiff.js +97 -20
  161. package/dist/chat/ui/diff/LegacyUnifiedDiff.js +172 -42
  162. package/dist/chat/ui/diff/RawDiff.js +65 -5
  163. package/dist/chat/ui/diff/ReviewDiff.js +77 -5
  164. package/dist/chat/ui/diff/diff-props.js +1 -1
  165. package/dist/chat/ui/diff/diff-source-budget.js +46 -35
  166. package/dist/chat/ui/diff/editor-edit-model.js +18 -14
  167. package/dist/chat/ui/diff/review-plan.js +63 -40
  168. package/dist/chat/ui/diff/review-settle.js +24 -9
  169. package/dist/chat/ui/diff/syntax-runtime.js +236 -201
  170. package/dist/chat/ui/diff/use-review-stack.js +146 -25
  171. package/dist/chat/ui/diff-syntax.js +70 -58
  172. package/dist/chat/ui/diff-theme.js +31 -12
  173. package/dist/chat/ui/file-links.js +39 -10
  174. package/dist/chat/ui/find-reveal.js +29 -8
  175. package/dist/chat/ui/full-diff.js +17 -12
  176. package/dist/chat/ui/highlighter.js +143 -113
  177. package/dist/chat/ui/icons.js +16 -7
  178. package/dist/chat/ui/index.js +1 -1
  179. package/dist/chat/ui/intelligent-ui/UiBlockFrame.js +556 -82
  180. package/dist/chat/ui/intelligent-ui/UiFallbackPart.js +73 -5
  181. package/dist/chat/ui/intelligent-ui/UiReply.js +666 -262
  182. package/dist/chat/ui/intelligent-ui/block-local.js +59 -31
  183. package/dist/chat/ui/intelligent-ui/chart-data.js +77 -67
  184. package/dist/chat/ui/intelligent-ui/node-text.js +77 -91
  185. package/dist/chat/ui/intelligent-ui/registry.js +46 -46
  186. package/dist/chat/ui/intelligent-ui/render-context.js +1 -1
  187. package/dist/chat/ui/intelligent-ui/renderers/base-land.js +1 -1
  188. package/dist/chat/ui/intelligent-ui/renderers/binding.js +3 -3
  189. package/dist/chat/ui/intelligent-ui/renderers/chart.js +1223 -123
  190. package/dist/chat/ui/intelligent-ui/renderers/choices.js +312 -34
  191. package/dist/chat/ui/intelligent-ui/renderers/content.js +1241 -86
  192. package/dist/chat/ui/intelligent-ui/renderers/data.js +619 -54
  193. package/dist/chat/ui/intelligent-ui/renderers/inputs.js +868 -67
  194. package/dist/chat/ui/intelligent-ui/renderers/links.js +366 -62
  195. package/dist/chat/ui/intelligent-ui/renderers/map-slots.js +118 -60
  196. package/dist/chat/ui/intelligent-ui/renderers/map-style.js +85 -78
  197. package/dist/chat/ui/intelligent-ui/renderers/map-view.js +282 -217
  198. package/dist/chat/ui/intelligent-ui/renderers/map.js +621 -69
  199. package/dist/chat/ui/intelligent-ui/renderers/place-point.js +15 -8
  200. package/dist/chat/ui/intelligent-ui/renderers/structure.js +262 -20
  201. package/dist/chat/ui/intelligent-ui/renderers/text.js +674 -49
  202. package/dist/chat/ui/intelligent-ui/reply-parts.js +24 -15
  203. package/dist/chat/ui/intelligent-ui/table-data.js +97 -57
  204. package/dist/chat/ui/intelligent-ui/tones.js +31 -31
  205. package/dist/chat/ui/intelligent-ui/use-in-view.js +30 -12
  206. package/dist/chat/ui/intelligent-ui/use-later.js +28 -13
  207. package/dist/chat/ui/intelligent-ui/use-truncated.js +45 -21
  208. package/dist/chat/ui/intelligent-ui/use-ui-links.js +296 -109
  209. package/dist/chat/ui/intelligent-ui/use-ui-queries.js +256 -246
  210. package/dist/chat/ui/markdown-blocks.js +296 -262
  211. package/dist/chat/ui/mermaid.d.ts +8 -20
  212. package/dist/chat/ui/mermaid.js +47 -84
  213. package/dist/chat/ui/quote-selection.js +32 -29
  214. package/dist/chat/ui/rehype-chips.js +35 -23
  215. package/dist/chat/ui/rehype-fade.js +28 -17
  216. package/dist/chat/ui/remark-html-as-text.js +22 -15
  217. package/dist/chat/ui/reply-context.js +1 -1
  218. package/dist/chat/ui/reveal.js +161 -72
  219. package/dist/chat/ui/rows/ForksRow.js +226 -24
  220. package/dist/chat/ui/rows/GeneratedImageRow.js +541 -87
  221. package/dist/chat/ui/rows/MessageRows.js +1706 -159
  222. package/dist/chat/ui/rows/RowContainer.js +57 -7
  223. package/dist/chat/ui/rows/Rows.js +463 -54
  224. package/dist/chat/ui/rows/SubagentRow.js +577 -60
  225. package/dist/chat/ui/rows/TaskRow.js +359 -40
  226. package/dist/chat/ui/rows/VisualRow.js +233 -11
  227. package/dist/chat/ui/rows/WorkRows.d.ts +3 -0
  228. package/dist/chat/ui/rows/WorkRows.js +1945 -164
  229. package/dist/chat/ui/rows/WorkflowRow.js +756 -37
  230. package/dist/chat/ui/rows/row-rhythm.js +27 -17
  231. package/dist/chat/ui/theme-watch.js +26 -23
  232. package/dist/chat/ui/timestamp-format.js +4 -1
  233. package/dist/chat/ui/use-diff-source-tokens.js +70 -34
  234. package/dist/chat/ui/useToggleSet.js +51 -19
  235. package/dist/chat/ui/visual-theme.js +153 -128
  236. package/dist/chat/visual-bridge.js +123 -123
  237. package/dist/chat/visual-viewport.js +94 -83
  238. package/dist/chat/visuals.js +13 -5
  239. package/dist/host-hooks.d.ts +29 -0
  240. package/dist/host-hooks.js +78 -0
  241. package/dist/host.js +120 -48
  242. package/dist/index.js +1 -1
  243. package/dist/lazy.js +38 -32
  244. package/dist/locales/en/agent-chat.d.ts +42 -0
  245. package/dist/locales/en/agent-chat.js +755 -713
  246. package/dist/locales/en/agent-prompts.js +42 -42
  247. package/dist/locales/en/agent-providers.d.ts +1 -0
  248. package/dist/locales/en/agent-providers.js +166 -165
  249. package/dist/locales/en/agent-usage.d.ts +6 -0
  250. package/dist/locales/en/agent-usage.js +129 -123
  251. package/dist/locales/nl/agent-chat.d.ts +42 -0
  252. package/dist/locales/nl/agent-chat.js +755 -713
  253. package/dist/locales/nl/agent-prompts.js +42 -42
  254. package/dist/locales/nl/agent-providers.d.ts +1 -0
  255. package/dist/locales/nl/agent-providers.js +166 -165
  256. package/dist/locales/nl/agent-usage.d.ts +6 -0
  257. package/dist/locales/nl/agent-usage.js +129 -123
  258. package/dist/locales.js +14 -14
  259. package/dist/mounted-registry.js +31 -30
  260. package/dist/port-transport.js +122 -111
  261. package/dist/prompts/index.js +1 -1
  262. package/dist/prompts/logic/focus.js +15 -14
  263. package/dist/prompts/logic/keys.js +93 -59
  264. package/dist/prompts/logic/prompts.js +27 -14
  265. package/dist/prompts/logic/subjects.js +60 -46
  266. package/dist/prompts/logic/useFocusAfterAnswer.js +60 -20
  267. package/dist/prompts/logic/usePromptSession.js +88 -77
  268. package/dist/prompts/ui/ApprovalBody.js +246 -27
  269. package/dist/prompts/ui/PromptActions.js +215 -9
  270. package/dist/prompts/ui/PromptCard.js +215 -36
  271. package/dist/prompts/ui/PromptView.js +372 -34
  272. package/dist/prompts/ui/QuestionBody.js +269 -73
  273. package/dist/providers/AccountColors.js +36 -5
  274. package/dist/providers/AccountDetail.js +683 -50
  275. package/dist/providers/AccountVariables.js +139 -32
  276. package/dist/providers/AddAccountForm.js +125 -38
  277. package/dist/providers/CliDetail.js +343 -36
  278. package/dist/providers/InstallPage.js +644 -59
  279. package/dist/providers/ProviderList.d.ts +2 -1
  280. package/dist/providers/ProviderList.js +215 -23
  281. package/dist/providers/ProvidersPane.d.ts +4 -2
  282. package/dist/providers/ProvidersPane.js +244 -64
  283. package/dist/providers/account-actions.js +54 -30
  284. package/dist/providers/index.js +1 -1
  285. package/dist/providers/install-steps.js +12 -9
  286. package/dist/providers/pane-target.d.ts +3 -0
  287. package/dist/providers/pane-target.js +34 -13
  288. package/dist/providers/parts.js +62 -12
  289. package/dist/providers/provider-abilities.js +5 -5
  290. package/dist/providers/provider-groups.js +75 -40
  291. package/dist/providers/variables.js +73 -39
  292. package/dist/scope.js +6 -6
  293. package/dist/settings/sections.js +18 -18
  294. package/dist/state/chats.js +404 -192
  295. package/dist/state/index.js +1 -1
  296. package/dist/state/provider-accounts.js +70 -47
  297. package/dist/state/providers.js +45 -16
  298. package/dist/state/usage.js +154 -77
  299. package/dist/storage.js +69 -68
  300. package/dist/testing/index.js +1 -1
  301. package/dist/testing/prompts.js +105 -67
  302. package/dist/transport.js +10 -10
  303. package/dist/ui/PlainTextarea.js +27 -3
  304. package/dist/usage/LimitsList.js +646 -40
  305. package/dist/usage/UsageBreakdown.js +879 -38
  306. package/dist/usage/UsageChart.js +311 -32
  307. package/dist/usage/UsageDialog.js +46 -4
  308. package/dist/usage/UsageLimits.js +467 -34
  309. package/dist/usage/UsageLimitsCard.js +95 -11
  310. package/dist/usage/UsagePage.js +817 -96
  311. package/dist/usage/UsagePane.js +164 -10
  312. package/dist/usage/UsageSummary.js +151 -6
  313. package/dist/usage/UsageTiles.js +164 -14
  314. package/dist/usage/format.js +32 -32
  315. package/dist/usage/index.d.ts +1 -1
  316. package/dist/usage/index.js +2 -1
  317. package/dist/usage/limit-groups.d.ts +2 -0
  318. package/dist/usage/limit-groups.js +77 -59
  319. package/dist/usage/limits.js +78 -43
  320. package/dist/usage/money.js +20 -4
  321. package/dist/usage/summary.js +85 -64
  322. package/package.json +9 -9
  323. package/src/agents/ModelOptionControl.tsx +3 -1
  324. package/src/agents/option-words.ts +27 -0
  325. package/src/chat/account-choice.ts +41 -1
  326. package/src/chat/composer-effort.ts +32 -0
  327. package/src/chat/forks.ts +4 -5
  328. package/src/chat/index.ts +3 -1
  329. package/src/chat/logic/effort.ts +32 -0
  330. package/src/chat/logic/picker-entries.ts +45 -10
  331. package/src/chat/logic/resume-compaction.ts +95 -17
  332. package/src/chat/logic/timeline.ts +11 -3
  333. package/src/chat/logic/workflow.ts +86 -4
  334. package/src/chat/preferences.ts +35 -0
  335. package/src/chat/subagent-view.ts +2 -3
  336. package/src/chat/ui/AnsiOutput.tsx +1 -2
  337. package/src/chat/ui/BookmarkSubmenu.tsx +3 -3
  338. package/src/chat/ui/ChatActivity.tsx +14 -22
  339. package/src/chat/ui/ChatReferenceChip.tsx +2 -3
  340. package/src/chat/ui/Composer.tsx +15 -7
  341. package/src/chat/ui/EditDiff.tsx +2 -3
  342. package/src/chat/ui/LimitState.tsx +2 -2
  343. package/src/chat/ui/Markdown.tsx +10 -8
  344. package/src/chat/ui/MermaidBlock.tsx +57 -49
  345. package/src/chat/ui/Pickers.tsx +49 -29
  346. package/src/chat/ui/PromptComposer.tsx +7 -9
  347. package/src/chat/ui/ResumeCompactionDock.tsx +16 -4
  348. package/src/chat/ui/RunSettings.tsx +67 -28
  349. package/src/chat/ui/Scrubber.tsx +3 -3
  350. package/src/chat/ui/ShellCommand.tsx +2 -0
  351. package/src/chat/ui/SubagentInfo.tsx +2 -3
  352. package/src/chat/ui/SubagentTimeline.tsx +12 -16
  353. package/src/chat/ui/Timeline.tsx +6 -6
  354. package/src/chat/ui/UnifiedDiff.tsx +3 -4
  355. package/src/chat/ui/VisualFrame.tsx +5 -8
  356. package/src/chat/ui/code-theme.ts +4 -4
  357. package/src/chat/ui/composer/placeholder.ts +2 -2
  358. package/src/chat/ui/composer/use-compaction-offer.ts +36 -16
  359. package/src/chat/ui/composer/use-composer-menus.ts +4 -9
  360. package/src/chat/ui/composer/use-composer-submit.ts +2 -1
  361. package/src/chat/ui/composer/use-effort-stepper.ts +56 -0
  362. package/src/chat/ui/composer/use-notice.ts +2 -2
  363. package/src/chat/ui/diff/EditorEditDiff.tsx +9 -13
  364. package/src/chat/ui/diff/LegacyEditDiff.tsx +12 -17
  365. package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +13 -21
  366. package/src/chat/ui/diff/use-review-stack.ts +4 -4
  367. package/src/chat/ui/diff-theme.ts +3 -3
  368. package/src/chat/ui/file-links.ts +2 -2
  369. package/src/chat/ui/intelligent-ui/UiReply.tsx +2 -0
  370. package/src/chat/ui/intelligent-ui/renderers/chart.tsx +3 -3
  371. package/src/chat/ui/intelligent-ui/renderers/content.tsx +5 -6
  372. package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +2 -1
  373. package/src/chat/ui/intelligent-ui/renderers/map.tsx +2 -1
  374. package/src/chat/ui/intelligent-ui/use-truncated.ts +16 -19
  375. package/src/chat/ui/intelligent-ui/use-ui-links.ts +3 -3
  376. package/src/chat/ui/mermaid.ts +52 -96
  377. package/src/chat/ui/rows/ForksRow.tsx +3 -5
  378. package/src/chat/ui/rows/GeneratedImageRow.tsx +2 -1
  379. package/src/chat/ui/rows/MessageRows.tsx +12 -21
  380. package/src/chat/ui/rows/SubagentRow.tsx +3 -3
  381. package/src/chat/ui/rows/TaskRow.tsx +1 -1
  382. package/src/chat/ui/rows/WorkRows.tsx +11 -6
  383. package/src/chat/ui/rows/WorkflowRow.tsx +144 -54
  384. package/src/chat/ui/useToggleSet.ts +15 -18
  385. package/src/chat/ui/visual-theme.ts +2 -3
  386. package/src/host-hooks.ts +113 -0
  387. package/src/lazy.tsx +2 -0
  388. package/src/locales/en/agent-chat.ts +142 -108
  389. package/src/locales/en/agent-prompts.ts +7 -7
  390. package/src/locales/en/agent-providers.ts +35 -34
  391. package/src/locales/en/agent-usage.ts +26 -20
  392. package/src/locales/nl/agent-chat.ts +134 -100
  393. package/src/locales/nl/agent-prompts.ts +5 -5
  394. package/src/locales/nl/agent-providers.ts +33 -32
  395. package/src/locales/nl/agent-usage.ts +25 -20
  396. package/src/providers/CliDetail.tsx +2 -1
  397. package/src/providers/InstallPage.tsx +2 -4
  398. package/src/providers/ProviderList.tsx +12 -2
  399. package/src/providers/ProvidersPane.tsx +45 -15
  400. package/src/providers/pane-target.ts +20 -4
  401. package/src/state/chats.ts +2 -2
  402. package/src/usage/LimitsList.tsx +12 -13
  403. package/src/usage/UsageBreakdown.tsx +17 -6
  404. package/src/usage/UsageLimits.tsx +2 -1
  405. package/src/usage/UsagePage.tsx +3 -3
  406. package/src/usage/index.ts +1 -1
  407. package/src/usage/limit-groups.ts +12 -0
  408. package/src/usage/limits.ts +2 -2
  409. package/src/usage/money.ts +1 -2
@@ -1,12 +1,11 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useContext, useMemo, useState } from 'react';
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { useContext, useState } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { Bot, Brain, Check, ChevronDown, CircleAlert, File, Info, MessageCircleQuestionMark, Reply, TriangleAlert, X } from 'lucide-react';
6
6
  import { WAITING_NOTE_PREFIX } from '@adecore/agent-contracts';
7
7
  import { fileBadge, formatBytes, isImageAttachment } from '../../attachments.js';
8
8
  import { useChatRow, useCurrentItem } from '../../../state/chats.js';
9
- import { useChatHost } from '../../../host.js';
10
9
  import { useChatScope } from '../../../scope.js';
11
10
  import { splitQuote } from '../../quote.js';
12
11
  import { jumpToTimelineItem } from '../../timeline-scroll.js';
@@ -26,115 +25,731 @@ import { ROW_GUTTER } from '../icons.js';
26
25
  import { useOpenForFind } from '../find-reveal.js';
27
26
  import { ReplyContext, UiReplyNavigationContext } from '../reply-context.js';
28
27
  import { UiReply } from '../intelligent-ui/UiReply.js';
28
+ import { useHostAttachmentUrl, useHostChatPlace, useHostReplyAuthor, useHostStreaming } from '../../../host-hooks.js';
29
29
  // A long prompt folds so the answer stays in view; the reader can open it.
30
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
30
31
  const USER_FOLD_LINES = 8;
31
32
  const USER_FOLD_CHARS = 600;
32
33
  /* A folded user prompt fades out at the bottom instead of cutting a line in half. */
33
34
  const FOLD = 'max-h-[10em] overflow-hidden [mask-image:linear-gradient(to_bottom,black_70%,transparent)]';
34
35
  function useReplyAuthor(chatId) {
35
- const host = useChatHost();
36
- const { id } = useChatScope();
37
- const context = useContext(ReplyContext);
38
- const author = host.useReplyAuthor(id, context?.chatId ?? chatId);
39
- return context !== null && context.chatId === undefined ? null : author;
36
+ const {
37
+ id
38
+ } = useChatScope();
39
+ const context = useContext(ReplyContext);
40
+ const author = useHostReplyAuthor(id, context?.chatId ?? chatId);
41
+ return context !== null && context.chatId === undefined ? null : author;
40
42
  }
41
43
  /*
42
44
  * A file attached to a message that is not a picture. `download` is what saves a blob URL: the shell
43
45
  * hands a link that opens a window to the system browser, which cannot reach a blob of this page.
44
46
  */
45
- function AttachmentLink({ chatId, attachment }) {
46
- const host = useChatHost();
47
- const { id } = useChatScope();
48
- const { url } = host.attachments.useUrl(id, chatId, attachment.id);
49
- const badge = fileBadge(attachment.name);
50
- return (_jsx(Tooltip, { label: attachment.name, children: _jsxs("a", { href: url ?? undefined, download: attachment.name, target: "_blank", rel: "noreferrer", "aria-disabled": url === null, className: "flex h-28 w-36 flex-col rounded-xl border border-border bg-surface-raised bg-clip-padding p-2.5 text-left hover:bg-surface-hover", children: [_jsx("span", { className: "flex h-6 min-w-6 items-center justify-center self-start rounded-md border border-border px-1.5 text-xs font-medium text-text-muted", children: badge ?? _jsx(Icon, { icon: File, size: 12 }) }), _jsx("span", { className: "mt-auto line-clamp-2 text-xs break-all text-text", children: attachment.name }), _jsx("span", { className: "text-xs text-text-faint", children: formatBytes(attachment.size) })] }) }));
47
+ function AttachmentLink(t0) {
48
+ const $ = _c(22);
49
+ const {
50
+ chatId,
51
+ attachment
52
+ } = t0;
53
+ const {
54
+ id
55
+ } = useChatScope();
56
+ const {
57
+ url
58
+ } = useHostAttachmentUrl(id, chatId, attachment.id);
59
+ let t1;
60
+ if ($[0] !== attachment.name) {
61
+ t1 = fileBadge(attachment.name);
62
+ $[0] = attachment.name;
63
+ $[1] = t1;
64
+ } else {
65
+ t1 = $[1];
66
+ }
67
+ const badge = t1;
68
+ const t2 = attachment.name;
69
+ const t3 = url ?? undefined;
70
+ const t4 = attachment.name;
71
+ const t5 = url === null;
72
+ let t6;
73
+ if ($[2] !== badge) {
74
+ t6 = badge ?? /*#__PURE__*/_jsx(Icon, {
75
+ icon: File,
76
+ size: 12
77
+ });
78
+ $[2] = badge;
79
+ $[3] = t6;
80
+ } else {
81
+ t6 = $[3];
82
+ }
83
+ let t7;
84
+ if ($[4] !== t6) {
85
+ t7 = /*#__PURE__*/_jsx("span", {
86
+ className: "flex h-6 min-w-6 items-center justify-center self-start rounded-md border border-border px-1.5 text-xs font-medium text-text-muted",
87
+ children: t6
88
+ });
89
+ $[4] = t6;
90
+ $[5] = t7;
91
+ } else {
92
+ t7 = $[5];
93
+ }
94
+ let t8;
95
+ if ($[6] !== attachment.name) {
96
+ t8 = /*#__PURE__*/_jsx("span", {
97
+ className: "mt-auto line-clamp-2 text-xs break-all text-text",
98
+ children: attachment.name
99
+ });
100
+ $[6] = attachment.name;
101
+ $[7] = t8;
102
+ } else {
103
+ t8 = $[7];
104
+ }
105
+ let t9;
106
+ if ($[8] !== attachment.size) {
107
+ t9 = formatBytes(attachment.size);
108
+ $[8] = attachment.size;
109
+ $[9] = t9;
110
+ } else {
111
+ t9 = $[9];
112
+ }
113
+ let t10;
114
+ if ($[10] !== t9) {
115
+ t10 = /*#__PURE__*/_jsx("span", {
116
+ className: "text-xs text-text-faint",
117
+ children: t9
118
+ });
119
+ $[10] = t9;
120
+ $[11] = t10;
121
+ } else {
122
+ t10 = $[11];
123
+ }
124
+ let t11;
125
+ if ($[12] !== attachment.name || $[13] !== t10 || $[14] !== t3 || $[15] !== t5 || $[16] !== t7 || $[17] !== t8) {
126
+ t11 = /*#__PURE__*/_jsxs("a", {
127
+ href: t3,
128
+ download: t4,
129
+ target: "_blank",
130
+ rel: "noreferrer",
131
+ "aria-disabled": t5,
132
+ className: "flex h-28 w-36 flex-col rounded-xl border border-border bg-surface-raised bg-clip-padding p-2.5 text-left hover:bg-surface-hover",
133
+ children: [t7, t8, t10]
134
+ });
135
+ $[12] = attachment.name;
136
+ $[13] = t10;
137
+ $[14] = t3;
138
+ $[15] = t5;
139
+ $[16] = t7;
140
+ $[17] = t8;
141
+ $[18] = t11;
142
+ } else {
143
+ t11 = $[18];
144
+ }
145
+ let t12;
146
+ if ($[19] !== attachment.name || $[20] !== t11) {
147
+ t12 = /*#__PURE__*/_jsx(Tooltip, {
148
+ label: t2,
149
+ children: t11
150
+ });
151
+ $[19] = attachment.name;
152
+ $[20] = t11;
153
+ $[21] = t12;
154
+ } else {
155
+ t12 = $[21];
156
+ }
157
+ return t12;
51
158
  }
52
159
  /* A picture attached to a message, which opens large. */
53
- function AttachmentThumb({ chatId, attachment }) {
54
- const host = useChatHost();
55
- const { id } = useChatScope();
56
- const source = host.attachments.useUrl(id, chatId, attachment.id);
57
- return _jsx(ImageThumb, { source: source, alt: attachment.name, className: "max-h-32 max-w-48 object-cover" });
160
+ function AttachmentThumb(t0) {
161
+ const $ = _c(3);
162
+ const {
163
+ chatId,
164
+ attachment
165
+ } = t0;
166
+ const {
167
+ id
168
+ } = useChatScope();
169
+ const source = useHostAttachmentUrl(id, chatId, attachment.id);
170
+ let t1;
171
+ if ($[0] !== attachment.name || $[1] !== source) {
172
+ t1 = /*#__PURE__*/_jsx(ImageThumb, {
173
+ source: source,
174
+ alt: attachment.name,
175
+ className: "max-h-32 max-w-48 object-cover"
176
+ });
177
+ $[0] = attachment.name;
178
+ $[1] = source;
179
+ $[2] = t1;
180
+ } else {
181
+ t1 = $[2];
182
+ }
183
+ return t1;
58
184
  }
59
- export function UserRow({ chatId, item }) {
60
- const { t } = useTranslation('agent-chat');
61
- const [open, setOpen] = useState(false);
62
- const long = item.text.split('\n').length > USER_FOLD_LINES || item.text.length > USER_FOLD_CHARS;
63
- const attachments = item.attachments ?? [];
64
- const chats = item.chats ?? [];
65
- const [missing, setMissing] = useState(false);
66
- const { keyOf } = useChatScope();
67
- useOpenForFind(item.id, 'text', setOpen);
68
- // A quote only leads somewhere when the message still opens with the blockquote it was sent with.
69
- const quoted = item.quoteSource === undefined ? null : splitQuote(item.text);
70
- const source = item.quoteSource?.itemId;
71
- function goToSource() {
72
- if (source !== undefined) {
73
- setMissing(false);
74
- jumpToTimelineItem(keyOf(chatId), source, { flash: true, onMissing: () => setMissing(true) });
75
- }
76
- }
77
- return (_jsxs("div", { "data-find-item": item.id, className: "flex flex-col items-end", children: [_jsx(MessageHeading, { children: t('rows.user.heading') }), attachments.length > 0 && (_jsx("div", { className: "mb-1.5 flex max-w-[80%] flex-wrap justify-end gap-1.5", children: attachments.map((attachment) => isImageAttachment(attachment.mime) ? (_jsx(AttachmentThumb, { chatId: chatId, attachment: attachment }, attachment.id)) : (_jsx(AttachmentLink, { chatId: chatId, attachment: attachment }, attachment.id))) })), chats.length > 0 && (_jsx("div", { className: "mb-1.5 flex max-w-[80%] flex-wrap justify-end gap-1.5", children: chats.map((id) => (_jsx(ChatReferenceChip, { chatId: id }, id))) })), item.uiChoice !== undefined && _jsx(ChoiceLine, { chatId: chatId, choice: item.uiChoice }), item.text !== '' && (_jsxs("div", { className: "relative max-w-[80%] rounded-2xl bg-surface-active px-3.5 py-2.5 text-sm wrap-anywhere text-text select-text", children: [_jsx("div", { "data-find-field": "text", className: clsx(long && !open && FOLD), children: quoted !== null && source !== undefined ? (_jsxs(_Fragment, { children: [_jsx(Tooltip, { label: t('composer.quote.goToSource'), children: _jsx("div", { role: "button", tabIndex: 0, className: "mb-2 cursor-pointer rounded-sm border-l-2 border-border-strong pl-2.5 text-text-muted hover:bg-text/5 hover:text-text focus-visible:outline-2 focus-visible:outline-accent", onClick: goToSource, onKeyDown: (e) => {
78
- if (e.key === 'Enter' || e.key === ' ') {
79
- e.preventDefault();
80
- goToSource();
81
- }
82
- }, children: _jsx(MessageMarkdown, { text: quoted.quote }) }) }), missing && _jsx("div", { className: "mb-2 text-xs text-text-faint", children: t('rows.user.quoteGone') }), quoted.rest !== '' && _jsx(MessageMarkdown, { text: quoted.rest, mentions: item.mentions, skills: item.skills })] })) : (_jsx(MessageMarkdown, { text: item.text, mentions: item.mentions, skills: item.skills })) }), long && (_jsxs("button", { className: "mt-1 flex items-center gap-1 text-xs text-text-muted hover:text-text", onClick: () => setOpen((o) => !o), children: [_jsx(Icon, { icon: ChevronDown, size: 12, className: clsx('transition-transform', open && 'rotate-180') }), ' ', open ? t('rows.user.showLess') : t('rows.user.showAll')] }))] }))] }));
185
+ export function UserRow(t0) {
186
+ const $ = _c(43);
187
+ const {
188
+ chatId,
189
+ item
190
+ } = t0;
191
+ const {
192
+ t
193
+ } = useTranslation("agent-chat");
194
+ const [open, setOpen] = useState(false);
195
+ let t1;
196
+ if ($[0] !== item.text) {
197
+ t1 = item.text.split("\n").length > USER_FOLD_LINES || item.text.length > USER_FOLD_CHARS;
198
+ $[0] = item.text;
199
+ $[1] = t1;
200
+ } else {
201
+ t1 = $[1];
202
+ }
203
+ const long = t1;
204
+ let t2;
205
+ if ($[2] !== item.attachments) {
206
+ t2 = item.attachments ?? [];
207
+ $[2] = item.attachments;
208
+ $[3] = t2;
209
+ } else {
210
+ t2 = $[3];
211
+ }
212
+ const attachments = t2;
213
+ let t3;
214
+ if ($[4] !== item.chats) {
215
+ t3 = item.chats ?? [];
216
+ $[4] = item.chats;
217
+ $[5] = t3;
218
+ } else {
219
+ t3 = $[5];
220
+ }
221
+ const chats = t3;
222
+ const [missing, setMissing] = useState(false);
223
+ const {
224
+ keyOf
225
+ } = useChatScope();
226
+ useOpenForFind(item.id, "text", setOpen);
227
+ let t4;
228
+ if ($[6] !== item.quoteSource || $[7] !== item.text) {
229
+ t4 = item.quoteSource === undefined ? null : splitQuote(item.text);
230
+ $[6] = item.quoteSource;
231
+ $[7] = item.text;
232
+ $[8] = t4;
233
+ } else {
234
+ t4 = $[8];
235
+ }
236
+ const quoted = t4;
237
+ const source = item.quoteSource?.itemId;
238
+ let t5;
239
+ if ($[9] !== chatId || $[10] !== keyOf || $[11] !== source) {
240
+ t5 = function goToSource() {
241
+ if (source !== undefined) {
242
+ setMissing(false);
243
+ jumpToTimelineItem(keyOf(chatId), source, {
244
+ flash: true,
245
+ onMissing: () => setMissing(true)
246
+ });
247
+ }
248
+ };
249
+ $[9] = chatId;
250
+ $[10] = keyOf;
251
+ $[11] = source;
252
+ $[12] = t5;
253
+ } else {
254
+ t5 = $[12];
255
+ }
256
+ const goToSource = t5;
257
+ const t6 = item.id;
258
+ let t7;
259
+ if ($[13] !== t) {
260
+ t7 = t("rows.user.heading");
261
+ $[13] = t;
262
+ $[14] = t7;
263
+ } else {
264
+ t7 = $[14];
265
+ }
266
+ let t8;
267
+ if ($[15] !== t7) {
268
+ t8 = /*#__PURE__*/_jsx(MessageHeading, {
269
+ children: t7
270
+ });
271
+ $[15] = t7;
272
+ $[16] = t8;
273
+ } else {
274
+ t8 = $[16];
275
+ }
276
+ let t9;
277
+ if ($[17] !== attachments || $[18] !== chatId) {
278
+ t9 = attachments.length > 0 && /*#__PURE__*/_jsx("div", {
279
+ className: "mb-1.5 flex max-w-[80%] flex-wrap justify-end gap-1.5",
280
+ children: attachments.map(attachment => isImageAttachment(attachment.mime) ? /*#__PURE__*/_jsx(AttachmentThumb, {
281
+ chatId: chatId,
282
+ attachment: attachment
283
+ }, attachment.id) : /*#__PURE__*/_jsx(AttachmentLink, {
284
+ chatId: chatId,
285
+ attachment: attachment
286
+ }, attachment.id))
287
+ });
288
+ $[17] = attachments;
289
+ $[18] = chatId;
290
+ $[19] = t9;
291
+ } else {
292
+ t9 = $[19];
293
+ }
294
+ let t10;
295
+ if ($[20] !== chats) {
296
+ t10 = chats.length > 0 && /*#__PURE__*/_jsx("div", {
297
+ className: "mb-1.5 flex max-w-[80%] flex-wrap justify-end gap-1.5",
298
+ children: chats.map(_temp)
299
+ });
300
+ $[20] = chats;
301
+ $[21] = t10;
302
+ } else {
303
+ t10 = $[21];
304
+ }
305
+ let t11;
306
+ if ($[22] !== chatId || $[23] !== item.uiChoice) {
307
+ t11 = item.uiChoice !== undefined && /*#__PURE__*/_jsx(ChoiceLine, {
308
+ chatId: chatId,
309
+ choice: item.uiChoice
310
+ });
311
+ $[22] = chatId;
312
+ $[23] = item.uiChoice;
313
+ $[24] = t11;
314
+ } else {
315
+ t11 = $[24];
316
+ }
317
+ let t12;
318
+ if ($[25] !== goToSource || $[26] !== item.mentions || $[27] !== item.skills || $[28] !== item.text || $[29] !== long || $[30] !== missing || $[31] !== open || $[32] !== quoted || $[33] !== source || $[34] !== t) {
319
+ t12 = item.text !== "" && /*#__PURE__*/_jsxs("div", {
320
+ className: "relative max-w-[80%] rounded-2xl bg-surface-active px-3.5 py-2.5 text-sm wrap-anywhere text-text select-text",
321
+ children: [/*#__PURE__*/_jsx("div", {
322
+ "data-find-field": "text",
323
+ className: clsx(long && !open && FOLD),
324
+ children: quoted !== null && source !== undefined ? /*#__PURE__*/_jsxs(_Fragment, {
325
+ children: [/*#__PURE__*/_jsx(Tooltip, {
326
+ label: t("composer.quote.goToSource"),
327
+ children: /*#__PURE__*/_jsx("div", {
328
+ role: "button",
329
+ tabIndex: 0,
330
+ className: "mb-2 cursor-pointer rounded-sm border-l-2 border-border-strong pl-2.5 text-text-muted hover:bg-text/5 hover:text-text focus-visible:outline-2 focus-visible:outline-accent",
331
+ onClick: goToSource,
332
+ onKeyDown: e => {
333
+ if (e.key === "Enter" || e.key === " ") {
334
+ e.preventDefault();
335
+ goToSource();
336
+ }
337
+ },
338
+ children: /*#__PURE__*/_jsx(MessageMarkdown, {
339
+ text: quoted.quote
340
+ })
341
+ })
342
+ }), missing && /*#__PURE__*/_jsx("div", {
343
+ className: "mb-2 text-xs text-text-faint",
344
+ children: t("rows.user.quoteGone")
345
+ }), quoted.rest !== "" && /*#__PURE__*/_jsx(MessageMarkdown, {
346
+ text: quoted.rest,
347
+ mentions: item.mentions,
348
+ skills: item.skills
349
+ })]
350
+ }) : /*#__PURE__*/_jsx(MessageMarkdown, {
351
+ text: item.text,
352
+ mentions: item.mentions,
353
+ skills: item.skills
354
+ })
355
+ }), long && /*#__PURE__*/_jsxs("button", {
356
+ className: "mt-1 flex items-center gap-1 text-xs text-text-muted hover:text-text",
357
+ onClick: () => setOpen(_temp2),
358
+ children: [/*#__PURE__*/_jsx(Icon, {
359
+ icon: ChevronDown,
360
+ size: 12,
361
+ className: clsx("transition-transform", open && "rotate-180")
362
+ }), " ", open ? t("rows.user.showLess") : t("rows.user.showAll")]
363
+ })]
364
+ });
365
+ $[25] = goToSource;
366
+ $[26] = item.mentions;
367
+ $[27] = item.skills;
368
+ $[28] = item.text;
369
+ $[29] = long;
370
+ $[30] = missing;
371
+ $[31] = open;
372
+ $[32] = quoted;
373
+ $[33] = source;
374
+ $[34] = t;
375
+ $[35] = t12;
376
+ } else {
377
+ t12 = $[35];
378
+ }
379
+ let t13;
380
+ if ($[36] !== item.id || $[37] !== t10 || $[38] !== t11 || $[39] !== t12 || $[40] !== t8 || $[41] !== t9) {
381
+ t13 = /*#__PURE__*/_jsxs("div", {
382
+ "data-find-item": t6,
383
+ className: "flex flex-col items-end",
384
+ children: [t8, t9, t10, t11, t12]
385
+ });
386
+ $[36] = item.id;
387
+ $[37] = t10;
388
+ $[38] = t11;
389
+ $[39] = t12;
390
+ $[40] = t8;
391
+ $[41] = t9;
392
+ $[42] = t13;
393
+ } else {
394
+ t13 = $[42];
395
+ }
396
+ return t13;
83
397
  }
84
398
  /*
85
399
  * The choice a message answers. The label stays out of the message, which holds exactly what the agent
86
400
  * read, and out of a copied selection; a screen reader hears it between the heading and the message.
87
401
  */
88
- function ChoiceLine({ chatId, choice }) {
89
- const { t } = useTranslation('agent-chat');
90
- const inherited = useContext(UiReplyNavigationContext);
91
- const navigation = inherited?.chatId === chatId ? inherited : null;
92
- const Tag = navigation ? 'button' : 'div';
93
- return (_jsxs(Tag, { type: navigation ? 'button' : undefined, onClick: navigation ? () => navigation.reveal(choice) : undefined, className: clsx('mb-1 flex max-w-[80%] items-start gap-1.5 px-1 text-left text-xs text-text-muted select-none', navigation && 'rounded-md hover:text-text focus-visible:outline-2 focus-visible:outline-accent'), children: [_jsx(Icon, { icon: Reply, size: 12, className: "mt-1 shrink-0" }), _jsx("span", { className: "min-w-0 wrap-anywhere", children: choice.older
94
- ? t('blocks.choseOlder', { label: choice.label, time: formatMoment(choice.sourceAt) })
95
- : t('blocks.chose', { label: choice.label }) })] }));
402
+ function _temp2(o) {
403
+ return !o;
404
+ }
405
+ function _temp(id) {
406
+ return /*#__PURE__*/_jsx(ChatReferenceChip, {
407
+ chatId: id
408
+ }, id);
409
+ }
410
+ function ChoiceLine(t0) {
411
+ const $ = _c(19);
412
+ const {
413
+ chatId,
414
+ choice
415
+ } = t0;
416
+ const {
417
+ t
418
+ } = useTranslation("agent-chat");
419
+ const inherited = useContext(UiReplyNavigationContext);
420
+ const navigation = inherited?.chatId === chatId ? inherited : null;
421
+ const Tag = navigation ? "button" : "div";
422
+ const t1 = navigation ? "button" : undefined;
423
+ let t2;
424
+ if ($[0] !== choice || $[1] !== navigation) {
425
+ t2 = navigation ? () => navigation.reveal(choice) : undefined;
426
+ $[0] = choice;
427
+ $[1] = navigation;
428
+ $[2] = t2;
429
+ } else {
430
+ t2 = $[2];
431
+ }
432
+ const t3 = navigation && "rounded-md hover:text-text focus-visible:outline-2 focus-visible:outline-accent";
433
+ let t4;
434
+ if ($[3] !== t3) {
435
+ t4 = clsx("mb-1 flex max-w-[80%] items-start gap-1.5 px-1 text-left text-xs text-text-muted select-none", t3);
436
+ $[3] = t3;
437
+ $[4] = t4;
438
+ } else {
439
+ t4 = $[4];
440
+ }
441
+ let t5;
442
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
443
+ t5 = /*#__PURE__*/_jsx(Icon, {
444
+ icon: Reply,
445
+ size: 12,
446
+ className: "mt-1 shrink-0"
447
+ });
448
+ $[5] = t5;
449
+ } else {
450
+ t5 = $[5];
451
+ }
452
+ let t6;
453
+ if ($[6] !== choice.label || $[7] !== choice.older || $[8] !== choice.sourceAt || $[9] !== t) {
454
+ t6 = choice.older ? t("blocks.choseOlder", {
455
+ label: choice.label,
456
+ time: formatMoment(choice.sourceAt)
457
+ }) : t("blocks.chose", {
458
+ label: choice.label
459
+ });
460
+ $[6] = choice.label;
461
+ $[7] = choice.older;
462
+ $[8] = choice.sourceAt;
463
+ $[9] = t;
464
+ $[10] = t6;
465
+ } else {
466
+ t6 = $[10];
467
+ }
468
+ let t7;
469
+ if ($[11] !== t6) {
470
+ t7 = /*#__PURE__*/_jsx("span", {
471
+ className: "min-w-0 wrap-anywhere",
472
+ children: t6
473
+ });
474
+ $[11] = t6;
475
+ $[12] = t7;
476
+ } else {
477
+ t7 = $[12];
478
+ }
479
+ let t8;
480
+ if ($[13] !== Tag || $[14] !== t1 || $[15] !== t2 || $[16] !== t4 || $[17] !== t7) {
481
+ t8 = /*#__PURE__*/_jsxs(Tag, {
482
+ type: t1,
483
+ onClick: t2,
484
+ className: t4,
485
+ children: [t5, t7]
486
+ });
487
+ $[13] = Tag;
488
+ $[14] = t1;
489
+ $[15] = t2;
490
+ $[16] = t4;
491
+ $[17] = t7;
492
+ $[18] = t8;
493
+ } else {
494
+ t8 = $[18];
495
+ }
496
+ return t8;
96
497
  }
97
498
  /*
98
499
  * Who wrote a message, for a screen reader only: one heading per message is what lets VoiceOver's
99
500
  * rotor walk a thread from message to message. `select-none`, so a selection copied across two
100
501
  * messages does not pick the names up.
101
502
  */
102
- function MessageHeading({ children }) {
103
- return _jsx("h3", { className: "sr-only select-none", children: children });
503
+ function MessageHeading(t0) {
504
+ const $ = _c(2);
505
+ const {
506
+ children
507
+ } = t0;
508
+ let t1;
509
+ if ($[0] !== children) {
510
+ t1 = /*#__PURE__*/_jsx("h3", {
511
+ className: "sr-only select-none",
512
+ children: children
513
+ });
514
+ $[0] = children;
515
+ $[1] = t1;
516
+ } else {
517
+ t1 = $[1];
518
+ }
519
+ return t1;
104
520
  }
105
521
  /* The report a subagent handed back, drawn as a reply under a label of its own. */
106
- export function ReportRow({ id, text }) {
107
- const { t } = useTranslation('agent-chat');
108
- return (_jsxs("div", { "data-find-item": id, className: "-mx-1 px-1 pb-2", children: [_jsx(MessageHeading, { children: t('rows.report.heading') }), _jsx("div", { "aria-hidden": true, className: "mb-1 text-xs font-medium text-text-faint select-none", children: t('rows.report.heading') }), _jsx("div", { "data-find-field": "text", "data-quote-answer": true, className: "contents", children: _jsx(ReplyMarkdown, { text: text, streaming: false }) })] }));
522
+ export function ReportRow(t0) {
523
+ const $ = _c(15);
524
+ const {
525
+ id,
526
+ text
527
+ } = t0;
528
+ const {
529
+ t
530
+ } = useTranslation("agent-chat");
531
+ let t1;
532
+ if ($[0] !== t) {
533
+ t1 = t("rows.report.heading");
534
+ $[0] = t;
535
+ $[1] = t1;
536
+ } else {
537
+ t1 = $[1];
538
+ }
539
+ let t2;
540
+ if ($[2] !== t1) {
541
+ t2 = /*#__PURE__*/_jsx(MessageHeading, {
542
+ children: t1
543
+ });
544
+ $[2] = t1;
545
+ $[3] = t2;
546
+ } else {
547
+ t2 = $[3];
548
+ }
549
+ let t3;
550
+ if ($[4] !== t) {
551
+ t3 = t("rows.report.heading");
552
+ $[4] = t;
553
+ $[5] = t3;
554
+ } else {
555
+ t3 = $[5];
556
+ }
557
+ let t4;
558
+ if ($[6] !== t3) {
559
+ t4 = /*#__PURE__*/_jsx("div", {
560
+ "aria-hidden": true,
561
+ className: "mb-1 text-xs font-medium text-text-faint select-none",
562
+ children: t3
563
+ });
564
+ $[6] = t3;
565
+ $[7] = t4;
566
+ } else {
567
+ t4 = $[7];
568
+ }
569
+ let t5;
570
+ if ($[8] !== text) {
571
+ t5 = /*#__PURE__*/_jsx("div", {
572
+ "data-find-field": "text",
573
+ "data-quote-answer": true,
574
+ className: "contents",
575
+ children: /*#__PURE__*/_jsx(ReplyMarkdown, {
576
+ text: text,
577
+ streaming: false
578
+ })
579
+ });
580
+ $[8] = text;
581
+ $[9] = t5;
582
+ } else {
583
+ t5 = $[9];
584
+ }
585
+ let t6;
586
+ if ($[10] !== id || $[11] !== t2 || $[12] !== t4 || $[13] !== t5) {
587
+ t6 = /*#__PURE__*/_jsxs("div", {
588
+ "data-find-item": id,
589
+ className: "-mx-1 px-1 pb-2",
590
+ children: [t2, t4, t5]
591
+ });
592
+ $[10] = id;
593
+ $[11] = t2;
594
+ $[12] = t4;
595
+ $[13] = t5;
596
+ $[14] = t6;
597
+ } else {
598
+ t6 = $[14];
599
+ }
600
+ return t6;
109
601
  }
110
602
  /* The heading of a reply, named after its author when the host names one and after the agent the chat runs otherwise. */
111
- function ReplyHeading({ chatId }) {
112
- const { t } = useTranslation('agent-chat');
113
- const context = useContext(ReplyContext);
114
- const author = useReplyAuthor(chatId);
115
- const kind = useChatRow(chatId, (row) => row?.info.provider);
116
- const name = useProviders((s) => s.providers.find((provider) => provider.kind === (context?.provider ?? kind))?.name);
117
- return _jsx(MessageHeading, { children: author?.name ?? name ?? t('rows.reply.agent') });
603
+ function ReplyHeading(t0) {
604
+ const $ = _c(9);
605
+ const {
606
+ chatId
607
+ } = t0;
608
+ const {
609
+ t
610
+ } = useTranslation("agent-chat");
611
+ const context = useContext(ReplyContext);
612
+ const author = useReplyAuthor(chatId);
613
+ const kind = useChatRow(chatId, _temp3);
614
+ let t1;
615
+ if ($[0] !== context?.provider || $[1] !== kind) {
616
+ t1 = s => s.providers.find(provider => provider.kind === (context?.provider ?? kind))?.name;
617
+ $[0] = context?.provider;
618
+ $[1] = kind;
619
+ $[2] = t1;
620
+ } else {
621
+ t1 = $[2];
622
+ }
623
+ const name = useProviders(t1);
624
+ let t2;
625
+ if ($[3] !== author?.name || $[4] !== name || $[5] !== t) {
626
+ t2 = author?.name ?? name ?? t("rows.reply.agent");
627
+ $[3] = author?.name;
628
+ $[4] = name;
629
+ $[5] = t;
630
+ $[6] = t2;
631
+ } else {
632
+ t2 = $[6];
633
+ }
634
+ let t3;
635
+ if ($[7] !== t2) {
636
+ t3 = /*#__PURE__*/_jsx(MessageHeading, {
637
+ children: t2
638
+ });
639
+ $[7] = t2;
640
+ $[8] = t3;
641
+ } else {
642
+ t3 = $[8];
643
+ }
644
+ return t3;
118
645
  }
119
646
  /*
120
647
  * The line over a reply with who wrote it and how long ago, when the host names its author. A screen
121
648
  * reader hears the name from the reply's own heading, so this line is for the eye only.
122
649
  */
123
- export function ReplyHeader({ chatId, at }) {
124
- const author = useReplyAuthor(chatId);
125
- if (author === null) {
126
- return null;
127
- }
128
- return (_jsxs("div", { "aria-hidden": true, className: "mb-1 flex h-6 items-center gap-2 text-sm font-medium text-text select-none", children: [author.mark, _jsx("span", { className: "min-w-0 truncate", children: author.name }), at !== null && _jsx(ReplyAge, { at: at })] }));
650
+ function _temp3(row) {
651
+ return row?.info.provider;
652
+ }
653
+ export function ReplyHeader(t0) {
654
+ const $ = _c(8);
655
+ const {
656
+ chatId,
657
+ at
658
+ } = t0;
659
+ const author = useReplyAuthor(chatId);
660
+ if (author === null) {
661
+ return null;
662
+ }
663
+ let t1;
664
+ if ($[0] !== author.name) {
665
+ t1 = /*#__PURE__*/_jsx("span", {
666
+ className: "min-w-0 truncate",
667
+ children: author.name
668
+ });
669
+ $[0] = author.name;
670
+ $[1] = t1;
671
+ } else {
672
+ t1 = $[1];
673
+ }
674
+ let t2;
675
+ if ($[2] !== at) {
676
+ t2 = at !== null && /*#__PURE__*/_jsx(ReplyAge, {
677
+ at: at
678
+ });
679
+ $[2] = at;
680
+ $[3] = t2;
681
+ } else {
682
+ t2 = $[3];
683
+ }
684
+ let t3;
685
+ if ($[4] !== author.mark || $[5] !== t1 || $[6] !== t2) {
686
+ t3 = /*#__PURE__*/_jsxs("div", {
687
+ "aria-hidden": true,
688
+ className: "mb-1 flex h-6 items-center gap-2 text-sm font-medium text-text select-none",
689
+ children: [author.mark, t1, t2]
690
+ });
691
+ $[4] = author.mark;
692
+ $[5] = t1;
693
+ $[6] = t2;
694
+ $[7] = t3;
695
+ } else {
696
+ t3 = $[7];
697
+ }
698
+ return t3;
129
699
  }
130
- function ReplyAge({ at }) {
131
- const ref = useTickingText(() => formatAgo(Date.now() - at), 30_000);
132
- return _jsx("span", { ref: ref, className: "shrink-0 font-normal text-text-faint" });
700
+ function ReplyAge(t0) {
701
+ const $ = _c(4);
702
+ const {
703
+ at
704
+ } = t0;
705
+ let t1;
706
+ if ($[0] !== at) {
707
+ t1 = () => formatAgo(Date.now() - at);
708
+ $[0] = at;
709
+ $[1] = t1;
710
+ } else {
711
+ t1 = $[1];
712
+ }
713
+ const ref = useTickingText(t1, 30000);
714
+ let t2;
715
+ if ($[2] !== ref) {
716
+ t2 = /*#__PURE__*/_jsx("span", {
717
+ ref: ref,
718
+ className: "shrink-0 font-normal text-text-faint"
719
+ });
720
+ $[2] = ref;
721
+ $[3] = t2;
722
+ } else {
723
+ t2 = $[3];
724
+ }
725
+ return t2;
133
726
  }
134
727
  /* The line that stands where the next words will land; a component, so the word is read at render and not at import. */
135
728
  function Writing() {
136
- const { t } = useTranslation('agent-chat');
137
- return _jsx("span", { className: "chat-live-text text-sm", children: t('rows.reply.writing') });
729
+ const $ = _c(4);
730
+ const {
731
+ t
732
+ } = useTranslation("agent-chat");
733
+ let t0;
734
+ if ($[0] !== t) {
735
+ t0 = t("rows.reply.writing");
736
+ $[0] = t;
737
+ $[1] = t0;
738
+ } else {
739
+ t0 = $[1];
740
+ }
741
+ let t1;
742
+ if ($[2] !== t0) {
743
+ t1 = /*#__PURE__*/_jsx("span", {
744
+ className: "chat-live-text text-sm",
745
+ children: t0
746
+ });
747
+ $[2] = t0;
748
+ $[3] = t1;
749
+ } else {
750
+ t1 = $[3];
751
+ }
752
+ return t1;
138
753
  }
139
754
  /*
140
755
  * A reply. A word at a time, it follows the text as it arrives. A block at a time, the blocks that
@@ -142,124 +757,1056 @@ function Writing() {
142
757
  * it says it is being written and fades in once it is done. Only a row that saw the reply being
143
758
  * written fades anything: an old reply scrolled back into view just stands there.
144
759
  */
145
- export function AssistantRow({ chatId, item: derived }) {
146
- const host = useChatHost();
147
- const item = useCurrentItem(chatId, derived);
148
- const scope = useChatScope();
149
- const context = useContext(ReplyContext);
150
- const reply = useMemo(() => (context === null && !item.parentToolUseId ? { scopeId: scope.id, chatId, itemId: item.id, streaming: item.streaming } : undefined), [context, item.parentToolUseId, scope.id, chatId, item.id, item.streaming]);
151
- const mode = host.useStreaming();
152
- const [sawWriting] = useState(item.streaming);
153
- const live = mode === 'words' && item.streaming;
154
- const reveal = useRevealedText(item.text, live);
155
- if (item.ui?.length && !item.parentToolUseId && !(mode === 'whole' && item.streaming)) {
156
- return (_jsxs("div", { "data-find-item": item.id, className: "-mx-1 px-1 pb-2", children: [_jsx(ReplyHeading, { chatId: chatId }), _jsx("div", { "data-find-field": "text", "data-quote-answer": true, className: "contents", children: _jsx(UiReply, { text: item.text, blocks: item.ui, answers: item.uiAnswers, queries: item.uiQueries, reply: reply, context: { scopeId: scope.id, chatId, itemId: item.id, phase: item.streaming ? 'streaming' : 'final' } }) })] }));
760
+ export function AssistantRow(t0) {
761
+ const $ = _c(63);
762
+ const {
763
+ chatId,
764
+ item: derived
765
+ } = t0;
766
+ const item = useCurrentItem(chatId, derived);
767
+ const scope = useChatScope();
768
+ const context = useContext(ReplyContext);
769
+ let t1;
770
+ if ($[0] !== chatId || $[1] !== context || $[2] !== item.id || $[3] !== item.parentToolUseId || $[4] !== item.streaming || $[5] !== scope) {
771
+ t1 = context === null && !item.parentToolUseId ? {
772
+ scopeId: scope.id,
773
+ chatId,
774
+ itemId: item.id,
775
+ streaming: item.streaming
776
+ } : undefined;
777
+ $[0] = chatId;
778
+ $[1] = context;
779
+ $[2] = item.id;
780
+ $[3] = item.parentToolUseId;
781
+ $[4] = item.streaming;
782
+ $[5] = scope;
783
+ $[6] = t1;
784
+ } else {
785
+ t1 = $[6];
786
+ }
787
+ const reply = t1;
788
+ const mode = useHostStreaming();
789
+ const [sawWriting] = useState(item.streaming);
790
+ const live = mode === "words" && item.streaming;
791
+ const reveal = useRevealedText(item.text, live);
792
+ if (item.ui?.length && !item.parentToolUseId && !(mode === "whole" && item.streaming)) {
793
+ let t2;
794
+ if ($[7] !== chatId) {
795
+ t2 = /*#__PURE__*/_jsx(ReplyHeading, {
796
+ chatId: chatId
797
+ });
798
+ $[7] = chatId;
799
+ $[8] = t2;
800
+ } else {
801
+ t2 = $[8];
802
+ }
803
+ const t3 = item.streaming ? "streaming" : "final";
804
+ let t4;
805
+ if ($[9] !== chatId || $[10] !== item.id || $[11] !== scope.id || $[12] !== t3) {
806
+ t4 = {
807
+ scopeId: scope.id,
808
+ chatId,
809
+ itemId: item.id,
810
+ phase: t3
811
+ };
812
+ $[9] = chatId;
813
+ $[10] = item.id;
814
+ $[11] = scope.id;
815
+ $[12] = t3;
816
+ $[13] = t4;
817
+ } else {
818
+ t4 = $[13];
819
+ }
820
+ let t5;
821
+ if ($[14] !== item.text || $[15] !== item.ui || $[16] !== item.uiAnswers || $[17] !== item.uiQueries || $[18] !== reply || $[19] !== t4) {
822
+ t5 = /*#__PURE__*/_jsx("div", {
823
+ "data-find-field": "text",
824
+ "data-quote-answer": true,
825
+ className: "contents",
826
+ children: /*#__PURE__*/_jsx(UiReply, {
827
+ text: item.text,
828
+ blocks: item.ui,
829
+ answers: item.uiAnswers,
830
+ queries: item.uiQueries,
831
+ reply: reply,
832
+ context: t4
833
+ })
834
+ });
835
+ $[14] = item.text;
836
+ $[15] = item.ui;
837
+ $[16] = item.uiAnswers;
838
+ $[17] = item.uiQueries;
839
+ $[18] = reply;
840
+ $[19] = t4;
841
+ $[20] = t5;
842
+ } else {
843
+ t5 = $[20];
844
+ }
845
+ let t6;
846
+ if ($[21] !== item.id || $[22] !== t2 || $[23] !== t5) {
847
+ t6 = /*#__PURE__*/_jsxs("div", {
848
+ "data-find-item": item.id,
849
+ className: "-mx-1 px-1 pb-2",
850
+ children: [t2, t5]
851
+ });
852
+ $[21] = item.id;
853
+ $[22] = t2;
854
+ $[23] = t5;
855
+ $[24] = t6;
856
+ } else {
857
+ t6 = $[24];
858
+ }
859
+ return t6;
860
+ }
861
+ if (mode === "blocks") {
862
+ let t2;
863
+ if ($[25] !== item.streaming || $[26] !== item.text) {
864
+ t2 = item.streaming ? settledBlocksText(item.text) : item.text;
865
+ $[25] = item.streaming;
866
+ $[26] = item.text;
867
+ $[27] = t2;
868
+ } else {
869
+ t2 = $[27];
870
+ }
871
+ const settled = t2;
872
+ let t3;
873
+ if ($[28] !== chatId) {
874
+ t3 = /*#__PURE__*/_jsx(ReplyHeading, {
875
+ chatId: chatId
876
+ });
877
+ $[28] = chatId;
878
+ $[29] = t3;
879
+ } else {
880
+ t3 = $[29];
157
881
  }
158
- if (mode === 'blocks') {
159
- const settled = item.streaming ? settledBlocksText(item.text) : item.text;
160
- return (_jsxs("div", { "data-find-item": item.id, className: "-mx-1 px-1 pb-2", children: [_jsx(ReplyHeading, { chatId: chatId }), settled !== '' && (_jsx("div", { "data-find-field": "text", "data-quote-answer": true, className: "contents", children: _jsx(ReplyMarkdown, { text: settled, streaming: false, arriving: sawWriting, reply: reply }) })), item.streaming && _jsx(Writing, {})] }));
882
+ let t4;
883
+ if ($[30] !== reply || $[31] !== sawWriting || $[32] !== settled) {
884
+ t4 = settled !== "" && /*#__PURE__*/_jsx("div", {
885
+ "data-find-field": "text",
886
+ "data-quote-answer": true,
887
+ className: "contents",
888
+ children: /*#__PURE__*/_jsx(ReplyMarkdown, {
889
+ text: settled,
890
+ streaming: false,
891
+ arriving: sawWriting,
892
+ reply: reply
893
+ })
894
+ });
895
+ $[30] = reply;
896
+ $[31] = sawWriting;
897
+ $[32] = settled;
898
+ $[33] = t4;
899
+ } else {
900
+ t4 = $[33];
161
901
  }
162
- if (mode === 'whole' && item.streaming) {
163
- return (_jsxs("div", { className: "-mx-1 px-1 pb-2", children: [_jsx(ReplyHeading, { chatId: chatId }), _jsx(Writing, {})] }));
902
+ let t5;
903
+ if ($[34] !== item.streaming) {
904
+ t5 = item.streaming && /*#__PURE__*/_jsx(Writing, {});
905
+ $[34] = item.streaming;
906
+ $[35] = t5;
907
+ } else {
908
+ t5 = $[35];
164
909
  }
165
- return (_jsxs("div", { "data-find-item": item.id, className: clsx('-mx-1 px-1 pb-2', mode === 'whole' && sawWriting && WHOLE_FADE_CLASS), children: [_jsx(ReplyHeading, { chatId: chatId }), _jsx("div", { "data-find-field": "text", "data-quote-answer": true, className: "contents", children: _jsx(ReplyMarkdown, { text: reveal.text, streaming: reveal.active, reply: reply }) }), live && item.text === '' && _jsx("span", { className: "inline-block h-3.5 w-1.5 animate-pulse rounded-sm bg-text-faint align-middle" })] }));
910
+ let t6;
911
+ if ($[36] !== item.id || $[37] !== t3 || $[38] !== t4 || $[39] !== t5) {
912
+ t6 = /*#__PURE__*/_jsxs("div", {
913
+ "data-find-item": item.id,
914
+ className: "-mx-1 px-1 pb-2",
915
+ children: [t3, t4, t5]
916
+ });
917
+ $[36] = item.id;
918
+ $[37] = t3;
919
+ $[38] = t4;
920
+ $[39] = t5;
921
+ $[40] = t6;
922
+ } else {
923
+ t6 = $[40];
924
+ }
925
+ return t6;
926
+ }
927
+ if (mode === "whole" && item.streaming) {
928
+ let t2;
929
+ if ($[41] !== chatId) {
930
+ t2 = /*#__PURE__*/_jsx(ReplyHeading, {
931
+ chatId: chatId
932
+ });
933
+ $[41] = chatId;
934
+ $[42] = t2;
935
+ } else {
936
+ t2 = $[42];
937
+ }
938
+ let t3;
939
+ if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
940
+ t3 = /*#__PURE__*/_jsx(Writing, {});
941
+ $[43] = t3;
942
+ } else {
943
+ t3 = $[43];
944
+ }
945
+ let t4;
946
+ if ($[44] !== t2) {
947
+ t4 = /*#__PURE__*/_jsxs("div", {
948
+ className: "-mx-1 px-1 pb-2",
949
+ children: [t2, t3]
950
+ });
951
+ $[44] = t2;
952
+ $[45] = t4;
953
+ } else {
954
+ t4 = $[45];
955
+ }
956
+ return t4;
957
+ }
958
+ const t2 = item.id;
959
+ const t3 = mode === "whole" && sawWriting && WHOLE_FADE_CLASS;
960
+ let t4;
961
+ if ($[46] !== t3) {
962
+ t4 = clsx("-mx-1 px-1 pb-2", t3);
963
+ $[46] = t3;
964
+ $[47] = t4;
965
+ } else {
966
+ t4 = $[47];
967
+ }
968
+ let t5;
969
+ if ($[48] !== chatId) {
970
+ t5 = /*#__PURE__*/_jsx(ReplyHeading, {
971
+ chatId: chatId
972
+ });
973
+ $[48] = chatId;
974
+ $[49] = t5;
975
+ } else {
976
+ t5 = $[49];
977
+ }
978
+ let t6;
979
+ if ($[50] !== reply || $[51] !== reveal.active || $[52] !== reveal.text) {
980
+ t6 = /*#__PURE__*/_jsx("div", {
981
+ "data-find-field": "text",
982
+ "data-quote-answer": true,
983
+ className: "contents",
984
+ children: /*#__PURE__*/_jsx(ReplyMarkdown, {
985
+ text: reveal.text,
986
+ streaming: reveal.active,
987
+ reply: reply
988
+ })
989
+ });
990
+ $[50] = reply;
991
+ $[51] = reveal.active;
992
+ $[52] = reveal.text;
993
+ $[53] = t6;
994
+ } else {
995
+ t6 = $[53];
996
+ }
997
+ let t7;
998
+ if ($[54] !== item.text || $[55] !== live) {
999
+ t7 = live && item.text === "" && /*#__PURE__*/_jsx("span", {
1000
+ className: "inline-block h-3.5 w-1.5 animate-pulse rounded-sm bg-text-faint align-middle"
1001
+ });
1002
+ $[54] = item.text;
1003
+ $[55] = live;
1004
+ $[56] = t7;
1005
+ } else {
1006
+ t7 = $[56];
1007
+ }
1008
+ let t8;
1009
+ if ($[57] !== item.id || $[58] !== t4 || $[59] !== t5 || $[60] !== t6 || $[61] !== t7) {
1010
+ t8 = /*#__PURE__*/_jsxs("div", {
1011
+ "data-find-item": t2,
1012
+ className: t4,
1013
+ children: [t5, t6, t7]
1014
+ });
1015
+ $[57] = item.id;
1016
+ $[58] = t4;
1017
+ $[59] = t5;
1018
+ $[60] = t6;
1019
+ $[61] = t7;
1020
+ $[62] = t8;
1021
+ } else {
1022
+ t8 = $[62];
1023
+ }
1024
+ return t8;
166
1025
  }
167
1026
  /*
168
1027
  * What the model thought before it answered. It shimmers while it streams and folds itself away
169
1028
  * once the answer starts, because the thought is worth a glance and rarely worth reading twice:
170
1029
  * folded, it shows the heading it opens with or itself on one line, and opened, it reads as Markdown.
171
1030
  */
172
- export function ThinkingRow({ chatId, item: derived }) {
173
- const host = useChatHost();
174
- const { t } = useTranslation('agent-chat');
175
- const item = useCurrentItem(chatId, derived);
176
- const mode = host.useStreaming();
177
- const [open, setOpen] = useState(false);
178
- const reveal = useRevealedText(item.text, mode === 'words' && item.streaming);
179
- // A block at a time, the paragraphs of the thought that closed are shown as they land.
180
- const settled = mode === 'blocks' && item.streaming ? settledBlocksText(item.text) : null;
181
- // Whole, the thought stays behind "Thinking…" until it is done and then folds like any other.
182
- const shown = open || reveal.active || (settled !== null && settled !== '');
183
- const text = settled ?? reveal.text;
184
- const live = useMemo(() => (item.streaming && mode !== 'whole' ? thoughtLine(text) : ''), [item.streaming, mode, text]);
185
- const preview = useMemo(() => (item.streaming ? '' : thoughtPreview(item.text)), [item.streaming, item.text]);
186
- const duration = formatElapsedShort((item.endedAt ?? item.createdAt) - item.createdAt);
187
- useOpenForFind(item.id, 'text', setOpen);
188
- return (_jsxs("div", { "data-find-item": item.id, className: "-mx-1 px-1 pb-2", children: [_jsxs("button", { className: "flex w-full min-w-0 items-center gap-2 text-left text-xs text-text-muted hover:text-text", disabled: item.streaming, "aria-expanded": item.streaming ? undefined : open, onClick: () => setOpen((o) => !o), children: [_jsx("span", { className: ROW_GUTTER, children: _jsx(Icon, { icon: Brain, size: 12 }) }), item.streaming ? (_jsx("span", { className: "chat-live-text min-w-0 truncate", children: live || t('rows.thinking.live') })) : preview === '' ? (_jsxs(_Fragment, { children: [_jsx("span", { children: t('rows.thinking.thoughtFor', { duration }) }), _jsx(Icon, { icon: ChevronDown, size: 12, className: clsx('shrink-0 transition-transform', open && 'rotate-180') })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 truncate", children: open ? t('rows.thinking.thought') : preview }), _jsx("span", { className: "grow" }), _jsx("span", { className: "shrink-0 text-text-faint tabular-nums", children: duration }), _jsx(Icon, { icon: ChevronDown, size: 12, className: clsx('shrink-0 transition-transform', open && 'rotate-180') })] }))] }), shown && text !== '' && (_jsx("div", { "data-find-field": "text", className: "mt-1 ml-1.75 border-l border-border pl-4 select-text", children: reveal.active ? (_jsx("div", { className: "text-sm whitespace-pre-wrap text-text-faint", children: _jsx(FadingWords, { text: reveal.text }) })) : (_jsx(Markdown, { text: text, muted: true })) }))] }));
1031
+ export function ThinkingRow(t0) {
1032
+ const $ = _c(27);
1033
+ const {
1034
+ chatId,
1035
+ item: derived
1036
+ } = t0;
1037
+ const {
1038
+ t
1039
+ } = useTranslation("agent-chat");
1040
+ const item = useCurrentItem(chatId, derived);
1041
+ const mode = useHostStreaming();
1042
+ const [open, setOpen] = useState(false);
1043
+ const reveal = useRevealedText(item.text, mode === "words" && item.streaming);
1044
+ let t1;
1045
+ if ($[0] !== item.streaming || $[1] !== item.text || $[2] !== mode) {
1046
+ t1 = mode === "blocks" && item.streaming ? settledBlocksText(item.text) : null;
1047
+ $[0] = item.streaming;
1048
+ $[1] = item.text;
1049
+ $[2] = mode;
1050
+ $[3] = t1;
1051
+ } else {
1052
+ t1 = $[3];
1053
+ }
1054
+ const settled = t1;
1055
+ const shown = open || reveal.active || settled !== null && settled !== "";
1056
+ const text = settled ?? reveal.text;
1057
+ let t2;
1058
+ if ($[4] !== item.streaming || $[5] !== mode || $[6] !== text) {
1059
+ t2 = item.streaming && mode !== "whole" ? thoughtLine(text) : "";
1060
+ $[4] = item.streaming;
1061
+ $[5] = mode;
1062
+ $[6] = text;
1063
+ $[7] = t2;
1064
+ } else {
1065
+ t2 = $[7];
1066
+ }
1067
+ const live = t2;
1068
+ let t3;
1069
+ if ($[8] !== item.streaming || $[9] !== item.text) {
1070
+ t3 = item.streaming ? "" : thoughtPreview(item.text);
1071
+ $[8] = item.streaming;
1072
+ $[9] = item.text;
1073
+ $[10] = t3;
1074
+ } else {
1075
+ t3 = $[10];
1076
+ }
1077
+ const preview = t3;
1078
+ const duration = formatElapsedShort((item.endedAt ?? item.createdAt) - item.createdAt);
1079
+ useOpenForFind(item.id, "text", setOpen);
1080
+ const t4 = "-mx-1 px-1 pb-2";
1081
+ const t5 = "flex w-full min-w-0 items-center gap-2 text-left text-xs text-text-muted hover:text-text";
1082
+ const t6 = item.streaming ? undefined : open;
1083
+ let t7;
1084
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1085
+ t7 = () => setOpen(_temp4);
1086
+ $[11] = t7;
1087
+ } else {
1088
+ t7 = $[11];
1089
+ }
1090
+ let t8;
1091
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1092
+ t8 = /*#__PURE__*/_jsx("span", {
1093
+ className: ROW_GUTTER,
1094
+ children: /*#__PURE__*/_jsx(Icon, {
1095
+ icon: Brain,
1096
+ size: 12
1097
+ })
1098
+ });
1099
+ $[12] = t8;
1100
+ } else {
1101
+ t8 = $[12];
1102
+ }
1103
+ const t9 = item.streaming ? /*#__PURE__*/_jsx("span", {
1104
+ className: "chat-live-text min-w-0 truncate",
1105
+ children: live || t("rows.thinking.live")
1106
+ }) : preview === "" ? /*#__PURE__*/_jsxs(_Fragment, {
1107
+ children: [/*#__PURE__*/_jsx("span", {
1108
+ children: t("rows.thinking.thoughtFor", {
1109
+ duration
1110
+ })
1111
+ }), /*#__PURE__*/_jsx(Icon, {
1112
+ icon: ChevronDown,
1113
+ size: 12,
1114
+ className: clsx("shrink-0 transition-transform", open && "rotate-180")
1115
+ })]
1116
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
1117
+ children: [/*#__PURE__*/_jsx("span", {
1118
+ className: "min-w-0 truncate",
1119
+ children: open ? t("rows.thinking.thought") : preview
1120
+ }), /*#__PURE__*/_jsx("span", {
1121
+ className: "grow"
1122
+ }), /*#__PURE__*/_jsx("span", {
1123
+ className: "shrink-0 text-text-faint tabular-nums",
1124
+ children: duration
1125
+ }), /*#__PURE__*/_jsx(Icon, {
1126
+ icon: ChevronDown,
1127
+ size: 12,
1128
+ className: clsx("shrink-0 transition-transform", open && "rotate-180")
1129
+ })]
1130
+ });
1131
+ let t10;
1132
+ if ($[13] !== item.streaming || $[14] !== t6 || $[15] !== t7 || $[16] !== t8 || $[17] !== t9) {
1133
+ t10 = /*#__PURE__*/_jsxs("button", {
1134
+ className: t5,
1135
+ disabled: item.streaming,
1136
+ "aria-expanded": t6,
1137
+ onClick: t7,
1138
+ children: [t8, t9]
1139
+ });
1140
+ $[13] = item.streaming;
1141
+ $[14] = t6;
1142
+ $[15] = t7;
1143
+ $[16] = t8;
1144
+ $[17] = t9;
1145
+ $[18] = t10;
1146
+ } else {
1147
+ t10 = $[18];
1148
+ }
1149
+ let t11;
1150
+ if ($[19] !== reveal || $[20] !== shown || $[21] !== text) {
1151
+ t11 = shown && text !== "" && /*#__PURE__*/_jsx("div", {
1152
+ "data-find-field": "text",
1153
+ className: "mt-1 ml-1.75 border-l border-border pl-4 select-text",
1154
+ children: reveal.active ? /*#__PURE__*/_jsx("div", {
1155
+ className: "text-sm whitespace-pre-wrap text-text-faint",
1156
+ children: /*#__PURE__*/_jsx(FadingWords, {
1157
+ text: reveal.text
1158
+ })
1159
+ }) : /*#__PURE__*/_jsx(Markdown, {
1160
+ text: text,
1161
+ muted: true
1162
+ })
1163
+ });
1164
+ $[19] = reveal;
1165
+ $[20] = shown;
1166
+ $[21] = text;
1167
+ $[22] = t11;
1168
+ } else {
1169
+ t11 = $[22];
1170
+ }
1171
+ let t12;
1172
+ if ($[23] !== item.id || $[24] !== t10 || $[25] !== t11) {
1173
+ t12 = /*#__PURE__*/_jsxs("div", {
1174
+ "data-find-item": item.id,
1175
+ className: t4,
1176
+ children: [t10, t11]
1177
+ });
1178
+ $[23] = item.id;
1179
+ $[24] = t10;
1180
+ $[25] = t11;
1181
+ $[26] = t12;
1182
+ } else {
1183
+ t12 = $[26];
1184
+ }
1185
+ return t12;
189
1186
  }
190
1187
  /*
191
1188
  * The latest thought of a running turn over the call it led to, as its heading or first sentence,
192
1189
  * so what the model found stays in view while it checks it. Nothing while the thought has no line yet.
193
1190
  */
194
- export function LiveThoughtRow({ chatId, item: derived }) {
195
- const item = useCurrentItem(chatId, derived);
196
- const line = useMemo(() => thoughtLine(item.text), [item.text]);
197
- if (line === '') {
198
- return null;
199
- }
200
- return (_jsxs("div", { className: "-mx-1 mb-0.5 flex min-h-7 items-start gap-2 px-1 py-1 text-xs text-text-muted", children: [_jsx("span", { className: ROW_GUTTER, children: _jsx(Icon, { icon: Brain, size: 12 }) }), _jsx("span", { className: "line-clamp-4 min-w-0 wrap-anywhere select-text", children: line })] }));
1191
+ function _temp4(o) {
1192
+ return !o;
1193
+ }
1194
+ export function LiveThoughtRow(t0) {
1195
+ const $ = _c(5);
1196
+ const {
1197
+ chatId,
1198
+ item: derived
1199
+ } = t0;
1200
+ const item = useCurrentItem(chatId, derived);
1201
+ let t1;
1202
+ if ($[0] !== item.text) {
1203
+ t1 = thoughtLine(item.text);
1204
+ $[0] = item.text;
1205
+ $[1] = t1;
1206
+ } else {
1207
+ t1 = $[1];
1208
+ }
1209
+ const line = t1;
1210
+ if (line === "") {
1211
+ return null;
1212
+ }
1213
+ let t2;
1214
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1215
+ t2 = /*#__PURE__*/_jsx("span", {
1216
+ className: ROW_GUTTER,
1217
+ children: /*#__PURE__*/_jsx(Icon, {
1218
+ icon: Brain,
1219
+ size: 12
1220
+ })
1221
+ });
1222
+ $[2] = t2;
1223
+ } else {
1224
+ t2 = $[2];
1225
+ }
1226
+ let t3;
1227
+ if ($[3] !== line) {
1228
+ t3 = /*#__PURE__*/_jsxs("div", {
1229
+ className: "-mx-1 mb-0.5 flex min-h-7 items-start gap-2 px-1 py-1 text-xs text-text-muted",
1230
+ children: [t2, /*#__PURE__*/_jsx("span", {
1231
+ className: "line-clamp-4 min-w-0 wrap-anywhere select-text",
1232
+ children: line
1233
+ })]
1234
+ });
1235
+ $[3] = line;
1236
+ $[4] = t3;
1237
+ } else {
1238
+ t3 = $[4];
1239
+ }
1240
+ return t3;
201
1241
  }
202
1242
  const NOTE_ICON = {
203
- info: _jsx(Icon, { icon: Info, size: 12 }),
204
- warning: _jsx(Icon, { icon: TriangleAlert, size: 12 }),
205
- error: _jsx(Icon, { icon: CircleAlert, size: 12 })
1243
+ info: /*#__PURE__*/_jsx(Icon, {
1244
+ icon: Info,
1245
+ size: 12
1246
+ }),
1247
+ warning: /*#__PURE__*/_jsx(Icon, {
1248
+ icon: TriangleAlert,
1249
+ size: 12
1250
+ }),
1251
+ error: /*#__PURE__*/_jsx(Icon, {
1252
+ icon: CircleAlert,
1253
+ size: 12
1254
+ })
206
1255
  };
207
1256
  /*
208
1257
  * A line from the machine in the thread. A note of more than one line (a summary a fork sent back)
209
1258
  * shows its first line and folds the rest open as markdown; one that came from a fork leads to it.
210
1259
  */
211
- export function NoteRow({ id, level, text, from }) {
212
- const { t } = useTranslation('agent-chat');
213
- const [open, setOpen] = useState(false);
214
- const breakAt = text.indexOf('\n');
215
- const head = breakAt === -1 ? text : text.slice(0, breakAt);
216
- const rest = breakAt === -1 ? '' : text.slice(breakAt + 1).trim();
217
- useOpenForFind(id, 'output', setOpen);
218
- return (_jsxs("div", { "data-find-item": id, className: clsx('-mx-1 mb-0.5 flex min-h-7 items-start gap-2 px-1 py-1 text-xs', level === 'error' ? 'text-status-error' : level === 'warning' ? 'text-status-needs-you' : 'text-text-faint'), children: [_jsx("span", { className: ROW_GUTTER, children: NOTE_ICON[level] }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-x-2", children: [_jsx("span", { "data-find-field": "summary", className: "select-text", children: head }), rest !== '' && (_jsx("button", { className: "text-text-muted hover:text-text", onClick: () => setOpen(!open), children: open ? t('rows.note.hide') : t('rows.note.show') })), from !== undefined && _jsx(OpenChatButton, { chatId: from, label: id.startsWith(WAITING_NOTE_PREFIX) ? 'openWaiting' : 'openFork' })] }), open && rest !== '' && (_jsx("div", { "data-find-field": "output", className: "mt-1 text-text-muted select-text", children: _jsx(MessageMarkdown, { text: rest }) }))] })] }));
1260
+ export function NoteRow(t0) {
1261
+ const $ = _c(34);
1262
+ const {
1263
+ id,
1264
+ level,
1265
+ text,
1266
+ from
1267
+ } = t0;
1268
+ const {
1269
+ t
1270
+ } = useTranslation("agent-chat");
1271
+ const [open, setOpen] = useState(false);
1272
+ let breakAt;
1273
+ let t1;
1274
+ if ($[0] !== text) {
1275
+ breakAt = text.indexOf("\n");
1276
+ t1 = breakAt === -1 ? text : text.slice(0, breakAt);
1277
+ $[0] = text;
1278
+ $[1] = breakAt;
1279
+ $[2] = t1;
1280
+ } else {
1281
+ breakAt = $[1];
1282
+ t1 = $[2];
1283
+ }
1284
+ const head = t1;
1285
+ let t2;
1286
+ if ($[3] !== breakAt || $[4] !== text) {
1287
+ t2 = breakAt === -1 ? "" : text.slice(breakAt + 1).trim();
1288
+ $[3] = breakAt;
1289
+ $[4] = text;
1290
+ $[5] = t2;
1291
+ } else {
1292
+ t2 = $[5];
1293
+ }
1294
+ const rest = t2;
1295
+ useOpenForFind(id, "output", setOpen);
1296
+ const t3 = level === "error" ? "text-status-error" : level === "warning" ? "text-status-needs-you" : "text-text-faint";
1297
+ let t4;
1298
+ if ($[6] !== t3) {
1299
+ t4 = clsx("-mx-1 mb-0.5 flex min-h-7 items-start gap-2 px-1 py-1 text-xs", t3);
1300
+ $[6] = t3;
1301
+ $[7] = t4;
1302
+ } else {
1303
+ t4 = $[7];
1304
+ }
1305
+ const t5 = NOTE_ICON[level];
1306
+ let t6;
1307
+ if ($[8] !== t5) {
1308
+ t6 = /*#__PURE__*/_jsx("span", {
1309
+ className: ROW_GUTTER,
1310
+ children: t5
1311
+ });
1312
+ $[8] = t5;
1313
+ $[9] = t6;
1314
+ } else {
1315
+ t6 = $[9];
1316
+ }
1317
+ let t7;
1318
+ if ($[10] !== head) {
1319
+ t7 = /*#__PURE__*/_jsx("span", {
1320
+ "data-find-field": "summary",
1321
+ className: "select-text",
1322
+ children: head
1323
+ });
1324
+ $[10] = head;
1325
+ $[11] = t7;
1326
+ } else {
1327
+ t7 = $[11];
1328
+ }
1329
+ let t8;
1330
+ if ($[12] !== open || $[13] !== rest || $[14] !== t) {
1331
+ t8 = rest !== "" && /*#__PURE__*/_jsx("button", {
1332
+ className: "text-text-muted hover:text-text",
1333
+ onClick: () => setOpen(!open),
1334
+ children: open ? t("rows.note.hide") : t("rows.note.show")
1335
+ });
1336
+ $[12] = open;
1337
+ $[13] = rest;
1338
+ $[14] = t;
1339
+ $[15] = t8;
1340
+ } else {
1341
+ t8 = $[15];
1342
+ }
1343
+ let t9;
1344
+ if ($[16] !== from || $[17] !== id) {
1345
+ t9 = from !== undefined && /*#__PURE__*/_jsx(OpenChatButton, {
1346
+ chatId: from,
1347
+ label: id.startsWith(WAITING_NOTE_PREFIX) ? "openWaiting" : "openFork"
1348
+ });
1349
+ $[16] = from;
1350
+ $[17] = id;
1351
+ $[18] = t9;
1352
+ } else {
1353
+ t9 = $[18];
1354
+ }
1355
+ let t10;
1356
+ if ($[19] !== t7 || $[20] !== t8 || $[21] !== t9) {
1357
+ t10 = /*#__PURE__*/_jsxs("div", {
1358
+ className: "flex flex-wrap items-center gap-x-2",
1359
+ children: [t7, t8, t9]
1360
+ });
1361
+ $[19] = t7;
1362
+ $[20] = t8;
1363
+ $[21] = t9;
1364
+ $[22] = t10;
1365
+ } else {
1366
+ t10 = $[22];
1367
+ }
1368
+ let t11;
1369
+ if ($[23] !== open || $[24] !== rest) {
1370
+ t11 = open && rest !== "" && /*#__PURE__*/_jsx("div", {
1371
+ "data-find-field": "output",
1372
+ className: "mt-1 text-text-muted select-text",
1373
+ children: /*#__PURE__*/_jsx(MessageMarkdown, {
1374
+ text: rest
1375
+ })
1376
+ });
1377
+ $[23] = open;
1378
+ $[24] = rest;
1379
+ $[25] = t11;
1380
+ } else {
1381
+ t11 = $[25];
1382
+ }
1383
+ let t12;
1384
+ if ($[26] !== t10 || $[27] !== t11) {
1385
+ t12 = /*#__PURE__*/_jsxs("div", {
1386
+ className: "min-w-0 flex-1",
1387
+ children: [t10, t11]
1388
+ });
1389
+ $[26] = t10;
1390
+ $[27] = t11;
1391
+ $[28] = t12;
1392
+ } else {
1393
+ t12 = $[28];
1394
+ }
1395
+ let t13;
1396
+ if ($[29] !== id || $[30] !== t12 || $[31] !== t4 || $[32] !== t6) {
1397
+ t13 = /*#__PURE__*/_jsxs("div", {
1398
+ "data-find-item": id,
1399
+ className: t4,
1400
+ children: [t6, t12]
1401
+ });
1402
+ $[29] = id;
1403
+ $[30] = t12;
1404
+ $[31] = t4;
1405
+ $[32] = t6;
1406
+ $[33] = t13;
1407
+ } else {
1408
+ t13 = $[33];
1409
+ }
1410
+ return t13;
219
1411
  }
220
1412
  /* "Open fork" on a note a fork sent, or "Open to answer" on one about a waiting child, while that chat is still in the project. */
221
- function OpenChatButton({ chatId, label }) {
222
- const host = useChatHost();
223
- const { t } = useTranslation('agent-chat');
224
- const place = host.useChatPlace(chatId);
225
- if (place.title === null) {
226
- return null;
227
- }
228
- return (_jsx("button", { className: "text-text-muted hover:text-text", onClick: place.go, children: t(`rows.note.${label}`) }));
1413
+ function OpenChatButton(t0) {
1414
+ const $ = _c(6);
1415
+ const {
1416
+ chatId,
1417
+ label
1418
+ } = t0;
1419
+ const {
1420
+ t
1421
+ } = useTranslation("agent-chat");
1422
+ const place = useHostChatPlace(chatId);
1423
+ if (place.title === null) {
1424
+ return null;
1425
+ }
1426
+ const t1 = place.go;
1427
+ const t2 = `rows.note.${label}`;
1428
+ let t3;
1429
+ if ($[0] !== t || $[1] !== t2) {
1430
+ t3 = t(t2);
1431
+ $[0] = t;
1432
+ $[1] = t2;
1433
+ $[2] = t3;
1434
+ } else {
1435
+ t3 = $[2];
1436
+ }
1437
+ let t4;
1438
+ if ($[3] !== place.go || $[4] !== t3) {
1439
+ t4 = /*#__PURE__*/_jsx("button", {
1440
+ className: "text-text-muted hover:text-text",
1441
+ onClick: t1,
1442
+ children: t3
1443
+ });
1444
+ $[3] = place.go;
1445
+ $[4] = t3;
1446
+ $[5] = t4;
1447
+ } else {
1448
+ t4 = $[5];
1449
+ }
1450
+ return t4;
229
1451
  }
230
1452
  /*
231
1453
  * The header of a turn the agent started itself, in place of a message of the person. What the
232
1454
  * sub-agent came back with lives on its own row, which the header opens when the CLI named it.
233
1455
  */
234
- export function AgentTurnRow({ label, onOpen }) {
235
- const line = 'mb-0.5 flex h-7 w-full items-center gap-2 text-left text-xs text-text-muted';
236
- // A header with nowhere to go is text to read and copy; one that opens a row is a button.
237
- const content = (_jsxs(_Fragment, { children: [_jsx("span", { className: ROW_GUTTER, children: _jsx(Icon, { icon: Bot, size: 12 }) }), _jsx("span", { className: clsx('min-w-0 truncate', onOpen === undefined && 'select-text'), children: label })] }));
238
- if (onOpen === undefined) {
239
- return _jsx("div", { className: line, children: content });
1456
+ export function AgentTurnRow(t0) {
1457
+ const $ = _c(12);
1458
+ const {
1459
+ label,
1460
+ onOpen
1461
+ } = t0;
1462
+ let t1;
1463
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1464
+ t1 = /*#__PURE__*/_jsx("span", {
1465
+ className: ROW_GUTTER,
1466
+ children: /*#__PURE__*/_jsx(Icon, {
1467
+ icon: Bot,
1468
+ size: 12
1469
+ })
1470
+ });
1471
+ $[0] = t1;
1472
+ } else {
1473
+ t1 = $[0];
1474
+ }
1475
+ const t2 = onOpen === undefined && "select-text";
1476
+ let t3;
1477
+ if ($[1] !== t2) {
1478
+ t3 = clsx("min-w-0 truncate", t2);
1479
+ $[1] = t2;
1480
+ $[2] = t3;
1481
+ } else {
1482
+ t3 = $[2];
1483
+ }
1484
+ let t4;
1485
+ if ($[3] !== label || $[4] !== t3) {
1486
+ t4 = /*#__PURE__*/_jsxs(_Fragment, {
1487
+ children: [t1, /*#__PURE__*/_jsx("span", {
1488
+ className: t3,
1489
+ children: label
1490
+ })]
1491
+ });
1492
+ $[3] = label;
1493
+ $[4] = t3;
1494
+ $[5] = t4;
1495
+ } else {
1496
+ t4 = $[5];
1497
+ }
1498
+ const content = t4;
1499
+ if (onOpen === undefined) {
1500
+ let t5;
1501
+ if ($[6] !== content) {
1502
+ t5 = /*#__PURE__*/_jsx("div", {
1503
+ className: "mb-0.5 flex h-7 w-full items-center gap-2 text-left text-xs text-text-muted",
1504
+ children: content
1505
+ });
1506
+ $[6] = content;
1507
+ $[7] = t5;
1508
+ } else {
1509
+ t5 = $[7];
240
1510
  }
241
- return (_jsx("button", { className: clsx(line, 'hover:text-text'), onClick: onOpen, children: content }));
1511
+ return t5;
1512
+ }
1513
+ let t5;
1514
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1515
+ t5 = clsx("mb-0.5 flex h-7 w-full items-center gap-2 text-left text-xs text-text-muted", "hover:text-text");
1516
+ $[8] = t5;
1517
+ } else {
1518
+ t5 = $[8];
1519
+ }
1520
+ let t6;
1521
+ if ($[9] !== content || $[10] !== onOpen) {
1522
+ t6 = /*#__PURE__*/_jsx("button", {
1523
+ className: t5,
1524
+ onClick: onOpen,
1525
+ children: content
1526
+ });
1527
+ $[9] = content;
1528
+ $[10] = onOpen;
1529
+ $[11] = t6;
1530
+ } else {
1531
+ t6 = $[11];
1532
+ }
1533
+ return t6;
242
1534
  }
243
1535
  /* A dashed line, since what stands above it is still there for the reader but only a summary to the agent. */
244
- export function CompactionRow({ preTokens }) {
245
- const { t } = useTranslation('agent-chat');
246
- return (_jsxs("div", { className: "flex items-center gap-3 pb-3 text-xs text-text-faint", children: [_jsx("span", { className: "grow border-t border-dashed border-border" }), _jsx(Tooltip, { label: t('rows.compaction.summary'), children: _jsx("span", { children: preTokens ? t('rows.compaction.from', { tokens: formatTokens(preTokens) }) : t('rows.compaction.plain') }) }), _jsx("span", { className: "grow border-t border-dashed border-border" })] }));
1536
+ export function CompactionRow(t0) {
1537
+ const $ = _c(14);
1538
+ const {
1539
+ preTokens
1540
+ } = t0;
1541
+ const {
1542
+ t
1543
+ } = useTranslation("agent-chat");
1544
+ let t1;
1545
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1546
+ t1 = /*#__PURE__*/_jsx("span", {
1547
+ className: "grow border-t border-dashed border-border"
1548
+ });
1549
+ $[0] = t1;
1550
+ } else {
1551
+ t1 = $[0];
1552
+ }
1553
+ let t2;
1554
+ if ($[1] !== t) {
1555
+ t2 = t("rows.compaction.summary");
1556
+ $[1] = t;
1557
+ $[2] = t2;
1558
+ } else {
1559
+ t2 = $[2];
1560
+ }
1561
+ let t3;
1562
+ if ($[3] !== preTokens || $[4] !== t) {
1563
+ t3 = preTokens ? t("rows.compaction.from", {
1564
+ tokens: formatTokens(preTokens)
1565
+ }) : t("rows.compaction.plain");
1566
+ $[3] = preTokens;
1567
+ $[4] = t;
1568
+ $[5] = t3;
1569
+ } else {
1570
+ t3 = $[5];
1571
+ }
1572
+ let t4;
1573
+ if ($[6] !== t3) {
1574
+ t4 = /*#__PURE__*/_jsx("span", {
1575
+ children: t3
1576
+ });
1577
+ $[6] = t3;
1578
+ $[7] = t4;
1579
+ } else {
1580
+ t4 = $[7];
1581
+ }
1582
+ let t5;
1583
+ if ($[8] !== t2 || $[9] !== t4) {
1584
+ t5 = /*#__PURE__*/_jsx(Tooltip, {
1585
+ label: t2,
1586
+ children: t4
1587
+ });
1588
+ $[8] = t2;
1589
+ $[9] = t4;
1590
+ $[10] = t5;
1591
+ } else {
1592
+ t5 = $[10];
1593
+ }
1594
+ let t6;
1595
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1596
+ t6 = /*#__PURE__*/_jsx("span", {
1597
+ className: "grow border-t border-dashed border-border"
1598
+ });
1599
+ $[11] = t6;
1600
+ } else {
1601
+ t6 = $[11];
1602
+ }
1603
+ let t7;
1604
+ if ($[12] !== t5) {
1605
+ t7 = /*#__PURE__*/_jsxs("div", {
1606
+ className: "flex items-center gap-3 pb-3 text-xs text-text-faint",
1607
+ children: [t1, t5, t6]
1608
+ });
1609
+ $[12] = t5;
1610
+ $[13] = t7;
1611
+ } else {
1612
+ t7 = $[13];
1613
+ }
1614
+ return t7;
247
1615
  }
248
1616
  const DECISION_ICON = {
249
- allow: _jsx(Icon, { icon: Check, size: 12 }),
250
- 'allow-always': _jsx(Icon, { icon: Check, size: 12 }),
251
- deny: _jsx(Icon, { icon: X, size: 12 }),
252
- cancelled: _jsx(Icon, { icon: X, size: 12 })
1617
+ allow: /*#__PURE__*/_jsx(Icon, {
1618
+ icon: Check,
1619
+ size: 12
1620
+ }),
1621
+ 'allow-always': /*#__PURE__*/_jsx(Icon, {
1622
+ icon: Check,
1623
+ size: 12
1624
+ }),
1625
+ deny: /*#__PURE__*/_jsx(Icon, {
1626
+ icon: X,
1627
+ size: 12
1628
+ }),
1629
+ cancelled: /*#__PURE__*/_jsx(Icon, {
1630
+ icon: X,
1631
+ size: 12
1632
+ })
253
1633
  };
254
1634
  /* The outcome of a permission request, one quiet line; the request itself lived on the composer. */
255
- export function ApprovalHistoryRow({ item }) {
256
- const { t } = useTranslation('agent-chat');
257
- if (item.decision === 'pending') {
258
- return null;
259
- }
260
- return (_jsxs("div", { className: "-mx-1 mb-0.5 flex h-7 items-center gap-2 px-1 text-xs text-text-faint", children: [_jsx("span", { className: clsx(ROW_GUTTER, item.decision === 'deny' && 'text-status-error'), children: DECISION_ICON[item.decision] }), _jsx("span", { className: clsx(item.decision === 'deny' && 'text-status-error'), children: t(`rows.approval.${item.decision}`) }), _jsx("span", { className: "text-text-muted", children: item.toolName }), _jsx("span", { className: "min-w-0 truncate font-mono text-code", children: toolSummaryIsPath(item.toolName, item.input) ? (_jsx(MiddleTruncate, { text: toolSummary(item.toolName, item.input) })) : (toolSummary(item.toolName, item.input)) })] }));
261
- }
262
- export function QuestionHistoryRow({ item }) {
263
- const { t } = useTranslation('agent-chat');
264
- return (_jsx("div", { children: item.questions.map((question) => (_jsxs("div", { className: "-mx-1 mb-0.5 flex min-h-7 items-start gap-2 px-1 py-1 text-xs text-text-faint", children: [_jsx("span", { className: ROW_GUTTER, children: _jsx(Icon, { icon: MessageCircleQuestionMark, size: 12 }) }), _jsxs("span", { className: "min-w-0", children: [_jsx("span", { className: "text-text-muted", children: question.question }), item.state === 'answered' && item.answers?.[question.id] !== undefined && (_jsx("span", { className: "ml-1.5 text-text", children: item.answers[question.id] })), item.state === 'cancelled' && _jsx("span", { className: "ml-1.5", children: t('rows.question.notAnswered') }), item.state === 'dismissed' && _jsx("span", { className: "ml-1.5", children: t('rows.question.dismissed') })] })] }, question.id))) }));
1635
+ export function ApprovalHistoryRow(t0) {
1636
+ const $ = _c(25);
1637
+ const {
1638
+ item
1639
+ } = t0;
1640
+ const {
1641
+ t
1642
+ } = useTranslation("agent-chat");
1643
+ if (item.decision === "pending") {
1644
+ return null;
1645
+ }
1646
+ const t1 = item.decision === "deny" && "text-status-error";
1647
+ let t2;
1648
+ if ($[0] !== t1) {
1649
+ t2 = clsx(ROW_GUTTER, t1);
1650
+ $[0] = t1;
1651
+ $[1] = t2;
1652
+ } else {
1653
+ t2 = $[1];
1654
+ }
1655
+ const t3 = DECISION_ICON[item.decision];
1656
+ let t4;
1657
+ if ($[2] !== t2 || $[3] !== t3) {
1658
+ t4 = /*#__PURE__*/_jsx("span", {
1659
+ className: t2,
1660
+ children: t3
1661
+ });
1662
+ $[2] = t2;
1663
+ $[3] = t3;
1664
+ $[4] = t4;
1665
+ } else {
1666
+ t4 = $[4];
1667
+ }
1668
+ const t5 = item.decision === "deny" && "text-status-error";
1669
+ let t6;
1670
+ if ($[5] !== t5) {
1671
+ t6 = clsx(t5);
1672
+ $[5] = t5;
1673
+ $[6] = t6;
1674
+ } else {
1675
+ t6 = $[6];
1676
+ }
1677
+ const t7 = `rows.approval.${item.decision}`;
1678
+ let t8;
1679
+ if ($[7] !== t || $[8] !== t7) {
1680
+ t8 = t(t7);
1681
+ $[7] = t;
1682
+ $[8] = t7;
1683
+ $[9] = t8;
1684
+ } else {
1685
+ t8 = $[9];
1686
+ }
1687
+ let t9;
1688
+ if ($[10] !== t6 || $[11] !== t8) {
1689
+ t9 = /*#__PURE__*/_jsx("span", {
1690
+ className: t6,
1691
+ children: t8
1692
+ });
1693
+ $[10] = t6;
1694
+ $[11] = t8;
1695
+ $[12] = t9;
1696
+ } else {
1697
+ t9 = $[12];
1698
+ }
1699
+ let t10;
1700
+ if ($[13] !== item.toolName) {
1701
+ t10 = /*#__PURE__*/_jsx("span", {
1702
+ className: "text-text-muted",
1703
+ children: item.toolName
1704
+ });
1705
+ $[13] = item.toolName;
1706
+ $[14] = t10;
1707
+ } else {
1708
+ t10 = $[14];
1709
+ }
1710
+ let t11;
1711
+ if ($[15] !== item.input || $[16] !== item.toolName) {
1712
+ t11 = toolSummaryIsPath(item.toolName, item.input) ? /*#__PURE__*/_jsx(MiddleTruncate, {
1713
+ text: toolSummary(item.toolName, item.input)
1714
+ }) : toolSummary(item.toolName, item.input);
1715
+ $[15] = item.input;
1716
+ $[16] = item.toolName;
1717
+ $[17] = t11;
1718
+ } else {
1719
+ t11 = $[17];
1720
+ }
1721
+ let t12;
1722
+ if ($[18] !== t11) {
1723
+ t12 = /*#__PURE__*/_jsx("span", {
1724
+ className: "min-w-0 truncate font-mono text-code",
1725
+ children: t11
1726
+ });
1727
+ $[18] = t11;
1728
+ $[19] = t12;
1729
+ } else {
1730
+ t12 = $[19];
1731
+ }
1732
+ let t13;
1733
+ if ($[20] !== t10 || $[21] !== t12 || $[22] !== t4 || $[23] !== t9) {
1734
+ t13 = /*#__PURE__*/_jsxs("div", {
1735
+ className: "-mx-1 mb-0.5 flex h-7 items-center gap-2 px-1 text-xs text-text-faint",
1736
+ children: [t4, t9, t10, t12]
1737
+ });
1738
+ $[20] = t10;
1739
+ $[21] = t12;
1740
+ $[22] = t4;
1741
+ $[23] = t9;
1742
+ $[24] = t13;
1743
+ } else {
1744
+ t13 = $[24];
1745
+ }
1746
+ return t13;
265
1747
  }
1748
+ export function QuestionHistoryRow(t0) {
1749
+ const $ = _c(11);
1750
+ const {
1751
+ item
1752
+ } = t0;
1753
+ const {
1754
+ t
1755
+ } = useTranslation("agent-chat");
1756
+ let t1;
1757
+ if ($[0] !== item.answers || $[1] !== item.questions || $[2] !== item.state || $[3] !== t) {
1758
+ let t2;
1759
+ if ($[5] !== item.answers || $[6] !== item.state || $[7] !== t) {
1760
+ t2 = question => /*#__PURE__*/_jsxs("div", {
1761
+ className: "-mx-1 mb-0.5 flex min-h-7 items-start gap-2 px-1 py-1 text-xs text-text-faint",
1762
+ children: [/*#__PURE__*/_jsx("span", {
1763
+ className: ROW_GUTTER,
1764
+ children: /*#__PURE__*/_jsx(Icon, {
1765
+ icon: MessageCircleQuestionMark,
1766
+ size: 12
1767
+ })
1768
+ }), /*#__PURE__*/_jsxs("span", {
1769
+ className: "min-w-0",
1770
+ children: [/*#__PURE__*/_jsx("span", {
1771
+ className: "text-text-muted",
1772
+ children: question.question
1773
+ }), item.state === "answered" && item.answers?.[question.id] !== undefined && /*#__PURE__*/_jsx("span", {
1774
+ className: "ml-1.5 text-text",
1775
+ children: item.answers[question.id]
1776
+ }), item.state === "cancelled" && /*#__PURE__*/_jsx("span", {
1777
+ className: "ml-1.5",
1778
+ children: t("rows.question.notAnswered")
1779
+ }), item.state === "dismissed" && /*#__PURE__*/_jsx("span", {
1780
+ className: "ml-1.5",
1781
+ children: t("rows.question.dismissed")
1782
+ })]
1783
+ })]
1784
+ }, question.id);
1785
+ $[5] = item.answers;
1786
+ $[6] = item.state;
1787
+ $[7] = t;
1788
+ $[8] = t2;
1789
+ } else {
1790
+ t2 = $[8];
1791
+ }
1792
+ t1 = item.questions.map(t2);
1793
+ $[0] = item.answers;
1794
+ $[1] = item.questions;
1795
+ $[2] = item.state;
1796
+ $[3] = t;
1797
+ $[4] = t1;
1798
+ } else {
1799
+ t1 = $[4];
1800
+ }
1801
+ let t2;
1802
+ if ($[9] !== t1) {
1803
+ t2 = /*#__PURE__*/_jsx("div", {
1804
+ children: t1
1805
+ });
1806
+ $[9] = t1;
1807
+ $[10] = t2;
1808
+ } else {
1809
+ t2 = $[10];
1810
+ }
1811
+ return t2;
1812
+ }