UNPKG

@dollhousemcp/mcp-server

Version:

DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.

63 lines 2.77 kB
/** * Centralized configuration for active element limits * * Issue #83 (Phase 1): Makes active element limits configurable via environment variables. * Previously, each manager had hardcoded MAX_ACTIVE_* and ACTIVE_SET_CLEANUP_THRESHOLD constants. * * Environment variables follow the pattern: DOLLHOUSE_MAX_ACTIVE_{TYPE} * Values are clamped between safety floors and security ceilings. * * @example * // Override via environment variables (set before server starts) * // DOLLHOUSE_MAX_ACTIVE_SKILLS=300 * // DOLLHOUSE_MAX_ACTIVE_AGENTS=150 * // DOLLHOUSE_MAX_ACTIVE_MEMORIES=200 * // DOLLHOUSE_MAX_ACTIVE_ENSEMBLES=75 * // DOLLHOUSE_MAX_ACTIVE_PERSONAS=50 */ /** Element types that support active element limits */ export type ActiveLimitElementType = 'skills' | 'agents' | 'memories' | 'ensembles' | 'personas'; /** Configuration for a single element type's active limits */ export interface ActiveElementLimitConfig { /** Maximum number of active elements before warning/cleanup triggers */ max: number; /** Threshold at which cleanup of stale references begins (typically floor(max * 0.9)) */ cleanupThreshold: number; } /** * Absolute maximum values — cannot be exceeded even with environment variable overrides. * Prevents resource exhaustion and DoS via unbounded active sets. */ export declare const ACTIVE_ELEMENT_HARD_LIMITS: Record<ActiveLimitElementType, number>; /** * Minimum values — configured values cannot go below these. * Ensures basic functionality is always available. */ export declare const ACTIVE_ELEMENT_MIN_LIMITS: Record<ActiveLimitElementType, number>; /** * Default max active limits when no environment variable is set. * Increased from original hardcoded values for better out-of-box experience. */ export declare const ACTIVE_ELEMENT_DEFAULTS: Record<ActiveLimitElementType, number>; /** * Maps element types to their environment variable names. * Exported for documentation and testing purposes. */ export declare const ACTIVE_LIMIT_ENV_VARS: Record<ActiveLimitElementType, string>; /** * Get the maximum active element limit for a given element type. * Respects environment variable overrides with validation and clamping. * * @param type - Element type * @returns Maximum active elements allowed */ export declare function getMaxActiveLimit(type: ActiveLimitElementType): number; /** * Get the full active element limit configuration for a given element type. * Returns both max limit and cleanup threshold (floor(max * 0.9)). * * @param type - Element type * @returns Configuration with max and cleanupThreshold */ export declare function getActiveElementLimitConfig(type: ActiveLimitElementType): ActiveElementLimitConfig; //# sourceMappingURL=active-element-limits.d.ts.map