@adecore/agents-react 0.31.11 → 0.32.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 (404) hide show
  1. package/dist/agents/AccountDot.js +57 -6
  2. package/dist/agents/AgentIcon.js +88 -12
  3. package/dist/agents/ModelOptionControl.js +153 -18
  4. package/dist/agents/ProviderLogo.js +49 -4
  5. package/dist/agents/account-limits.js +17 -14
  6. package/dist/agents/accounts.js +99 -67
  7. package/dist/agents/agent-marks.js +5 -3
  8. package/dist/agents/model-name.js +42 -31
  9. package/dist/agents/model-options.js +8 -8
  10. package/dist/agents/model-requirement.js +17 -14
  11. package/dist/agents/option-words.d.ts +7 -0
  12. package/dist/agents/option-words.js +35 -0
  13. package/dist/agents/provider-paths.js +6 -6
  14. package/dist/agents/status-look.js +32 -12
  15. package/dist/chat/account-choice.d.ts +13 -0
  16. package/dist/chat/account-choice.js +90 -20
  17. package/dist/chat/actions.js +126 -59
  18. package/dist/chat/activity.js +5 -5
  19. package/dist/chat/attachments.js +74 -53
  20. package/dist/chat/bookmarks.js +58 -48
  21. package/dist/chat/chat-client.js +344 -263
  22. package/dist/chat/chat-references.js +3 -3
  23. package/dist/chat/composer-effort.d.ts +5 -0
  24. package/dist/chat/composer-effort.js +26 -0
  25. package/dist/chat/composer-send.js +13 -13
  26. package/dist/chat/drafts.js +115 -79
  27. package/dist/chat/forks.js +81 -24
  28. package/dist/chat/guards.js +15 -43
  29. package/dist/chat/index.d.ts +3 -1
  30. package/dist/chat/index.js +3 -2
  31. package/dist/chat/logic/ansi.js +170 -167
  32. package/dist/chat/logic/answers.js +2 -2
  33. package/dist/chat/logic/bookmarks.js +19 -19
  34. package/dist/chat/logic/command-looks.js +138 -96
  35. package/dist/chat/logic/context-usage.js +13 -9
  36. package/dist/chat/logic/continue-after-stop.js +15 -19
  37. package/dist/chat/logic/effort.d.ts +14 -0
  38. package/dist/chat/logic/effort.js +34 -0
  39. package/dist/chat/logic/embedded-code.js +387 -326
  40. package/dist/chat/logic/fork.js +134 -110
  41. package/dist/chat/logic/generated-image.js +54 -23
  42. package/dist/chat/logic/goal.js +28 -20
  43. package/dist/chat/logic/handback.js +6 -6
  44. package/dist/chat/logic/json.js +2 -2
  45. package/dist/chat/logic/limit.js +46 -30
  46. package/dist/chat/logic/picker-entries.d.ts +5 -3
  47. package/dist/chat/logic/picker-entries.js +83 -43
  48. package/dist/chat/logic/resume-compaction.d.ts +14 -1
  49. package/dist/chat/logic/resume-compaction.js +93 -24
  50. package/dist/chat/logic/scrubber.js +188 -136
  51. package/dist/chat/logic/thought.js +13 -16
  52. package/dist/chat/logic/thread-cards.js +60 -48
  53. package/dist/chat/logic/timeline-copy.js +30 -38
  54. package/dist/chat/logic/timeline-target.js +92 -63
  55. package/dist/chat/logic/timeline.js +499 -355
  56. package/dist/chat/logic/tool-catalog.js +54 -34
  57. package/dist/chat/logic/tools.js +106 -82
  58. package/dist/chat/logic/visual-height.js +18 -18
  59. package/dist/chat/logic/visual-viewport.js +6 -3
  60. package/dist/chat/logic/welcome.js +9 -9
  61. package/dist/chat/logic/workflow.js +45 -34
  62. package/dist/chat/mentions.js +149 -109
  63. package/dist/chat/persisted-json.js +51 -54
  64. package/dist/chat/preferences.d.ts +4 -0
  65. package/dist/chat/preferences.js +162 -84
  66. package/dist/chat/prompt-hold.js +9 -9
  67. package/dist/chat/quote.js +21 -30
  68. package/dist/chat/reading-width.js +12 -10
  69. package/dist/chat/recent-messages.js +34 -21
  70. package/dist/chat/resume-compaction-dismissals.js +25 -5
  71. package/dist/chat/runtime-modes.js +3 -3
  72. package/dist/chat/send-key.js +11 -7
  73. package/dist/chat/stash.js +89 -69
  74. package/dist/chat/subagent-conversation.js +181 -139
  75. package/dist/chat/subagent-list.js +65 -67
  76. package/dist/chat/subagent-support.js +12 -7
  77. package/dist/chat/subagent-view.js +132 -44
  78. package/dist/chat/thumbnails.js +88 -60
  79. package/dist/chat/timeline-flash.js +24 -12
  80. package/dist/chat/timeline-scroll.js +116 -86
  81. package/dist/chat/ui/AccountPill.js +126 -15
  82. package/dist/chat/ui/AnsiOutput.js +62 -6
  83. package/dist/chat/ui/BookmarkMarker.js +231 -41
  84. package/dist/chat/ui/BookmarkSubmenu.js +165 -18
  85. package/dist/chat/ui/ChatActivity.js +649 -70
  86. package/dist/chat/ui/ChatReferenceChip.js +104 -9
  87. package/dist/chat/ui/CodeBlock.js +132 -58
  88. package/dist/chat/ui/Composer.js +866 -132
  89. package/dist/chat/ui/ComposerInput.js +309 -120
  90. package/dist/chat/ui/DiffPool.js +75 -14
  91. package/dist/chat/ui/EditDiff.js +160 -21
  92. package/dist/chat/ui/FadingWords.js +32 -3
  93. package/dist/chat/ui/GoalDock.js +235 -42
  94. package/dist/chat/ui/ImageView.js +617 -61
  95. package/dist/chat/ui/LimitState.js +446 -72
  96. package/dist/chat/ui/Markdown.js +991 -173
  97. package/dist/chat/ui/MermaidBlock.js +238 -68
  98. package/dist/chat/ui/MessageActions.js +251 -39
  99. package/dist/chat/ui/ModelMarks.js +55 -5
  100. package/dist/chat/ui/Pickers.js +664 -113
  101. package/dist/chat/ui/PromptComposer.js +281 -51
  102. package/dist/chat/ui/QuoteButton.js +151 -57
  103. package/dist/chat/ui/ResumeCompactionDock.d.ts +6 -2
  104. package/dist/chat/ui/ResumeCompactionDock.js +141 -6
  105. package/dist/chat/ui/RowTime.js +59 -5
  106. package/dist/chat/ui/RunSettings.js +1744 -154
  107. package/dist/chat/ui/Scrubber.js +517 -88
  108. package/dist/chat/ui/ShellCommand.js +183 -107
  109. package/dist/chat/ui/SubagentControls.js +212 -24
  110. package/dist/chat/ui/SubagentInfo.js +170 -13
  111. package/dist/chat/ui/SubagentStopButton.js +115 -24
  112. package/dist/chat/ui/SubagentTimeline.js +357 -91
  113. package/dist/chat/ui/Timeline.js +988 -476
  114. package/dist/chat/ui/TimelineMenu.js +552 -37
  115. package/dist/chat/ui/UnifiedDiff.js +234 -27
  116. package/dist/chat/ui/UploadThumb.js +37 -7
  117. package/dist/chat/ui/VisualDialogs.js +251 -20
  118. package/dist/chat/ui/VisualFrame.js +321 -95
  119. package/dist/chat/ui/Welcome.js +72 -7
  120. package/dist/chat/ui/chips.js +1 -1
  121. package/dist/chat/ui/code-lines.js +36 -36
  122. package/dist/chat/ui/code-streaming.js +1 -1
  123. package/dist/chat/ui/code-theme.js +7 -7
  124. package/dist/chat/ui/composer/ComposerControls.js +329 -21
  125. package/dist/chat/ui/composer/ComposerMenu.js +358 -30
  126. package/dist/chat/ui/composer/DraftParts.js +185 -11
  127. package/dist/chat/ui/composer/QueuedMessages.js +138 -13
  128. package/dist/chat/ui/composer/chips.js +29 -19
  129. package/dist/chat/ui/composer/editor.js +79 -63
  130. package/dist/chat/ui/composer/insert.js +26 -12
  131. package/dist/chat/ui/composer/key-handler.js +180 -127
  132. package/dist/chat/ui/composer/keys.js +90 -73
  133. package/dist/chat/ui/composer/menu-aria.js +18 -9
  134. package/dist/chat/ui/composer/placeholder.js +78 -31
  135. package/dist/chat/ui/composer/surface.js +13 -37
  136. package/dist/chat/ui/composer/use-chat-controls.js +230 -90
  137. package/dist/chat/ui/composer/use-compaction-offer.js +50 -18
  138. package/dist/chat/ui/composer/use-composer-draft.js +65 -34
  139. package/dist/chat/ui/composer/use-composer-menus.js +478 -193
  140. package/dist/chat/ui/composer/use-composer-submit.js +251 -109
  141. package/dist/chat/ui/composer/use-continuable-turn.js +33 -6
  142. package/dist/chat/ui/composer/use-draft-files.js +245 -93
  143. package/dist/chat/ui/composer/use-effort-stepper.d.ts +13 -0
  144. package/dist/chat/ui/composer/use-effort-stepper.js +88 -0
  145. package/dist/chat/ui/composer/use-notice.js +61 -16
  146. package/dist/chat/ui/composer/use-pending-requests.js +38 -17
  147. package/dist/chat/ui/composer/use-prompt-history.js +117 -45
  148. package/dist/chat/ui/composer/use-prompt-hold.js +119 -35
  149. package/dist/chat/ui/composer/use-take-back.js +94 -72
  150. package/dist/chat/ui/diff/ApprovalReview.js +101 -23
  151. package/dist/chat/ui/diff/DiffFallbackBoundary.js +21 -13
  152. package/dist/chat/ui/diff/DiffOmitted.js +56 -6
  153. package/dist/chat/ui/diff/DiffStack.js +92 -8
  154. package/dist/chat/ui/diff/DiffUnavailable.js +56 -6
  155. package/dist/chat/ui/diff/EditorEditDiff.js +263 -51
  156. package/dist/chat/ui/diff/EditorPatchDiff.js +39 -14
  157. package/dist/chat/ui/diff/LegacyDiffPool.js +27 -10
  158. package/dist/chat/ui/diff/LegacyEditDiff.js +97 -20
  159. package/dist/chat/ui/diff/LegacyUnifiedDiff.js +172 -42
  160. package/dist/chat/ui/diff/RawDiff.js +65 -5
  161. package/dist/chat/ui/diff/ReviewDiff.js +77 -5
  162. package/dist/chat/ui/diff/diff-props.js +1 -1
  163. package/dist/chat/ui/diff/diff-source-budget.js +46 -35
  164. package/dist/chat/ui/diff/editor-edit-model.js +18 -14
  165. package/dist/chat/ui/diff/review-plan.js +63 -40
  166. package/dist/chat/ui/diff/review-settle.js +24 -9
  167. package/dist/chat/ui/diff/syntax-runtime.js +236 -201
  168. package/dist/chat/ui/diff/use-review-stack.js +146 -25
  169. package/dist/chat/ui/diff-syntax.js +70 -58
  170. package/dist/chat/ui/diff-theme.js +31 -12
  171. package/dist/chat/ui/file-links.js +39 -10
  172. package/dist/chat/ui/find-reveal.js +29 -8
  173. package/dist/chat/ui/full-diff.js +17 -12
  174. package/dist/chat/ui/highlighter.js +143 -113
  175. package/dist/chat/ui/icons.js +16 -7
  176. package/dist/chat/ui/index.js +1 -1
  177. package/dist/chat/ui/intelligent-ui/UiBlockFrame.js +556 -82
  178. package/dist/chat/ui/intelligent-ui/UiFallbackPart.js +73 -5
  179. package/dist/chat/ui/intelligent-ui/UiReply.js +666 -262
  180. package/dist/chat/ui/intelligent-ui/block-local.js +59 -31
  181. package/dist/chat/ui/intelligent-ui/chart-data.js +77 -67
  182. package/dist/chat/ui/intelligent-ui/node-text.js +77 -91
  183. package/dist/chat/ui/intelligent-ui/registry.js +46 -46
  184. package/dist/chat/ui/intelligent-ui/render-context.js +1 -1
  185. package/dist/chat/ui/intelligent-ui/renderers/base-land.js +1 -1
  186. package/dist/chat/ui/intelligent-ui/renderers/binding.js +3 -3
  187. package/dist/chat/ui/intelligent-ui/renderers/chart.js +1223 -123
  188. package/dist/chat/ui/intelligent-ui/renderers/choices.js +312 -34
  189. package/dist/chat/ui/intelligent-ui/renderers/content.js +1241 -86
  190. package/dist/chat/ui/intelligent-ui/renderers/data.js +619 -54
  191. package/dist/chat/ui/intelligent-ui/renderers/inputs.js +868 -67
  192. package/dist/chat/ui/intelligent-ui/renderers/links.js +366 -62
  193. package/dist/chat/ui/intelligent-ui/renderers/map-slots.js +118 -60
  194. package/dist/chat/ui/intelligent-ui/renderers/map-style.js +85 -78
  195. package/dist/chat/ui/intelligent-ui/renderers/map-view.js +282 -217
  196. package/dist/chat/ui/intelligent-ui/renderers/map.js +621 -69
  197. package/dist/chat/ui/intelligent-ui/renderers/place-point.js +15 -8
  198. package/dist/chat/ui/intelligent-ui/renderers/structure.js +262 -20
  199. package/dist/chat/ui/intelligent-ui/renderers/text.js +674 -49
  200. package/dist/chat/ui/intelligent-ui/reply-parts.js +24 -15
  201. package/dist/chat/ui/intelligent-ui/table-data.js +97 -57
  202. package/dist/chat/ui/intelligent-ui/tones.js +31 -31
  203. package/dist/chat/ui/intelligent-ui/use-in-view.js +30 -12
  204. package/dist/chat/ui/intelligent-ui/use-later.js +28 -13
  205. package/dist/chat/ui/intelligent-ui/use-truncated.js +45 -21
  206. package/dist/chat/ui/intelligent-ui/use-ui-links.js +296 -109
  207. package/dist/chat/ui/intelligent-ui/use-ui-queries.js +256 -246
  208. package/dist/chat/ui/markdown-blocks.js +296 -262
  209. package/dist/chat/ui/mermaid.js +60 -72
  210. package/dist/chat/ui/quote-selection.js +32 -29
  211. package/dist/chat/ui/rehype-chips.js +35 -23
  212. package/dist/chat/ui/rehype-fade.js +28 -17
  213. package/dist/chat/ui/remark-html-as-text.js +22 -15
  214. package/dist/chat/ui/reply-context.js +1 -1
  215. package/dist/chat/ui/reveal.js +161 -72
  216. package/dist/chat/ui/rows/ForksRow.js +226 -24
  217. package/dist/chat/ui/rows/GeneratedImageRow.js +541 -87
  218. package/dist/chat/ui/rows/MessageRows.js +1706 -159
  219. package/dist/chat/ui/rows/RowContainer.js +57 -7
  220. package/dist/chat/ui/rows/Rows.js +463 -54
  221. package/dist/chat/ui/rows/SubagentRow.js +577 -60
  222. package/dist/chat/ui/rows/TaskRow.js +359 -40
  223. package/dist/chat/ui/rows/VisualRow.js +233 -11
  224. package/dist/chat/ui/rows/WorkRows.js +1946 -163
  225. package/dist/chat/ui/rows/WorkflowRow.js +293 -34
  226. package/dist/chat/ui/rows/row-rhythm.js +27 -17
  227. package/dist/chat/ui/theme-watch.js +26 -23
  228. package/dist/chat/ui/timestamp-format.js +4 -1
  229. package/dist/chat/ui/use-diff-source-tokens.js +70 -34
  230. package/dist/chat/ui/useToggleSet.js +51 -19
  231. package/dist/chat/ui/visual-theme.js +153 -128
  232. package/dist/chat/visual-bridge.js +123 -123
  233. package/dist/chat/visual-viewport.js +94 -83
  234. package/dist/chat/visuals.js +13 -5
  235. package/dist/host-hooks.d.ts +29 -0
  236. package/dist/host-hooks.js +78 -0
  237. package/dist/host.js +120 -48
  238. package/dist/index.js +1 -1
  239. package/dist/lazy.js +38 -32
  240. package/dist/locales/en/agent-chat.d.ts +35 -0
  241. package/dist/locales/en/agent-chat.js +747 -712
  242. package/dist/locales/en/agent-prompts.js +42 -42
  243. package/dist/locales/en/agent-providers.d.ts +1 -0
  244. package/dist/locales/en/agent-providers.js +166 -165
  245. package/dist/locales/en/agent-usage.d.ts +6 -0
  246. package/dist/locales/en/agent-usage.js +129 -123
  247. package/dist/locales/nl/agent-chat.d.ts +35 -0
  248. package/dist/locales/nl/agent-chat.js +747 -712
  249. package/dist/locales/nl/agent-prompts.js +42 -42
  250. package/dist/locales/nl/agent-providers.d.ts +1 -0
  251. package/dist/locales/nl/agent-providers.js +166 -165
  252. package/dist/locales/nl/agent-usage.d.ts +6 -0
  253. package/dist/locales/nl/agent-usage.js +129 -123
  254. package/dist/locales.js +14 -14
  255. package/dist/mounted-registry.js +31 -30
  256. package/dist/port-transport.js +122 -111
  257. package/dist/prompts/index.js +1 -1
  258. package/dist/prompts/logic/focus.js +15 -14
  259. package/dist/prompts/logic/keys.js +93 -59
  260. package/dist/prompts/logic/prompts.js +27 -14
  261. package/dist/prompts/logic/subjects.js +60 -46
  262. package/dist/prompts/logic/useFocusAfterAnswer.js +60 -20
  263. package/dist/prompts/logic/usePromptSession.js +88 -77
  264. package/dist/prompts/ui/ApprovalBody.js +246 -25
  265. package/dist/prompts/ui/PromptActions.js +215 -9
  266. package/dist/prompts/ui/PromptCard.js +215 -36
  267. package/dist/prompts/ui/PromptView.js +372 -34
  268. package/dist/prompts/ui/QuestionBody.js +269 -73
  269. package/dist/providers/AccountColors.js +36 -5
  270. package/dist/providers/AccountDetail.js +683 -50
  271. package/dist/providers/AccountVariables.js +139 -32
  272. package/dist/providers/AddAccountForm.js +125 -38
  273. package/dist/providers/CliDetail.js +343 -36
  274. package/dist/providers/InstallPage.js +644 -59
  275. package/dist/providers/ProviderList.d.ts +2 -1
  276. package/dist/providers/ProviderList.js +215 -23
  277. package/dist/providers/ProvidersPane.d.ts +4 -2
  278. package/dist/providers/ProvidersPane.js +244 -64
  279. package/dist/providers/account-actions.js +54 -30
  280. package/dist/providers/index.js +1 -1
  281. package/dist/providers/install-steps.js +12 -9
  282. package/dist/providers/pane-target.d.ts +3 -0
  283. package/dist/providers/pane-target.js +34 -13
  284. package/dist/providers/parts.js +62 -12
  285. package/dist/providers/provider-abilities.js +5 -5
  286. package/dist/providers/provider-groups.js +75 -40
  287. package/dist/providers/variables.js +73 -39
  288. package/dist/scope.js +6 -6
  289. package/dist/settings/sections.js +18 -18
  290. package/dist/state/chats.d.ts +1 -0
  291. package/dist/state/chats.js +408 -192
  292. package/dist/state/index.js +1 -1
  293. package/dist/state/provider-accounts.js +70 -47
  294. package/dist/state/providers.js +45 -16
  295. package/dist/state/usage.js +154 -77
  296. package/dist/storage.js +69 -68
  297. package/dist/testing/index.js +1 -1
  298. package/dist/testing/prompts.js +105 -67
  299. package/dist/transport.js +10 -10
  300. package/dist/ui/PlainTextarea.js +27 -3
  301. package/dist/usage/LimitsList.js +646 -40
  302. package/dist/usage/UsageBreakdown.js +879 -38
  303. package/dist/usage/UsageChart.js +311 -32
  304. package/dist/usage/UsageDialog.js +46 -4
  305. package/dist/usage/UsageLimits.js +467 -34
  306. package/dist/usage/UsageLimitsCard.js +95 -11
  307. package/dist/usage/UsagePage.js +817 -96
  308. package/dist/usage/UsagePane.js +164 -10
  309. package/dist/usage/UsageSummary.js +151 -6
  310. package/dist/usage/UsageTiles.js +164 -14
  311. package/dist/usage/format.js +32 -32
  312. package/dist/usage/index.d.ts +1 -1
  313. package/dist/usage/index.js +2 -1
  314. package/dist/usage/limit-groups.d.ts +2 -0
  315. package/dist/usage/limit-groups.js +77 -59
  316. package/dist/usage/limits.js +78 -43
  317. package/dist/usage/money.js +20 -4
  318. package/dist/usage/summary.js +85 -64
  319. package/package.json +8 -8
  320. package/src/agents/ModelOptionControl.tsx +3 -1
  321. package/src/agents/option-words.ts +27 -0
  322. package/src/chat/account-choice.ts +41 -1
  323. package/src/chat/composer-effort.ts +32 -0
  324. package/src/chat/forks.ts +4 -5
  325. package/src/chat/index.ts +3 -1
  326. package/src/chat/logic/effort.ts +32 -0
  327. package/src/chat/logic/picker-entries.ts +45 -10
  328. package/src/chat/logic/resume-compaction.ts +95 -17
  329. package/src/chat/logic/timeline.ts +11 -3
  330. package/src/chat/preferences.ts +35 -0
  331. package/src/chat/subagent-view.ts +2 -3
  332. package/src/chat/ui/AnsiOutput.tsx +1 -2
  333. package/src/chat/ui/BookmarkSubmenu.tsx +3 -3
  334. package/src/chat/ui/ChatActivity.tsx +14 -22
  335. package/src/chat/ui/ChatReferenceChip.tsx +2 -3
  336. package/src/chat/ui/Composer.tsx +15 -7
  337. package/src/chat/ui/EditDiff.tsx +2 -3
  338. package/src/chat/ui/LimitState.tsx +2 -2
  339. package/src/chat/ui/Markdown.tsx +10 -8
  340. package/src/chat/ui/MermaidBlock.tsx +2 -3
  341. package/src/chat/ui/Pickers.tsx +49 -29
  342. package/src/chat/ui/PromptComposer.tsx +7 -9
  343. package/src/chat/ui/ResumeCompactionDock.tsx +16 -4
  344. package/src/chat/ui/RunSettings.tsx +67 -28
  345. package/src/chat/ui/Scrubber.tsx +3 -3
  346. package/src/chat/ui/ShellCommand.tsx +2 -0
  347. package/src/chat/ui/SubagentInfo.tsx +2 -3
  348. package/src/chat/ui/SubagentTimeline.tsx +12 -16
  349. package/src/chat/ui/Timeline.tsx +6 -6
  350. package/src/chat/ui/UnifiedDiff.tsx +3 -4
  351. package/src/chat/ui/VisualFrame.tsx +5 -8
  352. package/src/chat/ui/code-theme.ts +4 -4
  353. package/src/chat/ui/composer/placeholder.ts +2 -2
  354. package/src/chat/ui/composer/use-compaction-offer.ts +36 -16
  355. package/src/chat/ui/composer/use-composer-menus.ts +4 -9
  356. package/src/chat/ui/composer/use-composer-submit.ts +2 -1
  357. package/src/chat/ui/composer/use-effort-stepper.ts +56 -0
  358. package/src/chat/ui/composer/use-notice.ts +2 -2
  359. package/src/chat/ui/diff/EditorEditDiff.tsx +9 -13
  360. package/src/chat/ui/diff/LegacyEditDiff.tsx +12 -17
  361. package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +13 -21
  362. package/src/chat/ui/diff/use-review-stack.ts +4 -4
  363. package/src/chat/ui/diff-theme.ts +3 -3
  364. package/src/chat/ui/file-links.ts +2 -2
  365. package/src/chat/ui/intelligent-ui/UiReply.tsx +2 -0
  366. package/src/chat/ui/intelligent-ui/renderers/chart.tsx +3 -3
  367. package/src/chat/ui/intelligent-ui/renderers/content.tsx +5 -6
  368. package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +2 -1
  369. package/src/chat/ui/intelligent-ui/renderers/map.tsx +2 -1
  370. package/src/chat/ui/intelligent-ui/use-truncated.ts +16 -19
  371. package/src/chat/ui/intelligent-ui/use-ui-links.ts +3 -3
  372. package/src/chat/ui/rows/ForksRow.tsx +3 -5
  373. package/src/chat/ui/rows/GeneratedImageRow.tsx +2 -1
  374. package/src/chat/ui/rows/MessageRows.tsx +12 -21
  375. package/src/chat/ui/rows/SubagentRow.tsx +3 -3
  376. package/src/chat/ui/rows/TaskRow.tsx +1 -1
  377. package/src/chat/ui/rows/WorkRows.tsx +20 -7
  378. package/src/chat/ui/useToggleSet.ts +15 -18
  379. package/src/chat/ui/visual-theme.ts +2 -3
  380. package/src/host-hooks.ts +113 -0
  381. package/src/lazy.tsx +2 -0
  382. package/src/locales/en/agent-chat.ts +135 -108
  383. package/src/locales/en/agent-prompts.ts +7 -7
  384. package/src/locales/en/agent-providers.ts +35 -34
  385. package/src/locales/en/agent-usage.ts +26 -20
  386. package/src/locales/nl/agent-chat.ts +127 -100
  387. package/src/locales/nl/agent-prompts.ts +5 -5
  388. package/src/locales/nl/agent-providers.ts +33 -32
  389. package/src/locales/nl/agent-usage.ts +25 -20
  390. package/src/prompts/ui/ApprovalBody.tsx +3 -1
  391. package/src/providers/CliDetail.tsx +2 -1
  392. package/src/providers/InstallPage.tsx +2 -4
  393. package/src/providers/ProviderList.tsx +12 -2
  394. package/src/providers/ProvidersPane.tsx +45 -15
  395. package/src/providers/pane-target.ts +20 -4
  396. package/src/state/chats.ts +7 -2
  397. package/src/usage/LimitsList.tsx +12 -13
  398. package/src/usage/UsageBreakdown.tsx +17 -6
  399. package/src/usage/UsageLimits.tsx +2 -1
  400. package/src/usage/UsagePage.tsx +3 -3
  401. package/src/usage/index.ts +1 -1
  402. package/src/usage/limit-groups.ts +12 -0
  403. package/src/usage/limits.ts +2 -2
  404. package/src/usage/money.ts +1 -2
@@ -1,8 +1,8 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { createContext, memo, useContext, useMemo } from 'react';
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { createContext, memo, useContext } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { Zap } from 'lucide-react';
5
- import ReactMarkdown, {} from 'react-markdown';
5
+ import ReactMarkdown from 'react-markdown';
6
6
  import remarkBreaks from 'remark-breaks';
7
7
  import remarkGfm from 'remark-gfm';
8
8
  import { CHIP_IN_MESSAGE, MENTION_TONE, SKILL_TONE } from './chips.js';
@@ -17,222 +17,788 @@ import { useChatHost } from '../../host.js';
17
17
  import { useFileLinkCwd, useFileLinkScopeId, useFileLinkTarget, useOpenFileLink } from './file-links.js';
18
18
  import { ErrorBoundary, FileIcon, Icon } from '@adecore/ui';
19
19
  import { useTranslation } from 'react-i18next';
20
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
21
  const ShellCodeBlockReplyContext = createContext(null);
21
22
  const BlockCodeContext = createContext(false);
22
23
  /* The command a shell fence holds, read from the fence as written, so it keeps the indentation and line endings it has. */
23
24
  function shellFence(source) {
24
- const opening = /^ {0,3}(`{3,}|~{3,})[ \t]*(sh|bash|zsh)[ \t]*\r?\n/.exec(source);
25
- if (opening === null) {
26
- return null;
27
- }
28
- const body = source.slice(opening[0].length);
29
- const closing = /(?:^|\r?\n) {0,3}(`{3,}|~{3,})[ \t]*$/.exec(body);
30
- const closed = closing !== null && closing[1][0] === opening[1][0] && closing[1].length >= opening[1].length;
31
- return { language: opening[2], code: closed ? body.slice(0, closing.index) : body, closed };
25
+ const opening = /^ {0,3}(`{3,}|~{3,})[ \t]*(sh|bash|zsh)[ \t]*\r?\n/.exec(source);
26
+ if (opening === null) {
27
+ return null;
28
+ }
29
+ const body = source.slice(opening[0].length);
30
+ const closing = /(?:^|\r?\n) {0,3}(`{3,}|~{3,})[ \t]*$/.exec(body);
31
+ const closed = closing !== null && closing[1][0] === opening[1][0] && closing[1].length >= opening[1].length;
32
+ return {
33
+ language: opening[2],
34
+ code: closed ? body.slice(0, closing.index) : body,
35
+ closed
36
+ };
32
37
  }
33
38
  /* Only root children qualify; Markdown's parser decides whether a fence belongs to a list or quote. */
34
39
  function remarkShellCodeBlocks() {
35
- return (tree, file) => {
36
- for (const node of tree.children ?? []) {
37
- if (node.type !== 'code') {
38
- continue;
39
- }
40
- const start = node.position?.start.offset;
41
- const end = node.position?.end.offset;
42
- if (start === undefined || end === undefined) {
43
- continue;
44
- }
45
- const shell = shellFence(String(file.value).slice(start, end));
46
- if (shell === null) {
47
- continue;
48
- }
49
- node.data = {
50
- ...node.data,
51
- hProperties: {
52
- ...node.data?.hProperties,
53
- 'data-shell-language': shell.language,
54
- 'data-shell-code': shell.code,
55
- 'data-shell-closed': shell.closed
56
- }
57
- };
40
+ return (tree, file) => {
41
+ for (const node of tree.children ?? []) {
42
+ if (node.type !== 'code') {
43
+ continue;
44
+ }
45
+ const start = node.position?.start.offset;
46
+ const end = node.position?.end.offset;
47
+ if (start === undefined || end === undefined) {
48
+ continue;
49
+ }
50
+ const shell = shellFence(String(file.value).slice(start, end));
51
+ if (shell === null) {
52
+ continue;
53
+ }
54
+ node.data = {
55
+ ...node.data,
56
+ hProperties: {
57
+ ...node.data?.hProperties,
58
+ 'data-shell-language': shell.language,
59
+ 'data-shell-code': shell.code,
60
+ 'data-shell-closed': shell.closed
58
61
  }
59
- };
62
+ };
63
+ }
64
+ };
60
65
  }
61
66
  /* What the host adds to a shell fence of a main reply, which is complete once the fence closed and the reply stopped. */
62
67
  function shellCodeBlockActions(reply, shell, render) {
63
- if (reply === null || shell === null) {
64
- return undefined;
65
- }
66
- const { scopeId, chatId, itemId } = reply;
67
- return render?.({ scopeId, chatId, itemId, language: shell.language, code: shell.code, complete: !reply.streaming && shell.closed });
68
+ if (reply === null || shell === null) {
69
+ return undefined;
70
+ }
71
+ const {
72
+ scopeId,
73
+ chatId,
74
+ itemId
75
+ } = reply;
76
+ return render?.({
77
+ scopeId,
78
+ chatId,
79
+ itemId,
80
+ language: shell.language,
81
+ code: shell.code,
82
+ complete: !reply.streaming && shell.closed
83
+ });
68
84
  }
69
85
  function languageOf(className) {
70
- return /language-([\w-]+)/.exec(className ?? '')?.[1] ?? 'text';
86
+ return /language-([\w-]+)/.exec(className ?? '')?.[1] ?? 'text';
71
87
  }
72
- const INLINE_CODE = 'rounded-sm bg-surface-sunken px-1 py-px font-mono text-code';
88
+ const INLINE_CODE = 'rounded-sm bg-surface-sunken px-1 py-px font-mono text-code box-decoration-clone';
73
89
  /*
74
90
  * A path an agent wrote down. It keeps the shape of the code chip it would otherwise be, so a sentence
75
91
  * full of them does not shift; `data-file-path` is what the thread's right-click menu reads.
76
92
  */
77
- function FileLink({ target, className, children }) {
78
- const cwd = useFileLinkCwd();
79
- const scopeId = useFileLinkScopeId();
80
- const openFileLink = useOpenFileLink();
81
- return (_jsx("button", { type: "button", className: clsx('cursor-pointer select-text', className), "data-file-path": target.path, "data-file-line": target.line, "data-file-column": target.column, "data-file-end-line": target.endLine, "data-file-directory": target.directory, "data-file-cwd": cwd ?? '', "data-file-scope-id": scopeId ?? '', onClick: () => openFileLink(cwd, target, scopeId), children: children }));
93
+ function FileLink(t0) {
94
+ const $ = _c(18);
95
+ const {
96
+ target,
97
+ className,
98
+ children
99
+ } = t0;
100
+ const cwd = useFileLinkCwd();
101
+ const scopeId = useFileLinkScopeId();
102
+ const openFileLink = useOpenFileLink();
103
+ let t1;
104
+ if ($[0] !== className) {
105
+ t1 = clsx("cursor-pointer select-text text-left", className);
106
+ $[0] = className;
107
+ $[1] = t1;
108
+ } else {
109
+ t1 = $[1];
110
+ }
111
+ const t2 = cwd ?? "";
112
+ const t3 = scopeId ?? "";
113
+ let t4;
114
+ if ($[2] !== cwd || $[3] !== openFileLink || $[4] !== scopeId || $[5] !== target) {
115
+ t4 = () => openFileLink(cwd, target, scopeId);
116
+ $[2] = cwd;
117
+ $[3] = openFileLink;
118
+ $[4] = scopeId;
119
+ $[5] = target;
120
+ $[6] = t4;
121
+ } else {
122
+ t4 = $[6];
123
+ }
124
+ let t5;
125
+ if ($[7] !== children || $[8] !== t1 || $[9] !== t2 || $[10] !== t3 || $[11] !== t4 || $[12] !== target.column || $[13] !== target.directory || $[14] !== target.endLine || $[15] !== target.line || $[16] !== target.path) {
126
+ t5 = /*#__PURE__*/_jsx("button", {
127
+ type: "button",
128
+ className: t1,
129
+ "data-file-path": target.path,
130
+ "data-file-line": target.line,
131
+ "data-file-column": target.column,
132
+ "data-file-end-line": target.endLine,
133
+ "data-file-directory": target.directory,
134
+ "data-file-cwd": t2,
135
+ "data-file-scope-id": t3,
136
+ onClick: t4,
137
+ children: children
138
+ });
139
+ $[7] = children;
140
+ $[8] = t1;
141
+ $[9] = t2;
142
+ $[10] = t3;
143
+ $[11] = t4;
144
+ $[12] = target.column;
145
+ $[13] = target.directory;
146
+ $[14] = target.endLine;
147
+ $[15] = target.line;
148
+ $[16] = target.path;
149
+ $[17] = t5;
150
+ } else {
151
+ t5 = $[17];
152
+ }
153
+ return t5;
82
154
  }
83
155
  /* Inline code, which is a file reference often enough that it is worth asking every time. */
84
- function InlineCode({ text }) {
85
- const target = useFileLinkTarget(text);
86
- if (target === null) {
87
- return _jsx("code", { className: INLINE_CODE, children: text });
156
+ function InlineCode(t0) {
157
+ const $ = _c(8);
158
+ const {
159
+ text
160
+ } = t0;
161
+ const target = useFileLinkTarget(text);
162
+ if (target === null) {
163
+ let t1;
164
+ if ($[0] !== text) {
165
+ t1 = /*#__PURE__*/_jsx("code", {
166
+ className: INLINE_CODE,
167
+ children: text
168
+ });
169
+ $[0] = text;
170
+ $[1] = t1;
171
+ } else {
172
+ t1 = $[1];
88
173
  }
89
- return (_jsx(FileLink, { target: target, className: `${INLINE_CODE} text-accent hover:underline`, children: text }));
174
+ return t1;
175
+ }
176
+ let t1;
177
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
178
+ t1 = clsx(INLINE_CODE, "hover:underline");
179
+ $[2] = t1;
180
+ } else {
181
+ t1 = $[2];
182
+ }
183
+ let t2;
184
+ if ($[3] !== text) {
185
+ t2 = /*#__PURE__*/_jsx("code", {
186
+ className: t1,
187
+ children: text
188
+ });
189
+ $[3] = text;
190
+ $[4] = t2;
191
+ } else {
192
+ t2 = $[4];
193
+ }
194
+ let t3;
195
+ if ($[5] !== t2 || $[6] !== target) {
196
+ t3 = /*#__PURE__*/_jsx(FileLink, {
197
+ target: target,
198
+ className: "text-accent",
199
+ children: t2
200
+ });
201
+ $[5] = t2;
202
+ $[6] = target;
203
+ $[7] = t3;
204
+ } else {
205
+ t3 = $[7];
206
+ }
207
+ return t3;
90
208
  }
91
209
  /*
92
210
  * The path a link target spells, without the one scheme that still means a file on the host's machine.
93
211
  * A href nobody encoded is left as it is, since decoding throws on a stray percent.
94
212
  */
95
213
  function hrefPath(href) {
96
- const bare = href.replace(/^file:\/\//, '');
97
- try {
98
- return decodeURI(bare);
99
- }
100
- catch {
101
- return bare;
102
- }
214
+ const bare = href.replace(/^file:\/\//, '');
215
+ try {
216
+ return decodeURI(bare);
217
+ } catch {
218
+ return bare;
219
+ }
103
220
  }
104
221
  /* A markdown link, which is a file when its target names no scheme of its own. */
105
- function MarkdownLink({ href, children }) {
106
- const target = useFileLinkTarget(hrefPath(href ?? ''));
107
- if (target !== null) {
108
- return (_jsx(FileLink, { target: target, className: "text-accent underline underline-offset-2", children: children }));
222
+ function MarkdownLink(t0) {
223
+ const $ = _c(8);
224
+ const {
225
+ href,
226
+ children
227
+ } = t0;
228
+ const t1 = href ?? "";
229
+ let t2;
230
+ if ($[0] !== t1) {
231
+ t2 = hrefPath(t1);
232
+ $[0] = t1;
233
+ $[1] = t2;
234
+ } else {
235
+ t2 = $[1];
236
+ }
237
+ const target = useFileLinkTarget(t2);
238
+ if (target !== null) {
239
+ let t3;
240
+ if ($[2] !== children || $[3] !== target) {
241
+ t3 = /*#__PURE__*/_jsx(FileLink, {
242
+ target: target,
243
+ className: "text-accent underline underline-offset-2",
244
+ children: children
245
+ });
246
+ $[2] = children;
247
+ $[3] = target;
248
+ $[4] = t3;
249
+ } else {
250
+ t3 = $[4];
109
251
  }
110
- return _jsx(ExternalLink, { href: href, children: children });
252
+ return t3;
253
+ }
254
+ let t3;
255
+ if ($[5] !== children || $[6] !== href) {
256
+ t3 = /*#__PURE__*/_jsx(ExternalLink, {
257
+ href: href,
258
+ children: children
259
+ });
260
+ $[5] = children;
261
+ $[6] = href;
262
+ $[7] = t3;
263
+ } else {
264
+ t3 = $[7];
265
+ }
266
+ return t3;
111
267
  }
112
- function ExternalLink({ href, children }) {
113
- return (_jsx("a", { href: href, target: "_blank", rel: "noreferrer", children: children }));
268
+ function ExternalLink(t0) {
269
+ const $ = _c(3);
270
+ const {
271
+ href,
272
+ children
273
+ } = t0;
274
+ let t1;
275
+ if ($[0] !== children || $[1] !== href) {
276
+ t1 = /*#__PURE__*/_jsx("a", {
277
+ href: href,
278
+ target: "_blank",
279
+ rel: "noreferrer",
280
+ children: children
281
+ });
282
+ $[0] = children;
283
+ $[1] = href;
284
+ $[2] = t1;
285
+ } else {
286
+ t1 = $[2];
287
+ }
288
+ return t1;
114
289
  }
115
290
  /*
116
291
  * The path on the host's machine an image target names, or null for a URL and for a relative path
117
292
  * nobody gave a folder for. react-markdown has already emptied a target of a scheme it distrusts.
118
293
  */
119
294
  function localImagePath(src, cwd) {
120
- if (src === '' || /^[a-z][a-z0-9+.-]*:/i.test(src)) {
121
- return null;
122
- }
123
- const target = hrefPath(src);
124
- if (target.startsWith('/')) {
125
- return target;
126
- }
127
- if (cwd === null) {
128
- return null;
129
- }
130
- return `${cwd.replace(/\/+$/, '')}/${target.replace(/^\.\//, '')}`;
295
+ if (src === '' || /^[a-z][a-z0-9+.-]*:/i.test(src)) {
296
+ return null;
297
+ }
298
+ const target = hrefPath(src);
299
+ if (target.startsWith('/')) {
300
+ return target;
301
+ }
302
+ if (cwd === null) {
303
+ return null;
304
+ }
305
+ return `${cwd.replace(/\/+$/, '')}/${target.replace(/^\.\//, '')}`;
131
306
  }
132
307
  /* A markdown image, which only the host can read when it names a file on its machine. */
133
- function MarkdownImage({ src, alt }) {
134
- const { MarkdownImage: HostImage } = useChatHost();
135
- const cwd = useFileLinkCwd();
136
- const path = typeof src === 'string' ? localImagePath(src, cwd) : null;
137
- if (HostImage === undefined || path === null) {
138
- return _jsx("img", { src: src, alt: alt });
308
+ function MarkdownImage(t0) {
309
+ const $ = _c(10);
310
+ const {
311
+ src,
312
+ alt
313
+ } = t0;
314
+ const {
315
+ MarkdownImage: HostImage
316
+ } = useChatHost();
317
+ const cwd = useFileLinkCwd();
318
+ let t1;
319
+ if ($[0] !== cwd || $[1] !== src) {
320
+ t1 = typeof src === "string" ? localImagePath(src, cwd) : null;
321
+ $[0] = cwd;
322
+ $[1] = src;
323
+ $[2] = t1;
324
+ } else {
325
+ t1 = $[2];
326
+ }
327
+ const path = t1;
328
+ if (HostImage === undefined || path === null) {
329
+ let t2;
330
+ if ($[3] !== alt || $[4] !== src) {
331
+ t2 = /*#__PURE__*/_jsx("img", {
332
+ src: src,
333
+ alt: alt
334
+ });
335
+ $[3] = alt;
336
+ $[4] = src;
337
+ $[5] = t2;
338
+ } else {
339
+ t2 = $[5];
139
340
  }
140
- return _jsx(HostImage, { path: path, alt: alt ?? '' });
341
+ return t2;
342
+ }
343
+ const t2 = alt ?? "";
344
+ let t3;
345
+ if ($[6] !== HostImage || $[7] !== path || $[8] !== t2) {
346
+ t3 = /*#__PURE__*/_jsx(HostImage, {
347
+ path: path,
348
+ alt: t2
349
+ });
350
+ $[6] = HostImage;
351
+ $[7] = path;
352
+ $[8] = t2;
353
+ $[9] = t3;
354
+ } else {
355
+ t3 = $[9];
356
+ }
357
+ return t3;
141
358
  }
142
- function PlainImage({ src, alt }) {
143
- return _jsx("img", { src: src, alt: alt });
359
+ function PlainImage(t0) {
360
+ const $ = _c(3);
361
+ const {
362
+ src,
363
+ alt
364
+ } = t0;
365
+ let t1;
366
+ if ($[0] !== alt || $[1] !== src) {
367
+ t1 = /*#__PURE__*/_jsx("img", {
368
+ src: src,
369
+ alt: alt
370
+ });
371
+ $[0] = alt;
372
+ $[1] = src;
373
+ $[2] = t1;
374
+ } else {
375
+ t1 = $[2];
376
+ }
377
+ return t1;
144
378
  }
145
379
  /* A ```mermaid fence, which draws what it says. */
146
- function Diagram({ code }) {
147
- const { t } = useTranslation('agent-chat');
148
- return (_jsx(ErrorBoundary, { label: t('code.mermaid.crashed'), resetKeys: [code], compact: true, className: "rounded-lg border border-border", children: _jsx(MermaidBlock, { code: code }) }));
380
+ function Diagram(t0) {
381
+ const $ = _c(10);
382
+ const {
383
+ code
384
+ } = t0;
385
+ const {
386
+ t
387
+ } = useTranslation("agent-chat");
388
+ let t1;
389
+ if ($[0] !== t) {
390
+ t1 = t("code.mermaid.crashed");
391
+ $[0] = t;
392
+ $[1] = t1;
393
+ } else {
394
+ t1 = $[1];
395
+ }
396
+ let t2;
397
+ if ($[2] !== code) {
398
+ t2 = [code];
399
+ $[2] = code;
400
+ $[3] = t2;
401
+ } else {
402
+ t2 = $[3];
403
+ }
404
+ let t3;
405
+ if ($[4] !== code) {
406
+ t3 = /*#__PURE__*/_jsx(MermaidBlock, {
407
+ code: code
408
+ });
409
+ $[4] = code;
410
+ $[5] = t3;
411
+ } else {
412
+ t3 = $[5];
413
+ }
414
+ let t4;
415
+ if ($[6] !== t1 || $[7] !== t2 || $[8] !== t3) {
416
+ t4 = /*#__PURE__*/_jsx(ErrorBoundary, {
417
+ label: t1,
418
+ resetKeys: t2,
419
+ compact: true,
420
+ className: "rounded-lg border border-border",
421
+ children: t3
422
+ });
423
+ $[6] = t1;
424
+ $[7] = t2;
425
+ $[8] = t3;
426
+ $[9] = t4;
427
+ } else {
428
+ t4 = $[9];
429
+ }
430
+ return t4;
149
431
  }
150
- function MarkdownCode({ className, children, plain = false }) {
151
- const block = useContext(BlockCodeContext);
152
- const text = String(children ?? '');
153
- if (block) {
154
- const lang = languageOf(className);
155
- const code = text.replace(/\n$/, '');
156
- return lang === 'mermaid' ? _jsx(Diagram, { code: code }) : _jsx(CodeBlock, { code: code, lang: lang });
432
+ function MarkdownCode(t0) {
433
+ const $ = _c(11);
434
+ const {
435
+ className,
436
+ children,
437
+ plain: t1
438
+ } = t0;
439
+ const plain = t1 === undefined ? false : t1;
440
+ const block = useContext(BlockCodeContext);
441
+ const text = String(children ?? "");
442
+ if (block) {
443
+ let t2;
444
+ if ($[0] !== className) {
445
+ t2 = languageOf(className);
446
+ $[0] = className;
447
+ $[1] = t2;
448
+ } else {
449
+ t2 = $[1];
450
+ }
451
+ const lang = t2;
452
+ let t3;
453
+ if ($[2] !== text) {
454
+ let t4;
455
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
456
+ t4 = /\n$/;
457
+ $[4] = t4;
458
+ } else {
459
+ t4 = $[4];
460
+ }
461
+ t3 = text.replace(t4, "");
462
+ $[2] = text;
463
+ $[3] = t3;
464
+ } else {
465
+ t3 = $[3];
466
+ }
467
+ const code = t3;
468
+ let t4;
469
+ if ($[5] !== code || $[6] !== lang) {
470
+ t4 = lang === "mermaid" ? /*#__PURE__*/_jsx(Diagram, {
471
+ code: code
472
+ }) : /*#__PURE__*/_jsx(CodeBlock, {
473
+ code: code,
474
+ lang: lang
475
+ });
476
+ $[5] = code;
477
+ $[6] = lang;
478
+ $[7] = t4;
479
+ } else {
480
+ t4 = $[7];
157
481
  }
158
- return plain ? _jsx("code", { className: INLINE_CODE, children: text }) : _jsx(InlineCode, { text: text });
482
+ return t4;
483
+ }
484
+ let t2;
485
+ if ($[8] !== plain || $[9] !== text) {
486
+ t2 = plain ? /*#__PURE__*/_jsx("code", {
487
+ className: INLINE_CODE,
488
+ children: text
489
+ }) : /*#__PURE__*/_jsx(InlineCode, {
490
+ text: text
491
+ });
492
+ $[8] = plain;
493
+ $[9] = text;
494
+ $[10] = t2;
495
+ } else {
496
+ t2 = $[10];
497
+ }
498
+ return t2;
159
499
  }
160
500
  const components = {
161
- pre({ children }) {
162
- return _jsx(BlockCodeContext.Provider, { value: true, children: children });
163
- },
164
- code: MarkdownCode,
165
- a({ href, children }) {
166
- return _jsx(MarkdownLink, { href: href, children: children });
167
- },
168
- img: MarkdownImage,
169
- table({ children }) {
170
- // A table wider than the column scrolls on its own instead of pushing the thread sideways.
171
- return (_jsx("div", { className: "chat-table", children: _jsx("table", { children: children }) }));
172
- }
501
+ pre({
502
+ children
503
+ }) {
504
+ return /*#__PURE__*/_jsx(BlockCodeContext.Provider, {
505
+ value: true,
506
+ children: children
507
+ });
508
+ },
509
+ code: MarkdownCode,
510
+ a({
511
+ href,
512
+ children
513
+ }) {
514
+ return /*#__PURE__*/_jsx(MarkdownLink, {
515
+ href: href,
516
+ children: children
517
+ });
518
+ },
519
+ img: MarkdownImage,
520
+ table({
521
+ children
522
+ }) {
523
+ // A table wider than the column scrolls on its own instead of pushing the thread sideways.
524
+ return /*#__PURE__*/_jsx("div", {
525
+ className: "chat-table",
526
+ children: /*#__PURE__*/_jsx("table", {
527
+ children: children
528
+ })
529
+ });
530
+ }
173
531
  };
174
532
  /* For text from outside this machine, where a path in inline code is not a file anybody meant to open here. */
175
533
  const plainComponents = {
176
- ...components,
177
- code({ className, children }) {
178
- return (_jsx(MarkdownCode, { className: className, plain: true, children: children }));
179
- },
180
- a: ExternalLink,
181
- img: PlainImage
534
+ ...components,
535
+ code({
536
+ className,
537
+ children
538
+ }) {
539
+ return /*#__PURE__*/_jsx(MarkdownCode, {
540
+ className: className,
541
+ plain: true,
542
+ children: children
543
+ });
544
+ },
545
+ a: ExternalLink,
546
+ img: PlainImage
182
547
  };
183
548
  // A reply sits under the heading of its message, an `h3`, so its own headings start one level below
184
549
  // that. Only `aria-level` moves. The tag stays, since the styles and a copy of the thread read it.
185
550
  const REPLY_HEADING_OFFSET = 3;
186
551
  function replyHeading(level) {
187
- const Tag = `h${level}`;
188
- return function ReplyHeading({ children }) {
189
- return _jsx(Tag, { "aria-level": Math.min(6, level + REPLY_HEADING_OFFSET), children: children });
190
- };
552
+ const Tag = `h${level}`;
553
+ return function ReplyHeading({
554
+ children
555
+ }) {
556
+ return /*#__PURE__*/_jsx(Tag, {
557
+ "aria-level": Math.min(6, level + REPLY_HEADING_OFFSET),
558
+ children: children
559
+ });
560
+ };
191
561
  }
192
562
  const replyComponents = {
193
- ...components,
194
- code: ReplyCode,
195
- h1: replyHeading(1),
196
- h2: replyHeading(2),
197
- h3: replyHeading(3),
198
- h4: replyHeading(4),
199
- h5: replyHeading(5),
200
- h6: replyHeading(6)
563
+ ...components,
564
+ code: ReplyCode,
565
+ h1: replyHeading(1),
566
+ h2: replyHeading(2),
567
+ h3: replyHeading(3),
568
+ h4: replyHeading(4),
569
+ h5: replyHeading(5),
570
+ h6: replyHeading(6)
201
571
  };
202
- function ReplyCode({ className, children, node }) {
203
- const reply = useContext(ShellCodeBlockReplyContext);
204
- const block = useContext(BlockCodeContext);
205
- const { renderShellCodeBlock } = useChatHost();
206
- const properties = node?.properties;
207
- const language = properties?.['data-shell-language'];
208
- const code = properties?.['data-shell-code'];
209
- const shell = (language === 'sh' || language === 'bash' || language === 'zsh') && typeof code === 'string'
210
- ? { language, code, closed: properties?.['data-shell-closed'] === true }
211
- : null;
212
- const text = String(children ?? '');
213
- if (block && languageOf(className) === 'mermaid') {
214
- return _jsx(Diagram, { code: text.replace(/\n$/, '') });
215
- }
216
- if (block) {
217
- return _jsx(CodeBlock, { code: text.replace(/\n$/, ''), lang: languageOf(className), actions: shellCodeBlockActions(reply, shell, renderShellCodeBlock) });
572
+ function ReplyCode(t0) {
573
+ const $ = _c(22);
574
+ const {
575
+ className,
576
+ children,
577
+ node
578
+ } = t0;
579
+ const reply = useContext(ShellCodeBlockReplyContext);
580
+ const block = useContext(BlockCodeContext);
581
+ const {
582
+ renderShellCodeBlock
583
+ } = useChatHost();
584
+ const properties = node?.properties;
585
+ const language = properties?.["data-shell-language"];
586
+ const code = properties?.["data-shell-code"];
587
+ let t1;
588
+ let text;
589
+ if ($[0] !== block || $[1] !== children || $[2] !== className || $[3] !== code || $[4] !== language || $[5] !== properties || $[6] !== renderShellCodeBlock || $[7] !== reply) {
590
+ t1 = Symbol.for("react.early_return_sentinel");
591
+ bb0: {
592
+ const shell = (language === "sh" || language === "bash" || language === "zsh") && typeof code === "string" ? {
593
+ language,
594
+ code,
595
+ closed: properties?.["data-shell-closed"] === true
596
+ } : null;
597
+ text = String(children ?? "");
598
+ if (block && languageOf(className) === "mermaid") {
599
+ let t2;
600
+ if ($[10] !== text) {
601
+ let t3;
602
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
603
+ t3 = /\n$/;
604
+ $[12] = t3;
605
+ } else {
606
+ t3 = $[12];
607
+ }
608
+ t2 = text.replace(t3, "");
609
+ $[10] = text;
610
+ $[11] = t2;
611
+ } else {
612
+ t2 = $[11];
613
+ }
614
+ let t3;
615
+ if ($[13] !== t2) {
616
+ t3 = /*#__PURE__*/_jsx(Diagram, {
617
+ code: t2
618
+ });
619
+ $[13] = t2;
620
+ $[14] = t3;
621
+ } else {
622
+ t3 = $[14];
623
+ }
624
+ t1 = t3;
625
+ break bb0;
626
+ }
627
+ if (block) {
628
+ let t2;
629
+ if ($[15] !== text) {
630
+ let t3;
631
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
632
+ t3 = /\n$/;
633
+ $[17] = t3;
634
+ } else {
635
+ t3 = $[17];
636
+ }
637
+ t2 = text.replace(t3, "");
638
+ $[15] = text;
639
+ $[16] = t2;
640
+ } else {
641
+ t2 = $[16];
642
+ }
643
+ let t3;
644
+ if ($[18] !== className) {
645
+ t3 = languageOf(className);
646
+ $[18] = className;
647
+ $[19] = t3;
648
+ } else {
649
+ t3 = $[19];
650
+ }
651
+ t1 = /*#__PURE__*/_jsx(CodeBlock, {
652
+ code: t2,
653
+ lang: t3,
654
+ actions: shellCodeBlockActions(reply, shell, renderShellCodeBlock)
655
+ });
656
+ break bb0;
657
+ }
218
658
  }
219
- return _jsx(InlineCode, { text: text });
659
+ $[0] = block;
660
+ $[1] = children;
661
+ $[2] = className;
662
+ $[3] = code;
663
+ $[4] = language;
664
+ $[5] = properties;
665
+ $[6] = renderShellCodeBlock;
666
+ $[7] = reply;
667
+ $[8] = t1;
668
+ $[9] = text;
669
+ } else {
670
+ t1 = $[8];
671
+ text = $[9];
672
+ }
673
+ if (t1 !== Symbol.for("react.early_return_sentinel")) {
674
+ return t1;
675
+ }
676
+ let t2;
677
+ if ($[20] !== text) {
678
+ t2 = /*#__PURE__*/_jsx(InlineCode, {
679
+ text: text
680
+ });
681
+ $[20] = text;
682
+ $[21] = t2;
683
+ } else {
684
+ t2 = $[21];
685
+ }
686
+ return t2;
220
687
  }
221
688
  /* A picked file or skill in a sent message. The glyph stands in for the sigil the text still carries. */
222
- function Chip({ kind, value }) {
223
- if (kind === 'skill') {
224
- return (_jsxs("span", { className: clsx(CHIP_IN_MESSAGE, SKILL_TONE), children: [_jsx(Icon, { icon: Zap, size: 14, className: "shrink-0 opacity-85" }), _jsx("span", { className: "truncate", children: value })] }));
689
+ function Chip(t0) {
690
+ const $ = _c(16);
691
+ const {
692
+ kind,
693
+ value
694
+ } = t0;
695
+ if (kind === "skill") {
696
+ let t1;
697
+ let t2;
698
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
699
+ t1 = clsx(CHIP_IN_MESSAGE, SKILL_TONE);
700
+ t2 = /*#__PURE__*/_jsx(Icon, {
701
+ icon: Zap,
702
+ size: 14,
703
+ className: "shrink-0 opacity-85"
704
+ });
705
+ $[0] = t1;
706
+ $[1] = t2;
707
+ } else {
708
+ t1 = $[0];
709
+ t2 = $[1];
225
710
  }
226
- return (_jsxs("span", { className: clsx(CHIP_IN_MESSAGE, MENTION_TONE), "data-file-path": value, "data-file-directory": /[\\/]$/.test(value), children: [_jsx(FileIcon, { path: value, size: 14 }), _jsx("span", { className: "truncate", children: value })] }));
711
+ let t3;
712
+ if ($[2] !== value) {
713
+ t3 = /*#__PURE__*/_jsxs("span", {
714
+ className: t1,
715
+ children: [t2, /*#__PURE__*/_jsx("span", {
716
+ className: "truncate",
717
+ children: value
718
+ })]
719
+ });
720
+ $[2] = value;
721
+ $[3] = t3;
722
+ } else {
723
+ t3 = $[3];
724
+ }
725
+ return t3;
726
+ }
727
+ let t1;
728
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
729
+ t1 = clsx(CHIP_IN_MESSAGE, MENTION_TONE);
730
+ $[4] = t1;
731
+ } else {
732
+ t1 = $[4];
733
+ }
734
+ let t2;
735
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
736
+ t2 = /[\\/]$/;
737
+ $[5] = t2;
738
+ } else {
739
+ t2 = $[5];
740
+ }
741
+ let t3;
742
+ if ($[6] !== value) {
743
+ t3 = t2.test(value);
744
+ $[6] = value;
745
+ $[7] = t3;
746
+ } else {
747
+ t3 = $[7];
748
+ }
749
+ let t4;
750
+ let t5;
751
+ if ($[8] !== value) {
752
+ t4 = /*#__PURE__*/_jsx(FileIcon, {
753
+ path: value,
754
+ size: 14
755
+ });
756
+ t5 = /*#__PURE__*/_jsx("span", {
757
+ className: "truncate",
758
+ children: value
759
+ });
760
+ $[8] = value;
761
+ $[9] = t4;
762
+ $[10] = t5;
763
+ } else {
764
+ t4 = $[9];
765
+ t5 = $[10];
766
+ }
767
+ let t6;
768
+ if ($[11] !== t3 || $[12] !== t4 || $[13] !== t5 || $[14] !== value) {
769
+ t6 = /*#__PURE__*/_jsxs("span", {
770
+ className: t1,
771
+ "data-file-path": value,
772
+ "data-file-directory": t3,
773
+ children: [t4, t5]
774
+ });
775
+ $[11] = t3;
776
+ $[12] = t4;
777
+ $[13] = t5;
778
+ $[14] = value;
779
+ $[15] = t6;
780
+ } else {
781
+ t6 = $[15];
782
+ }
783
+ return t6;
227
784
  }
228
785
  const messageComponents = {
229
- ...replyComponents,
230
- span({ children, 'data-chip': chip, 'data-value': value }) {
231
- if (chip === undefined || value === undefined) {
232
- return _jsx("span", { children: children });
233
- }
234
- return _jsx(Chip, { kind: chip, value: value });
786
+ ...replyComponents,
787
+ span({
788
+ children,
789
+ 'data-chip': chip,
790
+ 'data-value': value
791
+ }) {
792
+ if (chip === undefined || value === undefined) {
793
+ return /*#__PURE__*/_jsx("span", {
794
+ children: children
795
+ });
235
796
  }
797
+ return /*#__PURE__*/_jsx(Chip, {
798
+ kind: chip,
799
+ value: value
800
+ });
801
+ }
236
802
  };
237
803
  // Module constants, so a render never hands react-markdown a fresh array and makes it parse again.
238
804
  const PLUGINS = [remarkGfm];
@@ -242,20 +808,122 @@ const MESSAGE_PLUGINS = [remarkGfm, remarkHtmlAsText, remarkBreaks];
242
808
  const FADE_PLUGINS = [rehypeFadeWords];
243
809
  const NO_PLUGINS = [];
244
810
  /* One block of a reply. It renders no element of its own, so prose keeps its first and last margins. */
245
- const ReplyBlock = memo(function ReplyBlock({ text, fade, open, reply }) {
246
- return (_jsx(CodeStreamingContext.Provider, { value: open, children: _jsx(ShellCodeBlockReplyContext.Provider, { value: reply ?? null, children: _jsx(ReactMarkdown, { remarkPlugins: REPLY_PLUGINS, rehypePlugins: fade ? FADE_PLUGINS : NO_PLUGINS, components: replyComponents, children: text }) }) }));
811
+ const ReplyBlock = memo(function ReplyBlock(t0) {
812
+ const $ = _c(9);
813
+ const {
814
+ text,
815
+ fade,
816
+ open,
817
+ reply
818
+ } = t0;
819
+ const t1 = reply ?? null;
820
+ const t2 = fade ? FADE_PLUGINS : NO_PLUGINS;
821
+ let t3;
822
+ if ($[0] !== t2 || $[1] !== text) {
823
+ t3 = /*#__PURE__*/_jsx(ReactMarkdown, {
824
+ remarkPlugins: REPLY_PLUGINS,
825
+ rehypePlugins: t2,
826
+ components: replyComponents,
827
+ children: text
828
+ });
829
+ $[0] = t2;
830
+ $[1] = text;
831
+ $[2] = t3;
832
+ } else {
833
+ t3 = $[2];
834
+ }
835
+ let t4;
836
+ if ($[3] !== t1 || $[4] !== t3) {
837
+ t4 = /*#__PURE__*/_jsx(ShellCodeBlockReplyContext.Provider, {
838
+ value: t1,
839
+ children: t3
840
+ });
841
+ $[3] = t1;
842
+ $[4] = t3;
843
+ $[5] = t4;
844
+ } else {
845
+ t4 = $[5];
846
+ }
847
+ let t5;
848
+ if ($[6] !== open || $[7] !== t4) {
849
+ t5 = /*#__PURE__*/_jsx(CodeStreamingContext.Provider, {
850
+ value: open,
851
+ children: t4
852
+ });
853
+ $[6] = open;
854
+ $[7] = t4;
855
+ $[8] = t5;
856
+ } else {
857
+ t5 = $[8];
858
+ }
859
+ return t5;
247
860
  });
248
861
  /*
249
862
  * A code fence at the top level of a reply, drawn as markdown draws it but without parsing, so a word
250
863
  * added to a long fence costs no more than one added to a short one. It is the same tree whether the
251
864
  * fence is open or closed, so closing it keeps the lines its code block already has.
252
865
  */
253
- const ReplyFence = memo(function ReplyFence({ info, body, source, open, reply }) {
254
- const { renderShellCodeBlock } = useChatHost();
255
- // The class markdown gives the code, read back the way a parsed fence's is.
256
- const lang = languageOf(`language-${info.split(/[ \t]/, 1)[0]}`);
866
+ const ReplyFence = memo(function ReplyFence(t0) {
867
+ const $ = _c(12);
868
+ const {
869
+ info,
870
+ body,
871
+ source,
872
+ open,
873
+ reply
874
+ } = t0;
875
+ const {
876
+ renderShellCodeBlock
877
+ } = useChatHost();
878
+ let t1;
879
+ if ($[0] !== info) {
880
+ let t2;
881
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
882
+ t2 = /[ \t]/;
883
+ $[2] = t2;
884
+ } else {
885
+ t2 = $[2];
886
+ }
887
+ t1 = info.split(t2, 1);
888
+ $[0] = info;
889
+ $[1] = t1;
890
+ } else {
891
+ t1 = $[1];
892
+ }
893
+ const t2 = `language-${t1[0]}`;
894
+ let t3;
895
+ if ($[3] !== t2) {
896
+ t3 = languageOf(t2);
897
+ $[3] = t2;
898
+ $[4] = t3;
899
+ } else {
900
+ t3 = $[4];
901
+ }
902
+ const lang = t3;
903
+ let t4;
904
+ if ($[5] !== body || $[6] !== lang || $[7] !== open || $[8] !== renderShellCodeBlock || $[9] !== reply || $[10] !== source) {
257
905
  const shell = reply === undefined ? null : shellFence(source);
258
- return (_jsx(CodeStreamingContext.Provider, { value: open, children: lang === 'mermaid' ? (_jsx(Diagram, { code: body })) : (_jsx(CodeBlock, { code: body, lang: lang, actions: shellCodeBlockActions(reply ?? null, shell, renderShellCodeBlock) })) }));
906
+ t4 = /*#__PURE__*/_jsx(CodeStreamingContext.Provider, {
907
+ value: open,
908
+ children: lang === "mermaid" ? /*#__PURE__*/_jsx(Diagram, {
909
+ code: body
910
+ }) : /*#__PURE__*/_jsx(CodeBlock, {
911
+ code: body,
912
+ lang: lang,
913
+ actions: shellCodeBlockActions(reply ?? null, shell, renderShellCodeBlock)
914
+ })
915
+ });
916
+ $[5] = body;
917
+ $[6] = lang;
918
+ $[7] = open;
919
+ $[8] = renderShellCodeBlock;
920
+ $[9] = reply;
921
+ $[10] = source;
922
+ $[11] = t4;
923
+ } else {
924
+ t4 = $[11];
925
+ }
926
+ return t4;
259
927
  });
260
928
  /*
261
929
  * A reply in a chat thread, parsed a block at a time so a delta only parses the block that grows,
@@ -263,25 +931,175 @@ const ReplyFence = memo(function ReplyFence({ info, body, source, open, reply })
263
931
  * that has not closed yet is highlighted a line at a time as it grows. `arriving` fades in each block
264
932
  * as it is added instead, for a reply that is shown a block at a time.
265
933
  */
266
- export const ReplyMarkdown = memo(function ReplyMarkdown({ text, streaming, arriving = false, reply }) {
267
- const blocks = useMemo(() => splitMarkdownBlocks(text), [text]);
268
- return (_jsx("div", { className: "chat-markdown prose prose-sm max-w-none text-sm", "data-arriving": arriving || undefined, children: blocks.map((block, index) =>
269
- // Blocks only ever grow at the end, so the place of a block is a stable key.
270
- block.fence !== undefined ? (_jsx(ReplyFence, { info: block.fence.info, body: block.fence.body, source: block.fence.source, open: streaming && !block.fence.closed, reply: reply }, index)) : (_jsx(ReplyBlock, { text: block.text, fade: streaming, open: streaming && block.openFence, reply: reply }, index))) }));
934
+ export const ReplyMarkdown = memo(function ReplyMarkdown(t0) {
935
+ const $ = _c(14);
936
+ const {
937
+ text,
938
+ streaming,
939
+ arriving: t1,
940
+ reply
941
+ } = t0;
942
+ const arriving = t1 === undefined ? false : t1;
943
+ let t2;
944
+ let t3;
945
+ let t4;
946
+ if ($[0] !== arriving || $[1] !== reply || $[2] !== streaming || $[3] !== text) {
947
+ const blocks = splitMarkdownBlocks(text);
948
+ t2 = "chat-markdown prose prose-sm max-w-none text-sm";
949
+ t3 = arriving || undefined;
950
+ let t5;
951
+ if ($[7] !== reply || $[8] !== streaming) {
952
+ t5 = (block, index) => block.fence !== undefined ? /*#__PURE__*/_jsx(ReplyFence, {
953
+ info: block.fence.info,
954
+ body: block.fence.body,
955
+ source: block.fence.source,
956
+ open: streaming && !block.fence.closed,
957
+ reply: reply
958
+ }, index) : /*#__PURE__*/_jsx(ReplyBlock, {
959
+ text: block.text,
960
+ fade: streaming,
961
+ open: streaming && block.openFence,
962
+ reply: reply
963
+ }, index);
964
+ $[7] = reply;
965
+ $[8] = streaming;
966
+ $[9] = t5;
967
+ } else {
968
+ t5 = $[9];
969
+ }
970
+ t4 = blocks.map(t5);
971
+ $[0] = arriving;
972
+ $[1] = reply;
973
+ $[2] = streaming;
974
+ $[3] = text;
975
+ $[4] = t2;
976
+ $[5] = t3;
977
+ $[6] = t4;
978
+ } else {
979
+ t2 = $[4];
980
+ t3 = $[5];
981
+ t4 = $[6];
982
+ }
983
+ let t5;
984
+ if ($[10] !== t2 || $[11] !== t3 || $[12] !== t4) {
985
+ t5 = /*#__PURE__*/_jsx("div", {
986
+ className: t2,
987
+ "data-arriving": t3,
988
+ children: t4
989
+ });
990
+ $[10] = t2;
991
+ $[11] = t3;
992
+ $[12] = t4;
993
+ $[13] = t5;
994
+ } else {
995
+ t5 = $[13];
996
+ }
997
+ return t5;
271
998
  });
272
999
  /*
273
1000
  * A message a person sent. Enter meant a line break, a tag typed without backticks stays the text
274
1001
  * it was, and the files and skills picked in the composer are chips again.
275
1002
  */
276
- export const MessageMarkdown = memo(function MessageMarkdown({ text, mentions, skills }) {
277
- const rehypePlugins = useMemo(() => [[rehypeChips, { mentions, skills }]], [mentions, skills]);
278
- return (_jsx("div", { className: "chat-markdown prose prose-sm max-w-none text-sm", children: _jsx(ReactMarkdown, { remarkPlugins: MESSAGE_PLUGINS, rehypePlugins: rehypePlugins, components: messageComponents, children: text }) }));
1003
+ export const MessageMarkdown = memo(function MessageMarkdown(t0) {
1004
+ const $ = _c(6);
1005
+ const {
1006
+ text,
1007
+ mentions,
1008
+ skills
1009
+ } = t0;
1010
+ let t1;
1011
+ if ($[0] !== mentions || $[1] !== skills) {
1012
+ t1 = [[rehypeChips, {
1013
+ mentions,
1014
+ skills
1015
+ }]];
1016
+ $[0] = mentions;
1017
+ $[1] = skills;
1018
+ $[2] = t1;
1019
+ } else {
1020
+ t1 = $[2];
1021
+ }
1022
+ const rehypePlugins = t1;
1023
+ let t2;
1024
+ if ($[3] !== rehypePlugins || $[4] !== text) {
1025
+ t2 = /*#__PURE__*/_jsx("div", {
1026
+ className: "chat-markdown prose prose-sm max-w-none text-sm",
1027
+ children: /*#__PURE__*/_jsx(ReactMarkdown, {
1028
+ remarkPlugins: MESSAGE_PLUGINS,
1029
+ rehypePlugins: rehypePlugins,
1030
+ components: messageComponents,
1031
+ children: text
1032
+ })
1033
+ });
1034
+ $[3] = rehypePlugins;
1035
+ $[4] = text;
1036
+ $[5] = t2;
1037
+ } else {
1038
+ t2 = $[5];
1039
+ }
1040
+ return t2;
279
1041
  });
280
1042
  /*
281
1043
  * `breaks` is for person-authored notes; applying it to CLI markdown would change its layout. `muted`
282
1044
  * sets the text a step back, for what stands beside an answer rather than being one.
283
1045
  */
284
- export const Markdown = memo(function Markdown({ text, breaks = false, fileLinks = true, muted = false, rehypePlugins, componentOverrides }) {
285
- const renderComponents = useMemo(() => ({ ...(fileLinks ? components : plainComponents), ...componentOverrides }), [fileLinks, componentOverrides]);
286
- return (_jsx("div", { className: "chat-markdown prose prose-sm max-w-none text-sm", "data-muted": muted || undefined, children: _jsx(ReactMarkdown, { remarkPlugins: breaks ? PLUGINS_WITH_BREAKS : PLUGINS, rehypePlugins: rehypePlugins, components: renderComponents, children: text }) }));
287
- });
1046
+ export const Markdown = memo(function Markdown(t0) {
1047
+ const $ = _c(11);
1048
+ const {
1049
+ text,
1050
+ breaks: t1,
1051
+ fileLinks: t2,
1052
+ muted: t3,
1053
+ rehypePlugins,
1054
+ componentOverrides
1055
+ } = t0;
1056
+ const breaks = t1 === undefined ? false : t1;
1057
+ const fileLinks = t2 === undefined ? true : t2;
1058
+ const muted = t3 === undefined ? false : t3;
1059
+ const t4 = fileLinks ? components : plainComponents;
1060
+ let t5;
1061
+ if ($[0] !== componentOverrides || $[1] !== t4) {
1062
+ t5 = {
1063
+ ...t4,
1064
+ ...componentOverrides
1065
+ };
1066
+ $[0] = componentOverrides;
1067
+ $[1] = t4;
1068
+ $[2] = t5;
1069
+ } else {
1070
+ t5 = $[2];
1071
+ }
1072
+ const renderComponents = t5;
1073
+ const t6 = muted || undefined;
1074
+ const t7 = breaks ? PLUGINS_WITH_BREAKS : PLUGINS;
1075
+ let t8;
1076
+ if ($[3] !== rehypePlugins || $[4] !== renderComponents || $[5] !== t7 || $[6] !== text) {
1077
+ t8 = /*#__PURE__*/_jsx(ReactMarkdown, {
1078
+ remarkPlugins: t7,
1079
+ rehypePlugins: rehypePlugins,
1080
+ components: renderComponents,
1081
+ children: text
1082
+ });
1083
+ $[3] = rehypePlugins;
1084
+ $[4] = renderComponents;
1085
+ $[5] = t7;
1086
+ $[6] = text;
1087
+ $[7] = t8;
1088
+ } else {
1089
+ t8 = $[7];
1090
+ }
1091
+ let t9;
1092
+ if ($[8] !== t6 || $[9] !== t8) {
1093
+ t9 = /*#__PURE__*/_jsx("div", {
1094
+ className: "chat-markdown prose prose-sm max-w-none text-sm",
1095
+ "data-muted": t6,
1096
+ children: t8
1097
+ });
1098
+ $[8] = t6;
1099
+ $[9] = t8;
1100
+ $[10] = t9;
1101
+ } else {
1102
+ t9 = $[10];
1103
+ }
1104
+ return t9;
1105
+ });