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