@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.js CHANGED
@@ -1,9 +1,10 @@
1
1
  // src/CopilotzAdmin.tsx
2
2
  import {
3
- useCallback as useCallback4,
3
+ useCallback as useCallback8,
4
4
  useDeferredValue,
5
+ useEffect as useEffect9,
5
6
  useMemo as useMemo3,
6
- useState as useState5
7
+ useState as useState9
7
8
  } from "react";
8
9
 
9
10
  // src/config.ts
@@ -46,7 +47,9 @@ var defaultAdminConfig = {
46
47
  unconfigured: "Observed only",
47
48
  noResults: "No results",
48
49
  eventsTitle: "Events",
49
- dashboardTitle: "Dashboard"
50
+ dashboardTitle: "Dashboard",
51
+ collectionsTitle: "Collections",
52
+ collectionsEndpoint: "/v1/collections"
50
53
  },
51
54
  features: {
52
55
  showOverview: true,
@@ -54,7 +57,8 @@ var defaultAdminConfig = {
54
57
  showThreads: true,
55
58
  showParticipants: true,
56
59
  showAgents: true,
57
- showEvents: false
60
+ showEvents: true,
61
+ showCollections: true
58
62
  },
59
63
  ui: {
60
64
  compact: false,
@@ -245,6 +249,122 @@ async function fetchThreadMessages(threadId, messageOptions, options) {
245
249
  options
246
250
  );
247
251
  }
252
+ async function fetchParticipantDetail(participantId, options) {
253
+ return await fetchAdminJson(
254
+ `/v1/participants/${encodeURIComponent(participantId)}`,
255
+ {},
256
+ options
257
+ );
258
+ }
259
+ async function updateParticipant(participantId, data, options) {
260
+ const url = new URL(
261
+ `${resolveBaseUrl(options?.baseUrl)}/v1/participants/${encodeURIComponent(participantId)}`,
262
+ window.location.origin
263
+ );
264
+ const response = await fetch(url.toString(), {
265
+ method: "PUT",
266
+ headers: await withAuthHeaders(
267
+ { "Content-Type": "application/json" },
268
+ options?.getRequestHeaders
269
+ ),
270
+ body: JSON.stringify(data)
271
+ });
272
+ if (!response.ok) {
273
+ throw new Error(`Update participant failed (${response.status})`);
274
+ }
275
+ const payload = await response.json();
276
+ return payload.data;
277
+ }
278
+ async function fetchCollectionNames(options) {
279
+ return await fetchAdminJson("/v1/collections", {}, options);
280
+ }
281
+ async function fetchCollectionItems(collection, queryOptions, options) {
282
+ const params = {
283
+ namespace: queryOptions?.namespace,
284
+ limit: queryOptions?.limit?.toString()
285
+ };
286
+ if (queryOptions?.search) {
287
+ params.q = queryOptions.search;
288
+ } else {
289
+ params.offset = queryOptions?.offset?.toString();
290
+ }
291
+ return await fetchAdminJson(
292
+ `/v1/collections/${encodeURIComponent(collection)}`,
293
+ params,
294
+ options
295
+ );
296
+ }
297
+ async function fetchCollectionItem(collection, itemId, namespace, options) {
298
+ return await fetchAdminJson(
299
+ `/v1/collections/${encodeURIComponent(collection)}/${encodeURIComponent(itemId)}`,
300
+ { namespace },
301
+ options
302
+ );
303
+ }
304
+ async function createCollectionItem(collection, data, namespace, options) {
305
+ const url = new URL(
306
+ `${resolveBaseUrl(options?.baseUrl)}/v1/collections/${encodeURIComponent(collection)}`,
307
+ window.location.origin
308
+ );
309
+ if (namespace) url.searchParams.set("namespace", namespace);
310
+ const response = await fetch(url.toString(), {
311
+ method: "POST",
312
+ headers: await withAuthHeaders(
313
+ { "Content-Type": "application/json" },
314
+ options?.getRequestHeaders
315
+ ),
316
+ body: JSON.stringify(data)
317
+ });
318
+ if (!response.ok) {
319
+ throw new Error(`Create collection item failed (${response.status})`);
320
+ }
321
+ const payload = await response.json();
322
+ if ("body" in payload && payload.body && typeof payload.body === "object") {
323
+ return payload.body;
324
+ }
325
+ return payload;
326
+ }
327
+ async function updateCollectionItem(collection, itemId, data, namespace, options) {
328
+ const url = new URL(
329
+ `${resolveBaseUrl(options?.baseUrl)}/v1/collections/${encodeURIComponent(collection)}/${encodeURIComponent(itemId)}`,
330
+ window.location.origin
331
+ );
332
+ if (namespace) url.searchParams.set("namespace", namespace);
333
+ const response = await fetch(url.toString(), {
334
+ method: "PUT",
335
+ headers: await withAuthHeaders(
336
+ { "Content-Type": "application/json" },
337
+ options?.getRequestHeaders
338
+ ),
339
+ body: JSON.stringify(data)
340
+ });
341
+ if (!response.ok) {
342
+ throw new Error(`Update collection item failed (${response.status})`);
343
+ }
344
+ const payload = await response.json();
345
+ return payload.data;
346
+ }
347
+ async function deleteCollectionItem(collection, itemId, namespace, options) {
348
+ const url = new URL(
349
+ `${resolveBaseUrl(options?.baseUrl)}/v1/collections/${encodeURIComponent(collection)}/${encodeURIComponent(itemId)}`,
350
+ window.location.origin
351
+ );
352
+ if (namespace) url.searchParams.set("namespace", namespace);
353
+ const response = await fetch(url.toString(), {
354
+ method: "DELETE",
355
+ headers: await withAuthHeaders({}, options?.getRequestHeaders)
356
+ });
357
+ if (!response.ok) {
358
+ throw new Error(`Delete collection item failed (${response.status})`);
359
+ }
360
+ }
361
+ async function fetchThreadEvents(threadId, options) {
362
+ return await fetchAdminJson(
363
+ `/v1/threads/${encodeURIComponent(threadId)}/events`,
364
+ {},
365
+ options
366
+ );
367
+ }
248
368
 
249
369
  // src/useCopilotzAdmin.ts
250
370
  function useCopilotzAdmin(options = {}) {
@@ -533,11 +653,35 @@ function Input({ className, type, ...props }) {
533
653
  );
534
654
  }
535
655
 
656
+ // src/components/ui/separator.tsx
657
+ import * as SeparatorPrimitive from "@radix-ui/react-separator";
658
+ import { jsx as jsx5 } from "react/jsx-runtime";
659
+ function Separator({
660
+ className,
661
+ orientation = "horizontal",
662
+ decorative = true,
663
+ ...props
664
+ }) {
665
+ return /* @__PURE__ */ jsx5(
666
+ SeparatorPrimitive.Root,
667
+ {
668
+ "data-slot": "separator",
669
+ decorative,
670
+ orientation,
671
+ className: cn(
672
+ "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
673
+ className
674
+ ),
675
+ ...props
676
+ }
677
+ );
678
+ }
679
+
536
680
  // src/components/ui/sheet.tsx
537
681
  import * as React2 from "react";
538
682
  import * as SheetPrimitive from "@radix-ui/react-dialog";
539
683
  import { XIcon } from "lucide-react";
540
- import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
684
+ import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
541
685
  function cleanupBodyStyles() {
542
686
  if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
543
687
  document.body.style.pointerEvents = "";
@@ -557,18 +701,18 @@ function Sheet({ open, onOpenChange, ...props }) {
557
701
  cleanupBodyStyles();
558
702
  };
559
703
  }, []);
560
- return /* @__PURE__ */ jsx5(SheetPrimitive.Root, { "data-slot": "sheet", open, onOpenChange, ...props });
704
+ return /* @__PURE__ */ jsx6(SheetPrimitive.Root, { "data-slot": "sheet", open, onOpenChange, ...props });
561
705
  }
562
706
  function SheetPortal({
563
707
  ...props
564
708
  }) {
565
- return /* @__PURE__ */ jsx5(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
709
+ return /* @__PURE__ */ jsx6(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
566
710
  }
567
711
  function SheetOverlay({
568
712
  className,
569
713
  ...props
570
714
  }) {
571
- return /* @__PURE__ */ jsx5(
715
+ return /* @__PURE__ */ jsx6(
572
716
  SheetPrimitive.Overlay,
573
717
  {
574
718
  "data-slot": "sheet-overlay",
@@ -590,7 +734,7 @@ function SheetContent({
590
734
  ...props
591
735
  }) {
592
736
  return /* @__PURE__ */ jsxs2(SheetPortal, { children: [
593
- /* @__PURE__ */ jsx5(SheetOverlay, {}),
737
+ /* @__PURE__ */ jsx6(SheetOverlay, {}),
594
738
  /* @__PURE__ */ jsxs2(
595
739
  SheetPrimitive.Content,
596
740
  {
@@ -608,8 +752,8 @@ function SheetContent({
608
752
  children: [
609
753
  children,
610
754
  /* @__PURE__ */ jsxs2(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: [
611
- /* @__PURE__ */ jsx5(XIcon, { className: "size-4" }),
612
- /* @__PURE__ */ jsx5("span", { className: "sr-only", children: "Close" })
755
+ /* @__PURE__ */ jsx6(XIcon, { className: "size-4" }),
756
+ /* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Close" })
613
757
  ] })
614
758
  ]
615
759
  }
@@ -617,7 +761,7 @@ function SheetContent({
617
761
  ] });
618
762
  }
619
763
  function SheetHeader({ className, ...props }) {
620
- return /* @__PURE__ */ jsx5(
764
+ return /* @__PURE__ */ jsx6(
621
765
  "div",
622
766
  {
623
767
  "data-slot": "sheet-header",
@@ -630,7 +774,7 @@ function SheetTitle({
630
774
  className,
631
775
  ...props
632
776
  }) {
633
- return /* @__PURE__ */ jsx5(
777
+ return /* @__PURE__ */ jsx6(
634
778
  SheetPrimitive.Title,
635
779
  {
636
780
  "data-slot": "sheet-title",
@@ -643,7 +787,7 @@ function SheetDescription({
643
787
  className,
644
788
  ...props
645
789
  }) {
646
- return /* @__PURE__ */ jsx5(
790
+ return /* @__PURE__ */ jsx6(
647
791
  SheetPrimitive.Description,
648
792
  {
649
793
  "data-slot": "sheet-description",
@@ -654,7 +798,7 @@ function SheetDescription({
654
798
  }
655
799
 
656
800
  // src/components/ui/sidebar.tsx
657
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
801
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
658
802
  var SIDEBAR_COOKIE_NAME = "sidebar_state";
659
803
  var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
660
804
  var SIDEBAR_WIDTH = "16rem";
@@ -720,7 +864,7 @@ function SidebarProvider({
720
864
  }),
721
865
  [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
722
866
  );
723
- return /* @__PURE__ */ jsx6(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx6(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx6(
867
+ return /* @__PURE__ */ jsx7(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx7(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx7(
724
868
  "div",
725
869
  {
726
870
  "data-slot": "sidebar-wrapper",
@@ -748,7 +892,7 @@ function Sidebar({
748
892
  }) {
749
893
  const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
750
894
  if (collapsible === "none") {
751
- return /* @__PURE__ */ jsx6(
895
+ return /* @__PURE__ */ jsx7(
752
896
  "div",
753
897
  {
754
898
  "data-slot": "sidebar",
@@ -762,7 +906,7 @@ function Sidebar({
762
906
  );
763
907
  }
764
908
  if (isMobile) {
765
- return /* @__PURE__ */ jsx6(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs3(
909
+ return /* @__PURE__ */ jsx7(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs3(
766
910
  SheetContent,
767
911
  {
768
912
  "data-sidebar": "sidebar",
@@ -775,10 +919,10 @@ function Sidebar({
775
919
  side,
776
920
  children: [
777
921
  /* @__PURE__ */ jsxs3(SheetHeader, { className: "sr-only", children: [
778
- /* @__PURE__ */ jsx6(SheetTitle, { children: "Sidebar" }),
779
- /* @__PURE__ */ jsx6(SheetDescription, { children: "Displays the mobile sidebar." })
922
+ /* @__PURE__ */ jsx7(SheetTitle, { children: "Sidebar" }),
923
+ /* @__PURE__ */ jsx7(SheetDescription, { children: "Displays the mobile sidebar." })
780
924
  ] }),
781
- /* @__PURE__ */ jsx6("div", { className: "flex h-full w-full flex-col", children })
925
+ /* @__PURE__ */ jsx7("div", { className: "flex h-full w-full flex-col", children })
782
926
  ]
783
927
  }
784
928
  ) });
@@ -793,7 +937,7 @@ function Sidebar({
793
937
  "data-side": side,
794
938
  "data-slot": "sidebar",
795
939
  children: [
796
- /* @__PURE__ */ jsx6(
940
+ /* @__PURE__ */ jsx7(
797
941
  "div",
798
942
  {
799
943
  "data-slot": "sidebar-gap",
@@ -805,7 +949,7 @@ function Sidebar({
805
949
  )
806
950
  }
807
951
  ),
808
- /* @__PURE__ */ jsx6(
952
+ /* @__PURE__ */ jsx7(
809
953
  "div",
810
954
  {
811
955
  "data-slot": "sidebar-container",
@@ -816,7 +960,7 @@ function Sidebar({
816
960
  className
817
961
  ),
818
962
  ...props,
819
- children: /* @__PURE__ */ jsx6(
963
+ children: /* @__PURE__ */ jsx7(
820
964
  "div",
821
965
  {
822
966
  "data-sidebar": "sidebar",
@@ -851,15 +995,15 @@ function SidebarTrigger({
851
995
  },
852
996
  ...props,
853
997
  children: [
854
- /* @__PURE__ */ jsx6(PanelLeftIcon, {}),
855
- /* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Toggle Sidebar" })
998
+ /* @__PURE__ */ jsx7(PanelLeftIcon, {}),
999
+ /* @__PURE__ */ jsx7("span", { className: "sr-only", children: "Toggle Sidebar" })
856
1000
  ]
857
1001
  }
858
1002
  );
859
1003
  }
860
1004
  function SidebarRail({ className, ...props }) {
861
1005
  const { toggleSidebar } = useSidebar();
862
- return /* @__PURE__ */ jsx6(
1006
+ return /* @__PURE__ */ jsx7(
863
1007
  "button",
864
1008
  {
865
1009
  "data-sidebar": "rail",
@@ -882,7 +1026,7 @@ function SidebarRail({ className, ...props }) {
882
1026
  );
883
1027
  }
884
1028
  function SidebarInset({ className, ...props }) {
885
- return /* @__PURE__ */ jsx6(
1029
+ return /* @__PURE__ */ jsx7(
886
1030
  "main",
887
1031
  {
888
1032
  "data-slot": "sidebar-inset",
@@ -896,7 +1040,7 @@ function SidebarInset({ className, ...props }) {
896
1040
  );
897
1041
  }
898
1042
  function SidebarHeader({ className, ...props }) {
899
- return /* @__PURE__ */ jsx6(
1043
+ return /* @__PURE__ */ jsx7(
900
1044
  "div",
901
1045
  {
902
1046
  "data-slot": "sidebar-header",
@@ -907,7 +1051,7 @@ function SidebarHeader({ className, ...props }) {
907
1051
  );
908
1052
  }
909
1053
  function SidebarFooter({ className, ...props }) {
910
- return /* @__PURE__ */ jsx6(
1054
+ return /* @__PURE__ */ jsx7(
911
1055
  "div",
912
1056
  {
913
1057
  "data-slot": "sidebar-footer",
@@ -917,8 +1061,22 @@ function SidebarFooter({ className, ...props }) {
917
1061
  }
918
1062
  );
919
1063
  }
1064
+ function SidebarSeparator({
1065
+ className,
1066
+ ...props
1067
+ }) {
1068
+ return /* @__PURE__ */ jsx7(
1069
+ Separator,
1070
+ {
1071
+ "data-slot": "sidebar-separator",
1072
+ "data-sidebar": "separator",
1073
+ className: cn("bg-sidebar-border mx-2 w-auto", className),
1074
+ ...props
1075
+ }
1076
+ );
1077
+ }
920
1078
  function SidebarContent({ className, ...props }) {
921
- return /* @__PURE__ */ jsx6(
1079
+ return /* @__PURE__ */ jsx7(
922
1080
  "div",
923
1081
  {
924
1082
  "data-slot": "sidebar-content",
@@ -932,7 +1090,7 @@ function SidebarContent({ className, ...props }) {
932
1090
  );
933
1091
  }
934
1092
  function SidebarGroup({ className, ...props }) {
935
- return /* @__PURE__ */ jsx6(
1093
+ return /* @__PURE__ */ jsx7(
936
1094
  "div",
937
1095
  {
938
1096
  "data-slot": "sidebar-group",
@@ -948,7 +1106,7 @@ function SidebarGroupLabel({
948
1106
  ...props
949
1107
  }) {
950
1108
  const Comp = asChild ? Slot2 : "div";
951
- return /* @__PURE__ */ jsx6(
1109
+ return /* @__PURE__ */ jsx7(
952
1110
  Comp,
953
1111
  {
954
1112
  "data-slot": "sidebar-group-label",
@@ -966,7 +1124,7 @@ function SidebarGroupContent({
966
1124
  className,
967
1125
  ...props
968
1126
  }) {
969
- return /* @__PURE__ */ jsx6(
1127
+ return /* @__PURE__ */ jsx7(
970
1128
  "div",
971
1129
  {
972
1130
  "data-slot": "sidebar-group-content",
@@ -977,7 +1135,7 @@ function SidebarGroupContent({
977
1135
  );
978
1136
  }
979
1137
  function SidebarMenu({ className, ...props }) {
980
- return /* @__PURE__ */ jsx6(
1138
+ return /* @__PURE__ */ jsx7(
981
1139
  "ul",
982
1140
  {
983
1141
  "data-slot": "sidebar-menu",
@@ -988,7 +1146,7 @@ function SidebarMenu({ className, ...props }) {
988
1146
  );
989
1147
  }
990
1148
  function SidebarMenuItem({ className, ...props }) {
991
- return /* @__PURE__ */ jsx6(
1149
+ return /* @__PURE__ */ jsx7(
992
1150
  "li",
993
1151
  {
994
1152
  "data-slot": "sidebar-menu-item",
@@ -1029,7 +1187,7 @@ function SidebarMenuButton({
1029
1187
  }) {
1030
1188
  const Comp = asChild ? Slot2 : "button";
1031
1189
  const { isMobile, state } = useSidebar();
1032
- const button = /* @__PURE__ */ jsx6(
1190
+ const button = /* @__PURE__ */ jsx7(
1033
1191
  Comp,
1034
1192
  {
1035
1193
  "data-slot": "sidebar-menu-button",
@@ -1049,8 +1207,8 @@ function SidebarMenuButton({
1049
1207
  };
1050
1208
  }
1051
1209
  return /* @__PURE__ */ jsxs3(Tooltip, { children: [
1052
- /* @__PURE__ */ jsx6(TooltipTrigger, { asChild: true, children: button }),
1053
- /* @__PURE__ */ jsx6(
1210
+ /* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: button }),
1211
+ /* @__PURE__ */ jsx7(
1054
1212
  TooltipContent,
1055
1213
  {
1056
1214
  side: "right",
@@ -1068,91 +1226,19 @@ import {
1068
1226
  MessageSquare,
1069
1227
  Users,
1070
1228
  Bot,
1071
- Activity
1229
+ Activity,
1230
+ Database,
1231
+ ChevronsUpDown
1072
1232
  } from "lucide-react";
1073
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
1074
- var NAV_ITEMS = [
1075
- {
1076
- page: "dashboard",
1077
- label: "Dashboard",
1078
- icon: LayoutDashboard
1079
- },
1080
- {
1081
- page: "threads",
1082
- label: "Threads",
1083
- icon: MessageSquare,
1084
- featureKey: "showThreads"
1085
- },
1086
- {
1087
- page: "participants",
1088
- label: "Participants",
1089
- icon: Users,
1090
- featureKey: "showParticipants"
1091
- },
1092
- {
1093
- page: "agents",
1094
- label: "Agents",
1095
- icon: Bot,
1096
- featureKey: "showAgents"
1097
- },
1098
- {
1099
- page: "events",
1100
- label: "Events",
1101
- icon: Activity,
1102
- featureKey: "showEvents"
1103
- }
1104
- ];
1105
- var AdminSidebar = ({
1106
- config,
1107
- currentPage,
1108
- onNavigate
1109
- }) => {
1110
- const visibleItems = NAV_ITEMS.filter(
1111
- (item) => !item.featureKey || config.features[item.featureKey]
1112
- );
1113
- return /* @__PURE__ */ jsxs4(Sidebar, { collapsible: config.sidebar.collapsible, children: [
1114
- /* @__PURE__ */ jsx7(SidebarHeader, { children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 px-2 py-3", children: [
1115
- /* @__PURE__ */ jsx7("div", { className: "flex items-center justify-center shrink-0", children: config.branding.logo || /* @__PURE__ */ jsx7("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx7(LayoutDashboard, { className: "h-4 w-4" }) }) }),
1116
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-col min-w-0 group-data-[collapsible=icon]:hidden", children: [
1117
- /* @__PURE__ */ jsx7("span", { className: "text-sm font-semibold truncate", children: config.branding.title }),
1118
- config.branding.subtitle && /* @__PURE__ */ jsx7("span", { className: "text-xs text-muted-foreground truncate", children: config.branding.subtitle })
1119
- ] })
1120
- ] }) }),
1121
- /* @__PURE__ */ jsx7(SidebarContent, { children: /* @__PURE__ */ jsxs4(SidebarGroup, { children: [
1122
- /* @__PURE__ */ jsx7(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: "Navigation" }),
1123
- /* @__PURE__ */ jsx7(SidebarGroupContent, { children: /* @__PURE__ */ jsx7(SidebarMenu, { children: visibleItems.map((item) => {
1124
- const Icon2 = item.icon;
1125
- const label = config.labels[`${item.page}Title`] || item.label;
1126
- return /* @__PURE__ */ jsx7(SidebarMenuItem, { children: /* @__PURE__ */ jsxs4(
1127
- SidebarMenuButton,
1128
- {
1129
- isActive: currentPage === item.page,
1130
- onClick: () => onNavigate(item.page),
1131
- tooltip: label,
1132
- children: [
1133
- /* @__PURE__ */ jsx7(Icon2, {}),
1134
- /* @__PURE__ */ jsx7("span", { children: label })
1135
- ]
1136
- }
1137
- ) }, item.page);
1138
- }) }) })
1139
- ] }) }),
1140
- config.namespace && /* @__PURE__ */ jsx7(SidebarFooter, { children: /* @__PURE__ */ jsx7("div", { className: "px-2 py-2 text-xs text-muted-foreground group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsx7("span", { className: "font-medium uppercase tracking-[0.18em]", children: config.namespace }) }) }),
1141
- /* @__PURE__ */ jsx7(SidebarRail, {})
1142
- ] });
1143
- };
1144
-
1145
- // src/components/layout/AdminHeader.tsx
1146
- import { RefreshCw } from "lucide-react";
1147
1233
 
1148
1234
  // src/components/ui/select.tsx
1149
1235
  import * as React4 from "react";
1150
1236
  import * as SelectPrimitive from "@radix-ui/react-select";
1151
1237
  import { Check, ChevronDown, ChevronUp } from "lucide-react";
1152
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1238
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
1153
1239
  var Select = SelectPrimitive.Root;
1154
1240
  var SelectValue = SelectPrimitive.Value;
1155
- var SelectTrigger = React4.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs5(
1241
+ var SelectTrigger = React4.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs4(
1156
1242
  SelectPrimitive.Trigger,
1157
1243
  {
1158
1244
  ref,
@@ -1168,7 +1254,7 @@ var SelectTrigger = React4.forwardRef(({ className, children, ...props }, ref) =
1168
1254
  }
1169
1255
  ));
1170
1256
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
1171
- var SelectContent = React4.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx8(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs5(
1257
+ var SelectContent = React4.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx8(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs4(
1172
1258
  SelectPrimitive.Content,
1173
1259
  {
1174
1260
  ref,
@@ -1196,7 +1282,7 @@ var SelectContent = React4.forwardRef(({ className, children, position = "popper
1196
1282
  }
1197
1283
  ) }));
1198
1284
  SelectContent.displayName = SelectPrimitive.Content.displayName;
1199
- var SelectItem = React4.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs5(
1285
+ var SelectItem = React4.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs4(
1200
1286
  SelectPrimitive.Item,
1201
1287
  {
1202
1288
  ref,
@@ -1213,19 +1299,111 @@ var SelectItem = React4.forwardRef(({ className, children, ...props }, ref) => /
1213
1299
  ));
1214
1300
  SelectItem.displayName = SelectPrimitive.Item.displayName;
1215
1301
 
1302
+ // src/components/layout/AdminSidebar.tsx
1303
+ import { Fragment, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
1304
+ var NAV_ITEMS = [
1305
+ { page: "dashboard", label: "Dashboard", icon: LayoutDashboard },
1306
+ { page: "threads", label: "Threads", icon: MessageSquare, featureKey: "showThreads" },
1307
+ { page: "participants", label: "Participants", icon: Users, featureKey: "showParticipants" },
1308
+ { page: "agents", label: "Agents", icon: Bot, featureKey: "showAgents" },
1309
+ { page: "events", label: "Events", icon: Activity, featureKey: "showEvents" }
1310
+ ];
1311
+ var AdminSidebar = ({
1312
+ config,
1313
+ currentPage,
1314
+ currentRoute,
1315
+ onNavigate,
1316
+ onNavigateRoute,
1317
+ collections,
1318
+ namespace,
1319
+ onNamespaceChange
1320
+ }) => {
1321
+ const visibleItems = NAV_ITEMS.filter(
1322
+ (item) => !item.featureKey || config.features[item.featureKey]
1323
+ );
1324
+ const showCollections = config.features.showCollections && collections.length > 0;
1325
+ return /* @__PURE__ */ jsxs5(Sidebar, { collapsible: config.sidebar.collapsible, children: [
1326
+ /* @__PURE__ */ jsx9(SidebarHeader, { children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 px-2 py-3", children: [
1327
+ /* @__PURE__ */ jsx9("div", { className: "flex items-center justify-center shrink-0", children: config.branding.logo || /* @__PURE__ */ jsx9("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx9(LayoutDashboard, { className: "h-4 w-4" }) }) }),
1328
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-col min-w-0 group-data-[collapsible=icon]:hidden", children: [
1329
+ /* @__PURE__ */ jsx9("span", { className: "text-sm font-semibold truncate", children: config.branding.title }),
1330
+ config.branding.subtitle && /* @__PURE__ */ jsx9("span", { className: "text-xs text-muted-foreground truncate", children: config.branding.subtitle })
1331
+ ] })
1332
+ ] }) }),
1333
+ /* @__PURE__ */ jsxs5(SidebarContent, { children: [
1334
+ /* @__PURE__ */ jsxs5(SidebarGroup, { children: [
1335
+ /* @__PURE__ */ jsx9(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: "Navigation" }),
1336
+ /* @__PURE__ */ jsx9(SidebarGroupContent, { children: /* @__PURE__ */ jsx9(SidebarMenu, { children: visibleItems.map((item) => {
1337
+ const Icon2 = item.icon;
1338
+ const label = config.labels[`${item.page}Title`] || item.label;
1339
+ return /* @__PURE__ */ jsx9(SidebarMenuItem, { children: /* @__PURE__ */ jsxs5(
1340
+ SidebarMenuButton,
1341
+ {
1342
+ isActive: currentPage === item.page,
1343
+ onClick: () => onNavigate(item.page),
1344
+ tooltip: label,
1345
+ children: [
1346
+ /* @__PURE__ */ jsx9(Icon2, {}),
1347
+ /* @__PURE__ */ jsx9("span", { children: label })
1348
+ ]
1349
+ }
1350
+ ) }, item.page);
1351
+ }) }) })
1352
+ ] }),
1353
+ showCollections && /* @__PURE__ */ jsxs5(Fragment, { children: [
1354
+ /* @__PURE__ */ jsx9(SidebarSeparator, {}),
1355
+ /* @__PURE__ */ jsxs5(SidebarGroup, { children: [
1356
+ /* @__PURE__ */ jsx9(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: config.labels.collectionsTitle }),
1357
+ /* @__PURE__ */ jsx9(SidebarGroupContent, { children: /* @__PURE__ */ jsx9(SidebarMenu, { children: collections.map((col) => /* @__PURE__ */ jsx9(SidebarMenuItem, { children: /* @__PURE__ */ jsxs5(
1358
+ SidebarMenuButton,
1359
+ {
1360
+ isActive: currentRoute.page === "collection-items" && currentRoute.collection === col,
1361
+ onClick: () => onNavigateRoute({ page: "collection-items", collection: col }),
1362
+ tooltip: col,
1363
+ children: [
1364
+ /* @__PURE__ */ jsx9(Database, {}),
1365
+ /* @__PURE__ */ jsx9("span", { className: "capitalize", children: col })
1366
+ ]
1367
+ }
1368
+ ) }, col)) }) })
1369
+ ] })
1370
+ ] })
1371
+ ] }),
1372
+ /* @__PURE__ */ jsxs5(SidebarFooter, { children: [
1373
+ /* @__PURE__ */ jsxs5("div", { className: "group-data-[collapsible=icon]:hidden", children: [
1374
+ /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-muted-foreground mb-1 block px-2", children: "Namespace" }),
1375
+ /* @__PURE__ */ jsxs5(Select, { value: namespace || "__all__", onValueChange: (v) => onNamespaceChange(v === "__all__" ? "" : v), children: [
1376
+ /* @__PURE__ */ jsx9(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx9(SelectValue, { placeholder: "All namespaces" }) }),
1377
+ /* @__PURE__ */ jsxs5(SelectContent, { children: [
1378
+ /* @__PURE__ */ jsx9(SelectItem, { value: "__all__", children: "All namespaces" }),
1379
+ config.namespace && /* @__PURE__ */ jsx9(SelectItem, { value: config.namespace, children: config.namespace })
1380
+ ] })
1381
+ ] })
1382
+ ] }),
1383
+ /* @__PURE__ */ jsx9("div", { className: "hidden group-data-[collapsible=icon]:flex justify-center", children: /* @__PURE__ */ jsx9(ChevronsUpDown, { className: "h-4 w-4 text-muted-foreground" }) })
1384
+ ] }),
1385
+ /* @__PURE__ */ jsx9(SidebarRail, {})
1386
+ ] });
1387
+ };
1388
+
1216
1389
  // src/components/layout/AdminHeader.tsx
1217
- import { Fragment, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
1390
+ import { RefreshCw } from "lucide-react";
1391
+ import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1218
1392
  var PAGE_TITLES = {
1219
1393
  dashboard: "Dashboard",
1220
1394
  threads: "Threads",
1221
1395
  "thread-detail": "Thread Detail",
1222
1396
  participants: "Participants",
1397
+ "participant-detail": "Participant Detail",
1223
1398
  agents: "Agents",
1399
+ "agent-detail": "Agent Detail",
1400
+ "collection-items": "Collection",
1401
+ "collection-item-detail": "Item Detail",
1224
1402
  events: "Events"
1225
1403
  };
1226
1404
  var AdminHeader = ({
1227
1405
  config,
1228
- currentPage,
1406
+ currentRoute,
1229
1407
  range,
1230
1408
  interval,
1231
1409
  onRangeChange,
@@ -1233,19 +1411,22 @@ var AdminHeader = ({
1233
1411
  onRefresh,
1234
1412
  isLoading
1235
1413
  }) => {
1236
- const pageTitle = config.labels[`${currentPage}Title`] || PAGE_TITLES[currentPage];
1237
- return /* @__PURE__ */ jsx9(Card, { className: "py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80", children: /* @__PURE__ */ jsx9(CardHeader, { className: "p-2", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-2", children: [
1414
+ let pageTitle = config.labels[`${currentRoute.page}Title`] || PAGE_TITLES[currentRoute.page] || currentRoute.page;
1415
+ if (currentRoute.page === "collection-items" && currentRoute.collection) {
1416
+ pageTitle = currentRoute.collection.charAt(0).toUpperCase() + currentRoute.collection.slice(1);
1417
+ }
1418
+ return /* @__PURE__ */ jsx10(Card, { className: "py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80", children: /* @__PURE__ */ jsx10(CardHeader, { className: "p-2", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-2", children: [
1238
1419
  /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1", children: [
1239
1420
  /* @__PURE__ */ jsxs6(Tooltip, { children: [
1240
- /* @__PURE__ */ jsx9(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx9(SidebarTrigger, { className: "-ml-1" }) }),
1241
- /* @__PURE__ */ jsx9(TooltipContent, { children: "Toggle Sidebar" })
1421
+ /* @__PURE__ */ jsx10(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx10(SidebarTrigger, { className: "-ml-1" }) }),
1422
+ /* @__PURE__ */ jsx10(TooltipContent, { children: "Toggle Sidebar" })
1242
1423
  ] }),
1243
- /* @__PURE__ */ jsx9("h1", { className: "text-sm font-medium ml-2", children: pageTitle })
1424
+ /* @__PURE__ */ jsx10("h1", { className: "text-sm font-medium ml-2", children: pageTitle })
1244
1425
  ] }),
1245
- /* @__PURE__ */ jsx9("div", { className: "flex-1" }),
1426
+ /* @__PURE__ */ jsx10("div", { className: "flex-1" }),
1246
1427
  /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1", children: [
1247
- currentPage === "dashboard" && /* @__PURE__ */ jsxs6(Fragment, { children: [
1248
- /* @__PURE__ */ jsx9(
1428
+ currentRoute.page === "dashboard" && /* @__PURE__ */ jsxs6(Fragment2, { children: [
1429
+ /* @__PURE__ */ jsx10(
1249
1430
  Button,
1250
1431
  {
1251
1432
  variant: range === "24h" ? "default" : "ghost",
@@ -1255,7 +1436,7 @@ var AdminHeader = ({
1255
1436
  children: config.labels.range24h
1256
1437
  }
1257
1438
  ),
1258
- /* @__PURE__ */ jsx9(
1439
+ /* @__PURE__ */ jsx10(
1259
1440
  Button,
1260
1441
  {
1261
1442
  variant: range === "7d" ? "default" : "ghost",
@@ -1265,7 +1446,7 @@ var AdminHeader = ({
1265
1446
  children: config.labels.range7d
1266
1447
  }
1267
1448
  ),
1268
- /* @__PURE__ */ jsx9(
1449
+ /* @__PURE__ */ jsx10(
1269
1450
  Button,
1270
1451
  {
1271
1452
  variant: range === "30d" ? "default" : "ghost",
@@ -1281,17 +1462,17 @@ var AdminHeader = ({
1281
1462
  value: interval,
1282
1463
  onValueChange: (v) => onIntervalChange(v),
1283
1464
  children: [
1284
- /* @__PURE__ */ jsx9(SelectTrigger, { className: "h-7 w-[90px] text-xs", children: /* @__PURE__ */ jsx9(SelectValue, {}) }),
1465
+ /* @__PURE__ */ jsx10(SelectTrigger, { className: "h-7 w-[90px] text-xs", children: /* @__PURE__ */ jsx10(SelectValue, {}) }),
1285
1466
  /* @__PURE__ */ jsxs6(SelectContent, { children: [
1286
- /* @__PURE__ */ jsx9(SelectItem, { value: "hour", children: config.labels.intervalHour }),
1287
- /* @__PURE__ */ jsx9(SelectItem, { value: "day", children: config.labels.intervalDay })
1467
+ /* @__PURE__ */ jsx10(SelectItem, { value: "hour", children: config.labels.intervalHour }),
1468
+ /* @__PURE__ */ jsx10(SelectItem, { value: "day", children: config.labels.intervalDay })
1288
1469
  ] })
1289
1470
  ]
1290
1471
  }
1291
1472
  )
1292
1473
  ] }),
1293
1474
  /* @__PURE__ */ jsxs6(Tooltip, { children: [
1294
- /* @__PURE__ */ jsx9(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx9(
1475
+ /* @__PURE__ */ jsx10(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx10(
1295
1476
  Button,
1296
1477
  {
1297
1478
  variant: "ghost",
@@ -1299,7 +1480,7 @@ var AdminHeader = ({
1299
1480
  className: "h-7 w-7",
1300
1481
  onClick: onRefresh,
1301
1482
  disabled: isLoading,
1302
- children: /* @__PURE__ */ jsx9(
1483
+ children: /* @__PURE__ */ jsx10(
1303
1484
  RefreshCw,
1304
1485
  {
1305
1486
  className: `h-4 w-4 ${isLoading ? "animate-spin" : ""}`
@@ -1307,7 +1488,7 @@ var AdminHeader = ({
1307
1488
  )
1308
1489
  }
1309
1490
  ) }),
1310
- /* @__PURE__ */ jsx9(TooltipContent, { children: config.labels.refresh })
1491
+ /* @__PURE__ */ jsx10(TooltipContent, { children: config.labels.refresh })
1311
1492
  ] }),
1312
1493
  config.branding.actions
1313
1494
  ] })
@@ -1317,7 +1498,7 @@ var AdminHeader = ({
1317
1498
  // src/components/ui/badge.tsx
1318
1499
  import { Slot as Slot3 } from "@radix-ui/react-slot";
1319
1500
  import { cva as cva3 } from "class-variance-authority";
1320
- import { jsx as jsx10 } from "react/jsx-runtime";
1501
+ import { jsx as jsx11 } from "react/jsx-runtime";
1321
1502
  var badgeVariants = cva3(
1322
1503
  "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",
1323
1504
  {
@@ -1341,7 +1522,7 @@ function Badge({
1341
1522
  ...props
1342
1523
  }) {
1343
1524
  const Comp = asChild ? Slot3 : "span";
1344
- return /* @__PURE__ */ jsx10(
1525
+ return /* @__PURE__ */ jsx11(
1345
1526
  Comp,
1346
1527
  {
1347
1528
  "data-slot": "badge",
@@ -1352,7 +1533,7 @@ function Badge({
1352
1533
  }
1353
1534
 
1354
1535
  // src/components/views/DashboardView.tsx
1355
- import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
1536
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1356
1537
  var DashboardView = ({
1357
1538
  config,
1358
1539
  overview,
@@ -1399,27 +1580,27 @@ var DashboardView = ({
1399
1580
  const isEmpty = cards.every((card) => card.value === 0) && activity.length === 0 && threads.length === 0 && participants.length === 0 && agents.length === 0;
1400
1581
  return /* @__PURE__ */ jsxs7("div", { className: "space-y-6", children: [
1401
1582
  isEmpty && /* @__PURE__ */ jsxs7("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
1402
- /* @__PURE__ */ jsx11("h3", { className: "text-lg font-semibold", children: config.labels.emptyTitle }),
1403
- /* @__PURE__ */ jsx11("p", { className: "mt-2 text-sm text-muted-foreground", children: config.labels.emptyDescription })
1583
+ /* @__PURE__ */ jsx12("h3", { className: "text-lg font-semibold", children: config.labels.emptyTitle }),
1584
+ /* @__PURE__ */ jsx12("p", { className: "mt-2 text-sm text-muted-foreground", children: config.labels.emptyDescription })
1404
1585
  ] }),
1405
1586
  config.features.showOverview && /* @__PURE__ */ jsxs7("section", { className: "space-y-4", children: [
1406
- /* @__PURE__ */ jsx11(SectionHeading, { title: config.labels.overviewTitle }),
1407
- /* @__PURE__ */ jsx11("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-5", children: cards.map((card) => /* @__PURE__ */ jsxs7(
1587
+ /* @__PURE__ */ jsx12(SectionHeading, { title: config.labels.overviewTitle }),
1588
+ /* @__PURE__ */ jsx12("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-5", children: cards.map((card) => /* @__PURE__ */ jsxs7(
1408
1589
  "div",
1409
1590
  {
1410
1591
  className: "rounded-xl border bg-card p-5 shadow-sm",
1411
1592
  children: [
1412
- /* @__PURE__ */ jsx11("p", { className: "text-sm font-medium text-muted-foreground", children: card.label }),
1413
- /* @__PURE__ */ jsx11("p", { className: "mt-3 text-3xl font-semibold tracking-tight", children: formatNumber(card.value) }),
1414
- /* @__PURE__ */ jsx11("p", { className: "mt-2 text-xs text-muted-foreground", children: card.detail })
1593
+ /* @__PURE__ */ jsx12("p", { className: "text-sm font-medium text-muted-foreground", children: card.label }),
1594
+ /* @__PURE__ */ jsx12("p", { className: "mt-3 text-3xl font-semibold tracking-tight", children: formatNumber(card.value) }),
1595
+ /* @__PURE__ */ jsx12("p", { className: "mt-2 text-xs text-muted-foreground", children: card.detail })
1415
1596
  ]
1416
1597
  },
1417
1598
  card.label
1418
1599
  )) })
1419
1600
  ] }),
1420
1601
  config.features.showActivity && /* @__PURE__ */ jsxs7("section", { className: "space-y-4", children: [
1421
- /* @__PURE__ */ jsx11(SectionHeading, { title: config.labels.activityTitle }),
1422
- /* @__PURE__ */ jsx11(
1602
+ /* @__PURE__ */ jsx12(SectionHeading, { title: config.labels.activityTitle }),
1603
+ /* @__PURE__ */ jsx12(
1423
1604
  ActivityChart,
1424
1605
  {
1425
1606
  interval,
@@ -1430,7 +1611,7 @@ var DashboardView = ({
1430
1611
  )
1431
1612
  ] }),
1432
1613
  /* @__PURE__ */ jsxs7("div", { className: "grid gap-6 lg:grid-cols-3", children: [
1433
- config.features.showThreads && /* @__PURE__ */ jsx11(
1614
+ config.features.showThreads && /* @__PURE__ */ jsx12(
1434
1615
  DataTable,
1435
1616
  {
1436
1617
  rows: threads,
@@ -1438,7 +1619,7 @@ var DashboardView = ({
1438
1619
  searchValue: threadSearch,
1439
1620
  setSearchValue: onThreadSearchChange,
1440
1621
  title: config.labels.threadsTitle,
1441
- children: /* @__PURE__ */ jsx11(
1622
+ children: /* @__PURE__ */ jsx12(
1442
1623
  ThreadsTable,
1443
1624
  {
1444
1625
  rows: threads,
@@ -1448,7 +1629,7 @@ var DashboardView = ({
1448
1629
  )
1449
1630
  }
1450
1631
  ),
1451
- config.features.showParticipants && /* @__PURE__ */ jsx11(
1632
+ config.features.showParticipants && /* @__PURE__ */ jsx12(
1452
1633
  DataTable,
1453
1634
  {
1454
1635
  rows: participants,
@@ -1456,10 +1637,10 @@ var DashboardView = ({
1456
1637
  searchValue: participantSearch,
1457
1638
  setSearchValue: onParticipantSearchChange,
1458
1639
  title: config.labels.participantsTitle,
1459
- children: /* @__PURE__ */ jsx11(ParticipantsTable, { rows: participants, labels: config.labels })
1640
+ children: /* @__PURE__ */ jsx12(ParticipantsTable, { rows: participants, labels: config.labels })
1460
1641
  }
1461
1642
  ),
1462
- config.features.showAgents && /* @__PURE__ */ jsx11(
1643
+ config.features.showAgents && /* @__PURE__ */ jsx12(
1463
1644
  DataTable,
1464
1645
  {
1465
1646
  rows: agents,
@@ -1467,14 +1648,14 @@ var DashboardView = ({
1467
1648
  searchValue: agentSearch,
1468
1649
  setSearchValue: onAgentSearchChange,
1469
1650
  title: config.labels.agentsTitle,
1470
- children: /* @__PURE__ */ jsx11(AgentsTable, { rows: agents, labels: config.labels })
1651
+ children: /* @__PURE__ */ jsx12(AgentsTable, { rows: agents, labels: config.labels })
1471
1652
  }
1472
1653
  )
1473
1654
  ] })
1474
1655
  ] });
1475
1656
  };
1476
1657
  function SectionHeading({ title }) {
1477
- return /* @__PURE__ */ jsx11("h3", { className: "text-lg font-semibold tracking-tight", children: title });
1658
+ return /* @__PURE__ */ jsx12("h3", { className: "text-lg font-semibold tracking-tight", children: title });
1478
1659
  }
1479
1660
  function ActivityChart(props) {
1480
1661
  const trimmedPoints = props.points.slice(-props.maxBars);
@@ -1482,12 +1663,12 @@ function ActivityChart(props) {
1482
1663
  ...trimmedPoints.map((point) => point.messageCount),
1483
1664
  1
1484
1665
  );
1485
- return /* @__PURE__ */ jsx11("div", { className: "rounded-xl border bg-card p-5 shadow-sm", children: trimmedPoints.length === 0 ? /* @__PURE__ */ jsx11("p", { className: "text-sm text-muted-foreground", children: props.labels.noResults }) : /* @__PURE__ */ jsx11("div", { className: "flex min-h-48 items-end gap-2", children: trimmedPoints.map((point) => /* @__PURE__ */ jsxs7(
1666
+ return /* @__PURE__ */ jsx12("div", { className: "rounded-xl border bg-card p-5 shadow-sm", children: trimmedPoints.length === 0 ? /* @__PURE__ */ jsx12("p", { className: "text-sm text-muted-foreground", children: props.labels.noResults }) : /* @__PURE__ */ jsx12("div", { className: "flex min-h-48 items-end gap-2", children: trimmedPoints.map((point) => /* @__PURE__ */ jsxs7(
1486
1667
  "div",
1487
1668
  {
1488
1669
  className: "flex min-w-0 flex-1 flex-col items-center gap-2",
1489
1670
  children: [
1490
- /* @__PURE__ */ jsx11("div", { className: "flex h-36 w-full items-end rounded-lg bg-muted px-1 pb-1", children: /* @__PURE__ */ jsx11(
1671
+ /* @__PURE__ */ jsx12("div", { className: "flex h-36 w-full items-end rounded-lg bg-muted px-1 pb-1", children: /* @__PURE__ */ jsx12(
1491
1672
  "div",
1492
1673
  {
1493
1674
  className: "w-full rounded-md bg-primary transition-all",
@@ -1497,7 +1678,7 @@ function ActivityChart(props) {
1497
1678
  }
1498
1679
  ) }),
1499
1680
  /* @__PURE__ */ jsxs7("div", { className: "text-center", children: [
1500
- /* @__PURE__ */ jsx11("p", { className: "text-xs font-medium", children: formatBucket(point.bucket, props.interval) }),
1681
+ /* @__PURE__ */ jsx12("p", { className: "text-xs font-medium", children: formatBucket(point.bucket, props.interval) }),
1501
1682
  /* @__PURE__ */ jsxs7("p", { className: "text-[11px] text-muted-foreground", children: [
1502
1683
  formatNumber(point.messageCount),
1503
1684
  " msg"
@@ -1511,8 +1692,8 @@ function ActivityChart(props) {
1511
1692
  function DataTable(props) {
1512
1693
  return /* @__PURE__ */ jsxs7("div", { className: "rounded-xl border bg-card p-5 shadow-sm", children: [
1513
1694
  /* @__PURE__ */ jsxs7("div", { className: "mb-4 flex items-center justify-between gap-3", children: [
1514
- /* @__PURE__ */ jsx11(SectionHeading, { title: props.title }),
1515
- /* @__PURE__ */ jsx11(
1695
+ /* @__PURE__ */ jsx12(SectionHeading, { title: props.title }),
1696
+ /* @__PURE__ */ jsx12(
1516
1697
  Input,
1517
1698
  {
1518
1699
  className: "h-8 w-full max-w-44",
@@ -1522,7 +1703,7 @@ function DataTable(props) {
1522
1703
  }
1523
1704
  )
1524
1705
  ] }),
1525
- props.rows.length === 0 ? /* @__PURE__ */ jsx11("p", { className: "text-sm text-muted-foreground", children: "No results" }) : props.children
1706
+ props.rows.length === 0 ? /* @__PURE__ */ jsx12("p", { className: "text-sm text-muted-foreground", children: "No results" }) : props.children
1526
1707
  ] });
1527
1708
  }
1528
1709
  function ThreadsTable({
@@ -1530,7 +1711,7 @@ function ThreadsTable({
1530
1711
  labels,
1531
1712
  onThreadClick
1532
1713
  }) {
1533
- return /* @__PURE__ */ jsx11("div", { className: "space-y-3", children: rows.map((thread) => /* @__PURE__ */ jsxs7(
1714
+ return /* @__PURE__ */ jsx12("div", { className: "space-y-3", children: rows.map((thread) => /* @__PURE__ */ jsxs7(
1534
1715
  "div",
1535
1716
  {
1536
1717
  className: cn(
@@ -1541,10 +1722,10 @@ function ThreadsTable({
1541
1722
  children: [
1542
1723
  /* @__PURE__ */ jsxs7("div", { className: "flex items-start justify-between gap-3", children: [
1543
1724
  /* @__PURE__ */ jsxs7("div", { className: "min-w-0", children: [
1544
- /* @__PURE__ */ jsx11("p", { className: "font-medium", children: thread.name }),
1545
- /* @__PURE__ */ jsx11("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: thread.summary ?? thread.lastMessagePreview ?? "No summary yet" })
1725
+ /* @__PURE__ */ jsx12("p", { className: "font-medium", children: thread.name }),
1726
+ /* @__PURE__ */ jsx12("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: thread.summary ?? thread.lastMessagePreview ?? "No summary yet" })
1546
1727
  ] }),
1547
- /* @__PURE__ */ jsx11(
1728
+ /* @__PURE__ */ jsx12(
1548
1729
  Badge,
1549
1730
  {
1550
1731
  variant: thread.status === "archived" ? "secondary" : "default",
@@ -1561,7 +1742,7 @@ function ThreadsTable({
1561
1742
  thread.participantIds.length,
1562
1743
  " participants"
1563
1744
  ] }),
1564
- /* @__PURE__ */ jsx11("span", { children: formatDate(thread.lastActivityAt) })
1745
+ /* @__PURE__ */ jsx12("span", { children: formatDate(thread.lastActivityAt) })
1565
1746
  ] })
1566
1747
  ]
1567
1748
  },
@@ -1572,17 +1753,17 @@ function ParticipantsTable({
1572
1753
  rows,
1573
1754
  labels
1574
1755
  }) {
1575
- return /* @__PURE__ */ jsx11("div", { className: "space-y-3", children: rows.map((participant) => /* @__PURE__ */ jsxs7(
1756
+ return /* @__PURE__ */ jsx12("div", { className: "space-y-3", children: rows.map((participant) => /* @__PURE__ */ jsxs7(
1576
1757
  "div",
1577
1758
  {
1578
1759
  className: "rounded-lg border bg-muted/50 p-4",
1579
1760
  children: [
1580
1761
  /* @__PURE__ */ jsxs7("div", { className: "flex items-start justify-between gap-3", children: [
1581
1762
  /* @__PURE__ */ jsxs7("div", { className: "min-w-0", children: [
1582
- /* @__PURE__ */ jsx11("p", { className: "font-medium", children: participant.displayName }),
1583
- /* @__PURE__ */ jsx11("p", { className: "mt-1 text-xs uppercase tracking-[0.18em] text-muted-foreground", children: participant.participantType })
1763
+ /* @__PURE__ */ jsx12("p", { className: "font-medium", children: participant.displayName }),
1764
+ /* @__PURE__ */ jsx12("p", { className: "mt-1 text-xs uppercase tracking-[0.18em] text-muted-foreground", children: participant.participantType })
1584
1765
  ] }),
1585
- /* @__PURE__ */ jsx11(Badge, { variant: "outline", children: participant.isGlobal ? labels.scopeGlobal : labels.scopeScoped })
1766
+ /* @__PURE__ */ jsx12(Badge, { variant: "outline", children: participant.isGlobal ? labels.scopeGlobal : labels.scopeScoped })
1586
1767
  ] }),
1587
1768
  /* @__PURE__ */ jsxs7("div", { className: "mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground", children: [
1588
1769
  /* @__PURE__ */ jsxs7("span", { children: [
@@ -1593,7 +1774,7 @@ function ParticipantsTable({
1593
1774
  formatNumber(participant.threadCount),
1594
1775
  " threads"
1595
1776
  ] }),
1596
- /* @__PURE__ */ jsx11("span", { children: formatDate(participant.lastActivityAt) })
1777
+ /* @__PURE__ */ jsx12("span", { children: formatDate(participant.lastActivityAt) })
1597
1778
  ] })
1598
1779
  ]
1599
1780
  },
@@ -1604,17 +1785,17 @@ function AgentsTable({
1604
1785
  rows,
1605
1786
  labels
1606
1787
  }) {
1607
- return /* @__PURE__ */ jsx11("div", { className: "space-y-3", children: rows.map((agent) => /* @__PURE__ */ jsxs7(
1788
+ return /* @__PURE__ */ jsx12("div", { className: "space-y-3", children: rows.map((agent) => /* @__PURE__ */ jsxs7(
1608
1789
  "div",
1609
1790
  {
1610
1791
  className: "rounded-lg border bg-muted/50 p-4",
1611
1792
  children: [
1612
1793
  /* @__PURE__ */ jsxs7("div", { className: "flex items-start justify-between gap-3", children: [
1613
1794
  /* @__PURE__ */ jsxs7("div", { className: "min-w-0", children: [
1614
- /* @__PURE__ */ jsx11("p", { className: "font-medium", children: agent.displayName }),
1615
- /* @__PURE__ */ jsx11("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: agent.description ?? agent.agentId })
1795
+ /* @__PURE__ */ jsx12("p", { className: "font-medium", children: agent.displayName }),
1796
+ /* @__PURE__ */ jsx12("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: agent.description ?? agent.agentId })
1616
1797
  ] }),
1617
- /* @__PURE__ */ jsx11(Badge, { variant: "outline", children: agent.isConfigured ? labels.configured : labels.unconfigured })
1798
+ /* @__PURE__ */ jsx12(Badge, { variant: "outline", children: agent.isConfigured ? labels.configured : labels.unconfigured })
1618
1799
  ] }),
1619
1800
  /* @__PURE__ */ jsxs7("div", { className: "mt-3 grid grid-cols-2 gap-2 text-xs text-muted-foreground", children: [
1620
1801
  /* @__PURE__ */ jsxs7("span", { children: [
@@ -1668,7 +1849,7 @@ function formatNumber(value) {
1668
1849
 
1669
1850
  // src/components/views/ThreadsView.tsx
1670
1851
  import { Search, MessageSquare as MessageSquare2 } from "lucide-react";
1671
- import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
1852
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
1672
1853
  var ThreadsView = ({
1673
1854
  config,
1674
1855
  threads,
@@ -1678,8 +1859,8 @@ var ThreadsView = ({
1678
1859
  }) => {
1679
1860
  return /* @__PURE__ */ jsxs8("div", { className: "space-y-4", children: [
1680
1861
  /* @__PURE__ */ jsxs8("div", { className: "relative max-w-sm", children: [
1681
- /* @__PURE__ */ jsx12(Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
1682
- /* @__PURE__ */ jsx12(
1862
+ /* @__PURE__ */ jsx13(Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
1863
+ /* @__PURE__ */ jsx13(
1683
1864
  Input,
1684
1865
  {
1685
1866
  className: "pl-9",
@@ -1690,9 +1871,9 @@ var ThreadsView = ({
1690
1871
  )
1691
1872
  ] }),
1692
1873
  threads.length === 0 ? /* @__PURE__ */ jsxs8("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
1693
- /* @__PURE__ */ jsx12(MessageSquare2, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
1694
- /* @__PURE__ */ jsx12("p", { className: "mt-3 text-sm text-muted-foreground", children: searchValue ? config.labels.noResults : config.labels.emptyDescription })
1695
- ] }) : /* @__PURE__ */ jsx12("div", { className: "space-y-2", children: threads.map((thread) => /* @__PURE__ */ jsxs8(
1874
+ /* @__PURE__ */ jsx13(MessageSquare2, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
1875
+ /* @__PURE__ */ jsx13("p", { className: "mt-3 text-sm text-muted-foreground", children: searchValue ? config.labels.noResults : config.labels.emptyDescription })
1876
+ ] }) : /* @__PURE__ */ jsx13("div", { className: "space-y-2", children: threads.map((thread) => /* @__PURE__ */ jsxs8(
1696
1877
  "div",
1697
1878
  {
1698
1879
  className: "flex items-center gap-4 rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50 cursor-pointer",
@@ -1700,8 +1881,8 @@ var ThreadsView = ({
1700
1881
  children: [
1701
1882
  /* @__PURE__ */ jsxs8("div", { className: "flex-1 min-w-0", children: [
1702
1883
  /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
1703
- /* @__PURE__ */ jsx12("p", { className: "font-medium truncate", children: thread.name }),
1704
- /* @__PURE__ */ jsx12(
1884
+ /* @__PURE__ */ jsx13("p", { className: "font-medium truncate", children: thread.name }),
1885
+ /* @__PURE__ */ jsx13(
1705
1886
  Badge,
1706
1887
  {
1707
1888
  variant: thread.status === "archived" ? "secondary" : "default",
@@ -1710,7 +1891,7 @@ var ThreadsView = ({
1710
1891
  }
1711
1892
  )
1712
1893
  ] }),
1713
- /* @__PURE__ */ jsx12("p", { className: "mt-1 text-sm text-muted-foreground truncate", children: thread.summary ?? thread.lastMessagePreview ?? "No summary yet" })
1894
+ /* @__PURE__ */ jsx13("p", { className: "mt-1 text-sm text-muted-foreground truncate", children: thread.summary ?? thread.lastMessagePreview ?? "No summary yet" })
1714
1895
  ] }),
1715
1896
  /* @__PURE__ */ jsxs8("div", { className: "text-right text-xs text-muted-foreground shrink-0 space-y-1", children: [
1716
1897
  /* @__PURE__ */ jsxs8("p", { children: [
@@ -1721,7 +1902,7 @@ var ThreadsView = ({
1721
1902
  thread.participantIds.length,
1722
1903
  " participants"
1723
1904
  ] }),
1724
- /* @__PURE__ */ jsx12("p", { children: formatDate2(thread.lastActivityAt) })
1905
+ /* @__PURE__ */ jsx13("p", { children: formatDate2(thread.lastActivityAt) })
1725
1906
  ] })
1726
1907
  ]
1727
1908
  },
@@ -1755,7 +1936,7 @@ import {
1755
1936
  Wrench,
1756
1937
  Cpu
1757
1938
  } from "lucide-react";
1758
- import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
1939
+ import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
1759
1940
  var MESSAGES_PAGE_SIZE = 50;
1760
1941
  var ThreadDetailView = ({
1761
1942
  threadId,
@@ -1813,36 +1994,36 @@ var ThreadDetailView = ({
1813
1994
  }
1814
1995
  }, [threadId, pageInfo, isLoadingMore, config.baseUrl, config.getRequestHeaders]);
1815
1996
  if (isLoading) {
1816
- return /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx13(Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
1997
+ return /* @__PURE__ */ jsx14("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx14(Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
1817
1998
  }
1818
1999
  if (error) {
1819
2000
  return /* @__PURE__ */ jsxs9("div", { className: "space-y-4 py-10 text-center", children: [
1820
- /* @__PURE__ */ jsx13("p", { className: "text-destructive font-medium", children: error.message }),
2001
+ /* @__PURE__ */ jsx14("p", { className: "text-destructive font-medium", children: error.message }),
1821
2002
  /* @__PURE__ */ jsxs9("div", { className: "flex justify-center gap-2", children: [
1822
2003
  /* @__PURE__ */ jsxs9(Button, { variant: "outline", onClick: onBack, children: [
1823
- /* @__PURE__ */ jsx13(ArrowLeft, { className: "mr-2 h-4 w-4" }),
2004
+ /* @__PURE__ */ jsx14(ArrowLeft, { className: "mr-2 h-4 w-4" }),
1824
2005
  "Back"
1825
2006
  ] }),
1826
- /* @__PURE__ */ jsx13(Button, { variant: "destructive", onClick: () => void loadInitial(), children: config.labels.retry })
2007
+ /* @__PURE__ */ jsx14(Button, { variant: "destructive", onClick: () => void loadInitial(), children: config.labels.retry })
1827
2008
  ] })
1828
2009
  ] });
1829
2010
  }
1830
2011
  return /* @__PURE__ */ jsxs9("div", { className: "space-y-6", children: [
1831
2012
  /* @__PURE__ */ jsxs9("div", { className: "flex items-start gap-4", children: [
1832
- /* @__PURE__ */ jsx13(
2013
+ /* @__PURE__ */ jsx14(
1833
2014
  Button,
1834
2015
  {
1835
2016
  variant: "ghost",
1836
2017
  size: "icon",
1837
2018
  className: "mt-1 shrink-0",
1838
2019
  onClick: onBack,
1839
- children: /* @__PURE__ */ jsx13(ArrowLeft, { className: "h-4 w-4" })
2020
+ children: /* @__PURE__ */ jsx14(ArrowLeft, { className: "h-4 w-4" })
1840
2021
  }
1841
2022
  ),
1842
2023
  /* @__PURE__ */ jsxs9("div", { className: "flex-1 min-w-0", children: [
1843
2024
  /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
1844
- /* @__PURE__ */ jsx13("h2", { className: "text-xl font-semibold truncate", children: thread?.name ?? threadId }),
1845
- /* @__PURE__ */ jsx13(
2025
+ /* @__PURE__ */ jsx14("h2", { className: "text-xl font-semibold truncate", children: thread?.name ?? threadId }),
2026
+ /* @__PURE__ */ jsx14(
1846
2027
  Badge,
1847
2028
  {
1848
2029
  variant: thread?.status === "archived" ? "secondary" : "default",
@@ -1850,7 +2031,7 @@ var ThreadDetailView = ({
1850
2031
  }
1851
2032
  )
1852
2033
  ] }),
1853
- thread?.summary && /* @__PURE__ */ jsx13("p", { className: "mt-1 text-sm text-muted-foreground", children: thread.summary }),
2034
+ thread?.summary && /* @__PURE__ */ jsx14("p", { className: "mt-1 text-sm text-muted-foreground", children: thread.summary }),
1854
2035
  /* @__PURE__ */ jsxs9("div", { className: "mt-2 flex flex-wrap gap-4 text-xs text-muted-foreground", children: [
1855
2036
  thread?.createdAt && /* @__PURE__ */ jsxs9("span", { children: [
1856
2037
  "Created ",
@@ -1868,13 +2049,13 @@ var ThreadDetailView = ({
1868
2049
  ] })
1869
2050
  ] }),
1870
2051
  /* @__PURE__ */ jsxs9("div", { className: "space-y-1", children: [
1871
- /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs9("h3", { className: "text-sm font-medium text-muted-foreground", children: [
2052
+ /* @__PURE__ */ jsx14("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs9("h3", { className: "text-sm font-medium text-muted-foreground", children: [
1872
2053
  "Messages (",
1873
2054
  messages.length,
1874
2055
  pageInfo?.hasMoreBefore ? "+" : "",
1875
2056
  ")"
1876
2057
  ] }) }),
1877
- pageInfo?.hasMoreBefore && /* @__PURE__ */ jsx13("div", { className: "flex justify-center py-2", children: /* @__PURE__ */ jsxs9(
2058
+ pageInfo?.hasMoreBefore && /* @__PURE__ */ jsx14("div", { className: "flex justify-center py-2", children: /* @__PURE__ */ jsxs9(
1878
2059
  Button,
1879
2060
  {
1880
2061
  variant: "ghost",
@@ -1882,12 +2063,12 @@ var ThreadDetailView = ({
1882
2063
  onClick: () => void loadMore(),
1883
2064
  disabled: isLoadingMore,
1884
2065
  children: [
1885
- isLoadingMore ? /* @__PURE__ */ jsx13(Loader2, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx13(ChevronUp2, { className: "mr-2 h-3 w-3" }),
2066
+ isLoadingMore ? /* @__PURE__ */ jsx14(Loader2, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx14(ChevronUp2, { className: "mr-2 h-3 w-3" }),
1886
2067
  "Load older messages"
1887
2068
  ]
1888
2069
  }
1889
2070
  ) }),
1890
- /* @__PURE__ */ jsx13("div", { className: "rounded-lg border bg-card", children: messages.length === 0 ? /* @__PURE__ */ jsx13("p", { className: "p-6 text-center text-sm text-muted-foreground", children: "No messages in this thread yet." }) : /* @__PURE__ */ jsx13("div", { className: "divide-y", children: messages.map((message) => /* @__PURE__ */ jsx13(MessageRow, { message }, message.id)) }) })
2071
+ /* @__PURE__ */ jsx14("div", { className: "rounded-lg border bg-card", children: messages.length === 0 ? /* @__PURE__ */ jsx14("p", { className: "p-6 text-center text-sm text-muted-foreground", children: "No messages in this thread yet." }) : /* @__PURE__ */ jsx14("div", { className: "divide-y", children: messages.map((message) => /* @__PURE__ */ jsx14(MessageRow, { message }, message.id)) }) })
1891
2072
  ] })
1892
2073
  ] });
1893
2074
  };
@@ -1895,15 +2076,15 @@ function MessageRow({ message }) {
1895
2076
  const [expanded, setExpanded] = useState4(false);
1896
2077
  const hasToolCalls = Array.isArray(message.toolCalls) && message.toolCalls.length > 0;
1897
2078
  const hasReasoning = !!message.reasoning;
1898
- return /* @__PURE__ */ jsx13("div", { className: "px-4 py-3", children: /* @__PURE__ */ jsxs9("div", { className: "flex items-start gap-3", children: [
1899
- /* @__PURE__ */ jsx13(SenderIcon, { senderType: message.senderType }),
2079
+ return /* @__PURE__ */ jsx14("div", { className: "px-4 py-3", children: /* @__PURE__ */ jsxs9("div", { className: "flex items-start gap-3", children: [
2080
+ /* @__PURE__ */ jsx14(SenderIcon, { senderType: message.senderType }),
1900
2081
  /* @__PURE__ */ jsxs9("div", { className: "flex-1 min-w-0", children: [
1901
2082
  /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2 text-xs", children: [
1902
- /* @__PURE__ */ jsx13("span", { className: "font-medium", children: message.senderId ?? message.senderUserId ?? message.senderType }),
1903
- /* @__PURE__ */ jsx13(Badge, { variant: "outline", className: "text-[10px] px-1.5 py-0", children: message.senderType }),
1904
- message.createdAt && /* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: formatTimestamp(message.createdAt) })
2083
+ /* @__PURE__ */ jsx14("span", { className: "font-medium", children: message.senderId ?? message.senderUserId ?? message.senderType }),
2084
+ /* @__PURE__ */ jsx14(Badge, { variant: "outline", className: "text-[10px] px-1.5 py-0", children: message.senderType }),
2085
+ message.createdAt && /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: formatTimestamp(message.createdAt) })
1905
2086
  ] }),
1906
- message.content && /* @__PURE__ */ jsx13("p", { className: "mt-1 text-sm whitespace-pre-wrap break-words", children: message.content }),
2087
+ message.content && /* @__PURE__ */ jsx14("p", { className: "mt-1 text-sm whitespace-pre-wrap break-words", children: message.content }),
1907
2088
  (hasToolCalls || hasReasoning) && /* @__PURE__ */ jsxs9("div", { className: "mt-2 space-y-2", children: [
1908
2089
  hasToolCalls && /* @__PURE__ */ jsxs9(
1909
2090
  "button",
@@ -1912,7 +2093,7 @@ function MessageRow({ message }) {
1912
2093
  onClick: () => setExpanded(!expanded),
1913
2094
  className: "inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",
1914
2095
  children: [
1915
- /* @__PURE__ */ jsx13(Wrench, { className: "h-3 w-3" }),
2096
+ /* @__PURE__ */ jsx14(Wrench, { className: "h-3 w-3" }),
1916
2097
  message.toolCalls.length,
1917
2098
  " tool call",
1918
2099
  message.toolCalls.length > 1 ? "s" : ""
@@ -1926,12 +2107,12 @@ function MessageRow({ message }) {
1926
2107
  onClick: () => setExpanded(!expanded),
1927
2108
  className: "inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",
1928
2109
  children: [
1929
- /* @__PURE__ */ jsx13(Cpu, { className: "h-3 w-3" }),
2110
+ /* @__PURE__ */ jsx14(Cpu, { className: "h-3 w-3" }),
1930
2111
  "Reasoning"
1931
2112
  ]
1932
2113
  }
1933
2114
  ),
1934
- expanded && /* @__PURE__ */ jsx13("pre", { className: "mt-2 rounded-md bg-muted p-3 text-xs overflow-auto max-h-60", children: JSON.stringify(
2115
+ expanded && /* @__PURE__ */ jsx14("pre", { className: "mt-2 rounded-md bg-muted p-3 text-xs overflow-auto max-h-60", children: JSON.stringify(
1935
2116
  {
1936
2117
  ...hasToolCalls ? { toolCalls: message.toolCalls } : {},
1937
2118
  ...hasReasoning ? { reasoning: message.reasoning } : {}
@@ -1947,13 +2128,13 @@ function SenderIcon({ senderType }) {
1947
2128
  const base = "flex h-7 w-7 shrink-0 items-center justify-center rounded-full";
1948
2129
  switch (senderType) {
1949
2130
  case "agent":
1950
- return /* @__PURE__ */ jsx13("div", { className: cn(base, "bg-primary/10 text-primary"), children: /* @__PURE__ */ jsx13(Bot2, { className: "h-3.5 w-3.5" }) });
2131
+ return /* @__PURE__ */ jsx14("div", { className: cn(base, "bg-primary/10 text-primary"), children: /* @__PURE__ */ jsx14(Bot2, { className: "h-3.5 w-3.5" }) });
1951
2132
  case "user":
1952
- return /* @__PURE__ */ jsx13("div", { className: cn(base, "bg-secondary text-secondary-foreground"), children: /* @__PURE__ */ jsx13(User, { className: "h-3.5 w-3.5" }) });
2133
+ return /* @__PURE__ */ jsx14("div", { className: cn(base, "bg-secondary text-secondary-foreground"), children: /* @__PURE__ */ jsx14(User, { className: "h-3.5 w-3.5" }) });
1953
2134
  case "tool":
1954
- return /* @__PURE__ */ jsx13("div", { className: cn(base, "bg-muted text-muted-foreground"), children: /* @__PURE__ */ jsx13(Wrench, { className: "h-3.5 w-3.5" }) });
2135
+ return /* @__PURE__ */ jsx14("div", { className: cn(base, "bg-muted text-muted-foreground"), children: /* @__PURE__ */ jsx14(Wrench, { className: "h-3.5 w-3.5" }) });
1955
2136
  default:
1956
- return /* @__PURE__ */ jsx13("div", { className: cn(base, "bg-muted text-muted-foreground"), children: /* @__PURE__ */ jsx13(Cpu, { className: "h-3.5 w-3.5" }) });
2137
+ return /* @__PURE__ */ jsx14("div", { className: cn(base, "bg-muted text-muted-foreground"), children: /* @__PURE__ */ jsx14(Cpu, { className: "h-3.5 w-3.5" }) });
1957
2138
  }
1958
2139
  }
1959
2140
  function formatDate3(value) {
@@ -1977,8 +2158,634 @@ function formatTimestamp(value) {
1977
2158
  });
1978
2159
  }
1979
2160
 
2161
+ // src/components/views/ParticipantsView.tsx
2162
+ import { Search as Search2, Users as Users2 } from "lucide-react";
2163
+ import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
2164
+ var ParticipantsView = ({
2165
+ config,
2166
+ participants,
2167
+ searchValue,
2168
+ onSearchChange,
2169
+ onParticipantClick
2170
+ }) => {
2171
+ return /* @__PURE__ */ jsxs10("div", { className: "space-y-4", children: [
2172
+ /* @__PURE__ */ jsxs10("div", { className: "relative max-w-sm", children: [
2173
+ /* @__PURE__ */ jsx15(Search2, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
2174
+ /* @__PURE__ */ jsx15(
2175
+ Input,
2176
+ {
2177
+ className: "pl-9",
2178
+ placeholder: config.labels.participantSearchPlaceholder,
2179
+ value: searchValue,
2180
+ onChange: (e) => onSearchChange(e.target.value)
2181
+ }
2182
+ )
2183
+ ] }),
2184
+ participants.length === 0 ? /* @__PURE__ */ jsxs10("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
2185
+ /* @__PURE__ */ jsx15(Users2, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
2186
+ /* @__PURE__ */ jsx15("p", { className: "mt-3 text-sm text-muted-foreground", children: searchValue ? config.labels.noResults : config.labels.emptyDescription })
2187
+ ] }) : /* @__PURE__ */ jsx15("div", { className: "space-y-2", children: participants.map((p) => /* @__PURE__ */ jsxs10(
2188
+ "div",
2189
+ {
2190
+ className: "flex items-center gap-4 rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50 cursor-pointer",
2191
+ onClick: () => onParticipantClick?.(p.externalId),
2192
+ children: [
2193
+ /* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0", children: [
2194
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
2195
+ /* @__PURE__ */ jsx15("p", { className: "font-medium truncate", children: p.displayName }),
2196
+ /* @__PURE__ */ jsx15(Badge, { variant: "outline", className: "shrink-0 text-xs", children: p.participantType }),
2197
+ /* @__PURE__ */ jsx15(Badge, { variant: p.isGlobal ? "default" : "secondary", className: "shrink-0 text-xs", children: p.isGlobal ? config.labels.scopeGlobal : config.labels.scopeScoped })
2198
+ ] }),
2199
+ /* @__PURE__ */ jsx15("p", { className: "mt-1 text-xs text-muted-foreground", children: p.externalId })
2200
+ ] }),
2201
+ /* @__PURE__ */ jsxs10("div", { className: "text-right text-xs text-muted-foreground shrink-0 space-y-1", children: [
2202
+ /* @__PURE__ */ jsxs10("p", { children: [
2203
+ formatNumber3(p.messageCount),
2204
+ " messages"
2205
+ ] }),
2206
+ /* @__PURE__ */ jsxs10("p", { children: [
2207
+ formatNumber3(p.threadCount),
2208
+ " threads"
2209
+ ] }),
2210
+ /* @__PURE__ */ jsx15("p", { children: formatDate4(p.lastActivityAt) })
2211
+ ] })
2212
+ ]
2213
+ },
2214
+ `${p.namespace}:${p.externalId}`
2215
+ )) })
2216
+ ] });
2217
+ };
2218
+ function formatDate4(value) {
2219
+ if (!value) return "No activity";
2220
+ const date = new Date(value);
2221
+ if (Number.isNaN(date.getTime())) return value;
2222
+ return date.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
2223
+ }
2224
+ function formatNumber3(value) {
2225
+ return new Intl.NumberFormat().format(value);
2226
+ }
2227
+
2228
+ // src/components/views/ParticipantDetailView.tsx
2229
+ import { useCallback as useCallback4, useEffect as useEffect6, useState as useState5 } from "react";
2230
+ import { ArrowLeft as ArrowLeft2, Loader2 as Loader22, Save } from "lucide-react";
2231
+ import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
2232
+ var ParticipantDetailView = ({
2233
+ participantId,
2234
+ config,
2235
+ onBack
2236
+ }) => {
2237
+ const [data, setData] = useState5(null);
2238
+ const [editJson, setEditJson] = useState5("");
2239
+ const [isLoading, setIsLoading] = useState5(true);
2240
+ const [isSaving, setIsSaving] = useState5(false);
2241
+ const [error, setError] = useState5(null);
2242
+ const [saveMessage, setSaveMessage] = useState5(null);
2243
+ const fetchOptions = {
2244
+ baseUrl: config.baseUrl,
2245
+ getRequestHeaders: config.getRequestHeaders
2246
+ };
2247
+ const load = useCallback4(async () => {
2248
+ setIsLoading(true);
2249
+ setError(null);
2250
+ try {
2251
+ const result = await fetchParticipantDetail(participantId, fetchOptions);
2252
+ setData(result);
2253
+ setEditJson(JSON.stringify(result, null, 2));
2254
+ } catch (err) {
2255
+ setError(err instanceof Error ? err.message : "Failed to load participant");
2256
+ } finally {
2257
+ setIsLoading(false);
2258
+ }
2259
+ }, [participantId, config.baseUrl, config.getRequestHeaders]);
2260
+ useEffect6(() => {
2261
+ void load();
2262
+ }, [load]);
2263
+ const handleSave = async () => {
2264
+ setIsSaving(true);
2265
+ setError(null);
2266
+ setSaveMessage(null);
2267
+ try {
2268
+ const parsed = JSON.parse(editJson);
2269
+ const updated = await updateParticipant(participantId, parsed, fetchOptions);
2270
+ setData(updated);
2271
+ setEditJson(JSON.stringify(updated, null, 2));
2272
+ setSaveMessage("Saved successfully");
2273
+ setTimeout(() => setSaveMessage(null), 3e3);
2274
+ } catch (err) {
2275
+ setError(err instanceof Error ? err.message : "Failed to save");
2276
+ } finally {
2277
+ setIsSaving(false);
2278
+ }
2279
+ };
2280
+ if (isLoading) {
2281
+ return /* @__PURE__ */ jsx16("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx16(Loader22, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
2282
+ }
2283
+ return /* @__PURE__ */ jsxs11("div", { className: "space-y-6", children: [
2284
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-4", children: [
2285
+ /* @__PURE__ */ jsx16(Button, { variant: "ghost", size: "icon", onClick: onBack, children: /* @__PURE__ */ jsx16(ArrowLeft2, { className: "h-4 w-4" }) }),
2286
+ /* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
2287
+ /* @__PURE__ */ jsx16("h2", { className: "text-xl font-semibold truncate", children: participantId }),
2288
+ /* @__PURE__ */ jsx16("p", { className: "text-sm text-muted-foreground", children: "Participant Detail" })
2289
+ ] }),
2290
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
2291
+ saveMessage && /* @__PURE__ */ jsx16("span", { className: "text-xs text-emerald-600", children: saveMessage }),
2292
+ /* @__PURE__ */ jsxs11(Button, { size: "sm", onClick: () => void handleSave(), disabled: isSaving, children: [
2293
+ isSaving ? /* @__PURE__ */ jsx16(Loader22, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx16(Save, { className: "mr-2 h-3 w-3" }),
2294
+ "Save"
2295
+ ] })
2296
+ ] })
2297
+ ] }),
2298
+ error && /* @__PURE__ */ jsx16("div", { className: "rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive", children: error }),
2299
+ /* @__PURE__ */ jsx16("div", { className: "rounded-lg border bg-card", children: /* @__PURE__ */ jsx16(
2300
+ "textarea",
2301
+ {
2302
+ className: "w-full min-h-[400px] p-4 font-mono text-sm bg-transparent resize-y focus:outline-none",
2303
+ value: editJson,
2304
+ onChange: (e) => setEditJson(e.target.value),
2305
+ spellCheck: false
2306
+ }
2307
+ ) })
2308
+ ] });
2309
+ };
2310
+
2311
+ // src/components/views/AgentsView.tsx
2312
+ import { Search as Search3, Bot as Bot3 } from "lucide-react";
2313
+ import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
2314
+ var AgentsView = ({
2315
+ config,
2316
+ agents,
2317
+ searchValue,
2318
+ onSearchChange,
2319
+ onAgentClick
2320
+ }) => {
2321
+ return /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
2322
+ /* @__PURE__ */ jsxs12("div", { className: "relative max-w-sm", children: [
2323
+ /* @__PURE__ */ jsx17(Search3, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
2324
+ /* @__PURE__ */ jsx17(
2325
+ Input,
2326
+ {
2327
+ className: "pl-9",
2328
+ placeholder: config.labels.agentSearchPlaceholder,
2329
+ value: searchValue,
2330
+ onChange: (e) => onSearchChange(e.target.value)
2331
+ }
2332
+ )
2333
+ ] }),
2334
+ agents.length === 0 ? /* @__PURE__ */ jsxs12("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
2335
+ /* @__PURE__ */ jsx17(Bot3, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
2336
+ /* @__PURE__ */ jsx17("p", { className: "mt-3 text-sm text-muted-foreground", children: searchValue ? config.labels.noResults : config.labels.emptyDescription })
2337
+ ] }) : /* @__PURE__ */ jsx17("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3", children: agents.map((agent) => /* @__PURE__ */ jsxs12(
2338
+ "div",
2339
+ {
2340
+ className: "rounded-lg border bg-card p-5 transition-colors hover:bg-muted/50 cursor-pointer",
2341
+ onClick: () => onAgentClick?.(agent.agentId),
2342
+ children: [
2343
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-start justify-between gap-3", children: [
2344
+ /* @__PURE__ */ jsxs12("div", { className: "min-w-0", children: [
2345
+ /* @__PURE__ */ jsx17("p", { className: "font-medium truncate", children: agent.displayName }),
2346
+ /* @__PURE__ */ jsx17("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: agent.description ?? agent.agentId })
2347
+ ] }),
2348
+ /* @__PURE__ */ jsx17(Badge, { variant: "outline", className: "shrink-0", children: agent.isConfigured ? config.labels.configured : config.labels.unconfigured })
2349
+ ] }),
2350
+ /* @__PURE__ */ jsxs12("div", { className: "mt-4 grid grid-cols-2 gap-2 text-xs text-muted-foreground", children: [
2351
+ /* @__PURE__ */ jsxs12("span", { children: [
2352
+ formatNumber4(agent.messageCount),
2353
+ " messages"
2354
+ ] }),
2355
+ /* @__PURE__ */ jsxs12("span", { children: [
2356
+ formatNumber4(agent.llmCallCount),
2357
+ " LLM calls"
2358
+ ] }),
2359
+ /* @__PURE__ */ jsxs12("span", { children: [
2360
+ formatNumber4(agent.toolCallMessageCount),
2361
+ " tool calls"
2362
+ ] }),
2363
+ /* @__PURE__ */ jsxs12("span", { children: [
2364
+ formatNumber4(agent.totalTokens),
2365
+ " tokens"
2366
+ ] })
2367
+ ] }),
2368
+ /* @__PURE__ */ jsx17("p", { className: "mt-3 text-xs text-muted-foreground", children: formatDate5(agent.lastActivityAt) })
2369
+ ]
2370
+ },
2371
+ `${agent.namespace}:${agent.agentId}`
2372
+ )) })
2373
+ ] });
2374
+ };
2375
+ function formatDate5(value) {
2376
+ if (!value) return "No activity";
2377
+ const date = new Date(value);
2378
+ if (Number.isNaN(date.getTime())) return value;
2379
+ return date.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
2380
+ }
2381
+ function formatNumber4(value) {
2382
+ return new Intl.NumberFormat().format(value);
2383
+ }
2384
+
2385
+ // src/components/views/AgentDetailView.tsx
2386
+ import { ArrowLeft as ArrowLeft3, Bot as Bot4 } from "lucide-react";
2387
+ import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
2388
+ var AgentDetailView = ({
2389
+ agentId,
2390
+ config,
2391
+ agents,
2392
+ onBack
2393
+ }) => {
2394
+ const agent = agents.find((a) => a.agentId === agentId);
2395
+ if (!agent) {
2396
+ return /* @__PURE__ */ jsxs13("div", { className: "space-y-4 py-10 text-center", children: [
2397
+ /* @__PURE__ */ jsxs13("p", { className: "text-muted-foreground", children: [
2398
+ "Agent not found: ",
2399
+ agentId
2400
+ ] }),
2401
+ /* @__PURE__ */ jsxs13(Button, { variant: "outline", onClick: onBack, children: [
2402
+ /* @__PURE__ */ jsx18(ArrowLeft3, { className: "mr-2 h-4 w-4" }),
2403
+ " Back"
2404
+ ] })
2405
+ ] });
2406
+ }
2407
+ const stats = [
2408
+ { label: "Messages", value: agent.messageCount },
2409
+ { label: "LLM Calls", value: agent.llmCallCount },
2410
+ { label: "Tool Calls", value: agent.toolCallMessageCount },
2411
+ { label: "Input Tokens", value: agent.inputTokens },
2412
+ { label: "Output Tokens", value: agent.outputTokens },
2413
+ { label: "Reasoning Tokens", value: agent.reasoningTokens },
2414
+ { label: "Cache Read", value: agent.cacheReadInputTokens },
2415
+ { label: "Cache Created", value: agent.cacheCreationInputTokens },
2416
+ { label: "Total Tokens", value: agent.totalTokens }
2417
+ ];
2418
+ return /* @__PURE__ */ jsxs13("div", { className: "space-y-6", children: [
2419
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-4", children: [
2420
+ /* @__PURE__ */ jsx18(Button, { variant: "ghost", size: "icon", className: "mt-1 shrink-0", onClick: onBack, children: /* @__PURE__ */ jsx18(ArrowLeft3, { className: "h-4 w-4" }) }),
2421
+ /* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
2422
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
2423
+ /* @__PURE__ */ jsx18("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: /* @__PURE__ */ jsx18(Bot4, { className: "h-5 w-5" }) }),
2424
+ /* @__PURE__ */ jsxs13("div", { children: [
2425
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
2426
+ /* @__PURE__ */ jsx18("h2", { className: "text-xl font-semibold", children: agent.displayName }),
2427
+ /* @__PURE__ */ jsx18(Badge, { variant: "outline", children: agent.isConfigured ? config.labels.configured : config.labels.unconfigured })
2428
+ ] }),
2429
+ agent.description && /* @__PURE__ */ jsx18("p", { className: "text-sm text-muted-foreground", children: agent.description })
2430
+ ] })
2431
+ ] }),
2432
+ /* @__PURE__ */ jsxs13("div", { className: "mt-2 flex flex-wrap gap-4 text-xs text-muted-foreground", children: [
2433
+ /* @__PURE__ */ jsxs13("span", { children: [
2434
+ "ID: ",
2435
+ agent.agentId
2436
+ ] }),
2437
+ /* @__PURE__ */ jsxs13("span", { children: [
2438
+ "Namespace: ",
2439
+ agent.namespace
2440
+ ] }),
2441
+ agent.lastActivityAt && /* @__PURE__ */ jsxs13("span", { children: [
2442
+ "Last active: ",
2443
+ formatDate6(agent.lastActivityAt)
2444
+ ] })
2445
+ ] })
2446
+ ] })
2447
+ ] }),
2448
+ /* @__PURE__ */ jsx18("div", { className: "grid gap-4 sm:grid-cols-3 lg:grid-cols-3", children: stats.map((stat) => /* @__PURE__ */ jsxs13("div", { className: "rounded-xl border bg-card p-5 shadow-sm", children: [
2449
+ /* @__PURE__ */ jsx18("p", { className: "text-sm font-medium text-muted-foreground", children: stat.label }),
2450
+ /* @__PURE__ */ jsx18("p", { className: "mt-2 text-2xl font-semibold tracking-tight", children: new Intl.NumberFormat().format(stat.value) })
2451
+ ] }, stat.label)) })
2452
+ ] });
2453
+ };
2454
+ function formatDate6(value) {
2455
+ const date = new Date(value);
2456
+ if (Number.isNaN(date.getTime())) return value;
2457
+ return date.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
2458
+ }
2459
+
2460
+ // src/components/views/CollectionItemsView.tsx
2461
+ import { useCallback as useCallback5, useEffect as useEffect7, useState as useState6 } from "react";
2462
+ import { Loader2 as Loader23, Plus, Search as Search4, Database as Database2 } from "lucide-react";
2463
+ import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
2464
+ var CollectionItemsView = ({
2465
+ collection,
2466
+ config,
2467
+ namespace,
2468
+ onItemClick,
2469
+ onCreateNew
2470
+ }) => {
2471
+ const [items, setItems] = useState6([]);
2472
+ const [isLoading, setIsLoading] = useState6(true);
2473
+ const [search, setSearch] = useState6("");
2474
+ const [error, setError] = useState6(null);
2475
+ const fetchOptions = {
2476
+ baseUrl: config.baseUrl,
2477
+ getRequestHeaders: config.getRequestHeaders
2478
+ };
2479
+ const load = useCallback5(async () => {
2480
+ setIsLoading(true);
2481
+ setError(null);
2482
+ try {
2483
+ const result = await fetchCollectionItems(
2484
+ collection,
2485
+ { search: search || void 0, namespace, limit: 50 },
2486
+ fetchOptions
2487
+ );
2488
+ setItems(result);
2489
+ } catch (err) {
2490
+ setError(err instanceof Error ? err.message : "Failed to load items");
2491
+ } finally {
2492
+ setIsLoading(false);
2493
+ }
2494
+ }, [collection, search, namespace, config.baseUrl, config.getRequestHeaders]);
2495
+ useEffect7(() => {
2496
+ void load();
2497
+ }, [load]);
2498
+ const getItemId = (item) => {
2499
+ return String(item.id ?? item._id ?? JSON.stringify(item).slice(0, 40));
2500
+ };
2501
+ const getItemPreview = (item) => {
2502
+ const { id, _id, ...rest } = item;
2503
+ const name = item.name ?? item.title ?? item.displayName ?? item.label;
2504
+ if (typeof name === "string") return name;
2505
+ const keys = Object.keys(rest);
2506
+ if (keys.length === 0) return "(empty)";
2507
+ return keys.slice(0, 3).map((k) => `${k}: ${JSON.stringify(rest[k])?.slice(0, 30)}`).join(", ");
2508
+ };
2509
+ return /* @__PURE__ */ jsxs14("div", { className: "space-y-4", children: [
2510
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between gap-4", children: [
2511
+ /* @__PURE__ */ jsx19("h2", { className: "text-lg font-semibold capitalize", children: collection }),
2512
+ onCreateNew && /* @__PURE__ */ jsxs14(Button, { size: "sm", onClick: onCreateNew, children: [
2513
+ /* @__PURE__ */ jsx19(Plus, { className: "mr-2 h-3 w-3" }),
2514
+ " New"
2515
+ ] })
2516
+ ] }),
2517
+ /* @__PURE__ */ jsxs14("div", { className: "relative max-w-sm", children: [
2518
+ /* @__PURE__ */ jsx19(Search4, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
2519
+ /* @__PURE__ */ jsx19(
2520
+ Input,
2521
+ {
2522
+ className: "pl-9",
2523
+ placeholder: `Search ${collection}...`,
2524
+ value: search,
2525
+ onChange: (e) => setSearch(e.target.value)
2526
+ }
2527
+ )
2528
+ ] }),
2529
+ error && /* @__PURE__ */ jsx19("div", { className: "rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive", children: error }),
2530
+ isLoading ? /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx19(Loader23, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }) : items.length === 0 ? /* @__PURE__ */ jsxs14("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
2531
+ /* @__PURE__ */ jsx19(Database2, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
2532
+ /* @__PURE__ */ jsx19("p", { className: "mt-3 text-sm text-muted-foreground", children: search ? config.labels.noResults : `No items in ${collection}` })
2533
+ ] }) : /* @__PURE__ */ jsx19("div", { className: "space-y-2", children: items.map((item, idx) => {
2534
+ const itemId = getItemId(item);
2535
+ return /* @__PURE__ */ jsx19(
2536
+ "div",
2537
+ {
2538
+ className: "flex items-center gap-4 rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50 cursor-pointer",
2539
+ onClick: () => onItemClick?.(itemId),
2540
+ children: /* @__PURE__ */ jsxs14("div", { className: "flex-1 min-w-0", children: [
2541
+ /* @__PURE__ */ jsx19("p", { className: "font-medium font-mono text-sm truncate", children: itemId }),
2542
+ /* @__PURE__ */ jsx19("p", { className: "mt-1 text-xs text-muted-foreground truncate", children: getItemPreview(item) })
2543
+ ] })
2544
+ },
2545
+ itemId + idx
2546
+ );
2547
+ }) })
2548
+ ] });
2549
+ };
2550
+
2551
+ // src/components/views/CollectionItemDetailView.tsx
2552
+ import { useCallback as useCallback6, useEffect as useEffect8, useState as useState7 } from "react";
2553
+ import { ArrowLeft as ArrowLeft5, Loader2 as Loader24, Save as Save2, Trash2 } from "lucide-react";
2554
+ import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
2555
+ var CollectionItemDetailView = ({
2556
+ collection,
2557
+ itemId,
2558
+ config,
2559
+ namespace,
2560
+ onBack,
2561
+ onDeleted
2562
+ }) => {
2563
+ const isNew = !itemId;
2564
+ const [editJson, setEditJson] = useState7(isNew ? "{\n \n}" : "");
2565
+ const [isLoading, setIsLoading] = useState7(!isNew);
2566
+ const [isSaving, setIsSaving] = useState7(false);
2567
+ const [isDeleting, setIsDeleting] = useState7(false);
2568
+ const [error, setError] = useState7(null);
2569
+ const [saveMessage, setSaveMessage] = useState7(null);
2570
+ const fetchOptions = {
2571
+ baseUrl: config.baseUrl,
2572
+ getRequestHeaders: config.getRequestHeaders
2573
+ };
2574
+ const load = useCallback6(async () => {
2575
+ if (!itemId) return;
2576
+ setIsLoading(true);
2577
+ setError(null);
2578
+ try {
2579
+ const result = await fetchCollectionItem(collection, itemId, namespace, fetchOptions);
2580
+ setEditJson(JSON.stringify(result, null, 2));
2581
+ } catch (err) {
2582
+ setError(err instanceof Error ? err.message : "Failed to load item");
2583
+ } finally {
2584
+ setIsLoading(false);
2585
+ }
2586
+ }, [collection, itemId, namespace, config.baseUrl, config.getRequestHeaders]);
2587
+ useEffect8(() => {
2588
+ void load();
2589
+ }, [load]);
2590
+ const handleSave = async () => {
2591
+ setIsSaving(true);
2592
+ setError(null);
2593
+ setSaveMessage(null);
2594
+ try {
2595
+ const parsed = JSON.parse(editJson);
2596
+ if (isNew) {
2597
+ const created = await createCollectionItem(collection, parsed, namespace, fetchOptions);
2598
+ setEditJson(JSON.stringify(created, null, 2));
2599
+ setSaveMessage("Created successfully");
2600
+ } else {
2601
+ const updated = await updateCollectionItem(collection, itemId, parsed, namespace, fetchOptions);
2602
+ setEditJson(JSON.stringify(updated, null, 2));
2603
+ setSaveMessage("Saved successfully");
2604
+ }
2605
+ setTimeout(() => setSaveMessage(null), 3e3);
2606
+ } catch (err) {
2607
+ setError(err instanceof Error ? err.message : "Failed to save");
2608
+ } finally {
2609
+ setIsSaving(false);
2610
+ }
2611
+ };
2612
+ const handleDelete = async () => {
2613
+ if (!itemId) return;
2614
+ if (!window.confirm(`Delete this item from ${collection}?`)) return;
2615
+ setIsDeleting(true);
2616
+ setError(null);
2617
+ try {
2618
+ await deleteCollectionItem(collection, itemId, namespace, fetchOptions);
2619
+ onDeleted?.();
2620
+ onBack();
2621
+ } catch (err) {
2622
+ setError(err instanceof Error ? err.message : "Failed to delete");
2623
+ } finally {
2624
+ setIsDeleting(false);
2625
+ }
2626
+ };
2627
+ if (isLoading) {
2628
+ return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx20(Loader24, { className: "h-6 w-6 animate-spin text-muted-foreground" }) });
2629
+ }
2630
+ return /* @__PURE__ */ jsxs15("div", { className: "space-y-6", children: [
2631
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-4", children: [
2632
+ /* @__PURE__ */ jsx20(Button, { variant: "ghost", size: "icon", onClick: onBack, children: /* @__PURE__ */ jsx20(ArrowLeft5, { className: "h-4 w-4" }) }),
2633
+ /* @__PURE__ */ jsx20("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx20("h2", { className: "text-xl font-semibold truncate capitalize", children: isNew ? `New ${collection} item` : `${collection} / ${itemId}` }) }),
2634
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
2635
+ saveMessage && /* @__PURE__ */ jsx20("span", { className: "text-xs text-emerald-600", children: saveMessage }),
2636
+ !isNew && /* @__PURE__ */ jsxs15(
2637
+ Button,
2638
+ {
2639
+ variant: "destructive",
2640
+ size: "sm",
2641
+ onClick: () => void handleDelete(),
2642
+ disabled: isDeleting,
2643
+ children: [
2644
+ isDeleting ? /* @__PURE__ */ jsx20(Loader24, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx20(Trash2, { className: "mr-2 h-3 w-3" }),
2645
+ "Delete"
2646
+ ]
2647
+ }
2648
+ ),
2649
+ /* @__PURE__ */ jsxs15(Button, { size: "sm", onClick: () => void handleSave(), disabled: isSaving, children: [
2650
+ isSaving ? /* @__PURE__ */ jsx20(Loader24, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx20(Save2, { className: "mr-2 h-3 w-3" }),
2651
+ isNew ? "Create" : "Save"
2652
+ ] })
2653
+ ] })
2654
+ ] }),
2655
+ error && /* @__PURE__ */ jsx20("div", { className: "rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive", children: error }),
2656
+ /* @__PURE__ */ jsx20("div", { className: "rounded-lg border bg-card", children: /* @__PURE__ */ jsx20(
2657
+ "textarea",
2658
+ {
2659
+ className: "w-full min-h-[400px] p-4 font-mono text-sm bg-transparent resize-y focus:outline-none",
2660
+ value: editJson,
2661
+ onChange: (e) => setEditJson(e.target.value),
2662
+ spellCheck: false
2663
+ }
2664
+ ) })
2665
+ ] });
2666
+ };
2667
+
2668
+ // src/components/views/EventsView.tsx
2669
+ import { useCallback as useCallback7, useState as useState8 } from "react";
2670
+ import { Activity as Activity2, Loader2 as Loader25, Search as Search5 } from "lucide-react";
2671
+ import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
2672
+ var STATUS_VARIANTS = {
2673
+ pending: "outline",
2674
+ processing: "default",
2675
+ completed: "secondary",
2676
+ failed: "destructive",
2677
+ expired: "secondary",
2678
+ overwritten: "secondary"
2679
+ };
2680
+ var EventsView = ({ config }) => {
2681
+ const [threadId, setThreadId] = useState8("");
2682
+ const [event, setEvent] = useState8(null);
2683
+ const [hasSearched, setHasSearched] = useState8(false);
2684
+ const [isLoading, setIsLoading] = useState8(false);
2685
+ const [error, setError] = useState8(null);
2686
+ const fetchOptions = {
2687
+ baseUrl: config.baseUrl,
2688
+ getRequestHeaders: config.getRequestHeaders
2689
+ };
2690
+ const handleSearch = useCallback7(async () => {
2691
+ if (!threadId.trim()) return;
2692
+ setIsLoading(true);
2693
+ setError(null);
2694
+ setHasSearched(true);
2695
+ try {
2696
+ const result = await fetchThreadEvents(threadId.trim(), fetchOptions);
2697
+ setEvent(result ?? null);
2698
+ } catch (err) {
2699
+ setError(err instanceof Error ? err.message : "Failed to load events");
2700
+ } finally {
2701
+ setIsLoading(false);
2702
+ }
2703
+ }, [threadId, config.baseUrl, config.getRequestHeaders]);
2704
+ return /* @__PURE__ */ jsxs16("div", { className: "space-y-6", children: [
2705
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-end gap-3 max-w-lg", children: [
2706
+ /* @__PURE__ */ jsxs16("div", { className: "flex-1", children: [
2707
+ /* @__PURE__ */ jsx21("label", { className: "text-sm font-medium mb-1 block", children: "Thread ID" }),
2708
+ /* @__PURE__ */ jsxs16("div", { className: "relative", children: [
2709
+ /* @__PURE__ */ jsx21(Search5, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
2710
+ /* @__PURE__ */ jsx21(
2711
+ Input,
2712
+ {
2713
+ className: "pl-9",
2714
+ placeholder: "Enter thread ID to inspect events...",
2715
+ value: threadId,
2716
+ onChange: (e) => setThreadId(e.target.value),
2717
+ onKeyDown: (e) => e.key === "Enter" && void handleSearch()
2718
+ }
2719
+ )
2720
+ ] })
2721
+ ] }),
2722
+ /* @__PURE__ */ jsxs16(Button, { onClick: () => void handleSearch(), disabled: isLoading || !threadId.trim(), children: [
2723
+ isLoading ? /* @__PURE__ */ jsx21(Loader25, { className: "mr-2 h-4 w-4 animate-spin" }) : null,
2724
+ "Inspect"
2725
+ ] })
2726
+ ] }),
2727
+ error && /* @__PURE__ */ jsx21("div", { className: "rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive", children: error }),
2728
+ !hasSearched ? /* @__PURE__ */ jsxs16("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
2729
+ /* @__PURE__ */ jsx21(Activity2, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
2730
+ /* @__PURE__ */ jsx21("p", { className: "mt-3 text-sm text-muted-foreground", children: "Enter a thread ID to inspect its next pending queue event." })
2731
+ ] }) : isLoading ? /* @__PURE__ */ jsx21("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx21(Loader25, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }) : !event ? /* @__PURE__ */ jsxs16("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
2732
+ /* @__PURE__ */ jsx21(Activity2, { className: "mx-auto h-8 w-8 text-muted-foreground/50" }),
2733
+ /* @__PURE__ */ jsx21("p", { className: "mt-3 text-sm text-muted-foreground", children: "No pending events found for this thread." })
2734
+ ] }) : /* @__PURE__ */ jsxs16("div", { className: "rounded-lg border bg-card p-5 space-y-4", children: [
2735
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-start justify-between gap-3", children: [
2736
+ /* @__PURE__ */ jsxs16("div", { children: [
2737
+ /* @__PURE__ */ jsx21("p", { className: "font-medium", children: event.eventType }),
2738
+ /* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground font-mono mt-1", children: event.id })
2739
+ ] }),
2740
+ /* @__PURE__ */ jsx21(Badge, { variant: STATUS_VARIANTS[event.status] ?? "outline", children: event.status })
2741
+ ] }),
2742
+ /* @__PURE__ */ jsxs16("div", { className: "grid gap-3 sm:grid-cols-2 text-sm", children: [
2743
+ event.traceId && /* @__PURE__ */ jsxs16("div", { children: [
2744
+ /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Trace:" }),
2745
+ " ",
2746
+ /* @__PURE__ */ jsx21("span", { className: "font-mono text-xs", children: event.traceId })
2747
+ ] }),
2748
+ event.parentEventId && /* @__PURE__ */ jsxs16("div", { children: [
2749
+ /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Parent:" }),
2750
+ " ",
2751
+ /* @__PURE__ */ jsx21("span", { className: "font-mono text-xs", children: event.parentEventId })
2752
+ ] }),
2753
+ event.priority != null && /* @__PURE__ */ jsxs16("div", { children: [
2754
+ /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Priority:" }),
2755
+ " ",
2756
+ event.priority
2757
+ ] }),
2758
+ event.createdAt && /* @__PURE__ */ jsxs16("div", { children: [
2759
+ /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Created:" }),
2760
+ " ",
2761
+ formatTimestamp2(event.createdAt)
2762
+ ] })
2763
+ ] }),
2764
+ event.payload != null && /* @__PURE__ */ jsxs16("div", { children: [
2765
+ /* @__PURE__ */ jsx21("p", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Payload" }),
2766
+ /* @__PURE__ */ jsx21("pre", { className: "rounded-md bg-muted p-3 text-xs overflow-auto max-h-60", children: JSON.stringify(event.payload, null, 2) })
2767
+ ] }),
2768
+ event.metadata != null && Object.keys(event.metadata).length > 0 && /* @__PURE__ */ jsxs16("div", { children: [
2769
+ /* @__PURE__ */ jsx21("p", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Metadata" }),
2770
+ /* @__PURE__ */ jsx21("pre", { className: "rounded-md bg-muted p-3 text-xs overflow-auto max-h-40", children: JSON.stringify(event.metadata, null, 2) })
2771
+ ] })
2772
+ ] })
2773
+ ] });
2774
+ };
2775
+ function formatTimestamp2(value) {
2776
+ const date = new Date(value);
2777
+ if (Number.isNaN(date.getTime())) return value;
2778
+ return date.toLocaleString(void 0, {
2779
+ month: "short",
2780
+ day: "numeric",
2781
+ hour: "numeric",
2782
+ minute: "2-digit",
2783
+ second: "2-digit"
2784
+ });
2785
+ }
2786
+
1980
2787
  // src/CopilotzAdmin.tsx
1981
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
2788
+ import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
1982
2789
  var CopilotzAdmin = ({
1983
2790
  config: userConfig,
1984
2791
  className
@@ -1987,69 +2794,101 @@ var CopilotzAdmin = ({
1987
2794
  () => mergeAdminConfig(defaultAdminConfig, userConfig),
1988
2795
  [userConfig]
1989
2796
  );
1990
- const [route, setRoute] = useState5({ page: config.defaultPage });
1991
- const [threadSearch, setThreadSearch] = useState5("");
1992
- const [participantSearch, setParticipantSearch] = useState5("");
1993
- const [agentSearch, setAgentSearch] = useState5("");
2797
+ const [route, setRoute] = useState9({ page: config.defaultPage });
2798
+ const [namespace, setNamespace] = useState9(config.namespace);
2799
+ const [collections, setCollections] = useState9([]);
2800
+ const [threadSearch, setThreadSearch] = useState9("");
2801
+ const [participantSearch, setParticipantSearch] = useState9("");
2802
+ const [agentSearch, setAgentSearch] = useState9("");
1994
2803
  const deferredThreadSearch = useDeferredValue(threadSearch);
1995
2804
  const deferredParticipantSearch = useDeferredValue(participantSearch);
1996
2805
  const deferredAgentSearch = useDeferredValue(agentSearch);
1997
2806
  const admin = useCopilotzAdmin({
1998
2807
  baseUrl: config.baseUrl,
1999
2808
  getRequestHeaders: config.getRequestHeaders,
2000
- namespace: config.namespace,
2809
+ namespace,
2001
2810
  range: config.initialRange,
2002
2811
  interval: config.initialInterval,
2003
2812
  threadSearch: deferredThreadSearch,
2004
2813
  participantSearch: deferredParticipantSearch,
2005
2814
  agentSearch: deferredAgentSearch
2006
2815
  });
2007
- const navigate = useCallback4(
2816
+ useEffect9(() => {
2817
+ if (!config.features.showCollections) return;
2818
+ fetchCollectionNames({
2819
+ baseUrl: config.baseUrl,
2820
+ getRequestHeaders: config.getRequestHeaders
2821
+ }).then(setCollections).catch(() => setCollections([]));
2822
+ }, [config.baseUrl, config.getRequestHeaders, config.features.showCollections]);
2823
+ const navigate = useCallback8(
2008
2824
  (next) => {
2009
2825
  setRoute(next);
2010
2826
  config.onNavigate?.(next);
2011
2827
  },
2012
2828
  [config]
2013
2829
  );
2014
- const handleSidebarNavigate = useCallback4(
2830
+ const handleSidebarNavigate = useCallback8(
2015
2831
  (page) => navigate({ page }),
2016
2832
  [navigate]
2017
2833
  );
2018
- const handleThreadClick = useCallback4(
2834
+ const handleSidebarRouteNavigate = useCallback8(
2835
+ (r) => navigate(r),
2836
+ [navigate]
2837
+ );
2838
+ const handleThreadClick = useCallback8(
2019
2839
  (threadId) => navigate({ page: "thread-detail", resourceId: threadId }),
2020
2840
  [navigate]
2021
2841
  );
2022
- const handleBackToThreads = useCallback4(
2023
- () => navigate({ page: "threads" }),
2842
+ const handleBackToThreads = useCallback8(() => navigate({ page: "threads" }), [navigate]);
2843
+ const handleParticipantClick = useCallback8(
2844
+ (id) => navigate({ page: "participant-detail", resourceId: id }),
2845
+ [navigate]
2846
+ );
2847
+ const handleBackToParticipants = useCallback8(() => navigate({ page: "participants" }), [navigate]);
2848
+ const handleAgentClick = useCallback8(
2849
+ (id) => navigate({ page: "agent-detail", resourceId: id }),
2024
2850
  [navigate]
2025
2851
  );
2026
- const sidebarPage = route.page === "thread-detail" ? "threads" : route.page;
2852
+ const handleBackToAgents = useCallback8(() => navigate({ page: "agents" }), [navigate]);
2853
+ const handleCollectionItemClick = useCallback8(
2854
+ (itemId) => navigate({ page: "collection-item-detail", resourceId: itemId, collection: route.collection }),
2855
+ [navigate, route.collection]
2856
+ );
2857
+ const handleCollectionCreateNew = useCallback8(
2858
+ () => navigate({ page: "collection-item-detail", resourceId: void 0, collection: route.collection }),
2859
+ [navigate, route.collection]
2860
+ );
2861
+ const handleBackToCollectionItems = useCallback8(
2862
+ () => navigate({ page: "collection-items", collection: route.collection }),
2863
+ [navigate, route.collection]
2864
+ );
2865
+ const sidebarPage = (() => {
2866
+ switch (route.page) {
2867
+ case "thread-detail":
2868
+ return "threads";
2869
+ case "participant-detail":
2870
+ return "participants";
2871
+ case "agent-detail":
2872
+ return "agents";
2873
+ case "collection-item-detail":
2874
+ return "collection-items";
2875
+ default:
2876
+ return route.page;
2877
+ }
2878
+ })();
2027
2879
  if (admin.isLoading && !admin.overview) {
2028
- return /* @__PURE__ */ jsx14(Card, { className: cn("border-border", className), children: /* @__PURE__ */ jsx14(CardContent, { className: "text-muted-foreground flex items-center justify-center min-h-[200px]", children: config.labels.loading }) });
2880
+ return /* @__PURE__ */ jsx22(Card, { className: cn("border-border", className), children: /* @__PURE__ */ jsx22(CardContent, { className: "text-muted-foreground flex items-center justify-center min-h-[200px]", children: config.labels.loading }) });
2029
2881
  }
2030
2882
  if (admin.error && !admin.overview) {
2031
- return /* @__PURE__ */ jsx14(
2032
- Card,
2033
- {
2034
- className: cn("border-destructive/50 bg-destructive/10", className),
2035
- children: /* @__PURE__ */ jsxs10(CardContent, { className: "space-y-4", children: [
2036
- /* @__PURE__ */ jsx14("p", { className: "text-base font-semibold text-destructive", children: admin.error.message }),
2037
- /* @__PURE__ */ jsx14(
2038
- Button,
2039
- {
2040
- variant: "destructive",
2041
- onClick: () => void admin.refresh(),
2042
- children: config.labels.retry
2043
- }
2044
- )
2045
- ] })
2046
- }
2047
- );
2883
+ return /* @__PURE__ */ jsx22(Card, { className: cn("border-destructive/50 bg-destructive/10", className), children: /* @__PURE__ */ jsxs17(CardContent, { className: "space-y-4", children: [
2884
+ /* @__PURE__ */ jsx22("p", { className: "text-base font-semibold text-destructive", children: admin.error.message }),
2885
+ /* @__PURE__ */ jsx22(Button, { variant: "destructive", onClick: () => void admin.refresh(), children: config.labels.retry })
2886
+ ] }) });
2048
2887
  }
2049
2888
  const renderCurrentView = () => {
2050
2889
  switch (route.page) {
2051
2890
  case "dashboard":
2052
- return /* @__PURE__ */ jsx14(
2891
+ return /* @__PURE__ */ jsx22(
2053
2892
  DashboardView,
2054
2893
  {
2055
2894
  config,
@@ -2069,7 +2908,7 @@ var CopilotzAdmin = ({
2069
2908
  }
2070
2909
  );
2071
2910
  case "threads":
2072
- return /* @__PURE__ */ jsx14(
2911
+ return /* @__PURE__ */ jsx22(
2073
2912
  ThreadsView,
2074
2913
  {
2075
2914
  config,
@@ -2080,34 +2919,62 @@ var CopilotzAdmin = ({
2080
2919
  }
2081
2920
  );
2082
2921
  case "thread-detail":
2083
- return route.resourceId ? /* @__PURE__ */ jsx14(
2084
- ThreadDetailView,
2922
+ return route.resourceId ? /* @__PURE__ */ jsx22(ThreadDetailView, { threadId: route.resourceId, config, onBack: handleBackToThreads }) : null;
2923
+ case "participants":
2924
+ return /* @__PURE__ */ jsx22(
2925
+ ParticipantsView,
2085
2926
  {
2086
- threadId: route.resourceId,
2087
2927
  config,
2088
- onBack: handleBackToThreads
2928
+ participants: admin.participants,
2929
+ searchValue: participantSearch,
2930
+ onSearchChange: setParticipantSearch,
2931
+ onParticipantClick: handleParticipantClick
2089
2932
  }
2090
- ) : null;
2091
- case "participants":
2092
- return /* @__PURE__ */ jsxs10("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
2093
- /* @__PURE__ */ jsx14("h3", { className: "text-lg font-semibold", children: config.labels.participantsTitle }),
2094
- /* @__PURE__ */ jsx14("p", { className: "mt-2 text-sm text-muted-foreground", children: "Detailed participant management coming soon." })
2095
- ] });
2933
+ );
2934
+ case "participant-detail":
2935
+ return route.resourceId ? /* @__PURE__ */ jsx22(ParticipantDetailView, { participantId: route.resourceId, config, onBack: handleBackToParticipants }) : null;
2096
2936
  case "agents":
2097
- return /* @__PURE__ */ jsxs10("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
2098
- /* @__PURE__ */ jsx14("h3", { className: "text-lg font-semibold", children: config.labels.agentsTitle }),
2099
- /* @__PURE__ */ jsx14("p", { className: "mt-2 text-sm text-muted-foreground", children: "Agent configuration management coming soon." })
2100
- ] });
2937
+ return /* @__PURE__ */ jsx22(
2938
+ AgentsView,
2939
+ {
2940
+ config,
2941
+ agents: admin.agents,
2942
+ searchValue: agentSearch,
2943
+ onSearchChange: setAgentSearch,
2944
+ onAgentClick: handleAgentClick
2945
+ }
2946
+ );
2947
+ case "agent-detail":
2948
+ return route.resourceId ? /* @__PURE__ */ jsx22(AgentDetailView, { agentId: route.resourceId, config, agents: admin.agents, onBack: handleBackToAgents }) : null;
2949
+ case "collection-items":
2950
+ return route.collection ? /* @__PURE__ */ jsx22(
2951
+ CollectionItemsView,
2952
+ {
2953
+ collection: route.collection,
2954
+ config,
2955
+ namespace,
2956
+ onItemClick: handleCollectionItemClick,
2957
+ onCreateNew: handleCollectionCreateNew
2958
+ }
2959
+ ) : null;
2960
+ case "collection-item-detail":
2961
+ return route.collection ? /* @__PURE__ */ jsx22(
2962
+ CollectionItemDetailView,
2963
+ {
2964
+ collection: route.collection,
2965
+ itemId: route.resourceId ?? null,
2966
+ config,
2967
+ namespace,
2968
+ onBack: handleBackToCollectionItems
2969
+ }
2970
+ ) : null;
2101
2971
  case "events":
2102
- return /* @__PURE__ */ jsxs10("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
2103
- /* @__PURE__ */ jsx14("h3", { className: "text-lg font-semibold", children: config.labels.eventsTitle }),
2104
- /* @__PURE__ */ jsx14("p", { className: "mt-2 text-sm text-muted-foreground", children: "Event inspector coming soon." })
2105
- ] });
2972
+ return /* @__PURE__ */ jsx22(EventsView, { config });
2106
2973
  default:
2107
2974
  return null;
2108
2975
  }
2109
2976
  };
2110
- return /* @__PURE__ */ jsx14(TooltipProvider, { children: /* @__PURE__ */ jsx14(SidebarProvider, { defaultOpen: config.sidebar.defaultOpen, children: /* @__PURE__ */ jsxs10(
2977
+ return /* @__PURE__ */ jsx22(TooltipProvider, { children: /* @__PURE__ */ jsx22(SidebarProvider, { defaultOpen: config.sidebar.defaultOpen, children: /* @__PURE__ */ jsxs17(
2111
2978
  "div",
2112
2979
  {
2113
2980
  className: cn(
@@ -2115,20 +2982,25 @@ var CopilotzAdmin = ({
2115
2982
  className
2116
2983
  ),
2117
2984
  children: [
2118
- /* @__PURE__ */ jsx14(
2985
+ /* @__PURE__ */ jsx22(
2119
2986
  AdminSidebar,
2120
2987
  {
2121
2988
  config,
2122
2989
  currentPage: sidebarPage,
2123
- onNavigate: handleSidebarNavigate
2990
+ currentRoute: route,
2991
+ onNavigate: handleSidebarNavigate,
2992
+ onNavigateRoute: handleSidebarRouteNavigate,
2993
+ collections,
2994
+ namespace,
2995
+ onNamespaceChange: setNamespace
2124
2996
  }
2125
2997
  ),
2126
- /* @__PURE__ */ jsx14(SidebarInset, { children: /* @__PURE__ */ jsxs10("div", { className: "flex flex-col h-full min-h-0", children: [
2127
- /* @__PURE__ */ jsx14(
2998
+ /* @__PURE__ */ jsx22(SidebarInset, { children: /* @__PURE__ */ jsxs17("div", { className: "flex flex-col h-full min-h-0", children: [
2999
+ /* @__PURE__ */ jsx22(
2128
3000
  AdminHeader,
2129
3001
  {
2130
3002
  config,
2131
- currentPage: route.page,
3003
+ currentRoute: route,
2132
3004
  range: admin.filters.range,
2133
3005
  interval: admin.filters.interval,
2134
3006
  onRangeChange: admin.setRange,
@@ -2137,7 +3009,7 @@ var CopilotzAdmin = ({
2137
3009
  isLoading: admin.isLoading
2138
3010
  }
2139
3011
  ),
2140
- /* @__PURE__ */ jsx14("div", { className: "flex-1 overflow-auto p-6", children: renderCurrentView() })
3012
+ /* @__PURE__ */ jsx22("div", { className: "flex-1 overflow-auto p-6", children: renderCurrentView() })
2141
3013
  ] }) })
2142
3014
  ]
2143
3015
  }
@@ -2145,13 +3017,22 @@ var CopilotzAdmin = ({
2145
3017
  };
2146
3018
  export {
2147
3019
  CopilotzAdmin,
3020
+ createCollectionItem,
2148
3021
  defaultAdminConfig,
3022
+ deleteCollectionItem,
2149
3023
  fetchAdminActivity,
2150
3024
  fetchAdminAgents,
2151
3025
  fetchAdminOverview,
2152
3026
  fetchAdminParticipants,
2153
3027
  fetchAdminThreads,
3028
+ fetchCollectionItem,
3029
+ fetchCollectionItems,
3030
+ fetchCollectionNames,
3031
+ fetchParticipantDetail,
3032
+ fetchThreadEvents,
2154
3033
  mergeAdminConfig,
3034
+ updateCollectionItem,
3035
+ updateParticipant,
2155
3036
  useCopilotzAdmin
2156
3037
  };
2157
3038
  //# sourceMappingURL=index.js.map