@wallarm-org/gen-ui 0.0.0-stage → 1.0.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/README.md +153 -2
- package/dist/a2ui/A2uiSurfaces.d.ts +16 -0
- package/dist/a2ui/A2uiSurfaces.js +61 -0
- package/dist/a2ui/catalog.d.ts +16 -0
- package/dist/a2ui/catalog.js +66 -0
- package/dist/a2ui/check.d.ts +4 -0
- package/dist/a2ui/check.js +34 -0
- package/dist/a2ui/express.d.ts +38 -0
- package/dist/a2ui/express.js +64 -0
- package/dist/a2ui/index.d.ts +8 -0
- package/dist/a2ui/index.js +4 -0
- package/dist/a2ui/prompt.d.ts +16 -0
- package/dist/a2ui/prompt.js +17 -0
- package/dist/a2ui/toA2uiSchema.d.ts +19 -0
- package/dist/a2ui/toA2uiSchema.js +61 -0
- package/dist/components/Alert.d.ts +11 -0
- package/dist/components/Alert.js +43 -0
- package/dist/components/AreaChart.d.ts +36 -0
- package/dist/components/AreaChart.js +90 -0
- package/dist/components/Badge.d.ts +11 -0
- package/dist/components/Badge.js +30 -0
- package/dist/components/BarList.d.ts +26 -0
- package/dist/components/BarList.js +66 -0
- package/dist/components/Button.d.ts +10 -0
- package/dist/components/Button.js +40 -0
- package/dist/components/Card.d.ts +2 -0
- package/dist/components/Card.js +17 -0
- package/dist/components/ColumnChart.d.ts +32 -0
- package/dist/components/ColumnChart.js +114 -0
- package/dist/components/Grid.d.ts +29 -0
- package/dist/components/Grid.js +72 -0
- package/dist/components/Heading.d.ts +10 -0
- package/dist/components/Heading.js +29 -0
- package/dist/components/HorizontalBarStack.d.ts +39 -0
- package/dist/components/HorizontalBarStack.js +67 -0
- package/dist/components/LineChart.d.ts +36 -0
- package/dist/components/LineChart.js +101 -0
- package/dist/components/Metric.d.ts +35 -0
- package/dist/components/Metric.js +85 -0
- package/dist/components/PieChart.d.ts +25 -0
- package/dist/components/PieChart.js +83 -0
- package/dist/components/Section.d.ts +5 -0
- package/dist/components/Section.js +39 -0
- package/dist/components/Stack.d.ts +18 -0
- package/dist/components/Stack.js +41 -0
- package/dist/components/Table.d.ts +30 -0
- package/dist/components/Table.js +128 -0
- package/dist/components/Text.d.ts +9 -0
- package/dist/components/Text.js +27 -0
- package/dist/components/index.d.ts +20 -0
- package/dist/components/index.js +55 -0
- package/dist/core/check.d.ts +35 -0
- package/dist/core/check.js +63 -0
- package/dist/core/define.d.ts +64 -0
- package/dist/core/define.js +7 -0
- package/dist/core/format.d.ts +24 -0
- package/dist/core/format.js +74 -0
- package/dist/core/guards.d.ts +2 -0
- package/dist/core/guards.js +2 -0
- package/dist/fixtures/apiInventory.d.ts +36 -0
- package/dist/fixtures/apiInventory.js +287 -0
- package/dist/fixtures/attackSummary.d.ts +13 -0
- package/dist/fixtures/attackSummary.js +329 -0
- package/dist/fixtures/dashboard.d.ts +119 -0
- package/dist/fixtures/dashboard.js +428 -0
- package/dist/fixtures/incident.d.ts +44 -0
- package/dist/fixtures/incident.js +331 -0
- package/dist/fixtures/index.d.ts +13 -0
- package/dist/fixtures/index.js +9 -0
- package/dist/fixtures/liveMonitor.d.ts +9 -0
- package/dist/fixtures/liveMonitor.js +180 -0
- package/dist/fixtures/openui.d.ts +16 -0
- package/dist/fixtures/openui.js +74 -0
- package/dist/fixtures/scenarios.d.ts +13 -0
- package/dist/fixtures/scenarios.js +39 -0
- package/dist/fixtures/stream.d.ts +79 -0
- package/dist/fixtures/stream.js +147 -0
- package/dist/fixtures/weeklyReport.d.ts +46 -0
- package/dist/fixtures/weeklyReport.js +266 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +4 -0
- package/dist/json-render/JsonRenderSurface.d.ts +13 -0
- package/dist/json-render/JsonRenderSurface.js +63 -0
- package/dist/json-render/catalog.d.ts +64 -0
- package/dist/json-render/catalog.js +50 -0
- package/dist/json-render/check.d.ts +4 -0
- package/dist/json-render/check.js +13 -0
- package/dist/json-render/index.d.ts +6 -0
- package/dist/json-render/index.js +4 -0
- package/dist/json-render/spec.d.ts +23 -0
- package/dist/json-render/spec.js +77 -0
- package/dist/openui/OpenUiSurface.d.ts +24 -0
- package/dist/openui/OpenUiSurface.js +30 -0
- package/dist/openui/catalog.d.ts +23 -0
- package/dist/openui/catalog.js +65 -0
- package/dist/openui/check.d.ts +4 -0
- package/dist/openui/check.js +68 -0
- package/dist/openui/index.d.ts +5 -0
- package/dist/openui/index.js +3 -0
- package/dist/playground/GenUiChatDemo.d.ts +11 -0
- package/dist/playground/GenUiChatDemo.js +148 -0
- package/dist/playground/GenUiPlayground.d.ts +15 -0
- package/dist/playground/GenUiPlayground.js +413 -0
- package/dist/playground/index.d.ts +3 -0
- package/dist/playground/index.js +2 -0
- package/dist/playground/useEmulatedAgent.d.ts +37 -0
- package/dist/playground/useEmulatedAgent.js +221 -0
- package/dist/render/ChartSkeleton.d.ts +6 -0
- package/dist/render/ChartSkeleton.js +26 -0
- package/dist/render/GuardedView.d.ts +18 -0
- package/dist/render/GuardedView.js +24 -0
- package/dist/render/Placeholder.d.ts +16 -0
- package/dist/render/Placeholder.js +15 -0
- package/dist/render/SurfaceBoundary.d.ts +15 -0
- package/dist/render/SurfaceBoundary.js +15 -0
- package/dist/render/warn.d.ts +1 -0
- package/dist/render/warn.js +2 -0
- package/package.json +94 -4
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A security dashboard as an agent would build it: the agent sends the layout, with every number
|
|
3
|
+
* bound to a path, and the app fills those paths from its own API. The tree is written once and
|
|
4
|
+
* emitted in both formats, chunk by chunk, so a renderer shows placeholders until a part arrives.
|
|
5
|
+
*/
|
|
6
|
+
import type { GenUiAction } from '../core/define.js';
|
|
7
|
+
import { type Scenario } from './stream.js';
|
|
8
|
+
export declare const DASHBOARD_DATA: {
|
|
9
|
+
traffic: {
|
|
10
|
+
x: string;
|
|
11
|
+
requests: number;
|
|
12
|
+
}[];
|
|
13
|
+
attacks: {
|
|
14
|
+
x: string;
|
|
15
|
+
attacks: number;
|
|
16
|
+
blocked: number;
|
|
17
|
+
}[];
|
|
18
|
+
requestsSpark: {
|
|
19
|
+
x: string;
|
|
20
|
+
y: number;
|
|
21
|
+
}[];
|
|
22
|
+
attacksSpark: {
|
|
23
|
+
x: string;
|
|
24
|
+
y: number;
|
|
25
|
+
}[];
|
|
26
|
+
kpi: {
|
|
27
|
+
requests: number;
|
|
28
|
+
attacks: number;
|
|
29
|
+
blockedPercent: number;
|
|
30
|
+
incidents: number;
|
|
31
|
+
attacksDelta: {
|
|
32
|
+
value: number;
|
|
33
|
+
trend: string;
|
|
34
|
+
sentiment: string;
|
|
35
|
+
};
|
|
36
|
+
incidentsDelta: {
|
|
37
|
+
value: number;
|
|
38
|
+
trend: string;
|
|
39
|
+
sentiment: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
attackTypes: {
|
|
43
|
+
label: string;
|
|
44
|
+
value: number;
|
|
45
|
+
color: string;
|
|
46
|
+
}[];
|
|
47
|
+
endpoints: {
|
|
48
|
+
label: string;
|
|
49
|
+
value: number;
|
|
50
|
+
color: string;
|
|
51
|
+
}[];
|
|
52
|
+
severity: {
|
|
53
|
+
name: string;
|
|
54
|
+
value: number;
|
|
55
|
+
color: string;
|
|
56
|
+
}[];
|
|
57
|
+
threats: {
|
|
58
|
+
ip: string;
|
|
59
|
+
attack: string;
|
|
60
|
+
method: string;
|
|
61
|
+
path: string;
|
|
62
|
+
status: number;
|
|
63
|
+
hits: number;
|
|
64
|
+
last: string;
|
|
65
|
+
}[];
|
|
66
|
+
topIps: string[];
|
|
67
|
+
};
|
|
68
|
+
export declare const DASHBOARD_ACTIONS: readonly GenUiAction[];
|
|
69
|
+
/** Security dashboard: KPI tiles, traffic and attack charts, breakdowns and a threats table. */
|
|
70
|
+
export declare const DASHBOARD_SCENARIO: Scenario;
|
|
71
|
+
export declare const DASHBOARD_A2UI: import("./stream.js").StreamLine<{
|
|
72
|
+
createSurface: {
|
|
73
|
+
surfaceId: string;
|
|
74
|
+
catalogId?: string | undefined;
|
|
75
|
+
metadata?: {
|
|
76
|
+
extensions?: Record<string, unknown> | undefined;
|
|
77
|
+
} | undefined;
|
|
78
|
+
dataModel?: Record<string, any> | undefined;
|
|
79
|
+
components?: any[] | undefined;
|
|
80
|
+
sendDataModel?: boolean | undefined;
|
|
81
|
+
};
|
|
82
|
+
version: "1.0";
|
|
83
|
+
} | {
|
|
84
|
+
updateComponents: {
|
|
85
|
+
surfaceId: string;
|
|
86
|
+
components: any[];
|
|
87
|
+
};
|
|
88
|
+
version: "1.0";
|
|
89
|
+
} | {
|
|
90
|
+
updateDataModel: {
|
|
91
|
+
surfaceId: string;
|
|
92
|
+
path?: string | undefined;
|
|
93
|
+
value?: any;
|
|
94
|
+
};
|
|
95
|
+
version: "1.0";
|
|
96
|
+
} | {
|
|
97
|
+
deleteSurface: {
|
|
98
|
+
surfaceId: string;
|
|
99
|
+
};
|
|
100
|
+
version: "1.0";
|
|
101
|
+
} | {
|
|
102
|
+
callRendererFunction: {
|
|
103
|
+
functionCallId: string;
|
|
104
|
+
surfaceId?: string | undefined;
|
|
105
|
+
callFunction?: any;
|
|
106
|
+
};
|
|
107
|
+
version: "1.0";
|
|
108
|
+
} | {
|
|
109
|
+
agentFunctionResponse: {
|
|
110
|
+
functionCallId: string;
|
|
111
|
+
value?: any;
|
|
112
|
+
error?: {
|
|
113
|
+
code: string;
|
|
114
|
+
message: string;
|
|
115
|
+
} | undefined;
|
|
116
|
+
};
|
|
117
|
+
version: "1.0";
|
|
118
|
+
}>[];
|
|
119
|
+
export declare const DASHBOARD_JSON_RENDER: import("./stream.js").StreamLine<import("@json-render/core").JsonPatch>[];
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
import { bind, node, toStreams } from "./stream.js";
|
|
2
|
+
const wave = (i, base, amp, phase = 0)=>Math.round(base + amp * Math.sin((i + phase) / 3.2) + 0.35 * amp * Math.sin(1.7 * i));
|
|
3
|
+
const window24 = (shift)=>Array.from({
|
|
4
|
+
length: 24
|
|
5
|
+
}, (_, i)=>{
|
|
6
|
+
const hour = i + shift;
|
|
7
|
+
const x = new Date(Date.UTC(2026, 10, 12, hour)).toISOString();
|
|
8
|
+
const requests = wave(hour, 550000, 90000);
|
|
9
|
+
const attacks = wave(hour, 2700, 900, 2);
|
|
10
|
+
return {
|
|
11
|
+
x,
|
|
12
|
+
requests,
|
|
13
|
+
attacks,
|
|
14
|
+
blocked: Math.round(0.957 * attacks)
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
const series = (shift)=>{
|
|
18
|
+
const points = window24(shift);
|
|
19
|
+
return {
|
|
20
|
+
traffic: points.map(({ x, requests })=>({
|
|
21
|
+
x,
|
|
22
|
+
requests
|
|
23
|
+
})),
|
|
24
|
+
attacks: points.map(({ x, attacks, blocked })=>({
|
|
25
|
+
x,
|
|
26
|
+
attacks,
|
|
27
|
+
blocked
|
|
28
|
+
})),
|
|
29
|
+
requestsSpark: points.map(({ x, requests })=>({
|
|
30
|
+
x,
|
|
31
|
+
y: requests
|
|
32
|
+
})),
|
|
33
|
+
attacksSpark: points.map(({ x, attacks })=>({
|
|
34
|
+
x,
|
|
35
|
+
y: attacks
|
|
36
|
+
}))
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const DASHBOARD_DATA = {
|
|
40
|
+
kpi: {
|
|
41
|
+
requests: 13204118,
|
|
42
|
+
attacks: 64204,
|
|
43
|
+
blockedPercent: 95.7,
|
|
44
|
+
incidents: 3,
|
|
45
|
+
attacksDelta: {
|
|
46
|
+
value: 12,
|
|
47
|
+
trend: 'up',
|
|
48
|
+
sentiment: 'negative'
|
|
49
|
+
},
|
|
50
|
+
incidentsDelta: {
|
|
51
|
+
value: 2,
|
|
52
|
+
trend: 'down',
|
|
53
|
+
sentiment: 'positive'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
...series(0),
|
|
57
|
+
attackTypes: [
|
|
58
|
+
{
|
|
59
|
+
label: 'SQL injection',
|
|
60
|
+
value: 14820,
|
|
61
|
+
color: 'red'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: "Cross-site scripting",
|
|
65
|
+
value: 9410,
|
|
66
|
+
color: 'amber'
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: 'BOLA',
|
|
70
|
+
value: 6205,
|
|
71
|
+
color: 'purple'
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
label: 'Brute force',
|
|
75
|
+
value: 4930,
|
|
76
|
+
color: 'blue'
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
endpoints: [
|
|
80
|
+
{
|
|
81
|
+
label: 'POST /api/v2/auth/login',
|
|
82
|
+
value: 11204,
|
|
83
|
+
color: 'red'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
label: 'GET /api/v2/orders/{id}',
|
|
87
|
+
value: 7386,
|
|
88
|
+
color: 'amber'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
label: 'POST /graphql',
|
|
92
|
+
value: 5142,
|
|
93
|
+
color: 'blue'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: 'GET /api/v2/users/{id}',
|
|
97
|
+
value: 3920,
|
|
98
|
+
color: 'slate'
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
severity: [
|
|
102
|
+
{
|
|
103
|
+
name: 'Critical',
|
|
104
|
+
value: 1,
|
|
105
|
+
color: 'red'
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'High',
|
|
109
|
+
value: 1,
|
|
110
|
+
color: 'amber'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'Medium',
|
|
114
|
+
value: 1,
|
|
115
|
+
color: 'blue'
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
threats: [
|
|
119
|
+
{
|
|
120
|
+
ip: '203.0.113.24',
|
|
121
|
+
attack: 'SQL injection',
|
|
122
|
+
method: 'POST',
|
|
123
|
+
path: '/api/v2/auth/login',
|
|
124
|
+
status: 403,
|
|
125
|
+
hits: 4120,
|
|
126
|
+
last: '2026-11-12T22:41:00Z'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
ip: '198.51.100.160',
|
|
130
|
+
attack: 'BOLA',
|
|
131
|
+
method: 'GET',
|
|
132
|
+
path: '/api/v2/orders/100482',
|
|
133
|
+
status: 200,
|
|
134
|
+
hits: 2870,
|
|
135
|
+
last: '2026-11-12T22:36:00Z'
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
ip: '198.51.100.212',
|
|
139
|
+
attack: "Cross-site scripting",
|
|
140
|
+
method: 'POST',
|
|
141
|
+
path: '/search',
|
|
142
|
+
status: 403,
|
|
143
|
+
hits: 1940,
|
|
144
|
+
last: '2026-11-12T22:12:00Z'
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
ip: '203.0.113.5',
|
|
148
|
+
attack: 'Brute force',
|
|
149
|
+
method: 'POST',
|
|
150
|
+
path: '/oauth/token',
|
|
151
|
+
status: 429,
|
|
152
|
+
hits: 1310,
|
|
153
|
+
last: '2026-11-12T21:58:00Z'
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
topIps: [
|
|
157
|
+
'203.0.113.24',
|
|
158
|
+
'198.51.100.160',
|
|
159
|
+
'198.51.100.212'
|
|
160
|
+
]
|
|
161
|
+
};
|
|
162
|
+
const DASHBOARD_ACTIONS = [
|
|
163
|
+
{
|
|
164
|
+
name: 'block_ips',
|
|
165
|
+
description: 'Block the given source IPs (asks the user to approve first).'
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'open_attacks',
|
|
169
|
+
description: 'Open the Attacks page with the given filter.'
|
|
170
|
+
}
|
|
171
|
+
];
|
|
172
|
+
const LAYOUT = [
|
|
173
|
+
[
|
|
174
|
+
node('root', 'Section', {
|
|
175
|
+
title: 'Security dashboard',
|
|
176
|
+
subtitle: 'Last 24 hours · all applications'
|
|
177
|
+
}, [
|
|
178
|
+
'kpis',
|
|
179
|
+
'charts',
|
|
180
|
+
'breakdowns',
|
|
181
|
+
'threats',
|
|
182
|
+
'actions'
|
|
183
|
+
]),
|
|
184
|
+
node('kpis', 'Grid', {
|
|
185
|
+
columns: '4'
|
|
186
|
+
}, [
|
|
187
|
+
'm_requests',
|
|
188
|
+
'm_attacks',
|
|
189
|
+
'm_blocked',
|
|
190
|
+
'm_incidents'
|
|
191
|
+
])
|
|
192
|
+
],
|
|
193
|
+
[
|
|
194
|
+
node('m_requests', 'Metric', {
|
|
195
|
+
title: 'Requests',
|
|
196
|
+
value: bind('/kpi/requests'),
|
|
197
|
+
format: 'compact',
|
|
198
|
+
caption: 'All applications',
|
|
199
|
+
sparkline: bind('/requestsSpark')
|
|
200
|
+
}),
|
|
201
|
+
node('m_attacks', 'Metric', {
|
|
202
|
+
title: 'Attacks',
|
|
203
|
+
value: bind('/kpi/attacks'),
|
|
204
|
+
format: 'compact',
|
|
205
|
+
delta: bind('/kpi/attacksDelta'),
|
|
206
|
+
caption: 'vs the previous 24 hours',
|
|
207
|
+
sparkline: bind('/attacksSpark'),
|
|
208
|
+
sparklineColor: 'negative'
|
|
209
|
+
}),
|
|
210
|
+
node('m_blocked', 'Metric', {
|
|
211
|
+
title: 'Blocked',
|
|
212
|
+
value: bind('/kpi/blockedPercent'),
|
|
213
|
+
format: 'percent',
|
|
214
|
+
caption: 'of attacks'
|
|
215
|
+
}),
|
|
216
|
+
node('m_incidents', 'Metric', {
|
|
217
|
+
title: 'Open incidents',
|
|
218
|
+
value: bind('/kpi/incidents'),
|
|
219
|
+
delta: bind('/kpi/incidentsDelta'),
|
|
220
|
+
caption: 'vs the previous 24 hours'
|
|
221
|
+
})
|
|
222
|
+
],
|
|
223
|
+
[
|
|
224
|
+
node('charts', 'Grid', {
|
|
225
|
+
columns: '2'
|
|
226
|
+
}, [
|
|
227
|
+
'traffic',
|
|
228
|
+
'attack_trend'
|
|
229
|
+
]),
|
|
230
|
+
node('traffic', 'LineChart', {
|
|
231
|
+
title: 'Traffic',
|
|
232
|
+
series: [
|
|
233
|
+
{
|
|
234
|
+
key: 'requests',
|
|
235
|
+
label: 'Requests',
|
|
236
|
+
color: 'brand'
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
points: bind('/traffic'),
|
|
240
|
+
xFormat: 'time',
|
|
241
|
+
yFormat: 'compact'
|
|
242
|
+
}),
|
|
243
|
+
node('attack_trend', 'AreaChart', {
|
|
244
|
+
title: 'Attacks',
|
|
245
|
+
variant: 'standard',
|
|
246
|
+
series: [
|
|
247
|
+
{
|
|
248
|
+
key: 'attacks',
|
|
249
|
+
label: 'Attacks',
|
|
250
|
+
color: 'red'
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
key: 'blocked',
|
|
254
|
+
label: 'Blocked',
|
|
255
|
+
color: 'green'
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
points: bind('/attacks'),
|
|
259
|
+
xFormat: 'time',
|
|
260
|
+
yFormat: 'compact'
|
|
261
|
+
})
|
|
262
|
+
],
|
|
263
|
+
[
|
|
264
|
+
node('breakdowns', 'Grid', {
|
|
265
|
+
columns: '3'
|
|
266
|
+
}, [
|
|
267
|
+
'attack_types',
|
|
268
|
+
'endpoints',
|
|
269
|
+
'severity'
|
|
270
|
+
]),
|
|
271
|
+
node('attack_types', 'PieChart', {
|
|
272
|
+
title: 'Attack types',
|
|
273
|
+
items: bind('/attackTypes'),
|
|
274
|
+
centerLabel: 'attacks',
|
|
275
|
+
format: 'compact'
|
|
276
|
+
}),
|
|
277
|
+
node('endpoints', 'BarList', {
|
|
278
|
+
title: 'Most attacked endpoints',
|
|
279
|
+
items: bind('/endpoints')
|
|
280
|
+
}),
|
|
281
|
+
node('severity', 'HorizontalBarStack', {
|
|
282
|
+
title: 'Incidents by severity',
|
|
283
|
+
value: bind('/kpi/incidents'),
|
|
284
|
+
items: bind('/severity'),
|
|
285
|
+
legend: true
|
|
286
|
+
})
|
|
287
|
+
],
|
|
288
|
+
[
|
|
289
|
+
node('threats', 'Table', {
|
|
290
|
+
title: 'Top threats',
|
|
291
|
+
rowKey: 'ip',
|
|
292
|
+
columns: [
|
|
293
|
+
{
|
|
294
|
+
key: 'ip',
|
|
295
|
+
header: 'Source IP',
|
|
296
|
+
type: 'ip'
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
key: 'attack',
|
|
300
|
+
header: 'Attack',
|
|
301
|
+
type: 'badge'
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
key: 'method',
|
|
305
|
+
header: 'Method',
|
|
306
|
+
type: 'method'
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
key: 'path',
|
|
310
|
+
header: 'Path',
|
|
311
|
+
type: 'code'
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
key: 'status',
|
|
315
|
+
header: 'Status',
|
|
316
|
+
type: 'status'
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
key: 'hits',
|
|
320
|
+
header: 'Hits',
|
|
321
|
+
type: 'number'
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
key: 'last',
|
|
325
|
+
header: 'Last seen',
|
|
326
|
+
type: 'datetime',
|
|
327
|
+
format: 'datetime'
|
|
328
|
+
}
|
|
329
|
+
],
|
|
330
|
+
rows: bind('/threats')
|
|
331
|
+
}),
|
|
332
|
+
node('actions', 'Stack', {
|
|
333
|
+
direction: 'row',
|
|
334
|
+
gap: '8'
|
|
335
|
+
}, [
|
|
336
|
+
'block',
|
|
337
|
+
'open'
|
|
338
|
+
]),
|
|
339
|
+
{
|
|
340
|
+
...node('block', 'Button', {
|
|
341
|
+
label: 'Block the top 3 IPs',
|
|
342
|
+
variant: 'primary',
|
|
343
|
+
destructive: true
|
|
344
|
+
}),
|
|
345
|
+
press: {
|
|
346
|
+
action: 'block_ips',
|
|
347
|
+
params: {
|
|
348
|
+
ips: bind('/topIps')
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
...node('open', 'Button', {
|
|
354
|
+
label: 'Open in Attacks'
|
|
355
|
+
}),
|
|
356
|
+
press: {
|
|
357
|
+
action: 'open_attacks',
|
|
358
|
+
params: {
|
|
359
|
+
filter: 'last:24h'
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
]
|
|
364
|
+
];
|
|
365
|
+
const DASHBOARD_SCENARIO = {
|
|
366
|
+
id: 'security-dashboard',
|
|
367
|
+
prompt: 'Build a security dashboard for the last 24 hours',
|
|
368
|
+
summary: 'KPI tiles with sparklines, traffic and attack charts, breakdowns, a threats table',
|
|
369
|
+
surfaceId: 'security_dashboard',
|
|
370
|
+
actions: DASHBOARD_ACTIONS,
|
|
371
|
+
layout: LAYOUT,
|
|
372
|
+
data: [
|
|
373
|
+
{
|
|
374
|
+
after: 1,
|
|
375
|
+
values: [
|
|
376
|
+
{
|
|
377
|
+
path: '/kpi',
|
|
378
|
+
value: DASHBOARD_DATA.kpi
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
path: '/requestsSpark',
|
|
382
|
+
value: DASHBOARD_DATA.requestsSpark
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
path: '/attacksSpark',
|
|
386
|
+
value: DASHBOARD_DATA.attacksSpark
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
path: '/traffic',
|
|
390
|
+
value: DASHBOARD_DATA.traffic
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
path: '/attacks',
|
|
394
|
+
value: DASHBOARD_DATA.attacks
|
|
395
|
+
}
|
|
396
|
+
]
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
after: 3,
|
|
400
|
+
values: [
|
|
401
|
+
{
|
|
402
|
+
path: '/attackTypes',
|
|
403
|
+
value: DASHBOARD_DATA.attackTypes
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
path: '/endpoints',
|
|
407
|
+
value: DASHBOARD_DATA.endpoints
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
path: '/severity',
|
|
411
|
+
value: DASHBOARD_DATA.severity
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
path: '/threats',
|
|
415
|
+
value: DASHBOARD_DATA.threats
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
path: '/topIps',
|
|
419
|
+
value: DASHBOARD_DATA.topIps
|
|
420
|
+
}
|
|
421
|
+
]
|
|
422
|
+
}
|
|
423
|
+
]
|
|
424
|
+
};
|
|
425
|
+
const streams = toStreams(DASHBOARD_SCENARIO);
|
|
426
|
+
const DASHBOARD_A2UI = streams.a2ui;
|
|
427
|
+
const DASHBOARD_JSON_RENDER = streams.jsonRender;
|
|
428
|
+
export { DASHBOARD_A2UI, DASHBOARD_ACTIONS, DASHBOARD_DATA, DASHBOARD_JSON_RENDER, DASHBOARD_SCENARIO };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Investigating one incident: the agent lays out an alert, KPI tiles, the attempts trend, the
|
|
3
|
+
* top source IPs and the latest requests, every figure bound; the app fills them from its API.
|
|
4
|
+
*/
|
|
5
|
+
import type { GenUiAction } from '../core/define.js';
|
|
6
|
+
import { type Scenario } from './stream.js';
|
|
7
|
+
export declare const INCIDENT_DATA: {
|
|
8
|
+
incident: {
|
|
9
|
+
summary: string;
|
|
10
|
+
};
|
|
11
|
+
kpi: {
|
|
12
|
+
attempts: number;
|
|
13
|
+
uniqueIps: number;
|
|
14
|
+
successfulLogins: number;
|
|
15
|
+
blockedPercent: number;
|
|
16
|
+
attemptsDelta: {
|
|
17
|
+
value: number;
|
|
18
|
+
trend: string;
|
|
19
|
+
sentiment: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
attempts: {
|
|
23
|
+
x: string;
|
|
24
|
+
attempts: number;
|
|
25
|
+
baseline: number;
|
|
26
|
+
}[];
|
|
27
|
+
sourceIps: {
|
|
28
|
+
label: string;
|
|
29
|
+
value: number;
|
|
30
|
+
color: string;
|
|
31
|
+
}[];
|
|
32
|
+
requests: {
|
|
33
|
+
id: string;
|
|
34
|
+
time: string;
|
|
35
|
+
ip: string;
|
|
36
|
+
method: string;
|
|
37
|
+
path: string;
|
|
38
|
+
status: number;
|
|
39
|
+
}[];
|
|
40
|
+
blockIps: string[];
|
|
41
|
+
};
|
|
42
|
+
export declare const INCIDENT_ACTIONS: readonly GenUiAction[];
|
|
43
|
+
/** Incident investigation: an alert, KPI tiles, the attempts trend, top IPs, recent requests. */
|
|
44
|
+
export declare const INCIDENT_SCENARIO: Scenario;
|