@adecore/agents-react 0.69.1 → 0.70.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/provider-paths.js +3 -1
- package/dist/chat/activity.d.ts +2 -0
- package/dist/chat/activity.js +18 -4
- package/dist/chat/logic/timeline.js +3 -0
- package/dist/chat/logic/tools.d.ts +1 -0
- package/dist/chat/logic/tools.js +4 -0
- package/dist/chat/ui/ChatActivity.js +20 -17
- package/dist/chat/ui/rows/MessageRows.d.ts +2 -1
- package/dist/chat/ui/rows/MessageRows.js +61 -48
- package/dist/chat/ui/rows/Rows.js +163 -160
- package/dist/chat/ui/rows/WorkRows.js +125 -112
- package/dist/chat/ui/rows/WorkflowRow.js +2 -2
- package/dist/chat/waiting-on.js +3 -3
- package/dist/locales/en/agent-chat.d.ts +4 -0
- package/dist/locales/en/agent-chat.js +4 -0
- package/dist/locales/nl/agent-chat.d.ts +4 -0
- package/dist/locales/nl/agent-chat.js +4 -0
- package/dist/theme.css +3 -0
- package/dist/usage/format.js +4 -2
- package/package.json +9 -9
- package/src/agents/provider-paths.ts +4 -1
- package/src/chat/activity.ts +21 -5
- package/src/chat/logic/timeline.ts +4 -0
- package/src/chat/logic/tools.ts +5 -0
- package/src/chat/ui/ChatActivity.tsx +14 -8
- package/src/chat/ui/rows/MessageRows.tsx +3 -2
- package/src/chat/ui/rows/Rows.tsx +1 -1
- package/src/chat/ui/rows/WorkRows.tsx +5 -4
- package/src/chat/ui/rows/WorkflowRow.tsx +2 -2
- package/src/chat/waiting-on.ts +3 -6
- package/src/locales/en/agent-chat.ts +4 -0
- package/src/locales/nl/agent-chat.ts +4 -0
- package/src/theme.css +3 -0
- package/src/usage/format.ts +4 -2
package/src/chat/activity.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import { scheduledWakeupAt } from '@adecore/agent-contracts';
|
|
2
|
+
import { formatElapsedShort, formatMoment } from '@adecore/ui/format';
|
|
1
3
|
import i18next from 'i18next';
|
|
2
4
|
import type { ChatThreadInfo } from '../chat-sink';
|
|
3
5
|
|
|
4
6
|
/* A command or monitor as a client holds it; a newer host may run a kind this version does not know. */
|
|
5
7
|
export type ChatThreadBackgroundTask = NonNullable<ChatThreadInfo['background']>[number];
|
|
6
8
|
|
|
7
|
-
/* What a person reads for a task: what it does, else the command, else its kind. */
|
|
9
|
+
/* What a person reads for a task: what it does, else the command, else its kind. A wakeup reads as one in their words. */
|
|
8
10
|
export function backgroundTaskName(task: ChatThreadBackgroundTask): string {
|
|
11
|
+
if (scheduledWakeupAt(task) !== null) {
|
|
12
|
+
return i18next.t('agent-chat:activity.wakeup');
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
if (task.description || task.command) {
|
|
10
16
|
return task.description || task.command || '';
|
|
11
17
|
}
|
|
@@ -13,9 +19,19 @@ export function backgroundTaskName(task: ChatThreadBackgroundTask): string {
|
|
|
13
19
|
return task.kind === 'shell' || task.kind === 'monitor' ? i18next.t(`agent-chat:activity.${task.kind}`) : i18next.t('agent-chat:activity.other');
|
|
14
20
|
}
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
22
|
+
/* How long a task has run, or for a wakeup when it fires. */
|
|
23
|
+
export function backgroundTaskTime(task: ChatThreadBackgroundTask, now: number): string {
|
|
24
|
+
const wakesAt = scheduledWakeupAt(task);
|
|
25
|
+
|
|
26
|
+
return wakesAt === null
|
|
27
|
+
? formatElapsedShort(Math.max(0, now - task.startedAt))
|
|
28
|
+
: i18next.t('agent-chat:activity.wakesAt', { time: formatMoment(wakesAt, now) });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function backgroundCounts(tasks: readonly ChatThreadBackgroundTask[]): { shells: number; monitors: number; wakeups: number; others: number } {
|
|
32
|
+
const wakeups = tasks.filter((task) => scheduledWakeupAt(task) !== null).length;
|
|
33
|
+
const shells = tasks.filter((task) => task.kind === 'shell' && scheduledWakeupAt(task) === null).length;
|
|
34
|
+
const monitors = tasks.filter((task) => task.kind === 'monitor' && scheduledWakeupAt(task) === null).length;
|
|
19
35
|
|
|
20
|
-
return { shells, monitors, others: tasks.length - shells - monitors };
|
|
36
|
+
return { shells, monitors, wakeups, others: tasks.length - shells - monitors - wakeups };
|
|
21
37
|
}
|
|
@@ -207,6 +207,10 @@ export function agentTurnLabel(turn: ChatThreadTurn): string {
|
|
|
207
207
|
return about(i18next.t('agent-chat:turn.wokenByMessage', { count: turn.messageFrom.length }));
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
if (turn.wakeup === true) {
|
|
211
|
+
return i18next.t('agent-chat:activity.wakeup');
|
|
212
|
+
}
|
|
213
|
+
|
|
210
214
|
if (!turn.label) {
|
|
211
215
|
return i18next.t('agent-chat:turn.continued');
|
|
212
216
|
}
|
package/src/chat/logic/tools.ts
CHANGED
|
@@ -119,6 +119,11 @@ export function exitCodeOf(output: string): { code: number | null; rest: string
|
|
|
119
119
|
return { code: Number(match[1]), rest: output.slice(match[0].length) };
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
/* A call a person stopped ended in error without failing, so it reads as neutral. */
|
|
123
|
+
export function toolFailed(tool: ChatToolItem): boolean {
|
|
124
|
+
return tool.state === 'error' && tool.stopped !== true;
|
|
125
|
+
}
|
|
126
|
+
|
|
122
127
|
export function hasOutput(output: string | null): output is string {
|
|
123
128
|
return output !== null && output.trim() !== '';
|
|
124
129
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { taskIdOfRow, type ChatSubagentItem } from '@adecore/agent-contracts';
|
|
1
|
+
import { scheduledWakeupAt, taskIdOfRow, type ChatSubagentItem } from '@adecore/agent-contracts';
|
|
2
2
|
import { Icon, IconButton, Popover, ScrollArea, Surface, useNow } from '@adecore/ui';
|
|
3
|
-
import { formatElapsedShort } from '@adecore/ui/format';
|
|
4
3
|
import clsx from 'clsx';
|
|
5
|
-
import { Activity, MessageCircleQuestionMark, Square, SquareTerminal, TriangleAlert } from 'lucide-react';
|
|
4
|
+
import { Activity, Clock, MessageCircleQuestionMark, Square, SquareTerminal, TriangleAlert } from 'lucide-react';
|
|
6
5
|
import { useState, type ReactNode } from 'react';
|
|
7
6
|
import { useTranslation } from 'react-i18next';
|
|
8
7
|
import { useShallow } from 'zustand/shallow';
|
|
@@ -12,7 +11,7 @@ import { useHostTask, useHostTasks } from '../../host/host-hooks';
|
|
|
12
11
|
import { useChatScope } from '../../scope';
|
|
13
12
|
import { useChatRow, useChats } from '../../state/chats';
|
|
14
13
|
import { useChatActions } from '../actions';
|
|
15
|
-
import { backgroundCounts, backgroundTaskName, type ChatThreadBackgroundTask } from '../activity';
|
|
14
|
+
import { backgroundCounts, backgroundTaskName, backgroundTaskTime, type ChatThreadBackgroundTask } from '../activity';
|
|
16
15
|
import { badgeCountOf, entryTimeOf, flyoutSubagents, progressOf, statusWordOf, subagentTitle, summaryWordOf, taskRowStateOf } from '../subagent-list';
|
|
17
16
|
import { useSubagentSupport } from '../subagent-support';
|
|
18
17
|
import { canOpenSubagent, crumbOf, openFromMain, useSubagentTrail, type SubagentStep } from '../subagent-view';
|
|
@@ -64,7 +63,7 @@ export function ChatActivity({ chatId, workflows: showsWorkflows = true }: { cha
|
|
|
64
63
|
return null;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
const { shells, monitors, others } = backgroundCounts(background);
|
|
66
|
+
const { shells, monitors, wakeups, others } = backgroundCounts(background);
|
|
68
67
|
const Slot = host.SubagentSlot;
|
|
69
68
|
const counting = progress.active > 0 && progress.total > 1;
|
|
70
69
|
|
|
@@ -97,10 +96,11 @@ export function ChatActivity({ chatId, workflows: showsWorkflows = true }: { cha
|
|
|
97
96
|
{workflows.length > 0 && <WorkflowFlyout chatId={chatId} calls={workflows} />}
|
|
98
97
|
{background.length > 0 && (
|
|
99
98
|
<Flyout
|
|
100
|
-
icon={<Icon icon={shells > 0 ? SquareTerminal : Activity} size={14} />}
|
|
99
|
+
icon={<Icon icon={shells > 0 ? SquareTerminal : wakeups === background.length ? Clock : Activity} size={14} />}
|
|
101
100
|
label={[
|
|
102
101
|
shells > 0 && t('activity.shells', { count: shells }),
|
|
103
102
|
monitors > 0 && t('activity.monitors', { count: monitors }),
|
|
103
|
+
wakeups > 0 && t('activity.wakeups', { count: wakeups }),
|
|
104
104
|
others > 0 && t('activity.others', { count: others })
|
|
105
105
|
]
|
|
106
106
|
.filter(Boolean)
|
|
@@ -273,10 +273,16 @@ function BackgroundTaskRows({ chatId, tasks }: { chatId: string; tasks: readonly
|
|
|
273
273
|
return tasks.map((task) => (
|
|
274
274
|
<ActivityRow
|
|
275
275
|
key={task.id}
|
|
276
|
-
icon={
|
|
276
|
+
icon={
|
|
277
|
+
<Icon
|
|
278
|
+
icon={scheduledWakeupAt(task) !== null ? Clock : task.kind === 'shell' ? SquareTerminal : Activity}
|
|
279
|
+
size={14}
|
|
280
|
+
className="shrink-0 text-text-faint"
|
|
281
|
+
/>
|
|
282
|
+
}
|
|
277
283
|
title={backgroundTaskName(task)}
|
|
278
284
|
detail={task.description ? task.command : null}
|
|
279
|
-
time={
|
|
285
|
+
time={backgroundTaskTime(task, now)}
|
|
280
286
|
>
|
|
281
287
|
<IconButton icon={Square} size="xs" label={t('activity.stop')} className="mr-1.5" onClick={() => stop(task.id)} />
|
|
282
288
|
</ActivityRow>
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
CircleAlert,
|
|
22
22
|
CircleCheck,
|
|
23
23
|
CircleX,
|
|
24
|
+
Clock,
|
|
24
25
|
File,
|
|
25
26
|
Info,
|
|
26
27
|
MessageCircleQuestionMark,
|
|
@@ -739,14 +740,14 @@ function OpenChatButton({ chatId, label }: { chatId: string; label: 'openFork' |
|
|
|
739
740
|
* The header of a turn the agent started itself, in place of a message of the person. What the
|
|
740
741
|
* sub-agent came back with lives on its own row, which the header opens when the CLI named it.
|
|
741
742
|
*/
|
|
742
|
-
export function AgentTurnRow({ label, onOpen }: { label: string; onOpen?: () => void }) {
|
|
743
|
+
export function AgentTurnRow({ label, wakeup = false, onOpen }: { label: string; wakeup?: boolean; onOpen?: () => void }) {
|
|
743
744
|
const line = 'mb-0.5 flex h-7 w-full items-center gap-2 text-left text-xs text-text-muted';
|
|
744
745
|
|
|
745
746
|
// A header with nowhere to go is text to read and copy; one that opens a row is a button.
|
|
746
747
|
const content = (
|
|
747
748
|
<>
|
|
748
749
|
<span className={ROW_GUTTER}>
|
|
749
|
-
<Icon icon={Bot} size={12} />
|
|
750
|
+
<Icon icon={wakeup ? Clock : Bot} size={12} />
|
|
750
751
|
</span>
|
|
751
752
|
<span className={clsx('min-w-0 truncate', onOpen === undefined && 'select-text')}>{label}</span>
|
|
752
753
|
</>
|
|
@@ -61,7 +61,7 @@ export function Row({ row, chatId, toggleGroup, toggleTurn, toggleSubagent, open
|
|
|
61
61
|
case 'turn-start': {
|
|
62
62
|
const toolUseId = row.turn.taskToolUseId;
|
|
63
63
|
|
|
64
|
-
return <AgentTurnRow label={row.label} onOpen={toolUseId ? () => openSubagent(toolUseId) : undefined} />;
|
|
64
|
+
return <AgentTurnRow label={row.label} wakeup={row.turn.wakeup === true} onOpen={toolUseId ? () => openSubagent(toolUseId) : undefined} />;
|
|
65
65
|
}
|
|
66
66
|
case 'assistant':
|
|
67
67
|
return <AssistantRow chatId={chatId} item={row.item} />;
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
readImagePath,
|
|
26
26
|
shellCommand,
|
|
27
27
|
toolCallLines,
|
|
28
|
+
toolFailed,
|
|
28
29
|
toolStartedAt,
|
|
29
30
|
toolSummary,
|
|
30
31
|
toolSummaryIsPath,
|
|
@@ -355,7 +356,7 @@ function DiffBody({ tool, entries, patched, chatId }: { tool: ChatToolItem; entr
|
|
|
355
356
|
className="max-h-64"
|
|
356
357
|
viewportClassName={clsx(
|
|
357
358
|
'whitespace-pre-wrap font-mono text-code select-text',
|
|
358
|
-
tool
|
|
359
|
+
toolFailed(tool) ? 'text-chat-removed' : 'text-chat-output'
|
|
359
360
|
)}
|
|
360
361
|
>
|
|
361
362
|
<OutputText text={text} whole={whole} stored={tool.outputRef !== undefined} />
|
|
@@ -376,7 +377,7 @@ function ToolOutput({ tool, chatId }: { tool: ChatToolItem; chatId: string | und
|
|
|
376
377
|
return null;
|
|
377
378
|
}
|
|
378
379
|
|
|
379
|
-
const failed = tool
|
|
380
|
+
const failed = toolFailed(tool);
|
|
380
381
|
const { code, rest } = failed ? exitCodeOf(text) : { code: null, rest: text };
|
|
381
382
|
|
|
382
383
|
return (
|
|
@@ -491,7 +492,7 @@ export function WorkRow({
|
|
|
491
492
|
path={detail === undefined && toolSummaryIsPath(tool.name, tool.input)}
|
|
492
493
|
open={open && opens}
|
|
493
494
|
onToggle={opens ? () => setOpen((o) => !o) : undefined}
|
|
494
|
-
failed={failed ?? tool
|
|
495
|
+
failed={failed ?? toolFailed(tool)}
|
|
495
496
|
time={tool.createdAt}
|
|
496
497
|
/>
|
|
497
498
|
{image !== null && ReadImage !== null && <ReadImage path={image} />}
|
|
@@ -578,7 +579,7 @@ export function WorkGroupRow({
|
|
|
578
579
|
const { t } = useTranslation('agent-chat');
|
|
579
580
|
const { commandLooks, toolLooks } = useChatHost();
|
|
580
581
|
const running = tools.filter((tool) => tool.state === 'running').length;
|
|
581
|
-
const failed = tools.filter(
|
|
582
|
+
const failed = tools.filter(toolFailed).length;
|
|
582
583
|
const latest = tools.findLast((tool) => tool.state === 'running');
|
|
583
584
|
|
|
584
585
|
return (
|
|
@@ -8,7 +8,7 @@ import { useChatHost } from '../../../host/host';
|
|
|
8
8
|
import { useChatScope } from '../../../scope';
|
|
9
9
|
import { useChats } from '../../../state/chats';
|
|
10
10
|
import { useChatActions } from '../../actions';
|
|
11
|
-
import { hasToolBody } from '../../logic/tools';
|
|
11
|
+
import { hasToolBody, toolFailed } from '../../logic/tools';
|
|
12
12
|
import { workflowCounts, workflowDescription, workflowPhases, type WorkflowCounts, type WorkflowPhaseView } from '../../logic/workflow';
|
|
13
13
|
import { useSubagentSupport } from '../../subagent-support';
|
|
14
14
|
import type { SubagentStep } from '../../subagent-view';
|
|
@@ -103,7 +103,7 @@ export function WorkflowRow({
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
const failed = tool
|
|
106
|
+
const failed = toolFailed(tool);
|
|
107
107
|
|
|
108
108
|
const header = (
|
|
109
109
|
<>
|
package/src/chat/waiting-on.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { formatMoment } from '@adecore/ui/format';
|
|
2
2
|
import i18next from 'i18next';
|
|
3
3
|
import type { ChatThreadInfo } from '../chat-sink';
|
|
4
|
-
import { backgroundTaskName, type ChatThreadBackgroundTask } from './activity';
|
|
4
|
+
import { backgroundTaskName, backgroundTaskTime, type ChatThreadBackgroundTask } from './activity';
|
|
5
5
|
|
|
6
6
|
/* An open task the chat delegated: whether its child waits out a limit, and that child's info where the client has it. */
|
|
7
7
|
export interface WaitingChild {
|
|
@@ -81,10 +81,7 @@ export function waitingOnLabel(waiting: WaitingOn, now: number): string {
|
|
|
81
81
|
case 'paused':
|
|
82
82
|
return waiting.until === undefined ? t('waitingOn.paused') : t('waitingOn.pausedUntil', { time: formatMoment(waiting.until, now) });
|
|
83
83
|
case 'command':
|
|
84
|
-
return t('waitingOn.command', {
|
|
85
|
-
command: backgroundTaskName(waiting.task),
|
|
86
|
-
age: formatElapsedShort(Math.max(0, now - waiting.task.startedAt))
|
|
87
|
-
});
|
|
84
|
+
return t('waitingOn.command', { command: backgroundTaskName(waiting.task), age: backgroundTaskTime(waiting.task, now) });
|
|
88
85
|
case 'background':
|
|
89
86
|
if (waiting.subagents === 0 && waiting.workflows === 0) {
|
|
90
87
|
return t('waitingOn.background');
|
|
@@ -495,6 +495,10 @@ export default {
|
|
|
495
495
|
other: 'Background task',
|
|
496
496
|
others_one: '{{count}} background task',
|
|
497
497
|
others_other: '{{count}} background tasks',
|
|
498
|
+
wakeup: 'Scheduled wakeup',
|
|
499
|
+
wakeups_one: '{{count}} scheduled wakeup',
|
|
500
|
+
wakeups_other: '{{count}} scheduled wakeups',
|
|
501
|
+
wakesAt: 'wakes at {{time}}',
|
|
498
502
|
stop: 'Stop',
|
|
499
503
|
stopFailed: 'Could not stop task'
|
|
500
504
|
},
|
|
@@ -495,6 +495,10 @@ export default {
|
|
|
495
495
|
other: 'Achtergrondtaak',
|
|
496
496
|
others_one: '{{count}} achtergrondtaak',
|
|
497
497
|
others_other: '{{count}} achtergrondtaken',
|
|
498
|
+
wakeup: 'Geplande wekker',
|
|
499
|
+
wakeups_one: '{{count}} geplande wekker',
|
|
500
|
+
wakeups_other: '{{count}} geplande wekkers',
|
|
501
|
+
wakesAt: 'gaat af om {{time}}',
|
|
498
502
|
stop: 'Stoppen',
|
|
499
503
|
stopFailed: 'Kon de taak niet stoppen'
|
|
500
504
|
},
|
package/src/theme.css
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
--chart-copilot: #64748b;
|
|
18
18
|
--chart-nanogpt: #34c759;
|
|
19
19
|
--chart-grok: #ff2d55;
|
|
20
|
+
--chart-antigravity: #5856d6;
|
|
20
21
|
/* What a chat's context holds, one color per part; the rest is the system's and stays gray. */
|
|
21
22
|
--chart-context-tools: #4d7ce6;
|
|
22
23
|
--chart-context-files: #9a63e0;
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
--chart-copilot: #94a3b8;
|
|
46
47
|
--chart-nanogpt: #30d158;
|
|
47
48
|
--chart-grok: #ff375f;
|
|
49
|
+
--chart-antigravity: #5e5ce6;
|
|
48
50
|
--chart-context-tools: #8aa7f5;
|
|
49
51
|
--chart-context-files: #b98af3;
|
|
50
52
|
--chart-context-conversation: #6dd08b;
|
|
@@ -79,6 +81,7 @@
|
|
|
79
81
|
--color-chart-copilot: var(--chart-copilot);
|
|
80
82
|
--color-chart-nanogpt: var(--chart-nanogpt);
|
|
81
83
|
--color-chart-grok: var(--chart-grok);
|
|
84
|
+
--color-chart-antigravity: var(--chart-antigravity);
|
|
82
85
|
--color-chart-context-tools: var(--chart-context-tools);
|
|
83
86
|
--color-chart-context-files: var(--chart-context-files);
|
|
84
87
|
--color-chart-context-conversation: var(--chart-context-conversation);
|
package/src/usage/format.ts
CHANGED
|
@@ -32,7 +32,8 @@ export const PROVIDER_LABELS: Record<UsageProvider, string> = {
|
|
|
32
32
|
nanogpt: 'NanoGPT',
|
|
33
33
|
grok: 'Grok',
|
|
34
34
|
copilot: 'GitHub Copilot',
|
|
35
|
-
'anthropic-claude-api': 'Claude API'
|
|
35
|
+
'anthropic-claude-api': 'Claude API',
|
|
36
|
+
antigravity: 'Antigravity'
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
export const PROVIDER_COLORS: Record<UsageProvider, string> = {
|
|
@@ -41,7 +42,8 @@ export const PROVIDER_COLORS: Record<UsageProvider, string> = {
|
|
|
41
42
|
nanogpt: 'var(--chart-nanogpt)',
|
|
42
43
|
grok: 'var(--chart-grok)',
|
|
43
44
|
copilot: 'var(--chart-copilot)',
|
|
44
|
-
'anthropic-claude-api': 'var(--chart-claude-api)'
|
|
45
|
+
'anthropic-claude-api': 'var(--chart-claude-api)',
|
|
46
|
+
antigravity: 'var(--chart-antigravity)'
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
/*
|