@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.
- package/dist/agents/AgentModelLabel.d.ts +5 -0
- package/dist/agents/AgentModelLabel.js +32 -7
- package/dist/chat/account-choice.d.ts +1 -0
- package/dist/chat/account-choice.js +13 -4
- package/dist/chat/mentions.d.ts +24 -2
- package/dist/chat/mentions.js +84 -10
- package/dist/chat/subagent-list.d.ts +0 -1
- package/dist/chat/subagent-list.js +1 -9
- package/dist/chat/tag-suggestions.d.ts +22 -0
- package/dist/chat/tag-suggestions.js +71 -0
- package/dist/chat/ui/Composer.js +489 -447
- package/dist/chat/ui/ComposerInput.d.ts +1 -0
- package/dist/chat/ui/ComposerInput.js +9 -1
- package/dist/chat/ui/Markdown.js +41 -25
- package/dist/chat/ui/NamedChip.d.ts +5 -0
- package/dist/chat/ui/NamedChip.js +118 -0
- package/dist/chat/ui/Pickers.d.ts +0 -4
- package/dist/chat/ui/Pickers.js +1 -141
- package/dist/chat/ui/PromptEditor.js +2 -1
- package/dist/chat/ui/ReferenceChip.d.ts +3 -2
- package/dist/chat/ui/ReferenceChip.js +58 -36
- package/dist/chat/ui/RunSettings.d.ts +3 -2
- package/dist/chat/ui/RunSettings.js +386 -361
- package/dist/chat/ui/SubagentInfo.js +98 -114
- package/dist/chat/ui/SubagentTimeline.js +65 -43
- package/dist/chat/ui/Timeline.js +14 -8
- package/dist/chat/ui/chip-clipboard.js +10 -0
- package/dist/chat/ui/composer/ComposerControls.d.ts +6 -1
- package/dist/chat/ui/composer/ComposerControls.js +171 -158
- package/dist/chat/ui/composer/ComposerMenu.js +187 -55
- package/dist/chat/ui/composer/ComposerPlusMenu.d.ts +18 -0
- package/dist/chat/ui/composer/ComposerPlusMenu.js +400 -0
- package/dist/chat/ui/composer/ComposerStatusLine.d.ts +4 -0
- package/dist/chat/ui/composer/ComposerStatusLine.js +239 -0
- package/dist/chat/ui/composer/chips.d.ts +2 -0
- package/dist/chat/ui/composer/chips.js +66 -5
- package/dist/chat/ui/composer/insert.d.ts +1 -0
- package/dist/chat/ui/composer/insert.js +24 -0
- package/dist/chat/ui/composer/use-composer-menus.js +34 -17
- package/dist/chat/ui/composer/use-prompt-menus.d.ts +10 -2
- package/dist/chat/ui/composer/use-prompt-menus.js +290 -202
- package/dist/chat/ui/covered-bottom.d.ts +1 -0
- package/dist/chat/ui/covered-bottom.js +6 -0
- package/dist/chat/ui/named-chip-look.d.ts +14 -0
- package/dist/chat/ui/named-chip-look.js +72 -0
- package/dist/chat/ui/rehype-chips.js +13 -2
- package/dist/host-hooks.d.ts +2 -1
- package/dist/host-hooks.js +6 -0
- package/dist/host.d.ts +17 -0
- package/dist/index.d.ts +1 -1
- package/dist/locales/en/agent-chat.d.ts +14 -2
- package/dist/locales/en/agent-chat.js +16 -4
- package/dist/locales/nl/agent-chat.d.ts +14 -2
- package/dist/locales/nl/agent-chat.js +16 -4
- package/dist/state/chats.d.ts +1 -0
- package/dist/state/chats.js +45 -0
- package/package.json +9 -9
- package/src/agents/AgentModelLabel.tsx +10 -1
- package/src/chat/account-choice.ts +8 -0
- package/src/chat/mentions.ts +110 -13
- package/src/chat/subagent-list.ts +1 -14
- package/src/chat/tag-suggestions.ts +121 -0
- package/src/chat/ui/Composer.tsx +24 -12
- package/src/chat/ui/ComposerInput.tsx +13 -1
- package/src/chat/ui/Markdown.tsx +5 -0
- package/src/chat/ui/NamedChip.tsx +34 -0
- package/src/chat/ui/Pickers.tsx +1 -51
- package/src/chat/ui/PromptEditor.tsx +7 -1
- package/src/chat/ui/ReferenceChip.tsx +15 -4
- package/src/chat/ui/RunSettings.tsx +51 -29
- package/src/chat/ui/SubagentInfo.tsx +17 -17
- package/src/chat/ui/SubagentTimeline.tsx +7 -2
- package/src/chat/ui/Timeline.tsx +11 -5
- package/src/chat/ui/chip-clipboard.ts +8 -1
- package/src/chat/ui/composer/ComposerControls.tsx +24 -17
- package/src/chat/ui/composer/ComposerMenu.tsx +83 -15
- package/src/chat/ui/composer/ComposerPlusMenu.tsx +158 -0
- package/src/chat/ui/composer/ComposerStatusLine.tsx +94 -0
- package/src/chat/ui/composer/chips.ts +78 -7
- package/src/chat/ui/composer/insert.ts +12 -0
- package/src/chat/ui/composer/use-composer-menus.ts +5 -2
- package/src/chat/ui/composer/use-prompt-menus.ts +55 -10
- package/src/chat/ui/covered-bottom.ts +7 -0
- package/src/chat/ui/named-chip-look.ts +64 -0
- package/src/chat/ui/rehype-chips.ts +17 -2
- package/src/host-hooks.ts +11 -1
- package/src/host.ts +29 -0
- package/src/index.ts +2 -0
- package/src/locales/en/agent-chat.ts +16 -4
- package/src/locales/nl/agent-chat.ts +16 -4
- package/src/state/chats.ts +26 -0
|
@@ -36,9 +36,16 @@ function valueOf(segment: Exclude<ChipSegment, { kind: 'text' }>): string {
|
|
|
36
36
|
return segment.path;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
if (segment.kind === 'model' || segment.kind === 'account') {
|
|
40
|
+
return `${segment.cli}/${segment.id}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
return segment.kind === 'skill' ? segment.name : segment.id;
|
|
40
44
|
}
|
|
41
45
|
|
|
46
|
+
// What every named chip starts with, so a text without one skips the walk.
|
|
47
|
+
const NAMED_CHIP_HINT = /@(model|account):/;
|
|
48
|
+
|
|
42
49
|
// Inline code overrules a chip: `@a.ts` between backticks is code, not a mention.
|
|
43
50
|
const SKIPPED = new Set(['code', 'pre']);
|
|
44
51
|
|
|
@@ -55,6 +62,14 @@ function chipElement(segment: Exclude<ChipSegment, { kind: 'text' }>): HastEleme
|
|
|
55
62
|
};
|
|
56
63
|
}
|
|
57
64
|
|
|
65
|
+
function textOf(node: HastParent | HastNode): string {
|
|
66
|
+
if ('children' in node) {
|
|
67
|
+
return node.children.map(textOf).join('');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return node.type === 'text' ? node.value : '';
|
|
71
|
+
}
|
|
72
|
+
|
|
58
73
|
function split(parent: HastParent, tokenize: (text: string) => ChipSegment[], skipped: ReadonlySet<string>): void {
|
|
59
74
|
parent.children = parent.children.flatMap((child): HastNode[] => {
|
|
60
75
|
if (child.type === 'text') {
|
|
@@ -69,10 +84,10 @@ function split(parent: HastParent, tokenize: (text: string) => ChipSegment[], sk
|
|
|
69
84
|
});
|
|
70
85
|
}
|
|
71
86
|
|
|
72
|
-
/* The `@path`, `$name` and `#name` tokens a person picked in the composer, cut out of the text as chips. */
|
|
87
|
+
/* 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. */
|
|
73
88
|
export function rehypeChips({ mentions = [], skills = [], references = [] }: ChipOptions = {}) {
|
|
74
89
|
return (tree: HastParent) => {
|
|
75
|
-
if (mentions.length === 0 && skills.length === 0 && references.length === 0) {
|
|
90
|
+
if (mentions.length === 0 && skills.length === 0 && references.length === 0 && !NAMED_CHIP_HINT.test(textOf(tree))) {
|
|
76
91
|
return;
|
|
77
92
|
}
|
|
78
93
|
|
package/src/host-hooks.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import type { ProviderPlatform } from '@adecore/agent-contracts';
|
|
7
7
|
import type { AccountRule } from './agents/accounts';
|
|
8
8
|
import { referablesOfChats, type Referables } from './chat/chat-references';
|
|
9
|
-
import { useChatHost, type ChatHost, type CommandLook, type ComposerSendAction } from './host';
|
|
9
|
+
import { useChatHost, type ChatHost, type CommandLook, type ComposerSendAction, type ComposerStatusItem } from './host';
|
|
10
10
|
|
|
11
11
|
export function useHostCodeMode(): 'light' | 'dark' {
|
|
12
12
|
return useChatHost().code.useMode();
|
|
@@ -126,6 +126,16 @@ export function useHostComposerSendActions(scopeId: string, chatId: string): rea
|
|
|
126
126
|
return useSendActions(scopeId, chatId);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
const NO_STATUS: readonly ComposerStatusItem[] = [];
|
|
130
|
+
|
|
131
|
+
const noStatus = (): readonly ComposerStatusItem[] => NO_STATUS;
|
|
132
|
+
|
|
133
|
+
export function useHostComposerStatus(scopeId: string, chatId: string): readonly ComposerStatusItem[] {
|
|
134
|
+
const useStatus = useChatHost().useComposerStatus ?? noStatus;
|
|
135
|
+
|
|
136
|
+
return useStatus(scopeId, chatId);
|
|
137
|
+
}
|
|
138
|
+
|
|
129
139
|
export function useHostThreadCards(...args: Parameters<ChatHost['useThreadCards']>): ReturnType<ChatHost['useThreadCards']> {
|
|
130
140
|
return useChatHost().useThreadCards(...args);
|
|
131
141
|
}
|
package/src/host.ts
CHANGED
|
@@ -222,6 +222,33 @@ export interface ComposerSendAction {
|
|
|
222
222
|
run(draft: ComposerSendDraft): void;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
/* A row in the popover a status item opens. */
|
|
226
|
+
export interface ComposerStatusDetail {
|
|
227
|
+
icon: LucideIcon;
|
|
228
|
+
label: string;
|
|
229
|
+
/* A second line under the label, such as a path. */
|
|
230
|
+
detail?: string;
|
|
231
|
+
/* A word at the end of the row, such as what the label is. */
|
|
232
|
+
hint?: string;
|
|
233
|
+
/* Sets the label in the code font, for a name such as a branch. */
|
|
234
|
+
mono?: boolean;
|
|
235
|
+
/* Draws the row faint, for one that is listed but asks for no attention. */
|
|
236
|
+
muted?: boolean;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* One item in the line under the composer's card, such as the branch a chat works on. */
|
|
240
|
+
export interface ComposerStatusItem {
|
|
241
|
+
/* Unique among the items of one composer. */
|
|
242
|
+
id: string;
|
|
243
|
+
icon: LucideIcon;
|
|
244
|
+
label: string;
|
|
245
|
+
tooltip?: string;
|
|
246
|
+
/* Where on the line it stands; left out, at the start. */
|
|
247
|
+
side?: 'start' | 'end';
|
|
248
|
+
/* Rows a click on the item opens; left out, the item is no button. */
|
|
249
|
+
details?: readonly ComposerStatusDetail[];
|
|
250
|
+
}
|
|
251
|
+
|
|
225
252
|
/* What an app's own chips for a chat's sub-agents get, in place of the one flyout over the composer. */
|
|
226
253
|
export interface SubagentSlotProps {
|
|
227
254
|
chatId: string;
|
|
@@ -622,6 +649,8 @@ export interface ChatHost {
|
|
|
622
649
|
ComposerHeaderSlot?: ComponentType<ComposerHeaderSlotProps> | null;
|
|
623
650
|
/* Actions of the app's own behind a chevron on the send button, in the order given; left out, or none, Send stands alone. */
|
|
624
651
|
useComposerSendActions?(scopeId: string, chatId: string): readonly ComposerSendAction[];
|
|
652
|
+
/* Items of the app's own on a line under the composer's card, such as where the chat works; left out, or none, draws no line. */
|
|
653
|
+
useComposerStatus?(scopeId: string, chatId: string): readonly ComposerStatusItem[];
|
|
625
654
|
/* The app's own chips for a chat's sub-agents over the composer; null draws the one flyout. */
|
|
626
655
|
SubagentSlot: ComponentType<SubagentSlotProps> | null;
|
|
627
656
|
/* Cards of the app's own in a thread, in any order. Hand back the same array while none changed, or the thread lays out its rows again on every render. */
|
package/src/index.ts
CHANGED
|
@@ -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
|
-
|
|
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: {
|
|
@@ -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
|
-
|
|
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: {
|
package/src/state/chats.ts
CHANGED
|
@@ -471,6 +471,32 @@ export function useReportedModels(provider: AgentKind): ReadonlySet<string> {
|
|
|
471
471
|
return new Set(joined === '' ? [] : joined.split('\n'));
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
+
/* `useReportedModels` for every provider at once, as a lookup by provider. */
|
|
475
|
+
export function useReportedModelsByProvider(): (provider: AgentKind) => ReadonlySet<string> {
|
|
476
|
+
const scope = useContext(ChatScopeContext);
|
|
477
|
+
|
|
478
|
+
const joined = useChats((s) => {
|
|
479
|
+
const names = new Set<string>();
|
|
480
|
+
|
|
481
|
+
for (const [key, state] of Object.entries(s.statusByKey)) {
|
|
482
|
+
if (scope?.owns(key) === true && state.info.model !== null) {
|
|
483
|
+
names.add(`${state.info.provider}\t${state.info.model}`);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
return [...names].sort().join('\n');
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
const byProvider = new Map<string, Set<string>>();
|
|
491
|
+
|
|
492
|
+
for (const line of joined === '' ? [] : joined.split('\n')) {
|
|
493
|
+
const [provider = '', model = ''] = line.split('\t');
|
|
494
|
+
byProvider.set(provider, (byProvider.get(provider) ?? new Set()).add(model));
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return (provider) => byProvider.get(provider) ?? new Set();
|
|
498
|
+
}
|
|
499
|
+
|
|
474
500
|
/* Whether a call still waits on the person's answer to an approval of it, when its clock is not running yet. */
|
|
475
501
|
export function useAwaitsApproval(chatId: string, toolUseId: string): boolean {
|
|
476
502
|
return useChatRow(chatId, (row) => waitingRequestsOf(row).some((request) => request.kind === 'approval' && request.toolUseId === toolUseId));
|