reifyui 0.17.0 → 0.18.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/README.md +1 -1
- package/dist/agent-chat.cjs +271 -26
- package/dist/agent-chat.cjs.map +1 -1
- package/dist/agent-chat.d.ts +20 -4
- package/dist/agent-chat.js +5 -1
- package/dist/agent-chat.js.map +1 -1
- package/dist/{chunk-6HGZN2SQ.js → chunk-Y2MBOXQC.js} +269 -24
- package/dist/chunk-Y2MBOXQC.js.map +1 -0
- package/dist/index.cjs +266 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/agent-chat/components.jsx +28 -15
- package/src/agent-chat/index.d.ts +20 -4
- package/src/agent-chat/index.js +2 -2
- package/src/agent-chat/tools.js +177 -11
- package/styles/agent-chat.css +4 -0
- package/dist/chunk-6HGZN2SQ.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1176,6 +1176,7 @@ var NS = /^(developer|platform|computercontroller|builtin|default|functions|tool
|
|
|
1176
1176
|
function toolKind(name) {
|
|
1177
1177
|
const raw = String(name || "").trim();
|
|
1178
1178
|
if (!raw) return "tool";
|
|
1179
|
+
if (browserActOf(raw) !== null) return "browser";
|
|
1179
1180
|
if (/^mcp__/i.test(raw)) return "mcp";
|
|
1180
1181
|
const n = raw.toLowerCase().replace(NS, "");
|
|
1181
1182
|
if (KIND_BY_NAME[n]) return KIND_BY_NAME[n];
|
|
@@ -1326,6 +1327,195 @@ function shortUrl(u) {
|
|
|
1326
1327
|
function humanizeName(n) {
|
|
1327
1328
|
return str(n).replace(/^mcp__/i, "").replace(/__|\./g, " \xB7 ").replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").trim().replace(/^\w/, (c) => c.toUpperCase());
|
|
1328
1329
|
}
|
|
1330
|
+
var NS_BROWSER = /^(?:mcp__.+?__|[a-z0-9_-]+?(?:__|\.))(browser[_\-.].+)$/i;
|
|
1331
|
+
var BROWSER_SERVER = /^(?:mcp__)?(?:browser|playwright|puppeteer|browserbase|browser[_-]use|chrome[_-]?devtools)(?:__|\.)(.+)$/i;
|
|
1332
|
+
function browserActOf(name) {
|
|
1333
|
+
const raw = String(name || "").trim();
|
|
1334
|
+
if (!raw) return null;
|
|
1335
|
+
const n = raw.toLowerCase().replace(NS, "");
|
|
1336
|
+
if (KIND_BY_NAME[n] === "browser") return n === "navigate" || n === "screenshot" ? n : "";
|
|
1337
|
+
let m = n.match(/^(?:browser|playwright|computer)[_\-.](.+)$/);
|
|
1338
|
+
if (m) return m[1];
|
|
1339
|
+
m = raw.match(NS_BROWSER);
|
|
1340
|
+
if (m) return m[1].replace(/^browser[_\-.]/i, "").toLowerCase();
|
|
1341
|
+
m = raw.match(BROWSER_SERVER);
|
|
1342
|
+
if (m) return m[1].replace(/^browser[_\-.]/i, "").toLowerCase();
|
|
1343
|
+
if (/[_\-.]browser$/.test(n)) return "";
|
|
1344
|
+
return null;
|
|
1345
|
+
}
|
|
1346
|
+
var ROLE_NOUN = {
|
|
1347
|
+
link: "link",
|
|
1348
|
+
button: "button",
|
|
1349
|
+
submit: "button",
|
|
1350
|
+
textbox: "field",
|
|
1351
|
+
searchbox: "search field",
|
|
1352
|
+
combobox: "list",
|
|
1353
|
+
listbox: "list",
|
|
1354
|
+
checkbox: "checkbox",
|
|
1355
|
+
radio: "option",
|
|
1356
|
+
option: "option",
|
|
1357
|
+
tab: "tab",
|
|
1358
|
+
menuitem: "menu item",
|
|
1359
|
+
heading: "heading",
|
|
1360
|
+
img: "image",
|
|
1361
|
+
image: "image",
|
|
1362
|
+
switch: "switch",
|
|
1363
|
+
slider: "slider"
|
|
1364
|
+
};
|
|
1365
|
+
function cut(s, max) {
|
|
1366
|
+
const t = str(s).replace(/\s+/g, " ").trim();
|
|
1367
|
+
return t.length > max ? `${t.slice(0, max - 1).trimEnd()}\u2026` : t;
|
|
1368
|
+
}
|
|
1369
|
+
function elementWords(a, element, act) {
|
|
1370
|
+
const desc = str(firstOf(a, ["element", "element_description", "description", "label"])).trim();
|
|
1371
|
+
if (desc) return cut(desc, 60);
|
|
1372
|
+
if (element && element.role) {
|
|
1373
|
+
const noun = ROLE_NOUN[String(element.role).toLowerCase()] || "";
|
|
1374
|
+
const name = cut(element.name, 40);
|
|
1375
|
+
if (noun && name) return `the \u201C${name}\u201D ${noun}`;
|
|
1376
|
+
if (noun) return `a ${noun}`;
|
|
1377
|
+
if (name) return `\u201C${name}\u201D`;
|
|
1378
|
+
}
|
|
1379
|
+
const sel = str(a.selector).trim().toLowerCase();
|
|
1380
|
+
if (sel) {
|
|
1381
|
+
if (/^a(?=$|[\s.#[:>])|role=["']?link/.test(sel)) return "a link";
|
|
1382
|
+
if (/^button|\[type=["']?submit|role=["']?button/.test(sel)) return "a button";
|
|
1383
|
+
if (/^(input|textarea)|role=["']?(textbox|searchbox)|contenteditable/.test(sel)) return "a field";
|
|
1384
|
+
if (/^select|role=["']?(combobox|listbox)/.test(sel)) return "a list";
|
|
1385
|
+
}
|
|
1386
|
+
if (act === "click") {
|
|
1387
|
+
const t = str(a.text).trim();
|
|
1388
|
+
if (t) return `\u201C${cut(t, 40)}\u201D`;
|
|
1389
|
+
}
|
|
1390
|
+
return "";
|
|
1391
|
+
}
|
|
1392
|
+
function msWords(ms) {
|
|
1393
|
+
const s = Math.round(Number(ms) / 100) / 10;
|
|
1394
|
+
return s >= 1 ? `${s}s` : `${Math.round(Number(ms))} ms`;
|
|
1395
|
+
}
|
|
1396
|
+
var BROWSER_ACTS = [
|
|
1397
|
+
[
|
|
1398
|
+
/^(navigate|goto|go_to|open|open_url|visit|new_tab|tab_new|browse|go)$/,
|
|
1399
|
+
"Opening",
|
|
1400
|
+
"Opened",
|
|
1401
|
+
(a) => {
|
|
1402
|
+
const u = str(firstOf(a, ["url", "href", "uri", "link", "address"]));
|
|
1403
|
+
return u ? shortUrl(u) : "";
|
|
1404
|
+
},
|
|
1405
|
+
["Opening a page", "Opened a page"]
|
|
1406
|
+
],
|
|
1407
|
+
[/^(navigate_back|back|go_back|history_back)$/, "", "", null, ["Going back a page", "Went back a page"]],
|
|
1408
|
+
[/^(navigate_forward|forward|go_forward)$/, "", "", null, ["Going forward a page", "Went forward a page"]],
|
|
1409
|
+
[/^(reload|refresh)$/, "", "", null, ["Reloading the page", "Reloaded the page"]],
|
|
1410
|
+
[
|
|
1411
|
+
/^(click|left_click|double_click|right_click|triple_click|middle_click|tap|click_element)$/,
|
|
1412
|
+
"Clicking",
|
|
1413
|
+
"Clicked",
|
|
1414
|
+
(a, e, act) => elementWords(a, e, act),
|
|
1415
|
+
["Clicking on the page", "Clicked on the page"]
|
|
1416
|
+
],
|
|
1417
|
+
[/^(hover|mouse_move|move_mouse)$/, "Pointing at", "Pointed at", (a, e, act) => elementWords(a, e, act), ["Moving the pointer", "Moved the pointer"]],
|
|
1418
|
+
[
|
|
1419
|
+
/^(type|fill|input|input_text|type_text|insert_text|fill_form|send_keys_to)$/,
|
|
1420
|
+
"Typing into",
|
|
1421
|
+
"Typed into",
|
|
1422
|
+
(a, e, act) => elementWords(a, e, act),
|
|
1423
|
+
["Typing into a field", "Typed into a field"]
|
|
1424
|
+
],
|
|
1425
|
+
[
|
|
1426
|
+
/^(select|select_option|choose|select_dropdown_option)$/,
|
|
1427
|
+
"Choosing an option in",
|
|
1428
|
+
"Chose an option in",
|
|
1429
|
+
(a, e, act) => elementWords(a, e, act),
|
|
1430
|
+
["Choosing an option", "Chose an option"]
|
|
1431
|
+
],
|
|
1432
|
+
[
|
|
1433
|
+
/^(press|press_key|key|keypress|send_keys|hotkey)$/,
|
|
1434
|
+
"Pressing",
|
|
1435
|
+
"Pressed",
|
|
1436
|
+
(a) => cut(firstOf(a, ["key", "keys", "text"]), 30),
|
|
1437
|
+
["Pressing a key", "Pressed a key"]
|
|
1438
|
+
],
|
|
1439
|
+
[/^(scroll|scroll_down|scroll_up|wheel|scroll_page)$/, "Scrolling", "Scrolled", (a, e, act) => {
|
|
1440
|
+
const d = str(firstOf(a, ["direction", "scroll_direction"])).toLowerCase();
|
|
1441
|
+
if (/^(up|down|left|right)$/.test(d)) return d;
|
|
1442
|
+
if (/_up$/.test(act)) return "up";
|
|
1443
|
+
if (/_down$/.test(act)) return "down";
|
|
1444
|
+
const dy = Number(firstOf(a, ["pixels", "delta_y", "deltaY", "amount", "scroll_amount"]));
|
|
1445
|
+
return Number.isFinite(dy) && dy < 0 ? "up" : Number.isFinite(dy) && dy > 0 ? "down" : "";
|
|
1446
|
+
}, ["Scrolling the page", "Scrolled the page"]],
|
|
1447
|
+
[
|
|
1448
|
+
/^(screenshot|take_screenshot|capture|capture_screenshot)$/,
|
|
1449
|
+
"",
|
|
1450
|
+
"",
|
|
1451
|
+
null,
|
|
1452
|
+
["Taking a screenshot", "Took a screenshot"],
|
|
1453
|
+
(a) => a.full_page || a.fullPage ? ["Taking a screenshot of the whole page", "Took a screenshot of the whole page"] : null
|
|
1454
|
+
],
|
|
1455
|
+
[/^(snapshot|read|read_page|get_page|accessibility_snapshot|page_content|get_content|get_elements|observe)$/, "", "", null, ["Reading the page", "Read the page"]],
|
|
1456
|
+
[/^(extract_text|get_text|extract|text|extract_content|get_page_text)$/, "", "", null, ["Reading the page\u2019s text", "Read the page\u2019s text"]],
|
|
1457
|
+
[/^(get_url|url|current_url|location|get_title)$/, "", "", null, ["Checking the address", "Checked the address"]],
|
|
1458
|
+
[/^(wait|wait_for|wait_for_text|wait_for_selector|sleep)$/, "Waiting", "Waited", (a) => {
|
|
1459
|
+
const t = str(a.text).trim();
|
|
1460
|
+
if (t) return `for \u201C${cut(t, 40)}\u201D`;
|
|
1461
|
+
if (str(a.selector).trim()) return "for the page";
|
|
1462
|
+
const ms = a.ms != null ? Number(a.ms) : a.time != null ? Number(a.time) * 1e3 : Number(firstOf(a, ["timeout", "duration"]));
|
|
1463
|
+
return Number.isFinite(ms) && ms > 0 ? msWords(ms) : "";
|
|
1464
|
+
}, ["Waiting", "Waited"]],
|
|
1465
|
+
[/^(tabs|list_tabs|tab_list|get_tabs)$/, "", "", null, ["Listing the tabs", "Listed the tabs"]],
|
|
1466
|
+
[/^(switch_tab|tab_select|select_tab|focus_tab|switch_to_tab)$/, "", "", null, ["Switching tabs", "Switched tabs"]],
|
|
1467
|
+
[/^(close_tab|tab_close)$/, "", "", null, ["Closing a tab", "Closed a tab"]],
|
|
1468
|
+
[/^(close|quit|close_browser)$/, "", "", null, ["Closing the browser", "Closed the browser"]],
|
|
1469
|
+
[/^(drag|drag_and_drop|left_click_drag)$/, "", "", null, ["Dragging on the page", "Dragged on the page"]],
|
|
1470
|
+
[/^(file_upload|upload|upload_file|set_input_files)$/, "", "", null, ["Uploading a file", "Uploaded a file"]],
|
|
1471
|
+
[/^(handle_dialog|dialog|accept_dialog|dismiss_dialog)$/, "", "", null, ["Answering a dialog", "Answered a dialog"]],
|
|
1472
|
+
[/^(resize|set_viewport|resize_window)$/, "", "", null, ["Resizing the window", "Resized the window"]],
|
|
1473
|
+
[/^(evaluate|run_code|execute_js|eval|execute_script|run_javascript)$/, "", "", null, ["Running a script on the page", "Ran a script on the page"]],
|
|
1474
|
+
[/^(console_messages|console|get_console)$/, "", "", null, ["Reading the console", "Read the console"]],
|
|
1475
|
+
[/^(network_requests|network|get_network)$/, "", "", null, ["Reading the network requests", "Read the network requests"]],
|
|
1476
|
+
[/^(pdf_save|save_pdf|pdf|print_pdf)$/, "", "", null, ["Saving the page as a PDF", "Saved the page as a PDF"]],
|
|
1477
|
+
[/^(cursor_position)$/, "", "", null, ["Finding the pointer", "Found the pointer"]],
|
|
1478
|
+
[/^(install)$/, "", "", null, ["Installing the browser", "Installed the browser"]]
|
|
1479
|
+
];
|
|
1480
|
+
function describeBrowser(name, a, element) {
|
|
1481
|
+
const fromName = browserActOf(name) || "";
|
|
1482
|
+
const fromArgs = str(firstOf(a, ["action", "command", "type"])).trim();
|
|
1483
|
+
const act = (fromName && fromName !== "use" ? fromName : fromArgs || fromName).toLowerCase().replace(/[\s-]+/g, "_");
|
|
1484
|
+
const row = BROWSER_ACTS.find((r) => r[0].test(act));
|
|
1485
|
+
if (row) {
|
|
1486
|
+
const [, running, done, target, bare, special] = row;
|
|
1487
|
+
const sp = special ? special(a) : null;
|
|
1488
|
+
if (sp) return { running: sp[0], done: sp[1], target: "" };
|
|
1489
|
+
const t = target ? target(a, element, act) : "";
|
|
1490
|
+
return t ? { running, done, target: t } : { running: bare[0], done: bare[1], target: "" };
|
|
1491
|
+
}
|
|
1492
|
+
const u = str(firstOf(a, ["url", "href", "uri"]));
|
|
1493
|
+
return u ? { running: "Browsing", done: "Browsed", target: shortUrl(u) } : { running: "Using the browser", done: "Used the browser", target: "" };
|
|
1494
|
+
}
|
|
1495
|
+
function browserElements(items) {
|
|
1496
|
+
const out = {};
|
|
1497
|
+
let refs = /* @__PURE__ */ new Map();
|
|
1498
|
+
for (const it of items || []) {
|
|
1499
|
+
if (!it || it.kind !== "tool" || toolKind(it.name) !== "browser") continue;
|
|
1500
|
+
const a = parseToolArgs(it.args);
|
|
1501
|
+
const ref = str(firstOf(a, ["ref", "element_ref"])).trim();
|
|
1502
|
+
if (ref && refs.has(ref)) out[it.id] = refs.get(ref);
|
|
1503
|
+
const text = str(it.output);
|
|
1504
|
+
if (!text) continue;
|
|
1505
|
+
const next = /* @__PURE__ */ new Map();
|
|
1506
|
+
for (const ln of text.split("\n")) {
|
|
1507
|
+
let m = ln.match(/^\s*(e\d+)\s+([a-z]+)\s+"(.*?)"/i);
|
|
1508
|
+
if (m) {
|
|
1509
|
+
next.set(m[1], { role: m[2], name: m[3] });
|
|
1510
|
+
continue;
|
|
1511
|
+
}
|
|
1512
|
+
m = ln.match(/^\s*-\s+([a-z]+)(?:\s+"(.*?)")?[^\n]*\[ref=(e\d+)\]/i);
|
|
1513
|
+
if (m) next.set(m[3], { role: m[1], name: m[2] || "" });
|
|
1514
|
+
}
|
|
1515
|
+
if (next.size) refs = next;
|
|
1516
|
+
}
|
|
1517
|
+
return out;
|
|
1518
|
+
}
|
|
1329
1519
|
var VERBS = {
|
|
1330
1520
|
shell: ["Running", "Ran"],
|
|
1331
1521
|
shell_output: ["Reading output of", "Read output of"],
|
|
@@ -1346,7 +1536,7 @@ var VERBS = {
|
|
|
1346
1536
|
mcp: ["Using", "Used"],
|
|
1347
1537
|
tool: ["Using", "Used"]
|
|
1348
1538
|
};
|
|
1349
|
-
function describeTool(name, args) {
|
|
1539
|
+
function describeTool(name, args, opts) {
|
|
1350
1540
|
const a = parseToolArgs(args);
|
|
1351
1541
|
let kind = toolKind(name);
|
|
1352
1542
|
const nm = str(name);
|
|
@@ -1356,6 +1546,7 @@ function describeTool(name, args) {
|
|
|
1356
1546
|
let targetFull = "";
|
|
1357
1547
|
let mono = false;
|
|
1358
1548
|
let note = "";
|
|
1549
|
+
let browser = null;
|
|
1359
1550
|
const pathOf = () => firstOf(a, [
|
|
1360
1551
|
"file_path",
|
|
1361
1552
|
"path",
|
|
@@ -1433,11 +1624,9 @@ function describeTool(name, args) {
|
|
|
1433
1624
|
targetFull = target;
|
|
1434
1625
|
break;
|
|
1435
1626
|
case "browser": {
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
targetFull = target;
|
|
1440
|
-
if (/^browser[_\-.]/i.test(nm)) note = humanizeName(nm.replace(/^browser[_\-.]/i, ""));
|
|
1627
|
+
browser = describeBrowser(nm, a, opts && opts.element);
|
|
1628
|
+
target = browser.target;
|
|
1629
|
+
targetFull = str(firstOf(a, ["url", "href", "uri"])) || target;
|
|
1441
1630
|
break;
|
|
1442
1631
|
}
|
|
1443
1632
|
case "mcp":
|
|
@@ -1449,7 +1638,7 @@ function describeTool(name, args) {
|
|
|
1449
1638
|
default:
|
|
1450
1639
|
break;
|
|
1451
1640
|
}
|
|
1452
|
-
const v = VERBS[kind] || VERBS.tool;
|
|
1641
|
+
const v = browser ? [browser.running, browser.done] : VERBS[kind] || VERBS.tool;
|
|
1453
1642
|
return {
|
|
1454
1643
|
kind,
|
|
1455
1644
|
target: target.replace(/\s+/g, " ").trim(),
|
|
@@ -1467,7 +1656,9 @@ function toolLine(d, state) {
|
|
|
1467
1656
|
if (d.kind === "todo" || d.kind === "toolsearch" || d.kind === "think") return verb;
|
|
1468
1657
|
if (d.kind === "shell" && d.target && !d.mono) return d.target;
|
|
1469
1658
|
if (d.kind === "mcp" || d.kind === "tool") return `${verb} ${d.target || "a tool"}`;
|
|
1470
|
-
|
|
1659
|
+
if (d.target) return `${verb} ${d.target}`;
|
|
1660
|
+
const noun = KIND_NOUN[d.kind];
|
|
1661
|
+
return noun ? `${verb} ${noun}` : verb.replace(/\s+(for|of)$/, "");
|
|
1471
1662
|
}
|
|
1472
1663
|
var KIND_NOUN = {
|
|
1473
1664
|
shell: "a command",
|
|
@@ -1507,7 +1698,7 @@ var PHRASES = {
|
|
|
1507
1698
|
function summarizeCalls(calls) {
|
|
1508
1699
|
const list = (calls || []).filter(Boolean);
|
|
1509
1700
|
if (!list.length) return "";
|
|
1510
|
-
if (list.length === 1) return toolLine(describeTool(list[0].name, list[0].args), "done");
|
|
1701
|
+
if (list.length === 1) return toolLine(describeTool(list[0].name, list[0].args, { element: list[0].element }), "done");
|
|
1511
1702
|
const order = [];
|
|
1512
1703
|
const count = {};
|
|
1513
1704
|
for (const c of list) {
|
|
@@ -2233,8 +2424,9 @@ function StepDetail(props) {
|
|
|
2233
2424
|
] });
|
|
2234
2425
|
}
|
|
2235
2426
|
function StepRow(props) {
|
|
2236
|
-
const { item, labels = DEFAULT_AGENT_LABELS, defaultOpen = false } = props;
|
|
2237
|
-
const d = (0, import_react8.useMemo)(() => describeTool(item.name, item.args), [item.name, item.args]);
|
|
2427
|
+
const { item, labels = DEFAULT_AGENT_LABELS, defaultOpen = false, element = null, openStep, active = false } = props;
|
|
2428
|
+
const d = (0, import_react8.useMemo)(() => describeTool(item.name, item.args, { element }), [item.name, item.args, element]);
|
|
2429
|
+
const opener = openStep ? openStep(item, d) || null : null;
|
|
2238
2430
|
const [open, setOpen] = (0, import_react8.useState)(defaultOpen);
|
|
2239
2431
|
const uid2 = (0, import_react8.useRef)(`uac-s-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
2240
2432
|
const running = item.status === "running";
|
|
@@ -2244,8 +2436,8 @@ function StepRow(props) {
|
|
|
2244
2436
|
const verb = running ? d.running : d.done;
|
|
2245
2437
|
const hasTarget = d.target && line === `${verb} ${d.target}`;
|
|
2246
2438
|
const note = !running && item.status !== "failed" ? resultNote(d.kind, item.output) : "";
|
|
2247
|
-
const hasDetail = !!(item.args && item.args !== "{}" && item.args !== '""') || item.output !== void 0;
|
|
2248
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cls("uac-step", `is-${item.status}
|
|
2439
|
+
const hasDetail = !opener && (!!(item.args && item.args !== "{}" && item.args !== '""') || item.output !== void 0);
|
|
2440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cls("uac-step", `is-${item.status}`, opener && "is-opens", opener && active && "is-active"), "data-kind": d.kind, children: [
|
|
2249
2441
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2250
2442
|
"button",
|
|
2251
2443
|
{
|
|
@@ -2253,8 +2445,9 @@ function StepRow(props) {
|
|
|
2253
2445
|
className: "uac-step-h",
|
|
2254
2446
|
"aria-expanded": hasDetail ? open : void 0,
|
|
2255
2447
|
"aria-controls": hasDetail ? uid2 : void 0,
|
|
2256
|
-
|
|
2257
|
-
|
|
2448
|
+
"aria-current": opener && active ? "true" : void 0,
|
|
2449
|
+
disabled: !opener && !hasDetail,
|
|
2450
|
+
onClick: opener || (() => setOpen((v) => !v)),
|
|
2258
2451
|
title: d.targetFull || void 0,
|
|
2259
2452
|
children: [
|
|
2260
2453
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StatusGlyph, { status: item.status, kind: d.kind }),
|
|
@@ -2270,7 +2463,7 @@ function StepRow(props) {
|
|
|
2270
2463
|
note ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uac-step-n", children: note }) : null,
|
|
2271
2464
|
item.status === "stopped" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uac-step-n", children: labels.stoppedCall }) : null,
|
|
2272
2465
|
running && runMs != null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uac-step-time", children: formatElapsed(runMs) }) : tookMs != null && tookMs >= 1e3 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uac-step-time", children: formatDuration(tookMs) }) : null,
|
|
2273
|
-
hasDetail ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uac-chev", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Chevron, { dir: open ? "down" : "right", size: 12 }) }) : null
|
|
2466
|
+
hasDetail || opener ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uac-chev", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Chevron, { dir: open && !opener ? "down" : "right", size: 12 }) }) : null
|
|
2274
2467
|
]
|
|
2275
2468
|
}
|
|
2276
2469
|
),
|
|
@@ -2322,14 +2515,26 @@ function sumDiff(tools) {
|
|
|
2322
2515
|
return any ? { added, removed } : null;
|
|
2323
2516
|
}
|
|
2324
2517
|
function WorkGroup(props) {
|
|
2325
|
-
const {
|
|
2518
|
+
const {
|
|
2519
|
+
items,
|
|
2520
|
+
live = false,
|
|
2521
|
+
liveLabel,
|
|
2522
|
+
start = null,
|
|
2523
|
+
mark,
|
|
2524
|
+
motion,
|
|
2525
|
+
labels = DEFAULT_AGENT_LABELS,
|
|
2526
|
+
defaultOpen = false,
|
|
2527
|
+
elements = null,
|
|
2528
|
+
openStep,
|
|
2529
|
+
activeStep = null
|
|
2530
|
+
} = props;
|
|
2326
2531
|
const [open, setOpen] = (0, import_react8.useState)(defaultOpen);
|
|
2327
2532
|
const uid2 = (0, import_react8.useRef)(`uac-g-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
2328
2533
|
const tools = items.filter((x) => x.kind === "tool");
|
|
2329
2534
|
const thoughts = items.filter((x) => x.kind === "thinking");
|
|
2330
2535
|
const failed = tools.filter((x) => x.status === "failed").length;
|
|
2331
2536
|
let summary = "";
|
|
2332
|
-
if (tools.length) summary = summarizeCalls(tools);
|
|
2537
|
+
if (tools.length) summary = summarizeCalls(elements ? tools.map((t) => ({ name: t.name, args: t.args, element: elements[t.id] })) : tools);
|
|
2333
2538
|
else if (thoughts.length) {
|
|
2334
2539
|
const t = thoughts[0];
|
|
2335
2540
|
const ms = t.startedAt != null && t.endedAt != null ? t.endedAt - t.startedAt : null;
|
|
@@ -2337,7 +2542,17 @@ function WorkGroup(props) {
|
|
|
2337
2542
|
}
|
|
2338
2543
|
const diff = sumDiff(tools);
|
|
2339
2544
|
if (!live && !tools.length && !thoughts.some((t) => String(t.text || "").trim())) return null;
|
|
2340
|
-
const body = open ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "uac-calls", id: uid2, children: items.map((it) => it.kind === "tool" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2545
|
+
const body = open ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "uac-calls", id: uid2, children: items.map((it) => it.kind === "tool" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2546
|
+
StepRow,
|
|
2547
|
+
{
|
|
2548
|
+
item: it,
|
|
2549
|
+
labels,
|
|
2550
|
+
element: elements ? elements[it.id] || null : null,
|
|
2551
|
+
openStep,
|
|
2552
|
+
active: activeStep != null && activeStep === it.id
|
|
2553
|
+
},
|
|
2554
|
+
it.id
|
|
2555
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ThinkingRow, { item: it, labels }, it.id)) }) : null;
|
|
2341
2556
|
if (live) {
|
|
2342
2557
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cls("uac-group", "is-live", open && "is-open"), children: [
|
|
2343
2558
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
@@ -2475,9 +2690,13 @@ function AgentTurnView(props) {
|
|
|
2475
2690
|
renderFiles,
|
|
2476
2691
|
actions,
|
|
2477
2692
|
describeIncomplete,
|
|
2478
|
-
liveStart
|
|
2693
|
+
liveStart,
|
|
2694
|
+
openStep,
|
|
2695
|
+
activeStep = null
|
|
2479
2696
|
} = props;
|
|
2480
2697
|
const labels = (0, import_react8.useMemo)(() => ({ ...DEFAULT_AGENT_LABELS, ...labelsIn || {} }), [labelsIn]);
|
|
2698
|
+
const items = turn ? turn.items : null;
|
|
2699
|
+
const elements = (0, import_react8.useMemo)(() => browserElements(items), [items]);
|
|
2481
2700
|
if (!turn) return null;
|
|
2482
2701
|
const running = turn.status === "running";
|
|
2483
2702
|
const segs = segments(turn);
|
|
@@ -2488,7 +2707,7 @@ function AgentTurnView(props) {
|
|
|
2488
2707
|
const liveWork = running && lastSeg && lastSeg.type === "work";
|
|
2489
2708
|
let liveLabel = labels.thinking;
|
|
2490
2709
|
if (now) {
|
|
2491
|
-
if (now.phase === "tool" && now.tool) liveLabel = toolLine(describeTool(now.tool.name, now.tool.args), "running");
|
|
2710
|
+
if (now.phase === "tool" && now.tool) liveLabel = toolLine(describeTool(now.tool.name, now.tool.args, { element: elements[now.tool.id] }), "running");
|
|
2492
2711
|
else if (now.phase === "writing") liveLabel = labels.writing;
|
|
2493
2712
|
else if (now.phase === "starting") liveLabel = labels.starting;
|
|
2494
2713
|
}
|
|
@@ -2506,7 +2725,21 @@ function AgentTurnView(props) {
|
|
|
2506
2725
|
if (isLive) {
|
|
2507
2726
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react8.default.Fragment, { children: [
|
|
2508
2727
|
plan ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TodoCard, { todos: plan, labels, running: true }) : null,
|
|
2509
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2728
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2729
|
+
WorkGroup,
|
|
2730
|
+
{
|
|
2731
|
+
items: s.items,
|
|
2732
|
+
live: true,
|
|
2733
|
+
liveLabel,
|
|
2734
|
+
start,
|
|
2735
|
+
mark,
|
|
2736
|
+
motion,
|
|
2737
|
+
labels,
|
|
2738
|
+
elements,
|
|
2739
|
+
openStep,
|
|
2740
|
+
activeStep
|
|
2741
|
+
}
|
|
2742
|
+
)
|
|
2510
2743
|
] }, `w${i}`);
|
|
2511
2744
|
}
|
|
2512
2745
|
if (s.type === "text") {
|
|
@@ -2520,7 +2753,17 @@ function AgentTurnView(props) {
|
|
|
2520
2753
|
s.item.id || `t${i}`
|
|
2521
2754
|
);
|
|
2522
2755
|
}
|
|
2523
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2757
|
+
WorkGroup,
|
|
2758
|
+
{
|
|
2759
|
+
items: s.items,
|
|
2760
|
+
labels,
|
|
2761
|
+
elements,
|
|
2762
|
+
openStep,
|
|
2763
|
+
activeStep
|
|
2764
|
+
},
|
|
2765
|
+
`w${i}-${s.items[0] && s.items[0].id}`
|
|
2766
|
+
);
|
|
2524
2767
|
}),
|
|
2525
2768
|
!liveWork && plan ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TodoCard, { todos: plan, labels, running }) : null,
|
|
2526
2769
|
running && !liveWork ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(WorkingIndicator, { mark, motion, start, label: liveLabel }) : null,
|