@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
@@ -0,0 +1,43 @@
1
+ export default {
2
+ card: {
3
+ approval: 'Verzoek om toestemming',
4
+ question: 'Vraag',
5
+ waiting: 'Wacht in de terminal'
6
+ },
7
+ toolbar: 'Acties',
8
+ sending: 'Versturen…',
9
+ error: {
10
+ notConnected: 'Geen verbinding met de machine',
11
+ noChoices: 'Een chatverzoek heeft geen eigen keuzes'
12
+ },
13
+ approval: {
14
+ runCommand: 'Commando uitvoeren',
15
+ allow: 'Toestaan',
16
+ deny: 'Weigeren',
17
+ addReason: 'Reden toevoegen',
18
+ allChanges_one: 'Toestaan geldt voor de {{count}} wijziging in dit verzoek.',
19
+ allChanges_other: 'Toestaan geldt voor alle {{count}} wijzigingen in dit verzoek.',
20
+ loadingDiff: 'Diff laden…',
21
+ reviewChanges: 'Wijzigingen beoordelen',
22
+ viewDiff: 'Volledige diff tonen',
23
+ collapseDiff: 'Diff inklappen',
24
+ details: 'Details',
25
+ reasonLabel: 'Reden voor weigeren',
26
+ reasonPlaceholder: 'Reden voor weigeren, optioneel'
27
+ },
28
+ question: {
29
+ multiSelect: 'Kies er een of meer',
30
+ answerLabel: 'Jouw antwoord',
31
+ answerPlaceholder: 'Jouw antwoord',
32
+ somethingElse: 'Iets anders…',
33
+ previous: 'Vorige',
34
+ next: 'Volgende',
35
+ answer: 'Antwoorden'
36
+ },
37
+ meta: {
38
+ waiting_one: '{{count}} verzoek wacht',
39
+ waiting_other: '{{count}} verzoeken wachten',
40
+ question: 'Vraag {{index}} van {{total}}',
41
+ draftSaved: 'Concept bewaard'
42
+ }
43
+ };
@@ -0,0 +1,131 @@
1
+ export default {
2
+ status: {
3
+ checking: 'Controleren',
4
+ disabled: 'Uitgezet',
5
+ notFound: 'CLI niet gevonden',
6
+ signedOut: 'Niet ingelogd',
7
+ ready: 'Ingelogd',
8
+ readyPlan: 'Ingelogd · {{plan}}',
9
+ available: 'Klaar',
10
+ folderMissing: 'Map ontbreekt',
11
+ unavailable: 'Niet beschikbaar',
12
+ failed: 'Controle mislukt'
13
+ },
14
+ failed: 'De instellingen van de providers konden niet worden getekend',
15
+ list: {
16
+ label: "Agent-CLI's en hun accounts",
17
+ default: 'Standaard',
18
+ addAccount: 'Een {{provider}}-account toevoegen',
19
+ notInstalled: 'Niet geïnstalleerd',
20
+ missing: 'Ontbreekt',
21
+ notInstalledNote: 'Installeer er een en start Ruimte op die machine opnieuw om hem toe te voegen.',
22
+ none: "Geen agent-CLI's gevonden op deze machine.",
23
+ noAccounts: 'Deze machine houdt nog geen accounts bij. Werk Ruimte daar bij om er een toe te voegen.'
24
+ },
25
+ abilities: {
26
+ version: 'Versie {{version}}.',
27
+ chatAndTerminal: 'Chat en terminal.',
28
+ terminalOnly: 'Alleen terminal.',
29
+ reportsStatus: 'Meldt de agentstatus.',
30
+ noStatus: 'Meldt geen agentstatus.'
31
+ },
32
+ cli: {
33
+ addAccount: 'Account toevoegen',
34
+ onlyDefault: '{{provider}} heeft geen instelling voor zijn configuratiemap, dus alleen zijn standaardaccount.',
35
+ defaults: {
36
+ title: 'Standaarden voor nieuwe chats',
37
+ description: 'Een model of account kiezen in een chat verandert hier ook de standaard.',
38
+ account: 'Account',
39
+ accountFor: 'Standaardaccount voor {{provider}}',
40
+ model: 'Model',
41
+ modelFor: 'Standaardmodel voor {{provider}}',
42
+ shared: 'Gedeeld door elk {{provider}}-account.',
43
+ usesCliDefault: 'Gebruikt het standaardmodel van de CLI zelf.',
44
+ providerDefault: 'Standaard van de provider',
45
+ legacyModel: '{{name}} (legacy)'
46
+ },
47
+ accounts: 'Accounts'
48
+ },
49
+ account: {
50
+ kind: '{{provider}}-account',
51
+ enabled: {
52
+ label: 'Dit account gebruiken',
53
+ description: 'Uitgezet wordt het niet aangeboden voor nieuwe chats en agents.'
54
+ },
55
+ showFolder: 'Map tonen',
56
+ folderCopied: 'Pad van de map gekopieerd',
57
+ name: 'Naam',
58
+ color: 'Kleur',
59
+ login: {
60
+ title: 'Login',
61
+ signedInAs: 'Ingelogd als {{email}}',
62
+ signedIn: 'Ingelogd',
63
+ planDetail: '{{plan}}-abonnement. Opnieuw inloggen opent een terminal met de login van de CLI zelf.',
64
+ detail: 'Opnieuw inloggen opent een terminal met de login van de CLI zelf.',
65
+ signedOut: 'Niet ingelogd',
66
+ signedOutDetail: 'Opent een terminal die de login van de CLI met deze map draait.',
67
+ logIn: 'Inloggen',
68
+ logInAgain: 'Opnieuw inloggen'
69
+ },
70
+ folder: {
71
+ label: 'Map',
72
+ detail: 'Aan de CLI gegeven als <code>{{variable}}</code>. De CLI bewaart hier zijn eigen login, instellingen en geschiedenis.',
73
+ detailPlain: 'De CLI bewaart hier zijn eigen login, instellingen en geschiedenis.'
74
+ },
75
+ variables: {
76
+ title: 'Variabelen',
77
+ description: 'Extra omgeving voor alleen dit account. Gevoelige waarden blijven in de sleutelhanger.',
78
+ add: 'Variabele toevoegen',
79
+ name: 'Naam van variabele {{index}}',
80
+ value: 'Waarde van {{name}}',
81
+ kept: 'Bewaard in de sleutelhanger',
82
+ lock: '{{name}} in de sleutelhanger bewaren',
83
+ unlock: '{{name}} als platte tekst bewaren',
84
+ noKeychain: 'Deze machine heeft geen sleutelhanger, dus een waarde kan niet geheim blijven.',
85
+ remove: '{{name}} verwijderen',
86
+ none: 'Geen variabelen',
87
+ discard: 'Weggooien',
88
+ problem: {
89
+ noName: 'Elke variabele heeft een naam nodig.',
90
+ invalidName: '{{name}} is geen naam voor een variabele.',
91
+ duplicate: '{{name}} staat er twee keer in.',
92
+ noValue: '{{name}} heeft een waarde nodig.'
93
+ }
94
+ },
95
+ remove: {
96
+ label: 'Account verwijderen',
97
+ description: 'Chats die het gebruiken vragen bij hun volgende turn om een ander account. De map blijft op de schijf.',
98
+ defaultNote: 'Het standaardaccount gebruikt de eigen map van de CLI en kan niet weg. Zet het in plaats daarvan hierboven uit.',
99
+ button: 'Verwijderen',
100
+ confirmTitle: '{{account}} verwijderen?',
101
+ confirmDescription: 'Ruimte vergeet dit account. De map blijft op de schijf staan op {{folder}}, met de login erin.',
102
+ confirm: 'Account verwijderen'
103
+ },
104
+ saveFailed: 'Kon het account niet opslaan'
105
+ },
106
+ add: {
107
+ title: 'Een {{provider}}-account toevoegen',
108
+ description: 'Ruimte maakt er een map voor op de machine en opent dan een terminal waarin je inlogt.',
109
+ name: 'Naam',
110
+ namePlaceholder: 'Werk',
111
+ color: 'Kleur',
112
+ advanced: 'Geavanceerd',
113
+ link: {
114
+ label: 'Een bestaande map koppelen',
115
+ description: 'Gebruik een configuratiemap die al op de machine staat in plaats van een nieuwe. Ruimte verplaatst of verwijdert hem nooit.',
116
+ placeholder: 'Pad op de machine'
117
+ },
118
+ create: 'Account toevoegen',
119
+ linkButton: 'Map koppelen',
120
+ failed: 'Kon het account niet toevoegen'
121
+ },
122
+ section: {
123
+ label: 'Providers',
124
+ description: "De agent-CLI's op deze machine en de accounts waarmee ze inloggen."
125
+ },
126
+ notAnswering: 'Geeft geen antwoord. Pas dit aan zodra de machine terug is.',
127
+ common: {
128
+ save: 'Opslaan',
129
+ cancel: 'Annuleren'
130
+ }
131
+ };
@@ -0,0 +1,132 @@
1
+ export default {
2
+ limits: {
3
+ title: 'Limieten',
4
+ explain:
5
+ 'Het streepje op een balk laat zien hoeveel van het venster voorbij is. Een balk voorbij dat streepje verbruikt sneller dan het venster teruggeeft.',
6
+ loading: 'Limieten laden…',
7
+ used: '{{percent}}% gebruikt',
8
+ bar: '{{window}}, {{percent}}% gebruikt',
9
+ windowPassed: '{{percent}}% van het venster voorbij',
10
+ faster: 'Verbruikt sneller dan het venster teruggeeft.',
11
+ slower: 'Verbruikt langzamer dan het venster teruggeeft.',
12
+ resets: 'Reset {{at}}',
13
+ none: 'Nog geen limieten gemeld.',
14
+ notInstalled: 'Niet geïnstalleerd op deze machine.',
15
+ noSubscription: 'Dit account gebruikt een API-sleutel en kent geen abonnementslimieten.',
16
+ unreachable: 'De CLI was niet bereikbaar.',
17
+ filter: 'Accounts waarvan je de limieten ziet',
18
+ signedOut: 'Niet ingelogd',
19
+ signedOutDetail: 'Niet ingelogd. Log in om de limieten te zien.',
20
+ logIn: 'Inloggen',
21
+ nextReset: '{{window}} reset {{at}}',
22
+ checked: {
23
+ now: 'nu',
24
+ ago: '{{duration}} geleden',
25
+ fromTurn: 'Uit een turn · {{when}}'
26
+ }
27
+ },
28
+ settings: {
29
+ currency: {
30
+ label: 'Valuta',
31
+ dollars: 'Prijzen zoals gepubliceerd, in dollars.',
32
+ noRate: 'Nog geen wisselkoers. De pagina toont dollars zolang die er niet is.',
33
+ converted: 'Omgerekend met de ECB-referentiekoers van {{date}}.',
34
+ options: {
35
+ USD: 'Dollars',
36
+ EUR: "Euro's"
37
+ }
38
+ },
39
+ page: {
40
+ label: 'Verbruikspagina',
41
+ description: 'Kosten, tokens en planlimieten, per account.',
42
+ open: 'Verbruik openen'
43
+ }
44
+ },
45
+ section: {
46
+ label: 'Verbruik',
47
+ description: 'De valuta van de verbruikspagina.'
48
+ },
49
+ dialog: {
50
+ title: 'Verbruik',
51
+ description: 'Kosten, tokens en limieten van je abonnement',
52
+ close: 'Verbruik sluiten',
53
+ rescan: 'Opnieuw scannen',
54
+ period: 'Periode',
55
+ metric: 'Eenheid',
56
+ failed: 'Verbruik kon niet worden getekend',
57
+ periods: {
58
+ today: 'Vandaag',
59
+ '7d': '7 dagen',
60
+ '30d': '30 dagen',
61
+ '90d': '90 dagen'
62
+ },
63
+ metrics: {
64
+ cost: 'Kosten',
65
+ tokens: 'Tokens'
66
+ },
67
+ accounts: {
68
+ label: 'Account',
69
+ all: 'Alle accounts'
70
+ }
71
+ },
72
+ empty: {
73
+ noTranscripts: 'Geen transcripts van Claude of Codex gevonden. De machine leest ~/.claude/projects en ~/.codex/sessions.',
74
+ noUsage: 'Nog geen verbruik op deze machine.'
75
+ },
76
+ agents: {
77
+ none: 'Op deze machine staat geen agent-CLI.',
78
+ installed: 'Deze machine heeft {{list}}.',
79
+ settings: 'Agent-instellingen'
80
+ },
81
+ provenance: {
82
+ failed: 'Kon de transcripts niet lezen. Dit is de laatste scan die wel lukte.',
83
+ scanned_one: 'Gescand om {{time}}, {{files}} bestand',
84
+ scanned_other: 'Gescand om {{time}}, {{files}} bestanden',
85
+ bundledPrices: 'Prijzen uit de meegeleverde tabel',
86
+ fetchedPrices: 'Prijzen van LiteLLM, {{date}}',
87
+ rate: '{{currency}} tegen de ECB-koers van {{date}}'
88
+ },
89
+ summary: {
90
+ sessions_one: '{{sessions}} sessie',
91
+ sessions_other: '{{sessions}} sessies',
92
+ calls_one: '{{calls}} aanroep',
93
+ calls_other: '{{calls}} aanroepen',
94
+ apiRates: 'tegen API-tarieven'
95
+ },
96
+ tiles: {
97
+ processed: 'Verwerkt',
98
+ uncachedInput: 'Input zonder cache',
99
+ cachedInput: 'Input uit cache',
100
+ cacheWrites: 'Naar cache geschreven',
101
+ output: 'Output',
102
+ cacheSavings: 'Bespaard met cache'
103
+ },
104
+ chart: {
105
+ total: 'Totaal'
106
+ },
107
+ breakdown: {
108
+ title: 'Uitsplitsing',
109
+ tabs: {
110
+ models: 'Modellen',
111
+ projects: 'Projecten',
112
+ day: 'Dag'
113
+ },
114
+ models: {
115
+ model: 'Model',
116
+ calls: 'Aanroepen',
117
+ input: 'Input',
118
+ output: 'Output',
119
+ cache: 'Cache R/W',
120
+ cost: 'Kosten',
121
+ share: 'Aandeel',
122
+ pricedAs: 'Geprijsd als {{model}}',
123
+ noPrice: 'Geen prijs bekend voor dit model'
124
+ },
125
+ days: {
126
+ day: 'Dag',
127
+ total: 'Totaal',
128
+ tokens: 'Tokens',
129
+ empty: 'Geen activiteit in deze periode.'
130
+ }
131
+ }
132
+ };
package/src/locales.ts CHANGED
@@ -14,20 +14,21 @@ async function open(files: Files): Promise<Record<AgentsNamespace, Bundle>> {
14
14
  >;
15
15
  }
16
16
 
17
+ /* The words are modules, not JSON: Node needs `with { type: 'json' }` on a JSON import, and a browser refuses it on the JavaScript Vite serves. */
17
18
  /* One loader per language that answers every namespace of it, so a bundler splits them and a window only downloads the language it shows. */
18
19
  export const AGENTS_LOCALES: Record<string, () => Promise<Record<AgentsNamespace, Bundle>>> = {
19
20
  en: () =>
20
21
  open({
21
- 'agent-chat': () => import('./locales/en/agent-chat.json', { with: { type: 'json' } }),
22
- 'agent-prompts': () => import('./locales/en/agent-prompts.json', { with: { type: 'json' } }),
23
- 'agent-providers': () => import('./locales/en/agent-providers.json', { with: { type: 'json' } }),
24
- 'agent-usage': () => import('./locales/en/agent-usage.json', { with: { type: 'json' } })
22
+ 'agent-chat': () => import('./locales/en/agent-chat'),
23
+ 'agent-prompts': () => import('./locales/en/agent-prompts'),
24
+ 'agent-providers': () => import('./locales/en/agent-providers'),
25
+ 'agent-usage': () => import('./locales/en/agent-usage')
25
26
  }),
26
27
  nl: () =>
27
28
  open({
28
- 'agent-chat': () => import('./locales/nl/agent-chat.json', { with: { type: 'json' } }),
29
- 'agent-prompts': () => import('./locales/nl/agent-prompts.json', { with: { type: 'json' } }),
30
- 'agent-providers': () => import('./locales/nl/agent-providers.json', { with: { type: 'json' } }),
31
- 'agent-usage': () => import('./locales/nl/agent-usage.json', { with: { type: 'json' } })
29
+ 'agent-chat': () => import('./locales/nl/agent-chat'),
30
+ 'agent-prompts': () => import('./locales/nl/agent-prompts'),
31
+ 'agent-providers': () => import('./locales/nl/agent-providers'),
32
+ 'agent-usage': () => import('./locales/nl/agent-usage')
32
33
  })
33
34
  };
@@ -0,0 +1,35 @@
1
+ // Public API: exports.test.ts snapshots this list, so a name added or dropped here is an API change.
2
+ export { focusPromptStart, focusPromptHeading } from './logic/focus';
3
+ export { PROMPT_SHORTCUTS, pageKey, type PromptKeyEvent } from './logic/keys';
4
+ export {
5
+ type PendingPrompt,
6
+ type PromptAction,
7
+ emptyPromptDraft,
8
+ answerValue,
9
+ questionAnswer,
10
+ pickPromptChoice,
11
+ isBlockingPrompt,
12
+ orderPrompts,
13
+ nextPrompt,
14
+ promptAnswers,
15
+ type PromptAnswer,
16
+ type PromptDraft
17
+ } from './logic/prompts';
18
+ export {
19
+ type HostPrompt,
20
+ type PromptSubject,
21
+ type ChatPromptClients,
22
+ type PromptViewProps,
23
+ type ApprovalButtonSpec,
24
+ promptIdOf,
25
+ promptCreatedAt,
26
+ isBlockingSubject,
27
+ answerPrompt
28
+ } from './logic/subjects';
29
+ export { useFocusAfterAnswer, type FocusAfterAnswer } from './logic/useFocusAfterAnswer';
30
+ export { usePromptSession, type PromptSession } from './logic/usePromptSession';
31
+ export { CommandBox, ApprovalBody } from './ui/ApprovalBody';
32
+ export { PromptPrimary, ApprovalActions, QuestionActions, type ApprovalButton } from './ui/PromptActions';
33
+ export { PROMPT_SURFACE, PromptCard, type PromptCardKind } from './ui/PromptCard';
34
+ export { PromptView } from './ui/PromptView';
35
+ export { QuestionBody } from './ui/QuestionBody';
@@ -1,6 +1,6 @@
1
1
  import i18next from 'i18next';
2
2
  import type { ReactNode } from 'react';
3
- import { chatHost } from '../../host';
3
+ import type { ChatHost } from '../../host';
4
4
  import { isBlockingPrompt, type PendingPrompt, type PromptAction, type PromptDraft } from './prompts';
5
5
 
6
6
  /*
@@ -100,10 +100,18 @@ export function approvalButtons(subject: PromptSubject, reason: string): Approva
100
100
  ];
101
101
  }
102
102
 
103
- /* Sends a card's action as the request its subject is answered with. A refusal comes back as an error for the card to show. */
104
- export async function answerPrompt(subject: PromptSubject, action: PromptAction, chat: ChatPromptClients | null): Promise<void> {
103
+ /*
104
+ * Sends a card's action as the request its subject is answered with, or to `host` for a prompt it raised.
105
+ * A refusal comes back as an error for the card to show.
106
+ */
107
+ export async function answerPrompt(
108
+ subject: PromptSubject,
109
+ action: PromptAction,
110
+ chat: ChatPromptClients | null,
111
+ host: Pick<ChatHost, 'prompts'>
112
+ ): Promise<void> {
105
113
  if (subject.kind === 'host') {
106
- return chatHost().prompts.answer(subject.prompt, action);
114
+ return host.prompts.answer(subject.prompt, action);
107
115
  }
108
116
  if (chat === null) {
109
117
  throw new Error(i18next.t('agent-prompts:error.notConnected'));
@@ -3,7 +3,7 @@ import clsx from 'clsx';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import type { ChatApprovalItem } from '@adecore/agent-contracts';
5
5
  import { approvalChanges, fileChanges } from '../../chat/logic/tools';
6
- import { chatHost } from '../../host';
6
+ import { useChatHost } from '../../host';
7
7
  import { ApprovalReview } from '../../chat/ui/diff/ApprovalReview';
8
8
  import { reviewEntries } from '../../chat/ui/diff/review-plan';
9
9
  import { isPrimaryKey } from '../logic/keys';
@@ -21,12 +21,13 @@ export function CommandBox({ command, cwd }: { command: string; cwd?: string })
21
21
  }
22
22
 
23
23
  function ApprovalDetails({ item }: { item: ChatApprovalItem }) {
24
+ const host = useChatHost();
24
25
  const { t } = useTranslation('agent-prompts');
25
26
  const [expanded, setExpanded] = useState(false);
26
27
  const patches = approvalChanges(item.input);
27
28
  const edits = patches.length ? [] : fileChanges(item.toolName, item.input);
28
29
  const entries = reviewEntries(patches, edits);
29
- const editorPreview = chatHost().code.editor !== undefined;
30
+ const editorPreview = host.code.editor !== undefined;
30
31
  const maxHeight = expanded ? 480 : 176;
31
32
  const input = typeof item.input === 'object' && item.input !== null ? (item.input as Record<string, unknown>) : {};
32
33
  return (
@@ -76,8 +77,9 @@ export function ApprovalBody({
76
77
  denyReason: boolean;
77
78
  locked: boolean;
78
79
  }) {
80
+ const host = useChatHost();
79
81
  const { t } = useTranslation('agent-prompts');
80
- const AnswerField = chatHost().dictation.Textarea;
82
+ const AnswerField = host.dictation.Textarea;
81
83
  return (
82
84
  <>
83
85
  <ApprovalDetails item={item} />
@@ -92,7 +94,7 @@ export function ApprovalBody({
92
94
  onChange={(e) => onDraft({ ...draft, reason: e.target.value })}
93
95
  onKeyDown={(e) => {
94
96
  // Mod+Enter presses Allow everywhere else in the card, which is the opposite of what a reason for declining is typed for.
95
- if (isPrimaryKey(e.nativeEvent, chatHost().isApplePlatform())) {
97
+ if (isPrimaryKey(e.nativeEvent, host.isApplePlatform())) {
96
98
  e.preventDefault();
97
99
  }
98
100
  }}
@@ -1,7 +1,7 @@
1
1
  import type { KeyboardEvent, ReactNode } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { Hand, MessageCircleQuestionMark, type LucideIcon } from 'lucide-react';
4
- import { chatHost } from '../../host';
4
+ import { useChatHost } from '../../host';
5
5
  import { headingKey, isPrimaryKey, staysInCard, stepIndex, toolbarKey } from '../logic/keys';
6
6
  import { Icon } from '@adecore/ui';
7
7
 
@@ -32,11 +32,11 @@ interface PromptCardProps {
32
32
  * The keys every card shares: Mod+Enter, entering from the heading and the action row. The body handles
33
33
  * its own keys first and says so with `preventDefault`.
34
34
  */
35
- function onCardKeyDown(event: KeyboardEvent<HTMLDivElement>) {
35
+ function onCardKeyDown(event: KeyboardEvent<HTMLDivElement>, apple: boolean) {
36
36
  const card = event.currentTarget;
37
37
  const target = event.target instanceof HTMLElement ? event.target : null;
38
38
  if (!event.defaultPrevented) {
39
- if (isPrimaryKey(event.nativeEvent, chatHost().isApplePlatform())) {
39
+ if (isPrimaryKey(event.nativeEvent, apple)) {
40
40
  event.preventDefault();
41
41
  // A click on the button itself, so a disabled Next or Answer stays as disabled as it looks.
42
42
  card.querySelector<HTMLButtonElement>('[data-prompt-primary]:not(:disabled)')?.click();
@@ -62,8 +62,15 @@ function onCardKeyDown(event: KeyboardEvent<HTMLDivElement>) {
62
62
  /* What every prompt looks like, whatever asked it: in a chat's composer and in a canvas's stack. */
63
63
  export function PromptCard({ kind, heading, meta, top, actions, busy, notice, error, children }: PromptCardProps) {
64
64
  const { t } = useTranslation('agent-prompts');
65
+ const { isApplePlatform } = useChatHost();
65
66
  const card = (
66
- <div className="prompt-card flex min-h-0 flex-col gap-2 p-3" role="group" aria-label={t(`card.${kind}`)} aria-busy={busy} onKeyDown={onCardKeyDown}>
67
+ <div
68
+ className="prompt-card flex min-h-0 flex-col gap-2 p-3"
69
+ role="group"
70
+ aria-label={t(`card.${kind}`)}
71
+ aria-busy={busy}
72
+ onKeyDown={(event) => onCardKeyDown(event, isApplePlatform())}
73
+ >
67
74
  {/* The scroll box would clip the focus ring of whatever sits against its edge, so it carries the
68
75
  room that ring needs and gives the same amount back to the card's own padding. */}
69
76
  <div className="-m-1.5 max-h-[min(50dvh,480px)] overflow-auto overscroll-contain p-1.5">
@@ -1,6 +1,6 @@
1
1
  import { useTranslation } from 'react-i18next';
2
2
  import { toolSummary } from '../../chat/logic/tools';
3
- import { chatHost } from '../../host';
3
+ import { useChatHost } from '../../host';
4
4
  import { answerValue, promptAnswers, questionAnswer, type PromptDraft } from '../logic/prompts';
5
5
  import { approvalButtons, type PromptViewProps } from '../logic/subjects';
6
6
  import { ApprovalBody } from './ApprovalBody';
@@ -12,12 +12,13 @@ import { QuestionBody } from './QuestionBody';
12
12
  export function PromptView(props: PromptViewProps) {
13
13
  const { subject, draft, onDraft, onAction, more, hasDraft, denyReason, disabled, sending, error, top } = props;
14
14
  const { t } = useTranslation('agent-prompts');
15
+ const { prompts } = useChatHost();
15
16
  const locked = sending || disabled;
16
17
  const notice = disabled ? t('error.notConnected') : null;
17
18
  const buttons = approvalButtons(subject, draft.reason).map(({ action, ...button }) => ({ ...button, onPress: () => onAction(action) }));
18
19
 
19
20
  if (subject.kind === 'host') {
20
- return chatHost().prompts.render(subject.prompt, props);
21
+ return prompts.render(subject.prompt, props);
21
22
  }
22
23
 
23
24
  const { item } = subject;
@@ -6,7 +6,7 @@ import type { ChatQuestion } from '@adecore/agent-contracts';
6
6
  import { answerFieldKey, choiceKey, stepIndex } from '../logic/keys';
7
7
  import { pickPromptChoice, type PromptAnswer } from '../logic/prompts';
8
8
  import { Icon } from '@adecore/ui';
9
- import { chatHost } from '../../host';
9
+ import { useChatHost } from '../../host';
10
10
 
11
11
  /* One question of a request: its choices, "Something else…", or a written answer when it offers no choices. */
12
12
  export function QuestionBody({
@@ -23,8 +23,9 @@ export function QuestionBody({
23
23
  onCommit(answer: PromptAnswer): void;
24
24
  locked: boolean;
25
25
  }) {
26
+ const host = useChatHost();
26
27
  const { t } = useTranslation('agent-prompts');
27
- const AnswerField = chatHost().dictation.Textarea;
28
+ const AnswerField = host.dictation.Textarea;
28
29
  // The choices, then the "Something else…" field form one list with a single tab stop.
29
30
  const items = useRef<(HTMLElement | null)[]>([]);
30
31
  const shownQuestion = useRef(question.id);
@@ -1,8 +1,8 @@
1
1
  import { AccentSwatches } from '@adecore/ui';
2
- import { chatHost } from '../host';
2
+ import { useChatHost } from '../host';
3
3
 
4
4
  /* The colors an account may wear, the host's palette. */
5
5
  export function AccountColors({ value, label, onChange }: { value: string | undefined; label: string; onChange(id: string): void }) {
6
- const { all, featured, label: labelOf } = chatHost().accents;
6
+ const { all, featured, label: labelOf } = useChatHost().accents;
7
7
  return <AccentSwatches value={value} label={label} accents={all} featured={featured} labelOf={labelOf} onValueChange={onChange} />;
8
8
  }
@@ -6,7 +6,7 @@ import { AccountDot } from '../agents/AccountDot';
6
6
  import { accountName, FOLDER_VARIABLES, type AccountEntry } from '../agents/accounts';
7
7
  import { ConfirmDialog, DetailHeader, SettingsRow, SettingsSection } from '@adecore/ui/settings';
8
8
  import { Button, copyText, Icon, Input, Switch, Tooltip } from '@adecore/ui';
9
- import { chatHost } from '../host';
9
+ import { useChatHost } from '../host';
10
10
  import { useChatScope } from '../scope';
11
11
  import { removeAccount, saveAccount } from './account-actions';
12
12
  import { AccountVariables } from './AccountVariables';
@@ -59,6 +59,7 @@ function NameField({ value, label, onSave }: { value: string; label: string; onS
59
59
  export function AccountDetail({ provider, entry, canLogIn, loginBlocked, secretsAvailable, onRemoved }: AccountDetailProps) {
60
60
  const { t } = useTranslation('agent-providers');
61
61
  const scope = useChatScope();
62
+ const host = useChatHost();
62
63
  const [confirming, setConfirming] = useState(false);
63
64
  const { id, account, status, isDefault } = entry;
64
65
  const name = accountName(entry, provider.name);
@@ -68,7 +69,7 @@ export function AccountDetail({ provider, entry, canLogIn, loginBlocked, secrets
68
69
 
69
70
  const showFolder = (): void => {
70
71
  copyText(folder);
71
- chatHost().notify({ kind: 'success', title: t('account.folderCopied'), description: folder });
72
+ host.notify({ kind: 'success', title: t('account.folderCopied'), description: folder });
72
73
  };
73
74
 
74
75
  const loginDetail = (): string => {
@@ -82,7 +83,7 @@ export function AccountDetail({ provider, entry, canLogIn, loginBlocked, secrets
82
83
  };
83
84
 
84
85
  const loginButton = (
85
- <Button variant="secondary" disabled={loginBlocked !== null} onClick={() => void chatHost().openLogin?.(scope.id, provider.kind, id, name)}>
86
+ <Button variant="secondary" disabled={loginBlocked !== null} onClick={() => void host.openLogin?.(scope.id, provider.kind, id, name)}>
86
87
  <Icon icon={LogIn} size={14} />
87
88
  {signedIn ? t('account.login.logInAgain') : t('account.login.logIn')}
88
89
  </Button>
@@ -121,7 +122,7 @@ export function AccountDetail({ provider, entry, canLogIn, loginBlocked, secrets
121
122
  label={t('account.enabled.label')}
122
123
  onCheckedChange={(checked) => {
123
124
  const { enabled: _enabled, ...rest } = account;
124
- void saveAccount(scope, id, checked ? rest : { ...rest, enabled: false });
125
+ void saveAccount(scope, host, id, checked ? rest : { ...rest, enabled: false });
125
126
  }}
126
127
  />
127
128
  }
@@ -129,7 +130,12 @@ export function AccountDetail({ provider, entry, canLogIn, loginBlocked, secrets
129
130
  <SettingsRow
130
131
  label={t('account.name')}
131
132
  control={
132
- <NameField key={name} value={name} label={t('account.name')} onSave={(label) => void saveAccount(scope, id, { ...account, label })} />
133
+ <NameField
134
+ key={name}
135
+ value={name}
136
+ label={t('account.name')}
137
+ onSave={(label) => void saveAccount(scope, host, id, { ...account, label })}
138
+ />
133
139
  }
134
140
  />
135
141
  <SettingsRow
@@ -138,7 +144,7 @@ export function AccountDetail({ provider, entry, canLogIn, loginBlocked, secrets
138
144
  <AccountColors
139
145
  value={account.color}
140
146
  label={t('account.color')}
141
- onChange={(color) => void saveAccount(scope, id, { ...account, color })}
147
+ onChange={(color) => void saveAccount(scope, host, id, { ...account, color })}
142
148
  />
143
149
  }
144
150
  />
@@ -200,7 +206,7 @@ export function AccountDetail({ provider, entry, canLogIn, loginBlocked, secrets
200
206
  description={t('account.remove.confirmDescription', { folder })}
201
207
  confirmLabel={t('account.remove.confirm')}
202
208
  onConfirm={async () => {
203
- await removeAccount(scope, id, provider.kind);
209
+ await removeAccount(scope, host, id, provider.kind);
204
210
  onRemoved();
205
211
  }}
206
212
  />
@@ -2,6 +2,7 @@ import { useState } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { Lock, LockOpen, Plus, X } from 'lucide-react';
4
4
  import type { ProviderAccount } from '@adecore/agent-contracts';
5
+ import { useChatHost } from '../host';
5
6
  import { useChatScope } from '../scope';
6
7
  import { saveAccount } from './account-actions';
7
8
  import { draftsOf, emptyDraft, variablesChanged, variablesOf, variablesProblem, type VariableDraft } from './variables';
@@ -22,6 +23,7 @@ interface AccountVariablesProps {
22
23
  export function AccountVariables({ id, account, secretsAvailable }: AccountVariablesProps) {
23
24
  const { t } = useTranslation('agent-providers');
24
25
  const scope = useChatScope();
26
+ const host = useChatHost();
25
27
  const [drafts, setDrafts] = useState<VariableDraft[]>(() => draftsOf(account.env));
26
28
  const [saving, setSaving] = useState(false);
27
29
  const changed = variablesChanged(drafts, account.env);
@@ -36,7 +38,7 @@ export function AccountVariables({ id, account, secretsAvailable }: AccountVaria
36
38
  const { env: _env, ...rest } = account;
37
39
  setSaving(true);
38
40
  try {
39
- await saveAccount(scope, id, env.length === 0 ? rest : { ...rest, env });
41
+ await saveAccount(scope, host, id, env.length === 0 ? rest : { ...rest, env });
40
42
  } finally {
41
43
  setSaving(false);
42
44
  }