refactor(whatsapp): rename lazy channel runtime seam

This commit is contained in:
Marcus Castro
2026-04-13 21:33:45 -03:00
parent b1f2b40675
commit d8374aba34
3 changed files with 17 additions and 3 deletions

View File

@@ -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<WhatsAppRuntimeAssembly> | null = null;
let setupSurfacePromise: Promise<WhatsAppSetupSurface> | null = null;
export function loadWhatsAppChannelRuntime(): Promise<WhatsAppRuntimeAssembly> {
runtimeAssemblyPromise ??= import("./src/channel-runtime.runtime.js");
runtimeAssemblyPromise ??= import("./src/channel.runtime.js");
return runtimeAssemblyPromise;
}

View File

@@ -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);

View File

@@ -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";