@adecore/agents-react 0.38.0 → 0.39.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 +10 -0
- package/dist/agents/AgentModelLabel.js +97 -0
- package/dist/chat/ui/Composer.js +385 -360
- package/dist/chat/ui/Pickers.d.ts +2 -1
- package/dist/chat/ui/Pickers.js +126 -123
- package/dist/chat/ui/PromptEditor.d.ts +19 -0
- package/dist/chat/ui/PromptEditor.js +115 -0
- package/dist/chat/ui/Timeline.d.ts +2 -1
- package/dist/chat/ui/Timeline.js +13 -1
- package/dist/chat/ui/composer/ComposerControls.d.ts +3 -0
- package/dist/chat/ui/composer/ComposerControls.js +235 -38
- package/dist/chat/ui/composer/key-handler.d.ts +1 -1
- package/dist/chat/ui/composer/key-handler.js +3 -11
- package/dist/chat/ui/composer/prompt-picks.d.ts +4 -0
- package/dist/chat/ui/composer/prompt-picks.js +14 -0
- package/dist/chat/ui/composer/use-composer-menus.d.ts +4 -49
- package/dist/chat/ui/composer/use-composer-menus.js +65 -519
- package/dist/chat/ui/composer/use-prompt-menus.d.ts +73 -0
- package/dist/chat/ui/composer/use-prompt-menus.js +536 -0
- package/dist/chat/ui/index.d.ts +3 -0
- package/dist/chat/ui/index.js +2 -0
- package/dist/host-hooks.d.ts +2 -1
- package/dist/host-hooks.js +6 -0
- package/dist/host.d.ts +17 -1
- package/dist/index.d.ts +1 -1
- package/dist/locales/en/agent-chat.d.ts +1 -0
- package/dist/locales/en/agent-chat.js +1 -0
- package/dist/locales/nl/agent-chat.d.ts +1 -0
- package/dist/locales/nl/agent-chat.js +1 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.js +1 -0
- package/dist/theme.css +3 -0
- package/package.json +8 -8
- package/src/agents/AgentModelLabel.tsx +40 -0
- package/src/chat/ui/Composer.tsx +12 -3
- package/src/chat/ui/Pickers.tsx +4 -1
- package/src/chat/ui/PromptEditor.tsx +130 -0
- package/src/chat/ui/Timeline.tsx +22 -1
- package/src/chat/ui/composer/ComposerControls.tsx +65 -15
- package/src/chat/ui/composer/key-handler.ts +3 -9
- package/src/chat/ui/composer/prompt-picks.ts +17 -0
- package/src/chat/ui/composer/use-composer-menus.ts +18 -275
- package/src/chat/ui/composer/use-prompt-menus.ts +341 -0
- package/src/chat/ui/index.ts +3 -0
- package/src/host-hooks.ts +9 -1
- package/src/host.ts +27 -1
- package/src/index.ts +2 -0
- package/src/locales/en/agent-chat.ts +1 -0
- package/src/locales/nl/agent-chat.ts +1 -0
- package/src/providers/index.ts +1 -0
- package/src/theme.css +3 -0
package/src/host-hooks.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { ProviderPlatform } from '@adecore/agent-contracts';
|
|
9
9
|
import { referablesOfChats, type Referables } from './chat/chat-references';
|
|
10
|
-
import { useChatHost, type ChatHost, type CommandLook } from './host';
|
|
10
|
+
import { useChatHost, type ChatHost, type CommandLook, type ComposerSendAction } from './host';
|
|
11
11
|
|
|
12
12
|
export function useHostCodeMode(): 'light' | 'dark' {
|
|
13
13
|
return useChatHost().code.useMode();
|
|
@@ -101,6 +101,14 @@ export function useHostComposerPlaceholder(...args: Parameters<ChatHost['useComp
|
|
|
101
101
|
return useChatHost().useComposerPlaceholder(...args);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
const NO_SEND_ACTIONS: readonly ComposerSendAction[] = [];
|
|
105
|
+
const noSendActions = (): readonly ComposerSendAction[] => NO_SEND_ACTIONS;
|
|
106
|
+
|
|
107
|
+
export function useHostComposerSendActions(scopeId: string, chatId: string): readonly ComposerSendAction[] {
|
|
108
|
+
const useSendActions = useChatHost().useComposerSendActions ?? noSendActions;
|
|
109
|
+
return useSendActions(scopeId, chatId);
|
|
110
|
+
}
|
|
111
|
+
|
|
104
112
|
export function useHostThreadCards(...args: Parameters<ChatHost['useThreadCards']>): ReturnType<ChatHost['useThreadCards']> {
|
|
105
113
|
return useChatHost().useThreadCards(...args);
|
|
106
114
|
}
|
package/src/host.ts
CHANGED
|
@@ -18,7 +18,9 @@ import type {
|
|
|
18
18
|
ChatUiLinkPayload,
|
|
19
19
|
ChatUiLinkReading,
|
|
20
20
|
ChatVisual,
|
|
21
|
-
|
|
21
|
+
ModelSelection,
|
|
22
|
+
ProviderPlatform,
|
|
23
|
+
RuntimeMode
|
|
22
24
|
} from '@adecore/agent-contracts';
|
|
23
25
|
import { isApplePlatform } from '@adecore/ui';
|
|
24
26
|
import type { Referables } from './chat/chat-references';
|
|
@@ -168,6 +170,28 @@ export interface ComposerSlotProps {
|
|
|
168
170
|
insert(text: string): void;
|
|
169
171
|
}
|
|
170
172
|
|
|
173
|
+
/* What a send action of the app's gets: the message as it stands when a person picks the action. */
|
|
174
|
+
export interface ComposerSendDraft {
|
|
175
|
+
scopeId: string;
|
|
176
|
+
chatId: string;
|
|
177
|
+
/* The draft as Send would send it, trimmed and with its quote; empty when nothing is written. */
|
|
178
|
+
text: string;
|
|
179
|
+
provider: AgentKind;
|
|
180
|
+
selection: ModelSelection;
|
|
181
|
+
runtimeMode: RuntimeMode;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* An action of the app's own in the menu beside the composer's send button, such as sending the draft later. */
|
|
185
|
+
export interface ComposerSendAction {
|
|
186
|
+
/* Unique among the actions of one composer. */
|
|
187
|
+
id: string;
|
|
188
|
+
label: string;
|
|
189
|
+
icon?: LucideIcon;
|
|
190
|
+
disabled?: boolean;
|
|
191
|
+
/* Runs once a person picks it; the draft stays in the box, and the host shows a failure itself. */
|
|
192
|
+
run(draft: ComposerSendDraft): void;
|
|
193
|
+
}
|
|
194
|
+
|
|
171
195
|
/* What an app's own chips for a chat's sub-agents get, in place of the one flyout over the composer. */
|
|
172
196
|
export interface SubagentSlotProps {
|
|
173
197
|
chatId: string;
|
|
@@ -453,6 +477,8 @@ export interface ChatHost {
|
|
|
453
477
|
useComposerPlaceholder(scopeId: string, chatId: string): string | null;
|
|
454
478
|
/* The app's own control in the composer's row, after the pickers; null draws none. */
|
|
455
479
|
ComposerSlot: ComponentType<ComposerSlotProps> | null;
|
|
480
|
+
/* Actions of the app's own behind a chevron on the send button, in the order given; left out, or none, Send stands alone. */
|
|
481
|
+
useComposerSendActions?(scopeId: string, chatId: string): readonly ComposerSendAction[];
|
|
456
482
|
/* The app's own chips for a chat's sub-agents over the composer; null draws the one flyout. */
|
|
457
483
|
SubagentSlot: ComponentType<SubagentSlotProps> | null;
|
|
458
484
|
/* 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
package/src/providers/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Public API: exports.test.ts snapshots this list, so a name added or dropped here is an API change.
|
|
2
2
|
export { AccountDot } from '../agents/AccountDot';
|
|
3
3
|
export { AgentIcon } from '../agents/AgentIcon';
|
|
4
|
+
export { AgentModelLabel } from '../agents/AgentModelLabel';
|
|
4
5
|
export { ModelOptionControl } from '../agents/ModelOptionControl';
|
|
5
6
|
export { ProviderLogo } from '../agents/ProviderLogo';
|
|
6
7
|
export { type AccountEntry, accountsOfKind, ACCOUNT_TONE_CLASSES, accountStatusLine, canContinueOn, type AccountTone } from '../agents/accounts';
|
package/src/theme.css
CHANGED
|
@@ -288,6 +288,9 @@
|
|
|
288
288
|
.composer-input .cm-editor .cm-scroller .cm-content { padding: 18px 14px 6px 20px; caret-color: var(--text); }
|
|
289
289
|
.composer-input .cm-scroller .cm-content .cm-line { padding: 0; }
|
|
290
290
|
.composer-input .cm-scroller .cm-content .cm-placeholder { color: var(--text-faint); }
|
|
291
|
+
/* The same editor as a form field (`PromptEditor`): the field's inset, and room for a few lines before it scrolls. */
|
|
292
|
+
.composer-input.prompt-editor .cm-editor { max-height: 240px; }
|
|
293
|
+
.composer-input.prompt-editor .cm-editor .cm-scroller .cm-content { min-height: 80px; padding: 6px 10px; }
|
|
291
294
|
.composer-hints, .composer-hints-extra { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
|
|
292
295
|
/* The joiner starts with its own comma, so it sits against the lead without the gap. */
|
|
293
296
|
.composer-hints-extra { margin-left: -8px; }
|