@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,4 +1,4 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import clsx from 'clsx';
3
3
  import { createContext, useContext, useId, useState } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
@@ -11,12 +11,87 @@ import { CodeStreamingContext } from '../../code-streaming.js';
11
11
  import { ImageThumb } from '../../ImageView.js';
12
12
  import { uiChildrenOf, uiNodeLabel, uiNodeText, uiUrlDomain } from '../node-text.js';
13
13
  import { useTruncated } from '../use-truncated.js';
14
+ import { useHostAttachmentUrl } from '../../../../host-hooks.js';
14
15
  // The number of every source by its node id, which the list counts in its own order.
16
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
15
17
  const SourceNumbers = createContext(new Map());
16
18
  /* Plain text in the same measure until the node closes, so highlighting never makes it jump. */
17
- export function CodeBlockRenderer({ node }) {
18
- const { language } = node.props;
19
- return (_jsxs("div", { className: "chat-ui-code chat-ui-flat flex flex-col rounded-xl bg-ui-tile p-1.5", children: [language !== undefined && language !== '' && (_jsx("div", { className: "chat-ui-flat-inner flex px-1.5 pt-0.5 pb-1.5", children: _jsx("span", { className: "rounded-md bg-ui-inset px-1.5 font-mono text-2xs text-text shadow-[inset_0_0_0_1px_var(--border)]", children: language }) })), _jsx(CodeStreamingContext.Provider, { value: !node.complete, children: _jsx(CodeBlock, { code: uiNodeText(node).replace(/^\n|\n$/g, ''), lang: language ?? 'text' }) })] }));
19
+ export function CodeBlockRenderer(t0) {
20
+ const $ = _c(14);
21
+ const {
22
+ node
23
+ } = t0;
24
+ const {
25
+ language
26
+ } = node.props;
27
+ let t1;
28
+ if ($[0] !== language) {
29
+ t1 = language !== undefined && language !== "" && /*#__PURE__*/_jsx("div", {
30
+ className: "chat-ui-flat-inner flex px-1.5 pt-0.5 pb-1.5",
31
+ children: /*#__PURE__*/_jsx("span", {
32
+ className: "rounded-md bg-ui-inset px-1.5 font-mono text-2xs text-text shadow-[inset_0_0_0_1px_var(--border)]",
33
+ children: language
34
+ })
35
+ });
36
+ $[0] = language;
37
+ $[1] = t1;
38
+ } else {
39
+ t1 = $[1];
40
+ }
41
+ const t2 = !node.complete;
42
+ let t3;
43
+ if ($[2] !== node) {
44
+ let t4;
45
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
46
+ t4 = /^\n|\n$/g;
47
+ $[4] = t4;
48
+ } else {
49
+ t4 = $[4];
50
+ }
51
+ t3 = uiNodeText(node).replace(t4, "");
52
+ $[2] = node;
53
+ $[3] = t3;
54
+ } else {
55
+ t3 = $[3];
56
+ }
57
+ const t4 = language ?? "text";
58
+ let t5;
59
+ if ($[5] !== t3 || $[6] !== t4) {
60
+ t5 = /*#__PURE__*/_jsx(CodeBlock, {
61
+ code: t3,
62
+ lang: t4
63
+ });
64
+ $[5] = t3;
65
+ $[6] = t4;
66
+ $[7] = t5;
67
+ } else {
68
+ t5 = $[7];
69
+ }
70
+ let t6;
71
+ if ($[8] !== t2 || $[9] !== t5) {
72
+ t6 = /*#__PURE__*/_jsx(CodeStreamingContext.Provider, {
73
+ value: t2,
74
+ children: t5
75
+ });
76
+ $[8] = t2;
77
+ $[9] = t5;
78
+ $[10] = t6;
79
+ } else {
80
+ t6 = $[10];
81
+ }
82
+ let t7;
83
+ if ($[11] !== t1 || $[12] !== t6) {
84
+ t7 = /*#__PURE__*/_jsxs("div", {
85
+ className: "chat-ui-code chat-ui-flat flex flex-col rounded-xl bg-ui-tile p-1.5",
86
+ children: [t1, t6]
87
+ });
88
+ $[11] = t1;
89
+ $[12] = t6;
90
+ $[13] = t7;
91
+ } else {
92
+ t7 = $[13];
93
+ }
94
+ return t7;
20
95
  }
21
96
  // Set by a Gallery, so the images inside it draw as cells of its grid.
22
97
  const GalleryContext = createContext(false);
@@ -24,30 +99,232 @@ const GalleryContext = createContext(false);
24
99
  * Its own component, so the host's hook is only called for an image that names an attachment. In a
25
100
  * gallery a cell that cannot show its picture says what it was, since the square alone tells nothing.
26
101
  */
27
- function AttachedImage({ scopeId, chatId, attachmentId, alt, cell, unnamed }) {
28
- const host = useChatHost();
29
- const source = host.attachments.useUrl(scopeId, chatId, attachmentId);
30
- if (!cell) {
31
- return _jsx(ImageThumb, { source: source, alt: alt, className: "max-h-70 max-w-full rounded-xl object-contain" });
102
+ function AttachedImage(t0) {
103
+ const $ = _c(13);
104
+ const {
105
+ scopeId,
106
+ chatId,
107
+ attachmentId,
108
+ alt,
109
+ cell,
110
+ unnamed
111
+ } = t0;
112
+ const source = useHostAttachmentUrl(scopeId, chatId, attachmentId);
113
+ if (!cell) {
114
+ let t1;
115
+ if ($[0] !== alt || $[1] !== source) {
116
+ t1 = /*#__PURE__*/_jsx(ImageThumb, {
117
+ source: source,
118
+ alt: alt,
119
+ className: "max-h-70 max-w-full rounded-xl object-contain"
120
+ });
121
+ $[0] = alt;
122
+ $[1] = source;
123
+ $[2] = t1;
124
+ } else {
125
+ t1 = $[2];
32
126
  }
33
- return (_jsxs(_Fragment, { children: [_jsx(ImageThumb, { source: source, alt: alt, aspect: 1 }), unnamed && source.failure !== null && _jsx("figcaption", { className: "text-xs wrap-anywhere text-text-faint", children: alt })] }));
127
+ return t1;
128
+ }
129
+ let t1;
130
+ if ($[3] !== alt || $[4] !== source) {
131
+ t1 = /*#__PURE__*/_jsx(ImageThumb, {
132
+ source: source,
133
+ alt: alt,
134
+ aspect: 1
135
+ });
136
+ $[3] = alt;
137
+ $[4] = source;
138
+ $[5] = t1;
139
+ } else {
140
+ t1 = $[5];
141
+ }
142
+ let t2;
143
+ if ($[6] !== alt || $[7] !== source || $[8] !== unnamed) {
144
+ t2 = unnamed && source.failure !== null && /*#__PURE__*/_jsx("figcaption", {
145
+ className: "text-xs wrap-anywhere text-text-faint",
146
+ children: alt
147
+ });
148
+ $[6] = alt;
149
+ $[7] = source;
150
+ $[8] = unnamed;
151
+ $[9] = t2;
152
+ } else {
153
+ t2 = $[9];
154
+ }
155
+ let t3;
156
+ if ($[10] !== t1 || $[11] !== t2) {
157
+ t3 = /*#__PURE__*/_jsxs(_Fragment, {
158
+ children: [t1, t2]
159
+ });
160
+ $[10] = t1;
161
+ $[11] = t2;
162
+ $[12] = t3;
163
+ } else {
164
+ t3 = $[12];
165
+ }
166
+ return t3;
34
167
  }
35
168
  /*
36
169
  * An attachment of the chat, never a path or an address the model wrote. An image of the latest
37
170
  * generation stays a quiet square until the daemon resolved it to an attachment.
38
171
  */
39
- export function ImageRenderer({ node, children, context }) {
40
- const { t } = useTranslation('agent-chat');
41
- const cell = useContext(GalleryContext);
42
- const { attachment, alt } = node.props;
43
- const caption = uiNodeLabel(node);
44
- const name = alt ?? (caption === '' ? t('blocks.image.label') : caption);
45
- return (_jsxs("figure", { className: cell ? 'flex min-w-0 flex-col gap-1' : 'flex flex-col items-start gap-1.5', children: [attachment === undefined ? (_jsx(ImageThumb, { source: { url: null, failure: t('blocks.image.unavailable') }, alt: name, aspect: cell ? 1 : undefined })) : (_jsx(AttachedImage, { scopeId: context.scopeId, chatId: context.chatId, attachmentId: attachment, alt: name, cell: cell, unnamed: caption === '' })), caption !== '' && _jsx("figcaption", { className: "px-0.5 text-2xs wrap-anywhere text-text-muted", children: children }), cell && caption === '' && attachment === undefined && (_jsx("figcaption", { className: "text-xs wrap-anywhere text-text-faint", children: alt ?? t('blocks.image.unavailable') }))] }));
172
+ export function ImageRenderer(t0) {
173
+ const $ = _c(27);
174
+ const {
175
+ node,
176
+ children,
177
+ context
178
+ } = t0;
179
+ const {
180
+ t
181
+ } = useTranslation("agent-chat");
182
+ const cell = useContext(GalleryContext);
183
+ const {
184
+ attachment,
185
+ alt
186
+ } = node.props;
187
+ let t1;
188
+ if ($[0] !== node) {
189
+ t1 = uiNodeLabel(node);
190
+ $[0] = node;
191
+ $[1] = t1;
192
+ } else {
193
+ t1 = $[1];
194
+ }
195
+ const caption = t1;
196
+ let t2;
197
+ if ($[2] !== alt || $[3] !== caption || $[4] !== t) {
198
+ t2 = alt ?? (caption === "" ? t("blocks.image.label") : caption);
199
+ $[2] = alt;
200
+ $[3] = caption;
201
+ $[4] = t;
202
+ $[5] = t2;
203
+ } else {
204
+ t2 = $[5];
205
+ }
206
+ const name = t2;
207
+ const t3 = cell ? "flex min-w-0 flex-col gap-1" : "flex flex-col items-start gap-1.5";
208
+ let t4;
209
+ if ($[6] !== attachment || $[7] !== caption || $[8] !== cell || $[9] !== context || $[10] !== name || $[11] !== t) {
210
+ t4 = attachment === undefined ? /*#__PURE__*/_jsx(ImageThumb, {
211
+ source: {
212
+ url: null,
213
+ failure: t("blocks.image.unavailable")
214
+ },
215
+ alt: name,
216
+ aspect: cell ? 1 : undefined
217
+ }) : /*#__PURE__*/_jsx(AttachedImage, {
218
+ scopeId: context.scopeId,
219
+ chatId: context.chatId,
220
+ attachmentId: attachment,
221
+ alt: name,
222
+ cell: cell,
223
+ unnamed: caption === ""
224
+ });
225
+ $[6] = attachment;
226
+ $[7] = caption;
227
+ $[8] = cell;
228
+ $[9] = context;
229
+ $[10] = name;
230
+ $[11] = t;
231
+ $[12] = t4;
232
+ } else {
233
+ t4 = $[12];
234
+ }
235
+ let t5;
236
+ if ($[13] !== caption || $[14] !== children) {
237
+ t5 = caption !== "" && /*#__PURE__*/_jsx("figcaption", {
238
+ className: "px-0.5 text-2xs wrap-anywhere text-text-muted",
239
+ children: children
240
+ });
241
+ $[13] = caption;
242
+ $[14] = children;
243
+ $[15] = t5;
244
+ } else {
245
+ t5 = $[15];
246
+ }
247
+ let t6;
248
+ if ($[16] !== alt || $[17] !== attachment || $[18] !== caption || $[19] !== cell || $[20] !== t) {
249
+ t6 = cell && caption === "" && attachment === undefined && /*#__PURE__*/_jsx("figcaption", {
250
+ className: "text-xs wrap-anywhere text-text-faint",
251
+ children: alt ?? t("blocks.image.unavailable")
252
+ });
253
+ $[16] = alt;
254
+ $[17] = attachment;
255
+ $[18] = caption;
256
+ $[19] = cell;
257
+ $[20] = t;
258
+ $[21] = t6;
259
+ } else {
260
+ t6 = $[21];
261
+ }
262
+ let t7;
263
+ if ($[22] !== t3 || $[23] !== t4 || $[24] !== t5 || $[25] !== t6) {
264
+ t7 = /*#__PURE__*/_jsxs("figure", {
265
+ className: t3,
266
+ children: [t4, t5, t6]
267
+ });
268
+ $[22] = t3;
269
+ $[23] = t4;
270
+ $[24] = t5;
271
+ $[25] = t6;
272
+ $[26] = t7;
273
+ } else {
274
+ t7 = $[26];
275
+ }
276
+ return t7;
46
277
  }
47
278
  /* Three columns, two in a narrow block; the container decides, not the window, since a chat can be any width. */
48
- export function GalleryRenderer({ node, children }) {
49
- const { t } = useTranslation('agent-chat');
50
- return (_jsx(GalleryContext, { value: true, children: _jsx("div", { role: "group", "aria-label": t('blocks.gallery.label', { count: uiChildrenOf(node, 'Image').length }), className: "@container", children: _jsx("div", { className: "chat-ui-nodes grid grid-cols-2 gap-2 @min-[420px]:grid-cols-3", children: children }) }) }));
279
+ export function GalleryRenderer(t0) {
280
+ const $ = _c(8);
281
+ const {
282
+ node,
283
+ children
284
+ } = t0;
285
+ const {
286
+ t
287
+ } = useTranslation("agent-chat");
288
+ let t1;
289
+ if ($[0] !== node || $[1] !== t) {
290
+ t1 = t("blocks.gallery.label", {
291
+ count: uiChildrenOf(node, "Image").length
292
+ });
293
+ $[0] = node;
294
+ $[1] = t;
295
+ $[2] = t1;
296
+ } else {
297
+ t1 = $[2];
298
+ }
299
+ let t2;
300
+ if ($[3] !== children) {
301
+ t2 = /*#__PURE__*/_jsx("div", {
302
+ className: "chat-ui-nodes grid grid-cols-2 gap-2 @min-[420px]:grid-cols-3",
303
+ children: children
304
+ });
305
+ $[3] = children;
306
+ $[4] = t2;
307
+ } else {
308
+ t2 = $[4];
309
+ }
310
+ let t3;
311
+ if ($[5] !== t1 || $[6] !== t2) {
312
+ t3 = /*#__PURE__*/_jsx(GalleryContext, {
313
+ value: true,
314
+ children: /*#__PURE__*/_jsx("div", {
315
+ role: "group",
316
+ "aria-label": t1,
317
+ className: "@container",
318
+ children: t2
319
+ })
320
+ });
321
+ $[5] = t1;
322
+ $[6] = t2;
323
+ $[7] = t3;
324
+ } else {
325
+ t3 = $[7];
326
+ }
327
+ return t3;
51
328
  }
52
329
  // The shape of the frame until the first picture reports its own.
53
330
  const COMPARE_ASPECT = 4 / 3;
@@ -57,95 +334,973 @@ const COMPARE_MAX_HEIGHT = 384;
57
334
  * Two attachments in one frame, shaped like the first. The split is only this renderer's state. With one
58
335
  * attachment gone the other stands alone with the reason; with both gone the thumbnail says why.
59
336
  */
60
- export function CompareRenderer({ node, children, context }) {
61
- const { t } = useTranslation('agent-chat');
62
- const host = useChatHost();
63
- const { before, after } = node.props;
64
- const beforeLabel = node.props.beforeLabel || t('blocks.compare.before');
65
- const afterLabel = node.props.afterLabel || t('blocks.compare.after');
66
- const first = host.attachments.useUrl(context.scopeId, context.chatId, before);
67
- const second = host.attachments.useUrl(context.scopeId, context.chatId, after);
68
- const [split, setSplit] = useState(0.5);
69
- const [aspect, setAspect] = useState(COMPARE_ASPECT);
70
- const caption = uiNodeLabel(node);
71
- // Each picture is named by its side and by what the whole comparison shows.
72
- const describe = (side) => (caption === '' ? side : `${side}: ${caption}`);
73
- const loading = (source) => source.url === null && source.failure === null;
74
- const label = t('blocks.compare.label', { before: beforeLabel, after: afterLabel });
75
- let body;
76
- if (loading(first) || loading(second)) {
77
- body = _jsx(ImageThumb, { source: { url: null, failure: null }, alt: label, aspect: COMPARE_ASPECT });
78
- }
79
- else if (first.url !== null && second.url !== null) {
80
- body = (_jsxs("div", { className: "relative max-h-96 overflow-hidden rounded-xl bg-ui-tile", style: { aspectRatio: aspect, width: `min(100%, ${COMPARE_MAX_HEIGHT * aspect}px)` }, children: [_jsx(Wipe, { value: split, onValueChange: setSplit, label: label, before: _jsx("img", { src: first.url, alt: describe(beforeLabel), draggable: false, className: "size-full object-contain select-none", onLoad: (event) => {
81
- const { naturalWidth, naturalHeight } = event.currentTarget;
82
- if (naturalWidth > 0 && naturalHeight > 0) {
83
- setAspect(naturalWidth / naturalHeight);
84
- }
85
- } }), after: _jsx("img", { src: second.url, alt: describe(afterLabel), draggable: false, className: "size-full object-contain select-none" }) }), _jsx(CompareChip, { side: "left", label: beforeLabel }), _jsx(CompareChip, { side: "right", label: afterLabel })] }));
337
+ export function CompareRenderer(t0) {
338
+ const $ = _c(65);
339
+ const {
340
+ node,
341
+ children,
342
+ context
343
+ } = t0;
344
+ const {
345
+ t
346
+ } = useTranslation("agent-chat");
347
+ const {
348
+ before,
349
+ after
350
+ } = node.props;
351
+ const beforeLabel = node.props.beforeLabel || t("blocks.compare.before");
352
+ const afterLabel = node.props.afterLabel || t("blocks.compare.after");
353
+ const first = useHostAttachmentUrl(context.scopeId, context.chatId, before);
354
+ const second = useHostAttachmentUrl(context.scopeId, context.chatId, after);
355
+ const [split, setSplit] = useState(0.5);
356
+ const [aspect, setAspect] = useState(COMPARE_ASPECT);
357
+ let t1;
358
+ if ($[0] !== node) {
359
+ t1 = uiNodeLabel(node);
360
+ $[0] = node;
361
+ $[1] = t1;
362
+ } else {
363
+ t1 = $[1];
364
+ }
365
+ const caption = t1;
366
+ let t2;
367
+ if ($[2] !== caption) {
368
+ t2 = side => caption === "" ? side : `${side}: ${caption}`;
369
+ $[2] = caption;
370
+ $[3] = t2;
371
+ } else {
372
+ t2 = $[3];
373
+ }
374
+ const describe = t2;
375
+ const loading = _temp;
376
+ const label = t("blocks.compare.label", {
377
+ before: beforeLabel,
378
+ after: afterLabel
379
+ });
380
+ let body;
381
+ if (loading(first) || loading(second)) {
382
+ let t3;
383
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
384
+ t3 = {
385
+ url: null,
386
+ failure: null
387
+ };
388
+ $[4] = t3;
389
+ } else {
390
+ t3 = $[4];
86
391
  }
87
- else if (first.url === null && second.url === null) {
88
- body = _jsx(ImageThumb, { source: first, alt: label, aspect: COMPARE_ASPECT });
392
+ let t4;
393
+ if ($[5] !== label) {
394
+ t4 = /*#__PURE__*/_jsx(ImageThumb, {
395
+ source: t3,
396
+ alt: label,
397
+ aspect: COMPARE_ASPECT
398
+ });
399
+ $[5] = label;
400
+ $[6] = t4;
401
+ } else {
402
+ t4 = $[6];
89
403
  }
90
- else {
91
- const shown = first.url !== null ? { source: first, name: describe(beforeLabel) } : { source: second, name: describe(afterLabel) };
92
- body = (_jsxs(_Fragment, { children: [_jsx(ImageThumb, { source: shown.source, alt: shown.name, className: "max-h-70 max-w-full object-contain" }), _jsx("span", { className: "text-2xs text-text-faint", children: t('blocks.compare.missing') })] }));
404
+ body = t4;
405
+ } else {
406
+ if (first.url !== null && second.url !== null) {
407
+ const t3 = `min(100%, ${COMPARE_MAX_HEIGHT * aspect}px)`;
408
+ let t4;
409
+ if ($[7] !== aspect || $[8] !== t3) {
410
+ t4 = {
411
+ aspectRatio: aspect,
412
+ width: t3
413
+ };
414
+ $[7] = aspect;
415
+ $[8] = t3;
416
+ $[9] = t4;
417
+ } else {
418
+ t4 = $[9];
419
+ }
420
+ const t5 = first.url;
421
+ let t6;
422
+ if ($[10] !== beforeLabel || $[11] !== describe) {
423
+ t6 = describe(beforeLabel);
424
+ $[10] = beforeLabel;
425
+ $[11] = describe;
426
+ $[12] = t6;
427
+ } else {
428
+ t6 = $[12];
429
+ }
430
+ let t7;
431
+ if ($[13] !== setAspect) {
432
+ t7 = event => {
433
+ const {
434
+ naturalWidth,
435
+ naturalHeight
436
+ } = event.currentTarget;
437
+ if (naturalWidth > 0 && naturalHeight > 0) {
438
+ setAspect(naturalWidth / naturalHeight);
439
+ }
440
+ };
441
+ $[13] = setAspect;
442
+ $[14] = t7;
443
+ } else {
444
+ t7 = $[14];
445
+ }
446
+ let t8;
447
+ if ($[15] !== first.url || $[16] !== t6 || $[17] !== t7) {
448
+ t8 = /*#__PURE__*/_jsx("img", {
449
+ src: t5,
450
+ alt: t6,
451
+ draggable: false,
452
+ className: "size-full object-contain select-none",
453
+ onLoad: t7
454
+ });
455
+ $[15] = first.url;
456
+ $[16] = t6;
457
+ $[17] = t7;
458
+ $[18] = t8;
459
+ } else {
460
+ t8 = $[18];
461
+ }
462
+ const t9 = second.url;
463
+ let t10;
464
+ if ($[19] !== afterLabel || $[20] !== describe) {
465
+ t10 = describe(afterLabel);
466
+ $[19] = afterLabel;
467
+ $[20] = describe;
468
+ $[21] = t10;
469
+ } else {
470
+ t10 = $[21];
471
+ }
472
+ let t11;
473
+ if ($[22] !== second.url || $[23] !== t10) {
474
+ t11 = /*#__PURE__*/_jsx("img", {
475
+ src: t9,
476
+ alt: t10,
477
+ draggable: false,
478
+ className: "size-full object-contain select-none"
479
+ });
480
+ $[22] = second.url;
481
+ $[23] = t10;
482
+ $[24] = t11;
483
+ } else {
484
+ t11 = $[24];
485
+ }
486
+ let t12;
487
+ if ($[25] !== label || $[26] !== setSplit || $[27] !== split || $[28] !== t11 || $[29] !== t8) {
488
+ t12 = /*#__PURE__*/_jsx(Wipe, {
489
+ value: split,
490
+ onValueChange: setSplit,
491
+ label: label,
492
+ before: t8,
493
+ after: t11
494
+ });
495
+ $[25] = label;
496
+ $[26] = setSplit;
497
+ $[27] = split;
498
+ $[28] = t11;
499
+ $[29] = t8;
500
+ $[30] = t12;
501
+ } else {
502
+ t12 = $[30];
503
+ }
504
+ let t13;
505
+ if ($[31] !== beforeLabel) {
506
+ t13 = /*#__PURE__*/_jsx(CompareChip, {
507
+ side: "left",
508
+ label: beforeLabel
509
+ });
510
+ $[31] = beforeLabel;
511
+ $[32] = t13;
512
+ } else {
513
+ t13 = $[32];
514
+ }
515
+ let t14;
516
+ if ($[33] !== afterLabel) {
517
+ t14 = /*#__PURE__*/_jsx(CompareChip, {
518
+ side: "right",
519
+ label: afterLabel
520
+ });
521
+ $[33] = afterLabel;
522
+ $[34] = t14;
523
+ } else {
524
+ t14 = $[34];
525
+ }
526
+ let t15;
527
+ if ($[35] !== t12 || $[36] !== t13 || $[37] !== t14 || $[38] !== t4) {
528
+ t15 = /*#__PURE__*/_jsxs("div", {
529
+ className: "relative max-h-96 overflow-hidden rounded-xl bg-ui-tile",
530
+ style: t4,
531
+ children: [t12, t13, t14]
532
+ });
533
+ $[35] = t12;
534
+ $[36] = t13;
535
+ $[37] = t14;
536
+ $[38] = t4;
537
+ $[39] = t15;
538
+ } else {
539
+ t15 = $[39];
540
+ }
541
+ body = t15;
542
+ } else {
543
+ if (first.url === null && second.url === null) {
544
+ let t3;
545
+ if ($[40] !== first || $[41] !== label) {
546
+ t3 = /*#__PURE__*/_jsx(ImageThumb, {
547
+ source: first,
548
+ alt: label,
549
+ aspect: COMPARE_ASPECT
550
+ });
551
+ $[40] = first;
552
+ $[41] = label;
553
+ $[42] = t3;
554
+ } else {
555
+ t3 = $[42];
556
+ }
557
+ body = t3;
558
+ } else {
559
+ let t3;
560
+ if ($[43] !== afterLabel || $[44] !== beforeLabel || $[45] !== describe || $[46] !== first || $[47] !== second) {
561
+ t3 = first.url !== null ? {
562
+ source: first,
563
+ name: describe(beforeLabel)
564
+ } : {
565
+ source: second,
566
+ name: describe(afterLabel)
567
+ };
568
+ $[43] = afterLabel;
569
+ $[44] = beforeLabel;
570
+ $[45] = describe;
571
+ $[46] = first;
572
+ $[47] = second;
573
+ $[48] = t3;
574
+ } else {
575
+ t3 = $[48];
576
+ }
577
+ const shown = t3;
578
+ let t4;
579
+ if ($[49] !== shown.name || $[50] !== shown.source) {
580
+ t4 = /*#__PURE__*/_jsx(ImageThumb, {
581
+ source: shown.source,
582
+ alt: shown.name,
583
+ className: "max-h-70 max-w-full object-contain"
584
+ });
585
+ $[49] = shown.name;
586
+ $[50] = shown.source;
587
+ $[51] = t4;
588
+ } else {
589
+ t4 = $[51];
590
+ }
591
+ let t5;
592
+ if ($[52] !== t) {
593
+ t5 = t("blocks.compare.missing");
594
+ $[52] = t;
595
+ $[53] = t5;
596
+ } else {
597
+ t5 = $[53];
598
+ }
599
+ let t6;
600
+ if ($[54] !== t5) {
601
+ t6 = /*#__PURE__*/_jsx("span", {
602
+ className: "text-2xs text-text-faint",
603
+ children: t5
604
+ });
605
+ $[54] = t5;
606
+ $[55] = t6;
607
+ } else {
608
+ t6 = $[55];
609
+ }
610
+ let t7;
611
+ if ($[56] !== t4 || $[57] !== t6) {
612
+ t7 = /*#__PURE__*/_jsxs(_Fragment, {
613
+ children: [t4, t6]
614
+ });
615
+ $[56] = t4;
616
+ $[57] = t6;
617
+ $[58] = t7;
618
+ } else {
619
+ t7 = $[58];
620
+ }
621
+ body = t7;
622
+ }
93
623
  }
94
- return (_jsxs("figure", { className: "flex w-full flex-col items-start gap-1.5", children: [body, caption !== '' && _jsx("figcaption", { className: "px-0.5 text-2xs text-text-muted", children: children })] }));
624
+ }
625
+ let t3;
626
+ if ($[59] !== caption || $[60] !== children) {
627
+ t3 = caption !== "" && /*#__PURE__*/_jsx("figcaption", {
628
+ className: "px-0.5 text-2xs text-text-muted",
629
+ children: children
630
+ });
631
+ $[59] = caption;
632
+ $[60] = children;
633
+ $[61] = t3;
634
+ } else {
635
+ t3 = $[61];
636
+ }
637
+ let t4;
638
+ if ($[62] !== body || $[63] !== t3) {
639
+ t4 = /*#__PURE__*/_jsxs("figure", {
640
+ className: "flex w-full flex-col items-start gap-1.5",
641
+ children: [body, t3]
642
+ });
643
+ $[62] = body;
644
+ $[63] = t3;
645
+ $[64] = t4;
646
+ } else {
647
+ t4 = $[64];
648
+ }
649
+ return t4;
95
650
  }
96
651
  /* A chip on the picture gets a ground of its own, since a pill's alpha ground would vanish over an image. */
97
- function CompareChip({ side, label }) {
98
- return (_jsx("span", { className: clsx('pointer-events-none absolute top-2 z-20 max-w-2/5 truncate rounded-md bg-surface-raised', side === 'left' ? 'left-2' : 'right-2'), children: _jsx(Pill, { shape: "tag", size: "sm", tone: "muted", children: label }) }));
652
+ function _temp(source) {
653
+ return source.url === null && source.failure === null;
654
+ }
655
+ function CompareChip(t0) {
656
+ const $ = _c(7);
657
+ const {
658
+ side,
659
+ label
660
+ } = t0;
661
+ const t1 = side === "left" ? "left-2" : "right-2";
662
+ let t2;
663
+ if ($[0] !== t1) {
664
+ t2 = clsx("pointer-events-none absolute top-2 z-20 max-w-2/5 truncate rounded-md bg-surface-raised", t1);
665
+ $[0] = t1;
666
+ $[1] = t2;
667
+ } else {
668
+ t2 = $[1];
669
+ }
670
+ let t3;
671
+ if ($[2] !== label) {
672
+ t3 = /*#__PURE__*/_jsx(Pill, {
673
+ shape: "tag",
674
+ size: "sm",
675
+ tone: "muted",
676
+ children: label
677
+ });
678
+ $[2] = label;
679
+ $[3] = t3;
680
+ } else {
681
+ t3 = $[3];
682
+ }
683
+ let t4;
684
+ if ($[4] !== t2 || $[5] !== t3) {
685
+ t4 = /*#__PURE__*/_jsx("span", {
686
+ className: t2,
687
+ children: t3
688
+ });
689
+ $[4] = t2;
690
+ $[5] = t3;
691
+ $[6] = t4;
692
+ } else {
693
+ t4 = $[6];
694
+ }
695
+ return t4;
99
696
  }
100
697
  /*
101
698
  * The host draws the model, since the chat knows no 3D format. The frame has a fixed height in the reply column,
102
699
  * so a view that loads late never moves the thread. Without a view of the host, or without the bytes, the model
103
700
  * stays a quiet row that names it.
104
701
  */
105
- export function ModelRenderer({ node, children, context }) {
106
- const { t } = useTranslation('agent-chat');
107
- const host = useChatHost();
108
- const { attachment, alt } = node.props;
109
- const source = host.attachments.useUrl(context.scopeId, context.chatId, attachment);
110
- const caption = uiNodeLabel(node);
111
- const label = alt ?? (caption === '' ? t('blocks.model.label') : caption);
112
- const View = host.ModelView;
113
- let body;
114
- if (View !== undefined && source.url !== null) {
115
- body = (_jsx("div", { role: "group", "aria-label": label, className: "relative h-80 w-full overflow-hidden rounded-xl bg-ui-tile", children: _jsx(ErrorBoundary, { label: t('blocks.model.crashed'), resetKeys: [attachment, source.url], compact: true, children: _jsx(View, { scopeId: context.scopeId, chatId: context.chatId, attachmentId: attachment, url: source.url, label: label, alt: alt, caption: caption }) }) }));
702
+ export function ModelRenderer(t0) {
703
+ const $ = _c(46);
704
+ const {
705
+ node,
706
+ children,
707
+ context
708
+ } = t0;
709
+ const {
710
+ t
711
+ } = useTranslation("agent-chat");
712
+ const host = useChatHost();
713
+ const {
714
+ attachment,
715
+ alt
716
+ } = node.props;
717
+ const source = useHostAttachmentUrl(context.scopeId, context.chatId, attachment);
718
+ let t1;
719
+ if ($[0] !== node) {
720
+ t1 = uiNodeLabel(node);
721
+ $[0] = node;
722
+ $[1] = t1;
723
+ } else {
724
+ t1 = $[1];
725
+ }
726
+ const caption = t1;
727
+ let t2;
728
+ if ($[2] !== alt || $[3] !== caption || $[4] !== t) {
729
+ t2 = alt ?? (caption === "" ? t("blocks.model.label") : caption);
730
+ $[2] = alt;
731
+ $[3] = caption;
732
+ $[4] = t;
733
+ $[5] = t2;
734
+ } else {
735
+ t2 = $[5];
736
+ }
737
+ const label = t2;
738
+ const View = host.ModelView;
739
+ let body;
740
+ if (View !== undefined && source.url !== null) {
741
+ let t3;
742
+ if ($[6] !== t) {
743
+ t3 = t("blocks.model.crashed");
744
+ $[6] = t;
745
+ $[7] = t3;
746
+ } else {
747
+ t3 = $[7];
748
+ }
749
+ let t4;
750
+ if ($[8] !== attachment || $[9] !== source.url) {
751
+ t4 = [attachment, source.url];
752
+ $[8] = attachment;
753
+ $[9] = source.url;
754
+ $[10] = t4;
755
+ } else {
756
+ t4 = $[10];
116
757
  }
117
- else if (View !== undefined && source.failure === null) {
118
- body = _jsx("div", { "aria-busy": "true", "aria-label": label, className: "h-80 w-full rounded-xl bg-ui-tile" });
758
+ let t5;
759
+ if ($[11] !== View || $[12] !== alt || $[13] !== attachment || $[14] !== caption || $[15] !== context.chatId || $[16] !== context.scopeId || $[17] !== label || $[18] !== source.url) {
760
+ t5 = /*#__PURE__*/_jsx(View, {
761
+ scopeId: context.scopeId,
762
+ chatId: context.chatId,
763
+ attachmentId: attachment,
764
+ url: source.url,
765
+ label: label,
766
+ alt: alt,
767
+ caption: caption
768
+ });
769
+ $[11] = View;
770
+ $[12] = alt;
771
+ $[13] = attachment;
772
+ $[14] = caption;
773
+ $[15] = context.chatId;
774
+ $[16] = context.scopeId;
775
+ $[17] = label;
776
+ $[18] = source.url;
777
+ $[19] = t5;
778
+ } else {
779
+ t5 = $[19];
119
780
  }
120
- else {
121
- body = (_jsxs("div", { className: "flex w-full min-w-0 items-center gap-2 rounded-xl bg-ui-tile px-3 py-2 text-xs", children: [_jsx(Icon, { icon: Box, size: 14, className: "shrink-0 text-text-muted" }), _jsx("span", { className: "min-w-0 truncate text-text", children: alt ?? attachment }), _jsx("span", { className: "ml-auto shrink-0 text-text-faint", children: source.failure === null ? t('blocks.model.label') : t('blocks.model.unavailable') })] }));
781
+ let t6;
782
+ if ($[20] !== t3 || $[21] !== t4 || $[22] !== t5) {
783
+ t6 = /*#__PURE__*/_jsx(ErrorBoundary, {
784
+ label: t3,
785
+ resetKeys: t4,
786
+ compact: true,
787
+ children: t5
788
+ });
789
+ $[20] = t3;
790
+ $[21] = t4;
791
+ $[22] = t5;
792
+ $[23] = t6;
793
+ } else {
794
+ t6 = $[23];
122
795
  }
123
- return (_jsxs("figure", { className: "flex w-full flex-col items-start gap-1.5", children: [body, caption !== '' && _jsx("figcaption", { className: "px-0.5 text-2xs text-text-muted", children: children })] }));
796
+ let t7;
797
+ if ($[24] !== label || $[25] !== t6) {
798
+ t7 = /*#__PURE__*/_jsx("div", {
799
+ role: "group",
800
+ "aria-label": label,
801
+ className: "relative h-80 w-full overflow-hidden rounded-xl bg-ui-tile",
802
+ children: t6
803
+ });
804
+ $[24] = label;
805
+ $[25] = t6;
806
+ $[26] = t7;
807
+ } else {
808
+ t7 = $[26];
809
+ }
810
+ body = t7;
811
+ } else {
812
+ if (View !== undefined && source.failure === null) {
813
+ let t3;
814
+ if ($[27] !== label) {
815
+ t3 = /*#__PURE__*/_jsx("div", {
816
+ "aria-busy": "true",
817
+ "aria-label": label,
818
+ className: "h-80 w-full rounded-xl bg-ui-tile"
819
+ });
820
+ $[27] = label;
821
+ $[28] = t3;
822
+ } else {
823
+ t3 = $[28];
824
+ }
825
+ body = t3;
826
+ } else {
827
+ let t3;
828
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
829
+ t3 = /*#__PURE__*/_jsx(Icon, {
830
+ icon: Box,
831
+ size: 14,
832
+ className: "shrink-0 text-text-muted"
833
+ });
834
+ $[29] = t3;
835
+ } else {
836
+ t3 = $[29];
837
+ }
838
+ const t4 = alt ?? attachment;
839
+ let t5;
840
+ if ($[30] !== t4) {
841
+ t5 = /*#__PURE__*/_jsx("span", {
842
+ className: "min-w-0 truncate text-text",
843
+ children: t4
844
+ });
845
+ $[30] = t4;
846
+ $[31] = t5;
847
+ } else {
848
+ t5 = $[31];
849
+ }
850
+ let t6;
851
+ if ($[32] !== source.failure || $[33] !== t) {
852
+ t6 = source.failure === null ? t("blocks.model.label") : t("blocks.model.unavailable");
853
+ $[32] = source.failure;
854
+ $[33] = t;
855
+ $[34] = t6;
856
+ } else {
857
+ t6 = $[34];
858
+ }
859
+ let t7;
860
+ if ($[35] !== t6) {
861
+ t7 = /*#__PURE__*/_jsx("span", {
862
+ className: "ml-auto shrink-0 text-text-faint",
863
+ children: t6
864
+ });
865
+ $[35] = t6;
866
+ $[36] = t7;
867
+ } else {
868
+ t7 = $[36];
869
+ }
870
+ let t8;
871
+ if ($[37] !== t5 || $[38] !== t7) {
872
+ t8 = /*#__PURE__*/_jsxs("div", {
873
+ className: "flex w-full min-w-0 items-center gap-2 rounded-xl bg-ui-tile px-3 py-2 text-xs",
874
+ children: [t3, t5, t7]
875
+ });
876
+ $[37] = t5;
877
+ $[38] = t7;
878
+ $[39] = t8;
879
+ } else {
880
+ t8 = $[39];
881
+ }
882
+ body = t8;
883
+ }
884
+ }
885
+ let t3;
886
+ if ($[40] !== caption || $[41] !== children) {
887
+ t3 = caption !== "" && /*#__PURE__*/_jsx("figcaption", {
888
+ className: "px-0.5 text-2xs text-text-muted",
889
+ children: children
890
+ });
891
+ $[40] = caption;
892
+ $[41] = children;
893
+ $[42] = t3;
894
+ } else {
895
+ t3 = $[42];
896
+ }
897
+ let t4;
898
+ if ($[43] !== body || $[44] !== t3) {
899
+ t4 = /*#__PURE__*/_jsxs("figure", {
900
+ className: "flex w-full flex-col items-start gap-1.5",
901
+ children: [body, t3]
902
+ });
903
+ $[43] = body;
904
+ $[44] = t3;
905
+ $[45] = t4;
906
+ } else {
907
+ t4 = $[45];
908
+ }
909
+ return t4;
124
910
  }
125
- export function SourcesRenderer({ node, children }) {
126
- const { t } = useTranslation('agent-chat');
127
- const headingId = useId();
128
- const numbers = new Map(uiChildrenOf(node, 'Source').map((source, index) => [source.id, index + 1]));
129
- return (_jsx(SourceNumbers, { value: numbers, children: _jsxs("section", { "aria-labelledby": headingId, className: "chat-ui-flat flex flex-col rounded-xl bg-ui-tile p-1.5", children: [_jsx("span", { id: headingId, className: "chat-ui-flat-inner px-1.5 pt-0.5 pb-1 text-2xs font-medium text-text-muted", children: t('blocks.sources') }), _jsx("ol", { className: "chat-ui-nodes flex flex-col", children: children })] }) }));
911
+ export function SourcesRenderer(t0) {
912
+ const $ = _c(16);
913
+ const {
914
+ node,
915
+ children
916
+ } = t0;
917
+ const {
918
+ t
919
+ } = useTranslation("agent-chat");
920
+ const headingId = useId();
921
+ let t1;
922
+ if ($[0] !== node) {
923
+ t1 = new Map(uiChildrenOf(node, "Source").map(_temp2));
924
+ $[0] = node;
925
+ $[1] = t1;
926
+ } else {
927
+ t1 = $[1];
928
+ }
929
+ const numbers = t1;
930
+ let t2;
931
+ if ($[2] !== t) {
932
+ t2 = t("blocks.sources");
933
+ $[2] = t;
934
+ $[3] = t2;
935
+ } else {
936
+ t2 = $[3];
937
+ }
938
+ let t3;
939
+ if ($[4] !== headingId || $[5] !== t2) {
940
+ t3 = /*#__PURE__*/_jsx("span", {
941
+ id: headingId,
942
+ className: "chat-ui-flat-inner px-1.5 pt-0.5 pb-1 text-2xs font-medium text-text-muted",
943
+ children: t2
944
+ });
945
+ $[4] = headingId;
946
+ $[5] = t2;
947
+ $[6] = t3;
948
+ } else {
949
+ t3 = $[6];
950
+ }
951
+ let t4;
952
+ if ($[7] !== children) {
953
+ t4 = /*#__PURE__*/_jsx("ol", {
954
+ className: "chat-ui-nodes flex flex-col",
955
+ children: children
956
+ });
957
+ $[7] = children;
958
+ $[8] = t4;
959
+ } else {
960
+ t4 = $[8];
961
+ }
962
+ let t5;
963
+ if ($[9] !== headingId || $[10] !== t3 || $[11] !== t4) {
964
+ t5 = /*#__PURE__*/_jsxs("section", {
965
+ "aria-labelledby": headingId,
966
+ className: "chat-ui-flat flex flex-col rounded-xl bg-ui-tile p-1.5",
967
+ children: [t3, t4]
968
+ });
969
+ $[9] = headingId;
970
+ $[10] = t3;
971
+ $[11] = t4;
972
+ $[12] = t5;
973
+ } else {
974
+ t5 = $[12];
975
+ }
976
+ let t6;
977
+ if ($[13] !== numbers || $[14] !== t5) {
978
+ t6 = /*#__PURE__*/_jsx(SourceNumbers, {
979
+ value: numbers,
980
+ children: t5
981
+ });
982
+ $[13] = numbers;
983
+ $[14] = t5;
984
+ $[15] = t6;
985
+ } else {
986
+ t6 = $[15];
987
+ }
988
+ return t6;
130
989
  }
131
990
  /*
132
991
  * A source number in running text. Resting on it or focusing it shows the title and the domain, and
133
992
  * a tap reveals the row in the list of sources; only that row opens the address, so nothing loads
134
993
  * before a person asks for it.
135
994
  */
136
- export function UiSourceCitation({ number, title, url, onReveal, className }) {
137
- const { t } = useTranslation('agent-chat');
138
- return (_jsxs(PreviewCard.Root, { children: [_jsx(PreviewCard.Trigger, { delay: 300, closeDelay: 150, render: onReveal === undefined ? _jsx("span", {}) : _jsx("button", { type: "button" }), "aria-label": onReveal === undefined ? undefined : t('blocks.citation', { number: formatNumber(number), title }), className: clsx('inline-flex h-4 min-w-4.5 items-center justify-center rounded-sm bg-text/7 px-1 align-[1px] text-2xs leading-4 text-text-muted tabular-nums', onReveal !== undefined && 'cursor-pointer hover:bg-text/12 hover:text-text', className), onClick: onReveal, children: formatNumber(number) }), _jsxs(PreviewCard.Popup, { side: "top", align: "center", sideOffset: 4, className: "flex max-w-72 flex-col px-2.5 py-1.5 text-xs", children: [_jsx("span", { className: "line-clamp-2 text-text", children: title }), _jsx("span", { className: "truncate text-text-faint", children: uiUrlDomain(url) })] })] }));
995
+ function _temp2(source, index) {
996
+ return [source.id, index + 1];
997
+ }
998
+ export function UiSourceCitation(t0) {
999
+ const $ = _c(30);
1000
+ const {
1001
+ number,
1002
+ title,
1003
+ url,
1004
+ onReveal,
1005
+ className
1006
+ } = t0;
1007
+ const {
1008
+ t
1009
+ } = useTranslation("agent-chat");
1010
+ let t1;
1011
+ if ($[0] !== onReveal) {
1012
+ t1 = onReveal === undefined ? /*#__PURE__*/_jsx("span", {}) : /*#__PURE__*/_jsx("button", {
1013
+ type: "button"
1014
+ });
1015
+ $[0] = onReveal;
1016
+ $[1] = t1;
1017
+ } else {
1018
+ t1 = $[1];
1019
+ }
1020
+ let t2;
1021
+ if ($[2] !== number || $[3] !== onReveal || $[4] !== t || $[5] !== title) {
1022
+ t2 = onReveal === undefined ? undefined : t("blocks.citation", {
1023
+ number: formatNumber(number),
1024
+ title
1025
+ });
1026
+ $[2] = number;
1027
+ $[3] = onReveal;
1028
+ $[4] = t;
1029
+ $[5] = title;
1030
+ $[6] = t2;
1031
+ } else {
1032
+ t2 = $[6];
1033
+ }
1034
+ const t3 = onReveal !== undefined && "cursor-pointer hover:bg-text/12 hover:text-text";
1035
+ let t4;
1036
+ if ($[7] !== className || $[8] !== t3) {
1037
+ t4 = clsx("inline-flex h-4 min-w-4.5 items-center justify-center rounded-sm bg-text/7 px-1 align-[1px] text-2xs leading-4 text-text-muted tabular-nums", t3, className);
1038
+ $[7] = className;
1039
+ $[8] = t3;
1040
+ $[9] = t4;
1041
+ } else {
1042
+ t4 = $[9];
1043
+ }
1044
+ let t5;
1045
+ if ($[10] !== number) {
1046
+ t5 = formatNumber(number);
1047
+ $[10] = number;
1048
+ $[11] = t5;
1049
+ } else {
1050
+ t5 = $[11];
1051
+ }
1052
+ let t6;
1053
+ if ($[12] !== onReveal || $[13] !== t1 || $[14] !== t2 || $[15] !== t4 || $[16] !== t5) {
1054
+ t6 = /*#__PURE__*/_jsx(PreviewCard.Trigger, {
1055
+ delay: 300,
1056
+ closeDelay: 150,
1057
+ render: t1,
1058
+ "aria-label": t2,
1059
+ className: t4,
1060
+ onClick: onReveal,
1061
+ children: t5
1062
+ });
1063
+ $[12] = onReveal;
1064
+ $[13] = t1;
1065
+ $[14] = t2;
1066
+ $[15] = t4;
1067
+ $[16] = t5;
1068
+ $[17] = t6;
1069
+ } else {
1070
+ t6 = $[17];
1071
+ }
1072
+ let t7;
1073
+ if ($[18] !== title) {
1074
+ t7 = /*#__PURE__*/_jsx("span", {
1075
+ className: "line-clamp-2 text-text",
1076
+ children: title
1077
+ });
1078
+ $[18] = title;
1079
+ $[19] = t7;
1080
+ } else {
1081
+ t7 = $[19];
1082
+ }
1083
+ let t8;
1084
+ if ($[20] !== url) {
1085
+ t8 = uiUrlDomain(url);
1086
+ $[20] = url;
1087
+ $[21] = t8;
1088
+ } else {
1089
+ t8 = $[21];
1090
+ }
1091
+ let t9;
1092
+ if ($[22] !== t8) {
1093
+ t9 = /*#__PURE__*/_jsx("span", {
1094
+ className: "truncate text-text-faint",
1095
+ children: t8
1096
+ });
1097
+ $[22] = t8;
1098
+ $[23] = t9;
1099
+ } else {
1100
+ t9 = $[23];
1101
+ }
1102
+ let t10;
1103
+ if ($[24] !== t7 || $[25] !== t9) {
1104
+ t10 = /*#__PURE__*/_jsxs(PreviewCard.Popup, {
1105
+ side: "top",
1106
+ align: "center",
1107
+ sideOffset: 4,
1108
+ className: "flex max-w-72 flex-col px-2.5 py-1.5 text-xs",
1109
+ children: [t7, t9]
1110
+ });
1111
+ $[24] = t7;
1112
+ $[25] = t9;
1113
+ $[26] = t10;
1114
+ } else {
1115
+ t10 = $[26];
1116
+ }
1117
+ let t11;
1118
+ if ($[27] !== t10 || $[28] !== t6) {
1119
+ t11 = /*#__PURE__*/_jsxs(PreviewCard.Root, {
1120
+ children: [t6, t10]
1121
+ });
1122
+ $[27] = t10;
1123
+ $[28] = t6;
1124
+ $[29] = t11;
1125
+ } else {
1126
+ t11 = $[29];
1127
+ }
1128
+ return t11;
139
1129
  }
140
1130
  /*
141
1131
  * Opens through the host and loads nothing before, not even an icon. The row itself takes focus
142
1132
  * when a citation reveals it, apart from the button that opens it.
143
1133
  */
144
- export function SourceRenderer({ node, context }) {
145
- const number = useContext(SourceNumbers).get(node.id);
146
- const { title, url } = node.props;
147
- const { openUrl } = context;
148
- const [measureDomain, domainCut] = useTruncated();
149
- const face = (_jsxs(_Fragment, { children: [_jsx("span", { className: "grid size-5 shrink-0 place-items-center rounded-md bg-ui-inset text-2xs font-semibold text-text tabular-nums", children: number }), _jsxs("span", { className: "flex min-w-0 grow flex-col", children: [_jsx("span", { className: "font-medium wrap-anywhere text-text", children: title }), _jsx("span", { ref: measureDomain, className: "truncate text-text-muted", children: uiUrlDomain(url) })] })] }));
150
- return (_jsx("li", { "data-ui-source": node.id, tabIndex: -1, className: "chat-ui-source scroll-my-2 rounded-md", children: _jsx(Tooltip, { label: _jsxs(_Fragment, { children: [_jsx("span", { className: "block", children: title }), _jsx("span", { className: "block text-text-muted", children: url })] }), children: openUrl === undefined ? (_jsx("span", { tabIndex: domainCut ? 0 : undefined, className: "chat-ui-flat-inner flex min-h-8 items-start gap-2.5 rounded-lg px-1.5 py-1.5 text-2xs", children: face })) : (_jsx("button", { type: "button", className: "chat-ui-flat-inner flex min-h-8 w-full items-start gap-2.5 rounded-lg px-1.5 py-1.5 text-left text-2xs hover:bg-text/4", onClick: () => openUrl(url), children: face })) }) }));
151
- }
1134
+ export function SourceRenderer(t0) {
1135
+ const $ = _c(36);
1136
+ const {
1137
+ node,
1138
+ context
1139
+ } = t0;
1140
+ const t1 = useContext(SourceNumbers);
1141
+ let t2;
1142
+ if ($[0] !== node.id || $[1] !== t1) {
1143
+ t2 = t1.get(node.id);
1144
+ $[0] = node.id;
1145
+ $[1] = t1;
1146
+ $[2] = t2;
1147
+ } else {
1148
+ t2 = $[2];
1149
+ }
1150
+ const number = t2;
1151
+ const {
1152
+ title,
1153
+ url
1154
+ } = node.props;
1155
+ const {
1156
+ openUrl
1157
+ } = context;
1158
+ const [measureDomain, domainCut] = useTruncated();
1159
+ let t3;
1160
+ if ($[3] !== number) {
1161
+ t3 = /*#__PURE__*/_jsx("span", {
1162
+ className: "grid size-5 shrink-0 place-items-center rounded-md bg-ui-inset text-2xs font-semibold text-text tabular-nums",
1163
+ children: number
1164
+ });
1165
+ $[3] = number;
1166
+ $[4] = t3;
1167
+ } else {
1168
+ t3 = $[4];
1169
+ }
1170
+ let t4;
1171
+ if ($[5] !== title) {
1172
+ t4 = /*#__PURE__*/_jsx("span", {
1173
+ className: "font-medium wrap-anywhere text-text",
1174
+ children: title
1175
+ });
1176
+ $[5] = title;
1177
+ $[6] = t4;
1178
+ } else {
1179
+ t4 = $[6];
1180
+ }
1181
+ let t5;
1182
+ if ($[7] !== url) {
1183
+ t5 = uiUrlDomain(url);
1184
+ $[7] = url;
1185
+ $[8] = t5;
1186
+ } else {
1187
+ t5 = $[8];
1188
+ }
1189
+ let t6;
1190
+ if ($[9] !== measureDomain || $[10] !== t5) {
1191
+ t6 = /*#__PURE__*/_jsx("span", {
1192
+ ref: measureDomain,
1193
+ className: "truncate text-text-muted",
1194
+ children: t5
1195
+ });
1196
+ $[9] = measureDomain;
1197
+ $[10] = t5;
1198
+ $[11] = t6;
1199
+ } else {
1200
+ t6 = $[11];
1201
+ }
1202
+ let t7;
1203
+ if ($[12] !== t4 || $[13] !== t6) {
1204
+ t7 = /*#__PURE__*/_jsxs("span", {
1205
+ className: "flex min-w-0 grow flex-col",
1206
+ children: [t4, t6]
1207
+ });
1208
+ $[12] = t4;
1209
+ $[13] = t6;
1210
+ $[14] = t7;
1211
+ } else {
1212
+ t7 = $[14];
1213
+ }
1214
+ let t8;
1215
+ if ($[15] !== t3 || $[16] !== t7) {
1216
+ t8 = /*#__PURE__*/_jsxs(_Fragment, {
1217
+ children: [t3, t7]
1218
+ });
1219
+ $[15] = t3;
1220
+ $[16] = t7;
1221
+ $[17] = t8;
1222
+ } else {
1223
+ t8 = $[17];
1224
+ }
1225
+ const face = t8;
1226
+ let t9;
1227
+ if ($[18] !== title) {
1228
+ t9 = /*#__PURE__*/_jsx("span", {
1229
+ className: "block",
1230
+ children: title
1231
+ });
1232
+ $[18] = title;
1233
+ $[19] = t9;
1234
+ } else {
1235
+ t9 = $[19];
1236
+ }
1237
+ let t10;
1238
+ if ($[20] !== url) {
1239
+ t10 = /*#__PURE__*/_jsx("span", {
1240
+ className: "block text-text-muted",
1241
+ children: url
1242
+ });
1243
+ $[20] = url;
1244
+ $[21] = t10;
1245
+ } else {
1246
+ t10 = $[21];
1247
+ }
1248
+ let t11;
1249
+ if ($[22] !== t10 || $[23] !== t9) {
1250
+ t11 = /*#__PURE__*/_jsxs(_Fragment, {
1251
+ children: [t9, t10]
1252
+ });
1253
+ $[22] = t10;
1254
+ $[23] = t9;
1255
+ $[24] = t11;
1256
+ } else {
1257
+ t11 = $[24];
1258
+ }
1259
+ let t12;
1260
+ if ($[25] !== domainCut || $[26] !== face || $[27] !== openUrl || $[28] !== url) {
1261
+ t12 = openUrl === undefined ? /*#__PURE__*/_jsx("span", {
1262
+ tabIndex: domainCut ? 0 : undefined,
1263
+ className: "chat-ui-flat-inner flex min-h-8 items-start gap-2.5 rounded-lg px-1.5 py-1.5 text-2xs",
1264
+ children: face
1265
+ }) : /*#__PURE__*/_jsx("button", {
1266
+ type: "button",
1267
+ className: "chat-ui-flat-inner flex min-h-8 w-full items-start gap-2.5 rounded-lg px-1.5 py-1.5 text-left text-2xs hover:bg-text/4",
1268
+ onClick: () => openUrl(url),
1269
+ children: face
1270
+ });
1271
+ $[25] = domainCut;
1272
+ $[26] = face;
1273
+ $[27] = openUrl;
1274
+ $[28] = url;
1275
+ $[29] = t12;
1276
+ } else {
1277
+ t12 = $[29];
1278
+ }
1279
+ let t13;
1280
+ if ($[30] !== t11 || $[31] !== t12) {
1281
+ t13 = /*#__PURE__*/_jsx(Tooltip, {
1282
+ label: t11,
1283
+ children: t12
1284
+ });
1285
+ $[30] = t11;
1286
+ $[31] = t12;
1287
+ $[32] = t13;
1288
+ } else {
1289
+ t13 = $[32];
1290
+ }
1291
+ let t14;
1292
+ if ($[33] !== node.id || $[34] !== t13) {
1293
+ t14 = /*#__PURE__*/_jsx("li", {
1294
+ "data-ui-source": node.id,
1295
+ tabIndex: -1,
1296
+ className: "chat-ui-source scroll-my-2 rounded-md",
1297
+ children: t13
1298
+ });
1299
+ $[33] = node.id;
1300
+ $[34] = t13;
1301
+ $[35] = t14;
1302
+ } else {
1303
+ t14 = $[35];
1304
+ }
1305
+ return t14;
1306
+ }