// @crash-shield-ignore-file — config/cache reader for Planu-controlled JSON; writer is this codebase, shape guaranteed by build/seed.
// role-resolver.ts — Maps frameworkId signals to AgentTeamRole[] (SPEC-697)
// Zero hardcoded framework names. All framework knowledge lives in agent-team-roles.json.
import { readFile } from 'node:fs/promises';
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const CONFIG_PATH = join(dirname(fileURLToPath(import.meta.url)), '../../../config/agent-team-roles.json');
let cachedConfig = null;
async function loadConfig() {
    if (cachedConfig) {
        return cachedConfig;
    }
    const raw = await readFile(CONFIG_PATH, 'utf8');
    cachedConfig = JSON.parse(raw);
    return cachedConfig;
}
export async function resolveRoles(detectedFrameworkIds) {
    const config = await loadConfig();
    const matched = config.roles.filter((r) => r.alwaysInclude === true || detectedFrameworkIds.includes(r.frameworkId));
    const seen = new Set();
    return matched.filter((r) => {
        if (seen.has(r.role)) {
            return false;
        }
        seen.add(r.role);
        return true;
    });
}
//# sourceMappingURL=role-resolver.js.map