@adecore/agents-react 0.75.0 → 0.76.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/chat/logic/timeline.js +3 -0
- package/dist/chat/stop-task.d.ts +1 -0
- package/dist/chat/stop-task.js +34 -0
- package/dist/chat/ui/ChatActivity.js +20 -42
- package/dist/chat/ui/Composer.js +397 -381
- package/dist/chat/ui/composer/QueuedMessages.d.ts +5 -1
- package/dist/chat/ui/composer/QueuedMessages.js +60 -30
- package/dist/chat/ui/rows/MessageRows.d.ts +6 -2
- package/dist/chat/ui/rows/MessageRows.js +122 -45
- package/dist/chat/ui/rows/Rows.js +65 -61
- package/dist/chat/waiting-on.d.ts +6 -0
- package/dist/chat/waiting-on.js +13 -2
- package/dist/host/timeline-row.d.ts +1 -0
- package/dist/locales/en/agent-chat.d.ts +4 -0
- package/dist/locales/en/agent-chat.js +5 -1
- package/dist/locales/nl/agent-chat.d.ts +4 -0
- package/dist/locales/nl/agent-chat.js +5 -1
- package/package.json +9 -9
- package/src/chat/logic/timeline.ts +2 -1
- package/src/chat/stop-task.ts +17 -0
- package/src/chat/ui/ChatActivity.tsx +2 -10
- package/src/chat/ui/Composer.tsx +3 -0
- package/src/chat/ui/composer/QueuedMessages.tsx +21 -1
- package/src/chat/ui/rows/MessageRows.tsx +34 -3
- package/src/chat/ui/rows/Rows.tsx +1 -1
- package/src/chat/waiting-on.ts +13 -2
- package/src/host/timeline-row.ts +1 -1
- package/src/locales/en/agent-chat.ts +5 -1
- package/src/locales/nl/agent-chat.ts +5 -1
package/dist/chat/waiting-on.js
CHANGED
|
@@ -2,8 +2,8 @@ import { formatMoment } from '@adecore/ui/format';
|
|
|
2
2
|
import i18next from 'i18next';
|
|
3
3
|
import { backgroundTaskName, backgroundTaskTime } from './activity.js';
|
|
4
4
|
/*
|
|
5
|
-
* The one thing a chat waits on, most pressing first: a child that needs the person,
|
|
6
|
-
* until a time, the oldest command or monitor in the background, background subagents and workflows,
|
|
5
|
+
* The one thing a chat waits on, most pressing first: a child that needs the person, the work a
|
|
6
|
+
* message of the person waits for, a child paused until a time, the oldest command or monitor in the background, background subagents and workflows,
|
|
7
7
|
* and the plan's status line. Null when it waits on none of them.
|
|
8
8
|
*/
|
|
9
9
|
export function waitingOnOf(input) {
|
|
@@ -15,6 +15,13 @@ export function waitingOnOf(input) {
|
|
|
15
15
|
count: needsYou
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
+
if (input.queueHeld !== undefined) {
|
|
19
|
+
const holding = input.queueHeld.task;
|
|
20
|
+
return {
|
|
21
|
+
kind: 'queue',
|
|
22
|
+
task: (input.background ?? []).find(task => task.id === holding) ?? null
|
|
23
|
+
};
|
|
24
|
+
}
|
|
18
25
|
const paused = children.filter(entry => entry.paused !== undefined);
|
|
19
26
|
if (paused.length > 0) {
|
|
20
27
|
const times = paused.flatMap(entry => entry.paused?.until === undefined ? [] : [entry.paused.until]);
|
|
@@ -55,6 +62,10 @@ export function waitingOnLabel(waiting, now) {
|
|
|
55
62
|
return t('waitingOn.needsYou', {
|
|
56
63
|
count: waiting.count
|
|
57
64
|
});
|
|
65
|
+
case 'queue':
|
|
66
|
+
return waiting.task === null ? t('waitingOn.queueWork') : t('waitingOn.queue', {
|
|
67
|
+
command: backgroundTaskName(waiting.task)
|
|
68
|
+
});
|
|
58
69
|
case 'paused':
|
|
59
70
|
return waiting.until === undefined ? t('waitingOn.paused') : t('waitingOn.pausedUntil', {
|
|
60
71
|
time: formatMoment(waiting.until, now)
|
|
@@ -441,6 +441,8 @@ declare const _default: {
|
|
|
441
441
|
editFailed: string;
|
|
442
442
|
sendNow: string;
|
|
443
443
|
paused: string;
|
|
444
|
+
heldBy: string;
|
|
445
|
+
heldByWork: string;
|
|
444
446
|
};
|
|
445
447
|
quote: {
|
|
446
448
|
add: string;
|
|
@@ -511,6 +513,8 @@ declare const _default: {
|
|
|
511
513
|
waitingOn: {
|
|
512
514
|
needsYou_one: string;
|
|
513
515
|
needsYou_other: string;
|
|
516
|
+
queue: string;
|
|
517
|
+
queueWork: string;
|
|
514
518
|
paused: string;
|
|
515
519
|
pausedUntil: string;
|
|
516
520
|
command: string;
|
|
@@ -440,7 +440,9 @@ export default {
|
|
|
440
440
|
alreadySent: 'Already sent',
|
|
441
441
|
editFailed: 'Could not edit message',
|
|
442
442
|
sendNow: 'Send now',
|
|
443
|
-
paused: 'Queue paused. Send a message or choose Send now.'
|
|
443
|
+
paused: 'Queue paused. Send a message or choose Send now.',
|
|
444
|
+
heldBy: 'Waiting for {{command}} to end',
|
|
445
|
+
heldByWork: 'Waiting for work in the background to end'
|
|
444
446
|
},
|
|
445
447
|
quote: {
|
|
446
448
|
add: 'Quote',
|
|
@@ -511,6 +513,8 @@ export default {
|
|
|
511
513
|
waitingOn: {
|
|
512
514
|
needsYou_one: 'A sub-agent needs you',
|
|
513
515
|
needsYou_other: '{{count}} sub-agents need you',
|
|
516
|
+
queue: 'A message waits for {{command}}',
|
|
517
|
+
queueWork: 'A message waits for work in the background',
|
|
514
518
|
paused: 'A sub-agent is paused',
|
|
515
519
|
pausedUntil: 'A sub-agent is paused until {{time}}',
|
|
516
520
|
command: '{{command}} · {{age}}',
|
|
@@ -441,6 +441,8 @@ declare const _default: {
|
|
|
441
441
|
editFailed: string;
|
|
442
442
|
sendNow: string;
|
|
443
443
|
paused: string;
|
|
444
|
+
heldBy: string;
|
|
445
|
+
heldByWork: string;
|
|
444
446
|
};
|
|
445
447
|
quote: {
|
|
446
448
|
add: string;
|
|
@@ -511,6 +513,8 @@ declare const _default: {
|
|
|
511
513
|
waitingOn: {
|
|
512
514
|
needsYou_one: string;
|
|
513
515
|
needsYou_other: string;
|
|
516
|
+
queue: string;
|
|
517
|
+
queueWork: string;
|
|
514
518
|
paused: string;
|
|
515
519
|
pausedUntil: string;
|
|
516
520
|
command: string;
|
|
@@ -440,7 +440,9 @@ export default {
|
|
|
440
440
|
alreadySent: 'Al verstuurd',
|
|
441
441
|
editFailed: 'Kon het bericht niet bewerken',
|
|
442
442
|
sendNow: 'Nu versturen',
|
|
443
|
-
paused: 'Wachtrij gepauzeerd. Verstuur een bericht of kies Nu versturen.'
|
|
443
|
+
paused: 'Wachtrij gepauzeerd. Verstuur een bericht of kies Nu versturen.',
|
|
444
|
+
heldBy: 'Wacht tot {{command}} klaar is',
|
|
445
|
+
heldByWork: 'Wacht tot werk op de achtergrond klaar is'
|
|
444
446
|
},
|
|
445
447
|
quote: {
|
|
446
448
|
add: 'Citeren',
|
|
@@ -511,6 +513,8 @@ export default {
|
|
|
511
513
|
waitingOn: {
|
|
512
514
|
needsYou_one: 'Een sub-agent vraagt aandacht',
|
|
513
515
|
needsYou_other: '{{count}} sub-agents vragen aandacht',
|
|
516
|
+
queue: 'Een bericht wacht op {{command}}',
|
|
517
|
+
queueWork: 'Een bericht wacht op werk op de achtergrond',
|
|
514
518
|
paused: 'Een sub-agent is gepauzeerd',
|
|
515
519
|
pausedUntil: 'Een sub-agent is gepauzeerd tot {{time}}',
|
|
516
520
|
command: '{{command}} · {{age}}',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/agents-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.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.
|
|
76
|
-
"@adecore/editor": "0.
|
|
77
|
-
"@adecore/editor-react": "0.
|
|
78
|
-
"@adecore/intelligent-ui": "0.
|
|
79
|
-
"@adecore/merge": "0.
|
|
80
|
-
"@adecore/utils": "0.
|
|
75
|
+
"@adecore/agent-contracts": "0.76.0",
|
|
76
|
+
"@adecore/editor": "0.76.0",
|
|
77
|
+
"@adecore/editor-react": "0.76.0",
|
|
78
|
+
"@adecore/intelligent-ui": "0.76.0",
|
|
79
|
+
"@adecore/merge": "0.76.0",
|
|
80
|
+
"@adecore/utils": "0.76.0",
|
|
81
81
|
"@codemirror/commands": "^6.11.2",
|
|
82
82
|
"@codemirror/language": "^6.13.1",
|
|
83
83
|
"@codemirror/state": "^6.7.6",
|
|
@@ -101,14 +101,14 @@
|
|
|
101
101
|
"zustand": "^5.1.0"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@adecore/ui": "^0.
|
|
104
|
+
"@adecore/ui": "^0.76.0",
|
|
105
105
|
"i18next": "^26.4.2 || ^27.0.0",
|
|
106
106
|
"react": "^19.3.0",
|
|
107
107
|
"react-dom": "^19.3.0",
|
|
108
108
|
"react-i18next": "^17.0.15 || ^18.0.0"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@adecore/ui": "0.
|
|
111
|
+
"@adecore/ui": "0.76.0",
|
|
112
112
|
"@types/bun": "^1.4.5",
|
|
113
113
|
"@types/react": "^19.3.3",
|
|
114
114
|
"@types/react-dom": "^19.3.0",
|
|
@@ -430,7 +430,8 @@ function rowsForItems(items: ChatThreadItem[], options: TimelineOptions, childre
|
|
|
430
430
|
level: item.level,
|
|
431
431
|
text: item.text,
|
|
432
432
|
...(item.from === undefined ? {} : { from: item.from }),
|
|
433
|
-
...(item.said === undefined ? {} : { said: item.said })
|
|
433
|
+
...(item.said === undefined ? {} : { said: item.said }),
|
|
434
|
+
...(item.stops === undefined ? {} : { stops: item.stops })
|
|
434
435
|
});
|
|
435
436
|
}
|
|
436
437
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useTranslation } from 'react-i18next';
|
|
2
|
+
import { useChatHost } from '../host/host';
|
|
3
|
+
import { useChatActions } from './actions';
|
|
4
|
+
|
|
5
|
+
/* Stops a command or monitor a chat runs in the background, and tells the person when the host refused. */
|
|
6
|
+
export function useStopTask(chatId: string): (taskId: string) => void {
|
|
7
|
+
const host = useChatHost();
|
|
8
|
+
const { t } = useTranslation('agent-chat');
|
|
9
|
+
const actions = useChatActions();
|
|
10
|
+
|
|
11
|
+
return (taskId) => {
|
|
12
|
+
void actions.stopTask(chatId, taskId).catch((error: unknown) => {
|
|
13
|
+
const description = error instanceof Error ? error.message : t('subagents.noAnswer');
|
|
14
|
+
host.notify({ kind: 'error', title: t('activity.stopFailed'), description });
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -10,8 +10,8 @@ import { useChatHost } from '../../host/host';
|
|
|
10
10
|
import { useHostTask, useHostTasks } from '../../host/host-hooks';
|
|
11
11
|
import { useChatScope } from '../../scope';
|
|
12
12
|
import { useChatRow, useChats } from '../../state/chats';
|
|
13
|
-
import { useChatActions } from '../actions';
|
|
14
13
|
import { backgroundCounts, backgroundTaskName, backgroundTaskTime, type ChatThreadBackgroundTask } from '../activity';
|
|
14
|
+
import { useStopTask } from '../stop-task';
|
|
15
15
|
import { badgeCountOf, entryTimeOf, flyoutSubagents, progressOf, statusWordOf, subagentTitle, summaryWordOf, taskRowStateOf } from '../subagent-list';
|
|
16
16
|
import { useSubagentSupport } from '../subagent-support';
|
|
17
17
|
import { canOpenSubagent, crumbOf, openFromMain, useSubagentTrail, type SubagentStep } from '../subagent-view';
|
|
@@ -258,17 +258,9 @@ function SubagentEntry({ chatId, item, now }: { chatId: string; item: ChatSubage
|
|
|
258
258
|
|
|
259
259
|
/* Only drawn while the flyout is open, so the clock ticks for nobody otherwise. */
|
|
260
260
|
function BackgroundTaskRows({ chatId, tasks }: { chatId: string; tasks: readonly ChatThreadBackgroundTask[] }) {
|
|
261
|
-
const host = useChatHost();
|
|
262
261
|
const { t } = useTranslation('agent-chat');
|
|
263
262
|
const now = useNow(1000);
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
function stop(taskId: string): void {
|
|
267
|
-
void actions.stopTask(chatId, taskId).catch((e: unknown) => {
|
|
268
|
-
const description = e instanceof Error ? e.message : t('subagents.noAnswer');
|
|
269
|
-
host.notify({ kind: 'error', title: t('activity.stopFailed'), description });
|
|
270
|
-
});
|
|
271
|
-
}
|
|
263
|
+
const stop = useStopTask(chatId);
|
|
272
264
|
|
|
273
265
|
return tasks.map((task) => (
|
|
274
266
|
<ActivityRow
|
package/src/chat/ui/Composer.tsx
CHANGED
|
@@ -224,6 +224,8 @@ export function Composer({
|
|
|
224
224
|
);
|
|
225
225
|
|
|
226
226
|
const queue = info.queue ?? [];
|
|
227
|
+
const heldTask = info.queueHeld?.task;
|
|
228
|
+
const held = info.queueHeld === undefined ? undefined : { task: (info.background ?? []).find((task) => task.id === heldTask) ?? null };
|
|
227
229
|
const empty = isEmptyDraft(draft);
|
|
228
230
|
|
|
229
231
|
useEffect(() => {
|
|
@@ -315,6 +317,7 @@ export function Composer({
|
|
|
315
317
|
chatId={chatId}
|
|
316
318
|
queue={queue}
|
|
317
319
|
paused={info.queuePaused === true}
|
|
320
|
+
held={held}
|
|
318
321
|
takingBack={takingBack !== null}
|
|
319
322
|
onEdit={(message) => void takeBack(message)}
|
|
320
323
|
/>
|
|
@@ -3,25 +3,45 @@ import { ButtonGroup, ContextMenu, copyText, Icon, IconButton } from '@adecore/u
|
|
|
3
3
|
import { Clock, Copy, FastForward, Pencil, X } from 'lucide-react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { useChatActions } from '../../actions';
|
|
6
|
+
import { backgroundTaskName, type ChatThreadBackgroundTask } from '../../activity';
|
|
7
|
+
import { useStopTask } from '../../stop-task';
|
|
6
8
|
import { scrollTimelineToEnd } from '../../timeline-scroll';
|
|
7
9
|
|
|
8
10
|
interface QueuedMessagesProps {
|
|
9
11
|
chatId: string;
|
|
10
12
|
queue: readonly ChatQueuedMessage[];
|
|
11
13
|
paused: boolean;
|
|
14
|
+
|
|
15
|
+
/* Set while the queue waits for work of the process to end, with the background task in its way when it is one. */
|
|
16
|
+
held?: { task: ChatThreadBackgroundTask | null };
|
|
17
|
+
|
|
12
18
|
/* A message is on its way back into the draft, so no other can follow until it is there. */
|
|
13
19
|
takingBack: boolean;
|
|
14
20
|
onEdit(message: ChatQueuedMessage): void;
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
/* The messages waiting for the running turn to end, each with a way to send it now, edit it or drop it. */
|
|
18
|
-
export function QueuedMessages({ chatId, queue, paused, takingBack, onEdit }: QueuedMessagesProps) {
|
|
24
|
+
export function QueuedMessages({ chatId, queue, paused, held, takingBack, onEdit }: QueuedMessagesProps) {
|
|
19
25
|
const { t } = useTranslation('agent-chat');
|
|
20
26
|
const actions = useChatActions();
|
|
27
|
+
const stop = useStopTask(chatId);
|
|
28
|
+
const task = held?.task ?? null;
|
|
21
29
|
|
|
22
30
|
return (
|
|
23
31
|
<div className="flex flex-col gap-1 border-b border-border px-2 py-1.5">
|
|
24
32
|
{paused && <p className="px-1.5 text-xs text-text-muted">{t('composer.queue.paused')}</p>}
|
|
33
|
+
{held !== undefined && !paused && (
|
|
34
|
+
<p className="flex items-center gap-2 px-1.5 text-xs text-text-muted">
|
|
35
|
+
<span className="min-w-0 truncate">
|
|
36
|
+
{task === null ? t('composer.queue.heldByWork') : t('composer.queue.heldBy', { command: backgroundTaskName(task) })}
|
|
37
|
+
</span>
|
|
38
|
+
{task !== null && (
|
|
39
|
+
<button className="shrink-0 text-text-muted hover:text-text" onClick={() => stop(task.id)}>
|
|
40
|
+
{t('activity.stop')}
|
|
41
|
+
</button>
|
|
42
|
+
)}
|
|
43
|
+
</p>
|
|
44
|
+
)}
|
|
25
45
|
{queue.map((message) => {
|
|
26
46
|
const sendNow = (): void => {
|
|
27
47
|
scrollTimelineToEnd(chatId, 'instant');
|
|
@@ -48,6 +48,7 @@ import { thoughtLine, thoughtPreview } from '../../logic/thought';
|
|
|
48
48
|
import { toolStartedAt, toolSummary, toolSummaryIsPath } from '../../logic/tools';
|
|
49
49
|
import { presentReferences } from '../../mentions';
|
|
50
50
|
import { splitQuote } from '../../quote';
|
|
51
|
+
import { useStopTask } from '../../stop-task';
|
|
51
52
|
import { jumpToTimelineItem } from '../../timeline-scroll';
|
|
52
53
|
import { copySelectionWithChips } from '../chip-clipboard';
|
|
53
54
|
import { REFERENCE_TONE, TOKEN_IN_MESSAGE } from '../chips';
|
|
@@ -654,18 +655,30 @@ const NOTE_ICON = {
|
|
|
654
655
|
error: <Icon icon={CircleAlert} size={12} />
|
|
655
656
|
};
|
|
656
657
|
|
|
658
|
+
interface NoteRowProps {
|
|
659
|
+
id: string;
|
|
660
|
+
level: 'info' | 'warning' | 'error';
|
|
661
|
+
text: string;
|
|
662
|
+
from?: string;
|
|
663
|
+
said?: true;
|
|
664
|
+
|
|
665
|
+
/* The chat the note is in and the background task its message waits for, which the note offers to stop. */
|
|
666
|
+
chatId?: string;
|
|
667
|
+
stops?: string;
|
|
668
|
+
}
|
|
669
|
+
|
|
657
670
|
/*
|
|
658
671
|
* A line from the machine in the thread. A note of more than one line (a summary a fork sent back)
|
|
659
672
|
* shows its first line and folds the rest open as markdown; one that came from a fork leads to it.
|
|
660
673
|
*/
|
|
661
|
-
export function NoteRow({ id, level, text, from, said
|
|
674
|
+
export function NoteRow({ id, level, text, from, said, chatId, stops }: NoteRowProps) {
|
|
662
675
|
const { saidBy } = useChatHost();
|
|
663
676
|
|
|
664
677
|
if (said && saidBy !== undefined) {
|
|
665
678
|
return <HostSaidRow id={id} text={text} author={saidBy} />;
|
|
666
679
|
}
|
|
667
680
|
|
|
668
|
-
return <NoteLine id={id} level={level} text={text} from={from} />;
|
|
681
|
+
return <NoteLine id={id} level={level} text={text} from={from} chatId={chatId} stops={stops} />;
|
|
669
682
|
}
|
|
670
683
|
|
|
671
684
|
/* An item of a newer host this version cannot read: one muted line in its place, with nothing on it to act on. */
|
|
@@ -684,7 +697,7 @@ export function UnknownRow({ id, waits }: { id: string; waits: boolean }) {
|
|
|
684
697
|
);
|
|
685
698
|
}
|
|
686
699
|
|
|
687
|
-
function NoteLine({ id, level, text, from
|
|
700
|
+
function NoteLine({ id, level, text, from, chatId, stops }: Omit<NoteRowProps, 'said'>) {
|
|
688
701
|
const { t } = useTranslation('agent-chat');
|
|
689
702
|
const [open, setOpen] = useState(false);
|
|
690
703
|
const breakAt = text.indexOf('\n');
|
|
@@ -712,6 +725,7 @@ function NoteLine({ id, level, text, from }: { id: string; level: 'info' | 'warn
|
|
|
712
725
|
</button>
|
|
713
726
|
)}
|
|
714
727
|
{from !== undefined && <OpenChatButton chatId={from} label={id.startsWith(WAITING_NOTE_PREFIX) ? 'openWaiting' : 'openFork'} />}
|
|
728
|
+
{chatId !== undefined && stops !== undefined && <StopTaskButton chatId={chatId} taskId={stops} />}
|
|
715
729
|
</div>
|
|
716
730
|
{open && rest !== '' && (
|
|
717
731
|
<div data-find-field="output" className="mt-1 text-text-muted select-text">
|
|
@@ -723,6 +737,23 @@ function NoteLine({ id, level, text, from }: { id: string; level: 'info' | 'warn
|
|
|
723
737
|
);
|
|
724
738
|
}
|
|
725
739
|
|
|
740
|
+
/* Stop on a note about a message that waits for a background task, for as long as the chat runs that task. */
|
|
741
|
+
function StopTaskButton({ chatId, taskId }: { chatId: string; taskId: string }) {
|
|
742
|
+
const { t } = useTranslation('agent-chat');
|
|
743
|
+
const stop = useStopTask(chatId);
|
|
744
|
+
const runs = useChatRow(chatId, (row) => row?.info.background?.some((task) => task.id === taskId) === true);
|
|
745
|
+
|
|
746
|
+
if (!runs) {
|
|
747
|
+
return null;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
return (
|
|
751
|
+
<button className="text-text-muted hover:text-text" onClick={() => stop(taskId)}>
|
|
752
|
+
{t('activity.stop')}
|
|
753
|
+
</button>
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
|
|
726
757
|
/* "Open fork" on a note a fork sent, or "Open to answer" on one about a waiting child, while that chat is still in the project. */
|
|
727
758
|
function OpenChatButton({ chatId, label }: { chatId: string; label: 'openFork' | 'openWaiting' }) {
|
|
728
759
|
const { t } = useTranslation('agent-chat');
|
|
@@ -112,7 +112,7 @@ export function Row({ row, chatId, toggleGroup, toggleTurn, toggleSubagent, open
|
|
|
112
112
|
case 'question':
|
|
113
113
|
return <QuestionHistoryRow item={row.item} />;
|
|
114
114
|
case 'note':
|
|
115
|
-
return <NoteRow id={row.id} level={row.level} text={row.text} from={row.from} said={row.said} />;
|
|
115
|
+
return <NoteRow id={row.id} level={row.level} text={row.text} from={row.from} said={row.said} chatId={chatId} stops={row.stops} />;
|
|
116
116
|
case 'message':
|
|
117
117
|
return <SentMessageRow chatId={chatId} id={row.id} message={row.message} />;
|
|
118
118
|
case 'sent':
|
package/src/chat/waiting-on.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface WaitingChild {
|
|
|
13
13
|
export interface WaitingOnInput {
|
|
14
14
|
children?: readonly WaitingChild[];
|
|
15
15
|
background?: readonly ChatThreadBackgroundTask[];
|
|
16
|
+
/* `ChatThreadInfo.queueHeld`: set while a message of the person waits for work of the process to end. */
|
|
17
|
+
queueHeld?: { task?: string };
|
|
16
18
|
/* Background subagents and workflows of the CLI's own, counted where the thread is loaded. */
|
|
17
19
|
subagents?: number;
|
|
18
20
|
workflows?: number;
|
|
@@ -24,14 +26,15 @@ export interface WaitingOnInput {
|
|
|
24
26
|
|
|
25
27
|
export type WaitingOn =
|
|
26
28
|
| { kind: 'needs-you'; count: number }
|
|
29
|
+
| { kind: 'queue'; task: ChatThreadBackgroundTask | null }
|
|
27
30
|
| { kind: 'paused'; until?: number }
|
|
28
31
|
| { kind: 'command'; task: ChatThreadBackgroundTask }
|
|
29
32
|
| { kind: 'background'; subagents: number; workflows: number }
|
|
30
33
|
| { kind: 'plan'; text: string };
|
|
31
34
|
|
|
32
35
|
/*
|
|
33
|
-
* The one thing a chat waits on, most pressing first: a child that needs the person,
|
|
34
|
-
* until a time, the oldest command or monitor in the background, background subagents and workflows,
|
|
36
|
+
* The one thing a chat waits on, most pressing first: a child that needs the person, the work a
|
|
37
|
+
* message of the person waits for, a child paused until a time, the oldest command or monitor in the background, background subagents and workflows,
|
|
35
38
|
* and the plan's status line. Null when it waits on none of them.
|
|
36
39
|
*/
|
|
37
40
|
export function waitingOnOf(input: WaitingOnInput): WaitingOn | null {
|
|
@@ -42,6 +45,12 @@ export function waitingOnOf(input: WaitingOnInput): WaitingOn | null {
|
|
|
42
45
|
return { kind: 'needs-you', count: needsYou };
|
|
43
46
|
}
|
|
44
47
|
|
|
48
|
+
if (input.queueHeld !== undefined) {
|
|
49
|
+
const holding = input.queueHeld.task;
|
|
50
|
+
|
|
51
|
+
return { kind: 'queue', task: (input.background ?? []).find((task) => task.id === holding) ?? null };
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
const paused = children.filter((entry) => entry.paused !== undefined);
|
|
46
55
|
|
|
47
56
|
if (paused.length > 0) {
|
|
@@ -78,6 +87,8 @@ export function waitingOnLabel(waiting: WaitingOn, now: number): string {
|
|
|
78
87
|
switch (waiting.kind) {
|
|
79
88
|
case 'needs-you':
|
|
80
89
|
return t('waitingOn.needsYou', { count: waiting.count });
|
|
90
|
+
case 'queue':
|
|
91
|
+
return waiting.task === null ? t('waitingOn.queueWork') : t('waitingOn.queue', { command: backgroundTaskName(waiting.task) });
|
|
81
92
|
case 'paused':
|
|
82
93
|
return waiting.until === undefined ? t('waitingOn.paused') : t('waitingOn.pausedUntil', { time: formatMoment(waiting.until, now) });
|
|
83
94
|
case 'command':
|
package/src/host/timeline-row.ts
CHANGED
|
@@ -58,7 +58,7 @@ export type TimelineRow =
|
|
|
58
58
|
| ({ kind: 'subagent' } & SubagentBranch)
|
|
59
59
|
| { kind: 'approval'; id: string; item: ChatApprovalItem }
|
|
60
60
|
| { kind: 'question'; id: string; item: ChatQuestionItem }
|
|
61
|
-
| { kind: 'note'; id: string; level: 'info' | 'warning' | 'error'; text: string; from?: string; said?: true }
|
|
61
|
+
| { kind: 'note'; id: string; level: 'info' | 'warning' | 'error'; text: string; from?: string; said?: true; stops?: string }
|
|
62
62
|
// A message another node sent the chat, drawn as said to it under the name of its sender.
|
|
63
63
|
| { kind: 'message'; id: string; message: ChatNoteMessage; createdAt: number }
|
|
64
64
|
// A message this chat's agent sent another node with a command of a look, drawn as said instead of as its call.
|
|
@@ -440,7 +440,9 @@ export default {
|
|
|
440
440
|
alreadySent: 'Already sent',
|
|
441
441
|
editFailed: 'Could not edit message',
|
|
442
442
|
sendNow: 'Send now',
|
|
443
|
-
paused: 'Queue paused. Send a message or choose Send now.'
|
|
443
|
+
paused: 'Queue paused. Send a message or choose Send now.',
|
|
444
|
+
heldBy: 'Waiting for {{command}} to end',
|
|
445
|
+
heldByWork: 'Waiting for work in the background to end'
|
|
444
446
|
},
|
|
445
447
|
quote: {
|
|
446
448
|
add: 'Quote',
|
|
@@ -511,6 +513,8 @@ export default {
|
|
|
511
513
|
waitingOn: {
|
|
512
514
|
needsYou_one: 'A sub-agent needs you',
|
|
513
515
|
needsYou_other: '{{count}} sub-agents need you',
|
|
516
|
+
queue: 'A message waits for {{command}}',
|
|
517
|
+
queueWork: 'A message waits for work in the background',
|
|
514
518
|
paused: 'A sub-agent is paused',
|
|
515
519
|
pausedUntil: 'A sub-agent is paused until {{time}}',
|
|
516
520
|
command: '{{command}} · {{age}}',
|
|
@@ -440,7 +440,9 @@ export default {
|
|
|
440
440
|
alreadySent: 'Al verstuurd',
|
|
441
441
|
editFailed: 'Kon het bericht niet bewerken',
|
|
442
442
|
sendNow: 'Nu versturen',
|
|
443
|
-
paused: 'Wachtrij gepauzeerd. Verstuur een bericht of kies Nu versturen.'
|
|
443
|
+
paused: 'Wachtrij gepauzeerd. Verstuur een bericht of kies Nu versturen.',
|
|
444
|
+
heldBy: 'Wacht tot {{command}} klaar is',
|
|
445
|
+
heldByWork: 'Wacht tot werk op de achtergrond klaar is'
|
|
444
446
|
},
|
|
445
447
|
quote: {
|
|
446
448
|
add: 'Citeren',
|
|
@@ -511,6 +513,8 @@ export default {
|
|
|
511
513
|
waitingOn: {
|
|
512
514
|
needsYou_one: 'Een sub-agent vraagt aandacht',
|
|
513
515
|
needsYou_other: '{{count}} sub-agents vragen aandacht',
|
|
516
|
+
queue: 'Een bericht wacht op {{command}}',
|
|
517
|
+
queueWork: 'Een bericht wacht op werk op de achtergrond',
|
|
514
518
|
paused: 'Een sub-agent is gepauzeerd',
|
|
515
519
|
pausedUntil: 'Een sub-agent is gepauzeerd tot {{time}}',
|
|
516
520
|
command: '{{command}} · {{age}}',
|