"use strict";
// src/test_persona_router.ts
// v1.17.0 — PersonaRouter regression.
Object.defineProperty(exports, "__esModule", { value: true });
const PersonaRouter_1 = require("./orchestrator/story/PersonaRouter");
function assert(cond, msg) {
    if (!cond)
        throw new Error(`assertion failed: ${msg}`);
}
function deepEq(a, b) {
    return JSON.stringify(a) === JSON.stringify(b);
}
function s(title) {
    return { title };
}
function scenarioBugAndFix() {
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('[BUG] Fix gateway')), ['builder', 'sentinel']), 'BUG');
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('[FIX] something')), ['builder', 'sentinel']), 'FIX');
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('[HOTFIX] urgent')), ['builder', 'sentinel']), 'HOTFIX');
    console.log('✅ scenario 1: [BUG]/[FIX]/[HOTFIX] → builder+sentinel');
}
function scenarioFeature() {
    const seq = (0, PersonaRouter_1.pickPersona)(s('[FEATURE] Add auth'));
    assert(deepEq(seq, ['genesis', 'architect', 'builder', 'sentinel']), `got ${JSON.stringify(seq)}`);
    console.log('✅ scenario 2: [FEATURE] → genesis+architect+builder+sentinel');
}
function scenarioDesign() {
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('[DESIGN] new landing')), ['prism', 'builder', 'sentinel']), 'DESIGN');
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('[UI] tweak nav')), ['prism', 'builder', 'sentinel']), 'UI');
    console.log('✅ scenario 3: [DESIGN]/[UI] → prism+builder+sentinel');
}
function scenarioData() {
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('[DATA] new table')), ['mesh', 'builder', 'sentinel']), 'DATA');
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('[MIGRATION] add cols')), ['mesh', 'builder', 'sentinel']), 'MIGRATION');
    console.log('✅ scenario 4: [DATA]/[MIGRATION] → mesh+builder+sentinel');
}
function scenarioRefactorAndDocs() {
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('[REFACTOR] clean util')), ['architect', 'builder', 'sentinel']), 'REFACTOR');
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('[DEBT] tech debt')), ['architect', 'builder', 'sentinel']), 'DEBT');
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('[DOCS] update README')), ['lyra', 'sentinel']), 'DOCS');
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('[POLISH] surface error')), ['lyra', 'sentinel']), 'POLISH');
    console.log('✅ scenario 5: [REFACTOR]/[DEBT] → architect+...; [DOCS]/[POLISH] → lyra+sentinel');
}
function scenarioFallback() {
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('No tag here')), ['builder', 'sentinel']), 'untagged → builder');
    assert(deepEq((0, PersonaRouter_1.pickPersona)(s('[UNKNOWN] huh')), ['builder', 'sentinel']), 'unknown → builder');
    console.log('✅ scenario 6: untagged/unknown fallback');
}
function scenarioPrimary() {
    assert((0, PersonaRouter_1.pickPrimaryPersona)(s('[FEATURE] x')) === 'builder', 'builder is last non-sentinel');
    assert((0, PersonaRouter_1.pickPrimaryPersona)(s('[DOCS] x')) === 'lyra', 'lyra is last non-sentinel for DOCS');
    assert((0, PersonaRouter_1.pickPrimaryPersona)(s('[CONCERN] x')) === 'builder', 'builder for CONCERN sequence');
    console.log('✅ scenario 7: pickPrimaryPersona returns last non-sentinel');
}
function scenarioQAPredicate() {
    assert((0, PersonaRouter_1.isQAPersona)('sentinel'), 'sentinel is QA');
    assert(!(0, PersonaRouter_1.isQAPersona)('builder'), 'builder is not QA');
    assert(!(0, PersonaRouter_1.isQAPersona)('genesis'), 'genesis is not QA');
    console.log('✅ scenario 8: isQAPersona predicate');
}
try {
    scenarioBugAndFix();
    scenarioFeature();
    scenarioDesign();
    scenarioData();
    scenarioRefactorAndDocs();
    scenarioFallback();
    scenarioPrimary();
    scenarioQAPredicate();
    console.log('TEST_PERSONA_ROUTER_OK');
}
catch (err) {
    console.error('TEST_PERSONA_ROUTER_FAIL', err);
    process.exit(1);
}
