@adecore/agents-react 0.23.1 → 0.24.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 (341) hide show
  1. package/README.md +14 -11
  2. package/dist/agents/AccountDot.js +3 -1
  3. package/dist/agents/accounts.d.ts +3 -2
  4. package/dist/agents/accounts.js +5 -6
  5. package/dist/chat/actions.d.ts +2 -2
  6. package/dist/chat/actions.js +8 -5
  7. package/dist/chat/bookmarks.d.ts +5 -3
  8. package/dist/chat/bookmarks.js +13 -14
  9. package/dist/chat/chat-client.d.ts +1 -0
  10. package/dist/chat/chat-client.js +7 -0
  11. package/dist/chat/composer-send.d.ts +3 -0
  12. package/dist/chat/composer-send.js +22 -0
  13. package/dist/chat/forks.js +22 -5
  14. package/dist/chat/index.d.ts +31 -0
  15. package/dist/chat/index.js +28 -0
  16. package/dist/chat/logic/embedded-code.d.ts +8 -0
  17. package/dist/chat/logic/embedded-code.js +371 -0
  18. package/dist/chat/logic/fork.js +1 -0
  19. package/dist/chat/logic/goal.d.ts +6 -0
  20. package/dist/chat/logic/goal.js +26 -0
  21. package/dist/chat/logic/scrubber.d.ts +1 -1
  22. package/dist/chat/logic/scrubber.js +6 -5
  23. package/dist/chat/logic/thought.d.ts +3 -0
  24. package/dist/chat/logic/thought.js +35 -0
  25. package/dist/chat/logic/thread-cards.js +2 -0
  26. package/dist/chat/logic/timeline.d.ts +5 -0
  27. package/dist/chat/logic/timeline.js +22 -1
  28. package/dist/chat/logic/tool-catalog.d.ts +1 -0
  29. package/dist/chat/logic/tool-catalog.js +3 -1
  30. package/dist/chat/logic/tools.d.ts +14 -0
  31. package/dist/chat/logic/tools.js +57 -0
  32. package/dist/chat/preferences.d.ts +6 -0
  33. package/dist/chat/preferences.js +19 -3
  34. package/dist/chat/reading-width.d.ts +9 -0
  35. package/dist/chat/reading-width.js +27 -0
  36. package/dist/chat/send-key.d.ts +10 -0
  37. package/dist/chat/send-key.js +24 -0
  38. package/dist/chat/ui/BookmarkMarker.js +4 -2
  39. package/dist/chat/ui/BookmarkSubmenu.js +4 -3
  40. package/dist/chat/ui/ChatActivity.js +14 -10
  41. package/dist/chat/ui/ChatReferenceChip.js +3 -4
  42. package/dist/chat/ui/CodeBlock.d.ts +2 -1
  43. package/dist/chat/ui/CodeBlock.js +14 -96
  44. package/dist/chat/ui/Composer.d.ts +1 -1
  45. package/dist/chat/ui/Composer.js +117 -906
  46. package/dist/chat/ui/ComposerInput.js +5 -4
  47. package/dist/chat/ui/EditDiff.js +3 -2
  48. package/dist/chat/ui/GoalDock.d.ts +9 -0
  49. package/dist/chat/ui/GoalDock.js +63 -0
  50. package/dist/chat/ui/LimitState.js +5 -3
  51. package/dist/chat/ui/Markdown.d.ts +2 -1
  52. package/dist/chat/ui/Markdown.js +70 -31
  53. package/dist/chat/ui/MermaidBlock.d.ts +3 -0
  54. package/dist/chat/ui/MermaidBlock.js +73 -0
  55. package/dist/chat/ui/MessageActions.js +12 -7
  56. package/dist/chat/ui/Pickers.js +6 -5
  57. package/dist/chat/ui/PromptComposer.js +4 -3
  58. package/dist/chat/ui/RowTime.d.ts +3 -0
  59. package/dist/chat/ui/RowTime.js +12 -0
  60. package/dist/chat/ui/RunSettings.js +5 -4
  61. package/dist/chat/ui/ShellCommand.d.ts +3 -0
  62. package/dist/chat/ui/ShellCommand.js +110 -0
  63. package/dist/chat/ui/SubagentInfo.js +4 -3
  64. package/dist/chat/ui/SubagentStopButton.js +4 -3
  65. package/dist/chat/ui/SubagentTimeline.js +4 -1
  66. package/dist/chat/ui/Timeline.js +70 -40
  67. package/dist/chat/ui/TimelineMenu.d.ts +2 -1
  68. package/dist/chat/ui/TimelineMenu.js +18 -8
  69. package/dist/chat/ui/UnifiedDiff.js +3 -2
  70. package/dist/chat/ui/VisualFrame.js +6 -7
  71. package/dist/chat/ui/code-theme.d.ts +2 -1
  72. package/dist/chat/ui/code-theme.js +4 -4
  73. package/dist/chat/ui/composer/ComposerControls.d.ts +27 -0
  74. package/dist/chat/ui/composer/ComposerControls.js +34 -0
  75. package/dist/chat/ui/composer/ComposerMenu.d.ts +4 -0
  76. package/dist/chat/ui/composer/ComposerMenu.js +46 -0
  77. package/dist/chat/ui/composer/DraftParts.d.ts +18 -0
  78. package/dist/chat/ui/composer/DraftParts.js +25 -0
  79. package/dist/chat/ui/composer/QueuedMessages.d.ts +10 -0
  80. package/dist/chat/ui/composer/QueuedMessages.js +20 -0
  81. package/dist/chat/ui/composer/key-handler.d.ts +20 -0
  82. package/dist/chat/ui/composer/key-handler.js +150 -0
  83. package/dist/chat/ui/composer/keys.d.ts +7 -2
  84. package/dist/chat/ui/composer/keys.js +19 -9
  85. package/dist/chat/ui/composer/placeholder.d.ts +9 -0
  86. package/dist/chat/ui/composer/placeholder.js +38 -0
  87. package/dist/chat/ui/composer/use-chat-controls.d.ts +28 -0
  88. package/dist/chat/ui/composer/use-chat-controls.js +112 -0
  89. package/dist/chat/ui/composer/use-compaction-offer.d.ts +2 -0
  90. package/dist/chat/ui/composer/use-compaction-offer.js +23 -0
  91. package/dist/chat/ui/composer/use-composer-draft.d.ts +14 -0
  92. package/dist/chat/ui/composer/use-composer-draft.js +39 -0
  93. package/dist/chat/ui/composer/use-composer-menus.d.ts +52 -0
  94. package/dist/chat/ui/composer/use-composer-menus.js +232 -0
  95. package/dist/chat/ui/composer/use-composer-submit.d.ts +32 -0
  96. package/dist/chat/ui/composer/use-composer-submit.js +113 -0
  97. package/dist/chat/ui/composer/use-draft-files.d.ts +27 -0
  98. package/dist/chat/ui/composer/use-draft-files.js +111 -0
  99. package/dist/chat/ui/composer/use-notice.d.ts +6 -0
  100. package/dist/chat/ui/composer/use-notice.js +18 -0
  101. package/dist/chat/ui/composer/use-pending-requests.d.ts +2 -0
  102. package/dist/chat/ui/composer/use-pending-requests.js +22 -0
  103. package/dist/chat/ui/composer/use-prompt-history.d.ts +8 -0
  104. package/dist/chat/ui/composer/use-prompt-history.js +57 -0
  105. package/dist/chat/ui/composer/use-prompt-hold.d.ts +6 -0
  106. package/dist/chat/ui/composer/use-prompt-hold.js +48 -0
  107. package/dist/chat/ui/composer/use-take-back.d.ts +13 -0
  108. package/dist/chat/ui/composer/use-take-back.js +82 -0
  109. package/dist/chat/ui/diff/EditorEditDiff.js +4 -3
  110. package/dist/chat/ui/diff/LegacyDiffPool.js +3 -2
  111. package/dist/chat/ui/diff/LegacyEditDiff.js +3 -2
  112. package/dist/chat/ui/diff/LegacyUnifiedDiff.js +3 -2
  113. package/dist/chat/ui/diff/syntax-runtime.d.ts +2 -1
  114. package/dist/chat/ui/diff/syntax-runtime.js +9 -5
  115. package/dist/chat/ui/diff-syntax.d.ts +2 -2
  116. package/dist/chat/ui/diff-syntax.js +1 -2
  117. package/dist/chat/ui/diff-theme.js +10 -9
  118. package/dist/chat/ui/file-links.d.ts +1 -1
  119. package/dist/chat/ui/file-links.js +7 -5
  120. package/dist/chat/ui/highlighter.d.ts +27 -0
  121. package/dist/chat/ui/highlighter.js +151 -0
  122. package/dist/chat/ui/index.d.ts +67 -0
  123. package/dist/chat/ui/index.js +64 -0
  124. package/dist/chat/ui/intelligent-ui/UiReply.js +3 -2
  125. package/dist/chat/ui/intelligent-ui/renderers/content.js +3 -2
  126. package/dist/chat/ui/intelligent-ui/use-ui-links.js +2 -2
  127. package/dist/chat/ui/intelligent-ui/use-ui-queries.js +4 -3
  128. package/dist/chat/ui/markdown-blocks.d.ts +8 -0
  129. package/dist/chat/ui/markdown-blocks.js +260 -12
  130. package/dist/chat/ui/mermaid.d.ts +23 -0
  131. package/dist/chat/ui/mermaid.js +93 -0
  132. package/dist/chat/ui/rows/ForksRow.js +5 -3
  133. package/dist/chat/ui/rows/GeneratedImageRow.js +6 -4
  134. package/dist/chat/ui/rows/MessageRows.d.ts +4 -0
  135. package/dist/chat/ui/rows/MessageRows.js +36 -13
  136. package/dist/chat/ui/rows/Rows.js +3 -1
  137. package/dist/chat/ui/rows/SubagentRow.js +3 -2
  138. package/dist/chat/ui/rows/VisualRow.js +3 -2
  139. package/dist/chat/ui/rows/WorkRows.d.ts +6 -3
  140. package/dist/chat/ui/rows/WorkRows.js +57 -20
  141. package/dist/chat/ui/rows/WorkflowRow.js +3 -2
  142. package/dist/chat/ui/timestamp-format.d.ts +1 -0
  143. package/dist/chat/ui/timestamp-format.js +2 -0
  144. package/dist/chat/ui/use-diff-source-tokens.js +6 -3
  145. package/dist/chat/ui/visual-theme.js +3 -2
  146. package/dist/host.d.ts +9 -6
  147. package/dist/host.js +19 -8
  148. package/dist/index.d.ts +8 -0
  149. package/dist/index.js +9 -0
  150. package/dist/locales/en/agent-chat.d.ts +658 -0
  151. package/dist/locales/en/agent-chat.js +657 -0
  152. package/dist/locales/en/agent-prompts.d.ts +44 -0
  153. package/dist/locales/en/agent-prompts.js +43 -0
  154. package/dist/locales/en/agent-providers.d.ts +132 -0
  155. package/dist/locales/en/agent-providers.js +131 -0
  156. package/dist/locales/en/agent-usage.d.ts +132 -0
  157. package/dist/locales/en/agent-usage.js +131 -0
  158. package/dist/locales/nl/agent-chat.d.ts +658 -0
  159. package/dist/locales/nl/agent-chat.js +657 -0
  160. package/dist/locales/nl/agent-prompts.d.ts +44 -0
  161. package/dist/locales/nl/agent-prompts.js +43 -0
  162. package/dist/locales/nl/agent-providers.d.ts +132 -0
  163. package/dist/locales/nl/agent-providers.js +131 -0
  164. package/dist/locales/nl/agent-usage.d.ts +132 -0
  165. package/dist/locales/nl/agent-usage.js +131 -0
  166. package/dist/locales.js +9 -8
  167. package/dist/prompts/index.d.ts +11 -0
  168. package/dist/prompts/index.js +12 -0
  169. package/dist/prompts/logic/subjects.d.ts +2 -1
  170. package/dist/prompts/logic/subjects.js +6 -4
  171. package/dist/prompts/ui/ApprovalBody.js +6 -4
  172. package/dist/prompts/ui/PromptCard.js +5 -4
  173. package/dist/prompts/ui/PromptView.js +3 -2
  174. package/dist/prompts/ui/QuestionBody.js +3 -2
  175. package/dist/providers/AccountColors.js +2 -2
  176. package/dist/providers/AccountDetail.js +7 -6
  177. package/dist/providers/AccountVariables.js +3 -1
  178. package/dist/providers/AddAccountForm.js +3 -2
  179. package/dist/providers/ProvidersPane.js +4 -3
  180. package/dist/providers/account-actions.d.ts +4 -3
  181. package/dist/providers/account-actions.js +6 -7
  182. package/dist/providers/index.d.ts +16 -0
  183. package/dist/providers/index.js +17 -0
  184. package/dist/providers/provider-abilities.d.ts +2 -1
  185. package/dist/providers/provider-abilities.js +4 -0
  186. package/dist/state/chats.js +4 -2
  187. package/dist/state/index.d.ts +4 -0
  188. package/dist/state/index.js +5 -0
  189. package/dist/testing/index.d.ts +1 -0
  190. package/dist/testing/index.js +2 -0
  191. package/dist/{prompts/logic/prompts.fixtures.d.ts → testing/prompts.d.ts} +1 -1
  192. package/dist/theme.css +13 -3
  193. package/dist/usage/UsageBreakdown.js +3 -2
  194. package/dist/usage/UsageLimits.js +4 -3
  195. package/dist/usage/UsagePage.js +3 -2
  196. package/dist/usage/index.d.ts +15 -0
  197. package/dist/usage/index.js +15 -0
  198. package/package.json +53 -1031
  199. package/src/agents/AccountDot.tsx +3 -1
  200. package/src/agents/accounts.ts +6 -6
  201. package/src/chat/actions.ts +8 -5
  202. package/src/chat/bookmarks.ts +23 -14
  203. package/src/chat/chat-client.ts +8 -0
  204. package/src/chat/composer-send.ts +27 -0
  205. package/src/chat/forks.ts +27 -6
  206. package/src/chat/index.ts +98 -0
  207. package/src/chat/logic/embedded-code.ts +409 -0
  208. package/src/chat/logic/fork.ts +1 -0
  209. package/src/chat/logic/goal.ts +33 -0
  210. package/src/chat/logic/scrubber.ts +6 -5
  211. package/src/chat/logic/thought.ts +40 -0
  212. package/src/chat/logic/thread-cards.ts +2 -0
  213. package/src/chat/logic/timeline.ts +25 -1
  214. package/src/chat/logic/tool-catalog.ts +5 -1
  215. package/src/chat/logic/tools.ts +76 -0
  216. package/src/chat/preferences.ts +26 -3
  217. package/src/chat/reading-width.ts +39 -0
  218. package/src/chat/send-key.ts +38 -0
  219. package/src/chat/ui/BookmarkMarker.tsx +4 -2
  220. package/src/chat/ui/BookmarkSubmenu.tsx +4 -3
  221. package/src/chat/ui/ChatActivity.tsx +14 -10
  222. package/src/chat/ui/ChatReferenceChip.tsx +3 -4
  223. package/src/chat/ui/CodeBlock.tsx +33 -124
  224. package/src/chat/ui/Composer.tsx +162 -1324
  225. package/src/chat/ui/ComposerInput.tsx +5 -4
  226. package/src/chat/ui/EditDiff.tsx +3 -2
  227. package/src/chat/ui/GoalDock.tsx +104 -0
  228. package/src/chat/ui/LimitState.tsx +5 -3
  229. package/src/chat/ui/Markdown.tsx +113 -39
  230. package/src/chat/ui/MermaidBlock.tsx +119 -0
  231. package/src/chat/ui/MessageActions.tsx +13 -8
  232. package/src/chat/ui/Pickers.tsx +8 -7
  233. package/src/chat/ui/PromptComposer.tsx +4 -3
  234. package/src/chat/ui/RowTime.tsx +21 -0
  235. package/src/chat/ui/RunSettings.tsx +9 -4
  236. package/src/chat/ui/ShellCommand.tsx +134 -0
  237. package/src/chat/ui/SubagentInfo.tsx +4 -3
  238. package/src/chat/ui/SubagentStopButton.tsx +4 -3
  239. package/src/chat/ui/SubagentTimeline.tsx +5 -1
  240. package/src/chat/ui/Timeline.tsx +167 -105
  241. package/src/chat/ui/TimelineMenu.tsx +42 -7
  242. package/src/chat/ui/UnifiedDiff.tsx +3 -2
  243. package/src/chat/ui/VisualFrame.tsx +6 -7
  244. package/src/chat/ui/code-theme.ts +4 -4
  245. package/src/chat/ui/composer/ComposerControls.tsx +147 -0
  246. package/src/chat/ui/composer/ComposerMenu.tsx +138 -0
  247. package/src/chat/ui/composer/DraftParts.tsx +86 -0
  248. package/src/chat/ui/composer/QueuedMessages.tsx +64 -0
  249. package/src/chat/ui/composer/key-handler.ts +174 -0
  250. package/src/chat/ui/composer/keys.ts +32 -10
  251. package/src/chat/ui/composer/placeholder.ts +48 -0
  252. package/src/chat/ui/composer/use-chat-controls.ts +134 -0
  253. package/src/chat/ui/composer/use-compaction-offer.ts +25 -0
  254. package/src/chat/ui/composer/use-composer-draft.ts +71 -0
  255. package/src/chat/ui/composer/use-composer-menus.ts +289 -0
  256. package/src/chat/ui/composer/use-composer-submit.ts +163 -0
  257. package/src/chat/ui/composer/use-draft-files.ts +135 -0
  258. package/src/chat/ui/composer/use-notice.ts +28 -0
  259. package/src/chat/ui/composer/use-pending-requests.ts +23 -0
  260. package/src/chat/ui/composer/use-prompt-history.ts +76 -0
  261. package/src/chat/ui/composer/use-prompt-hold.ts +58 -0
  262. package/src/chat/ui/composer/use-take-back.ts +91 -0
  263. package/src/chat/ui/diff/DiffFallbackBoundary.tsx +2 -2
  264. package/src/chat/ui/diff/EditorEditDiff.tsx +4 -3
  265. package/src/chat/ui/diff/LegacyDiffPool.tsx +3 -2
  266. package/src/chat/ui/diff/LegacyEditDiff.tsx +3 -2
  267. package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +3 -2
  268. package/src/chat/ui/diff/syntax-runtime.ts +10 -5
  269. package/src/chat/ui/diff-syntax.ts +2 -2
  270. package/src/chat/ui/diff-theme.ts +10 -9
  271. package/src/chat/ui/file-links.ts +7 -5
  272. package/src/chat/ui/highlighter.ts +185 -0
  273. package/src/chat/ui/index.ts +109 -0
  274. package/src/chat/ui/intelligent-ui/UiReply.tsx +5 -4
  275. package/src/chat/ui/intelligent-ui/renderers/content.tsx +3 -2
  276. package/src/chat/ui/intelligent-ui/use-ui-links.ts +2 -2
  277. package/src/chat/ui/intelligent-ui/use-ui-queries.ts +4 -3
  278. package/src/chat/ui/markdown-blocks.ts +300 -12
  279. package/src/chat/ui/mermaid.ts +118 -0
  280. package/src/chat/ui/rows/ForksRow.tsx +5 -3
  281. package/src/chat/ui/rows/GeneratedImageRow.tsx +6 -4
  282. package/src/chat/ui/rows/MessageRows.tsx +73 -18
  283. package/src/chat/ui/rows/Rows.tsx +14 -1
  284. package/src/chat/ui/rows/SubagentRow.tsx +3 -2
  285. package/src/chat/ui/rows/VisualRow.tsx +3 -2
  286. package/src/chat/ui/rows/WorkRows.tsx +148 -47
  287. package/src/chat/ui/rows/WorkflowRow.tsx +3 -2
  288. package/src/chat/ui/timestamp-format.ts +2 -0
  289. package/src/chat/ui/use-diff-source-tokens.ts +10 -4
  290. package/src/chat/ui/visual-theme.ts +3 -2
  291. package/src/host.ts +31 -15
  292. package/src/index.ts +49 -0
  293. package/src/locales/en/agent-chat.ts +657 -0
  294. package/src/locales/en/agent-prompts.ts +43 -0
  295. package/src/locales/en/agent-providers.ts +131 -0
  296. package/src/locales/en/agent-usage.ts +131 -0
  297. package/src/locales/nl/agent-chat.ts +657 -0
  298. package/src/locales/nl/agent-prompts.ts +43 -0
  299. package/src/locales/nl/agent-providers.ts +131 -0
  300. package/src/locales/nl/agent-usage.ts +132 -0
  301. package/src/locales.ts +9 -8
  302. package/src/prompts/index.ts +35 -0
  303. package/src/prompts/logic/subjects.ts +12 -4
  304. package/src/prompts/ui/ApprovalBody.tsx +6 -4
  305. package/src/prompts/ui/PromptCard.tsx +11 -4
  306. package/src/prompts/ui/PromptView.tsx +3 -2
  307. package/src/prompts/ui/QuestionBody.tsx +3 -2
  308. package/src/providers/AccountColors.tsx +2 -2
  309. package/src/providers/AccountDetail.tsx +13 -7
  310. package/src/providers/AccountVariables.tsx +3 -1
  311. package/src/providers/AddAccountForm.tsx +3 -2
  312. package/src/providers/ProvidersPane.tsx +4 -3
  313. package/src/providers/account-actions.ts +7 -7
  314. package/src/providers/index.ts +17 -0
  315. package/src/providers/provider-abilities.ts +6 -1
  316. package/src/state/chats.ts +4 -2
  317. package/src/state/index.ts +39 -0
  318. package/src/testing/index.ts +2 -0
  319. package/src/{prompts/logic/prompts.fixtures.ts → testing/prompts.ts} +1 -1
  320. package/src/theme.css +13 -3
  321. package/src/usage/UsageBreakdown.tsx +3 -2
  322. package/src/usage/UsageLimits.tsx +4 -3
  323. package/src/usage/UsagePage.tsx +3 -2
  324. package/src/usage/index.ts +16 -0
  325. package/dist/locales/en/agent-chat.json +0 -597
  326. package/dist/locales/en/agent-prompts.json +0 -43
  327. package/dist/locales/en/agent-providers.json +0 -131
  328. package/dist/locales/en/agent-usage.json +0 -131
  329. package/dist/locales/nl/agent-chat.json +0 -597
  330. package/dist/locales/nl/agent-prompts.json +0 -43
  331. package/dist/locales/nl/agent-providers.json +0 -131
  332. package/dist/locales/nl/agent-usage.json +0 -131
  333. package/src/locales/en/agent-chat.json +0 -597
  334. package/src/locales/en/agent-prompts.json +0 -43
  335. package/src/locales/en/agent-providers.json +0 -131
  336. package/src/locales/en/agent-usage.json +0 -131
  337. package/src/locales/nl/agent-chat.json +0 -597
  338. package/src/locales/nl/agent-prompts.json +0 -43
  339. package/src/locales/nl/agent-providers.json +0 -131
  340. package/src/locales/nl/agent-usage.json +0 -131
  341. /package/dist/{prompts/logic/prompts.fixtures.js → testing/prompts.js} +0 -0
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
4
4
  import { ChevronRight } from 'lucide-react';
5
5
  import type { ProviderInfo } from '@adecore/agent-contracts';
6
6
  import { freeAccountColor, mintAccountId, type AccountEntry } from '../agents/accounts';
7
- import { chatHost } from '../host';
7
+ import { useChatHost } from '../host';
8
8
  import { useChatScope } from '../scope';
9
9
  import { createAccount, linkAccount } from './account-actions';
10
10
  import { AccountColors } from './AccountColors';
@@ -28,8 +28,9 @@ interface AddAccountFormProps {
28
28
  export function AddAccountForm({ provider, entries, onCancel, onAdded }: AddAccountFormProps) {
29
29
  const { t } = useTranslation('agent-providers');
30
30
  const scope = useChatScope();
31
+ const { accents } = useChatHost();
31
32
  const [name, setName] = useState('');
32
- const [color, setColor] = useState<string>(() => freeAccountColor(entries, chatHost().accents.current()));
33
+ const [color, setColor] = useState<string>(() => freeAccountColor(entries, accents, accents.current()));
33
34
  const [advanced, setAdvanced] = useState(false);
34
35
  const [folder, setFolder] = useState('');
35
36
  const [busy, setBusy] = useState(false);
@@ -7,7 +7,7 @@ import { AccountDot } from '../agents/AccountDot';
7
7
  import { ACCOUNT_TONE_CLASSES, accountName, accountsOfKind, accountStatusLine, type AccountEntry } from '../agents/accounts';
8
8
  import { ErrorBoundary, Icon, IconButton, SectionLabel, Skeleton } from '@adecore/ui';
9
9
  import { MasterDetail } from '@adecore/ui/settings';
10
- import { chatHost } from '../host';
10
+ import { useChatHost } from '../host';
11
11
  import { useChatScope } from '../scope';
12
12
  import { AccountDetail } from './AccountDetail';
13
13
  import { AddAccountForm } from './AddAccountForm';
@@ -63,8 +63,9 @@ export function ProvidersPane({ target = null, detailOf, defaults = true }: Prov
63
63
  const providers = useProviders((s) => s.providers);
64
64
  const loaded = useProviders((s) => s.loaded);
65
65
  const accounts = useProviderAccounts((s) => s.accounts);
66
- const { openLogin } = chatHost();
67
- const loginBlocked = chatHost().useLoginBlocked(scopeId);
66
+ const host = useChatHost();
67
+ const { openLogin } = host;
68
+ const loginBlocked = host.useLoginBlocked(scopeId);
68
69
  const [picked, setPicked] = useState<Picked | null>(() => (target === 'providers.apple' ? { kind: 'cli', cli: 'apple' } : null));
69
70
 
70
71
  const installed = useMemo(() => providers.filter((provider) => provider.installed || provider.kind === 'apple'), [providers]);
@@ -1,7 +1,7 @@
1
1
  import i18next from 'i18next';
2
2
  import type { AgentKind, ProviderAccount, ProviderAccountMap } from '@adecore/agent-contracts';
3
3
  import { accountFor, readChatPreferences, rememberChatAccount } from '../chat/preferences';
4
- import { chatHost } from '../host';
4
+ import type { ChatHost } from '../host';
5
5
  import type { ChatScope } from '../scope';
6
6
  import { providerAccountsOf, useProviderAccountsStore } from '../state/provider-accounts';
7
7
  import type { ChatTransport } from '../transport';
@@ -22,29 +22,29 @@ function linkTo(scope: ChatScope): ChatTransport {
22
22
  }
23
23
 
24
24
  /* The whole map, as `accounts.save` takes it. Answers false when the host refused, which a toast then says. */
25
- export async function saveAccounts(scope: ChatScope, accounts: ProviderAccountMap): Promise<boolean> {
25
+ export async function saveAccounts(scope: ChatScope, host: Pick<ChatHost, 'notify'>, accounts: ProviderAccountMap): Promise<boolean> {
26
26
  try {
27
27
  useProviderAccountsStore.getState().set(scope.id, await linkTo(scope).request('accounts.save', { accounts }));
28
28
  return true;
29
29
  } catch (e) {
30
- chatHost().notify({ id: `providers-save-${scope.id}`, kind: 'error', title: words('account.saveFailed'), description: reason(e) });
30
+ host.notify({ id: `providers-save-${scope.id}`, kind: 'error', title: words('account.saveFailed'), description: reason(e) });
31
31
  return false;
32
32
  }
33
33
  }
34
34
 
35
35
  /* One account changed and every other one as the host last said. */
36
- export function saveAccount(scope: ChatScope, id: string, account: ProviderAccount): Promise<boolean> {
36
+ export function saveAccount(scope: ChatScope, host: Pick<ChatHost, 'notify'>, id: string, account: ProviderAccount): Promise<boolean> {
37
37
  const current = providerAccountsOf(scope.id).accounts?.accounts ?? {};
38
- return saveAccounts(scope, { ...current, [id]: account });
38
+ return saveAccounts(scope, host, { ...current, [id]: account });
39
39
  }
40
40
 
41
41
  /*
42
42
  * Forgets an account; its folder stays where it is. A pick for new agents that named it goes back to
43
43
  * the CLI's default account, since no chat started from it yet.
44
44
  */
45
- export async function removeAccount(scope: ChatScope, id: string, kind: AgentKind): Promise<void> {
45
+ export async function removeAccount(scope: ChatScope, host: Pick<ChatHost, 'notify'>, id: string, kind: AgentKind): Promise<void> {
46
46
  const { [id]: _gone, ...rest } = providerAccountsOf(scope.id).accounts?.accounts ?? {};
47
- if (!(await saveAccounts(scope, rest))) {
47
+ if (!(await saveAccounts(scope, host, rest))) {
48
48
  throw new Error(words('account.saveFailed'));
49
49
  }
50
50
  if (accountFor(readChatPreferences(), scope.id, kind) === id) {
@@ -0,0 +1,17 @@
1
+ // Public API: exports.test.ts snapshots this list, so a name added or dropped here is an API change.
2
+ export { AccountDot } from '../agents/AccountDot';
3
+ export { AgentIcon } from '../agents/AgentIcon';
4
+ export { ModelOptionControl } from '../agents/ModelOptionControl';
5
+ export { ProviderLogo } from '../agents/ProviderLogo';
6
+ export { type AccountEntry, accountsOfKind, accountName, ACCOUNT_TONE_CLASSES, accountStatusLine, canContinueOn, type AccountTone } from '../agents/accounts';
7
+ export { modelName, useModelName, shortModelName } from '../agents/model-name';
8
+ export { optionValue, carryOptions } from '../agents/model-options';
9
+ export { modelRequirementOf, type ModelRequirement } from '../agents/model-requirement';
10
+ export { AccountColors } from './AccountColors';
11
+ export { AccountDetail } from './AccountDetail';
12
+ export { AccountVariables } from './AccountVariables';
13
+ export { AddAccountForm } from './AddAccountForm';
14
+ export { CliDetail } from './CliDetail';
15
+ export { ProvidersPane } from './ProvidersPane';
16
+ export { saveAccounts, saveAccount, removeAccount, createAccount, linkAccount } from './account-actions';
17
+ export { CliMark, CliTile } from './parts';
@@ -1,5 +1,5 @@
1
1
  import i18next from 'i18next';
2
- import type { ProviderInfo } from '@adecore/agent-contracts';
2
+ import type { ProviderCapabilities, ProviderInfo } from '@adecore/agent-contracts';
3
3
 
4
4
  /* What a provider offers, in one sentence, where it can be opened and whether its hooks report status. */
5
5
  export function providerAbilities(provider: ProviderInfo): string {
@@ -7,3 +7,8 @@ export function providerAbilities(provider: ProviderInfo): string {
7
7
  const status = provider.capabilities.hooks ? i18next.t('agent-providers:abilities.reportsStatus') : i18next.t('agent-providers:abilities.noStatus');
8
8
  return `${where} ${status}`;
9
9
  }
10
+
11
+ /* Whether a message sent while a turn runs may join it. Undefined while the host has not answered `provider.list`, which steers nothing. */
12
+ export function canSteer(capabilities: ProviderCapabilities | undefined): boolean {
13
+ return capabilities?.steer === true;
14
+ }
@@ -11,6 +11,7 @@ import type {
11
11
  ChatQuestionItem,
12
12
  ChatVisual
13
13
  } from '@adecore/agent-contracts';
14
+ import { appendToolOutput } from '@adecore/agent-contracts/text';
14
15
  import { ChatScopeContext, useChatScope } from '../scope';
15
16
 
16
17
  export interface ChatState {
@@ -123,7 +124,8 @@ export function prependPage(state: ChatState, cursor: string, page: ChatHistoryR
123
124
  const olderIds = new Set(older.map((item) => item.id));
124
125
  const items = { ...state.items };
125
126
  for (const item of older) {
126
- items[item.id] = item;
127
+ // A request from before the page that this client already holds came in live, which is never older than the page.
128
+ items[item.id] = state.items[item.id] ?? item;
127
129
  }
128
130
  const order = [...olderIds, ...state.order];
129
131
  if (page.history.cursor === null) {
@@ -193,7 +195,7 @@ export function applyEvent(state: ChatState, event: ChatEvent): ChatState {
193
195
  }
194
196
  if (item?.kind === 'tool' && item.state === 'running') {
195
197
  const progress = item.progress ?? { startedAt: null, description: null, output: null };
196
- const grown = { ...item, progress: { ...progress, output: (progress.output ?? '') + event.text } };
198
+ const grown = { ...item, progress: { ...progress, output: appendToolOutput(progress.output, event.text) } };
197
199
  return { ...state, items: { ...state.items, [event.itemId]: grown } };
198
200
  }
199
201
  return state;
@@ -0,0 +1,39 @@
1
+ // Public API: exports.test.ts snapshots this list, so a name added or dropped here is an API change.
2
+ export {
3
+ type ChatState,
4
+ type ChatsById,
5
+ type ChatStatuses,
6
+ type ChatSink,
7
+ prependPage,
8
+ waitingRequestsOf,
9
+ applyEvent,
10
+ useChats,
11
+ chatSink,
12
+ useChatRow,
13
+ useReportedModels,
14
+ useCurrentItem,
15
+ type ChatHistoryPage,
16
+ type ChatPage
17
+ } from './chats';
18
+ export {
19
+ useProviderAccountsStore,
20
+ useProviderAccounts,
21
+ providerAccountsOf,
22
+ knownAccounts,
23
+ watchProviderAccounts,
24
+ type ProviderAccountsRow
25
+ } from './provider-accounts';
26
+ export { useProvidersStore, useProviders, providersOf, providerSinkFor, type ProvidersRow } from './providers';
27
+ export {
28
+ type UsageMetric,
29
+ USAGE_PREFERENCES_KEY,
30
+ usagePreferencesKey,
31
+ dayOf,
32
+ windowFor,
33
+ summaryPayload,
34
+ reloadUsagePreferences,
35
+ useUsageStore,
36
+ useUsage,
37
+ type UsagePeriod,
38
+ type UsageView
39
+ } from './usage';
@@ -0,0 +1,2 @@
1
+ // Public API: exports.test.ts snapshots this list, so a name added or dropped here is an API change.
2
+ export { PROMPT_SAMPLES } from './prompts';
@@ -1,5 +1,5 @@
1
1
  import type { ChatQuestion, ChatQuestionItem, ChatApprovalItem } from '@adecore/agent-contracts';
2
- import type { PendingPrompt } from './prompts';
2
+ import type { PendingPrompt } from '../prompts/logic/prompts';
3
3
 
4
4
  const endpoints: ChatQuestion = {
5
5
  id: 'endpoints',
package/src/theme.css CHANGED
@@ -91,13 +91,14 @@
91
91
  /*
92
92
  * A chat that is a view of its own reads in a column. The scroller keeps the full width of the
93
93
  * main column, so its scrollbar sits at that column's right edge and nothing jumps when the
94
- * thread grows past a screenful; only the rows and the composer inside it are centered.
94
+ * thread grows past a screenful; only the rows and the composer inside it are centered. The
95
+ * width is the person's reading width (`chat/reading-width.ts`).
95
96
  */
96
- .chat-column .chat-column-content { margin-inline: auto; max-width: 768px; }
97
+ .chat-column .chat-column-content { margin-inline: auto; max-width: var(--chat-measure, 768px); }
97
98
  /* Wide pages clear the scrubber even when the reply column needs no extra padding. */
98
99
  .chat-wide-content { max-width: calc(100% - 2 * var(--chat-wide-inset, 0px)); }
99
100
  /* Wider by the input's inset (`.composer-input .cm-content` padding plus the card's border), so what is typed lines up with the thread. */
100
- .chat-column .chat-composer-content { margin-inline: auto; max-width: calc(768px + 2 * 21px); }
101
+ .chat-column .chat-composer-content { margin-inline: auto; max-width: calc(var(--chat-measure, 768px) + 2 * 21px); }
101
102
 
102
103
  /* A diff inside a chat tool block; the library paints its own colors inside a shadow root and
103
104
  takes the face it draws them in through these variables. */
@@ -184,6 +185,15 @@
184
185
  --tw-prose-th-borders: var(--border);
185
186
  --tw-prose-td-borders: var(--border);
186
187
  }
188
+ /* A muted `Markdown`, such as a thought the model had before it answered. */
189
+ .prose.chat-markdown[data-muted] {
190
+ --tw-prose-body: var(--text-muted);
191
+ --tw-prose-headings: var(--text-muted);
192
+ --tw-prose-bold: var(--text-muted);
193
+ --tw-prose-quotes: var(--text-muted);
194
+ --tw-prose-code: var(--text-muted);
195
+ --tw-prose-pre-code: var(--text-muted);
196
+ }
187
197
  /* Headings stay on the app's scale, which is flatter than the one prose brings. */
188
198
  .chat-markdown :is(h1, h2, h3, h4) { font-weight: 600; line-height: round(1.3em, 1px); }
189
199
  .chat-markdown h1 { font-size: var(--text-lg); }
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
5
5
  import type { UsageModel, UsageProject, UsageProvider, UsageSummaryResult } from '@adecore/agent-contracts';
6
6
  import { EmptyState, Icon, SectionLabel, Segmented, Tooltip } from '@adecore/ui';
7
7
  import { useChatScope } from '../scope';
8
- import { chatHost } from '../host';
8
+ import { useChatHost } from '../host';
9
9
  import type { UsageMetric } from '../state/usage';
10
10
  import { ProviderLogo } from '../agents/ProviderLogo';
11
11
  import { USAGE_PROVIDERS, totalTokensOf } from '@adecore/agent-contracts';
@@ -97,8 +97,9 @@ function ModelRows({ models, metric, total }: { models: readonly UsageModel[]; m
97
97
 
98
98
  /* One project's row, under the name and the mark its host gives it, or its folder's own under a folder. */
99
99
  function ProjectRow({ project, top, money }: { project: UsageProject; top: number; money(usd: number): string }) {
100
+ const host = useChatHost();
100
101
  // The usage on screen is one host's, so the look of a project is that host's too.
101
- const look = chatHost().useProjectLook(useChatScope().id, project.projectId);
102
+ const look = host.useProjectLook(useChatScope().id, project.projectId);
102
103
  return (
103
104
  /* The mark sits on the title rather than between the two lines, so the icons line up with the names. */
104
105
  <div className={`${ROW} h-auto items-start py-1.5`}>
@@ -4,7 +4,7 @@ import { LogIn } from 'lucide-react';
4
4
  import type { UsageProvider } from '@adecore/agent-contracts';
5
5
  import { AccountDot } from '../agents/AccountDot';
6
6
  import { Button, Icon, SectionLabel, Segmented, Tooltip, useNow } from '@adecore/ui';
7
- import { chatHost } from '../host';
7
+ import { useChatHost } from '../host';
8
8
  import { PROVIDER_COLORS, PROVIDER_LABELS } from './format';
9
9
  import { accountNote, checkedLabel, hasSeveralAccounts, isSignedOut, type LimitAccount } from './limit-groups';
10
10
  import { WindowBar } from './LimitsList';
@@ -93,14 +93,15 @@ function LimitCard({ account, named, now, login }: { account: LimitAccount; name
93
93
  * credential: every CLI holds its own login and answers the question when the daemon starts one and asks.
94
94
  */
95
95
  export function UsageLimits() {
96
+ const host = useChatHost();
96
97
  const { t } = useTranslation('agent-usage');
97
98
  const limits = useUsageLimits();
98
99
  const groups = useLimitGroups(limits);
99
100
  const now = useNow(MINUTE_MS);
100
101
  const scopeId = useChatScope().id;
101
102
  const loginCommands = useProviderAccountsStore((s) => s.byScope[scopeId]?.accounts?.loginCommands);
102
- const { openLogin } = chatHost();
103
- const blocked = chatHost().useLoginBlocked(scopeId);
103
+ const { openLogin } = host;
104
+ const blocked = host.useLoginBlocked(scopeId);
104
105
  const [filter, setFilter] = useState<Filter>('all');
105
106
 
106
107
  if (limits === null) {
@@ -4,7 +4,7 @@ import { ChartNoAxesColumn, RefreshCw } from 'lucide-react';
4
4
  import { USAGE_PROVIDERS, type UsageAccount } from '@adecore/agent-contracts';
5
5
  import { Button, CloseButton, Dialog, EmptyState, FormError, IconButton, Segmented, Select, Skeleton } from '@adecore/ui';
6
6
  import { AccountDot } from '../agents/AccountDot';
7
- import { chatHost } from '../host';
7
+ import { useChatHost } from '../host';
8
8
  import { useChatScope } from '../scope';
9
9
  import { useProvidersStore } from '../state/providers';
10
10
  import { askedKey, summaryPayload, USAGE_PERIODS, useUsage, useUsageStore, type UsageMetric, type UsagePeriod } from '../state/usage';
@@ -39,6 +39,7 @@ function useAnswering(transport: ChatTransport): boolean {
39
39
  * agent looks like too, and the way to fix that is the agent settings.
40
40
  */
41
41
  function HostAgents() {
42
+ const host = useChatHost();
42
43
  const { t } = useTranslation('agent-usage');
43
44
  const { id } = useChatScope();
44
45
  const row = useProvidersStore((s) => s.byScope[id]);
@@ -51,7 +52,7 @@ function HostAgents() {
51
52
  <p className="text-xs text-text-muted">
52
53
  {installed.length === 0 ? t('agents.none') : t('agents.installed', { list: installed.map((provider) => provider.name).join(', ') })}
53
54
  </p>
54
- <Button size="sm" variant="secondary" onClick={() => chatHost().openSettings('agents')}>
55
+ <Button size="sm" variant="secondary" onClick={() => host.openSettings('agents')}>
55
56
  {t('agents.settings')}
56
57
  </Button>
57
58
  </div>
@@ -0,0 +1,16 @@
1
+ // Public API: exports.test.ts snapshots this list, so a name added or dropped here is an API change.
2
+ export { WindowBar, LimitsList, AccountLimitsList } from './LimitsList';
3
+ export { UsageBreakdown } from './UsageBreakdown';
4
+ export { UsageChart } from './UsageChart';
5
+ export { UsageDialog } from './UsageDialog';
6
+ export { UsageLimits } from './UsageLimits';
7
+ export { UsageLimitsCard } from './UsageLimitsCard';
8
+ export { UsagePage } from './UsagePage';
9
+ export { UsagePane } from './UsagePane';
10
+ export { UsageSummary } from './UsageSummary';
11
+ export { UsageTiles } from './UsageTiles';
12
+ export { formatClock, type UsageCurrency } from './format';
13
+ export type { LimitAccount, LimitGroup } from './limit-groups';
14
+ export { useLimitGroups } from './limits';
15
+ export { useMoney } from './money';
16
+ export { niceScale, labelEveryFor, deriveUsage, type ChartSlot, type ProviderTotal, type DerivedUsage } from './summary';