reifyui 0.16.0 → 0.17.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.
@@ -189,7 +189,15 @@ export interface AgentConversationProps extends MarkProps {
189
189
  }
190
190
  export function AgentConversation(props: AgentConversationProps): ReactElement;
191
191
 
192
- export interface ArtifactFile { key: string; name: string; url: string }
192
+ export interface ArtifactFile {
193
+ key: string; name: string; url: string;
194
+ /** where it sits in the workspace (files are grouped by its folder) */
195
+ path?: string;
196
+ /** bytes, when known */
197
+ size?: number;
198
+ /** the turn that made it (1-based), when known */
199
+ turn?: number;
200
+ }
193
201
  export interface ArtifactPanelProps {
194
202
  files: ArtifactFile[];
195
203
  /** the key of the file shown (default: the first) */
@@ -199,6 +207,8 @@ export interface ArtifactPanelProps {
199
207
  /** a drawer over the page from the right (a narrow screen) instead of a docked column */
200
208
  overlay?: boolean;
201
209
  label?: string;
210
+ /** the words for "made in turn n" in the file list (default "Turn n") */
211
+ turnLabel?: (n: number) => string;
202
212
  fetchFile?: (url: string) => Promise<Response>;
203
213
  renderMarkdown?: (text: string) => ReactNode;
204
214
  officePdfUrl?: (url: string) => string;
@@ -207,6 +217,13 @@ export interface ArtifactPanelProps {
207
217
  className?: string;
208
218
  }
209
219
  export function ArtifactPanel(props: ArtifactPanelProps): ReactElement | null;
220
+ /** The preview header's file name as a dropdown of every file (ArtifactPanel uses it). */
221
+ export function FileSwitcher(props: { files: Omit<ArtifactFile, 'url'>[]; current: string; onSelect?: (key: string) => void; label?: string;
222
+ turnLabel?: (n: number) => string }): ReactElement | null;
223
+ /** "epsilla-enterprise-subscr…store-v2.png": the start and the end of a long name. */
224
+ export function middleEllipsis(name: string, max?: number): string;
225
+ /** A name truncated in the middle at whatever width it is given: the end always shows. */
226
+ export function MidName(props: { name: string; className?: string }): ReactElement;
210
227
  export interface FileCardProps {
211
228
  name: string; origin?: string; bytes?: number;
212
229
  onPreview?: () => void; onDownload?: () => void;
@@ -214,6 +231,8 @@ export interface FileCardProps {
214
231
  onCopy?: () => Promise<void> | void;
215
232
  /** the file open in the preview */
216
233
  active?: boolean;
234
+ /** an image's own picture (a url the browser can load, e.g. an object url) instead of its kind's icon */
235
+ thumb?: string;
217
236
  className?: string;
218
237
  }
219
238
  export function FileCard(props: FileCardProps): ReactElement;
@@ -221,4 +240,6 @@ export function FilePreview(props: {
221
240
  file: { url: string; name: string } | null; onClose?: () => void; fetchFile?: (url: string) => Promise<Response>;
222
241
  officePdfUrl?: (url: string) => string; renderMarkdown?: (text: string) => ReactNode;
223
242
  parseWorkbook?: ArtifactPanelProps['parseWorkbook']; onDownload?: (url: string, name: string) => void; title?: string; before?: ReactNode;
243
+ /** a control in the name's place in the header row (a file switcher) */
244
+ nameSlot?: ReactNode;
224
245
  }): ReactElement;
@@ -19,6 +19,7 @@ import {
19
19
  WorkingIndicator,
20
20
  WorkingMark,
21
21
  baseNameOf,
22
+ bytesLabel,
22
23
  commandText,
23
24
  describeTool,
24
25
  diffOf,
@@ -47,7 +48,7 @@ import {
47
48
  useElapsed,
48
49
  useNow,
49
50
  useStickToBottom
50
- } from "./chunk-4SVQGVJH.js";
51
+ } from "./chunk-6HGZN2SQ.js";
51
52
  import "./chunk-QCISEB67.js";
52
53
  import "./chunk-PZ5AY32C.js";
53
54
 
@@ -109,8 +110,210 @@ function motionFor(base) {
109
110
  }
110
111
 
111
112
  // src/agent-chat/artifacts.jsx
112
- import React, { useEffect, useRef } from "react";
113
+ import React, { useEffect, useMemo, useRef, useState } from "react";
113
114
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
115
+ var FILTER_AT = 8;
116
+ function middleEllipsis(name, max = 40) {
117
+ const s = String(name || "");
118
+ if (s.length <= max) return s;
119
+ const tail = Math.min(Math.max(10, Math.floor(max * 0.45)), max - 4);
120
+ return `${s.slice(0, max - tail - 1)}\u2026${s.slice(-tail)}`;
121
+ }
122
+ function MidName(props) {
123
+ const { name, className } = props;
124
+ const s = String(name || "");
125
+ const cut = s.length > 16 ? s.length - Math.min(14, Math.floor(s.length / 2)) : s.length;
126
+ return /* @__PURE__ */ jsxs("span", { className: "uac-mid" + (className ? ` ${className}` : ""), children: [
127
+ /* @__PURE__ */ jsx("span", { className: "uac-mid-h", children: s.slice(0, cut) }),
128
+ cut < s.length ? /* @__PURE__ */ jsx("span", { className: "uac-mid-t", children: s.slice(cut) }) : null
129
+ ] });
130
+ }
131
+ function dirOf(path) {
132
+ const p = String(path || "");
133
+ const i = p.lastIndexOf("/");
134
+ return i > 0 ? p.slice(0, i) : "";
135
+ }
136
+ function Check() {
137
+ return /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5L20 7" }) });
138
+ }
139
+ function FileSwitcher(props) {
140
+ const { files, current, onSelect, label = "Files in this conversation", turnLabel = (n) => `Turn ${n}` } = props;
141
+ const [open, setOpen] = useState(false);
142
+ const [q, setQ] = useState("");
143
+ const [hi, setHi] = useState(0);
144
+ const root = useRef(null);
145
+ const list = useRef(null);
146
+ const input = useRef(null);
147
+ const btn = useRef(null);
148
+ const id = useRef(`uac-fs-${Math.random().toString(36).slice(2, 9)}`).current;
149
+ const cur = files.find((f) => f.key === current) || files[0];
150
+ const needle = q.trim().toLowerCase();
151
+ const shown = useMemo(() => files.filter((f) => !needle || String(f.path || f.name).toLowerCase().includes(needle)), [files, needle]);
152
+ const groups = useMemo(() => {
153
+ const by = /* @__PURE__ */ new Map();
154
+ for (const f of shown) {
155
+ const d = dirOf(f.path);
156
+ if (!by.has(d)) by.set(d, []);
157
+ by.get(d).push(f);
158
+ }
159
+ return [...by.entries()].sort((a, b) => a[0] === "" ? -1 : b[0] === "" ? 1 : 0);
160
+ }, [shown]);
161
+ const flat = groups.flatMap(([, fs]) => fs);
162
+ const grouped = groups.length > 1 || groups.length === 1 && groups[0][0] !== "";
163
+ const many = files.length > FILTER_AT;
164
+ useEffect(() => {
165
+ if (!open) return void 0;
166
+ setHi(Math.max(0, flat.findIndex((f) => f.key === (cur && cur.key))));
167
+ const t = setTimeout(() => {
168
+ if (many && input.current) input.current.focus();
169
+ else if (list.current) list.current.focus();
170
+ }, 0);
171
+ const away = (e) => {
172
+ if (root.current && !root.current.contains(e.target)) setOpen(false);
173
+ };
174
+ document.addEventListener("mousedown", away);
175
+ document.addEventListener("touchstart", away);
176
+ return () => {
177
+ clearTimeout(t);
178
+ document.removeEventListener("mousedown", away);
179
+ document.removeEventListener("touchstart", away);
180
+ };
181
+ }, [open]);
182
+ useEffect(() => {
183
+ setHi(0);
184
+ }, [needle]);
185
+ useEffect(() => {
186
+ if (!open || !list.current) return;
187
+ const el = list.current.querySelector(`[data-i="${hi}"]`);
188
+ if (el && el.scrollIntoView) el.scrollIntoView({ block: "nearest" });
189
+ }, [hi, open]);
190
+ if (!cur) return null;
191
+ const pick = (f) => {
192
+ setOpen(false);
193
+ setQ("");
194
+ if (f && onSelect) onSelect(f.key);
195
+ if (btn.current) btn.current.focus();
196
+ };
197
+ const keys = (e) => {
198
+ if (e.key === "ArrowDown") {
199
+ e.preventDefault();
200
+ setHi((i2) => Math.min(flat.length - 1, i2 + 1));
201
+ } else if (e.key === "ArrowUp") {
202
+ e.preventDefault();
203
+ setHi((i2) => Math.max(0, i2 - 1));
204
+ } else if (e.key === "Home") {
205
+ e.preventDefault();
206
+ setHi(0);
207
+ } else if (e.key === "End") {
208
+ e.preventDefault();
209
+ setHi(flat.length - 1);
210
+ } else if (e.key === "Enter") {
211
+ e.preventDefault();
212
+ pick(flat[hi]);
213
+ } else if (e.key === "Escape") {
214
+ e.preventDefault();
215
+ e.stopPropagation();
216
+ setOpen(false);
217
+ if (btn.current) btn.current.focus();
218
+ } else if (e.key === "Tab") setOpen(false);
219
+ };
220
+ const single = files.length < 2;
221
+ let i = -1;
222
+ return /* @__PURE__ */ jsxs("div", { ref: root, className: "uac-fs" + (open ? " is-open" : ""), children: [
223
+ /* @__PURE__ */ jsxs(
224
+ "button",
225
+ {
226
+ ref: btn,
227
+ type: "button",
228
+ className: "uac-fs-btn",
229
+ title: cur.path || cur.name,
230
+ disabled: single,
231
+ "aria-haspopup": single ? void 0 : "listbox",
232
+ "aria-expanded": single ? void 0 : open,
233
+ "aria-controls": single ? void 0 : id,
234
+ onClick: () => setOpen((v) => !v),
235
+ onKeyDown: (e) => {
236
+ if (!single && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
237
+ e.preventDefault();
238
+ setOpen(true);
239
+ }
240
+ },
241
+ children: [
242
+ /* @__PURE__ */ jsx(MidName, { name: cur.name, className: "uac-fs-name" }),
243
+ single ? null : /* @__PURE__ */ jsx("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", children: /* @__PURE__ */ jsx("path", { d: "M6 9l6 6 6-6" }) })
244
+ ]
245
+ }
246
+ ),
247
+ open ? /* @__PURE__ */ jsxs(Fragment, { children: [
248
+ /* @__PURE__ */ jsx("div", { className: "uac-fs-scrim", "aria-hidden": "true", onClick: () => setOpen(false) }),
249
+ /* @__PURE__ */ jsxs("div", { className: "uac-fs-pop", onKeyDown: keys, children: [
250
+ /* @__PURE__ */ jsxs("div", { className: "uac-fs-head", children: [
251
+ /* @__PURE__ */ jsx("span", { children: label }),
252
+ /* @__PURE__ */ jsx("span", { className: "uac-fs-count", children: files.length })
253
+ ] }),
254
+ many ? /* @__PURE__ */ jsx(
255
+ "input",
256
+ {
257
+ ref: input,
258
+ className: "uac-fs-q",
259
+ type: "search",
260
+ placeholder: "Find a file",
261
+ value: q,
262
+ autoComplete: "off",
263
+ spellCheck: false,
264
+ "aria-label": "Find a file",
265
+ "aria-controls": id,
266
+ onChange: (e) => setQ(e.target.value)
267
+ }
268
+ ) : null,
269
+ /* @__PURE__ */ jsxs(
270
+ "div",
271
+ {
272
+ ref: list,
273
+ id,
274
+ className: "uac-fs-list",
275
+ role: "listbox",
276
+ tabIndex: -1,
277
+ "aria-label": label,
278
+ "aria-activedescendant": flat[hi] ? `${id}-${hi}` : void 0,
279
+ children: [
280
+ groups.map(([dir, fs]) => /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": dir || "Top level", children: [
281
+ grouped ? /* @__PURE__ */ jsx("div", { className: "uac-fs-dir", "aria-hidden": "true", children: dir || "Top level" }) : null,
282
+ fs.map((f) => {
283
+ i += 1;
284
+ const n = i;
285
+ const on = f.key === cur.key;
286
+ const meta = [f.size != null ? bytesLabel(f.size) : "", f.turn != null ? turnLabel(f.turn) : ""].filter(Boolean).join(" \xB7 ");
287
+ return /* @__PURE__ */ jsxs(
288
+ "div",
289
+ {
290
+ id: `${id}-${n}`,
291
+ "data-i": n,
292
+ role: "option",
293
+ "aria-selected": on,
294
+ className: "uac-fs-opt" + (on ? " is-on" : "") + (n === hi ? " is-hi" : ""),
295
+ title: f.path || f.name,
296
+ onMouseEnter: () => setHi(n),
297
+ onClick: () => pick(f),
298
+ children: [
299
+ /* @__PURE__ */ jsx(FileTypeIcon, { name: f.name, size: 16 }),
300
+ /* @__PURE__ */ jsx(MidName, { name: f.name, className: "uac-fs-on" }),
301
+ meta ? /* @__PURE__ */ jsx("span", { className: "uac-fs-meta", children: meta }) : null,
302
+ /* @__PURE__ */ jsx("span", { className: "uac-fs-ck", children: on ? /* @__PURE__ */ jsx(Check, {}) : null })
303
+ ]
304
+ },
305
+ f.key
306
+ );
307
+ })
308
+ ] }, dir || ".")),
309
+ !flat.length ? /* @__PURE__ */ jsx("div", { className: "uac-fs-none", children: "No file matches." }) : null
310
+ ]
311
+ }
312
+ )
313
+ ] })
314
+ ] }) : null
315
+ ] });
316
+ }
114
317
  function ArtifactPanel(props) {
115
318
  const {
116
319
  files = [],
@@ -119,6 +322,7 @@ function ArtifactPanel(props) {
119
322
  onClose,
120
323
  overlay = false,
121
324
  label = "Files in this conversation",
325
+ turnLabel,
122
326
  fetchFile,
123
327
  renderMarkdown,
124
328
  officePdfUrl,
@@ -136,7 +340,7 @@ function ArtifactPanel(props) {
136
340
  if (b) b.focus();
137
341
  }, 0);
138
342
  const key = (e) => {
139
- if (e.key === "Escape") {
343
+ if (e.key === "Escape" && !e.defaultPrevented) {
140
344
  e.stopPropagation();
141
345
  onClose && onClose();
142
346
  }
@@ -149,21 +353,7 @@ function ArtifactPanel(props) {
149
353
  };
150
354
  }, [overlay, !!cur]);
151
355
  if (!cur) return null;
152
- const switcher = files.length > 1 ? /* @__PURE__ */ jsx("nav", { className: "uac-art-files", "aria-label": label, children: files.map((f) => /* @__PURE__ */ jsxs(
153
- "button",
154
- {
155
- type: "button",
156
- className: "uac-art-file" + (f.key === cur.key ? " is-on" : ""),
157
- "aria-current": f.key === cur.key ? "true" : void 0,
158
- title: f.name,
159
- onClick: () => onSelect && onSelect(f.key),
160
- children: [
161
- /* @__PURE__ */ jsx(FileTypeIcon, { name: f.name, size: 14 }),
162
- /* @__PURE__ */ jsx("span", { children: f.name })
163
- ]
164
- },
165
- f.key
166
- )) }) : null;
356
+ const switcher = /* @__PURE__ */ jsx(FileSwitcher, { files, current: cur.key, onSelect, label, turnLabel });
167
357
  return /* @__PURE__ */ jsxs(Fragment, { children: [
168
358
  overlay ? /* @__PURE__ */ jsx("div", { className: "uac-art-scrim", "aria-hidden": "true", onClick: () => onClose && onClose() }) : null,
169
359
  /* @__PURE__ */ jsx(
@@ -179,7 +369,7 @@ function ArtifactPanel(props) {
179
369
  {
180
370
  file: { url: cur.url, name: cur.name },
181
371
  onClose,
182
- before: switcher,
372
+ nameSlot: switcher,
183
373
  fetchFile,
184
374
  renderMarkdown,
185
375
  officePdfUrl,
@@ -202,9 +392,11 @@ export {
202
392
  DiffBadge,
203
393
  FileCard,
204
394
  FilePreview,
395
+ FileSwitcher,
205
396
  LinesBlock,
206
397
  MARK_MOTIONS,
207
398
  MOTIONS,
399
+ MidName,
208
400
  StepRow,
209
401
  StreamingText,
210
402
  ThinkingRow,
@@ -226,6 +418,7 @@ export {
226
418
  latestPlan,
227
419
  lineCount,
228
420
  liveState,
421
+ middleEllipsis,
229
422
  motionFor,
230
423
  newTurn,
231
424
  parseToolArgs,
@@ -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: the file rendered (Markdown as a document, code\n// highlighted, images, PDFs, sheets), a switcher across every file the conversation made, Copy,\n// Download and Close. Docked, it is a column the host places beside the chat; `overlay` makes it a\n// drawer over the page from the right, which is what a narrow screen gets.\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, useRef } from 'react';\nimport { FilePreview } from '../components/FilePreview.jsx';\nimport { FileTypeIcon } from '../components/FileTypeIcon.jsx';\n\n/**\n * files: [{ key, name, url }] (key: stable id, e.g. the file id); active: the key shown.\n */\nexport function ArtifactPanel(props) {\n const {\n files = [], active, onSelect, onClose, overlay = false, label = 'Files in this conversation',\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.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 = files.length > 1 ? (\n <nav className=\"uac-art-files\" aria-label={label}>\n {files.map((f) => (\n <button key={f.key} type=\"button\" className={'uac-art-file' + (f.key === cur.key ? ' is-on' : '')}\n aria-current={f.key === cur.key ? 'true' : undefined} title={f.name} onClick={() => onSelect && onSelect(f.key)}>\n <FileTypeIcon name={f.name} size={14} /><span>{f.name}</span>\n </button>\n ))}\n </nav>\n ) : null;\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} before={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;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,IAAI,KAAK;AAAA,YAAG;AAAA,YAAkB,QAAQ;AAAA,YAC3F;AAAA,YAAsB;AAAA,YAAgC;AAAA,YAA4B;AAAA,YAA8B;AAAA;AAAA,UADhG,IAAI;AAAA,QACoH;AAAA;AAAA,IAC5I;AAAA,KACF;AAEJ;","names":[]}
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,KACF;AAEJ;","names":["i"]}
@@ -18,6 +18,14 @@ import {
18
18
  IcX
19
19
  } from "./chunk-QCISEB67.js";
20
20
 
21
+ // src/format.js
22
+ function bytesLabel(n) {
23
+ if (n == null) return "";
24
+ if (n < 1024) return `${n} B`;
25
+ if (n < 1048576) return `${Math.round(n / 1024)} KB`;
26
+ return `${(n / 1048576).toFixed(1)} MB`;
27
+ }
28
+
21
29
  // src/agent-chat/tools.js
22
30
  function parseToolArgs(args) {
23
31
  if (args && typeof args === "object") return args;
@@ -1891,16 +1899,16 @@ var IcCheckMark = () => /* @__PURE__ */ jsx3("svg", { width: "17", height: "17",
1891
1899
  function subtitle(name, origin, bytes) {
1892
1900
  const parts = [(extOf(name) || "file").toUpperCase()];
1893
1901
  if (origin) parts.push(origin);
1894
- if (bytes != null) parts.push(bytesLabel(bytes));
1902
+ if (bytes != null) parts.push(bytesLabel2(bytes));
1895
1903
  return parts.join(" \xB7 ");
1896
1904
  }
1897
- function bytesLabel(n) {
1905
+ function bytesLabel2(n) {
1898
1906
  if (n == null) return "";
1899
1907
  if (n < 1024) return `${n} B`;
1900
1908
  if (n < 1048576) return `${Math.round(n / 1024)} KB`;
1901
1909
  return `${(n / 1048576).toFixed(1)} MB`;
1902
1910
  }
1903
- function FileCard({ name, origin = "output", bytes, onPreview, onDownload, onCopy, active = false, className = "" }) {
1911
+ function FileCard({ name, origin = "output", bytes, onPreview, onDownload, onCopy, active = false, thumb, className = "" }) {
1904
1912
  const [copied, setCopied] = useState4("");
1905
1913
  useEffect4(() => {
1906
1914
  if (!copied) return void 0;
@@ -1927,7 +1935,7 @@ function FileCard({ name, origin = "output", bytes, onPreview, onDownload, onCop
1927
1935
  } : void 0,
1928
1936
  title: name,
1929
1937
  children: [
1930
- /* @__PURE__ */ jsx3("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ jsx3(FileTypeIcon, { name, size: 32 }) }),
1938
+ thumb ? /* @__PURE__ */ jsx3("span", { className: "uic-filecard-thumb", children: /* @__PURE__ */ jsx3("img", { src: thumb, alt: "" }) }) : /* @__PURE__ */ jsx3("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ jsx3(FileTypeIcon, { name, size: 32 }) }),
1931
1939
  /* @__PURE__ */ jsxs2("span", { className: "uic-filecard-meta", children: [
1932
1940
  /* @__PURE__ */ jsx3("span", { className: "uic-filecard-name", children: name }),
1933
1941
  /* @__PURE__ */ jsx3("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
@@ -2079,7 +2087,8 @@ function FilePreview({
2079
2087
  parseWorkbook,
2080
2088
  onDownload,
2081
2089
  title,
2082
- before
2090
+ before,
2091
+ nameSlot
2083
2092
  }) {
2084
2093
  const { url, name } = file || {};
2085
2094
  const [st, setSt] = useState5({ kind: "loading" });
@@ -2167,7 +2176,7 @@ function FilePreview({
2167
2176
  before,
2168
2177
  /* @__PURE__ */ jsxs3("header", { className: "uic-fp-head", children: [
2169
2178
  /* @__PURE__ */ jsx4("span", { className: "uic-fp-ic", children: /* @__PURE__ */ jsx4(FileTypeIcon, { name, size: 20 }) }),
2170
- /* @__PURE__ */ jsx4("span", { className: "uic-fp-name", title: name, children: name }),
2179
+ nameSlot || /* @__PURE__ */ jsx4("span", { className: "uic-fp-name", title: name, children: name }),
2171
2180
  st.kind === "html" && /* @__PURE__ */ jsx4("div", { className: "uic-fp-seg", role: "tablist", "aria-label": "Show the page or its source", children: [["preview", "Preview"], ["source", "Source"]].map(([id, label]) => /* @__PURE__ */ jsx4(
2172
2181
  "button",
2173
2182
  {
@@ -2254,6 +2263,7 @@ function FilePreview({
2254
2263
  }
2255
2264
 
2256
2265
  export {
2266
+ bytesLabel,
2257
2267
  parseToolArgs,
2258
2268
  toolKind,
2259
2269
  baseNameOf,
@@ -2304,4 +2314,4 @@ export {
2304
2314
  FileCard,
2305
2315
  FilePreview
2306
2316
  };
2307
- //# sourceMappingURL=chunk-4SVQGVJH.js.map
2317
+ //# sourceMappingURL=chunk-6HGZN2SQ.js.map