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.

125 lines 5.07 kB
/** * Centralized configuration for autonomy evaluation thresholds * * Issue #390 (Post-Review Improvement): Makes risk thresholds and step limits * configurable via environment variables. Previously, RISK_THRESHOLDS and * maxAutonomousSteps were hardcoded constants in autonomyEvaluator.ts. * * Environment variables follow the pattern: DOLLHOUSE_AUTONOMY_* * Values are clamped between safety floors and security ceilings. * * @example * // Override via environment variables (set before server starts) * // DOLLHOUSE_AUTONOMY_THRESHOLD_CONSERVATIVE=20 * // DOLLHOUSE_AUTONOMY_THRESHOLD_MODERATE=40 * // DOLLHOUSE_AUTONOMY_THRESHOLD_AGGRESSIVE=70 * // DOLLHOUSE_AUTONOMY_MAX_STEPS_DEFAULT=15 */ /** * Absolute maximum values — cannot be exceeded even with environment variable overrides. * Prevents nonsensical or dangerous configurations. */ export declare const AUTONOMY_HARD_LIMITS: { /** Max conservative threshold. Prevents it from being set so high it never triggers. */ readonly thresholdConservative: 50; /** Max moderate threshold. */ readonly thresholdModerate: 80; /** Max aggressive threshold. Must stay below 100 to retain some safety margin. */ readonly thresholdAggressive: 95; /** Max step limit. Prevents runaway agents even with misconfiguration. */ readonly maxStepsDefault: 100; }; /** * Minimum values — configured values cannot go below these. * Ensures thresholds remain meaningful and agents don't immediately pause. */ export declare const AUTONOMY_MIN_LIMITS: { /** Min conservative threshold. Must be positive to allow very-low-risk actions. */ readonly thresholdConservative: 5; /** Min moderate threshold. Must be above conservative floor. */ readonly thresholdModerate: 20; /** Min aggressive threshold. Must be above moderate floor. */ readonly thresholdAggressive: 40; /** Min step limit. Agents need at least 1 step to do anything. */ readonly maxStepsDefault: 1; }; /** * Default values when no environment variable is set. * Matches the original hardcoded constants from autonomyEvaluator.ts. */ export declare const AUTONOMY_DEFAULTS: { /** * Conservative threshold (25): Pauses on any moderate risk. * Suitable for production, financial, or security-sensitive agents. */ readonly thresholdConservative: 25; /** * Moderate threshold (50): Balances autonomy and safety. * Default for most agents. */ readonly thresholdModerate: 50; /** * Aggressive threshold (75): Only pauses on high-risk actions. * For trusted, well-tested agents in controlled environments. */ readonly thresholdAggressive: 75; /** * Default max autonomous steps (10): How many steps an agent can * take before requiring human check-in. */ readonly maxStepsDefault: 10; }; /** * Maps autonomy config keys to their environment variable names. * Exported for documentation and testing purposes. */ export declare const AUTONOMY_ENV_VARS: { readonly thresholdConservative: "DOLLHOUSE_AUTONOMY_THRESHOLD_CONSERVATIVE"; readonly thresholdModerate: "DOLLHOUSE_AUTONOMY_THRESHOLD_MODERATE"; readonly thresholdAggressive: "DOLLHOUSE_AUTONOMY_THRESHOLD_AGGRESSIVE"; readonly maxStepsDefault: "DOLLHOUSE_AUTONOMY_MAX_STEPS_DEFAULT"; }; /** * Get the conservative risk threshold. * * Actions with risk scores above this threshold require human approval * when an agent uses conservative risk tolerance. Low value means the * agent pauses on even moderate-risk actions. * * Suitable for production, financial, or security-sensitive agents. */ export declare function getAutonomyThresholdConservative(): number; /** * Get the moderate risk threshold. * * Balances autonomy and safety. Default for most agents. * Actions with risk scores above this value trigger a pause. */ export declare function getAutonomyThresholdModerate(): number; /** * Get the aggressive risk threshold. * * Only pauses on high-risk actions. For trusted, well-tested agents * in controlled environments where speed is prioritized. */ export declare function getAutonomyThresholdAggressive(): number; /** * Get the default maximum autonomous steps. * * Controls how many steps an agent can take before requiring * human check-in, when the agent doesn't specify its own limit. */ export declare function getAutonomyMaxStepsDefault(): number; /** * Get all risk thresholds as a record keyed by tolerance level. * * Convenience function for callers that need the full threshold map * (e.g., the autonomy evaluator's checkRiskThreshold function). * * @returns Object with keys `conservative`, `moderate`, and `aggressive`, * each mapping to a risk score threshold (0–100). These keys correspond * to the `riskTolerance` field on `AgentAutonomyConfig`. Actions with * risk scores above the agent's tolerance threshold trigger a pause. */ export declare function getAutonomyRiskThresholds(): Record<string, number>; //# sourceMappingURL=autonomy-config.d.ts.map