@adecore/agents-react 0.51.0 → 0.53.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/AgentIcon.js +25 -17
- package/dist/agents/ProviderLogo.js +26 -16
- package/dist/agents/agent-marks.d.ts +1 -0
- package/dist/agents/provider-paths.d.ts +2 -1
- package/dist/agents/provider-paths.js +11 -2
- package/dist/chat/index.d.ts +2 -1
- package/dist/chat/index.js +2 -1
- package/dist/chat/logic/command-looks.d.ts +17 -5
- package/dist/chat/logic/command-looks.js +35 -7
- package/dist/chat/logic/timeline.d.ts +6 -4
- package/dist/chat/logic/timeline.js +32 -25
- package/dist/chat/logic/tool-looks.d.ts +16 -0
- package/dist/chat/logic/tool-looks.js +188 -0
- package/dist/chat/logic/tools.d.ts +5 -0
- package/dist/chat/logic/tools.js +17 -2
- package/dist/chat/ui/ShellCommand.d.ts +2 -1
- package/dist/chat/ui/ShellCommand.js +73 -22
- package/dist/chat/ui/SubagentTimeline.js +5 -2
- package/dist/chat/ui/Timeline.js +2 -1
- package/dist/chat/ui/diff/EditorEditDiff.d.ts +3 -2
- package/dist/chat/ui/diff/EditorEditDiff.js +93 -79
- package/dist/chat/ui/diff/LegacyEditDiff.d.ts +1 -1
- package/dist/chat/ui/diff/LegacyEditDiff.js +64 -48
- package/dist/chat/ui/rows/RowContainer.js +26 -23
- package/dist/chat/ui/rows/WorkRows.d.ts +3 -4
- package/dist/chat/ui/rows/WorkRows.js +592 -519
- package/dist/chat/ui/rows/row-rhythm.d.ts +2 -2
- package/dist/chat/ui/rows/row-rhythm.js +9 -6
- package/dist/chat/ui/thread-references.d.ts +1 -0
- package/dist/chat/ui/thread-references.js +4 -3
- package/dist/host.d.ts +28 -0
- package/dist/index.d.ts +1 -1
- 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/package.json +8 -8
- package/src/agents/AgentIcon.tsx +2 -1
- package/src/agents/ProviderLogo.tsx +2 -2
- package/src/agents/agent-marks.ts +2 -0
- package/src/agents/provider-paths.ts +15 -3
- package/src/chat/index.ts +2 -1
- package/src/chat/logic/command-looks.ts +51 -10
- package/src/chat/logic/timeline.ts +46 -27
- package/src/chat/logic/tool-looks.ts +228 -0
- package/src/chat/logic/tools.ts +13 -2
- package/src/chat/ui/ShellCommand.tsx +33 -6
- package/src/chat/ui/SubagentTimeline.tsx +3 -2
- package/src/chat/ui/Timeline.tsx +2 -1
- package/src/chat/ui/diff/EditorEditDiff.tsx +31 -5
- package/src/chat/ui/diff/LegacyEditDiff.tsx +5 -3
- package/src/chat/ui/rows/RowContainer.tsx +4 -2
- package/src/chat/ui/rows/WorkRows.tsx +46 -33
- package/src/chat/ui/rows/row-rhythm.ts +9 -6
- package/src/chat/ui/thread-references.ts +5 -1
- package/src/host.ts +51 -0
- package/src/index.ts +3 -0
- package/src/locales/en/agent-chat.ts +4 -0
- package/src/locales/nl/agent-chat.ts +4 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
import { type TimelineRow } from '../../logic/timeline.js';
|
|
3
3
|
export declare const FOLLOW_THRESHOLD_PX = 40;
|
|
4
|
-
export declare function saidToChat(row: TimelineRow): boolean;
|
|
5
|
-
export declare function rowRhythm(row: TimelineRow, previous: TimelineRow | null): string;
|
|
4
|
+
export declare function saidToChat(row: TimelineRow, hostSpeaks?: boolean): boolean;
|
|
5
|
+
export declare function rowRhythm(row: TimelineRow, previous: TimelineRow | null, hostSpeaks?: boolean): string;
|
|
6
6
|
export declare function replyHeader(row: TimelineRow, previous: TimelineRow | null): {
|
|
7
7
|
at: number | null;
|
|
8
8
|
} | null;
|
|
@@ -7,14 +7,17 @@ export const FOLLOW_THRESHOLD_PX = 40;
|
|
|
7
7
|
* card, which have no margin of their own, and each end of a run of sent messages, which sit as tight as
|
|
8
8
|
* work lines so a fan-out reads as one stretch. A question and the answer after it never take a seam.
|
|
9
9
|
*/
|
|
10
|
-
/*
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
/*
|
|
11
|
+
* A person's message, or one another node sent: both are said to the chat and drawn the same way. So is a note
|
|
12
|
+
* the host said, where `hostSpeaks` says the host draws it as a message (`ChatHost.saidBy`).
|
|
13
|
+
*/
|
|
14
|
+
export function saidToChat(row, hostSpeaks = false) {
|
|
15
|
+
return row.kind === 'user' || row.kind === 'message' || hostSpeaks && row.kind === 'note' && row.said === true;
|
|
13
16
|
}
|
|
14
|
-
export function rowRhythm(row, previous) {
|
|
15
|
-
const question = saidToChat(row);
|
|
17
|
+
export function rowRhythm(row, previous, hostSpeaks = false) {
|
|
18
|
+
const question = saidToChat(row, hostSpeaks);
|
|
16
19
|
const bare = previous?.kind === 'visual' || previous?.kind === 'app-card';
|
|
17
|
-
const seam = !question && previous !== null && !saidToChat(previous) && (isBlock(row) !== isBlock(previous) || bare || row.kind === 'sent' !== (previous.kind === 'sent'));
|
|
20
|
+
const seam = !question && previous !== null && !saidToChat(previous, hostSpeaks) && (isBlock(row) !== isBlock(previous) || bare || row.kind === 'sent' !== (previous.kind === 'sent'));
|
|
18
21
|
return clsx(question && 'pb-(--chat-answer-gap)', seam && 'pt-(--chat-block-gap)');
|
|
19
22
|
}
|
|
20
23
|
/*
|
|
@@ -2,3 +2,4 @@ import type { ChatItem } from '@adecore/agent-contracts';
|
|
|
2
2
|
import type { ReferenceLookup } from './reference-lookup.js';
|
|
3
3
|
export declare function threadReferencedKey(structure: Record<string, ChatItem> | undefined): string;
|
|
4
4
|
export declare function useReferenceLookup(chatId: string): ReferenceLookup;
|
|
5
|
+
export declare function useReferenceLookupIn(scopeId: string, chatId: string): ReferenceLookup;
|
|
@@ -31,10 +31,11 @@ export function threadReferencedKey(structure) {
|
|
|
31
31
|
}
|
|
32
32
|
/* What the views, nodes and chats of a thread stand for now, and how one opens, for the rows that draw chips. */
|
|
33
33
|
export function useReferenceLookup(chatId) {
|
|
34
|
+
return useReferenceLookupIn(useChatScope().id, chatId);
|
|
35
|
+
}
|
|
36
|
+
/* The same for a row that may stand outside a scope. */
|
|
37
|
+
export function useReferenceLookupIn(scopeId, chatId) {
|
|
34
38
|
const $ = _c(9);
|
|
35
|
-
const {
|
|
36
|
-
id: scopeId
|
|
37
|
-
} = useChatScope();
|
|
38
39
|
const {
|
|
39
40
|
openReference
|
|
40
41
|
} = useChatHost();
|
package/dist/host.d.ts
CHANGED
|
@@ -167,6 +167,7 @@ export interface ReplyAuthor {
|
|
|
167
167
|
export interface CommandName {
|
|
168
168
|
name: string;
|
|
169
169
|
icon?: ReactNode;
|
|
170
|
+
reference?: string;
|
|
170
171
|
}
|
|
171
172
|
export interface CommandLookMatch {
|
|
172
173
|
label: string;
|
|
@@ -203,6 +204,32 @@ export interface CommandLook {
|
|
|
203
204
|
useNames?(scopeId: string, chatId: string): (word: string, option: string | null) => CommandName | null;
|
|
204
205
|
sent?(call: CommandLookCall): CommandLookSent | null;
|
|
205
206
|
}
|
|
207
|
+
export interface ToolLookMatch {
|
|
208
|
+
label: string;
|
|
209
|
+
lead?: string;
|
|
210
|
+
fields?: readonly string[];
|
|
211
|
+
group?: {
|
|
212
|
+
key: string;
|
|
213
|
+
sentence(count: number): string;
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
export interface ToolLookCall {
|
|
217
|
+
readonly tool: string;
|
|
218
|
+
readonly input: Readonly<Record<string, unknown>>;
|
|
219
|
+
readonly state: 'running' | 'done' | 'error';
|
|
220
|
+
readonly output: string | null;
|
|
221
|
+
}
|
|
222
|
+
export interface ToolLook {
|
|
223
|
+
server: string;
|
|
224
|
+
brand?: string;
|
|
225
|
+
Mark: ComponentType<{
|
|
226
|
+
size: number;
|
|
227
|
+
}>;
|
|
228
|
+
describe(tool: string, input: Readonly<Record<string, unknown>>): ToolLookMatch | null;
|
|
229
|
+
sentence?(count: number): string;
|
|
230
|
+
useNames?(scopeId: string, chatId: string): (word: string, option: string | null) => CommandName | null;
|
|
231
|
+
sent?(call: ToolLookCall): CommandLookSent | null;
|
|
232
|
+
}
|
|
206
233
|
export type UiMapSource = {
|
|
207
234
|
state: 'tiles';
|
|
208
235
|
styleUrl(theme: 'light' | 'dark'): string;
|
|
@@ -371,6 +398,7 @@ export interface ChatHost {
|
|
|
371
398
|
saidBy?: ReplyAuthor;
|
|
372
399
|
visuals: VisualHost | null;
|
|
373
400
|
commandLooks?: readonly CommandLook[];
|
|
401
|
+
toolLooks?: readonly ToolLook[];
|
|
374
402
|
}
|
|
375
403
|
export declare function ChatHostProvider({ host, children }: {
|
|
376
404
|
host: Partial<ChatHost>;
|
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, 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 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';
|
|
@@ -213,6 +213,7 @@ declare const _default: {
|
|
|
213
213
|
loadingDiff: string;
|
|
214
214
|
diffUnavailable: string;
|
|
215
215
|
runningFor: string;
|
|
216
|
+
failed: string;
|
|
216
217
|
awaitingApproval: string;
|
|
217
218
|
forksAfter_one: string;
|
|
218
219
|
forksAfter_other: string;
|
|
@@ -273,6 +274,8 @@ declare const _default: {
|
|
|
273
274
|
group: {
|
|
274
275
|
running_one: string;
|
|
275
276
|
running_other: string;
|
|
277
|
+
failed_one: string;
|
|
278
|
+
failed_other: string;
|
|
276
279
|
tools: {
|
|
277
280
|
Read_one: string;
|
|
278
281
|
Read_other: string;
|
|
@@ -317,6 +320,7 @@ declare const _default: {
|
|
|
317
320
|
wokenByMessage_one: string;
|
|
318
321
|
wokenByMessage_other: string;
|
|
319
322
|
subagentFinished: string;
|
|
323
|
+
backgroundFinished: string;
|
|
320
324
|
continued: string;
|
|
321
325
|
stopped: string;
|
|
322
326
|
youStopped: string;
|
|
@@ -213,6 +213,7 @@ export default {
|
|
|
213
213
|
loadingDiff: 'Loading diff',
|
|
214
214
|
diffUnavailable: 'Could not load this diff',
|
|
215
215
|
runningFor: 'running for {{elapsed}}',
|
|
216
|
+
failed: 'Failed',
|
|
216
217
|
awaitingApproval: 'waiting for you',
|
|
217
218
|
forksAfter_one: 'Forked after this turn',
|
|
218
219
|
forksAfter_other: '{{count}} forks after this turn',
|
|
@@ -273,6 +274,8 @@ export default {
|
|
|
273
274
|
group: {
|
|
274
275
|
running_one: '{{count}} running',
|
|
275
276
|
running_other: '{{count}} running',
|
|
277
|
+
failed_one: '{{count}} failed',
|
|
278
|
+
failed_other: '{{count}} failed',
|
|
276
279
|
tools: {
|
|
277
280
|
Read_one: 'Read {{count}} file',
|
|
278
281
|
Read_other: 'Read {{count}} files',
|
|
@@ -317,6 +320,7 @@ export default {
|
|
|
317
320
|
wokenByMessage_one: 'Woken by a message',
|
|
318
321
|
wokenByMessage_other: 'Woken by {{count}} messages',
|
|
319
322
|
subagentFinished: 'Sub-agent finished: {{label}}',
|
|
323
|
+
backgroundFinished: 'Background task finished: {{label}}',
|
|
320
324
|
continued: 'Continued on its own',
|
|
321
325
|
stopped: 'Stopped after {{duration}}',
|
|
322
326
|
youStopped: 'You stopped after {{duration}}',
|
|
@@ -213,6 +213,7 @@ declare const _default: {
|
|
|
213
213
|
loadingDiff: string;
|
|
214
214
|
diffUnavailable: string;
|
|
215
215
|
runningFor: string;
|
|
216
|
+
failed: string;
|
|
216
217
|
awaitingApproval: string;
|
|
217
218
|
forksAfter_one: string;
|
|
218
219
|
forksAfter_other: string;
|
|
@@ -273,6 +274,8 @@ declare const _default: {
|
|
|
273
274
|
group: {
|
|
274
275
|
running_one: string;
|
|
275
276
|
running_other: string;
|
|
277
|
+
failed_one: string;
|
|
278
|
+
failed_other: string;
|
|
276
279
|
tools: {
|
|
277
280
|
Read_one: string;
|
|
278
281
|
Read_other: string;
|
|
@@ -317,6 +320,7 @@ declare const _default: {
|
|
|
317
320
|
wokenByMessage_one: string;
|
|
318
321
|
wokenByMessage_other: string;
|
|
319
322
|
subagentFinished: string;
|
|
323
|
+
backgroundFinished: string;
|
|
320
324
|
continued: string;
|
|
321
325
|
stopped: string;
|
|
322
326
|
youStopped: string;
|
|
@@ -213,6 +213,7 @@ export default {
|
|
|
213
213
|
loadingDiff: 'Diff laden',
|
|
214
214
|
diffUnavailable: 'Kon deze diff niet laden',
|
|
215
215
|
runningFor: 'loopt al {{elapsed}}',
|
|
216
|
+
failed: 'Mislukt',
|
|
216
217
|
awaitingApproval: 'wacht op jou',
|
|
217
218
|
forksAfter_one: 'Fork na deze turn',
|
|
218
219
|
forksAfter_other: '{{count}} forks na deze turn',
|
|
@@ -273,6 +274,8 @@ export default {
|
|
|
273
274
|
group: {
|
|
274
275
|
running_one: '{{count}} actief',
|
|
275
276
|
running_other: '{{count}} actief',
|
|
277
|
+
failed_one: '{{count}} mislukt',
|
|
278
|
+
failed_other: '{{count}} mislukt',
|
|
276
279
|
tools: {
|
|
277
280
|
Read_one: '{{count}} bestand gelezen',
|
|
278
281
|
Read_other: '{{count}} bestanden gelezen',
|
|
@@ -317,6 +320,7 @@ export default {
|
|
|
317
320
|
wokenByMessage_one: 'Gewekt door een bericht',
|
|
318
321
|
wokenByMessage_other: 'Gewekt door {{count}} berichten',
|
|
319
322
|
subagentFinished: 'Sub-agent klaar: {{label}}',
|
|
323
|
+
backgroundFinished: 'Achtergrondtaak klaar: {{label}}',
|
|
320
324
|
continued: 'Zelf verdergegaan',
|
|
321
325
|
stopped: 'Gestopt na {{duration}}',
|
|
322
326
|
youStopped: 'Jij stopte na {{duration}}',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/agents-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -72,11 +72,11 @@
|
|
|
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.
|
|
75
|
+
"@adecore/agent-contracts": "0.53.0",
|
|
76
|
+
"@adecore/editor": "0.53.0",
|
|
77
|
+
"@adecore/editor-react": "0.53.0",
|
|
78
|
+
"@adecore/intelligent-ui": "0.53.0",
|
|
79
|
+
"@adecore/merge": "0.53.0",
|
|
80
80
|
"@codemirror/commands": "^6.11.1",
|
|
81
81
|
"@codemirror/language": "^6.13.1",
|
|
82
82
|
"@codemirror/state": "^6.7.6",
|
|
@@ -100,14 +100,14 @@
|
|
|
100
100
|
"zustand": "^5.0.16"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"@adecore/ui": "^0.
|
|
103
|
+
"@adecore/ui": "^0.53.0",
|
|
104
104
|
"i18next": "^26.4.2",
|
|
105
105
|
"react": "^19.3.0",
|
|
106
106
|
"react-dom": "^19.3.0",
|
|
107
107
|
"react-i18next": "^17.0.15"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
|
-
"@adecore/ui": "0.
|
|
110
|
+
"@adecore/ui": "0.53.0",
|
|
111
111
|
"@types/bun": "^1.4.4",
|
|
112
112
|
"@types/react": "^19.3.0",
|
|
113
113
|
"@types/react-dom": "^19.3.0",
|
package/src/agents/AgentIcon.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { PROVIDER_PATHS } from './provider-paths';
|
|
|
9
9
|
// simple-icons removed OpenAI's mark at its request, so Codex reuses the usage page's path.
|
|
10
10
|
const BUILT_IN_MARKS: Partial<Record<AgentKind, AgentMark>> = {
|
|
11
11
|
claude: siClaude,
|
|
12
|
+
'anthropic-claude-api': { title: 'Claude API', path: PROVIDER_PATHS['anthropic-claude-api'], fillRule: 'evenodd' },
|
|
12
13
|
codex: { title: 'Codex', path: PROVIDER_PATHS.codex },
|
|
13
14
|
grok: { title: 'Grok', path: PROVIDER_PATHS.grok },
|
|
14
15
|
gemini: siGooglegemini,
|
|
@@ -32,7 +33,7 @@ export function AgentIcon({ kind, size = 14, className }: { kind: AgentKind; siz
|
|
|
32
33
|
fill="currentColor"
|
|
33
34
|
className={clsx('align-middle', className)}
|
|
34
35
|
>
|
|
35
|
-
<path d={mark.path} />
|
|
36
|
+
<path d={mark.path} fillRule={mark.fillRule ?? 'nonzero'} />
|
|
36
37
|
</svg>
|
|
37
38
|
);
|
|
38
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import type { UsageProvider } from '@adecore/agent-contracts';
|
|
3
|
-
import { PROVIDER_PATHS } from './provider-paths';
|
|
3
|
+
import { PROVIDER_PATHS, providerFillRule } from './provider-paths';
|
|
4
4
|
|
|
5
5
|
interface ProviderLogoProps {
|
|
6
6
|
provider: UsageProvider;
|
|
@@ -14,7 +14,7 @@ const VIEW_BOX = '0 0 24 24';
|
|
|
14
14
|
export function ProviderLogo({ provider, size = 14, className }: ProviderLogoProps) {
|
|
15
15
|
return (
|
|
16
16
|
<svg aria-hidden viewBox={VIEW_BOX} width={size} height={size} fill="currentColor" className={clsx('shrink-0', className)}>
|
|
17
|
-
<path d={PROVIDER_PATHS[provider]} />
|
|
17
|
+
<path d={PROVIDER_PATHS[provider]} fillRule={providerFillRule(provider)} />
|
|
18
18
|
</svg>
|
|
19
19
|
);
|
|
20
20
|
}
|
|
@@ -8,6 +8,8 @@ export interface AgentMark {
|
|
|
8
8
|
path: string;
|
|
9
9
|
/* `0 0 24 24` when absent. */
|
|
10
10
|
viewBox?: string;
|
|
11
|
+
/* `evenodd` for a path whose holes are subpaths inside its shape; `nonzero` when absent. */
|
|
12
|
+
fillRule?: 'nonzero' | 'evenodd';
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
let hostMarks: Readonly<Partial<Record<AgentKind, AgentMark>>> = {};
|
|
@@ -8,9 +8,16 @@ import { siGithubcopilot } from 'simple-icons';
|
|
|
8
8
|
const CLAUDE_PATH =
|
|
9
9
|
'M4.709 15.955l4.72-2.647.079-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.377-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.048.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.607.212-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.914-1.316-.012.01z';
|
|
10
10
|
|
|
11
|
+
/*
|
|
12
|
+
* Claude Code on an API key: the Claude mark with its lower part cut away, over a label with "API" knocked out of it.
|
|
13
|
+
* Plain lines and curves, no text, so another platform can copy the `d` as it is. Its holes need the even-odd rule.
|
|
14
|
+
*/
|
|
15
|
+
const CLAUDE_API_PATH =
|
|
16
|
+
'M0 11.79L0.05 11.43L0.56 11.11L9.14 11.78L9.5 11.78L9.52 11.77L9.56 11.62L9.26 11.38L4.97 8.51L3.81 7.71L3.45 7.44L3.42 7.43L3.33 7.35L2.96 7.09L2.93 7.08L2.89 7.04L2.34 6.67L1.99 6.22L1.84 5.21L2.48 4.5L2.51 4.49L3.41 4.56L3.61 4.62L6.38 6.77L6.51 6.85L9.24 8.9L9.29 8.89L9.36 8.83L9.39 8.82L9.42 8.74L5.8 2.48L5.54 1.16L6.28 0.14L6.59 0.03L6.73 0L7.68 0.13L8.11 0.5L9.13 2.81L9.15 2.83L9.23 3.03L10.16 4.98L11.39 7.38L11.41 7.4L11.43 7.46L11.75 8.07L12.07 9.13L12.09 9.16L12.24 9.16L12.25 8.8L12.91 1.75L13.28 0.86L13.47 0.72L14.02 0.36L14.1 0.38L14.46 0.55L14.48 0.57L14.54 0.59L14.64 0.65L15.1 1.32L13.83 8.46L14.01 8.46L14.19 8.31L14.44 8.01L15.31 6.86L16.79 5.01L17.98 3.66L18.59 3.04L18.62 3.03L19.04 2.69L20.06 2.69L20.12 2.75L20.84 3.82L20.78 3.99L20.5 4.97L18.78 7.17L17.61 8.73L17.23 9.27L16.5 10.54L16.57 10.64L22.99 9.42L23.83 9.81L23.92 10.22L23.6 11L23.58 11.02L15.89 12.77L15.84 12.8L15.89 12.87L18.1 13.05L19.81 13.05L22.72 13.27L22.91 13.39L22.49 13.31L22.2 13.3L9.43 13.3L9.5 13.07L9.44 12.96L9.41 12.95L9.14 12.95L3.06 12.72L1.2 12.62L0.53 12.48ZM2 14.5H22C23.1 14.5 24 15.4 24 16.5V22C24 23.1 23.1 24 22 24H2C0.9 24 0 23.1 0 22V16.5C0 15.4 0.9 14.5 2 14.5ZM5.91 22.05L7.56 16.45L9.06 16.45L10.71 22.05L9.11 22.05L8.83 21.1L7.79 21.1L7.51 22.05ZM8.31 19.33L8.55 20.15L8.07 20.15ZM11.61 22.05V16.45H13.86C14.82 16.45 15.59 17.22 15.59 18.18C15.59 19.13 14.82 19.9 13.86 19.9H13.21V22.05ZM13.21 17.6H13.81C14.13 17.6 14.39 17.86 14.39 18.17C14.39 18.49 14.13 18.75 13.81 18.75H13.21ZM16.49 16.45H18.09V22.05H16.49Z';
|
|
17
|
+
|
|
11
18
|
export const PROVIDER_PATHS: Record<UsageProvider, string> = {
|
|
12
19
|
claude: CLAUDE_PATH,
|
|
13
|
-
'anthropic-claude-api':
|
|
20
|
+
'anthropic-claude-api': CLAUDE_API_PATH,
|
|
14
21
|
codex: 'M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.554 5.554 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.019.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.001zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z',
|
|
15
22
|
nanogpt: 'M5 20V4h2.6l8.8 11.2V4H19v16h-2.6L7.6 8.8V20z',
|
|
16
23
|
grok: 'M6.469 8.776 16.512 23h-4.464L2.005 8.776H6.47Zm-.004 7.9 2.233 3.164L6.467 23H2l4.465-6.324ZM22 2.582V23h-3.659V7.764L22 2.582ZM22 1l-9.952 14.095-2.233-3.163L17.533 1H22Z',
|
|
@@ -18,6 +25,11 @@ export const PROVIDER_PATHS: Record<UsageProvider, string> = {
|
|
|
18
25
|
};
|
|
19
26
|
|
|
20
27
|
/* The CLIs drawn with the logo of the usage page rather than their agent mark. */
|
|
21
|
-
export function hasProviderLogo(kind: AgentKind): kind is 'claude' | 'codex' {
|
|
22
|
-
return kind === 'claude' || kind === 'codex';
|
|
28
|
+
export function hasProviderLogo(kind: AgentKind): kind is 'claude' | 'codex' | 'anthropic-claude-api' {
|
|
29
|
+
return kind === 'claude' || kind === 'codex' || kind === 'anthropic-claude-api';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* The marks whose holes are subpaths inside the shape, which the default nonzero rule would fill. */
|
|
33
|
+
export function providerFillRule(provider: UsageProvider): 'evenodd' | 'nonzero' {
|
|
34
|
+
return provider === 'anthropic-claude-api' ? 'evenodd' : 'nonzero';
|
|
23
35
|
}
|
package/src/chat/index.ts
CHANGED
|
@@ -26,7 +26,8 @@ export {
|
|
|
26
26
|
type ForkWorktreeChoice
|
|
27
27
|
} from './logic/fork';
|
|
28
28
|
|
|
29
|
-
export { matchCommandLook, sentMessageOf, type CommandLookRun, type CommandLookWord } from './logic/command-looks';
|
|
29
|
+
export { matchCommandLook, lookRunOf, sentMessageOf, type Look, type LookRun, type CommandLookRun, type CommandLookWord } from './logic/command-looks';
|
|
30
|
+
export { mcpCallOf, matchToolLook, type McpCall, type ToolLookRun } from './logic/tool-looks';
|
|
30
31
|
export { handbackReportOf } from './logic/handback';
|
|
31
32
|
export { limitView, type LimitView } from './logic/limit';
|
|
32
33
|
export type { TickKind, ScrubberTick } from './logic/scrubber';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ChatToolItem } from '@adecore/agent-contracts';
|
|
2
|
-
import type { CommandLook, CommandLookMatch, CommandLookSent } from '../../host';
|
|
2
|
+
import type { CommandLook, CommandLookMatch, CommandLookSent, ToolLook } from '../../host';
|
|
3
3
|
import { EMBEDDED_CODE_LIMIT, shellCommands, type EmbeddedCode, type ShellSimpleCommand, type ShellWord } from './embedded-code';
|
|
4
|
+
import { matchToolLook } from './tool-looks';
|
|
4
5
|
import { shellCommand } from './tools';
|
|
5
6
|
|
|
6
7
|
// A folded value keeps this many characters of what it says.
|
|
@@ -18,12 +19,18 @@ export interface CommandLookWord {
|
|
|
18
19
|
readonly option: string | null;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
/* A
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
/* A look of the host's own: a program in a shell call, or an MCP server. */
|
|
23
|
+
export type Look = CommandLook | ToolLook;
|
|
24
|
+
|
|
25
|
+
/* A call read as a look's tool, as its row draws it, whether a shell line or an MCP call. */
|
|
26
|
+
export interface LookRun {
|
|
27
|
+
readonly look: Look;
|
|
28
|
+
readonly label: string;
|
|
29
|
+
readonly group?: { key: string; sentence(count: number): string };
|
|
30
|
+
/* What follows the label: the source from the detail word on, or the fields of an MCP call, with long values shortened. */
|
|
26
31
|
readonly detail: string;
|
|
32
|
+
/* Whether the detail is shell source, drawn in the colors of the code theme. */
|
|
33
|
+
readonly shell: boolean;
|
|
27
34
|
/* The values the match names a language for, as offsets into the detail. */
|
|
28
35
|
readonly code: readonly EmbeddedCode[];
|
|
29
36
|
/* The words of the detail that are no option. */
|
|
@@ -34,6 +41,12 @@ export interface CommandLookRun {
|
|
|
34
41
|
readonly more: number;
|
|
35
42
|
/* Whether the command is fed a heredoc, which the detail leaves out. */
|
|
36
43
|
readonly heredoc: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* A shell call read as a tool of its own: the first command of the line a look knows. */
|
|
47
|
+
export interface CommandLookRun extends LookRun {
|
|
48
|
+
readonly look: CommandLook;
|
|
49
|
+
readonly match: CommandLookMatch;
|
|
37
50
|
/* The words after the program, quotes taken out. */
|
|
38
51
|
readonly args: readonly string[];
|
|
39
52
|
/* The lines of its one heredoc, or null without one, with more, or with one the shell fills in. */
|
|
@@ -190,6 +203,9 @@ function read(command: string, looks: readonly CommandLook[]): CommandLookRun |
|
|
|
190
203
|
return {
|
|
191
204
|
look: found.look,
|
|
192
205
|
match: found.match,
|
|
206
|
+
label: found.match.label,
|
|
207
|
+
group: found.match.group,
|
|
208
|
+
shell: true,
|
|
193
209
|
...detailOf(command, found.command, found.match),
|
|
194
210
|
others,
|
|
195
211
|
more,
|
|
@@ -233,14 +249,39 @@ export function matchCommandLook(command: string, looks: readonly CommandLook[]
|
|
|
233
249
|
return run;
|
|
234
250
|
}
|
|
235
251
|
|
|
236
|
-
/* The
|
|
237
|
-
export function
|
|
252
|
+
/* The look a call runs under, a program of its shell line before an MCP server, or null for a call no look knows. */
|
|
253
|
+
export function lookRunOf(tool: ChatToolItem, commandLooks: readonly CommandLook[] | undefined, toolLooks: readonly ToolLook[] | undefined): LookRun | null {
|
|
254
|
+
const command = shellCommand(tool.name, tool.input);
|
|
255
|
+
|
|
256
|
+
return (command === null ? null : matchCommandLook(command, commandLooks)) ?? matchToolLook(tool, toolLooks);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* What tells looks apart where two may share a group key: the program, or the server. */
|
|
260
|
+
export function lookKey(look: Look): string {
|
|
261
|
+
return 'program' in look ? `program:${look.program}` : `server:${look.server}`;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/*
|
|
265
|
+
* The message a call sent, per its look: for a shell line only when it is exactly that one call, whose
|
|
266
|
+
* words are all known; for an MCP call whenever its look reads one from it.
|
|
267
|
+
*/
|
|
268
|
+
export function sentMessageOf(tool: ChatToolItem, looks: readonly CommandLook[] | undefined, toolLooks?: readonly ToolLook[]): CommandLookSent | null {
|
|
238
269
|
const command = shellCommand(tool.name, tool.input);
|
|
239
270
|
const run = command === null ? null : matchCommandLook(command, looks);
|
|
240
271
|
|
|
241
|
-
if (run
|
|
272
|
+
if (run !== null) {
|
|
273
|
+
if (run.look.sent === undefined || run.others.length > 0 || run.more > 0 || run.expands) {
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return run.look.sent({ args: run.args, heredoc: run.heredocText, state: tool.state, output: tool.output });
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const called = matchToolLook(tool, toolLooks);
|
|
281
|
+
|
|
282
|
+
if (called === null || called.look.sent === undefined) {
|
|
242
283
|
return null;
|
|
243
284
|
}
|
|
244
285
|
|
|
245
|
-
return
|
|
286
|
+
return called.look.sent({ tool: called.call.tool, input: called.call.input, state: tool.state, output: called.call.output });
|
|
246
287
|
}
|
|
@@ -15,13 +15,13 @@ import type {
|
|
|
15
15
|
ChatWorkflow
|
|
16
16
|
} from '@adecore/agent-contracts';
|
|
17
17
|
import { abortedByMachine } from '@adecore/agent-contracts';
|
|
18
|
-
import type { CommandLook, CommandLookSent, ThreadCard } from '../../host';
|
|
18
|
+
import type { CommandLook, CommandLookSent, ThreadCard, ToolLook } from '../../host';
|
|
19
19
|
import { formatElapsedShort } from '@adecore/ui/format';
|
|
20
|
-
import {
|
|
20
|
+
import { lookKey, lookRunOf, sentMessageOf, type Look } from './command-looks';
|
|
21
21
|
import { isImageGeneration } from './generated-image';
|
|
22
22
|
import { handbackReportOf } from './handback';
|
|
23
23
|
import { toolEntry } from './tool-catalog';
|
|
24
|
-
import { hasFileChanges, isFileChange
|
|
24
|
+
import { hasFileChanges, isFileChange } from './tools';
|
|
25
25
|
|
|
26
26
|
/* A subagent's row: the work the thread kept of it, and the agents it opened in turn, each a row of its own under it. */
|
|
27
27
|
export interface SubagentBranch {
|
|
@@ -46,7 +46,7 @@ export type TimelineRow =
|
|
|
46
46
|
| { kind: 'thinking'; id: string; item: ChatThinkingItem }
|
|
47
47
|
| { kind: 'work'; id: string; tool: ChatToolItem }
|
|
48
48
|
// `look` is set when every call is a run of that look and the summary is its sentence.
|
|
49
|
-
| { kind: 'work-group'; id: string; tools: ChatToolItem[]; summary: string; expanded: boolean; look?:
|
|
49
|
+
| { kind: 'work-group'; id: string; tools: ChatToolItem[]; summary: string; expanded: boolean; look?: Look }
|
|
50
50
|
| { kind: 'work-live'; id: string; tool: ChatToolItem }
|
|
51
51
|
// The latest thought of a running turn, repeated over the call it led to; `at` is when that call began.
|
|
52
52
|
| { kind: 'live-thought'; id: string; item: ChatThinkingItem; at: number }
|
|
@@ -89,6 +89,8 @@ interface TimelineOptions {
|
|
|
89
89
|
forkedTurns?: ReadonlySet<string>;
|
|
90
90
|
/* The host's programs drawn as tools of their own, whose runs read as their own sentences. */
|
|
91
91
|
commandLooks?: readonly CommandLook[];
|
|
92
|
+
/* The host's MCP servers drawn as tools of their own, read the same way. */
|
|
93
|
+
toolLooks?: readonly ToolLook[];
|
|
92
94
|
/* Leaves out the tool lines and their groups, while a settled turn still says how long it worked. */
|
|
93
95
|
hideTools?: boolean;
|
|
94
96
|
}
|
|
@@ -112,17 +114,20 @@ export function isBlock(row: TimelineRow): boolean {
|
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
/*
|
|
115
|
-
* The sentence of a run of
|
|
116
|
-
* else the look's own; null for any other run, which reads as
|
|
117
|
+
* The sentence of a run of calls that are all runs of one look: its group's when they share a key,
|
|
118
|
+
* else the look's own; null for any other run, which reads as its calls.
|
|
117
119
|
*/
|
|
118
|
-
function lookSummary(
|
|
119
|
-
|
|
120
|
+
function lookSummary(
|
|
121
|
+
tools: readonly ChatToolItem[],
|
|
122
|
+
looks: readonly CommandLook[] | undefined,
|
|
123
|
+
toolLooks: readonly ToolLook[] | undefined
|
|
124
|
+
): { look: Look; summary: string } | null {
|
|
125
|
+
let look: Look | null = null;
|
|
120
126
|
let group: { key: string; sentence(count: number): string } | undefined;
|
|
121
127
|
let sameKey = true;
|
|
122
128
|
|
|
123
129
|
for (const tool of tools) {
|
|
124
|
-
const
|
|
125
|
-
const run = command === null ? null : matchCommandLook(command, looks);
|
|
130
|
+
const run = lookRunOf(tool, looks, toolLooks);
|
|
126
131
|
|
|
127
132
|
if (run === null || (look !== null && run.look !== look)) {
|
|
128
133
|
return null;
|
|
@@ -130,8 +135,8 @@ function lookSummary(tools: readonly ChatToolItem[], looks: readonly CommandLook
|
|
|
130
135
|
|
|
131
136
|
if (look === null) {
|
|
132
137
|
look = run.look;
|
|
133
|
-
group = run.
|
|
134
|
-
} else if (run.
|
|
138
|
+
group = run.group;
|
|
139
|
+
} else if (run.group?.key !== group?.key) {
|
|
135
140
|
sameKey = false;
|
|
136
141
|
}
|
|
137
142
|
}
|
|
@@ -148,8 +153,8 @@ function lookSummary(tools: readonly ChatToolItem[], looks: readonly CommandLook
|
|
|
148
153
|
}
|
|
149
154
|
|
|
150
155
|
/* "Read 4 files", "Ran 2 commands", "12 tool calls" when the run mixes kinds, or the sentence of a look all its calls are runs of. */
|
|
151
|
-
export function summarizeGroup(tools: ChatToolItem[], looks?: readonly CommandLook[]): string {
|
|
152
|
-
const looked = lookSummary(tools, looks);
|
|
156
|
+
export function summarizeGroup(tools: ChatToolItem[], looks?: readonly CommandLook[], toolLooks?: readonly ToolLook[]): string {
|
|
157
|
+
const looked = lookSummary(tools, looks, toolLooks);
|
|
153
158
|
|
|
154
159
|
if (looked !== null) {
|
|
155
160
|
return looked.summary;
|
|
@@ -191,7 +196,7 @@ function editedPath(tool: ChatToolItem): string {
|
|
|
191
196
|
* "Searched 2 patterns". Every file change reads as one sentence, and calls without a sentence of
|
|
192
197
|
* their own are counted together at the end.
|
|
193
198
|
*/
|
|
194
|
-
export function summarizeTurn(tools: readonly ChatToolItem[], looks?: readonly CommandLook[]): string[] {
|
|
199
|
+
export function summarizeTurn(tools: readonly ChatToolItem[], looks?: readonly CommandLook[], toolLooks?: readonly ToolLook[]): string[] {
|
|
195
200
|
// Keyed by the sentence, so its place is where the first call of that kind came.
|
|
196
201
|
const counts = new Map<string, { count: number; say(count: number): string }>();
|
|
197
202
|
|
|
@@ -209,18 +214,17 @@ export function summarizeTurn(tools: readonly ChatToolItem[], looks?: readonly C
|
|
|
209
214
|
let other = 0;
|
|
210
215
|
|
|
211
216
|
for (const tool of tools) {
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
const sent = sentMessageOf(tool, looks);
|
|
217
|
+
const run = lookRunOf(tool, looks, toolLooks);
|
|
218
|
+
const group = run?.group;
|
|
219
|
+
const sent = sentMessageOf(tool, looks, toolLooks);
|
|
216
220
|
|
|
217
221
|
if (sent !== null && sent.state !== 'failed') {
|
|
218
222
|
add('agent-chat:group.sent', (count) => i18next.t('agent-chat:group.sent', { count }));
|
|
219
223
|
} else if (sent !== null) {
|
|
220
224
|
other += 1;
|
|
221
225
|
} else if (run !== null && group !== undefined) {
|
|
222
|
-
// Keyed by the
|
|
223
|
-
add(`look:${run.look
|
|
226
|
+
// Keyed by the look too, so two looks with a key in common keep their own sentences.
|
|
227
|
+
add(`look:${lookKey(run.look)}:${group.key}`, group.sentence);
|
|
224
228
|
} else if (failedFileChange(tool)) {
|
|
225
229
|
other += 1;
|
|
226
230
|
} else if (isFileChange(tool.name)) {
|
|
@@ -260,7 +264,15 @@ export function agentTurnLabel(turn: ChatTurnItem): string {
|
|
|
260
264
|
return about(i18next.t('agent-chat:turn.wokenByMessage', { count: turn.messageFrom.length }));
|
|
261
265
|
}
|
|
262
266
|
|
|
263
|
-
|
|
267
|
+
if (!turn.label) {
|
|
268
|
+
return i18next.t('agent-chat:turn.continued');
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// The machine names the subagent row a wake is about; Claude Code also wakes the agent for a command, a monitor or a
|
|
272
|
+
// workflow it ran in the background, which has no such row.
|
|
273
|
+
const key = turn.taskToolUseId === undefined ? 'agent-chat:turn.backgroundFinished' : 'agent-chat:turn.subagentFinished';
|
|
274
|
+
|
|
275
|
+
return i18next.t(key, { label: turn.label });
|
|
264
276
|
}
|
|
265
277
|
|
|
266
278
|
/* The items of the turn tell a turn a person stopped from one the machine ended after a restart. */
|
|
@@ -362,7 +374,7 @@ function flushTools(buffer: ChatToolItem[], rows: TimelineRow[], options: Timeli
|
|
|
362
374
|
const first = tools[0]!;
|
|
363
375
|
const id = `group-${first.id}`;
|
|
364
376
|
const expanded = options.expandedGroups.has(id);
|
|
365
|
-
const looked = lookSummary(tools, options.commandLooks);
|
|
377
|
+
const looked = lookSummary(tools, options.commandLooks, options.toolLooks);
|
|
366
378
|
|
|
367
379
|
rows.push(
|
|
368
380
|
looked === null
|
|
@@ -392,7 +404,7 @@ function rowsForItems(items: ChatItem[], options: TimelineOptions, children: Map
|
|
|
392
404
|
}
|
|
393
405
|
|
|
394
406
|
const report = handbackReportOf(item);
|
|
395
|
-
const sent = item.kind === 'tool' ? sentMessageOf(item, options.commandLooks) : null;
|
|
407
|
+
const sent = item.kind === 'tool' ? sentMessageOf(item, options.commandLooks, options.toolLooks) : null;
|
|
396
408
|
|
|
397
409
|
if (item.kind === 'tool' && sent !== null) {
|
|
398
410
|
flushTools(tools, rows, options);
|
|
@@ -691,13 +703,20 @@ export function deriveTimelineRows(items: ChatItem[], options: TimelineOptions):
|
|
|
691
703
|
const rest = conversation.slice(lastUser + 1);
|
|
692
704
|
const work = rowsForItems(rest, options, children);
|
|
693
705
|
// The closing answer stays visible; the work after the last input folds behind the label.
|
|
694
|
-
|
|
706
|
+
// A turn the machine ended mid-call has no closing answer, but what it last said is still the most a person can read of it.
|
|
707
|
+
const cutShort = turn.state === 'aborted' && abortedByMachine(turn, chunk.items);
|
|
708
|
+
const finalAssistant = lastAssistantRow(work) ?? (cutShort ? (work.findLast((row) => row.kind === 'assistant') ?? null) : null);
|
|
695
709
|
const closing = finalAssistant ? work.indexOf(finalAssistant) : work.length;
|
|
696
710
|
const before = work.slice(0, closing);
|
|
697
711
|
|
|
698
712
|
// Images remain a turn's visible result, and a workflow or a background subagent may still be running after its turn ends.
|
|
713
|
+
// A compaction is never folded away, so a turn that only compacted shows its divider and no fold.
|
|
699
714
|
const standing = before.filter(
|
|
700
|
-
(row) =>
|
|
715
|
+
(row) =>
|
|
716
|
+
isImageRow(row) ||
|
|
717
|
+
row.kind === 'compaction' ||
|
|
718
|
+
(row.kind === 'workflow' && row.tool.state === 'running') ||
|
|
719
|
+
(row.kind === 'subagent' && row.item.status === 'running')
|
|
701
720
|
);
|
|
702
721
|
|
|
703
722
|
const folded = before.length - standing.length;
|
|
@@ -715,7 +734,7 @@ export function deriveTimelineRows(items: ChatItem[], options: TimelineOptions):
|
|
|
715
734
|
id: `fold-${turnId}`,
|
|
716
735
|
turn,
|
|
717
736
|
label: turnLabel(turn, chunk.items),
|
|
718
|
-
work: summarizeTurn(tools, options.commandLooks),
|
|
737
|
+
work: summarizeTurn(tools, options.commandLooks, options.toolLooks),
|
|
719
738
|
hiddenCount: folded,
|
|
720
739
|
expanded,
|
|
721
740
|
expandable
|