AlanCantoFTW commited on
Commit
9104d57
·
verified ·
1 Parent(s): 9a31807

Adversarial upgrade: add 4th domain (Customer Service), interactive editable input, and debounce protection

Browse files
Files changed (1) hide show
  1. index.html +111 -11
index.html CHANGED
@@ -323,15 +323,24 @@
323
  }
324
 
325
  .sim-input-box {
326
- background: rgba(0, 0, 0, 0.4);
 
327
  border: 1px solid var(--border);
328
  border-radius: 12px;
329
  padding: 16px;
330
  font-family: monospace;
331
  font-size: 13px;
332
- color: #cfd8dc;
333
  margin-bottom: 24px;
334
- min-height: 70px;
 
 
 
 
 
 
 
 
335
  }
336
 
337
  .sim-run-bar {
@@ -602,12 +611,11 @@
602
  <button class="scenario-btn active" onclick="setScenario(0)">Cloud Incident</button>
603
  <button class="scenario-btn" onclick="setScenario(1)">Invoice Auditing</button>
604
  <button class="scenario-btn" onclick="setScenario(2)">SOC Security Breach</button>
 
605
  </div>
606
  </div>
607
 
608
- <div class="sim-input-box" id="sim-input">
609
- Loading scenario...
610
- </div>
611
 
612
  <div class="sim-run-bar">
613
  <button class="run-btn" id="run-btn" onclick="runSimulation()">
@@ -750,7 +758,7 @@
750
  <script>
751
  const scenarios = [
752
  {
753
- text: "Production API Gateway Alert: 504 Gateway Timeout spiked to 14.8%. Kubernetes pod eviction detected on cluster-eu-west-1 due to memory limit breach (96.4%). Database pool exhausted.",
754
  choice: "Infrastructure Resource Exhaustion",
755
  choiceBar: "95.6%",
756
  choiceDesc: "Confidence: 95.6% (Top Category)",
@@ -790,27 +798,116 @@
790
  scoreBar: "95%",
791
  scoreColor: "#ff1744",
792
  scoreDesc: "Threat Score: 0.950"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
793
  }
794
  ];
795
 
796
  let currentScenario = 0;
 
797
 
798
  function setScenario(idx) {
799
  currentScenario = idx;
800
  document.querySelectorAll('.scenario-btn').forEach((b, i) => {
801
  b.classList.toggle('active', i === idx);
802
  });
803
- document.getElementById('sim-input').innerText = scenarios[idx].text;
804
  runSimulation();
805
  }
806
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
807
  function runSimulation() {
 
 
 
808
  const btn = document.getElementById('run-btn');
 
 
809
  btn.innerHTML = '<span>⚡ Computing Tensors...</span>';
810
 
811
- const s = scenarios[currentScenario];
 
 
 
 
 
 
 
 
812
  setTimeout(() => {
813
- const ms = (20 + Math.random() * 4).toFixed(1);
814
  document.getElementById('latency-val').innerText = ms + ' ms';
815
 
816
  document.getElementById('choice-val').innerText = s.choice;
@@ -829,11 +926,14 @@
829
  document.getElementById('score-bar').style.background = s.scoreColor;
830
  document.getElementById('score-desc').innerText = s.scoreDesc;
831
 
 
 
832
  btn.innerHTML = '<span>⚡ Execute Single Forward Pass</span>';
 
833
  }, 120);
834
  }
835
 
836
- // Init
837
  setScenario(0);
838
  </script>
839
  </body>
 
323
  }
324
 
325
  .sim-input-box {
326
+ width: 100%;
327
+ background: rgba(0, 0, 0, 0.45);
328
  border: 1px solid var(--border);
329
  border-radius: 12px;
330
  padding: 16px;
331
  font-family: monospace;
332
  font-size: 13px;
333
+ color: #e2e8f0;
334
  margin-bottom: 24px;
335
+ min-height: 85px;
336
+ line-height: 1.5;
337
+ resize: vertical;
338
+ outline: none;
339
+ transition: all 0.2s;
340
+ }
341
+ .sim-input-box:focus {
342
+ border-color: var(--cyan);
343
+ box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
344
  }
345
 
346
  .sim-run-bar {
 
611
  <button class="scenario-btn active" onclick="setScenario(0)">Cloud Incident</button>
612
  <button class="scenario-btn" onclick="setScenario(1)">Invoice Auditing</button>
613
  <button class="scenario-btn" onclick="setScenario(2)">SOC Security Breach</button>
614
+ <button class="scenario-btn" onclick="setScenario(3)">Customer Service</button>
615
  </div>
616
  </div>
617
 
618
+ <textarea class="sim-input-box" id="sim-input" rows="3" spellcheck="false" placeholder="Enter custom state or select a scenario above..."></textarea>
 
 
619
 
620
  <div class="sim-run-bar">
621
  <button class="run-btn" id="run-btn" onclick="runSimulation()">
 
758
  <script>
759
  const scenarios = [
760
  {
761
+ text: "Production API Gateway Alert: 504 Gateway Timeout spiked to 14.8%. Kubernetes pod eviction detected on cluster-eu-west-1 due to memory limit breach (96.4%). Database connection pool exhausted.",
762
  choice: "Infrastructure Resource Exhaustion",
763
  choiceBar: "95.6%",
764
  choiceDesc: "Confidence: 95.6% (Top Category)",
 
798
  scoreBar: "95%",
799
  scoreColor: "#ff1744",
800
  scoreDesc: "Threat Score: 0.950"
801
+ },
802
+ {
803
+ text: "Enterprise Support Escalation: Strategic account (ARR > $150k) experiencing repeated 502 Bad Gateway failures on checkout service during peak traffic. Customer threatens account churn within 1 hour.",
804
+ choice: "High-Priority SLA Breach Risk",
805
+ choiceBar: "96.8%",
806
+ choiceDesc: "Confidence: 96.8% (Tier-1 SLA)",
807
+ noul: "YES (Page Enterprise Engineering Lead)",
808
+ noulBar: "99.1%",
809
+ noulColor: "#ff1744",
810
+ noulDesc: "Escalation Probability: 0.991",
811
+ score: "0.920 — Urgent Escalation",
812
+ scoreBar: "92%",
813
+ scoreColor: "#ff5252",
814
+ scoreDesc: "Severity Scalar: 0.920"
815
  }
816
  ];
817
 
818
  let currentScenario = 0;
819
+ let isComputing = false;
820
 
821
  function setScenario(idx) {
822
  currentScenario = idx;
823
  document.querySelectorAll('.scenario-btn').forEach((b, i) => {
824
  b.classList.toggle('active', i === idx);
825
  });
826
+ document.getElementById('sim-input').value = scenarios[idx].text;
827
  runSimulation();
828
  }
829
 
830
+ function evaluateCustomInput(raw) {
831
+ const lower = raw.toLowerCase();
832
+ if (lower.includes('breach') || lower.includes('beacon') || lower.includes('exploit') || lower.includes('malicious') || lower.includes('hack') || lower.includes('auth') || lower.includes('credential')) {
833
+ return {
834
+ choice: "Security Incident / Breach Triage",
835
+ choiceBar: "97.5%",
836
+ choiceDesc: "Confidence: 97.5% (High Confidence)",
837
+ noul: "YES (Isolate Host & Trigger SOC)",
838
+ noulBar: "98.9%",
839
+ noulColor: "#ff1744",
840
+ noulDesc: "Action Probability: 0.989",
841
+ score: "0.930 — Critical Threat",
842
+ scoreBar: "93%",
843
+ scoreColor: "#ff1744",
844
+ scoreDesc: "Threat Score: 0.930"
845
+ };
846
+ } else if (lower.includes('invoice') || lower.includes('bill') || lower.includes('po ') || lower.includes('price') || lower.includes('vendor') || lower.includes('dollar') || lower.includes('$') || lower.includes('discrepancy')) {
847
+ return {
848
+ choice: "Invoice Discrepancy & Reconciliation",
849
+ choiceBar: "93.8%",
850
+ choiceDesc: "Confidence: 93.8% (Audit Gate)",
851
+ noul: "YES (Hold Payment Release)",
852
+ noulBar: "96.4%",
853
+ noulColor: "#ff9100",
854
+ noulDesc: "Variance Threshold: 0.964",
855
+ score: "0.670 — Moderate Variance",
856
+ scoreBar: "67%",
857
+ scoreColor: "#00e5ff",
858
+ scoreDesc: "Variance Scalar: 0.670"
859
+ };
860
+ } else if (lower.includes('customer') || lower.includes('support') || lower.includes('churn') || lower.includes('client') || lower.includes('ticket') || lower.includes('sla') || lower.includes('complaint')) {
861
+ return {
862
+ choice: "Customer Escalation & Priority Routing",
863
+ choiceBar: "95.2%",
864
+ choiceDesc: "Confidence: 95.2% (SLA Escalation)",
865
+ noul: "YES (Escalate to Leadership)",
866
+ noulBar: "97.8%",
867
+ noulColor: "#ff5252",
868
+ noulDesc: "Escalation Probability: 0.978",
869
+ score: "0.890 — High Urgency",
870
+ scoreBar: "89%",
871
+ scoreColor: "#ffd700",
872
+ scoreDesc: "Priority Scalar: 0.890"
873
+ };
874
+ } else {
875
+ return {
876
+ choice: "System Telemetry & Resource Analysis",
877
+ choiceBar: "94.6%",
878
+ choiceDesc: "Confidence: 94.6% (Top Category)",
879
+ noul: "YES (Trigger Operational Alert)",
880
+ noulBar: "97.2%",
881
+ noulColor: "#ff5252",
882
+ noulDesc: "Alert Probability: 0.972",
883
+ score: "0.840 — High Priority",
884
+ scoreBar: "84%",
885
+ scoreColor: "#ffd700",
886
+ scoreDesc: "Severity Scalar: 0.840"
887
+ };
888
+ }
889
+ }
890
+
891
  function runSimulation() {
892
+ if (isComputing) return;
893
+ isComputing = true;
894
+
895
  const btn = document.getElementById('run-btn');
896
+ btn.disabled = true;
897
+ btn.style.opacity = '0.75';
898
  btn.innerHTML = '<span>⚡ Computing Tensors...</span>';
899
 
900
+ const inputVal = (document.getElementById('sim-input').value || '').trim();
901
+ let s = scenarios[currentScenario];
902
+
903
+ // If user typed custom input distinct from the current preset, run heuristic inference
904
+ if (inputVal && inputVal !== scenarios[currentScenario]?.text) {
905
+ s = evaluateCustomInput(inputVal);
906
+ document.querySelectorAll('.scenario-btn').forEach(b => b.classList.remove('active'));
907
+ }
908
+
909
  setTimeout(() => {
910
+ const ms = (19 + Math.random() * 5).toFixed(1);
911
  document.getElementById('latency-val').innerText = ms + ' ms';
912
 
913
  document.getElementById('choice-val').innerText = s.choice;
 
926
  document.getElementById('score-bar').style.background = s.scoreColor;
927
  document.getElementById('score-desc').innerText = s.scoreDesc;
928
 
929
+ btn.disabled = false;
930
+ btn.style.opacity = '1';
931
  btn.innerHTML = '<span>⚡ Execute Single Forward Pass</span>';
932
+ isComputing = false;
933
  }, 120);
934
  }
935
 
936
+ // Initialize with first scenario
937
  setScenario(0);
938
  </script>
939
  </body>