@adecore/agents-react 0.0.1 → 0.17.0-beta.2

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 (513) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +61 -0
  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/ModelOptionControl.d.ts +15 -0
  8. package/dist/agents/ModelOptionControl.js +33 -0
  9. package/dist/agents/ProviderLogo.d.ts +8 -0
  10. package/dist/agents/ProviderLogo.js +8 -0
  11. package/dist/agents/account-limits.d.ts +7 -0
  12. package/dist/agents/account-limits.js +40 -0
  13. package/dist/agents/accounts.d.ts +22 -0
  14. package/dist/agents/accounts.js +113 -0
  15. package/dist/agents/model-name.d.ts +12 -0
  16. package/dist/agents/model-name.js +56 -0
  17. package/dist/agents/model-options.d.ts +5 -0
  18. package/dist/agents/model-options.js +15 -0
  19. package/dist/agents/provider-paths.d.ts +2 -0
  20. package/dist/agents/provider-paths.js +8 -0
  21. package/dist/agents/status-look.d.ts +13 -0
  22. package/dist/agents/status-look.js +24 -0
  23. package/dist/chat/account-choice.d.ts +11 -0
  24. package/dist/chat/account-choice.js +30 -0
  25. package/dist/chat/actions.d.ts +6 -0
  26. package/dist/chat/actions.js +68 -0
  27. package/dist/chat/activity.d.ts +5 -0
  28. package/dist/chat/activity.js +6 -0
  29. package/dist/chat/attachments.d.ts +23 -0
  30. package/dist/chat/attachments.js +86 -0
  31. package/dist/chat/bookmarks.d.ts +14 -0
  32. package/dist/chat/bookmarks.js +73 -0
  33. package/dist/chat/chat-client.d.ts +55 -0
  34. package/dist/chat/chat-client.js +279 -0
  35. package/dist/chat/chat-references.d.ts +5 -0
  36. package/dist/chat/chat-references.js +5 -0
  37. package/dist/chat/drafts.d.ts +29 -0
  38. package/dist/chat/drafts.js +116 -0
  39. package/dist/chat/forks.d.ts +2 -0
  40. package/dist/chat/forks.js +28 -0
  41. package/dist/chat/guards.d.ts +12 -0
  42. package/dist/chat/guards.js +69 -0
  43. package/dist/chat/logic/ansi.d.ts +13 -0
  44. package/dist/chat/logic/ansi.js +185 -0
  45. package/dist/chat/logic/answers.d.ts +1 -0
  46. package/dist/chat/logic/answers.js +8 -0
  47. package/dist/chat/logic/bookmarks.d.ts +5 -0
  48. package/dist/chat/logic/bookmarks.js +33 -0
  49. package/dist/chat/logic/context-usage.d.ts +12 -0
  50. package/dist/chat/logic/context-usage.js +21 -0
  51. package/dist/chat/logic/fork.d.ts +45 -0
  52. package/dist/chat/logic/fork.js +148 -0
  53. package/dist/chat/logic/handback.d.ts +2 -0
  54. package/dist/chat/logic/handback.js +8 -0
  55. package/dist/chat/logic/json.d.ts +1 -0
  56. package/dist/chat/logic/json.js +4 -0
  57. package/dist/chat/logic/limit.d.ts +7 -0
  58. package/dist/chat/logic/limit.js +34 -0
  59. package/dist/chat/logic/resume-compaction.d.ts +14 -0
  60. package/dist/chat/logic/resume-compaction.js +47 -0
  61. package/dist/chat/logic/scrubber.d.ts +50 -0
  62. package/dist/chat/logic/scrubber.js +220 -0
  63. package/dist/chat/logic/thread-cards.d.ts +3 -0
  64. package/dist/chat/logic/thread-cards.js +59 -0
  65. package/dist/chat/logic/timeline-copy.d.ts +4 -0
  66. package/dist/chat/logic/timeline-copy.js +59 -0
  67. package/dist/chat/logic/timeline-target.d.ts +12 -0
  68. package/dist/chat/logic/timeline-target.js +34 -0
  69. package/dist/chat/logic/timeline.d.ts +115 -0
  70. package/dist/chat/logic/timeline.js +343 -0
  71. package/dist/chat/logic/tool-catalog.d.ts +10 -0
  72. package/dist/chat/logic/tool-catalog.js +44 -0
  73. package/dist/chat/logic/tools.d.ts +15 -0
  74. package/dist/chat/logic/tools.js +82 -0
  75. package/dist/chat/logic/welcome.d.ts +2 -0
  76. package/dist/chat/logic/welcome.js +10 -0
  77. package/dist/chat/logic/workflow.d.ts +14 -0
  78. package/dist/chat/logic/workflow.js +47 -0
  79. package/dist/chat/mentions.d.ts +65 -0
  80. package/dist/chat/mentions.js +184 -0
  81. package/dist/chat/persisted-json.d.ts +5 -0
  82. package/dist/chat/persisted-json.js +58 -0
  83. package/dist/chat/preferences.d.ts +27 -0
  84. package/dist/chat/preferences.js +139 -0
  85. package/dist/chat/quote.d.ts +2 -0
  86. package/dist/chat/quote.js +25 -0
  87. package/dist/chat/recent-messages.d.ts +17 -0
  88. package/dist/chat/recent-messages.js +36 -0
  89. package/dist/chat/resume-compaction-dismissals.d.ts +3 -0
  90. package/dist/chat/resume-compaction-dismissals.js +14 -0
  91. package/dist/chat/runtime-modes.d.ts +4 -0
  92. package/dist/chat/runtime-modes.js +15 -0
  93. package/dist/chat/stash.d.ts +24 -0
  94. package/dist/chat/stash.js +91 -0
  95. package/dist/chat/subagent-conversation.d.ts +41 -0
  96. package/dist/chat/subagent-conversation.js +167 -0
  97. package/dist/chat/subagent-list.d.ts +19 -0
  98. package/dist/chat/subagent-list.js +106 -0
  99. package/dist/chat/subagent-support.d.ts +6 -0
  100. package/dist/chat/subagent-support.js +14 -0
  101. package/dist/chat/subagent-view.d.ts +35 -0
  102. package/dist/chat/subagent-view.js +96 -0
  103. package/dist/chat/thumbnails.d.ts +10 -0
  104. package/dist/chat/thumbnails.js +89 -0
  105. package/dist/chat/timeline-flash.d.ts +12 -0
  106. package/dist/chat/timeline-flash.js +16 -0
  107. package/dist/chat/timeline-scroll.d.ts +27 -0
  108. package/dist/chat/timeline-scroll.js +152 -0
  109. package/dist/chat/ui/AccountPill.d.ts +3 -0
  110. package/dist/chat/ui/AccountPill.js +23 -0
  111. package/dist/chat/ui/AnsiOutput.d.ts +5 -0
  112. package/dist/chat/ui/AnsiOutput.js +9 -0
  113. package/dist/chat/ui/BookmarkMarker.d.ts +8 -0
  114. package/dist/chat/ui/BookmarkMarker.js +57 -0
  115. package/dist/chat/ui/BookmarkSubmenu.d.ts +3 -0
  116. package/dist/chat/ui/BookmarkSubmenu.js +33 -0
  117. package/dist/chat/ui/ChatActivity.d.ts +7 -0
  118. package/dist/chat/ui/ChatActivity.js +84 -0
  119. package/dist/chat/ui/ChatReferenceChip.d.ts +4 -0
  120. package/dist/chat/ui/ChatReferenceChip.js +16 -0
  121. package/dist/chat/ui/CodeBlock.d.ts +4 -0
  122. package/dist/chat/ui/CodeBlock.js +132 -0
  123. package/dist/chat/ui/Composer.d.ts +15 -0
  124. package/dist/chat/ui/Composer.js +856 -0
  125. package/dist/chat/ui/ComposerInput.d.ts +29 -0
  126. package/dist/chat/ui/ComposerInput.js +127 -0
  127. package/dist/chat/ui/DiffPool.d.ts +5 -0
  128. package/dist/chat/ui/DiffPool.js +26 -0
  129. package/dist/chat/ui/EditDiff.d.ts +4 -0
  130. package/dist/chat/ui/EditDiff.js +21 -0
  131. package/dist/chat/ui/FadingWords.d.ts +3 -0
  132. package/dist/chat/ui/FadingWords.js +5 -0
  133. package/dist/chat/ui/ImageView.d.ts +6 -0
  134. package/dist/chat/ui/ImageView.js +81 -0
  135. package/dist/chat/ui/LimitState.d.ts +8 -0
  136. package/dist/chat/ui/LimitState.js +112 -0
  137. package/dist/chat/ui/Markdown.d.ts +18 -0
  138. package/dist/chat/ui/Markdown.js +159 -0
  139. package/dist/chat/ui/MessageActions.d.ts +9 -0
  140. package/dist/chat/ui/MessageActions.js +53 -0
  141. package/dist/chat/ui/Pickers.d.ts +21 -0
  142. package/dist/chat/ui/Pickers.js +111 -0
  143. package/dist/chat/ui/PromptComposer.d.ts +13 -0
  144. package/dist/chat/ui/PromptComposer.js +56 -0
  145. package/dist/chat/ui/QuoteButton.d.ts +7 -0
  146. package/dist/chat/ui/QuoteButton.js +74 -0
  147. package/dist/chat/ui/ResumeCompactionDock.d.ts +5 -0
  148. package/dist/chat/ui/ResumeCompactionDock.js +14 -0
  149. package/dist/chat/ui/RunSettings.d.ts +28 -0
  150. package/dist/chat/ui/RunSettings.js +153 -0
  151. package/dist/chat/ui/Scrubber.d.ts +17 -0
  152. package/dist/chat/ui/Scrubber.js +118 -0
  153. package/dist/chat/ui/SubagentControls.d.ts +11 -0
  154. package/dist/chat/ui/SubagentControls.js +36 -0
  155. package/dist/chat/ui/SubagentInfo.d.ts +4 -0
  156. package/dist/chat/ui/SubagentInfo.js +34 -0
  157. package/dist/chat/ui/SubagentStopButton.d.ts +7 -0
  158. package/dist/chat/ui/SubagentStopButton.js +34 -0
  159. package/dist/chat/ui/SubagentTimeline.d.ts +4 -0
  160. package/dist/chat/ui/SubagentTimeline.js +107 -0
  161. package/dist/chat/ui/Timeline.d.ts +6 -0
  162. package/dist/chat/ui/Timeline.js +424 -0
  163. package/dist/chat/ui/TimelineMenu.d.ts +12 -0
  164. package/dist/chat/ui/TimelineMenu.js +54 -0
  165. package/dist/chat/ui/UnifiedDiff.d.ts +11 -0
  166. package/dist/chat/ui/UnifiedDiff.js +66 -0
  167. package/dist/chat/ui/UploadThumb.d.ts +4 -0
  168. package/dist/chat/ui/UploadThumb.js +11 -0
  169. package/dist/chat/ui/Welcome.d.ts +4 -0
  170. package/dist/chat/ui/Welcome.js +16 -0
  171. package/dist/chat/ui/chips.d.ts +4 -0
  172. package/dist/chat/ui/chips.js +11 -0
  173. package/dist/chat/ui/code-lines.d.ts +18 -0
  174. package/dist/chat/ui/code-lines.js +46 -0
  175. package/dist/chat/ui/code-streaming.d.ts +1 -0
  176. package/dist/chat/ui/code-streaming.js +3 -0
  177. package/dist/chat/ui/code-theme.d.ts +3 -0
  178. package/dist/chat/ui/code-theme.js +12 -0
  179. package/dist/chat/ui/composer/chips.d.ts +6 -0
  180. package/dist/chat/ui/composer/chips.js +31 -0
  181. package/dist/chat/ui/composer/editor.d.ts +11 -0
  182. package/dist/chat/ui/composer/editor.js +98 -0
  183. package/dist/chat/ui/composer/insert.d.ts +2 -0
  184. package/dist/chat/ui/composer/insert.js +19 -0
  185. package/dist/chat/ui/composer/keys.d.ts +30 -0
  186. package/dist/chat/ui/composer/keys.js +100 -0
  187. package/dist/chat/ui/diff-theme.d.ts +2 -0
  188. package/dist/chat/ui/diff-theme.js +20 -0
  189. package/dist/chat/ui/file-links.d.ts +5 -0
  190. package/dist/chat/ui/file-links.js +20 -0
  191. package/dist/chat/ui/find-reveal.d.ts +7 -0
  192. package/dist/chat/ui/find-reveal.js +13 -0
  193. package/dist/chat/ui/full-diff.d.ts +6 -0
  194. package/dist/chat/ui/full-diff.js +19 -0
  195. package/dist/chat/ui/icons.d.ts +4 -0
  196. package/dist/chat/ui/icons.js +20 -0
  197. package/dist/chat/ui/markdown-blocks.d.ts +6 -0
  198. package/dist/chat/ui/markdown-blocks.js +103 -0
  199. package/dist/chat/ui/quote-selection.d.ts +3 -0
  200. package/dist/chat/ui/quote-selection.js +46 -0
  201. package/dist/chat/ui/rehype-chips.d.ts +23 -0
  202. package/dist/chat/ui/rehype-chips.js +32 -0
  203. package/dist/chat/ui/rehype-fade.d.ts +23 -0
  204. package/dist/chat/ui/rehype-fade.js +36 -0
  205. package/dist/chat/ui/remark-html-as-text.d.ts +8 -0
  206. package/dist/chat/ui/remark-html-as-text.js +26 -0
  207. package/dist/chat/ui/reply-context.d.ts +5 -0
  208. package/dist/chat/ui/reply-context.js +2 -0
  209. package/dist/chat/ui/reveal.d.ts +13 -0
  210. package/dist/chat/ui/reveal.js +114 -0
  211. package/dist/chat/ui/rows/ForksRow.d.ts +4 -0
  212. package/dist/chat/ui/rows/ForksRow.js +38 -0
  213. package/dist/chat/ui/rows/MessageRows.d.ts +40 -0
  214. package/dist/chat/ui/rows/MessageRows.js +204 -0
  215. package/dist/chat/ui/rows/Rows.d.ts +12 -0
  216. package/dist/chat/ui/rows/Rows.js +61 -0
  217. package/dist/chat/ui/rows/SubagentRow.d.ts +17 -0
  218. package/dist/chat/ui/rows/SubagentRow.js +101 -0
  219. package/dist/chat/ui/rows/TaskRow.d.ts +8 -0
  220. package/dist/chat/ui/rows/TaskRow.js +63 -0
  221. package/dist/chat/ui/rows/WorkRows.d.ts +47 -0
  222. package/dist/chat/ui/rows/WorkRows.js +168 -0
  223. package/dist/chat/ui/rows/WorkflowRow.d.ts +8 -0
  224. package/dist/chat/ui/rows/WorkflowRow.js +48 -0
  225. package/dist/chat/ui/rows/row-rhythm.d.ts +6 -0
  226. package/dist/chat/ui/rows/row-rhythm.js +34 -0
  227. package/dist/chat/ui/useToggleSet.d.ts +6 -0
  228. package/dist/chat/ui/useToggleSet.js +25 -0
  229. package/dist/host.d.ts +195 -0
  230. package/dist/host.js +55 -0
  231. package/dist/lazy.d.ts +6 -0
  232. package/dist/lazy.js +57 -0
  233. package/dist/locales/en/agent-chat.json +446 -0
  234. package/dist/locales/en/agent-prompts.json +42 -0
  235. package/dist/locales/en/agent-providers.json +131 -0
  236. package/dist/locales/en/agent-usage.json +131 -0
  237. package/dist/locales/nl/agent-chat.json +446 -0
  238. package/dist/locales/nl/agent-prompts.json +42 -0
  239. package/dist/locales/nl/agent-providers.json +131 -0
  240. package/dist/locales/nl/agent-usage.json +131 -0
  241. package/dist/locales.d.ts +5 -0
  242. package/dist/locales.js +20 -0
  243. package/dist/mounted-registry.d.ts +7 -0
  244. package/dist/mounted-registry.js +39 -0
  245. package/dist/port-transport.d.ts +6 -0
  246. package/dist/port-transport.js +129 -0
  247. package/dist/prompts/logic/focus.d.ts +2 -0
  248. package/dist/prompts/logic/focus.js +23 -0
  249. package/dist/prompts/logic/keys.d.ts +42 -0
  250. package/dist/prompts/logic/keys.js +94 -0
  251. package/dist/prompts/logic/prompts.d.ts +34 -0
  252. package/dist/prompts/logic/prompts.fixtures.d.ts +5 -0
  253. package/dist/prompts/logic/prompts.fixtures.js +79 -0
  254. package/dist/prompts/logic/prompts.js +32 -0
  255. package/dist/prompts/logic/subjects.d.ts +50 -0
  256. package/dist/prompts/logic/subjects.js +63 -0
  257. package/dist/prompts/logic/useFocusAfterAnswer.d.ts +6 -0
  258. package/dist/prompts/logic/useFocusAfterAnswer.js +28 -0
  259. package/dist/prompts/logic/usePromptSession.d.ts +24 -0
  260. package/dist/prompts/logic/usePromptSession.js +87 -0
  261. package/dist/prompts/ui/ApprovalBody.d.ts +13 -0
  262. package/dist/prompts/ui/ApprovalBody.js +34 -0
  263. package/dist/prompts/ui/PromptActions.d.ts +27 -0
  264. package/dist/prompts/ui/PromptActions.js +18 -0
  265. package/dist/prompts/ui/PromptCard.d.ts +16 -0
  266. package/dist/prompts/ui/PromptCard.js +50 -0
  267. package/dist/prompts/ui/PromptView.d.ts +2 -0
  268. package/dist/prompts/ui/PromptView.js +47 -0
  269. package/dist/prompts/ui/QuestionBody.d.ts +9 -0
  270. package/dist/prompts/ui/QuestionBody.js +87 -0
  271. package/dist/providers/AccountColors.d.ts +5 -0
  272. package/dist/providers/AccountColors.js +8 -0
  273. package/dist/providers/AccountDetail.d.ts +12 -0
  274. package/dist/providers/AccountDetail.js +69 -0
  275. package/dist/providers/AccountVariables.d.ts +8 -0
  276. package/dist/providers/AccountVariables.js +43 -0
  277. package/dist/providers/AddAccountForm.d.ts +10 -0
  278. package/dist/providers/AddAccountForm.js +54 -0
  279. package/dist/providers/CliDetail.d.ts +12 -0
  280. package/dist/providers/CliDetail.js +54 -0
  281. package/dist/providers/ProvidersPane.d.ts +9 -0
  282. package/dist/providers/ProvidersPane.js +86 -0
  283. package/dist/providers/account-actions.d.ts +7 -0
  284. package/dist/providers/account-actions.js +57 -0
  285. package/dist/providers/parts.d.ts +9 -0
  286. package/dist/providers/parts.js +18 -0
  287. package/dist/providers/provider-abilities.d.ts +2 -0
  288. package/dist/providers/provider-abilities.js +7 -0
  289. package/dist/providers/variables.d.ts +13 -0
  290. package/dist/providers/variables.js +63 -0
  291. package/dist/scope.d.ts +11 -0
  292. package/dist/scope.js +10 -0
  293. package/dist/settings/sections.d.ts +13 -0
  294. package/dist/settings/sections.js +32 -0
  295. package/dist/state/chats.d.ts +44 -0
  296. package/dist/state/chats.js +199 -0
  297. package/dist/state/provider-accounts.d.ts +17 -0
  298. package/dist/state/provider-accounts.js +67 -0
  299. package/dist/state/providers.d.ts +17 -0
  300. package/dist/state/providers.js +33 -0
  301. package/dist/state/usage.d.ts +44 -0
  302. package/dist/state/usage.js +121 -0
  303. package/dist/storage.d.ts +20 -0
  304. package/dist/storage.js +89 -0
  305. package/dist/theme.css +212 -0
  306. package/dist/transport.d.ts +24 -0
  307. package/dist/transport.js +18 -0
  308. package/dist/ui/PlainTextarea.d.ts +2 -0
  309. package/dist/ui/PlainTextarea.js +5 -0
  310. package/dist/usage/LimitsList.d.ts +18 -0
  311. package/dist/usage/LimitsList.js +73 -0
  312. package/dist/usage/UsageBreakdown.d.ts +9 -0
  313. package/dist/usage/UsageBreakdown.js +67 -0
  314. package/dist/usage/UsageChart.d.ts +10 -0
  315. package/dist/usage/UsageChart.js +47 -0
  316. package/dist/usage/UsageDialog.d.ts +6 -0
  317. package/dist/usage/UsageDialog.js +12 -0
  318. package/dist/usage/UsageLimits.d.ts +1 -0
  319. package/dist/usage/UsageLimits.js +57 -0
  320. package/dist/usage/UsageLimitsCard.d.ts +4 -0
  321. package/dist/usage/UsageLimitsCard.js +26 -0
  322. package/dist/usage/UsagePage.d.ts +7 -0
  323. package/dist/usage/UsagePage.js +154 -0
  324. package/dist/usage/UsagePane.d.ts +3 -0
  325. package/dist/usage/UsagePane.js +21 -0
  326. package/dist/usage/UsageSummary.d.ts +12 -0
  327. package/dist/usage/UsageSummary.js +15 -0
  328. package/dist/usage/UsageTiles.d.ts +7 -0
  329. package/dist/usage/UsageTiles.js +19 -0
  330. package/dist/usage/format.d.ts +13 -0
  331. package/dist/usage/format.js +55 -0
  332. package/dist/usage/limit-groups.d.ts +22 -0
  333. package/dist/usage/limit-groups.js +86 -0
  334. package/dist/usage/limits.d.ts +4 -0
  335. package/dist/usage/limits.js +58 -0
  336. package/dist/usage/money.d.ts +1 -0
  337. package/dist/usage/money.js +13 -0
  338. package/dist/usage/summary.d.ts +34 -0
  339. package/dist/usage/summary.js +94 -0
  340. package/package.json +895 -3
  341. package/src/agents/AccountDot.tsx +14 -0
  342. package/src/agents/AgentIcon.tsx +26 -0
  343. package/src/agents/ModelOptionControl.tsx +68 -0
  344. package/src/agents/ProviderLogo.tsx +20 -0
  345. package/src/agents/account-limits.ts +61 -0
  346. package/src/agents/accounts.ts +137 -0
  347. package/src/agents/model-name.ts +70 -0
  348. package/src/agents/model-options.ts +21 -0
  349. package/src/agents/provider-paths.ts +10 -0
  350. package/src/agents/status-look.ts +43 -0
  351. package/src/chat/account-choice.ts +44 -0
  352. package/src/chat/actions.ts +72 -0
  353. package/src/chat/activity.ts +8 -0
  354. package/src/chat/attachments.ts +118 -0
  355. package/src/chat/bookmarks.ts +87 -0
  356. package/src/chat/chat-client.ts +345 -0
  357. package/src/chat/chat-references.ts +11 -0
  358. package/src/chat/drafts.ts +165 -0
  359. package/src/chat/forks.ts +33 -0
  360. package/src/chat/guards.ts +84 -0
  361. package/src/chat/logic/ansi.ts +206 -0
  362. package/src/chat/logic/answers.ts +8 -0
  363. package/src/chat/logic/bookmarks.ts +42 -0
  364. package/src/chat/logic/context-usage.ts +36 -0
  365. package/src/chat/logic/fork.ts +200 -0
  366. package/src/chat/logic/handback.ts +10 -0
  367. package/src/chat/logic/json.ts +4 -0
  368. package/src/chat/logic/limit.ts +46 -0
  369. package/src/chat/logic/resume-compaction.ts +71 -0
  370. package/src/chat/logic/scrubber.ts +289 -0
  371. package/src/chat/logic/thread-cards.ts +64 -0
  372. package/src/chat/logic/timeline-copy.ts +65 -0
  373. package/src/chat/logic/timeline-target.ts +52 -0
  374. package/src/chat/logic/timeline.ts +419 -0
  375. package/src/chat/logic/tool-catalog.ts +62 -0
  376. package/src/chat/logic/tools.ts +102 -0
  377. package/src/chat/logic/welcome.ts +13 -0
  378. package/src/chat/logic/workflow.ts +66 -0
  379. package/src/chat/mentions.ts +232 -0
  380. package/src/chat/persisted-json.ts +67 -0
  381. package/src/chat/preferences.ts +179 -0
  382. package/src/chat/quote.ts +26 -0
  383. package/src/chat/recent-messages.ts +59 -0
  384. package/src/chat/resume-compaction-dismissals.ts +17 -0
  385. package/src/chat/runtime-modes.ts +18 -0
  386. package/src/chat/stash.ts +122 -0
  387. package/src/chat/subagent-conversation.ts +203 -0
  388. package/src/chat/subagent-list.ts +141 -0
  389. package/src/chat/subagent-support.ts +21 -0
  390. package/src/chat/subagent-view.ts +137 -0
  391. package/src/chat/thumbnails.ts +108 -0
  392. package/src/chat/timeline-flash.ts +33 -0
  393. package/src/chat/timeline-scroll.ts +199 -0
  394. package/src/chat/ui/AccountPill.tsx +31 -0
  395. package/src/chat/ui/AnsiOutput.tsx +18 -0
  396. package/src/chat/ui/BookmarkMarker.tsx +108 -0
  397. package/src/chat/ui/BookmarkSubmenu.tsx +53 -0
  398. package/src/chat/ui/ChatActivity.tsx +198 -0
  399. package/src/chat/ui/ChatReferenceChip.tsx +28 -0
  400. package/src/chat/ui/CodeBlock.tsx +175 -0
  401. package/src/chat/ui/Composer.tsx +1326 -0
  402. package/src/chat/ui/ComposerInput.tsx +187 -0
  403. package/src/chat/ui/DiffPool.tsx +36 -0
  404. package/src/chat/ui/EditDiff.tsx +30 -0
  405. package/src/chat/ui/FadingWords.tsx +18 -0
  406. package/src/chat/ui/ImageView.tsx +159 -0
  407. package/src/chat/ui/LimitState.tsx +165 -0
  408. package/src/chat/ui/Markdown.tsx +258 -0
  409. package/src/chat/ui/MessageActions.tsx +88 -0
  410. package/src/chat/ui/Pickers.tsx +272 -0
  411. package/src/chat/ui/PromptComposer.tsx +119 -0
  412. package/src/chat/ui/QuoteButton.tsx +103 -0
  413. package/src/chat/ui/ResumeCompactionDock.tsx +28 -0
  414. package/src/chat/ui/RunSettings.tsx +546 -0
  415. package/src/chat/ui/Scrubber.tsx +262 -0
  416. package/src/chat/ui/SubagentControls.tsx +66 -0
  417. package/src/chat/ui/SubagentInfo.tsx +67 -0
  418. package/src/chat/ui/SubagentStopButton.tsx +45 -0
  419. package/src/chat/ui/SubagentTimeline.tsx +170 -0
  420. package/src/chat/ui/Timeline.tsx +628 -0
  421. package/src/chat/ui/TimelineMenu.tsx +124 -0
  422. package/src/chat/ui/UnifiedDiff.tsx +99 -0
  423. package/src/chat/ui/UploadThumb.tsx +13 -0
  424. package/src/chat/ui/Welcome.tsx +22 -0
  425. package/src/chat/ui/chips.ts +15 -0
  426. package/src/chat/ui/code-lines.ts +60 -0
  427. package/src/chat/ui/code-streaming.ts +4 -0
  428. package/src/chat/ui/code-theme.ts +15 -0
  429. package/src/chat/ui/composer/chips.ts +43 -0
  430. package/src/chat/ui/composer/editor.ts +118 -0
  431. package/src/chat/ui/composer/insert.ts +22 -0
  432. package/src/chat/ui/composer/keys.ts +144 -0
  433. package/src/chat/ui/diff-theme.ts +23 -0
  434. package/src/chat/ui/file-links.ts +24 -0
  435. package/src/chat/ui/find-reveal.ts +23 -0
  436. package/src/chat/ui/full-diff.ts +25 -0
  437. package/src/chat/ui/icons.tsx +24 -0
  438. package/src/chat/ui/markdown-blocks.ts +123 -0
  439. package/src/chat/ui/quote-selection.ts +53 -0
  440. package/src/chat/ui/rehype-chips.ts +62 -0
  441. package/src/chat/ui/rehype-fade.ts +64 -0
  442. package/src/chat/ui/remark-html-as-text.ts +36 -0
  443. package/src/chat/ui/reply-context.ts +4 -0
  444. package/src/chat/ui/reveal.ts +135 -0
  445. package/src/chat/ui/rows/ForksRow.tsx +79 -0
  446. package/src/chat/ui/rows/MessageRows.tsx +415 -0
  447. package/src/chat/ui/rows/Rows.tsx +81 -0
  448. package/src/chat/ui/rows/SubagentRow.tsx +209 -0
  449. package/src/chat/ui/rows/TaskRow.tsx +91 -0
  450. package/src/chat/ui/rows/WorkRows.tsx +445 -0
  451. package/src/chat/ui/rows/WorkflowRow.tsx +120 -0
  452. package/src/chat/ui/rows/row-rhythm.ts +37 -0
  453. package/src/chat/ui/useToggleSet.ts +39 -0
  454. package/src/host.ts +324 -0
  455. package/src/lazy.tsx +64 -0
  456. package/src/locales/en/agent-chat.json +446 -0
  457. package/src/locales/en/agent-prompts.json +42 -0
  458. package/src/locales/en/agent-providers.json +131 -0
  459. package/src/locales/en/agent-usage.json +131 -0
  460. package/src/locales/nl/agent-chat.json +446 -0
  461. package/src/locales/nl/agent-prompts.json +42 -0
  462. package/src/locales/nl/agent-providers.json +131 -0
  463. package/src/locales/nl/agent-usage.json +131 -0
  464. package/src/locales.ts +33 -0
  465. package/src/mounted-registry.ts +45 -0
  466. package/src/port-transport.ts +146 -0
  467. package/src/prompts/logic/focus.ts +25 -0
  468. package/src/prompts/logic/keys.ts +116 -0
  469. package/src/prompts/logic/prompts.fixtures.ts +84 -0
  470. package/src/prompts/logic/prompts.ts +58 -0
  471. package/src/prompts/logic/subjects.ts +122 -0
  472. package/src/prompts/logic/useFocusAfterAnswer.ts +38 -0
  473. package/src/prompts/logic/usePromptSession.ts +114 -0
  474. package/src/prompts/ui/ApprovalBody.tsx +109 -0
  475. package/src/prompts/ui/PromptActions.tsx +109 -0
  476. package/src/prompts/ui/PromptCard.tsx +101 -0
  477. package/src/prompts/ui/PromptView.tsx +111 -0
  478. package/src/prompts/ui/QuestionBody.tsx +174 -0
  479. package/src/providers/AccountColors.tsx +8 -0
  480. package/src/providers/AccountDetail.tsx +209 -0
  481. package/src/providers/AccountVariables.tsx +126 -0
  482. package/src/providers/AddAccountForm.tsx +121 -0
  483. package/src/providers/CliDetail.tsx +157 -0
  484. package/src/providers/ProvidersPane.tsx +236 -0
  485. package/src/providers/account-actions.ts +67 -0
  486. package/src/providers/parts.tsx +25 -0
  487. package/src/providers/provider-abilities.ts +9 -0
  488. package/src/providers/variables.ts +87 -0
  489. package/src/scope.ts +30 -0
  490. package/src/settings/sections.ts +47 -0
  491. package/src/state/chats.ts +279 -0
  492. package/src/state/provider-accounts.ts +87 -0
  493. package/src/state/providers.ts +50 -0
  494. package/src/state/usage.ts +196 -0
  495. package/src/storage.ts +113 -0
  496. package/src/theme.css +212 -0
  497. package/src/transport.ts +50 -0
  498. package/src/ui/PlainTextarea.tsx +6 -0
  499. package/src/usage/LimitsList.tsx +232 -0
  500. package/src/usage/UsageBreakdown.tsx +210 -0
  501. package/src/usage/UsageChart.tsx +113 -0
  502. package/src/usage/UsageDialog.tsx +20 -0
  503. package/src/usage/UsageLimits.tsx +145 -0
  504. package/src/usage/UsageLimitsCard.tsx +36 -0
  505. package/src/usage/UsagePage.tsx +276 -0
  506. package/src/usage/UsagePane.tsx +52 -0
  507. package/src/usage/UsageSummary.tsx +50 -0
  508. package/src/usage/UsageTiles.tsx +34 -0
  509. package/src/usage/format.ts +71 -0
  510. package/src/usage/limit-groups.ts +119 -0
  511. package/src/usage/limits.ts +71 -0
  512. package/src/usage/money.ts +14 -0
  513. package/src/usage/summary.ts +137 -0
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 - present 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 ADDED
@@ -0,0 +1,61 @@
1
+ # @adecore/agents-react
2
+
3
+ [![npm](https://img.shields.io/npm/v/@adecore/agents-react)](https://www.npmjs.com/package/@adecore/agents-react)
4
+ [![Docs](https://img.shields.io/badge/docs-adecore.dev-blue)](https://adecore.dev/agents-react/)
5
+
6
+ React views for agent chats: the thread, the composer, approvals and questions, the agent CLIs and their accounts, and what they cost. They talk to a host of chats, such as [`@adecore/agents`](https://adecore.dev/agents/), over the requests of [`@adecore/agent-contracts`](https://adecore.dev/agent-contracts/). Built on React 19, [`@adecore/ui`](https://adecore.dev/ui/) and Tailwind 4.
7
+
8
+ **[Documentation with live demos](https://adecore.dev/agents-react/)**
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ bun add @adecore/agents-react @adecore/agent-contracts
14
+ ```
15
+
16
+ `@adecore/ui`, React 19, `react-dom`, `i18next` and `react-i18next` are peer dependencies.
17
+
18
+ ## Set up
19
+
20
+ Import the theme after the one of `@adecore/ui`, let Tailwind scan the package, and load the typography plugin. The `@source` path is relative to the CSS file.
21
+
22
+ ```css
23
+ @import "tailwindcss";
24
+ @import "@adecore/ui/theme.css";
25
+ @import "@adecore/agents-react/theme.css";
26
+ @plugin "@tailwindcss/typography";
27
+ @source "../node_modules/@adecore/agents-react/dist";
28
+ ```
29
+
30
+ Add the words of `AGENTS_LOCALES` to your i18next, call `setChatHost` once, and render the views in a `ChatScopeContext`:
31
+
32
+ ```tsx
33
+ import { Composer } from '@adecore/agents-react/chat/ui/Composer';
34
+ import { Timeline } from '@adecore/agents-react/chat/ui/Timeline';
35
+ import { ChatScopeContext } from '@adecore/agents-react/scope';
36
+
37
+ <ChatScopeContext.Provider value={scope}>
38
+ <Timeline chatId={chatId} composer={<Composer chatId={chatId} info={info} {...composerProps} />} />
39
+ </ChatScopeContext.Provider>;
40
+ ```
41
+
42
+ [Getting started](https://adecore.dev/agents-react/guide/getting-started) covers the words, the host, the scope and its transport.
43
+
44
+ Every module has its own subpath, `@adecore/agents-react/<path>`; there is no root import.
45
+
46
+ ## Documentation
47
+
48
+ | Page | What it covers |
49
+ |---|---|
50
+ | [Getting started](https://adecore.dev/agents-react/guide/getting-started) | Install, CSS, words, the host and a first chat |
51
+ | [Host adapters](https://adecore.dev/agents-react/guide/host) | Everything `setChatHost` takes |
52
+ | [Chat client and state](https://adecore.dev/agents-react/guide/chat-client) | The transport, `ChatClient` and the stores |
53
+ | [Persistence](https://adecore.dev/agents-react/guide/persistence) | Drafts, preferences and their storage keys |
54
+ | [Chat](https://adecore.dev/agents-react/chat/timeline) | The timeline, the composer, prompts and their parts, each with a live demo |
55
+ | [Providers](https://adecore.dev/agents-react/providers/providers-pane) | The settings of the CLIs and their accounts |
56
+ | [Usage](https://adecore.dev/agents-react/usage/usage-page) | Cost, charts and plan limits |
57
+ | [Modules](https://adecore.dev/agents-react/reference) | Every subpath and its exports |
58
+
59
+ ## License
60
+
61
+ FSL-1.1-MIT. See [LICENSE](./LICENSE).
@@ -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.js';
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 '@adecore/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 '@adecore/ui';
6
+ import { PROVIDER_PATHS } from './provider-paths.js';
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,15 @@
1
+ import type { ModelOptionDescriptor, ModelSelection } from '@adecore/agent-contracts';
2
+ type ModelOptionControlProps = {
3
+ option: ModelOptionDescriptor;
4
+ options: ModelSelection['options'];
5
+ layout?: 'compact' | 'row';
6
+ disabled?: boolean;
7
+ } & ({
8
+ defaultLabel?: undefined;
9
+ onChange(value: string | boolean): void;
10
+ } | {
11
+ defaultLabel: string;
12
+ onChange(value: string | boolean | undefined): void;
13
+ });
14
+ export declare function ModelOptionControl(props: ModelOptionControlProps): import("react").JSX.Element;
15
+ export {};
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Segmented, Switch, Select } from '@adecore/ui';
3
+ import { optionValue } from './model-options.js';
4
+ // Up to this many choices read at a glance side by side; more go into a menu.
5
+ const MAX_SEGMENTS = 3;
6
+ // The item `defaultLabel` adds; a choice id is never empty.
7
+ const MODEL_DEFAULT = '';
8
+ /*
9
+ * One of a model's own knobs outside a chat, such as effort in a form. The composer draws the same
10
+ * descriptors as menu items (`RunSettings`), since there they sit in a menu.
11
+ */
12
+ export function ModelOptionControl(props) {
13
+ const { option, options, layout = 'compact', disabled } = props;
14
+ if (option.type === 'boolean') {
15
+ return _jsx(Switch, { checked: optionValue(option, options) === true, label: option.label, disabled: disabled, onCheckedChange: props.onChange });
16
+ }
17
+ const picked = props.defaultLabel !== undefined && options[option.id] === undefined ? MODEL_DEFAULT : String(optionValue(option, options));
18
+ const choices = [
19
+ ...(props.defaultLabel !== undefined ? [{ id: MODEL_DEFAULT, label: props.defaultLabel, description: undefined }] : []),
20
+ ...option.choices
21
+ ];
22
+ const choose = (id) => {
23
+ if (props.defaultLabel !== undefined) {
24
+ props.onChange(id === MODEL_DEFAULT ? undefined : id);
25
+ return;
26
+ }
27
+ props.onChange(id);
28
+ };
29
+ if (layout === 'row' && choices.length <= MAX_SEGMENTS) {
30
+ return (_jsx(Segmented, { value: picked, label: option.label, disabled: disabled, options: choices.map((choice) => ({ id: choice.id, label: choice.label })), onValueChange: choose }));
31
+ }
32
+ return (_jsx(Select, { value: picked, label: option.label, size: layout === 'compact' ? 'sm' : 'md', variant: layout === 'compact' ? 'ghost' : 'outlined', align: layout === 'row' ? 'end' : 'start', disabled: disabled, items: choices.map((choice) => ({ value: choice.id, label: choice.label, description: choice.description })), onValueChange: choose }));
33
+ }
@@ -0,0 +1,8 @@
1
+ import type { UsageProvider } from '@adecore/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.js';
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 '@adecore/agent-contracts';
2
+ import { type AccountEntry } from './accounts.js';
3
+ export declare function limitsAccountId(entry: UsageLimitsProvider): string;
4
+ export declare function limitsOfAccount(snapshot: UsageLimitsSnapshot | null, id: string): UsageLimitsProvider | null;
5
+ export declare function sessionWindow(entry: UsageLimitsProvider | null): UsageWindow | null;
6
+ export declare function continueTarget(accounts: ProviderAccounts | null, snapshot: UsageLimitsSnapshot | null, kind: AgentKind, current: string | undefined): AccountEntry | null;
7
+ export declare function hasUnreadAccount(accounts: ProviderAccounts | null, snapshot: UsageLimitsSnapshot | null, kind: AgentKind, current: string | undefined): boolean;
@@ -0,0 +1,40 @@
1
+ import { accountsOfKind } from './accounts.js';
2
+ /* The account a plan entry is of; an entry from a machine before accounts is its CLI's default account. */
3
+ export function limitsAccountId(entry) {
4
+ return entry.account?.id ?? entry.kind;
5
+ }
6
+ export function limitsOfAccount(snapshot, id) {
7
+ return snapshot?.providers.find((entry) => limitsAccountId(entry) === id) ?? null;
8
+ }
9
+ export function sessionWindow(entry) {
10
+ return entry?.windows.find((window) => window.kind === 'session') ?? null;
11
+ }
12
+ /* The numbers were read, and no window of the plan is spent. An account never read has no known room. */
13
+ function hasRoom(entry) {
14
+ return entry !== null && entry.checkedAt > 0 && entry.unavailable === null && entry.windows.length > 0 && entry.windows.every((window) => window.used < 1);
15
+ }
16
+ /* What a turn of this account would run into first: its session window, else its fullest one. */
17
+ function pressure(entry) {
18
+ return sessionWindow(entry)?.used ?? Math.max(...entry.windows.map((window) => window.used));
19
+ }
20
+ /* The other accounts of the CLI a chat could go on under right now: on, and signed in. */
21
+ function others(accounts, kind, current) {
22
+ return accountsOfKind(accounts, kind).filter((entry) => entry.id !== (current ?? kind) && entry.account.enabled !== false && entry.status?.state === 'ready');
23
+ }
24
+ /*
25
+ * The account a chat that stopped on a limit could go on under: another one of its CLI that is on,
26
+ * signed in and has room, the one with the least of its session spent. Null when none has room, or
27
+ * none was read yet; the choice is only ever offered, never made.
28
+ */
29
+ export function continueTarget(accounts, snapshot, kind, current) {
30
+ const roomy = others(accounts, kind, current).flatMap((entry) => {
31
+ const limits = limitsOfAccount(snapshot, entry.id);
32
+ return hasRoom(limits) ? [{ entry, pressure: pressure(limits) }] : [];
33
+ });
34
+ roomy.sort((a, b) => a.pressure - b.pressure);
35
+ return roomy[0]?.entry ?? null;
36
+ }
37
+ /* Whether another account a chat could go on under has no numbers yet, since the machine only reads one in use by itself. */
38
+ export function hasUnreadAccount(accounts, snapshot, kind, current) {
39
+ return others(accounts, kind, current).some((entry) => (limitsOfAccount(snapshot, entry.id)?.checkedAt ?? 0) === 0);
40
+ }
@@ -0,0 +1,22 @@
1
+ import type { AgentKind, ProviderAccount, ProviderAccounts, ProviderAccountStatus } from '@adecore/agent-contracts';
2
+ export declare function 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 function accountsOfKind(accounts: ProviderAccounts | null, kind: AgentKind): AccountEntry[];
11
+ export declare function 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 function accountStatusLine(status: ProviderAccountStatus | null, canLogIn: boolean): {
15
+ text: string;
16
+ tone: AccountTone;
17
+ };
18
+ export declare function mintAccountId(kind: AgentKind, label: string, taken: ReadonlySet<string>): string;
19
+ export declare function freeAccountColor(entries: readonly AccountEntry[], fallback: string): string;
20
+ export declare function offeredAccounts(entries: readonly AccountEntry[], current: string | undefined): AccountEntry[];
21
+ export declare function hasAccountChoice(entries: readonly AccountEntry[]): boolean;
22
+ export declare function canContinueOn(accounts: ProviderAccounts | null, kind: AgentKind, from: string | undefined, to: string | undefined): boolean;
@@ -0,0 +1,113 @@
1
+ import i18next from 'i18next';
2
+ import { chatHost } from '../host.js';
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 function accountColor(color) {
8
+ return chatHost().accents.all.find((entry) => entry.id === color)?.color;
9
+ }
10
+ /*
11
+ * The variable each CLI reads its config folder from, as the host's providers name them. Only for
12
+ * the sentence under the folder; a CLI missing here still works, the sentence just does not name it.
13
+ */
14
+ export const FOLDER_VARIABLES = { claude: 'CLAUDE_CONFIG_DIR', codex: 'CODEX_HOME' };
15
+ /* The accounts of one CLI, its default one first and the others in the order the machine keeps them. */
16
+ export function accountsOfKind(accounts, kind) {
17
+ if (accounts === null) {
18
+ return [];
19
+ }
20
+ const statuses = new Map(accounts.statuses.map((status) => [status.id, status]));
21
+ return Object.entries(accounts.accounts)
22
+ .filter(([, account]) => account.kind === kind)
23
+ .map(([id, account]) => ({ id, account, status: statuses.get(id) ?? null, isDefault: id === kind }))
24
+ .sort((a, b) => Number(b.isDefault) - Number(a.isDefault));
25
+ }
26
+ /* A default account nobody named goes by its CLI's name. */
27
+ export function accountName(entry, providerName) {
28
+ return entry.account.label ?? (entry.isDefault ? providerName : entry.id);
29
+ }
30
+ export const ACCOUNT_TONE_CLASSES = {
31
+ muted: 'text-text-muted',
32
+ 'needs-you': 'text-status-needs-you',
33
+ error: 'text-status-error'
34
+ };
35
+ /*
36
+ * What an account's row says about it, in a few words. `canLogIn` is false for a CLI without a config
37
+ * folder: it has no login of its own to report, so being there is all a ready one says.
38
+ */
39
+ export function accountStatusLine(status, canLogIn) {
40
+ const words = (key, values) => i18next.t(`agent-providers:status.${key}`, values);
41
+ switch (status?.state ?? 'checking') {
42
+ case 'checking':
43
+ return { text: words('checking'), tone: 'muted' };
44
+ case 'disabled':
45
+ return { text: words('disabled'), tone: 'muted' };
46
+ case 'not-found':
47
+ return { text: words('notFound'), tone: 'muted' };
48
+ case 'signed-out':
49
+ return { text: words('signedOut'), tone: 'needs-you' };
50
+ case 'ready':
51
+ if (!canLogIn) {
52
+ return { text: words('available'), tone: 'muted' };
53
+ }
54
+ return { text: status?.plan ? words('readyPlan', { plan: status.plan }) : words('ready'), tone: 'muted' };
55
+ case 'folder-missing':
56
+ return { text: words('folderMissing'), tone: 'error' };
57
+ case 'unavailable':
58
+ return { text: words('unavailable'), tone: 'muted' };
59
+ case 'failed':
60
+ return { text: words('failed'), tone: 'error' };
61
+ }
62
+ }
63
+ /* The part of a name an id can hold, the way the machine makes one: `Work (EU)` becomes `work-eu`. */
64
+ function slugOf(label) {
65
+ return label
66
+ .normalize('NFKD')
67
+ .replace(/[̀-ͯ]/g, '')
68
+ .toLowerCase()
69
+ .replace(/[^a-z0-9]+/g, '-')
70
+ .replace(/^-+|-+$/g, '');
71
+ }
72
+ /* 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. */
73
+ export function mintAccountId(kind, label, taken) {
74
+ const base = `${kind}_${slugOf(label) || 'account'}`.slice(0, 60).replace(/-+$/, '');
75
+ let id = base;
76
+ for (let suffix = 2; taken.has(id); suffix += 1) {
77
+ id = `${base}-${suffix}`;
78
+ }
79
+ return id;
80
+ }
81
+ /*
82
+ * The first featured accent no account of the CLI wears yet, then any other, so a new one stands apart.
83
+ * An account without a color of its own wears `fallback`, the accent the app is painted in.
84
+ */
85
+ export function freeAccountColor(entries, fallback) {
86
+ const { all, featured } = chatHost().accents;
87
+ const worn = new Set(entries.map((entry) => (accountColor(entry.account.color) === undefined ? fallback : entry.account.color)));
88
+ const choices = [...featured, ...all.map((entry) => entry.id).filter((id) => !featured.includes(id))];
89
+ return choices.find((id) => !worn.has(id)) ?? featured[entries.length % featured.length] ?? fallback;
90
+ }
91
+ /* The accounts of a CLI a picker offers: every one that is on, and the one in use even while it is off. */
92
+ export function offeredAccounts(entries, current) {
93
+ return entries.filter((entry) => entry.account.enabled !== false || entry.id === current);
94
+ }
95
+ /* Whether a person has a choice of account for this CLI at all, which is when a chat shows its account. */
96
+ export function hasAccountChoice(entries) {
97
+ return entries.filter((entry) => entry.account.enabled !== false).length >= 2;
98
+ }
99
+ /*
100
+ * Whether a chat of one account can go on under another, the way the machine decides it: the same
101
+ * account, or two of the chat's CLI that write their conversations to one folder. A machine that does
102
+ * not say where an account writes them answers no, so the person forks instead of being refused.
103
+ */
104
+ export function canContinueOn(accounts, kind, from, to) {
105
+ const fromId = from ?? kind;
106
+ const toId = to ?? kind;
107
+ if (fromId === toId) {
108
+ return true;
109
+ }
110
+ const folderOf = (id) => accounts?.accounts[id]?.kind === kind ? accounts.statuses.find((status) => status.id === id)?.transcripts : undefined;
111
+ const folder = folderOf(fromId);
112
+ return folder !== undefined && folder !== '' && folder === folderOf(toId);
113
+ }
@@ -0,0 +1,12 @@
1
+ import type { AgentKind, ModelInfo, ProviderInfo } from '@adecore/agent-contracts';
2
+ export declare function modelNameFromSlug(slug: string): string;
3
+ export declare function modelName(slug: string, models: readonly ModelInfo[] | undefined): string;
4
+ export interface AgentChip {
5
+ readonly mark: 'logo' | 'icon';
6
+ readonly name: string;
7
+ readonly model: string;
8
+ }
9
+ export declare function agentChipOf(providers: readonly ProviderInfo[], provider: AgentKind, model: string): AgentChip;
10
+ export declare function useModelName(provider: AgentKind | undefined, slug: string): string;
11
+ export declare function sharedModelPrefix(models: readonly ModelInfo[]): string;
12
+ export declare function shortModelName(name: string, models: readonly ModelInfo[] | undefined): string;
@@ -0,0 +1,56 @@
1
+ import { useProviders } from '../state/providers.js';
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 function 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 function modelName(slug, models) {
22
+ return models?.find((entry) => entry.slug === slug)?.name ?? modelNameFromSlug(slug);
23
+ }
24
+ export function agentChipOf(providers, provider, model) {
25
+ const owner = providers.find((entry) => entry.kind === provider);
26
+ return {
27
+ mark: provider === 'claude' || provider === 'codex' ? 'logo' : 'icon',
28
+ name: owner?.name ?? provider,
29
+ model: modelName(model, owner?.models)
30
+ };
31
+ }
32
+ /* The same answer for the machine in scope, whose catalog is the only one that can name the slug. */
33
+ export function useModelName(provider, slug) {
34
+ return useProviders((state) => modelName(slug, state.providers.find((entry) => entry.kind === provider)?.models));
35
+ }
36
+ /*
37
+ * The leading words every model of a catalog shares, so a tight spot can say `Opus 5.5` where the
38
+ * CLI says `Claude Opus 5.5`. Whole words only, so `GPT-6` never loses its `GPT-`, and never all of a name.
39
+ */
40
+ export function sharedModelPrefix(models) {
41
+ const names = models.map((entry) => entry.name.split(' '));
42
+ const first = names[0];
43
+ if (first === undefined || names.length < 2) {
44
+ return '';
45
+ }
46
+ let count = 0;
47
+ while (names.every((words) => words.length > count + 1 && words[count] === first[count])) {
48
+ count++;
49
+ }
50
+ return count === 0 ? '' : `${first.slice(0, count).join(' ')} `;
51
+ }
52
+ /* A model's name without the words its whole catalog shares. */
53
+ export function shortModelName(name, models) {
54
+ const prefix = sharedModelPrefix(models ?? []);
55
+ return prefix !== '' && name.startsWith(prefix) ? name.slice(prefix.length) : name;
56
+ }
@@ -0,0 +1,5 @@
1
+ import type { ModelInfo, ModelOptionDescriptor, ModelSelection } from '@adecore/agent-contracts';
2
+ type OptionValues = ModelSelection['options'];
3
+ export declare function optionValue(option: ModelOptionDescriptor, options: OptionValues): string | boolean;
4
+ export declare function carryOptions(options: OptionValues, model: ModelInfo | undefined): OptionValues;
5
+ export {};
@@ -0,0 +1,15 @@
1
+ function fits(option, value) {
2
+ return option.type === 'boolean' ? typeof value === 'boolean' : typeof value === 'string' && option.choices.some((choice) => choice.id === value);
3
+ }
4
+ /* What an option runs at: the value picked, else the model's own default. A value the model does not offer counts as unpicked. */
5
+ export function optionValue(option, options) {
6
+ const picked = options[option.id];
7
+ if (fits(option, picked)) {
8
+ return picked;
9
+ }
10
+ return option.type === 'boolean' ? option.defaultValue : option.defaultChoice;
11
+ }
12
+ /* The picked options that `model` offers as well, so switching models keeps an effort the next one also has. */
13
+ export function carryOptions(options, model) {
14
+ return Object.fromEntries((model?.options ?? []).filter((option) => fits(option, options[option.id])).map((option) => [option.id, options[option.id]]));
15
+ }
@@ -0,0 +1,2 @@
1
+ import type { UsageProvider } from '@adecore/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 function statusLookOf(word: StatusWord): StatusLook;
9
+ export interface TaskState {
10
+ status: 'open' | 'done' | 'failed' | 'cancelled';
11
+ paused?: object;
12
+ }
13
+ export declare function taskStatusWord(task: TaskState): StatusWord;
@@ -0,0 +1,24 @@
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 function statusLookOf(word) {
16
+ return LOOKS[word];
17
+ }
18
+ /* 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. */
19
+ export function taskStatusWord(task) {
20
+ if (task.status !== 'open') {
21
+ return task.status;
22
+ }
23
+ return task.paused === undefined ? 'running' : 'paused';
24
+ }
@@ -0,0 +1,11 @@
1
+ import type { AgentKind, ProviderAccounts } from '@adecore/agent-contracts';
2
+ import { type AccountEntry } from '../agents/accounts.js';
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 function useAccountChoice(kind: AgentKind | null, account: string | undefined): AccountChoice | null;