feat: possession presentation layer — glitchy text + degraded audio

First sub-project of the "make contact feel real" arc (spec:
docs/superpowers/specs/2026-07-23-possession-presentation-design.md).
Direct Contact replies now feel like a spirit fighting through static to
hold the channel rather than a plain chat bubble:

- backend/app/possession.py: compute_stability(rarity, magnitude, rng) —
  a 0.05-0.98 score per reply (rarer entity + stronger triggering anomaly =
  cleaner signal), rng injectable for a later quantum-RNG source.
- ws.py sends stability on reply_start; audio synthesis for that reply gets
  noise/bitcrush scaled by instability (1 - stability) via a new
  instability param on synthesize_spirit_voice — effects.py itself is
  untouched, only the params fed into it.
- frontend/src/lib/possession.ts: renderPossessedText — pure, deterministic
  (tick-seeded, no Math.random) text corruption with self-correcting
  glitch bursts, wired into Transcript.tsx's streaming reply display.

Stored transcript/reply text is unaffected — this is presentation only.
78/78 backend, 137/137 frontend tests passing.
This commit is contained in:
Indiana
2026-07-23 05:48:02 +00:00
parent bf8f352910
commit 58c30b7273
14 changed files with 638 additions and 21 deletions

View File

@@ -1095,6 +1095,25 @@
text-shadow: 0 0 10px rgba(124, 255, 178, 0.45);
}
/* Low-stability possession: the channel is unsteady, so the streamed text
itself trembles — kept subtle (opacity/skew jitter, no color change) so
the glitched characters underneath stay legible. */
.possession-glitch {
display: inline-block;
animation: possessionJitter 0.6s steps(2, end) infinite;
text-shadow:
0 0 10px rgba(124, 255, 178, 0.45),
1px 0 rgba(178, 107, 255, 0.35),
-1px 0 rgba(255, 59, 92, 0.25);
}
@keyframes possessionJitter {
0%, 100% { opacity: 1; transform: translateX(0); }
20% { opacity: 0.86; transform: translateX(-0.5px); }
45% { opacity: 1; transform: translateX(0.5px); }
70% { opacity: 0.9; transform: translateX(0); }
}
.tx-cursor {
color: #7cffb2;
animation: cursorBlink 0.8s steps(1) infinite;