@copilotz/admin 0.3.7 → 0.3.8
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/index.cjs +1224 -337
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/index.js +1150 -269
- package/dist/index.js.map +1 -1
- package/dist/styles.css +67 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -31,19 +31,28 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
CopilotzAdmin: () => CopilotzAdmin,
|
|
34
|
+
createCollectionItem: () => createCollectionItem,
|
|
34
35
|
defaultAdminConfig: () => defaultAdminConfig,
|
|
36
|
+
deleteCollectionItem: () => deleteCollectionItem,
|
|
35
37
|
fetchAdminActivity: () => fetchAdminActivity,
|
|
36
38
|
fetchAdminAgents: () => fetchAdminAgents,
|
|
37
39
|
fetchAdminOverview: () => fetchAdminOverview,
|
|
38
40
|
fetchAdminParticipants: () => fetchAdminParticipants,
|
|
39
41
|
fetchAdminThreads: () => fetchAdminThreads,
|
|
42
|
+
fetchCollectionItem: () => fetchCollectionItem,
|
|
43
|
+
fetchCollectionItems: () => fetchCollectionItems,
|
|
44
|
+
fetchCollectionNames: () => fetchCollectionNames,
|
|
45
|
+
fetchParticipantDetail: () => fetchParticipantDetail,
|
|
46
|
+
fetchThreadEvents: () => fetchThreadEvents,
|
|
40
47
|
mergeAdminConfig: () => mergeAdminConfig,
|
|
48
|
+
updateCollectionItem: () => updateCollectionItem,
|
|
49
|
+
updateParticipant: () => updateParticipant,
|
|
41
50
|
useCopilotzAdmin: () => useCopilotzAdmin
|
|
42
51
|
});
|
|
43
52
|
module.exports = __toCommonJS(index_exports);
|
|
44
53
|
|
|
45
54
|
// src/CopilotzAdmin.tsx
|
|
46
|
-
var
|
|
55
|
+
var import_react7 = require("react");
|
|
47
56
|
|
|
48
57
|
// src/config.ts
|
|
49
58
|
var defaultAdminConfig = {
|
|
@@ -85,7 +94,9 @@ var defaultAdminConfig = {
|
|
|
85
94
|
unconfigured: "Observed only",
|
|
86
95
|
noResults: "No results",
|
|
87
96
|
eventsTitle: "Events",
|
|
88
|
-
dashboardTitle: "Dashboard"
|
|
97
|
+
dashboardTitle: "Dashboard",
|
|
98
|
+
collectionsTitle: "Collections",
|
|
99
|
+
collectionsEndpoint: "/v1/collections"
|
|
89
100
|
},
|
|
90
101
|
features: {
|
|
91
102
|
showOverview: true,
|
|
@@ -93,7 +104,8 @@ var defaultAdminConfig = {
|
|
|
93
104
|
showThreads: true,
|
|
94
105
|
showParticipants: true,
|
|
95
106
|
showAgents: true,
|
|
96
|
-
showEvents:
|
|
107
|
+
showEvents: true,
|
|
108
|
+
showCollections: true
|
|
97
109
|
},
|
|
98
110
|
ui: {
|
|
99
111
|
compact: false,
|
|
@@ -280,6 +292,122 @@ async function fetchThreadMessages(threadId, messageOptions, options) {
|
|
|
280
292
|
options
|
|
281
293
|
);
|
|
282
294
|
}
|
|
295
|
+
async function fetchParticipantDetail(participantId, options) {
|
|
296
|
+
return await fetchAdminJson(
|
|
297
|
+
`/v1/participants/${encodeURIComponent(participantId)}`,
|
|
298
|
+
{},
|
|
299
|
+
options
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
async function updateParticipant(participantId, data, options) {
|
|
303
|
+
const url = new URL(
|
|
304
|
+
`${resolveBaseUrl(options?.baseUrl)}/v1/participants/${encodeURIComponent(participantId)}`,
|
|
305
|
+
window.location.origin
|
|
306
|
+
);
|
|
307
|
+
const response = await fetch(url.toString(), {
|
|
308
|
+
method: "PUT",
|
|
309
|
+
headers: await withAuthHeaders(
|
|
310
|
+
{ "Content-Type": "application/json" },
|
|
311
|
+
options?.getRequestHeaders
|
|
312
|
+
),
|
|
313
|
+
body: JSON.stringify(data)
|
|
314
|
+
});
|
|
315
|
+
if (!response.ok) {
|
|
316
|
+
throw new Error(`Update participant failed (${response.status})`);
|
|
317
|
+
}
|
|
318
|
+
const payload = await response.json();
|
|
319
|
+
return payload.data;
|
|
320
|
+
}
|
|
321
|
+
async function fetchCollectionNames(options) {
|
|
322
|
+
return await fetchAdminJson("/v1/collections", {}, options);
|
|
323
|
+
}
|
|
324
|
+
async function fetchCollectionItems(collection, queryOptions, options) {
|
|
325
|
+
const params = {
|
|
326
|
+
namespace: queryOptions?.namespace,
|
|
327
|
+
limit: queryOptions?.limit?.toString()
|
|
328
|
+
};
|
|
329
|
+
if (queryOptions?.search) {
|
|
330
|
+
params.q = queryOptions.search;
|
|
331
|
+
} else {
|
|
332
|
+
params.offset = queryOptions?.offset?.toString();
|
|
333
|
+
}
|
|
334
|
+
return await fetchAdminJson(
|
|
335
|
+
`/v1/collections/${encodeURIComponent(collection)}`,
|
|
336
|
+
params,
|
|
337
|
+
options
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
async function fetchCollectionItem(collection, itemId, namespace, options) {
|
|
341
|
+
return await fetchAdminJson(
|
|
342
|
+
`/v1/collections/${encodeURIComponent(collection)}/${encodeURIComponent(itemId)}`,
|
|
343
|
+
{ namespace },
|
|
344
|
+
options
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
async function createCollectionItem(collection, data, namespace, options) {
|
|
348
|
+
const url = new URL(
|
|
349
|
+
`${resolveBaseUrl(options?.baseUrl)}/v1/collections/${encodeURIComponent(collection)}`,
|
|
350
|
+
window.location.origin
|
|
351
|
+
);
|
|
352
|
+
if (namespace) url.searchParams.set("namespace", namespace);
|
|
353
|
+
const response = await fetch(url.toString(), {
|
|
354
|
+
method: "POST",
|
|
355
|
+
headers: await withAuthHeaders(
|
|
356
|
+
{ "Content-Type": "application/json" },
|
|
357
|
+
options?.getRequestHeaders
|
|
358
|
+
),
|
|
359
|
+
body: JSON.stringify(data)
|
|
360
|
+
});
|
|
361
|
+
if (!response.ok) {
|
|
362
|
+
throw new Error(`Create collection item failed (${response.status})`);
|
|
363
|
+
}
|
|
364
|
+
const payload = await response.json();
|
|
365
|
+
if ("body" in payload && payload.body && typeof payload.body === "object") {
|
|
366
|
+
return payload.body;
|
|
367
|
+
}
|
|
368
|
+
return payload;
|
|
369
|
+
}
|
|
370
|
+
async function updateCollectionItem(collection, itemId, data, namespace, options) {
|
|
371
|
+
const url = new URL(
|
|
372
|
+
`${resolveBaseUrl(options?.baseUrl)}/v1/collections/${encodeURIComponent(collection)}/${encodeURIComponent(itemId)}`,
|
|
373
|
+
window.location.origin
|
|
374
|
+
);
|
|
375
|
+
if (namespace) url.searchParams.set("namespace", namespace);
|
|
376
|
+
const response = await fetch(url.toString(), {
|
|
377
|
+
method: "PUT",
|
|
378
|
+
headers: await withAuthHeaders(
|
|
379
|
+
{ "Content-Type": "application/json" },
|
|
380
|
+
options?.getRequestHeaders
|
|
381
|
+
),
|
|
382
|
+
body: JSON.stringify(data)
|
|
383
|
+
});
|
|
384
|
+
if (!response.ok) {
|
|
385
|
+
throw new Error(`Update collection item failed (${response.status})`);
|
|
386
|
+
}
|
|
387
|
+
const payload = await response.json();
|
|
388
|
+
return payload.data;
|
|
389
|
+
}
|
|
390
|
+
async function deleteCollectionItem(collection, itemId, namespace, options) {
|
|
391
|
+
const url = new URL(
|
|
392
|
+
`${resolveBaseUrl(options?.baseUrl)}/v1/collections/${encodeURIComponent(collection)}/${encodeURIComponent(itemId)}`,
|
|
393
|
+
window.location.origin
|
|
394
|
+
);
|
|
395
|
+
if (namespace) url.searchParams.set("namespace", namespace);
|
|
396
|
+
const response = await fetch(url.toString(), {
|
|
397
|
+
method: "DELETE",
|
|
398
|
+
headers: await withAuthHeaders({}, options?.getRequestHeaders)
|
|
399
|
+
});
|
|
400
|
+
if (!response.ok) {
|
|
401
|
+
throw new Error(`Delete collection item failed (${response.status})`);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
async function fetchThreadEvents(threadId, options) {
|
|
405
|
+
return await fetchAdminJson(
|
|
406
|
+
`/v1/threads/${encodeURIComponent(threadId)}/events`,
|
|
407
|
+
{},
|
|
408
|
+
options
|
|
409
|
+
);
|
|
410
|
+
}
|
|
283
411
|
|
|
284
412
|
// src/useCopilotzAdmin.ts
|
|
285
413
|
function useCopilotzAdmin(options = {}) {
|
|
@@ -568,11 +696,35 @@ function Input({ className, type, ...props }) {
|
|
|
568
696
|
);
|
|
569
697
|
}
|
|
570
698
|
|
|
699
|
+
// src/components/ui/separator.tsx
|
|
700
|
+
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"), 1);
|
|
701
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
702
|
+
function Separator({
|
|
703
|
+
className,
|
|
704
|
+
orientation = "horizontal",
|
|
705
|
+
decorative = true,
|
|
706
|
+
...props
|
|
707
|
+
}) {
|
|
708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
709
|
+
SeparatorPrimitive.Root,
|
|
710
|
+
{
|
|
711
|
+
"data-slot": "separator",
|
|
712
|
+
decorative,
|
|
713
|
+
orientation,
|
|
714
|
+
className: cn(
|
|
715
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
716
|
+
className
|
|
717
|
+
),
|
|
718
|
+
...props
|
|
719
|
+
}
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
|
|
571
723
|
// src/components/ui/sheet.tsx
|
|
572
724
|
var React2 = __toESM(require("react"), 1);
|
|
573
725
|
var SheetPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
574
726
|
var import_lucide_react = require("lucide-react");
|
|
575
|
-
var
|
|
727
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
576
728
|
function cleanupBodyStyles() {
|
|
577
729
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
578
730
|
document.body.style.pointerEvents = "";
|
|
@@ -592,18 +744,18 @@ function Sheet({ open, onOpenChange, ...props }) {
|
|
|
592
744
|
cleanupBodyStyles();
|
|
593
745
|
};
|
|
594
746
|
}, []);
|
|
595
|
-
return /* @__PURE__ */ (0,
|
|
747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SheetPrimitive.Root, { "data-slot": "sheet", open, onOpenChange, ...props });
|
|
596
748
|
}
|
|
597
749
|
function SheetPortal({
|
|
598
750
|
...props
|
|
599
751
|
}) {
|
|
600
|
-
return /* @__PURE__ */ (0,
|
|
752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
601
753
|
}
|
|
602
754
|
function SheetOverlay({
|
|
603
755
|
className,
|
|
604
756
|
...props
|
|
605
757
|
}) {
|
|
606
|
-
return /* @__PURE__ */ (0,
|
|
758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
607
759
|
SheetPrimitive.Overlay,
|
|
608
760
|
{
|
|
609
761
|
"data-slot": "sheet-overlay",
|
|
@@ -624,9 +776,9 @@ function SheetContent({
|
|
|
624
776
|
side = "right",
|
|
625
777
|
...props
|
|
626
778
|
}) {
|
|
627
|
-
return /* @__PURE__ */ (0,
|
|
628
|
-
/* @__PURE__ */ (0,
|
|
629
|
-
/* @__PURE__ */ (0,
|
|
779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(SheetPortal, { children: [
|
|
780
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SheetOverlay, {}),
|
|
781
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
630
782
|
SheetPrimitive.Content,
|
|
631
783
|
{
|
|
632
784
|
"data-slot": "sheet-content",
|
|
@@ -642,9 +794,9 @@ function SheetContent({
|
|
|
642
794
|
...props,
|
|
643
795
|
children: [
|
|
644
796
|
children,
|
|
645
|
-
/* @__PURE__ */ (0,
|
|
646
|
-
/* @__PURE__ */ (0,
|
|
647
|
-
/* @__PURE__ */ (0,
|
|
797
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(SheetPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
|
|
798
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.XIcon, { className: "size-4" }),
|
|
799
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sr-only", children: "Close" })
|
|
648
800
|
] })
|
|
649
801
|
]
|
|
650
802
|
}
|
|
@@ -652,7 +804,7 @@ function SheetContent({
|
|
|
652
804
|
] });
|
|
653
805
|
}
|
|
654
806
|
function SheetHeader({ className, ...props }) {
|
|
655
|
-
return /* @__PURE__ */ (0,
|
|
807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
656
808
|
"div",
|
|
657
809
|
{
|
|
658
810
|
"data-slot": "sheet-header",
|
|
@@ -665,7 +817,7 @@ function SheetTitle({
|
|
|
665
817
|
className,
|
|
666
818
|
...props
|
|
667
819
|
}) {
|
|
668
|
-
return /* @__PURE__ */ (0,
|
|
820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
669
821
|
SheetPrimitive.Title,
|
|
670
822
|
{
|
|
671
823
|
"data-slot": "sheet-title",
|
|
@@ -678,7 +830,7 @@ function SheetDescription({
|
|
|
678
830
|
className,
|
|
679
831
|
...props
|
|
680
832
|
}) {
|
|
681
|
-
return /* @__PURE__ */ (0,
|
|
833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
682
834
|
SheetPrimitive.Description,
|
|
683
835
|
{
|
|
684
836
|
"data-slot": "sheet-description",
|
|
@@ -689,7 +841,7 @@ function SheetDescription({
|
|
|
689
841
|
}
|
|
690
842
|
|
|
691
843
|
// src/components/ui/sidebar.tsx
|
|
692
|
-
var
|
|
844
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
693
845
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
694
846
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
695
847
|
var SIDEBAR_WIDTH = "16rem";
|
|
@@ -755,7 +907,7 @@ function SidebarProvider({
|
|
|
755
907
|
}),
|
|
756
908
|
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
757
909
|
);
|
|
758
|
-
return /* @__PURE__ */ (0,
|
|
910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
759
911
|
"div",
|
|
760
912
|
{
|
|
761
913
|
"data-slot": "sidebar-wrapper",
|
|
@@ -783,7 +935,7 @@ function Sidebar({
|
|
|
783
935
|
}) {
|
|
784
936
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
785
937
|
if (collapsible === "none") {
|
|
786
|
-
return /* @__PURE__ */ (0,
|
|
938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
787
939
|
"div",
|
|
788
940
|
{
|
|
789
941
|
"data-slot": "sidebar",
|
|
@@ -797,7 +949,7 @@ function Sidebar({
|
|
|
797
949
|
);
|
|
798
950
|
}
|
|
799
951
|
if (isMobile) {
|
|
800
|
-
return /* @__PURE__ */ (0,
|
|
952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
801
953
|
SheetContent,
|
|
802
954
|
{
|
|
803
955
|
"data-sidebar": "sidebar",
|
|
@@ -809,16 +961,16 @@ function Sidebar({
|
|
|
809
961
|
},
|
|
810
962
|
side,
|
|
811
963
|
children: [
|
|
812
|
-
/* @__PURE__ */ (0,
|
|
813
|
-
/* @__PURE__ */ (0,
|
|
814
|
-
/* @__PURE__ */ (0,
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(SheetHeader, { className: "sr-only", children: [
|
|
965
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SheetTitle, { children: "Sidebar" }),
|
|
966
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
815
967
|
] }),
|
|
816
|
-
/* @__PURE__ */ (0,
|
|
968
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex h-full w-full flex-col", children })
|
|
817
969
|
]
|
|
818
970
|
}
|
|
819
971
|
) });
|
|
820
972
|
}
|
|
821
|
-
return /* @__PURE__ */ (0,
|
|
973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
822
974
|
"div",
|
|
823
975
|
{
|
|
824
976
|
className: "group peer text-sidebar-foreground hidden md:block",
|
|
@@ -828,7 +980,7 @@ function Sidebar({
|
|
|
828
980
|
"data-side": side,
|
|
829
981
|
"data-slot": "sidebar",
|
|
830
982
|
children: [
|
|
831
|
-
/* @__PURE__ */ (0,
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
832
984
|
"div",
|
|
833
985
|
{
|
|
834
986
|
"data-slot": "sidebar-gap",
|
|
@@ -840,7 +992,7 @@ function Sidebar({
|
|
|
840
992
|
)
|
|
841
993
|
}
|
|
842
994
|
),
|
|
843
|
-
/* @__PURE__ */ (0,
|
|
995
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
844
996
|
"div",
|
|
845
997
|
{
|
|
846
998
|
"data-slot": "sidebar-container",
|
|
@@ -851,7 +1003,7 @@ function Sidebar({
|
|
|
851
1003
|
className
|
|
852
1004
|
),
|
|
853
1005
|
...props,
|
|
854
|
-
children: /* @__PURE__ */ (0,
|
|
1006
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
855
1007
|
"div",
|
|
856
1008
|
{
|
|
857
1009
|
"data-sidebar": "sidebar",
|
|
@@ -872,7 +1024,7 @@ function SidebarTrigger({
|
|
|
872
1024
|
...props
|
|
873
1025
|
}) {
|
|
874
1026
|
const { toggleSidebar } = useSidebar();
|
|
875
|
-
return /* @__PURE__ */ (0,
|
|
1027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
876
1028
|
Button,
|
|
877
1029
|
{
|
|
878
1030
|
"data-sidebar": "trigger",
|
|
@@ -886,15 +1038,15 @@ function SidebarTrigger({
|
|
|
886
1038
|
},
|
|
887
1039
|
...props,
|
|
888
1040
|
children: [
|
|
889
|
-
/* @__PURE__ */ (0,
|
|
890
|
-
/* @__PURE__ */ (0,
|
|
1041
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.PanelLeftIcon, {}),
|
|
1042
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
891
1043
|
]
|
|
892
1044
|
}
|
|
893
1045
|
);
|
|
894
1046
|
}
|
|
895
1047
|
function SidebarRail({ className, ...props }) {
|
|
896
1048
|
const { toggleSidebar } = useSidebar();
|
|
897
|
-
return /* @__PURE__ */ (0,
|
|
1049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
898
1050
|
"button",
|
|
899
1051
|
{
|
|
900
1052
|
"data-sidebar": "rail",
|
|
@@ -917,7 +1069,7 @@ function SidebarRail({ className, ...props }) {
|
|
|
917
1069
|
);
|
|
918
1070
|
}
|
|
919
1071
|
function SidebarInset({ className, ...props }) {
|
|
920
|
-
return /* @__PURE__ */ (0,
|
|
1072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
921
1073
|
"main",
|
|
922
1074
|
{
|
|
923
1075
|
"data-slot": "sidebar-inset",
|
|
@@ -931,7 +1083,7 @@ function SidebarInset({ className, ...props }) {
|
|
|
931
1083
|
);
|
|
932
1084
|
}
|
|
933
1085
|
function SidebarHeader({ className, ...props }) {
|
|
934
|
-
return /* @__PURE__ */ (0,
|
|
1086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
935
1087
|
"div",
|
|
936
1088
|
{
|
|
937
1089
|
"data-slot": "sidebar-header",
|
|
@@ -942,7 +1094,7 @@ function SidebarHeader({ className, ...props }) {
|
|
|
942
1094
|
);
|
|
943
1095
|
}
|
|
944
1096
|
function SidebarFooter({ className, ...props }) {
|
|
945
|
-
return /* @__PURE__ */ (0,
|
|
1097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
946
1098
|
"div",
|
|
947
1099
|
{
|
|
948
1100
|
"data-slot": "sidebar-footer",
|
|
@@ -952,8 +1104,22 @@ function SidebarFooter({ className, ...props }) {
|
|
|
952
1104
|
}
|
|
953
1105
|
);
|
|
954
1106
|
}
|
|
1107
|
+
function SidebarSeparator({
|
|
1108
|
+
className,
|
|
1109
|
+
...props
|
|
1110
|
+
}) {
|
|
1111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1112
|
+
Separator,
|
|
1113
|
+
{
|
|
1114
|
+
"data-slot": "sidebar-separator",
|
|
1115
|
+
"data-sidebar": "separator",
|
|
1116
|
+
className: cn("bg-sidebar-border mx-2 w-auto", className),
|
|
1117
|
+
...props
|
|
1118
|
+
}
|
|
1119
|
+
);
|
|
1120
|
+
}
|
|
955
1121
|
function SidebarContent({ className, ...props }) {
|
|
956
|
-
return /* @__PURE__ */ (0,
|
|
1122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
957
1123
|
"div",
|
|
958
1124
|
{
|
|
959
1125
|
"data-slot": "sidebar-content",
|
|
@@ -967,7 +1133,7 @@ function SidebarContent({ className, ...props }) {
|
|
|
967
1133
|
);
|
|
968
1134
|
}
|
|
969
1135
|
function SidebarGroup({ className, ...props }) {
|
|
970
|
-
return /* @__PURE__ */ (0,
|
|
1136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
971
1137
|
"div",
|
|
972
1138
|
{
|
|
973
1139
|
"data-slot": "sidebar-group",
|
|
@@ -983,7 +1149,7 @@ function SidebarGroupLabel({
|
|
|
983
1149
|
...props
|
|
984
1150
|
}) {
|
|
985
1151
|
const Comp = asChild ? import_react_slot2.Slot : "div";
|
|
986
|
-
return /* @__PURE__ */ (0,
|
|
1152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
987
1153
|
Comp,
|
|
988
1154
|
{
|
|
989
1155
|
"data-slot": "sidebar-group-label",
|
|
@@ -1001,7 +1167,7 @@ function SidebarGroupContent({
|
|
|
1001
1167
|
className,
|
|
1002
1168
|
...props
|
|
1003
1169
|
}) {
|
|
1004
|
-
return /* @__PURE__ */ (0,
|
|
1170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1005
1171
|
"div",
|
|
1006
1172
|
{
|
|
1007
1173
|
"data-slot": "sidebar-group-content",
|
|
@@ -1012,7 +1178,7 @@ function SidebarGroupContent({
|
|
|
1012
1178
|
);
|
|
1013
1179
|
}
|
|
1014
1180
|
function SidebarMenu({ className, ...props }) {
|
|
1015
|
-
return /* @__PURE__ */ (0,
|
|
1181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1016
1182
|
"ul",
|
|
1017
1183
|
{
|
|
1018
1184
|
"data-slot": "sidebar-menu",
|
|
@@ -1023,7 +1189,7 @@ function SidebarMenu({ className, ...props }) {
|
|
|
1023
1189
|
);
|
|
1024
1190
|
}
|
|
1025
1191
|
function SidebarMenuItem({ className, ...props }) {
|
|
1026
|
-
return /* @__PURE__ */ (0,
|
|
1192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1027
1193
|
"li",
|
|
1028
1194
|
{
|
|
1029
1195
|
"data-slot": "sidebar-menu-item",
|
|
@@ -1064,7 +1230,7 @@ function SidebarMenuButton({
|
|
|
1064
1230
|
}) {
|
|
1065
1231
|
const Comp = asChild ? import_react_slot2.Slot : "button";
|
|
1066
1232
|
const { isMobile, state } = useSidebar();
|
|
1067
|
-
const button = /* @__PURE__ */ (0,
|
|
1233
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1068
1234
|
Comp,
|
|
1069
1235
|
{
|
|
1070
1236
|
"data-slot": "sidebar-menu-button",
|
|
@@ -1083,9 +1249,9 @@ function SidebarMenuButton({
|
|
|
1083
1249
|
children: tooltip
|
|
1084
1250
|
};
|
|
1085
1251
|
}
|
|
1086
|
-
return /* @__PURE__ */ (0,
|
|
1087
|
-
/* @__PURE__ */ (0,
|
|
1088
|
-
/* @__PURE__ */ (0,
|
|
1252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Tooltip, { children: [
|
|
1253
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipTrigger, { asChild: true, children: button }),
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1089
1255
|
TooltipContent,
|
|
1090
1256
|
{
|
|
1091
1257
|
side: "right",
|
|
@@ -1098,86 +1264,12 @@ function SidebarMenuButton({
|
|
|
1098
1264
|
}
|
|
1099
1265
|
|
|
1100
1266
|
// src/components/layout/AdminSidebar.tsx
|
|
1101
|
-
var
|
|
1102
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1103
|
-
var NAV_ITEMS = [
|
|
1104
|
-
{
|
|
1105
|
-
page: "dashboard",
|
|
1106
|
-
label: "Dashboard",
|
|
1107
|
-
icon: import_lucide_react3.LayoutDashboard
|
|
1108
|
-
},
|
|
1109
|
-
{
|
|
1110
|
-
page: "threads",
|
|
1111
|
-
label: "Threads",
|
|
1112
|
-
icon: import_lucide_react3.MessageSquare,
|
|
1113
|
-
featureKey: "showThreads"
|
|
1114
|
-
},
|
|
1115
|
-
{
|
|
1116
|
-
page: "participants",
|
|
1117
|
-
label: "Participants",
|
|
1118
|
-
icon: import_lucide_react3.Users,
|
|
1119
|
-
featureKey: "showParticipants"
|
|
1120
|
-
},
|
|
1121
|
-
{
|
|
1122
|
-
page: "agents",
|
|
1123
|
-
label: "Agents",
|
|
1124
|
-
icon: import_lucide_react3.Bot,
|
|
1125
|
-
featureKey: "showAgents"
|
|
1126
|
-
},
|
|
1127
|
-
{
|
|
1128
|
-
page: "events",
|
|
1129
|
-
label: "Events",
|
|
1130
|
-
icon: import_lucide_react3.Activity,
|
|
1131
|
-
featureKey: "showEvents"
|
|
1132
|
-
}
|
|
1133
|
-
];
|
|
1134
|
-
var AdminSidebar = ({
|
|
1135
|
-
config,
|
|
1136
|
-
currentPage,
|
|
1137
|
-
onNavigate
|
|
1138
|
-
}) => {
|
|
1139
|
-
const visibleItems = NAV_ITEMS.filter(
|
|
1140
|
-
(item) => !item.featureKey || config.features[item.featureKey]
|
|
1141
|
-
);
|
|
1142
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Sidebar, { collapsible: config.sidebar.collapsible, children: [
|
|
1143
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SidebarHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-3 px-2 py-3", children: [
|
|
1144
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-center shrink-0", children: config.branding.logo || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-primary-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.LayoutDashboard, { className: "h-4 w-4" }) }) }),
|
|
1145
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col min-w-0 group-data-[collapsible=icon]:hidden", children: [
|
|
1146
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-sm font-semibold truncate", children: config.branding.title }),
|
|
1147
|
-
config.branding.subtitle && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-xs text-muted-foreground truncate", children: config.branding.subtitle })
|
|
1148
|
-
] })
|
|
1149
|
-
] }) }),
|
|
1150
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SidebarContent, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(SidebarGroup, { children: [
|
|
1151
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: "Navigation" }),
|
|
1152
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SidebarGroupContent, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SidebarMenu, { children: visibleItems.map((item) => {
|
|
1153
|
-
const Icon2 = item.icon;
|
|
1154
|
-
const label = config.labels[`${item.page}Title`] || item.label;
|
|
1155
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SidebarMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1156
|
-
SidebarMenuButton,
|
|
1157
|
-
{
|
|
1158
|
-
isActive: currentPage === item.page,
|
|
1159
|
-
onClick: () => onNavigate(item.page),
|
|
1160
|
-
tooltip: label,
|
|
1161
|
-
children: [
|
|
1162
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon2, {}),
|
|
1163
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: label })
|
|
1164
|
-
]
|
|
1165
|
-
}
|
|
1166
|
-
) }, item.page);
|
|
1167
|
-
}) }) })
|
|
1168
|
-
] }) }),
|
|
1169
|
-
config.namespace && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SidebarFooter, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "px-2 py-2 text-xs text-muted-foreground group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-medium uppercase tracking-[0.18em]", children: config.namespace }) }) }),
|
|
1170
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SidebarRail, {})
|
|
1171
|
-
] });
|
|
1172
|
-
};
|
|
1173
|
-
|
|
1174
|
-
// src/components/layout/AdminHeader.tsx
|
|
1175
|
-
var import_lucide_react5 = require("lucide-react");
|
|
1267
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1176
1268
|
|
|
1177
1269
|
// src/components/ui/select.tsx
|
|
1178
1270
|
var React4 = __toESM(require("react"), 1);
|
|
1179
1271
|
var SelectPrimitive = __toESM(require("@radix-ui/react-select"), 1);
|
|
1180
|
-
var
|
|
1272
|
+
var import_lucide_react3 = require("lucide-react");
|
|
1181
1273
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1182
1274
|
var Select = SelectPrimitive.Root;
|
|
1183
1275
|
var SelectValue = SelectPrimitive.Value;
|
|
@@ -1192,7 +1284,7 @@ var SelectTrigger = React4.forwardRef(({ className, children, ...props }, ref) =
|
|
|
1192
1284
|
...props,
|
|
1193
1285
|
children: [
|
|
1194
1286
|
children,
|
|
1195
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1287
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ChevronDown, { className: "h-4 w-4 opacity-50" }) })
|
|
1196
1288
|
]
|
|
1197
1289
|
}
|
|
1198
1290
|
));
|
|
@@ -1209,7 +1301,7 @@ var SelectContent = React4.forwardRef(({ className, children, position = "popper
|
|
|
1209
1301
|
position,
|
|
1210
1302
|
...props,
|
|
1211
1303
|
children: [
|
|
1212
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectPrimitive.ScrollUpButton, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1304
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectPrimitive.ScrollUpButton, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ChevronUp, { className: "h-4 w-4" }) }),
|
|
1213
1305
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1214
1306
|
SelectPrimitive.Viewport,
|
|
1215
1307
|
{
|
|
@@ -1220,7 +1312,7 @@ var SelectContent = React4.forwardRef(({ className, children, position = "popper
|
|
|
1220
1312
|
children
|
|
1221
1313
|
}
|
|
1222
1314
|
),
|
|
1223
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectPrimitive.ScrollDownButton, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1315
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectPrimitive.ScrollDownButton, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ChevronDown, { className: "h-4 w-4" }) })
|
|
1224
1316
|
]
|
|
1225
1317
|
}
|
|
1226
1318
|
) }));
|
|
@@ -1236,25 +1328,117 @@ var SelectItem = React4.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
1236
1328
|
...props,
|
|
1237
1329
|
children: [
|
|
1238
1330
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectPrimitive.ItemText, { children }),
|
|
1239
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectPrimitive.ItemIndicator, { className: "absolute right-2 inline-flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1331
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectPrimitive.ItemIndicator, { className: "absolute right-2 inline-flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Check, { className: "h-4 w-4" }) })
|
|
1240
1332
|
]
|
|
1241
1333
|
}
|
|
1242
1334
|
));
|
|
1243
1335
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
1244
1336
|
|
|
1245
|
-
// src/components/layout/
|
|
1337
|
+
// src/components/layout/AdminSidebar.tsx
|
|
1246
1338
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1339
|
+
var NAV_ITEMS = [
|
|
1340
|
+
{ page: "dashboard", label: "Dashboard", icon: import_lucide_react4.LayoutDashboard },
|
|
1341
|
+
{ page: "threads", label: "Threads", icon: import_lucide_react4.MessageSquare, featureKey: "showThreads" },
|
|
1342
|
+
{ page: "participants", label: "Participants", icon: import_lucide_react4.Users, featureKey: "showParticipants" },
|
|
1343
|
+
{ page: "agents", label: "Agents", icon: import_lucide_react4.Bot, featureKey: "showAgents" },
|
|
1344
|
+
{ page: "events", label: "Events", icon: import_lucide_react4.Activity, featureKey: "showEvents" }
|
|
1345
|
+
];
|
|
1346
|
+
var AdminSidebar = ({
|
|
1347
|
+
config,
|
|
1348
|
+
currentPage,
|
|
1349
|
+
currentRoute,
|
|
1350
|
+
onNavigate,
|
|
1351
|
+
onNavigateRoute,
|
|
1352
|
+
collections,
|
|
1353
|
+
namespace,
|
|
1354
|
+
onNamespaceChange
|
|
1355
|
+
}) => {
|
|
1356
|
+
const visibleItems = NAV_ITEMS.filter(
|
|
1357
|
+
(item) => !item.featureKey || config.features[item.featureKey]
|
|
1358
|
+
);
|
|
1359
|
+
const showCollections = config.features.showCollections && collections.length > 0;
|
|
1360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Sidebar, { collapsible: config.sidebar.collapsible, children: [
|
|
1361
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SidebarHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3 px-2 py-3", children: [
|
|
1362
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center justify-center shrink-0", children: config.branding.logo || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-primary-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.LayoutDashboard, { className: "h-4 w-4" }) }) }),
|
|
1363
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col min-w-0 group-data-[collapsible=icon]:hidden", children: [
|
|
1364
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-semibold truncate", children: config.branding.title }),
|
|
1365
|
+
config.branding.subtitle && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-muted-foreground truncate", children: config.branding.subtitle })
|
|
1366
|
+
] })
|
|
1367
|
+
] }) }),
|
|
1368
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(SidebarContent, { children: [
|
|
1369
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(SidebarGroup, { children: [
|
|
1370
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: "Navigation" }),
|
|
1371
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SidebarGroupContent, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SidebarMenu, { children: visibleItems.map((item) => {
|
|
1372
|
+
const Icon2 = item.icon;
|
|
1373
|
+
const label = config.labels[`${item.page}Title`] || item.label;
|
|
1374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SidebarMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1375
|
+
SidebarMenuButton,
|
|
1376
|
+
{
|
|
1377
|
+
isActive: currentPage === item.page,
|
|
1378
|
+
onClick: () => onNavigate(item.page),
|
|
1379
|
+
tooltip: label,
|
|
1380
|
+
children: [
|
|
1381
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon2, {}),
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: label })
|
|
1383
|
+
]
|
|
1384
|
+
}
|
|
1385
|
+
) }, item.page);
|
|
1386
|
+
}) }) })
|
|
1387
|
+
] }),
|
|
1388
|
+
showCollections && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SidebarSeparator, {}),
|
|
1390
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(SidebarGroup, { children: [
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: config.labels.collectionsTitle }),
|
|
1392
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SidebarGroupContent, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SidebarMenu, { children: collections.map((col) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SidebarMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1393
|
+
SidebarMenuButton,
|
|
1394
|
+
{
|
|
1395
|
+
isActive: currentRoute.page === "collection-items" && currentRoute.collection === col,
|
|
1396
|
+
onClick: () => onNavigateRoute({ page: "collection-items", collection: col }),
|
|
1397
|
+
tooltip: col,
|
|
1398
|
+
children: [
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Database, {}),
|
|
1400
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "capitalize", children: col })
|
|
1401
|
+
]
|
|
1402
|
+
}
|
|
1403
|
+
) }, col)) }) })
|
|
1404
|
+
] })
|
|
1405
|
+
] })
|
|
1406
|
+
] }),
|
|
1407
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(SidebarFooter, { children: [
|
|
1408
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "group-data-[collapsible=icon]:hidden", children: [
|
|
1409
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "text-xs font-medium text-muted-foreground mb-1 block px-2", children: "Namespace" }),
|
|
1410
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Select, { value: namespace || "__all__", onValueChange: (v) => onNamespaceChange(v === "__all__" ? "" : v), children: [
|
|
1411
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectValue, { placeholder: "All namespaces" }) }),
|
|
1412
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(SelectContent, { children: [
|
|
1413
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectItem, { value: "__all__", children: "All namespaces" }),
|
|
1414
|
+
config.namespace && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectItem, { value: config.namespace, children: config.namespace })
|
|
1415
|
+
] })
|
|
1416
|
+
] })
|
|
1417
|
+
] }),
|
|
1418
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "hidden group-data-[collapsible=icon]:flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.ChevronsUpDown, { className: "h-4 w-4 text-muted-foreground" }) })
|
|
1419
|
+
] }),
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SidebarRail, {})
|
|
1421
|
+
] });
|
|
1422
|
+
};
|
|
1423
|
+
|
|
1424
|
+
// src/components/layout/AdminHeader.tsx
|
|
1425
|
+
var import_lucide_react5 = require("lucide-react");
|
|
1426
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1247
1427
|
var PAGE_TITLES = {
|
|
1248
1428
|
dashboard: "Dashboard",
|
|
1249
1429
|
threads: "Threads",
|
|
1250
1430
|
"thread-detail": "Thread Detail",
|
|
1251
1431
|
participants: "Participants",
|
|
1432
|
+
"participant-detail": "Participant Detail",
|
|
1252
1433
|
agents: "Agents",
|
|
1434
|
+
"agent-detail": "Agent Detail",
|
|
1435
|
+
"collection-items": "Collection",
|
|
1436
|
+
"collection-item-detail": "Item Detail",
|
|
1253
1437
|
events: "Events"
|
|
1254
1438
|
};
|
|
1255
1439
|
var AdminHeader = ({
|
|
1256
1440
|
config,
|
|
1257
|
-
|
|
1441
|
+
currentRoute,
|
|
1258
1442
|
range,
|
|
1259
1443
|
interval,
|
|
1260
1444
|
onRangeChange,
|
|
@@ -1262,19 +1446,22 @@ var AdminHeader = ({
|
|
|
1262
1446
|
onRefresh,
|
|
1263
1447
|
isLoading
|
|
1264
1448
|
}) => {
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1449
|
+
let pageTitle = config.labels[`${currentRoute.page}Title`] || PAGE_TITLES[currentRoute.page] || currentRoute.page;
|
|
1450
|
+
if (currentRoute.page === "collection-items" && currentRoute.collection) {
|
|
1451
|
+
pageTitle = currentRoute.collection.charAt(0).toUpperCase() + currentRoute.collection.slice(1);
|
|
1452
|
+
}
|
|
1453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Card, { className: "py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CardHeader, { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1455
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Tooltip, { children: [
|
|
1456
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SidebarTrigger, { className: "-ml-1" }) }),
|
|
1457
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipContent, { children: "Toggle Sidebar" })
|
|
1271
1458
|
] }),
|
|
1272
|
-
/* @__PURE__ */ (0,
|
|
1459
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { className: "text-sm font-medium ml-2", children: pageTitle })
|
|
1273
1460
|
] }),
|
|
1274
|
-
/* @__PURE__ */ (0,
|
|
1275
|
-
/* @__PURE__ */ (0,
|
|
1276
|
-
|
|
1277
|
-
/* @__PURE__ */ (0,
|
|
1461
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex-1" }),
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1463
|
+
currentRoute.page === "dashboard" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1278
1465
|
Button,
|
|
1279
1466
|
{
|
|
1280
1467
|
variant: range === "24h" ? "default" : "ghost",
|
|
@@ -1284,7 +1471,7 @@ var AdminHeader = ({
|
|
|
1284
1471
|
children: config.labels.range24h
|
|
1285
1472
|
}
|
|
1286
1473
|
),
|
|
1287
|
-
/* @__PURE__ */ (0,
|
|
1474
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1288
1475
|
Button,
|
|
1289
1476
|
{
|
|
1290
1477
|
variant: range === "7d" ? "default" : "ghost",
|
|
@@ -1294,7 +1481,7 @@ var AdminHeader = ({
|
|
|
1294
1481
|
children: config.labels.range7d
|
|
1295
1482
|
}
|
|
1296
1483
|
),
|
|
1297
|
-
/* @__PURE__ */ (0,
|
|
1484
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1298
1485
|
Button,
|
|
1299
1486
|
{
|
|
1300
1487
|
variant: range === "30d" ? "default" : "ghost",
|
|
@@ -1304,23 +1491,23 @@ var AdminHeader = ({
|
|
|
1304
1491
|
children: config.labels.range30d
|
|
1305
1492
|
}
|
|
1306
1493
|
),
|
|
1307
|
-
/* @__PURE__ */ (0,
|
|
1494
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1308
1495
|
Select,
|
|
1309
1496
|
{
|
|
1310
1497
|
value: interval,
|
|
1311
1498
|
onValueChange: (v) => onIntervalChange(v),
|
|
1312
1499
|
children: [
|
|
1313
|
-
/* @__PURE__ */ (0,
|
|
1314
|
-
/* @__PURE__ */ (0,
|
|
1315
|
-
/* @__PURE__ */ (0,
|
|
1316
|
-
/* @__PURE__ */ (0,
|
|
1500
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SelectTrigger, { className: "h-7 w-[90px] text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SelectValue, {}) }),
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(SelectContent, { children: [
|
|
1502
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SelectItem, { value: "hour", children: config.labels.intervalHour }),
|
|
1503
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SelectItem, { value: "day", children: config.labels.intervalDay })
|
|
1317
1504
|
] })
|
|
1318
1505
|
]
|
|
1319
1506
|
}
|
|
1320
1507
|
)
|
|
1321
1508
|
] }),
|
|
1322
|
-
/* @__PURE__ */ (0,
|
|
1323
|
-
/* @__PURE__ */ (0,
|
|
1509
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Tooltip, { children: [
|
|
1510
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1324
1511
|
Button,
|
|
1325
1512
|
{
|
|
1326
1513
|
variant: "ghost",
|
|
@@ -1328,7 +1515,7 @@ var AdminHeader = ({
|
|
|
1328
1515
|
className: "h-7 w-7",
|
|
1329
1516
|
onClick: onRefresh,
|
|
1330
1517
|
disabled: isLoading,
|
|
1331
|
-
children: /* @__PURE__ */ (0,
|
|
1518
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1332
1519
|
import_lucide_react5.RefreshCw,
|
|
1333
1520
|
{
|
|
1334
1521
|
className: `h-4 w-4 ${isLoading ? "animate-spin" : ""}`
|
|
@@ -1336,7 +1523,7 @@ var AdminHeader = ({
|
|
|
1336
1523
|
)
|
|
1337
1524
|
}
|
|
1338
1525
|
) }),
|
|
1339
|
-
/* @__PURE__ */ (0,
|
|
1526
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipContent, { children: config.labels.refresh })
|
|
1340
1527
|
] }),
|
|
1341
1528
|
config.branding.actions
|
|
1342
1529
|
] })
|
|
@@ -1346,7 +1533,7 @@ var AdminHeader = ({
|
|
|
1346
1533
|
// src/components/ui/badge.tsx
|
|
1347
1534
|
var import_react_slot3 = require("@radix-ui/react-slot");
|
|
1348
1535
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
1349
|
-
var
|
|
1536
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1350
1537
|
var badgeVariants = (0, import_class_variance_authority3.cva)(
|
|
1351
1538
|
"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
1352
1539
|
{
|
|
@@ -1370,7 +1557,7 @@ function Badge({
|
|
|
1370
1557
|
...props
|
|
1371
1558
|
}) {
|
|
1372
1559
|
const Comp = asChild ? import_react_slot3.Slot : "span";
|
|
1373
|
-
return /* @__PURE__ */ (0,
|
|
1560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1374
1561
|
Comp,
|
|
1375
1562
|
{
|
|
1376
1563
|
"data-slot": "badge",
|
|
@@ -1381,7 +1568,7 @@ function Badge({
|
|
|
1381
1568
|
}
|
|
1382
1569
|
|
|
1383
1570
|
// src/components/views/DashboardView.tsx
|
|
1384
|
-
var
|
|
1571
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1385
1572
|
var DashboardView = ({
|
|
1386
1573
|
config,
|
|
1387
1574
|
overview,
|
|
@@ -1426,29 +1613,29 @@ var DashboardView = ({
|
|
|
1426
1613
|
}
|
|
1427
1614
|
];
|
|
1428
1615
|
const isEmpty = cards.every((card) => card.value === 0) && activity.length === 0 && threads.length === 0 && participants.length === 0 && agents.length === 0;
|
|
1429
|
-
return /* @__PURE__ */ (0,
|
|
1430
|
-
isEmpty && /* @__PURE__ */ (0,
|
|
1431
|
-
/* @__PURE__ */ (0,
|
|
1432
|
-
/* @__PURE__ */ (0,
|
|
1616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-6", children: [
|
|
1617
|
+
isEmpty && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-lg font-semibold", children: config.labels.emptyTitle }),
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-2 text-sm text-muted-foreground", children: config.labels.emptyDescription })
|
|
1433
1620
|
] }),
|
|
1434
|
-
config.features.showOverview && /* @__PURE__ */ (0,
|
|
1435
|
-
/* @__PURE__ */ (0,
|
|
1436
|
-
/* @__PURE__ */ (0,
|
|
1621
|
+
config.features.showOverview && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { className: "space-y-4", children: [
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SectionHeading, { title: config.labels.overviewTitle }),
|
|
1623
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-5", children: cards.map((card) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1437
1624
|
"div",
|
|
1438
1625
|
{
|
|
1439
1626
|
className: "rounded-xl border bg-card p-5 shadow-sm",
|
|
1440
1627
|
children: [
|
|
1441
|
-
/* @__PURE__ */ (0,
|
|
1442
|
-
/* @__PURE__ */ (0,
|
|
1443
|
-
/* @__PURE__ */ (0,
|
|
1628
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm font-medium text-muted-foreground", children: card.label }),
|
|
1629
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-3 text-3xl font-semibold tracking-tight", children: formatNumber(card.value) }),
|
|
1630
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-2 text-xs text-muted-foreground", children: card.detail })
|
|
1444
1631
|
]
|
|
1445
1632
|
},
|
|
1446
1633
|
card.label
|
|
1447
1634
|
)) })
|
|
1448
1635
|
] }),
|
|
1449
|
-
config.features.showActivity && /* @__PURE__ */ (0,
|
|
1450
|
-
/* @__PURE__ */ (0,
|
|
1451
|
-
/* @__PURE__ */ (0,
|
|
1636
|
+
config.features.showActivity && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { className: "space-y-4", children: [
|
|
1637
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SectionHeading, { title: config.labels.activityTitle }),
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1452
1639
|
ActivityChart,
|
|
1453
1640
|
{
|
|
1454
1641
|
interval,
|
|
@@ -1458,8 +1645,8 @@ var DashboardView = ({
|
|
|
1458
1645
|
}
|
|
1459
1646
|
)
|
|
1460
1647
|
] }),
|
|
1461
|
-
/* @__PURE__ */ (0,
|
|
1462
|
-
config.features.showThreads && /* @__PURE__ */ (0,
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid gap-6 lg:grid-cols-3", children: [
|
|
1649
|
+
config.features.showThreads && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1463
1650
|
DataTable,
|
|
1464
1651
|
{
|
|
1465
1652
|
rows: threads,
|
|
@@ -1467,7 +1654,7 @@ var DashboardView = ({
|
|
|
1467
1654
|
searchValue: threadSearch,
|
|
1468
1655
|
setSearchValue: onThreadSearchChange,
|
|
1469
1656
|
title: config.labels.threadsTitle,
|
|
1470
|
-
children: /* @__PURE__ */ (0,
|
|
1657
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1471
1658
|
ThreadsTable,
|
|
1472
1659
|
{
|
|
1473
1660
|
rows: threads,
|
|
@@ -1477,7 +1664,7 @@ var DashboardView = ({
|
|
|
1477
1664
|
)
|
|
1478
1665
|
}
|
|
1479
1666
|
),
|
|
1480
|
-
config.features.showParticipants && /* @__PURE__ */ (0,
|
|
1667
|
+
config.features.showParticipants && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1481
1668
|
DataTable,
|
|
1482
1669
|
{
|
|
1483
1670
|
rows: participants,
|
|
@@ -1485,10 +1672,10 @@ var DashboardView = ({
|
|
|
1485
1672
|
searchValue: participantSearch,
|
|
1486
1673
|
setSearchValue: onParticipantSearchChange,
|
|
1487
1674
|
title: config.labels.participantsTitle,
|
|
1488
|
-
children: /* @__PURE__ */ (0,
|
|
1675
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ParticipantsTable, { rows: participants, labels: config.labels })
|
|
1489
1676
|
}
|
|
1490
1677
|
),
|
|
1491
|
-
config.features.showAgents && /* @__PURE__ */ (0,
|
|
1678
|
+
config.features.showAgents && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1492
1679
|
DataTable,
|
|
1493
1680
|
{
|
|
1494
1681
|
rows: agents,
|
|
@@ -1496,14 +1683,14 @@ var DashboardView = ({
|
|
|
1496
1683
|
searchValue: agentSearch,
|
|
1497
1684
|
setSearchValue: onAgentSearchChange,
|
|
1498
1685
|
title: config.labels.agentsTitle,
|
|
1499
|
-
children: /* @__PURE__ */ (0,
|
|
1686
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AgentsTable, { rows: agents, labels: config.labels })
|
|
1500
1687
|
}
|
|
1501
1688
|
)
|
|
1502
1689
|
] })
|
|
1503
1690
|
] });
|
|
1504
1691
|
};
|
|
1505
1692
|
function SectionHeading({ title }) {
|
|
1506
|
-
return /* @__PURE__ */ (0,
|
|
1693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-lg font-semibold tracking-tight", children: title });
|
|
1507
1694
|
}
|
|
1508
1695
|
function ActivityChart(props) {
|
|
1509
1696
|
const trimmedPoints = props.points.slice(-props.maxBars);
|
|
@@ -1511,12 +1698,12 @@ function ActivityChart(props) {
|
|
|
1511
1698
|
...trimmedPoints.map((point) => point.messageCount),
|
|
1512
1699
|
1
|
|
1513
1700
|
);
|
|
1514
|
-
return /* @__PURE__ */ (0,
|
|
1701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "rounded-xl border bg-card p-5 shadow-sm", children: trimmedPoints.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm text-muted-foreground", children: props.labels.noResults }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex min-h-48 items-end gap-2", children: trimmedPoints.map((point) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1515
1702
|
"div",
|
|
1516
1703
|
{
|
|
1517
1704
|
className: "flex min-w-0 flex-1 flex-col items-center gap-2",
|
|
1518
1705
|
children: [
|
|
1519
|
-
/* @__PURE__ */ (0,
|
|
1706
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex h-36 w-full items-end rounded-lg bg-muted px-1 pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1520
1707
|
"div",
|
|
1521
1708
|
{
|
|
1522
1709
|
className: "w-full rounded-md bg-primary transition-all",
|
|
@@ -1525,9 +1712,9 @@ function ActivityChart(props) {
|
|
|
1525
1712
|
}
|
|
1526
1713
|
}
|
|
1527
1714
|
) }),
|
|
1528
|
-
/* @__PURE__ */ (0,
|
|
1529
|
-
/* @__PURE__ */ (0,
|
|
1530
|
-
/* @__PURE__ */ (0,
|
|
1715
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-center", children: [
|
|
1716
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs font-medium", children: formatBucket(point.bucket, props.interval) }),
|
|
1717
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
1531
1718
|
formatNumber(point.messageCount),
|
|
1532
1719
|
" msg"
|
|
1533
1720
|
] })
|
|
@@ -1538,10 +1725,10 @@ function ActivityChart(props) {
|
|
|
1538
1725
|
)) }) });
|
|
1539
1726
|
}
|
|
1540
1727
|
function DataTable(props) {
|
|
1541
|
-
return /* @__PURE__ */ (0,
|
|
1542
|
-
/* @__PURE__ */ (0,
|
|
1543
|
-
/* @__PURE__ */ (0,
|
|
1544
|
-
/* @__PURE__ */ (0,
|
|
1728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "rounded-xl border bg-card p-5 shadow-sm", children: [
|
|
1729
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mb-4 flex items-center justify-between gap-3", children: [
|
|
1730
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SectionHeading, { title: props.title }),
|
|
1731
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1545
1732
|
Input,
|
|
1546
1733
|
{
|
|
1547
1734
|
className: "h-8 w-full max-w-44",
|
|
@@ -1551,7 +1738,7 @@ function DataTable(props) {
|
|
|
1551
1738
|
}
|
|
1552
1739
|
)
|
|
1553
1740
|
] }),
|
|
1554
|
-
props.rows.length === 0 ? /* @__PURE__ */ (0,
|
|
1741
|
+
props.rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm text-muted-foreground", children: "No results" }) : props.children
|
|
1555
1742
|
] });
|
|
1556
1743
|
}
|
|
1557
1744
|
function ThreadsTable({
|
|
@@ -1559,7 +1746,7 @@ function ThreadsTable({
|
|
|
1559
1746
|
labels,
|
|
1560
1747
|
onThreadClick
|
|
1561
1748
|
}) {
|
|
1562
|
-
return /* @__PURE__ */ (0,
|
|
1749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "space-y-3", children: rows.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1563
1750
|
"div",
|
|
1564
1751
|
{
|
|
1565
1752
|
className: cn(
|
|
@@ -1568,12 +1755,12 @@ function ThreadsTable({
|
|
|
1568
1755
|
),
|
|
1569
1756
|
onClick: () => onThreadClick?.(thread.threadId),
|
|
1570
1757
|
children: [
|
|
1571
|
-
/* @__PURE__ */ (0,
|
|
1572
|
-
/* @__PURE__ */ (0,
|
|
1573
|
-
/* @__PURE__ */ (0,
|
|
1574
|
-
/* @__PURE__ */ (0,
|
|
1758
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
|
|
1759
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "min-w-0", children: [
|
|
1760
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "font-medium", children: thread.name }),
|
|
1761
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: thread.summary ?? thread.lastMessagePreview ?? "No summary yet" })
|
|
1575
1762
|
] }),
|
|
1576
|
-
/* @__PURE__ */ (0,
|
|
1763
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1577
1764
|
Badge,
|
|
1578
1765
|
{
|
|
1579
1766
|
variant: thread.status === "archived" ? "secondary" : "default",
|
|
@@ -1581,16 +1768,16 @@ function ThreadsTable({
|
|
|
1581
1768
|
}
|
|
1582
1769
|
)
|
|
1583
1770
|
] }),
|
|
1584
|
-
/* @__PURE__ */ (0,
|
|
1585
|
-
/* @__PURE__ */ (0,
|
|
1771
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground", children: [
|
|
1772
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
|
|
1586
1773
|
formatNumber(thread.messageCount),
|
|
1587
1774
|
" messages"
|
|
1588
1775
|
] }),
|
|
1589
|
-
/* @__PURE__ */ (0,
|
|
1776
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
|
|
1590
1777
|
thread.participantIds.length,
|
|
1591
1778
|
" participants"
|
|
1592
1779
|
] }),
|
|
1593
|
-
/* @__PURE__ */ (0,
|
|
1780
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: formatDate(thread.lastActivityAt) })
|
|
1594
1781
|
] })
|
|
1595
1782
|
]
|
|
1596
1783
|
},
|
|
@@ -1601,28 +1788,28 @@ function ParticipantsTable({
|
|
|
1601
1788
|
rows,
|
|
1602
1789
|
labels
|
|
1603
1790
|
}) {
|
|
1604
|
-
return /* @__PURE__ */ (0,
|
|
1791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "space-y-3", children: rows.map((participant) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1605
1792
|
"div",
|
|
1606
1793
|
{
|
|
1607
1794
|
className: "rounded-lg border bg-muted/50 p-4",
|
|
1608
1795
|
children: [
|
|
1609
|
-
/* @__PURE__ */ (0,
|
|
1610
|
-
/* @__PURE__ */ (0,
|
|
1611
|
-
/* @__PURE__ */ (0,
|
|
1612
|
-
/* @__PURE__ */ (0,
|
|
1796
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
|
|
1797
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "min-w-0", children: [
|
|
1798
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "font-medium", children: participant.displayName }),
|
|
1799
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-xs uppercase tracking-[0.18em] text-muted-foreground", children: participant.participantType })
|
|
1613
1800
|
] }),
|
|
1614
|
-
/* @__PURE__ */ (0,
|
|
1801
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "outline", children: participant.isGlobal ? labels.scopeGlobal : labels.scopeScoped })
|
|
1615
1802
|
] }),
|
|
1616
|
-
/* @__PURE__ */ (0,
|
|
1617
|
-
/* @__PURE__ */ (0,
|
|
1803
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground", children: [
|
|
1804
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
|
|
1618
1805
|
formatNumber(participant.messageCount),
|
|
1619
1806
|
" messages"
|
|
1620
1807
|
] }),
|
|
1621
|
-
/* @__PURE__ */ (0,
|
|
1808
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
|
|
1622
1809
|
formatNumber(participant.threadCount),
|
|
1623
1810
|
" threads"
|
|
1624
1811
|
] }),
|
|
1625
|
-
/* @__PURE__ */ (0,
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: formatDate(participant.lastActivityAt) })
|
|
1626
1813
|
] })
|
|
1627
1814
|
]
|
|
1628
1815
|
},
|
|
@@ -1633,32 +1820,32 @@ function AgentsTable({
|
|
|
1633
1820
|
rows,
|
|
1634
1821
|
labels
|
|
1635
1822
|
}) {
|
|
1636
|
-
return /* @__PURE__ */ (0,
|
|
1823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "space-y-3", children: rows.map((agent) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1637
1824
|
"div",
|
|
1638
1825
|
{
|
|
1639
1826
|
className: "rounded-lg border bg-muted/50 p-4",
|
|
1640
1827
|
children: [
|
|
1641
|
-
/* @__PURE__ */ (0,
|
|
1642
|
-
/* @__PURE__ */ (0,
|
|
1643
|
-
/* @__PURE__ */ (0,
|
|
1644
|
-
/* @__PURE__ */ (0,
|
|
1828
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
|
|
1829
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "min-w-0", children: [
|
|
1830
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "font-medium", children: agent.displayName }),
|
|
1831
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: agent.description ?? agent.agentId })
|
|
1645
1832
|
] }),
|
|
1646
|
-
/* @__PURE__ */ (0,
|
|
1833
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "outline", children: agent.isConfigured ? labels.configured : labels.unconfigured })
|
|
1647
1834
|
] }),
|
|
1648
|
-
/* @__PURE__ */ (0,
|
|
1649
|
-
/* @__PURE__ */ (0,
|
|
1835
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mt-3 grid grid-cols-2 gap-2 text-xs text-muted-foreground", children: [
|
|
1836
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
|
|
1650
1837
|
formatNumber(agent.messageCount),
|
|
1651
1838
|
" messages"
|
|
1652
1839
|
] }),
|
|
1653
|
-
/* @__PURE__ */ (0,
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
|
|
1654
1841
|
formatNumber(agent.llmCallCount),
|
|
1655
1842
|
" LLM calls"
|
|
1656
1843
|
] }),
|
|
1657
|
-
/* @__PURE__ */ (0,
|
|
1844
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
|
|
1658
1845
|
formatNumber(agent.toolCallMessageCount),
|
|
1659
1846
|
" tool calls"
|
|
1660
1847
|
] }),
|
|
1661
|
-
/* @__PURE__ */ (0,
|
|
1848
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
|
|
1662
1849
|
formatNumber(agent.totalTokens),
|
|
1663
1850
|
" tokens"
|
|
1664
1851
|
] })
|
|
@@ -1697,7 +1884,7 @@ function formatNumber(value) {
|
|
|
1697
1884
|
|
|
1698
1885
|
// src/components/views/ThreadsView.tsx
|
|
1699
1886
|
var import_lucide_react6 = require("lucide-react");
|
|
1700
|
-
var
|
|
1887
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1701
1888
|
var ThreadsView = ({
|
|
1702
1889
|
config,
|
|
1703
1890
|
threads,
|
|
@@ -1705,10 +1892,10 @@ var ThreadsView = ({
|
|
|
1705
1892
|
onSearchChange,
|
|
1706
1893
|
onThreadClick
|
|
1707
1894
|
}) => {
|
|
1708
|
-
return /* @__PURE__ */ (0,
|
|
1709
|
-
/* @__PURE__ */ (0,
|
|
1710
|
-
/* @__PURE__ */ (0,
|
|
1711
|
-
/* @__PURE__ */ (0,
|
|
1895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-4", children: [
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative max-w-sm", children: [
|
|
1897
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react6.Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
1898
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1712
1899
|
Input,
|
|
1713
1900
|
{
|
|
1714
1901
|
className: "pl-9",
|
|
@@ -1718,19 +1905,19 @@ var ThreadsView = ({
|
|
|
1718
1905
|
}
|
|
1719
1906
|
)
|
|
1720
1907
|
] }),
|
|
1721
|
-
threads.length === 0 ? /* @__PURE__ */ (0,
|
|
1722
|
-
/* @__PURE__ */ (0,
|
|
1723
|
-
/* @__PURE__ */ (0,
|
|
1724
|
-
] }) : /* @__PURE__ */ (0,
|
|
1908
|
+
threads.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
|
|
1909
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react6.MessageSquare, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "mt-3 text-sm text-muted-foreground", children: searchValue ? config.labels.noResults : config.labels.emptyDescription })
|
|
1911
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "space-y-2", children: threads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1725
1912
|
"div",
|
|
1726
1913
|
{
|
|
1727
1914
|
className: "flex items-center gap-4 rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50 cursor-pointer",
|
|
1728
1915
|
onClick: () => onThreadClick?.(thread.threadId),
|
|
1729
1916
|
children: [
|
|
1730
|
-
/* @__PURE__ */ (0,
|
|
1731
|
-
/* @__PURE__ */ (0,
|
|
1732
|
-
/* @__PURE__ */ (0,
|
|
1733
|
-
/* @__PURE__ */ (0,
|
|
1917
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
1918
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "font-medium truncate", children: thread.name }),
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1734
1921
|
Badge,
|
|
1735
1922
|
{
|
|
1736
1923
|
variant: thread.status === "archived" ? "secondary" : "default",
|
|
@@ -1739,18 +1926,18 @@ var ThreadsView = ({
|
|
|
1739
1926
|
}
|
|
1740
1927
|
)
|
|
1741
1928
|
] }),
|
|
1742
|
-
/* @__PURE__ */ (0,
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "mt-1 text-sm text-muted-foreground truncate", children: thread.summary ?? thread.lastMessagePreview ?? "No summary yet" })
|
|
1743
1930
|
] }),
|
|
1744
|
-
/* @__PURE__ */ (0,
|
|
1745
|
-
/* @__PURE__ */ (0,
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "text-right text-xs text-muted-foreground shrink-0 space-y-1", children: [
|
|
1932
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { children: [
|
|
1746
1933
|
formatNumber2(thread.messageCount),
|
|
1747
1934
|
" messages"
|
|
1748
1935
|
] }),
|
|
1749
|
-
/* @__PURE__ */ (0,
|
|
1936
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { children: [
|
|
1750
1937
|
thread.participantIds.length,
|
|
1751
1938
|
" participants"
|
|
1752
1939
|
] }),
|
|
1753
|
-
/* @__PURE__ */ (0,
|
|
1940
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: formatDate2(thread.lastActivityAt) })
|
|
1754
1941
|
] })
|
|
1755
1942
|
]
|
|
1756
1943
|
},
|
|
@@ -1776,7 +1963,7 @@ function formatNumber2(value) {
|
|
|
1776
1963
|
// src/components/views/ThreadDetailView.tsx
|
|
1777
1964
|
var import_react2 = require("react");
|
|
1778
1965
|
var import_lucide_react7 = require("lucide-react");
|
|
1779
|
-
var
|
|
1966
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1780
1967
|
var MESSAGES_PAGE_SIZE = 50;
|
|
1781
1968
|
var ThreadDetailView = ({
|
|
1782
1969
|
threadId,
|
|
@@ -1834,36 +2021,36 @@ var ThreadDetailView = ({
|
|
|
1834
2021
|
}
|
|
1835
2022
|
}, [threadId, pageInfo, isLoadingMore, config.baseUrl, config.getRequestHeaders]);
|
|
1836
2023
|
if (isLoading) {
|
|
1837
|
-
return /* @__PURE__ */ (0,
|
|
2024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
|
|
1838
2025
|
}
|
|
1839
2026
|
if (error) {
|
|
1840
|
-
return /* @__PURE__ */ (0,
|
|
1841
|
-
/* @__PURE__ */ (0,
|
|
1842
|
-
/* @__PURE__ */ (0,
|
|
1843
|
-
/* @__PURE__ */ (0,
|
|
1844
|
-
/* @__PURE__ */ (0,
|
|
2027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-4 py-10 text-center", children: [
|
|
2028
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-destructive font-medium", children: error.message }),
|
|
2029
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex justify-center gap-2", children: [
|
|
2030
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Button, { variant: "outline", onClick: onBack, children: [
|
|
2031
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.ArrowLeft, { className: "mr-2 h-4 w-4" }),
|
|
1845
2032
|
"Back"
|
|
1846
2033
|
] }),
|
|
1847
|
-
/* @__PURE__ */ (0,
|
|
2034
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { variant: "destructive", onClick: () => void loadInitial(), children: config.labels.retry })
|
|
1848
2035
|
] })
|
|
1849
2036
|
] });
|
|
1850
2037
|
}
|
|
1851
|
-
return /* @__PURE__ */ (0,
|
|
1852
|
-
/* @__PURE__ */ (0,
|
|
1853
|
-
/* @__PURE__ */ (0,
|
|
2038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-6", children: [
|
|
2039
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-start gap-4", children: [
|
|
2040
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1854
2041
|
Button,
|
|
1855
2042
|
{
|
|
1856
2043
|
variant: "ghost",
|
|
1857
2044
|
size: "icon",
|
|
1858
2045
|
className: "mt-1 shrink-0",
|
|
1859
2046
|
onClick: onBack,
|
|
1860
|
-
children: /* @__PURE__ */ (0,
|
|
2047
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.ArrowLeft, { className: "h-4 w-4" })
|
|
1861
2048
|
}
|
|
1862
2049
|
),
|
|
1863
|
-
/* @__PURE__ */ (0,
|
|
1864
|
-
/* @__PURE__ */ (0,
|
|
1865
|
-
/* @__PURE__ */ (0,
|
|
1866
|
-
/* @__PURE__ */ (0,
|
|
2050
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
2051
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2052
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h2", { className: "text-xl font-semibold truncate", children: thread?.name ?? threadId }),
|
|
2053
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1867
2054
|
Badge,
|
|
1868
2055
|
{
|
|
1869
2056
|
variant: thread?.status === "archived" ? "secondary" : "default",
|
|
@@ -1871,31 +2058,31 @@ var ThreadDetailView = ({
|
|
|
1871
2058
|
}
|
|
1872
2059
|
)
|
|
1873
2060
|
] }),
|
|
1874
|
-
thread?.summary && /* @__PURE__ */ (0,
|
|
1875
|
-
/* @__PURE__ */ (0,
|
|
1876
|
-
thread?.createdAt && /* @__PURE__ */ (0,
|
|
2061
|
+
thread?.summary && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "mt-1 text-sm text-muted-foreground", children: thread.summary }),
|
|
2062
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mt-2 flex flex-wrap gap-4 text-xs text-muted-foreground", children: [
|
|
2063
|
+
thread?.createdAt && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { children: [
|
|
1877
2064
|
"Created ",
|
|
1878
2065
|
formatDate3(thread.createdAt)
|
|
1879
2066
|
] }),
|
|
1880
|
-
thread?.updatedAt && /* @__PURE__ */ (0,
|
|
2067
|
+
thread?.updatedAt && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { children: [
|
|
1881
2068
|
"Updated ",
|
|
1882
2069
|
formatDate3(thread.updatedAt)
|
|
1883
2070
|
] }),
|
|
1884
|
-
thread?.participants && /* @__PURE__ */ (0,
|
|
2071
|
+
thread?.participants && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { children: [
|
|
1885
2072
|
thread.participants.length,
|
|
1886
2073
|
" participants"
|
|
1887
2074
|
] })
|
|
1888
2075
|
] })
|
|
1889
2076
|
] })
|
|
1890
2077
|
] }),
|
|
1891
|
-
/* @__PURE__ */ (0,
|
|
1892
|
-
/* @__PURE__ */ (0,
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1", children: [
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("h3", { className: "text-sm font-medium text-muted-foreground", children: [
|
|
1893
2080
|
"Messages (",
|
|
1894
2081
|
messages.length,
|
|
1895
2082
|
pageInfo?.hasMoreBefore ? "+" : "",
|
|
1896
2083
|
")"
|
|
1897
2084
|
] }) }),
|
|
1898
|
-
pageInfo?.hasMoreBefore && /* @__PURE__ */ (0,
|
|
2085
|
+
pageInfo?.hasMoreBefore && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex justify-center py-2", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1899
2086
|
Button,
|
|
1900
2087
|
{
|
|
1901
2088
|
variant: "ghost",
|
|
@@ -1903,12 +2090,12 @@ var ThreadDetailView = ({
|
|
|
1903
2090
|
onClick: () => void loadMore(),
|
|
1904
2091
|
disabled: isLoadingMore,
|
|
1905
2092
|
children: [
|
|
1906
|
-
isLoadingMore ? /* @__PURE__ */ (0,
|
|
2093
|
+
isLoadingMore ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Loader2, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.ChevronUp, { className: "mr-2 h-3 w-3" }),
|
|
1907
2094
|
"Load older messages"
|
|
1908
2095
|
]
|
|
1909
2096
|
}
|
|
1910
2097
|
) }),
|
|
1911
|
-
/* @__PURE__ */ (0,
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "rounded-lg border bg-card", children: messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "p-6 text-center text-sm text-muted-foreground", children: "No messages in this thread yet." }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "divide-y", children: messages.map((message) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MessageRow, { message }, message.id)) }) })
|
|
1912
2099
|
] })
|
|
1913
2100
|
] });
|
|
1914
2101
|
};
|
|
@@ -1916,43 +2103,43 @@ function MessageRow({ message }) {
|
|
|
1916
2103
|
const [expanded, setExpanded] = (0, import_react2.useState)(false);
|
|
1917
2104
|
const hasToolCalls = Array.isArray(message.toolCalls) && message.toolCalls.length > 0;
|
|
1918
2105
|
const hasReasoning = !!message.reasoning;
|
|
1919
|
-
return /* @__PURE__ */ (0,
|
|
1920
|
-
/* @__PURE__ */ (0,
|
|
1921
|
-
/* @__PURE__ */ (0,
|
|
1922
|
-
/* @__PURE__ */ (0,
|
|
1923
|
-
/* @__PURE__ */ (0,
|
|
1924
|
-
/* @__PURE__ */ (0,
|
|
1925
|
-
message.createdAt && /* @__PURE__ */ (0,
|
|
2106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
2107
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SenderIcon, { senderType: message.senderType }),
|
|
2108
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
2109
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "font-medium", children: message.senderId ?? message.senderUserId ?? message.senderType }),
|
|
2111
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Badge, { variant: "outline", className: "text-[10px] px-1.5 py-0", children: message.senderType }),
|
|
2112
|
+
message.createdAt && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-muted-foreground", children: formatTimestamp(message.createdAt) })
|
|
1926
2113
|
] }),
|
|
1927
|
-
message.content && /* @__PURE__ */ (0,
|
|
1928
|
-
(hasToolCalls || hasReasoning) && /* @__PURE__ */ (0,
|
|
1929
|
-
hasToolCalls && /* @__PURE__ */ (0,
|
|
2114
|
+
message.content && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "mt-1 text-sm whitespace-pre-wrap break-words", children: message.content }),
|
|
2115
|
+
(hasToolCalls || hasReasoning) && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mt-2 space-y-2", children: [
|
|
2116
|
+
hasToolCalls && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1930
2117
|
"button",
|
|
1931
2118
|
{
|
|
1932
2119
|
type: "button",
|
|
1933
2120
|
onClick: () => setExpanded(!expanded),
|
|
1934
2121
|
className: "inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",
|
|
1935
2122
|
children: [
|
|
1936
|
-
/* @__PURE__ */ (0,
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Wrench, { className: "h-3 w-3" }),
|
|
1937
2124
|
message.toolCalls.length,
|
|
1938
2125
|
" tool call",
|
|
1939
2126
|
message.toolCalls.length > 1 ? "s" : ""
|
|
1940
2127
|
]
|
|
1941
2128
|
}
|
|
1942
2129
|
),
|
|
1943
|
-
hasReasoning && /* @__PURE__ */ (0,
|
|
2130
|
+
hasReasoning && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1944
2131
|
"button",
|
|
1945
2132
|
{
|
|
1946
2133
|
type: "button",
|
|
1947
2134
|
onClick: () => setExpanded(!expanded),
|
|
1948
2135
|
className: "inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",
|
|
1949
2136
|
children: [
|
|
1950
|
-
/* @__PURE__ */ (0,
|
|
2137
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Cpu, { className: "h-3 w-3" }),
|
|
1951
2138
|
"Reasoning"
|
|
1952
2139
|
]
|
|
1953
2140
|
}
|
|
1954
2141
|
),
|
|
1955
|
-
expanded && /* @__PURE__ */ (0,
|
|
2142
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("pre", { className: "mt-2 rounded-md bg-muted p-3 text-xs overflow-auto max-h-60", children: JSON.stringify(
|
|
1956
2143
|
{
|
|
1957
2144
|
...hasToolCalls ? { toolCalls: message.toolCalls } : {},
|
|
1958
2145
|
...hasReasoning ? { reasoning: message.reasoning } : {}
|
|
@@ -1968,13 +2155,13 @@ function SenderIcon({ senderType }) {
|
|
|
1968
2155
|
const base = "flex h-7 w-7 shrink-0 items-center justify-center rounded-full";
|
|
1969
2156
|
switch (senderType) {
|
|
1970
2157
|
case "agent":
|
|
1971
|
-
return /* @__PURE__ */ (0,
|
|
2158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn(base, "bg-primary/10 text-primary"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Bot, { className: "h-3.5 w-3.5" }) });
|
|
1972
2159
|
case "user":
|
|
1973
|
-
return /* @__PURE__ */ (0,
|
|
2160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn(base, "bg-secondary text-secondary-foreground"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.User, { className: "h-3.5 w-3.5" }) });
|
|
1974
2161
|
case "tool":
|
|
1975
|
-
return /* @__PURE__ */ (0,
|
|
2162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn(base, "bg-muted text-muted-foreground"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Wrench, { className: "h-3.5 w-3.5" }) });
|
|
1976
2163
|
default:
|
|
1977
|
-
return /* @__PURE__ */ (0,
|
|
2164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn(base, "bg-muted text-muted-foreground"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Cpu, { className: "h-3.5 w-3.5" }) });
|
|
1978
2165
|
}
|
|
1979
2166
|
}
|
|
1980
2167
|
function formatDate3(value) {
|
|
@@ -1998,79 +2185,737 @@ function formatTimestamp(value) {
|
|
|
1998
2185
|
});
|
|
1999
2186
|
}
|
|
2000
2187
|
|
|
2188
|
+
// src/components/views/ParticipantsView.tsx
|
|
2189
|
+
var import_lucide_react8 = require("lucide-react");
|
|
2190
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2191
|
+
var ParticipantsView = ({
|
|
2192
|
+
config,
|
|
2193
|
+
participants,
|
|
2194
|
+
searchValue,
|
|
2195
|
+
onSearchChange,
|
|
2196
|
+
onParticipantClick
|
|
2197
|
+
}) => {
|
|
2198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-4", children: [
|
|
2199
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative max-w-sm", children: [
|
|
2200
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react8.Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
2201
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2202
|
+
Input,
|
|
2203
|
+
{
|
|
2204
|
+
className: "pl-9",
|
|
2205
|
+
placeholder: config.labels.participantSearchPlaceholder,
|
|
2206
|
+
value: searchValue,
|
|
2207
|
+
onChange: (e) => onSearchChange(e.target.value)
|
|
2208
|
+
}
|
|
2209
|
+
)
|
|
2210
|
+
] }),
|
|
2211
|
+
participants.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
|
|
2212
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react8.Users, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
|
|
2213
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "mt-3 text-sm text-muted-foreground", children: searchValue ? config.labels.noResults : config.labels.emptyDescription })
|
|
2214
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "space-y-2", children: participants.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2215
|
+
"div",
|
|
2216
|
+
{
|
|
2217
|
+
className: "flex items-center gap-4 rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50 cursor-pointer",
|
|
2218
|
+
onClick: () => onParticipantClick?.(p.externalId),
|
|
2219
|
+
children: [
|
|
2220
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
2221
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2222
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "font-medium truncate", children: p.displayName }),
|
|
2223
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Badge, { variant: "outline", className: "shrink-0 text-xs", children: p.participantType }),
|
|
2224
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Badge, { variant: p.isGlobal ? "default" : "secondary", className: "shrink-0 text-xs", children: p.isGlobal ? config.labels.scopeGlobal : config.labels.scopeScoped })
|
|
2225
|
+
] }),
|
|
2226
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: p.externalId })
|
|
2227
|
+
] }),
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "text-right text-xs text-muted-foreground shrink-0 space-y-1", children: [
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { children: [
|
|
2230
|
+
formatNumber3(p.messageCount),
|
|
2231
|
+
" messages"
|
|
2232
|
+
] }),
|
|
2233
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { children: [
|
|
2234
|
+
formatNumber3(p.threadCount),
|
|
2235
|
+
" threads"
|
|
2236
|
+
] }),
|
|
2237
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: formatDate4(p.lastActivityAt) })
|
|
2238
|
+
] })
|
|
2239
|
+
]
|
|
2240
|
+
},
|
|
2241
|
+
`${p.namespace}:${p.externalId}`
|
|
2242
|
+
)) })
|
|
2243
|
+
] });
|
|
2244
|
+
};
|
|
2245
|
+
function formatDate4(value) {
|
|
2246
|
+
if (!value) return "No activity";
|
|
2247
|
+
const date = new Date(value);
|
|
2248
|
+
if (Number.isNaN(date.getTime())) return value;
|
|
2249
|
+
return date.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
|
|
2250
|
+
}
|
|
2251
|
+
function formatNumber3(value) {
|
|
2252
|
+
return new Intl.NumberFormat().format(value);
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
// src/components/views/ParticipantDetailView.tsx
|
|
2256
|
+
var import_react3 = require("react");
|
|
2257
|
+
var import_lucide_react9 = require("lucide-react");
|
|
2258
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2259
|
+
var ParticipantDetailView = ({
|
|
2260
|
+
participantId,
|
|
2261
|
+
config,
|
|
2262
|
+
onBack
|
|
2263
|
+
}) => {
|
|
2264
|
+
const [data, setData] = (0, import_react3.useState)(null);
|
|
2265
|
+
const [editJson, setEditJson] = (0, import_react3.useState)("");
|
|
2266
|
+
const [isLoading, setIsLoading] = (0, import_react3.useState)(true);
|
|
2267
|
+
const [isSaving, setIsSaving] = (0, import_react3.useState)(false);
|
|
2268
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
2269
|
+
const [saveMessage, setSaveMessage] = (0, import_react3.useState)(null);
|
|
2270
|
+
const fetchOptions = {
|
|
2271
|
+
baseUrl: config.baseUrl,
|
|
2272
|
+
getRequestHeaders: config.getRequestHeaders
|
|
2273
|
+
};
|
|
2274
|
+
const load = (0, import_react3.useCallback)(async () => {
|
|
2275
|
+
setIsLoading(true);
|
|
2276
|
+
setError(null);
|
|
2277
|
+
try {
|
|
2278
|
+
const result = await fetchParticipantDetail(participantId, fetchOptions);
|
|
2279
|
+
setData(result);
|
|
2280
|
+
setEditJson(JSON.stringify(result, null, 2));
|
|
2281
|
+
} catch (err) {
|
|
2282
|
+
setError(err instanceof Error ? err.message : "Failed to load participant");
|
|
2283
|
+
} finally {
|
|
2284
|
+
setIsLoading(false);
|
|
2285
|
+
}
|
|
2286
|
+
}, [participantId, config.baseUrl, config.getRequestHeaders]);
|
|
2287
|
+
(0, import_react3.useEffect)(() => {
|
|
2288
|
+
void load();
|
|
2289
|
+
}, [load]);
|
|
2290
|
+
const handleSave = async () => {
|
|
2291
|
+
setIsSaving(true);
|
|
2292
|
+
setError(null);
|
|
2293
|
+
setSaveMessage(null);
|
|
2294
|
+
try {
|
|
2295
|
+
const parsed = JSON.parse(editJson);
|
|
2296
|
+
const updated = await updateParticipant(participantId, parsed, fetchOptions);
|
|
2297
|
+
setData(updated);
|
|
2298
|
+
setEditJson(JSON.stringify(updated, null, 2));
|
|
2299
|
+
setSaveMessage("Saved successfully");
|
|
2300
|
+
setTimeout(() => setSaveMessage(null), 3e3);
|
|
2301
|
+
} catch (err) {
|
|
2302
|
+
setError(err instanceof Error ? err.message : "Failed to save");
|
|
2303
|
+
} finally {
|
|
2304
|
+
setIsSaving(false);
|
|
2305
|
+
}
|
|
2306
|
+
};
|
|
2307
|
+
if (isLoading) {
|
|
2308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react9.Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
|
|
2309
|
+
}
|
|
2310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-6", children: [
|
|
2311
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
2312
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { variant: "ghost", size: "icon", onClick: onBack, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react9.ArrowLeft, { className: "h-4 w-4" }) }),
|
|
2313
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
2314
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h2", { className: "text-xl font-semibold truncate", children: participantId }),
|
|
2315
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-sm text-muted-foreground", children: "Participant Detail" })
|
|
2316
|
+
] }),
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2318
|
+
saveMessage && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-xs text-emerald-600", children: saveMessage }),
|
|
2319
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Button, { size: "sm", onClick: () => void handleSave(), disabled: isSaving, children: [
|
|
2320
|
+
isSaving ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react9.Loader2, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react9.Save, { className: "mr-2 h-3 w-3" }),
|
|
2321
|
+
"Save"
|
|
2322
|
+
] })
|
|
2323
|
+
] })
|
|
2324
|
+
] }),
|
|
2325
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive", children: error }),
|
|
2326
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "rounded-lg border bg-card", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2327
|
+
"textarea",
|
|
2328
|
+
{
|
|
2329
|
+
className: "w-full min-h-[400px] p-4 font-mono text-sm bg-transparent resize-y focus:outline-none",
|
|
2330
|
+
value: editJson,
|
|
2331
|
+
onChange: (e) => setEditJson(e.target.value),
|
|
2332
|
+
spellCheck: false
|
|
2333
|
+
}
|
|
2334
|
+
) })
|
|
2335
|
+
] });
|
|
2336
|
+
};
|
|
2337
|
+
|
|
2338
|
+
// src/components/views/AgentsView.tsx
|
|
2339
|
+
var import_lucide_react10 = require("lucide-react");
|
|
2340
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2341
|
+
var AgentsView = ({
|
|
2342
|
+
config,
|
|
2343
|
+
agents,
|
|
2344
|
+
searchValue,
|
|
2345
|
+
onSearchChange,
|
|
2346
|
+
onAgentClick
|
|
2347
|
+
}) => {
|
|
2348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-4", children: [
|
|
2349
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "relative max-w-sm", children: [
|
|
2350
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react10.Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
2351
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2352
|
+
Input,
|
|
2353
|
+
{
|
|
2354
|
+
className: "pl-9",
|
|
2355
|
+
placeholder: config.labels.agentSearchPlaceholder,
|
|
2356
|
+
value: searchValue,
|
|
2357
|
+
onChange: (e) => onSearchChange(e.target.value)
|
|
2358
|
+
}
|
|
2359
|
+
)
|
|
2360
|
+
] }),
|
|
2361
|
+
agents.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
|
|
2362
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react10.Bot, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
|
|
2363
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "mt-3 text-sm text-muted-foreground", children: searchValue ? config.labels.noResults : config.labels.emptyDescription })
|
|
2364
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3", children: agents.map((agent) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2365
|
+
"div",
|
|
2366
|
+
{
|
|
2367
|
+
className: "rounded-lg border bg-card p-5 transition-colors hover:bg-muted/50 cursor-pointer",
|
|
2368
|
+
onClick: () => onAgentClick?.(agent.agentId),
|
|
2369
|
+
children: [
|
|
2370
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
|
|
2371
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "min-w-0", children: [
|
|
2372
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "font-medium truncate", children: agent.displayName }),
|
|
2373
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: agent.description ?? agent.agentId })
|
|
2374
|
+
] }),
|
|
2375
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Badge, { variant: "outline", className: "shrink-0", children: agent.isConfigured ? config.labels.configured : config.labels.unconfigured })
|
|
2376
|
+
] }),
|
|
2377
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "mt-4 grid grid-cols-2 gap-2 text-xs text-muted-foreground", children: [
|
|
2378
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
|
|
2379
|
+
formatNumber4(agent.messageCount),
|
|
2380
|
+
" messages"
|
|
2381
|
+
] }),
|
|
2382
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
|
|
2383
|
+
formatNumber4(agent.llmCallCount),
|
|
2384
|
+
" LLM calls"
|
|
2385
|
+
] }),
|
|
2386
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
|
|
2387
|
+
formatNumber4(agent.toolCallMessageCount),
|
|
2388
|
+
" tool calls"
|
|
2389
|
+
] }),
|
|
2390
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
|
|
2391
|
+
formatNumber4(agent.totalTokens),
|
|
2392
|
+
" tokens"
|
|
2393
|
+
] })
|
|
2394
|
+
] }),
|
|
2395
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "mt-3 text-xs text-muted-foreground", children: formatDate5(agent.lastActivityAt) })
|
|
2396
|
+
]
|
|
2397
|
+
},
|
|
2398
|
+
`${agent.namespace}:${agent.agentId}`
|
|
2399
|
+
)) })
|
|
2400
|
+
] });
|
|
2401
|
+
};
|
|
2402
|
+
function formatDate5(value) {
|
|
2403
|
+
if (!value) return "No activity";
|
|
2404
|
+
const date = new Date(value);
|
|
2405
|
+
if (Number.isNaN(date.getTime())) return value;
|
|
2406
|
+
return date.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
|
|
2407
|
+
}
|
|
2408
|
+
function formatNumber4(value) {
|
|
2409
|
+
return new Intl.NumberFormat().format(value);
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
// src/components/views/AgentDetailView.tsx
|
|
2413
|
+
var import_lucide_react11 = require("lucide-react");
|
|
2414
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2415
|
+
var AgentDetailView = ({
|
|
2416
|
+
agentId,
|
|
2417
|
+
config,
|
|
2418
|
+
agents,
|
|
2419
|
+
onBack
|
|
2420
|
+
}) => {
|
|
2421
|
+
const agent = agents.find((a) => a.agentId === agentId);
|
|
2422
|
+
if (!agent) {
|
|
2423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-4 py-10 text-center", children: [
|
|
2424
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { className: "text-muted-foreground", children: [
|
|
2425
|
+
"Agent not found: ",
|
|
2426
|
+
agentId
|
|
2427
|
+
] }),
|
|
2428
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Button, { variant: "outline", onClick: onBack, children: [
|
|
2429
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react11.ArrowLeft, { className: "mr-2 h-4 w-4" }),
|
|
2430
|
+
" Back"
|
|
2431
|
+
] })
|
|
2432
|
+
] });
|
|
2433
|
+
}
|
|
2434
|
+
const stats = [
|
|
2435
|
+
{ label: "Messages", value: agent.messageCount },
|
|
2436
|
+
{ label: "LLM Calls", value: agent.llmCallCount },
|
|
2437
|
+
{ label: "Tool Calls", value: agent.toolCallMessageCount },
|
|
2438
|
+
{ label: "Input Tokens", value: agent.inputTokens },
|
|
2439
|
+
{ label: "Output Tokens", value: agent.outputTokens },
|
|
2440
|
+
{ label: "Reasoning Tokens", value: agent.reasoningTokens },
|
|
2441
|
+
{ label: "Cache Read", value: agent.cacheReadInputTokens },
|
|
2442
|
+
{ label: "Cache Created", value: agent.cacheCreationInputTokens },
|
|
2443
|
+
{ label: "Total Tokens", value: agent.totalTokens }
|
|
2444
|
+
];
|
|
2445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-6", children: [
|
|
2446
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-4", children: [
|
|
2447
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "ghost", size: "icon", className: "mt-1 shrink-0", onClick: onBack, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react11.ArrowLeft, { className: "h-4 w-4" }) }),
|
|
2448
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
2449
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
2450
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react11.Bot, { className: "h-5 w-5" }) }),
|
|
2451
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
|
|
2452
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2453
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h2", { className: "text-xl font-semibold", children: agent.displayName }),
|
|
2454
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge, { variant: "outline", children: agent.isConfigured ? config.labels.configured : config.labels.unconfigured })
|
|
2455
|
+
] }),
|
|
2456
|
+
agent.description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-muted-foreground", children: agent.description })
|
|
2457
|
+
] })
|
|
2458
|
+
] }),
|
|
2459
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "mt-2 flex flex-wrap gap-4 text-xs text-muted-foreground", children: [
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
|
|
2461
|
+
"ID: ",
|
|
2462
|
+
agent.agentId
|
|
2463
|
+
] }),
|
|
2464
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
|
|
2465
|
+
"Namespace: ",
|
|
2466
|
+
agent.namespace
|
|
2467
|
+
] }),
|
|
2468
|
+
agent.lastActivityAt && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
|
|
2469
|
+
"Last active: ",
|
|
2470
|
+
formatDate6(agent.lastActivityAt)
|
|
2471
|
+
] })
|
|
2472
|
+
] })
|
|
2473
|
+
] })
|
|
2474
|
+
] }),
|
|
2475
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid gap-4 sm:grid-cols-3 lg:grid-cols-3", children: stats.map((stat) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "rounded-xl border bg-card p-5 shadow-sm", children: [
|
|
2476
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm font-medium text-muted-foreground", children: stat.label }),
|
|
2477
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "mt-2 text-2xl font-semibold tracking-tight", children: new Intl.NumberFormat().format(stat.value) })
|
|
2478
|
+
] }, stat.label)) })
|
|
2479
|
+
] });
|
|
2480
|
+
};
|
|
2481
|
+
function formatDate6(value) {
|
|
2482
|
+
const date = new Date(value);
|
|
2483
|
+
if (Number.isNaN(date.getTime())) return value;
|
|
2484
|
+
return date.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
// src/components/views/CollectionItemsView.tsx
|
|
2488
|
+
var import_react4 = require("react");
|
|
2489
|
+
var import_lucide_react12 = require("lucide-react");
|
|
2490
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2491
|
+
var CollectionItemsView = ({
|
|
2492
|
+
collection,
|
|
2493
|
+
config,
|
|
2494
|
+
namespace,
|
|
2495
|
+
onItemClick,
|
|
2496
|
+
onCreateNew
|
|
2497
|
+
}) => {
|
|
2498
|
+
const [items, setItems] = (0, import_react4.useState)([]);
|
|
2499
|
+
const [isLoading, setIsLoading] = (0, import_react4.useState)(true);
|
|
2500
|
+
const [search, setSearch] = (0, import_react4.useState)("");
|
|
2501
|
+
const [error, setError] = (0, import_react4.useState)(null);
|
|
2502
|
+
const fetchOptions = {
|
|
2503
|
+
baseUrl: config.baseUrl,
|
|
2504
|
+
getRequestHeaders: config.getRequestHeaders
|
|
2505
|
+
};
|
|
2506
|
+
const load = (0, import_react4.useCallback)(async () => {
|
|
2507
|
+
setIsLoading(true);
|
|
2508
|
+
setError(null);
|
|
2509
|
+
try {
|
|
2510
|
+
const result = await fetchCollectionItems(
|
|
2511
|
+
collection,
|
|
2512
|
+
{ search: search || void 0, namespace, limit: 50 },
|
|
2513
|
+
fetchOptions
|
|
2514
|
+
);
|
|
2515
|
+
setItems(result);
|
|
2516
|
+
} catch (err) {
|
|
2517
|
+
setError(err instanceof Error ? err.message : "Failed to load items");
|
|
2518
|
+
} finally {
|
|
2519
|
+
setIsLoading(false);
|
|
2520
|
+
}
|
|
2521
|
+
}, [collection, search, namespace, config.baseUrl, config.getRequestHeaders]);
|
|
2522
|
+
(0, import_react4.useEffect)(() => {
|
|
2523
|
+
void load();
|
|
2524
|
+
}, [load]);
|
|
2525
|
+
const getItemId = (item) => {
|
|
2526
|
+
return String(item.id ?? item._id ?? JSON.stringify(item).slice(0, 40));
|
|
2527
|
+
};
|
|
2528
|
+
const getItemPreview = (item) => {
|
|
2529
|
+
const { id, _id, ...rest } = item;
|
|
2530
|
+
const name = item.name ?? item.title ?? item.displayName ?? item.label;
|
|
2531
|
+
if (typeof name === "string") return name;
|
|
2532
|
+
const keys = Object.keys(rest);
|
|
2533
|
+
if (keys.length === 0) return "(empty)";
|
|
2534
|
+
return keys.slice(0, 3).map((k) => `${k}: ${JSON.stringify(rest[k])?.slice(0, 30)}`).join(", ");
|
|
2535
|
+
};
|
|
2536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-4", children: [
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
2538
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: "text-lg font-semibold capitalize", children: collection }),
|
|
2539
|
+
onCreateNew && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Button, { size: "sm", onClick: onCreateNew, children: [
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react12.Plus, { className: "mr-2 h-3 w-3" }),
|
|
2541
|
+
" New"
|
|
2542
|
+
] })
|
|
2543
|
+
] }),
|
|
2544
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative max-w-sm", children: [
|
|
2545
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react12.Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
2546
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2547
|
+
Input,
|
|
2548
|
+
{
|
|
2549
|
+
className: "pl-9",
|
|
2550
|
+
placeholder: `Search ${collection}...`,
|
|
2551
|
+
value: search,
|
|
2552
|
+
onChange: (e) => setSearch(e.target.value)
|
|
2553
|
+
}
|
|
2554
|
+
)
|
|
2555
|
+
] }),
|
|
2556
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive", children: error }),
|
|
2557
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react12.Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }) : items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
|
|
2558
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react12.Database, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
|
|
2559
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "mt-3 text-sm text-muted-foreground", children: search ? config.labels.noResults : `No items in ${collection}` })
|
|
2560
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "space-y-2", children: items.map((item, idx) => {
|
|
2561
|
+
const itemId = getItemId(item);
|
|
2562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2563
|
+
"div",
|
|
2564
|
+
{
|
|
2565
|
+
className: "flex items-center gap-4 rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50 cursor-pointer",
|
|
2566
|
+
onClick: () => onItemClick?.(itemId),
|
|
2567
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
2568
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "font-medium font-mono text-sm truncate", children: itemId }),
|
|
2569
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "mt-1 text-xs text-muted-foreground truncate", children: getItemPreview(item) })
|
|
2570
|
+
] })
|
|
2571
|
+
},
|
|
2572
|
+
itemId + idx
|
|
2573
|
+
);
|
|
2574
|
+
}) })
|
|
2575
|
+
] });
|
|
2576
|
+
};
|
|
2577
|
+
|
|
2578
|
+
// src/components/views/CollectionItemDetailView.tsx
|
|
2579
|
+
var import_react5 = require("react");
|
|
2580
|
+
var import_lucide_react13 = require("lucide-react");
|
|
2581
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2582
|
+
var CollectionItemDetailView = ({
|
|
2583
|
+
collection,
|
|
2584
|
+
itemId,
|
|
2585
|
+
config,
|
|
2586
|
+
namespace,
|
|
2587
|
+
onBack,
|
|
2588
|
+
onDeleted
|
|
2589
|
+
}) => {
|
|
2590
|
+
const isNew = !itemId;
|
|
2591
|
+
const [editJson, setEditJson] = (0, import_react5.useState)(isNew ? "{\n \n}" : "");
|
|
2592
|
+
const [isLoading, setIsLoading] = (0, import_react5.useState)(!isNew);
|
|
2593
|
+
const [isSaving, setIsSaving] = (0, import_react5.useState)(false);
|
|
2594
|
+
const [isDeleting, setIsDeleting] = (0, import_react5.useState)(false);
|
|
2595
|
+
const [error, setError] = (0, import_react5.useState)(null);
|
|
2596
|
+
const [saveMessage, setSaveMessage] = (0, import_react5.useState)(null);
|
|
2597
|
+
const fetchOptions = {
|
|
2598
|
+
baseUrl: config.baseUrl,
|
|
2599
|
+
getRequestHeaders: config.getRequestHeaders
|
|
2600
|
+
};
|
|
2601
|
+
const load = (0, import_react5.useCallback)(async () => {
|
|
2602
|
+
if (!itemId) return;
|
|
2603
|
+
setIsLoading(true);
|
|
2604
|
+
setError(null);
|
|
2605
|
+
try {
|
|
2606
|
+
const result = await fetchCollectionItem(collection, itemId, namespace, fetchOptions);
|
|
2607
|
+
setEditJson(JSON.stringify(result, null, 2));
|
|
2608
|
+
} catch (err) {
|
|
2609
|
+
setError(err instanceof Error ? err.message : "Failed to load item");
|
|
2610
|
+
} finally {
|
|
2611
|
+
setIsLoading(false);
|
|
2612
|
+
}
|
|
2613
|
+
}, [collection, itemId, namespace, config.baseUrl, config.getRequestHeaders]);
|
|
2614
|
+
(0, import_react5.useEffect)(() => {
|
|
2615
|
+
void load();
|
|
2616
|
+
}, [load]);
|
|
2617
|
+
const handleSave = async () => {
|
|
2618
|
+
setIsSaving(true);
|
|
2619
|
+
setError(null);
|
|
2620
|
+
setSaveMessage(null);
|
|
2621
|
+
try {
|
|
2622
|
+
const parsed = JSON.parse(editJson);
|
|
2623
|
+
if (isNew) {
|
|
2624
|
+
const created = await createCollectionItem(collection, parsed, namespace, fetchOptions);
|
|
2625
|
+
setEditJson(JSON.stringify(created, null, 2));
|
|
2626
|
+
setSaveMessage("Created successfully");
|
|
2627
|
+
} else {
|
|
2628
|
+
const updated = await updateCollectionItem(collection, itemId, parsed, namespace, fetchOptions);
|
|
2629
|
+
setEditJson(JSON.stringify(updated, null, 2));
|
|
2630
|
+
setSaveMessage("Saved successfully");
|
|
2631
|
+
}
|
|
2632
|
+
setTimeout(() => setSaveMessage(null), 3e3);
|
|
2633
|
+
} catch (err) {
|
|
2634
|
+
setError(err instanceof Error ? err.message : "Failed to save");
|
|
2635
|
+
} finally {
|
|
2636
|
+
setIsSaving(false);
|
|
2637
|
+
}
|
|
2638
|
+
};
|
|
2639
|
+
const handleDelete = async () => {
|
|
2640
|
+
if (!itemId) return;
|
|
2641
|
+
if (!window.confirm(`Delete this item from ${collection}?`)) return;
|
|
2642
|
+
setIsDeleting(true);
|
|
2643
|
+
setError(null);
|
|
2644
|
+
try {
|
|
2645
|
+
await deleteCollectionItem(collection, itemId, namespace, fetchOptions);
|
|
2646
|
+
onDeleted?.();
|
|
2647
|
+
onBack();
|
|
2648
|
+
} catch (err) {
|
|
2649
|
+
setError(err instanceof Error ? err.message : "Failed to delete");
|
|
2650
|
+
} finally {
|
|
2651
|
+
setIsDeleting(false);
|
|
2652
|
+
}
|
|
2653
|
+
};
|
|
2654
|
+
if (isLoading) {
|
|
2655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react13.Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
|
|
2656
|
+
}
|
|
2657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-6", children: [
|
|
2658
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
2659
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "ghost", size: "icon", onClick: onBack, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react13.ArrowLeft, { className: "h-4 w-4" }) }),
|
|
2660
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h2", { className: "text-xl font-semibold truncate capitalize", children: isNew ? `New ${collection} item` : `${collection} / ${itemId}` }) }),
|
|
2661
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2662
|
+
saveMessage && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs text-emerald-600", children: saveMessage }),
|
|
2663
|
+
!isNew && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2664
|
+
Button,
|
|
2665
|
+
{
|
|
2666
|
+
variant: "destructive",
|
|
2667
|
+
size: "sm",
|
|
2668
|
+
onClick: () => void handleDelete(),
|
|
2669
|
+
disabled: isDeleting,
|
|
2670
|
+
children: [
|
|
2671
|
+
isDeleting ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react13.Loader2, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react13.Trash2, { className: "mr-2 h-3 w-3" }),
|
|
2672
|
+
"Delete"
|
|
2673
|
+
]
|
|
2674
|
+
}
|
|
2675
|
+
),
|
|
2676
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Button, { size: "sm", onClick: () => void handleSave(), disabled: isSaving, children: [
|
|
2677
|
+
isSaving ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react13.Loader2, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react13.Save, { className: "mr-2 h-3 w-3" }),
|
|
2678
|
+
isNew ? "Create" : "Save"
|
|
2679
|
+
] })
|
|
2680
|
+
] })
|
|
2681
|
+
] }),
|
|
2682
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive", children: error }),
|
|
2683
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "rounded-lg border bg-card", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2684
|
+
"textarea",
|
|
2685
|
+
{
|
|
2686
|
+
className: "w-full min-h-[400px] p-4 font-mono text-sm bg-transparent resize-y focus:outline-none",
|
|
2687
|
+
value: editJson,
|
|
2688
|
+
onChange: (e) => setEditJson(e.target.value),
|
|
2689
|
+
spellCheck: false
|
|
2690
|
+
}
|
|
2691
|
+
) })
|
|
2692
|
+
] });
|
|
2693
|
+
};
|
|
2694
|
+
|
|
2695
|
+
// src/components/views/EventsView.tsx
|
|
2696
|
+
var import_react6 = require("react");
|
|
2697
|
+
var import_lucide_react14 = require("lucide-react");
|
|
2698
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2699
|
+
var STATUS_VARIANTS = {
|
|
2700
|
+
pending: "outline",
|
|
2701
|
+
processing: "default",
|
|
2702
|
+
completed: "secondary",
|
|
2703
|
+
failed: "destructive",
|
|
2704
|
+
expired: "secondary",
|
|
2705
|
+
overwritten: "secondary"
|
|
2706
|
+
};
|
|
2707
|
+
var EventsView = ({ config }) => {
|
|
2708
|
+
const [threadId, setThreadId] = (0, import_react6.useState)("");
|
|
2709
|
+
const [event, setEvent] = (0, import_react6.useState)(null);
|
|
2710
|
+
const [hasSearched, setHasSearched] = (0, import_react6.useState)(false);
|
|
2711
|
+
const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
|
|
2712
|
+
const [error, setError] = (0, import_react6.useState)(null);
|
|
2713
|
+
const fetchOptions = {
|
|
2714
|
+
baseUrl: config.baseUrl,
|
|
2715
|
+
getRequestHeaders: config.getRequestHeaders
|
|
2716
|
+
};
|
|
2717
|
+
const handleSearch = (0, import_react6.useCallback)(async () => {
|
|
2718
|
+
if (!threadId.trim()) return;
|
|
2719
|
+
setIsLoading(true);
|
|
2720
|
+
setError(null);
|
|
2721
|
+
setHasSearched(true);
|
|
2722
|
+
try {
|
|
2723
|
+
const result = await fetchThreadEvents(threadId.trim(), fetchOptions);
|
|
2724
|
+
setEvent(result ?? null);
|
|
2725
|
+
} catch (err) {
|
|
2726
|
+
setError(err instanceof Error ? err.message : "Failed to load events");
|
|
2727
|
+
} finally {
|
|
2728
|
+
setIsLoading(false);
|
|
2729
|
+
}
|
|
2730
|
+
}, [threadId, config.baseUrl, config.getRequestHeaders]);
|
|
2731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-6", children: [
|
|
2732
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-end gap-3 max-w-lg", children: [
|
|
2733
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex-1", children: [
|
|
2734
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-sm font-medium mb-1 block", children: "Thread ID" }),
|
|
2735
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative", children: [
|
|
2736
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react14.Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
2737
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2738
|
+
Input,
|
|
2739
|
+
{
|
|
2740
|
+
className: "pl-9",
|
|
2741
|
+
placeholder: "Enter thread ID to inspect events...",
|
|
2742
|
+
value: threadId,
|
|
2743
|
+
onChange: (e) => setThreadId(e.target.value),
|
|
2744
|
+
onKeyDown: (e) => e.key === "Enter" && void handleSearch()
|
|
2745
|
+
}
|
|
2746
|
+
)
|
|
2747
|
+
] })
|
|
2748
|
+
] }),
|
|
2749
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Button, { onClick: () => void handleSearch(), disabled: isLoading || !threadId.trim(), children: [
|
|
2750
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react14.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null,
|
|
2751
|
+
"Inspect"
|
|
2752
|
+
] })
|
|
2753
|
+
] }),
|
|
2754
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive", children: error }),
|
|
2755
|
+
!hasSearched ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
|
|
2756
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react14.Activity, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
|
|
2757
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "mt-3 text-sm text-muted-foreground", children: "Enter a thread ID to inspect its next pending queue event." })
|
|
2758
|
+
] }) : isLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react14.Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }) : !event ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
|
|
2759
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react14.Activity, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
|
|
2760
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "mt-3 text-sm text-muted-foreground", children: "No pending events found for this thread." })
|
|
2761
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "rounded-lg border bg-card p-5 space-y-4", children: [
|
|
2762
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
|
|
2763
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2764
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "font-medium", children: event.eventType }),
|
|
2765
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-muted-foreground font-mono mt-1", children: event.id })
|
|
2766
|
+
] }),
|
|
2767
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Badge, { variant: STATUS_VARIANTS[event.status] ?? "outline", children: event.status })
|
|
2768
|
+
] }),
|
|
2769
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "grid gap-3 sm:grid-cols-2 text-sm", children: [
|
|
2770
|
+
event.traceId && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2771
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Trace:" }),
|
|
2772
|
+
" ",
|
|
2773
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-mono text-xs", children: event.traceId })
|
|
2774
|
+
] }),
|
|
2775
|
+
event.parentEventId && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2776
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Parent:" }),
|
|
2777
|
+
" ",
|
|
2778
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-mono text-xs", children: event.parentEventId })
|
|
2779
|
+
] }),
|
|
2780
|
+
event.priority != null && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2781
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Priority:" }),
|
|
2782
|
+
" ",
|
|
2783
|
+
event.priority
|
|
2784
|
+
] }),
|
|
2785
|
+
event.createdAt && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2786
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "Created:" }),
|
|
2787
|
+
" ",
|
|
2788
|
+
formatTimestamp2(event.createdAt)
|
|
2789
|
+
] })
|
|
2790
|
+
] }),
|
|
2791
|
+
event.payload != null && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2792
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Payload" }),
|
|
2793
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { className: "rounded-md bg-muted p-3 text-xs overflow-auto max-h-60", children: JSON.stringify(event.payload, null, 2) })
|
|
2794
|
+
] }),
|
|
2795
|
+
event.metadata != null && Object.keys(event.metadata).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
2796
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Metadata" }),
|
|
2797
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { className: "rounded-md bg-muted p-3 text-xs overflow-auto max-h-40", children: JSON.stringify(event.metadata, null, 2) })
|
|
2798
|
+
] })
|
|
2799
|
+
] })
|
|
2800
|
+
] });
|
|
2801
|
+
};
|
|
2802
|
+
function formatTimestamp2(value) {
|
|
2803
|
+
const date = new Date(value);
|
|
2804
|
+
if (Number.isNaN(date.getTime())) return value;
|
|
2805
|
+
return date.toLocaleString(void 0, {
|
|
2806
|
+
month: "short",
|
|
2807
|
+
day: "numeric",
|
|
2808
|
+
hour: "numeric",
|
|
2809
|
+
minute: "2-digit",
|
|
2810
|
+
second: "2-digit"
|
|
2811
|
+
});
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2001
2814
|
// src/CopilotzAdmin.tsx
|
|
2002
|
-
var
|
|
2815
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2003
2816
|
var CopilotzAdmin = ({
|
|
2004
2817
|
config: userConfig,
|
|
2005
2818
|
className
|
|
2006
2819
|
}) => {
|
|
2007
|
-
const config = (0,
|
|
2820
|
+
const config = (0, import_react7.useMemo)(
|
|
2008
2821
|
() => mergeAdminConfig(defaultAdminConfig, userConfig),
|
|
2009
2822
|
[userConfig]
|
|
2010
2823
|
);
|
|
2011
|
-
const [route, setRoute] = (0,
|
|
2012
|
-
const [
|
|
2013
|
-
const [
|
|
2014
|
-
const [
|
|
2015
|
-
const
|
|
2016
|
-
const
|
|
2017
|
-
const
|
|
2824
|
+
const [route, setRoute] = (0, import_react7.useState)({ page: config.defaultPage });
|
|
2825
|
+
const [namespace, setNamespace] = (0, import_react7.useState)(config.namespace);
|
|
2826
|
+
const [collections, setCollections] = (0, import_react7.useState)([]);
|
|
2827
|
+
const [threadSearch, setThreadSearch] = (0, import_react7.useState)("");
|
|
2828
|
+
const [participantSearch, setParticipantSearch] = (0, import_react7.useState)("");
|
|
2829
|
+
const [agentSearch, setAgentSearch] = (0, import_react7.useState)("");
|
|
2830
|
+
const deferredThreadSearch = (0, import_react7.useDeferredValue)(threadSearch);
|
|
2831
|
+
const deferredParticipantSearch = (0, import_react7.useDeferredValue)(participantSearch);
|
|
2832
|
+
const deferredAgentSearch = (0, import_react7.useDeferredValue)(agentSearch);
|
|
2018
2833
|
const admin = useCopilotzAdmin({
|
|
2019
2834
|
baseUrl: config.baseUrl,
|
|
2020
2835
|
getRequestHeaders: config.getRequestHeaders,
|
|
2021
|
-
namespace
|
|
2836
|
+
namespace,
|
|
2022
2837
|
range: config.initialRange,
|
|
2023
2838
|
interval: config.initialInterval,
|
|
2024
2839
|
threadSearch: deferredThreadSearch,
|
|
2025
2840
|
participantSearch: deferredParticipantSearch,
|
|
2026
2841
|
agentSearch: deferredAgentSearch
|
|
2027
2842
|
});
|
|
2028
|
-
|
|
2843
|
+
(0, import_react7.useEffect)(() => {
|
|
2844
|
+
if (!config.features.showCollections) return;
|
|
2845
|
+
fetchCollectionNames({
|
|
2846
|
+
baseUrl: config.baseUrl,
|
|
2847
|
+
getRequestHeaders: config.getRequestHeaders
|
|
2848
|
+
}).then(setCollections).catch(() => setCollections([]));
|
|
2849
|
+
}, [config.baseUrl, config.getRequestHeaders, config.features.showCollections]);
|
|
2850
|
+
const navigate = (0, import_react7.useCallback)(
|
|
2029
2851
|
(next) => {
|
|
2030
2852
|
setRoute(next);
|
|
2031
2853
|
config.onNavigate?.(next);
|
|
2032
2854
|
},
|
|
2033
2855
|
[config]
|
|
2034
2856
|
);
|
|
2035
|
-
const handleSidebarNavigate = (0,
|
|
2857
|
+
const handleSidebarNavigate = (0, import_react7.useCallback)(
|
|
2036
2858
|
(page) => navigate({ page }),
|
|
2037
2859
|
[navigate]
|
|
2038
2860
|
);
|
|
2039
|
-
const
|
|
2861
|
+
const handleSidebarRouteNavigate = (0, import_react7.useCallback)(
|
|
2862
|
+
(r) => navigate(r),
|
|
2863
|
+
[navigate]
|
|
2864
|
+
);
|
|
2865
|
+
const handleThreadClick = (0, import_react7.useCallback)(
|
|
2040
2866
|
(threadId) => navigate({ page: "thread-detail", resourceId: threadId }),
|
|
2041
2867
|
[navigate]
|
|
2042
2868
|
);
|
|
2043
|
-
const handleBackToThreads = (0,
|
|
2044
|
-
|
|
2869
|
+
const handleBackToThreads = (0, import_react7.useCallback)(() => navigate({ page: "threads" }), [navigate]);
|
|
2870
|
+
const handleParticipantClick = (0, import_react7.useCallback)(
|
|
2871
|
+
(id) => navigate({ page: "participant-detail", resourceId: id }),
|
|
2045
2872
|
[navigate]
|
|
2046
2873
|
);
|
|
2047
|
-
const
|
|
2874
|
+
const handleBackToParticipants = (0, import_react7.useCallback)(() => navigate({ page: "participants" }), [navigate]);
|
|
2875
|
+
const handleAgentClick = (0, import_react7.useCallback)(
|
|
2876
|
+
(id) => navigate({ page: "agent-detail", resourceId: id }),
|
|
2877
|
+
[navigate]
|
|
2878
|
+
);
|
|
2879
|
+
const handleBackToAgents = (0, import_react7.useCallback)(() => navigate({ page: "agents" }), [navigate]);
|
|
2880
|
+
const handleCollectionItemClick = (0, import_react7.useCallback)(
|
|
2881
|
+
(itemId) => navigate({ page: "collection-item-detail", resourceId: itemId, collection: route.collection }),
|
|
2882
|
+
[navigate, route.collection]
|
|
2883
|
+
);
|
|
2884
|
+
const handleCollectionCreateNew = (0, import_react7.useCallback)(
|
|
2885
|
+
() => navigate({ page: "collection-item-detail", resourceId: void 0, collection: route.collection }),
|
|
2886
|
+
[navigate, route.collection]
|
|
2887
|
+
);
|
|
2888
|
+
const handleBackToCollectionItems = (0, import_react7.useCallback)(
|
|
2889
|
+
() => navigate({ page: "collection-items", collection: route.collection }),
|
|
2890
|
+
[navigate, route.collection]
|
|
2891
|
+
);
|
|
2892
|
+
const sidebarPage = (() => {
|
|
2893
|
+
switch (route.page) {
|
|
2894
|
+
case "thread-detail":
|
|
2895
|
+
return "threads";
|
|
2896
|
+
case "participant-detail":
|
|
2897
|
+
return "participants";
|
|
2898
|
+
case "agent-detail":
|
|
2899
|
+
return "agents";
|
|
2900
|
+
case "collection-item-detail":
|
|
2901
|
+
return "collection-items";
|
|
2902
|
+
default:
|
|
2903
|
+
return route.page;
|
|
2904
|
+
}
|
|
2905
|
+
})();
|
|
2048
2906
|
if (admin.isLoading && !admin.overview) {
|
|
2049
|
-
return /* @__PURE__ */ (0,
|
|
2907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Card, { className: cn("border-border", className), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardContent, { className: "text-muted-foreground flex items-center justify-center min-h-[200px]", children: config.labels.loading }) });
|
|
2050
2908
|
}
|
|
2051
2909
|
if (admin.error && !admin.overview) {
|
|
2052
|
-
return /* @__PURE__ */ (0,
|
|
2053
|
-
|
|
2054
|
-
{
|
|
2055
|
-
|
|
2056
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(CardContent, { className: "space-y-4", children: [
|
|
2057
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-base font-semibold text-destructive", children: admin.error.message }),
|
|
2058
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2059
|
-
Button,
|
|
2060
|
-
{
|
|
2061
|
-
variant: "destructive",
|
|
2062
|
-
onClick: () => void admin.refresh(),
|
|
2063
|
-
children: config.labels.retry
|
|
2064
|
-
}
|
|
2065
|
-
)
|
|
2066
|
-
] })
|
|
2067
|
-
}
|
|
2068
|
-
);
|
|
2910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Card, { className: cn("border-destructive/50 bg-destructive/10", className), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(CardContent, { className: "space-y-4", children: [
|
|
2911
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-base font-semibold text-destructive", children: admin.error.message }),
|
|
2912
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { variant: "destructive", onClick: () => void admin.refresh(), children: config.labels.retry })
|
|
2913
|
+
] }) });
|
|
2069
2914
|
}
|
|
2070
2915
|
const renderCurrentView = () => {
|
|
2071
2916
|
switch (route.page) {
|
|
2072
2917
|
case "dashboard":
|
|
2073
|
-
return /* @__PURE__ */ (0,
|
|
2918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2074
2919
|
DashboardView,
|
|
2075
2920
|
{
|
|
2076
2921
|
config,
|
|
@@ -2090,7 +2935,7 @@ var CopilotzAdmin = ({
|
|
|
2090
2935
|
}
|
|
2091
2936
|
);
|
|
2092
2937
|
case "threads":
|
|
2093
|
-
return /* @__PURE__ */ (0,
|
|
2938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2094
2939
|
ThreadsView,
|
|
2095
2940
|
{
|
|
2096
2941
|
config,
|
|
@@ -2101,34 +2946,62 @@ var CopilotzAdmin = ({
|
|
|
2101
2946
|
}
|
|
2102
2947
|
);
|
|
2103
2948
|
case "thread-detail":
|
|
2104
|
-
return route.resourceId ? /* @__PURE__ */ (0,
|
|
2105
|
-
|
|
2949
|
+
return route.resourceId ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ThreadDetailView, { threadId: route.resourceId, config, onBack: handleBackToThreads }) : null;
|
|
2950
|
+
case "participants":
|
|
2951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2952
|
+
ParticipantsView,
|
|
2106
2953
|
{
|
|
2107
|
-
threadId: route.resourceId,
|
|
2108
2954
|
config,
|
|
2109
|
-
|
|
2955
|
+
participants: admin.participants,
|
|
2956
|
+
searchValue: participantSearch,
|
|
2957
|
+
onSearchChange: setParticipantSearch,
|
|
2958
|
+
onParticipantClick: handleParticipantClick
|
|
2110
2959
|
}
|
|
2111
|
-
)
|
|
2112
|
-
case "
|
|
2113
|
-
return /* @__PURE__ */ (0,
|
|
2114
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "text-lg font-semibold", children: config.labels.participantsTitle }),
|
|
2115
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "mt-2 text-sm text-muted-foreground", children: "Detailed participant management coming soon." })
|
|
2116
|
-
] });
|
|
2960
|
+
);
|
|
2961
|
+
case "participant-detail":
|
|
2962
|
+
return route.resourceId ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ParticipantDetailView, { participantId: route.resourceId, config, onBack: handleBackToParticipants }) : null;
|
|
2117
2963
|
case "agents":
|
|
2118
|
-
return /* @__PURE__ */ (0,
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2965
|
+
AgentsView,
|
|
2966
|
+
{
|
|
2967
|
+
config,
|
|
2968
|
+
agents: admin.agents,
|
|
2969
|
+
searchValue: agentSearch,
|
|
2970
|
+
onSearchChange: setAgentSearch,
|
|
2971
|
+
onAgentClick: handleAgentClick
|
|
2972
|
+
}
|
|
2973
|
+
);
|
|
2974
|
+
case "agent-detail":
|
|
2975
|
+
return route.resourceId ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AgentDetailView, { agentId: route.resourceId, config, agents: admin.agents, onBack: handleBackToAgents }) : null;
|
|
2976
|
+
case "collection-items":
|
|
2977
|
+
return route.collection ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2978
|
+
CollectionItemsView,
|
|
2979
|
+
{
|
|
2980
|
+
collection: route.collection,
|
|
2981
|
+
config,
|
|
2982
|
+
namespace,
|
|
2983
|
+
onItemClick: handleCollectionItemClick,
|
|
2984
|
+
onCreateNew: handleCollectionCreateNew
|
|
2985
|
+
}
|
|
2986
|
+
) : null;
|
|
2987
|
+
case "collection-item-detail":
|
|
2988
|
+
return route.collection ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2989
|
+
CollectionItemDetailView,
|
|
2990
|
+
{
|
|
2991
|
+
collection: route.collection,
|
|
2992
|
+
itemId: route.resourceId ?? null,
|
|
2993
|
+
config,
|
|
2994
|
+
namespace,
|
|
2995
|
+
onBack: handleBackToCollectionItems
|
|
2996
|
+
}
|
|
2997
|
+
) : null;
|
|
2122
2998
|
case "events":
|
|
2123
|
-
return /* @__PURE__ */ (0,
|
|
2124
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "text-lg font-semibold", children: config.labels.eventsTitle }),
|
|
2125
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "mt-2 text-sm text-muted-foreground", children: "Event inspector coming soon." })
|
|
2126
|
-
] });
|
|
2999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EventsView, { config });
|
|
2127
3000
|
default:
|
|
2128
3001
|
return null;
|
|
2129
3002
|
}
|
|
2130
3003
|
};
|
|
2131
|
-
return /* @__PURE__ */ (0,
|
|
3004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarProvider, { defaultOpen: config.sidebar.defaultOpen, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2132
3005
|
"div",
|
|
2133
3006
|
{
|
|
2134
3007
|
className: cn(
|
|
@@ -2136,20 +3009,25 @@ var CopilotzAdmin = ({
|
|
|
2136
3009
|
className
|
|
2137
3010
|
),
|
|
2138
3011
|
children: [
|
|
2139
|
-
/* @__PURE__ */ (0,
|
|
3012
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2140
3013
|
AdminSidebar,
|
|
2141
3014
|
{
|
|
2142
3015
|
config,
|
|
2143
3016
|
currentPage: sidebarPage,
|
|
2144
|
-
|
|
3017
|
+
currentRoute: route,
|
|
3018
|
+
onNavigate: handleSidebarNavigate,
|
|
3019
|
+
onNavigateRoute: handleSidebarRouteNavigate,
|
|
3020
|
+
collections,
|
|
3021
|
+
namespace,
|
|
3022
|
+
onNamespaceChange: setNamespace
|
|
2145
3023
|
}
|
|
2146
3024
|
),
|
|
2147
|
-
/* @__PURE__ */ (0,
|
|
2148
|
-
/* @__PURE__ */ (0,
|
|
3025
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarInset, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
3026
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2149
3027
|
AdminHeader,
|
|
2150
3028
|
{
|
|
2151
3029
|
config,
|
|
2152
|
-
|
|
3030
|
+
currentRoute: route,
|
|
2153
3031
|
range: admin.filters.range,
|
|
2154
3032
|
interval: admin.filters.interval,
|
|
2155
3033
|
onRangeChange: admin.setRange,
|
|
@@ -2158,7 +3036,7 @@ var CopilotzAdmin = ({
|
|
|
2158
3036
|
isLoading: admin.isLoading
|
|
2159
3037
|
}
|
|
2160
3038
|
),
|
|
2161
|
-
/* @__PURE__ */ (0,
|
|
3039
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1 overflow-auto p-6", children: renderCurrentView() })
|
|
2162
3040
|
] }) })
|
|
2163
3041
|
]
|
|
2164
3042
|
}
|
|
@@ -2167,13 +3045,22 @@ var CopilotzAdmin = ({
|
|
|
2167
3045
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2168
3046
|
0 && (module.exports = {
|
|
2169
3047
|
CopilotzAdmin,
|
|
3048
|
+
createCollectionItem,
|
|
2170
3049
|
defaultAdminConfig,
|
|
3050
|
+
deleteCollectionItem,
|
|
2171
3051
|
fetchAdminActivity,
|
|
2172
3052
|
fetchAdminAgents,
|
|
2173
3053
|
fetchAdminOverview,
|
|
2174
3054
|
fetchAdminParticipants,
|
|
2175
3055
|
fetchAdminThreads,
|
|
3056
|
+
fetchCollectionItem,
|
|
3057
|
+
fetchCollectionItems,
|
|
3058
|
+
fetchCollectionNames,
|
|
3059
|
+
fetchParticipantDetail,
|
|
3060
|
+
fetchThreadEvents,
|
|
2176
3061
|
mergeAdminConfig,
|
|
3062
|
+
updateCollectionItem,
|
|
3063
|
+
updateParticipant,
|
|
2177
3064
|
useCopilotzAdmin
|
|
2178
3065
|
});
|
|
2179
3066
|
//# sourceMappingURL=index.cjs.map
|