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/agent-chat.d.ts
CHANGED
|
@@ -65,10 +65,18 @@ export interface ToolDescription {
|
|
|
65
65
|
diff: { added: number; removed: number } | null;
|
|
66
66
|
todos: TodoEntry[] | null;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
/** The element a browser call acts on, as a page snapshot named its ref. */
|
|
69
|
+
export interface BrowserElement { role: string; name: string }
|
|
70
|
+
/** `opts.element`: for a browser call, the element its ref names (from browserElements). */
|
|
71
|
+
export function describeTool(name: string, args: unknown, opts?: { element?: BrowserElement | null }): ToolDescription;
|
|
69
72
|
export function toolKind(name: string): ToolKind;
|
|
70
73
|
export function toolLine(d: ToolDescription, state: 'running' | 'done'): string;
|
|
71
|
-
export function summarizeCalls(calls: { name: string; args?: unknown }[]): string;
|
|
74
|
+
export function summarizeCalls(calls: { name: string; args?: unknown; element?: BrowserElement | null }[]): string;
|
|
75
|
+
/** The action a browser tool's name carries ("click" for mcp__plugs__browser_click), '' when the action
|
|
76
|
+
* is an argument (`browser`, `computer`), null when the tool is not a browser's. */
|
|
77
|
+
export function browserActOf(name: string): string | null;
|
|
78
|
+
/** {[call id]: element} for the browser calls whose ref an earlier snapshot in the same turn named. */
|
|
79
|
+
export function browserElements(items: TurnItem[] | null | undefined): Record<string, BrowserElement>;
|
|
72
80
|
export function resultNote(kind: ToolKind, output: unknown): string;
|
|
73
81
|
export function parseToolArgs(args: unknown): Record<string, unknown>;
|
|
74
82
|
export function todosOf(args: Record<string, unknown>): TodoEntry[] | null;
|
|
@@ -110,10 +118,14 @@ export function WorkingIndicator(props: MarkProps & {
|
|
|
110
118
|
export function CopyButton(props: { text: string; labels?: AgentLabels; label?: string }): ReactElement;
|
|
111
119
|
export function DiffBadge(props: { diff: { added: number; removed: number } | null }): ReactElement | null;
|
|
112
120
|
export function LinesBlock(props: { lines: { text: string; cls?: string }[]; limit?: number; labels?: AgentLabels; className?: string; numbered?: boolean }): ReactElement;
|
|
113
|
-
|
|
121
|
+
/** A call the host shows in a place of its own: a handler for the calls it opens (a browser step opens
|
|
122
|
+
* the browser beside the conversation), null for the rest, which unfold to their input and output. */
|
|
123
|
+
export type OpenStep = (item: ToolItem, d: ToolDescription) => (() => void) | null | undefined;
|
|
124
|
+
export function StepRow(props: { item: ToolItem; labels?: AgentLabels; defaultOpen?: boolean; element?: BrowserElement | null;
|
|
125
|
+
openStep?: OpenStep; active?: boolean }): ReactElement;
|
|
114
126
|
export function ThinkingRow(props: { item: ThinkingItem; labels?: AgentLabels }): ReactElement;
|
|
115
127
|
export function WorkGroup(props: MarkProps & { items: (ToolItem | ThinkingItem)[]; live?: boolean; liveLabel?: string; start?: number | null;
|
|
116
|
-
labels?: AgentLabels; defaultOpen?: boolean }): ReactElement | null;
|
|
128
|
+
labels?: AgentLabels; defaultOpen?: boolean; elements?: Record<string, BrowserElement> | null; openStep?: OpenStep; activeStep?: string | null }): ReactElement | null;
|
|
117
129
|
export function TodoCard(props: { todos: TodoEntry[] | null; labels?: AgentLabels; running?: boolean }): ReactElement | null;
|
|
118
130
|
export function StreamingText(props: { text: string; active?: boolean; render?: (text: string) => ReactNode }): ReactElement;
|
|
119
131
|
export function UserBubble(props: { user: TurnUser | null; renderFile?: (f: { name: string; src?: string }, i: number) => ReactNode; extra?: ReactNode }): ReactElement | null;
|
|
@@ -136,6 +148,10 @@ export interface AgentTurnViewProps extends MarkProps {
|
|
|
136
148
|
describeIncomplete?: (i: { reason?: string; detail?: string }) => string;
|
|
137
149
|
/** the epoch ms the live clock counts from, when it is not the turn's own startedAt */
|
|
138
150
|
liveStart?: number | null;
|
|
151
|
+
/** calls the host opens in a place of its own (a browser step opens the browser), instead of unfolding */
|
|
152
|
+
openStep?: OpenStep;
|
|
153
|
+
/** the id of the call the host is showing now: its row stays marked */
|
|
154
|
+
activeStep?: string | null;
|
|
139
155
|
}
|
|
140
156
|
export function AgentTurnView(props: AgentTurnViewProps): ReactElement | null;
|
|
141
157
|
|
package/dist/agent-chat.js
CHANGED
|
@@ -19,6 +19,8 @@ import {
|
|
|
19
19
|
WorkingIndicator,
|
|
20
20
|
WorkingMark,
|
|
21
21
|
baseNameOf,
|
|
22
|
+
browserActOf,
|
|
23
|
+
browserElements,
|
|
22
24
|
bytesLabel,
|
|
23
25
|
commandText,
|
|
24
26
|
describeTool,
|
|
@@ -48,7 +50,7 @@ import {
|
|
|
48
50
|
useElapsed,
|
|
49
51
|
useNow,
|
|
50
52
|
useStickToBottom
|
|
51
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-Y2MBOXQC.js";
|
|
52
54
|
import "./chunk-QCISEB67.js";
|
|
53
55
|
import "./chunk-PZ5AY32C.js";
|
|
54
56
|
|
|
@@ -407,6 +409,8 @@ export {
|
|
|
407
409
|
WorkingIndicator,
|
|
408
410
|
WorkingMark,
|
|
409
411
|
baseNameOf,
|
|
412
|
+
browserActOf,
|
|
413
|
+
browserElements,
|
|
410
414
|
commandText,
|
|
411
415
|
describeTool,
|
|
412
416
|
diffOf,
|
package/dist/agent-chat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/agent-chat/marks.js","../src/agent-chat/artifacts.jsx"],"sourcesContent":["// The working mark: each harness's own logo, moving the way that logo suggests.\n//\n// The package ships the MOTIONS (CSS keyframes in styles/agent-chat.css), never the logos: a\n// host passes its official mark as a node and names a motion. motionFor(base) is the house\n// choice for the harnesses we know, picked by looking at each mark:\n//\n// bloom the Claude starburst turns a quarter and breathes, like the CLI's ✻ ✽ ✶ spinner\n// sheen a light passes across the tile (Codex's prompt, Kimi's K, Kilo's grid)\n// glint brightens and swells, a spark catching light (Gemini)\n// flutter a quick wing beat, tilt and lift (Hermes, the messenger)\n// glide a bird's lift and settle (Goose)\n// blink the tile blinks shut and open, a terminal cursor (OpenCode)\n// flip a coin turning on its vertical axis (pi, omp)\n// swim a short wave from nose to tail (DeepSeek's whale)\n// spin a steady revolution, for round marks (Qwen, Grok, System One, OpenSquilla)\n// wave hands waving from the wrist (OpenHands)\n// dash a sprint forward and back (CheetahClaws)\n// scuttle a sideways skitter (ZeroClaw's crab)\n// equalize a level meter rising and falling (MiniMax's waveform)\n// bob a soft hop (robots and app tiles: Cline, Agent Zero, Qoder, nanobot)\n// pulse the default: scale and opacity breathing\n//\n// Every motion stops under prefers-reduced-motion; the mark then stands still and the line's\n// words alone say the work is going on.\n\nexport const MARK_MOTIONS = {\n 'claude-code': 'bloom', claude: 'bloom', anthropic: 'bloom',\n codex: 'sheen', openai: 'sheen',\n gemini: 'glint', 'gemini-cli': 'glint',\n hermes: 'flutter',\n goose: 'glide',\n opencode: 'blink',\n pi: 'flip', omp: 'flip',\n dsh: 'swim', deepseek: 'swim',\n qwen: 'spin', grok: 'spin', systemone: 'spin', opensquilla: 'spin',\n openhands: 'wave',\n cheetahclaws: 'dash',\n zeroclaw: 'scuttle',\n minimax: 'equalize',\n cline: 'bob', agentzero: 'bob', qoder: 'bob', nanobot: 'bob',\n kimi: 'sheen', kilo: 'sheen', jcode: 'pulse', mimo: 'pulse', aider: 'pulse',\n};\n\nexport const MOTIONS = ['bloom', 'sheen', 'glint', 'flutter', 'glide', 'blink', 'flip', 'swim', 'spin', 'wave',\n 'dash', 'scuttle', 'equalize', 'bob', 'pulse', 'dots'];\n\n/** The motion for a base harness id, 'pulse' for one we do not know. */\nexport function motionFor(base) {\n const k = String(base || '').toLowerCase().trim();\n return MARK_MOTIONS[k] || 'pulse';\n}\n","// The files a turn produced, opened beside the conversation instead of printed into it.\n//\n// In the conversation a file is a card (the package's FileCard: its kind, Copy, Download, and the\n// whole card opens it). Opened, it shows here, under ONE header row: the file's kind, its name as a\n// switcher (a dropdown of every file of the conversation, grouped by folder, filterable when there are\n// many, keyboard driven), then Copy, Download and Close. Below, the file rendered (Markdown as a\n// document, code highlighted, images, PDFs, sheets). Docked, it is a column the host places beside the\n// chat; `overlay` makes it a drawer over the page from the right, and on a phone the dropdown is a\n// sheet from the bottom.\n//\n// Transport and rendering stay the host's, exactly as for FilePreview: `fetchFile` (with the\n// host's auth), `renderMarkdown`, `officePdfUrl`, `parseWorkbook`, `onDownload`.\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { FilePreview } from '../components/FilePreview.jsx';\nimport { FileTypeIcon } from '../components/FileTypeIcon.jsx';\nimport { bytesLabel } from '../format.js';\n\nconst FILTER_AT = 8; // more files than this, and the list opens with a filter box\n\n/** \"epsilla-enterprise-subscr…store-v2.png\": the start and the end, which is where names differ. */\nexport function middleEllipsis(name, max = 40) {\n const s = String(name || '');\n if (s.length <= max) return s;\n const tail = Math.min(Math.max(10, Math.floor(max * 0.45)), max - 4);\n return `${s.slice(0, max - tail - 1)}…${s.slice(-tail)}`;\n}\n\n/** A name that truncates in the MIDDLE at whatever width it gets: the start shrinks with an ellipsis,\n * the end (where similar names differ: \"-v2\", the extension) always shows. */\nexport function MidName(props) {\n const { name, className } = props;\n const s = String(name || '');\n const cut = s.length > 16 ? s.length - Math.min(14, Math.floor(s.length / 2)) : s.length;\n return (\n <span className={'uac-mid' + (className ? ` ${className}` : '')}>\n <span className=\"uac-mid-h\">{s.slice(0, cut)}</span>{cut < s.length ? <span className=\"uac-mid-t\">{s.slice(cut)}</span> : null}\n </span>\n );\n}\n\nfunction dirOf(path) {\n const p = String(path || '');\n const i = p.lastIndexOf('/');\n return i > 0 ? p.slice(0, i) : '';\n}\n\nfunction Check() {\n return (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M5 12l5 5L20 7\" />\n </svg>\n );\n}\n\n/** The name in the header, as a dropdown of every file. `files`: [{key, name, path?, size?, turn?}]. */\nexport function FileSwitcher(props) {\n const { files, current, onSelect, label = 'Files in this conversation', turnLabel = (n) => `Turn ${n}` } = props;\n const [open, setOpen] = useState(false);\n const [q, setQ] = useState('');\n const [hi, setHi] = useState(0);\n const root = useRef(null);\n const list = useRef(null);\n const input = useRef(null);\n const btn = useRef(null);\n const id = useRef(`uac-fs-${Math.random().toString(36).slice(2, 9)}`).current;\n const cur = files.find((f) => f.key === current) || files[0];\n const needle = q.trim().toLowerCase();\n const shown = useMemo(() => files.filter((f) => !needle || String(f.path || f.name).toLowerCase().includes(needle)), [files, needle]);\n // by folder, in the order folders first appear; the root (no folder) first\n const groups = useMemo(() => {\n const by = new Map();\n for (const f of shown) {\n const d = dirOf(f.path);\n if (!by.has(d)) by.set(d, []);\n by.get(d).push(f);\n }\n return [...by.entries()].sort((a, b) => (a[0] === '' ? -1 : b[0] === '' ? 1 : 0));\n }, [shown]);\n const flat = groups.flatMap(([, fs]) => fs);\n const grouped = groups.length > 1 || (groups.length === 1 && groups[0][0] !== '');\n const many = files.length > FILTER_AT;\n\n useEffect(() => {\n if (!open) return undefined;\n setHi(Math.max(0, flat.findIndex((f) => f.key === (cur && cur.key))));\n const t = setTimeout(() => { if (many && input.current) input.current.focus(); else if (list.current) list.current.focus(); }, 0);\n const away = (e) => { if (root.current && !root.current.contains(e.target)) setOpen(false); };\n document.addEventListener('mousedown', away);\n document.addEventListener('touchstart', away);\n return () => { clearTimeout(t); document.removeEventListener('mousedown', away); document.removeEventListener('touchstart', away); };\n }, [open]); // eslint-disable-line react-hooks/exhaustive-deps\n useEffect(() => { setHi(0); }, [needle]);\n useEffect(() => {\n if (!open || !list.current) return;\n const el = list.current.querySelector(`[data-i=\"${hi}\"]`);\n if (el && el.scrollIntoView) el.scrollIntoView({ block: 'nearest' });\n }, [hi, open]);\n\n if (!cur) return null;\n const pick = (f) => { setOpen(false); setQ(''); if (f && onSelect) onSelect(f.key); if (btn.current) btn.current.focus(); };\n const keys = (e) => {\n if (e.key === 'ArrowDown') { e.preventDefault(); setHi((i) => Math.min(flat.length - 1, i + 1)); }\n else if (e.key === 'ArrowUp') { e.preventDefault(); setHi((i) => Math.max(0, i - 1)); }\n else if (e.key === 'Home') { e.preventDefault(); setHi(0); }\n else if (e.key === 'End') { e.preventDefault(); setHi(flat.length - 1); }\n else if (e.key === 'Enter') { e.preventDefault(); pick(flat[hi]); }\n else if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); setOpen(false); if (btn.current) btn.current.focus(); }\n else if (e.key === 'Tab') setOpen(false);\n };\n const single = files.length < 2;\n let i = -1;\n return (\n <div ref={root} className={'uac-fs' + (open ? ' is-open' : '')}>\n <button ref={btn} type=\"button\" className=\"uac-fs-btn\" title={cur.path || cur.name} disabled={single}\n aria-haspopup={single ? undefined : 'listbox'} aria-expanded={single ? undefined : open} aria-controls={single ? undefined : id}\n onClick={() => setOpen((v) => !v)}\n onKeyDown={(e) => { if (!single && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) { e.preventDefault(); setOpen(true); } }}>\n <MidName name={cur.name} className=\"uac-fs-name\" />\n {single ? null : (\n <svg className=\"uac-fs-chev\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\"><path d=\"M6 9l6 6 6-6\" /></svg>\n )}\n </button>\n {open ? (\n <>\n <div className=\"uac-fs-scrim\" aria-hidden=\"true\" onClick={() => setOpen(false)} />\n <div className=\"uac-fs-pop\" onKeyDown={keys}>\n <div className=\"uac-fs-head\"><span>{label}</span><span className=\"uac-fs-count\">{files.length}</span></div>\n {many ? (\n <input ref={input} className=\"uac-fs-q\" type=\"search\" placeholder=\"Find a file\" value={q} autoComplete=\"off\" spellCheck={false}\n aria-label=\"Find a file\" aria-controls={id} onChange={(e) => setQ(e.target.value)} />\n ) : null}\n <div ref={list} id={id} className=\"uac-fs-list\" role=\"listbox\" tabIndex={-1} aria-label={label}\n aria-activedescendant={flat[hi] ? `${id}-${hi}` : undefined}>\n {groups.map(([dir, fs]) => (\n <div key={dir || '.'} role=\"group\" aria-label={dir || 'Top level'}>\n {grouped ? <div className=\"uac-fs-dir\" aria-hidden=\"true\">{dir || 'Top level'}</div> : null}\n {fs.map((f) => {\n i += 1;\n const n = i;\n const on = f.key === cur.key;\n const meta = [f.size != null ? bytesLabel(f.size) : '', f.turn != null ? turnLabel(f.turn) : ''].filter(Boolean).join(' · ');\n return (\n <div key={f.key} id={`${id}-${n}`} data-i={n} role=\"option\" aria-selected={on}\n className={'uac-fs-opt' + (on ? ' is-on' : '') + (n === hi ? ' is-hi' : '')}\n title={f.path || f.name} onMouseEnter={() => setHi(n)} onClick={() => pick(f)}>\n <FileTypeIcon name={f.name} size={16} />\n <MidName name={f.name} className=\"uac-fs-on\" />\n {meta ? <span className=\"uac-fs-meta\">{meta}</span> : null}\n <span className=\"uac-fs-ck\">{on ? <Check /> : null}</span>\n </div>\n );\n })}\n </div>\n ))}\n {!flat.length ? <div className=\"uac-fs-none\">No file matches.</div> : null}\n </div>\n </div>\n </>\n ) : null}\n </div>\n );\n}\n\n/**\n * files: [{ key, name, url, path?, size?, turn? }] (key: stable id, e.g. the file id; path: where it\n * sits in the workspace, for folders; size in bytes and the turn that made it, when known).\n */\nexport function ArtifactPanel(props) {\n const {\n files = [], active, onSelect, onClose, overlay = false, label = 'Files in this conversation', turnLabel,\n fetchFile, renderMarkdown, officePdfUrl, parseWorkbook, onDownload, className,\n } = props;\n const ref = useRef(null);\n const cur = files.find((f) => f.key === active) || files[0] || null;\n // a drawer takes the focus and gives it back with Escape, like any dialog\n useEffect(() => {\n if (!overlay || !cur) return undefined;\n const back = document.activeElement;\n const t = setTimeout(() => { const b = ref.current && ref.current.querySelector('button'); if (b) b.focus(); }, 0);\n const key = (e) => { if (e.key === 'Escape' && !e.defaultPrevented) { e.stopPropagation(); onClose && onClose(); } };\n document.addEventListener('keydown', key);\n return () => { clearTimeout(t); document.removeEventListener('keydown', key); if (back && back.focus) back.focus(); };\n }, [overlay, !!cur]); // eslint-disable-line react-hooks/exhaustive-deps\n if (!cur) return null;\n const switcher = <FileSwitcher files={files} current={cur.key} onSelect={onSelect} label={label} turnLabel={turnLabel} />;\n return (\n <>\n {overlay ? <div className=\"uac-art-scrim\" aria-hidden=\"true\" onClick={() => onClose && onClose()} /> : null}\n <div ref={ref} className={'uac-art' + (overlay ? ' is-overlay' : '') + (className ? ` ${className}` : '')}\n role={overlay ? 'dialog' : undefined} aria-modal={overlay ? 'true' : undefined} aria-label={overlay ? `Preview of ${cur.name}` : undefined}>\n <FilePreview key={cur.key} file={{ url: cur.url, name: cur.name }} onClose={onClose} nameSlot={switcher}\n fetchFile={fetchFile} renderMarkdown={renderMarkdown} officePdfUrl={officePdfUrl} parseWorkbook={parseWorkbook} onDownload={onDownload} />\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,IAAM,eAAe;AAAA,EAC1B,eAAe;AAAA,EAAS,QAAQ;AAAA,EAAS,WAAW;AAAA,EACpD,OAAO;AAAA,EAAS,QAAQ;AAAA,EACxB,QAAQ;AAAA,EAAS,cAAc;AAAA,EAC/B,QAAQ;AAAA,EACR,OAAO;AAAA,EAC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,MAAM,CAAC,MAAM;AAAE,UAAI,EAAE,QAAQ,YAAY,CAAC,EAAE,kBAAkB;AAAE,UAAE,gBAAgB;AAAG,mBAAW,QAAQ;AAAA,MAAG;AAAA,IAAE;AACnH,aAAS,iBAAiB,WAAW,GAAG;AACxC,WAAO,MAAM;AAAE,mBAAa,CAAC;AAAG,eAAS,oBAAoB,WAAW,GAAG;AAAG,UAAI,QAAQ,KAAK,MAAO,MAAK,MAAM;AAAA,IAAG;AAAA,EACtH,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC;AACnB,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,WAAW,oBAAC,gBAAa,OAAc,SAAS,IAAI,KAAK,UAAoB,OAAc,WAAsB;AACvH,SACE,iCACG;AAAA,cAAU,oBAAC,SAAI,WAAU,iBAAgB,eAAY,QAAO,SAAS,MAAM,WAAW,QAAQ,GAAG,IAAK;AAAA,IACvG;AAAA,MAAC;AAAA;AAAA,QAAI;AAAA,QAAU,WAAW,aAAa,UAAU,gBAAgB,OAAO,YAAY,IAAI,SAAS,KAAK;AAAA,QACpG,MAAM,UAAU,WAAW;AAAA,QAAW,cAAY,UAAU,SAAS;AAAA,QAAW,cAAY,UAAU,cAAc,IAAI,IAAI,KAAK;AAAA,QACjI;AAAA,UAAC;AAAA;AAAA,YAA0B,MAAM,EAAE,KAAK,IAAI,KAAK,MAAM,IAAI,KAAK;AAAA,YAAG;AAAA,YAAkB,UAAU;AAAA,YAC7F;AAAA,YAAsB;AAAA,YAAgC;AAAA,YAA4B;AAAA,YAA8B;AAAA;AAAA,UADhG,IAAI;AAAA,QACoH;AAAA;AAAA,IAC5I;AAAA,KACF;AAEJ;","names":["i"]}
|
|
1
|
+
{"version":3,"sources":["../src/agent-chat/marks.js","../src/agent-chat/artifacts.jsx"],"sourcesContent":["// The working mark: each harness's own logo, moving the way that logo suggests.\n//\n// The package ships the MOTIONS (CSS keyframes in styles/agent-chat.css), never the logos: a\n// host passes its official mark as a node and names a motion. motionFor(base) is the house\n// choice for the harnesses we know, picked by looking at each mark:\n//\n// bloom the Claude starburst turns a quarter and breathes, like the CLI's ✻ ✽ ✶ spinner\n// sheen a light passes across the tile (Codex's prompt, Kimi's K, Kilo's grid)\n// glint brightens and swells, a spark catching light (Gemini)\n// flutter a quick wing beat, tilt and lift (Hermes, the messenger)\n// glide a bird's lift and settle (Goose)\n// blink the tile blinks shut and open, a terminal cursor (OpenCode)\n// flip a coin turning on its vertical axis (pi, omp)\n// swim a short wave from nose to tail (DeepSeek's whale)\n// spin a steady revolution, for round marks (Qwen, Grok, System One, OpenSquilla)\n// wave hands waving from the wrist (OpenHands)\n// dash a sprint forward and back (CheetahClaws)\n// scuttle a sideways skitter (ZeroClaw's crab)\n// equalize a level meter rising and falling (MiniMax's waveform)\n// bob a soft hop (robots and app tiles: Cline, Agent Zero, Qoder, nanobot)\n// pulse the default: scale and opacity breathing\n//\n// Every motion stops under prefers-reduced-motion; the mark then stands still and the line's\n// words alone say the work is going on.\n\nexport const MARK_MOTIONS = {\n 'claude-code': 'bloom', claude: 'bloom', anthropic: 'bloom',\n codex: 'sheen', openai: 'sheen',\n gemini: 'glint', 'gemini-cli': 'glint',\n hermes: 'flutter',\n goose: 'glide',\n opencode: 'blink',\n pi: 'flip', omp: 'flip',\n dsh: 'swim', deepseek: 'swim',\n qwen: 'spin', grok: 'spin', systemone: 'spin', opensquilla: 'spin',\n openhands: 'wave',\n cheetahclaws: 'dash',\n zeroclaw: 'scuttle',\n minimax: 'equalize',\n cline: 'bob', agentzero: 'bob', qoder: 'bob', nanobot: 'bob',\n kimi: 'sheen', kilo: 'sheen', jcode: 'pulse', mimo: 'pulse', aider: 'pulse',\n};\n\nexport const MOTIONS = ['bloom', 'sheen', 'glint', 'flutter', 'glide', 'blink', 'flip', 'swim', 'spin', 'wave',\n 'dash', 'scuttle', 'equalize', 'bob', 'pulse', 'dots'];\n\n/** The motion for a base harness id, 'pulse' for one we do not know. */\nexport function motionFor(base) {\n const k = String(base || '').toLowerCase().trim();\n return MARK_MOTIONS[k] || 'pulse';\n}\n","// The files a turn produced, opened beside the conversation instead of printed into it.\n//\n// In the conversation a file is a card (the package's FileCard: its kind, Copy, Download, and the\n// whole card opens it). Opened, it shows here, under ONE header row: the file's kind, its name as a\n// switcher (a dropdown of every file of the conversation, grouped by folder, filterable when there are\n// many, keyboard driven), then Copy, Download and Close. Below, the file rendered (Markdown as a\n// document, code highlighted, images, PDFs, sheets). Docked, it is a column the host places beside the\n// chat; `overlay` makes it a drawer over the page from the right, and on a phone the dropdown is a\n// sheet from the bottom.\n//\n// Transport and rendering stay the host's, exactly as for FilePreview: `fetchFile` (with the\n// host's auth), `renderMarkdown`, `officePdfUrl`, `parseWorkbook`, `onDownload`.\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { FilePreview } from '../components/FilePreview.jsx';\nimport { FileTypeIcon } from '../components/FileTypeIcon.jsx';\nimport { bytesLabel } from '../format.js';\n\nconst FILTER_AT = 8; // more files than this, and the list opens with a filter box\n\n/** \"epsilla-enterprise-subscr…store-v2.png\": the start and the end, which is where names differ. */\nexport function middleEllipsis(name, max = 40) {\n const s = String(name || '');\n if (s.length <= max) return s;\n const tail = Math.min(Math.max(10, Math.floor(max * 0.45)), max - 4);\n return `${s.slice(0, max - tail - 1)}…${s.slice(-tail)}`;\n}\n\n/** A name that truncates in the MIDDLE at whatever width it gets: the start shrinks with an ellipsis,\n * the end (where similar names differ: \"-v2\", the extension) always shows. */\nexport function MidName(props) {\n const { name, className } = props;\n const s = String(name || '');\n const cut = s.length > 16 ? s.length - Math.min(14, Math.floor(s.length / 2)) : s.length;\n return (\n <span className={'uac-mid' + (className ? ` ${className}` : '')}>\n <span className=\"uac-mid-h\">{s.slice(0, cut)}</span>{cut < s.length ? <span className=\"uac-mid-t\">{s.slice(cut)}</span> : null}\n </span>\n );\n}\n\nfunction dirOf(path) {\n const p = String(path || '');\n const i = p.lastIndexOf('/');\n return i > 0 ? p.slice(0, i) : '';\n}\n\nfunction Check() {\n return (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M5 12l5 5L20 7\" />\n </svg>\n );\n}\n\n/** The name in the header, as a dropdown of every file. `files`: [{key, name, path?, size?, turn?}]. */\nexport function FileSwitcher(props) {\n const { files, current, onSelect, label = 'Files in this conversation', turnLabel = (n) => `Turn ${n}` } = props;\n const [open, setOpen] = useState(false);\n const [q, setQ] = useState('');\n const [hi, setHi] = useState(0);\n const root = useRef(null);\n const list = useRef(null);\n const input = useRef(null);\n const btn = useRef(null);\n const id = useRef(`uac-fs-${Math.random().toString(36).slice(2, 9)}`).current;\n const cur = files.find((f) => f.key === current) || files[0];\n const needle = q.trim().toLowerCase();\n const shown = useMemo(() => files.filter((f) => !needle || String(f.path || f.name).toLowerCase().includes(needle)), [files, needle]);\n // by folder, in the order folders first appear; the root (no folder) first\n const groups = useMemo(() => {\n const by = new Map();\n for (const f of shown) {\n const d = dirOf(f.path);\n if (!by.has(d)) by.set(d, []);\n by.get(d).push(f);\n }\n return [...by.entries()].sort((a, b) => (a[0] === '' ? -1 : b[0] === '' ? 1 : 0));\n }, [shown]);\n const flat = groups.flatMap(([, fs]) => fs);\n const grouped = groups.length > 1 || (groups.length === 1 && groups[0][0] !== '');\n const many = files.length > FILTER_AT;\n\n useEffect(() => {\n if (!open) return undefined;\n setHi(Math.max(0, flat.findIndex((f) => f.key === (cur && cur.key))));\n const t = setTimeout(() => { if (many && input.current) input.current.focus(); else if (list.current) list.current.focus(); }, 0);\n const away = (e) => { if (root.current && !root.current.contains(e.target)) setOpen(false); };\n document.addEventListener('mousedown', away);\n document.addEventListener('touchstart', away);\n return () => { clearTimeout(t); document.removeEventListener('mousedown', away); document.removeEventListener('touchstart', away); };\n }, [open]); // eslint-disable-line react-hooks/exhaustive-deps\n useEffect(() => { setHi(0); }, [needle]);\n useEffect(() => {\n if (!open || !list.current) return;\n const el = list.current.querySelector(`[data-i=\"${hi}\"]`);\n if (el && el.scrollIntoView) el.scrollIntoView({ block: 'nearest' });\n }, [hi, open]);\n\n if (!cur) return null;\n const pick = (f) => { setOpen(false); setQ(''); if (f && onSelect) onSelect(f.key); if (btn.current) btn.current.focus(); };\n const keys = (e) => {\n if (e.key === 'ArrowDown') { e.preventDefault(); setHi((i) => Math.min(flat.length - 1, i + 1)); }\n else if (e.key === 'ArrowUp') { e.preventDefault(); setHi((i) => Math.max(0, i - 1)); }\n else if (e.key === 'Home') { e.preventDefault(); setHi(0); }\n else if (e.key === 'End') { e.preventDefault(); setHi(flat.length - 1); }\n else if (e.key === 'Enter') { e.preventDefault(); pick(flat[hi]); }\n else if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); setOpen(false); if (btn.current) btn.current.focus(); }\n else if (e.key === 'Tab') setOpen(false);\n };\n const single = files.length < 2;\n let i = -1;\n return (\n <div ref={root} className={'uac-fs' + (open ? ' is-open' : '')}>\n <button ref={btn} type=\"button\" className=\"uac-fs-btn\" title={cur.path || cur.name} disabled={single}\n aria-haspopup={single ? undefined : 'listbox'} aria-expanded={single ? undefined : open} aria-controls={single ? undefined : id}\n onClick={() => setOpen((v) => !v)}\n onKeyDown={(e) => { if (!single && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) { e.preventDefault(); setOpen(true); } }}>\n <MidName name={cur.name} className=\"uac-fs-name\" />\n {single ? null : (\n <svg className=\"uac-fs-chev\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\"><path d=\"M6 9l6 6 6-6\" /></svg>\n )}\n </button>\n {open ? (\n <>\n <div className=\"uac-fs-scrim\" aria-hidden=\"true\" onClick={() => setOpen(false)} />\n <div className=\"uac-fs-pop\" onKeyDown={keys}>\n <div className=\"uac-fs-head\"><span>{label}</span><span className=\"uac-fs-count\">{files.length}</span></div>\n {many ? (\n <input ref={input} className=\"uac-fs-q\" type=\"search\" placeholder=\"Find a file\" value={q} autoComplete=\"off\" spellCheck={false}\n aria-label=\"Find a file\" aria-controls={id} onChange={(e) => setQ(e.target.value)} />\n ) : null}\n <div ref={list} id={id} className=\"uac-fs-list\" role=\"listbox\" tabIndex={-1} aria-label={label}\n aria-activedescendant={flat[hi] ? `${id}-${hi}` : undefined}>\n {groups.map(([dir, fs]) => (\n <div key={dir || '.'} role=\"group\" aria-label={dir || 'Top level'}>\n {grouped ? <div className=\"uac-fs-dir\" aria-hidden=\"true\">{dir || 'Top level'}</div> : null}\n {fs.map((f) => {\n i += 1;\n const n = i;\n const on = f.key === cur.key;\n const meta = [f.size != null ? bytesLabel(f.size) : '', f.turn != null ? turnLabel(f.turn) : ''].filter(Boolean).join(' · ');\n return (\n <div key={f.key} id={`${id}-${n}`} data-i={n} role=\"option\" aria-selected={on}\n className={'uac-fs-opt' + (on ? ' is-on' : '') + (n === hi ? ' is-hi' : '')}\n title={f.path || f.name} onMouseEnter={() => setHi(n)} onClick={() => pick(f)}>\n <FileTypeIcon name={f.name} size={16} />\n <MidName name={f.name} className=\"uac-fs-on\" />\n {meta ? <span className=\"uac-fs-meta\">{meta}</span> : null}\n <span className=\"uac-fs-ck\">{on ? <Check /> : null}</span>\n </div>\n );\n })}\n </div>\n ))}\n {!flat.length ? <div className=\"uac-fs-none\">No file matches.</div> : null}\n </div>\n </div>\n </>\n ) : null}\n </div>\n );\n}\n\n/**\n * files: [{ key, name, url, path?, size?, turn? }] (key: stable id, e.g. the file id; path: where it\n * sits in the workspace, for folders; size in bytes and the turn that made it, when known).\n */\nexport function ArtifactPanel(props) {\n const {\n files = [], active, onSelect, onClose, overlay = false, label = 'Files in this conversation', turnLabel,\n fetchFile, renderMarkdown, officePdfUrl, parseWorkbook, onDownload, className,\n } = props;\n const ref = useRef(null);\n const cur = files.find((f) => f.key === active) || files[0] || null;\n // a drawer takes the focus and gives it back with Escape, like any dialog\n useEffect(() => {\n if (!overlay || !cur) return undefined;\n const back = document.activeElement;\n const t = setTimeout(() => { const b = ref.current && ref.current.querySelector('button'); if (b) b.focus(); }, 0);\n const key = (e) => { if (e.key === 'Escape' && !e.defaultPrevented) { e.stopPropagation(); onClose && onClose(); } };\n document.addEventListener('keydown', key);\n return () => { clearTimeout(t); document.removeEventListener('keydown', key); if (back && back.focus) back.focus(); };\n }, [overlay, !!cur]); // eslint-disable-line react-hooks/exhaustive-deps\n if (!cur) return null;\n const switcher = <FileSwitcher files={files} current={cur.key} onSelect={onSelect} label={label} turnLabel={turnLabel} />;\n return (\n <>\n {overlay ? <div className=\"uac-art-scrim\" aria-hidden=\"true\" onClick={() => onClose && onClose()} /> : null}\n <div ref={ref} className={'uac-art' + (overlay ? ' is-overlay' : '') + (className ? ` ${className}` : '')}\n role={overlay ? 'dialog' : undefined} aria-modal={overlay ? 'true' : undefined} aria-label={overlay ? `Preview of ${cur.name}` : undefined}>\n <FilePreview key={cur.key} file={{ url: cur.url, name: cur.name }} onClose={onClose} nameSlot={switcher}\n fetchFile={fetchFile} renderMarkdown={renderMarkdown} officePdfUrl={officePdfUrl} parseWorkbook={parseWorkbook} onDownload={onDownload} />\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,IAAM,eAAe;AAAA,EAC1B,eAAe;AAAA,EAAS,QAAQ;AAAA,EAAS,WAAW;AAAA,EACpD,OAAO;AAAA,EAAS,QAAQ;AAAA,EACxB,QAAQ;AAAA,EAAS,cAAc;AAAA,EAC/B,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,UAAU;AAAA,EACV,IAAI;AAAA,EAAQ,KAAK;AAAA,EACjB,KAAK;AAAA,EAAQ,UAAU;AAAA,EACvB,MAAM;AAAA,EAAQ,MAAM;AAAA,EAAQ,WAAW;AAAA,EAAQ,aAAa;AA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W,GAAG;AACxC,WAAO,MAAM;AAAE,mBAAa,CAAC;AAAG,eAAS,oBAAoB,WAAW,GAAG;AAAG,UAAI,QAAQ,KAAK,MAAO,MAAK,MAAM;AAAA,IAAG;AAAA,EACtH,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC;AACnB,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,WAAW,oBAAC,gBAAa,OAAc,SAAS,IAAI,KAAK,UAAoB,OAAc,WAAsB;AACvH,SACE,iCACG;AAAA,cAAU,oBAAC,SAAI,WAAU,iBAAgB,eAAY,QAAO,SAAS,MAAM,WAAW,QAAQ,GAAG,IAAK;AAAA,IACvG;AAAA,MAAC;AAAA;AAAA,QAAI;AAAA,QAAU,WAAW,aAAa,UAAU,gBAAgB,OAAO,YAAY,IAAI,SAAS,KAAK;AAAA,QACpG,MAAM,UAAU,WAAW;AAAA,QAAW,cAAY,UAAU,SAAS;AAAA,QAAW,cAAY,UAAU,cAAc,IAAI,IAAI,KAAK;AAAA,QACjI;AAAA,UAAC;AAAA;AAAA,YAA0B,MAAM,EAAE,KAAK,IAAI,KAAK,MAAM,IAAI,KAAK;AAAA,YAAG;AAAA,YAAkB,UAAU;AAAA,YAC7F;AAAA,YAAsB;AAAA,YAAgC;AAAA,YAA4B;AAAA,YAA8B;AAAA;AAAA,UADhG,IAAI;AAAA,QACoH;AAAA;AAAA,IAC5I;AAAA,KACF;AAEJ;","names":["i"]}
|
|
@@ -169,6 +169,7 @@ var NS = /^(developer|platform|computercontroller|builtin|default|functions|tool
|
|
|
169
169
|
function toolKind(name) {
|
|
170
170
|
const raw = String(name || "").trim();
|
|
171
171
|
if (!raw) return "tool";
|
|
172
|
+
if (browserActOf(raw) !== null) return "browser";
|
|
172
173
|
if (/^mcp__/i.test(raw)) return "mcp";
|
|
173
174
|
const n = raw.toLowerCase().replace(NS, "");
|
|
174
175
|
if (KIND_BY_NAME[n]) return KIND_BY_NAME[n];
|
|
@@ -319,6 +320,195 @@ function shortUrl(u) {
|
|
|
319
320
|
function humanizeName(n) {
|
|
320
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());
|
|
321
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
|
+
}
|
|
322
512
|
var VERBS = {
|
|
323
513
|
shell: ["Running", "Ran"],
|
|
324
514
|
shell_output: ["Reading output of", "Read output of"],
|
|
@@ -339,7 +529,7 @@ var VERBS = {
|
|
|
339
529
|
mcp: ["Using", "Used"],
|
|
340
530
|
tool: ["Using", "Used"]
|
|
341
531
|
};
|
|
342
|
-
function describeTool(name, args) {
|
|
532
|
+
function describeTool(name, args, opts) {
|
|
343
533
|
const a = parseToolArgs(args);
|
|
344
534
|
let kind = toolKind(name);
|
|
345
535
|
const nm = str(name);
|
|
@@ -349,6 +539,7 @@ function describeTool(name, args) {
|
|
|
349
539
|
let targetFull = "";
|
|
350
540
|
let mono = false;
|
|
351
541
|
let note = "";
|
|
542
|
+
let browser = null;
|
|
352
543
|
const pathOf = () => firstOf(a, [
|
|
353
544
|
"file_path",
|
|
354
545
|
"path",
|
|
@@ -426,11 +617,9 @@ function describeTool(name, args) {
|
|
|
426
617
|
targetFull = target;
|
|
427
618
|
break;
|
|
428
619
|
case "browser": {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
targetFull = target;
|
|
433
|
-
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;
|
|
434
623
|
break;
|
|
435
624
|
}
|
|
436
625
|
case "mcp":
|
|
@@ -442,7 +631,7 @@ function describeTool(name, args) {
|
|
|
442
631
|
default:
|
|
443
632
|
break;
|
|
444
633
|
}
|
|
445
|
-
const v = VERBS[kind] || VERBS.tool;
|
|
634
|
+
const v = browser ? [browser.running, browser.done] : VERBS[kind] || VERBS.tool;
|
|
446
635
|
return {
|
|
447
636
|
kind,
|
|
448
637
|
target: target.replace(/\s+/g, " ").trim(),
|
|
@@ -460,7 +649,9 @@ function toolLine(d, state) {
|
|
|
460
649
|
if (d.kind === "todo" || d.kind === "toolsearch" || d.kind === "think") return verb;
|
|
461
650
|
if (d.kind === "shell" && d.target && !d.mono) return d.target;
|
|
462
651
|
if (d.kind === "mcp" || d.kind === "tool") return `${verb} ${d.target || "a tool"}`;
|
|
463
|
-
|
|
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)$/, "");
|
|
464
655
|
}
|
|
465
656
|
var KIND_NOUN = {
|
|
466
657
|
shell: "a command",
|
|
@@ -500,7 +691,7 @@ var PHRASES = {
|
|
|
500
691
|
function summarizeCalls(calls) {
|
|
501
692
|
const list = (calls || []).filter(Boolean);
|
|
502
693
|
if (!list.length) return "";
|
|
503
|
-
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");
|
|
504
695
|
const order = [];
|
|
505
696
|
const count = {};
|
|
506
697
|
for (const c of list) {
|
|
@@ -1277,8 +1468,9 @@ function StepDetail(props) {
|
|
|
1277
1468
|
] });
|
|
1278
1469
|
}
|
|
1279
1470
|
function StepRow(props) {
|
|
1280
|
-
const { item, labels = DEFAULT_AGENT_LABELS, defaultOpen = false } = props;
|
|
1281
|
-
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;
|
|
1282
1474
|
const [open, setOpen] = useState2(defaultOpen);
|
|
1283
1475
|
const uid = useRef(`uac-s-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
1284
1476
|
const running = item.status === "running";
|
|
@@ -1288,8 +1480,8 @@ function StepRow(props) {
|
|
|
1288
1480
|
const verb = running ? d.running : d.done;
|
|
1289
1481
|
const hasTarget = d.target && line === `${verb} ${d.target}`;
|
|
1290
1482
|
const note = !running && item.status !== "failed" ? resultNote(d.kind, item.output) : "";
|
|
1291
|
-
const hasDetail = !!(item.args && item.args !== "{}" && item.args !== '""') || item.output !== void 0;
|
|
1292
|
-
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: [
|
|
1293
1485
|
/* @__PURE__ */ jsxs(
|
|
1294
1486
|
"button",
|
|
1295
1487
|
{
|
|
@@ -1297,8 +1489,9 @@ function StepRow(props) {
|
|
|
1297
1489
|
className: "uac-step-h",
|
|
1298
1490
|
"aria-expanded": hasDetail ? open : void 0,
|
|
1299
1491
|
"aria-controls": hasDetail ? uid : void 0,
|
|
1300
|
-
|
|
1301
|
-
|
|
1492
|
+
"aria-current": opener && active ? "true" : void 0,
|
|
1493
|
+
disabled: !opener && !hasDetail,
|
|
1494
|
+
onClick: opener || (() => setOpen((v) => !v)),
|
|
1302
1495
|
title: d.targetFull || void 0,
|
|
1303
1496
|
children: [
|
|
1304
1497
|
/* @__PURE__ */ jsx(StatusGlyph, { status: item.status, kind: d.kind }),
|
|
@@ -1314,7 +1507,7 @@ function StepRow(props) {
|
|
|
1314
1507
|
note ? /* @__PURE__ */ jsx("span", { className: "uac-step-n", children: note }) : null,
|
|
1315
1508
|
item.status === "stopped" ? /* @__PURE__ */ jsx("span", { className: "uac-step-n", children: labels.stoppedCall }) : null,
|
|
1316
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,
|
|
1317
|
-
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
|
|
1318
1511
|
]
|
|
1319
1512
|
}
|
|
1320
1513
|
),
|
|
@@ -1366,14 +1559,26 @@ function sumDiff(tools) {
|
|
|
1366
1559
|
return any ? { added, removed } : null;
|
|
1367
1560
|
}
|
|
1368
1561
|
function WorkGroup(props) {
|
|
1369
|
-
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;
|
|
1370
1575
|
const [open, setOpen] = useState2(defaultOpen);
|
|
1371
1576
|
const uid = useRef(`uac-g-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
1372
1577
|
const tools = items.filter((x) => x.kind === "tool");
|
|
1373
1578
|
const thoughts = items.filter((x) => x.kind === "thinking");
|
|
1374
1579
|
const failed = tools.filter((x) => x.status === "failed").length;
|
|
1375
1580
|
let summary = "";
|
|
1376
|
-
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);
|
|
1377
1582
|
else if (thoughts.length) {
|
|
1378
1583
|
const t = thoughts[0];
|
|
1379
1584
|
const ms = t.startedAt != null && t.endedAt != null ? t.endedAt - t.startedAt : null;
|
|
@@ -1381,7 +1586,17 @@ function WorkGroup(props) {
|
|
|
1381
1586
|
}
|
|
1382
1587
|
const diff = sumDiff(tools);
|
|
1383
1588
|
if (!live && !tools.length && !thoughts.some((t) => String(t.text || "").trim())) return null;
|
|
1384
|
-
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;
|
|
1385
1600
|
if (live) {
|
|
1386
1601
|
return /* @__PURE__ */ jsxs("div", { className: cls("uac-group", "is-live", open && "is-open"), children: [
|
|
1387
1602
|
/* @__PURE__ */ jsx(
|
|
@@ -1519,9 +1734,13 @@ function AgentTurnView(props) {
|
|
|
1519
1734
|
renderFiles,
|
|
1520
1735
|
actions,
|
|
1521
1736
|
describeIncomplete,
|
|
1522
|
-
liveStart
|
|
1737
|
+
liveStart,
|
|
1738
|
+
openStep,
|
|
1739
|
+
activeStep = null
|
|
1523
1740
|
} = props;
|
|
1524
1741
|
const labels = useMemo(() => ({ ...DEFAULT_AGENT_LABELS, ...labelsIn || {} }), [labelsIn]);
|
|
1742
|
+
const items = turn ? turn.items : null;
|
|
1743
|
+
const elements = useMemo(() => browserElements(items), [items]);
|
|
1525
1744
|
if (!turn) return null;
|
|
1526
1745
|
const running = turn.status === "running";
|
|
1527
1746
|
const segs = segments(turn);
|
|
@@ -1532,7 +1751,7 @@ function AgentTurnView(props) {
|
|
|
1532
1751
|
const liveWork = running && lastSeg && lastSeg.type === "work";
|
|
1533
1752
|
let liveLabel = labels.thinking;
|
|
1534
1753
|
if (now) {
|
|
1535
|
-
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");
|
|
1536
1755
|
else if (now.phase === "writing") liveLabel = labels.writing;
|
|
1537
1756
|
else if (now.phase === "starting") liveLabel = labels.starting;
|
|
1538
1757
|
}
|
|
@@ -1550,7 +1769,21 @@ function AgentTurnView(props) {
|
|
|
1550
1769
|
if (isLive) {
|
|
1551
1770
|
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
1552
1771
|
plan ? /* @__PURE__ */ jsx(TodoCard, { todos: plan, labels, running: true }) : null,
|
|
1553
|
-
/* @__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
|
+
)
|
|
1554
1787
|
] }, `w${i}`);
|
|
1555
1788
|
}
|
|
1556
1789
|
if (s.type === "text") {
|
|
@@ -1564,7 +1797,17 @@ function AgentTurnView(props) {
|
|
|
1564
1797
|
s.item.id || `t${i}`
|
|
1565
1798
|
);
|
|
1566
1799
|
}
|
|
1567
|
-
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
|
+
);
|
|
1568
1811
|
}),
|
|
1569
1812
|
!liveWork && plan ? /* @__PURE__ */ jsx(TodoCard, { todos: plan, labels, running }) : null,
|
|
1570
1813
|
running && !liveWork ? /* @__PURE__ */ jsx(WorkingIndicator, { mark, motion, start, label: liveLabel }) : null,
|
|
@@ -2272,6 +2515,8 @@ export {
|
|
|
2272
2515
|
patchStats,
|
|
2273
2516
|
diffOf,
|
|
2274
2517
|
todosOf,
|
|
2518
|
+
browserActOf,
|
|
2519
|
+
browserElements,
|
|
2275
2520
|
describeTool,
|
|
2276
2521
|
toolLine,
|
|
2277
2522
|
summarizeCalls,
|
|
@@ -2314,4 +2559,4 @@ export {
|
|
|
2314
2559
|
FileCard,
|
|
2315
2560
|
FilePreview
|
|
2316
2561
|
};
|
|
2317
|
-
//# sourceMappingURL=chunk-
|
|
2562
|
+
//# sourceMappingURL=chunk-Y2MBOXQC.js.map
|