@copilotz/admin 0.3.4 → 0.3.6

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
@@ -300,8 +300,212 @@ function useCopilotzAdmin(options = {}) {
300
300
  ]);
301
301
  }
302
302
 
303
+ // src/lib/utils.ts
304
+ import { clsx } from "clsx";
305
+ import { twMerge } from "tailwind-merge";
306
+ function cn(...inputs) {
307
+ return twMerge(clsx(inputs));
308
+ }
309
+
310
+ // src/components/ui/card.tsx
311
+ import { jsx } from "react/jsx-runtime";
312
+ function Card({ className, ...props }) {
313
+ return /* @__PURE__ */ jsx(
314
+ "div",
315
+ {
316
+ "data-slot": "card",
317
+ className: cn(
318
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
319
+ className
320
+ ),
321
+ ...props
322
+ }
323
+ );
324
+ }
325
+ function CardContent({ className, ...props }) {
326
+ return /* @__PURE__ */ jsx(
327
+ "div",
328
+ {
329
+ "data-slot": "card-content",
330
+ className: cn("px-6", className),
331
+ ...props
332
+ }
333
+ );
334
+ }
335
+
336
+ // src/components/ui/button.tsx
337
+ import { Slot } from "@radix-ui/react-slot";
338
+ import { cva } from "class-variance-authority";
339
+ import { jsx as jsx2 } from "react/jsx-runtime";
340
+ var buttonVariants = cva(
341
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-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",
342
+ {
343
+ variants: {
344
+ variant: {
345
+ default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
346
+ destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
347
+ outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
348
+ secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
349
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
350
+ link: "text-primary underline-offset-4 hover:underline"
351
+ },
352
+ size: {
353
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
354
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
355
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
356
+ icon: "size-9"
357
+ }
358
+ },
359
+ defaultVariants: {
360
+ variant: "default",
361
+ size: "default"
362
+ }
363
+ }
364
+ );
365
+ function Button({
366
+ className,
367
+ variant,
368
+ size,
369
+ asChild = false,
370
+ ...props
371
+ }) {
372
+ const Comp = asChild ? Slot : "button";
373
+ return /* @__PURE__ */ jsx2(
374
+ Comp,
375
+ {
376
+ "data-slot": "button",
377
+ className: cn(buttonVariants({ variant, size, className })),
378
+ ...props
379
+ }
380
+ );
381
+ }
382
+
383
+ // src/components/ui/input.tsx
384
+ import { jsx as jsx3 } from "react/jsx-runtime";
385
+ function Input({ className, type, ...props }) {
386
+ return /* @__PURE__ */ jsx3(
387
+ "input",
388
+ {
389
+ type,
390
+ "data-slot": "input",
391
+ className: cn(
392
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
393
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
394
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
395
+ className
396
+ ),
397
+ ...props
398
+ }
399
+ );
400
+ }
401
+
402
+ // src/components/ui/badge.tsx
403
+ import { Slot as Slot2 } from "@radix-ui/react-slot";
404
+ import { cva as cva2 } from "class-variance-authority";
405
+ import { jsx as jsx4 } from "react/jsx-runtime";
406
+ var badgeVariants = cva2(
407
+ "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",
408
+ {
409
+ variants: {
410
+ variant: {
411
+ default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
412
+ secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
413
+ destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
414
+ outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
415
+ }
416
+ },
417
+ defaultVariants: {
418
+ variant: "default"
419
+ }
420
+ }
421
+ );
422
+ function Badge({
423
+ className,
424
+ variant,
425
+ asChild = false,
426
+ ...props
427
+ }) {
428
+ const Comp = asChild ? Slot2 : "span";
429
+ return /* @__PURE__ */ jsx4(
430
+ Comp,
431
+ {
432
+ "data-slot": "badge",
433
+ className: cn(badgeVariants({ variant }), className),
434
+ ...props
435
+ }
436
+ );
437
+ }
438
+
439
+ // src/components/ui/select.tsx
440
+ import * as React from "react";
441
+ import * as SelectPrimitive from "@radix-ui/react-select";
442
+ import { Check, ChevronDown, ChevronUp } from "lucide-react";
443
+ import { jsx as jsx5, jsxs } from "react/jsx-runtime";
444
+ var Select = SelectPrimitive.Root;
445
+ var SelectValue = SelectPrimitive.Value;
446
+ var SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
447
+ SelectPrimitive.Trigger,
448
+ {
449
+ ref,
450
+ className: cn(
451
+ "flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none transition-colors placeholder:text-muted-foreground focus:ring-2 focus:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50",
452
+ className
453
+ ),
454
+ ...props,
455
+ children: [
456
+ children,
457
+ /* @__PURE__ */ jsx5(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx5(ChevronDown, { className: "h-4 w-4 opacity-50" }) })
458
+ ]
459
+ }
460
+ ));
461
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
462
+ var SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx5(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
463
+ SelectPrimitive.Content,
464
+ {
465
+ ref,
466
+ className: cn(
467
+ "relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
468
+ position === "popper" && "translate-y-1",
469
+ className
470
+ ),
471
+ position,
472
+ ...props,
473
+ children: [
474
+ /* @__PURE__ */ jsx5(SelectPrimitive.ScrollUpButton, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ jsx5(ChevronUp, { className: "h-4 w-4" }) }),
475
+ /* @__PURE__ */ jsx5(
476
+ SelectPrimitive.Viewport,
477
+ {
478
+ className: cn(
479
+ "p-1",
480
+ position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
481
+ ),
482
+ children
483
+ }
484
+ ),
485
+ /* @__PURE__ */ jsx5(SelectPrimitive.ScrollDownButton, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ jsx5(ChevronDown, { className: "h-4 w-4" }) })
486
+ ]
487
+ }
488
+ ) }));
489
+ SelectContent.displayName = SelectPrimitive.Content.displayName;
490
+ var SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
491
+ SelectPrimitive.Item,
492
+ {
493
+ ref,
494
+ className: cn(
495
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
496
+ className
497
+ ),
498
+ ...props,
499
+ children: [
500
+ /* @__PURE__ */ jsx5(SelectPrimitive.ItemText, { children }),
501
+ /* @__PURE__ */ jsx5(SelectPrimitive.ItemIndicator, { className: "absolute right-2 inline-flex items-center justify-center", children: /* @__PURE__ */ jsx5(Check, { className: "h-4 w-4" }) })
502
+ ]
503
+ }
504
+ ));
505
+ SelectItem.displayName = SelectPrimitive.Item.displayName;
506
+
303
507
  // src/CopilotzAdmin.tsx
304
- import { jsx, jsxs } from "react/jsx-runtime";
508
+ import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
305
509
  var CopilotzAdmin = ({
306
510
  config: userConfig,
307
511
  className
@@ -354,112 +558,115 @@ var CopilotzAdmin = ({
354
558
  }
355
559
  ];
356
560
  if (admin.isLoading && !admin.overview) {
357
- return /* @__PURE__ */ jsx("div", { className: joinClassNames("rounded-3xl border border-slate-200 bg-white p-8 text-slate-700 shadow-sm", className), children: config.labels.loading });
561
+ return /* @__PURE__ */ jsx6(Card, { className: cn("border-border", className), children: /* @__PURE__ */ jsx6(CardContent, { className: "text-muted-foreground", children: config.labels.loading }) });
358
562
  }
359
563
  if (admin.error && !admin.overview) {
360
- return /* @__PURE__ */ jsxs("div", { className: joinClassNames("rounded-3xl border border-rose-200 bg-rose-50 p-8 text-rose-700 shadow-sm", className), children: [
361
- /* @__PURE__ */ jsx("p", { className: "text-base font-semibold", children: admin.error.message }),
362
- /* @__PURE__ */ jsx(
363
- "button",
564
+ return /* @__PURE__ */ jsx6(Card, { className: cn("border-destructive/50 bg-destructive/10", className), children: /* @__PURE__ */ jsxs2(CardContent, { className: "space-y-4", children: [
565
+ /* @__PURE__ */ jsx6("p", { className: "text-base font-semibold text-destructive", children: admin.error.message }),
566
+ /* @__PURE__ */ jsx6(
567
+ Button,
364
568
  {
365
- className: "mt-4 rounded-xl bg-rose-600 px-4 py-2 text-sm font-medium text-white",
569
+ variant: "destructive",
366
570
  onClick: () => void admin.refresh(),
367
- type: "button",
368
571
  children: config.labels.retry
369
572
  }
370
573
  )
371
- ] });
574
+ ] }) });
372
575
  }
373
576
  const isEmpty = cards.every((card) => card.value === 0) && admin.activity.length === 0 && admin.threads.length === 0 && admin.participants.length === 0 && admin.agents.length === 0;
374
- return /* @__PURE__ */ jsxs("div", { className: joinClassNames("space-y-6 rounded-[28px] border border-slate-200 bg-[linear-gradient(180deg,#ffffff_0%,#f8fafc_100%)] p-6 text-slate-900 shadow-sm", className), children: [
375
- /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between", children: [
376
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
377
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
378
- config.branding.logo ? /* @__PURE__ */ jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-2xl border border-slate-200 bg-white shadow-sm", children: config.branding.logo }) : null,
379
- /* @__PURE__ */ jsxs("div", { children: [
380
- /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold tracking-tight", children: config.branding.title }),
381
- /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500", children: config.branding.subtitle })
577
+ return /* @__PURE__ */ jsx6(Card, { className: cn("gap-0 overflow-hidden py-0", className), children: /* @__PURE__ */ jsxs2(CardContent, { className: "space-y-6 p-6", children: [
578
+ /* @__PURE__ */ jsxs2("header", { className: "flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between", children: [
579
+ /* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
580
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
581
+ config.branding.logo ? /* @__PURE__ */ jsx6("div", { className: "flex h-10 w-10 items-center justify-center rounded-xl border bg-background shadow-sm", children: config.branding.logo }) : null,
582
+ /* @__PURE__ */ jsxs2("div", { children: [
583
+ /* @__PURE__ */ jsx6("h2", { className: "text-2xl font-semibold tracking-tight", children: config.branding.title }),
584
+ /* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: config.branding.subtitle })
382
585
  ] })
383
586
  ] }),
384
- config.namespace ? /* @__PURE__ */ jsxs("p", { className: "text-xs font-medium uppercase tracking-[0.18em] text-slate-400", children: [
587
+ config.namespace ? /* @__PURE__ */ jsxs2("p", { className: "text-xs font-medium uppercase tracking-[0.18em] text-muted-foreground", children: [
385
588
  "Namespace: ",
386
589
  config.namespace
387
590
  ] }) : null
388
591
  ] }),
389
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
390
- /* @__PURE__ */ jsx(
391
- RangeButton,
592
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center gap-2", children: [
593
+ /* @__PURE__ */ jsx6(
594
+ Button,
392
595
  {
393
- active: admin.filters.range === "24h",
394
- label: config.labels.range24h,
395
- onClick: () => admin.setRange("24h")
596
+ variant: admin.filters.range === "24h" ? "default" : "outline",
597
+ size: "sm",
598
+ onClick: () => admin.setRange("24h"),
599
+ children: config.labels.range24h
396
600
  }
397
601
  ),
398
- /* @__PURE__ */ jsx(
399
- RangeButton,
602
+ /* @__PURE__ */ jsx6(
603
+ Button,
400
604
  {
401
- active: admin.filters.range === "7d",
402
- label: config.labels.range7d,
403
- onClick: () => admin.setRange("7d")
605
+ variant: admin.filters.range === "7d" ? "default" : "outline",
606
+ size: "sm",
607
+ onClick: () => admin.setRange("7d"),
608
+ children: config.labels.range7d
404
609
  }
405
610
  ),
406
- /* @__PURE__ */ jsx(
407
- RangeButton,
611
+ /* @__PURE__ */ jsx6(
612
+ Button,
408
613
  {
409
- active: admin.filters.range === "30d",
410
- label: config.labels.range30d,
411
- onClick: () => admin.setRange("30d")
614
+ variant: admin.filters.range === "30d" ? "default" : "outline",
615
+ size: "sm",
616
+ onClick: () => admin.setRange("30d"),
617
+ children: config.labels.range30d
412
618
  }
413
619
  ),
414
- /* @__PURE__ */ jsxs(
415
- "select",
620
+ /* @__PURE__ */ jsxs2(
621
+ Select,
416
622
  {
417
- className: "rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm",
418
- onChange: (event) => admin.setInterval(event.target.value),
419
623
  value: admin.filters.interval,
624
+ onValueChange: (v) => admin.setInterval(v),
420
625
  children: [
421
- /* @__PURE__ */ jsx("option", { value: "hour", children: config.labels.intervalHour }),
422
- /* @__PURE__ */ jsx("option", { value: "day", children: config.labels.intervalDay })
626
+ /* @__PURE__ */ jsx6(SelectTrigger, { className: "h-8 w-[110px]", children: /* @__PURE__ */ jsx6(SelectValue, {}) }),
627
+ /* @__PURE__ */ jsxs2(SelectContent, { children: [
628
+ /* @__PURE__ */ jsx6(SelectItem, { value: "hour", children: config.labels.intervalHour }),
629
+ /* @__PURE__ */ jsx6(SelectItem, { value: "day", children: config.labels.intervalDay })
630
+ ] })
423
631
  ]
424
632
  }
425
633
  ),
426
- /* @__PURE__ */ jsx(
427
- "button",
634
+ /* @__PURE__ */ jsx6(
635
+ Button,
428
636
  {
429
- className: "rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm font-medium text-slate-700",
637
+ variant: "outline",
638
+ size: "sm",
430
639
  onClick: () => void admin.refresh(),
431
- type: "button",
432
640
  children: config.labels.refresh
433
641
  }
434
642
  ),
435
643
  config.branding.actions
436
644
  ] })
437
645
  ] }),
438
- isEmpty ? /* @__PURE__ */ jsxs("section", { className: "rounded-3xl border border-dashed border-slate-300 bg-white/70 p-10 text-center", children: [
439
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold", children: config.labels.emptyTitle }),
440
- /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-slate-500", children: config.labels.emptyDescription })
646
+ isEmpty ? /* @__PURE__ */ jsxs2("div", { className: "rounded-xl border border-dashed p-10 text-center", children: [
647
+ /* @__PURE__ */ jsx6("h3", { className: "text-lg font-semibold", children: config.labels.emptyTitle }),
648
+ /* @__PURE__ */ jsx6("p", { className: "mt-2 text-sm text-muted-foreground", children: config.labels.emptyDescription })
441
649
  ] }) : null,
442
- config.features.showOverview ? /* @__PURE__ */ jsxs("section", { className: "space-y-4", children: [
443
- /* @__PURE__ */ jsx(SectionHeading, { title: config.labels.overviewTitle }),
444
- /* @__PURE__ */ jsx("div", { className: "grid gap-4 md:grid-cols-2 xl:grid-cols-5", children: cards.map((card) => /* @__PURE__ */ jsxs(
650
+ config.features.showOverview ? /* @__PURE__ */ jsxs2("section", { className: "space-y-4", children: [
651
+ /* @__PURE__ */ jsx6(SectionHeading, { title: config.labels.overviewTitle }),
652
+ /* @__PURE__ */ jsx6("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-5", children: cards.map((card) => /* @__PURE__ */ jsxs2(
445
653
  "div",
446
654
  {
447
- className: "rounded-3xl border border-slate-200 bg-white p-5 shadow-sm",
655
+ className: "rounded-xl border bg-background p-5 shadow-sm",
448
656
  children: [
449
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-slate-500", children: card.label }),
450
- /* @__PURE__ */ jsx("p", { className: "mt-3 text-3xl font-semibold tracking-tight", children: formatNumber(card.value) }),
451
- /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-slate-400", children: card.detail })
657
+ /* @__PURE__ */ jsx6("p", { className: "text-sm font-medium text-muted-foreground", children: card.label }),
658
+ /* @__PURE__ */ jsx6("p", { className: "mt-3 text-3xl font-semibold tracking-tight", children: formatNumber(card.value) }),
659
+ /* @__PURE__ */ jsx6("p", { className: "mt-2 text-xs text-muted-foreground", children: card.detail })
452
660
  ]
453
661
  },
454
662
  card.label
455
663
  )) })
456
664
  ] }) : null,
457
- config.features.showActivity ? /* @__PURE__ */ jsxs("section", { className: "space-y-4", children: [
458
- /* @__PURE__ */ jsx(SectionHeading, { title: config.labels.activityTitle }),
459
- /* @__PURE__ */ jsx(
665
+ config.features.showActivity ? /* @__PURE__ */ jsxs2("section", { className: "space-y-4", children: [
666
+ /* @__PURE__ */ jsx6(SectionHeading, { title: config.labels.activityTitle }),
667
+ /* @__PURE__ */ jsx6(
460
668
  ActivityChart,
461
669
  {
462
- compact: config.ui.compact,
463
670
  interval: admin.filters.interval,
464
671
  labels: config.labels,
465
672
  maxBars: config.ui.maxActivityBars,
@@ -467,8 +674,8 @@ var CopilotzAdmin = ({
467
674
  }
468
675
  )
469
676
  ] }) : null,
470
- /* @__PURE__ */ jsxs("div", { className: "grid gap-6 xl:grid-cols-3", children: [
471
- config.features.showThreads ? /* @__PURE__ */ jsx(
677
+ /* @__PURE__ */ jsxs2("div", { className: "grid gap-6 lg:grid-cols-3", children: [
678
+ config.features.showThreads ? /* @__PURE__ */ jsx6(
472
679
  DataTable,
473
680
  {
474
681
  rows: admin.threads,
@@ -476,10 +683,10 @@ var CopilotzAdmin = ({
476
683
  searchValue: threadSearch,
477
684
  setSearchValue: setThreadSearch,
478
685
  title: config.labels.threadsTitle,
479
- children: /* @__PURE__ */ jsx(ThreadsTable, { rows: admin.threads, labels: config.labels })
686
+ children: /* @__PURE__ */ jsx6(ThreadsTable, { rows: admin.threads, labels: config.labels })
480
687
  }
481
688
  ) : null,
482
- config.features.showParticipants ? /* @__PURE__ */ jsx(
689
+ config.features.showParticipants ? /* @__PURE__ */ jsx6(
483
690
  DataTable,
484
691
  {
485
692
  rows: admin.participants,
@@ -487,10 +694,16 @@ var CopilotzAdmin = ({
487
694
  searchValue: participantSearch,
488
695
  setSearchValue: setParticipantSearch,
489
696
  title: config.labels.participantsTitle,
490
- children: /* @__PURE__ */ jsx(ParticipantsTable, { rows: admin.participants, labels: config.labels })
697
+ children: /* @__PURE__ */ jsx6(
698
+ ParticipantsTable,
699
+ {
700
+ rows: admin.participants,
701
+ labels: config.labels
702
+ }
703
+ )
491
704
  }
492
705
  ) : null,
493
- config.features.showAgents ? /* @__PURE__ */ jsx(
706
+ config.features.showAgents ? /* @__PURE__ */ jsx6(
494
707
  DataTable,
495
708
  {
496
709
  rows: admin.agents,
@@ -498,145 +711,184 @@ var CopilotzAdmin = ({
498
711
  searchValue: agentSearch,
499
712
  setSearchValue: setAgentSearch,
500
713
  title: config.labels.agentsTitle,
501
- children: /* @__PURE__ */ jsx(AgentsTable, { rows: admin.agents, labels: config.labels })
714
+ children: /* @__PURE__ */ jsx6(AgentsTable, { rows: admin.agents, labels: config.labels })
502
715
  }
503
716
  ) : null
504
717
  ] })
505
- ] });
718
+ ] }) });
506
719
  };
507
720
  function SectionHeading({ title }) {
508
- return /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold tracking-tight", children: title });
509
- }
510
- function RangeButton({ active, label, onClick }) {
511
- return /* @__PURE__ */ jsx(
512
- "button",
513
- {
514
- className: joinClassNames(
515
- "rounded-xl px-3 py-2 text-sm font-medium transition",
516
- active ? "bg-slate-900 text-white" : "border border-slate-200 bg-white text-slate-600"
517
- ),
518
- onClick,
519
- type: "button",
520
- children: label
521
- }
522
- );
721
+ return /* @__PURE__ */ jsx6("h3", { className: "text-lg font-semibold tracking-tight", children: title });
523
722
  }
524
723
  function ActivityChart(props) {
525
724
  const trimmedPoints = props.points.slice(-props.maxBars);
526
- const maxMessages = Math.max(...trimmedPoints.map((point) => point.messageCount), 1);
527
- return /* @__PURE__ */ jsx("div", { className: "rounded-3xl border border-slate-200 bg-white p-5 shadow-sm", children: trimmedPoints.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500", children: props.labels.noResults }) : /* @__PURE__ */ jsx("div", { className: "flex min-h-56 items-end gap-2", children: trimmedPoints.map((point) => /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col items-center gap-2", children: [
528
- /* @__PURE__ */ jsx("div", { className: "flex h-40 w-full items-end rounded-2xl bg-slate-100/80 px-1 pb-1", children: /* @__PURE__ */ jsx(
529
- "div",
530
- {
531
- className: "w-full rounded-xl bg-slate-900",
532
- style: {
533
- height: `${Math.max(point.messageCount / maxMessages * 100, 8)}%`
534
- }
535
- }
536
- ) }),
537
- /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
538
- /* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-slate-700", children: formatBucket(point.bucket, props.interval) }),
539
- /* @__PURE__ */ jsxs("p", { className: "text-[11px] text-slate-400", children: [
540
- formatNumber(point.messageCount),
541
- " msg"
542
- ] })
543
- ] })
544
- ] }, point.bucket)) }) });
725
+ const maxMessages = Math.max(
726
+ ...trimmedPoints.map((point) => point.messageCount),
727
+ 1
728
+ );
729
+ return /* @__PURE__ */ jsx6("div", { className: "rounded-xl border bg-background p-5 shadow-sm", children: trimmedPoints.length === 0 ? /* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: props.labels.noResults }) : /* @__PURE__ */ jsx6("div", { className: "flex min-h-48 items-end gap-2", children: trimmedPoints.map((point) => /* @__PURE__ */ jsxs2(
730
+ "div",
731
+ {
732
+ className: "flex min-w-0 flex-1 flex-col items-center gap-2",
733
+ children: [
734
+ /* @__PURE__ */ jsx6("div", { className: "flex h-36 w-full items-end rounded-lg bg-muted px-1 pb-1", children: /* @__PURE__ */ jsx6(
735
+ "div",
736
+ {
737
+ className: "w-full rounded-md bg-primary transition-all",
738
+ style: {
739
+ height: `${Math.max(point.messageCount / maxMessages * 100, 8)}%`
740
+ }
741
+ }
742
+ ) }),
743
+ /* @__PURE__ */ jsxs2("div", { className: "text-center", children: [
744
+ /* @__PURE__ */ jsx6("p", { className: "text-xs font-medium", children: formatBucket(point.bucket, props.interval) }),
745
+ /* @__PURE__ */ jsxs2("p", { className: "text-[11px] text-muted-foreground", children: [
746
+ formatNumber(point.messageCount),
747
+ " msg"
748
+ ] })
749
+ ] })
750
+ ]
751
+ },
752
+ point.bucket
753
+ )) }) });
545
754
  }
546
755
  function DataTable(props) {
547
- return /* @__PURE__ */ jsxs("section", { className: "rounded-3xl border border-slate-200 bg-white p-5 shadow-sm", children: [
548
- /* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-center justify-between gap-3", children: [
549
- /* @__PURE__ */ jsx(SectionHeading, { title: props.title }),
550
- /* @__PURE__ */ jsx(
551
- "input",
756
+ return /* @__PURE__ */ jsxs2("div", { className: "rounded-xl border bg-background p-5 shadow-sm", children: [
757
+ /* @__PURE__ */ jsxs2("div", { className: "mb-4 flex items-center justify-between gap-3", children: [
758
+ /* @__PURE__ */ jsx6(SectionHeading, { title: props.title }),
759
+ /* @__PURE__ */ jsx6(
760
+ Input,
552
761
  {
553
- className: "w-full max-w-44 rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm outline-none ring-0",
762
+ className: "h-8 w-full max-w-44",
554
763
  onChange: (event) => props.setSearchValue(event.target.value),
555
764
  placeholder: props.searchPlaceholder,
556
765
  value: props.searchValue
557
766
  }
558
767
  )
559
768
  ] }),
560
- props.rows.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500", children: "No results" }) : props.children
769
+ props.rows.length === 0 ? /* @__PURE__ */ jsx6("p", { className: "text-sm text-muted-foreground", children: "No results" }) : props.children
561
770
  ] });
562
771
  }
563
- function ThreadsTable({ rows, labels }) {
564
- return /* @__PURE__ */ jsx("div", { className: "space-y-3", children: rows.map((thread) => /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-slate-200 bg-slate-50/70 p-4", children: [
565
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
566
- /* @__PURE__ */ jsxs("div", { children: [
567
- /* @__PURE__ */ jsx("p", { className: "font-medium text-slate-900", children: thread.name }),
568
- /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-slate-500", children: thread.summary ?? thread.lastMessagePreview ?? "No summary yet" })
569
- ] }),
570
- /* @__PURE__ */ jsx("span", { className: "rounded-full bg-slate-900 px-2.5 py-1 text-[11px] font-semibold text-white", children: thread.status === "archived" ? labels.statusArchived : labels.statusActive })
571
- ] }),
572
- /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap gap-3 text-xs text-slate-500", children: [
573
- /* @__PURE__ */ jsxs("span", { children: [
574
- formatNumber(thread.messageCount),
575
- " messages"
576
- ] }),
577
- /* @__PURE__ */ jsxs("span", { children: [
578
- thread.participantIds.length,
579
- " participants"
580
- ] }),
581
- /* @__PURE__ */ jsx("span", { children: formatDate(thread.lastActivityAt) })
582
- ] })
583
- ] }, thread.threadId)) });
772
+ function ThreadsTable({
773
+ rows,
774
+ labels
775
+ }) {
776
+ return /* @__PURE__ */ jsx6("div", { className: "space-y-3", children: rows.map((thread) => /* @__PURE__ */ jsxs2(
777
+ "div",
778
+ {
779
+ className: "rounded-lg border bg-muted/50 p-4",
780
+ children: [
781
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-start justify-between gap-3", children: [
782
+ /* @__PURE__ */ jsxs2("div", { className: "min-w-0", children: [
783
+ /* @__PURE__ */ jsx6("p", { className: "font-medium", children: thread.name }),
784
+ /* @__PURE__ */ jsx6("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: thread.summary ?? thread.lastMessagePreview ?? "No summary yet" })
785
+ ] }),
786
+ /* @__PURE__ */ jsx6(
787
+ Badge,
788
+ {
789
+ variant: thread.status === "archived" ? "secondary" : "default",
790
+ children: thread.status === "archived" ? labels.statusArchived : labels.statusActive
791
+ }
792
+ )
793
+ ] }),
794
+ /* @__PURE__ */ jsxs2("div", { className: "mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground", children: [
795
+ /* @__PURE__ */ jsxs2("span", { children: [
796
+ formatNumber(thread.messageCount),
797
+ " messages"
798
+ ] }),
799
+ /* @__PURE__ */ jsxs2("span", { children: [
800
+ thread.participantIds.length,
801
+ " participants"
802
+ ] }),
803
+ /* @__PURE__ */ jsx6("span", { children: formatDate(thread.lastActivityAt) })
804
+ ] })
805
+ ]
806
+ },
807
+ thread.threadId
808
+ )) });
584
809
  }
585
- function ParticipantsTable({ rows, labels }) {
586
- return /* @__PURE__ */ jsx("div", { className: "space-y-3", children: rows.map((participant) => /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-slate-200 bg-slate-50/70 p-4", children: [
587
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
588
- /* @__PURE__ */ jsxs("div", { children: [
589
- /* @__PURE__ */ jsx("p", { className: "font-medium text-slate-900", children: participant.displayName }),
590
- /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs uppercase tracking-[0.18em] text-slate-400", children: participant.participantType })
591
- ] }),
592
- /* @__PURE__ */ jsx("span", { className: "rounded-full border border-slate-200 bg-white px-2.5 py-1 text-[11px] font-semibold text-slate-600", children: participant.isGlobal ? labels.scopeGlobal : labels.scopeScoped })
593
- ] }),
594
- /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap gap-3 text-xs text-slate-500", children: [
595
- /* @__PURE__ */ jsxs("span", { children: [
596
- formatNumber(participant.messageCount),
597
- " messages"
598
- ] }),
599
- /* @__PURE__ */ jsxs("span", { children: [
600
- formatNumber(participant.threadCount),
601
- " threads"
602
- ] }),
603
- /* @__PURE__ */ jsx("span", { children: formatDate(participant.lastActivityAt) })
604
- ] })
605
- ] }, `${participant.namespace}:${participant.externalId}`)) });
810
+ function ParticipantsTable({
811
+ rows,
812
+ labels
813
+ }) {
814
+ return /* @__PURE__ */ jsx6("div", { className: "space-y-3", children: rows.map((participant) => /* @__PURE__ */ jsxs2(
815
+ "div",
816
+ {
817
+ className: "rounded-lg border bg-muted/50 p-4",
818
+ children: [
819
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-start justify-between gap-3", children: [
820
+ /* @__PURE__ */ jsxs2("div", { className: "min-w-0", children: [
821
+ /* @__PURE__ */ jsx6("p", { className: "font-medium", children: participant.displayName }),
822
+ /* @__PURE__ */ jsx6("p", { className: "mt-1 text-xs uppercase tracking-[0.18em] text-muted-foreground", children: participant.participantType })
823
+ ] }),
824
+ /* @__PURE__ */ jsx6(Badge, { variant: "outline", children: participant.isGlobal ? labels.scopeGlobal : labels.scopeScoped })
825
+ ] }),
826
+ /* @__PURE__ */ jsxs2("div", { className: "mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground", children: [
827
+ /* @__PURE__ */ jsxs2("span", { children: [
828
+ formatNumber(participant.messageCount),
829
+ " messages"
830
+ ] }),
831
+ /* @__PURE__ */ jsxs2("span", { children: [
832
+ formatNumber(participant.threadCount),
833
+ " threads"
834
+ ] }),
835
+ /* @__PURE__ */ jsx6("span", { children: formatDate(participant.lastActivityAt) })
836
+ ] })
837
+ ]
838
+ },
839
+ `${participant.namespace}:${participant.externalId}`
840
+ )) });
606
841
  }
607
- function AgentsTable({ rows, labels }) {
608
- return /* @__PURE__ */ jsx("div", { className: "space-y-3", children: rows.map((agent) => /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-slate-200 bg-slate-50/70 p-4", children: [
609
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
610
- /* @__PURE__ */ jsxs("div", { children: [
611
- /* @__PURE__ */ jsx("p", { className: "font-medium text-slate-900", children: agent.displayName }),
612
- /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-slate-500", children: agent.description ?? agent.agentId })
613
- ] }),
614
- /* @__PURE__ */ jsx("span", { className: "rounded-full border border-slate-200 bg-white px-2.5 py-1 text-[11px] font-semibold text-slate-600", children: agent.isConfigured ? labels.configured : labels.unconfigured })
615
- ] }),
616
- /* @__PURE__ */ jsxs("div", { className: "mt-3 grid grid-cols-2 gap-2 text-xs text-slate-500", children: [
617
- /* @__PURE__ */ jsxs("span", { children: [
618
- formatNumber(agent.messageCount),
619
- " messages"
620
- ] }),
621
- /* @__PURE__ */ jsxs("span", { children: [
622
- formatNumber(agent.llmCallCount),
623
- " LLM calls"
624
- ] }),
625
- /* @__PURE__ */ jsxs("span", { children: [
626
- formatNumber(agent.toolCallMessageCount),
627
- " tool calls"
628
- ] }),
629
- /* @__PURE__ */ jsxs("span", { children: [
630
- formatNumber(agent.totalTokens),
631
- " tokens"
632
- ] })
633
- ] })
634
- ] }, `${agent.namespace}:${agent.agentId}`)) });
842
+ function AgentsTable({
843
+ rows,
844
+ labels
845
+ }) {
846
+ return /* @__PURE__ */ jsx6("div", { className: "space-y-3", children: rows.map((agent) => /* @__PURE__ */ jsxs2(
847
+ "div",
848
+ {
849
+ className: "rounded-lg border bg-muted/50 p-4",
850
+ children: [
851
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-start justify-between gap-3", children: [
852
+ /* @__PURE__ */ jsxs2("div", { className: "min-w-0", children: [
853
+ /* @__PURE__ */ jsx6("p", { className: "font-medium", children: agent.displayName }),
854
+ /* @__PURE__ */ jsx6("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: agent.description ?? agent.agentId })
855
+ ] }),
856
+ /* @__PURE__ */ jsx6(Badge, { variant: "outline", children: agent.isConfigured ? labels.configured : labels.unconfigured })
857
+ ] }),
858
+ /* @__PURE__ */ jsxs2("div", { className: "mt-3 grid grid-cols-2 gap-2 text-xs text-muted-foreground", children: [
859
+ /* @__PURE__ */ jsxs2("span", { children: [
860
+ formatNumber(agent.messageCount),
861
+ " messages"
862
+ ] }),
863
+ /* @__PURE__ */ jsxs2("span", { children: [
864
+ formatNumber(agent.llmCallCount),
865
+ " LLM calls"
866
+ ] }),
867
+ /* @__PURE__ */ jsxs2("span", { children: [
868
+ formatNumber(agent.toolCallMessageCount),
869
+ " tool calls"
870
+ ] }),
871
+ /* @__PURE__ */ jsxs2("span", { children: [
872
+ formatNumber(agent.totalTokens),
873
+ " tokens"
874
+ ] })
875
+ ] })
876
+ ]
877
+ },
878
+ `${agent.namespace}:${agent.agentId}`
879
+ )) });
635
880
  }
636
881
  function formatBucket(bucket, interval) {
637
882
  const date = new Date(bucket);
638
883
  if (Number.isNaN(date.getTime())) return bucket;
639
- return interval === "hour" ? date.toLocaleString(void 0, { hour: "numeric", month: "short", day: "numeric" }) : date.toLocaleDateString(void 0, { month: "short", day: "numeric" });
884
+ return interval === "hour" ? date.toLocaleString(void 0, {
885
+ hour: "numeric",
886
+ month: "short",
887
+ day: "numeric"
888
+ }) : date.toLocaleDateString(void 0, {
889
+ month: "short",
890
+ day: "numeric"
891
+ });
640
892
  }
641
893
  function formatDate(value) {
642
894
  if (!value) return "No activity";
@@ -652,9 +904,6 @@ function formatDate(value) {
652
904
  function formatNumber(value) {
653
905
  return new Intl.NumberFormat().format(value);
654
906
  }
655
- function joinClassNames(...values) {
656
- return values.filter(Boolean).join(" ");
657
- }
658
907
  export {
659
908
  CopilotzAdmin,
660
909
  defaultAdminConfig,