reifyui 0.15.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-chat.cjs +607 -5
- package/dist/agent-chat.cjs.map +1 -1
- package/dist/agent-chat.d.ts +34 -0
- package/dist/agent-chat.js +93 -2
- package/dist/agent-chat.js.map +1 -1
- package/dist/{chunk-S46J7CLH.js → chunk-4SVQGVJH.js} +415 -4
- package/dist/chunk-4SVQGVJH.js.map +1 -0
- package/dist/{chunk-WAND7AYD.js → chunk-QCISEB67.js} +103 -2
- package/dist/chunk-QCISEB67.js.map +1 -0
- package/dist/chunk-SPLQ7T6F.js +76 -0
- package/dist/chunk-SPLQ7T6F.js.map +1 -0
- package/dist/graph.js +4 -3
- package/dist/graph.js.map +1 -1
- package/dist/index.cjs +144 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +176 -512
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/agent-chat/artifacts.jsx +55 -0
- package/src/agent-chat/components.jsx +6 -1
- package/src/agent-chat/index.d.ts +34 -0
- package/src/agent-chat/index.js +5 -0
- package/src/components/FileCard.jsx +17 -2
- package/src/components/FilePreview.jsx +15 -1
- package/styles/agent-chat.css +18 -0
- package/styles/file.css +2 -0
- package/dist/chunk-AGSX5YKH.js +0 -177
- package/dist/chunk-AGSX5YKH.js.map +0 -1
- package/dist/chunk-S46J7CLH.js.map +0 -1
- package/dist/chunk-WAND7AYD.js.map +0 -1
package/dist/agent-chat.d.ts
CHANGED
|
@@ -188,3 +188,37 @@ export interface AgentConversationProps extends MarkProps {
|
|
|
188
188
|
empty?: ReactNode;
|
|
189
189
|
}
|
|
190
190
|
export function AgentConversation(props: AgentConversationProps): ReactElement;
|
|
191
|
+
|
|
192
|
+
export interface ArtifactFile { key: string; name: string; url: string }
|
|
193
|
+
export interface ArtifactPanelProps {
|
|
194
|
+
files: ArtifactFile[];
|
|
195
|
+
/** the key of the file shown (default: the first) */
|
|
196
|
+
active?: string | null;
|
|
197
|
+
onSelect?: (key: string) => void;
|
|
198
|
+
onClose?: () => void;
|
|
199
|
+
/** a drawer over the page from the right (a narrow screen) instead of a docked column */
|
|
200
|
+
overlay?: boolean;
|
|
201
|
+
label?: string;
|
|
202
|
+
fetchFile?: (url: string) => Promise<Response>;
|
|
203
|
+
renderMarkdown?: (text: string) => ReactNode;
|
|
204
|
+
officePdfUrl?: (url: string) => string;
|
|
205
|
+
parseWorkbook?: (buf: ArrayBuffer) => Promise<{ name: string; filled: boolean; rows: unknown[][] }[]>;
|
|
206
|
+
onDownload?: (url: string, name: string) => void;
|
|
207
|
+
className?: string;
|
|
208
|
+
}
|
|
209
|
+
export function ArtifactPanel(props: ArtifactPanelProps): ReactElement | null;
|
|
210
|
+
export interface FileCardProps {
|
|
211
|
+
name: string; origin?: string; bytes?: number;
|
|
212
|
+
onPreview?: () => void; onDownload?: () => void;
|
|
213
|
+
/** copy the file's text; resolve when copied, reject when it could not be */
|
|
214
|
+
onCopy?: () => Promise<void> | void;
|
|
215
|
+
/** the file open in the preview */
|
|
216
|
+
active?: boolean;
|
|
217
|
+
className?: string;
|
|
218
|
+
}
|
|
219
|
+
export function FileCard(props: FileCardProps): ReactElement;
|
|
220
|
+
export function FilePreview(props: {
|
|
221
|
+
file: { url: string; name: string } | null; onClose?: () => void; fetchFile?: (url: string) => Promise<Response>;
|
|
222
|
+
officePdfUrl?: (url: string) => string; renderMarkdown?: (text: string) => ReactNode;
|
|
223
|
+
parseWorkbook?: ArtifactPanelProps['parseWorkbook']; onDownload?: (url: string, name: string) => void; title?: string; before?: ReactNode;
|
|
224
|
+
}): ReactElement;
|
package/dist/agent-chat.js
CHANGED
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
CopyButton,
|
|
6
6
|
DEFAULT_AGENT_LABELS,
|
|
7
7
|
DiffBadge,
|
|
8
|
+
FileCard,
|
|
9
|
+
FilePreview,
|
|
10
|
+
FileTypeIcon,
|
|
8
11
|
LinesBlock,
|
|
9
12
|
StepRow,
|
|
10
13
|
StreamingText,
|
|
@@ -44,8 +47,8 @@ import {
|
|
|
44
47
|
useElapsed,
|
|
45
48
|
useNow,
|
|
46
49
|
useStickToBottom
|
|
47
|
-
} from "./chunk-
|
|
48
|
-
import "./chunk-
|
|
50
|
+
} from "./chunk-4SVQGVJH.js";
|
|
51
|
+
import "./chunk-QCISEB67.js";
|
|
49
52
|
import "./chunk-PZ5AY32C.js";
|
|
50
53
|
|
|
51
54
|
// src/agent-chat/marks.js
|
|
@@ -104,13 +107,101 @@ function motionFor(base) {
|
|
|
104
107
|
const k = String(base || "").toLowerCase().trim();
|
|
105
108
|
return MARK_MOTIONS[k] || "pulse";
|
|
106
109
|
}
|
|
110
|
+
|
|
111
|
+
// src/agent-chat/artifacts.jsx
|
|
112
|
+
import React, { useEffect, useRef } from "react";
|
|
113
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
114
|
+
function ArtifactPanel(props) {
|
|
115
|
+
const {
|
|
116
|
+
files = [],
|
|
117
|
+
active,
|
|
118
|
+
onSelect,
|
|
119
|
+
onClose,
|
|
120
|
+
overlay = false,
|
|
121
|
+
label = "Files in this conversation",
|
|
122
|
+
fetchFile,
|
|
123
|
+
renderMarkdown,
|
|
124
|
+
officePdfUrl,
|
|
125
|
+
parseWorkbook,
|
|
126
|
+
onDownload,
|
|
127
|
+
className
|
|
128
|
+
} = props;
|
|
129
|
+
const ref = useRef(null);
|
|
130
|
+
const cur = files.find((f) => f.key === active) || files[0] || null;
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
if (!overlay || !cur) return void 0;
|
|
133
|
+
const back = document.activeElement;
|
|
134
|
+
const t = setTimeout(() => {
|
|
135
|
+
const b = ref.current && ref.current.querySelector("button");
|
|
136
|
+
if (b) b.focus();
|
|
137
|
+
}, 0);
|
|
138
|
+
const key = (e) => {
|
|
139
|
+
if (e.key === "Escape") {
|
|
140
|
+
e.stopPropagation();
|
|
141
|
+
onClose && onClose();
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
document.addEventListener("keydown", key);
|
|
145
|
+
return () => {
|
|
146
|
+
clearTimeout(t);
|
|
147
|
+
document.removeEventListener("keydown", key);
|
|
148
|
+
if (back && back.focus) back.focus();
|
|
149
|
+
};
|
|
150
|
+
}, [overlay, !!cur]);
|
|
151
|
+
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;
|
|
167
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
168
|
+
overlay ? /* @__PURE__ */ jsx("div", { className: "uac-art-scrim", "aria-hidden": "true", onClick: () => onClose && onClose() }) : null,
|
|
169
|
+
/* @__PURE__ */ jsx(
|
|
170
|
+
"div",
|
|
171
|
+
{
|
|
172
|
+
ref,
|
|
173
|
+
className: "uac-art" + (overlay ? " is-overlay" : "") + (className ? ` ${className}` : ""),
|
|
174
|
+
role: overlay ? "dialog" : void 0,
|
|
175
|
+
"aria-modal": overlay ? "true" : void 0,
|
|
176
|
+
"aria-label": overlay ? `Preview of ${cur.name}` : void 0,
|
|
177
|
+
children: /* @__PURE__ */ jsx(
|
|
178
|
+
FilePreview,
|
|
179
|
+
{
|
|
180
|
+
file: { url: cur.url, name: cur.name },
|
|
181
|
+
onClose,
|
|
182
|
+
before: switcher,
|
|
183
|
+
fetchFile,
|
|
184
|
+
renderMarkdown,
|
|
185
|
+
officePdfUrl,
|
|
186
|
+
parseWorkbook,
|
|
187
|
+
onDownload
|
|
188
|
+
},
|
|
189
|
+
cur.key
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
] });
|
|
194
|
+
}
|
|
107
195
|
export {
|
|
108
196
|
AgentComposer,
|
|
109
197
|
AgentConversation,
|
|
110
198
|
AgentTurnView,
|
|
199
|
+
ArtifactPanel,
|
|
111
200
|
CopyButton,
|
|
112
201
|
DEFAULT_AGENT_LABELS,
|
|
113
202
|
DiffBadge,
|
|
203
|
+
FileCard,
|
|
204
|
+
FilePreview,
|
|
114
205
|
LinesBlock,
|
|
115
206
|
MARK_MOTIONS,
|
|
116
207
|
MOTIONS,
|
package/dist/agent-chat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/agent-chat/marks.js"],"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"],"mappings":"
|
|
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;AAAA,EAC5D,WAAW;AAAA,EACX,cAAc;AAAA,EACd,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EAAO,WAAW;AAAA,EAAO,OAAO;AAAA,EAAO,SAAS;AAAA,EACvD,MAAM;AAAA,EAAS,MAAM;AAAA,EAAS,OAAO;AAAA,EAAS,MAAM;AAAA,EAAS,OAAO;AACtE;AAEO,IAAM,UAAU;AAAA,EAAC;AAAA,EAAS;AAAA,EAAS;AAAA,EAAS;AAAA,EAAW;AAAA,EAAS;AAAA,EAAS;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAQ;AAAA,EACtG;AAAA,EAAQ;AAAA,EAAW;AAAA,EAAY;AAAA,EAAO;AAAA,EAAS;AAAM;AAGhD,SAAS,UAAU,MAAM;AAC9B,QAAM,IAAI,OAAO,QAAQ,EAAE,EAAE,YAAY,EAAE,KAAK;AAChD,SAAO,aAAa,CAAC,KAAK;AAC5B;;;ACxCA,OAAO,SAAS,WAAW,cAAc;AA2BjC,SAQJ,UANM,KAFF;AApBD,SAAS,cAAc,OAAO;AACnC,QAAM;AAAA,IACJ,QAAQ,CAAC;AAAA,IAAG;AAAA,IAAQ;AAAA,IAAU;AAAA,IAAS,UAAU;AAAA,IAAO,QAAQ;AAAA,IAChE;AAAA,IAAW;AAAA,IAAgB;AAAA,IAAc;AAAA,IAAe;AAAA,IAAY;AAAA,EACtE,IAAI;AACJ,QAAM,MAAM,OAAO,IAAI;AACvB,QAAM,MAAM,MAAM,KAAK,CAAC,MAAM,EAAE,QAAQ,MAAM,KAAK,MAAM,CAAC,KAAK;AAE/D,YAAU,MAAM;AACd,QAAI,CAAC,WAAW,CAAC,IAAK,QAAO;AAC7B,UAAM,OAAO,SAAS;AACtB,UAAM,IAAI,WAAW,MAAM;AAAE,YAAM,IAAI,IAAI,WAAW,IAAI,QAAQ,cAAc,QAAQ;AAAG,UAAI,EAAG,GAAE,MAAM;AAAA,IAAG,GAAG,CAAC;AACjH,UAAM,MAAM,CAAC,MAAM;AAAE,UAAI,EAAE,QAAQ,UAAU;AAAE,UAAE,gBAAgB;AAAG,mBAAW,QAAQ;AAAA,MAAG;AAAA,IAAE;AAC5F,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,MAAM,SAAS,IAC9B,oBAAC,SAAI,WAAU,iBAAgB,cAAY,OACxC,gBAAM,IAAI,CAAC,MACV;AAAA,IAAC;AAAA;AAAA,MAAmB,MAAK;AAAA,MAAS,WAAW,kBAAkB,EAAE,QAAQ,IAAI,MAAM,WAAW;AAAA,MAC5F,gBAAc,EAAE,QAAQ,IAAI,MAAM,SAAS;AAAA,MAAW,OAAO,EAAE;AAAA,MAAM,SAAS,MAAM,YAAY,SAAS,EAAE,GAAG;AAAA,MAC9G;AAAA,4BAAC,gBAAa,MAAM,EAAE,MAAM,MAAM,IAAI;AAAA,QAAE,oBAAC,UAAM,YAAE,MAAK;AAAA;AAAA;AAAA,IAF3C,EAAE;AAAA,EAGf,CACD,GACH,IACE;AACJ,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,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,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Chevron,
|
|
3
|
+
CodeBlock,
|
|
3
4
|
IcDoc,
|
|
5
|
+
IcDownload,
|
|
4
6
|
IcGlobe,
|
|
5
7
|
IcList,
|
|
6
8
|
IcPaperclip,
|
|
@@ -14,7 +16,7 @@ import {
|
|
|
14
16
|
IcThink,
|
|
15
17
|
IcTool,
|
|
16
18
|
IcX
|
|
17
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-QCISEB67.js";
|
|
18
20
|
|
|
19
21
|
// src/agent-chat/tools.js
|
|
20
22
|
function parseToolArgs(args) {
|
|
@@ -1469,7 +1471,9 @@ function TurnOutcome(props) {
|
|
|
1469
1471
|
if (!turn || turn.status === "running") return null;
|
|
1470
1472
|
const ms = turn.startedAt != null && turn.endedAt != null ? turn.endedAt - turn.startedAt : turn.elapsedMs;
|
|
1471
1473
|
const time = ms != null && ms >= 0 ? formatElapsed(ms) : "";
|
|
1472
|
-
const
|
|
1474
|
+
const u = turn.usage || null;
|
|
1475
|
+
const parts = u ? ["input_tokens", "output_tokens", "cache_read_tokens", "cache_write_tokens"].map((k) => Number(u[k]) || 0) : [];
|
|
1476
|
+
const tok = u ? parts.some(Boolean) ? parts.reduce((a, b) => a + b, 0) : Number(u.total_tokens) || 0 : 0;
|
|
1473
1477
|
const tokens = tok ? labels.tokens(formatTokens(tok)) : "";
|
|
1474
1478
|
if (turn.status === "done") {
|
|
1475
1479
|
if (!time && !tokens) return null;
|
|
@@ -1846,6 +1850,409 @@ function AgentConversation(props) {
|
|
|
1846
1850
|
] });
|
|
1847
1851
|
}
|
|
1848
1852
|
|
|
1853
|
+
// src/components/FileTypeIcon.jsx
|
|
1854
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
1855
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
1856
|
+
function extOf(name) {
|
|
1857
|
+
const m = String(name || "").toLowerCase().match(/\.([a-z0-9]+)$/);
|
|
1858
|
+
return m ? m[1] : "";
|
|
1859
|
+
}
|
|
1860
|
+
var mod = null;
|
|
1861
|
+
var tried = false;
|
|
1862
|
+
function FileTypeIcon({ name, size = 36 }) {
|
|
1863
|
+
const [, force] = useState3(0);
|
|
1864
|
+
const ext = extOf(name);
|
|
1865
|
+
useEffect3(() => {
|
|
1866
|
+
if (tried || mod) return;
|
|
1867
|
+
tried = true;
|
|
1868
|
+
import("react-file-icon").then((m) => {
|
|
1869
|
+
mod = m;
|
|
1870
|
+
force((n) => n + 1);
|
|
1871
|
+
}).catch(() => {
|
|
1872
|
+
});
|
|
1873
|
+
}, []);
|
|
1874
|
+
const box = { width: size, height: Math.round(size * 1.16), display: "inline-block", flex: "0 0 auto" };
|
|
1875
|
+
if (!mod) {
|
|
1876
|
+
return /* @__PURE__ */ jsx2("span", { className: "uic-fileglyph", style: box, "aria-hidden": "true", children: /* @__PURE__ */ jsx2("span", { className: "uic-fileglyph-ext", children: (ext || "file").slice(0, 4) }) });
|
|
1877
|
+
}
|
|
1878
|
+
const { FileIcon, defaultStyles } = mod;
|
|
1879
|
+
const style = defaultStyles?.[ext] || {};
|
|
1880
|
+
return /* @__PURE__ */ jsx2("span", { style: box, children: /* @__PURE__ */ jsx2(FileIcon, { extension: ext || void 0, ...style }) });
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
// src/components/FileCard.jsx
|
|
1884
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
1885
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1886
|
+
var IcCopy = () => /* @__PURE__ */ jsxs2("svg", { width: "17", height: "17", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1887
|
+
/* @__PURE__ */ jsx3("rect", { x: "9", y: "9", width: "11", height: "11", rx: "2" }),
|
|
1888
|
+
/* @__PURE__ */ jsx3("path", { d: "M5 15V6a2 2 0 0 1 2-2h9" })
|
|
1889
|
+
] });
|
|
1890
|
+
var IcCheckMark = () => /* @__PURE__ */ jsx3("svg", { width: "17", height: "17", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx3("path", { d: "M5 12l5 5L20 7" }) });
|
|
1891
|
+
function subtitle(name, origin, bytes) {
|
|
1892
|
+
const parts = [(extOf(name) || "file").toUpperCase()];
|
|
1893
|
+
if (origin) parts.push(origin);
|
|
1894
|
+
if (bytes != null) parts.push(bytesLabel(bytes));
|
|
1895
|
+
return parts.join(" \xB7 ");
|
|
1896
|
+
}
|
|
1897
|
+
function bytesLabel(n) {
|
|
1898
|
+
if (n == null) return "";
|
|
1899
|
+
if (n < 1024) return `${n} B`;
|
|
1900
|
+
if (n < 1048576) return `${Math.round(n / 1024)} KB`;
|
|
1901
|
+
return `${(n / 1048576).toFixed(1)} MB`;
|
|
1902
|
+
}
|
|
1903
|
+
function FileCard({ name, origin = "output", bytes, onPreview, onDownload, onCopy, active = false, className = "" }) {
|
|
1904
|
+
const [copied, setCopied] = useState4("");
|
|
1905
|
+
useEffect4(() => {
|
|
1906
|
+
if (!copied) return void 0;
|
|
1907
|
+
const t = setTimeout(() => setCopied(""), 1600);
|
|
1908
|
+
return () => clearTimeout(t);
|
|
1909
|
+
}, [copied]);
|
|
1910
|
+
const open = onPreview ? (e) => {
|
|
1911
|
+
e.stopPropagation();
|
|
1912
|
+
onPreview();
|
|
1913
|
+
} : void 0;
|
|
1914
|
+
return /* @__PURE__ */ jsxs2(
|
|
1915
|
+
"div",
|
|
1916
|
+
{
|
|
1917
|
+
className: "uic-filecard" + (open ? " is-clickable" : "") + (active ? " is-active" : "") + (className ? " " + className : ""),
|
|
1918
|
+
"aria-current": active ? "true" : void 0,
|
|
1919
|
+
onClick: open,
|
|
1920
|
+
role: open ? "button" : void 0,
|
|
1921
|
+
tabIndex: open ? 0 : void 0,
|
|
1922
|
+
onKeyDown: open ? (e) => {
|
|
1923
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1924
|
+
e.preventDefault();
|
|
1925
|
+
open(e);
|
|
1926
|
+
}
|
|
1927
|
+
} : void 0,
|
|
1928
|
+
title: name,
|
|
1929
|
+
children: [
|
|
1930
|
+
/* @__PURE__ */ jsx3("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ jsx3(FileTypeIcon, { name, size: 32 }) }),
|
|
1931
|
+
/* @__PURE__ */ jsxs2("span", { className: "uic-filecard-meta", children: [
|
|
1932
|
+
/* @__PURE__ */ jsx3("span", { className: "uic-filecard-name", children: name }),
|
|
1933
|
+
/* @__PURE__ */ jsx3("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
|
|
1934
|
+
] }),
|
|
1935
|
+
onCopy && /* @__PURE__ */ jsx3(
|
|
1936
|
+
"button",
|
|
1937
|
+
{
|
|
1938
|
+
type: "button",
|
|
1939
|
+
className: "uic-filecard-dl uic-filecard-copy",
|
|
1940
|
+
"aria-label": copied === "ok" ? "Copied" : `Copy ${name}`,
|
|
1941
|
+
title: copied === "ok" ? "Copied" : copied === "no" ? "Could not copy" : "Copy",
|
|
1942
|
+
onClick: async (e) => {
|
|
1943
|
+
e.stopPropagation();
|
|
1944
|
+
try {
|
|
1945
|
+
await onCopy();
|
|
1946
|
+
setCopied("ok");
|
|
1947
|
+
} catch {
|
|
1948
|
+
setCopied("no");
|
|
1949
|
+
}
|
|
1950
|
+
},
|
|
1951
|
+
children: copied === "ok" ? /* @__PURE__ */ jsx3(IcCheckMark, {}) : /* @__PURE__ */ jsx3(IcCopy, {})
|
|
1952
|
+
}
|
|
1953
|
+
),
|
|
1954
|
+
onDownload && /* @__PURE__ */ jsx3(
|
|
1955
|
+
"button",
|
|
1956
|
+
{
|
|
1957
|
+
type: "button",
|
|
1958
|
+
className: "uic-filecard-dl",
|
|
1959
|
+
"aria-label": `Download ${name}`,
|
|
1960
|
+
title: "Download",
|
|
1961
|
+
onClick: (e) => {
|
|
1962
|
+
e.stopPropagation();
|
|
1963
|
+
onDownload();
|
|
1964
|
+
},
|
|
1965
|
+
children: /* @__PURE__ */ jsx3(IcDownload, { size: 18 })
|
|
1966
|
+
}
|
|
1967
|
+
),
|
|
1968
|
+
onPreview && /* @__PURE__ */ jsx3("button", { type: "button", className: "uic-filecard-open", "aria-label": `Preview ${name}`, onClick: open, children: "Preview" })
|
|
1969
|
+
]
|
|
1970
|
+
}
|
|
1971
|
+
);
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
// src/components/FilePreview.jsx
|
|
1975
|
+
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
1976
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1977
|
+
var LANG = {
|
|
1978
|
+
js: "javascript",
|
|
1979
|
+
mjs: "javascript",
|
|
1980
|
+
cjs: "javascript",
|
|
1981
|
+
jsx: "javascript",
|
|
1982
|
+
ts: "typescript",
|
|
1983
|
+
tsx: "typescript",
|
|
1984
|
+
py: "python",
|
|
1985
|
+
rb: "ruby",
|
|
1986
|
+
go: "go",
|
|
1987
|
+
rs: "rust",
|
|
1988
|
+
java: "java",
|
|
1989
|
+
c: "c",
|
|
1990
|
+
h: "c",
|
|
1991
|
+
cpp: "cpp",
|
|
1992
|
+
hpp: "cpp",
|
|
1993
|
+
cs: "csharp",
|
|
1994
|
+
php: "php",
|
|
1995
|
+
swift: "swift",
|
|
1996
|
+
kt: "kotlin",
|
|
1997
|
+
scala: "scala",
|
|
1998
|
+
sh: "bash",
|
|
1999
|
+
bash: "bash",
|
|
2000
|
+
zsh: "bash",
|
|
2001
|
+
sql: "sql",
|
|
2002
|
+
css: "css",
|
|
2003
|
+
scss: "scss",
|
|
2004
|
+
less: "less",
|
|
2005
|
+
html: "xml",
|
|
2006
|
+
htm: "xml",
|
|
2007
|
+
xml: "xml",
|
|
2008
|
+
svg: "xml",
|
|
2009
|
+
json: "json",
|
|
2010
|
+
yaml: "yaml",
|
|
2011
|
+
yml: "yaml",
|
|
2012
|
+
toml: "ini",
|
|
2013
|
+
ini: "ini",
|
|
2014
|
+
r: "r",
|
|
2015
|
+
lua: "lua",
|
|
2016
|
+
pl: "perl",
|
|
2017
|
+
dockerfile: "dockerfile",
|
|
2018
|
+
diff: "diff",
|
|
2019
|
+
md: "markdown",
|
|
2020
|
+
txt: "plaintext",
|
|
2021
|
+
log: "plaintext",
|
|
2022
|
+
csv: "plaintext"
|
|
2023
|
+
};
|
|
2024
|
+
var OFFICE = /* @__PURE__ */ new Set(["pptx", "ppt", "pptm", "odp", "doc", "docx", "odt", "rtf"]);
|
|
2025
|
+
var SHEET = /* @__PURE__ */ new Set(["xls", "xlsx", "xlsm", "xlsb", "ods"]);
|
|
2026
|
+
function kindOf(name, mime = "") {
|
|
2027
|
+
const e = extOf(name);
|
|
2028
|
+
if (mime.startsWith("image/") || /^(png|jpe?g|gif|webp|svg|bmp|ico|avif)$/.test(e)) return "image";
|
|
2029
|
+
if (mime === "application/pdf" || e === "pdf") return "pdf";
|
|
2030
|
+
if (mime.startsWith("video/") || ["mp4", "webm", "mov", "m4v"].includes(e)) return "video";
|
|
2031
|
+
if (mime.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac"].includes(e)) return "audio";
|
|
2032
|
+
if (e === "csv" || e === "tsv") return "csv";
|
|
2033
|
+
if (e === "md" || e === "markdown") return "markdown";
|
|
2034
|
+
if (e === "html" || e === "htm") return "html";
|
|
2035
|
+
if (SHEET.has(e)) return "sheet";
|
|
2036
|
+
if (OFFICE.has(e)) return "office";
|
|
2037
|
+
if (mime.startsWith("text/") || LANG[e] || /^(txt|log|env|conf|cfg|gitignore)$/.test(e)) return "code";
|
|
2038
|
+
return "binary";
|
|
2039
|
+
}
|
|
2040
|
+
function delimitedToRows(text, sep) {
|
|
2041
|
+
return text.split(/\r?\n/).filter((l) => l.length).slice(0, 1e3).map((line) => {
|
|
2042
|
+
const out = [];
|
|
2043
|
+
let cur = "";
|
|
2044
|
+
let q = false;
|
|
2045
|
+
for (const ch of line) {
|
|
2046
|
+
if (ch === '"') q = !q;
|
|
2047
|
+
else if (ch === sep && !q) {
|
|
2048
|
+
out.push(cur);
|
|
2049
|
+
cur = "";
|
|
2050
|
+
} else cur += ch;
|
|
2051
|
+
}
|
|
2052
|
+
out.push(cur);
|
|
2053
|
+
return out.map((c) => c.replace(/^"|"$/g, ""));
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
function Grid({ rows }) {
|
|
2057
|
+
if (!rows?.length) return /* @__PURE__ */ jsx4("div", { className: "uic-fp-empty", children: "This file is empty." });
|
|
2058
|
+
const [head, ...body] = rows;
|
|
2059
|
+
return /* @__PURE__ */ jsx4("div", { className: "uic-fp-sheet", children: /* @__PURE__ */ jsxs3("table", { children: [
|
|
2060
|
+
/* @__PURE__ */ jsx4("thead", { children: /* @__PURE__ */ jsx4("tr", { children: head.map((c, i) => /* @__PURE__ */ jsx4("th", { children: c }, i)) }) }),
|
|
2061
|
+
/* @__PURE__ */ jsx4("tbody", { children: body.map((r, i) => /* @__PURE__ */ jsx4("tr", { children: r.map((c, j) => /* @__PURE__ */ jsx4("td", { children: c }, j)) }, i)) })
|
|
2062
|
+
] }) });
|
|
2063
|
+
}
|
|
2064
|
+
var defaultDownload = (url, name) => {
|
|
2065
|
+
const a = document.createElement("a");
|
|
2066
|
+
a.href = url;
|
|
2067
|
+
a.download = name;
|
|
2068
|
+
a.rel = "noreferrer";
|
|
2069
|
+
document.body.appendChild(a);
|
|
2070
|
+
a.click();
|
|
2071
|
+
a.remove();
|
|
2072
|
+
};
|
|
2073
|
+
function FilePreview({
|
|
2074
|
+
file,
|
|
2075
|
+
onClose,
|
|
2076
|
+
fetchFile,
|
|
2077
|
+
officePdfUrl,
|
|
2078
|
+
renderMarkdown,
|
|
2079
|
+
parseWorkbook,
|
|
2080
|
+
onDownload,
|
|
2081
|
+
title,
|
|
2082
|
+
before
|
|
2083
|
+
}) {
|
|
2084
|
+
const { url, name } = file || {};
|
|
2085
|
+
const [st, setSt] = useState5({ kind: "loading" });
|
|
2086
|
+
const [tab, setTab] = useState5(0);
|
|
2087
|
+
const [view, setView] = useState5("preview");
|
|
2088
|
+
useEffect5(() => {
|
|
2089
|
+
if (!url) return void 0;
|
|
2090
|
+
let alive = true;
|
|
2091
|
+
let obj;
|
|
2092
|
+
setSt({ kind: "loading" });
|
|
2093
|
+
setTab(0);
|
|
2094
|
+
setView("preview");
|
|
2095
|
+
const get = fetchFile || ((u) => fetch(u, { cache: "no-store" }));
|
|
2096
|
+
(async () => {
|
|
2097
|
+
const res = await get(url);
|
|
2098
|
+
if (!res.ok) throw new Error(`${res.status}`);
|
|
2099
|
+
const mime = (res.headers.get("content-type") || "").toLowerCase();
|
|
2100
|
+
const kind = kindOf(name, mime);
|
|
2101
|
+
if (kind === "office") {
|
|
2102
|
+
if (!officePdfUrl) {
|
|
2103
|
+
setSt({ kind: "binary", error: "This format has no preview here. Download it to open it." });
|
|
2104
|
+
return;
|
|
2105
|
+
}
|
|
2106
|
+
const r = await get(officePdfUrl(url));
|
|
2107
|
+
if (!r.ok) throw new Error(`${r.status}`);
|
|
2108
|
+
obj = URL.createObjectURL(await r.blob());
|
|
2109
|
+
if (alive) setSt({ kind: "pdf", objUrl: obj });
|
|
2110
|
+
return;
|
|
2111
|
+
}
|
|
2112
|
+
if (kind === "sheet") {
|
|
2113
|
+
if (!parseWorkbook) {
|
|
2114
|
+
setSt({ kind: "binary", error: "This format has no preview here. Download it to open it." });
|
|
2115
|
+
return;
|
|
2116
|
+
}
|
|
2117
|
+
try {
|
|
2118
|
+
const sheets = await parseWorkbook(await res.arrayBuffer());
|
|
2119
|
+
const first = sheets.findIndex((s) => s.filled);
|
|
2120
|
+
if (alive) {
|
|
2121
|
+
setTab(first < 0 ? 0 : first);
|
|
2122
|
+
setSt({ kind: "sheet", sheets });
|
|
2123
|
+
}
|
|
2124
|
+
} catch (e) {
|
|
2125
|
+
if (alive) setSt({ kind: "binary", error: `This spreadsheet couldn\u2019t be read (${String(e?.message || "parse failed").slice(0, 80)}).` });
|
|
2126
|
+
}
|
|
2127
|
+
return;
|
|
2128
|
+
}
|
|
2129
|
+
if (kind === "csv" || kind === "markdown" || kind === "code" || kind === "html") {
|
|
2130
|
+
const text = await res.text();
|
|
2131
|
+
if (!alive) return;
|
|
2132
|
+
if (kind === "csv") setSt({ kind: "csv", rows: delimitedToRows(text, extOf(name) === "tsv" ? " " : ",") });
|
|
2133
|
+
else setSt({ kind, text: text.slice(0, 4e5) });
|
|
2134
|
+
return;
|
|
2135
|
+
}
|
|
2136
|
+
if (kind === "binary") {
|
|
2137
|
+
if (alive) setSt({ kind: "binary" });
|
|
2138
|
+
return;
|
|
2139
|
+
}
|
|
2140
|
+
obj = URL.createObjectURL(await res.blob());
|
|
2141
|
+
if (alive) setSt({ kind, objUrl: obj });
|
|
2142
|
+
})().catch(() => {
|
|
2143
|
+
if (alive) setSt({ kind: "binary", error: "Could not load this file." });
|
|
2144
|
+
});
|
|
2145
|
+
return () => {
|
|
2146
|
+
alive = false;
|
|
2147
|
+
if (obj) URL.revokeObjectURL(obj);
|
|
2148
|
+
};
|
|
2149
|
+
}, [url, name, fetchFile, officePdfUrl, parseWorkbook]);
|
|
2150
|
+
const download = () => onDownload ? onDownload(url, name) : defaultDownload(url, name);
|
|
2151
|
+
const [copied, setCopied] = useState5("");
|
|
2152
|
+
useEffect5(() => {
|
|
2153
|
+
if (!copied) return void 0;
|
|
2154
|
+
const t = setTimeout(() => setCopied(""), 1600);
|
|
2155
|
+
return () => clearTimeout(t);
|
|
2156
|
+
}, [copied]);
|
|
2157
|
+
const copyText = typeof st.text === "string" ? st.text : null;
|
|
2158
|
+
const copy = async () => {
|
|
2159
|
+
try {
|
|
2160
|
+
await navigator.clipboard.writeText(copyText || "");
|
|
2161
|
+
setCopied("ok");
|
|
2162
|
+
} catch {
|
|
2163
|
+
setCopied("no");
|
|
2164
|
+
}
|
|
2165
|
+
};
|
|
2166
|
+
return /* @__PURE__ */ jsxs3("aside", { className: "uic-fp", "aria-label": title || `Preview of ${name}`, children: [
|
|
2167
|
+
before,
|
|
2168
|
+
/* @__PURE__ */ jsxs3("header", { className: "uic-fp-head", children: [
|
|
2169
|
+
/* @__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 }),
|
|
2171
|
+
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
|
+
"button",
|
|
2173
|
+
{
|
|
2174
|
+
type: "button",
|
|
2175
|
+
role: "tab",
|
|
2176
|
+
"aria-selected": view === id,
|
|
2177
|
+
className: "uic-fp-seg-btn" + (view === id ? " is-on" : ""),
|
|
2178
|
+
onClick: () => setView(id),
|
|
2179
|
+
children: label
|
|
2180
|
+
},
|
|
2181
|
+
id
|
|
2182
|
+
)) }),
|
|
2183
|
+
copyText != null && /* @__PURE__ */ jsx4(
|
|
2184
|
+
"button",
|
|
2185
|
+
{
|
|
2186
|
+
type: "button",
|
|
2187
|
+
className: "uic-fp-btn uic-fp-copy",
|
|
2188
|
+
"aria-label": copied === "ok" ? "Copied" : `Copy ${name}`,
|
|
2189
|
+
title: copied === "ok" ? "Copied" : copied === "no" ? "Could not copy" : "Copy",
|
|
2190
|
+
onClick: copy,
|
|
2191
|
+
children: copied === "ok" ? /* @__PURE__ */ jsx4("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx4("path", { d: "M5 12l5 5L20 7" }) }) : /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
2192
|
+
/* @__PURE__ */ jsx4("rect", { x: "9", y: "9", width: "11", height: "11", rx: "2" }),
|
|
2193
|
+
/* @__PURE__ */ jsx4("path", { d: "M5 15V6a2 2 0 0 1 2-2h9" })
|
|
2194
|
+
] })
|
|
2195
|
+
}
|
|
2196
|
+
),
|
|
2197
|
+
/* @__PURE__ */ jsx4(
|
|
2198
|
+
"button",
|
|
2199
|
+
{
|
|
2200
|
+
type: "button",
|
|
2201
|
+
className: "uic-fp-btn",
|
|
2202
|
+
"aria-label": `Download ${name}`,
|
|
2203
|
+
title: "Download",
|
|
2204
|
+
onClick: download,
|
|
2205
|
+
children: /* @__PURE__ */ jsx4(IcDownload, {})
|
|
2206
|
+
}
|
|
2207
|
+
),
|
|
2208
|
+
onClose && /* @__PURE__ */ jsx4(
|
|
2209
|
+
"button",
|
|
2210
|
+
{
|
|
2211
|
+
type: "button",
|
|
2212
|
+
className: "uic-fp-btn",
|
|
2213
|
+
"aria-label": "Close preview",
|
|
2214
|
+
title: "Close",
|
|
2215
|
+
onClick: onClose,
|
|
2216
|
+
children: /* @__PURE__ */ jsx4(IcX, { size: 18 })
|
|
2217
|
+
}
|
|
2218
|
+
)
|
|
2219
|
+
] }),
|
|
2220
|
+
/* @__PURE__ */ jsxs3("div", { className: "uic-fp-body", children: [
|
|
2221
|
+
st.kind === "loading" && /* @__PURE__ */ jsx4("div", { className: "uic-fp-pad", children: /* @__PURE__ */ jsx4("span", { className: "uic-skel uic-fp-skel" }) }),
|
|
2222
|
+
st.kind === "image" && st.objUrl && /* @__PURE__ */ jsx4("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx4("img", { className: "uic-fp-img", src: st.objUrl, alt: name }) }),
|
|
2223
|
+
st.kind === "pdf" && st.objUrl && /* @__PURE__ */ jsx4("iframe", { className: "uic-fp-frame", src: st.objUrl, title: name }),
|
|
2224
|
+
st.kind === "video" && st.objUrl && /* @__PURE__ */ jsx4("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx4("video", { className: "uic-fp-media", src: st.objUrl, controls: true }) }),
|
|
2225
|
+
st.kind === "audio" && st.objUrl && /* @__PURE__ */ jsx4("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx4("audio", { src: st.objUrl, controls: true }) }),
|
|
2226
|
+
st.kind === "markdown" && /* @__PURE__ */ jsx4("div", { className: "uic-fp-doc", children: renderMarkdown ? renderMarkdown(st.text || "") : /* @__PURE__ */ jsx4("pre", { className: "uic-fp-pre", children: st.text }) }),
|
|
2227
|
+
st.kind === "code" && /* @__PURE__ */ jsx4(CodeBlock, { code: st.text || "", language: LANG[extOf(name)] || "plaintext" }),
|
|
2228
|
+
st.kind === "html" && view === "source" && /* @__PURE__ */ jsx4(CodeBlock, { code: st.text || "", language: "xml" }),
|
|
2229
|
+
st.kind === "html" && view === "preview" && // The page runs in its own origin with scripts only: a mockup's own script and styles
|
|
2230
|
+
// work, and nothing in it can read the host page, its cookies or its storage.
|
|
2231
|
+
/* @__PURE__ */ jsx4("iframe", { className: "uic-fp-frame", title: name, sandbox: "allow-scripts", srcDoc: st.text || "" }),
|
|
2232
|
+
st.kind === "csv" && /* @__PURE__ */ jsx4(Grid, { rows: st.rows }),
|
|
2233
|
+
st.kind === "sheet" && st.sheets && /* @__PURE__ */ jsxs3("div", { className: "uic-fp-xlsx", children: [
|
|
2234
|
+
st.sheets[tab]?.filled ? /* @__PURE__ */ jsx4(Grid, { rows: st.sheets[tab].rows }) : /* @__PURE__ */ jsx4("div", { className: "uic-fp-empty", children: "This sheet is empty." }),
|
|
2235
|
+
/* @__PURE__ */ jsx4("div", { className: "uic-fp-tabs", children: st.sheets.map((s, i) => /* @__PURE__ */ jsx4(
|
|
2236
|
+
"button",
|
|
2237
|
+
{
|
|
2238
|
+
type: "button",
|
|
2239
|
+
className: "uic-fp-tab" + (i === tab ? " is-on" : "") + (s.filled ? "" : " is-empty"),
|
|
2240
|
+
onClick: () => setTab(i),
|
|
2241
|
+
title: s.filled ? s.name : `${s.name} (empty)`,
|
|
2242
|
+
children: s.name
|
|
2243
|
+
},
|
|
2244
|
+
s.name + i
|
|
2245
|
+
)) })
|
|
2246
|
+
] }),
|
|
2247
|
+
st.kind === "binary" && /* @__PURE__ */ jsx4("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsxs3("div", { className: "uic-fp-fallback", children: [
|
|
2248
|
+
/* @__PURE__ */ jsx4(FileTypeIcon, { name, size: 56 }),
|
|
2249
|
+
/* @__PURE__ */ jsx4("p", { children: st.error || "No inline preview for this file type." }),
|
|
2250
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "uic-fp-dl", onClick: download, children: "Download" })
|
|
2251
|
+
] }) })
|
|
2252
|
+
] })
|
|
2253
|
+
] });
|
|
2254
|
+
}
|
|
2255
|
+
|
|
1849
2256
|
export {
|
|
1850
2257
|
parseToolArgs,
|
|
1851
2258
|
toolKind,
|
|
@@ -1891,6 +2298,10 @@ export {
|
|
|
1891
2298
|
AgentTurnView,
|
|
1892
2299
|
AgentComposer,
|
|
1893
2300
|
useStickToBottom,
|
|
1894
|
-
AgentConversation
|
|
2301
|
+
AgentConversation,
|
|
2302
|
+
extOf,
|
|
2303
|
+
FileTypeIcon,
|
|
2304
|
+
FileCard,
|
|
2305
|
+
FilePreview
|
|
1895
2306
|
};
|
|
1896
|
-
//# sourceMappingURL=chunk-
|
|
2307
|
+
//# sourceMappingURL=chunk-4SVQGVJH.js.map
|