@retrivora-ai/rag-engine 1.9.3 → 1.9.6

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.
Files changed (60) hide show
  1. package/README.md +27 -0
  2. package/dist/{ILLMProvider-Bw2A28nU.d.mts → ILLMProvider-DNhyOYoK.d.mts} +41 -1
  3. package/dist/{ILLMProvider-Bw2A28nU.d.ts → ILLMProvider-DNhyOYoK.d.ts} +41 -1
  4. package/dist/handlers/index.d.mts +2 -2
  5. package/dist/handlers/index.d.ts +2 -2
  6. package/dist/handlers/index.js +552 -198
  7. package/dist/handlers/index.mjs +552 -198
  8. package/dist/index-C9v7-tWd.d.mts +183 -0
  9. package/dist/{index-B70ZLkfG.d.mts → index-CHL1jdYm.d.mts} +1 -1
  10. package/dist/index-CjQdL0cX.d.ts +183 -0
  11. package/dist/{index-DVu-mkAM.d.ts → index-Hgbwl9X4.d.ts} +1 -1
  12. package/dist/index.css +40 -0
  13. package/dist/index.d.mts +3 -3
  14. package/dist/index.d.ts +3 -3
  15. package/dist/index.js +326 -158
  16. package/dist/index.mjs +312 -151
  17. package/dist/server.d.mts +15 -94
  18. package/dist/server.d.ts +15 -94
  19. package/dist/server.js +612 -198
  20. package/dist/server.mjs +604 -198
  21. package/package.json +1 -1
  22. package/src/app/api/chat/route.ts +2 -2
  23. package/src/app/api/health/route.ts +3 -2
  24. package/src/app/api/ingest/route.ts +3 -2
  25. package/src/app/api/suggestions/route.ts +3 -2
  26. package/src/app/api/upload/route.ts +3 -2
  27. package/src/app/constants.tsx +85 -30
  28. package/src/app/layout.tsx +18 -7
  29. package/src/components/MessageBubble.tsx +39 -2
  30. package/src/components/ThinkingBlock.tsx +75 -0
  31. package/src/components/VisualizationRenderer.tsx +27 -1
  32. package/src/config/RagConfig.ts +47 -0
  33. package/src/config/serverConfig.ts +25 -0
  34. package/src/core/ConfigResolver.ts +56 -4
  35. package/src/core/ConfigValidator.ts +2 -1
  36. package/src/core/Pipeline.ts +224 -67
  37. package/src/core/ProviderRegistry.ts +11 -2
  38. package/src/core/QueryProcessor.ts +38 -4
  39. package/src/core/Retrivora.ts +51 -0
  40. package/src/exceptions/index.ts +59 -0
  41. package/src/handlers/index.ts +2 -0
  42. package/src/hooks/useRagChat.ts +26 -4
  43. package/src/index.ts +25 -1
  44. package/src/lib/plugin.ts +24 -0
  45. package/src/llm/LLMFactory.ts +4 -1
  46. package/src/llm/providers/AnthropicProvider.ts +70 -20
  47. package/src/llm/providers/GeminiProvider.ts +14 -15
  48. package/src/llm/providers/OllamaProvider.ts +13 -16
  49. package/src/llm/providers/OpenAIProvider.ts +9 -14
  50. package/src/llm/providers/UniversalLLMAdapter.ts +5 -5
  51. package/src/llm/utils.ts +46 -0
  52. package/src/providers/vectordb/MongoDBProvider.ts +9 -4
  53. package/src/providers/vectordb/MultiTablePostgresProvider.ts +45 -13
  54. package/src/rag/EntityExtractor.ts +2 -2
  55. package/src/rag/Reranker.ts +9 -16
  56. package/src/server.ts +27 -1
  57. package/src/types/chat.ts +7 -0
  58. package/src/utils/UITransformer.ts +73 -4
  59. package/dist/DocumentChunker-Dh9TvmGG.d.mts +0 -45
  60. package/dist/DocumentChunker-Dh9TvmGG.d.ts +0 -45
package/dist/index.mjs CHANGED
@@ -34,11 +34,11 @@ var __objRest = (source, exclude) => {
34
34
  import "./index.css";
35
35
 
36
36
  // src/components/ChatWidget.tsx
37
- import { useState as useState6 } from "react";
37
+ import { useState as useState7 } from "react";
38
38
  import { MessageSquare, X as X3 } from "lucide-react";
39
39
 
40
40
  // src/components/ChatWindow.tsx
41
- import { useState as useState5, useRef as useRef4, useEffect as useEffect4, useCallback as useCallback2 } from "react";
41
+ import { useState as useState6, useRef as useRef5, useEffect as useEffect5, useCallback as useCallback2 } from "react";
42
42
  import {
43
43
  Bot as Bot2,
44
44
  Trash2,
@@ -315,8 +315,8 @@ function DocumentUpload({ namespace, onUploadComplete, className = "" }) {
315
315
  }
316
316
 
317
317
  // src/components/MessageBubble.tsx
318
- import React9 from "react";
319
- import { Bot, User, ChevronDown as ChevronDown3, ChevronRight as ChevronRight3, Activity, Copy, Check } from "lucide-react";
318
+ import React10 from "react";
319
+ import { Bot, User, ChevronDown as ChevronDown4, ChevronRight as ChevronRight4, Activity, Copy, Check } from "lucide-react";
320
320
  import ReactMarkdown from "react-markdown";
321
321
 
322
322
  // src/components/SourceCard.tsx
@@ -811,6 +811,7 @@ function renderVisualization(type, data, onAddToCart, primaryColor, isStreaming)
811
811
  return /* @__PURE__ */ jsx7(TableView, { data, isStreaming });
812
812
  case "product_carousel":
813
813
  case "carousel":
814
+ if (isStreaming) return /* @__PURE__ */ jsx7(CarouselSkeleton, {});
814
815
  return /* @__PURE__ */ jsx7(CarouselView, { data, onAddToCart, primaryColor });
815
816
  case "text":
816
817
  default:
@@ -821,6 +822,26 @@ function renderVisualization(type, data, onAddToCart, primaryColor, isStreaming)
821
822
  return /* @__PURE__ */ jsx7(TextView, { data: { content: "Unable to render the requested visualization." } });
822
823
  }
823
824
  }
825
+ function CarouselSkeleton() {
826
+ return /* @__PURE__ */ jsxs6("div", { className: "w-full py-2", children: [
827
+ /* @__PURE__ */ jsx7("div", { className: "mb-3 h-4 w-36 rounded-full bg-slate-200 animate-pulse" }),
828
+ /* @__PURE__ */ jsx7("div", { className: "flex gap-3 overflow-hidden", children: Array.from({ length: 4 }).map((_, i) => /* @__PURE__ */ jsxs6(
829
+ "div",
830
+ {
831
+ className: "flex-shrink-0 w-44 rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden animate-pulse",
832
+ children: [
833
+ /* @__PURE__ */ jsx7("div", { className: "h-28 bg-slate-100" }),
834
+ /* @__PURE__ */ jsxs6("div", { className: "p-3 space-y-2", children: [
835
+ /* @__PURE__ */ jsx7("div", { className: "h-3 w-28 rounded-full bg-slate-200" }),
836
+ /* @__PURE__ */ jsx7("div", { className: "h-3 w-16 rounded-full bg-slate-100" }),
837
+ /* @__PURE__ */ jsx7("div", { className: "h-3 w-20 rounded-full bg-emerald-100" })
838
+ ] })
839
+ ]
840
+ },
841
+ i
842
+ )) })
843
+ ] });
844
+ }
824
845
  function ChartSkeleton({ type }) {
825
846
  if (type === "pie") {
826
847
  return /* @__PURE__ */ jsx7("div", { className: "w-full mt-4 mb-2 animate-pulse", children: /* @__PURE__ */ jsx7("div", { className: "mx-auto w-40 h-40 rounded-full bg-slate-100 dark:bg-white/10" }) });
@@ -2222,8 +2243,54 @@ function normaliseChild(children) {
2222
2243
  return children;
2223
2244
  }
2224
2245
 
2225
- // src/components/MessageBubble.tsx
2246
+ // src/components/ThinkingBlock.tsx
2247
+ import { useState as useState3, useEffect as useEffect2, useRef as useRef3 } from "react";
2248
+ import { Brain, ChevronDown as ChevronDown3, ChevronRight as ChevronRight3, Loader2 as Loader22 } from "lucide-react";
2226
2249
  import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
2250
+ function ThinkingBlock({ thinking, thinkingMs, isStreaming = false }) {
2251
+ const [isExpanded, setIsExpanded] = useState3(true);
2252
+ const containerRef = useRef3(null);
2253
+ useEffect2(() => {
2254
+ if (!isStreaming) {
2255
+ setIsExpanded(false);
2256
+ } else {
2257
+ setIsExpanded(true);
2258
+ }
2259
+ }, [isStreaming]);
2260
+ useEffect2(() => {
2261
+ if (isStreaming && isExpanded && containerRef.current) {
2262
+ containerRef.current.scrollTop = containerRef.current.scrollHeight;
2263
+ }
2264
+ }, [thinking, isStreaming, isExpanded]);
2265
+ const durationSec = thinkingMs ? (thinkingMs / 1e3).toFixed(1) : null;
2266
+ return /* @__PURE__ */ jsxs11("div", { className: "w-full max-w-2xl my-1.5 border border-slate-200 dark:border-white/10 rounded-xl bg-slate-50/50 dark:bg-white/5 overflow-hidden transition-all duration-200", children: [
2267
+ /* @__PURE__ */ jsxs11(
2268
+ "button",
2269
+ {
2270
+ onClick: () => setIsExpanded(!isExpanded),
2271
+ className: "w-full px-4 py-2.5 flex items-center justify-between text-xs font-medium text-slate-500 dark:text-white/40 hover:bg-slate-100 dark:hover:bg-white/10 transition-colors cursor-pointer select-none",
2272
+ children: [
2273
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
2274
+ isStreaming ? /* @__PURE__ */ jsx12(Loader22, { className: "w-3.5 h-3.5 animate-spin text-slate-400 dark:text-white/30" }) : /* @__PURE__ */ jsx12(Brain, { className: "w-3.5 h-3.5 text-slate-400 dark:text-white/40" }),
2275
+ /* @__PURE__ */ jsx12("span", { children: isStreaming ? "Thinking..." : durationSec ? `Thought for ${durationSec}s` : "Thinking process" })
2276
+ ] }),
2277
+ /* @__PURE__ */ jsx12("div", { children: isExpanded ? /* @__PURE__ */ jsx12(ChevronDown3, { className: "w-3.5 h-3.5 text-slate-400 dark:text-white/30" }) : /* @__PURE__ */ jsx12(ChevronRight3, { className: "w-3.5 h-3.5 text-slate-400 dark:text-white/30" }) })
2278
+ ]
2279
+ }
2280
+ ),
2281
+ isExpanded && /* @__PURE__ */ jsx12(
2282
+ "div",
2283
+ {
2284
+ ref: containerRef,
2285
+ className: "px-4 pb-3 pt-1 border-t border-slate-200 dark:border-white/10 text-xs font-mono leading-relaxed text-slate-600 dark:text-white/60 bg-slate-50/20 dark:bg-transparent max-h-60 overflow-y-auto whitespace-pre-wrap select-text break-words",
2286
+ children: thinking
2287
+ }
2288
+ )
2289
+ ] });
2290
+ }
2291
+
2292
+ // src/components/MessageBubble.tsx
2293
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
2227
2294
  function normalizePlusSeparatedLists(raw) {
2228
2295
  return raw.split("\n").map((line) => {
2229
2296
  const productListLine = /[—:]\s*\d+\s+\+\s+[A-Za-z]/.test(line) || /\b(products?|categories?|in stock|out of stock)\b/i.test(line);
@@ -2247,10 +2314,10 @@ function MessageBubble({
2247
2314
  const isUser = message.role === "user";
2248
2315
  const isCompact = viewportSize === "compact";
2249
2316
  const isMedium = viewportSize === "medium";
2250
- const [showSources, setShowSources] = React9.useState(false);
2251
- const [showTrace, setShowTrace] = React9.useState(false);
2252
- const [copied, setCopied] = React9.useState(false);
2253
- const handleCopy = React9.useCallback(async () => {
2317
+ const [showSources, setShowSources] = React10.useState(false);
2318
+ const [showTrace, setShowTrace] = React10.useState(false);
2319
+ const [copied, setCopied] = React10.useState(false);
2320
+ const handleCopy = React10.useCallback(async () => {
2254
2321
  try {
2255
2322
  await navigator.clipboard.writeText(message.content);
2256
2323
  setCopied(true);
@@ -2259,11 +2326,11 @@ function MessageBubble({
2259
2326
  console.error("Failed to copy text:", err);
2260
2327
  }
2261
2328
  }, [message.content]);
2262
- const structuredContent = React9.useMemo(
2329
+ const structuredContent = React10.useMemo(
2263
2330
  () => isUser ? { payload: null, text: message.content } : extractStructuredPayload(message.content),
2264
2331
  [isUser, message.content]
2265
2332
  );
2266
- const hasRichUI = React9.useMemo(() => {
2333
+ const hasRichUI = React10.useMemo(() => {
2267
2334
  if (message.uiTransformation) {
2268
2335
  const type = message.uiTransformation.type;
2269
2336
  if (type && !["text", "table"].includes(type)) return true;
@@ -2278,10 +2345,10 @@ function MessageBubble({
2278
2345
  uiTransformationType && !["text", "product_carousel", "carousel"].includes(uiTransformationType)
2279
2346
  );
2280
2347
  const shouldRenderStructuredOnly = !isUser && hasRichUI && isLikelyUiOnlyMessage(structuredContent.text);
2281
- const productsFromSources = React9.useMemo(() => {
2348
+ const productsFromSources = React10.useMemo(() => {
2282
2349
  return extractProductsFromSources(sources, isUser);
2283
2350
  }, [sources, isUser]);
2284
- const { productsFromContent, cleanContent } = React9.useMemo(() => {
2351
+ const { productsFromContent, cleanContent } = React10.useMemo(() => {
2285
2352
  if (isUser) {
2286
2353
  return { productsFromContent: [], cleanContent: message.content };
2287
2354
  }
@@ -2297,10 +2364,10 @@ function MessageBubble({
2297
2364
  isStreaming
2298
2365
  );
2299
2366
  }, [message.content, isUser, structuredContent, productsFromSources, isStreaming]);
2300
- const allProducts = React9.useMemo(() => {
2367
+ const allProducts = React10.useMemo(() => {
2301
2368
  return deduplicateProducts(productsFromSources, productsFromContent, message.content);
2302
2369
  }, [productsFromSources, productsFromContent, message.content]);
2303
- const processedMarkdown = React9.useMemo(() => {
2370
+ const processedMarkdown = React10.useMemo(() => {
2304
2371
  let raw = structuredContent.payload ? structuredContent.text : cleanContent || message.content;
2305
2372
  raw = raw.replace(/\$\s*(\d+)(?!\.\d)/g, "$1");
2306
2373
  raw = normalizePlusSeparatedLists(raw);
@@ -2331,41 +2398,49 @@ ${match.trim()}
2331
2398
  }
2332
2399
  return raw;
2333
2400
  }, [cleanContent, message.content, isStreaming, structuredContent]);
2334
- const markdownComponents = React9.useMemo(
2401
+ const markdownComponents = React10.useMemo(
2335
2402
  () => createMarkdownComponents({ primaryColor, accentColor, isStreaming, onAddToCart, viewportSize }),
2336
2403
  [primaryColor, accentColor, isStreaming, onAddToCart, viewportSize]
2337
2404
  );
2338
- return /* @__PURE__ */ jsxs11("div", { className: `flex ${isCompact ? "gap-2" : "gap-3"} ${isUser ? "flex-row-reverse" : "flex-row"} items-start`, children: [
2339
- /* @__PURE__ */ jsx12(
2405
+ return /* @__PURE__ */ jsxs12("div", { className: `flex ${isCompact ? "gap-2" : "gap-3"} ${isUser ? "flex-row-reverse" : "flex-row"} items-start`, children: [
2406
+ /* @__PURE__ */ jsx13(
2340
2407
  "div",
2341
2408
  {
2342
2409
  className: `flex-shrink-0 ${isCompact ? "w-7 h-7" : "w-8 h-8"} rounded-full flex items-center justify-center shadow-lg ${isUser ? "text-white" : "bg-slate-100 dark:bg-white/10 text-slate-700 dark:text-white/80"}`,
2343
2410
  style: isUser ? { background: `linear-gradient(135deg, ${primaryColor}, ${accentColor})` } : {},
2344
- children: isUser ? /* @__PURE__ */ jsx12(User, { className: `${isCompact ? "w-3.5 h-3.5" : "w-4 h-4"} text-white` }) : /* @__PURE__ */ jsx12(Bot, { className: `${isCompact ? "w-3.5 h-3.5" : "w-4 h-4"}` })
2411
+ children: isUser ? /* @__PURE__ */ jsx13(User, { className: `${isCompact ? "w-3.5 h-3.5" : "w-4 h-4"} text-white` }) : /* @__PURE__ */ jsx13(Bot, { className: `${isCompact ? "w-3.5 h-3.5" : "w-4 h-4"}` })
2345
2412
  }
2346
2413
  ),
2347
- /* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-1 min-w-0 ${isCompact ? "max-w-[94%]" : isMedium ? "max-w-[92%]" : "max-w-[90%]"} ${isUser ? "items-end" : "items-start"}`, children: [
2348
- /* @__PURE__ */ jsxs11(
2414
+ /* @__PURE__ */ jsxs12("div", { className: `flex flex-col gap-1 min-w-0 ${isCompact ? "max-w-[94%]" : isMedium ? "max-w-[92%]" : "max-w-[90%]"} ${isUser ? "items-end" : "items-start"}`, children: [
2415
+ !isUser && message.thinking && /* @__PURE__ */ jsx13(
2416
+ ThinkingBlock,
2417
+ {
2418
+ thinking: message.thinking,
2419
+ thinkingMs: message.thinkingMs,
2420
+ isStreaming: isStreaming && !message.content
2421
+ }
2422
+ ),
2423
+ /* @__PURE__ */ jsxs12(
2349
2424
  "div",
2350
2425
  {
2351
2426
  className: `relative group ${isCompact ? "px-3 py-2.5 text-[13px]" : "px-4 py-3 text-sm"} rounded-2xl leading-relaxed shadow-sm dark:shadow-lg ${isUser ? "text-white rounded-tr-sm" : "bg-white dark:bg-white/5 border border-slate-200 dark:border-white/10 text-slate-800 dark:text-white/90 rounded-tl-sm"}`,
2352
2427
  style: isUser ? { background: `linear-gradient(135deg, ${primaryColor}, ${accentColor})` } : {},
2353
2428
  children: [
2354
- !isUser && !isStreaming && message.content && /* @__PURE__ */ jsx12(
2429
+ !isUser && !isStreaming && message.content && /* @__PURE__ */ jsx13(
2355
2430
  "button",
2356
2431
  {
2357
2432
  onClick: handleCopy,
2358
2433
  className: `absolute top-2 right-2 p-1.5 rounded-lg border transition-all duration-200 cursor-pointer ${copied ? "bg-emerald-500/10 border-emerald-500/20 text-emerald-500 dark:text-emerald-400" : "bg-slate-500/5 hover:bg-slate-500/10 border-slate-200 dark:border-white/10 text-slate-400 dark:text-white/30 hover:text-slate-600 dark:hover:text-white/60"} opacity-0 group-hover:opacity-100 backdrop-blur-sm shadow-sm scale-95 group-hover:scale-100`,
2359
2434
  title: copied ? "Copied!" : "Copy response",
2360
- children: copied ? /* @__PURE__ */ jsx12(Check, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ jsx12(Copy, { className: "w-3.5 h-3.5" })
2435
+ children: copied ? /* @__PURE__ */ jsx13(Check, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ jsx13(Copy, { className: "w-3.5 h-3.5" })
2361
2436
  }
2362
2437
  ),
2363
- isStreaming && !message.content ? /* @__PURE__ */ jsxs11("span", { className: "flex items-center gap-1 py-1", children: [
2364
- /* @__PURE__ */ jsx12("span", { className: "w-1.5 h-1.5 rounded-full bg-slate-400 dark:bg-white/60 animate-bounce [animation-delay:0ms]" }),
2365
- /* @__PURE__ */ jsx12("span", { className: "w-1.5 h-1.5 rounded-full bg-slate-400 dark:bg-white/60 animate-bounce [animation-delay:150ms]" }),
2366
- /* @__PURE__ */ jsx12("span", { className: "w-1.5 h-1.5 rounded-full bg-slate-400 dark:bg-white/60 animate-bounce [animation-delay:300ms]" })
2367
- ] }) : /* @__PURE__ */ jsxs11("div", { className: `prose ${isCompact ? "prose-xs" : "prose-sm"} max-w-none break-words ${isUser ? "prose-invert" : "dark:prose-invert"}`, children: [
2368
- !isUser && structuredContent.payload && /* @__PURE__ */ jsx12(
2438
+ isStreaming && !message.content ? /* @__PURE__ */ jsxs12("span", { className: "flex items-center gap-1 py-1", children: [
2439
+ /* @__PURE__ */ jsx13("span", { className: "w-1.5 h-1.5 rounded-full bg-slate-400 dark:bg-white/60 animate-bounce [animation-delay:0ms]" }),
2440
+ /* @__PURE__ */ jsx13("span", { className: "w-1.5 h-1.5 rounded-full bg-slate-400 dark:bg-white/60 animate-bounce [animation-delay:150ms]" }),
2441
+ /* @__PURE__ */ jsx13("span", { className: "w-1.5 h-1.5 rounded-full bg-slate-400 dark:bg-white/60 animate-bounce [animation-delay:300ms]" })
2442
+ ] }) : /* @__PURE__ */ jsxs12("div", { className: `prose ${isCompact ? "prose-xs" : "prose-sm"} max-w-none break-words ${isUser ? "prose-invert" : "dark:prose-invert"}`, children: [
2443
+ !isUser && structuredContent.payload && /* @__PURE__ */ jsx13(
2369
2444
  UIDispatcher,
2370
2445
  {
2371
2446
  rawContent: structuredContent.payload,
@@ -2376,9 +2451,9 @@ ${match.trim()}
2376
2451
  viewportSize
2377
2452
  }
2378
2453
  ),
2379
- !shouldRenderStructuredOnly && /* @__PURE__ */ jsx12(ReactMarkdown, { components: markdownComponents, children: processedMarkdown }),
2380
- isStreaming && /* @__PURE__ */ jsxs11("span", { className: "inline-flex items-center gap-1.5 ml-2 text-emerald-500 animate-pulse align-middle text-xs font-medium", children: [
2381
- /* @__PURE__ */ jsx12(
2454
+ !shouldRenderStructuredOnly && /* @__PURE__ */ jsx13(ReactMarkdown, { components: markdownComponents, children: processedMarkdown }),
2455
+ isStreaming && /* @__PURE__ */ jsxs12("span", { className: "inline-flex items-center gap-1.5 ml-2 text-emerald-500 animate-pulse align-middle text-xs font-medium", children: [
2456
+ /* @__PURE__ */ jsx13(
2382
2457
  HourglassLoader_default,
2383
2458
  {
2384
2459
  size: 18,
@@ -2395,13 +2470,33 @@ ${match.trim()}
2395
2470
  ),
2396
2471
  (() => {
2397
2472
  var _a2, _b;
2398
- if (isUser || structuredContent.payload || !message.uiTransformation) return null;
2473
+ if (isUser || structuredContent.payload) return null;
2474
+ if (isStreaming && !message.uiTransformation && sources && sources.length > 0) {
2475
+ const hasProductSource = sources.some(
2476
+ (s) => s.metadata && Object.keys(s.metadata).some(
2477
+ (k) => ["name", "title", "price", "brand", "image", "product", "sku", "category"].includes(k.toLowerCase())
2478
+ )
2479
+ );
2480
+ if (hasProductSource) {
2481
+ return /* @__PURE__ */ jsx13("div", { className: "w-full mt-3", children: /* @__PURE__ */ jsx13(
2482
+ VisualizationRenderer,
2483
+ {
2484
+ data: { type: "product_carousel", title: "Recommended Products", description: "Loading...", data: [] },
2485
+ primaryColor,
2486
+ onAddToCart,
2487
+ className: "rounded-3xl border border-slate-200/60 dark:border-white/10 bg-white/90 dark:bg-slate-900/80 p-4",
2488
+ isStreaming: true
2489
+ }
2490
+ ) });
2491
+ }
2492
+ }
2493
+ if (!message.uiTransformation) return null;
2399
2494
  const ui = message.uiTransformation;
2400
2495
  const textContent = (_b = (_a2 = ui.data) == null ? void 0 : _a2.content) != null ? _b : "";
2401
2496
  const isNegativeOrFallbackText = textContent.toLowerCase().includes("cannot answer") || textContent.toLowerCase().includes("no relevant data") || textContent.toLowerCase().includes("no data available") || typeof ui.title === "string" && ui.title.toLowerCase().includes("no data") || typeof ui.description === "string" && ui.description.toLowerCase().includes("no relevant data");
2402
2497
  const shouldShow = !isNegativeOrFallbackText && (ui.type === "table" || !["text", "table"].includes(ui.type) || ui.type === "text" && !hasRichUI && allProducts.length === 0 && textContent && !processedMarkdown.toLowerCase().includes(textContent.trim().toLowerCase()));
2403
2498
  if (!shouldShow) return null;
2404
- return /* @__PURE__ */ jsx12("div", { className: "w-full mt-3", children: /* @__PURE__ */ jsx12(
2499
+ return /* @__PURE__ */ jsx13("div", { className: "w-full mt-3", children: /* @__PURE__ */ jsx13(
2405
2500
  VisualizationRenderer,
2406
2501
  {
2407
2502
  data: ui,
@@ -2412,7 +2507,7 @@ ${match.trim()}
2412
2507
  }
2413
2508
  ) });
2414
2509
  })(),
2415
- !isUser && !hasRichUI && !shouldSuppressProductCarousel && allProducts.length > 0 && /* @__PURE__ */ jsx12("div", { className: "w-full mt-1", children: /* @__PURE__ */ jsx12(
2510
+ !isUser && !hasRichUI && !shouldSuppressProductCarousel && allProducts.length > 0 && /* @__PURE__ */ jsx13("div", { className: "w-full mt-1", children: /* @__PURE__ */ jsx13(
2416
2511
  ProductCarousel,
2417
2512
  {
2418
2513
  products: allProducts,
@@ -2420,14 +2515,14 @@ ${match.trim()}
2420
2515
  onAddToCart
2421
2516
  }
2422
2517
  ) }),
2423
- !isUser && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-4 mt-1 w-full flex-wrap", children: [
2424
- sources && sources.length > 0 && /* @__PURE__ */ jsxs11(
2518
+ !isUser && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-4 mt-1 w-full flex-wrap", children: [
2519
+ sources && sources.length > 0 && /* @__PURE__ */ jsxs12(
2425
2520
  "button",
2426
2521
  {
2427
2522
  onClick: () => setShowSources((s) => !s),
2428
2523
  className: "text-[11px] text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-1",
2429
2524
  children: [
2430
- showSources ? /* @__PURE__ */ jsx12(ChevronDown3, { className: "w-3 h-3" }) : /* @__PURE__ */ jsx12(ChevronRight3, { className: "w-3 h-3" }),
2525
+ showSources ? /* @__PURE__ */ jsx13(ChevronDown4, { className: "w-3 h-3" }) : /* @__PURE__ */ jsx13(ChevronRight4, { className: "w-3 h-3" }),
2431
2526
  sources.length,
2432
2527
  " source",
2433
2528
  sources.length !== 1 ? "s" : "",
@@ -2435,31 +2530,31 @@ ${match.trim()}
2435
2530
  ]
2436
2531
  }
2437
2532
  ),
2438
- message.trace && /* @__PURE__ */ jsxs11(
2533
+ message.trace && /* @__PURE__ */ jsxs12(
2439
2534
  "button",
2440
2535
  {
2441
2536
  onClick: () => setShowTrace((t) => !t),
2442
2537
  className: "text-[11px] text-emerald-500 hover:text-emerald-400 transition-colors flex items-center gap-1",
2443
2538
  children: [
2444
- /* @__PURE__ */ jsx12(Activity, { className: "w-3 h-3" }),
2539
+ /* @__PURE__ */ jsx13(Activity, { className: "w-3 h-3" }),
2445
2540
  showTrace ? "Hide Trace" : "Trace"
2446
2541
  ]
2447
2542
  }
2448
2543
  )
2449
2544
  ] }),
2450
- /* @__PURE__ */ jsxs11("div", { className: "w-full flex flex-col gap-2 min-w-0", children: [
2451
- showSources && sources && sources.length > 0 && /* @__PURE__ */ jsx12("div", { className: "mt-1 flex flex-col gap-2", children: sources.map((src, i) => /* @__PURE__ */ jsx12(SourceCard, { source: src, index: i }, src.id)) }),
2452
- showTrace && message.trace && /* @__PURE__ */ jsx12(ObservabilityPanel, { trace: message.trace, primaryColor })
2545
+ /* @__PURE__ */ jsxs12("div", { className: "w-full flex flex-col gap-2 min-w-0", children: [
2546
+ showSources && sources && sources.length > 0 && /* @__PURE__ */ jsx13("div", { className: "mt-1 flex flex-col gap-2", children: sources.map((src, i) => /* @__PURE__ */ jsx13(SourceCard, { source: src, index: i }, src.id)) }),
2547
+ showTrace && message.trace && /* @__PURE__ */ jsx13(ObservabilityPanel, { trace: message.trace, primaryColor })
2453
2548
  ] })
2454
2549
  ] })
2455
2550
  ] });
2456
2551
  }
2457
2552
 
2458
2553
  // src/hooks/useRagChat.ts
2459
- import { useState as useState4, useCallback, useRef as useRef3, useEffect as useEffect3 } from "react";
2554
+ import { useState as useState5, useCallback, useRef as useRef4, useEffect as useEffect4 } from "react";
2460
2555
 
2461
2556
  // src/hooks/useStoredMessages.ts
2462
- import * as React10 from "react";
2557
+ import * as React11 from "react";
2463
2558
  function readStoredMessages(storageKey) {
2464
2559
  if (typeof window === "undefined") {
2465
2560
  return [];
@@ -2476,8 +2571,8 @@ function readStoredMessages(storageKey) {
2476
2571
  }
2477
2572
  }
2478
2573
  function useStoredMessages(storageKey, persist) {
2479
- const [messages, setMessages] = React10.useState(() => persist ? readStoredMessages(storageKey) : []);
2480
- React10.useEffect(() => {
2574
+ const [messages, setMessages] = React11.useState(() => persist ? readStoredMessages(storageKey) : []);
2575
+ React11.useEffect(() => {
2481
2576
  if (!persist || typeof window === "undefined") {
2482
2577
  return;
2483
2578
  }
@@ -2517,12 +2612,12 @@ function useRagChat(projectId, options = {}) {
2517
2612
  } = options;
2518
2613
  const storageKey = `rag_chat_${projectId}`;
2519
2614
  const [messages, setMessages] = useStoredMessages(storageKey, persist);
2520
- const [isLoading, setIsLoading] = useState4(false);
2521
- const [error, setError] = useState4(null);
2522
- const lastInputRef = useRef3("");
2523
- const messagesRef = useRef3(messages);
2524
- const abortControllerRef = useRef3(null);
2525
- useEffect3(() => {
2615
+ const [isLoading, setIsLoading] = useState5(false);
2616
+ const [error, setError] = useState5(null);
2617
+ const lastInputRef = useRef4("");
2618
+ const messagesRef = useRef4(messages);
2619
+ const abortControllerRef = useRef4(null);
2620
+ useEffect4(() => {
2526
2621
  messagesRef.current = messages;
2527
2622
  }, [messages]);
2528
2623
  const sendMessage = useCallback(
@@ -2569,18 +2664,25 @@ function useRagChat(projectId, options = {}) {
2569
2664
  const reader = response.body.getReader();
2570
2665
  const decoder = new TextDecoder();
2571
2666
  let assistantContent = "";
2667
+ let thinkingContent = "";
2668
+ let thinkingMs;
2572
2669
  let sources = [];
2573
2670
  let uiTransformation = null;
2574
2671
  let trace;
2575
2672
  let buffer = "";
2576
2673
  let pendingFlush = false;
2577
2674
  const pendingContentRef = { current: "" };
2675
+ const pendingThinkingRef = { current: "" };
2578
2676
  const flushTextUpdate = (msgId) => {
2579
2677
  pendingFlush = false;
2580
2678
  const snapshot = pendingContentRef.current;
2679
+ const thinkingSnapshot = pendingThinkingRef.current;
2581
2680
  setMessages(
2582
2681
  (prev) => prev.map(
2583
- (msg) => msg.id === msgId ? __spreadProps(__spreadValues({}, msg), { content: snapshot }) : msg
2682
+ (msg) => msg.id === msgId ? __spreadProps(__spreadValues({}, msg), {
2683
+ content: snapshot,
2684
+ thinking: thinkingSnapshot || void 0
2685
+ }) : msg
2584
2686
  )
2585
2687
  );
2586
2688
  };
@@ -2614,8 +2716,13 @@ function useRagChat(projectId, options = {}) {
2614
2716
  assistantContent += frame.text;
2615
2717
  pendingContentRef.current = assistantContent;
2616
2718
  scheduleFlush(assistantMessageId);
2719
+ } else if (frame.type === "thinking" && frame.text) {
2720
+ thinkingContent += frame.text;
2721
+ pendingThinkingRef.current = thinkingContent;
2722
+ scheduleFlush(assistantMessageId);
2617
2723
  } else if (frame.type === "metadata") {
2618
2724
  sources = (_a = frame.sources) != null ? _a : [];
2725
+ thinkingMs = frame.thinkingMs;
2619
2726
  hasNonTextFrame = true;
2620
2727
  } else if (frame.type === "ui_transformation") {
2621
2728
  uiTransformation = frame.data;
@@ -2633,6 +2740,8 @@ function useRagChat(projectId, options = {}) {
2633
2740
  (prev) => prev.map(
2634
2741
  (msg) => msg.id === assistantMessageId ? __spreadProps(__spreadValues({}, msg), {
2635
2742
  content: assistantContent,
2743
+ thinking: thinkingContent || void 0,
2744
+ thinkingMs,
2636
2745
  sources: sources.length > 0 ? sources : msg.sources,
2637
2746
  uiTransformation: uiTransformation || msg.uiTransformation
2638
2747
  }) : msg
@@ -2643,8 +2752,11 @@ function useRagChat(projectId, options = {}) {
2643
2752
  if (buffer.trim()) {
2644
2753
  for (const frame of parseSseChunk(buffer)) {
2645
2754
  if (frame.type === "text" && frame.text) assistantContent += frame.text;
2646
- else if (frame.type === "metadata") sources = (_b = frame.sources) != null ? _b : [];
2647
- else if (frame.type === "observability") trace = frame.data;
2755
+ else if (frame.type === "thinking" && frame.text) thinkingContent += frame.text;
2756
+ else if (frame.type === "metadata") {
2757
+ sources = (_b = frame.sources) != null ? _b : [];
2758
+ thinkingMs = frame.thinkingMs;
2759
+ } else if (frame.type === "observability") trace = frame.data;
2648
2760
  }
2649
2761
  }
2650
2762
  const finalMsg = {
@@ -2654,6 +2766,8 @@ function useRagChat(projectId, options = {}) {
2654
2766
  sources: sources.length > 0 ? sources : void 0,
2655
2767
  uiTransformation: uiTransformation != null ? uiTransformation : void 0,
2656
2768
  trace,
2769
+ thinking: thinkingContent || void 0,
2770
+ thinkingMs,
2657
2771
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
2658
2772
  };
2659
2773
  setMessages(
@@ -2708,7 +2822,7 @@ function useRagChat(projectId, options = {}) {
2708
2822
  }
2709
2823
 
2710
2824
  // src/components/ChatWindow.tsx
2711
- import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
2825
+ import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
2712
2826
  function ChatWindow({
2713
2827
  className = "",
2714
2828
  style,
@@ -2723,21 +2837,21 @@ function ChatWindow({
2723
2837
  }) {
2724
2838
  var _a;
2725
2839
  const { ui, projectId } = useConfig();
2726
- const [input, setInput] = useState5("");
2727
- const [mounted, setMounted] = useState5(false);
2728
- const [viewportSize, setViewportSize] = useState5("large");
2729
- const windowRef = useRef4(null);
2730
- const bottomRef = useRef4(null);
2731
- const inputRef = useRef4(null);
2840
+ const [input, setInput] = useState6("");
2841
+ const [mounted, setMounted] = useState6(false);
2842
+ const [viewportSize, setViewportSize] = useState6("large");
2843
+ const windowRef = useRef5(null);
2844
+ const bottomRef = useRef5(null);
2845
+ const inputRef = useRef5(null);
2732
2846
  const { messages, send, clear, isLoading, error, stop } = useRagChat(projectId, {
2733
2847
  namespace: projectId
2734
2848
  });
2735
- const [suggestions, setSuggestions] = useState5([]);
2736
- const [isSuggesting, setIsSuggesting] = useState5(false);
2737
- const [isListening, setIsListening] = useState5(false);
2738
- const [isUploadModalOpen, setIsUploadModalOpen] = useState5(false);
2739
- const recognitionRef = useRef4(null);
2740
- useEffect4(() => {
2849
+ const [suggestions, setSuggestions] = useState6([]);
2850
+ const [isSuggesting, setIsSuggesting] = useState6(false);
2851
+ const [isListening, setIsListening] = useState6(false);
2852
+ const [isUploadModalOpen, setIsUploadModalOpen] = useState6(false);
2853
+ const recognitionRef = useRef5(null);
2854
+ useEffect5(() => {
2741
2855
  if (typeof window !== "undefined") {
2742
2856
  const win = window;
2743
2857
  const SpeechRecognition = win.SpeechRecognition || win.webkitSpeechRecognition;
@@ -2783,10 +2897,10 @@ function ChatWindow({
2783
2897
  }
2784
2898
  }
2785
2899
  };
2786
- useEffect4(() => {
2900
+ useEffect5(() => {
2787
2901
  setMounted(true);
2788
2902
  }, []);
2789
- useEffect4(() => {
2903
+ useEffect5(() => {
2790
2904
  const element = windowRef.current;
2791
2905
  if (!element || typeof ResizeObserver === "undefined") return;
2792
2906
  const resolveViewportSize = (width) => {
@@ -2802,7 +2916,7 @@ function ChatWindow({
2802
2916
  observer.observe(element);
2803
2917
  return () => observer.disconnect();
2804
2918
  }, []);
2805
- useEffect4(() => {
2919
+ useEffect5(() => {
2806
2920
  var _a2;
2807
2921
  if (messages.length > 0 || isLoading) {
2808
2922
  (_a2 = bottomRef.current) == null ? void 0 : _a2.scrollIntoView({ behavior: "smooth" });
@@ -2838,7 +2952,7 @@ function ChatWindow({
2838
2952
  const isEmpty = messages.length === 0;
2839
2953
  const currentRadius = BORDER_RADIUS_MAP[ui.borderRadius || "xl"];
2840
2954
  const isGlass = ui.visualStyle !== "solid";
2841
- useEffect4(() => {
2955
+ useEffect5(() => {
2842
2956
  if (input.trim().length < 3) {
2843
2957
  return;
2844
2958
  }
@@ -2862,85 +2976,85 @@ function ChatWindow({
2862
2976
  }, 800);
2863
2977
  return () => clearTimeout(timer);
2864
2978
  }, [input, projectId]);
2865
- return /* @__PURE__ */ jsxs12(
2979
+ return /* @__PURE__ */ jsxs13(
2866
2980
  "div",
2867
2981
  {
2868
2982
  ref: windowRef,
2869
2983
  className: `relative flex flex-col border border-slate-200 dark:border-white/10 shadow-2xl transition-all duration-300 ${currentRadius} ${isGlass ? "bg-white/90 dark:bg-[#0f0f1a]/90 backdrop-blur-xl" : "bg-white dark:bg-[#0f0f1a]"} ${className}`,
2870
2984
  style: __spreadValues({ "--primary": ui.primaryColor, "--accent": ui.accentColor }, style),
2871
2985
  children: [
2872
- onResizeStart && /* @__PURE__ */ jsx13(
2986
+ onResizeStart && /* @__PURE__ */ jsx14(
2873
2987
  "div",
2874
2988
  {
2875
2989
  onMouseDown: onResizeStart,
2876
2990
  className: "absolute top-0 left-0 w-6 h-6 cursor-nw-resize z-[100] group flex items-start justify-start p-1",
2877
2991
  title: "Drag to resize",
2878
- children: /* @__PURE__ */ jsx13("div", { className: "w-2.5 h-2.5 border-t-2 border-l-2 border-slate-300 dark:border-white/20 group-hover:border-slate-500 dark:group-hover:border-white/50 transition-colors rounded-tl-[2px]" })
2992
+ children: /* @__PURE__ */ jsx14("div", { className: "w-2.5 h-2.5 border-t-2 border-l-2 border-slate-300 dark:border-white/20 group-hover:border-slate-500 dark:group-hover:border-white/50 transition-colors rounded-tl-[2px]" })
2879
2993
  }
2880
2994
  ),
2881
- /* @__PURE__ */ jsxs12(
2995
+ /* @__PURE__ */ jsxs13(
2882
2996
  "div",
2883
2997
  {
2884
2998
  className: "flex items-center justify-between px-5 py-4 border-b border-slate-200 dark:border-white/10",
2885
2999
  style: { background: `linear-gradient(135deg, ${ui.primaryColor}15, ${ui.accentColor}10)` },
2886
3000
  children: [
2887
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3", children: [
3001
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
2888
3002
  ui.logoUrl ? (
2889
3003
  // eslint-disable-next-line @next/next/no-img-element
2890
- /* @__PURE__ */ jsx13("img", { src: ui.logoUrl, alt: "logo", className: "w-8 h-8 rounded-lg object-cover" })
2891
- ) : /* @__PURE__ */ jsx13(
3004
+ /* @__PURE__ */ jsx14("img", { src: ui.logoUrl, alt: "logo", className: "w-8 h-8 rounded-lg object-cover" })
3005
+ ) : /* @__PURE__ */ jsx14(
2892
3006
  "div",
2893
3007
  {
2894
3008
  className: `w-9 h-9 flex items-center justify-center shadow-md ${ui.borderRadius === "full" ? "rounded-full" : "rounded-xl"}`,
2895
3009
  style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` },
2896
- children: /* @__PURE__ */ jsx13(Bot2, { className: "w-5 h-5 text-white" })
3010
+ children: /* @__PURE__ */ jsx14(Bot2, { className: "w-5 h-5 text-white" })
2897
3011
  }
2898
3012
  ),
2899
- /* @__PURE__ */ jsxs12("div", { children: [
2900
- /* @__PURE__ */ jsx13("h2", { className: "text-slate-900 dark:text-white font-semibold text-sm leading-tight", children: ui.title }),
2901
- ui.poweredBy && /* @__PURE__ */ jsx13("p", { className: "text-slate-500 dark:text-white/40 text-[11px] leading-tight", children: `Powered by ${ui.poweredBy}` })
3013
+ /* @__PURE__ */ jsxs13("div", { children: [
3014
+ /* @__PURE__ */ jsx14("h2", { className: "text-slate-900 dark:text-white font-semibold text-sm leading-tight", children: ui.title }),
3015
+ ui.poweredBy && /* @__PURE__ */ jsx14("p", { className: "text-slate-500 dark:text-white/40 text-[11px] leading-tight", children: `Powered by ${ui.poweredBy}` })
2902
3016
  ] })
2903
3017
  ] }),
2904
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5", children: [
2905
- /* @__PURE__ */ jsxs12("span", { className: "flex items-center gap-1 text-[10px] text-emerald-500 dark:text-emerald-400 mr-2", children: [
2906
- /* @__PURE__ */ jsx13("span", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500 dark:bg-emerald-400 animate-pulse" }),
3018
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5", children: [
3019
+ /* @__PURE__ */ jsxs13("span", { className: "flex items-center gap-1 text-[10px] text-emerald-500 dark:text-emerald-400 mr-2", children: [
3020
+ /* @__PURE__ */ jsx14("span", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500 dark:bg-emerald-400 animate-pulse" }),
2907
3021
  "Online"
2908
3022
  ] }),
2909
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center bg-slate-100/50 dark:bg-white/5 rounded-lg p-0.5 border border-slate-200/50 dark:border-white/5", children: [
2910
- mounted && messages.length > 0 && /* @__PURE__ */ jsx13(
3023
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center bg-slate-100/50 dark:bg-white/5 rounded-lg p-0.5 border border-slate-200/50 dark:border-white/5", children: [
3024
+ mounted && messages.length > 0 && /* @__PURE__ */ jsx14(
2911
3025
  "button",
2912
3026
  {
2913
3027
  onClick: clearHistory,
2914
3028
  title: "Clear conversation",
2915
3029
  className: "w-7 h-7 rounded-md flex items-center justify-center text-slate-400 hover:text-rose-500 dark:text-white/40 dark:hover:text-rose-400 hover:bg-white dark:hover:bg-white/10 transition-all cursor-pointer",
2916
- children: /* @__PURE__ */ jsx13(Trash2, { className: "w-3.5 h-3.5" })
3030
+ children: /* @__PURE__ */ jsx14(Trash2, { className: "w-3.5 h-3.5" })
2917
3031
  }
2918
3032
  ),
2919
- isResized && onResetResize && /* @__PURE__ */ jsx13(
3033
+ isResized && onResetResize && /* @__PURE__ */ jsx14(
2920
3034
  "button",
2921
3035
  {
2922
3036
  onClick: onResetResize,
2923
3037
  title: "Reset to default size",
2924
3038
  className: "w-7 h-7 rounded-md flex items-center justify-center text-slate-400 hover:text-blue-500 dark:text-white/40 dark:hover:text-blue-400 hover:bg-white dark:hover:bg-white/10 transition-all cursor-pointer",
2925
- children: /* @__PURE__ */ jsx13(RotateCcw, { className: "w-3.5 h-3.5" })
3039
+ children: /* @__PURE__ */ jsx14(RotateCcw, { className: "w-3.5 h-3.5" })
2926
3040
  }
2927
3041
  ),
2928
- onMaximize && /* @__PURE__ */ jsx13(
3042
+ onMaximize && /* @__PURE__ */ jsx14(
2929
3043
  "button",
2930
3044
  {
2931
3045
  onClick: onMaximize,
2932
3046
  title: isMaximized ? "Minimize" : "Maximize",
2933
3047
  className: "w-7 h-7 rounded-md flex items-center justify-center text-slate-400 hover:text-blue-500 dark:text-white/40 dark:hover:text-blue-400 hover:bg-white dark:hover:bg-white/10 transition-all cursor-pointer",
2934
- children: isMaximized ? /* @__PURE__ */ jsx13(Minimize2, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ jsx13(Maximize2, { className: "w-3.5 h-3.5" })
3048
+ children: isMaximized ? /* @__PURE__ */ jsx14(Minimize2, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ jsx14(Maximize2, { className: "w-3.5 h-3.5" })
2935
3049
  }
2936
3050
  ),
2937
- showClose && onClose && /* @__PURE__ */ jsx13(
3051
+ showClose && onClose && /* @__PURE__ */ jsx14(
2938
3052
  "button",
2939
3053
  {
2940
3054
  onClick: onClose,
2941
3055
  title: "Close chat",
2942
3056
  className: "w-7 h-7 rounded-md flex items-center justify-center text-slate-400 hover:text-slate-600 dark:text-white/40 dark:hover:text-white/70 hover:bg-white dark:hover:bg-white/10 transition-all cursor-pointer",
2943
- children: /* @__PURE__ */ jsx13(X2, { className: "w-4 h-4" })
3057
+ children: /* @__PURE__ */ jsx14(X2, { className: "w-4 h-4" })
2944
3058
  }
2945
3059
  )
2946
3060
  ] })
@@ -2948,24 +3062,24 @@ function ChatWindow({
2948
3062
  ]
2949
3063
  }
2950
3064
  ),
2951
- /* @__PURE__ */ jsxs12("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5 scrollbar-thin scrollbar-thumb-slate-200 dark:scrollbar-thumb-white/10 scrollbar-track-transparent min-h-0 bg-slate-50 dark:bg-transparent", children: [
3065
+ /* @__PURE__ */ jsxs13("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5 scrollbar-thin scrollbar-thumb-slate-200 dark:scrollbar-thumb-white/10 scrollbar-track-transparent min-h-0 bg-slate-50 dark:bg-transparent", children: [
2952
3066
  !mounted || isEmpty ? (
2953
3067
  /* Welcome state */
2954
- /* @__PURE__ */ jsxs12("div", { className: "h-full flex flex-col items-center justify-center text-center gap-4 px-6 py-12", children: [
2955
- /* @__PURE__ */ jsx13(
3068
+ /* @__PURE__ */ jsxs13("div", { className: "h-full flex flex-col items-center justify-center text-center gap-4 px-6 py-12", children: [
3069
+ /* @__PURE__ */ jsx14(
2956
3070
  "div",
2957
3071
  {
2958
3072
  className: `w-16 h-16 flex items-center justify-center shadow-lg ${ui.borderRadius === "full" ? "rounded-full" : "rounded-2xl"}`,
2959
3073
  style: { background: `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` },
2960
- children: /* @__PURE__ */ jsx13(Sparkles, { className: "w-8 h-8 text-white" })
3074
+ children: /* @__PURE__ */ jsx14(Sparkles, { className: "w-8 h-8 text-white" })
2961
3075
  }
2962
3076
  ),
2963
- /* @__PURE__ */ jsxs12("div", { children: [
2964
- /* @__PURE__ */ jsx13("p", { className: "text-slate-800 dark:text-white/80 font-medium leading-relaxed", children: ui.welcomeMessage }),
2965
- /* @__PURE__ */ jsx13("p", { className: "text-slate-500 dark:text-white/30 text-sm mt-2", children: "Ask a question to get started" })
3077
+ /* @__PURE__ */ jsxs13("div", { children: [
3078
+ /* @__PURE__ */ jsx14("p", { className: "text-slate-800 dark:text-white/80 font-medium leading-relaxed", children: ui.welcomeMessage }),
3079
+ /* @__PURE__ */ jsx14("p", { className: "text-slate-500 dark:text-white/30 text-sm mt-2", children: "Ask a question to get started" })
2966
3080
  ] }),
2967
- /* @__PURE__ */ jsx13("div", { className: "flex flex-wrap gap-2 justify-center mt-2", children: CHAT_SUGGESTIONS.map(
2968
- (suggestion) => /* @__PURE__ */ jsx13(
3081
+ /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap gap-2 justify-center mt-2", children: CHAT_SUGGESTIONS.map(
3082
+ (suggestion) => /* @__PURE__ */ jsx14(
2969
3083
  "button",
2970
3084
  {
2971
3085
  onClick: () => {
@@ -2980,7 +3094,7 @@ function ChatWindow({
2980
3094
  )
2981
3095
  ) })
2982
3096
  ] })
2983
- ) : messages.map((msg, index) => /* @__PURE__ */ jsx13(
3097
+ ) : messages.map((msg, index) => /* @__PURE__ */ jsx14(
2984
3098
  MessageBubble,
2985
3099
  {
2986
3100
  message: msg,
@@ -2993,7 +3107,7 @@ function ChatWindow({
2993
3107
  },
2994
3108
  msg.id
2995
3109
  )),
2996
- isLoading && ((_a = messages[messages.length - 1]) == null ? void 0 : _a.role) !== "assistant" && /* @__PURE__ */ jsx13(
3110
+ isLoading && ((_a = messages[messages.length - 1]) == null ? void 0 : _a.role) !== "assistant" && /* @__PURE__ */ jsx14(
2997
3111
  MessageBubble,
2998
3112
  {
2999
3113
  message: { id: "loading", role: "assistant", content: "", createdAt: (/* @__PURE__ */ new Date()).toISOString() },
@@ -3004,22 +3118,22 @@ function ChatWindow({
3004
3118
  viewportSize
3005
3119
  }
3006
3120
  ),
3007
- error && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2 text-rose-500 dark:text-rose-400 text-sm bg-rose-50 dark:bg-rose-400/10 border border-rose-200 dark:border-rose-400/20 rounded-xl px-4 py-3", children: [
3008
- /* @__PURE__ */ jsx13(TriangleAlert, { className: "w-4 h-4 flex-shrink-0" }),
3009
- /* @__PURE__ */ jsx13("span", { children: error })
3121
+ error && /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 text-rose-500 dark:text-rose-400 text-sm bg-rose-50 dark:bg-rose-400/10 border border-rose-200 dark:border-rose-400/20 rounded-xl px-4 py-3", children: [
3122
+ /* @__PURE__ */ jsx14(TriangleAlert, { className: "w-4 h-4 flex-shrink-0" }),
3123
+ /* @__PURE__ */ jsx14("span", { children: error })
3010
3124
  ] }),
3011
- /* @__PURE__ */ jsx13("div", { ref: bottomRef })
3125
+ /* @__PURE__ */ jsx14("div", { ref: bottomRef })
3012
3126
  ] }),
3013
- isUploadModalOpen && /* @__PURE__ */ jsx13("div", { className: "absolute inset-0 z-50 flex items-center justify-center p-4 bg-slate-900/50 backdrop-blur-sm rounded-inherit", children: /* @__PURE__ */ jsxs12("div", { className: "relative w-full max-w-md bg-white dark:bg-[#0f0f1a] rounded-2xl shadow-2xl overflow-hidden animate-in zoom-in-95 duration-200", children: [
3014
- /* @__PURE__ */ jsx13(
3127
+ isUploadModalOpen && /* @__PURE__ */ jsx14("div", { className: "absolute inset-0 z-50 flex items-center justify-center p-4 bg-slate-900/50 backdrop-blur-sm rounded-inherit", children: /* @__PURE__ */ jsxs13("div", { className: "relative w-full max-w-md bg-white dark:bg-[#0f0f1a] rounded-2xl shadow-2xl overflow-hidden animate-in zoom-in-95 duration-200", children: [
3128
+ /* @__PURE__ */ jsx14(
3015
3129
  "button",
3016
3130
  {
3017
3131
  onClick: () => setIsUploadModalOpen(false),
3018
3132
  className: "absolute top-4 right-4 p-1.5 rounded-lg text-slate-400 hover:text-slate-600 hover:bg-slate-100 dark:hover:text-white/80 dark:hover:bg-white/10 transition-colors z-10",
3019
- children: /* @__PURE__ */ jsx13(X2, { className: "w-5 h-5" })
3133
+ children: /* @__PURE__ */ jsx14(X2, { className: "w-5 h-5" })
3020
3134
  }
3021
3135
  ),
3022
- /* @__PURE__ */ jsx13(
3136
+ /* @__PURE__ */ jsx14(
3023
3137
  DocumentUpload,
3024
3138
  {
3025
3139
  namespace: projectId,
@@ -3027,9 +3141,9 @@ function ChatWindow({
3027
3141
  }
3028
3142
  )
3029
3143
  ] }) }),
3030
- /* @__PURE__ */ jsxs12("div", { className: `px-4 pb-4 pt-2 border-t border-slate-200 dark:border-white/10 ${isGlass ? "bg-transparent" : "bg-white dark:bg-[#0f0f1a]"}`, children: [
3031
- (suggestions.length > 0 || isSuggesting) && !isLoading && /* @__PURE__ */ jsxs12("div", { className: "mb-3 flex flex-wrap gap-2 animate-in fade-in slide-in-from-bottom-2 duration-300", children: [
3032
- suggestions.map((suggestion) => /* @__PURE__ */ jsxs12(
3144
+ /* @__PURE__ */ jsxs13("div", { className: `px-4 pb-4 pt-2 border-t border-slate-200 dark:border-white/10 ${isGlass ? "bg-transparent" : "bg-white dark:bg-[#0f0f1a]"}`, children: [
3145
+ (suggestions.length > 0 || isSuggesting) && !isLoading && /* @__PURE__ */ jsxs13("div", { className: "mb-3 flex flex-wrap gap-2 animate-in fade-in slide-in-from-bottom-2 duration-300", children: [
3146
+ suggestions.map((suggestion) => /* @__PURE__ */ jsxs13(
3033
3147
  "button",
3034
3148
  {
3035
3149
  onClick: () => {
@@ -3040,19 +3154,19 @@ function ChatWindow({
3040
3154
  },
3041
3155
  className: "flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-medium bg-white dark:bg-white/5 border border-slate-200 dark:border-white/10 text-slate-600 dark:text-white/60 hover:text-slate-900 dark:hover:text-white/90 hover:border-slate-300 dark:hover:border-white/20 transition-all shadow-sm cursor-pointer group",
3042
3156
  children: [
3043
- /* @__PURE__ */ jsx13(Sparkles, { className: "w-3 h-3 text-amber-400" }),
3157
+ /* @__PURE__ */ jsx14(Sparkles, { className: "w-3 h-3 text-amber-400" }),
3044
3158
  suggestion
3045
3159
  ]
3046
3160
  },
3047
3161
  suggestion
3048
3162
  )),
3049
- isSuggesting && suggestions.length === 0 && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-medium text-slate-400 dark:text-white/30 animate-pulse", children: [
3050
- /* @__PURE__ */ jsx13(Sparkles, { className: "w-3 h-3" }),
3163
+ isSuggesting && suggestions.length === 0 && /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-medium text-slate-400 dark:text-white/30 animate-pulse", children: [
3164
+ /* @__PURE__ */ jsx14(Sparkles, { className: "w-3 h-3" }),
3051
3165
  "Thinking..."
3052
3166
  ] })
3053
3167
  ] }),
3054
- /* @__PURE__ */ jsxs12("div", { className: `flex items-end gap-2 bg-slate-50 dark:bg-white/5 border border-slate-200 dark:border-white/10 p-2 focus-within:border-slate-300 dark:focus-within:border-white/20 transition-all ${ui.borderRadius === "full" ? "rounded-3xl" : "rounded-2xl"}`, children: [
3055
- /* @__PURE__ */ jsx13(
3168
+ /* @__PURE__ */ jsxs13("div", { className: `flex items-end gap-2 bg-slate-50 dark:bg-white/5 border border-slate-200 dark:border-white/10 p-2 focus-within:border-slate-300 dark:focus-within:border-white/20 transition-all ${ui.borderRadius === "full" ? "rounded-3xl" : "rounded-2xl"}`, children: [
3169
+ /* @__PURE__ */ jsx14(
3056
3170
  "textarea",
3057
3171
  {
3058
3172
  ref: inputRef,
@@ -3072,7 +3186,7 @@ function ChatWindow({
3072
3186
  style: { scrollbarWidth: "none" }
3073
3187
  }
3074
3188
  ),
3075
- ui.enableVoiceInput !== false && /* @__PURE__ */ jsx13(
3189
+ ui.enableVoiceInput !== false && /* @__PURE__ */ jsx14(
3076
3190
  "button",
3077
3191
  {
3078
3192
  type: "button",
@@ -3080,28 +3194,28 @@ function ChatWindow({
3080
3194
  disabled: isLoading,
3081
3195
  className: `flex-shrink-0 w-9 h-9 rounded-xl flex items-center justify-center transition-all hover:scale-105 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100 disabled:active:scale-100 ${isListening ? "bg-rose-500 text-white animate-pulse shadow-md shadow-rose-500/20" : "text-slate-400 dark:text-white/40 hover:bg-slate-200 dark:hover:bg-white/10"}`,
3082
3196
  title: isListening ? "Stop listening" : "Start voice input",
3083
- children: isListening ? /* @__PURE__ */ jsx13(MicOff, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx13(Mic, { className: "w-4 h-4" })
3197
+ children: isListening ? /* @__PURE__ */ jsx14(MicOff, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx14(Mic, { className: "w-4 h-4" })
3084
3198
  }
3085
3199
  ),
3086
- ui.allowUpload !== false && /* @__PURE__ */ jsx13(
3200
+ ui.allowUpload !== false && /* @__PURE__ */ jsx14(
3087
3201
  "button",
3088
3202
  {
3089
3203
  type: "button",
3090
3204
  onClick: () => setIsUploadModalOpen(true),
3091
3205
  className: "flex-shrink-0 w-9 h-9 rounded-xl flex items-center justify-center transition-all hover:scale-105 active:scale-95 text-slate-400 dark:text-white/40 hover:bg-slate-200 dark:hover:bg-white/10",
3092
3206
  title: "Upload Document",
3093
- children: /* @__PURE__ */ jsx13(Paperclip, { className: "w-4 h-4" })
3207
+ children: /* @__PURE__ */ jsx14(Paperclip, { className: "w-4 h-4" })
3094
3208
  }
3095
3209
  ),
3096
- isLoading ? /* @__PURE__ */ jsx13(
3210
+ isLoading ? /* @__PURE__ */ jsx14(
3097
3211
  "button",
3098
3212
  {
3099
3213
  onClick: stop,
3100
3214
  className: "flex-shrink-0 w-9 h-9 rounded-xl flex items-center justify-center transition-all hover:scale-105 active:scale-95 shadow-md bg-rose-500 hover:bg-rose-600 text-white cursor-pointer",
3101
3215
  title: "Stop generating",
3102
- children: /* @__PURE__ */ jsx13("div", { className: "w-3.5 h-3.5 bg-white rounded-[2px]" })
3216
+ children: /* @__PURE__ */ jsx14("div", { className: "w-3.5 h-3.5 bg-white rounded-[2px]" })
3103
3217
  }
3104
- ) : /* @__PURE__ */ jsx13(
3218
+ ) : /* @__PURE__ */ jsx14(
3105
3219
  "button",
3106
3220
  {
3107
3221
  onClick: sendMessage,
@@ -3111,11 +3225,11 @@ function ChatWindow({
3111
3225
  background: input.trim() ? `linear-gradient(135deg, ${ui.primaryColor}, ${ui.accentColor})` : "rgba(148, 163, 184, 0.2)"
3112
3226
  // slate-400/20 for light mode disabled
3113
3227
  },
3114
- children: /* @__PURE__ */ jsx13(ArrowUp, { className: "w-4 h-4 text-white" })
3228
+ children: /* @__PURE__ */ jsx14(ArrowUp, { className: "w-4 h-4 text-white" })
3115
3229
  }
3116
3230
  )
3117
3231
  ] }),
3118
- /* @__PURE__ */ jsx13("p", { className: "text-center text-[10px] text-slate-400 dark:text-white/20 mt-2", children: "Press Enter to send \xB7 Shift+Enter for new line" })
3232
+ /* @__PURE__ */ jsx14("p", { className: "text-center text-[10px] text-slate-400 dark:text-white/20 mt-2", children: "Press Enter to send \xB7 Shift+Enter for new line" })
3119
3233
  ] })
3120
3234
  ]
3121
3235
  }
@@ -3123,7 +3237,7 @@ function ChatWindow({
3123
3237
  }
3124
3238
 
3125
3239
  // src/components/ChatWidget.tsx
3126
- import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
3240
+ import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
3127
3241
  var DEFAULT_DIMENSIONS = { width: 380, height: 600 };
3128
3242
  var GEMINI_STYLES = `
3129
3243
  @keyframes shapeshift {
@@ -3164,12 +3278,12 @@ var GEMINI_STYLES = `
3164
3278
  `;
3165
3279
  function ChatWidget({ position = "bottom-right", onAddToCart }) {
3166
3280
  const { ui } = useConfig();
3167
- const [isOpen, setIsOpen] = useState6(false);
3168
- const [hasUnread, setHasUnread] = useState6(false);
3169
- const [dimensions, setDimensions] = useState6(DEFAULT_DIMENSIONS);
3170
- const [isResizing, setIsResizing] = useState6(false);
3171
- const [isMaximized, setIsMaximized] = useState6(false);
3172
- const [prevDimensions, setPrevDimensions] = useState6(DEFAULT_DIMENSIONS);
3281
+ const [isOpen, setIsOpen] = useState7(false);
3282
+ const [hasUnread, setHasUnread] = useState7(false);
3283
+ const [dimensions, setDimensions] = useState7(DEFAULT_DIMENSIONS);
3284
+ const [isResizing, setIsResizing] = useState7(false);
3285
+ const [isMaximized, setIsMaximized] = useState7(false);
3286
+ const [prevDimensions, setPrevDimensions] = useState7(DEFAULT_DIMENSIONS);
3173
3287
  if (ui.showWidget === false) return null;
3174
3288
  const positionClass = position === "bottom-left" ? "bottom-6 left-6" : "bottom-6 right-6";
3175
3289
  const windowPositionClass = position === "bottom-left" ? "bottom-20 left-6" : "bottom-20 right-6";
@@ -3218,9 +3332,9 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
3218
3332
  }
3219
3333
  };
3220
3334
  const isResized = dimensions.width !== DEFAULT_DIMENSIONS.width || dimensions.height !== DEFAULT_DIMENSIONS.height;
3221
- return /* @__PURE__ */ jsxs13(Fragment4, { children: [
3222
- /* @__PURE__ */ jsx14("style", { dangerouslySetInnerHTML: { __html: GEMINI_STYLES } }),
3223
- /* @__PURE__ */ jsxs13(
3335
+ return /* @__PURE__ */ jsxs14(Fragment4, { children: [
3336
+ /* @__PURE__ */ jsx15("style", { dangerouslySetInnerHTML: { __html: GEMINI_STYLES } }),
3337
+ /* @__PURE__ */ jsxs14(
3224
3338
  "div",
3225
3339
  {
3226
3340
  className: `fixed z-[9998] max-w-[calc(100vw-3rem)] ease-in-out ${windowPositionClass} ${isOpen ? "opacity-100 translate-y-0 pointer-events-auto" : "opacity-0 translate-y-4 pointer-events-none"} ${isResizing ? "" : "transition-all duration-300"}`,
@@ -3230,7 +3344,7 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
3230
3344
  maxHeight: "calc(100vh - 6rem)"
3231
3345
  },
3232
3346
  children: [
3233
- /* @__PURE__ */ jsx14(
3347
+ /* @__PURE__ */ jsx15(
3234
3348
  ChatWindow,
3235
3349
  {
3236
3350
  className: "h-full relative z-10",
@@ -3244,7 +3358,7 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
3244
3358
  onAddToCart
3245
3359
  }
3246
3360
  ),
3247
- /* @__PURE__ */ jsx14(
3361
+ /* @__PURE__ */ jsx15(
3248
3362
  "div",
3249
3363
  {
3250
3364
  className: `absolute -bottom-1.5 w-4 h-4 rotate-45 border-r border-b border-slate-200 dark:border-white/10 z-0 ${ui.visualStyle === "solid" ? "bg-white dark:bg-[#0f0f1a]" : "bg-white/90 dark:bg-[#0f0f1a]/90 backdrop-blur-xl"} ${position === "bottom-left" ? "left-5" : "right-5"}`
@@ -3253,18 +3367,18 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
3253
3367
  ]
3254
3368
  }
3255
3369
  ),
3256
- /* @__PURE__ */ jsxs13(
3370
+ /* @__PURE__ */ jsxs14(
3257
3371
  "button",
3258
3372
  {
3259
3373
  onClick: isOpen ? () => setIsOpen(false) : handleOpen,
3260
3374
  className: `group fixed z-[9999] w-14 h-14 drop-shadow-2xl flex items-center justify-center transition-all duration-300 cursor-pointer hover:scale-110 active:scale-95 ${positionClass}`,
3261
3375
  "aria-label": "Open chat",
3262
3376
  children: [
3263
- /* @__PURE__ */ jsx14(
3377
+ /* @__PURE__ */ jsx15(
3264
3378
  "div",
3265
3379
  {
3266
3380
  className: "absolute inset-0 transition-all duration-300 overflow-hidden rounded-full group-hover:rounded-none group-hover:animate-[shapeshift_5s_ease-in-out_infinite_forwards]",
3267
- children: /* @__PURE__ */ jsx14(
3381
+ children: /* @__PURE__ */ jsx15(
3268
3382
  "div",
3269
3383
  {
3270
3384
  className: "absolute top-0 left-0 w-[400%] h-[400%] transition-transform duration-300 group-hover:animate-[gradientMove_3.5s_ease-in-out_infinite_alternate]",
@@ -3275,33 +3389,80 @@ function ChatWidget({ position = "bottom-right", onAddToCart }) {
3275
3389
  )
3276
3390
  }
3277
3391
  ),
3278
- /* @__PURE__ */ jsx14(
3392
+ /* @__PURE__ */ jsx15(
3279
3393
  "span",
3280
3394
  {
3281
3395
  className: "absolute inset-0 rounded-full animate-ping opacity-20 pointer-events-none",
3282
3396
  style: { background: ui.primaryColor }
3283
3397
  }
3284
3398
  ),
3285
- /* @__PURE__ */ jsx14(
3399
+ /* @__PURE__ */ jsx15(
3286
3400
  "span",
3287
3401
  {
3288
3402
  className: `relative z-10 transition-transform duration-300 ${isOpen ? "rotate-90 scale-90" : "rotate-0 scale-100"}`,
3289
- children: isOpen ? /* @__PURE__ */ jsx14(X3, { className: "w-6 h-6 text-white" }) : /* @__PURE__ */ jsx14(MessageSquare, { className: "w-6 h-6 text-white" })
3403
+ children: isOpen ? /* @__PURE__ */ jsx15(X3, { className: "w-6 h-6 text-white" }) : /* @__PURE__ */ jsx15(MessageSquare, { className: "w-6 h-6 text-white" })
3290
3404
  }
3291
3405
  ),
3292
- hasUnread && !isOpen && /* @__PURE__ */ jsx14("span", { className: "absolute top-0 right-0 w-4 h-4 bg-rose-500 rounded-full border-2 border-white flex items-center justify-center text-[9px] font-bold text-white", children: "1" })
3406
+ hasUnread && !isOpen && /* @__PURE__ */ jsx15("span", { className: "absolute top-0 right-0 w-4 h-4 bg-rose-500 rounded-full border-2 border-white flex items-center justify-center text-[9px] font-bold text-white", children: "1" })
3293
3407
  ]
3294
3408
  }
3295
3409
  )
3296
3410
  ] });
3297
3411
  }
3412
+
3413
+ // src/exceptions/index.ts
3414
+ var RetrivoraError = class extends Error {
3415
+ constructor(message, code, details) {
3416
+ super(message);
3417
+ this.name = new.target.name;
3418
+ this.code = code;
3419
+ this.details = details;
3420
+ }
3421
+ };
3422
+ var ProviderNotFoundException = class extends RetrivoraError {
3423
+ constructor(providerType, provider, details) {
3424
+ super(`Unsupported ${providerType} provider: ${provider}`, "PROVIDER_NOT_FOUND", details);
3425
+ }
3426
+ };
3427
+ var EmbeddingFailedException = class extends RetrivoraError {
3428
+ constructor(message = "Embedding generation failed", details) {
3429
+ super(message, "EMBEDDING_FAILED", details);
3430
+ }
3431
+ };
3432
+ var RetrievalException = class extends RetrivoraError {
3433
+ constructor(message = "Retrieval failed", details) {
3434
+ super(message, "RETRIEVAL_FAILED", details);
3435
+ }
3436
+ };
3437
+ var RateLimitException = class extends RetrivoraError {
3438
+ constructor(message = "Provider rate limit exceeded", details) {
3439
+ super(message, "RATE_LIMITED", details);
3440
+ }
3441
+ };
3442
+ var ConfigurationException = class extends RetrivoraError {
3443
+ constructor(message, details) {
3444
+ super(message, "CONFIGURATION_ERROR", details);
3445
+ }
3446
+ };
3447
+ var AuthenticationException = class extends RetrivoraError {
3448
+ constructor(message = "Provider authentication failed", details) {
3449
+ super(message, "AUTHENTICATION_ERROR", details);
3450
+ }
3451
+ };
3298
3452
  export {
3453
+ AuthenticationException,
3299
3454
  ChatWidget,
3300
3455
  ChatWindow,
3301
3456
  ConfigProvider,
3457
+ ConfigurationException,
3302
3458
  DocumentUpload,
3459
+ EmbeddingFailedException,
3303
3460
  MessageBubble,
3304
3461
  ObservabilityPanel,
3462
+ ProviderNotFoundException,
3463
+ RateLimitException,
3464
+ RetrievalException,
3465
+ RetrivoraError,
3305
3466
  SourceCard,
3306
3467
  addSynonyms,
3307
3468
  useConfig,