@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.
116 lines • 5.34 kB
TypeScript
/**
* Constants for Memory element implementation
* Extracted for reusability and maintainability
*
* MEMORY ARCHITECTURE DESIGN:
* - Memories are stored as small, sharded YAML files for fast loading
* - Each memory file should be <256KB for optimal parse performance
* - Larger content referenced via external documents (PDFs, images, etc)
* - Index-of-indexes pattern for O(log n) search performance
*
* SECURITY NOTE: This file contains only constants and type definitions.
* It does not process any user input. The security scanner may flag this
* for missing Unicode normalization, but this is a false positive as no
* input processing occurs here.
*
* @module MemoryConstants
*/
export declare const MEMORY_CONSTANTS: {
readonly MAX_MEMORY_SIZE: number;
readonly MAX_ENTRY_SIZE: number;
readonly MAX_ENTRIES_DEFAULT: 1000;
readonly MAX_TAGS_PER_ENTRY: 20;
readonly MAX_TAG_LENGTH: 50;
readonly MAX_METADATA_KEYS: 20;
readonly MAX_METADATA_KEY_LENGTH: 50;
readonly MAX_METADATA_VALUE_LENGTH: 200;
readonly DEFAULT_RETENTION_DAYS: 999999;
readonly MIN_RETENTION_DAYS: 1;
readonly MAX_RETENTION_DAYS: 999999;
readonly DEFAULT_SEARCH_LIMIT: 100;
/**
* YAML Size Limit Rationale:
* 256KB is optimal for YAML parsing performance while preventing DoS attacks.
* - YAML parsing is CPU-intensive; large files can block the event loop
* - 256KB accommodates ~5000 lines of typical memory content
* - Larger memories should be sharded across multiple files
* - External references used for binary data (images, PDFs, etc)
*
* Performance benchmarks:
* - <256KB: Parse time <10ms on average hardware
* - 1MB: Parse time ~50-100ms (acceptable but not ideal)
* - >5MB: Parse time >500ms (unacceptable, blocks UI)
*/
readonly MAX_YAML_SIZE: number;
/**
* Privacy Level Hierarchy:
*
* 'public' - Lowest restriction level
* - Available to all contexts and users
* - Can be shared across sessions
* - Suitable for general knowledge, documentation
* - Example: Project conventions, public APIs
*
* 'private' - Default level, moderate restriction
* - Restricted to current user/session
* - Not shared with other users
* - Suitable for personal preferences, user-specific data
* - Example: User's coding style, personal notes
*
* 'sensitive' - Highest restriction level
* - Requires explicit permission to access
* - Extra logging and audit trail
* - Automatic deletion after retention period
* - Suitable for credentials, PII, confidential data
* - Example: API keys (temporary), personal information
*
* Access rules cascade: sensitive ⊂ private ⊂ public
*/
readonly PRIVACY_LEVELS: readonly ["public", "private", "sensitive"];
readonly DEFAULT_PRIVACY_LEVEL: "private";
readonly DEFAULT_STORAGE_BACKEND: "memory";
readonly SUPPORTED_STORAGE_BACKENDS: readonly ["memory", "file", "indexed"];
};
export type PrivacyLevel = typeof MEMORY_CONSTANTS.PRIVACY_LEVELS[number];
export type StorageBackend = typeof MEMORY_CONSTANTS.SUPPORTED_STORAGE_BACKENDS[number];
/**
* Trust Levels for Memory Security Architecture (Issue #1314, #1320, #1321)
*
* UNTRUSTED: Default - all content starts as untrusted until validated
* VALIDATED: Content has passed security validation (no dangerous patterns)
* TRUSTED: Manually marked as trusted by user (highest trust)
* FLAGGED: Contains dangerous patterns, sanitized display required
* QUARANTINED: Content failed validation, isolated from normal use
*/
export declare const TRUST_LEVELS: {
readonly UNTRUSTED: "untrusted";
readonly VALIDATED: "validated";
readonly TRUSTED: "trusted";
readonly FLAGGED: "flagged";
readonly QUARANTINED: "quarantined";
};
export type TrustLevel = typeof TRUST_LEVELS[keyof typeof TRUST_LEVELS];
export declare const MEMORY_SECURITY_EVENTS: {
readonly MEMORY_CREATED: "MEMORY_CREATED";
readonly MEMORY_ADDED: "MEMORY_ADDED";
readonly MEMORY_SEARCHED: "MEMORY_SEARCHED";
readonly SENSITIVE_MEMORY_DELETED: "SENSITIVE_MEMORY_DELETED";
readonly RETENTION_POLICY_ENFORCED: "RETENTION_POLICY_ENFORCED";
readonly MEMORY_CLEARED: "MEMORY_CLEARED";
readonly MEMORY_LOADED: "MEMORY_LOADED";
readonly MEMORY_SAVED: "MEMORY_SAVED";
readonly MEMORY_DELETED: "MEMORY_DELETED";
readonly MEMORY_LOAD_FAILED: "MEMORY_LOAD_FAILED";
readonly MEMORY_SAVE_FAILED: "MEMORY_SAVE_FAILED";
readonly MEMORY_DESERIALIZE_FAILED: "MEMORY_DESERIALIZE_FAILED";
readonly MEMORY_LIST_ITEM_FAILED: "MEMORY_LIST_ITEM_FAILED";
readonly MEMORY_IMPORT_FAILED: "MEMORY_IMPORT_FAILED";
readonly MEMORY_INTEGRITY_VIOLATION: "MEMORY_INTEGRITY_VIOLATION";
readonly MEMORY_UNICODE_VALIDATION_FAILED: "MEMORY_UNICODE_VALIDATION_FAILED";
readonly MEMORY_DUPLICATE_DETECTED: "MEMORY_DUPLICATE_DETECTED";
readonly MEMORY_INJECTION_BLOCKED: "MEMORY_INJECTION_BLOCKED";
readonly MEMORY_INJECTION_DETECTED_ON_READ: "MEMORY_INJECTION_DETECTED_ON_READ";
readonly SEED_MEMORY_INSTALLED: "SEED_MEMORY_INSTALLED";
readonly SEED_MEMORY_INSTALLATION_FAILED: "SEED_MEMORY_INSTALLATION_FAILED";
};
//# sourceMappingURL=constants.d.ts.map