@frontera-sdk/chat-ui 1.50.59 → 1.50.61

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 (42) hide show
  1. package/README.md +41 -12
  2. package/dist/agent-picker.js +4 -4
  3. package/dist/{esm-MHF25KDL.js → browser-B7HPFETX.js} +1 -1
  4. package/dist/browser-DK2ZWH4A.js +2081 -0
  5. package/dist/chat.d.ts +12 -8
  6. package/dist/chat.js +109 -50
  7. package/dist/{chunk-CWC2IOX7.js → chunk-26L3ST3H.js} +1147 -1787
  8. package/dist/{chunk-BEJ3HQG4.js → chunk-37G6MHWS.js} +12 -9
  9. package/dist/{chunk-ZS6PXIZP.js → chunk-BDJFVRYR.js} +16 -3
  10. package/dist/{chunk-PQZ2CS26.js → chunk-CDTES65T.js} +17 -41
  11. package/dist/{chunk-2KEBRV3W.js → chunk-F6PEZE7A.js} +1 -2
  12. package/dist/{chunk-IBCOQG5T.js → chunk-FDGBZFGN.js} +5 -4
  13. package/dist/{chunk-XSEN6ISU.js → chunk-FNIHHKOZ.js} +25 -8
  14. package/dist/{chunk-SZTQOXLD.js → chunk-IQXJEZM7.js} +14 -14
  15. package/dist/{chunk-AQGBRSIP.js → chunk-J7EWRXEC.js} +1 -1
  16. package/dist/{chunk-IHBTHNXV.js → chunk-KHF7OM3F.js} +2 -2
  17. package/dist/{chunk-VDZH5Z3K.js → chunk-PH7AYVSS.js} +2 -2
  18. package/dist/{chunk-GTQH7MPF.js → chunk-ROJM44GB.js} +1 -1
  19. package/dist/{chunk-76WUIIOX.js → chunk-S3ECTKA3.js} +2 -2
  20. package/dist/{chunk-FXKXDR5K.js → chunk-TSKFBMGC.js} +1 -1
  21. package/dist/{chunk-466MYFJD.js → chunk-UTKQ6G2A.js} +3 -3
  22. package/dist/{chunk-IQRPGFLI.js → chunk-V44YVBRX.js} +3 -35
  23. package/dist/chunk-WDYCLC4F.js +35 -0
  24. package/dist/chunk-XLX3L3P4.js +43 -0
  25. package/dist/client.js +3 -2
  26. package/dist/credential.js +2 -1
  27. package/dist/frame.js +2 -5
  28. package/dist/header.js +11 -11
  29. package/dist/message.js +11 -11
  30. package/dist/new-session.d.ts +128 -3
  31. package/dist/new-session.js +5 -5
  32. package/dist/parts.js +5 -5
  33. package/dist/{pdf-deck-view-inner-3PVGFH26.js → pdf-deck-view-inner-AY4FYDAJ.js} +4 -4
  34. package/dist/{pdf-document-view-inner-CP6VFHG4.js → pdf-document-view-inner-NC5MBN7X.js} +4 -4
  35. package/dist/pending-cards.js +5 -5
  36. package/dist/platform.css +88 -101
  37. package/dist/{univer-workbook-N5IIN7CH.js → univer-workbook-LSBVETAQ.js} +22824 -31017
  38. package/package.json +25 -5
  39. package/src/styles.css +20 -5
  40. package/dist/chunk-DGDHKMDB.js +0 -10
  41. package/dist/lib-3ZKX25RJ.js +0 -4511
  42. package/dist/new-session-Dw7JOgzu.d.ts +0 -141
@@ -1,15 +1,18 @@
1
1
  'use client';
2
+ import { tokenEndpointError } from './chunk-WDYCLC4F.js';
2
3
  import { useState, useRef, useMemo, useEffect, useCallback } from 'react';
3
4
  import { FronteraClient } from '@frontera-sdk/core/client';
4
5
  import { createTokenSession } from '@frontera-sdk/chat/token-session';
5
6
 
6
- // src/credential.ts
7
7
  function useChatCredential(props) {
8
- const [ready, setReady] = useState(false);
8
+ const suppliedClient = props.client;
9
+ const [ready, setReady] = useState(() => {
10
+ if (!suppliedClient) return false;
11
+ return typeof suppliedClient === "function" ? !!suppliedClient() : true;
12
+ });
9
13
  const [error, setError] = useState(null);
10
14
  const clientRef = useRef(null);
11
15
  const sessionRef = useRef(null);
12
- const suppliedClient = props.client;
13
16
  const staticToken = props.token;
14
17
  const apiBaseUrl = props.apiBaseUrl;
15
18
  const tokenEndpoint = props.tokenEndpoint;
@@ -18,9 +21,13 @@ function useChatCredential(props) {
18
21
  if (!suppliedClient) return null;
19
22
  return typeof suppliedClient === "function" ? suppliedClient : () => suppliedClient;
20
23
  }, [suppliedClient]);
24
+ const pendingGetter = typeof suppliedClient === "function" && !ready;
25
+ useEffect(() => {
26
+ if (!pendingGetter) return;
27
+ if (suppliedClient()) setReady(true);
28
+ });
21
29
  useEffect(() => {
22
30
  if (staticClient) {
23
- setReady(true);
24
31
  return;
25
32
  }
26
33
  if (staticToken) {
@@ -44,11 +51,7 @@ function useChatCredential(props) {
44
51
  async function loadFromHost() {
45
52
  if (getToken) return getToken();
46
53
  const response = await fetch(tokenEndpoint, { method: "POST", credentials: "same-origin" });
47
- if (!response.ok) {
48
- throw new Error(
49
- `Token endpoint answered ${response.status}. It must return { token, expiresAt } for the signed-in user.`
50
- );
51
- }
54
+ if (!response.ok) throw await tokenEndpointError(response);
52
55
  return await response.json();
53
56
  }
54
57
  async function start() {
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { cn } from './chunk-DGDHKMDB.js';
2
+ import { cn, usePortalContainer } from './chunk-XLX3L3P4.js';
3
3
  import { CircleIcon, ChevronRightIcon } from './chunk-AFVU5VT6.js';
4
4
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
5
5
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -9,6 +9,19 @@ function DropdownMenu({
9
9
  }) {
10
10
  return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
11
11
  }
12
+ function DropdownMenuPortal({
13
+ ...props
14
+ }) {
15
+ const container = usePortalContainer();
16
+ return /* @__PURE__ */ jsx(
17
+ DropdownMenuPrimitive.Portal,
18
+ {
19
+ "data-slot": "dropdown-menu-portal",
20
+ ...container ? { container } : {},
21
+ ...props
22
+ }
23
+ );
24
+ }
12
25
  function DropdownMenuTrigger({
13
26
  ...props
14
27
  }) {
@@ -25,7 +38,7 @@ function DropdownMenuContent({
25
38
  sideOffset = 4,
26
39
  ...props
27
40
  }) {
28
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
41
+ return /* @__PURE__ */ jsx(DropdownMenuPortal, { children: /* @__PURE__ */ jsx(
29
42
  DropdownMenuPrimitive.Content,
30
43
  {
31
44
  "data-slot": "dropdown-menu-content",
@@ -165,7 +178,7 @@ function DropdownMenuSubContent({
165
178
  // for its own scroll), so an inline submenu gets cut at the menu edge —
166
179
  // visible on mobile where the submenu opens toward the viewport edge.
167
180
  // The portal escapes the clip and lets collision detection flip sides.
168
- /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
181
+ /* @__PURE__ */ jsx(DropdownMenuPortal, { children: /* @__PURE__ */ jsx(
169
182
  DropdownMenuPrimitive.SubContent,
170
183
  {
171
184
  "data-slot": "dropdown-menu-sub-content",
@@ -1,47 +1,23 @@
1
1
  'use client';
2
- import { createRequire } from 'module';
3
-
4
- // ../../node_modules/fflate/esm/index.mjs
5
- var require2 = createRequire("/");
6
- var _a;
7
- var Worker;
8
- var isMarkedAsUntransferable;
9
- var workerAdd = ";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global";
10
- try {
11
- _a = require2("worker_threads"), Worker = _a.Worker, isMarkedAsUntransferable = _a.isMarkedAsUntransferable;
12
- } catch (e) {
13
- }
14
- var wk = Worker ? function(c, _, msg, transfer, cb) {
15
- var done = false;
16
- var w = new Worker(c + workerAdd, { eval: true }).on("error", function(e) {
17
- return cb(e, null);
18
- }).on("message", function(m) {
19
- return cb(null, m);
20
- }).on("exit", function(c2) {
21
- if (c2 && !done)
22
- cb(new Error("exited with code " + c2), null);
23
- });
24
- if (isMarkedAsUntransferable)
25
- transfer = transfer.filter(function(t) {
26
- return !isMarkedAsUntransferable(t);
27
- });
28
- w.postMessage(msg, transfer);
29
- w.terminate = function() {
30
- done = true;
31
- return Worker.prototype.terminate.call(w);
2
+ // ../../node_modules/fflate/esm/browser.js
3
+ var ch2 = {};
4
+ var wk = (function(c, id, msg, transfer, cb) {
5
+ var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([
6
+ c + ';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'
7
+ ], { type: "text/javascript" }))));
8
+ w.onmessage = function(e) {
9
+ var d = e.data, ed = d.$e$;
10
+ if (ed) {
11
+ var err2 = new Error(ed[0]);
12
+ err2["code"] = ed[1];
13
+ err2.stack = ed[2];
14
+ cb(err2, null);
15
+ } else
16
+ cb(null, d);
32
17
  };
18
+ w.postMessage(msg, transfer);
33
19
  return w;
34
- } : function(_, __, ___, ____, cb) {
35
- setImmediate(function() {
36
- return cb(new Error("async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)"), null);
37
- });
38
- var NOP = function() {
39
- };
40
- return {
41
- terminate: NOP,
42
- postMessage: NOP
43
- };
44
- };
20
+ });
45
21
  var u8 = Uint8Array;
46
22
  var u16 = Uint16Array;
47
23
  var i32 = Int32Array;
@@ -1,6 +1,5 @@
1
1
  'use client';
2
- import { usePortalContainer } from './chunk-IQRPGFLI.js';
3
- import { cn } from './chunk-DGDHKMDB.js';
2
+ import { usePortalContainer, cn } from './chunk-XLX3L3P4.js';
4
3
  import { CrossMediumIcon } from './chunk-AFVU5VT6.js';
5
4
  import * as PopoverPrimitive from '@radix-ui/react-popover';
6
5
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -1,7 +1,7 @@
1
1
  'use client';
2
- import { Button, Skeleton, ScrollArea } from './chunk-GTQH7MPF.js';
3
- import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from './chunk-IQRPGFLI.js';
4
- import { cn } from './chunk-DGDHKMDB.js';
2
+ import { Button, Skeleton, ScrollArea } from './chunk-ROJM44GB.js';
3
+ import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from './chunk-V44YVBRX.js';
4
+ import { cn, usePortalContainer } from './chunk-XLX3L3P4.js';
5
5
  import { SquareArrowTopRightIcon, Checkmark1Icon, ClipboardIcon, Book3Icon, ChevronDownMediumIcon, ApiAppIcon, TextToImageIcon, Robot4Icon, DeviceDesktopIcon, PhotoIcon, Code2Icon, Terminal2Icon, Folder1Icon, PencilIcon, FileTextIcon, WritingIcon, WorldSearchIcon, icons_exports } from './chunk-AFVU5VT6.js';
6
6
  import '@radix-ui/react-slot';
7
7
  import { cva } from 'class-variance-authority';
@@ -43,12 +43,13 @@ function HoverCardContent({
43
43
  sideOffset = 4,
44
44
  ...props
45
45
  }) {
46
+ const container = usePortalContainer();
46
47
  return (
47
48
  // Portalled like every other popup primitive here. Rendered inline it is
48
49
  // clipped by any scrolling or `overflow-hidden` ancestor — a citation
49
50
  // hover card inside a message card was cut off at the card's edge — and
50
51
  // its z-100 is trapped in whatever stacking context that ancestor makes.
51
- /* @__PURE__ */ jsx(HoverCardPrimitive.Portal, { children: /* @__PURE__ */ jsx(
52
+ /* @__PURE__ */ jsx(HoverCardPrimitive.Portal, { ...container ? { container } : {}, children: /* @__PURE__ */ jsx(
52
53
  HoverCardPrimitive.Content,
53
54
  {
54
55
  align,
@@ -1,13 +1,13 @@
1
1
  'use client';
2
- import { usePlugins, useChatCapabilityEnabled, resolvePluginLanguage, renderPluginBlock, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, ActionMenu, useArtifactStore, ArtifactActionsMenu, useArtifact, resolveArtifactIconFormat, artifactFormatIcon, useArtifactFileObjectUrl, artifactFormatSubtitle, ChatImageLightbox, useClient, processMessageParts, getMessageDisplayTimestampValue, extractCitationsFromSteps, useSourcesEnrichment, extractImagesFromSteps, dedupeImageResults, getDocumentStreamArtifacts, getToolOutput, useCanvasStore, ImageResultsGallery, MessageDecisionCards, MessageStepsGroup, getToolState, getToolInput, getToolErrorText, dynamic, useChatCapabilities, useOptionalWorkspaceContext, useCitationViewer, useChatOverviewStore, dedup, extractDomain, sourceKind, SourceFavicon, Input, exportDocumentPdf, useAgentPanelStore, AgentRoutineForm, formatFileSize, FileThumbnail, MobileScreenSheet, useAgentHistorySource, treatyErrorMessage, useRouter, useBasePath, unwrap, agentRoutineKeys, getFileCategory, unwrapData, useOptionalAgentsContext, avatarMotionForStream, AGENT_AVATAR_SIZE } from './chunk-CWC2IOX7.js';
3
- import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription, Popover, PopoverTrigger, PopoverContent } from './chunk-2KEBRV3W.js';
2
+ import { usePlugins, useChatCapabilityEnabled, resolvePluginLanguage, renderPluginBlock, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, ActionMenu, useArtifactStore, ArtifactActionsMenu, useArtifact, resolveArtifactIconFormat, artifactFormatIcon, useArtifactFileObjectUrl, artifactFormatSubtitle, ChatImageLightbox, useClient, processMessageParts, getMessageDisplayTimestampValue, extractCitationsFromSteps, useSourcesEnrichment, extractImagesFromSteps, dedupeImageResults, getDocumentStreamArtifacts, getToolOutput, useCanvasStore, ImageResultsGallery, MessageDecisionCards, MessageStepsGroup, getToolState, getToolInput, getToolErrorText, dynamic, useChatCapabilities, useOptionalWorkspaceContext, useCitationViewer, useChatOverviewStore, dedup, extractDomain, sourceKind, SourceFavicon, Input, exportDocumentPdf, useAgentPanelStore, AgentRoutineForm, formatFileSize, FileThumbnail, MobileScreenSheet, useAgentHistorySource, treatyErrorMessage, useRouter, useBasePath, unwrap, agentRoutineKeys, getFileCategory, unwrapData, useOptionalAgentsContext, avatarMotionForStream, AGENT_AVATAR_SIZE } from './chunk-26L3ST3H.js';
3
+ import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription, Popover, PopoverTrigger, PopoverContent } from './chunk-F6PEZE7A.js';
4
4
  import { useTranslation } from './chunk-FTLVGUG5.js';
5
- import { MessageToolbar, MessageResponse, Shimmer, Message, MessageContent, deferDuringLayoutMotion, HoverCard, HoverCardTrigger, HoverCardContent, Icon } from './chunk-IBCOQG5T.js';
6
- import { Button, ScrollArea, Skeleton } from './chunk-GTQH7MPF.js';
5
+ import { MessageToolbar, MessageResponse, Shimmer, Message, MessageContent, deferDuringLayoutMotion, HoverCard, HoverCardTrigger, HoverCardContent, Icon } from './chunk-FDGBZFGN.js';
6
+ import { Button, ScrollArea, Skeleton } from './chunk-ROJM44GB.js';
7
7
  import { useIsMobile } from './chunk-IXDM5R55.js';
8
- import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent } from './chunk-ZS6PXIZP.js';
9
- import { HISTORY_CITATION_PREFIX, historyCitationReference, AgentAvatar } from './chunk-FXKXDR5K.js';
10
- import { cn } from './chunk-DGDHKMDB.js';
8
+ import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent } from './chunk-BDJFVRYR.js';
9
+ import { HISTORY_CITATION_PREFIX, historyCitationReference, AgentAvatar } from './chunk-TSKFBMGC.js';
10
+ import { cn } from './chunk-XLX3L3P4.js';
11
11
  import { ThumbsUpIcon, ThumbsDownIcon, ArrowRotateClockwiseIcon, ForkCodeIcon, CircleInfoIcon, SquareArrowTopRightIcon, ChevronDownMediumIcon, DotGrid1x3HorizontalTightIcon, SidebarSimpleRightWideIcon, ChevronTopMediumIcon, FileTextIcon, Checkmark1Icon, ClipboardIcon, ArrowsShowIcon, FileDownloadIcon, PencilIcon, LayoutLeftRightIcon, StopIcon, VolumeFullIcon, DotGrid1x3HorizontalIcon, CrossMediumIcon, SendIcon, FilePdfIcon, StudioDisplayIcon, WorldIcon, FloppyDisk1Icon, WarningSignIcon, Email1Icon, ArrowRightIcon, TextSelectIcon, BubblePlusIcon, BrainIcon, CheckCircle2Icon, CircleQuestionmarkIcon, ArrowUpRightIcon, CircleXIcon, ClockIcon, CircleCheckIcon, UserAddedIcon, LoaderIcon } from './chunk-AFVU5VT6.js';
12
12
  import { useChatClientOptional } from './chunk-7ADM3CKD.js';
13
13
  import { createContext, memo, useMemo, isValidElement, cloneElement, useState, useCallback, useRef, useEffect, useId, useLayoutEffect, useContext } from 'react';
@@ -791,7 +791,24 @@ function modeToBrandRow(mode) {
791
791
  return {
792
792
  icon: mode.icon,
793
793
  provider: mode.provider,
794
- modelId: mode.modelId ?? mode.model ?? mode.key,
794
+ /*
795
+ A `modelId` that merely echoes the key is not evidence, so the display
796
+ name is preferred over it.
797
+
798
+ A mode key is frozen when the mode is created; the model behind it can be
799
+ changed afterwards, and several agents carry `key: 'deepseek-v4-pro'` with
800
+ `name: 'Claude Sonnet 5'`. On the platform the stale key is harmless
801
+ because a real `modelId` sits ahead of it in the haystack. `/v1/chat-agents`
802
+ withholds `modelId` — it names the checkpoint the deployment runs — and
803
+ `chat-input-bar` then fills the field with the key itself, so the stale
804
+ key became the only signal and drew a DeepSeek glyph beside a Claude
805
+ label.
806
+
807
+ Nothing new is disclosed: the name is already rendered next to the icon.
808
+ A mode named "Fast" resolves to the generic glyph, which is the honest
809
+ outcome — this resolver returns null rather than guessing.
810
+ */
811
+ modelId: mode.modelId && mode.modelId !== mode.key ? mode.modelId : mode.model ?? mode.name ?? mode.key,
795
812
  slug: mode.key
796
813
  };
797
814
  }
@@ -1,13 +1,13 @@
1
1
  'use client';
2
- import { requestPaneFocus, useArtifacts, usePlugins, useCanvasStore, useArtifactStore, useChatOverviewStore, useSourcesEnrichment, sourceKind, useCitationViewer, resolveSourceDisplay, extractDomain, canvasId, useAgentPanelStore, SourceFavicon, dedup, useArtifactFileObjectUrl, resolveArtifactIconFormat, artifactFormatIcon, avatarMotionForStream, AGENT_AVATAR_SIZE, getFileCategory, FileThumbnail, formatFileSize, usePathname, artifactFormatSubtitle, artifactCategory, Input, MobileScreenSheet, TooltipTrigger, Tooltip, useChatCapabilities, TooltipContent, processMessageParts, GridSpinner, PanelEdgeRing, ArtifactActionsMenu, extractCitationsFromSteps, resolvePluginLanguage, getMessageDisplayTimestampValue } from './chunk-CWC2IOX7.js';
3
- import { Popover, PopoverTrigger, PopoverContent, Sheet, SheetContent, SheetHeader, SheetTitle } from './chunk-2KEBRV3W.js';
2
+ import { requestPaneFocus, useArtifacts, usePlugins, useCanvasStore, useArtifactStore, useChatOverviewStore, useSourcesEnrichment, sourceKind, useCitationViewer, resolveSourceDisplay, extractDomain, canvasId, useAgentPanelStore, SourceFavicon, dedup, useArtifactFileObjectUrl, resolveArtifactIconFormat, artifactFormatIcon, avatarMotionForStream, AGENT_AVATAR_SIZE, getFileCategory, FileThumbnail, formatFileSize, usePathname, artifactFormatSubtitle, artifactCategory, Input, MobileScreenSheet, TooltipTrigger, Tooltip, useChatCapabilities, TooltipContent, processMessageParts, GridSpinner, PanelEdgeRing, ArtifactActionsMenu, extractCitationsFromSteps, resolvePluginLanguage, getMessageDisplayTimestampValue } from './chunk-26L3ST3H.js';
3
+ import { Popover, PopoverTrigger, PopoverContent, Sheet, SheetContent, SheetHeader, SheetTitle } from './chunk-F6PEZE7A.js';
4
4
  import { useTranslation } from './chunk-FTLVGUG5.js';
5
- import { Collapsible, CollapsibleTrigger, CollapsibleContent, Shimmer, HoverCard, HoverCardTrigger, HoverCardContent } from './chunk-IBCOQG5T.js';
6
- import { ScrollArea, Skeleton, Button } from './chunk-GTQH7MPF.js';
7
- import { Dialog, DialogContent, DialogHeader, DialogTitle } from './chunk-IQRPGFLI.js';
5
+ import { Collapsible, CollapsibleTrigger, CollapsibleContent, Shimmer, HoverCard, HoverCardTrigger, HoverCardContent } from './chunk-FDGBZFGN.js';
6
+ import { ScrollArea, Skeleton, Button } from './chunk-ROJM44GB.js';
7
+ import { Dialog, DialogContent, DialogHeader, DialogTitle } from './chunk-V44YVBRX.js';
8
8
  import { useIsMobile } from './chunk-IXDM5R55.js';
9
- import { AgentAvatar } from './chunk-FXKXDR5K.js';
10
- import { cn } from './chunk-DGDHKMDB.js';
9
+ import { AgentAvatar } from './chunk-TSKFBMGC.js';
10
+ import { cn } from './chunk-XLX3L3P4.js';
11
11
  import { CircleDashedIcon, StudioDisplayIcon, LayoutDashboardIcon, TableIcon, Chart1Icon, Checkmark1Icon, BulletListIcon, FilesIcon, ChevronDownMediumIcon, ChainLink1Icon, MagnifyingGlassIcon, ChevronRightIcon, CrossMediumIcon, SidebarHiddenRightWideIcon, DotGrid1x3HorizontalTightIcon } from './chunk-AFVU5VT6.js';
12
12
  import { __require } from './chunk-PR4QN5HX.js';
13
13
  import * as React2 from 'react';
@@ -425,7 +425,7 @@ var warning = () => {
425
425
  };
426
426
  var invariant = () => {
427
427
  };
428
- if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production") {
428
+ if (typeof process !== "undefined" && true) {
429
429
  warning = (check, message, errorCode) => {
430
430
  if (!check && typeof console !== "undefined") {
431
431
  console.warn(formatErrorMessage(message, errorCode));
@@ -1732,7 +1732,7 @@ var JSAnimation = class extends WithPromise {
1732
1732
  const { type = keyframes, repeat = 0, repeatDelay = 0, repeatType, velocity = 0 } = options;
1733
1733
  let { keyframes: keyframes$1 } = options;
1734
1734
  const generatorFactory = type || keyframes;
1735
- if (process.env.NODE_ENV !== "production" && generatorFactory !== keyframes) {
1735
+ if (generatorFactory !== keyframes) {
1736
1736
  invariant(keyframes$1.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes$1}`, "spring-two-frames");
1737
1737
  }
1738
1738
  if (generatorFactory !== keyframes && typeof keyframes$1[0] !== "number") {
@@ -2890,7 +2890,7 @@ var MotionValue = class {
2890
2890
  * @deprecated
2891
2891
  */
2892
2892
  onChange(subscription) {
2893
- if (process.env.NODE_ENV !== "production") {
2893
+ {
2894
2894
  warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on("change", callback).`);
2895
2895
  }
2896
2896
  return this.on("change", subscription);
@@ -4348,7 +4348,7 @@ var VisualElement = class {
4348
4348
  }
4349
4349
  this.shouldReduceMotion = prefersReducedMotion.current;
4350
4350
  }
4351
- if (process.env.NODE_ENV !== "production") {
4351
+ {
4352
4352
  warnOnce(this.shouldReduceMotion !== true, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled");
4353
4353
  }
4354
4354
  this.shouldSkipAnimations = this.skipAnimationsConfig ?? false;
@@ -7139,7 +7139,7 @@ var AnimatePresence = ({ children, custom, initial = true, onExitComplete, prese
7139
7139
  setDiffedChildren(presentChildren);
7140
7140
  return null;
7141
7141
  }
7142
- if (process.env.NODE_ENV !== "production" && mode === "wait" && renderedChildren.length > 1) {
7142
+ if (mode === "wait" && renderedChildren.length > 1) {
7143
7143
  console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
7144
7144
  }
7145
7145
  const { forceRender } = useContext(LayoutGroupContext);
@@ -7687,7 +7687,7 @@ function useLayoutId({ layoutId }) {
7687
7687
  }
7688
7688
  function useStrictMode(configAndProps, preloadedFeatures) {
7689
7689
  const isStrict = useContext(LazyContext).strict;
7690
- if (process.env.NODE_ENV !== "production" && preloadedFeatures && isStrict) {
7690
+ if (preloadedFeatures && isStrict) {
7691
7691
  const strictMessage = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
7692
7692
  configAndProps.ignoreStrict ? warning(false, strictMessage, "lazy-strict-mode") : invariant(false, strictMessage, "lazy-strict-mode");
7693
7693
  }
@@ -7714,7 +7714,7 @@ function createMotionProxy(preloadedFeatures, createVisualElement) {
7714
7714
  return createMotionComponent(Component3, options, preloadedFeatures, createVisualElement);
7715
7715
  };
7716
7716
  const deprecatedFactoryFunction = (Component3, options) => {
7717
- if (process.env.NODE_ENV !== "production") {
7717
+ {
7718
7718
  warnOnce(false, "motion() is deprecated. Use motion.create() instead.");
7719
7719
  }
7720
7720
  return factory(Component3, options);
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { useTranslation } from './chunk-FTLVGUG5.js';
3
- import { Skeleton } from './chunk-GTQH7MPF.js';
3
+ import { Skeleton } from './chunk-ROJM44GB.js';
4
4
  import { useRef, useState, useEffect } from 'react';
5
5
  import { jsx, jsxs } from 'react/jsx-runtime';
6
6
 
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- import { getToolMeta } from './chunk-IBCOQG5T.js';
3
- import { Button } from './chunk-GTQH7MPF.js';
2
+ import { getToolMeta } from './chunk-FDGBZFGN.js';
3
+ import { Button } from './chunk-ROJM44GB.js';
4
4
  import { ChevronDownMediumIcon, CrossMediumIcon } from './chunk-AFVU5VT6.js';
5
5
  import { useChatClientOptional } from './chunk-7ADM3CKD.js';
6
6
  import { useState, useCallback, useEffect, useMemo } from 'react';
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from './chunk-ZS6PXIZP.js';
3
- import { AgentAvatar } from './chunk-FXKXDR5K.js';
2
+ import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from './chunk-BDJFVRYR.js';
3
+ import { AgentAvatar } from './chunk-TSKFBMGC.js';
4
4
  import { ChevronDownMediumIcon } from './chunk-AFVU5VT6.js';
5
5
  import { useChatClientOptional } from './chunk-7ADM3CKD.js';
6
6
  import { useState, useEffect } from 'react';
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { cn } from './chunk-DGDHKMDB.js';
2
+ import { cn } from './chunk-XLX3L3P4.js';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
4
  import { cva } from 'class-variance-authority';
5
5
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- import { describeToolRow, getToolMeta, Shimmer, Collapse } from './chunk-IBCOQG5T.js';
3
- import { cn } from './chunk-DGDHKMDB.js';
2
+ import { describeToolRow, getToolMeta, Shimmer, Collapse } from './chunk-FDGBZFGN.js';
3
+ import { cn } from './chunk-XLX3L3P4.js';
4
4
  import { Code2Icon, ChevronDownMediumIcon, ProcessorIcon } from './chunk-AFVU5VT6.js';
5
5
  import { memo, useState, useMemo } from 'react';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { cn } from './chunk-DGDHKMDB.js';
2
+ import { cn } from './chunk-XLX3L3P4.js';
3
3
  import { forwardRef, useState, useId, useRef, useMemo, memo, useEffect, useLayoutEffect } from 'react';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
  import { z } from 'zod';
@@ -1,9 +1,9 @@
1
1
  'use client';
2
- import { Sheet, SheetContent, SheetHeader, SheetTitle, Popover, PopoverTrigger, PopoverContent } from './chunk-2KEBRV3W.js';
2
+ import { Sheet, SheetContent, SheetHeader, SheetTitle, Popover, PopoverTrigger, PopoverContent } from './chunk-F6PEZE7A.js';
3
3
  import { useTranslation } from './chunk-FTLVGUG5.js';
4
4
  import { useIsMobile } from './chunk-IXDM5R55.js';
5
- import { AgentAvatar } from './chunk-FXKXDR5K.js';
6
- import { cn } from './chunk-DGDHKMDB.js';
5
+ import { AgentAvatar } from './chunk-TSKFBMGC.js';
6
+ import { cn } from './chunk-XLX3L3P4.js';
7
7
  import { CrossMediumIcon, MagnifyingGlassIcon, Checkmark1Icon } from './chunk-AFVU5VT6.js';
8
8
  import * as t from 'react';
9
9
  import { memo, useState } from 'react';
@@ -1,42 +1,10 @@
1
1
  'use client';
2
- import { cn } from './chunk-DGDHKMDB.js';
2
+ import { cn, usePortalContainer } from './chunk-XLX3L3P4.js';
3
3
  import { CrossMediumIcon } from './chunk-AFVU5VT6.js';
4
4
  import * as React from 'react';
5
- import { createContext, useContext, useState, useEffect } from 'react';
6
- import { jsx, jsxs } from 'react/jsx-runtime';
7
5
  import * as DialogPrimitive from '@radix-ui/react-dialog';
6
+ import { jsx, jsxs } from 'react/jsx-runtime';
8
7
 
9
- var PortalRootContext = createContext(null);
10
- function usePortalContainer() {
11
- return useContext(PortalRootContext);
12
- }
13
- function PortalRootProvider({
14
- dark,
15
- style,
16
- children
17
- }) {
18
- const [root, setRoot] = useState(null);
19
- useEffect(() => {
20
- const element = document.createElement("div");
21
- element.setAttribute("data-frontera-portal-root", "");
22
- document.body.appendChild(element);
23
- setRoot(element);
24
- return () => {
25
- element.remove();
26
- };
27
- }, []);
28
- useEffect(() => {
29
- if (!root) return;
30
- root.className = `fr-shell${dark ? " dark" : ""}`;
31
- root.removeAttribute("style");
32
- for (const [key, value] of Object.entries(style ?? {})) {
33
- if (typeof value !== "string") continue;
34
- if (key.startsWith("--")) root.style.setProperty(key, value);
35
- else root.style.setProperty(key, value);
36
- }
37
- }, [root, dark, style]);
38
- return /* @__PURE__ */ jsx(PortalRootContext.Provider, { value: root, children });
39
- }
40
8
  function Dialog({
41
9
  ...props
42
10
  }) {
@@ -231,4 +199,4 @@ function DialogDescription({
231
199
  );
232
200
  }
233
201
 
234
- export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, PortalRootProvider, usePortalContainer };
202
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle };
@@ -0,0 +1,35 @@
1
+ 'use client';
2
+ // src/token-endpoint-error.ts
3
+ var MAX_DETAIL = 300;
4
+ function pickMessage(body) {
5
+ const trimmed = body.trim();
6
+ if (!trimmed) return null;
7
+ if (trimmed.startsWith("<")) return null;
8
+ try {
9
+ const parsed = JSON.parse(trimmed);
10
+ if (typeof parsed === "string") return parsed.slice(0, MAX_DETAIL);
11
+ if (parsed && typeof parsed === "object") {
12
+ const record = parsed;
13
+ for (const key of ["message", "error_description", "error", "detail"]) {
14
+ const value = record[key];
15
+ if (typeof value === "string" && value.trim()) return value.trim().slice(0, MAX_DETAIL);
16
+ }
17
+ return null;
18
+ }
19
+ return null;
20
+ } catch {
21
+ return trimmed.slice(0, MAX_DETAIL);
22
+ }
23
+ }
24
+ async function tokenEndpointError(response) {
25
+ let detail = null;
26
+ try {
27
+ detail = pickMessage(await response.text());
28
+ } catch {
29
+ }
30
+ return new Error(
31
+ detail ? `Token endpoint answered ${response.status}: ${detail}` : `Token endpoint answered ${response.status} with no message. It must return { token, expiresAt } for the signed-in user.`
32
+ );
33
+ }
34
+
35
+ export { tokenEndpointError };
@@ -0,0 +1,43 @@
1
+ 'use client';
2
+ import { clsx } from 'clsx';
3
+ import { twMerge } from 'tailwind-merge';
4
+ import { createContext, useContext, useState, useEffect } from 'react';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ // src/vendor/lib/utils.ts
8
+ function cn(...inputs) {
9
+ return twMerge(clsx(inputs));
10
+ }
11
+ var PortalRootContext = createContext(null);
12
+ function usePortalContainer() {
13
+ return useContext(PortalRootContext);
14
+ }
15
+ function PortalRootProvider({
16
+ dark,
17
+ style,
18
+ children
19
+ }) {
20
+ const [root, setRoot] = useState(null);
21
+ useEffect(() => {
22
+ const element = document.createElement("div");
23
+ element.setAttribute("data-frontera-portal-root", "");
24
+ document.body.appendChild(element);
25
+ setRoot(element);
26
+ return () => {
27
+ element.remove();
28
+ };
29
+ }, []);
30
+ useEffect(() => {
31
+ if (!root) return;
32
+ root.className = `fr-shell${dark ? " dark" : ""}`;
33
+ root.removeAttribute("style");
34
+ for (const [key, value] of Object.entries(style ?? {})) {
35
+ if (typeof value !== "string") continue;
36
+ if (key.startsWith("--")) root.style.setProperty(key, value);
37
+ else root.style.setProperty(key, value);
38
+ }
39
+ }, [root, dark, style]);
40
+ return /* @__PURE__ */ jsx(PortalRootContext.Provider, { value: root, children });
41
+ }
42
+
43
+ export { PortalRootProvider, cn, usePortalContainer };
package/dist/client.js CHANGED
@@ -1,7 +1,8 @@
1
1
  'use client';
2
2
  export { capabilitiesOfChatToken, subjectOfChatToken } from './chunk-CCVPZVFK.js';
3
- import { useChatCredential } from './chunk-BEJ3HQG4.js';
4
- export { useChatCredential } from './chunk-BEJ3HQG4.js';
3
+ import { useChatCredential } from './chunk-37G6MHWS.js';
4
+ export { useChatCredential } from './chunk-37G6MHWS.js';
5
+ import './chunk-WDYCLC4F.js';
5
6
  export { ChatClientContext, useChatClientOptional } from './chunk-7ADM3CKD.js';
6
7
  import './chunk-PR4QN5HX.js';
7
8
  import { useMemo } from 'react';
@@ -1,3 +1,4 @@
1
1
  'use client';
2
- export { useChatCredential } from './chunk-BEJ3HQG4.js';
2
+ export { useChatCredential } from './chunk-37G6MHWS.js';
3
+ import './chunk-WDYCLC4F.js';
3
4
  import './chunk-PR4QN5HX.js';
package/dist/frame.js CHANGED
@@ -1,4 +1,5 @@
1
1
  'use client';
2
+ import { tokenEndpointError } from './chunk-WDYCLC4F.js';
2
3
  import './chunk-PR4QN5HX.js';
3
4
  import { useRef, useState, useEffect } from 'react';
4
5
  import { jsx } from 'react/jsx-runtime';
@@ -43,11 +44,7 @@ function FronteraChatFrame({
43
44
  method: "POST",
44
45
  credentials: "same-origin"
45
46
  });
46
- if (!response.ok) {
47
- throw new Error(
48
- `Token endpoint answered ${response.status}. It must return { token, expiresAt } for the signed-in user.`
49
- );
50
- }
47
+ if (!response.ok) throw await tokenEndpointError(response);
51
48
  return response.json();
52
49
  }
53
50
  function post(message) {
package/dist/header.js CHANGED
@@ -1,18 +1,18 @@
1
1
  'use client';
2
- export { ChatHeader, ChatHeaderActions } from './chunk-SZTQOXLD.js';
3
- import './chunk-CWC2IOX7.js';
4
- import './chunk-2KEBRV3W.js';
2
+ export { ChatHeader, ChatHeaderActions } from './chunk-IQXJEZM7.js';
3
+ import './chunk-26L3ST3H.js';
4
+ import './chunk-F6PEZE7A.js';
5
5
  import './chunk-FTLVGUG5.js';
6
- import './chunk-76WUIIOX.js';
7
- import './chunk-IBCOQG5T.js';
8
- import './chunk-GTQH7MPF.js';
9
- import './chunk-IQRPGFLI.js';
6
+ import './chunk-S3ECTKA3.js';
7
+ import './chunk-FDGBZFGN.js';
8
+ import './chunk-ROJM44GB.js';
9
+ import './chunk-V44YVBRX.js';
10
10
  import './chunk-6BPHEBCF.js';
11
11
  import './chunk-IXDM5R55.js';
12
- import './chunk-PQZ2CS26.js';
13
- import './chunk-ZS6PXIZP.js';
14
- import './chunk-FXKXDR5K.js';
15
- import './chunk-DGDHKMDB.js';
12
+ import './chunk-CDTES65T.js';
13
+ import './chunk-BDJFVRYR.js';
14
+ import './chunk-TSKFBMGC.js';
15
+ import './chunk-XLX3L3P4.js';
16
16
  import './chunk-AFVU5VT6.js';
17
17
  import './chunk-7ADM3CKD.js';
18
18
  import './chunk-PR4QN5HX.js';
package/dist/message.js CHANGED
@@ -1,18 +1,18 @@
1
1
  'use client';
2
- export { Message, Thinking } from './chunk-XSEN6ISU.js';
3
- import './chunk-CWC2IOX7.js';
4
- import './chunk-2KEBRV3W.js';
2
+ export { Message, Thinking } from './chunk-FNIHHKOZ.js';
3
+ import './chunk-26L3ST3H.js';
4
+ import './chunk-F6PEZE7A.js';
5
5
  import './chunk-FTLVGUG5.js';
6
- import './chunk-76WUIIOX.js';
7
- import './chunk-IBCOQG5T.js';
8
- import './chunk-GTQH7MPF.js';
9
- import './chunk-IQRPGFLI.js';
6
+ import './chunk-S3ECTKA3.js';
7
+ import './chunk-FDGBZFGN.js';
8
+ import './chunk-ROJM44GB.js';
9
+ import './chunk-V44YVBRX.js';
10
10
  import './chunk-6BPHEBCF.js';
11
11
  import './chunk-IXDM5R55.js';
12
- import './chunk-PQZ2CS26.js';
13
- import './chunk-ZS6PXIZP.js';
14
- import './chunk-FXKXDR5K.js';
15
- import './chunk-DGDHKMDB.js';
12
+ import './chunk-CDTES65T.js';
13
+ import './chunk-BDJFVRYR.js';
14
+ import './chunk-TSKFBMGC.js';
15
+ import './chunk-XLX3L3P4.js';
16
16
  import './chunk-AFVU5VT6.js';
17
17
  import './chunk-7ADM3CKD.js';
18
18
  import './chunk-PR4QN5HX.js';