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.

68 lines 2.58 kB
/** * Centralized configuration for handoff payload size limits * * Issue #380 (Post-Review Hardening): Makes handoff size limits configurable * via environment variables. Previously, MAX_RECENT_ENTRIES and MAX_RECENT_DECISIONS * were hardcoded constants in handoff.ts. * * Environment variables follow the pattern: DOLLHOUSE_HANDOFF_* * Values are clamped between safety floors and security ceilings. * * @example * // Override via environment variables (set before server starts) * // DOLLHOUSE_HANDOFF_MAX_RECENT_ENTRIES=50 * // DOLLHOUSE_HANDOFF_MAX_RECENT_DECISIONS=25 * // DOLLHOUSE_HANDOFF_WARN_PAYLOAD_BYTES=512000 */ /** * Absolute maximum values — cannot be exceeded even with environment variable overrides. * Prevents resource exhaustion via unbounded handoff payloads. */ export declare const HANDOFF_HARD_LIMITS: { readonly recentEntries: 100; readonly recentDecisions: 50; readonly warnPayloadBytes: 1048576; }; /** * Minimum values — configured values cannot go below these. * Ensures handoff blocks contain enough context to be useful. */ export declare const HANDOFF_MIN_LIMITS: { readonly recentEntries: 5; readonly recentDecisions: 3; readonly warnPayloadBytes: 1024; }; /** * Default values when no environment variable is set. * Matches the original hardcoded constants. */ export declare const HANDOFF_DEFAULTS: { readonly recentEntries: 20; readonly recentDecisions: 10; readonly warnPayloadBytes: 102400; }; /** * Maps handoff config keys to their environment variable names. * Exported for documentation and testing purposes. */ export declare const HANDOFF_ENV_VARS: { readonly recentEntries: "DOLLHOUSE_HANDOFF_MAX_RECENT_ENTRIES"; readonly recentDecisions: "DOLLHOUSE_HANDOFF_MAX_RECENT_DECISIONS"; readonly warnPayloadBytes: "DOLLHOUSE_HANDOFF_WARN_PAYLOAD_BYTES"; }; /** * Get the maximum number of recent entries to include in a handoff payload. * Respects environment variable overrides with validation and clamping. */ export declare function getHandoffMaxRecentEntries(): number; /** * Get the maximum number of recent decisions to include in a handoff payload. * Respects environment variable overrides with validation and clamping. */ export declare function getHandoffMaxRecentDecisions(): number; /** * Get the payload size threshold (in bytes) at which a warning is logged. * Respects environment variable overrides with validation and clamping. */ export declare function getHandoffWarnPayloadBytes(): number; //# sourceMappingURL=handoff-limits.d.ts.map