@page-speed/agent-everywhere 0.2.0 → 0.3.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/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,7 +981,32 @@ function MessageBubble({ role, children, className, unstyled }) {
980
981
  }
981
982
  );
982
983
  }
983
- function MessageContent({ children, className }) {
984
+ var PROSE_CLASSES = cn(
985
+ "text-sm leading-relaxed",
986
+ "[&_p]:my-1.5 first:[&_p]:mt-0 last:[&_p]:mb-0",
987
+ "[&_ul]:my-1.5 [&_ul]:list-disc [&_ul]:pl-5",
988
+ "[&_ol]:my-1.5 [&_ol]:list-decimal [&_ol]:pl-5",
989
+ "[&_li]:my-0.5",
990
+ "[&_h1]:mt-2 [&_h1]:mb-1 [&_h1]:text-base [&_h1]:font-semibold",
991
+ "[&_h2]:mt-2 [&_h2]:mb-1 [&_h2]:text-sm [&_h2]:font-semibold",
992
+ "[&_h3]:mt-2 [&_h3]:mb-1 [&_h3]:text-sm [&_h3]:font-semibold",
993
+ "[&_strong]:font-semibold",
994
+ "[&_a]:underline [&_a]:underline-offset-2",
995
+ "[&_code]:rounded [&_code]:bg-black/10 [&_code]:px-1 [&_code]:py-0.5 [&_code]:text-[0.85em]",
996
+ "[&_pre]:my-1.5 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-black/10 [&_pre]:p-2 [&_pre]:text-xs",
997
+ "[&_pre_code]:bg-transparent [&_pre_code]:p-0",
998
+ "[&_blockquote]:border-l-2 [&_blockquote]:border-current/30 [&_blockquote]:pl-3 [&_blockquote]:opacity-90",
999
+ "[&_hr]:my-2 [&_hr]:border-current/20",
1000
+ "whitespace-normal"
1001
+ );
1002
+ function MessageContent({
1003
+ children,
1004
+ className,
1005
+ markdown = true
1006
+ }) {
1007
+ if (markdown && typeof children === "string") {
1008
+ return /* @__PURE__ */ jsx(Markdown, { className: cn(PROSE_CLASSES, className), children });
1009
+ }
984
1010
  return /* @__PURE__ */ jsx("div", { className: cn("text-sm leading-relaxed whitespace-pre-wrap", className), children });
985
1011
  }
986
1012
  function MessageContainer({ role, children, className }) {