@adecore/agents-react 0.38.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/dist/agents/AgentModelLabel.d.ts +10 -0
  2. package/dist/agents/AgentModelLabel.js +98 -0
  3. package/dist/agents/model-name.js +2 -1
  4. package/dist/agents/provider-paths.d.ts +2 -1
  5. package/dist/agents/provider-paths.js +7 -3
  6. package/dist/chat/account-choice.js +57 -28
  7. package/dist/chat/bookmarks.js +2 -1
  8. package/dist/chat/drafts.d.ts +0 -1
  9. package/dist/chat/drafts.js +9 -28
  10. package/dist/chat/logic/picker-entries.js +2 -8
  11. package/dist/chat/logic/resume-compaction.js +2 -5
  12. package/dist/chat/logic/timeline-copy.js +2 -8
  13. package/dist/chat/logic/timeline.js +9 -10
  14. package/dist/chat/logic/workflow.js +2 -4
  15. package/dist/chat/subagent-conversation.js +2 -1
  16. package/dist/chat/ui/Composer.js +385 -360
  17. package/dist/chat/ui/GoalDock.js +2 -1
  18. package/dist/chat/ui/LimitState.js +4 -6
  19. package/dist/chat/ui/Pickers.d.ts +2 -1
  20. package/dist/chat/ui/Pickers.js +126 -123
  21. package/dist/chat/ui/PromptEditor.d.ts +19 -0
  22. package/dist/chat/ui/PromptEditor.js +115 -0
  23. package/dist/chat/ui/Timeline.d.ts +2 -1
  24. package/dist/chat/ui/Timeline.js +13 -1
  25. package/dist/chat/ui/composer/ComposerControls.d.ts +3 -0
  26. package/dist/chat/ui/composer/ComposerControls.js +235 -38
  27. package/dist/chat/ui/composer/key-handler.d.ts +1 -1
  28. package/dist/chat/ui/composer/key-handler.js +3 -11
  29. package/dist/chat/ui/composer/prompt-picks.d.ts +4 -0
  30. package/dist/chat/ui/composer/prompt-picks.js +14 -0
  31. package/dist/chat/ui/composer/use-composer-menus.d.ts +4 -49
  32. package/dist/chat/ui/composer/use-composer-menus.js +65 -519
  33. package/dist/chat/ui/composer/use-continuable-turn.js +0 -1
  34. package/dist/chat/ui/composer/use-notice.js +2 -1
  35. package/dist/chat/ui/composer/use-prompt-history.js +1 -1
  36. package/dist/chat/ui/composer/use-prompt-menus.d.ts +73 -0
  37. package/dist/chat/ui/composer/use-prompt-menus.js +499 -0
  38. package/dist/chat/ui/composer/use-take-back.js +2 -2
  39. package/dist/chat/ui/diff/ApprovalReview.js +1 -1
  40. package/dist/chat/ui/highlighter.d.ts +0 -6
  41. package/dist/chat/ui/highlighter.js +0 -12
  42. package/dist/chat/ui/icons.d.ts +0 -1
  43. package/dist/chat/ui/icons.js +0 -3
  44. package/dist/chat/ui/index.d.ts +3 -0
  45. package/dist/chat/ui/index.js +2 -0
  46. package/dist/chat/ui/rows/MessageRows.js +2 -5
  47. package/dist/chat/ui/rows/row-rhythm.js +2 -5
  48. package/dist/chat/ui/theme-watch.js +3 -7
  49. package/dist/host-hooks.d.ts +2 -1
  50. package/dist/host-hooks.js +6 -0
  51. package/dist/host.d.ts +17 -1
  52. package/dist/index.d.ts +1 -1
  53. package/dist/locales/en/agent-chat.d.ts +1 -0
  54. package/dist/locales/en/agent-chat.js +1 -0
  55. package/dist/locales/nl/agent-chat.d.ts +1 -0
  56. package/dist/locales/nl/agent-chat.js +1 -0
  57. package/dist/prompts/logic/usePromptSession.js +2 -1
  58. package/dist/providers/AddAccountForm.js +2 -1
  59. package/dist/providers/CliDetail.js +104 -130
  60. package/dist/providers/account-actions.js +6 -9
  61. package/dist/providers/index.d.ts +1 -0
  62. package/dist/providers/index.js +1 -0
  63. package/dist/state/chats.d.ts +1 -0
  64. package/dist/state/chats.js +6 -11
  65. package/dist/state/provider-accounts.d.ts +1 -1
  66. package/dist/state/provider-accounts.js +2 -8
  67. package/dist/theme.css +3 -0
  68. package/dist/transport.d.ts +2 -0
  69. package/dist/transport.js +14 -0
  70. package/dist/usage/ChartLogo.d.ts +5 -0
  71. package/dist/usage/ChartLogo.js +48 -0
  72. package/dist/usage/LimitsList.js +6 -16
  73. package/dist/usage/UsageBreakdown.js +17 -40
  74. package/dist/usage/UsageLimits.js +183 -211
  75. package/dist/usage/UsagePage.js +3 -17
  76. package/dist/usage/UsageSummary.js +4 -9
  77. package/dist/usage/limits.js +16 -31
  78. package/dist/usage/summary.d.ts +1 -1
  79. package/dist/usage/summary.js +3 -5
  80. package/package.json +26 -26
  81. package/src/agents/AccountDot.tsx +1 -0
  82. package/src/agents/AgentIcon.tsx +2 -0
  83. package/src/agents/AgentModelLabel.tsx +38 -0
  84. package/src/agents/ModelOptionControl.tsx +8 -0
  85. package/src/agents/account-limits.ts +3 -0
  86. package/src/agents/accounts.ts +12 -0
  87. package/src/agents/model-name.ts +13 -1
  88. package/src/agents/model-options.ts +2 -0
  89. package/src/agents/model-requirement.ts +4 -0
  90. package/src/agents/option-words.ts +2 -0
  91. package/src/agents/provider-paths.ts +8 -3
  92. package/src/agents/status-look.ts +1 -0
  93. package/src/chat/account-choice.ts +25 -19
  94. package/src/chat/actions.ts +5 -0
  95. package/src/chat/attachments.ts +8 -0
  96. package/src/chat/bookmarks.ts +13 -1
  97. package/src/chat/chat-client.ts +63 -0
  98. package/src/chat/chat-references.ts +3 -0
  99. package/src/chat/composer-effort.ts +5 -0
  100. package/src/chat/composer-send.ts +4 -0
  101. package/src/chat/drafts.ts +21 -17
  102. package/src/chat/forks.ts +4 -0
  103. package/src/chat/guards.ts +2 -0
  104. package/src/chat/index.ts +7 -0
  105. package/src/chat/logic/ansi.ts +47 -0
  106. package/src/chat/logic/bookmarks.ts +7 -0
  107. package/src/chat/logic/command-looks.ts +29 -0
  108. package/src/chat/logic/context-usage.ts +3 -0
  109. package/src/chat/logic/continue-after-stop.ts +5 -0
  110. package/src/chat/logic/effort.ts +4 -0
  111. package/src/chat/logic/embedded-code.ts +63 -0
  112. package/src/chat/logic/fork.ts +22 -0
  113. package/src/chat/logic/generated-image.ts +7 -0
  114. package/src/chat/logic/goal.ts +7 -0
  115. package/src/chat/logic/handback.ts +2 -0
  116. package/src/chat/logic/limit.ts +8 -0
  117. package/src/chat/logic/picker-entries.ts +16 -4
  118. package/src/chat/logic/resume-compaction.ts +22 -5
  119. package/src/chat/logic/scrubber.ts +38 -5
  120. package/src/chat/logic/thought.ts +5 -0
  121. package/src/chat/logic/thread-cards.ts +6 -0
  122. package/src/chat/logic/timeline-copy.ts +4 -9
  123. package/src/chat/logic/timeline-target.ts +15 -0
  124. package/src/chat/logic/timeline.ts +113 -10
  125. package/src/chat/logic/tools.ts +30 -0
  126. package/src/chat/logic/visual-height.ts +5 -0
  127. package/src/chat/logic/visual-viewport.ts +1 -0
  128. package/src/chat/logic/welcome.ts +3 -0
  129. package/src/chat/logic/workflow.ts +26 -7
  130. package/src/chat/mentions.ts +56 -0
  131. package/src/chat/pending-prompts.ts +16 -0
  132. package/src/chat/persisted-json.ts +15 -0
  133. package/src/chat/preferences.ts +16 -0
  134. package/src/chat/prompt-hold.ts +2 -0
  135. package/src/chat/quote.ts +7 -0
  136. package/src/chat/reading-width.ts +1 -0
  137. package/src/chat/recent-messages.ts +5 -0
  138. package/src/chat/resume-compaction-dismissals.ts +1 -0
  139. package/src/chat/stash.ts +12 -0
  140. package/src/chat/subagent-conversation.ts +24 -4
  141. package/src/chat/subagent-list.ts +14 -0
  142. package/src/chat/subagent-support.ts +1 -0
  143. package/src/chat/subagent-view.ts +9 -0
  144. package/src/chat/thumbnails.ts +14 -0
  145. package/src/chat/timeline-flash.ts +2 -0
  146. package/src/chat/timeline-scroll.ts +23 -0
  147. package/src/chat/ui/AccountPill.tsx +4 -0
  148. package/src/chat/ui/AnsiOutput.tsx +1 -0
  149. package/src/chat/ui/BookmarkMarker.tsx +5 -0
  150. package/src/chat/ui/BookmarkSubmenu.tsx +1 -0
  151. package/src/chat/ui/ChatActivity.tsx +13 -0
  152. package/src/chat/ui/CodeBlock.tsx +8 -0
  153. package/src/chat/ui/Composer.tsx +27 -3
  154. package/src/chat/ui/ComposerInput.tsx +22 -0
  155. package/src/chat/ui/DiffPool.tsx +3 -0
  156. package/src/chat/ui/EditDiff.tsx +5 -0
  157. package/src/chat/ui/GoalDock.tsx +13 -1
  158. package/src/chat/ui/ImageView.tsx +11 -0
  159. package/src/chat/ui/LimitState.tsx +23 -6
  160. package/src/chat/ui/Markdown.tsx +41 -0
  161. package/src/chat/ui/MermaidBlock.tsx +16 -0
  162. package/src/chat/ui/MessageActions.tsx +8 -0
  163. package/src/chat/ui/ModelMarks.tsx +1 -0
  164. package/src/chat/ui/Pickers.tsx +30 -1
  165. package/src/chat/ui/PromptComposer.tsx +2 -0
  166. package/src/chat/ui/PromptEditor.tsx +136 -0
  167. package/src/chat/ui/QuoteButton.tsx +12 -0
  168. package/src/chat/ui/ReferenceChip.tsx +3 -0
  169. package/src/chat/ui/ResumeCompactionDock.tsx +1 -0
  170. package/src/chat/ui/RowTime.tsx +1 -0
  171. package/src/chat/ui/RunSettings.tsx +38 -0
  172. package/src/chat/ui/Scrubber.tsx +14 -0
  173. package/src/chat/ui/SessionLine.tsx +1 -0
  174. package/src/chat/ui/ShellCommand.tsx +32 -0
  175. package/src/chat/ui/SubagentControls.tsx +7 -0
  176. package/src/chat/ui/SubagentInfo.tsx +1 -0
  177. package/src/chat/ui/SubagentStopButton.tsx +6 -0
  178. package/src/chat/ui/SubagentTimeline.tsx +10 -0
  179. package/src/chat/ui/Timeline.tsx +141 -1
  180. package/src/chat/ui/TimelineMenu.tsx +5 -0
  181. package/src/chat/ui/UnifiedDiff.tsx +6 -0
  182. package/src/chat/ui/UploadThumb.tsx +2 -0
  183. package/src/chat/ui/VisualDialogs.tsx +3 -0
  184. package/src/chat/ui/VisualFrame.tsx +15 -0
  185. package/src/chat/ui/Welcome.tsx +1 -0
  186. package/src/chat/ui/chip-clipboard.ts +20 -0
  187. package/src/chat/ui/code-lines.ts +14 -0
  188. package/src/chat/ui/code-theme.ts +1 -0
  189. package/src/chat/ui/composer/ComposerControls.tsx +70 -15
  190. package/src/chat/ui/composer/ComposerMenu.tsx +12 -0
  191. package/src/chat/ui/composer/DraftParts.tsx +2 -0
  192. package/src/chat/ui/composer/QueuedMessages.tsx +4 -0
  193. package/src/chat/ui/composer/chip-paste.ts +16 -0
  194. package/src/chat/ui/composer/chips.ts +6 -0
  195. package/src/chat/ui/composer/editor.ts +9 -0
  196. package/src/chat/ui/composer/insert.ts +2 -0
  197. package/src/chat/ui/composer/key-handler.ts +42 -9
  198. package/src/chat/ui/composer/keys.ts +23 -0
  199. package/src/chat/ui/composer/placeholder.ts +6 -0
  200. package/src/chat/ui/composer/prompt-picks.ts +18 -0
  201. package/src/chat/ui/composer/surface.ts +5 -0
  202. package/src/chat/ui/composer/use-chat-controls.ts +13 -0
  203. package/src/chat/ui/composer/use-compaction-offer.ts +3 -0
  204. package/src/chat/ui/composer/use-composer-menus.ts +20 -275
  205. package/src/chat/ui/composer/use-composer-submit.ts +27 -0
  206. package/src/chat/ui/composer/use-continuable-turn.ts +3 -5
  207. package/src/chat/ui/composer/use-draft-files.ts +24 -0
  208. package/src/chat/ui/composer/use-effort-stepper.ts +8 -0
  209. package/src/chat/ui/composer/use-notice.ts +4 -1
  210. package/src/chat/ui/composer/use-pending-requests.ts +3 -0
  211. package/src/chat/ui/composer/use-prompt-history.ts +20 -11
  212. package/src/chat/ui/composer/use-prompt-hold.ts +3 -0
  213. package/src/chat/ui/composer/use-prompt-menus.ts +361 -0
  214. package/src/chat/ui/composer/use-take-back.ts +20 -2
  215. package/src/chat/ui/diff/ApprovalReview.tsx +18 -15
  216. package/src/chat/ui/diff/DiffFallbackBoundary.tsx +1 -0
  217. package/src/chat/ui/diff/DiffOmitted.tsx +1 -0
  218. package/src/chat/ui/diff/DiffStack.tsx +2 -0
  219. package/src/chat/ui/diff/DiffUnavailable.tsx +1 -0
  220. package/src/chat/ui/diff/EditorEditDiff.tsx +13 -0
  221. package/src/chat/ui/diff/EditorPatchDiff.tsx +4 -0
  222. package/src/chat/ui/diff/LegacyDiffPool.tsx +2 -0
  223. package/src/chat/ui/diff/LegacyEditDiff.tsx +2 -0
  224. package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +8 -0
  225. package/src/chat/ui/diff/RawDiff.tsx +1 -0
  226. package/src/chat/ui/diff/ReviewDiff.tsx +1 -0
  227. package/src/chat/ui/diff/diff-source-budget.ts +8 -0
  228. package/src/chat/ui/diff/editor-edit-model.ts +4 -0
  229. package/src/chat/ui/diff/review-plan.ts +9 -0
  230. package/src/chat/ui/diff/review-settle.ts +1 -0
  231. package/src/chat/ui/diff/syntax-runtime.ts +52 -0
  232. package/src/chat/ui/diff/use-review-stack.ts +9 -0
  233. package/src/chat/ui/diff-syntax.ts +12 -0
  234. package/src/chat/ui/diff-theme.ts +2 -0
  235. package/src/chat/ui/file-links.ts +2 -0
  236. package/src/chat/ui/find-reveal.ts +1 -0
  237. package/src/chat/ui/full-diff.ts +1 -0
  238. package/src/chat/ui/highlighter.ts +29 -15
  239. package/src/chat/ui/icons.tsx +2 -4
  240. package/src/chat/ui/index.ts +7 -0
  241. package/src/chat/ui/intelligent-ui/UiBlockFrame.tsx +25 -0
  242. package/src/chat/ui/intelligent-ui/UiFallbackPart.tsx +1 -0
  243. package/src/chat/ui/intelligent-ui/UiReply.tsx +63 -0
  244. package/src/chat/ui/intelligent-ui/block-local.ts +5 -0
  245. package/src/chat/ui/intelligent-ui/chart-data.ts +15 -0
  246. package/src/chat/ui/intelligent-ui/node-text.ts +17 -0
  247. package/src/chat/ui/intelligent-ui/renderers/binding.ts +1 -0
  248. package/src/chat/ui/intelligent-ui/renderers/chart.tsx +31 -0
  249. package/src/chat/ui/intelligent-ui/renderers/choices.tsx +4 -0
  250. package/src/chat/ui/intelligent-ui/renderers/content.tsx +18 -0
  251. package/src/chat/ui/intelligent-ui/renderers/data.tsx +11 -0
  252. package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +13 -0
  253. package/src/chat/ui/intelligent-ui/renderers/links.tsx +9 -0
  254. package/src/chat/ui/intelligent-ui/renderers/map-slots.ts +15 -0
  255. package/src/chat/ui/intelligent-ui/renderers/map-style.ts +15 -0
  256. package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +48 -0
  257. package/src/chat/ui/intelligent-ui/renderers/map.tsx +20 -0
  258. package/src/chat/ui/intelligent-ui/renderers/place-point.ts +3 -0
  259. package/src/chat/ui/intelligent-ui/renderers/structure.tsx +3 -0
  260. package/src/chat/ui/intelligent-ui/renderers/text.tsx +8 -0
  261. package/src/chat/ui/intelligent-ui/reply-parts.ts +5 -0
  262. package/src/chat/ui/intelligent-ui/table-data.ts +17 -0
  263. package/src/chat/ui/intelligent-ui/use-in-view.ts +4 -0
  264. package/src/chat/ui/intelligent-ui/use-later.ts +4 -0
  265. package/src/chat/ui/intelligent-ui/use-truncated.ts +5 -0
  266. package/src/chat/ui/intelligent-ui/use-ui-links.ts +29 -0
  267. package/src/chat/ui/intelligent-ui/use-ui-queries.ts +60 -0
  268. package/src/chat/ui/markdown-blocks.ts +64 -0
  269. package/src/chat/ui/mermaid.ts +4 -0
  270. package/src/chat/ui/quote-selection.ts +10 -0
  271. package/src/chat/ui/rehype-chips.ts +5 -0
  272. package/src/chat/ui/rehype-fade.ts +2 -0
  273. package/src/chat/ui/remark-html-as-text.ts +5 -0
  274. package/src/chat/ui/reveal.ts +18 -0
  275. package/src/chat/ui/rows/ForksRow.tsx +5 -0
  276. package/src/chat/ui/rows/GeneratedImageRow.tsx +10 -0
  277. package/src/chat/ui/rows/MessageRows.tsx +29 -5
  278. package/src/chat/ui/rows/RowContainer.tsx +1 -0
  279. package/src/chat/ui/rows/Rows.tsx +2 -0
  280. package/src/chat/ui/rows/SubagentRow.tsx +13 -0
  281. package/src/chat/ui/rows/TaskRow.tsx +7 -0
  282. package/src/chat/ui/rows/VisualRow.tsx +4 -0
  283. package/src/chat/ui/rows/WorkRows.tsx +46 -0
  284. package/src/chat/ui/rows/WorkflowRow.tsx +10 -0
  285. package/src/chat/ui/rows/row-rhythm.ts +7 -5
  286. package/src/chat/ui/theme-watch.ts +8 -7
  287. package/src/chat/ui/thread-references.ts +7 -0
  288. package/src/chat/ui/use-diff-source-tokens.ts +8 -0
  289. package/src/chat/ui/useToggleSet.ts +3 -0
  290. package/src/chat/ui/visual-theme.ts +30 -0
  291. package/src/chat/visual-bridge.ts +23 -0
  292. package/src/chat/visual-viewport.ts +12 -0
  293. package/src/host-hooks.ts +15 -5
  294. package/src/host.ts +29 -1
  295. package/src/index.ts +5 -0
  296. package/src/lazy.tsx +9 -0
  297. package/src/locales/en/agent-chat.ts +1 -0
  298. package/src/locales/nl/agent-chat.ts +1 -0
  299. package/src/mounted-registry.ts +4 -0
  300. package/src/port-transport.ts +32 -0
  301. package/src/prompts/index.ts +2 -0
  302. package/src/prompts/logic/focus.ts +5 -0
  303. package/src/prompts/logic/keys.ts +12 -0
  304. package/src/prompts/logic/prompts.ts +8 -0
  305. package/src/prompts/logic/subjects.ts +8 -0
  306. package/src/prompts/logic/useFocusAfterAnswer.ts +2 -0
  307. package/src/prompts/logic/usePromptSession.ts +13 -1
  308. package/src/prompts/ui/ApprovalBody.tsx +2 -0
  309. package/src/prompts/ui/PromptActions.tsx +2 -0
  310. package/src/prompts/ui/PromptCard.tsx +6 -0
  311. package/src/prompts/ui/PromptView.tsx +6 -0
  312. package/src/prompts/ui/QuestionBody.tsx +11 -0
  313. package/src/providers/AccountColors.tsx +1 -0
  314. package/src/providers/AccountDetail.tsx +7 -0
  315. package/src/providers/AccountVariables.tsx +2 -0
  316. package/src/providers/AddAccountForm.tsx +5 -1
  317. package/src/providers/CliDetail.tsx +6 -5
  318. package/src/providers/InstallPage.tsx +11 -0
  319. package/src/providers/ProviderList.tsx +3 -0
  320. package/src/providers/ProvidersPane.tsx +18 -0
  321. package/src/providers/account-actions.ts +10 -8
  322. package/src/providers/index.ts +1 -0
  323. package/src/providers/install-steps.ts +3 -0
  324. package/src/providers/pane-target.ts +5 -0
  325. package/src/providers/provider-abilities.ts +1 -0
  326. package/src/providers/provider-groups.ts +6 -0
  327. package/src/providers/variables.ts +12 -0
  328. package/src/scope.ts +2 -0
  329. package/src/state/chats.ts +61 -14
  330. package/src/state/index.ts +2 -0
  331. package/src/state/provider-accounts.ts +7 -9
  332. package/src/state/providers.ts +1 -0
  333. package/src/state/usage.ts +6 -0
  334. package/src/storage.ts +18 -0
  335. package/src/testing/prompts.ts +5 -0
  336. package/src/theme.css +3 -0
  337. package/src/transport.ts +18 -0
  338. package/src/usage/ChartLogo.tsx +12 -0
  339. package/src/usage/LimitsList.tsx +7 -8
  340. package/src/usage/UsageBreakdown.tsx +11 -4
  341. package/src/usage/UsageChart.tsx +5 -0
  342. package/src/usage/UsageLimits.tsx +10 -7
  343. package/src/usage/UsageLimitsCard.tsx +2 -0
  344. package/src/usage/UsagePage.tsx +16 -19
  345. package/src/usage/UsageSummary.tsx +4 -5
  346. package/src/usage/UsageTiles.tsx +2 -0
  347. package/src/usage/format.ts +7 -0
  348. package/src/usage/limit-groups.ts +14 -0
  349. package/src/usage/limits.ts +11 -13
  350. package/src/usage/money.ts +1 -0
  351. package/src/usage/summary.ts +15 -7
@@ -5,13 +5,13 @@ import { LogIn } from 'lucide-react';
5
5
  import { AccountDot } from '../agents/AccountDot.js';
6
6
  import { Button, Icon, SectionLabel, Segmented, Tooltip, useNow } from '@adecore/ui';
7
7
  import { useChatHost } from '../host.js';
8
- import { PROVIDER_COLORS, PROVIDER_LABELS } from './format.js';
8
+ import { ChartLogo } from './ChartLogo.js';
9
+ import { PROVIDER_LABELS } from './format.js';
9
10
  import { accountNote, checkedLabel, hasSeveralAccounts, isSignedOut } from './limit-groups.js';
10
11
  import { WindowBar } from './LimitsList.js';
11
12
  import { useLimitGroups, useUsageLimits } from './limits.js';
12
- import { useProviderAccountsStore } from '../state/provider-accounts.js';
13
+ import { useProviderAccounts } from '../state/provider-accounts.js';
13
14
  import { useChatScope } from '../scope.js';
14
- import { ProviderLogo } from '../agents/ProviderLogo.js';
15
15
  import { useHostLoginBlocked } from '../host-hooks.js';
16
16
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
17
17
  const MINUTE_MS = 60_000;
@@ -91,7 +91,7 @@ function LoginButton(t0) {
91
91
  }
92
92
  /* One account: where its numbers come from, then a bar per window, or why there are none. */
93
93
  function LimitCard(t0) {
94
- const $ = _c(42);
94
+ const $ = _c(37);
95
95
  const {
96
96
  account,
97
97
  named,
@@ -132,55 +132,32 @@ function LimitCard(t0) {
132
132
  t3 = $[8];
133
133
  }
134
134
  const checked = t3;
135
- const t4 = PROVIDER_COLORS[account.kind];
136
- let t5;
137
- if ($[9] !== t4) {
138
- t5 = {
139
- color: t4
140
- };
141
- $[9] = t4;
142
- $[10] = t5;
135
+ let t4;
136
+ if ($[9] !== account.kind) {
137
+ t4 = /*#__PURE__*/_jsx(ChartLogo, {
138
+ provider: account.kind,
139
+ className: "shrink-0"
140
+ });
141
+ $[9] = account.kind;
142
+ $[10] = t4;
143
143
  } else {
144
- t5 = $[10];
144
+ t4 = $[10];
145
145
  }
146
+ const t5 = PROVIDER_LABELS[account.kind];
146
147
  let t6;
147
- if ($[11] !== account.kind) {
148
- t6 = /*#__PURE__*/_jsx(ProviderLogo, {
149
- provider: account.kind
148
+ if ($[11] !== t5) {
149
+ t6 = /*#__PURE__*/_jsx("span", {
150
+ className: "shrink-0",
151
+ children: t5
150
152
  });
151
- $[11] = account.kind;
153
+ $[11] = t5;
152
154
  $[12] = t6;
153
155
  } else {
154
156
  t6 = $[12];
155
157
  }
156
158
  let t7;
157
- if ($[13] !== t5 || $[14] !== t6) {
158
- t7 = /*#__PURE__*/_jsx("span", {
159
- className: "shrink-0",
160
- style: t5,
161
- children: t6
162
- });
163
- $[13] = t5;
164
- $[14] = t6;
165
- $[15] = t7;
166
- } else {
167
- t7 = $[15];
168
- }
169
- const t8 = PROVIDER_LABELS[account.kind];
170
- let t9;
171
- if ($[16] !== t8) {
172
- t9 = /*#__PURE__*/_jsx("span", {
173
- className: "shrink-0",
174
- children: t8
175
- });
176
- $[16] = t8;
177
- $[17] = t9;
178
- } else {
179
- t9 = $[17];
180
- }
181
- let t10;
182
- if ($[18] !== account.color || $[19] !== account.name || $[20] !== named) {
183
- t10 = named && /*#__PURE__*/_jsxs(_Fragment, {
159
+ if ($[13] !== account.color || $[14] !== account.name || $[15] !== named) {
160
+ t7 = named && /*#__PURE__*/_jsxs(_Fragment, {
184
161
  children: [/*#__PURE__*/_jsx("span", {
185
162
  className: "text-text-faint",
186
163
  children: "\xB7"
@@ -191,53 +168,53 @@ function LimitCard(t0) {
191
168
  children: account.name
192
169
  })]
193
170
  });
194
- $[18] = account.color;
195
- $[19] = account.name;
196
- $[20] = named;
197
- $[21] = t10;
171
+ $[13] = account.color;
172
+ $[14] = account.name;
173
+ $[15] = named;
174
+ $[16] = t7;
198
175
  } else {
199
- t10 = $[21];
176
+ t7 = $[16];
200
177
  }
201
- let t11;
202
- if ($[22] !== plan) {
203
- t11 = plan && /*#__PURE__*/_jsxs("span", {
178
+ let t8;
179
+ if ($[17] !== plan) {
180
+ t8 = plan && /*#__PURE__*/_jsxs("span", {
204
181
  className: "shrink-0 font-normal text-text-muted",
205
182
  children: ["\xB7 ", plan]
206
183
  });
207
- $[22] = plan;
208
- $[23] = t11;
184
+ $[17] = plan;
185
+ $[18] = t8;
209
186
  } else {
210
- t11 = $[23];
187
+ t8 = $[18];
211
188
  }
212
- let t12;
213
- if ($[24] !== checked) {
214
- t12 = checked !== null && /*#__PURE__*/_jsx("span", {
189
+ let t9;
190
+ if ($[19] !== checked) {
191
+ t9 = checked !== null && /*#__PURE__*/_jsx("span", {
215
192
  className: "ml-auto shrink-0 pl-2 font-normal text-text-faint",
216
193
  children: checked
217
194
  });
218
- $[24] = checked;
219
- $[25] = t12;
195
+ $[19] = checked;
196
+ $[20] = t9;
220
197
  } else {
221
- t12 = $[25];
198
+ t9 = $[20];
222
199
  }
223
- let t13;
224
- if ($[26] !== t10 || $[27] !== t11 || $[28] !== t12 || $[29] !== t7 || $[30] !== t9) {
225
- t13 = /*#__PURE__*/_jsxs("p", {
200
+ let t10;
201
+ if ($[21] !== t4 || $[22] !== t6 || $[23] !== t7 || $[24] !== t8 || $[25] !== t9) {
202
+ t10 = /*#__PURE__*/_jsxs("p", {
226
203
  className: "flex min-w-0 items-center gap-2 text-xs font-medium",
227
- children: [t7, t9, t10, t11, t12]
204
+ children: [t4, t6, t7, t8, t9]
228
205
  });
206
+ $[21] = t4;
207
+ $[22] = t6;
208
+ $[23] = t7;
209
+ $[24] = t8;
210
+ $[25] = t9;
229
211
  $[26] = t10;
230
- $[27] = t11;
231
- $[28] = t12;
232
- $[29] = t7;
233
- $[30] = t9;
234
- $[31] = t13;
235
212
  } else {
236
- t13 = $[31];
213
+ t10 = $[26];
237
214
  }
238
- let t14;
239
- if ($[32] !== account || $[33] !== login || $[34] !== note || $[35] !== now || $[36] !== signedOut || $[37] !== t) {
240
- t14 = signedOut ? /*#__PURE__*/_jsxs(_Fragment, {
215
+ let t11;
216
+ if ($[27] !== account || $[28] !== login || $[29] !== note || $[30] !== now || $[31] !== signedOut || $[32] !== t) {
217
+ t11 = signedOut ? /*#__PURE__*/_jsxs(_Fragment, {
241
218
  children: [/*#__PURE__*/_jsx("p", {
242
219
  className: "text-xs text-text-faint",
243
220
  children: t("limits.signedOutDetail")
@@ -256,36 +233,36 @@ function LimitCard(t0) {
256
233
  compact: false
257
234
  }, window.id))
258
235
  });
259
- $[32] = account;
260
- $[33] = login;
261
- $[34] = note;
262
- $[35] = now;
263
- $[36] = signedOut;
264
- $[37] = t;
265
- $[38] = t14;
236
+ $[27] = account;
237
+ $[28] = login;
238
+ $[29] = note;
239
+ $[30] = now;
240
+ $[31] = signedOut;
241
+ $[32] = t;
242
+ $[33] = t11;
266
243
  } else {
267
- t14 = $[38];
244
+ t11 = $[33];
268
245
  }
269
- let t15;
270
- if ($[39] !== t13 || $[40] !== t14) {
271
- t15 = /*#__PURE__*/_jsxs("div", {
246
+ let t12;
247
+ if ($[34] !== t10 || $[35] !== t11) {
248
+ t12 = /*#__PURE__*/_jsxs("div", {
272
249
  className: "flex min-w-0 flex-col gap-3.5 rounded-xl border border-border bg-surface bg-clip-padding px-4 py-3.5",
273
- children: [t13, t14]
250
+ children: [t10, t11]
274
251
  });
275
- $[39] = t13;
276
- $[40] = t14;
277
- $[41] = t15;
252
+ $[34] = t10;
253
+ $[35] = t11;
254
+ $[36] = t12;
278
255
  } else {
279
- t15 = $[41];
256
+ t12 = $[36];
280
257
  }
281
- return t15;
258
+ return t12;
282
259
  }
283
260
  /*
284
261
  * What is left of each plan, asked of the CLIs themselves, a card per account. Nothing here reads a
285
262
  * credential: every CLI holds its own login and answers the question when the daemon starts one and asks.
286
263
  */
287
264
  export function UsageLimits() {
288
- const $ = _c(46);
265
+ const $ = _c(44);
289
266
  const host = useChatHost();
290
267
  const {
291
268
  t
@@ -294,15 +271,7 @@ export function UsageLimits() {
294
271
  const groups = useLimitGroups(limits);
295
272
  const now = useNow(MINUTE_MS);
296
273
  const scopeId = useChatScope().id;
297
- let t0;
298
- if ($[0] !== scopeId) {
299
- t0 = s => s.byScope[scopeId]?.accounts?.loginCommands;
300
- $[0] = scopeId;
301
- $[1] = t0;
302
- } else {
303
- t0 = $[1];
304
- }
305
- const loginCommands = useProviderAccountsStore(t0);
274
+ const loginCommands = useProviderAccounts(_temp);
306
275
  const {
307
276
  openLogin
308
277
  } = host;
@@ -311,181 +280,184 @@ export function UsageLimits() {
311
280
  if (limits === null) {
312
281
  return null;
313
282
  }
283
+ let t0;
284
+ if ($[0] !== groups) {
285
+ t0 = groups.length > 1 && hasSeveralAccounts(groups);
286
+ $[0] = groups;
287
+ $[1] = t0;
288
+ } else {
289
+ t0 = $[1];
290
+ }
291
+ const filterable = t0;
314
292
  let t1;
315
- if ($[2] !== groups) {
316
- t1 = groups.length > 1 && hasSeveralAccounts(groups);
317
- $[2] = groups;
318
- $[3] = t1;
293
+ if ($[2] !== filter || $[3] !== filterable || $[4] !== groups) {
294
+ t1 = filterable && groups.some(group => group.kind === filter) ? filter : "all";
295
+ $[2] = filter;
296
+ $[3] = filterable;
297
+ $[4] = groups;
298
+ $[5] = t1;
319
299
  } else {
320
- t1 = $[3];
300
+ t1 = $[5];
321
301
  }
322
- const filterable = t1;
302
+ const current = t1;
323
303
  let t2;
324
- if ($[4] !== filter || $[5] !== filterable || $[6] !== groups) {
325
- t2 = filterable && groups.some(group => group.kind === filter) ? filter : "all";
326
- $[4] = filter;
327
- $[5] = filterable;
328
- $[6] = groups;
329
- $[7] = t2;
304
+ if ($[6] !== current || $[7] !== groups) {
305
+ t2 = current === "all" ? groups : groups.filter(group_0 => group_0.kind === current);
306
+ $[6] = current;
307
+ $[7] = groups;
308
+ $[8] = t2;
330
309
  } else {
331
- t2 = $[7];
310
+ t2 = $[8];
332
311
  }
333
- const current = t2;
312
+ const shown = t2;
334
313
  let t3;
335
- if ($[8] !== current || $[9] !== groups) {
336
- t3 = current === "all" ? groups : groups.filter(group_0 => group_0.kind === current);
337
- $[8] = current;
338
- $[9] = groups;
339
- $[10] = t3;
340
- } else {
341
- t3 = $[10];
342
- }
343
- const shown = t3;
344
- let t4;
345
- if ($[11] !== blocked || $[12] !== loginCommands || $[13] !== openLogin || $[14] !== scopeId) {
346
- t4 = kind => openLogin === null || loginCommands?.[kind] === undefined ? null : {
314
+ if ($[9] !== blocked || $[10] !== loginCommands || $[11] !== openLogin || $[12] !== scopeId) {
315
+ t3 = kind => openLogin === null || loginCommands?.[kind] === undefined ? null : {
347
316
  blocked,
348
317
  open: account => void openLogin(scopeId, kind, account.id, account.name)
349
318
  };
350
- $[11] = blocked;
351
- $[12] = loginCommands;
352
- $[13] = openLogin;
353
- $[14] = scopeId;
354
- $[15] = t4;
319
+ $[9] = blocked;
320
+ $[10] = loginCommands;
321
+ $[11] = openLogin;
322
+ $[12] = scopeId;
323
+ $[13] = t3;
355
324
  } else {
356
- t4 = $[15];
325
+ t3 = $[13];
326
+ }
327
+ const loginFor = t3;
328
+ let t4;
329
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
330
+ t4 = /*#__PURE__*/_jsx("h2", {});
331
+ $[14] = t4;
332
+ } else {
333
+ t4 = $[14];
357
334
  }
358
- const loginFor = t4;
359
335
  let t5;
360
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
361
- t5 = /*#__PURE__*/_jsx("h2", {});
336
+ if ($[15] !== t) {
337
+ t5 = t("limits.title");
338
+ $[15] = t;
362
339
  $[16] = t5;
363
340
  } else {
364
341
  t5 = $[16];
365
342
  }
366
343
  let t6;
367
- if ($[17] !== t) {
368
- t6 = t("limits.title");
369
- $[17] = t;
344
+ if ($[17] !== t5) {
345
+ t6 = /*#__PURE__*/_jsx(SectionLabel, {
346
+ render: t4,
347
+ className: "grow",
348
+ children: t5
349
+ });
350
+ $[17] = t5;
370
351
  $[18] = t6;
371
352
  } else {
372
353
  t6 = $[18];
373
354
  }
374
355
  let t7;
375
- if ($[19] !== t6) {
376
- t7 = /*#__PURE__*/_jsx(SectionLabel, {
377
- render: t5,
378
- className: "grow",
379
- children: t6
380
- });
381
- $[19] = t6;
382
- $[20] = t7;
383
- } else {
384
- t7 = $[20];
385
- }
386
- let t8;
387
- if ($[21] !== current || $[22] !== filterable || $[23] !== groups || $[24] !== t) {
388
- t8 = filterable && /*#__PURE__*/_jsx(Segmented, {
356
+ if ($[19] !== current || $[20] !== filterable || $[21] !== groups || $[22] !== t) {
357
+ t7 = filterable && /*#__PURE__*/_jsx(Segmented, {
389
358
  value: current,
390
359
  options: [{
391
360
  id: "all",
392
361
  label: t("dialog.accounts.all")
393
- }, ...groups.map(_temp)],
362
+ }, ...groups.map(_temp2)],
394
363
  onValueChange: setFilter,
395
364
  label: t("limits.filter")
396
365
  });
397
- $[21] = current;
398
- $[22] = filterable;
399
- $[23] = groups;
400
- $[24] = t;
401
- $[25] = t8;
366
+ $[19] = current;
367
+ $[20] = filterable;
368
+ $[21] = groups;
369
+ $[22] = t;
370
+ $[23] = t7;
402
371
  } else {
403
- t8 = $[25];
372
+ t7 = $[23];
404
373
  }
405
- let t9;
406
- if ($[26] !== t7 || $[27] !== t8) {
407
- t9 = /*#__PURE__*/_jsxs("div", {
374
+ let t8;
375
+ if ($[24] !== t6 || $[25] !== t7) {
376
+ t8 = /*#__PURE__*/_jsxs("div", {
408
377
  className: "flex min-h-8 items-center gap-3",
409
- children: [t7, t8]
378
+ children: [t6, t7]
410
379
  });
411
- $[26] = t7;
412
- $[27] = t8;
380
+ $[24] = t6;
381
+ $[25] = t7;
382
+ $[26] = t8;
383
+ } else {
384
+ t8 = $[26];
385
+ }
386
+ let t9;
387
+ if ($[27] !== t) {
388
+ t9 = t("limits.explain");
389
+ $[27] = t;
413
390
  $[28] = t9;
414
391
  } else {
415
392
  t9 = $[28];
416
393
  }
417
394
  let t10;
418
- if ($[29] !== t) {
419
- t10 = t("limits.explain");
420
- $[29] = t;
395
+ if ($[29] !== t9) {
396
+ t10 = /*#__PURE__*/_jsx("p", {
397
+ className: "text-xs text-text-muted",
398
+ children: t9
399
+ });
400
+ $[29] = t9;
421
401
  $[30] = t10;
422
402
  } else {
423
403
  t10 = $[30];
424
404
  }
425
405
  let t11;
426
- if ($[31] !== t10) {
427
- t11 = /*#__PURE__*/_jsx("p", {
428
- className: "text-xs text-text-muted",
429
- children: t10
430
- });
431
- $[31] = t10;
432
- $[32] = t11;
433
- } else {
434
- t11 = $[32];
435
- }
436
- let t12;
437
- if ($[33] !== loginFor || $[34] !== now || $[35] !== shown) {
438
- let t13;
439
- if ($[37] !== loginFor || $[38] !== now) {
440
- t13 = group_2 => group_2.accounts.map(account_0 => /*#__PURE__*/_jsx(LimitCard, {
406
+ if ($[31] !== loginFor || $[32] !== now || $[33] !== shown) {
407
+ let t12;
408
+ if ($[35] !== loginFor || $[36] !== now) {
409
+ t12 = group_2 => group_2.accounts.map(account_0 => /*#__PURE__*/_jsx(LimitCard, {
441
410
  account: account_0,
442
411
  named: group_2.accounts.length > 1,
443
412
  now: now,
444
413
  login: loginFor(group_2.kind)
445
414
  }, account_0.id));
446
- $[37] = loginFor;
447
- $[38] = now;
448
- $[39] = t13;
415
+ $[35] = loginFor;
416
+ $[36] = now;
417
+ $[37] = t12;
449
418
  } else {
450
- t13 = $[39];
419
+ t12 = $[37];
451
420
  }
452
- t12 = shown.flatMap(t13);
453
- $[33] = loginFor;
454
- $[34] = now;
455
- $[35] = shown;
456
- $[36] = t12;
421
+ t11 = shown.flatMap(t12);
422
+ $[31] = loginFor;
423
+ $[32] = now;
424
+ $[33] = shown;
425
+ $[34] = t11;
457
426
  } else {
458
- t12 = $[36];
427
+ t11 = $[34];
459
428
  }
460
- let t13;
461
- if ($[40] !== t12) {
462
- t13 = /*#__PURE__*/_jsx("div", {
429
+ let t12;
430
+ if ($[38] !== t11) {
431
+ t12 = /*#__PURE__*/_jsx("div", {
463
432
  className: "grid grid-cols-2 gap-3",
464
- children: t12
433
+ children: t11
465
434
  });
466
- $[40] = t12;
467
- $[41] = t13;
435
+ $[38] = t11;
436
+ $[39] = t12;
468
437
  } else {
469
- t13 = $[41];
438
+ t12 = $[39];
470
439
  }
471
- let t14;
472
- if ($[42] !== t11 || $[43] !== t13 || $[44] !== t9) {
473
- t14 = /*#__PURE__*/_jsxs("section", {
440
+ let t13;
441
+ if ($[40] !== t10 || $[41] !== t12 || $[42] !== t8) {
442
+ t13 = /*#__PURE__*/_jsxs("section", {
474
443
  className: "flex flex-col gap-3",
475
- children: [t9, t11, t13]
444
+ children: [t8, t10, t12]
476
445
  });
477
- $[42] = t11;
446
+ $[40] = t10;
447
+ $[41] = t12;
448
+ $[42] = t8;
478
449
  $[43] = t13;
479
- $[44] = t9;
480
- $[45] = t14;
481
450
  } else {
482
- t14 = $[45];
451
+ t13 = $[43];
483
452
  }
484
- return t14;
453
+ return t13;
485
454
  }
486
- function _temp(group_1) {
455
+ function _temp2(group_1) {
487
456
  return {
488
457
  id: group_1.kind,
489
458
  label: PROVIDER_LABELS[group_1.kind]
490
459
  };
460
+ }
461
+ function _temp(row) {
462
+ return row.accounts?.loginCommands;
491
463
  }
@@ -9,6 +9,7 @@ import { useChatHost } from '../host.js';
9
9
  import { useChatScope } from '../scope.js';
10
10
  import { useProvidersStore } from '../state/providers.js';
11
11
  import { askedKey, summaryPayload, USAGE_PERIODS, useUsage, useUsageStore } from '../state/usage.js';
12
+ import { whenOpen } from '../transport.js';
12
13
  import { formatClock, formatCount, formatDate, formatTokens, PROVIDER_LABELS } from './format.js';
13
14
  import { useMoney } from './money.js';
14
15
  import { deriveUsage, labelEveryFor } from './summary.js';
@@ -174,15 +175,7 @@ function useSummary(scopeId, transport, period, account) {
174
175
  let t1;
175
176
  if ($[0] !== transport) {
176
177
  t0 = () => {
177
- const subscribe = () => void transport.request("usage.subscribe", {}).catch(_temp3);
178
- if (transport.status === "open") {
179
- subscribe();
180
- }
181
- const off = transport.subscribeStatus(status => {
182
- if (status === "open") {
183
- subscribe();
184
- }
185
- });
178
+ const off = whenOpen(transport, () => void transport.request("usage.subscribe", {}).catch(_temp3));
186
179
  return () => {
187
180
  off();
188
181
  transport.request("usage.unsubscribe", {}).catch(_temp4);
@@ -218,15 +211,8 @@ function useSummary(scopeId, transport, period, account) {
218
211
  let t4;
219
212
  if ($[8] !== load || $[9] !== transport) {
220
213
  t3 = () => {
221
- if (transport.status === "open") {
222
- load();
223
- }
214
+ const offStatus = whenOpen(transport, load);
224
215
  const offChanged = transport.on("usage.changed", load);
225
- const offStatus = transport.subscribeStatus(status_0 => {
226
- if (status_0 === "open") {
227
- load();
228
- }
229
- });
230
216
  return () => {
231
217
  offChanged();
232
218
  offStatus();
@@ -1,8 +1,8 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { useTranslation } from 'react-i18next';
3
- import { ProviderLogo } from '../agents/ProviderLogo.js';
4
3
  import { totalTokensOf } from '@adecore/agent-contracts';
5
- import { formatCount, formatTokens, PROVIDER_COLORS, PROVIDER_LABELS } from './format.js';
4
+ import { ChartLogo } from './ChartLogo.js';
5
+ import { formatCount, formatTokens, PROVIDER_LABELS } from './format.js';
6
6
  import { useMoney } from './money.js';
7
7
  /*
8
8
  * The number the page is about, with a row per provider under it. Those rows double as the chart's
@@ -106,13 +106,8 @@ export function UsageSummary(t0) {
106
106
  if ($[25] !== money) {
107
107
  t9 = provider => /*#__PURE__*/_jsxs("div", {
108
108
  className: "flex items-center gap-2 text-xs",
109
- children: [/*#__PURE__*/_jsx("span", {
110
- style: {
111
- color: PROVIDER_COLORS[provider.provider]
112
- },
113
- children: /*#__PURE__*/_jsx(ProviderLogo, {
114
- provider: provider.provider
115
- })
109
+ children: [/*#__PURE__*/_jsx(ChartLogo, {
110
+ provider: provider.provider
116
111
  }), /*#__PURE__*/_jsx("span", {
117
112
  className: "text-text",
118
113
  children: PROVIDER_LABELS[provider.provider]