/** * Emotion → physical-cue rewriting. Models render emotion better from physical * cues ("eyes wide, jaw slack") than from named emotions ("scared"). ADVISORY + * ADDITIVE: only moderate emotions are mapped; EXTREMES (panic, terror, rage, * ecstatic, ...) are deliberately left named so the model pushes the * performance. Unmapped names pass through unchanged. */ export const EMOTION_PHYSICAL_CUE_MAP: Readonly> = { calm: 'shoulders relaxed, breathing even, jaw unclenched, gaze steady', scared: 'eyes wide, jaw slack, breath shallow and quick, shoulders drawn up', afraid: 'eyes wide, jaw slack, breath shallow and quick, shoulders drawn up', angry: 'jaw clenched, eyes narrowed, nostrils flared, shoulders squared', sad: 'eyes downcast and glassy, mouth corners pulled down, shoulders sunk', surprised: 'eyebrows raised high, eyes round, mouth parted, head drawn back', tense: 'jaw set, breath held, fingers curled tight, muscles rigid', nervous: 'eyes flicking, throat swallowing, fingers fidgeting, weight shifting', confused: 'brows knitted, head tilted, eyes searching, mouth slightly open', joyful: 'eyes crinkled at the corners, cheeks lifted, easy open smile', happy: 'eyes crinkled at the corners, cheeks lifted, easy open smile', determined: 'jaw set, eyes locked forward, brow level, chin slightly lowered', shaken: 'breath unsteady, hands trembling, gaze unfocused, shoulders caved', wary: 'eyes narrowed and tracking, chin tucked, weight back on the heels', relieved: 'shoulders dropping, a long slow exhale, brow smoothing', defiant: 'chin raised, eyes hard, mouth a flat line, stance widened', }; /** * Map a named emotion to its physical-cue descriptor. Advisory: an unmapped or * deliberately-excluded (extreme) emotion is returned unchanged, never dropped * and never throws. `undefined` in → `undefined` out. */ export function rewriteEmotionAsPhysical(emotion: string | undefined): string | undefined { if (emotion === undefined) return undefined; const key = emotion.trim().toLowerCase(); return EMOTION_PHYSICAL_CUE_MAP[key] ?? emotion; }