@supaku/agentfactory-dashboard 0.5.0 → 0.6.2
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/README.md +248 -0
- package/package.json +35 -4
- package/src/components/fleet/agent-card.tsx +45 -15
- package/src/components/fleet/fleet-overview.tsx +82 -45
- package/src/components/fleet/stat-card.tsx +31 -12
- package/src/components/fleet/status-dot.tsx +6 -3
- package/src/components/layout/bottom-bar.tsx +9 -12
- package/src/components/layout/shell.tsx +15 -7
- package/src/components/layout/sidebar.tsx +39 -23
- package/src/components/layout/top-bar.tsx +23 -15
- package/src/components/pipeline/pipeline-card.tsx +24 -6
- package/src/components/pipeline/pipeline-column.tsx +16 -12
- package/src/components/pipeline/pipeline-view.tsx +45 -35
- package/src/components/sessions/session-detail.tsx +75 -54
- package/src/components/sessions/session-list.tsx +39 -23
- package/src/components/sessions/session-timeline.tsx +49 -27
- package/src/components/sessions/token-chart.tsx +14 -14
- package/src/components/settings/settings-view.tsx +61 -52
- package/src/components/shared/empty-state.tsx +11 -6
- package/src/components/ui/badge.tsx +5 -5
- package/src/components/ui/button.tsx +7 -7
- package/src/components/ui/card.tsx +13 -6
- package/src/components/ui/skeleton.tsx +4 -1
- package/src/lib/status-config.ts +18 -4
- package/src/lib/work-type-config.ts +59 -2
- package/src/pages/dashboard-page.tsx +6 -2
- package/src/pages/pipeline-page.tsx +6 -2
- package/src/styles/globals.css +191 -11
- package/tailwind.config.ts +63 -12
package/README.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# @supaku/agentfactory-dashboard
|
|
2
|
+
|
|
3
|
+
A self-contained React component library for AgentFactory fleet management. Provides a complete dashboard UI with real-time data fetching, a dark design system with orange accent, and four page-level components.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @supaku/agentfactory-dashboard
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @supaku/agentfactory-dashboard
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Peer Dependencies
|
|
14
|
+
|
|
15
|
+
- `next` >= 14.0.0
|
|
16
|
+
- `react` >= 18.0.0
|
|
17
|
+
- `react-dom` >= 18.0.0
|
|
18
|
+
- `tailwindcss` >= 3.4.0
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
The package distributes TypeScript source — no build step. Add it to `transpilePackages` in your Next.js config:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// next.config.ts
|
|
26
|
+
const nextConfig: NextConfig = {
|
|
27
|
+
transpilePackages: ['@supaku/agentfactory-dashboard'],
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Tailwind v3
|
|
32
|
+
|
|
33
|
+
Import the globals CSS and use the tailwind preset:
|
|
34
|
+
|
|
35
|
+
```css
|
|
36
|
+
/* globals.css */
|
|
37
|
+
@import '@supaku/agentfactory-dashboard/styles';
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
// tailwind.config.ts
|
|
42
|
+
import dashboardPreset from '@supaku/agentfactory-dashboard/tailwind-preset'
|
|
43
|
+
|
|
44
|
+
export default {
|
|
45
|
+
presets: [dashboardPreset],
|
|
46
|
+
content: [
|
|
47
|
+
'./src/**/*.{ts,tsx}',
|
|
48
|
+
'./node_modules/@supaku/agentfactory-dashboard/src/**/*.{ts,tsx}',
|
|
49
|
+
],
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Tailwind v4
|
|
54
|
+
|
|
55
|
+
Skip the preset and globals import. Instead, register the design tokens directly in your `globals.css`:
|
|
56
|
+
|
|
57
|
+
```css
|
|
58
|
+
@source "../../node_modules/@supaku/agentfactory-dashboard/src";
|
|
59
|
+
|
|
60
|
+
@theme {
|
|
61
|
+
/* Dashboard colors */
|
|
62
|
+
--color-af-bg-primary: #0A0E1A;
|
|
63
|
+
--color-af-bg-secondary: #111827;
|
|
64
|
+
--color-af-surface: #1A1F2E;
|
|
65
|
+
--color-af-surface-border: #2A3040;
|
|
66
|
+
--color-af-accent: #FF6B35;
|
|
67
|
+
--color-af-status-success: #22C55E;
|
|
68
|
+
--color-af-status-warning: #F59E0B;
|
|
69
|
+
--color-af-status-error: #EF4444;
|
|
70
|
+
--color-af-text-primary: #F9FAFB;
|
|
71
|
+
--color-af-text-secondary: #9CA3AF;
|
|
72
|
+
--color-af-code: #A5B4FC;
|
|
73
|
+
|
|
74
|
+
/* Dashboard animations */
|
|
75
|
+
--animate-pulse-dot: pulse-dot 2s ease-in-out infinite;
|
|
76
|
+
--animate-heartbeat: heartbeat 2s ease-out infinite;
|
|
77
|
+
|
|
78
|
+
@keyframes pulse-dot {
|
|
79
|
+
0%, 100% { opacity: 1; }
|
|
80
|
+
50% { opacity: 0.4; }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@keyframes heartbeat {
|
|
84
|
+
0% { transform: scale(1); opacity: 0.6; }
|
|
85
|
+
50% { transform: scale(1.8); opacity: 0; }
|
|
86
|
+
100% { transform: scale(1); opacity: 0; }
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
And set the `:root` CSS variables to the dashboard palette:
|
|
92
|
+
|
|
93
|
+
```css
|
|
94
|
+
:root {
|
|
95
|
+
--background: 222 47% 7%;
|
|
96
|
+
--foreground: 210 40% 98%;
|
|
97
|
+
--primary: 19 100% 60%; /* orange accent */
|
|
98
|
+
--card: 222 30% 14%;
|
|
99
|
+
--muted: 222 20% 22%;
|
|
100
|
+
--border: 222 20% 22%;
|
|
101
|
+
--ring: 19 100% 60%;
|
|
102
|
+
/* ... see full palette in source */
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Pages
|
|
107
|
+
|
|
108
|
+
Four page components handle complete views with data fetching:
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import {
|
|
112
|
+
DashboardShell,
|
|
113
|
+
DashboardPage,
|
|
114
|
+
PipelinePage,
|
|
115
|
+
SessionPage,
|
|
116
|
+
SettingsPage,
|
|
117
|
+
} from '@supaku/agentfactory-dashboard'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
| Component | Route | Description |
|
|
121
|
+
|-----------|-------|-------------|
|
|
122
|
+
| `DashboardPage` | `/` | Fleet overview with stat cards and agent session grid |
|
|
123
|
+
| `PipelinePage` | `/pipeline` | Kanban board with queued/working/completed columns |
|
|
124
|
+
| `SessionPage` | `/sessions` | Session list table with status filtering |
|
|
125
|
+
| `SessionPage` | `/sessions/[id]` | Session detail view (pass `sessionId` prop) |
|
|
126
|
+
| `SettingsPage` | `/settings` | Integration status and worker list |
|
|
127
|
+
|
|
128
|
+
### Usage with Next.js App Router
|
|
129
|
+
|
|
130
|
+
Wrap each page in `DashboardShell` for the sidebar layout:
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
// app/page.tsx
|
|
134
|
+
'use client'
|
|
135
|
+
|
|
136
|
+
import { DashboardShell, DashboardPage as FleetPage } from '@supaku/agentfactory-dashboard'
|
|
137
|
+
import { usePathname } from 'next/navigation'
|
|
138
|
+
|
|
139
|
+
export default function Home() {
|
|
140
|
+
const pathname = usePathname()
|
|
141
|
+
return (
|
|
142
|
+
<DashboardShell currentPath={pathname}>
|
|
143
|
+
<FleetPage />
|
|
144
|
+
</DashboardShell>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
// app/sessions/[id]/page.tsx
|
|
151
|
+
'use client'
|
|
152
|
+
|
|
153
|
+
import { DashboardShell, SessionPage } from '@supaku/agentfactory-dashboard'
|
|
154
|
+
import { usePathname, useParams } from 'next/navigation'
|
|
155
|
+
|
|
156
|
+
export default function SessionDetail() {
|
|
157
|
+
const pathname = usePathname()
|
|
158
|
+
const params = useParams<{ id: string }>()
|
|
159
|
+
return (
|
|
160
|
+
<DashboardShell currentPath={pathname}>
|
|
161
|
+
<SessionPage sessionId={params.id} />
|
|
162
|
+
</DashboardShell>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Layout Components
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
import { DashboardShell, Sidebar, TopBar, BottomBar } from '@supaku/agentfactory-dashboard'
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
- **DashboardShell** — Full layout with sidebar, top bar, bottom bar, and mobile hamburger menu
|
|
174
|
+
- **Sidebar** — Navigation sidebar with customizable `navItems` and active state via `currentPath`
|
|
175
|
+
- **TopBar** — System status bar showing worker count, queue depth, uptime
|
|
176
|
+
- **BottomBar** — Footer bar with version and connection status
|
|
177
|
+
|
|
178
|
+
## Fleet Components
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
import { FleetOverview, AgentCard, StatCard, StatusDot, ProviderIcon } from '@supaku/agentfactory-dashboard'
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Pipeline Components
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
import { PipelineView, PipelineColumn, PipelineCard } from '@supaku/agentfactory-dashboard'
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Session Components
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
import { SessionList, SessionDetail, SessionTimeline, TokenChart } from '@supaku/agentfactory-dashboard'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Data Hooks
|
|
197
|
+
|
|
198
|
+
SWR-based hooks that fetch from AgentFactory API routes with automatic 5-second refresh:
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
import { useStats, useSessions, useWorkers } from '@supaku/agentfactory-dashboard'
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
| Hook | Endpoint | Returns |
|
|
205
|
+
|------|----------|---------|
|
|
206
|
+
| `useStats()` | `/api/public/stats` | `{ workersOnline, agentsWorking, queueDepth, completedToday, ... }` |
|
|
207
|
+
| `useSessions()` | `/api/public/sessions` | `{ sessions: PublicSessionResponse[], count }` |
|
|
208
|
+
| `useWorkers()` | `/api/workers` | `{ workers: WorkerResponse[] }` |
|
|
209
|
+
|
|
210
|
+
## Utilities
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
import { cn, formatDuration, formatCost, formatTokens, formatRelativeTime } from '@supaku/agentfactory-dashboard'
|
|
214
|
+
import { getWorkTypeConfig, getStatusConfig } from '@supaku/agentfactory-dashboard'
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## UI Primitives
|
|
218
|
+
|
|
219
|
+
Re-exports of Radix-based primitives styled for the dashboard:
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
import {
|
|
223
|
+
Button, Card, Badge, Skeleton, Separator,
|
|
224
|
+
ScrollArea, Tabs, Tooltip, Sheet, DropdownMenu,
|
|
225
|
+
} from '@supaku/agentfactory-dashboard'
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Design System
|
|
229
|
+
|
|
230
|
+
Dark-only theme with orange accent (`#FF6B35`). All custom colors use the `af-` prefix:
|
|
231
|
+
|
|
232
|
+
| Token | Value | Usage |
|
|
233
|
+
|-------|-------|-------|
|
|
234
|
+
| `af-bg-primary` | `#0A0E1A` | Page background |
|
|
235
|
+
| `af-bg-secondary` | `#111827` | Sidebar, panels |
|
|
236
|
+
| `af-surface` | `#1A1F2E` | Cards, active states |
|
|
237
|
+
| `af-surface-border` | `#2A3040` | Borders, dividers |
|
|
238
|
+
| `af-accent` | `#FF6B35` | Primary actions, highlights |
|
|
239
|
+
| `af-status-success` | `#22C55E` | Online, completed |
|
|
240
|
+
| `af-status-warning` | `#F59E0B` | Queued, warnings |
|
|
241
|
+
| `af-status-error` | `#EF4444` | Failed, errors |
|
|
242
|
+
| `af-text-primary` | `#F9FAFB` | Headings, labels |
|
|
243
|
+
| `af-text-secondary` | `#9CA3AF` | Descriptions, metadata |
|
|
244
|
+
| `af-code` | `#A5B4FC` | Code, identifiers |
|
|
245
|
+
|
|
246
|
+
## License
|
|
247
|
+
|
|
248
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supaku/agentfactory-dashboard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.2",
|
|
4
|
+
"description": "Premium dashboard UI components for AgentFactory",
|
|
5
|
+
"author": "Supaku (https://supaku.com)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22.0.0"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/supaku/agentfactory",
|
|
13
|
+
"directory": "packages/dashboard"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/supaku/agentfactory/tree/main/packages/dashboard",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/supaku/agentfactory/issues"
|
|
18
|
+
},
|
|
4
19
|
"publishConfig": {
|
|
5
20
|
"access": "public"
|
|
6
21
|
},
|
|
7
|
-
"
|
|
8
|
-
|
|
22
|
+
"keywords": [
|
|
23
|
+
"dashboard",
|
|
24
|
+
"agentfactory",
|
|
25
|
+
"fleet-management",
|
|
26
|
+
"react",
|
|
27
|
+
"ui-components",
|
|
28
|
+
"tailwindcss"
|
|
29
|
+
],
|
|
9
30
|
"type": "module",
|
|
10
31
|
"exports": {
|
|
11
32
|
".": "./src/index.ts",
|
|
@@ -15,7 +36,9 @@
|
|
|
15
36
|
"files": [
|
|
16
37
|
"src",
|
|
17
38
|
"tailwind.config.ts",
|
|
18
|
-
"components.json"
|
|
39
|
+
"components.json",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE"
|
|
19
42
|
],
|
|
20
43
|
"dependencies": {
|
|
21
44
|
"@radix-ui/react-dialog": "^1.1.0",
|
|
@@ -38,10 +61,18 @@
|
|
|
38
61
|
"tailwindcss": ">=3.4.0"
|
|
39
62
|
},
|
|
40
63
|
"devDependencies": {
|
|
64
|
+
"@types/node": "^22",
|
|
41
65
|
"@types/react": "^19",
|
|
66
|
+
"autoprefixer": "^10",
|
|
67
|
+
"next": "^15.3.0",
|
|
68
|
+
"postcss": "^8",
|
|
69
|
+
"react": "^19.0.0",
|
|
70
|
+
"react-dom": "^19.0.0",
|
|
71
|
+
"tailwindcss": "^3.4.0",
|
|
42
72
|
"typescript": "^5"
|
|
43
73
|
},
|
|
44
74
|
"scripts": {
|
|
75
|
+
"dev": "cd dev && next dev",
|
|
45
76
|
"typecheck": "tsc --noEmit"
|
|
46
77
|
}
|
|
47
78
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { cn } from '../../lib/utils'
|
|
4
|
-
import { Card } from '../../components/ui/card'
|
|
5
4
|
import { Badge } from '../../components/ui/badge'
|
|
6
5
|
import { StatusDot } from './status-dot'
|
|
7
6
|
import { ProviderIcon } from './provider-icon'
|
|
@@ -9,54 +8,85 @@ import { formatDuration, formatCost } from '../../lib/format'
|
|
|
9
8
|
import { getWorkTypeConfig } from '../../lib/work-type-config'
|
|
10
9
|
import { getStatusConfig } from '../../lib/status-config'
|
|
11
10
|
import type { PublicSessionResponse } from '../../types/api'
|
|
11
|
+
import { Clock, Coins } from 'lucide-react'
|
|
12
12
|
|
|
13
13
|
interface AgentCardProps {
|
|
14
14
|
session: PublicSessionResponse
|
|
15
15
|
className?: string
|
|
16
|
+
onSelect?: (sessionId: string) => void
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export function AgentCard({ session, className }: AgentCardProps) {
|
|
19
|
+
export function AgentCard({ session, className, onSelect }: AgentCardProps) {
|
|
19
20
|
const statusConfig = getStatusConfig(session.status)
|
|
20
21
|
const workTypeConfig = getWorkTypeConfig(session.workType)
|
|
21
22
|
|
|
22
23
|
return (
|
|
23
|
-
<
|
|
24
|
+
<div
|
|
24
25
|
className={cn(
|
|
25
|
-
'relative
|
|
26
|
+
'group relative rounded-xl border border-af-surface-border/50 bg-af-surface/40 p-4 transition-all duration-300 hover-glow',
|
|
27
|
+
session.status === 'working' && 'border-af-status-success/10',
|
|
28
|
+
session.status === 'failed' && 'border-af-status-error/10',
|
|
29
|
+
onSelect && 'cursor-pointer',
|
|
26
30
|
className
|
|
27
31
|
)}
|
|
32
|
+
{...(onSelect && {
|
|
33
|
+
role: 'button',
|
|
34
|
+
tabIndex: 0,
|
|
35
|
+
onClick: () => onSelect(session.id),
|
|
36
|
+
onKeyDown: (e: React.KeyboardEvent) => {
|
|
37
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
38
|
+
e.preventDefault()
|
|
39
|
+
onSelect(session.id)
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
})}
|
|
28
43
|
>
|
|
29
|
-
|
|
30
|
-
|
|
44
|
+
{/* Top row: identifier + provider */}
|
|
45
|
+
<div className="flex items-start justify-between gap-2">
|
|
46
|
+
<div className="flex items-center gap-2 min-w-0">
|
|
31
47
|
<StatusDot status={session.status} showHeartbeat={session.status === 'working'} />
|
|
32
|
-
<span className="text-sm font-medium text-af-text-primary
|
|
48
|
+
<span className="text-sm font-mono font-medium text-af-text-primary truncate">
|
|
33
49
|
{session.identifier}
|
|
34
50
|
</span>
|
|
35
51
|
</div>
|
|
36
|
-
<ProviderIcon size={14} />
|
|
52
|
+
<ProviderIcon size={14} className="shrink-0 opacity-40 group-hover:opacity-70 transition-opacity" />
|
|
37
53
|
</div>
|
|
38
54
|
|
|
39
|
-
|
|
55
|
+
{/* Badges */}
|
|
56
|
+
<div className="mt-3 flex items-center gap-1.5">
|
|
40
57
|
<Badge
|
|
41
58
|
variant="outline"
|
|
42
|
-
className={cn(
|
|
59
|
+
className={cn(
|
|
60
|
+
'text-2xs border',
|
|
61
|
+
workTypeConfig.bgColor, workTypeConfig.color, workTypeConfig.borderColor
|
|
62
|
+
)}
|
|
43
63
|
>
|
|
44
64
|
{workTypeConfig.label}
|
|
45
65
|
</Badge>
|
|
46
66
|
<Badge
|
|
47
67
|
variant="outline"
|
|
48
|
-
className={cn(
|
|
68
|
+
className={cn(
|
|
69
|
+
'text-2xs border',
|
|
70
|
+
statusConfig.bgColor, statusConfig.textColor, statusConfig.borderColor
|
|
71
|
+
)}
|
|
49
72
|
>
|
|
50
73
|
{statusConfig.label}
|
|
51
74
|
</Badge>
|
|
52
75
|
</div>
|
|
53
76
|
|
|
54
|
-
|
|
55
|
-
|
|
77
|
+
{/* Footer metrics */}
|
|
78
|
+
<div className="mt-3.5 flex items-center justify-between text-2xs font-body text-af-text-tertiary">
|
|
79
|
+
<span className="flex items-center gap-1 tabular-nums">
|
|
80
|
+
<Clock className="h-3 w-3" />
|
|
81
|
+
{formatDuration(session.duration)}
|
|
82
|
+
</span>
|
|
56
83
|
{session.costUsd != null && (
|
|
57
|
-
<span className="tabular-nums font-mono">
|
|
84
|
+
<span className="flex items-center gap-1 tabular-nums font-mono text-af-text-secondary">
|
|
85
|
+
<Coins className="h-3 w-3" />
|
|
86
|
+
{formatCost(session.costUsd)}
|
|
87
|
+
</span>
|
|
58
88
|
)}
|
|
59
89
|
</div>
|
|
60
|
-
</
|
|
90
|
+
</div>
|
|
61
91
|
)
|
|
62
92
|
}
|
|
@@ -12,63 +12,94 @@ import { Users, Cpu, ListTodo, CheckCircle2, Gauge, DollarSign } from 'lucide-re
|
|
|
12
12
|
|
|
13
13
|
interface FleetOverviewProps {
|
|
14
14
|
className?: string
|
|
15
|
+
onSessionSelect?: (sessionId: string) => void
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
export function FleetOverview({ className }: FleetOverviewProps) {
|
|
18
|
+
export function FleetOverview({ className, onSessionSelect }: FleetOverviewProps) {
|
|
18
19
|
const { data: stats, isLoading: statsLoading } = useStats()
|
|
19
20
|
const { data: sessionsData, isLoading: sessionsLoading } = useSessions()
|
|
20
21
|
|
|
21
22
|
const sessions = sessionsData?.sessions ?? []
|
|
23
|
+
const activeSessions = sessions.filter((s) => s.status === 'working' || s.status === 'queued')
|
|
22
24
|
|
|
23
25
|
return (
|
|
24
|
-
<div className={cn('space-y-
|
|
25
|
-
{/*
|
|
26
|
-
<div
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
26
|
+
<div className={cn('space-y-8 p-6', className)}>
|
|
27
|
+
{/* Section: Fleet Metrics */}
|
|
28
|
+
<div>
|
|
29
|
+
<div className="mb-4 flex items-center gap-3">
|
|
30
|
+
<h2 className="font-display text-lg font-bold text-af-text-primary tracking-tight">
|
|
31
|
+
Fleet Overview
|
|
32
|
+
</h2>
|
|
33
|
+
{!statsLoading && stats && (
|
|
34
|
+
<span className="text-2xs font-body text-af-text-tertiary tabular-nums">
|
|
35
|
+
{stats.workersOnline} worker{stats.workersOnline !== 1 ? 's' : ''} online
|
|
36
|
+
</span>
|
|
37
|
+
)}
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-6">
|
|
41
|
+
<StatCard
|
|
42
|
+
label="Workers"
|
|
43
|
+
value={stats?.workersOnline ?? 0}
|
|
44
|
+
icon={<Users className="h-3.5 w-3.5" />}
|
|
45
|
+
loading={statsLoading}
|
|
46
|
+
/>
|
|
47
|
+
<StatCard
|
|
48
|
+
label="Active"
|
|
49
|
+
value={stats?.agentsWorking ?? 0}
|
|
50
|
+
icon={<Cpu className="h-3.5 w-3.5" />}
|
|
51
|
+
accent
|
|
52
|
+
loading={statsLoading}
|
|
53
|
+
/>
|
|
54
|
+
<StatCard
|
|
55
|
+
label="Queued"
|
|
56
|
+
value={stats?.queueDepth ?? 0}
|
|
57
|
+
icon={<ListTodo className="h-3.5 w-3.5" />}
|
|
58
|
+
loading={statsLoading}
|
|
59
|
+
/>
|
|
60
|
+
<StatCard
|
|
61
|
+
label="Completed"
|
|
62
|
+
value={stats?.completedToday ?? 0}
|
|
63
|
+
icon={<CheckCircle2 className="h-3.5 w-3.5" />}
|
|
64
|
+
loading={statsLoading}
|
|
65
|
+
/>
|
|
66
|
+
<StatCard
|
|
67
|
+
label="Capacity"
|
|
68
|
+
value={stats?.availableCapacity ?? 0}
|
|
69
|
+
icon={<Gauge className="h-3.5 w-3.5" />}
|
|
70
|
+
loading={statsLoading}
|
|
71
|
+
/>
|
|
72
|
+
<StatCard
|
|
73
|
+
label="Cost"
|
|
74
|
+
value={formatCost(stats?.totalCostToday)}
|
|
75
|
+
icon={<DollarSign className="h-3.5 w-3.5" />}
|
|
76
|
+
loading={statsLoading}
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
63
79
|
</div>
|
|
64
80
|
|
|
65
|
-
{/*
|
|
81
|
+
{/* Section: Active Sessions */}
|
|
66
82
|
<div>
|
|
67
|
-
<
|
|
83
|
+
<div className="mb-4 flex items-center justify-between">
|
|
84
|
+
<div className="flex items-center gap-3">
|
|
85
|
+
<h2 className="font-display text-lg font-bold text-af-text-primary tracking-tight">
|
|
86
|
+
Sessions
|
|
87
|
+
</h2>
|
|
88
|
+
<span className="rounded-full bg-af-surface/60 px-2 py-0.5 text-2xs font-body font-medium tabular-nums text-af-text-secondary">
|
|
89
|
+
{sessions.length}
|
|
90
|
+
</span>
|
|
91
|
+
</div>
|
|
92
|
+
{activeSessions.length > 0 && (
|
|
93
|
+
<span className="text-2xs font-body text-af-teal">
|
|
94
|
+
{activeSessions.length} active
|
|
95
|
+
</span>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
|
|
68
99
|
{sessionsLoading ? (
|
|
69
100
|
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
|
|
70
101
|
{Array.from({ length: 4 }).map((_, i) => (
|
|
71
|
-
<Skeleton key={i} className="h-
|
|
102
|
+
<Skeleton key={i} className="h-[130px] rounded-xl" />
|
|
72
103
|
))}
|
|
73
104
|
</div>
|
|
74
105
|
) : sessions.length === 0 ? (
|
|
@@ -78,8 +109,14 @@ export function FleetOverview({ className }: FleetOverviewProps) {
|
|
|
78
109
|
/>
|
|
79
110
|
) : (
|
|
80
111
|
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
|
|
81
|
-
{sessions.map((session) => (
|
|
82
|
-
<
|
|
112
|
+
{sessions.map((session, i) => (
|
|
113
|
+
<div
|
|
114
|
+
key={session.id}
|
|
115
|
+
className="animate-fade-in"
|
|
116
|
+
style={{ animationDelay: `${i * 50}ms` }}
|
|
117
|
+
>
|
|
118
|
+
<AgentCard session={session} onSelect={onSessionSelect} />
|
|
119
|
+
</div>
|
|
83
120
|
))}
|
|
84
121
|
</div>
|
|
85
122
|
)}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { cn } from '../../lib/utils'
|
|
2
|
-
import { Card } from '../../components/ui/card'
|
|
3
2
|
import { Skeleton } from '../../components/ui/skeleton'
|
|
4
3
|
|
|
5
4
|
interface StatCardProps {
|
|
@@ -8,36 +7,56 @@ interface StatCardProps {
|
|
|
8
7
|
detail?: string
|
|
9
8
|
icon?: React.ReactNode
|
|
10
9
|
trend?: 'up' | 'down' | 'neutral'
|
|
10
|
+
accent?: boolean
|
|
11
11
|
loading?: boolean
|
|
12
12
|
className?: string
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export function StatCard({ label, value, detail, icon, loading, className }: StatCardProps) {
|
|
15
|
+
export function StatCard({ label, value, detail, icon, accent, loading, className }: StatCardProps) {
|
|
16
16
|
if (loading) {
|
|
17
17
|
return (
|
|
18
|
-
<
|
|
18
|
+
<div className={cn(
|
|
19
|
+
'rounded-xl border border-af-surface-border/50 bg-af-surface/50 p-4',
|
|
20
|
+
className
|
|
21
|
+
)}>
|
|
19
22
|
<div className="flex items-center justify-between">
|
|
20
23
|
<Skeleton className="h-3 w-16" />
|
|
21
24
|
<Skeleton className="h-4 w-4 rounded" />
|
|
22
25
|
</div>
|
|
23
|
-
<Skeleton className="mt-
|
|
24
|
-
<Skeleton className="mt-1 h-3 w-20" />
|
|
25
|
-
</
|
|
26
|
+
<Skeleton className="mt-3 h-8 w-16" />
|
|
27
|
+
<Skeleton className="mt-1.5 h-3 w-20" />
|
|
28
|
+
</div>
|
|
26
29
|
)
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
return (
|
|
30
|
-
<
|
|
33
|
+
<div className={cn(
|
|
34
|
+
'group rounded-xl border border-af-surface-border/50 bg-af-surface/40 p-4 transition-all duration-300 hover-glow',
|
|
35
|
+
accent && 'border-af-accent/15 bg-af-accent/[0.03]',
|
|
36
|
+
className
|
|
37
|
+
)}>
|
|
31
38
|
<div className="flex items-center justify-between">
|
|
32
|
-
<span className="text-
|
|
33
|
-
|
|
39
|
+
<span className="text-2xs font-body font-medium uppercase tracking-wider text-af-text-tertiary">
|
|
40
|
+
{label}
|
|
41
|
+
</span>
|
|
42
|
+
{icon && (
|
|
43
|
+
<span className={cn(
|
|
44
|
+
'text-af-text-tertiary transition-colors duration-300 group-hover:text-af-text-secondary',
|
|
45
|
+
accent && 'text-af-accent/40 group-hover:text-af-accent/70'
|
|
46
|
+
)}>
|
|
47
|
+
{icon}
|
|
48
|
+
</span>
|
|
49
|
+
)}
|
|
34
50
|
</div>
|
|
35
|
-
<div className=
|
|
51
|
+
<div className={cn(
|
|
52
|
+
'mt-2 font-display text-2xl font-bold tabular-nums tracking-tight',
|
|
53
|
+
accent ? 'text-af-accent' : 'text-af-text-primary'
|
|
54
|
+
)}>
|
|
36
55
|
{value}
|
|
37
56
|
</div>
|
|
38
57
|
{detail && (
|
|
39
|
-
<p className="mt-
|
|
58
|
+
<p className="mt-1 text-2xs font-body text-af-text-tertiary">{detail}</p>
|
|
40
59
|
)}
|
|
41
|
-
</
|
|
60
|
+
</div>
|
|
42
61
|
)
|
|
43
62
|
}
|
|
@@ -11,7 +11,8 @@ export function StatusDot({ status, className, showHeartbeat = false }: StatusDo
|
|
|
11
11
|
const config = getStatusConfig(status)
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<span className={cn('relative inline-flex h-2
|
|
14
|
+
<span className={cn('relative inline-flex h-2 w-2', className)}>
|
|
15
|
+
{/* Outer glow ring for active states */}
|
|
15
16
|
{config.animate && showHeartbeat && (
|
|
16
17
|
<span
|
|
17
18
|
className={cn(
|
|
@@ -20,11 +21,13 @@ export function StatusDot({ status, className, showHeartbeat = false }: StatusDo
|
|
|
20
21
|
)}
|
|
21
22
|
/>
|
|
22
23
|
)}
|
|
24
|
+
{/* Core dot */}
|
|
23
25
|
<span
|
|
24
26
|
className={cn(
|
|
25
|
-
'relative inline-flex h-2
|
|
27
|
+
'relative inline-flex h-2 w-2 rounded-full',
|
|
26
28
|
config.dotColor,
|
|
27
|
-
config.animate && 'animate-pulse-dot'
|
|
29
|
+
config.animate && 'animate-pulse-dot',
|
|
30
|
+
config.glowClass
|
|
28
31
|
)}
|
|
29
32
|
/>
|
|
30
33
|
</span>
|