@adecore/agents-react 0.48.1 → 0.48.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/logic/timeline.d.ts +1 -0
- package/dist/chat/logic/timeline.js +31 -43
- package/dist/chat/ui/rows/MessageRows.d.ts +2 -1
- package/dist/chat/ui/rows/MessageRows.js +223 -62
- package/dist/chat/ui/rows/Rows.js +31 -29
- package/dist/chat/ui/rows/WorkRows.js +103 -51
- package/dist/host.d.ts +1 -0
- package/dist/locales/en/agent-chat.d.ts +2 -0
- package/dist/locales/en/agent-chat.js +2 -0
- package/dist/locales/nl/agent-chat.d.ts +2 -0
- package/dist/locales/nl/agent-chat.js +2 -0
- package/package.json +8 -8
- package/src/chat/logic/timeline.ts +28 -27
- package/src/chat/ui/rows/MessageRows.tsx +67 -20
- package/src/chat/ui/rows/Rows.tsx +1 -1
- package/src/chat/ui/rows/WorkRows.tsx +12 -5
- package/src/host.ts +2 -0
- package/src/locales/en/agent-chat.ts +2 -0
- package/src/locales/nl/agent-chat.ts +2 -0
|
@@ -206,7 +206,7 @@ function LookTags(t0) {
|
|
|
206
206
|
* not a button. `time` shows at the right edge while the line is hovered or focused.
|
|
207
207
|
*/
|
|
208
208
|
export function ToggleLine(t0) {
|
|
209
|
-
const $ = _c(
|
|
209
|
+
const $ = _c(49);
|
|
210
210
|
const {
|
|
211
211
|
icon,
|
|
212
212
|
label,
|
|
@@ -225,10 +225,10 @@ export function ToggleLine(t0) {
|
|
|
225
225
|
} = t0;
|
|
226
226
|
const open = t1 === undefined ? false : t1;
|
|
227
227
|
const t2 = onToggle !== undefined && "hover:bg-surface-hover";
|
|
228
|
-
const t3 = failed
|
|
228
|
+
const t3 = failed ? "text-status-error" : "text-text-muted";
|
|
229
229
|
let t4;
|
|
230
230
|
if ($[0] !== className || $[1] !== t2 || $[2] !== t3) {
|
|
231
|
-
t4 = clsx("group/line -mx-1 mb-0.5 flex h-7 w-[calc(100%+8px)] items-center gap-2 rounded-md px-1 text-left text-xs
|
|
231
|
+
t4 = clsx("group/line -mx-1 mb-0.5 flex h-7 w-[calc(100%+8px)] items-center gap-2 rounded-md px-1 text-left text-xs", t2, t3, className);
|
|
232
232
|
$[0] = className;
|
|
233
233
|
$[1] = t2;
|
|
234
234
|
$[2] = t3;
|
|
@@ -411,18 +411,20 @@ export function ToggleLine(t0) {
|
|
|
411
411
|
return t20;
|
|
412
412
|
}
|
|
413
413
|
let t20;
|
|
414
|
-
if ($[44] !== classes || $[45] !== content || $[46] !== onToggle) {
|
|
414
|
+
if ($[44] !== classes || $[45] !== content || $[46] !== onToggle || $[47] !== open) {
|
|
415
415
|
t20 = /*#__PURE__*/_jsx("button", {
|
|
416
416
|
className: classes,
|
|
417
417
|
onClick: onToggle,
|
|
418
|
+
"aria-expanded": open,
|
|
418
419
|
children: content
|
|
419
420
|
});
|
|
420
421
|
$[44] = classes;
|
|
421
422
|
$[45] = content;
|
|
422
423
|
$[46] = onToggle;
|
|
423
|
-
$[47] =
|
|
424
|
+
$[47] = open;
|
|
425
|
+
$[48] = t20;
|
|
424
426
|
} else {
|
|
425
|
-
t20 = $[
|
|
427
|
+
t20 = $[48];
|
|
426
428
|
}
|
|
427
429
|
return t20;
|
|
428
430
|
}
|
|
@@ -1501,7 +1503,7 @@ function _temp3(o) {
|
|
|
1501
1503
|
return !o;
|
|
1502
1504
|
}
|
|
1503
1505
|
export function WorkGroupRow(t0) {
|
|
1504
|
-
const $ = _c(
|
|
1506
|
+
const $ = _c(27);
|
|
1505
1507
|
const {
|
|
1506
1508
|
tools,
|
|
1507
1509
|
summary,
|
|
@@ -1509,65 +1511,115 @@ export function WorkGroupRow(t0) {
|
|
|
1509
1511
|
expanded,
|
|
1510
1512
|
onToggle
|
|
1511
1513
|
} = t0;
|
|
1514
|
+
const {
|
|
1515
|
+
t
|
|
1516
|
+
} = useTranslation("agent-chat");
|
|
1512
1517
|
let t1;
|
|
1513
1518
|
if ($[0] !== tools) {
|
|
1514
|
-
t1 = tools.
|
|
1519
|
+
t1 = tools.filter(_temp4);
|
|
1515
1520
|
$[0] = tools;
|
|
1516
1521
|
$[1] = t1;
|
|
1517
1522
|
} else {
|
|
1518
1523
|
t1 = $[1];
|
|
1519
1524
|
}
|
|
1520
|
-
const
|
|
1525
|
+
const running = t1.length;
|
|
1521
1526
|
let t2;
|
|
1522
|
-
if ($[2] !==
|
|
1523
|
-
t2 =
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
$[2] = look;
|
|
1527
|
-
$[3] = tools[0].name;
|
|
1528
|
-
$[4] = t2;
|
|
1527
|
+
if ($[2] !== tools) {
|
|
1528
|
+
t2 = tools.some(_temp5);
|
|
1529
|
+
$[2] = tools;
|
|
1530
|
+
$[3] = t2;
|
|
1529
1531
|
} else {
|
|
1530
|
-
t2 = $[
|
|
1532
|
+
t2 = $[3];
|
|
1531
1533
|
}
|
|
1534
|
+
const failed = t2;
|
|
1532
1535
|
let t3;
|
|
1533
|
-
if ($[
|
|
1534
|
-
t3 =
|
|
1535
|
-
|
|
1536
|
-
|
|
1536
|
+
if ($[4] !== look || $[5] !== running || $[6] !== tools[0].name) {
|
|
1537
|
+
t3 = running > 0 ? /*#__PURE__*/_jsx(Spinner, {
|
|
1538
|
+
size: 12
|
|
1539
|
+
}) : look === undefined ? toolIcon(tools[0].name) : /*#__PURE__*/_jsx(look.Mark, {
|
|
1540
|
+
size: 12
|
|
1541
|
+
});
|
|
1542
|
+
$[4] = look;
|
|
1543
|
+
$[5] = running;
|
|
1544
|
+
$[6] = tools[0].name;
|
|
1537
1545
|
$[7] = t3;
|
|
1538
1546
|
} else {
|
|
1539
1547
|
t3 = $[7];
|
|
1540
1548
|
}
|
|
1541
1549
|
let t4;
|
|
1542
|
-
if ($[8] !==
|
|
1543
|
-
t4 =
|
|
1550
|
+
if ($[8] !== look || $[9] !== running || $[10] !== summary || $[11] !== t || $[12] !== tools.length) {
|
|
1551
|
+
t4 = running > 0 ? t("group.toolCalls", {
|
|
1552
|
+
count: tools.length
|
|
1553
|
+
}) : look?.brand === undefined ? summary : withBrand(summary, [look.brand]);
|
|
1554
|
+
$[8] = look;
|
|
1555
|
+
$[9] = running;
|
|
1556
|
+
$[10] = summary;
|
|
1557
|
+
$[11] = t;
|
|
1558
|
+
$[12] = tools.length;
|
|
1559
|
+
$[13] = t4;
|
|
1560
|
+
} else {
|
|
1561
|
+
t4 = $[13];
|
|
1562
|
+
}
|
|
1563
|
+
let t5;
|
|
1564
|
+
if ($[14] !== t4) {
|
|
1565
|
+
t5 = /*#__PURE__*/_jsx("span", {
|
|
1566
|
+
className: "tabular-nums",
|
|
1567
|
+
children: t4
|
|
1568
|
+
});
|
|
1569
|
+
$[14] = t4;
|
|
1570
|
+
$[15] = t5;
|
|
1571
|
+
} else {
|
|
1572
|
+
t5 = $[15];
|
|
1573
|
+
}
|
|
1574
|
+
let t6;
|
|
1575
|
+
if ($[16] !== running || $[17] !== t) {
|
|
1576
|
+
t6 = running > 0 && /*#__PURE__*/_jsx("span", {
|
|
1577
|
+
className: "shrink-0 text-text-faint tabular-nums",
|
|
1578
|
+
children: t("group.running", {
|
|
1579
|
+
count: running
|
|
1580
|
+
})
|
|
1581
|
+
});
|
|
1582
|
+
$[16] = running;
|
|
1583
|
+
$[17] = t;
|
|
1584
|
+
$[18] = t6;
|
|
1585
|
+
} else {
|
|
1586
|
+
t6 = $[18];
|
|
1587
|
+
}
|
|
1588
|
+
let t7;
|
|
1589
|
+
if ($[19] !== expanded || $[20] !== failed || $[21] !== onToggle || $[22] !== t3 || $[23] !== t5 || $[24] !== t6 || $[25] !== tools[0].createdAt) {
|
|
1590
|
+
t7 = /*#__PURE__*/_jsx("div", {
|
|
1544
1591
|
children: /*#__PURE__*/_jsx(ToggleLine, {
|
|
1545
|
-
icon:
|
|
1546
|
-
label:
|
|
1592
|
+
icon: t3,
|
|
1593
|
+
label: t5,
|
|
1547
1594
|
open: expanded,
|
|
1548
1595
|
onToggle: onToggle,
|
|
1549
1596
|
failed: failed,
|
|
1597
|
+
trailing: t6,
|
|
1550
1598
|
time: tools[0].createdAt
|
|
1551
1599
|
})
|
|
1552
1600
|
});
|
|
1553
|
-
$[
|
|
1554
|
-
$[
|
|
1555
|
-
$[
|
|
1556
|
-
$[
|
|
1557
|
-
$[
|
|
1558
|
-
$[
|
|
1559
|
-
$[
|
|
1601
|
+
$[19] = expanded;
|
|
1602
|
+
$[20] = failed;
|
|
1603
|
+
$[21] = onToggle;
|
|
1604
|
+
$[22] = t3;
|
|
1605
|
+
$[23] = t5;
|
|
1606
|
+
$[24] = t6;
|
|
1607
|
+
$[25] = tools[0].createdAt;
|
|
1608
|
+
$[26] = t7;
|
|
1560
1609
|
} else {
|
|
1561
|
-
|
|
1610
|
+
t7 = $[26];
|
|
1562
1611
|
}
|
|
1563
|
-
return
|
|
1612
|
+
return t7;
|
|
1564
1613
|
}
|
|
1565
1614
|
/*
|
|
1566
1615
|
* A settled turn folded behind how long it took and what it did. A line and not a button, like the
|
|
1567
1616
|
* tool lines it hides; the work reads fainter than the time so the eye lands on the time first.
|
|
1568
1617
|
*/
|
|
1618
|
+
function _temp5(tool_0) {
|
|
1619
|
+
return tool_0.state === "error";
|
|
1620
|
+
}
|
|
1569
1621
|
function _temp4(tool) {
|
|
1570
|
-
return tool.state === "
|
|
1622
|
+
return tool.state === "running";
|
|
1571
1623
|
}
|
|
1572
1624
|
export function TurnFoldRow(t0) {
|
|
1573
1625
|
const $ = _c(39);
|
|
@@ -1587,7 +1639,7 @@ export function TurnFoldRow(t0) {
|
|
|
1587
1639
|
let t2;
|
|
1588
1640
|
let t3;
|
|
1589
1641
|
if ($[0] !== commandLooks || $[1] !== expandable || $[2] !== expanded || $[3] !== label || $[4] !== turn.state || $[5] !== work) {
|
|
1590
|
-
const brands = commandLooks?.flatMap(
|
|
1642
|
+
const brands = commandLooks?.flatMap(_temp6) ?? [];
|
|
1591
1643
|
const t4 = expandable && "hover:bg-surface-hover";
|
|
1592
1644
|
const t5 = turn.state === "error" && "text-status-error";
|
|
1593
1645
|
let t6;
|
|
@@ -1731,7 +1783,7 @@ export function TurnFoldRow(t0) {
|
|
|
1731
1783
|
}
|
|
1732
1784
|
return t7;
|
|
1733
1785
|
}
|
|
1734
|
-
function
|
|
1786
|
+
function _temp6(t0) {
|
|
1735
1787
|
const {
|
|
1736
1788
|
brand
|
|
1737
1789
|
} = t0;
|
|
@@ -1847,7 +1899,7 @@ function ChangedFilesCard(t0) {
|
|
|
1847
1899
|
let t2;
|
|
1848
1900
|
let t3;
|
|
1849
1901
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1850
|
-
t2 = () => setExpanded(
|
|
1902
|
+
t2 = () => setExpanded(_temp7);
|
|
1851
1903
|
t3 = /*#__PURE__*/_jsx(Icon, {
|
|
1852
1904
|
icon: FileDiff,
|
|
1853
1905
|
size: 12,
|
|
@@ -2004,7 +2056,7 @@ function ChangedFilesCard(t0) {
|
|
|
2004
2056
|
* checkpoint but no stored diff asks the host for one, which is also how a running turn gets it.
|
|
2005
2057
|
* A diff the thread keeps only the first files of (`heldBack`) asks for the whole when a person does.
|
|
2006
2058
|
*/
|
|
2007
|
-
function
|
|
2059
|
+
function _temp7(value) {
|
|
2008
2060
|
return !value;
|
|
2009
2061
|
}
|
|
2010
2062
|
export function ChangedFilesRow(t0) {
|
|
@@ -2054,7 +2106,7 @@ export function ChangedFilesRow(t0) {
|
|
|
2054
2106
|
if (alive) {
|
|
2055
2107
|
setFetched(answer);
|
|
2056
2108
|
}
|
|
2057
|
-
}).catch(
|
|
2109
|
+
}).catch(_temp8);
|
|
2058
2110
|
return () => {
|
|
2059
2111
|
alive = false;
|
|
2060
2112
|
};
|
|
@@ -2076,7 +2128,7 @@ export function ChangedFilesRow(t0) {
|
|
|
2076
2128
|
const {
|
|
2077
2129
|
keyOf
|
|
2078
2130
|
} = useChatScope();
|
|
2079
|
-
const flash = useTimelineFlash(
|
|
2131
|
+
const flash = useTimelineFlash(_temp9);
|
|
2080
2132
|
let t6;
|
|
2081
2133
|
if ($[13] !== chatId || $[14] !== flash || $[15] !== keyOf || $[16] !== turnId) {
|
|
2082
2134
|
t6 = flash !== null && flash.opens && flash.key === keyOf(chatId) && flash.rowId === `files-${turnId}` ? flash.nonce : 0;
|
|
@@ -2095,7 +2147,7 @@ export function ChangedFilesRow(t0) {
|
|
|
2095
2147
|
const t8 = checkpointDiff.truncated;
|
|
2096
2148
|
let t9;
|
|
2097
2149
|
if ($[18] !== files) {
|
|
2098
|
-
t9 = files.reduce(
|
|
2150
|
+
t9 = files.reduce(_temp0, 0);
|
|
2099
2151
|
$[18] = files;
|
|
2100
2152
|
$[19] = t9;
|
|
2101
2153
|
} else {
|
|
@@ -2103,7 +2155,7 @@ export function ChangedFilesRow(t0) {
|
|
|
2103
2155
|
}
|
|
2104
2156
|
let t10;
|
|
2105
2157
|
if ($[20] !== files) {
|
|
2106
|
-
t10 = files.reduce(
|
|
2158
|
+
t10 = files.reduce(_temp1, 0);
|
|
2107
2159
|
$[20] = files;
|
|
2108
2160
|
$[21] = t10;
|
|
2109
2161
|
} else {
|
|
@@ -2193,16 +2245,16 @@ export function ChangedFilesRow(t0) {
|
|
|
2193
2245
|
}
|
|
2194
2246
|
return t7;
|
|
2195
2247
|
}
|
|
2196
|
-
function
|
|
2248
|
+
function _temp1(sum_0, file_0) {
|
|
2197
2249
|
return sum_0 + file_0.deleted;
|
|
2198
2250
|
}
|
|
2199
|
-
function
|
|
2251
|
+
function _temp0(sum, file) {
|
|
2200
2252
|
return sum + file.added;
|
|
2201
2253
|
}
|
|
2202
|
-
function
|
|
2254
|
+
function _temp9(s) {
|
|
2203
2255
|
return s.target;
|
|
2204
2256
|
}
|
|
2205
|
-
function
|
|
2257
|
+
function _temp8() {}
|
|
2206
2258
|
function ProviderReviewFiles(t0) {
|
|
2207
2259
|
const $ = _c(16);
|
|
2208
2260
|
const {
|
|
@@ -2228,7 +2280,7 @@ function ProviderReviewFiles(t0) {
|
|
|
2228
2280
|
} else {
|
|
2229
2281
|
t2 = $[4];
|
|
2230
2282
|
}
|
|
2231
|
-
t1 = reviews.filter(t2).flatMap(
|
|
2283
|
+
t1 = reviews.filter(t2).flatMap(_temp10);
|
|
2232
2284
|
$[0] = open;
|
|
2233
2285
|
$[1] = reviews;
|
|
2234
2286
|
$[2] = t1;
|
|
@@ -2286,7 +2338,7 @@ function ProviderReviewFiles(t0) {
|
|
|
2286
2338
|
return t2;
|
|
2287
2339
|
}
|
|
2288
2340
|
/* The fallback card, built from what the CLI itself reported about its edits. */
|
|
2289
|
-
function
|
|
2341
|
+
function _temp10(t0) {
|
|
2290
2342
|
const {
|
|
2291
2343
|
reviews: reviews_0
|
|
2292
2344
|
} = t0;
|
|
@@ -2328,7 +2380,7 @@ function ProviderChangedFiles(t0) {
|
|
|
2328
2380
|
entryFor(change.path || tool.id).edits.push(change);
|
|
2329
2381
|
}
|
|
2330
2382
|
}
|
|
2331
|
-
t1 = [...byPath].map(
|
|
2383
|
+
t1 = [...byPath].map(_temp11);
|
|
2332
2384
|
$[0] = tools;
|
|
2333
2385
|
$[1] = byPath;
|
|
2334
2386
|
$[2] = t1;
|
|
@@ -2368,7 +2420,7 @@ function ProviderChangedFiles(t0) {
|
|
|
2368
2420
|
return t3;
|
|
2369
2421
|
}
|
|
2370
2422
|
/* "Working for 00:14". */
|
|
2371
|
-
function
|
|
2423
|
+
function _temp11(t0) {
|
|
2372
2424
|
const [path_0, entry] = t0;
|
|
2373
2425
|
return {
|
|
2374
2426
|
path: path_0,
|
package/dist/host.d.ts
CHANGED
|
@@ -328,6 +328,7 @@ export interface ChatHost {
|
|
|
328
328
|
SubagentSlot: ComponentType<SubagentSlotProps> | null;
|
|
329
329
|
useThreadCards(scopeId: string, chatId: string): readonly ThreadCard[];
|
|
330
330
|
useReplyAuthor(scopeId: string, chatId: string): ReplyAuthor | null;
|
|
331
|
+
saidBy?: ReplyAuthor;
|
|
331
332
|
visuals: VisualHost | null;
|
|
332
333
|
commandLooks?: readonly CommandLook[];
|
|
333
334
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/agents-react",
|
|
3
|
-
"version": "0.48.
|
|
3
|
+
"version": "0.48.3",
|
|
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.48.
|
|
76
|
-
"@adecore/editor": "0.48.
|
|
77
|
-
"@adecore/editor-react": "0.48.
|
|
78
|
-
"@adecore/intelligent-ui": "0.48.
|
|
79
|
-
"@adecore/merge": "0.48.
|
|
75
|
+
"@adecore/agent-contracts": "0.48.3",
|
|
76
|
+
"@adecore/editor": "0.48.3",
|
|
77
|
+
"@adecore/editor-react": "0.48.3",
|
|
78
|
+
"@adecore/intelligent-ui": "0.48.3",
|
|
79
|
+
"@adecore/merge": "0.48.3",
|
|
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.48.
|
|
103
|
+
"@adecore/ui": "^0.48.3",
|
|
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.48.
|
|
110
|
+
"@adecore/ui": "0.48.3",
|
|
111
111
|
"@types/bun": "^1.4.4",
|
|
112
112
|
"@types/react": "^19.3.0",
|
|
113
113
|
"@types/react-dom": "^19.3.0",
|
|
@@ -55,7 +55,7 @@ export type TimelineRow =
|
|
|
55
55
|
| ({ kind: 'subagent' } & SubagentBranch)
|
|
56
56
|
| { kind: 'approval'; id: string; item: ChatApprovalItem }
|
|
57
57
|
| { kind: 'question'; id: string; item: ChatQuestionItem }
|
|
58
|
-
| { kind: 'note'; id: string; level: 'info' | 'warning' | 'error'; text: string; from?: string }
|
|
58
|
+
| { kind: 'note'; id: string; level: 'info' | 'warning' | 'error'; text: string; from?: string; said?: true }
|
|
59
59
|
// A message another node sent the chat, drawn as said to it under the name of its sender.
|
|
60
60
|
| { kind: 'message'; id: string; message: ChatNoteMessage; createdAt: number }
|
|
61
61
|
| { kind: 'compaction'; id: string; preTokens: number | null }
|
|
@@ -352,32 +352,22 @@ function flushTools(buffer: ChatToolItem[], rows: TimelineRow[], options: Timeli
|
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
const tools = buffer.splice(0);
|
|
355
|
-
const
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
rows.push(
|
|
366
|
-
looked === null
|
|
367
|
-
? { kind: 'work-group', id, tools: settled, summary: summarizeGroup(settled), expanded }
|
|
368
|
-
: { kind: 'work-group', id, tools: settled, summary: looked.summary, expanded, look: looked.look }
|
|
369
|
-
);
|
|
355
|
+
const first = tools[0]!;
|
|
356
|
+
const id = `group-${first.id}`;
|
|
357
|
+
const expanded = options.expandedGroups.has(id);
|
|
358
|
+
const looked = lookSummary(tools, options.commandLooks);
|
|
359
|
+
|
|
360
|
+
rows.push(
|
|
361
|
+
looked === null
|
|
362
|
+
? { kind: 'work-group', id, tools, summary: summarizeGroup(tools), expanded }
|
|
363
|
+
: { kind: 'work-group', id, tools, summary: looked.summary, expanded, look: looked.look }
|
|
364
|
+
);
|
|
370
365
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
366
|
+
if (expanded) {
|
|
367
|
+
for (const tool of tools) {
|
|
368
|
+
rows.push({ kind: tool.state === 'running' ? 'work-live' : 'work', id: tool.id, tool });
|
|
375
369
|
}
|
|
376
370
|
}
|
|
377
|
-
|
|
378
|
-
for (const tool of live) {
|
|
379
|
-
rows.push({ kind: 'work-live', id: tool.id, tool });
|
|
380
|
-
}
|
|
381
371
|
}
|
|
382
372
|
|
|
383
373
|
function isImageRow(row: TimelineRow): boolean {
|
|
@@ -461,7 +451,14 @@ function rowsForItems(items: ChatItem[], options: TimelineOptions, children: Map
|
|
|
461
451
|
if (item.message !== undefined) {
|
|
462
452
|
rows.push({ kind: 'message', id: item.id, message: item.message, createdAt: item.createdAt });
|
|
463
453
|
} else {
|
|
464
|
-
rows.push({
|
|
454
|
+
rows.push({
|
|
455
|
+
kind: 'note',
|
|
456
|
+
id: item.id,
|
|
457
|
+
level: item.level,
|
|
458
|
+
text: item.text,
|
|
459
|
+
...(item.from === undefined ? {} : { from: item.from }),
|
|
460
|
+
...(item.said === undefined ? {} : { said: item.said })
|
|
461
|
+
});
|
|
465
462
|
}
|
|
466
463
|
|
|
467
464
|
break;
|
|
@@ -532,7 +529,10 @@ function lastAssistantRow(rows: TimelineRow[]): TimelineRow | null {
|
|
|
532
529
|
continue;
|
|
533
530
|
}
|
|
534
531
|
|
|
535
|
-
if (
|
|
532
|
+
if (
|
|
533
|
+
(row.kind === 'work' && refused.has(row.tool.toolUseId)) ||
|
|
534
|
+
(row.kind === 'work-group' && row.tools.length === 1 && refused.has(row.tools[0]!.toolUseId))
|
|
535
|
+
) {
|
|
536
536
|
continue;
|
|
537
537
|
}
|
|
538
538
|
|
|
@@ -559,7 +559,8 @@ function withLiveThought(rows: TimelineRow[], items: readonly ChatItem[]): Timel
|
|
|
559
559
|
}
|
|
560
560
|
|
|
561
561
|
const after = new Set(items.slice(thoughtAt + 1).map((item) => item.id));
|
|
562
|
-
const
|
|
562
|
+
const grouped = new Set(rows.flatMap((row) => (row.kind === 'work-group' ? row.tools.map((tool) => tool.id) : [])));
|
|
563
|
+
const index = rows.findIndex((row) => row.kind === 'work-live' && after.has(row.tool.id) && !grouped.has(row.tool.id));
|
|
563
564
|
const call = rows[index];
|
|
564
565
|
const shownAt = rows.findIndex((row) => row.kind === 'thinking' && row.id === thought.id);
|
|
565
566
|
const inSight = shownAt !== -1 && shownAt < index && !rows.slice(shownAt + 1, index).some((row) => row.kind === 'work' || row.kind === 'work-group');
|
|
@@ -37,7 +37,9 @@ import { ROW_GUTTER } from '../icons';
|
|
|
37
37
|
import { useOpenForFind } from '../find-reveal';
|
|
38
38
|
import { ReplyContext, UiReplyNavigationContext } from '../reply-context';
|
|
39
39
|
import { UiReply } from '../intelligent-ui/UiReply';
|
|
40
|
+
import { useChatHost, type ReplyAuthor } from '../../../host';
|
|
40
41
|
import { useHostAttachmentUrl, useHostChatPlace, useHostReplyAuthor, useHostStreaming } from '../../../host-hooks';
|
|
42
|
+
import { REFERENCE_TONE, TOKEN_IN_MESSAGE } from '../chips';
|
|
41
43
|
import { copySelectionWithChips } from '../chip-clipboard';
|
|
42
44
|
import { useReferenceLookup } from '../thread-references';
|
|
43
45
|
|
|
@@ -193,31 +195,66 @@ export function UserRow({ chatId, item }: { chatId: string; item: ChatUserItem }
|
|
|
193
195
|
*/
|
|
194
196
|
export function SentMessageRow({ chatId, id, message }: { chatId: string; id: string; message: ChatNoteMessage }) {
|
|
195
197
|
const { t } = useTranslation('agent-chat');
|
|
196
|
-
const [open, setOpen] = useState(false);
|
|
197
|
-
const long = message.text.split('\n').length > USER_FOLD_LINES || message.text.length > USER_FOLD_CHARS;
|
|
198
198
|
const lookup = useReferenceLookup(chatId);
|
|
199
|
-
useOpenForFind(id, 'text', setOpen);
|
|
200
199
|
|
|
201
200
|
return (
|
|
202
201
|
<ReferenceLookupContext value={lookup}>
|
|
203
|
-
<
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
202
|
+
<SaidMessage
|
|
203
|
+
id={id}
|
|
204
|
+
name={message.title || t('rows.message.unnamed')}
|
|
205
|
+
chip={<ReferenceChip id={message.from} lastName={message.title} />}
|
|
206
|
+
text={message.text}
|
|
207
|
+
/>
|
|
208
|
+
</ReferenceLookupContext>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* What the host told the agent in front of a prompt, said under the host's own name, which the text no longer has to lead with. */
|
|
213
|
+
function HostSaidRow({ id, text, author }: { id: string; text: string; author: ReplyAuthor }) {
|
|
214
|
+
const prefix = `${author.name}: `;
|
|
215
|
+
const words = text
|
|
216
|
+
.split('\n\n')
|
|
217
|
+
.map((part) => (part.startsWith(prefix) ? part.slice(prefix.length) : part))
|
|
218
|
+
.join('\n\n');
|
|
219
|
+
|
|
220
|
+
return (
|
|
221
|
+
<SaidMessage
|
|
222
|
+
id={id}
|
|
223
|
+
name={author.name}
|
|
224
|
+
chip={
|
|
225
|
+
<span className={clsx(TOKEN_IN_MESSAGE, REFERENCE_TONE, 'inline-flex items-center gap-1')}>
|
|
226
|
+
{author.mark}
|
|
227
|
+
{author.name}
|
|
228
|
+
</span>
|
|
229
|
+
}
|
|
230
|
+
text={words}
|
|
231
|
+
/>
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* A message the person did not write: a bubble on the left, quieter than theirs, under a chip of who said it. A long one folds. */
|
|
236
|
+
function SaidMessage({ id, name, chip, text }: { id: string; name: string; chip: ReactNode; text: string }) {
|
|
237
|
+
const { t } = useTranslation('agent-chat');
|
|
238
|
+
const [open, setOpen] = useState(false);
|
|
239
|
+
const long = text.split('\n').length > USER_FOLD_LINES || text.length > USER_FOLD_CHARS;
|
|
240
|
+
useOpenForFind(id, 'text', setOpen);
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<div data-find-item={id} className="flex flex-col items-start">
|
|
244
|
+
<MessageHeading>{t('rows.message.heading', { name })}</MessageHeading>
|
|
245
|
+
<div className="mb-1.5 flex max-w-[80%]">{chip}</div>
|
|
246
|
+
<div className="relative max-w-[80%] rounded-2xl bg-surface-hover px-3.5 py-2.5 text-sm wrap-anywhere text-text select-text">
|
|
247
|
+
<div data-find-field="text" className={clsx(long && !open && FOLD)}>
|
|
248
|
+
<MessageMarkdown text={text} />
|
|
218
249
|
</div>
|
|
250
|
+
{long && (
|
|
251
|
+
<button className="mt-1 flex items-center gap-1 text-xs text-text-muted hover:text-text" onClick={() => setOpen((o) => !o)}>
|
|
252
|
+
<Icon icon={ChevronDown} size={12} className={clsx('transition-transform', open && 'rotate-180')} />{' '}
|
|
253
|
+
{open ? t('rows.user.showLess') : t('rows.user.showAll')}
|
|
254
|
+
</button>
|
|
255
|
+
)}
|
|
219
256
|
</div>
|
|
220
|
-
</
|
|
257
|
+
</div>
|
|
221
258
|
);
|
|
222
259
|
}
|
|
223
260
|
|
|
@@ -492,7 +529,17 @@ const NOTE_ICON = {
|
|
|
492
529
|
* A line from the machine in the thread. A note of more than one line (a summary a fork sent back)
|
|
493
530
|
* shows its first line and folds the rest open as markdown; one that came from a fork leads to it.
|
|
494
531
|
*/
|
|
495
|
-
export function NoteRow({ id, level, text, from }: { id: string; level: 'info' | 'warning' | 'error'; text: string; from?: string }) {
|
|
532
|
+
export function NoteRow({ id, level, text, from, said }: { id: string; level: 'info' | 'warning' | 'error'; text: string; from?: string; said?: true }) {
|
|
533
|
+
const { saidBy } = useChatHost();
|
|
534
|
+
|
|
535
|
+
if (said && saidBy !== undefined) {
|
|
536
|
+
return <HostSaidRow id={id} text={text} author={saidBy} />;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
return <NoteLine id={id} level={level} text={text} from={from} />;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
function NoteLine({ id, level, text, from }: { id: string; level: 'info' | 'warning' | 'error'; text: string; from?: string }) {
|
|
496
543
|
const { t } = useTranslation('agent-chat');
|
|
497
544
|
const [open, setOpen] = useState(false);
|
|
498
545
|
const breakAt = text.indexOf('\n');
|
|
@@ -108,7 +108,7 @@ export function Row({ row, chatId, toggleGroup, toggleTurn, toggleSubagent, open
|
|
|
108
108
|
case 'question':
|
|
109
109
|
return <QuestionHistoryRow item={row.item} />;
|
|
110
110
|
case 'note':
|
|
111
|
-
return <NoteRow id={row.id} level={row.level} text={row.text} from={row.from} />;
|
|
111
|
+
return <NoteRow id={row.id} level={row.level} text={row.text} from={row.from} said={row.said} />;
|
|
112
112
|
case 'message':
|
|
113
113
|
return <SentMessageRow chatId={chatId} id={row.id} message={row.message} />;
|
|
114
114
|
case 'compaction':
|