@ruimte/agents-react 0.0.0 → 0.7.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 (312) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +142 -1
  3. package/dist/agents/AccountDot.d.ts +4 -0
  4. package/dist/agents/AccountDot.js +8 -0
  5. package/dist/agents/AgentIcon.d.ts +6 -0
  6. package/dist/agents/AgentIcon.js +20 -0
  7. package/dist/agents/ProviderLogo.d.ts +8 -0
  8. package/dist/agents/ProviderLogo.js +8 -0
  9. package/dist/agents/account-limits.d.ts +7 -0
  10. package/dist/agents/account-limits.js +26 -0
  11. package/dist/agents/accounts.d.ts +22 -0
  12. package/dist/agents/accounts.js +103 -0
  13. package/dist/agents/model-name.d.ts +6 -0
  14. package/dist/agents/model-name.js +44 -0
  15. package/dist/agents/provider-paths.d.ts +2 -0
  16. package/dist/agents/provider-paths.js +8 -0
  17. package/dist/agents/status-look.d.ts +13 -0
  18. package/dist/agents/status-look.js +22 -0
  19. package/dist/chat/account-choice.d.ts +11 -0
  20. package/dist/chat/account-choice.js +30 -0
  21. package/dist/chat/actions.d.ts +6 -0
  22. package/dist/chat/actions.js +64 -0
  23. package/dist/chat/activity.d.ts +5 -0
  24. package/dist/chat/activity.js +4 -0
  25. package/dist/chat/attachments.d.ts +23 -0
  26. package/dist/chat/attachments.js +70 -0
  27. package/dist/chat/bookmarks.d.ts +14 -0
  28. package/dist/chat/bookmarks.js +73 -0
  29. package/dist/chat/chat-client.d.ts +53 -0
  30. package/dist/chat/chat-client.js +232 -0
  31. package/dist/chat/chat-references.d.ts +5 -0
  32. package/dist/chat/chat-references.js +5 -0
  33. package/dist/chat/drafts.d.ts +29 -0
  34. package/dist/chat/drafts.js +104 -0
  35. package/dist/chat/forks.d.ts +2 -0
  36. package/dist/chat/forks.js +26 -0
  37. package/dist/chat/guards.d.ts +12 -0
  38. package/dist/chat/guards.js +63 -0
  39. package/dist/chat/logic/answers.d.ts +3 -0
  40. package/dist/chat/logic/answers.js +14 -0
  41. package/dist/chat/logic/bookmarks.d.ts +5 -0
  42. package/dist/chat/logic/bookmarks.js +31 -0
  43. package/dist/chat/logic/context-usage.d.ts +12 -0
  44. package/dist/chat/logic/context-usage.js +20 -0
  45. package/dist/chat/logic/fork.d.ts +44 -0
  46. package/dist/chat/logic/fork.js +138 -0
  47. package/dist/chat/logic/handback.d.ts +2 -0
  48. package/dist/chat/logic/handback.js +8 -0
  49. package/dist/chat/logic/json.d.ts +1 -0
  50. package/dist/chat/logic/json.js +2 -0
  51. package/dist/chat/logic/limit.d.ts +7 -0
  52. package/dist/chat/logic/limit.js +34 -0
  53. package/dist/chat/logic/resume-compaction.d.ts +14 -0
  54. package/dist/chat/logic/resume-compaction.js +47 -0
  55. package/dist/chat/logic/scrubber.d.ts +50 -0
  56. package/dist/chat/logic/scrubber.js +216 -0
  57. package/dist/chat/logic/timeline-copy.d.ts +4 -0
  58. package/dist/chat/logic/timeline-copy.js +51 -0
  59. package/dist/chat/logic/timeline-target.d.ts +12 -0
  60. package/dist/chat/logic/timeline-target.js +34 -0
  61. package/dist/chat/logic/timeline.d.ts +110 -0
  62. package/dist/chat/logic/timeline.js +339 -0
  63. package/dist/chat/logic/tool-catalog.d.ts +10 -0
  64. package/dist/chat/logic/tool-catalog.js +40 -0
  65. package/dist/chat/logic/tools.d.ts +15 -0
  66. package/dist/chat/logic/tools.js +79 -0
  67. package/dist/chat/logic/workflow.d.ts +14 -0
  68. package/dist/chat/logic/workflow.js +47 -0
  69. package/dist/chat/mentions.d.ts +46 -0
  70. package/dist/chat/mentions.js +128 -0
  71. package/dist/chat/persisted-json.d.ts +5 -0
  72. package/dist/chat/persisted-json.js +24 -0
  73. package/dist/chat/preferences.d.ts +23 -0
  74. package/dist/chat/preferences.js +110 -0
  75. package/dist/chat/quote.d.ts +2 -0
  76. package/dist/chat/quote.js +25 -0
  77. package/dist/chat/recent-messages.d.ts +17 -0
  78. package/dist/chat/recent-messages.js +28 -0
  79. package/dist/chat/resume-compaction-dismissals.d.ts +3 -0
  80. package/dist/chat/resume-compaction-dismissals.js +14 -0
  81. package/dist/chat/runtime-modes.d.ts +4 -0
  82. package/dist/chat/runtime-modes.js +11 -0
  83. package/dist/chat/stash.d.ts +24 -0
  84. package/dist/chat/stash.js +88 -0
  85. package/dist/chat/subagent-conversation.d.ts +38 -0
  86. package/dist/chat/subagent-conversation.js +150 -0
  87. package/dist/chat/subagent-list.d.ts +16 -0
  88. package/dist/chat/subagent-list.js +76 -0
  89. package/dist/chat/subagent-support.d.ts +6 -0
  90. package/dist/chat/subagent-support.js +14 -0
  91. package/dist/chat/subagent-view.d.ts +33 -0
  92. package/dist/chat/subagent-view.js +65 -0
  93. package/dist/chat/thumbnails.d.ts +10 -0
  94. package/dist/chat/thumbnails.js +87 -0
  95. package/dist/chat/timeline-scroll.d.ts +16 -0
  96. package/dist/chat/timeline-scroll.js +100 -0
  97. package/dist/chat/ui/AccountPill.d.ts +3 -0
  98. package/dist/chat/ui/AccountPill.js +24 -0
  99. package/dist/chat/ui/BookmarkMarker.d.ts +8 -0
  100. package/dist/chat/ui/BookmarkMarker.js +59 -0
  101. package/dist/chat/ui/BookmarkSubmenu.d.ts +3 -0
  102. package/dist/chat/ui/BookmarkSubmenu.js +44 -0
  103. package/dist/chat/ui/ChatActivity.d.ts +3 -0
  104. package/dist/chat/ui/ChatActivity.js +87 -0
  105. package/dist/chat/ui/ChatReferenceChip.d.ts +4 -0
  106. package/dist/chat/ui/ChatReferenceChip.js +17 -0
  107. package/dist/chat/ui/CodeBlock.d.ts +4 -0
  108. package/dist/chat/ui/CodeBlock.js +130 -0
  109. package/dist/chat/ui/Composer.d.ts +14 -0
  110. package/dist/chat/ui/Composer.js +821 -0
  111. package/dist/chat/ui/ComposerInput.d.ts +28 -0
  112. package/dist/chat/ui/ComposerInput.js +118 -0
  113. package/dist/chat/ui/DiffPool.d.ts +5 -0
  114. package/dist/chat/ui/DiffPool.js +26 -0
  115. package/dist/chat/ui/EditDiff.d.ts +4 -0
  116. package/dist/chat/ui/EditDiff.js +21 -0
  117. package/dist/chat/ui/FadingWords.d.ts +3 -0
  118. package/dist/chat/ui/FadingWords.js +5 -0
  119. package/dist/chat/ui/ImageView.d.ts +6 -0
  120. package/dist/chat/ui/ImageView.js +85 -0
  121. package/dist/chat/ui/LimitState.d.ts +8 -0
  122. package/dist/chat/ui/LimitState.js +117 -0
  123. package/dist/chat/ui/Markdown.d.ts +18 -0
  124. package/dist/chat/ui/Markdown.js +158 -0
  125. package/dist/chat/ui/MessageActions.d.ts +9 -0
  126. package/dist/chat/ui/MessageActions.js +56 -0
  127. package/dist/chat/ui/Pickers.d.ts +15 -0
  128. package/dist/chat/ui/Pickers.js +110 -0
  129. package/dist/chat/ui/PromptComposer.d.ts +13 -0
  130. package/dist/chat/ui/PromptComposer.js +48 -0
  131. package/dist/chat/ui/QuoteButton.d.ts +7 -0
  132. package/dist/chat/ui/QuoteButton.js +76 -0
  133. package/dist/chat/ui/ResumeCompactionDock.d.ts +5 -0
  134. package/dist/chat/ui/ResumeCompactionDock.js +15 -0
  135. package/dist/chat/ui/RunSettings.d.ts +25 -0
  136. package/dist/chat/ui/RunSettings.js +148 -0
  137. package/dist/chat/ui/Scrubber.d.ts +17 -0
  138. package/dist/chat/ui/Scrubber.js +121 -0
  139. package/dist/chat/ui/SubagentControls.d.ts +11 -0
  140. package/dist/chat/ui/SubagentControls.js +37 -0
  141. package/dist/chat/ui/SubagentStopButton.d.ts +7 -0
  142. package/dist/chat/ui/SubagentStopButton.js +36 -0
  143. package/dist/chat/ui/SubagentTimeline.d.ts +4 -0
  144. package/dist/chat/ui/SubagentTimeline.js +92 -0
  145. package/dist/chat/ui/Timeline.d.ts +5 -0
  146. package/dist/chat/ui/Timeline.js +318 -0
  147. package/dist/chat/ui/TimelineMenu.d.ts +12 -0
  148. package/dist/chat/ui/TimelineMenu.js +61 -0
  149. package/dist/chat/ui/UnifiedDiff.d.ts +8 -0
  150. package/dist/chat/ui/UnifiedDiff.js +51 -0
  151. package/dist/chat/ui/UploadThumb.d.ts +4 -0
  152. package/dist/chat/ui/UploadThumb.js +11 -0
  153. package/dist/chat/ui/chips.d.ts +4 -0
  154. package/dist/chat/ui/chips.js +11 -0
  155. package/dist/chat/ui/code-lines.d.ts +18 -0
  156. package/dist/chat/ui/code-lines.js +46 -0
  157. package/dist/chat/ui/code-streaming.d.ts +1 -0
  158. package/dist/chat/ui/code-streaming.js +3 -0
  159. package/dist/chat/ui/code-theme.d.ts +3 -0
  160. package/dist/chat/ui/code-theme.js +10 -0
  161. package/dist/chat/ui/composer/chips.d.ts +6 -0
  162. package/dist/chat/ui/composer/chips.js +29 -0
  163. package/dist/chat/ui/composer/editor.d.ts +11 -0
  164. package/dist/chat/ui/composer/editor.js +94 -0
  165. package/dist/chat/ui/composer/keys.d.ts +30 -0
  166. package/dist/chat/ui/composer/keys.js +98 -0
  167. package/dist/chat/ui/diff-theme.d.ts +2 -0
  168. package/dist/chat/ui/diff-theme.js +20 -0
  169. package/dist/chat/ui/file-links.d.ts +5 -0
  170. package/dist/chat/ui/file-links.js +18 -0
  171. package/dist/chat/ui/find-reveal.d.ts +7 -0
  172. package/dist/chat/ui/find-reveal.js +13 -0
  173. package/dist/chat/ui/icons.d.ts +4 -0
  174. package/dist/chat/ui/icons.js +20 -0
  175. package/dist/chat/ui/markdown-blocks.d.ts +6 -0
  176. package/dist/chat/ui/markdown-blocks.js +101 -0
  177. package/dist/chat/ui/quote-selection.d.ts +3 -0
  178. package/dist/chat/ui/quote-selection.js +44 -0
  179. package/dist/chat/ui/rehype-chips.d.ts +23 -0
  180. package/dist/chat/ui/rehype-chips.js +28 -0
  181. package/dist/chat/ui/rehype-fade.d.ts +23 -0
  182. package/dist/chat/ui/rehype-fade.js +30 -0
  183. package/dist/chat/ui/remark-html-as-text.d.ts +8 -0
  184. package/dist/chat/ui/remark-html-as-text.js +24 -0
  185. package/dist/chat/ui/reveal.d.ts +13 -0
  186. package/dist/chat/ui/reveal.js +112 -0
  187. package/dist/chat/ui/rows/ForksRow.d.ts +4 -0
  188. package/dist/chat/ui/rows/ForksRow.js +40 -0
  189. package/dist/chat/ui/rows/MessageRows.d.ts +36 -0
  190. package/dist/chat/ui/rows/MessageRows.js +190 -0
  191. package/dist/chat/ui/rows/Rows.d.ts +12 -0
  192. package/dist/chat/ui/rows/Rows.js +49 -0
  193. package/dist/chat/ui/rows/SubagentRow.d.ts +15 -0
  194. package/dist/chat/ui/rows/SubagentRow.js +98 -0
  195. package/dist/chat/ui/rows/WorkRows.d.ts +46 -0
  196. package/dist/chat/ui/rows/WorkRows.js +143 -0
  197. package/dist/chat/ui/rows/WorkflowRow.d.ts +7 -0
  198. package/dist/chat/ui/rows/WorkflowRow.js +37 -0
  199. package/dist/chat/ui/rows/row-rhythm.d.ts +3 -0
  200. package/dist/chat/ui/rows/row-rhythm.js +14 -0
  201. package/dist/chat/ui/useToggleSet.d.ts +6 -0
  202. package/dist/chat/ui/useToggleSet.js +25 -0
  203. package/dist/host.d.ts +167 -0
  204. package/dist/host.js +41 -0
  205. package/dist/lazy.d.ts +5 -0
  206. package/dist/lazy.js +35 -0
  207. package/dist/locales/en/agent-chat.json +417 -0
  208. package/dist/locales/en/agent-prompts.json +42 -0
  209. package/dist/locales/en/agent-providers.json +131 -0
  210. package/dist/locales/en/agent-usage.json +131 -0
  211. package/dist/locales/nl/agent-chat.json +417 -0
  212. package/dist/locales/nl/agent-prompts.json +42 -0
  213. package/dist/locales/nl/agent-providers.json +131 -0
  214. package/dist/locales/nl/agent-usage.json +131 -0
  215. package/dist/locales.d.ts +5 -0
  216. package/dist/locales.js +18 -0
  217. package/dist/mounted-registry.d.ts +7 -0
  218. package/dist/mounted-registry.js +39 -0
  219. package/dist/port-transport.d.ts +6 -0
  220. package/dist/port-transport.js +120 -0
  221. package/dist/prompts/logic/focus.d.ts +1 -0
  222. package/dist/prompts/logic/focus.js +17 -0
  223. package/dist/prompts/logic/keys.d.ts +42 -0
  224. package/dist/prompts/logic/keys.js +84 -0
  225. package/dist/prompts/logic/prompts.d.ts +34 -0
  226. package/dist/prompts/logic/prompts.fixtures.d.ts +5 -0
  227. package/dist/prompts/logic/prompts.fixtures.js +73 -0
  228. package/dist/prompts/logic/prompts.js +22 -0
  229. package/dist/prompts/logic/subjects.d.ts +49 -0
  230. package/dist/prompts/logic/subjects.js +56 -0
  231. package/dist/prompts/logic/useFocusAfterAnswer.d.ts +6 -0
  232. package/dist/prompts/logic/useFocusAfterAnswer.js +28 -0
  233. package/dist/prompts/logic/usePromptSession.d.ts +24 -0
  234. package/dist/prompts/logic/usePromptSession.js +87 -0
  235. package/dist/prompts/ui/ApprovalBody.d.ts +13 -0
  236. package/dist/prompts/ui/ApprovalBody.js +35 -0
  237. package/dist/prompts/ui/PromptActions.d.ts +26 -0
  238. package/dist/prompts/ui/PromptActions.js +19 -0
  239. package/dist/prompts/ui/PromptCard.d.ts +16 -0
  240. package/dist/prompts/ui/PromptCard.js +50 -0
  241. package/dist/prompts/ui/PromptView.d.ts +2 -0
  242. package/dist/prompts/ui/PromptView.js +47 -0
  243. package/dist/prompts/ui/QuestionBody.d.ts +9 -0
  244. package/dist/prompts/ui/QuestionBody.js +87 -0
  245. package/dist/providers/AccountColors.d.ts +5 -0
  246. package/dist/providers/AccountColors.js +8 -0
  247. package/dist/providers/AccountDetail.d.ts +12 -0
  248. package/dist/providers/AccountDetail.js +76 -0
  249. package/dist/providers/AccountVariables.d.ts +8 -0
  250. package/dist/providers/AccountVariables.js +48 -0
  251. package/dist/providers/AddAccountForm.d.ts +10 -0
  252. package/dist/providers/AddAccountForm.js +58 -0
  253. package/dist/providers/CliDetail.d.ts +11 -0
  254. package/dist/providers/CliDetail.js +62 -0
  255. package/dist/providers/ProvidersPane.d.ts +8 -0
  256. package/dist/providers/ProvidersPane.js +90 -0
  257. package/dist/providers/account-actions.d.ts +7 -0
  258. package/dist/providers/account-actions.js +53 -0
  259. package/dist/providers/parts.d.ts +9 -0
  260. package/dist/providers/parts.js +18 -0
  261. package/dist/providers/provider-abilities.d.ts +2 -0
  262. package/dist/providers/provider-abilities.js +7 -0
  263. package/dist/providers/variables.d.ts +13 -0
  264. package/dist/providers/variables.js +53 -0
  265. package/dist/scope.d.ts +11 -0
  266. package/dist/scope.js +10 -0
  267. package/dist/settings/sections.d.ts +13 -0
  268. package/dist/settings/sections.js +30 -0
  269. package/dist/state/chats.d.ts +32 -0
  270. package/dist/state/chats.js +124 -0
  271. package/dist/state/provider-accounts.d.ts +17 -0
  272. package/dist/state/provider-accounts.js +63 -0
  273. package/dist/state/providers.d.ts +17 -0
  274. package/dist/state/providers.js +29 -0
  275. package/dist/state/usage.d.ts +41 -0
  276. package/dist/state/usage.js +100 -0
  277. package/dist/theme.css +186 -0
  278. package/dist/transport.d.ts +24 -0
  279. package/dist/transport.js +16 -0
  280. package/dist/ui/PlainTextarea.d.ts +2 -0
  281. package/dist/ui/PlainTextarea.js +5 -0
  282. package/dist/usage/LimitsList.d.ts +18 -0
  283. package/dist/usage/LimitsList.js +69 -0
  284. package/dist/usage/UsageBreakdown.d.ts +9 -0
  285. package/dist/usage/UsageBreakdown.js +69 -0
  286. package/dist/usage/UsageChart.d.ts +10 -0
  287. package/dist/usage/UsageChart.js +49 -0
  288. package/dist/usage/UsageDialog.d.ts +6 -0
  289. package/dist/usage/UsageDialog.js +15 -0
  290. package/dist/usage/UsageLimits.d.ts +1 -0
  291. package/dist/usage/UsageLimits.js +62 -0
  292. package/dist/usage/UsageLimitsCard.d.ts +4 -0
  293. package/dist/usage/UsageLimitsCard.js +27 -0
  294. package/dist/usage/UsagePage.d.ts +7 -0
  295. package/dist/usage/UsagePage.js +161 -0
  296. package/dist/usage/UsagePane.d.ts +3 -0
  297. package/dist/usage/UsagePane.js +24 -0
  298. package/dist/usage/UsageSummary.d.ts +12 -0
  299. package/dist/usage/UsageSummary.js +15 -0
  300. package/dist/usage/UsageTiles.d.ts +7 -0
  301. package/dist/usage/UsageTiles.js +19 -0
  302. package/dist/usage/format.d.ts +14 -0
  303. package/dist/usage/format.js +50 -0
  304. package/dist/usage/limit-groups.d.ts +22 -0
  305. package/dist/usage/limit-groups.js +78 -0
  306. package/dist/usage/limits.d.ts +4 -0
  307. package/dist/usage/limits.js +58 -0
  308. package/dist/usage/money.d.ts +1 -0
  309. package/dist/usage/money.js +13 -0
  310. package/dist/usage/summary.d.ts +34 -0
  311. package/dist/usage/summary.js +90 -0
  312. package/package.json +639 -2
package/LICENSE ADDED
@@ -0,0 +1,110 @@
1
+ # Functional Source License, Version 1.1, MIT Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-MIT
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 Bas Milius
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the MIT license that is effective on the second anniversary of the date we make
91
+ the Software available. On or after that date, you may use the Software under
92
+ the MIT license, in which case the following will apply:
93
+
94
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
95
+ this software and associated documentation files (the "Software"), to deal in
96
+ the Software without restriction, including without limitation the rights to
97
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98
+ of the Software, and to permit persons to whom the Software is furnished to do
99
+ so, subject to the following conditions:
100
+
101
+ The above copyright notice and this permission notice shall be included in all
102
+ copies or substantial portions of the Software.
103
+
104
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
107
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
109
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
110
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,144 @@
1
1
  # @ruimte/agents-react
2
2
 
3
- Ruimte's AI chat interface for React: the thread, composer and prompt cards, the providers pane and the usage page. This version is a placeholder; install a release.
3
+ Ruimte's AI chat for any React app that runs agent CLIs: the thread and its composer, the approval and question cards, the model and mode pickers, the providers settings pane and the usage page. React 19, Base UI, zustand, react-i18next and Tailwind 4, on top of `@ruimte/ui` and `@ruimte/agent-contracts`.
4
+
5
+ Import per file, the way `@ruimte/ui` does: `@ruimte/agents-react/chat/ui/Timeline`, `@ruimte/agents-react/transport`.
6
+
7
+ ## The seams
8
+
9
+ - **`ChatTransport`** (`transport`) is how the chat reaches whatever runs the chats: a typed request out of `AGENT_REQUEST_SCHEMAS` with its typed answer, the events of `AGENT_EVENT_SCHEMAS`, and the status of the link. A link that comes back counts as a fresh one: the chat asks `chat.list` again and attaches every open chat. `portTransport(port)` (`port-transport`) runs one over a `FramePort` of `@ruimte/agent-contracts/port`; its `close()` fails what still waits. A refusal carries a `code` (`errorCode`, `isConnectionError`).
10
+ - **`ChatScope`** (`scope`) is one host of chats as everything under `ChatScopeContext` sees it: an `id` for the stores that keep a row per host (providers, accounts, usage), `keyOf` and `owns` for the rows of the chats store, whose keys the app decides, the `transport`, and the `ChatClient` on it. An app with several hosts renders a scope per host; the usage page renders the host it shows as a scope of its own.
11
+ - **`setChatHost`** (`host`) hands over, once and before the first render, what only the app decides: its palette for account colors, toasts, its own actions (else every action is a request on the transport), file search for `@`, attached files, code themes, how replies stream, file links, find in a thread, dictation, prompts of its own beside a chat's, other chats to point at, the places of forks, tasks, confirmations, logins, project marks, and which settings section to open. Whatever an app leaves out is the chat without that part.
12
+ - **`setLazyPrefetch`** (`lazy`) hands the modules the chat loads lazily (the diff renderers) to the app's prefetcher.
13
+
14
+ ## Wiring it up
15
+
16
+ In the process that runs the chats, the host answers `AGENT_REQUEST_SCHEMAS` on a `MessagePort`. In the window:
17
+
18
+ ```tsx
19
+ import i18next from 'i18next';
20
+ import { ChatClient } from '@ruimte/agents-react/chat/chat-client';
21
+ import { portTransport } from '@ruimte/agents-react/port-transport';
22
+ import { ChatScopeContext, type ChatScope } from '@ruimte/agents-react/scope';
23
+ import { chatSink } from '@ruimte/agents-react/state/chats';
24
+ import { providerSinkFor } from '@ruimte/agents-react/state/providers';
25
+ import { watchProviderAccounts } from '@ruimte/agents-react/state/provider-accounts';
26
+ import { setChatHost } from '@ruimte/agents-react/host';
27
+ import { AGENTS_LOCALES } from '@ruimte/agents-react/locales';
28
+ import { setFormatSource } from '@ruimte/ui/format/locale';
29
+ import { FORMAT_LANGUAGE } from '@ruimte/ui/format/regions';
30
+ import { UI_LOCALES, UI_NAMESPACE } from '@ruimte/ui/locales';
31
+
32
+ // The port the utility process handed over, as the frames the chat speaks.
33
+ const transport = portTransport({
34
+ send: (frame) => port.postMessage(frame),
35
+ onFrame: (listener) => {
36
+ const onMessage = (event: MessageEvent) => listener(event.data);
37
+ port.addEventListener('message', onMessage);
38
+ port.start();
39
+ return () => port.removeEventListener('message', onMessage);
40
+ }
41
+ });
42
+
43
+ // One host, so a chat's own id is its key.
44
+ const scope: ChatScope = {
45
+ id: 'local',
46
+ keyOf: (chatId) => chatId,
47
+ owns: () => true,
48
+ transport,
49
+ chats: new ChatClient(transport, chatSink((chatId) => chatId), providerSinkFor('local'))
50
+ };
51
+ watchProviderAccounts(scope.id, transport);
52
+
53
+ setFormatSource({
54
+ language: () => i18next.language,
55
+ region: () => FORMAT_LANGUAGE,
56
+ subscribe: (onChange) => {
57
+ i18next.on('languageChanged', onChange);
58
+ return () => i18next.off('languageChanged', onChange);
59
+ }
60
+ });
61
+ setChatHost({ notify: (toast) => showToast(toast), openSettings: (section) => openSettings(section) });
62
+
63
+ // The words: the ui namespace and the chat's own, in the language on screen.
64
+ i18next.addResourceBundle(language, UI_NAMESPACE, (await UI_LOCALES[language]!()).default, true, true);
65
+ for (const [namespace, words] of Object.entries(await AGENTS_LOCALES[language]!())) {
66
+ i18next.addResourceBundle(language, namespace, words, true, true);
67
+ }
68
+ ```
69
+
70
+ A chat, opened while it is on screen:
71
+
72
+ ```tsx
73
+ import { useEffect } from 'react';
74
+ import DiffPool from '@ruimte/agents-react/chat/ui/DiffPool';
75
+ import { Composer } from '@ruimte/agents-react/chat/ui/Composer';
76
+ import { Timeline } from '@ruimte/agents-react/chat/ui/Timeline';
77
+ import { useChatRow } from '@ruimte/agents-react/state/chats';
78
+ import DiffWorker from '@pierre/diffs/worker/worker.js?worker';
79
+
80
+ function Chat({ chatId }: { chatId: string }) {
81
+ const info = useChatRow(chatId, (row) => row?.info);
82
+ useEffect(() => {
83
+ void scope.chats.open(chatId, { cwd: projectFolder });
84
+ return () => void scope.chats.detach(chatId);
85
+ }, [chatId]);
86
+ return (
87
+ <DiffPool workerFactory={() => new DiffWorker()}>
88
+ <Timeline
89
+ chatId={chatId}
90
+ composer={
91
+ info && (
92
+ <Composer
93
+ chatId={chatId}
94
+ info={info}
95
+ focused
96
+ disabled={transport.status !== 'open'}
97
+ providerFixed={false}
98
+ onSend={(text, extras) => void scope.chats.send(chatId, text, extras)}
99
+ onRetarget={(provider, selection) => void scope.chats.retarget(chatId, provider, selection)}
100
+ />
101
+ )
102
+ }
103
+ />
104
+ </DiffPool>
105
+ );
106
+ }
107
+
108
+ <ChatScopeContext.Provider value={scope}>
109
+ <Chat chatId="chat-1" />
110
+ </ChatScopeContext.Provider>;
111
+ ```
112
+
113
+ The stylesheet goes right after the ui theme, and Tailwind scans both packages. The markdown of a thread builds on the typography plugin, and a few rules read the terminal colors (`--term-bg`, `--term-fg`, `--term-green`, `--term-red`) and the find colors (`--find-current`) an app defines:
114
+
115
+ ```css
116
+ @import "tailwindcss";
117
+ @import "@ruimte/ui/theme.css";
118
+ @import "@ruimte/agents-react/theme.css";
119
+ @source "<path to>/@ruimte/ui/src";
120
+ @source "<path to>/@ruimte/agents-react/src";
121
+ @plugin "@tailwindcss/typography";
122
+ ```
123
+
124
+ ## Settings and usage
125
+
126
+ `settings/sections` describes the two sections this package brings to the settings dialog of `@ruimte/ui`; `settingsSection` makes the entry the dialog takes, with the pane the app hands it:
127
+
128
+ ```tsx
129
+ import { ProvidersPane } from '@ruimte/agents-react/providers/ProvidersPane';
130
+ import { PROVIDERS_SECTION, USAGE_SECTION, settingsSection } from '@ruimte/agents-react/settings/sections';
131
+ import { UsagePane } from '@ruimte/agents-react/usage/UsagePane';
132
+ import { SettingsDialog } from '@ruimte/ui/settings/SettingsDialog';
133
+
134
+ <SettingsDialog
135
+ groups={[{ label: null, sections: [settingsSection(PROVIDERS_SECTION, ProvidersPane), settingsSection(USAGE_SECTION, () => <UsagePane onOpenPage={openUsage} />)] }]}
136
+ {...rest}
137
+ />;
138
+ ```
139
+
140
+ `ProvidersPane` takes the `target` a search result leads to and `detailOf`, for a provider the app draws itself. The usage page is `UsageDialog` around `UsagePage`, with an `ErrorBoundary` between them; `pickers` and `notice` take what the app says about the host itself. `UsageLimitsCard` draws the plan windows of the scope's host behind a trigger of the app's.
141
+
142
+ ## Rules
143
+
144
+ Nothing in `src` imports from an app or from `@ruimte/contracts` (`boundary.test.ts`), and every source file is exported under its own path. The words are the namespaces of `AGENTS_NAMESPACES`, English and Dutch, held against each other by `locales.test.ts`.
@@ -0,0 +1,4 @@
1
+ export declare function AccountDot({ color, className }: {
2
+ color: string | undefined;
3
+ className?: string;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import clsx from 'clsx';
3
+ import { accountColor } from './accounts';
4
+ /* The color an account wears, or the app's accent while it wears none of the accents. */
5
+ export function AccountDot({ color, className }) {
6
+ const paint = accountColor(color);
7
+ return (_jsx("span", { "aria-hidden": true, className: clsx('shrink-0 rounded-full', paint === undefined && 'bg-accent', className ?? 'size-2'), style: paint === undefined ? undefined : { background: paint } }));
8
+ }
@@ -0,0 +1,6 @@
1
+ import type { AgentKind } from '@ruimte/agent-contracts';
2
+ export declare function AgentIcon({ kind, size, className }: {
3
+ kind: AgentKind;
4
+ size?: number;
5
+ className?: string;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import clsx from 'clsx';
3
+ import { Bot } from 'lucide-react';
4
+ import { siClaude, siGithubcopilot, siGooglegemini } from 'simple-icons';
5
+ import { Icon } from '@ruimte/ui/Icon';
6
+ import { PROVIDER_PATHS } from './provider-paths';
7
+ // simple-icons removed OpenAI's mark at its request, so Codex reuses the usage page's path.
8
+ const MARKS = {
9
+ claude: siClaude,
10
+ codex: { title: 'Codex', path: PROVIDER_PATHS.codex },
11
+ gemini: siGooglegemini,
12
+ copilot: siGithubcopilot
13
+ };
14
+ export function AgentIcon({ kind, size = 14, className }) {
15
+ const mark = MARKS[kind];
16
+ if (!mark) {
17
+ return _jsx(Icon, { icon: Bot, size: size, className: className });
18
+ }
19
+ return (_jsx("svg", { role: "img", "aria-label": mark.title, viewBox: "0 0 24 24", width: size, height: size, fill: "currentColor", className: clsx('align-middle', className), children: _jsx("path", { d: mark.path }) }));
20
+ }
@@ -0,0 +1,8 @@
1
+ import type { UsageProvider } from '@ruimte/agent-contracts';
2
+ interface ProviderLogoProps {
3
+ provider: UsageProvider;
4
+ size?: number;
5
+ className?: string;
6
+ }
7
+ export declare function ProviderLogo({ provider, size, className }: ProviderLogoProps): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import clsx from 'clsx';
3
+ import { PROVIDER_PATHS } from './provider-paths';
4
+ /* The 24 by 24 box both marks are drawn in, so one size renders them at the same weight. */
5
+ const VIEW_BOX = '0 0 24 24';
6
+ export function ProviderLogo({ provider, size = 14, className }) {
7
+ return (_jsx("svg", { "aria-hidden": true, viewBox: VIEW_BOX, width: size, height: size, fill: "currentColor", className: clsx('shrink-0', className), children: _jsx("path", { d: PROVIDER_PATHS[provider] }) }));
8
+ }
@@ -0,0 +1,7 @@
1
+ import type { AgentKind, ProviderAccounts, UsageLimitsProvider, UsageLimitsSnapshot, UsageWindow } from '@ruimte/agent-contracts';
2
+ import { type AccountEntry } from './accounts';
3
+ export declare const limitsAccountId: (entry: UsageLimitsProvider) => string;
4
+ export declare const limitsOfAccount: (snapshot: UsageLimitsSnapshot | null, id: string) => UsageLimitsProvider | null;
5
+ export declare const sessionWindow: (entry: UsageLimitsProvider | null) => UsageWindow | null;
6
+ export declare const continueTarget: (accounts: ProviderAccounts | null, snapshot: UsageLimitsSnapshot | null, kind: AgentKind, current: string | undefined) => AccountEntry | null;
7
+ export declare const hasUnreadAccount: (accounts: ProviderAccounts | null, snapshot: UsageLimitsSnapshot | null, kind: AgentKind, current: string | undefined) => boolean;
@@ -0,0 +1,26 @@
1
+ import { accountsOfKind } from './accounts';
2
+ /* The account a plan entry is of; an entry from a machine before accounts is its CLI's default account. */
3
+ export const limitsAccountId = (entry) => entry.account?.id ?? entry.kind;
4
+ export const limitsOfAccount = (snapshot, id) => snapshot?.providers.find((entry) => limitsAccountId(entry) === id) ?? null;
5
+ export const sessionWindow = (entry) => entry?.windows.find((window) => window.kind === 'session') ?? null;
6
+ /* The numbers were read, and no window of the plan is spent. An account never read has no known room. */
7
+ const hasRoom = (entry) => entry !== null && entry.checkedAt > 0 && entry.unavailable === null && entry.windows.length > 0 && entry.windows.every((window) => window.used < 1);
8
+ /* What a turn of this account would run into first: its session window, else its fullest one. */
9
+ const pressure = (entry) => sessionWindow(entry)?.used ?? Math.max(...entry.windows.map((window) => window.used));
10
+ /* The other accounts of the CLI a chat could go on under right now: on, and signed in. */
11
+ const others = (accounts, kind, current) => accountsOfKind(accounts, kind).filter((entry) => entry.id !== (current ?? kind) && entry.account.enabled !== false && entry.status?.state === 'ready');
12
+ /*
13
+ * The account a chat that stopped on a limit could go on under: another one of its CLI that is on,
14
+ * signed in and has room, the one with the least of its session spent. Null when none has room, or
15
+ * none was read yet; the choice is only ever offered, never made.
16
+ */
17
+ export const continueTarget = (accounts, snapshot, kind, current) => {
18
+ const roomy = others(accounts, kind, current).flatMap((entry) => {
19
+ const limits = limitsOfAccount(snapshot, entry.id);
20
+ return hasRoom(limits) ? [{ entry, pressure: pressure(limits) }] : [];
21
+ });
22
+ roomy.sort((a, b) => a.pressure - b.pressure);
23
+ return roomy[0]?.entry ?? null;
24
+ };
25
+ /* Whether another account a chat could go on under has no numbers yet, since the machine only reads one in use by itself. */
26
+ export const hasUnreadAccount = (accounts, snapshot, kind, current) => others(accounts, kind, current).some((entry) => (limitsOfAccount(snapshot, entry.id)?.checkedAt ?? 0) === 0);
@@ -0,0 +1,22 @@
1
+ import type { AgentKind, ProviderAccount, ProviderAccounts, ProviderAccountStatus } from '@ruimte/agent-contracts';
2
+ export declare const accountColor: (color: string | undefined) => string | undefined;
3
+ export declare const FOLDER_VARIABLES: Partial<Record<AgentKind, string>>;
4
+ export interface AccountEntry {
5
+ id: string;
6
+ account: ProviderAccount;
7
+ status: ProviderAccountStatus | null;
8
+ isDefault: boolean;
9
+ }
10
+ export declare const accountsOfKind: (accounts: ProviderAccounts | null, kind: AgentKind) => AccountEntry[];
11
+ export declare const accountName: (entry: Pick<AccountEntry, 'id' | 'account' | 'isDefault'>, providerName: string) => string;
12
+ export type AccountTone = 'muted' | 'needs-you' | 'error';
13
+ export declare const ACCOUNT_TONE_CLASSES: Record<AccountTone, string>;
14
+ export declare const accountStatusLine: (status: ProviderAccountStatus | null, canLogIn: boolean) => {
15
+ text: string;
16
+ tone: AccountTone;
17
+ };
18
+ export declare const mintAccountId: (kind: AgentKind, label: string, taken: ReadonlySet<string>) => string;
19
+ export declare const freeAccountColor: (entries: readonly AccountEntry[], fallback: string) => string;
20
+ export declare const offeredAccounts: (entries: readonly AccountEntry[], current: string | undefined) => AccountEntry[];
21
+ export declare const hasAccountChoice: (entries: readonly AccountEntry[]) => boolean;
22
+ export declare const canContinueOn: (accounts: ProviderAccounts | null, kind: AgentKind, from: string | undefined, to: string | undefined) => boolean;
@@ -0,0 +1,103 @@
1
+ import i18next from 'i18next';
2
+ import { chatHost } from '../host';
3
+ /*
4
+ * An account wears one of the host's accents, so the app paints from one palette. A color that is none
5
+ * of them (an older name, or one written by hand) reads as undefined, and the dot takes the accent.
6
+ */
7
+ export const accountColor = (color) => chatHost().accents.all.find((entry) => entry.id === color)?.color;
8
+ /*
9
+ * The variable each CLI reads its config folder from, as the host's providers name them. Only for
10
+ * the sentence under the folder; a CLI missing here still works, the sentence just does not name it.
11
+ */
12
+ export const FOLDER_VARIABLES = { claude: 'CLAUDE_CONFIG_DIR', codex: 'CODEX_HOME' };
13
+ /* The accounts of one CLI, its default one first and the others in the order the machine keeps them. */
14
+ export const accountsOfKind = (accounts, kind) => {
15
+ if (accounts === null) {
16
+ return [];
17
+ }
18
+ const statuses = new Map(accounts.statuses.map((status) => [status.id, status]));
19
+ return Object.entries(accounts.accounts)
20
+ .filter(([, account]) => account.kind === kind)
21
+ .map(([id, account]) => ({ id, account, status: statuses.get(id) ?? null, isDefault: id === kind }))
22
+ .sort((a, b) => Number(b.isDefault) - Number(a.isDefault));
23
+ };
24
+ /* A default account nobody named goes by its CLI's name. */
25
+ export const accountName = (entry, providerName) => entry.account.label ?? (entry.isDefault ? providerName : entry.id);
26
+ export const ACCOUNT_TONE_CLASSES = {
27
+ muted: 'text-text-muted',
28
+ 'needs-you': 'text-status-needs-you',
29
+ error: 'text-status-error'
30
+ };
31
+ /*
32
+ * What an account's row says about it, in a few words. `canLogIn` is false for a CLI without a config
33
+ * folder: it has no login of its own to report, so being there is all a ready one says.
34
+ */
35
+ export const accountStatusLine = (status, canLogIn) => {
36
+ const words = (key, values) => i18next.t(`agent-providers:status.${key}`, values);
37
+ switch (status?.state ?? 'checking') {
38
+ case 'checking':
39
+ return { text: words('checking'), tone: 'muted' };
40
+ case 'disabled':
41
+ return { text: words('disabled'), tone: 'muted' };
42
+ case 'not-found':
43
+ return { text: words('notFound'), tone: 'muted' };
44
+ case 'signed-out':
45
+ return { text: words('signedOut'), tone: 'needs-you' };
46
+ case 'ready':
47
+ if (!canLogIn) {
48
+ return { text: words('available'), tone: 'muted' };
49
+ }
50
+ return { text: status?.plan ? words('readyPlan', { plan: status.plan }) : words('ready'), tone: 'muted' };
51
+ case 'folder-missing':
52
+ return { text: words('folderMissing'), tone: 'error' };
53
+ case 'unavailable':
54
+ return { text: words('unavailable'), tone: 'muted' };
55
+ case 'failed':
56
+ return { text: words('failed'), tone: 'error' };
57
+ }
58
+ };
59
+ /* The part of a name an id can hold, the way the machine makes one: `Work (EU)` becomes `work-eu`. */
60
+ const slugOf = (label) => label
61
+ .normalize('NFKD')
62
+ .replace(/[̀-ͯ]/g, '')
63
+ .toLowerCase()
64
+ .replace(/[^a-z0-9]+/g, '-')
65
+ .replace(/^-+|-+$/g, '');
66
+ /* A free id for an account a person links to a folder of their own; one the machine makes gets its id from the machine. */
67
+ export const mintAccountId = (kind, label, taken) => {
68
+ const base = `${kind}_${slugOf(label) || 'account'}`.slice(0, 60).replace(/-+$/, '');
69
+ let id = base;
70
+ for (let suffix = 2; taken.has(id); suffix += 1) {
71
+ id = `${base}-${suffix}`;
72
+ }
73
+ return id;
74
+ };
75
+ /*
76
+ * The first featured accent no account of the CLI wears yet, then any other, so a new one stands apart.
77
+ * An account without a color of its own wears `fallback`, the accent the app is painted in.
78
+ */
79
+ export const freeAccountColor = (entries, fallback) => {
80
+ const { all, featured } = chatHost().accents;
81
+ const worn = new Set(entries.map((entry) => (accountColor(entry.account.color) === undefined ? fallback : entry.account.color)));
82
+ const choices = [...featured, ...all.map((entry) => entry.id).filter((id) => !featured.includes(id))];
83
+ return choices.find((id) => !worn.has(id)) ?? featured[entries.length % featured.length] ?? fallback;
84
+ };
85
+ /* The accounts of a CLI a picker offers: every one that is on, and the one in use even while it is off. */
86
+ export const offeredAccounts = (entries, current) => entries.filter((entry) => entry.account.enabled !== false || entry.id === current);
87
+ /* Whether a person has a choice of account for this CLI at all, which is when a chat shows its account. */
88
+ export const hasAccountChoice = (entries) => entries.filter((entry) => entry.account.enabled !== false).length >= 2;
89
+ /*
90
+ * Whether a chat of one account can go on under another, the way the machine decides it: the same
91
+ * account, or two of the chat's CLI that write their conversations to one folder. A machine that does
92
+ * not say where an account writes them answers no, so the person forks instead of being refused.
93
+ */
94
+ export const canContinueOn = (accounts, kind, from, to) => {
95
+ const fromId = from ?? kind;
96
+ const toId = to ?? kind;
97
+ if (fromId === toId) {
98
+ return true;
99
+ }
100
+ const folderOf = (id) => accounts?.accounts[id]?.kind === kind ? accounts.statuses.find((status) => status.id === id)?.transcripts : undefined;
101
+ const folder = folderOf(fromId);
102
+ return folder !== undefined && folder !== '' && folder === folderOf(toId);
103
+ };
@@ -0,0 +1,6 @@
1
+ import type { AgentKind, ModelInfo } from '@ruimte/agent-contracts';
2
+ export declare const modelNameFromSlug: (slug: string) => string;
3
+ export declare const modelName: (slug: string, models: readonly ModelInfo[] | undefined) => string;
4
+ export declare const useModelName: (provider: AgentKind | undefined, slug: string) => string;
5
+ export declare const sharedModelPrefix: (models: readonly ModelInfo[]) => string;
6
+ export declare const shortModelName: (name: string, models: readonly ModelInfo[] | undefined) => string;
@@ -0,0 +1,44 @@
1
+ import { useProviders } from '../state/providers';
2
+ /*
3
+ * A model id as a person reads it, for a model no catalog names: without its vendor prefix and its
4
+ * date, and with the version number put back together (`claude-opus-4-5` is one 4.5, not a 4 and a
5
+ * 5).
6
+ */
7
+ export const modelNameFromSlug = (slug) => {
8
+ const bare = slug.slice(slug.lastIndexOf('/') + 1).replace(/-\d{6,8}$/, '');
9
+ const words = [];
10
+ for (const word of bare.split('-')) {
11
+ const previous = words.at(-1);
12
+ if (previous !== undefined && /^\d+$/.test(word) && /\d$/.test(previous)) {
13
+ words[words.length - 1] = `${previous}.${word}`;
14
+ continue;
15
+ }
16
+ words.push(word);
17
+ }
18
+ return words.map((word) => (word === 'gpt' ? 'GPT' : word.charAt(0).toUpperCase() + word.slice(1))).join(' ');
19
+ };
20
+ /* What the CLI calls the model, so every surface says the same thing; a slug it no longer offers is read as one. */
21
+ export const modelName = (slug, models) => models?.find((entry) => entry.slug === slug)?.name ?? modelNameFromSlug(slug);
22
+ /* The same answer for the machine in scope, whose catalog is the only one that can name the slug. */
23
+ export const useModelName = (provider, slug) => useProviders((state) => modelName(slug, state.providers.find((entry) => entry.kind === provider)?.models));
24
+ /*
25
+ * The leading words every model of a catalog shares, so a tight spot can say `Opus 5.5` where the
26
+ * CLI says `Claude Opus 5.5`. Whole words only, so `GPT-6` never loses its `GPT-`, and never all of a name.
27
+ */
28
+ export const sharedModelPrefix = (models) => {
29
+ const names = models.map((entry) => entry.name.split(' '));
30
+ const first = names[0];
31
+ if (first === undefined || names.length < 2) {
32
+ return '';
33
+ }
34
+ let count = 0;
35
+ while (names.every((words) => words.length > count + 1 && words[count] === first[count])) {
36
+ count++;
37
+ }
38
+ return count === 0 ? '' : `${first.slice(0, count).join(' ')} `;
39
+ };
40
+ /* A model's name without the words its whole catalog shares. */
41
+ export const shortModelName = (name, models) => {
42
+ const prefix = sharedModelPrefix(models ?? []);
43
+ return prefix !== '' && name.startsWith(prefix) ? name.slice(prefix.length) : name;
44
+ };
@@ -0,0 +1,2 @@
1
+ import type { UsageProvider } from '@ruimte/agent-contracts';
2
+ export declare const PROVIDER_PATHS: Record<UsageProvider, string>;
@@ -0,0 +1,8 @@
1
+ /*
2
+ * The marks of Anthropic and OpenAI. Lucide has no brand marks, so these are the icon rule's
3
+ * exception for provider marks. One path each, in `currentColor`, so a row decides how loud the logo is.
4
+ */
5
+ export const PROVIDER_PATHS = {
6
+ claude: 'M4.709 15.955l4.72-2.647.079-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.377-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.048.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.607.212-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.914-1.316-.012.01z',
7
+ codex: 'M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.554 5.554 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.019.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.001zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z'
8
+ };
@@ -0,0 +1,13 @@
1
+ import { type LucideIcon } from 'lucide-react';
2
+ export type StatusWord = 'running' | 'paused' | 'done' | 'failed' | 'cancelled';
3
+ export interface StatusLook {
4
+ icon: LucideIcon;
5
+ tone: string;
6
+ spins: boolean;
7
+ }
8
+ export declare const statusLookOf: (word: StatusWord) => StatusLook;
9
+ export interface TaskState {
10
+ status: 'open' | 'done' | 'failed' | 'cancelled';
11
+ paused?: object;
12
+ }
13
+ export declare const taskStatusWord: (task: TaskState) => StatusWord;
@@ -0,0 +1,22 @@
1
+ import { CircleCheck, CircleSlash, CircleX, Hourglass, LoaderCircle } from 'lucide-react';
2
+ /*
3
+ * One state, one mark: an entry in the sub-agent flyout, a task on its node (`TaskMark`), what finished
4
+ * in the toolbar (`StatusSummary`) and work in progress in a toast. A spinner stops under reduced
5
+ * motion with every other animation (`styles.css`).
6
+ */
7
+ const LOOKS = {
8
+ running: { icon: LoaderCircle, tone: 'text-status-running', spins: true },
9
+ // The hourglass of a chat that stopped on a limit, since that is what holds the work up.
10
+ paused: { icon: Hourglass, tone: 'text-text-faint', spins: false },
11
+ done: { icon: CircleCheck, tone: 'text-status-idle', spins: false },
12
+ failed: { icon: CircleX, tone: 'text-status-error', spins: false },
13
+ cancelled: { icon: CircleSlash, tone: 'text-text-faint', spins: false }
14
+ };
15
+ export const statusLookOf = (word) => LOOKS[word];
16
+ /* A task calls its running state `open`, which is the host's word for it and not a person's; an open task whose child stopped on a limit is paused. */
17
+ export const taskStatusWord = (task) => {
18
+ if (task.status !== 'open') {
19
+ return task.status;
20
+ }
21
+ return task.paused === undefined ? 'running' : 'paused';
22
+ };
@@ -0,0 +1,11 @@
1
+ import type { AgentKind, ProviderAccounts } from '@ruimte/agent-contracts';
2
+ import { type AccountEntry } from '../agents/accounts';
3
+ export interface AccountChoice {
4
+ accounts: ProviderAccounts;
5
+ offered: AccountEntry[];
6
+ currentId: string;
7
+ current: AccountEntry | null;
8
+ providerName: string;
9
+ nameOf(entry: AccountEntry): string;
10
+ }
11
+ export declare const useAccountChoice: (kind: AgentKind | null, account: string | undefined) => AccountChoice | null;
@@ -0,0 +1,30 @@
1
+ import { useMemo } from 'react';
2
+ import { accountName, accountsOfKind, hasAccountChoice, offeredAccounts } from '../agents/accounts';
3
+ import { useProviderAccounts } from '../state/provider-accounts';
4
+ import { useProviders } from '../state/providers';
5
+ /*
6
+ * The accounts of a chat's CLI on the machine in scope and the one the chat runs under, or null while
7
+ * the CLI has fewer than two accounts that are on: with one there is nothing to choose or tell apart.
8
+ */
9
+ export const useAccountChoice = (kind, account) => {
10
+ const accounts = useProviderAccounts((row) => row.accounts);
11
+ const providerName = useProviders((row) => row.providers.find((entry) => entry.kind === kind)?.name) ?? kind ?? '';
12
+ return useMemo(() => {
13
+ if (kind === null || accounts === null) {
14
+ return null;
15
+ }
16
+ const entries = accountsOfKind(accounts, kind);
17
+ if (!hasAccountChoice(entries)) {
18
+ return null;
19
+ }
20
+ const currentId = account ?? kind;
21
+ return {
22
+ accounts,
23
+ offered: offeredAccounts(entries, currentId),
24
+ currentId,
25
+ current: entries.find((entry) => entry.id === currentId) ?? null,
26
+ providerName,
27
+ nameOf: (entry) => accountName(entry, providerName)
28
+ };
29
+ }, [accounts, kind, account, providerName]);
30
+ };
@@ -0,0 +1,6 @@
1
+ import { type ChatActions } from '../host';
2
+ import { type ChatScope } from '../scope';
3
+ import { type ChatTransport } from '../transport';
4
+ export declare const transportActions: (transport: ChatTransport) => ChatActions;
5
+ export declare const actionsOf: (scope: ChatScope) => ChatActions;
6
+ export declare const useChatActions: () => ChatActions;