@frontera-sdk/chat-ui 1.50.59 → 1.50.60

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
package/dist/chat.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { StartChatRequest } from '@frontera-sdk/chat/types';
3
3
  import { ChatCredentialProps } from './credential.js';
4
- import { M as ModelModes, S as Shortcut } from './new-session-Dw7JOgzu.js';
4
+ import { Shortcut } from './new-session.js';
5
5
  import { FronteraChatTheme } from './theme.js';
6
6
  import '@frontera-sdk/core/client';
7
7
  import './types-BDqLaBfH.js';
@@ -29,13 +29,17 @@ interface FronteraChatOwnProps {
29
29
  /** Agent UUID — lets the composer offer that agent's apps and mentions. */
30
30
  agentId?: string;
31
31
  /**
32
- * Model modes the picker offers, keyed by mode name. Omit to hide the
33
- * picker — an embedded chat whose token fixes the model has nothing to
34
- * choose between.
32
+ * The model picker.
33
+ *
34
+ * What it offers comes from the AGENT, read with the same credential the
35
+ * chat holds — not from this application. A model is bound to the agent on
36
+ * the deployment, so a list supplied here could only ever disagree with what
37
+ * actually runs, and the disagreement would surface as a label that lies.
38
+ *
39
+ * On by default, and it hides itself when there is nothing to choose: one
40
+ * model mode, and no effort levels behind it.
35
41
  */
36
- modes?: ModelModes;
37
- modelMode?: string;
38
- defaultMode?: string;
42
+ modelSelector?: boolean;
39
43
  /**
40
44
  * Offer the approval-mode selector — how much the agent may do unattended.
41
45
  *
@@ -156,6 +160,6 @@ interface FronteraChatOwnProps {
156
160
  }) => void;
157
161
  onError?: (error: Error) => void;
158
162
  }
159
- declare function FronteraChat({ conversationId: initialConversationId, agentName: pinnedAgentName, agentPicker, agentId, modes, modelMode, defaultMode, fileUpload, approvalSelector, appsButton, agentLabel, mobileMenu, body, header, sidePanel, theme, dark: darkProp, className, placeholder, empty, shortcuts, connectRedirectUri, connectOrigin, onStart, onError, ...credentialProps }: FronteraChatProps): react.JSX.Element;
163
+ declare function FronteraChat({ conversationId: initialConversationId, agentName: pinnedAgentName, agentPicker, agentId, modelSelector, fileUpload, approvalSelector, appsButton, agentLabel, mobileMenu, body, header, sidePanel, theme, dark: darkProp, className, placeholder, empty, shortcuts, connectRedirectUri, connectOrigin, onStart, onError, ...credentialProps }: FronteraChatProps): react.JSX.Element;
160
164
 
161
165
  export { FronteraChat, type FronteraChatOwnProps, type FronteraChatProps };
package/dist/chat.js CHANGED
@@ -1,33 +1,34 @@
1
1
  'use client';
2
2
  import { isFullscreenHotkey, DeckNotesCard, deckOwnsArrowKeys } from './chunk-WMN6BPPS.js';
3
3
  import { offset, flip, autoUpdate, computePosition } from './chunk-I7SXWUAN.js';
4
- import { ArtifactSkeleton, resolveStageWidth, zoomPercent, DECK_ZOOM_LEVELS, LazyThumb } from './chunk-AQGBRSIP.js';
5
- import { NewSessionPrompt, keepCaretOnTap } from './chunk-466MYFJD.js';
6
- import { PendingCards } from './chunk-IHBTHNXV.js';
4
+ import { ArtifactSkeleton, resolveStageWidth, zoomPercent, DECK_ZOOM_LEVELS, LazyThumb } from './chunk-J7EWRXEC.js';
5
+ import { NewSessionPrompt, keepCaretOnTap } from './chunk-UTKQ6G2A.js';
6
+ import { PendingCards } from './chunk-KHF7OM3F.js';
7
7
  import { themeToStyle } from './chunk-6HYPVNVA.js';
8
- import { useChatAgents } from './chunk-VDZH5Z3K.js';
8
+ import { useChatAgents } from './chunk-PH7AYVSS.js';
9
9
  import { subjectOfChatToken, capabilitiesOfChatToken } from './chunk-CCVPZVFK.js';
10
- import { useChatCredential } from './chunk-BEJ3HQG4.js';
11
- import { chatSidePanelSessionKey, useTemplatePreviewStore, useHasTemplatePreviewHost, useChatSidePanelStore, ChatHeader, ChatHeaderActions, useRightPane, getChatOverviewAgentStatus, useChatOverviewVisible, useConversationArtifacts, PENDING_CHART_TAB_PREFIX, CHART_TAB_PREFIX, AGENT_WORK_TAB_ID, AGENT_ROUTINES_TAB_ID, SOURCES_TAB_ID, TEMPLATE_TAB_ID, OutputsSection, ChatOverviewContent, COMPUTER_TAB_PREFIX, SourceRow, motion, MAX_CHAT_SIDE_PANEL_SESSIONS, DEFAULT_CHAT_SIDE_PANEL_SIZE } from './chunk-SZTQOXLD.js';
12
- import { useComposerStore, Message, Thinking, setPendingFiles, useLivePreviewUrl, useComputerFiles, useUploadComputerFile, CanvasWidget, isPlainTextLanguage, useUploadFile, COMPOSER_ID_MAIN, useContextWindowInfo, useIsCompacting, useQueuedMessages, useChatStreamStore, useComputer, csvTextToWorkbookJson, CSV_PREVIEW_MAX_ROWS, CopyButton, useBackDismiss, PdfViewer, ModelIcon, modeToBrandRow, brandLabel, Spinner } from './chunk-XSEN6ISU.js';
13
- import { env, require_shim, require_with_selector, dynamic, Textarea, artifactFormatIcon, useAgentRoster, useArtifactStore, useCanvasStore, useChatOverviewStore, setSdkConversationPath, setSdkDarkMode, AgentsProvider, PluginProvider, WorkspaceProvider, TooltipProvider, CitationViewerProvider, ConnectRunnerProvider, isToolPart, getToolState, getToolName, getToolInput, usePaneFocusStore, useAgentPanelStore, Tooltip, TooltipTrigger, TooltipContent, ArtifactActionsMenu, useKeyboardInset, getToolOutput, useArtifact, useUpdateArtifact, useArtifactFileObjectUrl, resolveArtifactIconFormat, useSourcesEnrichment, Label, Input, renderPluginBlock, useArtifactVersion, useChatCapabilities, useChatOptInEnabled, useSessionPendingApprovals, tableToCsv, tableToXlsx, tableToMarkdown, DropdownMenu, DropdownMenuTrigger, StyledDropdownMenuContent, StyledDropdownMenuItem, useArtifactVersions, useClient, unwrapData, authFetch, getBearerHeadersForApi, useRestoreArtifactVersion, ZoomableImage, ChatImageLightbox, useDownloadArtifact, useArtifactFileBytes, useArtifactPreviewFileObjectUrl, useArtifactVersionPreviewFileObjectUrl, SpreadsheetIcon, useOptionalWorkspaceContext, useAgentConnectionStatus, useArtifacts, useRouter, useBrand, resolveBearerHeaders, subscribeSdkDarkMode, getSdkDarkMode, unwrap, useSession, useConnectRunner, useStartUserConnect, useUpsertGrant, useRevokeGrant, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, useConversationDesktopStatus, isRequestHumanTool, useWorkspaceContext, useCatalog, useInstalls, appsKeys, buildTenantUrlAbsolute } from './chunk-CWC2IOX7.js';
14
- import { Popover, PopoverTrigger, PopoverContent, Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription } from './chunk-2KEBRV3W.js';
10
+ import { useChatCredential } from './chunk-37G6MHWS.js';
11
+ import './chunk-WDYCLC4F.js';
12
+ import { chatSidePanelSessionKey, useTemplatePreviewStore, useHasTemplatePreviewHost, useChatSidePanelStore, ChatHeader, ChatHeaderActions, useRightPane, getChatOverviewAgentStatus, useChatOverviewVisible, useConversationArtifacts, PENDING_CHART_TAB_PREFIX, CHART_TAB_PREFIX, AGENT_WORK_TAB_ID, AGENT_ROUTINES_TAB_ID, SOURCES_TAB_ID, TEMPLATE_TAB_ID, OutputsSection, ChatOverviewContent, COMPUTER_TAB_PREFIX, SourceRow, motion, MAX_CHAT_SIDE_PANEL_SESSIONS, DEFAULT_CHAT_SIDE_PANEL_SIZE } from './chunk-IQXJEZM7.js';
13
+ import { useChatStreamStore, useComposerStore, Message, Thinking, setPendingFiles, useLivePreviewUrl, useComputerFiles, useUploadComputerFile, CanvasWidget, isPlainTextLanguage, useUploadFile, COMPOSER_ID_MAIN, useContextWindowInfo, useIsCompacting, useQueuedMessages, useComputer, csvTextToWorkbookJson, CSV_PREVIEW_MAX_ROWS, CopyButton, useBackDismiss, PdfViewer, ModelIcon, modeToBrandRow, brandLabel, Spinner } from './chunk-FNIHHKOZ.js';
14
+ import { env, dynamic, Textarea, artifactFormatIcon, useAgentRoster, useArtifactStore, useCanvasStore, useChatOverviewStore, setSdkConversationPath, setSdkDarkMode, AgentsProvider, PluginProvider, WorkspaceProvider, TooltipProvider, CitationViewerProvider, ConnectRunnerProvider, isToolPart, getToolState, getToolName, getToolInput, usePaneFocusStore, useAgentPanelStore, Tooltip, TooltipTrigger, TooltipContent, ArtifactActionsMenu, useKeyboardInset, getToolOutput, useArtifact, useUpdateArtifact, useArtifactFileObjectUrl, resolveArtifactIconFormat, useSourcesEnrichment, Label, Input, renderPluginBlock, useArtifactVersion, useChatCapabilities, useChatOptInEnabled, useSessionPendingApprovals, tableToCsv, tableToXlsx, tableToMarkdown, DropdownMenu, DropdownMenuTrigger, StyledDropdownMenuContent, StyledDropdownMenuItem, useArtifactVersions, useClient, unwrapData, authFetch, getBearerHeadersForApi, useRestoreArtifactVersion, ZoomableImage, ChatImageLightbox, useDownloadArtifact, useArtifactFileBytes, useArtifactPreviewFileObjectUrl, useArtifactVersionPreviewFileObjectUrl, SpreadsheetIcon, useOptionalWorkspaceContext, useAgentConnectionStatus, useArtifacts, useRouter, useBrand, resolveBearerHeaders, subscribeSdkDarkMode, getSdkDarkMode, unwrap, useSession, useConnectRunner, useStartUserConnect, useUpsertGrant, useRevokeGrant, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, useConversationDesktopStatus, isRequestHumanTool, useWorkspaceContext, useCatalog, useInstalls, appsKeys, buildTenantUrlAbsolute } from './chunk-26L3ST3H.js';
15
+ import { Popover, PopoverTrigger, PopoverContent, Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription } from './chunk-F6PEZE7A.js';
15
16
  import { I18nProvider, useTranslation } from './chunk-FTLVGUG5.js';
16
- import './chunk-76WUIIOX.js';
17
- import { AppIcon, frontera_icon_default, describeToolRow, useStreamdownPlugins, getToolMeta, MessageResponse, AppIconFrame } from './chunk-IBCOQG5T.js';
18
- import { Skeleton, Button, ScrollArea } from './chunk-GTQH7MPF.js';
19
- import { PortalRootProvider, Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from './chunk-IQRPGFLI.js';
17
+ import './chunk-S3ECTKA3.js';
18
+ import { AppIcon, frontera_icon_default, describeToolRow, useStreamdownPlugins, getToolMeta, MessageResponse, AppIconFrame } from './chunk-FDGBZFGN.js';
19
+ import { Skeleton, Button, ScrollArea } from './chunk-ROJM44GB.js';
20
+ import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from './chunk-V44YVBRX.js';
20
21
  import './chunk-6BPHEBCF.js';
21
22
  import { MOBILE_BREAKPOINT, useIsMobile } from './chunk-IXDM5R55.js';
22
- import './chunk-PQZ2CS26.js';
23
- import { DropdownMenu as DropdownMenu$1, DropdownMenuTrigger as DropdownMenuTrigger$1, DropdownMenuContent, DropdownMenuItem, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DropdownMenuLabel, DropdownMenuSeparator } from './chunk-ZS6PXIZP.js';
24
- import { AgentAvatar } from './chunk-FXKXDR5K.js';
25
- import { cn } from './chunk-DGDHKMDB.js';
23
+ import './chunk-CDTES65T.js';
24
+ import { DropdownMenu as DropdownMenu$1, DropdownMenuTrigger as DropdownMenuTrigger$1, DropdownMenuContent, DropdownMenuItem, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DropdownMenuLabel, DropdownMenuSeparator } from './chunk-BDJFVRYR.js';
25
+ import { AgentAvatar } from './chunk-TSKFBMGC.js';
26
+ import { cn, PortalRootProvider } from './chunk-XLX3L3P4.js';
26
27
  import { Chart1Icon, BooleanGroupIntersectIcon, ColorSwatchIcon, BookIcon, BuildingBlocksIcon, Box2Icon, PeopleIcon, UserIcon, TruckIcon, TicketIcon, TagIcon, ShoppingBag1Icon, ReceiptBillIcon, PackageIcon, MapPin2Icon, MapPinIcon, MapIcon, Folder1Icon, FileTextIcon, Server2Icon, CreditCard1Icon, Calendar1Icon, BuildingsIcon, DollarIcon, RaisingHand5FingerIcon, ShieldCheckIcon, ShieldBreakIcon, ArrowDownIcon, Paperclip1Icon, ChevronGrabberVerticalIcon, PlusMediumIcon, ChecklistIcon, CalendarRepeatIcon, StudioDisplayIcon, WorldIcon, SlidesWideIcon, ChainLink1Icon, StandingGlobeIcon, DotGrid1x3HorizontalTightIcon, ArrowsHideIcon, ArrowsShowIcon, CrossMediumIcon, ExclamationCircleIcon, ArrowRotateClockwiseIcon, SquareArrowTopRightIcon, ClipboardIcon, LoaderIcon, FileDownloadIcon, GhostIcon, HammerIcon, MoonIcon, FolderUploadIcon, Checkmark1Icon, MicrophoneIcon, VolumeFullIcon, VolumeOffIcon, ArrowCornerDownLeftIcon, ArrowUpIcon, TrashCanIcon, WarningSignIcon, CircleDotsCenter1Icon, CodeBracketsIcon, TableIcon, QrCodeIcon, ChevronDownMediumIcon, EyeOpenIcon, EyeSlashIcon, HistoryIcon, PlayIcon, ChevronLeftIcon, ChevronRightIcon, CodeIcon, FilePdfIcon, NotesIcon, AppsIcon, ChevronLeftMediumIcon, Camera1Icon, Images1Icon, MagicWandIcon, ChevronRightMediumIcon, Checkmark1MediumIcon, VideoIcon, AudioIcon, AspectRatio11Icon, CameraOff1Icon, ArrowsRepeatIcon, PlayCircleIcon, PauseIcon, StarWandIcon, SettingsGear1Icon, LayoutGrid1Icon, ArrowExpandVerIcon, AddImageIcon, Plugin1Icon } from './chunk-AFVU5VT6.js';
27
28
  import { ChatClientContext } from './chunk-7ADM3CKD.js';
28
- import { __commonJS, __toESM, __export } from './chunk-PR4QN5HX.js';
29
+ import { __commonJS, __export, __toESM } from './chunk-PR4QN5HX.js';
29
30
  import * as React from 'react';
30
- import React__default, { createContext, forwardRef, useState, useRef, useCallback, useMemo, useEffect, useImperativeHandle, useContext, useDebugValue, createRef, memo, createElement, useLayoutEffect, version, Activity, Component, useSyncExternalStore } from 'react';
31
+ import React__default, { createContext, forwardRef, useState, useRef, useCallback, useMemo, useEffect, useImperativeHandle, useContext, useDebugValue, createRef, memo, createElement, useLayoutEffect, version, Activity, Component, useSyncExternalStore as useSyncExternalStore$1 } from 'react';
31
32
  import { useChat } from '@ai-sdk/react';
32
33
  import { createChatTransport } from '@frontera-sdk/chat/transport';
33
34
  import { runAppConnection, completeRedirectedConnection } from '@frontera-sdk/chat/connect-popup';
@@ -36,6 +37,8 @@ import { QueryClient, useQuery, useQueryClient, useMutation } from '@tanstack/re
36
37
  import { Toaster, toast } from 'sonner';
37
38
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
38
39
  import ReactDOM, { flushSync, createPortal } from 'react-dom';
40
+ import { useSyncExternalStore } from 'use-sync-external-store/shim/index.js';
41
+ import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector.js';
39
42
  import * as TabsPrimitive from '@radix-ui/react-tabs';
40
43
  import { CodeBlock as CodeBlock$2, Streamdown } from 'streamdown';
41
44
  import * as ResizablePrimitive from 'react-resizable-panels';
@@ -145,6 +148,20 @@ var require_markdown_it_task_lists = __commonJS({
145
148
  }
146
149
  });
147
150
 
151
+ // src/connect-outcome.ts
152
+ function connectionOrThrow(outcome) {
153
+ if (outcome.status === "redirecting") return { continued: false };
154
+ if (outcome.status === "cancelled") {
155
+ throw new Error(
156
+ outcome.error ?? (outcome.reason === "timeout" ? "The connection timed out. Try again." : "Connect was cancelled or no account was granted.")
157
+ );
158
+ }
159
+ if (outcome.resume && !outcome.resume.ok) {
160
+ throw new Error(outcome.resume.error ?? `Could not continue (${outcome.resume.reason}).`);
161
+ }
162
+ return { continued: true };
163
+ }
164
+
148
165
  // src/vendor/ui/stores/chat-side-panel-persistence.ts
149
166
  var CHAT_SIDE_PANEL_STORAGE_PREFIX = "sebati.chat-side-panel.v2.";
150
167
  var SCHEMA_VERSION = 2;
@@ -1872,9 +1889,6 @@ function SaveStatusIndicator({ status }) {
1872
1889
  ] }) });
1873
1890
  }
1874
1891
 
1875
- // ../../node_modules/@tiptap/react/dist/index.js
1876
- var import_shim = __toESM(require_shim(), 1);
1877
-
1878
1892
  // ../../node_modules/orderedmap/dist/index.js
1879
1893
  function OrderedMap(content) {
1880
1894
  this.content = content;
@@ -16901,7 +16915,7 @@ var EventEmitter = class {
16901
16915
  this.callbacks = {};
16902
16916
  }
16903
16917
  };
16904
- var isDev = typeof process !== "undefined" && process.env.NODE_ENV !== "production";
16918
+ var isDev = typeof process !== "undefined" && true;
16905
16919
  function isWidgetDecoration(decoration) {
16906
16920
  return decoration.kind === "widget";
16907
16921
  }
@@ -20646,9 +20660,6 @@ function markPasteRule(config2) {
20646
20660
  });
20647
20661
  }
20648
20662
 
20649
- // ../../node_modules/@tiptap/react/dist/index.js
20650
- var import_shim2 = __toESM(require_shim(), 1);
20651
-
20652
20663
  // ../../node_modules/fast-equals/dist/es/index.mjs
20653
20664
  var { getOwnPropertyNames, getOwnPropertySymbols } = Object;
20654
20665
  var { hasOwnProperty } = Object.prototype;
@@ -21086,9 +21097,6 @@ function createCustomEqual(options = {}) {
21086
21097
  const equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
21087
21098
  return createIsEqual({ circular, comparator, createState, equals, strict });
21088
21099
  }
21089
-
21090
- // ../../node_modules/@tiptap/react/dist/index.js
21091
- var import_with_selector = __toESM(require_with_selector(), 1);
21092
21100
  var mergeRefs = (...refs) => {
21093
21101
  return (node) => {
21094
21102
  refs.forEach((ref) => {
@@ -21101,7 +21109,7 @@ var mergeRefs = (...refs) => {
21101
21109
  };
21102
21110
  };
21103
21111
  var Portals = ({ contentComponent }) => {
21104
- const renderers = (0, import_shim.useSyncExternalStore)(
21112
+ const renderers = useSyncExternalStore(
21105
21113
  contentComponent.subscribe,
21106
21114
  contentComponent.getSnapshot,
21107
21115
  contentComponent.getServerSnapshot
@@ -21302,7 +21310,7 @@ var EditorStateManager = class {
21302
21310
  function useEditorState(options) {
21303
21311
  var _a2;
21304
21312
  const [editorStateManager] = useState(() => new EditorStateManager(options.editor));
21305
- const selectedState = (0, import_with_selector.useSyncExternalStoreWithSelector)(
21313
+ const selectedState = useSyncExternalStoreWithSelector(
21306
21314
  editorStateManager.subscribe,
21307
21315
  editorStateManager.getSnapshot,
21308
21316
  editorStateManager.getServerSnapshot,
@@ -21315,7 +21323,7 @@ function useEditorState(options) {
21315
21323
  useDebugValue(selectedState);
21316
21324
  return selectedState;
21317
21325
  }
21318
- var isDev2 = process.env.NODE_ENV !== "production";
21326
+ var isDev2 = true;
21319
21327
  var isSSR = typeof window === "undefined";
21320
21328
  var isNext = isSSR || Boolean(typeof window !== "undefined" && window.next);
21321
21329
  var EditorInstanceManager = class _EditorInstanceManager {
@@ -21354,7 +21362,7 @@ var EditorInstanceManager = class _EditorInstanceManager {
21354
21362
  immediatelyRender = false;
21355
21363
  } else if (isNext && explicit === void 0) {
21356
21364
  immediatelyRender = false;
21357
- if (isDev2) {
21365
+ {
21358
21366
  console.warn(
21359
21367
  "Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client."
21360
21368
  );
@@ -21558,7 +21566,7 @@ function useEditor(options = {}, deps = []) {
21558
21566
  const mostRecentOptions = useRef(options);
21559
21567
  mostRecentOptions.current = options;
21560
21568
  const [instanceManager] = useState(() => new EditorInstanceManager(mostRecentOptions));
21561
- const editor = (0, import_shim2.useSyncExternalStore)(
21569
+ const editor = useSyncExternalStore(
21562
21570
  instanceManager.subscribe,
21563
21571
  instanceManager.getEditor,
21564
21572
  instanceManager.getServerSnapshot
@@ -41474,7 +41482,7 @@ function useThemeMode() {
41474
41482
  },
41475
41483
  [setTheme]
41476
41484
  );
41477
- const sdkDark = useSyncExternalStore(
41485
+ const sdkDark = useSyncExternalStore$1(
41478
41486
  subscribeSdkDarkMode,
41479
41487
  getSdkDarkMode,
41480
41488
  () => null
@@ -41781,7 +41789,7 @@ function fromUniver(uw) {
41781
41789
  })
41782
41790
  };
41783
41791
  }
41784
- var UniverWorkbookView = dynamic(() => import('./univer-workbook-N5IIN7CH.js'), {
41792
+ var UniverWorkbookView = dynamic(() => import('./univer-workbook-LSBVETAQ.js'), {
41785
41793
  ssr: false,
41786
41794
  loading: () => /* @__PURE__ */ jsx(ArtifactSkeleton, { format: "sheet" })
41787
41795
  });
@@ -41879,7 +41887,7 @@ function SheetEditor({ content, onSave, readOnly = false }) {
41879
41887
  );
41880
41888
  }
41881
41889
  var PdfDocumentViewInner = dynamic(
41882
- () => import('./pdf-document-view-inner-CP6VFHG4.js'),
41890
+ () => import('./pdf-document-view-inner-NC5MBN7X.js'),
41883
41891
  {
41884
41892
  ssr: false,
41885
41893
  loading: () => /* @__PURE__ */ jsx(ArtifactSkeleton, { format: "pdf" })
@@ -42492,7 +42500,7 @@ function HtmlDeckView({ content, inChat = false, versionSlot }) {
42492
42500
  !present && inChat && /* @__PURE__ */ jsx(DeckEditPanel, { currentIndex: sel, currentHtml: slides[sel]?.html ?? "" })
42493
42501
  ] });
42494
42502
  }
42495
- var Inner = dynamic(() => import('./pdf-deck-view-inner-3PVGFH26.js'), {
42503
+ var Inner = dynamic(() => import('./pdf-deck-view-inner-AY4FYDAJ.js'), {
42496
42504
  ssr: false,
42497
42505
  loading: () => /* @__PURE__ */ jsx(ArtifactSkeleton, { format: "htmldeck" })
42498
42506
  });
@@ -44254,7 +44262,7 @@ function QrShareDialog({ target, onOpenChange }) {
44254
44262
  if (state !== "ready" || !link2 || !canvasRef.current) return;
44255
44263
  let cancelled = false;
44256
44264
  void (async () => {
44257
- const QRCode = (await import('./lib-3ZKX25RJ.js')).default;
44265
+ const QRCode = (await import('./browser-DK2ZWH4A.js')).default;
44258
44266
  if (cancelled || !canvasRef.current) return;
44259
44267
  await QRCode.toCanvas(canvasRef.current, link2, {
44260
44268
  width: 260,
@@ -53216,7 +53224,8 @@ function useManifest(surface) {
53216
53224
  fetch: { signal: requestController.signal }
53217
53225
  });
53218
53226
  if (error3) throw error3;
53219
- return { data: { agents: unwrap(data2) ?? [] } };
53227
+ const list2 = unwrapData(data2);
53228
+ return { data: { agents: Array.isArray(list2) ? list2 : [] } };
53220
53229
  }
53221
53230
  const query = surface ? { surface } : {};
53222
53231
  const { data, error: error2 } = await client.v1.manifest.get({
@@ -53777,7 +53786,8 @@ var COMPOSER_OUTPUT_MODES = [
53777
53786
  // src/vendor/ui/chat/chat-input-bar/hooks/use-composer-output-modes.ts
53778
53787
  function useComposerOutputModes(agentId) {
53779
53788
  const manifestQuery = useManifest("chat");
53780
- const agents = manifestQuery.data?.data?.agents ?? [];
53789
+ const raw = manifestQuery.data?.data?.agents;
53790
+ const agents = Array.isArray(raw) ? raw : [];
53781
53791
  return useMemo(() => {
53782
53792
  if (!agentId) return [];
53783
53793
  const entry = agents.find(
@@ -59722,15 +59732,18 @@ function currentToolActivity(messages) {
59722
59732
  }
59723
59733
  return null;
59724
59734
  }
59735
+ var REASONING_EFFORTS = ["max", "xhigh", "high", "medium", "low", "minimal", "none"];
59736
+ function isReasoningEffort(value) {
59737
+ return !!value && REASONING_EFFORTS.includes(value);
59738
+ }
59725
59739
  var lastPanelConversation;
59740
+ var NEW_SESSION_KEY = "__new__";
59726
59741
  function FronteraChat({
59727
59742
  conversationId: initialConversationId,
59728
59743
  agentName: pinnedAgentName,
59729
59744
  agentPicker = true,
59730
59745
  agentId,
59731
- modes,
59732
- modelMode,
59733
- defaultMode,
59746
+ modelSelector = true,
59734
59747
  fileUpload = true,
59735
59748
  approvalSelector = true,
59736
59749
  appsButton = false,
@@ -59798,12 +59811,13 @@ function FronteraChat({
59798
59811
  if (!chatClient || !connectRedirectUri) return null;
59799
59812
  return {
59800
59813
  connect: async ({ installId, pendingToolCallId, catalogDisplayName }) => {
59801
- await runAppConnection(chatClient, {
59814
+ const outcome = await runAppConnection(chatClient, {
59802
59815
  ...pendingToolCallId ? { pendingToolCallId } : {},
59803
59816
  installId,
59804
59817
  redirectUri: connectRedirectUri,
59805
59818
  expectedOrigin: connectOrigin
59806
59819
  });
59820
+ if (!connectionOrThrow(outcome).continued) return;
59807
59821
  if (!pendingToolCallId) return;
59808
59822
  if (nudgedRef.current.has(pendingToolCallId)) return;
59809
59823
  nudgedRef.current.add(pendingToolCallId);
@@ -59822,18 +59836,55 @@ function FronteraChat({
59822
59836
  slug: agent2.agentId,
59823
59837
  avatarConfig: agent2.avatarConfig,
59824
59838
  avatarSeed: agent2.agentId,
59825
- modes: [],
59826
- defaultMode: ""
59839
+ modes: agent2.modes ?? [],
59840
+ defaultMode: agent2.defaultMode ?? ""
59827
59841
  })),
59828
59842
  [agents]
59829
59843
  );
59844
+ const agentModes = useMemo(() => {
59845
+ if (!modelSelector) return void 0;
59846
+ const source = chosenAgent?.modes ?? agents.find((a) => a.agentId === agentName)?.modes;
59847
+ if (!source?.length) return void 0;
59848
+ return Object.fromEntries(
59849
+ source.map((mode) => [
59850
+ mode.key,
59851
+ {
59852
+ name: mode.name,
59853
+ ...mode.description ? { description: mode.description } : {},
59854
+ ...mode.style ? { style: mode.style } : {},
59855
+ ...mode.reasoning ? { reasoning: mode.reasoning } : {}
59856
+ }
59857
+ ])
59858
+ );
59859
+ }, [modelSelector, chosenAgent, agents, agentName]);
59860
+ const agentDefaultMode = chosenAgent?.defaultMode ?? agents.find((a) => a.agentId === agentName)?.defaultMode ?? void 0;
59861
+ const sessionKey = conversationId ?? NEW_SESSION_KEY;
59862
+ const reasoningEffort = useChatStreamStore(
59863
+ (state) => state.reasoningEffortBySession[sessionKey]
59864
+ );
59865
+ const [chosenMode, setChosenMode] = useState(void 0);
59866
+ const modelMode = chosenMode ?? agentDefaultMode;
59867
+ useEffect(() => {
59868
+ setChosenMode(void 0);
59869
+ }, [agentName]);
59830
59870
  useEffect(() => {
59831
59871
  if (chosenAgent || pinnedAgentName || agents.length === 0) return;
59832
59872
  if (conversationId) return;
59833
59873
  setChosenAgent(agents[0]);
59834
59874
  }, [agents, chosenAgent, pinnedAgentName, conversationId]);
59835
59875
  const bodyRef = useRef({});
59836
- bodyRef.current = { ...agentName ? { agentName } : {}, ...body };
59876
+ bodyRef.current = {
59877
+ ...agentName ? { agentName } : {},
59878
+ ...modelMode ? { modelMode } : {},
59879
+ /*
59880
+ The store holds whatever the selector wrote, as a string; the request
59881
+ takes a closed union. Narrowed rather than widened — an effort the
59882
+ deployment does not know is refused at the send, and a cast here would
59883
+ turn that into a 400 the person cannot act on.
59884
+ */
59885
+ ...isReasoningEffort(reasoningEffort) ? { reasoningEffort } : {},
59886
+ ...body
59887
+ };
59837
59888
  const transport = useMemo(
59838
59889
  () => createChatTransport(() => getClient(), {
59839
59890
  conversationId: initialConversationId,
@@ -59842,6 +59893,12 @@ function FronteraChat({
59842
59893
  // instead of a failed send the person has to repeat themselves after.
59843
59894
  onUnauthorized: () => refreshCredential(),
59844
59895
  onStart: (info) => {
59896
+ const stream = useChatStreamStore.getState();
59897
+ const pendingEffort = stream.reasoningEffortBySession[NEW_SESSION_KEY];
59898
+ if (pendingEffort) {
59899
+ stream.setReasoningEffort(info.conversationId, pendingEffort);
59900
+ stream.setReasoningEffort(NEW_SESSION_KEY, null);
59901
+ }
59845
59902
  setConversationId(info.conversationId);
59846
59903
  onStart?.({ conversationId: info.conversationId, runId: info.runId });
59847
59904
  }
@@ -60085,9 +60142,11 @@ function FronteraChat({
60085
60142
  status: ready ? status : "submitted",
60086
60143
  stop,
60087
60144
  placeholder,
60088
- modes,
60145
+ modes: agentModes,
60146
+ defaultMode: agentDefaultMode,
60089
60147
  modelMode,
60090
- defaultMode,
60148
+ onModelModeChange: modelSelector ? setChosenMode : void 0,
60149
+ sessionKey,
60091
60150
  approvalMode,
60092
60151
  onApprovalModeChange: approvalSelector ? changeApprovalMode : void 0,
60093
60152
  modeOptions: approvalSelector ? approvalModeOptions : void 0,