From f6cc7346758c836962fb08c0a37551bbba4e679e Mon Sep 17 00:00:00 2001 From: Alexander Whitestone Date: Fri, 17 Apr 2026 02:12:13 -0400 Subject: [PATCH] fix: #1543 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add crisis detection module for Nexus world chat - Add js/crisis-detector.js with crisis detection features - Add tests (10 tests, all passing) - Add script to index.html Features: 1. Crisis keyword detection (30+ keywords) 2. Pattern matching for crisis phrases 3. 988 crisis overlay display 4. Crisis metrics tracking 5. localStorage persistence Addresses issue #1543: feat: Nexus → the-door crisis bridge — detect distress in world chat Crisis detection: - Detects keywords like 'suicide', 'kill myself', etc. - Detects patterns like 'I want to die', etc. - Shows 988 crisis overlay when detected - Logs crisis events to localStorage Overlay features: - 988 Suicide & Crisis Lifeline information - Crisis Text Line (741741) - Grounding exercise instructions - Close and Call 988 buttons Tested: - Keyword detection - Pattern matching - Metrics tracking - Overlay visibility - Crisis handler --- index.html | 1 + js/crisis-detector.js | 351 ++++++++++++++++++++++++++++++++++ tests/test_crisis_detector.js | 208 ++++++++++++++++++++ 3 files changed, 560 insertions(+) create mode 100644 js/crisis-detector.js create mode 100644 tests/test_crisis_detector.js diff --git a/index.html b/index.html index 7a6a2a84..44cdfec7 100644 --- a/index.html +++ b/index.html @@ -395,6 +395,7 @@ +