/**
* Centralized constants
*
* Avoids magic numbers and strings scattered throughout the codebase.
*/
/**
* Default timeouts in milliseconds
*/
export const Timeouts = {
/** Default request timeout */
REQUEST: 30_000,
/** Tool execution timeout */
TOOL_EXECUTION: 60_000,
/** Database operation timeout */
DATABASE: 5_000,
/** External API call timeout */
EXTERNAL_API: 15_000,
/** Session idle timeout */
SESSION_IDLE: 30 * 60 * 1000, // 30 minutes
/** SSE keepalive interval */
SSE_KEEPALIVE: 30_000,
} as const;
/**
* Cache TTL values in seconds
*/
export const CacheTtl = {
/** Short-lived cache (1 hour) */
SHORT: 3600,
/** Medium cache (1 day) */
MEDIUM: 86400,
/** Long cache (1 week) */
LONG: 604800,
/** Search results */
SEARCH: 3600,
/** Entity metadata */
ENTITY: 86400,
/** Session data */
SESSION: 28800, // 8 hours
} as const;
/**
* Rate limiting defaults
*/
export const RateLimits = {
/** Default requests per window */
REQUESTS_PER_WINDOW: 60,
/** Default window duration in ms */
WINDOW_MS: 60_000,
/** Maximum backoff in seconds */
MAX_BACKOFF_SECONDS: 60,
} as const;
/**
* Retry defaults
*/
export const RetryDefaults = {
/** Maximum retry attempts */
MAX_ATTEMPTS: 3,
/** Initial delay in ms */
INITIAL_DELAY_MS: 1000,
/** Maximum delay in ms */
MAX_DELAY_MS: 30_000,
/** Backoff multiplier */
BACKOFF_MULTIPLIER: 2,
/** Jitter factor (0-1) */
JITTER_FACTOR: 0.25,
} as const;
/**
* Pagination defaults
*/
export const Pagination = {
/** Default page size */
DEFAULT_PAGE_SIZE: 50,
/** Maximum page size */
MAX_PAGE_SIZE: 100,
} as const;
/**
* Security constants
*/
export const Security = {
/** PBKDF2 iterations for key derivation */
PBKDF2_ITERATIONS: 100_000,
/** AES key length in bytes */
AES_KEY_LENGTH: 32,
/** IV length in bytes for GCM */
GCM_IV_LENGTH: 12,
/** Auth tag length in bytes */
GCM_AUTH_TAG_LENGTH: 16,
/** Salt length in bytes */
SALT_LENGTH: 32,
} as const;
/**
* MCP protocol constants
*/
export const McpProtocol = {
/** Protocol version */
VERSION: '2025-11-25',
/** Session header name */
SESSION_HEADER: 'Mcp-Session-Id',
/** Content type for Problem Details */
PROBLEM_CONTENT_TYPE: 'application/problem+json',
} as const;
/**
* HTTP status codes
*/
export const HttpStatus = {
OK: 200,
CREATED: 201,
NO_CONTENT: 204,
BAD_REQUEST: 400,
UNAUTHORIZED: 401,
FORBIDDEN: 403,
NOT_FOUND: 404,
METHOD_NOT_ALLOWED: 405,
CONFLICT: 409,
UNPROCESSABLE_ENTITY: 422,
TOO_MANY_REQUESTS: 429,
INTERNAL_SERVER_ERROR: 500,
BAD_GATEWAY: 502,
SERVICE_UNAVAILABLE: 503,
GATEWAY_TIMEOUT: 504,
} as const;