/** * Chat V2 — Configuration constants. * * Loads Phase 1 defaults (from spec §15) and honors * `CREWLY_CHAT_*` environment overrides. Pure functions; * no disk I/O here. * * @module services/chat-v2/config */ /** Full Chat V2 runtime config. All durations in ms, sizes in bytes. */ export interface ChatV2Config { enabled: boolean; /** Hard cap on message body size in UTF-8 bytes after NFC normalization. */ maxMessageBytes: number; maxAttachmentBytes: number; maxAttachmentsPerMessage: number; allowedAttachmentMimes: readonly string[]; /** Max chars on channel name (validated at controller). */ maxChannelNameChars: number; /** Max chars on optional channel purpose. */ maxPurposeChars: number; /** Max bytes in message metadata JSON blob. */ maxMetadataBytes: number; rateLimits: { messagesPerSec: number; messagesPerMin: number; uploadsPerSec: number; uploadsPerMin: number; wsFramesPerSec: number; }; websocket: { heartbeatIntervalMs: number; idleTimeoutMs: number; pongTimeoutMs: number; replayCap: number; maxFrameBytes: number; }; offlineQueue: { maxPendingPerAgent: number; maxAgeMs: number; drainBatchSize: number; drainPauseMs: number; }; presence: { pollIntervalMs: number; }; portal: { /** Name of the env var holding the Cloud-OSS shared service token. */ sharedSecretEnv: string; }; storage: { dbPath: string; attachmentsDir: string; uploadsStagingDir: string; }; } /** * Resolve a path containing a leading `~` or `~/` to the user's home directory. * * @param input - Path possibly prefixed with `~` or `~/` * @returns Absolute path with `~` expanded */ export declare function expandHomePath(input: string): string; /** Phase 1 defaults — source of truth is the tech spec §15. */ export declare const CHAT_V2_DEFAULTS: ChatV2Config; /** * Parse a positive integer from an env-string, falling back to a default. * * @param raw - Raw env-var value or undefined * @param fallback - Default if raw is missing/invalid/non-positive * @returns The parsed positive integer */ export declare function parsePositiveInt(raw: string | undefined, fallback: number): number; /** * Parse a boolean env-var supporting `true`/`false`/`1`/`0` (case-insensitive). * * @param raw - Raw env-var value or undefined * @param fallback - Default if raw is missing * @returns The parsed boolean */ export declare function parseBoolean(raw: string | undefined, fallback: boolean): boolean; /** * Build a fully-resolved config from defaults + environment overrides. * * Env vars honored (all optional): * - `CREWLY_CHAT_ENABLED` — master switch * - `CREWLY_CHAT_MAX_MESSAGE_BYTES` — per-message byte cap * - `CREWLY_CHAT_MAX_ATTACHMENT_BYTES` — per-attachment byte cap * - `CREWLY_CHAT_WS_HEARTBEAT_MS` — client-ping interval * - `CREWLY_CHAT_WS_IDLE_TIMEOUT_MS` — server idle close * - `CREWLY_CHAT_DB_PATH` — SQLite DB path (expands `~`) * - `CREWLY_CHAT_ATTACHMENTS_DIR` — committed attachment dir (expands `~`) * - `CREWLY_CHAT_UPLOADS_STAGING_DIR` — pre-commit upload dir (expands `~`) * - `CREWLY_HOME` — when set and DB/path env vars are not, rebases storage under this dir * * @param env - The environment object to read from (defaults to `process.env`) * @returns A fully-resolved, immutable ChatV2Config */ export declare function loadChatV2Config(env?: NodeJS.ProcessEnv): ChatV2Config; //# sourceMappingURL=config.d.ts.map