@adecore/agents-react 0.54.15 → 0.55.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 (91) hide show
  1. package/dist/agents/AgentModelLabel.d.ts +5 -0
  2. package/dist/agents/AgentModelLabel.js +32 -7
  3. package/dist/chat/account-choice.d.ts +1 -0
  4. package/dist/chat/account-choice.js +13 -4
  5. package/dist/chat/mentions.d.ts +24 -2
  6. package/dist/chat/mentions.js +84 -10
  7. package/dist/chat/subagent-list.d.ts +0 -1
  8. package/dist/chat/subagent-list.js +1 -9
  9. package/dist/chat/tag-suggestions.d.ts +22 -0
  10. package/dist/chat/tag-suggestions.js +71 -0
  11. package/dist/chat/ui/Composer.js +489 -447
  12. package/dist/chat/ui/ComposerInput.d.ts +1 -0
  13. package/dist/chat/ui/ComposerInput.js +9 -1
  14. package/dist/chat/ui/Markdown.js +41 -25
  15. package/dist/chat/ui/NamedChip.d.ts +5 -0
  16. package/dist/chat/ui/NamedChip.js +118 -0
  17. package/dist/chat/ui/Pickers.d.ts +0 -4
  18. package/dist/chat/ui/Pickers.js +1 -141
  19. package/dist/chat/ui/PromptEditor.js +2 -1
  20. package/dist/chat/ui/ReferenceChip.d.ts +3 -2
  21. package/dist/chat/ui/ReferenceChip.js +58 -36
  22. package/dist/chat/ui/RunSettings.d.ts +3 -2
  23. package/dist/chat/ui/RunSettings.js +386 -361
  24. package/dist/chat/ui/SubagentInfo.js +98 -114
  25. package/dist/chat/ui/SubagentTimeline.js +65 -43
  26. package/dist/chat/ui/Timeline.js +14 -8
  27. package/dist/chat/ui/chip-clipboard.js +10 -0
  28. package/dist/chat/ui/composer/ComposerControls.d.ts +6 -1
  29. package/dist/chat/ui/composer/ComposerControls.js +171 -158
  30. package/dist/chat/ui/composer/ComposerMenu.js +187 -55
  31. package/dist/chat/ui/composer/ComposerPlusMenu.d.ts +18 -0
  32. package/dist/chat/ui/composer/ComposerPlusMenu.js +400 -0
  33. package/dist/chat/ui/composer/ComposerStatusLine.d.ts +4 -0
  34. package/dist/chat/ui/composer/ComposerStatusLine.js +239 -0
  35. package/dist/chat/ui/composer/chips.d.ts +2 -0
  36. package/dist/chat/ui/composer/chips.js +66 -5
  37. package/dist/chat/ui/composer/insert.d.ts +1 -0
  38. package/dist/chat/ui/composer/insert.js +24 -0
  39. package/dist/chat/ui/composer/use-composer-menus.js +34 -17
  40. package/dist/chat/ui/composer/use-prompt-menus.d.ts +10 -2
  41. package/dist/chat/ui/composer/use-prompt-menus.js +290 -202
  42. package/dist/chat/ui/covered-bottom.d.ts +1 -0
  43. package/dist/chat/ui/covered-bottom.js +6 -0
  44. package/dist/chat/ui/named-chip-look.d.ts +14 -0
  45. package/dist/chat/ui/named-chip-look.js +72 -0
  46. package/dist/chat/ui/rehype-chips.js +13 -2
  47. package/dist/host-hooks.d.ts +2 -1
  48. package/dist/host-hooks.js +6 -0
  49. package/dist/host.d.ts +17 -0
  50. package/dist/index.d.ts +1 -1
  51. package/dist/locales/en/agent-chat.d.ts +14 -2
  52. package/dist/locales/en/agent-chat.js +16 -4
  53. package/dist/locales/nl/agent-chat.d.ts +14 -2
  54. package/dist/locales/nl/agent-chat.js +16 -4
  55. package/dist/state/chats.d.ts +1 -0
  56. package/dist/state/chats.js +45 -0
  57. package/package.json +9 -9
  58. package/src/agents/AgentModelLabel.tsx +10 -1
  59. package/src/chat/account-choice.ts +8 -0
  60. package/src/chat/mentions.ts +110 -13
  61. package/src/chat/subagent-list.ts +1 -14
  62. package/src/chat/tag-suggestions.ts +121 -0
  63. package/src/chat/ui/Composer.tsx +24 -12
  64. package/src/chat/ui/ComposerInput.tsx +13 -1
  65. package/src/chat/ui/Markdown.tsx +5 -0
  66. package/src/chat/ui/NamedChip.tsx +34 -0
  67. package/src/chat/ui/Pickers.tsx +1 -51
  68. package/src/chat/ui/PromptEditor.tsx +7 -1
  69. package/src/chat/ui/ReferenceChip.tsx +15 -4
  70. package/src/chat/ui/RunSettings.tsx +51 -29
  71. package/src/chat/ui/SubagentInfo.tsx +17 -17
  72. package/src/chat/ui/SubagentTimeline.tsx +7 -2
  73. package/src/chat/ui/Timeline.tsx +11 -5
  74. package/src/chat/ui/chip-clipboard.ts +8 -1
  75. package/src/chat/ui/composer/ComposerControls.tsx +24 -17
  76. package/src/chat/ui/composer/ComposerMenu.tsx +83 -15
  77. package/src/chat/ui/composer/ComposerPlusMenu.tsx +158 -0
  78. package/src/chat/ui/composer/ComposerStatusLine.tsx +94 -0
  79. package/src/chat/ui/composer/chips.ts +78 -7
  80. package/src/chat/ui/composer/insert.ts +12 -0
  81. package/src/chat/ui/composer/use-composer-menus.ts +5 -2
  82. package/src/chat/ui/composer/use-prompt-menus.ts +55 -10
  83. package/src/chat/ui/covered-bottom.ts +7 -0
  84. package/src/chat/ui/named-chip-look.ts +64 -0
  85. package/src/chat/ui/rehype-chips.ts +17 -2
  86. package/src/host-hooks.ts +11 -1
  87. package/src/host.ts +29 -0
  88. package/src/index.ts +2 -0
  89. package/src/locales/en/agent-chat.ts +16 -4
  90. package/src/locales/nl/agent-chat.ts +16 -4
  91. package/src/state/chats.ts +26 -0
@@ -0,0 +1 @@
1
+ export declare const CoveredBottomContext: import("react").Context<number>;
@@ -0,0 +1,6 @@
1
+ import { createContext } from 'react';
2
+ /*
3
+ * How far up from its bottom the composer covers a view that stands in the thread's place, such as a
4
+ * sub-agent's conversation, so that view scrolls on under the card and fades out the way the thread does.
5
+ */
6
+ export const CoveredBottomContext = createContext(0);
@@ -0,0 +1,14 @@
1
+ import { type AgentKind, type ProviderAccounts, type ProviderInfo } from '@adecore/agent-contracts';
2
+ import { type AccentChoice } from '../../host.js';
3
+ import type { NamedChipKind } from '../mentions.js';
4
+ export interface NamedChipLook {
5
+ label: string;
6
+ color: string | undefined;
7
+ }
8
+ export type NamedChipLookup = (kind: NamedChipKind, cli: string, id: string) => NamedChipLook;
9
+ export interface NamedChipHome {
10
+ provider: AgentKind;
11
+ account: string | undefined;
12
+ }
13
+ export declare function namedChipLookup(providers: readonly ProviderInfo[], accounts: ProviderAccounts | null, accents: readonly AccentChoice[], home: NamedChipHome | null): NamedChipLookup;
14
+ export declare function useNamedChipLookup(home?: NamedChipHome | null): NamedChipLookup;
@@ -0,0 +1,72 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { UsageProviderSchema } from '@adecore/agent-contracts';
3
+ import { useContext } from 'react';
4
+ import { accountColor, accountName, accountsOfKind, topAccountEntry } from '../../agents/accounts.js';
5
+ import { useChatHost } from '../../host.js';
6
+ import { ChatScopeContext } from '../../scope.js';
7
+ import { useProviderAccountsStore } from '../../state/provider-accounts.js';
8
+ import { useProvidersStore } from '../../state/providers.js';
9
+ import { PROVIDER_COLORS } from '../../usage/format.js';
10
+ const NO_PROVIDERS = [];
11
+ export function namedChipLookup(providers, accounts, accents, home) {
12
+ const colorOf = (cli, accountId) => {
13
+ const entries = accountsOfKind(accounts, cli);
14
+ const entry = accountId === undefined ? topAccountEntry(entries) : entries.find(candidate => candidate.id === accountId);
15
+ const kind = UsageProviderSchema.safeParse(cli);
16
+ return accountColor(entry?.account.color, accents) ?? (kind.success ? PROVIDER_COLORS[kind.data] : undefined);
17
+ };
18
+ return (kind, cli, id) => {
19
+ const provider = providers.find(entry => entry.kind === cli);
20
+ if (kind === 'model') {
21
+ const account = home?.provider === cli ? home.account ?? cli : undefined;
22
+ return {
23
+ label: provider?.models.find(model => model.slug === id)?.name ?? id,
24
+ color: colorOf(cli, account)
25
+ };
26
+ }
27
+ const entry = accountsOfKind(accounts, cli).find(candidate => candidate.id === id);
28
+ return {
29
+ label: entry === undefined ? id : accountName(entry, provider?.name ?? cli),
30
+ color: colorOf(cli, id)
31
+ };
32
+ };
33
+ }
34
+ /* `namedChipLookup` for the machine in scope; outside a scope, every chip keeps its id. */
35
+ export function useNamedChipLookup(t0) {
36
+ const $ = _c(9);
37
+ const home = t0 === undefined ? null : t0;
38
+ const scope = useContext(ChatScopeContext);
39
+ const {
40
+ accents
41
+ } = useChatHost();
42
+ let t1;
43
+ if ($[0] !== scope) {
44
+ t1 = s => scope === null ? NO_PROVIDERS : s.byScope[scope.id]?.providers ?? NO_PROVIDERS;
45
+ $[0] = scope;
46
+ $[1] = t1;
47
+ } else {
48
+ t1 = $[1];
49
+ }
50
+ const providers = useProvidersStore(t1);
51
+ let t2;
52
+ if ($[2] !== scope) {
53
+ t2 = s_0 => scope === null ? null : s_0.byScope[scope.id]?.accounts ?? null;
54
+ $[2] = scope;
55
+ $[3] = t2;
56
+ } else {
57
+ t2 = $[3];
58
+ }
59
+ const accounts = useProviderAccountsStore(t2);
60
+ let t3;
61
+ if ($[4] !== accents.all || $[5] !== accounts || $[6] !== home || $[7] !== providers) {
62
+ t3 = namedChipLookup(providers, accounts, accents.all, home);
63
+ $[4] = accents.all;
64
+ $[5] = accounts;
65
+ $[6] = home;
66
+ $[7] = providers;
67
+ $[8] = t3;
68
+ } else {
69
+ t3 = $[8];
70
+ }
71
+ return t3;
72
+ }
@@ -3,8 +3,13 @@ function valueOf(segment) {
3
3
  if (segment.kind === 'mention') {
4
4
  return segment.path;
5
5
  }
6
+ if (segment.kind === 'model' || segment.kind === 'account') {
7
+ return `${segment.cli}/${segment.id}`;
8
+ }
6
9
  return segment.kind === 'skill' ? segment.name : segment.id;
7
10
  }
11
+ // What every named chip starts with, so a text without one skips the walk.
12
+ const NAMED_CHIP_HINT = /@(model|account):/;
8
13
  // Inline code overrules a chip: `@a.ts` between backticks is code, not a mention.
9
14
  const SKIPPED = new Set(['code', 'pre']);
10
15
  // A link already leads somewhere of its own.
@@ -24,6 +29,12 @@ function chipElement(segment) {
24
29
  }]
25
30
  };
26
31
  }
32
+ function textOf(node) {
33
+ if ('children' in node) {
34
+ return node.children.map(textOf).join('');
35
+ }
36
+ return node.type === 'text' ? node.value : '';
37
+ }
27
38
  function split(parent, tokenize, skipped) {
28
39
  parent.children = parent.children.flatMap(child => {
29
40
  if (child.type === 'text') {
@@ -38,14 +49,14 @@ function split(parent, tokenize, skipped) {
38
49
  return [child];
39
50
  });
40
51
  }
41
- /* The `@path`, `$name` and `#name` tokens a person picked in the composer, cut out of the text as chips. */
52
+ /* The `@path`, `$name` and `#name` tokens a person picked in the composer, and every model and account it spells, cut out of the text as chips. */
42
53
  export function rehypeChips({
43
54
  mentions = [],
44
55
  skills = [],
45
56
  references = []
46
57
  } = {}) {
47
58
  return tree => {
48
- if (mentions.length === 0 && skills.length === 0 && references.length === 0) {
59
+ if (mentions.length === 0 && skills.length === 0 && references.length === 0 && !NAMED_CHIP_HINT.test(textOf(tree))) {
49
60
  return;
50
61
  }
51
62
  split(tree, text => tokenizeChips(text, mentions, skills, references), SKIPPED);
@@ -1,7 +1,7 @@
1
1
  import type { ProviderPlatform } from '@adecore/agent-contracts';
2
2
  import type { AccountRule } from './agents/accounts.js';
3
3
  import { type Referables } from './chat/chat-references.js';
4
- import { type ChatHost, type CommandLook, type ComposerSendAction } from './host.js';
4
+ import { type ChatHost, type CommandLook, type ComposerSendAction, type ComposerStatusItem } from './host.js';
5
5
  export declare function useHostCodeMode(): 'light' | 'dark';
6
6
  export declare function useHostCodeThemes(): {
7
7
  light: string;
@@ -29,6 +29,7 @@ export declare function useHostWelcome(...args: Parameters<ChatHost['useWelcome'
29
29
  export declare function useHostResumeAtReset(...args: Parameters<ChatHost['useResumeAtReset']>): ReturnType<ChatHost['useResumeAtReset']>;
30
30
  export declare function useHostComposerPlaceholder(...args: Parameters<ChatHost['useComposerPlaceholder']>): ReturnType<ChatHost['useComposerPlaceholder']>;
31
31
  export declare function useHostComposerSendActions(scopeId: string, chatId: string): readonly ComposerSendAction[];
32
+ export declare function useHostComposerStatus(scopeId: string, chatId: string): readonly ComposerStatusItem[];
32
33
  export declare function useHostThreadCards(...args: Parameters<ChatHost['useThreadCards']>): ReturnType<ChatHost['useThreadCards']>;
33
34
  export declare function useHostReplyAuthor(...args: Parameters<ChatHost['useReplyAuthor']>): ReturnType<ChatHost['useReplyAuthor']>;
34
35
  export declare function useHostMapSource(maps: NonNullable<ChatHost['maps']>, scopeId: string): ReturnType<NonNullable<ChatHost['maps']>['useSource']>;
@@ -87,6 +87,12 @@ export function useHostComposerSendActions(scopeId, chatId) {
87
87
  const useSendActions = useChatHost().useComposerSendActions ?? noSendActions;
88
88
  return useSendActions(scopeId, chatId);
89
89
  }
90
+ const NO_STATUS = [];
91
+ const noStatus = () => NO_STATUS;
92
+ export function useHostComposerStatus(scopeId, chatId) {
93
+ const useStatus = useChatHost().useComposerStatus ?? noStatus;
94
+ return useStatus(scopeId, chatId);
95
+ }
90
96
  export function useHostThreadCards(...args) {
91
97
  return useChatHost().useThreadCards(...args);
92
98
  }
package/dist/host.d.ts CHANGED
@@ -139,6 +139,22 @@ export interface ComposerSendAction {
139
139
  disabled?: boolean;
140
140
  run(draft: ComposerSendDraft): void;
141
141
  }
142
+ export interface ComposerStatusDetail {
143
+ icon: LucideIcon;
144
+ label: string;
145
+ detail?: string;
146
+ hint?: string;
147
+ mono?: boolean;
148
+ muted?: boolean;
149
+ }
150
+ export interface ComposerStatusItem {
151
+ id: string;
152
+ icon: LucideIcon;
153
+ label: string;
154
+ tooltip?: string;
155
+ side?: 'start' | 'end';
156
+ details?: readonly ComposerStatusDetail[];
157
+ }
142
158
  export interface SubagentSlotProps {
143
159
  chatId: string;
144
160
  items: readonly ChatSubagentItem[];
@@ -392,6 +408,7 @@ export interface ChatHost {
392
408
  ComposerSlot: ComponentType<ComposerSlotProps> | null;
393
409
  ComposerHeaderSlot?: ComponentType<ComposerHeaderSlotProps> | null;
394
410
  useComposerSendActions?(scopeId: string, chatId: string): readonly ComposerSendAction[];
411
+ useComposerStatus?(scopeId: string, chatId: string): readonly ComposerStatusItem[];
395
412
  SubagentSlot: ComponentType<SubagentSlotProps> | null;
396
413
  useThreadCards(scopeId: string, chatId: string): readonly ThreadCard[];
397
414
  useReplyAuthor(scopeId: string, chatId: string): ReplyAuthor | null;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { type ChatActions, type FileRef, type ShellCodeBlockContext, type ChatPlace, type SubagentTask, type TimelineFindOptions, type TimelineFind, type ComposerDictationProps, type ComposerHeaderSlotProps, type ComposerSlotProps, type ReferenceIconProps, type ComposerSendAction, type ComposerSendDraft, type SubagentSlotProps, type ThreadCard, type VisualHost, type HostMenuAction, type ReplyAuthor, type ChatHost, type UiMapSource, type UiModelViewProps, type CommandLook, type CommandLookCall, type CommandLookSent, type CommandLookMatch, type CommandName, type ToolLook, type ToolLookCall, type ToolLookMatch, ChatHostProvider, useChatHost, type AccentChoice, type ChatToast, type TextareaProps, type ResourceUrl } from './host.js';
1
+ export { type ChatActions, type FileRef, type ShellCodeBlockContext, type ChatPlace, type SubagentTask, type TimelineFindOptions, type TimelineFind, type ComposerDictationProps, type ComposerHeaderSlotProps, type ComposerSlotProps, type ReferenceIconProps, type ComposerSendAction, type ComposerSendDraft, type ComposerStatusDetail, type ComposerStatusItem, type SubagentSlotProps, type ThreadCard, type VisualHost, type HostMenuAction, type ReplyAuthor, type ChatHost, type UiMapSource, type UiModelViewProps, type CommandLook, type CommandLookCall, type CommandLookSent, type CommandLookMatch, type CommandName, type ToolLook, type ToolLookCall, type ToolLookMatch, ChatHostProvider, useChatHost, type AccentChoice, type ChatToast, type TextareaProps, type ResourceUrl } from './host.js';
2
2
  export { type ChatScope, ChatScopeContext, useChatScope } from './scope.js';
3
3
  export { type ChatRequestMap, type ChatEventMap, type ChatTransportStatus, type ChatTransport, ChatTransportError, errorCode, isConnectionError } from './transport.js';
4
4
  export { portTransport, type PortTransport } from './port-transport.js';
@@ -386,6 +386,8 @@ declare const _default: {
386
386
  files: string;
387
387
  noMatch: string;
388
388
  empty: string;
389
+ models: string;
390
+ accounts: string;
389
391
  };
390
392
  references: {
391
393
  canvas: string;
@@ -420,7 +422,18 @@ declare const _default: {
420
422
  goToSource: string;
421
423
  };
422
424
  removeAttachment: string;
423
- attach: string;
425
+ plus: {
426
+ label: string;
427
+ attach: string;
428
+ stash: string;
429
+ mention: string;
430
+ reference: string;
431
+ skill: string;
432
+ commands: string;
433
+ };
434
+ status: {
435
+ label: string;
436
+ };
424
437
  tooLong: string;
425
438
  stop: string;
426
439
  queueButton: string;
@@ -480,7 +493,6 @@ declare const _default: {
480
493
  stopFailed: string;
481
494
  info: {
482
495
  label: string;
483
- tokens: string;
484
496
  };
485
497
  };
486
498
  modes: {
@@ -385,7 +385,9 @@ export default {
385
385
  here: 'Files in this folder',
386
386
  files: 'Files',
387
387
  noMatch: 'No files match',
388
- empty: 'No files here'
388
+ empty: 'No files here',
389
+ models: 'Models',
390
+ accounts: 'Accounts'
389
391
  },
390
392
  references: {
391
393
  canvas: 'On this canvas',
@@ -420,7 +422,18 @@ export default {
420
422
  goToSource: 'Go to reply'
421
423
  },
422
424
  removeAttachment: 'Remove {{name}}',
423
- attach: 'Attach files',
425
+ plus: {
426
+ label: 'Add to the message',
427
+ attach: 'Attach files…',
428
+ stash: 'Stash this prompt',
429
+ mention: 'Mention a file',
430
+ reference: 'Reference a view or node',
431
+ skill: 'Use a skill',
432
+ commands: 'Commands'
433
+ },
434
+ status: {
435
+ label: 'Where this chat works'
436
+ },
424
437
  tooLong: 'characters, too long to send',
425
438
  stop: 'Stop. Shift-click stops sub-agents too',
426
439
  queueButton: 'Queue',
@@ -479,8 +492,7 @@ export default {
479
492
  noAnswer: 'The machine did not answer',
480
493
  stopFailed: 'Could not stop sub-agent',
481
494
  info: {
482
- label: 'About this sub-agent',
483
- tokens: '{{tokens}} tokens'
495
+ label: 'About this sub-agent'
484
496
  }
485
497
  },
486
498
  modes: {
@@ -386,6 +386,8 @@ declare const _default: {
386
386
  files: string;
387
387
  noMatch: string;
388
388
  empty: string;
389
+ models: string;
390
+ accounts: string;
389
391
  };
390
392
  references: {
391
393
  canvas: string;
@@ -420,7 +422,18 @@ declare const _default: {
420
422
  goToSource: string;
421
423
  };
422
424
  removeAttachment: string;
423
- attach: string;
425
+ plus: {
426
+ label: string;
427
+ attach: string;
428
+ stash: string;
429
+ mention: string;
430
+ reference: string;
431
+ skill: string;
432
+ commands: string;
433
+ };
434
+ status: {
435
+ label: string;
436
+ };
424
437
  tooLong: string;
425
438
  stop: string;
426
439
  queueButton: string;
@@ -480,7 +493,6 @@ declare const _default: {
480
493
  stopFailed: string;
481
494
  info: {
482
495
  label: string;
483
- tokens: string;
484
496
  };
485
497
  };
486
498
  modes: {
@@ -385,7 +385,9 @@ export default {
385
385
  here: 'Bestanden in deze map',
386
386
  files: 'Bestanden',
387
387
  noMatch: 'Geen bestanden gevonden',
388
- empty: 'Hier staan geen bestanden'
388
+ empty: 'Hier staan geen bestanden',
389
+ models: 'Modellen',
390
+ accounts: 'Accounts'
389
391
  },
390
392
  references: {
391
393
  canvas: 'Op dit canvas',
@@ -420,7 +422,18 @@ export default {
420
422
  goToSource: 'Naar het antwoord'
421
423
  },
422
424
  removeAttachment: '{{name}} verwijderen',
423
- attach: 'Bestanden toevoegen',
425
+ plus: {
426
+ label: 'Toevoegen aan het bericht',
427
+ attach: 'Bestanden toevoegen…',
428
+ stash: 'Deze prompt stashen',
429
+ mention: 'Een bestand noemen',
430
+ reference: 'Naar een weergave of node verwijzen',
431
+ skill: 'Een skill gebruiken',
432
+ commands: "Commando's"
433
+ },
434
+ status: {
435
+ label: 'Waar deze chat werkt'
436
+ },
424
437
  tooLong: 'tekens, te lang om te versturen',
425
438
  stop: 'Stoppen. Shift-klik stopt ook de sub-agents',
426
439
  queueButton: 'In de wachtrij zetten',
@@ -479,8 +492,7 @@ export default {
479
492
  noAnswer: 'De machine antwoordde niet',
480
493
  stopFailed: 'Kon de sub-agent niet stoppen',
481
494
  info: {
482
- label: 'Over deze sub-agent',
483
- tokens: '{{tokens}} tokens'
495
+ label: 'Over deze sub-agent'
484
496
  }
485
497
  },
486
498
  modes: {
@@ -55,6 +55,7 @@ export declare const useChats: import("zustand").UseBoundStore<import("zustand")
55
55
  export declare function chatSink(keyOf: (chatId: string) => string): ChatSink;
56
56
  export declare function useChatRow<T>(chatId: string, select: (row: ChatState | undefined) => T): T;
57
57
  export declare function useReportedModels(provider: AgentKind): ReadonlySet<string>;
58
+ export declare function useReportedModelsByProvider(): (provider: AgentKind) => ReadonlySet<string>;
58
59
  export declare function useAwaitsApproval(chatId: string, toolUseId: string): boolean;
59
60
  export declare function useCurrentItem<T extends ChatItem>(chatId: string, derived: T): T;
60
61
  export {};
@@ -484,6 +484,51 @@ export function useReportedModels(provider) {
484
484
  }
485
485
  return t1;
486
486
  }
487
+ /* `useReportedModels` for every provider at once, as a lookup by provider. */
488
+ export function useReportedModelsByProvider() {
489
+ const $ = _c(6);
490
+ const scope = useContext(ChatScopeContext);
491
+ let t0;
492
+ if ($[0] !== scope) {
493
+ t0 = s => {
494
+ const names = new Set();
495
+ for (const [key, state] of Object.entries(s.statusByKey)) {
496
+ if (scope?.owns(key) === true && state.info.model !== null) {
497
+ names.add(`${state.info.provider}\t${state.info.model}`);
498
+ }
499
+ }
500
+ return [...names].sort().join("\n");
501
+ };
502
+ $[0] = scope;
503
+ $[1] = t0;
504
+ } else {
505
+ t0 = $[1];
506
+ }
507
+ const joined = useChats(t0);
508
+ let byProvider;
509
+ if ($[2] !== joined) {
510
+ byProvider = new Map();
511
+ for (const line of joined === "" ? [] : joined.split("\n")) {
512
+ const [t1, t2] = line.split("\t");
513
+ const provider = t1 === undefined ? "" : t1;
514
+ const model = t2 === undefined ? "" : t2;
515
+ byProvider.set(provider, (byProvider.get(provider) ?? new Set()).add(model));
516
+ }
517
+ $[2] = joined;
518
+ $[3] = byProvider;
519
+ } else {
520
+ byProvider = $[3];
521
+ }
522
+ let t1;
523
+ if ($[4] !== byProvider) {
524
+ t1 = provider_0 => byProvider.get(provider_0) ?? new Set();
525
+ $[4] = byProvider;
526
+ $[5] = t1;
527
+ } else {
528
+ t1 = $[5];
529
+ }
530
+ return t1;
531
+ }
487
532
  /* Whether a call still waits on the person's answer to an approval of it, when its clock is not running yet. */
488
533
  export function useAwaitsApproval(chatId, toolUseId) {
489
534
  const $ = _c(2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents-react",
3
- "version": "0.54.15",
3
+ "version": "0.55.0",
4
4
  "description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -72,12 +72,12 @@
72
72
  "test:visuals": "bun --config=integration.bunfig.toml --conditions=source test ./src/chat/visual-viewport.integration.test.ts"
73
73
  },
74
74
  "dependencies": {
75
- "@adecore/agent-contracts": "0.54.15",
76
- "@adecore/editor": "0.54.15",
77
- "@adecore/editor-react": "0.54.15",
78
- "@adecore/intelligent-ui": "0.54.15",
79
- "@adecore/merge": "0.54.15",
80
- "@adecore/utils": "0.54.15",
75
+ "@adecore/agent-contracts": "0.55.0",
76
+ "@adecore/editor": "0.55.0",
77
+ "@adecore/editor-react": "0.55.0",
78
+ "@adecore/intelligent-ui": "0.55.0",
79
+ "@adecore/merge": "0.55.0",
80
+ "@adecore/utils": "0.55.0",
81
81
  "@codemirror/commands": "^6.11.1",
82
82
  "@codemirror/language": "^6.13.1",
83
83
  "@codemirror/state": "^6.7.6",
@@ -101,14 +101,14 @@
101
101
  "zustand": "^5.0.16"
102
102
  },
103
103
  "peerDependencies": {
104
- "@adecore/ui": "^0.54.15",
104
+ "@adecore/ui": "^0.55.0",
105
105
  "i18next": "^26.4.2",
106
106
  "react": "^19.3.0",
107
107
  "react-dom": "^19.3.0",
108
108
  "react-i18next": "^17.0.15"
109
109
  },
110
110
  "devDependencies": {
111
- "@adecore/ui": "0.54.15",
111
+ "@adecore/ui": "0.55.0",
112
112
  "@types/bun": "^1.4.4",
113
113
  "@types/react": "^19.3.0",
114
114
  "@types/react-dom": "^19.3.0",
@@ -18,6 +18,15 @@ interface AgentModelLabelProps {
18
18
  className?: string;
19
19
  }
20
20
 
21
+ /* A CLI's mark: the provider's own logo where there is one, its icon otherwise. */
22
+ export function CliMark({ kind, size = 14, className }: { kind: AgentKind; size?: number; className?: string }) {
23
+ return hasProviderLogo(kind) ? (
24
+ <ProviderLogo provider={kind} size={size} className={className} />
25
+ ) : (
26
+ <AgentIcon kind={kind} size={size} className={clsx('shrink-0', className)} />
27
+ );
28
+ }
29
+
21
30
  /*
22
31
  * Who answered or will answer, in one line: the CLI's mark and the model, named the way the machine's
23
32
  * catalog names it, as a row of facts writes it ("made by", "runs as").
@@ -31,7 +40,7 @@ export function AgentModelLabel({ provider, model, scopeId, size = 14, className
31
40
 
32
41
  return (
33
42
  <span className={clsx('flex min-w-0 items-center gap-1.5', className)}>
34
- {hasProviderLogo(provider) ? <ProviderLogo provider={provider} size={size} /> : <AgentIcon kind={provider} size={size} className="shrink-0" />}
43
+ <CliMark kind={provider} size={size} />
35
44
  <span className="truncate">{name}</span>
36
45
  </span>
37
46
  );
@@ -26,6 +26,14 @@ export interface AccountChoice {
26
26
  nameOf(entry: AccountEntry): string;
27
27
  }
28
28
 
29
+ /* The color a person gave the account the chat runs under, also when it is the CLI's only one. */
30
+ export function useAccountColorId(kind: AgentKind, account: string | undefined): string | undefined {
31
+ const accounts = useProviderAccounts((row) => row.accounts);
32
+ const currentId = account ?? kind;
33
+
34
+ return accounts?.accounts[currentId]?.color;
35
+ }
36
+
29
37
  /*
30
38
  * The accounts of a chat's CLI on the machine in scope and the one the chat runs under, or null while
31
39
  * the CLI has fewer than two accounts that are on: with one there is nothing to choose or tell apart.