import { Router } from 'express'; import type { Server as HttpServer } from 'http'; /** * Express adapter for mounting the Long Tail dashboard at an arbitrary subpath * inside an existing Express-based application (NestJS, Fastify-Express, etc.). * * @example NestJS * ```typescript * import { LTExpressAdapter } from '@hotmeshio/long-tail'; * * const adapter = new LTExpressAdapter(); * adapter.setBasePath('/admin/longtail'); * * @Module({}) * export class LongTailUiModule implements NestModule { * configure(consumer: MiddlewareConsumer) { * consumer * .apply(adapter.getRouter()) * .forRoutes('/admin/longtail'); * } * * async onModuleInit() { * // Attach socket.io to the host's HTTP server for real-time events * const httpServer = this.httpAdapterHost.httpAdapter.getHttpServer(); * await adapter.attachServer(httpServer); * } * } * ``` * * @example Express * ```typescript * import { LTExpressAdapter } from '@hotmeshio/long-tail'; * * const adapter = new LTExpressAdapter(); * adapter.setBasePath('/admin/longtail'); * app.use('/admin/longtail', adapter.getRouter()); * * const server = app.listen(3000); * await adapter.attachServer(server); * ``` */ export declare class LTExpressAdapter { private basePath; /** * Set the subpath where the dashboard is mounted. * Omit or pass '' for root-level deployment (standalone mode). */ setBasePath(basePath: string): void; /** * Attach Socket.IO to the host's HTTP server for real-time events. * * When Long Tail is started with `server: { enabled: false }` (embedded mode), * the internal server is not created. Call this after the host server is * listening so Socket.IO can bind to it with the correct subpath. * * Safe to call even when no Socket.IO adapter is registered — it no-ops. */ attachServer(server: HttpServer): Promise; /** * Return a self-contained Express Router that serves: * - `/api/*` — Long Tail API routes (auth, tasks, escalations, etc.) * - `/mcp` — MCP streamable-HTTP transport (Claude Desktop, Cursor, agents) * - `/health` — health check * - Static dashboard assets * - SPA fallback with injected `` and `window.__LT_BASE__` */ getRouter(): Router; private resolveDashboardDist; }