@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
@@ -3,11 +3,8 @@ import { isBlock } from '../../logic/timeline.js';
3
3
  /* Below this distance from the bottom a thread follows what the agent writes; above it the reader scrolled back on purpose. */
4
4
  export const FOLLOW_THRESHOLD_PX = 40;
5
5
  /*
6
- * The gaps a row wears for where it sits: a question is followed by its answer gap, and a seam where
7
- * the list rhythm of tool lines meets the block rhythm of prose gets the block gap. A visual and an
8
- * app's card have no margin of their own like prose does, so the row under one takes the block gap
9
- * too. A question already carries the gap before it, and the row after one is the answer, so neither
10
- * takes a seam.
6
+ * A seam where tool lines meet prose gets the block gap, and so does the row under a visual or an app's
7
+ * card, which have no margin of their own. A question and the answer after it never take a seam.
11
8
  */
12
9
  export function rowRhythm(row, previous) {
13
10
  const question = row.kind === 'user';
@@ -1,13 +1,9 @@
1
1
  /* The attributes of the root and the body an app switches its theme, its accent or its palette with. */
2
2
  const THEME_ATTRIBUTES = ['class', 'style', 'data-theme'];
3
3
  /*
4
- * Calls `changed` after the root of `owner` or its body changes a theme attribute, at most once a
5
- * frame, for whatever resolves the theme's tokens into colors of its own. A stylesheet that changes
6
- * changes no attribute, so an app that rewrites its palette that way touches the root's `style` as
7
- * well, the signal the terminal follows too. Returns what stops it.
8
- *
9
- * Any change of those attributes counts, also one that leaves every token as it was (a dialog that
10
- * locks the scroll writes the root's `style`), so a caller compares what it reads with what it drew.
4
+ * Calls `changed` at most once a frame after the root or body of `owner` changes a theme attribute. An app
5
+ * that rewrites its palette through a stylesheet touches the root's `style` as well, as the terminal expects.
6
+ * Any change counts, also one that leaves every token alone, so a caller compares what it reads with what it drew.
11
7
  */
12
8
  export function watchTheme(owner, changed) {
13
9
  const view = owner.defaultView ?? window;
@@ -1,6 +1,6 @@
1
1
  import type { ProviderPlatform } from '@adecore/agent-contracts';
2
2
  import { type Referables } from './chat/chat-references.js';
3
- import { type ChatHost, type CommandLook } from './host.js';
3
+ import { type ChatHost, type CommandLook, type ComposerSendAction } from './host.js';
4
4
  export declare function useHostCodeMode(): 'light' | 'dark';
5
5
  export declare function useHostCodeThemes(): {
6
6
  light: string;
@@ -25,6 +25,7 @@ export declare function useHostHidesFolder(...args: Parameters<ChatHost['useHide
25
25
  export declare function useHostWelcome(...args: Parameters<ChatHost['useWelcome']>): ReturnType<ChatHost['useWelcome']>;
26
26
  export declare function useHostResumeAtReset(...args: Parameters<ChatHost['useResumeAtReset']>): ReturnType<ChatHost['useResumeAtReset']>;
27
27
  export declare function useHostComposerPlaceholder(...args: Parameters<ChatHost['useComposerPlaceholder']>): ReturnType<ChatHost['useComposerPlaceholder']>;
28
+ export declare function useHostComposerSendActions(scopeId: string, chatId: string): readonly ComposerSendAction[];
28
29
  export declare function useHostThreadCards(...args: Parameters<ChatHost['useThreadCards']>): ReturnType<ChatHost['useThreadCards']>;
29
30
  export declare function useHostReplyAuthor(...args: Parameters<ChatHost['useReplyAuthor']>): ReturnType<ChatHost['useReplyAuthor']>;
30
31
  export declare function useHostMapSource(maps: NonNullable<ChatHost['maps']>, scopeId: string): ReturnType<NonNullable<ChatHost['maps']>['useSource']>;
@@ -71,6 +71,12 @@ export function useHostResumeAtReset(...args) {
71
71
  export function useHostComposerPlaceholder(...args) {
72
72
  return useChatHost().useComposerPlaceholder(...args);
73
73
  }
74
+ const NO_SEND_ACTIONS = [];
75
+ const noSendActions = () => NO_SEND_ACTIONS;
76
+ export function useHostComposerSendActions(scopeId, chatId) {
77
+ const useSendActions = useChatHost().useComposerSendActions ?? noSendActions;
78
+ return useSendActions(scopeId, chatId);
79
+ }
74
80
  export function useHostThreadCards(...args) {
75
81
  return useChatHost().useThreadCards(...args);
76
82
  }
package/dist/host.d.ts CHANGED
@@ -4,7 +4,7 @@ import type { EditorView } from '@codemirror/view';
4
4
  import type { Highlighter, ThemeRegistration } from 'shiki';
5
5
  import type { LucideIcon } from 'lucide-react';
6
6
  import type { EditorEngine } from '@adecore/editor';
7
- import type { AgentKind, ChatAttachment, ChatCheckpointDiff, ChatConfigurePayload, ChatGoalAction, ChatItem, ChatSubagentItem, ChatUiChoicePayload, ChatUiQueryPayload, ChatUiQueryReading, ChatUiLinkPayload, ChatUiLinkReading, ChatVisual, ProviderPlatform } from '@adecore/agent-contracts';
7
+ import type { AgentKind, ChatAttachment, ChatCheckpointDiff, ChatConfigurePayload, ChatGoalAction, ChatItem, ChatSubagentItem, ChatUiChoicePayload, ChatUiQueryPayload, ChatUiQueryReading, ChatUiLinkPayload, ChatUiLinkReading, ChatVisual, ModelSelection, ProviderPlatform, RuntimeMode } from '@adecore/agent-contracts';
8
8
  import type { Referables } from './chat/chat-references.js';
9
9
  import type { TimelineRow } from './chat/logic/timeline.js';
10
10
  import type { FindReveal } from './chat/ui/find-reveal.js';
@@ -110,6 +110,21 @@ export interface ComposerSlotProps {
110
110
  disabled: boolean;
111
111
  insert(text: string): void;
112
112
  }
113
+ export interface ComposerSendDraft {
114
+ scopeId: string;
115
+ chatId: string;
116
+ text: string;
117
+ provider: AgentKind;
118
+ selection: ModelSelection;
119
+ runtimeMode: RuntimeMode;
120
+ }
121
+ export interface ComposerSendAction {
122
+ id: string;
123
+ label: string;
124
+ icon?: LucideIcon;
125
+ disabled?: boolean;
126
+ run(draft: ComposerSendDraft): void;
127
+ }
113
128
  export interface SubagentSlotProps {
114
129
  chatId: string;
115
130
  items: readonly ChatSubagentItem[];
@@ -290,6 +305,7 @@ export interface ChatHost {
290
305
  useResumeAtReset(scopeId: string): boolean;
291
306
  useComposerPlaceholder(scopeId: string, chatId: string): string | null;
292
307
  ComposerSlot: ComponentType<ComposerSlotProps> | null;
308
+ useComposerSendActions?(scopeId: string, chatId: string): readonly ComposerSendAction[];
293
309
  SubagentSlot: ComponentType<SubagentSlotProps> | null;
294
310
  useThreadCards(scopeId: string, chatId: string): readonly ThreadCard[];
295
311
  useReplyAuthor(scopeId: string, chatId: string): ReplyAuthor | null;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { type ChatActions, type FileRef, type ShellCodeBlockContext, type ChatPlace, type SubagentTask, type TimelineFindOptions, type TimelineFind, type ComposerDictationProps, type ComposerSlotProps, type SubagentSlotProps, type ThreadCard, type VisualHost, type HostMenuAction, type ReplyAuthor, type ChatHost, type UiMapSource, type UiModelViewProps, type CommandLook, type CommandLookMatch, type CommandName, ChatHostProvider, useChatHost, type AccentChoice, type ChatToast, type TextareaProps, type ResourceUrl } from './host.js';
1
+ export { type ChatActions, type FileRef, type ShellCodeBlockContext, type ChatPlace, type SubagentTask, type TimelineFindOptions, type TimelineFind, type ComposerDictationProps, type ComposerSlotProps, type ComposerSendAction, type ComposerSendDraft, type SubagentSlotProps, type ThreadCard, type VisualHost, type HostMenuAction, type ReplyAuthor, type ChatHost, type UiMapSource, type UiModelViewProps, type CommandLook, type CommandLookMatch, type CommandName, ChatHostProvider, useChatHost, type AccentChoice, type ChatToast, type TextareaProps, type ResourceUrl } from './host.js';
2
2
  export { type ChatScope, ChatScopeContext, useChatScope } from './scope.js';
3
3
  export { type ChatRequestMap, type ChatEventMap, type ChatTransportStatus, type ChatTransport, ChatTransportError, errorCode, isConnectionError } from './transport.js';
4
4
  export { portTransport, type PortTransport } from './port-transport.js';
@@ -391,6 +391,7 @@ declare const _default: {
391
391
  continue: string;
392
392
  continueHint: string;
393
393
  send: string;
394
+ sendActions: string;
394
395
  clear: {
395
396
  title: string;
396
397
  description: string;
@@ -391,6 +391,7 @@ export default {
391
391
  continue: 'Continue',
392
392
  continueHint: 'Continue the stopped turn',
393
393
  send: 'Send',
394
+ sendActions: 'More send options',
394
395
  clear: {
395
396
  title: 'Clear thread?',
396
397
  description: 'A turn is running.',
@@ -391,6 +391,7 @@ declare const _default: {
391
391
  continue: string;
392
392
  continueHint: string;
393
393
  send: string;
394
+ sendActions: string;
394
395
  clear: {
395
396
  title: string;
396
397
  description: string;
@@ -391,6 +391,7 @@ export default {
391
391
  continue: 'Doorgaan',
392
392
  continueHint: 'Ga verder met de gestopte beurt',
393
393
  send: 'Versturen',
394
+ sendActions: 'Meer verzendopties',
394
395
  clear: {
395
396
  title: 'Thread wissen?',
396
397
  description: 'Er loopt een turn.',
@@ -1,4 +1,5 @@
1
1
  import { useRef, useState } from 'react';
2
+ import { errorMessage } from '../../transport.js';
2
3
  import { emptyPromptDraft } from './prompts.js';
3
4
  /*
4
5
  * What answering a row of prompts needs besides the prompts: a draft per request that survives
@@ -59,7 +60,7 @@ export function usePromptSession({
59
60
  } catch (cause) {
60
61
  setError({
61
62
  id: id_1,
62
- message: cause instanceof Error ? cause.message : String(cause)
63
+ message: errorMessage(cause)
63
64
  });
64
65
  return 'failed';
65
66
  } finally {
@@ -11,6 +11,7 @@ import { DetailHeader, SettingsRow, SettingsSection } from '@adecore/ui/settings
11
11
  import { Button, FormError, Icon, Input } from '@adecore/ui';
12
12
  import { CliTile } from './parts.js';
13
13
  import { providerAccountsOf } from '../state/provider-accounts.js';
14
+ import { errorMessage } from '../transport.js';
14
15
  /*
15
16
  * A name and a color, asked before anything exists, so the account is made once with both. By default
16
17
  * the machine makes the folder; under Advanced a person points at a folder of their own instead.
@@ -60,7 +61,7 @@ export function AddAccountForm({
60
61
  onAdded(await createAccount(scope, provider.kind, label, color), label, true);
61
62
  }
62
63
  } catch (e) {
63
- setError(e instanceof Error ? e.message : String(e));
64
+ setError(errorMessage(e));
64
65
  setBusy(false);
65
66
  }
66
67
  };
@@ -5,14 +5,14 @@ import { AccountDot } from '../agents/AccountDot.js';
5
5
  import { ModelOptionControl } from '../agents/ModelOptionControl.js';
6
6
  import { carryOptions } from '../agents/model-options.js';
7
7
  import { optionWord } from '../agents/option-words.js';
8
- import { ACCOUNT_TONE_CLASSES, accountName, accountStatusLine } from '../agents/accounts.js';
8
+ import { ACCOUNT_TONE_CLASSES, accountName, accountStatusLine, offeredAccounts } from '../agents/accounts.js';
9
9
  import { accountFor, forgetChatSelection, rememberChatAccount, rememberChatSelection, selectionFor, useChatPreferences } from '../chat/preferences.js';
10
10
  import { useChatScope } from '../scope.js';
11
11
  import { providerAbilities } from './provider-abilities.js';
12
12
  import { DetailHeader, SettingsRow, SettingsSection } from '@adecore/ui/settings';
13
13
  import { Button, Icon, Select } from '@adecore/ui';
14
14
  import { CliTile } from './parts.js';
15
- import { useProviderAccountsStore } from '../state/provider-accounts.js';
15
+ import { knownAccounts, useProviderAccounts } from '../state/provider-accounts.js';
16
16
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
17
17
  const PROVIDER_DEFAULT = '';
18
18
  /* One row per knob the chosen model exposes; the composer's option picker shows the same descriptors. */
@@ -85,7 +85,7 @@ function ModelOptionRows(t0) {
85
85
  }
86
86
  /* One CLI: what it is, what a new chat of it starts with unless `defaults` is off, and its accounts. */
87
87
  export function CliDetail(t0) {
88
- const $ = _c(57);
88
+ const $ = _c(49);
89
89
  const {
90
90
  provider,
91
91
  entries,
@@ -129,75 +129,48 @@ export function CliDetail(t0) {
129
129
  t2 = $[5];
130
130
  }
131
131
  const model = t2;
132
+ const machineAccounts = useProviderAccounts(knownAccounts);
133
+ let canAddAccount;
132
134
  let t3;
133
- if ($[8] !== scopeId) {
134
- t3 = s => s.byScope[scopeId]?.loaded ? s.byScope[scopeId].accounts : undefined;
135
- $[8] = scopeId;
136
- $[9] = t3;
137
- } else {
138
- t3 = $[9];
139
- }
140
- const machineAccounts = useProviderAccountsStore(t3);
141
135
  let t4;
142
- if ($[10] !== machineAccounts || $[11] !== preferences || $[12] !== provider.kind || $[13] !== scopeId) {
143
- t4 = accountFor(preferences, scopeId, provider.kind, machineAccounts) ?? provider.kind;
144
- $[10] = machineAccounts;
145
- $[11] = preferences;
146
- $[12] = provider.kind;
147
- $[13] = scopeId;
148
- $[14] = t4;
149
- } else {
150
- t4 = $[14];
151
- }
152
- const picked = t4;
153
- let canAddAccount;
154
- let t5;
155
- let t6;
156
- if ($[15] !== defaults || $[16] !== entries || $[17] !== login || $[18] !== model || $[19] !== onAddAccount || $[20] !== picked || $[21] !== provider || $[22] !== scopeId || $[23] !== selection?.options || $[24] !== t) {
157
- let t7;
158
- if ($[28] !== picked) {
159
- t7 = entry_0 => entry_0.account.enabled !== false || entry_0.id === picked;
160
- $[28] = picked;
161
- $[29] = t7;
162
- } else {
163
- t7 = $[29];
164
- }
165
- const choosable = (entries ?? []).filter(t7);
136
+ if ($[8] !== defaults || $[9] !== entries || $[10] !== login || $[11] !== machineAccounts || $[12] !== model || $[13] !== onAddAccount || $[14] !== preferences || $[15] !== provider || $[16] !== scopeId || $[17] !== selection?.options || $[18] !== t) {
137
+ const picked = accountFor(preferences, scopeId, provider.kind, machineAccounts) ?? provider.kind;
138
+ const choosable = offeredAccounts(entries ?? [], picked);
166
139
  canAddAccount = login !== null;
167
- let t8;
168
- if ($[30] !== provider.kind) {
169
- t8 = /*#__PURE__*/_jsx(CliTile, {
140
+ let t5;
141
+ if ($[22] !== provider.kind) {
142
+ t5 = /*#__PURE__*/_jsx(CliTile, {
170
143
  kind: provider.kind
171
144
  });
172
- $[30] = provider.kind;
173
- $[31] = t8;
145
+ $[22] = provider.kind;
146
+ $[23] = t5;
174
147
  } else {
175
- t8 = $[31];
148
+ t5 = $[23];
176
149
  }
177
- const t9 = provider.name;
178
- let t10;
179
- if ($[32] !== provider.version || $[33] !== t) {
180
- t10 = provider.version ? `${t("abilities.version", {
150
+ const t6 = provider.name;
151
+ let t7;
152
+ if ($[24] !== provider.version || $[25] !== t) {
153
+ t7 = provider.version ? `${t("abilities.version", {
181
154
  version: provider.version
182
155
  })} ` : "";
183
- $[32] = provider.version;
184
- $[33] = t;
185
- $[34] = t10;
156
+ $[24] = provider.version;
157
+ $[25] = t;
158
+ $[26] = t7;
186
159
  } else {
187
- t10 = $[34];
160
+ t7 = $[26];
188
161
  }
189
- let t11;
190
- if ($[35] !== provider) {
191
- t11 = providerAbilities(provider);
192
- $[35] = provider;
193
- $[36] = t11;
162
+ let t8;
163
+ if ($[27] !== provider) {
164
+ t8 = providerAbilities(provider);
165
+ $[27] = provider;
166
+ $[28] = t8;
194
167
  } else {
195
- t11 = $[36];
168
+ t8 = $[28];
196
169
  }
197
- const t12 = `${t10}${t11}`;
198
- let t13;
199
- if ($[37] !== canAddAccount || $[38] !== onAddAccount || $[39] !== t) {
200
- t13 = canAddAccount && /*#__PURE__*/_jsxs(Button, {
170
+ const t9 = `${t7}${t8}`;
171
+ let t10;
172
+ if ($[29] !== canAddAccount || $[30] !== onAddAccount || $[31] !== t) {
173
+ t10 = canAddAccount && /*#__PURE__*/_jsxs(Button, {
201
174
  variant: "secondary",
202
175
  className: "whitespace-nowrap",
203
176
  onClick: onAddAccount,
@@ -206,29 +179,29 @@ export function CliDetail(t0) {
206
179
  size: 14
207
180
  }), t("cli.addAccount")]
208
181
  });
209
- $[37] = canAddAccount;
210
- $[38] = onAddAccount;
211
- $[39] = t;
212
- $[40] = t13;
182
+ $[29] = canAddAccount;
183
+ $[30] = onAddAccount;
184
+ $[31] = t;
185
+ $[32] = t10;
213
186
  } else {
214
- t13 = $[40];
187
+ t10 = $[32];
215
188
  }
216
- if ($[41] !== provider.name || $[42] !== t12 || $[43] !== t13 || $[44] !== t8) {
217
- t5 = /*#__PURE__*/_jsx(DetailHeader, {
218
- mark: t8,
219
- title: t9,
220
- subtitle: t12,
221
- actions: t13
189
+ if ($[33] !== provider.name || $[34] !== t10 || $[35] !== t5 || $[36] !== t9) {
190
+ t3 = /*#__PURE__*/_jsx(DetailHeader, {
191
+ mark: t5,
192
+ title: t6,
193
+ subtitle: t9,
194
+ actions: t10
222
195
  });
223
- $[41] = provider.name;
224
- $[42] = t12;
225
- $[43] = t13;
226
- $[44] = t8;
227
- $[45] = t5;
196
+ $[33] = provider.name;
197
+ $[34] = t10;
198
+ $[35] = t5;
199
+ $[36] = t9;
200
+ $[37] = t3;
228
201
  } else {
229
- t5 = $[45];
202
+ t3 = $[37];
230
203
  }
231
- t6 = defaults && /*#__PURE__*/_jsxs(SettingsSection, {
204
+ t4 = defaults && /*#__PURE__*/_jsxs(SettingsSection, {
232
205
  title: t("cli.defaults.title"),
233
206
  description: t("cli.defaults.description"),
234
207
  children: [choosable.length > 0 && /*#__PURE__*/_jsx(SettingsRow, {
@@ -240,11 +213,11 @@ export function CliDetail(t0) {
240
213
  provider: provider.name
241
214
  }),
242
215
  align: "end",
243
- items: choosable.map(entry_1 => ({
244
- value: entry_1.id,
245
- label: accountName(entry_1, provider.name),
216
+ items: choosable.map(entry_0 => ({
217
+ value: entry_0.id,
218
+ label: accountName(entry_0, provider.name),
246
219
  icon: /*#__PURE__*/_jsx(AccountDot, {
247
- color: entry_1.account.color,
220
+ color: entry_0.account.color,
248
221
  className: "size-2"
249
222
  })
250
223
  })),
@@ -265,15 +238,15 @@ export function CliDetail(t0) {
265
238
  items: [{
266
239
  value: PROVIDER_DEFAULT,
267
240
  label: t("cli.defaults.providerDefault")
268
- }, ...provider.models.map(entry_2 => ({
269
- value: entry_2.slug,
270
- label: entry_2.legacy ? t("cli.defaults.legacyModel", {
271
- name: entry_2.name
272
- }) : entry_2.name
241
+ }, ...provider.models.map(entry_1 => ({
242
+ value: entry_1.slug,
243
+ label: entry_1.legacy ? t("cli.defaults.legacyModel", {
244
+ name: entry_1.name
245
+ }) : entry_1.name
273
246
  }))],
274
247
  onValueChange: value => value === PROVIDER_DEFAULT ? forgetChatSelection(provider.kind) : rememberChatSelection(provider.kind, {
275
248
  model: value,
276
- options: carryOptions(selection?.options ?? {}, provider.models.find(entry_3 => entry_3.slug === value))
249
+ options: carryOptions(selection?.options ?? {}, provider.models.find(entry_2 => entry_2.slug === value))
277
250
  })
278
251
  })
279
252
  }), model && /*#__PURE__*/_jsx(ModelOptionRows, {
@@ -285,27 +258,28 @@ export function CliDetail(t0) {
285
258
  label: t("cli.defaults.usesCliDefault")
286
259
  })]
287
260
  });
288
- $[15] = defaults;
289
- $[16] = entries;
290
- $[17] = login;
291
- $[18] = model;
292
- $[19] = onAddAccount;
293
- $[20] = picked;
294
- $[21] = provider;
295
- $[22] = scopeId;
296
- $[23] = selection?.options;
297
- $[24] = t;
298
- $[25] = canAddAccount;
299
- $[26] = t5;
300
- $[27] = t6;
261
+ $[8] = defaults;
262
+ $[9] = entries;
263
+ $[10] = login;
264
+ $[11] = machineAccounts;
265
+ $[12] = model;
266
+ $[13] = onAddAccount;
267
+ $[14] = preferences;
268
+ $[15] = provider;
269
+ $[16] = scopeId;
270
+ $[17] = selection?.options;
271
+ $[18] = t;
272
+ $[19] = canAddAccount;
273
+ $[20] = t3;
274
+ $[21] = t4;
301
275
  } else {
302
- canAddAccount = $[25];
303
- t5 = $[26];
304
- t6 = $[27];
276
+ canAddAccount = $[19];
277
+ t3 = $[20];
278
+ t4 = $[21];
305
279
  }
306
- let t7;
307
- if ($[46] !== canAddAccount || $[47] !== entries || $[48] !== login || $[49] !== onPickAccount || $[50] !== provider.name || $[51] !== t) {
308
- t7 = entries === null ? /*#__PURE__*/_jsx("p", {
280
+ let t5;
281
+ if ($[38] !== canAddAccount || $[39] !== entries || $[40] !== login || $[41] !== onPickAccount || $[42] !== provider.name || $[43] !== t) {
282
+ t5 = entries === null ? /*#__PURE__*/_jsx("p", {
309
283
  className: "text-xs text-text-faint",
310
284
  children: t("list.noAccounts")
311
285
  }) : /*#__PURE__*/_jsx(SettingsSection, {
@@ -313,17 +287,17 @@ export function CliDetail(t0) {
313
287
  footer: canAddAccount ? undefined : t("cli.onlyDefault", {
314
288
  provider: provider.name
315
289
  }),
316
- children: entries.map(entry_4 => {
317
- const status = accountStatusLine(entry_4.status, login === "terminal");
290
+ children: entries.map(entry_3 => {
291
+ const status = accountStatusLine(entry_3.status, login === "terminal");
318
292
  return /*#__PURE__*/_jsxs("button", {
319
293
  type: "button",
320
294
  className: "flex w-full min-w-0 items-center gap-3 px-4.5 py-3 text-left first:rounded-t-xl last:rounded-b-xl hover:bg-surface-hover",
321
- onClick: () => onPickAccount(entry_4.id),
295
+ onClick: () => onPickAccount(entry_3.id),
322
296
  children: [/*#__PURE__*/_jsx(AccountDot, {
323
- color: entry_4.account.color
297
+ color: entry_3.account.color
324
298
  }), /*#__PURE__*/_jsx("span", {
325
299
  className: "min-w-0 grow truncate text-sm text-text",
326
- children: accountName(entry_4, provider.name)
300
+ children: accountName(entry_3, provider.name)
327
301
  }), /*#__PURE__*/_jsx("span", {
328
302
  className: `shrink-0 text-xs ${ACCOUNT_TONE_CLASSES[status.tone]}`,
329
303
  children: status.text
@@ -332,30 +306,30 @@ export function CliDetail(t0) {
332
306
  size: 14,
333
307
  className: "shrink-0 text-text-faint"
334
308
  })]
335
- }, entry_4.id);
309
+ }, entry_3.id);
336
310
  })
337
311
  });
338
- $[46] = canAddAccount;
339
- $[47] = entries;
340
- $[48] = login;
341
- $[49] = onPickAccount;
342
- $[50] = provider.name;
343
- $[51] = t;
344
- $[52] = t7;
312
+ $[38] = canAddAccount;
313
+ $[39] = entries;
314
+ $[40] = login;
315
+ $[41] = onPickAccount;
316
+ $[42] = provider.name;
317
+ $[43] = t;
318
+ $[44] = t5;
345
319
  } else {
346
- t7 = $[52];
320
+ t5 = $[44];
347
321
  }
348
- let t8;
349
- if ($[53] !== t5 || $[54] !== t6 || $[55] !== t7) {
350
- t8 = /*#__PURE__*/_jsxs(_Fragment, {
351
- children: [t5, t6, t7]
322
+ let t6;
323
+ if ($[45] !== t3 || $[46] !== t4 || $[47] !== t5) {
324
+ t6 = /*#__PURE__*/_jsxs(_Fragment, {
325
+ children: [t3, t4, t5]
352
326
  });
353
- $[53] = t5;
354
- $[54] = t6;
355
- $[55] = t7;
356
- $[56] = t8;
327
+ $[45] = t3;
328
+ $[46] = t4;
329
+ $[47] = t5;
330
+ $[48] = t6;
357
331
  } else {
358
- t8 = $[56];
332
+ t6 = $[48];
359
333
  }
360
- return t8;
334
+ return t6;
361
335
  }
@@ -1,12 +1,10 @@
1
1
  import i18next from 'i18next';
2
2
  import { accountFor, readChatPreferences, rememberChatAccount } from '../chat/preferences.js';
3
3
  import { providerAccountsOf, useProviderAccountsStore } from '../state/provider-accounts.js';
4
+ import { errorMessage } from '../transport.js';
4
5
  function words(key, values) {
5
6
  return i18next.t(`agent-providers:${key}`, values);
6
7
  }
7
- function reason(e) {
8
- return e instanceof Error ? e.message : String(e);
9
- }
10
8
  function linkTo(scope) {
11
9
  if (scope.transport.status !== 'open') {
12
10
  throw new Error(words('notAnswering'));
@@ -25,7 +23,7 @@ export async function saveAccounts(scope, host, accounts) {
25
23
  id: `providers-save-${scope.id}`,
26
24
  kind: 'error',
27
25
  title: words('account.saveFailed'),
28
- description: reason(e)
26
+ description: errorMessage(e)
29
27
  });
30
28
  return false;
31
29
  }
@@ -56,15 +54,14 @@ export async function removeAccount(scope, host, id, kind) {
56
54
  }
57
55
  /* An account in a folder the host makes for it; answers its id. Throws what the host said, for the form to show. */
58
56
  export async function createAccount(scope, kind, label, color) {
59
- const created = await linkTo(scope).request('accounts.create', {
57
+ const {
58
+ id,
59
+ ...accounts
60
+ } = await linkTo(scope).request('accounts.create', {
60
61
  kind,
61
62
  label,
62
63
  color
63
64
  });
64
- const {
65
- id,
66
- ...accounts
67
- } = created;
68
65
  useProviderAccountsStore.getState().set(scope.id, accounts);
69
66
  return id;
70
67
  }
@@ -1,5 +1,6 @@
1
1
  export { AccountDot } from '../agents/AccountDot.js';
2
2
  export { AgentIcon } from '../agents/AgentIcon.js';
3
+ export { AgentModelLabel } from '../agents/AgentModelLabel.js';
3
4
  export { ModelOptionControl } from '../agents/ModelOptionControl.js';
4
5
  export { ProviderLogo } from '../agents/ProviderLogo.js';
5
6
  export { type AccountEntry, accountsOfKind, ACCOUNT_TONE_CLASSES, accountStatusLine, canContinueOn, type AccountTone } from '../agents/accounts.js';
@@ -1,6 +1,7 @@
1
1
  // Public API: exports.test.ts snapshots this list, so a name added or dropped here is an API change.
2
2
  export { AccountDot } from '../agents/AccountDot.js';
3
3
  export { AgentIcon } from '../agents/AgentIcon.js';
4
+ export { AgentModelLabel } from '../agents/AgentModelLabel.js';
4
5
  export { ModelOptionControl } from '../agents/ModelOptionControl.js';
5
6
  export { ProviderLogo } from '../agents/ProviderLogo.js';
6
7
  export { accountsOfKind, ACCOUNT_TONE_CLASSES, accountStatusLine, canContinueOn } from '../agents/accounts.js';
@@ -43,6 +43,7 @@ interface ChatsStore {
43
43
  forget(key: string): void;
44
44
  forgetWhere(matches: (key: string) => boolean): void;
45
45
  }
46
+ export declare function isWaiting(item: ChatItem | undefined): item is ChatApprovalItem | ChatQuestionItem;
46
47
  export declare function prependPage(state: ChatState, cursor: string, page: ChatHistoryResult): ChatState;
47
48
  export declare function waitingRequestsOf(chat: Pick<ChatState, 'structure' | 'order' | 'waitingBefore'> | undefined): Array<ChatApprovalItem | ChatQuestionItem>;
48
49
  export declare function applyEvent(state: ChatState, event: ChatEvent): ChatState;
@@ -3,7 +3,7 @@ import { useContext } from 'react';
3
3
  import { create } from 'zustand';
4
4
  import { appendToolOutput } from '@adecore/agent-contracts/text';
5
5
  import { ChatScopeContext, useChatScope } from '../scope.js';
6
- function isWaiting(item) {
6
+ export function isWaiting(item) {
7
7
  return item?.kind === 'approval' && item.decision === 'pending' || item?.kind === 'question' && item.state === 'pending';
8
8
  }
9
9
  function stateOf(info, items, page) {
@@ -215,10 +215,7 @@ function applyUpdate(state, event, write) {
215
215
  text: item.text + event.text
216
216
  };
217
217
  // The first text is structure after all, since an empty reply that is not streaming has no row.
218
- if (item.text === '') {
219
- return write(state, grown);
220
- }
221
- return write(state, grown, false);
218
+ return write(state, grown, item.text === '');
222
219
  }
223
220
  if (item?.kind === 'tool' && item.state === 'running') {
224
221
  const progress = item.progress ?? {
@@ -226,14 +223,13 @@ function applyUpdate(state, event, write) {
226
223
  description: null,
227
224
  output: null
228
225
  };
229
- const grown = {
226
+ return write(state, {
230
227
  ...item,
231
228
  progress: {
232
229
  ...progress,
233
230
  output: appendToolOutput(progress.output, event.text)
234
231
  }
235
- };
236
- return write(state, grown, false);
232
+ }, false);
237
233
  }
238
234
  return state;
239
235
  }
@@ -338,9 +334,8 @@ export const useChats = create(set => ({
338
334
  });
339
335
  },
340
336
  /*
341
- * The status of a chat this window is not reading, which the host sends for every chat it has
342
- * loaded. The thread stays empty until somebody attaches, since this is what a header, a list and
343
- * the counters need, and they ask the info and never the items.
337
+ * The host sends this for every chat it has loaded. The thread stays empty until somebody attaches,
338
+ * since a header, a list and the counters read the info and never the items.
344
339
  */
345
340
  status(key, info) {
346
341
  set(s => {
@@ -1,5 +1,5 @@
1
1
  import type { ProviderAccounts } from '@adecore/agent-contracts';
2
- import type { ChatTransport } from '../transport.js';
2
+ import { type ChatTransport } from '../transport.js';
3
3
  export interface ProviderAccountsRow {
4
4
  accounts: ProviderAccounts | null;
5
5
  loaded: boolean;