From d8374aba343640d0311eebc6ec7b66657cfaec8f Mon Sep 17 00:00:00 2001 From: Marcus Castro Date: Mon, 13 Apr 2026 21:33:45 -0300 Subject: [PATCH] refactor(whatsapp): rename lazy channel runtime seam --- extensions/whatsapp/assembly.ts | 4 ++-- extensions/whatsapp/index.test.ts | 2 +- extensions/whatsapp/src/channel.runtime.ts | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 extensions/whatsapp/src/channel.runtime.ts diff --git a/extensions/whatsapp/assembly.ts b/extensions/whatsapp/assembly.ts index 8184d1239b8..691c076f6e7 100644 --- a/extensions/whatsapp/assembly.ts +++ b/extensions/whatsapp/assembly.ts @@ -8,7 +8,7 @@ import { } from "openclaw/plugin-sdk/setup-runtime"; import { whatsappSetupWizardContract } from "./src/setup-contract.js"; -type WhatsAppRuntimeAssembly = typeof import("./src/channel-runtime.runtime.js"); +type WhatsAppRuntimeAssembly = typeof import("./src/channel.runtime.js"); type WhatsAppSetupSurface = typeof import("./src/setup-surface.js"); export const whatsappAssembly = { @@ -103,7 +103,7 @@ let runtimeAssemblyPromise: Promise | null = null; let setupSurfacePromise: Promise | null = null; export function loadWhatsAppChannelRuntime(): Promise { - runtimeAssemblyPromise ??= import("./src/channel-runtime.runtime.js"); + runtimeAssemblyPromise ??= import("./src/channel.runtime.js"); return runtimeAssemblyPromise; } diff --git a/extensions/whatsapp/index.test.ts b/extensions/whatsapp/index.test.ts index 27308f9cb87..3640dae2c71 100644 --- a/extensions/whatsapp/index.test.ts +++ b/extensions/whatsapp/index.test.ts @@ -40,7 +40,7 @@ describe("whatsapp bundled entries", () => { expect(indexSource).toContain("defineWhatsAppBundledChannelEntry(import.meta.url)"); expect(setupEntrySource).toContain("defineWhatsAppBundledChannelSetupEntry(import.meta.url)"); - expect(assemblySource).toContain('import("./src/channel-runtime.runtime.js")'); + expect(assemblySource).toContain('import("./src/channel.runtime.js")'); expect(runtimeApiSource).toContain('from "./src/runtime-api.js"'); expect(lightRuntimeApiSource).toContain('from "./src/light-runtime-api.js"'); expect(entry.id).toBe(whatsappAssembly.id); diff --git a/extensions/whatsapp/src/channel.runtime.ts b/extensions/whatsapp/src/channel.runtime.ts new file mode 100644 index 00000000000..4d9e0e17cf0 --- /dev/null +++ b/extensions/whatsapp/src/channel.runtime.ts @@ -0,0 +1,14 @@ +// Keep the lazy channel runtime boundary separate from the public runtime-api +// wrapper so production code does not mix static and dynamic imports of the +// same module path. +export { getActiveWebListener } from "./active-listener.js"; +export { + getWebAuthAgeMs, + logWebSelfId, + logoutWeb, + readWebSelfId, + webAuthExists, +} from "./auth-store.js"; +export { monitorWebChannel } from "./auto-reply/monitor.js"; +export { loginWeb } from "./login.js"; +export { startWebLoginWithQr, waitForWebLogin } from "../login-qr-runtime.js";