@frontera-sdk/chat-ui 1.52.43 → 1.52.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat.js +4 -4
- package/dist/{chunk-WO2UNC2J.js → chunk-2G3EHYNS.js} +1 -1
- package/dist/{chunk-3J7EDXMY.js → chunk-5SGSD4HS.js} +1 -1
- package/dist/{chunk-37G6MHWS.js → chunk-QGGYWRGV.js} +10 -3
- package/dist/{chunk-4DWSQQQE.js → chunk-TY6QQSAF.js} +48 -21
- package/dist/client.js +2 -2
- package/dist/credential.d.ts +18 -1
- package/dist/credential.js +1 -1
- package/dist/header.js +2 -2
- package/dist/message.js +2 -2
- package/dist/platform.css +1 -1
- package/package.json +3 -3
package/dist/chat.js
CHANGED
|
@@ -7,12 +7,12 @@ import { PendingCards } from './chunk-N3I3MZTY.js';
|
|
|
7
7
|
import { themeToStyle } from './chunk-6HYPVNVA.js';
|
|
8
8
|
import { useChatAgents } from './chunk-O6CVTMZJ.js';
|
|
9
9
|
import { subjectOfChatToken, capabilitiesOfChatToken } from './chunk-CCVPZVFK.js';
|
|
10
|
-
import { useChatCredential } from './chunk-
|
|
10
|
+
import { useChatCredential } from './chunk-QGGYWRGV.js';
|
|
11
11
|
import './chunk-WDYCLC4F.js';
|
|
12
|
-
import { chatSidePanelSessionKey, Chart1Icon, 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, ChainLink1Icon, ChatOverviewContent, COMPUTER_TAB_PREFIX, SourceRow, motion, MAX_CHAT_SIDE_PANEL_SESSIONS, DEFAULT_CHAT_SIDE_PANEL_SIZE, TableIcon } from './chunk-
|
|
12
|
+
import { chatSidePanelSessionKey, Chart1Icon, 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, ChainLink1Icon, ChatOverviewContent, COMPUTER_TAB_PREFIX, SourceRow, motion, MAX_CHAT_SIDE_PANEL_SESSIONS, DEFAULT_CHAT_SIDE_PANEL_SIZE, TableIcon } from './chunk-5SGSD4HS.js';
|
|
13
13
|
import './chunk-X3QVICX7.js';
|
|
14
|
-
import { dynamic, useChatStreamStore, useComposerStore, Message, Thinking, setPendingFiles, usePersonConfirmations, unshownPendingConfirmations, ConversationConfirmationCard, useLivePreviewUrl, ArrowRotateClockwiseIcon, useComputerFiles, useUploadComputerFile, CanvasWidget, isPlainTextLanguage, useUploadFile, COMPOSER_ID_MAIN, useContextWindowInfo, useIsCompacting, useQueuedMessages, VolumeFullIcon, WarningSignIcon, useComputer, csvTextToWorkbookJson, CSV_PREVIEW_MAX_ROWS, CopyButton, COMPOSER_ID_COPILOT, ModelIcon, modeToBrandRow, useBackDismiss, PdfViewer, brandLabel, Spinner } from './chunk-
|
|
15
|
-
import { Textarea, artifactFormatIcon, BookIcon, useAgentRoster, ShieldCheckIcon, useArtifactStore, useCanvasStore, useChatOverviewStore, setSdkConversationPath, setSdkDarkMode, AgentsProvider, PluginProvider, WorkspaceProvider, TooltipProvider, getPersonConfirmation, isToolPart, getToolState, getToolName, getToolInput, sourceKind, extractDomain, CitationViewerContext, MarkdownRenderer, ConnectRunnerContext, usePathname, usePaneFocusStore, useAgentPanelStore, Tooltip, TooltipTrigger, TooltipContent, StudioDisplayIcon, WorldIcon, SlidesWideIcon, ArtifactActionsMenu, DotGrid1x3HorizontalTightIcon, ArrowsShowIcon, useKeyboardInset, ExclamationCircleIcon, getToolOutput, useArtifact, useUpdateArtifact, useArtifactFileObjectUrl, resolveArtifactIconFormat, useSourcesEnrichment, LoaderIcon, FileDownloadIcon, Label, Input, renderPluginBlock, useArtifactVersion, useChatCapabilities, useChatCapabilityEnabled, useChatOptInEnabled, useSessionPendingApprovals, tableToCsv, tableToXlsx, tableToMarkdown, DropdownMenu, DropdownMenuTrigger, StyledDropdownMenuContent, StyledDropdownMenuItem, useArtifactVersions, useClient, unwrapData, authFetch, getBearerHeadersForApi, EyeOpenIcon, EyeSlashIcon, useRestoreArtifactVersion, ZoomableImage, ChatImageLightbox, useDownloadArtifact, useArtifactFileBytes, useArtifactPreviewFileObjectUrl, useArtifactVersionPreviewFileObjectUrl, errorText, SpreadsheetIcon, FilePdfIcon, useOptionalWorkspaceContext, useAgentConnectionStatus, useArtifacts, useSession, useWorkspaceContext, useConversationDesktopStatus, isRequestHumanTool, appsKeys, unwrapDataDeep, useRouter, Images1Icon, ArrowUpIcon, VideoIcon, AudioIcon, useBrand, resolveBearerHeaders, subscribeSdkDarkMode, getSdkDarkMode, unwrap, useConnectRunner, useStartUserConnect, useUpsertGrant, useRevokeGrant, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, LayoutGrid1Icon, useCatalog, useInstalls, useWorkspaceSlug, buildTenantUrlAbsolute } from './chunk-
|
|
14
|
+
import { dynamic, useChatStreamStore, useComposerStore, Message, Thinking, setPendingFiles, usePersonConfirmations, unshownPendingConfirmations, ConversationConfirmationCard, useLivePreviewUrl, ArrowRotateClockwiseIcon, useComputerFiles, useUploadComputerFile, CanvasWidget, isPlainTextLanguage, useUploadFile, COMPOSER_ID_MAIN, useContextWindowInfo, useIsCompacting, useQueuedMessages, VolumeFullIcon, WarningSignIcon, useComputer, csvTextToWorkbookJson, CSV_PREVIEW_MAX_ROWS, CopyButton, COMPOSER_ID_COPILOT, ModelIcon, modeToBrandRow, useBackDismiss, PdfViewer, brandLabel, Spinner } from './chunk-2G3EHYNS.js';
|
|
15
|
+
import { Textarea, artifactFormatIcon, BookIcon, useAgentRoster, ShieldCheckIcon, useArtifactStore, useCanvasStore, useChatOverviewStore, setSdkConversationPath, setSdkDarkMode, AgentsProvider, PluginProvider, WorkspaceProvider, TooltipProvider, getPersonConfirmation, isToolPart, getToolState, getToolName, getToolInput, sourceKind, extractDomain, CitationViewerContext, MarkdownRenderer, ConnectRunnerContext, usePathname, usePaneFocusStore, useAgentPanelStore, Tooltip, TooltipTrigger, TooltipContent, StudioDisplayIcon, WorldIcon, SlidesWideIcon, ArtifactActionsMenu, DotGrid1x3HorizontalTightIcon, ArrowsShowIcon, useKeyboardInset, ExclamationCircleIcon, getToolOutput, useArtifact, useUpdateArtifact, useArtifactFileObjectUrl, resolveArtifactIconFormat, useSourcesEnrichment, LoaderIcon, FileDownloadIcon, Label, Input, renderPluginBlock, useArtifactVersion, useChatCapabilities, useChatCapabilityEnabled, useChatOptInEnabled, useSessionPendingApprovals, tableToCsv, tableToXlsx, tableToMarkdown, DropdownMenu, DropdownMenuTrigger, StyledDropdownMenuContent, StyledDropdownMenuItem, useArtifactVersions, useClient, unwrapData, authFetch, getBearerHeadersForApi, EyeOpenIcon, EyeSlashIcon, useRestoreArtifactVersion, ZoomableImage, ChatImageLightbox, useDownloadArtifact, useArtifactFileBytes, useArtifactPreviewFileObjectUrl, useArtifactVersionPreviewFileObjectUrl, errorText, SpreadsheetIcon, FilePdfIcon, useOptionalWorkspaceContext, useAgentConnectionStatus, useArtifacts, useSession, useWorkspaceContext, useConversationDesktopStatus, isRequestHumanTool, appsKeys, unwrapDataDeep, useRouter, Images1Icon, ArrowUpIcon, VideoIcon, AudioIcon, useBrand, resolveBearerHeaders, subscribeSdkDarkMode, getSdkDarkMode, unwrap, useConnectRunner, useStartUserConnect, useUpsertGrant, useRevokeGrant, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, LayoutGrid1Icon, useCatalog, useInstalls, useWorkspaceSlug, buildTenantUrlAbsolute } from './chunk-TY6QQSAF.js';
|
|
16
16
|
import { ChevronLeftIcon } from './chunk-CWAOLMFS.js';
|
|
17
17
|
import { Popover, PopoverTrigger, PopoverContent, Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription } from './chunk-T5SANYSX.js';
|
|
18
18
|
import { MOBILE_BREAKPOINT, useIsMobile, I18nProvider, useTranslation } from './chunk-3ED4DPTV.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
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, DotGrid1x3HorizontalTightIcon, useArtifact, resolveArtifactIconFormat, artifactFormatIcon, useArtifactFileObjectUrl, artifactFormatSubtitle, ChatImageLightbox, ArrowsShowIcon, FileDownloadIcon, useClient, processMessageParts, getMessageDisplayTimestampValue, getMessageCreatedAtMs, isApprovalRequested, extractCitationsFromSteps, useSourcesEnrichment, extractImagesFromSteps, dedupeImageResults, getDocumentStreamArtifacts, getToolOutput, useCanvasStore, ImageResultsGallery, MessageDecisionCards, useChatCapabilities, useOptionalWorkspaceContext, useCitationViewer, useChatOverviewStore, dedup, extractDomain, sourceKind, SourceFavicon, Input, exportDocumentPdf, FilePdfIcon, StudioDisplayIcon, WorldIcon, MessageStepsGroup, getToolState, getToolInput, getToolErrorText, useChatOptInEnabled, ArrowRightIcon, formatFileSize, FileThumbnail, attachmentFileOf, MobileScreenSheet, useAgentHistorySource, treatyErrorMessage, useRouter, useBasePath, useAgentPanelStore, AgentRoutineForm, getFileCategory, unwrap, unwrapData, unwrapDataDeep, formatDecisionTime, DecisionCard, LoaderIcon, formatRelativeTime, CircleCheckIcon, agentRoutineKeys, useOptionalAgentsContext, avatarMotionForStream, AGENT_AVATAR_SIZE } from './chunk-
|
|
2
|
+
import { usePlugins, useChatCapabilityEnabled, resolvePluginLanguage, renderPluginBlock, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, ActionMenu, useArtifactStore, ArtifactActionsMenu, DotGrid1x3HorizontalTightIcon, useArtifact, resolveArtifactIconFormat, artifactFormatIcon, useArtifactFileObjectUrl, artifactFormatSubtitle, ChatImageLightbox, ArrowsShowIcon, FileDownloadIcon, useClient, processMessageParts, getMessageDisplayTimestampValue, getMessageCreatedAtMs, isApprovalRequested, extractCitationsFromSteps, useSourcesEnrichment, extractImagesFromSteps, dedupeImageResults, getDocumentStreamArtifacts, getToolOutput, useCanvasStore, ImageResultsGallery, MessageDecisionCards, useChatCapabilities, useOptionalWorkspaceContext, useCitationViewer, useChatOverviewStore, dedup, extractDomain, sourceKind, SourceFavicon, Input, exportDocumentPdf, FilePdfIcon, StudioDisplayIcon, WorldIcon, MessageStepsGroup, getToolState, getToolInput, getToolErrorText, useChatOptInEnabled, ArrowRightIcon, formatFileSize, FileThumbnail, attachmentFileOf, MobileScreenSheet, useAgentHistorySource, treatyErrorMessage, useRouter, useBasePath, useAgentPanelStore, AgentRoutineForm, getFileCategory, unwrap, unwrapData, unwrapDataDeep, formatDecisionTime, DecisionCard, LoaderIcon, formatRelativeTime, CircleCheckIcon, agentRoutineKeys, useOptionalAgentsContext, avatarMotionForStream, AGENT_AVATAR_SIZE } from './chunk-TY6QQSAF.js';
|
|
3
3
|
import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription, Popover, PopoverTrigger, PopoverContent } from './chunk-T5SANYSX.js';
|
|
4
4
|
import { useIsMobile, useTranslation } from './chunk-3ED4DPTV.js';
|
|
5
5
|
import { MessageToolbar, MessageResponse, SquareArrowTopRightIcon, FileTextIcon, Shimmer, ClipboardIcon, Message, MessageContent, PencilIcon, deferDuringLayoutMotion, HoverCard, HoverCardTrigger, HoverCardContent, Collapse, Icon, CircleXIcon, ClockIcon } from './chunk-X33KXNO3.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { MagnifyingGlassIcon } from './chunk-X3QVICX7.js';
|
|
3
|
-
import { requestPaneFocus, useArtifacts, usePlugins, useCanvasStore, useArtifactStore, useChatOverviewStore, useSourcesEnrichment, sourceKind, useCitationViewer, resolveSourceDisplay, extractDomain, canvasId, StudioDisplayIcon, LayoutDashboardIcon, 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, DotGrid1x3HorizontalTightIcon, extractCitationsFromSteps, resolvePluginLanguage, getMessageDisplayTimestampValue } from './chunk-
|
|
3
|
+
import { requestPaneFocus, useArtifacts, usePlugins, useCanvasStore, useArtifactStore, useChatOverviewStore, useSourcesEnrichment, sourceKind, useCitationViewer, resolveSourceDisplay, extractDomain, canvasId, StudioDisplayIcon, LayoutDashboardIcon, 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, DotGrid1x3HorizontalTightIcon, extractCitationsFromSteps, resolvePluginLanguage, getMessageDisplayTimestampValue } from './chunk-TY6QQSAF.js';
|
|
4
4
|
import { Popover, PopoverTrigger, PopoverContent, Sheet, SheetContent, SheetHeader, SheetTitle } from './chunk-T5SANYSX.js';
|
|
5
5
|
import { useTranslation, useIsMobile } from './chunk-3ED4DPTV.js';
|
|
6
6
|
import { Collapsible, CollapsibleTrigger, CollapsibleContent, Shimmer, HoverCard, HoverCardTrigger, HoverCardContent } from './chunk-X33KXNO3.js';
|
|
@@ -3,6 +3,7 @@ import { tokenEndpointError } from './chunk-WDYCLC4F.js';
|
|
|
3
3
|
import { useState, useRef, useMemo, useEffect, useCallback } from 'react';
|
|
4
4
|
import { FronteraClient } from '@frontera-sdk/core/client';
|
|
5
5
|
import { createTokenSession } from '@frontera-sdk/chat/token-session';
|
|
6
|
+
import { mintPublicChatToken } from '@frontera-sdk/chat/public-token';
|
|
6
7
|
|
|
7
8
|
function useChatCredential(props) {
|
|
8
9
|
const suppliedClient = props.client;
|
|
@@ -16,6 +17,7 @@ function useChatCredential(props) {
|
|
|
16
17
|
const staticToken = props.token;
|
|
17
18
|
const apiBaseUrl = props.apiBaseUrl;
|
|
18
19
|
const tokenEndpoint = props.tokenEndpoint;
|
|
20
|
+
const publishableKey = props.publishableKey;
|
|
19
21
|
const getToken = props.getToken;
|
|
20
22
|
const staticClient = useMemo(() => {
|
|
21
23
|
if (!suppliedClient) return null;
|
|
@@ -42,14 +44,19 @@ function useChatCredential(props) {
|
|
|
42
44
|
setReady(true);
|
|
43
45
|
return;
|
|
44
46
|
}
|
|
45
|
-
if (
|
|
46
|
-
setError(new Error("
|
|
47
|
+
if (publishableKey && !apiBaseUrl) {
|
|
48
|
+
setError(new Error("Passing `publishableKey` also requires `apiBaseUrl`"));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (!tokenEndpoint && !getToken && !publishableKey) {
|
|
52
|
+
setError(new Error("Pass one of: tokenEndpoint, publishableKey + apiBaseUrl, token + apiBaseUrl, getToken, or client"));
|
|
47
53
|
return;
|
|
48
54
|
}
|
|
49
55
|
let disposed = false;
|
|
50
56
|
let session = null;
|
|
51
57
|
async function loadFromHost() {
|
|
52
58
|
if (getToken) return getToken();
|
|
59
|
+
if (publishableKey) return mintPublicChatToken({ apiBaseUrl, publishableKey });
|
|
53
60
|
const response = await fetch(tokenEndpoint, { method: "POST", credentials: "same-origin" });
|
|
54
61
|
if (!response.ok) throw await tokenEndpointError(response);
|
|
55
62
|
return await response.json();
|
|
@@ -84,7 +91,7 @@ function useChatCredential(props) {
|
|
|
84
91
|
session?.dispose();
|
|
85
92
|
sessionRef.current = null;
|
|
86
93
|
};
|
|
87
|
-
}, [staticClient, staticToken, apiBaseUrl, tokenEndpoint, getToken]);
|
|
94
|
+
}, [staticClient, staticToken, apiBaseUrl, tokenEndpoint, getToken, publishableKey]);
|
|
88
95
|
const getClient = useMemo(
|
|
89
96
|
() => staticClient ? () => staticClient() : () => sessionRef.current?.getClient() ?? clientRef.current,
|
|
90
97
|
[staticClient]
|
|
@@ -10057,6 +10057,52 @@ function usePlugins() {
|
|
|
10057
10057
|
}
|
|
10058
10058
|
return ctx;
|
|
10059
10059
|
}
|
|
10060
|
+
|
|
10061
|
+
// ../platform-kit/src/lib/api/treaty-helpers.ts
|
|
10062
|
+
var OBJECT_STRING = "[object Object]";
|
|
10063
|
+
function readableText(value) {
|
|
10064
|
+
return typeof value === "string" && value.trim() && value !== OBJECT_STRING ? value : null;
|
|
10065
|
+
}
|
|
10066
|
+
function treatyErrorMessage(err, fallback = "Request failed") {
|
|
10067
|
+
if (err && typeof err === "object" && "value" in err) {
|
|
10068
|
+
const value = err.value;
|
|
10069
|
+
if (value && typeof value === "object") {
|
|
10070
|
+
const body = value;
|
|
10071
|
+
const m = readableText(body.message) ?? readableText(body.error) ?? readableText(body.summary);
|
|
10072
|
+
if (m) return m;
|
|
10073
|
+
}
|
|
10074
|
+
const text2 = readableText(value);
|
|
10075
|
+
if (text2) return text2;
|
|
10076
|
+
}
|
|
10077
|
+
if (err && typeof err === "object" && "message" in err) {
|
|
10078
|
+
const m = readableText(err.message);
|
|
10079
|
+
if (m) return m;
|
|
10080
|
+
}
|
|
10081
|
+
return readableText(err) ?? fallback;
|
|
10082
|
+
}
|
|
10083
|
+
function withReadableMessage(result) {
|
|
10084
|
+
const error = result?.error;
|
|
10085
|
+
if (error instanceof Error && "value" in error) {
|
|
10086
|
+
const status = result.status;
|
|
10087
|
+
error.message = treatyErrorMessage(error, status ? `Request failed (${status})` : "Request failed");
|
|
10088
|
+
}
|
|
10089
|
+
return result;
|
|
10090
|
+
}
|
|
10091
|
+
function withReadableErrors(client) {
|
|
10092
|
+
if (typeof client !== "function") return client;
|
|
10093
|
+
return new Proxy(client, {
|
|
10094
|
+
get(target, prop, receiver) {
|
|
10095
|
+
return withReadableErrors(Reflect.get(target, prop, receiver));
|
|
10096
|
+
},
|
|
10097
|
+
apply(target, thisArg, args) {
|
|
10098
|
+
const result = Reflect.apply(target, thisArg, args);
|
|
10099
|
+
if (result instanceof Promise) return result.then(withReadableMessage);
|
|
10100
|
+
return withReadableErrors(result);
|
|
10101
|
+
}
|
|
10102
|
+
});
|
|
10103
|
+
}
|
|
10104
|
+
|
|
10105
|
+
// src/adapters/lib/api.ts
|
|
10060
10106
|
function isPlatformOnly(url) {
|
|
10061
10107
|
const path2 = url.split("?")[0] ?? url;
|
|
10062
10108
|
return (
|
|
@@ -10083,7 +10129,7 @@ function emptyEnvelope() {
|
|
|
10083
10129
|
}
|
|
10084
10130
|
function createApiClient(baseUrl, headers, options = {}) {
|
|
10085
10131
|
const platformSurfaces = options.platformSurfaces ?? true;
|
|
10086
|
-
return treaty(baseUrl, {
|
|
10132
|
+
return withReadableErrors(treaty(baseUrl, {
|
|
10087
10133
|
headers,
|
|
10088
10134
|
...platformSurfaces ? {} : {
|
|
10089
10135
|
fetcher: ((input, init) => {
|
|
@@ -10097,7 +10143,7 @@ function createApiClient(baseUrl, headers, options = {}) {
|
|
|
10097
10143
|
// a payload carrying arbitrary strings hands React a `Date` and crashes
|
|
10098
10144
|
// the render. The service speaks ISO strings; parse at the point of use.
|
|
10099
10145
|
parseDate: false
|
|
10100
|
-
});
|
|
10146
|
+
}));
|
|
10101
10147
|
}
|
|
10102
10148
|
function unwrap(data) {
|
|
10103
10149
|
if (data && typeof data === "object" && "error" in data && data.error !== false) {
|
|
@@ -12472,25 +12518,6 @@ var Textarea = React29.forwardRef(function Textarea2({ className, ...props }, re
|
|
|
12472
12518
|
);
|
|
12473
12519
|
});
|
|
12474
12520
|
|
|
12475
|
-
// ../platform-kit/src/lib/api/treaty-helpers.ts
|
|
12476
|
-
function treatyErrorMessage(err, fallback = "Request failed") {
|
|
12477
|
-
if (err && typeof err === "object" && "value" in err) {
|
|
12478
|
-
const value = err.value;
|
|
12479
|
-
if (value && typeof value === "object" && "message" in value) {
|
|
12480
|
-
const m = value.message;
|
|
12481
|
-
if (typeof m === "string" && m.trim()) return m;
|
|
12482
|
-
}
|
|
12483
|
-
if (typeof value === "string" && value.trim()) return value;
|
|
12484
|
-
}
|
|
12485
|
-
if (err instanceof Error) return err.message;
|
|
12486
|
-
if (err && typeof err === "object" && "message" in err) {
|
|
12487
|
-
const m = err.message;
|
|
12488
|
-
if (typeof m === "string" && m.trim()) return m;
|
|
12489
|
-
if (m != null) return String(m);
|
|
12490
|
-
}
|
|
12491
|
-
return fallback;
|
|
12492
|
-
}
|
|
12493
|
-
|
|
12494
12521
|
// ../chat/src/ui/agent-mode/utils/routine-schedule.ts
|
|
12495
12522
|
function routineScheduleCron(schedule) {
|
|
12496
12523
|
const [hour, minute] = schedule.time.split(":").map(Number);
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
export { capabilitiesOfChatToken, subjectOfChatToken } from './chunk-CCVPZVFK.js';
|
|
3
|
-
import { useChatCredential } from './chunk-
|
|
4
|
-
export { useChatCredential } from './chunk-
|
|
3
|
+
import { useChatCredential } from './chunk-QGGYWRGV.js';
|
|
4
|
+
export { useChatCredential } from './chunk-QGGYWRGV.js';
|
|
5
5
|
import './chunk-WDYCLC4F.js';
|
|
6
6
|
export { ChatClientContext, useChatClientOptional } from './chunk-6JLWE7M3.js';
|
|
7
7
|
import './chunk-PR4QN5HX.js';
|
package/dist/credential.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { FronteraClient } from '@frontera-sdk/core/client';
|
|
|
3
3
|
/**
|
|
4
4
|
* How a component gets its credential.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Five shapes, ordered by how much the caller wants to manage. Every chat
|
|
7
7
|
* component in this package accepts the same union, so moving between
|
|
8
8
|
* `FronteraChat`, `FronteraChatFrame` and the script embed is a change of
|
|
9
9
|
* component, not of plumbing.
|
|
@@ -22,6 +22,20 @@ type ChatCredentialProps = {
|
|
|
22
22
|
token?: never;
|
|
23
23
|
getToken?: never;
|
|
24
24
|
client?: never;
|
|
25
|
+
publishableKey?: never;
|
|
26
|
+
} | {
|
|
27
|
+
/**
|
|
28
|
+
* An Agent's public website key (`fpk_…`), for a public site whose
|
|
29
|
+
* visitors have no account. Safe in page code: it reaches that one Agent,
|
|
30
|
+
* only from the origins listed on the key, and the token it starts can
|
|
31
|
+
* only chat. No endpoint of your own is needed.
|
|
32
|
+
*/
|
|
33
|
+
publishableKey: string;
|
|
34
|
+
apiBaseUrl: string;
|
|
35
|
+
tokenEndpoint?: never;
|
|
36
|
+
token?: never;
|
|
37
|
+
getToken?: never;
|
|
38
|
+
client?: never;
|
|
25
39
|
} | {
|
|
26
40
|
/**
|
|
27
41
|
* A token you already hold. You then own replacing it before it expires
|
|
@@ -32,6 +46,7 @@ type ChatCredentialProps = {
|
|
|
32
46
|
tokenEndpoint?: never;
|
|
33
47
|
getToken?: never;
|
|
34
48
|
client?: never;
|
|
49
|
+
publishableKey?: never;
|
|
35
50
|
} | {
|
|
36
51
|
/** Fetch the token however you like; called again on refresh. */
|
|
37
52
|
getToken: () => Promise<{
|
|
@@ -43,6 +58,7 @@ type ChatCredentialProps = {
|
|
|
43
58
|
tokenEndpoint?: never;
|
|
44
59
|
token?: never;
|
|
45
60
|
client?: never;
|
|
61
|
+
publishableKey?: never;
|
|
46
62
|
} | {
|
|
47
63
|
/**
|
|
48
64
|
* A client you built yourself. Pass a getter if you rotate tokens.
|
|
@@ -57,6 +73,7 @@ type ChatCredentialProps = {
|
|
|
57
73
|
token?: never;
|
|
58
74
|
getToken?: never;
|
|
59
75
|
apiBaseUrl?: never;
|
|
76
|
+
publishableKey?: never;
|
|
60
77
|
};
|
|
61
78
|
interface ResolvedCredential {
|
|
62
79
|
/** The current client, or null until the first token arrives. */
|
package/dist/credential.js
CHANGED
package/dist/header.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { ChatHeader, ChatHeaderActions } from './chunk-
|
|
2
|
+
export { ChatHeader, ChatHeaderActions } from './chunk-5SGSD4HS.js';
|
|
3
3
|
import './chunk-X3QVICX7.js';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-TY6QQSAF.js';
|
|
5
5
|
import './chunk-CWAOLMFS.js';
|
|
6
6
|
import './chunk-T5SANYSX.js';
|
|
7
7
|
import './chunk-3ED4DPTV.js';
|
package/dist/message.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { Message, Thinking } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
export { Message, Thinking } from './chunk-2G3EHYNS.js';
|
|
3
|
+
import './chunk-TY6QQSAF.js';
|
|
4
4
|
import './chunk-CWAOLMFS.js';
|
|
5
5
|
import './chunk-T5SANYSX.js';
|
|
6
6
|
import './chunk-3ED4DPTV.js';
|