/** * ThreadForge Configuration v2 * * Key design changes: * * 1. Services declare their TYPE: * - "edge" → binds an HTTP port, receives external traffic * - "internal" → no port, only reachable via IPC from other services * - "background" → no port, no inbound IPC, runs tasks (cron, queue consumer) * * Only edge services need ports. Internal services live behind the * IPC bus and are never directly exposed. * * 2. Services declare DEPENDENCIES (connects): * Instead of a full mesh (N*(N-1)/2 channels), services declare * which other services they talk to. This means 8 services might * only need 8 channels instead of 28. * * 3. Services can be COLOCATED into process groups: * Lightweight internal services can share a process. One Node.js * event loop handles multiple services via in-process function calls * (zero IPC overhead). Only CPU-heavy services need isolated processes. * * This means 8 services might run in 3 processes instead of 8, * saving ~200MB of memory. * * 4. Thread allocation is per-PROCESS GROUP, not per-service. */ import { type RpcOptions } from "./RpcConfig.js"; import { LogLevel, RegistryMode, RoutingStrategyName, ServiceMode, ServiceType } from "./config-enums.js"; export { LogLevel, LOG_LEVELS, RegistryMode, REGISTRY_MODES, RoutingStrategyName, ROUTING_STRATEGY_NAMES, ServiceMode, SERVICE_MODES, ServiceType, SERVICE_TYPES, } from "./config-enums.js"; interface WebSocketConfigObject { enabled?: boolean; paths?: string[]; } type WebSocketInput = boolean | string[] | WebSocketConfigObject | undefined | null; interface NormalizedWebSocket { enabled: boolean; paths: string[]; } interface RoutingConfig { strategy: RoutingStrategyName; } export interface RawServiceConfig { entry?: string; type?: ServiceType; port?: number; address?: string; connects?: string[]; group?: string; threads?: number | "auto"; weight?: number; mode?: ServiceMode; env?: Record; routing?: { strategy?: RoutingStrategyName; }; prefix?: string; plugins?: string[]; websocket?: WebSocketInput; remotePort?: number; rpc?: RpcOptions; rpcTargets?: Record; } export interface NormalizedService { name: string; entry: string | null; type: ServiceType; port: number | null; address?: string; connects: string[]; group: string | null; threads: number | "auto"; weight: number; mode: ServiceMode; env: Record; routing: RoutingConfig; prefix?: string | null; plugins?: string[] | null; websocket: NormalizedWebSocket | null; rpc?: RpcOptions; rpcTargets?: Record; } export interface ProcessGroup { name: string; services: NormalizedService[]; threads: number | "auto"; weight: number; hasEdge: boolean; port: number | null; } export interface Channel { from: string; to: string; } interface LoggingConfig { level: LogLevel; structured: boolean; } interface InternalConfig { configUrl: string | undefined; isHostMode: boolean | undefined; isPlatformMode: boolean | undefined; hostMeta: unknown; hostMetaJSON: string | undefined; } export interface SiteConfig { [key: string]: unknown; } export interface DefineServicesOptions { metricsPort?: number; logging?: Partial; watch?: boolean; registryMode?: RegistryMode; host?: string; httpBasePort?: number; ingress?: Record; plugins?: unknown[]; frontendPlugins?: unknown[]; sites?: Record; _configUrl?: string; _isHostMode?: boolean; _isPlatformMode?: boolean; _hostMeta?: unknown; _hostMetaJSON?: string; [key: string]: unknown; } export interface NormalizedConfig { services: Record; groups: Record; channels: Channel[]; plugins: unknown[]; frontendPlugins: unknown[]; sites: Record; metricsPort: number; logging: LoggingConfig; watch: boolean; registryMode: RegistryMode | undefined; host: string | undefined; httpBasePort: number | undefined; ingress: Record | undefined; _internal: InternalConfig; _configUrl: string | undefined; _isHostMode: boolean | undefined; _isPlatformMode: boolean | undefined; _hostMeta: unknown; _hostMetaJSON: string | undefined; } /** * Define services for the ThreadForge runtime. */ export declare function defineServices(servicesMap: Record & { plugins?: unknown[]; }, options?: DefineServicesOptions): NormalizedConfig; /** * Load a forge config file from disk. */ export declare function loadConfig(configPath: string): Promise; //# sourceMappingURL=config.d.ts.map