@kb-labs/studio-app 0.6.0 → 2.8.0
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.html +1 -0
- package/dist/main.1d68e922.js +522 -0
- package/dist/main.1d68e922.js.map +1 -0
- package/dist/main.80b70197.css +2 -0
- package/dist/main.80b70197.css.map +1 -0
- package/dist/mf-manifest.json +241 -0
- package/dist/mf-stats.json +271 -0
- package/package.json +56 -39
- package/server.js +68 -0
- package/.env.example +0 -10
- package/UI-KIT-COMPONENTS.md +0 -783
- package/UI-KIT-PLAN.md +0 -326
- package/eslint-rules/no-direct-antd-import.js +0 -151
- package/eslint.config.ts +0 -27
- package/index.html +0 -17
- package/postcss.config.js +0 -7
- package/public/favicon.ico +0 -0
- package/rspack.config.mjs +0 -118
- package/src/App.tsx +0 -46
- package/src/components/devtools/devtools-log-feed.module.css +0 -165
- package/src/components/devtools/devtools-log-feed.tsx +0 -300
- package/src/components/devtools/devtools-panel.module.css +0 -121
- package/src/components/devtools/devtools-panel.tsx +0 -115
- package/src/components/empty-state.tsx +0 -28
- package/src/components/error-boundary.tsx +0 -210
- package/src/components/health-banner.module.css +0 -103
- package/src/components/health-banner.tsx +0 -134
- package/src/components/health-indicator.tsx +0 -12
- package/src/components/page-header.tsx +0 -49
- package/src/components/page-transition.tsx +0 -24
- package/src/components/role-switcher.tsx +0 -148
- package/src/components/run-badge.tsx +0 -13
- package/src/components/ui/icons.tsx +0 -509
- package/src/components/ui/index.ts +0 -25
- package/src/components/ui/kb-config-provider.tsx +0 -130
- package/src/components/ui/kb-header.module.css +0 -51
- package/src/components/ui/kb-header.tsx +0 -112
- package/src/components/ui/kb-notification-bell.module.css +0 -103
- package/src/components/ui/kb-notification-bell.tsx +0 -199
- package/src/components/ui/kb-page-layout.tsx +0 -66
- package/src/components/ui/kb-quick-search.module.css +0 -86
- package/src/components/ui/kb-quick-search.tsx +0 -196
- package/src/components/ui/kb-sidebar.module.css +0 -47
- package/src/components/ui/kb-sidebar.tsx +0 -196
- package/src/components/ui/kb-stat-card.module.css +0 -21
- package/src/components/ui/kb-stat-card.tsx +0 -22
- package/src/components/ui/kb-stat-grid.tsx +0 -22
- package/src/components/ui/kb-status-bar.module.css +0 -49
- package/src/components/ui/kb-status-bar.tsx +0 -145
- package/src/components/ui/kb-system-health-indicator.tsx +0 -229
- package/src/components/ui/kb-theme-toggle.tsx +0 -42
- package/src/components/ui/theme-adapter.ts +0 -812
- package/src/components/ui/theme-transition-overlay.tsx +0 -70
- package/src/components/ui/utils.ts +0 -6
- package/src/components/widget-error-boundary.tsx +0 -172
- package/src/config/env.ts +0 -5
- package/src/config/feature-flags.ts +0 -482
- package/src/config/studio.config.schema.ts +0 -88
- package/src/config/studio.config.ts +0 -84
- package/src/env.d.ts +0 -23
- package/src/hooks/use-command-palette.ts +0 -6
- package/src/hooks/use-devtools-store.ts +0 -25
- package/src/hooks/use-feature-flags.ts +0 -101
- package/src/index.css +0 -10
- package/src/layouts/dashboard-grid.tsx +0 -122
- package/src/layouts/index.ts +0 -12
- package/src/layouts/two-pane.tsx +0 -134
- package/src/main.tsx +0 -15
- package/src/modules/analytics/components/analytics-daily-stats-chart.tsx +0 -257
- package/src/modules/analytics/components/analytics-date-range-picker.tsx +0 -121
- package/src/modules/analytics/pages/analytics-cache-page.tsx +0 -285
- package/src/modules/analytics/pages/analytics-embeddings-page.tsx +0 -274
- package/src/modules/analytics/pages/analytics-events-page.tsx +0 -425
- package/src/modules/analytics/pages/analytics-llm-page.tsx +0 -434
- package/src/modules/analytics/pages/analytics-overview-page.tsx +0 -336
- package/src/modules/analytics/pages/analytics-page.tsx +0 -20
- package/src/modules/analytics/pages/analytics-storage-page.tsx +0 -344
- package/src/modules/analytics/pages/analytics-vectorstore-page.tsx +0 -279
- package/src/modules/analytics/routes/index.tsx +0 -133
- package/src/modules/analytics/utils/formatters.test.ts +0 -148
- package/src/modules/analytics/utils/formatters.ts +0 -100
- package/src/modules/auth/pages/login-page.module.css +0 -113
- package/src/modules/auth/pages/login-page.tsx +0 -80
- package/src/modules/auth/routes/index.tsx +0 -24
- package/src/modules/dashboard/components/ActivityTimelineWidget.tsx +0 -199
- package/src/modules/dashboard/components/AiInsightsWidget.tsx +0 -358
- package/src/modules/dashboard/components/AnimatedMetricCard.css +0 -88
- package/src/modules/dashboard/components/AnimatedMetricCard.tsx +0 -125
- package/src/modules/dashboard/components/HeroMetricCard.css +0 -114
- package/src/modules/dashboard/components/HeroMetricCard.tsx +0 -152
- package/src/modules/dashboard/components/HeroMetricsWidget.tsx +0 -146
- package/src/modules/dashboard/components/SystemResourcesWidget.tsx +0 -197
- package/src/modules/dashboard/components/dashboard-empty.tsx +0 -22
- package/src/modules/dashboard/components/dashboard-kpis-widget.tsx +0 -59
- package/src/modules/dashboard/components/dashboard-kpis.tsx +0 -13
- package/src/modules/dashboard/components/dashboard-latency-percentiles-widget.tsx +0 -85
- package/src/modules/dashboard/components/dashboard-metrics-widget.tsx +0 -78
- package/src/modules/dashboard/components/dashboard-plugins-widget.tsx +0 -67
- package/src/modules/dashboard/components/dashboard-requests-widget.tsx +0 -62
- package/src/modules/dashboard/layouts/dashboard-layout.tsx +0 -16
- package/src/modules/dashboard/pages/ai-insights-page.tsx +0 -563
- package/src/modules/dashboard/pages/dashboard-animations.css +0 -317
- package/src/modules/dashboard/pages/dashboard-page.tsx +0 -13
- package/src/modules/dashboard/routes/index.tsx +0 -70
- package/src/modules/observability/pages/devkit-page.tsx +0 -263
- package/src/modules/observability/pages/incident-detail-page.tsx +0 -571
- package/src/modules/observability/pages/incidents-page.tsx +0 -370
- package/src/modules/observability/pages/log-detail-page.tsx +0 -508
- package/src/modules/observability/pages/logs-page.tsx +0 -1129
- package/src/modules/observability/pages/prometheus-metrics-page.tsx +0 -486
- package/src/modules/observability/pages/state-broker-page.tsx +0 -229
- package/src/modules/observability/pages/system-events-page.tsx +0 -255
- package/src/modules/observability/routes/index.tsx +0 -133
- package/src/modules/plugins/components/marketplace-card.tsx +0 -153
- package/src/modules/plugins/components/plugin-ai-assistant-modal.tsx +0 -374
- package/src/modules/plugins/components/plugin-card.tsx +0 -136
- package/src/modules/plugins/components/plugin-detail/capabilities-summary.tsx +0 -101
- package/src/modules/plugins/components/plugin-detail/cli-commands-table.tsx +0 -101
- package/src/modules/plugins/components/plugin-detail/index.ts +0 -7
- package/src/modules/plugins/components/plugin-detail/jobs-table.tsx +0 -64
- package/src/modules/plugins/components/plugin-detail/permissions/env-permissions.tsx +0 -30
- package/src/modules/plugins/components/plugin-detail/permissions/filesystem-permissions.tsx +0 -68
- package/src/modules/plugins/components/plugin-detail/permissions/index.ts +0 -6
- package/src/modules/plugins/components/plugin-detail/permissions/network-permissions.tsx +0 -43
- package/src/modules/plugins/components/plugin-detail/permissions/platform-services.tsx +0 -242
- package/src/modules/plugins/components/plugin-detail/permissions/resource-quotas.tsx +0 -96
- package/src/modules/plugins/components/plugin-detail/permissions/shell-permissions.tsx +0 -55
- package/src/modules/plugins/components/plugin-detail/permissions-view.tsx +0 -47
- package/src/modules/plugins/components/plugin-detail/plugin-header.tsx +0 -169
- package/src/modules/plugins/components/plugin-detail/rest-routes-table.tsx +0 -159
- package/src/modules/plugins/components/plugin-detail/workflows-table.tsx +0 -40
- package/src/modules/plugins/components/plugin-grid.tsx +0 -20
- package/src/modules/plugins/components/plugin-table.tsx +0 -178
- package/src/modules/plugins/pages/marketplace-page.tsx +0 -200
- package/src/modules/plugins/pages/plugin-detail-page.tsx +0 -1145
- package/src/modules/plugins/routes/index.tsx +0 -48
- package/src/modules/plugins/utils/index.ts +0 -1
- package/src/modules/plugins/utils/schema-helpers.ts +0 -21
- package/src/modules/settings/components/api-routes-viewer.tsx +0 -415
- package/src/modules/settings/components/appearance-settings.tsx +0 -200
- package/src/modules/settings/components/configuration-settings.tsx +0 -321
- package/src/modules/settings/components/data-privacy-settings.tsx +0 -111
- package/src/modules/settings/components/experimental-settings.tsx +0 -243
- package/src/modules/settings/components/navigation-settings.tsx +0 -198
- package/src/modules/settings/components/notifications-settings.tsx +0 -40
- package/src/modules/settings/pages/settings-page.tsx +0 -298
- package/src/modules/settings/routes/index.tsx +0 -47
- package/src/pages/README-assistant.md +0 -91
- package/src/pages/login-page.tsx +0 -177
- package/src/pages/not-found-page.tsx +0 -85
- package/src/providers/auth-provider.tsx +0 -40
- package/src/providers/command-palette-provider.tsx +0 -193
- package/src/providers/data-sources-provider.tsx +0 -27
- package/src/providers/devtools-provider.tsx +0 -72
- package/src/providers/navigation-items-provider.tsx +0 -38
- package/src/providers/registry-v2-provider.tsx +0 -93
- package/src/providers/settings-provider.tsx +0 -158
- package/src/router.tsx +0 -302
- package/src/routes/helpers.tsx +0 -25
- package/src/routes/plugin-page-v2.tsx +0 -52
- package/src/routes/types.ts +0 -18
- package/src/styles/antd-overrides.css +0 -211
- package/src/styles/base.css +0 -190
- package/src/styles/settings.css +0 -75
- package/src/styles/variables.css +0 -94
- package/src/utils/analytics.ts +0 -183
- package/src/utils/apply-navigation-categories.ts +0 -83
- package/src/utils/commands.ts +0 -252
- package/src/utils/export.ts +0 -174
- package/src/utils/format-date.ts +0 -166
- package/src/utils/logger.ts +0 -110
- package/tailwind.config.ts +0 -13
- package/tsconfig.json +0 -13
- package/vitest-setup.ts +0 -1
- /package/{public → dist}/favicon.svg +0 -0
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
UIRow,
|
|
3
|
-
UICol,
|
|
4
|
-
UITable,
|
|
5
|
-
UICard,
|
|
6
|
-
UIStatistic,
|
|
7
|
-
UIProgress,
|
|
8
|
-
UIAlert,
|
|
9
|
-
UIIcon,
|
|
10
|
-
} from '@kb-labs/studio-ui-kit';
|
|
11
|
-
import { useStateBrokerStats } from '@kb-labs/studio-data-client';
|
|
12
|
-
import { useDataSources } from '../../../providers/data-sources-provider';
|
|
13
|
-
import type { NamespaceStats } from '@kb-labs/studio-data-client';
|
|
14
|
-
import { UIPage, UIPageHeader } from '@kb-labs/studio-ui-kit';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Format uptime in milliseconds to human-readable string
|
|
18
|
-
*/
|
|
19
|
-
function formatUptime(ms: number): string {
|
|
20
|
-
const hours = Math.floor(ms / 3600000);
|
|
21
|
-
const minutes = Math.floor((ms % 3600000) / 60000);
|
|
22
|
-
|
|
23
|
-
if (hours > 0) {
|
|
24
|
-
return `${hours}h ${minutes}m`;
|
|
25
|
-
}
|
|
26
|
-
return `${minutes}m`;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Format bytes to human-readable size
|
|
31
|
-
*/
|
|
32
|
-
function formatBytes(bytes: number): string {
|
|
33
|
-
if (bytes === 0) {return '0 B';}
|
|
34
|
-
const k = 1024;
|
|
35
|
-
const sizes = ['B', 'KB', 'MB', 'GB'];
|
|
36
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
37
|
-
return `${Math.round(bytes / Math.pow(k, i) * 100) / 100} ${sizes[i]}`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* State Broker Observability Page
|
|
42
|
-
*
|
|
43
|
-
* Shows real-time statistics from the State Broker daemon:
|
|
44
|
-
* - Cache hit/miss rates
|
|
45
|
-
* - Namespace breakdown
|
|
46
|
-
* - Uptime and entry counts
|
|
47
|
-
*/
|
|
48
|
-
export function StateBrokerPage() {
|
|
49
|
-
const sources = useDataSources();
|
|
50
|
-
const { data, isLoading, error, isError } = useStateBrokerStats(sources.observability);
|
|
51
|
-
|
|
52
|
-
if (isError) {
|
|
53
|
-
return (
|
|
54
|
-
<UIPage>
|
|
55
|
-
<UIPageHeader
|
|
56
|
-
title="State Broker"
|
|
57
|
-
description="In-memory cache statistics"
|
|
58
|
-
/>
|
|
59
|
-
<UIAlert
|
|
60
|
-
message="Failed to load State Broker stats"
|
|
61
|
-
description={error instanceof Error ? error.message : 'Unknown error. Make sure State Daemon is running on localhost:7777'}
|
|
62
|
-
variant="error"
|
|
63
|
-
showIcon
|
|
64
|
-
style={{ marginBottom: 24 }}
|
|
65
|
-
/>
|
|
66
|
-
</UIPage>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (isLoading || !data) {
|
|
71
|
-
return (
|
|
72
|
-
<UIPage>
|
|
73
|
-
<UIPageHeader
|
|
74
|
-
title="State Broker"
|
|
75
|
-
description="In-memory cache statistics"
|
|
76
|
-
/>
|
|
77
|
-
<div style={{ padding: '24px 0', textAlign: 'center' }}>
|
|
78
|
-
Loading...
|
|
79
|
-
</div>
|
|
80
|
-
</UIPage>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const hitRatePercent = Math.round(data.hitRate * 100);
|
|
85
|
-
const missRatePercent = Math.round(data.missRate * 100);
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<UIPage width="full">
|
|
89
|
-
<UIPageHeader
|
|
90
|
-
title="State Broker"
|
|
91
|
-
description="In-memory cache statistics - Auto-refresh every 5s"
|
|
92
|
-
/>
|
|
93
|
-
|
|
94
|
-
{/* Overview Stats */}
|
|
95
|
-
<UIRow gutter={[16, 16]} style={{ marginBottom: 24 }}>
|
|
96
|
-
<UICol xs={24} sm={12} lg={6}>
|
|
97
|
-
<UICard>
|
|
98
|
-
<UIStatistic
|
|
99
|
-
title="Uptime"
|
|
100
|
-
value={formatUptime(data.uptime)}
|
|
101
|
-
prefix={<UIIcon name="ClockCircleOutlined" />}
|
|
102
|
-
/>
|
|
103
|
-
</UICard>
|
|
104
|
-
</UICol>
|
|
105
|
-
<UICol xs={24} sm={12} lg={6}>
|
|
106
|
-
<UICard>
|
|
107
|
-
<UIStatistic
|
|
108
|
-
title="Cache Entries"
|
|
109
|
-
value={data.totalEntries}
|
|
110
|
-
prefix={<UIIcon name="DatabaseOutlined" />}
|
|
111
|
-
/>
|
|
112
|
-
</UICard>
|
|
113
|
-
</UICol>
|
|
114
|
-
<UICol xs={24} sm={12} lg={6}>
|
|
115
|
-
<UICard>
|
|
116
|
-
<UIStatistic
|
|
117
|
-
title="Cache Size"
|
|
118
|
-
value={formatBytes(data.totalSize)}
|
|
119
|
-
prefix={<UIIcon name="DatabaseOutlined" />}
|
|
120
|
-
/>
|
|
121
|
-
</UICard>
|
|
122
|
-
</UICol>
|
|
123
|
-
<UICol xs={24} sm={12} lg={6}>
|
|
124
|
-
<UICard>
|
|
125
|
-
<UIStatistic
|
|
126
|
-
title="Evictions"
|
|
127
|
-
value={data.evictions}
|
|
128
|
-
prefix={<UIIcon name="DeleteOutlined" />}
|
|
129
|
-
/>
|
|
130
|
-
</UICard>
|
|
131
|
-
</UICol>
|
|
132
|
-
</UIRow>
|
|
133
|
-
|
|
134
|
-
{/* Hit/Miss Rate */}
|
|
135
|
-
<UIRow gutter={[16, 16]} style={{ marginBottom: 24 }}>
|
|
136
|
-
<UICol xs={24} lg={12}>
|
|
137
|
-
<UICard title="Cache Hit Rate" extra={<UIIcon name="CheckCircleOutlined" style={{ color: '#52c41a' }} />}>
|
|
138
|
-
<UIProgress
|
|
139
|
-
percent={hitRatePercent}
|
|
140
|
-
status={hitRatePercent >= 70 ? 'success' : hitRatePercent >= 50 ? 'normal' : 'exception'}
|
|
141
|
-
strokeColor={hitRatePercent >= 70 ? '#52c41a' : hitRatePercent >= 50 ? '#1890ff' : '#ff4d4f'}
|
|
142
|
-
/>
|
|
143
|
-
<div style={{ marginTop: 8, fontSize: 12, color: '#8c8c8c' }}>
|
|
144
|
-
{hitRatePercent >= 70 ? 'Excellent cache performance' :
|
|
145
|
-
hitRatePercent >= 50 ? 'Good cache performance' :
|
|
146
|
-
'Poor cache performance - consider increasing TTL'}
|
|
147
|
-
</div>
|
|
148
|
-
</UICard>
|
|
149
|
-
</UICol>
|
|
150
|
-
<UICol xs={24} lg={12}>
|
|
151
|
-
<UICard title="Cache Miss Rate" extra={<UIIcon name="CloseCircleOutlined" style={{ color: '#ff4d4f' }} />}>
|
|
152
|
-
<UIProgress
|
|
153
|
-
percent={missRatePercent}
|
|
154
|
-
status={missRatePercent <= 30 ? 'success' : missRatePercent <= 50 ? 'normal' : 'exception'}
|
|
155
|
-
strokeColor={missRatePercent <= 30 ? '#52c41a' : missRatePercent <= 50 ? '#faad14' : '#ff4d4f'}
|
|
156
|
-
/>
|
|
157
|
-
<div style={{ marginTop: 8, fontSize: 12, color: '#8c8c8c' }}>
|
|
158
|
-
{missRatePercent <= 30 ? 'Low miss rate - good cache efficiency' :
|
|
159
|
-
missRatePercent <= 50 ? 'Moderate miss rate' :
|
|
160
|
-
'High miss rate - cache not effective'}
|
|
161
|
-
</div>
|
|
162
|
-
</UICard>
|
|
163
|
-
</UICol>
|
|
164
|
-
</UIRow>
|
|
165
|
-
|
|
166
|
-
{/* Namespaces Table */}
|
|
167
|
-
<UICard title="Namespaces Breakdown" style={{ marginBottom: 24 }}>
|
|
168
|
-
<UITable<{ key: string; name: string } & NamespaceStats>
|
|
169
|
-
dataSource={Object.entries(data.namespaces).map(([name, stats]) => ({
|
|
170
|
-
key: name,
|
|
171
|
-
name,
|
|
172
|
-
...stats,
|
|
173
|
-
}))}
|
|
174
|
-
columns={[
|
|
175
|
-
{
|
|
176
|
-
title: 'Namespace',
|
|
177
|
-
dataIndex: 'name',
|
|
178
|
-
key: 'name',
|
|
179
|
-
render: (name: string) => <strong>{name}</strong>,
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
title: 'Entries',
|
|
183
|
-
dataIndex: 'entries',
|
|
184
|
-
key: 'entries',
|
|
185
|
-
align: 'right' as const,
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
title: 'Hits',
|
|
189
|
-
dataIndex: 'hits',
|
|
190
|
-
key: 'hits',
|
|
191
|
-
align: 'right' as const,
|
|
192
|
-
render: (hits: number) => (
|
|
193
|
-
<span style={{ color: '#52c41a' }}>{hits}</span>
|
|
194
|
-
),
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
title: 'Misses',
|
|
198
|
-
dataIndex: 'misses',
|
|
199
|
-
key: 'misses',
|
|
200
|
-
align: 'right' as const,
|
|
201
|
-
render: (misses: number) => (
|
|
202
|
-
<span style={{ color: '#ff4d4f' }}>{misses}</span>
|
|
203
|
-
),
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
title: 'Hit Rate',
|
|
207
|
-
key: 'hitRate',
|
|
208
|
-
align: 'right' as const,
|
|
209
|
-
render: (_: unknown, record: { hits: number; misses: number }) => {
|
|
210
|
-
const total = record.hits + record.misses;
|
|
211
|
-
const rate = total > 0 ? (record.hits / total) * 100 : 0;
|
|
212
|
-
return `${Math.round(rate)}%`;
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
title: 'Size',
|
|
217
|
-
dataIndex: 'size',
|
|
218
|
-
key: 'size',
|
|
219
|
-
align: 'right' as const,
|
|
220
|
-
render: (size: number) => formatBytes(size),
|
|
221
|
-
},
|
|
222
|
-
]}
|
|
223
|
-
pagination={false}
|
|
224
|
-
size="small"
|
|
225
|
-
/>
|
|
226
|
-
</UICard>
|
|
227
|
-
</UIPage>
|
|
228
|
-
);
|
|
229
|
-
}
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
UICard,
|
|
3
|
-
UIAlert,
|
|
4
|
-
UIBadge,
|
|
5
|
-
UITag,
|
|
6
|
-
UITimeline,
|
|
7
|
-
UIRow,
|
|
8
|
-
UICol,
|
|
9
|
-
UIStatistic,
|
|
10
|
-
UIIcon,
|
|
11
|
-
} from '@kb-labs/studio-ui-kit';
|
|
12
|
-
import { useSystemEvents } from '@kb-labs/studio-data-client';
|
|
13
|
-
import { useDataSources } from '../../../providers/data-sources-provider';
|
|
14
|
-
import type { RegistryEvent, HealthEvent } from '@kb-labs/studio-data-client';
|
|
15
|
-
import { UIPage, UIPageHeader } from '@kb-labs/studio-ui-kit';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Format timestamp to time string
|
|
19
|
-
*/
|
|
20
|
-
function formatTime(timestamp: string): string {
|
|
21
|
-
return new Date(timestamp).toLocaleTimeString();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* System Events Live Feed Page
|
|
26
|
-
*
|
|
27
|
-
* Shows real-time system events from /events/registry SSE stream:
|
|
28
|
-
* - Registry updates (plugin registration, checksums)
|
|
29
|
-
* - Health status changes
|
|
30
|
-
* - Redis state transitions
|
|
31
|
-
* - Plugin mount events
|
|
32
|
-
*/
|
|
33
|
-
export function SystemEventsPage() {
|
|
34
|
-
const sources = useDataSources();
|
|
35
|
-
const { events, isConnected, error } = useSystemEvents(sources.observability);
|
|
36
|
-
|
|
37
|
-
const latestHealth = events.find((e) => e.type === 'health') as HealthEvent | undefined;
|
|
38
|
-
const latestRegistry = events.find((e) => e.type === 'registry') as RegistryEvent | undefined;
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<UIPage width="full">
|
|
42
|
-
<UIPageHeader
|
|
43
|
-
title="System Events"
|
|
44
|
-
description="Real-time system event stream - Auto-updates via Server-Sent Events"
|
|
45
|
-
/>
|
|
46
|
-
|
|
47
|
-
{/* Connection Status */}
|
|
48
|
-
{!isConnected && !error && (
|
|
49
|
-
<UIAlert
|
|
50
|
-
message="Connecting to event stream..."
|
|
51
|
-
variant="info"
|
|
52
|
-
showIcon
|
|
53
|
-
icon={<UIIcon name="SyncOutlined" spin />}
|
|
54
|
-
style={{ marginBottom: 24 }}
|
|
55
|
-
/>
|
|
56
|
-
)}
|
|
57
|
-
|
|
58
|
-
{error && (
|
|
59
|
-
<UIAlert
|
|
60
|
-
message="Connection failed"
|
|
61
|
-
description={error.message + ' - Make sure REST API is running on localhost:5050'}
|
|
62
|
-
variant="error"
|
|
63
|
-
showIcon
|
|
64
|
-
style={{ marginBottom: 24 }}
|
|
65
|
-
/>
|
|
66
|
-
)}
|
|
67
|
-
|
|
68
|
-
{isConnected && (
|
|
69
|
-
<UIAlert
|
|
70
|
-
message="Connected to event stream"
|
|
71
|
-
variant="success"
|
|
72
|
-
showIcon
|
|
73
|
-
icon={<UIIcon name="CheckCircleOutlined" />}
|
|
74
|
-
style={{ marginBottom: 24 }}
|
|
75
|
-
/>
|
|
76
|
-
)}
|
|
77
|
-
|
|
78
|
-
{/* Current System Status */}
|
|
79
|
-
<UIRow gutter={[16, 16]} style={{ marginBottom: 24 }}>
|
|
80
|
-
<UICol xs={24} lg={12}>
|
|
81
|
-
<UICard
|
|
82
|
-
title="Latest Health Status"
|
|
83
|
-
extra={
|
|
84
|
-
latestHealth ? (
|
|
85
|
-
<UIBadge
|
|
86
|
-
variant={latestHealth.ready ? 'success' : 'error'}
|
|
87
|
-
>
|
|
88
|
-
{latestHealth.ready ? 'Ready' : 'Not Ready'}
|
|
89
|
-
</UIBadge>
|
|
90
|
-
) : null
|
|
91
|
-
}
|
|
92
|
-
>
|
|
93
|
-
{latestHealth ? (
|
|
94
|
-
<UIRow gutter={16}>
|
|
95
|
-
<UICol span={8}>
|
|
96
|
-
<UIStatistic
|
|
97
|
-
title="Status"
|
|
98
|
-
value={latestHealth.status}
|
|
99
|
-
valueStyle={{ color: latestHealth.status === 'healthy' ? '#52c41a' : '#ff4d4f' }}
|
|
100
|
-
/>
|
|
101
|
-
</UICol>
|
|
102
|
-
<UICol span={8}>
|
|
103
|
-
<UIStatistic
|
|
104
|
-
title="Plugins Mounted"
|
|
105
|
-
value={latestHealth.pluginsMounted ?? 0}
|
|
106
|
-
suffix={latestHealth.pluginsMounted !== undefined && latestHealth.pluginsFailed !== undefined
|
|
107
|
-
? `/ ${latestHealth.pluginsMounted + latestHealth.pluginsFailed}`
|
|
108
|
-
: ''}
|
|
109
|
-
/>
|
|
110
|
-
</UICol>
|
|
111
|
-
<UICol span={8}>
|
|
112
|
-
<UIStatistic
|
|
113
|
-
title="Redis"
|
|
114
|
-
value={latestHealth.redisEnabled
|
|
115
|
-
? (latestHealth.redisHealthy ? 'Healthy' : 'Unhealthy')
|
|
116
|
-
: 'Disabled'}
|
|
117
|
-
valueStyle={{
|
|
118
|
-
color: !latestHealth.redisEnabled
|
|
119
|
-
? '#8c8c8c'
|
|
120
|
-
: (latestHealth.redisHealthy ? '#52c41a' : '#ff4d4f')
|
|
121
|
-
}}
|
|
122
|
-
/>
|
|
123
|
-
</UICol>
|
|
124
|
-
</UIRow>
|
|
125
|
-
) : (
|
|
126
|
-
<UIAlert message="No health data received yet" variant="info" showIcon />
|
|
127
|
-
)}
|
|
128
|
-
</UICard>
|
|
129
|
-
</UICol>
|
|
130
|
-
|
|
131
|
-
<UICol xs={24} lg={12}>
|
|
132
|
-
<UICard
|
|
133
|
-
title="Latest Registry"
|
|
134
|
-
extra={
|
|
135
|
-
latestRegistry ? (
|
|
136
|
-
<UITag color={latestRegistry.stale ? 'orange' : 'green'}>
|
|
137
|
-
{latestRegistry.stale ? 'Stale' : 'Fresh'}
|
|
138
|
-
</UITag>
|
|
139
|
-
) : null
|
|
140
|
-
}
|
|
141
|
-
>
|
|
142
|
-
{latestRegistry ? (
|
|
143
|
-
<UIRow gutter={16}>
|
|
144
|
-
<UICol span={12}>
|
|
145
|
-
<UIStatistic
|
|
146
|
-
title="Revision"
|
|
147
|
-
value={String(latestRegistry.rev).substring(0, 8)}
|
|
148
|
-
valueStyle={{ fontSize: 18 }}
|
|
149
|
-
/>
|
|
150
|
-
</UICol>
|
|
151
|
-
<UICol span={12}>
|
|
152
|
-
<UIStatistic
|
|
153
|
-
title="Generated"
|
|
154
|
-
value={formatTime(latestRegistry.generatedAt)}
|
|
155
|
-
valueStyle={{ fontSize: 18 }}
|
|
156
|
-
/>
|
|
157
|
-
</UICol>
|
|
158
|
-
</UIRow>
|
|
159
|
-
) : (
|
|
160
|
-
<UIAlert message="No registry data received yet" variant="info" showIcon />
|
|
161
|
-
)}
|
|
162
|
-
</UICard>
|
|
163
|
-
</UICol>
|
|
164
|
-
</UIRow>
|
|
165
|
-
|
|
166
|
-
{/* Event Timeline */}
|
|
167
|
-
<UICard
|
|
168
|
-
title="Live Event Feed"
|
|
169
|
-
extra={
|
|
170
|
-
<UIBadge
|
|
171
|
-
count={events.length}
|
|
172
|
-
overflowCount={99}
|
|
173
|
-
style={{ backgroundColor: '#1890ff' }}
|
|
174
|
-
/>
|
|
175
|
-
}
|
|
176
|
-
>
|
|
177
|
-
{events.length > 0 ? (
|
|
178
|
-
<UITimeline
|
|
179
|
-
items={events.map((event, index) => {
|
|
180
|
-
if (event.type === 'health') {
|
|
181
|
-
const healthEvent = event as HealthEvent;
|
|
182
|
-
return {
|
|
183
|
-
key: index,
|
|
184
|
-
color: healthEvent.ready ? 'green' : 'red',
|
|
185
|
-
dot: healthEvent.ready ? <UIIcon name="CheckCircleOutlined" /> : <UIIcon name="CloseCircleOutlined" />,
|
|
186
|
-
children: (
|
|
187
|
-
<div>
|
|
188
|
-
<div style={{ marginBottom: 4 }}>
|
|
189
|
-
<UITag color="blue">HEALTH</UITag>
|
|
190
|
-
<UITag color={healthEvent.status === 'healthy' ? 'green' : 'red'}>
|
|
191
|
-
{healthEvent.status}
|
|
192
|
-
</UITag>
|
|
193
|
-
{healthEvent.ready && <UITag color="green">READY</UITag>}
|
|
194
|
-
{!healthEvent.ready && healthEvent.reason && (
|
|
195
|
-
<UITag color="orange">{healthEvent.reason}</UITag>
|
|
196
|
-
)}
|
|
197
|
-
<span style={{ fontSize: 12, color: '#8c8c8c', marginLeft: 8 }}>
|
|
198
|
-
{formatTime(healthEvent.ts)}
|
|
199
|
-
</span>
|
|
200
|
-
</div>
|
|
201
|
-
<div style={{ fontSize: 13 }}>
|
|
202
|
-
{healthEvent.pluginsMounted !== undefined && healthEvent.pluginsFailed !== undefined ? (
|
|
203
|
-
<>Plugins: {healthEvent.pluginsMounted} mounted, {healthEvent.pluginsFailed} failed</>
|
|
204
|
-
) : (
|
|
205
|
-
<>Plugins: status unavailable</>
|
|
206
|
-
)}
|
|
207
|
-
{healthEvent.redisEnabled && (
|
|
208
|
-
<> | Redis: {healthEvent.redisHealthy ? 'healthy' : 'unhealthy'}</>
|
|
209
|
-
)}
|
|
210
|
-
</div>
|
|
211
|
-
</div>
|
|
212
|
-
),
|
|
213
|
-
};
|
|
214
|
-
} else {
|
|
215
|
-
const registryEvent = event as RegistryEvent;
|
|
216
|
-
return {
|
|
217
|
-
key: index,
|
|
218
|
-
color: registryEvent.stale ? 'orange' : 'blue',
|
|
219
|
-
dot: <UIIcon name="ApiOutlined" />,
|
|
220
|
-
children: (
|
|
221
|
-
<div>
|
|
222
|
-
<div style={{ marginBottom: 4 }}>
|
|
223
|
-
<UITag color="purple">REGISTRY</UITag>
|
|
224
|
-
<UITag>{String(registryEvent.rev).substring(0, 8)}</UITag>
|
|
225
|
-
{registryEvent.stale && <UITag color="orange">STALE</UITag>}
|
|
226
|
-
{registryEvent.partial && <UITag color="orange">PARTIAL</UITag>}
|
|
227
|
-
<span style={{ fontSize: 12, color: '#8c8c8c', marginLeft: 8 }}>
|
|
228
|
-
{formatTime(registryEvent.generatedAt)}
|
|
229
|
-
</span>
|
|
230
|
-
</div>
|
|
231
|
-
{registryEvent.checksum && (
|
|
232
|
-
<div style={{ fontSize: 13 }}>
|
|
233
|
-
Checksum: {registryEvent.checksum.substring(0, 16)}...
|
|
234
|
-
{registryEvent.previousChecksum && ' (changed)'}
|
|
235
|
-
</div>
|
|
236
|
-
)}
|
|
237
|
-
</div>
|
|
238
|
-
),
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
})}
|
|
242
|
-
/>
|
|
243
|
-
) : (
|
|
244
|
-
<UIAlert
|
|
245
|
-
message="No events received yet"
|
|
246
|
-
description="Waiting for system events..."
|
|
247
|
-
variant="info"
|
|
248
|
-
showIcon
|
|
249
|
-
icon={<UIIcon name="SyncOutlined" spin />}
|
|
250
|
-
/>
|
|
251
|
-
)}
|
|
252
|
-
</UICard>
|
|
253
|
-
</UIPage>
|
|
254
|
-
);
|
|
255
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module @kb-labs/studio-app/modules/observability/routes
|
|
3
|
-
* Observability module routing configuration
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { RouteObject } from 'react-router-dom';
|
|
7
|
-
import { StateBrokerPage } from '../pages/state-broker-page';
|
|
8
|
-
import { DevKitPage } from '../pages/devkit-page';
|
|
9
|
-
import { PrometheusMetricsPage } from '../pages/prometheus-metrics-page';
|
|
10
|
-
import { SystemEventsPage } from '../pages/system-events-page';
|
|
11
|
-
import { LogsPage } from '../pages/logs-page';
|
|
12
|
-
import { LogDetailPage } from '../pages/log-detail-page';
|
|
13
|
-
import { IncidentsPage } from '../pages/incidents-page';
|
|
14
|
-
import { IncidentDetailPage } from '../pages/incident-detail-page';
|
|
15
|
-
import { ErrorBoundary } from '../../../components/error-boundary';
|
|
16
|
-
import { renderIcon } from '../../../routes/helpers';
|
|
17
|
-
import type { NavigationItem } from '@/components/ui';
|
|
18
|
-
|
|
19
|
-
// Route paths
|
|
20
|
-
const PATHS = {
|
|
21
|
-
STATE_BROKER: '/observability/state-broker',
|
|
22
|
-
DEVKIT: '/observability/devkit',
|
|
23
|
-
PROMETHEUS: '/observability/prometheus-metrics',
|
|
24
|
-
EVENTS: '/observability/system-events',
|
|
25
|
-
LOGS: '/observability/logs',
|
|
26
|
-
LOG_DETAIL: '/observability/logs/:id',
|
|
27
|
-
INCIDENTS: '/observability/incidents',
|
|
28
|
-
INCIDENT_DETAIL: '/observability/incidents/:id',
|
|
29
|
-
} as const;
|
|
30
|
-
|
|
31
|
-
// Route keys
|
|
32
|
-
const KEYS = {
|
|
33
|
-
MODULE: 'observability',
|
|
34
|
-
STATE_BROKER: 'observability-state-broker',
|
|
35
|
-
DEVKIT: 'observability-devkit',
|
|
36
|
-
PROMETHEUS: 'observability-prometheus',
|
|
37
|
-
EVENTS: 'observability-events',
|
|
38
|
-
LOGS: 'observability-logs',
|
|
39
|
-
INCIDENTS: 'observability-incidents',
|
|
40
|
-
} as const;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Observability routes
|
|
44
|
-
*/
|
|
45
|
-
export const observabilityRoutes: RouteObject[] = [
|
|
46
|
-
{
|
|
47
|
-
path: PATHS.STATE_BROKER,
|
|
48
|
-
element: <StateBrokerPage />,
|
|
49
|
-
errorElement: <ErrorBoundary />,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
path: PATHS.DEVKIT,
|
|
53
|
-
element: <DevKitPage />,
|
|
54
|
-
errorElement: <ErrorBoundary />,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
path: PATHS.PROMETHEUS,
|
|
58
|
-
element: <PrometheusMetricsPage />,
|
|
59
|
-
errorElement: <ErrorBoundary />,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
path: PATHS.EVENTS,
|
|
63
|
-
element: <SystemEventsPage />,
|
|
64
|
-
errorElement: <ErrorBoundary />,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
path: PATHS.LOGS,
|
|
68
|
-
element: <LogsPage />,
|
|
69
|
-
errorElement: <ErrorBoundary />,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
path: PATHS.LOG_DETAIL,
|
|
73
|
-
element: <LogDetailPage />,
|
|
74
|
-
errorElement: <ErrorBoundary />,
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
path: PATHS.INCIDENTS,
|
|
78
|
-
element: <IncidentsPage />,
|
|
79
|
-
errorElement: <ErrorBoundary />,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
path: PATHS.INCIDENT_DETAIL,
|
|
83
|
-
element: <IncidentDetailPage />,
|
|
84
|
-
errorElement: <ErrorBoundary />,
|
|
85
|
-
},
|
|
86
|
-
];
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Observability navigation item for sidebar
|
|
90
|
-
*/
|
|
91
|
-
export const observabilityNavigation: NavigationItem = {
|
|
92
|
-
key: KEYS.MODULE,
|
|
93
|
-
label: 'Observability',
|
|
94
|
-
icon: renderIcon('EyeOutlined'),
|
|
95
|
-
children: [
|
|
96
|
-
{
|
|
97
|
-
key: KEYS.STATE_BROKER,
|
|
98
|
-
label: 'State Broker',
|
|
99
|
-
path: PATHS.STATE_BROKER,
|
|
100
|
-
icon: renderIcon('ApiOutlined'),
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
key: KEYS.DEVKIT,
|
|
104
|
-
label: 'DevKit',
|
|
105
|
-
path: PATHS.DEVKIT,
|
|
106
|
-
icon: renderIcon('ToolOutlined'),
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
key: KEYS.PROMETHEUS,
|
|
110
|
-
label: 'Metrics',
|
|
111
|
-
path: PATHS.PROMETHEUS,
|
|
112
|
-
icon: renderIcon('LineChartOutlined'),
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
key: KEYS.EVENTS,
|
|
116
|
-
label: 'System Events',
|
|
117
|
-
path: PATHS.EVENTS,
|
|
118
|
-
icon: renderIcon('BellOutlined'),
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
key: KEYS.LOGS,
|
|
122
|
-
label: 'Logs',
|
|
123
|
-
path: PATHS.LOGS,
|
|
124
|
-
icon: renderIcon('FileTextOutlined'),
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
key: KEYS.INCIDENTS,
|
|
128
|
-
label: 'Incidents',
|
|
129
|
-
path: PATHS.INCIDENTS,
|
|
130
|
-
icon: renderIcon('WarningOutlined'),
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
};
|