context-mode 1.0.80 → 1.0.81

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.
Files changed (43) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.openclaw-plugin/openclaw.plugin.json +1 -1
  4. package/.openclaw-plugin/package.json +1 -1
  5. package/build/cli.js +57 -0
  6. package/build/server.js +94 -1
  7. package/cli.bundle.mjs +106 -99
  8. package/insight/components.json +25 -0
  9. package/insight/index.html +13 -0
  10. package/insight/package.json +54 -0
  11. package/insight/server.mjs +624 -0
  12. package/insight/src/components/analytics.tsx +112 -0
  13. package/insight/src/components/ui/badge.tsx +52 -0
  14. package/insight/src/components/ui/button.tsx +58 -0
  15. package/insight/src/components/ui/card.tsx +103 -0
  16. package/insight/src/components/ui/chart.tsx +371 -0
  17. package/insight/src/components/ui/collapsible.tsx +19 -0
  18. package/insight/src/components/ui/input.tsx +20 -0
  19. package/insight/src/components/ui/progress.tsx +83 -0
  20. package/insight/src/components/ui/scroll-area.tsx +55 -0
  21. package/insight/src/components/ui/separator.tsx +23 -0
  22. package/insight/src/components/ui/table.tsx +114 -0
  23. package/insight/src/components/ui/tabs.tsx +82 -0
  24. package/insight/src/components/ui/tooltip.tsx +64 -0
  25. package/insight/src/lib/api.ts +71 -0
  26. package/insight/src/lib/utils.ts +6 -0
  27. package/insight/src/main.tsx +22 -0
  28. package/insight/src/routeTree.gen.ts +189 -0
  29. package/insight/src/router.tsx +19 -0
  30. package/insight/src/routes/__root.tsx +55 -0
  31. package/insight/src/routes/enterprise.tsx +316 -0
  32. package/insight/src/routes/index.tsx +914 -0
  33. package/insight/src/routes/knowledge.tsx +221 -0
  34. package/insight/src/routes/knowledge_.$dbHash.$sourceId.tsx +137 -0
  35. package/insight/src/routes/search.tsx +97 -0
  36. package/insight/src/routes/sessions.tsx +179 -0
  37. package/insight/src/routes/sessions_.$dbHash.$sessionId.tsx +181 -0
  38. package/insight/src/styles.css +104 -0
  39. package/insight/tsconfig.json +29 -0
  40. package/insight/vite.config.ts +19 -0
  41. package/openclaw.plugin.json +1 -1
  42. package/package.json +2 -1
  43. package/server.bundle.mjs +76 -72
@@ -0,0 +1,19 @@
1
+ import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible"
2
+
3
+ function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) {
4
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
5
+ }
6
+
7
+ function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props) {
8
+ return (
9
+ <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />
10
+ )
11
+ }
12
+
13
+ function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {
14
+ return (
15
+ <CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />
16
+ )
17
+ }
18
+
19
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent }
@@ -0,0 +1,20 @@
1
+ import * as React from "react"
2
+ import { Input as InputPrimitive } from "@base-ui/react/input"
3
+
4
+ import { cn } from "#/lib/utils"
5
+
6
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
7
+ return (
8
+ <InputPrimitive
9
+ type={type}
10
+ data-slot="input"
11
+ className={cn(
12
+ "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
13
+ className
14
+ )}
15
+ {...props}
16
+ />
17
+ )
18
+ }
19
+
20
+ export { Input }
@@ -0,0 +1,83 @@
1
+ "use client"
2
+
3
+ import { Progress as ProgressPrimitive } from "@base-ui/react/progress"
4
+
5
+ import { cn } from "#/lib/utils"
6
+
7
+ function Progress({
8
+ className,
9
+ children,
10
+ value,
11
+ ...props
12
+ }: ProgressPrimitive.Root.Props) {
13
+ return (
14
+ <ProgressPrimitive.Root
15
+ value={value}
16
+ data-slot="progress"
17
+ className={cn("flex flex-wrap gap-3", className)}
18
+ {...props}
19
+ >
20
+ {children}
21
+ <ProgressTrack>
22
+ <ProgressIndicator />
23
+ </ProgressTrack>
24
+ </ProgressPrimitive.Root>
25
+ )
26
+ }
27
+
28
+ function ProgressTrack({ className, ...props }: ProgressPrimitive.Track.Props) {
29
+ return (
30
+ <ProgressPrimitive.Track
31
+ className={cn(
32
+ "relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted",
33
+ className
34
+ )}
35
+ data-slot="progress-track"
36
+ {...props}
37
+ />
38
+ )
39
+ }
40
+
41
+ function ProgressIndicator({
42
+ className,
43
+ ...props
44
+ }: ProgressPrimitive.Indicator.Props) {
45
+ return (
46
+ <ProgressPrimitive.Indicator
47
+ data-slot="progress-indicator"
48
+ className={cn("h-full bg-primary transition-all", className)}
49
+ {...props}
50
+ />
51
+ )
52
+ }
53
+
54
+ function ProgressLabel({ className, ...props }: ProgressPrimitive.Label.Props) {
55
+ return (
56
+ <ProgressPrimitive.Label
57
+ className={cn("text-sm font-medium", className)}
58
+ data-slot="progress-label"
59
+ {...props}
60
+ />
61
+ )
62
+ }
63
+
64
+ function ProgressValue({ className, ...props }: ProgressPrimitive.Value.Props) {
65
+ return (
66
+ <ProgressPrimitive.Value
67
+ className={cn(
68
+ "ml-auto text-sm text-muted-foreground tabular-nums",
69
+ className
70
+ )}
71
+ data-slot="progress-value"
72
+ {...props}
73
+ />
74
+ )
75
+ }
76
+
77
+ export {
78
+ Progress,
79
+ ProgressTrack,
80
+ ProgressIndicator,
81
+ ProgressLabel,
82
+ ProgressValue,
83
+ }
@@ -0,0 +1,55 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
5
+
6
+ import { cn } from "#/lib/utils"
7
+
8
+ function ScrollArea({
9
+ className,
10
+ children,
11
+ ...props
12
+ }: ScrollAreaPrimitive.Root.Props) {
13
+ return (
14
+ <ScrollAreaPrimitive.Root
15
+ data-slot="scroll-area"
16
+ className={cn("relative", className)}
17
+ {...props}
18
+ >
19
+ <ScrollAreaPrimitive.Viewport
20
+ data-slot="scroll-area-viewport"
21
+ className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
22
+ >
23
+ {children}
24
+ </ScrollAreaPrimitive.Viewport>
25
+ <ScrollBar />
26
+ <ScrollAreaPrimitive.Corner />
27
+ </ScrollAreaPrimitive.Root>
28
+ )
29
+ }
30
+
31
+ function ScrollBar({
32
+ className,
33
+ orientation = "vertical",
34
+ ...props
35
+ }: ScrollAreaPrimitive.Scrollbar.Props) {
36
+ return (
37
+ <ScrollAreaPrimitive.Scrollbar
38
+ data-slot="scroll-area-scrollbar"
39
+ data-orientation={orientation}
40
+ orientation={orientation}
41
+ className={cn(
42
+ "flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",
43
+ className
44
+ )}
45
+ {...props}
46
+ >
47
+ <ScrollAreaPrimitive.Thumb
48
+ data-slot="scroll-area-thumb"
49
+ className="relative flex-1 rounded-full bg-border"
50
+ />
51
+ </ScrollAreaPrimitive.Scrollbar>
52
+ )
53
+ }
54
+
55
+ export { ScrollArea, ScrollBar }
@@ -0,0 +1,23 @@
1
+ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
2
+
3
+ import { cn } from "#/lib/utils"
4
+
5
+ function Separator({
6
+ className,
7
+ orientation = "horizontal",
8
+ ...props
9
+ }: SeparatorPrimitive.Props) {
10
+ return (
11
+ <SeparatorPrimitive
12
+ data-slot="separator"
13
+ orientation={orientation}
14
+ className={cn(
15
+ "shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
16
+ className
17
+ )}
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ export { Separator }
@@ -0,0 +1,114 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "#/lib/utils"
4
+
5
+ function Table({ className, ...props }: React.ComponentProps<"table">) {
6
+ return (
7
+ <div
8
+ data-slot="table-container"
9
+ className="relative w-full overflow-x-auto"
10
+ >
11
+ <table
12
+ data-slot="table"
13
+ className={cn("w-full caption-bottom text-sm", className)}
14
+ {...props}
15
+ />
16
+ </div>
17
+ )
18
+ }
19
+
20
+ function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
21
+ return (
22
+ <thead
23
+ data-slot="table-header"
24
+ className={cn("[&_tr]:border-b", className)}
25
+ {...props}
26
+ />
27
+ )
28
+ }
29
+
30
+ function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
31
+ return (
32
+ <tbody
33
+ data-slot="table-body"
34
+ className={cn("[&_tr:last-child]:border-0", className)}
35
+ {...props}
36
+ />
37
+ )
38
+ }
39
+
40
+ function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
41
+ return (
42
+ <tfoot
43
+ data-slot="table-footer"
44
+ className={cn(
45
+ "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
46
+ className
47
+ )}
48
+ {...props}
49
+ />
50
+ )
51
+ }
52
+
53
+ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
54
+ return (
55
+ <tr
56
+ data-slot="table-row"
57
+ className={cn(
58
+ "border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
59
+ className
60
+ )}
61
+ {...props}
62
+ />
63
+ )
64
+ }
65
+
66
+ function TableHead({ className, ...props }: React.ComponentProps<"th">) {
67
+ return (
68
+ <th
69
+ data-slot="table-head"
70
+ className={cn(
71
+ "h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",
72
+ className
73
+ )}
74
+ {...props}
75
+ />
76
+ )
77
+ }
78
+
79
+ function TableCell({ className, ...props }: React.ComponentProps<"td">) {
80
+ return (
81
+ <td
82
+ data-slot="table-cell"
83
+ className={cn(
84
+ "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
85
+ className
86
+ )}
87
+ {...props}
88
+ />
89
+ )
90
+ }
91
+
92
+ function TableCaption({
93
+ className,
94
+ ...props
95
+ }: React.ComponentProps<"caption">) {
96
+ return (
97
+ <caption
98
+ data-slot="table-caption"
99
+ className={cn("mt-4 text-sm text-muted-foreground", className)}
100
+ {...props}
101
+ />
102
+ )
103
+ }
104
+
105
+ export {
106
+ Table,
107
+ TableHeader,
108
+ TableBody,
109
+ TableFooter,
110
+ TableHead,
111
+ TableRow,
112
+ TableCell,
113
+ TableCaption,
114
+ }
@@ -0,0 +1,82 @@
1
+ "use client"
2
+
3
+ import { Tabs as TabsPrimitive } from "@base-ui/react/tabs"
4
+ import { cva, type VariantProps } from "class-variance-authority"
5
+
6
+ import { cn } from "#/lib/utils"
7
+
8
+ function Tabs({
9
+ className,
10
+ orientation = "horizontal",
11
+ ...props
12
+ }: TabsPrimitive.Root.Props) {
13
+ return (
14
+ <TabsPrimitive.Root
15
+ data-slot="tabs"
16
+ data-orientation={orientation}
17
+ className={cn(
18
+ "group/tabs flex gap-2 data-horizontal:flex-col",
19
+ className
20
+ )}
21
+ {...props}
22
+ />
23
+ )
24
+ }
25
+
26
+ const tabsListVariants = cva(
27
+ "group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
28
+ {
29
+ variants: {
30
+ variant: {
31
+ default: "bg-muted",
32
+ line: "gap-1 bg-transparent",
33
+ },
34
+ },
35
+ defaultVariants: {
36
+ variant: "default",
37
+ },
38
+ }
39
+ )
40
+
41
+ function TabsList({
42
+ className,
43
+ variant = "default",
44
+ ...props
45
+ }: TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants>) {
46
+ return (
47
+ <TabsPrimitive.List
48
+ data-slot="tabs-list"
49
+ data-variant={variant}
50
+ className={cn(tabsListVariants({ variant }), className)}
51
+ {...props}
52
+ />
53
+ )
54
+ }
55
+
56
+ function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
57
+ return (
58
+ <TabsPrimitive.Tab
59
+ data-slot="tabs-trigger"
60
+ className={cn(
61
+ "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
62
+ "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
63
+ "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
64
+ "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
65
+ className
66
+ )}
67
+ {...props}
68
+ />
69
+ )
70
+ }
71
+
72
+ function TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {
73
+ return (
74
+ <TabsPrimitive.Panel
75
+ data-slot="tabs-content"
76
+ className={cn("flex-1 text-sm outline-none", className)}
77
+ {...props}
78
+ />
79
+ )
80
+ }
81
+
82
+ export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
@@ -0,0 +1,64 @@
1
+ import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip"
2
+
3
+ import { cn } from "#/lib/utils"
4
+
5
+ function TooltipProvider({
6
+ delay = 0,
7
+ ...props
8
+ }: TooltipPrimitive.Provider.Props) {
9
+ return (
10
+ <TooltipPrimitive.Provider
11
+ data-slot="tooltip-provider"
12
+ delay={delay}
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {
19
+ return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
20
+ }
21
+
22
+ function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {
23
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
24
+ }
25
+
26
+ function TooltipContent({
27
+ className,
28
+ side = "top",
29
+ sideOffset = 4,
30
+ align = "center",
31
+ alignOffset = 0,
32
+ children,
33
+ ...props
34
+ }: TooltipPrimitive.Popup.Props &
35
+ Pick<
36
+ TooltipPrimitive.Positioner.Props,
37
+ "align" | "alignOffset" | "side" | "sideOffset"
38
+ >) {
39
+ return (
40
+ <TooltipPrimitive.Portal>
41
+ <TooltipPrimitive.Positioner
42
+ align={align}
43
+ alignOffset={alignOffset}
44
+ side={side}
45
+ sideOffset={sideOffset}
46
+ className="isolate z-50"
47
+ >
48
+ <TooltipPrimitive.Popup
49
+ data-slot="tooltip-content"
50
+ className={cn(
51
+ "z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
52
+ className
53
+ )}
54
+ {...props}
55
+ >
56
+ {children}
57
+ <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" />
58
+ </TooltipPrimitive.Popup>
59
+ </TooltipPrimitive.Positioner>
60
+ </TooltipPrimitive.Portal>
61
+ )
62
+ }
63
+
64
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
@@ -0,0 +1,71 @@
1
+ const API = "/api";
2
+
3
+ export interface OverviewData {
4
+ content: { databases: number; sources: number; chunks: number; totalSize: string; totalSizeBytes: number };
5
+ sessions: { databases: number; sessions: number; events: number; totalSize: string; totalSizeBytes: number };
6
+ }
7
+
8
+ export interface Source { id: number; label: string; chunks: number; codeChunks: number; indexedAt: string; }
9
+ export interface ContentDB { hash: string; size: string; sizeBytes: number; sourceCount: number; chunkCount: number; sources: Source[]; }
10
+ export interface Chunk { title: string; content: string; content_type: string; label: string; highlighted?: string; dbHash?: string; rank?: number; }
11
+ export interface SessionMeta { id: string; projectDir: string; startedAt: string; lastEventAt: string; eventCount: number; compactCount: number; }
12
+ export interface SessionDB { hash: string; size: string; sizeBytes: number; sessions: SessionMeta[]; }
13
+ export interface SessionEvent { id: number; type: string; category: string; priority: number; data: string; source_hook: string; created_at: string; }
14
+ export interface SessionEventData { events: SessionEvent[]; resume: { snapshot: string; event_count: number; consumed: number } | null; }
15
+
16
+ export interface AnalyticsData {
17
+ totals: {
18
+ totalSessions: number; totalEvents: number; avgSessionMin: number;
19
+ totalErrors: number; avgErrorRate: number; totalCompacts: number;
20
+ uniqueFiles: number; uniqueProjects: number;
21
+ totalCommits: number; commitsPerSession: number; sandboxRate: number;
22
+ totalRules: number; totalEditTestCycles: number;
23
+ };
24
+ sessionsByDate: { date: string; count: number; events: number; compacts: number }[];
25
+ sessionDurations: { session_id: string; project_dir: string; started_at: string; duration_min: number; event_count: number; compact_count: number }[];
26
+ intents: { intent: string; count: number }[];
27
+ eventTypes: { type: string; count: number }[];
28
+ errorRates: { session_id: string; started_at: string; errors: number; total: number; error_rate: number }[];
29
+ fileActivity: { file: string; count: number }[];
30
+ toolUsage: { tool: string; count: number }[];
31
+ gitActivity: { action: string; created_at: string }[];
32
+ skillUsage: { skill: string; count: number }[];
33
+ subagents: {
34
+ total: number; bursts: number; maxConcurrent: number;
35
+ parallelCount: number; sequentialCount: number; timeSavedMin: number;
36
+ burstDetails: { size: number; time: string }[];
37
+ };
38
+ workModes: { mode: string; count: number }[];
39
+ timeToFirstCommit: { session_id: string; started_at: string; first_commit_at: string; minutes_to_commit: number }[];
40
+ exploreExecRatio: { explore: number; execute: number; total: number };
41
+ reworkData: { session_id: string; file: string; edit_count: number }[];
42
+ gitActivity: { action: string; created_at: string; session_id: string; project_dir: string; session_start: string }[];
43
+ projectActivity: { project_dir: string; sessions: number; events: number }[];
44
+ hourlyPattern: { hour: number; count: number }[];
45
+ weeklyTrend: { week: string; sessions: number; events: number }[];
46
+ tasks: { task: string; created_at: string }[];
47
+ prompts: { prompt: string; created_at: string }[];
48
+ masteryTrend: { week: string; errors: number; total: number; error_rate: number }[];
49
+ commitRate: { session_id: string; project_dir: string; commits: number }[];
50
+ sandboxAdoption: { sandbox_calls: number; total_calls: number };
51
+ rulesFreshness: { rule_path: string; last_seen: string; load_count: number }[];
52
+ editTestCycles: { session_id: string; cycles: number }[];
53
+ }
54
+
55
+ async function get<T>(path: string): Promise<T> {
56
+ const r = await fetch(`${API}${path}`);
57
+ return r.json() as Promise<T>;
58
+ }
59
+
60
+ export const api = {
61
+ overview: () => get<OverviewData>("/overview"),
62
+ analytics: () => get<AnalyticsData>("/analytics"),
63
+ content: () => get<ContentDB[]>("/content"),
64
+ chunks: (dbHash: string, sourceId: number) => get<Chunk[]>(`/content/${dbHash}/chunks/${sourceId}`),
65
+ search: (q: string) => get<Chunk[]>(`/search?q=${encodeURIComponent(q)}`),
66
+ sessions: () => get<SessionDB[]>("/sessions"),
67
+ events: (dbHash: string, sessionId: string) =>
68
+ get<SessionEventData>(`/sessions/${dbHash}/events/${encodeURIComponent(sessionId)}`),
69
+ deleteSource: (dbHash: string, sourceId: number) =>
70
+ fetch(`${API}/content/${dbHash}/source/${sourceId}`, { method: "DELETE" }).then(r => r.json() as Promise<{ ok: boolean }>),
71
+ };
@@ -0,0 +1,6 @@
1
+ import { clsx, type ClassValue } from "clsx"
2
+ import { twMerge } from "tailwind-merge"
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs))
6
+ }
@@ -0,0 +1,22 @@
1
+ import ReactDOM from 'react-dom/client'
2
+ import { RouterProvider, createRouter } from '@tanstack/react-router'
3
+ import { routeTree } from './routeTree.gen'
4
+
5
+ const router = createRouter({
6
+ routeTree,
7
+ defaultPreload: 'intent',
8
+ scrollRestoration: true,
9
+ })
10
+
11
+ declare module '@tanstack/react-router' {
12
+ interface Register {
13
+ router: typeof router
14
+ }
15
+ }
16
+
17
+ const rootElement = document.getElementById('app')!
18
+
19
+ if (!rootElement.innerHTML) {
20
+ const root = ReactDOM.createRoot(rootElement)
21
+ root.render(<RouterProvider router={router} />)
22
+ }