/** * HTTP 服务器 — SSE 流式、速率限制、去重、allowFrom、群聊、webhook、 * 心跳、typing、per-IP 限流、会话管理、聊天命令、文件上传、优雅关闭 */ import { type ServerResponse, type Server } from "node:http"; import { SessionStore } from "./utils/session-store.js"; import type { HttpApiAccount } from "./types.js"; interface ServerOptions { port: number; accountId: string; account: HttpApiAccount; runtime: Record; config: Record; log: { info: (...a: unknown[]) => void; warn: (...a: unknown[]) => void; error: (...a: unknown[]) => void; }; abortSignal: AbortSignal; onReady?: () => void; } /** 请求统计 */ interface Stats { startTime: number; total: number; success: number; error: number; } /** 获取指定 account 的运行时 webhook URL(供 outbound 适配器使用) */ export declare function getRuntimeWebhookUrl(accountId?: string): string | null; /** 获取指定 account 的运行时 webhook secret(供 outbound 适配器使用) */ export declare function getRuntimeWebhookSecret(accountId?: string): string | null; /** 暴露给 channel 适配器的运行时状态 */ export interface AccountRuntimeState { sessionStore: SessionStore; port: number; activeConnections: Set; stats: Stats; } /** 获取指定 account 的运行时状态(供 directory/heartbeat 等适配器使用) */ export declare function getAccountState(accountId?: string): AccountRuntimeState | null; export declare function startHttpServer(opts: ServerOptions): Promise; export {}; //# sourceMappingURL=server.d.ts.map