diff --git a/extensions/whatsapp/runtime-api.ts b/extensions/whatsapp/runtime-api.ts index 95d77be9899..9732e1bc5d3 100644 --- a/extensions/whatsapp/runtime-api.ts +++ b/extensions/whatsapp/runtime-api.ts @@ -1,12 +1,86 @@ -export * from "./src/active-listener.js"; -export * from "./src/action-runtime.js"; -export * from "./src/agent-tools-login.js"; -export * from "./src/auth-store.js"; -export * from "./src/auto-reply.js"; -export * from "./src/inbound.js"; -export * from "./src/login.js"; -export * from "./src/media.js"; -export * from "./src/send.js"; -export * from "./src/session.js"; +export { + getActiveWebListener, + resolveWebAccountId, + type ActiveWebListener, + type ActiveWebSendOptions, +} from "./src/active-listener.js"; +export { handleWhatsAppAction, whatsAppActionRuntime } from "./src/action-runtime.js"; +export { createWhatsAppLoginTool } from "./src/agent-tools-login.js"; +export { + formatWhatsAppWebAuthStatusState, + getWebAuthAgeMs, + hasWebCredsSync, + logWebSelfId, + logoutWeb, + pickWebChannel, + readCredsJsonRaw, + readWebAuthExistsBestEffort, + readWebAuthExistsForDecision, + readWebAuthSnapshot, + readWebAuthSnapshotBestEffort, + readWebAuthState, + readWebSelfId, + readWebSelfIdentity, + readWebSelfIdentityForDecision, + resolveDefaultWebAuthDir, + resolveWebCredsBackupPath, + resolveWebCredsPath, + restoreCredsFromBackupIfNeeded, + WA_WEB_AUTH_DIR, + webAuthExists, + WHATSAPP_AUTH_UNSTABLE_CODE, + WhatsAppAuthUnstableError, + type WhatsAppWebAuthState, +} from "./src/auth-store.js"; +export { + DEFAULT_WEB_MEDIA_BYTES, + HEARTBEAT_PROMPT, + HEARTBEAT_TOKEN, + monitorWebChannel, + resolveHeartbeatRecipients, + runWebHeartbeatOnce, + SILENT_REPLY_TOKEN, + stripHeartbeatToken, + type WebChannelStatus, + type WebMonitorTuning, +} from "./src/auto-reply.js"; +export { + extractContactContext, + extractLocationData, + extractMediaPlaceholder, + extractText, + monitorWebInbox, + resetWebInboundDedupe, + type WebInboundMessage, + type WebListenerCloseReason, +} from "./src/inbound.js"; +export { loginWeb } from "./src/login.js"; +export { + getDefaultLocalRoots, + loadWebMedia, + loadWebMediaRaw, + LocalMediaAccessError, + optimizeImageToJpeg, + optimizeImageToPng, + type LocalMediaAccessErrorCode, + type WebMediaResult, +} from "./src/media.js"; +export { + sendMessageWhatsApp, + sendPollWhatsApp, + sendReactionWhatsApp, + sendTypingWhatsApp, +} from "./src/send.js"; +export { + createWaSocket, + formatError, + getStatusCode, + newConnectionId, + waitForCredsSaveQueue, + waitForCredsSaveQueueWithTimeout, + waitForWaConnection, + writeCredsJsonAtomically, + type CredsQueueWaitResult, +} from "./src/session.js"; export { setWhatsAppRuntime } from "./src/runtime.js"; export { startWebLoginWithQr, waitForWebLogin } from "./login-qr-runtime.js"; diff --git a/src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts b/src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts index f891281fbd0..8a1eb70415a 100644 --- a/src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts +++ b/src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts @@ -233,16 +233,16 @@ const RUNTIME_API_EXPORT_GUARDS: Record = { ], [bundledPluginFile({ rootDir: ROOT_DIR, pluginId: "whatsapp", relativePath: "runtime-api.ts" })]: [ - 'export * from "./src/active-listener.js";', - 'export * from "./src/action-runtime.js";', - 'export * from "./src/agent-tools-login.js";', - 'export * from "./src/auth-store.js";', - 'export * from "./src/auto-reply.js";', - 'export * from "./src/inbound.js";', - 'export * from "./src/login.js";', - 'export * from "./src/media.js";', - 'export * from "./src/send.js";', - 'export * from "./src/session.js";', + 'export { getActiveWebListener, resolveWebAccountId, type ActiveWebListener, type ActiveWebSendOptions } from "./src/active-listener.js";', + 'export { handleWhatsAppAction, whatsAppActionRuntime } from "./src/action-runtime.js";', + 'export { createWhatsAppLoginTool } from "./src/agent-tools-login.js";', + 'export { formatWhatsAppWebAuthStatusState, getWebAuthAgeMs, hasWebCredsSync, logWebSelfId, logoutWeb, pickWebChannel, readCredsJsonRaw, readWebAuthExistsBestEffort, readWebAuthExistsForDecision, readWebAuthSnapshot, readWebAuthSnapshotBestEffort, readWebAuthState, readWebSelfId, readWebSelfIdentity, readWebSelfIdentityForDecision, resolveDefaultWebAuthDir, resolveWebCredsBackupPath, resolveWebCredsPath, restoreCredsFromBackupIfNeeded, WA_WEB_AUTH_DIR, webAuthExists, WHATSAPP_AUTH_UNSTABLE_CODE, WhatsAppAuthUnstableError, type WhatsAppWebAuthState } from "./src/auth-store.js";', + 'export { DEFAULT_WEB_MEDIA_BYTES, HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, monitorWebChannel, resolveHeartbeatRecipients, runWebHeartbeatOnce, SILENT_REPLY_TOKEN, stripHeartbeatToken, type WebChannelStatus, type WebMonitorTuning } from "./src/auto-reply.js";', + 'export { extractContactContext, extractLocationData, extractMediaPlaceholder, extractText, monitorWebInbox, resetWebInboundDedupe, type WebInboundMessage, type WebListenerCloseReason } from "./src/inbound.js";', + 'export { loginWeb } from "./src/login.js";', + 'export { getDefaultLocalRoots, loadWebMedia, loadWebMediaRaw, LocalMediaAccessError, optimizeImageToJpeg, optimizeImageToPng, type LocalMediaAccessErrorCode, type WebMediaResult } from "./src/media.js";', + 'export { sendMessageWhatsApp, sendPollWhatsApp, sendReactionWhatsApp, sendTypingWhatsApp } from "./src/send.js";', + 'export { createWaSocket, formatError, getStatusCode, newConnectionId, waitForCredsSaveQueue, waitForCredsSaveQueueWithTimeout, waitForWaConnection, writeCredsJsonAtomically, type CredsQueueWaitResult } from "./src/session.js";', 'export { setWhatsAppRuntime } from "./src/runtime.js";', 'export { startWebLoginWithQr, waitForWebLogin } from "./login-qr-runtime.js";', ],