const registry = new Map();
export function registerAgentProfile(blueprint) {
    if (!blueprint?.name) {
        throw new Error('Agent profile name is required.');
    }
    const trimmedName = blueprint.name.trim();
    if (!trimmedName) {
        throw new Error('Agent profile name cannot be blank.');
    }
    const payload = Object.freeze({
        ...blueprint,
        name: trimmedName,
        label: blueprint.label.trim() || trimmedName,
        frozen: true,
    });
    registry.set(trimmedName, payload);
}
export function hasAgentProfile(name) {
    return registry.has(name.trim());
}
export function getAgentProfile(name) {
    const profile = registry.get(name.trim());
    if (!profile) {
        const known = listAgentProfiles()
            .map((entry) => entry.name)
            .sort()
            .join(', ');
        throw new Error(`Unknown profile "${name}". Registered profiles: ${known || 'none'}.`);
    }
    return profile;
}
export function listAgentProfiles() {
    return Array.from(registry.values());
}
//# sourceMappingURL=agentProfiles.js.map