yuangs 5.10.0 → 5.11.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/package.json +3 -2
- package/public/index.html +619 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yuangs",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.11.0",
|
|
4
4
|
"description": "苑广山的个人应用集合 CLI(彩色版)",
|
|
5
5
|
"author": "苑广山",
|
|
6
6
|
"license": "ISC",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"main": "dist/cli.js",
|
|
11
11
|
"types": "dist/cli.d.ts",
|
|
12
12
|
"files": [
|
|
13
|
-
"dist"
|
|
13
|
+
"dist",
|
|
14
|
+
"public"
|
|
14
15
|
],
|
|
15
16
|
"scripts": {
|
|
16
17
|
"build": "tsc && chmod +x dist/cli.js",
|
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<title>YUANGS | AI Governance Console</title>
|
|
7
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@5.3.0/css/xterm.css" />
|
|
8
|
+
<link
|
|
9
|
+
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Inter:wght@400;500;600;700&display=swap"
|
|
10
|
+
rel="stylesheet">
|
|
11
|
+
<style>
|
|
12
|
+
:root {
|
|
13
|
+
/* Default: Cyberpunk Dark */
|
|
14
|
+
--bg-color: #09090b;
|
|
15
|
+
--sidebar-bg: #111114;
|
|
16
|
+
--header-bg: rgba(9, 9, 11, 0.8);
|
|
17
|
+
--border-color: #27272a;
|
|
18
|
+
--accent-blue: #3b82f6;
|
|
19
|
+
--text-primary: #f4f4f5;
|
|
20
|
+
--text-secondary: #a1a1aa;
|
|
21
|
+
--danger: #ef4444;
|
|
22
|
+
--success: #10b981;
|
|
23
|
+
--warning: #f59e0b;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* ❄️ Nordic Frost */
|
|
27
|
+
body.theme-nordic {
|
|
28
|
+
--bg-color: #0f172a;
|
|
29
|
+
--sidebar-bg: #1e293b;
|
|
30
|
+
--header-bg: rgba(15, 23, 42, 0.8);
|
|
31
|
+
--border-color: #334155;
|
|
32
|
+
--accent-blue: #38bdf8;
|
|
33
|
+
--text-primary: #f1f5f9;
|
|
34
|
+
--text-secondary: #94a3b8;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* 📜 Solarized Paper */
|
|
38
|
+
body.theme-paper {
|
|
39
|
+
--bg-color: #fdf6e3;
|
|
40
|
+
--sidebar-bg: #eee8d5;
|
|
41
|
+
--header-bg: rgba(253, 246, 227, 0.9);
|
|
42
|
+
--border-color: #d5c4a1;
|
|
43
|
+
--accent-blue: #268bd2;
|
|
44
|
+
--text-primary: #586e75;
|
|
45
|
+
--text-secondary: #839496;
|
|
46
|
+
--term-bg: #fdf6e3;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* 📟 Matrix */
|
|
50
|
+
body.theme-matrix {
|
|
51
|
+
--bg-color: #000000;
|
|
52
|
+
--sidebar-bg: #050505;
|
|
53
|
+
--header-bg: rgba(0, 0, 0, 0.8);
|
|
54
|
+
--border-color: #003b00;
|
|
55
|
+
--accent-blue: #00ff41;
|
|
56
|
+
--text-primary: #00ff41;
|
|
57
|
+
--text-secondary: #008f11;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* 🧛 Dracula */
|
|
61
|
+
body.theme-dracula {
|
|
62
|
+
--bg-color: #282a36;
|
|
63
|
+
--sidebar-bg: #1e1f29;
|
|
64
|
+
--header-bg: rgba(40, 42, 54, 0.8);
|
|
65
|
+
--border-color: #44475a;
|
|
66
|
+
--accent-blue: #bd93f9;
|
|
67
|
+
--text-primary: #f8f8f2;
|
|
68
|
+
--text-secondary: #6272a4;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* 🌑 Solarized Dark */
|
|
72
|
+
body.theme-solarized {
|
|
73
|
+
--bg-color: #002b36;
|
|
74
|
+
--sidebar-bg: #073642;
|
|
75
|
+
--header-bg: rgba(0, 43, 54, 0.8);
|
|
76
|
+
--border-color: #586e75;
|
|
77
|
+
--accent-blue: #268bd2;
|
|
78
|
+
--text-primary: #839496;
|
|
79
|
+
--text-secondary: #586e75;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* 🐈 GitHub Dark */
|
|
83
|
+
body.theme-github {
|
|
84
|
+
--bg-color: #0d1117;
|
|
85
|
+
--sidebar-bg: #161b22;
|
|
86
|
+
--header-bg: rgba(13, 17, 23, 0.8);
|
|
87
|
+
--border-color: #30363d;
|
|
88
|
+
--accent-blue: #58a6ff;
|
|
89
|
+
--text-primary: #c9d1d9;
|
|
90
|
+
--text-secondary: #8b949e;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* 🌙 Dark Mode Scrollbar */
|
|
94
|
+
::-webkit-scrollbar {
|
|
95
|
+
width: 6px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
::-webkit-scrollbar-track {
|
|
99
|
+
background: transparent;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
::-webkit-scrollbar-thumb {
|
|
103
|
+
background: var(--border-color);
|
|
104
|
+
border-radius: 10px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
* {
|
|
108
|
+
box-sizing: border-box;
|
|
109
|
+
transition: background-color 0.3s, border-color 0.3s, color 0.3s;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
body {
|
|
113
|
+
margin: 0;
|
|
114
|
+
background-color: var(--bg-color);
|
|
115
|
+
color: var(--text-primary);
|
|
116
|
+
font-family: 'Inter', sans-serif;
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
height: 100vh;
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Red Flash Overlay */
|
|
124
|
+
#alert-overlay {
|
|
125
|
+
position: fixed;
|
|
126
|
+
inset: 0;
|
|
127
|
+
background: radial-gradient(circle, rgba(239, 68, 68, 0.15) 0%, transparent 70%);
|
|
128
|
+
opacity: 0;
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
z-index: 1000;
|
|
131
|
+
transition: opacity 0.3s;
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
justify-content: center;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
#alert-overlay.active {
|
|
138
|
+
opacity: 1;
|
|
139
|
+
animation: flash-red 0.5s infinite alternate;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@keyframes flash-red {
|
|
143
|
+
from {
|
|
144
|
+
background-color: rgba(239, 68, 68, 0.05);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
to {
|
|
148
|
+
background-color: rgba(239, 68, 68, 0.2);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
#alert-box {
|
|
153
|
+
background: #000;
|
|
154
|
+
border: 2px solid var(--danger);
|
|
155
|
+
padding: 30px 60px;
|
|
156
|
+
border-radius: 4px;
|
|
157
|
+
box-shadow: 0 0 100px rgba(239, 68, 68, 0.5);
|
|
158
|
+
text-align: center;
|
|
159
|
+
transform: scale(0.9);
|
|
160
|
+
transition: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
161
|
+
color: #fff;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
#alert-overlay.active #alert-box {
|
|
165
|
+
transform: scale(1);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.alert-title {
|
|
169
|
+
color: var(--danger);
|
|
170
|
+
font-size: 32px;
|
|
171
|
+
font-weight: 800;
|
|
172
|
+
letter-spacing: 4px;
|
|
173
|
+
margin-bottom: 10px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.alert-sub {
|
|
177
|
+
color: #fff;
|
|
178
|
+
font-size: 14px;
|
|
179
|
+
opacity: 0.8;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* Header */
|
|
183
|
+
header {
|
|
184
|
+
height: 56px;
|
|
185
|
+
padding: 0 20px;
|
|
186
|
+
background: var(--header-bg);
|
|
187
|
+
backdrop-filter: blur(10px);
|
|
188
|
+
border-bottom: 1px solid var(--border-color);
|
|
189
|
+
display: flex;
|
|
190
|
+
align-items: center;
|
|
191
|
+
justify-content: space-between;
|
|
192
|
+
z-index: 100;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.logo-section {
|
|
196
|
+
display: flex;
|
|
197
|
+
align-items: baseline;
|
|
198
|
+
gap: 12px;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.logo {
|
|
202
|
+
font-family: 'JetBrains Mono', monospace;
|
|
203
|
+
font-weight: 800;
|
|
204
|
+
font-size: 22px;
|
|
205
|
+
background: linear-gradient(to right, #60a5fa, #a855f7);
|
|
206
|
+
-webkit-background-clip: text;
|
|
207
|
+
background-clip: text;
|
|
208
|
+
-webkit-text-fill-color: transparent;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.slogan {
|
|
212
|
+
font-size: 13px;
|
|
213
|
+
color: var(--text-secondary);
|
|
214
|
+
font-weight: 500;
|
|
215
|
+
letter-spacing: 0.5px;
|
|
216
|
+
opacity: 0.9;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.header-actions {
|
|
220
|
+
display: flex;
|
|
221
|
+
align-items: center;
|
|
222
|
+
gap: 16px;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.theme-switcher {
|
|
226
|
+
display: flex;
|
|
227
|
+
gap: 4px;
|
|
228
|
+
background: rgba(0, 0, 0, 0.2);
|
|
229
|
+
padding: 4px;
|
|
230
|
+
border-radius: 8px;
|
|
231
|
+
border: 1px solid var(--border-color);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.theme-btn {
|
|
235
|
+
width: 20px;
|
|
236
|
+
height: 20px;
|
|
237
|
+
border-radius: 4px;
|
|
238
|
+
cursor: pointer;
|
|
239
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.theme-btn:hover {
|
|
243
|
+
transform: scale(1.15);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.status-pill {
|
|
247
|
+
display: flex;
|
|
248
|
+
align-items: center;
|
|
249
|
+
gap: 8px;
|
|
250
|
+
font-size: 11px;
|
|
251
|
+
font-weight: 600;
|
|
252
|
+
color: var(--text-secondary);
|
|
253
|
+
background: rgba(39, 39, 42, 0.3);
|
|
254
|
+
padding: 4px 10px;
|
|
255
|
+
border-radius: 99px;
|
|
256
|
+
border: 1px solid var(--border-color);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.dot {
|
|
260
|
+
width: 6px;
|
|
261
|
+
height: 6px;
|
|
262
|
+
border-radius: 50%;
|
|
263
|
+
background: #52525b;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.dot.active {
|
|
267
|
+
background: var(--success);
|
|
268
|
+
box-shadow: 0 0 8px var(--success);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/* Main Layout */
|
|
272
|
+
main {
|
|
273
|
+
flex: 1;
|
|
274
|
+
display: flex;
|
|
275
|
+
overflow: hidden;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Left: Terminal */
|
|
279
|
+
#term-section {
|
|
280
|
+
flex: 1;
|
|
281
|
+
padding: 20px;
|
|
282
|
+
position: relative;
|
|
283
|
+
background: var(--bg-color);
|
|
284
|
+
overflow: hidden;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
#term-container {
|
|
288
|
+
height: 100%;
|
|
289
|
+
border-radius: 8px;
|
|
290
|
+
padding: 0;
|
|
291
|
+
overflow: hidden;
|
|
292
|
+
border: 1px solid var(--border-color);
|
|
293
|
+
background: rgba(0, 0, 0, 0.1);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/* Sidebar */
|
|
297
|
+
#sidebar {
|
|
298
|
+
width: 380px;
|
|
299
|
+
background-color: var(--sidebar-bg);
|
|
300
|
+
border-left: 1px solid var(--border-color);
|
|
301
|
+
display: flex;
|
|
302
|
+
flex-direction: column;
|
|
303
|
+
padding: 24px;
|
|
304
|
+
overflow-y: auto;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.section-title {
|
|
308
|
+
font-size: 10px;
|
|
309
|
+
font-weight: 700;
|
|
310
|
+
color: var(--text-secondary);
|
|
311
|
+
text-transform: uppercase;
|
|
312
|
+
letter-spacing: 1.5px;
|
|
313
|
+
margin-bottom: 20px;
|
|
314
|
+
display: flex;
|
|
315
|
+
align-items: center;
|
|
316
|
+
gap: 8px;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.section-title::after {
|
|
320
|
+
content: '';
|
|
321
|
+
flex: 1;
|
|
322
|
+
height: 1px;
|
|
323
|
+
background: var(--border-color);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.insight-card {
|
|
327
|
+
background: rgba(128, 128, 128, 0.05);
|
|
328
|
+
border: 1px solid var(--border-color);
|
|
329
|
+
border-radius: 12px;
|
|
330
|
+
padding: 20px;
|
|
331
|
+
margin-bottom: 24px;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.scan-line {
|
|
335
|
+
height: 2px;
|
|
336
|
+
background: var(--accent-blue);
|
|
337
|
+
width: 0%;
|
|
338
|
+
margin-top: 10px;
|
|
339
|
+
transition: width 0.4s;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.scan-active .scan-line {
|
|
343
|
+
width: 100%;
|
|
344
|
+
animation: pulse-blue 1s infinite;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
@keyframes pulse-blue {
|
|
348
|
+
0% {
|
|
349
|
+
opacity: 0.4;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
50% {
|
|
353
|
+
opacity: 1;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
100% {
|
|
357
|
+
opacity: 0.4;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/* Decision Badge */
|
|
362
|
+
.risk-badge {
|
|
363
|
+
padding: 4px 12px;
|
|
364
|
+
border-radius: 6px;
|
|
365
|
+
font-size: 11px;
|
|
366
|
+
font-weight: 700;
|
|
367
|
+
display: inline-block;
|
|
368
|
+
margin-bottom: 12px;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.risk-r1 {
|
|
372
|
+
background: rgba(16, 185, 129, 0.1);
|
|
373
|
+
color: var(--success);
|
|
374
|
+
border: 1px solid rgba(16, 185, 129, 0.3);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.risk-r3 {
|
|
378
|
+
background: rgba(239, 68, 68, 0.1);
|
|
379
|
+
color: var(--danger);
|
|
380
|
+
border: 1px solid rgba(239, 68, 68, 0.3);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.decision-title {
|
|
384
|
+
font-size: 16px;
|
|
385
|
+
font-weight: 700;
|
|
386
|
+
margin-bottom: 8px;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.decision-reason {
|
|
390
|
+
font-size: 13px;
|
|
391
|
+
color: var(--text-secondary);
|
|
392
|
+
line-height: 1.6;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/* History List */
|
|
396
|
+
.history-item {
|
|
397
|
+
padding: 12px 0;
|
|
398
|
+
border-bottom: 1px solid #1f1f23;
|
|
399
|
+
display: flex;
|
|
400
|
+
flex-direction: column;
|
|
401
|
+
gap: 4px;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.history-item:last-child {
|
|
405
|
+
border-bottom: none;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.history-cmd {
|
|
409
|
+
font-family: 'JetBrains Mono', monospace;
|
|
410
|
+
font-size: 12px;
|
|
411
|
+
color: var(--accent-blue);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.history-meta {
|
|
415
|
+
font-size: 10px;
|
|
416
|
+
color: #52525b;
|
|
417
|
+
display: flex;
|
|
418
|
+
justify-content: space-between;
|
|
419
|
+
}
|
|
420
|
+
</style>
|
|
421
|
+
</head>
|
|
422
|
+
|
|
423
|
+
<body>
|
|
424
|
+
<div id="alert-overlay">
|
|
425
|
+
<div id="alert-box">
|
|
426
|
+
<div class="alert-title">SECURITY BLOCK</div>
|
|
427
|
+
<div class="alert-sub">Critical command intercepted by AI Governance.</div>
|
|
428
|
+
</div>
|
|
429
|
+
</div>
|
|
430
|
+
|
|
431
|
+
<header>
|
|
432
|
+
<div class="logo-section">
|
|
433
|
+
<div class="logo">YUANGS</div>
|
|
434
|
+
<div class="slogan">AI 驱动的智能治理终端 | AI-Powered Governance Shell</div>
|
|
435
|
+
</div>
|
|
436
|
+
<div class="header-actions">
|
|
437
|
+
<div class="theme-switcher">
|
|
438
|
+
<div class="theme-btn" style="background: #09090b" onclick="setTheme('default')" title="Cyberpunk">
|
|
439
|
+
</div>
|
|
440
|
+
<div class="theme-btn" style="background: #0f172a" onclick="setTheme('nordic')" title="Nordic"></div>
|
|
441
|
+
<div class="theme-btn" style="background: #fdf6e3" onclick="setTheme('paper')" title="Paper"></div>
|
|
442
|
+
<div class="theme-btn" style="background: #00ff41" onclick="setTheme('matrix')" title="Matrix"></div>
|
|
443
|
+
<div class="theme-btn" style="background: #bd93f9" onclick="setTheme('dracula')" title="Dracula"></div>
|
|
444
|
+
<div class="theme-btn" style="background: #002b36" onclick="setTheme('solarized')"
|
|
445
|
+
title="Solarized Dark"></div>
|
|
446
|
+
<div class="theme-btn" style="background: #0d1117" onclick="setTheme('github')" title="GitHub Dark">
|
|
447
|
+
</div>
|
|
448
|
+
</div>
|
|
449
|
+
<div class="status-pill">
|
|
450
|
+
<div id="conn-dot" class="dot"></div>
|
|
451
|
+
<span id="conn-status">WAITING</span>
|
|
452
|
+
</div>
|
|
453
|
+
</div>
|
|
454
|
+
</header>
|
|
455
|
+
|
|
456
|
+
<main>
|
|
457
|
+
<div id="term-section">
|
|
458
|
+
<div id="term-container"></div>
|
|
459
|
+
</div>
|
|
460
|
+
|
|
461
|
+
<aside id="sidebar">
|
|
462
|
+
<div class="section-title">AI Cognitive Process</div>
|
|
463
|
+
<div id="insight-container">
|
|
464
|
+
<div class="insight-card" id="current-scan">
|
|
465
|
+
<div id="scan-label" style="font-size: 12px; color: var(--text-secondary)">Standby Mode</div>
|
|
466
|
+
<div id="scan-cmd"
|
|
467
|
+
style="font-family: 'JetBrains Mono'; font-size: 14px; margin-top: 8px; color: #fff;">-</div>
|
|
468
|
+
<div class="scan-line"></div>
|
|
469
|
+
</div>
|
|
470
|
+
</div>
|
|
471
|
+
|
|
472
|
+
<div id="decision-detail" style="display: none;">
|
|
473
|
+
<div class="insight-card active">
|
|
474
|
+
<div id="risk-pill" class="risk-badge">LEVEL: -</div>
|
|
475
|
+
<div id="dec-title" class="decision-title">-</div>
|
|
476
|
+
<div id="dec-reason" class="decision-reason">-</div>
|
|
477
|
+
<div id="dec-impact"
|
|
478
|
+
style="margin-top: 12px; font-size: 12px; color: var(--danger); display: none;">
|
|
479
|
+
<b>Impact:</b> <span id="dec-impact-text"></span>
|
|
480
|
+
</div>
|
|
481
|
+
</div>
|
|
482
|
+
</div>
|
|
483
|
+
|
|
484
|
+
<div class="section-title">Audit History</div>
|
|
485
|
+
<div id="history-list">
|
|
486
|
+
<!-- Log items will go here -->
|
|
487
|
+
</div>
|
|
488
|
+
</aside>
|
|
489
|
+
</main>
|
|
490
|
+
|
|
491
|
+
<script src="https://cdn.jsdelivr.net/npm/xterm@5.3.0/lib/xterm.js"></script>
|
|
492
|
+
<script src="https://cdn.jsdelivr.net/npm/xterm-addon-fit@0.8.0/lib/xterm-addon-fit.js"></script>
|
|
493
|
+
<script src="/socket.io/socket.io.js"></script>
|
|
494
|
+
|
|
495
|
+
<script>
|
|
496
|
+
const term = new Terminal({
|
|
497
|
+
cursorBlink: true,
|
|
498
|
+
fontFamily: '"JetBrains Mono", monospace',
|
|
499
|
+
fontSize: 14,
|
|
500
|
+
theme: { background: '#09090b00' },
|
|
501
|
+
scrollback: 5000 // Increase scrollback buffer
|
|
502
|
+
});
|
|
503
|
+
const fitAddon = new FitAddon.FitAddon();
|
|
504
|
+
term.loadAddon(fitAddon);
|
|
505
|
+
term.open(document.getElementById('term-container'));
|
|
506
|
+
fitAddon.fit();
|
|
507
|
+
|
|
508
|
+
const socket = io();
|
|
509
|
+
term.onData(data => socket.emit('input', data));
|
|
510
|
+
socket.on('output', data => {
|
|
511
|
+
term.write(data);
|
|
512
|
+
// Auto scroll to bottom
|
|
513
|
+
term.scrollToBottom();
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
// UI Ref Elements
|
|
517
|
+
const scanCard = document.getElementById('current-scan');
|
|
518
|
+
const scanLabel = document.getElementById('scan-label');
|
|
519
|
+
const scanCmd = document.getElementById('scan-cmd');
|
|
520
|
+
const decDetail = document.getElementById('decision-detail');
|
|
521
|
+
const riskPill = document.getElementById('risk-pill');
|
|
522
|
+
const decTitle = document.getElementById('dec-title');
|
|
523
|
+
const decReason = document.getElementById('dec-reason');
|
|
524
|
+
const decImpact = document.getElementById('dec-impact');
|
|
525
|
+
const decImpactText = document.getElementById('dec-impact-text');
|
|
526
|
+
const historyList = document.getElementById('history-list');
|
|
527
|
+
|
|
528
|
+
// AI Evaluating
|
|
529
|
+
socket.on('governance_evaluating', (data) => {
|
|
530
|
+
scanCard.classList.add('scan-active');
|
|
531
|
+
scanLabel.innerText = 'AI Analysis in Progress...';
|
|
532
|
+
scanCmd.innerText = data.command;
|
|
533
|
+
decDetail.style.display = 'none';
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
// AI Decision
|
|
537
|
+
socket.on('governance_decision', (dec) => {
|
|
538
|
+
scanCard.classList.remove('scan-active');
|
|
539
|
+
scanLabel.innerText = 'Audit Complete';
|
|
540
|
+
decDetail.style.display = 'block';
|
|
541
|
+
|
|
542
|
+
decTitle.innerText = dec.allowed ? 'Execution Approved' : 'Execution Denied';
|
|
543
|
+
// Use reasoning for approved commands, reason for denied ones
|
|
544
|
+
decReason.innerText = dec.reasoning || dec.reason || 'No detailed analysis provided.';
|
|
545
|
+
|
|
546
|
+
const riskLevel = dec.riskLevel || (dec.allowed ? 'R1' : 'R3');
|
|
547
|
+
riskPill.className = 'risk-badge risk-' + riskLevel.toLowerCase();
|
|
548
|
+
riskPill.innerText = 'RISK LEVEL: ' + riskLevel;
|
|
549
|
+
|
|
550
|
+
if (!dec.allowed && dec.disclosure) {
|
|
551
|
+
decImpact.style.display = 'block';
|
|
552
|
+
decImpactText.innerText = dec.disclosure.impact;
|
|
553
|
+
} else {
|
|
554
|
+
decImpact.style.display = 'none';
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// Add to history
|
|
558
|
+
const item = document.createElement('div');
|
|
559
|
+
item.className = 'history-item';
|
|
560
|
+
item.innerHTML = `
|
|
561
|
+
<div class="history-cmd">${dec.command || scanCmd.innerText}</div>
|
|
562
|
+
<div class="history-meta">
|
|
563
|
+
<span style="color: ${dec.allowed ? 'var(--success)' : 'var(--danger)'}">${riskLevel}</span>
|
|
564
|
+
<span>${new Date().toLocaleTimeString()}</span>
|
|
565
|
+
</div>
|
|
566
|
+
`;
|
|
567
|
+
historyList.prepend(item);
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
// Alert
|
|
571
|
+
socket.on('governance_alert', () => {
|
|
572
|
+
document.getElementById('alert-overlay').classList.add('active');
|
|
573
|
+
setTimeout(() => {
|
|
574
|
+
document.getElementById('alert-overlay').classList.remove('active');
|
|
575
|
+
}, 3000);
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
// Connection
|
|
579
|
+
socket.on('connect', () => {
|
|
580
|
+
document.getElementById('conn-dot').classList.add('active');
|
|
581
|
+
document.getElementById('conn-status').innerText = 'SECURE CHANNEL';
|
|
582
|
+
term.focus();
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
// --- Theme Management ---
|
|
586
|
+
const themes = {
|
|
587
|
+
default: { background: '#09090b00', foreground: '#f4f4f5', cursor: '#3b82f6' },
|
|
588
|
+
nordic: { background: '#0f172a00', foreground: '#f1f5f9', cursor: '#38bdf8' },
|
|
589
|
+
paper: { background: '#fdf6e300', foreground: '#586e75', cursor: '#268bd2' },
|
|
590
|
+
matrix: { background: '#00000000', foreground: '#00ff41', cursor: '#00ff41' },
|
|
591
|
+
dracula: { background: '#282a3600', foreground: '#f8f8f2', cursor: '#bd93f9' },
|
|
592
|
+
solarized: { background: '#002b3600', foreground: '#839496', cursor: '#268bd2' },
|
|
593
|
+
github: { background: '#0d111700', foreground: '#c9d1d9', cursor: '#58a6ff' }
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
window.setTheme = (themeName) => {
|
|
597
|
+
document.body.className = themeName === 'default' ? '' : 'theme-' + themeName;
|
|
598
|
+
term.options.theme = {
|
|
599
|
+
...term.options.theme,
|
|
600
|
+
...themes[themeName]
|
|
601
|
+
};
|
|
602
|
+
localStorage.setItem('yuangs-theme', themeName);
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
// Restore saved theme
|
|
606
|
+
const savedTheme = localStorage.getItem('yuangs-theme');
|
|
607
|
+
if (savedTheme) setTheme(savedTheme);
|
|
608
|
+
|
|
609
|
+
window.onresize = () => {
|
|
610
|
+
fitAddon.fit();
|
|
611
|
+
const dims = fitAddon.proposeDimensions();
|
|
612
|
+
if (dims) socket.emit('resize', dims);
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
setTimeout(() => fitAddon.fit(), 500);
|
|
616
|
+
</script>
|
|
617
|
+
</body>
|
|
618
|
+
|
|
619
|
+
</html>
|