Zhen Ye commited on
Commit
9803004
·
1 Parent(s): 3954f64

wired endpoints to new html

Browse files
LaserPerception/LaserPerception.css ADDED
@@ -0,0 +1,844 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* =========================================
2
+ LaserPerception Design System
3
+ ========================================= */
4
+
5
+ :root {
6
+ /* --- Colors --- */
7
+ --bg: #060914;
8
+ --panel: #0b1026;
9
+ --panel2: #0a0f22;
10
+
11
+ --stroke: rgba(255, 255, 255, .08);
12
+ --stroke2: rgba(255, 255, 255, .12);
13
+
14
+ --text: rgba(255, 255, 255, .92);
15
+ --muted: rgba(255, 255, 255, .62);
16
+ --faint: rgba(255, 255, 255, .42);
17
+
18
+ --good: #22c55e;
19
+ --warn: #f59e0b;
20
+ --bad: #ef4444;
21
+
22
+ --accent: #7c3aed;
23
+ --cyan: #22d3ee;
24
+ --mag: #fb7185;
25
+
26
+ /* --- Effects --- */
27
+ --shadow: 0 18px 60px rgba(0, 0, 0, .55);
28
+
29
+ /* --- Typography --- */
30
+ --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
31
+ --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
32
+ }
33
+
34
+ * {
35
+ box-sizing: border-box;
36
+ }
37
+
38
+ html,
39
+ body {
40
+ height: 100%;
41
+ margin: 0;
42
+ }
43
+
44
+ body {
45
+ background:
46
+ radial-gradient(1200px 700px at 20% 8%, rgba(124, 58, 237, .22), transparent 60%),
47
+ radial-gradient(900px 500px at 82% 18%, rgba(34, 211, 238, .18), transparent 60%),
48
+ radial-gradient(800px 520px at 52% 82%, rgba(251, 113, 133, .10), transparent 65%),
49
+ linear-gradient(180deg, #040614, #060914);
50
+ color: var(--text);
51
+ font-family: var(--sans);
52
+ overflow: hidden;
53
+ }
54
+
55
+ /* =========================================
56
+ Layout & Structure
57
+ ========================================= */
58
+
59
+ #app {
60
+ height: 100%;
61
+ display: flex;
62
+ flex-direction: column;
63
+ }
64
+
65
+ header {
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: space-between;
69
+ padding: 14px 16px 12px;
70
+ border-bottom: 1px solid var(--stroke);
71
+ background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent);
72
+ }
73
+
74
+ .workspace {
75
+ flex: 1;
76
+ display: grid;
77
+ grid-template-columns: 540px 1fr;
78
+ /* Fixed sidebar width */
79
+ gap: 12px;
80
+ padding: 12px;
81
+ min-height: 0;
82
+ }
83
+
84
+ aside,
85
+ main {
86
+ background: rgba(255, 255, 255, .02);
87
+ border: 1px solid var(--stroke);
88
+ border-radius: 16px;
89
+ box-shadow: var(--shadow);
90
+ overflow: hidden;
91
+ display: flex;
92
+ flex-direction: column;
93
+ min-height: 0;
94
+ }
95
+
96
+ footer {
97
+ padding: 10px 14px;
98
+ border-top: 1px solid var(--stroke);
99
+ color: var(--muted);
100
+ font-size: 11px;
101
+ display: flex;
102
+ justify-content: space-between;
103
+ align-items: center;
104
+ gap: 10px;
105
+ background: linear-gradient(0deg, rgba(255, 255, 255, .03), transparent);
106
+ }
107
+
108
+ footer .mono {
109
+ font-family: var(--mono);
110
+ color: rgba(255, 255, 255, .76);
111
+ }
112
+
113
+ /* =========================================
114
+ Brand & Status
115
+ ========================================= */
116
+
117
+ .brand {
118
+ display: flex;
119
+ gap: 12px;
120
+ align-items: center;
121
+ min-width: 420px;
122
+ }
123
+
124
+ .logo {
125
+ width: 40px;
126
+ height: 40px;
127
+ border-radius: 14px;
128
+ background:
129
+ radial-gradient(circle at 30% 30%, rgba(34, 211, 238, .9), rgba(124, 58, 237, .9) 55%, rgba(0, 0, 0, .1) 70%),
130
+ linear-gradient(135deg, rgba(255, 255, 255, .10), transparent 60%);
131
+ box-shadow: 0 16px 46px rgba(124, 58, 237, .25);
132
+ border: 1px solid rgba(255, 255, 255, .16);
133
+ position: relative;
134
+ overflow: hidden;
135
+ }
136
+
137
+ .logo:after {
138
+ content: "";
139
+ position: absolute;
140
+ inset: -40px;
141
+ background: conic-gradient(from 180deg, transparent, rgba(255, 255, 255, .10), transparent);
142
+ animation: spin 10s linear infinite;
143
+ }
144
+
145
+ @keyframes spin {
146
+ to {
147
+ transform: rotate(360deg);
148
+ }
149
+ }
150
+
151
+ .brand h1 {
152
+ font-size: 14px;
153
+ margin: 0;
154
+ letter-spacing: .16em;
155
+ text-transform: uppercase;
156
+ }
157
+
158
+ .brand .sub {
159
+ font-size: 12px;
160
+ color: var(--muted);
161
+ margin-top: 2px;
162
+ line-height: 1.2;
163
+ }
164
+
165
+ .status-row {
166
+ display: flex;
167
+ gap: 10px;
168
+ align-items: center;
169
+ flex-wrap: wrap;
170
+ justify-content: flex-end;
171
+ }
172
+
173
+ /* =========================================
174
+ Components: Cards & Panels
175
+ ========================================= */
176
+
177
+ .card {
178
+ padding: 12px 12px 10px;
179
+ border-bottom: 1px solid var(--stroke);
180
+ position: relative;
181
+ }
182
+
183
+ .card:last-child {
184
+ border-bottom: none;
185
+ }
186
+
187
+ .card h2 {
188
+ margin: 0;
189
+ font-size: 12px;
190
+ letter-spacing: .14em;
191
+ text-transform: uppercase;
192
+ color: rgba(255, 255, 255, .78);
193
+ }
194
+
195
+ .card small {
196
+ color: var(--muted);
197
+ }
198
+
199
+ .card .hint {
200
+ color: var(--faint);
201
+ font-size: 11px;
202
+ line-height: 1.35;
203
+ margin-top: 6px;
204
+ }
205
+
206
+ .panel {
207
+ background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .015));
208
+ border: 1px solid var(--stroke);
209
+ border-radius: 16px;
210
+ padding: 10px;
211
+ box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
212
+ overflow: hidden;
213
+ position: relative;
214
+ }
215
+
216
+ .panel h3 {
217
+ margin: 0 0 8px;
218
+ font-size: 12px;
219
+ letter-spacing: .14em;
220
+ text-transform: uppercase;
221
+ color: rgba(255, 255, 255, .78);
222
+ display: flex;
223
+ align-items: center;
224
+ justify-content: space-between;
225
+ gap: 8px;
226
+ }
227
+
228
+ .panel h3 .rightnote {
229
+ font-size: 11px;
230
+ color: var(--muted);
231
+ font-family: var(--mono);
232
+ letter-spacing: 0;
233
+ text-transform: none;
234
+ }
235
+
236
+ .collapse-btn {
237
+ background: rgba(255, 255, 255, .05);
238
+ border: 1px solid rgba(255, 255, 255, .12);
239
+ border-radius: 8px;
240
+ padding: 4px 8px;
241
+ color: var(--muted);
242
+ cursor: pointer;
243
+ font-size: 11px;
244
+ font-family: var(--mono);
245
+ transition: all 0.2s ease;
246
+ text-transform: none;
247
+ letter-spacing: 0;
248
+ }
249
+
250
+ .collapse-btn:hover {
251
+ background: rgba(255, 255, 255, .08);
252
+ color: var(--text);
253
+ border-color: rgba(255, 255, 255, .18);
254
+ }
255
+
256
+ /* =========================================
257
+ Components: Inputs & Controls
258
+ ========================================= */
259
+
260
+ .grid2 {
261
+ display: grid;
262
+ grid-template-columns: 1fr 1fr;
263
+ gap: 8px;
264
+ margin-top: 10px;
265
+ }
266
+
267
+ .row {
268
+ display: flex;
269
+ gap: 8px;
270
+ align-items: center;
271
+ justify-content: space-between;
272
+ margin-top: 8px;
273
+ }
274
+
275
+ label {
276
+ font-size: 11px;
277
+ color: var(--muted);
278
+ }
279
+
280
+ input[type="range"] {
281
+ width: 100%;
282
+ }
283
+
284
+ select,
285
+ textarea,
286
+ input[type="text"],
287
+ input[type="number"] {
288
+ width: 100%;
289
+ background: rgba(255, 255, 255, .04);
290
+ border: 1px solid var(--stroke2);
291
+ border-radius: 10px;
292
+ padding: 8px 10px;
293
+ color: var(--text);
294
+ outline: none;
295
+ font-size: 12px;
296
+ }
297
+
298
+ select:focus,
299
+ textarea:focus,
300
+ input[type="text"]:focus,
301
+ input[type="number"]:focus {
302
+ border-color: rgba(124, 58, 237, .55);
303
+ box-shadow: 0 0 0 3px rgba(124, 58, 237, .16);
304
+ }
305
+
306
+ .btn {
307
+ user-select: none;
308
+ cursor: pointer;
309
+ border: none;
310
+ border-radius: 12px;
311
+ padding: 10px 12px;
312
+ font-weight: 700;
313
+ font-size: 12px;
314
+ letter-spacing: .04em;
315
+ color: rgba(255, 255, 255, .92);
316
+ background: linear-gradient(135deg, rgba(124, 58, 237, .95), rgba(34, 211, 238, .45));
317
+ box-shadow: 0 18px 40px rgba(124, 58, 237, .24);
318
+ }
319
+
320
+ .btn:hover {
321
+ filter: brightness(1.06);
322
+ }
323
+
324
+ .btn:active {
325
+ transform: translateY(1px);
326
+ }
327
+
328
+ .btn.secondary {
329
+ background: rgba(255, 255, 255, .06);
330
+ border: 1px solid var(--stroke2);
331
+ box-shadow: none;
332
+ font-weight: 600;
333
+ }
334
+
335
+ .btn.secondary:hover {
336
+ background: rgba(255, 255, 255, .08);
337
+ }
338
+
339
+ .btn.danger {
340
+ background: linear-gradient(135deg, rgba(239, 68, 68, .95), rgba(251, 113, 133, .55));
341
+ box-shadow: 0 18px 40px rgba(239, 68, 68, .18);
342
+ }
343
+
344
+ .btnrow {
345
+ display: flex;
346
+ gap: 8px;
347
+ margin-top: 10px;
348
+ }
349
+
350
+ .btnrow .btn {
351
+ flex: 1;
352
+ }
353
+
354
+ .pill {
355
+ display: flex;
356
+ align-items: center;
357
+ gap: 10px;
358
+ padding: 8px 12px;
359
+ border-radius: 999px;
360
+ border: 1px solid var(--stroke2);
361
+ background: rgba(255, 255, 255, .04);
362
+ box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
363
+ font-size: 12px;
364
+ color: var(--muted);
365
+ white-space: nowrap;
366
+ }
367
+
368
+ .dot {
369
+ width: 8px;
370
+ height: 8px;
371
+ border-radius: 50%;
372
+ background: var(--good);
373
+ box-shadow: 0 0 16px rgba(34, 197, 94, .6);
374
+ }
375
+
376
+ .dot.warn {
377
+ background: var(--warn);
378
+ box-shadow: 0 0 16px rgba(245, 158, 11, .55);
379
+ }
380
+
381
+ .dot.bad {
382
+ background: var(--bad);
383
+ box-shadow: 0 0 16px rgba(239, 68, 68, .55);
384
+ }
385
+
386
+ .kbd {
387
+ font-family: var(--mono);
388
+ font-size: 11px;
389
+ padding: 2px 6px;
390
+ border: 1px solid var(--stroke2);
391
+ border-bottom-color: rgba(255, 255, 255, .24);
392
+ background: rgba(0, 0, 0, .35);
393
+ border-radius: 7px;
394
+ color: rgba(255, 255, 255, .78);
395
+ }
396
+
397
+ .badge {
398
+ display: inline-flex;
399
+ align-items: center;
400
+ gap: 6px;
401
+ padding: 4px 8px;
402
+ border-radius: 999px;
403
+ border: 1px solid var(--stroke2);
404
+ background: rgba(0, 0, 0, .25);
405
+ font-family: var(--mono);
406
+ }
407
+
408
+ /* =========================================
409
+ Navigation: Tabs
410
+ ========================================= */
411
+
412
+ .tabs {
413
+ display: flex;
414
+ gap: 8px;
415
+ padding: 10px 12px;
416
+ border-bottom: 1px solid var(--stroke);
417
+ background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent);
418
+ flex-wrap: wrap;
419
+ }
420
+
421
+ .tabbtn {
422
+ cursor: pointer;
423
+ border: none;
424
+ border-radius: 999px;
425
+ padding: 8px 12px;
426
+ font-size: 12px;
427
+ color: rgba(255, 255, 255, .75);
428
+ background: rgba(255, 255, 255, .04);
429
+ border: 1px solid var(--stroke2);
430
+ }
431
+
432
+ .tabbtn.active {
433
+ color: rgba(255, 255, 255, .92);
434
+ background: linear-gradient(135deg, rgba(124, 58, 237, .35), rgba(34, 211, 238, .10));
435
+ border-color: rgba(124, 58, 237, .45);
436
+ box-shadow: 0 0 0 3px rgba(124, 58, 237, .14);
437
+ }
438
+
439
+ .tab {
440
+ display: none;
441
+ flex: 1;
442
+ min-height: 0;
443
+ overflow: auto;
444
+ padding: 12px;
445
+ }
446
+
447
+ .tab.active {
448
+ display: block;
449
+ }
450
+
451
+ /* =========================================
452
+ Visualization: Views & Canvas
453
+ ========================================= */
454
+
455
+ .viewbox {
456
+ position: relative;
457
+ border-radius: 14px;
458
+ overflow: hidden;
459
+ background: radial-gradient(700px 380px at 30% 30%, rgba(124, 58, 237, .12), rgba(0, 0, 0, .0) 60%),
460
+ linear-gradient(180deg, rgba(0, 0, 0, .25), rgba(0, 0, 0, .15));
461
+ border: 1px solid rgba(255, 255, 255, .08);
462
+ min-height: 360px;
463
+ }
464
+
465
+ .viewbox canvas,
466
+ .viewbox video {
467
+ width: 100%;
468
+ height: 100%;
469
+ display: block;
470
+ }
471
+
472
+ /* Always show the engage video feed */
473
+ #videoEngage {
474
+ display: block;
475
+ opacity: 1;
476
+ }
477
+
478
+ .viewbox .overlay {
479
+ position: absolute;
480
+ inset: 0;
481
+ pointer-events: none;
482
+ }
483
+
484
+ /* Make engage overlay visible as main display (not just overlay) */
485
+ #engageOverlay {
486
+ display: none;
487
+ pointer-events: none;
488
+ }
489
+
490
+ .viewbox .watermark {
491
+ position: absolute;
492
+ left: 10px;
493
+ bottom: 10px;
494
+ font-family: var(--mono);
495
+ font-size: 11px;
496
+ color: rgba(255, 255, 255, .55);
497
+ background: rgba(0, 0, 0, .35);
498
+ border: 1px solid rgba(255, 255, 255, .14);
499
+ padding: 6px 8px;
500
+ border-radius: 10px;
501
+ }
502
+
503
+ .viewbox .empty {
504
+ position: absolute;
505
+ inset: 0;
506
+ display: flex;
507
+ flex-direction: column;
508
+ align-items: center;
509
+ justify-content: center;
510
+ gap: 10px;
511
+ color: rgba(255, 255, 255, .72);
512
+ text-align: center;
513
+ padding: 22px;
514
+ }
515
+
516
+ .viewbox .empty .big {
517
+ font-size: 14px;
518
+ letter-spacing: .12em;
519
+ text-transform: uppercase;
520
+ }
521
+
522
+ .viewbox .empty .small {
523
+ color: var(--muted);
524
+ font-size: 12px;
525
+ max-width: 520px;
526
+ line-height: 1.4;
527
+ }
528
+
529
+ /* =========================================
530
+ Lists & Tables
531
+ ========================================= */
532
+
533
+ .list {
534
+ display: flex;
535
+ flex-direction: column;
536
+ gap: 8px;
537
+ min-height: 160px;
538
+ max-height: 320px;
539
+ overflow: auto;
540
+ padding-right: 4px;
541
+ }
542
+
543
+ .obj {
544
+ padding: 10px;
545
+ border-radius: 14px;
546
+ border: 1px solid var(--stroke2);
547
+ background: rgba(255, 255, 255, .03);
548
+ cursor: pointer;
549
+ }
550
+
551
+ .obj:hover {
552
+ background: rgba(255, 255, 255, .05);
553
+ }
554
+
555
+ .obj.active {
556
+ border-color: rgba(34, 211, 238, .45);
557
+ box-shadow: 0 0 0 3px rgba(34, 211, 238, .14);
558
+ background: linear-gradient(135deg, rgba(34, 211, 238, .10), rgba(124, 58, 237, .08));
559
+ }
560
+
561
+ .obj .top {
562
+ display: flex;
563
+ align-items: center;
564
+ justify-content: space-between;
565
+ gap: 10px;
566
+ }
567
+
568
+ .obj .id {
569
+ font-family: var(--mono);
570
+ font-size: 12px;
571
+ color: rgba(255, 255, 255, .90);
572
+ }
573
+
574
+ .obj .cls {
575
+ font-size: 12px;
576
+ color: rgba(255, 255, 255, .80);
577
+ }
578
+
579
+ .obj .meta {
580
+ margin-top: 6px;
581
+ display: flex;
582
+ gap: 10px;
583
+ flex-wrap: wrap;
584
+ font-size: 11px;
585
+ color: var(--muted);
586
+ }
587
+
588
+ .table {
589
+ width: 100%;
590
+ border-collapse: separate;
591
+ border-spacing: 0;
592
+ overflow: hidden;
593
+ border-radius: 14px;
594
+ border: 1px solid rgba(255, 255, 255, .10);
595
+ }
596
+
597
+ .table th,
598
+ .table td {
599
+ padding: 8px 10px;
600
+ font-size: 12px;
601
+ border-bottom: 1px solid rgba(255, 255, 255, .08);
602
+ vertical-align: top;
603
+ }
604
+
605
+ .table th {
606
+ background: rgba(255, 255, 255, .04);
607
+ color: rgba(255, 255, 255, .78);
608
+ letter-spacing: .12em;
609
+ text-transform: uppercase;
610
+ font-size: 11px;
611
+ }
612
+
613
+ .table tr:last-child td {
614
+ border-bottom: none;
615
+ }
616
+
617
+ .k {
618
+ font-family: var(--mono);
619
+ color: rgba(255, 255, 255, .84);
620
+ }
621
+
622
+ .mini {
623
+ font-size: 11px;
624
+ color: var(--muted);
625
+ line-height: 1.35;
626
+ }
627
+
628
+ /* =========================================
629
+ Metrics & Logs
630
+ ========================================= */
631
+
632
+ .metricgrid {
633
+ display: grid;
634
+ grid-template-columns: 1fr 1fr;
635
+ gap: 8px;
636
+ }
637
+
638
+ .metric {
639
+ border: 1px solid rgba(255, 255, 255, .10);
640
+ background: rgba(255, 255, 255, .03);
641
+ border-radius: 14px;
642
+ padding: 10px;
643
+ }
644
+
645
+ .metric .label {
646
+ font-size: 11px;
647
+ color: var(--muted);
648
+ letter-spacing: .12em;
649
+ text-transform: uppercase;
650
+ }
651
+
652
+ .metric .value {
653
+ margin-top: 6px;
654
+ font-family: var(--mono);
655
+ font-size: 16px;
656
+ color: rgba(255, 255, 255, .92);
657
+ }
658
+
659
+ .metric .sub {
660
+ margin-top: 4px;
661
+ font-size: 11px;
662
+ color: var(--faint);
663
+ line-height: 1.35;
664
+ }
665
+
666
+ .log {
667
+ font-family: var(--mono);
668
+ font-size: 11px;
669
+ color: rgba(255, 255, 255, .78);
670
+ line-height: 1.45;
671
+ background: rgba(0, 0, 0, .35);
672
+ border: 1px solid rgba(255, 255, 255, .12);
673
+ border-radius: 14px;
674
+ padding: 10px;
675
+ height: 210px;
676
+ overflow: auto;
677
+ white-space: pre-wrap;
678
+ }
679
+
680
+ .log .t {
681
+ color: rgba(34, 211, 238, .95);
682
+ }
683
+
684
+ .log .w {
685
+ color: rgba(245, 158, 11, .95);
686
+ }
687
+
688
+ .log .e {
689
+ color: rgba(239, 68, 68, .95);
690
+ }
691
+
692
+ .log .g {
693
+ color: rgba(34, 197, 94, .95);
694
+ }
695
+
696
+ /* =========================================
697
+ Tab Specific: Intel + Frame
698
+ ========================================= */
699
+
700
+ .frame-grid {
701
+ display: grid;
702
+ grid-template-columns: 1.6fr .9fr;
703
+ grid-template-rows: auto auto 240px;
704
+ gap: 12px;
705
+ min-height: 0;
706
+ }
707
+
708
+ .intel {
709
+ margin-top: 10px;
710
+ display: flex;
711
+ flex-direction: column;
712
+ gap: 8px;
713
+ }
714
+
715
+ .intel-top {
716
+ display: flex;
717
+ align-items: center;
718
+ justify-content: space-between;
719
+ gap: 8px;
720
+ }
721
+
722
+ .thumbrow {
723
+ display: flex;
724
+ gap: 8px;
725
+ }
726
+
727
+ .thumbrow img {
728
+ flex: 1;
729
+ height: 86px;
730
+ object-fit: cover;
731
+ border-radius: 12px;
732
+ border: 1px solid rgba(255, 255, 255, .12);
733
+ background: rgba(0, 0, 0, .25);
734
+ }
735
+
736
+ .intelbox {
737
+ font-size: 12px;
738
+ line-height: 1.45;
739
+ color: rgba(255, 255, 255, .84);
740
+ background: rgba(0, 0, 0, .35);
741
+ border: 1px solid rgba(255, 255, 255, .12);
742
+ border-radius: 14px;
743
+ padding: 10px;
744
+ min-height: 72px;
745
+ }
746
+
747
+ /* =========================================
748
+ Tab Specific: Engage
749
+ ========================================= */
750
+
751
+ .engage-grid {
752
+ display: grid;
753
+ grid-template-columns: 4.5fr 0.5fr;
754
+ gap: 12px;
755
+ min-height: 0;
756
+ transition: grid-template-columns 0.3s ease;
757
+ }
758
+
759
+ .engage-grid.sidebar-collapsed {
760
+ grid-template-columns: 1fr 0fr;
761
+ }
762
+
763
+ .engage-grid.sidebar-collapsed .engage-right {
764
+ display: none;
765
+ }
766
+
767
+ .engage-right {
768
+ display: flex;
769
+ flex-direction: column;
770
+ gap: 12px;
771
+ min-height: 0;
772
+ max-width: 320px;
773
+ }
774
+
775
+ .radar {
776
+ height: 180px;
777
+ }
778
+
779
+ .strip {
780
+ display: flex;
781
+ gap: 8px;
782
+ flex-wrap: wrap;
783
+ align-items: center;
784
+ font-size: 12px;
785
+ color: var(--muted);
786
+ }
787
+
788
+ .strip .chip {
789
+ padding: 6px 10px;
790
+ border-radius: 999px;
791
+ border: 1px solid rgba(255, 255, 255, .12);
792
+ background: rgba(255, 255, 255, .03);
793
+ font-family: var(--mono);
794
+ color: rgba(255, 255, 255, .78);
795
+ }
796
+
797
+ .bar {
798
+ height: 10px;
799
+ border-radius: 999px;
800
+ background: rgba(255, 255, 255, .08);
801
+ border: 1px solid rgba(255, 255, 255, .12);
802
+ overflow: hidden;
803
+ }
804
+
805
+ .bar>div {
806
+ height: 100%;
807
+ width: 0%;
808
+ background: linear-gradient(90deg, rgba(34, 211, 238, .95), rgba(124, 58, 237, .95));
809
+ transition: width .18s ease;
810
+ }
811
+
812
+ /* =========================================
813
+ Tab Specific: Trade Space
814
+ ========================================= */
815
+
816
+ .trade-grid {
817
+ display: grid;
818
+ grid-template-columns: 1.35fr .65fr;
819
+ gap: 12px;
820
+ min-height: 0;
821
+ }
822
+
823
+ .plot {
824
+ height: 420px;
825
+ }
826
+
827
+ /* =========================================
828
+ Utilities
829
+ ========================================= */
830
+
831
+ ::-webkit-scrollbar {
832
+ width: 10px;
833
+ height: 10px;
834
+ }
835
+
836
+ ::-webkit-scrollbar-thumb {
837
+ background: rgba(255, 255, 255, .10);
838
+ border-radius: 999px;
839
+ border: 2px solid rgba(0, 0, 0, .25);
840
+ }
841
+
842
+ ::-webkit-scrollbar-thumb:hover {
843
+ background: rgba(255, 255, 255, .16);
844
+ }
LaserPerception/LaserPerception.html ADDED
@@ -0,0 +1,530 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <link rel="stylesheet" href="LaserPerception.css">
8
+ <title>HEL Perception & Engagement Reasoner (Weapon-Grade Demo)</title>
9
+ </head>
10
+
11
+ <body>
12
+ <div id="app">
13
+ <header>
14
+ <div class="brand">
15
+ <div class="logo" aria-hidden="true"></div>
16
+ <div>
17
+ <h1>HEL Perception & Engagement Reasoner</h1>
18
+ <div class="sub">Video → detection → expert features → aimpoint + Intensity@Target → HEL feasibility →
19
+ closed-loop tracking & dwell control</div>
20
+ </div>
21
+ </div>
22
+ <div class="status-row">
23
+ <div class="pill">
24
+ <span class="dot" id="sys-dot"></span>
25
+ <span id="sys-status">STANDBY · No video loaded</span>
26
+ </div>
27
+ <div class="pill">
28
+ <span class="kbd">Reason</span>
29
+ <span>Frame-1 inference</span>
30
+ </div>
31
+ <div class="pill">
32
+ <span class="kbd">Engage</span>
33
+ <span>Closed-loop track + dwell</span>
34
+ </div>
35
+ </div>
36
+ </header>
37
+
38
+ <div class="workspace">
39
+ <aside>
40
+ <div class="card">
41
+ <h2>Video Input</h2>
42
+ <div class="hint">Upload one video. Tab 1 uses only the first frame. Tab 2 reuses the same video for tracking
43
+ and engagement.</div>
44
+
45
+ <div class="row mt-md">
46
+ <label for="videoFile">Video file</label>
47
+ <span class="badge"><span id="videoMeta">No file</span></span>
48
+ </div>
49
+ <input id="videoFile" type="file" accept="video/*" />
50
+
51
+ <div class="mt-md">
52
+ <label>Mission Objective (optional · enables class filtering)</label>
53
+ <textarea id="missionText" rows="3"
54
+ placeholder="Optional: e.g., Detect people and vehicles; highlight hazards and key objects."></textarea>
55
+
56
+ <div class="hint mt-sm">
57
+ Mission objective is <b>optional</b>. If provided, it will be used directly as input to the detector.
58
+ If left blank, the detector will detect <b>all</b> objects without filtering.
59
+ <div class="mini mt-xs" id="hfBackendStatus">HF Backend: STANDBY</div>
60
+ </div>
61
+ </div>
62
+
63
+ <div class="btnrow">
64
+ <button id="btnLoadSample" class="btn secondary" title="Optional: wire up sample videos later" disabled>Load
65
+ Sample</button>
66
+ <button id="btnEject" class="btn danger" title="Unload video">Eject</button>
67
+ </div>
68
+
69
+ <div class="grid2">
70
+ <div>
71
+ <label>Detector</label>
72
+ <select id="detectorSelect">
73
+ <optgroup label="Object Detection Models">
74
+ <option value="hf_yolov8" data-kind="object" selected>Lite</option>
75
+ <option value="detr_resnet50" data-kind="object">Big</option>
76
+ <option value="grounding_dino" data-kind="object">Large</option>
77
+ </optgroup>
78
+ <optgroup label="Segmentation Models">
79
+ <option value="sam3" data-kind="segmentation">Segmentor</option>
80
+ </optgroup>
81
+ <optgroup label="Drone Detection Models">
82
+ <option value="drone_yolo" data-kind="drone">Drone</option>
83
+ </optgroup>
84
+ </select>
85
+ </div>
86
+ <div>
87
+ <label>Tracking</label>
88
+ <select id="trackerSelect">
89
+ <option value="iou">IOU + velocity (built-in)</option>
90
+ <option value="external">External hook (user API)</option>
91
+ </select>
92
+ </div>
93
+ </div>
94
+
95
+ <div class="hint mt-sm" id="detectorHint">
96
+ If the browser model cannot load (offline), plug in your own detector in <span
97
+ class="kbd">externalDetect()</span>.
98
+ </div>
99
+ </div>
100
+
101
+ <div class="card">
102
+ <h2>Mission Intel Summary</h2>
103
+ <div class="hint">Unbiased 2–3 sentence scene description computed from a few sampled frames + detected
104
+ objects (no location inference).</div>
105
+
106
+ <div class="intel">
107
+ <div class="intel-top">
108
+ <span class="badge"><span class="dot warn" id="intelDot"
109
+ style="width:7px;height:7px;box-shadow:none"></span><span id="intelStamp">Idle</span></span>
110
+ <button id="btnIntelRefresh" class="btn secondary"
111
+ style="padding:8px 10px; border-radius:10px; font-weight:700">Refresh</button>
112
+ </div>
113
+
114
+ <div class="thumbrow" aria-label="sampled frames">
115
+ <img id="intelThumb0" alt="sample frame 1" />
116
+ <img id="intelThumb1" alt="sample frame 2" />
117
+ <img id="intelThumb2" alt="sample frame 3" />
118
+ </div>
119
+
120
+ <div id="intelSummaryBox" class="intelbox">Upload a video, then click <b>Reason</b> to generate an unbiased
121
+ scene summary.</div>
122
+ </div>
123
+ </div>
124
+
125
+ <div class="card">
126
+ <h2>HEL & Director Knobs</h2>
127
+ <div class="grid2">
128
+ <div>
129
+ <label>Max output power (kW)</label>
130
+ <input id="helPower" type="range" min="20" max="250" step="1" value="60" />
131
+ <div class="row"><small class="mini"><span id="helPowerVal">60</span> kW</small><small class="mini">turret
132
+ output</small></div>
133
+ </div>
134
+ <div>
135
+ <label>Aperture (m)</label>
136
+ <input id="helAperture" type="range" min="0.05" max="0.6" step="0.01" value="0.25" />
137
+ <div class="row"><small class="mini"><span id="helApertureVal">0.25</span> m</small><small
138
+ class="mini">beam director</small></div>
139
+ </div>
140
+ </div>
141
+
142
+ <div class="grid2 mt-sm">
143
+ <div>
144
+ <label>Beam quality (M²)</label>
145
+ <input id="helM2" type="range" min="1.1" max="4.0" step="0.1" value="1.6" />
146
+ <div class="row"><small class="mini"><span id="helM2Val">1.6</span></small><small class="mini">lower is
147
+ better</small></div>
148
+ </div>
149
+ <div>
150
+ <label>Jitter (μrad RMS)</label>
151
+ <input id="helJitter" type="range" min="0.5" max="15" step="0.1" value="3.2" />
152
+ <div class="row"><small class="mini"><span id="helJitterVal">3.2</span></small><small
153
+ class="mini">director stability</small></div>
154
+ </div>
155
+ </div>
156
+
157
+ <div class="grid2 mt-sm">
158
+ <div>
159
+ <label>Mode</label>
160
+ <select id="helMode">
161
+ <option value="cw">CW (continuous)</option>
162
+ <option value="burst">Burst (duty-limited)</option>
163
+ <option value="pulse">Pulsed (peak shaping)</option>
164
+ </select>
165
+ </div>
166
+ <div>
167
+ <label>Duty cycle (%)</label>
168
+ <input id="helDuty" type="range" min="10" max="100" step="1" value="85" />
169
+ <div class="row"><small class="mini"><span id="helDutyVal">85</span>%</small><small class="mini">thermal /
170
+ power</small></div>
171
+ </div>
172
+ </div>
173
+ </div>
174
+
175
+ <div class="card">
176
+ <h2>Atmosphere & Maritime</h2>
177
+ <div class="grid2">
178
+ <div>
179
+ <label>Visibility (km)</label>
180
+ <input id="atmVis" type="range" min="1" max="30" step="1" value="16" />
181
+ <div class="row"><small class="mini"><span id="atmVisVal">16</span> km</small><small
182
+ class="mini">aerosol/haze</small></div>
183
+ </div>
184
+ <div>
185
+ <label>Turbulence (Cn²)</label>
186
+ <input id="atmCn2" type="range" min="1" max="10" step="1" value="5" />
187
+ <div class="row"><small class="mini"><span id="atmCn2Val">5</span>/10</small><small
188
+ class="mini">wavefront</small></div>
189
+ </div>
190
+ </div>
191
+
192
+ <div class="grid2 mt-sm">
193
+ <div>
194
+ <label>Sea spray</label>
195
+ <input id="seaSpray" type="range" min="0" max="10" step="1" value="2" />
196
+ <div class="row"><small class="mini"><span id="seaSprayVal">2</span>/10</small><small class="mini">salt
197
+ attenuation</small></div>
198
+ </div>
199
+ <div>
200
+ <label>Adaptive optics</label>
201
+ <input id="aoQ" type="range" min="0" max="10" step="1" value="7" />
202
+ <div class="row"><small class="mini"><span id="aoQVal">7</span>/10</small><small class="mini">turbulence
203
+ mitigation</small></div>
204
+ </div>
205
+ </div>
206
+
207
+ <div class="grid2 mt-sm">
208
+ <div>
209
+ <label>Baseline range (m)</label>
210
+ <input id="rangeBase" type="range" min="200" max="6000" step="25" value="1500" />
211
+ <div class="row"><small class="mini"><span id="rangeBaseVal">1500</span> m</small><small
212
+ class="mini">median target</small></div>
213
+ </div>
214
+ <div>
215
+ <label>Update rate (Hz)</label>
216
+ <input id="detHz" type="range" min="1" max="12" step="1" value="6" />
217
+ <div class="row"><small class="mini"><span id="detHzVal">6</span> Hz</small><small class="mini">tab 2
218
+ detection</small></div>
219
+ </div>
220
+ </div>
221
+ </div>
222
+
223
+ <div class="card">
224
+ <h2>Engagement Policy</h2>
225
+ <div class="grid2">
226
+ <div>
227
+ <label>Targeting</label>
228
+ <select id="policyMode">
229
+ <option value="auto">Auto: highest lethality margin</option>
230
+ <option value="manual">Manual: click target</option>
231
+ </select>
232
+ </div>
233
+ <div>
234
+ <label>Assess window (s)</label>
235
+ <input id="assessWindow" type="range" min="0.3" max="3.0" step="0.1" value="1.0" />
236
+ <div class="row"><small class="mini"><span id="assessWindowVal">1.0</span> s</small><small
237
+ class="mini">post-dwell</small></div>
238
+ </div>
239
+ </div>
240
+
241
+ <div class="row">
242
+ <label>Show agent cursor</label>
243
+ <select id="cursorMode">
244
+ <option value="on">On</option>
245
+ <option value="off">Off</option>
246
+ </select>
247
+ </div>
248
+
249
+ <div class="hint">The UI is wired for your APIs. Replace <span class="kbd">externalDetect()</span>, <span
250
+ class="kbd">externalFeatures()</span>, and <span class="kbd">externalTrack()</span> when ready.</div>
251
+ </div>
252
+
253
+ <div class="card" style="flex:1; min-height:0">
254
+ <h2>System Log</h2>
255
+ <div class="log" id="sysLog"></div>
256
+ </div>
257
+ </aside>
258
+
259
+ <main>
260
+ <div class="tabs">
261
+ <button class="tabbtn active" data-tab="frame">Tab 1 · Frame-1 Reason</button>
262
+ <button class="tabbtn" data-tab="engage">Tab 2 · Video Engage</button>
263
+ <button class="tabbtn" data-tab="trade">Trade Space</button>
264
+ </div>
265
+
266
+ <!-- ===== Tab 1 ===== -->
267
+ <section class="tab active" id="tab-frame">
268
+ <div class="frame-grid">
269
+ <div class="panel panel-monitor">
270
+ <h3>
271
+ <span>First Frame · Detection + Aimpoints</span>
272
+ <span class="rightnote" id="frameNote">Awaiting video</span>
273
+ </h3>
274
+ <div class="viewbox" id="frameViewBox">
275
+ <canvas id="frameCanvas" width="1280" height="720"></canvas>
276
+ <canvas id="frameOverlay" class="overlay" width="1280" height="720"></canvas>
277
+ <div class="watermark">EO/IR · Track-ID · Aimpoint · Required Dwell</div>
278
+ <div class="empty" id="frameEmpty">
279
+ <div class="big">Upload a video to begin</div>
280
+ <div class="small">This demo performs first-frame perception and engagement reasoning. Then it replays
281
+ the same video with closed-loop tracking and dynamic dwell updates.</div>
282
+ <div style="display:flex; gap:10px; margin-top:6px; flex-wrap:wrap; justify-content:center;">
283
+ <span class="badge"><span class="dot"></span> If you are online, COCO-SSD loads automatically</span>
284
+ </div>
285
+ </div>
286
+ </div>
287
+
288
+ <div class="btnrow" style="margin-top:10px">
289
+ <button id="btnReason" class="btn">Reason</button>
290
+ <button id="btnCancelReason" class="btn danger" style="display: none;">Cancel</button>
291
+ <button id="btnRecompute" class="btn secondary">Recompute HEL</button>
292
+ <button id="btnClear" class="btn secondary">Clear</button>
293
+ </div>
294
+ </div>
295
+
296
+ <div class="panel panel-objects">
297
+ <h3>
298
+ <span>Detected Objects</span>
299
+ <span class="rightnote" id="objCount">0</span>
300
+ </h3>
301
+ <div class="hint mt-xs">
302
+ Mission classes: <span class="kbd" id="missionClasses">—</span>
303
+ <div class="mini" id="missionId">Mission: —</div>
304
+ </div>
305
+ <div class="list" id="objList"></div>
306
+ </div>
307
+
308
+ <div class="panel panel-features">
309
+ <h3>
310
+ <span>Selected Target · Features</span>
311
+ <span class="rightnote" id="selId">—</span>
312
+ </h3>
313
+ <table class="table" id="featureTable">
314
+ <thead>
315
+ <tr>
316
+ <th style="width:42%">Feature</th>
317
+ <th>Value</th>
318
+ </tr>
319
+ </thead>
320
+ <tbody>
321
+ <tr>
322
+ <td class="k">—</td>
323
+ <td class="mini">No target selected</td>
324
+ </tr>
325
+ </tbody>
326
+ </table>
327
+ <div class="hint mt-sm">You can replace feature generation via <span
328
+ class="kbd">externalFeatures()</span>. The UI will render whatever 10–12 key-value pairs you return.
329
+ </div>
330
+ </div>
331
+
332
+ <div class="panel panel-summary">
333
+ <h3>
334
+ <span>HEL Summary Outputs</span>
335
+ <span class="rightnote" id="summaryStamp">—</span>
336
+ </h3>
337
+
338
+ <div class="metricgrid">
339
+ <div class="metric">
340
+ <div class="label">HEL Max power at target</div>
341
+ <div class="value" id="mMaxP">—</div>
342
+ <div class="sub" id="mMaxPSub">Propagation + beam control + duty cycle</div>
343
+ </div>
344
+ <div class="metric">
345
+ <div class="label">Worst-case required power</div>
346
+ <div class="value" id="mReqP">—</div>
347
+ <div class="sub" id="mReqPSub">From target robustness + reflectivity + aimpoint</div>
348
+ </div>
349
+ <div class="metric">
350
+ <div class="label">Feasibility margin</div>
351
+ <div class="value" id="mMargin">—</div>
352
+ <div class="sub" id="mMarginSub">Positive margin indicates viable engagement</div>
353
+ </div>
354
+ <div class="metric">
355
+ <div class="label">Recommended engagement</div>
356
+ <div class="value" id="mPlan">—</div>
357
+ <div class="sub" id="mPlanSub">Order + dwell window + assess</div>
358
+ </div>
359
+ </div>
360
+
361
+ <div class="scroll-table mt-md">
362
+ <table class="table" id="summaryTable">
363
+ <thead>
364
+ <tr>
365
+ <th style="width:9%">ID</th>
366
+ <th style="width:16%">Class</th>
367
+ <th style="width:14%">Range (m)</th>
368
+ <th style="width:16%">Aimpoint</th>
369
+ <th style="width:15%">Req P@Target</th>
370
+ <th style="width:15%">Max P@Target</th>
371
+ <th style="width:15%">Req Dwell</th>
372
+ <th style="width:10%">P(kill)</th>
373
+ </tr>
374
+ </thead>
375
+ <tbody>
376
+ <tr>
377
+ <td class="k">—</td>
378
+ <td colspan="7" class="mini">No outputs yet. Click <b>Reason</b>.</td>
379
+ </tr>
380
+ </tbody>
381
+ </table>
382
+ </div>
383
+ </div>
384
+ </div>
385
+ </section>
386
+
387
+ <!-- ===== Tab 2 ===== -->
388
+ <section class="tab" id="tab-engage">
389
+ <div class="engage-grid">
390
+ <div class="panel">
391
+ <h3>
392
+ <span>Video Engage · Tracking + Dynamic Dwell</span>
393
+ <div style="display: flex; gap: 8px; align-items: center;">
394
+ <button class="collapse-btn" id="btnToggleSidebar">◀ Hide Sidebar</button>
395
+ <span class="rightnote" id="engageNote">Awaiting video</span>
396
+ </div>
397
+ </h3>
398
+
399
+ <div class="viewbox" style="min-height: 650px;">
400
+ <video id="videoEngage" playsinline muted></video>
401
+ <canvas id="engageOverlay" class="overlay"></canvas>
402
+ <div class="watermark">LOCK · DIST · DWELL · AIMPOINT · FIRE/ASSESS</div>
403
+ <div class="empty" id="engageEmpty">
404
+ <div class="big">No video loaded</div>
405
+ <div class="small">Upload a video. Run <b>Reason</b> first to initialize aimpoints and baseline dwell.
406
+ Then click <b>Engage</b>.</div>
407
+ </div>
408
+ </div>
409
+
410
+ <div class="btnrow mt-md">
411
+ <button id="btnEngage" class="btn">Engage</button>
412
+ <button id="btnPause" class="btn secondary">Pause</button>
413
+ <button id="btnReset" class="btn secondary">Reset</button>
414
+ </div>
415
+
416
+ <div class="strip mt-md">
417
+ <span class="chip" id="chipPolicy">POLICY:AUTO</span>
418
+ <span class="chip" id="chipTracks">TRACKS:0</span>
419
+ <span class="chip" id="chipBeam">BEAM:OFF</span>
420
+ <span class="chip" id="chipHz">DET:6Hz</span>
421
+ <span class="chip" id="chipFeed" title="Toggle raw vs HF-processed feed (if available)">FEED:RAW</span>
422
+ </div>
423
+
424
+ <div class="mt-md">
425
+ <div class="row"><label>Active dwell progress (selected)</label><small class="mini"
426
+ id="dwellText">—</small></div>
427
+ <div class="bar">
428
+ <div id="dwellBar"></div>
429
+ </div>
430
+ </div>
431
+
432
+ <div class="hint mt-md">Manual targeting: choose “Manual” in Engagement Policy, then
433
+ click a target in the video. The “beam” will track its aimpoint and accumulate dwell.</div>
434
+ </div>
435
+
436
+ <div class="engage-right">
437
+ <div class="panel radar">
438
+ <h3>
439
+ <span>Radar / Relative Geometry</span>
440
+ <span class="rightnote">Dynamic</span>
441
+ </h3>
442
+ <canvas id="radarCanvas" width="600" height="260" class="full-size"></canvas>
443
+ </div>
444
+
445
+ <div class="panel" style="flex:1; min-height:0">
446
+ <h3>
447
+ <span>Live Track Cards</span>
448
+ <span class="rightnote" id="liveStamp">—</span>
449
+ </h3>
450
+ <div class="list" id="trackList" style="max-height:none"></div>
451
+ </div>
452
+ </div>
453
+ </div>
454
+ </section>
455
+
456
+ <!-- ===== Tab 3 ===== -->
457
+ <section class="tab" id="tab-trade">
458
+ <div class="trade-grid">
459
+ <div class="panel plot">
460
+ <h3>
461
+ <span>Range Sensitivity · Max vs Required Power · Dwell</span>
462
+ <span class="rightnote">Interactive</span>
463
+ </h3>
464
+ <canvas id="tradeCanvas" width="1100" height="420" class="full-size"></canvas>
465
+ </div>
466
+
467
+ <div class="panel">
468
+ <h3>
469
+ <span>Trade Controls</span>
470
+ <span class="rightnote">What-if</span>
471
+ </h3>
472
+ <div class="hint">This plot is computed from your current HEL and atmosphere knobs. It uses the selected
473
+ target’s baseline requirements (from Tab 1) as a reference curve.</div>
474
+
475
+ <div class="mt-md">
476
+ <label>Selected target for curve</label>
477
+ <select id="tradeTarget"></select>
478
+ </div>
479
+
480
+ <div class="grid2 mt-sm">
481
+ <div>
482
+ <label>Range sweep min (m)</label>
483
+ <input id="rMin" type="number" value="200" min="50" max="10000" step="50" />
484
+ </div>
485
+ <div>
486
+ <label>Range sweep max (m)</label>
487
+ <input id="rMax" type="number" value="6000" min="100" max="20000" step="50" />
488
+ </div>
489
+ </div>
490
+
491
+ <div class="row mt-md">
492
+ <label>Show P(kill)</label>
493
+ <select id="showPk">
494
+ <option value="on">On</option>
495
+ <option value="off">Off</option>
496
+ </select>
497
+ </div>
498
+
499
+ <div class="btnrow">
500
+ <button class="btn secondary" id="btnReplot">Replot</button>
501
+ <button class="btn secondary" id="btnSnap">Snapshot (log)</button>
502
+ </div>
503
+
504
+ <div class="hint">This tab is designed to look like a weapon trade-space console: propagation, lethality
505
+ margin, and dwell inflation with range and atmosphere.</div>
506
+ </div>
507
+ </div>
508
+ </section>
509
+ </main>
510
+ </div>
511
+
512
+ <footer>
513
+ <div>Demo mode · Unclassified visuals · Integrate your APIs where marked</div>
514
+ <div class="mono" id="telemetry">HEL=60kW · VIS=16km · Cn²=5/10 · AO=7/10 · DET=6Hz</div>
515
+ </footer>
516
+
517
+ <!-- Hidden video used only for first-frame capture -->
518
+ <video id="videoHidden" playsinline muted style="display:none"></video>
519
+ </div>
520
+
521
+ <script>
522
+ window.API_CONFIG = {
523
+ BACKEND_BASE: "https://biaslab2025-perception.hf.space"
524
+ };
525
+ </script>
526
+ <script src="LaserPerception.js"></script>
527
+
528
+ </body>
529
+
530
+ </html>
LaserPerception/LaserPerception.js ADDED
The diff for this file is too large to render. See raw diff
 
app.py CHANGED
@@ -12,6 +12,7 @@ import cv2
12
  from fastapi import BackgroundTasks, FastAPI, File, Form, HTTPException, UploadFile
13
  from fastapi.middleware.cors import CORSMiddleware
14
  from fastapi.responses import FileResponse, HTMLResponse, JSONResponse
 
15
  import uvicorn
16
 
17
  from inference import process_first_frame, run_inference, run_segmentation
@@ -52,6 +53,11 @@ app.add_middleware(
52
  allow_headers=["*"],
53
  )
54
 
 
 
 
 
 
55
  # Valid detection modes
56
  VALID_MODES = {"object_detection", "segmentation", "drone_detection"}
57
 
@@ -336,6 +342,25 @@ async def detect_status(job_id: str):
336
  }
337
 
338
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  @app.get("/detect/first-frame/{job_id}")
340
  async def detect_first_frame(job_id: str):
341
  job = get_job_storage().get(job_id)
@@ -355,6 +380,8 @@ async def detect_video(job_id: str):
355
  raise HTTPException(status_code=404, detail="Job not found or expired.")
356
  if job.status == JobStatus.FAILED:
357
  raise HTTPException(status_code=500, detail=f"Job failed: {job.error}")
 
 
358
  if job.status == JobStatus.PROCESSING:
359
  return JSONResponse(
360
  status_code=202,
 
12
  from fastapi import BackgroundTasks, FastAPI, File, Form, HTTPException, UploadFile
13
  from fastapi.middleware.cors import CORSMiddleware
14
  from fastapi.responses import FileResponse, HTMLResponse, JSONResponse
15
+ from fastapi.staticfiles import StaticFiles
16
  import uvicorn
17
 
18
  from inference import process_first_frame, run_inference, run_segmentation
 
53
  allow_headers=["*"],
54
  )
55
 
56
+ # Optional: serve the LaserPerception frontend from this backend.
57
+ _LASER_DIR = Path(__file__).with_name("LaserPerception")
58
+ if _LASER_DIR.exists():
59
+ app.mount("/laser", StaticFiles(directory=_LASER_DIR), name="laser")
60
+
61
  # Valid detection modes
62
  VALID_MODES = {"object_detection", "segmentation", "drone_detection"}
63
 
 
342
  }
343
 
344
 
345
+ @app.delete("/detect/job/{job_id}")
346
+ async def cancel_job(job_id: str):
347
+ """Cancel a running job."""
348
+ job = get_job_storage().get(job_id)
349
+ if not job:
350
+ raise HTTPException(status_code=404, detail="Job not found or expired.")
351
+ if job.status != JobStatus.PROCESSING:
352
+ return {
353
+ "message": f"Job already {job.status.value}",
354
+ "status": job.status.value,
355
+ }
356
+
357
+ get_job_storage().update(job_id, status=JobStatus.CANCELLED)
358
+ return {
359
+ "message": "Job cancellation requested",
360
+ "status": "cancelled",
361
+ }
362
+
363
+
364
  @app.get("/detect/first-frame/{job_id}")
365
  async def detect_first_frame(job_id: str):
366
  job = get_job_storage().get(job_id)
 
380
  raise HTTPException(status_code=404, detail="Job not found or expired.")
381
  if job.status == JobStatus.FAILED:
382
  raise HTTPException(status_code=500, detail=f"Job failed: {job.error}")
383
+ if job.status == JobStatus.CANCELLED:
384
+ raise HTTPException(status_code=410, detail="Job was cancelled")
385
  if job.status == JobStatus.PROCESSING:
386
  return JSONResponse(
387
  status_code=202,
inference.py CHANGED
@@ -9,6 +9,18 @@ from models.segmenters.model_loader import load_segmenter
9
  from utils.video import extract_frames, write_video
10
 
11
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  def _color_for_label(label: str) -> tuple[int, int, int]:
13
  # Deterministic BGR color from label text.
14
  value = abs(hash(label)) % 0xFFFFFF
@@ -251,6 +263,7 @@ def run_inference(
251
  queries: List[str],
252
  max_frames: Optional[int] = None,
253
  detector_name: Optional[str] = None,
 
254
  ) -> str:
255
  """
256
  Run object detection inference on a video.
@@ -261,6 +274,7 @@ def run_inference(
261
  queries: List of object classes to detect (e.g., ["person", "car"])
262
  max_frames: Optional frame limit for testing
263
  detector_name: Detector to use (default: hf_yolov8)
 
264
 
265
  Returns:
266
  Path to processed output video
@@ -285,6 +299,9 @@ def run_inference(
285
  # Process frames
286
  processed_frames: List[np.ndarray] = []
287
  for idx, frame in enumerate(frames):
 
 
 
288
  if max_frames is not None and idx >= max_frames:
289
  break
290
  logging.debug("Processing frame %d", idx)
@@ -304,6 +321,7 @@ def run_segmentation(
304
  queries: List[str],
305
  max_frames: Optional[int] = None,
306
  segmenter_name: Optional[str] = None,
 
307
  ) -> str:
308
  try:
309
  frames, fps, width, height = extract_frames(input_video_path)
@@ -316,6 +334,9 @@ def run_segmentation(
316
 
317
  processed_frames: List[np.ndarray] = []
318
  for idx, frame in enumerate(frames):
 
 
 
319
  if max_frames is not None and idx >= max_frames:
320
  break
321
  logging.debug("Processing frame %d", idx)
 
9
  from utils.video import extract_frames, write_video
10
 
11
 
12
+ def _check_cancellation(job_id: Optional[str]) -> None:
13
+ """Check if job has been cancelled and raise exception if so."""
14
+ if job_id is None:
15
+ return
16
+ from jobs.storage import get_job_storage
17
+ from jobs.models import JobStatus
18
+
19
+ job = get_job_storage().get(job_id)
20
+ if job and job.status == JobStatus.CANCELLED:
21
+ raise RuntimeError("Job cancelled by user")
22
+
23
+
24
  def _color_for_label(label: str) -> tuple[int, int, int]:
25
  # Deterministic BGR color from label text.
26
  value = abs(hash(label)) % 0xFFFFFF
 
263
  queries: List[str],
264
  max_frames: Optional[int] = None,
265
  detector_name: Optional[str] = None,
266
+ job_id: Optional[str] = None,
267
  ) -> str:
268
  """
269
  Run object detection inference on a video.
 
274
  queries: List of object classes to detect (e.g., ["person", "car"])
275
  max_frames: Optional frame limit for testing
276
  detector_name: Detector to use (default: hf_yolov8)
277
+ job_id: Optional job ID for cancellation support
278
 
279
  Returns:
280
  Path to processed output video
 
299
  # Process frames
300
  processed_frames: List[np.ndarray] = []
301
  for idx, frame in enumerate(frames):
302
+ # Check for cancellation every frame
303
+ _check_cancellation(job_id)
304
+
305
  if max_frames is not None and idx >= max_frames:
306
  break
307
  logging.debug("Processing frame %d", idx)
 
321
  queries: List[str],
322
  max_frames: Optional[int] = None,
323
  segmenter_name: Optional[str] = None,
324
+ job_id: Optional[str] = None,
325
  ) -> str:
326
  try:
327
  frames, fps, width, height = extract_frames(input_video_path)
 
334
 
335
  processed_frames: List[np.ndarray] = []
336
  for idx, frame in enumerate(frames):
337
+ # Check for cancellation every frame
338
+ _check_cancellation(job_id)
339
+
340
  if max_frames is not None and idx >= max_frames:
341
  break
342
  logging.debug("Processing frame %d", idx)
jobs/background.py CHANGED
@@ -22,6 +22,7 @@ async def process_video_async(job_id: str) -> None:
22
  job.queries,
23
  None,
24
  job.segmenter_name,
 
25
  )
26
  else:
27
  output_path = await asyncio.to_thread(
@@ -31,6 +32,7 @@ async def process_video_async(job_id: str) -> None:
31
  job.queries,
32
  None,
33
  job.detector_name,
 
34
  )
35
  storage.update(
36
  job_id,
@@ -38,6 +40,24 @@ async def process_video_async(job_id: str) -> None:
38
  completed_at=datetime.utcnow(),
39
  output_video_path=output_path,
40
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  except Exception as exc:
42
  logging.exception("Background processing failed for job %s", job_id)
43
  storage.update(
 
22
  job.queries,
23
  None,
24
  job.segmenter_name,
25
+ job_id,
26
  )
27
  else:
28
  output_path = await asyncio.to_thread(
 
32
  job.queries,
33
  None,
34
  job.detector_name,
35
+ job_id,
36
  )
37
  storage.update(
38
  job_id,
 
40
  completed_at=datetime.utcnow(),
41
  output_video_path=output_path,
42
  )
43
+ except RuntimeError as exc:
44
+ # Handle cancellation specifically
45
+ if "cancelled" in str(exc).lower():
46
+ logging.info("Job %s was cancelled", job_id)
47
+ storage.update(
48
+ job_id,
49
+ status=JobStatus.CANCELLED,
50
+ completed_at=datetime.utcnow(),
51
+ error="Cancelled by user",
52
+ )
53
+ else:
54
+ logging.exception("Background processing failed for job %s", job_id)
55
+ storage.update(
56
+ job_id,
57
+ status=JobStatus.FAILED,
58
+ completed_at=datetime.utcnow(),
59
+ error=str(exc),
60
+ )
61
  except Exception as exc:
62
  logging.exception("Background processing failed for job %s", job_id)
63
  storage.update(
jobs/models.py CHANGED
@@ -8,6 +8,7 @@ class JobStatus(str, Enum):
8
  PROCESSING = "processing"
9
  COMPLETED = "completed"
10
  FAILED = "failed"
 
11
 
12
 
13
  @dataclass
 
8
  PROCESSING = "processing"
9
  COMPLETED = "completed"
10
  FAILED = "failed"
11
+ CANCELLED = "cancelled"
12
 
13
 
14
  @dataclass