/** * MAMA OS runtime utility functions, constants, and interfaces. * * Extracted from cli/commands/start.ts to keep the orchestrator thin. * All logic and function signatures are unchanged. */ import type { Server as HttpServer } from 'node:http'; import { loadConfig } from '../config/config-manager.js'; /** Public-facing API server port (REST API, Viewer UI, Setup Wizard) */ export declare const API_PORT = 3847; /** Internal embedding server port (model inference, mobile chat, graph) */ export declare const EMBEDDING_PORT = 3849; export interface SecurityAlertTarget { gateway: 'discord' | 'slack' | 'telegram'; channelId: string; } export declare function parseSecurityAlertTargets(config: { discord?: { default_channel_id?: string; }; slack?: unknown; }): SecurityAlertTarget[]; export declare function getEmbeddingServer(): HttpServer | null; export declare function setEmbeddingServer(server: HttpServer | null): void; export declare function getEmbeddingShutdownToken(): string | null; export declare function setEmbeddingShutdownToken(token: string | null): void; /** * Normalize Discord guild config before passing to gateway. * Guards against null, unexpected types, and non-string keys. */ export interface NormalizedDiscordGuildConfig { requireMention?: boolean; channels?: Record; } export declare function normalizeDiscordGuilds(raw: unknown): Record | undefined; /** * SECURITY P1: Wait for port to become available after shutdown * Polls port availability instead of using fixed setTimeout */ export declare function waitForPortAvailable(port: number, maxWaitMs?: number): Promise; /** * Check existing embedding server and request takeover if needed * Returns true if existing server has chat capability (no takeover needed) * * SECURITY P1: Uses authenticated shutdown with token * SECURITY P1: Validates health response before reuse * SECURITY P1: Uses port polling instead of fixed timeout */ export declare function checkAndTakeoverExistingServer(port: number, shutdownToken: string | null): Promise; export declare function startEmbeddingServerIfAvailable(messageRouter?: any, sessionStore?: any, graphHandler?: any): Promise; /** * Open URL in default browser (cross-platform) */ export declare function openBrowser(url: string): void; /** * Check if onboarding is complete (persona files exist) */ export declare function isOnboardingComplete(): boolean; /** * Sync built-in skills from templates to user's skills directory. * Only copies files that don't already exist (never overwrites user modifications). */ export declare function syncBuiltinSkills(): void; export declare function shouldAutoOpenBrowser(): boolean; export declare function isExecutable(target: string): boolean; export declare function findExecutableInPath(commandName: string): string | null; export declare function resolveCodexCommandForStartup(): string; export declare function hasCodexBackendConfigured(config: Awaited>): boolean; //# sourceMappingURL=utilities.d.ts.map