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/README.md
CHANGED
|
@@ -227,7 +227,7 @@ the response's own `usage`. `turnFromHistory` (a session's turns feed), `turnFro
|
|
|
227
227
|
response) and `turnFromMessage` (a `ChatMessages` blocks message, optionally timed by a clock turn)
|
|
228
228
|
build the same Turn from what a host already holds. `describeTool(name, args)` reads every harness's
|
|
229
229
|
tool vocabulary (Claude Code, Codex, Gemini CLI, Hermes, Goose, OpenCode, OpenHands, pi, Kimi …)
|
|
230
|
-
into a kind, a target, lines added and removed, and the plan. The package ships the motions, never
|
|
230
|
+
into a kind, a target, lines added and removed, and the plan; a browser call reads as what it did ("Clicked the “About” link"). `openStep(item, d)` lets the host open a call in a place of its own (a browser step opens the live browser beside the conversation) instead of unfolding it. The package ships the motions, never
|
|
231
231
|
the logos: pass your mark as a node and `motionFor(base)` names a motion, or none for three dots.
|
|
232
232
|
All motion stops under `prefers-reduced-motion`.
|
|
233
233
|
|
package/dist/agent-chat.cjs
CHANGED
|
@@ -53,6 +53,8 @@ __export(agent_chat_exports, {
|
|
|
53
53
|
WorkingIndicator: () => WorkingIndicator,
|
|
54
54
|
WorkingMark: () => WorkingMark,
|
|
55
55
|
baseNameOf: () => baseNameOf,
|
|
56
|
+
browserActOf: () => browserActOf,
|
|
57
|
+
browserElements: () => browserElements,
|
|
56
58
|
commandText: () => commandText,
|
|
57
59
|
describeTool: () => describeTool,
|
|
58
60
|
diffOf: () => diffOf,
|
|
@@ -119,7 +121,8 @@ kinds("shell", [
|
|
|
119
121
|
"exec",
|
|
120
122
|
"run",
|
|
121
123
|
"sh",
|
|
122
|
-
"process"
|
|
124
|
+
"process",
|
|
125
|
+
"execute"
|
|
123
126
|
]);
|
|
124
127
|
kinds("shell_output", ["bashoutput", "bash_output", "killshell", "kill_shell", "killbash"]);
|
|
125
128
|
kinds("read", [
|
|
@@ -229,6 +232,7 @@ var NS = /^(developer|platform|computercontroller|builtin|default|functions|tool
|
|
|
229
232
|
function toolKind(name) {
|
|
230
233
|
const raw = String(name || "").trim();
|
|
231
234
|
if (!raw) return "tool";
|
|
235
|
+
if (browserActOf(raw) !== null) return "browser";
|
|
232
236
|
if (/^mcp__/i.test(raw)) return "mcp";
|
|
233
237
|
const n = raw.toLowerCase().replace(NS, "");
|
|
234
238
|
if (KIND_BY_NAME[n]) return KIND_BY_NAME[n];
|
|
@@ -379,6 +383,195 @@ function shortUrl(u) {
|
|
|
379
383
|
function humanizeName(n) {
|
|
380
384
|
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());
|
|
381
385
|
}
|
|
386
|
+
var NS_BROWSER = /^(?:mcp__.+?__|[a-z0-9_-]+?(?:__|\.))(browser[_\-.].+)$/i;
|
|
387
|
+
var BROWSER_SERVER = /^(?:mcp__)?(?:browser|playwright|puppeteer|browserbase|browser[_-]use|chrome[_-]?devtools)(?:__|\.)(.+)$/i;
|
|
388
|
+
function browserActOf(name) {
|
|
389
|
+
const raw = String(name || "").trim();
|
|
390
|
+
if (!raw) return null;
|
|
391
|
+
const n = raw.toLowerCase().replace(NS, "");
|
|
392
|
+
if (KIND_BY_NAME[n] === "browser") return n === "navigate" || n === "screenshot" ? n : "";
|
|
393
|
+
let m = n.match(/^(?:browser|playwright|computer)[_\-.](.+)$/);
|
|
394
|
+
if (m) return m[1];
|
|
395
|
+
m = raw.match(NS_BROWSER);
|
|
396
|
+
if (m) return m[1].replace(/^browser[_\-.]/i, "").toLowerCase();
|
|
397
|
+
m = raw.match(BROWSER_SERVER);
|
|
398
|
+
if (m) return m[1].replace(/^browser[_\-.]/i, "").toLowerCase();
|
|
399
|
+
if (/[_\-.]browser$/.test(n)) return "";
|
|
400
|
+
return null;
|
|
401
|
+
}
|
|
402
|
+
var ROLE_NOUN = {
|
|
403
|
+
link: "link",
|
|
404
|
+
button: "button",
|
|
405
|
+
submit: "button",
|
|
406
|
+
textbox: "field",
|
|
407
|
+
searchbox: "search field",
|
|
408
|
+
combobox: "list",
|
|
409
|
+
listbox: "list",
|
|
410
|
+
checkbox: "checkbox",
|
|
411
|
+
radio: "option",
|
|
412
|
+
option: "option",
|
|
413
|
+
tab: "tab",
|
|
414
|
+
menuitem: "menu item",
|
|
415
|
+
heading: "heading",
|
|
416
|
+
img: "image",
|
|
417
|
+
image: "image",
|
|
418
|
+
switch: "switch",
|
|
419
|
+
slider: "slider"
|
|
420
|
+
};
|
|
421
|
+
function cut(s, max) {
|
|
422
|
+
const t = str(s).replace(/\s+/g, " ").trim();
|
|
423
|
+
return t.length > max ? `${t.slice(0, max - 1).trimEnd()}\u2026` : t;
|
|
424
|
+
}
|
|
425
|
+
function elementWords(a, element, act) {
|
|
426
|
+
const desc = str(firstOf(a, ["element", "element_description", "description", "label"])).trim();
|
|
427
|
+
if (desc) return cut(desc, 60);
|
|
428
|
+
if (element && element.role) {
|
|
429
|
+
const noun = ROLE_NOUN[String(element.role).toLowerCase()] || "";
|
|
430
|
+
const name = cut(element.name, 40);
|
|
431
|
+
if (noun && name) return `the \u201C${name}\u201D ${noun}`;
|
|
432
|
+
if (noun) return `a ${noun}`;
|
|
433
|
+
if (name) return `\u201C${name}\u201D`;
|
|
434
|
+
}
|
|
435
|
+
const sel = str(a.selector).trim().toLowerCase();
|
|
436
|
+
if (sel) {
|
|
437
|
+
if (/^a(?=$|[\s.#[:>])|role=["']?link/.test(sel)) return "a link";
|
|
438
|
+
if (/^button|\[type=["']?submit|role=["']?button/.test(sel)) return "a button";
|
|
439
|
+
if (/^(input|textarea)|role=["']?(textbox|searchbox)|contenteditable/.test(sel)) return "a field";
|
|
440
|
+
if (/^select|role=["']?(combobox|listbox)/.test(sel)) return "a list";
|
|
441
|
+
}
|
|
442
|
+
if (act === "click") {
|
|
443
|
+
const t = str(a.text).trim();
|
|
444
|
+
if (t) return `\u201C${cut(t, 40)}\u201D`;
|
|
445
|
+
}
|
|
446
|
+
return "";
|
|
447
|
+
}
|
|
448
|
+
function msWords(ms) {
|
|
449
|
+
const s = Math.round(Number(ms) / 100) / 10;
|
|
450
|
+
return s >= 1 ? `${s}s` : `${Math.round(Number(ms))} ms`;
|
|
451
|
+
}
|
|
452
|
+
var BROWSER_ACTS = [
|
|
453
|
+
[
|
|
454
|
+
/^(navigate|goto|go_to|open|open_url|visit|new_tab|tab_new|browse|go)$/,
|
|
455
|
+
"Opening",
|
|
456
|
+
"Opened",
|
|
457
|
+
(a) => {
|
|
458
|
+
const u = str(firstOf(a, ["url", "href", "uri", "link", "address"]));
|
|
459
|
+
return u ? shortUrl(u) : "";
|
|
460
|
+
},
|
|
461
|
+
["Opening a page", "Opened a page"]
|
|
462
|
+
],
|
|
463
|
+
[/^(navigate_back|back|go_back|history_back)$/, "", "", null, ["Going back a page", "Went back a page"]],
|
|
464
|
+
[/^(navigate_forward|forward|go_forward)$/, "", "", null, ["Going forward a page", "Went forward a page"]],
|
|
465
|
+
[/^(reload|refresh)$/, "", "", null, ["Reloading the page", "Reloaded the page"]],
|
|
466
|
+
[
|
|
467
|
+
/^(click|left_click|double_click|right_click|triple_click|middle_click|tap|click_element)$/,
|
|
468
|
+
"Clicking",
|
|
469
|
+
"Clicked",
|
|
470
|
+
(a, e, act) => elementWords(a, e, act),
|
|
471
|
+
["Clicking on the page", "Clicked on the page"]
|
|
472
|
+
],
|
|
473
|
+
[/^(hover|mouse_move|move_mouse)$/, "Pointing at", "Pointed at", (a, e, act) => elementWords(a, e, act), ["Moving the pointer", "Moved the pointer"]],
|
|
474
|
+
[
|
|
475
|
+
/^(type|fill|input|input_text|type_text|insert_text|fill_form|send_keys_to)$/,
|
|
476
|
+
"Typing into",
|
|
477
|
+
"Typed into",
|
|
478
|
+
(a, e, act) => elementWords(a, e, act),
|
|
479
|
+
["Typing into a field", "Typed into a field"]
|
|
480
|
+
],
|
|
481
|
+
[
|
|
482
|
+
/^(select|select_option|choose|select_dropdown_option)$/,
|
|
483
|
+
"Choosing an option in",
|
|
484
|
+
"Chose an option in",
|
|
485
|
+
(a, e, act) => elementWords(a, e, act),
|
|
486
|
+
["Choosing an option", "Chose an option"]
|
|
487
|
+
],
|
|
488
|
+
[
|
|
489
|
+
/^(press|press_key|key|keypress|send_keys|hotkey)$/,
|
|
490
|
+
"Pressing",
|
|
491
|
+
"Pressed",
|
|
492
|
+
(a) => cut(firstOf(a, ["key", "keys", "text"]), 30),
|
|
493
|
+
["Pressing a key", "Pressed a key"]
|
|
494
|
+
],
|
|
495
|
+
[/^(scroll|scroll_down|scroll_up|wheel|scroll_page)$/, "Scrolling", "Scrolled", (a, e, act) => {
|
|
496
|
+
const d = str(firstOf(a, ["direction", "scroll_direction"])).toLowerCase();
|
|
497
|
+
if (/^(up|down|left|right)$/.test(d)) return d;
|
|
498
|
+
if (/_up$/.test(act)) return "up";
|
|
499
|
+
if (/_down$/.test(act)) return "down";
|
|
500
|
+
const dy = Number(firstOf(a, ["pixels", "delta_y", "deltaY", "amount", "scroll_amount"]));
|
|
501
|
+
return Number.isFinite(dy) && dy < 0 ? "up" : Number.isFinite(dy) && dy > 0 ? "down" : "";
|
|
502
|
+
}, ["Scrolling the page", "Scrolled the page"]],
|
|
503
|
+
[
|
|
504
|
+
/^(screenshot|take_screenshot|capture|capture_screenshot)$/,
|
|
505
|
+
"",
|
|
506
|
+
"",
|
|
507
|
+
null,
|
|
508
|
+
["Taking a screenshot", "Took a screenshot"],
|
|
509
|
+
(a) => a.full_page || a.fullPage ? ["Taking a screenshot of the whole page", "Took a screenshot of the whole page"] : null
|
|
510
|
+
],
|
|
511
|
+
[/^(snapshot|read|read_page|get_page|accessibility_snapshot|page_content|get_content|get_elements|observe)$/, "", "", null, ["Reading the page", "Read the page"]],
|
|
512
|
+
[/^(extract_text|get_text|extract|text|extract_content|get_page_text)$/, "", "", null, ["Reading the page\u2019s text", "Read the page\u2019s text"]],
|
|
513
|
+
[/^(get_url|url|current_url|location|get_title)$/, "", "", null, ["Checking the address", "Checked the address"]],
|
|
514
|
+
[/^(wait|wait_for|wait_for_text|wait_for_selector|sleep)$/, "Waiting", "Waited", (a) => {
|
|
515
|
+
const t = str(a.text).trim();
|
|
516
|
+
if (t) return `for \u201C${cut(t, 40)}\u201D`;
|
|
517
|
+
if (str(a.selector).trim()) return "for the page";
|
|
518
|
+
const ms = a.ms != null ? Number(a.ms) : a.time != null ? Number(a.time) * 1e3 : Number(firstOf(a, ["timeout", "duration"]));
|
|
519
|
+
return Number.isFinite(ms) && ms > 0 ? msWords(ms) : "";
|
|
520
|
+
}, ["Waiting", "Waited"]],
|
|
521
|
+
[/^(tabs|list_tabs|tab_list|get_tabs)$/, "", "", null, ["Listing the tabs", "Listed the tabs"]],
|
|
522
|
+
[/^(switch_tab|tab_select|select_tab|focus_tab|switch_to_tab)$/, "", "", null, ["Switching tabs", "Switched tabs"]],
|
|
523
|
+
[/^(close_tab|tab_close)$/, "", "", null, ["Closing a tab", "Closed a tab"]],
|
|
524
|
+
[/^(close|quit|close_browser)$/, "", "", null, ["Closing the browser", "Closed the browser"]],
|
|
525
|
+
[/^(drag|drag_and_drop|left_click_drag)$/, "", "", null, ["Dragging on the page", "Dragged on the page"]],
|
|
526
|
+
[/^(file_upload|upload|upload_file|set_input_files)$/, "", "", null, ["Uploading a file", "Uploaded a file"]],
|
|
527
|
+
[/^(handle_dialog|dialog|accept_dialog|dismiss_dialog)$/, "", "", null, ["Answering a dialog", "Answered a dialog"]],
|
|
528
|
+
[/^(resize|set_viewport|resize_window)$/, "", "", null, ["Resizing the window", "Resized the window"]],
|
|
529
|
+
[/^(evaluate|run_code|execute_js|eval|execute_script|run_javascript)$/, "", "", null, ["Running a script on the page", "Ran a script on the page"]],
|
|
530
|
+
[/^(console_messages|console|get_console)$/, "", "", null, ["Reading the console", "Read the console"]],
|
|
531
|
+
[/^(network_requests|network|get_network)$/, "", "", null, ["Reading the network requests", "Read the network requests"]],
|
|
532
|
+
[/^(pdf_save|save_pdf|pdf|print_pdf)$/, "", "", null, ["Saving the page as a PDF", "Saved the page as a PDF"]],
|
|
533
|
+
[/^(cursor_position)$/, "", "", null, ["Finding the pointer", "Found the pointer"]],
|
|
534
|
+
[/^(install)$/, "", "", null, ["Installing the browser", "Installed the browser"]]
|
|
535
|
+
];
|
|
536
|
+
function describeBrowser(name, a, element) {
|
|
537
|
+
const fromName = browserActOf(name) || "";
|
|
538
|
+
const fromArgs = str(firstOf(a, ["action", "command", "type"])).trim();
|
|
539
|
+
const act = (fromName && fromName !== "use" ? fromName : fromArgs || fromName).toLowerCase().replace(/[\s-]+/g, "_");
|
|
540
|
+
const row = BROWSER_ACTS.find((r) => r[0].test(act));
|
|
541
|
+
if (row) {
|
|
542
|
+
const [, running, done, target, bare, special] = row;
|
|
543
|
+
const sp = special ? special(a) : null;
|
|
544
|
+
if (sp) return { running: sp[0], done: sp[1], target: "" };
|
|
545
|
+
const t = target ? target(a, element, act) : "";
|
|
546
|
+
return t ? { running, done, target: t } : { running: bare[0], done: bare[1], target: "" };
|
|
547
|
+
}
|
|
548
|
+
const u = str(firstOf(a, ["url", "href", "uri"]));
|
|
549
|
+
return u ? { running: "Browsing", done: "Browsed", target: shortUrl(u) } : { running: "Using the browser", done: "Used the browser", target: "" };
|
|
550
|
+
}
|
|
551
|
+
function browserElements(items) {
|
|
552
|
+
const out = {};
|
|
553
|
+
let refs = /* @__PURE__ */ new Map();
|
|
554
|
+
for (const it of items || []) {
|
|
555
|
+
if (!it || it.kind !== "tool" || toolKind(it.name) !== "browser") continue;
|
|
556
|
+
const a = parseToolArgs(it.args);
|
|
557
|
+
const ref = str(firstOf(a, ["ref", "element_ref"])).trim();
|
|
558
|
+
if (ref && refs.has(ref)) out[it.id] = refs.get(ref);
|
|
559
|
+
const text = str(it.output);
|
|
560
|
+
if (!text) continue;
|
|
561
|
+
const next = /* @__PURE__ */ new Map();
|
|
562
|
+
for (const ln of text.split("\n")) {
|
|
563
|
+
let m = ln.match(/^\s*(e\d+)\s+([a-z]+)\s+"(.*?)"/i);
|
|
564
|
+
if (m) {
|
|
565
|
+
next.set(m[1], { role: m[2], name: m[3] });
|
|
566
|
+
continue;
|
|
567
|
+
}
|
|
568
|
+
m = ln.match(/^\s*-\s+([a-z]+)(?:\s+"(.*?)")?[^\n]*\[ref=(e\d+)\]/i);
|
|
569
|
+
if (m) next.set(m[3], { role: m[1], name: m[2] || "" });
|
|
570
|
+
}
|
|
571
|
+
if (next.size) refs = next;
|
|
572
|
+
}
|
|
573
|
+
return out;
|
|
574
|
+
}
|
|
382
575
|
var VERBS = {
|
|
383
576
|
shell: ["Running", "Ran"],
|
|
384
577
|
shell_output: ["Reading output of", "Read output of"],
|
|
@@ -399,7 +592,7 @@ var VERBS = {
|
|
|
399
592
|
mcp: ["Using", "Used"],
|
|
400
593
|
tool: ["Using", "Used"]
|
|
401
594
|
};
|
|
402
|
-
function describeTool(name, args) {
|
|
595
|
+
function describeTool(name, args, opts) {
|
|
403
596
|
const a = parseToolArgs(args);
|
|
404
597
|
let kind = toolKind(name);
|
|
405
598
|
const nm = str(name);
|
|
@@ -409,6 +602,7 @@ function describeTool(name, args) {
|
|
|
409
602
|
let targetFull = "";
|
|
410
603
|
let mono = false;
|
|
411
604
|
let note = "";
|
|
605
|
+
let browser = null;
|
|
412
606
|
const pathOf = () => firstOf(a, [
|
|
413
607
|
"file_path",
|
|
414
608
|
"path",
|
|
@@ -486,11 +680,9 @@ function describeTool(name, args) {
|
|
|
486
680
|
targetFull = target;
|
|
487
681
|
break;
|
|
488
682
|
case "browser": {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
targetFull = target;
|
|
493
|
-
if (/^browser[_\-.]/i.test(nm)) note = humanizeName(nm.replace(/^browser[_\-.]/i, ""));
|
|
683
|
+
browser = describeBrowser(nm, a, opts && opts.element);
|
|
684
|
+
target = browser.target;
|
|
685
|
+
targetFull = str(firstOf(a, ["url", "href", "uri"])) || target;
|
|
494
686
|
break;
|
|
495
687
|
}
|
|
496
688
|
case "mcp":
|
|
@@ -502,7 +694,7 @@ function describeTool(name, args) {
|
|
|
502
694
|
default:
|
|
503
695
|
break;
|
|
504
696
|
}
|
|
505
|
-
const v = VERBS[kind] || VERBS.tool;
|
|
697
|
+
const v = browser ? [browser.running, browser.done] : VERBS[kind] || VERBS.tool;
|
|
506
698
|
return {
|
|
507
699
|
kind,
|
|
508
700
|
target: target.replace(/\s+/g, " ").trim(),
|
|
@@ -520,7 +712,9 @@ function toolLine(d, state) {
|
|
|
520
712
|
if (d.kind === "todo" || d.kind === "toolsearch" || d.kind === "think") return verb;
|
|
521
713
|
if (d.kind === "shell" && d.target && !d.mono) return d.target;
|
|
522
714
|
if (d.kind === "mcp" || d.kind === "tool") return `${verb} ${d.target || "a tool"}`;
|
|
523
|
-
|
|
715
|
+
if (d.target) return `${verb} ${d.target}`;
|
|
716
|
+
const noun = KIND_NOUN[d.kind];
|
|
717
|
+
return noun ? `${verb} ${noun}` : verb.replace(/\s+(for|of)$/, "");
|
|
524
718
|
}
|
|
525
719
|
var KIND_NOUN = {
|
|
526
720
|
shell: "a command",
|
|
@@ -560,7 +754,7 @@ var PHRASES = {
|
|
|
560
754
|
function summarizeCalls(calls) {
|
|
561
755
|
const list = (calls || []).filter(Boolean);
|
|
562
756
|
if (!list.length) return "";
|
|
563
|
-
if (list.length === 1) return toolLine(describeTool(list[0].name, list[0].args), "done");
|
|
757
|
+
if (list.length === 1) return toolLine(describeTool(list[0].name, list[0].args, { element: list[0].element }), "done");
|
|
564
758
|
const order = [];
|
|
565
759
|
const count = {};
|
|
566
760
|
for (const c of list) {
|
|
@@ -1480,8 +1674,9 @@ function StepDetail(props) {
|
|
|
1480
1674
|
] });
|
|
1481
1675
|
}
|
|
1482
1676
|
function StepRow(props) {
|
|
1483
|
-
const { item, labels = DEFAULT_AGENT_LABELS, defaultOpen = false } = props;
|
|
1484
|
-
const d = (0, import_react3.useMemo)(() => describeTool(item.name, item.args), [item.name, item.args]);
|
|
1677
|
+
const { item, labels = DEFAULT_AGENT_LABELS, defaultOpen = false, element = null, openStep, active = false } = props;
|
|
1678
|
+
const d = (0, import_react3.useMemo)(() => describeTool(item.name, item.args, { element }), [item.name, item.args, element]);
|
|
1679
|
+
const opener = openStep ? openStep(item, d) || null : null;
|
|
1485
1680
|
const [open, setOpen] = (0, import_react3.useState)(defaultOpen);
|
|
1486
1681
|
const uid = (0, import_react3.useRef)(`uac-s-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
1487
1682
|
const running = item.status === "running";
|
|
@@ -1491,8 +1686,8 @@ function StepRow(props) {
|
|
|
1491
1686
|
const verb = running ? d.running : d.done;
|
|
1492
1687
|
const hasTarget = d.target && line === `${verb} ${d.target}`;
|
|
1493
1688
|
const note = !running && item.status !== "failed" ? resultNote(d.kind, item.output) : "";
|
|
1494
|
-
const hasDetail = !!(item.args && item.args !== "{}" && item.args !== '""') || item.output !== void 0;
|
|
1495
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: cls("uac-step", `is-${item.status}
|
|
1689
|
+
const hasDetail = !opener && (!!(item.args && item.args !== "{}" && item.args !== '""') || item.output !== void 0);
|
|
1690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: cls("uac-step", `is-${item.status}`, opener && "is-opens", opener && active && "is-active"), "data-kind": d.kind, children: [
|
|
1496
1691
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1497
1692
|
"button",
|
|
1498
1693
|
{
|
|
@@ -1500,8 +1695,9 @@ function StepRow(props) {
|
|
|
1500
1695
|
className: "uac-step-h",
|
|
1501
1696
|
"aria-expanded": hasDetail ? open : void 0,
|
|
1502
1697
|
"aria-controls": hasDetail ? uid : void 0,
|
|
1503
|
-
|
|
1504
|
-
|
|
1698
|
+
"aria-current": opener && active ? "true" : void 0,
|
|
1699
|
+
disabled: !opener && !hasDetail,
|
|
1700
|
+
onClick: opener || (() => setOpen((v) => !v)),
|
|
1505
1701
|
title: d.targetFull || void 0,
|
|
1506
1702
|
children: [
|
|
1507
1703
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StatusGlyph, { status: item.status, kind: d.kind }),
|
|
@@ -1517,7 +1713,7 @@ function StepRow(props) {
|
|
|
1517
1713
|
note ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "uac-step-n", children: note }) : null,
|
|
1518
1714
|
item.status === "stopped" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "uac-step-n", children: labels.stoppedCall }) : null,
|
|
1519
1715
|
running && runMs != null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "uac-step-time", children: formatElapsed(runMs) }) : tookMs != null && tookMs >= 1e3 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "uac-step-time", children: formatDuration(tookMs) }) : null,
|
|
1520
|
-
hasDetail ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "uac-chev", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Chevron, { dir: open ? "down" : "right", size: 12 }) }) : null
|
|
1716
|
+
hasDetail || opener ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "uac-chev", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Chevron, { dir: open && !opener ? "down" : "right", size: 12 }) }) : null
|
|
1521
1717
|
]
|
|
1522
1718
|
}
|
|
1523
1719
|
),
|
|
@@ -1569,14 +1765,26 @@ function sumDiff(tools) {
|
|
|
1569
1765
|
return any ? { added, removed } : null;
|
|
1570
1766
|
}
|
|
1571
1767
|
function WorkGroup(props) {
|
|
1572
|
-
const {
|
|
1768
|
+
const {
|
|
1769
|
+
items,
|
|
1770
|
+
live = false,
|
|
1771
|
+
liveLabel,
|
|
1772
|
+
start = null,
|
|
1773
|
+
mark,
|
|
1774
|
+
motion,
|
|
1775
|
+
labels = DEFAULT_AGENT_LABELS,
|
|
1776
|
+
defaultOpen = false,
|
|
1777
|
+
elements = null,
|
|
1778
|
+
openStep,
|
|
1779
|
+
activeStep = null
|
|
1780
|
+
} = props;
|
|
1573
1781
|
const [open, setOpen] = (0, import_react3.useState)(defaultOpen);
|
|
1574
1782
|
const uid = (0, import_react3.useRef)(`uac-g-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
1575
1783
|
const tools = items.filter((x) => x.kind === "tool");
|
|
1576
1784
|
const thoughts = items.filter((x) => x.kind === "thinking");
|
|
1577
1785
|
const failed = tools.filter((x) => x.status === "failed").length;
|
|
1578
1786
|
let summary = "";
|
|
1579
|
-
if (tools.length) summary = summarizeCalls(tools);
|
|
1787
|
+
if (tools.length) summary = summarizeCalls(elements ? tools.map((t) => ({ name: t.name, args: t.args, element: elements[t.id] })) : tools);
|
|
1580
1788
|
else if (thoughts.length) {
|
|
1581
1789
|
const t = thoughts[0];
|
|
1582
1790
|
const ms = t.startedAt != null && t.endedAt != null ? t.endedAt - t.startedAt : null;
|
|
@@ -1584,7 +1792,17 @@ function WorkGroup(props) {
|
|
|
1584
1792
|
}
|
|
1585
1793
|
const diff = sumDiff(tools);
|
|
1586
1794
|
if (!live && !tools.length && !thoughts.some((t) => String(t.text || "").trim())) return null;
|
|
1587
|
-
const body = open ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "uac-calls", id: uid, children: items.map((it) => it.kind === "tool" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1795
|
+
const body = open ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "uac-calls", id: uid, children: items.map((it) => it.kind === "tool" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1796
|
+
StepRow,
|
|
1797
|
+
{
|
|
1798
|
+
item: it,
|
|
1799
|
+
labels,
|
|
1800
|
+
element: elements ? elements[it.id] || null : null,
|
|
1801
|
+
openStep,
|
|
1802
|
+
active: activeStep != null && activeStep === it.id
|
|
1803
|
+
},
|
|
1804
|
+
it.id
|
|
1805
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ThinkingRow, { item: it, labels }, it.id)) }) : null;
|
|
1588
1806
|
if (live) {
|
|
1589
1807
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: cls("uac-group", "is-live", open && "is-open"), children: [
|
|
1590
1808
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -1722,9 +1940,13 @@ function AgentTurnView(props) {
|
|
|
1722
1940
|
renderFiles,
|
|
1723
1941
|
actions,
|
|
1724
1942
|
describeIncomplete,
|
|
1725
|
-
liveStart
|
|
1943
|
+
liveStart,
|
|
1944
|
+
openStep,
|
|
1945
|
+
activeStep = null
|
|
1726
1946
|
} = props;
|
|
1727
1947
|
const labels = (0, import_react3.useMemo)(() => ({ ...DEFAULT_AGENT_LABELS, ...labelsIn || {} }), [labelsIn]);
|
|
1948
|
+
const items = turn ? turn.items : null;
|
|
1949
|
+
const elements = (0, import_react3.useMemo)(() => browserElements(items), [items]);
|
|
1728
1950
|
if (!turn) return null;
|
|
1729
1951
|
const running = turn.status === "running";
|
|
1730
1952
|
const segs = segments(turn);
|
|
@@ -1735,7 +1957,7 @@ function AgentTurnView(props) {
|
|
|
1735
1957
|
const liveWork = running && lastSeg && lastSeg.type === "work";
|
|
1736
1958
|
let liveLabel = labels.thinking;
|
|
1737
1959
|
if (now) {
|
|
1738
|
-
if (now.phase === "tool" && now.tool) liveLabel = toolLine(describeTool(now.tool.name, now.tool.args), "running");
|
|
1960
|
+
if (now.phase === "tool" && now.tool) liveLabel = toolLine(describeTool(now.tool.name, now.tool.args, { element: elements[now.tool.id] }), "running");
|
|
1739
1961
|
else if (now.phase === "writing") liveLabel = labels.writing;
|
|
1740
1962
|
else if (now.phase === "starting") liveLabel = labels.starting;
|
|
1741
1963
|
}
|
|
@@ -1753,7 +1975,21 @@ function AgentTurnView(props) {
|
|
|
1753
1975
|
if (isLive) {
|
|
1754
1976
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react3.default.Fragment, { children: [
|
|
1755
1977
|
plan ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TodoCard, { todos: plan, labels, running: true }) : null,
|
|
1756
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1978
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1979
|
+
WorkGroup,
|
|
1980
|
+
{
|
|
1981
|
+
items: s.items,
|
|
1982
|
+
live: true,
|
|
1983
|
+
liveLabel,
|
|
1984
|
+
start,
|
|
1985
|
+
mark,
|
|
1986
|
+
motion,
|
|
1987
|
+
labels,
|
|
1988
|
+
elements,
|
|
1989
|
+
openStep,
|
|
1990
|
+
activeStep
|
|
1991
|
+
}
|
|
1992
|
+
)
|
|
1757
1993
|
] }, `w${i}`);
|
|
1758
1994
|
}
|
|
1759
1995
|
if (s.type === "text") {
|
|
@@ -1767,7 +2003,17 @@ function AgentTurnView(props) {
|
|
|
1767
2003
|
s.item.id || `t${i}`
|
|
1768
2004
|
);
|
|
1769
2005
|
}
|
|
1770
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2007
|
+
WorkGroup,
|
|
2008
|
+
{
|
|
2009
|
+
items: s.items,
|
|
2010
|
+
labels,
|
|
2011
|
+
elements,
|
|
2012
|
+
openStep,
|
|
2013
|
+
activeStep
|
|
2014
|
+
},
|
|
2015
|
+
`w${i}-${s.items[0] && s.items[0].id}`
|
|
2016
|
+
);
|
|
1771
2017
|
}),
|
|
1772
2018
|
!liveWork && plan ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TodoCard, { todos: plan, labels, running }) : null,
|
|
1773
2019
|
running && !liveWork ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(WorkingIndicator, { mark, motion, start, label: liveLabel }) : null,
|
|
@@ -2499,10 +2745,10 @@ function middleEllipsis(name, max = 40) {
|
|
|
2499
2745
|
function MidName(props) {
|
|
2500
2746
|
const { name, className } = props;
|
|
2501
2747
|
const s = String(name || "");
|
|
2502
|
-
const
|
|
2748
|
+
const cut2 = s.length > 16 ? s.length - Math.min(14, Math.floor(s.length / 2)) : s.length;
|
|
2503
2749
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "uac-mid" + (className ? ` ${className}` : ""), children: [
|
|
2504
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uac-mid-h", children: s.slice(0,
|
|
2505
|
-
|
|
2750
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uac-mid-h", children: s.slice(0, cut2) }),
|
|
2751
|
+
cut2 < s.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uac-mid-t", children: s.slice(cut2) }) : null
|
|
2506
2752
|
] });
|
|
2507
2753
|
}
|
|
2508
2754
|
function dirOf(path) {
|