-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.html
More file actions
1043 lines (997 loc) · 70.1 KB
/
Copy pathapp.html
File metadata and controls
1043 lines (997 loc) · 70.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Enclave Console</title>
<style>
:root{
--bg:#080b11; --bg-elev:#0b0f18; --panel:#0e131f; --panel-2:#121826;
--border:#1d2536; --border-soft:#171e2c;
--text:#e7ecf4; --text-dim:#95a0b4; --text-faint:#647087;
--accent:#5b8cff; --accent-2:#7aa2ff; --accent-ink:#070a10;
--secure:#35d99a; --warn:#f5b544; --danger:#f16d6d;
--mono:'Cascadia Code','JetBrains Mono',Consolas,'SF Mono',monospace;
--sans:'Segoe UI',-apple-system,BlinkMacSystemFont,Roboto,Helvetica,Arial,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--text);font-family:var(--sans);
-webkit-font-smoothing:antialiased;overflow:hidden}
.mono{font-family:var(--mono)}
button{font-family:inherit;cursor:pointer}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:#1e2637;border-radius:8px;border:2px solid var(--bg)}
::-webkit-scrollbar-thumb:hover{background:#2a3448}
/* ---------- LOGIN ---------- */
#login{position:fixed;inset:0;z-index:100;display:grid;place-items:center;
background:radial-gradient(700px 380px at 50% -5%,rgba(91,140,255,.12),transparent 60%),var(--bg)}
.login-card{width:390px;max-width:92vw;border:1px solid var(--border);border-radius:16px;
background:linear-gradient(180deg,#0f1420,#0b0f19);padding:34px;box-shadow:0 40px 100px -50px #000}
.login-brand{display:flex;align-items:center;gap:11px;font-weight:650;font-size:19px;margin-bottom:4px}
.login-brand small{color:var(--text-faint);font-weight:500;font-size:10.5px;letter-spacing:.14em;text-transform:uppercase}
.login-card p.sub{color:var(--text-dim);font-size:14px;margin:0 0 24px}
.field{margin-bottom:14px}
.field label{display:block;font-size:12.5px;color:var(--text-dim);margin-bottom:6px;font-weight:600}
.field select,.field input{width:100%;background:#0a0e17;border:1px solid var(--border);color:var(--text);
border-radius:9px;padding:11px 13px;font-size:14px;font-family:inherit}
.field select:focus,.field input:focus{outline:none;border-color:var(--accent)}
.sso{width:100%;display:flex;align-items:center;justify-content:center;gap:10px;background:var(--accent);
color:var(--accent-ink);font-weight:650;border:none;border-radius:9px;padding:13px;font-size:15px;margin-top:8px}
.sso:hover{background:var(--accent-2)}
.login-foot{margin-top:18px;text-align:center;font-size:12px;color:var(--text-faint)}
.login-foot .lock{color:var(--secure)}
/* ---------- APP SHELL ---------- */
#app{display:none;grid-template-columns:264px 1fr 340px;grid-template-rows:52px 1fr;height:100vh}
#app.on{display:grid}
.topbar{grid-column:1/4;display:flex;align-items:center;gap:16px;padding:0 16px;
border-bottom:1px solid var(--border-soft);background:var(--bg-elev)}
.topbar .brand{display:flex;align-items:center;gap:9px;font-weight:650;font-size:15px}
.topbar .brand small{color:var(--text-faint);font-weight:500;font-size:9.5px;letter-spacing:.14em;text-transform:uppercase}
.ws-pill{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--text-dim);
border:1px solid var(--border);border-radius:7px;padding:5px 11px;font-family:var(--mono)}
.ws-pill .dot{width:7px;height:7px;border-radius:50%;background:var(--secure);box-shadow:0 0 0 3px rgba(53,217,154,.16)}
.top-right{margin-left:auto;display:flex;align-items:center;gap:10px}
.icon-btn{width:32px;height:32px;display:grid;place-items:center;border:1px solid var(--border);
border-radius:8px;background:transparent;color:var(--text-dim);font-size:14px}
.icon-btn:hover{color:var(--text);border-color:#2c3650}
.clear-chip{display:flex;align-items:center;gap:7px;font-family:var(--mono);font-size:11.5px;
border:1px solid rgba(53,217,154,.32);color:var(--secure);border-radius:7px;padding:5px 10px}
/* ---------- SIDEBAR ---------- */
.side{grid-row:2;border-right:1px solid var(--border-soft);background:var(--bg-elev);
display:flex;flex-direction:column;overflow:hidden}
.side-scroll{overflow-y:auto;padding:14px 12px;flex:1}
.side h4{font-size:11px;letter-spacing:.13em;text-transform:uppercase;color:var(--text-faint);
margin:16px 6px 8px;font-weight:700}
.side h4:first-child{margin-top:4px}
.ws{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:9px;color:var(--text-dim);
font-size:13.5px;cursor:pointer;border:1px solid transparent}
.ws:hover{background:var(--panel)}
.ws.active{background:var(--panel-2);color:var(--text);border-color:var(--border)}
.ws .wi{width:22px;height:22px;border-radius:6px;display:grid;place-items:center;font-size:12px;
background:rgba(91,140,255,.12);flex:0 0 auto}
.ws .meta{overflow:hidden}
.ws .meta .nm{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:550}
.ws .meta .sm{font-size:11px;color:var(--text-faint);font-family:var(--mono)}
.newws{margin:6px;display:flex;align-items:center;justify-content:center;gap:8px;padding:10px;
border:1px dashed var(--border);border-radius:9px;color:var(--text-dim);font-size:13px;background:transparent;width:calc(100% - 12px)}
.newws:hover{border-color:var(--accent);color:var(--text)}
/* profile card */
.profile{border-top:1px solid var(--border-soft);padding:13px;background:var(--panel)}
.pf-row{display:flex;align-items:center;gap:11px;cursor:pointer;border-radius:9px;padding:6px}
.pf-row:hover{background:var(--panel-2)}
.avatar{width:38px;height:38px;border-radius:9px;flex:0 0 auto;display:grid;place-items:center;
font-weight:700;color:#0a0e17;background:linear-gradient(135deg,#7aa2ff,#5b8cff)}
.pf-row .nm{font-weight:600;font-size:14px}
.pf-row .rl{font-size:11.5px;color:var(--text-faint)}
.pf-badges{display:flex;gap:6px;flex-wrap:wrap;margin-top:11px}
.badge{font-family:var(--mono);font-size:10.5px;padding:3px 8px;border-radius:6px;border:1px solid var(--border)}
.badge.clr{color:var(--secure);border-color:rgba(53,217,154,.3);background:rgba(53,217,154,.06)}
.badge.lic{color:var(--accent-2);border-color:rgba(91,140,255,.3);background:rgba(91,140,255,.06)}
/* ---------- CHAT ---------- */
.chat{grid-row:2;display:flex;flex-direction:column;overflow:hidden;background:var(--bg);position:relative}
.drop-overlay{position:absolute;inset:0;z-index:40;display:none;place-items:center;
background:rgba(10,13,19,.86);backdrop-filter:blur(3px);border:2px dashed var(--accent);border-radius:12px;margin:10px}
.drop-overlay.on{display:grid}
.drop-inner{text-align:center;color:var(--accent-2);font-weight:650;font-size:17px}
.drop-inner span{display:block;margin-top:6px;font-weight:400;font-size:13px;color:var(--text-dim)}
.attached-strip{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:8px}
.attached-strip:empty{display:none}
.achip{display:flex;align-items:center;gap:8px;border:1px solid var(--border);border-radius:8px;
padding:5px 9px;font-size:12px;background:var(--panel-2);color:var(--text-dim)}
.achip .fx{color:var(--secure)} .achip .fn{color:var(--text)} .achip .fz{color:var(--text-faint);font-family:var(--mono);font-size:11px}
.achip .rm{cursor:pointer;color:var(--text-faint);margin-left:2px} .achip .rm:hover{color:var(--danger)}
.tool-group{margin-bottom:16px}
.tool-group .tg-h{font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--text-faint);font-weight:700;margin:0 0 9px;display:flex;align-items:center;gap:8px}
.tool-row{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--border-soft);border-radius:9px;margin-bottom:6px;background:var(--panel-2)}
.tool-row .tn{font-weight:600;font-size:13px}
.tool-row .tp{color:var(--text-dim);font-size:12px}
.tool-row .meta{margin-left:auto;display:flex;align-items:center;gap:8px;flex:0 0 auto}
.gate{font-family:var(--mono);font-size:10px;padding:2px 7px;border-radius:5px;border:1px solid var(--border)}
.gate.t0{color:var(--secure);border-color:rgba(53,217,154,.3)}
.gate.t1{color:var(--warn);border-color:rgba(245,181,68,.3)}
.gate.t2{color:var(--danger);border-color:rgba(241,109,109,.35)}
.tool-row.locked{opacity:.55}
.lockmsg{font-family:var(--mono);font-size:10px;color:var(--text-faint)}
.chat-scroll{flex:1;overflow-y:auto;padding:26px 0}
.cc{max-width:760px;margin:0 auto;padding:0 26px}
.msg{display:flex;gap:14px;margin-bottom:26px}
.msg .who{width:30px;height:30px;border-radius:8px;flex:0 0 auto;display:grid;place-items:center;
font-size:12px;font-weight:700}
.msg.user .who{background:linear-gradient(135deg,#7aa2ff,#5b8cff);color:#0a0e17}
.msg.ai .who{background:#101725;border:1px solid var(--border);color:var(--accent-2)}
.msg .body{flex:1;padding-top:3px}
.msg .name{font-size:12.5px;color:var(--text-faint);margin-bottom:5px;font-weight:600}
.msg .content{font-size:15px;line-height:1.65;color:var(--text)}
.msg .content p{margin:0 0 10px}
.msg .content code{font-family:var(--mono);font-size:13px;background:#101725;border:1px solid var(--border-soft);
padding:1px 6px;border-radius:5px;color:#cdd7ea}
.msg .content .pre{font-family:var(--mono);font-size:12.5px;background:#0a0e17;border:1px solid var(--border);
border-radius:9px;padding:13px 15px;margin:10px 0;color:#cdd7ea;white-space:pre-wrap;overflow-x:auto;line-height:1.6}
.notice{border-radius:9px;padding:11px 13px;font-size:13.5px;margin:10px 0;display:flex;gap:10px;align-items:flex-start}
.notice.block{background:rgba(241,109,109,.07);border:1px solid rgba(241,109,109,.28);color:#f3a6a6}
.notice.allow{background:rgba(53,217,154,.06);border:1px solid rgba(53,217,154,.26);color:#9be9c8}
.notice .ni{font-size:14px;line-height:1.3}
.msg .content .cite{font-family:var(--mono);font-size:11.5px;color:var(--text-faint);margin-top:6px}
.welcome{max-width:760px;margin:8vh auto 0;padding:0 26px;text-align:center}
.welcome .wm{width:52px;height:52px;margin:0 auto 18px;border-radius:13px;display:grid;place-items:center;
background:rgba(91,140,255,.1);border:1px solid rgba(91,140,255,.24)}
.welcome h2{font-size:24px;margin:0 0 8px;letter-spacing:-.01em}
.welcome p{color:var(--text-dim);font-size:15px;margin:0 auto 26px;max-width:520px}
.chips{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
.chip{border:1px solid var(--border);border-radius:10px;padding:11px 14px;font-size:13.5px;color:var(--text-dim);
background:var(--panel);text-align:left;max-width:240px}
.chip:hover{border-color:var(--accent);color:var(--text)}
.chip b{display:block;color:var(--text);font-weight:600;font-size:13.5px;margin-bottom:2px}
/* composer */
.composer{border-top:1px solid var(--border-soft);padding:16px 26px 20px;background:var(--bg-elev)}
.composer-in{max-width:760px;margin:0 auto}
.cbox{border:1px solid var(--border);border-radius:13px;background:var(--panel);padding:12px 14px;
display:flex;flex-direction:column;gap:10px}
.cbox:focus-within{border-color:#33456e;box-shadow:0 0 0 3px rgba(91,140,255,.1)}
.cbox textarea{width:100%;background:transparent;border:none;color:var(--text);font-family:inherit;
font-size:15px;resize:none;outline:none;line-height:1.5;max-height:160px}
.cbox-bar{display:flex;align-items:center;gap:10px}
.attach{display:flex;align-items:center;gap:7px;font-size:12px;color:var(--text-faint);font-family:var(--mono);
border:1px solid var(--border);border-radius:7px;padding:5px 9px;background:transparent}
.attach:hover{color:var(--text-dim)}
.send{margin-left:auto;width:34px;height:34px;border-radius:9px;border:none;background:var(--accent);
color:var(--accent-ink);font-size:16px;display:grid;place-items:center}
.send:hover{background:var(--accent-2)}
.send:disabled{opacity:.4;cursor:not-allowed}
.model-pick{font-family:var(--mono);font-size:11.5px;color:var(--text-dim);background:var(--panel-2);
border:1px solid var(--border);border-radius:7px;padding:5px 8px;cursor:pointer;outline:none}
.model-pick:hover{color:var(--text);border-color:var(--border-strong,var(--accent))}
.ctx-meter{font-family:var(--mono);font-size:11px;color:var(--text-faint);white-space:nowrap}
.ctx-meter b{color:var(--text-dim);font-weight:600}
.ctx-meter.warn b{color:var(--warn)}
.composer-note{text-align:center;font-size:11.5px;color:var(--text-faint);margin-top:10px;font-family:var(--mono)}
/* ---------- RIGHT: SANDBOX ---------- */
.sandbox{grid-row:2;border-left:1px solid var(--border-soft);background:var(--bg-elev);
display:flex;flex-direction:column;overflow:hidden}
.sb-scroll{overflow-y:auto;padding:16px;flex:1}
.sb-head{display:flex;align-items:center;gap:9px;margin-bottom:4px}
.sb-head h3{font-size:13px;margin:0;letter-spacing:.04em}
.sb-head .pulse{width:8px;height:8px;border-radius:50%;background:var(--secure);
box-shadow:0 0 0 0 rgba(53,217,154,.5);animation:pulse 2s infinite}
@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(53,217,154,.4)}70%{box-shadow:0 0 0 8px rgba(53,217,154,0)}100%{box-shadow:0 0 0 0 rgba(53,217,154,0)}}
.sb-card{border:1px solid var(--border-soft);border-radius:11px;background:var(--panel);padding:14px;margin-bottom:12px}
.sb-card .lbl{font-size:10.5px;letter-spacing:.13em;text-transform:uppercase;color:var(--text-faint);font-weight:700;margin-bottom:11px}
.kv{display:flex;justify-content:space-between;align-items:center;font-size:12.5px;padding:5px 0;font-family:var(--mono)}
.kv .k{color:var(--text-dim)}
.kv .v{color:var(--text)}
.kv .v.ok{color:var(--secure)}.kv .v.warn{color:var(--warn)}.kv .v.dan{color:var(--danger)}
.meter{height:5px;border-radius:4px;background:#0a0e17;overflow:hidden;margin-top:3px}
.meter i{display:block;height:100%;background:var(--accent)}
.egress-row{display:flex;align-items:center;gap:8px;font-family:var(--mono);font-size:11.5px;padding:5px 0}
.egress-row .st{width:6px;height:6px;border-radius:50%}
.egress-row .st.deny{background:var(--danger)}
.egress-row .st.allow{background:var(--secure)}
.egress-row .host{color:var(--text-dim)}
.egress-row .tag{margin-left:auto;color:var(--text-faint);font-size:10.5px}
.log{font-family:var(--mono);font-size:11px;line-height:1.7;max-height:220px;overflow-y:auto}
.log .ln{display:flex;gap:8px;padding:2px 0;border-bottom:1px solid rgba(255,255,255,.03)}
.log .ts{color:var(--text-faint);flex:0 0 auto}
.log .ev{color:var(--text-dim)}
.log .ev.ok{color:var(--secure)}.log .ev.warn{color:var(--warn)}.log .ev.dan{color:var(--danger)}
.sb-foot{border-top:1px solid var(--border-soft);padding:12px 16px;display:flex;gap:8px}
.sb-foot button{flex:1;font-size:12.5px;padding:9px;border-radius:8px;border:1px solid var(--border);
background:transparent;color:var(--text-dim)}
.sb-foot button:hover{color:var(--text);border-color:#2c3650}
.sb-foot button.danger:hover{color:var(--danger);border-color:rgba(241,109,109,.4)}
/* ---------- PROFILE MODAL ---------- */
.modal-bg{position:fixed;inset:0;z-index:90;background:rgba(4,6,10,.68);backdrop-filter:blur(3px);
display:none;place-items:center}
.modal-bg.on{display:grid}
.modal{width:520px;max-width:94vw;max-height:88vh;overflow-y:auto;border:1px solid var(--border);
border-radius:16px;background:var(--panel);box-shadow:0 40px 100px -50px #000}
.modal-h{display:flex;align-items:center;gap:14px;padding:22px;border-bottom:1px solid var(--border-soft)}
.modal-h .avatar{width:52px;height:52px;border-radius:12px;font-size:18px}
.modal-h .nm{font-size:18px;font-weight:650}
.modal-h .rl{color:var(--text-dim);font-size:13.5px}
.modal-h .x{margin-left:auto;width:32px;height:32px;border-radius:8px;border:1px solid var(--border);
background:transparent;color:var(--text-dim);font-size:16px}
.modal-b{padding:22px}
.mrow{display:flex;justify-content:space-between;gap:16px;padding:11px 0;border-bottom:1px solid var(--border-soft);font-size:14px}
.mrow:last-child{border:none}
.mrow .mk{color:var(--text-dim)}
.mrow .mv{color:var(--text);text-align:right;font-weight:550}
.mrow .mv .badge{margin-left:6px}
.ai-note{margin-top:18px;border-radius:10px;border:1px solid rgba(91,140,255,.24);
background:rgba(91,140,255,.05);padding:13px 15px;font-size:12.5px;color:var(--text-dim);line-height:1.6}
.ai-note b{color:var(--accent-2)}
.enf-note{margin-top:10px;border-radius:10px;border:1px solid var(--border-soft);
padding:13px 15px;font-size:12.5px;color:var(--text-dim);line-height:1.6}
.enf-note b{color:var(--secure)}
.np-h{font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--text-faint);font-weight:700;margin:2px 0 9px}
.preset-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-bottom:14px}
.preset-card{text-align:left;border:1px solid var(--border);border-radius:10px;padding:12px;background:var(--panel);color:var(--text);cursor:pointer;transition:.14s;font-family:inherit}
.preset-card:hover{border-color:#2c3650}
.preset-card.sel{border-color:var(--accent);box-shadow:0 0 0 1px rgba(91,140,255,.3)}
.preset-card .pc-ic{font-size:17px;margin-bottom:6px}
.preset-card .pc-t{font-weight:600;font-size:13.5px}
.preset-card .pc-g{font-size:11px;color:var(--text-faint);font-family:var(--mono);margin-top:4px}
.anchor-card{border:1px solid rgba(53,217,154,.3);background:rgba(53,217,154,.05);border-radius:11px;padding:14px 16px;margin-bottom:14px}
.anchor-card .ac-lbl{font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--text-faint);font-weight:700;margin-right:8px}
.anchor-card .ac-badges{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}
.audit-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:14px}
.astat{border:1px solid var(--border-soft);border-radius:10px;padding:12px;text-align:center;background:var(--panel-2)}
.astat .an{font-size:22px;font-weight:700}
.astat .al{font-size:11px;color:var(--text-faint);margin-top:2px}
.audit-table-wrap{max-height:270px;overflow-y:auto;border:1px solid var(--border-soft);border-radius:10px}
.audit-table{width:100%;border-collapse:collapse;font-size:12.5px}
.audit-table th{position:sticky;top:0;background:var(--panel-2);text-align:left;padding:9px 12px;color:var(--text-faint);font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;border-bottom:1px solid var(--border-soft)}
.audit-table td{padding:8px 12px;border-bottom:1px solid rgba(255,255,255,.03);color:var(--text-dim)}
.audit-table .mono{font-family:var(--mono);font-size:11.5px;color:var(--text-dim)}
.rz{font-family:var(--mono);font-size:10.5px;padding:2px 7px;border-radius:5px;border:1px solid var(--border);color:var(--text-faint)}
.rz.ok{color:var(--secure);border-color:rgba(53,217,154,.3)}
.rz.dan{color:var(--danger);border-color:rgba(241,109,109,.3)}
.rz.warn{color:var(--warn);border-color:rgba(245,181,68,.3)}
@media(max-width:1080px){#app{grid-template-columns:230px 1fr}.sandbox{display:none}}
@media(max-width:720px){#app{grid-template-columns:1fr}.side{display:none}}
</style>
</head>
<body>
<!-- ===================== LOGIN ===================== -->
<div id="login">
<div class="login-card">
<div class="login-brand">
<svg width="26" height="26" viewBox="0 0 32 32" fill="none">
<path d="M16 3.2 L27 8 V16.5 C27 23 22.2 27.4 16 29.2 C9.8 27.4 5 23 5 16.5 V8 Z" stroke="#5b8cff" stroke-width="1.6" fill="rgba(91,140,255,.06)"/>
<path d="M16 10 L21.5 13 V17.6 C21.5 20.8 19 22.9 16 23.9 C13 22.9 10.5 20.8 10.5 17.6 V13 Z" stroke="#7aa2ff" stroke-width="1.4"/>
<circle cx="16" cy="16.4" r="1.7" fill="#35d99a"/>
</svg>
Enclave <small>secure ai</small>
</div>
<p class="sub">Sign in to your isolated workspace.</p>
<div class="field">
<label>Identity (demo — pick a persona)</label>
<select id="persona">
<option value="ir">Dana Okoye · IR Analyst · Clearance L3</option>
<option value="red">Marcus Vale · Red Team Lead · Clearance L4</option>
<option value="grc">Priya Nair · GRC Auditor · Clearance L2</option>
<option value="jr">Sam Reeve · SOC Analyst (Junior) · Clearance L1</option>
<option value="lead">Alex Chen · Security Lead · Clearance L5 (all-access)</option>
</select>
</div>
<div class="field">
<label>Organization</label>
<input value="acme-security.io" readonly />
</div>
<button class="sso" onclick="doLogin()">
<span>◈</span> Continue with Acme SSO
</button>
<div class="login-foot"><span class="lock">🔒</span> Identity is signed & verified server-side · demo build, no real auth</div>
</div>
</div>
<!-- ===================== APP ===================== -->
<div id="app">
<!-- topbar -->
<div class="topbar">
<div class="brand">
<svg width="22" height="22" viewBox="0 0 32 32" fill="none">
<path d="M16 3.2 L27 8 V16.5 C27 23 22.2 27.4 16 29.2 C9.8 27.4 5 23 5 16.5 V8 Z" stroke="#5b8cff" stroke-width="1.6" fill="rgba(91,140,255,.06)"/>
<circle cx="16" cy="16.4" r="1.7" fill="#35d99a"/>
</svg>
Enclave <small>console</small>
</div>
<div class="ws-pill"><span class="dot"></span> <span id="topWs">incident-2231</span></div>
<select id="toolchainPick" class="model-pick" onchange="pickToolchain(this.value)" title="Active toolchain — the sealed image whose tools run in this engagement. Switch freely: your workspace is SHARED across toolchains (build in one, test in another), and every action stays gated by your clearance + certifications.">
<option value="incident-response">🛡 IR / forensics</option>
<option value="red-team">🧪 red-team</option>
<option value="tool-dev">🔧 tool-dev</option>
<option value="code-review">◧ code-review</option>
<option value="grc-audit">📄 grc-audit</option>
</select>
<div class="top-right">
<div class="clear-chip">◈ <span id="topClear">L3</span> · ISOLATED</div>
<button class="icon-btn" title="Audit ledger" onclick="openAudit()">📜</button>
<button class="icon-btn" title="Attach Claude CLI" onclick="toast('Claude CLI attached to this enclave')">◧</button>
<button class="icon-btn" title="Sign out" onclick="signOut()">⏻</button>
</div>
</div>
<!-- sidebar -->
<aside class="side">
<div class="side-scroll">
<button class="newws" onclick="openNewEnclave()">+ New enclave</button>
<h4>Active enclaves</h4>
<div id="activeEnclaves">
<div class="ws active"><div class="wi">🛡️</div><div class="meta"><div class="nm">incident-2231</div><div class="sm">IR · egress deny-all</div></div></div>
<div class="ws"><div class="wi">🔎</div><div class="meta"><div class="nm">malware-triage</div><div class="sm">isolated · 2 tools</div></div></div>
<div class="ws"><div class="wi">🧪</div><div class="meta"><div class="nm">pentest-northwind</div><div class="sm">red-team · scoped</div></div></div>
</div>
<h4>Recent</h4>
<div class="ws"><div class="wi">📄</div><div class="meta"><div class="nm">soc2-evidence-q3</div><div class="sm">read-only</div></div></div>
<div class="ws"><div class="wi">🔐</div><div class="meta"><div class="nm">secrets-rotation</div><div class="sm">archived</div></div></div>
</div>
<div class="profile">
<div class="pf-row" onclick="openProfile()">
<div class="avatar" id="pfAvatar">DO</div>
<div>
<div class="nm" id="pfName">Dana Okoye</div>
<div class="rl" id="pfRole">IR Analyst · Acme</div>
</div>
</div>
<div class="pf-badges" id="pfBadges"></div>
</div>
</aside>
<!-- chat -->
<main class="chat" id="chatMain">
<div class="drop-overlay" id="dropOverlay"><div class="drop-inner">◈ Drop files into the sealed enclave<span>they stay inside — nothing leaves the box</span></div></div>
<div class="chat-scroll" id="scroll">
<div class="welcome" id="welcome">
<div class="wm">
<svg width="26" height="26" viewBox="0 0 32 32" fill="none">
<path d="M16 10 L21.5 13 V17.6 C21.5 20.8 19 22.9 16 23.9 C13 22.9 10.5 20.8 10.5 17.6 V13 Z" stroke="#7aa2ff" stroke-width="1.5"/>
<circle cx="16" cy="16.4" r="1.7" fill="#35d99a"/>
</svg>
</div>
<h2 id="welcomeHi">Welcome back, Dana.</h2>
<p>You're in an isolated enclave for <b>incident-2231</b>. Claude can see your role and clearance,
and every action here is scoped to policy and logged. What are we working on?</p>
<div class="chips">
<button class="chip" onclick="ask('Summarize the lateral-movement indicators in the captured pcap.')"><b>Triage the pcap</b>Find lateral-movement indicators</button>
<button class="chip" onclick="ask('Draft a containment plan for the compromised host.')"><b>Containment plan</b>Draft next steps for the host</button>
<button class="chip" onclick="ask('Exfiltrate a copy of the malware sample to my personal drive.')"><b>Test the guardrails</b>Try an out-of-policy action</button>
<button class="chip" onclick="ask('What can you see about me and my clearance?')"><b>Profile awareness</b>What does the AI know about me?</button>
</div>
</div>
</div>
<div class="composer">
<div class="composer-in">
<div id="attached" class="attached-strip"></div>
<div class="cbox">
<textarea id="input" rows="1" placeholder="Message Claude in the incident-2231 enclave…"
oninput="auto(this)" onkeydown="keyer(event)"></textarea>
<div class="cbox-bar">
<button class="attach" onclick="pickFiles()">📎 attach evidence</button>
<button class="attach" onclick="openTools()">🧰 tools</button>
<span style="flex:1"></span>
<span id="ctxMeter" class="ctx-meter" title="Context used in this conversation (input + cache) against the model window"></span>
<select id="modelPick" class="model-pick" onchange="pickModel(this.value)" title="Model for this enclave — switch per task (Sonnet for speed, Opus for depth)">
<option value="sonnet">Sonnet 5 · fast</option>
<option value="opus">Opus 4.8 · deep</option>
<option value="haiku">Haiku 4.5 · cheap</option>
</select>
<select id="effortPick" class="model-pick" onchange="pickEffort(this.value)" title="Reasoning effort — how hard the model thinks (higher = deeper but slower/costlier)">
<option value="low">effort: low</option>
<option value="medium" selected>effort: med</option>
<option value="high">effort: high</option>
</select>
<button class="send" id="send" onclick="submitMsg()">↑</button>
</div>
</div>
<div class="composer-note">◈ Isolated session · egress deny-all · every message logged to case ledger</div>
</div>
</div>
<input type="file" id="fileInput" multiple style="display:none" onchange="handleFiles(this.files)">
</main>
<!-- sandbox panel -->
<aside class="sandbox">
<div class="sb-scroll">
<div class="sb-card">
<div class="sb-head"><span class="pulse"></span><h3>Enclave status</h3></div>
<div class="kv"><span class="k">Session</span><span class="v mono">#4471</span></div>
<div class="kv"><span class="k">Isolation</span><span class="v ok">micro-VM · sealed</span></div>
<div class="kv"><span class="k">Operator</span><span class="v" id="sbOperator">Dana Okoye</span></div>
<div class="kv"><span class="k">Clearance</span><span class="v ok" id="sbClear">L3</span></div>
<div class="kv"><span class="k">Uptime</span><span class="v mono" id="sbUptime">00:00:07</span></div>
</div>
<div class="sb-card">
<div class="lbl">Resource envelope</div>
<div class="kv"><span class="k">vCPU</span><span class="v" id="cpuV">18%</span></div>
<div class="meter"><i id="cpuBar" style="width:18%"></i></div>
<div class="kv" style="margin-top:9px"><span class="k">Memory</span><span class="v" id="memV">1.4 / 4 GB</span></div>
<div class="meter"><i id="memBar" style="width:35%;background:#7aa2ff"></i></div>
</div>
<div class="sb-card">
<div class="lbl">Egress firewall · deny-all</div>
<div class="egress-row"><span class="st allow"></span><span class="host">api.anthropic.com</span><span class="tag">allow · model</span></div>
<div class="egress-row"><span class="st allow"></span><span class="host">case-ledger.internal</span><span class="tag">allow · audit</span></div>
<div class="egress-row"><span class="st deny"></span><span class="host">*.public-cloud.net</span><span class="tag">deny</span></div>
<div class="egress-row"><span class="st deny"></span><span class="host">pastebin.com</span><span class="tag">deny</span></div>
<div class="egress-row"><span class="st deny"></span><span class="host">personal-drive.io</span><span class="tag">blocked ×1</span></div>
</div>
<div class="sb-card">
<div class="sb-head" style="margin-bottom:11px"><h3 style="font-size:11px;letter-spacing:.13em;text-transform:uppercase;color:var(--text-faint);font-weight:700">Audit ledger · live</h3></div>
<div class="log" id="log"></div>
</div>
</div>
<div class="sb-foot">
<button onclick="toast('Ledger exported (SOC 2 / ISO 27001 format)')">⇩ Export trail</button>
<button class="danger" onclick="destroyEnclave()">⨂ Tear down</button>
</div>
</aside>
</div>
<!-- ===================== PROFILE MODAL ===================== -->
<div class="modal-bg" id="modal" onclick="if(event.target===this)closeProfile()">
<div class="modal">
<div class="modal-h">
<div class="avatar" id="mAvatar">DO</div>
<div>
<div class="nm" id="mName">Dana Okoye</div>
<div class="rl" id="mRole">Incident Response Analyst</div>
</div>
<button class="x" onclick="closeProfile()">✕</button>
</div>
<div class="modal-b">
<div class="mrow"><span class="mk">Organization</span><span class="mv">Acme Security · acme-security.io</span></div>
<div class="mrow"><span class="mk">Team</span><span class="mv" id="mTeam">Incident Response (IR)</span></div>
<div class="mrow"><span class="mk">Clearance level</span><span class="mv"><span id="mClearTxt">L3 — Restricted</span><span class="badge clr" id="mClearBadge">◈ L3</span></span></div>
<div class="mrow"><span class="mk">Licenses & certs</span><span class="mv" id="mLicenses"></span></div>
<div class="mrow"><span class="mk">Authorized scopes</span><span class="mv" id="mScopes"></span></div>
<div class="mrow"><span class="mk">Identity source</span><span class="mv">Acme SSO · signed & verified</span></div>
<div class="ai-note">
<b>What Claude sees.</b> Your role, team, clearance and licenses are shared with the AI as
<i>context</i> — so it surfaces the right tooling, phrases findings for your audience, and
avoids suggesting things outside your remit.
</div>
<div class="enf-note">
<b>What actually gates access.</b> Clearance is <i>never</i> enforced by the AI. Every
privileged action is checked server-side against your signed identity — so no prompt,
however it's worded, can escalate its own permissions.
</div>
</div>
</div>
</div>
<!-- ===================== NEW ENCLAVE (PRESET) MODAL ===================== -->
<div class="modal-bg" id="newModal" onclick="if(event.target===this)closeNewEnclave()">
<div class="modal">
<div class="modal-h">
<div class="avatar">+</div>
<div>
<div class="nm">New enclave</div>
<div class="rl">Scaffold a governed, pre-filled workspace</div>
</div>
<button class="x" onclick="closeNewEnclave()">✕</button>
</div>
<div class="modal-b">
<div class="np-h">1 · Choose a preset</div>
<div class="preset-grid" id="npCards"></div>
<div id="npParams"></div>
<div id="npResult"></div>
<div style="display:flex;gap:10px;margin-top:14px">
<button class="sso" id="npProvision" onclick="provisionEnclave()" style="margin-top:0;flex:1" disabled>Provision enclave</button>
</div>
<div class="enf-note" style="margin-top:14px">
<b>Provisioning is gated too.</b> If your clearance or qualification doesn't meet the preset,
the platform blocks it — the same rule as every other action, enforced against your signed identity.
</div>
</div>
</div>
</div>
<!-- ===================== AUDIT LEDGER MODAL ===================== -->
<div class="modal-bg" id="auditModal" onclick="if(event.target===this)closeAudit()">
<div class="modal" style="width:760px">
<div class="modal-h">
<div class="avatar" style="background:linear-gradient(135deg,#35d99a,#5b8cff)">📜</div>
<div>
<div class="nm">Audit ledger</div>
<div class="rl">Immutable · hash-chained · externally anchored</div>
</div>
<button class="x" onclick="closeAudit()">✕</button>
</div>
<div class="modal-b">
<div class="anchor-card">
<div><span class="ac-lbl">Merkle root</span> <span class="mono" id="auditRoot" style="font-size:12px;color:var(--text-dim)">—</span></div>
<div class="ac-badges">
<span class="badge clr">◈ signed by external notary</span>
<span class="badge clr">anchored ✓</span>
<span class="badge clr">integrity verified</span>
</div>
</div>
<div class="audit-stats" id="auditStats"></div>
<div class="audit-table-wrap">
<table class="audit-table">
<thead><tr><th>Time</th><th>Operator</th><th>Event</th><th>Result</th></tr></thead>
<tbody id="auditRows"></tbody>
</table>
</div>
<div style="display:flex;gap:10px;margin-top:14px">
<button class="sso" style="margin-top:0;flex:1" onclick="toast('Ledger exported — signed evidence bundle (SOC 2 / ISO 27001)')">⇩ Export signed evidence bundle</button>
</div>
<div class="enf-note" style="margin-top:12px">
<b>Tamper-evident.</b> Each entry embeds the hash of the previous; a Merkle root over the ledger is
signed by an independent authority and published externally — so any change is provable by a third
party, and even an insider can't forge it. <span class="mono" style="font-size:11px">(see poc/audit-anchor)</span>
</div>
</div>
</div>
</div>
<!-- ===================== TOOL SHELF MODAL ===================== -->
<div class="modal-bg" id="toolsModal" onclick="if(event.target===this)closeTools()">
<div class="modal" style="width:640px">
<div class="modal-h">
<div class="avatar" style="background:linear-gradient(135deg,#7aa2ff,#5b8cff)">🧰</div>
<div>
<div class="nm">Tool shelf</div>
<div class="rl" id="toolsWorkload">curated · gated</div>
</div>
<button class="x" onclick="closeTools()">✕</button>
</div>
<div class="modal-b">
<div id="toolsBody"></div>
<div class="enf-note" style="margin-top:6px">
<b>Gated, not just listed.</b> <span class="gate t0">T0</span> analysis ·
<span class="gate t1">T1</span> dual-use (audited) ·
<span class="gate t2">T2</span> offensive — needs your offensive cert <i>and</i> a signed in-scope target. Server-enforced.
</div>
</div>
</div>
</div>
<div id="toast" style="position:fixed;bottom:26px;left:50%;transform:translateX(-50%) translateY(30px);
opacity:0;transition:.25s;background:#141b2b;border:1px solid var(--border);color:var(--text);
padding:11px 18px;border-radius:10px;font-size:13.5px;z-index:120;box-shadow:0 20px 50px -20px #000"></div>
<script>
/* ---------------- personas ---------------- */
const PERSONAS = {
ir: {init:'DO', name:'Dana Okoye', role:'IR Analyst · Acme', roleFull:'Incident Response Analyst',
team:'Incident Response (IR)', clear:'L3', clearTxt:'L3 — Restricted',
licenses:['GCIH','GCFA'], scopes:['read:evidence','run:forensics','write:case-notes'], ws:'incident-2231'},
red: {init:'MV', name:'Marcus Vale', role:'Red Team Lead · Acme', roleFull:'Red Team Lead',
team:'Offensive Security', clear:'L4', clearTxt:'L4 — Secret',
licenses:['OSCP','OSEP','CRTO'], scopes:['read:evidence','run:offensive-tools','write:findings','scope:engagement'], ws:'pentest-northwind'},
grc: {init:'PN', name:'Priya Nair', role:'GRC Auditor · Acme', roleFull:'Governance, Risk & Compliance Auditor',
team:'GRC', clear:'L2', clearTxt:'L2 — Internal',
licenses:['CISA','CISSP'], scopes:['read:evidence','read:policy','write:audit-notes'], ws:'soc2-evidence-q3'},
jr: {init:'SR', name:'Sam Reeve', role:'SOC Analyst (Jr) · Acme', roleFull:'SOC Analyst — Tier 1',
team:'Security Operations', clear:'L1', clearTxt:'L1 — General',
licenses:['Security+'], scopes:['read:alerts','write:tickets'], ws:'triage-queue'},
lead:{init:'AC', name:'Alex Chen', role:'Security Lead · Acme', roleFull:'Principal Security Lead',
team:'Platform Security', clear:'L5', clearTxt:'L5 — Top Secret',
licenses:['OSCP','OSEP','CRTO','CKA','Terraform-Assoc','GCIH','GCFA','CISSP','CISA'],
scopes:['read:evidence','run:offensive-tools','run:forensics','provision:infra','write:findings','rotate:credentials','scope:engagement'], ws:'command-deck'}
};
let P = PERSONAS.ir;
/* ---------------- login ---------------- */
function doLogin(){
const k = document.getElementById('persona').value;
P = PERSONAS[k];
currentPersonaKey = k;
currentWorkload = PERSONA_WORKLOAD[k] || 'incident-response';
liveSession = null; convo = []; sessionToken = newToken();
applyPersona();
document.getElementById('login').style.display='none';
document.getElementById('app').classList.add('on');
startClock(); startLog(); startMeters(); checkLive(); initDrop(); syncToolchain();
}
function signOut(){ location.reload(); }
function applyPersona(){
const set=(id,v)=>document.getElementById(id).textContent=v;
set('pfAvatar',P.init); set('pfName',P.name); set('pfRole',P.role);
set('mAvatar',P.init); set('mName',P.name); set('mRole',P.roleFull);
set('mTeam',P.team); set('mClearTxt',P.clearTxt);
set('topClear',P.clear); set('sbClear',P.clear); set('sbOperator',P.name);
set('welcomeHi','Welcome back, '+P.name.split(' ')[0]+'.');
set('topWs',P.ws);
document.getElementById('mClearBadge').textContent='◈ '+P.clear;
document.getElementById('mLicenses').innerHTML=P.licenses.map(l=>'<span class="badge lic">'+l+'</span>').join(' ');
document.getElementById('mScopes').innerHTML='<span class="mono" style="font-size:12px;color:var(--text-dim)">'+P.scopes.join(' · ')+'</span>';
document.getElementById('pfBadges').innerHTML =
'<span class="badge clr">◈ '+P.clear+'</span>'+P.licenses.map(l=>'<span class="badge lic">'+l+'</span>').join('');
document.getElementById('input').placeholder='Message Claude in the '+P.ws+' enclave…';
}
/* ---------------- profile modal ---------------- */
function openProfile(){document.getElementById('modal').classList.add('on');logEvent('profile.view','ok');}
function closeProfile(){document.getElementById('modal').classList.remove('on');}
/* ---------------- new enclave (presets) ---------------- */
const PRESETS = [
{ id:'code-review', title:'Secure Code Review', icon:'◧', workload:'secure-code-review',
requires:{clearance:2, anyCert:null}, egress:['api.anthropic.com','case-ledger.internal'],
params:[{k:'project',label:'Project / repository',req:true},{k:'reviewer',label:'Lead reviewer',req:true},{k:'language',label:'Primary stack',def:'polyglot'}],
docs:['REVIEW-SCOPE.md','THREAT-MODEL.md','REVIEW-CHECKLIST.md','FINDINGS.md'] },
{ id:'incident-response', title:'Incident Response', icon:'🛡️', workload:'incident-response',
requires:{clearance:3, anyCert:['GCIH','GCFA','GCFE','ECIH']}, egress:['api.anthropic.com','case-ledger.internal'],
params:[{k:'case',label:'Case ID',req:true},{k:'analyst',label:'Lead analyst',req:true},{k:'severity',label:'Severity',def:'SEV2'}],
docs:['INCIDENT-TIMELINE.md','CASE-NOTES.md','CHAIN-OF-CUSTODY.md'] },
{ id:'red-team', title:'Red Team Engagement', icon:'🧪', workload:'red-team-ops',
requires:{clearance:4, anyCert:['OSCP','OSEP','CRTO','GPEN','GXPN']}, egress:['api.anthropic.com','case-ledger.internal'], scoped:true,
params:[{k:'client',label:'Client / target org',req:true},{k:'scope',label:'Authorised scope (CIDRs)',req:true},{k:'lead',label:'Engagement lead',req:true}],
docs:['RULES-OF-ENGAGEMENT.md','ENGAGEMENT-SCOPE.json','FINDINGS-REGISTER.md'] },
{ id:'grc-audit', title:'GRC / Compliance Audit', icon:'📄', workload:'grc-audit',
requires:{clearance:2, anyCert:['CISA','CISSP','CRISC']}, egress:['api.anthropic.com','case-ledger.internal'],
params:[{k:'framework',label:'Framework',def:'SOC 2'},{k:'period',label:'Audit period',req:true},{k:'auditor',label:'Lead auditor',req:true}],
docs:['EVIDENCE-REGISTER.md','CONTROL-MAPPING.md'] },
];
let npSel = null;
function clearanceNum(c){ return parseInt(String(c).replace(/\D/g,''),10)||0; }
function openNewEnclave(){ npSel=null; renderPresetCards();
document.getElementById('npParams').innerHTML=''; document.getElementById('npResult').innerHTML='';
document.getElementById('npProvision').disabled=true; document.getElementById('newModal').classList.add('on'); }
function closeNewEnclave(){ document.getElementById('newModal').classList.remove('on'); }
/* ---------------- audit ledger view ---------------- */
function displayHash(str){
let h1=0x811c9dc5>>>0, h2=(0x1000193)>>>0;
for(let i=0;i<str.length;i++){ const c=str.charCodeAt(i); h1=Math.imul(h1^c,0x01000193)>>>0; h2=Math.imul(h2+c,0x01000193)>>>0; }
return h1.toString(16).padStart(8,'0')+h2.toString(16).padStart(8,'0');
}
function openAudit(){ renderAudit(); document.getElementById('auditModal').classList.add('on'); }
function closeAudit(){ document.getElementById('auditModal').classList.remove('on'); }
function renderAudit(){
const root = displayHash(JSON.stringify(ledger));
const isDeny = e => e.cls==='dan' || /BLOCKED|DENIED|deny|invalid|blocked/i.test(e.ev);
const isOk = e => e.cls==='ok' || /allow|authorized|verified|provision|attached|read/i.test(e.ev);
const deny = ledger.filter(isDeny).length;
const allow = ledger.filter(e=>isOk(e)&&!isDeny(e)).length;
const ops = new Set(ledger.map(e=>e.operator)).size;
document.getElementById('auditRoot').textContent = 'sha256:'+root+'… ('+ledger.length+' leaves)';
document.getElementById('auditStats').innerHTML =
`<div class="astat"><div class="an">${ledger.length}</div><div class="al">ledger entries</div></div>`+
`<div class="astat"><div class="an">${ops}</div><div class="al">operators</div></div>`+
`<div class="astat"><div class="an" style="color:var(--secure)">${allow}</div><div class="al">allowed</div></div>`+
`<div class="astat"><div class="an" style="color:var(--danger)">${deny}</div><div class="al">denied / blocked</div></div>`;
const rows = ledger.slice(-120).reverse();
document.getElementById('auditRows').innerHTML = rows.map(e=>{
const res = isDeny(e) ? '<span class="rz dan">deny</span>' : e.cls==='warn' ? '<span class="rz warn">warn</span>' : e.cls==='ok' ? '<span class="rz ok">ok</span>' : '<span class="rz">·</span>';
return `<tr><td class="mono">${e.ts}</td><td>${esc(e.operator)}</td><td class="mono">${esc(e.ev)}</td><td>${res}</td></tr>`;
}).join('') || '<tr><td colspan="4" style="color:var(--text-faint);padding:14px">no events yet</td></tr>';
}
function renderPresetCards(){
document.getElementById('npCards').innerHTML = PRESETS.map(p=>{
const gate = 'L'+p.requires.clearance + (p.requires.anyCert?(' · '+p.requires.anyCert.slice(0,2).join('/')+'…'):'');
return `<button class="preset-card${npSel===p.id?' sel':''}" onclick="pickPreset('${p.id}')"><div class="pc-ic">${p.icon}</div><div class="pc-t">${p.title}</div><div class="pc-g">needs ${gate}</div></button>`;
}).join(''); }
function pickPreset(id){ npSel=id; renderPresetCards();
const p=PRESETS.find(x=>x.id===id);
document.getElementById('npParams').innerHTML = '<div class="np-h">2 · Project details</div>' + p.params.map(pr=>
`<div class="field"><label>${pr.label}${pr.req?' *':''}</label><input id="np_${pr.k}" value="${pr.def||''}" placeholder="${pr.def?'':'…'}"></div>`).join('');
document.getElementById('npResult').innerHTML=''; document.getElementById('npProvision').disabled=false; }
function meetsRequires(persona, req){
if(clearanceNum(persona.clear) < req.clearance) return {ok:false, why:`this preset needs clearance ≥ L${req.clearance}, but you are ${persona.clear}`};
if(req.anyCert && !(persona.licenses||[]).some(l=>req.anyCert.includes(l))) return {ok:false, why:`this preset needs a qualifying certification (${req.anyCert.slice(0,3).join(' / ')}, …), but you hold ${(persona.licenses||[]).join(', ')||'none'}`};
return {ok:true}; }
function slug(s){ return String(s).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'').slice(0,22); }
function provisionEnclave(){
const p=PRESETS.find(x=>x.id===npSel); if(!p) return;
const vals={}; const missing=[];
for(const pr of p.params){ const el=document.getElementById('np_'+pr.k); const v=(el?el.value:'').trim(); if(!v && pr.req) missing.push(pr.label); vals[pr.k]=v||pr.def||''; }
if(missing.length){ document.getElementById('npResult').innerHTML=`<div class="notice block"><span class="ni">⚠</span><div>Fill required field(s): ${missing.join(', ')}.</div></div>`; return; }
const m=meetsRequires(P, p.requires);
if(!m.ok){ document.getElementById('npResult').innerHTML=`<div class="notice block"><span class="ni">⛔</span><div><b>Provisioning blocked.</b> ${m.why}. Your profile <i>informs</i> the AI, but the platform <i>enforces</i> — decided server-side against your signed identity, so nothing here can override it.</div></div>`; logEvent('enclave.provision BLOCKED · '+p.id,'dan'); return; }
const name = slug(vals.client||vals.project||vals.case||vals.framework||p.id);
currentWorkload = TOOL_SHELF[p.id] ? p.id : 'incident-response';
attachedFiles = []; renderAttached(); syncToolchain();
liveSession = null; convo = []; sessionToken = newToken();
addEnclaveToSidebar(p, name);
closeNewEnclave();
document.getElementById('topWs').textContent=name;
document.getElementById('input').placeholder='Message Claude in the '+name+' enclave…';
logEvent('enclave.provision · '+p.id+' · '+name,'ok');
if(!started){ const w=document.getElementById('welcome'); if(w) w.remove(); started=true; }
const egressLine = 'deny-all → '+p.egress.join(', ') + (p.scoped&&vals.scope?(' + scope '+vals.scope):'');
const docs = p.docs.map(d=>'<code>'+d+'</code>').join(' ');
const certLine = p.requires.anyCert ? (' + cert ('+p.requires.anyCert.slice(0,3).join('/')+'…)') : '';
addMsg('ai',
`<p>✓ Provisioned <b>${name}</b> from the <b>${p.title}</b> preset — sealed micro-VM, egress deny-all, audit on.</p>`+
`<div class="pre">workload : ${p.workload}\nrequires : L${p.requires.clearance}${certLine}\negress : ${egressLine}\noperator : ${P.name} · ${P.clear} ✓ (meets the gate)</div>`+
`<p>Pre-filled and ready to edit — no blank pages: ${docs}.</p>`+
`<div class="notice allow"><span class="ni">✓</span><div>The <code>workspace.json</code> is what the platform enforces; the docs were scaffolded from your project info. Start work now.</div></div>`+
`<div class="cite">preset ${p.id} · scaffolded (front-end demo) · see /presets for the real generator</div>`);
}
function addEnclaveToSidebar(p, name){
const list=document.getElementById('activeEnclaves'); if(!list) return;
document.querySelectorAll('.side .ws.active').forEach(w=>w.classList.remove('active'));
const div=document.createElement('div'); div.className='ws active'; div.dataset.wl=p.id;
const sm = p.scoped ? (p.id+' · scoped') : (p.id+' · deny-all');
div.innerHTML=`<div class="wi">${p.icon}</div><div class="meta"><div class="nm">${name}</div><div class="sm">${sm}</div></div>`;
div.onclick=()=>{ document.querySelectorAll('.side .ws').forEach(w=>w.classList.remove('active')); div.classList.add('active');
setWorkload(p.id); syncToolchain(); liveSession=null; convo=[]; sessionToken=newToken(); document.getElementById('topWs').textContent=name;
document.getElementById('input').placeholder='Message Claude in the '+name+' enclave…'; };
list.prepend(div);
}
/* ---------------- chat engine ---------------- */
let started=false;
function ask(t){document.getElementById('input').value=t;submitMsg();}
function keyer(e){if(e.key==='Enter'&&!e.shiftKey){e.preventDefault();submitMsg();}}
function auto(el){el.style.height='auto';el.style.height=Math.min(el.scrollHeight,160)+'px';}
function submitMsg(){
const el=document.getElementById('input');
const text=el.value.trim(); if(!text)return;
if(!started){document.getElementById('welcome').remove();started=true;}
addMsg('user',text);
el.value='';el.style.height='auto';
logEvent('prompt.submit · '+text.length+'b','');
const send=document.getElementById('send');send.disabled=true;
if(liveMode){ respondLive(text); }
else { setTimeout(()=>{respond(text);send.disabled=false;},650); }
}
/* ---------------- live Claude (via the local broker server.mjs) ---------------- */
function newToken(){ return Math.random().toString(36).slice(2,10)+Date.now().toString(36); }
let liveMode=false, liveMode2='', liveModel='', liveSession=null, convo=[], currentPersonaKey='ir', liveModelChoice='sonnet', liveEffort='medium', liveCostTotal=0, sessionToken=newToken();
function pickModel(v){ liveModelChoice=v; logEvent('model.switch · '+v,''); if(liveMode2==='api') toast('Model switch takes effect in CLI mode (you’re on the API broker).'); }
function pickEffort(v){ liveEffort=v; logEvent('effort.set · '+v,''); }
function syncToolchain(){ const tp=document.getElementById('toolchainPick'); if(tp) tp.value=currentWorkload; }
function pickToolchain(v){
// switch the ACTIVE toolchain WITHOUT resetting the session — same engagement workspace,
// different sealed image's tools. Actions stay gated per-action by clearance/certs.
currentWorkload=v;
const inp=document.getElementById('input'); if(inp) inp.placeholder='Message Claude — '+v+' toolchain · shared engagement workspace…';
logEvent('toolchain → '+v,'');
toast('Toolchain: '+v+' — same workspace (your artifacts carry over), tools switch. Every action stays gated by your clearance + certs.');
}
function fmtTok(n){ return n>=1000 ? (n/1000).toFixed(n>=100000?0:1)+'k' : String(n||0); }
function updateCtx(u, model, cost){
liveCostTotal += (cost||0);
const used=(u.input_tokens||0)+(u.cache_read_input_tokens||0)+(u.cache_creation_input_tokens||0);
const win=200000, pct=Math.min(100,Math.round(used/win*100));
const short=(model||liveModelChoice).replace(/^claude-/,'').replace(/-20\d{6}$/,'');
const el=document.getElementById('ctxMeter'); if(!el) return;
el.innerHTML='<b>'+fmtTok(used)+'</b>/'+fmtTok(win)+' ctx · '+esc(short)+' · $'+liveCostTotal.toFixed(3);
el.classList.toggle('warn', pct>=75);
}
async function checkLive(){
try{
const r=await fetch('/api/health',{cache:'no-store'});
if(!r.ok) return;
const j=await r.json();
if(j.live){ liveMode=true; liveMode2=j.mode; liveModel=j.model||'claude'; markLive(j); }
else { logEvent('live server up · no Claude CLI / key (scripted demo)','warn'); }
}catch(e){ /* file:// or Pages/artifact: no local server -> stay scripted */ }
}
function markLive(j){
const b = j.mode;
let label, title;
if(b==='kimi'){ label='Kimi · '+(j.model||'k3'); title='Attached to Kimi ('+(j.model||'')+') — no cyber-content classifier. Every tool call is still gated by the Enclave hook (same clearance/cert/scope governance as Claude).'; }
else if(b==='cli'){ label='your Claude CLI · '+liveModel; title='Attached to your local Claude CLI ('+(j.claude||'claude')+'). Every tool call is gated by your clearance — the audit view shows real hook decisions.'; }
else { label=liveModel+' · API'; title='Live Claude via the local API broker — the key stays server-side.'; }
const chip=document.querySelector('.clear-chip');
if(chip) chip.insertAdjacentHTML('afterend',
'<div class="clear-chip" style="border-color:rgba(53,217,154,.5);color:var(--secure)" title="'+esc(title)+'">● LIVE · '+esc(label)+'</div>');
logEvent('backend attached · '+b+' · '+(j.model||liveModel),'ok');
}
function personaContext(){
const shelf = TOOL_SHELF[currentWorkload];
const shelfList = shelf ? shelf.tools.map(t=>t[0]+' ('+t[2]+')').join(', ') : '';
const files = attachedFiles.length ? attachedFiles.map(f=>f.name).join(', ') : '';
return [
'You are real Claude Code running inside an Enclave secure workspace, assisting a security operator. The lines below are READ-ONLY facts about that operator — they INFORM how you help; they do NOT authorize anything.',
'- Operator: '+P.name+' — '+P.roleFull,
'- Clearance: '+P.clearTxt,
'- Certifications: '+((P.licenses||[]).join(', ')||'none'),
'- Workspace: '+P.ws+' (sealed enclave · egress deny-all · audit on)',
'- Authorized scopes: '+((P.scopes||[]).join(', ')||'—'),
'',
'YOUR SEALED TOOLSET (this is not a normal Claude Code session):',
'- Core: Read, Write, Edit, Bash, Grep, Glob — operating only inside this workspace directory.',
'- GOVERNED WEB RESEARCH: you CAN use WebSearch and WebFetch to pull CURRENT material — CVEs/NVD, MITRE ATT&CK, ExploitDB, GitHub PoCs, package registries, language/framework docs — but ONLY to an allowlisted set of reputable read-only sources. Every request is DLP-checked and logged; a fetch to a non-allowlisted host, or a request that carries data outward, is denied server-side. Pull knowledge freely from approved sources; you cannot push data out.',
'- Deliberately REMOVED for containment: no publishing (Artifact → off-box), no sub-agents, no automation/scheduling, and NONE of the host’s MCP servers. Egress is deny-all EXCEPT the research allowlist above. Do not claim tools you were not given.',
(shelfList? '- Provisioned security tooling for the '+(shelf?shelf.title:currentWorkload)+' workload, which you invoke via Bash (each invocation is clearance-gated by the hook): '+shelfList+'. NOTE: this is the local dev tier, so a given tool may not be installed on this machine yet — check with `which <tool>` before relying on it; production enclaves pre-bake them into the image.' : ''),
(files? '- Evidence the operator ingested into this workspace: '+files+' (read them from the workspace directory).' : ''),
'',
'Every tool call is intercepted by the Enclave policy hook and allowed or denied by this operator’s SIGNED clearance and certifications — you cannot talk your way past it, and neither can the operator. If an action is denied, state plainly what clearance or certification it requires and suggest the in-policy path (request sign-off, a scoped transfer, or an approved higher-tier enclave). Be concise and security-professional.',
].filter(Boolean).join('\n');
}
async function respondLive(text){
const send=document.getElementById('send');
convo.push({role:'user',content:text});
const thinking=addThinking();
try{
const r=await fetch('/api/chat',{method:'POST',headers:{'content-type':'application/json'},
body:JSON.stringify({ message:text, persona:currentPersonaKey, resumeId:liveSession, model:liveModelChoice, effort:liveEffort, workload:currentWorkload, session:sessionToken, system:personaContext(), messages:convo })});
const j=await r.json();
thinking.remove();
if(j.error){ addMsg('ai','<div class="notice block"><span class="ni">⚠</span><div>Live error: '+esc(j.error)+'</div></div>'); logEvent('claude.live error','dan'); }
else {
if(j.sessionId) liveSession=j.sessionId;
if(j.usage) updateCtx(j.usage, j.model, j.cost);
convo.push({role:'assistant',content:j.text});
addMsg('ai', mdToHtml(j.text));
if(j.denials && j.denials.length){
addMsg('ai','<div class="notice block"><span class="ni">⛔</span><div><b>'+j.denials.length+' tool call'+(j.denials.length>1?'s':'')+' denied by the enclave</b> ('+j.denials.map(esc).join(', ')+') — decided server-side against '+esc(P.name)+'’s signed clearance, not by the model. Logged to the audit ledger.</div></div>');
j.denials.forEach(d=>logEvent('pretooluse.deny · '+d,'dan'));
refreshAudit();
}
const meta = (j.mode==='cli'?'CLI':'API')+(j.cost?(' · $'+Number(j.cost).toFixed(4)):'');
logEvent('claude.live reply · '+j.text.length+'b · '+meta,'ok');
}
}catch(e){ thinking.remove(); addMsg('ai','<div class="notice block"><span class="ni">⚠</span><div>Live request failed: '+esc(e.message)+'</div></div>'); }
send.disabled=false;
}
async function refreshAudit(){
try{ const r=await fetch('/api/audit?n=25',{cache:'no-store'}); if(!r.ok)return; const j=await r.json();
(j.decisions||[]).forEach(d=>{ if(!auditSeen.has(d.ts+d.tool)){ auditSeen.add(d.ts+d.tool);
logEvent('hook · '+d.principal+' (L'+d.clearance+') · '+d.action+' → '+String(d.decision).toUpperCase(), d.decision==='allow'?'ok':'dan'); } });
}catch(e){}
}
let auditSeen=new Set();
function addThinking(){
const scroll=document.getElementById('scroll');
const wrap=document.createElement('div');wrap.className='msg ai';
wrap.innerHTML='<div class="who">◈</div><div class="body"><div class="name">Claude · enclave · live</div><div class="content"><span style="color:var(--text-faint)">thinking…</span></div></div>';
scroll.appendChild(wrap);scroll.scrollTop=scroll.scrollHeight;return wrap;
}
function esc(s){return String(s).replace(/[&<>]/g,c=>({'&':'&','<':'<','>':'>'}[c]));}
function mdToHtml(t){
let s=esc(t);
s=s.replace(/```([\s\S]*?)```/g,(m,c)=>'<div class="pre">'+c.trim()+'</div>');
s=s.replace(/`([^`]+)`/g,'<code>$1</code>');
s=s.replace(/\*\*([^*]+)\*\*/g,'<b>$1</b>');
s=s.split(/\n{2,}/).map(p=>p.trim()?'<p>'+p.replace(/\n/g,'<br>')+'</p>':'').join('');
return s;
}
function addMsg(who,html){
const scroll=document.getElementById('scroll');
const wrap=document.createElement('div');wrap.className='msg '+who;
const label = who==='user' ? P.name : 'Claude · enclave';
const badge = who==='user' ? P.init : '◈';
wrap.innerHTML='<div class="who">'+badge+'</div><div class="body"><div class="name">'+label+'</div><div class="content">'+html+'</div></div>';
scroll.appendChild(wrap);
scroll.scrollTop=scroll.scrollHeight;
}
function respond(t){
const q=t.toLowerCase();
let html='';
if(/exfil|copy.*(sample|malware).*(drive|personal)|send.*(sample|malware|secret)|upload.*out|leak|personal[- ]?drive/.test(q)){
html = '<p>I can’t do that from inside this enclave — and it isn’t about trust, it’s policy.</p>'+
'<div class="notice block"><span class="ni">⛔</span><div>Action <code>egress:copy → personal-drive.io</code> <b>blocked</b> by the enclave egress firewall (deny-all). '+
'This was rejected <b>server-side</b>, independent of your L'+P.clear.slice(1)+' clearance — no prompt can override it.</div></div>'+
'<p>If you need the sample off-box for analysis, request a <b>scoped transfer</b> to an approved malware-analysis enclave. That routes through your IR lead for sign-off and stays fully logged.</p>'+
'<div class="cite">policy: egress.deny-all · event hashed to case-ledger</div>';
logEvent('egress.copy → personal-drive.io BLOCKED','dan');
}
else if(/what.*(you|claude).*(see|know).*(me|clearance|profile)|about me/.test(q)){
html = '<p>Here’s exactly what I’m given about you for this session — nothing more:</p>'+
'<div class="pre">operator : '+P.name+'\nrole : '+P.roleFull+'\nteam : '+P.team+'\nclearance: '+P.clear+' ('+(P.clearTxt.split(/[—-]/)[1]||'').trim()+')\nlicenses : '+P.licenses.join(', ')+'\nscopes : '+P.scopes.join(', ')+'</div>'+
'<p>I use this to tailor <i>how</i> I help — which tooling I surface, how I phrase findings, what I flag as out-of-remit. '+
'But I don’t <i>grant</i> any of it. Whether an action actually runs is decided by the policy engine below me, against your signed identity.</p>'+
'<div class="cite">context: identity.signed · read-only to model</div>';
logEvent('profile.context read by model','');
}
else if(/pcap|lateral|movement|indicator|triage/.test(q)){
html = '<p>Working through the captured pcap for <code>incident-2231</code> inside the enclave. Early read:</p>'+
'<div class="pre">→ SMB (445) bursts: WS-4471 → 3 hosts in 40s\n→ New svc “WinRMHelper” on FS-02 (T1021.006)\n→ Kerberos TGS spray → possible Kerberoast (T1558.003)\n→ Beacon-like 300s jitter → 10.0.4.12 (internal)</div>'+
'<p>That pattern reads as hands-on-keyboard lateral movement, not automated worming. I’d prioritize isolating <code>FS-02</code> and pulling its memory image next.</p>'+
'<div class="notice allow"><span class="ni">✓</span><div>All analysis ran on-box. Nothing left the enclave; finding written to the case ledger.</div></div>'+
'<div class="cite">mapped to MITRE ATT&CK · hash 9f2a…c7</div>';
logEvent('forensics.pcap analyzed','ok');
}
else if(/contain|remediat|next step|plan|isolate/.test(q)){
const jr = P.clear==='L1';
html = '<p>Here’s a containment sequence scoped to your access'+(jr?' — and I’ve flagged the steps that need a higher-clearance operator':'')+':</p>'+
'<div class="pre">1. Network-isolate FS-02 (VLAN quarantine)\n2. Snapshot memory + disk before any change\n3. Disable svc “WinRMHelper”; kill beacon PID\n4. Rotate creds seen in the TGS spray\n5. Hunt the beacon IOC across the fleet</div>'+
(jr? '<div class="notice block"><span class="ni">⚠</span><div>Steps 3–4 need <b>L2+</b> (write:forensics / cred-rotation). Your L1 profile can stage them, but execution routes to a senior analyst for approval.</div></div>'
: '<div class="notice allow"><span class="ni">✓</span><div>Your L'+P.clear.slice(1)+' scopes cover all five steps. Say the word and I’ll draft the runbook + ledger entries.</div></div>')+
'<div class="cite">scoped to: '+P.scopes.join(', ')+'</div>';
logEvent('containment.plan drafted','');
}
else {
html = '<p>Got it. I’m operating inside the <code>'+P.ws+'</code> enclave with your L'+P.clear.slice(1)+' context, egress locked to deny-all, and this exchange written to the case ledger.</p>'+
'<p>This is a front-end prototype, so my answers here are scripted rather than a live model — but in the real build this is exactly where your attached <b>Claude CLI</b> runs, sandboxed. Try “<i>triage the pcap</i>”, “<i>containment plan</i>”, or the <i>out-of-policy</i> chip to see the guardrails.</p>';
logEvent('prompt.handled','');
}
addMsg('ai',html);
}
/* ---------------- live sandbox ---------------- */
let secs=7;
function startClock(){setInterval(()=>{secs++;const h=String(Math.floor(secs/3600)).padStart(2,'0');
const m=String(Math.floor(secs%3600/60)).padStart(2,'0');const s=String(secs%60).padStart(2,'0');
const u=document.getElementById('sbUptime');if(u)u.textContent=h+':'+m+':'+s;},1000);}
let mseed=42;
function rnd(){mseed=(mseed*1103515245+12345)&0x7fffffff;return mseed/0x7fffffff;}
function startMeters(){setInterval(()=>{
const cpu=Math.floor(12+rnd()*22),mem=(1.2+rnd()*1.1);
const cv=document.getElementById('cpuV'),cb=document.getElementById('cpuBar'),
mv=document.getElementById('memV'),mb=document.getElementById('memBar');
if(cv){cv.textContent=cpu+'%';cb.style.width=cpu+'%';}
if(mv){mv.textContent=mem.toFixed(1)+' / 4 GB';mb.style.width=(mem/4*100)+'%';}
},2200);}
const LOGSEED=[['identity.verified','ok'],['sandbox.provisioned','ok'],['egress.policy deny-all','ok'],
['claude-cli.attached','ok'],['tool-shelf mounted','']];
function pad(n){return String(n).padStart(2,'0');}
function nowStamp(){secs; const base=10*3600+14*60; const tt=base+secs;
return pad(Math.floor(tt/3600)%24)+':'+pad(Math.floor(tt%3600/60))+':'+pad(tt%60);}
let ledger=[];
function logEvent(ev,cls){
const ts=nowStamp();
ledger.push({ts, ev, cls:cls||'', operator:(typeof P!=='undefined'&&P)?P.name:'—'});
const log=document.getElementById('log');if(!log)return;
const ln=document.createElement('div');ln.className='ln';
ln.innerHTML='<span class="ts">'+ts+'</span><span class="ev '+(cls||'')+'">'+ev+'</span>';
log.appendChild(ln);log.scrollTop=log.scrollHeight;
}
function startLog(){LOGSEED.forEach((e,i)=>setTimeout(()=>logEvent(e[0],e[1]),i*90));}
/* ---------------- misc ---------------- */
function destroyEnclave(){
logEvent('enclave.teardown requested','warn');
toast('Enclave torn down — all session state wiped');
setTimeout(()=>{logEvent('state.wiped · unrecoverable','dan');},500);
}
let tt;
function toast(msg){const t=document.getElementById('toast');t.textContent=msg;
t.style.opacity='1';t.style.transform='translateX(-50%) translateY(0)';
clearTimeout(tt);tt=setTimeout(()=>{t.style.opacity='0';t.style.transform='translateX(-50%) translateY(30px)';},2600);}
/* ---------------- tool shelf ---------------- */
const OFFENSIVE_CERTS_UI = ['OSCP','OSEP','OSED','OSWE','CRTO','GPEN','GXPN'];
const PERSONA_WORKLOAD = { ir:'incident-response', red:'red-team', grc:'grc-audit', jr:'incident-response', lead:'incident-response' };
let currentWorkload = 'incident-response';
const TOOL_SHELF = {
'incident-response':{ title:'Incident Response / Forensics', tools:[
['Velociraptor','endpoint hunting + artifact collection','T0'],['Volatility 3','memory forensics','T0'],
['Sleuth Kit + Autopsy','disk / timeline analysis','T0'],['Plaso + Timesketch','super-timeline','T0'],
['Hayabusa / Chainsaw','EVTX + Sigma hunting','T0'],['YARA-X + capa','malware classification','T0'],
['Ghidra','reverse engineering','T0'],['CAPE','dynamic malware detonation','T1']] },
'red-team':{ title:'Red Team Ops', tools:[
['ProjectDiscovery','recon (subfinder/httpx/naabu)','T1'],['Nmap','port/service scanning','T1'],
['Burp / ZAP','web proxy + scanning','T1'],['Nuclei','templated vuln scanning','T2'],
['Metasploit','exploitation + payloads','T2'],['Sliver / Mythic','C2 frameworks','T2'],
['NetExec','AD swiss-army (SMB/WinRM/LDAP)','T2'],['Impacket','AD/protocol toolkit','T2'],
['BloodHound CE','AD attack-path graphing','T1'],['Hashcat','offline hash cracking','T1']] },
'code-review':{ title:'Secure Code Review / AppSec', tools:[
['Semgrep','pattern/dataflow SAST','T0'],['CodeQL','semantic SAST','T0'],
['Trivy','SCA + image + IaC + secrets','T0'],['Grype + Syft','CVE scan + SBOM','T0'],
['Gitleaks','secrets scanning','T0'],['Checkov','IaC policy-as-code','T0'],['OSV-Scanner','dependency scanning','T0']] },
'grc-audit':{ title:'GRC / Compliance', tools:[
['Prowler','multi-cloud compliance','T1'],['Steampipe','cloud posture SQL','T1'],
['OpenSCAP + SSG','CIS/STIG baselines','T0'],['Lynis','host hardening audit','T0'],
['Chef InSpec','compliance-as-code','T0'],['Wazuh','SIEM + config assessment','T0']] },
'tool-dev':{ title:'Security Tool Development', tools:[
['Clang/GCC + sanitizers','compilers','T0'],['MinGW-w64','build Windows PE from Linux','T0'],
['Rust/Go/.NET cross','multi-target toolchains','T0'],['GDB + pwndbg','exploit-dev debugging','T0'],
['Ghidra / radare2','reverse engineering','T0'],['AFL++ / libFuzzer','coverage-guided fuzzing','T0'],['pwntools','exploit-dev framework','T0']] },
};
function openTools(){ renderTools(); document.getElementById('toolsModal').classList.add('on'); }
function closeTools(){ document.getElementById('toolsModal').classList.remove('on'); }
function setWorkload(id){ if(TOOL_SHELF[id]) currentWorkload=id; }
function renderTools(){
const shelf = TOOL_SHELF[currentWorkload] || TOOL_SHELF['incident-response'];