@adecore/agents-react 0.52.0 → 0.53.1
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/logic/timeline.js +13 -4
- package/dist/chat/logic/tools.d.ts +5 -0
- package/dist/chat/logic/tools.js +17 -2
- 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/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/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/logic/timeline.ts +18 -3
- package/src/chat/logic/tools.ts +13 -2
- package/src/chat/ui/diff/EditorEditDiff.tsx +31 -5
- package/src/chat/ui/diff/LegacyEditDiff.tsx +5 -3
- package/src/locales/en/agent-chat.ts +1 -0
- package/src/locales/nl/agent-chat.ts +1 -0
package/dist/agents/AgentIcon.js
CHANGED
|
@@ -9,6 +9,11 @@ import { PROVIDER_PATHS } from './provider-paths.js';
|
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const BUILT_IN_MARKS = {
|
|
11
11
|
claude: siClaude,
|
|
12
|
+
'anthropic-claude-api': {
|
|
13
|
+
title: 'Claude API',
|
|
14
|
+
path: PROVIDER_PATHS['anthropic-claude-api'],
|
|
15
|
+
fillRule: 'evenodd'
|
|
16
|
+
},
|
|
12
17
|
codex: {
|
|
13
18
|
title: 'Codex',
|
|
14
19
|
path: PROVIDER_PATHS.codex
|
|
@@ -21,7 +26,7 @@ const BUILT_IN_MARKS = {
|
|
|
21
26
|
copilot: siGithubcopilot
|
|
22
27
|
};
|
|
23
28
|
export function AgentIcon(t0) {
|
|
24
|
-
const $ = _c(
|
|
29
|
+
const $ = _c(16);
|
|
25
30
|
const {
|
|
26
31
|
kind,
|
|
27
32
|
size: t1,
|
|
@@ -63,19 +68,22 @@ export function AgentIcon(t0) {
|
|
|
63
68
|
} else {
|
|
64
69
|
t5 = $[6];
|
|
65
70
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
const t6 = mark.fillRule ?? "nonzero";
|
|
72
|
+
let t7;
|
|
73
|
+
if ($[7] !== mark.path || $[8] !== t6) {
|
|
74
|
+
t7 = /*#__PURE__*/_jsx("path", {
|
|
75
|
+
d: mark.path,
|
|
76
|
+
fillRule: t6
|
|
70
77
|
});
|
|
71
78
|
$[7] = mark.path;
|
|
72
79
|
$[8] = t6;
|
|
80
|
+
$[9] = t7;
|
|
73
81
|
} else {
|
|
74
|
-
|
|
82
|
+
t7 = $[9];
|
|
75
83
|
}
|
|
76
|
-
let
|
|
77
|
-
if ($[
|
|
78
|
-
|
|
84
|
+
let t8;
|
|
85
|
+
if ($[10] !== mark.title || $[11] !== size || $[12] !== t4 || $[13] !== t5 || $[14] !== t7) {
|
|
86
|
+
t8 = /*#__PURE__*/_jsx("svg", {
|
|
79
87
|
role: "img",
|
|
80
88
|
"aria-label": t3,
|
|
81
89
|
viewBox: t4,
|
|
@@ -83,16 +91,16 @@ export function AgentIcon(t0) {
|
|
|
83
91
|
height: size,
|
|
84
92
|
fill: "currentColor",
|
|
85
93
|
className: t5,
|
|
86
|
-
children:
|
|
94
|
+
children: t7
|
|
87
95
|
});
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[13] = t6;
|
|
96
|
+
$[10] = mark.title;
|
|
97
|
+
$[11] = size;
|
|
98
|
+
$[12] = t4;
|
|
99
|
+
$[13] = t5;
|
|
93
100
|
$[14] = t7;
|
|
101
|
+
$[15] = t8;
|
|
94
102
|
} else {
|
|
95
|
-
|
|
103
|
+
t8 = $[15];
|
|
96
104
|
}
|
|
97
|
-
return
|
|
105
|
+
return t8;
|
|
98
106
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { PROVIDER_PATHS } from './provider-paths.js';
|
|
3
|
+
import { PROVIDER_PATHS, providerFillRule } from './provider-paths.js';
|
|
4
4
|
/* The 24 by 24 box both marks are drawn in, so one size renders them at the same weight. */
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
const VIEW_BOX = '0 0 24 24';
|
|
7
7
|
export function ProviderLogo(t0) {
|
|
8
|
-
const $ = _c(
|
|
8
|
+
const $ = _c(11);
|
|
9
9
|
const {
|
|
10
10
|
provider,
|
|
11
11
|
size: t1,
|
|
@@ -22,32 +22,42 @@ export function ProviderLogo(t0) {
|
|
|
22
22
|
}
|
|
23
23
|
const t3 = PROVIDER_PATHS[provider];
|
|
24
24
|
let t4;
|
|
25
|
-
if ($[2] !==
|
|
26
|
-
t4 =
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
$[2] = t3;
|
|
25
|
+
if ($[2] !== provider) {
|
|
26
|
+
t4 = providerFillRule(provider);
|
|
27
|
+
$[2] = provider;
|
|
30
28
|
$[3] = t4;
|
|
31
29
|
} else {
|
|
32
30
|
t4 = $[3];
|
|
33
31
|
}
|
|
34
32
|
let t5;
|
|
35
|
-
if ($[4] !==
|
|
36
|
-
t5 = /*#__PURE__*/_jsx("
|
|
33
|
+
if ($[4] !== t3 || $[5] !== t4) {
|
|
34
|
+
t5 = /*#__PURE__*/_jsx("path", {
|
|
35
|
+
d: t3,
|
|
36
|
+
fillRule: t4
|
|
37
|
+
});
|
|
38
|
+
$[4] = t3;
|
|
39
|
+
$[5] = t4;
|
|
40
|
+
$[6] = t5;
|
|
41
|
+
} else {
|
|
42
|
+
t5 = $[6];
|
|
43
|
+
}
|
|
44
|
+
let t6;
|
|
45
|
+
if ($[7] !== size || $[8] !== t2 || $[9] !== t5) {
|
|
46
|
+
t6 = /*#__PURE__*/_jsx("svg", {
|
|
37
47
|
"aria-hidden": true,
|
|
38
48
|
viewBox: VIEW_BOX,
|
|
39
49
|
width: size,
|
|
40
50
|
height: size,
|
|
41
51
|
fill: "currentColor",
|
|
42
52
|
className: t2,
|
|
43
|
-
children:
|
|
53
|
+
children: t5
|
|
44
54
|
});
|
|
45
|
-
$[
|
|
46
|
-
$[
|
|
47
|
-
$[
|
|
48
|
-
$[
|
|
55
|
+
$[7] = size;
|
|
56
|
+
$[8] = t2;
|
|
57
|
+
$[9] = t5;
|
|
58
|
+
$[10] = t6;
|
|
49
59
|
} else {
|
|
50
|
-
|
|
60
|
+
t6 = $[10];
|
|
51
61
|
}
|
|
52
|
-
return
|
|
62
|
+
return t6;
|
|
53
63
|
}
|
|
@@ -3,6 +3,7 @@ export interface AgentMark {
|
|
|
3
3
|
title: string;
|
|
4
4
|
path: string;
|
|
5
5
|
viewBox?: string;
|
|
6
|
+
fillRule?: 'nonzero' | 'evenodd';
|
|
6
7
|
}
|
|
7
8
|
export declare function configureAgentMarks(marks: Readonly<Partial<Record<AgentKind, AgentMark>>>): void;
|
|
8
9
|
export declare function hostAgentMark(kind: AgentKind): AgentMark | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { AgentKind, UsageProvider } from '@adecore/agent-contracts';
|
|
2
2
|
export declare const PROVIDER_PATHS: Record<UsageProvider, string>;
|
|
3
|
-
export declare function hasProviderLogo(kind: AgentKind): kind is 'claude' | 'codex';
|
|
3
|
+
export declare function hasProviderLogo(kind: AgentKind): kind is 'claude' | 'codex' | 'anthropic-claude-api';
|
|
4
|
+
export declare function providerFillRule(provider: UsageProvider): 'evenodd' | 'nonzero';
|
|
@@ -4,9 +4,14 @@ import { siGithubcopilot } from 'simple-icons';
|
|
|
4
4
|
* in `currentColor`, so a row decides how loud the logo is.
|
|
5
5
|
*/
|
|
6
6
|
const CLAUDE_PATH = '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';
|
|
7
|
+
/*
|
|
8
|
+
* Claude Code on an API key: the Claude mark with its lower part cut away, over a label with "API" knocked out of it.
|
|
9
|
+
* Plain lines and curves, no text, so another platform can copy the `d` as it is. Its holes need the even-odd rule.
|
|
10
|
+
*/
|
|
11
|
+
const CLAUDE_API_PATH = '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';
|
|
7
12
|
export const PROVIDER_PATHS = {
|
|
8
13
|
claude: CLAUDE_PATH,
|
|
9
|
-
'anthropic-claude-api':
|
|
14
|
+
'anthropic-claude-api': CLAUDE_API_PATH,
|
|
10
15
|
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',
|
|
11
16
|
nanogpt: 'M5 20V4h2.6l8.8 11.2V4H19v16h-2.6L7.6 8.8V20z',
|
|
12
17
|
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',
|
|
@@ -14,5 +19,9 @@ export const PROVIDER_PATHS = {
|
|
|
14
19
|
};
|
|
15
20
|
/* The CLIs drawn with the logo of the usage page rather than their agent mark. */
|
|
16
21
|
export function hasProviderLogo(kind) {
|
|
17
|
-
return kind === 'claude' || kind === 'codex';
|
|
22
|
+
return kind === 'claude' || kind === 'codex' || kind === 'anthropic-claude-api';
|
|
23
|
+
}
|
|
24
|
+
/* The marks whose holes are subpaths inside the shape, which the default nonzero rule would fill. */
|
|
25
|
+
export function providerFillRule(provider) {
|
|
26
|
+
return provider === 'anthropic-claude-api' ? 'evenodd' : 'nonzero';
|
|
18
27
|
}
|
|
@@ -174,9 +174,15 @@ export function agentTurnLabel(turn) {
|
|
|
174
174
|
count: turn.messageFrom.length
|
|
175
175
|
}));
|
|
176
176
|
}
|
|
177
|
-
|
|
177
|
+
if (!turn.label) {
|
|
178
|
+
return i18next.t('agent-chat:turn.continued');
|
|
179
|
+
}
|
|
180
|
+
// The machine names the subagent row a wake is about; Claude Code also wakes the agent for a command, a monitor or a
|
|
181
|
+
// workflow it ran in the background, which has no such row.
|
|
182
|
+
const key = turn.taskToolUseId === undefined ? 'agent-chat:turn.backgroundFinished' : 'agent-chat:turn.subagentFinished';
|
|
183
|
+
return i18next.t(key, {
|
|
178
184
|
label: turn.label
|
|
179
|
-
})
|
|
185
|
+
});
|
|
180
186
|
}
|
|
181
187
|
/* The items of the turn tell a turn a person stopped from one the machine ended after a restart. */
|
|
182
188
|
export function turnLabel(turn, items = []) {
|
|
@@ -603,11 +609,14 @@ export function deriveTimelineRows(items, options) {
|
|
|
603
609
|
const rest = conversation.slice(lastUser + 1);
|
|
604
610
|
const work = rowsForItems(rest, options, children);
|
|
605
611
|
// The closing answer stays visible; the work after the last input folds behind the label.
|
|
606
|
-
|
|
612
|
+
// 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.
|
|
613
|
+
const cutShort = turn.state === 'aborted' && abortedByMachine(turn, chunk.items);
|
|
614
|
+
const finalAssistant = lastAssistantRow(work) ?? (cutShort ? work.findLast(row => row.kind === 'assistant') ?? null : null);
|
|
607
615
|
const closing = finalAssistant ? work.indexOf(finalAssistant) : work.length;
|
|
608
616
|
const before = work.slice(0, closing);
|
|
609
617
|
// Images remain a turn's visible result, and a workflow or a background subagent may still be running after its turn ends.
|
|
610
|
-
|
|
618
|
+
// A compaction is never folded away, so a turn that only compacted shows its divider and no fold.
|
|
619
|
+
const standing = before.filter(row => isImageRow(row) || row.kind === 'compaction' || row.kind === 'workflow' && row.tool.state === 'running' || row.kind === 'subagent' && row.item.status === 'running');
|
|
611
620
|
const folded = before.length - standing.length;
|
|
612
621
|
// With the tool lines left out, a turn that only ran tools has nothing behind its fold to open.
|
|
613
622
|
const expandable = shownRows(before, options).some(row => !standing.includes(row));
|
|
@@ -3,7 +3,12 @@ export interface FileChange {
|
|
|
3
3
|
path: string;
|
|
4
4
|
before: string;
|
|
5
5
|
after: string;
|
|
6
|
+
fragment?: boolean;
|
|
6
7
|
}
|
|
8
|
+
export declare function diffTexts(change: FileChange): {
|
|
9
|
+
before: string;
|
|
10
|
+
after: string;
|
|
11
|
+
};
|
|
7
12
|
export declare function toolSummary(name: string, input: unknown): string;
|
|
8
13
|
export declare function toolSummaryIsPath(name: string, input: unknown): boolean;
|
|
9
14
|
export declare function shellCommand(name: string, input: unknown): string | null;
|
package/dist/chat/logic/tools.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { isRecord } from './json.js';
|
|
2
2
|
import { toolEntry } from './tool-catalog.js';
|
|
3
|
+
/* The texts a diff draws: a fragment ends where its edit does, not where its file ends, so it gets no "no final newline" mark. */
|
|
4
|
+
export function diffTexts(change) {
|
|
5
|
+
if (change.fragment !== true || change.before.endsWith('\n') || change.after.endsWith('\n')) {
|
|
6
|
+
return {
|
|
7
|
+
before: change.before,
|
|
8
|
+
after: change.after
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
before: `${change.before}\n`,
|
|
13
|
+
after: `${change.after}\n`
|
|
14
|
+
};
|
|
15
|
+
}
|
|
3
16
|
function str(value) {
|
|
4
17
|
return typeof value === 'string' ? value : null;
|
|
5
18
|
}
|
|
@@ -115,7 +128,8 @@ export function fileChanges(name, input) {
|
|
|
115
128
|
return [{
|
|
116
129
|
path,
|
|
117
130
|
before: str(input.old_string) ?? '',
|
|
118
|
-
after: str(input.new_string) ?? ''
|
|
131
|
+
after: str(input.new_string) ?? '',
|
|
132
|
+
fragment: true
|
|
119
133
|
}];
|
|
120
134
|
}
|
|
121
135
|
if (name === 'Write') {
|
|
@@ -129,7 +143,8 @@ export function fileChanges(name, input) {
|
|
|
129
143
|
return input.edits.filter(isRecord).map(edit => ({
|
|
130
144
|
path,
|
|
131
145
|
before: str(edit.old_string) ?? '',
|
|
132
|
-
after: str(edit.new_string) ?? ''
|
|
146
|
+
after: str(edit.new_string) ?? '',
|
|
147
|
+
fragment: true
|
|
133
148
|
}));
|
|
134
149
|
}
|
|
135
150
|
return [];
|
|
@@ -2,9 +2,9 @@ import { type ReactNode } from 'react';
|
|
|
2
2
|
import type { EditorEngine } from '@adecore/editor';
|
|
3
3
|
import { type DiffSource } from '@adecore/editor-react';
|
|
4
4
|
import { type DiffDocument } from '@adecore/merge';
|
|
5
|
-
import type
|
|
5
|
+
import { type FileChange } from '../../logic/tools.js';
|
|
6
6
|
type EngineLoader = () => Promise<EditorEngine>;
|
|
7
|
-
export declare function EditorDocumentDiff({ document, path, loadEngine, fallback, wrap, fill, layout, maxHeight, onSource }: {
|
|
7
|
+
export declare function EditorDocumentDiff({ document, path, loadEngine, fallback, wrap, fill, layout, maxHeight, numbered, onSource }: {
|
|
8
8
|
document: DiffDocument;
|
|
9
9
|
path: string;
|
|
10
10
|
loadEngine: EngineLoader;
|
|
@@ -13,6 +13,7 @@ export declare function EditorDocumentDiff({ document, path, loadEngine, fallbac
|
|
|
13
13
|
fill?: boolean;
|
|
14
14
|
layout?: 'unified' | 'split';
|
|
15
15
|
maxHeight?: number;
|
|
16
|
+
numbered?: boolean;
|
|
16
17
|
onSource?(source: DiffSource): void | (() => void);
|
|
17
18
|
}): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
18
19
|
export default function EditorEditDiff({ change, loadEngine, fallback, maxHeight, sourceChecked }: {
|
|
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
5
5
|
import { getFiletypeFromFileName } from '@pierre/diffs';
|
|
6
6
|
import { DiffView } from '@adecore/editor-react';
|
|
7
7
|
import { diffDocument, patchOf } from '@adecore/merge';
|
|
8
|
+
import { diffTexts } from '../../logic/tools.js';
|
|
8
9
|
import { useDiffSourceTokens } from '../use-diff-source-tokens.js';
|
|
9
10
|
import { diffSourceBudget } from './diff-source-budget.js';
|
|
10
11
|
import { DiffOmitted } from './DiffOmitted.js';
|
|
@@ -14,7 +15,7 @@ import { useHostCodeMode, useHostCodeThemes } from '../../../host-hooks.js';
|
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
const engines = new WeakMap();
|
|
16
17
|
function ReadyDiff(t0) {
|
|
17
|
-
const $ = _c(
|
|
18
|
+
const $ = _c(17);
|
|
18
19
|
const {
|
|
19
20
|
document,
|
|
20
21
|
path,
|
|
@@ -23,6 +24,7 @@ function ReadyDiff(t0) {
|
|
|
23
24
|
fill,
|
|
24
25
|
layout,
|
|
25
26
|
maxHeight,
|
|
27
|
+
numbered,
|
|
26
28
|
onSource
|
|
27
29
|
} = t0;
|
|
28
30
|
useReviewSettled();
|
|
@@ -53,7 +55,7 @@ function ReadyDiff(t0) {
|
|
|
53
55
|
t2 = $[4];
|
|
54
56
|
}
|
|
55
57
|
let t3;
|
|
56
|
-
if ($[5] !== document || $[6] !== engine || $[7] !== fill || $[8] !== layout || $[9] !== maxHeight || $[10] !==
|
|
58
|
+
if ($[5] !== document || $[6] !== engine || $[7] !== fill || $[8] !== layout || $[9] !== maxHeight || $[10] !== numbered || $[11] !== onSource || $[12] !== t2 || $[13] !== theme || $[14] !== tokens || $[15] !== wrap) {
|
|
57
59
|
t3 = /*#__PURE__*/_jsx(DiffView, {
|
|
58
60
|
engine: engine,
|
|
59
61
|
document: document,
|
|
@@ -65,6 +67,7 @@ function ReadyDiff(t0) {
|
|
|
65
67
|
layout: layout,
|
|
66
68
|
wrap: wrap,
|
|
67
69
|
fill: fill,
|
|
70
|
+
numbered: numbered,
|
|
68
71
|
className: "chat-diff select-text",
|
|
69
72
|
onSource: onSource
|
|
70
73
|
});
|
|
@@ -73,19 +76,20 @@ function ReadyDiff(t0) {
|
|
|
73
76
|
$[7] = fill;
|
|
74
77
|
$[8] = layout;
|
|
75
78
|
$[9] = maxHeight;
|
|
76
|
-
$[10] =
|
|
77
|
-
$[11] =
|
|
78
|
-
$[12] =
|
|
79
|
-
$[13] =
|
|
80
|
-
$[14] =
|
|
81
|
-
$[15] =
|
|
79
|
+
$[10] = numbered;
|
|
80
|
+
$[11] = onSource;
|
|
81
|
+
$[12] = t2;
|
|
82
|
+
$[13] = theme;
|
|
83
|
+
$[14] = tokens;
|
|
84
|
+
$[15] = wrap;
|
|
85
|
+
$[16] = t3;
|
|
82
86
|
} else {
|
|
83
|
-
t3 = $[
|
|
87
|
+
t3 = $[16];
|
|
84
88
|
}
|
|
85
89
|
return t3;
|
|
86
90
|
}
|
|
87
91
|
export function EditorDocumentDiff(t0) {
|
|
88
|
-
const $ = _c(
|
|
92
|
+
const $ = _c(26);
|
|
89
93
|
const {
|
|
90
94
|
document,
|
|
91
95
|
path,
|
|
@@ -95,29 +99,31 @@ export function EditorDocumentDiff(t0) {
|
|
|
95
99
|
fill: t2,
|
|
96
100
|
layout: t3,
|
|
97
101
|
maxHeight: t4,
|
|
102
|
+
numbered: t5,
|
|
98
103
|
onSource
|
|
99
104
|
} = t0;
|
|
100
105
|
const wrap = t1 === undefined ? true : t1;
|
|
101
106
|
const fill = t2 === undefined ? false : t2;
|
|
102
107
|
const layout = t3 === undefined ? "unified" : t3;
|
|
103
108
|
const maxHeight = t4 === undefined ? 480 : t4;
|
|
109
|
+
const numbered = t5 === undefined ? true : t5;
|
|
104
110
|
const {
|
|
105
111
|
t
|
|
106
112
|
} = useTranslation("agent-chat");
|
|
107
|
-
let
|
|
113
|
+
let t6;
|
|
108
114
|
if ($[0] !== document) {
|
|
109
|
-
|
|
115
|
+
t6 = canRenderEditorDiff(document);
|
|
110
116
|
$[0] = document;
|
|
111
|
-
$[1] =
|
|
117
|
+
$[1] = t6;
|
|
112
118
|
} else {
|
|
113
|
-
|
|
119
|
+
t6 = $[1];
|
|
114
120
|
}
|
|
115
|
-
const withinLimits =
|
|
121
|
+
const withinLimits = t6;
|
|
116
122
|
const [loaded, setLoaded] = useState();
|
|
117
|
-
let t6;
|
|
118
123
|
let t7;
|
|
124
|
+
let t8;
|
|
119
125
|
if ($[2] !== loadEngine || $[3] !== withinLimits) {
|
|
120
|
-
|
|
126
|
+
t7 = () => {
|
|
121
127
|
if (!withinLimits || engines.has(loadEngine)) {
|
|
122
128
|
return;
|
|
123
129
|
}
|
|
@@ -143,64 +149,64 @@ export function EditorDocumentDiff(t0) {
|
|
|
143
149
|
active = false;
|
|
144
150
|
};
|
|
145
151
|
};
|
|
146
|
-
|
|
152
|
+
t8 = [loadEngine, withinLimits];
|
|
147
153
|
$[2] = loadEngine;
|
|
148
154
|
$[3] = withinLimits;
|
|
149
|
-
$[4] =
|
|
150
|
-
$[5] =
|
|
155
|
+
$[4] = t7;
|
|
156
|
+
$[5] = t8;
|
|
151
157
|
} else {
|
|
152
|
-
|
|
153
|
-
|
|
158
|
+
t7 = $[4];
|
|
159
|
+
t8 = $[5];
|
|
154
160
|
}
|
|
155
|
-
useEffect(
|
|
156
|
-
let
|
|
161
|
+
useEffect(t7, t8);
|
|
162
|
+
let t9;
|
|
157
163
|
if ($[6] !== loadEngine || $[7] !== loaded) {
|
|
158
|
-
|
|
164
|
+
t9 = loaded?.load === loadEngine ? loaded.engine : engines.get(loadEngine);
|
|
159
165
|
$[6] = loadEngine;
|
|
160
166
|
$[7] = loaded;
|
|
161
|
-
$[8] =
|
|
167
|
+
$[8] = t9;
|
|
162
168
|
} else {
|
|
163
|
-
|
|
169
|
+
t9 = $[8];
|
|
164
170
|
}
|
|
165
|
-
const engine_0 =
|
|
171
|
+
const engine_0 = t9;
|
|
166
172
|
if (!withinLimits) {
|
|
167
|
-
let
|
|
173
|
+
let t10;
|
|
168
174
|
if ($[9] !== path) {
|
|
169
|
-
|
|
175
|
+
t10 = /*#__PURE__*/_jsx(DiffOmitted, {
|
|
170
176
|
path: path
|
|
171
177
|
});
|
|
172
178
|
$[9] = path;
|
|
173
|
-
$[10] =
|
|
179
|
+
$[10] = t10;
|
|
174
180
|
} else {
|
|
175
|
-
|
|
181
|
+
t10 = $[10];
|
|
176
182
|
}
|
|
177
|
-
return
|
|
183
|
+
return t10;
|
|
178
184
|
}
|
|
179
185
|
if (engine_0 === undefined) {
|
|
180
|
-
let
|
|
186
|
+
let t10;
|
|
181
187
|
if ($[11] !== t) {
|
|
182
|
-
|
|
188
|
+
t10 = t("work.loadingDiff");
|
|
183
189
|
$[11] = t;
|
|
184
|
-
$[12] =
|
|
190
|
+
$[12] = t10;
|
|
185
191
|
} else {
|
|
186
|
-
|
|
192
|
+
t10 = $[12];
|
|
187
193
|
}
|
|
188
|
-
let
|
|
189
|
-
if ($[13] !==
|
|
190
|
-
|
|
194
|
+
let t11;
|
|
195
|
+
if ($[13] !== t10) {
|
|
196
|
+
t11 = /*#__PURE__*/_jsx("div", {
|
|
191
197
|
className: "px-3 py-2 text-xs text-text-faint",
|
|
192
|
-
children:
|
|
198
|
+
children: t10
|
|
193
199
|
});
|
|
194
|
-
$[13] =
|
|
195
|
-
$[14] =
|
|
200
|
+
$[13] = t10;
|
|
201
|
+
$[14] = t11;
|
|
196
202
|
} else {
|
|
197
|
-
|
|
203
|
+
t11 = $[14];
|
|
198
204
|
}
|
|
199
|
-
return
|
|
205
|
+
return t11;
|
|
200
206
|
}
|
|
201
|
-
let
|
|
202
|
-
if ($[15] !== document || $[16] !== engine_0 || $[17] !== fallback || $[18] !== fill || $[19] !== layout || $[20] !== maxHeight || $[21] !==
|
|
203
|
-
|
|
207
|
+
let t10;
|
|
208
|
+
if ($[15] !== document || $[16] !== engine_0 || $[17] !== fallback || $[18] !== fill || $[19] !== layout || $[20] !== maxHeight || $[21] !== numbered || $[22] !== onSource || $[23] !== path || $[24] !== wrap) {
|
|
209
|
+
t10 = engine_0 === null ? fallback : /*#__PURE__*/_jsx(ReadyDiff, {
|
|
204
210
|
document: document,
|
|
205
211
|
path: path,
|
|
206
212
|
engine: engine_0,
|
|
@@ -208,6 +214,7 @@ export function EditorDocumentDiff(t0) {
|
|
|
208
214
|
fill: fill,
|
|
209
215
|
layout: layout,
|
|
210
216
|
maxHeight: maxHeight,
|
|
217
|
+
numbered: numbered,
|
|
211
218
|
onSource: onSource
|
|
212
219
|
});
|
|
213
220
|
$[15] = document;
|
|
@@ -216,14 +223,15 @@ export function EditorDocumentDiff(t0) {
|
|
|
216
223
|
$[18] = fill;
|
|
217
224
|
$[19] = layout;
|
|
218
225
|
$[20] = maxHeight;
|
|
219
|
-
$[21] =
|
|
220
|
-
$[22] =
|
|
221
|
-
$[23] =
|
|
222
|
-
$[24] =
|
|
226
|
+
$[21] = numbered;
|
|
227
|
+
$[22] = onSource;
|
|
228
|
+
$[23] = path;
|
|
229
|
+
$[24] = wrap;
|
|
230
|
+
$[25] = t10;
|
|
223
231
|
} else {
|
|
224
|
-
|
|
232
|
+
t10 = $[25];
|
|
225
233
|
}
|
|
226
|
-
return
|
|
234
|
+
return t10;
|
|
227
235
|
}
|
|
228
236
|
export default function EditorEditDiff(t0) {
|
|
229
237
|
const $ = _c(12);
|
|
@@ -236,51 +244,57 @@ export default function EditorEditDiff(t0) {
|
|
|
236
244
|
} = t0;
|
|
237
245
|
const sourceChecked = t1 === undefined ? false : t1;
|
|
238
246
|
let t2;
|
|
239
|
-
if ($[0] !== change
|
|
240
|
-
|
|
247
|
+
if ($[0] !== change || $[1] !== sourceChecked) {
|
|
248
|
+
const {
|
|
249
|
+
before,
|
|
250
|
+
after
|
|
251
|
+
} = diffTexts(change);
|
|
252
|
+
t2 = sourceChecked || diffSourceBudget(before, after) ? diffDocument(patchOf(before, after, 3, {
|
|
241
253
|
maxWork: EDITOR_DIFF_WORK
|
|
242
254
|
}), {
|
|
243
|
-
old:
|
|
244
|
-
new:
|
|
255
|
+
old: before,
|
|
256
|
+
new: after
|
|
245
257
|
}) : undefined;
|
|
246
|
-
$[0] = change
|
|
247
|
-
$[1] =
|
|
248
|
-
$[2] =
|
|
249
|
-
$[3] = t2;
|
|
258
|
+
$[0] = change;
|
|
259
|
+
$[1] = sourceChecked;
|
|
260
|
+
$[2] = t2;
|
|
250
261
|
} else {
|
|
251
|
-
t2 = $[
|
|
262
|
+
t2 = $[2];
|
|
252
263
|
}
|
|
253
264
|
const document = t2;
|
|
254
265
|
if (document === undefined) {
|
|
255
266
|
let t3;
|
|
256
|
-
if ($[
|
|
267
|
+
if ($[3] !== change.path) {
|
|
257
268
|
t3 = /*#__PURE__*/_jsx(DiffOmitted, {
|
|
258
269
|
path: change.path
|
|
259
270
|
});
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
271
|
+
$[3] = change.path;
|
|
272
|
+
$[4] = t3;
|
|
262
273
|
} else {
|
|
263
|
-
t3 = $[
|
|
274
|
+
t3 = $[4];
|
|
264
275
|
}
|
|
265
276
|
return t3;
|
|
266
277
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
278
|
+
const t3 = change.fragment !== true;
|
|
279
|
+
let t4;
|
|
280
|
+
if ($[5] !== change.path || $[6] !== document || $[7] !== fallback || $[8] !== loadEngine || $[9] !== maxHeight || $[10] !== t3) {
|
|
281
|
+
t4 = /*#__PURE__*/_jsx(EditorDocumentDiff, {
|
|
270
282
|
document: document,
|
|
271
283
|
path: change.path,
|
|
272
284
|
loadEngine: loadEngine,
|
|
273
285
|
fallback: fallback,
|
|
274
|
-
maxHeight: maxHeight
|
|
286
|
+
maxHeight: maxHeight,
|
|
287
|
+
numbered: t3
|
|
275
288
|
});
|
|
276
|
-
$[
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
289
|
+
$[5] = change.path;
|
|
290
|
+
$[6] = document;
|
|
291
|
+
$[7] = fallback;
|
|
292
|
+
$[8] = loadEngine;
|
|
293
|
+
$[9] = maxHeight;
|
|
294
|
+
$[10] = t3;
|
|
295
|
+
$[11] = t4;
|
|
282
296
|
} else {
|
|
283
|
-
|
|
297
|
+
t4 = $[11];
|
|
284
298
|
}
|
|
285
|
-
return
|
|
299
|
+
return t4;
|
|
286
300
|
}
|
|
@@ -3,10 +3,11 @@ import { LegacyDiffPool } from './LegacyDiffPool.js';
|
|
|
3
3
|
import { useReviewSettled } from './review-settle.js';
|
|
4
4
|
import { MultiFileDiff } from '@pierre/diffs/react';
|
|
5
5
|
import { useDiffTheme } from '../diff-theme.js';
|
|
6
|
+
import { diffTexts } from '../../logic/tools.js';
|
|
6
7
|
import { useHostCodeMode } from '../../../host-hooks.js';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
export default function LegacyEditDiff(t0) {
|
|
9
|
-
const $ = _c(
|
|
10
|
+
const $ = _c(21);
|
|
10
11
|
const {
|
|
11
12
|
change,
|
|
12
13
|
maxHeight
|
|
@@ -15,87 +16,102 @@ export default function LegacyEditDiff(t0) {
|
|
|
15
16
|
const resolved = useHostCodeMode();
|
|
16
17
|
const theme = useDiffTheme();
|
|
17
18
|
let t1;
|
|
18
|
-
if ($[0] !== change
|
|
19
|
-
t1 =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
$[0] = change.before;
|
|
24
|
-
$[1] = change.path;
|
|
25
|
-
$[2] = t1;
|
|
19
|
+
if ($[0] !== change) {
|
|
20
|
+
t1 = diffTexts(change);
|
|
21
|
+
$[0] = change;
|
|
22
|
+
$[1] = t1;
|
|
26
23
|
} else {
|
|
27
|
-
t1 = $[
|
|
24
|
+
t1 = $[1];
|
|
28
25
|
}
|
|
29
|
-
const
|
|
26
|
+
const {
|
|
27
|
+
before,
|
|
28
|
+
after
|
|
29
|
+
} = t1;
|
|
30
30
|
let t2;
|
|
31
|
-
if ($[
|
|
31
|
+
if ($[2] !== before || $[3] !== change.path) {
|
|
32
32
|
t2 = {
|
|
33
33
|
name: change.path,
|
|
34
|
-
contents:
|
|
34
|
+
contents: before
|
|
35
35
|
};
|
|
36
|
-
$[
|
|
37
|
-
$[
|
|
38
|
-
$[
|
|
36
|
+
$[2] = before;
|
|
37
|
+
$[3] = change.path;
|
|
38
|
+
$[4] = t2;
|
|
39
39
|
} else {
|
|
40
|
-
t2 = $[
|
|
40
|
+
t2 = $[4];
|
|
41
41
|
}
|
|
42
|
-
const
|
|
42
|
+
const oldFile = t2;
|
|
43
43
|
let t3;
|
|
44
|
-
if ($[
|
|
44
|
+
if ($[5] !== after || $[6] !== change.path) {
|
|
45
45
|
t3 = {
|
|
46
|
+
name: change.path,
|
|
47
|
+
contents: after
|
|
48
|
+
};
|
|
49
|
+
$[5] = after;
|
|
50
|
+
$[6] = change.path;
|
|
51
|
+
$[7] = t3;
|
|
52
|
+
} else {
|
|
53
|
+
t3 = $[7];
|
|
54
|
+
}
|
|
55
|
+
const newFile = t3;
|
|
56
|
+
const t4 = change.fragment === true;
|
|
57
|
+
let t5;
|
|
58
|
+
if ($[8] !== resolved || $[9] !== t4 || $[10] !== theme) {
|
|
59
|
+
t5 = {
|
|
46
60
|
diffStyle: "unified",
|
|
47
61
|
theme,
|
|
48
62
|
themeType: resolved,
|
|
49
63
|
disableFileHeader: true,
|
|
64
|
+
disableLineNumbers: t4,
|
|
50
65
|
overflow: "wrap",
|
|
51
66
|
hunkSeparators: "simple"
|
|
52
67
|
};
|
|
53
|
-
$[
|
|
54
|
-
$[
|
|
55
|
-
$[
|
|
68
|
+
$[8] = resolved;
|
|
69
|
+
$[9] = t4;
|
|
70
|
+
$[10] = theme;
|
|
71
|
+
$[11] = t5;
|
|
56
72
|
} else {
|
|
57
|
-
|
|
73
|
+
t5 = $[11];
|
|
58
74
|
}
|
|
59
|
-
const options =
|
|
60
|
-
let
|
|
61
|
-
if ($[
|
|
62
|
-
|
|
75
|
+
const options = t5;
|
|
76
|
+
let t6;
|
|
77
|
+
if ($[12] !== maxHeight) {
|
|
78
|
+
t6 = maxHeight === undefined ? undefined : {
|
|
63
79
|
maxHeight,
|
|
64
80
|
overflow: "auto"
|
|
65
81
|
};
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
82
|
+
$[12] = maxHeight;
|
|
83
|
+
$[13] = t6;
|
|
68
84
|
} else {
|
|
69
|
-
|
|
85
|
+
t6 = $[13];
|
|
70
86
|
}
|
|
71
|
-
let
|
|
72
|
-
if ($[
|
|
73
|
-
|
|
87
|
+
let t7;
|
|
88
|
+
if ($[14] !== newFile || $[15] !== oldFile || $[16] !== options) {
|
|
89
|
+
t7 = /*#__PURE__*/_jsx(LegacyDiffPool, {
|
|
74
90
|
children: /*#__PURE__*/_jsx(MultiFileDiff, {
|
|
75
91
|
oldFile: oldFile,
|
|
76
92
|
newFile: newFile,
|
|
77
93
|
options: options
|
|
78
94
|
})
|
|
79
95
|
});
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
96
|
+
$[14] = newFile;
|
|
97
|
+
$[15] = oldFile;
|
|
98
|
+
$[16] = options;
|
|
99
|
+
$[17] = t7;
|
|
84
100
|
} else {
|
|
85
|
-
|
|
101
|
+
t7 = $[17];
|
|
86
102
|
}
|
|
87
|
-
let
|
|
88
|
-
if ($[
|
|
89
|
-
|
|
103
|
+
let t8;
|
|
104
|
+
if ($[18] !== t6 || $[19] !== t7) {
|
|
105
|
+
t8 = /*#__PURE__*/_jsx("div", {
|
|
90
106
|
className: "chat-diff select-text",
|
|
91
|
-
style:
|
|
92
|
-
children:
|
|
107
|
+
style: t6,
|
|
108
|
+
children: t7
|
|
93
109
|
});
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
110
|
+
$[18] = t6;
|
|
111
|
+
$[19] = t7;
|
|
112
|
+
$[20] = t8;
|
|
97
113
|
} else {
|
|
98
|
-
|
|
114
|
+
t8 = $[20];
|
|
99
115
|
}
|
|
100
|
-
return
|
|
116
|
+
return t8;
|
|
101
117
|
}
|
|
@@ -320,6 +320,7 @@ export default {
|
|
|
320
320
|
wokenByMessage_one: 'Woken by a message',
|
|
321
321
|
wokenByMessage_other: 'Woken by {{count}} messages',
|
|
322
322
|
subagentFinished: 'Sub-agent finished: {{label}}',
|
|
323
|
+
backgroundFinished: 'Background task finished: {{label}}',
|
|
323
324
|
continued: 'Continued on its own',
|
|
324
325
|
stopped: 'Stopped after {{duration}}',
|
|
325
326
|
youStopped: 'You stopped after {{duration}}',
|
|
@@ -320,6 +320,7 @@ export default {
|
|
|
320
320
|
wokenByMessage_one: 'Gewekt door een bericht',
|
|
321
321
|
wokenByMessage_other: 'Gewekt door {{count}} berichten',
|
|
322
322
|
subagentFinished: 'Sub-agent klaar: {{label}}',
|
|
323
|
+
backgroundFinished: 'Achtergrondtaak klaar: {{label}}',
|
|
323
324
|
continued: 'Zelf verdergegaan',
|
|
324
325
|
stopped: 'Gestopt na {{duration}}',
|
|
325
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.1",
|
|
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.1",
|
|
76
|
+
"@adecore/editor": "0.53.1",
|
|
77
|
+
"@adecore/editor-react": "0.53.1",
|
|
78
|
+
"@adecore/intelligent-ui": "0.53.1",
|
|
79
|
+
"@adecore/merge": "0.53.1",
|
|
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.1",
|
|
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.1",
|
|
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
|
}
|
|
@@ -264,7 +264,15 @@ export function agentTurnLabel(turn: ChatTurnItem): string {
|
|
|
264
264
|
return about(i18next.t('agent-chat:turn.wokenByMessage', { count: turn.messageFrom.length }));
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
|
|
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 });
|
|
268
276
|
}
|
|
269
277
|
|
|
270
278
|
/* The items of the turn tell a turn a person stopped from one the machine ended after a restart. */
|
|
@@ -695,13 +703,20 @@ export function deriveTimelineRows(items: ChatItem[], options: TimelineOptions):
|
|
|
695
703
|
const rest = conversation.slice(lastUser + 1);
|
|
696
704
|
const work = rowsForItems(rest, options, children);
|
|
697
705
|
// The closing answer stays visible; the work after the last input folds behind the label.
|
|
698
|
-
|
|
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);
|
|
699
709
|
const closing = finalAssistant ? work.indexOf(finalAssistant) : work.length;
|
|
700
710
|
const before = work.slice(0, closing);
|
|
701
711
|
|
|
702
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.
|
|
703
714
|
const standing = before.filter(
|
|
704
|
-
(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')
|
|
705
720
|
);
|
|
706
721
|
|
|
707
722
|
const folded = before.length - standing.length;
|
package/src/chat/logic/tools.ts
CHANGED
|
@@ -6,6 +6,17 @@ export interface FileChange {
|
|
|
6
6
|
path: string;
|
|
7
7
|
before: string;
|
|
8
8
|
after: string;
|
|
9
|
+
// A piece of the file (an Edit's `old_string` and `new_string`), whose line numbers and last line say nothing about the file.
|
|
10
|
+
fragment?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* The texts a diff draws: a fragment ends where its edit does, not where its file ends, so it gets no "no final newline" mark. */
|
|
14
|
+
export function diffTexts(change: FileChange): { before: string; after: string } {
|
|
15
|
+
if (change.fragment !== true || change.before.endsWith('\n') || change.after.endsWith('\n')) {
|
|
16
|
+
return { before: change.before, after: change.after };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return { before: `${change.before}\n`, after: `${change.after}\n` };
|
|
9
20
|
}
|
|
10
21
|
|
|
11
22
|
function str(value: unknown): string | null {
|
|
@@ -156,7 +167,7 @@ export function fileChanges(name: string, input: unknown): FileChange[] {
|
|
|
156
167
|
const path = str(input.file_path) ?? '';
|
|
157
168
|
|
|
158
169
|
if (name === 'Edit') {
|
|
159
|
-
return [{ path, before: str(input.old_string) ?? '', after: str(input.new_string) ?? '' }];
|
|
170
|
+
return [{ path, before: str(input.old_string) ?? '', after: str(input.new_string) ?? '', fragment: true }];
|
|
160
171
|
}
|
|
161
172
|
|
|
162
173
|
if (name === 'Write') {
|
|
@@ -164,7 +175,7 @@ export function fileChanges(name: string, input: unknown): FileChange[] {
|
|
|
164
175
|
}
|
|
165
176
|
|
|
166
177
|
if (name === 'MultiEdit' && Array.isArray(input.edits)) {
|
|
167
|
-
return input.edits.filter(isRecord).map((edit) => ({ path, before: str(edit.old_string) ?? '', after: str(edit.new_string) ?? '' }));
|
|
178
|
+
return input.edits.filter(isRecord).map((edit) => ({ path, before: str(edit.old_string) ?? '', after: str(edit.new_string) ?? '', fragment: true }));
|
|
168
179
|
}
|
|
169
180
|
|
|
170
181
|
return [];
|
|
@@ -5,7 +5,7 @@ import { getFiletypeFromFileName } from '@pierre/diffs';
|
|
|
5
5
|
import type { EditorEngine } from '@adecore/editor';
|
|
6
6
|
import { DiffView, type DiffSource } from '@adecore/editor-react';
|
|
7
7
|
import { diffDocument, patchOf, type DiffDocument } from '@adecore/merge';
|
|
8
|
-
import type
|
|
8
|
+
import { diffTexts, type FileChange } from '../../logic/tools';
|
|
9
9
|
import { useDiffSourceTokens } from '../use-diff-source-tokens';
|
|
10
10
|
import { diffSourceBudget } from './diff-source-budget';
|
|
11
11
|
import { DiffOmitted } from './DiffOmitted';
|
|
@@ -25,6 +25,7 @@ function ReadyDiff({
|
|
|
25
25
|
fill,
|
|
26
26
|
layout,
|
|
27
27
|
maxHeight,
|
|
28
|
+
numbered,
|
|
28
29
|
onSource
|
|
29
30
|
}: {
|
|
30
31
|
document: DiffDocument;
|
|
@@ -34,6 +35,7 @@ function ReadyDiff({
|
|
|
34
35
|
fill: boolean;
|
|
35
36
|
layout: 'unified' | 'split';
|
|
36
37
|
maxHeight: number;
|
|
38
|
+
numbered: boolean;
|
|
37
39
|
onSource?(source: DiffSource): void | (() => void);
|
|
38
40
|
}) {
|
|
39
41
|
useReviewSettled();
|
|
@@ -55,6 +57,7 @@ function ReadyDiff({
|
|
|
55
57
|
layout={layout}
|
|
56
58
|
wrap={wrap}
|
|
57
59
|
fill={fill}
|
|
60
|
+
numbered={numbered}
|
|
58
61
|
className="chat-diff select-text"
|
|
59
62
|
onSource={onSource}
|
|
60
63
|
/>
|
|
@@ -70,6 +73,7 @@ export function EditorDocumentDiff({
|
|
|
70
73
|
fill = false,
|
|
71
74
|
layout = 'unified',
|
|
72
75
|
maxHeight = 480,
|
|
76
|
+
numbered = true,
|
|
73
77
|
onSource
|
|
74
78
|
}: {
|
|
75
79
|
document: DiffDocument;
|
|
@@ -80,6 +84,7 @@ export function EditorDocumentDiff({
|
|
|
80
84
|
fill?: boolean;
|
|
81
85
|
layout?: 'unified' | 'split';
|
|
82
86
|
maxHeight?: number;
|
|
87
|
+
numbered?: boolean;
|
|
83
88
|
onSource?(source: DiffSource): void | (() => void);
|
|
84
89
|
}) {
|
|
85
90
|
const { t } = useTranslation('agent-chat');
|
|
@@ -130,7 +135,17 @@ export function EditorDocumentDiff({
|
|
|
130
135
|
return engine === null ? (
|
|
131
136
|
fallback
|
|
132
137
|
) : (
|
|
133
|
-
<ReadyDiff
|
|
138
|
+
<ReadyDiff
|
|
139
|
+
document={document}
|
|
140
|
+
path={path}
|
|
141
|
+
engine={engine}
|
|
142
|
+
wrap={wrap}
|
|
143
|
+
fill={fill}
|
|
144
|
+
layout={layout}
|
|
145
|
+
maxHeight={maxHeight}
|
|
146
|
+
numbered={numbered}
|
|
147
|
+
onSource={onSource}
|
|
148
|
+
/>
|
|
134
149
|
);
|
|
135
150
|
}
|
|
136
151
|
|
|
@@ -147,14 +162,25 @@ export default function EditorEditDiff({
|
|
|
147
162
|
fallback: ReactNode;
|
|
148
163
|
maxHeight?: number;
|
|
149
164
|
}) {
|
|
165
|
+
const { before, after } = diffTexts(change);
|
|
166
|
+
|
|
150
167
|
const document =
|
|
151
|
-
sourceChecked || diffSourceBudget(
|
|
152
|
-
? diffDocument(patchOf(
|
|
168
|
+
sourceChecked || diffSourceBudget(before, after)
|
|
169
|
+
? diffDocument(patchOf(before, after, 3, { maxWork: EDITOR_DIFF_WORK }), { old: before, new: after })
|
|
153
170
|
: undefined;
|
|
154
171
|
|
|
155
172
|
if (document === undefined) {
|
|
156
173
|
return <DiffOmitted path={change.path} />;
|
|
157
174
|
}
|
|
158
175
|
|
|
159
|
-
return
|
|
176
|
+
return (
|
|
177
|
+
<EditorDocumentDiff
|
|
178
|
+
document={document}
|
|
179
|
+
path={change.path}
|
|
180
|
+
loadEngine={loadEngine}
|
|
181
|
+
fallback={fallback}
|
|
182
|
+
maxHeight={maxHeight}
|
|
183
|
+
numbered={change.fragment !== true}
|
|
184
|
+
/>
|
|
185
|
+
);
|
|
160
186
|
}
|
|
@@ -2,21 +2,23 @@ import { LegacyDiffPool } from './LegacyDiffPool';
|
|
|
2
2
|
import { useReviewSettled } from './review-settle';
|
|
3
3
|
import { MultiFileDiff } from '@pierre/diffs/react';
|
|
4
4
|
import { useDiffTheme } from '../diff-theme';
|
|
5
|
-
import type
|
|
5
|
+
import { diffTexts, type FileChange } from '../../logic/tools';
|
|
6
6
|
import { useHostCodeMode } from '../../../host-hooks';
|
|
7
7
|
|
|
8
8
|
export default function LegacyEditDiff({ change, maxHeight }: { change: FileChange; maxHeight?: number }) {
|
|
9
9
|
useReviewSettled();
|
|
10
10
|
const resolved = useHostCodeMode();
|
|
11
11
|
const theme = useDiffTheme();
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const { before, after } = diffTexts(change);
|
|
13
|
+
const oldFile = { name: change.path, contents: before };
|
|
14
|
+
const newFile = { name: change.path, contents: after };
|
|
14
15
|
|
|
15
16
|
const options = {
|
|
16
17
|
diffStyle: 'unified' as const,
|
|
17
18
|
theme,
|
|
18
19
|
themeType: resolved,
|
|
19
20
|
disableFileHeader: true,
|
|
21
|
+
disableLineNumbers: change.fragment === true,
|
|
20
22
|
overflow: 'wrap' as const,
|
|
21
23
|
hunkSeparators: 'simple' as const
|
|
22
24
|
};
|
|
@@ -320,6 +320,7 @@ export default {
|
|
|
320
320
|
wokenByMessage_one: 'Woken by a message',
|
|
321
321
|
wokenByMessage_other: 'Woken by {{count}} messages',
|
|
322
322
|
subagentFinished: 'Sub-agent finished: {{label}}',
|
|
323
|
+
backgroundFinished: 'Background task finished: {{label}}',
|
|
323
324
|
continued: 'Continued on its own',
|
|
324
325
|
stopped: 'Stopped after {{duration}}',
|
|
325
326
|
youStopped: 'You stopped after {{duration}}',
|
|
@@ -320,6 +320,7 @@ export default {
|
|
|
320
320
|
wokenByMessage_one: 'Gewekt door een bericht',
|
|
321
321
|
wokenByMessage_other: 'Gewekt door {{count}} berichten',
|
|
322
322
|
subagentFinished: 'Sub-agent klaar: {{label}}',
|
|
323
|
+
backgroundFinished: 'Achtergrondtaak klaar: {{label}}',
|
|
323
324
|
continued: 'Zelf verdergegaan',
|
|
324
325
|
stopped: 'Gestopt na {{duration}}',
|
|
325
326
|
youStopped: 'Jij stopte na {{duration}}',
|