@heroui/agent 0.2.0-beta.7 → 0.2.0-beta.9
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/CHANGELOG.md +20 -2
- package/README.md +15 -10
- package/dist/chart-content-BBHQVMP4.js +1 -0
- package/dist/chunk-2XBFFSW2.js +1 -0
- package/dist/chunk-64RI74L5.js +1 -0
- package/dist/chunk-6ZJJN322.js +1 -0
- package/dist/chunk-7KCGPNEN.js +1 -0
- package/dist/chunk-BBB5EHDN.js +5 -0
- package/dist/chunk-CR3H7AVI.js +1 -0
- package/dist/chunk-HCLXS4HQ.js +1 -0
- package/dist/chunk-MXLGM4WV.js +1 -0
- package/dist/chunk-OA3TG5CS.js +1 -0
- package/dist/chunk-PZJ4NC3J.js +1 -0
- package/dist/chunk-RNNGE7KM.js +1 -0
- package/dist/chunk-S6OIAJSC.js +1 -0
- package/dist/chunk-SUDHJNTJ.js +2 -0
- package/dist/chunk-WUAFMD7Z.js +2 -0
- package/dist/component-renderer-GG6JVRUG.js +1 -0
- package/dist/composer-draft-NSKK65F3.js +1 -0
- package/dist/composer-image-draft-KAGTNQR7.js +1 -0
- package/dist/contracts.d.ts +50 -19
- package/dist/contracts.js +2 -2545
- package/dist/css/index.css +1 -1
- package/dist/embed-runtime-GYXK7V6N.js +5 -0
- package/dist/identity-3P8-17km.d.ts +95 -0
- package/dist/index.d.ts +46 -10
- package/dist/index.js +1 -28
- package/dist/interactive-map-surface-WC2LPCR7.js +1 -0
- package/dist/internal/client-tools.js +1 -0
- package/dist/internal/models.js +1 -0
- package/dist/internal/runtime.js +1 -0
- package/dist/internal/theme.js +1 -0
- package/dist/next.d.ts +2 -1
- package/dist/next.js +1 -22
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -260
- package/package.json +6 -6
- package/dist/chart-content-E4NPTUPR.js +0 -2696
- package/dist/chunk-3FG5NRTX.js +0 -9
- package/dist/chunk-6O3SFXJK.js +0 -325
- package/dist/chunk-FNGGMHVR.js +0 -625
- package/dist/chunk-OQGXZY5L.js +0 -1091
- package/dist/chunk-TOOT6SZ2.js +0 -74
- package/dist/chunk-V5S5FRGV.js +0 -984
- package/dist/chunk-VJA52U5P.js +0 -137
- package/dist/component-renderer-46EJDPTB.js +0 -10627
- package/dist/embed-runtime-UF7XJIFA.js +0 -7650
- package/dist/identity-Z6i6pL0F.d.ts +0 -166
- package/dist/interactive-map-surface-67KHT3VB.js +0 -362
package/dist/chunk-3FG5NRTX.js
DELETED
package/dist/chunk-6O3SFXJK.js
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
mergeClassNames
|
|
3
|
-
} from "./chunk-3FG5NRTX.js";
|
|
4
|
-
|
|
5
|
-
// ../agent-ui/src/components/display-information/scroll-shadow/scroll-shadow.tsx
|
|
6
|
-
import { useCallback, useEffect, useRef } from "react";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
function ScrollShadow({
|
|
9
|
-
children,
|
|
10
|
-
className,
|
|
11
|
-
offset = 0,
|
|
12
|
-
size = 32,
|
|
13
|
-
style,
|
|
14
|
-
...props
|
|
15
|
-
}) {
|
|
16
|
-
const ref = useRef(null);
|
|
17
|
-
const previousVisibility = useRef(null);
|
|
18
|
-
const frame = useRef(null);
|
|
19
|
-
const updateVisibility = useCallback(() => {
|
|
20
|
-
const element = ref.current;
|
|
21
|
-
if (!element) return;
|
|
22
|
-
const hasScrollBefore = element.scrollLeft > offset;
|
|
23
|
-
const hasScrollAfter = element.scrollLeft + element.clientWidth + offset < element.scrollWidth;
|
|
24
|
-
const visibility = hasScrollBefore && hasScrollAfter ? "both" : hasScrollBefore ? "left" : hasScrollAfter ? "right" : "none";
|
|
25
|
-
if (previousVisibility.current === visibility) return;
|
|
26
|
-
previousVisibility.current = visibility;
|
|
27
|
-
if (frame.current !== null) cancelAnimationFrame(frame.current);
|
|
28
|
-
frame.current = requestAnimationFrame(() => {
|
|
29
|
-
frame.current = null;
|
|
30
|
-
delete element.dataset["leftScroll"];
|
|
31
|
-
delete element.dataset["rightScroll"];
|
|
32
|
-
delete element.dataset["leftRightScroll"];
|
|
33
|
-
if (visibility === "both") element.dataset["leftRightScroll"] = "true";
|
|
34
|
-
else if (visibility !== "none") element.dataset[`${visibility}Scroll`] = "true";
|
|
35
|
-
});
|
|
36
|
-
}, [offset]);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
const element = ref.current;
|
|
39
|
-
if (!element) return;
|
|
40
|
-
updateVisibility();
|
|
41
|
-
element.addEventListener("scroll", updateVisibility, { passive: true });
|
|
42
|
-
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(updateVisibility);
|
|
43
|
-
observer?.observe(element);
|
|
44
|
-
return () => {
|
|
45
|
-
element.removeEventListener("scroll", updateVisibility);
|
|
46
|
-
observer?.disconnect();
|
|
47
|
-
if (frame.current !== null) cancelAnimationFrame(frame.current);
|
|
48
|
-
frame.current = null;
|
|
49
|
-
previousVisibility.current = null;
|
|
50
|
-
};
|
|
51
|
-
}, [updateVisibility]);
|
|
52
|
-
return /* @__PURE__ */ jsx(
|
|
53
|
-
"div",
|
|
54
|
-
{
|
|
55
|
-
ref,
|
|
56
|
-
className: mergeClassNames("aui-scroll-shadow", className),
|
|
57
|
-
"data-slot": "agent-ui-scroll-shadow",
|
|
58
|
-
style: { "--scroll-shadow-size": `${size}px`, ...style },
|
|
59
|
-
...props,
|
|
60
|
-
children
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// ../agent-ui/src/utils/inline-markdown.tsx
|
|
66
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
67
|
-
var INLINE_TOKEN = /(\*\*[^*\n]+\*\*|\*[^*\s][^*\n]*\*|_[^_\s][^_\n]*_|`[^`\n]+`|\[[^\]\n]+\]\([^\s)\n]+\))/g;
|
|
68
|
-
var LINK_TOKEN = /^\[([^\]]+)\]\(([^\s)]+)\)$/;
|
|
69
|
-
var BARE_DOMAIN = /^(?:[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?\.)+[a-z]{2,63}(?::\d{1,5})?(?:[/?#][^\s]*)?$/i;
|
|
70
|
-
function resolveLinkHref(target) {
|
|
71
|
-
const href = /^https?:\/\//i.test(target) ? target : BARE_DOMAIN.test(target) ? `https://${target}` : void 0;
|
|
72
|
-
if (!href) return void 0;
|
|
73
|
-
try {
|
|
74
|
-
const url = new URL(href);
|
|
75
|
-
return url.protocol === "http:" || url.protocol === "https:" ? href : void 0;
|
|
76
|
-
} catch {
|
|
77
|
-
return void 0;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function renderInlineMarkdown(text) {
|
|
81
|
-
const parts = text.split(INLINE_TOKEN);
|
|
82
|
-
if (parts.length === 1) return text;
|
|
83
|
-
const occurrences = /* @__PURE__ */ new Map();
|
|
84
|
-
return parts.map((part) => {
|
|
85
|
-
const occurrence = (occurrences.get(part) ?? 0) + 1;
|
|
86
|
-
const key = `${part}:${occurrence}`;
|
|
87
|
-
occurrences.set(part, occurrence);
|
|
88
|
-
if (part.startsWith("**") && part.endsWith("**") && part.length > 4)
|
|
89
|
-
return /* @__PURE__ */ jsx2("strong", { children: part.slice(2, -2) }, key);
|
|
90
|
-
if (part.startsWith("*") && part.endsWith("*") && part.length > 2)
|
|
91
|
-
return /* @__PURE__ */ jsx2("em", { children: part.slice(1, -1) }, key);
|
|
92
|
-
if (part.startsWith("_") && part.endsWith("_") && part.length > 2)
|
|
93
|
-
return /* @__PURE__ */ jsx2("em", { children: part.slice(1, -1) }, key);
|
|
94
|
-
if (part.startsWith("`") && part.endsWith("`") && part.length > 2)
|
|
95
|
-
return /* @__PURE__ */ jsx2("code", { children: part.slice(1, -1) }, key);
|
|
96
|
-
const link = LINK_TOKEN.exec(part);
|
|
97
|
-
const target = link?.[2];
|
|
98
|
-
const href = target ? resolveLinkHref(target) : void 0;
|
|
99
|
-
if (link && href)
|
|
100
|
-
return /* @__PURE__ */ jsx2("a", { href, rel: "noopener noreferrer", target: "_blank", children: link[1] }, key);
|
|
101
|
-
return part;
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// ../agent-ui/src/components/actions/action-button.tsx
|
|
106
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
107
|
-
function ActionButton({
|
|
108
|
-
className,
|
|
109
|
-
size = "sm",
|
|
110
|
-
variant = "secondary",
|
|
111
|
-
...props
|
|
112
|
-
}) {
|
|
113
|
-
return /* @__PURE__ */ jsx3(
|
|
114
|
-
"button",
|
|
115
|
-
{
|
|
116
|
-
className: mergeClassNames("aui-button", className),
|
|
117
|
-
"data-size": size,
|
|
118
|
-
"data-slot": "agent-ui-action-button",
|
|
119
|
-
"data-variant": variant,
|
|
120
|
-
type: "button",
|
|
121
|
-
...props
|
|
122
|
-
}
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// ../agent-ui/src/components/display-information/code-block.tsx
|
|
127
|
-
import { Button } from "@heroui/react";
|
|
128
|
-
import { useEffect as useEffect2, useRef as useRef2, useState } from "react";
|
|
129
|
-
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
130
|
-
var COPY_RESET_DELAY = 2e3;
|
|
131
|
-
var DEFAULT_DARK_THEME = "github-dark";
|
|
132
|
-
var DEFAULT_LIGHT_THEME = "github-light";
|
|
133
|
-
var languageLoaders = {
|
|
134
|
-
bash: () => import("shiki/langs/bash.mjs"),
|
|
135
|
-
css: () => import("shiki/langs/css.mjs"),
|
|
136
|
-
html: () => import("shiki/langs/html.mjs"),
|
|
137
|
-
javascript: () => import("shiki/langs/javascript.mjs"),
|
|
138
|
-
json: () => import("shiki/langs/json.mjs"),
|
|
139
|
-
jsx: () => import("shiki/langs/jsx.mjs"),
|
|
140
|
-
markdown: () => import("shiki/langs/markdown.mjs"),
|
|
141
|
-
python: () => import("shiki/langs/python.mjs"),
|
|
142
|
-
shellscript: () => import("shiki/langs/shellscript.mjs"),
|
|
143
|
-
sql: () => import("shiki/langs/sql.mjs"),
|
|
144
|
-
tsx: () => import("shiki/langs/tsx.mjs"),
|
|
145
|
-
typescript: () => import("shiki/langs/typescript.mjs")
|
|
146
|
-
};
|
|
147
|
-
var highlighters = /* @__PURE__ */ new Map();
|
|
148
|
-
function normalizeLanguage(language) {
|
|
149
|
-
const aliases = {
|
|
150
|
-
js: "javascript",
|
|
151
|
-
md: "markdown",
|
|
152
|
-
py: "python",
|
|
153
|
-
sh: "shellscript",
|
|
154
|
-
shell: "shellscript",
|
|
155
|
-
ts: "typescript"
|
|
156
|
-
};
|
|
157
|
-
const normalized = language.toLowerCase();
|
|
158
|
-
if (normalized in languageLoaders) return normalized;
|
|
159
|
-
return aliases[normalized] ?? null;
|
|
160
|
-
}
|
|
161
|
-
async function createLanguageHighlighter(language) {
|
|
162
|
-
const [{ createHighlighterCore }, { createJavaScriptRegexEngine }, lightTheme, darkTheme, grammar] = await Promise.all([
|
|
163
|
-
import("shiki/core"),
|
|
164
|
-
import("shiki/engine/javascript"),
|
|
165
|
-
import("shiki/themes/github-light.mjs"),
|
|
166
|
-
import("shiki/themes/github-dark.mjs"),
|
|
167
|
-
languageLoaders[language]()
|
|
168
|
-
]);
|
|
169
|
-
return createHighlighterCore({
|
|
170
|
-
engine: createJavaScriptRegexEngine(),
|
|
171
|
-
langs: [grammar.default],
|
|
172
|
-
themes: [lightTheme.default, darkTheme.default]
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
async function highlightCode(code, language) {
|
|
176
|
-
const normalized = normalizeLanguage(language);
|
|
177
|
-
if (!normalized) return null;
|
|
178
|
-
const existing = highlighters.get(normalized);
|
|
179
|
-
const highlighterPromise = existing ?? createLanguageHighlighter(normalized);
|
|
180
|
-
if (!existing) highlighters.set(normalized, highlighterPromise);
|
|
181
|
-
const highlighter = await highlighterPromise;
|
|
182
|
-
return highlighter.codeToHtml(code, {
|
|
183
|
-
defaultColor: false,
|
|
184
|
-
lang: normalized,
|
|
185
|
-
themes: { dark: DEFAULT_DARK_THEME, light: DEFAULT_LIGHT_THEME }
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
async function copyText(text) {
|
|
189
|
-
try {
|
|
190
|
-
await navigator.clipboard.writeText(text);
|
|
191
|
-
return true;
|
|
192
|
-
} catch {
|
|
193
|
-
const textarea = document.createElement("textarea");
|
|
194
|
-
textarea.value = text;
|
|
195
|
-
textarea.setAttribute("readonly", "");
|
|
196
|
-
textarea.style.position = "fixed";
|
|
197
|
-
textarea.style.opacity = "0";
|
|
198
|
-
document.body.append(textarea);
|
|
199
|
-
textarea.select();
|
|
200
|
-
try {
|
|
201
|
-
return document.execCommand?.("copy") ?? false;
|
|
202
|
-
} catch {
|
|
203
|
-
return false;
|
|
204
|
-
} finally {
|
|
205
|
-
textarea.remove();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
function CodeGlyph() {
|
|
210
|
-
return /* @__PURE__ */ jsx4("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx4(
|
|
211
|
-
"path",
|
|
212
|
-
{
|
|
213
|
-
clipRule: "evenodd",
|
|
214
|
-
d: "M10.218 3.216a.75.75 0 0 0-1.436-.431l-3 10a.75.75 0 0 0 1.436.43zM4.53 4.97a.75.75 0 0 1 0 1.06L2.56 8l1.97 1.97a.75.75 0 0 1-1.06 1.06l-2.5-2.5a.75.75 0 0 1 0-1.06l2.5-2.5a.75.75 0 0 1 1.06 0m6.94 6.06a.75.75 0 0 1 0-1.06L13.44 8l-1.97-1.97a.75.75 0 0 1 1.06-1.06l2.5 2.5a.75.75 0 0 1 0 1.06l-2.5 2.5a.75.75 0 0 1-1.06 0",
|
|
215
|
-
fill: "currentColor",
|
|
216
|
-
fillRule: "evenodd"
|
|
217
|
-
}
|
|
218
|
-
) });
|
|
219
|
-
}
|
|
220
|
-
function CopyGlyph() {
|
|
221
|
-
return /* @__PURE__ */ jsx4("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx4(
|
|
222
|
-
"path",
|
|
223
|
-
{
|
|
224
|
-
clipRule: "evenodd",
|
|
225
|
-
d: "M12 2.5H8A1.5 1.5 0 0 0 6.5 4v1H8a3 3 0 0 1 3 3v1.5h1A1.5 1.5 0 0 0 13.5 8V4A1.5 1.5 0 0 0 12 2.5M11 11h1a3 3 0 0 0 3-3V4a3 3 0 0 0-3-3H8a3 3 0 0 0-3 3v1H4a3 3 0 0 0-3 3v4a3 3 0 0 0 3 3h4a3 3 0 0 0 3-3zM4 6.5h4A1.5 1.5 0 0 1 9.5 8v4A1.5 1.5 0 0 1 8 13.5H4A1.5 1.5 0 0 1 2.5 12V8A1.5 1.5 0 0 1 4 6.5",
|
|
226
|
-
fill: "currentColor",
|
|
227
|
-
fillRule: "evenodd"
|
|
228
|
-
}
|
|
229
|
-
) });
|
|
230
|
-
}
|
|
231
|
-
function CheckGlyph() {
|
|
232
|
-
return /* @__PURE__ */ jsx4("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx4(
|
|
233
|
-
"path",
|
|
234
|
-
{
|
|
235
|
-
clipRule: "evenodd",
|
|
236
|
-
d: "M13.488 3.43a.75.75 0 0 1 .081 1.058l-6 7a.75.75 0 0 1-1.1.042l-3.5-3.5A.75.75 0 0 1 4.03 6.97l2.928 2.927 5.473-6.385a.75.75 0 0 1 1.057-.081",
|
|
237
|
-
fill: "currentColor",
|
|
238
|
-
fillRule: "evenodd"
|
|
239
|
-
}
|
|
240
|
-
) });
|
|
241
|
-
}
|
|
242
|
-
function CodeBlock({ code, language = "text" }) {
|
|
243
|
-
const highlightKey = `${language}:${code}`;
|
|
244
|
-
const [highlighted, setHighlighted] = useState(null);
|
|
245
|
-
const [copied, setCopied] = useState(false);
|
|
246
|
-
const resetTimeout = useRef2(null);
|
|
247
|
-
useEffect2(() => {
|
|
248
|
-
let cancelled = false;
|
|
249
|
-
async function highlight() {
|
|
250
|
-
try {
|
|
251
|
-
const html = await highlightCode(code, language);
|
|
252
|
-
if (!cancelled) setHighlighted(html ? { html, key: highlightKey } : null);
|
|
253
|
-
} catch {
|
|
254
|
-
if (!cancelled) setHighlighted(null);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
void highlight();
|
|
258
|
-
return () => {
|
|
259
|
-
cancelled = true;
|
|
260
|
-
};
|
|
261
|
-
}, [code, highlightKey, language]);
|
|
262
|
-
useEffect2(
|
|
263
|
-
() => () => {
|
|
264
|
-
if (resetTimeout.current !== null) window.clearTimeout(resetTimeout.current);
|
|
265
|
-
},
|
|
266
|
-
[]
|
|
267
|
-
);
|
|
268
|
-
const copy = async () => {
|
|
269
|
-
if (await copyText(code)) {
|
|
270
|
-
setCopied(true);
|
|
271
|
-
if (resetTimeout.current !== null) window.clearTimeout(resetTimeout.current);
|
|
272
|
-
resetTimeout.current = window.setTimeout(() => {
|
|
273
|
-
setCopied(false);
|
|
274
|
-
resetTimeout.current = null;
|
|
275
|
-
}, COPY_RESET_DELAY);
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
return /* @__PURE__ */ jsxs("div", { className: "aui-code", "data-slot": "agent-ui-code-block", children: [
|
|
279
|
-
/* @__PURE__ */ jsxs("header", { className: "aui-code__header", "data-slot": "agent-ui-code-header", children: [
|
|
280
|
-
/* @__PURE__ */ jsxs("span", { className: "aui-code__language", children: [
|
|
281
|
-
/* @__PURE__ */ jsx4(CodeGlyph, {}),
|
|
282
|
-
/* @__PURE__ */ jsx4("span", { children: language.toUpperCase() })
|
|
283
|
-
] }),
|
|
284
|
-
/* @__PURE__ */ jsx4(
|
|
285
|
-
Button,
|
|
286
|
-
{
|
|
287
|
-
isIconOnly: true,
|
|
288
|
-
"aria-label": copied ? "Code copied" : "Copy code",
|
|
289
|
-
className: "aui-code__copy",
|
|
290
|
-
"data-slot": "agent-ui-code-copy",
|
|
291
|
-
size: "sm",
|
|
292
|
-
variant: "ghost",
|
|
293
|
-
onPress: copy,
|
|
294
|
-
children: /* @__PURE__ */ jsxs(
|
|
295
|
-
"span",
|
|
296
|
-
{
|
|
297
|
-
className: "aui-code__copy-swap",
|
|
298
|
-
"data-copied": copied || void 0,
|
|
299
|
-
"data-slot": "agent-ui-code-copy-icon",
|
|
300
|
-
children: [
|
|
301
|
-
/* @__PURE__ */ jsx4("span", { className: "aui-code__copy-icon aui-code__copy-icon--copy", children: /* @__PURE__ */ jsx4(CopyGlyph, {}) }),
|
|
302
|
-
/* @__PURE__ */ jsx4("span", { className: "aui-code__copy-icon aui-code__copy-icon--check", children: /* @__PURE__ */ jsx4(CheckGlyph, {}) })
|
|
303
|
-
]
|
|
304
|
-
}
|
|
305
|
-
)
|
|
306
|
-
}
|
|
307
|
-
)
|
|
308
|
-
] }),
|
|
309
|
-
highlighted?.key === highlightKey ? /* @__PURE__ */ jsx4(
|
|
310
|
-
"div",
|
|
311
|
-
{
|
|
312
|
-
className: "aui-code__content",
|
|
313
|
-
dangerouslySetInnerHTML: { __html: highlighted.html },
|
|
314
|
-
"data-slot": "agent-ui-code"
|
|
315
|
-
}
|
|
316
|
-
) : /* @__PURE__ */ jsx4("div", { className: "aui-code__content", "data-slot": "agent-ui-code", children: /* @__PURE__ */ jsx4("pre", { children: /* @__PURE__ */ jsx4("code", { children: code }) }) })
|
|
317
|
-
] });
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
export {
|
|
321
|
-
ActionButton,
|
|
322
|
-
ScrollShadow,
|
|
323
|
-
renderInlineMarkdown,
|
|
324
|
-
CodeBlock
|
|
325
|
-
};
|