feat(webchat): auto-start at root

This commit is contained in:
Peter Steinberger
2025-12-09 21:07:53 +00:00
parent 3ee3f7e30b
commit bd41cf377a
7 changed files with 43 additions and 10 deletions

View File

@@ -22,6 +22,7 @@ import { defaultRuntime } from "../runtime.js";
import { monitorTelegramProvider } from "../telegram/monitor.js";
import { sendMessageTelegram } from "../telegram/send.js";
import { sendMessageWhatsApp } from "../web/outbound.js";
import { ensureWebChatServerFromConfig } from "../webchat/server.js";
import {
ErrorCodes,
type ErrorShape,
@@ -730,6 +731,13 @@ export async function startGatewayServer(port = 18789): Promise<GatewayServer> {
);
defaultRuntime.log(`gateway log file: ${getResolvedLoggerSettings().file}`);
// Start loopback WebChat server (unless disabled via config).
void ensureWebChatServerFromConfig({
gatewayUrl: `ws://127.0.0.1:${port}`,
}).catch((err) => {
logError(`gateway: webchat failed to start: ${String(err)}`);
});
// Launch configured providers (WhatsApp Web, Telegram) so gateway replies via the
// surface the message came from. Tests can opt out via CLAWDIS_SKIP_PROVIDERS.
if (process.env.CLAWDIS_SKIP_PROVIDERS !== "1") {