@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/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpStatusError, OPEN_TOOL_CONFIRMATION_STATUSES, PlaiChat, isHiddenMessage, pendingActionIds, toolConfirmationAt } from "@plaisolutions/client";
|
|
2
2
|
import { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
|
-
import { Bot, Brain, CalendarDays, Check, CheckCircle2, ChevronDown, CircleAlert, CircleX, Clock, Copy, Database,
|
|
3
|
+
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";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/use-tool-confirmations.ts
|
|
@@ -371,7 +371,7 @@ function ChatError({ error, locale, title, children, className,...props }) {
|
|
|
371
371
|
return /* @__PURE__ */ jsxs("div", {
|
|
372
372
|
role: "alert",
|
|
373
373
|
...props,
|
|
374
|
-
className: joinClasses("plai-chat-error flex gap-3 rounded-lg border border-
|
|
374
|
+
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),
|
|
375
375
|
children: [/* @__PURE__ */ jsx(CircleAlert, {
|
|
376
376
|
"aria-hidden": "true",
|
|
377
377
|
className: "mt-0.5 size-4 shrink-0"
|
|
@@ -437,6 +437,12 @@ const ENGLISH_COPY = {
|
|
|
437
437
|
officeDocuments: "Office documents",
|
|
438
438
|
creatingDocuments: "Creating documents…",
|
|
439
439
|
noFilesGenerated: "No files were generated.",
|
|
440
|
+
download: "Download",
|
|
441
|
+
downloading: "Downloading…",
|
|
442
|
+
downloadFailed: "Download failed. Try again.",
|
|
443
|
+
conversationFiles: "Conversation files",
|
|
444
|
+
uploadedFiles: "Uploaded files",
|
|
445
|
+
noConversationFiles: "No files in this conversation yet.",
|
|
440
446
|
httpRequest: "HTTP request",
|
|
441
447
|
httpResponse: "HTTP response",
|
|
442
448
|
requestUrl: "Request URL",
|
|
@@ -539,6 +545,12 @@ const TRANSLATIONS = {
|
|
|
539
545
|
officeDocuments: "Documents d’Office",
|
|
540
546
|
creatingDocuments: "Creant documents…",
|
|
541
547
|
noFilesGenerated: "No s’han generat fitxers.",
|
|
548
|
+
download: "Baixa",
|
|
549
|
+
downloading: "Baixant…",
|
|
550
|
+
downloadFailed: "No s’ha pogut baixar. Torna-ho a provar.",
|
|
551
|
+
conversationFiles: "Fitxers de la conversa",
|
|
552
|
+
uploadedFiles: "Fitxers pujats",
|
|
553
|
+
noConversationFiles: "Encara no hi ha fitxers en aquesta conversa.",
|
|
542
554
|
httpRequest: "Sol·licitud HTTP",
|
|
543
555
|
httpResponse: "Resposta HTTP",
|
|
544
556
|
requestUrl: "URL de la sol·licitud",
|
|
@@ -640,6 +652,12 @@ const TRANSLATIONS = {
|
|
|
640
652
|
officeDocuments: "Office-dokumenter",
|
|
641
653
|
creatingDocuments: "Opretter dokumenter…",
|
|
642
654
|
noFilesGenerated: "Ingen filer blev genereret.",
|
|
655
|
+
download: "Download",
|
|
656
|
+
downloading: "Downloader…",
|
|
657
|
+
downloadFailed: "Download mislykkedes. Prøv igen.",
|
|
658
|
+
conversationFiles: "Filer i samtalen",
|
|
659
|
+
uploadedFiles: "Uploadede filer",
|
|
660
|
+
noConversationFiles: "Der er endnu ingen filer i denne samtale.",
|
|
643
661
|
httpRequest: "HTTP-anmodning",
|
|
644
662
|
httpResponse: "HTTP-svar",
|
|
645
663
|
requestUrl: "Anmodnings-URL",
|
|
@@ -741,6 +759,12 @@ const TRANSLATIONS = {
|
|
|
741
759
|
officeDocuments: "Office-Dokumente",
|
|
742
760
|
creatingDocuments: "Dokumente werden erstellt…",
|
|
743
761
|
noFilesGenerated: "Es wurden keine Dateien erstellt.",
|
|
762
|
+
download: "Herunterladen",
|
|
763
|
+
downloading: "Wird heruntergeladen…",
|
|
764
|
+
downloadFailed: "Download fehlgeschlagen. Bitte erneut versuchen.",
|
|
765
|
+
conversationFiles: "Dateien der Unterhaltung",
|
|
766
|
+
uploadedFiles: "Hochgeladene Dateien",
|
|
767
|
+
noConversationFiles: "In dieser Unterhaltung gibt es noch keine Dateien.",
|
|
744
768
|
httpRequest: "HTTP-Anfrage",
|
|
745
769
|
httpResponse: "HTTP-Antwort",
|
|
746
770
|
requestUrl: "Anfrage-URL",
|
|
@@ -843,6 +867,12 @@ const TRANSLATIONS = {
|
|
|
843
867
|
officeDocuments: "Documentos de Office",
|
|
844
868
|
creatingDocuments: "Creando documentos…",
|
|
845
869
|
noFilesGenerated: "No se generaron archivos.",
|
|
870
|
+
download: "Descargar",
|
|
871
|
+
downloading: "Descargando…",
|
|
872
|
+
downloadFailed: "No se pudo descargar. Inténtalo de nuevo.",
|
|
873
|
+
conversationFiles: "Archivos de la conversación",
|
|
874
|
+
uploadedFiles: "Archivos subidos",
|
|
875
|
+
noConversationFiles: "Todavía no hay archivos en esta conversación.",
|
|
846
876
|
httpRequest: "Solicitud HTTP",
|
|
847
877
|
httpResponse: "Respuesta HTTP",
|
|
848
878
|
requestUrl: "URL de la solicitud",
|
|
@@ -944,6 +974,12 @@ const TRANSLATIONS = {
|
|
|
944
974
|
officeDocuments: "Documents Office",
|
|
945
975
|
creatingDocuments: "Création des documents…",
|
|
946
976
|
noFilesGenerated: "Aucun fichier n’a été généré.",
|
|
977
|
+
download: "Télécharger",
|
|
978
|
+
downloading: "Téléchargement…",
|
|
979
|
+
downloadFailed: "Échec du téléchargement. Réessayez.",
|
|
980
|
+
conversationFiles: "Fichiers de la conversation",
|
|
981
|
+
uploadedFiles: "Fichiers importés",
|
|
982
|
+
noConversationFiles: "Aucun fichier dans cette conversation pour l’instant.",
|
|
947
983
|
httpRequest: "Requête HTTP",
|
|
948
984
|
httpResponse: "Réponse HTTP",
|
|
949
985
|
requestUrl: "URL de la requête",
|
|
@@ -1045,6 +1081,12 @@ const TRANSLATIONS = {
|
|
|
1045
1081
|
officeDocuments: "Documenti Office",
|
|
1046
1082
|
creatingDocuments: "Creazione dei documenti…",
|
|
1047
1083
|
noFilesGenerated: "Nessun file generato.",
|
|
1084
|
+
download: "Scarica",
|
|
1085
|
+
downloading: "Download in corso…",
|
|
1086
|
+
downloadFailed: "Download non riuscito. Riprova.",
|
|
1087
|
+
conversationFiles: "File della conversazione",
|
|
1088
|
+
uploadedFiles: "File caricati",
|
|
1089
|
+
noConversationFiles: "Ancora nessun file in questa conversazione.",
|
|
1048
1090
|
httpRequest: "Richiesta HTTP",
|
|
1049
1091
|
httpResponse: "Risposta HTTP",
|
|
1050
1092
|
requestUrl: "URL della richiesta",
|
|
@@ -1146,6 +1188,12 @@ const TRANSLATIONS = {
|
|
|
1146
1188
|
officeDocuments: "Office-dokumenter",
|
|
1147
1189
|
creatingDocuments: "Oppretter dokumenter…",
|
|
1148
1190
|
noFilesGenerated: "Ingen filer ble generert.",
|
|
1191
|
+
download: "Last ned",
|
|
1192
|
+
downloading: "Laster ned…",
|
|
1193
|
+
downloadFailed: "Nedlastingen mislyktes. Prøv igjen.",
|
|
1194
|
+
conversationFiles: "Filer i samtalen",
|
|
1195
|
+
uploadedFiles: "Opplastede filer",
|
|
1196
|
+
noConversationFiles: "Det er ingen filer i denne samtalen ennå.",
|
|
1149
1197
|
httpRequest: "HTTP-forespørsel",
|
|
1150
1198
|
httpResponse: "HTTP-svar",
|
|
1151
1199
|
requestUrl: "Forespørsels-URL",
|
|
@@ -1247,6 +1295,12 @@ const TRANSLATIONS = {
|
|
|
1247
1295
|
officeDocuments: "Documentos do Office",
|
|
1248
1296
|
creatingDocuments: "A criar documentos…",
|
|
1249
1297
|
noFilesGenerated: "Não foram gerados ficheiros.",
|
|
1298
|
+
download: "Transferir",
|
|
1299
|
+
downloading: "A transferir…",
|
|
1300
|
+
downloadFailed: "Não foi possível transferir. Tente novamente.",
|
|
1301
|
+
conversationFiles: "Ficheiros da conversa",
|
|
1302
|
+
uploadedFiles: "Ficheiros carregados",
|
|
1303
|
+
noConversationFiles: "Ainda não há ficheiros nesta conversa.",
|
|
1250
1304
|
httpRequest: "Pedido HTTP",
|
|
1251
1305
|
httpResponse: "Resposta HTTP",
|
|
1252
1306
|
requestUrl: "URL do pedido",
|
|
@@ -1348,6 +1402,12 @@ const TRANSLATIONS = {
|
|
|
1348
1402
|
officeDocuments: "Office-dokument",
|
|
1349
1403
|
creatingDocuments: "Skapar dokument…",
|
|
1350
1404
|
noFilesGenerated: "Inga filer genererades.",
|
|
1405
|
+
download: "Ladda ned",
|
|
1406
|
+
downloading: "Laddar ned…",
|
|
1407
|
+
downloadFailed: "Nedladdningen misslyckades. Försök igen.",
|
|
1408
|
+
conversationFiles: "Filer i konversationen",
|
|
1409
|
+
uploadedFiles: "Uppladdade filer",
|
|
1410
|
+
noConversationFiles: "Det finns inga filer i den här konversationen ännu.",
|
|
1351
1411
|
httpRequest: "HTTP-begäran",
|
|
1352
1412
|
httpResponse: "HTTP-svar",
|
|
1353
1413
|
requestUrl: "Begärans URL",
|
|
@@ -1479,7 +1539,7 @@ function DatasourceToolResultCardContent({ title, description, type, icon, resou
|
|
|
1479
1539
|
children: description
|
|
1480
1540
|
}),
|
|
1481
1541
|
resourceCount === void 0 ? null : /* @__PURE__ */ jsxs("p", {
|
|
1482
|
-
className: "mt-2 text-xs leading-4 text-
|
|
1542
|
+
className: "mt-2 text-xs leading-4 text-secondary",
|
|
1483
1543
|
children: [
|
|
1484
1544
|
resourceCount,
|
|
1485
1545
|
" ",
|
|
@@ -1491,7 +1551,7 @@ function DatasourceToolResultCardContent({ title, description, type, icon, resou
|
|
|
1491
1551
|
function DatasourceToolResultCard(props) {
|
|
1492
1552
|
return /* @__PURE__ */ jsx("article", {
|
|
1493
1553
|
"aria-label": `${props.type}: ${props.title}`,
|
|
1494
|
-
className: "w-46.5 rounded-lg bg-
|
|
1554
|
+
className: "plai-datasource-tool-result-card w-46.5 rounded-lg bg-surface-subtle p-4 text-foreground",
|
|
1495
1555
|
children: /* @__PURE__ */ jsx(DatasourceToolResultCardContent, { ...props })
|
|
1496
1556
|
});
|
|
1497
1557
|
}
|
|
@@ -1524,7 +1584,7 @@ function ResourceCardContent({ icon, type, title, description, variant = "card"
|
|
|
1524
1584
|
children: bodyTitle
|
|
1525
1585
|
}) : null,
|
|
1526
1586
|
bodyDescription ? /* @__PURE__ */ jsx("p", {
|
|
1527
|
-
className: "mt-2 line-clamp-2 text-xs leading-4 text-
|
|
1587
|
+
className: "mt-2 line-clamp-2 text-xs leading-4 text-secondary",
|
|
1528
1588
|
children: bodyDescription
|
|
1529
1589
|
}) : null
|
|
1530
1590
|
] });
|
|
@@ -1534,8 +1594,8 @@ function ResourceCard(props) {
|
|
|
1534
1594
|
const copy = getUiCopy(locale);
|
|
1535
1595
|
const [downloadState, setDownloadState] = useState("idle");
|
|
1536
1596
|
const abortControllerRef = useRef(null);
|
|
1537
|
-
const className = joinClasses("block rounded-lg bg-
|
|
1538
|
-
const interactiveClassName = `${className} transition-colors hover:bg-
|
|
1597
|
+
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);
|
|
1598
|
+
const interactiveClassName = `${className} transition-colors hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`;
|
|
1539
1599
|
useEffect(() => () => {
|
|
1540
1600
|
abortControllerRef.current?.abort();
|
|
1541
1601
|
}, []);
|
|
@@ -1581,12 +1641,12 @@ function ResourceCard(props) {
|
|
|
1581
1641
|
variant
|
|
1582
1642
|
}),
|
|
1583
1643
|
downloadState === "loading" ? /* @__PURE__ */ jsx("span", {
|
|
1584
|
-
className: "mt-2 block text-xs text-
|
|
1644
|
+
className: "mt-2 block text-xs text-secondary",
|
|
1585
1645
|
"aria-live": "polite",
|
|
1586
1646
|
children: copy.openingResource
|
|
1587
1647
|
}) : null,
|
|
1588
1648
|
downloadState === "error" ? /* @__PURE__ */ jsx("span", {
|
|
1589
|
-
className: "mt-2 block text-xs text-
|
|
1649
|
+
className: "mt-2 block text-xs text-danger-strong",
|
|
1590
1650
|
role: "alert",
|
|
1591
1651
|
children: copy.resourceOpenFailed
|
|
1592
1652
|
}) : null
|
|
@@ -1880,7 +1940,7 @@ const SheetContent = forwardRef(function SheetContent$1({ children, className, s
|
|
|
1880
1940
|
"aria-label": ariaLabel,
|
|
1881
1941
|
"aria-labelledby": ariaLabelledBy ?? labelledBy,
|
|
1882
1942
|
"aria-describedby": ariaDescribedBy ?? describedBy,
|
|
1883
|
-
className: "plai-sheet-overlay fixed inset-0 m-0 h-full max-h-none w-full max-w-none border-0 bg-
|
|
1943
|
+
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",
|
|
1884
1944
|
onCancel: (event) => {
|
|
1885
1945
|
onCancel?.(event);
|
|
1886
1946
|
if (!event.defaultPrevented) {
|
|
@@ -1896,13 +1956,13 @@ const SheetContent = forwardRef(function SheetContent$1({ children, className, s
|
|
|
1896
1956
|
"data-slot": "sheet-content",
|
|
1897
1957
|
"data-state": state,
|
|
1898
1958
|
"data-side": side,
|
|
1899
|
-
className: joinClasses("plai-sheet-content fixed overflow-y-auto border-
|
|
1959
|
+
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),
|
|
1900
1960
|
onAnimationEnd: (event) => {
|
|
1901
1961
|
if (event.currentTarget === event.target && !open) setPresent(false);
|
|
1902
1962
|
},
|
|
1903
1963
|
children: [showCloseButton ? /* @__PURE__ */ jsx(SheetClose, {
|
|
1904
1964
|
"aria-label": closeLabel ?? getUiCopy(locale).close,
|
|
1905
|
-
className: "absolute right-4 top-2 rounded-sm p-1 text-
|
|
1965
|
+
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",
|
|
1906
1966
|
children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
|
|
1907
1967
|
}) : null, children]
|
|
1908
1968
|
})
|
|
@@ -1956,7 +2016,7 @@ const SheetDescription = forwardRef(function SheetDescription$1({ className, id,
|
|
|
1956
2016
|
ref: forwardedRef,
|
|
1957
2017
|
id: resolvedId,
|
|
1958
2018
|
"data-slot": "sheet-description",
|
|
1959
|
-
className: joinClasses("text-sm text-
|
|
2019
|
+
className: joinClasses("text-sm text-secondary", className)
|
|
1960
2020
|
});
|
|
1961
2021
|
});
|
|
1962
2022
|
|
|
@@ -1966,7 +2026,7 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
|
|
|
1966
2026
|
const copy = getUiCopy(locale);
|
|
1967
2027
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
1968
2028
|
"aria-label": `${type}: ${title}`,
|
|
1969
|
-
className: `${variant === "card" ? "min-h-[183px] w-[186px] max-w-full" : "w-full"} rounded-lg bg-
|
|
2029
|
+
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`,
|
|
1970
2030
|
children: /* @__PURE__ */ jsx(DatasourceToolResultCardContent, {
|
|
1971
2031
|
icon,
|
|
1972
2032
|
title,
|
|
@@ -1999,7 +2059,7 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
|
|
|
1999
2059
|
href: url,
|
|
2000
2060
|
target: "_blank",
|
|
2001
2061
|
rel: "noreferrer noopener",
|
|
2002
|
-
className: "text-xs font-medium text-
|
|
2062
|
+
className: "text-xs font-medium text-strong underline underline-offset-2",
|
|
2003
2063
|
children: copy.view
|
|
2004
2064
|
}) : null
|
|
2005
2065
|
]
|
|
@@ -2346,18 +2406,18 @@ function WebSearchResultItem({ result }) {
|
|
|
2346
2406
|
const imageUrl = toStringOrNull$2(result.image_url);
|
|
2347
2407
|
const faviconUrl = getFaviconUrl(result.url);
|
|
2348
2408
|
return /* @__PURE__ */ jsx("article", {
|
|
2349
|
-
className: "rounded-lg border border-
|
|
2409
|
+
className: "rounded-lg border border-border bg-surface p-4",
|
|
2350
2410
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2351
2411
|
className: "flex items-start gap-3",
|
|
2352
2412
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
2353
2413
|
"aria-hidden": "true",
|
|
2354
|
-
className: "relative flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full border border-
|
|
2414
|
+
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",
|
|
2355
2415
|
children: [/* @__PURE__ */ jsx(Globe, { className: "h-4 w-4" }), faviconUrl ? /* @__PURE__ */ jsx("img", {
|
|
2356
2416
|
src: faviconUrl,
|
|
2357
2417
|
alt: "",
|
|
2358
2418
|
width: "16",
|
|
2359
2419
|
height: "16",
|
|
2360
|
-
className: "absolute h-4 w-4 bg-
|
|
2420
|
+
className: "absolute h-4 w-4 bg-surface",
|
|
2361
2421
|
onError: (event) => {
|
|
2362
2422
|
event.currentTarget.style.display = "none";
|
|
2363
2423
|
}
|
|
@@ -2369,28 +2429,28 @@ function WebSearchResultItem({ result }) {
|
|
|
2369
2429
|
href: result.url,
|
|
2370
2430
|
target: "_blank",
|
|
2371
2431
|
rel: "noreferrer noopener",
|
|
2372
|
-
className: "block line-clamp-2 text-sm font-medium leading-5 text-
|
|
2432
|
+
className: "block line-clamp-2 text-sm font-medium leading-5 text-foreground hover:underline",
|
|
2373
2433
|
children: result.title
|
|
2374
2434
|
}),
|
|
2375
2435
|
/* @__PURE__ */ jsxs("div", {
|
|
2376
|
-
className: "flex flex-wrap items-center gap-1.5 text-xs text-
|
|
2436
|
+
className: "flex flex-wrap items-center gap-1.5 text-xs text-muted",
|
|
2377
2437
|
children: [
|
|
2378
2438
|
date ? /* @__PURE__ */ jsx("span", { children: date }) : null,
|
|
2379
2439
|
source ? /* @__PURE__ */ jsx("span", {
|
|
2380
|
-
className: "rounded-full bg-
|
|
2440
|
+
className: "rounded-full bg-surface-subtle px-1.5 py-0.5 capitalize text-secondary",
|
|
2381
2441
|
children: source
|
|
2382
2442
|
}) : null,
|
|
2383
2443
|
!date && !source && hostname ? /* @__PURE__ */ jsx("span", { children: hostname }) : null
|
|
2384
2444
|
]
|
|
2385
2445
|
}),
|
|
2386
2446
|
snippet ? /* @__PURE__ */ jsx("p", {
|
|
2387
|
-
className: "line-clamp-2 text-xs leading-5 text-
|
|
2447
|
+
className: "line-clamp-2 text-xs leading-5 text-secondary",
|
|
2388
2448
|
children: snippet
|
|
2389
2449
|
}) : null,
|
|
2390
2450
|
imageUrl ? /* @__PURE__ */ jsx("img", {
|
|
2391
2451
|
src: imageUrl,
|
|
2392
2452
|
alt: "",
|
|
2393
|
-
className: "max-h-64 w-full rounded-md border border-
|
|
2453
|
+
className: "max-h-64 w-full rounded-md border border-border object-contain",
|
|
2394
2454
|
loading: "lazy"
|
|
2395
2455
|
}) : null
|
|
2396
2456
|
]
|
|
@@ -2407,7 +2467,7 @@ function ToolResultWebSearchCard({ part, locale, className }) {
|
|
|
2407
2467
|
const sourceLabel = searchResults.length === 1 ? copy.singularSource : copy.pluralSources;
|
|
2408
2468
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsxs(SheetTrigger, {
|
|
2409
2469
|
"aria-label": `Web: ${copy.webSearchTitle}, ${searchResults.length} ${sourceLabel}`,
|
|
2410
|
-
className: joinClasses("plai-tool-result-web-search-card min-h-[183px] w-[186px] rounded-lg bg-
|
|
2470
|
+
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),
|
|
2411
2471
|
children: [
|
|
2412
2472
|
/* @__PURE__ */ jsxs("header", {
|
|
2413
2473
|
className: "flex items-center gap-3",
|
|
@@ -2424,7 +2484,7 @@ function ToolResultWebSearchCard({ part, locale, className }) {
|
|
|
2424
2484
|
children: copy.webSearchTitle
|
|
2425
2485
|
}),
|
|
2426
2486
|
/* @__PURE__ */ jsx("p", {
|
|
2427
|
-
className: "mt-2 text-xs leading-4 text-
|
|
2487
|
+
className: "mt-2 text-xs leading-4 text-secondary",
|
|
2428
2488
|
children: part.state === "pending" ? uiCopy.searching : `${searchResults.length} ${sourceLabel}`
|
|
2429
2489
|
})
|
|
2430
2490
|
]
|
|
@@ -2451,13 +2511,13 @@ function ToolResultWebSearchResults({ part, searchResults = getWebSearchResults(
|
|
|
2451
2511
|
className: "space-y-3",
|
|
2452
2512
|
children: searchResults.map((result, index) => /* @__PURE__ */ jsx(WebSearchResultItem, { result }, `${result.url}-${index}`))
|
|
2453
2513
|
}) : part.state === "pending" ? /* @__PURE__ */ jsx("p", {
|
|
2454
|
-
className: "text-sm text-
|
|
2514
|
+
className: "text-sm text-secondary",
|
|
2455
2515
|
children: copy.searchingForSources
|
|
2456
2516
|
}) : /* @__PURE__ */ jsx("p", {
|
|
2457
|
-
className: "text-sm text-
|
|
2517
|
+
className: "text-sm text-secondary",
|
|
2458
2518
|
children: copy.noSourcesReturned
|
|
2459
2519
|
}), errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
2460
|
-
className: "mt-4 rounded border border-
|
|
2520
|
+
className: "mt-4 rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
2461
2521
|
children: [
|
|
2462
2522
|
/* @__PURE__ */ jsxs("span", {
|
|
2463
2523
|
className: "font-semibold",
|
|
@@ -2502,7 +2562,7 @@ function SourceCard({ source, locale, variant = "card" }) {
|
|
|
2502
2562
|
locale
|
|
2503
2563
|
});
|
|
2504
2564
|
return /* @__PURE__ */ jsxs("section", {
|
|
2505
|
-
className: "rounded-lg bg-
|
|
2565
|
+
className: "rounded-lg bg-surface-subtle p-4",
|
|
2506
2566
|
children: [/* @__PURE__ */ jsxs("header", {
|
|
2507
2567
|
className: "mb-4 flex items-center gap-3",
|
|
2508
2568
|
children: [/* @__PURE__ */ jsx(Globe, {
|
|
@@ -2540,7 +2600,7 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
|
|
|
2540
2600
|
locale
|
|
2541
2601
|
}, source.key)), overflowCount > 0 ? /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsxs(SheetTrigger, {
|
|
2542
2602
|
"aria-label": `+${overflowCount} ${overflowLabel}`,
|
|
2543
|
-
className: "flex min-h-[183px] w-[186px] max-w-full flex-col justify-center rounded-lg bg-
|
|
2603
|
+
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",
|
|
2544
2604
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
2545
2605
|
className: "text-2xl font-medium leading-7",
|
|
2546
2606
|
children: ["+", overflowCount]
|
|
@@ -2569,6 +2629,41 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
|
|
|
2569
2629
|
});
|
|
2570
2630
|
}
|
|
2571
2631
|
|
|
2632
|
+
//#endregion
|
|
2633
|
+
//#region src/components/internal/file-display.ts
|
|
2634
|
+
function getFilenameFromUrl(url) {
|
|
2635
|
+
try {
|
|
2636
|
+
const parsed = new URL(url);
|
|
2637
|
+
return decodeURIComponent(parsed.pathname).split("/").pop()?.trim() || void 0;
|
|
2638
|
+
} catch {
|
|
2639
|
+
return (url.split("?")[0]?.split("#")[0] ?? "").split("/").pop()?.trim() || void 0;
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
/** Lowercase extension from the file name, falling back to the MIME type. */
|
|
2643
|
+
function getFileExtension(name, contentType) {
|
|
2644
|
+
const label = name ?? "";
|
|
2645
|
+
const extension = label.split(".").pop()?.toLowerCase();
|
|
2646
|
+
if (extension && extension !== label.toLowerCase()) return extension;
|
|
2647
|
+
const mime = contentType ?? "";
|
|
2648
|
+
if (mime.includes("pdf")) return "pdf";
|
|
2649
|
+
if (mime.includes("wordprocessingml")) return "docx";
|
|
2650
|
+
if (mime.includes("spreadsheetml")) return "xlsx";
|
|
2651
|
+
if (mime.includes("presentationml")) return "pptx";
|
|
2652
|
+
if (mime.startsWith("image/")) return mime.slice(6) || null;
|
|
2653
|
+
return null;
|
|
2654
|
+
}
|
|
2655
|
+
function getFileIconClass(extension) {
|
|
2656
|
+
if (extension === "pdf") return "text-danger";
|
|
2657
|
+
if (["doc", "docx"].includes(extension ?? "")) return "text-info";
|
|
2658
|
+
if ([
|
|
2659
|
+
"xls",
|
|
2660
|
+
"xlsx",
|
|
2661
|
+
"csv"
|
|
2662
|
+
].includes(extension ?? "")) return "text-success";
|
|
2663
|
+
if (["ppt", "pptx"].includes(extension ?? "")) return "text-warning";
|
|
2664
|
+
return "text-muted";
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2572
2667
|
//#endregion
|
|
2573
2668
|
//#region src/components/memory-proposal-card.tsx
|
|
2574
2669
|
const COPY$1 = {
|
|
@@ -2822,88 +2917,94 @@ function MemoryProposalCard({ proposal: initial, actions, activeAgentId, locale,
|
|
|
2822
2917
|
const statusCopy = proposal.status === "ACCEPTED" ? copy.accepted : proposal.status === "REJECTED" ? copy.rejected : proposal.status === "EXPIRED" ? copy.expired : proposal.status === "CONFLICTED" ? copy.conflicted : null;
|
|
2823
2918
|
const operation = proposal.operation === "CREATE" ? copy.create : proposal.operation === "UPDATE" ? copy.update : copy.delete;
|
|
2824
2919
|
return /* @__PURE__ */ jsxs("section", {
|
|
2825
|
-
className: joinClasses("
|
|
2920
|
+
className: joinClasses("plai-memory-proposal-card overflow-hidden rounded-lg border border-success-border bg-success-subtle/30 text-left", className),
|
|
2826
2921
|
"data-memory-proposal-id": proposal.id,
|
|
2827
|
-
children: [
|
|
2828
|
-
|
|
2829
|
-
|
|
2922
|
+
children: [/* @__PURE__ */ jsx("header", {
|
|
2923
|
+
className: "border-b border-success-border px-3 py-2",
|
|
2924
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
2925
|
+
className: "flex items-center gap-2",
|
|
2830
2926
|
children: [/* @__PURE__ */ jsxs("h4", {
|
|
2831
|
-
className: "flex items-center gap-2 text-sm font-semibold text-
|
|
2832
|
-
children: [/* @__PURE__ */ jsx(Brain, { className: "size-4" }), copy.
|
|
2927
|
+
className: "flex items-center gap-2 text-sm font-semibold text-foreground",
|
|
2928
|
+
children: [/* @__PURE__ */ jsx(Brain, { className: "size-4" }), proposal.scope === "USER" ? copy.user : copy.project]
|
|
2833
2929
|
}), /* @__PURE__ */ jsxs("div", {
|
|
2930
|
+
"aria-label": "type",
|
|
2834
2931
|
className: "flex flex-wrap gap-2 text-xs",
|
|
2835
|
-
children: [
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
children: operation
|
|
2843
|
-
}),
|
|
2844
|
-
/* @__PURE__ */ jsx("span", {
|
|
2845
|
-
className: "rounded-full bg-slate-100 px-2 py-0.5",
|
|
2846
|
-
children: formatCategory(proposal.category)
|
|
2847
|
-
})
|
|
2848
|
-
]
|
|
2849
|
-
})]
|
|
2850
|
-
}),
|
|
2851
|
-
proposal.previous_content && proposal.previous_content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
|
|
2852
|
-
className: "rounded-md bg-slate-100 p-3 text-sm",
|
|
2853
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
2854
|
-
className: "mb-1 block text-xs font-medium text-slate-500",
|
|
2855
|
-
children: copy.previous
|
|
2856
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
2857
|
-
className: "whitespace-pre-wrap break-words",
|
|
2858
|
-
children: proposal.previous_content
|
|
2859
|
-
})]
|
|
2860
|
-
}) : null,
|
|
2861
|
-
proposal.content && proposal.content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
|
|
2862
|
-
className: "text-sm",
|
|
2863
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
2864
|
-
className: "mb-1 block text-xs font-medium text-slate-500",
|
|
2865
|
-
children: copy.proposed
|
|
2866
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
2867
|
-
className: "whitespace-pre-wrap break-words",
|
|
2868
|
-
children: proposal.content
|
|
2869
|
-
})]
|
|
2870
|
-
}) : null,
|
|
2871
|
-
canResolve ? /* @__PURE__ */ jsxs("div", {
|
|
2872
|
-
className: "flex gap-2",
|
|
2873
|
-
children: [/* @__PURE__ */ jsxs("button", {
|
|
2874
|
-
type: "button",
|
|
2875
|
-
disabled: resolving,
|
|
2876
|
-
onClick: () => void resolve(true),
|
|
2877
|
-
className: "inline-flex items-center rounded-md bg-slate-900 px-3 py-1.5 text-xs font-medium text-white disabled:opacity-50",
|
|
2878
|
-
children: [resolving ? /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 size-3 animate-spin" }) : null, copy.accept]
|
|
2879
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
2880
|
-
type: "button",
|
|
2881
|
-
disabled: resolving,
|
|
2882
|
-
onClick: () => void resolve(false),
|
|
2883
|
-
className: "rounded-md border border-slate-300 bg-white px-3 py-1.5 text-xs font-medium disabled:opacity-50",
|
|
2884
|
-
children: copy.reject
|
|
2885
|
-
})]
|
|
2886
|
-
}) : null,
|
|
2887
|
-
proposal.status === "PENDING" && !canResolve ? /* @__PURE__ */ jsx("p", {
|
|
2888
|
-
className: "text-xs font-medium text-slate-500",
|
|
2889
|
-
children: proposal.scope === "PROJECT" ? copy.review : copy.unavailable
|
|
2890
|
-
}) : null,
|
|
2891
|
-
proposal.status === "ACCEPTED" && statusCopy ? /* @__PURE__ */ jsxs("span", {
|
|
2892
|
-
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",
|
|
2893
|
-
children: [statusCopy, /* @__PURE__ */ jsx(Check, {
|
|
2894
|
-
className: "size-3.5 stroke-[2.5] text-emerald-600",
|
|
2895
|
-
"aria-hidden": "true"
|
|
2932
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2933
|
+
className: "rounded-full bg-surface-subtle px-2 py-0.5",
|
|
2934
|
+
children: operation
|
|
2935
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2936
|
+
className: "rounded-full bg-surface-subtle px-2 py-0.5",
|
|
2937
|
+
children: formatCategory(proposal.category)
|
|
2938
|
+
})]
|
|
2896
2939
|
})]
|
|
2897
|
-
})
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2940
|
+
})
|
|
2941
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
2942
|
+
className: "space-y-3 px-3 py-2",
|
|
2943
|
+
children: [
|
|
2944
|
+
" ",
|
|
2945
|
+
proposal.previous_content && proposal.previous_content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
|
|
2946
|
+
className: "rounded-md bg-surface-subtle p-3 text-sm",
|
|
2947
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2948
|
+
className: "mb-1 block text-xs font-medium text-muted",
|
|
2949
|
+
children: copy.previous
|
|
2950
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
2951
|
+
className: "whitespace-pre-wrap break-words",
|
|
2952
|
+
children: proposal.previous_content
|
|
2953
|
+
})]
|
|
2954
|
+
}) : null,
|
|
2955
|
+
proposal.content && proposal.content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
|
|
2956
|
+
className: "text-sm",
|
|
2957
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2958
|
+
className: "mb-1 block text-xs font-medium text-muted",
|
|
2959
|
+
children: copy.proposed
|
|
2960
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
2961
|
+
className: "whitespace-pre-wrap break-words",
|
|
2962
|
+
children: proposal.content
|
|
2963
|
+
})]
|
|
2964
|
+
}) : null,
|
|
2965
|
+
canResolve ? /* @__PURE__ */ jsxs("div", {
|
|
2966
|
+
className: "flex gap-2",
|
|
2967
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
2968
|
+
type: "button",
|
|
2969
|
+
disabled: resolving,
|
|
2970
|
+
onClick: () => void resolve(true),
|
|
2971
|
+
className: "inline-flex items-center rounded-md bg-inverse px-3 py-1.5 text-xs font-medium text-inverse-foreground disabled:opacity-50",
|
|
2972
|
+
children: [resolving ? /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 size-3 animate-spin" }) : null, copy.accept]
|
|
2973
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
2974
|
+
type: "button",
|
|
2975
|
+
disabled: resolving,
|
|
2976
|
+
onClick: () => void resolve(false),
|
|
2977
|
+
className: "rounded-md border border-border-strong bg-surface px-3 py-1.5 text-xs font-medium disabled:opacity-50",
|
|
2978
|
+
children: copy.reject
|
|
2979
|
+
})]
|
|
2980
|
+
}) : null,
|
|
2981
|
+
proposal.status === "PENDING" && !canResolve ? /* @__PURE__ */ jsxs("span", {
|
|
2982
|
+
className: "inline-flex items-center gap-1.5 rounded-full border bg-surface px-3 py-1 text-xs font-medium text-foreground",
|
|
2983
|
+
children: [proposal.scope === "PROJECT" ? copy.review : copy.unavailable, /* @__PURE__ */ jsx(Clock, {
|
|
2984
|
+
className: "size-3.5 stroke-[2.5] text-muted",
|
|
2985
|
+
"aria-hidden": "true"
|
|
2986
|
+
})]
|
|
2987
|
+
}) : null,
|
|
2988
|
+
proposal.status === "ACCEPTED" && statusCopy ? /* @__PURE__ */ jsxs("span", {
|
|
2989
|
+
className: "inline-flex items-center gap-1.5 rounded-full border bg-surface px-3 py-1 text-xs font-medium text-foreground",
|
|
2990
|
+
children: [statusCopy, /* @__PURE__ */ jsx(Check, {
|
|
2991
|
+
className: "size-3.5 stroke-[2.5] text-success",
|
|
2992
|
+
"aria-hidden": "true"
|
|
2993
|
+
})]
|
|
2994
|
+
}) : null,
|
|
2995
|
+
statusCopy && proposal.status !== "ACCEPTED" ? /* @__PURE__ */ jsxs("span", {
|
|
2996
|
+
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",
|
|
2997
|
+
children: [statusCopy, /* @__PURE__ */ jsx(X$1, {
|
|
2998
|
+
className: "size-3.5 stroke-[2.5]",
|
|
2999
|
+
"aria-hidden": "true"
|
|
3000
|
+
})]
|
|
3001
|
+
}) : null,
|
|
3002
|
+
error ? /* @__PURE__ */ jsx("p", {
|
|
3003
|
+
className: "text-xs text-danger",
|
|
3004
|
+
children: error
|
|
3005
|
+
}) : null
|
|
3006
|
+
]
|
|
3007
|
+
})]
|
|
2907
3008
|
});
|
|
2908
3009
|
}
|
|
2909
3010
|
function mergeProposal(current, incoming) {
|
|
@@ -3010,7 +3111,7 @@ function ToolError({ part, locale, defaultOpen = false, className,...props }) {
|
|
|
3010
3111
|
const copy = getToolErrorCopy(part, locale);
|
|
3011
3112
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
3012
3113
|
return /* @__PURE__ */ jsxs("section", {
|
|
3013
|
-
className: joinClasses("text-sm text-
|
|
3114
|
+
className: joinClasses("text-sm text-secondary", className),
|
|
3014
3115
|
"data-tool-call-id": part.id,
|
|
3015
3116
|
"data-tool-call-state": part.state,
|
|
3016
3117
|
...props,
|
|
@@ -3018,14 +3119,17 @@ function ToolError({ part, locale, defaultOpen = false, className,...props }) {
|
|
|
3018
3119
|
type: "button",
|
|
3019
3120
|
"aria-controls": contentId,
|
|
3020
3121
|
"aria-expanded": isOpen,
|
|
3021
|
-
className: "inline-flex items-center gap-2 rounded-md py-1 text-left font-medium text-
|
|
3122
|
+
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",
|
|
3022
3123
|
onClick: () => setIsOpen((value) => !value),
|
|
3023
3124
|
children: [
|
|
3024
3125
|
/* @__PURE__ */ jsx(CircleX, {
|
|
3025
3126
|
className: "size-4 shrink-0",
|
|
3026
3127
|
"aria-hidden": "true"
|
|
3027
3128
|
}),
|
|
3028
|
-
/* @__PURE__ */ jsx("span", {
|
|
3129
|
+
/* @__PURE__ */ jsx("span", {
|
|
3130
|
+
className: "line-clamp-1",
|
|
3131
|
+
children: copy.summary
|
|
3132
|
+
}),
|
|
3029
3133
|
/* @__PURE__ */ jsx(ChevronDown, {
|
|
3030
3134
|
className: joinClasses("size-4 shrink-0 transition-transform motion-reduce:transition-none", isOpen ? "rotate-180" : void 0),
|
|
3031
3135
|
"aria-hidden": "true"
|
|
@@ -3033,27 +3137,27 @@ function ToolError({ part, locale, defaultOpen = false, className,...props }) {
|
|
|
3033
3137
|
]
|
|
3034
3138
|
}), isOpen ? /* @__PURE__ */ jsxs("div", {
|
|
3035
3139
|
id: contentId,
|
|
3036
|
-
className: "mt-2 space-y-3 border-l-2 border-
|
|
3140
|
+
className: "mt-2 space-y-3 border-l-2 border-danger-border pl-3",
|
|
3037
3141
|
children: [
|
|
3038
3142
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
3039
|
-
className: "mb-2 text-xs font-semibold text-
|
|
3143
|
+
className: "mb-2 text-xs font-semibold text-strong",
|
|
3040
3144
|
children: copy.input
|
|
3041
3145
|
}), /* @__PURE__ */ jsx("pre", {
|
|
3042
|
-
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-
|
|
3146
|
+
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-surface-subtle p-3 text-xs leading-5 text-strong",
|
|
3043
3147
|
children: formatJson$1(part.input)
|
|
3044
3148
|
})] }),
|
|
3045
3149
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
3046
|
-
className: "mb-2 text-xs font-semibold text-
|
|
3150
|
+
className: "mb-2 text-xs font-semibold text-strong",
|
|
3047
3151
|
children: copy.output
|
|
3048
3152
|
}), /* @__PURE__ */ jsx("pre", {
|
|
3049
|
-
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-
|
|
3153
|
+
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-surface-subtle p-3 text-xs leading-5 text-strong",
|
|
3050
3154
|
children: part.result === void 0 ? copy.noOutput : formatJson$1(part.result)
|
|
3051
3155
|
})] }),
|
|
3052
3156
|
errorDetails ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
3053
|
-
className: "mb-2 text-xs font-semibold text-
|
|
3157
|
+
className: "mb-2 text-xs font-semibold text-danger-strong",
|
|
3054
3158
|
children: copy.details
|
|
3055
3159
|
}), /* @__PURE__ */ jsx("p", {
|
|
3056
|
-
className: "whitespace-pre-wrap text-xs leading-5 text-
|
|
3160
|
+
className: "whitespace-pre-wrap text-xs leading-5 text-danger-strong",
|
|
3057
3161
|
children: errorDetails
|
|
3058
3162
|
})] }) : null
|
|
3059
3163
|
]
|
|
@@ -3093,12 +3197,12 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }
|
|
|
3093
3197
|
const pending = part.state === "pending";
|
|
3094
3198
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
3095
3199
|
"aria-label": `${copy.agent}: ${agentName}`,
|
|
3096
|
-
className: joinClasses("w-full rounded-lg border border-
|
|
3200
|
+
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),
|
|
3097
3201
|
children: /* @__PURE__ */ jsxs("span", {
|
|
3098
3202
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
3099
3203
|
children: [
|
|
3100
3204
|
/* @__PURE__ */ jsx(Bot, {
|
|
3101
|
-
className: "h-4 w-4 shrink-0 text-
|
|
3205
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
3102
3206
|
"aria-hidden": "true"
|
|
3103
3207
|
}),
|
|
3104
3208
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3106,19 +3210,19 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }
|
|
|
3106
3210
|
children: copy.agent
|
|
3107
3211
|
}),
|
|
3108
3212
|
/* @__PURE__ */ jsx("span", {
|
|
3109
|
-
className: "min-w-0 truncate border-
|
|
3213
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
3110
3214
|
children: agentName
|
|
3111
3215
|
}),
|
|
3112
3216
|
/* @__PURE__ */ jsx("span", {
|
|
3113
3217
|
className: "ml-auto shrink-0",
|
|
3114
3218
|
children: pending ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
3115
|
-
className: "h-4 w-4 animate-spin text-
|
|
3219
|
+
className: "h-4 w-4 animate-spin text-warning",
|
|
3116
3220
|
"aria-label": copy.pending
|
|
3117
3221
|
}) : failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
3118
|
-
className: "h-4 w-4 text-
|
|
3222
|
+
className: "h-4 w-4 text-danger",
|
|
3119
3223
|
"aria-hidden": "true"
|
|
3120
3224
|
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
3121
|
-
className: "h-4 w-4 text-
|
|
3225
|
+
className: "h-4 w-4 text-success",
|
|
3122
3226
|
"aria-hidden": "true"
|
|
3123
3227
|
})
|
|
3124
3228
|
})
|
|
@@ -3137,25 +3241,25 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }
|
|
|
3137
3241
|
className: "grid gap-2 text-sm",
|
|
3138
3242
|
children: [
|
|
3139
3243
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3140
|
-
className: "text-xs text-
|
|
3244
|
+
className: "text-xs text-muted",
|
|
3141
3245
|
children: copy.status
|
|
3142
3246
|
}), /* @__PURE__ */ jsx("dd", { children: getUiStatusLabel(part.state, copy) })] }),
|
|
3143
3247
|
metadata?.agent_id ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3144
|
-
className: "text-xs text-
|
|
3248
|
+
className: "text-xs text-muted",
|
|
3145
3249
|
children: copy.agentId
|
|
3146
3250
|
}), /* @__PURE__ */ jsx("dd", {
|
|
3147
3251
|
className: "break-all",
|
|
3148
3252
|
children: metadata.agent_id
|
|
3149
3253
|
})] }) : null,
|
|
3150
3254
|
metadata?.tracked_execution_id ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3151
|
-
className: "text-xs text-
|
|
3255
|
+
className: "text-xs text-muted",
|
|
3152
3256
|
children: copy.executionId
|
|
3153
3257
|
}), /* @__PURE__ */ jsx("dd", {
|
|
3154
3258
|
className: "break-all",
|
|
3155
3259
|
children: metadata.tracked_execution_id
|
|
3156
3260
|
})] }) : null,
|
|
3157
3261
|
threadId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3158
|
-
className: "text-xs text-
|
|
3262
|
+
className: "text-xs text-muted",
|
|
3159
3263
|
children: copy.threadId
|
|
3160
3264
|
}), /* @__PURE__ */ jsx("dd", {
|
|
3161
3265
|
className: "break-all",
|
|
@@ -3167,19 +3271,19 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }
|
|
|
3167
3271
|
className: "mb-2 text-sm font-medium",
|
|
3168
3272
|
children: copy.prompt
|
|
3169
3273
|
}), /* @__PURE__ */ jsx("p", {
|
|
3170
|
-
className: "whitespace-pre-wrap rounded-md border border-
|
|
3274
|
+
className: "whitespace-pre-wrap rounded-md border border-border bg-surface-muted p-3 text-sm leading-6",
|
|
3171
3275
|
children: prompt
|
|
3172
3276
|
})] }) : null,
|
|
3173
3277
|
output$1 ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
3174
3278
|
className: "mb-2 text-sm font-medium",
|
|
3175
3279
|
children: copy.result
|
|
3176
3280
|
}), /* @__PURE__ */ jsx("pre", {
|
|
3177
|
-
className: "overflow-x-auto whitespace-pre-wrap rounded-md border border-
|
|
3281
|
+
className: "overflow-x-auto whitespace-pre-wrap rounded-md border border-border bg-surface-muted p-3 text-xs leading-5",
|
|
3178
3282
|
children: output$1
|
|
3179
3283
|
})] }) : null,
|
|
3180
3284
|
threadId && onOpenThread ? /* @__PURE__ */ jsxs("button", {
|
|
3181
3285
|
type: "button",
|
|
3182
|
-
className: "inline-flex items-center gap-2 rounded-md border border-
|
|
3286
|
+
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",
|
|
3183
3287
|
onClick: () => onOpenThread(threadId),
|
|
3184
3288
|
children: [/* @__PURE__ */ jsx(MessageSquare, {
|
|
3185
3289
|
className: "h-4 w-4",
|
|
@@ -3187,7 +3291,7 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }
|
|
|
3187
3291
|
}), copy.openConversation]
|
|
3188
3292
|
}) : null,
|
|
3189
3293
|
error ? /* @__PURE__ */ jsxs("p", {
|
|
3190
|
-
className: "rounded border border-
|
|
3294
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
3191
3295
|
children: [
|
|
3192
3296
|
/* @__PURE__ */ jsxs("span", {
|
|
3193
3297
|
className: "font-semibold",
|
|
@@ -3239,66 +3343,67 @@ function ToolResultBrowserCard({ part, className, locale }) {
|
|
|
3239
3343
|
const pending = part.state === "pending";
|
|
3240
3344
|
const canExpand = Boolean(preview || error || url);
|
|
3241
3345
|
return /* @__PURE__ */ jsxs("section", {
|
|
3242
|
-
className: joinClasses("overflow-hidden rounded-lg border border-
|
|
3346
|
+
className: joinClasses("plai-tool-result-browser-card overflow-hidden rounded-lg border border-border bg-surface", className),
|
|
3243
3347
|
"aria-label": copy.browserResult,
|
|
3244
|
-
children: [/* @__PURE__ */
|
|
3245
|
-
className: "flex items-center gap-2 px-3 py-2 text-
|
|
3246
|
-
children:
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
className: "min-w-0 truncate border-neutral-500 border px-2 py-0.5 rounded-md text-xs text-neutral-500",
|
|
3257
|
-
children: subtitle
|
|
3258
|
-
}) : null,
|
|
3259
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3260
|
-
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
3261
|
-
children: [pending ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
3262
|
-
className: "h-4 w-4 animate-spin text-amber-600",
|
|
3263
|
-
"aria-label": copy.pending
|
|
3264
|
-
}) : failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
3265
|
-
className: "h-4 w-4 text-rose-600",
|
|
3266
|
-
"aria-hidden": "true"
|
|
3267
|
-
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
3268
|
-
className: "h-4 w-4 text-emerald-600",
|
|
3348
|
+
children: [/* @__PURE__ */ jsx("header", {
|
|
3349
|
+
className: "flex items-center gap-2 border-b border-border px-3 py-2 text-xs text-secondary",
|
|
3350
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
3351
|
+
type: "button",
|
|
3352
|
+
disabled: !canExpand,
|
|
3353
|
+
"aria-label": expanded ? copy.collapseBrowserResult : copy.expandBrowserResult,
|
|
3354
|
+
"aria-expanded": canExpand ? expanded : void 0,
|
|
3355
|
+
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",
|
|
3356
|
+
onClick: () => setExpanded((value) => !value),
|
|
3357
|
+
children: [
|
|
3358
|
+
/* @__PURE__ */ jsx(Globe, {
|
|
3359
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
3269
3360
|
"aria-hidden": "true"
|
|
3270
|
-
}),
|
|
3271
|
-
|
|
3272
|
-
"
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3361
|
+
}),
|
|
3362
|
+
/* @__PURE__ */ jsx("span", {
|
|
3363
|
+
className: "font-medium text-strong",
|
|
3364
|
+
children: copy.browser
|
|
3365
|
+
}),
|
|
3366
|
+
subtitle ? /* @__PURE__ */ jsx("span", {
|
|
3367
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
3368
|
+
children: subtitle
|
|
3369
|
+
}) : null,
|
|
3370
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3371
|
+
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
3372
|
+
children: [pending ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
3373
|
+
className: "h-4 w-4 animate-spin text-warning",
|
|
3374
|
+
"aria-label": copy.pending
|
|
3375
|
+
}) : failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
3376
|
+
className: "h-4 w-4 text-danger",
|
|
3278
3377
|
"aria-hidden": "true"
|
|
3279
|
-
}) : /* @__PURE__ */ jsx(
|
|
3280
|
-
className: "h-
|
|
3378
|
+
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
3379
|
+
className: "h-4 w-4 text-success",
|
|
3281
3380
|
"aria-hidden": "true"
|
|
3282
|
-
})
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3381
|
+
}), canExpand ? expanded ? /* @__PURE__ */ jsx(ChevronUp, {
|
|
3382
|
+
className: "h-4 w-4 text-muted",
|
|
3383
|
+
"aria-hidden": "true"
|
|
3384
|
+
}) : /* @__PURE__ */ jsx(ChevronDown, {
|
|
3385
|
+
className: "h-4 w-4 text-muted",
|
|
3386
|
+
"aria-hidden": "true"
|
|
3387
|
+
}) : null]
|
|
3388
|
+
})
|
|
3389
|
+
]
|
|
3390
|
+
})
|
|
3286
3391
|
}), expanded ? /* @__PURE__ */ jsxs("div", {
|
|
3287
|
-
className: "space-y-3 border-t border-
|
|
3392
|
+
className: "space-y-3 border-t border-border bg-surface-muted p-3",
|
|
3288
3393
|
children: [
|
|
3289
3394
|
url ? /* @__PURE__ */ jsx("a", {
|
|
3290
3395
|
href: url,
|
|
3291
3396
|
target: "_blank",
|
|
3292
3397
|
rel: "noreferrer noopener",
|
|
3293
|
-
className: "block truncate text-xs text-
|
|
3398
|
+
className: "block truncate text-xs text-info-strong underline underline-offset-2 hover:text-info-strong",
|
|
3294
3399
|
children: url
|
|
3295
3400
|
}) : null,
|
|
3296
3401
|
preview ? /* @__PURE__ */ jsx("p", {
|
|
3297
|
-
className: "whitespace-pre-wrap text-xs leading-5 text-
|
|
3402
|
+
className: "whitespace-pre-wrap text-xs leading-5 text-secondary",
|
|
3298
3403
|
children: preview
|
|
3299
3404
|
}) : null,
|
|
3300
3405
|
error ? /* @__PURE__ */ jsxs("p", {
|
|
3301
|
-
className: "text-xs text-
|
|
3406
|
+
className: "text-xs text-danger-strong",
|
|
3302
3407
|
children: [
|
|
3303
3408
|
/* @__PURE__ */ jsxs("span", {
|
|
3304
3409
|
className: "font-semibold",
|
|
@@ -3377,159 +3482,161 @@ function ToolResultEmailSendCard({ part, className, locale }) {
|
|
|
3377
3482
|
const emailInput = parseEmailSendInput(part);
|
|
3378
3483
|
const emailResult = parseEmailSendResult(part);
|
|
3379
3484
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
3380
|
-
const statusClass = part.state === "error" ? "border-
|
|
3485
|
+
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";
|
|
3381
3486
|
return /* @__PURE__ */ jsxs("section", {
|
|
3382
|
-
className: joinClasses("
|
|
3487
|
+
className: joinClasses("plai-tool-result-email-send-card overflow-hidden rounded-lg border border-border bg-surface-muted", className),
|
|
3383
3488
|
"data-tool-call-id": part.id,
|
|
3384
3489
|
"data-tool-call-state": part.state,
|
|
3385
|
-
children: [
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3490
|
+
children: [/* @__PURE__ */ jsx("header", {
|
|
3491
|
+
className: "flex items-center gap-2 border-b border-border px-3 py-2 text-xs text-secondary",
|
|
3492
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
3493
|
+
type: "button",
|
|
3494
|
+
"aria-expanded": isExpanded,
|
|
3495
|
+
"aria-label": isExpanded ? copy.collapse : copy.expand,
|
|
3496
|
+
"aria-controls": `tool-email-details-${part.id}`,
|
|
3497
|
+
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",
|
|
3498
|
+
onClick: () => setIsExpanded((previous) => !previous),
|
|
3499
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3500
|
+
className: "text-sm font-semibold text-foreground",
|
|
3390
3501
|
children: copy.email
|
|
3391
|
-
}), /* @__PURE__ */ jsxs("
|
|
3502
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
3392
3503
|
className: "flex items-center gap-2",
|
|
3393
3504
|
children: [/* @__PURE__ */ jsx("span", {
|
|
3394
|
-
className: joinClasses("rounded-full
|
|
3505
|
+
className: joinClasses("rounded-full border capitalize px-2 py-0.5 text-xs", statusClass),
|
|
3395
3506
|
children: getUiStatusLabel(part.state, copy)
|
|
3396
|
-
}), /* @__PURE__ */ jsx(
|
|
3397
|
-
|
|
3398
|
-
"aria-
|
|
3399
|
-
|
|
3400
|
-
"
|
|
3401
|
-
|
|
3402
|
-
onClick: () => setIsExpanded((previous) => !previous),
|
|
3403
|
-
children: isExpanded ? /* @__PURE__ */ jsx(Minus, {
|
|
3404
|
-
className: "h-3 w-3",
|
|
3405
|
-
"aria-hidden": "true"
|
|
3406
|
-
}) : /* @__PURE__ */ jsx(Plus, {
|
|
3407
|
-
className: "h-3 w-3",
|
|
3408
|
-
"aria-hidden": "true"
|
|
3409
|
-
})
|
|
3507
|
+
}), isExpanded ? /* @__PURE__ */ jsx(ChevronUp, {
|
|
3508
|
+
className: "h-4 w-4 text-muted",
|
|
3509
|
+
"aria-hidden": "true"
|
|
3510
|
+
}) : /* @__PURE__ */ jsx(ChevronDown, {
|
|
3511
|
+
className: "h-4 w-4 text-muted",
|
|
3512
|
+
"aria-hidden": "true"
|
|
3410
3513
|
})]
|
|
3411
3514
|
})]
|
|
3412
|
-
})
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
3419
|
-
className: "text-xs text-slate-900",
|
|
3420
|
-
children: emailInput.subject
|
|
3421
|
-
})]
|
|
3422
|
-
}) : null,
|
|
3423
|
-
/* @__PURE__ */ jsxs("div", {
|
|
3424
|
-
className: "flex items-center gap-1",
|
|
3425
|
-
children: [/* @__PURE__ */ jsxs("p", {
|
|
3426
|
-
className: "text-xs font-semibold text-slate-600",
|
|
3427
|
-
children: [copy.to, ":"]
|
|
3428
|
-
}), emailInput.to.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
3429
|
-
className: "flex flex-wrap gap-2",
|
|
3430
|
-
children: emailInput.to.map((recipient) => /* @__PURE__ */ jsx("span", {
|
|
3431
|
-
className: "rounded-full border border-slate-300 bg-slate-100 px-2 py-0.5 text-xs text-slate-700",
|
|
3432
|
-
children: recipient
|
|
3433
|
-
}, recipient))
|
|
3434
|
-
}) : /* @__PURE__ */ jsx("p", {
|
|
3435
|
-
className: "text-xs text-slate-500",
|
|
3436
|
-
children: copy.noRecipientsProvided
|
|
3437
|
-
})]
|
|
3438
|
-
}),
|
|
3439
|
-
/* @__PURE__ */ jsxs("div", {
|
|
3440
|
-
id: `tool-email-details-${part.id}`,
|
|
3441
|
-
"data-testid": "email-send-details",
|
|
3442
|
-
className: joinClasses(isExpanded ? "block space-y-4" : "hidden"),
|
|
3443
|
-
children: [emailInput.text ? /* @__PURE__ */ jsxs("div", {
|
|
3444
|
-
className: "space-y-1",
|
|
3515
|
+
})
|
|
3516
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
3517
|
+
className: "space-y-4 px-3 py-2",
|
|
3518
|
+
children: [
|
|
3519
|
+
emailInput.subject ? /* @__PURE__ */ jsxs("div", {
|
|
3520
|
+
className: "flex items-center gap-1",
|
|
3445
3521
|
children: [/* @__PURE__ */ jsxs("p", {
|
|
3446
|
-
className: "text-xs font-semibold text-
|
|
3447
|
-
children: [copy.
|
|
3522
|
+
className: "text-xs font-semibold text-secondary",
|
|
3523
|
+
children: [copy.subject, ":"]
|
|
3448
3524
|
}), /* @__PURE__ */ jsx("p", {
|
|
3449
|
-
className: "
|
|
3450
|
-
children: emailInput.
|
|
3525
|
+
className: "text-xs text-foreground",
|
|
3526
|
+
children: emailInput.subject
|
|
3527
|
+
})]
|
|
3528
|
+
}) : null,
|
|
3529
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3530
|
+
className: "flex items-center gap-1",
|
|
3531
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
3532
|
+
className: "text-xs font-semibold text-secondary",
|
|
3533
|
+
children: [copy.to, ":"]
|
|
3534
|
+
}), emailInput.to.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
3535
|
+
className: "flex flex-wrap gap-2",
|
|
3536
|
+
children: emailInput.to.map((recipient) => /* @__PURE__ */ jsx("span", {
|
|
3537
|
+
className: "rounded-full border border-border-strong bg-surface-subtle px-2 py-0.5 text-xs text-strong",
|
|
3538
|
+
children: recipient
|
|
3539
|
+
}, recipient))
|
|
3540
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
3541
|
+
className: "text-xs text-muted",
|
|
3542
|
+
children: copy.noRecipientsProvided
|
|
3451
3543
|
})]
|
|
3452
|
-
})
|
|
3453
|
-
|
|
3544
|
+
}),
|
|
3545
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3546
|
+
id: `tool-email-details-${part.id}`,
|
|
3547
|
+
"data-testid": "email-send-details",
|
|
3548
|
+
className: joinClasses(isExpanded ? "block space-y-4" : "hidden"),
|
|
3549
|
+
children: [emailInput.text ? /* @__PURE__ */ jsxs("div", {
|
|
3550
|
+
className: "space-y-1",
|
|
3551
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
3552
|
+
className: "text-xs font-semibold text-secondary",
|
|
3553
|
+
children: [copy.body, ":"]
|
|
3554
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
3555
|
+
className: "whitespace-pre-wrap rounded border border-border bg-surface p-2 text-sm text-strong",
|
|
3556
|
+
children: emailInput.text
|
|
3557
|
+
})]
|
|
3558
|
+
}) : null, part.result !== void 0 ? /* @__PURE__ */ jsxs("div", {
|
|
3559
|
+
className: "space-y-2 rounded border border-border bg-surface-muted p-3",
|
|
3560
|
+
children: [
|
|
3561
|
+
/* @__PURE__ */ jsx("p", {
|
|
3562
|
+
className: "text-xs font-semibold capitalize tracking-wide text-muted",
|
|
3563
|
+
children: copy.delivery
|
|
3564
|
+
}),
|
|
3565
|
+
emailResult.status ? /* @__PURE__ */ jsxs("p", {
|
|
3566
|
+
className: "text-xs text-strong",
|
|
3567
|
+
children: [
|
|
3568
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3569
|
+
className: "font-semibold text-foreground",
|
|
3570
|
+
children: [copy.status, ":"]
|
|
3571
|
+
}),
|
|
3572
|
+
" ",
|
|
3573
|
+
emailResult.status
|
|
3574
|
+
]
|
|
3575
|
+
}) : null,
|
|
3576
|
+
emailResult.recipientsCount !== null ? /* @__PURE__ */ jsxs("p", {
|
|
3577
|
+
className: "text-xs text-strong",
|
|
3578
|
+
children: [
|
|
3579
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3580
|
+
className: "font-semibold text-foreground",
|
|
3581
|
+
children: [copy.recipients, ":"]
|
|
3582
|
+
}),
|
|
3583
|
+
" ",
|
|
3584
|
+
emailResult.recipientsCount
|
|
3585
|
+
]
|
|
3586
|
+
}) : null,
|
|
3587
|
+
emailResult.receiptProvider ? /* @__PURE__ */ jsxs("p", {
|
|
3588
|
+
className: "text-xs text-strong",
|
|
3589
|
+
children: [
|
|
3590
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3591
|
+
className: "font-semibold text-foreground",
|
|
3592
|
+
children: [copy.provider, ":"]
|
|
3593
|
+
}),
|
|
3594
|
+
" ",
|
|
3595
|
+
emailResult.receiptProvider
|
|
3596
|
+
]
|
|
3597
|
+
}) : null,
|
|
3598
|
+
emailResult.receiptMessageId ? /* @__PURE__ */ jsxs("p", {
|
|
3599
|
+
className: "break-all text-xs text-strong",
|
|
3600
|
+
children: [
|
|
3601
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3602
|
+
className: "font-semibold text-foreground",
|
|
3603
|
+
children: [copy.messageId, ":"]
|
|
3604
|
+
}),
|
|
3605
|
+
" ",
|
|
3606
|
+
emailResult.receiptMessageId
|
|
3607
|
+
]
|
|
3608
|
+
}) : null,
|
|
3609
|
+
emailResult.receiptRawStatus ? /* @__PURE__ */ jsxs("p", {
|
|
3610
|
+
className: "text-xs text-strong",
|
|
3611
|
+
children: [
|
|
3612
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3613
|
+
className: "font-semibold text-foreground",
|
|
3614
|
+
children: [copy.rawStatus, ":"]
|
|
3615
|
+
}),
|
|
3616
|
+
" ",
|
|
3617
|
+
emailResult.receiptRawStatus
|
|
3618
|
+
]
|
|
3619
|
+
}) : null,
|
|
3620
|
+
emailResult.raw ? /* @__PURE__ */ jsx("p", {
|
|
3621
|
+
className: "whitespace-pre-wrap text-xs text-strong",
|
|
3622
|
+
children: emailResult.raw
|
|
3623
|
+
}) : null
|
|
3624
|
+
]
|
|
3625
|
+
}) : null]
|
|
3626
|
+
}),
|
|
3627
|
+
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
3628
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
3454
3629
|
children: [
|
|
3455
|
-
/* @__PURE__ */
|
|
3456
|
-
className: "
|
|
3457
|
-
children: copy.
|
|
3630
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3631
|
+
className: "font-semibold",
|
|
3632
|
+
children: [copy.errorDetails, ":"]
|
|
3458
3633
|
}),
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
children: [
|
|
3462
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3463
|
-
className: "font-semibold text-slate-900",
|
|
3464
|
-
children: [copy.status, ":"]
|
|
3465
|
-
}),
|
|
3466
|
-
" ",
|
|
3467
|
-
emailResult.status
|
|
3468
|
-
]
|
|
3469
|
-
}) : null,
|
|
3470
|
-
emailResult.recipientsCount !== null ? /* @__PURE__ */ jsxs("p", {
|
|
3471
|
-
className: "text-xs text-slate-700",
|
|
3472
|
-
children: [
|
|
3473
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3474
|
-
className: "font-semibold text-slate-900",
|
|
3475
|
-
children: [copy.recipients, ":"]
|
|
3476
|
-
}),
|
|
3477
|
-
" ",
|
|
3478
|
-
emailResult.recipientsCount
|
|
3479
|
-
]
|
|
3480
|
-
}) : null,
|
|
3481
|
-
emailResult.receiptProvider ? /* @__PURE__ */ jsxs("p", {
|
|
3482
|
-
className: "text-xs text-slate-700",
|
|
3483
|
-
children: [
|
|
3484
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3485
|
-
className: "font-semibold text-slate-900",
|
|
3486
|
-
children: [copy.provider, ":"]
|
|
3487
|
-
}),
|
|
3488
|
-
" ",
|
|
3489
|
-
emailResult.receiptProvider
|
|
3490
|
-
]
|
|
3491
|
-
}) : null,
|
|
3492
|
-
emailResult.receiptMessageId ? /* @__PURE__ */ jsxs("p", {
|
|
3493
|
-
className: "break-all text-xs text-slate-700",
|
|
3494
|
-
children: [
|
|
3495
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3496
|
-
className: "font-semibold text-slate-900",
|
|
3497
|
-
children: [copy.messageId, ":"]
|
|
3498
|
-
}),
|
|
3499
|
-
" ",
|
|
3500
|
-
emailResult.receiptMessageId
|
|
3501
|
-
]
|
|
3502
|
-
}) : null,
|
|
3503
|
-
emailResult.receiptRawStatus ? /* @__PURE__ */ jsxs("p", {
|
|
3504
|
-
className: "text-xs text-slate-700",
|
|
3505
|
-
children: [
|
|
3506
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3507
|
-
className: "font-semibold text-slate-900",
|
|
3508
|
-
children: [copy.rawStatus, ":"]
|
|
3509
|
-
}),
|
|
3510
|
-
" ",
|
|
3511
|
-
emailResult.receiptRawStatus
|
|
3512
|
-
]
|
|
3513
|
-
}) : null,
|
|
3514
|
-
emailResult.raw ? /* @__PURE__ */ jsx("p", {
|
|
3515
|
-
className: "whitespace-pre-wrap text-xs text-slate-700",
|
|
3516
|
-
children: emailResult.raw
|
|
3517
|
-
}) : null
|
|
3634
|
+
" ",
|
|
3635
|
+
errorDetails
|
|
3518
3636
|
]
|
|
3519
|
-
}) : null
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
|
|
3523
|
-
children: [
|
|
3524
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3525
|
-
className: "font-semibold",
|
|
3526
|
-
children: [copy.errorDetails, ":"]
|
|
3527
|
-
}),
|
|
3528
|
-
" ",
|
|
3529
|
-
errorDetails
|
|
3530
|
-
]
|
|
3531
|
-
}) : null
|
|
3532
|
-
]
|
|
3637
|
+
}) : null
|
|
3638
|
+
]
|
|
3639
|
+
})]
|
|
3533
3640
|
});
|
|
3534
3641
|
}
|
|
3535
3642
|
|
|
@@ -3604,15 +3711,15 @@ function ToolResultExternalDatasourceCard({ part, className, locale }) {
|
|
|
3604
3711
|
const sqlQuery = toStringOrNull(part.metadata?.sql_query);
|
|
3605
3712
|
const table = normalizeTable(getTableValue(part), copy);
|
|
3606
3713
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
3607
|
-
const statusClass = part.state === "error" ? "text-
|
|
3714
|
+
const statusClass = part.state === "error" ? "text-danger" : part.state === "pending" ? "text-warning" : "text-success";
|
|
3608
3715
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
3609
3716
|
"aria-label": `${copy.externalDatasource}: ${getUiStatusLabel(part.state, copy)}`,
|
|
3610
|
-
className: joinClasses("w-full overflow-hidden rounded-lg border border-
|
|
3717
|
+
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),
|
|
3611
3718
|
children: /* @__PURE__ */ jsxs("span", {
|
|
3612
3719
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
3613
3720
|
children: [
|
|
3614
3721
|
/* @__PURE__ */ jsx(Database, {
|
|
3615
|
-
className: "h-4 w-4 shrink-0 text-
|
|
3722
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
3616
3723
|
"aria-hidden": "true"
|
|
3617
3724
|
}),
|
|
3618
3725
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3648,14 +3755,14 @@ function ToolResultExternalDatasourceCard({ part, className, locale }) {
|
|
|
3648
3755
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
3649
3756
|
className: "flex items-center gap-2",
|
|
3650
3757
|
children: [/* @__PURE__ */ jsx(Database, {
|
|
3651
|
-
className: "h-5 w-5 text-
|
|
3758
|
+
className: "h-5 w-5 text-info",
|
|
3652
3759
|
"aria-hidden": "true"
|
|
3653
3760
|
}), /* @__PURE__ */ jsx("h3", {
|
|
3654
3761
|
className: "text-sm font-medium",
|
|
3655
3762
|
children: copy.sqlQuery
|
|
3656
3763
|
})]
|
|
3657
3764
|
}), /* @__PURE__ */ jsx("pre", {
|
|
3658
|
-
className: "overflow-x-auto rounded-md border border-
|
|
3765
|
+
className: "overflow-x-auto rounded-md border border-border bg-surface-muted p-3 text-xs leading-5 text-strong",
|
|
3659
3766
|
children: sqlQuery
|
|
3660
3767
|
})]
|
|
3661
3768
|
}) : null,
|
|
@@ -3665,22 +3772,22 @@ function ToolResultExternalDatasourceCard({ part, className, locale }) {
|
|
|
3665
3772
|
className: "text-sm font-medium",
|
|
3666
3773
|
children: copy.queryResults
|
|
3667
3774
|
}), /* @__PURE__ */ jsx("div", {
|
|
3668
|
-
className: "overflow-x-auto rounded-md border border-
|
|
3775
|
+
className: "overflow-x-auto rounded-md border border-border",
|
|
3669
3776
|
children: /* @__PURE__ */ jsxs("table", {
|
|
3670
3777
|
className: "w-full border-collapse text-left text-xs",
|
|
3671
3778
|
children: [/* @__PURE__ */ jsx("thead", {
|
|
3672
|
-
className: "bg-
|
|
3779
|
+
className: "bg-surface-muted text-secondary",
|
|
3673
3780
|
children: /* @__PURE__ */ jsx("tr", { children: table.columns.map((column) => /* @__PURE__ */ jsx("th", {
|
|
3674
|
-
className: "max-w-56 truncate border-b border-
|
|
3781
|
+
className: "max-w-56 truncate border-b border-border px-3 py-2 font-medium",
|
|
3675
3782
|
title: column,
|
|
3676
3783
|
children: column
|
|
3677
3784
|
}, column)) })
|
|
3678
3785
|
}), /* @__PURE__ */ jsx("tbody", { children: table.rows.map((row) => /* @__PURE__ */ jsx("tr", {
|
|
3679
|
-
className: "border-b border-
|
|
3786
|
+
className: "border-b border-divider last:border-0",
|
|
3680
3787
|
children: table.columns.map((column, columnIndex) => {
|
|
3681
3788
|
const value = formatCell(row[columnIndex]);
|
|
3682
3789
|
return /* @__PURE__ */ jsx("td", {
|
|
3683
|
-
className: "max-w-56 truncate px-3 py-2 text-
|
|
3790
|
+
className: "max-w-56 truncate px-3 py-2 text-strong",
|
|
3684
3791
|
title: value,
|
|
3685
3792
|
children: value
|
|
3686
3793
|
}, column);
|
|
@@ -3689,11 +3796,11 @@ function ToolResultExternalDatasourceCard({ part, className, locale }) {
|
|
|
3689
3796
|
})
|
|
3690
3797
|
})]
|
|
3691
3798
|
}) : part.state === "completed" && !errorDetails ? /* @__PURE__ */ jsx("p", {
|
|
3692
|
-
className: "text-sm text-
|
|
3799
|
+
className: "text-sm text-secondary",
|
|
3693
3800
|
children: copy.noDataToDisplay
|
|
3694
3801
|
}) : null,
|
|
3695
3802
|
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
3696
|
-
className: "rounded border border-
|
|
3803
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
3697
3804
|
children: [
|
|
3698
3805
|
/* @__PURE__ */ jsxs("span", {
|
|
3699
3806
|
className: "font-semibold",
|
|
@@ -3729,12 +3836,12 @@ function ToolResultHttpRequestCard({ part, className, locale }) {
|
|
|
3729
3836
|
const status = statusCode ? `${statusCode}${metadata?.status_reason ? ` ${metadata.status_reason}` : ""}` : getUiStatusLabel(part.state, copy);
|
|
3730
3837
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
3731
3838
|
"aria-label": `${copy.httpRequest}: ${status}`,
|
|
3732
|
-
className: joinClasses("w-full rounded-lg border border-
|
|
3839
|
+
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),
|
|
3733
3840
|
children: /* @__PURE__ */ jsxs("span", {
|
|
3734
3841
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
3735
3842
|
children: [
|
|
3736
3843
|
/* @__PURE__ */ jsx(Globe, {
|
|
3737
|
-
className: "h-4 w-4 shrink-0 text-
|
|
3844
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
3738
3845
|
"aria-hidden": "true"
|
|
3739
3846
|
}),
|
|
3740
3847
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3742,11 +3849,11 @@ function ToolResultHttpRequestCard({ part, className, locale }) {
|
|
|
3742
3849
|
children: metadata?.method ?? "HTTP"
|
|
3743
3850
|
}),
|
|
3744
3851
|
/* @__PURE__ */ jsx("span", {
|
|
3745
|
-
className: "min-w-0 truncate text-
|
|
3852
|
+
className: "min-w-0 truncate text-secondary",
|
|
3746
3853
|
children: metadata?.url ?? part.name
|
|
3747
3854
|
}),
|
|
3748
3855
|
/* @__PURE__ */ jsx("span", {
|
|
3749
|
-
className: joinClasses("ml-auto shrink-0", failed ? "text-
|
|
3856
|
+
className: joinClasses("ml-auto shrink-0", failed ? "text-danger" : "text-success"),
|
|
3750
3857
|
children: failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
3751
3858
|
className: "h-4 w-4",
|
|
3752
3859
|
"aria-hidden": "true"
|
|
@@ -3770,25 +3877,25 @@ function ToolResultHttpRequestCard({ part, className, locale }) {
|
|
|
3770
3877
|
className: "grid gap-2 text-sm",
|
|
3771
3878
|
children: [
|
|
3772
3879
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3773
|
-
className: "text-xs text-
|
|
3880
|
+
className: "text-xs text-muted",
|
|
3774
3881
|
children: copy.status
|
|
3775
3882
|
}), /* @__PURE__ */ jsx("dd", { children: status })] }),
|
|
3776
3883
|
metadata?.url ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3777
|
-
className: "text-xs text-
|
|
3884
|
+
className: "text-xs text-muted",
|
|
3778
3885
|
children: copy.requestUrl
|
|
3779
3886
|
}), /* @__PURE__ */ jsx("dd", {
|
|
3780
3887
|
className: "break-all",
|
|
3781
3888
|
children: metadata.url
|
|
3782
3889
|
})] }) : null,
|
|
3783
3890
|
metadata?.response_url && metadata.response_url !== metadata.url ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3784
|
-
className: "text-xs text-
|
|
3891
|
+
className: "text-xs text-muted",
|
|
3785
3892
|
children: copy.responseUrl
|
|
3786
3893
|
}), /* @__PURE__ */ jsx("dd", {
|
|
3787
3894
|
className: "break-all",
|
|
3788
3895
|
children: metadata.response_url
|
|
3789
3896
|
})] }) : null,
|
|
3790
3897
|
metadata?.content_type ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3791
|
-
className: "text-xs text-
|
|
3898
|
+
className: "text-xs text-muted",
|
|
3792
3899
|
children: copy.contentType
|
|
3793
3900
|
}), /* @__PURE__ */ jsx("dd", { children: metadata.content_type })] }) : null
|
|
3794
3901
|
]
|
|
@@ -3797,18 +3904,18 @@ function ToolResultHttpRequestCard({ part, className, locale }) {
|
|
|
3797
3904
|
className: "mb-2 text-sm font-medium",
|
|
3798
3905
|
children: copy.response
|
|
3799
3906
|
}), /* @__PURE__ */ jsx("pre", {
|
|
3800
|
-
className: "overflow-x-auto rounded-md border border-
|
|
3907
|
+
className: "overflow-x-auto rounded-md border border-border bg-surface-muted p-3 text-xs leading-5",
|
|
3801
3908
|
children: response
|
|
3802
3909
|
})] }) : null,
|
|
3803
3910
|
metadata?.response_headers && Object.keys(metadata.response_headers).length ? /* @__PURE__ */ jsxs("details", { children: [/* @__PURE__ */ jsx("summary", {
|
|
3804
3911
|
className: "cursor-pointer text-sm font-medium",
|
|
3805
3912
|
children: copy.responseHeaders
|
|
3806
3913
|
}), /* @__PURE__ */ jsx("pre", {
|
|
3807
|
-
className: "mt-2 overflow-x-auto rounded-md border border-
|
|
3914
|
+
className: "mt-2 overflow-x-auto rounded-md border border-border bg-surface-muted p-3 text-xs",
|
|
3808
3915
|
children: JSON.stringify(metadata.response_headers, null, 2)
|
|
3809
3916
|
})] }) : null,
|
|
3810
3917
|
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
3811
|
-
className: "rounded border border-
|
|
3918
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
3812
3919
|
children: [
|
|
3813
3920
|
/* @__PURE__ */ jsxs("span", {
|
|
3814
3921
|
className: "font-semibold",
|
|
@@ -3844,12 +3951,12 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3844
3951
|
const failed = part.state === "error";
|
|
3845
3952
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
3846
3953
|
"aria-label": `${copy.mcpTool}: ${tool}`,
|
|
3847
|
-
className: joinClasses("w-full rounded-lg border border-
|
|
3954
|
+
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),
|
|
3848
3955
|
children: /* @__PURE__ */ jsxs("span", {
|
|
3849
3956
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
3850
3957
|
children: [
|
|
3851
3958
|
/* @__PURE__ */ jsx(Plug, {
|
|
3852
|
-
className: "h-4 w-4 shrink-0 text-
|
|
3959
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
3853
3960
|
"aria-hidden": "true"
|
|
3854
3961
|
}),
|
|
3855
3962
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3857,11 +3964,11 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3857
3964
|
children: "MCP"
|
|
3858
3965
|
}),
|
|
3859
3966
|
/* @__PURE__ */ jsx("span", {
|
|
3860
|
-
className: "min-w-0 truncate border-
|
|
3967
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
3861
3968
|
children: tool
|
|
3862
3969
|
}),
|
|
3863
3970
|
/* @__PURE__ */ jsx("span", {
|
|
3864
|
-
className: joinClasses("ml-auto shrink-0", failed ? "text-
|
|
3971
|
+
className: joinClasses("ml-auto shrink-0", failed ? "text-danger" : "text-success"),
|
|
3865
3972
|
children: failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
3866
3973
|
className: "h-4 w-4",
|
|
3867
3974
|
"aria-hidden": "true"
|
|
@@ -3884,10 +3991,10 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3884
3991
|
/* @__PURE__ */ jsxs("dl", {
|
|
3885
3992
|
className: "grid gap-2 text-sm",
|
|
3886
3993
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3887
|
-
className: "text-xs text-
|
|
3994
|
+
className: "text-xs text-muted",
|
|
3888
3995
|
children: copy.tool
|
|
3889
3996
|
}), /* @__PURE__ */ jsx("dd", { children: tool })] }), server ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
3890
|
-
className: "text-xs text-
|
|
3997
|
+
className: "text-xs text-muted",
|
|
3891
3998
|
children: copy.server
|
|
3892
3999
|
}), /* @__PURE__ */ jsx("dd", {
|
|
3893
4000
|
className: "break-all",
|
|
@@ -3898,11 +4005,11 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3898
4005
|
className: "mb-2 text-sm font-medium",
|
|
3899
4006
|
children: copy.result
|
|
3900
4007
|
}), /* @__PURE__ */ jsx("pre", {
|
|
3901
|
-
className: "overflow-x-auto rounded-md border border-
|
|
4008
|
+
className: "overflow-x-auto rounded-md border border-border bg-surface-muted p-3 text-xs leading-5",
|
|
3902
4009
|
children: result
|
|
3903
4010
|
})] }) : null,
|
|
3904
4011
|
error ? /* @__PURE__ */ jsxs("p", {
|
|
3905
|
-
className: "rounded border border-
|
|
4012
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
3906
4013
|
children: [
|
|
3907
4014
|
/* @__PURE__ */ jsxs("span", {
|
|
3908
4015
|
className: "font-semibold",
|
|
@@ -3917,6 +4024,83 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3917
4024
|
})] });
|
|
3918
4025
|
}
|
|
3919
4026
|
|
|
4027
|
+
//#endregion
|
|
4028
|
+
//#region src/components/internal/download-file.ts
|
|
4029
|
+
/**
|
|
4030
|
+
* Single entry point for downloading a chat file.
|
|
4031
|
+
*
|
|
4032
|
+
* Fetches the bytes and saves them under the file name, so the browser neither
|
|
4033
|
+
* navigates nor opens a tab. That read needs the file host to allow this origin
|
|
4034
|
+
* (CORS); when it does not, the URL opens in a new tab instead. An HTTP error
|
|
4035
|
+
* (expired, deleted or private object) rejects so the caller can say so.
|
|
4036
|
+
*/
|
|
4037
|
+
async function downloadFile(file) {
|
|
4038
|
+
let response;
|
|
4039
|
+
try {
|
|
4040
|
+
response = await fetch(file.url, { credentials: "omit" });
|
|
4041
|
+
} catch {
|
|
4042
|
+
openInNewTab(file.url);
|
|
4043
|
+
return;
|
|
4044
|
+
}
|
|
4045
|
+
if (!response.ok) throw new Error(`Download failed with status ${response.status}`);
|
|
4046
|
+
saveBlob(await response.blob(), file.name || getFilenameFromUrl(file.url) || "download");
|
|
4047
|
+
}
|
|
4048
|
+
function saveBlob(blob, fileName) {
|
|
4049
|
+
const objectUrl = URL.createObjectURL(blob);
|
|
4050
|
+
const anchor = document.createElement("a");
|
|
4051
|
+
anchor.href = objectUrl;
|
|
4052
|
+
anchor.download = fileName;
|
|
4053
|
+
anchor.rel = "noopener";
|
|
4054
|
+
anchor.style.display = "none";
|
|
4055
|
+
document.body.appendChild(anchor);
|
|
4056
|
+
anchor.click();
|
|
4057
|
+
anchor.remove();
|
|
4058
|
+
window.setTimeout(() => URL.revokeObjectURL(objectUrl), 1e3);
|
|
4059
|
+
}
|
|
4060
|
+
function openInNewTab(url) {
|
|
4061
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
4062
|
+
}
|
|
4063
|
+
|
|
4064
|
+
//#endregion
|
|
4065
|
+
//#region src/components/internal/file-download-button.tsx
|
|
4066
|
+
function FileDownloadButton({ file, label, copy, className }) {
|
|
4067
|
+
const [state, setState] = useState("idle");
|
|
4068
|
+
const isDownloading = state === "downloading";
|
|
4069
|
+
const handleClick = async (event) => {
|
|
4070
|
+
event.stopPropagation();
|
|
4071
|
+
if (isDownloading) return;
|
|
4072
|
+
setState("downloading");
|
|
4073
|
+
try {
|
|
4074
|
+
await downloadFile(file);
|
|
4075
|
+
setState("idle");
|
|
4076
|
+
} catch {
|
|
4077
|
+
setState("error");
|
|
4078
|
+
}
|
|
4079
|
+
};
|
|
4080
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
4081
|
+
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
4082
|
+
children: [state === "error" ? /* @__PURE__ */ jsx("span", {
|
|
4083
|
+
role: "alert",
|
|
4084
|
+
className: "text-xs text-danger",
|
|
4085
|
+
children: copy.downloadFailed
|
|
4086
|
+
}) : null, /* @__PURE__ */ jsx("button", {
|
|
4087
|
+
type: "button",
|
|
4088
|
+
onClick: handleClick,
|
|
4089
|
+
disabled: isDownloading,
|
|
4090
|
+
"aria-label": `${isDownloading ? copy.downloading : copy.download}: ${label}`,
|
|
4091
|
+
title: isDownloading ? copy.downloading : copy.download,
|
|
4092
|
+
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),
|
|
4093
|
+
children: isDownloading ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
4094
|
+
className: "h-4 w-4 animate-spin",
|
|
4095
|
+
"aria-hidden": "true"
|
|
4096
|
+
}) : /* @__PURE__ */ jsx(Download, {
|
|
4097
|
+
className: "h-4 w-4",
|
|
4098
|
+
"aria-hidden": "true"
|
|
4099
|
+
})
|
|
4100
|
+
})]
|
|
4101
|
+
});
|
|
4102
|
+
}
|
|
4103
|
+
|
|
3920
4104
|
//#endregion
|
|
3921
4105
|
//#region src/components/tool-result-office-documents-card.tsx
|
|
3922
4106
|
function getFiles(part) {
|
|
@@ -3924,41 +4108,61 @@ function getFiles(part) {
|
|
|
3924
4108
|
return Array.isArray(files) ? files.filter((file) => Boolean(file) && typeof file === "object" && typeof file.id === "string") : [];
|
|
3925
4109
|
}
|
|
3926
4110
|
function getExtension(file) {
|
|
3927
|
-
|
|
3928
|
-
const extension = name.split(".").pop()?.toLowerCase();
|
|
3929
|
-
if (extension && extension !== name.toLowerCase()) return extension;
|
|
3930
|
-
const mime = file.content_type ?? "";
|
|
3931
|
-
if (mime.includes("pdf")) return "pdf";
|
|
3932
|
-
if (mime.includes("wordprocessingml")) return "docx";
|
|
3933
|
-
if (mime.includes("spreadsheetml")) return "xlsx";
|
|
3934
|
-
if (mime.includes("presentationml")) return "pptx";
|
|
3935
|
-
return null;
|
|
4111
|
+
return getFileExtension(file.name ?? file.pathname, file.content_type);
|
|
3936
4112
|
}
|
|
3937
|
-
function
|
|
3938
|
-
|
|
3939
|
-
if (["doc", "docx"].includes(extension ?? "")) return "text-blue-600";
|
|
3940
|
-
if ([
|
|
3941
|
-
"xls",
|
|
3942
|
-
"xlsx",
|
|
3943
|
-
"csv"
|
|
3944
|
-
].includes(extension ?? "")) return "text-emerald-600";
|
|
3945
|
-
if (["ppt", "pptx"].includes(extension ?? "")) return "text-orange-600";
|
|
3946
|
-
return "text-neutral-500";
|
|
4113
|
+
function getLabel(file) {
|
|
4114
|
+
return file.name ?? file.pathname ?? file.id;
|
|
3947
4115
|
}
|
|
3948
4116
|
function ToolResultOfficeDocumentsCard({ part, className, locale }) {
|
|
3949
4117
|
const copy = getUiCopy(locale);
|
|
3950
4118
|
const files = getFiles(part);
|
|
3951
4119
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
3952
4120
|
const fileLabel = files.length === 1 ? copy.file : copy.files;
|
|
3953
|
-
const statusClass = part.state === "error" ? "text-
|
|
4121
|
+
const statusClass = part.state === "error" ? "text-danger" : part.state === "pending" ? "text-warning" : "text-success";
|
|
4122
|
+
const singleFile = part.state === "completed" && files.length === 1 && !errorDetails ? files[0] : void 0;
|
|
4123
|
+
if (singleFile) {
|
|
4124
|
+
const extension = getExtension(singleFile);
|
|
4125
|
+
const label = getLabel(singleFile);
|
|
4126
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
4127
|
+
"aria-label": `${copy.officeDocuments}: ${label}`,
|
|
4128
|
+
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),
|
|
4129
|
+
children: [
|
|
4130
|
+
/* @__PURE__ */ jsx(File, {
|
|
4131
|
+
className: joinClasses("h-6 w-6 shrink-0", getFileIconClass(extension)),
|
|
4132
|
+
"aria-hidden": "true"
|
|
4133
|
+
}),
|
|
4134
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4135
|
+
className: "min-w-0",
|
|
4136
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
4137
|
+
className: "truncate text-sm font-medium",
|
|
4138
|
+
children: label
|
|
4139
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
4140
|
+
className: "truncate text-[11px] text-muted",
|
|
4141
|
+
children: [copy.officeDocuments, extension ? ` · ${extension.toUpperCase()}` : null]
|
|
4142
|
+
})]
|
|
4143
|
+
}),
|
|
4144
|
+
singleFile.url ? /* @__PURE__ */ jsx(FileDownloadButton, {
|
|
4145
|
+
file: {
|
|
4146
|
+
url: singleFile.url,
|
|
4147
|
+
name: singleFile.name
|
|
4148
|
+
},
|
|
4149
|
+
label,
|
|
4150
|
+
copy
|
|
4151
|
+
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
4152
|
+
className: "ml-auto h-4 w-4 shrink-0 text-success",
|
|
4153
|
+
"aria-hidden": "true"
|
|
4154
|
+
})
|
|
4155
|
+
]
|
|
4156
|
+
});
|
|
4157
|
+
}
|
|
3954
4158
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
3955
4159
|
"aria-label": `${copy.officeDocuments}: ${files.length} ${fileLabel}`,
|
|
3956
|
-
className: joinClasses("w-full overflow-hidden rounded-lg border border-
|
|
4160
|
+
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),
|
|
3957
4161
|
children: /* @__PURE__ */ jsxs("span", {
|
|
3958
4162
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
3959
4163
|
children: [
|
|
3960
4164
|
/* @__PURE__ */ jsx(FileText, {
|
|
3961
|
-
className: "h-4 w-4 shrink-0 text-
|
|
4165
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
3962
4166
|
"aria-hidden": "true"
|
|
3963
4167
|
}),
|
|
3964
4168
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3966,7 +4170,7 @@ function ToolResultOfficeDocumentsCard({ part, className, locale }) {
|
|
|
3966
4170
|
children: copy.officeDocuments
|
|
3967
4171
|
}),
|
|
3968
4172
|
/* @__PURE__ */ jsx("span", {
|
|
3969
|
-
className: "min-w-0 truncate border-
|
|
4173
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
3970
4174
|
children: part.state === "pending" ? copy.pending : `${files.length} ${fileLabel}`
|
|
3971
4175
|
}),
|
|
3972
4176
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -3992,41 +4196,45 @@ function ToolResultOfficeDocumentsCard({ part, className, locale }) {
|
|
|
3992
4196
|
children: [
|
|
3993
4197
|
files.map((file) => {
|
|
3994
4198
|
const extension = getExtension(file);
|
|
3995
|
-
const label = file
|
|
3996
|
-
|
|
3997
|
-
className: "flex items-center gap-3 rounded-lg border border-
|
|
3998
|
-
children: [
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
className: "
|
|
4005
|
-
children:
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4199
|
+
const label = getLabel(file);
|
|
4200
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4201
|
+
className: "flex items-center gap-3 rounded-lg border border-border bg-surface p-3",
|
|
4202
|
+
children: [
|
|
4203
|
+
/* @__PURE__ */ jsx(File, {
|
|
4204
|
+
className: joinClasses("h-8 w-8 shrink-0", getFileIconClass(extension)),
|
|
4205
|
+
"aria-hidden": "true"
|
|
4206
|
+
}),
|
|
4207
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4208
|
+
className: "min-w-0",
|
|
4209
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
4210
|
+
className: "truncate text-sm font-medium",
|
|
4211
|
+
children: label
|
|
4212
|
+
}), extension ? /* @__PURE__ */ jsx("p", {
|
|
4213
|
+
className: "text-[11px] uppercase text-muted",
|
|
4214
|
+
children: extension
|
|
4215
|
+
}) : null]
|
|
4216
|
+
}),
|
|
4217
|
+
file.url ? /* @__PURE__ */ jsx(FileDownloadButton, {
|
|
4218
|
+
file: {
|
|
4219
|
+
url: file.url,
|
|
4220
|
+
name: file.name
|
|
4221
|
+
},
|
|
4222
|
+
label,
|
|
4223
|
+
copy
|
|
4224
|
+
}) : null
|
|
4225
|
+
]
|
|
4011
4226
|
}, file.id);
|
|
4012
|
-
return file.url ? /* @__PURE__ */ jsx("a", {
|
|
4013
|
-
href: file.url,
|
|
4014
|
-
target: "_blank",
|
|
4015
|
-
rel: "noreferrer noopener",
|
|
4016
|
-
className: "block hover:bg-neutral-50",
|
|
4017
|
-
children: content
|
|
4018
|
-
}, file.id) : /* @__PURE__ */ jsx("div", { children: content }, file.id);
|
|
4019
4227
|
}),
|
|
4020
4228
|
files.length === 0 && part.state === "pending" ? /* @__PURE__ */ jsx("p", {
|
|
4021
|
-
className: "text-sm text-
|
|
4229
|
+
className: "text-sm text-secondary",
|
|
4022
4230
|
children: copy.creatingDocuments
|
|
4023
4231
|
}) : null,
|
|
4024
4232
|
files.length === 0 && part.state === "completed" && !errorDetails ? /* @__PURE__ */ jsx("p", {
|
|
4025
|
-
className: "text-sm text-
|
|
4233
|
+
className: "text-sm text-secondary",
|
|
4026
4234
|
children: copy.noFilesGenerated
|
|
4027
4235
|
}) : null,
|
|
4028
4236
|
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
4029
|
-
className: "rounded border border-
|
|
4237
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
4030
4238
|
children: [
|
|
4031
4239
|
/* @__PURE__ */ jsxs("span", {
|
|
4032
4240
|
className: "font-semibold",
|
|
@@ -4820,11 +5028,11 @@ function statusLabel(status, copy) {
|
|
|
4820
5028
|
return key ? copy[key] : null;
|
|
4821
5029
|
}
|
|
4822
5030
|
const BADGE_TONE = {
|
|
4823
|
-
pending: "border-
|
|
5031
|
+
pending: "border-warning-border bg-warning-subtle text-warning-strong",
|
|
4824
5032
|
executing: "border-sky-200 bg-sky-50 text-sky-800",
|
|
4825
|
-
executed: "border-
|
|
4826
|
-
failed: "border-
|
|
4827
|
-
unknown: "border-
|
|
5033
|
+
executed: "border-success-border bg-success-subtle text-success-strong",
|
|
5034
|
+
failed: "border-danger-border bg-danger-subtle text-danger-strong",
|
|
5035
|
+
unknown: "border-warning-border bg-warning-subtle text-warning-strong"
|
|
4828
5036
|
};
|
|
4829
5037
|
/** Header badge of a held action: "Awaiting your confirmation" or its outcome. */
|
|
4830
5038
|
function ConfirmationBadge({ state, copy }) {
|
|
@@ -4832,7 +5040,7 @@ function ConfirmationBadge({ state, copy }) {
|
|
|
4832
5040
|
const label = status === "pending" ? copy.awaitingConfirmation : statusLabel(status, copy);
|
|
4833
5041
|
const Icon = status === "executed" ? CheckCircle2 : status === "failed" ? XCircle : status === "executing" ? LoaderCircle : Clock;
|
|
4834
5042
|
return /* @__PURE__ */ jsxs("span", {
|
|
4835
|
-
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-
|
|
5043
|
+
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"),
|
|
4836
5044
|
"data-confirmation-status": status,
|
|
4837
5045
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
4838
5046
|
className: joinClasses("h-3 w-3", status === "executing" ? "animate-spin" : void 0),
|
|
@@ -4856,18 +5064,18 @@ function PendingConfirmationFooter({ pending, toolConfirmation, copy }) {
|
|
|
4856
5064
|
const [sending, setSending] = useState(null);
|
|
4857
5065
|
const [failed, setFailed] = useState(false);
|
|
4858
5066
|
if (!toolConfirmation) return /* @__PURE__ */ jsx("p", {
|
|
4859
|
-
className: "border-t border-
|
|
5067
|
+
className: "border-t border-border bg-warning-subtle/60 px-3 py-2 text-xs text-strong",
|
|
4860
5068
|
children: copy.confirmHint
|
|
4861
5069
|
});
|
|
4862
5070
|
if (!state) return /* @__PURE__ */ jsx("p", {
|
|
4863
|
-
className: "border-t border-
|
|
5071
|
+
className: "border-t border-divider bg-surface-muted px-3 py-2 text-xs text-muted",
|
|
4864
5072
|
"aria-live": "polite",
|
|
4865
5073
|
children: copy.verifying
|
|
4866
5074
|
});
|
|
4867
5075
|
if (state.status !== "pending") {
|
|
4868
5076
|
const label = statusLabel(state.status, copy);
|
|
4869
5077
|
return label ? /* @__PURE__ */ jsxs("p", {
|
|
4870
|
-
className: "border-t border-
|
|
5078
|
+
className: "border-t border-divider bg-surface-muted px-3 py-2 text-xs text-strong",
|
|
4871
5079
|
"aria-live": "polite",
|
|
4872
5080
|
children: [label, state.status === "failed" && state.error ? `: ${state.error}` : null]
|
|
4873
5081
|
}) : null;
|
|
@@ -4891,14 +5099,14 @@ function PendingConfirmationFooter({ pending, toolConfirmation, copy }) {
|
|
|
4891
5099
|
const expiry = expiryText(state, toolConfirmation.states.serverOffsetMs, now, copy);
|
|
4892
5100
|
const unavailable = state.error === "tool_unavailable";
|
|
4893
5101
|
return /* @__PURE__ */ jsxs("div", {
|
|
4894
|
-
className: "flex flex-wrap items-center gap-2 border-t border-
|
|
5102
|
+
className: "flex flex-wrap items-center gap-2 border-t border-border bg-warning-subtle/60 px-3 py-2",
|
|
4895
5103
|
"data-confirmation-actions": pending.action_id,
|
|
4896
5104
|
children: [
|
|
4897
5105
|
state.canConfirm ? /* @__PURE__ */ jsxs("button", {
|
|
4898
5106
|
type: "button",
|
|
4899
5107
|
disabled,
|
|
4900
5108
|
onClick: () => void decide("confirm"),
|
|
4901
|
-
className: joinClasses("inline-flex items-center rounded-md px-3 py-1.5 text-xs font-medium text-
|
|
5109
|
+
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"),
|
|
4902
5110
|
children: [sending === "confirm" ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
4903
5111
|
className: "mr-2 size-3 animate-spin",
|
|
4904
5112
|
"aria-hidden": "true"
|
|
@@ -4908,14 +5116,14 @@ function PendingConfirmationFooter({ pending, toolConfirmation, copy }) {
|
|
|
4908
5116
|
type: "button",
|
|
4909
5117
|
disabled,
|
|
4910
5118
|
onClick: () => void decide("reject"),
|
|
4911
|
-
className: "inline-flex items-center rounded-md border border-
|
|
5119
|
+
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",
|
|
4912
5120
|
children: [sending === "reject" ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
4913
5121
|
className: "mr-2 size-3 animate-spin",
|
|
4914
5122
|
"aria-hidden": "true"
|
|
4915
5123
|
}) : null, sending === "reject" ? copy.cancelling : copy.cancel]
|
|
4916
5124
|
}) : null,
|
|
4917
5125
|
/* @__PURE__ */ jsx("span", {
|
|
4918
|
-
className: "ml-auto text-xs text-
|
|
5126
|
+
className: "ml-auto text-xs text-secondary",
|
|
4919
5127
|
"aria-live": "polite",
|
|
4920
5128
|
children: failed ? copy.decisionError : unavailable ? copy.toolUnavailable : expiry
|
|
4921
5129
|
})
|
|
@@ -5050,7 +5258,7 @@ function ExternalAnchor({ href, className, children, label }) {
|
|
|
5050
5258
|
target: "_blank",
|
|
5051
5259
|
rel: "noreferrer noopener",
|
|
5052
5260
|
"aria-label": label,
|
|
5053
|
-
className: joinClasses("inline-flex items-center gap-1 text-xs font-medium text-
|
|
5261
|
+
className: joinClasses("inline-flex items-center gap-1 text-xs font-medium text-strong hover:text-muted", className),
|
|
5054
5262
|
children
|
|
5055
5263
|
});
|
|
5056
5264
|
}
|
|
@@ -5059,7 +5267,7 @@ function ShowAllToggle({ total, expanded, onToggle, copy }) {
|
|
|
5059
5267
|
return /* @__PURE__ */ jsx("button", {
|
|
5060
5268
|
type: "button",
|
|
5061
5269
|
onClick: onToggle,
|
|
5062
|
-
className: "w-full border-t border-
|
|
5270
|
+
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",
|
|
5063
5271
|
children: expanded ? copy.showLess : fillCopy(copy.showAll, { count: total })
|
|
5064
5272
|
});
|
|
5065
5273
|
}
|
|
@@ -5070,24 +5278,24 @@ function MailRow({ message, locale, copy }) {
|
|
|
5070
5278
|
children: [
|
|
5071
5279
|
/* @__PURE__ */ jsx("span", {
|
|
5072
5280
|
"aria-label": message.unread ? copy.unread : void 0,
|
|
5073
|
-
className: joinClasses("h-2 w-2 shrink-0 self-center rounded-full", message.unread ? "bg-
|
|
5281
|
+
className: joinClasses("h-2 w-2 shrink-0 self-center rounded-full", message.unread ? "bg-info" : "bg-transparent")
|
|
5074
5282
|
}),
|
|
5075
5283
|
/* @__PURE__ */ jsx("span", {
|
|
5076
|
-
className: joinClasses("min-w-0 flex-1 truncate text-sm", message.unread ? "font-semibold text-
|
|
5284
|
+
className: joinClasses("min-w-0 flex-1 truncate text-sm", message.unread ? "font-semibold text-foreground" : "text-strong"),
|
|
5077
5285
|
children: displayName(message.from) ?? "—"
|
|
5078
5286
|
}),
|
|
5079
5287
|
/* @__PURE__ */ jsx("span", {
|
|
5080
|
-
className: "shrink-0 text-xs text-
|
|
5288
|
+
className: "shrink-0 text-xs text-muted",
|
|
5081
5289
|
children: formatMailDate(message.date, locale)
|
|
5082
5290
|
})
|
|
5083
5291
|
]
|
|
5084
5292
|
}),
|
|
5085
5293
|
/* @__PURE__ */ jsx("p", {
|
|
5086
|
-
className: joinClasses("truncate pl-4 text-sm", message.unread ? "font-medium text-
|
|
5294
|
+
className: joinClasses("truncate pl-4 text-sm", message.unread ? "font-medium text-foreground" : "text-strong"),
|
|
5087
5295
|
children: text(message.subject) ?? copy.noSubject
|
|
5088
5296
|
}),
|
|
5089
5297
|
text(message.snippet) ? /* @__PURE__ */ jsx("p", {
|
|
5090
|
-
className: "line-clamp-1 pl-4 text-xs text-
|
|
5298
|
+
className: "line-clamp-1 pl-4 text-xs text-muted",
|
|
5091
5299
|
children: message.snippet
|
|
5092
5300
|
}) : null
|
|
5093
5301
|
] });
|
|
@@ -5096,7 +5304,7 @@ function MailRow({ message, locale, copy }) {
|
|
|
5096
5304
|
href: message.link,
|
|
5097
5305
|
target: "_blank",
|
|
5098
5306
|
rel: "noreferrer noopener",
|
|
5099
|
-
className: joinClasses(className, "hover:bg-
|
|
5307
|
+
className: joinClasses(className, "hover:bg-surface-muted"),
|
|
5100
5308
|
children: content
|
|
5101
5309
|
}) : /* @__PURE__ */ jsx("div", {
|
|
5102
5310
|
className,
|
|
@@ -5106,11 +5314,11 @@ function MailRow({ message, locale, copy }) {
|
|
|
5106
5314
|
function MailList({ messages, locale, copy }) {
|
|
5107
5315
|
const [expanded, setExpanded] = useState(false);
|
|
5108
5316
|
if (messages.length === 0) return /* @__PURE__ */ jsx("p", {
|
|
5109
|
-
className: "px-3 py-3 text-sm text-
|
|
5317
|
+
className: "px-3 py-3 text-sm text-secondary",
|
|
5110
5318
|
children: copy.noEmails
|
|
5111
5319
|
});
|
|
5112
5320
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("ul", {
|
|
5113
|
-
className: "divide-y divide-
|
|
5321
|
+
className: "divide-y divide-divider",
|
|
5114
5322
|
children: (expanded ? messages : messages.slice(0, COLLAPSED_ITEMS)).map((message) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(MailRow, {
|
|
5115
5323
|
message,
|
|
5116
5324
|
locale,
|
|
@@ -5135,13 +5343,13 @@ function MailMessageView({ message, connector, locale, copy }) {
|
|
|
5135
5343
|
className: "space-y-1",
|
|
5136
5344
|
children: [
|
|
5137
5345
|
/* @__PURE__ */ jsx("h4", {
|
|
5138
|
-
className: "text-sm font-semibold text-
|
|
5346
|
+
className: "text-sm font-semibold text-foreground",
|
|
5139
5347
|
children: text(message.subject) ?? copy.noSubject
|
|
5140
5348
|
}),
|
|
5141
5349
|
/* @__PURE__ */ jsxs("div", {
|
|
5142
|
-
className: "flex items-baseline gap-2 text-xs text-
|
|
5350
|
+
className: "flex items-baseline gap-2 text-xs text-secondary",
|
|
5143
5351
|
children: [/* @__PURE__ */ jsx("span", {
|
|
5144
|
-
className: "min-w-0 flex-1 truncate font-medium text-
|
|
5352
|
+
className: "min-w-0 flex-1 truncate font-medium text-strong",
|
|
5145
5353
|
children: message.from ?? "—"
|
|
5146
5354
|
}), /* @__PURE__ */ jsx("span", {
|
|
5147
5355
|
className: "shrink-0",
|
|
@@ -5149,7 +5357,7 @@ function MailMessageView({ message, connector, locale, copy }) {
|
|
|
5149
5357
|
})]
|
|
5150
5358
|
}),
|
|
5151
5359
|
text(message.to) ? /* @__PURE__ */ jsxs("p", {
|
|
5152
|
-
className: "truncate text-xs text-
|
|
5360
|
+
className: "truncate text-xs text-muted",
|
|
5153
5361
|
children: [
|
|
5154
5362
|
copy.to,
|
|
5155
5363
|
": ",
|
|
@@ -5157,7 +5365,7 @@ function MailMessageView({ message, connector, locale, copy }) {
|
|
|
5157
5365
|
]
|
|
5158
5366
|
}) : null,
|
|
5159
5367
|
text(message.cc) ? /* @__PURE__ */ jsxs("p", {
|
|
5160
|
-
className: "truncate text-xs text-
|
|
5368
|
+
className: "truncate text-xs text-muted",
|
|
5161
5369
|
children: [
|
|
5162
5370
|
copy.cc,
|
|
5163
5371
|
": ",
|
|
@@ -5167,7 +5375,7 @@ function MailMessageView({ message, connector, locale, copy }) {
|
|
|
5167
5375
|
]
|
|
5168
5376
|
}),
|
|
5169
5377
|
shownBody ? /* @__PURE__ */ jsx("p", {
|
|
5170
|
-
className: "whitespace-pre-wrap break-words text-sm leading-6 text-
|
|
5378
|
+
className: "whitespace-pre-wrap break-words text-sm leading-6 text-strong",
|
|
5171
5379
|
children: shownBody
|
|
5172
5380
|
}) : null,
|
|
5173
5381
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -5175,11 +5383,11 @@ function MailMessageView({ message, connector, locale, copy }) {
|
|
|
5175
5383
|
children: [long ? /* @__PURE__ */ jsx("button", {
|
|
5176
5384
|
type: "button",
|
|
5177
5385
|
onClick: () => setExpanded((value) => !value),
|
|
5178
|
-
className: "text-xs font-medium text-
|
|
5386
|
+
className: "text-xs font-medium text-secondary hover:text-foreground",
|
|
5179
5387
|
children: expanded ? copy.showLess : copy.showMore
|
|
5180
5388
|
}) : null, message.link ? /* @__PURE__ */ jsxs(ExternalAnchor, {
|
|
5181
5389
|
href: message.link,
|
|
5182
|
-
children: [fillCopy(copy.openIn, { service: connector?.label ?? "" }), /* @__PURE__ */ jsx(
|
|
5390
|
+
children: [fillCopy(copy.openIn, { service: connector?.label ?? "" }), /* @__PURE__ */ jsx(ArrowUpRight, {
|
|
5183
5391
|
className: "h-3 w-3",
|
|
5184
5392
|
"aria-hidden": "true"
|
|
5185
5393
|
})]
|
|
@@ -5219,7 +5427,7 @@ function EventRow({ event, locale, copy }) {
|
|
|
5219
5427
|
className: "flex gap-3 px-3 py-2",
|
|
5220
5428
|
children: [
|
|
5221
5429
|
/* @__PURE__ */ jsx("span", {
|
|
5222
|
-
className: "w-24 shrink-0 pt-0.5 text-xs tabular-nums text-
|
|
5430
|
+
className: "w-24 shrink-0 pt-0.5 text-xs tabular-nums text-secondary",
|
|
5223
5431
|
children: eventTime(event, locale, copy)
|
|
5224
5432
|
}),
|
|
5225
5433
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -5228,13 +5436,13 @@ function EventRow({ event, locale, copy }) {
|
|
|
5228
5436
|
href: event.link,
|
|
5229
5437
|
target: "_blank",
|
|
5230
5438
|
rel: "noreferrer noopener",
|
|
5231
|
-
className: "block truncate text-sm font-medium text-
|
|
5439
|
+
className: "block truncate text-sm font-medium text-foreground hover:underline",
|
|
5232
5440
|
children: text(event.title) ?? copy.noSubject
|
|
5233
5441
|
}) : /* @__PURE__ */ jsx("p", {
|
|
5234
|
-
className: "truncate text-sm font-medium text-
|
|
5442
|
+
className: "truncate text-sm font-medium text-foreground",
|
|
5235
5443
|
children: text(event.title) ?? copy.noSubject
|
|
5236
5444
|
}), details.length > 0 ? /* @__PURE__ */ jsx("p", {
|
|
5237
|
-
className: "truncate text-xs text-
|
|
5445
|
+
className: "truncate text-xs text-muted",
|
|
5238
5446
|
children: details.join(" · ")
|
|
5239
5447
|
}) : null]
|
|
5240
5448
|
}),
|
|
@@ -5252,7 +5460,7 @@ function EventRow({ event, locale, copy }) {
|
|
|
5252
5460
|
function Agenda({ events, locale, copy }) {
|
|
5253
5461
|
const [expanded, setExpanded] = useState(false);
|
|
5254
5462
|
if (events.length === 0) return /* @__PURE__ */ jsx("p", {
|
|
5255
|
-
className: "px-3 py-3 text-sm text-
|
|
5463
|
+
className: "px-3 py-3 text-sm text-secondary",
|
|
5256
5464
|
children: copy.noEvents
|
|
5257
5465
|
});
|
|
5258
5466
|
const visible = expanded ? events : events.slice(0, COLLAPSED_ITEMS);
|
|
@@ -5262,12 +5470,12 @@ function Agenda({ events, locale, copy }) {
|
|
|
5262
5470
|
month: "long"
|
|
5263
5471
|
});
|
|
5264
5472
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
5265
|
-
className: "divide-y divide-
|
|
5473
|
+
className: "divide-y divide-divider",
|
|
5266
5474
|
children: groupByDay(visible).map((group, index) => /* @__PURE__ */ jsxs("section", { children: [group.day ? /* @__PURE__ */ jsx("h4", {
|
|
5267
|
-
className: "bg-
|
|
5475
|
+
className: "bg-surface-muted px-3 py-1 text-xs font-medium capitalize text-secondary",
|
|
5268
5476
|
children: dayFormat.format(group.day)
|
|
5269
5477
|
}) : null, /* @__PURE__ */ jsx("ul", {
|
|
5270
|
-
className: "divide-y divide-
|
|
5478
|
+
className: "divide-y divide-divider",
|
|
5271
5479
|
children: group.events.map((event) => /* @__PURE__ */ jsx(EventRow, {
|
|
5272
5480
|
event,
|
|
5273
5481
|
locale,
|
|
@@ -5288,12 +5496,12 @@ function CollapsibleBody({ body, copy }) {
|
|
|
5288
5496
|
return /* @__PURE__ */ jsxs("div", {
|
|
5289
5497
|
className: "space-y-1",
|
|
5290
5498
|
children: [/* @__PURE__ */ jsx("p", {
|
|
5291
|
-
className: "whitespace-pre-wrap break-words text-sm leading-6 text-
|
|
5499
|
+
className: "whitespace-pre-wrap break-words text-sm leading-6 text-strong",
|
|
5292
5500
|
children: long && !expanded ? `${body.slice(0, COLLAPSED_BODY_CHARS).trimEnd()}…` : body
|
|
5293
5501
|
}), long ? /* @__PURE__ */ jsx("button", {
|
|
5294
5502
|
type: "button",
|
|
5295
5503
|
onClick: () => setExpanded((value) => !value),
|
|
5296
|
-
className: "text-xs font-medium text-
|
|
5504
|
+
className: "text-xs font-medium text-secondary hover:text-foreground",
|
|
5297
5505
|
children: expanded ? copy.showLess : copy.showMore
|
|
5298
5506
|
}) : null]
|
|
5299
5507
|
});
|
|
@@ -5306,15 +5514,15 @@ function DraftView({ view, copy }) {
|
|
|
5306
5514
|
className: "space-y-1",
|
|
5307
5515
|
children: [
|
|
5308
5516
|
/* @__PURE__ */ jsx("p", {
|
|
5309
|
-
className: "text-sm font-medium text-
|
|
5517
|
+
className: "text-sm font-medium text-foreground",
|
|
5310
5518
|
children: copy.draftSaved
|
|
5311
5519
|
}),
|
|
5312
5520
|
view.subject ? /* @__PURE__ */ jsx("p", {
|
|
5313
|
-
className: "truncate text-sm text-
|
|
5521
|
+
className: "truncate text-sm text-strong",
|
|
5314
5522
|
children: view.subject
|
|
5315
5523
|
}) : null,
|
|
5316
5524
|
view.to.length > 0 ? /* @__PURE__ */ jsxs("p", {
|
|
5317
|
-
className: "truncate text-xs text-
|
|
5525
|
+
className: "truncate text-xs text-muted",
|
|
5318
5526
|
children: [
|
|
5319
5527
|
copy.to,
|
|
5320
5528
|
": ",
|
|
@@ -5329,7 +5537,7 @@ function DraftView({ view, copy }) {
|
|
|
5329
5537
|
}),
|
|
5330
5538
|
view.link ? /* @__PURE__ */ jsxs(ExternalAnchor, {
|
|
5331
5539
|
href: view.link,
|
|
5332
|
-
children: [copy.openDraft, /* @__PURE__ */ jsx(
|
|
5540
|
+
children: [copy.openDraft, /* @__PURE__ */ jsx(ArrowUpRight, {
|
|
5333
5541
|
className: "h-3 w-3",
|
|
5334
5542
|
"aria-hidden": "true"
|
|
5335
5543
|
})]
|
|
@@ -5344,10 +5552,10 @@ function Field({ label, children }) {
|
|
|
5344
5552
|
return /* @__PURE__ */ jsxs("div", {
|
|
5345
5553
|
className: "flex gap-3 text-sm",
|
|
5346
5554
|
children: [/* @__PURE__ */ jsx("dt", {
|
|
5347
|
-
className: "w-24 shrink-0 text-xs leading-5 text-
|
|
5555
|
+
className: "w-24 shrink-0 text-xs leading-5 text-muted",
|
|
5348
5556
|
children: label
|
|
5349
5557
|
}), /* @__PURE__ */ jsx("dd", {
|
|
5350
|
-
className: "min-w-0 flex-1 break-words text-
|
|
5558
|
+
className: "min-w-0 flex-1 break-words text-foreground",
|
|
5351
5559
|
children
|
|
5352
5560
|
})]
|
|
5353
5561
|
});
|
|
@@ -5380,11 +5588,11 @@ function PendingMailView({ pending, copy }) {
|
|
|
5380
5588
|
]
|
|
5381
5589
|
}),
|
|
5382
5590
|
text(mail.reply_to_message_id) ? /* @__PURE__ */ jsx("p", {
|
|
5383
|
-
className: "text-xs text-
|
|
5591
|
+
className: "text-xs text-muted",
|
|
5384
5592
|
children: copy.replyInThread
|
|
5385
5593
|
}) : null,
|
|
5386
5594
|
/* @__PURE__ */ jsx("div", {
|
|
5387
|
-
className: "rounded-md border border-
|
|
5595
|
+
className: "rounded-md border border-border bg-surface-muted px-3 py-2",
|
|
5388
5596
|
children: /* @__PURE__ */ jsx(CollapsibleBody, {
|
|
5389
5597
|
body: text(mail.body),
|
|
5390
5598
|
copy
|
|
@@ -5416,7 +5624,7 @@ function Change({ before, after }) {
|
|
|
5416
5624
|
className: "flex flex-wrap items-baseline gap-x-2",
|
|
5417
5625
|
children: [
|
|
5418
5626
|
/* @__PURE__ */ jsx("span", {
|
|
5419
|
-
className: "text-
|
|
5627
|
+
className: "text-muted line-through",
|
|
5420
5628
|
children: before
|
|
5421
5629
|
}),
|
|
5422
5630
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -5435,19 +5643,19 @@ function PendingEventView({ operation, pending, locale, copy }) {
|
|
|
5435
5643
|
className: "space-y-1 px-3 py-3",
|
|
5436
5644
|
children: [
|
|
5437
5645
|
/* @__PURE__ */ jsx("p", {
|
|
5438
|
-
className: "text-xs font-medium
|
|
5646
|
+
className: "text-xs font-medium capitalize tracking-wide text-danger-strong",
|
|
5439
5647
|
children: copy.deleteEvent
|
|
5440
5648
|
}),
|
|
5441
5649
|
/* @__PURE__ */ jsx("p", {
|
|
5442
|
-
className: "text-sm font-medium text-
|
|
5650
|
+
className: "text-sm font-medium text-foreground line-through",
|
|
5443
5651
|
children: text(current?.title) ?? text(action.event_id) ?? copy.noSubject
|
|
5444
5652
|
}),
|
|
5445
5653
|
current ? /* @__PURE__ */ jsx("p", {
|
|
5446
|
-
className: "text-xs text-
|
|
5654
|
+
className: "text-xs text-muted",
|
|
5447
5655
|
children: formatRange(current.start, current.end, Boolean(current.all_day), locale, copy)
|
|
5448
5656
|
}) : null,
|
|
5449
5657
|
(current?.attendees?.length ?? 0) > 0 ? /* @__PURE__ */ jsx("p", {
|
|
5450
|
-
className: "pt-1 text-xs text-
|
|
5658
|
+
className: "pt-1 text-xs text-secondary",
|
|
5451
5659
|
children: copy.attendeesNotified
|
|
5452
5660
|
}) : null
|
|
5453
5661
|
]
|
|
@@ -5462,7 +5670,7 @@ function PendingEventView({ operation, pending, locale, copy }) {
|
|
|
5462
5670
|
className: "space-y-2 px-3 py-3",
|
|
5463
5671
|
children: [
|
|
5464
5672
|
/* @__PURE__ */ jsx("p", {
|
|
5465
|
-
className: "text-xs font-medium
|
|
5673
|
+
className: "text-xs font-medium capitalize tracking-wide text-muted",
|
|
5466
5674
|
children: isUpdate ? copy.eventChange : copy.newEvent
|
|
5467
5675
|
}),
|
|
5468
5676
|
/* @__PURE__ */ jsxs("dl", {
|
|
@@ -5515,7 +5723,7 @@ function PendingEventView({ operation, pending, locale, copy }) {
|
|
|
5515
5723
|
]
|
|
5516
5724
|
}),
|
|
5517
5725
|
attendees.length > 0 ? /* @__PURE__ */ jsx("p", {
|
|
5518
|
-
className: "text-xs text-
|
|
5726
|
+
className: "text-xs text-secondary",
|
|
5519
5727
|
children: copy.attendeesNotified
|
|
5520
5728
|
}) : null
|
|
5521
5729
|
]
|
|
@@ -5537,24 +5745,24 @@ function ToolResultPersonalConnectorCard({ part, locale, className, toolConfirma
|
|
|
5537
5745
|
const total = headerCount(view, copy);
|
|
5538
5746
|
const isPending = view.kind === "pending-mail" || view.kind === "pending-event";
|
|
5539
5747
|
return /* @__PURE__ */ jsxs("section", {
|
|
5540
|
-
className: joinClasses("plai-tool-result-personal-connector-card overflow-hidden rounded-lg border border-
|
|
5748
|
+
className: joinClasses("plai-tool-result-personal-connector-card overflow-hidden rounded-lg border border-border bg-surface text-foreground", className),
|
|
5541
5749
|
"data-tool-call-id": part.id,
|
|
5542
5750
|
"data-tool-call-state": part.state,
|
|
5543
5751
|
"data-connector-action": view.kind,
|
|
5544
5752
|
children: [
|
|
5545
5753
|
/* @__PURE__ */ jsxs("header", {
|
|
5546
|
-
className: "flex items-center gap-2 border-b border-
|
|
5754
|
+
className: "flex items-center gap-2 border-b border-border px-3 py-2 text-xs text-secondary",
|
|
5547
5755
|
children: [
|
|
5548
5756
|
/* @__PURE__ */ jsx(Icon, {
|
|
5549
|
-
className: "h-4 w-4 shrink-0 text-
|
|
5757
|
+
className: "h-4 w-4 shrink-0 text-strong",
|
|
5550
5758
|
"aria-hidden": "true"
|
|
5551
5759
|
}),
|
|
5552
5760
|
/* @__PURE__ */ jsx("span", {
|
|
5553
|
-
className: "shrink-0 font-medium text-
|
|
5761
|
+
className: "shrink-0 font-medium text-foreground",
|
|
5554
5762
|
children: connector?.label
|
|
5555
5763
|
}),
|
|
5556
5764
|
connector?.account_email ? /* @__PURE__ */ jsx("span", {
|
|
5557
|
-
className: "min-w-0 truncate border-
|
|
5765
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
5558
5766
|
children: connector.account_email
|
|
5559
5767
|
}) : null,
|
|
5560
5768
|
isPending ? /* @__PURE__ */ jsx(ConfirmationBadge, {
|
|
@@ -5629,39 +5837,42 @@ function ConfirmedActionRow({ action, copy }) {
|
|
|
5629
5837
|
"data-confirmation-status": action.status,
|
|
5630
5838
|
children: [
|
|
5631
5839
|
failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
5632
|
-
className: "mt-0.5 h-4 w-4 shrink-0 text-
|
|
5840
|
+
className: "mt-0.5 h-4 w-4 shrink-0 text-danger",
|
|
5633
5841
|
"aria-hidden": "true"
|
|
5634
5842
|
}) : executed ? /* @__PURE__ */ jsx(CheckCircle2, {
|
|
5635
|
-
className: "mt-0.5 h-4 w-4 shrink-0 text-
|
|
5843
|
+
className: "mt-0.5 h-4 w-4 shrink-0 text-success",
|
|
5636
5844
|
"aria-hidden": "true"
|
|
5637
5845
|
}) : /* @__PURE__ */ jsx(Clock, {
|
|
5638
|
-
className: "mt-0.5 h-4 w-4 shrink-0 text-
|
|
5846
|
+
className: "mt-0.5 h-4 w-4 shrink-0 text-muted",
|
|
5639
5847
|
"aria-hidden": "true"
|
|
5640
5848
|
}),
|
|
5641
5849
|
/* @__PURE__ */ jsxs("div", {
|
|
5642
5850
|
className: "min-w-0 flex-1 space-y-0.5",
|
|
5643
5851
|
children: [
|
|
5644
5852
|
/* @__PURE__ */ jsx("p", {
|
|
5645
|
-
className: "text-sm font-medium text-
|
|
5853
|
+
className: "text-sm font-medium text-foreground",
|
|
5646
5854
|
children: title
|
|
5647
5855
|
}),
|
|
5648
5856
|
connector ? /* @__PURE__ */ jsxs("div", {
|
|
5649
|
-
className: "flex items-center gap-2 truncate text-xs text-
|
|
5857
|
+
className: "flex items-center gap-2 truncate text-xs text-muted",
|
|
5650
5858
|
children: [connector.label, connector.account_email ? /* @__PURE__ */ jsx("span", {
|
|
5651
|
-
className: "min-w-0 truncate border-
|
|
5859
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
5652
5860
|
children: connector.account_email
|
|
5653
5861
|
}) : null]
|
|
5654
5862
|
}) : null,
|
|
5655
5863
|
failed && text(action.error) ? /* @__PURE__ */ jsx("p", {
|
|
5656
|
-
className: "line-clamp-2 text-xs text-
|
|
5864
|
+
className: "line-clamp-2 text-xs text-danger-strong",
|
|
5657
5865
|
children: action.error
|
|
5658
5866
|
}) : null
|
|
5659
5867
|
]
|
|
5660
5868
|
}),
|
|
5661
|
-
executed && link ? /* @__PURE__ */
|
|
5869
|
+
executed && link ? /* @__PURE__ */ jsxs(ExternalAnchor, {
|
|
5662
5870
|
href: link,
|
|
5663
5871
|
className: "shrink-0",
|
|
5664
|
-
children: operation === "send" ? copy.openEmail : copy.openEvent
|
|
5872
|
+
children: [operation === "send" ? copy.openEmail : copy.openEvent, /* @__PURE__ */ jsx(ArrowUpRight, {
|
|
5873
|
+
className: "h-3 w-3",
|
|
5874
|
+
"aria-hidden": "true"
|
|
5875
|
+
})]
|
|
5665
5876
|
}) : null
|
|
5666
5877
|
]
|
|
5667
5878
|
});
|
|
@@ -5671,7 +5882,7 @@ function ToolResultToolConfirmationCard({ part, locale, className }) {
|
|
|
5671
5882
|
if (actions.length === 0) return null;
|
|
5672
5883
|
const copy = getPersonalConnectorCopy(locale);
|
|
5673
5884
|
return /* @__PURE__ */ jsx("ul", {
|
|
5674
|
-
className: joinClasses("plai-tool-result-tool-confirmation-card divide-y divide-
|
|
5885
|
+
className: joinClasses("plai-tool-result-tool-confirmation-card divide-y divide-divider overflow-hidden rounded-lg border border-border bg-surface text-foreground", className),
|
|
5675
5886
|
"data-tool-call-id": part.id,
|
|
5676
5887
|
"data-tool-call-state": part.state,
|
|
5677
5888
|
children: actions.map((action) => /* @__PURE__ */ jsx(ConfirmedActionRow, {
|
|
@@ -5696,14 +5907,14 @@ function ToolResultPendingConfirmationCard({ part, locale, className, toolConfir
|
|
|
5696
5907
|
const copy = getPersonalConnectorCopy(locale);
|
|
5697
5908
|
const entries = Object.entries(pending.action).filter(([key, value]) => key !== "operation" && value !== null && value !== void 0);
|
|
5698
5909
|
return /* @__PURE__ */ jsxs("section", {
|
|
5699
|
-
className: joinClasses("plai-tool-result-pending-confirmation-card overflow-hidden rounded-lg border border-
|
|
5910
|
+
className: joinClasses("plai-tool-result-pending-confirmation-card overflow-hidden rounded-lg border border-border bg-surface text-foreground", className),
|
|
5700
5911
|
"data-tool-call-id": part.id,
|
|
5701
5912
|
"data-tool-call-state": part.state,
|
|
5702
5913
|
children: [
|
|
5703
5914
|
/* @__PURE__ */ jsxs("header", {
|
|
5704
|
-
className: "flex items-center gap-2 border-b border-
|
|
5915
|
+
className: "flex items-center gap-2 border-b border-border px-3 py-2 text-xs text-secondary",
|
|
5705
5916
|
children: [/* @__PURE__ */ jsx("span", {
|
|
5706
|
-
className: "truncate font-mono font-medium text-
|
|
5917
|
+
className: "truncate font-mono font-medium text-foreground",
|
|
5707
5918
|
children: part.name
|
|
5708
5919
|
}), /* @__PURE__ */ jsx(ConfirmationBadge, {
|
|
5709
5920
|
state: confirmationState,
|
|
@@ -5766,12 +5977,12 @@ function ToolResultWorkflowDispatchCard({ part, className, locale }) {
|
|
|
5766
5977
|
const error = formatToolErrorDetails(part.errorDetails);
|
|
5767
5978
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
5768
5979
|
"aria-label": `${copy.workflow}: ${workflowName}`,
|
|
5769
|
-
className: joinClasses("w-full rounded-lg border border-
|
|
5980
|
+
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),
|
|
5770
5981
|
children: /* @__PURE__ */ jsxs("span", {
|
|
5771
5982
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
5772
5983
|
children: [
|
|
5773
5984
|
/* @__PURE__ */ jsx(Workflow, {
|
|
5774
|
-
className: "h-4 w-4 shrink-0 text-
|
|
5985
|
+
className: "h-4 w-4 shrink-0 text-muted",
|
|
5775
5986
|
"aria-hidden": "true"
|
|
5776
5987
|
}),
|
|
5777
5988
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -5779,19 +5990,19 @@ function ToolResultWorkflowDispatchCard({ part, className, locale }) {
|
|
|
5779
5990
|
children: copy.workflow
|
|
5780
5991
|
}),
|
|
5781
5992
|
/* @__PURE__ */ jsx("span", {
|
|
5782
|
-
className: "min-w-0 truncate border-
|
|
5993
|
+
className: "min-w-0 truncate border-border-strong border px-2 py-0.5 rounded-md text-xs text-muted",
|
|
5783
5994
|
children: workflowName
|
|
5784
5995
|
}),
|
|
5785
5996
|
/* @__PURE__ */ jsxs("span", {
|
|
5786
5997
|
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
5787
5998
|
children: [/* @__PURE__ */ jsx("span", {
|
|
5788
|
-
className: "text-xs text-
|
|
5999
|
+
className: "text-xs text-muted",
|
|
5789
6000
|
children: status
|
|
5790
6001
|
}), failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
5791
|
-
className: "h-4 w-4 text-
|
|
6002
|
+
className: "h-4 w-4 text-danger",
|
|
5792
6003
|
"aria-hidden": "true"
|
|
5793
6004
|
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
5794
|
-
className: "h-4 w-4 text-
|
|
6005
|
+
className: "h-4 w-4 text-success",
|
|
5795
6006
|
"aria-hidden": "true"
|
|
5796
6007
|
})]
|
|
5797
6008
|
})
|
|
@@ -5810,22 +6021,22 @@ function ToolResultWorkflowDispatchCard({ part, className, locale }) {
|
|
|
5810
6021
|
className: "grid gap-2 text-sm",
|
|
5811
6022
|
children: [
|
|
5812
6023
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
5813
|
-
className: "text-xs text-
|
|
6024
|
+
className: "text-xs text-muted",
|
|
5814
6025
|
children: copy.workflow
|
|
5815
6026
|
}), /* @__PURE__ */ jsx("dd", { children: workflowName })] }),
|
|
5816
6027
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
5817
|
-
className: "text-xs text-
|
|
6028
|
+
className: "text-xs text-muted",
|
|
5818
6029
|
children: copy.status
|
|
5819
6030
|
}), /* @__PURE__ */ jsx("dd", { children: status })] }),
|
|
5820
6031
|
result.executionId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
5821
|
-
className: "text-xs text-
|
|
6032
|
+
className: "text-xs text-muted",
|
|
5822
6033
|
children: copy.executionId
|
|
5823
6034
|
}), /* @__PURE__ */ jsx("dd", {
|
|
5824
6035
|
className: "break-all",
|
|
5825
6036
|
children: result.executionId
|
|
5826
6037
|
})] }) : null,
|
|
5827
6038
|
result.workflowId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
5828
|
-
className: "text-xs text-
|
|
6039
|
+
className: "text-xs text-muted",
|
|
5829
6040
|
children: copy.workflowId
|
|
5830
6041
|
}), /* @__PURE__ */ jsx("dd", {
|
|
5831
6042
|
className: "break-all",
|
|
@@ -5837,11 +6048,11 @@ function ToolResultWorkflowDispatchCard({ part, className, locale }) {
|
|
|
5837
6048
|
className: "mb-2 text-sm font-medium",
|
|
5838
6049
|
children: copy.result
|
|
5839
6050
|
}), /* @__PURE__ */ jsx("pre", {
|
|
5840
|
-
className: "overflow-x-auto rounded-md border border-
|
|
6051
|
+
className: "overflow-x-auto rounded-md border border-border bg-surface-muted p-3 text-xs leading-5",
|
|
5841
6052
|
children: output$1
|
|
5842
6053
|
})] }) : null,
|
|
5843
6054
|
error ? /* @__PURE__ */ jsxs("p", {
|
|
5844
|
-
className: "rounded border border-
|
|
6055
|
+
className: "rounded border border-danger-border bg-danger-subtle px-3 py-2 text-xs text-danger-strong",
|
|
5845
6056
|
children: [
|
|
5846
6057
|
/* @__PURE__ */ jsxs("span", {
|
|
5847
6058
|
className: "font-semibold",
|
|
@@ -6148,79 +6359,81 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
|
|
|
6148
6359
|
});
|
|
6149
6360
|
if (part.toolType === "datasource") return null;
|
|
6150
6361
|
return /* @__PURE__ */ jsxs("section", {
|
|
6151
|
-
className: joinClasses("
|
|
6362
|
+
className: joinClasses("plai-tool-result-card overflow-hidden rounded-lg border border-border bg-surface-muted", className),
|
|
6152
6363
|
"data-tool-call-id": part.id,
|
|
6153
6364
|
"data-tool-call-state": part.state,
|
|
6154
|
-
children: [
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6365
|
+
children: [/* @__PURE__ */ jsxs("header", {
|
|
6366
|
+
className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2",
|
|
6367
|
+
children: [/* @__PURE__ */ jsx("h4", {
|
|
6368
|
+
className: "text-sm font-semibold text-foreground",
|
|
6369
|
+
children: part.name
|
|
6370
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6371
|
+
className: "rounded-full border capitalize border-success-border bg-success-subtle px-2 py-0.5 text-xs text-success-strong",
|
|
6372
|
+
children: copy.completed
|
|
6373
|
+
})]
|
|
6374
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
6375
|
+
className: "space-y-3 px-3 py-2",
|
|
6376
|
+
children: [
|
|
6377
|
+
part.toolType ? /* @__PURE__ */ jsxs("p", {
|
|
6378
|
+
className: "text-xs text-secondary",
|
|
6379
|
+
children: [
|
|
6380
|
+
/* @__PURE__ */ jsxs("span", {
|
|
6381
|
+
className: "font-semibold",
|
|
6382
|
+
children: [copy.type, ":"]
|
|
6383
|
+
}),
|
|
6384
|
+
" ",
|
|
6385
|
+
part.toolType
|
|
6386
|
+
]
|
|
6387
|
+
}) : null,
|
|
6388
|
+
/* @__PURE__ */ jsxs("details", {
|
|
6389
|
+
open: detailsOpen,
|
|
6390
|
+
className: "space-y-2",
|
|
6391
|
+
children: [/* @__PURE__ */ jsx("summary", {
|
|
6392
|
+
className: "cursor-pointer text-xs font-semibold text-secondary",
|
|
6393
|
+
children: copy.input
|
|
6394
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
6395
|
+
className: "overflow-x-auto rounded bg-inverse p-2 text-xs text-inverse-foreground",
|
|
6396
|
+
children: formatJson(part.input)
|
|
6397
|
+
})]
|
|
6398
|
+
}),
|
|
6399
|
+
part.result !== void 0 ? /* @__PURE__ */ jsxs("details", {
|
|
6400
|
+
open: detailsOpen,
|
|
6401
|
+
className: "space-y-2",
|
|
6402
|
+
children: [
|
|
6403
|
+
/* @__PURE__ */ jsx("summary", {
|
|
6404
|
+
className: "cursor-pointer text-xs font-semibold text-secondary",
|
|
6405
|
+
children: copy.output
|
|
6406
|
+
}),
|
|
6407
|
+
officeMediaFiles.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
6408
|
+
className: "space-y-2 rounded border border-border bg-surface p-3",
|
|
6409
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
6410
|
+
className: "text-xs font-semibold text-strong",
|
|
6411
|
+
children: copy.generatedFiles
|
|
6412
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
6413
|
+
className: "space-y-1",
|
|
6414
|
+
children: officeMediaFiles.map((file) => {
|
|
6415
|
+
const label = file.name || file.pathname || file.id;
|
|
6416
|
+
return /* @__PURE__ */ jsx("li", {
|
|
6417
|
+
className: "text-xs text-strong",
|
|
6418
|
+
children: file.url ? /* @__PURE__ */ jsx("a", {
|
|
6419
|
+
href: file.url,
|
|
6420
|
+
target: "_blank",
|
|
6421
|
+
rel: "noreferrer noopener",
|
|
6422
|
+
className: "hover:underline",
|
|
6423
|
+
children: label
|
|
6424
|
+
}) : /* @__PURE__ */ jsx("span", { children: label })
|
|
6425
|
+
}, file.id);
|
|
6426
|
+
})
|
|
6427
|
+
})]
|
|
6428
|
+
}) : null,
|
|
6429
|
+
/* @__PURE__ */ jsx("pre", {
|
|
6430
|
+
className: "overflow-x-auto rounded bg-inverse p-2 text-xs text-inverse-foreground",
|
|
6431
|
+
children: formatJson(part.result)
|
|
6432
|
+
})
|
|
6433
|
+
]
|
|
6434
|
+
}) : null
|
|
6435
|
+
]
|
|
6436
|
+
})]
|
|
6224
6437
|
});
|
|
6225
6438
|
}
|
|
6226
6439
|
|
|
@@ -6239,7 +6452,7 @@ function Thinking({ part, thinkingLabel, completedLabel, locale, defaultOpen, cl
|
|
|
6239
6452
|
previousState.current = part.state;
|
|
6240
6453
|
}, [isStreaming, part.state]);
|
|
6241
6454
|
return /* @__PURE__ */ jsxs("section", {
|
|
6242
|
-
className: joinClasses("text-sm text-
|
|
6455
|
+
className: joinClasses("text-sm text-secondary", className),
|
|
6243
6456
|
"data-thinking-state": part.state,
|
|
6244
6457
|
...props,
|
|
6245
6458
|
children: [
|
|
@@ -6249,7 +6462,7 @@ function Thinking({ part, thinkingLabel, completedLabel, locale, defaultOpen, cl
|
|
|
6249
6462
|
"aria-expanded": hasContent ? isOpen : void 0,
|
|
6250
6463
|
"aria-label": hasContent ? `${isOpen ? copy.collapse : copy.expand} ${label}` : label,
|
|
6251
6464
|
disabled: !hasContent,
|
|
6252
|
-
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-
|
|
6465
|
+
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"),
|
|
6253
6466
|
onClick: () => setIsOpen((value) => !value),
|
|
6254
6467
|
children: [
|
|
6255
6468
|
isStreaming ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
@@ -6273,7 +6486,7 @@ function Thinking({ part, thinkingLabel, completedLabel, locale, defaultOpen, cl
|
|
|
6273
6486
|
}),
|
|
6274
6487
|
hasContent && isOpen ? /* @__PURE__ */ jsx("p", {
|
|
6275
6488
|
id: contentId,
|
|
6276
|
-
className: "mt-1 whitespace-pre-wrap border-l-2 border-
|
|
6489
|
+
className: "mt-1 whitespace-pre-wrap border-l-2 border-border pl-3 text-sm leading-6 text-secondary",
|
|
6277
6490
|
children: part.thinking
|
|
6278
6491
|
}) : null
|
|
6279
6492
|
]
|
|
@@ -6300,7 +6513,7 @@ function MessageAvatar({ src, fallback, alt = fallback, className, imageClassNam
|
|
|
6300
6513
|
const showImage = src.trim().length > 0 && failedSrc !== src;
|
|
6301
6514
|
const initials = getFallbackInitials(fallback);
|
|
6302
6515
|
return /* @__PURE__ */ jsx("div", {
|
|
6303
|
-
className: joinClasses("plai-message-avatar flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-full bg-
|
|
6516
|
+
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),
|
|
6304
6517
|
...props,
|
|
6305
6518
|
children: showImage ? /* @__PURE__ */ jsx("img", {
|
|
6306
6519
|
src,
|
|
@@ -6322,7 +6535,7 @@ function MessageContent({ className,...props }) {
|
|
|
6322
6535
|
}
|
|
6323
6536
|
function MessageHeader({ className,...props }) {
|
|
6324
6537
|
return /* @__PURE__ */ jsx("header", {
|
|
6325
|
-
className: joinClasses("text-xs font-semibold uppercase tracking-wide text-
|
|
6538
|
+
className: joinClasses("text-xs font-semibold uppercase tracking-wide text-muted", className),
|
|
6326
6539
|
...props
|
|
6327
6540
|
});
|
|
6328
6541
|
}
|
|
@@ -6333,14 +6546,6 @@ function MessageFooter({ className,...props }) {
|
|
|
6333
6546
|
});
|
|
6334
6547
|
}
|
|
6335
6548
|
const DEFAULT_COLLAPSE_THRESHOLD = 600;
|
|
6336
|
-
function getFilenameFromUrl(url) {
|
|
6337
|
-
try {
|
|
6338
|
-
const parsed = new URL(url);
|
|
6339
|
-
return decodeURIComponent(parsed.pathname).split("/").pop()?.trim() || void 0;
|
|
6340
|
-
} catch {
|
|
6341
|
-
return (url.split("?")[0]?.split("#")[0] ?? "").split("/").pop()?.trim() || void 0;
|
|
6342
|
-
}
|
|
6343
|
-
}
|
|
6344
6549
|
function getDisplayExtension(label) {
|
|
6345
6550
|
if (!label) return void 0;
|
|
6346
6551
|
const ext = label.split(".").pop()?.trim().toUpperCase();
|
|
@@ -6371,13 +6576,13 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
|
|
|
6371
6576
|
href: part.url,
|
|
6372
6577
|
target: "_blank",
|
|
6373
6578
|
rel: "noreferrer noopener",
|
|
6374
|
-
className: "block w-fit rounded-lg border border-
|
|
6579
|
+
className: "block w-fit rounded-lg border border-border bg-surface p-2",
|
|
6375
6580
|
children: [/* @__PURE__ */ jsx("img", {
|
|
6376
6581
|
src: part.url,
|
|
6377
6582
|
alt: title || copy.uploadedImage,
|
|
6378
6583
|
className: "max-h-56 rounded-md object-contain"
|
|
6379
6584
|
}), title ? /* @__PURE__ */ jsx("p", {
|
|
6380
|
-
className: "mt-2 max-w-xs truncate text-xs font-medium text-
|
|
6585
|
+
className: "mt-2 max-w-xs truncate text-xs font-medium text-strong",
|
|
6381
6586
|
children: title
|
|
6382
6587
|
}) : null]
|
|
6383
6588
|
}, `image-${index}`);
|
|
@@ -6389,17 +6594,17 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
|
|
|
6389
6594
|
href: part.fileUrl,
|
|
6390
6595
|
target: "_blank",
|
|
6391
6596
|
rel: "noreferrer noopener",
|
|
6392
|
-
className: "flex w-fit items-center gap-3 rounded-lg border border-
|
|
6597
|
+
className: "flex w-fit items-center gap-3 rounded-lg border border-border bg-surface-muted px-3 py-2 text-left",
|
|
6393
6598
|
children: [/* @__PURE__ */ jsx("span", {
|
|
6394
|
-
className: "rounded bg-
|
|
6599
|
+
className: "rounded bg-inverse px-2 py-1 text-[10px] font-semibold uppercase tracking-wide text-inverse-foreground",
|
|
6395
6600
|
children: extension ?? copy.file
|
|
6396
6601
|
}), /* @__PURE__ */ jsxs("div", {
|
|
6397
6602
|
className: "min-w-0",
|
|
6398
6603
|
children: [/* @__PURE__ */ jsx("p", {
|
|
6399
|
-
className: "max-w-xs truncate text-sm font-medium text-
|
|
6604
|
+
className: "max-w-xs truncate text-sm font-medium text-foreground",
|
|
6400
6605
|
children: fileName
|
|
6401
6606
|
}), part.mimeType ? /* @__PURE__ */ jsx("p", {
|
|
6402
|
-
className: "text-xs text-
|
|
6607
|
+
className: "text-xs text-muted",
|
|
6403
6608
|
children: part.mimeType
|
|
6404
6609
|
}) : null]
|
|
6405
6610
|
})]
|
|
@@ -6426,7 +6631,7 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
|
|
|
6426
6631
|
}, `thinking-${index}`);
|
|
6427
6632
|
}
|
|
6428
6633
|
if (part.type === "guardrail") return /* @__PURE__ */ jsx("p", {
|
|
6429
|
-
className: "rounded-lg border border-
|
|
6634
|
+
className: "rounded-lg border border-warning-border bg-warning-subtle px-3 py-2 text-sm text-warning-strong",
|
|
6430
6635
|
children: part.content
|
|
6431
6636
|
}, `guardrail-${index}`);
|
|
6432
6637
|
return null;
|
|
@@ -6503,7 +6708,7 @@ function MessageParts({ message, collapseThreshold = DEFAULT_COLLAPSE_THRESHOLD,
|
|
|
6503
6708
|
getResourceDownloadUrl
|
|
6504
6709
|
}, `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", {
|
|
6505
6710
|
type: "button",
|
|
6506
|
-
className: "text-xs font-medium text-
|
|
6711
|
+
className: "text-xs font-medium text-secondary hover:text-foreground",
|
|
6507
6712
|
onClick: () => setIsExpanded((previous) => !previous),
|
|
6508
6713
|
children: isExpanded ? readLessLabel ?? copy.readLess : readMoreLabel ?? copy.readMore
|
|
6509
6714
|
}) : null]
|
|
@@ -6690,7 +6895,7 @@ function Clipboard({ text: text$2, onCopy, copiedDuration = 2e3, copyLabel, copi
|
|
|
6690
6895
|
return /* @__PURE__ */ jsxs("button", {
|
|
6691
6896
|
type,
|
|
6692
6897
|
"aria-label": isCopied ? resolvedCopiedLabel : resolvedCopyLabel,
|
|
6693
|
-
className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-
|
|
6898
|
+
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),
|
|
6694
6899
|
disabled: disabled || isCopying,
|
|
6695
6900
|
onClick: handleClick,
|
|
6696
6901
|
...props,
|
|
@@ -6714,7 +6919,7 @@ function ThumbButton({ label, icon, className, type = "button",...props }) {
|
|
|
6714
6919
|
return /* @__PURE__ */ jsxs("button", {
|
|
6715
6920
|
type,
|
|
6716
6921
|
"aria-label": label,
|
|
6717
|
-
className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-
|
|
6922
|
+
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),
|
|
6718
6923
|
...props,
|
|
6719
6924
|
children: [icon, /* @__PURE__ */ jsx("span", {
|
|
6720
6925
|
className: "sr-only",
|
|
@@ -6750,7 +6955,7 @@ function Reload({ label, locale, className, type = "button",...props }) {
|
|
|
6750
6955
|
return /* @__PURE__ */ jsxs("button", {
|
|
6751
6956
|
type,
|
|
6752
6957
|
"aria-label": resolvedLabel,
|
|
6753
|
-
className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-
|
|
6958
|
+
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),
|
|
6754
6959
|
...props,
|
|
6755
6960
|
children: [/* @__PURE__ */ jsx(RotateCcw, {
|
|
6756
6961
|
className: "size-4",
|
|
@@ -6780,13 +6985,13 @@ const ALLOWED_EXTENSIONS = new Set([
|
|
|
6780
6985
|
".pptx"
|
|
6781
6986
|
]);
|
|
6782
6987
|
const PROMPT_FORM_FILE_ACCEPT = "image/*,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx";
|
|
6783
|
-
function getFileExtension(filename) {
|
|
6988
|
+
function getFileExtension$1(filename) {
|
|
6784
6989
|
const lastDotIndex = filename.lastIndexOf(".");
|
|
6785
6990
|
if (lastDotIndex <= 0 || lastDotIndex === filename.length - 1) return;
|
|
6786
6991
|
return filename.slice(lastDotIndex).toLowerCase();
|
|
6787
6992
|
}
|
|
6788
6993
|
function isAllowedPromptFormFile(file) {
|
|
6789
|
-
const extension = getFileExtension(file.name);
|
|
6994
|
+
const extension = getFileExtension$1(file.name);
|
|
6790
6995
|
if (extension && ALLOWED_EXTENSIONS.has(extension)) return true;
|
|
6791
6996
|
return file.type.startsWith("image/");
|
|
6792
6997
|
}
|
|
@@ -6837,7 +7042,7 @@ function PromptFormAttachButton({ onFilesSelected, onInvalidFiles, locale, accep
|
|
|
6837
7042
|
|
|
6838
7043
|
//#endregion
|
|
6839
7044
|
//#region src/components/prompt-form/prompt-form.tsx
|
|
6840
|
-
const actionButtonClassName = "inline-flex size-8 shrink-0 items-center justify-center rounded-md bg-
|
|
7045
|
+
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";
|
|
6841
7046
|
const defaultMaxRows = 4;
|
|
6842
7047
|
function resizeTextarea(textarea, maxRows) {
|
|
6843
7048
|
const styles = getComputedStyle(textarea);
|
|
@@ -6889,7 +7094,7 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", locale,
|
|
|
6889
7094
|
setFiles(files.filter((_, fileIndex) => fileIndex !== index));
|
|
6890
7095
|
}
|
|
6891
7096
|
return /* @__PURE__ */ jsxs("form", {
|
|
6892
|
-
className: joinClasses("flex w-full flex-col overflow-hidden rounded-2xl border border-
|
|
7097
|
+
className: joinClasses("flex w-full flex-col overflow-hidden rounded-2xl border border-border bg-surface", className),
|
|
6893
7098
|
onSubmit: async (event) => {
|
|
6894
7099
|
event.preventDefault();
|
|
6895
7100
|
if (!canSubmit) return;
|
|
@@ -6921,7 +7126,7 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", locale,
|
|
|
6921
7126
|
/* @__PURE__ */ jsx("textarea", {
|
|
6922
7127
|
ref: textareaRef,
|
|
6923
7128
|
rows: 1,
|
|
6924
|
-
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-
|
|
7129
|
+
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),
|
|
6925
7130
|
value,
|
|
6926
7131
|
onChange: (event) => {
|
|
6927
7132
|
onValueChange(event.target.value);
|
|
@@ -6965,17 +7170,17 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", locale,
|
|
|
6965
7170
|
})
|
|
6966
7171
|
]
|
|
6967
7172
|
}), files.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
6968
|
-
className: joinClasses("border-t border-
|
|
7173
|
+
className: joinClasses("border-t border-border", attachmentsClassName),
|
|
6969
7174
|
children: [/* @__PURE__ */ jsx("div", {
|
|
6970
7175
|
className: "flex flex-wrap gap-2 px-4 py-2",
|
|
6971
7176
|
children: files.map((file, index) => /* @__PURE__ */ jsxs("div", {
|
|
6972
|
-
className: "flex max-w-full items-center gap-1.5 rounded-md bg-
|
|
7177
|
+
className: "flex max-w-full items-center gap-1.5 rounded-md bg-surface-subtle px-2 py-1 text-xs text-strong",
|
|
6973
7178
|
children: [/* @__PURE__ */ jsx("span", {
|
|
6974
7179
|
className: "max-w-[150px] truncate",
|
|
6975
7180
|
children: file.name
|
|
6976
7181
|
}), /* @__PURE__ */ jsx("button", {
|
|
6977
7182
|
type: "button",
|
|
6978
|
-
className: "text-
|
|
7183
|
+
className: "text-muted transition-colors hover:text-strong disabled:cursor-not-allowed disabled:opacity-40",
|
|
6979
7184
|
"aria-label": `${removeFileLabel}: ${file.name}`,
|
|
6980
7185
|
disabled: isInteractionDisabled,
|
|
6981
7186
|
onClick: () => removeFile(index),
|
|
@@ -6991,14 +7196,14 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", locale,
|
|
|
6991
7196
|
"aria-valuemin": 0,
|
|
6992
7197
|
"aria-valuemax": 100,
|
|
6993
7198
|
"aria-valuenow": Math.round(uploadState.progress),
|
|
6994
|
-
className: joinClasses("h-1.5 overflow-hidden rounded-full bg-
|
|
7199
|
+
className: joinClasses("h-1.5 overflow-hidden rounded-full bg-surface-hover", uploadProgressClassName),
|
|
6995
7200
|
children: /* @__PURE__ */ jsx("div", {
|
|
6996
|
-
className: "h-full rounded-full bg-
|
|
7201
|
+
className: "h-full rounded-full bg-inverse transition-[width] duration-150",
|
|
6997
7202
|
style: { width: `${uploadState.progress}%` }
|
|
6998
7203
|
})
|
|
6999
7204
|
})
|
|
7000
7205
|
}) : uploadState?.status === "error" ? /* @__PURE__ */ jsx("p", {
|
|
7001
|
-
className: "px-4 pb-3 text-xs text-
|
|
7206
|
+
className: "px-4 pb-3 text-xs text-danger",
|
|
7002
7207
|
children: uploadErrorLabel
|
|
7003
7208
|
}) : null]
|
|
7004
7209
|
}) : null]
|
|
@@ -7202,7 +7407,7 @@ function SpeechToTextToggle({ controller, onTranscriptionComplete, onTranscripti
|
|
|
7202
7407
|
"aria-pressed": isListening,
|
|
7203
7408
|
"aria-busy": isRequesting || isTranscribing,
|
|
7204
7409
|
disabled: disabled || isRequesting || isTranscribing,
|
|
7205
|
-
className: joinClasses(isListening && !isTranscribing ? "text-
|
|
7410
|
+
className: joinClasses(isListening && !isTranscribing ? "text-danger" : void 0, className),
|
|
7206
7411
|
onClick: (event) => {
|
|
7207
7412
|
onClick?.(event);
|
|
7208
7413
|
if (event.defaultPrevented) return;
|
|
@@ -7232,5 +7437,175 @@ async function dummyTranscribeAudio(_audio, signal) {
|
|
|
7232
7437
|
}
|
|
7233
7438
|
|
|
7234
7439
|
//#endregion
|
|
7235
|
-
|
|
7440
|
+
//#region src/components/conversation-files.tsx
|
|
7441
|
+
/** URL without query or hash, so a re-signed URL still matches its file. */
|
|
7442
|
+
function getFileKey(url) {
|
|
7443
|
+
return url.split("#")[0]?.split("?")[0] ?? url;
|
|
7444
|
+
}
|
|
7445
|
+
/**
|
|
7446
|
+
* Collects the files of the loaded messages, in conversation order: the user's
|
|
7447
|
+
* attachments and the files produced by office_documents tool calls. Files
|
|
7448
|
+
* without a URL are skipped; a file seen twice is listed once. Persisted
|
|
7449
|
+
* history omits media file ids, so files are matched by URL.
|
|
7450
|
+
*/
|
|
7451
|
+
function getConversationFiles(messages) {
|
|
7452
|
+
const uploaded = [];
|
|
7453
|
+
const generated = [];
|
|
7454
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7455
|
+
const add = (list, file) => {
|
|
7456
|
+
const key = `${file.kind}:${getFileKey(file.url)}`;
|
|
7457
|
+
if (seen.has(key)) return;
|
|
7458
|
+
seen.add(key);
|
|
7459
|
+
list.push(file);
|
|
7460
|
+
};
|
|
7461
|
+
for (const message of messages) for (const part of message.parts) if (message.role === "user" && part.type === "input_file") {
|
|
7462
|
+
const url = part.metadata?.wasConverted && part.metadata.sourceUrl || part.fileUrl;
|
|
7463
|
+
if (!url) continue;
|
|
7464
|
+
const name = part.metadata?.originalFileName || part.title || getFilenameFromUrl(url) || url;
|
|
7465
|
+
add(uploaded, {
|
|
7466
|
+
id: part.metadata?.mediaFileId || url,
|
|
7467
|
+
kind: "uploaded",
|
|
7468
|
+
name,
|
|
7469
|
+
url,
|
|
7470
|
+
contentType: part.mimeType,
|
|
7471
|
+
extension: getFileExtension(name, part.mimeType),
|
|
7472
|
+
messageId: message.id
|
|
7473
|
+
});
|
|
7474
|
+
} else if (message.role === "user" && part.type === "input_image") {
|
|
7475
|
+
if (!part.url) continue;
|
|
7476
|
+
const name = part.metadata?.originalFileName || part.title || getFilenameFromUrl(part.url) || part.url;
|
|
7477
|
+
add(uploaded, {
|
|
7478
|
+
id: part.metadata?.mediaFileId || part.url,
|
|
7479
|
+
kind: "uploaded",
|
|
7480
|
+
name,
|
|
7481
|
+
url: part.url,
|
|
7482
|
+
extension: getFileExtension(name),
|
|
7483
|
+
messageId: message.id
|
|
7484
|
+
});
|
|
7485
|
+
} else if (part.type === "tool-call" && part.toolType === "office_documents") {
|
|
7486
|
+
const mediaFiles = part.metadata?.media_files;
|
|
7487
|
+
if (!Array.isArray(mediaFiles)) continue;
|
|
7488
|
+
for (const file of mediaFiles) {
|
|
7489
|
+
if (!file || typeof file.id !== "string" || !file.url) continue;
|
|
7490
|
+
const name = file.name ?? getFilenameFromUrl(file.url) ?? file.id;
|
|
7491
|
+
add(generated, {
|
|
7492
|
+
id: file.id,
|
|
7493
|
+
kind: "generated",
|
|
7494
|
+
name,
|
|
7495
|
+
url: file.url,
|
|
7496
|
+
contentType: file.content_type,
|
|
7497
|
+
extension: getFileExtension(name, file.content_type),
|
|
7498
|
+
messageId: message.id
|
|
7499
|
+
});
|
|
7500
|
+
}
|
|
7501
|
+
}
|
|
7502
|
+
return {
|
|
7503
|
+
uploaded,
|
|
7504
|
+
generated
|
|
7505
|
+
};
|
|
7506
|
+
}
|
|
7507
|
+
/** Uploaded and generated files of a conversation, each with a download button. */
|
|
7508
|
+
function ConversationFilesList({ messages, locale, className }) {
|
|
7509
|
+
const copy = getUiCopy(locale);
|
|
7510
|
+
const { uploaded, generated } = useMemo(() => getConversationFiles(messages), [messages]);
|
|
7511
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7512
|
+
className: joinClasses("space-y-6", className),
|
|
7513
|
+
children: [
|
|
7514
|
+
uploaded.length === 0 && generated.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
7515
|
+
className: "text-sm text-secondary",
|
|
7516
|
+
children: copy.noConversationFiles
|
|
7517
|
+
}) : null,
|
|
7518
|
+
/* @__PURE__ */ jsx(FileSection, {
|
|
7519
|
+
title: copy.uploadedFiles,
|
|
7520
|
+
files: uploaded,
|
|
7521
|
+
copy
|
|
7522
|
+
}),
|
|
7523
|
+
/* @__PURE__ */ jsx(FileSection, {
|
|
7524
|
+
title: copy.generatedFiles,
|
|
7525
|
+
files: generated,
|
|
7526
|
+
copy
|
|
7527
|
+
})
|
|
7528
|
+
]
|
|
7529
|
+
});
|
|
7530
|
+
}
|
|
7531
|
+
function FileSection({ title, files, copy }) {
|
|
7532
|
+
if (files.length === 0) return null;
|
|
7533
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
7534
|
+
className: "space-y-3",
|
|
7535
|
+
"aria-label": title,
|
|
7536
|
+
children: [/* @__PURE__ */ jsxs("h3", {
|
|
7537
|
+
className: "text-xs font-semibold uppercase tracking-wide text-muted",
|
|
7538
|
+
children: [
|
|
7539
|
+
title,
|
|
7540
|
+
" (",
|
|
7541
|
+
files.length,
|
|
7542
|
+
")"
|
|
7543
|
+
]
|
|
7544
|
+
}), files.map((file) => /* @__PURE__ */ jsxs("div", {
|
|
7545
|
+
className: "flex items-center gap-3 rounded-lg border border-border bg-surface p-3",
|
|
7546
|
+
children: [
|
|
7547
|
+
/* @__PURE__ */ jsx(File, {
|
|
7548
|
+
className: joinClasses("h-8 w-8 shrink-0", getFileIconClass(file.extension)),
|
|
7549
|
+
"aria-hidden": "true"
|
|
7550
|
+
}),
|
|
7551
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7552
|
+
className: "min-w-0",
|
|
7553
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
7554
|
+
className: "truncate text-sm font-medium",
|
|
7555
|
+
children: file.name
|
|
7556
|
+
}), file.extension ? /* @__PURE__ */ jsx("p", {
|
|
7557
|
+
className: "text-[11px] uppercase text-muted",
|
|
7558
|
+
children: file.extension
|
|
7559
|
+
}) : null]
|
|
7560
|
+
}),
|
|
7561
|
+
/* @__PURE__ */ jsx(FileDownloadButton, {
|
|
7562
|
+
file: {
|
|
7563
|
+
url: file.url,
|
|
7564
|
+
name: file.name
|
|
7565
|
+
},
|
|
7566
|
+
label: file.name,
|
|
7567
|
+
copy
|
|
7568
|
+
})
|
|
7569
|
+
]
|
|
7570
|
+
}, `${file.kind}:${file.id}`))]
|
|
7571
|
+
});
|
|
7572
|
+
}
|
|
7573
|
+
/** Side sheet with the conversation's files, opened from a paperclip button. */
|
|
7574
|
+
function ConversationFilesSheet({ messages, locale, className, open, onOpenChange, showTrigger = true, triggerClassName, side }) {
|
|
7575
|
+
const copy = getUiCopy(locale);
|
|
7576
|
+
const count$1 = useMemo(() => {
|
|
7577
|
+
const { uploaded, generated } = getConversationFiles(messages);
|
|
7578
|
+
return uploaded.length + generated.length;
|
|
7579
|
+
}, [messages]);
|
|
7580
|
+
return /* @__PURE__ */ jsxs(Sheet, {
|
|
7581
|
+
open,
|
|
7582
|
+
onOpenChange,
|
|
7583
|
+
children: [showTrigger ? /* @__PURE__ */ jsxs(SheetTrigger, {
|
|
7584
|
+
"aria-label": `${copy.conversationFiles}: ${count$1}`,
|
|
7585
|
+
title: copy.conversationFiles,
|
|
7586
|
+
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),
|
|
7587
|
+
children: [/* @__PURE__ */ jsx(Paperclip$1, {
|
|
7588
|
+
className: "h-4 w-4",
|
|
7589
|
+
"aria-hidden": "true"
|
|
7590
|
+
}), count$1 > 0 ? /* @__PURE__ */ jsx("span", {
|
|
7591
|
+
className: "tabular-nums",
|
|
7592
|
+
children: count$1
|
|
7593
|
+
}) : null]
|
|
7594
|
+
}) : null, /* @__PURE__ */ jsxs(SheetContent, {
|
|
7595
|
+
locale,
|
|
7596
|
+
side,
|
|
7597
|
+
children: [/* @__PURE__ */ jsx(SheetHeader, {
|
|
7598
|
+
className: "pr-10",
|
|
7599
|
+
children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.conversationFiles })
|
|
7600
|
+
}), /* @__PURE__ */ jsx(ConversationFilesList, {
|
|
7601
|
+
messages,
|
|
7602
|
+
locale,
|
|
7603
|
+
className: joinClasses("mt-6", className)
|
|
7604
|
+
})]
|
|
7605
|
+
})]
|
|
7606
|
+
});
|
|
7607
|
+
}
|
|
7608
|
+
|
|
7609
|
+
//#endregion
|
|
7610
|
+
export { AggregatedSourceResults, ArrowUp, AssistantMessage, ChatError, Clipboard, ConversationFilesList, ConversationFilesSheet, DatasourceFolderCard, DatasourceToolResources, DatasourceToolResultCard, Loader, MemoryProposalCard, Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader, MessageParts, MessageRoot, Microphone, PROMPT_FORM_FILE_ACCEPT, Paperclip, 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, getResourceDescription, getResourceIcon, getResourceOpenGraphImage, getResourceOpenGraphType, getResourceTitle, getResourceType, getResourceUrl, getToolUseLabel, isAllowedPromptFormFile, partitionPromptFormFiles, useChat, useChatRegistryBusy, useOwnedChatRegistry, useRegistryChat, useSpeechToText, useStreamCoordinator, useToolConfirmationSync, useToolConfirmations };
|
|
7236
7611
|
//# sourceMappingURL=index.js.map
|