feat: matrix/graph data views, wire-generated anomalies, http cookie fix

- auth: session cookie Secure only over https — plain-http LAN access was
  silently dropping the cookie, killing WS auth ('connection unstable')
- wire ghost: server-side spike detection on jitter baseline (3σ + 2.5×mean,
  20KB/s floor, 20s throttle) — wire anomalies now flood every session with
  zero hardware, pushed to clients as {type:'anomaly'} frames
- telemetry cadence 3-5s for live graphs; ambient whispers unchanged
- frontend: MATRIX view (data-rain interleaved with live utterances/anomaly/
  telemetry strings), GRAPHS view (scrolling jitter/variance/dns lines +
  anomaly markers + counters), BOARD/MATRIX/GRAPHS switcher
- connection banner: 'connecting' is now neutral 'tuning the veil…', only
  unstable/closed warns
- db: recreated quantumancy(+_test) as UTF8 (was SQL_ASCII — crashed on
  non-ASCII spirit text); README quickstart updated
- i18n: seance.views.* EN/ES
This commit is contained in:
Indiana
2026-07-21 00:02:41 +00:00
parent 6edbbbbc2a
commit c372427ced
16 changed files with 1086 additions and 16 deletions

View File

@@ -111,3 +111,24 @@ async def sample_network(period_s: float = 1.0) -> TelemetrySample:
if dns_times:
sample.dns_ms = sum(dns_times) / len(dns_times)
return sample
def detect_wire_spike(
history: list[float], current: float, *, min_samples: int = 6
) -> float | None:
"""Return the spike ratio when `current` is anomalous vs the rolling
baseline of jitter samples — the Wire Ghost noticing something move.
Three guards so idle-hour noise doesn't cry ghost: enough history to
have a baseline, an absolute floor (20 KB/s) so near-silent links stay
silent, and a statistical (3σ) + relative (2.5× mean) threshold.
"""
if len(history) < min_samples:
return None
mean = sum(history) / len(history)
if mean <= 0 or current <= 20_000:
return None
std = (sum((x - mean) ** 2 for x in history) / len(history)) ** 0.5
if current > mean + 3 * std and current > mean * 2.5:
return current / mean
return None