"use strict";
// src/orchestrator/story/PersonaRouter.ts
// v1.17.0 — Picks the persona sequence for an autonomous story loop.
//
// Tag map (from .openlife/method/agents/*.md):
//   [BUG]/[FIX]/[HOTFIX]    → builder + sentinel
//   [FEATURE]/[FEAT]         → genesis + architect + builder + sentinel
//   [DESIGN]/[UI]/[UX]       → prism + builder + sentinel
//   [DATA]/[DB]/[MIGRATION]  → mesh + builder + sentinel
//   [REFACTOR]/[DEBT]        → architect + builder + sentinel
//   [DOCS]/[POLISH]          → lyra + sentinel
//   [CONCERN]/[QA]           → sentinel + builder
//   default                  → builder + sentinel
Object.defineProperty(exports, "__esModule", { value: true });
exports.pickPersona = pickPersona;
exports.pickPrimaryPersona = pickPrimaryPersona;
exports.isQAPersona = isQAPersona;
exports._allPersonas = _allPersonas;
const TAG_RE = /^\s*\[([A-Z]+)\]/;
function pickPersona(story) {
    const m = TAG_RE.exec(story.title || '');
    const tag = m ? m[1].toUpperCase() : 'BUG';
    switch (tag) {
        case 'BUG':
        case 'FIX':
        case 'HOTFIX':
            return ['builder', 'sentinel'];
        case 'FEATURE':
        case 'FEAT':
            return ['genesis', 'architect', 'builder', 'sentinel'];
        case 'DESIGN':
        case 'UI':
        case 'UX':
            return ['prism', 'builder', 'sentinel'];
        case 'DATA':
        case 'DB':
        case 'MIGRATION':
            return ['mesh', 'builder', 'sentinel'];
        case 'REFACTOR':
        case 'CLEANUP':
        case 'DEBT':
            return ['architect', 'builder', 'sentinel'];
        case 'DOCS':
        case 'DOC':
        case 'POLISH':
            return ['lyra', 'sentinel'];
        case 'CONCERN':
        case 'QA':
            return ['sentinel', 'builder'];
        default:
            return ['builder', 'sentinel'];
    }
}
function pickPrimaryPersona(story) {
    const seq = pickPersona(story);
    for (let i = seq.length - 1; i >= 0; i--) {
        if (seq[i] !== 'sentinel')
            return seq[i];
    }
    return 'builder';
}
function isQAPersona(p) {
    return p === 'sentinel';
}
function _allPersonas() {
    return ['builder', 'sentinel', 'genesis', 'architect', 'prism', 'mesh', 'lyra', 'steward', 'conductor'];
}
