@page-speed/agent-everywhere 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +65 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +65 -2
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import * as React4 from 'react';
|
|
|
5
5
|
import { createContext, forwardRef, useRef, useImperativeHandle, useCallback, useLayoutEffect, useState, useEffect, useReducer, useMemo, useContext } from 'react';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import { AnimatePresence, motion } from 'motion/react';
|
|
8
|
+
import { Markdown } from '@page-speed/markdown-to-jsx';
|
|
8
9
|
import { SendIcon, PaperclipIcon, FileTextIcon, MicIcon, ImageIcon, XIcon, SearchIcon, UploadIcon, FileIcon, UserCircleIcon, CheckIcon, SparklesIcon, BookmarkIcon, InfoIcon, CheckCircle2Icon, AlertTriangleIcon, LightbulbIcon, BrainIcon, ChevronDownIcon, ZapIcon, CopyIcon, ThumbsUpIcon, ThumbsDownIcon, BotIcon, UserIcon, DownloadIcon, MinusIcon, TrendingDownIcon, TrendingUpIcon, ChevronUpIcon, ArrowUpDownIcon, LinkIcon, PlayIcon, ExternalLinkIcon, WandIcon, LayoutGridIcon, Grid3X3Icon, ArrowUpRightIcon, ShuffleIcon, SkipForwardIcon, ChevronLeftIcon, ChevronRightIcon, XCircleIcon, HelpCircleIcon, Minimize2Icon, Maximize2Icon, RotateCcwIcon, MessageSquareIcon, GripVerticalIcon, PanelLeftOpenIcon, PanelLeftCloseIcon, CheckCircleIcon, AlertCircleIcon, MoreHorizontalIcon, ArrowLeftIcon, MoreVerticalIcon, Loader2Icon, ArrowRightIcon, AlignLeftIcon, ListIcon, HashIcon, TypeIcon, ClockIcon, CoinsIcon, ActivityIcon, ArrowUpIcon, ArrowDownIcon } from 'lucide-react';
|
|
9
10
|
import { Slot } from '@radix-ui/react-slot';
|
|
10
11
|
import { cva } from 'class-variance-authority';
|
|
@@ -980,8 +981,70 @@ function MessageBubble({ role, children, className, unstyled }) {
|
|
|
980
981
|
}
|
|
981
982
|
);
|
|
982
983
|
}
|
|
983
|
-
|
|
984
|
-
|
|
984
|
+
var SPACE = "0.5rem";
|
|
985
|
+
var mdStyle = { lineHeight: 1.6 };
|
|
986
|
+
var MdP = ({ children }) => /* @__PURE__ */ jsx("p", { style: { margin: `${SPACE} 0` }, children });
|
|
987
|
+
var MdUl = ({ children }) => /* @__PURE__ */ jsx("ul", { style: { margin: `${SPACE} 0`, paddingLeft: "1.25rem", listStyle: "disc" }, children });
|
|
988
|
+
var MdOl = ({ children }) => /* @__PURE__ */ jsx(
|
|
989
|
+
"ol",
|
|
990
|
+
{
|
|
991
|
+
style: { margin: `${SPACE} 0`, paddingLeft: "1.25rem", listStyle: "decimal" },
|
|
992
|
+
children
|
|
993
|
+
}
|
|
994
|
+
);
|
|
995
|
+
var MdLi = ({ children }) => /* @__PURE__ */ jsx("li", { style: { margin: "0.2rem 0" }, children });
|
|
996
|
+
var mkHeading = (level, fontSize) => ({ children }) => {
|
|
997
|
+
const Tag = `h${level}`;
|
|
998
|
+
return /* @__PURE__ */ jsx(Tag, { style: { margin: `${SPACE} 0 0.25rem`, fontSize, fontWeight: 600 }, children });
|
|
999
|
+
};
|
|
1000
|
+
var MdBlockquote = ({ children }) => /* @__PURE__ */ jsx(
|
|
1001
|
+
"blockquote",
|
|
1002
|
+
{
|
|
1003
|
+
style: {
|
|
1004
|
+
margin: `${SPACE} 0`,
|
|
1005
|
+
paddingLeft: "0.75rem",
|
|
1006
|
+
borderLeft: "2px solid currentColor",
|
|
1007
|
+
opacity: 0.85
|
|
1008
|
+
},
|
|
1009
|
+
children
|
|
1010
|
+
}
|
|
1011
|
+
);
|
|
1012
|
+
var MARKDOWN_OVERRIDES = {
|
|
1013
|
+
p: MdP,
|
|
1014
|
+
ul: MdUl,
|
|
1015
|
+
ol: MdOl,
|
|
1016
|
+
li: MdLi,
|
|
1017
|
+
h1: mkHeading(1, "1rem"),
|
|
1018
|
+
h2: mkHeading(2, "0.95rem"),
|
|
1019
|
+
h3: mkHeading(3, "0.9rem"),
|
|
1020
|
+
blockquote: MdBlockquote
|
|
1021
|
+
};
|
|
1022
|
+
function MessageContent({
|
|
1023
|
+
children,
|
|
1024
|
+
className,
|
|
1025
|
+
markdown = true
|
|
1026
|
+
}) {
|
|
1027
|
+
if (markdown && typeof children === "string") {
|
|
1028
|
+
return /* @__PURE__ */ jsx(
|
|
1029
|
+
Markdown,
|
|
1030
|
+
{
|
|
1031
|
+
className: cn(
|
|
1032
|
+
"text-sm [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
1033
|
+
className
|
|
1034
|
+
),
|
|
1035
|
+
overrides: MARKDOWN_OVERRIDES,
|
|
1036
|
+
children
|
|
1037
|
+
}
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
return /* @__PURE__ */ jsx(
|
|
1041
|
+
"div",
|
|
1042
|
+
{
|
|
1043
|
+
className: cn("text-sm leading-relaxed whitespace-pre-wrap", className),
|
|
1044
|
+
style: mdStyle,
|
|
1045
|
+
children
|
|
1046
|
+
}
|
|
1047
|
+
);
|
|
985
1048
|
}
|
|
986
1049
|
function MessageContainer({ role, children, className }) {
|
|
987
1050
|
return /* @__PURE__ */ jsx(
|