/** * Server Factory - 服务器工厂 * * Unified Hub V1: single execution path. * Only RouteCodexHttpServer is supported. */ import type { ServerConfigV2 as HttpServerConfigV2 } from './server/runtime/http-server.js'; type ServerConfigV2 = Partial & { server?: Partial; logging?: Partial; providers?: Record; }; /** * 服务器创建选项 */ export interface ServerCreateOptions { config?: { v2HooksEnabled?: boolean; v2MiddlewareEnabled?: boolean; }; } /** * 服务器实例接口 */ export interface ServerInstance { initialize(): Promise; start(): Promise; stop(): Promise; getStatus(): unknown; isInitialized(): boolean; isRunning(): boolean; } /** * 服务器工厂类 */ export declare class ServerFactory { private static v2Instance?; /** * 创建服务器实例 * Unified Hub V1: always create V2 server. */ static createServer(config: ServerConfigV2, options?: ServerCreateOptions): Promise; /** * 创建V2服务器实例 */ static createV2Server(config: ServerConfigV2, options?: ServerCreateOptions): Promise; private static normalizeV2Config; /** * 测试专用:创建V2服务器实例 */ static createV2ServerForTest(config?: Partial): Promise; /** * 获取当前实例状态 */ static getInstanceStatus(): { v2Created: boolean; v2Initialized: boolean; }; /** * 清理实例缓存 */ static clearInstances(): void; /** * 强制重新创建实例 */ static recreateServer(config: ServerConfigV2, options?: ServerCreateOptions): Promise; /** * 获取V2实例 (单例) */ static getV2Instance(): ServerInstance | undefined; } /** * 便捷函数:创建服务器 */ export declare function createRouteCodexServer(config: ServerConfigV2, options?: ServerCreateOptions): Promise; /** * 便捷函数:创建V2服务器 */ export declare function createV2Server(config: ServerConfigV2): Promise; export { ServerFactory as default };