File size: 29,341 Bytes
c8d30bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="zh-TW">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta name="description" content="ThreatHunter — 多 Agent 資安威脅情報平台,即時漏洞掃描與行動報告" />
  <title>ThreatHunter — Security Intelligence Platform</title>
  <link rel="stylesheet" href="/static/style.css?v=5.2" />
</head>
<body>
<div id="app">

  <!-- ── Header ──────────────────────────────────────── -->
  <header class="th-header">
    <div class="th-brand">
      <!-- Lucide Shield SVG (非 emoji) -->
      <svg class="th-logo-icon" xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
        <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
      </svg>
      <div>
        <div class="th-title">ThreatHunter</div>
        <div class="th-subtitle">Security Intelligence Platform</div>
      </div>
    </div>
    <nav class="th-nav">
      <a href="/checkpoints" class="nav-link" id="navCheckpoints">
        <!-- Lucide Database icon -->
        <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
          <ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>
          <path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>
        </svg>
        Checkpoints
      </a>
      <!-- v3.6: Thinking Path 永遠顯示,掃描前顯示最新 checkpoint -->
      <button id="btnThinking" class="nav-btn" onclick="openThinking()">
        <!-- Lucide GitBranch icon -->
        <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
          <line x1="6" y1="3" x2="6" y2="15"/><circle cx="18" cy="6" r="3"/>
          <circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>
        </svg>
        Thinking Path
        <span class="nav-btn-badge" id="thinkingBadgeNew" style="display:none">NEW</span>
      </button>
    </nav>
    <div class="th-status-wrap">
      <span id="statusDot" class="status-dot idle"></span>
      <span id="statusText" class="status-text">IDLE</span>
    </div>
    <!-- System Info Bar:GPU + Model 即時顯示 -->
    <div class="th-system-info" id="systemInfoBar">
      <div class="sys-chip sys-chip-gpu" id="sysGpuChip" title="GPU Provider">
        <!-- Lucide Cpu icon -->
        <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
          <rect x="4" y="4" width="16" height="16" rx="2" ry="2"/><rect x="9" y="9" width="6" height="6"/>
          <line x1="9" y1="1" x2="9" y2="4"/><line x1="15" y1="1" x2="15" y2="4"/>
          <line x1="9" y1="20" x2="9" y2="23"/><line x1="15" y1="20" x2="15" y2="23"/>
          <line x1="20" y1="9" x2="23" y2="9"/><line x1="20" y1="14" x2="23" y2="14"/>
          <line x1="1" y1="9" x2="4" y2="9"/><line x1="1" y1="14" x2="4" y2="14"/>
        </svg>
        <span id="sysGpuLabel">Checking...</span>
      </div>
      <div class="sys-chip sys-chip-model" id="sysModelChip" title="Active LLM Model">
        <!-- Lucide Brain icon -->
        <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
          <path d="M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24A2.5 2.5 0 0 1 9.5 2z"/>
          <path d="M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24A2.5 2.5 0 0 0 14.5 2z"/>
        </svg>
        <span id="sysModelLabel">Checking...</span>
      </div>
      <div class="sys-chip sys-chip-deg" id="sysDegChip" title="Degradation Level" style="display:none">
        <span id="sysDegLabel">L1</span>
      </div>
    </div>
  </header>

  <!-- ── Main ────────────────────────────────────────── -->
  <main>

    <!-- Input Card -->
    <div class="input-card">
      <div class="section-label">Target Input</div>
      <div class="input-area">
        <!-- 檔案上傳區 -->
        <div id="dropZone" class="drop-zone">
          <div class="drop-zone-content">
            <!-- Lucide Upload icon -->
            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="drop-icon-svg">
              <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
              <polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/>
            </svg>
            <span class="drop-text">Drop code files here</span>
            <span class="drop-divider">or</span>
            <label class="file-select-btn">
              Browse
              <input type="file" id="fileInput"
                accept=".py,.js,.ts,.java,.go,.php,.rb,.rs,.c,.cpp,.h,.txt,.yml,.yaml,.json,.toml,.xml"
                hidden />
            </label>
            <span class="drop-formats">.py .js .ts .java .go .php .c .cpp .rs</span>
          </div>
        </div>
        <!-- 程式碼 / 套件輸入 -->
        <textarea
          id="techStackInput"
          class="code-textarea"
          rows="6"
          placeholder="Paste code, tech stack, or config...&#10;&#10;  • Django 4.2, Redis 7.0, nginx 1.24&#10;  • import os; os.system(user_input)&#10;  • const app = require('express');"
          autocomplete="off"
          spellcheck="false"
        >Django 4.2, Redis 7.0</textarea>
        <div class="input-footer">
          <span id="inputTypeIndicator" class="type-indicator">Package List · Path A</span>
          <div class="input-actions">
            <button id="btnScan" class="btn btn-primary" onclick="startScan()">
              <!-- Lucide Zap icon -->
              <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
                <polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>
              </svg>
              Scan
            </button>
            <div class="example-dropdown-wrap">
              <button class="btn btn-ghost" onclick="toggleExampleMenu()">
                Examples
                <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <polyline points="6 9 12 15 18 9"/>
                </svg>
              </button>
              <div id="exampleMenu" class="example-dropdown hidden">
                <div class="example-item" onclick="loadExampleType('pkg')">
                  <span class="ex-tag">PKG</span> Tech Stack (Django)
                </div>
                <div class="example-item" onclick="loadExampleType('python')">
                  <span class="ex-tag">PY</span> Python — SQL Injection
                </div>
                <div class="example-item" onclick="loadExampleType('javascript')">
                  <span class="ex-tag">JS</span> JavaScript — XSS
                </div>
                <div class="example-item" onclick="loadExampleType('java')">
                  <span class="ex-tag">JV</span> Java — Deserialization
                </div>
                <div class="example-item" onclick="loadExampleType('go')">
                  <span class="ex-tag">GO</span> Go — Command Injection
                </div>
                <div class="example-item" onclick="loadExampleType('php')">
                  <span class="ex-tag">PHP</span> PHP — File Include
                </div>
                <div class="example-item" onclick="loadExampleType('injection')">
                  <span class="ex-tag ex-tag-warn">INJ</span> Prompt Injection Attack
                </div>
              </div>
            </div>
            <button id="btnClear" class="btn btn-ghost hidden" onclick="clearResults()">
              <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
                <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
              </svg>
              Clear
            </button>
          </div>
        </div>
      </div>
    </div>

    <!-- Pipeline Progress Bar -->
    <div id="pipelineBar" class="pipeline-bar hidden">
      <span id="stepOrchestrator" class="pipeline-step step-pending">Orch</span>
      <span class="step-arrow"></span>
      <div id="stepLayer1" class="pipeline-step pipeline-step-parallel step-pending">
        <span class="parallel-step-title">L1 Parallel</span>
        <span class="parallel-step-chips">
          <span id="stepChipSecurityGuard" class="parallel-step-chip state-pending">SG</span>
          <span id="stepChipScout" class="parallel-step-chip state-pending">SC</span>
        </span>
      </div>
      <span class="step-arrow"></span>
      <span id="stepIntelFusion" class="pipeline-step step-pending">Intel Fusion</span>
      <span class="step-arrow"></span>
      <span id="stepAnalyst" class="pipeline-step step-pending">Analyst</span>
      <span class="step-arrow"></span>
      <span id="stepCritic" class="pipeline-step step-pending">Critic</span>
      <span class="step-arrow"></span>
      <span id="stepAdvisor" class="pipeline-step step-pending">Advisor</span>
    </div>

    <div id="parallelVisualizer" class="parallel-visualizer hidden">
      <div class="parallel-visualizer-header">
        <div>
          <div class="parallel-visualizer-title">Layer 1 Parallel Runtime</div>
          <div id="parallelSummary" class="parallel-visualizer-subtitle">
            Security Guard and Scout discover in parallel, then feed Intel Fusion.
          </div>
        </div>
        <span id="parallelMergeBadge" class="parallel-merge-badge state-pending">SYNC PENDING</span>
      </div>

      <div class="parallel-lane-grid">
        <div id="laneSecurityGuard" class="parallel-lane state-pending">
          <div class="parallel-lane-top">
            <span class="parallel-lane-name">Security Guard</span>
            <span id="laneStatusSecurityGuard" class="parallel-lane-status">WAITING</span>
          </div>
          <div class="parallel-track">
            <span class="parallel-track-line"></span>
            <span class="parallel-packet packet-1"></span>
            <span class="parallel-packet packet-2"></span>
            <span class="parallel-packet packet-3"></span>
          </div>
          <div id="laneDetailSecurityGuard" class="parallel-lane-detail">Awaiting launch</div>
        </div>

        <div id="laneScout" class="parallel-lane state-pending">
          <div class="parallel-lane-top">
            <span class="parallel-lane-name">Scout</span>
            <span id="laneStatusScout" class="parallel-lane-status">WAITING</span>
          </div>
          <div class="parallel-track">
            <span class="parallel-track-line"></span>
            <span class="parallel-packet packet-1"></span>
            <span class="parallel-packet packet-2"></span>
            <span class="parallel-packet packet-3"></span>
          </div>
          <div id="laneDetailScout" class="parallel-lane-detail">Awaiting launch</div>
        </div>
      </div>

      <div class="parallel-merge-row">
        <div id="parallelMergeNode" class="parallel-merge-node state-pending">Awaiting discovery merge</div>
      </div>
    </div>

    <!-- Agent Status Cards -->
    <div id="agentGrid" class="agent-grid hidden">
      <!-- Row 1 -->
      <div class="agent-card" id="cardOrchestrator">
        <div class="agent-icon-wrap">
          <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
            <circle cx="12" cy="12" r="3"/><path d="M12 1v4M12 19v4M4.22 4.22l2.83 2.83M16.95 16.95l2.83 2.83M1 12h4M19 12h4M4.22 19.78l2.83-2.83M16.95 7.05l2.83-2.83"/>
          </svg>
        </div>
        <div class="agent-info">
          <div class="agent-name">Orchestrator</div>
          <div class="agent-role">動態路由決策</div>
        </div>
        <div class="agent-status-wrap">
          <span class="agent-status pending" id="statusOrchestrator">WAITING</span>
          <div class="agent-detail" id="detailOrchestrator"></div>
        </div>
      </div>
      <div class="agent-card parallel-agent" id="cardSecurityGuard">
        <div class="agent-icon-wrap">
          <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
            <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
            <path d="M7 11V7a5 5 0 0 1 10 0v4"/>
          </svg>
        </div>
        <div class="agent-info">
          <div class="agent-name">Security Guard</div>
          <div class="agent-role">Code weakness discovery</div>
        </div>
        <div class="agent-status-wrap">
          <span class="agent-status pending" id="statusSecurityGuard">WAITING</span>
          <div class="agent-detail" id="detailSecurityGuard"></div>
        </div>
      </div>
      <div class="agent-card parallel-agent" id="cardIntelFusion">
        <div class="agent-icon-wrap">
          <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
            <path d="M12 2a10 10 0 0 1 10 10c0 5.52-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2z"/>
            <path d="M12 8v4l3 3"/>
          </svg>
        </div>
        <div class="agent-info">
          <div class="agent-name">Intel Fusion</div>
          <div class="agent-role">Risk fusion after discovery</div>
        </div>
        <div class="agent-status-wrap">
          <span class="agent-status pending" id="statusIntelFusion">WAITING</span>
          <div class="agent-detail" id="detailIntelFusion"></div>
        </div>
      </div>
      <!-- Row 2 -->
      <div class="agent-card" id="cardScout">
        <div class="agent-icon-wrap">
          <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
            <circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
          </svg>
        </div>
        <div class="agent-info">
          <div class="agent-name">Scout</div>
          <div class="agent-role">Package CVE discovery</div>
        </div>
        <div class="agent-status-wrap">
          <span class="agent-status pending" id="statusScout">WAITING</span>
          <div class="agent-detail" id="detailScout"></div>
        </div>
      </div>
      <div class="agent-card" id="cardAnalyst">
        <div class="agent-icon-wrap">
          <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
            <path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/>
            <path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/>
          </svg>
        </div>
        <div class="agent-info">
          <div class="agent-name">Analyst</div>
          <div class="agent-role">漏洞連鎖分析</div>
        </div>
        <div class="agent-status-wrap">
          <span class="agent-status pending" id="statusAnalyst">WAITING</span>
          <div class="agent-detail" id="detailAnalyst"></div>
        </div>
      </div>
      <div class="agent-card" id="cardCritic">
        <div class="agent-icon-wrap">
          <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
            <polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>
          </svg>
        </div>
        <div class="agent-info">
          <div class="agent-name">Critic</div>
          <div class="agent-role">ColMAD 辯論</div>
        </div>
        <div class="agent-status-wrap">
          <span class="agent-status pending" id="statusCritic">WAITING</span>
          <div class="agent-detail" id="detailCritic"></div>
        </div>
      </div>
      <div class="agent-card" id="cardAdvisor">
        <div class="agent-icon-wrap">
          <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
            <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
            <polyline points="14 2 14 8 20 8"/>
            <line x1="16" y1="13" x2="8" y2="13"/>
            <line x1="16" y1="17" x2="8" y2="17"/>
            <polyline points="10 9 9 9 8 9"/>
          </svg>
        </div>
        <div class="agent-info">
          <div class="agent-name">Advisor</div>
          <div class="agent-role">行動報告生成</div>
        </div>
        <div class="agent-status-wrap">
          <span class="agent-status pending" id="statusAdvisor">WAITING</span>
          <div class="agent-detail" id="detailAdvisor"></div>
        </div>
      </div>
    </div>

    <!-- Live Monitor + Meta -->
    <div id="monitorLayout" class="monitor-layout hidden">
      <div>
        <div class="section-label">Live Monitor</div>
        <div id="logPanel" class="log-panel">
          <div class="log-empty">Waiting for scan...</div>
        </div>
      </div>
      <div>
        <div class="section-label">Pipeline Meta</div>
        <div id="metaPanel" class="meta-side">
          <div class="meta-row"><span class="meta-label">Status</span><span class="meta-value" id="metaStatus"></span></div>
          <div class="meta-row"><span class="meta-label">Tech Stack</span><span class="meta-value" id="metaTech"></span></div>
          <div class="meta-row"><span class="meta-label">Pipeline Ver</span><span class="meta-value" id="metaVersion"></span></div>
          <div class="meta-row"><span class="meta-label">Scan Path</span><span class="meta-value" id="metaScanPath"></span></div>
          <div class="meta-row"><span class="meta-label">Duration</span><span class="meta-value" id="metaDuration"></span></div>
          <div class="meta-row"><span class="meta-label">Critic Verdict</span><span class="meta-value" id="metaVerdict"></span></div>
          <div class="meta-row"><span class="meta-label">Critic Score</span><span class="meta-value" id="metaScore"></span></div>
          <div class="meta-row"><span class="meta-label">Degradation</span><span class="meta-value" id="metaDeg"></span></div>
        </div>
        <div class="section-label runtime-label">Runtime Protection</div>
        <div id="runtimeProtectionPanel" class="runtime-panel">
          <div class="runtime-row" id="runtimeCheckpointRow">
            <span class="runtime-name">Rust Checkpoint Writer</span>
            <span class="runtime-badge state-loading" id="runtimeCheckpoint">CHECKING</span>
          </div>
          <div class="runtime-row" id="runtimeWasmRow">
            <span class="runtime-name">WASM Prompt Sandbox</span>
            <span class="runtime-badge state-loading" id="runtimeWasm">CHECKING</span>
          </div>
          <div class="runtime-row" id="runtimeDockerRow">
            <span class="runtime-name">Docker Sandbox</span>
            <span class="runtime-badge state-loading" id="runtimeDocker">CHECKING</span>
          </div>
          <div class="runtime-row" id="runtimeMemoryRow">
            <span class="runtime-name">Memory Sanitizer</span>
            <span class="runtime-badge state-loading" id="runtimeMemory">CHECKING</span>
          </div>
          <div class="runtime-row" id="runtimeAstRow">
            <span class="runtime-name">AST Guard</span>
            <span class="runtime-badge state-loading" id="runtimeAst">CHECKING</span>
          </div>
          <div class="runtime-note" id="runtimeProtectionNote">Runtime capability check runs automatically.</div>
        </div>
      </div>
    </div>

    <!-- Error Banner -->
    <div id="errorBanner" class="error-banner hidden"></div>

    <!-- Success Banner -->
    <div id="successBanner" class="success-banner hidden"></div>

    <!-- ── Report Section ──────────────────────────── -->
    <div id="reportSection" class="hidden">

      <!-- Executive Summary -->
      <div class="section-label">Executive Summary</div>
      <div class="exec-summary">
        <div class="exec-text" id="execSummary"></div>
      </div>

      <div class="section-label">Result Lineage</div>
      <div id="resultLineage" class="result-lineage">
        <div id="resultSourceChips" class="lineage-chip-row">
          <span class="lineage-chip neutral">Awaiting scan result</span>
        </div>
        <div id="resultLineageNote" class="lineage-note">
          Scan-scoped evidence lineage will appear here after the pipeline completes.
        </div>
      </div>

      <!-- Metric Cards -->
      <div class="metric-grid" id="metricGrid">
        <div class="metric-card metric-critical">
          <div class="metric-value" id="mCritical">0</div>
          <div class="metric-label">Critical</div>
        </div>
        <div class="metric-card metric-high">
          <div class="metric-value" id="mHigh">0</div>
          <div class="metric-label">High</div>
        </div>
        <div class="metric-card metric-score">
          <div class="metric-value" id="mRisk">0</div>
          <div class="metric-label">Risk Score</div>
        </div>
        <div class="metric-card metric-new">
          <div class="metric-value" id="mNew">0</div>
          <div class="metric-label">External CVEs</div>
        </div>
        <div class="metric-card metric-code">
          <div class="metric-value" id="mCodeFindings">0</div>
          <div class="metric-label">Code Findings</div>
        </div>
        <div class="metric-card metric-cwe">
          <div class="metric-value" id="mCweCategories">0</div>
          <div class="metric-label">CWE Categories</div>
        </div>
        <div class="metric-card metric-secret">
          <div class="metric-value" id="mSecretFindings">0</div>
          <div class="metric-label">Hardcoded Secrets</div>
        </div>
      </div>

      <!-- Package / Code Split -->
      <div class="scan-split-grid" id="scanSplitGrid">
        <div class="scan-split-card scan-package-card">
          <div class="scan-split-header">
            <div>
              <div class="scan-split-kicker">Scout + Intel Fusion</div>
              <div class="scan-split-title">Package Scan Vulnerabilities</div>
            </div>
            <span id="packageScanCount" class="scan-count-pill">0 items</span>
          </div>
          <div id="packageScanSummary" class="scan-split-summary">External CVE/GHSA intelligence appears here.</div>
          <div id="packageScanList" class="scan-split-body">
            <div class="report-empty">No package vulnerabilities</div>
          </div>
        </div>
        <div class="scan-split-card scan-code-card">
          <div class="scan-split-header">
            <div>
              <div class="scan-split-kicker">Security Guard</div>
              <div class="scan-split-title">Code Scan Vulnerabilities</div>
            </div>
            <span id="codeScanCount" class="scan-count-pill">0 findings</span>
          </div>
          <div id="codeScanSummary" class="scan-split-summary">Source-code CWE findings appear here.</div>
          <div id="codeScanList" class="scan-split-body">
            <div class="report-empty">No code vulnerabilities</div>
          </div>
        </div>
      </div>

      <!-- Action Report -->
      <div class="report-grid">
        <div class="report-card">
          <div class="report-card-header header-urgent">URGENT — Immediate Action Required</div>
          <div class="report-card-body" id="urgentList">
            <div class="report-empty">No urgent items</div>
          </div>
        </div>
        <div class="report-card">
          <div class="report-card-header header-important">IMPORTANT — Address Within 72h</div>
          <div class="report-card-body" id="importantList">
            <div class="report-empty">No important items</div>
          </div>
        </div>
      </div>

      <!-- Resolved + CVEs -->
      <div class="report-grid">
        <div class="report-card">
          <div class="report-card-header header-resolved">RESOLVED — Verified Fixed</div>
          <div class="report-card-body" id="resolvedList">
            <div class="report-empty">No resolved items</div>
          </div>
        </div>
        <div class="report-card">
          <div class="report-card-header header-cve">CVE INTELLIGENCE</div>
          <div class="report-card-body" style="padding:0;">
            <table class="cve-table">
              <thead>
                <tr>
                  <th>CVE ID</th>
                  <th>Package</th>
                  <th style="text-align:center">CVSS</th>
                  <th>Severity</th>
                  <th>Description</th>
                </tr>
              </thead>
              <tbody id="cveTableBody"></tbody>
            </table>
          </div>
        </div>
      </div>

      <!-- Vulnerability Glossary -->
      <div class="section-label">VULNERABILITY GLOSSARY</div>
      <div id="vulnGlossary" class="vuln-glossary">
        <div class="report-empty">Run a scan to see CWE, CVSS, and NVD explanations.</div>
      </div>

      <!-- Security Guard: Code Pattern CWE Evidence -->
      <div id="codePatternsCWESection" style="display:none;margin-top:1.5rem;">
        <div class="report-card" style="border:1px solid rgba(248,81,73,0.3);background:rgba(248,81,73,0.04);">
          <div class="report-card-header" style="background:rgba(248,81,73,0.12);color:#f85149;display:flex;align-items:center;gap:0.5rem;">
            <span>🛡️ SECURITY GUARD</span>
            <span style="font-size:0.75rem;font-weight:400;color:#8b949e;">— Source Code Vulnerability Analysis with</span>
            <span style="font-size:0.75rem;font-weight:600;color:#58a6ff;">MITRE CWE v4.14 Evidence</span>
            <span id="codePatternsCWEBadge" style="margin-left:auto;background:rgba(248,81,73,0.15);border:1px solid rgba(248,81,73,0.4);color:#f85149;border-radius:4px;padding:1px 8px;font-size:0.72rem;"></span>
          </div>
          <div class="report-card-body" id="codePatternsCWEList">
            <div style="color:var(--text-dim);font-size:0.8rem;padding:0.5rem;">Scanning...</div>
          </div>
        </div>
      </div>


    </div><!-- /reportSection -->

  </main>

  <footer class="th-footer">ThreatHunter v3.6 · Harness Engineering Architecture · Multi-Agent Pipeline</footer>
</div>

<!-- Thinking Path Drawer -->
<div id="thinkingOverlay" class="tp-overlay hidden" onclick="closeThinking()"></div>
<aside id="thinkingDrawer" class="tp-drawer hidden" role="complementary" aria-label="Thinking Path">
  <div class="tp-drawer-header">
    <div class="tp-drawer-title">
      <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
        <line x1="6" y1="3" x2="6" y2="15"/><circle cx="18" cy="6" r="3"/>
        <circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>
      </svg>
      Thinking Path
    </div>
    <div class="tp-drawer-meta" id="thinkingMeta">No scan loaded</div>
    <button class="tp-close-btn" onclick="closeThinking()" aria-label="Close">
      <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
        <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
      </svg>
    </button>
  </div>
  <div class="tp-drawer-body">
    <div id="thinkingContent" class="tp-content">
      <div class="tp-loading" id="thinkingLoading">
        <div class="tp-spinner"></div>
        <span>Loading thinking path...</span>
      </div>
    </div>
  </div>
</aside>

<script src="/static/app.js?v=5.2"></script>
</body>
</html>