reifyui 0.16.1 → 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 +490 -44
- package/dist/agent-chat.cjs.map +1 -1
- package/dist/agent-chat.d.ts +40 -5
- package/dist/agent-chat.js +216 -19
- package/dist/agent-chat.js.map +1 -1
- package/dist/{chunk-UP3CNKZR.js → chunk-Y2MBOXQC.js} +283 -28
- package/dist/chunk-Y2MBOXQC.js.map +1 -0
- package/dist/index.cjs +269 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/agent-chat/artifacts.jsx +160 -19
- package/src/agent-chat/components.jsx +28 -15
- package/src/agent-chat/index.d.ts +40 -5
- package/src/agent-chat/index.js +3 -3
- package/src/agent-chat/tools.js +177 -11
- package/src/components/FilePreview.jsx +3 -2
- package/styles/agent-chat.css +45 -7
- package/dist/chunk-UP3CNKZR.js.map +0 -1
|
@@ -18,6 +18,14 @@ import {
|
|
|
18
18
|
IcX
|
|
19
19
|
} from "./chunk-QCISEB67.js";
|
|
20
20
|
|
|
21
|
+
// src/format.js
|
|
22
|
+
function bytesLabel(n) {
|
|
23
|
+
if (n == null) return "";
|
|
24
|
+
if (n < 1024) return `${n} B`;
|
|
25
|
+
if (n < 1048576) return `${Math.round(n / 1024)} KB`;
|
|
26
|
+
return `${(n / 1048576).toFixed(1)} MB`;
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
// src/agent-chat/tools.js
|
|
22
30
|
function parseToolArgs(args) {
|
|
23
31
|
if (args && typeof args === "object") return args;
|
|
@@ -161,6 +169,7 @@ var NS = /^(developer|platform|computercontroller|builtin|default|functions|tool
|
|
|
161
169
|
function toolKind(name) {
|
|
162
170
|
const raw = String(name || "").trim();
|
|
163
171
|
if (!raw) return "tool";
|
|
172
|
+
if (browserActOf(raw) !== null) return "browser";
|
|
164
173
|
if (/^mcp__/i.test(raw)) return "mcp";
|
|
165
174
|
const n = raw.toLowerCase().replace(NS, "");
|
|
166
175
|
if (KIND_BY_NAME[n]) return KIND_BY_NAME[n];
|
|
@@ -311,6 +320,195 @@ function shortUrl(u) {
|
|
|
311
320
|
function humanizeName(n) {
|
|
312
321
|
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());
|
|
313
322
|
}
|
|
323
|
+
var NS_BROWSER = /^(?:mcp__.+?__|[a-z0-9_-]+?(?:__|\.))(browser[_\-.].+)$/i;
|
|
324
|
+
var BROWSER_SERVER = /^(?:mcp__)?(?:browser|playwright|puppeteer|browserbase|browser[_-]use|chrome[_-]?devtools)(?:__|\.)(.+)$/i;
|
|
325
|
+
function browserActOf(name) {
|
|
326
|
+
const raw = String(name || "").trim();
|
|
327
|
+
if (!raw) return null;
|
|
328
|
+
const n = raw.toLowerCase().replace(NS, "");
|
|
329
|
+
if (KIND_BY_NAME[n] === "browser") return n === "navigate" || n === "screenshot" ? n : "";
|
|
330
|
+
let m = n.match(/^(?:browser|playwright|computer)[_\-.](.+)$/);
|
|
331
|
+
if (m) return m[1];
|
|
332
|
+
m = raw.match(NS_BROWSER);
|
|
333
|
+
if (m) return m[1].replace(/^browser[_\-.]/i, "").toLowerCase();
|
|
334
|
+
m = raw.match(BROWSER_SERVER);
|
|
335
|
+
if (m) return m[1].replace(/^browser[_\-.]/i, "").toLowerCase();
|
|
336
|
+
if (/[_\-.]browser$/.test(n)) return "";
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
var ROLE_NOUN = {
|
|
340
|
+
link: "link",
|
|
341
|
+
button: "button",
|
|
342
|
+
submit: "button",
|
|
343
|
+
textbox: "field",
|
|
344
|
+
searchbox: "search field",
|
|
345
|
+
combobox: "list",
|
|
346
|
+
listbox: "list",
|
|
347
|
+
checkbox: "checkbox",
|
|
348
|
+
radio: "option",
|
|
349
|
+
option: "option",
|
|
350
|
+
tab: "tab",
|
|
351
|
+
menuitem: "menu item",
|
|
352
|
+
heading: "heading",
|
|
353
|
+
img: "image",
|
|
354
|
+
image: "image",
|
|
355
|
+
switch: "switch",
|
|
356
|
+
slider: "slider"
|
|
357
|
+
};
|
|
358
|
+
function cut(s, max) {
|
|
359
|
+
const t = str(s).replace(/\s+/g, " ").trim();
|
|
360
|
+
return t.length > max ? `${t.slice(0, max - 1).trimEnd()}\u2026` : t;
|
|
361
|
+
}
|
|
362
|
+
function elementWords(a, element, act) {
|
|
363
|
+
const desc = str(firstOf(a, ["element", "element_description", "description", "label"])).trim();
|
|
364
|
+
if (desc) return cut(desc, 60);
|
|
365
|
+
if (element && element.role) {
|
|
366
|
+
const noun = ROLE_NOUN[String(element.role).toLowerCase()] || "";
|
|
367
|
+
const name = cut(element.name, 40);
|
|
368
|
+
if (noun && name) return `the \u201C${name}\u201D ${noun}`;
|
|
369
|
+
if (noun) return `a ${noun}`;
|
|
370
|
+
if (name) return `\u201C${name}\u201D`;
|
|
371
|
+
}
|
|
372
|
+
const sel = str(a.selector).trim().toLowerCase();
|
|
373
|
+
if (sel) {
|
|
374
|
+
if (/^a(?=$|[\s.#[:>])|role=["']?link/.test(sel)) return "a link";
|
|
375
|
+
if (/^button|\[type=["']?submit|role=["']?button/.test(sel)) return "a button";
|
|
376
|
+
if (/^(input|textarea)|role=["']?(textbox|searchbox)|contenteditable/.test(sel)) return "a field";
|
|
377
|
+
if (/^select|role=["']?(combobox|listbox)/.test(sel)) return "a list";
|
|
378
|
+
}
|
|
379
|
+
if (act === "click") {
|
|
380
|
+
const t = str(a.text).trim();
|
|
381
|
+
if (t) return `\u201C${cut(t, 40)}\u201D`;
|
|
382
|
+
}
|
|
383
|
+
return "";
|
|
384
|
+
}
|
|
385
|
+
function msWords(ms) {
|
|
386
|
+
const s = Math.round(Number(ms) / 100) / 10;
|
|
387
|
+
return s >= 1 ? `${s}s` : `${Math.round(Number(ms))} ms`;
|
|
388
|
+
}
|
|
389
|
+
var BROWSER_ACTS = [
|
|
390
|
+
[
|
|
391
|
+
/^(navigate|goto|go_to|open|open_url|visit|new_tab|tab_new|browse|go)$/,
|
|
392
|
+
"Opening",
|
|
393
|
+
"Opened",
|
|
394
|
+
(a) => {
|
|
395
|
+
const u = str(firstOf(a, ["url", "href", "uri", "link", "address"]));
|
|
396
|
+
return u ? shortUrl(u) : "";
|
|
397
|
+
},
|
|
398
|
+
["Opening a page", "Opened a page"]
|
|
399
|
+
],
|
|
400
|
+
[/^(navigate_back|back|go_back|history_back)$/, "", "", null, ["Going back a page", "Went back a page"]],
|
|
401
|
+
[/^(navigate_forward|forward|go_forward)$/, "", "", null, ["Going forward a page", "Went forward a page"]],
|
|
402
|
+
[/^(reload|refresh)$/, "", "", null, ["Reloading the page", "Reloaded the page"]],
|
|
403
|
+
[
|
|
404
|
+
/^(click|left_click|double_click|right_click|triple_click|middle_click|tap|click_element)$/,
|
|
405
|
+
"Clicking",
|
|
406
|
+
"Clicked",
|
|
407
|
+
(a, e, act) => elementWords(a, e, act),
|
|
408
|
+
["Clicking on the page", "Clicked on the page"]
|
|
409
|
+
],
|
|
410
|
+
[/^(hover|mouse_move|move_mouse)$/, "Pointing at", "Pointed at", (a, e, act) => elementWords(a, e, act), ["Moving the pointer", "Moved the pointer"]],
|
|
411
|
+
[
|
|
412
|
+
/^(type|fill|input|input_text|type_text|insert_text|fill_form|send_keys_to)$/,
|
|
413
|
+
"Typing into",
|
|
414
|
+
"Typed into",
|
|
415
|
+
(a, e, act) => elementWords(a, e, act),
|
|
416
|
+
["Typing into a field", "Typed into a field"]
|
|
417
|
+
],
|
|
418
|
+
[
|
|
419
|
+
/^(select|select_option|choose|select_dropdown_option)$/,
|
|
420
|
+
"Choosing an option in",
|
|
421
|
+
"Chose an option in",
|
|
422
|
+
(a, e, act) => elementWords(a, e, act),
|
|
423
|
+
["Choosing an option", "Chose an option"]
|
|
424
|
+
],
|
|
425
|
+
[
|
|
426
|
+
/^(press|press_key|key|keypress|send_keys|hotkey)$/,
|
|
427
|
+
"Pressing",
|
|
428
|
+
"Pressed",
|
|
429
|
+
(a) => cut(firstOf(a, ["key", "keys", "text"]), 30),
|
|
430
|
+
["Pressing a key", "Pressed a key"]
|
|
431
|
+
],
|
|
432
|
+
[/^(scroll|scroll_down|scroll_up|wheel|scroll_page)$/, "Scrolling", "Scrolled", (a, e, act) => {
|
|
433
|
+
const d = str(firstOf(a, ["direction", "scroll_direction"])).toLowerCase();
|
|
434
|
+
if (/^(up|down|left|right)$/.test(d)) return d;
|
|
435
|
+
if (/_up$/.test(act)) return "up";
|
|
436
|
+
if (/_down$/.test(act)) return "down";
|
|
437
|
+
const dy = Number(firstOf(a, ["pixels", "delta_y", "deltaY", "amount", "scroll_amount"]));
|
|
438
|
+
return Number.isFinite(dy) && dy < 0 ? "up" : Number.isFinite(dy) && dy > 0 ? "down" : "";
|
|
439
|
+
}, ["Scrolling the page", "Scrolled the page"]],
|
|
440
|
+
[
|
|
441
|
+
/^(screenshot|take_screenshot|capture|capture_screenshot)$/,
|
|
442
|
+
"",
|
|
443
|
+
"",
|
|
444
|
+
null,
|
|
445
|
+
["Taking a screenshot", "Took a screenshot"],
|
|
446
|
+
(a) => a.full_page || a.fullPage ? ["Taking a screenshot of the whole page", "Took a screenshot of the whole page"] : null
|
|
447
|
+
],
|
|
448
|
+
[/^(snapshot|read|read_page|get_page|accessibility_snapshot|page_content|get_content|get_elements|observe)$/, "", "", null, ["Reading the page", "Read the page"]],
|
|
449
|
+
[/^(extract_text|get_text|extract|text|extract_content|get_page_text)$/, "", "", null, ["Reading the page\u2019s text", "Read the page\u2019s text"]],
|
|
450
|
+
[/^(get_url|url|current_url|location|get_title)$/, "", "", null, ["Checking the address", "Checked the address"]],
|
|
451
|
+
[/^(wait|wait_for|wait_for_text|wait_for_selector|sleep)$/, "Waiting", "Waited", (a) => {
|
|
452
|
+
const t = str(a.text).trim();
|
|
453
|
+
if (t) return `for \u201C${cut(t, 40)}\u201D`;
|
|
454
|
+
if (str(a.selector).trim()) return "for the page";
|
|
455
|
+
const ms = a.ms != null ? Number(a.ms) : a.time != null ? Number(a.time) * 1e3 : Number(firstOf(a, ["timeout", "duration"]));
|
|
456
|
+
return Number.isFinite(ms) && ms > 0 ? msWords(ms) : "";
|
|
457
|
+
}, ["Waiting", "Waited"]],
|
|
458
|
+
[/^(tabs|list_tabs|tab_list|get_tabs)$/, "", "", null, ["Listing the tabs", "Listed the tabs"]],
|
|
459
|
+
[/^(switch_tab|tab_select|select_tab|focus_tab|switch_to_tab)$/, "", "", null, ["Switching tabs", "Switched tabs"]],
|
|
460
|
+
[/^(close_tab|tab_close)$/, "", "", null, ["Closing a tab", "Closed a tab"]],
|
|
461
|
+
[/^(close|quit|close_browser)$/, "", "", null, ["Closing the browser", "Closed the browser"]],
|
|
462
|
+
[/^(drag|drag_and_drop|left_click_drag)$/, "", "", null, ["Dragging on the page", "Dragged on the page"]],
|
|
463
|
+
[/^(file_upload|upload|upload_file|set_input_files)$/, "", "", null, ["Uploading a file", "Uploaded a file"]],
|
|
464
|
+
[/^(handle_dialog|dialog|accept_dialog|dismiss_dialog)$/, "", "", null, ["Answering a dialog", "Answered a dialog"]],
|
|
465
|
+
[/^(resize|set_viewport|resize_window)$/, "", "", null, ["Resizing the window", "Resized the window"]],
|
|
466
|
+
[/^(evaluate|run_code|execute_js|eval|execute_script|run_javascript)$/, "", "", null, ["Running a script on the page", "Ran a script on the page"]],
|
|
467
|
+
[/^(console_messages|console|get_console)$/, "", "", null, ["Reading the console", "Read the console"]],
|
|
468
|
+
[/^(network_requests|network|get_network)$/, "", "", null, ["Reading the network requests", "Read the network requests"]],
|
|
469
|
+
[/^(pdf_save|save_pdf|pdf|print_pdf)$/, "", "", null, ["Saving the page as a PDF", "Saved the page as a PDF"]],
|
|
470
|
+
[/^(cursor_position)$/, "", "", null, ["Finding the pointer", "Found the pointer"]],
|
|
471
|
+
[/^(install)$/, "", "", null, ["Installing the browser", "Installed the browser"]]
|
|
472
|
+
];
|
|
473
|
+
function describeBrowser(name, a, element) {
|
|
474
|
+
const fromName = browserActOf(name) || "";
|
|
475
|
+
const fromArgs = str(firstOf(a, ["action", "command", "type"])).trim();
|
|
476
|
+
const act = (fromName && fromName !== "use" ? fromName : fromArgs || fromName).toLowerCase().replace(/[\s-]+/g, "_");
|
|
477
|
+
const row = BROWSER_ACTS.find((r) => r[0].test(act));
|
|
478
|
+
if (row) {
|
|
479
|
+
const [, running, done, target, bare, special] = row;
|
|
480
|
+
const sp = special ? special(a) : null;
|
|
481
|
+
if (sp) return { running: sp[0], done: sp[1], target: "" };
|
|
482
|
+
const t = target ? target(a, element, act) : "";
|
|
483
|
+
return t ? { running, done, target: t } : { running: bare[0], done: bare[1], target: "" };
|
|
484
|
+
}
|
|
485
|
+
const u = str(firstOf(a, ["url", "href", "uri"]));
|
|
486
|
+
return u ? { running: "Browsing", done: "Browsed", target: shortUrl(u) } : { running: "Using the browser", done: "Used the browser", target: "" };
|
|
487
|
+
}
|
|
488
|
+
function browserElements(items) {
|
|
489
|
+
const out = {};
|
|
490
|
+
let refs = /* @__PURE__ */ new Map();
|
|
491
|
+
for (const it of items || []) {
|
|
492
|
+
if (!it || it.kind !== "tool" || toolKind(it.name) !== "browser") continue;
|
|
493
|
+
const a = parseToolArgs(it.args);
|
|
494
|
+
const ref = str(firstOf(a, ["ref", "element_ref"])).trim();
|
|
495
|
+
if (ref && refs.has(ref)) out[it.id] = refs.get(ref);
|
|
496
|
+
const text = str(it.output);
|
|
497
|
+
if (!text) continue;
|
|
498
|
+
const next = /* @__PURE__ */ new Map();
|
|
499
|
+
for (const ln of text.split("\n")) {
|
|
500
|
+
let m = ln.match(/^\s*(e\d+)\s+([a-z]+)\s+"(.*?)"/i);
|
|
501
|
+
if (m) {
|
|
502
|
+
next.set(m[1], { role: m[2], name: m[3] });
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
m = ln.match(/^\s*-\s+([a-z]+)(?:\s+"(.*?)")?[^\n]*\[ref=(e\d+)\]/i);
|
|
506
|
+
if (m) next.set(m[3], { role: m[1], name: m[2] || "" });
|
|
507
|
+
}
|
|
508
|
+
if (next.size) refs = next;
|
|
509
|
+
}
|
|
510
|
+
return out;
|
|
511
|
+
}
|
|
314
512
|
var VERBS = {
|
|
315
513
|
shell: ["Running", "Ran"],
|
|
316
514
|
shell_output: ["Reading output of", "Read output of"],
|
|
@@ -331,7 +529,7 @@ var VERBS = {
|
|
|
331
529
|
mcp: ["Using", "Used"],
|
|
332
530
|
tool: ["Using", "Used"]
|
|
333
531
|
};
|
|
334
|
-
function describeTool(name, args) {
|
|
532
|
+
function describeTool(name, args, opts) {
|
|
335
533
|
const a = parseToolArgs(args);
|
|
336
534
|
let kind = toolKind(name);
|
|
337
535
|
const nm = str(name);
|
|
@@ -341,6 +539,7 @@ function describeTool(name, args) {
|
|
|
341
539
|
let targetFull = "";
|
|
342
540
|
let mono = false;
|
|
343
541
|
let note = "";
|
|
542
|
+
let browser = null;
|
|
344
543
|
const pathOf = () => firstOf(a, [
|
|
345
544
|
"file_path",
|
|
346
545
|
"path",
|
|
@@ -418,11 +617,9 @@ function describeTool(name, args) {
|
|
|
418
617
|
targetFull = target;
|
|
419
618
|
break;
|
|
420
619
|
case "browser": {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
targetFull = target;
|
|
425
|
-
if (/^browser[_\-.]/i.test(nm)) note = humanizeName(nm.replace(/^browser[_\-.]/i, ""));
|
|
620
|
+
browser = describeBrowser(nm, a, opts && opts.element);
|
|
621
|
+
target = browser.target;
|
|
622
|
+
targetFull = str(firstOf(a, ["url", "href", "uri"])) || target;
|
|
426
623
|
break;
|
|
427
624
|
}
|
|
428
625
|
case "mcp":
|
|
@@ -434,7 +631,7 @@ function describeTool(name, args) {
|
|
|
434
631
|
default:
|
|
435
632
|
break;
|
|
436
633
|
}
|
|
437
|
-
const v = VERBS[kind] || VERBS.tool;
|
|
634
|
+
const v = browser ? [browser.running, browser.done] : VERBS[kind] || VERBS.tool;
|
|
438
635
|
return {
|
|
439
636
|
kind,
|
|
440
637
|
target: target.replace(/\s+/g, " ").trim(),
|
|
@@ -452,7 +649,9 @@ function toolLine(d, state) {
|
|
|
452
649
|
if (d.kind === "todo" || d.kind === "toolsearch" || d.kind === "think") return verb;
|
|
453
650
|
if (d.kind === "shell" && d.target && !d.mono) return d.target;
|
|
454
651
|
if (d.kind === "mcp" || d.kind === "tool") return `${verb} ${d.target || "a tool"}`;
|
|
455
|
-
|
|
652
|
+
if (d.target) return `${verb} ${d.target}`;
|
|
653
|
+
const noun = KIND_NOUN[d.kind];
|
|
654
|
+
return noun ? `${verb} ${noun}` : verb.replace(/\s+(for|of)$/, "");
|
|
456
655
|
}
|
|
457
656
|
var KIND_NOUN = {
|
|
458
657
|
shell: "a command",
|
|
@@ -492,7 +691,7 @@ var PHRASES = {
|
|
|
492
691
|
function summarizeCalls(calls) {
|
|
493
692
|
const list = (calls || []).filter(Boolean);
|
|
494
693
|
if (!list.length) return "";
|
|
495
|
-
if (list.length === 1) return toolLine(describeTool(list[0].name, list[0].args), "done");
|
|
694
|
+
if (list.length === 1) return toolLine(describeTool(list[0].name, list[0].args, { element: list[0].element }), "done");
|
|
496
695
|
const order = [];
|
|
497
696
|
const count = {};
|
|
498
697
|
for (const c of list) {
|
|
@@ -1269,8 +1468,9 @@ function StepDetail(props) {
|
|
|
1269
1468
|
] });
|
|
1270
1469
|
}
|
|
1271
1470
|
function StepRow(props) {
|
|
1272
|
-
const { item, labels = DEFAULT_AGENT_LABELS, defaultOpen = false } = props;
|
|
1273
|
-
const d = useMemo(() => describeTool(item.name, item.args), [item.name, item.args]);
|
|
1471
|
+
const { item, labels = DEFAULT_AGENT_LABELS, defaultOpen = false, element = null, openStep, active = false } = props;
|
|
1472
|
+
const d = useMemo(() => describeTool(item.name, item.args, { element }), [item.name, item.args, element]);
|
|
1473
|
+
const opener = openStep ? openStep(item, d) || null : null;
|
|
1274
1474
|
const [open, setOpen] = useState2(defaultOpen);
|
|
1275
1475
|
const uid = useRef(`uac-s-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
1276
1476
|
const running = item.status === "running";
|
|
@@ -1280,8 +1480,8 @@ function StepRow(props) {
|
|
|
1280
1480
|
const verb = running ? d.running : d.done;
|
|
1281
1481
|
const hasTarget = d.target && line === `${verb} ${d.target}`;
|
|
1282
1482
|
const note = !running && item.status !== "failed" ? resultNote(d.kind, item.output) : "";
|
|
1283
|
-
const hasDetail = !!(item.args && item.args !== "{}" && item.args !== '""') || item.output !== void 0;
|
|
1284
|
-
return /* @__PURE__ */ jsxs("div", { className: cls("uac-step", `is-${item.status}
|
|
1483
|
+
const hasDetail = !opener && (!!(item.args && item.args !== "{}" && item.args !== '""') || item.output !== void 0);
|
|
1484
|
+
return /* @__PURE__ */ jsxs("div", { className: cls("uac-step", `is-${item.status}`, opener && "is-opens", opener && active && "is-active"), "data-kind": d.kind, children: [
|
|
1285
1485
|
/* @__PURE__ */ jsxs(
|
|
1286
1486
|
"button",
|
|
1287
1487
|
{
|
|
@@ -1289,8 +1489,9 @@ function StepRow(props) {
|
|
|
1289
1489
|
className: "uac-step-h",
|
|
1290
1490
|
"aria-expanded": hasDetail ? open : void 0,
|
|
1291
1491
|
"aria-controls": hasDetail ? uid : void 0,
|
|
1292
|
-
|
|
1293
|
-
|
|
1492
|
+
"aria-current": opener && active ? "true" : void 0,
|
|
1493
|
+
disabled: !opener && !hasDetail,
|
|
1494
|
+
onClick: opener || (() => setOpen((v) => !v)),
|
|
1294
1495
|
title: d.targetFull || void 0,
|
|
1295
1496
|
children: [
|
|
1296
1497
|
/* @__PURE__ */ jsx(StatusGlyph, { status: item.status, kind: d.kind }),
|
|
@@ -1306,7 +1507,7 @@ function StepRow(props) {
|
|
|
1306
1507
|
note ? /* @__PURE__ */ jsx("span", { className: "uac-step-n", children: note }) : null,
|
|
1307
1508
|
item.status === "stopped" ? /* @__PURE__ */ jsx("span", { className: "uac-step-n", children: labels.stoppedCall }) : null,
|
|
1308
1509
|
running && runMs != null ? /* @__PURE__ */ jsx("span", { className: "uac-step-time", children: formatElapsed(runMs) }) : tookMs != null && tookMs >= 1e3 ? /* @__PURE__ */ jsx("span", { className: "uac-step-time", children: formatDuration(tookMs) }) : null,
|
|
1309
|
-
hasDetail ? /* @__PURE__ */ jsx("span", { className: "uac-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Chevron, { dir: open ? "down" : "right", size: 12 }) }) : null
|
|
1510
|
+
hasDetail || opener ? /* @__PURE__ */ jsx("span", { className: "uac-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Chevron, { dir: open && !opener ? "down" : "right", size: 12 }) }) : null
|
|
1310
1511
|
]
|
|
1311
1512
|
}
|
|
1312
1513
|
),
|
|
@@ -1358,14 +1559,26 @@ function sumDiff(tools) {
|
|
|
1358
1559
|
return any ? { added, removed } : null;
|
|
1359
1560
|
}
|
|
1360
1561
|
function WorkGroup(props) {
|
|
1361
|
-
const {
|
|
1562
|
+
const {
|
|
1563
|
+
items,
|
|
1564
|
+
live = false,
|
|
1565
|
+
liveLabel,
|
|
1566
|
+
start = null,
|
|
1567
|
+
mark,
|
|
1568
|
+
motion,
|
|
1569
|
+
labels = DEFAULT_AGENT_LABELS,
|
|
1570
|
+
defaultOpen = false,
|
|
1571
|
+
elements = null,
|
|
1572
|
+
openStep,
|
|
1573
|
+
activeStep = null
|
|
1574
|
+
} = props;
|
|
1362
1575
|
const [open, setOpen] = useState2(defaultOpen);
|
|
1363
1576
|
const uid = useRef(`uac-g-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
1364
1577
|
const tools = items.filter((x) => x.kind === "tool");
|
|
1365
1578
|
const thoughts = items.filter((x) => x.kind === "thinking");
|
|
1366
1579
|
const failed = tools.filter((x) => x.status === "failed").length;
|
|
1367
1580
|
let summary = "";
|
|
1368
|
-
if (tools.length) summary = summarizeCalls(tools);
|
|
1581
|
+
if (tools.length) summary = summarizeCalls(elements ? tools.map((t) => ({ name: t.name, args: t.args, element: elements[t.id] })) : tools);
|
|
1369
1582
|
else if (thoughts.length) {
|
|
1370
1583
|
const t = thoughts[0];
|
|
1371
1584
|
const ms = t.startedAt != null && t.endedAt != null ? t.endedAt - t.startedAt : null;
|
|
@@ -1373,7 +1586,17 @@ function WorkGroup(props) {
|
|
|
1373
1586
|
}
|
|
1374
1587
|
const diff = sumDiff(tools);
|
|
1375
1588
|
if (!live && !tools.length && !thoughts.some((t) => String(t.text || "").trim())) return null;
|
|
1376
|
-
const body = open ? /* @__PURE__ */ jsx("div", { className: "uac-calls", id: uid, children: items.map((it) => it.kind === "tool" ? /* @__PURE__ */ jsx(
|
|
1589
|
+
const body = open ? /* @__PURE__ */ jsx("div", { className: "uac-calls", id: uid, children: items.map((it) => it.kind === "tool" ? /* @__PURE__ */ jsx(
|
|
1590
|
+
StepRow,
|
|
1591
|
+
{
|
|
1592
|
+
item: it,
|
|
1593
|
+
labels,
|
|
1594
|
+
element: elements ? elements[it.id] || null : null,
|
|
1595
|
+
openStep,
|
|
1596
|
+
active: activeStep != null && activeStep === it.id
|
|
1597
|
+
},
|
|
1598
|
+
it.id
|
|
1599
|
+
) : /* @__PURE__ */ jsx(ThinkingRow, { item: it, labels }, it.id)) }) : null;
|
|
1377
1600
|
if (live) {
|
|
1378
1601
|
return /* @__PURE__ */ jsxs("div", { className: cls("uac-group", "is-live", open && "is-open"), children: [
|
|
1379
1602
|
/* @__PURE__ */ jsx(
|
|
@@ -1511,9 +1734,13 @@ function AgentTurnView(props) {
|
|
|
1511
1734
|
renderFiles,
|
|
1512
1735
|
actions,
|
|
1513
1736
|
describeIncomplete,
|
|
1514
|
-
liveStart
|
|
1737
|
+
liveStart,
|
|
1738
|
+
openStep,
|
|
1739
|
+
activeStep = null
|
|
1515
1740
|
} = props;
|
|
1516
1741
|
const labels = useMemo(() => ({ ...DEFAULT_AGENT_LABELS, ...labelsIn || {} }), [labelsIn]);
|
|
1742
|
+
const items = turn ? turn.items : null;
|
|
1743
|
+
const elements = useMemo(() => browserElements(items), [items]);
|
|
1517
1744
|
if (!turn) return null;
|
|
1518
1745
|
const running = turn.status === "running";
|
|
1519
1746
|
const segs = segments(turn);
|
|
@@ -1524,7 +1751,7 @@ function AgentTurnView(props) {
|
|
|
1524
1751
|
const liveWork = running && lastSeg && lastSeg.type === "work";
|
|
1525
1752
|
let liveLabel = labels.thinking;
|
|
1526
1753
|
if (now) {
|
|
1527
|
-
if (now.phase === "tool" && now.tool) liveLabel = toolLine(describeTool(now.tool.name, now.tool.args), "running");
|
|
1754
|
+
if (now.phase === "tool" && now.tool) liveLabel = toolLine(describeTool(now.tool.name, now.tool.args, { element: elements[now.tool.id] }), "running");
|
|
1528
1755
|
else if (now.phase === "writing") liveLabel = labels.writing;
|
|
1529
1756
|
else if (now.phase === "starting") liveLabel = labels.starting;
|
|
1530
1757
|
}
|
|
@@ -1542,7 +1769,21 @@ function AgentTurnView(props) {
|
|
|
1542
1769
|
if (isLive) {
|
|
1543
1770
|
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
1544
1771
|
plan ? /* @__PURE__ */ jsx(TodoCard, { todos: plan, labels, running: true }) : null,
|
|
1545
|
-
/* @__PURE__ */ jsx(
|
|
1772
|
+
/* @__PURE__ */ jsx(
|
|
1773
|
+
WorkGroup,
|
|
1774
|
+
{
|
|
1775
|
+
items: s.items,
|
|
1776
|
+
live: true,
|
|
1777
|
+
liveLabel,
|
|
1778
|
+
start,
|
|
1779
|
+
mark,
|
|
1780
|
+
motion,
|
|
1781
|
+
labels,
|
|
1782
|
+
elements,
|
|
1783
|
+
openStep,
|
|
1784
|
+
activeStep
|
|
1785
|
+
}
|
|
1786
|
+
)
|
|
1546
1787
|
] }, `w${i}`);
|
|
1547
1788
|
}
|
|
1548
1789
|
if (s.type === "text") {
|
|
@@ -1556,7 +1797,17 @@ function AgentTurnView(props) {
|
|
|
1556
1797
|
s.item.id || `t${i}`
|
|
1557
1798
|
);
|
|
1558
1799
|
}
|
|
1559
|
-
return /* @__PURE__ */ jsx(
|
|
1800
|
+
return /* @__PURE__ */ jsx(
|
|
1801
|
+
WorkGroup,
|
|
1802
|
+
{
|
|
1803
|
+
items: s.items,
|
|
1804
|
+
labels,
|
|
1805
|
+
elements,
|
|
1806
|
+
openStep,
|
|
1807
|
+
activeStep
|
|
1808
|
+
},
|
|
1809
|
+
`w${i}-${s.items[0] && s.items[0].id}`
|
|
1810
|
+
);
|
|
1560
1811
|
}),
|
|
1561
1812
|
!liveWork && plan ? /* @__PURE__ */ jsx(TodoCard, { todos: plan, labels, running }) : null,
|
|
1562
1813
|
running && !liveWork ? /* @__PURE__ */ jsx(WorkingIndicator, { mark, motion, start, label: liveLabel }) : null,
|
|
@@ -1891,10 +2142,10 @@ var IcCheckMark = () => /* @__PURE__ */ jsx3("svg", { width: "17", height: "17",
|
|
|
1891
2142
|
function subtitle(name, origin, bytes) {
|
|
1892
2143
|
const parts = [(extOf(name) || "file").toUpperCase()];
|
|
1893
2144
|
if (origin) parts.push(origin);
|
|
1894
|
-
if (bytes != null) parts.push(
|
|
2145
|
+
if (bytes != null) parts.push(bytesLabel2(bytes));
|
|
1895
2146
|
return parts.join(" \xB7 ");
|
|
1896
2147
|
}
|
|
1897
|
-
function
|
|
2148
|
+
function bytesLabel2(n) {
|
|
1898
2149
|
if (n == null) return "";
|
|
1899
2150
|
if (n < 1024) return `${n} B`;
|
|
1900
2151
|
if (n < 1048576) return `${Math.round(n / 1024)} KB`;
|
|
@@ -2079,7 +2330,8 @@ function FilePreview({
|
|
|
2079
2330
|
parseWorkbook,
|
|
2080
2331
|
onDownload,
|
|
2081
2332
|
title,
|
|
2082
|
-
before
|
|
2333
|
+
before,
|
|
2334
|
+
nameSlot
|
|
2083
2335
|
}) {
|
|
2084
2336
|
const { url, name } = file || {};
|
|
2085
2337
|
const [st, setSt] = useState5({ kind: "loading" });
|
|
@@ -2167,7 +2419,7 @@ function FilePreview({
|
|
|
2167
2419
|
before,
|
|
2168
2420
|
/* @__PURE__ */ jsxs3("header", { className: "uic-fp-head", children: [
|
|
2169
2421
|
/* @__PURE__ */ jsx4("span", { className: "uic-fp-ic", children: /* @__PURE__ */ jsx4(FileTypeIcon, { name, size: 20 }) }),
|
|
2170
|
-
/* @__PURE__ */ jsx4("span", { className: "uic-fp-name", title: name, children: name }),
|
|
2422
|
+
nameSlot || /* @__PURE__ */ jsx4("span", { className: "uic-fp-name", title: name, children: name }),
|
|
2171
2423
|
st.kind === "html" && /* @__PURE__ */ jsx4("div", { className: "uic-fp-seg", role: "tablist", "aria-label": "Show the page or its source", children: [["preview", "Preview"], ["source", "Source"]].map(([id, label]) => /* @__PURE__ */ jsx4(
|
|
2172
2424
|
"button",
|
|
2173
2425
|
{
|
|
@@ -2254,6 +2506,7 @@ function FilePreview({
|
|
|
2254
2506
|
}
|
|
2255
2507
|
|
|
2256
2508
|
export {
|
|
2509
|
+
bytesLabel,
|
|
2257
2510
|
parseToolArgs,
|
|
2258
2511
|
toolKind,
|
|
2259
2512
|
baseNameOf,
|
|
@@ -2262,6 +2515,8 @@ export {
|
|
|
2262
2515
|
patchStats,
|
|
2263
2516
|
diffOf,
|
|
2264
2517
|
todosOf,
|
|
2518
|
+
browserActOf,
|
|
2519
|
+
browserElements,
|
|
2265
2520
|
describeTool,
|
|
2266
2521
|
toolLine,
|
|
2267
2522
|
summarizeCalls,
|
|
@@ -2304,4 +2559,4 @@ export {
|
|
|
2304
2559
|
FileCard,
|
|
2305
2560
|
FilePreview
|
|
2306
2561
|
};
|
|
2307
|
-
//# sourceMappingURL=chunk-
|
|
2562
|
+
//# sourceMappingURL=chunk-Y2MBOXQC.js.map
|