@adecore/agents-react 0.39.0 → 0.40.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 (317) hide show
  1. package/dist/agents/AgentModelLabel.js +2 -1
  2. package/dist/agents/model-name.js +2 -1
  3. package/dist/agents/provider-paths.d.ts +2 -1
  4. package/dist/agents/provider-paths.js +7 -3
  5. package/dist/chat/account-choice.js +57 -28
  6. package/dist/chat/bookmarks.js +2 -1
  7. package/dist/chat/drafts.d.ts +0 -1
  8. package/dist/chat/drafts.js +9 -28
  9. package/dist/chat/logic/picker-entries.js +2 -8
  10. package/dist/chat/logic/resume-compaction.js +2 -5
  11. package/dist/chat/logic/timeline-copy.js +2 -8
  12. package/dist/chat/logic/timeline.js +9 -10
  13. package/dist/chat/logic/workflow.js +2 -4
  14. package/dist/chat/subagent-conversation.js +2 -1
  15. package/dist/chat/ui/GoalDock.js +2 -1
  16. package/dist/chat/ui/LimitState.js +4 -6
  17. package/dist/chat/ui/composer/use-continuable-turn.js +0 -1
  18. package/dist/chat/ui/composer/use-notice.js +2 -1
  19. package/dist/chat/ui/composer/use-prompt-history.js +1 -1
  20. package/dist/chat/ui/composer/use-prompt-menus.js +216 -253
  21. package/dist/chat/ui/composer/use-take-back.js +2 -2
  22. package/dist/chat/ui/diff/ApprovalReview.js +1 -1
  23. package/dist/chat/ui/highlighter.d.ts +0 -6
  24. package/dist/chat/ui/highlighter.js +0 -12
  25. package/dist/chat/ui/icons.d.ts +0 -1
  26. package/dist/chat/ui/icons.js +0 -3
  27. package/dist/chat/ui/rows/MessageRows.js +2 -5
  28. package/dist/chat/ui/rows/row-rhythm.js +2 -5
  29. package/dist/chat/ui/theme-watch.js +3 -7
  30. package/dist/prompts/logic/usePromptSession.js +2 -1
  31. package/dist/providers/AddAccountForm.js +2 -1
  32. package/dist/providers/CliDetail.js +104 -130
  33. package/dist/providers/account-actions.js +6 -9
  34. package/dist/state/chats.d.ts +1 -0
  35. package/dist/state/chats.js +6 -11
  36. package/dist/state/provider-accounts.d.ts +1 -1
  37. package/dist/state/provider-accounts.js +2 -8
  38. package/dist/transport.d.ts +2 -0
  39. package/dist/transport.js +14 -0
  40. package/dist/usage/ChartLogo.d.ts +5 -0
  41. package/dist/usage/ChartLogo.js +48 -0
  42. package/dist/usage/LimitsList.js +6 -16
  43. package/dist/usage/UsageBreakdown.js +17 -40
  44. package/dist/usage/UsageLimits.js +183 -211
  45. package/dist/usage/UsagePage.js +3 -17
  46. package/dist/usage/UsageSummary.js +4 -9
  47. package/dist/usage/limits.js +16 -31
  48. package/dist/usage/summary.d.ts +1 -1
  49. package/dist/usage/summary.js +3 -5
  50. package/package.json +27 -27
  51. package/src/agents/AccountDot.tsx +1 -0
  52. package/src/agents/AgentIcon.tsx +2 -0
  53. package/src/agents/AgentModelLabel.tsx +4 -6
  54. package/src/agents/ModelOptionControl.tsx +8 -0
  55. package/src/agents/account-limits.ts +3 -0
  56. package/src/agents/accounts.ts +12 -0
  57. package/src/agents/model-name.ts +13 -1
  58. package/src/agents/model-options.ts +2 -0
  59. package/src/agents/model-requirement.ts +4 -0
  60. package/src/agents/option-words.ts +2 -0
  61. package/src/agents/provider-paths.ts +8 -3
  62. package/src/agents/status-look.ts +1 -0
  63. package/src/chat/account-choice.ts +25 -19
  64. package/src/chat/actions.ts +5 -0
  65. package/src/chat/attachments.ts +8 -0
  66. package/src/chat/bookmarks.ts +13 -1
  67. package/src/chat/chat-client.ts +63 -0
  68. package/src/chat/chat-references.ts +3 -0
  69. package/src/chat/composer-effort.ts +5 -0
  70. package/src/chat/composer-send.ts +4 -0
  71. package/src/chat/drafts.ts +21 -17
  72. package/src/chat/forks.ts +4 -0
  73. package/src/chat/guards.ts +2 -0
  74. package/src/chat/index.ts +7 -0
  75. package/src/chat/logic/ansi.ts +47 -0
  76. package/src/chat/logic/bookmarks.ts +7 -0
  77. package/src/chat/logic/command-looks.ts +29 -0
  78. package/src/chat/logic/context-usage.ts +3 -0
  79. package/src/chat/logic/continue-after-stop.ts +5 -0
  80. package/src/chat/logic/effort.ts +4 -0
  81. package/src/chat/logic/embedded-code.ts +63 -0
  82. package/src/chat/logic/fork.ts +22 -0
  83. package/src/chat/logic/generated-image.ts +7 -0
  84. package/src/chat/logic/goal.ts +7 -0
  85. package/src/chat/logic/handback.ts +2 -0
  86. package/src/chat/logic/limit.ts +8 -0
  87. package/src/chat/logic/picker-entries.ts +16 -4
  88. package/src/chat/logic/resume-compaction.ts +22 -5
  89. package/src/chat/logic/scrubber.ts +38 -5
  90. package/src/chat/logic/thought.ts +5 -0
  91. package/src/chat/logic/thread-cards.ts +6 -0
  92. package/src/chat/logic/timeline-copy.ts +4 -9
  93. package/src/chat/logic/timeline-target.ts +15 -0
  94. package/src/chat/logic/timeline.ts +113 -10
  95. package/src/chat/logic/tools.ts +30 -0
  96. package/src/chat/logic/visual-height.ts +5 -0
  97. package/src/chat/logic/visual-viewport.ts +1 -0
  98. package/src/chat/logic/welcome.ts +3 -0
  99. package/src/chat/logic/workflow.ts +26 -7
  100. package/src/chat/mentions.ts +56 -0
  101. package/src/chat/pending-prompts.ts +16 -0
  102. package/src/chat/persisted-json.ts +15 -0
  103. package/src/chat/preferences.ts +16 -0
  104. package/src/chat/prompt-hold.ts +2 -0
  105. package/src/chat/quote.ts +7 -0
  106. package/src/chat/reading-width.ts +1 -0
  107. package/src/chat/recent-messages.ts +5 -0
  108. package/src/chat/resume-compaction-dismissals.ts +1 -0
  109. package/src/chat/stash.ts +12 -0
  110. package/src/chat/subagent-conversation.ts +24 -4
  111. package/src/chat/subagent-list.ts +14 -0
  112. package/src/chat/subagent-support.ts +1 -0
  113. package/src/chat/subagent-view.ts +9 -0
  114. package/src/chat/thumbnails.ts +14 -0
  115. package/src/chat/timeline-flash.ts +2 -0
  116. package/src/chat/timeline-scroll.ts +23 -0
  117. package/src/chat/ui/AccountPill.tsx +4 -0
  118. package/src/chat/ui/AnsiOutput.tsx +1 -0
  119. package/src/chat/ui/BookmarkMarker.tsx +5 -0
  120. package/src/chat/ui/BookmarkSubmenu.tsx +1 -0
  121. package/src/chat/ui/ChatActivity.tsx +13 -0
  122. package/src/chat/ui/CodeBlock.tsx +8 -0
  123. package/src/chat/ui/Composer.tsx +15 -0
  124. package/src/chat/ui/ComposerInput.tsx +22 -0
  125. package/src/chat/ui/DiffPool.tsx +3 -0
  126. package/src/chat/ui/EditDiff.tsx +5 -0
  127. package/src/chat/ui/GoalDock.tsx +13 -1
  128. package/src/chat/ui/ImageView.tsx +11 -0
  129. package/src/chat/ui/LimitState.tsx +23 -6
  130. package/src/chat/ui/Markdown.tsx +41 -0
  131. package/src/chat/ui/MermaidBlock.tsx +16 -0
  132. package/src/chat/ui/MessageActions.tsx +8 -0
  133. package/src/chat/ui/ModelMarks.tsx +1 -0
  134. package/src/chat/ui/Pickers.tsx +26 -0
  135. package/src/chat/ui/PromptComposer.tsx +2 -0
  136. package/src/chat/ui/PromptEditor.tsx +6 -0
  137. package/src/chat/ui/QuoteButton.tsx +12 -0
  138. package/src/chat/ui/ReferenceChip.tsx +3 -0
  139. package/src/chat/ui/ResumeCompactionDock.tsx +1 -0
  140. package/src/chat/ui/RowTime.tsx +1 -0
  141. package/src/chat/ui/RunSettings.tsx +38 -0
  142. package/src/chat/ui/Scrubber.tsx +14 -0
  143. package/src/chat/ui/SessionLine.tsx +1 -0
  144. package/src/chat/ui/ShellCommand.tsx +32 -0
  145. package/src/chat/ui/SubagentControls.tsx +7 -0
  146. package/src/chat/ui/SubagentInfo.tsx +1 -0
  147. package/src/chat/ui/SubagentStopButton.tsx +6 -0
  148. package/src/chat/ui/SubagentTimeline.tsx +10 -0
  149. package/src/chat/ui/Timeline.tsx +119 -0
  150. package/src/chat/ui/TimelineMenu.tsx +5 -0
  151. package/src/chat/ui/UnifiedDiff.tsx +6 -0
  152. package/src/chat/ui/UploadThumb.tsx +2 -0
  153. package/src/chat/ui/VisualDialogs.tsx +3 -0
  154. package/src/chat/ui/VisualFrame.tsx +15 -0
  155. package/src/chat/ui/Welcome.tsx +1 -0
  156. package/src/chat/ui/chip-clipboard.ts +20 -0
  157. package/src/chat/ui/code-lines.ts +14 -0
  158. package/src/chat/ui/code-theme.ts +1 -0
  159. package/src/chat/ui/composer/ComposerControls.tsx +5 -0
  160. package/src/chat/ui/composer/ComposerMenu.tsx +12 -0
  161. package/src/chat/ui/composer/DraftParts.tsx +2 -0
  162. package/src/chat/ui/composer/QueuedMessages.tsx +4 -0
  163. package/src/chat/ui/composer/chip-paste.ts +16 -0
  164. package/src/chat/ui/composer/chips.ts +6 -0
  165. package/src/chat/ui/composer/editor.ts +9 -0
  166. package/src/chat/ui/composer/insert.ts +2 -0
  167. package/src/chat/ui/composer/key-handler.ts +39 -0
  168. package/src/chat/ui/composer/keys.ts +23 -0
  169. package/src/chat/ui/composer/placeholder.ts +6 -0
  170. package/src/chat/ui/composer/prompt-picks.ts +1 -0
  171. package/src/chat/ui/composer/surface.ts +5 -0
  172. package/src/chat/ui/composer/use-chat-controls.ts +13 -0
  173. package/src/chat/ui/composer/use-compaction-offer.ts +3 -0
  174. package/src/chat/ui/composer/use-composer-menus.ts +2 -0
  175. package/src/chat/ui/composer/use-composer-submit.ts +27 -0
  176. package/src/chat/ui/composer/use-continuable-turn.ts +3 -5
  177. package/src/chat/ui/composer/use-draft-files.ts +24 -0
  178. package/src/chat/ui/composer/use-effort-stepper.ts +8 -0
  179. package/src/chat/ui/composer/use-notice.ts +4 -1
  180. package/src/chat/ui/composer/use-pending-requests.ts +3 -0
  181. package/src/chat/ui/composer/use-prompt-history.ts +20 -11
  182. package/src/chat/ui/composer/use-prompt-hold.ts +3 -0
  183. package/src/chat/ui/composer/use-prompt-menus.ts +34 -14
  184. package/src/chat/ui/composer/use-take-back.ts +20 -2
  185. package/src/chat/ui/diff/ApprovalReview.tsx +18 -15
  186. package/src/chat/ui/diff/DiffFallbackBoundary.tsx +1 -0
  187. package/src/chat/ui/diff/DiffOmitted.tsx +1 -0
  188. package/src/chat/ui/diff/DiffStack.tsx +2 -0
  189. package/src/chat/ui/diff/DiffUnavailable.tsx +1 -0
  190. package/src/chat/ui/diff/EditorEditDiff.tsx +13 -0
  191. package/src/chat/ui/diff/EditorPatchDiff.tsx +4 -0
  192. package/src/chat/ui/diff/LegacyDiffPool.tsx +2 -0
  193. package/src/chat/ui/diff/LegacyEditDiff.tsx +2 -0
  194. package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +8 -0
  195. package/src/chat/ui/diff/RawDiff.tsx +1 -0
  196. package/src/chat/ui/diff/ReviewDiff.tsx +1 -0
  197. package/src/chat/ui/diff/diff-source-budget.ts +8 -0
  198. package/src/chat/ui/diff/editor-edit-model.ts +4 -0
  199. package/src/chat/ui/diff/review-plan.ts +9 -0
  200. package/src/chat/ui/diff/review-settle.ts +1 -0
  201. package/src/chat/ui/diff/syntax-runtime.ts +52 -0
  202. package/src/chat/ui/diff/use-review-stack.ts +9 -0
  203. package/src/chat/ui/diff-syntax.ts +12 -0
  204. package/src/chat/ui/diff-theme.ts +2 -0
  205. package/src/chat/ui/file-links.ts +2 -0
  206. package/src/chat/ui/find-reveal.ts +1 -0
  207. package/src/chat/ui/full-diff.ts +1 -0
  208. package/src/chat/ui/highlighter.ts +29 -15
  209. package/src/chat/ui/icons.tsx +2 -4
  210. package/src/chat/ui/index.ts +4 -0
  211. package/src/chat/ui/intelligent-ui/UiBlockFrame.tsx +25 -0
  212. package/src/chat/ui/intelligent-ui/UiFallbackPart.tsx +1 -0
  213. package/src/chat/ui/intelligent-ui/UiReply.tsx +63 -0
  214. package/src/chat/ui/intelligent-ui/block-local.ts +5 -0
  215. package/src/chat/ui/intelligent-ui/chart-data.ts +15 -0
  216. package/src/chat/ui/intelligent-ui/node-text.ts +17 -0
  217. package/src/chat/ui/intelligent-ui/renderers/binding.ts +1 -0
  218. package/src/chat/ui/intelligent-ui/renderers/chart.tsx +31 -0
  219. package/src/chat/ui/intelligent-ui/renderers/choices.tsx +4 -0
  220. package/src/chat/ui/intelligent-ui/renderers/content.tsx +18 -0
  221. package/src/chat/ui/intelligent-ui/renderers/data.tsx +11 -0
  222. package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +13 -0
  223. package/src/chat/ui/intelligent-ui/renderers/links.tsx +9 -0
  224. package/src/chat/ui/intelligent-ui/renderers/map-slots.ts +15 -0
  225. package/src/chat/ui/intelligent-ui/renderers/map-style.ts +15 -0
  226. package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +48 -0
  227. package/src/chat/ui/intelligent-ui/renderers/map.tsx +20 -0
  228. package/src/chat/ui/intelligent-ui/renderers/place-point.ts +3 -0
  229. package/src/chat/ui/intelligent-ui/renderers/structure.tsx +3 -0
  230. package/src/chat/ui/intelligent-ui/renderers/text.tsx +8 -0
  231. package/src/chat/ui/intelligent-ui/reply-parts.ts +5 -0
  232. package/src/chat/ui/intelligent-ui/table-data.ts +17 -0
  233. package/src/chat/ui/intelligent-ui/use-in-view.ts +4 -0
  234. package/src/chat/ui/intelligent-ui/use-later.ts +4 -0
  235. package/src/chat/ui/intelligent-ui/use-truncated.ts +5 -0
  236. package/src/chat/ui/intelligent-ui/use-ui-links.ts +29 -0
  237. package/src/chat/ui/intelligent-ui/use-ui-queries.ts +60 -0
  238. package/src/chat/ui/markdown-blocks.ts +64 -0
  239. package/src/chat/ui/mermaid.ts +4 -0
  240. package/src/chat/ui/quote-selection.ts +10 -0
  241. package/src/chat/ui/rehype-chips.ts +5 -0
  242. package/src/chat/ui/rehype-fade.ts +2 -0
  243. package/src/chat/ui/remark-html-as-text.ts +5 -0
  244. package/src/chat/ui/reveal.ts +18 -0
  245. package/src/chat/ui/rows/ForksRow.tsx +5 -0
  246. package/src/chat/ui/rows/GeneratedImageRow.tsx +10 -0
  247. package/src/chat/ui/rows/MessageRows.tsx +29 -5
  248. package/src/chat/ui/rows/RowContainer.tsx +1 -0
  249. package/src/chat/ui/rows/Rows.tsx +2 -0
  250. package/src/chat/ui/rows/SubagentRow.tsx +13 -0
  251. package/src/chat/ui/rows/TaskRow.tsx +7 -0
  252. package/src/chat/ui/rows/VisualRow.tsx +4 -0
  253. package/src/chat/ui/rows/WorkRows.tsx +46 -0
  254. package/src/chat/ui/rows/WorkflowRow.tsx +10 -0
  255. package/src/chat/ui/rows/row-rhythm.ts +7 -5
  256. package/src/chat/ui/theme-watch.ts +8 -7
  257. package/src/chat/ui/thread-references.ts +7 -0
  258. package/src/chat/ui/use-diff-source-tokens.ts +8 -0
  259. package/src/chat/ui/useToggleSet.ts +3 -0
  260. package/src/chat/ui/visual-theme.ts +30 -0
  261. package/src/chat/visual-bridge.ts +23 -0
  262. package/src/chat/visual-viewport.ts +12 -0
  263. package/src/host-hooks.ts +6 -4
  264. package/src/host.ts +2 -0
  265. package/src/index.ts +3 -0
  266. package/src/lazy.tsx +9 -0
  267. package/src/mounted-registry.ts +4 -0
  268. package/src/port-transport.ts +32 -0
  269. package/src/prompts/index.ts +2 -0
  270. package/src/prompts/logic/focus.ts +5 -0
  271. package/src/prompts/logic/keys.ts +12 -0
  272. package/src/prompts/logic/prompts.ts +8 -0
  273. package/src/prompts/logic/subjects.ts +8 -0
  274. package/src/prompts/logic/useFocusAfterAnswer.ts +2 -0
  275. package/src/prompts/logic/usePromptSession.ts +13 -1
  276. package/src/prompts/ui/ApprovalBody.tsx +2 -0
  277. package/src/prompts/ui/PromptActions.tsx +2 -0
  278. package/src/prompts/ui/PromptCard.tsx +6 -0
  279. package/src/prompts/ui/PromptView.tsx +6 -0
  280. package/src/prompts/ui/QuestionBody.tsx +11 -0
  281. package/src/providers/AccountColors.tsx +1 -0
  282. package/src/providers/AccountDetail.tsx +7 -0
  283. package/src/providers/AccountVariables.tsx +2 -0
  284. package/src/providers/AddAccountForm.tsx +5 -1
  285. package/src/providers/CliDetail.tsx +6 -5
  286. package/src/providers/InstallPage.tsx +11 -0
  287. package/src/providers/ProviderList.tsx +3 -0
  288. package/src/providers/ProvidersPane.tsx +18 -0
  289. package/src/providers/account-actions.ts +10 -8
  290. package/src/providers/install-steps.ts +3 -0
  291. package/src/providers/pane-target.ts +5 -0
  292. package/src/providers/provider-abilities.ts +1 -0
  293. package/src/providers/provider-groups.ts +6 -0
  294. package/src/providers/variables.ts +12 -0
  295. package/src/scope.ts +2 -0
  296. package/src/state/chats.ts +61 -14
  297. package/src/state/index.ts +2 -0
  298. package/src/state/provider-accounts.ts +7 -9
  299. package/src/state/providers.ts +1 -0
  300. package/src/state/usage.ts +6 -0
  301. package/src/storage.ts +18 -0
  302. package/src/testing/prompts.ts +5 -0
  303. package/src/transport.ts +18 -0
  304. package/src/usage/ChartLogo.tsx +12 -0
  305. package/src/usage/LimitsList.tsx +7 -8
  306. package/src/usage/UsageBreakdown.tsx +11 -4
  307. package/src/usage/UsageChart.tsx +5 -0
  308. package/src/usage/UsageLimits.tsx +10 -7
  309. package/src/usage/UsageLimitsCard.tsx +2 -0
  310. package/src/usage/UsagePage.tsx +16 -19
  311. package/src/usage/UsageSummary.tsx +4 -5
  312. package/src/usage/UsageTiles.tsx +2 -0
  313. package/src/usage/format.ts +7 -0
  314. package/src/usage/limit-groups.ts +14 -0
  315. package/src/usage/limits.ts +11 -13
  316. package/src/usage/money.ts +1 -0
  317. package/src/usage/summary.ts +15 -7
@@ -149,18 +149,6 @@ export function loadLanguage(lang) {
149
149
  export function loadTheme(theme, custom) {
150
150
  return codeHighlighter().loadTheme(theme, custom);
151
151
  }
152
- /* The web bundle's highlighter once every one of `langs` and `theme` is in, or null while one is still on its way. */
153
- export function readyHighlighter(langs, theme) {
154
- return codeHighlighter().ready(langs, theme);
155
- }
156
- /* The language the web bundle draws `lang` in: the bundled grammar, or plain text. Only meaningful once a load settled. */
157
- export function loadedLanguage(lang) {
158
- return codeHighlighter().language(lang);
159
- }
160
- /* The web bundle's tokenizer for a language in a theme, or null while shiki, the grammar or the theme is still on its way. */
161
- export function tokenizerFor(lang, theme) {
162
- return codeHighlighter().tokenizer(lang, theme);
163
- }
164
152
  /* The inline style of one token; undefined when it only has the surrounding color. */
165
153
  export function tokenStyle(token) {
166
154
  const style = token.fontStyle ?? 0;
@@ -1,4 +1,3 @@
1
1
  import type { ReactNode } from 'react';
2
- export declare const DOCK_ICON_SIZE = 14;
3
2
  export declare const ROW_GUTTER = "grid h-5 w-4 shrink-0 place-items-center";
4
3
  export declare function toolIcon(name: string, size?: number): ReactNode;
@@ -3,9 +3,6 @@ import { toolEntry } from '../logic/tool-catalog.js';
3
3
  import { Icon } from '@adecore/ui';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  const SIZE = 12;
6
- /* A pending dock draws its mark a step up from the lines of a transcript, at the size a sidebar
7
- row uses, because it is a thing to answer rather than a thing to read past. */
8
- export const DOCK_ICON_SIZE = 14;
9
6
  /* The gutter every row in the thread opens with: 16 wide, on the line box of its first row of text,
10
7
  so the mark of a tool call, a note and a fold all sit in one column and their labels start at the
11
8
  same x. The same box the menu rows and the toasts use. */
@@ -786,11 +786,8 @@ function Writing() {
786
786
  return t1;
787
787
  }
788
788
  /*
789
- * A reply. A word at a time, it follows the text as it arrives. A block at a time, the blocks that
790
- * closed are drawn and fade in as they land, with "Writing…" where the next one will stand. Whole,
791
- * it says it is being written and fades in once it is done. Only a row that saw the reply being
792
- * written fades anything: an old reply scrolled back into view just stands there. A `#Name` it
793
- * spells for a view, node or chat of the project is a chip that opens it.
789
+ * A reply, streamed a word, a block or the whole of it at a time. Only a row that saw the reply being
790
+ * written fades anything in: an old reply scrolled back into view just stands there.
794
791
  */
795
792
  export function AssistantRow(t0) {
796
793
  const $ = _c(67);
@@ -3,11 +3,8 @@ import { isBlock } from '../../logic/timeline.js';
3
3
  /* Below this distance from the bottom a thread follows what the agent writes; above it the reader scrolled back on purpose. */
4
4
  export const FOLLOW_THRESHOLD_PX = 40;
5
5
  /*
6
- * The gaps a row wears for where it sits: a question is followed by its answer gap, and a seam where
7
- * the list rhythm of tool lines meets the block rhythm of prose gets the block gap. A visual and an
8
- * app's card have no margin of their own like prose does, so the row under one takes the block gap
9
- * too. A question already carries the gap before it, and the row after one is the answer, so neither
10
- * takes a seam.
6
+ * A seam where tool lines meet prose gets the block gap, and so does the row under a visual or an app's
7
+ * card, which have no margin of their own. A question and the answer after it never take a seam.
11
8
  */
12
9
  export function rowRhythm(row, previous) {
13
10
  const question = row.kind === 'user';
@@ -1,13 +1,9 @@
1
1
  /* The attributes of the root and the body an app switches its theme, its accent or its palette with. */
2
2
  const THEME_ATTRIBUTES = ['class', 'style', 'data-theme'];
3
3
  /*
4
- * Calls `changed` after the root of `owner` or its body changes a theme attribute, at most once a
5
- * frame, for whatever resolves the theme's tokens into colors of its own. A stylesheet that changes
6
- * changes no attribute, so an app that rewrites its palette that way touches the root's `style` as
7
- * well, the signal the terminal follows too. Returns what stops it.
8
- *
9
- * Any change of those attributes counts, also one that leaves every token as it was (a dialog that
10
- * locks the scroll writes the root's `style`), so a caller compares what it reads with what it drew.
4
+ * Calls `changed` at most once a frame after the root or body of `owner` changes a theme attribute. An app
5
+ * that rewrites its palette through a stylesheet touches the root's `style` as well, as the terminal expects.
6
+ * Any change counts, also one that leaves every token alone, so a caller compares what it reads with what it drew.
11
7
  */
12
8
  export function watchTheme(owner, changed) {
13
9
  const view = owner.defaultView ?? window;
@@ -1,4 +1,5 @@
1
1
  import { useRef, useState } from 'react';
2
+ import { errorMessage } from '../../transport.js';
2
3
  import { emptyPromptDraft } from './prompts.js';
3
4
  /*
4
5
  * What answering a row of prompts needs besides the prompts: a draft per request that survives
@@ -59,7 +60,7 @@ export function usePromptSession({
59
60
  } catch (cause) {
60
61
  setError({
61
62
  id: id_1,
62
- message: cause instanceof Error ? cause.message : String(cause)
63
+ message: errorMessage(cause)
63
64
  });
64
65
  return 'failed';
65
66
  } finally {
@@ -11,6 +11,7 @@ import { DetailHeader, SettingsRow, SettingsSection } from '@adecore/ui/settings
11
11
  import { Button, FormError, Icon, Input } from '@adecore/ui';
12
12
  import { CliTile } from './parts.js';
13
13
  import { providerAccountsOf } from '../state/provider-accounts.js';
14
+ import { errorMessage } from '../transport.js';
14
15
  /*
15
16
  * A name and a color, asked before anything exists, so the account is made once with both. By default
16
17
  * the machine makes the folder; under Advanced a person points at a folder of their own instead.
@@ -60,7 +61,7 @@ export function AddAccountForm({
60
61
  onAdded(await createAccount(scope, provider.kind, label, color), label, true);
61
62
  }
62
63
  } catch (e) {
63
- setError(e instanceof Error ? e.message : String(e));
64
+ setError(errorMessage(e));
64
65
  setBusy(false);
65
66
  }
66
67
  };
@@ -5,14 +5,14 @@ import { AccountDot } from '../agents/AccountDot.js';
5
5
  import { ModelOptionControl } from '../agents/ModelOptionControl.js';
6
6
  import { carryOptions } from '../agents/model-options.js';
7
7
  import { optionWord } from '../agents/option-words.js';
8
- import { ACCOUNT_TONE_CLASSES, accountName, accountStatusLine } from '../agents/accounts.js';
8
+ import { ACCOUNT_TONE_CLASSES, accountName, accountStatusLine, offeredAccounts } from '../agents/accounts.js';
9
9
  import { accountFor, forgetChatSelection, rememberChatAccount, rememberChatSelection, selectionFor, useChatPreferences } from '../chat/preferences.js';
10
10
  import { useChatScope } from '../scope.js';
11
11
  import { providerAbilities } from './provider-abilities.js';
12
12
  import { DetailHeader, SettingsRow, SettingsSection } from '@adecore/ui/settings';
13
13
  import { Button, Icon, Select } from '@adecore/ui';
14
14
  import { CliTile } from './parts.js';
15
- import { useProviderAccountsStore } from '../state/provider-accounts.js';
15
+ import { knownAccounts, useProviderAccounts } from '../state/provider-accounts.js';
16
16
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
17
17
  const PROVIDER_DEFAULT = '';
18
18
  /* One row per knob the chosen model exposes; the composer's option picker shows the same descriptors. */
@@ -85,7 +85,7 @@ function ModelOptionRows(t0) {
85
85
  }
86
86
  /* One CLI: what it is, what a new chat of it starts with unless `defaults` is off, and its accounts. */
87
87
  export function CliDetail(t0) {
88
- const $ = _c(57);
88
+ const $ = _c(49);
89
89
  const {
90
90
  provider,
91
91
  entries,
@@ -129,75 +129,48 @@ export function CliDetail(t0) {
129
129
  t2 = $[5];
130
130
  }
131
131
  const model = t2;
132
+ const machineAccounts = useProviderAccounts(knownAccounts);
133
+ let canAddAccount;
132
134
  let t3;
133
- if ($[8] !== scopeId) {
134
- t3 = s => s.byScope[scopeId]?.loaded ? s.byScope[scopeId].accounts : undefined;
135
- $[8] = scopeId;
136
- $[9] = t3;
137
- } else {
138
- t3 = $[9];
139
- }
140
- const machineAccounts = useProviderAccountsStore(t3);
141
135
  let t4;
142
- if ($[10] !== machineAccounts || $[11] !== preferences || $[12] !== provider.kind || $[13] !== scopeId) {
143
- t4 = accountFor(preferences, scopeId, provider.kind, machineAccounts) ?? provider.kind;
144
- $[10] = machineAccounts;
145
- $[11] = preferences;
146
- $[12] = provider.kind;
147
- $[13] = scopeId;
148
- $[14] = t4;
149
- } else {
150
- t4 = $[14];
151
- }
152
- const picked = t4;
153
- let canAddAccount;
154
- let t5;
155
- let t6;
156
- if ($[15] !== defaults || $[16] !== entries || $[17] !== login || $[18] !== model || $[19] !== onAddAccount || $[20] !== picked || $[21] !== provider || $[22] !== scopeId || $[23] !== selection?.options || $[24] !== t) {
157
- let t7;
158
- if ($[28] !== picked) {
159
- t7 = entry_0 => entry_0.account.enabled !== false || entry_0.id === picked;
160
- $[28] = picked;
161
- $[29] = t7;
162
- } else {
163
- t7 = $[29];
164
- }
165
- const choosable = (entries ?? []).filter(t7);
136
+ if ($[8] !== defaults || $[9] !== entries || $[10] !== login || $[11] !== machineAccounts || $[12] !== model || $[13] !== onAddAccount || $[14] !== preferences || $[15] !== provider || $[16] !== scopeId || $[17] !== selection?.options || $[18] !== t) {
137
+ const picked = accountFor(preferences, scopeId, provider.kind, machineAccounts) ?? provider.kind;
138
+ const choosable = offeredAccounts(entries ?? [], picked);
166
139
  canAddAccount = login !== null;
167
- let t8;
168
- if ($[30] !== provider.kind) {
169
- t8 = /*#__PURE__*/_jsx(CliTile, {
140
+ let t5;
141
+ if ($[22] !== provider.kind) {
142
+ t5 = /*#__PURE__*/_jsx(CliTile, {
170
143
  kind: provider.kind
171
144
  });
172
- $[30] = provider.kind;
173
- $[31] = t8;
145
+ $[22] = provider.kind;
146
+ $[23] = t5;
174
147
  } else {
175
- t8 = $[31];
148
+ t5 = $[23];
176
149
  }
177
- const t9 = provider.name;
178
- let t10;
179
- if ($[32] !== provider.version || $[33] !== t) {
180
- t10 = provider.version ? `${t("abilities.version", {
150
+ const t6 = provider.name;
151
+ let t7;
152
+ if ($[24] !== provider.version || $[25] !== t) {
153
+ t7 = provider.version ? `${t("abilities.version", {
181
154
  version: provider.version
182
155
  })} ` : "";
183
- $[32] = provider.version;
184
- $[33] = t;
185
- $[34] = t10;
156
+ $[24] = provider.version;
157
+ $[25] = t;
158
+ $[26] = t7;
186
159
  } else {
187
- t10 = $[34];
160
+ t7 = $[26];
188
161
  }
189
- let t11;
190
- if ($[35] !== provider) {
191
- t11 = providerAbilities(provider);
192
- $[35] = provider;
193
- $[36] = t11;
162
+ let t8;
163
+ if ($[27] !== provider) {
164
+ t8 = providerAbilities(provider);
165
+ $[27] = provider;
166
+ $[28] = t8;
194
167
  } else {
195
- t11 = $[36];
168
+ t8 = $[28];
196
169
  }
197
- const t12 = `${t10}${t11}`;
198
- let t13;
199
- if ($[37] !== canAddAccount || $[38] !== onAddAccount || $[39] !== t) {
200
- t13 = canAddAccount && /*#__PURE__*/_jsxs(Button, {
170
+ const t9 = `${t7}${t8}`;
171
+ let t10;
172
+ if ($[29] !== canAddAccount || $[30] !== onAddAccount || $[31] !== t) {
173
+ t10 = canAddAccount && /*#__PURE__*/_jsxs(Button, {
201
174
  variant: "secondary",
202
175
  className: "whitespace-nowrap",
203
176
  onClick: onAddAccount,
@@ -206,29 +179,29 @@ export function CliDetail(t0) {
206
179
  size: 14
207
180
  }), t("cli.addAccount")]
208
181
  });
209
- $[37] = canAddAccount;
210
- $[38] = onAddAccount;
211
- $[39] = t;
212
- $[40] = t13;
182
+ $[29] = canAddAccount;
183
+ $[30] = onAddAccount;
184
+ $[31] = t;
185
+ $[32] = t10;
213
186
  } else {
214
- t13 = $[40];
187
+ t10 = $[32];
215
188
  }
216
- if ($[41] !== provider.name || $[42] !== t12 || $[43] !== t13 || $[44] !== t8) {
217
- t5 = /*#__PURE__*/_jsx(DetailHeader, {
218
- mark: t8,
219
- title: t9,
220
- subtitle: t12,
221
- actions: t13
189
+ if ($[33] !== provider.name || $[34] !== t10 || $[35] !== t5 || $[36] !== t9) {
190
+ t3 = /*#__PURE__*/_jsx(DetailHeader, {
191
+ mark: t5,
192
+ title: t6,
193
+ subtitle: t9,
194
+ actions: t10
222
195
  });
223
- $[41] = provider.name;
224
- $[42] = t12;
225
- $[43] = t13;
226
- $[44] = t8;
227
- $[45] = t5;
196
+ $[33] = provider.name;
197
+ $[34] = t10;
198
+ $[35] = t5;
199
+ $[36] = t9;
200
+ $[37] = t3;
228
201
  } else {
229
- t5 = $[45];
202
+ t3 = $[37];
230
203
  }
231
- t6 = defaults && /*#__PURE__*/_jsxs(SettingsSection, {
204
+ t4 = defaults && /*#__PURE__*/_jsxs(SettingsSection, {
232
205
  title: t("cli.defaults.title"),
233
206
  description: t("cli.defaults.description"),
234
207
  children: [choosable.length > 0 && /*#__PURE__*/_jsx(SettingsRow, {
@@ -240,11 +213,11 @@ export function CliDetail(t0) {
240
213
  provider: provider.name
241
214
  }),
242
215
  align: "end",
243
- items: choosable.map(entry_1 => ({
244
- value: entry_1.id,
245
- label: accountName(entry_1, provider.name),
216
+ items: choosable.map(entry_0 => ({
217
+ value: entry_0.id,
218
+ label: accountName(entry_0, provider.name),
246
219
  icon: /*#__PURE__*/_jsx(AccountDot, {
247
- color: entry_1.account.color,
220
+ color: entry_0.account.color,
248
221
  className: "size-2"
249
222
  })
250
223
  })),
@@ -265,15 +238,15 @@ export function CliDetail(t0) {
265
238
  items: [{
266
239
  value: PROVIDER_DEFAULT,
267
240
  label: t("cli.defaults.providerDefault")
268
- }, ...provider.models.map(entry_2 => ({
269
- value: entry_2.slug,
270
- label: entry_2.legacy ? t("cli.defaults.legacyModel", {
271
- name: entry_2.name
272
- }) : entry_2.name
241
+ }, ...provider.models.map(entry_1 => ({
242
+ value: entry_1.slug,
243
+ label: entry_1.legacy ? t("cli.defaults.legacyModel", {
244
+ name: entry_1.name
245
+ }) : entry_1.name
273
246
  }))],
274
247
  onValueChange: value => value === PROVIDER_DEFAULT ? forgetChatSelection(provider.kind) : rememberChatSelection(provider.kind, {
275
248
  model: value,
276
- options: carryOptions(selection?.options ?? {}, provider.models.find(entry_3 => entry_3.slug === value))
249
+ options: carryOptions(selection?.options ?? {}, provider.models.find(entry_2 => entry_2.slug === value))
277
250
  })
278
251
  })
279
252
  }), model && /*#__PURE__*/_jsx(ModelOptionRows, {
@@ -285,27 +258,28 @@ export function CliDetail(t0) {
285
258
  label: t("cli.defaults.usesCliDefault")
286
259
  })]
287
260
  });
288
- $[15] = defaults;
289
- $[16] = entries;
290
- $[17] = login;
291
- $[18] = model;
292
- $[19] = onAddAccount;
293
- $[20] = picked;
294
- $[21] = provider;
295
- $[22] = scopeId;
296
- $[23] = selection?.options;
297
- $[24] = t;
298
- $[25] = canAddAccount;
299
- $[26] = t5;
300
- $[27] = t6;
261
+ $[8] = defaults;
262
+ $[9] = entries;
263
+ $[10] = login;
264
+ $[11] = machineAccounts;
265
+ $[12] = model;
266
+ $[13] = onAddAccount;
267
+ $[14] = preferences;
268
+ $[15] = provider;
269
+ $[16] = scopeId;
270
+ $[17] = selection?.options;
271
+ $[18] = t;
272
+ $[19] = canAddAccount;
273
+ $[20] = t3;
274
+ $[21] = t4;
301
275
  } else {
302
- canAddAccount = $[25];
303
- t5 = $[26];
304
- t6 = $[27];
276
+ canAddAccount = $[19];
277
+ t3 = $[20];
278
+ t4 = $[21];
305
279
  }
306
- let t7;
307
- if ($[46] !== canAddAccount || $[47] !== entries || $[48] !== login || $[49] !== onPickAccount || $[50] !== provider.name || $[51] !== t) {
308
- t7 = entries === null ? /*#__PURE__*/_jsx("p", {
280
+ let t5;
281
+ if ($[38] !== canAddAccount || $[39] !== entries || $[40] !== login || $[41] !== onPickAccount || $[42] !== provider.name || $[43] !== t) {
282
+ t5 = entries === null ? /*#__PURE__*/_jsx("p", {
309
283
  className: "text-xs text-text-faint",
310
284
  children: t("list.noAccounts")
311
285
  }) : /*#__PURE__*/_jsx(SettingsSection, {
@@ -313,17 +287,17 @@ export function CliDetail(t0) {
313
287
  footer: canAddAccount ? undefined : t("cli.onlyDefault", {
314
288
  provider: provider.name
315
289
  }),
316
- children: entries.map(entry_4 => {
317
- const status = accountStatusLine(entry_4.status, login === "terminal");
290
+ children: entries.map(entry_3 => {
291
+ const status = accountStatusLine(entry_3.status, login === "terminal");
318
292
  return /*#__PURE__*/_jsxs("button", {
319
293
  type: "button",
320
294
  className: "flex w-full min-w-0 items-center gap-3 px-4.5 py-3 text-left first:rounded-t-xl last:rounded-b-xl hover:bg-surface-hover",
321
- onClick: () => onPickAccount(entry_4.id),
295
+ onClick: () => onPickAccount(entry_3.id),
322
296
  children: [/*#__PURE__*/_jsx(AccountDot, {
323
- color: entry_4.account.color
297
+ color: entry_3.account.color
324
298
  }), /*#__PURE__*/_jsx("span", {
325
299
  className: "min-w-0 grow truncate text-sm text-text",
326
- children: accountName(entry_4, provider.name)
300
+ children: accountName(entry_3, provider.name)
327
301
  }), /*#__PURE__*/_jsx("span", {
328
302
  className: `shrink-0 text-xs ${ACCOUNT_TONE_CLASSES[status.tone]}`,
329
303
  children: status.text
@@ -332,30 +306,30 @@ export function CliDetail(t0) {
332
306
  size: 14,
333
307
  className: "shrink-0 text-text-faint"
334
308
  })]
335
- }, entry_4.id);
309
+ }, entry_3.id);
336
310
  })
337
311
  });
338
- $[46] = canAddAccount;
339
- $[47] = entries;
340
- $[48] = login;
341
- $[49] = onPickAccount;
342
- $[50] = provider.name;
343
- $[51] = t;
344
- $[52] = t7;
312
+ $[38] = canAddAccount;
313
+ $[39] = entries;
314
+ $[40] = login;
315
+ $[41] = onPickAccount;
316
+ $[42] = provider.name;
317
+ $[43] = t;
318
+ $[44] = t5;
345
319
  } else {
346
- t7 = $[52];
320
+ t5 = $[44];
347
321
  }
348
- let t8;
349
- if ($[53] !== t5 || $[54] !== t6 || $[55] !== t7) {
350
- t8 = /*#__PURE__*/_jsxs(_Fragment, {
351
- children: [t5, t6, t7]
322
+ let t6;
323
+ if ($[45] !== t3 || $[46] !== t4 || $[47] !== t5) {
324
+ t6 = /*#__PURE__*/_jsxs(_Fragment, {
325
+ children: [t3, t4, t5]
352
326
  });
353
- $[53] = t5;
354
- $[54] = t6;
355
- $[55] = t7;
356
- $[56] = t8;
327
+ $[45] = t3;
328
+ $[46] = t4;
329
+ $[47] = t5;
330
+ $[48] = t6;
357
331
  } else {
358
- t8 = $[56];
332
+ t6 = $[48];
359
333
  }
360
- return t8;
334
+ return t6;
361
335
  }
@@ -1,12 +1,10 @@
1
1
  import i18next from 'i18next';
2
2
  import { accountFor, readChatPreferences, rememberChatAccount } from '../chat/preferences.js';
3
3
  import { providerAccountsOf, useProviderAccountsStore } from '../state/provider-accounts.js';
4
+ import { errorMessage } from '../transport.js';
4
5
  function words(key, values) {
5
6
  return i18next.t(`agent-providers:${key}`, values);
6
7
  }
7
- function reason(e) {
8
- return e instanceof Error ? e.message : String(e);
9
- }
10
8
  function linkTo(scope) {
11
9
  if (scope.transport.status !== 'open') {
12
10
  throw new Error(words('notAnswering'));
@@ -25,7 +23,7 @@ export async function saveAccounts(scope, host, accounts) {
25
23
  id: `providers-save-${scope.id}`,
26
24
  kind: 'error',
27
25
  title: words('account.saveFailed'),
28
- description: reason(e)
26
+ description: errorMessage(e)
29
27
  });
30
28
  return false;
31
29
  }
@@ -56,15 +54,14 @@ export async function removeAccount(scope, host, id, kind) {
56
54
  }
57
55
  /* An account in a folder the host makes for it; answers its id. Throws what the host said, for the form to show. */
58
56
  export async function createAccount(scope, kind, label, color) {
59
- const created = await linkTo(scope).request('accounts.create', {
57
+ const {
58
+ id,
59
+ ...accounts
60
+ } = await linkTo(scope).request('accounts.create', {
60
61
  kind,
61
62
  label,
62
63
  color
63
64
  });
64
- const {
65
- id,
66
- ...accounts
67
- } = created;
68
65
  useProviderAccountsStore.getState().set(scope.id, accounts);
69
66
  return id;
70
67
  }
@@ -43,6 +43,7 @@ interface ChatsStore {
43
43
  forget(key: string): void;
44
44
  forgetWhere(matches: (key: string) => boolean): void;
45
45
  }
46
+ export declare function isWaiting(item: ChatItem | undefined): item is ChatApprovalItem | ChatQuestionItem;
46
47
  export declare function prependPage(state: ChatState, cursor: string, page: ChatHistoryResult): ChatState;
47
48
  export declare function waitingRequestsOf(chat: Pick<ChatState, 'structure' | 'order' | 'waitingBefore'> | undefined): Array<ChatApprovalItem | ChatQuestionItem>;
48
49
  export declare function applyEvent(state: ChatState, event: ChatEvent): ChatState;
@@ -3,7 +3,7 @@ import { useContext } from 'react';
3
3
  import { create } from 'zustand';
4
4
  import { appendToolOutput } from '@adecore/agent-contracts/text';
5
5
  import { ChatScopeContext, useChatScope } from '../scope.js';
6
- function isWaiting(item) {
6
+ export function isWaiting(item) {
7
7
  return item?.kind === 'approval' && item.decision === 'pending' || item?.kind === 'question' && item.state === 'pending';
8
8
  }
9
9
  function stateOf(info, items, page) {
@@ -215,10 +215,7 @@ function applyUpdate(state, event, write) {
215
215
  text: item.text + event.text
216
216
  };
217
217
  // The first text is structure after all, since an empty reply that is not streaming has no row.
218
- if (item.text === '') {
219
- return write(state, grown);
220
- }
221
- return write(state, grown, false);
218
+ return write(state, grown, item.text === '');
222
219
  }
223
220
  if (item?.kind === 'tool' && item.state === 'running') {
224
221
  const progress = item.progress ?? {
@@ -226,14 +223,13 @@ function applyUpdate(state, event, write) {
226
223
  description: null,
227
224
  output: null
228
225
  };
229
- const grown = {
226
+ return write(state, {
230
227
  ...item,
231
228
  progress: {
232
229
  ...progress,
233
230
  output: appendToolOutput(progress.output, event.text)
234
231
  }
235
- };
236
- return write(state, grown, false);
232
+ }, false);
237
233
  }
238
234
  return state;
239
235
  }
@@ -338,9 +334,8 @@ export const useChats = create(set => ({
338
334
  });
339
335
  },
340
336
  /*
341
- * The status of a chat this window is not reading, which the host sends for every chat it has
342
- * loaded. The thread stays empty until somebody attaches, since this is what a header, a list and
343
- * the counters need, and they ask the info and never the items.
337
+ * The host sends this for every chat it has loaded. The thread stays empty until somebody attaches,
338
+ * since a header, a list and the counters read the info and never the items.
344
339
  */
345
340
  status(key, info) {
346
341
  set(s => {
@@ -1,5 +1,5 @@
1
1
  import type { ProviderAccounts } from '@adecore/agent-contracts';
2
- import type { ChatTransport } from '../transport.js';
2
+ import { type ChatTransport } from '../transport.js';
3
3
  export interface ProviderAccountsRow {
4
4
  accounts: ProviderAccounts | null;
5
5
  loaded: boolean;
@@ -1,6 +1,7 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { create } from 'zustand';
3
3
  import { useChatScope } from '../scope.js';
4
+ import { whenOpen } from '../transport.js';
4
5
  /* One object for a host that has not answered yet, so a selector gets a stable snapshot. */
5
6
  const NONE = {
6
7
  accounts: null,
@@ -78,13 +79,6 @@ export function watchProviderAccounts(scopeId, transport) {
78
79
  const off = [transport.on('accounts.changed', accounts => {
79
80
  changes += 1;
80
81
  store.set(scopeId, accounts);
81
- }), transport.subscribeStatus(status => {
82
- if (status === 'open') {
83
- load();
84
- }
85
- })];
86
- if (transport.status === 'open') {
87
- load();
88
- }
82
+ }), whenOpen(transport, load)];
89
83
  return () => off.forEach(stop => stop());
90
84
  }
@@ -21,4 +21,6 @@ export declare class ChatTransportError extends Error {
21
21
  constructor(code: string, message: string);
22
22
  }
23
23
  export declare function errorCode(error: unknown): string | null;
24
+ export declare function whenOpen(transport: ChatTransport, run: () => void): () => void;
25
+ export declare function errorMessage(error: unknown): string;
24
26
  export declare function isConnectionError(error: unknown): boolean;
package/dist/transport.js CHANGED
@@ -11,6 +11,20 @@ export class ChatTransportError extends Error {
11
11
  export function errorCode(error) {
12
12
  return typeof error === 'object' && error !== null && 'code' in error && typeof error.code === 'string' ? error.code : null;
13
13
  }
14
+ /* Runs `run` now while the link is up and again each time it comes back; answers the function that stops it. */
15
+ export function whenOpen(transport, run) {
16
+ if (transport.status === 'open') {
17
+ run();
18
+ }
19
+ return transport.subscribeStatus(status => {
20
+ if (status === 'open') {
21
+ run();
22
+ }
23
+ });
24
+ }
25
+ export function errorMessage(error) {
26
+ return error instanceof Error ? error.message : String(error);
27
+ }
14
28
  /* Whether a request failed because the link was down rather than because the host refused it; the reconnect asks again. */
15
29
  export function isConnectionError(error) {
16
30
  const code = errorCode(error);
@@ -0,0 +1,5 @@
1
+ import type { UsageProvider } from '@adecore/agent-contracts';
2
+ export declare function ChartLogo({ provider, className }: {
3
+ provider: UsageProvider;
4
+ className?: string;
5
+ }): import("react").JSX.Element;