@openclaw/whatsapp 2026.5.10-beta.2 → 2026.5.10-beta.3
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-CdP8S3rJ.js → access-control-BEpPB-Jx.js} +6 -6
- package/dist/{accounts-BDqgpFEB.js → accounts-B4oR6Dhx.js} +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/{action-runtime-CMhO8liB.js → action-runtime-lppOTCTN.js} +4 -4
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/api.js +18 -145
- package/dist/{auth-store-CjEimXKX.js → auth-store-_ScMvp7r.js} +10 -10
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-DJvzhIPw.js → channel-react-action-C1wufQtL.js} +3 -3
- package/dist/{channel-BxntAClG.js → channel-yfTKmDAy.js} +18 -18
- package/dist/{channel.runtime-CNdPCK3G.js → channel.runtime-U2LumvwN.js} +5 -5
- package/dist/{channel.setup-BqlcEVzR.js → channel.setup-k1Ro0czO.js} +4 -4
- package/dist/{connection-controller-DX2phM7V.js → connection-controller-Ik54eV0p.js} +7 -6
- package/dist/constants.js +1 -1
- package/dist/contract-api.js +8 -8
- package/dist/{directory-config-o-muXLgk.js → directory-config-CE74HYlw.js} +3 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{group-session-contract-DL-SLclv.js → group-session-contract-DdqigLJl.js} +1 -1
- package/dist/{identity-KxdJfH7p.js → identity-BNDkpR8N.js} +2 -2
- package/dist/legacy-session-surface-api.js +1 -1
- package/dist/legacy-state-migrations-api.js +1 -1
- package/dist/light-runtime-api.js +3 -3
- package/dist/{login-DV99D0IN.js → login-eiyCwLI5.js} +6 -6
- package/dist/{login-qr-cKndAXTv.js → login-qr-CSEa1_wH.js} +5 -5
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-mfy3Mmq-.js → monitor-DcfFBU0V.js} +46 -34
- package/dist/normalize-f31evwm8.js +2 -0
- package/dist/{normalize-target-nXxC_hxG.js → normalize-target-ePanEpfY.js} +1 -1
- package/dist/{outbound-adapter-B9ZW8sht.js → outbound-adapter-Bs0e4qVd.js} +4 -4
- package/dist/{outbound-base-MVpg2zU2.js → outbound-base-BgtywpNm.js} +3 -3
- package/dist/{outbound-media-contract-BzWwBppP.js → outbound-media-contract-zq9aNgT8.js} +5 -5
- package/dist/outbound-payload-test-api.js +1 -1
- package/dist/{quoted-message-DQ6hAr34.js → quoted-message-BQsRXnac.js} +1 -1
- package/dist/{reaction-level-CRVEVAfi.js → reaction-level-2m9sWGCw.js} +1 -1
- package/dist/{resolve-outbound-target-CQ3Y1i0g.js → resolve-outbound-target-BKcv4ofn.js} +1 -1
- package/dist/rolldown-runtime-CiIaOW0V.js +13 -0
- package/dist/runtime-api.js +11 -11
- package/dist/{security-contract-BzlZFreO.js → security-contract-CvfWex9e.js} +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-u88yh8Hw.js → send-DBfXQDd4.js} +10 -9
- package/dist/{send-api-DsbCqDre.js → send-api-DD93aPIQ.js} +7 -7
- package/dist/{session-DeIU_vjJ.js → session-CVCKPoQN.js} +6 -6
- package/dist/{session.runtime-B9VlYnWQ.js → session.runtime-CZQ0ycCg.js} +2 -2
- package/dist/{setup-finalize-D3YuMUBs.js → setup-finalize-WYnZjedw.js} +4 -4
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-CHjYlKJc.js → setup-surface-DJAu-uxi.js} +3 -3
- package/dist/{shared-CgYT3IzU.js → shared-CcuxfjaQ.js} +9 -9
- package/dist/targets.js +1 -1
- package/dist/test-api.js +2 -2
- package/dist/{text-runtime-DBKC9uEi.js → text-runtime-CMxQczvs.js} +4 -42
- package/package.json +5 -5
- package/dist/normalize-Y3eBdM8a.js +0 -2
- /package/dist/{active-listener-D2NHQ5Og.js → active-listener-DTbKS-j-.js} +0 -0
- /package/dist/{agent-tools-login-DYKYW5Nh.js → agent-tools-login-DpRxLNRB.js} +0 -0
- /package/dist/{audio-preflight.runtime-CIFjeaEN.js → audio-preflight.runtime-MmkB-pgX.js} +0 -0
- /package/dist/{command-policy-BgZRZ31o.js → command-policy-O8sRnqUV.js} +0 -0
- /package/dist/{config-schema-cSC7M4YA.js → config-schema-Dmo66Ubb.js} +0 -0
- /package/dist/{constants-yKXGCGU9.js → constants-DLGCIbfl.js} +0 -0
- /package/dist/{doctor-BrgepDUP.js → doctor-A9tXm9Om.js} +0 -0
- /package/dist/{reply-resolver.runtime-CROyXXQh.js → reply-resolver.runtime-rIVWohXr.js} +0 -0
- /package/dist/{runtime-DdodQB8G.js → runtime-6fZ67abR.js} +0 -0
- /package/dist/{runtime-group-policy-BH_U23qp.js → runtime-group-policy-Gp1lQ0at.js} +0 -0
- /package/dist/{session-contract-BNUscPf4.js → session-contract-B0efQf9P.js} +0 -0
- /package/dist/{setup-core-DnhO0PjG.js → setup-core-DZKvpzbH.js} +0 -0
- /package/dist/{state-migrations-CtdIArlK.js → state-migrations-Bm0S67yH.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as resolveWhatsAppAccount } from "./accounts-
|
|
2
|
-
import { d as readWebAuthExistsForDecision, h as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-
|
|
3
|
-
import { i as resolveWhatsAppSocketTiming, t as createWaSocket } from "./session-
|
|
4
|
-
import {
|
|
5
|
-
import { logInfo } from "openclaw/plugin-sdk/
|
|
1
|
+
import { a as resolveWhatsAppAccount } from "./accounts-B4oR6Dhx.js";
|
|
2
|
+
import { d as readWebAuthExistsForDecision, h as readWebSelfId, n as WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store-_ScMvp7r.js";
|
|
3
|
+
import { i as resolveWhatsAppSocketTiming, t as createWaSocket } from "./session-CVCKPoQN.js";
|
|
4
|
+
import { i as closeWaSocket, o as waitForWhatsAppLoginResult, t as WHATSAPP_LOGGED_OUT_QR_MESSAGE } from "./connection-controller-Ik54eV0p.js";
|
|
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";
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
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-CSEa1_wH.js");
|
|
5
5
|
return loginQrModulePromise;
|
|
6
6
|
}
|
|
7
7
|
async function startWebLoginWithQr(...args) {
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as resolveWhatsAppReactionLevel } from "./reaction-level-CRVEVAfi.js";
|
|
1
|
+
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-B4oR6Dhx.js";
|
|
2
|
+
import { t as isWhatsAppGroupJid } from "./normalize-target-ePanEpfY.js";
|
|
3
|
+
import { t as resolveWhatsAppReactionLevel } from "./reaction-level-2m9sWGCw.js";
|
|
5
4
|
import { n as getStatusCode, t as formatError } from "./session-errors-CSuKZPub.js";
|
|
6
|
-
import {
|
|
7
|
-
import { r as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { i as
|
|
12
|
-
import {
|
|
13
|
-
import { i as
|
|
14
|
-
import {
|
|
5
|
+
import { d as markdownToWhatsApp, f as resolveJidToE164, l as isSelfChatMode, n as normalizeE164, t as convertMarkdownTables$1, u as jidToE164 } from "./text-runtime-CMxQczvs.js";
|
|
6
|
+
import { i as prepareWhatsAppOutboundMedia, o as sendWhatsAppOutboundWithRetry, r as normalizeWhatsAppPayloadTextPreservingIndentation, t as normalizeWhatsAppOutboundPayload } from "./outbound-media-contract-zq9aNgT8.js";
|
|
7
|
+
import { r as sendReactionWhatsApp } from "./send-DBfXQDd4.js";
|
|
8
|
+
import { n as cacheInboundMessageMeta, r as lookupInboundMessageMeta, t as buildQuotedMessageOptions } from "./quoted-message-BQsRXnac.js";
|
|
9
|
+
import { _ as readWebSelfIdentityForDecision, a as getWebAuthAgeMs, h as readWebSelfId, r as WhatsAppAuthUnstableError, s as logoutWeb } from "./auth-store-_ScMvp7r.js";
|
|
10
|
+
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-BNDkpR8N.js";
|
|
11
|
+
import { i as resolveWhatsAppInboundPolicy, n as checkInboundAccessControl, r as resolveWhatsAppCommandAuthorized } from "./access-control-BEpPB-Jx.js";
|
|
12
|
+
import { a as mayContainWhatsAppOutboundMention, c as extractContactContext, d as extractMediaPlaceholder, f as extractMentionedJids, i as addWhatsAppOutboundMentionsToContent, l as extractContextInfo, m as hasInboundUserContent, n as listWhatsAppSendResultMessageIds, o as resolveWhatsAppOutboundMentions, p as extractText, r as normalizeWhatsAppSendResult, s as describeReplyContext, t as createWebSendApi, u as extractLocationData } from "./send-api-DD93aPIQ.js";
|
|
13
|
+
import { i as resolveWhatsAppSocketTiming, r as waitForWaConnection, t as createWaSocket } from "./session-CVCKPoQN.js";
|
|
14
|
+
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-Ik54eV0p.js";
|
|
15
15
|
import { resolveAccountEntry } from "openclaw/plugin-sdk/account-core";
|
|
16
|
-
import {
|
|
16
|
+
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
17
17
|
import { createAckReactionHandle, logAckFailure, removeAckReactionHandleAfterReply, shouldAckReactionForWhatsApp } from "openclaw/plugin-sdk/channel-feedback";
|
|
18
18
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
19
|
+
import { getChildLogger } from "openclaw/plugin-sdk/logging-core";
|
|
19
20
|
import { resolveMarkdownTableMode as resolveMarkdownTableMode$1 } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
20
|
-
import { createSubsystemLogger, defaultRuntime, formatDurationPrecise, getChildLogger as getChildLogger$1, logVerbose, logVerbose as logVerbose$1, registerUnhandledRejectionHandler, shouldLogVerbose, shouldLogVerbose as shouldLogVerbose$1 } from "openclaw/plugin-sdk/runtime-env";
|
|
21
|
+
import { createSubsystemLogger, defaultRuntime, formatDurationPrecise, getChildLogger as getChildLogger$1, logVerbose, logVerbose as logVerbose$1, registerUnhandledRejectionHandler, shouldLogVerbose, shouldLogVerbose as shouldLogVerbose$1, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
21
22
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
22
23
|
import { evaluateSupplementalContextVisibility, filterSupplementalContextItems, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
|
|
23
24
|
import { LocalMediaAccessError, getDefaultLocalRoots, loadWebMedia as loadWebMedia$1, loadWebMediaRaw, optimizeImageToJpeg, optimizeImageToPng } from "openclaw/plugin-sdk/web-media";
|
|
@@ -27,7 +28,7 @@ import { isReasoningReplyPayload, resolveSendableOutboundReplyParts, sendMediaWi
|
|
|
27
28
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, DEFAULT_MAIN_KEY, buildAgentMainSessionKey, buildAgentSessionKey, buildGroupHistoryKey, deriveLastRoutePolicy, normalizeAccountId as normalizeAccountId$1, normalizeAgentId, resolveAgentRoute, resolveInboundLastRouteSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
28
29
|
import { recordInboundSession } from "openclaw/plugin-sdk/conversation-runtime";
|
|
29
30
|
import { loadSessionStore, resolveStorePath, updateLastRoute, updateSessionStore } from "openclaw/plugin-sdk/session-store-runtime";
|
|
30
|
-
import { DisconnectReason as DisconnectReason$1, downloadMediaMessage, isJidGroup, normalizeMessageContent as normalizeMessageContent$1 } from "
|
|
31
|
+
import { DisconnectReason as DisconnectReason$1, downloadMediaMessage, isJidGroup, normalizeMessageContent as normalizeMessageContent$1 } from "baileys";
|
|
31
32
|
import { formatLocationText, resolveInboundSessionEnvelopeContext } from "openclaw/plugin-sdk/channel-inbound";
|
|
32
33
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
33
34
|
import { dispatchReplyWithBufferedBlockDispatcher, finalizeInboundContext, resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime";
|
|
@@ -817,7 +818,7 @@ function debugMention(msg, mentionCfg, authDir) {
|
|
|
817
818
|
}
|
|
818
819
|
function resolveOwnerList(mentionCfg, selfE164) {
|
|
819
820
|
const allowFrom = mentionCfg.allowFrom;
|
|
820
|
-
return (Array.isArray(allowFrom) && allowFrom.length > 0 ? allowFrom : selfE164 ? [selfE164] : []).filter((entry) => Boolean(entry && entry !== "*")).map((entry) =>
|
|
821
|
+
return (Array.isArray(allowFrom) && allowFrom.length > 0 ? allowFrom : selfE164 ? [selfE164] : []).filter((entry) => Boolean(entry && entry !== "*")).map((entry) => normalizeE164(entry)).filter((entry) => Boolean(entry));
|
|
821
822
|
}
|
|
822
823
|
//#endregion
|
|
823
824
|
//#region extensions/whatsapp/src/auto-reply/monitor-state.ts
|
|
@@ -831,6 +832,7 @@ function isTerminalHealthState(healthState) {
|
|
|
831
832
|
return healthState === "conflict" || healthState === "logged-out" || healthState === "stopped";
|
|
832
833
|
}
|
|
833
834
|
function createWebChannelStatusController(statusSink) {
|
|
835
|
+
let lastDisconnectWasWatchdogRecovery = false;
|
|
834
836
|
const status = {
|
|
835
837
|
running: true,
|
|
836
838
|
connected: false,
|
|
@@ -852,6 +854,11 @@ function createWebChannelStatusController(statusSink) {
|
|
|
852
854
|
noteConnected(at = Date.now()) {
|
|
853
855
|
Object.assign(status, createConnectedChannelStatusPatch(at));
|
|
854
856
|
Object.assign(status, createTransportActivityStatusPatch(at));
|
|
857
|
+
if (lastDisconnectWasWatchdogRecovery) {
|
|
858
|
+
status.lastDisconnect = null;
|
|
859
|
+
status.reconnectAttempts = 0;
|
|
860
|
+
lastDisconnectWasWatchdogRecovery = false;
|
|
861
|
+
}
|
|
855
862
|
status.lastError = null;
|
|
856
863
|
status.healthState = "healthy";
|
|
857
864
|
emit();
|
|
@@ -880,6 +887,7 @@ function createWebChannelStatusController(statusSink) {
|
|
|
880
887
|
},
|
|
881
888
|
noteClose(params) {
|
|
882
889
|
const at = params.at ?? Date.now();
|
|
890
|
+
lastDisconnectWasWatchdogRecovery = params.watchdogRecovery === true;
|
|
883
891
|
status.connected = false;
|
|
884
892
|
status.lastEventAt = at;
|
|
885
893
|
status.lastDisconnect = {
|
|
@@ -1137,7 +1145,7 @@ function stripMentionsForCommand(text, mentionRegexes, selfE164) {
|
|
|
1137
1145
|
//#region extensions/whatsapp/src/auto-reply/monitor/group-members.ts
|
|
1138
1146
|
function appendNormalizedUnique(entries, seen, ordered) {
|
|
1139
1147
|
for (const entry of entries) {
|
|
1140
|
-
const normalized =
|
|
1148
|
+
const normalized = normalizeE164(entry) ?? entry;
|
|
1141
1149
|
if (!normalized || seen.has(normalized)) continue;
|
|
1142
1150
|
seen.add(normalized);
|
|
1143
1151
|
ordered.push(normalized);
|
|
@@ -1145,7 +1153,7 @@ function appendNormalizedUnique(entries, seen, ordered) {
|
|
|
1145
1153
|
}
|
|
1146
1154
|
function noteGroupMember(groupMemberNames, conversationId, e164, name) {
|
|
1147
1155
|
if (!e164 || !name) return;
|
|
1148
|
-
const key =
|
|
1156
|
+
const key = normalizeE164(e164) ?? e164;
|
|
1149
1157
|
if (!key) return;
|
|
1150
1158
|
let roster = groupMemberNames.get(conversationId);
|
|
1151
1159
|
if (!roster) {
|
|
@@ -1161,7 +1169,7 @@ function formatGroupMembers(params) {
|
|
|
1161
1169
|
if (participants?.length) appendNormalizedUnique(participants, seen, ordered);
|
|
1162
1170
|
if (roster) appendNormalizedUnique(roster.keys(), seen, ordered);
|
|
1163
1171
|
if (ordered.length === 0 && fallbackE164) {
|
|
1164
|
-
const normalized =
|
|
1172
|
+
const normalized = normalizeE164(fallbackE164) ?? fallbackE164;
|
|
1165
1173
|
if (normalized) ordered.push(normalized);
|
|
1166
1174
|
}
|
|
1167
1175
|
if (ordered.length === 0) return;
|
|
@@ -1173,7 +1181,7 @@ function formatGroupMembers(params) {
|
|
|
1173
1181
|
//#endregion
|
|
1174
1182
|
//#region extensions/whatsapp/src/auto-reply/monitor/group-gating.ts
|
|
1175
1183
|
function isOwnerSender(baseMentionConfig, msg) {
|
|
1176
|
-
const sender =
|
|
1184
|
+
const sender = normalizeE164(getSenderIdentity(msg).e164 ?? "");
|
|
1177
1185
|
if (!sender) return false;
|
|
1178
1186
|
return resolveOwnerList(baseMentionConfig, getSelfIdentity(msg).e164 ?? void 0).includes(sender);
|
|
1179
1187
|
}
|
|
@@ -1313,9 +1321,9 @@ function updateLastRouteInBackground(params) {
|
|
|
1313
1321
|
function resolvePeerId(msg) {
|
|
1314
1322
|
if (msg.chatType === "group") return msg.conversationId ?? msg.from;
|
|
1315
1323
|
const sender = getSenderIdentity(msg);
|
|
1316
|
-
if (sender.e164) return
|
|
1324
|
+
if (sender.e164) return normalizeE164(sender.e164) ?? sender.e164;
|
|
1317
1325
|
if (msg.from.includes("@")) return jidToE164(msg.from) ?? msg.from;
|
|
1318
|
-
return
|
|
1326
|
+
return normalizeE164(msg.from) ?? msg.from;
|
|
1319
1327
|
}
|
|
1320
1328
|
//#endregion
|
|
1321
1329
|
//#region extensions/whatsapp/src/system-prompt.ts
|
|
@@ -1361,7 +1369,7 @@ function isLikelyWhatsAppCryptoError(reason) {
|
|
|
1361
1369
|
};
|
|
1362
1370
|
const haystack = normalizeLowercaseStringOrEmpty(reason instanceof Error ? `${reason.message}\n${reason.stack ?? ""}` : formatReason(reason));
|
|
1363
1371
|
if (!(haystack.includes("unsupported state or unable to authenticate data") || haystack.includes("bad mac"))) return false;
|
|
1364
|
-
return haystack.includes("
|
|
1372
|
+
return haystack.includes("baileys") || haystack.includes("noise-handler") || haystack.includes("aesdecryptgcm");
|
|
1365
1373
|
}
|
|
1366
1374
|
//#endregion
|
|
1367
1375
|
//#region extensions/whatsapp/src/auto-reply/deliver-reply.ts
|
|
@@ -1422,7 +1430,7 @@ async function deliverWebReply(params) {
|
|
|
1422
1430
|
const tableMode = params.tableMode ?? "code";
|
|
1423
1431
|
const chunkMode = params.chunkMode ?? "length";
|
|
1424
1432
|
const normalizedReply = params.normalizedReplyResult ?? normalizeWhatsAppOutboundPayload(replyResult, { normalizeText: normalizeWhatsAppPayloadTextPreservingIndentation });
|
|
1425
|
-
const textChunks = chunkMarkdownTextWithMode(markdownToWhatsApp(
|
|
1433
|
+
const textChunks = chunkMarkdownTextWithMode(markdownToWhatsApp(convertMarkdownTables$1(normalizedReply.text ?? "", tableMode)), textLimit, chunkMode);
|
|
1426
1434
|
const mediaList = normalizedReply.mediaUrls ?? [];
|
|
1427
1435
|
const getQuote = () => {
|
|
1428
1436
|
if (!replyResult.replyToId) return;
|
|
@@ -1553,7 +1561,7 @@ function isWhatsAppSupplementalSenderAllowed(params) {
|
|
|
1553
1561
|
for (const entry of params.allowFrom) {
|
|
1554
1562
|
const rawEntry = entry.trim();
|
|
1555
1563
|
if (!rawEntry) continue;
|
|
1556
|
-
const normalizedEntry =
|
|
1564
|
+
const normalizedEntry = normalizeE164(rawEntry);
|
|
1557
1565
|
if (normalizedEntry && senderValues.has(normalizedEntry) || senderValues.has(rawEntry)) return true;
|
|
1558
1566
|
}
|
|
1559
1567
|
return false;
|
|
@@ -1978,7 +1986,7 @@ function resolvePinnedMainDmRecipient(params) {
|
|
|
1978
1986
|
return resolvePinnedMainDmOwnerFromAllowlist({
|
|
1979
1987
|
dmScope: params.cfg.session?.dmScope,
|
|
1980
1988
|
allowFrom: params.allowFrom,
|
|
1981
|
-
normalizeEntry: (entry) =>
|
|
1989
|
+
normalizeEntry: (entry) => normalizeE164(entry)
|
|
1982
1990
|
});
|
|
1983
1991
|
}
|
|
1984
1992
|
async function processMessage(params) {
|
|
@@ -2003,7 +2011,7 @@ async function processMessage(params) {
|
|
|
2003
2011
|
let audioTranscript = params.preflightAudioTranscript ?? void 0;
|
|
2004
2012
|
const hasAudioBody = params.msg.mediaType?.startsWith("audio/") === true && params.msg.body === "<media:audio>";
|
|
2005
2013
|
if (params.preflightAudioTranscript === void 0 && hasAudioBody && params.msg.mediaPath) try {
|
|
2006
|
-
const { transcribeFirstAudio } = await import("./audio-preflight.runtime-
|
|
2014
|
+
const { transcribeFirstAudio } = await import("./audio-preflight.runtime-MmkB-pgX.js");
|
|
2007
2015
|
audioTranscript = await transcribeFirstAudio({
|
|
2008
2016
|
ctx: {
|
|
2009
2017
|
MediaPaths: [params.msg.mediaPath],
|
|
@@ -2109,7 +2117,7 @@ async function processMessage(params) {
|
|
|
2109
2117
|
const dmRouteTarget = resolveWhatsAppDmRouteTarget({
|
|
2110
2118
|
msg: params.msg,
|
|
2111
2119
|
senderE164: sender.e164 ?? void 0,
|
|
2112
|
-
normalizeE164
|
|
2120
|
+
normalizeE164
|
|
2113
2121
|
});
|
|
2114
2122
|
const commandAuthorized = shouldComputeCommandAuthorized(params.msg.body, params.cfg) ? await resolveWhatsAppCommandAuthorized({
|
|
2115
2123
|
cfg: params.cfg,
|
|
@@ -2324,7 +2332,7 @@ function createWebOnMessageHandler(params) {
|
|
|
2324
2332
|
});
|
|
2325
2333
|
ackAlreadySent = ackReaction !== null;
|
|
2326
2334
|
try {
|
|
2327
|
-
const { transcribeFirstAudio } = await import("./audio-preflight.runtime-
|
|
2335
|
+
const { transcribeFirstAudio } = await import("./audio-preflight.runtime-MmkB-pgX.js");
|
|
2328
2336
|
preflightAudioTranscript = await transcribeFirstAudio({
|
|
2329
2337
|
ctx: {
|
|
2330
2338
|
MediaPaths: [msg.mediaPath],
|
|
@@ -2411,7 +2419,7 @@ function createWebOnMessageHandler(params) {
|
|
|
2411
2419
|
}
|
|
2412
2420
|
if (!gating.shouldProcess) return;
|
|
2413
2421
|
} else if (!msg.sender?.e164 && !msg.senderE164 && peerId && peerId.startsWith("+")) {
|
|
2414
|
-
const normalized =
|
|
2422
|
+
const normalized = normalizeE164(peerId);
|
|
2415
2423
|
if (normalized) {
|
|
2416
2424
|
msg.sender = {
|
|
2417
2425
|
...msg.sender,
|
|
@@ -2447,7 +2455,7 @@ function isNonRetryableWebCloseStatus(statusCode) {
|
|
|
2447
2455
|
}
|
|
2448
2456
|
let replyResolverRuntimePromise = null;
|
|
2449
2457
|
function loadReplyResolverRuntime() {
|
|
2450
|
-
replyResolverRuntimePromise ??= import("./reply-resolver.runtime-
|
|
2458
|
+
replyResolverRuntimePromise ??= import("./reply-resolver.runtime-rIVWohXr.js");
|
|
2451
2459
|
return replyResolverRuntimePromise;
|
|
2452
2460
|
}
|
|
2453
2461
|
function normalizeReconnectAccountId(accountId) {
|
|
@@ -2822,11 +2830,13 @@ async function monitorWebChannel(verbose, listenerFactory = attachWebInboxToSock
|
|
|
2822
2830
|
await controller.shutdown();
|
|
2823
2831
|
break;
|
|
2824
2832
|
}
|
|
2833
|
+
const isWatchdogRecoveryReconnect = decision.normalized.error === WHATSAPP_WATCHDOG_TIMEOUT_ERROR;
|
|
2825
2834
|
statusController.noteClose({
|
|
2826
2835
|
statusCode: decision.normalized.statusCode,
|
|
2827
2836
|
error: decision.normalized.errorText,
|
|
2828
2837
|
reconnectAttempts: decision.reconnectAttempts,
|
|
2829
|
-
healthState: decision.healthState
|
|
2838
|
+
healthState: decision.healthState,
|
|
2839
|
+
watchdogRecovery: isWatchdogRecoveryReconnect
|
|
2830
2840
|
});
|
|
2831
2841
|
reconnectLogger.info({
|
|
2832
2842
|
connectionId: connection.connectionId,
|
|
@@ -2835,7 +2845,9 @@ async function monitorWebChannel(verbose, listenerFactory = attachWebInboxToSock
|
|
|
2835
2845
|
maxAttempts: reconnectPolicy.maxAttempts || "unlimited",
|
|
2836
2846
|
delayMs: decision.delayMs
|
|
2837
2847
|
}, "web reconnect: scheduling retry");
|
|
2838
|
-
|
|
2848
|
+
const reconnectMessage = isWatchdogRecoveryReconnect ? `WhatsApp Web watchdog is recovering a stale connection (status ${decision.normalized.statusLabel}). Retry ${decision.reconnectAttempts}/${reconnectPolicy.maxAttempts || "∞"} in ${formatDurationPrecise(decision.delayMs ?? 0)}.` : `WhatsApp Web connection closed (status ${decision.normalized.statusLabel}). Retry ${decision.reconnectAttempts}/${reconnectPolicy.maxAttempts || "∞"} in ${formatDurationPrecise(decision.delayMs ?? 0)}… (${decision.normalized.errorText})`;
|
|
2849
|
+
if (isWatchdogRecoveryReconnect) runtime.log(warn(reconnectMessage));
|
|
2850
|
+
else runtime.error(reconnectMessage);
|
|
2839
2851
|
await controller.closeCurrentConnection();
|
|
2840
2852
|
try {
|
|
2841
2853
|
await controller.waitBeforeRetry(decision.delayMs ?? 0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/
|
|
1
|
+
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
2
|
import { normalizeE164 } from "openclaw/plugin-sdk/account-resolution";
|
|
3
3
|
//#region extensions/whatsapp/src/normalize-target.ts
|
|
4
4
|
const WHATSAPP_USER_JID_RE = /^(\d+)(?::\d+)?@s\.whatsapp\.net$/i;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-
|
|
2
|
-
import { n as normalizeWhatsAppPayloadText } from "./outbound-media-contract-
|
|
3
|
-
import { t as createWhatsAppOutboundBase } from "./outbound-base-
|
|
1
|
+
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-BKcv4ofn.js";
|
|
2
|
+
import { n as normalizeWhatsAppPayloadText } from "./outbound-media-contract-zq9aNgT8.js";
|
|
3
|
+
import { t as createWhatsAppOutboundBase } from "./outbound-base-BgtywpNm.js";
|
|
4
4
|
import { shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
5
5
|
import { chunkText } from "openclaw/plugin-sdk/reply-chunking";
|
|
6
6
|
//#region extensions/whatsapp/src/outbound-adapter.ts
|
|
7
7
|
let whatsAppSendModulePromise;
|
|
8
8
|
function loadWhatsAppSendModule() {
|
|
9
|
-
whatsAppSendModulePromise ??= import("./send-
|
|
9
|
+
whatsAppSendModulePromise ??= import("./send-DBfXQDd4.js").then((n) => n.a);
|
|
10
10
|
return whatsAppSendModulePromise;
|
|
11
11
|
}
|
|
12
12
|
function normalizeOutboundText(text) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as normalizeWhatsAppPayloadText, t as normalizeWhatsAppOutboundPayload } from "./outbound-media-contract-
|
|
3
|
-
import { i as lookupInboundMessageMetaForTarget } from "./quoted-message-
|
|
1
|
+
import { p as toWhatsappJid } from "./text-runtime-CMxQczvs.js";
|
|
2
|
+
import { n as normalizeWhatsAppPayloadText, t as normalizeWhatsAppOutboundPayload } from "./outbound-media-contract-zq9aNgT8.js";
|
|
3
|
+
import { i as lookupInboundMessageMetaForTarget } from "./quoted-message-BQsRXnac.js";
|
|
4
4
|
import { DEFAULT_ACCOUNT_ID, listCombinedAccountIds, normalizeOptionalAccountId, resolveListedDefaultAccountId } from "openclaw/plugin-sdk/account-core";
|
|
5
5
|
import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
|
|
6
6
|
import { resolveOutboundSendDep } from "openclaw/plugin-sdk/outbound-send-deps";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as text_runtime_exports } from "./text-runtime-DBKC9uEi.js";
|
|
2
1
|
import { t as formatError } from "./session-errors-CSuKZPub.js";
|
|
2
|
+
import { a as sanitizeAssistantVisibleTextWithProfile, i as sanitizeAssistantVisibleText, o as sleep, s as stripToolCallXmlTags } from "./text-runtime-CMxQczvs.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS, runFfmpeg } from "openclaw/plugin-sdk/media-runtime";
|
|
5
5
|
import { sanitizeForPlainText } from "openclaw/plugin-sdk/outbound-runtime";
|
|
@@ -11,19 +11,19 @@ const WHATSAPP_VOICE_SAMPLE_RATE_HZ = 48e3;
|
|
|
11
11
|
const WHATSAPP_VOICE_BITRATE = "64k";
|
|
12
12
|
const WHATSAPP_VOICE_MIMETYPE = "audio/ogg; codecs=opus";
|
|
13
13
|
function stripWhatsAppPluralToolXml(text) {
|
|
14
|
-
return
|
|
14
|
+
return stripToolCallXmlTags(text, { stripFunctionCallsXmlPayloads: true });
|
|
15
15
|
}
|
|
16
16
|
function finalizeWhatsAppVisibleText(text) {
|
|
17
17
|
return sanitizeForPlainText(stripWhatsAppPluralToolXml(text));
|
|
18
18
|
}
|
|
19
19
|
function normalizeWhatsAppPayloadText(text) {
|
|
20
|
-
return finalizeWhatsAppVisibleText(
|
|
20
|
+
return finalizeWhatsAppVisibleText(sanitizeAssistantVisibleText(text ?? "")).trimStart();
|
|
21
21
|
}
|
|
22
22
|
function stripLeadingBlankLines(text) {
|
|
23
23
|
return text.replace(/^(?:[ \t]*\r?\n)+/, "");
|
|
24
24
|
}
|
|
25
25
|
function normalizeWhatsAppPayloadTextPreservingIndentation(text) {
|
|
26
|
-
const normalized = stripLeadingBlankLines(finalizeWhatsAppVisibleText(
|
|
26
|
+
const normalized = stripLeadingBlankLines(finalizeWhatsAppVisibleText(sanitizeAssistantVisibleTextWithProfile(stripLeadingBlankLines(text ?? ""), "history")));
|
|
27
27
|
return normalized.trim() ? normalized : "";
|
|
28
28
|
}
|
|
29
29
|
function resolveWhatsAppOutboundMediaUrls(payload) {
|
|
@@ -151,7 +151,7 @@ async function sendWhatsAppOutboundWithRetry(params) {
|
|
|
151
151
|
error,
|
|
152
152
|
errorText
|
|
153
153
|
});
|
|
154
|
-
await
|
|
154
|
+
await sleep(backoffMs);
|
|
155
155
|
}
|
|
156
156
|
throw lastError;
|
|
157
157
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as whatsappOutbound } from "./outbound-adapter-
|
|
1
|
+
import { t as whatsappOutbound } from "./outbound-adapter-Bs0e4qVd.js";
|
|
2
2
|
export { whatsappOutbound };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as resolveMergedWhatsAppAccountConfig } from "./account-config-CNQ33oav.js";
|
|
2
|
-
import { resolveReactionLevel } from "openclaw/plugin-sdk/
|
|
2
|
+
import { resolveReactionLevel } from "openclaw/plugin-sdk/status-helpers";
|
|
3
3
|
//#region extensions/whatsapp/src/reaction-level.ts
|
|
4
4
|
/** Resolve the effective reaction level and its implications for WhatsApp. */
|
|
5
5
|
function resolveWhatsAppReactionLevel(params) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as normalizeWhatsAppTarget, n as isWhatsAppNewsletterJid, t as isWhatsAppGroupJid } from "./normalize-target-
|
|
1
|
+
import { c as normalizeWhatsAppTarget, n as isWhatsAppNewsletterJid, t as isWhatsAppGroupJid } from "./normalize-target-ePanEpfY.js";
|
|
2
2
|
import { missingTargetError } from "openclaw/plugin-sdk/channel-feedback";
|
|
3
3
|
//#region extensions/whatsapp/src/resolve-outbound-target.ts
|
|
4
4
|
function whatsappAllowFromPolicyError(target) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll as t };
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { n as resolveWebCredsBackupPath, r as resolveWebCredsPath, t as hasWebCredsSync } from "./creds-files-_2V8jzQa.js";
|
|
2
|
-
import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-
|
|
2
|
+
import { n as whatsAppActionRuntime, t as handleWhatsAppAction } from "./action-runtime-lppOTCTN.js";
|
|
3
3
|
import { n as getStatusCode, t as formatError } from "./session-errors-CSuKZPub.js";
|
|
4
|
-
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-
|
|
4
|
+
import { i as sendTypingWhatsApp, n as sendPollWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./send-DBfXQDd4.js";
|
|
5
5
|
import { startWebLoginWithQr, waitForWebLogin } from "./login-qr-runtime.js";
|
|
6
|
-
import { t as createWhatsAppLoginTool } from "./agent-tools-login-
|
|
7
|
-
import { n as setWhatsAppRuntime } from "./runtime-
|
|
8
|
-
import { C as waitForCredsSaveQueueWithTimeout, S as waitForCredsSaveQueue, _ as readWebSelfIdentityForDecision, a as getWebAuthAgeMs, b as webAuthExists, c as pickWebChannel, d as readWebAuthExistsForDecision, f as readWebAuthSnapshot, g as readWebSelfIdentity, h as readWebSelfId, i as formatWhatsAppWebAuthStatusState, l as readCredsJsonRaw, m as readWebAuthState, n as WHATSAPP_AUTH_UNSTABLE_CODE, o as logWebSelfId, p as readWebAuthSnapshotBestEffort, r as WhatsAppAuthUnstableError, s as logoutWeb, t as WA_WEB_AUTH_DIR, u as readWebAuthExistsBestEffort, v as resolveDefaultWebAuthDir, w as writeCredsJsonAtomically, y as restoreCredsFromBackupIfNeeded } from "./auth-store-
|
|
9
|
-
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-
|
|
10
|
-
import { c as extractContactContext, d as extractMediaPlaceholder, p as extractText, u as extractLocationData } 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-
|
|
6
|
+
import { t as createWhatsAppLoginTool } from "./agent-tools-login-DpRxLNRB.js";
|
|
7
|
+
import { n as setWhatsAppRuntime } from "./runtime-6fZ67abR.js";
|
|
8
|
+
import { C as waitForCredsSaveQueueWithTimeout, S as waitForCredsSaveQueue, _ as readWebSelfIdentityForDecision, a as getWebAuthAgeMs, b as webAuthExists, c as pickWebChannel, d as readWebAuthExistsForDecision, f as readWebAuthSnapshot, g as readWebSelfIdentity, h as readWebSelfId, i as formatWhatsAppWebAuthStatusState, l as readCredsJsonRaw, m as readWebAuthState, n as WHATSAPP_AUTH_UNSTABLE_CODE, o as logWebSelfId, p as readWebAuthSnapshotBestEffort, r as WhatsAppAuthUnstableError, s as logoutWeb, t as WA_WEB_AUTH_DIR, u as readWebAuthExistsBestEffort, v as resolveDefaultWebAuthDir, w as writeCredsJsonAtomically, y as restoreCredsFromBackupIfNeeded } from "./auth-store-_ScMvp7r.js";
|
|
9
|
+
import { t as DEFAULT_WEB_MEDIA_BYTES } from "./constants-DLGCIbfl.js";
|
|
10
|
+
import { c as extractContactContext, d as extractMediaPlaceholder, p as extractText, u as extractLocationData } from "./send-api-DD93aPIQ.js";
|
|
11
|
+
import { n as newConnectionId, r as waitForWaConnection, t as createWaSocket } from "./session-CVCKPoQN.js";
|
|
12
|
+
import { n as resolveWebAccountId, t as getActiveWebListener } from "./active-listener-DTbKS-j-.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-DcfFBU0V.js";
|
|
14
|
+
import { t as loginWeb } from "./login-eiyCwLI5.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,4 +1,4 @@
|
|
|
1
|
-
import { isRecord } from "openclaw/plugin-sdk/
|
|
1
|
+
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
2
|
//#region extensions/whatsapp/src/security-contract.ts
|
|
3
3
|
const unsupportedSecretRefSurfacePatterns = ["channels.whatsapp.creds.json", "channels.whatsapp.accounts.*.creds.json"];
|
|
4
4
|
function collectUnsupportedSecretRefConfigCandidates(raw) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-
|
|
1
|
+
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-CvfWex9e.js";
|
|
2
2
|
export { collectUnsupportedSecretRefConfigCandidates, unsupportedSecretRefSurfacePatterns };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
|
|
2
2
|
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-DG18xddX.js";
|
|
3
|
-
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-
|
|
4
|
-
import { n as isWhatsAppNewsletterJid } from "./normalize-target-
|
|
3
|
+
import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-B4oR6Dhx.js";
|
|
4
|
+
import { n as isWhatsAppNewsletterJid } from "./normalize-target-ePanEpfY.js";
|
|
5
5
|
import { t as getRegisteredWhatsAppConnectionController } from "./connection-controller-registry-D_iIGz5m.js";
|
|
6
|
-
import "./normalize-
|
|
7
|
-
import {
|
|
6
|
+
import "./normalize-f31evwm8.js";
|
|
7
|
+
import { d as markdownToWhatsApp, p as toWhatsappJid } from "./text-runtime-CMxQczvs.js";
|
|
8
|
+
import { a as resolveWhatsAppOutboundMediaUrls, i as prepareWhatsAppOutboundMedia, n as normalizeWhatsAppPayloadText } from "./outbound-media-contract-zq9aNgT8.js";
|
|
8
9
|
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
9
10
|
import { generateSecureUuid } from "openclaw/plugin-sdk/core";
|
|
10
11
|
import { redactIdentifier } from "openclaw/plugin-sdk/logging-core";
|
|
11
12
|
import { convertMarkdownTables, resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
12
13
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
13
14
|
import { normalizePollInput } from "openclaw/plugin-sdk/poll-runtime";
|
|
14
|
-
import { createSubsystemLogger, getChildLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
15
|
+
import { createSubsystemLogger, getChildLogger as getChildLogger$1 } from "openclaw/plugin-sdk/runtime-env";
|
|
15
16
|
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
16
17
|
//#region extensions/whatsapp/src/outbound-media.runtime.ts
|
|
17
18
|
async function loadOutboundMediaFromUrl(mediaUrl, options = {}) {
|
|
@@ -77,7 +78,7 @@ async function sendMessageWhatsApp(to, body, options) {
|
|
|
77
78
|
text = convertMarkdownTables(text ?? "", tableMode);
|
|
78
79
|
text = markdownToWhatsApp(text);
|
|
79
80
|
const redactedTo = redactIdentifier(to);
|
|
80
|
-
const logger = getChildLogger({
|
|
81
|
+
const logger = getChildLogger$1({
|
|
81
82
|
module: "web-outbound",
|
|
82
83
|
correlationId,
|
|
83
84
|
to: redactedTo
|
|
@@ -156,7 +157,7 @@ async function sendReactionWhatsApp(chatJid, messageId, emoji, options) {
|
|
|
156
157
|
accountId: options.accountId
|
|
157
158
|
});
|
|
158
159
|
const redactedChatJid = redactIdentifier(chatJid);
|
|
159
|
-
const logger = getChildLogger({
|
|
160
|
+
const logger = getChildLogger$1({
|
|
160
161
|
module: "web-outbound",
|
|
161
162
|
correlationId,
|
|
162
163
|
chatJid: redactedChatJid,
|
|
@@ -195,7 +196,7 @@ async function sendPollWhatsApp(to, poll, options) {
|
|
|
195
196
|
accountId: options.accountId
|
|
196
197
|
});
|
|
197
198
|
const redactedTo = redactIdentifier(to);
|
|
198
|
-
const logger = getChildLogger({
|
|
199
|
+
const logger = getChildLogger$1({
|
|
199
200
|
module: "web-outbound",
|
|
200
201
|
correlationId,
|
|
201
202
|
to: redactedTo
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import { t as buildQuotedMessageOptions } from "./quoted-message-
|
|
5
|
-
import { c as resolveComparableIdentity } from "./identity-
|
|
6
|
-
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/
|
|
1
|
+
import { n as isWhatsAppNewsletterJid } from "./normalize-target-ePanEpfY.js";
|
|
2
|
+
import "./normalize-f31evwm8.js";
|
|
3
|
+
import { m as toWhatsappJidWithLid, p as toWhatsappJid, u as jidToE164 } from "./text-runtime-CMxQczvs.js";
|
|
4
|
+
import { t as buildQuotedMessageOptions } from "./quoted-message-BQsRXnac.js";
|
|
5
|
+
import { c as resolveComparableIdentity } from "./identity-BNDkpR8N.js";
|
|
6
|
+
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
8
8
|
import { createMessageReceiptFromOutboundResults, listMessageReceiptPlatformIds } from "openclaw/plugin-sdk/channel-message";
|
|
9
|
-
import { extractMessageContent, getContentType, normalizeMessageContent } from "
|
|
9
|
+
import { extractMessageContent, getContentType, normalizeMessageContent } from "baileys";
|
|
10
10
|
import { formatLocationText } from "openclaw/plugin-sdk/channel-inbound";
|
|
11
11
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
12
12
|
//#region extensions/whatsapp/src/vcard.ts
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { n as resolveWebCredsBackupPath, r as resolveWebCredsPath } from "./creds-files-_2V8jzQa.js";
|
|
2
2
|
import { n as getStatusCode } from "./session-errors-CSuKZPub.js";
|
|
3
|
-
import { C as waitForCredsSaveQueueWithTimeout, l as readCredsJsonRaw, v as resolveDefaultWebAuthDir, w as writeCredsJsonAtomically, x as enqueueCredsSave, y as restoreCredsFromBackupIfNeeded } from "./auth-store-
|
|
4
|
-
import { i as makeWASocket, n as fetchLatestBaileysVersion, o as useMultiFileAuthState, r as makeCacheableSignalKeyStore, t as DisconnectReason } from "./session.runtime-
|
|
3
|
+
import { C as waitForCredsSaveQueueWithTimeout, l as readCredsJsonRaw, v as resolveDefaultWebAuthDir, w as writeCredsJsonAtomically, x as enqueueCredsSave, y as restoreCredsFromBackupIfNeeded } from "./auth-store-_ScMvp7r.js";
|
|
4
|
+
import { i as makeWASocket, n as fetchLatestBaileysVersion, o as useMultiFileAuthState, r as makeCacheableSignalKeyStore, t as DisconnectReason } from "./session.runtime-CZQ0ycCg.js";
|
|
5
5
|
import fs from "node:fs";
|
|
6
|
-
import { ensureDir, resolveUserPath } from "openclaw/plugin-sdk/text-runtime";
|
|
7
6
|
import { VERSION, formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
|
|
8
|
-
import { danger, getChildLogger
|
|
7
|
+
import { danger, getChildLogger, success, toPinoLikeLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
9
8
|
import { renderQrTerminal } from "openclaw/plugin-sdk/media-runtime";
|
|
9
|
+
import { ensureDir, resolveUserPath } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
10
10
|
import { randomUUID } from "node:crypto";
|
|
11
11
|
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
12
12
|
import { resolveEnvHttpProxyUrl, shouldUseEnvHttpProxyForUrl } from "openclaw/plugin-sdk/fetch-runtime";
|
|
@@ -65,10 +65,10 @@ async function printTerminalQr(qr) {
|
|
|
65
65
|
* Consumers can opt into QR printing for interactive login flows.
|
|
66
66
|
*/
|
|
67
67
|
async function createWaSocket(printQr, verbose, opts = {}) {
|
|
68
|
-
const logger = toPinoLikeLogger(getChildLogger
|
|
68
|
+
const logger = toPinoLikeLogger(getChildLogger({ module: "baileys" }, { level: verbose ? "info" : "silent" }), verbose ? "info" : "silent");
|
|
69
69
|
const authDir = resolveUserPath(opts.authDir ?? resolveDefaultWebAuthDir());
|
|
70
70
|
await ensureDir(authDir);
|
|
71
|
-
const sessionLogger = getChildLogger
|
|
71
|
+
const sessionLogger = getChildLogger({ module: "web-session" });
|
|
72
72
|
if (await waitForCredsSaveQueueWithTimeout(authDir) === "timed_out") sessionLogger.warn({ authDir }, CREDS_FLUSH_TIMEOUT_MESSAGE);
|
|
73
73
|
else await restoreCredsFromBackupIfNeeded(authDir);
|
|
74
74
|
const { state } = await useMultiFileAuthState(authDir);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BufferJSON, DisconnectReason as DisconnectReason$1, fetchLatestBaileysVersion, makeCacheableSignalKeyStore, makeWASocket, useMultiFileAuthState } from "
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
|
|
2
|
+
import { BufferJSON, DisconnectReason as DisconnectReason$1, fetchLatestBaileysVersion, makeCacheableSignalKeyStore, makeWASocket, useMultiFileAuthState } from "baileys";
|
|
3
3
|
//#region extensions/whatsapp/src/session.runtime.ts
|
|
4
4
|
var session_runtime_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
BufferJSON: () => BufferJSON,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-DG18xddX.js";
|
|
2
|
-
import { a as resolveWhatsAppAccount, o as resolveWhatsAppAuthDir } from "./accounts-
|
|
3
|
-
import { a as normalizeWhatsAppAllowFromEntries, o as normalizeWhatsAppAllowFromEntry } from "./normalize-target-
|
|
4
|
-
import { t as whatsappSetupAdapter } from "./setup-core-
|
|
2
|
+
import { a as resolveWhatsAppAccount, o as resolveWhatsAppAuthDir } from "./accounts-B4oR6Dhx.js";
|
|
3
|
+
import { a as normalizeWhatsAppAllowFromEntries, o as normalizeWhatsAppAllowFromEntry } from "./normalize-target-ePanEpfY.js";
|
|
4
|
+
import { t as whatsappSetupAdapter } from "./setup-core-DZKvpzbH.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { DEFAULT_ACCOUNT_ID, pathExists, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
7
7
|
import { formatCliCommand, formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
|
|
@@ -279,7 +279,7 @@ async function finalizeWhatsAppSetup(params) {
|
|
|
279
279
|
message: linked ? "WhatsApp already linked. Re-link now?" : "Link WhatsApp now (QR)?",
|
|
280
280
|
initialValue: !linked
|
|
281
281
|
})) try {
|
|
282
|
-
const { loginWeb } = await import("./login-
|
|
282
|
+
const { loginWeb } = await import("./login-eiyCwLI5.js").then((n) => n.n);
|
|
283
283
|
await loginWeb(false, void 0, params.runtime, accountId);
|
|
284
284
|
} catch (error) {
|
|
285
285
|
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-k1Ro0czO.js";
|
|
2
2
|
export { whatsappSetupPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as listAccountIds } from "./account-ids-DG18xddX.js";
|
|
2
|
-
import { o as resolveWhatsAppAuthDir } from "./accounts-
|
|
3
|
-
import { i as formatWhatsAppWebAuthStatusState, m as readWebAuthState } from "./auth-store-
|
|
2
|
+
import { o as resolveWhatsAppAuthDir } from "./accounts-B4oR6Dhx.js";
|
|
3
|
+
import { i as formatWhatsAppWebAuthStatusState, m as readWebAuthState } from "./auth-store-_ScMvp7r.js";
|
|
4
4
|
import { DEFAULT_ACCOUNT_ID, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
|
|
5
5
|
//#region extensions/whatsapp/src/setup-surface.ts
|
|
6
6
|
const channel = "whatsapp";
|
|
@@ -35,7 +35,7 @@ const whatsappSetupWizard = {
|
|
|
35
35
|
},
|
|
36
36
|
resolveShouldPromptAccountIds: ({ shouldPromptAccountIds }) => shouldPromptAccountIds,
|
|
37
37
|
credentials: [],
|
|
38
|
-
finalize: async (params) => await (await import("./setup-finalize-
|
|
38
|
+
finalize: async (params) => await (await import("./setup-finalize-WYnZjedw.js")).finalizeWhatsAppSetup(params),
|
|
39
39
|
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false),
|
|
40
40
|
onAccountRecorded: (accountId, options) => {
|
|
41
41
|
options?.onAccountId?.(channel, accountId);
|