@plaisolutions/react 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.d.ts +55 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +961 -586
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +55 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +961 -586
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bot, Brain, CalendarDays, Check, CheckCircle2, ChevronDown, CircleAlert, CircleX, Clock, Copy, Database,
|
|
1
|
+
import { ArrowUpRight, Bot, Brain, CalendarDays, Check, CheckCircle2, ChevronDown, ChevronUp, CircleAlert, CircleX, Clock, Copy, Database, Download, File, FileText, Globe, LoaderCircle, Mail, MessageSquare, Paperclip as Paperclip$1, Plug, RotateCcw, ThumbsDown, ThumbsUp, Video, Workflow, X as X$1, XCircle } from "lucide-react";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { HttpStatusError, isHiddenMessage, toolConfirmationAt } from "@plaisolutions/client";
|
|
@@ -179,7 +179,7 @@ function ChatError({ error, locale, title, children, className,...props }) {
|
|
|
179
179
|
return /* @__PURE__ */ jsxs("div", {
|
|
180
180
|
role: "alert",
|
|
181
181
|
...props,
|
|
182
|
-
className: joinClasses("plai-chat-error flex gap-3 rounded-lg border border-
|
|
182
|
+
className: joinClasses("plai-chat-error flex gap-3 rounded-lg border border-danger-border bg-danger-subtle p-4 text-sm text-danger-strong ", className),
|
|
183
183
|
children: [/* @__PURE__ */ jsx(CircleAlert, {
|
|
184
184
|
"aria-hidden": "true",
|
|
185
185
|
className: "mt-0.5 size-4 shrink-0"
|
|
@@ -245,6 +245,12 @@ const ENGLISH_COPY = {
|
|
|
245
245
|
officeDocuments: "Office documents",
|
|
246
246
|
creatingDocuments: "Creating documents…",
|
|
247
247
|
noFilesGenerated: "No files were generated.",
|
|
248
|
+
download: "Download",
|
|
249
|
+
downloading: "Downloading…",
|
|
250
|
+
downloadFailed: "Download failed. Try again.",
|
|
251
|
+
conversationFiles: "Conversation files",
|
|
252
|
+
uploadedFiles: "Uploaded files",
|
|
253
|
+
noConversationFiles: "No files in this conversation yet.",
|
|
248
254
|
httpRequest: "HTTP request",
|
|
249
255
|
httpResponse: "HTTP response",
|
|
250
256
|
requestUrl: "Request URL",
|
|
@@ -347,6 +353,12 @@ const TRANSLATIONS = {
|
|
|
347
353
|
officeDocuments: "Documents d’Office",
|
|
348
354
|
creatingDocuments: "Creant documents…",
|
|
349
355
|
noFilesGenerated: "No s’han generat fitxers.",
|
|
356
|
+
download: "Baixa",
|
|
357
|
+
downloading: "Baixant…",
|
|
358
|
+
downloadFailed: "No s’ha pogut baixar. Torna-ho a provar.",
|
|
359
|
+
conversationFiles: "Fitxers de la conversa",
|
|
360
|
+
uploadedFiles: "Fitxers pujats",
|
|
361
|
+
noConversationFiles: "Encara no hi ha fitxers en aquesta conversa.",
|
|
350
362
|
httpRequest: "Sol·licitud HTTP",
|
|
351
363
|
httpResponse: "Resposta HTTP",
|
|
352
364
|
requestUrl: "URL de la sol·licitud",
|
|
@@ -448,6 +460,12 @@ const TRANSLATIONS = {
|
|
|
448
460
|
officeDocuments: "Office-dokumenter",
|
|
449
461
|
creatingDocuments: "Opretter dokumenter…",
|
|
450
462
|
noFilesGenerated: "Ingen filer blev genereret.",
|
|
463
|
+
download: "Download",
|
|
464
|
+
downloading: "Downloader…",
|
|
465
|
+
downloadFailed: "Download mislykkedes. Prøv igen.",
|
|
466
|
+
conversationFiles: "Filer i samtalen",
|
|
467
|
+
uploadedFiles: "Uploadede filer",
|
|
468
|
+
noConversationFiles: "Der er endnu ingen filer i denne samtale.",
|
|
451
469
|
httpRequest: "HTTP-anmodning",
|
|
452
470
|
httpResponse: "HTTP-svar",
|
|
453
471
|
requestUrl: "Anmodnings-URL",
|
|
@@ -549,6 +567,12 @@ const TRANSLATIONS = {
|
|
|
549
567
|
officeDocuments: "Office-Dokumente",
|
|
550
568
|
creatingDocuments: "Dokumente werden erstellt…",
|
|
551
569
|
noFilesGenerated: "Es wurden keine Dateien erstellt.",
|
|
570
|
+
download: "Herunterladen",
|
|
571
|
+
downloading: "Wird heruntergeladen…",
|
|
572
|
+
downloadFailed: "Download fehlgeschlagen. Bitte erneut versuchen.",
|
|
573
|
+
conversationFiles: "Dateien der Unterhaltung",
|
|
574
|
+
uploadedFiles: "Hochgeladene Dateien",
|
|
575
|
+
noConversationFiles: "In dieser Unterhaltung gibt es noch keine Dateien.",
|
|
552
576
|
httpRequest: "HTTP-Anfrage",
|
|
553
577
|
httpResponse: "HTTP-Antwort",
|
|
554
578
|
requestUrl: "Anfrage-URL",
|
|
@@ -651,6 +675,12 @@ const TRANSLATIONS = {
|
|
|
651
675
|
officeDocuments: "Documentos de Office",
|
|
652
676
|
creatingDocuments: "Creando documentos…",
|
|
653
677
|
noFilesGenerated: "No se generaron archivos.",
|
|
678
|
+
download: "Descargar",
|
|
679
|
+
downloading: "Descargando…",
|
|
680
|
+
downloadFailed: "No se pudo descargar. Inténtalo de nuevo.",
|
|
681
|
+
conversationFiles: "Archivos de la conversación",
|
|
682
|
+
uploadedFiles: "Archivos subidos",
|
|
683
|
+
noConversationFiles: "Todavía no hay archivos en esta conversación.",
|
|
654
684
|
httpRequest: "Solicitud HTTP",
|
|
655
685
|
httpResponse: "Respuesta HTTP",
|
|
656
686
|
requestUrl: "URL de la solicitud",
|
|
@@ -752,6 +782,12 @@ const TRANSLATIONS = {
|
|
|
752
782
|
officeDocuments: "Documents Office",
|
|
753
783
|
creatingDocuments: "Création des documents…",
|
|
754
784
|
noFilesGenerated: "Aucun fichier n’a été généré.",
|
|
785
|
+
download: "Télécharger",
|
|
786
|
+
downloading: "Téléchargement…",
|
|
787
|
+
downloadFailed: "Échec du téléchargement. Réessayez.",
|
|
788
|
+
conversationFiles: "Fichiers de la conversation",
|
|
789
|
+
uploadedFiles: "Fichiers importés",
|
|
790
|
+
noConversationFiles: "Aucun fichier dans cette conversation pour l’instant.",
|
|
755
791
|
httpRequest: "Requête HTTP",
|
|
756
792
|
httpResponse: "Réponse HTTP",
|
|
757
793
|
requestUrl: "URL de la requête",
|
|
@@ -853,6 +889,12 @@ const TRANSLATIONS = {
|
|
|
853
889
|
officeDocuments: "Documenti Office",
|
|
854
890
|
creatingDocuments: "Creazione dei documenti…",
|
|
855
891
|
noFilesGenerated: "Nessun file generato.",
|
|
892
|
+
download: "Scarica",
|
|
893
|
+
downloading: "Download in corso…",
|
|
894
|
+
downloadFailed: "Download non riuscito. Riprova.",
|
|
895
|
+
conversationFiles: "File della conversazione",
|
|
896
|
+
uploadedFiles: "File caricati",
|
|
897
|
+
noConversationFiles: "Ancora nessun file in questa conversazione.",
|
|
856
898
|
httpRequest: "Richiesta HTTP",
|
|
857
899
|
httpResponse: "Risposta HTTP",
|
|
858
900
|
requestUrl: "URL della richiesta",
|
|
@@ -954,6 +996,12 @@ const TRANSLATIONS = {
|
|
|
954
996
|
officeDocuments: "Office-dokumenter",
|
|
955
997
|
creatingDocuments: "Oppretter dokumenter…",
|
|
956
998
|
noFilesGenerated: "Ingen filer ble generert.",
|
|
999
|
+
download: "Last ned",
|
|
1000
|
+
downloading: "Laster ned…",
|
|
1001
|
+
downloadFailed: "Nedlastingen mislyktes. Prøv igjen.",
|
|
1002
|
+
conversationFiles: "Filer i samtalen",
|
|
1003
|
+
uploadedFiles: "Opplastede filer",
|
|
1004
|
+
noConversationFiles: "Det er ingen filer i denne samtalen ennå.",
|
|
957
1005
|
httpRequest: "HTTP-forespørsel",
|
|
958
1006
|
httpResponse: "HTTP-svar",
|
|
959
1007
|
requestUrl: "Forespørsels-URL",
|
|
@@ -1055,6 +1103,12 @@ const TRANSLATIONS = {
|
|
|
1055
1103
|
officeDocuments: "Documentos do Office",
|
|
1056
1104
|
creatingDocuments: "A criar documentos…",
|
|
1057
1105
|
noFilesGenerated: "Não foram gerados ficheiros.",
|
|
1106
|
+
download: "Transferir",
|
|
1107
|
+
downloading: "A transferir…",
|
|
1108
|
+
downloadFailed: "Não foi possível transferir. Tente novamente.",
|
|
1109
|
+
conversationFiles: "Ficheiros da conversa",
|
|
1110
|
+
uploadedFiles: "Ficheiros carregados",
|
|
1111
|
+
noConversationFiles: "Ainda não há ficheiros nesta conversa.",
|
|
1058
1112
|
httpRequest: "Pedido HTTP",
|
|
1059
1113
|
httpResponse: "Resposta HTTP",
|
|
1060
1114
|
requestUrl: "URL do pedido",
|
|
@@ -1156,6 +1210,12 @@ const TRANSLATIONS = {
|
|
|
1156
1210
|
officeDocuments: "Office-dokument",
|
|
1157
1211
|
creatingDocuments: "Skapar dokument…",
|
|
1158
1212
|
noFilesGenerated: "Inga filer genererades.",
|
|
1213
|
+
download: "Ladda ned",
|
|
1214
|
+
downloading: "Laddar ned…",
|
|
1215
|
+
downloadFailed: "Nedladdningen misslyckades. Försök igen.",
|
|
1216
|
+
conversationFiles: "Filer i konversationen",
|
|
1217
|
+
uploadedFiles: "Uppladdade filer",
|
|
1218
|
+
noConversationFiles: "Det finns inga filer i den här konversationen ännu.",
|
|
1159
1219
|
httpRequest: "HTTP-begäran",
|
|
1160
1220
|
httpResponse: "HTTP-svar",
|
|
1161
1221
|
requestUrl: "Begärans URL",
|
|
@@ -1287,7 +1347,7 @@ function DatasourceToolResultCardContent({ title, description, type, icon, resou
|
|
|
1287
1347
|
children: description
|
|
1288
1348
|
}),
|
|
1289
1349
|
resourceCount === void 0 ? null : /* @__PURE__ */ jsxs("p", {
|
|
1290
|
-
className: "mt-2 text-xs leading-4 text-
|
|
1350
|
+
className: "mt-2 text-xs leading-4 text-secondary",
|
|
1291
1351
|
children: [
|
|
1292
1352
|
resourceCount,
|
|
1293
1353
|
" ",
|
|
@@ -1299,7 +1359,7 @@ function DatasourceToolResultCardContent({ title, description, type, icon, resou
|
|
|
1299
1359
|
function DatasourceToolResultCard(props) {
|
|
1300
1360
|
return /* @__PURE__ */ jsx("article", {
|
|
1301
1361
|
"aria-label": `${props.type}: ${props.title}`,
|
|
1302
|
-
className: "w-46.5 rounded-lg bg-
|
|
1362
|
+
className: "plai-datasource-tool-result-card w-46.5 rounded-lg bg-surface-subtle p-4 text-foreground",
|
|
1303
1363
|
children: /* @__PURE__ */ jsx(DatasourceToolResultCardContent, { ...props })
|
|
1304
1364
|
});
|
|
1305
1365
|
}
|
|
@@ -1332,7 +1392,7 @@ function ResourceCardContent({ icon, type, title, description, variant = "card"
|
|
|
1332
1392
|
children: bodyTitle
|
|
1333
1393
|
}) : null,
|
|
1334
1394
|
bodyDescription ? /* @__PURE__ */ jsx("p", {
|
|
1335
|
-
className: "mt-2 line-clamp-2 text-xs leading-4 text-
|
|
1395
|
+
className: "mt-2 line-clamp-2 text-xs leading-4 text-secondary",
|
|
1336
1396
|
children: bodyDescription
|
|
1337
1397
|
}) : null
|
|
1338
1398
|
] });
|
|
@@ -1342,8 +1402,8 @@ function ResourceCard(props) {
|
|
|
1342
1402
|
const copy = getUiCopy(locale);
|
|
1343
1403
|
const [downloadState, setDownloadState] = useState("idle");
|
|
1344
1404
|
const abortControllerRef = useRef(null);
|
|
1345
|
-
const className = joinClasses("block rounded-lg bg-
|
|
1346
|
-
const interactiveClassName = `${className} transition-colors hover:bg-
|
|
1405
|
+
const className = joinClasses("plai-resource-card block rounded-lg bg-surface-subtle p-4 text-left text-foreground", variant === "card" ? "min-h-[183px] w-[186px] max-w-full" : "w-full", customClassName);
|
|
1406
|
+
const interactiveClassName = `${className} transition-colors hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`;
|
|
1347
1407
|
useEffect(() => () => {
|
|
1348
1408
|
abortControllerRef.current?.abort();
|
|
1349
1409
|
}, []);
|
|
@@ -1389,12 +1449,12 @@ function ResourceCard(props) {
|
|
|
1389
1449
|
variant
|
|
1390
1450
|
}),
|
|
1391
1451
|
downloadState === "loading" ? /* @__PURE__ */ jsx("span", {
|
|
1392
|
-
className: "mt-2 block text-xs text-
|
|
1452
|
+
className: "mt-2 block text-xs text-secondary",
|
|
1393
1453
|
"aria-live": "polite",
|
|
1394
1454
|
children: copy.openingResource
|
|
1395
1455
|
}) : null,
|
|
1396
1456
|
downloadState === "error" ? /* @__PURE__ */ jsx("span", {
|
|
1397
|
-
className: "mt-2 block text-xs text-
|
|
1457
|
+
className: "mt-2 block text-xs text-danger-strong",
|
|
1398
1458
|
role: "alert",
|
|
1399
1459
|
children: copy.resourceOpenFailed
|
|
1400
1460
|
}) : null
|
|
@@ -1688,7 +1748,7 @@ const SheetContent = forwardRef(function SheetContent$1({ children, className, s
|
|
|
1688
1748
|
"aria-label": ariaLabel,
|
|
1689
1749
|
"aria-labelledby": ariaLabelledBy ?? labelledBy,
|
|
1690
1750
|
"aria-describedby": ariaDescribedBy ?? describedBy,
|
|
1691
|
-
className: "plai-sheet-overlay fixed inset-0 m-0 h-full max-h-none w-full max-w-none border-0 bg-
|
|
1751
|
+
className: "plai-sheet-overlay fixed inset-0 m-0 h-full max-h-none w-full max-w-none border-0 bg-overlay p-0",
|
|
1692
1752
|
onCancel: (event) => {
|
|
1693
1753
|
onCancel?.(event);
|
|
1694
1754
|
if (!event.defaultPrevented) {
|
|
@@ -1704,13 +1764,13 @@ const SheetContent = forwardRef(function SheetContent$1({ children, className, s
|
|
|
1704
1764
|
"data-slot": "sheet-content",
|
|
1705
1765
|
"data-state": state,
|
|
1706
1766
|
"data-side": side,
|
|
1707
|
-
className: joinClasses("plai-sheet-content fixed overflow-y-auto border-
|
|
1767
|
+
className: joinClasses("plai-sheet-content fixed overflow-y-auto border-border bg-surface px-6 py-5 text-foreground shadow-2xl outline-none", getSideClasses(side), className),
|
|
1708
1768
|
onAnimationEnd: (event) => {
|
|
1709
1769
|
if (event.currentTarget === event.target && !open) setPresent(false);
|
|
1710
1770
|
},
|
|
1711
1771
|
children: [showCloseButton ? /* @__PURE__ */ jsx(SheetClose, {
|
|
1712
1772
|
"aria-label": closeLabel ?? getUiCopy(locale).close,
|
|
1713
|
-
className: "absolute right-4 top-2 rounded-sm p-1 text-
|
|
1773
|
+
className: "absolute right-4 top-2 rounded-sm p-1 text-muted transition-colors hover:bg-surface-subtle hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
1714
1774
|
children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
|
|
1715
1775
|
}) : null, children]
|
|
1716
1776
|
})
|
|
@@ -1764,7 +1824,7 @@ const SheetDescription = forwardRef(function SheetDescription$1({ className, id,
|
|
|
1764
1824
|
ref: forwardedRef,
|
|
1765
1825
|
id: resolvedId,
|
|
1766
1826
|
"data-slot": "sheet-description",
|
|
1767
|
-
className: joinClasses("text-sm text-
|
|
1827
|
+
className: joinClasses("text-sm text-secondary", className)
|
|
1768
1828
|
});
|
|
1769
1829
|
});
|
|
1770
1830
|
|
|
@@ -1774,7 +1834,7 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
|
|
|
1774
1834
|
const copy = getUiCopy(locale);
|
|
1775
1835
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
1776
1836
|
"aria-label": `${type}: ${title}`,
|
|
1777
|
-
className: `${variant === "card" ? "min-h-[183px] w-[186px] max-w-full" : "w-full"} rounded-lg bg-
|
|
1837
|
+
className: `${variant === "card" ? "min-h-[183px] w-[186px] max-w-full" : "w-full"} plai-datasource-folder-card rounded-lg bg-surface-subtle p-4 text-left font-normal text-foreground transition-colors hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,
|
|
1778
1838
|
children: /* @__PURE__ */ jsx(DatasourceToolResultCardContent, {
|
|
1779
1839
|
icon,
|
|
1780
1840
|
title,
|
|
@@ -1807,7 +1867,7 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
|
|
|
1807
1867
|
href: url,
|
|
1808
1868
|
target: "_blank",
|
|
1809
1869
|
rel: "noreferrer noopener",
|
|
1810
|
-
className: "text-xs font-medium text-
|
|
1870
|
+
className: "text-xs font-medium text-strong underline underline-offset-2",
|
|
1811
1871
|
children: copy.view
|
|
1812
1872
|
}) : null
|
|
1813
1873
|
]
|
|
@@ -2154,18 +2214,18 @@ function WebSearchResultItem({ result }) {
|
|
|
2154
2214
|
const imageUrl = toStringOrNull$2(result.image_url);
|
|
2155
2215
|
const faviconUrl = getFaviconUrl(result.url);
|
|
2156
2216
|
return /* @__PURE__ */ jsx("article", {
|
|
2157
|
-
className: "rounded-lg border border-
|
|
2217
|
+
className: "rounded-lg border border-border bg-surface p-4",
|
|
2158
2218
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2159
2219
|
className: "flex items-start gap-3",
|
|
2160
2220
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
2161
2221
|
"aria-hidden": "true",
|
|
2162
|
-
className: "relative flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full border border-
|
|
2222
|
+
className: "relative flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border-strong bg-surface text-secondary",
|
|
2163
2223
|
children: [/* @__PURE__ */ jsx(Globe, { className: "h-4 w-4" }), faviconUrl ? /* @__PURE__ */ jsx("img", {
|
|
2164
2224
|
src: faviconUrl,
|
|
2165
2225
|
alt: "",
|
|
2166
2226
|
width: "16",
|
|
2167
2227
|
height: "16",
|
|
2168
|
-
className: "absolute h-4 w-4 bg-
|
|
2228
|
+
className: "absolute h-4 w-4 bg-surface",
|
|
2169
2229
|
onError: (event) => {
|
|
2170
2230
|
event.currentTarget.style.display = "none";
|
|
2171
2231
|
}
|
|
@@ -2177,28 +2237,28 @@ function WebSearchResultItem({ result }) {
|
|
|
2177
2237
|
href: result.url,
|
|
2178
2238
|
target: "_blank",
|
|
2179
2239
|
rel: "noreferrer noopener",
|
|
2180
|
-
className: "block line-clamp-2 text-sm font-medium leading-5 text-
|
|
2240
|
+
className: "block line-clamp-2 text-sm font-medium leading-5 text-foreground hover:underline",
|
|
2181
2241
|
children: result.title
|
|
2182
2242
|
}),
|
|
2183
2243
|
/* @__PURE__ */ jsxs("div", {
|
|
2184
|
-
className: "flex flex-wrap items-center gap-1.5 text-xs text-
|
|
2244
|
+
className: "flex flex-wrap items-center gap-1.5 text-xs text-muted",
|
|
2185
2245
|
children: [
|
|
2186
2246
|
date ? /* @__PURE__ */ jsx("span", { children: date }) : null,
|
|
2187
2247
|
source ? /* @__PURE__ */ jsx("span", {
|
|
2188
|
-
className: "rounded-full bg-
|
|
2248
|
+
className: "rounded-full bg-surface-subtle px-1.5 py-0.5 capitalize text-secondary",
|
|
2189
2249
|
children: source
|
|
2190
2250
|
}) : null,
|
|
2191
2251
|
!date && !source && hostname ? /* @__PURE__ */ jsx("span", { children: hostname }) : null
|
|
2192
2252
|
]
|
|
2193
2253
|
}),
|
|
2194
2254
|
snippet ? /* @__PURE__ */ jsx("p", {
|
|
2195
|
-
className: "line-clamp-2 text-xs leading-5 text-
|
|
2255
|
+
className: "line-clamp-2 text-xs leading-5 text-secondary",
|
|
2196
2256
|
children: snippet
|
|
2197
2257
|
}) : null,
|
|
2198
2258
|
imageUrl ? /* @__PURE__ */ jsx("img", {
|
|
2199
2259
|
src: imageUrl,
|
|
2200
2260
|
alt: "",
|
|
2201
|
-
className: "max-h-64 w-full rounded-md border border-
|
|
2261
|
+
className: "max-h-64 w-full rounded-md border border-border object-contain",
|
|
2202
2262
|
loading: "lazy"
|
|
2203
2263
|
}) : null
|
|
2204
2264
|
]
|
|
@@ -2215,7 +2275,7 @@ function ToolResultWebSearchCard({ part, locale, className }) {
|
|
|
2215
2275
|
const sourceLabel = searchResults.length === 1 ? copy.singularSource : copy.pluralSources;
|
|
2216
2276
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsxs(SheetTrigger, {
|
|
2217
2277
|
"aria-label": `Web: ${copy.webSearchTitle}, ${searchResults.length} ${sourceLabel}`,
|
|
2218
|
-
className: joinClasses("plai-tool-result-web-search-card min-h-[183px] w-[186px] rounded-lg bg-
|
|
2278
|
+
className: joinClasses("plai-tool-result-web-search-card min-h-[183px] w-[186px] rounded-lg bg-surface-subtle p-4 text-left font-normal text-foreground transition-colors hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", className),
|
|
2219
2279
|
children: [
|
|
2220
2280
|
/* @__PURE__ */ jsxs("header", {
|
|
2221
2281
|
className: "flex items-center gap-3",
|
|
@@ -2232,7 +2292,7 @@ function ToolResultWebSearchCard({ part, locale, className }) {
|
|
|
2232
2292
|
children: copy.webSearchTitle
|
|
2233
2293
|
}),
|
|
2234
2294
|
/* @__PURE__ */ jsx("p", {
|
|
2235
|
-
className: "mt-2 text-xs leading-4 text-
|
|
2295
|
+
className: "mt-2 text-xs leading-4 text-secondary",
|
|
2236
2296
|
children: part.state === "pending" ? uiCopy.searching : `${searchResults.length} ${sourceLabel}`
|
|
2237
2297
|
})
|
|
2238
2298
|
]
|
|
@@ -2259,13 +2319,13 @@ function ToolResultWebSearchResults({ part, searchResults = getWebSearchResults(
|
|
|
2259
2319
|
className: "space-y-3",
|
|
2260
2320
|
children: searchResults.map((result, index) => /* @__PURE__ */ jsx(WebSearchResultItem, { result }, `${result.url}-${index}`))
|
|
2261
2321
|
}) : part.state === "pending" ? /* @__PURE__ */ jsx("p", {
|
|
2262
|
-
className: "text-sm text-
|
|
2322
|
+
className: "text-sm text-secondary",
|
|
2263
2323
|
children: copy.searchingForSources
|
|
2264
2324
|
}) : /* @__PURE__ */ jsx("p", {
|
|
2265
|
-
className: "text-sm text-
|
|
2325
|
+
className: "text-sm text-secondary",
|
|
2266
2326
|
children: copy.noSourcesReturned
|
|
2267
2327
|
}), errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
2268
|
-
className: "mt-4 rounded border border-
|
|
2328
|
+
className: "mt-4 rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
2269
2329
|
children: [
|
|
2270
2330
|
/* @__PURE__ */ jsxs("span", {
|
|
2271
2331
|
className: "font-semibold",
|
|
@@ -2310,7 +2370,7 @@ function SourceCard({ source, locale, variant = "card" }) {
|
|
|
2310
2370
|
locale
|
|
2311
2371
|
});
|
|
2312
2372
|
return /* @__PURE__ */ jsxs("section", {
|
|
2313
|
-
className: "rounded-lg bg-
|
|
2373
|
+
className: "rounded-lg bg-surface-subtle p-4",
|
|
2314
2374
|
children: [/* @__PURE__ */ jsxs("header", {
|
|
2315
2375
|
className: "mb-4 flex items-center gap-3",
|
|
2316
2376
|
children: [/* @__PURE__ */ jsx(Globe, {
|
|
@@ -2348,7 +2408,7 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
|
|
|
2348
2408
|
locale
|
|
2349
2409
|
}, source.key)), overflowCount > 0 ? /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsxs(SheetTrigger, {
|
|
2350
2410
|
"aria-label": `+${overflowCount} ${overflowLabel}`,
|
|
2351
|
-
className: "flex min-h-[183px] w-[186px] max-w-full flex-col justify-center rounded-lg bg-
|
|
2411
|
+
className: "flex min-h-[183px] w-[186px] max-w-full flex-col justify-center rounded-lg bg-surface-subtle p-4 text-left font-normal text-foreground transition-colors hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
2352
2412
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
2353
2413
|
className: "text-2xl font-medium leading-7",
|
|
2354
2414
|
children: ["+", overflowCount]
|
|
@@ -2377,6 +2437,41 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
|
|
|
2377
2437
|
});
|
|
2378
2438
|
}
|
|
2379
2439
|
|
|
2440
|
+
//#endregion
|
|
2441
|
+
//#region src/components/internal/file-display.ts
|
|
2442
|
+
function getFilenameFromUrl(url) {
|
|
2443
|
+
try {
|
|
2444
|
+
const parsed = new URL(url);
|
|
2445
|
+
return decodeURIComponent(parsed.pathname).split("/").pop()?.trim() || void 0;
|
|
2446
|
+
} catch {
|
|
2447
|
+
return (url.split("?")[0]?.split("#")[0] ?? "").split("/").pop()?.trim() || void 0;
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
/** Lowercase extension from the file name, falling back to the MIME type. */
|
|
2451
|
+
function getFileExtension(name, contentType) {
|
|
2452
|
+
const label = name ?? "";
|
|
2453
|
+
const extension = label.split(".").pop()?.toLowerCase();
|
|
2454
|
+
if (extension && extension !== label.toLowerCase()) return extension;
|
|
2455
|
+
const mime = contentType ?? "";
|
|
2456
|
+
if (mime.includes("pdf")) return "pdf";
|
|
2457
|
+
if (mime.includes("wordprocessingml")) return "docx";
|
|
2458
|
+
if (mime.includes("spreadsheetml")) return "xlsx";
|
|
2459
|
+
if (mime.includes("presentationml")) return "pptx";
|
|
2460
|
+
if (mime.startsWith("image/")) return mime.slice(6) || null;
|
|
2461
|
+
return null;
|
|
2462
|
+
}
|
|
2463
|
+
function getFileIconClass(extension) {
|
|
2464
|
+
if (extension === "pdf") return "text-danger";
|
|
2465
|
+
if (["doc", "docx"].includes(extension ?? "")) return "text-info";
|
|
2466
|
+
if ([
|
|
2467
|
+
"xls",
|
|
2468
|
+
"xlsx",
|
|
2469
|
+
"csv"
|
|
2470
|
+
].includes(extension ?? "")) return "text-success";
|
|
2471
|
+
if (["ppt", "pptx"].includes(extension ?? "")) return "text-warning";
|
|
2472
|
+
return "text-muted";
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2380
2475
|
//#endregion
|
|
2381
2476
|
//#region src/components/memory-proposal-card.tsx
|
|
2382
2477
|
const COPY$1 = {
|
|
@@ -2630,88 +2725,94 @@ function MemoryProposalCard({ proposal: initial, actions, activeAgentId, locale,
|
|
|
2630
2725
|
const statusCopy = proposal.status === "ACCEPTED" ? copy.accepted : proposal.status === "REJECTED" ? copy.rejected : proposal.status === "EXPIRED" ? copy.expired : proposal.status === "CONFLICTED" ? copy.conflicted : null;
|
|
2631
2726
|
const operation = proposal.operation === "CREATE" ? copy.create : proposal.operation === "UPDATE" ? copy.update : copy.delete;
|
|
2632
2727
|
return /* @__PURE__ */ jsxs("section", {
|
|
2633
|
-
className: joinClasses("
|
|
2728
|
+
className: joinClasses("plai-memory-proposal-card overflow-hidden rounded-lg border border-success-border bg-success-subtle/30 text-left", className),
|
|
2634
2729
|
"data-memory-proposal-id": proposal.id,
|
|
2635
|
-
children: [
|
|
2636
|
-
|
|
2637
|
-
|
|
2730
|
+
children: [/* @__PURE__ */ jsx("header", {
|
|
2731
|
+
className: "border-b border-success-border px-3 py-2",
|
|
2732
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
2733
|
+
className: "flex items-center gap-2",
|
|
2638
2734
|
children: [/* @__PURE__ */ jsxs("h4", {
|
|
2639
|
-
className: "flex items-center gap-2 text-sm font-semibold text-
|
|
2640
|
-
children: [/* @__PURE__ */ jsx(Brain, { className: "size-4" }), copy.
|
|
2735
|
+
className: "flex items-center gap-2 text-sm font-semibold text-foreground",
|
|
2736
|
+
children: [/* @__PURE__ */ jsx(Brain, { className: "size-4" }), proposal.scope === "USER" ? copy.user : copy.project]
|
|
2641
2737
|
}), /* @__PURE__ */ jsxs("div", {
|
|
2738
|
+
"aria-label": "type",
|
|
2642
2739
|
className: "flex flex-wrap gap-2 text-xs",
|
|
2643
|
-
children: [
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
children: operation
|
|
2651
|
-
}),
|
|
2652
|
-
/* @__PURE__ */ jsx("span", {
|
|
2653
|
-
className: "rounded-full bg-slate-100 px-2 py-0.5",
|
|
2654
|
-
children: formatCategory(proposal.category)
|
|
2655
|
-
})
|
|
2656
|
-
]
|
|
2657
|
-
})]
|
|
2658
|
-
}),
|
|
2659
|
-
proposal.previous_content && proposal.previous_content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
|
|
2660
|
-
className: "rounded-md bg-slate-100 p-3 text-sm",
|
|
2661
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
2662
|
-
className: "mb-1 block text-xs font-medium text-slate-500",
|
|
2663
|
-
children: copy.previous
|
|
2664
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
2665
|
-
className: "whitespace-pre-wrap break-words",
|
|
2666
|
-
children: proposal.previous_content
|
|
2667
|
-
})]
|
|
2668
|
-
}) : null,
|
|
2669
|
-
proposal.content && proposal.content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
|
|
2670
|
-
className: "text-sm",
|
|
2671
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
2672
|
-
className: "mb-1 block text-xs font-medium text-slate-500",
|
|
2673
|
-
children: copy.proposed
|
|
2674
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
2675
|
-
className: "whitespace-pre-wrap break-words",
|
|
2676
|
-
children: proposal.content
|
|
2677
|
-
})]
|
|
2678
|
-
}) : null,
|
|
2679
|
-
canResolve ? /* @__PURE__ */ jsxs("div", {
|
|
2680
|
-
className: "flex gap-2",
|
|
2681
|
-
children: [/* @__PURE__ */ jsxs("button", {
|
|
2682
|
-
type: "button",
|
|
2683
|
-
disabled: resolving,
|
|
2684
|
-
onClick: () => void resolve(true),
|
|
2685
|
-
className: "inline-flex items-center rounded-md bg-slate-900 px-3 py-1.5 text-xs font-medium text-white disabled:opacity-50",
|
|
2686
|
-
children: [resolving ? /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 size-3 animate-spin" }) : null, copy.accept]
|
|
2687
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
2688
|
-
type: "button",
|
|
2689
|
-
disabled: resolving,
|
|
2690
|
-
onClick: () => void resolve(false),
|
|
2691
|
-
className: "rounded-md border border-slate-300 bg-white px-3 py-1.5 text-xs font-medium disabled:opacity-50",
|
|
2692
|
-
children: copy.reject
|
|
2693
|
-
})]
|
|
2694
|
-
}) : null,
|
|
2695
|
-
proposal.status === "PENDING" && !canResolve ? /* @__PURE__ */ jsx("p", {
|
|
2696
|
-
className: "text-xs font-medium text-slate-500",
|
|
2697
|
-
children: proposal.scope === "PROJECT" ? copy.review : copy.unavailable
|
|
2698
|
-
}) : null,
|
|
2699
|
-
proposal.status === "ACCEPTED" && statusCopy ? /* @__PURE__ */ jsxs("span", {
|
|
2700
|
-
className: "inline-flex items-center gap-1.5 rounded-full border bg-white px-3 py-1 text-xs font-medium text-slate-900 shadow-sm",
|
|
2701
|
-
children: [statusCopy, /* @__PURE__ */ jsx(Check, {
|
|
2702
|
-
className: "size-3.5 stroke-[2.5] text-emerald-600",
|
|
2703
|
-
"aria-hidden": "true"
|
|
2740
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2741
|
+
className: "rounded-full bg-surface-subtle px-2 py-0.5",
|
|
2742
|
+
children: operation
|
|
2743
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2744
|
+
className: "rounded-full bg-surface-subtle px-2 py-0.5",
|
|
2745
|
+
children: formatCategory(proposal.category)
|
|
2746
|
+
})]
|
|
2704
2747
|
})]
|
|
2705
|
-
})
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2748
|
+
})
|
|
2749
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
2750
|
+
className: "space-y-3 px-3 py-2",
|
|
2751
|
+
children: [
|
|
2752
|
+
" ",
|
|
2753
|
+
proposal.previous_content && proposal.previous_content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
|
|
2754
|
+
className: "rounded-md bg-surface-subtle p-3 text-sm",
|
|
2755
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2756
|
+
className: "mb-1 block text-xs font-medium text-muted",
|
|
2757
|
+
children: copy.previous
|
|
2758
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
2759
|
+
className: "whitespace-pre-wrap break-words",
|
|
2760
|
+
children: proposal.previous_content
|
|
2761
|
+
})]
|
|
2762
|
+
}) : null,
|
|
2763
|
+
proposal.content && proposal.content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
|
|
2764
|
+
className: "text-sm",
|
|
2765
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2766
|
+
className: "mb-1 block text-xs font-medium text-muted",
|
|
2767
|
+
children: copy.proposed
|
|
2768
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
2769
|
+
className: "whitespace-pre-wrap break-words",
|
|
2770
|
+
children: proposal.content
|
|
2771
|
+
})]
|
|
2772
|
+
}) : null,
|
|
2773
|
+
canResolve ? /* @__PURE__ */ jsxs("div", {
|
|
2774
|
+
className: "flex gap-2",
|
|
2775
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
2776
|
+
type: "button",
|
|
2777
|
+
disabled: resolving,
|
|
2778
|
+
onClick: () => void resolve(true),
|
|
2779
|
+
className: "inline-flex items-center rounded-md bg-inverse px-3 py-1.5 text-xs font-medium text-inverse-foreground disabled:opacity-50",
|
|
2780
|
+
children: [resolving ? /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 size-3 animate-spin" }) : null, copy.accept]
|
|
2781
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
2782
|
+
type: "button",
|
|
2783
|
+
disabled: resolving,
|
|
2784
|
+
onClick: () => void resolve(false),
|
|
2785
|
+
className: "rounded-md border border-border-strong bg-surface px-3 py-1.5 text-xs font-medium disabled:opacity-50",
|
|
2786
|
+
children: copy.reject
|
|
2787
|
+
})]
|
|
2788
|
+
}) : null,
|
|
2789
|
+
proposal.status === "PENDING" && !canResolve ? /* @__PURE__ */ jsxs("span", {
|
|
2790
|
+
className: "inline-flex items-center gap-1.5 rounded-full border bg-surface px-3 py-1 text-xs font-medium text-foreground",
|
|
2791
|
+
children: [proposal.scope === "PROJECT" ? copy.review : copy.unavailable, /* @__PURE__ */ jsx(Clock, {
|
|
2792
|
+
className: "size-3.5 stroke-[2.5] text-muted",
|
|
2793
|
+
"aria-hidden": "true"
|
|
2794
|
+
})]
|
|
2795
|
+
}) : null,
|
|
2796
|
+
proposal.status === "ACCEPTED" && statusCopy ? /* @__PURE__ */ jsxs("span", {
|
|
2797
|
+
className: "inline-flex items-center gap-1.5 rounded-full border bg-surface px-3 py-1 text-xs font-medium text-foreground",
|
|
2798
|
+
children: [statusCopy, /* @__PURE__ */ jsx(Check, {
|
|
2799
|
+
className: "size-3.5 stroke-[2.5] text-success",
|
|
2800
|
+
"aria-hidden": "true"
|
|
2801
|
+
})]
|
|
2802
|
+
}) : null,
|
|
2803
|
+
statusCopy && proposal.status !== "ACCEPTED" ? /* @__PURE__ */ jsxs("span", {
|
|
2804
|
+
className: "inline-flex items-center gap-1.5 rounded-full border border-danger bg-surface px-3 py-1 text-xs font-medium text-danger",
|
|
2805
|
+
children: [statusCopy, /* @__PURE__ */ jsx(X$1, {
|
|
2806
|
+
className: "size-3.5 stroke-[2.5]",
|
|
2807
|
+
"aria-hidden": "true"
|
|
2808
|
+
})]
|
|
2809
|
+
}) : null,
|
|
2810
|
+
error ? /* @__PURE__ */ jsx("p", {
|
|
2811
|
+
className: "text-xs text-danger",
|
|
2812
|
+
children: error
|
|
2813
|
+
}) : null
|
|
2814
|
+
]
|
|
2815
|
+
})]
|
|
2715
2816
|
});
|
|
2716
2817
|
}
|
|
2717
2818
|
function mergeProposal(current, incoming) {
|
|
@@ -2818,7 +2919,7 @@ function ToolError({ part, locale, defaultOpen = false, className,...props }) {
|
|
|
2818
2919
|
const copy = getToolErrorCopy(part, locale);
|
|
2819
2920
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
2820
2921
|
return /* @__PURE__ */ jsxs("section", {
|
|
2821
|
-
className: joinClasses("text-sm text-
|
|
2922
|
+
className: joinClasses("text-sm text-secondary", className),
|
|
2822
2923
|
"data-tool-call-id": part.id,
|
|
2823
2924
|
"data-tool-call-state": part.state,
|
|
2824
2925
|
...props,
|
|
@@ -2826,14 +2927,17 @@ function ToolError({ part, locale, defaultOpen = false, className,...props }) {
|
|
|
2826
2927
|
type: "button",
|
|
2827
2928
|
"aria-controls": contentId,
|
|
2828
2929
|
"aria-expanded": isOpen,
|
|
2829
|
-
className: "inline-flex items-center gap-2 rounded-md py-1 text-left font-medium text-
|
|
2930
|
+
className: "inline-flex items-center gap-2 rounded-md py-1 text-left font-medium text-danger transition-colors hover:text-danger-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
2830
2931
|
onClick: () => setIsOpen((value) => !value),
|
|
2831
2932
|
children: [
|
|
2832
2933
|
/* @__PURE__ */ jsx(CircleX, {
|
|
2833
2934
|
className: "size-4 shrink-0",
|
|
2834
2935
|
"aria-hidden": "true"
|
|
2835
2936
|
}),
|
|
2836
|
-
/* @__PURE__ */ jsx("span", {
|
|
2937
|
+
/* @__PURE__ */ jsx("span", {
|
|
2938
|
+
className: "line-clamp-1",
|
|
2939
|
+
children: copy.summary
|
|
2940
|
+
}),
|
|
2837
2941
|
/* @__PURE__ */ jsx(ChevronDown, {
|
|
2838
2942
|
className: joinClasses("size-4 shrink-0 transition-transform motion-reduce:transition-none", isOpen ? "rotate-180" : void 0),
|
|
2839
2943
|
"aria-hidden": "true"
|
|
@@ -2841,27 +2945,27 @@ function ToolError({ part, locale, defaultOpen = false, className,...props }) {
|
|
|
2841
2945
|
]
|
|
2842
2946
|
}), isOpen ? /* @__PURE__ */ jsxs("div", {
|
|
2843
2947
|
id: contentId,
|
|
2844
|
-
className: "mt-2 space-y-3 border-l-2 border-
|
|
2948
|
+
className: "mt-2 space-y-3 border-l-2 border-danger-border pl-3",
|
|
2845
2949
|
children: [
|
|
2846
2950
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
2847
|
-
className: "mb-2 text-xs font-semibold text-
|
|
2951
|
+
className: "mb-2 text-xs font-semibold text-strong",
|
|
2848
2952
|
children: copy.input
|
|
2849
2953
|
}), /* @__PURE__ */ jsx("pre", {
|
|
2850
|
-
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-
|
|
2954
|
+
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-surface-subtle p-3 text-xs leading-5 text-strong",
|
|
2851
2955
|
children: formatJson$1(part.input)
|
|
2852
2956
|
})] }),
|
|
2853
2957
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
2854
|
-
className: "mb-2 text-xs font-semibold text-
|
|
2958
|
+
className: "mb-2 text-xs font-semibold text-strong",
|
|
2855
2959
|
children: copy.output
|
|
2856
2960
|
}), /* @__PURE__ */ jsx("pre", {
|
|
2857
|
-
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-
|
|
2961
|
+
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-surface-subtle p-3 text-xs leading-5 text-strong",
|
|
2858
2962
|
children: part.result === void 0 ? copy.noOutput : formatJson$1(part.result)
|
|
2859
2963
|
})] }),
|
|
2860
2964
|
errorDetails ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
2861
|
-
className: "mb-2 text-xs font-semibold text-
|
|
2965
|
+
className: "mb-2 text-xs font-semibold text-danger-strong",
|
|
2862
2966
|
children: copy.details
|
|
2863
2967
|
}), /* @__PURE__ */ jsx("p", {
|
|
2864
|
-
className: "whitespace-pre-wrap text-xs leading-5 text-
|
|
2968
|
+
className: "whitespace-pre-wrap text-xs leading-5 text-danger-strong",
|
|
2865
2969
|
children: errorDetails
|
|
2866
2970
|
})] }) : null
|
|
2867
2971
|
]
|
|
@@ -2901,12 +3005,12 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }
|
|
|
2901
3005
|
const pending = part.state === "pending";
|
|
2902
3006
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
2903
3007
|
"aria-label": `${copy.agent}: ${agentName}`,
|
|
2904
|
-
className: joinClasses("w-full rounded-lg border border-
|
|
3008
|
+
className: joinClasses("plai-tool-result-agent-invocation-card w-full rounded-lg border border-border bg-surface text-left font-normal text-foreground transition-colors hover:bg-surface-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", className),
|
|
2905
3009
|
children: /* @__PURE__ */ jsxs("span", {
|
|
2906
3010
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
2907
3011
|
children: [
|
|
2908
3012
|
/* @__PURE__ */ jsx(Bot, {
|
|
2909
|
-
className: "h-4 w-4 shrink-0 text-
|
|
3013
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
2910
3014
|
"aria-hidden": "true"
|
|
2911
3015
|
}),
|
|
2912
3016
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -2914,19 +3018,19 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }
|
|
|
2914
3018
|
children: copy.agent
|
|
2915
3019
|
}),
|
|
2916
3020
|
/* @__PURE__ */ jsx("span", {
|
|
2917
|
-
className: "min-w-0 truncate border-
|
|
3021
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
2918
3022
|
children: agentName
|
|
2919
3023
|
}),
|
|
2920
3024
|
/* @__PURE__ */ jsx("span", {
|
|
2921
3025
|
className: "ml-auto shrink-0",
|
|
2922
3026
|
children: pending ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
2923
|
-
className: "h-4 w-4 animate-spin text-
|
|
3027
|
+
className: "h-4 w-4 animate-spin text-warning",
|
|
2924
3028
|
"aria-label": copy.pending
|
|
2925
3029
|
}) : failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
2926
|
-
className: "h-4 w-4 text-
|
|
3030
|
+
className: "h-4 w-4 text-danger",
|
|
2927
3031
|
"aria-hidden": "true"
|
|
2928
3032
|
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
2929
|
-
className: "h-4 w-4 text-
|
|
3033
|
+
className: "h-4 w-4 text-success",
|
|
2930
3034
|
"aria-hidden": "true"
|
|
2931
3035
|
})
|
|
2932
3036
|
})
|
|
@@ -2945,25 +3049,25 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }
|
|
|
2945
3049
|
className: "grid gap-2 text-sm",
|
|
2946
3050
|
children: [
|
|
2947
3051
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
2948
|
-
className: "text-xs text-
|
|
3052
|
+
className: "text-xs text-muted",
|
|
2949
3053
|
children: copy.status
|
|
2950
3054
|
}), /* @__PURE__ */ jsx("dd", { children: getUiStatusLabel(part.state, copy) })] }),
|
|
2951
3055
|
metadata?.agent_id ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
2952
|
-
className: "text-xs text-
|
|
3056
|
+
className: "text-xs text-muted",
|
|
2953
3057
|
children: copy.agentId
|
|
2954
3058
|
}), /* @__PURE__ */ jsx("dd", {
|
|
2955
3059
|
className: "break-all",
|
|
2956
3060
|
children: metadata.agent_id
|
|
2957
3061
|
})] }) : null,
|
|
2958
3062
|
metadata?.tracked_execution_id ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
2959
|
-
className: "text-xs text-
|
|
3063
|
+
className: "text-xs text-muted",
|
|
2960
3064
|
children: copy.executionId
|
|
2961
3065
|
}), /* @__PURE__ */ jsx("dd", {
|
|
2962
3066
|
className: "break-all",
|
|
2963
3067
|
children: metadata.tracked_execution_id
|
|
2964
3068
|
})] }) : null,
|
|
2965
3069
|
threadId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
2966
|
-
className: "text-xs text-
|
|
3070
|
+
className: "text-xs text-muted",
|
|
2967
3071
|
children: copy.threadId
|
|
2968
3072
|
}), /* @__PURE__ */ jsx("dd", {
|
|
2969
3073
|
className: "break-all",
|
|
@@ -2975,19 +3079,19 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }
|
|
|
2975
3079
|
className: "mb-2 text-sm font-medium",
|
|
2976
3080
|
children: copy.prompt
|
|
2977
3081
|
}), /* @__PURE__ */ jsx("p", {
|
|
2978
|
-
className: "whitespace-pre-wrap rounded-md border border-
|
|
3082
|
+
className: "whitespace-pre-wrap rounded-md border border-border bg-surface-muted p-3 text-sm leading-6",
|
|
2979
3083
|
children: prompt
|
|
2980
3084
|
})] }) : null,
|
|
2981
3085
|
output$1 ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
2982
3086
|
className: "mb-2 text-sm font-medium",
|
|
2983
3087
|
children: copy.result
|
|
2984
3088
|
}), /* @__PURE__ */ jsx("pre", {
|
|
2985
|
-
className: "overflow-x-auto whitespace-pre-wrap rounded-md border border-
|
|
3089
|
+
className: "overflow-x-auto whitespace-pre-wrap rounded-md border border-border bg-surface-muted p-3 text-xs leading-5",
|
|
2986
3090
|
children: output$1
|
|
2987
3091
|
})] }) : null,
|
|
2988
3092
|
threadId && onOpenThread ? /* @__PURE__ */ jsxs("button", {
|
|
2989
3093
|
type: "button",
|
|
2990
|
-
className: "inline-flex items-center gap-2 rounded-md border border-
|
|
3094
|
+
className: "inline-flex items-center gap-2 rounded-md border border-border-strong px-3 py-2 text-sm font-medium text-foreground transition-colors hover:bg-surface-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
2991
3095
|
onClick: () => onOpenThread(threadId),
|
|
2992
3096
|
children: [/* @__PURE__ */ jsx(MessageSquare, {
|
|
2993
3097
|
className: "h-4 w-4",
|
|
@@ -2995,7 +3099,7 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }
|
|
|
2995
3099
|
}), copy.openConversation]
|
|
2996
3100
|
}) : null,
|
|
2997
3101
|
error ? /* @__PURE__ */ jsxs("p", {
|
|
2998
|
-
className: "rounded border border-
|
|
3102
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
2999
3103
|
children: [
|
|
3000
3104
|
/* @__PURE__ */ jsxs("span", {
|
|
3001
3105
|
className: "font-semibold",
|
|
@@ -3047,66 +3151,67 @@ function ToolResultBrowserCard({ part, className, locale }) {
|
|
|
3047
3151
|
const pending = part.state === "pending";
|
|
3048
3152
|
const canExpand = Boolean(preview || error || url);
|
|
3049
3153
|
return /* @__PURE__ */ jsxs("section", {
|
|
3050
|
-
className: joinClasses("overflow-hidden rounded-lg border border-
|
|
3154
|
+
className: joinClasses("plai-tool-result-browser-card overflow-hidden rounded-lg border border-border bg-surface", className),
|
|
3051
3155
|
"aria-label": copy.browserResult,
|
|
3052
|
-
children: [/* @__PURE__ */
|
|
3053
|
-
className: "flex items-center gap-2 px-3 py-2 text-
|
|
3054
|
-
children:
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
className: "min-w-0 truncate border-neutral-500 border px-2 py-0.5 rounded-md text-xs text-neutral-500",
|
|
3065
|
-
children: subtitle
|
|
3066
|
-
}) : null,
|
|
3067
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3068
|
-
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
3069
|
-
children: [pending ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
3070
|
-
className: "h-4 w-4 animate-spin text-amber-600",
|
|
3071
|
-
"aria-label": copy.pending
|
|
3072
|
-
}) : failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
3073
|
-
className: "h-4 w-4 text-rose-600",
|
|
3074
|
-
"aria-hidden": "true"
|
|
3075
|
-
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
3076
|
-
className: "h-4 w-4 text-emerald-600",
|
|
3156
|
+
children: [/* @__PURE__ */ jsx("header", {
|
|
3157
|
+
className: "flex items-center gap-2 border-b border-border px-3 py-2 text-xs text-secondary",
|
|
3158
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
3159
|
+
type: "button",
|
|
3160
|
+
disabled: !canExpand,
|
|
3161
|
+
"aria-label": expanded ? copy.collapseBrowserResult : copy.expandBrowserResult,
|
|
3162
|
+
"aria-expanded": canExpand ? expanded : void 0,
|
|
3163
|
+
className: "flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors enabled:cursor-pointer enabled:hover:bg-surface-subtle focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring",
|
|
3164
|
+
onClick: () => setExpanded((value) => !value),
|
|
3165
|
+
children: [
|
|
3166
|
+
/* @__PURE__ */ jsx(Globe, {
|
|
3167
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
3077
3168
|
"aria-hidden": "true"
|
|
3078
|
-
}),
|
|
3079
|
-
|
|
3080
|
-
"
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3169
|
+
}),
|
|
3170
|
+
/* @__PURE__ */ jsx("span", {
|
|
3171
|
+
className: "font-medium text-strong",
|
|
3172
|
+
children: copy.browser
|
|
3173
|
+
}),
|
|
3174
|
+
subtitle ? /* @__PURE__ */ jsx("span", {
|
|
3175
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
3176
|
+
children: subtitle
|
|
3177
|
+
}) : null,
|
|
3178
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3179
|
+
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
3180
|
+
children: [pending ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
3181
|
+
className: "h-4 w-4 animate-spin text-warning",
|
|
3182
|
+
"aria-label": copy.pending
|
|
3183
|
+
}) : failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
3184
|
+
className: "h-4 w-4 text-danger",
|
|
3086
3185
|
"aria-hidden": "true"
|
|
3087
|
-
}) : /* @__PURE__ */ jsx(
|
|
3088
|
-
className: "h-
|
|
3186
|
+
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
3187
|
+
className: "h-4 w-4 text-success",
|
|
3089
3188
|
"aria-hidden": "true"
|
|
3090
|
-
})
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3189
|
+
}), canExpand ? expanded ? /* @__PURE__ */ jsx(ChevronUp, {
|
|
3190
|
+
className: "h-4 w-4 text-muted",
|
|
3191
|
+
"aria-hidden": "true"
|
|
3192
|
+
}) : /* @__PURE__ */ jsx(ChevronDown, {
|
|
3193
|
+
className: "h-4 w-4 text-muted",
|
|
3194
|
+
"aria-hidden": "true"
|
|
3195
|
+
}) : null]
|
|
3196
|
+
})
|
|
3197
|
+
]
|
|
3198
|
+
})
|
|
3094
3199
|
}), expanded ? /* @__PURE__ */ jsxs("div", {
|
|
3095
|
-
className: "space-y-3 border-t border-
|
|
3200
|
+
className: "space-y-3 border-t border-border bg-surface-muted p-3",
|
|
3096
3201
|
children: [
|
|
3097
3202
|
url ? /* @__PURE__ */ jsx("a", {
|
|
3098
3203
|
href: url,
|
|
3099
3204
|
target: "_blank",
|
|
3100
3205
|
rel: "noreferrer noopener",
|
|
3101
|
-
className: "block truncate text-xs text-
|
|
3206
|
+
className: "block truncate text-xs text-info-strong underline underline-offset-2 hover:text-info-strong",
|
|
3102
3207
|
children: url
|
|
3103
3208
|
}) : null,
|
|
3104
3209
|
preview ? /* @__PURE__ */ jsx("p", {
|
|
3105
|
-
className: "whitespace-pre-wrap text-xs leading-5 text-
|
|
3210
|
+
className: "whitespace-pre-wrap text-xs leading-5 text-secondary",
|
|
3106
3211
|
children: preview
|
|
3107
3212
|
}) : null,
|
|
3108
3213
|
error ? /* @__PURE__ */ jsxs("p", {
|
|
3109
|
-
className: "text-xs text-
|
|
3214
|
+
className: "text-xs text-danger-strong",
|
|
3110
3215
|
children: [
|
|
3111
3216
|
/* @__PURE__ */ jsxs("span", {
|
|
3112
3217
|
className: "font-semibold",
|
|
@@ -3185,159 +3290,161 @@ function ToolResultEmailSendCard({ part, className, locale }) {
|
|
|
3185
3290
|
const emailInput = parseEmailSendInput(part);
|
|
3186
3291
|
const emailResult = parseEmailSendResult(part);
|
|
3187
3292
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
3188
|
-
const statusClass = part.state === "error" ? "border-
|
|
3293
|
+
const statusClass = part.state === "error" ? "border-danger-border bg-danger-subtle text-danger-strong" : part.state === "pending" ? "border-warning-border bg-warning-subtle text-warning-strong" : "border-success-border bg-success-subtle text-success-strong";
|
|
3189
3294
|
return /* @__PURE__ */ jsxs("section", {
|
|
3190
|
-
className: joinClasses("
|
|
3295
|
+
className: joinClasses("plai-tool-result-email-send-card overflow-hidden rounded-lg border border-border bg-surface-muted", className),
|
|
3191
3296
|
"data-tool-call-id": part.id,
|
|
3192
3297
|
"data-tool-call-state": part.state,
|
|
3193
|
-
children: [
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3298
|
+
children: [/* @__PURE__ */ jsx("header", {
|
|
3299
|
+
className: "flex items-center gap-2 border-b border-border px-3 py-2 text-xs text-secondary",
|
|
3300
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
3301
|
+
type: "button",
|
|
3302
|
+
"aria-expanded": isExpanded,
|
|
3303
|
+
"aria-label": isExpanded ? copy.collapse : copy.expand,
|
|
3304
|
+
"aria-controls": `tool-email-details-${part.id}`,
|
|
3305
|
+
className: "flex w-full cursor-pointer items-center justify-between gap-2 rounded text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
3306
|
+
onClick: () => setIsExpanded((previous) => !previous),
|
|
3307
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3308
|
+
className: "text-sm font-semibold text-foreground",
|
|
3198
3309
|
children: copy.email
|
|
3199
|
-
}), /* @__PURE__ */ jsxs("
|
|
3310
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
3200
3311
|
className: "flex items-center gap-2",
|
|
3201
3312
|
children: [/* @__PURE__ */ jsx("span", {
|
|
3202
|
-
className: joinClasses("rounded-full
|
|
3313
|
+
className: joinClasses("rounded-full border capitalize px-2 py-0.5 text-xs", statusClass),
|
|
3203
3314
|
children: getUiStatusLabel(part.state, copy)
|
|
3204
|
-
}), /* @__PURE__ */ jsx(
|
|
3205
|
-
|
|
3206
|
-
"aria-
|
|
3207
|
-
|
|
3208
|
-
"
|
|
3209
|
-
|
|
3210
|
-
onClick: () => setIsExpanded((previous) => !previous),
|
|
3211
|
-
children: isExpanded ? /* @__PURE__ */ jsx(Minus, {
|
|
3212
|
-
className: "h-3 w-3",
|
|
3213
|
-
"aria-hidden": "true"
|
|
3214
|
-
}) : /* @__PURE__ */ jsx(Plus, {
|
|
3215
|
-
className: "h-3 w-3",
|
|
3216
|
-
"aria-hidden": "true"
|
|
3217
|
-
})
|
|
3315
|
+
}), isExpanded ? /* @__PURE__ */ jsx(ChevronUp, {
|
|
3316
|
+
className: "h-4 w-4 text-muted",
|
|
3317
|
+
"aria-hidden": "true"
|
|
3318
|
+
}) : /* @__PURE__ */ jsx(ChevronDown, {
|
|
3319
|
+
className: "h-4 w-4 text-muted",
|
|
3320
|
+
"aria-hidden": "true"
|
|
3218
3321
|
})]
|
|
3219
3322
|
})]
|
|
3220
|
-
})
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
3227
|
-
className: "text-xs text-slate-900",
|
|
3228
|
-
children: emailInput.subject
|
|
3229
|
-
})]
|
|
3230
|
-
}) : null,
|
|
3231
|
-
/* @__PURE__ */ jsxs("div", {
|
|
3232
|
-
className: "flex items-center gap-1",
|
|
3233
|
-
children: [/* @__PURE__ */ jsxs("p", {
|
|
3234
|
-
className: "text-xs font-semibold text-slate-600",
|
|
3235
|
-
children: [copy.to, ":"]
|
|
3236
|
-
}), emailInput.to.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
3237
|
-
className: "flex flex-wrap gap-2",
|
|
3238
|
-
children: emailInput.to.map((recipient) => /* @__PURE__ */ jsx("span", {
|
|
3239
|
-
className: "rounded-full border border-slate-300 bg-slate-100 px-2 py-0.5 text-xs text-slate-700",
|
|
3240
|
-
children: recipient
|
|
3241
|
-
}, recipient))
|
|
3242
|
-
}) : /* @__PURE__ */ jsx("p", {
|
|
3243
|
-
className: "text-xs text-slate-500",
|
|
3244
|
-
children: copy.noRecipientsProvided
|
|
3245
|
-
})]
|
|
3246
|
-
}),
|
|
3247
|
-
/* @__PURE__ */ jsxs("div", {
|
|
3248
|
-
id: `tool-email-details-${part.id}`,
|
|
3249
|
-
"data-testid": "email-send-details",
|
|
3250
|
-
className: joinClasses(isExpanded ? "block space-y-4" : "hidden"),
|
|
3251
|
-
children: [emailInput.text ? /* @__PURE__ */ jsxs("div", {
|
|
3252
|
-
className: "space-y-1",
|
|
3323
|
+
})
|
|
3324
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
3325
|
+
className: "space-y-4 px-3 py-2",
|
|
3326
|
+
children: [
|
|
3327
|
+
emailInput.subject ? /* @__PURE__ */ jsxs("div", {
|
|
3328
|
+
className: "flex items-center gap-1",
|
|
3253
3329
|
children: [/* @__PURE__ */ jsxs("p", {
|
|
3254
|
-
className: "text-xs font-semibold text-
|
|
3255
|
-
children: [copy.
|
|
3330
|
+
className: "text-xs font-semibold text-secondary",
|
|
3331
|
+
children: [copy.subject, ":"]
|
|
3256
3332
|
}), /* @__PURE__ */ jsx("p", {
|
|
3257
|
-
className: "
|
|
3258
|
-
children: emailInput.
|
|
3333
|
+
className: "text-xs text-foreground",
|
|
3334
|
+
children: emailInput.subject
|
|
3335
|
+
})]
|
|
3336
|
+
}) : null,
|
|
3337
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3338
|
+
className: "flex items-center gap-1",
|
|
3339
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
3340
|
+
className: "text-xs font-semibold text-secondary",
|
|
3341
|
+
children: [copy.to, ":"]
|
|
3342
|
+
}), emailInput.to.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
3343
|
+
className: "flex flex-wrap gap-2",
|
|
3344
|
+
children: emailInput.to.map((recipient) => /* @__PURE__ */ jsx("span", {
|
|
3345
|
+
className: "rounded-full border border-border-strong bg-surface-subtle px-2 py-0.5 text-xs text-strong",
|
|
3346
|
+
children: recipient
|
|
3347
|
+
}, recipient))
|
|
3348
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
3349
|
+
className: "text-xs text-muted",
|
|
3350
|
+
children: copy.noRecipientsProvided
|
|
3259
3351
|
})]
|
|
3260
|
-
})
|
|
3261
|
-
|
|
3352
|
+
}),
|
|
3353
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3354
|
+
id: `tool-email-details-${part.id}`,
|
|
3355
|
+
"data-testid": "email-send-details",
|
|
3356
|
+
className: joinClasses(isExpanded ? "block space-y-4" : "hidden"),
|
|
3357
|
+
children: [emailInput.text ? /* @__PURE__ */ jsxs("div", {
|
|
3358
|
+
className: "space-y-1",
|
|
3359
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
3360
|
+
className: "text-xs font-semibold text-secondary",
|
|
3361
|
+
children: [copy.body, ":"]
|
|
3362
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
3363
|
+
className: "whitespace-pre-wrap rounded border border-border bg-surface p-2 text-sm text-strong",
|
|
3364
|
+
children: emailInput.text
|
|
3365
|
+
})]
|
|
3366
|
+
}) : null, part.result !== void 0 ? /* @__PURE__ */ jsxs("div", {
|
|
3367
|
+
className: "space-y-2 rounded border border-border bg-surface-muted p-3",
|
|
3368
|
+
children: [
|
|
3369
|
+
/* @__PURE__ */ jsx("p", {
|
|
3370
|
+
className: "text-xs font-semibold capitalize tracking-wide text-muted",
|
|
3371
|
+
children: copy.delivery
|
|
3372
|
+
}),
|
|
3373
|
+
emailResult.status ? /* @__PURE__ */ jsxs("p", {
|
|
3374
|
+
className: "text-xs text-strong",
|
|
3375
|
+
children: [
|
|
3376
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3377
|
+
className: "font-semibold text-foreground",
|
|
3378
|
+
children: [copy.status, ":"]
|
|
3379
|
+
}),
|
|
3380
|
+
" ",
|
|
3381
|
+
emailResult.status
|
|
3382
|
+
]
|
|
3383
|
+
}) : null,
|
|
3384
|
+
emailResult.recipientsCount !== null ? /* @__PURE__ */ jsxs("p", {
|
|
3385
|
+
className: "text-xs text-strong",
|
|
3386
|
+
children: [
|
|
3387
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3388
|
+
className: "font-semibold text-foreground",
|
|
3389
|
+
children: [copy.recipients, ":"]
|
|
3390
|
+
}),
|
|
3391
|
+
" ",
|
|
3392
|
+
emailResult.recipientsCount
|
|
3393
|
+
]
|
|
3394
|
+
}) : null,
|
|
3395
|
+
emailResult.receiptProvider ? /* @__PURE__ */ jsxs("p", {
|
|
3396
|
+
className: "text-xs text-strong",
|
|
3397
|
+
children: [
|
|
3398
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3399
|
+
className: "font-semibold text-foreground",
|
|
3400
|
+
children: [copy.provider, ":"]
|
|
3401
|
+
}),
|
|
3402
|
+
" ",
|
|
3403
|
+
emailResult.receiptProvider
|
|
3404
|
+
]
|
|
3405
|
+
}) : null,
|
|
3406
|
+
emailResult.receiptMessageId ? /* @__PURE__ */ jsxs("p", {
|
|
3407
|
+
className: "break-all text-xs text-strong",
|
|
3408
|
+
children: [
|
|
3409
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3410
|
+
className: "font-semibold text-foreground",
|
|
3411
|
+
children: [copy.messageId, ":"]
|
|
3412
|
+
}),
|
|
3413
|
+
" ",
|
|
3414
|
+
emailResult.receiptMessageId
|
|
3415
|
+
]
|
|
3416
|
+
}) : null,
|
|
3417
|
+
emailResult.receiptRawStatus ? /* @__PURE__ */ jsxs("p", {
|
|
3418
|
+
className: "text-xs text-strong",
|
|
3419
|
+
children: [
|
|
3420
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3421
|
+
className: "font-semibold text-foreground",
|
|
3422
|
+
children: [copy.rawStatus, ":"]
|
|
3423
|
+
}),
|
|
3424
|
+
" ",
|
|
3425
|
+
emailResult.receiptRawStatus
|
|
3426
|
+
]
|
|
3427
|
+
}) : null,
|
|
3428
|
+
emailResult.raw ? /* @__PURE__ */ jsx("p", {
|
|
3429
|
+
className: "whitespace-pre-wrap text-xs text-strong",
|
|
3430
|
+
children: emailResult.raw
|
|
3431
|
+
}) : null
|
|
3432
|
+
]
|
|
3433
|
+
}) : null]
|
|
3434
|
+
}),
|
|
3435
|
+
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
3436
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
3262
3437
|
children: [
|
|
3263
|
-
/* @__PURE__ */
|
|
3264
|
-
className: "
|
|
3265
|
-
children: copy.
|
|
3438
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3439
|
+
className: "font-semibold",
|
|
3440
|
+
children: [copy.errorDetails, ":"]
|
|
3266
3441
|
}),
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
children: [
|
|
3270
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3271
|
-
className: "font-semibold text-slate-900",
|
|
3272
|
-
children: [copy.status, ":"]
|
|
3273
|
-
}),
|
|
3274
|
-
" ",
|
|
3275
|
-
emailResult.status
|
|
3276
|
-
]
|
|
3277
|
-
}) : null,
|
|
3278
|
-
emailResult.recipientsCount !== null ? /* @__PURE__ */ jsxs("p", {
|
|
3279
|
-
className: "text-xs text-slate-700",
|
|
3280
|
-
children: [
|
|
3281
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3282
|
-
className: "font-semibold text-slate-900",
|
|
3283
|
-
children: [copy.recipients, ":"]
|
|
3284
|
-
}),
|
|
3285
|
-
" ",
|
|
3286
|
-
emailResult.recipientsCount
|
|
3287
|
-
]
|
|
3288
|
-
}) : null,
|
|
3289
|
-
emailResult.receiptProvider ? /* @__PURE__ */ jsxs("p", {
|
|
3290
|
-
className: "text-xs text-slate-700",
|
|
3291
|
-
children: [
|
|
3292
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3293
|
-
className: "font-semibold text-slate-900",
|
|
3294
|
-
children: [copy.provider, ":"]
|
|
3295
|
-
}),
|
|
3296
|
-
" ",
|
|
3297
|
-
emailResult.receiptProvider
|
|
3298
|
-
]
|
|
3299
|
-
}) : null,
|
|
3300
|
-
emailResult.receiptMessageId ? /* @__PURE__ */ jsxs("p", {
|
|
3301
|
-
className: "break-all text-xs text-slate-700",
|
|
3302
|
-
children: [
|
|
3303
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3304
|
-
className: "font-semibold text-slate-900",
|
|
3305
|
-
children: [copy.messageId, ":"]
|
|
3306
|
-
}),
|
|
3307
|
-
" ",
|
|
3308
|
-
emailResult.receiptMessageId
|
|
3309
|
-
]
|
|
3310
|
-
}) : null,
|
|
3311
|
-
emailResult.receiptRawStatus ? /* @__PURE__ */ jsxs("p", {
|
|
3312
|
-
className: "text-xs text-slate-700",
|
|
3313
|
-
children: [
|
|
3314
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3315
|
-
className: "font-semibold text-slate-900",
|
|
3316
|
-
children: [copy.rawStatus, ":"]
|
|
3317
|
-
}),
|
|
3318
|
-
" ",
|
|
3319
|
-
emailResult.receiptRawStatus
|
|
3320
|
-
]
|
|
3321
|
-
}) : null,
|
|
3322
|
-
emailResult.raw ? /* @__PURE__ */ jsx("p", {
|
|
3323
|
-
className: "whitespace-pre-wrap text-xs text-slate-700",
|
|
3324
|
-
children: emailResult.raw
|
|
3325
|
-
}) : null
|
|
3442
|
+
" ",
|
|
3443
|
+
errorDetails
|
|
3326
3444
|
]
|
|
3327
|
-
}) : null
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
|
|
3331
|
-
children: [
|
|
3332
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3333
|
-
className: "font-semibold",
|
|
3334
|
-
children: [copy.errorDetails, ":"]
|
|
3335
|
-
}),
|
|
3336
|
-
" ",
|
|
3337
|
-
errorDetails
|
|
3338
|
-
]
|
|
3339
|
-
}) : null
|
|
3340
|
-
]
|
|
3445
|
+
}) : null
|
|
3446
|
+
]
|
|
3447
|
+
})]
|
|
3341
3448
|
});
|
|
3342
3449
|
}
|
|
3343
3450
|
|
|
@@ -3412,15 +3519,15 @@ function ToolResultExternalDatasourceCard({ part, className, locale }) {
|
|
|
3412
3519
|
const sqlQuery = toStringOrNull(part.metadata?.sql_query);
|
|
3413
3520
|
const table = normalizeTable(getTableValue(part), copy);
|
|
3414
3521
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
3415
|
-
const statusClass = part.state === "error" ? "text-
|
|
3522
|
+
const statusClass = part.state === "error" ? "text-danger" : part.state === "pending" ? "text-warning" : "text-success";
|
|
3416
3523
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
3417
3524
|
"aria-label": `${copy.externalDatasource}: ${getUiStatusLabel(part.state, copy)}`,
|
|
3418
|
-
className: joinClasses("w-full overflow-hidden rounded-lg border border-
|
|
3525
|
+
className: joinClasses("plai-tool-result-external-datasource-card w-full overflow-hidden rounded-lg border border-border bg-surface text-left font-normal text-foreground transition-colors hover:bg-surface-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", className),
|
|
3419
3526
|
children: /* @__PURE__ */ jsxs("span", {
|
|
3420
3527
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
3421
3528
|
children: [
|
|
3422
3529
|
/* @__PURE__ */ jsx(Database, {
|
|
3423
|
-
className: "h-4 w-4 shrink-0 text-
|
|
3530
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
3424
3531
|
"aria-hidden": "true"
|
|
3425
3532
|
}),
|
|
3426
3533
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3456,14 +3563,14 @@ function ToolResultExternalDatasourceCard({ part, className, locale }) {
|
|
|
3456
3563
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
3457
3564
|
className: "flex items-center gap-2",
|
|
3458
3565
|
children: [/* @__PURE__ */ jsx(Database, {
|
|
3459
|
-
className: "h-5 w-5 text-
|
|
3566
|
+
className: "h-5 w-5 text-info",
|
|
3460
3567
|
"aria-hidden": "true"
|
|
3461
3568
|
}), /* @__PURE__ */ jsx("h3", {
|
|
3462
3569
|
className: "text-sm font-medium",
|
|
3463
3570
|
children: copy.sqlQuery
|
|
3464
3571
|
})]
|
|
3465
3572
|
}), /* @__PURE__ */ jsx("pre", {
|
|
3466
|
-
className: "overflow-x-auto rounded-md border border-
|
|
3573
|
+
className: "overflow-x-auto rounded-md border border-border bg-surface-muted p-3 text-xs leading-5 text-strong",
|
|
3467
3574
|
children: sqlQuery
|
|
3468
3575
|
})]
|
|
3469
3576
|
}) : null,
|
|
@@ -3473,22 +3580,22 @@ function ToolResultExternalDatasourceCard({ part, className, locale }) {
|
|
|
3473
3580
|
className: "text-sm font-medium",
|
|
3474
3581
|
children: copy.queryResults
|
|
3475
3582
|
}), /* @__PURE__ */ jsx("div", {
|
|
3476
|
-
className: "overflow-x-auto rounded-md border border-
|
|
3583
|
+
className: "overflow-x-auto rounded-md border border-border",
|
|
3477
3584
|
children: /* @__PURE__ */ jsxs("table", {
|
|
3478
3585
|
className: "w-full border-collapse text-left text-xs",
|
|
3479
3586
|
children: [/* @__PURE__ */ jsx("thead", {
|
|
3480
|
-
className: "bg-
|
|
3587
|
+
className: "bg-surface-muted text-secondary",
|
|
3481
3588
|
children: /* @__PURE__ */ jsx("tr", { children: table.columns.map((column) => /* @__PURE__ */ jsx("th", {
|
|
3482
|
-
className: "max-w-56 truncate border-b border-
|
|
3589
|
+
className: "max-w-56 truncate border-b border-border px-3 py-2 font-medium",
|
|
3483
3590
|
title: column,
|
|
3484
3591
|
children: column
|
|
3485
3592
|
}, column)) })
|
|
3486
3593
|
}), /* @__PURE__ */ jsx("tbody", { children: table.rows.map((row) => /* @__PURE__ */ jsx("tr", {
|
|
3487
|
-
className: "border-b border-
|
|
3594
|
+
className: "border-b border-divider last:border-0",
|
|
3488
3595
|
children: table.columns.map((column, columnIndex) => {
|
|
3489
3596
|
const value = formatCell(row[columnIndex]);
|
|
3490
3597
|
return /* @__PURE__ */ jsx("td", {
|
|
3491
|
-
className: "max-w-56 truncate px-3 py-2 text-
|
|
3598
|
+
className: "max-w-56 truncate px-3 py-2 text-strong",
|
|
3492
3599
|
title: value,
|
|
3493
3600
|
children: value
|
|
3494
3601
|
}, column);
|
|
@@ -3497,11 +3604,11 @@ function ToolResultExternalDatasourceCard({ part, className, locale }) {
|
|
|
3497
3604
|
})
|
|
3498
3605
|
})]
|
|
3499
3606
|
}) : part.state === "completed" && !errorDetails ? /* @__PURE__ */ jsx("p", {
|
|
3500
|
-
className: "text-sm text-
|
|
3607
|
+
className: "text-sm text-secondary",
|
|
3501
3608
|
children: copy.noDataToDisplay
|
|
3502
3609
|
}) : null,
|
|
3503
3610
|
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
3504
|
-
className: "rounded border border-
|
|
3611
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
3505
3612
|
children: [
|
|
3506
3613
|
/* @__PURE__ */ jsxs("span", {
|
|
3507
3614
|
className: "font-semibold",
|
|
@@ -3537,12 +3644,12 @@ function ToolResultHttpRequestCard({ part, className, locale }) {
|
|
|
3537
3644
|
const status = statusCode ? `${statusCode}${metadata?.status_reason ? ` ${metadata.status_reason}` : ""}` : getUiStatusLabel(part.state, copy);
|
|
3538
3645
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
3539
3646
|
"aria-label": `${copy.httpRequest}: ${status}`,
|
|
3540
|
-
className: joinClasses("w-full rounded-lg border border-
|
|
3647
|
+
className: joinClasses("plai-tool-result-http-request-card w-full rounded-lg border border-border bg-surface text-left font-normal text-foreground transition-colors hover:bg-surface-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", className),
|
|
3541
3648
|
children: /* @__PURE__ */ jsxs("span", {
|
|
3542
3649
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
3543
3650
|
children: [
|
|
3544
3651
|
/* @__PURE__ */ jsx(Globe, {
|
|
3545
|
-
className: "h-4 w-4 shrink-0 text-
|
|
3652
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
3546
3653
|
"aria-hidden": "true"
|
|
3547
3654
|
}),
|
|
3548
3655
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3550,11 +3657,11 @@ function ToolResultHttpRequestCard({ part, className, locale }) {
|
|
|
3550
3657
|
children: metadata?.method ?? "HTTP"
|
|
3551
3658
|
}),
|
|
3552
3659
|
/* @__PURE__ */ jsx("span", {
|
|
3553
|
-
className: "min-w-0 truncate text-
|
|
3660
|
+
className: "min-w-0 truncate text-secondary",
|
|
3554
3661
|
children: metadata?.url ?? part.name
|
|
3555
3662
|
}),
|
|
3556
3663
|
/* @__PURE__ */ jsx("span", {
|
|
3557
|
-
className: joinClasses("ml-auto shrink-0", failed ? "text-
|
|
3664
|
+
className: joinClasses("ml-auto shrink-0", failed ? "text-danger" : "text-success"),
|
|
3558
3665
|
children: failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
3559
3666
|
className: "h-4 w-4",
|
|
3560
3667
|
"aria-hidden": "true"
|
|
@@ -3578,25 +3685,25 @@ function ToolResultHttpRequestCard({ part, className, locale }) {
|
|
|
3578
3685
|
className: "grid gap-2 text-sm",
|
|
3579
3686
|
children: [
|
|
3580
3687
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3581
|
-
className: "text-xs text-
|
|
3688
|
+
className: "text-xs text-muted",
|
|
3582
3689
|
children: copy.status
|
|
3583
3690
|
}), /* @__PURE__ */ jsx("dd", { children: status })] }),
|
|
3584
3691
|
metadata?.url ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3585
|
-
className: "text-xs text-
|
|
3692
|
+
className: "text-xs text-muted",
|
|
3586
3693
|
children: copy.requestUrl
|
|
3587
3694
|
}), /* @__PURE__ */ jsx("dd", {
|
|
3588
3695
|
className: "break-all",
|
|
3589
3696
|
children: metadata.url
|
|
3590
3697
|
})] }) : null,
|
|
3591
3698
|
metadata?.response_url && metadata.response_url !== metadata.url ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3592
|
-
className: "text-xs text-
|
|
3699
|
+
className: "text-xs text-muted",
|
|
3593
3700
|
children: copy.responseUrl
|
|
3594
3701
|
}), /* @__PURE__ */ jsx("dd", {
|
|
3595
3702
|
className: "break-all",
|
|
3596
3703
|
children: metadata.response_url
|
|
3597
3704
|
})] }) : null,
|
|
3598
3705
|
metadata?.content_type ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3599
|
-
className: "text-xs text-
|
|
3706
|
+
className: "text-xs text-muted",
|
|
3600
3707
|
children: copy.contentType
|
|
3601
3708
|
}), /* @__PURE__ */ jsx("dd", { children: metadata.content_type })] }) : null
|
|
3602
3709
|
]
|
|
@@ -3605,18 +3712,18 @@ function ToolResultHttpRequestCard({ part, className, locale }) {
|
|
|
3605
3712
|
className: "mb-2 text-sm font-medium",
|
|
3606
3713
|
children: copy.response
|
|
3607
3714
|
}), /* @__PURE__ */ jsx("pre", {
|
|
3608
|
-
className: "overflow-x-auto rounded-md border border-
|
|
3715
|
+
className: "overflow-x-auto rounded-md border border-border bg-surface-muted p-3 text-xs leading-5",
|
|
3609
3716
|
children: response
|
|
3610
3717
|
})] }) : null,
|
|
3611
3718
|
metadata?.response_headers && Object.keys(metadata.response_headers).length ? /* @__PURE__ */ jsxs("details", { children: [/* @__PURE__ */ jsx("summary", {
|
|
3612
3719
|
className: "cursor-pointer text-sm font-medium",
|
|
3613
3720
|
children: copy.responseHeaders
|
|
3614
3721
|
}), /* @__PURE__ */ jsx("pre", {
|
|
3615
|
-
className: "mt-2 overflow-x-auto rounded-md border border-
|
|
3722
|
+
className: "mt-2 overflow-x-auto rounded-md border border-border bg-surface-muted p-3 text-xs",
|
|
3616
3723
|
children: JSON.stringify(metadata.response_headers, null, 2)
|
|
3617
3724
|
})] }) : null,
|
|
3618
3725
|
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
3619
|
-
className: "rounded border border-
|
|
3726
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
3620
3727
|
children: [
|
|
3621
3728
|
/* @__PURE__ */ jsxs("span", {
|
|
3622
3729
|
className: "font-semibold",
|
|
@@ -3652,12 +3759,12 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3652
3759
|
const failed = part.state === "error";
|
|
3653
3760
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
3654
3761
|
"aria-label": `${copy.mcpTool}: ${tool}`,
|
|
3655
|
-
className: joinClasses("w-full rounded-lg border border-
|
|
3762
|
+
className: joinClasses("plai-tool-result-mcp-card w-full rounded-lg border border-border bg-surface text-left font-normal text-foreground transition-colors hover:bg-surface-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", className),
|
|
3656
3763
|
children: /* @__PURE__ */ jsxs("span", {
|
|
3657
3764
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
3658
3765
|
children: [
|
|
3659
3766
|
/* @__PURE__ */ jsx(Plug, {
|
|
3660
|
-
className: "h-4 w-4 shrink-0 text-
|
|
3767
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
3661
3768
|
"aria-hidden": "true"
|
|
3662
3769
|
}),
|
|
3663
3770
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3665,11 +3772,11 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3665
3772
|
children: "MCP"
|
|
3666
3773
|
}),
|
|
3667
3774
|
/* @__PURE__ */ jsx("span", {
|
|
3668
|
-
className: "min-w-0 truncate border-
|
|
3775
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
3669
3776
|
children: tool
|
|
3670
3777
|
}),
|
|
3671
3778
|
/* @__PURE__ */ jsx("span", {
|
|
3672
|
-
className: joinClasses("ml-auto shrink-0", failed ? "text-
|
|
3779
|
+
className: joinClasses("ml-auto shrink-0", failed ? "text-danger" : "text-success"),
|
|
3673
3780
|
children: failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
3674
3781
|
className: "h-4 w-4",
|
|
3675
3782
|
"aria-hidden": "true"
|
|
@@ -3692,10 +3799,10 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3692
3799
|
/* @__PURE__ */ jsxs("dl", {
|
|
3693
3800
|
className: "grid gap-2 text-sm",
|
|
3694
3801
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3695
|
-
className: "text-xs text-
|
|
3802
|
+
className: "text-xs text-muted",
|
|
3696
3803
|
children: copy.tool
|
|
3697
3804
|
}), /* @__PURE__ */ jsx("dd", { children: tool })] }), server ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3698
|
-
className: "text-xs text-
|
|
3805
|
+
className: "text-xs text-muted",
|
|
3699
3806
|
children: copy.server
|
|
3700
3807
|
}), /* @__PURE__ */ jsx("dd", {
|
|
3701
3808
|
className: "break-all",
|
|
@@ -3706,11 +3813,11 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3706
3813
|
className: "mb-2 text-sm font-medium",
|
|
3707
3814
|
children: copy.result
|
|
3708
3815
|
}), /* @__PURE__ */ jsx("pre", {
|
|
3709
|
-
className: "overflow-x-auto rounded-md border border-
|
|
3816
|
+
className: "overflow-x-auto rounded-md border border-border bg-surface-muted p-3 text-xs leading-5",
|
|
3710
3817
|
children: result
|
|
3711
3818
|
})] }) : null,
|
|
3712
3819
|
error ? /* @__PURE__ */ jsxs("p", {
|
|
3713
|
-
className: "rounded border border-
|
|
3820
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
3714
3821
|
children: [
|
|
3715
3822
|
/* @__PURE__ */ jsxs("span", {
|
|
3716
3823
|
className: "font-semibold",
|
|
@@ -3725,6 +3832,83 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3725
3832
|
})] });
|
|
3726
3833
|
}
|
|
3727
3834
|
|
|
3835
|
+
//#endregion
|
|
3836
|
+
//#region src/components/internal/download-file.ts
|
|
3837
|
+
/**
|
|
3838
|
+
* Single entry point for downloading a chat file.
|
|
3839
|
+
*
|
|
3840
|
+
* Fetches the bytes and saves them under the file name, so the browser neither
|
|
3841
|
+
* navigates nor opens a tab. That read needs the file host to allow this origin
|
|
3842
|
+
* (CORS); when it does not, the URL opens in a new tab instead. An HTTP error
|
|
3843
|
+
* (expired, deleted or private object) rejects so the caller can say so.
|
|
3844
|
+
*/
|
|
3845
|
+
async function downloadFile(file) {
|
|
3846
|
+
let response;
|
|
3847
|
+
try {
|
|
3848
|
+
response = await fetch(file.url, { credentials: "omit" });
|
|
3849
|
+
} catch {
|
|
3850
|
+
openInNewTab(file.url);
|
|
3851
|
+
return;
|
|
3852
|
+
}
|
|
3853
|
+
if (!response.ok) throw new Error(`Download failed with status ${response.status}`);
|
|
3854
|
+
saveBlob(await response.blob(), file.name || getFilenameFromUrl(file.url) || "download");
|
|
3855
|
+
}
|
|
3856
|
+
function saveBlob(blob, fileName) {
|
|
3857
|
+
const objectUrl = URL.createObjectURL(blob);
|
|
3858
|
+
const anchor = document.createElement("a");
|
|
3859
|
+
anchor.href = objectUrl;
|
|
3860
|
+
anchor.download = fileName;
|
|
3861
|
+
anchor.rel = "noopener";
|
|
3862
|
+
anchor.style.display = "none";
|
|
3863
|
+
document.body.appendChild(anchor);
|
|
3864
|
+
anchor.click();
|
|
3865
|
+
anchor.remove();
|
|
3866
|
+
window.setTimeout(() => URL.revokeObjectURL(objectUrl), 1e3);
|
|
3867
|
+
}
|
|
3868
|
+
function openInNewTab(url) {
|
|
3869
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3872
|
+
//#endregion
|
|
3873
|
+
//#region src/components/internal/file-download-button.tsx
|
|
3874
|
+
function FileDownloadButton({ file, label, copy, className }) {
|
|
3875
|
+
const [state, setState] = useState("idle");
|
|
3876
|
+
const isDownloading = state === "downloading";
|
|
3877
|
+
const handleClick = async (event) => {
|
|
3878
|
+
event.stopPropagation();
|
|
3879
|
+
if (isDownloading) return;
|
|
3880
|
+
setState("downloading");
|
|
3881
|
+
try {
|
|
3882
|
+
await downloadFile(file);
|
|
3883
|
+
setState("idle");
|
|
3884
|
+
} catch {
|
|
3885
|
+
setState("error");
|
|
3886
|
+
}
|
|
3887
|
+
};
|
|
3888
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
3889
|
+
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
3890
|
+
children: [state === "error" ? /* @__PURE__ */ jsx("span", {
|
|
3891
|
+
role: "alert",
|
|
3892
|
+
className: "text-xs text-danger",
|
|
3893
|
+
children: copy.downloadFailed
|
|
3894
|
+
}) : null, /* @__PURE__ */ jsx("button", {
|
|
3895
|
+
type: "button",
|
|
3896
|
+
onClick: handleClick,
|
|
3897
|
+
disabled: isDownloading,
|
|
3898
|
+
"aria-label": `${isDownloading ? copy.downloading : copy.download}: ${label}`,
|
|
3899
|
+
title: isDownloading ? copy.downloading : copy.download,
|
|
3900
|
+
className: joinClasses("inline-flex h-8 w-8 items-center justify-center rounded-md border border-border bg-surface text-strong transition-colors hover:bg-surface-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:cursor-wait disabled:opacity-60", className),
|
|
3901
|
+
children: isDownloading ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
3902
|
+
className: "h-4 w-4 animate-spin",
|
|
3903
|
+
"aria-hidden": "true"
|
|
3904
|
+
}) : /* @__PURE__ */ jsx(Download, {
|
|
3905
|
+
className: "h-4 w-4",
|
|
3906
|
+
"aria-hidden": "true"
|
|
3907
|
+
})
|
|
3908
|
+
})]
|
|
3909
|
+
});
|
|
3910
|
+
}
|
|
3911
|
+
|
|
3728
3912
|
//#endregion
|
|
3729
3913
|
//#region src/components/tool-result-office-documents-card.tsx
|
|
3730
3914
|
function getFiles(part) {
|
|
@@ -3732,41 +3916,61 @@ function getFiles(part) {
|
|
|
3732
3916
|
return Array.isArray(files) ? files.filter((file) => Boolean(file) && typeof file === "object" && typeof file.id === "string") : [];
|
|
3733
3917
|
}
|
|
3734
3918
|
function getExtension(file) {
|
|
3735
|
-
|
|
3736
|
-
const extension = name.split(".").pop()?.toLowerCase();
|
|
3737
|
-
if (extension && extension !== name.toLowerCase()) return extension;
|
|
3738
|
-
const mime = file.content_type ?? "";
|
|
3739
|
-
if (mime.includes("pdf")) return "pdf";
|
|
3740
|
-
if (mime.includes("wordprocessingml")) return "docx";
|
|
3741
|
-
if (mime.includes("spreadsheetml")) return "xlsx";
|
|
3742
|
-
if (mime.includes("presentationml")) return "pptx";
|
|
3743
|
-
return null;
|
|
3919
|
+
return getFileExtension(file.name ?? file.pathname, file.content_type);
|
|
3744
3920
|
}
|
|
3745
|
-
function
|
|
3746
|
-
|
|
3747
|
-
if (["doc", "docx"].includes(extension ?? "")) return "text-blue-600";
|
|
3748
|
-
if ([
|
|
3749
|
-
"xls",
|
|
3750
|
-
"xlsx",
|
|
3751
|
-
"csv"
|
|
3752
|
-
].includes(extension ?? "")) return "text-emerald-600";
|
|
3753
|
-
if (["ppt", "pptx"].includes(extension ?? "")) return "text-orange-600";
|
|
3754
|
-
return "text-neutral-500";
|
|
3921
|
+
function getLabel(file) {
|
|
3922
|
+
return file.name ?? file.pathname ?? file.id;
|
|
3755
3923
|
}
|
|
3756
3924
|
function ToolResultOfficeDocumentsCard({ part, className, locale }) {
|
|
3757
3925
|
const copy = getUiCopy(locale);
|
|
3758
3926
|
const files = getFiles(part);
|
|
3759
3927
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
3760
3928
|
const fileLabel = files.length === 1 ? copy.file : copy.files;
|
|
3761
|
-
const statusClass = part.state === "error" ? "text-
|
|
3929
|
+
const statusClass = part.state === "error" ? "text-danger" : part.state === "pending" ? "text-warning" : "text-success";
|
|
3930
|
+
const singleFile = part.state === "completed" && files.length === 1 && !errorDetails ? files[0] : void 0;
|
|
3931
|
+
if (singleFile) {
|
|
3932
|
+
const extension = getExtension(singleFile);
|
|
3933
|
+
const label = getLabel(singleFile);
|
|
3934
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
3935
|
+
"aria-label": `${copy.officeDocuments}: ${label}`,
|
|
3936
|
+
className: joinClasses("plai-tool-result-office-documents-card flex w-full items-center gap-3 overflow-hidden rounded-lg border border-border bg-surface px-3 py-2 text-left font-normal text-foreground", className),
|
|
3937
|
+
children: [
|
|
3938
|
+
/* @__PURE__ */ jsx(File, {
|
|
3939
|
+
className: joinClasses("h-6 w-6 shrink-0", getFileIconClass(extension)),
|
|
3940
|
+
"aria-hidden": "true"
|
|
3941
|
+
}),
|
|
3942
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3943
|
+
className: "min-w-0",
|
|
3944
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
3945
|
+
className: "truncate text-sm font-medium",
|
|
3946
|
+
children: label
|
|
3947
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
3948
|
+
className: "truncate text-[11px] text-muted",
|
|
3949
|
+
children: [copy.officeDocuments, extension ? ` · ${extension.toUpperCase()}` : null]
|
|
3950
|
+
})]
|
|
3951
|
+
}),
|
|
3952
|
+
singleFile.url ? /* @__PURE__ */ jsx(FileDownloadButton, {
|
|
3953
|
+
file: {
|
|
3954
|
+
url: singleFile.url,
|
|
3955
|
+
name: singleFile.name
|
|
3956
|
+
},
|
|
3957
|
+
label,
|
|
3958
|
+
copy
|
|
3959
|
+
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
3960
|
+
className: "ml-auto h-4 w-4 shrink-0 text-success",
|
|
3961
|
+
"aria-hidden": "true"
|
|
3962
|
+
})
|
|
3963
|
+
]
|
|
3964
|
+
});
|
|
3965
|
+
}
|
|
3762
3966
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
3763
3967
|
"aria-label": `${copy.officeDocuments}: ${files.length} ${fileLabel}`,
|
|
3764
|
-
className: joinClasses("w-full overflow-hidden rounded-lg border border-
|
|
3968
|
+
className: joinClasses("plai-tool-result-office-documents-card w-full overflow-hidden rounded-lg border border-border bg-surface text-left font-normal text-foreground transition-colors hover:bg-surface-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", className),
|
|
3765
3969
|
children: /* @__PURE__ */ jsxs("span", {
|
|
3766
3970
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
3767
3971
|
children: [
|
|
3768
3972
|
/* @__PURE__ */ jsx(FileText, {
|
|
3769
|
-
className: "h-4 w-4 shrink-0 text-
|
|
3973
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
3770
3974
|
"aria-hidden": "true"
|
|
3771
3975
|
}),
|
|
3772
3976
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3774,7 +3978,7 @@ function ToolResultOfficeDocumentsCard({ part, className, locale }) {
|
|
|
3774
3978
|
children: copy.officeDocuments
|
|
3775
3979
|
}),
|
|
3776
3980
|
/* @__PURE__ */ jsx("span", {
|
|
3777
|
-
className: "min-w-0 truncate border-
|
|
3981
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
3778
3982
|
children: part.state === "pending" ? copy.pending : `${files.length} ${fileLabel}`
|
|
3779
3983
|
}),
|
|
3780
3984
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3800,41 +4004,45 @@ function ToolResultOfficeDocumentsCard({ part, className, locale }) {
|
|
|
3800
4004
|
children: [
|
|
3801
4005
|
files.map((file) => {
|
|
3802
4006
|
const extension = getExtension(file);
|
|
3803
|
-
const label = file
|
|
3804
|
-
|
|
3805
|
-
className: "flex items-center gap-3 rounded-lg border border-
|
|
3806
|
-
children: [
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
className: "
|
|
3813
|
-
children:
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
4007
|
+
const label = getLabel(file);
|
|
4008
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4009
|
+
className: "flex items-center gap-3 rounded-lg border border-border bg-surface p-3",
|
|
4010
|
+
children: [
|
|
4011
|
+
/* @__PURE__ */ jsx(File, {
|
|
4012
|
+
className: joinClasses("h-8 w-8 shrink-0", getFileIconClass(extension)),
|
|
4013
|
+
"aria-hidden": "true"
|
|
4014
|
+
}),
|
|
4015
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4016
|
+
className: "min-w-0",
|
|
4017
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
4018
|
+
className: "truncate text-sm font-medium",
|
|
4019
|
+
children: label
|
|
4020
|
+
}), extension ? /* @__PURE__ */ jsx("p", {
|
|
4021
|
+
className: "text-[11px] uppercase text-muted",
|
|
4022
|
+
children: extension
|
|
4023
|
+
}) : null]
|
|
4024
|
+
}),
|
|
4025
|
+
file.url ? /* @__PURE__ */ jsx(FileDownloadButton, {
|
|
4026
|
+
file: {
|
|
4027
|
+
url: file.url,
|
|
4028
|
+
name: file.name
|
|
4029
|
+
},
|
|
4030
|
+
label,
|
|
4031
|
+
copy
|
|
4032
|
+
}) : null
|
|
4033
|
+
]
|
|
3819
4034
|
}, file.id);
|
|
3820
|
-
return file.url ? /* @__PURE__ */ jsx("a", {
|
|
3821
|
-
href: file.url,
|
|
3822
|
-
target: "_blank",
|
|
3823
|
-
rel: "noreferrer noopener",
|
|
3824
|
-
className: "block hover:bg-neutral-50",
|
|
3825
|
-
children: content
|
|
3826
|
-
}, file.id) : /* @__PURE__ */ jsx("div", { children: content }, file.id);
|
|
3827
4035
|
}),
|
|
3828
4036
|
files.length === 0 && part.state === "pending" ? /* @__PURE__ */ jsx("p", {
|
|
3829
|
-
className: "text-sm text-
|
|
4037
|
+
className: "text-sm text-secondary",
|
|
3830
4038
|
children: copy.creatingDocuments
|
|
3831
4039
|
}) : null,
|
|
3832
4040
|
files.length === 0 && part.state === "completed" && !errorDetails ? /* @__PURE__ */ jsx("p", {
|
|
3833
|
-
className: "text-sm text-
|
|
4041
|
+
className: "text-sm text-secondary",
|
|
3834
4042
|
children: copy.noFilesGenerated
|
|
3835
4043
|
}) : null,
|
|
3836
4044
|
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
3837
|
-
className: "rounded border border-
|
|
4045
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
3838
4046
|
children: [
|
|
3839
4047
|
/* @__PURE__ */ jsxs("span", {
|
|
3840
4048
|
className: "font-semibold",
|
|
@@ -4628,11 +4836,11 @@ function statusLabel(status, copy) {
|
|
|
4628
4836
|
return key ? copy[key] : null;
|
|
4629
4837
|
}
|
|
4630
4838
|
const BADGE_TONE = {
|
|
4631
|
-
pending: "border-
|
|
4839
|
+
pending: "border-warning-border bg-warning-subtle text-warning-strong",
|
|
4632
4840
|
executing: "border-sky-200 bg-sky-50 text-sky-800",
|
|
4633
|
-
executed: "border-
|
|
4634
|
-
failed: "border-
|
|
4635
|
-
unknown: "border-
|
|
4841
|
+
executed: "border-success-border bg-success-subtle text-success-strong",
|
|
4842
|
+
failed: "border-danger-border bg-danger-subtle text-danger-strong",
|
|
4843
|
+
unknown: "border-warning-border bg-warning-subtle text-warning-strong"
|
|
4636
4844
|
};
|
|
4637
4845
|
/** Header badge of a held action: "Awaiting your confirmation" or its outcome. */
|
|
4638
4846
|
function ConfirmationBadge({ state, copy }) {
|
|
@@ -4640,7 +4848,7 @@ function ConfirmationBadge({ state, copy }) {
|
|
|
4640
4848
|
const label = status === "pending" ? copy.awaitingConfirmation : statusLabel(status, copy);
|
|
4641
4849
|
const Icon = status === "executed" ? CheckCircle2 : status === "failed" ? XCircle : status === "executing" ? LoaderCircle : Clock;
|
|
4642
4850
|
return /* @__PURE__ */ jsxs("span", {
|
|
4643
|
-
className: joinClasses("ml-auto inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 font-medium", BADGE_TONE[status] ?? "border-
|
|
4851
|
+
className: joinClasses("ml-auto inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 font-medium", BADGE_TONE[status] ?? "border-border bg-surface-muted text-strong"),
|
|
4644
4852
|
"data-confirmation-status": status,
|
|
4645
4853
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
4646
4854
|
className: joinClasses("h-3 w-3", status === "executing" ? "animate-spin" : void 0),
|
|
@@ -4664,18 +4872,18 @@ function PendingConfirmationFooter({ pending, toolConfirmation, copy }) {
|
|
|
4664
4872
|
const [sending, setSending] = useState(null);
|
|
4665
4873
|
const [failed, setFailed] = useState(false);
|
|
4666
4874
|
if (!toolConfirmation) return /* @__PURE__ */ jsx("p", {
|
|
4667
|
-
className: "border-t border-
|
|
4875
|
+
className: "border-t border-border bg-warning-subtle/60 px-3 py-2 text-xs text-strong",
|
|
4668
4876
|
children: copy.confirmHint
|
|
4669
4877
|
});
|
|
4670
4878
|
if (!state) return /* @__PURE__ */ jsx("p", {
|
|
4671
|
-
className: "border-t border-
|
|
4879
|
+
className: "border-t border-divider bg-surface-muted px-3 py-2 text-xs text-muted",
|
|
4672
4880
|
"aria-live": "polite",
|
|
4673
4881
|
children: copy.verifying
|
|
4674
4882
|
});
|
|
4675
4883
|
if (state.status !== "pending") {
|
|
4676
4884
|
const label = statusLabel(state.status, copy);
|
|
4677
4885
|
return label ? /* @__PURE__ */ jsxs("p", {
|
|
4678
|
-
className: "border-t border-
|
|
4886
|
+
className: "border-t border-divider bg-surface-muted px-3 py-2 text-xs text-strong",
|
|
4679
4887
|
"aria-live": "polite",
|
|
4680
4888
|
children: [label, state.status === "failed" && state.error ? `: ${state.error}` : null]
|
|
4681
4889
|
}) : null;
|
|
@@ -4699,14 +4907,14 @@ function PendingConfirmationFooter({ pending, toolConfirmation, copy }) {
|
|
|
4699
4907
|
const expiry = expiryText(state, toolConfirmation.states.serverOffsetMs, now, copy);
|
|
4700
4908
|
const unavailable = state.error === "tool_unavailable";
|
|
4701
4909
|
return /* @__PURE__ */ jsxs("div", {
|
|
4702
|
-
className: "flex flex-wrap items-center gap-2 border-t border-
|
|
4910
|
+
className: "flex flex-wrap items-center gap-2 border-t border-border bg-warning-subtle/60 px-3 py-2",
|
|
4703
4911
|
"data-confirmation-actions": pending.action_id,
|
|
4704
4912
|
children: [
|
|
4705
4913
|
state.canConfirm ? /* @__PURE__ */ jsxs("button", {
|
|
4706
4914
|
type: "button",
|
|
4707
4915
|
disabled,
|
|
4708
4916
|
onClick: () => void decide("confirm"),
|
|
4709
|
-
className: joinClasses("inline-flex items-center rounded-md px-3 py-1.5 text-xs font-medium text-
|
|
4917
|
+
className: joinClasses("inline-flex items-center rounded-md px-3 py-1.5 text-xs font-medium text-inverse-foreground disabled:opacity-50", destructive ? "bg-danger hover:bg-danger-strong" : "bg-inverse hover:bg-inverse-hover"),
|
|
4710
4918
|
children: [sending === "confirm" ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
4711
4919
|
className: "mr-2 size-3 animate-spin",
|
|
4712
4920
|
"aria-hidden": "true"
|
|
@@ -4716,14 +4924,14 @@ function PendingConfirmationFooter({ pending, toolConfirmation, copy }) {
|
|
|
4716
4924
|
type: "button",
|
|
4717
4925
|
disabled,
|
|
4718
4926
|
onClick: () => void decide("reject"),
|
|
4719
|
-
className: "inline-flex items-center rounded-md border border-
|
|
4927
|
+
className: "inline-flex items-center rounded-md border border-border-strong bg-surface px-3 py-1.5 text-xs font-medium text-strong hover:bg-surface-muted disabled:opacity-50",
|
|
4720
4928
|
children: [sending === "reject" ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
4721
4929
|
className: "mr-2 size-3 animate-spin",
|
|
4722
4930
|
"aria-hidden": "true"
|
|
4723
4931
|
}) : null, sending === "reject" ? copy.cancelling : copy.cancel]
|
|
4724
4932
|
}) : null,
|
|
4725
4933
|
/* @__PURE__ */ jsx("span", {
|
|
4726
|
-
className: "ml-auto text-xs text-
|
|
4934
|
+
className: "ml-auto text-xs text-secondary",
|
|
4727
4935
|
"aria-live": "polite",
|
|
4728
4936
|
children: failed ? copy.decisionError : unavailable ? copy.toolUnavailable : expiry
|
|
4729
4937
|
})
|
|
@@ -4858,7 +5066,7 @@ function ExternalAnchor({ href, className, children, label }) {
|
|
|
4858
5066
|
target: "_blank",
|
|
4859
5067
|
rel: "noreferrer noopener",
|
|
4860
5068
|
"aria-label": label,
|
|
4861
|
-
className: joinClasses("inline-flex items-center gap-1 text-xs font-medium text-
|
|
5069
|
+
className: joinClasses("inline-flex items-center gap-1 text-xs font-medium text-strong hover:text-muted", className),
|
|
4862
5070
|
children
|
|
4863
5071
|
});
|
|
4864
5072
|
}
|
|
@@ -4867,7 +5075,7 @@ function ShowAllToggle({ total, expanded, onToggle, copy }) {
|
|
|
4867
5075
|
return /* @__PURE__ */ jsx("button", {
|
|
4868
5076
|
type: "button",
|
|
4869
5077
|
onClick: onToggle,
|
|
4870
|
-
className: "w-full border-t border-
|
|
5078
|
+
className: "w-full border-t border-border px-3 py-2 text-left text-xs font-medium text-secondary hover:bg-surface-muted hover:text-foreground",
|
|
4871
5079
|
children: expanded ? copy.showLess : fillCopy(copy.showAll, { count: total })
|
|
4872
5080
|
});
|
|
4873
5081
|
}
|
|
@@ -4878,24 +5086,24 @@ function MailRow({ message, locale, copy }) {
|
|
|
4878
5086
|
children: [
|
|
4879
5087
|
/* @__PURE__ */ jsx("span", {
|
|
4880
5088
|
"aria-label": message.unread ? copy.unread : void 0,
|
|
4881
|
-
className: joinClasses("h-2 w-2 shrink-0 self-center rounded-full", message.unread ? "bg-
|
|
5089
|
+
className: joinClasses("h-2 w-2 shrink-0 self-center rounded-full", message.unread ? "bg-info" : "bg-transparent")
|
|
4882
5090
|
}),
|
|
4883
5091
|
/* @__PURE__ */ jsx("span", {
|
|
4884
|
-
className: joinClasses("min-w-0 flex-1 truncate text-sm", message.unread ? "font-semibold text-
|
|
5092
|
+
className: joinClasses("min-w-0 flex-1 truncate text-sm", message.unread ? "font-semibold text-foreground" : "text-strong"),
|
|
4885
5093
|
children: displayName(message.from) ?? "—"
|
|
4886
5094
|
}),
|
|
4887
5095
|
/* @__PURE__ */ jsx("span", {
|
|
4888
|
-
className: "shrink-0 text-xs text-
|
|
5096
|
+
className: "shrink-0 text-xs text-muted",
|
|
4889
5097
|
children: formatMailDate(message.date, locale)
|
|
4890
5098
|
})
|
|
4891
5099
|
]
|
|
4892
5100
|
}),
|
|
4893
5101
|
/* @__PURE__ */ jsx("p", {
|
|
4894
|
-
className: joinClasses("truncate pl-4 text-sm", message.unread ? "font-medium text-
|
|
5102
|
+
className: joinClasses("truncate pl-4 text-sm", message.unread ? "font-medium text-foreground" : "text-strong"),
|
|
4895
5103
|
children: text(message.subject) ?? copy.noSubject
|
|
4896
5104
|
}),
|
|
4897
5105
|
text(message.snippet) ? /* @__PURE__ */ jsx("p", {
|
|
4898
|
-
className: "line-clamp-1 pl-4 text-xs text-
|
|
5106
|
+
className: "line-clamp-1 pl-4 text-xs text-muted",
|
|
4899
5107
|
children: message.snippet
|
|
4900
5108
|
}) : null
|
|
4901
5109
|
] });
|
|
@@ -4904,7 +5112,7 @@ function MailRow({ message, locale, copy }) {
|
|
|
4904
5112
|
href: message.link,
|
|
4905
5113
|
target: "_blank",
|
|
4906
5114
|
rel: "noreferrer noopener",
|
|
4907
|
-
className: joinClasses(className, "hover:bg-
|
|
5115
|
+
className: joinClasses(className, "hover:bg-surface-muted"),
|
|
4908
5116
|
children: content
|
|
4909
5117
|
}) : /* @__PURE__ */ jsx("div", {
|
|
4910
5118
|
className,
|
|
@@ -4914,11 +5122,11 @@ function MailRow({ message, locale, copy }) {
|
|
|
4914
5122
|
function MailList({ messages, locale, copy }) {
|
|
4915
5123
|
const [expanded, setExpanded] = useState(false);
|
|
4916
5124
|
if (messages.length === 0) return /* @__PURE__ */ jsx("p", {
|
|
4917
|
-
className: "px-3 py-3 text-sm text-
|
|
5125
|
+
className: "px-3 py-3 text-sm text-secondary",
|
|
4918
5126
|
children: copy.noEmails
|
|
4919
5127
|
});
|
|
4920
5128
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("ul", {
|
|
4921
|
-
className: "divide-y divide-
|
|
5129
|
+
className: "divide-y divide-divider",
|
|
4922
5130
|
children: (expanded ? messages : messages.slice(0, COLLAPSED_ITEMS)).map((message) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(MailRow, {
|
|
4923
5131
|
message,
|
|
4924
5132
|
locale,
|
|
@@ -4943,13 +5151,13 @@ function MailMessageView({ message, connector, locale, copy }) {
|
|
|
4943
5151
|
className: "space-y-1",
|
|
4944
5152
|
children: [
|
|
4945
5153
|
/* @__PURE__ */ jsx("h4", {
|
|
4946
|
-
className: "text-sm font-semibold text-
|
|
5154
|
+
className: "text-sm font-semibold text-foreground",
|
|
4947
5155
|
children: text(message.subject) ?? copy.noSubject
|
|
4948
5156
|
}),
|
|
4949
5157
|
/* @__PURE__ */ jsxs("div", {
|
|
4950
|
-
className: "flex items-baseline gap-2 text-xs text-
|
|
5158
|
+
className: "flex items-baseline gap-2 text-xs text-secondary",
|
|
4951
5159
|
children: [/* @__PURE__ */ jsx("span", {
|
|
4952
|
-
className: "min-w-0 flex-1 truncate font-medium text-
|
|
5160
|
+
className: "min-w-0 flex-1 truncate font-medium text-strong",
|
|
4953
5161
|
children: message.from ?? "—"
|
|
4954
5162
|
}), /* @__PURE__ */ jsx("span", {
|
|
4955
5163
|
className: "shrink-0",
|
|
@@ -4957,7 +5165,7 @@ function MailMessageView({ message, connector, locale, copy }) {
|
|
|
4957
5165
|
})]
|
|
4958
5166
|
}),
|
|
4959
5167
|
text(message.to) ? /* @__PURE__ */ jsxs("p", {
|
|
4960
|
-
className: "truncate text-xs text-
|
|
5168
|
+
className: "truncate text-xs text-muted",
|
|
4961
5169
|
children: [
|
|
4962
5170
|
copy.to,
|
|
4963
5171
|
": ",
|
|
@@ -4965,7 +5173,7 @@ function MailMessageView({ message, connector, locale, copy }) {
|
|
|
4965
5173
|
]
|
|
4966
5174
|
}) : null,
|
|
4967
5175
|
text(message.cc) ? /* @__PURE__ */ jsxs("p", {
|
|
4968
|
-
className: "truncate text-xs text-
|
|
5176
|
+
className: "truncate text-xs text-muted",
|
|
4969
5177
|
children: [
|
|
4970
5178
|
copy.cc,
|
|
4971
5179
|
": ",
|
|
@@ -4975,7 +5183,7 @@ function MailMessageView({ message, connector, locale, copy }) {
|
|
|
4975
5183
|
]
|
|
4976
5184
|
}),
|
|
4977
5185
|
shownBody ? /* @__PURE__ */ jsx("p", {
|
|
4978
|
-
className: "whitespace-pre-wrap break-words text-sm leading-6 text-
|
|
5186
|
+
className: "whitespace-pre-wrap break-words text-sm leading-6 text-strong",
|
|
4979
5187
|
children: shownBody
|
|
4980
5188
|
}) : null,
|
|
4981
5189
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -4983,11 +5191,11 @@ function MailMessageView({ message, connector, locale, copy }) {
|
|
|
4983
5191
|
children: [long ? /* @__PURE__ */ jsx("button", {
|
|
4984
5192
|
type: "button",
|
|
4985
5193
|
onClick: () => setExpanded((value) => !value),
|
|
4986
|
-
className: "text-xs font-medium text-
|
|
5194
|
+
className: "text-xs font-medium text-secondary hover:text-foreground",
|
|
4987
5195
|
children: expanded ? copy.showLess : copy.showMore
|
|
4988
5196
|
}) : null, message.link ? /* @__PURE__ */ jsxs(ExternalAnchor, {
|
|
4989
5197
|
href: message.link,
|
|
4990
|
-
children: [fillCopy(copy.openIn, { service: connector?.label ?? "" }), /* @__PURE__ */ jsx(
|
|
5198
|
+
children: [fillCopy(copy.openIn, { service: connector?.label ?? "" }), /* @__PURE__ */ jsx(ArrowUpRight, {
|
|
4991
5199
|
className: "h-3 w-3",
|
|
4992
5200
|
"aria-hidden": "true"
|
|
4993
5201
|
})]
|
|
@@ -5027,7 +5235,7 @@ function EventRow({ event, locale, copy }) {
|
|
|
5027
5235
|
className: "flex gap-3 px-3 py-2",
|
|
5028
5236
|
children: [
|
|
5029
5237
|
/* @__PURE__ */ jsx("span", {
|
|
5030
|
-
className: "w-24 shrink-0 pt-0.5 text-xs tabular-nums text-
|
|
5238
|
+
className: "w-24 shrink-0 pt-0.5 text-xs tabular-nums text-secondary",
|
|
5031
5239
|
children: eventTime(event, locale, copy)
|
|
5032
5240
|
}),
|
|
5033
5241
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -5036,13 +5244,13 @@ function EventRow({ event, locale, copy }) {
|
|
|
5036
5244
|
href: event.link,
|
|
5037
5245
|
target: "_blank",
|
|
5038
5246
|
rel: "noreferrer noopener",
|
|
5039
|
-
className: "block truncate text-sm font-medium text-
|
|
5247
|
+
className: "block truncate text-sm font-medium text-foreground hover:underline",
|
|
5040
5248
|
children: text(event.title) ?? copy.noSubject
|
|
5041
5249
|
}) : /* @__PURE__ */ jsx("p", {
|
|
5042
|
-
className: "truncate text-sm font-medium text-
|
|
5250
|
+
className: "truncate text-sm font-medium text-foreground",
|
|
5043
5251
|
children: text(event.title) ?? copy.noSubject
|
|
5044
5252
|
}), details.length > 0 ? /* @__PURE__ */ jsx("p", {
|
|
5045
|
-
className: "truncate text-xs text-
|
|
5253
|
+
className: "truncate text-xs text-muted",
|
|
5046
5254
|
children: details.join(" · ")
|
|
5047
5255
|
}) : null]
|
|
5048
5256
|
}),
|
|
@@ -5060,7 +5268,7 @@ function EventRow({ event, locale, copy }) {
|
|
|
5060
5268
|
function Agenda({ events, locale, copy }) {
|
|
5061
5269
|
const [expanded, setExpanded] = useState(false);
|
|
5062
5270
|
if (events.length === 0) return /* @__PURE__ */ jsx("p", {
|
|
5063
|
-
className: "px-3 py-3 text-sm text-
|
|
5271
|
+
className: "px-3 py-3 text-sm text-secondary",
|
|
5064
5272
|
children: copy.noEvents
|
|
5065
5273
|
});
|
|
5066
5274
|
const visible = expanded ? events : events.slice(0, COLLAPSED_ITEMS);
|
|
@@ -5070,12 +5278,12 @@ function Agenda({ events, locale, copy }) {
|
|
|
5070
5278
|
month: "long"
|
|
5071
5279
|
});
|
|
5072
5280
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
5073
|
-
className: "divide-y divide-
|
|
5281
|
+
className: "divide-y divide-divider",
|
|
5074
5282
|
children: groupByDay(visible).map((group, index) => /* @__PURE__ */ jsxs("section", { children: [group.day ? /* @__PURE__ */ jsx("h4", {
|
|
5075
|
-
className: "bg-
|
|
5283
|
+
className: "bg-surface-muted px-3 py-1 text-xs font-medium capitalize text-secondary",
|
|
5076
5284
|
children: dayFormat.format(group.day)
|
|
5077
5285
|
}) : null, /* @__PURE__ */ jsx("ul", {
|
|
5078
|
-
className: "divide-y divide-
|
|
5286
|
+
className: "divide-y divide-divider",
|
|
5079
5287
|
children: group.events.map((event) => /* @__PURE__ */ jsx(EventRow, {
|
|
5080
5288
|
event,
|
|
5081
5289
|
locale,
|
|
@@ -5096,12 +5304,12 @@ function CollapsibleBody({ body, copy }) {
|
|
|
5096
5304
|
return /* @__PURE__ */ jsxs("div", {
|
|
5097
5305
|
className: "space-y-1",
|
|
5098
5306
|
children: [/* @__PURE__ */ jsx("p", {
|
|
5099
|
-
className: "whitespace-pre-wrap break-words text-sm leading-6 text-
|
|
5307
|
+
className: "whitespace-pre-wrap break-words text-sm leading-6 text-strong",
|
|
5100
5308
|
children: long && !expanded ? `${body.slice(0, COLLAPSED_BODY_CHARS).trimEnd()}…` : body
|
|
5101
5309
|
}), long ? /* @__PURE__ */ jsx("button", {
|
|
5102
5310
|
type: "button",
|
|
5103
5311
|
onClick: () => setExpanded((value) => !value),
|
|
5104
|
-
className: "text-xs font-medium text-
|
|
5312
|
+
className: "text-xs font-medium text-secondary hover:text-foreground",
|
|
5105
5313
|
children: expanded ? copy.showLess : copy.showMore
|
|
5106
5314
|
}) : null]
|
|
5107
5315
|
});
|
|
@@ -5114,15 +5322,15 @@ function DraftView({ view, copy }) {
|
|
|
5114
5322
|
className: "space-y-1",
|
|
5115
5323
|
children: [
|
|
5116
5324
|
/* @__PURE__ */ jsx("p", {
|
|
5117
|
-
className: "text-sm font-medium text-
|
|
5325
|
+
className: "text-sm font-medium text-foreground",
|
|
5118
5326
|
children: copy.draftSaved
|
|
5119
5327
|
}),
|
|
5120
5328
|
view.subject ? /* @__PURE__ */ jsx("p", {
|
|
5121
|
-
className: "truncate text-sm text-
|
|
5329
|
+
className: "truncate text-sm text-strong",
|
|
5122
5330
|
children: view.subject
|
|
5123
5331
|
}) : null,
|
|
5124
5332
|
view.to.length > 0 ? /* @__PURE__ */ jsxs("p", {
|
|
5125
|
-
className: "truncate text-xs text-
|
|
5333
|
+
className: "truncate text-xs text-muted",
|
|
5126
5334
|
children: [
|
|
5127
5335
|
copy.to,
|
|
5128
5336
|
": ",
|
|
@@ -5137,7 +5345,7 @@ function DraftView({ view, copy }) {
|
|
|
5137
5345
|
}),
|
|
5138
5346
|
view.link ? /* @__PURE__ */ jsxs(ExternalAnchor, {
|
|
5139
5347
|
href: view.link,
|
|
5140
|
-
children: [copy.openDraft, /* @__PURE__ */ jsx(
|
|
5348
|
+
children: [copy.openDraft, /* @__PURE__ */ jsx(ArrowUpRight, {
|
|
5141
5349
|
className: "h-3 w-3",
|
|
5142
5350
|
"aria-hidden": "true"
|
|
5143
5351
|
})]
|
|
@@ -5152,10 +5360,10 @@ function Field({ label, children }) {
|
|
|
5152
5360
|
return /* @__PURE__ */ jsxs("div", {
|
|
5153
5361
|
className: "flex gap-3 text-sm",
|
|
5154
5362
|
children: [/* @__PURE__ */ jsx("dt", {
|
|
5155
|
-
className: "w-24 shrink-0 text-xs leading-5 text-
|
|
5363
|
+
className: "w-24 shrink-0 text-xs leading-5 text-muted",
|
|
5156
5364
|
children: label
|
|
5157
5365
|
}), /* @__PURE__ */ jsx("dd", {
|
|
5158
|
-
className: "min-w-0 flex-1 break-words text-
|
|
5366
|
+
className: "min-w-0 flex-1 break-words text-foreground",
|
|
5159
5367
|
children
|
|
5160
5368
|
})]
|
|
5161
5369
|
});
|
|
@@ -5188,11 +5396,11 @@ function PendingMailView({ pending, copy }) {
|
|
|
5188
5396
|
]
|
|
5189
5397
|
}),
|
|
5190
5398
|
text(mail.reply_to_message_id) ? /* @__PURE__ */ jsx("p", {
|
|
5191
|
-
className: "text-xs text-
|
|
5399
|
+
className: "text-xs text-muted",
|
|
5192
5400
|
children: copy.replyInThread
|
|
5193
5401
|
}) : null,
|
|
5194
5402
|
/* @__PURE__ */ jsx("div", {
|
|
5195
|
-
className: "rounded-md border border-
|
|
5403
|
+
className: "rounded-md border border-border bg-surface-muted px-3 py-2",
|
|
5196
5404
|
children: /* @__PURE__ */ jsx(CollapsibleBody, {
|
|
5197
5405
|
body: text(mail.body),
|
|
5198
5406
|
copy
|
|
@@ -5224,7 +5432,7 @@ function Change({ before, after }) {
|
|
|
5224
5432
|
className: "flex flex-wrap items-baseline gap-x-2",
|
|
5225
5433
|
children: [
|
|
5226
5434
|
/* @__PURE__ */ jsx("span", {
|
|
5227
|
-
className: "text-
|
|
5435
|
+
className: "text-muted line-through",
|
|
5228
5436
|
children: before
|
|
5229
5437
|
}),
|
|
5230
5438
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -5243,19 +5451,19 @@ function PendingEventView({ operation, pending, locale, copy }) {
|
|
|
5243
5451
|
className: "space-y-1 px-3 py-3",
|
|
5244
5452
|
children: [
|
|
5245
5453
|
/* @__PURE__ */ jsx("p", {
|
|
5246
|
-
className: "text-xs font-medium
|
|
5454
|
+
className: "text-xs font-medium capitalize tracking-wide text-danger-strong",
|
|
5247
5455
|
children: copy.deleteEvent
|
|
5248
5456
|
}),
|
|
5249
5457
|
/* @__PURE__ */ jsx("p", {
|
|
5250
|
-
className: "text-sm font-medium text-
|
|
5458
|
+
className: "text-sm font-medium text-foreground line-through",
|
|
5251
5459
|
children: text(current?.title) ?? text(action.event_id) ?? copy.noSubject
|
|
5252
5460
|
}),
|
|
5253
5461
|
current ? /* @__PURE__ */ jsx("p", {
|
|
5254
|
-
className: "text-xs text-
|
|
5462
|
+
className: "text-xs text-muted",
|
|
5255
5463
|
children: formatRange(current.start, current.end, Boolean(current.all_day), locale, copy)
|
|
5256
5464
|
}) : null,
|
|
5257
5465
|
(current?.attendees?.length ?? 0) > 0 ? /* @__PURE__ */ jsx("p", {
|
|
5258
|
-
className: "pt-1 text-xs text-
|
|
5466
|
+
className: "pt-1 text-xs text-secondary",
|
|
5259
5467
|
children: copy.attendeesNotified
|
|
5260
5468
|
}) : null
|
|
5261
5469
|
]
|
|
@@ -5270,7 +5478,7 @@ function PendingEventView({ operation, pending, locale, copy }) {
|
|
|
5270
5478
|
className: "space-y-2 px-3 py-3",
|
|
5271
5479
|
children: [
|
|
5272
5480
|
/* @__PURE__ */ jsx("p", {
|
|
5273
|
-
className: "text-xs font-medium
|
|
5481
|
+
className: "text-xs font-medium capitalize tracking-wide text-muted",
|
|
5274
5482
|
children: isUpdate ? copy.eventChange : copy.newEvent
|
|
5275
5483
|
}),
|
|
5276
5484
|
/* @__PURE__ */ jsxs("dl", {
|
|
@@ -5323,7 +5531,7 @@ function PendingEventView({ operation, pending, locale, copy }) {
|
|
|
5323
5531
|
]
|
|
5324
5532
|
}),
|
|
5325
5533
|
attendees.length > 0 ? /* @__PURE__ */ jsx("p", {
|
|
5326
|
-
className: "text-xs text-
|
|
5534
|
+
className: "text-xs text-secondary",
|
|
5327
5535
|
children: copy.attendeesNotified
|
|
5328
5536
|
}) : null
|
|
5329
5537
|
]
|
|
@@ -5345,24 +5553,24 @@ function ToolResultPersonalConnectorCard({ part, locale, className, toolConfirma
|
|
|
5345
5553
|
const total = headerCount(view, copy);
|
|
5346
5554
|
const isPending = view.kind === "pending-mail" || view.kind === "pending-event";
|
|
5347
5555
|
return /* @__PURE__ */ jsxs("section", {
|
|
5348
|
-
className: joinClasses("plai-tool-result-personal-connector-card overflow-hidden rounded-lg border border-
|
|
5556
|
+
className: joinClasses("plai-tool-result-personal-connector-card overflow-hidden rounded-lg border border-border bg-surface text-foreground", className),
|
|
5349
5557
|
"data-tool-call-id": part.id,
|
|
5350
5558
|
"data-tool-call-state": part.state,
|
|
5351
5559
|
"data-connector-action": view.kind,
|
|
5352
5560
|
children: [
|
|
5353
5561
|
/* @__PURE__ */ jsxs("header", {
|
|
5354
|
-
className: "flex items-center gap-2 border-b border-
|
|
5562
|
+
className: "flex items-center gap-2 border-b border-border px-3 py-2 text-xs text-secondary",
|
|
5355
5563
|
children: [
|
|
5356
5564
|
/* @__PURE__ */ jsx(Icon, {
|
|
5357
|
-
className: "h-4 w-4 shrink-0 text-
|
|
5565
|
+
className: "h-4 w-4 shrink-0 text-strong",
|
|
5358
5566
|
"aria-hidden": "true"
|
|
5359
5567
|
}),
|
|
5360
5568
|
/* @__PURE__ */ jsx("span", {
|
|
5361
|
-
className: "shrink-0 font-medium text-
|
|
5569
|
+
className: "shrink-0 font-medium text-foreground",
|
|
5362
5570
|
children: connector?.label
|
|
5363
5571
|
}),
|
|
5364
5572
|
connector?.account_email ? /* @__PURE__ */ jsx("span", {
|
|
5365
|
-
className: "min-w-0 truncate border-
|
|
5573
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
5366
5574
|
children: connector.account_email
|
|
5367
5575
|
}) : null,
|
|
5368
5576
|
isPending ? /* @__PURE__ */ jsx(ConfirmationBadge, {
|
|
@@ -5437,39 +5645,42 @@ function ConfirmedActionRow({ action, copy }) {
|
|
|
5437
5645
|
"data-confirmation-status": action.status,
|
|
5438
5646
|
children: [
|
|
5439
5647
|
failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
5440
|
-
className: "mt-0.5 h-4 w-4 shrink-0 text-
|
|
5648
|
+
className: "mt-0.5 h-4 w-4 shrink-0 text-danger",
|
|
5441
5649
|
"aria-hidden": "true"
|
|
5442
5650
|
}) : executed ? /* @__PURE__ */ jsx(CheckCircle2, {
|
|
5443
|
-
className: "mt-0.5 h-4 w-4 shrink-0 text-
|
|
5651
|
+
className: "mt-0.5 h-4 w-4 shrink-0 text-success",
|
|
5444
5652
|
"aria-hidden": "true"
|
|
5445
5653
|
}) : /* @__PURE__ */ jsx(Clock, {
|
|
5446
|
-
className: "mt-0.5 h-4 w-4 shrink-0 text-
|
|
5654
|
+
className: "mt-0.5 h-4 w-4 shrink-0 text-muted",
|
|
5447
5655
|
"aria-hidden": "true"
|
|
5448
5656
|
}),
|
|
5449
5657
|
/* @__PURE__ */ jsxs("div", {
|
|
5450
5658
|
className: "min-w-0 flex-1 space-y-0.5",
|
|
5451
5659
|
children: [
|
|
5452
5660
|
/* @__PURE__ */ jsx("p", {
|
|
5453
|
-
className: "text-sm font-medium text-
|
|
5661
|
+
className: "text-sm font-medium text-foreground",
|
|
5454
5662
|
children: title
|
|
5455
5663
|
}),
|
|
5456
5664
|
connector ? /* @__PURE__ */ jsxs("div", {
|
|
5457
|
-
className: "flex items-center gap-2 truncate text-xs text-
|
|
5665
|
+
className: "flex items-center gap-2 truncate text-xs text-muted",
|
|
5458
5666
|
children: [connector.label, connector.account_email ? /* @__PURE__ */ jsx("span", {
|
|
5459
|
-
className: "min-w-0 truncate border-
|
|
5667
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
5460
5668
|
children: connector.account_email
|
|
5461
5669
|
}) : null]
|
|
5462
5670
|
}) : null,
|
|
5463
5671
|
failed && text(action.error) ? /* @__PURE__ */ jsx("p", {
|
|
5464
|
-
className: "line-clamp-2 text-xs text-
|
|
5672
|
+
className: "line-clamp-2 text-xs text-danger-strong",
|
|
5465
5673
|
children: action.error
|
|
5466
5674
|
}) : null
|
|
5467
5675
|
]
|
|
5468
5676
|
}),
|
|
5469
|
-
executed && link ? /* @__PURE__ */
|
|
5677
|
+
executed && link ? /* @__PURE__ */ jsxs(ExternalAnchor, {
|
|
5470
5678
|
href: link,
|
|
5471
5679
|
className: "shrink-0",
|
|
5472
|
-
children: operation === "send" ? copy.openEmail : copy.openEvent
|
|
5680
|
+
children: [operation === "send" ? copy.openEmail : copy.openEvent, /* @__PURE__ */ jsx(ArrowUpRight, {
|
|
5681
|
+
className: "h-3 w-3",
|
|
5682
|
+
"aria-hidden": "true"
|
|
5683
|
+
})]
|
|
5473
5684
|
}) : null
|
|
5474
5685
|
]
|
|
5475
5686
|
});
|
|
@@ -5479,7 +5690,7 @@ function ToolResultToolConfirmationCard({ part, locale, className }) {
|
|
|
5479
5690
|
if (actions.length === 0) return null;
|
|
5480
5691
|
const copy = getPersonalConnectorCopy(locale);
|
|
5481
5692
|
return /* @__PURE__ */ jsx("ul", {
|
|
5482
|
-
className: joinClasses("plai-tool-result-tool-confirmation-card divide-y divide-
|
|
5693
|
+
className: joinClasses("plai-tool-result-tool-confirmation-card divide-y divide-divider overflow-hidden rounded-lg border border-border bg-surface text-foreground", className),
|
|
5483
5694
|
"data-tool-call-id": part.id,
|
|
5484
5695
|
"data-tool-call-state": part.state,
|
|
5485
5696
|
children: actions.map((action) => /* @__PURE__ */ jsx(ConfirmedActionRow, {
|
|
@@ -5504,14 +5715,14 @@ function ToolResultPendingConfirmationCard({ part, locale, className, toolConfir
|
|
|
5504
5715
|
const copy = getPersonalConnectorCopy(locale);
|
|
5505
5716
|
const entries = Object.entries(pending.action).filter(([key, value]) => key !== "operation" && value !== null && value !== void 0);
|
|
5506
5717
|
return /* @__PURE__ */ jsxs("section", {
|
|
5507
|
-
className: joinClasses("plai-tool-result-pending-confirmation-card overflow-hidden rounded-lg border border-
|
|
5718
|
+
className: joinClasses("plai-tool-result-pending-confirmation-card overflow-hidden rounded-lg border border-border bg-surface text-foreground", className),
|
|
5508
5719
|
"data-tool-call-id": part.id,
|
|
5509
5720
|
"data-tool-call-state": part.state,
|
|
5510
5721
|
children: [
|
|
5511
5722
|
/* @__PURE__ */ jsxs("header", {
|
|
5512
|
-
className: "flex items-center gap-2 border-b border-
|
|
5723
|
+
className: "flex items-center gap-2 border-b border-border px-3 py-2 text-xs text-secondary",
|
|
5513
5724
|
children: [/* @__PURE__ */ jsx("span", {
|
|
5514
|
-
className: "truncate font-mono font-medium text-
|
|
5725
|
+
className: "truncate font-mono font-medium text-foreground",
|
|
5515
5726
|
children: part.name
|
|
5516
5727
|
}), /* @__PURE__ */ jsx(ConfirmationBadge, {
|
|
5517
5728
|
state: confirmationState,
|
|
@@ -5574,12 +5785,12 @@ function ToolResultWorkflowDispatchCard({ part, className, locale }) {
|
|
|
5574
5785
|
const error = formatToolErrorDetails(part.errorDetails);
|
|
5575
5786
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
5576
5787
|
"aria-label": `${copy.workflow}: ${workflowName}`,
|
|
5577
|
-
className: joinClasses("w-full rounded-lg border border-
|
|
5788
|
+
className: joinClasses("plai-tool-result-workflow-dispatch-card w-full rounded-lg border border-border bg-surface text-left font-normal text-foreground transition-colors hover:bg-surface-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", className),
|
|
5578
5789
|
children: /* @__PURE__ */ jsxs("span", {
|
|
5579
5790
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
5580
5791
|
children: [
|
|
5581
5792
|
/* @__PURE__ */ jsx(Workflow, {
|
|
5582
|
-
className: "h-4 w-4 shrink-0 text-
|
|
5793
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
5583
5794
|
"aria-hidden": "true"
|
|
5584
5795
|
}),
|
|
5585
5796
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -5587,19 +5798,19 @@ function ToolResultWorkflowDispatchCard({ part, className, locale }) {
|
|
|
5587
5798
|
children: copy.workflow
|
|
5588
5799
|
}),
|
|
5589
5800
|
/* @__PURE__ */ jsx("span", {
|
|
5590
|
-
className: "min-w-0 truncate border-
|
|
5801
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
5591
5802
|
children: workflowName
|
|
5592
5803
|
}),
|
|
5593
5804
|
/* @__PURE__ */ jsxs("span", {
|
|
5594
5805
|
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
5595
5806
|
children: [/* @__PURE__ */ jsx("span", {
|
|
5596
|
-
className: "text-xs text-
|
|
5807
|
+
className: "text-xs text-muted",
|
|
5597
5808
|
children: status
|
|
5598
5809
|
}), failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
5599
|
-
className: "h-4 w-4 text-
|
|
5810
|
+
className: "h-4 w-4 text-danger",
|
|
5600
5811
|
"aria-hidden": "true"
|
|
5601
5812
|
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
5602
|
-
className: "h-4 w-4 text-
|
|
5813
|
+
className: "h-4 w-4 text-success",
|
|
5603
5814
|
"aria-hidden": "true"
|
|
5604
5815
|
})]
|
|
5605
5816
|
})
|
|
@@ -5618,22 +5829,22 @@ function ToolResultWorkflowDispatchCard({ part, className, locale }) {
|
|
|
5618
5829
|
className: "grid gap-2 text-sm",
|
|
5619
5830
|
children: [
|
|
5620
5831
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
5621
|
-
className: "text-xs text-
|
|
5832
|
+
className: "text-xs text-muted",
|
|
5622
5833
|
children: copy.workflow
|
|
5623
5834
|
}), /* @__PURE__ */ jsx("dd", { children: workflowName })] }),
|
|
5624
5835
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
5625
|
-
className: "text-xs text-
|
|
5836
|
+
className: "text-xs text-muted",
|
|
5626
5837
|
children: copy.status
|
|
5627
5838
|
}), /* @__PURE__ */ jsx("dd", { children: status })] }),
|
|
5628
5839
|
result.executionId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
5629
|
-
className: "text-xs text-
|
|
5840
|
+
className: "text-xs text-muted",
|
|
5630
5841
|
children: copy.executionId
|
|
5631
5842
|
}), /* @__PURE__ */ jsx("dd", {
|
|
5632
5843
|
className: "break-all",
|
|
5633
5844
|
children: result.executionId
|
|
5634
5845
|
})] }) : null,
|
|
5635
5846
|
result.workflowId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
5636
|
-
className: "text-xs text-
|
|
5847
|
+
className: "text-xs text-muted",
|
|
5637
5848
|
children: copy.workflowId
|
|
5638
5849
|
}), /* @__PURE__ */ jsx("dd", {
|
|
5639
5850
|
className: "break-all",
|
|
@@ -5645,11 +5856,11 @@ function ToolResultWorkflowDispatchCard({ part, className, locale }) {
|
|
|
5645
5856
|
className: "mb-2 text-sm font-medium",
|
|
5646
5857
|
children: copy.result
|
|
5647
5858
|
}), /* @__PURE__ */ jsx("pre", {
|
|
5648
|
-
className: "overflow-x-auto rounded-md border border-
|
|
5859
|
+
className: "overflow-x-auto rounded-md border border-border bg-surface-muted p-3 text-xs leading-5",
|
|
5649
5860
|
children: output$1
|
|
5650
5861
|
})] }) : null,
|
|
5651
5862
|
error ? /* @__PURE__ */ jsxs("p", {
|
|
5652
|
-
className: "rounded border border-
|
|
5863
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
5653
5864
|
children: [
|
|
5654
5865
|
/* @__PURE__ */ jsxs("span", {
|
|
5655
5866
|
className: "font-semibold",
|
|
@@ -5956,79 +6167,81 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
|
|
|
5956
6167
|
});
|
|
5957
6168
|
if (part.toolType === "datasource") return null;
|
|
5958
6169
|
return /* @__PURE__ */ jsxs("section", {
|
|
5959
|
-
className: joinClasses("
|
|
6170
|
+
className: joinClasses("plai-tool-result-card overflow-hidden rounded-lg border border-border bg-surface-muted", className),
|
|
5960
6171
|
"data-tool-call-id": part.id,
|
|
5961
6172
|
"data-tool-call-state": part.state,
|
|
5962
|
-
children: [
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6173
|
+
children: [/* @__PURE__ */ jsxs("header", {
|
|
6174
|
+
className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2",
|
|
6175
|
+
children: [/* @__PURE__ */ jsx("h4", {
|
|
6176
|
+
className: "text-sm font-semibold text-foreground",
|
|
6177
|
+
children: part.name
|
|
6178
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6179
|
+
className: "rounded-full border capitalize border-success-border bg-success-subtle px-2 py-0.5 text-xs text-success-strong",
|
|
6180
|
+
children: copy.completed
|
|
6181
|
+
})]
|
|
6182
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
6183
|
+
className: "space-y-3 px-3 py-2",
|
|
6184
|
+
children: [
|
|
6185
|
+
part.toolType ? /* @__PURE__ */ jsxs("p", {
|
|
6186
|
+
className: "text-xs text-secondary",
|
|
6187
|
+
children: [
|
|
6188
|
+
/* @__PURE__ */ jsxs("span", {
|
|
6189
|
+
className: "font-semibold",
|
|
6190
|
+
children: [copy.type, ":"]
|
|
6191
|
+
}),
|
|
6192
|
+
" ",
|
|
6193
|
+
part.toolType
|
|
6194
|
+
]
|
|
6195
|
+
}) : null,
|
|
6196
|
+
/* @__PURE__ */ jsxs("details", {
|
|
6197
|
+
open: detailsOpen,
|
|
6198
|
+
className: "space-y-2",
|
|
6199
|
+
children: [/* @__PURE__ */ jsx("summary", {
|
|
6200
|
+
className: "cursor-pointer text-xs font-semibold text-secondary",
|
|
6201
|
+
children: copy.input
|
|
6202
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
6203
|
+
className: "overflow-x-auto rounded bg-inverse p-2 text-xs text-inverse-foreground",
|
|
6204
|
+
children: formatJson(part.input)
|
|
6205
|
+
})]
|
|
6206
|
+
}),
|
|
6207
|
+
part.result !== void 0 ? /* @__PURE__ */ jsxs("details", {
|
|
6208
|
+
open: detailsOpen,
|
|
6209
|
+
className: "space-y-2",
|
|
6210
|
+
children: [
|
|
6211
|
+
/* @__PURE__ */ jsx("summary", {
|
|
6212
|
+
className: "cursor-pointer text-xs font-semibold text-secondary",
|
|
6213
|
+
children: copy.output
|
|
6214
|
+
}),
|
|
6215
|
+
officeMediaFiles.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
6216
|
+
className: "space-y-2 rounded border border-border bg-surface p-3",
|
|
6217
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
6218
|
+
className: "text-xs font-semibold text-strong",
|
|
6219
|
+
children: copy.generatedFiles
|
|
6220
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
6221
|
+
className: "space-y-1",
|
|
6222
|
+
children: officeMediaFiles.map((file) => {
|
|
6223
|
+
const label = file.name || file.pathname || file.id;
|
|
6224
|
+
return /* @__PURE__ */ jsx("li", {
|
|
6225
|
+
className: "text-xs text-strong",
|
|
6226
|
+
children: file.url ? /* @__PURE__ */ jsx("a", {
|
|
6227
|
+
href: file.url,
|
|
6228
|
+
target: "_blank",
|
|
6229
|
+
rel: "noreferrer noopener",
|
|
6230
|
+
className: "hover:underline",
|
|
6231
|
+
children: label
|
|
6232
|
+
}) : /* @__PURE__ */ jsx("span", { children: label })
|
|
6233
|
+
}, file.id);
|
|
6234
|
+
})
|
|
6235
|
+
})]
|
|
6236
|
+
}) : null,
|
|
6237
|
+
/* @__PURE__ */ jsx("pre", {
|
|
6238
|
+
className: "overflow-x-auto rounded bg-inverse p-2 text-xs text-inverse-foreground",
|
|
6239
|
+
children: formatJson(part.result)
|
|
6240
|
+
})
|
|
6241
|
+
]
|
|
6242
|
+
}) : null
|
|
6243
|
+
]
|
|
6244
|
+
})]
|
|
6032
6245
|
});
|
|
6033
6246
|
}
|
|
6034
6247
|
|
|
@@ -6047,7 +6260,7 @@ function Thinking({ part, thinkingLabel, completedLabel, locale, defaultOpen, cl
|
|
|
6047
6260
|
previousState.current = part.state;
|
|
6048
6261
|
}, [isStreaming, part.state]);
|
|
6049
6262
|
return /* @__PURE__ */ jsxs("section", {
|
|
6050
|
-
className: joinClasses("text-sm text-
|
|
6263
|
+
className: joinClasses("text-sm text-secondary", className),
|
|
6051
6264
|
"data-thinking-state": part.state,
|
|
6052
6265
|
...props,
|
|
6053
6266
|
children: [
|
|
@@ -6057,7 +6270,7 @@ function Thinking({ part, thinkingLabel, completedLabel, locale, defaultOpen, cl
|
|
|
6057
6270
|
"aria-expanded": hasContent ? isOpen : void 0,
|
|
6058
6271
|
"aria-label": hasContent ? `${isOpen ? copy.collapse : copy.expand} ${label}` : label,
|
|
6059
6272
|
disabled: !hasContent,
|
|
6060
|
-
className: joinClasses("inline-flex items-center gap-2 rounded-md py-1 text-left font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-
|
|
6273
|
+
className: joinClasses("inline-flex items-center gap-2 rounded-md py-1 text-left font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", hasContent ? "cursor-pointer hover:text-foreground" : "cursor-default"),
|
|
6061
6274
|
onClick: () => setIsOpen((value) => !value),
|
|
6062
6275
|
children: [
|
|
6063
6276
|
isStreaming ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
@@ -6081,7 +6294,7 @@ function Thinking({ part, thinkingLabel, completedLabel, locale, defaultOpen, cl
|
|
|
6081
6294
|
}),
|
|
6082
6295
|
hasContent && isOpen ? /* @__PURE__ */ jsx("p", {
|
|
6083
6296
|
id: contentId,
|
|
6084
|
-
className: "mt-1 whitespace-pre-wrap border-l-2 border-
|
|
6297
|
+
className: "mt-1 whitespace-pre-wrap border-l-2 border-border pl-3 text-sm leading-6 text-secondary",
|
|
6085
6298
|
children: part.thinking
|
|
6086
6299
|
}) : null
|
|
6087
6300
|
]
|
|
@@ -6108,7 +6321,7 @@ function MessageAvatar({ src, fallback, alt = fallback, className, imageClassNam
|
|
|
6108
6321
|
const showImage = src.trim().length > 0 && failedSrc !== src;
|
|
6109
6322
|
const initials = getFallbackInitials(fallback);
|
|
6110
6323
|
return /* @__PURE__ */ jsx("div", {
|
|
6111
|
-
className: joinClasses("plai-message-avatar flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-full bg-
|
|
6324
|
+
className: joinClasses("plai-message-avatar flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-full bg-surface-hover text-xs font-semibold uppercase text-strong", className),
|
|
6112
6325
|
...props,
|
|
6113
6326
|
children: showImage ? /* @__PURE__ */ jsx("img", {
|
|
6114
6327
|
src,
|
|
@@ -6130,7 +6343,7 @@ function MessageContent({ className,...props }) {
|
|
|
6130
6343
|
}
|
|
6131
6344
|
function MessageHeader({ className,...props }) {
|
|
6132
6345
|
return /* @__PURE__ */ jsx("header", {
|
|
6133
|
-
className: joinClasses("text-xs font-semibold uppercase tracking-wide text-
|
|
6346
|
+
className: joinClasses("text-xs font-semibold uppercase tracking-wide text-muted", className),
|
|
6134
6347
|
...props
|
|
6135
6348
|
});
|
|
6136
6349
|
}
|
|
@@ -6141,14 +6354,6 @@ function MessageFooter({ className,...props }) {
|
|
|
6141
6354
|
});
|
|
6142
6355
|
}
|
|
6143
6356
|
const DEFAULT_COLLAPSE_THRESHOLD = 600;
|
|
6144
|
-
function getFilenameFromUrl(url) {
|
|
6145
|
-
try {
|
|
6146
|
-
const parsed = new URL(url);
|
|
6147
|
-
return decodeURIComponent(parsed.pathname).split("/").pop()?.trim() || void 0;
|
|
6148
|
-
} catch {
|
|
6149
|
-
return (url.split("?")[0]?.split("#")[0] ?? "").split("/").pop()?.trim() || void 0;
|
|
6150
|
-
}
|
|
6151
|
-
}
|
|
6152
6357
|
function getDisplayExtension(label) {
|
|
6153
6358
|
if (!label) return void 0;
|
|
6154
6359
|
const ext = label.split(".").pop()?.trim().toUpperCase();
|
|
@@ -6179,13 +6384,13 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
|
|
|
6179
6384
|
href: part.url,
|
|
6180
6385
|
target: "_blank",
|
|
6181
6386
|
rel: "noreferrer noopener",
|
|
6182
|
-
className: "block w-fit rounded-lg border border-
|
|
6387
|
+
className: "block w-fit rounded-lg border border-border bg-surface p-2",
|
|
6183
6388
|
children: [/* @__PURE__ */ jsx("img", {
|
|
6184
6389
|
src: part.url,
|
|
6185
6390
|
alt: title || copy.uploadedImage,
|
|
6186
6391
|
className: "max-h-56 rounded-md object-contain"
|
|
6187
6392
|
}), title ? /* @__PURE__ */ jsx("p", {
|
|
6188
|
-
className: "mt-2 max-w-xs truncate text-xs font-medium text-
|
|
6393
|
+
className: "mt-2 max-w-xs truncate text-xs font-medium text-strong",
|
|
6189
6394
|
children: title
|
|
6190
6395
|
}) : null]
|
|
6191
6396
|
}, `image-${index}`);
|
|
@@ -6197,17 +6402,17 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
|
|
|
6197
6402
|
href: part.fileUrl,
|
|
6198
6403
|
target: "_blank",
|
|
6199
6404
|
rel: "noreferrer noopener",
|
|
6200
|
-
className: "flex w-fit items-center gap-3 rounded-lg border border-
|
|
6405
|
+
className: "flex w-fit items-center gap-3 rounded-lg border border-border bg-surface-muted px-3 py-2 text-left",
|
|
6201
6406
|
children: [/* @__PURE__ */ jsx("span", {
|
|
6202
|
-
className: "rounded bg-
|
|
6407
|
+
className: "rounded bg-inverse px-2 py-1 text-[10px] font-semibold uppercase tracking-wide text-inverse-foreground",
|
|
6203
6408
|
children: extension ?? copy.file
|
|
6204
6409
|
}), /* @__PURE__ */ jsxs("div", {
|
|
6205
6410
|
className: "min-w-0",
|
|
6206
6411
|
children: [/* @__PURE__ */ jsx("p", {
|
|
6207
|
-
className: "max-w-xs truncate text-sm font-medium text-
|
|
6412
|
+
className: "max-w-xs truncate text-sm font-medium text-foreground",
|
|
6208
6413
|
children: fileName
|
|
6209
6414
|
}), part.mimeType ? /* @__PURE__ */ jsx("p", {
|
|
6210
|
-
className: "text-xs text-
|
|
6415
|
+
className: "text-xs text-muted",
|
|
6211
6416
|
children: part.mimeType
|
|
6212
6417
|
}) : null]
|
|
6213
6418
|
})]
|
|
@@ -6234,7 +6439,7 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
|
|
|
6234
6439
|
}, `thinking-${index}`);
|
|
6235
6440
|
}
|
|
6236
6441
|
if (part.type === "guardrail") return /* @__PURE__ */ jsx("p", {
|
|
6237
|
-
className: "rounded-lg border border-
|
|
6442
|
+
className: "rounded-lg border border-warning-border bg-warning-subtle px-3 py-2 text-sm text-warning-strong",
|
|
6238
6443
|
children: part.content
|
|
6239
6444
|
}, `guardrail-${index}`);
|
|
6240
6445
|
return null;
|
|
@@ -6311,7 +6516,7 @@ function MessageParts({ message, collapseThreshold = DEFAULT_COLLAPSE_THRESHOLD,
|
|
|
6311
6516
|
getResourceDownloadUrl
|
|
6312
6517
|
}, `source-results-${item.index}`) : renderPart(item.part, item.index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, memoryProposal, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName, toolConfirmation)), canCollapse ? /* @__PURE__ */ jsx("button", {
|
|
6313
6518
|
type: "button",
|
|
6314
|
-
className: "text-xs font-medium text-
|
|
6519
|
+
className: "text-xs font-medium text-secondary hover:text-foreground",
|
|
6315
6520
|
onClick: () => setIsExpanded((previous) => !previous),
|
|
6316
6521
|
children: isExpanded ? readLessLabel ?? copy.readLess : readMoreLabel ?? copy.readMore
|
|
6317
6522
|
}) : null]
|
|
@@ -6498,7 +6703,7 @@ function Clipboard({ text: text$2, onCopy, copiedDuration = 2e3, copyLabel, copi
|
|
|
6498
6703
|
return /* @__PURE__ */ jsxs("button", {
|
|
6499
6704
|
type,
|
|
6500
6705
|
"aria-label": isCopied ? resolvedCopiedLabel : resolvedCopyLabel,
|
|
6501
|
-
className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-
|
|
6706
|
+
className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-surface text-strong transition-colors hover:bg-surface-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:cursor-not-allowed disabled:opacity-40", className),
|
|
6502
6707
|
disabled: disabled || isCopying,
|
|
6503
6708
|
onClick: handleClick,
|
|
6504
6709
|
...props,
|
|
@@ -6522,7 +6727,7 @@ function ThumbButton({ label, icon, className, type = "button",...props }) {
|
|
|
6522
6727
|
return /* @__PURE__ */ jsxs("button", {
|
|
6523
6728
|
type,
|
|
6524
6729
|
"aria-label": label,
|
|
6525
|
-
className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-
|
|
6730
|
+
className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-surface text-strong transition-colors hover:bg-surface-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:cursor-not-allowed disabled:opacity-40 aria-pressed:border-inverse aria-pressed:bg-inverse aria-pressed:text-inverse-foreground", className),
|
|
6526
6731
|
...props,
|
|
6527
6732
|
children: [icon, /* @__PURE__ */ jsx("span", {
|
|
6528
6733
|
className: "sr-only",
|
|
@@ -6558,7 +6763,7 @@ function Reload({ label, locale, className, type = "button",...props }) {
|
|
|
6558
6763
|
return /* @__PURE__ */ jsxs("button", {
|
|
6559
6764
|
type,
|
|
6560
6765
|
"aria-label": resolvedLabel,
|
|
6561
|
-
className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-
|
|
6766
|
+
className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-surface text-strong transition-colors hover:bg-surface-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:cursor-not-allowed disabled:opacity-40", className),
|
|
6562
6767
|
...props,
|
|
6563
6768
|
children: [/* @__PURE__ */ jsx(RotateCcw, {
|
|
6564
6769
|
className: "size-4",
|
|
@@ -6588,13 +6793,13 @@ const ALLOWED_EXTENSIONS = new Set([
|
|
|
6588
6793
|
".pptx"
|
|
6589
6794
|
]);
|
|
6590
6795
|
const PROMPT_FORM_FILE_ACCEPT = "image/*,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx";
|
|
6591
|
-
function getFileExtension(filename) {
|
|
6796
|
+
function getFileExtension$1(filename) {
|
|
6592
6797
|
const lastDotIndex = filename.lastIndexOf(".");
|
|
6593
6798
|
if (lastDotIndex <= 0 || lastDotIndex === filename.length - 1) return;
|
|
6594
6799
|
return filename.slice(lastDotIndex).toLowerCase();
|
|
6595
6800
|
}
|
|
6596
6801
|
function isAllowedPromptFormFile(file) {
|
|
6597
|
-
const extension = getFileExtension(file.name);
|
|
6802
|
+
const extension = getFileExtension$1(file.name);
|
|
6598
6803
|
if (extension && ALLOWED_EXTENSIONS.has(extension)) return true;
|
|
6599
6804
|
return file.type.startsWith("image/");
|
|
6600
6805
|
}
|
|
@@ -6645,7 +6850,7 @@ function PromptFormAttachButton({ onFilesSelected, onInvalidFiles, locale, accep
|
|
|
6645
6850
|
|
|
6646
6851
|
//#endregion
|
|
6647
6852
|
//#region src/components/prompt-form/prompt-form.tsx
|
|
6648
|
-
const actionButtonClassName = "inline-flex size-8 shrink-0 items-center justify-center rounded-md bg-
|
|
6853
|
+
const actionButtonClassName = "inline-flex size-8 shrink-0 items-center justify-center rounded-md bg-surface-subtle text-secondary transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-40";
|
|
6649
6854
|
const defaultMaxRows = 4;
|
|
6650
6855
|
function resizeTextarea(textarea, maxRows) {
|
|
6651
6856
|
const styles = getComputedStyle(textarea);
|
|
@@ -6697,7 +6902,7 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", locale,
|
|
|
6697
6902
|
setFiles(files.filter((_, fileIndex) => fileIndex !== index));
|
|
6698
6903
|
}
|
|
6699
6904
|
return /* @__PURE__ */ jsxs("form", {
|
|
6700
|
-
className: joinClasses("flex w-full flex-col overflow-hidden rounded-2xl border border-
|
|
6905
|
+
className: joinClasses("flex w-full flex-col overflow-hidden rounded-2xl border border-border bg-surface", className),
|
|
6701
6906
|
onSubmit: async (event) => {
|
|
6702
6907
|
event.preventDefault();
|
|
6703
6908
|
if (!canSubmit) return;
|
|
@@ -6729,7 +6934,7 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", locale,
|
|
|
6729
6934
|
/* @__PURE__ */ jsx("textarea", {
|
|
6730
6935
|
ref: textareaRef,
|
|
6731
6936
|
rows: 1,
|
|
6732
|
-
className: joinClasses("min-h-10 flex-1 resize-none overflow-hidden border-0 bg-transparent px-0 py-1.5 text-sm leading-6 text-
|
|
6937
|
+
className: joinClasses("min-h-10 flex-1 resize-none overflow-hidden border-0 bg-transparent px-0 py-1.5 text-sm leading-6 text-foreground outline-none placeholder:text-muted", textareaClassName),
|
|
6733
6938
|
value,
|
|
6734
6939
|
onChange: (event) => {
|
|
6735
6940
|
onValueChange(event.target.value);
|
|
@@ -6773,17 +6978,17 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", locale,
|
|
|
6773
6978
|
})
|
|
6774
6979
|
]
|
|
6775
6980
|
}), files.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
6776
|
-
className: joinClasses("border-t border-
|
|
6981
|
+
className: joinClasses("border-t border-border", attachmentsClassName),
|
|
6777
6982
|
children: [/* @__PURE__ */ jsx("div", {
|
|
6778
6983
|
className: "flex flex-wrap gap-2 px-4 py-2",
|
|
6779
6984
|
children: files.map((file, index) => /* @__PURE__ */ jsxs("div", {
|
|
6780
|
-
className: "flex max-w-full items-center gap-1.5 rounded-md bg-
|
|
6985
|
+
className: "flex max-w-full items-center gap-1.5 rounded-md bg-surface-subtle px-2 py-1 text-xs text-strong",
|
|
6781
6986
|
children: [/* @__PURE__ */ jsx("span", {
|
|
6782
6987
|
className: "max-w-[150px] truncate",
|
|
6783
6988
|
children: file.name
|
|
6784
6989
|
}), /* @__PURE__ */ jsx("button", {
|
|
6785
6990
|
type: "button",
|
|
6786
|
-
className: "text-
|
|
6991
|
+
className: "text-muted transition-colors hover:text-strong disabled:cursor-not-allowed disabled:opacity-40",
|
|
6787
6992
|
"aria-label": `${removeFileLabel}: ${file.name}`,
|
|
6788
6993
|
disabled: isInteractionDisabled,
|
|
6789
6994
|
onClick: () => removeFile(index),
|
|
@@ -6799,14 +7004,14 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", locale,
|
|
|
6799
7004
|
"aria-valuemin": 0,
|
|
6800
7005
|
"aria-valuemax": 100,
|
|
6801
7006
|
"aria-valuenow": Math.round(uploadState.progress),
|
|
6802
|
-
className: joinClasses("h-1.5 overflow-hidden rounded-full bg-
|
|
7007
|
+
className: joinClasses("h-1.5 overflow-hidden rounded-full bg-surface-hover", uploadProgressClassName),
|
|
6803
7008
|
children: /* @__PURE__ */ jsx("div", {
|
|
6804
|
-
className: "h-full rounded-full bg-
|
|
7009
|
+
className: "h-full rounded-full bg-inverse transition-[width] duration-150",
|
|
6805
7010
|
style: { width: `${uploadState.progress}%` }
|
|
6806
7011
|
})
|
|
6807
7012
|
})
|
|
6808
7013
|
}) : uploadState?.status === "error" ? /* @__PURE__ */ jsx("p", {
|
|
6809
|
-
className: "px-4 pb-3 text-xs text-
|
|
7014
|
+
className: "px-4 pb-3 text-xs text-danger",
|
|
6810
7015
|
children: uploadErrorLabel
|
|
6811
7016
|
}) : null]
|
|
6812
7017
|
}) : null]
|
|
@@ -7010,7 +7215,7 @@ function SpeechToTextToggle({ controller, onTranscriptionComplete, onTranscripti
|
|
|
7010
7215
|
"aria-pressed": isListening,
|
|
7011
7216
|
"aria-busy": isRequesting || isTranscribing,
|
|
7012
7217
|
disabled: disabled || isRequesting || isTranscribing,
|
|
7013
|
-
className: joinClasses(isListening && !isTranscribing ? "text-
|
|
7218
|
+
className: joinClasses(isListening && !isTranscribing ? "text-danger" : void 0, className),
|
|
7014
7219
|
onClick: (event) => {
|
|
7015
7220
|
onClick?.(event);
|
|
7016
7221
|
if (event.defaultPrevented) return;
|
|
@@ -7040,5 +7245,175 @@ async function dummyTranscribeAudio(_audio, signal) {
|
|
|
7040
7245
|
}
|
|
7041
7246
|
|
|
7042
7247
|
//#endregion
|
|
7043
|
-
|
|
7248
|
+
//#region src/components/conversation-files.tsx
|
|
7249
|
+
/** URL without query or hash, so a re-signed URL still matches its file. */
|
|
7250
|
+
function getFileKey(url) {
|
|
7251
|
+
return url.split("#")[0]?.split("?")[0] ?? url;
|
|
7252
|
+
}
|
|
7253
|
+
/**
|
|
7254
|
+
* Collects the files of the loaded messages, in conversation order: the user's
|
|
7255
|
+
* attachments and the files produced by office_documents tool calls. Files
|
|
7256
|
+
* without a URL are skipped; a file seen twice is listed once. Persisted
|
|
7257
|
+
* history omits media file ids, so files are matched by URL.
|
|
7258
|
+
*/
|
|
7259
|
+
function getConversationFiles(messages) {
|
|
7260
|
+
const uploaded = [];
|
|
7261
|
+
const generated = [];
|
|
7262
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7263
|
+
const add = (list, file) => {
|
|
7264
|
+
const key = `${file.kind}:${getFileKey(file.url)}`;
|
|
7265
|
+
if (seen.has(key)) return;
|
|
7266
|
+
seen.add(key);
|
|
7267
|
+
list.push(file);
|
|
7268
|
+
};
|
|
7269
|
+
for (const message of messages) for (const part of message.parts) if (message.role === "user" && part.type === "input_file") {
|
|
7270
|
+
const url = part.metadata?.wasConverted && part.metadata.sourceUrl || part.fileUrl;
|
|
7271
|
+
if (!url) continue;
|
|
7272
|
+
const name = part.metadata?.originalFileName || part.title || getFilenameFromUrl(url) || url;
|
|
7273
|
+
add(uploaded, {
|
|
7274
|
+
id: part.metadata?.mediaFileId || url,
|
|
7275
|
+
kind: "uploaded",
|
|
7276
|
+
name,
|
|
7277
|
+
url,
|
|
7278
|
+
contentType: part.mimeType,
|
|
7279
|
+
extension: getFileExtension(name, part.mimeType),
|
|
7280
|
+
messageId: message.id
|
|
7281
|
+
});
|
|
7282
|
+
} else if (message.role === "user" && part.type === "input_image") {
|
|
7283
|
+
if (!part.url) continue;
|
|
7284
|
+
const name = part.metadata?.originalFileName || part.title || getFilenameFromUrl(part.url) || part.url;
|
|
7285
|
+
add(uploaded, {
|
|
7286
|
+
id: part.metadata?.mediaFileId || part.url,
|
|
7287
|
+
kind: "uploaded",
|
|
7288
|
+
name,
|
|
7289
|
+
url: part.url,
|
|
7290
|
+
extension: getFileExtension(name),
|
|
7291
|
+
messageId: message.id
|
|
7292
|
+
});
|
|
7293
|
+
} else if (part.type === "tool-call" && part.toolType === "office_documents") {
|
|
7294
|
+
const mediaFiles = part.metadata?.media_files;
|
|
7295
|
+
if (!Array.isArray(mediaFiles)) continue;
|
|
7296
|
+
for (const file of mediaFiles) {
|
|
7297
|
+
if (!file || typeof file.id !== "string" || !file.url) continue;
|
|
7298
|
+
const name = file.name ?? getFilenameFromUrl(file.url) ?? file.id;
|
|
7299
|
+
add(generated, {
|
|
7300
|
+
id: file.id,
|
|
7301
|
+
kind: "generated",
|
|
7302
|
+
name,
|
|
7303
|
+
url: file.url,
|
|
7304
|
+
contentType: file.content_type,
|
|
7305
|
+
extension: getFileExtension(name, file.content_type),
|
|
7306
|
+
messageId: message.id
|
|
7307
|
+
});
|
|
7308
|
+
}
|
|
7309
|
+
}
|
|
7310
|
+
return {
|
|
7311
|
+
uploaded,
|
|
7312
|
+
generated
|
|
7313
|
+
};
|
|
7314
|
+
}
|
|
7315
|
+
/** Uploaded and generated files of a conversation, each with a download button. */
|
|
7316
|
+
function ConversationFilesList({ messages, locale, className }) {
|
|
7317
|
+
const copy = getUiCopy(locale);
|
|
7318
|
+
const { uploaded, generated } = useMemo(() => getConversationFiles(messages), [messages]);
|
|
7319
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7320
|
+
className: joinClasses("space-y-6", className),
|
|
7321
|
+
children: [
|
|
7322
|
+
uploaded.length === 0 && generated.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
7323
|
+
className: "text-sm text-secondary",
|
|
7324
|
+
children: copy.noConversationFiles
|
|
7325
|
+
}) : null,
|
|
7326
|
+
/* @__PURE__ */ jsx(FileSection, {
|
|
7327
|
+
title: copy.uploadedFiles,
|
|
7328
|
+
files: uploaded,
|
|
7329
|
+
copy
|
|
7330
|
+
}),
|
|
7331
|
+
/* @__PURE__ */ jsx(FileSection, {
|
|
7332
|
+
title: copy.generatedFiles,
|
|
7333
|
+
files: generated,
|
|
7334
|
+
copy
|
|
7335
|
+
})
|
|
7336
|
+
]
|
|
7337
|
+
});
|
|
7338
|
+
}
|
|
7339
|
+
function FileSection({ title, files, copy }) {
|
|
7340
|
+
if (files.length === 0) return null;
|
|
7341
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
7342
|
+
className: "space-y-3",
|
|
7343
|
+
"aria-label": title,
|
|
7344
|
+
children: [/* @__PURE__ */ jsxs("h3", {
|
|
7345
|
+
className: "text-xs font-semibold uppercase tracking-wide text-muted",
|
|
7346
|
+
children: [
|
|
7347
|
+
title,
|
|
7348
|
+
" (",
|
|
7349
|
+
files.length,
|
|
7350
|
+
")"
|
|
7351
|
+
]
|
|
7352
|
+
}), files.map((file) => /* @__PURE__ */ jsxs("div", {
|
|
7353
|
+
className: "flex items-center gap-3 rounded-lg border border-border bg-surface p-3",
|
|
7354
|
+
children: [
|
|
7355
|
+
/* @__PURE__ */ jsx(File, {
|
|
7356
|
+
className: joinClasses("h-8 w-8 shrink-0", getFileIconClass(file.extension)),
|
|
7357
|
+
"aria-hidden": "true"
|
|
7358
|
+
}),
|
|
7359
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7360
|
+
className: "min-w-0",
|
|
7361
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
7362
|
+
className: "truncate text-sm font-medium",
|
|
7363
|
+
children: file.name
|
|
7364
|
+
}), file.extension ? /* @__PURE__ */ jsx("p", {
|
|
7365
|
+
className: "text-[11px] uppercase text-muted",
|
|
7366
|
+
children: file.extension
|
|
7367
|
+
}) : null]
|
|
7368
|
+
}),
|
|
7369
|
+
/* @__PURE__ */ jsx(FileDownloadButton, {
|
|
7370
|
+
file: {
|
|
7371
|
+
url: file.url,
|
|
7372
|
+
name: file.name
|
|
7373
|
+
},
|
|
7374
|
+
label: file.name,
|
|
7375
|
+
copy
|
|
7376
|
+
})
|
|
7377
|
+
]
|
|
7378
|
+
}, `${file.kind}:${file.id}`))]
|
|
7379
|
+
});
|
|
7380
|
+
}
|
|
7381
|
+
/** Side sheet with the conversation's files, opened from a paperclip button. */
|
|
7382
|
+
function ConversationFilesSheet({ messages, locale, className, open, onOpenChange, showTrigger = true, triggerClassName, side }) {
|
|
7383
|
+
const copy = getUiCopy(locale);
|
|
7384
|
+
const count$1 = useMemo(() => {
|
|
7385
|
+
const { uploaded, generated } = getConversationFiles(messages);
|
|
7386
|
+
return uploaded.length + generated.length;
|
|
7387
|
+
}, [messages]);
|
|
7388
|
+
return /* @__PURE__ */ jsxs(Sheet, {
|
|
7389
|
+
open,
|
|
7390
|
+
onOpenChange,
|
|
7391
|
+
children: [showTrigger ? /* @__PURE__ */ jsxs(SheetTrigger, {
|
|
7392
|
+
"aria-label": `${copy.conversationFiles}: ${count$1}`,
|
|
7393
|
+
title: copy.conversationFiles,
|
|
7394
|
+
className: joinClasses("inline-flex h-8 items-center gap-1.5 rounded-md border border-border bg-surface px-2 text-sm text-strong transition-colors hover:bg-surface-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", triggerClassName),
|
|
7395
|
+
children: [/* @__PURE__ */ jsx(Paperclip$1, {
|
|
7396
|
+
className: "h-4 w-4",
|
|
7397
|
+
"aria-hidden": "true"
|
|
7398
|
+
}), count$1 > 0 ? /* @__PURE__ */ jsx("span", {
|
|
7399
|
+
className: "tabular-nums",
|
|
7400
|
+
children: count$1
|
|
7401
|
+
}) : null]
|
|
7402
|
+
}) : null, /* @__PURE__ */ jsxs(SheetContent, {
|
|
7403
|
+
locale,
|
|
7404
|
+
side,
|
|
7405
|
+
children: [/* @__PURE__ */ jsx(SheetHeader, {
|
|
7406
|
+
className: "pr-10",
|
|
7407
|
+
children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.conversationFiles })
|
|
7408
|
+
}), /* @__PURE__ */ jsx(ConversationFilesList, {
|
|
7409
|
+
messages,
|
|
7410
|
+
locale,
|
|
7411
|
+
className: joinClasses("mt-6", className)
|
|
7412
|
+
})]
|
|
7413
|
+
})]
|
|
7414
|
+
});
|
|
7415
|
+
}
|
|
7416
|
+
|
|
7417
|
+
//#endregion
|
|
7418
|
+
export { AggregatedSourceResults, ArrowUp, AssistantMessage, ChatError, Clipboard, ConfirmationBadge, ConversationFilesList, ConversationFilesSheet, DatasourceFolderCard, DatasourceToolResources, DatasourceToolResultCard, Loader, MemoryProposalCard, Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader, MessageParts, MessageRoot, Microphone, PROMPT_FORM_FILE_ACCEPT, Paperclip, PendingConfirmationFooter, PromptForm, PromptFormAttachButton, PromptFormIconButton, Reload, ResourceCard, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, SpeechToTextToggle, Stop, Thinking, ThumbDown, ThumbUp, ToolError, ToolResultAgentInvocationCard, ToolResultBrowserCard, ToolResultCard, ToolResultExternalDatasourceCard, ToolResultHttpRequestCard, ToolResultMcpCard, ToolResultOfficeDocumentsCard, ToolResultPendingConfirmationCard, ToolResultPersonalConnectorCard, ToolResultToolConfirmationCard, ToolResultWebSearchCard, ToolResultWorkflowDispatchCard, ToolUseIndicator, UserMessage, X, dummyTranscribeAudio, getConversationFiles, getLocalizedOpenGraphValue, getPendingConfirmation, getResourceDescription, getResourceIcon, getResourceOpenGraphImage, getResourceOpenGraphType, getResourceTitle, getResourceType, getResourceUrl, getToolUseLabel, hasPersonalConnectorView, hasToolConfirmationView, isAllowedPromptFormFile, partitionPromptFormFiles, useSpeechToText };
|
|
7044
7419
|
//# sourceMappingURL=index.js.map
|