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

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 +53 -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 +196 -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 +265 -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 +196 -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
@@ -0,0 +1,14 @@
1
+ import clsx from 'clsx';
2
+ import { accountColor } from './accounts';
3
+
4
+ /* The color an account wears, or the app's accent while it wears none of the accents. */
5
+ export function AccountDot({ color, className }: { color: string | undefined; className?: string }) {
6
+ const paint = accountColor(color);
7
+ return (
8
+ <span
9
+ aria-hidden
10
+ className={clsx('shrink-0 rounded-full', paint === undefined && 'bg-accent', className ?? 'size-2')}
11
+ style={paint === undefined ? undefined : { background: paint }}
12
+ />
13
+ );
14
+ }
@@ -0,0 +1,26 @@
1
+ import type { AgentKind } from '@adecore/agent-contracts';
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';
7
+
8
+ // simple-icons removed OpenAI's mark at its request, so Codex reuses the usage page's path.
9
+ const MARKS: Partial<Record<AgentKind, { title: string; path: string }>> = {
10
+ claude: siClaude,
11
+ codex: { title: 'Codex', path: PROVIDER_PATHS.codex },
12
+ gemini: siGooglegemini,
13
+ copilot: siGithubcopilot
14
+ };
15
+
16
+ export function AgentIcon({ kind, size = 14, className }: { kind: AgentKind; size?: number; className?: string }) {
17
+ const mark = MARKS[kind];
18
+ if (!mark) {
19
+ return <Icon icon={Bot} size={size} className={className} />;
20
+ }
21
+ return (
22
+ <svg role="img" aria-label={mark.title} viewBox="0 0 24 24" width={size} height={size} fill="currentColor" className={clsx('align-middle', className)}>
23
+ <path d={mark.path} />
24
+ </svg>
25
+ );
26
+ }
@@ -0,0 +1,68 @@
1
+ import type { ModelOptionDescriptor, ModelSelection } from '@adecore/agent-contracts';
2
+ import { Segmented, Switch, Select } from '@adecore/ui';
3
+ import { optionValue } from './model-options';
4
+
5
+ // Up to this many choices read at a glance side by side; more go into a menu.
6
+ const MAX_SEGMENTS = 3;
7
+
8
+ // The item `defaultLabel` adds; a choice id is never empty.
9
+ const MODEL_DEFAULT = '';
10
+
11
+ type ModelOptionControlProps = {
12
+ option: ModelOptionDescriptor;
13
+ /* The selection's options, of which this control reads and writes one. */
14
+ options: ModelSelection['options'];
15
+ /* `compact` beside a model picker in a form, `row` as the control of a settings row. */
16
+ layout?: 'compact' | 'row';
17
+ disabled?: boolean;
18
+ } & (
19
+ | { defaultLabel?: undefined; onChange(value: string | boolean): void }
20
+ /* Adds an item that leaves the choice to the model, answered as `undefined`. A boolean has no room for it and ignores it. */
21
+ | { defaultLabel: string; onChange(value: string | boolean | undefined): void }
22
+ );
23
+
24
+ /*
25
+ * One of a model's own knobs outside a chat, such as effort in a form. The composer draws the same
26
+ * descriptors as menu items (`RunSettings`), since there they sit in a menu.
27
+ */
28
+ export function ModelOptionControl(props: ModelOptionControlProps) {
29
+ const { option, options, layout = 'compact', disabled } = props;
30
+ if (option.type === 'boolean') {
31
+ return <Switch checked={optionValue(option, options) === true} label={option.label} disabled={disabled} onCheckedChange={props.onChange} />;
32
+ }
33
+ const picked = props.defaultLabel !== undefined && options[option.id] === undefined ? MODEL_DEFAULT : String(optionValue(option, options));
34
+ const choices = [
35
+ ...(props.defaultLabel !== undefined ? [{ id: MODEL_DEFAULT, label: props.defaultLabel, description: undefined }] : []),
36
+ ...option.choices
37
+ ];
38
+ const choose = (id: string): void => {
39
+ if (props.defaultLabel !== undefined) {
40
+ props.onChange(id === MODEL_DEFAULT ? undefined : id);
41
+ return;
42
+ }
43
+ props.onChange(id);
44
+ };
45
+ if (layout === 'row' && choices.length <= MAX_SEGMENTS) {
46
+ return (
47
+ <Segmented
48
+ value={picked}
49
+ label={option.label}
50
+ disabled={disabled}
51
+ options={choices.map((choice) => ({ id: choice.id, label: choice.label }))}
52
+ onValueChange={choose}
53
+ />
54
+ );
55
+ }
56
+ return (
57
+ <Select
58
+ value={picked}
59
+ label={option.label}
60
+ size={layout === 'compact' ? 'sm' : 'md'}
61
+ variant={layout === 'compact' ? 'ghost' : 'outlined'}
62
+ align={layout === 'row' ? 'end' : 'start'}
63
+ disabled={disabled}
64
+ items={choices.map((choice) => ({ value: choice.id, label: choice.label, description: choice.description }))}
65
+ onValueChange={choose}
66
+ />
67
+ );
68
+ }
@@ -0,0 +1,20 @@
1
+ import clsx from 'clsx';
2
+ import type { UsageProvider } from '@adecore/agent-contracts';
3
+ import { PROVIDER_PATHS } from './provider-paths';
4
+
5
+ interface ProviderLogoProps {
6
+ provider: UsageProvider;
7
+ size?: number;
8
+ className?: string;
9
+ }
10
+
11
+ /* The 24 by 24 box both marks are drawn in, so one size renders them at the same weight. */
12
+ const VIEW_BOX = '0 0 24 24';
13
+
14
+ export function ProviderLogo({ provider, size = 14, className }: ProviderLogoProps) {
15
+ return (
16
+ <svg aria-hidden viewBox={VIEW_BOX} width={size} height={size} fill="currentColor" className={clsx('shrink-0', className)}>
17
+ <path d={PROVIDER_PATHS[provider]} />
18
+ </svg>
19
+ );
20
+ }
@@ -0,0 +1,61 @@
1
+ import type { AgentKind, ProviderAccounts, UsageLimitsProvider, UsageLimitsSnapshot, UsageWindow } from '@adecore/agent-contracts';
2
+ import { accountsOfKind, type AccountEntry } from './accounts';
3
+
4
+ /* The account a plan entry is of; an entry from a machine before accounts is its CLI's default account. */
5
+ export function limitsAccountId(entry: UsageLimitsProvider): string {
6
+ return entry.account?.id ?? entry.kind;
7
+ }
8
+
9
+ export function limitsOfAccount(snapshot: UsageLimitsSnapshot | null, id: string): UsageLimitsProvider | null {
10
+ return snapshot?.providers.find((entry) => limitsAccountId(entry) === id) ?? null;
11
+ }
12
+
13
+ export function sessionWindow(entry: UsageLimitsProvider | null): UsageWindow | null {
14
+ return entry?.windows.find((window) => window.kind === 'session') ?? null;
15
+ }
16
+
17
+ /* The numbers were read, and no window of the plan is spent. An account never read has no known room. */
18
+ function hasRoom(entry: UsageLimitsProvider | null): entry is UsageLimitsProvider {
19
+ return entry !== null && entry.checkedAt > 0 && entry.unavailable === null && entry.windows.length > 0 && entry.windows.every((window) => window.used < 1);
20
+ }
21
+
22
+ /* What a turn of this account would run into first: its session window, else its fullest one. */
23
+ function pressure(entry: UsageLimitsProvider): number {
24
+ return sessionWindow(entry)?.used ?? Math.max(...entry.windows.map((window) => window.used));
25
+ }
26
+
27
+ /* The other accounts of the CLI a chat could go on under right now: on, and signed in. */
28
+ function others(accounts: ProviderAccounts | null, kind: AgentKind, current: string | undefined): AccountEntry[] {
29
+ return accountsOfKind(accounts, kind).filter(
30
+ (entry) => entry.id !== (current ?? kind) && entry.account.enabled !== false && entry.status?.state === 'ready'
31
+ );
32
+ }
33
+
34
+ /*
35
+ * The account a chat that stopped on a limit could go on under: another one of its CLI that is on,
36
+ * signed in and has room, the one with the least of its session spent. Null when none has room, or
37
+ * none was read yet; the choice is only ever offered, never made.
38
+ */
39
+ export function continueTarget(
40
+ accounts: ProviderAccounts | null,
41
+ snapshot: UsageLimitsSnapshot | null,
42
+ kind: AgentKind,
43
+ current: string | undefined
44
+ ): AccountEntry | null {
45
+ const roomy = others(accounts, kind, current).flatMap((entry) => {
46
+ const limits = limitsOfAccount(snapshot, entry.id);
47
+ return hasRoom(limits) ? [{ entry, pressure: pressure(limits) }] : [];
48
+ });
49
+ roomy.sort((a, b) => a.pressure - b.pressure);
50
+ return roomy[0]?.entry ?? null;
51
+ }
52
+
53
+ /* Whether another account a chat could go on under has no numbers yet, since the machine only reads one in use by itself. */
54
+ export function hasUnreadAccount(
55
+ accounts: ProviderAccounts | null,
56
+ snapshot: UsageLimitsSnapshot | null,
57
+ kind: AgentKind,
58
+ current: string | undefined
59
+ ): boolean {
60
+ return others(accounts, kind, current).some((entry) => (limitsOfAccount(snapshot, entry.id)?.checkedAt ?? 0) === 0);
61
+ }
@@ -0,0 +1,137 @@
1
+ import i18next from 'i18next';
2
+ import type { AgentKind, ProviderAccount, ProviderAccounts, ProviderAccountStatus } from '@adecore/agent-contracts';
3
+ import { chatHost } from '../host';
4
+
5
+ /*
6
+ * An account wears one of the host's accents, so the app paints from one palette. A color that is none
7
+ * of them (an older name, or one written by hand) reads as undefined, and the dot takes the accent.
8
+ */
9
+ export function accountColor(color: string | undefined): string | undefined {
10
+ return chatHost().accents.all.find((entry) => entry.id === color)?.color;
11
+ }
12
+
13
+ /*
14
+ * The variable each CLI reads its config folder from, as the host's providers name them. Only for
15
+ * the sentence under the folder; a CLI missing here still works, the sentence just does not name it.
16
+ */
17
+ export const FOLDER_VARIABLES: Partial<Record<AgentKind, string>> = { claude: 'CLAUDE_CONFIG_DIR', codex: 'CODEX_HOME' };
18
+
19
+ export interface AccountEntry {
20
+ id: string;
21
+ account: ProviderAccount;
22
+ status: ProviderAccountStatus | null;
23
+ /* The account under the CLI's own id, in the CLI's own folder. */
24
+ isDefault: boolean;
25
+ }
26
+
27
+ /* The accounts of one CLI, its default one first and the others in the order the machine keeps them. */
28
+ export function accountsOfKind(accounts: ProviderAccounts | null, kind: AgentKind): AccountEntry[] {
29
+ if (accounts === null) {
30
+ return [];
31
+ }
32
+ const statuses = new Map(accounts.statuses.map((status) => [status.id, status]));
33
+ return Object.entries(accounts.accounts)
34
+ .filter(([, account]) => account.kind === kind)
35
+ .map(([id, account]) => ({ id, account, status: statuses.get(id) ?? null, isDefault: id === kind }))
36
+ .sort((a, b) => Number(b.isDefault) - Number(a.isDefault));
37
+ }
38
+
39
+ /* A default account nobody named goes by its CLI's name. */
40
+ export function accountName(entry: Pick<AccountEntry, 'id' | 'account' | 'isDefault'>, providerName: string): string {
41
+ return entry.account.label ?? (entry.isDefault ? providerName : entry.id);
42
+ }
43
+
44
+ export type AccountTone = 'muted' | 'needs-you' | 'error';
45
+
46
+ export const ACCOUNT_TONE_CLASSES: Record<AccountTone, string> = {
47
+ muted: 'text-text-muted',
48
+ 'needs-you': 'text-status-needs-you',
49
+ error: 'text-status-error'
50
+ };
51
+
52
+ /*
53
+ * What an account's row says about it, in a few words. `canLogIn` is false for a CLI without a config
54
+ * folder: it has no login of its own to report, so being there is all a ready one says.
55
+ */
56
+ export function accountStatusLine(status: ProviderAccountStatus | null, canLogIn: boolean): { text: string; tone: AccountTone } {
57
+ const words = (key: string, values?: Record<string, string>): string => i18next.t(`agent-providers:status.${key}`, values);
58
+ switch (status?.state ?? 'checking') {
59
+ case 'checking':
60
+ return { text: words('checking'), tone: 'muted' };
61
+ case 'disabled':
62
+ return { text: words('disabled'), tone: 'muted' };
63
+ case 'not-found':
64
+ return { text: words('notFound'), tone: 'muted' };
65
+ case 'signed-out':
66
+ return { text: words('signedOut'), tone: 'needs-you' };
67
+ case 'ready':
68
+ if (!canLogIn) {
69
+ return { text: words('available'), tone: 'muted' };
70
+ }
71
+ return { text: status?.plan ? words('readyPlan', { plan: status.plan }) : words('ready'), tone: 'muted' };
72
+ case 'folder-missing':
73
+ return { text: words('folderMissing'), tone: 'error' };
74
+ case 'unavailable':
75
+ return { text: words('unavailable'), tone: 'muted' };
76
+ case 'failed':
77
+ return { text: words('failed'), tone: 'error' };
78
+ }
79
+ }
80
+
81
+ /* The part of a name an id can hold, the way the machine makes one: `Work (EU)` becomes `work-eu`. */
82
+ function slugOf(label: string): string {
83
+ return label
84
+ .normalize('NFKD')
85
+ .replace(/[̀-ͯ]/g, '')
86
+ .toLowerCase()
87
+ .replace(/[^a-z0-9]+/g, '-')
88
+ .replace(/^-+|-+$/g, '');
89
+ }
90
+
91
+ /* 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. */
92
+ export function mintAccountId(kind: AgentKind, label: string, taken: ReadonlySet<string>): string {
93
+ const base = `${kind}_${slugOf(label) || 'account'}`.slice(0, 60).replace(/-+$/, '');
94
+ let id = base;
95
+ for (let suffix = 2; taken.has(id); suffix += 1) {
96
+ id = `${base}-${suffix}`;
97
+ }
98
+ return id;
99
+ }
100
+
101
+ /*
102
+ * The first featured accent no account of the CLI wears yet, then any other, so a new one stands apart.
103
+ * An account without a color of its own wears `fallback`, the accent the app is painted in.
104
+ */
105
+ export function freeAccountColor(entries: readonly AccountEntry[], fallback: string): string {
106
+ const { all, featured } = chatHost().accents;
107
+ const worn = new Set(entries.map((entry) => (accountColor(entry.account.color) === undefined ? fallback : entry.account.color)));
108
+ const choices = [...featured, ...all.map((entry) => entry.id).filter((id) => !featured.includes(id))];
109
+ return choices.find((id) => !worn.has(id)) ?? featured[entries.length % featured.length] ?? fallback;
110
+ }
111
+
112
+ /* The accounts of a CLI a picker offers: every one that is on, and the one in use even while it is off. */
113
+ export function offeredAccounts(entries: readonly AccountEntry[], current: string | undefined): AccountEntry[] {
114
+ return entries.filter((entry) => entry.account.enabled !== false || entry.id === current);
115
+ }
116
+
117
+ /* Whether a person has a choice of account for this CLI at all, which is when a chat shows its account. */
118
+ export function hasAccountChoice(entries: readonly AccountEntry[]): boolean {
119
+ return entries.filter((entry) => entry.account.enabled !== false).length >= 2;
120
+ }
121
+
122
+ /*
123
+ * Whether a chat of one account can go on under another, the way the machine decides it: the same
124
+ * account, or two of the chat's CLI that write their conversations to one folder. A machine that does
125
+ * not say where an account writes them answers no, so the person forks instead of being refused.
126
+ */
127
+ export function canContinueOn(accounts: ProviderAccounts | null, kind: AgentKind, from: string | undefined, to: string | undefined): boolean {
128
+ const fromId = from ?? kind;
129
+ const toId = to ?? kind;
130
+ if (fromId === toId) {
131
+ return true;
132
+ }
133
+ const folderOf = (id: string): string | undefined =>
134
+ accounts?.accounts[id]?.kind === kind ? accounts.statuses.find((status) => status.id === id)?.transcripts : undefined;
135
+ const folder = folderOf(fromId);
136
+ return folder !== undefined && folder !== '' && folder === folderOf(toId);
137
+ }
@@ -0,0 +1,70 @@
1
+ import type { AgentKind, ModelInfo, ProviderInfo } from '@adecore/agent-contracts';
2
+ import { useProviders } from '../state/providers';
3
+
4
+ /*
5
+ * A model id as a person reads it, for a model no catalog names: without its vendor prefix and its
6
+ * date, and with the version number put back together (`claude-opus-4-5` is one 4.5, not a 4 and a
7
+ * 5).
8
+ */
9
+ export function modelNameFromSlug(slug: string): string {
10
+ const bare = slug.slice(slug.lastIndexOf('/') + 1).replace(/-\d{6,8}$/, '');
11
+ const words: string[] = [];
12
+ for (const word of bare.split('-')) {
13
+ const previous = words.at(-1);
14
+ if (previous !== undefined && /^\d+$/.test(word) && /\d$/.test(previous)) {
15
+ words[words.length - 1] = `${previous}.${word}`;
16
+ continue;
17
+ }
18
+ words.push(word);
19
+ }
20
+ return words.map((word) => (word === 'gpt' ? 'GPT' : word.charAt(0).toUpperCase() + word.slice(1))).join(' ');
21
+ }
22
+
23
+ /* What the CLI calls the model, so every surface says the same thing; a slug it no longer offers is read as one. */
24
+ export function modelName(slug: string, models: readonly ModelInfo[] | undefined): string {
25
+ return models?.find((entry) => entry.slug === slug)?.name ?? modelNameFromSlug(slug);
26
+ }
27
+
28
+ /* What an agent picker's chip says: the provider's name beside the model, and whether its mark is the logo of the usage page or the generic icon. */
29
+ export interface AgentChip {
30
+ readonly mark: 'logo' | 'icon';
31
+ readonly name: string;
32
+ readonly model: string;
33
+ }
34
+
35
+ export function agentChipOf(providers: readonly ProviderInfo[], provider: AgentKind, model: string): AgentChip {
36
+ const owner = providers.find((entry) => entry.kind === provider);
37
+ return {
38
+ mark: provider === 'claude' || provider === 'codex' ? 'logo' : 'icon',
39
+ name: owner?.name ?? provider,
40
+ model: modelName(model, owner?.models)
41
+ };
42
+ }
43
+
44
+ /* The same answer for the machine in scope, whose catalog is the only one that can name the slug. */
45
+ export function useModelName(provider: AgentKind | undefined, slug: string): string {
46
+ return useProviders((state) => modelName(slug, state.providers.find((entry) => entry.kind === provider)?.models));
47
+ }
48
+
49
+ /*
50
+ * The leading words every model of a catalog shares, so a tight spot can say `Opus 5.5` where the
51
+ * CLI says `Claude Opus 5.5`. Whole words only, so `GPT-6` never loses its `GPT-`, and never all of a name.
52
+ */
53
+ export function sharedModelPrefix(models: readonly ModelInfo[]): string {
54
+ const names = models.map((entry) => entry.name.split(' '));
55
+ const first = names[0];
56
+ if (first === undefined || names.length < 2) {
57
+ return '';
58
+ }
59
+ let count = 0;
60
+ while (names.every((words) => words.length > count + 1 && words[count] === first[count])) {
61
+ count++;
62
+ }
63
+ return count === 0 ? '' : `${first.slice(0, count).join(' ')} `;
64
+ }
65
+
66
+ /* A model's name without the words its whole catalog shares. */
67
+ export function shortModelName(name: string, models: readonly ModelInfo[] | undefined): string {
68
+ const prefix = sharedModelPrefix(models ?? []);
69
+ return prefix !== '' && name.startsWith(prefix) ? name.slice(prefix.length) : name;
70
+ }
@@ -0,0 +1,21 @@
1
+ import type { ModelInfo, ModelOptionDescriptor, ModelSelection } from '@adecore/agent-contracts';
2
+
3
+ type OptionValues = ModelSelection['options'];
4
+
5
+ function fits(option: ModelOptionDescriptor, value: string | boolean | undefined): value is string | boolean {
6
+ return option.type === 'boolean' ? typeof value === 'boolean' : typeof value === 'string' && option.choices.some((choice) => choice.id === value);
7
+ }
8
+
9
+ /* What an option runs at: the value picked, else the model's own default. A value the model does not offer counts as unpicked. */
10
+ export function optionValue(option: ModelOptionDescriptor, options: OptionValues): string | boolean {
11
+ const picked = options[option.id];
12
+ if (fits(option, picked)) {
13
+ return picked;
14
+ }
15
+ return option.type === 'boolean' ? option.defaultValue : option.defaultChoice;
16
+ }
17
+
18
+ /* The picked options that `model` offers as well, so switching models keeps an effort the next one also has. */
19
+ export function carryOptions(options: OptionValues, model: ModelInfo | undefined): OptionValues {
20
+ return Object.fromEntries((model?.options ?? []).filter((option) => fits(option, options[option.id])).map((option) => [option.id, options[option.id]!]));
21
+ }
@@ -0,0 +1,10 @@
1
+ import type { UsageProvider } from '@adecore/agent-contracts';
2
+
3
+ /*
4
+ * The marks of Anthropic and OpenAI. Lucide has no brand marks, so these are the icon rule's
5
+ * exception for provider marks. One path each, in `currentColor`, so a row decides how loud the logo is.
6
+ */
7
+ export const PROVIDER_PATHS: Record<UsageProvider, string> = {
8
+ 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',
9
+ 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'
10
+ };
@@ -0,0 +1,43 @@
1
+ import { CircleCheck, CircleSlash, CircleX, Hourglass, LoaderCircle, type LucideIcon } from 'lucide-react';
2
+
3
+ /* The states a piece of work settles into, wherever it is drawn. */
4
+ export type StatusWord = 'running' | 'paused' | 'done' | 'failed' | 'cancelled';
5
+
6
+ export interface StatusLook {
7
+ icon: LucideIcon;
8
+ tone: string;
9
+ spins: boolean;
10
+ }
11
+
12
+ /*
13
+ * One state, one mark: an entry in the sub-agent flyout, a task on its node (`TaskMark`), what finished
14
+ * in the toolbar (`StatusSummary`) and work in progress in a toast. A spinner stops under reduced
15
+ * motion with every other animation (`styles.css`).
16
+ */
17
+ const LOOKS: Record<StatusWord, StatusLook> = {
18
+ running: { icon: LoaderCircle, tone: 'text-status-running', spins: true },
19
+ // The hourglass of a chat that stopped on a limit, since that is what holds the work up.
20
+ paused: { icon: Hourglass, tone: 'text-text-faint', spins: false },
21
+ done: { icon: CircleCheck, tone: 'text-status-idle', spins: false },
22
+ failed: { icon: CircleX, tone: 'text-status-error', spins: false },
23
+ cancelled: { icon: CircleSlash, tone: 'text-text-faint', spins: false }
24
+ };
25
+
26
+ export function statusLookOf(word: StatusWord): StatusLook {
27
+ return LOOKS[word];
28
+ }
29
+
30
+ /* A task as far as its look goes, for an app that hands work to agents as tasks. */
31
+ export interface TaskState {
32
+ status: 'open' | 'done' | 'failed' | 'cancelled';
33
+ /* Set while the child waits out a limit. */
34
+ paused?: object;
35
+ }
36
+
37
+ /* 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. */
38
+ export function taskStatusWord(task: TaskState): StatusWord {
39
+ if (task.status !== 'open') {
40
+ return task.status;
41
+ }
42
+ return task.paused === undefined ? 'running' : 'paused';
43
+ }
@@ -0,0 +1,44 @@
1
+ import { useMemo } from 'react';
2
+ import type { AgentKind, ProviderAccounts } from '@adecore/agent-contracts';
3
+ import { accountName, accountsOfKind, hasAccountChoice, offeredAccounts, type AccountEntry } from '../agents/accounts';
4
+ import { useProviderAccounts } from '../state/provider-accounts';
5
+ import { useProviders } from '../state/providers';
6
+
7
+ export interface AccountChoice {
8
+ accounts: ProviderAccounts;
9
+ /* The accounts a person may pick for this CLI: those that are on, and the one in use. */
10
+ offered: AccountEntry[];
11
+ /* The account the chat runs under, by id; the CLI's kind for its default account. */
12
+ currentId: string;
13
+ /* Null for an account the machine no longer has. */
14
+ current: AccountEntry | null;
15
+ providerName: string;
16
+ nameOf(entry: AccountEntry): string;
17
+ }
18
+
19
+ /*
20
+ * The accounts of a chat's CLI on the machine in scope and the one the chat runs under, or null while
21
+ * the CLI has fewer than two accounts that are on: with one there is nothing to choose or tell apart.
22
+ */
23
+ export function useAccountChoice(kind: AgentKind | null, account: string | undefined): AccountChoice | null {
24
+ const accounts = useProviderAccounts((row) => row.accounts);
25
+ const providerName = useProviders((row) => row.providers.find((entry) => entry.kind === kind)?.name) ?? kind ?? '';
26
+ return useMemo(() => {
27
+ if (kind === null || accounts === null) {
28
+ return null;
29
+ }
30
+ const entries = accountsOfKind(accounts, kind);
31
+ if (!hasAccountChoice(entries)) {
32
+ return null;
33
+ }
34
+ const currentId = account ?? kind;
35
+ return {
36
+ accounts,
37
+ offered: offeredAccounts(entries, currentId),
38
+ currentId,
39
+ current: entries.find((entry) => entry.id === currentId) ?? null,
40
+ providerName,
41
+ nameOf: (entry: AccountEntry) => accountName(entry, providerName)
42
+ };
43
+ }, [accounts, kind, account, providerName]);
44
+ }
@@ -0,0 +1,72 @@
1
+ import i18next from 'i18next';
2
+ import { chatHost, type ChatActions } from '../host';
3
+ import { useChatScope, type ChatScope } from '../scope';
4
+ import { ChatTransportError, type ChatTransport } from '../transport';
5
+
6
+ /* Every action as the request a chat host answers, for an app that runs them through nothing of its own. */
7
+ export function transportActions(transport: ChatTransport): ChatActions {
8
+ return {
9
+ clear: async (chatId, force) => {
10
+ await transport.request('chat.clear', { chatId, ...(force ? { force: true } : {}) });
11
+ },
12
+ stopTurn: async (chatId, subagents) => {
13
+ await transport.request('chat.cancel', { chatId, ...(subagents ? { subagents: true } : {}) });
14
+ },
15
+ unqueue: async (chatId, messageId) => {
16
+ const { message } = await transport.request('chat.unqueue', { chatId, messageId });
17
+ // A host answers without the message once it went out, which is what the composer tells a person.
18
+ if (message === undefined) {
19
+ throw new ChatTransportError('request-not-found', i18next.t('agent-chat:composer.queue.alreadySent'));
20
+ }
21
+ },
22
+ sendNow: async (chatId, messageId) => {
23
+ await transport.request('chat.sendNow', { chatId, messageId });
24
+ },
25
+ compact: async (chatId) => {
26
+ await transport.request('chat.compact', { chatId });
27
+ },
28
+ configure: async (chatId, patch) => {
29
+ await transport.request('chat.configure', { chatId, ...patch });
30
+ },
31
+ continueOn: async (chatId, account) => {
32
+ await transport.request('chat.continueOn', { chatId, account });
33
+ },
34
+ turnDiff: async (chatId, turnId) => (await transport.request('chat.turnDiff', { chatId, turnId })).diff,
35
+ stopSubagent: async (chatId, toolUseId) => {
36
+ await transport.request('chat.stopSubagent', { chatId, toolUseId });
37
+ },
38
+ stopTask: async (chatId, taskId) => {
39
+ await transport.request('chat.stopTask', { chatId, taskId });
40
+ },
41
+ approve: async (chatId, requestId, decision, message) => {
42
+ await transport.request('chat.approve', { chatId, requestId, decision, ...(message === undefined ? {} : { message }) });
43
+ },
44
+ answer: async (chatId, requestId, answers) => {
45
+ await transport.request('chat.answer', { chatId, requestId, answers });
46
+ },
47
+ dismiss: async (chatId, itemId) => {
48
+ await transport.request('chat.dismiss', { chatId, itemId });
49
+ }
50
+ };
51
+ }
52
+
53
+ const byTransport = new WeakMap<ChatTransport, ChatActions>();
54
+
55
+ /* The app's own actions when it has them, and the requests of this scope's host otherwise. */
56
+ export function actionsOf(scope: ChatScope): ChatActions {
57
+ const own = chatHost().actions;
58
+ if (own !== null) {
59
+ return own;
60
+ }
61
+ const { transport } = scope;
62
+ let actions = byTransport.get(transport);
63
+ if (actions === undefined) {
64
+ actions = transportActions(transport);
65
+ byTransport.set(transport, actions);
66
+ }
67
+ return actions;
68
+ }
69
+
70
+ export function useChatActions(): ChatActions {
71
+ return actionsOf(useChatScope());
72
+ }
@@ -0,0 +1,8 @@
1
+ import type { ChatBackgroundTask } from '@adecore/agent-contracts';
2
+
3
+ export function backgroundCounts(tasks: readonly ChatBackgroundTask[]): { shells: number; monitors: number } {
4
+ return {
5
+ shells: tasks.filter((task) => task.kind === 'shell').length,
6
+ monitors: tasks.filter((task) => task.kind === 'monitor').length
7
+ };
8
+ }