@openclaw/whatsapp 2026.5.27 → 2026.5.28-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{access-control-tKMSybhe.js → access-control-Z0fYaWrx.js} +11 -3
- package/dist/{action-runtime-ClWX76J7.js → action-runtime-BdhkGtaP.js} +1 -2
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/{active-listener-B4SDebQ6.js → active-listener-CFwkn3ho.js} +1 -1
- package/dist/{agent-tools-login-BDzvb3ee.js → agent-tools-login-BX7eHgDm.js} +5 -3
- package/dist/api.js +7 -9
- package/dist/{approval-handler.runtime-CnM8rqpB.js → approval-handler.runtime-C25wPeBf.js} +6 -23
- package/dist/{channel-DeRnX7Dx.js → channel-CeSu_mqS.js} +149 -108
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-Bo_hIjzN.js → channel-react-action-Cd2qkLqp.js} +2 -2
- package/dist/{channel.runtime-C08TFa-d.js → channel.runtime-S9MB6sub.js} +4 -4
- package/dist/{channel.setup-CtTHpu8o.js → channel.setup-BNqtW-u1.js} +1 -1
- package/dist/{connection-controller-ja6z4F_k.js → connection-controller-BZuzYCGM.js} +2 -3
- package/dist/contract-api.js +1 -2
- package/dist/light-runtime-api.js +3 -3
- package/dist/{login-1rs_uPW-.js → login-1yyBrXTL.js} +3 -3
- package/dist/{login-qr-CdhkC9Ij.js → login-qr-6DdwGlkz.js} +2 -2
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-BdKlBuaK.js → monitor-CzL4sZSN.js} +9 -9
- package/dist/runtime-api.js +9 -9
- package/dist/{send-D0iPQBMX.js → send-C4LG-Cl6.js} +199 -11
- package/dist/{send-api-3hUuzYv1.js → send-api-C66vkRl9.js} +1 -1
- package/dist/{session-CDgpDc0l.js → session-D8UW2Vbn.js} +13 -10
- package/dist/{session-errors-BAj9D2La.js → session-errors-CbsoQqoy.js} +22 -1
- package/dist/{setup-core-cgB2JDjU.js → setup-core-C2os03mR.js} +2 -2
- package/dist/{setup-finalize-CCZdGnko.js → setup-finalize-IDTrWXtX.js} +2 -2
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BouY1WI8.js → setup-surface-BOhQVZqy.js} +1 -1
- package/npm-shrinkwrap.json +3 -26
- package/openclaw.plugin.json +18 -0
- package/package.json +4 -6
- package/dist/connection-controller-registry-TSX_udJp.js +0 -22
- package/dist/outbound-adapter-CcNeZvD_.js +0 -30
- package/dist/outbound-base-MHdfVWvv.js +0 -125
- package/dist/outbound-media-contract-B3Y-9slb.js +0 -184
- package/dist/outbound-payload-test-api.js +0 -2
- package/dist/reaction-level-BF3d5IgO.js +0 -16
- package/dist/runtime-group-policy-DeSRFXEV.js +0 -11
- package/dist/test-api.js +0 -3
- package/node_modules/agent-base/LICENSE +0 -22
- package/node_modules/agent-base/README.md +0 -69
- package/node_modules/agent-base/dist/helpers.d.ts +0 -10
- package/node_modules/agent-base/dist/helpers.d.ts.map +0 -1
- package/node_modules/agent-base/dist/helpers.js +0 -37
- package/node_modules/agent-base/dist/helpers.js.map +0 -1
- package/node_modules/agent-base/dist/index.d.ts +0 -37
- package/node_modules/agent-base/dist/index.d.ts.map +0 -1
- package/node_modules/agent-base/dist/index.js +0 -146
- package/node_modules/agent-base/dist/index.js.map +0 -1
- package/node_modules/agent-base/package.json +0 -46
- package/node_modules/https-proxy-agent/LICENSE +0 -22
- package/node_modules/https-proxy-agent/README.md +0 -70
- package/node_modules/https-proxy-agent/dist/index.d.ts +0 -43
- package/node_modules/https-proxy-agent/dist/index.d.ts.map +0 -1
- package/node_modules/https-proxy-agent/dist/index.js +0 -150
- package/node_modules/https-proxy-agent/dist/index.js.map +0 -1
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +0 -12
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts.map +0 -1
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +0 -94
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +0 -1
- package/node_modules/https-proxy-agent/package.json +0 -50
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount } from "./accounts-BMGM1RtF.js";
|
|
2
2
|
import { f as readWebAuthExistsForDecision, g as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-BrKb0mwT.js";
|
|
3
|
-
import { i as resolveWhatsAppSocketTiming, t as createWaSocket } from "./session-
|
|
4
|
-
import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-
|
|
3
|
+
import { i as resolveWhatsAppSocketTiming, t as createWaSocket } from "./session-D8UW2Vbn.js";
|
|
4
|
+
import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-BZuzYCGM.js";
|
|
5
5
|
import { logInfo } from "openclaw/plugin-sdk/logging-core";
|
|
6
6
|
import { danger, defaultRuntime, info, success } from "openclaw/plugin-sdk/runtime-env";
|
|
7
7
|
import { renderQrPngDataUrl } from "openclaw/plugin-sdk/media-runtime";
|
package/dist/login-qr-runtime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region extensions/whatsapp/login-qr-runtime.ts
|
|
2
2
|
let loginQrModulePromise = null;
|
|
3
3
|
function loadLoginQrModule() {
|
|
4
|
-
loginQrModulePromise ??= import("./login-qr-
|
|
4
|
+
loginQrModulePromise ??= import("./login-qr-6DdwGlkz.js");
|
|
5
5
|
return loginQrModulePromise;
|
|
6
6
|
}
|
|
7
7
|
async function startWebLoginWithQr(...args) {
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-BMGM1RtF.js";
|
|
2
2
|
import { t as isWhatsAppGroupJid } from "./normalize-target-bVWjgftN.js";
|
|
3
|
-
import {
|
|
4
|
-
import { o as maybeResolveWhatsAppApprovalReaction, r as sendReactionWhatsApp } from "./send-D0iPQBMX.js";
|
|
3
|
+
import { a as normalizeWhatsAppOutboundPayload, c as prepareWhatsAppOutboundMedia, d as maybeResolveWhatsAppApprovalReaction, g as resolveWhatsAppReactionLevel, l as sendWhatsAppOutboundWithRetry, r as sendReactionWhatsApp, s as normalizeWhatsAppPayloadTextPreservingIndentation } from "./send-C4LG-Cl6.js";
|
|
5
4
|
import { n as getWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
6
|
-
import {
|
|
7
|
-
import { n as getStatusCode, t as formatError } from "./session-errors-BAj9D2La.js";
|
|
5
|
+
import { n as getStatusCode, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
8
6
|
import { d as markdownToWhatsApp, f as resolveJidToE164, l as isSelfChatMode, n as normalizeE164, t as convertMarkdownTables$1, u as jidToE164 } from "./text-runtime-Dk37KYHj.js";
|
|
9
7
|
import { n as cacheInboundMessageMeta, r as lookupInboundMessageMeta, t as buildQuotedMessageOptions } from "./quoted-message-CveINB35.js";
|
|
10
8
|
import { c as logoutWeb, g as readWebSelfId, o as getWebAuthAgeMs, r as WhatsAppAuthUnstableError, v as readWebSelfIdentityForDecision } from "./auth-store-BrKb0mwT.js";
|
|
11
9
|
import { a as getSelfIdentity, c as resolveComparableIdentity, i as getReplyContext, n as getMentionIdentities, o as getSenderIdentity, r as getPrimaryIdentityId, s as identitiesOverlap, t as getComparableIdentityValues } from "./identity-xoLLdqEv.js";
|
|
12
10
|
import { n as resolveWhatsAppGroupsConfigPath } from "./group-config-path-BGyzT9Lg.js";
|
|
13
|
-
import { i as resolveWhatsAppInboundPolicy, r as resolveWhatsAppCommandAuthorized, t as checkInboundAccessControl } from "./access-control-
|
|
14
|
-
import { a as mayContainWhatsAppOutboundMention, c as describeReplyContext, d as extractLocationData, f as extractMediaPlaceholder, h as hasInboundUserContent, i as addWhatsAppOutboundMentionsToContent, l as extractContactContext, m as extractText, n as listWhatsAppSendResultMessageIds, o as resolveWhatsAppOutboundMentions, p as extractMentionedJids, r as normalizeWhatsAppSendResult, s as addWhatsAppImagePreviewFields, t as createWebSendApi, u as extractContextInfo } from "./send-api-
|
|
15
|
-
import { i as resolveWhatsAppSocketTiming, r as waitForWaConnection, t as createWaSocket } from "./session-
|
|
11
|
+
import { i as resolveWhatsAppInboundPolicy, r as resolveWhatsAppCommandAuthorized, t as checkInboundAccessControl } from "./access-control-Z0fYaWrx.js";
|
|
12
|
+
import { a as mayContainWhatsAppOutboundMention, c as describeReplyContext, d as extractLocationData, f as extractMediaPlaceholder, h as hasInboundUserContent, i as addWhatsAppOutboundMentionsToContent, l as extractContactContext, m as extractText, n as listWhatsAppSendResultMessageIds, o as resolveWhatsAppOutboundMentions, p as extractMentionedJids, r as normalizeWhatsAppSendResult, s as addWhatsAppImagePreviewFields, t as createWebSendApi, u as extractContextInfo } from "./send-api-C66vkRl9.js";
|
|
13
|
+
import { i as resolveWhatsAppSocketTiming, r as waitForWaConnection, t as createWaSocket } from "./session-D8UW2Vbn.js";
|
|
16
14
|
import { t as BufferJSON } from "./session.runtime-LZFdq3yb.js";
|
|
17
|
-
import { c as computeBackoff, d as resolveReconnectPolicy, f as sleepWithAbort, l as newConnectionId, n as WHATSAPP_WATCHDOG_TIMEOUT_ERROR, r as WhatsAppConnectionController, s as DEFAULT_RECONNECT_POLICY, u as resolveHeartbeatSeconds } from "./connection-controller-
|
|
15
|
+
import { c as computeBackoff, d as resolveReconnectPolicy, f as sleepWithAbort, l as newConnectionId, n as WHATSAPP_WATCHDOG_TIMEOUT_ERROR, r as WhatsAppConnectionController, s as DEFAULT_RECONNECT_POLICY, u as resolveHeartbeatSeconds } from "./connection-controller-BZuzYCGM.js";
|
|
18
16
|
import { resolveAccountEntry } from "openclaw/plugin-sdk/account-core";
|
|
19
17
|
import { normalizeLowercaseStringOrEmpty, normalizeStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
20
18
|
import { createChannelMessageReplyPipeline, createDurableInboundReceiveJournal, createMessageReceiptFromOutboundResults, deliverInboundReplyWithMessageSendContext, resolveChannelMessageSourceReplyDeliveryMode } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -2501,7 +2499,9 @@ const WHATSAPP_MESSAGE_RECEIVED_HOOK_LIMITS = {
|
|
|
2501
2499
|
};
|
|
2502
2500
|
function readWhatsAppMessageReceivedHookOptIn(value) {
|
|
2503
2501
|
if (!value || typeof value !== "object") return;
|
|
2504
|
-
|
|
2502
|
+
const pluginHooks = value.pluginHooks;
|
|
2503
|
+
if (pluginHooks?.messageReceived === void 0) return;
|
|
2504
|
+
return pluginHooks.messageReceived;
|
|
2505
2505
|
}
|
|
2506
2506
|
function shouldEmitWhatsAppMessageReceivedHooks(params) {
|
|
2507
2507
|
const channelConfig = params.cfg.channels?.whatsapp;
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { o as resolveWebCredsBackupPath, r as hasWebCredsSync, s as resolveWebCredsPath } from "./creds-files-B1kSWtBg.js";
|
|
2
|
-
import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-
|
|
3
|
-
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-
|
|
2
|
+
import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-BdhkGtaP.js";
|
|
3
|
+
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-C4LG-Cl6.js";
|
|
4
4
|
import { r as setWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
5
|
-
import { n as getStatusCode, t as formatError } from "./session-errors-
|
|
5
|
+
import { n as getStatusCode, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
6
6
|
import { startWebLoginWithQr, waitForWebLogin } from "./login-qr-runtime.js";
|
|
7
|
-
import { t as createWhatsAppLoginTool } from "./agent-tools-login-
|
|
7
|
+
import { t as createWhatsAppLoginTool } from "./agent-tools-login-BX7eHgDm.js";
|
|
8
8
|
import { C as waitForCredsSaveQueue, T as writeCredsJsonAtomically, _ as readWebSelfIdentity, a as formatWhatsAppWebAuthStatusState, b as restoreCredsFromBackupIfNeeded, c as logoutWeb, d as readWebAuthExistsBestEffort, f as readWebAuthExistsForDecision, g as readWebSelfId, h as readWebAuthState, l as pickWebChannel, m as readWebAuthSnapshotBestEffort, n as WHATSAPP_AUTH_UNSTABLE_CODE, o as getWebAuthAgeMs, p as readWebAuthSnapshot, r as WhatsAppAuthUnstableError, s as logWebSelfId, t as WA_WEB_AUTH_DIR, u as readCredsJsonRaw, v as readWebSelfIdentityForDecision, w as waitForCredsSaveQueueWithTimeout, x as webAuthExists, y as resolveDefaultWebAuthDir } from "./auth-store-BrKb0mwT.js";
|
|
9
9
|
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-HU41RHGI.js";
|
|
10
|
-
import { d as extractLocationData, f as extractMediaPlaceholder, l as extractContactContext, m as extractText } from "./send-api-
|
|
11
|
-
import { n as newConnectionId, r as waitForWaConnection, t as createWaSocket } from "./session-
|
|
12
|
-
import { n as resolveWebAccountId, t as getActiveWebListener } from "./active-listener-
|
|
13
|
-
import { a as loadWebMediaRaw, c as monitorWebInbox, i as loadWebMedia, l as resetWebInboundDedupe, n as LocalMediaAccessError, o as optimizeImageToJpeg, r as getDefaultLocalRoots, s as optimizeImageToPng, t as monitorWebChannel } from "./monitor-
|
|
14
|
-
import { t as loginWeb } from "./login-
|
|
10
|
+
import { d as extractLocationData, f as extractMediaPlaceholder, l as extractContactContext, m as extractText } from "./send-api-C66vkRl9.js";
|
|
11
|
+
import { n as newConnectionId, r as waitForWaConnection, t as createWaSocket } from "./session-D8UW2Vbn.js";
|
|
12
|
+
import { n as resolveWebAccountId, t as getActiveWebListener } from "./active-listener-CFwkn3ho.js";
|
|
13
|
+
import { a as loadWebMediaRaw, c as monitorWebInbox, i as loadWebMedia, l as resetWebInboundDedupe, n as LocalMediaAccessError, o as optimizeImageToJpeg, r as getDefaultLocalRoots, s as optimizeImageToPng, t as monitorWebChannel } from "./monitor-CzL4sZSN.js";
|
|
14
|
+
import { t as loginWeb } from "./login-1yyBrXTL.js";
|
|
15
15
|
import { HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, SILENT_REPLY_TOKEN, stripHeartbeatToken } from "openclaw/plugin-sdk/reply-runtime";
|
|
16
16
|
export { DEFAULT_WEB_MEDIA_BYTES, HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, LocalMediaAccessError, SILENT_REPLY_TOKEN, WA_WEB_AUTH_DIR, WHATSAPP_AUTH_UNSTABLE_CODE, WhatsAppAuthUnstableError, createWaSocket, createWhatsAppLoginTool, extractContactContext, extractLocationData, extractMediaPlaceholder, extractText, formatError, formatWhatsAppWebAuthStatusState, getActiveWebListener, getDefaultLocalRoots, getStatusCode, getWebAuthAgeMs, handleWhatsAppAction, hasWebCredsSync, loadWebMedia, loadWebMediaRaw, logWebSelfId, loginWeb, logoutWeb, monitorWebChannel, monitorWebInbox, newConnectionId, optimizeImageToJpeg, optimizeImageToPng, pickWebChannel, readCredsJsonRaw, readWebAuthExistsBestEffort, readWebAuthExistsForDecision, readWebAuthSnapshot, readWebAuthSnapshotBestEffort, readWebAuthState, readWebSelfId, readWebSelfIdentity, readWebSelfIdentityForDecision, resetWebInboundDedupe, resolveDefaultWebAuthDir, resolveWebAccountId, resolveWebCredsBackupPath, resolveWebCredsPath, restoreCredsFromBackupIfNeeded, sendMessageWhatsApp, sendPollWhatsApp, sendReactionWhatsApp, sendTypingWhatsApp, setWhatsAppRuntime, startWebLoginWithQr, stripHeartbeatToken, waitForCredsSaveQueue, waitForCredsSaveQueueWithTimeout, waitForWaConnection, waitForWebLogin, webAuthExists, whatsAppActionRuntime, writeCredsJsonAtomically };
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as resolveMergedWhatsAppAccountConfig } from "./account-config-6PTOSfaI.js";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js";
|
|
3
3
|
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-BMGM1RtF.js";
|
|
4
4
|
import { c as normalizeWhatsAppTarget, n as isWhatsAppNewsletterJid } from "./normalize-target-bVWjgftN.js";
|
|
5
5
|
import "./normalize-Bxwqo-bW.js";
|
|
6
6
|
import { t as getOptionalWhatsAppRuntime } from "./runtime-BfAdAEYT.js";
|
|
7
|
-
import {
|
|
8
|
-
import { a as
|
|
9
|
-
import
|
|
7
|
+
import { r as getRegisteredWhatsAppConnectionController, t as formatError } from "./session-errors-CbsoQqoy.js";
|
|
8
|
+
import { a as sanitizeAssistantVisibleTextWithProfile, d as markdownToWhatsApp, i as sanitizeAssistantVisibleText, o as sleep, p as toWhatsappJid, s as stripToolCallXmlTags } from "./text-runtime-Dk37KYHj.js";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
|
+
import { sanitizeForPlainText } from "openclaw/plugin-sdk/channel-outbound";
|
|
12
|
+
import { writeExternalFileWithinRoot } from "openclaw/plugin-sdk/security-runtime";
|
|
13
|
+
import { resolveReactionLevel } from "openclaw/plugin-sdk/status-helpers";
|
|
10
14
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
11
15
|
import { generateSecureUuid } from "openclaw/plugin-sdk/core";
|
|
12
16
|
import { redactIdentifier } from "openclaw/plugin-sdk/logging-core";
|
|
@@ -16,7 +20,23 @@ import { normalizePollInput } from "openclaw/plugin-sdk/poll-runtime";
|
|
|
16
20
|
import { createSubsystemLogger, getChildLogger as getChildLogger$1 } from "openclaw/plugin-sdk/runtime-env";
|
|
17
21
|
import { createApprovalReactionTargetStore, listApprovalReactionBindings, resolveApprovalReactionTarget } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
18
22
|
import { createResolvedApproverActionAuthAdapter, resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
23
|
+
import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
|
|
24
|
+
import { MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS, runFfmpeg } from "openclaw/plugin-sdk/media-runtime";
|
|
25
|
+
import { resolvePreferredOpenClawTmpDir, withTempWorkspace } from "openclaw/plugin-sdk/temp-path";
|
|
19
26
|
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
27
|
+
//#region extensions/whatsapp/src/reaction-level.ts
|
|
28
|
+
/** Resolve the effective reaction level and its implications for WhatsApp. */
|
|
29
|
+
function resolveWhatsAppReactionLevel(params) {
|
|
30
|
+
return resolveReactionLevel({
|
|
31
|
+
value: resolveMergedWhatsAppAccountConfig({
|
|
32
|
+
cfg: params.cfg,
|
|
33
|
+
accountId: params.accountId
|
|
34
|
+
}).reactionLevel,
|
|
35
|
+
defaultLevel: "minimal",
|
|
36
|
+
invalidFallback: "minimal"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
20
40
|
//#region extensions/whatsapp/src/approval-auth.ts
|
|
21
41
|
function normalizeWhatsAppApproverId(value) {
|
|
22
42
|
const normalized = normalizeWhatsAppTarget(String(value));
|
|
@@ -254,6 +274,180 @@ async function maybeResolveWhatsAppApprovalReaction(params) {
|
|
|
254
274
|
}
|
|
255
275
|
}
|
|
256
276
|
//#endregion
|
|
277
|
+
//#region extensions/whatsapp/src/document-filename.ts
|
|
278
|
+
const WHATSAPP_DEFAULT_DOCUMENT_FILE_NAME = "file";
|
|
279
|
+
function resolveWhatsAppDefaultDocumentFileName(mimetype) {
|
|
280
|
+
const extension = extensionForMime(mimetype);
|
|
281
|
+
return extension ? `${WHATSAPP_DEFAULT_DOCUMENT_FILE_NAME}${extension}` : WHATSAPP_DEFAULT_DOCUMENT_FILE_NAME;
|
|
282
|
+
}
|
|
283
|
+
function resolveWhatsAppDocumentFileName(params) {
|
|
284
|
+
const fallbackName = resolveWhatsAppDefaultDocumentFileName(params.mimetype);
|
|
285
|
+
return params.fileName?.replace(/[\x00-\x1f\x7f]/g, "").trim() || fallbackName;
|
|
286
|
+
}
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region extensions/whatsapp/src/outbound-media-contract.ts
|
|
289
|
+
const WHATSAPP_VOICE_FILE_NAME = "voice.ogg";
|
|
290
|
+
const WHATSAPP_VOICE_SAMPLE_RATE_HZ = 48e3;
|
|
291
|
+
const WHATSAPP_VOICE_BITRATE = "64k";
|
|
292
|
+
const WHATSAPP_VOICE_MIMETYPE = "audio/ogg; codecs=opus";
|
|
293
|
+
function stripWhatsAppPluralToolXml(text) {
|
|
294
|
+
return stripToolCallXmlTags(text, { stripFunctionCallsXmlPayloads: true });
|
|
295
|
+
}
|
|
296
|
+
function finalizeWhatsAppVisibleText(text) {
|
|
297
|
+
return sanitizeForPlainText(stripWhatsAppPluralToolXml(text));
|
|
298
|
+
}
|
|
299
|
+
function normalizeWhatsAppPayloadText(text) {
|
|
300
|
+
return finalizeWhatsAppVisibleText(sanitizeAssistantVisibleText(text ?? "")).trimStart();
|
|
301
|
+
}
|
|
302
|
+
function stripLeadingBlankLines(text) {
|
|
303
|
+
return text.replace(/^(?:[ \t]*\r?\n)+/, "");
|
|
304
|
+
}
|
|
305
|
+
function normalizeWhatsAppPayloadTextPreservingIndentation(text) {
|
|
306
|
+
const normalized = stripLeadingBlankLines(finalizeWhatsAppVisibleText(sanitizeAssistantVisibleTextWithProfile(stripLeadingBlankLines(text ?? ""), "history")));
|
|
307
|
+
return normalized.trim() ? normalized : "";
|
|
308
|
+
}
|
|
309
|
+
function resolveWhatsAppOutboundMediaUrls(payload) {
|
|
310
|
+
return uniqueStrings([payload.mediaUrl?.trim(), ...(payload.mediaUrls ? [...payload.mediaUrls] : []).map((entry) => entry.trim()).filter((entry) => Boolean(entry))].filter((entry) => Boolean(entry)));
|
|
311
|
+
}
|
|
312
|
+
function normalizeWhatsAppOutboundPayload(payload, options) {
|
|
313
|
+
const mediaUrls = resolveWhatsAppOutboundMediaUrls(payload);
|
|
314
|
+
const normalizeText = options?.normalizeText ?? normalizeWhatsAppPayloadText;
|
|
315
|
+
return {
|
|
316
|
+
...payload,
|
|
317
|
+
text: normalizeText(payload.text),
|
|
318
|
+
mediaUrl: mediaUrls[0],
|
|
319
|
+
mediaUrls: mediaUrls.length > 0 ? mediaUrls : void 0
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function inferWhatsAppMediaKind(media) {
|
|
323
|
+
if (media.kind === "image" || media.kind === "audio" || media.kind === "video" || media.kind === "document") return media.kind;
|
|
324
|
+
const contentType = normalizeContentType(media.contentType);
|
|
325
|
+
if (contentType.startsWith("image/")) return "image";
|
|
326
|
+
if (contentType.startsWith("audio/")) return "audio";
|
|
327
|
+
if (contentType.startsWith("video/")) return "video";
|
|
328
|
+
return "document";
|
|
329
|
+
}
|
|
330
|
+
function normalizeWhatsAppLoadedMedia(media, mediaUrl) {
|
|
331
|
+
const kind = inferWhatsAppMediaKind(media);
|
|
332
|
+
const mimetype = kind === "audio" && isWhatsAppNativeVoiceAudio({
|
|
333
|
+
contentType: media.contentType,
|
|
334
|
+
mediaUrl
|
|
335
|
+
}) ? WHATSAPP_VOICE_MIMETYPE : media.contentType ?? "application/octet-stream";
|
|
336
|
+
const fileName = kind === "document" ? resolveWhatsAppDocumentFileName({
|
|
337
|
+
fileName: media.fileName ?? deriveWhatsAppDocumentFileName(mediaUrl),
|
|
338
|
+
mimetype
|
|
339
|
+
}) : media.fileName;
|
|
340
|
+
return {
|
|
341
|
+
buffer: media.buffer,
|
|
342
|
+
kind,
|
|
343
|
+
mimetype,
|
|
344
|
+
...fileName ? { fileName } : {}
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
async function prepareWhatsAppOutboundMedia(media, mediaUrl) {
|
|
348
|
+
const normalized = normalizeWhatsAppLoadedMedia(media, mediaUrl);
|
|
349
|
+
if (normalized.kind !== "audio") return normalized;
|
|
350
|
+
if (isWhatsAppNativeVoiceAudio({
|
|
351
|
+
contentType: media.contentType,
|
|
352
|
+
fileName: media.fileName,
|
|
353
|
+
mediaUrl
|
|
354
|
+
})) return normalized;
|
|
355
|
+
return {
|
|
356
|
+
buffer: await transcodeToWhatsAppVoiceOpus({
|
|
357
|
+
buffer: media.buffer,
|
|
358
|
+
fileName: media.fileName ?? deriveWhatsAppDocumentFileName(mediaUrl) ?? "audio"
|
|
359
|
+
}),
|
|
360
|
+
kind: "audio",
|
|
361
|
+
mimetype: WHATSAPP_VOICE_MIMETYPE
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function normalizeContentType(value) {
|
|
365
|
+
return value?.split(";", 1)[0]?.trim().toLowerCase() ?? "";
|
|
366
|
+
}
|
|
367
|
+
function isWhatsAppNativeVoiceAudio(params) {
|
|
368
|
+
const contentType = normalizeContentType(params.contentType);
|
|
369
|
+
if (contentType === "audio/ogg" || contentType === "audio/opus") return true;
|
|
370
|
+
const fileName = params.fileName ?? deriveWhatsAppDocumentFileName(params.mediaUrl) ?? "";
|
|
371
|
+
const ext = path.extname(fileName).toLowerCase();
|
|
372
|
+
return ext === ".ogg" || ext === ".opus";
|
|
373
|
+
}
|
|
374
|
+
async function transcodeToWhatsAppVoiceOpus(params) {
|
|
375
|
+
return await withTempWorkspace({
|
|
376
|
+
rootDir: resolvePreferredOpenClawTmpDir(),
|
|
377
|
+
prefix: "whatsapp-voice-"
|
|
378
|
+
}, async (workspace) => {
|
|
379
|
+
const ext = path.extname(params.fileName).toLowerCase();
|
|
380
|
+
const inputExt = ext && ext.length <= 12 ? ext : ".audio";
|
|
381
|
+
const inputPath = await workspace.write(`input${inputExt}`, params.buffer);
|
|
382
|
+
await writeExternalFileWithinRoot({
|
|
383
|
+
rootDir: workspace.dir,
|
|
384
|
+
path: WHATSAPP_VOICE_FILE_NAME,
|
|
385
|
+
write: async (outputPath) => {
|
|
386
|
+
await runFfmpeg([
|
|
387
|
+
"-hide_banner",
|
|
388
|
+
"-loglevel",
|
|
389
|
+
"error",
|
|
390
|
+
"-y",
|
|
391
|
+
"-i",
|
|
392
|
+
inputPath,
|
|
393
|
+
"-vn",
|
|
394
|
+
"-sn",
|
|
395
|
+
"-dn",
|
|
396
|
+
"-t",
|
|
397
|
+
String(MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS),
|
|
398
|
+
"-ar",
|
|
399
|
+
String(WHATSAPP_VOICE_SAMPLE_RATE_HZ),
|
|
400
|
+
"-ac",
|
|
401
|
+
"1",
|
|
402
|
+
"-c:a",
|
|
403
|
+
"libopus",
|
|
404
|
+
"-b:a",
|
|
405
|
+
WHATSAPP_VOICE_BITRATE,
|
|
406
|
+
"-f",
|
|
407
|
+
"ogg",
|
|
408
|
+
outputPath
|
|
409
|
+
]);
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
return await workspace.read(WHATSAPP_VOICE_FILE_NAME);
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
function deriveWhatsAppDocumentFileName(mediaUrl) {
|
|
416
|
+
if (!mediaUrl) return;
|
|
417
|
+
try {
|
|
418
|
+
const parsed = new URL(mediaUrl);
|
|
419
|
+
const fileName = path.posix.basename(parsed.pathname);
|
|
420
|
+
return fileName ? decodeURIComponent(fileName) : void 0;
|
|
421
|
+
} catch {
|
|
422
|
+
return (mediaUrl.split(/[?#]/, 1)[0] ?? "").split(/[\\/]/).pop() || void 0;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function isRetryableWhatsAppOutboundError(error) {
|
|
426
|
+
return /closed|reset|timed\s*out|disconnect/i.test(formatError(error));
|
|
427
|
+
}
|
|
428
|
+
async function sendWhatsAppOutboundWithRetry(params) {
|
|
429
|
+
const maxAttempts = params.maxAttempts ?? 3;
|
|
430
|
+
let lastError;
|
|
431
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) try {
|
|
432
|
+
return await params.send();
|
|
433
|
+
} catch (error) {
|
|
434
|
+
lastError = error;
|
|
435
|
+
const errorText = formatError(error);
|
|
436
|
+
const isLastAttempt = attempt === maxAttempts;
|
|
437
|
+
if (!isRetryableWhatsAppOutboundError(error) || isLastAttempt) throw error;
|
|
438
|
+
const backoffMs = 500 * attempt;
|
|
439
|
+
await params.onRetry?.({
|
|
440
|
+
attempt,
|
|
441
|
+
maxAttempts,
|
|
442
|
+
backoffMs,
|
|
443
|
+
error,
|
|
444
|
+
errorText
|
|
445
|
+
});
|
|
446
|
+
await sleep(backoffMs);
|
|
447
|
+
}
|
|
448
|
+
throw lastError;
|
|
449
|
+
}
|
|
450
|
+
//#endregion
|
|
257
451
|
//#region extensions/whatsapp/src/outbound-media.runtime.ts
|
|
258
452
|
async function loadOutboundMediaFromUrl(mediaUrl, options = {}) {
|
|
259
453
|
const readFile = options.mediaAccess?.readFile ?? options.mediaReadFile;
|
|
@@ -274,12 +468,6 @@ async function loadOutboundMediaFromUrl(mediaUrl, options = {}) {
|
|
|
274
468
|
}
|
|
275
469
|
//#endregion
|
|
276
470
|
//#region extensions/whatsapp/src/send.ts
|
|
277
|
-
var send_exports = /* @__PURE__ */ __exportAll({
|
|
278
|
-
sendMessageWhatsApp: () => sendMessageWhatsApp,
|
|
279
|
-
sendPollWhatsApp: () => sendPollWhatsApp,
|
|
280
|
-
sendReactionWhatsApp: () => sendReactionWhatsApp,
|
|
281
|
-
sendTypingWhatsApp: () => sendTypingWhatsApp
|
|
282
|
-
});
|
|
283
471
|
const outboundLog = createSubsystemLogger("gateway/channels/whatsapp").child("outbound");
|
|
284
472
|
function supportsForcedDocumentDelivery(kind) {
|
|
285
473
|
return kind === "image" || kind === "video";
|
|
@@ -520,4 +708,4 @@ async function sendPollWhatsApp(to, poll, options) {
|
|
|
520
708
|
}
|
|
521
709
|
}
|
|
522
710
|
//#endregion
|
|
523
|
-
export {
|
|
711
|
+
export { normalizeWhatsAppOutboundPayload as a, prepareWhatsAppOutboundMedia as c, maybeResolveWhatsAppApprovalReaction as d, registerWhatsAppApprovalReactionTarget as f, resolveWhatsAppReactionLevel as g, whatsappApprovalAuth as h, sendTypingWhatsApp as i, sendWhatsAppOutboundWithRetry as l, getWhatsAppApprovalApprovers as m, sendPollWhatsApp as n, normalizeWhatsAppPayloadText as o, unregisterWhatsAppApprovalReactionTarget as p, sendReactionWhatsApp as r, normalizeWhatsAppPayloadTextPreservingIndentation as s, sendMessageWhatsApp as t, resolveWhatsAppDocumentFileName as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as isWhatsAppNewsletterJid } from "./normalize-target-bVWjgftN.js";
|
|
2
|
+
import { u as resolveWhatsAppDocumentFileName } from "./send-C4LG-Cl6.js";
|
|
2
3
|
import "./normalize-Bxwqo-bW.js";
|
|
3
|
-
import { s as resolveWhatsAppDocumentFileName } from "./outbound-media-contract-B3Y-9slb.js";
|
|
4
4
|
import { m as toWhatsappJidWithLid, p as toWhatsappJid, u as jidToE164 } from "./text-runtime-Dk37KYHj.js";
|
|
5
5
|
import { t as buildQuotedMessageOptions } from "./quoted-message-CveINB35.js";
|
|
6
6
|
import { c as resolveComparableIdentity } from "./identity-xoLLdqEv.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as resolveWebCredsBackupPath, s as resolveWebCredsPath, t as assertWebCredsPathRegularFileOrMissing } from "./creds-files-B1kSWtBg.js";
|
|
2
|
-
import { n as getStatusCode } from "./session-errors-
|
|
2
|
+
import { n as getStatusCode } from "./session-errors-CbsoQqoy.js";
|
|
3
3
|
import { E as writeWebCredsRawAtomically, S as enqueueCredsSave, T as writeCredsJsonAtomically, b as restoreCredsFromBackupIfNeeded, u as readCredsJsonRaw, w as waitForCredsSaveQueueWithTimeout, y as resolveDefaultWebAuthDir } from "./auth-store-BrKb0mwT.js";
|
|
4
4
|
import { a as makeWASocket, i as makeCacheableSignalKeyStore, n as DisconnectReason, r as fetchLatestBaileysVersion, s as useMultiFileAuthState } from "./session.runtime-LZFdq3yb.js";
|
|
5
5
|
import { VERSION, formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
@@ -7,8 +7,7 @@ import { danger, getChildLogger, success, toPinoLikeLogger } from "openclaw/plug
|
|
|
7
7
|
import { renderQrTerminal } from "openclaw/plugin-sdk/media-runtime";
|
|
8
8
|
import { ensureDir, resolveUserPath } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
|
-
import {
|
|
11
|
-
import { createHttp1EnvHttpProxyAgent, createHttp1ProxyAgent, resolveActiveManagedProxyTlsOptions, resolveEnvHttpProxyUrl, shouldUseEnvHttpProxyForUrl } from "openclaw/plugin-sdk/fetch-runtime";
|
|
10
|
+
import { createHttp1EnvHttpProxyAgent, createHttp1ProxyAgent, createNodeProxyAgent } from "openclaw/plugin-sdk/fetch-runtime";
|
|
12
11
|
//#region extensions/whatsapp/src/socket-timing.ts
|
|
13
12
|
const DEFAULT_WHATSAPP_SOCKET_TIMING = {
|
|
14
13
|
keepAliveIntervalMs: 25e3,
|
|
@@ -60,7 +59,7 @@ async function safeSaveCreds(authDir, saveCreds, logger) {
|
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
async function printTerminalQr(qr) {
|
|
63
|
-
const output = await renderQrTerminal(qr);
|
|
62
|
+
const output = await renderQrTerminal(qr, { small: true });
|
|
64
63
|
process.stdout.write(output.endsWith("\n") ? output : `${output}\n`);
|
|
65
64
|
}
|
|
66
65
|
/**
|
|
@@ -137,13 +136,13 @@ async function createWaSocket(printQr, verbose, opts = {}) {
|
|
|
137
136
|
return sock;
|
|
138
137
|
}
|
|
139
138
|
async function resolveEnvProxyAgent(logger) {
|
|
140
|
-
if (!shouldUseEnvHttpProxyForUrl(WHATSAPP_WEBSOCKET_PROXY_TARGET)) return;
|
|
141
|
-
const proxyUrl = resolveEnvHttpProxyUrl("https");
|
|
142
|
-
if (!proxyUrl) return;
|
|
143
|
-
const proxyTls = resolveActiveManagedProxyTlsOptions({ proxyUrl });
|
|
144
|
-
const proxyAgentOptions = proxyTls?.ca ? { ca: proxyTls.ca } : void 0;
|
|
145
139
|
try {
|
|
146
|
-
const agent =
|
|
140
|
+
const agent = createNodeProxyAgent({
|
|
141
|
+
mode: "env",
|
|
142
|
+
targetUrl: WHATSAPP_WEBSOCKET_PROXY_TARGET,
|
|
143
|
+
protocol: "https"
|
|
144
|
+
});
|
|
145
|
+
if (!agent) return;
|
|
147
146
|
logger.info("Using ambient env proxy for WhatsApp WebSocket connection");
|
|
148
147
|
return agent;
|
|
149
148
|
} catch (error) {
|
|
@@ -163,6 +162,10 @@ async function resolveEnvFetchDispatcher(logger, agent) {
|
|
|
163
162
|
}
|
|
164
163
|
}
|
|
165
164
|
function resolveProxyUrlFromAgent(agent) {
|
|
165
|
+
if (typeof agent === "object" && agent !== null && "getProxyForUrl" in agent && typeof agent.getProxyForUrl === "function") {
|
|
166
|
+
const proxyUrl = agent.getProxyForUrl(WHATSAPP_WEBSOCKET_PROXY_TARGET);
|
|
167
|
+
return typeof proxyUrl === "string" && proxyUrl.length > 0 ? proxyUrl : void 0;
|
|
168
|
+
}
|
|
166
169
|
if (typeof agent !== "object" || agent === null || !("proxy" in agent)) return;
|
|
167
170
|
const proxy = agent.proxy;
|
|
168
171
|
if (proxy instanceof URL) return proxy.toString();
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
//#region extensions/whatsapp/src/connection-controller-registry.ts
|
|
2
|
+
const CONNECTION_REGISTRY_KEY = Symbol.for("openclaw.whatsapp.connectionControllerRegistry");
|
|
3
|
+
function getConnectionRegistryState() {
|
|
4
|
+
const globalState = globalThis;
|
|
5
|
+
const existing = globalState[CONNECTION_REGISTRY_KEY];
|
|
6
|
+
if (existing) return existing;
|
|
7
|
+
const created = { controllers: /* @__PURE__ */ new Map() };
|
|
8
|
+
globalState[CONNECTION_REGISTRY_KEY] = created;
|
|
9
|
+
return created;
|
|
10
|
+
}
|
|
11
|
+
function getRegisteredWhatsAppConnectionController(accountId) {
|
|
12
|
+
return getConnectionRegistryState().controllers.get(accountId) ?? null;
|
|
13
|
+
}
|
|
14
|
+
function registerWhatsAppConnectionController(accountId, controller) {
|
|
15
|
+
getConnectionRegistryState().controllers.set(accountId, controller);
|
|
16
|
+
}
|
|
17
|
+
function unregisterWhatsAppConnectionController(accountId, controller) {
|
|
18
|
+
const controllers = getConnectionRegistryState().controllers;
|
|
19
|
+
if (controllers.get(accountId) === controller) controllers.delete(accountId);
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
1
22
|
//#region extensions/whatsapp/src/session-errors.ts
|
|
2
23
|
function safeStringify(value, limit = 800) {
|
|
3
24
|
try {
|
|
@@ -60,4 +81,4 @@ function formatError(err) {
|
|
|
60
81
|
return safeStringify(err);
|
|
61
82
|
}
|
|
62
83
|
//#endregion
|
|
63
|
-
export { getStatusCode as n, formatError as t };
|
|
84
|
+
export { unregisterWhatsAppConnectionController as a, registerWhatsAppConnectionController as i, getStatusCode as n, getRegisteredWhatsAppConnectionController as r, formatError as t };
|
|
@@ -99,10 +99,10 @@ async function applyWhatsAppSecurityConfigFixes(params) {
|
|
|
99
99
|
//#region extensions/whatsapp/src/shared.ts
|
|
100
100
|
const WHATSAPP_CHANNEL = "whatsapp";
|
|
101
101
|
async function loadWhatsAppChannelRuntime() {
|
|
102
|
-
return await import("./channel.runtime-
|
|
102
|
+
return await import("./channel.runtime-S9MB6sub.js");
|
|
103
103
|
}
|
|
104
104
|
async function loadWhatsAppSetupSurface() {
|
|
105
|
-
return await import("./setup-surface-
|
|
105
|
+
return await import("./setup-surface-BOhQVZqy.js");
|
|
106
106
|
}
|
|
107
107
|
const whatsappSetupWizardProxy = createWhatsAppSetupWizardProxy(async () => (await loadWhatsAppSetupSurface()).whatsappSetupWizard);
|
|
108
108
|
const whatsappConfigAdapter = createScopedChannelConfigAdapter({
|
|
@@ -2,7 +2,7 @@ import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js"
|
|
|
2
2
|
import { r as hasWebCredsSync } from "./creds-files-B1kSWtBg.js";
|
|
3
3
|
import { a as resolveWhatsAppAccount, o as resolveWhatsAppAuthDir } from "./accounts-BMGM1RtF.js";
|
|
4
4
|
import { a as normalizeWhatsAppAllowFromEntries, o as normalizeWhatsAppAllowFromEntry } from "./normalize-target-bVWjgftN.js";
|
|
5
|
-
import { t as whatsappSetupAdapter } from "./setup-core-
|
|
5
|
+
import { t as whatsappSetupAdapter } from "./setup-core-C2os03mR.js";
|
|
6
6
|
import { DEFAULT_ACCOUNT_ID, createSetupTranslator, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
7
7
|
import { formatCliCommand, formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
|
|
8
8
|
//#region extensions/whatsapp/src/setup-finalize.ts
|
|
@@ -280,7 +280,7 @@ async function finalizeWhatsAppSetup(params) {
|
|
|
280
280
|
message: linked ? t("wizard.whatsapp.relinkPrompt") : t("wizard.whatsapp.linkNowPrompt"),
|
|
281
281
|
initialValue: !linked
|
|
282
282
|
})) try {
|
|
283
|
-
const { loginWeb } = await import("./login-
|
|
283
|
+
const { loginWeb } = await import("./login-1yyBrXTL.js").then((n) => n.n);
|
|
284
284
|
await loginWeb(false, void 0, params.runtime, accountId);
|
|
285
285
|
} catch (error) {
|
|
286
286
|
params.runtime.error(`WhatsApp login failed: ${String(error)}`);
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as whatsappSetupPlugin } from "./channel.setup-
|
|
1
|
+
import { t as whatsappSetupPlugin } from "./channel.setup-BNqtW-u1.js";
|
|
2
2
|
export { whatsappSetupPlugin };
|
|
@@ -36,7 +36,7 @@ const whatsappSetupWizard = {
|
|
|
36
36
|
},
|
|
37
37
|
resolveShouldPromptAccountIds: ({ shouldPromptAccountIds }) => shouldPromptAccountIds,
|
|
38
38
|
credentials: [],
|
|
39
|
-
finalize: async (params) => await (await import("./setup-finalize-
|
|
39
|
+
finalize: async (params) => await (await import("./setup-finalize-IDTrWXtX.js")).finalizeWhatsAppSetup(params),
|
|
40
40
|
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false),
|
|
41
41
|
onAccountRecorded: (accountId, options) => {
|
|
42
42
|
options?.onAccountId?.(channel, accountId);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/whatsapp",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.28-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/whatsapp",
|
|
9
|
-
"version": "2026.5.
|
|
9
|
+
"version": "2026.5.28-beta.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"audio-decode": "2.2.3",
|
|
12
12
|
"baileys": "7.0.0-rc13",
|
|
13
|
-
"https-proxy-agent": "9.0.0",
|
|
14
13
|
"typebox": "1.1.38"
|
|
15
14
|
},
|
|
16
15
|
"peerDependencies": {
|
|
17
|
-
"openclaw": ">=2026.5.
|
|
16
|
+
"openclaw": ">=2026.5.28-beta.1"
|
|
18
17
|
},
|
|
19
18
|
"peerDependenciesMeta": {
|
|
20
19
|
"openclaw": {
|
|
@@ -240,15 +239,6 @@
|
|
|
240
239
|
"url": "https://github.com/sponsors/eshaz"
|
|
241
240
|
}
|
|
242
241
|
},
|
|
243
|
-
"node_modules/agent-base": {
|
|
244
|
-
"version": "9.0.0",
|
|
245
|
-
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-9.0.0.tgz",
|
|
246
|
-
"integrity": "sha512-TQf59BsZnytt8GdJKLPfUZ54g/iaUL2OWDSFCCvMOhsHduDQxO8xC4PNeyIkVcA5KwL2phPSv0douC0fgWzmnA==",
|
|
247
|
-
"license": "MIT",
|
|
248
|
-
"engines": {
|
|
249
|
-
"node": ">= 20"
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
242
|
"node_modules/async-mutex": {
|
|
253
243
|
"version": "0.5.0",
|
|
254
244
|
"resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.5.0.tgz",
|
|
@@ -434,19 +424,6 @@
|
|
|
434
424
|
"integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==",
|
|
435
425
|
"license": "MIT"
|
|
436
426
|
},
|
|
437
|
-
"node_modules/https-proxy-agent": {
|
|
438
|
-
"version": "9.0.0",
|
|
439
|
-
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-9.0.0.tgz",
|
|
440
|
-
"integrity": "sha512-/MVmHp58WkOypgFhCLk4fzpPcFQvTJ/e6LBI7irpIO2HfxUbpmYoHF+KzipzJpxxzJu7aJNWQ0xojJ/dzV2G5g==",
|
|
441
|
-
"license": "MIT",
|
|
442
|
-
"dependencies": {
|
|
443
|
-
"agent-base": "9.0.0",
|
|
444
|
-
"debug": "^4.3.4"
|
|
445
|
-
},
|
|
446
|
-
"engines": {
|
|
447
|
-
"node": ">= 20"
|
|
448
|
-
}
|
|
449
|
-
},
|
|
450
427
|
"node_modules/ieee754": {
|
|
451
428
|
"version": "1.2.1",
|
|
452
429
|
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
package/openclaw.plugin.json
CHANGED
|
@@ -346,6 +346,15 @@
|
|
|
346
346
|
},
|
|
347
347
|
"additionalProperties": false
|
|
348
348
|
},
|
|
349
|
+
"pluginHooks": {
|
|
350
|
+
"type": "object",
|
|
351
|
+
"properties": {
|
|
352
|
+
"messageReceived": {
|
|
353
|
+
"type": "boolean"
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"additionalProperties": false
|
|
357
|
+
},
|
|
349
358
|
"accounts": {
|
|
350
359
|
"type": "object",
|
|
351
360
|
"propertyNames": {
|
|
@@ -667,6 +676,15 @@
|
|
|
667
676
|
},
|
|
668
677
|
"additionalProperties": false
|
|
669
678
|
},
|
|
679
|
+
"pluginHooks": {
|
|
680
|
+
"type": "object",
|
|
681
|
+
"properties": {
|
|
682
|
+
"messageReceived": {
|
|
683
|
+
"type": "boolean"
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
"additionalProperties": false
|
|
687
|
+
},
|
|
670
688
|
"name": {
|
|
671
689
|
"type": "string"
|
|
672
690
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/whatsapp",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.28-beta.1",
|
|
4
4
|
"description": "OpenClaw WhatsApp channel plugin for WhatsApp Web chats.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"audio-decode": "2.2.3",
|
|
12
12
|
"baileys": "7.0.0-rc13",
|
|
13
|
-
"https-proxy-agent": "9.0.0",
|
|
14
13
|
"typebox": "1.1.38"
|
|
15
14
|
},
|
|
16
15
|
"peerDependencies": {
|
|
17
|
-
"openclaw": ">=2026.5.
|
|
16
|
+
"openclaw": ">=2026.5.28-beta.1"
|
|
18
17
|
},
|
|
19
18
|
"peerDependenciesMeta": {
|
|
20
19
|
"openclaw": {
|
|
@@ -57,10 +56,10 @@
|
|
|
57
56
|
"minHostVersion": ">=2026.4.25"
|
|
58
57
|
},
|
|
59
58
|
"compat": {
|
|
60
|
-
"pluginApi": ">=2026.5.
|
|
59
|
+
"pluginApi": ">=2026.5.28-beta.1"
|
|
61
60
|
},
|
|
62
61
|
"build": {
|
|
63
|
-
"openclawVersion": "2026.5.
|
|
62
|
+
"openclawVersion": "2026.5.28-beta.1"
|
|
64
63
|
},
|
|
65
64
|
"release": {
|
|
66
65
|
"publishToClawHub": true,
|
|
@@ -79,7 +78,6 @@
|
|
|
79
78
|
"bundledDependencies": [
|
|
80
79
|
"audio-decode",
|
|
81
80
|
"baileys",
|
|
82
|
-
"https-proxy-agent",
|
|
83
81
|
"typebox"
|
|
84
82
|
]
|
|
85
83
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//#region extensions/whatsapp/src/connection-controller-registry.ts
|
|
2
|
-
const CONNECTION_REGISTRY_KEY = Symbol.for("openclaw.whatsapp.connectionControllerRegistry");
|
|
3
|
-
function getConnectionRegistryState() {
|
|
4
|
-
const globalState = globalThis;
|
|
5
|
-
const existing = globalState[CONNECTION_REGISTRY_KEY];
|
|
6
|
-
if (existing) return existing;
|
|
7
|
-
const created = { controllers: /* @__PURE__ */ new Map() };
|
|
8
|
-
globalState[CONNECTION_REGISTRY_KEY] = created;
|
|
9
|
-
return created;
|
|
10
|
-
}
|
|
11
|
-
function getRegisteredWhatsAppConnectionController(accountId) {
|
|
12
|
-
return getConnectionRegistryState().controllers.get(accountId) ?? null;
|
|
13
|
-
}
|
|
14
|
-
function registerWhatsAppConnectionController(accountId, controller) {
|
|
15
|
-
getConnectionRegistryState().controllers.set(accountId, controller);
|
|
16
|
-
}
|
|
17
|
-
function unregisterWhatsAppConnectionController(accountId, controller) {
|
|
18
|
-
const controllers = getConnectionRegistryState().controllers;
|
|
19
|
-
if (controllers.get(accountId) === controller) controllers.delete(accountId);
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
export { registerWhatsAppConnectionController as n, unregisterWhatsAppConnectionController as r, getRegisteredWhatsAppConnectionController as t };
|