/**
 * Role Management Service
 *
 * Handles CRUD operations for AI agent roles, loading from configuration
 * directories, and managing role-to-skill assignments.
 *
 * @module services/settings/role.service
 */
import { Role, RoleWithPrompt, RoleSummary, CreateRoleInput, UpdateRoleInput, RoleFilter } from '../../types/role.types.js';
/**
 * Error thrown when a role is not found
 */
export declare class RoleNotFoundError extends Error {
    constructor(id: string);
}
/**
 * Error thrown when role validation fails
 */
export declare class RoleValidationError extends Error {
    readonly errors: string[];
    constructor(errors: string[]);
}
/**
 * Error thrown when attempting to modify a built-in role
 */
export declare class BuiltinRoleModificationError extends Error {
    constructor(action: string);
}
/**
 * Error thrown when a role with the same name already exists
 */
export declare class DuplicateRoleNameError extends Error {
    constructor(name: string);
}
/**
 * Service for managing AI agent roles
 *
 * Handles:
 * - Loading built-in roles from config/roles/
 * - Managing user-created roles in ~/.crewly/roles/
 * - CRUD operations for roles
 * - Role-to-skill assignment management
 *
 * @example
 * ```typescript
 * const service = getRoleService();
 * await service.initialize();
 *
 * // List all roles
 * const roles = await service.listRoles();
 *
 * // Create a new role
 * const newRole = await service.createRole({
 *   name: 'my-role',
 *   displayName: 'My Role',
 *   description: 'A custom role',
 *   category: 'development',
 *   systemPromptContent: 'You are a helpful assistant.',
 * });
 * ```
 */
export declare class RoleService {
    private readonly builtinRolesDir;
    private readonly userRolesDir;
    private rolesCache;
    private promptCache;
    private initialized;
    private readonly logger;
    /**
     * Create a new RoleService instance
     *
     * @param options - Configuration options
     * @param options.builtinRolesDir - Directory for built-in roles
     * @param options.userRolesDir - Directory for user-created roles
     */
    constructor(options?: {
        builtinRolesDir?: string;
        userRolesDir?: string;
    });
    /**
     * Initialize the service by loading all roles
     * Must be called before using other methods
     */
    initialize(): Promise<void>;
    /**
     * Get all roles, optionally filtered
     *
     * @param filter - Optional filter criteria
     * @param includeHidden - Whether to include hidden roles (default: false for UI)
     * @returns Array of role summaries
     */
    listRoles(filter?: RoleFilter, includeHidden?: boolean): Promise<RoleSummary[]>;
    /**
     * Get a role by ID with full prompt content
     *
     * @param id - The role ID
     * @returns The role with prompt content, or null if not found
     */
    getRole(id: string): Promise<RoleWithPrompt | null>;
    /**
     * Get a role by name (includes hidden roles)
     *
     * @param name - The role name
     * @returns The role with prompt content, or null if not found
     */
    getRoleByName(name: string): Promise<RoleWithPrompt | null>;
    /**
     * Get the prompt file path for a role
     * Used by PromptBuilderService and AgentRegistrationService
     *
     * @param roleName - The role name (e.g., 'orchestrator', 'tpm', 'developer')
     * @returns The full path to the prompt file, or null if role not found
     */
    getPromptFilePath(roleName: string): Promise<string | null>;
    /**
     * Get the built-in roles directory path
     *
     * @returns The path to built-in roles directory
     */
    getBuiltinRolesDir(): string;
    /**
     * Create a new user-defined role
     *
     * @param input - The role creation input
     * @returns The created role
     * @throws {RoleValidationError} If input validation fails
     * @throws {DuplicateRoleNameError} If a role with the same name exists
     */
    createRole(input: CreateRoleInput): Promise<Role>;
    /**
     * Update an existing role
     *
     * For builtin roles: Creates an override in ~/.crewly/roles/ (original stays intact)
     * For user roles: Updates the role directly
     *
     * @param id - The role ID
     * @param input - The update input
     * @returns The updated role
     * @throws {RoleNotFoundError} If the role is not found
     * @throws {RoleValidationError} If input validation fails
     */
    updateRole(id: string, input: UpdateRoleInput): Promise<Role>;
    /**
     * Check if a builtin role has a user override
     *
     * @param id - The role ID
     * @returns True if the role has a user override
     */
    hasOverride(id: string): Promise<boolean>;
    /**
     * Reset a builtin role to its default (removes user override)
     *
     * @param id - The role ID
     * @returns The reset role (original builtin values)
     * @throws {RoleNotFoundError} If the role is not found
     */
    resetToDefault(id: string): Promise<Role>;
    /**
     * Delete a user-created role (built-in roles cannot be deleted)
     *
     * @param id - The role ID
     * @throws {RoleNotFoundError} If the role is not found
     * @throws {BuiltinRoleModificationError} If attempting to delete a built-in role
     */
    deleteRole(id: string): Promise<void>;
    /**
     * Assign skills to a role
     *
     * @param roleId - The role ID
     * @param skillIds - Array of skill IDs to assign
     * @returns The updated role
     * @throws {RoleNotFoundError} If the role is not found
     * @throws {BuiltinRoleModificationError} If attempting to modify a built-in role
     */
    assignSkills(roleId: string, skillIds: string[]): Promise<Role>;
    /**
     * Remove skills from a role
     *
     * @param roleId - The role ID
     * @param skillIds - Array of skill IDs to remove
     * @returns The updated role
     * @throws {RoleNotFoundError} If the role is not found
     * @throws {BuiltinRoleModificationError} If attempting to modify a built-in role
     */
    removeSkills(roleId: string, skillIds: string[]): Promise<Role>;
    /**
     * Set the default role
     *
     * @param roleId - The role ID to set as default
     * @returns The updated role
     * @throws {RoleNotFoundError} If the role is not found
     */
    setDefaultRole(roleId: string): Promise<Role>;
    /**
     * Get the current default role
     *
     * @returns The default role, or null if none is set
     */
    getDefaultRole(): Promise<Role | null>;
    /**
     * Refresh the roles cache by reloading from disk
     */
    refresh(): Promise<void>;
    /**
     * Ensure the service is initialized.
     * Auto-initializes if not already done.
     */
    private ensureInitialized;
    /**
     * Load built-in roles from the config directory
     * Loads from subdirectories (config/roles/{role}/role.json)
     */
    private loadBuiltinRoles;
    /**
     * Load user-created roles from the user directory
     */
    private loadUserRoles;
    /**
     * Save a role and its prompt content to disk
     *
     * @param role - The role to save
     * @param promptContent - The prompt content to save
     */
    private saveRole;
    /**
     * Save a role override to user directory
     * Uses subdirectory structure: ~/.crewly/roles/{role-name}/role.json + prompt.md
     *
     * @param role - The role to save
     * @param promptContent - The prompt content
     */
    private saveRoleOverride;
    /**
     * Load prompt content from a file
     * For built-in roles, checks for user override first, then falls back to builtin
     * For user roles, loads from ~/.crewly/roles/
     *
     * @param promptFile - The prompt file name (e.g., "prompt.md")
     * @param isBuiltin - Whether this is a built-in role
     * @param roleName - The role name (directory name)
     * @returns The prompt content
     */
    private loadPromptContent;
    /**
     * Ensure the user roles directory exists
     */
    private ensureUserRolesDir;
    /**
     * Generate a unique role ID
     *
     * @param name - The role name
     * @returns A unique ID
     */
    private generateRoleId;
    /**
     * Sanitize a role name for use in file names
     *
     * @param name - The role name
     * @returns The sanitized name
     */
    private sanitizeRoleName;
    /**
     * Unset isDefault on all roles
     */
    private unsetAllDefaults;
}
/**
 * Get the singleton RoleService instance
 *
 * @returns The RoleService instance
 */
export declare function getRoleService(): RoleService;
/**
 * Reset the singleton instance (for testing)
 */
export declare function resetRoleService(): void;
//# sourceMappingURL=role.service.d.ts.map