@adecore/agents-react 0.38.0 → 0.40.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 (351) hide show
  1. package/dist/agents/AgentModelLabel.d.ts +10 -0
  2. package/dist/agents/AgentModelLabel.js +98 -0
  3. package/dist/agents/model-name.js +2 -1
  4. package/dist/agents/provider-paths.d.ts +2 -1
  5. package/dist/agents/provider-paths.js +7 -3
  6. package/dist/chat/account-choice.js +57 -28
  7. package/dist/chat/bookmarks.js +2 -1
  8. package/dist/chat/drafts.d.ts +0 -1
  9. package/dist/chat/drafts.js +9 -28
  10. package/dist/chat/logic/picker-entries.js +2 -8
  11. package/dist/chat/logic/resume-compaction.js +2 -5
  12. package/dist/chat/logic/timeline-copy.js +2 -8
  13. package/dist/chat/logic/timeline.js +9 -10
  14. package/dist/chat/logic/workflow.js +2 -4
  15. package/dist/chat/subagent-conversation.js +2 -1
  16. package/dist/chat/ui/Composer.js +385 -360
  17. package/dist/chat/ui/GoalDock.js +2 -1
  18. package/dist/chat/ui/LimitState.js +4 -6
  19. package/dist/chat/ui/Pickers.d.ts +2 -1
  20. package/dist/chat/ui/Pickers.js +126 -123
  21. package/dist/chat/ui/PromptEditor.d.ts +19 -0
  22. package/dist/chat/ui/PromptEditor.js +115 -0
  23. package/dist/chat/ui/Timeline.d.ts +2 -1
  24. package/dist/chat/ui/Timeline.js +13 -1
  25. package/dist/chat/ui/composer/ComposerControls.d.ts +3 -0
  26. package/dist/chat/ui/composer/ComposerControls.js +235 -38
  27. package/dist/chat/ui/composer/key-handler.d.ts +1 -1
  28. package/dist/chat/ui/composer/key-handler.js +3 -11
  29. package/dist/chat/ui/composer/prompt-picks.d.ts +4 -0
  30. package/dist/chat/ui/composer/prompt-picks.js +14 -0
  31. package/dist/chat/ui/composer/use-composer-menus.d.ts +4 -49
  32. package/dist/chat/ui/composer/use-composer-menus.js +65 -519
  33. package/dist/chat/ui/composer/use-continuable-turn.js +0 -1
  34. package/dist/chat/ui/composer/use-notice.js +2 -1
  35. package/dist/chat/ui/composer/use-prompt-history.js +1 -1
  36. package/dist/chat/ui/composer/use-prompt-menus.d.ts +73 -0
  37. package/dist/chat/ui/composer/use-prompt-menus.js +499 -0
  38. package/dist/chat/ui/composer/use-take-back.js +2 -2
  39. package/dist/chat/ui/diff/ApprovalReview.js +1 -1
  40. package/dist/chat/ui/highlighter.d.ts +0 -6
  41. package/dist/chat/ui/highlighter.js +0 -12
  42. package/dist/chat/ui/icons.d.ts +0 -1
  43. package/dist/chat/ui/icons.js +0 -3
  44. package/dist/chat/ui/index.d.ts +3 -0
  45. package/dist/chat/ui/index.js +2 -0
  46. package/dist/chat/ui/rows/MessageRows.js +2 -5
  47. package/dist/chat/ui/rows/row-rhythm.js +2 -5
  48. package/dist/chat/ui/theme-watch.js +3 -7
  49. package/dist/host-hooks.d.ts +2 -1
  50. package/dist/host-hooks.js +6 -0
  51. package/dist/host.d.ts +17 -1
  52. package/dist/index.d.ts +1 -1
  53. package/dist/locales/en/agent-chat.d.ts +1 -0
  54. package/dist/locales/en/agent-chat.js +1 -0
  55. package/dist/locales/nl/agent-chat.d.ts +1 -0
  56. package/dist/locales/nl/agent-chat.js +1 -0
  57. package/dist/prompts/logic/usePromptSession.js +2 -1
  58. package/dist/providers/AddAccountForm.js +2 -1
  59. package/dist/providers/CliDetail.js +104 -130
  60. package/dist/providers/account-actions.js +6 -9
  61. package/dist/providers/index.d.ts +1 -0
  62. package/dist/providers/index.js +1 -0
  63. package/dist/state/chats.d.ts +1 -0
  64. package/dist/state/chats.js +6 -11
  65. package/dist/state/provider-accounts.d.ts +1 -1
  66. package/dist/state/provider-accounts.js +2 -8
  67. package/dist/theme.css +3 -0
  68. package/dist/transport.d.ts +2 -0
  69. package/dist/transport.js +14 -0
  70. package/dist/usage/ChartLogo.d.ts +5 -0
  71. package/dist/usage/ChartLogo.js +48 -0
  72. package/dist/usage/LimitsList.js +6 -16
  73. package/dist/usage/UsageBreakdown.js +17 -40
  74. package/dist/usage/UsageLimits.js +183 -211
  75. package/dist/usage/UsagePage.js +3 -17
  76. package/dist/usage/UsageSummary.js +4 -9
  77. package/dist/usage/limits.js +16 -31
  78. package/dist/usage/summary.d.ts +1 -1
  79. package/dist/usage/summary.js +3 -5
  80. package/package.json +26 -26
  81. package/src/agents/AccountDot.tsx +1 -0
  82. package/src/agents/AgentIcon.tsx +2 -0
  83. package/src/agents/AgentModelLabel.tsx +38 -0
  84. package/src/agents/ModelOptionControl.tsx +8 -0
  85. package/src/agents/account-limits.ts +3 -0
  86. package/src/agents/accounts.ts +12 -0
  87. package/src/agents/model-name.ts +13 -1
  88. package/src/agents/model-options.ts +2 -0
  89. package/src/agents/model-requirement.ts +4 -0
  90. package/src/agents/option-words.ts +2 -0
  91. package/src/agents/provider-paths.ts +8 -3
  92. package/src/agents/status-look.ts +1 -0
  93. package/src/chat/account-choice.ts +25 -19
  94. package/src/chat/actions.ts +5 -0
  95. package/src/chat/attachments.ts +8 -0
  96. package/src/chat/bookmarks.ts +13 -1
  97. package/src/chat/chat-client.ts +63 -0
  98. package/src/chat/chat-references.ts +3 -0
  99. package/src/chat/composer-effort.ts +5 -0
  100. package/src/chat/composer-send.ts +4 -0
  101. package/src/chat/drafts.ts +21 -17
  102. package/src/chat/forks.ts +4 -0
  103. package/src/chat/guards.ts +2 -0
  104. package/src/chat/index.ts +7 -0
  105. package/src/chat/logic/ansi.ts +47 -0
  106. package/src/chat/logic/bookmarks.ts +7 -0
  107. package/src/chat/logic/command-looks.ts +29 -0
  108. package/src/chat/logic/context-usage.ts +3 -0
  109. package/src/chat/logic/continue-after-stop.ts +5 -0
  110. package/src/chat/logic/effort.ts +4 -0
  111. package/src/chat/logic/embedded-code.ts +63 -0
  112. package/src/chat/logic/fork.ts +22 -0
  113. package/src/chat/logic/generated-image.ts +7 -0
  114. package/src/chat/logic/goal.ts +7 -0
  115. package/src/chat/logic/handback.ts +2 -0
  116. package/src/chat/logic/limit.ts +8 -0
  117. package/src/chat/logic/picker-entries.ts +16 -4
  118. package/src/chat/logic/resume-compaction.ts +22 -5
  119. package/src/chat/logic/scrubber.ts +38 -5
  120. package/src/chat/logic/thought.ts +5 -0
  121. package/src/chat/logic/thread-cards.ts +6 -0
  122. package/src/chat/logic/timeline-copy.ts +4 -9
  123. package/src/chat/logic/timeline-target.ts +15 -0
  124. package/src/chat/logic/timeline.ts +113 -10
  125. package/src/chat/logic/tools.ts +30 -0
  126. package/src/chat/logic/visual-height.ts +5 -0
  127. package/src/chat/logic/visual-viewport.ts +1 -0
  128. package/src/chat/logic/welcome.ts +3 -0
  129. package/src/chat/logic/workflow.ts +26 -7
  130. package/src/chat/mentions.ts +56 -0
  131. package/src/chat/pending-prompts.ts +16 -0
  132. package/src/chat/persisted-json.ts +15 -0
  133. package/src/chat/preferences.ts +16 -0
  134. package/src/chat/prompt-hold.ts +2 -0
  135. package/src/chat/quote.ts +7 -0
  136. package/src/chat/reading-width.ts +1 -0
  137. package/src/chat/recent-messages.ts +5 -0
  138. package/src/chat/resume-compaction-dismissals.ts +1 -0
  139. package/src/chat/stash.ts +12 -0
  140. package/src/chat/subagent-conversation.ts +24 -4
  141. package/src/chat/subagent-list.ts +14 -0
  142. package/src/chat/subagent-support.ts +1 -0
  143. package/src/chat/subagent-view.ts +9 -0
  144. package/src/chat/thumbnails.ts +14 -0
  145. package/src/chat/timeline-flash.ts +2 -0
  146. package/src/chat/timeline-scroll.ts +23 -0
  147. package/src/chat/ui/AccountPill.tsx +4 -0
  148. package/src/chat/ui/AnsiOutput.tsx +1 -0
  149. package/src/chat/ui/BookmarkMarker.tsx +5 -0
  150. package/src/chat/ui/BookmarkSubmenu.tsx +1 -0
  151. package/src/chat/ui/ChatActivity.tsx +13 -0
  152. package/src/chat/ui/CodeBlock.tsx +8 -0
  153. package/src/chat/ui/Composer.tsx +27 -3
  154. package/src/chat/ui/ComposerInput.tsx +22 -0
  155. package/src/chat/ui/DiffPool.tsx +3 -0
  156. package/src/chat/ui/EditDiff.tsx +5 -0
  157. package/src/chat/ui/GoalDock.tsx +13 -1
  158. package/src/chat/ui/ImageView.tsx +11 -0
  159. package/src/chat/ui/LimitState.tsx +23 -6
  160. package/src/chat/ui/Markdown.tsx +41 -0
  161. package/src/chat/ui/MermaidBlock.tsx +16 -0
  162. package/src/chat/ui/MessageActions.tsx +8 -0
  163. package/src/chat/ui/ModelMarks.tsx +1 -0
  164. package/src/chat/ui/Pickers.tsx +30 -1
  165. package/src/chat/ui/PromptComposer.tsx +2 -0
  166. package/src/chat/ui/PromptEditor.tsx +136 -0
  167. package/src/chat/ui/QuoteButton.tsx +12 -0
  168. package/src/chat/ui/ReferenceChip.tsx +3 -0
  169. package/src/chat/ui/ResumeCompactionDock.tsx +1 -0
  170. package/src/chat/ui/RowTime.tsx +1 -0
  171. package/src/chat/ui/RunSettings.tsx +38 -0
  172. package/src/chat/ui/Scrubber.tsx +14 -0
  173. package/src/chat/ui/SessionLine.tsx +1 -0
  174. package/src/chat/ui/ShellCommand.tsx +32 -0
  175. package/src/chat/ui/SubagentControls.tsx +7 -0
  176. package/src/chat/ui/SubagentInfo.tsx +1 -0
  177. package/src/chat/ui/SubagentStopButton.tsx +6 -0
  178. package/src/chat/ui/SubagentTimeline.tsx +10 -0
  179. package/src/chat/ui/Timeline.tsx +141 -1
  180. package/src/chat/ui/TimelineMenu.tsx +5 -0
  181. package/src/chat/ui/UnifiedDiff.tsx +6 -0
  182. package/src/chat/ui/UploadThumb.tsx +2 -0
  183. package/src/chat/ui/VisualDialogs.tsx +3 -0
  184. package/src/chat/ui/VisualFrame.tsx +15 -0
  185. package/src/chat/ui/Welcome.tsx +1 -0
  186. package/src/chat/ui/chip-clipboard.ts +20 -0
  187. package/src/chat/ui/code-lines.ts +14 -0
  188. package/src/chat/ui/code-theme.ts +1 -0
  189. package/src/chat/ui/composer/ComposerControls.tsx +70 -15
  190. package/src/chat/ui/composer/ComposerMenu.tsx +12 -0
  191. package/src/chat/ui/composer/DraftParts.tsx +2 -0
  192. package/src/chat/ui/composer/QueuedMessages.tsx +4 -0
  193. package/src/chat/ui/composer/chip-paste.ts +16 -0
  194. package/src/chat/ui/composer/chips.ts +6 -0
  195. package/src/chat/ui/composer/editor.ts +9 -0
  196. package/src/chat/ui/composer/insert.ts +2 -0
  197. package/src/chat/ui/composer/key-handler.ts +42 -9
  198. package/src/chat/ui/composer/keys.ts +23 -0
  199. package/src/chat/ui/composer/placeholder.ts +6 -0
  200. package/src/chat/ui/composer/prompt-picks.ts +18 -0
  201. package/src/chat/ui/composer/surface.ts +5 -0
  202. package/src/chat/ui/composer/use-chat-controls.ts +13 -0
  203. package/src/chat/ui/composer/use-compaction-offer.ts +3 -0
  204. package/src/chat/ui/composer/use-composer-menus.ts +20 -275
  205. package/src/chat/ui/composer/use-composer-submit.ts +27 -0
  206. package/src/chat/ui/composer/use-continuable-turn.ts +3 -5
  207. package/src/chat/ui/composer/use-draft-files.ts +24 -0
  208. package/src/chat/ui/composer/use-effort-stepper.ts +8 -0
  209. package/src/chat/ui/composer/use-notice.ts +4 -1
  210. package/src/chat/ui/composer/use-pending-requests.ts +3 -0
  211. package/src/chat/ui/composer/use-prompt-history.ts +20 -11
  212. package/src/chat/ui/composer/use-prompt-hold.ts +3 -0
  213. package/src/chat/ui/composer/use-prompt-menus.ts +361 -0
  214. package/src/chat/ui/composer/use-take-back.ts +20 -2
  215. package/src/chat/ui/diff/ApprovalReview.tsx +18 -15
  216. package/src/chat/ui/diff/DiffFallbackBoundary.tsx +1 -0
  217. package/src/chat/ui/diff/DiffOmitted.tsx +1 -0
  218. package/src/chat/ui/diff/DiffStack.tsx +2 -0
  219. package/src/chat/ui/diff/DiffUnavailable.tsx +1 -0
  220. package/src/chat/ui/diff/EditorEditDiff.tsx +13 -0
  221. package/src/chat/ui/diff/EditorPatchDiff.tsx +4 -0
  222. package/src/chat/ui/diff/LegacyDiffPool.tsx +2 -0
  223. package/src/chat/ui/diff/LegacyEditDiff.tsx +2 -0
  224. package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +8 -0
  225. package/src/chat/ui/diff/RawDiff.tsx +1 -0
  226. package/src/chat/ui/diff/ReviewDiff.tsx +1 -0
  227. package/src/chat/ui/diff/diff-source-budget.ts +8 -0
  228. package/src/chat/ui/diff/editor-edit-model.ts +4 -0
  229. package/src/chat/ui/diff/review-plan.ts +9 -0
  230. package/src/chat/ui/diff/review-settle.ts +1 -0
  231. package/src/chat/ui/diff/syntax-runtime.ts +52 -0
  232. package/src/chat/ui/diff/use-review-stack.ts +9 -0
  233. package/src/chat/ui/diff-syntax.ts +12 -0
  234. package/src/chat/ui/diff-theme.ts +2 -0
  235. package/src/chat/ui/file-links.ts +2 -0
  236. package/src/chat/ui/find-reveal.ts +1 -0
  237. package/src/chat/ui/full-diff.ts +1 -0
  238. package/src/chat/ui/highlighter.ts +29 -15
  239. package/src/chat/ui/icons.tsx +2 -4
  240. package/src/chat/ui/index.ts +7 -0
  241. package/src/chat/ui/intelligent-ui/UiBlockFrame.tsx +25 -0
  242. package/src/chat/ui/intelligent-ui/UiFallbackPart.tsx +1 -0
  243. package/src/chat/ui/intelligent-ui/UiReply.tsx +63 -0
  244. package/src/chat/ui/intelligent-ui/block-local.ts +5 -0
  245. package/src/chat/ui/intelligent-ui/chart-data.ts +15 -0
  246. package/src/chat/ui/intelligent-ui/node-text.ts +17 -0
  247. package/src/chat/ui/intelligent-ui/renderers/binding.ts +1 -0
  248. package/src/chat/ui/intelligent-ui/renderers/chart.tsx +31 -0
  249. package/src/chat/ui/intelligent-ui/renderers/choices.tsx +4 -0
  250. package/src/chat/ui/intelligent-ui/renderers/content.tsx +18 -0
  251. package/src/chat/ui/intelligent-ui/renderers/data.tsx +11 -0
  252. package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +13 -0
  253. package/src/chat/ui/intelligent-ui/renderers/links.tsx +9 -0
  254. package/src/chat/ui/intelligent-ui/renderers/map-slots.ts +15 -0
  255. package/src/chat/ui/intelligent-ui/renderers/map-style.ts +15 -0
  256. package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +48 -0
  257. package/src/chat/ui/intelligent-ui/renderers/map.tsx +20 -0
  258. package/src/chat/ui/intelligent-ui/renderers/place-point.ts +3 -0
  259. package/src/chat/ui/intelligent-ui/renderers/structure.tsx +3 -0
  260. package/src/chat/ui/intelligent-ui/renderers/text.tsx +8 -0
  261. package/src/chat/ui/intelligent-ui/reply-parts.ts +5 -0
  262. package/src/chat/ui/intelligent-ui/table-data.ts +17 -0
  263. package/src/chat/ui/intelligent-ui/use-in-view.ts +4 -0
  264. package/src/chat/ui/intelligent-ui/use-later.ts +4 -0
  265. package/src/chat/ui/intelligent-ui/use-truncated.ts +5 -0
  266. package/src/chat/ui/intelligent-ui/use-ui-links.ts +29 -0
  267. package/src/chat/ui/intelligent-ui/use-ui-queries.ts +60 -0
  268. package/src/chat/ui/markdown-blocks.ts +64 -0
  269. package/src/chat/ui/mermaid.ts +4 -0
  270. package/src/chat/ui/quote-selection.ts +10 -0
  271. package/src/chat/ui/rehype-chips.ts +5 -0
  272. package/src/chat/ui/rehype-fade.ts +2 -0
  273. package/src/chat/ui/remark-html-as-text.ts +5 -0
  274. package/src/chat/ui/reveal.ts +18 -0
  275. package/src/chat/ui/rows/ForksRow.tsx +5 -0
  276. package/src/chat/ui/rows/GeneratedImageRow.tsx +10 -0
  277. package/src/chat/ui/rows/MessageRows.tsx +29 -5
  278. package/src/chat/ui/rows/RowContainer.tsx +1 -0
  279. package/src/chat/ui/rows/Rows.tsx +2 -0
  280. package/src/chat/ui/rows/SubagentRow.tsx +13 -0
  281. package/src/chat/ui/rows/TaskRow.tsx +7 -0
  282. package/src/chat/ui/rows/VisualRow.tsx +4 -0
  283. package/src/chat/ui/rows/WorkRows.tsx +46 -0
  284. package/src/chat/ui/rows/WorkflowRow.tsx +10 -0
  285. package/src/chat/ui/rows/row-rhythm.ts +7 -5
  286. package/src/chat/ui/theme-watch.ts +8 -7
  287. package/src/chat/ui/thread-references.ts +7 -0
  288. package/src/chat/ui/use-diff-source-tokens.ts +8 -0
  289. package/src/chat/ui/useToggleSet.ts +3 -0
  290. package/src/chat/ui/visual-theme.ts +30 -0
  291. package/src/chat/visual-bridge.ts +23 -0
  292. package/src/chat/visual-viewport.ts +12 -0
  293. package/src/host-hooks.ts +15 -5
  294. package/src/host.ts +29 -1
  295. package/src/index.ts +5 -0
  296. package/src/lazy.tsx +9 -0
  297. package/src/locales/en/agent-chat.ts +1 -0
  298. package/src/locales/nl/agent-chat.ts +1 -0
  299. package/src/mounted-registry.ts +4 -0
  300. package/src/port-transport.ts +32 -0
  301. package/src/prompts/index.ts +2 -0
  302. package/src/prompts/logic/focus.ts +5 -0
  303. package/src/prompts/logic/keys.ts +12 -0
  304. package/src/prompts/logic/prompts.ts +8 -0
  305. package/src/prompts/logic/subjects.ts +8 -0
  306. package/src/prompts/logic/useFocusAfterAnswer.ts +2 -0
  307. package/src/prompts/logic/usePromptSession.ts +13 -1
  308. package/src/prompts/ui/ApprovalBody.tsx +2 -0
  309. package/src/prompts/ui/PromptActions.tsx +2 -0
  310. package/src/prompts/ui/PromptCard.tsx +6 -0
  311. package/src/prompts/ui/PromptView.tsx +6 -0
  312. package/src/prompts/ui/QuestionBody.tsx +11 -0
  313. package/src/providers/AccountColors.tsx +1 -0
  314. package/src/providers/AccountDetail.tsx +7 -0
  315. package/src/providers/AccountVariables.tsx +2 -0
  316. package/src/providers/AddAccountForm.tsx +5 -1
  317. package/src/providers/CliDetail.tsx +6 -5
  318. package/src/providers/InstallPage.tsx +11 -0
  319. package/src/providers/ProviderList.tsx +3 -0
  320. package/src/providers/ProvidersPane.tsx +18 -0
  321. package/src/providers/account-actions.ts +10 -8
  322. package/src/providers/index.ts +1 -0
  323. package/src/providers/install-steps.ts +3 -0
  324. package/src/providers/pane-target.ts +5 -0
  325. package/src/providers/provider-abilities.ts +1 -0
  326. package/src/providers/provider-groups.ts +6 -0
  327. package/src/providers/variables.ts +12 -0
  328. package/src/scope.ts +2 -0
  329. package/src/state/chats.ts +61 -14
  330. package/src/state/index.ts +2 -0
  331. package/src/state/provider-accounts.ts +7 -9
  332. package/src/state/providers.ts +1 -0
  333. package/src/state/usage.ts +6 -0
  334. package/src/storage.ts +18 -0
  335. package/src/testing/prompts.ts +5 -0
  336. package/src/theme.css +3 -0
  337. package/src/transport.ts +18 -0
  338. package/src/usage/ChartLogo.tsx +12 -0
  339. package/src/usage/LimitsList.tsx +7 -8
  340. package/src/usage/UsageBreakdown.tsx +11 -4
  341. package/src/usage/UsageChart.tsx +5 -0
  342. package/src/usage/UsageLimits.tsx +10 -7
  343. package/src/usage/UsageLimitsCard.tsx +2 -0
  344. package/src/usage/UsagePage.tsx +16 -19
  345. package/src/usage/UsageSummary.tsx +4 -5
  346. package/src/usage/UsageTiles.tsx +2 -0
  347. package/src/usage/format.ts +7 -0
  348. package/src/usage/limit-groups.ts +14 -0
  349. package/src/usage/limits.ts +11 -13
  350. package/src/usage/money.ts +1 -0
  351. package/src/usage/summary.ts +15 -7
@@ -10,6 +10,7 @@ import { useChatScope } from '../../scope.js';
10
10
  import { useChats } from '../../state/chats.js';
11
11
  import { useChatActions } from '../actions.js';
12
12
  import { goalView } from '../logic/goal.js';
13
+ import { errorMessage } from '../../transport.js';
13
14
  /* How far the goal got, in what its CLI counts: the checks that sent the agent on, or the tokens it spent. */
14
15
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
15
16
  function progressOf(goal, t) {
@@ -71,7 +72,7 @@ export function GoalDock(t0) {
71
72
  actions.goal(chatId, action).catch(e => host.notify({
72
73
  kind: "error",
73
74
  title: t("goal.failed"),
74
- description: e instanceof Error ? e.message : String(e)
75
+ description: errorMessage(e)
75
76
  })).finally(() => setChanging(false));
76
77
  };
77
78
  $[9] = actions;
@@ -18,6 +18,7 @@ import { useChatActions } from '../actions.js';
18
18
  import { useUsageStore } from '../../state/usage.js';
19
19
  import { SessionLine } from './SessionLine.js';
20
20
  import { useHostResumeAtReset } from '../../host-hooks.js';
21
+ import { errorMessage } from '../../transport.js';
21
22
  // A time a limit names reads as a clock today and with its day after that, so the words follow the minute.
22
23
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
23
24
  const MINUTE_MS = 60_000;
@@ -121,11 +122,8 @@ function ResumeAtResetToggle(t0) {
121
122
  return t7;
122
123
  }
123
124
  /*
124
- * Another account of the chat's CLI that has room: the one with the least of its session spent, and
125
- * beside it a menu of every account with room, for a person whose companies each pay for their own
126
- * work. Only ever offered, since going on there spends someone's other plan, and nothing is
127
- * remembered: the next limit suggests the one with the most room again. An account that reads the
128
- * chat's conversation takes it over; any other goes on in a fork, which then opens the way a fork does.
125
+ * Another account of the chat's CLI with room, only ever offered since it spends someone's other plan, and
126
+ * never remembered. One that reads the chat's conversation takes it over; any other goes on in a fork.
129
127
  */
130
128
  function _temp() {}
131
129
  function ContinueOn(t0) {
@@ -187,7 +185,7 @@ function ContinueOn(t0) {
187
185
  title: t("limit.continueFailed", {
188
186
  account: choice.nameOf(entry)
189
187
  }),
190
- description: e instanceof Error ? e.message : String(e)
188
+ description: errorMessage(e)
191
189
  })).finally(() => setBusy(false));
192
190
  };
193
191
  $[9] = actions;
@@ -11,10 +11,11 @@ interface ModelPickerProps {
11
11
  kbd?: string | null;
12
12
  side?: 'top' | 'bottom';
13
13
  trigger?: 'plain' | 'chip';
14
+ chipSize?: 'sm' | 'md';
14
15
  finalFocus?: RefObject<HTMLElement | null>;
15
16
  footer?: ReactNode;
16
17
  }
17
- export declare function ModelPicker({ providers, provider, selection, open, onOpenChange, onChange, kbd, side, trigger, finalFocus, footer }: ModelPickerProps): import("react").JSX.Element;
18
+ export declare function ModelPicker({ providers, provider, selection, open, onOpenChange, onChange, kbd, side, trigger, chipSize, finalFocus, footer }: ModelPickerProps): import("react").JSX.Element;
18
19
  export declare function StashPicker({ onRestore }: {
19
20
  onRestore(prompt: StashedPrompt): void;
20
21
  }): import("react").JSX.Element | null;
@@ -23,7 +23,7 @@ const triggerClass = 'flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rou
23
23
  * provider's model is also how a chat picks its provider; with one CLI the group headers drop.
24
24
  */
25
25
  export function ModelPicker(t0) {
26
- const $ = _c(49);
26
+ const $ = _c(50);
27
27
  const {
28
28
  providers,
29
29
  provider,
@@ -34,115 +34,117 @@ export function ModelPicker(t0) {
34
34
  kbd: t1,
35
35
  side: t2,
36
36
  trigger: t3,
37
+ chipSize: t4,
37
38
  finalFocus,
38
39
  footer
39
40
  } = t0;
40
41
  const kbd = t1 === undefined ? "/model" : t1;
41
42
  const side = t2 === undefined ? "top" : t2;
42
43
  const trigger = t3 === undefined ? "plain" : t3;
44
+ const chipSize = t4 === undefined ? "sm" : t4;
43
45
  const host = useChatHost();
44
46
  const {
45
47
  t
46
48
  } = useTranslation("agent-chat");
47
49
  const [query, setQuery] = useState("");
48
50
  const [legacyOpen, setLegacyOpen] = useState(false);
49
- let t4;
51
+ let t5;
50
52
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
51
- t4 = new Set();
52
- $[0] = t4;
53
+ t5 = new Set();
54
+ $[0] = t5;
53
55
  } else {
54
- t4 = $[0];
56
+ t5 = $[0];
55
57
  }
56
- const [expanded, setExpanded] = useState(t4);
58
+ const [expanded, setExpanded] = useState(t5);
57
59
  const [index, setIndex] = useState(0);
58
60
  const inputRef = useRef(null);
59
61
  const listRef = useRef(null);
60
62
  let owner;
61
- let t5;
63
+ let t6;
62
64
  if ($[1] !== provider || $[2] !== providers || $[3] !== selection.model) {
63
- let t6;
65
+ let t7;
64
66
  if ($[6] !== provider) {
65
- t6 = entry => entry.kind === provider;
67
+ t7 = entry => entry.kind === provider;
66
68
  $[6] = provider;
67
- $[7] = t6;
69
+ $[7] = t7;
68
70
  } else {
69
- t6 = $[7];
71
+ t7 = $[7];
70
72
  }
71
- owner = providers.find(t6);
72
- t5 = modelName(selection.model, owner?.models);
73
+ owner = providers.find(t7);
74
+ t6 = modelName(selection.model, owner?.models);
73
75
  $[1] = provider;
74
76
  $[2] = providers;
75
77
  $[3] = selection.model;
76
78
  $[4] = owner;
77
- $[5] = t5;
79
+ $[5] = t6;
78
80
  } else {
79
81
  owner = $[4];
80
- t5 = $[5];
82
+ t6 = $[5];
81
83
  }
82
- const current = t5;
83
- let t6;
84
+ const current = t6;
85
+ let t7;
84
86
  if ($[8] !== provider || $[9] !== providers || $[10] !== selection.model) {
85
- t6 = agentChipOf(providers, provider, selection.model);
87
+ t7 = agentChipOf(providers, provider, selection.model);
86
88
  $[8] = provider;
87
89
  $[9] = providers;
88
90
  $[10] = selection.model;
89
- $[11] = t6;
91
+ $[11] = t7;
90
92
  } else {
91
- t6 = $[11];
93
+ t7 = $[11];
92
94
  }
93
- const chip = t6;
95
+ const chip = t7;
94
96
  const grouped = providers.length > 1;
95
97
  const trimmed = query.trim().toLowerCase();
96
98
  const favorites = useChatPreferences(_temp);
97
- let t7;
99
+ let t8;
98
100
  if ($[12] !== favorites) {
99
- t7 = row => row?.kind === "model" && favorites[row.provider.kind]?.includes(row.model.slug) === true;
101
+ t8 = row => row?.kind === "model" && favorites[row.provider.kind]?.includes(row.model.slug) === true;
100
102
  $[12] = favorites;
101
- $[13] = t7;
103
+ $[13] = t8;
102
104
  } else {
103
- t7 = $[13];
105
+ t8 = $[13];
104
106
  }
105
- const starredHere = t7;
106
- let t8;
107
+ const starredHere = t8;
108
+ let t9;
107
109
  if ($[14] !== favorites) {
108
- t8 = kind => favoriteModelsOf(favorites, kind);
110
+ t9 = kind => favoriteModelsOf(favorites, kind);
109
111
  $[14] = favorites;
110
- $[15] = t8;
112
+ $[15] = t9;
111
113
  } else {
112
- t8 = $[15];
114
+ t9 = $[15];
113
115
  }
114
116
  const entries = pickerEntriesOf(inPickerOrder(providers), trimmed, legacyOpen, expanded, {
115
117
  provider,
116
118
  model: selection.model
117
- }, t8);
119
+ }, t9);
118
120
  const scope = useContext(ChatScopeContext);
119
121
  const machine = useHostMachineLabel(scope?.id ?? "");
120
122
  const reported = useReportedModels(provider);
121
- let t9;
123
+ let t10;
122
124
  if ($[16] !== reported) {
123
- t9 = entry_0 => modelRequirementOf(entry_0.model, entry_0.provider, reported);
125
+ t10 = entry_0 => modelRequirementOf(entry_0.model, entry_0.provider, reported);
124
126
  $[16] = reported;
125
- $[17] = t9;
127
+ $[17] = t10;
126
128
  } else {
127
- t9 = $[17];
129
+ t10 = $[17];
128
130
  }
129
- const requirementOf = t9;
131
+ const requirementOf = t10;
130
132
  const kindBefore = i => {
131
133
  const before = entries[i - 1];
132
134
  return before === undefined || before.kind === "legacy" ? undefined : before.provider.kind;
133
135
  };
134
- let t10;
136
+ let t11;
135
137
  if ($[18] !== requirementOf) {
136
- t10 = entry_1 => entry_1.kind === "model" && requirementOf(entry_1) !== null ? [entry_1.provider.kind] : [];
138
+ t11 = entry_1 => entry_1.kind === "model" && requirementOf(entry_1) !== null ? [entry_1.provider.kind] : [];
137
139
  $[18] = requirementOf;
138
- $[19] = t10;
140
+ $[19] = t11;
139
141
  } else {
140
- t10 = $[19];
142
+ t11 = $[19];
141
143
  }
142
- const blockedKinds = new Set(entries.flatMap(t10));
143
- let t11;
144
+ const blockedKinds = new Set(entries.flatMap(t11));
145
+ let t12;
144
146
  if ($[20] !== onOpenChange) {
145
- t11 = next => {
147
+ t12 = next => {
146
148
  if (!next) {
147
149
  setQuery("");
148
150
  setLegacyOpen(false);
@@ -152,31 +154,31 @@ export function ModelPicker(t0) {
152
154
  onOpenChange(next);
153
155
  };
154
156
  $[20] = onOpenChange;
155
- $[21] = t11;
157
+ $[21] = t12;
156
158
  } else {
157
- t11 = $[21];
159
+ t12 = $[21];
158
160
  }
159
- const setOpen = t11;
160
- let t12;
161
+ const setOpen = t12;
162
+ let t13;
161
163
  if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
162
- t12 = () => {
164
+ t13 = () => {
163
165
  listRef.current?.querySelector("[data-active=\"true\"]")?.scrollIntoView({
164
166
  block: "nearest"
165
167
  });
166
168
  };
167
- $[22] = t12;
169
+ $[22] = t13;
168
170
  } else {
169
- t12 = $[22];
171
+ t13 = $[22];
170
172
  }
171
- let t13;
173
+ let t14;
172
174
  if ($[23] !== index) {
173
- t13 = [index];
175
+ t14 = [index];
174
176
  $[23] = index;
175
- $[24] = t13;
177
+ $[24] = t14;
176
178
  } else {
177
- t13 = $[24];
179
+ t14 = $[24];
178
180
  }
179
- useEffect(t12, t13);
181
+ useEffect(t13, t14);
180
182
  const choose = entry_2 => {
181
183
  if (!entry_2) {
182
184
  return;
@@ -220,23 +222,23 @@ export function ModelPicker(t0) {
220
222
  }
221
223
  }
222
224
  };
223
- let t14;
225
+ let t15;
224
226
  if ($[25] !== current || $[26] !== owner || $[27] !== t) {
225
- t14 = owner ? `${owner.name} · ${current}` : t("pickers.model.choose");
227
+ t15 = owner ? `${owner.name} · ${current}` : t("pickers.model.choose");
226
228
  $[25] = current;
227
229
  $[26] = owner;
228
230
  $[27] = t;
229
- $[28] = t14;
231
+ $[28] = t15;
230
232
  } else {
231
- t14 = $[28];
233
+ t15 = $[28];
232
234
  }
233
- const t15 = kbd ?? undefined;
234
- let t16;
235
- if ($[29] !== chip || $[30] !== current || $[31] !== provider || $[32] !== trigger) {
236
- t16 = trigger === "chip" ? /*#__PURE__*/_jsxs(Popover.Trigger, {
235
+ const t16 = kbd ?? undefined;
236
+ let t17;
237
+ if ($[29] !== chip || $[30] !== chipSize || $[31] !== current || $[32] !== provider || $[33] !== trigger) {
238
+ t17 = trigger === "chip" ? /*#__PURE__*/_jsxs(Popover.Trigger, {
237
239
  render: /*#__PURE__*/_jsx(Button, {
238
240
  variant: "secondary",
239
- size: "sm",
241
+ size: chipSize,
240
242
  className: "min-w-0 shrink gap-1.5"
241
243
  }),
242
244
  children: [chip.mark === "logo" ? /*#__PURE__*/_jsx(ProviderLogo, {
@@ -271,73 +273,74 @@ export function ModelPicker(t0) {
271
273
  })]
272
274
  });
273
275
  $[29] = chip;
274
- $[30] = current;
275
- $[31] = provider;
276
- $[32] = trigger;
277
- $[33] = t16;
276
+ $[30] = chipSize;
277
+ $[31] = current;
278
+ $[32] = provider;
279
+ $[33] = trigger;
280
+ $[34] = t17;
278
281
  } else {
279
- t16 = $[33];
282
+ t17 = $[34];
280
283
  }
281
- let t17;
282
- if ($[34] !== t14 || $[35] !== t15 || $[36] !== t16) {
283
- t17 = /*#__PURE__*/_jsx(Tooltip, {
284
- label: t14,
285
- kbd: t15,
286
- children: t16
284
+ let t18;
285
+ if ($[35] !== t15 || $[36] !== t16 || $[37] !== t17) {
286
+ t18 = /*#__PURE__*/_jsx(Tooltip, {
287
+ label: t15,
288
+ kbd: t16,
289
+ children: t17
287
290
  });
288
- $[34] = t14;
289
291
  $[35] = t15;
290
292
  $[36] = t16;
291
293
  $[37] = t17;
294
+ $[38] = t18;
292
295
  } else {
293
- t17 = $[37];
296
+ t18 = $[38];
294
297
  }
295
- let t18;
296
- if ($[38] !== finalFocus) {
297
- t18 = finalFocus === undefined ? {} : {
298
+ let t19;
299
+ if ($[39] !== finalFocus) {
300
+ t19 = finalFocus === undefined ? {} : {
298
301
  finalFocus
299
302
  };
300
- $[38] = finalFocus;
301
- $[39] = t18;
303
+ $[39] = finalFocus;
304
+ $[40] = t19;
302
305
  } else {
303
- t18 = $[39];
306
+ t19 = $[40];
304
307
  }
305
- let t19;
306
- if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
307
- t19 = /*#__PURE__*/_jsx(Icon, {
308
+ let t20;
309
+ if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
310
+ t20 = /*#__PURE__*/_jsx(Icon, {
308
311
  icon: Search,
309
312
  size: 14,
310
313
  className: "shrink-0 text-text-faint"
311
314
  });
312
- $[40] = t19;
315
+ $[41] = t20;
313
316
  } else {
314
- t19 = $[40];
317
+ t20 = $[41];
315
318
  }
316
- let t20;
317
- if ($[41] !== t) {
318
- t20 = t("pickers.model.search");
319
- $[41] = t;
320
- $[42] = t20;
319
+ let t21;
320
+ if ($[42] !== t) {
321
+ t21 = t("pickers.model.search");
322
+ $[42] = t;
323
+ $[43] = t21;
321
324
  } else {
322
- t20 = $[42];
325
+ t21 = $[43];
323
326
  }
324
- let t21;
325
- if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
326
- t21 = e_0 => {
327
+ let t22;
328
+ if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
329
+ t22 = e_0 => {
327
330
  setQuery(e_0.target.value);
328
331
  setIndex(0);
329
332
  };
330
- $[43] = t21;
333
+ $[44] = t22;
331
334
  } else {
332
- t21 = $[43];
335
+ t22 = $[44];
333
336
  }
334
- const t22 = "max-h-72 overflow-auto p-1";
335
- const t23 = "listbox";
336
- const t24 = entries.length === 0 && /*#__PURE__*/_jsx("div", {
337
+ const t23 = "max-h-72 overflow-auto p-1";
338
+ const t24 = "listbox";
339
+ const t25 = entries.length === 0 && /*#__PURE__*/_jsx("div", {
337
340
  className: "px-3 py-6 text-center text-xs text-text-faint",
338
341
  children: providers.length === 0 ? t("pickers.model.noProvider") : t("pickers.model.noMatch")
339
342
  });
340
- const t25 = entries.map((entry_3, i_2) => {
343
+ const t26 = entries.map((entry_3, i_2) => {
341
344
  if (entry_3.kind === "all") {
342
345
  const before_0 = entries[i_2 - 1];
343
346
  const header = grouped && (before_0 === undefined || before_0.kind === "legacy" || before_0.provider.kind !== entry_3.provider.kind);
@@ -452,51 +455,51 @@ export function ModelPicker(t0) {
452
455
  })]
453
456
  }, `${entry_3.provider.kind}/${entry_3.model.slug}`);
454
457
  });
455
- let t26;
456
- if ($[44] !== t24 || $[45] !== t25) {
457
- t26 = /*#__PURE__*/_jsxs("div", {
458
+ let t27;
459
+ if ($[45] !== t25 || $[46] !== t26) {
460
+ t27 = /*#__PURE__*/_jsxs("div", {
458
461
  ref: listRef,
459
- className: t22,
460
- role: t23,
461
- children: [t24, t25]
462
+ className: t23,
463
+ role: t24,
464
+ children: [t25, t26]
462
465
  });
463
- $[44] = t24;
464
466
  $[45] = t25;
465
467
  $[46] = t26;
468
+ $[47] = t27;
466
469
  } else {
467
- t26 = $[46];
470
+ t27 = $[47];
468
471
  }
469
- let t27;
470
- if ($[47] !== footer) {
471
- t27 = footer !== undefined && /*#__PURE__*/_jsx("div", {
472
+ let t28;
473
+ if ($[48] !== footer) {
474
+ t28 = footer !== undefined && /*#__PURE__*/_jsx("div", {
472
475
  className: "border-t border-border-soft px-3 py-2 text-xs text-text-faint",
473
476
  children: footer
474
477
  });
475
- $[47] = footer;
476
- $[48] = t27;
478
+ $[48] = footer;
479
+ $[49] = t28;
477
480
  } else {
478
- t27 = $[48];
481
+ t28 = $[49];
479
482
  }
480
483
  return /*#__PURE__*/_jsxs(Popover.Root, {
481
484
  open: open,
482
485
  onOpenChange: setOpen,
483
- children: [t17, /*#__PURE__*/_jsxs(Popover.Popup, {
486
+ children: [t18, /*#__PURE__*/_jsxs(Popover.Popup, {
484
487
  variant: "picker",
485
488
  side: side,
486
489
  initialFocus: inputRef,
487
- ...t18,
490
+ ...t19,
488
491
  children: [/*#__PURE__*/_jsxs("div", {
489
492
  className: "flex items-center gap-2 border-b border-border px-2.5",
490
- children: [t19, /*#__PURE__*/_jsx("input", {
493
+ children: [t20, /*#__PURE__*/_jsx("input", {
491
494
  ref: inputRef,
492
495
  className: "h-8 w-full bg-transparent text-sm text-text outline-none placeholder:text-text-faint",
493
- placeholder: t20,
496
+ placeholder: t21,
494
497
  spellCheck: false,
495
498
  value: query,
496
- onChange: t21,
499
+ onChange: t22,
497
500
  onKeyDown: onKeyDown
498
501
  })]
499
- }), t26, t27]
502
+ }), t27, t28]
500
503
  })]
501
504
  });
502
505
  }
@@ -0,0 +1,19 @@
1
+ import type { ChatSkill } from '@adecore/agent-contracts';
2
+ import type { Referables } from '../chat-references.js';
3
+ import { type PromptDraft } from './composer/use-prompt-menus.js';
4
+ interface PromptEditorProps {
5
+ value: PromptDraft;
6
+ onChange(next: PromptDraft): void;
7
+ label: string;
8
+ placeholder: string;
9
+ skills: readonly ChatSkill[];
10
+ slashCommands?: readonly string[];
11
+ goals?: boolean;
12
+ cwd: string | null;
13
+ referables: Referables;
14
+ providerName?: string;
15
+ disabled?: boolean;
16
+ className?: string;
17
+ }
18
+ export declare function PromptEditor({ value, onChange, label, placeholder, skills, slashCommands, goals, cwd, referables, providerName, disabled, className }: PromptEditorProps): import("react").JSX.Element;
19
+ export {};
@@ -0,0 +1,115 @@
1
+ import { useLayoutEffect, useRef } from 'react';
2
+ import clsx from 'clsx';
3
+ import { Surface } from '@adecore/ui';
4
+ import { ComposerInput } from './ComposerInput.js';
5
+ import { chipDecorations } from './composer/chips.js';
6
+ import { ComposerMenu } from './composer/ComposerMenu.js';
7
+ import { pickInMenu } from './composer/key-handler.js';
8
+ import { usePromptMenus } from './composer/use-prompt-menus.js';
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ const NO_COMMANDS = [];
11
+ /*
12
+ * A prompt written now and sent later, as a form field: the composer's editor with its pickers and chips,
13
+ * without a chat behind it. The host hands in what the CLI it goes to has, and keeps what was picked.
14
+ */
15
+ export function PromptEditor({
16
+ value,
17
+ onChange,
18
+ label,
19
+ placeholder,
20
+ skills,
21
+ slashCommands = NO_COMMANDS,
22
+ goals = false,
23
+ cwd,
24
+ referables,
25
+ providerName,
26
+ disabled = false,
27
+ className
28
+ }) {
29
+ const inputRef = useRef(null);
30
+ // A pick writes twice in one event (the text, then what it picked), and the second must build on the first.
31
+ const latest = useRef(value);
32
+ useLayoutEffect(() => {
33
+ latest.current = value;
34
+ }, [value]);
35
+ const setDraft = action => {
36
+ const next = typeof action === 'function' ? action(latest.current) : action;
37
+ latest.current = next;
38
+ onChange(next);
39
+ };
40
+ const setText = (next_0, mentions = value.mentions, chosen = value.skills) => {
41
+ setDraft(current => ({
42
+ ...current,
43
+ text: next_0,
44
+ mentions,
45
+ skills: chosen
46
+ }));
47
+ };
48
+ const menus = usePromptMenus({
49
+ draft: {
50
+ draft: value,
51
+ setDraft,
52
+ setText
53
+ },
54
+ inputRef,
55
+ cwd,
56
+ skills,
57
+ slashCommands,
58
+ goals,
59
+ providerName,
60
+ referables,
61
+ label
62
+ });
63
+ const extensions = chipDecorations({
64
+ mentions: value.mentions,
65
+ skills: value.skills,
66
+ references: menus.referenceChips
67
+ });
68
+ const onKeyDown = e => {
69
+ if (e.isComposing) {
70
+ return false;
71
+ }
72
+ // Escape closes the picker, and only that: the dialog around the field stays.
73
+ if (e.key === 'Escape' && menus.menuOpen) {
74
+ menus.close();
75
+ e.stopPropagation();
76
+ return true;
77
+ }
78
+ // Enter adds a line here rather than sending, so on a command it completes like Tab.
79
+ if (e.key === 'Enter' && menus.commandMenuOpen) {
80
+ menus.completeCommand(menus.commands[menus.activeIndex]);
81
+ return true;
82
+ }
83
+ return pickInMenu(e, menus);
84
+ };
85
+ return /*#__PURE__*/_jsxs("div", {
86
+ className: clsx('relative', className),
87
+ children: [menus.menuOpen && /*#__PURE__*/_jsx(Surface, {
88
+ className: "absolute inset-x-0 top-full z-50 mt-1 overflow-hidden rounded-lg bg-clip-padding *:border-b-0",
89
+ children: /*#__PURE__*/_jsx(ComposerMenu, {
90
+ menus: menus
91
+ })
92
+ }), /*#__PURE__*/_jsx("div", {
93
+ className: "field h-auto overflow-hidden p-0 focus-ring-within",
94
+ children: /*#__PURE__*/_jsx(ComposerInput, {
95
+ ref: inputRef,
96
+ dictationToolbar: null,
97
+ className: "composer-input prompt-editor select-text text-sm leading-normal text-text",
98
+ value: value.text,
99
+ placeholder: placeholder,
100
+ disabled: disabled,
101
+ tabbable: true,
102
+ extensions: extensions,
103
+ aria: menus.inputAria,
104
+ onChange: (text, selection, state) => {
105
+ setText(text);
106
+ menus.setMenuIndex(0);
107
+ menus.trackTriggers(text, selection, state);
108
+ },
109
+ onSelectionChange: menus.trackTriggers,
110
+ onBlur: menus.close,
111
+ onKeyDown: onKeyDown
112
+ })
113
+ })]
114
+ });
115
+ }
@@ -1,6 +1,7 @@
1
1
  import { type ReactNode } from 'react';
2
- export declare function Timeline({ chatId, composer, overlay }: {
2
+ export declare function Timeline({ chatId, composer, overlay, onContentHeight }: {
3
3
  chatId: string;
4
4
  composer?: ReactNode;
5
5
  overlay?: ReactNode;
6
+ onContentHeight?: (height: number) => void;
6
7
  }): import("react").JSX.Element;
@@ -388,11 +388,15 @@ const ThreadRow = memo(function ThreadRow(t0) {
388
388
  /*
389
389
  * `overlay` stands in the thread's place and ends where the composer starts, so the thread keeps
390
390
  * where it was underneath and the composer stays in reach for the prompts it answers.
391
+ * `onContentHeight` hears what the thread's rows and its padding take, without the composer, once
392
+ * the rows in view are laid out at their real heights, for a host that sizes its frame to the thread.
393
+ * Rows out of view still count at an estimate, so a frame up to the viewport's height gets it exact.
391
394
  */
392
395
  export function Timeline({
393
396
  chatId,
394
397
  composer,
395
- overlay
398
+ overlay,
399
+ onContentHeight
396
400
  }) {
397
401
  const host = useChatHost();
398
402
  const {
@@ -605,6 +609,14 @@ export function Timeline({
605
609
  setMeasuredThread(keyOf(chatId));
606
610
  }
607
611
  }, [initialLayout, empty, loadingHistory, frame.height, virtualRows, virtualizer, rows.length, keyOf, chatId]);
612
+ useLayoutEffect(() => {
613
+ const thread = threadRef.current;
614
+ if (onContentHeight === undefined || initialLayout || empty || loadingHistory || thread === null) {
615
+ return;
616
+ }
617
+ const style = getComputedStyle(thread);
618
+ onContentHeight(totalSize + (Number.parseFloat(style.paddingTop) || 0) + (Number.parseFloat(style.paddingBottom) || 0));
619
+ }, [onContentHeight, initialLayout, empty, loadingHistory, totalSize]);
608
620
  useLayoutEffect(() => {
609
621
  const element_2 = scrollRef.current;
610
622
  if (!followRef.current || element_2 === null) {