refactor: untangle whatsapp runtime boundary

This commit is contained in:
Peter Steinberger
2026-03-19 03:12:16 +00:00
parent 510f4276b5
commit 30a94dfd3b
33 changed files with 848 additions and 474 deletions

View File

@@ -248,6 +248,8 @@ describe("plugin-sdk subpath exports", () => {
expect(typeof whatsappSdk.WhatsAppConfigSchema).toBe("object");
expect(typeof whatsappSdk.resolveWhatsAppOutboundTarget).toBe("function");
expect(typeof whatsappSdk.resolveWhatsAppMentionStripRegexes).toBe("function");
expect(typeof whatsappSdk.sendMessageWhatsApp).toBe("function");
expect(typeof whatsappSdk.loadWebMedia).toBe("function");
});
it("exports WhatsApp QR login helpers from the dedicated subpath", () => {

View File

@@ -3,4 +3,4 @@ export {
loadWebMedia,
loadWebMediaRaw,
type WebMediaResult,
} from "../../extensions/whatsapp/runtime-api.js";
} from "../media/web-media.js";

View File

@@ -1 +1 @@
export { handleWhatsAppAction } from "../../extensions/whatsapp/action-runtime-api.js";
export { handleWhatsAppAction } from "../plugins/runtime/runtime-whatsapp-boundary.js";

View File

@@ -1 +1,4 @@
export { startWebLoginWithQr, waitForWebLogin } from "../../extensions/whatsapp/login-qr-api.js";
export {
startWebLoginWithQr,
waitForWebLogin,
} from "../plugins/runtime/runtime-whatsapp-boundary.js";

View File

@@ -0,0 +1,9 @@
export type { ChannelMessageActionName } from "../channels/plugins/types.js";
export type { DmPolicy, GroupPolicy, WhatsAppAccountConfig } from "../config/types.js";
export {
createWhatsAppOutboundBase,
resolveWhatsAppGroupIntroHint,
resolveWhatsAppMentionStripRegexes,
} from "../channels/plugins/whatsapp-shared.js";
export { resolveWhatsAppHeartbeatRecipients } from "../channels/plugins/whatsapp-heartbeat.js";
export { isWhatsAppGroupJid, normalizeWhatsAppTarget } from "../whatsapp/normalize.js";

View File

@@ -1,11 +1,14 @@
export type { ChannelMessageActionName } from "../channels/plugins/types.js";
export type { OpenClawConfig } from "../config/config.js";
export type { DmPolicy, GroupPolicy, WhatsAppAccountConfig } from "../config/types.js";
export type { WebChannelStatus, WebMonitorTuning } from "../../extensions/whatsapp/runtime-api.js";
export type {
WebChannelStatus,
WebMonitorTuning,
} from "../../extensions/whatsapp/src/auto-reply/types.js";
export type {
WebInboundMessage,
WebListenerCloseReason,
} from "../../extensions/whatsapp/runtime-api.js";
} from "../../extensions/whatsapp/src/inbound/types.js";
export type {
ChannelMessageActionContext,
ChannelPlugin,
@@ -71,44 +74,40 @@ export {
resolveWhatsAppAccount,
} from "../../extensions/whatsapp/api.js";
export {
getActiveWebListener,
getWebAuthAgeMs,
WA_WEB_AUTH_DIR,
logWebSelfId,
logoutWeb,
pickWebChannel,
readWebSelfId,
webAuthExists,
} from "../../extensions/whatsapp/runtime-api.js";
export {
DEFAULT_WEB_MEDIA_BYTES,
HEARTBEAT_PROMPT,
HEARTBEAT_TOKEN,
WA_WEB_AUTH_DIR,
createWaSocket,
formatError,
loginWeb,
logWebSelfId,
logoutWeb,
monitorWebChannel,
pickWebChannel,
resolveHeartbeatRecipients,
runWebHeartbeatOnce,
} from "../../extensions/whatsapp/runtime-api.js";
sendMessageWhatsApp,
sendReactionWhatsApp,
waitForWaConnection,
webAuthExists,
} from "../channel-web.js";
export {
extractMediaPlaceholder,
extractText,
getActiveWebListener,
getWebAuthAgeMs,
monitorWebInbox,
} from "../../extensions/whatsapp/runtime-api.js";
export { loginWeb } from "../../extensions/whatsapp/runtime-api.js";
readWebSelfId,
sendPollWhatsApp,
startWebLoginWithQr,
waitForWebLogin,
} from "../plugins/runtime/runtime-whatsapp-boundary.js";
export { DEFAULT_WEB_MEDIA_BYTES } from "../../extensions/whatsapp/src/auto-reply/constants.js";
export {
getDefaultLocalRoots,
loadWebMedia,
loadWebMediaRaw,
optimizeImageToJpeg,
} from "../../extensions/whatsapp/runtime-api.js";
export {
sendMessageWhatsApp,
sendPollWhatsApp,
sendReactionWhatsApp,
} from "../../extensions/whatsapp/runtime-api.js";
export {
createWaSocket,
formatError,
getStatusCode,
waitForWaConnection,
} from "../../extensions/whatsapp/runtime-api.js";
export { createWhatsAppLoginTool } from "../../extensions/whatsapp/runtime-api.js";
} from "../media/web-media.js";
export { getStatusCode } from "../plugins/runtime/runtime-whatsapp-boundary.js";
export { createRuntimeWhatsAppLoginTool as createWhatsAppLoginTool } from "../plugins/runtime/runtime-whatsapp-boundary.js";