reifyui 0.17.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agent-chat.cjs +273 -27
- package/dist/agent-chat.cjs.map +1 -1
- package/dist/agent-chat.d.ts +20 -4
- package/dist/agent-chat.js +5 -1
- package/dist/agent-chat.js.map +1 -1
- package/dist/{chunk-6HGZN2SQ.js → chunk-E5JOTPKI.js} +271 -25
- package/dist/chunk-E5JOTPKI.js.map +1 -0
- package/dist/index.cjs +268 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/agent-chat/components.jsx +28 -15
- package/src/agent-chat/index.d.ts +20 -4
- package/src/agent-chat/index.js +2 -2
- package/src/agent-chat/tools.js +179 -13
- package/styles/agent-chat.css +4 -0
- package/dist/chunk-6HGZN2SQ.js.map +0 -1
package/dist/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-E5JOTPKI.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,EACP,U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AM,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;AAAA,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AAG;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"]}
|
|
@@ -59,7 +59,8 @@ kinds("shell", [
|
|
|
59
59
|
"exec",
|
|
60
60
|
"run",
|
|
61
61
|
"sh",
|
|
62
|
-
"process"
|
|
62
|
+
"process",
|
|
63
|
+
"execute"
|
|
63
64
|
]);
|
|
64
65
|
kinds("shell_output", ["bashoutput", "bash_output", "killshell", "kill_shell", "killbash"]);
|
|
65
66
|
kinds("read", [
|
|
@@ -169,6 +170,7 @@ var NS = /^(developer|platform|computercontroller|builtin|default|functions|tool
|
|
|
169
170
|
function toolKind(name) {
|
|
170
171
|
const raw = String(name || "").trim();
|
|
171
172
|
if (!raw) return "tool";
|
|
173
|
+
if (browserActOf(raw) !== null) return "browser";
|
|
172
174
|
if (/^mcp__/i.test(raw)) return "mcp";
|
|
173
175
|
const n = raw.toLowerCase().replace(NS, "");
|
|
174
176
|
if (KIND_BY_NAME[n]) return KIND_BY_NAME[n];
|
|
@@ -319,6 +321,195 @@ function shortUrl(u) {
|
|
|
319
321
|
function humanizeName(n) {
|
|
320
322
|
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
323
|
}
|
|
324
|
+
var NS_BROWSER = /^(?:mcp__.+?__|[a-z0-9_-]+?(?:__|\.))(browser[_\-.].+)$/i;
|
|
325
|
+
var BROWSER_SERVER = /^(?:mcp__)?(?:browser|playwright|puppeteer|browserbase|browser[_-]use|chrome[_-]?devtools)(?:__|\.)(.+)$/i;
|
|
326
|
+
function browserActOf(name) {
|
|
327
|
+
const raw = String(name || "").trim();
|
|
328
|
+
if (!raw) return null;
|
|
329
|
+
const n = raw.toLowerCase().replace(NS, "");
|
|
330
|
+
if (KIND_BY_NAME[n] === "browser") return n === "navigate" || n === "screenshot" ? n : "";
|
|
331
|
+
let m = n.match(/^(?:browser|playwright|computer)[_\-.](.+)$/);
|
|
332
|
+
if (m) return m[1];
|
|
333
|
+
m = raw.match(NS_BROWSER);
|
|
334
|
+
if (m) return m[1].replace(/^browser[_\-.]/i, "").toLowerCase();
|
|
335
|
+
m = raw.match(BROWSER_SERVER);
|
|
336
|
+
if (m) return m[1].replace(/^browser[_\-.]/i, "").toLowerCase();
|
|
337
|
+
if (/[_\-.]browser$/.test(n)) return "";
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
var ROLE_NOUN = {
|
|
341
|
+
link: "link",
|
|
342
|
+
button: "button",
|
|
343
|
+
submit: "button",
|
|
344
|
+
textbox: "field",
|
|
345
|
+
searchbox: "search field",
|
|
346
|
+
combobox: "list",
|
|
347
|
+
listbox: "list",
|
|
348
|
+
checkbox: "checkbox",
|
|
349
|
+
radio: "option",
|
|
350
|
+
option: "option",
|
|
351
|
+
tab: "tab",
|
|
352
|
+
menuitem: "menu item",
|
|
353
|
+
heading: "heading",
|
|
354
|
+
img: "image",
|
|
355
|
+
image: "image",
|
|
356
|
+
switch: "switch",
|
|
357
|
+
slider: "slider"
|
|
358
|
+
};
|
|
359
|
+
function cut(s, max) {
|
|
360
|
+
const t = str(s).replace(/\s+/g, " ").trim();
|
|
361
|
+
return t.length > max ? `${t.slice(0, max - 1).trimEnd()}\u2026` : t;
|
|
362
|
+
}
|
|
363
|
+
function elementWords(a, element, act) {
|
|
364
|
+
const desc = str(firstOf(a, ["element", "element_description", "description", "label"])).trim();
|
|
365
|
+
if (desc) return cut(desc, 60);
|
|
366
|
+
if (element && element.role) {
|
|
367
|
+
const noun = ROLE_NOUN[String(element.role).toLowerCase()] || "";
|
|
368
|
+
const name = cut(element.name, 40);
|
|
369
|
+
if (noun && name) return `the \u201C${name}\u201D ${noun}`;
|
|
370
|
+
if (noun) return `a ${noun}`;
|
|
371
|
+
if (name) return `\u201C${name}\u201D`;
|
|
372
|
+
}
|
|
373
|
+
const sel = str(a.selector).trim().toLowerCase();
|
|
374
|
+
if (sel) {
|
|
375
|
+
if (/^a(?=$|[\s.#[:>])|role=["']?link/.test(sel)) return "a link";
|
|
376
|
+
if (/^button|\[type=["']?submit|role=["']?button/.test(sel)) return "a button";
|
|
377
|
+
if (/^(input|textarea)|role=["']?(textbox|searchbox)|contenteditable/.test(sel)) return "a field";
|
|
378
|
+
if (/^select|role=["']?(combobox|listbox)/.test(sel)) return "a list";
|
|
379
|
+
}
|
|
380
|
+
if (act === "click") {
|
|
381
|
+
const t = str(a.text).trim();
|
|
382
|
+
if (t) return `\u201C${cut(t, 40)}\u201D`;
|
|
383
|
+
}
|
|
384
|
+
return "";
|
|
385
|
+
}
|
|
386
|
+
function msWords(ms) {
|
|
387
|
+
const s = Math.round(Number(ms) / 100) / 10;
|
|
388
|
+
return s >= 1 ? `${s}s` : `${Math.round(Number(ms))} ms`;
|
|
389
|
+
}
|
|
390
|
+
var BROWSER_ACTS = [
|
|
391
|
+
[
|
|
392
|
+
/^(navigate|goto|go_to|open|open_url|visit|new_tab|tab_new|browse|go)$/,
|
|
393
|
+
"Opening",
|
|
394
|
+
"Opened",
|
|
395
|
+
(a) => {
|
|
396
|
+
const u = str(firstOf(a, ["url", "href", "uri", "link", "address"]));
|
|
397
|
+
return u ? shortUrl(u) : "";
|
|
398
|
+
},
|
|
399
|
+
["Opening a page", "Opened a page"]
|
|
400
|
+
],
|
|
401
|
+
[/^(navigate_back|back|go_back|history_back)$/, "", "", null, ["Going back a page", "Went back a page"]],
|
|
402
|
+
[/^(navigate_forward|forward|go_forward)$/, "", "", null, ["Going forward a page", "Went forward a page"]],
|
|
403
|
+
[/^(reload|refresh)$/, "", "", null, ["Reloading the page", "Reloaded the page"]],
|
|
404
|
+
[
|
|
405
|
+
/^(click|left_click|double_click|right_click|triple_click|middle_click|tap|click_element)$/,
|
|
406
|
+
"Clicking",
|
|
407
|
+
"Clicked",
|
|
408
|
+
(a, e, act) => elementWords(a, e, act),
|
|
409
|
+
["Clicking on the page", "Clicked on the page"]
|
|
410
|
+
],
|
|
411
|
+
[/^(hover|mouse_move|move_mouse)$/, "Pointing at", "Pointed at", (a, e, act) => elementWords(a, e, act), ["Moving the pointer", "Moved the pointer"]],
|
|
412
|
+
[
|
|
413
|
+
/^(type|fill|input|input_text|type_text|insert_text|fill_form|send_keys_to)$/,
|
|
414
|
+
"Typing into",
|
|
415
|
+
"Typed into",
|
|
416
|
+
(a, e, act) => elementWords(a, e, act),
|
|
417
|
+
["Typing into a field", "Typed into a field"]
|
|
418
|
+
],
|
|
419
|
+
[
|
|
420
|
+
/^(select|select_option|choose|select_dropdown_option)$/,
|
|
421
|
+
"Choosing an option in",
|
|
422
|
+
"Chose an option in",
|
|
423
|
+
(a, e, act) => elementWords(a, e, act),
|
|
424
|
+
["Choosing an option", "Chose an option"]
|
|
425
|
+
],
|
|
426
|
+
[
|
|
427
|
+
/^(press|press_key|key|keypress|send_keys|hotkey)$/,
|
|
428
|
+
"Pressing",
|
|
429
|
+
"Pressed",
|
|
430
|
+
(a) => cut(firstOf(a, ["key", "keys", "text"]), 30),
|
|
431
|
+
["Pressing a key", "Pressed a key"]
|
|
432
|
+
],
|
|
433
|
+
[/^(scroll|scroll_down|scroll_up|wheel|scroll_page)$/, "Scrolling", "Scrolled", (a, e, act) => {
|
|
434
|
+
const d = str(firstOf(a, ["direction", "scroll_direction"])).toLowerCase();
|
|
435
|
+
if (/^(up|down|left|right)$/.test(d)) return d;
|
|
436
|
+
if (/_up$/.test(act)) return "up";
|
|
437
|
+
if (/_down$/.test(act)) return "down";
|
|
438
|
+
const dy = Number(firstOf(a, ["pixels", "delta_y", "deltaY", "amount", "scroll_amount"]));
|
|
439
|
+
return Number.isFinite(dy) && dy < 0 ? "up" : Number.isFinite(dy) && dy > 0 ? "down" : "";
|
|
440
|
+
}, ["Scrolling the page", "Scrolled the page"]],
|
|
441
|
+
[
|
|
442
|
+
/^(screenshot|take_screenshot|capture|capture_screenshot)$/,
|
|
443
|
+
"",
|
|
444
|
+
"",
|
|
445
|
+
null,
|
|
446
|
+
["Taking a screenshot", "Took a screenshot"],
|
|
447
|
+
(a) => a.full_page || a.fullPage ? ["Taking a screenshot of the whole page", "Took a screenshot of the whole page"] : null
|
|
448
|
+
],
|
|
449
|
+
[/^(snapshot|read|read_page|get_page|accessibility_snapshot|page_content|get_content|get_elements|observe)$/, "", "", null, ["Reading the page", "Read the page"]],
|
|
450
|
+
[/^(extract_text|get_text|extract|text|extract_content|get_page_text)$/, "", "", null, ["Reading the page\u2019s text", "Read the page\u2019s text"]],
|
|
451
|
+
[/^(get_url|url|current_url|location|get_title)$/, "", "", null, ["Checking the address", "Checked the address"]],
|
|
452
|
+
[/^(wait|wait_for|wait_for_text|wait_for_selector|sleep)$/, "Waiting", "Waited", (a) => {
|
|
453
|
+
const t = str(a.text).trim();
|
|
454
|
+
if (t) return `for \u201C${cut(t, 40)}\u201D`;
|
|
455
|
+
if (str(a.selector).trim()) return "for the page";
|
|
456
|
+
const ms = a.ms != null ? Number(a.ms) : a.time != null ? Number(a.time) * 1e3 : Number(firstOf(a, ["timeout", "duration"]));
|
|
457
|
+
return Number.isFinite(ms) && ms > 0 ? msWords(ms) : "";
|
|
458
|
+
}, ["Waiting", "Waited"]],
|
|
459
|
+
[/^(tabs|list_tabs|tab_list|get_tabs)$/, "", "", null, ["Listing the tabs", "Listed the tabs"]],
|
|
460
|
+
[/^(switch_tab|tab_select|select_tab|focus_tab|switch_to_tab)$/, "", "", null, ["Switching tabs", "Switched tabs"]],
|
|
461
|
+
[/^(close_tab|tab_close)$/, "", "", null, ["Closing a tab", "Closed a tab"]],
|
|
462
|
+
[/^(close|quit|close_browser)$/, "", "", null, ["Closing the browser", "Closed the browser"]],
|
|
463
|
+
[/^(drag|drag_and_drop|left_click_drag)$/, "", "", null, ["Dragging on the page", "Dragged on the page"]],
|
|
464
|
+
[/^(file_upload|upload|upload_file|set_input_files)$/, "", "", null, ["Uploading a file", "Uploaded a file"]],
|
|
465
|
+
[/^(handle_dialog|dialog|accept_dialog|dismiss_dialog)$/, "", "", null, ["Answering a dialog", "Answered a dialog"]],
|
|
466
|
+
[/^(resize|set_viewport|resize_window)$/, "", "", null, ["Resizing the window", "Resized the window"]],
|
|
467
|
+
[/^(evaluate|run_code|execute_js|eval|execute_script|run_javascript)$/, "", "", null, ["Running a script on the page", "Ran a script on the page"]],
|
|
468
|
+
[/^(console_messages|console|get_console)$/, "", "", null, ["Reading the console", "Read the console"]],
|
|
469
|
+
[/^(network_requests|network|get_network)$/, "", "", null, ["Reading the network requests", "Read the network requests"]],
|
|
470
|
+
[/^(pdf_save|save_pdf|pdf|print_pdf)$/, "", "", null, ["Saving the page as a PDF", "Saved the page as a PDF"]],
|
|
471
|
+
[/^(cursor_position)$/, "", "", null, ["Finding the pointer", "Found the pointer"]],
|
|
472
|
+
[/^(install)$/, "", "", null, ["Installing the browser", "Installed the browser"]]
|
|
473
|
+
];
|
|
474
|
+
function describeBrowser(name, a, element) {
|
|
475
|
+
const fromName = browserActOf(name) || "";
|
|
476
|
+
const fromArgs = str(firstOf(a, ["action", "command", "type"])).trim();
|
|
477
|
+
const act = (fromName && fromName !== "use" ? fromName : fromArgs || fromName).toLowerCase().replace(/[\s-]+/g, "_");
|
|
478
|
+
const row = BROWSER_ACTS.find((r) => r[0].test(act));
|
|
479
|
+
if (row) {
|
|
480
|
+
const [, running, done, target, bare, special] = row;
|
|
481
|
+
const sp = special ? special(a) : null;
|
|
482
|
+
if (sp) return { running: sp[0], done: sp[1], target: "" };
|
|
483
|
+
const t = target ? target(a, element, act) : "";
|
|
484
|
+
return t ? { running, done, target: t } : { running: bare[0], done: bare[1], target: "" };
|
|
485
|
+
}
|
|
486
|
+
const u = str(firstOf(a, ["url", "href", "uri"]));
|
|
487
|
+
return u ? { running: "Browsing", done: "Browsed", target: shortUrl(u) } : { running: "Using the browser", done: "Used the browser", target: "" };
|
|
488
|
+
}
|
|
489
|
+
function browserElements(items) {
|
|
490
|
+
const out = {};
|
|
491
|
+
let refs = /* @__PURE__ */ new Map();
|
|
492
|
+
for (const it of items || []) {
|
|
493
|
+
if (!it || it.kind !== "tool" || toolKind(it.name) !== "browser") continue;
|
|
494
|
+
const a = parseToolArgs(it.args);
|
|
495
|
+
const ref = str(firstOf(a, ["ref", "element_ref"])).trim();
|
|
496
|
+
if (ref && refs.has(ref)) out[it.id] = refs.get(ref);
|
|
497
|
+
const text = str(it.output);
|
|
498
|
+
if (!text) continue;
|
|
499
|
+
const next = /* @__PURE__ */ new Map();
|
|
500
|
+
for (const ln of text.split("\n")) {
|
|
501
|
+
let m = ln.match(/^\s*(e\d+)\s+([a-z]+)\s+"(.*?)"/i);
|
|
502
|
+
if (m) {
|
|
503
|
+
next.set(m[1], { role: m[2], name: m[3] });
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
m = ln.match(/^\s*-\s+([a-z]+)(?:\s+"(.*?)")?[^\n]*\[ref=(e\d+)\]/i);
|
|
507
|
+
if (m) next.set(m[3], { role: m[1], name: m[2] || "" });
|
|
508
|
+
}
|
|
509
|
+
if (next.size) refs = next;
|
|
510
|
+
}
|
|
511
|
+
return out;
|
|
512
|
+
}
|
|
322
513
|
var VERBS = {
|
|
323
514
|
shell: ["Running", "Ran"],
|
|
324
515
|
shell_output: ["Reading output of", "Read output of"],
|
|
@@ -339,7 +530,7 @@ var VERBS = {
|
|
|
339
530
|
mcp: ["Using", "Used"],
|
|
340
531
|
tool: ["Using", "Used"]
|
|
341
532
|
};
|
|
342
|
-
function describeTool(name, args) {
|
|
533
|
+
function describeTool(name, args, opts) {
|
|
343
534
|
const a = parseToolArgs(args);
|
|
344
535
|
let kind = toolKind(name);
|
|
345
536
|
const nm = str(name);
|
|
@@ -349,6 +540,7 @@ function describeTool(name, args) {
|
|
|
349
540
|
let targetFull = "";
|
|
350
541
|
let mono = false;
|
|
351
542
|
let note = "";
|
|
543
|
+
let browser = null;
|
|
352
544
|
const pathOf = () => firstOf(a, [
|
|
353
545
|
"file_path",
|
|
354
546
|
"path",
|
|
@@ -426,11 +618,9 @@ function describeTool(name, args) {
|
|
|
426
618
|
targetFull = target;
|
|
427
619
|
break;
|
|
428
620
|
case "browser": {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
targetFull = target;
|
|
433
|
-
if (/^browser[_\-.]/i.test(nm)) note = humanizeName(nm.replace(/^browser[_\-.]/i, ""));
|
|
621
|
+
browser = describeBrowser(nm, a, opts && opts.element);
|
|
622
|
+
target = browser.target;
|
|
623
|
+
targetFull = str(firstOf(a, ["url", "href", "uri"])) || target;
|
|
434
624
|
break;
|
|
435
625
|
}
|
|
436
626
|
case "mcp":
|
|
@@ -442,7 +632,7 @@ function describeTool(name, args) {
|
|
|
442
632
|
default:
|
|
443
633
|
break;
|
|
444
634
|
}
|
|
445
|
-
const v = VERBS[kind] || VERBS.tool;
|
|
635
|
+
const v = browser ? [browser.running, browser.done] : VERBS[kind] || VERBS.tool;
|
|
446
636
|
return {
|
|
447
637
|
kind,
|
|
448
638
|
target: target.replace(/\s+/g, " ").trim(),
|
|
@@ -460,7 +650,9 @@ function toolLine(d, state) {
|
|
|
460
650
|
if (d.kind === "todo" || d.kind === "toolsearch" || d.kind === "think") return verb;
|
|
461
651
|
if (d.kind === "shell" && d.target && !d.mono) return d.target;
|
|
462
652
|
if (d.kind === "mcp" || d.kind === "tool") return `${verb} ${d.target || "a tool"}`;
|
|
463
|
-
|
|
653
|
+
if (d.target) return `${verb} ${d.target}`;
|
|
654
|
+
const noun = KIND_NOUN[d.kind];
|
|
655
|
+
return noun ? `${verb} ${noun}` : verb.replace(/\s+(for|of)$/, "");
|
|
464
656
|
}
|
|
465
657
|
var KIND_NOUN = {
|
|
466
658
|
shell: "a command",
|
|
@@ -500,7 +692,7 @@ var PHRASES = {
|
|
|
500
692
|
function summarizeCalls(calls) {
|
|
501
693
|
const list = (calls || []).filter(Boolean);
|
|
502
694
|
if (!list.length) return "";
|
|
503
|
-
if (list.length === 1) return toolLine(describeTool(list[0].name, list[0].args), "done");
|
|
695
|
+
if (list.length === 1) return toolLine(describeTool(list[0].name, list[0].args, { element: list[0].element }), "done");
|
|
504
696
|
const order = [];
|
|
505
697
|
const count = {};
|
|
506
698
|
for (const c of list) {
|
|
@@ -1277,8 +1469,9 @@ function StepDetail(props) {
|
|
|
1277
1469
|
] });
|
|
1278
1470
|
}
|
|
1279
1471
|
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]);
|
|
1472
|
+
const { item, labels = DEFAULT_AGENT_LABELS, defaultOpen = false, element = null, openStep, active = false } = props;
|
|
1473
|
+
const d = useMemo(() => describeTool(item.name, item.args, { element }), [item.name, item.args, element]);
|
|
1474
|
+
const opener = openStep ? openStep(item, d) || null : null;
|
|
1282
1475
|
const [open, setOpen] = useState2(defaultOpen);
|
|
1283
1476
|
const uid = useRef(`uac-s-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
1284
1477
|
const running = item.status === "running";
|
|
@@ -1288,8 +1481,8 @@ function StepRow(props) {
|
|
|
1288
1481
|
const verb = running ? d.running : d.done;
|
|
1289
1482
|
const hasTarget = d.target && line === `${verb} ${d.target}`;
|
|
1290
1483
|
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}
|
|
1484
|
+
const hasDetail = !opener && (!!(item.args && item.args !== "{}" && item.args !== '""') || item.output !== void 0);
|
|
1485
|
+
return /* @__PURE__ */ jsxs("div", { className: cls("uac-step", `is-${item.status}`, opener && "is-opens", opener && active && "is-active"), "data-kind": d.kind, children: [
|
|
1293
1486
|
/* @__PURE__ */ jsxs(
|
|
1294
1487
|
"button",
|
|
1295
1488
|
{
|
|
@@ -1297,8 +1490,9 @@ function StepRow(props) {
|
|
|
1297
1490
|
className: "uac-step-h",
|
|
1298
1491
|
"aria-expanded": hasDetail ? open : void 0,
|
|
1299
1492
|
"aria-controls": hasDetail ? uid : void 0,
|
|
1300
|
-
|
|
1301
|
-
|
|
1493
|
+
"aria-current": opener && active ? "true" : void 0,
|
|
1494
|
+
disabled: !opener && !hasDetail,
|
|
1495
|
+
onClick: opener || (() => setOpen((v) => !v)),
|
|
1302
1496
|
title: d.targetFull || void 0,
|
|
1303
1497
|
children: [
|
|
1304
1498
|
/* @__PURE__ */ jsx(StatusGlyph, { status: item.status, kind: d.kind }),
|
|
@@ -1314,7 +1508,7 @@ function StepRow(props) {
|
|
|
1314
1508
|
note ? /* @__PURE__ */ jsx("span", { className: "uac-step-n", children: note }) : null,
|
|
1315
1509
|
item.status === "stopped" ? /* @__PURE__ */ jsx("span", { className: "uac-step-n", children: labels.stoppedCall }) : null,
|
|
1316
1510
|
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
|
|
1511
|
+
hasDetail || opener ? /* @__PURE__ */ jsx("span", { className: "uac-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Chevron, { dir: open && !opener ? "down" : "right", size: 12 }) }) : null
|
|
1318
1512
|
]
|
|
1319
1513
|
}
|
|
1320
1514
|
),
|
|
@@ -1366,14 +1560,26 @@ function sumDiff(tools) {
|
|
|
1366
1560
|
return any ? { added, removed } : null;
|
|
1367
1561
|
}
|
|
1368
1562
|
function WorkGroup(props) {
|
|
1369
|
-
const {
|
|
1563
|
+
const {
|
|
1564
|
+
items,
|
|
1565
|
+
live = false,
|
|
1566
|
+
liveLabel,
|
|
1567
|
+
start = null,
|
|
1568
|
+
mark,
|
|
1569
|
+
motion,
|
|
1570
|
+
labels = DEFAULT_AGENT_LABELS,
|
|
1571
|
+
defaultOpen = false,
|
|
1572
|
+
elements = null,
|
|
1573
|
+
openStep,
|
|
1574
|
+
activeStep = null
|
|
1575
|
+
} = props;
|
|
1370
1576
|
const [open, setOpen] = useState2(defaultOpen);
|
|
1371
1577
|
const uid = useRef(`uac-g-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
1372
1578
|
const tools = items.filter((x) => x.kind === "tool");
|
|
1373
1579
|
const thoughts = items.filter((x) => x.kind === "thinking");
|
|
1374
1580
|
const failed = tools.filter((x) => x.status === "failed").length;
|
|
1375
1581
|
let summary = "";
|
|
1376
|
-
if (tools.length) summary = summarizeCalls(tools);
|
|
1582
|
+
if (tools.length) summary = summarizeCalls(elements ? tools.map((t) => ({ name: t.name, args: t.args, element: elements[t.id] })) : tools);
|
|
1377
1583
|
else if (thoughts.length) {
|
|
1378
1584
|
const t = thoughts[0];
|
|
1379
1585
|
const ms = t.startedAt != null && t.endedAt != null ? t.endedAt - t.startedAt : null;
|
|
@@ -1381,7 +1587,17 @@ function WorkGroup(props) {
|
|
|
1381
1587
|
}
|
|
1382
1588
|
const diff = sumDiff(tools);
|
|
1383
1589
|
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(
|
|
1590
|
+
const body = open ? /* @__PURE__ */ jsx("div", { className: "uac-calls", id: uid, children: items.map((it) => it.kind === "tool" ? /* @__PURE__ */ jsx(
|
|
1591
|
+
StepRow,
|
|
1592
|
+
{
|
|
1593
|
+
item: it,
|
|
1594
|
+
labels,
|
|
1595
|
+
element: elements ? elements[it.id] || null : null,
|
|
1596
|
+
openStep,
|
|
1597
|
+
active: activeStep != null && activeStep === it.id
|
|
1598
|
+
},
|
|
1599
|
+
it.id
|
|
1600
|
+
) : /* @__PURE__ */ jsx(ThinkingRow, { item: it, labels }, it.id)) }) : null;
|
|
1385
1601
|
if (live) {
|
|
1386
1602
|
return /* @__PURE__ */ jsxs("div", { className: cls("uac-group", "is-live", open && "is-open"), children: [
|
|
1387
1603
|
/* @__PURE__ */ jsx(
|
|
@@ -1519,9 +1735,13 @@ function AgentTurnView(props) {
|
|
|
1519
1735
|
renderFiles,
|
|
1520
1736
|
actions,
|
|
1521
1737
|
describeIncomplete,
|
|
1522
|
-
liveStart
|
|
1738
|
+
liveStart,
|
|
1739
|
+
openStep,
|
|
1740
|
+
activeStep = null
|
|
1523
1741
|
} = props;
|
|
1524
1742
|
const labels = useMemo(() => ({ ...DEFAULT_AGENT_LABELS, ...labelsIn || {} }), [labelsIn]);
|
|
1743
|
+
const items = turn ? turn.items : null;
|
|
1744
|
+
const elements = useMemo(() => browserElements(items), [items]);
|
|
1525
1745
|
if (!turn) return null;
|
|
1526
1746
|
const running = turn.status === "running";
|
|
1527
1747
|
const segs = segments(turn);
|
|
@@ -1532,7 +1752,7 @@ function AgentTurnView(props) {
|
|
|
1532
1752
|
const liveWork = running && lastSeg && lastSeg.type === "work";
|
|
1533
1753
|
let liveLabel = labels.thinking;
|
|
1534
1754
|
if (now) {
|
|
1535
|
-
if (now.phase === "tool" && now.tool) liveLabel = toolLine(describeTool(now.tool.name, now.tool.args), "running");
|
|
1755
|
+
if (now.phase === "tool" && now.tool) liveLabel = toolLine(describeTool(now.tool.name, now.tool.args, { element: elements[now.tool.id] }), "running");
|
|
1536
1756
|
else if (now.phase === "writing") liveLabel = labels.writing;
|
|
1537
1757
|
else if (now.phase === "starting") liveLabel = labels.starting;
|
|
1538
1758
|
}
|
|
@@ -1550,7 +1770,21 @@ function AgentTurnView(props) {
|
|
|
1550
1770
|
if (isLive) {
|
|
1551
1771
|
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
1552
1772
|
plan ? /* @__PURE__ */ jsx(TodoCard, { todos: plan, labels, running: true }) : null,
|
|
1553
|
-
/* @__PURE__ */ jsx(
|
|
1773
|
+
/* @__PURE__ */ jsx(
|
|
1774
|
+
WorkGroup,
|
|
1775
|
+
{
|
|
1776
|
+
items: s.items,
|
|
1777
|
+
live: true,
|
|
1778
|
+
liveLabel,
|
|
1779
|
+
start,
|
|
1780
|
+
mark,
|
|
1781
|
+
motion,
|
|
1782
|
+
labels,
|
|
1783
|
+
elements,
|
|
1784
|
+
openStep,
|
|
1785
|
+
activeStep
|
|
1786
|
+
}
|
|
1787
|
+
)
|
|
1554
1788
|
] }, `w${i}`);
|
|
1555
1789
|
}
|
|
1556
1790
|
if (s.type === "text") {
|
|
@@ -1564,7 +1798,17 @@ function AgentTurnView(props) {
|
|
|
1564
1798
|
s.item.id || `t${i}`
|
|
1565
1799
|
);
|
|
1566
1800
|
}
|
|
1567
|
-
return /* @__PURE__ */ jsx(
|
|
1801
|
+
return /* @__PURE__ */ jsx(
|
|
1802
|
+
WorkGroup,
|
|
1803
|
+
{
|
|
1804
|
+
items: s.items,
|
|
1805
|
+
labels,
|
|
1806
|
+
elements,
|
|
1807
|
+
openStep,
|
|
1808
|
+
activeStep
|
|
1809
|
+
},
|
|
1810
|
+
`w${i}-${s.items[0] && s.items[0].id}`
|
|
1811
|
+
);
|
|
1568
1812
|
}),
|
|
1569
1813
|
!liveWork && plan ? /* @__PURE__ */ jsx(TodoCard, { todos: plan, labels, running }) : null,
|
|
1570
1814
|
running && !liveWork ? /* @__PURE__ */ jsx(WorkingIndicator, { mark, motion, start, label: liveLabel }) : null,
|
|
@@ -2272,6 +2516,8 @@ export {
|
|
|
2272
2516
|
patchStats,
|
|
2273
2517
|
diffOf,
|
|
2274
2518
|
todosOf,
|
|
2519
|
+
browserActOf,
|
|
2520
|
+
browserElements,
|
|
2275
2521
|
describeTool,
|
|
2276
2522
|
toolLine,
|
|
2277
2523
|
summarizeCalls,
|
|
@@ -2314,4 +2560,4 @@ export {
|
|
|
2314
2560
|
FileCard,
|
|
2315
2561
|
FilePreview
|
|
2316
2562
|
};
|
|
2317
|
-
//# sourceMappingURL=chunk-
|
|
2563
|
+
//# sourceMappingURL=chunk-E5JOTPKI.js.map
|