feat(ai-psychosis): promote domain_context to array for multi-domain support

This commit is contained in:
Kjell Tore Guttormsen 2026-05-01 21:28:36 +02:00
commit a5bc53cb42
6 changed files with 72 additions and 11 deletions

View file

@ -46,9 +46,11 @@ export function aggregateSessions(sessions) {
total_fatigue += Number(flags.fatigue) || 0;
total_validation += Number(flags.validation) || 0;
// v1.2: domain_context is array; v1.0/v1.1: null or string. Coerce on read.
const dc = rec.domain_context;
if (dc === null || dc === undefined) null_domain_count += 1;
else if (dc === 'relationship') relationship_domain_count += 1;
const domains = Array.isArray(dc) ? dc : (dc ? [dc] : []);
if (domains.length === 0) null_domain_count += 1;
else if (domains.includes('relationship')) relationship_domain_count += 1;
else other_domain_count += 1;
}